diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index 880359f21ddabcdecd553efcfa6571e06fb28770..93609a8852db91c918cfeec3bcda861575e4ec59 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -647,7 +647,7 @@ void ClangdLSPServer::onDocumentDidChange( return; } - Server->addDocument(File, *Contents, WantDiags); + Server->addDocument(File, *Contents, WantDiags, Params.forceRebuild); } void ClangdLSPServer::onFileEvent(const DidChangeWatchedFilesParams &Params) { diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index 3e22a4dfe6675b4594d285679bde6ec84b296ca0..48cf921ff18cf6dd323ebaa3b0ecd3d03e40e1f4 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -170,7 +170,7 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB, } void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents, - WantDiagnostics WantDiags) { + WantDiagnostics WantDiags, bool ForceRebuild) { auto FS = FSProvider.getFileSystem(); ParseOptions Opts; @@ -184,6 +184,7 @@ void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents, ParseInputs Inputs; Inputs.FS = FS; Inputs.Contents = std::string(Contents); + Inputs.ForceRebuild = ForceRebuild; Inputs.Opts = std::move(Opts); Inputs.Index = Index; bool NewFile = WorkScheduler.update(File, Inputs, WantDiags); diff --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h index 3c3505295a75f90fc98a9e38035a1b963ec12d61..5156520e2d078e9f4e369c6667653ee1347ae630 100644 --- a/clang-tools-extra/clangd/ClangdServer.h +++ b/clang-tools-extra/clangd/ClangdServer.h @@ -172,7 +172,8 @@ public: /// separate thread. When the parsing is complete, DiagConsumer passed in /// constructor will receive onDiagnosticsReady callback. void addDocument(PathRef File, StringRef Contents, - WantDiagnostics WD = WantDiagnostics::Auto); + WantDiagnostics WD = WantDiagnostics::Auto, + bool ForceRebuild = false); /// Get the contents of \p File, which should have been added. llvm::StringRef getDocument(PathRef File) const; diff --git a/clang-tools-extra/clangd/Compiler.h b/clang-tools-extra/clangd/Compiler.h index 51414c37fc042a2c607ec9fe4fb69f000ebbd6e7..356293b158f8b5c20c4f94ce520ae321d5be6544 100644 --- a/clang-tools-extra/clangd/Compiler.h +++ b/clang-tools-extra/clangd/Compiler.h @@ -45,6 +45,9 @@ struct ParseInputs { tooling::CompileCommand CompileCommand; IntrusiveRefCntPtr FS; std::string Contents; + // Prevent reuse of the cached preamble/AST. Slow! Useful to workaround + // clangd's assumption that missing header files will stay missing. + bool ForceRebuild = false; // Used to recover from diagnostics (e.g. find missing includes for symbol). const SymbolIndex *Index = nullptr; ParseOptions Opts; diff --git a/clang-tools-extra/clangd/Protocol.cpp b/clang-tools-extra/clangd/Protocol.cpp index aabf0fa11d45bab2b09eaca9d7f63270cfe1083a..d607ffbbc8157228e0399f8630a3ef4c2bd0e89f 100644 --- a/clang-tools-extra/clangd/Protocol.cpp +++ b/clang-tools-extra/clangd/Protocol.cpp @@ -430,7 +430,10 @@ bool fromJSON(const llvm::json::Value &Params, DidCloseTextDocumentParams &R) { bool fromJSON(const llvm::json::Value &Params, DidChangeTextDocumentParams &R) { llvm::json::ObjectMapper O(Params); - return O && O.map("textDocument", R.textDocument) && + if (!O) + return false; + O.map("forceRebuild", R.forceRebuild); // Optional clangd extension. + return O.map("textDocument", R.textDocument) && O.map("contentChanges", R.contentChanges) && O.map("wantDiagnostics", R.wantDiagnostics); } diff --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h index 255629f0a0ecc15eb0c7f521cd9ea5f42a5f062a..3275cbbd17b1291b3edf027458c8685364e2b8c3 100644 --- a/clang-tools-extra/clangd/Protocol.h +++ b/clang-tools-extra/clangd/Protocol.h @@ -652,6 +652,12 @@ struct DidChangeTextDocumentParams { /// either they will be provided for this version or some subsequent one. /// This is a clangd extension. llvm::Optional wantDiagnostics; + + /// Force a complete rebuild of the file, ignoring all cached state. Slow! + /// This is useful to defeat clangd's assumption that missing headers will + /// stay missing. + /// This is a clangd extension. + bool forceRebuild = false; }; bool fromJSON(const llvm::json::Value &, DidChangeTextDocumentParams &); diff --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp index 12a0623782025964cdcf1d5ab978d3ffbe2fb3ab..5a1caa96452095dc325c1cd76470c8c402722d0c 100644 --- a/clang-tools-extra/clangd/TUScheduler.cpp +++ b/clang-tools-extra/clangd/TUScheduler.cpp @@ -436,7 +436,8 @@ void ASTWorker::update(ParseInputs Inputs, WantDiagnostics WantDiags) { } std::shared_ptr OldPreamble = - getPossiblyStalePreamble(); + Inputs.ForceRebuild ? std::shared_ptr() + : getPossiblyStalePreamble(); std::shared_ptr NewPreamble = buildPreamble( FileName, *Invocation, OldPreamble, OldCommand, Inputs, StorePreambleInMemory, diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp index 1d2ea0f1c0b285216356ebc8511e2c69ab134454..be4b37c8f453b1bba905330b03b04e18cd6a46ee 100644 --- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp +++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp @@ -823,6 +823,10 @@ TEST_F(FindExplicitReferencesTest, All) { "1: targets = {vector}\n" "2: targets = {x}\n"}, // Handle UnresolvedLookupExpr. + // FIXME + // This case fails when expensive checks are enabled. + // Seems like the order of ns1::func and ns2::func isn't defined. + #ifndef EXPENSIVE_CHECKS {R"cpp( namespace ns1 { void func(char*); } namespace ns2 { void func(int*); } @@ -836,6 +840,7 @@ TEST_F(FindExplicitReferencesTest, All) { )cpp", "0: targets = {ns1::func, ns2::func}\n" "1: targets = {t}\n"}, + #endif // Handle UnresolvedMemberExpr. {R"cpp( struct X { diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp index 6605ccf65860f18f4545904087834ea9578317f2..2140997679904b2ed663081feecefd63b21605ae 100644 --- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp +++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp @@ -616,6 +616,53 @@ TEST_F(TUSchedulerTests, NoopOnEmptyChanges) { ASSERT_FALSE(DoUpdate(OtherSourceContents)); } +TEST_F(TUSchedulerTests, ForceRebuild) { + TUScheduler S(CDB, optsForTest(), captureDiags()); + + auto Source = testPath("foo.cpp"); + auto Header = testPath("foo.h"); + + auto SourceContents = R"cpp( + #include "foo.h" + int b = a; + )cpp"; + + ParseInputs Inputs = getInputs(Source, SourceContents); + + // Update the source contents, which should trigger an initial build with + // the header file missing. + updateWithDiags(S, Source, Inputs, WantDiagnostics::Yes, + [](std::vector Diags) { + EXPECT_THAT( + Diags, + ElementsAre( + Field(&Diag::Message, "'foo.h' file not found"), + Field(&Diag::Message, "use of undeclared identifier 'a'"))); + }); + + // Add the header file. We need to recreate the inputs since we changed a + // file from underneath the test FS. + Files[Header] = "int a;"; + Timestamps[Header] = time_t(1); + Inputs = getInputs(Source, SourceContents); + + // The addition of the missing header file shouldn't trigger a rebuild since + // we don't track missing files. + updateWithDiags(S, Source, Inputs, WantDiagnostics::Yes, + [](std::vector Diags) { + ADD_FAILURE() << "Did not expect diagnostics for missing header update"; + }); + + // Forcing the reload should should cause a rebuild which no longer has any + // errors. + Inputs.ForceRebuild = true; + updateWithDiags(S, Source, Inputs, WantDiagnostics::Yes, + [](std::vector Diags) { + EXPECT_THAT(Diags, IsEmpty()); + }); + + ASSERT_TRUE(S.blockUntilIdle(timeoutSeconds(10))); +} TEST_F(TUSchedulerTests, NoChangeDiags) { TUScheduler S(CDB, optsForTest(), captureDiags()); @@ -722,7 +769,8 @@ TEST_F(TUSchedulerTests, CommandLineErrors) { TUScheduler S(CDB, optsForTest(), captureDiags()); std::vector Diagnostics; updateWithDiags(S, testPath("foo.cpp"), "void test() {}", - WantDiagnostics::Yes, [&](std::vector D) { + WantDiagnostics::Yes, + [&](std::vector D) { Diagnostics = std::move(D); Ready.notify(); }); @@ -746,7 +794,8 @@ TEST_F(TUSchedulerTests, CommandLineWarnings) { TUScheduler S(CDB, optsForTest(), captureDiags()); std::vector Diagnostics; updateWithDiags(S, testPath("foo.cpp"), "void test() {}", - WantDiagnostics::Yes, [&](std::vector D) { + WantDiagnostics::Yes, + [&](std::vector D) { Diagnostics = std::move(D); Ready.notify(); }); diff --git a/clang/docs/Block-ABI-Apple.rst b/clang/docs/Block-ABI-Apple.rst index 0cc14a35b033401aa3f7c2aa8eae0714305a3090..d038cdfe9bd20b302cd22497e9ac4180334185a8 100644 --- a/clang/docs/Block-ABI-Apple.rst +++ b/clang/docs/Block-ABI-Apple.rst @@ -63,7 +63,7 @@ The following flags bits are in use thusly for a possible ABI.2010.3.16: enum { // Set to true on blocks that have captures (and thus are not true // global blocks) but are known not to escape for various other - // reasons. For backward compatiblity with old runtimes, whenever + // reasons. For backward compatibility with old runtimes, whenever // BLOCK_IS_NOESCAPE is set, BLOCK_IS_GLOBAL is set too. Copying a // non-escaping block returns the original block and releasing such a // block is a no-op, which is exactly how global blocks are handled. diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 9af49e3a60d7c1380a203626853a8d53369577d5..adef8bb433a1e2c9adcac8c4697a7e59434d9d25 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2145,7 +2145,7 @@ Checked Arithmetic Builtins --------------------------- Clang provides a set of builtins that implement checked arithmetic for security -critical applications in a manner that is fast and easily expressable in C. As +critical applications in a manner that is fast and easily expressible in C. As an example of their usage: .. code-block:: c @@ -2538,7 +2538,7 @@ pointers and integers. These builtins can be used to avoid relying on implementation-defined behavior of arithmetic on integers derived from pointers. Additionally, these builtins retain type information and, unlike bitwise -arithmentic, they can perform semantic checking on the alignment value. +arithmetic, they can perform semantic checking on the alignment value. **Syntax**: diff --git a/clang/docs/SourceBasedCodeCoverage.rst b/clang/docs/SourceBasedCodeCoverage.rst index 1575e4faaa01d83201b6d26176d4566cd8f1571e..0e9c364fbf6bd29e077e6fbc349f84775c723edc 100644 --- a/clang/docs/SourceBasedCodeCoverage.rst +++ b/clang/docs/SourceBasedCodeCoverage.rst @@ -107,14 +107,14 @@ relies on padding and the ability to map a file over the existing memory mapping which is generally only available on POSIX systems and isn't suitable for other platforms. -On Fuchsia, we rely on the the ability to relocate counters at runtime using a +On Fuchsia, we rely on the ability to relocate counters at runtime using a level of indirection. On every counter access, we add a bias to the counter address. This bias is stored in ``__llvm_profile_counter_bias`` symbol that's provided by the profile runtime and is initially set to zero, meaning no -relocation. The runtime can map the profile into memory at abitrary location, +relocation. The runtime can map the profile into memory at arbitrary locations, and set bias to the offset between the original and the new counter location, at which point every subsequent counter access will be to the new location, -which allows updating profile directly akin to the continous mode. +which allows updating profile directly akin to the continuous mode. The advantage of this approach is that doesn't require any special OS support. The disadvantage is the extra overhead due to additional instructions required diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h index f0dddf729309f4b023a29855d67c5879fbf1d327..19a84bd00a36dec33411913cd064d8471f5e6fcb 100644 --- a/clang/include/clang/AST/OpenMPClause.h +++ b/clang/include/clang/AST/OpenMPClause.h @@ -1882,7 +1882,7 @@ public: /// #pragma omp flush acq_rel /// \endcode /// In this example directive '#pragma omp flush' has 'acq_rel' clause. -class OMPAcqRelClause : public OMPClause { +class OMPAcqRelClause final : public OMPClause { public: /// Build 'ack_rel' clause. /// @@ -1915,6 +1915,86 @@ public: } }; +/// This represents 'acquire' clause in the '#pragma omp atomic|flush' +/// directives. +/// +/// \code +/// #pragma omp flush acquire +/// \endcode +/// In this example directive '#pragma omp flush' has 'acquire' clause. +class OMPAcquireClause final : public OMPClause { +public: + /// Build 'acquire' clause. + /// + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + OMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPClause(OMPC_acquire, StartLoc, EndLoc) {} + + /// Build an empty clause. + OMPAcquireClause() + : OMPClause(OMPC_acquire, SourceLocation(), SourceLocation()) {} + + child_range children() { + return child_range(child_iterator(), child_iterator()); + } + + const_child_range children() const { + return const_child_range(const_child_iterator(), const_child_iterator()); + } + + child_range used_children() { + return child_range(child_iterator(), child_iterator()); + } + const_child_range used_children() const { + return const_child_range(const_child_iterator(), const_child_iterator()); + } + + static bool classof(const OMPClause *T) { + return T->getClauseKind() == OMPC_acquire; + } +}; + +/// This represents 'release' clause in the '#pragma omp atomic|flush' +/// directives. +/// +/// \code +/// #pragma omp flush release +/// \endcode +/// In this example directive '#pragma omp flush' has 'release' clause. +class OMPReleaseClause final : public OMPClause { +public: + /// Build 'release' clause. + /// + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc) + : OMPClause(OMPC_release, StartLoc, EndLoc) {} + + /// Build an empty clause. + OMPReleaseClause() + : OMPClause(OMPC_release, SourceLocation(), SourceLocation()) {} + + child_range children() { + return child_range(child_iterator(), child_iterator()); + } + + const_child_range children() const { + return const_child_range(const_child_iterator(), const_child_iterator()); + } + + child_range used_children() { + return child_range(child_iterator(), child_iterator()); + } + const_child_range used_children() const { + return const_child_range(const_child_iterator(), const_child_iterator()); + } + + static bool classof(const OMPClause *T) { + return T->getClauseKind() == OMPC_release; + } +}; + /// This represents clause 'private' in the '#pragma omp ...' directives. /// /// \code diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index d8e6fb6e0254cd47ee5ab293c9711fb45852d591..4ef9528dcf5bb8c076bb421bb3a9c8c183495705 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -3126,6 +3126,16 @@ bool RecursiveASTVisitor::VisitOMPAcqRelClause(OMPAcqRelClause *) { return true; } +template +bool RecursiveASTVisitor::VisitOMPAcquireClause(OMPAcquireClause *) { + return true; +} + +template +bool RecursiveASTVisitor::VisitOMPReleaseClause(OMPReleaseClause *) { + return true; +} + template bool RecursiveASTVisitor::VisitOMPThreadsClause(OMPThreadsClause *) { return true; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index b5367a0bfc9af1011dee289d4a6e250c94e52f2c..31f73490f4e331d8a61a963210427468c7a97999 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9695,9 +9695,9 @@ def note_omp_atomic_capture: Note< "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">; def err_omp_atomic_several_clauses : Error< "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">; -def err_omp_atomic_several_mem_order_clauses : Error< - "directive '#pragma omp atomic' cannot contain more than one 'seq_cst' or 'acq_rel' clause">; -def note_omp_atomic_previous_clause : Note< +def err_omp_several_mem_order_clauses : Error< + "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', |}1'acq_rel', 'acquire' or 'release' clause">; +def note_omp_previous_mem_order_clause : Note< "'%0' clause used here">; def err_omp_target_contains_not_only_teams : Error< "target construct with nested teams region contains statements outside of the teams construct">; diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def index 0d7d952a49d6d0bd0e0cfc4ca9d6b4b7635ada41..19fcf7cfac58cd9244aa60610b2c5f8210194da4 100644 --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -258,6 +258,8 @@ OPENMP_CLAUSE(update, OMPUpdateClause) OPENMP_CLAUSE(capture, OMPCaptureClause) OPENMP_CLAUSE(seq_cst, OMPSeqCstClause) OPENMP_CLAUSE(acq_rel, OMPAcqRelClause) +OPENMP_CLAUSE(acquire, OMPAcquireClause) +OPENMP_CLAUSE(release, OMPReleaseClause) OPENMP_CLAUSE(depend, OMPDependClause) OPENMP_CLAUSE(device, OMPDeviceClause) OPENMP_CLAUSE(threads, OMPThreadsClause) @@ -491,6 +493,8 @@ OPENMP_ATOMIC_CLAUSE(update) OPENMP_ATOMIC_CLAUSE(capture) OPENMP_ATOMIC_CLAUSE(seq_cst) OPENMP_ATOMIC_CLAUSE(acq_rel) +OPENMP_ATOMIC_CLAUSE(acquire) +OPENMP_ATOMIC_CLAUSE(release) // Clauses allowed for OpenMP directive 'target'. OPENMP_TARGET_CLAUSE(if) @@ -1089,6 +1093,8 @@ OPENMP_ORDER_KIND(concurrent) // Clauses allowed for OpenMP directive 'flush'. OPENMP_FLUSH_CLAUSE(acq_rel) +OPENMP_FLUSH_CLAUSE(acquire) +OPENMP_FLUSH_CLAUSE(release) #undef OPENMP_FLUSH_CLAUSE #undef OPENMP_ORDER_KIND diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 52137af4d67b376ab245524cd32ca35756eabb5b..1b9f3b95c25fec3f3149a6770bd9253d8cbcb8fc 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -10331,6 +10331,12 @@ public: /// Called on well-formed 'acq_rel' clause. OMPClause *ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc); + /// Called on well-formed 'acquire' clause. + OMPClause *ActOnOpenMPAcquireClause(SourceLocation StartLoc, + SourceLocation EndLoc); + /// Called on well-formed 'release' clause. + OMPClause *ActOnOpenMPReleaseClause(SourceLocation StartLoc, + SourceLocation EndLoc); /// Called on well-formed 'threads' clause. OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc); diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp index b1f9ad17f708bf8b63c558d02947394acc525ca2..2947665981aff6f39f8b61ea417b88f07bf502b5 100644 --- a/clang/lib/AST/OpenMPClause.cpp +++ b/clang/lib/AST/OpenMPClause.cpp @@ -117,6 +117,8 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) { case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_threads: case OMPC_simd: @@ -192,6 +194,8 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C) case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_device: case OMPC_threads: @@ -1340,6 +1344,14 @@ void OMPClausePrinter::VisitOMPAcqRelClause(OMPAcqRelClause *) { OS << "acq_rel"; } +void OMPClausePrinter::VisitOMPAcquireClause(OMPAcquireClause *) { + OS << "acquire"; +} + +void OMPClausePrinter::VisitOMPReleaseClause(OMPReleaseClause *) { + OS << "release"; +} + void OMPClausePrinter::VisitOMPThreadsClause(OMPThreadsClause *) { OS << "threads"; } diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index a39bc9af3b03a11f018f11e63e86614e67099d68..b303851a75c6f588c7a768df465748886778fe9c 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -19,6 +19,7 @@ #include "clang/AST/ExprObjC.h" #include "clang/AST/ExprOpenMP.h" #include "clang/AST/ODRHash.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/StmtVisitor.h" #include "llvm/ADT/FoldingSet.h" using namespace clang; @@ -519,6 +520,10 @@ void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {} +void OMPClauseProfiler::VisitOMPAcquireClause(const OMPAcquireClause *) {} + +void OMPClauseProfiler::VisitOMPReleaseClause(const OMPReleaseClause *) {} + void OMPClauseProfiler::VisitOMPThreadsClause(const OMPThreadsClause *) {} void OMPClauseProfiler::VisitOMPSIMDClause(const OMPSIMDClause *) {} diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp index 8937e879af2b8e44a7037367c945a0d58d306140..124723552af4c9564c520959c6de162cbdfa58d3 100644 --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/lib/Basic/OpenMPKinds.cpp @@ -215,6 +215,8 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_device: case OMPC_threads: case OMPC_simd: @@ -428,6 +430,8 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind, case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_device: case OMPC_threads: case OMPC_simd: @@ -593,7 +597,8 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, } break; case OMPD_atomic: - if (OpenMPVersion < 50 && CKind == OMPC_acq_rel) + if (OpenMPVersion < 50 && (CKind == OMPC_acq_rel || CKind == OMPC_acquire || + CKind == OMPC_release)) return false; switch (CKind) { #define OPENMP_ATOMIC_CLAUSE(Name) \ diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index cd5bbbbf7c05e0bb2ecade648eb3fda7c9f23d3e..bc71c27fd95f7416ec5f5e72138399802c36978e 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -4492,6 +4492,8 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind, case OMPC_default: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_shared: case OMPC_linear: case OMPC_aligned: @@ -4543,11 +4545,18 @@ void CodeGenFunction::EmitOMPAtomicDirective(const OMPAtomicDirective &S) { AO = llvm::AtomicOrdering::SequentiallyConsistent; else if (S.getSingleClause()) AO = llvm::AtomicOrdering::AcquireRelease; + else if (S.getSingleClause()) + AO = llvm::AtomicOrdering::Acquire; + else if (S.getSingleClause()) + AO = llvm::AtomicOrdering::Release; OpenMPClauseKind Kind = OMPC_unknown; for (const OMPClause *C : S.clauses()) { - // Find first clause (skip seq_cst|acq_rel clause, if it is first). + // Find first clause (skip seq_cst|acq_rel|aqcuire|release clause, if it is + // first). if (C->getClauseKind() != OMPC_seq_cst && - C->getClauseKind() != OMPC_acq_rel) { + C->getClauseKind() != OMPC_acq_rel && + C->getClauseKind() != OMPC_acquire && + C->getClauseKind() != OMPC_release) { Kind = C->getClauseKind(); break; } diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 9034726560dc87899ddd9fa7a607925463a8cf73..a51745697b115290e8adee98df569f0245a0573b 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2552,8 +2552,8 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr, '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/', '/' }; - while (CurPtr+16 <= BufferEnd && - !vec_any_eq(*(const vector unsigned char*)CurPtr, Slashes)) + while (CurPtr + 16 <= BufferEnd && + !vec_any_eq(*(const __vector unsigned char *)CurPtr, Slashes)) CurPtr += 16; #else // Scan for '/' quickly. Many block comments are very large. diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index 8ac0471b18066b7a2c1a64c571413142bf805d66..1a7916e5adb865ff7f60b17b787f3db9c3fcf6c7 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -2090,7 +2090,7 @@ bool Parser::ParseOpenMPSimpleVarList( /// nogroup-clause | num_tasks-clause | hint-clause | to-clause | /// from-clause | is_device_ptr-clause | task_reduction-clause | /// in_reduction-clause | allocator-clause | allocate-clause | -/// acq_rel-clause +/// acq_rel-clause | acquire-clause | release-clause /// OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, OpenMPClauseKind CKind, bool FirstClause) { @@ -2200,6 +2200,8 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind, case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_threads: case OMPC_simd: case OMPC_nogroup: diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index aa619710c4ef29bc4f4fe746a4fd8109026ed30e..2e3c75fed37017cda6ec52c43e7f712cf6d56031 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -4988,6 +4988,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_threads: case OMPC_simd: @@ -8571,6 +8573,24 @@ StmtResult Sema::ActOnOpenMPFlushDirective(ArrayRef Clauses, else OrderClause = C; } + OpenMPClauseKind MemOrderKind = OMPC_unknown; + SourceLocation MemOrderLoc; + for (const OMPClause *C : Clauses) { + if (C->getClauseKind() == OMPC_acq_rel || + C->getClauseKind() == OMPC_acquire || + C->getClauseKind() == OMPC_release) { + if (MemOrderKind != OMPC_unknown) { + Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses) + << getOpenMPDirectiveName(OMPD_flush) << 1 + << SourceRange(C->getBeginLoc(), C->getEndLoc()); + Diag(MemOrderLoc, diag::note_omp_previous_mem_order_clause) + << getOpenMPClauseName(MemOrderKind); + } else { + MemOrderKind = C->getClauseKind(); + MemOrderLoc = C->getBeginLoc(); + } + } + } if (FC && OrderClause) { Diag(FC->getLParenLoc(), diag::err_omp_flush_order_clause_and_list) << getOpenMPClauseName(OrderClause->getClauseKind()); @@ -8925,7 +8945,7 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses, if (AtomicKind != OMPC_unknown) { Diag(C->getBeginLoc(), diag::err_omp_atomic_several_clauses) << SourceRange(C->getBeginLoc(), C->getEndLoc()); - Diag(AtomicKindLoc, diag::note_omp_atomic_previous_clause) + Diag(AtomicKindLoc, diag::note_omp_previous_mem_order_clause) << getOpenMPClauseName(AtomicKind); } else { AtomicKind = C->getClauseKind(); @@ -8933,11 +8953,14 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef Clauses, } } if (C->getClauseKind() == OMPC_seq_cst || - C->getClauseKind() == OMPC_acq_rel) { + C->getClauseKind() == OMPC_acq_rel || + C->getClauseKind() == OMPC_acquire || + C->getClauseKind() == OMPC_release) { if (MemOrderKind != OMPC_unknown) { - Diag(C->getBeginLoc(), diag::err_omp_atomic_several_mem_order_clauses) + Diag(C->getBeginLoc(), diag::err_omp_several_mem_order_clauses) + << getOpenMPDirectiveName(OMPD_atomic) << 0 << SourceRange(C->getBeginLoc(), C->getEndLoc()); - Diag(MemOrderLoc, diag::note_omp_atomic_previous_clause) + Diag(MemOrderLoc, diag::note_omp_previous_mem_order_clause) << getOpenMPClauseName(MemOrderKind); } else { MemOrderKind = C->getClauseKind(); @@ -10871,6 +10894,8 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_threads: case OMPC_simd: @@ -11584,6 +11609,8 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_threads: case OMPC_simd: @@ -12007,6 +12034,8 @@ OMPClause *Sema::ActOnOpenMPSimpleClause( case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_device: case OMPC_threads: @@ -12208,6 +12237,8 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause( case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_depend: case OMPC_device: case OMPC_threads: @@ -12384,6 +12415,12 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind, case OMPC_acq_rel: Res = ActOnOpenMPAcqRelClause(StartLoc, EndLoc); break; + case OMPC_acquire: + Res = ActOnOpenMPAcquireClause(StartLoc, EndLoc); + break; + case OMPC_release: + Res = ActOnOpenMPReleaseClause(StartLoc, EndLoc); + break; case OMPC_threads: Res = ActOnOpenMPThreadsClause(StartLoc, EndLoc); break; @@ -12502,6 +12539,16 @@ OMPClause *Sema::ActOnOpenMPAcqRelClause(SourceLocation StartLoc, return new (Context) OMPAcqRelClause(StartLoc, EndLoc); } +OMPClause *Sema::ActOnOpenMPAcquireClause(SourceLocation StartLoc, + SourceLocation EndLoc) { + return new (Context) OMPAcquireClause(StartLoc, EndLoc); +} + +OMPClause *Sema::ActOnOpenMPReleaseClause(SourceLocation StartLoc, + SourceLocation EndLoc) { + return new (Context) OMPReleaseClause(StartLoc, EndLoc); +} + OMPClause *Sema::ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc) { return new (Context) OMPThreadsClause(StartLoc, EndLoc); @@ -12659,6 +12706,8 @@ OMPClause *Sema::ActOnOpenMPVarListClause( case OMPC_capture: case OMPC_seq_cst: case OMPC_acq_rel: + case OMPC_acquire: + case OMPC_release: case OMPC_device: case OMPC_threads: case OMPC_simd: diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index bd0df005f60b4d92805ab346782ccf5cf5536a97..dffaf893862798747e8054f1800c7bb8069151f6 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -8811,6 +8811,20 @@ TreeTransform::TransformOMPAcqRelClause(OMPAcqRelClause *C) { return C; } +template +OMPClause * +TreeTransform::TransformOMPAcquireClause(OMPAcquireClause *C) { + // No need to rebuild this clause, no template-dependent parameters. + return C; +} + +template +OMPClause * +TreeTransform::TransformOMPReleaseClause(OMPReleaseClause *C) { + // No need to rebuild this clause, no template-dependent parameters. + return C; +} + template OMPClause * TreeTransform::TransformOMPThreadsClause(OMPThreadsClause *C) { diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index c25ce494231630c7ab3c4bdebe2e5167a226d014..c9553de8143e33cd704f51380a418e9742b85f86 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -11669,6 +11669,12 @@ OMPClause *OMPClauseReader::readClause() { case OMPC_acq_rel: C = new (Context) OMPAcqRelClause(); break; + case OMPC_acquire: + C = new (Context) OMPAcquireClause(); + break; + case OMPC_release: + C = new (Context) OMPReleaseClause(); + break; case OMPC_threads: C = new (Context) OMPThreadsClause(); break; @@ -11933,6 +11939,10 @@ void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {} void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {} +void OMPClauseReader::VisitOMPAcquireClause(OMPAcquireClause *) {} + +void OMPClauseReader::VisitOMPReleaseClause(OMPReleaseClause *) {} + void OMPClauseReader::VisitOMPThreadsClause(OMPThreadsClause *) {} void OMPClauseReader::VisitOMPSIMDClause(OMPSIMDClause *) {} diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 2e19d735265c5a5212195e24966e354b7f157271..eb79ba20ddf7a5ab900662579101f7a3ea8d15c0 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -6149,6 +6149,10 @@ void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {} void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {} +void OMPClauseWriter::VisitOMPAcquireClause(OMPAcquireClause *) {} + +void OMPClauseWriter::VisitOMPReleaseClause(OMPReleaseClause *) {} + void OMPClauseWriter::VisitOMPThreadsClause(OMPThreadsClause *) {} void OMPClauseWriter::VisitOMPSIMDClause(OMPSIMDClause *) {} diff --git a/clang/test/OpenMP/atomic_ast_print.cpp b/clang/test/OpenMP/atomic_ast_print.cpp index 06c1aea19691bb2f4fe4540c897470d9bf88088f..4dd64a75f2c906516f5bb933bfa33930024514ae 100644 --- a/clang/test/OpenMP/atomic_ast_print.cpp +++ b/clang/test/OpenMP/atomic_ast_print.cpp @@ -59,6 +59,36 @@ T foo(T argc) { a = b; b++; } +#pragma omp atomic acquire + a++; +#pragma omp atomic read acquire + a = argc; +#pragma omp atomic acquire write + a = argc + argc; +#pragma omp atomic update acquire + a = a + argc; +#pragma omp atomic acquire capture + a = b++; +#pragma omp atomic capture acquire + { + a = b; + b++; + } +#pragma omp atomic release + a++; +#pragma omp atomic read release + a = argc; +#pragma omp atomic release write + a = argc + argc; +#pragma omp atomic update release + a = a + argc; +#pragma omp atomic release capture + a = b++; +#pragma omp atomic capture release + { + a = b; + b++; + } return T(); } @@ -108,6 +138,36 @@ T foo(T argc) { // CHECK-NEXT: a = b; // CHECK-NEXT: b++; // CHECK-NEXT: } +// CHECK-NEXT: #pragma omp atomic acquire +// CHECK-NEXT: a++; +// CHECK-NEXT: #pragma omp atomic read acquire +// CHECK-NEXT: a = argc; +// CHECK-NEXT: #pragma omp atomic acquire write +// CHECK-NEXT: a = argc + argc; +// CHECK-NEXT: #pragma omp atomic update acquire +// CHECK-NEXT: a = a + argc; +// CHECK-NEXT: #pragma omp atomic acquire capture +// CHECK-NEXT: a = b++; +// CHECK-NEXT: #pragma omp atomic capture acquire +// CHECK-NEXT: { +// CHECK-NEXT: a = b; +// CHECK-NEXT: b++; +// CHECK-NEXT: } +// CHECK-NEXT: #pragma omp atomic release +// CHECK-NEXT: a++; +// CHECK-NEXT: #pragma omp atomic read release +// CHECK-NEXT: a = argc; +// CHECK-NEXT: #pragma omp atomic release write +// CHECK-NEXT: a = argc + argc; +// CHECK-NEXT: #pragma omp atomic update release +// CHECK-NEXT: a = a + argc; +// CHECK-NEXT: #pragma omp atomic release capture +// CHECK-NEXT: a = b++; +// CHECK-NEXT: #pragma omp atomic capture release +// CHECK-NEXT: { +// CHECK-NEXT: a = b; +// CHECK-NEXT: b++; +// CHECK-NEXT: } // CHECK: int a = int(); // CHECK-NEXT: #pragma omp atomic // CHECK-NEXT: a++; @@ -154,6 +214,36 @@ T foo(T argc) { // CHECK-NEXT: a = b; // CHECK-NEXT: b++; // CHECK-NEXT: } +// CHECK-NEXT: #pragma omp atomic acquire +// CHECK-NEXT: a++; +// CHECK-NEXT: #pragma omp atomic read acquire +// CHECK-NEXT: a = argc; +// CHECK-NEXT: #pragma omp atomic acquire write +// CHECK-NEXT: a = argc + argc; +// CHECK-NEXT: #pragma omp atomic update acquire +// CHECK-NEXT: a = a + argc; +// CHECK-NEXT: #pragma omp atomic acquire capture +// CHECK-NEXT: a = b++; +// CHECK-NEXT: #pragma omp atomic capture acquire +// CHECK-NEXT: { +// CHECK-NEXT: a = b; +// CHECK-NEXT: b++; +// CHECK-NEXT: } +// CHECK-NEXT: #pragma omp atomic release +// CHECK-NEXT: a++; +// CHECK-NEXT: #pragma omp atomic read release +// CHECK-NEXT: a = argc; +// CHECK-NEXT: #pragma omp atomic release write +// CHECK-NEXT: a = argc + argc; +// CHECK-NEXT: #pragma omp atomic update release +// CHECK-NEXT: a = a + argc; +// CHECK-NEXT: #pragma omp atomic release capture +// CHECK-NEXT: a = b++; +// CHECK-NEXT: #pragma omp atomic capture release +// CHECK-NEXT: { +// CHECK-NEXT: a = b; +// CHECK-NEXT: b++; +// CHECK-NEXT: } int main(int argc, char **argv) { int b = 0; @@ -204,6 +294,36 @@ int main(int argc, char **argv) { a = b; b++; } +#pragma omp atomic acquire + a++; +#pragma omp atomic read acquire + a = argc; +#pragma omp atomic acquire write + a = argc + argc; +#pragma omp atomic update acquire + a = a + argc; +#pragma omp atomic acquire capture + a = b++; +#pragma omp atomic capture acquire + { + a = b; + b++; + } +#pragma omp atomic release + a++; +#pragma omp atomic read release + a = argc; +#pragma omp atomic release write + a = argc + argc; +#pragma omp atomic update release + a = a + argc; +#pragma omp atomic release capture + a = b++; +#pragma omp atomic capture release + { + a = b; + b++; + } // CHECK-NEXT: #pragma omp atomic // CHECK-NEXT: a++; // CHECK-NEXT: #pragma omp atomic read @@ -249,6 +369,36 @@ int main(int argc, char **argv) { // CHECK-NEXT: a = b; // CHECK-NEXT: b++; // CHECK-NEXT: } + // CHECK-NEXT: #pragma omp atomic acquire + // CHECK-NEXT: a++; + // CHECK-NEXT: #pragma omp atomic read acquire + // CHECK-NEXT: a = argc; + // CHECK-NEXT: #pragma omp atomic acquire write + // CHECK-NEXT: a = argc + argc; + // CHECK-NEXT: #pragma omp atomic update acquire + // CHECK-NEXT: a = a + argc; + // CHECK-NEXT: #pragma omp atomic acquire capture + // CHECK-NEXT: a = b++; + // CHECK-NEXT: #pragma omp atomic capture acquire + // CHECK-NEXT: { + // CHECK-NEXT: a = b; + // CHECK-NEXT: b++; + // CHECK-NEXT: } + // CHECK-NEXT: #pragma omp atomic release + // CHECK-NEXT: a++; + // CHECK-NEXT: #pragma omp atomic read release + // CHECK-NEXT: a = argc; + // CHECK-NEXT: #pragma omp atomic release write + // CHECK-NEXT: a = argc + argc; + // CHECK-NEXT: #pragma omp atomic update release + // CHECK-NEXT: a = a + argc; + // CHECK-NEXT: #pragma omp atomic release capture + // CHECK-NEXT: a = b++; + // CHECK-NEXT: #pragma omp atomic capture release + // CHECK-NEXT: { + // CHECK-NEXT: a = b; + // CHECK-NEXT: b++; + // CHECK-NEXT: } return foo(a); } diff --git a/clang/test/OpenMP/atomic_capture_codegen.cpp b/clang/test/OpenMP/atomic_capture_codegen.cpp index 338ee7dd943fa7d850795633fd608a0e992cbe91..3164c4f419f52dea04e4d296723f082c299fd899 100644 --- a/clang/test/OpenMP/atomic_capture_codegen.cpp +++ b/clang/test/OpenMP/atomic_capture_codegen.cpp @@ -896,17 +896,18 @@ int main() { // CHECK: [[VAL:%.+]] = or i64 [[BF_CLEAR]], [[BF_VALUE]] // CHECK: store i64 [[VAL]], i64* [[TEMP1]] // CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[TEMP1]] -// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] monotonic monotonic +// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] release monotonic // CHECK: [[FAILED_OLD_VAL]] = extractvalue { i64, i1 } [[RES]], 0 // CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1 // CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]] // CHECK: [[EXIT]] // CHECK: [[NEW_VAL:%.+]] = trunc i64 [[CONV]] to i32 // CHECK: store i32 [[NEW_VAL]], i32* @{{.+}}, -#pragma omp atomic capture +// CHECK: call{{.*}} @__kmpc_flush( +#pragma omp atomic capture release {bfx4.b /= ldv; iv = bfx4.b;} // CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}} -// CHECK: [[PREV_VALUE:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2) monotonic +// CHECK: [[PREV_VALUE:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2) acquire // CHECK: br label %[[CONT:.+]] // CHECK: [[CONT]] // CHECK: [[OLD_BF_VALUE:%.+]] = phi i8 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ] @@ -928,14 +929,15 @@ int main() { // CHECK: or i8 [[BF_CLEAR]], [[BF_VALUE]] // CHECK: store i8 %{{.+}}, i8* [[BITCAST1]] // CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[BITCAST1]] -// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] monotonic monotonic +// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] acquire acquire // CHECK: [[FAILED_OLD_VAL]] = extractvalue { i8, i1 } [[RES]], 0 // CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i8, i1 } [[RES]], 1 // CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]] // CHECK: [[EXIT]] // CHECK: [[NEW_VAL_I32:%.+]] = trunc i64 [[NEW_VAL]] to i32 // CHECK: store i32 [[NEW_VAL_I32]], i32* @{{.+}}, -#pragma omp atomic capture +// CHECK: call{{.*}} @__kmpc_flush( +#pragma omp atomic capture acquire iv = bfx4_packed.b += ldv; // CHECK: load i64, i64* // CHECK: [[EXPR:%.+]] = uitofp i64 %{{.+}} to float diff --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp index 804375a852e572305ff02507a9c7471a3633e457..d595689e4d15c1558927c46709852c85990761ec 100644 --- a/clang/test/OpenMP/atomic_messages.cpp +++ b/clang/test/OpenMP/atomic_messages.cpp @@ -733,7 +733,7 @@ T acq_rel() { // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} // expected-note@+1 {{expected an expression statement}} ; -// omp50-error@+1 2 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' or 'acq_rel' clause}} omp50-note@+1 2 {{'acq_rel' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp atomic'}} +// omp50-error@+1 2 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 2 {{'acq_rel' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp atomic'}} #pragma omp atomic acq_rel seq_cst a += b; @@ -754,7 +754,7 @@ int acq_rel() { // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} // expected-note@+1 {{expected an expression statement}} ; -// omp50-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' or 'acq_rel' clause}} omp50-note@+1 {{'seq_cst' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp atomic'}} +// omp50-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 {{'seq_cst' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp atomic'}} #pragma omp atomic seq_cst acq_rel a += b; @@ -767,6 +767,90 @@ int acq_rel() { return acq_rel(); // omp50-note {{in instantiation of function template specialization 'acq_rel' requested here}} } +template +T acquire() { + T a = 0, b = 0; +// omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic acquire + // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; +// omp50-error@+1 2 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 2 {{'acquire' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic acquire seq_cst + a += b; + +// omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic update acquire + // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; + + return T(); +} + +int acquire() { + int a = 0, b = 0; +// Test for atomic acquire +// omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic acquire + // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; +// omp50-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 {{'seq_cst' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic seq_cst acquire + a += b; + +// omp45-error@+1 {{unexpected OpenMP clause 'acquire' in directive '#pragma omp atomic'}} +#pragma omp atomic update acquire + // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; + + return acquire(); // omp50-note {{in instantiation of function template specialization 'acquire' requested here}} +} + +template +T release() { + T a = 0, b = 0; +// omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic release + // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; +// omp50-error@+1 2 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 2 {{'release' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic release seq_cst + a += b; + +// omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic update release + // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; + + return T(); +} + +int release() { + int a = 0, b = 0; +// Test for atomic release +// omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic release + // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; +// omp50-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp50-note@+1 {{'seq_cst' clause used here}} omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic seq_cst release + a += b; + +// omp45-error@+1 {{unexpected OpenMP clause 'release' in directive '#pragma omp atomic'}} +#pragma omp atomic update release + // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}} + // expected-note@+1 {{expected an expression statement}} + ; + + return release(); // omp50-note {{in instantiation of function template specialization 'release' requested here}} +} + template T mixed() { T a, b = T(); diff --git a/clang/test/OpenMP/atomic_read_codegen.c b/clang/test/OpenMP/atomic_read_codegen.c index 03737b91397f1651e96c165153e417146d368f96..814975e38ea27a4935306b41fd4d739953d61491 100644 --- a/clang/test/OpenMP/atomic_read_codegen.c +++ b/clang/test/OpenMP/atomic_read_codegen.c @@ -312,15 +312,16 @@ int main() { // CHECK: [[SHL:%.+]] = shl i64 [[LD]], 40 // CHECK: [[ASHR:%.+]] = ashr i64 [[SHL]], 57 // CHECK: store x86_fp80 -#pragma omp atomic read +#pragma omp atomic read release ldv = bfx4.b; -// CHECK: [[LD:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @bfx4_packed, i32 0, i32 0, i64 2) monotonic +// CHECK: [[LD:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @bfx4_packed, i32 0, i32 0, i64 2) acquire // CHECK: store i8 [[LD]], i8* [[LDTEMP:%.+]] // CHECK: [[LD:%.+]] = load i8, i8* [[LDTEMP]] // CHECK: [[ASHR:%.+]] = ashr i8 [[LD]], 1 // CHECK: sext i8 [[ASHR]] to i64 +// CHECK: call{{.*}} @__kmpc_flush( // CHECK: store x86_fp80 -#pragma omp atomic read +#pragma omp atomic read acquire ldv = bfx4_packed.b; // CHECK: [[LD:%.+]] = load atomic i64, i64* bitcast (<2 x float>* @{{.+}} to i64*) acquire // CHECK: [[BITCAST:%.+]] = bitcast <2 x float>* [[LDTEMP:%.+]] to i64* diff --git a/clang/test/OpenMP/atomic_update_codegen.cpp b/clang/test/OpenMP/atomic_update_codegen.cpp index 6f95c8e84540e001bc16c5b20598a6f4cc5d7213..fb900753898c533d9344cce1ccbeacbcd11a3c11 100644 --- a/clang/test/OpenMP/atomic_update_codegen.cpp +++ b/clang/test/OpenMP/atomic_update_codegen.cpp @@ -529,12 +529,13 @@ int main() { // CHECK: [[DESIRED:%.+]] = zext i1 [[BOOL_DESIRED]] to i8 // CHECK: store i8 [[DESIRED]], i8* [[TEMP:%.+]] // CHECK: [[DESIRED:%.+]] = load i8, i8* [[TEMP]] -// CHECK: [[RES:%.+]] = cmpxchg i8* [[X_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] monotonic monotonic +// CHECK: [[RES:%.+]] = cmpxchg i8* [[X_ADDR]], i8 [[EXPECTED]], i8 [[DESIRED]] release monotonic // CHECK: [[OLD_XI8:%.+]] = extractvalue { i8, i1 } [[RES]], 0 // CHECK: [[SUCCESS_FAIL:%.+]] = extractvalue { i8, i1 } [[RES]], 1 // CHECK: br i1 [[SUCCESS_FAIL]], label %[[EXIT:.+]], label %[[CONT]] // CHECK: [[EXIT]] -#pragma omp atomic update +// CHECK: call{{.*}} @__kmpc_flush( +#pragma omp atomic update release bx = ldv * bx; // CHECK: [[EXPR_RE:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* [[CIV_ADDR:@.+]], i32 0, i32 0), // CHECK: [[EXPR_IM:%.+]] = load i32, i32* getelementptr inbounds ({ i32, i32 }, { i32, i32 }* [[CIV_ADDR]], i32 0, i32 1), @@ -811,7 +812,7 @@ int main() { #pragma omp atomic update bfx4_packed.a -= ldv; // CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}} -// CHECK: [[PREV_VALUE:%.+]] = load atomic i64, i64* bitcast (%struct.BitFields4* @{{.+}} to i64*) monotonic +// CHECK: [[PREV_VALUE:%.+]] = load atomic i64, i64* bitcast (%struct.BitFields4* @{{.+}} to i64*) acquire // CHECK: br label %[[CONT:.+]] // CHECK: [[CONT]] // CHECK: [[OLD_BF_VALUE:%.+]] = phi i64 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ] @@ -830,12 +831,12 @@ int main() { // CHECK: [[VAL:%.+]] = or i64 [[BF_CLEAR]], [[BF_VALUE]] // CHECK: store i64 [[VAL]], i64* [[TEMP1]] // CHECK: [[NEW_BF_VALUE:%.+]] = load i64, i64* [[TEMP1]] -// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] monotonic monotonic +// CHECK: [[RES:%.+]] = cmpxchg i64* bitcast (%struct.BitFields4* @{{.+}} to i64*), i64 [[OLD_BF_VALUE]], i64 [[NEW_BF_VALUE]] acquire acquire // CHECK: [[FAILED_OLD_VAL]] = extractvalue { i64, i1 } [[RES]], 0 // CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i64, i1 } [[RES]], 1 // CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]] // CHECK: [[EXIT]] -#pragma omp atomic +#pragma omp atomic acquire bfx4.b /= ldv; // CHECK: [[EXPR:%.+]] = load x86_fp80, x86_fp80* @{{.+}} // CHECK: [[PREV_VALUE:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2) acquire diff --git a/clang/test/OpenMP/atomic_write_codegen.c b/clang/test/OpenMP/atomic_write_codegen.c index 517765ccdf47850e12acb1b037639e87bac406aa..f8a74e8c6edd27f095e7083938c3318a018c07a1 100644 --- a/clang/test/OpenMP/atomic_write_codegen.c +++ b/clang/test/OpenMP/atomic_write_codegen.c @@ -87,12 +87,12 @@ int main() { #pragma omp atomic write __imag(civ) = 1; // CHECK: load i8, i8* -// CHECK: store atomic i8 -#pragma omp atomic write +// CHECK: store atomic i8{{.*}}monotonic +#pragma omp atomic write acquire bx = bv; // CHECK: load i8, i8* -// CHECK: store atomic i8 -#pragma omp atomic write +// CHECK: store atomic i8{{.*}}release +#pragma omp atomic write release cx = cv; // CHECK: load i8, i8* // CHECK: store atomic i8 @@ -189,7 +189,7 @@ int main() { #pragma omp atomic write bx = cv; // CHECK: load i8, i8* -// CHECK: store atomic i8 +// CHECK: store atomic i8{{.*}}seq_cst // CHECK: call{{.*}} @__kmpc_flush( #pragma omp atomic write, seq_cst cx = ucv; @@ -470,7 +470,7 @@ int main() { bfx4.b = ldv; // CHECK: load x86_fp80, x86_fp80* @{{.+}} // CHECK: [[NEW_VAL:%.+]] = fptosi x86_fp80 %{{.+}} to i64 -// CHECK: [[PREV_VALUE:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2) monotonic +// CHECK: [[PREV_VALUE:%.+]] = load atomic i8, i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2) acquire // CHECK: br label %[[CONT:.+]] // CHECK: [[CONT]] // CHECK: [[OLD_BF_VALUE:%.+]] = phi i8 [ [[PREV_VALUE]], %[[EXIT]] ], [ [[FAILED_OLD_VAL:%.+]], %[[CONT]] ] @@ -481,12 +481,12 @@ int main() { // CHECK: or i8 [[BF_CLEAR]], [[BF_VALUE]] // CHECK: store i8 %{{.+}}, i8* [[LDTEMP:%.+]] // CHECK: [[NEW_BF_VALUE:%.+]] = load i8, i8* [[LDTEMP]] -// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] monotonic monotonic +// CHECK: [[RES:%.+]] = cmpxchg i8* getelementptr inbounds (%struct.BitFields4_packed, %struct.BitFields4_packed* @{{.+}}, i32 0, i32 0, i64 2), i8 [[OLD_BF_VALUE]], i8 [[NEW_BF_VALUE]] acquire acquire // CHECK: [[FAILED_OLD_VAL]] = extractvalue { i8, i1 } [[RES]], 0 // CHECK: [[FAIL_SUCCESS:%.+]] = extractvalue { i8, i1 } [[RES]], 1 // CHECK: br i1 [[FAIL_SUCCESS]], label %[[EXIT:.+]], label %[[CONT]] // CHECK: [[EXIT]] -#pragma omp atomic write +#pragma omp atomic write acquire bfx4_packed.b = ldv; // CHECK: load i64, i64* // CHECK: [[VEC_ITEM_VAL:%.+]] = uitofp i64 %{{.+}} to float diff --git a/clang/test/OpenMP/flush_ast_print.cpp b/clang/test/OpenMP/flush_ast_print.cpp index ca275b8e1f5940c01d8ada5f453216e442649385..2f2dbba75c9efcc8ea3d4a8f17d40ca55a3bd03a 100644 --- a/clang/test/OpenMP/flush_ast_print.cpp +++ b/clang/test/OpenMP/flush_ast_print.cpp @@ -17,20 +17,28 @@ T tmain(T argc) { static T a; #pragma omp flush #pragma omp flush acq_rel +#pragma omp flush acquire +#pragma omp flush release #pragma omp flush(a) return a + argc; } // CHECK: static T a; // CHECK-NEXT: #pragma omp flush{{$}} // CHECK-NEXT: #pragma omp flush acq_rel{{$}} +// CHECK-NEXT: #pragma omp flush acquire{{$}} +// CHECK-NEXT: #pragma omp flush release{{$}} // CHECK-NEXT: #pragma omp flush (a) // CHECK: static int a; // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush acq_rel{{$}} +// CHECK-NEXT: #pragma omp flush acquire{{$}} +// CHECK-NEXT: #pragma omp flush release{{$}} // CHECK-NEXT: #pragma omp flush (a) // CHECK: static char a; // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush acq_rel{{$}} +// CHECK-NEXT: #pragma omp flush acquire{{$}} +// CHECK-NEXT: #pragma omp flush release{{$}} // CHECK-NEXT: #pragma omp flush (a) int main(int argc, char **argv) { @@ -38,9 +46,13 @@ int main(int argc, char **argv) { // CHECK: static int a; #pragma omp flush #pragma omp flush acq_rel +#pragma omp flush acquire +#pragma omp flush release #pragma omp flush(a) // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush acq_rel +// CHECK-NEXT: #pragma omp flush acquire{{$}} +// CHECK-NEXT: #pragma omp flush release // CHECK-NEXT: #pragma omp flush (a) return tmain(argc) + tmain(argv[0][0]) + a; } diff --git a/clang/test/OpenMP/flush_codegen.cpp b/clang/test/OpenMP/flush_codegen.cpp index c73741c4d4926249a884d5b9a7c8e83a1734b080..36ab677a7e8205de03b28fdfba41ee10fa5f9397 100644 --- a/clang/test/OpenMP/flush_codegen.cpp +++ b/clang/test/OpenMP/flush_codegen.cpp @@ -1,16 +1,10 @@ -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s -// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s -// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -debug-info-kind=limited -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s @@ -23,6 +17,9 @@ template T tmain(T argc) { static T a; #pragma omp flush +#pragma omp flush acq_rel +#pragma omp flush acquire +#pragma omp flush release #pragma omp flush(a) return a + argc; } @@ -31,7 +28,13 @@ T tmain(T argc) { int main() { static int a; #pragma omp flush +#pragma omp flush acq_rel +#pragma omp flush acquire +#pragma omp flush release #pragma omp flush(a) + // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) + // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) + // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) return tmain(a); @@ -42,6 +45,9 @@ int main() { // CHECK: [[TMAIN]] // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) +// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) +// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) +// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) // CHECK: ret // CHECK-NOT: line: 0, diff --git a/clang/test/OpenMP/flush_messages.cpp b/clang/test/OpenMP/flush_messages.cpp index 234db25f26dccd3b0a389c464a03ab60327b5ceb..48a70f3f8dcb5364fbfea5d34901cf028cbe2718 100644 --- a/clang/test/OpenMP/flush_messages.cpp +++ b/clang/test/OpenMP/flush_messages.cpp @@ -136,6 +136,10 @@ label1 : { ; #pragma omp flush seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp flush'}} #pragma omp flush acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} +#pragma omp flush acquire // omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} +#pragma omp flush release // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}} +#pragma omp flush acq_rel acquire // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp50-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp50-note {{'acq_rel' clause used here}} +#pragma omp flush release acquire // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp50-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp50-note {{'release' clause used here}} #pragma omp flush acq_rel (argc) // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp50-error {{'flush' directive with memory order clause 'acq_rel' cannot have the list}} omp50-note {{memory order clause 'acq_rel' is specified here}} #pragma omp flush(argc) acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp50-error {{'flush' directive with memory order clause 'acq_rel' cannot have the list}} omp50-note {{memory order clause 'acq_rel' is specified here}} return tmain(argc); diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 95cb517fa3328140e86547decee2e3a90c7996fe..12479c7abb84e7bab1bb7e5195ee3339f3f77e87 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -23,6 +23,7 @@ #include "clang-c/FatalErrorHandler.h" #include "clang/AST/Attr.h" #include "clang/AST/Mangle.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/StmtVisitor.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticCategories.h" @@ -2236,6 +2237,10 @@ void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {} void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {} +void OMPClauseEnqueue::VisitOMPAcquireClause(const OMPAcquireClause *) {} + +void OMPClauseEnqueue::VisitOMPReleaseClause(const OMPReleaseClause *) {} + void OMPClauseEnqueue::VisitOMPThreadsClause(const OMPThreadsClause *) {} void OMPClauseEnqueue::VisitOMPSIMDClause(const OMPSIMDClause *) {} diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp index 6e2c6137f0ce7fa25d2b07fee67ce6bf46161248..6d1ad794677062b94d08f7ca69543a090d03254f 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_fuchsia.cpp @@ -66,6 +66,10 @@ uptr internal_getpid() { return pid; } +int internal_dlinfo(void *handle, int request, void *p) { + UNIMPLEMENTED(); +} + uptr GetThreadSelf() { return reinterpret_cast(thrd_current()); } tid_t GetTid() { return GetThreadSelf(); } diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_libc.h b/compiler-rt/lib/sanitizer_common/sanitizer_libc.h index 3d5db35d68ba560d8de46b82746fe4d867423b2c..ec0a6ded009b0773d66d492375ed0831c9058b4c 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_libc.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_libc.h @@ -72,6 +72,8 @@ unsigned int internal_sleep(unsigned int seconds); uptr internal_getpid(); uptr internal_getppid(); +int internal_dlinfo(void *handle, int request, void *p); + // Threading uptr internal_sched_yield(); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp index 15252462686dc90b97520b0eaaa41cf973e7b0ea..9baf9066900c26c4c7e55c4dffb09339ee6f5f60 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -735,6 +735,10 @@ uptr internal_getppid() { return internal_syscall(SYSCALL(getppid)); } +int internal_dlinfo(void *handle, int request, void *p) { + return dlinfo(handle, request, p); +} + uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) { #if SANITIZER_FREEBSD return internal_syscall(SYSCALL(getdirentries), fd, (uptr)dirp, count, NULL); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp index 6999e4c0613b7276156097b76d947e6f7f5f1c9e..c025f70df028abfda06bd0477603f5e0d8d88019 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp @@ -208,6 +208,10 @@ uptr internal_getpid() { return getpid(); } +int internal_dlinfo(void *handle, int request, void *p) { + UNIMPLEMENTED(); +} + int internal_sigaction(int signum, const void *act, void *oldact) { return sigaction(signum, (const struct sigaction *)act, (struct sigaction *)oldact); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp index 49a951e04b3741ca1fd9aa6ad52161c239ef7df8..d9aff51d8ae793a9a50ef38b2baff802da62b2bb 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_netbsd.cpp @@ -265,6 +265,11 @@ uptr internal_getppid() { return _REAL(getppid); } +int internal_dlinfo(void *handle, int request, void *p) { + DEFINE__REAL(int, dlinfo, void *a, int b, void *c); + return _REAL(dlinfo, handle, request, p); +} + uptr internal_getdents(fd_t fd, void *dirp, unsigned int count) { DEFINE__REAL(int, __getdents30, int a, void *b, size_t c); return _REAL(__getdents30, fd, dirp, count); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp index f504feaecd35855611f8ff697e6464b1fcc70281..dcc6c71c07d8ae7873c7903761d8537e4bfe7d11 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp @@ -52,6 +52,7 @@ #include // #include +#include #include #include #include @@ -86,9 +87,15 @@ // Include these after system headers to avoid name clashes and ambiguities. #include "sanitizer_internal_defs.h" +#include "sanitizer_libc.h" #include "sanitizer_platform_limits_freebsd.h" namespace __sanitizer { +void *__sanitizer_get_link_map_by_dlopen_handle(void *handle) { + void *p = nullptr; + return internal_dlinfo(handle, RTLD_DI_LINKMAP, &p) == 0 ? p : nullptr; +} + unsigned struct_cap_rights_sz = sizeof(cap_rights_t); unsigned struct_utsname_sz = sizeof(struct utsname); unsigned struct_stat_sz = sizeof(struct stat); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h index f461da275dedbce32c417c4c6738afc30f3644fe..5e0ca9c7d78236821e41226edf33a4b551f3ee5d 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h @@ -20,15 +20,15 @@ #include "sanitizer_platform.h" #include "sanitizer_platform_limits_posix.h" -// FreeBSD's dlopen() returns a pointer to an Obj_Entry structure that -// incorporates the map structure. -#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ - ((link_map *)((handle) == nullptr ? nullptr : ((char *)(handle) + 560))) // Get sys/_types.h, because that tells us whether 64-bit inodes are // used in struct dirent below. #include namespace __sanitizer { +void *__sanitizer_get_link_map_by_dlopen_handle(void *handle); +#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ + (link_map *)__sanitizer_get_link_map_by_dlopen_handle(handle) + extern unsigned struct_utsname_sz; extern unsigned struct_stat_sz; #if defined(__powerpc64__) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp index 2c889f01e9fc16bc3486f86e2d78f4c9f2d8741f..722cb1feb56075c979dcd1855c13c0f837fd60fc 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp @@ -213,6 +213,7 @@ struct urio_command { #include #include #include +#include #include #include #include @@ -258,9 +259,15 @@ struct urio_command { // Include these after system headers to avoid name clashes and ambiguities. #include "sanitizer_internal_defs.h" +#include "sanitizer_libc.h" #include "sanitizer_platform_limits_netbsd.h" namespace __sanitizer { +void *__sanitizer_get_link_map_by_dlopen_handle(void* handle) { + void *p = nullptr; + return internal_dlinfo(handle, RTLD_DI_LINKMAP, &p) == 0 ? p : nullptr; +} + unsigned struct_utsname_sz = sizeof(struct utsname); unsigned struct_stat_sz = sizeof(struct stat); unsigned struct_rusage_sz = sizeof(struct rusage); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h index 2544f8ce7e56189ba872e67dc2628fb829f6d912..d80280d9bf8c837635435463e80b01354f391f9b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h @@ -19,18 +19,11 @@ #include "sanitizer_internal_defs.h" #include "sanitizer_platform.h" -#define _GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, shift) \ - ((link_map *)((handle) == nullptr ? nullptr : ((char *)(handle) + (shift)))) - -#if defined(__x86_64__) -#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ - _GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, 264) -#elif defined(__i386__) -#define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ - _GET_LINK_MAP_BY_DLOPEN_HANDLE(handle, 136) -#endif - namespace __sanitizer { +void *__sanitizer_get_link_map_by_dlopen_handle(void *handle); +# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) \ + (link_map *)__sanitizer_get_link_map_by_dlopen_handle(handle) + extern unsigned struct_utsname_sz; extern unsigned struct_stat_sz; extern unsigned struct_rusage_sz; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_rtems.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_rtems.cpp index 0d2576c00ab3c8d34c0f3ac8eb8984e5b49b586d..29bcfcfa6f1581a456e9a5183e8de51a14d1c834 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_rtems.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_rtems.cpp @@ -49,6 +49,10 @@ uptr internal_getpid() { return getpid(); } +int internal_dlinfo(void *handle, int request, void *p) { + UNIMPLEMENTED(); +} + bool FileExists(const char *filename) { struct stat st; if (stat(filename, &st)) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp index e790789c8698d481128aa7640f9abf454924d912..490c6fe89beb5bfc2681aeb6dbd679e0c2c475b8 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp @@ -529,8 +529,8 @@ bool SymbolizerProcess::ReadFromSymbolizer(char *buffer, uptr max_length) { break; if (read_len + 1 == max_length) { Report("WARNING: Symbolizer buffer too small\n"); - buffer[0] = '\0'; - return false; + read_len = 0; + break; } } buffer[read_len] = '\0'; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp index dc940817c0258fa0549c11514727fb61aaf92392..73dc042b69f171ad6f6a739f4bf678fcc2d8a1ec 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_win.cpp @@ -94,6 +94,10 @@ uptr internal_getpid() { return GetProcessId(GetCurrentProcess()); } +int internal_dlinfo(void *handle, int request, void *p) { + UNIMPLEMENTED(); +} + // In contrast to POSIX, on Windows GetCurrentThreadId() // returns a system-unique identifier. tid_t GetTid() { diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm index 233734109c41cdd5d530211dd9eb3c9e14190a1e..778cf3d90869b63d1a18381fe8f29565f8eafc19 100644 --- a/lldb/source/Host/macosx/objcxx/Host.mm +++ b/lldb/source/Host/macosx/objcxx/Host.mm @@ -9,9 +9,10 @@ #include "lldb/Host/Host.h" #include +#include // On device doesn't have supporty for XPC. -#if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__)) +#if defined(__APPLE__) && defined(TARGET_OS_EMBEDDED) #define NO_XPC_SERVICES 1 #endif @@ -135,6 +136,8 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { return false; } +#if !NO_XPC_SERVICES + static void *AcceptPIDFromInferior(void *arg) { const char *connect_url = (const char *)arg; ConnectionFileDescriptor file_conn; @@ -153,8 +156,6 @@ static void *AcceptPIDFromInferior(void *arg) { return NULL; } -#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) - const char *applscript_in_new_tty = "tell application \"Terminal\"\n" " activate\n" " do script \"/bin/bash -c '%s';exit\"\n" @@ -307,11 +308,11 @@ LaunchInNewTerminalWithAppleScript(const char *exe_path, return error; } -#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) +#endif // #if !NO_XPC_SERVICES bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, uint32_t line_no) { -#if defined(__arm__) || defined(__arm64__) || defined(__aarch64__) +#if NO_XPC_SERVICES return false; #else // We attach this to an 'odoc' event to specify a particular selection @@ -404,7 +405,7 @@ bool Host::OpenFileInExternalEditor(const FileSpec &file_spec, } return true; -#endif // #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) +#endif // #if !NO_XPC_SERVICES } Environment Host::GetEnvironment() { return Environment(*_NSGetEnviron()); } @@ -1263,7 +1264,7 @@ Status Host::LaunchProcess(ProcessLaunchInfo &launch_info) { } if (launch_info.GetFlags().Test(eLaunchFlagLaunchInTTY)) { -#if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) +#if !NO_XPC_SERVICES return LaunchInNewTerminalWithAppleScript(exe_spec.GetPath().c_str(), launch_info); #else diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index eead322f6b891479ced52819b1cf4b98a985512c..7581ccea625af074300abf0c78e77b7a82bc99bd 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -130,11 +130,9 @@ ThreadPlanStepOut::ThreadPlanStepOut( uint32_t permissions = 0; if (!m_thread.GetProcess()->GetLoadAddressPermissions(m_return_addr, permissions)) { - m_constructor_errors.Printf("Return address (0x%" PRIx64 - ") permissions not found.", - m_return_addr); - LLDB_LOGF(log, "ThreadPlanStepOut(%p): %s", static_cast(this), - m_constructor_errors.GetData()); + LLDB_LOGF(log, "ThreadPlanStepOut(%p): Return address (0x%" PRIx64 + ") permissions not found.", static_cast(this), + m_return_addr); } else if (!(permissions & ePermissionsExecutable)) { m_constructor_errors.Printf("Return address (0x%" PRIx64 ") did not point to executable memory.", diff --git a/lldb/tools/debugserver/source/CMakeLists.txt b/lldb/tools/debugserver/source/CMakeLists.txt index ef8dcd1f53538def603f118afac0e21b30bcb54d..151386d0c130154f5d48d950ee79419cc32d7531 100644 --- a/lldb/tools/debugserver/source/CMakeLists.txt +++ b/lldb/tools/debugserver/source/CMakeLists.txt @@ -136,9 +136,11 @@ set(generated_mach_interfaces ) set(MIG_ARCH_FLAGS "") -foreach(ARCH ${CMAKE_OSX_ARCHITECTURES}) - set(MIG_ARCH_FLAGS "${MIG_ARCH_FLAGS} -arch ${ARCH}") -endforeach() +if (DEFINED MIG_ARCHS) + foreach(ARCH ${MIG_ARCHS}) + set(MIG_ARCH_FLAGS "${MIG_ARCH_FLAGS} -arch ${ARCH}") + endforeach() +endif() separate_arguments(MIG_ARCH_FLAGS_SEPARTED NATIVE_COMMAND "${MIG_ARCH_FLAGS}") add_custom_command(OUTPUT ${generated_mach_interfaces} diff --git a/llgo/.arcconfig b/llgo/.arcconfig deleted file mode 100644 index 38ac2790f4ee1edb95dd972ac42fea4bf674ac58..0000000000000000000000000000000000000000 --- a/llgo/.arcconfig +++ /dev/null @@ -1,4 +0,0 @@ -{ - "project_id" : "llgo", - "conduit_uri" : "https://reviews.llvm.org/" -} diff --git a/llgo/CMakeLists.txt b/llgo/CMakeLists.txt deleted file mode 100644 index abe89624aa15cfa3c4a874cc374922c5912e6ab9..0000000000000000000000000000000000000000 --- a/llgo/CMakeLists.txt +++ /dev/null @@ -1,265 +0,0 @@ -include(ExternalProject) -include(ProcessorCount) - -# Provide a config.h which exposes build system information. -configure_file( - cmd/gllgo/config.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/cmd/gllgo/config.h) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/cmd/gllgo) - -list(APPEND LLVM_GO_PACKAGES "llvm.org/llgo=${CMAKE_CURRENT_SOURCE_DIR}") - -llvm_add_go_executable(llgo llvm.org/llgo/cmd/gllgo ALL DEPENDS - build/context.go - cmd/gllgo/gllgo.go - debug/debug.go - driver/parser.go - irgen/annotations.go - irgen/attribute.go - irgen/builtins.go - irgen/cabi.go - irgen/call.go - irgen/channels.go - irgen/closures.go - irgen/compiler.go - irgen/errors.go - irgen/indirect.go - irgen/interfaces.go - irgen/maps.go - irgen/predicates.go - irgen/println.go - irgen/runtime.go - irgen/slice.go - irgen/ssa.go - irgen/strings.go - irgen/switches.go - irgen/targets.go - irgen/typemap.go - irgen/types.go - irgen/utils.go - irgen/value.go - irgen/version.go - ssaopt/esc.go -) - -string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLGO_VERSION - ${PACKAGE_VERSION}) - -configure_file( - cmd/go/zdefaultcc.go.in - ${CMAKE_CURRENT_BINARY_DIR}/cmd/go/zdefaultcc.go) - -set(LLGO_GO_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/build.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/clean.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/context.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/discovery.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/doc.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/env.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/fix.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/fmt.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/generate.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/get.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/go11.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/help.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/http.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/list.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/main.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/note.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/pkg.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/run.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/signal.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/signal_unix.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/testflag.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/test.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/tool.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/vcs.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/version.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/go/vet.go - ${CMAKE_CURRENT_BINARY_DIR}/cmd/go/zdefaultcc.go -) - -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX} - COMMAND ${CMAKE_BINARY_DIR}/bin/llgo -static-libgo - -I ${CMAKE_CURRENT_BINARY_DIR}/libgo - -o ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX} - ${LLGO_GO_SOURCES} - ${CMAKE_CURRENT_BINARY_DIR}/libgo/zstdpkglist.go - DEPENDS llgo libgo ${LLGO_GO_SOURCES} - COMMENT "Building Go executable llgo-go" - VERBATIM) -add_custom_target(llgo-go ALL DEPENDS ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX}) - -set(LLGO_CGO_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/ast.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/doc.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/gcc.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/godefs.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/main.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/out.go - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo/go/cmd/cgo/util.go - ${CMAKE_CURRENT_SOURCE_DIR}/cmd/cgo/zdefaultcc.go -) - -add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lib/go/llgo-${LLGO_VERSION}/cgo - COMMAND ${CMAKE_BINARY_DIR}/bin/llgo -static-libgo - -o ${CMAKE_BINARY_DIR}/lib/go/llgo-${LLGO_VERSION}/cgo - ${LLGO_CGO_SOURCES} - DEPENDS llgo libgo ${LLGO_CGO_SOURCES} - COMMENT "Building Go executable cgo" - VERBATIM) -add_custom_target(cgo ALL DEPENDS ${CMAKE_BINARY_DIR}/lib/go/llgo-${LLGO_VERSION}/cgo) - -llvm_add_go_executable(llgo-stage2 llvm.org/llgo/cmd/gllgo - DEPENDS libgo ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX} - ${CMAKE_BINARY_DIR}/lib/go/llgo-${LLGO_VERSION}/cgo - ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX} - GOFLAGS "cc=${CMAKE_BINARY_DIR}/bin/clang" - "cxx=${CMAKE_BINARY_DIR}/bin/clang++" - "go=${CMAKE_BINARY_DIR}/bin/llgo-go" -) - -llvm_add_go_executable(llgo-stage3 llvm.org/llgo/cmd/gllgo - DEPENDS libgo ${CMAKE_BINARY_DIR}/bin/llgo-stage2${CMAKE_EXECUTABLE_SUFFIX} - GOFLAGS "cc=${CMAKE_BINARY_DIR}/bin/clang" - "cxx=${CMAKE_BINARY_DIR}/bin/clang++" - "go=${CMAKE_BINARY_DIR}/bin/llgo-go" - "llgo=${CMAKE_BINARY_DIR}/bin/llgo-stage2${CMAKE_EXECUTABLE_SUFFIX}" -) - -llvm_add_go_executable(cc-wrapper llvm.org/llgo/cmd/cc-wrapper DEPENDS - cmd/cc-wrapper/main.go -) - -llvm_add_go_executable(llgoi llvm.org/llgo/cmd/llgoi ALL - DEPENDS libgo ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX} - ${CMAKE_BINARY_DIR}/lib/go/llgo-${LLGO_VERSION}/cgo - ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX} - cmd/llgoi/llgoi.go - GOFLAGS "cc=${CMAKE_BINARY_DIR}/bin/clang" - "cxx=${CMAKE_BINARY_DIR}/bin/clang++" - "go=${CMAKE_BINARY_DIR}/bin/llgo-go" -) - -install(FILES ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX} - ${CMAKE_BINARY_DIR}/bin/llgoi${CMAKE_EXECUTABLE_SUFFIX} - ${CMAKE_BINARY_DIR}/bin/llgo-go${CMAKE_EXECUTABLE_SUFFIX} - DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE) - -function(add_clobber_steps name) - ExternalProject_Add_Step(${name} force-reconfigure - DEPENDERS configure - ALWAYS 1 - ) - - ExternalProject_Add_Step(${name} clobber - COMMAND ${CMAKE_COMMAND} -E remove_directory - COMMAND ${CMAKE_COMMAND} -E make_directory - COMMENT "Clobbering ${name} build directory..." - DEPENDERS configure - DEPENDS ${ARGN} - ) -endfunction() - -processorcount(PROCESSOR_COUNT) - -function(add_libgo_variant suffix cflags gocflags deps exclude_from_all) - externalproject_add(libbacktrace${suffix} - DEPENDS clang ${deps} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libbacktrace - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${suffix}/libbacktrace - CONFIGURE_COMMAND /configure --disable-multilib --enable-host-shared "CC=${CMAKE_BINARY_DIR}/bin/clang ${cflags}" - BUILD_COMMAND make -j${PROCESSOR_COUNT} - INSTALL_COMMAND "" - LOG_CONFIGURE 1 - LOG_BUILD 1 - ) - set_property(TARGET libbacktrace${suffix} - PROPERTY EXCLUDE_FROM_ALL ${exclude_from_all}) - - add_clobber_steps(libbacktrace${suffix} clang ${deps}) - - externalproject_add(libffi${suffix} - DEPENDS clang ${deps} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libffi - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${suffix}/libffi - CONFIGURE_COMMAND /configure --disable-multilib "CC=${CMAKE_BINARY_DIR}/bin/clang ${cflags}" - BUILD_COMMAND make -j${PROCESSOR_COUNT} - INSTALL_COMMAND "" - LOG_CONFIGURE 1 - LOG_BUILD 1 - ) - set_property(TARGET libffi${suffix} - PROPERTY EXCLUDE_FROM_ALL ${exclude_from_all}) - - add_clobber_steps(libffi${suffix} clang ${deps}) - - externalproject_add(libgo${suffix} - DEPENDS clang llgo cc-wrapper libbacktrace${suffix} libffi${suffix} ${deps} - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/gofrontend/libgo - BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${suffix}/libgo - INSTALL_DIR ${CMAKE_BINARY_DIR} - CONFIGURE_COMMAND /configure --disable-multilib --without-libatomic --prefix= "CC=env REAL_CC=${CMAKE_BINARY_DIR}/bin/clang@SPACE@${cflags} ${CMAKE_BINARY_DIR}/bin/cc-wrapper" "GOC=${CMAKE_BINARY_DIR}/bin/llgo -no-prefix -fcompilerrt-prefix=${CMAKE_BINARY_DIR} ${gocflags}" - BUILD_COMMAND make -j${PROCESSOR_COUNT} - LOG_CONFIGURE 1 - LOG_BUILD 1 - LOG_INSTALL 1 - ) - set_property(TARGET libgo${suffix} - PROPERTY EXCLUDE_FROM_ALL ${exclude_from_all}) - - add_clobber_steps(libgo${suffix} clang - ${CMAKE_BINARY_DIR}/bin/llgo${CMAKE_EXECUTABLE_SUFFIX} - ${CMAKE_BINARY_DIR}/bin/cc-wrapper${CMAKE_EXECUTABLE_SUFFIX}) -endfunction() - -add_libgo_variant("" "" "" "" FALSE) - -if(TARGET asan) - add_libgo_variant("_asan" "-fsanitize=address" "-fsanitize=address" asan TRUE) -endif() - -if(TARGET tsan) - add_libgo_variant("_tsan" "-fsanitize=thread" "-fsanitize=thread" tsan TRUE) -endif() - -if(TARGET msan) - add_libgo_variant("_msan" "-fsanitize=memory" "-fsanitize=memory" msan TRUE) -endif() - -if(TARGET dfsan) - add_libgo_variant("_dfsan" "-fsanitize=dataflow" "-fsanitize=dataflow" dfsan TRUE) -endif() - -set(LLGO_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) - -install(FILES ${LLGO_LIBRARY_DIR}/libgo-llgo.a - ${LLGO_LIBRARY_DIR}/libgo-llgo.so - ${LLGO_LIBRARY_DIR}/libgo-llgo.so.8 - ${LLGO_LIBRARY_DIR}/libgo-llgo.so.8.0.0 - ${LLGO_LIBRARY_DIR}/libgobegin-llgo.a - DESTINATION lib${LLVM_LIBDIR_SUFFIX}) - -install(DIRECTORY ${LLGO_LIBRARY_DIR}/go - DESTINATION lib${LLVM_LIBDIR_SUFFIX}) - -add_custom_target(check-libgo - COMMAND make -C ${CMAKE_CURRENT_BINARY_DIR}/libgo -j${PROCESSOR_COUNT} check - DEPENDS libgo - ${cmake_3_2_USES_TERMINAL} - COMMENT "Running libgo tests") - -add_custom_target(check-llgo-bootstrap - COMMAND strip -R .note.gnu.build-id -o ${CMAKE_CURRENT_BINARY_DIR}/llgo-stage2.stripped - ${CMAKE_BINARY_DIR}/bin/llgo-stage2${CMAKE_EXECUTABLE_SUFFIX} - COMMAND strip -R .note.gnu.build-id -o ${CMAKE_CURRENT_BINARY_DIR}/llgo-stage3.stripped - ${CMAKE_BINARY_DIR}/bin/llgo-stage3${CMAKE_EXECUTABLE_SUFFIX} - COMMAND cmp ${CMAKE_CURRENT_BINARY_DIR}/llgo-stage2.stripped - ${CMAKE_CURRENT_BINARY_DIR}/llgo-stage3.stripped - DEPENDS llgo-stage2 llgo-stage3 - COMMENT "Checking llgo bootstrap") - -add_subdirectory(test) diff --git a/llgo/LICENSE.TXT b/llgo/LICENSE.TXT deleted file mode 100644 index 2d94553573c3bfec264703904ef1d3a201719b96..0000000000000000000000000000000000000000 --- a/llgo/LICENSE.TXT +++ /dev/null @@ -1,308 +0,0 @@ -============================================================================== -The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: -============================================================================== - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - ----- LLVM Exceptions to the Apache 2.0 License ---- - -As an exception, if, as a result of your compiling your source code, portions -of this Software are embedded into an Object form of such source code, you -may redistribute such embedded portions in such Object form without complying -with the conditions of Sections 4(a), 4(b) and 4(d) of the License. - -In addition, if you combine or link compiled forms of this Software with -software that is licensed under the GPLv2 ("Combined Software") and if a -court of competent jurisdiction determines that the patent provision (Section -3), the indemnity provision (Section 9) or other Section of the License -conflicts with the conditions of the GPLv2, you may retroactively and -prospectively choose to deem waived or otherwise exclude such Section(s) of -the License, but only in their entirety and only with respect to the Combined -Software. - -============================================================================== -Software from third parties included in the LLVM Project: -============================================================================== -The LLVM Project contains third party software which is under different license -terms. All such code will be identified clearly using at least one of two -mechanisms: -1) It will be in a separate directory tree with its own `LICENSE.txt` or - `LICENSE` file at the top containing the specific license and restrictions - which apply to that software, or -2) It will contain specific license and restriction terms at the top of every - file. - -============================================================================== -Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): -============================================================================== -The llgo distribution, excluding the contents of the 'include' and any third -party software is licensed under the University of Illinois "BSD-Like" license. - -The contents of the 'include' directory are dual licensed under both the -University of Illinois "BSD-Like" license and the MIT license. As a user of -this code you may choose to use it under either license. As a contributor, -you agree to allow your code to be used under both. - -Full text of the relevant licenses is included below. - -============================================================================== - -University of Illinois/NCSA -Open Source License - -Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign. -All rights reserved. - -Developed by: - - LLVM Team - - http://llvm.org - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal with -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the - documentation and/or other materials provided with the distribution. - - * Neither the names of the LLVM Team, University of Illinois at - Urbana-Champaign, nor the names of its contributors may be used to - endorse or promote products derived from this Software without specific - prior written permission. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE -SOFTWARE. - -============================================================================== - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/llgo/README.TXT b/llgo/README.TXT deleted file mode 100644 index c48e85561cf48669245f024a5c2afd64446eddac..0000000000000000000000000000000000000000 --- a/llgo/README.TXT +++ /dev/null @@ -1,74 +0,0 @@ -llgo -==== - -llgo is a Go (http://golang.org) frontend for LLVM, written in Go. - -llgo is under active development. It compiles and passes most of the -standard library test suite and a substantial portion of the gc test suite, -but there are some corner cases that are known not to be handled correctly -yet. Nevertheless it can compile modestly substantial programs (including -itself; it is self hosting on x86-64 Linux). - -Mailing list: https://groups.google.com/d/forum/llgo-dev - -Supported platforms -------------------- - -llgo is currently only supported on the x86-64 Linux platform. Contributions -that add support for other platforms are welcome. - -There are two components which would need to be ported to new platforms: the -compiler and the runtime library. The compiler has little platform-specific -code; the most significant is in irgen/cabi.go. The main limiting factor -for new platforms is the runtime library in third_party/gofrontend/libgo, -which inherits some support for other platforms from the gc compiler's -runtime library, but this support tends to be incomplete. - -Installation ------------- - -llgo requires: -* Go 1.3 or later. -* CMake 2.8.8 or later (to build LLVM). -* A modern C++ toolchain (to build LLVM). - http://llvm.org/docs/GettingStarted.html#getting-a-modern-host-c-toolchain - -Note that Ubuntu Precise is one Linux distribution which does not package -a sufficiently new CMake or C++ toolchain. - -To build and install llgo: - - # Checkout llvm project. - git clone https://github.com/llvm/llvm-project.git - - # Build LLVM, Clang and llgo: (see also http://llvm.org/docs/CMake.html) - cd llvm-project - mkdir build - cd build - cmake ../llvm -DLLVM_ENABLE_PROJECTS='clang;llgo' -DCMAKE_INSTALL_PREFIX=/path/to/llvm-inst - make install - -Running -------- - -llgo-go is llgo's version of the "go" command. It has the same command line -interface as go, and works the same way, but it uses llgo to compile. - -llgoi is an interactive REPL for Go. It supports expressions, statements, most -declarations and imports, including binary imports from the standard library -and source imports from $GOPATH. See docs/llgoi.rst for more information. - -llgo is the compiler binary. It has a command line interface that is intended -to be compatible to a large extent with gccgo. - -Contributing ------------- - -Changes to code outside the third_party directory should be contributed in -the normal way by sending patches to . - -Changes to code in the third_party directory must first be made in the -respective upstream project, from which they will be mirrored into the llgo -repository. See the script update_third_party.sh for the locations of the -upstream projects and details of how the mirroring works. - diff --git a/llgo/autoconf/config.sub b/llgo/autoconf/config.sub deleted file mode 100644 index 2583c901235ab0b80de890be89e33ce1c5d9e32e..0000000000000000000000000000000000000000 --- a/llgo/autoconf/config.sub +++ /dev/null @@ -1,1770 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-11-02' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | aarch64 | aarch64_be \ - | be32 | be64 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | hexagon \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | aarch64-* | aarch64_be-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hexagon-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -bitrig*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -ps4) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/llgo/build/context.go b/llgo/build/context.go deleted file mode 100644 index f0847a2bf11dd9800bebfb97163a8ea9482b3c09..0000000000000000000000000000000000000000 --- a/llgo/build/context.go +++ /dev/null @@ -1,94 +0,0 @@ -//===- context.go - Build context utilities for llgo ----------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Build context utilities for llgo. -// -//===----------------------------------------------------------------------===// - -package build - -import ( - "errors" - "go/build" - "regexp" - "strings" -) - -type Context struct { - build.Context - - // LLVM triple - Triple string -} - -// ContextFromTriple returns a new go/build.Context with GOOS and GOARCH -// configured from the given triple. -func ContextFromTriple(triple string) (*Context, error) { - goos, goarch, err := parseTriple(triple) - if err != nil { - return nil, err - } - ctx := &Context{Context: build.Default, Triple: triple} - ctx.GOOS = goos - ctx.GOARCH = goarch - ctx.BuildTags = append(ctx.BuildTags, "llgo") - if triple == "pnacl" { - ctx.BuildTags = append(ctx.BuildTags, "pnacl") - } - return ctx, nil -} - -func parseTriple(triple string) (goos string, goarch string, err error) { - if strings.ToLower(triple) == "pnacl" { - return "nacl", "le32", nil - } - - type REs struct{ re, out string } - // reference: http://llvm.org/docs/doxygen/html/Triple_8cpp_source.html - goarchREs := []REs{ - {"amd64|x86_64", "amd64"}, - {"i[3-9]86", "386"}, - {"xscale|((arm|thumb)(v.*)?)", "arm"}, - } - goosREs := []REs{ - {"linux.*", "linux"}, - {"(darwin|macosx|ios).*", "darwin"}, - {"k?freebsd.*", "freebsd"}, - {"netbsd.*", "netbsd"}, - {"openbsd.*", "openbsd"}, - } - match := func(list []REs, s string) string { - for _, t := range list { - if matched, _ := regexp.MatchString(t.re, s); matched { - return t.out - } - } - return "" - } - - s := strings.Split(triple, "-") - switch l := len(s); l { - default: - return "", "", errors.New("triple should be made up of 2, 3, or 4 parts.") - case 2, 3: // ARCHITECTURE-(VENDOR-)OPERATING_SYSTEM - goarch = s[0] - goos = s[l-1] - case 4: // ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT - goarch = s[0] - goos = s[2] - } - goarch = match(goarchREs, goarch) - if goarch == "" { - return "", "", errors.New("unknown architecture in triple") - } - goos = match(goosREs, goos) - if goos == "" { - return "", "", errors.New("unknown OS in triple") - } - return goos, goarch, nil -} diff --git a/llgo/buildslave-config.yaml b/llgo/buildslave-config.yaml deleted file mode 100644 index 76e2403765dae5e9e17eb89280406dd199033f9f..0000000000000000000000000000000000000000 --- a/llgo/buildslave-config.yaml +++ /dev/null @@ -1,31 +0,0 @@ -# This file contains llgo's configuration for the buildbot-slave Juju charm. -# -# The slave is deployed with the following command in a Juju environment: -# juju deploy cs:~axwalk/buildbot-slave --config buildslave-config.yaml -# -# The charm generates a random password on first run, in the file -# /srv/buildbot/password. If the password is regenerated, it must -# be updated in the buildbot master. -# -buildbot-slave: - name: llgo-builder - master: lab.llvm.org:9990 - admin-info: Andrew Wilkins - apt-packages: subversion git cmake gcc g++ gccgo python-dev - pip-versions: sqlalchemy==0.7.9 buildbot==0.8.5 buildbot_slave==0.8.5 twisted==12.0.0 - post-install: | - #!/bin/bash - # - # Fetch, build and install Ninja. - rm -fr /tmp/ninja - cd /tmp && git clone git://github.com/martine/ninja.git - cd /tmp/ninja && ./configure.py --bootstrap - cp /tmp/ninja/ninja /usr/local/bin - # Fetch and unpack Go. - cd /tmp && wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz - sha1sum < 0 { - consumedArgs := 1 - - switch { - case !strings.HasPrefix(args[0], "-"): - if strings.HasSuffix(args[0], ".go") { - goInputs = append(goInputs, args[0]) - } else { - hasOtherNonFlagInputs = true - otherInputs = append(otherInputs, args[0]) - } - - case strings.HasPrefix(args[0], "-Wl,"), strings.HasPrefix(args[0], "-l"), strings.HasPrefix(args[0], "--sysroot="): - // TODO(pcc): Handle these correctly. - otherInputs = append(otherInputs, args[0]) - - case args[0] == "-B": - if len(args) == 1 { - return opts, errors.New("missing argument after '-B'") - } - opts.bprefix = args[1] - consumedArgs = 2 - - case args[0] == "-D": - if len(args) == 1 { - return opts, errors.New("missing argument after '-D'") - } - otherInputs = append(otherInputs, args[0], args[1]) - consumedArgs = 2 - - case strings.HasPrefix(args[0], "-D"): - otherInputs = append(otherInputs, args[0]) - - case args[0] == "-I": - if len(args) == 1 { - return opts, errors.New("missing argument after '-I'") - } - opts.importPaths = append(opts.importPaths, args[1]) - consumedArgs = 2 - - case strings.HasPrefix(args[0], "-I"): - opts.importPaths = append(opts.importPaths, args[0][2:]) - - case args[0] == "-isystem": - if len(args) == 1 { - return opts, errors.New("missing argument after '-isystem'") - } - otherInputs = append(otherInputs, args[0], args[1]) - consumedArgs = 2 - - case args[0] == "-L": - if len(args) == 1 { - return opts, errors.New("missing argument after '-L'") - } - opts.libPaths = append(opts.libPaths, args[1]) - consumedArgs = 2 - - case strings.HasPrefix(args[0], "-L"): - opts.libPaths = append(opts.libPaths, args[0][2:]) - - case args[0] == "-O0": - opts.optLevel = 0 - - case args[0] == "-O1", args[0] == "-O": - opts.optLevel = 1 - - case args[0] == "-O2": - opts.optLevel = 2 - - case args[0] == "-Os": - opts.optLevel = 2 - opts.sizeLevel = 1 - - case args[0] == "-O3": - opts.optLevel = 3 - - case args[0] == "-S": - actionKind = actionAssemble - - case args[0] == "-c": - actionKind = actionCompile - - case strings.HasPrefix(args[0], "-fcompilerrt-prefix="): - opts.sanitizer.crtPrefix = args[0][20:] - - case strings.HasPrefix(args[0], "-fdebug-prefix-map="): - split := strings.SplitN(args[0][19:], "=", 2) - if len(split) < 2 { - return opts, fmt.Errorf("argument '%s' must be of form '-fdebug-prefix-map=SOURCE=REPLACEMENT'", args[0]) - } - opts.debugPrefixMaps = append(opts.debugPrefixMaps, debug.PrefixMap{split[0], split[1]}) - - case args[0] == "-fdump-ssa": - opts.dumpSSA = true - - case args[0] == "-fdump-trace": - opts.dumpTrace = true - - case strings.HasPrefix(args[0], "-fgccgo-path="): - opts.gccgoPath = args[0][13:] - - case strings.HasPrefix(args[0], "-fgo-pkgpath="): - opts.pkgpath = args[0][13:] - - case strings.HasPrefix(args[0], "-fgo-relative-import-path="): - // TODO(pcc): Handle this. - - case strings.HasPrefix(args[0], "-fstack-protector"): - // TODO(axw) set ssp function attributes. This can be useful - // even for Go, if it interfaces with code written in a non- - // memory safe language (e.g. via cgo). - - case strings.HasPrefix(args[0], "-W"): - // Go doesn't do warnings. Ignore. - - case args[0] == "-fload-plugin": - if len(args) == 1 { - return opts, errors.New("missing argument after '-fload-plugin'") - } - opts.plugins = append(opts.plugins, args[1]) - consumedArgs = 2 - - case args[0] == "-fno-toplevel-reorder": - // This is a GCC-specific code generation option. Ignore. - - case args[0] == "-emit-llvm": - opts.emitIR = true - - case args[0] == "-flto": - opts.lto = true - - case args[0] == "-fPIC": - opts.pic = true - - case strings.HasPrefix(args[0], "-fsanitize-blacklist="): - opts.sanitizer.blacklist = args[0][21:] - - // TODO(pcc): Enforce mutual exclusion between sanitizers. - - case args[0] == "-fsanitize=address": - opts.sanitizer.address = true - - case args[0] == "-fsanitize=thread": - opts.sanitizer.thread = true - - case args[0] == "-fsanitize=memory": - opts.sanitizer.memory = true - - case args[0] == "-fsanitize=dataflow": - opts.sanitizer.dataflow = true - - case args[0] == "-g": - opts.generateDebug = true - - case args[0] == "-mllvm": - if len(args) == 1 { - return opts, errors.New("missing argument after '-mllvm'") - } - opts.llvmArgs = append(opts.llvmArgs, args[1]) - consumedArgs = 2 - - case strings.HasPrefix(args[0], "-m"), args[0] == "-funsafe-math-optimizations", args[0] == "-ffp-contract=off": - // TODO(pcc): Handle code generation options. - - case args[0] == "-no-prefix": - noPrefix = true - - case args[0] == "-o": - if len(args) == 1 { - return opts, errors.New("missing argument after '-o'") - } - opts.output = args[1] - consumedArgs = 2 - - case args[0] == "-pie": - opts.pieLink = true - - case args[0] == "-dumpversion", - args[0] == "-print-libgcc-file-name", - args[0] == "-print-multi-os-directory", - args[0] == "--version": - actionKind = actionPrint - opts.output = args[0] - - case args[0] == "-static": - opts.staticLink = true - - case args[0] == "-static-libgcc": - opts.staticLibgcc = true - - case args[0] == "-static-libgo": - opts.staticLibgo = true - - default: - return opts, fmt.Errorf("unrecognized command line option '%s'", args[0]) - } - - args = args[consumedArgs:] - } - - if actionKind != actionPrint && len(goInputs) == 0 && !hasOtherNonFlagInputs { - return opts, errors.New("no input files") - } - - if !noPrefix { - opts.prefix, err = getInstPrefix() - if err != nil { - return opts, err - } - } - - if opts.sanitizer.crtPrefix == "" { - opts.sanitizer.crtPrefix = opts.prefix - } - - if opts.sanitizer.isPIEDefault() { - // This should really only be turning on -fPIE, but this isn't - // easy to do from Go, and -fPIC is a superset of it anyway. - opts.pic = true - opts.pieLink = true - } - - switch actionKind { - case actionLink: - if len(goInputs) != 0 { - opts.actions = []action{action{actionCompile, goInputs}} - } - opts.actions = append(opts.actions, action{actionLink, otherInputs}) - - case actionCompile, actionAssemble: - if len(goInputs) != 0 { - opts.actions = []action{action{actionKind, goInputs}} - } - - case actionPrint: - opts.actions = []action{action{actionKind, nil}} - } - - if opts.output == "" && len(opts.actions) != 0 { - switch actionKind { - case actionCompile, actionAssemble: - base := filepath.Base(goInputs[0]) - base = base[0 : len(base)-3] - if actionKind == actionCompile { - opts.output = base + ".o" - } else { - opts.output = base + ".s" - } - - case actionLink: - opts.output = "a.out" - } - } - - return opts, nil -} - -func runPasses(opts *driverOptions, tm llvm.TargetMachine, m llvm.Module) { - fpm := llvm.NewFunctionPassManagerForModule(m) - defer fpm.Dispose() - - mpm := llvm.NewPassManager() - defer mpm.Dispose() - - pmb := llvm.NewPassManagerBuilder() - defer pmb.Dispose() - - pmb.SetOptLevel(opts.optLevel) - pmb.SetSizeLevel(opts.sizeLevel) - - tm.AddAnalysisPasses(mpm) - tm.AddAnalysisPasses(fpm) - - mpm.AddVerifierPass() - fpm.AddVerifierPass() - - pmb.Populate(mpm) - pmb.PopulateFunc(fpm) - - if opts.optLevel == 0 { - // Remove references (via the descriptor) to dead functions, - // for compatibility with other compilers. - mpm.AddGlobalDCEPass() - } - - opts.sanitizer.addPasses(mpm, fpm) - - fpm.InitializeFunc() - for fn := m.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) { - fpm.RunFunc(fn) - } - fpm.FinalizeFunc() - - mpm.Run(m) -} - -func getMetadataSectionInlineAsm(name string) string { - // ELF: creates a non-allocated excluded section. - return ".section \"" + name + "\", \"e\"\n" -} - -func getDataInlineAsm(data []byte) string { - edata := make([]byte, 0, len(data)*4+10) - - edata = append(edata, ".ascii \""...) - for i := range data { - switch data[i] { - case '\000': - edata = append(edata, "\\000"...) - continue - case '\n': - edata = append(edata, "\\n"...) - continue - case '"', '\\': - edata = append(edata, '\\') - } - edata = append(edata, data[i]) - } - edata = append(edata, "\"\n"...) - return string(edata) -} - -// Get the lib path to the standard libraries for the given driver options. -// This is normally 'lib' but can vary for cross compilation, LTO, sanitizers -// etc. -func getLibDir(opts *driverOptions) string { - lib := "lib" + LibDirSuffix - switch { - case opts.lto: - return filepath.Join(lib, "llvm-lto.0") - case opts.sanitizer.address: - return filepath.Join(lib, "llvm-asan.0") - case opts.sanitizer.thread: - return filepath.Join(lib, "llvm-tsan.0") - case opts.sanitizer.memory: - return filepath.Join(lib, "llvm-msan.0") - case opts.sanitizer.dataflow: - return filepath.Join(lib, "llvm-dfsan.0") - default: - return lib - } -} - -func performAction(opts *driverOptions, kind actionKind, inputs []string, output string) error { - switch kind { - case actionPrint: - switch opts.output { - case "-dumpversion": - fmt.Println("llgo-" + llvmVersion()) - return nil - case "-print-libgcc-file-name": - cmd := exec.Command(opts.bprefix+"gcc", "-print-libgcc-file-name") - out, err := cmd.CombinedOutput() - os.Stdout.Write(out) - return err - case "-print-multi-os-directory": - fmt.Println(filepath.Join("..", getLibDir(opts))) - return nil - case "--version": - displayVersion() - return nil - default: - panic("unexpected print command") - } - - case actionCompile, actionAssemble: - compiler, err := initCompiler(opts) - if err != nil { - return err - } - - fset := token.NewFileSet() - files, err := driver.ParseFiles(fset, inputs) - if err != nil { - return err - } - - module, err := compiler.Compile(fset, files, opts.pkgpath) - if err != nil { - return err - } - - defer module.Dispose() - - target, err := llvm.GetTargetFromTriple(opts.triple) - if err != nil { - return err - } - - optLevel := [...]llvm.CodeGenOptLevel{ - llvm.CodeGenLevelNone, - llvm.CodeGenLevelLess, - llvm.CodeGenLevelDefault, - llvm.CodeGenLevelAggressive, - }[opts.optLevel] - - relocMode := llvm.RelocStatic - if opts.pic { - relocMode = llvm.RelocPIC - } - - tm := target.CreateTargetMachine(opts.triple, "", "", optLevel, - relocMode, llvm.CodeModelDefault) - defer tm.Dispose() - - runPasses(opts, tm, module.Module) - - var file *os.File - if output == "-" { - file = os.Stdout - } else { - file, err = os.Create(output) - if err != nil { - return err - } - defer file.Close() - } - - switch { - case !opts.lto && !opts.emitIR: - if module.ExportData != nil { - asm := getMetadataSectionInlineAsm(".go_export") - asm += getDataInlineAsm(module.ExportData) - module.Module.SetInlineAsm(asm) - } - - fileType := llvm.AssemblyFile - if kind == actionCompile { - fileType = llvm.ObjectFile - } - mb, err := tm.EmitToMemoryBuffer(module.Module, fileType) - if err != nil { - return err - } - defer mb.Dispose() - - bytes := mb.Bytes() - _, err = file.Write(bytes) - return err - - case opts.lto: - bcmb := llvm.WriteBitcodeToMemoryBuffer(module.Module) - defer bcmb.Dispose() - - // This is a bit of a hack. We just want an object file - // containing some metadata sections. This might be simpler - // if we had bindings for the MC library, but for now we create - // a fresh module containing only inline asm that creates the - // sections. - outmodule := llvm.NewModule("") - defer outmodule.Dispose() - asm := getMetadataSectionInlineAsm(".llvmbc") - asm += getDataInlineAsm(bcmb.Bytes()) - if module.ExportData != nil { - asm += getMetadataSectionInlineAsm(".go_export") - asm += getDataInlineAsm(module.ExportData) - } - outmodule.SetInlineAsm(asm) - - fileType := llvm.AssemblyFile - if kind == actionCompile { - fileType = llvm.ObjectFile - } - mb, err := tm.EmitToMemoryBuffer(outmodule, fileType) - if err != nil { - return err - } - defer mb.Dispose() - - bytes := mb.Bytes() - _, err = file.Write(bytes) - return err - - case kind == actionCompile: - err := llvm.WriteBitcodeToFile(module.Module, file) - return err - - case kind == actionAssemble: - _, err := file.WriteString(module.Module.String()) - return err - - default: - panic("unexpected action kind") - } - - case actionLink: - // TODO(pcc): Teach this to do LTO. - args := []string{"-o", output} - if opts.pic { - args = append(args, "-fPIC") - } - if opts.pieLink { - args = append(args, "-pie") - } - if opts.staticLink { - args = append(args, "-static") - } - if opts.staticLibgcc { - args = append(args, "-static-libgcc") - } - for _, p := range opts.libPaths { - args = append(args, "-L", p) - } - for _, p := range opts.importPaths { - args = append(args, "-I", p) - } - args = append(args, inputs...) - var linkerPath string - if opts.gccgoPath == "" { - // TODO(pcc): See if we can avoid calling gcc here. - // We currently rely on it to find crt*.o and compile - // any C source files passed as arguments. - linkerPath = opts.bprefix + "gcc" - - if opts.prefix != "" { - libdir := filepath.Join(opts.prefix, getLibDir(opts)) - args = append(args, "-L", libdir) - if !opts.staticLibgo { - args = append(args, "-Wl,-rpath,"+libdir) - } - } - - args = append(args, "-lgobegin-llgo") - if opts.staticLibgo { - args = append(args, "-Wl,-Bstatic", "-lgo-llgo", "-Wl,-Bdynamic", "-lpthread", "-lm") - } else { - args = append(args, "-lgo-llgo", "-lm") - } - } else { - linkerPath = opts.gccgoPath - if opts.staticLibgo { - args = append(args, "-static-libgo") - } - } - - args = opts.sanitizer.addLibs(opts.triple, args) - - cmd := exec.Command(linkerPath, args...) - out, err := cmd.CombinedOutput() - if err != nil { - os.Stderr.Write(out) - } - return err - - default: - panic("unexpected action kind") - } -} - -func performActions(opts *driverOptions) error { - var extraInput string - - for _, plugin := range opts.plugins { - err := llvm.LoadLibraryPermanently(plugin) - if err != nil { - return err - } - } - - llvm.ParseCommandLineOptions(append([]string{"llgo"}, opts.llvmArgs...), "llgo (LLVM option parsing)\n") - - for i, action := range opts.actions { - var output string - if i == len(opts.actions)-1 { - output = opts.output - } else { - tmpfile, err := ioutil.TempFile("", "llgo") - if err != nil { - return err - } - output = tmpfile.Name() + ".o" - tmpfile.Close() - err = os.Remove(tmpfile.Name()) - if err != nil { - return err - } - defer os.Remove(output) - } - - inputs := action.inputs - if extraInput != "" { - inputs = append([]string{extraInput}, inputs...) - } - - err := performAction(opts, action.kind, inputs, output) - if err != nil { - return err - } - - extraInput = output - } - - return nil -} - -func main() { - llvm.InitializeAllTargets() - llvm.InitializeAllTargetMCs() - llvm.InitializeAllTargetInfos() - llvm.InitializeAllAsmParsers() - llvm.InitializeAllAsmPrinters() - - opts, err := parseArguments(os.Args[1:]) - if err != nil { - report(err) - os.Exit(1) - } - - err = performActions(&opts) - if err != nil { - report(err) - os.Exit(1) - } -} diff --git a/llgo/cmd/go/zdefaultcc.go.in b/llgo/cmd/go/zdefaultcc.go.in deleted file mode 100644 index 66d52d951bacaf72a064529ed65948ecf29e28d2..0000000000000000000000000000000000000000 --- a/llgo/cmd/go/zdefaultcc.go.in +++ /dev/null @@ -1,54 +0,0 @@ -//===- zdefaultcc.go - default compiler locations -------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file provides default locations for cc, cxx and llgo. -// -//===----------------------------------------------------------------------===// - -package main - -import ( - "path/filepath" - "os" - "os/exec" -) - -var defaultGCCGO, defaultCC, defaultCXX string - -func getInstPrefix() (string, error) { - path, err := exec.LookPath(os.Args[0]) - if err != nil { - return "", err - } - - path, err = filepath.EvalSymlinks(path) - if err != nil { - return "", err - } - - prefix := filepath.Join(path, "..", "..") - return prefix, nil -} - -func init() { - prefix, err := getInstPrefix() - if err != nil { - panic(err.Error()) - } - - defaultCC = filepath.Join(prefix, "bin", "clang") - defaultCXX = filepath.Join(prefix, "bin", "clang++") - defaultGCCGO = filepath.Join(prefix, "bin", "llgo") - toolDir = filepath.Join(prefix, "lib", "go", "llgo-@LLGO_VERSION@") - - gccgoName = os.Getenv("GCCGO") - if gccgoName == "" { - gccgoName = defaultGCCGO - } - gccgoBin, _ = exec.LookPath(gccgoName) -} diff --git a/llgo/cmd/llgoi/llgoi.go b/llgo/cmd/llgoi/llgoi.go deleted file mode 100644 index 39d9af6790acb1f06931b0ab48ca5b3f462fa5ea..0000000000000000000000000000000000000000 --- a/llgo/cmd/llgoi/llgoi.go +++ /dev/null @@ -1,596 +0,0 @@ -//===- llgoi.go - llgo-based Go REPL --------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This is llgoi, a Go REPL based on llgo and the LLVM JIT. -// -//===----------------------------------------------------------------------===// - -package main - -import ( - "bytes" - "errors" - "fmt" - "go/ast" - "go/build" - "go/parser" - "go/scanner" - "go/token" - "io" - "os" - "os/exec" - "path/filepath" - "runtime/debug" - "strconv" - "strings" - "unsafe" - - "llvm.org/llgo/driver" - "llvm.org/llgo/irgen" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llgo/third_party/liner" - "llvm.org/llvm/bindings/go/llvm" -) - -// /* Force exporting __morestack if it's available, so that it is -// available to the engine when linking with libLLVM.so. */ -// -// void *__morestack __attribute__((weak)); -import "C" - -func getInstPrefix() (string, error) { - path, err := exec.LookPath(os.Args[0]) - if err != nil { - return "", err - } - - path, err = filepath.EvalSymlinks(path) - if err != nil { - return "", err - } - - prefix := filepath.Join(path, "..", "..") - return prefix, nil -} - -func llvmVersion() string { - return strings.Replace(llvm.Version, "svn", "", 1) -} - -type line struct { - line string - isStmt bool - declName string - assigns []string - - parens, bracks, braces int -} - -type interp struct { - engine llvm.ExecutionEngine - - liner *liner.State - pendingLine line - - copts irgen.CompilerOptions - - imports []*types.Package - scope map[string]types.Object - - modules map[string]llvm.Module - pkgmap map[string]*types.Package - pkgnum int -} - -func (in *interp) makeCompilerOptions() error { - prefix, err := getInstPrefix() - if err != nil { - return err - } - - importPaths := []string{filepath.Join(prefix, "lib", "go", "llgo-"+llvmVersion())} - in.copts = irgen.CompilerOptions{ - TargetTriple: llvm.DefaultTargetTriple(), - ImportPaths: importPaths, - GenerateDebug: true, - Packages: in.pkgmap, - } - err = in.copts.MakeImporter() - if err != nil { - return err - } - - origImporter := in.copts.Importer - in.copts.Importer = func(pkgmap map[string]*types.Package, pkgpath string) (*types.Package, error) { - if pkg, ok := pkgmap[pkgpath]; ok && pkg.Complete() { - return pkg, nil - } - return origImporter(pkgmap, pkgpath) - } - return nil -} - -func (in *interp) init() error { - in.liner = liner.NewLiner() - in.scope = make(map[string]types.Object) - in.pkgmap = make(map[string]*types.Package) - in.modules = make(map[string]llvm.Module) - - err := in.makeCompilerOptions() - if err != nil { - return err - } - - return nil -} - -func (in *interp) dispose() { - in.liner.Close() - in.engine.Dispose() -} - -func (in *interp) loadSourcePackageFromCode(pkgcode, pkgpath string, copts irgen.CompilerOptions) (*types.Package, error) { - fset := token.NewFileSet() - file, err := parser.ParseFile(fset, "", pkgcode, parser.DeclarationErrors|parser.ParseComments) - if err != nil { - return nil, err - } - files := []*ast.File{file} - return in.loadSourcePackage(fset, files, pkgpath, copts) -} - -func (in *interp) loadSourcePackage(fset *token.FileSet, files []*ast.File, pkgpath string, copts irgen.CompilerOptions) (_ *types.Package, resultErr error) { - compiler, err := irgen.NewCompiler(copts) - if err != nil { - return nil, err - } - - module, err := compiler.Compile(fset, files, pkgpath) - if err != nil { - return nil, err - } - in.modules[pkgpath] = module.Module - - if in.engine.C != nil { - in.engine.AddModule(module.Module) - } else { - options := llvm.NewMCJITCompilerOptions() - in.engine, err = llvm.NewMCJITCompiler(module.Module, options) - if err != nil { - return nil, err - } - } - - var importFunc func() - importAddress := in.getPackageSymbol(pkgpath, ".import$descriptor") - *(*unsafe.Pointer)(unsafe.Pointer(&importFunc)) = importAddress - - defer func() { - p := recover() - if p != nil { - resultErr = fmt.Errorf("panic: %v\n%v", p, string(debug.Stack())) - } - }() - importFunc() - in.pkgmap[pkgpath] = module.Package - - return module.Package, nil -} - -func (in *interp) getPackageSymbol(pkgpath, name string) unsafe.Pointer { - symbolName := irgen.ManglePackagePath(pkgpath) + "." + name - global := in.modules[pkgpath].NamedGlobal(symbolName) - if global.IsNil() { - return nil - } - return in.engine.PointerToGlobal(global) -} - -func (in *interp) augmentPackageScope(pkg *types.Package) { - for _, obj := range in.scope { - pkg.Scope().Insert(obj) - } -} - -func (l *line) append(str string, assigns []string) { - var s scanner.Scanner - fset := token.NewFileSet() - file := fset.AddFile("", fset.Base(), len(str)) - s.Init(file, []byte(str), nil, 0) - - _, tok, _ := s.Scan() - if l.line == "" { - switch tok { - case token.FOR, token.GO, token.IF, token.LBRACE, token.SELECT, token.SWITCH: - l.isStmt = true - case token.CONST, token.FUNC, token.TYPE, token.VAR: - var lit string - _, tok, lit = s.Scan() - if tok == token.IDENT { - l.declName = lit - } - } - } - - for tok != token.EOF { - switch tok { - case token.LPAREN: - l.parens++ - case token.RPAREN: - l.parens-- - case token.LBRACE: - l.braces++ - case token.RBRACE: - l.braces-- - case token.LBRACK: - l.bracks++ - case token.RBRACK: - l.bracks-- - case token.DEC, token.INC, - token.ASSIGN, token.ADD_ASSIGN, token.SUB_ASSIGN, - token.MUL_ASSIGN, token.QUO_ASSIGN, token.REM_ASSIGN, - token.AND_ASSIGN, token.OR_ASSIGN, token.XOR_ASSIGN, - token.SHL_ASSIGN, token.SHR_ASSIGN, token.AND_NOT_ASSIGN: - if l.parens == 0 && l.bracks == 0 && l.braces == 0 { - l.isStmt = true - } - } - _, tok, _ = s.Scan() - } - - if l.line == "" { - l.assigns = assigns - } - l.line += str -} - -func (l *line) ready() bool { - return l.parens <= 0 && l.bracks <= 0 && l.braces <= 0 -} - -func (in *interp) readExprLine(str string, assigns []string) ([]interface{}, error) { - in.pendingLine.append(str, assigns) - if !in.pendingLine.ready() { - return nil, nil - } - results, err := in.interpretLine(in.pendingLine) - in.pendingLine = line{} - return results, err -} - -func (in *interp) interpretLine(l line) ([]interface{}, error) { - pkgname := fmt.Sprintf("input%05d", in.pkgnum) - in.pkgnum++ - - pkg := types.NewPackage(pkgname, pkgname) - scope := pkg.Scope() - - for _, imppkg := range in.imports { - obj := types.NewPkgName(token.NoPos, pkg, imppkg.Name(), imppkg) - scope.Insert(obj) - } - - in.augmentPackageScope(pkg) - - var tv types.TypeAndValue - if l.declName == "" && !l.isStmt { - var err error - tv, err = types.Eval(l.line, pkg, scope) - if err != nil { - return nil, err - } - } - - var code bytes.Buffer - fmt.Fprintf(&code, "package %s\n", pkgname) - - for _, pkg := range in.imports { - fmt.Fprintf(&code, "import %q\n", pkg.Path()) - } - - if l.declName != "" { - code.WriteString(l.line) - } else if !l.isStmt && tv.IsValue() { - var typs []types.Type - if tuple, ok := tv.Type.(*types.Tuple); ok { - typs = make([]types.Type, tuple.Len()) - for i := range typs { - typs[i] = tuple.At(i).Type() - } - } else { - typs = []types.Type{tv.Type} - } - if len(l.assigns) == 2 && tv.HasOk() { - typs = append(typs, types.Typ[types.Bool]) - } - if len(l.assigns) != 0 && len(l.assigns) != len(typs) { - return nil, errors.New("return value mismatch") - } - - code.WriteString("var ") - for i := range typs { - if i != 0 { - code.WriteString(", ") - } - if len(l.assigns) != 0 && l.assigns[i] != "" { - if _, ok := in.scope[l.assigns[i]]; ok { - fmt.Fprintf(&code, "__llgoiV%d", i) - } else { - code.WriteString(l.assigns[i]) - } - } else { - fmt.Fprintf(&code, "__llgoiV%d", i) - } - } - fmt.Fprintf(&code, " = %s\n", l.line) - - code.WriteString("func init() {\n") - varnames := make([]string, len(typs)) - for i := range typs { - var varname string - if len(l.assigns) != 0 && l.assigns[i] != "" { - if _, ok := in.scope[l.assigns[i]]; ok { - fmt.Fprintf(&code, "\t%s = __llgoiV%d\n", l.assigns[i], i) - } - varname = l.assigns[i] - } else { - varname = fmt.Sprintf("__llgoiV%d", i) - } - varnames[i] = varname - } - code.WriteString("}\n\n") - - code.WriteString("func __llgoiResults() []interface{} {\n") - code.WriteString("\treturn []interface{}{\n") - for _, varname := range varnames { - fmt.Fprintf(&code, "\t\t%s,\n", varname) - } - code.WriteString("\t}\n") - code.WriteString("}\n") - } else { - if len(l.assigns) != 0 { - return nil, errors.New("return value mismatch") - } - - fmt.Fprintf(&code, "func init() {\n\t%s}", l.line) - } - - copts := in.copts - copts.PackageCreated = in.augmentPackageScope - copts.DisableUnusedImportCheck = true - pkg, err := in.loadSourcePackageFromCode(code.String(), pkgname, copts) - if err != nil { - return nil, err - } - in.imports = append(in.imports, pkg) - - var results []interface{} - llgoiResultsAddress := in.getPackageSymbol(pkgname, "__llgoiResults$descriptor") - if llgoiResultsAddress != nil { - var resultsFunc func() []interface{} - *(*unsafe.Pointer)(unsafe.Pointer(&resultsFunc)) = llgoiResultsAddress - results = resultsFunc() - } - - for _, assign := range l.assigns { - if assign != "" { - if _, ok := in.scope[assign]; !ok { - in.scope[assign] = pkg.Scope().Lookup(assign) - } - } - } - - if l.declName != "" { - in.scope[l.declName] = pkg.Scope().Lookup(l.declName) - } - - return results, nil -} - -func (in *interp) maybeReadAssignment(line string, s *scanner.Scanner, initial string, base int) (bool, error) { - if initial == "_" { - initial = "" - } - assigns := []string{initial} - - pos, tok, lit := s.Scan() - for tok == token.COMMA { - pos, tok, lit = s.Scan() - if tok != token.IDENT { - return false, nil - } - - if lit == "_" { - lit = "" - } - assigns = append(assigns, lit) - - pos, tok, lit = s.Scan() - } - - if tok != token.DEFINE { - return false, nil - } - - // It's an assignment statement, there are no results. - _, err := in.readExprLine(line[int(pos)-base+2:], assigns) - return true, err -} - -func (in *interp) loadPackage(pkgpath string) (*types.Package, error) { - pkg, err := in.copts.Importer(in.pkgmap, pkgpath) - if err == nil { - return pkg, nil - } - - buildpkg, err := build.Import(pkgpath, ".", 0) - if err != nil { - return nil, err - } - if len(buildpkg.CgoFiles) != 0 { - return nil, fmt.Errorf("%s: cannot load cgo package", pkgpath) - } - - for _, imp := range buildpkg.Imports { - _, err := in.loadPackage(imp) - if err != nil { - return nil, err - } - } - - inputs := make([]string, len(buildpkg.GoFiles)) - for i, file := range buildpkg.GoFiles { - inputs[i] = filepath.Join(buildpkg.Dir, file) - } - - fset := token.NewFileSet() - files, err := driver.ParseFiles(fset, inputs) - if err != nil { - return nil, err - } - - return in.loadSourcePackage(fset, files, pkgpath, in.copts) -} - -// readLine accumulates lines of input, including trailing newlines, -// executing statements as they are completed. -func (in *interp) readLine(line string) ([]interface{}, error) { - if !in.pendingLine.ready() { - return in.readExprLine(line, nil) - } - - var s scanner.Scanner - fset := token.NewFileSet() - file := fset.AddFile("", fset.Base(), len(line)) - s.Init(file, []byte(line), nil, 0) - - _, tok, lit := s.Scan() - switch tok { - case token.EOF: - return nil, nil - - case token.IMPORT: - _, tok, lit = s.Scan() - if tok != token.STRING { - return nil, errors.New("expected string literal") - } - pkgpath, err := strconv.Unquote(lit) - if err != nil { - return nil, err - } - pkg, err := in.loadPackage(pkgpath) - if err != nil { - return nil, err - } - in.imports = append(in.imports, pkg) - return nil, nil - - case token.IDENT: - ok, err := in.maybeReadAssignment(line, &s, lit, file.Base()) - if err != nil { - return nil, err - } - if ok { - return nil, nil - } - fallthrough - - default: - return in.readExprLine(line, nil) - } -} - -// printResult prints a value that was the result of an expression evaluated -// by the interpreter. -func printResult(w io.Writer, v interface{}) { - // TODO the result should be formatted in Go syntax, without - // package qualifiers for types defined within the interpreter. - fmt.Fprintf(w, "%+v", v) -} - -// formatHistory reformats the provided Go source by collapsing all lines -// and adding semicolons where required, suitable for adding to line history. -func formatHistory(input []byte) string { - var buf bytes.Buffer - var s scanner.Scanner - fset := token.NewFileSet() - file := fset.AddFile("", fset.Base(), len(input)) - s.Init(file, input, nil, 0) - pos, tok, lit := s.Scan() - for tok != token.EOF { - if int(pos)-1 > buf.Len() { - n := int(pos) - 1 - buf.Len() - buf.WriteString(strings.Repeat(" ", n)) - } - var semicolon bool - if tok == token.SEMICOLON { - semicolon = true - } else if lit != "" { - buf.WriteString(lit) - } else { - buf.WriteString(tok.String()) - } - pos, tok, lit = s.Scan() - if semicolon { - switch tok { - case token.RBRACE, token.RPAREN, token.EOF: - default: - buf.WriteRune(';') - } - } - } - return buf.String() -} - -func main() { - llvm.LinkInMCJIT() - llvm.InitializeNativeTarget() - llvm.InitializeNativeAsmPrinter() - - var in interp - err := in.init() - if err != nil { - panic(err) - } - defer in.dispose() - - var buf bytes.Buffer - for { - if in.pendingLine.ready() && buf.Len() > 0 { - history := formatHistory(buf.Bytes()) - in.liner.AppendHistory(history) - buf.Reset() - } - prompt := "(llgo) " - if !in.pendingLine.ready() { - prompt = strings.Repeat(" ", len(prompt)) - } - line, err := in.liner.Prompt(prompt) - if err == io.EOF { - break - } else if err != nil { - panic(err) - } - if line == "" { - continue - } - buf.WriteString(line + "\n") - results, err := in.readLine(line + "\n") - if err != nil { - fmt.Println(err) - } - for _, result := range results { - printResult(os.Stdout, result) - fmt.Println() - } - } - - if liner.TerminalSupported() { - fmt.Println() - } -} diff --git a/llgo/debug/debug.go b/llgo/debug/debug.go deleted file mode 100644 index 561360a40c82bfab03d814fd02b36a234a65c61f..0000000000000000000000000000000000000000 --- a/llgo/debug/debug.go +++ /dev/null @@ -1,431 +0,0 @@ -//===- debug.go - debug info builder --------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This package builds LLVM debug info from go/* data structures. -// -//===----------------------------------------------------------------------===// - -package debug - -import ( - "debug/dwarf" - "fmt" - "go/token" - "os" - "strings" - - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llgo/third_party/gotools/go/types/typeutil" - - "llvm.org/llvm/bindings/go/llvm" -) - -const ( - // non-standard debug metadata tags - tagAutoVariable dwarf.Tag = 0x100 - tagArgVariable dwarf.Tag = 0x101 -) - -type PrefixMap struct { - Source, Replacement string -} - -// DIBuilder builds debug metadata for Go programs. -type DIBuilder struct { - // builder is the current builder; there is one per CU. - builder *llvm.DIBuilder - module llvm.Module - files map[*token.File]llvm.Metadata - cu, fn, lb llvm.Metadata - fnFile string - sizes types.Sizes - fset *token.FileSet - prefixMaps []PrefixMap - types typeutil.Map - voidType llvm.Metadata -} - -// NewDIBuilder creates a new debug information builder. -func NewDIBuilder(sizes types.Sizes, module llvm.Module, fset *token.FileSet, prefixMaps []PrefixMap) *DIBuilder { - var d DIBuilder - d.module = module - d.files = make(map[*token.File]llvm.Metadata) - d.sizes = sizes - d.fset = fset - d.prefixMaps = prefixMaps - d.builder = llvm.NewDIBuilder(d.module) - d.cu = d.createCompileUnit() - return &d -} - -// Destroy destroys the DIBuilder. -func (d *DIBuilder) Destroy() { - d.builder.Destroy() -} - -func (d *DIBuilder) scope() llvm.Metadata { - if d.lb.C != nil { - return d.lb - } - if d.fn.C != nil { - return d.fn - } - return d.cu -} - -func (d *DIBuilder) remapFilePath(path string) string { - for _, pm := range d.prefixMaps { - if strings.HasPrefix(path, pm.Source) { - return pm.Replacement + path[len(pm.Source):] - } - } - return path -} - -func (d *DIBuilder) getFile(file *token.File) llvm.Metadata { - if diFile := d.files[file]; diFile.C != nil { - return diFile - } - diFile := d.builder.CreateFile(d.remapFilePath(file.Name()), "") - d.files[file] = diFile - return diFile -} - -// createCompileUnit creates and returns debug metadata for the compile -// unit as a whole, using the first file in the file set as a representative -// (the choice of file is arbitrary). -func (d *DIBuilder) createCompileUnit() llvm.Metadata { - var file *token.File - d.fset.Iterate(func(f *token.File) bool { - file = f - return false - }) - dir, err := os.Getwd() - if err != nil { - panic("could not get current directory: " + err.Error()) - } - return d.builder.CreateCompileUnit(llvm.DICompileUnit{ - Language: llvm.DW_LANG_Go, - File: d.remapFilePath(file.Name()), - Dir: dir, - Producer: "llgo", - }) -} - -// PushFunction creates debug metadata for the specified function, -// and pushes it onto the scope stack. -func (d *DIBuilder) PushFunction(fnptr llvm.Value, sig *types.Signature, pos token.Pos) { - var diFile llvm.Metadata - var line int - if file := d.fset.File(pos); file != nil { - d.fnFile = file.Name() - diFile = d.getFile(file) - line = file.Line(pos) - } - d.fn = d.builder.CreateFunction(d.scope(), llvm.DIFunction{ - Name: fnptr.Name(), // TODO(axw) unmangled name? - LinkageName: fnptr.Name(), - File: diFile, - Line: line, - Type: d.DIType(sig), - IsDefinition: true, - }) - fnptr.SetSubprogram(d.fn) -} - -// PopFunction pops the previously pushed function off the scope stack. -func (d *DIBuilder) PopFunction() { - d.lb = llvm.Metadata{} - d.fn = llvm.Metadata{} - d.fnFile = "" -} - -// Value creates an llvm.dbg.value call for the specified register value. -func (d *DIBuilder) Value(b llvm.Builder, v ssa.Value, llv llvm.Value, paramIndex int) { - // TODO(axw) -} - -// SetLocation sets the current debug location. -func (d *DIBuilder) SetLocation(b llvm.Builder, pos token.Pos) { - position := d.fset.Position(pos) - d.lb = llvm.Metadata{} - if position.Filename != d.fnFile && position.Filename != "" { - // This can happen rarely, e.g. in init functions. - diFile := d.builder.CreateFile(d.remapFilePath(position.Filename), "") - d.lb = d.builder.CreateLexicalBlockFile(d.scope(), diFile, 0) - } - b.SetCurrentDebugLocation(uint(position.Line), uint(position.Column), d.scope(), llvm.Metadata{}) -} - -// Finalize must be called after all compilation units are translated, -// generating the final debug metadata for the module. -func (d *DIBuilder) Finalize() { - d.module.AddNamedMetadataOperand( - "llvm.module.flags", - llvm.GlobalContext().MDNode([]llvm.Metadata{ - llvm.ConstInt(llvm.Int32Type(), 2, false).ConstantAsMetadata(), // Warn on mismatch - llvm.GlobalContext().MDString("Dwarf Version"), - llvm.ConstInt(llvm.Int32Type(), 4, false).ConstantAsMetadata(), - }), - ) - d.module.AddNamedMetadataOperand( - "llvm.module.flags", - llvm.GlobalContext().MDNode([]llvm.Metadata{ - llvm.ConstInt(llvm.Int32Type(), 1, false).ConstantAsMetadata(), // Error on mismatch - llvm.GlobalContext().MDString("Debug Info Version"), - llvm.ConstInt(llvm.Int32Type(), 3, false).ConstantAsMetadata(), - }), - ) - d.builder.Finalize() -} - -// DIType maps a Go type to DIType debug metadata value. -func (d *DIBuilder) DIType(t types.Type) llvm.Metadata { - return d.typeDebugDescriptor(t, types.TypeString(nil, t)) -} - -func (d *DIBuilder) typeDebugDescriptor(t types.Type, name string) llvm.Metadata { - // Signature needs to be handled specially, to preprocess - // methods, moving the receiver to the parameter list. - if t, ok := t.(*types.Signature); ok { - return d.descriptorSignature(t, name) - } - if t == nil { - if d.voidType.C == nil { - d.voidType = d.builder.CreateBasicType(llvm.DIBasicType{Name: "void"}) - } - return d.voidType - } - if dt, ok := d.types.At(t).(llvm.Metadata); ok { - return dt - } - dt := d.descriptor(t, name) - d.types.Set(t, dt) - return dt -} - -func (d *DIBuilder) descriptor(t types.Type, name string) llvm.Metadata { - switch t := t.(type) { - case *types.Basic: - return d.descriptorBasic(t, name) - case *types.Pointer: - return d.descriptorPointer(t) - case *types.Struct: - return d.descriptorStruct(t, name) - case *types.Named: - return d.descriptorNamed(t) - case *types.Array: - return d.descriptorArray(t, name) - case *types.Slice: - return d.descriptorSlice(t, name) - case *types.Map: - return d.descriptorMap(t, name) - case *types.Chan: - return d.descriptorChan(t, name) - case *types.Interface: - return d.descriptorInterface(t, name) - default: - panic(fmt.Sprintf("unhandled type: %T", t)) - } -} - -func (d *DIBuilder) descriptorBasic(t *types.Basic, name string) llvm.Metadata { - switch t.Kind() { - case types.String: - return d.typeDebugDescriptor(types.NewStruct([]*types.Var{ - types.NewVar(0, nil, "ptr", types.NewPointer(types.Typ[types.Uint8])), - types.NewVar(0, nil, "len", types.Typ[types.Int]), - }, nil), name) - case types.UnsafePointer: - return d.builder.CreateBasicType(llvm.DIBasicType{ - Name: name, - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - Encoding: llvm.DW_ATE_unsigned, - }) - default: - bt := llvm.DIBasicType{ - Name: t.String(), - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - } - switch bi := t.Info(); { - case bi&types.IsBoolean != 0: - bt.Encoding = llvm.DW_ATE_boolean - case bi&types.IsUnsigned != 0: - bt.Encoding = llvm.DW_ATE_unsigned - case bi&types.IsInteger != 0: - bt.Encoding = llvm.DW_ATE_signed - case bi&types.IsFloat != 0: - bt.Encoding = llvm.DW_ATE_float - case bi&types.IsComplex != 0: - bt.Encoding = llvm.DW_ATE_imaginary_float - case bi&types.IsUnsigned != 0: - bt.Encoding = llvm.DW_ATE_unsigned - default: - panic(fmt.Sprintf("unhandled: %#v", t)) - } - return d.builder.CreateBasicType(bt) - } -} - -func (d *DIBuilder) descriptorPointer(t *types.Pointer) llvm.Metadata { - return d.builder.CreatePointerType(llvm.DIPointerType{ - Pointee: d.DIType(t.Elem()), - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - AlignInBits: uint32(d.sizes.Alignof(t) * 8), - }) -} - -func (d *DIBuilder) descriptorStruct(t *types.Struct, name string) llvm.Metadata { - fields := make([]*types.Var, t.NumFields()) - for i := range fields { - fields[i] = t.Field(i) - } - offsets := d.sizes.Offsetsof(fields) - members := make([]llvm.Metadata, len(fields)) - for i, f := range fields { - // TODO(axw) file/line where member is defined. - t := f.Type() - members[i] = d.builder.CreateMemberType(d.cu, llvm.DIMemberType{ - Name: f.Name(), - Type: d.DIType(t), - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - AlignInBits: uint32(d.sizes.Alignof(t) * 8), - OffsetInBits: uint64(offsets[i] * 8), - }) - } - // TODO(axw) file/line where struct is defined. - return d.builder.CreateStructType(d.cu, llvm.DIStructType{ - Name: name, - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - AlignInBits: uint32(d.sizes.Alignof(t) * 8), - Elements: members, - }) -} - -func (d *DIBuilder) descriptorNamed(t *types.Named) llvm.Metadata { - var diFile llvm.Metadata - var line int - if file := d.fset.File(t.Obj().Pos()); file != nil { - line = file.Line(t.Obj().Pos()) - diFile = d.getFile(file) - } - - // Create a placeholder for the named type, to terminate cycles. - name := t.Obj().Name() - placeholder := d.builder.CreateReplaceableCompositeType(d.scope(), llvm.DIReplaceableCompositeType{ - Tag: dwarf.TagStructType, - Name: name, - File: diFile, - Line: line, - }) - d.types.Set(t, placeholder) - - typedef := d.builder.CreateTypedef(llvm.DITypedef{ - Type: d.DIType(t.Underlying()), - Name: name, - File: diFile, - Line: line, - }) - placeholder.ReplaceAllUsesWith(typedef) - return typedef -} - -func (d *DIBuilder) descriptorArray(t *types.Array, name string) llvm.Metadata { - return d.builder.CreateArrayType(llvm.DIArrayType{ - SizeInBits: uint64(d.sizes.Sizeof(t) * 8), - AlignInBits: uint32(d.sizes.Alignof(t) * 8), - ElementType: d.DIType(t.Elem()), - Subscripts: []llvm.DISubrange{{Count: t.Len()}}, - }) -} - -func (d *DIBuilder) descriptorSlice(t *types.Slice, name string) llvm.Metadata { - sliceStruct := types.NewStruct([]*types.Var{ - types.NewVar(0, nil, "ptr", types.NewPointer(t.Elem())), - types.NewVar(0, nil, "len", types.Typ[types.Int]), - types.NewVar(0, nil, "cap", types.Typ[types.Int]), - }, nil) - return d.typeDebugDescriptor(sliceStruct, name) -} - -func (d *DIBuilder) descriptorMap(t *types.Map, name string) llvm.Metadata { - // FIXME: This should be DW_TAG_pointer_type to __go_map. - return d.descriptorBasic(types.Typ[types.Uintptr], name) -} - -func (d *DIBuilder) descriptorChan(t *types.Chan, name string) llvm.Metadata { - // FIXME: This should be DW_TAG_pointer_type to __go_channel. - return d.descriptorBasic(types.Typ[types.Uintptr], name) -} - -func (d *DIBuilder) descriptorInterface(t *types.Interface, name string) llvm.Metadata { - ifaceStruct := types.NewStruct([]*types.Var{ - types.NewVar(0, nil, "type", types.NewPointer(types.Typ[types.Uint8])), - types.NewVar(0, nil, "data", types.NewPointer(types.Typ[types.Uint8])), - }, nil) - return d.typeDebugDescriptor(ifaceStruct, name) -} - -func (d *DIBuilder) descriptorSignature(t *types.Signature, name string) llvm.Metadata { - // If there's a receiver change the receiver to an - // additional (first) parameter, and take the value of - // the resulting signature instead. - if recv := t.Recv(); recv != nil { - params := t.Params() - paramvars := make([]*types.Var, int(params.Len()+1)) - paramvars[0] = recv - for i := 0; i < int(params.Len()); i++ { - paramvars[i+1] = params.At(i) - } - params = types.NewTuple(paramvars...) - t := types.NewSignature(nil, nil, params, t.Results(), t.Variadic()) - return d.typeDebugDescriptor(t, name) - } - if dt, ok := d.types.At(t).(llvm.Metadata); ok { - return dt - } - - var returnType llvm.Metadata - results := t.Results() - switch n := results.Len(); n { - case 0: - returnType = d.DIType(nil) // void - case 1: - returnType = d.DIType(results.At(0).Type()) - default: - fields := make([]*types.Var, results.Len()) - for i := range fields { - f := results.At(i) - // Structs may not have multiple fields - // with the same name, excepting "_". - if f.Name() == "" { - f = types.NewVar(f.Pos(), f.Pkg(), "_", f.Type()) - } - fields[i] = f - } - returnType = d.typeDebugDescriptor(types.NewStruct(fields, nil), "") - } - - var paramTypes []llvm.Metadata - params := t.Params() - if params != nil && params.Len() > 0 { - paramTypes = make([]llvm.Metadata, params.Len()+1) - paramTypes[0] = returnType - for i := range paramTypes[1:] { - paramTypes[i+1] = d.DIType(params.At(i).Type()) - } - } else { - paramTypes = []llvm.Metadata{returnType} - } - - // TODO(axw) get position of type definition for File field - return d.builder.CreateSubroutineType(llvm.DISubroutineType{ - Parameters: paramTypes, - }) -} diff --git a/llgo/docs/Makefile.sphinx b/llgo/docs/Makefile.sphinx deleted file mode 100644 index b3083d5f90ad7f0eb2aa73bbe841b6e2baf41576..0000000000000000000000000000000000000000 --- a/llgo/docs/Makefile.sphinx +++ /dev/null @@ -1,177 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - rm -rf $(BUILDDIR)/* - -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/llgo.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/llgo.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/llgo" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/llgo" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/llgo/docs/conf.py b/llgo/docs/conf.py deleted file mode 100644 index 11a5e5143660bf9b63fcdce40cff4dc678e8f1bb..0000000000000000000000000000000000000000 --- a/llgo/docs/conf.py +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf-8 -*- -# -# llgo documentation build configuration file, created by -# sphinx-quickstart on Sun Apr 5 16:02:16 2015. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys -import os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'llgo' -copyright = u'2015, LLVM Team' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '3.7' -# The full version, including alpha/beta/rc tags. -release = '3.7' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build'] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'default' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -#html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'llgodoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', 'llgo.tex', u'llgo Documentation', - u'LLVM Team', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'llgo', u'llgo Documentation', - [u'LLVM Team'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'llgo', u'llgo Documentation', - u'LLVM Team', 'llgo', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False diff --git a/llgo/docs/index.rst b/llgo/docs/index.rst deleted file mode 100644 index 40cfc43fd2377b27d874fdd3be65bb8f6a78284d..0000000000000000000000000000000000000000 --- a/llgo/docs/index.rst +++ /dev/null @@ -1,23 +0,0 @@ -.. llgo documentation master file, created by - sphinx-quickstart on Sun Apr 5 16:02:16 2015. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to llgo's documentation! -================================ - -Contents: - -.. toctree:: - :maxdepth: 2 - - llgoi - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/llgo/docs/llgoi.rst b/llgo/docs/llgoi.rst deleted file mode 100644 index c7def7dde43639489cf6c357024179384978575d..0000000000000000000000000000000000000000 --- a/llgo/docs/llgoi.rst +++ /dev/null @@ -1,80 +0,0 @@ -===== -llgoi -===== - -Introduction -============ - -llgoi is an interactive REPL for Go. It supports expressions, statements, -most declarations and imports, including binary imports from the standard -library and source imports from ``$GOPATH``. - -Example usage -============= - -.. code-block:: none - - (llgo) 1+1 - #0 untyped int = 2 - (llgo) x := 1 - x untyped int = 1 - (llgo) x++ - (llgo) x - #0 int = 2 - (llgo) import "fmt" - (llgo) fmt.Println("hello world") - hello world - #0 int = 12 - #1 error () = - (llgo) for i := 0; i != 3; i++ { - fmt.Println(i) - } - 0 - 1 - 2 - (llgo) func foo() { - fmt.Println("hello decl") - } - (llgo) foo() - hello decl - (llgo) import "golang.org/x/tools/go/types" - # golang.org/x/tools/go/ast/astutil - # golang.org/x/tools/go/exact - # golang.org/x/tools/go/types - (llgo) types.Eval("1+1", nil, nil) - #0 golang.org/x/tools/go/types.TypeAndValue = {mode:4 Type:untyped int Value:2} - #1 error () = - -Expressions -=========== - -Expressions can be evaluated by entering them at the llgoi prompt. The -result of evaluating the expression is displayed as if printed with the -format string ``"%+v"``. If the expression has multiple values (e.g. calls), -each value is displayed separately. - -Declarations -============ - -Declarations introduce new entities into llgoi's scope. For example, entering -``x := 1`` introduces into the scope a variable named ``x`` with an initial -value of 1. In addition to short variable declarations (i.e. variables declared -with ``:=``), llgoi supports constant declarations, function declarations, -variable declarations and type declarations. - -Imports -======= - -To import a package, enter ``import`` followed by the name of a package -surrounded by quotes. This introduces the package name into llgoi's -scope. The package may be a standard library package, or a source package on -``$GOPATH``. In the latter case, llgoi will first compile the package and -its dependencies. - -Statements -========== - -Aside from declarations and expressions, the following kinds of statements -can be evaluated by entering them at the llgoi prompt: IncDec statements, -assignments, go statements, blocks, if statements, switch statements, select -statements and for statements. diff --git a/llgo/docs/make.bat b/llgo/docs/make.bat deleted file mode 100644 index 449a79dcc89193109d4c67f19176cf9d4df3f547..0000000000000000000000000000000000000000 --- a/llgo/docs/make.bat +++ /dev/null @@ -1,242 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. xml to make Docutils-native XML files - echo. pseudoxml to make pseudoxml-XML files for display purposes - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - - -%SPHINXBUILD% 2> nul -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\llgo.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\llgo.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdf" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdfja" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf-ja - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -if "%1" == "xml" ( - %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The XML files are in %BUILDDIR%/xml. - goto end -) - -if "%1" == "pseudoxml" ( - %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. - goto end -) - -:end diff --git a/llgo/driver/parser.go b/llgo/driver/parser.go deleted file mode 100644 index 94ae3fd80194b355051e9a6c02b7189b129665af..0000000000000000000000000000000000000000 --- a/llgo/driver/parser.go +++ /dev/null @@ -1,42 +0,0 @@ -//===- parser.go - parser wrapper -----------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains functions for calling the parser in an appropriate way for -// llgo. -// -//===----------------------------------------------------------------------===// - -package driver - -import ( - "fmt" - "go/ast" - "go/parser" - "go/scanner" - "go/token" -) - -func parseFile(fset *token.FileSet, filename string) (*ast.File, error) { - // Retain comments; this is important for annotation processing. - mode := parser.DeclarationErrors | parser.ParseComments - return parser.ParseFile(fset, filename, nil, mode) -} - -func ParseFiles(fset *token.FileSet, filenames []string) ([]*ast.File, error) { - files := make([]*ast.File, len(filenames)) - for i, filename := range filenames { - file, err := parseFile(fset, filename) - if _, ok := err.(scanner.ErrorList); ok { - return nil, err - } else if err != nil { - return nil, fmt.Errorf("%q: %v", filename, err) - } - files[i] = file - } - return files, nil -} diff --git a/llgo/include/dwarf2.h b/llgo/include/dwarf2.h deleted file mode 100644 index 9824fc079d5ef4cecb069cd82fe16910fce2f5ae..0000000000000000000000000000000000000000 --- a/llgo/include/dwarf2.h +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------- dwarf2.h -------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// DWARF constants. Derived from: -// - libcxxabi/src/Unwind/dwarf2.h -// - DWARF 4 specification -// -//===----------------------------------------------------------------------===// - -#ifndef DWARF2_H -#define DWARF2_H - -enum dwarf_attribute { - DW_AT_name = 0x03, - DW_AT_stmt_list = 0x10, - DW_AT_low_pc = 0x11, - DW_AT_high_pc = 0x12, - DW_AT_comp_dir = 0x1b, - DW_AT_abstract_origin = 0x31, - DW_AT_specification = 0x47, - DW_AT_ranges = 0x55, - DW_AT_call_file = 0x58, - DW_AT_call_line = 0x59, - DW_AT_linkage_name = 0x6e, - DW_AT_MIPS_linkage_name = 0x2007 -}; - -enum dwarf_form { - DW_FORM_addr = 0x01, - DW_FORM_block2 = 0x03, - DW_FORM_block4 = 0x04, - DW_FORM_data2 = 0x05, - DW_FORM_data4 = 0x06, - DW_FORM_data8 = 0x07, - DW_FORM_string = 0x08, - DW_FORM_block = 0x09, - DW_FORM_block1 = 0x0a, - DW_FORM_data1 = 0x0b, - DW_FORM_flag = 0x0c, - DW_FORM_sdata = 0x0d, - DW_FORM_strp = 0x0e, - DW_FORM_udata = 0x0f, - DW_FORM_ref_addr = 0x10, - DW_FORM_ref1 = 0x11, - DW_FORM_ref2 = 0x12, - DW_FORM_ref4 = 0x13, - DW_FORM_ref8 = 0x14, - DW_FORM_ref_udata = 0x15, - DW_FORM_indirect = 0x16, - DW_FORM_sec_offset = 0x17, - DW_FORM_exprloc = 0x18, - DW_FORM_flag_present = 0x19, - DW_FORM_ref_sig8 = 0x20, - DW_FORM_GNU_addr_index = 0x1f01, - DW_FORM_GNU_str_index = 0x1f02, - DW_FORM_GNU_ref_alt = 0x1f20, - DW_FORM_GNU_strp_alt = 0x1f21 -}; - -enum dwarf_tag { - DW_TAG_entry_point = 0x03, - DW_TAG_compile_unit = 0x11, - DW_TAG_inlined_subroutine = 0x1d, - DW_TAG_subprogram = 0x2e -}; - -enum dwarf_lns { - DW_LNS_extended_op = 0x00, - DW_LNS_copy = 0x01, - DW_LNS_advance_pc = 0x02, - DW_LNS_advance_line = 0x03, - DW_LNS_set_file = 0x04, - DW_LNS_set_column = 0x05, - DW_LNS_negate_stmt = 0x06, - DW_LNS_set_basic_block = 0x07, - DW_LNS_const_add_pc = 0x08, - DW_LNS_fixed_advance_pc = 0x09, - DW_LNS_set_prologue_end = 0x0a, - DW_LNS_set_epilogue_begin = 0x0b, - DW_LNS_set_isa = 0x0c -}; - -enum dwarf_lne { - DW_LNE_end_sequence = 0x01, - DW_LNE_set_address = 0x02, - DW_LNE_define_file = 0x03, - DW_LNE_set_discriminator = 0x04 -}; - -#endif // DWARF2_H diff --git a/llgo/include/filenames.h b/llgo/include/filenames.h deleted file mode 100644 index 005b302159e3e643187c1b0a7e557e80eef07016..0000000000000000000000000000000000000000 --- a/llgo/include/filenames.h +++ /dev/null @@ -1,14 +0,0 @@ -//===----------------------------- filenames.h ----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef FILENAMES_H -#define FILENAMES_H - -#define IS_ABSOLUTE_PATH(path) ((path)[0] == '/') - -#endif diff --git a/llgo/include/unwind-pe.h b/llgo/include/unwind-pe.h deleted file mode 100644 index 8655a92e2fd26373f853aa36d3002438c647941e..0000000000000000000000000000000000000000 --- a/llgo/include/unwind-pe.h +++ /dev/null @@ -1,200 +0,0 @@ -//===----------------------------- unwind-pe.h ----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Pointer-Encoding decoder. Derived from: -// - libcxxabi/src/Unwind/dwarf2.h -// - libcxxabi/src/Unwind/AddressSpace.h -// -//===----------------------------------------------------------------------===// - -#ifndef UNWIND_PE_H -#define UNWIND_PE_H - -#include -#include -#include - -// FSF exception handling Pointer-Encoding constants -// Used in CFI augmentation by GCC -enum { - DW_EH_PE_ptr = 0x00, - DW_EH_PE_uleb128 = 0x01, - DW_EH_PE_udata2 = 0x02, - DW_EH_PE_udata4 = 0x03, - DW_EH_PE_udata8 = 0x04, - DW_EH_PE_signed = 0x08, - DW_EH_PE_sleb128 = 0x09, - DW_EH_PE_sdata2 = 0x0A, - DW_EH_PE_sdata4 = 0x0B, - DW_EH_PE_sdata8 = 0x0C, - DW_EH_PE_absptr = 0x00, - DW_EH_PE_pcrel = 0x10, - DW_EH_PE_textrel = 0x20, - DW_EH_PE_datarel = 0x30, - DW_EH_PE_funcrel = 0x40, - DW_EH_PE_aligned = 0x50, - DW_EH_PE_indirect = 0x80, - DW_EH_PE_omit = 0xFF -}; - -/// Read a ULEB128 into a 64-bit word. -static uint64_t unw_getULEB128(uintptr_t *addr) { - const uint8_t *p = (uint8_t *)*addr; - uint64_t result = 0; - int bit = 0; - do { - uint64_t b; - - b = *p & 0x7f; - - if (bit >= 64 || b << bit >> bit != b) { - assert(!"malformed uleb128 expression"); - } else { - result |= b << bit; - bit += 7; - } - } while (*p++ >= 0x80); - *addr = (uintptr_t) p; - return result; -} - -/// Read a SLEB128 into a 64-bit word. -static int64_t unw_getSLEB128(uintptr_t *addr) { - const uint8_t *p = (uint8_t *)addr; - int64_t result = 0; - int bit = 0; - uint8_t byte; - do { - byte = *p++; - result |= ((byte & 0x7f) << bit); - bit += 7; - } while (byte & 0x80); - // sign extend negative numbers - if ((byte & 0x40) != 0) - result |= (-1LL) << bit; - *addr = (uintptr_t) p; - return result; -} - -static uint16_t unw_get16(uintptr_t addr) { - uint16_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uint32_t unw_get32(uintptr_t addr) { - uint32_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uint64_t unw_get64(uintptr_t addr) { - uint64_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uintptr_t unw_getP(uintptr_t addr) { - if (sizeof(uintptr_t) == 8) - return unw_get64(addr); - else - return unw_get32(addr); -} - -static const unsigned char *read_uleb128(const unsigned char *p, - _uleb128_t *ret) { - uintptr_t addr = (uintptr_t)p; - *ret = unw_getULEB128(&addr); - return (unsigned char *)addr; -} - -static const unsigned char *read_encoded_value(struct _Unwind_Context *ctx, - unsigned char encoding, - const unsigned char *p, - _Unwind_Ptr *ret) { - uintptr_t addr = (uintptr_t)p; - uintptr_t startAddr = addr; - uintptr_t result; - - (void)ctx; - - // first get value - switch (encoding & 0x0F) { - case DW_EH_PE_ptr: - result = unw_getP(addr); - p += sizeof(uintptr_t); - break; - case DW_EH_PE_uleb128: - result = (uintptr_t)unw_getULEB128(&addr); - p = (const unsigned char *)addr; - break; - case DW_EH_PE_udata2: - result = unw_get16(addr); - p += 2; - break; - case DW_EH_PE_udata4: - result = unw_get32(addr); - p += 4; - break; - case DW_EH_PE_udata8: - result = (uintptr_t)unw_get64(addr); - p += 8; - break; - case DW_EH_PE_sleb128: - result = (uintptr_t)unw_getSLEB128(&addr); - p = (const unsigned char *)addr; - break; - case DW_EH_PE_sdata2: - // Sign extend from signed 16-bit value. - result = (uintptr_t)(int16_t)unw_get16(addr); - p += 2; - break; - case DW_EH_PE_sdata4: - // Sign extend from signed 32-bit value. - result = (uintptr_t)(int32_t)unw_get32(addr); - p += 4; - break; - case DW_EH_PE_sdata8: - result = (uintptr_t)unw_get64(addr); - p += 8; - break; - default: - assert(!"unknown pointer encoding"); - } - - // then add relative offset - switch (encoding & 0x70) { - case DW_EH_PE_absptr: - // do nothing - break; - case DW_EH_PE_pcrel: - result += startAddr; - break; - case DW_EH_PE_textrel: - assert(!"DW_EH_PE_textrel pointer encoding not supported"); - break; - case DW_EH_PE_datarel: - assert(!"DW_EH_PE_datarel pointer encoding not supported"); - break; - case DW_EH_PE_funcrel: - assert(!"DW_EH_PE_funcrel pointer encoding not supported"); - break; - case DW_EH_PE_aligned: - assert(!"DW_EH_PE_aligned pointer encoding not supported"); - break; - default: - assert(!"unknown pointer encoding"); - break; - } - - if (encoding & DW_EH_PE_indirect) - result = unw_getP(result); - - *ret = result; - return p; -} - -#endif // UNWIND_PE_H diff --git a/llgo/irgen/annotations.go b/llgo/irgen/annotations.go deleted file mode 100644 index 5bda7a1c17f73c4f64d54cec38166e8c5131c19e..0000000000000000000000000000000000000000 --- a/llgo/irgen/annotations.go +++ /dev/null @@ -1,63 +0,0 @@ -//===- annotations.go - annotation processor ------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file converts llgo annotations into attributes. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "go/ast" - "go/token" - "llvm.org/llgo/third_party/gotools/go/loader" - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// processAnnotations takes an *ssa.Package and a -// *importer.PackageInfo, and processes all of the -// llgo source annotations attached to each top-level -// function and global variable. -func (c *compiler) processAnnotations(u *unit, pkginfo *loader.PackageInfo) { - members := make(map[types.Object]llvm.Value, len(u.globals)) - for k, v := range u.globals { - members[k.(ssa.Member).Object()] = v - } - applyAttributes := func(attrs []Attribute, idents ...*ast.Ident) { - if len(attrs) == 0 { - return - } - for _, ident := range idents { - if v := members[pkginfo.ObjectOf(ident)]; !v.IsNil() { - for _, attr := range attrs { - attr.Apply(v) - } - } - } - } - for _, f := range pkginfo.Files { - for _, decl := range f.Decls { - switch decl := decl.(type) { - case *ast.FuncDecl: - attrs := parseAttributes(decl.Doc) - applyAttributes(attrs, decl.Name) - case *ast.GenDecl: - if decl.Tok != token.VAR { - continue - } - for _, spec := range decl.Specs { - varspec := spec.(*ast.ValueSpec) - attrs := parseAttributes(decl.Doc) - applyAttributes(attrs, varspec.Names...) - } - } - } - } -} diff --git a/llgo/irgen/attribute.go b/llgo/irgen/attribute.go deleted file mode 100644 index e986e5edb0a9e244ca5aa57d21b1cb457a86767b..0000000000000000000000000000000000000000 --- a/llgo/irgen/attribute.go +++ /dev/null @@ -1,146 +0,0 @@ -//===- attribute.go - attribute processor ---------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file processes llgo and //extern attributes. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "fmt" - "go/ast" - "llvm.org/llvm/bindings/go/llvm" - "strings" -) - -const AttributeCommentPrefix = "#llgo " - -// Attribute represents an attribute associated with a -// global variable or function. -type Attribute interface { - Apply(llvm.Value) -} - -// parseAttribute parses zero or more #llgo comment attributes associated with -// a global variable or function. The comment group provided will be processed -// one line at a time using parseAttribute. -func parseAttributes(doc *ast.CommentGroup) []Attribute { - var attributes []Attribute - if doc == nil { - return attributes - } - for _, comment := range doc.List { - if strings.HasPrefix(comment.Text, "//extern ") { - nameattr := nameAttribute(strings.TrimSpace(comment.Text[9:])) - attributes = append(attributes, nameattr) - continue - } - text := comment.Text[2:] - if strings.HasPrefix(comment.Text, "/*") { - text = text[:len(text)-2] - } - attr := parseAttribute(strings.TrimSpace(text)) - if attr != nil { - attributes = append(attributes, attr) - } - } - return attributes -} - -// parseAttribute parses a single #llgo comment attribute associated with -// a global variable or function. The string provided will be parsed -// if it begins with AttributeCommentPrefix, otherwise nil is returned. -func parseAttribute(line string) Attribute { - if !strings.HasPrefix(line, AttributeCommentPrefix) { - return nil - } - line = strings.TrimSpace(line[len(AttributeCommentPrefix):]) - colon := strings.IndexRune(line, ':') - var key, value string - if colon == -1 { - key = line - } else { - key, value = line[:colon], line[colon+1:] - } - switch key { - case "linkage": - return parseLinkageAttribute(value) - case "name": - return nameAttribute(strings.TrimSpace(value)) - case "thread_local": - return tlsAttribute{} - default: - // FIXME decide what to do here. return error? log warning? - panic("unknown attribute key: " + key) - } - return nil -} - -type linkageAttribute llvm.Linkage - -func (a linkageAttribute) Apply(v llvm.Value) { - v.SetLinkage(llvm.Linkage(a)) -} - -func parseLinkageAttribute(value string) linkageAttribute { - var result linkageAttribute - value = strings.Replace(value, ",", " ", -1) - for _, field := range strings.Fields(value) { - switch strings.ToLower(field) { - case "private": - result |= linkageAttribute(llvm.PrivateLinkage) - case "internal": - result |= linkageAttribute(llvm.InternalLinkage) - case "available_externally": - result |= linkageAttribute(llvm.AvailableExternallyLinkage) - case "linkonce": - result |= linkageAttribute(llvm.LinkOnceAnyLinkage) - case "common": - result |= linkageAttribute(llvm.CommonLinkage) - case "weak": - result |= linkageAttribute(llvm.WeakAnyLinkage) - case "appending": - result |= linkageAttribute(llvm.AppendingLinkage) - case "extern_weak": - result |= linkageAttribute(llvm.ExternalWeakLinkage) - case "linkonce_odr": - result |= linkageAttribute(llvm.LinkOnceODRLinkage) - case "weak_odr": - result |= linkageAttribute(llvm.WeakODRLinkage) - case "external": - result |= linkageAttribute(llvm.ExternalLinkage) - } - } - return result -} - -type nameAttribute string - -func (a nameAttribute) Apply(v llvm.Value) { - if !v.IsAFunction().IsNil() { - name := string(a) - curr := v.GlobalParent().NamedFunction(name) - if !curr.IsNil() && curr != v { - if curr.BasicBlocksCount() != 0 { - panic(fmt.Errorf("Want to take the name %s from a function that has a body!", name)) - } - curr.SetName(name + "_llgo_replaced") - curr.ReplaceAllUsesWith(llvm.ConstBitCast(v, curr.Type())) - } - v.SetName(name) - } else { - v.SetName(string(a)) - } -} - -type tlsAttribute struct{} - -func (tlsAttribute) Apply(v llvm.Value) { - v.SetThreadLocal(true) -} diff --git a/llgo/irgen/builtins.go b/llgo/irgen/builtins.go deleted file mode 100644 index 7a33ef09deeb77ac2be6953ebd3d3b90363d42c6..0000000000000000000000000000000000000000 --- a/llgo/irgen/builtins.go +++ /dev/null @@ -1,117 +0,0 @@ -//===- builtins.go - IR generation for builtins ---------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for the built-in functions. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -func (fr *frame) callCap(arg *govalue) *govalue { - var v llvm.Value - switch typ := arg.Type().Underlying().(type) { - case *types.Array: - v = llvm.ConstInt(fr.llvmtypes.inttype, uint64(typ.Len()), false) - case *types.Pointer: - atyp := typ.Elem().Underlying().(*types.Array) - v = llvm.ConstInt(fr.llvmtypes.inttype, uint64(atyp.Len()), false) - case *types.Slice: - v = fr.builder.CreateExtractValue(arg.value, 2, "") - case *types.Chan: - v = fr.runtime.chanCap.call(fr, arg.value)[0] - } - return newValue(v, types.Typ[types.Int]) -} - -func (fr *frame) callLen(arg *govalue) *govalue { - var lenvalue llvm.Value - switch typ := arg.Type().Underlying().(type) { - case *types.Array: - lenvalue = llvm.ConstInt(fr.llvmtypes.inttype, uint64(typ.Len()), false) - case *types.Pointer: - atyp := typ.Elem().Underlying().(*types.Array) - lenvalue = llvm.ConstInt(fr.llvmtypes.inttype, uint64(atyp.Len()), false) - case *types.Slice: - lenvalue = fr.builder.CreateExtractValue(arg.value, 1, "") - case *types.Map: - lenvalue = fr.runtime.mapLen.call(fr, arg.value)[0] - case *types.Basic: - if isString(typ) { - lenvalue = fr.builder.CreateExtractValue(arg.value, 1, "") - } - case *types.Chan: - lenvalue = fr.runtime.chanLen.call(fr, arg.value)[0] - } - return newValue(lenvalue, types.Typ[types.Int]) -} - -// callAppend takes two slices of the same type, and yields -// the result of appending the second to the first. -func (fr *frame) callAppend(a, b *govalue) *govalue { - bptr := fr.builder.CreateExtractValue(b.value, 0, "") - blen := fr.builder.CreateExtractValue(b.value, 1, "") - elemsizeInt64 := fr.types.Sizeof(a.Type().Underlying().(*types.Slice).Elem()) - elemsize := llvm.ConstInt(fr.target.IntPtrType(), uint64(elemsizeInt64), false) - result := fr.runtime.append.call(fr, a.value, bptr, blen, elemsize)[0] - return newValue(result, a.Type()) -} - -// callCopy takes two slices a and b of the same type, and -// yields the result of calling "copy(a, b)". -func (fr *frame) callCopy(dest, source *govalue) *govalue { - aptr := fr.builder.CreateExtractValue(dest.value, 0, "") - alen := fr.builder.CreateExtractValue(dest.value, 1, "") - bptr := fr.builder.CreateExtractValue(source.value, 0, "") - blen := fr.builder.CreateExtractValue(source.value, 1, "") - aless := fr.builder.CreateICmp(llvm.IntULT, alen, blen, "") - minlen := fr.builder.CreateSelect(aless, alen, blen, "") - elemsizeInt64 := fr.types.Sizeof(dest.Type().Underlying().(*types.Slice).Elem()) - elemsize := llvm.ConstInt(fr.types.inttype, uint64(elemsizeInt64), false) - bytes := fr.builder.CreateMul(minlen, elemsize, "") - fr.runtime.copy.call(fr, aptr, bptr, bytes) - return newValue(minlen, types.Typ[types.Int]) -} - -func (fr *frame) callRecover(isDeferredRecover bool) *govalue { - startbb := fr.builder.GetInsertBlock() - recoverbb := llvm.AddBasicBlock(fr.function, "") - contbb := llvm.AddBasicBlock(fr.function, "") - canRecover := fr.builder.CreateTrunc(fr.canRecover, llvm.Int1Type(), "") - fr.builder.CreateCondBr(canRecover, recoverbb, contbb) - - fr.builder.SetInsertPointAtEnd(recoverbb) - var recovered llvm.Value - if isDeferredRecover { - recovered = fr.runtime.deferredRecover.call(fr)[0] - } else { - recovered = fr.runtime.recover.call(fr)[0] - } - recoverbb = fr.builder.GetInsertBlock() - fr.builder.CreateBr(contbb) - - fr.builder.SetInsertPointAtEnd(contbb) - eface := types.NewInterface(nil, nil) - llv := fr.builder.CreatePHI(fr.types.ToLLVM(eface), "") - llv.AddIncoming( - []llvm.Value{llvm.ConstNull(llv.Type()), recovered}, - []llvm.BasicBlock{startbb, recoverbb}, - ) - return newValue(llv, eface) -} - -func (fr *frame) callPanic(arg *govalue, term bool) { - fr.runtime.panic.call(fr, arg.value) - if term { - fr.builder.CreateUnreachable() - } -} diff --git a/llgo/irgen/cabi.go b/llgo/irgen/cabi.go deleted file mode 100644 index 02def37de7635479e1d43d7653904a38a9ec4137..0000000000000000000000000000000000000000 --- a/llgo/irgen/cabi.go +++ /dev/null @@ -1,695 +0,0 @@ -//===- cabi.go - C ABI abstraction layer ----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements an abstraction layer for the platform's C ABI (currently -// supports only Linux/x86_64). -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -type abiArgInfo int - -const ( - AIK_Direct = abiArgInfo(iota) - AIK_Indirect -) - -type backendType interface { - ToLLVM(llvm.Context) llvm.Type -} - -type ptrBType struct { -} - -func (t ptrBType) ToLLVM(c llvm.Context) llvm.Type { - return llvm.PointerType(c.Int8Type(), 0) -} - -type intBType struct { - width int - signed bool -} - -func (t intBType) ToLLVM(c llvm.Context) llvm.Type { - return c.IntType(t.width * 8) -} - -type floatBType struct { - isDouble bool -} - -func (t floatBType) ToLLVM(c llvm.Context) llvm.Type { - if t.isDouble { - return c.DoubleType() - } else { - return c.FloatType() - } -} - -type structBType struct { - fields []backendType -} - -func (t structBType) ToLLVM(c llvm.Context) llvm.Type { - var lfields []llvm.Type - for _, f := range t.fields { - lfields = append(lfields, f.ToLLVM(c)) - } - return c.StructType(lfields, false) -} - -type arrayBType struct { - length uint64 - elem backendType -} - -func (t arrayBType) ToLLVM(c llvm.Context) llvm.Type { - return llvm.ArrayType(t.elem.ToLLVM(c), int(t.length)) -} - -// align returns the smallest y >= x such that y % a == 0. -func align(x, a int64) int64 { - y := x + a - 1 - return y - y%a -} - -func (tm *llvmTypeMap) sizeofStruct(fields ...types.Type) int64 { - var o int64 - for _, f := range fields { - a := tm.Alignof(f) - o = align(o, a) - o += tm.Sizeof(f) - } - return o -} - -// This decides whether the x86_64 classification algorithm produces MEMORY for -// the given type. Given the subset of types that Go supports, this is exactly -// equivalent to testing the type's size. See in particular the first step of -// the algorithm and its footnote. -func (tm *llvmTypeMap) classify(t ...types.Type) abiArgInfo { - if tm.sizeofStruct(t...) > 16 { - return AIK_Indirect - } - return AIK_Direct -} - -func (tm *llvmTypeMap) sliceBackendType() backendType { - i8ptr := &ptrBType{} - uintptr := &intBType{tm.target.PointerSize(), false} - return &structBType{[]backendType{i8ptr, uintptr, uintptr}} -} - -func (tm *llvmTypeMap) getBackendType(t types.Type) backendType { - switch t := t.(type) { - case *types.Named: - return tm.getBackendType(t.Underlying()) - - case *types.Basic: - switch t.Kind() { - case types.Bool, types.Uint8: - return &intBType{1, false} - case types.Int8: - return &intBType{1, true} - case types.Uint16: - return &intBType{2, false} - case types.Int16: - return &intBType{2, true} - case types.Uint32: - return &intBType{4, false} - case types.Int32: - return &intBType{4, true} - case types.Uint64: - return &intBType{8, false} - case types.Int64: - return &intBType{8, true} - case types.Uint, types.Uintptr: - return &intBType{tm.target.PointerSize(), false} - case types.Int: - return &intBType{tm.target.PointerSize(), true} - case types.Float32: - return &floatBType{false} - case types.Float64: - return &floatBType{true} - case types.UnsafePointer: - return &ptrBType{} - case types.Complex64: - f32 := &floatBType{false} - return &structBType{[]backendType{f32, f32}} - case types.Complex128: - f64 := &floatBType{true} - return &structBType{[]backendType{f64, f64}} - case types.String: - return &structBType{[]backendType{&ptrBType{}, &intBType{tm.target.PointerSize(), false}}} - } - - case *types.Struct: - var fields []backendType - for i := 0; i != t.NumFields(); i++ { - f := t.Field(i) - fields = append(fields, tm.getBackendType(f.Type())) - } - return &structBType{fields} - - case *types.Pointer, *types.Signature, *types.Map, *types.Chan: - return &ptrBType{} - - case *types.Interface: - i8ptr := &ptrBType{} - return &structBType{[]backendType{i8ptr, i8ptr}} - - case *types.Slice: - return tm.sliceBackendType() - - case *types.Array: - return &arrayBType{uint64(t.Len()), tm.getBackendType(t.Elem())} - } - - panic("unhandled type: " + t.String()) -} - -type offsetedType struct { - typ backendType - offset uint64 -} - -func (tm *llvmTypeMap) getBackendOffsets(bt backendType) (offsets []offsetedType) { - switch bt := bt.(type) { - case *structBType: - t := bt.ToLLVM(tm.ctx) - for i, f := range bt.fields { - offset := tm.target.ElementOffset(t, i) - fieldOffsets := tm.getBackendOffsets(f) - for _, fo := range fieldOffsets { - offsets = append(offsets, offsetedType{fo.typ, offset + fo.offset}) - } - } - - case *arrayBType: - size := tm.target.TypeAllocSize(bt.elem.ToLLVM(tm.ctx)) - fieldOffsets := tm.getBackendOffsets(bt.elem) - for i := uint64(0); i != bt.length; i++ { - for _, fo := range fieldOffsets { - offsets = append(offsets, offsetedType{fo.typ, i*size + fo.offset}) - } - } - - default: - offsets = []offsetedType{offsetedType{bt, 0}} - } - - return -} - -func (tm *llvmTypeMap) classifyEightbyte(offsets []offsetedType, numInt, numSSE *int) llvm.Type { - if len(offsets) == 1 { - if _, ok := offsets[0].typ.(*floatBType); ok { - *numSSE++ - } else { - *numInt++ - } - return offsets[0].typ.ToLLVM(tm.ctx) - } - // This implements classification for the basic types and step 4 of the - // classification algorithm. At this point, the only two possible - // classifications are SSE (floats) and INTEGER (everything else). - sse := true - for _, ot := range offsets { - if _, ok := ot.typ.(*floatBType); !ok { - sse = false - break - } - } - if sse { - // This can only be (float, float), which uses an SSE vector. - *numSSE++ - return llvm.VectorType(tm.ctx.FloatType(), 2) - } else { - *numInt++ - width := offsets[len(offsets)-1].offset + tm.target.TypeAllocSize(offsets[len(offsets)-1].typ.ToLLVM(tm.ctx)) - offsets[0].offset - return tm.ctx.IntType(int(width) * 8) - } -} - -func (tm *llvmTypeMap) expandType(argTypes []llvm.Type, argAttrs []llvm.Attribute, bt backendType) ([]llvm.Type, []llvm.Attribute, int, int) { - var numInt, numSSE int - var argAttr llvm.Attribute - - switch bt := bt.(type) { - case *structBType, *arrayBType: - noneAttr := tm.ctx.CreateEnumAttribute(0, 0) - bo := tm.getBackendOffsets(bt) - sp := 0 - for sp != len(bo) && bo[sp].offset < 8 { - sp++ - } - eb1 := bo[0:sp] - eb2 := bo[sp:] - if len(eb2) > 0 { - argTypes = append(argTypes, tm.classifyEightbyte(eb1, &numInt, &numSSE), tm.classifyEightbyte(eb2, &numInt, &numSSE)) - argAttrs = append(argAttrs, noneAttr, noneAttr) - } else { - argTypes = append(argTypes, tm.classifyEightbyte(eb1, &numInt, &numSSE)) - argAttrs = append(argAttrs, noneAttr) - } - - return argTypes, argAttrs, numInt, numSSE - - case *intBType: - if bt.width < 4 { - var argAttrKind uint - if bt.signed { - argAttrKind = llvm.AttributeKindID("signext") - } else { - argAttrKind = llvm.AttributeKindID("zeroext") - } - argAttr = tm.ctx.CreateEnumAttribute(argAttrKind, 0) - } - } - - argTypes = append(argTypes, tm.classifyEightbyte([]offsetedType{{bt, 0}}, &numInt, &numSSE)) - argAttrs = append(argAttrs, argAttr) - - return argTypes, argAttrs, numInt, numSSE -} - -type argInfo interface { - // Emit instructions to builder to ABI encode val and store result to args. - encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, args []llvm.Value, val llvm.Value) - - // Emit instructions to builder to ABI decode and return the resulting Value. - decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder) llvm.Value -} - -type retInfo interface { - // Prepare args to receive a value. allocaBuilder refers to a builder in the entry block. - prepare(ctx llvm.Context, allocaBuilder llvm.Builder, args []llvm.Value) - - // Emit instructions to builder to ABI decode the return value(s), if any. call is the - // call instruction. Must be called after prepare(). - decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, call llvm.Value) []llvm.Value - - // Emit instructions to builder to ABI encode the return value(s), if any, and return. - encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, vals []llvm.Value) -} - -type directArgInfo struct { - argOffset int - argTypes []llvm.Type - valType llvm.Type -} - -func directEncode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, argTypes []llvm.Type, args []llvm.Value, val llvm.Value) { - valType := val.Type() - - switch len(argTypes) { - case 0: - // do nothing - - case 1: - if argTypes[0].C == valType.C { - args[0] = val - return - } - alloca := allocaBuilder.CreateAlloca(valType, "") - bitcast := builder.CreateBitCast(alloca, llvm.PointerType(argTypes[0], 0), "") - builder.CreateStore(val, alloca) - args[0] = builder.CreateLoad(bitcast, "") - - case 2: - encodeType := llvm.StructType(argTypes, false) - alloca := allocaBuilder.CreateAlloca(valType, "") - bitcast := builder.CreateBitCast(alloca, llvm.PointerType(encodeType, 0), "") - builder.CreateStore(val, alloca) - args[0] = builder.CreateLoad(builder.CreateStructGEP(bitcast, 0, ""), "") - args[1] = builder.CreateLoad(builder.CreateStructGEP(bitcast, 1, ""), "") - - default: - panic("unexpected argTypes size") - } -} - -func (ai *directArgInfo) encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, args []llvm.Value, val llvm.Value) { - directEncode(ctx, allocaBuilder, builder, ai.argTypes, args[ai.argOffset:ai.argOffset+len(ai.argTypes)], val) -} - -func directDecode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, valType llvm.Type, args []llvm.Value) llvm.Value { - var alloca llvm.Value - - switch len(args) { - case 0: - return llvm.ConstNull(ctx.StructType(nil, false)) - - case 1: - if args[0].Type().C == valType.C { - return args[0] - } - alloca = allocaBuilder.CreateAlloca(valType, "") - bitcast := builder.CreateBitCast(alloca, llvm.PointerType(args[0].Type(), 0), "") - builder.CreateStore(args[0], bitcast) - - case 2: - alloca = allocaBuilder.CreateAlloca(valType, "") - var argTypes []llvm.Type - for _, a := range args { - argTypes = append(argTypes, a.Type()) - } - encodeType := ctx.StructType(argTypes, false) - bitcast := builder.CreateBitCast(alloca, llvm.PointerType(encodeType, 0), "") - builder.CreateStore(args[0], builder.CreateStructGEP(bitcast, 0, "")) - builder.CreateStore(args[1], builder.CreateStructGEP(bitcast, 1, "")) - - default: - panic("unexpected argTypes size") - } - - return builder.CreateLoad(alloca, "") -} - -func (ai *directArgInfo) decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder) llvm.Value { - var args []llvm.Value - fn := builder.GetInsertBlock().Parent() - for i, _ := range ai.argTypes { - args = append(args, fn.Param(ai.argOffset+i)) - } - return directDecode(ctx, allocaBuilder, builder, ai.valType, args) -} - -type indirectArgInfo struct { - argOffset int -} - -func (ai *indirectArgInfo) encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, args []llvm.Value, val llvm.Value) { - alloca := allocaBuilder.CreateAlloca(val.Type(), "") - builder.CreateStore(val, alloca) - args[ai.argOffset] = alloca -} - -func (ai *indirectArgInfo) decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder) llvm.Value { - fn := builder.GetInsertBlock().Parent() - return builder.CreateLoad(fn.Param(ai.argOffset), "") -} - -type directRetInfo struct { - numResults int - retTypes []llvm.Type - resultsType llvm.Type -} - -func (ri *directRetInfo) prepare(ctx llvm.Context, allocaBuilder llvm.Builder, args []llvm.Value) { -} - -func (ri *directRetInfo) decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, call llvm.Value) []llvm.Value { - var args []llvm.Value - switch len(ri.retTypes) { - case 0: - return nil - case 1: - args = []llvm.Value{call} - default: - args = make([]llvm.Value, len(ri.retTypes)) - for i := 0; i != len(ri.retTypes); i++ { - args[i] = builder.CreateExtractValue(call, i, "") - } - } - - d := directDecode(ctx, allocaBuilder, builder, ri.resultsType, args) - - if ri.numResults == 1 { - return []llvm.Value{d} - } else { - results := make([]llvm.Value, ri.numResults) - for i := 0; i != ri.numResults; i++ { - results[i] = builder.CreateExtractValue(d, i, "") - } - return results - } -} - -func (ri *directRetInfo) encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, vals []llvm.Value) { - if len(ri.retTypes) == 0 { - builder.CreateRetVoid() - return - } - - var val llvm.Value - switch ri.numResults { - case 1: - val = vals[0] - default: - val = llvm.Undef(ri.resultsType) - for i, v := range vals { - val = builder.CreateInsertValue(val, v, i, "") - } - } - - args := make([]llvm.Value, len(ri.retTypes)) - directEncode(ctx, allocaBuilder, builder, ri.retTypes, args, val) - - var retval llvm.Value - switch len(ri.retTypes) { - case 1: - retval = args[0] - default: - retval = llvm.Undef(ctx.StructType(ri.retTypes, false)) - for i, a := range args { - retval = builder.CreateInsertValue(retval, a, i, "") - } - } - builder.CreateRet(retval) -} - -type indirectRetInfo struct { - numResults int - sretSlot llvm.Value - resultsType llvm.Type -} - -func (ri *indirectRetInfo) prepare(ctx llvm.Context, allocaBuilder llvm.Builder, args []llvm.Value) { - ri.sretSlot = allocaBuilder.CreateAlloca(ri.resultsType, "") - args[0] = ri.sretSlot -} - -func (ri *indirectRetInfo) decode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, call llvm.Value) []llvm.Value { - if ri.numResults == 1 { - return []llvm.Value{builder.CreateLoad(ri.sretSlot, "")} - } else { - vals := make([]llvm.Value, ri.numResults) - for i, _ := range vals { - vals[i] = builder.CreateLoad(builder.CreateStructGEP(ri.sretSlot, i, ""), "") - } - return vals - } -} - -func (ri *indirectRetInfo) encode(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, vals []llvm.Value) { - fn := builder.GetInsertBlock().Parent() - sretSlot := fn.Param(0) - - if ri.numResults == 1 { - builder.CreateStore(vals[0], sretSlot) - } else { - for i, v := range vals { - builder.CreateStore(v, builder.CreateStructGEP(sretSlot, i, "")) - } - } - builder.CreateRetVoid() -} - -type functionTypeInfo struct { - functionType llvm.Type - argAttrs []llvm.Attribute - retAttr llvm.Attribute - argInfos []argInfo - retInf retInfo - chainIndex int -} - -func (fi *functionTypeInfo) declare(m llvm.Module, name string) llvm.Value { - fn := llvm.AddFunction(m, name, fi.functionType) - if fi.retAttr.GetEnumKind() != 0 { - fn.AddAttributeAtIndex(0, fi.retAttr) - } - for i, a := range fi.argAttrs { - if a.GetEnumKind() != 0 { - fn.AddAttributeAtIndex(i + 1, a) - } - } - return fn -} - -func (fi *functionTypeInfo) call(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, callee llvm.Value, chain llvm.Value, args []llvm.Value) []llvm.Value { - callArgs := make([]llvm.Value, len(fi.argAttrs)) - if chain.C == nil { - chain = llvm.Undef(llvm.PointerType(ctx.Int8Type(), 0)) - } - callArgs[fi.chainIndex] = chain - for i, a := range args { - fi.argInfos[i].encode(ctx, allocaBuilder, builder, callArgs, a) - } - fi.retInf.prepare(ctx, allocaBuilder, callArgs) - typedCallee := builder.CreateBitCast(callee, llvm.PointerType(fi.functionType, 0), "") - call := builder.CreateCall(typedCallee, callArgs, "") - if fi.retAttr.GetEnumKind() != 0 { - call.AddCallSiteAttribute(0, fi.retAttr) - } - for i, a := range fi.argAttrs { - if a.GetEnumKind() != 0 { - call.AddCallSiteAttribute(i + 1, a) - } - } - return fi.retInf.decode(ctx, allocaBuilder, builder, call) -} - -func (fi *functionTypeInfo) invoke(ctx llvm.Context, allocaBuilder llvm.Builder, builder llvm.Builder, callee llvm.Value, chain llvm.Value, args []llvm.Value, cont, lpad llvm.BasicBlock) []llvm.Value { - callArgs := make([]llvm.Value, len(fi.argAttrs)) - if chain.C == nil { - chain = llvm.Undef(llvm.PointerType(ctx.Int8Type(), 0)) - } - callArgs[fi.chainIndex] = chain - for i, a := range args { - fi.argInfos[i].encode(ctx, allocaBuilder, builder, callArgs, a) - } - fi.retInf.prepare(ctx, allocaBuilder, callArgs) - typedCallee := builder.CreateBitCast(callee, llvm.PointerType(fi.functionType, 0), "") - call := builder.CreateInvoke(typedCallee, callArgs, cont, lpad, "") - if fi.retAttr.GetEnumKind() != 0 { - call.AddCallSiteAttribute(0, fi.retAttr) - } - for i, a := range fi.argAttrs { - if a.GetEnumKind() != 0 { - call.AddCallSiteAttribute(i + 1, a) - } - } - builder.SetInsertPointAtEnd(cont) - return fi.retInf.decode(ctx, allocaBuilder, builder, call) -} - -func (tm *llvmTypeMap) getFunctionTypeInfo(args []types.Type, results []types.Type) (fi functionTypeInfo) { - var returnType llvm.Type - var argTypes []llvm.Type - var argAttrKind uint - if len(results) == 0 { - returnType = llvm.VoidType() - fi.retInf = &directRetInfo{} - } else { - aik := tm.classify(results...) - - var resultsType llvm.Type - if len(results) == 1 { - resultsType = tm.ToLLVM(results[0]) - } else { - elements := make([]llvm.Type, len(results)) - for i := range elements { - elements[i] = tm.ToLLVM(results[i]) - } - resultsType = tm.ctx.StructType(elements, false) - } - - switch aik { - case AIK_Direct: - var retFields []backendType - for _, t := range results { - retFields = append(retFields, tm.getBackendType(t)) - } - bt := &structBType{retFields} - - retTypes, retAttrs, _, _ := tm.expandType(nil, nil, bt) - switch len(retTypes) { - case 0: // e.g., empty struct - returnType = llvm.VoidType() - case 1: - returnType = retTypes[0] - fi.retAttr = retAttrs[0] - case 2: - returnType = llvm.StructType(retTypes, false) - default: - panic("unexpected expandType result") - } - fi.retInf = &directRetInfo{numResults: len(results), retTypes: retTypes, resultsType: resultsType} - - case AIK_Indirect: - returnType = llvm.VoidType() - argTypes = []llvm.Type{llvm.PointerType(resultsType, 0)} - argAttrKind = llvm.AttributeKindID("sret") - fi.argAttrs = []llvm.Attribute{tm.ctx.CreateEnumAttribute(argAttrKind, 0)} - fi.retInf = &indirectRetInfo{numResults: len(results), resultsType: resultsType} - } - } - - // Allocate an argument for the call chain. - fi.chainIndex = len(argTypes) - argTypes = append(argTypes, llvm.PointerType(tm.ctx.Int8Type(), 0)) - argAttrKind = llvm.AttributeKindID("nest") - fi.argAttrs = append(fi.argAttrs, tm.ctx.CreateEnumAttribute(argAttrKind, 0)) - - // Keep track of the number of INTEGER/SSE class registers remaining. - remainingInt := 6 - remainingSSE := 8 - - for _, arg := range args { - aik := tm.classify(arg) - - isDirect := aik == AIK_Direct - if isDirect { - bt := tm.getBackendType(arg) - directArgTypes, directArgAttrs, numInt, numSSE := tm.expandType(argTypes, fi.argAttrs, bt) - - // Check if the argument can fit into the remaining registers, or if - // it would just occupy one register (which pushes the whole argument - // onto the stack anyway). - if numInt <= remainingInt && numSSE <= remainingSSE || numInt+numSSE == 1 { - remainingInt -= numInt - remainingSSE -= numSSE - argInfo := &directArgInfo{argOffset: len(argTypes), valType: bt.ToLLVM(tm.ctx)} - fi.argInfos = append(fi.argInfos, argInfo) - argTypes = directArgTypes - fi.argAttrs = directArgAttrs - argInfo.argTypes = argTypes[argInfo.argOffset:len(argTypes)] - } else { - // No remaining registers; pass on the stack. - isDirect = false - } - } - - if !isDirect { - fi.argInfos = append(fi.argInfos, &indirectArgInfo{len(argTypes)}) - argTypes = append(argTypes, llvm.PointerType(tm.ToLLVM(arg), 0)) - argAttrKind = llvm.AttributeKindID("byval") - fi.argAttrs = append(fi.argAttrs, tm.ctx.CreateEnumAttribute(argAttrKind, 0)) - } - } - - fi.functionType = llvm.FunctionType(returnType, argTypes, false) - return -} - -func (tm *llvmTypeMap) getSignatureInfo(sig *types.Signature) functionTypeInfo { - var args, results []types.Type - if sig.Recv() != nil { - recvtype := sig.Recv().Type() - if _, ok := recvtype.Underlying().(*types.Pointer); !ok && recvtype != types.Typ[types.UnsafePointer] { - recvtype = types.NewPointer(recvtype) - } - args = []types.Type{recvtype} - } - - for i := 0; i != sig.Params().Len(); i++ { - args = append(args, sig.Params().At(i).Type()) - } - for i := 0; i != sig.Results().Len(); i++ { - results = append(results, sig.Results().At(i).Type()) - } - return tm.getFunctionTypeInfo(args, results) -} diff --git a/llgo/irgen/call.go b/llgo/irgen/call.go deleted file mode 100644 index e3874c3cc2775446ea77d267303758bf39f96b2f..0000000000000000000000000000000000000000 --- a/llgo/irgen/call.go +++ /dev/null @@ -1,43 +0,0 @@ -//===- call.go - IR generation for calls ----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for calls. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// createCall emits the code for a function call, -// taking into account receivers, and panic/defer. -func (fr *frame) createCall(fn *govalue, chain llvm.Value, argValues []*govalue) []*govalue { - fntyp := fn.Type().Underlying().(*types.Signature) - typinfo := fr.types.getSignatureInfo(fntyp) - - args := make([]llvm.Value, len(argValues)) - for i, arg := range argValues { - args[i] = arg.value - } - var results []llvm.Value - if fr.unwindBlock.IsNil() { - results = typinfo.call(fr.types.ctx, fr.allocaBuilder, fr.builder, fn.value, chain, args) - } else { - contbb := llvm.AddBasicBlock(fr.function, "") - results = typinfo.invoke(fr.types.ctx, fr.allocaBuilder, fr.builder, fn.value, chain, args, contbb, fr.unwindBlock) - } - - resultValues := make([]*govalue, len(results)) - for i, res := range results { - resultValues[i] = newValue(res, fntyp.Results().At(i).Type()) - } - return resultValues -} diff --git a/llgo/irgen/channels.go b/llgo/irgen/channels.go deleted file mode 100644 index 5a4e2d56aee8f957a22142ae7f0756af18652ad8..0000000000000000000000000000000000000000 --- a/llgo/irgen/channels.go +++ /dev/null @@ -1,133 +0,0 @@ -//===- channels.go - IR generation for channels ---------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for channels. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// makeChan implements make(chantype[, size]) -func (fr *frame) makeChan(chantyp types.Type, size *govalue) *govalue { - // TODO(pcc): call __go_new_channel_big here if needed - dyntyp := fr.types.ToRuntime(chantyp) - size = fr.convert(size, types.Typ[types.Uintptr]) - ch := fr.runtime.newChannel.call(fr, dyntyp, size.value)[0] - return newValue(ch, chantyp) -} - -// chanSend implements ch<- x -func (fr *frame) chanSend(ch *govalue, elem *govalue) { - elemtyp := ch.Type().Underlying().(*types.Chan).Elem() - elem = fr.convert(elem, elemtyp) - elemptr := fr.allocaBuilder.CreateAlloca(elem.value.Type(), "") - fr.builder.CreateStore(elem.value, elemptr) - elemptr = fr.builder.CreateBitCast(elemptr, llvm.PointerType(llvm.Int8Type(), 0), "") - chantyp := fr.types.ToRuntime(ch.Type()) - fr.runtime.sendBig.call(fr, chantyp, ch.value, elemptr) -} - -// chanRecv implements x[, ok] = <-ch -func (fr *frame) chanRecv(ch *govalue, commaOk bool) (x, ok *govalue) { - elemtyp := ch.Type().Underlying().(*types.Chan).Elem() - ptr := fr.allocaBuilder.CreateAlloca(fr.types.ToLLVM(elemtyp), "") - ptri8 := fr.builder.CreateBitCast(ptr, llvm.PointerType(llvm.Int8Type(), 0), "") - chantyp := fr.types.ToRuntime(ch.Type()) - - if commaOk { - okval := fr.runtime.chanrecv2.call(fr, chantyp, ch.value, ptri8)[0] - ok = newValue(okval, types.Typ[types.Bool]) - } else { - fr.runtime.receive.call(fr, chantyp, ch.value, ptri8) - } - x = newValue(fr.builder.CreateLoad(ptr, ""), elemtyp) - return -} - -// chanClose implements close(ch) -func (fr *frame) chanClose(ch *govalue) { - fr.runtime.builtinClose.call(fr, ch.value) -} - -func (fr *frame) chanSelect(sel *ssa.Select) (index, recvOk *govalue, recvElems []*govalue) { - n := uint64(len(sel.States)) - if !sel.Blocking { - // non-blocking means there's a default case - n++ - } - size := llvm.ConstInt(llvm.Int32Type(), n, false) - selectp := fr.runtime.newSelect.call(fr, size)[0] - - // Allocate stack for the values to send and receive. - ptrs := make([]llvm.Value, len(sel.States)) - for i, state := range sel.States { - chantyp := state.Chan.Type().Underlying().(*types.Chan) - elemtyp := fr.types.ToLLVM(chantyp.Elem()) - if state.Dir == types.SendOnly { - ptrs[i] = fr.allocaBuilder.CreateAlloca(elemtyp, "") - fr.builder.CreateStore(fr.llvmvalue(state.Send), ptrs[i]) - } else { - // Only allocate stack space if the received value is used. - used := chanSelectStateUsed(sel, len(recvElems)) - if used { - ptrs[i] = fr.allocaBuilder.CreateAlloca(elemtyp, "") - } else { - ptrs[i] = llvm.ConstNull(llvm.PointerType(llvm.Int8Type(), 0)) - } - recvElems = append(recvElems, newValue(ptrs[i], chantyp.Elem())) - } - } - - // Create select{send,recv2} calls. - var receivedp llvm.Value - if len(recvElems) > 0 { - receivedp = fr.allocaBuilder.CreateAlloca(fr.types.ToLLVM(types.Typ[types.Bool]), "") - } - if !sel.Blocking { - // If the default case is chosen, the index must be -1. - fr.runtime.selectdefault.call(fr, selectp, llvm.ConstAllOnes(llvm.Int32Type())) - } - for i, state := range sel.States { - ch := fr.llvmvalue(state.Chan) - index := llvm.ConstInt(llvm.Int32Type(), uint64(i), false) - if state.Dir == types.SendOnly { - fr.runtime.selectsend.call(fr, selectp, ch, ptrs[i], index) - } else { - fr.runtime.selectrecv2.call(fr, selectp, ch, ptrs[i], receivedp, index) - } - } - - // Fire off the select. - index = newValue(fr.runtime.selectgo.call(fr, selectp)[0], types.Typ[types.Int]) - if len(recvElems) > 0 { - recvOk = newValue(fr.builder.CreateLoad(receivedp, ""), types.Typ[types.Bool]) - for _, recvElem := range recvElems { - recvElem.value = fr.builder.CreateLoad(recvElem.value, "") - } - } - return index, recvOk, recvElems -} - -func chanSelectStateUsed(sel *ssa.Select, recvIndex int) bool { - for _, instr := range *sel.Referrers() { - extract, ok := instr.(*ssa.Extract) - if !ok || extract.Index != (recvIndex+2) { - continue - } - if len(*extract.Referrers()) > 0 { - return true - } - } - return false -} diff --git a/llgo/irgen/closures.go b/llgo/irgen/closures.go deleted file mode 100644 index 0895ac2bb3bb6cc8ce2ff8a2a37c94de34aee31d..0000000000000000000000000000000000000000 --- a/llgo/irgen/closures.go +++ /dev/null @@ -1,36 +0,0 @@ -//===- closures.go - IR generation for closures ---------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for closures. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" -) - -// makeClosure creates a closure from a function pointer and -// a set of bindings. The bindings are addresses of captured -// variables. -func (fr *frame) makeClosure(fn *govalue, bindings []*govalue) *govalue { - govalues := append([]*govalue{fn}, bindings...) - fields := make([]*types.Var, len(govalues)) - for i, v := range govalues { - field := types.NewField(0, nil, "_", v.Type(), false) - fields[i] = field - } - block := fr.createTypeMalloc(types.NewStruct(fields, nil)) - for i, v := range govalues { - addressPtr := fr.builder.CreateStructGEP(block, i, "") - fr.builder.CreateStore(v.value, addressPtr) - } - closure := fr.builder.CreateBitCast(block, fn.value.Type(), "") - return newValue(closure, fn.Type()) -} diff --git a/llgo/irgen/compiler.go b/llgo/irgen/compiler.go deleted file mode 100644 index 69934dfe88b07e8c9793e5b3cd6241a3e57bdbed..0000000000000000000000000000000000000000 --- a/llgo/irgen/compiler.go +++ /dev/null @@ -1,394 +0,0 @@ -//===- compiler.go - IR generator entry point -----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements the main IR generator entry point, (*Compiler).Compile. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "bytes" - "go/ast" - "go/token" - "log" - "sort" - "strconv" - - llgobuild "llvm.org/llgo/build" - "llvm.org/llgo/debug" - "llvm.org/llvm/bindings/go/llvm" - - "llvm.org/llgo/third_party/gotools/go/gccgoimporter" - "llvm.org/llgo/third_party/gotools/go/importer" - "llvm.org/llgo/third_party/gotools/go/loader" - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/types" -) - -type Module struct { - llvm.Module - Path string - ExportData []byte - Package *types.Package - disposed bool -} - -func (m *Module) Dispose() { - if m.disposed { - return - } - m.Module.Dispose() - m.disposed = true -} - -/////////////////////////////////////////////////////////////////////////////// - -type CompilerOptions struct { - // TargetTriple is the LLVM triple for the target. - TargetTriple string - - // GenerateDebug decides whether debug data is - // generated in the output module. - GenerateDebug bool - - // DebugPrefixMaps is a list of mappings from source prefixes to - // replacement prefixes, to be applied in debug info. - DebugPrefixMaps []debug.PrefixMap - - // Logger is a logger used for tracing compilation. - Logger *log.Logger - - // DumpSSA is a debugging option that dumps each SSA function - // to stderr before generating code for it. - DumpSSA bool - - // GccgoPath is the path to the gccgo binary whose libgo we read import - // data from. If blank, the caller is expected to supply an import - // path in ImportPaths. - GccgoPath string - - // Whether to use the gccgo ABI. - GccgoABI bool - - // ImportPaths is the list of additional import paths - ImportPaths []string - - // SanitizerAttribute is an attribute to apply to functions to enable - // dynamic instrumentation using a sanitizer. - SanitizerAttribute llvm.Attribute - - // Importer is the importer. If nil, the compiler will set this field - // automatically using MakeImporter(). - Importer types.Importer - - // InitMap is the init map used by Importer. If Importer is nil, the - // compiler will set this field automatically using MakeImporter(). - // If Importer is non-nil, InitMap must be non-nil also. - InitMap map[*types.Package]gccgoimporter.InitData - - // PackageCreated is a hook passed to the go/loader package via - // loader.Config, see the documentation for that package for more - // information. - PackageCreated func(*types.Package) - - // DisableUnusedImportCheck disables the unused import check performed - // by go/types if set to true. - DisableUnusedImportCheck bool - - // Packages is used by go/types as the imported package map if non-nil. - Packages map[string]*types.Package -} - -type Compiler struct { - opts CompilerOptions - dataLayout string -} - -func NewCompiler(opts CompilerOptions) (*Compiler, error) { - compiler := &Compiler{opts: opts} - dataLayout, err := llvmDataLayout(compiler.opts.TargetTriple) - if err != nil { - return nil, err - } - compiler.dataLayout = dataLayout - return compiler, nil -} - -func (c *Compiler) Compile(fset *token.FileSet, astFiles []*ast.File, importpath string) (m *Module, err error) { - target := llvm.NewTargetData(c.dataLayout) - compiler := &compiler{ - CompilerOptions: c.opts, - dataLayout: c.dataLayout, - target: target, - llvmtypes: NewLLVMTypeMap(llvm.GlobalContext(), target), - } - return compiler.compile(fset, astFiles, importpath) -} - -type compiler struct { - CompilerOptions - - module *Module - dataLayout string - target llvm.TargetData - fileset *token.FileSet - - runtime *runtimeInterface - llvmtypes *llvmTypeMap - types *TypeMap - - debug *debug.DIBuilder -} - -func (c *compiler) logf(format string, v ...interface{}) { - if c.Logger != nil { - c.Logger.Printf(format, v...) - } -} - -func (c *compiler) addCommonFunctionAttrs(fn llvm.Value) { - fn.AddTargetDependentFunctionAttr("disable-tail-calls", "true") - fn.AddTargetDependentFunctionAttr("split-stack", "") - if c.SanitizerAttribute.GetEnumKind() != 0 { - fn.AddFunctionAttr(c.SanitizerAttribute) - } -} - -// MakeImporter sets CompilerOptions.Importer to an appropriate importer -// for the search paths given in CompilerOptions.ImportPaths, and sets -// CompilerOptions.InitMap to an init map belonging to that importer. -// If CompilerOptions.GccgoPath is non-empty, the importer will also use -// the search paths for that gccgo installation. -func (opts *CompilerOptions) MakeImporter() error { - opts.InitMap = make(map[*types.Package]gccgoimporter.InitData) - if opts.GccgoPath == "" { - paths := append(append([]string{}, opts.ImportPaths...), ".") - opts.Importer = gccgoimporter.GetImporter(paths, opts.InitMap) - } else { - var inst gccgoimporter.GccgoInstallation - err := inst.InitFromDriver(opts.GccgoPath) - if err != nil { - return err - } - opts.Importer = inst.GetImporter(opts.ImportPaths, opts.InitMap) - } - return nil -} - -func (compiler *compiler) compile(fset *token.FileSet, astFiles []*ast.File, importpath string) (m *Module, err error) { - buildctx, err := llgobuild.ContextFromTriple(compiler.TargetTriple) - if err != nil { - return nil, err - } - - if compiler.Importer == nil { - err = compiler.MakeImporter() - if err != nil { - return nil, err - } - } - - impcfg := &loader.Config{ - Fset: fset, - TypeChecker: types.Config{ - Packages: compiler.Packages, - Import: compiler.Importer, - Sizes: compiler.llvmtypes, - DisableUnusedImportCheck: compiler.DisableUnusedImportCheck, - }, - ImportFromBinary: true, - Build: &buildctx.Context, - PackageCreated: compiler.PackageCreated, - } - // If no import path is specified, then set the import - // path to be the same as the package's name. - if importpath == "" { - importpath = astFiles[0].Name.String() - } - impcfg.CreateFromFiles(importpath, astFiles...) - iprog, err := impcfg.Load() - if err != nil { - return nil, err - } - program := ssa.Create(iprog, ssa.BareInits) - mainPkginfo := iprog.InitialPackages()[0] - mainPkg := program.CreatePackage(mainPkginfo) - - // Create a Module, which contains the LLVM module. - modulename := importpath - compiler.module = &Module{Module: llvm.NewModule(modulename), Path: modulename, Package: mainPkg.Object} - compiler.module.SetTarget(compiler.TargetTriple) - compiler.module.SetDataLayout(compiler.dataLayout) - - // Create a new translation unit. - unit := newUnit(compiler, mainPkg) - - // Create the runtime interface. - compiler.runtime, err = newRuntimeInterface(compiler.module.Module, compiler.llvmtypes) - if err != nil { - return nil, err - } - - mainPkg.Build() - - // Create a struct responsible for mapping static types to LLVM types, - // and to runtime/dynamic type values. - compiler.types = NewTypeMap( - mainPkg, - compiler.llvmtypes, - compiler.module.Module, - compiler.runtime, - MethodResolver(unit), - ) - - if compiler.GenerateDebug { - compiler.debug = debug.NewDIBuilder( - types.Sizes(compiler.llvmtypes), - compiler.module.Module, - impcfg.Fset, - compiler.DebugPrefixMaps, - ) - defer compiler.debug.Destroy() - defer compiler.debug.Finalize() - } - - unit.translatePackage(mainPkg) - compiler.processAnnotations(unit, mainPkginfo) - - if importpath == "main" { - compiler.createInitMainFunction(mainPkg) - } else { - compiler.module.ExportData = compiler.buildExportData(mainPkg) - } - - return compiler.module, nil -} - -type byPriorityThenFunc []gccgoimporter.PackageInit - -func (a byPriorityThenFunc) Len() int { return len(a) } -func (a byPriorityThenFunc) Swap(i, j int) { a[i], a[j] = a[j], a[i] } -func (a byPriorityThenFunc) Less(i, j int) bool { - switch { - case a[i].Priority < a[j].Priority: - return true - case a[i].Priority > a[j].Priority: - return false - case a[i].InitFunc < a[j].InitFunc: - return true - default: - return false - } -} - -func (c *compiler) buildPackageInitData(mainPkg *ssa.Package) gccgoimporter.InitData { - var inits []gccgoimporter.PackageInit - for _, imp := range mainPkg.Object.Imports() { - inits = append(inits, c.InitMap[imp].Inits...) - } - sort.Sort(byPriorityThenFunc(inits)) - - // Deduplicate init entries. We want to preserve the entry with the highest priority. - // Normally a package's priorities will be consistent among its dependencies, but it is - // possible for them to be different. For example, if a standard library test augments a - // package which is a dependency of 'regexp' (which is imported by every test main package) - // with additional dependencies, those dependencies may cause the package under test to - // receive a higher priority than indicated by its init clause in 'regexp'. - uniqinits := make([]gccgoimporter.PackageInit, len(inits)) - uniqinitpos := len(inits) - uniqinitnames := make(map[string]struct{}) - for i, _ := range inits { - init := inits[len(inits)-1-i] - if _, ok := uniqinitnames[init.InitFunc]; !ok { - uniqinitnames[init.InitFunc] = struct{}{} - uniqinitpos-- - uniqinits[uniqinitpos] = init - } - } - uniqinits = uniqinits[uniqinitpos:] - - ourprio := 1 - if len(uniqinits) != 0 { - ourprio = uniqinits[len(uniqinits)-1].Priority + 1 - } - - if imp := mainPkg.Func("init"); imp != nil { - impname := c.types.mc.mangleFunctionName(imp) - uniqinits = append(uniqinits, gccgoimporter.PackageInit{mainPkg.Object.Name(), impname, ourprio}) - } - - return gccgoimporter.InitData{ourprio, uniqinits} -} - -func (c *compiler) createInitMainFunction(mainPkg *ssa.Package) { - int8ptr := llvm.PointerType(c.types.ctx.Int8Type(), 0) - ftyp := llvm.FunctionType(llvm.VoidType(), []llvm.Type{int8ptr}, false) - initMain := llvm.AddFunction(c.module.Module, "__go_init_main", ftyp) - c.addCommonFunctionAttrs(initMain) - entry := llvm.AddBasicBlock(initMain, "entry") - - builder := llvm.GlobalContext().NewBuilder() - defer builder.Dispose() - builder.SetInsertPointAtEnd(entry) - - args := []llvm.Value{llvm.Undef(int8ptr)} - - if !c.GccgoABI { - initfn := c.module.Module.NamedFunction("main..import") - if !initfn.IsNil() { - builder.CreateCall(initfn, args, "") - } - builder.CreateRetVoid() - return - } - - initdata := c.buildPackageInitData(mainPkg) - - for _, init := range initdata.Inits { - initfn := c.module.Module.NamedFunction(init.InitFunc) - if initfn.IsNil() { - initfn = llvm.AddFunction(c.module.Module, init.InitFunc, ftyp) - } - builder.CreateCall(initfn, args, "") - } - - builder.CreateRetVoid() -} - -func (c *compiler) buildExportData(mainPkg *ssa.Package) []byte { - exportData := importer.ExportData(mainPkg.Object) - b := bytes.NewBuffer(exportData) - - b.WriteString("v1;\n") - if !c.GccgoABI { - return b.Bytes() - } - - initdata := c.buildPackageInitData(mainPkg) - b.WriteString("priority ") - b.WriteString(strconv.Itoa(initdata.Priority)) - b.WriteString(";\n") - - if len(initdata.Inits) != 0 { - b.WriteString("init") - for _, init := range initdata.Inits { - b.WriteRune(' ') - b.WriteString(init.Name) - b.WriteRune(' ') - b.WriteString(init.InitFunc) - b.WriteRune(' ') - b.WriteString(strconv.Itoa(init.Priority)) - } - b.WriteString(";\n") - } - - return b.Bytes() -} - -// vim: set ft=go : diff --git a/llgo/irgen/errors.go b/llgo/irgen/errors.go deleted file mode 100644 index 01be69b40e2bb1238209b079dec698df88eed341..0000000000000000000000000000000000000000 --- a/llgo/irgen/errors.go +++ /dev/null @@ -1,71 +0,0 @@ -//===- errors.go - IR generation for run-time panics ----------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for triggering run-time panics. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llvm/bindings/go/llvm" -) - -const ( - // From go-runtime-error.c - gccgoRuntimeErrorSLICE_INDEX_OUT_OF_BOUNDS = 0 - gccgoRuntimeErrorARRAY_INDEX_OUT_OF_BOUNDS = 1 - gccgoRuntimeErrorSTRING_INDEX_OUT_OF_BOUNDS = 2 - gccgoRuntimeErrorSLICE_SLICE_OUT_OF_BOUNDS = 3 - gccgoRuntimeErrorARRAY_SLICE_OUT_OF_BOUNDS = 4 - gccgoRuntimeErrorSTRING_SLICE_OUT_OF_BOUNDS = 5 - gccgoRuntimeErrorNIL_DEREFERENCE = 6 - gccgoRuntimeErrorMAKE_SLICE_OUT_OF_BOUNDS = 7 - gccgoRuntimeErrorMAKE_MAP_OUT_OF_BOUNDS = 8 - gccgoRuntimeErrorMAKE_CHAN_OUT_OF_BOUNDS = 9 - gccgoRuntimeErrorDIVISION_BY_ZERO = 10 - gccgoRuntimeErrorCount = 11 -) - -func (fr *frame) setBranchWeightMetadata(br llvm.Value, trueweight, falseweight uint64) { - mdprof := llvm.MDKindID("prof") - - mdnode := llvm.GlobalContext().MDNode([]llvm.Metadata{ - llvm.GlobalContext().MDString("branch_weights"), - llvm.ConstInt(llvm.Int32Type(), trueweight, false).ConstantAsMetadata(), - llvm.ConstInt(llvm.Int32Type(), falseweight, false).ConstantAsMetadata(), - }) - - br.SetMetadata(mdprof, mdnode) -} - -func (fr *frame) condBrRuntimeError(cond llvm.Value, errcode uint64) { - if cond.IsNull() { - return - } - - errorbb := fr.runtimeErrorBlocks[errcode] - newbb := errorbb.C == nil - if newbb { - errorbb = llvm.AddBasicBlock(fr.function, "") - fr.runtimeErrorBlocks[errcode] = errorbb - } - - contbb := llvm.AddBasicBlock(fr.function, "") - - br := fr.builder.CreateCondBr(cond, errorbb, contbb) - fr.setBranchWeightMetadata(br, 1, 1000) - - if newbb { - fr.builder.SetInsertPointAtEnd(errorbb) - fr.runtime.runtimeError.call(fr, llvm.ConstInt(llvm.Int32Type(), errcode, false)) - fr.builder.CreateUnreachable() - } - - fr.builder.SetInsertPointAtEnd(contbb) -} diff --git a/llgo/irgen/indirect.go b/llgo/irgen/indirect.go deleted file mode 100644 index 50074294857271dfecd2702de87db6c0d01a19a9..0000000000000000000000000000000000000000 --- a/llgo/irgen/indirect.go +++ /dev/null @@ -1,124 +0,0 @@ -//===- indirect.go - IR generation for thunks -----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for thunks required by the "defer" and -// "go" builtins. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// createThunk creates a thunk from a -// given function and arguments, suitable for use with -// "defer" and "go". -func (fr *frame) createThunk(call ssa.CallInstruction) (thunk llvm.Value, arg llvm.Value) { - seenarg := make(map[ssa.Value]bool) - var args []ssa.Value - var argtypes []*types.Var - - packArg := func(arg ssa.Value) { - switch arg.(type) { - case *ssa.Builtin, *ssa.Function, *ssa.Const, *ssa.Global: - // Do nothing: we can generate these in the thunk - default: - if !seenarg[arg] { - seenarg[arg] = true - args = append(args, arg) - field := types.NewField(0, nil, "_", arg.Type(), true) - argtypes = append(argtypes, field) - } - } - } - - packArg(call.Common().Value) - for _, arg := range call.Common().Args { - packArg(arg) - } - - var isRecoverCall bool - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - var structllptr llvm.Type - if len(args) == 0 { - if builtin, ok := call.Common().Value.(*ssa.Builtin); ok { - isRecoverCall = builtin.Name() == "recover" - } - if isRecoverCall { - // When creating a thunk for recover(), we must pass fr.canRecover. - arg = fr.builder.CreateZExt(fr.canRecover, fr.target.IntPtrType(), "") - arg = fr.builder.CreateIntToPtr(arg, i8ptr, "") - } else { - arg = llvm.ConstPointerNull(i8ptr) - } - } else { - structtype := types.NewStruct(argtypes, nil) - arg = fr.createTypeMalloc(structtype) - structllptr = arg.Type() - for i, ssaarg := range args { - argptr := fr.builder.CreateStructGEP(arg, i, "") - fr.builder.CreateStore(fr.llvmvalue(ssaarg), argptr) - } - arg = fr.builder.CreateBitCast(arg, i8ptr, "") - } - - thunkfntype := llvm.FunctionType(llvm.VoidType(), []llvm.Type{i8ptr}, false) - thunkfn := llvm.AddFunction(fr.module.Module, "", thunkfntype) - thunkfn.SetLinkage(llvm.InternalLinkage) - fr.addCommonFunctionAttrs(thunkfn) - - thunkfr := newFrame(fr.unit, thunkfn) - defer thunkfr.dispose() - - prologuebb := llvm.AddBasicBlock(thunkfn, "prologue") - thunkfr.builder.SetInsertPointAtEnd(prologuebb) - - if isRecoverCall { - thunkarg := thunkfn.Param(0) - thunkarg = thunkfr.builder.CreatePtrToInt(thunkarg, fr.target.IntPtrType(), "") - thunkfr.canRecover = thunkfr.builder.CreateTrunc(thunkarg, llvm.Int1Type(), "") - } else if len(args) > 0 { - thunkarg := thunkfn.Param(0) - thunkarg = thunkfr.builder.CreateBitCast(thunkarg, structllptr, "") - for i, ssaarg := range args { - thunkargptr := thunkfr.builder.CreateStructGEP(thunkarg, i, "") - thunkarg := thunkfr.builder.CreateLoad(thunkargptr, "") - thunkfr.env[ssaarg] = newValue(thunkarg, ssaarg.Type()) - } - } - - _, isDefer := call.(*ssa.Defer) - - entrybb := llvm.AddBasicBlock(thunkfn, "entry") - br := thunkfr.builder.CreateBr(entrybb) - thunkfr.allocaBuilder.SetInsertPointBefore(br) - - thunkfr.builder.SetInsertPointAtEnd(entrybb) - var exitbb llvm.BasicBlock - if isDefer { - exitbb = llvm.AddBasicBlock(thunkfn, "exit") - thunkfr.runtime.setDeferRetaddr.call(thunkfr, llvm.BlockAddress(thunkfn, exitbb)) - } - if isDefer && isRecoverCall { - thunkfr.callRecover(true) - } else { - thunkfr.callInstruction(call) - } - if isDefer { - thunkfr.builder.CreateBr(exitbb) - thunkfr.builder.SetInsertPointAtEnd(exitbb) - } - thunkfr.builder.CreateRetVoid() - - thunk = fr.builder.CreateBitCast(thunkfn, i8ptr, "") - return -} diff --git a/llgo/irgen/interfaces.go b/llgo/irgen/interfaces.go deleted file mode 100644 index 6ebaa5564ed597cd90ceddd841f58645c526f388..0000000000000000000000000000000000000000 --- a/llgo/irgen/interfaces.go +++ /dev/null @@ -1,195 +0,0 @@ -//===- interfaces.go - IR generation for interfaces -----------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for dealing with interface values. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// interfaceMethod returns a function and receiver pointer for the specified -// interface and method pair. -func (fr *frame) interfaceMethod(lliface llvm.Value, ifacety types.Type, method *types.Func) (fn, recv *govalue) { - llitab := fr.builder.CreateExtractValue(lliface, 0, "") - recv = newValue(fr.builder.CreateExtractValue(lliface, 1, ""), types.Typ[types.UnsafePointer]) - methodset := fr.types.MethodSet(ifacety) - // TODO(axw) cache ordered method index - index := -1 - for i, m := range orderedMethodSet(methodset) { - if m.Obj() == method { - index = i - break - } - } - if index == -1 { - panic("could not find method index") - } - llitab = fr.builder.CreateBitCast(llitab, llvm.PointerType(llvm.PointerType(llvm.Int8Type(), 0), 0), "") - // Skip runtime type pointer. - llifnptr := fr.builder.CreateGEP(llitab, []llvm.Value{ - llvm.ConstInt(llvm.Int32Type(), uint64(index+1), false), - }, "") - - llifn := fr.builder.CreateLoad(llifnptr, "") - // Replace receiver type with unsafe.Pointer. - recvparam := types.NewParam(0, nil, "", types.Typ[types.UnsafePointer]) - sig := method.Type().(*types.Signature) - sig = types.NewSignature(nil, recvparam, sig.Params(), sig.Results(), sig.Variadic()) - fn = newValue(llifn, sig) - return -} - -// compareInterfaces emits code to compare two interfaces for -// equality. -func (fr *frame) compareInterfaces(a, b *govalue) *govalue { - aNull := a.value.IsNull() - bNull := b.value.IsNull() - if aNull && bNull { - return newValue(boolLLVMValue(true), types.Typ[types.Bool]) - } - - compare := fr.runtime.emptyInterfaceCompare - aI := a.Type().Underlying().(*types.Interface).NumMethods() > 0 - bI := b.Type().Underlying().(*types.Interface).NumMethods() > 0 - switch { - case aI && bI: - compare = fr.runtime.interfaceCompare - case aI: - a = fr.convertI2E(a) - case bI: - b = fr.convertI2E(b) - } - - result := compare.call(fr, a.value, b.value)[0] - result = fr.builder.CreateIsNull(result, "") - result = fr.builder.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) -} - -func (fr *frame) makeInterface(llv llvm.Value, vty types.Type, iface types.Type) *govalue { - if _, ok := vty.Underlying().(*types.Pointer); !ok { - ptr := fr.createTypeMalloc(vty) - fr.builder.CreateStore(llv, ptr) - llv = ptr - } - return fr.makeInterfaceFromPointer(llv, vty, iface) -} - -func (fr *frame) makeInterfaceFromPointer(vptr llvm.Value, vty types.Type, iface types.Type) *govalue { - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - llv := fr.builder.CreateBitCast(vptr, i8ptr, "") - value := llvm.Undef(fr.types.ToLLVM(iface)) - itab := fr.types.getItabPointer(vty, iface.Underlying().(*types.Interface)) - value = fr.builder.CreateInsertValue(value, itab, 0, "") - value = fr.builder.CreateInsertValue(value, llv, 1, "") - return newValue(value, iface) -} - -// Reads the type descriptor from the given interface type. -func (fr *frame) getInterfaceTypeDescriptor(v *govalue) llvm.Value { - isempty := v.Type().Underlying().(*types.Interface).NumMethods() == 0 - itab := fr.builder.CreateExtractValue(v.value, 0, "") - if isempty { - return itab - } else { - itabnonnull := fr.builder.CreateIsNotNull(itab, "") - return fr.loadOrNull(itabnonnull, itab, types.Typ[types.UnsafePointer]).value - } -} - -// Reads the value from the given interface type, assuming that the -// interface holds a value of the correct type. -func (fr *frame) getInterfaceValue(v *govalue, ty types.Type) *govalue { - val := fr.builder.CreateExtractValue(v.value, 1, "") - if _, ok := ty.Underlying().(*types.Pointer); !ok { - typedval := fr.builder.CreateBitCast(val, llvm.PointerType(fr.types.ToLLVM(ty), 0), "") - val = fr.builder.CreateLoad(typedval, "") - } - return newValue(val, ty) -} - -// If cond is true, reads the value from the given interface type, otherwise -// returns a nil value. -func (fr *frame) getInterfaceValueOrNull(cond llvm.Value, v *govalue, ty types.Type) *govalue { - val := fr.builder.CreateExtractValue(v.value, 1, "") - if _, ok := ty.Underlying().(*types.Pointer); ok { - val = fr.builder.CreateSelect(cond, val, llvm.ConstNull(val.Type()), "") - } else { - val = fr.loadOrNull(cond, val, ty).value - } - return newValue(val, ty) -} - -func (fr *frame) interfaceTypeCheck(val *govalue, ty types.Type) (v *govalue, okval *govalue) { - tytd := fr.types.ToRuntime(ty) - if _, ok := ty.Underlying().(*types.Interface); ok { - var result []llvm.Value - if val.Type().Underlying().(*types.Interface).NumMethods() > 0 { - result = fr.runtime.ifaceI2I2.call(fr, tytd, val.value) - } else { - result = fr.runtime.ifaceE2I2.call(fr, tytd, val.value) - } - v = newValue(result[0], ty) - okval = newValue(result[1], types.Typ[types.Bool]) - } else { - valtd := fr.getInterfaceTypeDescriptor(val) - tyequal := fr.runtime.typeDescriptorsEqual.call(fr, valtd, tytd)[0] - okval = newValue(tyequal, types.Typ[types.Bool]) - tyequal = fr.builder.CreateTrunc(tyequal, llvm.Int1Type(), "") - - v = fr.getInterfaceValueOrNull(tyequal, val, ty) - } - return -} - -func (fr *frame) interfaceTypeAssert(val *govalue, ty types.Type) *govalue { - if _, ok := ty.Underlying().(*types.Interface); ok { - return fr.changeInterface(val, ty, true) - } else { - valtytd := fr.types.ToRuntime(val.Type()) - valtd := fr.getInterfaceTypeDescriptor(val) - tytd := fr.types.ToRuntime(ty) - fr.runtime.checkInterfaceType.call(fr, valtd, tytd, valtytd) - - return fr.getInterfaceValue(val, ty) - } -} - -// convertI2E converts a non-empty interface value to an empty interface. -func (fr *frame) convertI2E(v *govalue) *govalue { - td := fr.getInterfaceTypeDescriptor(v) - val := fr.builder.CreateExtractValue(v.value, 1, "") - - typ := types.NewInterface(nil, nil) - intf := llvm.Undef(fr.types.ToLLVM(typ)) - intf = fr.builder.CreateInsertValue(intf, td, 0, "") - intf = fr.builder.CreateInsertValue(intf, val, 1, "") - return newValue(intf, typ) -} - -func (fr *frame) changeInterface(v *govalue, ty types.Type, assert bool) *govalue { - td := fr.getInterfaceTypeDescriptor(v) - tytd := fr.types.ToRuntime(ty) - var itab llvm.Value - if assert { - itab = fr.runtime.assertInterface.call(fr, tytd, td)[0] - } else { - itab = fr.runtime.convertInterface.call(fr, tytd, td)[0] - } - val := fr.builder.CreateExtractValue(v.value, 1, "") - - intf := llvm.Undef(fr.types.ToLLVM(ty)) - intf = fr.builder.CreateInsertValue(intf, itab, 0, "") - intf = fr.builder.CreateInsertValue(intf, val, 1, "") - return newValue(intf, ty) -} diff --git a/llgo/irgen/maps.go b/llgo/irgen/maps.go deleted file mode 100644 index f729b07f26f04b5589354b23c44f25958418c5e8..0000000000000000000000000000000000000000 --- a/llgo/irgen/maps.go +++ /dev/null @@ -1,156 +0,0 @@ -//===- maps.go - IR generation for maps -----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for maps. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// makeMap implements make(maptype[, initial space]) -func (fr *frame) makeMap(typ types.Type, cap_ *govalue) *govalue { - // TODO(pcc): call __go_new_map_big here if needed - dyntyp := fr.types.getMapDescriptorPointer(typ) - dyntyp = fr.builder.CreateBitCast(dyntyp, llvm.PointerType(llvm.Int8Type(), 0), "") - var cap llvm.Value - if cap_ != nil { - cap = fr.convert(cap_, types.Typ[types.Uintptr]).value - } else { - cap = llvm.ConstNull(fr.types.inttype) - } - m := fr.runtime.newMap.call(fr, dyntyp, cap) - return newValue(m[0], typ) -} - -// mapLookup implements v[, ok] = m[k] -func (fr *frame) mapLookup(m, k *govalue) (v *govalue, ok *govalue) { - llk := k.value - pk := fr.allocaBuilder.CreateAlloca(llk.Type(), "") - fr.builder.CreateStore(llk, pk) - valptr := fr.runtime.mapIndex.call(fr, m.value, pk, boolLLVMValue(false))[0] - attrkind := llvm.AttributeKindID("nocapture") - valptr.AddCallSiteAttribute(2, fr.types.ctx.CreateEnumAttribute(attrkind, 0)) - attrkind = llvm.AttributeKindID("readonly") - valptr.AddCallSiteAttribute(2, fr.types.ctx.CreateEnumAttribute(attrkind, 0)) - okbit := fr.builder.CreateIsNotNull(valptr, "") - - elemtyp := m.Type().Underlying().(*types.Map).Elem() - ok = newValue(fr.builder.CreateZExt(okbit, llvm.Int8Type(), ""), types.Typ[types.Bool]) - v = fr.loadOrNull(okbit, valptr, elemtyp) - return -} - -// mapUpdate implements m[k] = v -func (fr *frame) mapUpdate(m, k, v *govalue) { - llk := k.value - pk := fr.allocaBuilder.CreateAlloca(llk.Type(), "") - fr.builder.CreateStore(llk, pk) - valptr := fr.runtime.mapIndex.call(fr, m.value, pk, boolLLVMValue(true))[0] - attrkind := llvm.AttributeKindID("nocapture") - valptr.AddCallSiteAttribute(2, fr.types.ctx.CreateEnumAttribute(attrkind, 0)) - attrkind = llvm.AttributeKindID("readonly") - valptr.AddCallSiteAttribute(2, fr.types.ctx.CreateEnumAttribute(attrkind, 0)) - - elemtyp := m.Type().Underlying().(*types.Map).Elem() - llelemtyp := fr.types.ToLLVM(elemtyp) - typedvalptr := fr.builder.CreateBitCast(valptr, llvm.PointerType(llelemtyp, 0), "") - fr.builder.CreateStore(v.value, typedvalptr) -} - -// mapDelete implements delete(m, k) -func (fr *frame) mapDelete(m, k *govalue) { - llk := k.value - pk := fr.allocaBuilder.CreateAlloca(llk.Type(), "") - fr.builder.CreateStore(llk, pk) - fr.runtime.mapdelete.call(fr, m.value, pk) -} - -// mapIterInit creates a map iterator -func (fr *frame) mapIterInit(m *govalue) []*govalue { - // We represent an iterator as a tuple (map, *bool). The second element - // controls whether the code we generate for "next" (below) calls the - // runtime function for the first or the next element. We let the - // optimizer reorganize this into something more sensible. - isinit := fr.allocaBuilder.CreateAlloca(llvm.Int1Type(), "") - fr.builder.CreateStore(llvm.ConstNull(llvm.Int1Type()), isinit) - - return []*govalue{m, newValue(isinit, types.NewPointer(types.Typ[types.Bool]))} -} - -// mapIterNext advances the iterator, and returns the tuple (ok, k, v). -func (fr *frame) mapIterNext(iter []*govalue) []*govalue { - maptyp := iter[0].Type().Underlying().(*types.Map) - ktyp := maptyp.Key() - klltyp := fr.types.ToLLVM(ktyp) - vtyp := maptyp.Elem() - vlltyp := fr.types.ToLLVM(vtyp) - - m, isinitptr := iter[0], iter[1] - - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - mapiterbufty := llvm.ArrayType(i8ptr, 4) - mapiterbuf := fr.allocaBuilder.CreateAlloca(mapiterbufty, "") - mapiterbufelem0ptr := fr.builder.CreateStructGEP(mapiterbuf, 0, "") - - keybuf := fr.allocaBuilder.CreateAlloca(klltyp, "") - keyptr := fr.builder.CreateBitCast(keybuf, i8ptr, "") - valbuf := fr.allocaBuilder.CreateAlloca(vlltyp, "") - valptr := fr.builder.CreateBitCast(valbuf, i8ptr, "") - - isinit := fr.builder.CreateLoad(isinitptr.value, "") - - initbb := llvm.AddBasicBlock(fr.function, "") - nextbb := llvm.AddBasicBlock(fr.function, "") - contbb := llvm.AddBasicBlock(fr.function, "") - - fr.builder.CreateCondBr(isinit, nextbb, initbb) - - fr.builder.SetInsertPointAtEnd(initbb) - fr.builder.CreateStore(llvm.ConstAllOnes(llvm.Int1Type()), isinitptr.value) - fr.runtime.mapiterinit.call(fr, m.value, mapiterbufelem0ptr) - fr.builder.CreateBr(contbb) - - fr.builder.SetInsertPointAtEnd(nextbb) - fr.runtime.mapiternext.call(fr, mapiterbufelem0ptr) - fr.builder.CreateBr(contbb) - - fr.builder.SetInsertPointAtEnd(contbb) - mapiterbufelem0 := fr.builder.CreateLoad(mapiterbufelem0ptr, "") - okbit := fr.builder.CreateIsNotNull(mapiterbufelem0, "") - ok := fr.builder.CreateZExt(okbit, llvm.Int8Type(), "") - - loadbb := llvm.AddBasicBlock(fr.function, "") - cont2bb := llvm.AddBasicBlock(fr.function, "") - fr.builder.CreateCondBr(okbit, loadbb, cont2bb) - - fr.builder.SetInsertPointAtEnd(loadbb) - fr.runtime.mapiter2.call(fr, mapiterbufelem0ptr, keyptr, valptr) - loadbb = fr.builder.GetInsertBlock() - loadedkey := fr.builder.CreateLoad(keybuf, "") - loadedval := fr.builder.CreateLoad(valbuf, "") - fr.builder.CreateBr(cont2bb) - - fr.builder.SetInsertPointAtEnd(cont2bb) - k := fr.builder.CreatePHI(klltyp, "") - k.AddIncoming( - []llvm.Value{llvm.ConstNull(klltyp), loadedkey}, - []llvm.BasicBlock{contbb, loadbb}, - ) - v := fr.builder.CreatePHI(vlltyp, "") - v.AddIncoming( - []llvm.Value{llvm.ConstNull(vlltyp), loadedval}, - []llvm.BasicBlock{contbb, loadbb}, - ) - - return []*govalue{newValue(ok, types.Typ[types.Bool]), newValue(k, ktyp), newValue(v, vtyp)} -} diff --git a/llgo/irgen/predicates.go b/llgo/irgen/predicates.go deleted file mode 100644 index 52e9e2ca935c95938104b273071c7fff2444e3aa..0000000000000000000000000000000000000000 --- a/llgo/irgen/predicates.go +++ /dev/null @@ -1,57 +0,0 @@ -//===- predicates.go - type predicates ------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements commonly used type predicates. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" -) - -func isBoolean(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsBoolean != 0 -} - -func isInteger(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsInteger != 0 -} - -func isUnsigned(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsUnsigned != 0 -} - -func isFloat(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsFloat != 0 -} - -func isComplex(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsComplex != 0 -} - -func isString(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsString != 0 -} - -func isUntyped(typ types.Type) bool { - t, ok := typ.Underlying().(*types.Basic) - return ok && t.Info()&types.IsUntyped != 0 -} - -func isSlice(typ types.Type, bkind types.BasicKind) bool { - t, ok := typ.Underlying().(*types.Slice) - return ok && types.Identical(t.Elem().Underlying(), types.Typ[bkind]) -} diff --git a/llgo/irgen/println.go b/llgo/irgen/println.go deleted file mode 100644 index caeaff2c0d5ca3993ae43a7431eb5692df5bc630..0000000000000000000000000000000000000000 --- a/llgo/irgen/println.go +++ /dev/null @@ -1,92 +0,0 @@ -//===- println.go - IR generation for print and println -------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for the print and println built-in -// functions. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "fmt" - - "llvm.org/llgo/third_party/gotools/go/types" -) - -func (fr *frame) printValues(println_ bool, values ...*govalue) { - for i, value := range values { - llvm_value := value.value - - typ := value.Type().Underlying() - if name, isname := typ.(*types.Named); isname { - typ = name.Underlying() - } - - if println_ && i > 0 { - fr.runtime.printSpace.call(fr) - } - switch typ := typ.(type) { - case *types.Basic: - switch typ.Kind() { - case types.Uint8, types.Uint16, types.Uint32, types.Uintptr, types.Uint, types.Uint64: - i64 := fr.llvmtypes.ctx.Int64Type() - zext := fr.builder.CreateZExt(llvm_value, i64, "") - fr.runtime.printUint64.call(fr, zext) - - case types.Int, types.Int8, types.Int16, types.Int32, types.Int64: - i64 := fr.llvmtypes.ctx.Int64Type() - sext := fr.builder.CreateSExt(llvm_value, i64, "") - fr.runtime.printInt64.call(fr, sext) - - case types.Float32: - llvm_value = fr.builder.CreateFPExt(llvm_value, fr.llvmtypes.ctx.DoubleType(), "") - fallthrough - case types.Float64: - fr.runtime.printDouble.call(fr, llvm_value) - - case types.Complex64: - llvm_value = fr.convert(value, types.Typ[types.Complex128]).value - fallthrough - case types.Complex128: - fr.runtime.printComplex.call(fr, llvm_value) - - case types.String, types.UntypedString: - fr.runtime.printString.call(fr, llvm_value) - - case types.Bool: - fr.runtime.printBool.call(fr, llvm_value) - - case types.UnsafePointer: - fr.runtime.printPointer.call(fr, llvm_value) - - default: - panic(fmt.Sprint("Unhandled Basic Kind: ", typ.Kind)) - } - - case *types.Interface: - if typ.Empty() { - fr.runtime.printEmptyInterface.call(fr, llvm_value) - } else { - fr.runtime.printInterface.call(fr, llvm_value) - } - - case *types.Slice: - fr.runtime.printSlice.call(fr, llvm_value) - - case *types.Pointer, *types.Map, *types.Chan, *types.Signature: - fr.runtime.printPointer.call(fr, llvm_value) - - default: - panic(fmt.Sprintf("Unhandled type kind: %s (%T)", typ, typ)) - } - } - if println_ { - fr.runtime.printNl.call(fr) - } -} diff --git a/llgo/irgen/runtime.go b/llgo/irgen/runtime.go deleted file mode 100644 index 3731ff1880c2ac00159295c78baf3e4a46ef4f7a..0000000000000000000000000000000000000000 --- a/llgo/irgen/runtime.go +++ /dev/null @@ -1,607 +0,0 @@ -//===- runtime.go - IR generation for runtime calls -----------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for calls to the runtime library. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "strconv" - - "llvm.org/llgo/third_party/gotools/go/types" - - "llvm.org/llvm/bindings/go/llvm" -) - -type runtimeFnInfo struct { - fi *functionTypeInfo - fn llvm.Value -} - -func (rfi *runtimeFnInfo) init(tm *llvmTypeMap, m llvm.Module, name string, args []types.Type, results []types.Type) { - rfi.fi = new(functionTypeInfo) - *rfi.fi = tm.getFunctionTypeInfo(args, results) - rfi.fn = rfi.fi.declare(m, name) -} - -func (rfi *runtimeFnInfo) call(f *frame, args ...llvm.Value) []llvm.Value { - if f.unwindBlock.IsNil() { - return rfi.callOnly(f, args...) - } else { - return rfi.invoke(f, f.unwindBlock, args...) - } -} - -func (rfi *runtimeFnInfo) callOnly(f *frame, args ...llvm.Value) []llvm.Value { - return rfi.fi.call(f.llvmtypes.ctx, f.allocaBuilder, f.builder, rfi.fn, llvm.Value{nil}, args) -} - -func (rfi *runtimeFnInfo) invoke(f *frame, lpad llvm.BasicBlock, args ...llvm.Value) []llvm.Value { - contbb := llvm.AddBasicBlock(f.function, "") - return rfi.fi.invoke(f.llvmtypes.ctx, f.allocaBuilder, f.builder, rfi.fn, llvm.Value{nil}, args, contbb, lpad) -} - -// runtimeInterface is a struct containing references to -// runtime types and intrinsic function declarations. -type runtimeInterface struct { - // LLVM intrinsics - memcpy, - memset, - returnaddress llvm.Value - - // Exception handling support - gccgoPersonality llvm.Value - gccgoExceptionType llvm.Type - - // Runtime intrinsics - append, - assertInterface, - byteArrayToString, - canRecover, - chanCap, - chanLen, - chanrecv2, - checkDefer, - checkInterfaceType, - builtinClose, - convertInterface, - copy, - Defer, - deferredRecover, - emptyInterfaceCompare, - Go, - ifaceE2I2, - ifaceI2I2, - intArrayToString, - interfaceCompare, - intToString, - makeSlice, - mapdelete, - mapiter2, - mapiterinit, - mapiternext, - mapIndex, - mapLen, - New, - newChannel, - newMap, - newSelect, - panic, - printBool, - printComplex, - printDouble, - printEmptyInterface, - printInterface, - printInt64, - printNl, - printPointer, - printSlice, - printSpace, - printString, - printUint64, - receive, - recover, - registerGcRoots, - runtimeError, - selectdefault, - selectrecv2, - selectsend, - selectgo, - sendBig, - setDeferRetaddr, - strcmp, - stringiter2, - stringPlus, - stringSlice, - stringToByteArray, - stringToIntArray, - typeDescriptorsEqual, - undefer runtimeFnInfo -} - -func newRuntimeInterface(module llvm.Module, tm *llvmTypeMap) (*runtimeInterface, error) { - var ri runtimeInterface - - Bool := types.Typ[types.Bool] - Complex128 := types.Typ[types.Complex128] - Float64 := types.Typ[types.Float64] - Int32 := types.Typ[types.Int32] - Int64 := types.Typ[types.Int64] - Int := types.Typ[types.Int] - Rune := types.Typ[types.Rune] - String := types.Typ[types.String] - Uintptr := types.Typ[types.Uintptr] - UnsafePointer := types.Typ[types.UnsafePointer] - - EmptyInterface := types.NewInterface(nil, nil) - ByteSlice := types.NewSlice(types.Typ[types.Byte]) - IntSlice := types.NewSlice(types.Typ[types.Int]) - - AttrKind := llvm.AttributeKindID("nounwind") - NoUnwindAttr := module.Context().CreateEnumAttribute(AttrKind, 0) - AttrKind = llvm.AttributeKindID("noreturn") - NoReturnAttr := module.Context().CreateEnumAttribute(AttrKind, 0) - - for _, rt := range [...]struct { - name string - rfi *runtimeFnInfo - args, res []types.Type - attrs []llvm.Attribute - }{ - { - name: "__go_append", - rfi: &ri.append, - args: []types.Type{IntSlice, UnsafePointer, Uintptr, Uintptr}, - res: []types.Type{IntSlice}, - }, - { - name: "__go_assert_interface", - rfi: &ri.assertInterface, - args: []types.Type{UnsafePointer, UnsafePointer}, - res: []types.Type{UnsafePointer}, - }, - { - name: "__go_byte_array_to_string", - rfi: &ri.byteArrayToString, - args: []types.Type{UnsafePointer, Int}, - res: []types.Type{String}, - attrs: []llvm.Attribute{NoUnwindAttr}, - }, - { - name: "__go_can_recover", - rfi: &ri.canRecover, - args: []types.Type{UnsafePointer}, - res: []types.Type{Bool}, - }, - { - name: "__go_chan_cap", - rfi: &ri.chanCap, - args: []types.Type{UnsafePointer}, - res: []types.Type{Int}, - }, - { - name: "__go_chan_len", - rfi: &ri.chanLen, - args: []types.Type{UnsafePointer}, - res: []types.Type{Int}, - }, - { - name: "runtime.chanrecv2", - rfi: &ri.chanrecv2, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - res: []types.Type{Bool}, - }, - { - name: "__go_check_defer", - rfi: &ri.checkDefer, - args: []types.Type{UnsafePointer}, - }, - { - name: "__go_check_interface_type", - rfi: &ri.checkInterfaceType, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - }, - { - name: "__go_builtin_close", - rfi: &ri.builtinClose, - args: []types.Type{UnsafePointer}, - }, - { - name: "__go_convert_interface", - rfi: &ri.convertInterface, - args: []types.Type{UnsafePointer, UnsafePointer}, - res: []types.Type{UnsafePointer}, - }, - { - name: "__go_copy", - rfi: &ri.copy, - args: []types.Type{UnsafePointer, UnsafePointer, Uintptr}, - }, - { - name: "__go_defer", - rfi: &ri.Defer, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - }, - { - name: "__go_deferred_recover", - rfi: &ri.deferredRecover, - res: []types.Type{EmptyInterface}, - }, - { - name: "__go_empty_interface_compare", - rfi: &ri.emptyInterfaceCompare, - args: []types.Type{EmptyInterface, EmptyInterface}, - res: []types.Type{Int}, - }, - { - name: "__go_go", - rfi: &ri.Go, - args: []types.Type{UnsafePointer, UnsafePointer}, - }, - { - name: "runtime.ifaceE2I2", - rfi: &ri.ifaceE2I2, - args: []types.Type{UnsafePointer, EmptyInterface}, - res: []types.Type{EmptyInterface, Bool}, - }, - { - name: "runtime.ifaceI2I2", - rfi: &ri.ifaceI2I2, - args: []types.Type{UnsafePointer, EmptyInterface}, - res: []types.Type{EmptyInterface, Bool}, - }, - { - name: "__go_int_array_to_string", - rfi: &ri.intArrayToString, - args: []types.Type{UnsafePointer, Int}, - res: []types.Type{String}, - }, - { - name: "__go_int_to_string", - rfi: &ri.intToString, - args: []types.Type{Int}, - res: []types.Type{String}, - }, - { - name: "__go_interface_compare", - rfi: &ri.interfaceCompare, - args: []types.Type{EmptyInterface, EmptyInterface}, - res: []types.Type{Int}, - }, - { - name: "__go_make_slice2", - rfi: &ri.makeSlice, - args: []types.Type{UnsafePointer, Uintptr, Uintptr}, - res: []types.Type{IntSlice}, - }, - { - name: "runtime.mapdelete", - rfi: &ri.mapdelete, - args: []types.Type{UnsafePointer, UnsafePointer}, - }, - { - name: "runtime.mapiter2", - rfi: &ri.mapiter2, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - }, - { - name: "runtime.mapiterinit", - rfi: &ri.mapiterinit, - args: []types.Type{UnsafePointer, UnsafePointer}, - }, - { - name: "runtime.mapiternext", - rfi: &ri.mapiternext, - args: []types.Type{UnsafePointer}, - }, - { - name: "__go_map_index", - rfi: &ri.mapIndex, - args: []types.Type{UnsafePointer, UnsafePointer, Bool}, - res: []types.Type{UnsafePointer}, - }, - { - name: "__go_map_len", - rfi: &ri.mapLen, - args: []types.Type{UnsafePointer}, - res: []types.Type{Int}, - }, - { - name: "__go_new", - rfi: &ri.New, - args: []types.Type{UnsafePointer, Uintptr}, - res: []types.Type{UnsafePointer}, - attrs: []llvm.Attribute{NoUnwindAttr}, - }, - { - name: "__go_new_channel", - rfi: &ri.newChannel, - args: []types.Type{UnsafePointer, Uintptr}, - res: []types.Type{UnsafePointer}, - }, - { - name: "__go_new_map", - rfi: &ri.newMap, - args: []types.Type{UnsafePointer, Uintptr}, - res: []types.Type{UnsafePointer}, - }, - { - name: "runtime.newselect", - rfi: &ri.newSelect, - args: []types.Type{Int32}, - res: []types.Type{UnsafePointer}, - }, - { - name: "__go_panic", - rfi: &ri.panic, - args: []types.Type{EmptyInterface}, - attrs: []llvm.Attribute{NoReturnAttr}, - }, - { - name: "__go_print_bool", - rfi: &ri.printBool, - args: []types.Type{Bool}, - }, - { - name: "__go_print_complex", - rfi: &ri.printComplex, - args: []types.Type{Complex128}, - }, - { - name: "__go_print_double", - rfi: &ri.printDouble, - args: []types.Type{Float64}, - }, - { - name: "__go_print_empty_interface", - rfi: &ri.printEmptyInterface, - args: []types.Type{EmptyInterface}, - }, - { - name: "__go_print_interface", - rfi: &ri.printInterface, - args: []types.Type{EmptyInterface}, - }, - { - name: "__go_print_int64", - rfi: &ri.printInt64, - args: []types.Type{Int64}, - }, - { - name: "__go_print_nl", - rfi: &ri.printNl, - }, - { - name: "__go_print_pointer", - rfi: &ri.printPointer, - args: []types.Type{UnsafePointer}, - }, - { - name: "__go_print_slice", - rfi: &ri.printSlice, - args: []types.Type{IntSlice}, - }, - { - name: "__go_print_space", - rfi: &ri.printSpace, - }, - { - name: "__go_print_string", - rfi: &ri.printString, - args: []types.Type{String}, - }, - { - name: "__go_print_uint64", - rfi: &ri.printUint64, - args: []types.Type{Int64}, - }, - { - name: "__go_receive", - rfi: &ri.receive, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - }, - { - name: "__go_recover", - rfi: &ri.recover, - res: []types.Type{EmptyInterface}, - }, - { - name: "__go_register_gc_roots", - rfi: &ri.registerGcRoots, - args: []types.Type{UnsafePointer}, - }, - { - name: "__go_runtime_error", - rfi: &ri.runtimeError, - args: []types.Type{Int32}, - attrs: []llvm.Attribute{NoReturnAttr}, - }, - { - name: "runtime.selectdefault", - rfi: &ri.selectdefault, - args: []types.Type{UnsafePointer, Int32}, - }, - { - name: "runtime.selectgo", - rfi: &ri.selectgo, - args: []types.Type{UnsafePointer}, - res: []types.Type{Int}, - }, - { - name: "runtime.selectrecv2", - rfi: &ri.selectrecv2, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer, UnsafePointer, Int32}, - }, - { - name: "runtime.selectsend", - rfi: &ri.selectsend, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer, Int32}, - }, - { - name: "__go_send_big", - rfi: &ri.sendBig, - args: []types.Type{UnsafePointer, UnsafePointer, UnsafePointer}, - }, - { - name: "__go_set_defer_retaddr", - rfi: &ri.setDeferRetaddr, - args: []types.Type{UnsafePointer}, - res: []types.Type{Bool}, - }, - { - name: "__go_strcmp", - rfi: &ri.strcmp, - args: []types.Type{String, String}, - res: []types.Type{Int}, - }, - { - name: "__go_string_plus", - rfi: &ri.stringPlus, - args: []types.Type{String, String}, - res: []types.Type{String}, - }, - { - name: "__go_string_slice", - rfi: &ri.stringSlice, - args: []types.Type{String, Int, Int}, - res: []types.Type{String}, - }, - { - name: "__go_string_to_byte_array", - rfi: &ri.stringToByteArray, - args: []types.Type{String}, - res: []types.Type{ByteSlice}, - attrs: []llvm.Attribute{NoUnwindAttr}, - }, - { - name: "__go_string_to_int_array", - rfi: &ri.stringToIntArray, - args: []types.Type{String}, - res: []types.Type{IntSlice}, - }, - { - name: "runtime.stringiter2", - rfi: &ri.stringiter2, - args: []types.Type{String, Int}, - res: []types.Type{Int, Rune}, - }, - { - name: "__go_type_descriptors_equal", - rfi: &ri.typeDescriptorsEqual, - args: []types.Type{UnsafePointer, UnsafePointer}, - res: []types.Type{Bool}, - }, - { - name: "__go_undefer", - rfi: &ri.undefer, - args: []types.Type{UnsafePointer}, - }, - } { - rt.rfi.init(tm, module, rt.name, rt.args, rt.res) - for _, attr := range rt.attrs { - rt.rfi.fn.AddFunctionAttr(attr) - } - } - - memsetName := "llvm.memset.p0i8.i" + strconv.Itoa(tm.target.IntPtrType().IntTypeWidth()) - memsetType := llvm.FunctionType( - llvm.VoidType(), - []llvm.Type{ - llvm.PointerType(llvm.Int8Type(), 0), - llvm.Int8Type(), - tm.target.IntPtrType(), - llvm.Int1Type(), - }, - false, - ) - ri.memset = llvm.AddFunction(module, memsetName, memsetType) - - memcpyName := "llvm.memcpy.p0i8.p0i8.i" + strconv.Itoa(tm.target.IntPtrType().IntTypeWidth()) - memcpyType := llvm.FunctionType( - llvm.VoidType(), - []llvm.Type{ - llvm.PointerType(llvm.Int8Type(), 0), - llvm.PointerType(llvm.Int8Type(), 0), - llvm.Int64Type(), - llvm.Int1Type(), - }, - false, - ) - ri.memcpy = llvm.AddFunction(module, memcpyName, memcpyType) - - returnaddressType := llvm.FunctionType( - llvm.PointerType(llvm.Int8Type(), 0), - []llvm.Type{llvm.Int32Type()}, - false, - ) - ri.returnaddress = llvm.AddFunction(module, "llvm.returnaddress", returnaddressType) - - gccgoPersonalityType := llvm.FunctionType( - llvm.Int32Type(), - []llvm.Type{ - llvm.Int32Type(), - llvm.Int64Type(), - llvm.PointerType(llvm.Int8Type(), 0), - llvm.PointerType(llvm.Int8Type(), 0), - }, - false, - ) - ri.gccgoPersonality = llvm.AddFunction(module, "__gccgo_personality_v0", gccgoPersonalityType) - - ri.gccgoExceptionType = llvm.StructType( - []llvm.Type{ - llvm.PointerType(llvm.Int8Type(), 0), - llvm.Int32Type(), - }, - false, - ) - - return &ri, nil -} - -func (fr *frame) createZExtOrTrunc(v llvm.Value, t llvm.Type, name string) llvm.Value { - switch n := v.Type().IntTypeWidth() - t.IntTypeWidth(); { - case n < 0: - v = fr.builder.CreateZExt(v, fr.target.IntPtrType(), name) - case n > 0: - v = fr.builder.CreateTrunc(v, fr.target.IntPtrType(), name) - } - return v -} - -func (fr *frame) createTypeMalloc(t types.Type) llvm.Value { - size := llvm.ConstInt(fr.target.IntPtrType(), uint64(fr.llvmtypes.Sizeof(t)), false) - malloc := fr.runtime.New.callOnly(fr, fr.types.ToRuntime(t), size)[0] - return fr.builder.CreateBitCast(malloc, llvm.PointerType(fr.types.ToLLVM(t), 0), "") -} - -func (fr *frame) memsetZero(ptr llvm.Value, size llvm.Value) { - memset := fr.runtime.memset - ptr = fr.builder.CreateBitCast(ptr, llvm.PointerType(llvm.Int8Type(), 0), "") - fill := llvm.ConstNull(llvm.Int8Type()) - size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "") - isvolatile := llvm.ConstNull(llvm.Int1Type()) - fr.builder.CreateCall(memset, []llvm.Value{ptr, fill, size, isvolatile}, "") -} - -func (fr *frame) memcpy(dest llvm.Value, src llvm.Value, size llvm.Value) { - memcpy := fr.runtime.memcpy - dest = fr.builder.CreateBitCast(dest, llvm.PointerType(llvm.Int8Type(), 0), "") - src = fr.builder.CreateBitCast(src, llvm.PointerType(llvm.Int8Type(), 0), "") - size = fr.createZExtOrTrunc(size, fr.target.IntPtrType(), "") - isvolatile := llvm.ConstNull(llvm.Int1Type()) - fr.builder.CreateCall(memcpy, []llvm.Value{dest, src, size, isvolatile}, "") -} - -func (fr *frame) returnAddress(level uint64) llvm.Value { - returnaddress := fr.runtime.returnaddress - levelValue := llvm.ConstInt(llvm.Int32Type(), level, false) - return fr.builder.CreateCall(returnaddress, []llvm.Value{levelValue}, "") -} diff --git a/llgo/irgen/slice.go b/llgo/irgen/slice.go deleted file mode 100644 index f987155fcf8f1344d27719109af21b8157e246bc..0000000000000000000000000000000000000000 --- a/llgo/irgen/slice.go +++ /dev/null @@ -1,105 +0,0 @@ -//===- slice.go - IR generation for slices --------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for slices. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// makeSlice allocates a new slice with the optional length and capacity, -// initialising its contents to their zero values. -func (fr *frame) makeSlice(sliceType types.Type, length, capacity *govalue) *govalue { - length = fr.convert(length, types.Typ[types.Uintptr]) - capacity = fr.convert(capacity, types.Typ[types.Uintptr]) - runtimeType := fr.types.ToRuntime(sliceType) - llslice := fr.runtime.makeSlice.call(fr, runtimeType, length.value, capacity.value) - return newValue(llslice[0], sliceType) -} - -func (fr *frame) slice(x llvm.Value, xtyp types.Type, low, high, max llvm.Value) llvm.Value { - if !low.IsNil() { - low = fr.createZExtOrTrunc(low, fr.types.inttype, "") - } else { - low = llvm.ConstNull(fr.types.inttype) - } - if !high.IsNil() { - high = fr.createZExtOrTrunc(high, fr.types.inttype, "") - } - if !max.IsNil() { - max = fr.createZExtOrTrunc(max, fr.types.inttype, "") - } - - var arrayptr, arraylen, arraycap llvm.Value - var elemtyp types.Type - var errcode uint64 - switch typ := xtyp.Underlying().(type) { - case *types.Pointer: // *array - errcode = gccgoRuntimeErrorARRAY_SLICE_OUT_OF_BOUNDS - arraytyp := typ.Elem().Underlying().(*types.Array) - elemtyp = arraytyp.Elem() - arrayptr = x - arrayptr = fr.builder.CreateBitCast(arrayptr, llvm.PointerType(llvm.Int8Type(), 0), "") - arraylen = llvm.ConstInt(fr.llvmtypes.inttype, uint64(arraytyp.Len()), false) - arraycap = arraylen - case *types.Slice: - errcode = gccgoRuntimeErrorSLICE_SLICE_OUT_OF_BOUNDS - elemtyp = typ.Elem() - arrayptr = fr.builder.CreateExtractValue(x, 0, "") - arraylen = fr.builder.CreateExtractValue(x, 1, "") - arraycap = fr.builder.CreateExtractValue(x, 2, "") - case *types.Basic: - if high.IsNil() { - high = llvm.ConstAllOnes(fr.types.inttype) // -1 - } - result := fr.runtime.stringSlice.call(fr, x, low, high) - return result[0] - default: - panic("unimplemented") - } - if high.IsNil() { - high = arraylen - } - if max.IsNil() { - max = arraycap - } - - // Bounds checking: 0 <= low <= high <= max <= cap - zero := llvm.ConstNull(fr.types.inttype) - l0 := fr.builder.CreateICmp(llvm.IntSLT, low, zero, "") - hl := fr.builder.CreateICmp(llvm.IntSLT, high, low, "") - mh := fr.builder.CreateICmp(llvm.IntSLT, max, high, "") - cm := fr.builder.CreateICmp(llvm.IntSLT, arraycap, max, "") - - cond := fr.builder.CreateOr(l0, hl, "") - cond = fr.builder.CreateOr(cond, mh, "") - cond = fr.builder.CreateOr(cond, cm, "") - - fr.condBrRuntimeError(cond, errcode) - - slicelen := fr.builder.CreateSub(high, low, "") - slicecap := fr.builder.CreateSub(max, low, "") - - elemsize := llvm.ConstInt(fr.llvmtypes.inttype, uint64(fr.llvmtypes.Sizeof(elemtyp)), false) - offset := fr.builder.CreateMul(low, elemsize, "") - - sliceptr := fr.builder.CreateInBoundsGEP(arrayptr, []llvm.Value{offset}, "") - - llslicetyp := fr.llvmtypes.sliceBackendType().ToLLVM(fr.llvmtypes.ctx) - sliceValue := llvm.Undef(llslicetyp) - sliceValue = fr.builder.CreateInsertValue(sliceValue, sliceptr, 0, "") - sliceValue = fr.builder.CreateInsertValue(sliceValue, slicelen, 1, "") - sliceValue = fr.builder.CreateInsertValue(sliceValue, slicecap, 2, "") - - return sliceValue -} diff --git a/llgo/irgen/ssa.go b/llgo/irgen/ssa.go deleted file mode 100644 index ed45e2c4dad947be0ef87e1a17092c6aa3760ab5..0000000000000000000000000000000000000000 --- a/llgo/irgen/ssa.go +++ /dev/null @@ -1,1342 +0,0 @@ -//===- ssa.go - IR generation from go/ssa ---------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements the top-level LLVM IR generation from go/ssa form. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "fmt" - "go/ast" - "go/token" - "os" - "sort" - - "llvm.org/llgo/ssaopt" - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/ssa/ssautil" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// A globalInit is used to temporarily store a global's initializer until -// we are ready to build it. -type globalInit struct { - val llvm.Value - elems []globalInit -} - -func (gi *globalInit) update(typ llvm.Type, indices []uint32, val llvm.Value) { - if len(indices) == 0 { - gi.val = val - return - } - - if gi.val.C != nil { - gi.val = llvm.ConstInsertValue(gi.val, val, indices) - } - - tk := typ.TypeKind() - - if len(gi.elems) == 0 { - switch tk { - case llvm.StructTypeKind: - gi.elems = make([]globalInit, typ.StructElementTypesCount()) - case llvm.ArrayTypeKind: - gi.elems = make([]globalInit, typ.ArrayLength()) - default: - panic("unexpected type") - } - } - - var eltyp llvm.Type - switch tk { - case llvm.StructTypeKind: - eltyp = typ.StructElementTypes()[indices[0]] - case llvm.ArrayTypeKind: - eltyp = typ.ElementType() - default: - panic("unexpected type") - } - - gi.elems[indices[0]].update(eltyp, indices[1:], val) -} - -func (gi *globalInit) build(typ llvm.Type) llvm.Value { - if gi.val.C != nil { - return gi.val - } - if len(gi.elems) == 0 { - return llvm.ConstNull(typ) - } - - switch typ.TypeKind() { - case llvm.StructTypeKind: - eltypes := typ.StructElementTypes() - elems := make([]llvm.Value, len(eltypes)) - for i, eltyp := range eltypes { - elems[i] = gi.elems[i].build(eltyp) - } - return llvm.ConstStruct(elems, false) - case llvm.ArrayTypeKind: - eltyp := typ.ElementType() - elems := make([]llvm.Value, len(gi.elems)) - for i := range gi.elems { - elems[i] = gi.elems[i].build(eltyp) - } - return llvm.ConstArray(eltyp, elems) - default: - panic("unexpected type") - } -} - -type unit struct { - *compiler - pkg *ssa.Package - globals map[ssa.Value]llvm.Value - globalInits map[llvm.Value]*globalInit - - // funcDescriptors maps *ssa.Functions to function descriptors, - // the first-class representation of functions. - funcDescriptors map[*ssa.Function]llvm.Value - - // undefinedFuncs contains functions that have been resolved - // (declared) but not defined. - undefinedFuncs map[*ssa.Function]bool - - gcRoots []llvm.Value -} - -func newUnit(c *compiler, pkg *ssa.Package) *unit { - u := &unit{ - compiler: c, - pkg: pkg, - globals: make(map[ssa.Value]llvm.Value), - globalInits: make(map[llvm.Value]*globalInit), - funcDescriptors: make(map[*ssa.Function]llvm.Value), - undefinedFuncs: make(map[*ssa.Function]bool), - } - return u -} - -type byMemberName []ssa.Member - -func (ms byMemberName) Len() int { return len(ms) } -func (ms byMemberName) Swap(i, j int) { - ms[i], ms[j] = ms[j], ms[i] -} -func (ms byMemberName) Less(i, j int) bool { - return ms[i].Name() < ms[j].Name() -} - -type byFunctionString []*ssa.Function - -func (fns byFunctionString) Len() int { return len(fns) } -func (fns byFunctionString) Swap(i, j int) { - fns[i], fns[j] = fns[j], fns[i] -} -func (fns byFunctionString) Less(i, j int) bool { - return fns[i].String() < fns[j].String() -} - -// Emit functions in order of their fully qualified names. This is so that a -// bootstrap build can be verified by comparing the stage2 and stage3 binaries. -func (u *unit) defineFunctionsInOrder(functions map[*ssa.Function]bool) { - fns := []*ssa.Function{} - for f, _ := range functions { - fns = append(fns, f) - } - sort.Sort(byFunctionString(fns)) - for _, f := range fns { - u.defineFunction(f) - } -} - -// translatePackage translates an *ssa.Package into an LLVM module, and returns -// the translation unit information. -func (u *unit) translatePackage(pkg *ssa.Package) { - ms := make([]ssa.Member, len(pkg.Members)) - i := 0 - for _, m := range pkg.Members { - ms[i] = m - i++ - } - - sort.Sort(byMemberName(ms)) - - // Initialize global storage and type descriptors for this package. - // We must create globals regardless of whether they're referenced, - // hence the duplication in frame.value. - for _, m := range ms { - switch v := m.(type) { - case *ssa.Global: - elemtyp := deref(v.Type()) - llelemtyp := u.llvmtypes.ToLLVM(elemtyp) - vname := u.types.mc.mangleGlobalName(v) - global := llvm.AddGlobal(u.module.Module, llelemtyp, vname) - if !v.Object().Exported() { - global.SetLinkage(llvm.InternalLinkage) - } - u.addGlobal(global, elemtyp) - global = llvm.ConstBitCast(global, u.llvmtypes.ToLLVM(v.Type())) - u.globals[v] = global - case *ssa.Type: - u.types.getTypeDescriptorPointer(v.Type()) - } - } - - // Define functions. - u.defineFunctionsInOrder(ssautil.AllFunctions(pkg.Prog)) - - // Emit initializers for type descriptors, which may trigger - // the resolution of additional functions. - u.types.emitTypeDescInitializers() - - // Define remaining functions that were resolved during - // runtime type mapping, but not defined. - u.defineFunctionsInOrder(u.undefinedFuncs) - - // Set initializers for globals. - for global, init := range u.globalInits { - initval := init.build(global.Type().ElementType()) - global.SetInitializer(initval) - } -} - -func (u *unit) addGlobal(global llvm.Value, ty types.Type) { - u.globalInits[global] = new(globalInit) - - if hasPointers(ty) { - global = llvm.ConstBitCast(global, llvm.PointerType(llvm.Int8Type(), 0)) - size := llvm.ConstInt(u.types.inttype, uint64(u.types.Sizeof(ty)), false) - root := llvm.ConstStruct([]llvm.Value{global, size}, false) - u.gcRoots = append(u.gcRoots, root) - } -} - -// ResolveMethod implements MethodResolver.ResolveMethod. -func (u *unit) ResolveMethod(s *types.Selection) *govalue { - m := u.pkg.Prog.Method(s) - llfn := u.resolveFunctionGlobal(m) - llfn = llvm.ConstBitCast(llfn, llvm.PointerType(llvm.Int8Type(), 0)) - return newValue(llfn, m.Signature) -} - -// resolveFunctionDescriptorGlobal returns a reference to the LLVM global -// storing the function's descriptor. -func (u *unit) resolveFunctionDescriptorGlobal(f *ssa.Function) llvm.Value { - llfd, ok := u.funcDescriptors[f] - if !ok { - name := u.types.mc.mangleFunctionName(f) + "$descriptor" - llfd = llvm.AddGlobal(u.module.Module, llvm.PointerType(llvm.Int8Type(), 0), name) - llfd.SetGlobalConstant(true) - u.funcDescriptors[f] = llfd - } - return llfd -} - -// resolveFunctionDescriptor returns a function's -// first-class value representation. -func (u *unit) resolveFunctionDescriptor(f *ssa.Function) *govalue { - llfd := u.resolveFunctionDescriptorGlobal(f) - llfd = llvm.ConstBitCast(llfd, llvm.PointerType(llvm.Int8Type(), 0)) - return newValue(llfd, f.Signature) -} - -// resolveFunctionGlobal returns an llvm.Value for a function global. -func (u *unit) resolveFunctionGlobal(f *ssa.Function) llvm.Value { - if v, ok := u.globals[f]; ok { - return v - } - name := u.types.mc.mangleFunctionName(f) - // It's possible that the function already exists in the module; - // for example, if it's a runtime intrinsic that the compiler - // has already referenced. - llvmFunction := u.module.Module.NamedFunction(name) - if llvmFunction.IsNil() { - fti := u.llvmtypes.getSignatureInfo(f.Signature) - llvmFunction = fti.declare(u.module.Module, name) - u.undefinedFuncs[f] = true - } - u.globals[f] = llvmFunction - return llvmFunction -} - -func (u *unit) getFunctionLinkage(f *ssa.Function) llvm.Linkage { - switch { - case f.Pkg == nil: - // Synthetic functions outside packages may appear in multiple packages. - return llvm.LinkOnceODRLinkage - - case f.Parent() != nil: - // Anonymous. - return llvm.InternalLinkage - - case f.Signature.Recv() == nil && !ast.IsExported(f.Name()) && - !(f.Name() == "main" && f.Pkg.Object.Path() == "main") && - f.Name() != "init": - // Unexported methods may be referenced as part of an interface method - // table in another package. TODO(pcc): detect when this cannot happen. - return llvm.InternalLinkage - - default: - return llvm.ExternalLinkage - } -} - -func (u *unit) defineFunction(f *ssa.Function) { - // Only define functions from this package, or synthetic - // wrappers (which do not have a package). - if f.Pkg != nil && f.Pkg != u.pkg { - return - } - - llfn := u.resolveFunctionGlobal(f) - linkage := u.getFunctionLinkage(f) - - isMethod := f.Signature.Recv() != nil - - // Methods cannot be referred to via a descriptor. - if !isMethod { - llfd := u.resolveFunctionDescriptorGlobal(f) - llfd.SetInitializer(llvm.ConstBitCast(llfn, llvm.PointerType(llvm.Int8Type(), 0))) - llfd.SetLinkage(linkage) - } - - // We only need to emit a descriptor for functions without bodies. - if len(f.Blocks) == 0 { - return - } - - ssaopt.LowerAllocsToStack(f) - - if u.DumpSSA { - f.WriteTo(os.Stderr) - } - - fr := newFrame(u, llfn) - defer fr.dispose() - fr.addCommonFunctionAttrs(fr.function) - fr.function.SetLinkage(linkage) - - fr.logf("Define function: %s @ %s", f.String(), fr.pkg.Prog.Fset.Position(f.Pos())) - fti := u.llvmtypes.getSignatureInfo(f.Signature) - delete(u.undefinedFuncs, f) - fr.retInf = fti.retInf - - // Push the compile unit and function onto the debug context. - if u.GenerateDebug { - u.debug.PushFunction(fr.function, f.Signature, f.Pos()) - defer u.debug.PopFunction() - u.debug.SetLocation(fr.builder, f.Pos()) - } - - // If a function calls recover, we create a separate function to - // hold the real function, and this function calls __go_can_recover - // and bridges to it. - if callsRecover(f) { - fr = fr.bridgeRecoverFunc(fr.function, fti) - } - - fr.blocks = make([]llvm.BasicBlock, len(f.Blocks)) - fr.lastBlocks = make([]llvm.BasicBlock, len(f.Blocks)) - for i, block := range f.Blocks { - fr.blocks[i] = llvm.AddBasicBlock(fr.function, fmt.Sprintf(".%d.%s", i, block.Comment)) - } - fr.builder.SetInsertPointAtEnd(fr.blocks[0]) - fr.transformSwitches(f) - - prologueBlock := llvm.InsertBasicBlock(fr.blocks[0], "prologue") - fr.builder.SetInsertPointAtEnd(prologueBlock) - - for i, param := range f.Params { - llparam := fti.argInfos[i].decode(llvm.GlobalContext(), fr.builder, fr.builder) - if isMethod && i == 0 { - if _, ok := param.Type().Underlying().(*types.Pointer); !ok { - llparam = fr.builder.CreateBitCast(llparam, llvm.PointerType(fr.types.ToLLVM(param.Type()), 0), "") - llparam = fr.builder.CreateLoad(llparam, "") - } - } - fr.env[param] = newValue(llparam, param.Type()) - } - - // Load closure, extract free vars. - if len(f.FreeVars) > 0 { - for _, fv := range f.FreeVars { - fr.env[fv] = newValue(llvm.ConstNull(u.llvmtypes.ToLLVM(fv.Type())), fv.Type()) - } - elemTypes := make([]llvm.Type, len(f.FreeVars)+1) - elemTypes[0] = llvm.PointerType(llvm.Int8Type(), 0) // function pointer - for i, fv := range f.FreeVars { - elemTypes[i+1] = u.llvmtypes.ToLLVM(fv.Type()) - } - structType := llvm.StructType(elemTypes, false) - closure := fr.function.Param(fti.chainIndex) - closure = fr.builder.CreateBitCast(closure, llvm.PointerType(structType, 0), "") - for i, fv := range f.FreeVars { - ptr := fr.builder.CreateStructGEP(closure, i+1, "") - ptr = fr.builder.CreateLoad(ptr, "") - fr.env[fv] = newValue(ptr, fv.Type()) - } - } - - // Allocate stack space for locals in the prologue block. - for _, local := range f.Locals { - typ := fr.llvmtypes.ToLLVM(deref(local.Type())) - alloca := fr.builder.CreateAlloca(typ, local.Comment) - fr.memsetZero(alloca, llvm.SizeOf(typ)) - bcalloca := fr.builder.CreateBitCast(alloca, llvm.PointerType(llvm.Int8Type(), 0), "") - value := newValue(bcalloca, local.Type()) - fr.env[local] = value - } - - // If the function contains any defers, we must first create - // an unwind block. We can short-circuit the check for defers with - // f.Recover != nil. - if f.Recover != nil || hasDefer(f) { - fr.unwindBlock = llvm.AddBasicBlock(fr.function, "unwind") - fr.frameptr = fr.builder.CreateAlloca(llvm.Int8Type(), "") - } - - // Keep track of the block into which we need to insert the call - // to __go_register_gc_roots. This needs to be inserted after the - // init guard check under the llgo ABI. - var registerGcBlock llvm.BasicBlock - - // If this is the "init" function, emit the init guard check and - // enable init-specific optimizations. - if !isMethod && f.Name() == "init" { - registerGcBlock = fr.emitInitPrologue() - fr.isInit = true - } - - fr.builder.CreateBr(fr.blocks[0]) - fr.allocaBuilder.SetInsertPointBefore(prologueBlock.FirstInstruction()) - - for _, block := range f.DomPreorder() { - llblock := fr.blocks[block.Index] - if llblock.IsNil() { - continue - } - fr.translateBlock(block, llblock) - } - - fr.fixupPhis() - - if !fr.unwindBlock.IsNil() { - fr.setupUnwindBlock(f.Recover) - } - - // The init function needs to register the GC roots first. We do this - // after generating code for it because allocations may have caused - // additional GC roots to be created. - if fr.isInit { - fr.builder.SetInsertPointBefore(registerGcBlock.FirstInstruction()) - fr.registerGcRoots() - } -} - -type pendingPhi struct { - ssa *ssa.Phi - llvm llvm.Value -} - -type frame struct { - *unit - function llvm.Value - builder, allocaBuilder llvm.Builder - retInf retInfo - blocks []llvm.BasicBlock - lastBlocks []llvm.BasicBlock - runtimeErrorBlocks [gccgoRuntimeErrorCount]llvm.BasicBlock - unwindBlock llvm.BasicBlock - frameptr llvm.Value - env map[ssa.Value]*govalue - ptr map[ssa.Value]llvm.Value - tuples map[ssa.Value][]*govalue - phis []pendingPhi - canRecover llvm.Value - isInit bool -} - -func newFrame(u *unit, fn llvm.Value) *frame { - return &frame{ - unit: u, - function: fn, - builder: llvm.GlobalContext().NewBuilder(), - allocaBuilder: llvm.GlobalContext().NewBuilder(), - env: make(map[ssa.Value]*govalue), - ptr: make(map[ssa.Value]llvm.Value), - tuples: make(map[ssa.Value][]*govalue), - } -} - -func (fr *frame) dispose() { - fr.builder.Dispose() - fr.allocaBuilder.Dispose() -} - -// emitInitPrologue emits the init-specific function prologue (guard check and -// initialization of dependent packages under the llgo native ABI), and returns -// the basic block into which the GC registration call should be emitted. -func (fr *frame) emitInitPrologue() llvm.BasicBlock { - if fr.GccgoABI { - return fr.builder.GetInsertBlock() - } - - initGuard := llvm.AddGlobal(fr.module.Module, llvm.Int1Type(), "init$guard") - initGuard.SetLinkage(llvm.InternalLinkage) - initGuard.SetInitializer(llvm.ConstNull(llvm.Int1Type())) - - returnBlock := llvm.AddBasicBlock(fr.function, "") - initBlock := llvm.AddBasicBlock(fr.function, "") - - initGuardVal := fr.builder.CreateLoad(initGuard, "") - fr.builder.CreateCondBr(initGuardVal, returnBlock, initBlock) - - fr.builder.SetInsertPointAtEnd(returnBlock) - fr.builder.CreateRetVoid() - - fr.builder.SetInsertPointAtEnd(initBlock) - fr.builder.CreateStore(llvm.ConstInt(llvm.Int1Type(), 1, false), initGuard) - int8ptr := llvm.PointerType(fr.types.ctx.Int8Type(), 0) - ftyp := llvm.FunctionType(llvm.VoidType(), []llvm.Type{int8ptr}, false) - for _, pkg := range fr.pkg.Object.Imports() { - initname := ManglePackagePath(pkg.Path()) + "..import" - initfn := fr.module.Module.NamedFunction(initname) - if initfn.IsNil() { - initfn = llvm.AddFunction(fr.module.Module, initname, ftyp) - } - args := []llvm.Value{llvm.Undef(int8ptr)} - fr.builder.CreateCall(initfn, args, "") - } - - return initBlock -} - -// bridgeRecoverFunc creates a function that may call recover(), and creates -// a call to it from the current frame. The created function will be called -// with a boolean parameter that indicates whether it may call recover(). -// -// The created function will have the same name as the current frame's function -// with "$recover" appended, having the same return types and parameters with -// an additional boolean parameter appended. -// -// A new frame will be returned for the newly created function. -func (fr *frame) bridgeRecoverFunc(llfn llvm.Value, fti functionTypeInfo) *frame { - // The bridging function must not be inlined, or the return address - // may not correspond to the source function. - attrKind := llvm.AttributeKindID("noinline") - noInlineAttr := fr.module.Context().CreateEnumAttribute(attrKind, 0) - llfn.AddFunctionAttr(noInlineAttr) - - // Call __go_can_recover, passing in the function's return address. - entry := llvm.AddBasicBlock(llfn, "entry") - fr.builder.SetInsertPointAtEnd(entry) - canRecover := fr.runtime.canRecover.call(fr, fr.returnAddress(0))[0] - returnType := fti.functionType.ReturnType() - argTypes := fti.functionType.ParamTypes() - argTypes = append(argTypes, canRecover.Type()) - - // Create and call the $recover function. - ftiRecover := fti - ftiRecover.functionType = llvm.FunctionType(returnType, argTypes, false) - llfnRecover := ftiRecover.declare(fr.module.Module, llfn.Name()+"$recover") - fr.addCommonFunctionAttrs(llfnRecover) - llfnRecover.SetLinkage(llvm.InternalLinkage) - args := make([]llvm.Value, len(argTypes)-1, len(argTypes)) - for i := range args { - args[i] = llfn.Param(i) - } - args = append(args, canRecover) - result := fr.builder.CreateCall(llfnRecover, args, "") - if returnType.TypeKind() == llvm.VoidTypeKind { - fr.builder.CreateRetVoid() - } else { - fr.builder.CreateRet(result) - } - - // The $recover function must condition calls to __go_recover on - // the result of __go_can_recover passed in as an argument. - fr = newFrame(fr.unit, llfnRecover) - fr.retInf = ftiRecover.retInf - fr.canRecover = fr.function.Param(len(argTypes) - 1) - return fr -} - -func (fr *frame) registerGcRoots() { - if len(fr.gcRoots) != 0 { - rootty := fr.gcRoots[0].Type() - roots := append(fr.gcRoots, llvm.ConstNull(rootty)) - rootsarr := llvm.ConstArray(rootty, roots) - rootsstruct := llvm.ConstStruct([]llvm.Value{llvm.ConstNull(llvm.PointerType(llvm.Int8Type(), 0)), rootsarr}, false) - - rootsglobal := llvm.AddGlobal(fr.module.Module, rootsstruct.Type(), "") - rootsglobal.SetInitializer(rootsstruct) - rootsglobal.SetLinkage(llvm.InternalLinkage) - fr.runtime.registerGcRoots.callOnly(fr, llvm.ConstBitCast(rootsglobal, llvm.PointerType(llvm.Int8Type(), 0))) - } -} - -func (fr *frame) fixupPhis() { - for _, phi := range fr.phis { - values := make([]llvm.Value, len(phi.ssa.Edges)) - blocks := make([]llvm.BasicBlock, len(phi.ssa.Edges)) - block := phi.ssa.Block() - for i, edge := range phi.ssa.Edges { - values[i] = fr.llvmvalue(edge) - blocks[i] = fr.lastBlock(block.Preds[i]) - } - phi.llvm.AddIncoming(values, blocks) - } -} - -func (fr *frame) createLandingPad(cleanup bool) llvm.Value { - fr.function.SetPersonality(fr.runtime.gccgoPersonality) - lp := fr.builder.CreateLandingPad(fr.runtime.gccgoExceptionType, 0, "") - if cleanup { - lp.SetCleanup(true) - } else { - lp.AddClause(llvm.ConstNull(llvm.PointerType(llvm.Int8Type(), 0))) - } - return lp -} - -// Runs defers. If a defer panics, check for recovers in later defers. -func (fr *frame) runDefers() { - loopbb := llvm.AddBasicBlock(fr.function, "") - fr.builder.CreateBr(loopbb) - - retrylpad := llvm.AddBasicBlock(fr.function, "") - fr.builder.SetInsertPointAtEnd(retrylpad) - fr.createLandingPad(false) - fr.runtime.checkDefer.callOnly(fr, fr.frameptr) - fr.builder.CreateBr(loopbb) - - fr.builder.SetInsertPointAtEnd(loopbb) - fr.runtime.undefer.invoke(fr, retrylpad, fr.frameptr) -} - -func (fr *frame) setupUnwindBlock(rec *ssa.BasicBlock) { - var recoverbb llvm.BasicBlock - if rec != nil { - recoverbb = fr.blocks[rec.Index] - } else { - recoverbb = llvm.AddBasicBlock(fr.function, "recover") - fr.builder.SetInsertPointAtEnd(recoverbb) - fr.builder.CreateUnreachable() - } - - checkunwindbb := llvm.AddBasicBlock(fr.function, "") - fr.builder.SetInsertPointAtEnd(checkunwindbb) - exc := fr.createLandingPad(true) - fr.runDefers() - - frame := fr.builder.CreateLoad(fr.frameptr, "") - shouldresume := fr.builder.CreateIsNull(frame, "") - - resumebb := llvm.AddBasicBlock(fr.function, "") - fr.builder.CreateCondBr(shouldresume, resumebb, recoverbb) - - fr.builder.SetInsertPointAtEnd(resumebb) - fr.builder.CreateResume(exc) - - fr.builder.SetInsertPointAtEnd(fr.unwindBlock) - fr.createLandingPad(false) - fr.runtime.checkDefer.invoke(fr, checkunwindbb, fr.frameptr) - fr.runDefers() - fr.builder.CreateBr(recoverbb) -} - -func (fr *frame) translateBlock(b *ssa.BasicBlock, llb llvm.BasicBlock) { - fr.builder.SetInsertPointAtEnd(llb) - for _, instr := range b.Instrs { - fr.instruction(instr) - } - fr.lastBlocks[b.Index] = fr.builder.GetInsertBlock() -} - -func (fr *frame) block(b *ssa.BasicBlock) llvm.BasicBlock { - return fr.blocks[b.Index] -} - -func (fr *frame) lastBlock(b *ssa.BasicBlock) llvm.BasicBlock { - return fr.lastBlocks[b.Index] -} - -func (fr *frame) value(v ssa.Value) (result *govalue) { - switch v := v.(type) { - case nil: - return nil - case *ssa.Function: - return fr.resolveFunctionDescriptor(v) - case *ssa.Const: - return fr.newValueFromConst(v.Value, v.Type()) - case *ssa.Global: - if g, ok := fr.globals[v]; ok { - return newValue(g, v.Type()) - } - // Create an external global. Globals for this package are defined - // on entry to translatePackage, and have initialisers. - llelemtyp := fr.llvmtypes.ToLLVM(deref(v.Type())) - vname := fr.types.mc.mangleGlobalName(v) - llglobal := llvm.AddGlobal(fr.module.Module, llelemtyp, vname) - llglobal = llvm.ConstBitCast(llglobal, fr.llvmtypes.ToLLVM(v.Type())) - fr.globals[v] = llglobal - return newValue(llglobal, v.Type()) - } - if value, ok := fr.env[v]; ok { - return value - } - - panic(fmt.Errorf("Instruction %q not visited yet", v.Name())) -} - -func (fr *frame) llvmvalue(v ssa.Value) llvm.Value { - if gv := fr.value(v); gv != nil { - return gv.value - } else { - return llvm.Value{nil} - } -} - -func (fr *frame) isNonNull(v ssa.Value) bool { - switch v.(type) { - case - // Globals have a fixed (non-nil) address. - *ssa.Global, - // The language does not specify what happens if an allocation fails. - *ssa.Alloc, - // These have already been nil checked. - *ssa.FieldAddr, *ssa.IndexAddr: - return true - default: - return false - } -} - -func (fr *frame) nilCheck(v ssa.Value, llptr llvm.Value) { - if !fr.isNonNull(v) { - ptrnull := fr.builder.CreateIsNull(llptr, "") - fr.condBrRuntimeError(ptrnull, gccgoRuntimeErrorNIL_DEREFERENCE) - } -} - -func (fr *frame) canAvoidElementLoad(ptr ssa.Value) bool { - for _, ref := range *ptr.Referrers() { - switch ref := ref.(type) { - case *ssa.Field: - case *ssa.Index: - if ref.X != ptr { - return false - } - // ok - default: - return false - } - } - - return true -} - -// If this value is sufficiently large, look through referrers to see if we can -// avoid a load. -func (fr *frame) canAvoidLoad(instr *ssa.UnOp, op llvm.Value) bool { - if fr.types.Sizeof(instr.Type()) < 2*fr.types.Sizeof(types.Typ[types.Int]) { - // Don't bother with small values. - return false - } - - // Keep track of whether our pointer may escape. We conservatively assume - // that MakeInterfaces will escape. - esc := false - - // We only know how to avoid loads if they are used to create an interface - // or read an element of the structure. If we see any other referrer, abort. - for _, ref := range *instr.Referrers() { - switch ref := ref.(type) { - case *ssa.MakeInterface: - esc = true - case *ssa.Field: - case *ssa.Index: - if ref.X != instr { - // This should never happen, as indices are always of type int - // and we don't bother with values smaller than 2*sizeof(int). - panic("impossible") - } - // ok - default: - return false - } - } - - var opcopy llvm.Value - if esc { - opcopy = fr.createTypeMalloc(instr.Type()) - } else { - opcopy = fr.allocaBuilder.CreateAlloca(fr.types.ToLLVM(instr.Type()), "") - } - fr.memcpy(opcopy, op, llvm.ConstInt(fr.types.inttype, uint64(fr.types.Sizeof(instr.Type())), false)) - - fr.ptr[instr] = opcopy - return true -} - -// Return true iff we think it might be beneficial to turn this alloc instruction -// into a statically allocated global. -// Precondition: we are compiling the init function. -func (fr *frame) shouldStaticallyAllocate(alloc *ssa.Alloc) bool { - // First, see if the allocated type is an array or struct, and if so determine - // the number of elements in the type. If the type is anything else, we - // statically allocate unconditionally. - var numElems int64 - switch ty := deref(alloc.Type()).Underlying().(type) { - case *types.Array: - numElems = ty.Len() - case *types.Struct: - numElems = int64(ty.NumFields()) - default: - return true - } - - // We treat the number of referrers to the alloc instruction as a rough - // proxy for the number of elements initialized. If the data structure - // is densely initialized (> 1/4 elements initialized), enable the - // optimization. - return int64(len(*alloc.Referrers()))*4 > numElems -} - -// If val is a constant and addr refers to a global variable which is defined in -// this module or an element thereof, simulate the effect of storing val at addr -// in the global variable's initializer and return true, otherwise return false. -// Precondition: we are compiling the init function. -func (fr *frame) maybeStoreInInitializer(val, addr llvm.Value) bool { - if val.IsAConstant().IsNil() { - return false - } - - if !addr.IsAConstantExpr().IsNil() && addr.OperandsCount() >= 2 && - // TODO(pcc): Explicitly check that this is a constant GEP. - // I don't think there are any other kinds of constantexpr which - // satisfy the conditions we test for here, so this is probably safe. - !addr.Operand(0).IsAGlobalVariable().IsNil() && - addr.Operand(1).IsNull() { - gv := addr.Operand(0) - globalInit, ok := fr.globalInits[gv] - if !ok { - return false - } - indices := make([]uint32, addr.OperandsCount()-2) - for i := range indices { - op := addr.Operand(i + 2) - if op.IsAConstantInt().IsNil() { - return false - } - indices[i] = uint32(op.ZExtValue()) - } - globalInit.update(gv.Type().ElementType(), indices, val) - return true - } else if !addr.IsAGlobalVariable().IsNil() { - if globalInit, ok := fr.globalInits[addr]; ok { - globalInit.update(addr.Type().ElementType(), nil, val) - return true - } - return false - } else { - return false - } -} - -func (fr *frame) instruction(instr ssa.Instruction) { - fr.logf("[%T] %v @ %s\n", instr, instr, fr.pkg.Prog.Fset.Position(instr.Pos())) - if fr.GenerateDebug { - fr.debug.SetLocation(fr.builder, instr.Pos()) - } - - switch instr := instr.(type) { - case *ssa.Alloc: - typ := deref(instr.Type()) - llvmtyp := fr.llvmtypes.ToLLVM(typ) - var value llvm.Value - if !instr.Heap { - value = fr.env[instr].value - fr.memsetZero(value, llvm.SizeOf(llvmtyp)) - } else if fr.isInit && fr.shouldStaticallyAllocate(instr) { - // If this is the init function and we think it may be beneficial, - // allocate memory statically in the object file rather than on the - // heap. This allows us to optimize constant stores into such - // variables as static initializations. - global := llvm.AddGlobal(fr.module.Module, llvmtyp, "") - global.SetLinkage(llvm.InternalLinkage) - fr.addGlobal(global, typ) - ptr := llvm.ConstBitCast(global, llvm.PointerType(llvm.Int8Type(), 0)) - fr.env[instr] = newValue(ptr, instr.Type()) - } else { - value = fr.createTypeMalloc(typ) - value.SetName(instr.Comment) - value = fr.builder.CreateBitCast(value, llvm.PointerType(llvm.Int8Type(), 0), "") - fr.env[instr] = newValue(value, instr.Type()) - } - - case *ssa.BinOp: - lhs, rhs := fr.value(instr.X), fr.value(instr.Y) - fr.env[instr] = fr.binaryOp(lhs, instr.Op, rhs) - - case *ssa.Call: - tuple := fr.callInstruction(instr) - if len(tuple) == 1 { - fr.env[instr] = tuple[0] - } else { - fr.tuples[instr] = tuple - } - - case *ssa.ChangeInterface: - x := fr.value(instr.X) - // The source type must be a non-empty interface, - // as ChangeInterface cannot fail (E2I may fail). - if instr.Type().Underlying().(*types.Interface).NumMethods() > 0 { - x = fr.changeInterface(x, instr.Type(), false) - } else { - x = fr.convertI2E(x) - } - fr.env[instr] = x - - case *ssa.ChangeType: - value := fr.llvmvalue(instr.X) - if _, ok := instr.Type().Underlying().(*types.Pointer); ok { - value = fr.builder.CreateBitCast(value, fr.llvmtypes.ToLLVM(instr.Type()), "") - } - fr.env[instr] = newValue(value, instr.Type()) - - case *ssa.Convert: - v := fr.value(instr.X) - fr.env[instr] = fr.convert(v, instr.Type()) - - case *ssa.Defer: - fn, arg := fr.createThunk(instr) - fr.runtime.Defer.call(fr, fr.frameptr, fn, arg) - - case *ssa.Extract: - var elem llvm.Value - if t, ok := fr.tuples[instr.Tuple]; ok { - elem = t[instr.Index].value - } else { - tuple := fr.llvmvalue(instr.Tuple) - elem = fr.builder.CreateExtractValue(tuple, instr.Index, instr.Name()) - } - elemtyp := instr.Type() - fr.env[instr] = newValue(elem, elemtyp) - - case *ssa.Field: - fieldtyp := instr.Type() - if p, ok := fr.ptr[instr.X]; ok { - field := fr.builder.CreateStructGEP(p, instr.Field, instr.Name()) - if fr.canAvoidElementLoad(instr) { - fr.ptr[instr] = field - } else { - fr.env[instr] = newValue(fr.builder.CreateLoad(field, ""), fieldtyp) - } - } else { - value := fr.llvmvalue(instr.X) - field := fr.builder.CreateExtractValue(value, instr.Field, instr.Name()) - fr.env[instr] = newValue(field, fieldtyp) - } - - case *ssa.FieldAddr: - ptr := fr.llvmvalue(instr.X) - fr.nilCheck(instr.X, ptr) - xtyp := instr.X.Type().Underlying().(*types.Pointer).Elem() - ptrtyp := llvm.PointerType(fr.llvmtypes.ToLLVM(xtyp), 0) - ptr = fr.builder.CreateBitCast(ptr, ptrtyp, "") - fieldptr := fr.builder.CreateStructGEP(ptr, instr.Field, instr.Name()) - fieldptr = fr.builder.CreateBitCast(fieldptr, llvm.PointerType(llvm.Int8Type(), 0), "") - fieldptrtyp := instr.Type() - fr.env[instr] = newValue(fieldptr, fieldptrtyp) - - case *ssa.Go: - fn, arg := fr.createThunk(instr) - fr.runtime.Go.call(fr, fn, arg) - - case *ssa.If: - cond := fr.llvmvalue(instr.Cond) - block := instr.Block() - trueBlock := fr.block(block.Succs[0]) - falseBlock := fr.block(block.Succs[1]) - cond = fr.builder.CreateTrunc(cond, llvm.Int1Type(), "") - fr.builder.CreateCondBr(cond, trueBlock, falseBlock) - - case *ssa.Index: - var arrayptr llvm.Value - - if ptr, ok := fr.ptr[instr.X]; ok { - arrayptr = ptr - } else { - array := fr.llvmvalue(instr.X) - arrayptr = fr.allocaBuilder.CreateAlloca(array.Type(), "") - - fr.builder.CreateStore(array, arrayptr) - } - index := fr.llvmvalue(instr.Index) - - arraytyp := instr.X.Type().Underlying().(*types.Array) - arraylen := llvm.ConstInt(fr.llvmtypes.inttype, uint64(arraytyp.Len()), false) - - // The index may not have been promoted to int (for example, if it - // came from a composite literal). - index = fr.createZExtOrTrunc(index, fr.types.inttype, "") - - // Bounds checking: 0 <= index < len - zero := llvm.ConstNull(fr.types.inttype) - i0 := fr.builder.CreateICmp(llvm.IntSLT, index, zero, "") - li := fr.builder.CreateICmp(llvm.IntSLE, arraylen, index, "") - - cond := fr.builder.CreateOr(i0, li, "") - - fr.condBrRuntimeError(cond, gccgoRuntimeErrorARRAY_INDEX_OUT_OF_BOUNDS) - - addr := fr.builder.CreateGEP(arrayptr, []llvm.Value{zero, index}, "") - if fr.canAvoidElementLoad(instr) { - fr.ptr[instr] = addr - } else { - fr.env[instr] = newValue(fr.builder.CreateLoad(addr, ""), instr.Type()) - } - - case *ssa.IndexAddr: - x := fr.llvmvalue(instr.X) - index := fr.llvmvalue(instr.Index) - var arrayptr, arraylen llvm.Value - var elemtyp types.Type - var errcode uint64 - switch typ := instr.X.Type().Underlying().(type) { - case *types.Slice: - elemtyp = typ.Elem() - arrayptr = fr.builder.CreateExtractValue(x, 0, "") - arraylen = fr.builder.CreateExtractValue(x, 1, "") - errcode = gccgoRuntimeErrorSLICE_INDEX_OUT_OF_BOUNDS - case *types.Pointer: // *array - arraytyp := typ.Elem().Underlying().(*types.Array) - elemtyp = arraytyp.Elem() - fr.nilCheck(instr.X, x) - arrayptr = x - arraylen = llvm.ConstInt(fr.llvmtypes.inttype, uint64(arraytyp.Len()), false) - errcode = gccgoRuntimeErrorARRAY_INDEX_OUT_OF_BOUNDS - } - - // The index may not have been promoted to int (for example, if it - // came from a composite literal). - index = fr.createZExtOrTrunc(index, fr.types.inttype, "") - - // Bounds checking: 0 <= index < len - zero := llvm.ConstNull(fr.types.inttype) - i0 := fr.builder.CreateICmp(llvm.IntSLT, index, zero, "") - li := fr.builder.CreateICmp(llvm.IntSLE, arraylen, index, "") - - cond := fr.builder.CreateOr(i0, li, "") - - fr.condBrRuntimeError(cond, errcode) - - ptrtyp := llvm.PointerType(fr.llvmtypes.ToLLVM(elemtyp), 0) - arrayptr = fr.builder.CreateBitCast(arrayptr, ptrtyp, "") - addr := fr.builder.CreateGEP(arrayptr, []llvm.Value{index}, "") - addr = fr.builder.CreateBitCast(addr, llvm.PointerType(llvm.Int8Type(), 0), "") - fr.env[instr] = newValue(addr, types.NewPointer(elemtyp)) - - case *ssa.Jump: - succ := instr.Block().Succs[0] - fr.builder.CreateBr(fr.block(succ)) - - case *ssa.Lookup: - x := fr.value(instr.X) - index := fr.value(instr.Index) - if isString(x.Type().Underlying()) { - fr.env[instr] = fr.stringIndex(x, index) - } else { - v, ok := fr.mapLookup(x, index) - if instr.CommaOk { - fr.tuples[instr] = []*govalue{v, ok} - } else { - fr.env[instr] = v - } - } - - case *ssa.MakeChan: - fr.env[instr] = fr.makeChan(instr.Type(), fr.value(instr.Size)) - - case *ssa.MakeClosure: - llfn := fr.resolveFunctionGlobal(instr.Fn.(*ssa.Function)) - llfn = llvm.ConstBitCast(llfn, llvm.PointerType(llvm.Int8Type(), 0)) - fn := newValue(llfn, instr.Fn.(*ssa.Function).Signature) - bindings := make([]*govalue, len(instr.Bindings)) - for i, binding := range instr.Bindings { - bindings[i] = fr.value(binding) - } - fr.env[instr] = fr.makeClosure(fn, bindings) - - case *ssa.MakeInterface: - // fr.ptr[instr.X] will be set if a pointer load was elided by canAvoidLoad - if ptr, ok := fr.ptr[instr.X]; ok { - fr.env[instr] = fr.makeInterfaceFromPointer(ptr, instr.X.Type(), instr.Type()) - } else { - receiver := fr.llvmvalue(instr.X) - fr.env[instr] = fr.makeInterface(receiver, instr.X.Type(), instr.Type()) - } - - case *ssa.MakeMap: - fr.env[instr] = fr.makeMap(instr.Type(), fr.value(instr.Reserve)) - - case *ssa.MakeSlice: - length := fr.value(instr.Len) - capacity := fr.value(instr.Cap) - fr.env[instr] = fr.makeSlice(instr.Type(), length, capacity) - - case *ssa.MapUpdate: - m := fr.value(instr.Map) - k := fr.value(instr.Key) - v := fr.value(instr.Value) - fr.mapUpdate(m, k, v) - - case *ssa.Next: - iter := fr.tuples[instr.Iter] - if instr.IsString { - fr.tuples[instr] = fr.stringIterNext(iter) - } else { - fr.tuples[instr] = fr.mapIterNext(iter) - } - - case *ssa.Panic: - arg := fr.value(instr.X) - fr.callPanic(arg, true) - - case *ssa.Phi: - typ := instr.Type() - phi := fr.builder.CreatePHI(fr.llvmtypes.ToLLVM(typ), instr.Comment) - fr.env[instr] = newValue(phi, typ) - fr.phis = append(fr.phis, pendingPhi{instr, phi}) - - case *ssa.Range: - x := fr.value(instr.X) - switch x.Type().Underlying().(type) { - case *types.Map: - fr.tuples[instr] = fr.mapIterInit(x) - case *types.Basic: // string - fr.tuples[instr] = fr.stringIterInit(x) - default: - panic(fmt.Sprintf("unhandled range for type %T", x.Type())) - } - - case *ssa.Return: - vals := make([]llvm.Value, len(instr.Results)) - for i, res := range instr.Results { - vals[i] = fr.llvmvalue(res) - } - fr.retInf.encode(llvm.GlobalContext(), fr.allocaBuilder, fr.builder, vals) - - case *ssa.RunDefers: - fr.runDefers() - - case *ssa.Select: - index, recvOk, recvElems := fr.chanSelect(instr) - tuple := append([]*govalue{index, recvOk}, recvElems...) - fr.tuples[instr] = tuple - - case *ssa.Send: - fr.chanSend(fr.value(instr.Chan), fr.value(instr.X)) - - case *ssa.Slice: - x := fr.llvmvalue(instr.X) - low := fr.llvmvalue(instr.Low) - high := fr.llvmvalue(instr.High) - max := fr.llvmvalue(instr.Max) - slice := fr.slice(x, instr.X.Type(), low, high, max) - fr.env[instr] = newValue(slice, instr.Type()) - - case *ssa.Store: - addr := fr.llvmvalue(instr.Addr) - value := fr.llvmvalue(instr.Val) - addr = fr.builder.CreateBitCast(addr, llvm.PointerType(value.Type(), 0), "") - // If this is the init function, see if we can simulate the effect - // of the store in a global's initializer, in which case we can avoid - // generating code for it. - if !fr.isInit || !fr.maybeStoreInInitializer(value, addr) { - fr.nilCheck(instr.Addr, addr) - fr.builder.CreateStore(value, addr) - } - - case *switchInstr: - fr.emitSwitch(instr) - - case *ssa.TypeAssert: - x := fr.value(instr.X) - if instr.CommaOk { - v, ok := fr.interfaceTypeCheck(x, instr.AssertedType) - fr.tuples[instr] = []*govalue{v, ok} - } else { - fr.env[instr] = fr.interfaceTypeAssert(x, instr.AssertedType) - } - - case *ssa.UnOp: - operand := fr.value(instr.X) - switch instr.Op { - case token.ARROW: - x, ok := fr.chanRecv(operand, instr.CommaOk) - if instr.CommaOk { - fr.tuples[instr] = []*govalue{x, ok} - } else { - fr.env[instr] = x - } - case token.MUL: - fr.nilCheck(instr.X, operand.value) - if !fr.canAvoidLoad(instr, operand.value) { - // The bitcast is necessary to handle recursive pointer loads. - llptr := fr.builder.CreateBitCast(operand.value, llvm.PointerType(fr.llvmtypes.ToLLVM(instr.Type()), 0), "") - fr.env[instr] = newValue(fr.builder.CreateLoad(llptr, ""), instr.Type()) - } - default: - fr.env[instr] = fr.unaryOp(operand, instr.Op) - } - - default: - panic(fmt.Sprintf("unhandled: %v", instr)) - } -} - -func (fr *frame) callBuiltin(typ types.Type, builtin *ssa.Builtin, args []ssa.Value) []*govalue { - switch builtin.Name() { - case "print", "println": - llargs := make([]*govalue, len(args)) - for i, arg := range args { - llargs[i] = fr.value(arg) - } - fr.printValues(builtin.Name() == "println", llargs...) - return nil - - case "panic": - fr.callPanic(fr.value(args[0]), false) - return nil - - case "recover": - return []*govalue{fr.callRecover(false)} - - case "append": - return []*govalue{fr.callAppend(fr.value(args[0]), fr.value(args[1]))} - - case "close": - fr.chanClose(fr.value(args[0])) - return nil - - case "cap": - return []*govalue{fr.callCap(fr.value(args[0]))} - - case "len": - return []*govalue{fr.callLen(fr.value(args[0]))} - - case "copy": - return []*govalue{fr.callCopy(fr.value(args[0]), fr.value(args[1]))} - - case "delete": - fr.mapDelete(fr.value(args[0]), fr.value(args[1])) - return nil - - case "real": - return []*govalue{fr.extractRealValue(fr.value(args[0]))} - - case "imag": - return []*govalue{fr.extractImagValue(fr.value(args[0]))} - - case "complex": - r := fr.llvmvalue(args[0]) - i := fr.llvmvalue(args[1]) - cmplx := llvm.Undef(fr.llvmtypes.ToLLVM(typ)) - cmplx = fr.builder.CreateInsertValue(cmplx, r, 0, "") - cmplx = fr.builder.CreateInsertValue(cmplx, i, 1, "") - return []*govalue{newValue(cmplx, typ)} - - case "ssa:wrapnilchk": - ptr := fr.value(args[0]) - fr.nilCheck(args[0], ptr.value) - return []*govalue{ptr} - - default: - panic("unimplemented: " + builtin.Name()) - } -} - -// callInstruction translates function call instructions. -func (fr *frame) callInstruction(instr ssa.CallInstruction) []*govalue { - call := instr.Common() - if builtin, ok := call.Value.(*ssa.Builtin); ok { - var typ types.Type - if v := instr.Value(); v != nil { - typ = v.Type() - } - return fr.callBuiltin(typ, builtin, call.Args) - } - - args := make([]*govalue, len(call.Args)) - for i, arg := range call.Args { - args[i] = fr.value(arg) - } - - var fn *govalue - var chain llvm.Value - if call.IsInvoke() { - var recv *govalue - fn, recv = fr.interfaceMethod(fr.llvmvalue(call.Value), call.Value.Type(), call.Method) - args = append([]*govalue{recv}, args...) - } else { - if ssafn, ok := call.Value.(*ssa.Function); ok { - llfn := fr.resolveFunctionGlobal(ssafn) - llfn = llvm.ConstBitCast(llfn, llvm.PointerType(llvm.Int8Type(), 0)) - fn = newValue(llfn, ssafn.Type()) - } else { - // First-class function values are stored as *{*fnptr}, so - // we must extract the function pointer. We must also - // set the chain, in case the function is a closure. - fn = fr.value(call.Value) - chain = fn.value - fnptr := fr.builder.CreateBitCast(fn.value, llvm.PointerType(fn.value.Type(), 0), "") - fnptr = fr.builder.CreateLoad(fnptr, "") - fn = newValue(fnptr, fn.Type()) - } - if recv := call.Signature().Recv(); recv != nil { - if _, ok := recv.Type().Underlying().(*types.Pointer); !ok { - recvalloca := fr.allocaBuilder.CreateAlloca(args[0].value.Type(), "") - fr.builder.CreateStore(args[0].value, recvalloca) - args[0] = newValue(recvalloca, types.NewPointer(args[0].Type())) - } - } - } - return fr.createCall(fn, chain, args) -} - -func hasDefer(f *ssa.Function) bool { - for _, b := range f.Blocks { - for _, instr := range b.Instrs { - if _, ok := instr.(*ssa.Defer); ok { - return true - } - } - } - return false -} - -func callsRecover(f *ssa.Function) bool { - for _, b := range f.Blocks { - for _, instr := range b.Instrs { - if instr, ok := instr.(ssa.CallInstruction); ok { - b, ok := instr.Common().Value.(*ssa.Builtin) - if ok && b.Name() == "recover" { - return true - } - } - } - } - return false -} diff --git a/llgo/irgen/strings.go b/llgo/irgen/strings.go deleted file mode 100644 index 6d8e2998e05c8d4857be110dbefc36edf7f427d0..0000000000000000000000000000000000000000 --- a/llgo/irgen/strings.go +++ /dev/null @@ -1,113 +0,0 @@ -//===- strings.go - IR generation for string ops --------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements IR generation for string operations. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "go/token" - - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -func (fr *frame) concatenateStrings(lhs, rhs *govalue) *govalue { - result := fr.runtime.stringPlus.call(fr, lhs.value, rhs.value) - return newValue(result[0], types.Typ[types.String]) -} - -func (fr *frame) compareStringEmpty(v llvm.Value) *govalue { - len := fr.builder.CreateExtractValue(v, 1, "") - result := fr.builder.CreateIsNull(len, "") - result = fr.builder.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) -} - -func (fr *frame) compareStrings(lhs, rhs *govalue, op token.Token) *govalue { - if op == token.EQL { - if lhs.value.IsNull() { - return fr.compareStringEmpty(rhs.value) - } - if rhs.value.IsNull() { - return fr.compareStringEmpty(lhs.value) - } - } - - result := fr.runtime.strcmp.call(fr, lhs.value, rhs.value)[0] - zero := llvm.ConstNull(fr.types.inttype) - var pred llvm.IntPredicate - switch op { - case token.EQL: - pred = llvm.IntEQ - case token.LSS: - pred = llvm.IntSLT - case token.GTR: - pred = llvm.IntSGT - case token.LEQ: - pred = llvm.IntSLE - case token.GEQ: - pred = llvm.IntSGE - case token.NEQ: - panic("NEQ is handled in govalue.BinaryOp") - default: - panic("unreachable") - } - result = fr.builder.CreateICmp(pred, result, zero, "") - result = fr.builder.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) -} - -// stringIndex implements v = m[i] -func (fr *frame) stringIndex(s, i *govalue) *govalue { - ptr := fr.builder.CreateExtractValue(s.value, 0, "") - ptr = fr.builder.CreateGEP(ptr, []llvm.Value{i.value}, "") - return newValue(fr.builder.CreateLoad(ptr, ""), types.Typ[types.Byte]) -} - -func (fr *frame) stringIterInit(str *govalue) []*govalue { - indexptr := fr.allocaBuilder.CreateAlloca(fr.types.inttype, "") - fr.builder.CreateStore(llvm.ConstNull(fr.types.inttype), indexptr) - return []*govalue{str, newValue(indexptr, types.Typ[types.Int])} -} - -// stringIterNext advances the iterator, and returns the tuple (ok, k, v). -func (fr *frame) stringIterNext(iter []*govalue) []*govalue { - str, indexptr := iter[0], iter[1] - k := fr.builder.CreateLoad(indexptr.value, "") - - result := fr.runtime.stringiter2.call(fr, str.value, k) - fr.builder.CreateStore(result[0], indexptr.value) - ok := fr.builder.CreateIsNotNull(result[0], "") - ok = fr.builder.CreateZExt(ok, llvm.Int8Type(), "") - v := result[1] - - return []*govalue{newValue(ok, types.Typ[types.Bool]), newValue(k, types.Typ[types.Int]), newValue(v, types.Typ[types.Rune])} -} - -func (fr *frame) runeToString(v *govalue) *govalue { - v = fr.convert(v, types.Typ[types.Int]) - result := fr.runtime.intToString.call(fr, v.value) - return newValue(result[0], types.Typ[types.String]) -} - -func (fr *frame) stringToRuneSlice(v *govalue) *govalue { - result := fr.runtime.stringToIntArray.call(fr, v.value) - runeslice := types.NewSlice(types.Typ[types.Rune]) - return newValue(result[0], runeslice) -} - -func (fr *frame) runeSliceToString(v *govalue) *govalue { - llv := v.value - ptr := fr.builder.CreateExtractValue(llv, 0, "") - len := fr.builder.CreateExtractValue(llv, 1, "") - result := fr.runtime.intArrayToString.call(fr, ptr, len) - return newValue(result[0], types.Typ[types.String]) -} diff --git a/llgo/irgen/switches.go b/llgo/irgen/switches.go deleted file mode 100644 index a2b46b788d3d07ccddd717b0be4b4c491c286057..0000000000000000000000000000000000000000 --- a/llgo/irgen/switches.go +++ /dev/null @@ -1,144 +0,0 @@ -//===- switches.go - misc utils -------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements transformations and IR generation for switches. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "go/token" - - "llvm.org/llgo/third_party/gotools/go/exact" - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/ssa/ssautil" - "llvm.org/llvm/bindings/go/llvm" -) - -// switchInstr is an instruction representing a switch on constant -// integer values. -type switchInstr struct { - ssa.Instruction - ssautil.Switch -} - -func (sw *switchInstr) String() string { - return sw.Switch.String() -} - -func (sw *switchInstr) Parent() *ssa.Function { - return sw.Default.Instrs[0].Parent() -} - -func (sw *switchInstr) Block() *ssa.BasicBlock { - return sw.Start -} - -func (sw *switchInstr) Operands(rands []*ssa.Value) []*ssa.Value { - return nil -} - -func (sw *switchInstr) Pos() token.Pos { - return token.NoPos -} - -// emitSwitch emits an LLVM switch instruction. -func (fr *frame) emitSwitch(instr *switchInstr) { - cases, _ := dedupConstCases(fr, instr.ConstCases) - ncases := len(cases) - elseblock := fr.block(instr.Default) - llswitch := fr.builder.CreateSwitch(fr.llvmvalue(instr.X), elseblock, ncases) - for _, c := range cases { - llswitch.AddCase(fr.llvmvalue(c.Value), fr.block(c.Body)) - } -} - -// transformSwitches replaces the final If statement in start blocks -// with a high-level switch instruction, and erases chained condition -// blocks. -func (fr *frame) transformSwitches(f *ssa.Function) { - for _, sw := range ssautil.Switches(f) { - if sw.ConstCases == nil { - // TODO(axw) investigate switch - // on hashes in type switches. - continue - } - if !isInteger(sw.X.Type()) && !isBoolean(sw.X.Type()) { - // LLVM switches can only operate on integers. - continue - } - instr := &switchInstr{Switch: sw} - sw.Start.Instrs[len(sw.Start.Instrs)-1] = instr - for _, c := range sw.ConstCases[1:] { - fr.blocks[c.Block.Index].EraseFromParent() - fr.blocks[c.Block.Index] = llvm.BasicBlock{} - } - - // Fix predecessors in successor blocks for fixupPhis. - cases, duplicates := dedupConstCases(fr, instr.ConstCases) - for _, c := range cases { - for _, succ := range c.Block.Succs { - for i, pred := range succ.Preds { - if pred == c.Block { - succ.Preds[i] = sw.Start - break - } - } - } - } - - // Remove redundant edges corresponding to duplicate cases - // that will not feature in the LLVM switch instruction. - for _, c := range duplicates { - for _, succ := range c.Block.Succs { - for i, pred := range succ.Preds { - if pred == c.Block { - head := succ.Preds[:i] - tail := succ.Preds[i+1:] - succ.Preds = append(head, tail...) - removePhiEdge(succ, i) - break - } - } - } - } - } -} - -// dedupConstCases separates duplicate const cases. -// -// TODO(axw) fix this in go/ssa/ssautil. -func dedupConstCases(fr *frame, in []ssautil.ConstCase) (unique, duplicates []ssautil.ConstCase) { - unique = make([]ssautil.ConstCase, 0, len(in)) -dedup: - for i, c1 := range in { - for _, c2 := range in[i+1:] { - if exact.Compare(c1.Value.Value, token.EQL, c2.Value.Value) { - duplicates = append(duplicates, c1) - continue dedup - } - } - unique = append(unique, c1) - } - return unique, duplicates -} - -// removePhiEdge removes the i'th edge from each PHI -// instruction in the specified basic block. -func removePhiEdge(bb *ssa.BasicBlock, i int) { - for _, instr := range bb.Instrs { - instr, ok := instr.(*ssa.Phi) - if !ok { - return - } - head := instr.Edges[:i] - tail := instr.Edges[i+1:] - instr.Edges = append(head, tail...) - } -} diff --git a/llgo/irgen/targets.go b/llgo/irgen/targets.go deleted file mode 100644 index 4460cef1d54b8a0a060ed1b630a39b1950ec3288..0000000000000000000000000000000000000000 --- a/llgo/irgen/targets.go +++ /dev/null @@ -1,88 +0,0 @@ -//===- targets.go - target data -------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file contains functions for retrieving target-specific data. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "fmt" - "strings" - - "llvm.org/llvm/bindings/go/llvm" -) - -// llvmDataLayout returns the data layout string -// representation for the specified LLVM triple. -func llvmDataLayout(triple string) (string, error) { - // Triples are several fields separated by '-' characters. - // The first field is the architecture. The architecture's - // canonical form may include a '-' character, which would - // have been translated to '_' for inclusion in a triple. - arch := parseArch(triple[:strings.IndexRune(triple, '-')]) - for target := llvm.FirstTarget(); target.C != nil; target = target.NextTarget() { - if arch == target.Name() { - machine := target.CreateTargetMachine( - triple, "", "", - llvm.CodeGenLevelDefault, - llvm.RelocDefault, - llvm.CodeModelDefault, - ) - targetData := machine.CreateTargetData() - targetDataLayout := targetData.String() - targetData.Dispose() - machine.Dispose() - return targetDataLayout, nil - } - } - return "", fmt.Errorf("Invalid target triple: %s", triple) -} - -// Based on parseArch from LLVM's lib/Support/Triple.cpp. -// This is used to match the target machine type. -func parseArch(arch string) string { - switch arch { - case "i386", "i486", "i586", "i686", "i786", "i886", "i986": - return "x86" - case "amd64", "x86_64": - return "x86-64" - case "powerpc": - return "ppc" - case "powerpc64", "ppu": - return "ppc64" - case "mblaze": - return "mblaze" - case "arm", "xscale": - return "arm" - case "thumb": - return "thumb" - case "spu", "cellspu": - return "cellspu" - case "msp430": - return "msp430" - case "mips", "mipseb", "mipsallegrex": - return "mips" - case "mipsel", "mipsallegrexel": - return "mipsel" - case "mips64", "mips64eb": - return "mips64" - case "mipsel64": - return "mipsel64" - case "r600", "hexagon", "sparc", "sparcv9", "tce", - "xcore", "nvptx", "nvptx64", "le32", "amdil": - return arch - } - if strings.HasPrefix(arch, "armv") { - return "arm" - } else if strings.HasPrefix(arch, "thumbv") { - return "thumb" - } - return "unknown" -} diff --git a/llgo/irgen/typemap.go b/llgo/irgen/typemap.go deleted file mode 100644 index c2a5c7acc4bea204c22975f27e85aea6d90e0a53..0000000000000000000000000000000000000000 --- a/llgo/irgen/typemap.go +++ /dev/null @@ -1,2052 +0,0 @@ -//===- typemap.go - type and type descriptor mapping ----------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements the mapping from go/types types to LLVM types and to -// type descriptors. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "bytes" - "fmt" - "sort" - "strconv" - "strings" - - "llvm.org/llgo/third_party/gotools/go/ssa" - "llvm.org/llgo/third_party/gotools/go/ssa/ssautil" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llgo/third_party/gotools/go/types/typeutil" - "llvm.org/llvm/bindings/go/llvm" -) - -type MethodResolver interface { - ResolveMethod(*types.Selection) *govalue -} - -// llvmTypeMap is provides a means of mapping from a types.Map -// to llgo's corresponding LLVM type representation. -type llvmTypeMap struct { - sizes *types.StdSizes - ctx llvm.Context - target llvm.TargetData - inttype llvm.Type - stringType llvm.Type - - types typeutil.Map -} - -type typeDescInfo struct { - global llvm.Value - commonTypePtr llvm.Value - mapDescPtr llvm.Value - gc, gcPtr llvm.Value - - interfaceMethodTables typeutil.Map -} - -type TypeMap struct { - *llvmTypeMap - mc manglerContext - - module llvm.Module - pkgpath string - types, algs typeutil.Map - runtime *runtimeInterface - methodResolver MethodResolver - types.MethodSetCache - - commonTypeType, uncommonTypeType, ptrTypeType, funcTypeType, arrayTypeType, sliceTypeType, mapTypeType, chanTypeType, interfaceTypeType, structTypeType llvm.Type - mapDescType llvm.Type - - methodType, imethodType, structFieldType llvm.Type - - typeSliceType, methodSliceType, imethodSliceType, structFieldSliceType llvm.Type - - funcValType llvm.Type - hashFnType, equalFnType llvm.Type - - algsEmptyInterface, - algsInterface, - algsFloat, - algsComplex, - algsString, - algsIdentity, - algsError algorithms -} - -type algorithms struct { - hash, hashDescriptor, equal, equalDescriptor llvm.Value -} - -func NewLLVMTypeMap(ctx llvm.Context, target llvm.TargetData) *llvmTypeMap { - // spec says int is either 32-bit or 64-bit. - // ABI currently requires sizeof(int) == sizeof(uint) == sizeof(uintptr). - inttype := ctx.IntType(8 * target.PointerSize()) - - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - elements := []llvm.Type{i8ptr, inttype} - stringType := llvm.StructType(elements, false) - - return &llvmTypeMap{ - ctx: ctx, - sizes: &types.StdSizes{ - WordSize: int64(target.PointerSize()), - MaxAlign: 8, - }, - target: target, - inttype: inttype, - stringType: stringType, - } -} - -func NewTypeMap(pkg *ssa.Package, llvmtm *llvmTypeMap, module llvm.Module, r *runtimeInterface, mr MethodResolver) *TypeMap { - tm := &TypeMap{ - llvmTypeMap: llvmtm, - module: module, - pkgpath: pkg.Object.Path(), - runtime: r, - methodResolver: mr, - } - - tm.mc.init(pkg.Prog, &tm.MethodSetCache) - - uintptrType := tm.inttype - voidPtrType := llvm.PointerType(tm.ctx.Int8Type(), 0) - boolType := llvm.Int8Type() - stringPtrType := llvm.PointerType(tm.stringType, 0) - - tm.funcValType = tm.ctx.StructCreateNamed("funcVal") - tm.funcValType.StructSetBody([]llvm.Type{ - llvm.PointerType(llvm.FunctionType(llvm.VoidType(), []llvm.Type{}, false), 0), - }, false) - - params := []llvm.Type{voidPtrType, uintptrType} - tm.hashFnType = llvm.FunctionType(uintptrType, params, false) - params = []llvm.Type{voidPtrType, voidPtrType, uintptrType} - tm.equalFnType = llvm.FunctionType(boolType, params, false) - - typeAlgorithms := [...]struct { - Name string - *algorithms - }{ - {"empty_interface", &tm.algsEmptyInterface}, - {"interface", &tm.algsInterface}, - {"float", &tm.algsFloat}, - {"complex", &tm.algsComplex}, - {"string", &tm.algsString}, - {"identity", &tm.algsIdentity}, - {"error", &tm.algsError}, - } - for _, typeAlgs := range typeAlgorithms { - hashFnName := "__go_type_hash_" + typeAlgs.Name - hashDescriptorName := hashFnName + "_descriptor" - equalFnName := "__go_type_equal_" + typeAlgs.Name - equalDescriptorName := equalFnName + "_descriptor" - typeAlgs.hash = llvm.AddFunction(tm.module, hashFnName, tm.hashFnType) - typeAlgs.hashDescriptor = llvm.AddGlobal(tm.module, tm.funcValType, hashDescriptorName) - typeAlgs.equal = llvm.AddFunction(tm.module, equalFnName, tm.equalFnType) - typeAlgs.equalDescriptor = llvm.AddGlobal(tm.module, tm.funcValType, equalDescriptorName) - } - - tm.commonTypeType = tm.ctx.StructCreateNamed("commonType") - commonTypeTypePtr := llvm.PointerType(tm.commonTypeType, 0) - - tm.methodType = tm.ctx.StructCreateNamed("method") - tm.methodType.StructSetBody([]llvm.Type{ - stringPtrType, // name - stringPtrType, // pkgPath - commonTypeTypePtr, // mtype (without receiver) - commonTypeTypePtr, // type (with receiver) - voidPtrType, // function - }, false) - - tm.methodSliceType = tm.makeNamedSliceType("methodSlice", tm.methodType) - - tm.uncommonTypeType = tm.ctx.StructCreateNamed("uncommonType") - tm.uncommonTypeType.StructSetBody([]llvm.Type{ - stringPtrType, // name - stringPtrType, // pkgPath - tm.methodSliceType, // methods - }, false) - - tm.commonTypeType.StructSetBody([]llvm.Type{ - tm.ctx.Int8Type(), // Kind - tm.ctx.Int8Type(), // align - tm.ctx.Int8Type(), // fieldAlign - uintptrType, // size - tm.ctx.Int32Type(), // hash - llvm.PointerType(tm.funcValType, 0), // hashfn - llvm.PointerType(tm.funcValType, 0), // equalfn - voidPtrType, // gc - stringPtrType, // string - llvm.PointerType(tm.uncommonTypeType, 0), // uncommonType - commonTypeTypePtr, // ptrToThis - }, false) - - tm.typeSliceType = tm.makeNamedSliceType("typeSlice", commonTypeTypePtr) - - tm.ptrTypeType = tm.ctx.StructCreateNamed("ptrType") - tm.ptrTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - commonTypeTypePtr, - }, false) - - tm.funcTypeType = tm.ctx.StructCreateNamed("funcType") - tm.funcTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - tm.ctx.Int8Type(), // dotdotdot - tm.typeSliceType, // in - tm.typeSliceType, // out - }, false) - - tm.arrayTypeType = tm.ctx.StructCreateNamed("arrayType") - tm.arrayTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - commonTypeTypePtr, // elem - commonTypeTypePtr, // slice - tm.inttype, // len - }, false) - - tm.sliceTypeType = tm.ctx.StructCreateNamed("sliceType") - tm.sliceTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - commonTypeTypePtr, // elem - }, false) - - tm.mapTypeType = tm.ctx.StructCreateNamed("mapType") - tm.mapTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - commonTypeTypePtr, // key - commonTypeTypePtr, // elem - }, false) - - tm.chanTypeType = tm.ctx.StructCreateNamed("chanType") - tm.chanTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - commonTypeTypePtr, // elem - tm.inttype, // dir - }, false) - - tm.imethodType = tm.ctx.StructCreateNamed("imethod") - tm.imethodType.StructSetBody([]llvm.Type{ - stringPtrType, // name - stringPtrType, // pkgPath - commonTypeTypePtr, // typ - }, false) - - tm.imethodSliceType = tm.makeNamedSliceType("imethodSlice", tm.imethodType) - - tm.interfaceTypeType = tm.ctx.StructCreateNamed("interfaceType") - tm.interfaceTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - tm.imethodSliceType, - }, false) - - tm.structFieldType = tm.ctx.StructCreateNamed("structField") - tm.structFieldType.StructSetBody([]llvm.Type{ - stringPtrType, // name - stringPtrType, // pkgPath - commonTypeTypePtr, // typ - stringPtrType, // tag - tm.inttype, // offset - }, false) - - tm.structFieldSliceType = tm.makeNamedSliceType("structFieldSlice", tm.structFieldType) - - tm.structTypeType = tm.ctx.StructCreateNamed("structType") - tm.structTypeType.StructSetBody([]llvm.Type{ - tm.commonTypeType, - tm.structFieldSliceType, // fields - }, false) - - tm.mapDescType = tm.ctx.StructCreateNamed("mapDesc") - tm.mapDescType.StructSetBody([]llvm.Type{ - commonTypeTypePtr, // map_descriptor - tm.inttype, // entry_size - tm.inttype, // key_offset - tm.inttype, // value_offset - }, false) - - return tm -} - -func (tm *llvmTypeMap) ToLLVM(t types.Type) llvm.Type { - return tm.toLLVM(t, "") -} - -func (tm *llvmTypeMap) toLLVM(t types.Type, name string) llvm.Type { - lt, ok := tm.types.At(t).(llvm.Type) - if !ok { - lt = tm.makeLLVMType(t, name) - if lt.IsNil() { - panic(fmt.Sprint("Failed to create LLVM type for: ", t)) - } - tm.types.Set(t, lt) - } - return lt -} - -func (tm *llvmTypeMap) makeLLVMType(t types.Type, name string) llvm.Type { - return tm.getBackendType(t).ToLLVM(tm.ctx) -} - -func (tm *llvmTypeMap) Offsetsof(fields []*types.Var) []int64 { - offsets := make([]int64, len(fields)) - var o int64 - for i, f := range fields { - a := tm.Alignof(f.Type()) - o = align(o, a) - offsets[i] = o - o += tm.Sizeof(f.Type()) - } - return offsets -} - -var basicSizes = [...]byte{ - types.Bool: 1, - types.Int8: 1, - types.Int16: 2, - types.Int32: 4, - types.Int64: 8, - types.Uint8: 1, - types.Uint16: 2, - types.Uint32: 4, - types.Uint64: 8, - types.Float32: 4, - types.Float64: 8, - types.Complex64: 8, - types.Complex128: 16, -} - -func (tm *llvmTypeMap) Sizeof(T types.Type) int64 { - switch t := T.Underlying().(type) { - case *types.Basic: - k := t.Kind() - if int(k) < len(basicSizes) { - if s := basicSizes[k]; s > 0 { - return int64(s) - } - } - if k == types.String { - return tm.sizes.WordSize * 2 - } - case *types.Array: - a := tm.Alignof(t.Elem()) - z := tm.Sizeof(t.Elem()) - return align(z, a) * t.Len() // may be 0 - case *types.Slice: - return tm.sizes.WordSize * 3 - case *types.Struct: - n := t.NumFields() - if n == 0 { - return 0 - } - fields := make([]*types.Var, t.NumFields()) - for i := 0; i != t.NumFields(); i++ { - fields[i] = t.Field(i) - } - offsets := tm.Offsetsof(fields) - return align(offsets[n-1]+tm.Sizeof(t.Field(n-1).Type()), tm.Alignof(t)) - case *types.Interface: - return tm.sizes.WordSize * 2 - } - return tm.sizes.WordSize // catch-all -} - -func (tm *llvmTypeMap) Alignof(t types.Type) int64 { - return tm.sizes.Alignof(t) -} - -/////////////////////////////////////////////////////////////////////////////// - -func (tm *TypeMap) ToRuntime(t types.Type) llvm.Value { - return llvm.ConstBitCast(tm.getTypeDescriptorPointer(t), llvm.PointerType(llvm.Int8Type(), 0)) -} - -type localNamedTypeInfo struct { - functionName string - scopeNum int -} - -type namedTypeInfo struct { - pkgname, pkgpath string - name string - localNamedTypeInfo -} - -type manglerContext struct { - ti map[*types.Named]localNamedTypeInfo - msc *types.MethodSetCache -} - -// Assembles the method set into the order that gccgo uses (unexported methods first). -// TODO(pcc): cache this. -func orderedMethodSet(ms *types.MethodSet) []*types.Selection { - oms := make([]*types.Selection, ms.Len()) - omsi := 0 - for i := 0; i != ms.Len(); i++ { - if sel := ms.At(i); !sel.Obj().Exported() { - oms[omsi] = sel - omsi++ - } - } - for i := 0; i != ms.Len(); i++ { - if sel := ms.At(i); sel.Obj().Exported() { - oms[omsi] = sel - omsi++ - } - } - return oms -} - -func (ctx *manglerContext) init(prog *ssa.Program, msc *types.MethodSetCache) { - ctx.msc = msc - ctx.ti = make(map[*types.Named]localNamedTypeInfo) - for f, _ := range ssautil.AllFunctions(prog) { - scopeNum := 0 - var addNamedTypesToMap func(*types.Scope) - addNamedTypesToMap = func(scope *types.Scope) { - hasNamedTypes := false - for _, n := range scope.Names() { - if tn, ok := scope.Lookup(n).(*types.TypeName); ok { - hasNamedTypes = true - ctx.ti[tn.Type().(*types.Named)] = localNamedTypeInfo{f.Name(), scopeNum} - } - } - if hasNamedTypes { - scopeNum++ - } - for i := 0; i != scope.NumChildren(); i++ { - addNamedTypesToMap(scope.Child(i)) - } - } - if fobj, ok := f.Object().(*types.Func); ok && fobj.Scope() != nil { - addNamedTypesToMap(fobj.Scope()) - } - } -} - -func (ctx *manglerContext) getNamedTypeInfo(t types.Type) (nti namedTypeInfo) { - switch t := t.(type) { - case *types.Basic: - switch t.Kind() { - case types.Byte: - nti.name = "uint8" - case types.Rune: - nti.name = "int32" - case types.UnsafePointer: - nti.pkgname = "unsafe" - nti.pkgpath = "unsafe" - nti.name = "Pointer" - default: - nti.name = t.Name() - } - - case *types.Named: - obj := t.Obj() - if pkg := obj.Pkg(); pkg != nil { - nti.pkgname = obj.Pkg().Name() - nti.pkgpath = obj.Pkg().Path() - } - nti.name = obj.Name() - nti.localNamedTypeInfo = ctx.ti[t] - - default: - panic("not a named type") - } - - return -} - -func (ctx *manglerContext) mangleSignature(s *types.Signature, recv *types.Var, b *bytes.Buffer) { - b.WriteRune('F') - if recv != nil { - b.WriteRune('m') - ctx.mangleType(recv.Type(), b) - } - - if p := s.Params(); p.Len() != 0 { - b.WriteRune('p') - for i := 0; i != p.Len(); i++ { - ctx.mangleType(p.At(i).Type(), b) - } - if s.Variadic() { - b.WriteRune('V') - } - b.WriteRune('e') - } - - if r := s.Results(); r.Len() != 0 { - b.WriteRune('r') - for i := 0; i != r.Len(); i++ { - ctx.mangleType(r.At(i).Type(), b) - } - b.WriteRune('e') - } - - b.WriteRune('e') -} - -func ManglePackagePath(pkgpath string) string { - pkgpath = strings.Replace(pkgpath, "/", "_", -1) - pkgpath = strings.Replace(pkgpath, ".", "_", -1) - return pkgpath -} - -func (ctx *manglerContext) mangleType(t types.Type, b *bytes.Buffer) { - switch t := t.(type) { - case *types.Basic, *types.Named: - var nb bytes.Buffer - ti := ctx.getNamedTypeInfo(t) - if ti.pkgpath != "" { - nb.WriteString(ManglePackagePath(ti.pkgpath)) - nb.WriteRune('.') - } - if ti.functionName != "" { - nb.WriteString(ti.functionName) - nb.WriteRune('$') - if ti.scopeNum != 0 { - nb.WriteString(strconv.Itoa(ti.scopeNum)) - nb.WriteRune('$') - } - } - nb.WriteString(ti.name) - - b.WriteRune('N') - b.WriteString(strconv.Itoa(nb.Len())) - b.WriteRune('_') - b.WriteString(nb.String()) - - case *types.Pointer: - b.WriteRune('p') - ctx.mangleType(t.Elem(), b) - - case *types.Map: - b.WriteRune('M') - ctx.mangleType(t.Key(), b) - b.WriteString("__") - ctx.mangleType(t.Elem(), b) - - case *types.Chan: - b.WriteRune('C') - ctx.mangleType(t.Elem(), b) - switch t.Dir() { - case types.SendOnly: - b.WriteRune('s') - case types.RecvOnly: - b.WriteRune('r') - case types.SendRecv: - b.WriteString("sr") - } - b.WriteRune('e') - - case *types.Signature: - ctx.mangleSignature(t, t.Recv(), b) - - case *types.Array: - b.WriteRune('A') - ctx.mangleType(t.Elem(), b) - b.WriteString(strconv.FormatInt(t.Len(), 10)) - b.WriteRune('e') - - case *types.Slice: - b.WriteRune('A') - ctx.mangleType(t.Elem(), b) - b.WriteRune('e') - - case *types.Struct: - b.WriteRune('S') - for i := 0; i != t.NumFields(); i++ { - f := t.Field(i) - if f.Anonymous() { - b.WriteString("0_") - } else { - b.WriteString(strconv.Itoa(len(f.Name()))) - b.WriteRune('_') - b.WriteString(f.Name()) - } - ctx.mangleType(f.Type(), b) - // TODO: tags are mangled here - } - b.WriteRune('e') - - case *types.Interface: - b.WriteRune('I') - methodset := ctx.msc.MethodSet(t) - for _, m := range orderedMethodSet(methodset) { - method := m.Obj() - var nb bytes.Buffer - if !method.Exported() { - nb.WriteRune('.') - nb.WriteString(method.Pkg().Path()) - nb.WriteRune('.') - } - nb.WriteString(method.Name()) - - b.WriteString(strconv.Itoa(nb.Len())) - b.WriteRune('_') - b.WriteString(nb.String()) - - ctx.mangleSignature(method.Type().(*types.Signature), nil, b) - } - b.WriteRune('e') - - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } -} - -func (ctx *manglerContext) mangleTypeDescriptorName(t types.Type, b *bytes.Buffer) { - switch t := t.(type) { - case *types.Basic, *types.Named: - b.WriteString("__go_tdn_") - ti := ctx.getNamedTypeInfo(t) - if ti.pkgpath != "" { - b.WriteString(ManglePackagePath(ti.pkgpath)) - b.WriteRune('.') - } - if ti.functionName != "" { - b.WriteString(ti.functionName) - b.WriteRune('.') - if ti.scopeNum != 0 { - b.WriteString(strconv.Itoa(ti.scopeNum)) - b.WriteRune('.') - } - } - b.WriteString(ti.name) - - default: - b.WriteString("__go_td_") - ctx.mangleType(t, b) - } -} - -func (ctx *manglerContext) mangleMapDescriptorName(t types.Type, b *bytes.Buffer) { - b.WriteString("__go_map_") - ctx.mangleType(t, b) -} - -func (ctx *manglerContext) mangleImtName(srctype types.Type, targettype *types.Interface, b *bytes.Buffer) { - b.WriteString("__go_imt_") - ctx.mangleType(targettype, b) - b.WriteString("__") - ctx.mangleType(srctype, b) -} - -func (ctx *manglerContext) mangleHashFunctionName(t types.Type) string { - var b bytes.Buffer - b.WriteString("__go_type_hash_") - ctx.mangleType(t, &b) - return b.String() -} - -func (ctx *manglerContext) mangleEqualFunctionName(t types.Type) string { - var b bytes.Buffer - b.WriteString("__go_type_equal_") - ctx.mangleType(t, &b) - return b.String() -} - -func (ctx *manglerContext) mangleFunctionName(f *ssa.Function) string { - var b bytes.Buffer - - if f.Parent() != nil { - // Anonymous functions are not guaranteed to - // have unique identifiers at the global scope. - b.WriteString(ctx.mangleFunctionName(f.Parent())) - b.WriteRune(':') - b.WriteString(f.String()) - return b.String() - } - - // Synthetic bound and thunk functions are special cases; they can only be - // distinguished using private data that is only exposed via String(). - if strings.HasSuffix(f.Name(), "$bound") || strings.HasSuffix(f.Name(), "$thunk") { - b.WriteString(f.String()) - return b.String() - } - - var pkg *types.Package - if f.Pkg != nil { - pkg = f.Pkg.Object - } else if !f.Object().Exported() { - pkg = f.Object().Pkg() - } - - if pkg != nil { - b.WriteString(ManglePackagePath(pkg.Path())) - b.WriteRune('.') - } - - if f.Signature.Recv() == nil && f.Name() == "init" { - b.WriteString(".import") - } else { - b.WriteString(f.Name()) - } - if f.Signature.Recv() != nil { - b.WriteRune('.') - ctx.mangleType(f.Signature.Recv().Type(), &b) - } - - return b.String() -} - -func (ctx *manglerContext) mangleGlobalName(g *ssa.Global) string { - var b bytes.Buffer - - b.WriteString(ManglePackagePath(g.Pkg.Object.Path())) - b.WriteRune('.') - b.WriteString(g.Name()) - - return b.String() -} - -const ( - // From gofrontend/types.h - gccgoTypeClassERROR = iota - gccgoTypeClassVOID - gccgoTypeClassBOOLEAN - gccgoTypeClassINTEGER - gccgoTypeClassFLOAT - gccgoTypeClassCOMPLEX - gccgoTypeClassSTRING - gccgoTypeClassSINK - gccgoTypeClassFUNCTION - gccgoTypeClassPOINTER - gccgoTypeClassNIL - gccgoTypeClassCALL_MULTIPLE_RESULT - gccgoTypeClassSTRUCT - gccgoTypeClassARRAY - gccgoTypeClassMAP - gccgoTypeClassCHANNEL - gccgoTypeClassINTERFACE - gccgoTypeClassNAMED - gccgoTypeClassFORWARD -) - -func getStringHash(s string, h uint32) uint32 { - for _, c := range []byte(s) { - h ^= uint32(c) - h += 16777619 - } - return h -} - -func (tm *TypeMap) getTypeHash(t types.Type) uint32 { - switch t := t.(type) { - case *types.Basic, *types.Named: - nti := tm.mc.getNamedTypeInfo(t) - h := getStringHash(nti.functionName+nti.name+nti.pkgpath, 0) - h ^= uint32(nti.scopeNum) - return gccgoTypeClassNAMED + h - - case *types.Signature: - var h uint32 - - p := t.Params() - for i := 0; i != p.Len(); i++ { - h += tm.getTypeHash(p.At(i).Type()) << uint32(i+1) - } - - r := t.Results() - for i := 0; i != r.Len(); i++ { - h += tm.getTypeHash(r.At(i).Type()) << uint32(i+2) - } - - if t.Variadic() { - h += 1 - } - h <<= 4 - return gccgoTypeClassFUNCTION + h - - case *types.Pointer: - return gccgoTypeClassPOINTER + (tm.getTypeHash(t.Elem()) << 4) - - case *types.Struct: - var h uint32 - for i := 0; i != t.NumFields(); i++ { - h = (h << 1) + tm.getTypeHash(t.Field(i).Type()) - } - h <<= 2 - return gccgoTypeClassSTRUCT + h - - case *types.Array: - return gccgoTypeClassARRAY + tm.getTypeHash(t.Elem()) + 1 - - case *types.Slice: - return gccgoTypeClassARRAY + tm.getTypeHash(t.Elem()) + 1 - - case *types.Map: - return gccgoTypeClassMAP + tm.getTypeHash(t.Key()) + tm.getTypeHash(t.Elem()) + 2 - - case *types.Chan: - var h uint32 - - switch t.Dir() { - case types.SendOnly: - h = 1 - case types.RecvOnly: - h = 2 - case types.SendRecv: - h = 3 - } - - h += tm.getTypeHash(t.Elem()) << 2 - h <<= 3 - return gccgoTypeClassCHANNEL + h - - case *types.Interface: - var h uint32 - for _, m := range orderedMethodSet(tm.MethodSet(t)) { - h = getStringHash(m.Obj().Name(), h) - h <<= 1 - } - return gccgoTypeClassINTERFACE + h - - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } -} - -func (tm *TypeMap) writeType(typ types.Type, b *bytes.Buffer) { - switch t := typ.(type) { - case *types.Basic, *types.Named: - ti := tm.mc.getNamedTypeInfo(t) - if ti.pkgpath != "" { - b.WriteByte('\t') - b.WriteString(ManglePackagePath(ti.pkgpath)) - b.WriteByte('\t') - b.WriteString(ti.pkgname) - b.WriteByte('.') - } - if ti.functionName != "" { - b.WriteByte('\t') - b.WriteString(ti.functionName) - b.WriteByte('$') - if ti.scopeNum != 0 { - b.WriteString(strconv.Itoa(ti.scopeNum)) - b.WriteByte('$') - } - b.WriteByte('\t') - } - b.WriteString(ti.name) - - case *types.Array: - fmt.Fprintf(b, "[%d]", t.Len()) - tm.writeType(t.Elem(), b) - - case *types.Slice: - b.WriteString("[]") - tm.writeType(t.Elem(), b) - - case *types.Struct: - if t.NumFields() == 0 { - b.WriteString("struct {}") - return - } - b.WriteString("struct { ") - for i := 0; i != t.NumFields(); i++ { - f := t.Field(i) - if i > 0 { - b.WriteString("; ") - } - if !f.Anonymous() { - b.WriteString(f.Name()) - b.WriteByte(' ') - } - tm.writeType(f.Type(), b) - if tag := t.Tag(i); tag != "" { - fmt.Fprintf(b, " %q", tag) - } - } - b.WriteString(" }") - - case *types.Pointer: - b.WriteByte('*') - tm.writeType(t.Elem(), b) - - case *types.Signature: - b.WriteString("func") - tm.writeSignature(t, b) - - case *types.Interface: - if t.NumMethods() == 0 && t.NumEmbeddeds() == 0 { - b.WriteString("interface {}") - return - } - // We write the source-level methods and embedded types rather - // than the actual method set since resolved method signatures - // may have non-printable cycles if parameters have anonymous - // interface types that (directly or indirectly) embed the - // current interface. For instance, consider the result type - // of m: - // - // type T interface{ - // m() interface{ T } - // } - // - b.WriteString("interface { ") - // print explicit interface methods and embedded types - for i := 0; i != t.NumMethods(); i++ { - m := t.Method(i) - if i > 0 { - b.WriteString("; ") - } - if !m.Exported() { - b.WriteString(m.Pkg().Path()) - b.WriteByte('.') - } - b.WriteString(m.Name()) - tm.writeSignature(m.Type().(*types.Signature), b) - } - for i := 0; i != t.NumEmbeddeds(); i++ { - typ := t.Embedded(i) - if i > 0 || t.NumMethods() > 0 { - b.WriteString("; ") - } - tm.writeType(typ, b) - } - b.WriteString(" }") - - case *types.Map: - b.WriteString("map[") - tm.writeType(t.Key(), b) - b.WriteByte(']') - tm.writeType(t.Elem(), b) - - case *types.Chan: - var s string - var parens bool - switch t.Dir() { - case types.SendRecv: - s = "chan " - // chan (<-chan T) requires parentheses - if c, _ := t.Elem().(*types.Chan); c != nil && c.Dir() == types.RecvOnly { - parens = true - } - case types.SendOnly: - s = "chan<- " - case types.RecvOnly: - s = "<-chan " - default: - panic("unreachable") - } - b.WriteString(s) - if parens { - b.WriteByte('(') - } - tm.writeType(t.Elem(), b) - if parens { - b.WriteByte(')') - } - - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } -} - -func (tm *TypeMap) writeTuple(tup *types.Tuple, variadic bool, b *bytes.Buffer) { - b.WriteByte('(') - if tup != nil { - for i := 0; i != tup.Len(); i++ { - v := tup.At(i) - if i > 0 { - b.WriteString(", ") - } - typ := v.Type() - if variadic && i == tup.Len()-1 { - b.WriteString("...") - typ = typ.(*types.Slice).Elem() - } - tm.writeType(typ, b) - } - } - b.WriteByte(')') -} - -func (tm *TypeMap) writeSignature(sig *types.Signature, b *bytes.Buffer) { - tm.writeTuple(sig.Params(), sig.Variadic(), b) - - n := sig.Results().Len() - if n == 0 { - // no result - return - } - - b.WriteByte(' ') - if n == 1 { - tm.writeType(sig.Results().At(0).Type(), b) - return - } - - // multiple results - tm.writeTuple(sig.Results(), false, b) -} - -func (tm *TypeMap) getTypeDescType(t types.Type) llvm.Type { - switch t.Underlying().(type) { - case *types.Basic: - return tm.commonTypeType - case *types.Pointer: - return tm.ptrTypeType - case *types.Signature: - return tm.funcTypeType - case *types.Array: - return tm.arrayTypeType - case *types.Slice: - return tm.sliceTypeType - case *types.Map: - return tm.mapTypeType - case *types.Chan: - return tm.chanTypeType - case *types.Struct: - return tm.structTypeType - case *types.Interface: - return tm.interfaceTypeType - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } -} - -func (tm *TypeMap) getNamedTypeLinkage(nt *types.Named) (linkage llvm.Linkage, emit bool) { - if pkg := nt.Obj().Pkg(); pkg != nil { - linkage = llvm.ExternalLinkage - emit = pkg.Path() == tm.pkgpath - } else { - linkage = llvm.LinkOnceODRLinkage - emit = true - } - - return -} - -func (tm *TypeMap) getTypeDescLinkage(t types.Type) (linkage llvm.Linkage, emit bool) { - switch t := t.(type) { - case *types.Named: - linkage, emit = tm.getNamedTypeLinkage(t) - - case *types.Pointer: - elem := t.Elem() - if nt, ok := elem.(*types.Named); ok { - // Thanks to the ptrToThis member, pointers to named types appear - // in exactly the same objects as the named types themselves, so - // we can give them the same linkage. - linkage, emit = tm.getNamedTypeLinkage(nt) - return - } - linkage = llvm.LinkOnceODRLinkage - emit = true - - default: - linkage = llvm.LinkOnceODRLinkage - emit = true - } - - return -} - -type typeAndInfo struct { - typ types.Type - typeString string - tdi *typeDescInfo -} - -type byTypeName []typeAndInfo - -func (ts byTypeName) Len() int { return len(ts) } -func (ts byTypeName) Swap(i, j int) { - ts[i], ts[j] = ts[j], ts[i] -} -func (ts byTypeName) Less(i, j int) bool { - return ts[i].typeString < ts[j].typeString -} - -func (tm *TypeMap) emitTypeDescInitializers() { - var maxSize, maxAlign int64 - maxAlign = 1 - - for changed := true; changed; { - changed = false - - var ts []typeAndInfo - - tm.types.Iterate(func(key types.Type, value interface{}) { - tdi := value.(*typeDescInfo) - if tdi.global.Initializer().C == nil { - linkage, emit := tm.getTypeDescLinkage(key) - tdi.global.SetLinkage(linkage) - tdi.gc.SetLinkage(linkage) - if emit { - changed = true - ts = append(ts, typeAndInfo{key, key.String(), tdi}) - } - } - }) - - if changed { - sort.Sort(byTypeName(ts)) - for _, t := range ts { - tm.emitTypeDescInitializer(t.typ, t.tdi) - if size := tm.Sizeof(t.typ); size > maxSize { - maxSize = size - } - if align := tm.Alignof(t.typ); align > maxAlign { - maxAlign = align - } - } - } - } -} - -const ( - // From libgo/runtime/mgc0.h - gcOpcodeEND = iota - gcOpcodePTR - gcOpcodeAPTR - gcOpcodeARRAY_START - gcOpcodeARRAY_NEXT - gcOpcodeCALL - gcOpcodeCHAN_PTR - gcOpcodeSTRING - gcOpcodeEFACE - gcOpcodeIFACE - gcOpcodeSLICE - gcOpcodeREGION - - gcStackCapacity = 8 -) - -func (tm *TypeMap) makeGcInst(val int64) llvm.Value { - c := llvm.ConstInt(tm.inttype, uint64(val), false) - return llvm.ConstIntToPtr(c, llvm.PointerType(tm.ctx.Int8Type(), 0)) -} - -func (tm *TypeMap) appendGcInsts(insts []llvm.Value, t types.Type, offset, stackSize int64) []llvm.Value { - switch u := t.Underlying().(type) { - case *types.Basic: - switch u.Kind() { - case types.String: - insts = append(insts, tm.makeGcInst(gcOpcodeSTRING), tm.makeGcInst(offset)) - case types.UnsafePointer: - insts = append(insts, tm.makeGcInst(gcOpcodeAPTR), tm.makeGcInst(offset)) - } - case *types.Pointer: - insts = append(insts, tm.makeGcInst(gcOpcodePTR), tm.makeGcInst(offset), - tm.getGcPointer(u.Elem())) - case *types.Signature, *types.Map: - insts = append(insts, tm.makeGcInst(gcOpcodeAPTR), tm.makeGcInst(offset)) - case *types.Array: - if u.Len() == 0 { - return insts - } else if stackSize >= gcStackCapacity { - insts = append(insts, tm.makeGcInst(gcOpcodeREGION), tm.makeGcInst(offset), - tm.makeGcInst(tm.Sizeof(t)), tm.getGcPointer(t)) - } else { - insts = append(insts, tm.makeGcInst(gcOpcodeARRAY_START), tm.makeGcInst(offset), - tm.makeGcInst(u.Len()), tm.makeGcInst(tm.Sizeof(u.Elem()))) - insts = tm.appendGcInsts(insts, u.Elem(), 0, stackSize+1) - insts = append(insts, tm.makeGcInst(gcOpcodeARRAY_NEXT)) - } - case *types.Slice: - if tm.Sizeof(u.Elem()) == 0 { - insts = append(insts, tm.makeGcInst(gcOpcodeAPTR), tm.makeGcInst(offset)) - } else { - insts = append(insts, tm.makeGcInst(gcOpcodeSLICE), tm.makeGcInst(offset), - tm.getGcPointer(u.Elem())) - } - case *types.Chan: - insts = append(insts, tm.makeGcInst(gcOpcodeCHAN_PTR), tm.makeGcInst(offset), - tm.ToRuntime(t)) - case *types.Struct: - fields := make([]*types.Var, u.NumFields()) - for i := range fields { - fields[i] = u.Field(i) - } - offsets := tm.Offsetsof(fields) - - for i, field := range fields { - insts = tm.appendGcInsts(insts, field.Type(), offset+offsets[i], stackSize) - } - case *types.Interface: - if u.NumMethods() == 0 { - insts = append(insts, tm.makeGcInst(gcOpcodeEFACE), tm.makeGcInst(offset)) - } else { - insts = append(insts, tm.makeGcInst(gcOpcodeIFACE), tm.makeGcInst(offset)) - } - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } - - return insts -} - -func (tm *TypeMap) emitTypeDescInitializer(t types.Type, tdi *typeDescInfo) { - // initialize type descriptor - tdi.global.SetInitializer(tm.makeTypeDescInitializer(t)) - - // initialize GC program - insts := []llvm.Value{tm.makeGcInst(tm.Sizeof(t))} - insts = tm.appendGcInsts(insts, t, 0, 0) - insts = append(insts, tm.makeGcInst(gcOpcodeEND)) - - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - instArray := llvm.ConstArray(i8ptr, insts) - - newGc := llvm.AddGlobal(tm.module, instArray.Type(), "") - newGc.SetGlobalConstant(true) - newGc.SetInitializer(instArray) - gcName := tdi.gc.Name() - tdi.gc.SetName("") - newGc.SetName(gcName) - newGc.SetLinkage(tdi.gc.Linkage()) - - tdi.gc.ReplaceAllUsesWith(llvm.ConstBitCast(newGc, tdi.gc.Type())) - tdi.gc.EraseFromParentAsGlobal() - tdi.gc = llvm.Value{nil} - tdi.gcPtr = llvm.ConstBitCast(newGc, i8ptr) -} - -func (tm *TypeMap) makeTypeDescInitializer(t types.Type) llvm.Value { - switch u := t.Underlying().(type) { - case *types.Basic: - return tm.makeBasicType(t, u) - case *types.Pointer: - return tm.makePointerType(t, u) - case *types.Signature: - return tm.makeFuncType(t, u) - case *types.Array: - return tm.makeArrayType(t, u) - case *types.Slice: - return tm.makeSliceType(t, u) - case *types.Map: - return tm.makeMapType(t, u) - case *types.Chan: - return tm.makeChanType(t, u) - case *types.Struct: - return tm.makeStructType(t, u) - case *types.Interface: - return tm.makeInterfaceType(t, u) - default: - panic(fmt.Sprintf("unhandled type: %#v", t)) - } -} - -func (tm *TypeMap) getStructAlgorithms(st *types.Struct) algorithms { - if algs, ok := tm.algs.At(st).(algorithms); ok { - return algs - } - - hashes := make([]llvm.Value, st.NumFields()) - equals := make([]llvm.Value, st.NumFields()) - - for i := range hashes { - algs := tm.getAlgorithms(st.Field(i).Type()) - if algs.hashDescriptor == tm.algsError.hashDescriptor { - return algs - } - hashes[i], equals[i] = algs.hash, algs.equal - } - - i8ptr := llvm.PointerType(tm.ctx.Int8Type(), 0) - llsptrty := llvm.PointerType(tm.ToLLVM(st), 0) - - builder := tm.ctx.NewBuilder() - defer builder.Dispose() - - hashFunctionName := tm.mc.mangleHashFunctionName(st) - hash := llvm.AddFunction(tm.module, hashFunctionName, tm.hashFnType) - hash.SetLinkage(llvm.LinkOnceODRLinkage) - hashDescriptor := tm.createAlgorithmDescriptor(hashFunctionName+"_descriptor", hash) - - builder.SetInsertPointAtEnd(llvm.AddBasicBlock(hash, "entry")) - sptr := builder.CreateBitCast(hash.Param(0), llsptrty, "") - - hashval := llvm.ConstNull(tm.inttype) - i33 := llvm.ConstInt(tm.inttype, 33, false) - - for i, fhash := range hashes { - fptr := builder.CreateStructGEP(sptr, i, "") - fptr = builder.CreateBitCast(fptr, i8ptr, "") - fsize := llvm.ConstInt(tm.inttype, uint64(tm.sizes.Sizeof(st.Field(i).Type())), false) - hashcall := builder.CreateCall(fhash, []llvm.Value{fptr, fsize}, "") - hashval = builder.CreateMul(hashval, i33, "") - hashval = builder.CreateAdd(hashval, hashcall, "") - } - - builder.CreateRet(hashval) - - equalFunctionName := tm.mc.mangleEqualFunctionName(st) - equal := llvm.AddFunction(tm.module, equalFunctionName, tm.equalFnType) - equal.SetLinkage(llvm.LinkOnceODRLinkage) - equalDescriptor := tm.createAlgorithmDescriptor(equalFunctionName+"_descriptor", equal) - - eqentrybb := llvm.AddBasicBlock(equal, "entry") - eqretzerobb := llvm.AddBasicBlock(equal, "retzero") - builder.SetInsertPointAtEnd(eqentrybb) - s1ptr := builder.CreateBitCast(equal.Param(0), llsptrty, "") - s2ptr := builder.CreateBitCast(equal.Param(1), llsptrty, "") - - zerobool := llvm.ConstNull(tm.ctx.Int8Type()) - onebool := llvm.ConstInt(tm.ctx.Int8Type(), 1, false) - - for i, fequal := range equals { - f1ptr := builder.CreateStructGEP(s1ptr, i, "") - f1ptr = builder.CreateBitCast(f1ptr, i8ptr, "") - f2ptr := builder.CreateStructGEP(s2ptr, i, "") - f2ptr = builder.CreateBitCast(f2ptr, i8ptr, "") - fsize := llvm.ConstInt(tm.inttype, uint64(tm.sizes.Sizeof(st.Field(i).Type())), false) - equalcall := builder.CreateCall(fequal, []llvm.Value{f1ptr, f2ptr, fsize}, "") - equaleqzero := builder.CreateICmp(llvm.IntEQ, equalcall, zerobool, "") - contbb := llvm.AddBasicBlock(equal, "cont") - builder.CreateCondBr(equaleqzero, eqretzerobb, contbb) - builder.SetInsertPointAtEnd(contbb) - } - - builder.CreateRet(onebool) - - builder.SetInsertPointAtEnd(eqretzerobb) - builder.CreateRet(zerobool) - - algs := algorithms{ - hash: hash, - hashDescriptor: hashDescriptor, - equal: equal, - equalDescriptor: equalDescriptor, - } - tm.algs.Set(st, algs) - return algs -} - -func (tm *TypeMap) getArrayAlgorithms(at *types.Array) algorithms { - if algs, ok := tm.algs.At(at).(algorithms); ok { - return algs - } - - elemAlgs := tm.getAlgorithms(at.Elem()) - if elemAlgs.hashDescriptor == tm.algsError.hashDescriptor { - return elemAlgs - } - - i8ptr := llvm.PointerType(tm.ctx.Int8Type(), 0) - llelemty := llvm.PointerType(tm.ToLLVM(at.Elem()), 0) - - i1 := llvm.ConstInt(tm.inttype, 1, false) - alen := llvm.ConstInt(tm.inttype, uint64(at.Len()), false) - esize := llvm.ConstInt(tm.inttype, uint64(tm.sizes.Sizeof(at.Elem())), false) - - builder := tm.ctx.NewBuilder() - defer builder.Dispose() - - hashFunctionName := tm.mc.mangleHashFunctionName(at) - hash := llvm.AddFunction(tm.module, hashFunctionName, tm.hashFnType) - hash.SetLinkage(llvm.LinkOnceODRLinkage) - hashDescriptor := tm.createAlgorithmDescriptor(hashFunctionName+"_descriptor", hash) - equalFunctionName := tm.mc.mangleHashFunctionName(at) - equal := llvm.AddFunction(tm.module, equalFunctionName, tm.equalFnType) - equal.SetLinkage(llvm.LinkOnceODRLinkage) - equalDescriptor := tm.createAlgorithmDescriptor(equalFunctionName+"_descriptor", equal) - algs := algorithms{ - hash: hash, - hashDescriptor: hashDescriptor, - equal: equal, - equalDescriptor: equalDescriptor, - } - tm.algs.Set(at, algs) - - hashentrybb := llvm.AddBasicBlock(hash, "entry") - builder.SetInsertPointAtEnd(hashentrybb) - if at.Len() == 0 { - builder.CreateRet(llvm.ConstNull(tm.inttype)) - } else { - i33 := llvm.ConstInt(tm.inttype, 33, false) - - aptr := builder.CreateBitCast(hash.Param(0), llelemty, "") - loopbb := llvm.AddBasicBlock(hash, "loop") - builder.CreateBr(loopbb) - - exitbb := llvm.AddBasicBlock(hash, "exit") - - builder.SetInsertPointAtEnd(loopbb) - indexphi := builder.CreatePHI(tm.inttype, "") - index := indexphi - hashvalphi := builder.CreatePHI(tm.inttype, "") - hashval := hashvalphi - - eptr := builder.CreateGEP(aptr, []llvm.Value{index}, "") - eptr = builder.CreateBitCast(eptr, i8ptr, "") - - hashcall := builder.CreateCall(elemAlgs.hash, []llvm.Value{eptr, esize}, "") - hashval = builder.CreateMul(hashval, i33, "") - hashval = builder.CreateAdd(hashval, hashcall, "") - - index = builder.CreateAdd(index, i1, "") - - indexphi.AddIncoming( - []llvm.Value{llvm.ConstNull(tm.inttype), index}, - []llvm.BasicBlock{hashentrybb, loopbb}, - ) - hashvalphi.AddIncoming( - []llvm.Value{llvm.ConstNull(tm.inttype), hashval}, - []llvm.BasicBlock{hashentrybb, loopbb}, - ) - - exit := builder.CreateICmp(llvm.IntEQ, index, alen, "") - builder.CreateCondBr(exit, exitbb, loopbb) - - builder.SetInsertPointAtEnd(exitbb) - builder.CreateRet(hashval) - } - - zerobool := llvm.ConstNull(tm.ctx.Int8Type()) - onebool := llvm.ConstInt(tm.ctx.Int8Type(), 1, false) - - eqentrybb := llvm.AddBasicBlock(equal, "entry") - builder.SetInsertPointAtEnd(eqentrybb) - if at.Len() == 0 { - builder.CreateRet(onebool) - } else { - a1ptr := builder.CreateBitCast(equal.Param(0), llelemty, "") - a2ptr := builder.CreateBitCast(equal.Param(1), llelemty, "") - loopbb := llvm.AddBasicBlock(equal, "loop") - builder.CreateBr(loopbb) - - exitbb := llvm.AddBasicBlock(equal, "exit") - retzerobb := llvm.AddBasicBlock(equal, "retzero") - - builder.SetInsertPointAtEnd(loopbb) - indexphi := builder.CreatePHI(tm.inttype, "") - index := indexphi - - e1ptr := builder.CreateGEP(a1ptr, []llvm.Value{index}, "") - e1ptr = builder.CreateBitCast(e1ptr, i8ptr, "") - e2ptr := builder.CreateGEP(a2ptr, []llvm.Value{index}, "") - e2ptr = builder.CreateBitCast(e2ptr, i8ptr, "") - - equalcall := builder.CreateCall(elemAlgs.equal, []llvm.Value{e1ptr, e2ptr, esize}, "") - equaleqzero := builder.CreateICmp(llvm.IntEQ, equalcall, zerobool, "") - - contbb := llvm.AddBasicBlock(equal, "cont") - builder.CreateCondBr(equaleqzero, retzerobb, contbb) - - builder.SetInsertPointAtEnd(contbb) - - index = builder.CreateAdd(index, i1, "") - - indexphi.AddIncoming( - []llvm.Value{llvm.ConstNull(tm.inttype), index}, - []llvm.BasicBlock{eqentrybb, contbb}, - ) - - exit := builder.CreateICmp(llvm.IntEQ, index, alen, "") - builder.CreateCondBr(exit, exitbb, loopbb) - - builder.SetInsertPointAtEnd(exitbb) - builder.CreateRet(onebool) - - builder.SetInsertPointAtEnd(retzerobb) - builder.CreateRet(zerobool) - } - - return algs -} - -func (tm *TypeMap) createAlgorithmDescriptor(name string, fn llvm.Value) llvm.Value { - d := llvm.AddGlobal(tm.module, tm.funcValType, name) - d.SetLinkage(llvm.LinkOnceODRLinkage) - d.SetGlobalConstant(true) - fn = llvm.ConstBitCast(fn, tm.funcValType.StructElementTypes()[0]) - init := llvm.ConstNull(tm.funcValType) - init = llvm.ConstInsertValue(init, fn, []uint32{0}) - d.SetInitializer(init) - return d -} - -func (tm *TypeMap) getAlgorithms(t types.Type) algorithms { - switch t := t.Underlying().(type) { - case *types.Interface: - if t.NumMethods() == 0 { - return tm.algsEmptyInterface - } - return tm.algsInterface - case *types.Basic: - switch t.Kind() { - case types.Float32, types.Float64: - return tm.algsFloat - case types.Complex64, types.Complex128: - return tm.algsComplex - case types.String: - return tm.algsString - } - return tm.algsIdentity - case *types.Signature, *types.Map, *types.Slice: - return tm.algsError - case *types.Struct: - return tm.getStructAlgorithms(t) - case *types.Array: - return tm.getArrayAlgorithms(t) - } - return tm.algsIdentity -} - -func (tm *TypeMap) getTypeDescInfo(t types.Type) *typeDescInfo { - if tdi, ok := tm.types.At(t).(*typeDescInfo); ok { - return tdi - } - - var b bytes.Buffer - tm.mc.mangleTypeDescriptorName(t, &b) - - global := llvm.AddGlobal(tm.module, tm.getTypeDescType(t), b.String()) - global.SetGlobalConstant(true) - ptr := llvm.ConstBitCast(global, llvm.PointerType(tm.commonTypeType, 0)) - - gc := llvm.AddGlobal(tm.module, llvm.PointerType(llvm.Int8Type(), 0), b.String()+"$gc") - gc.SetGlobalConstant(true) - gcPtr := llvm.ConstBitCast(gc, llvm.PointerType(tm.ctx.Int8Type(), 0)) - - var mapDescPtr llvm.Value - if m, ok := t.Underlying().(*types.Map); ok { - var mapb bytes.Buffer - tm.mc.mangleMapDescriptorName(t, &mapb) - - mapDescPtr = llvm.AddGlobal(tm.module, tm.mapDescType, mapb.String()) - mapDescPtr.SetGlobalConstant(true) - mapDescPtr.SetLinkage(llvm.LinkOnceODRLinkage) - mapDescPtr.SetInitializer(tm.makeMapDesc(ptr, m)) - } - - tdi := &typeDescInfo{ - global: global, - commonTypePtr: ptr, - mapDescPtr: mapDescPtr, - gc: gc, - gcPtr: gcPtr, - } - tm.types.Set(t, tdi) - return tdi -} - -func (tm *TypeMap) getTypeDescriptorPointer(t types.Type) llvm.Value { - return tm.getTypeDescInfo(t).commonTypePtr -} - -func (tm *TypeMap) getMapDescriptorPointer(t types.Type) llvm.Value { - return tm.getTypeDescInfo(t).mapDescPtr -} - -func (tm *TypeMap) getGcPointer(t types.Type) llvm.Value { - return tm.getTypeDescInfo(t).gcPtr -} - -func (tm *TypeMap) getItabPointer(srctype types.Type, targettype *types.Interface) llvm.Value { - if targettype.NumMethods() == 0 { - return tm.ToRuntime(srctype) - } else { - return tm.getImtPointer(srctype, targettype) - } -} - -func (tm *TypeMap) getImtPointer(srctype types.Type, targettype *types.Interface) llvm.Value { - tdi := tm.getTypeDescInfo(srctype) - - if ptr, ok := tdi.interfaceMethodTables.At(targettype).(llvm.Value); ok { - return ptr - } - - srcms := tm.MethodSet(srctype) - targetms := tm.MethodSet(targettype) - - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - - elems := make([]llvm.Value, targetms.Len()+1) - elems[0] = tm.ToRuntime(srctype) - for i, targetm := range orderedMethodSet(targetms) { - srcm := srcms.Lookup(targetm.Obj().Pkg(), targetm.Obj().Name()) - - elems[i+1] = tm.methodResolver.ResolveMethod(srcm).value - } - imtinit := llvm.ConstArray(i8ptr, elems) - - var b bytes.Buffer - tm.mc.mangleImtName(srctype, targettype, &b) - imt := llvm.AddGlobal(tm.module, imtinit.Type(), b.String()) - imt.SetGlobalConstant(true) - imt.SetInitializer(imtinit) - imt.SetLinkage(llvm.LinkOnceODRLinkage) - - imtptr := llvm.ConstBitCast(imt, i8ptr) - tdi.interfaceMethodTables.Set(targettype, imtptr) - return imtptr -} - -const ( - // From gofrontend/types.h - gccgoRuntimeTypeKindBOOL = 1 - gccgoRuntimeTypeKindINT = 2 - gccgoRuntimeTypeKindINT8 = 3 - gccgoRuntimeTypeKindINT16 = 4 - gccgoRuntimeTypeKindINT32 = 5 - gccgoRuntimeTypeKindINT64 = 6 - gccgoRuntimeTypeKindUINT = 7 - gccgoRuntimeTypeKindUINT8 = 8 - gccgoRuntimeTypeKindUINT16 = 9 - gccgoRuntimeTypeKindUINT32 = 10 - gccgoRuntimeTypeKindUINT64 = 11 - gccgoRuntimeTypeKindUINTPTR = 12 - gccgoRuntimeTypeKindFLOAT32 = 13 - gccgoRuntimeTypeKindFLOAT64 = 14 - gccgoRuntimeTypeKindCOMPLEX64 = 15 - gccgoRuntimeTypeKindCOMPLEX128 = 16 - gccgoRuntimeTypeKindARRAY = 17 - gccgoRuntimeTypeKindCHAN = 18 - gccgoRuntimeTypeKindFUNC = 19 - gccgoRuntimeTypeKindINTERFACE = 20 - gccgoRuntimeTypeKindMAP = 21 - gccgoRuntimeTypeKindPTR = 22 - gccgoRuntimeTypeKindSLICE = 23 - gccgoRuntimeTypeKindSTRING = 24 - gccgoRuntimeTypeKindSTRUCT = 25 - gccgoRuntimeTypeKindUNSAFE_POINTER = 26 - gccgoRuntimeTypeKindDIRECT_IFACE = (1 << 5) - gccgoRuntimeTypeKindNO_POINTERS = (1 << 7) -) - -func hasPointers(t types.Type) bool { - switch t := t.(type) { - case *types.Basic: - return t.Kind() == types.String || t.Kind() == types.UnsafePointer - - case *types.Signature, *types.Pointer, *types.Slice, *types.Map, *types.Chan, *types.Interface: - return true - - case *types.Struct: - for i := 0; i != t.NumFields(); i++ { - if hasPointers(t.Field(i).Type()) { - return true - } - } - return false - - case *types.Named: - return hasPointers(t.Underlying()) - - case *types.Array: - return hasPointers(t.Elem()) - - default: - panic("unrecognized type") - } -} - -func runtimeTypeKind(t types.Type) (k uint8) { - switch t := t.(type) { - case *types.Basic: - switch t.Kind() { - case types.Bool: - k = gccgoRuntimeTypeKindBOOL - case types.Int: - k = gccgoRuntimeTypeKindINT - case types.Int8: - k = gccgoRuntimeTypeKindINT8 - case types.Int16: - k = gccgoRuntimeTypeKindINT16 - case types.Int32: - k = gccgoRuntimeTypeKindINT32 - case types.Int64: - k = gccgoRuntimeTypeKindINT64 - case types.Uint: - k = gccgoRuntimeTypeKindUINT - case types.Uint8: - k = gccgoRuntimeTypeKindUINT8 - case types.Uint16: - k = gccgoRuntimeTypeKindUINT16 - case types.Uint32: - k = gccgoRuntimeTypeKindUINT32 - case types.Uint64: - k = gccgoRuntimeTypeKindUINT64 - case types.Uintptr: - k = gccgoRuntimeTypeKindUINTPTR - case types.Float32: - k = gccgoRuntimeTypeKindFLOAT32 - case types.Float64: - k = gccgoRuntimeTypeKindFLOAT64 - case types.Complex64: - k = gccgoRuntimeTypeKindCOMPLEX64 - case types.Complex128: - k = gccgoRuntimeTypeKindCOMPLEX128 - case types.String: - k = gccgoRuntimeTypeKindSTRING - case types.UnsafePointer: - k = gccgoRuntimeTypeKindUNSAFE_POINTER | gccgoRuntimeTypeKindDIRECT_IFACE - default: - panic("unrecognized builtin type") - } - case *types.Array: - k = gccgoRuntimeTypeKindARRAY - case *types.Slice: - k = gccgoRuntimeTypeKindSLICE - case *types.Struct: - k = gccgoRuntimeTypeKindSTRUCT - case *types.Pointer: - k = gccgoRuntimeTypeKindPTR | gccgoRuntimeTypeKindDIRECT_IFACE - case *types.Signature: - k = gccgoRuntimeTypeKindFUNC - case *types.Interface: - k = gccgoRuntimeTypeKindINTERFACE - case *types.Map: - k = gccgoRuntimeTypeKindMAP - case *types.Chan: - k = gccgoRuntimeTypeKindCHAN - case *types.Named: - return runtimeTypeKind(t.Underlying()) - default: - panic("unrecognized type") - } - - if !hasPointers(t) { - k |= gccgoRuntimeTypeKindNO_POINTERS - } - - return -} - -func (tm *TypeMap) makeCommonType(t types.Type) llvm.Value { - var vals [11]llvm.Value - vals[0] = llvm.ConstInt(tm.ctx.Int8Type(), uint64(runtimeTypeKind(t)), false) - vals[1] = llvm.ConstInt(tm.ctx.Int8Type(), uint64(tm.Alignof(t)), false) - vals[2] = vals[1] - vals[3] = llvm.ConstInt(tm.inttype, uint64(tm.Sizeof(t)), false) - vals[4] = llvm.ConstInt(tm.ctx.Int32Type(), uint64(tm.getTypeHash(t)), false) - algs := tm.getAlgorithms(t) - vals[5] = algs.hashDescriptor - vals[6] = algs.equalDescriptor - vals[7] = tm.getGcPointer(t) - var b bytes.Buffer - tm.writeType(t, &b) - vals[8] = tm.globalStringPtr(b.String()) - vals[9] = tm.makeUncommonTypePtr(t) - switch t.(type) { - case *types.Named, *types.Struct: - vals[10] = tm.getTypeDescriptorPointer(types.NewPointer(t)) - default: - vals[10] = llvm.ConstPointerNull(llvm.PointerType(tm.commonTypeType, 0)) - } - return llvm.ConstNamedStruct(tm.commonTypeType, vals[:]) -} - -func (tm *TypeMap) makeBasicType(t types.Type, u *types.Basic) llvm.Value { - return tm.makeCommonType(t) -} - -func (tm *TypeMap) makeArrayType(t types.Type, a *types.Array) llvm.Value { - var vals [4]llvm.Value - vals[0] = tm.makeCommonType(t) - vals[1] = tm.getTypeDescriptorPointer(a.Elem()) - vals[2] = tm.getTypeDescriptorPointer(types.NewSlice(a.Elem())) - vals[3] = llvm.ConstInt(tm.inttype, uint64(a.Len()), false) - - return llvm.ConstNamedStruct(tm.arrayTypeType, vals[:]) -} - -func (tm *TypeMap) makeSliceType(t types.Type, s *types.Slice) llvm.Value { - var vals [2]llvm.Value - vals[0] = tm.makeCommonType(t) - vals[1] = tm.getTypeDescriptorPointer(s.Elem()) - - return llvm.ConstNamedStruct(tm.sliceTypeType, vals[:]) -} - -func (tm *TypeMap) makeStructType(t types.Type, s *types.Struct) llvm.Value { - var vals [2]llvm.Value - vals[0] = tm.makeCommonType(t) - - fieldVars := make([]*types.Var, s.NumFields()) - for i := range fieldVars { - fieldVars[i] = s.Field(i) - } - offsets := tm.Offsetsof(fieldVars) - structFields := make([]llvm.Value, len(fieldVars)) - for i, field := range fieldVars { - var sfvals [5]llvm.Value - if !field.Anonymous() { - sfvals[0] = tm.globalStringPtr(field.Name()) - } else { - sfvals[0] = llvm.ConstPointerNull(llvm.PointerType(tm.stringType, 0)) - } - if !field.Exported() && field.Pkg() != nil { - sfvals[1] = tm.globalStringPtr(field.Pkg().Path()) - } else { - sfvals[1] = llvm.ConstPointerNull(llvm.PointerType(tm.stringType, 0)) - } - sfvals[2] = tm.getTypeDescriptorPointer(field.Type()) - if tag := s.Tag(i); tag != "" { - sfvals[3] = tm.globalStringPtr(tag) - } else { - sfvals[3] = llvm.ConstPointerNull(llvm.PointerType(tm.stringType, 0)) - } - sfvals[4] = llvm.ConstInt(tm.inttype, uint64(offsets[i]), false) - - structFields[i] = llvm.ConstNamedStruct(tm.structFieldType, sfvals[:]) - } - vals[1] = tm.makeSlice(structFields, tm.structFieldSliceType) - - return llvm.ConstNamedStruct(tm.structTypeType, vals[:]) -} - -func (tm *TypeMap) makePointerType(t types.Type, p *types.Pointer) llvm.Value { - var vals [2]llvm.Value - vals[0] = tm.makeCommonType(t) - vals[1] = tm.getTypeDescriptorPointer(p.Elem()) - - return llvm.ConstNamedStruct(tm.ptrTypeType, vals[:]) -} - -func (tm *TypeMap) rtypeSlice(t *types.Tuple) llvm.Value { - rtypes := make([]llvm.Value, t.Len()) - for i := range rtypes { - rtypes[i] = tm.getTypeDescriptorPointer(t.At(i).Type()) - } - return tm.makeSlice(rtypes, tm.typeSliceType) -} - -func (tm *TypeMap) makeFuncType(t types.Type, f *types.Signature) llvm.Value { - var vals [4]llvm.Value - vals[0] = tm.makeCommonType(t) - // dotdotdot - variadic := 0 - if f.Variadic() { - variadic = 1 - } - vals[1] = llvm.ConstInt(llvm.Int8Type(), uint64(variadic), false) - // in - vals[2] = tm.rtypeSlice(f.Params()) - // out - vals[3] = tm.rtypeSlice(f.Results()) - - return llvm.ConstNamedStruct(tm.funcTypeType, vals[:]) -} - -func (tm *TypeMap) makeInterfaceType(t types.Type, i *types.Interface) llvm.Value { - var vals [2]llvm.Value - vals[0] = tm.makeCommonType(t) - - methodset := tm.MethodSet(i) - imethods := make([]llvm.Value, methodset.Len()) - for index, ms := range orderedMethodSet(methodset) { - method := ms.Obj() - var imvals [3]llvm.Value - imvals[0] = tm.globalStringPtr(method.Name()) - if !method.Exported() && method.Pkg() != nil { - imvals[1] = tm.globalStringPtr(method.Pkg().Path()) - } else { - imvals[1] = llvm.ConstPointerNull(llvm.PointerType(tm.stringType, 0)) - } - mtyp := method.Type().(*types.Signature) - mftyp := types.NewSignature(nil, nil, mtyp.Params(), mtyp.Results(), mtyp.Variadic()) - imvals[2] = tm.getTypeDescriptorPointer(mftyp) - - imethods[index] = llvm.ConstNamedStruct(tm.imethodType, imvals[:]) - } - vals[1] = tm.makeSlice(imethods, tm.imethodSliceType) - - return llvm.ConstNamedStruct(tm.interfaceTypeType, vals[:]) -} - -func (tm *TypeMap) makeMapType(t types.Type, m *types.Map) llvm.Value { - var vals [3]llvm.Value - vals[0] = tm.makeCommonType(t) - vals[1] = tm.getTypeDescriptorPointer(m.Key()) - vals[2] = tm.getTypeDescriptorPointer(m.Elem()) - - return llvm.ConstNamedStruct(tm.mapTypeType, vals[:]) -} - -func (tm *TypeMap) makeMapDesc(ptr llvm.Value, m *types.Map) llvm.Value { - mapEntryType := structBType{[]backendType{ - tm.getBackendType(types.Typ[types.UnsafePointer]), - tm.getBackendType(m.Key()), - tm.getBackendType(m.Elem()), - }}.ToLLVM(tm.ctx) - - var vals [4]llvm.Value - // map_descriptor - vals[0] = ptr - // entry_size - vals[1] = llvm.ConstInt(tm.inttype, tm.target.TypeAllocSize(mapEntryType), false) - // key_offset - vals[2] = llvm.ConstInt(tm.inttype, tm.target.ElementOffset(mapEntryType, 1), false) - // value_offset - vals[3] = llvm.ConstInt(tm.inttype, tm.target.ElementOffset(mapEntryType, 2), false) - - return llvm.ConstNamedStruct(tm.mapDescType, vals[:]) -} - -func (tm *TypeMap) makeChanType(t types.Type, c *types.Chan) llvm.Value { - var vals [3]llvm.Value - vals[0] = tm.makeCommonType(t) - vals[1] = tm.getTypeDescriptorPointer(c.Elem()) - - // From gofrontend/go/types.cc - // These bits must match the ones in libgo/runtime/go-type.h. - var dir int - switch c.Dir() { - case types.RecvOnly: - dir = 1 - case types.SendOnly: - dir = 2 - case types.SendRecv: - dir = 3 - } - vals[2] = llvm.ConstInt(tm.inttype, uint64(dir), false) - - return llvm.ConstNamedStruct(tm.chanTypeType, vals[:]) -} - -func (tm *TypeMap) makeUncommonTypePtr(t types.Type) llvm.Value { - _, isbasic := t.(*types.Basic) - _, isnamed := t.(*types.Named) - - var mset types.MethodSet - // We store interface methods on the interface type. - if _, ok := t.Underlying().(*types.Interface); !ok { - mset = *tm.MethodSet(t) - } - - if !isbasic && !isnamed && mset.Len() == 0 { - return llvm.ConstPointerNull(llvm.PointerType(tm.uncommonTypeType, 0)) - } - - var vals [3]llvm.Value - - nullStringPtr := llvm.ConstPointerNull(llvm.PointerType(tm.stringType, 0)) - vals[0] = nullStringPtr - vals[1] = nullStringPtr - - if isbasic || isnamed { - nti := tm.mc.getNamedTypeInfo(t) - vals[0] = tm.globalStringPtr(nti.name) - if nti.pkgpath != "" { - path := nti.pkgpath - if nti.functionName != "" { - path += "." + nti.functionName - if nti.scopeNum != 0 { - path += "$" + strconv.Itoa(nti.scopeNum) - } - } - vals[1] = tm.globalStringPtr(path) - } - } - - // Store methods. All methods must be stored, not only exported ones; - // this is to allow satisfying of interfaces with non-exported methods. - methods := make([]llvm.Value, mset.Len()) - omset := orderedMethodSet(&mset) - for i := range methods { - var mvals [5]llvm.Value - - sel := omset[i] - mname := sel.Obj().Name() - mfunc := tm.methodResolver.ResolveMethod(sel) - ftyp := mfunc.Type().(*types.Signature) - - // name - mvals[0] = tm.globalStringPtr(mname) - - // pkgPath - mvals[1] = nullStringPtr - if pkg := sel.Obj().Pkg(); pkg != nil && !sel.Obj().Exported() { - mvals[1] = tm.globalStringPtr(pkg.Path()) - } - - // mtyp (method type, no receiver) - mftyp := types.NewSignature(nil, nil, ftyp.Params(), ftyp.Results(), ftyp.Variadic()) - mvals[2] = tm.getTypeDescriptorPointer(mftyp) - - // typ (function type, with receiver) - recvparam := types.NewParam(0, nil, "", t) - params := ftyp.Params() - rfparams := make([]*types.Var, params.Len()+1) - rfparams[0] = recvparam - for i := 0; i != ftyp.Params().Len(); i++ { - rfparams[i+1] = params.At(i) - } - rftyp := types.NewSignature(nil, nil, types.NewTuple(rfparams...), ftyp.Results(), ftyp.Variadic()) - mvals[3] = tm.getTypeDescriptorPointer(rftyp) - - // function - mvals[4] = mfunc.value - - methods[i] = llvm.ConstNamedStruct(tm.methodType, mvals[:]) - } - - vals[2] = tm.makeSlice(methods, tm.methodSliceType) - - uncommonType := llvm.ConstNamedStruct(tm.uncommonTypeType, vals[:]) - - uncommonTypePtr := llvm.AddGlobal(tm.module, tm.uncommonTypeType, "") - uncommonTypePtr.SetGlobalConstant(true) - uncommonTypePtr.SetInitializer(uncommonType) - uncommonTypePtr.SetLinkage(llvm.InternalLinkage) - return uncommonTypePtr -} - -// globalStringPtr returns a *string with the specified value. -func (tm *TypeMap) globalStringPtr(value string) llvm.Value { - strval := llvm.ConstString(value, false) - strglobal := llvm.AddGlobal(tm.module, strval.Type(), "") - strglobal.SetGlobalConstant(true) - strglobal.SetLinkage(llvm.InternalLinkage) - strglobal.SetInitializer(strval) - strglobal = llvm.ConstBitCast(strglobal, llvm.PointerType(llvm.Int8Type(), 0)) - strlen := llvm.ConstInt(tm.inttype, uint64(len(value)), false) - str := llvm.ConstStruct([]llvm.Value{strglobal, strlen}, false) - g := llvm.AddGlobal(tm.module, str.Type(), "") - g.SetGlobalConstant(true) - g.SetLinkage(llvm.InternalLinkage) - g.SetInitializer(str) - return g -} - -func (tm *TypeMap) makeNamedSliceType(tname string, elemtyp llvm.Type) llvm.Type { - t := tm.ctx.StructCreateNamed(tname) - t.StructSetBody([]llvm.Type{ - llvm.PointerType(elemtyp, 0), - tm.inttype, - tm.inttype, - }, false) - return t -} - -func (tm *TypeMap) makeSlice(values []llvm.Value, slicetyp llvm.Type) llvm.Value { - ptrtyp := slicetyp.StructElementTypes()[0] - var globalptr llvm.Value - if len(values) > 0 { - array := llvm.ConstArray(ptrtyp.ElementType(), values) - globalptr = llvm.AddGlobal(tm.module, array.Type(), "") - globalptr.SetGlobalConstant(true) - globalptr.SetLinkage(llvm.InternalLinkage) - globalptr.SetInitializer(array) - globalptr = llvm.ConstBitCast(globalptr, ptrtyp) - } else { - globalptr = llvm.ConstNull(ptrtyp) - } - len_ := llvm.ConstInt(tm.inttype, uint64(len(values)), false) - slice := llvm.ConstNull(slicetyp) - slice = llvm.ConstInsertValue(slice, globalptr, []uint32{0}) - slice = llvm.ConstInsertValue(slice, len_, []uint32{1}) - slice = llvm.ConstInsertValue(slice, len_, []uint32{2}) - return slice -} - -func isGlobalObject(obj types.Object) bool { - pkg := obj.Pkg() - return pkg == nil || obj.Parent() == pkg.Scope() -} diff --git a/llgo/irgen/types.go b/llgo/irgen/types.go deleted file mode 100644 index ed1aac2873e9b94b8cd522c1f65c98a418d7341f..0000000000000000000000000000000000000000 --- a/llgo/irgen/types.go +++ /dev/null @@ -1,21 +0,0 @@ -//===- types.go - convenience functions for types -------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements convenience functions for dealing with types. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" -) - -func deref(t types.Type) types.Type { - return t.Underlying().(*types.Pointer).Elem() -} diff --git a/llgo/irgen/utils.go b/llgo/irgen/utils.go deleted file mode 100644 index 2efdc8454583da091b285bfec2c06b13fcd87742..0000000000000000000000000000000000000000 --- a/llgo/irgen/utils.go +++ /dev/null @@ -1,39 +0,0 @@ -//===- utils.go - misc utils ----------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file implements misellaneous utilities for IR generation. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -func (fr *frame) loadOrNull(cond, ptr llvm.Value, ty types.Type) *govalue { - startbb := fr.builder.GetInsertBlock() - loadbb := llvm.AddBasicBlock(fr.function, "") - contbb := llvm.AddBasicBlock(fr.function, "") - fr.builder.CreateCondBr(cond, loadbb, contbb) - - fr.builder.SetInsertPointAtEnd(loadbb) - llty := fr.types.ToLLVM(ty) - typedptr := fr.builder.CreateBitCast(ptr, llvm.PointerType(llty, 0), "") - loadedval := fr.builder.CreateLoad(typedptr, "") - fr.builder.CreateBr(contbb) - - fr.builder.SetInsertPointAtEnd(contbb) - llv := fr.builder.CreatePHI(llty, "") - llv.AddIncoming( - []llvm.Value{llvm.ConstNull(llty), loadedval}, - []llvm.BasicBlock{startbb, loadbb}, - ) - return newValue(llv, ty) -} diff --git a/llgo/irgen/value.go b/llgo/irgen/value.go deleted file mode 100644 index 8b70e015edb6f250649d37bf8a62cd0560736ae6..0000000000000000000000000000000000000000 --- a/llgo/irgen/value.go +++ /dev/null @@ -1,637 +0,0 @@ -//===- value.go - govalue and operations ----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file defines the govalue type, which combines an LLVM value with its Go -// type, and implements various basic operations on govalues. -// -//===----------------------------------------------------------------------===// - -package irgen - -import ( - "fmt" - "go/token" - - "llvm.org/llgo/third_party/gotools/go/exact" - "llvm.org/llgo/third_party/gotools/go/types" - "llvm.org/llvm/bindings/go/llvm" -) - -// govalue contains an LLVM value and a Go type, -// representing the result of a Go expression. -type govalue struct { - value llvm.Value - typ types.Type -} - -func (v *govalue) String() string { - return fmt.Sprintf("[llgo.govalue typ:%s value:%v]", v.typ, v.value) -} - -// Create a new dynamic value from a (LLVM Value, Type) pair. -func newValue(v llvm.Value, t types.Type) *govalue { - return &govalue{v, t} -} - -// TODO(axw) remove this, use .typ directly -func (v *govalue) Type() types.Type { - return v.typ -} - -// newValueFromConst converts a constant value to an LLVM value. -func (fr *frame) newValueFromConst(v exact.Value, typ types.Type) *govalue { - switch { - case v == nil: - llvmtyp := fr.types.ToLLVM(typ) - return newValue(llvm.ConstNull(llvmtyp), typ) - - case isString(typ): - if isUntyped(typ) { - typ = types.Typ[types.String] - } - llvmtyp := fr.types.ToLLVM(typ) - strval := exact.StringVal(v) - strlen := len(strval) - i8ptr := llvm.PointerType(llvm.Int8Type(), 0) - var ptr llvm.Value - if strlen > 0 { - init := llvm.ConstString(strval, false) - ptr = llvm.AddGlobal(fr.module.Module, init.Type(), "") - ptr.SetInitializer(init) - ptr.SetLinkage(llvm.InternalLinkage) - ptr = llvm.ConstBitCast(ptr, i8ptr) - } else { - ptr = llvm.ConstNull(i8ptr) - } - len_ := llvm.ConstInt(fr.types.inttype, uint64(strlen), false) - llvmvalue := llvm.Undef(llvmtyp) - llvmvalue = llvm.ConstInsertValue(llvmvalue, ptr, []uint32{0}) - llvmvalue = llvm.ConstInsertValue(llvmvalue, len_, []uint32{1}) - return newValue(llvmvalue, typ) - - case isInteger(typ): - if isUntyped(typ) { - typ = types.Typ[types.Int] - } - llvmtyp := fr.types.ToLLVM(typ) - var llvmvalue llvm.Value - if isUnsigned(typ) { - v, _ := exact.Uint64Val(v) - llvmvalue = llvm.ConstInt(llvmtyp, v, false) - } else { - v, _ := exact.Int64Val(v) - llvmvalue = llvm.ConstInt(llvmtyp, uint64(v), true) - } - return newValue(llvmvalue, typ) - - case isBoolean(typ): - if isUntyped(typ) { - typ = types.Typ[types.Bool] - } - return newValue(boolLLVMValue(exact.BoolVal(v)), typ) - - case isFloat(typ): - if isUntyped(typ) { - typ = types.Typ[types.Float64] - } - llvmtyp := fr.types.ToLLVM(typ) - floatval, _ := exact.Float64Val(v) - llvmvalue := llvm.ConstFloat(llvmtyp, floatval) - return newValue(llvmvalue, typ) - - case typ == types.Typ[types.UnsafePointer]: - llvmtyp := fr.types.ToLLVM(typ) - v, _ := exact.Uint64Val(v) - llvmvalue := llvm.ConstInt(fr.types.inttype, v, false) - llvmvalue = llvm.ConstIntToPtr(llvmvalue, llvmtyp) - return newValue(llvmvalue, typ) - - case isComplex(typ): - if isUntyped(typ) { - typ = types.Typ[types.Complex128] - } - llvmtyp := fr.types.ToLLVM(typ) - floattyp := llvmtyp.StructElementTypes()[0] - llvmvalue := llvm.ConstNull(llvmtyp) - realv := exact.Real(v) - imagv := exact.Imag(v) - realfloatval, _ := exact.Float64Val(realv) - imagfloatval, _ := exact.Float64Val(imagv) - llvmre := llvm.ConstFloat(floattyp, realfloatval) - llvmim := llvm.ConstFloat(floattyp, imagfloatval) - llvmvalue = llvm.ConstInsertValue(llvmvalue, llvmre, []uint32{0}) - llvmvalue = llvm.ConstInsertValue(llvmvalue, llvmim, []uint32{1}) - return newValue(llvmvalue, typ) - } - - // Special case for string -> [](byte|rune) - if u, ok := typ.Underlying().(*types.Slice); ok && isInteger(u.Elem()) { - if v.Kind() == exact.String { - strval := fr.newValueFromConst(v, types.Typ[types.String]) - return fr.convert(strval, typ) - } - } - - panic(fmt.Sprintf("unhandled: t=%s(%T), v=%v(%T)", typ, typ, v, v)) -} - -func (fr *frame) binaryOp(lhs *govalue, op token.Token, rhs *govalue) *govalue { - if op == token.NEQ { - result := fr.binaryOp(lhs, token.EQL, rhs) - return fr.unaryOp(result, token.NOT) - } - - var result llvm.Value - b := fr.builder - - switch typ := lhs.typ.Underlying().(type) { - case *types.Struct: - // TODO(axw) use runtime equality algorithm (will be suitably inlined). - // For now, we use compare all fields unconditionally and bitwise AND - // to avoid branching (i.e. so we don't create additional blocks). - value := newValue(boolLLVMValue(true), types.Typ[types.Bool]) - for i := 0; i < typ.NumFields(); i++ { - t := typ.Field(i).Type() - lhs := newValue(b.CreateExtractValue(lhs.value, i, ""), t) - rhs := newValue(b.CreateExtractValue(rhs.value, i, ""), t) - value = fr.binaryOp(value, token.AND, fr.binaryOp(lhs, token.EQL, rhs)) - } - return value - - case *types.Array: - // TODO(pcc): as above. - value := newValue(boolLLVMValue(true), types.Typ[types.Bool]) - t := typ.Elem() - for i := int64(0); i < typ.Len(); i++ { - lhs := newValue(b.CreateExtractValue(lhs.value, int(i), ""), t) - rhs := newValue(b.CreateExtractValue(rhs.value, int(i), ""), t) - value = fr.binaryOp(value, token.AND, fr.binaryOp(lhs, token.EQL, rhs)) - } - return value - - case *types.Slice: - // []T == nil or nil == []T - lhsptr := b.CreateExtractValue(lhs.value, 0, "") - rhsptr := b.CreateExtractValue(rhs.value, 0, "") - isnil := b.CreateICmp(llvm.IntEQ, lhsptr, rhsptr, "") - isnil = b.CreateZExt(isnil, llvm.Int8Type(), "") - return newValue(isnil, types.Typ[types.Bool]) - - case *types.Signature: - // func == nil or nil == func - isnil := b.CreateICmp(llvm.IntEQ, lhs.value, rhs.value, "") - isnil = b.CreateZExt(isnil, llvm.Int8Type(), "") - return newValue(isnil, types.Typ[types.Bool]) - - case *types.Interface: - return fr.compareInterfaces(lhs, rhs) - } - - // Strings. - if isString(lhs.typ) { - if isString(rhs.typ) { - switch op { - case token.ADD: - return fr.concatenateStrings(lhs, rhs) - case token.EQL, token.LSS, token.GTR, token.LEQ, token.GEQ: - return fr.compareStrings(lhs, rhs, op) - default: - panic(fmt.Sprint("Unimplemented operator: ", op)) - } - } - panic("unimplemented") - } - - // Complex numbers. - if isComplex(lhs.typ) { - // XXX Should we represent complex numbers as vectors? - lhsval := lhs.value - rhsval := rhs.value - a_ := b.CreateExtractValue(lhsval, 0, "") - b_ := b.CreateExtractValue(lhsval, 1, "") - c_ := b.CreateExtractValue(rhsval, 0, "") - d_ := b.CreateExtractValue(rhsval, 1, "") - switch op { - case token.QUO: - // (a+bi)/(c+di) = (ac+bd)/(c**2+d**2) + (bc-ad)/(c**2+d**2)i - ac := b.CreateFMul(a_, c_, "") - bd := b.CreateFMul(b_, d_, "") - bc := b.CreateFMul(b_, c_, "") - ad := b.CreateFMul(a_, d_, "") - cpow2 := b.CreateFMul(c_, c_, "") - dpow2 := b.CreateFMul(d_, d_, "") - denom := b.CreateFAdd(cpow2, dpow2, "") - realnumer := b.CreateFAdd(ac, bd, "") - imagnumer := b.CreateFSub(bc, ad, "") - real_ := b.CreateFDiv(realnumer, denom, "") - imag_ := b.CreateFDiv(imagnumer, denom, "") - lhsval = b.CreateInsertValue(lhsval, real_, 0, "") - result = b.CreateInsertValue(lhsval, imag_, 1, "") - case token.MUL: - // (a+bi)(c+di) = (ac-bd)+(bc+ad)i - ac := b.CreateFMul(a_, c_, "") - bd := b.CreateFMul(b_, d_, "") - bc := b.CreateFMul(b_, c_, "") - ad := b.CreateFMul(a_, d_, "") - real_ := b.CreateFSub(ac, bd, "") - imag_ := b.CreateFAdd(bc, ad, "") - lhsval = b.CreateInsertValue(lhsval, real_, 0, "") - result = b.CreateInsertValue(lhsval, imag_, 1, "") - case token.ADD: - real_ := b.CreateFAdd(a_, c_, "") - imag_ := b.CreateFAdd(b_, d_, "") - lhsval = b.CreateInsertValue(lhsval, real_, 0, "") - result = b.CreateInsertValue(lhsval, imag_, 1, "") - case token.SUB: - real_ := b.CreateFSub(a_, c_, "") - imag_ := b.CreateFSub(b_, d_, "") - lhsval = b.CreateInsertValue(lhsval, real_, 0, "") - result = b.CreateInsertValue(lhsval, imag_, 1, "") - case token.EQL: - realeq := b.CreateFCmp(llvm.FloatOEQ, a_, c_, "") - imageq := b.CreateFCmp(llvm.FloatOEQ, b_, d_, "") - result = b.CreateAnd(realeq, imageq, "") - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - default: - panic(fmt.Errorf("unhandled operator: %v", op)) - } - return newValue(result, lhs.typ) - } - - // Floats and integers. - // TODO determine the NaN rules. - - switch op { - case token.MUL: - if isFloat(lhs.typ) { - result = b.CreateFMul(lhs.value, rhs.value, "") - } else { - result = b.CreateMul(lhs.value, rhs.value, "") - } - return newValue(result, lhs.typ) - case token.QUO: - switch { - case isFloat(lhs.typ): - result = b.CreateFDiv(lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateSDiv(lhs.value, rhs.value, "") - default: - result = b.CreateUDiv(lhs.value, rhs.value, "") - } - return newValue(result, lhs.typ) - case token.REM: - switch { - case isFloat(lhs.typ): - result = b.CreateFRem(lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateSRem(lhs.value, rhs.value, "") - default: - result = b.CreateURem(lhs.value, rhs.value, "") - } - return newValue(result, lhs.typ) - case token.ADD: - if isFloat(lhs.typ) { - result = b.CreateFAdd(lhs.value, rhs.value, "") - } else { - result = b.CreateAdd(lhs.value, rhs.value, "") - } - return newValue(result, lhs.typ) - case token.SUB: - if isFloat(lhs.typ) { - result = b.CreateFSub(lhs.value, rhs.value, "") - } else { - result = b.CreateSub(lhs.value, rhs.value, "") - } - return newValue(result, lhs.typ) - case token.SHL, token.SHR: - return fr.shift(lhs, rhs, op) - case token.EQL: - if isFloat(lhs.typ) { - result = b.CreateFCmp(llvm.FloatOEQ, lhs.value, rhs.value, "") - } else { - result = b.CreateICmp(llvm.IntEQ, lhs.value, rhs.value, "") - } - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - case token.LSS: - switch { - case isFloat(lhs.typ): - result = b.CreateFCmp(llvm.FloatOLT, lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateICmp(llvm.IntSLT, lhs.value, rhs.value, "") - default: - result = b.CreateICmp(llvm.IntULT, lhs.value, rhs.value, "") - } - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - case token.LEQ: - switch { - case isFloat(lhs.typ): - result = b.CreateFCmp(llvm.FloatOLE, lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateICmp(llvm.IntSLE, lhs.value, rhs.value, "") - default: - result = b.CreateICmp(llvm.IntULE, lhs.value, rhs.value, "") - } - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - case token.GTR: - switch { - case isFloat(lhs.typ): - result = b.CreateFCmp(llvm.FloatOGT, lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateICmp(llvm.IntSGT, lhs.value, rhs.value, "") - default: - result = b.CreateICmp(llvm.IntUGT, lhs.value, rhs.value, "") - } - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - case token.GEQ: - switch { - case isFloat(lhs.typ): - result = b.CreateFCmp(llvm.FloatOGE, lhs.value, rhs.value, "") - case !isUnsigned(lhs.typ): - result = b.CreateICmp(llvm.IntSGE, lhs.value, rhs.value, "") - default: - result = b.CreateICmp(llvm.IntUGE, lhs.value, rhs.value, "") - } - result = b.CreateZExt(result, llvm.Int8Type(), "") - return newValue(result, types.Typ[types.Bool]) - case token.AND: // a & b - result = b.CreateAnd(lhs.value, rhs.value, "") - return newValue(result, lhs.typ) - case token.AND_NOT: // a &^ b - rhsval := rhs.value - rhsval = b.CreateXor(rhsval, llvm.ConstAllOnes(rhsval.Type()), "") - result = b.CreateAnd(lhs.value, rhsval, "") - return newValue(result, lhs.typ) - case token.OR: // a | b - result = b.CreateOr(lhs.value, rhs.value, "") - return newValue(result, lhs.typ) - case token.XOR: // a ^ b - result = b.CreateXor(lhs.value, rhs.value, "") - return newValue(result, lhs.typ) - default: - panic(fmt.Sprint("Unimplemented operator: ", op)) - } - panic("unreachable") -} - -func (fr *frame) shift(lhs *govalue, rhs *govalue, op token.Token) *govalue { - rhs = fr.convert(rhs, lhs.Type()) - lhsval := lhs.value - bits := rhs.value - unsigned := isUnsigned(lhs.Type()) - // Shifting >= width of lhs yields undefined behaviour, so we must select. - max := llvm.ConstInt(bits.Type(), uint64(lhsval.Type().IntTypeWidth()-1), false) - var result llvm.Value - lessEqualWidth := fr.builder.CreateICmp(llvm.IntULE, bits, max, "") - if !unsigned && op == token.SHR { - bits := fr.builder.CreateSelect(lessEqualWidth, bits, max, "") - result = fr.builder.CreateAShr(lhsval, bits, "") - } else { - if op == token.SHL { - result = fr.builder.CreateShl(lhsval, bits, "") - } else { - result = fr.builder.CreateLShr(lhsval, bits, "") - } - zero := llvm.ConstNull(lhsval.Type()) - result = fr.builder.CreateSelect(lessEqualWidth, result, zero, "") - } - return newValue(result, lhs.typ) -} - -func (fr *frame) unaryOp(v *govalue, op token.Token) *govalue { - switch op { - case token.SUB: - var value llvm.Value - if isComplex(v.typ) { - realv := fr.builder.CreateExtractValue(v.value, 0, "") - imagv := fr.builder.CreateExtractValue(v.value, 1, "") - negzero := llvm.ConstFloatFromString(realv.Type(), "-0") - realv = fr.builder.CreateFSub(negzero, realv, "") - imagv = fr.builder.CreateFSub(negzero, imagv, "") - value = llvm.Undef(v.value.Type()) - value = fr.builder.CreateInsertValue(value, realv, 0, "") - value = fr.builder.CreateInsertValue(value, imagv, 1, "") - } else if isFloat(v.typ) { - negzero := llvm.ConstFloatFromString(fr.types.ToLLVM(v.Type()), "-0") - value = fr.builder.CreateFSub(negzero, v.value, "") - } else { - value = fr.builder.CreateNeg(v.value, "") - } - return newValue(value, v.typ) - case token.ADD: - return v // No-op - case token.NOT: - value := fr.builder.CreateXor(v.value, boolLLVMValue(true), "") - return newValue(value, v.typ) - case token.XOR: - lhs := v.value - rhs := llvm.ConstAllOnes(lhs.Type()) - value := fr.builder.CreateXor(lhs, rhs, "") - return newValue(value, v.typ) - default: - panic(fmt.Sprintf("Unhandled operator: %s", op)) - } -} - -func (fr *frame) convert(v *govalue, dsttyp types.Type) *govalue { - b := fr.builder - - // If it's a stack allocated value, we'll want to compare the - // value type, not the pointer type. - srctyp := v.typ - - // Get the underlying type, if any. - origdsttyp := dsttyp - dsttyp = dsttyp.Underlying() - srctyp = srctyp.Underlying() - - // Identical (underlying) types? Just swap in the destination type. - if types.Identical(srctyp, dsttyp) { - return newValue(v.value, origdsttyp) - } - - // Both pointer types with identical underlying types? Same as above. - if srctyp, ok := srctyp.(*types.Pointer); ok { - if dsttyp, ok := dsttyp.(*types.Pointer); ok { - srctyp := srctyp.Elem().Underlying() - dsttyp := dsttyp.Elem().Underlying() - if types.Identical(srctyp, dsttyp) { - return newValue(v.value, origdsttyp) - } - } - } - - // string -> - if isString(srctyp) { - // (untyped) string -> string - // XXX should untyped strings be able to escape go/types? - if isString(dsttyp) { - return newValue(v.value, origdsttyp) - } - - // string -> []byte - if isSlice(dsttyp, types.Byte) { - sliceValue := fr.runtime.stringToByteArray.callOnly(fr, v.value)[0] - return newValue(sliceValue, origdsttyp) - } - - // string -> []rune - if isSlice(dsttyp, types.Rune) { - return fr.stringToRuneSlice(v) - } - } - - // []byte -> string - if isSlice(srctyp, types.Byte) && isString(dsttyp) { - data := fr.builder.CreateExtractValue(v.value, 0, "") - len := fr.builder.CreateExtractValue(v.value, 1, "") - stringValue := fr.runtime.byteArrayToString.callOnly(fr, data, len)[0] - return newValue(stringValue, dsttyp) - } - - // []rune -> string - if isSlice(srctyp, types.Rune) && isString(dsttyp) { - return fr.runeSliceToString(v) - } - - // rune -> string - if isString(dsttyp) && isInteger(srctyp) { - return fr.runeToString(v) - } - - // Unsafe pointer conversions. - llvm_type := fr.types.ToLLVM(dsttyp) - if dsttyp == types.Typ[types.UnsafePointer] { // X -> unsafe.Pointer - if _, isptr := srctyp.(*types.Pointer); isptr { - return newValue(v.value, origdsttyp) - } else if srctyp == types.Typ[types.Uintptr] { - value := b.CreateIntToPtr(v.value, llvm_type, "") - return newValue(value, origdsttyp) - } - } else if srctyp == types.Typ[types.UnsafePointer] { // unsafe.Pointer -> X - if _, isptr := dsttyp.(*types.Pointer); isptr { - return newValue(v.value, origdsttyp) - } else if dsttyp == types.Typ[types.Uintptr] { - value := b.CreatePtrToInt(v.value, llvm_type, "") - return newValue(value, origdsttyp) - } - } - - lv := v.value - srcType := lv.Type() - switch srcType.TypeKind() { - case llvm.IntegerTypeKind: - switch llvm_type.TypeKind() { - case llvm.IntegerTypeKind: - srcBits := srcType.IntTypeWidth() - dstBits := llvm_type.IntTypeWidth() - delta := srcBits - dstBits - switch { - case delta < 0: - if !isUnsigned(srctyp) { - lv = b.CreateSExt(lv, llvm_type, "") - } else { - lv = b.CreateZExt(lv, llvm_type, "") - } - case delta > 0: - lv = b.CreateTrunc(lv, llvm_type, "") - } - return newValue(lv, origdsttyp) - case llvm.FloatTypeKind, llvm.DoubleTypeKind: - if !isUnsigned(v.Type()) { - lv = b.CreateSIToFP(lv, llvm_type, "") - } else { - lv = b.CreateUIToFP(lv, llvm_type, "") - } - return newValue(lv, origdsttyp) - } - case llvm.DoubleTypeKind: - switch llvm_type.TypeKind() { - case llvm.FloatTypeKind: - lv = b.CreateFPTrunc(lv, llvm_type, "") - return newValue(lv, origdsttyp) - case llvm.IntegerTypeKind: - if !isUnsigned(dsttyp) { - lv = b.CreateFPToSI(lv, llvm_type, "") - } else { - lv = b.CreateFPToUI(lv, llvm_type, "") - } - return newValue(lv, origdsttyp) - } - case llvm.FloatTypeKind: - switch llvm_type.TypeKind() { - case llvm.DoubleTypeKind: - lv = b.CreateFPExt(lv, llvm_type, "") - return newValue(lv, origdsttyp) - case llvm.IntegerTypeKind: - if !isUnsigned(dsttyp) { - lv = b.CreateFPToSI(lv, llvm_type, "") - } else { - lv = b.CreateFPToUI(lv, llvm_type, "") - } - return newValue(lv, origdsttyp) - } - } - - // Complex -> complex. Complexes are only convertible to other - // complexes, contant conversions aside. So we can just check the - // source type here; given that the types are not identical - // (checked above), we can assume the destination type is the alternate - // complex type. - if isComplex(srctyp) { - var fpcast func(llvm.Builder, llvm.Value, llvm.Type, string) llvm.Value - var fptype llvm.Type - if srctyp == types.Typ[types.Complex64] { - fpcast = (llvm.Builder).CreateFPExt - fptype = llvm.DoubleType() - } else { - fpcast = (llvm.Builder).CreateFPTrunc - fptype = llvm.FloatType() - } - if fpcast != nil { - realv := b.CreateExtractValue(lv, 0, "") - imagv := b.CreateExtractValue(lv, 1, "") - realv = fpcast(b, realv, fptype, "") - imagv = fpcast(b, imagv, fptype, "") - lv = llvm.Undef(fr.types.ToLLVM(dsttyp)) - lv = b.CreateInsertValue(lv, realv, 0, "") - lv = b.CreateInsertValue(lv, imagv, 1, "") - return newValue(lv, origdsttyp) - } - } - panic(fmt.Sprintf("unimplemented conversion: %s (%s) -> %s", v.typ, lv.Type(), origdsttyp)) -} - -// extractRealValue extracts the real component of a complex number. -func (fr *frame) extractRealValue(v *govalue) *govalue { - component := fr.builder.CreateExtractValue(v.value, 0, "") - if component.Type().TypeKind() == llvm.FloatTypeKind { - return newValue(component, types.Typ[types.Float32]) - } - return newValue(component, types.Typ[types.Float64]) -} - -// extractRealValue extracts the imaginary component of a complex number. -func (fr *frame) extractImagValue(v *govalue) *govalue { - component := fr.builder.CreateExtractValue(v.value, 1, "") - if component.Type().TypeKind() == llvm.FloatTypeKind { - return newValue(component, types.Typ[types.Float32]) - } - return newValue(component, types.Typ[types.Float64]) -} - -func boolLLVMValue(v bool) (lv llvm.Value) { - if v { - return llvm.ConstInt(llvm.Int8Type(), 1, false) - } - return llvm.ConstNull(llvm.Int8Type()) -} diff --git a/llgo/irgen/version.go b/llgo/irgen/version.go deleted file mode 100644 index a3a1d68dff7f4918fac10e0a532a7cc4f712c226..0000000000000000000000000000000000000000 --- a/llgo/irgen/version.go +++ /dev/null @@ -1,22 +0,0 @@ -//===- version.go - version info ------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file specifies the Go version supported by the IR generator. -// -//===----------------------------------------------------------------------===// - -package irgen - -const ( - goVersion = "go1.4.2" -) - -// GoVersion returns the version of Go that we are targeting. -func GoVersion() string { - return goVersion -} diff --git a/llgo/libgo-check-failures.diff b/llgo/libgo-check-failures.diff deleted file mode 100644 index 519bddfce449c26172f3ecc196d0eba92b6c77bc..0000000000000000000000000000000000000000 --- a/llgo/libgo-check-failures.diff +++ /dev/null @@ -1,49 +0,0 @@ -diff -r a6e10414311a libgo/Makefile.am ---- a/libgo/Makefile.am Fri Jan 16 07:57:02 2015 -0800 -+++ b/libgo/Makefile.am Fri Apr 03 15:07:47 2015 -0700 -@@ -3738,7 +3738,6 @@ - os/check \ - path/check \ - reflect/check \ -- regexp/check \ - runtime/check \ - sort/check \ - strconv/check \ -@@ -3838,7 +3837,6 @@ - os/user/check \ - path/filepath/check \ - regexp/syntax/check \ -- runtime/pprof/check \ - sync/atomic/check \ - text/scanner/check \ - text/tabwriter/check \ -diff -r a6e10414311a libgo/Makefile.in ---- a/libgo/Makefile.in Fri Jan 16 07:57:02 2015 -0800 -+++ b/libgo/Makefile.in Fri Apr 03 15:07:47 2015 -0700 -@@ -2212,7 +2212,6 @@ - os/check \ - path/check \ - reflect/check \ -- regexp/check \ - runtime/check \ - sort/check \ - strconv/check \ -@@ -2312,7 +2311,6 @@ - os/user/check \ - path/filepath/check \ - regexp/syntax/check \ -- runtime/pprof/check \ - sync/atomic/check \ - text/scanner/check \ - text/tabwriter/check \ -diff -r a6e10414311a libgo/go/runtime/mfinal_test.go ---- a/libgo/go/runtime/mfinal_test.go Fri Jan 16 07:57:02 2015 -0800 -+++ b/libgo/go/runtime/mfinal_test.go Fri Apr 03 15:07:47 2015 -0700 -@@ -62,6 +62,7 @@ - }() - <-done - runtime.GC() -+ runtime.GC() - select { - case <-ch: - case <-time.After(time.Second * 4): diff --git a/llgo/libgo-noext.diff b/llgo/libgo-noext.diff deleted file mode 100644 index 86312bb469f2b9c17e24222bad84871d5217c661..0000000000000000000000000000000000000000 --- a/llgo/libgo-noext.diff +++ /dev/null @@ -1,1790 +0,0 @@ -diff -r bb70e852004f libgo/runtime/chan.goc ---- a/libgo/runtime/chan.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/chan.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -111,7 +111,7 @@ - mysg.releasetime = -1; - } - -- runtime_lock(c); -+ runtime_lock(&c->lock); - if(c->closed) - goto closed; - -@@ -120,7 +120,7 @@ - - sg = dequeue(&c->recvq); - if(sg != nil) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - - gp = sg->g; - gp->param = sg; -@@ -133,7 +133,7 @@ - } - - if(!block) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return false; - } - -@@ -142,10 +142,10 @@ - mysg.selectdone = nil; - g->param = nil; - enqueue(&c->sendq, &mysg); -- runtime_parkunlock(c, "chan send"); -+ runtime_parkunlock(&c->lock, "chan send"); - - if(g->param == nil) { -- runtime_lock(c); -+ runtime_lock(&c->lock); - if(!c->closed) - runtime_throw("chansend: spurious wakeup"); - goto closed; -@@ -162,16 +162,16 @@ - - if(c->qcount >= c->dataqsiz) { - if(!block) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return false; - } - mysg.g = g; - mysg.elem = nil; - mysg.selectdone = nil; - enqueue(&c->sendq, &mysg); -- runtime_parkunlock(c, "chan send"); -+ runtime_parkunlock(&c->lock, "chan send"); - -- runtime_lock(c); -+ runtime_lock(&c->lock); - goto asynch; - } - -@@ -183,18 +183,18 @@ - sg = dequeue(&c->recvq); - if(sg != nil) { - gp = sg->g; -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - if(sg->releasetime) - sg->releasetime = runtime_cputicks(); - runtime_ready(gp); - } else -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - if(mysg.releasetime > 0) - runtime_blockevent(mysg.releasetime - t0, 2); - return true; - - closed: -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_panicstring("send on closed channel"); - return false; // not reached - } -@@ -232,7 +232,7 @@ - mysg.releasetime = -1; - } - -- runtime_lock(c); -+ runtime_lock(&c->lock); - if(c->dataqsiz > 0) - goto asynch; - -@@ -241,7 +241,7 @@ - - sg = dequeue(&c->sendq); - if(sg != nil) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - - if(ep != nil) - runtime_memmove(ep, sg->elem, c->elemsize); -@@ -257,7 +257,7 @@ - } - - if(!block) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return false; - } - -@@ -266,10 +266,10 @@ - mysg.selectdone = nil; - g->param = nil; - enqueue(&c->recvq, &mysg); -- runtime_parkunlock(c, "chan receive"); -+ runtime_parkunlock(&c->lock, "chan receive"); - - if(g->param == nil) { -- runtime_lock(c); -+ runtime_lock(&c->lock); - if(!c->closed) - runtime_throw("chanrecv: spurious wakeup"); - goto closed; -@@ -287,7 +287,7 @@ - goto closed; - - if(!block) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - if(received != nil) - *received = false; - return false; -@@ -296,9 +296,9 @@ - mysg.elem = nil; - mysg.selectdone = nil; - enqueue(&c->recvq, &mysg); -- runtime_parkunlock(c, "chan receive"); -+ runtime_parkunlock(&c->lock, "chan receive"); - -- runtime_lock(c); -+ runtime_lock(&c->lock); - goto asynch; - } - -@@ -312,12 +312,12 @@ - sg = dequeue(&c->sendq); - if(sg != nil) { - gp = sg->g; -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - if(sg->releasetime) - sg->releasetime = runtime_cputicks(); - runtime_ready(gp); - } else -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - - if(received != nil) - *received = true; -@@ -330,7 +330,7 @@ - runtime_memclr(ep, c->elemsize); - if(received != nil) - *received = false; -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - if(mysg.releasetime > 0) - runtime_blockevent(mysg.releasetime - t0, 2); - return true; -@@ -604,7 +604,7 @@ - c0 = sel->lockorder[i]; - if(c0 && c0 != c) { - c = sel->lockorder[i]; -- runtime_lock(c); -+ runtime_lock(&c->lock); - } - } - } -@@ -632,7 +632,7 @@ - c = sel->lockorder[i]; - if(i>0 && sel->lockorder[i-1] == c) - continue; // will unlock it on the next iteration -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - } - } - -@@ -1017,9 +1017,9 @@ - if(runtime_gcwaiting()) - runtime_gosched(); - -- runtime_lock(c); -+ runtime_lock(&c->lock); - if(c->closed) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_panicstring("close of closed channel"); - } - c->closed = true; -@@ -1048,7 +1048,7 @@ - runtime_ready(gp); - } - -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - } - - void -diff -r bb70e852004f libgo/runtime/chan.h ---- a/libgo/runtime/chan.h Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/chan.h Fri Apr 03 17:31:02 2015 -0700 -@@ -39,7 +39,7 @@ - uintgo recvx; // receive index - WaitQ recvq; // list of recv waiters - WaitQ sendq; // list of send waiters -- Lock; -+ Lock lock; - }; - - // Buffer follows Hchan immediately in memory. -diff -r bb70e852004f libgo/runtime/heapdump.c ---- a/libgo/runtime/heapdump.c Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/heapdump.c Fri Apr 03 17:31:02 2015 -0700 -@@ -387,7 +387,7 @@ - if(sp->kind != KindSpecialFinalizer) - continue; - spf = (SpecialFinalizer*)sp; -- p = (byte*)((s->start << PageShift) + spf->offset); -+ p = (byte*)((s->start << PageShift) + spf->special.offset); - dumpfinalizer(p, spf->fn, spf->ft, spf->ot); - } - } -@@ -566,7 +566,7 @@ - if(sp->kind != KindSpecialProfile) - continue; - spp = (SpecialProfile*)sp; -- p = (byte*)((s->start << PageShift) + spp->offset); -+ p = (byte*)((s->start << PageShift) + spp->special.offset); - dumpint(TagAllocSample); - dumpint((uintptr)p); - dumpint((uintptr)spp->b); -diff -r bb70e852004f libgo/runtime/malloc.goc ---- a/libgo/runtime/malloc.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/malloc.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -429,9 +429,9 @@ - m->mcache->local_nlookup++; - if (sizeof(void*) == 4 && m->mcache->local_nlookup >= (1<<30)) { - // purge cache stats to prevent overflow -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - runtime_purgecachedstats(m->mcache); -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - } - - s = runtime_MHeap_LookupMaybe(&runtime_mheap, v); -@@ -728,7 +728,7 @@ - - static struct - { -- Lock; -+ Lock lock; - byte* pos; - byte* end; - } persistent; -@@ -757,19 +757,19 @@ - align = 8; - if(size >= PersistentAllocMaxBlock) - return runtime_SysAlloc(size, stat); -- runtime_lock(&persistent); -+ runtime_lock(&persistent.lock); - persistent.pos = (byte*)ROUND((uintptr)persistent.pos, align); - if(persistent.pos + size > persistent.end) { - persistent.pos = runtime_SysAlloc(PersistentAllocChunk, &mstats.other_sys); - if(persistent.pos == nil) { -- runtime_unlock(&persistent); -+ runtime_unlock(&persistent.lock); - runtime_throw("runtime: cannot allocate memory"); - } - persistent.end = persistent.pos + PersistentAllocChunk; - } - p = persistent.pos; - persistent.pos += size; -- runtime_unlock(&persistent); -+ runtime_unlock(&persistent.lock); - if(stat != &mstats.other_sys) { - // reaccount the allocation against provided stat - runtime_xadd64(stat, size); -diff -r bb70e852004f libgo/runtime/malloc.h ---- a/libgo/runtime/malloc.h Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/malloc.h Fri Apr 03 17:31:02 2015 -0700 -@@ -390,7 +390,7 @@ - typedef struct SpecialFinalizer SpecialFinalizer; - struct SpecialFinalizer - { -- Special; -+ Special special; - FuncVal* fn; - const FuncType* ft; - const PtrType* ot; -@@ -401,7 +401,7 @@ - typedef struct SpecialProfile SpecialProfile; - struct SpecialProfile - { -- Special; -+ Special special; - Bucket* b; - }; - -@@ -458,7 +458,7 @@ - // Central list of free objects of a given size. - struct MCentral - { -- Lock; -+ Lock lock; - int32 sizeclass; - MSpan nonempty; // list of spans with a free object - MSpan empty; // list of spans with no free objects (or cached in an MCache) -@@ -476,7 +476,7 @@ - // but all the other global data is here too. - struct MHeap - { -- Lock; -+ Lock lock; - MSpan free[MaxMHeapList]; // free lists of given length - MSpan freelarge; // free lists length >= MaxMHeapList - MSpan busy[MaxMHeapList]; // busy lists of large objects of given length -@@ -505,7 +505,7 @@ - // spaced CacheLineSize bytes apart, so that each MCentral.Lock - // gets its own cache line. - struct { -- MCentral; -+ MCentral mcentral; - byte pad[64]; - } central[NumSizeClasses]; - -diff -r bb70e852004f libgo/runtime/mcache.c ---- a/libgo/runtime/mcache.c Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/mcache.c Fri Apr 03 17:31:02 2015 -0700 -@@ -23,9 +23,9 @@ - MCache *c; - int32 i; - -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - c = runtime_FixAlloc_Alloc(&runtime_mheap.cachealloc); -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - runtime_memclr((byte*)c, sizeof(*c)); - for(i = 0; i < NumSizeClasses; i++) - c->alloc[i] = &emptymspan; -@@ -44,10 +44,10 @@ - runtime_freemcache(MCache *c) - { - runtime_MCache_ReleaseAll(c); -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - runtime_purgecachedstats(c); - runtime_FixAlloc_Free(&runtime_mheap.cachealloc, c); -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - } - - // Gets a span that has a free object in it and assigns it -@@ -64,19 +64,19 @@ - if(s->freelist != nil) - runtime_throw("refill on a nonempty span"); - if(s != &emptymspan) -- runtime_MCentral_UncacheSpan(&runtime_mheap.central[sizeclass], s); -+ runtime_MCentral_UncacheSpan(&runtime_mheap.central[sizeclass].mcentral, s); - - // Push any explicitly freed objects to the central lists. - // Not required, but it seems like a good time to do it. - l = &c->free[sizeclass]; - if(l->nlist > 0) { -- runtime_MCentral_FreeList(&runtime_mheap.central[sizeclass], l->list); -+ runtime_MCentral_FreeList(&runtime_mheap.central[sizeclass].mcentral, l->list); - l->list = nil; - l->nlist = 0; - } - - // Get a new cached span from the central lists. -- s = runtime_MCentral_CacheSpan(&runtime_mheap.central[sizeclass]); -+ s = runtime_MCentral_CacheSpan(&runtime_mheap.central[sizeclass].mcentral); - if(s == nil) - runtime_throw("out of memory"); - if(s->freelist == nil) { -@@ -102,7 +102,7 @@ - // We transfer a span at a time from MCentral to MCache, - // so we'll do the same in the other direction. - if(l->nlist >= (runtime_class_to_allocnpages[sizeclass]<list); -+ runtime_MCentral_FreeList(&runtime_mheap.central[sizeclass].mcentral, l->list); - l->list = nil; - l->nlist = 0; - } -@@ -118,12 +118,12 @@ - for(i=0; ialloc[i]; - if(s != &emptymspan) { -- runtime_MCentral_UncacheSpan(&runtime_mheap.central[i], s); -+ runtime_MCentral_UncacheSpan(&runtime_mheap.central[i].mcentral, s); - c->alloc[i] = &emptymspan; - } - l = &c->free[i]; - if(l->nlist > 0) { -- runtime_MCentral_FreeList(&runtime_mheap.central[i], l->list); -+ runtime_MCentral_FreeList(&runtime_mheap.central[i].mcentral, l->list); - l->list = nil; - l->nlist = 0; - } -diff -r bb70e852004f libgo/runtime/mcentral.c ---- a/libgo/runtime/mcentral.c Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/mcentral.c Fri Apr 03 17:31:02 2015 -0700 -@@ -39,14 +39,14 @@ - int32 cap, n; - uint32 sg; - -- runtime_lock(c); -+ runtime_lock(&c->lock); - sg = runtime_mheap.sweepgen; - retry: - for(s = c->nonempty.next; s != &c->nonempty; s = s->next) { - if(s->sweepgen == sg-2 && runtime_cas(&s->sweepgen, sg-2, sg-1)) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_MSpan_Sweep(s); -- runtime_lock(c); -+ runtime_lock(&c->lock); - // the span could have been moved to heap, retry - goto retry; - } -@@ -65,9 +65,9 @@ - runtime_MSpanList_Remove(s); - // swept spans are at the end of the list - runtime_MSpanList_InsertBack(&c->empty, s); -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_MSpan_Sweep(s); -- runtime_lock(c); -+ runtime_lock(&c->lock); - // the span could be moved to nonempty or heap, retry - goto retry; - } -@@ -82,7 +82,7 @@ - - // Replenish central list if empty. - if(!MCentral_Grow(c)) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return nil; - } - goto retry; -@@ -98,7 +98,7 @@ - runtime_MSpanList_Remove(s); - runtime_MSpanList_InsertBack(&c->empty, s); - s->incache = true; -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return s; - } - -@@ -109,7 +109,7 @@ - MLink *v; - int32 cap, n; - -- runtime_lock(c); -+ runtime_lock(&c->lock); - - s->incache = false; - -@@ -135,7 +135,7 @@ - runtime_MSpanList_Remove(s); - runtime_MSpanList_Insert(&c->nonempty, s); - } -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - } - - // Free the list of objects back into the central free list c. -@@ -145,12 +145,12 @@ - { - MLink *next; - -- runtime_lock(c); -+ runtime_lock(&c->lock); - for(; start != nil; start = next) { - next = start->next; - MCentral_Free(c, start); - } -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - } - - // Helper: free one object back into the central free list. -@@ -193,7 +193,7 @@ - // If s is completely freed, return it to the heap. - if(s->ref == 0) { - MCentral_ReturnToHeap(c, s); // unlocks c -- runtime_lock(c); -+ runtime_lock(&c->lock); - } - } - -@@ -206,7 +206,7 @@ - { - if(s->incache) - runtime_throw("freespan into cached span"); -- runtime_lock(c); -+ runtime_lock(&c->lock); - - // Move to nonempty if necessary. - if(s->freelist == nil) { -@@ -227,7 +227,7 @@ - runtime_atomicstore(&s->sweepgen, runtime_mheap.sweepgen); - - if(s->ref != 0) { -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - return false; - } - -@@ -260,12 +260,12 @@ - byte *p; - MSpan *s; - -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_MGetSizeClassInfo(c->sizeclass, &size, &npages, &n); - s = runtime_MHeap_Alloc(&runtime_mheap, npages, c->sizeclass, 0, 1); - if(s == nil) { - // TODO(rsc): Log out of memory -- runtime_lock(c); -+ runtime_lock(&c->lock); - return false; - } - -@@ -282,7 +282,7 @@ - *tailp = nil; - runtime_markspan((byte*)(s->start<npages<lock); - c->nfree += n; - runtime_MSpanList_Insert(&c->nonempty, s); - return true; -@@ -301,7 +301,7 @@ - if(s->ref != 0) - runtime_throw("ref wrong"); - c->nfree -= (s->npages << PageShift) / size; -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - runtime_unmarkspan((byte*)(s->start<npages<start << PageShift) + spf->offset/s->elemsize*s->elemsize); -+ p = (void*)((s->start << PageShift) + spf->special.offset/s->elemsize*s->elemsize); - enqueue1(&wbuf, (Obj){p, s->elemsize, 0}); - enqueue1(&wbuf, (Obj){(void*)&spf->fn, PtrSize, 0}); - enqueue1(&wbuf, (Obj){(void*)&spf->ft, PtrSize, 0}); -@@ -1378,7 +1378,7 @@ - b = (Workbuf*)runtime_lfstackpop(&work.empty); - if(b == nil) { - // Need to allocate. -- runtime_lock(&work); -+ runtime_lock(&work.lock); - if(work.nchunk < sizeof *b) { - work.nchunk = 1<<20; - work.chunk = runtime_SysAlloc(work.nchunk, &mstats.gc_sys); -@@ -1388,7 +1388,7 @@ - b = (Workbuf*)work.chunk; - work.chunk += sizeof *b; - work.nchunk -= sizeof *b; -- runtime_unlock(&work); -+ runtime_unlock(&work.lock); - } - b->nobj = 0; - return b; -@@ -1802,7 +1802,7 @@ - c->local_nsmallfree[cl] += nfree; - c->local_cachealloc -= nfree * size; - runtime_xadd64(&mstats.next_gc, -(uint64)(nfree * size * (gcpercent + 100)/100)); -- res = runtime_MCentral_FreeSpan(&runtime_mheap.central[cl], s, nfree, head.next, end); -+ res = runtime_MCentral_FreeSpan(&runtime_mheap.central[cl].mcentral, s, nfree, head.next, end); - //MCentral_FreeSpan updates sweepgen - } - return res; -@@ -2147,10 +2147,10 @@ - return; - - if(gcpercent == GcpercentUnknown) { // first time through -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - if(gcpercent == GcpercentUnknown) - gcpercent = readgogc(); -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - } - if(gcpercent < 0) - return; -@@ -2423,7 +2423,7 @@ - - // Pass back: pauses, last gc (absolute time), number of gc, total pause ns. - p = (uint64*)pauses->array; -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - n = mstats.numgc; - if(n > nelem(mstats.pause_ns)) - n = nelem(mstats.pause_ns); -@@ -2438,7 +2438,7 @@ - p[n] = mstats.last_gc; - p[n+1] = mstats.numgc; - p[n+2] = mstats.pause_total_ns; -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - pauses->__count = n+3; - } - -@@ -2446,14 +2446,14 @@ - runtime_setgcpercent(int32 in) { - int32 out; - -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - if(gcpercent == GcpercentUnknown) - gcpercent = readgogc(); - out = gcpercent; - if(in < 0) - in = -1; - gcpercent = in; -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - return out; - } - -diff -r bb70e852004f libgo/runtime/mheap.c ---- a/libgo/runtime/mheap.c Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/mheap.c Fri Apr 03 17:31:02 2015 -0700 -@@ -70,7 +70,7 @@ - runtime_MSpanList_Init(&h->freelarge); - runtime_MSpanList_Init(&h->busylarge); - for(i=0; icentral); i++) -- runtime_MCentral_Init(&h->central[i], i); -+ runtime_MCentral_Init(&h->central[i].mcentral, i); - } - - void -@@ -109,9 +109,9 @@ - runtime_MSpanList_Remove(s); - // swept spans are at the end of the list - runtime_MSpanList_InsertBack(list, s); -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - n += runtime_MSpan_Sweep(s); -- runtime_lock(h); -+ runtime_lock(&h->lock); - if(n >= npages) - return n; - // the span could have been moved elsewhere -@@ -156,7 +156,7 @@ - } - - // Now sweep everything that is not yet swept. -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - for(;;) { - n = runtime_sweepone(); - if(n == (uintptr)-1) // all spans are swept -@@ -165,7 +165,7 @@ - if(reclaimed >= npage) - break; - } -- runtime_lock(h); -+ runtime_lock(&h->lock); - } - - // Allocate a new span of npage pages from the heap -@@ -175,7 +175,7 @@ - { - MSpan *s; - -- runtime_lock(h); -+ runtime_lock(&h->lock); - mstats.heap_alloc += runtime_m()->mcache->local_cachealloc; - runtime_m()->mcache->local_cachealloc = 0; - s = MHeap_AllocLocked(h, npage, sizeclass); -@@ -191,7 +191,7 @@ - runtime_MSpanList_InsertBack(&h->busylarge, s); - } - } -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - if(s != nil) { - if(needzero && s->needzero) - runtime_memclr((byte*)(s->start<npages<lock); - mstats.heap_alloc += runtime_m()->mcache->local_cachealloc; - runtime_m()->mcache->local_cachealloc = 0; - mstats.heap_inuse -= s->npages<lock); - } - - static void -@@ -548,10 +548,10 @@ - runtime_noteclear(¬e); - runtime_notetsleepg(¬e, tick); - -- runtime_lock(h); -+ runtime_lock(&h->lock); - unixnow = runtime_unixnanotime(); - if(unixnow - mstats.last_gc > forcegc) { -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - // The scavenger can not block other goroutines, - // otherwise deadlock detector can fire spuriously. - // GC blocks other goroutines via the runtime_worldsema. -@@ -561,11 +561,11 @@ - runtime_notetsleepg(¬e, -1); - if(runtime_debug.gctrace > 0) - runtime_printf("scvg%d: GC forced\n", k); -- runtime_lock(h); -+ runtime_lock(&h->lock); - } - now = runtime_nanotime(); - scavenge(k, now, limit); -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - } - } - -@@ -575,9 +575,9 @@ - runtime_debug_freeOSMemory(void) - { - runtime_gc(2); // force GC and do eager sweep -- runtime_lock(&runtime_mheap); -+ runtime_lock(&runtime_mheap.lock); - scavenge(-1, ~(uintptr)0, 0); -- runtime_unlock(&runtime_mheap); -+ runtime_unlock(&runtime_mheap.lock); - } - - // Initialize a new span with the given start and npages. -@@ -752,11 +752,11 @@ - runtime_lock(&runtime_mheap.speciallock); - s = runtime_FixAlloc_Alloc(&runtime_mheap.specialfinalizeralloc); - runtime_unlock(&runtime_mheap.speciallock); -- s->kind = KindSpecialFinalizer; -+ s->special.kind = KindSpecialFinalizer; - s->fn = f; - s->ft = ft; - s->ot = ot; -- if(addspecial(p, s)) -+ if(addspecial(p, &s->special)) - return true; - - // There was an old finalizer -@@ -789,9 +789,9 @@ - runtime_lock(&runtime_mheap.speciallock); - s = runtime_FixAlloc_Alloc(&runtime_mheap.specialprofilealloc); - runtime_unlock(&runtime_mheap.speciallock); -- s->kind = KindSpecialProfile; -+ s->special.kind = KindSpecialProfile; - s->b = b; -- if(!addspecial(p, s)) -+ if(!addspecial(p, &s->special)) - runtime_throw("setprofilebucket: profile already set"); - } - -@@ -879,14 +879,14 @@ - // remove the span from whatever list it is in now - if(s->sizeclass > 0) { - // must be in h->central[x].empty -- c = &h->central[s->sizeclass]; -- runtime_lock(c); -+ c = &h->central[s->sizeclass].mcentral; -+ runtime_lock(&c->lock); - runtime_MSpanList_Remove(s); -- runtime_unlock(c); -- runtime_lock(h); -+ runtime_unlock(&c->lock); -+ runtime_lock(&h->lock); - } else { - // must be in h->busy/busylarge -- runtime_lock(h); -+ runtime_lock(&h->lock); - runtime_MSpanList_Remove(s); - } - // heap is locked now -@@ -933,18 +933,18 @@ - - // place the span into a new list - if(s->sizeclass > 0) { -- runtime_unlock(h); -- c = &h->central[s->sizeclass]; -- runtime_lock(c); -+ runtime_unlock(&h->lock); -+ c = &h->central[s->sizeclass].mcentral; -+ runtime_lock(&c->lock); - // swept spans are at the end of the list - runtime_MSpanList_InsertBack(&c->empty, s); -- runtime_unlock(c); -+ runtime_unlock(&c->lock); - } else { - // Swept spans are at the end of lists. - if(s->npages < nelem(h->free)) - runtime_MSpanList_InsertBack(&h->busy[s->npages], s); - else - runtime_MSpanList_InsertBack(&h->busylarge, s); -- runtime_unlock(h); -+ runtime_unlock(&h->lock); - } - } -diff -r bb70e852004f libgo/runtime/netpoll.goc ---- a/libgo/runtime/netpoll.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/netpoll.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -53,7 +53,7 @@ - // pollReset, pollWait, pollWaitCanceled and runtime_netpollready (IO rediness notification) - // proceed w/o taking the lock. So closing, rg, rd, wg and wd are manipulated - // in a lock-free way by all operations. -- Lock; // protectes the following fields -+ Lock lock; // protectes the following fields - uintptr fd; - bool closing; - uintptr seq; // protects from stale timers and ready notifications -@@ -68,7 +68,7 @@ - - static struct - { -- Lock; -+ Lock lock; - PollDesc* first; - // PollDesc objects must be type-stable, - // because we can get ready notification from epoll/kqueue -@@ -100,7 +100,7 @@ - - func runtime_pollOpen(fd uintptr) (pd *PollDesc, errno int) { - pd = allocPollDesc(); -- runtime_lock(pd); -+ runtime_lock(&pd->lock); - if(pd->wg != nil && pd->wg != READY) - runtime_throw("runtime_pollOpen: blocked write on free descriptor"); - if(pd->rg != nil && pd->rg != READY) -@@ -112,7 +112,7 @@ - pd->rd = 0; - pd->wg = nil; - pd->wd = 0; -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - - errno = runtime_netpollopen(fd, pd); - } -@@ -125,10 +125,10 @@ - if(pd->rg != nil && pd->rg != READY) - runtime_throw("runtime_pollClose: blocked read on closing descriptor"); - runtime_netpollclose(pd->fd); -- runtime_lock(&pollcache); -+ runtime_lock(&pollcache.lock); - pd->link = pollcache.first; - pollcache.first = pd; -- runtime_unlock(&pollcache); -+ runtime_unlock(&pollcache.lock); - } - - func runtime_pollReset(pd *PollDesc, mode int) (err int) { -@@ -169,9 +169,9 @@ - func runtime_pollSetDeadline(pd *PollDesc, d int64, mode int) { - G *rg, *wg; - -- runtime_lock(pd); -+ runtime_lock(&pd->lock); - if(pd->closing) { -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - return; - } - pd->seq++; // invalidate current timers -@@ -226,7 +226,7 @@ - rg = netpollunblock(pd, 'r', false); - if(pd->wd < 0) - wg = netpollunblock(pd, 'w', false); -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - if(rg) - runtime_ready(rg); - if(wg) -@@ -236,7 +236,7 @@ - func runtime_pollUnblock(pd *PollDesc) { - G *rg, *wg; - -- runtime_lock(pd); -+ runtime_lock(&pd->lock); - if(pd->closing) - runtime_throw("runtime_pollUnblock: already closing"); - pd->closing = true; -@@ -252,7 +252,7 @@ - runtime_deltimer(&pd->wt); - pd->wt.fv = nil; - } -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - if(rg) - runtime_ready(rg); - if(wg) -@@ -280,13 +280,13 @@ - void - runtime_netpolllock(PollDesc *pd) - { -- runtime_lock(pd); -+ runtime_lock(&pd->lock); - } - - void - runtime_netpollunlock(PollDesc *pd) - { -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - } - - // make pd ready, newly runnable goroutines (if any) are enqueued info gpp list -@@ -399,12 +399,12 @@ - - pd = (PollDesc*)arg.data; - rg = wg = nil; -- runtime_lock(pd); -+ runtime_lock(&pd->lock); - // Seq arg is seq when the timer was set. - // If it's stale, ignore the timer event. - if(seq != pd->seq) { - // The descriptor was reused or timers were reset. -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - return; - } - if(read) { -@@ -421,7 +421,7 @@ - runtime_atomicstorep(&pd->wt.fv, nil); // full memory barrier between store to wd and load of wg in netpollunblock - wg = netpollunblock(pd, 'w', false); - } -- runtime_unlock(pd); -+ runtime_unlock(&pd->lock); - if(rg) - runtime_ready(rg); - if(wg) -@@ -452,7 +452,7 @@ - PollDesc *pd; - uint32 i, n; - -- runtime_lock(&pollcache); -+ runtime_lock(&pollcache.lock); - if(pollcache.first == nil) { - n = PollBlockSize/sizeof(*pd); - if(n == 0) -@@ -467,6 +467,6 @@ - } - pd = pollcache.first; - pollcache.first = pd->link; -- runtime_unlock(&pollcache); -+ runtime_unlock(&pollcache.lock); - return pd; - } -diff -r bb70e852004f libgo/runtime/proc.c ---- a/libgo/runtime/proc.c Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/proc.c Fri Apr 03 17:31:02 2015 -0700 -@@ -302,7 +302,7 @@ - - typedef struct Sched Sched; - struct Sched { -- Lock; -+ Lock lock; - - uint64 goidgen; - M* midle; // idle m's waiting for work -@@ -709,7 +709,7 @@ - - mp->fastrand = 0x49f6428aUL + mp->id + runtime_cputicks(); - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - mp->id = runtime_sched.mcount++; - checkmcount(); - runtime_mpreinit(mp); -@@ -720,7 +720,7 @@ - // runtime_NumCgoCall() iterates over allm w/o schedlock, - // so we need to publish it safely. - runtime_atomicstorep(&runtime_allm, mp); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - // Mark gp ready to run. -@@ -747,7 +747,7 @@ - - // Figure out how many CPUs to use during GC. - // Limited by gomaxprocs, number of actual CPUs, and MaxGcproc. -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - n = runtime_gomaxprocs; - if(n > runtime_ncpu) - n = runtime_ncpu > 0 ? runtime_ncpu : 1; -@@ -755,7 +755,7 @@ - n = MaxGcproc; - if(n > runtime_sched.nmidle+1) // one M is currently running - n = runtime_sched.nmidle+1; -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return n; - } - -@@ -764,14 +764,14 @@ - { - int32 n; - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - n = runtime_gomaxprocs; - if(n > runtime_ncpu) - n = runtime_ncpu; - if(n > MaxGcproc) - n = MaxGcproc; - n -= runtime_sched.nmidle+1; // one M is currently running -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return n > 0; - } - -@@ -781,7 +781,7 @@ - M *mp; - int32 n, pos; - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - pos = 0; - for(n = 1; n < nproc; n++) { // one M is currently running - if(runtime_allp[pos]->mcache == m->mcache) -@@ -794,7 +794,7 @@ - pos++; - runtime_notewakeup(&mp->park); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - // Similar to stoptheworld but best-effort and can be called several times. -@@ -833,7 +833,7 @@ - P *p; - bool wait; - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - runtime_sched.stopwait = runtime_gomaxprocs; - runtime_atomicstore((uint32*)&runtime_sched.gcwaiting, 1); - preemptall(); -@@ -853,7 +853,7 @@ - runtime_sched.stopwait--; - } - wait = runtime_sched.stopwait > 0; -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - - // wait for remaining P's to stop voluntarily - if(wait) { -@@ -887,7 +887,7 @@ - gp = runtime_netpoll(false); // non-blocking - injectglist(gp); - add = needaddgcproc(); -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(newprocs) { - procresize(newprocs); - newprocs = 0; -@@ -911,7 +911,7 @@ - runtime_sched.sysmonwait = false; - runtime_notewakeup(&runtime_sched.sysmonnote); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - - while(p1) { - p = p1; -@@ -1346,9 +1346,9 @@ - } - - retry: -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - mput(m); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - runtime_notesleep(&m->park); - runtime_noteclear(&m->park); - if(m->helpgc) { -@@ -1375,18 +1375,18 @@ - M *mp; - void (*fn)(void); - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(p == nil) { - p = pidleget(); - if(p == nil) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(spinning) - runtime_xadd(&runtime_sched.nmspinning, -1); - return; - } - } - mp = mget(); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(mp == nil) { - fn = nil; - if(spinning) -@@ -1419,28 +1419,28 @@ - startm(p, true); - return; - } -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(runtime_sched.gcwaiting) { - p->status = Pgcstop; - if(--runtime_sched.stopwait == 0) - runtime_notewakeup(&runtime_sched.stopnote); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return; - } - if(runtime_sched.runqsize) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - startm(p, false); - return; - } - // If this is the last running P and nobody is polling network, - // need to wakeup another M to poll network. - if(runtime_sched.npidle == (uint32)runtime_gomaxprocs-1 && runtime_atomicload64(&runtime_sched.lastpoll) != 0) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - startm(p, false); - return; - } - pidleput(p); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - // Tries to add one more P to execute G's. -@@ -1512,11 +1512,11 @@ - runtime_xadd(&runtime_sched.nmspinning, -1); - } - p = releasep(); -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - p->status = Pgcstop; - if(--runtime_sched.stopwait == 0) - runtime_notewakeup(&runtime_sched.stopnote); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - stopm(); - } - -@@ -1567,9 +1567,9 @@ - return gp; - // global runq - if(runtime_sched.runqsize) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - gp = globrunqget(m->p, 0); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(gp) - return gp; - } -@@ -1603,19 +1603,19 @@ - } - stop: - // return P and block -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(runtime_sched.gcwaiting) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - goto top; - } - if(runtime_sched.runqsize) { - gp = globrunqget(m->p, 0); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return gp; - } - p = releasep(); - pidleput(p); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(m->spinning) { - m->spinning = false; - runtime_xadd(&runtime_sched.nmspinning, -1); -@@ -1624,9 +1624,9 @@ - for(i = 0; i < runtime_gomaxprocs; i++) { - p = runtime_allp[i]; - if(p && p->runqhead != p->runqtail) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - p = pidleget(); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(p) { - acquirep(p); - goto top; -@@ -1643,9 +1643,9 @@ - gp = runtime_netpoll(true); // block until new work is available - runtime_atomicstore64(&runtime_sched.lastpoll, runtime_nanotime()); - if(gp) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - p = pidleget(); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(p) { - acquirep(p); - injectglist(gp->schedlink); -@@ -1688,14 +1688,14 @@ - - if(glist == nil) - return; -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - for(n = 0; glist; n++) { - gp = glist; - glist = gp->schedlink; - gp->status = Grunnable; - globrunqput(gp); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - - for(; n && runtime_sched.npidle; n--) - startm(nil, false); -@@ -1726,9 +1726,9 @@ - // This is a fancy way to say tick%61==0, - // it uses 2 MUL instructions instead of a single DIV and so is faster on modern processors. - if(tick - (((uint64)tick*0x4325c53fu)>>36)*61 == 0 && runtime_sched.runqsize > 0) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - gp = globrunqget(m->p, 1); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(gp) - resetspinning(); - } -@@ -1822,9 +1822,9 @@ - gp->status = Grunnable; - gp->m = nil; - m->curg = nil; -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - globrunqput(gp); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(m->lockedg) { - stoplockedm(); - execute(gp); // Never returns. -@@ -1925,24 +1925,24 @@ - g->status = Gsyscall; - - if(runtime_atomicload(&runtime_sched.sysmonwait)) { // TODO: fast atomic -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(runtime_atomicload(&runtime_sched.sysmonwait)) { - runtime_atomicstore(&runtime_sched.sysmonwait, 0); - runtime_notewakeup(&runtime_sched.sysmonnote); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - m->mcache = nil; - m->p->m = nil; - runtime_atomicstore(&m->p->status, Psyscall); - if(runtime_sched.gcwaiting) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if (runtime_sched.stopwait > 0 && runtime_cas(&m->p->status, Psyscall, Pgcstop)) { - if(--runtime_sched.stopwait == 0) - runtime_notewakeup(&runtime_sched.stopnote); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - m->locks--; -@@ -2053,13 +2053,13 @@ - // Try to get any other idle P. - m->p = nil; - if(runtime_sched.pidle) { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - p = pidleget(); - if(p && runtime_atomicload(&runtime_sched.sysmonwait)) { - runtime_atomicstore(&runtime_sched.sysmonwait, 0); - runtime_notewakeup(&runtime_sched.sysmonnote); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(p) { - acquirep(p); - return true; -@@ -2078,7 +2078,7 @@ - gp->status = Grunnable; - gp->m = nil; - m->curg = nil; -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - p = pidleget(); - if(p == nil) - globrunqput(gp); -@@ -2086,7 +2086,7 @@ - runtime_atomicstore(&runtime_sched.sysmonwait, 0); - runtime_notewakeup(&runtime_sched.sysmonnote); - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - if(p) { - acquirep(p); - execute(gp); // Never returns. -@@ -2365,13 +2365,13 @@ - - if(n > MaxGomaxprocs) - n = MaxGomaxprocs; -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - ret = runtime_gomaxprocs; - if(n <= 0 || n == ret) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return ret; - } -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - - runtime_semacquire(&runtime_worldsema, false); - m->gcing = 1; -@@ -2476,7 +2476,7 @@ - } - - static struct { -- Lock; -+ Lock lock; - void (*fn)(uintptr*, int32); - int32 hz; - uintptr pcbuf[TracebackMaxFrames]; -@@ -2508,9 +2508,9 @@ - if(mp->mcache == nil) - traceback = false; - -- runtime_lock(&prof); -+ runtime_lock(&prof.lock); - if(prof.fn == nil) { -- runtime_unlock(&prof); -+ runtime_unlock(&prof.lock); - mp->mallocing--; - return; - } -@@ -2538,7 +2538,7 @@ - prof.pcbuf[1] = (uintptr)System; - } - prof.fn(prof.pcbuf, n); -- runtime_unlock(&prof); -+ runtime_unlock(&prof.lock); - mp->mallocing--; - } - -@@ -2563,13 +2563,13 @@ - // it would deadlock. - runtime_resetcpuprofiler(0); - -- runtime_lock(&prof); -+ runtime_lock(&prof.lock); - prof.fn = fn; - prof.hz = hz; -- runtime_unlock(&prof); -- runtime_lock(&runtime_sched); -+ runtime_unlock(&prof.lock); -+ runtime_lock(&runtime_sched.lock); - runtime_sched.profilehz = hz; -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - - if(hz != 0) - runtime_resetcpuprofiler(hz); -@@ -2707,11 +2707,11 @@ - static void - incidlelocked(int32 v) - { -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - runtime_sched.nmidlelocked += v; - if(v > 0) - checkdead(); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - // Check for deadlock situation. -@@ -2780,16 +2780,16 @@ - runtime_usleep(delay); - if(runtime_debug.schedtrace <= 0 && - (runtime_sched.gcwaiting || runtime_atomicload(&runtime_sched.npidle) == (uint32)runtime_gomaxprocs)) { // TODO: fast atomic -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - if(runtime_atomicload(&runtime_sched.gcwaiting) || runtime_atomicload(&runtime_sched.npidle) == (uint32)runtime_gomaxprocs) { - runtime_atomicstore(&runtime_sched.sysmonwait, 1); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - runtime_notesleep(&runtime_sched.sysmonnote); - runtime_noteclear(&runtime_sched.sysmonnote); - idle = 0; - delay = 20; - } else -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - // poll network if not polled for more than 10ms - lastpoll = runtime_atomicload64(&runtime_sched.lastpoll); -@@ -2918,7 +2918,7 @@ - if(starttime == 0) - starttime = now; - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - runtime_printf("SCHED %Dms: gomaxprocs=%d idleprocs=%d threads=%d idlethreads=%d runqueue=%d", - (now-starttime)/1000000, runtime_gomaxprocs, runtime_sched.npidle, runtime_sched.mcount, - runtime_sched.nmidle, runtime_sched.runqsize); -@@ -2954,7 +2954,7 @@ - } - } - if(!detailed) { -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return; - } - for(mp = runtime_allm; mp; mp = mp->alllink) { -@@ -2986,7 +2986,7 @@ - lockedm ? lockedm->id : -1); - } - runtime_unlock(&allglock); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - } - - // Put mp on midle list. -@@ -3142,9 +3142,9 @@ - for(i=0; ischedlink = batch[i+1]; - // Now put the batch on global queue. -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - globrunqputbatch(batch[0], batch[n], n+1); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return true; - } - -@@ -3296,11 +3296,11 @@ - { - int32 out; - -- runtime_lock(&runtime_sched); -+ runtime_lock(&runtime_sched.lock); - out = runtime_sched.maxmcount; - runtime_sched.maxmcount = in; - checkmcount(); -- runtime_unlock(&runtime_sched); -+ runtime_unlock(&runtime_sched.lock); - return out; - } - -diff -r bb70e852004f libgo/runtime/runtime.h ---- a/libgo/runtime/runtime.h Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/runtime.h Fri Apr 03 17:31:02 2015 -0700 -@@ -285,7 +285,7 @@ - - struct P - { -- Lock; -+ Lock lock; - - int32 id; - uint32 status; // one of Pidle/Prunning/... -@@ -383,7 +383,7 @@ - - struct Timers - { -- Lock; -+ Lock lock; - G *timerproc; - bool sleeping; - bool rescheduling; -diff -r bb70e852004f libgo/runtime/sema.goc ---- a/libgo/runtime/sema.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/sema.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -35,7 +35,7 @@ - typedef struct SemaRoot SemaRoot; - struct SemaRoot - { -- Lock; -+ Lock lock; - SemaWaiter* head; - SemaWaiter* tail; - // Number of waiters. Read w/o the lock. -@@ -47,7 +47,7 @@ - - struct semtable - { -- SemaRoot; -+ SemaRoot root; - uint8 pad[CacheLineSize-sizeof(SemaRoot)]; - }; - static struct semtable semtable[SEMTABLESZ]; -@@ -55,7 +55,7 @@ - static SemaRoot* - semroot(uint32 volatile *addr) - { -- return &semtable[((uintptr)addr >> 3) % SEMTABLESZ]; -+ return &semtable[((uintptr)addr >> 3) % SEMTABLESZ].root; - } - - static void -@@ -124,19 +124,19 @@ - } - for(;;) { - -- runtime_lock(root); -+ runtime_lock(&root->lock); - // Add ourselves to nwait to disable "easy case" in semrelease. - runtime_xadd(&root->nwait, 1); - // Check cansemacquire to avoid missed wakeup. - if(cansemacquire(addr)) { - runtime_xadd(&root->nwait, -1); -- runtime_unlock(root); -+ runtime_unlock(&root->lock); - return; - } - // Any semrelease after the cansemacquire knows we're waiting - // (we set nwait above), so go to sleep. - semqueue(root, addr, &s); -- runtime_parkunlock(root, "semacquire"); -+ runtime_parkunlock(&root->lock, "semacquire"); - if(cansemacquire(addr)) { - if(t0) - runtime_blockevent(s.releasetime - t0, 3); -@@ -161,11 +161,11 @@ - return; - - // Harder case: search for a waiter and wake it. -- runtime_lock(root); -+ runtime_lock(&root->lock); - if(runtime_atomicload(&root->nwait) == 0) { - // The count is already consumed by another goroutine, - // so no need to wake up another goroutine. -- runtime_unlock(root); -+ runtime_unlock(&root->lock); - return; - } - for(s = root->head; s; s = s->next) { -@@ -175,7 +175,7 @@ - break; - } - } -- runtime_unlock(root); -+ runtime_unlock(&root->lock); - if(s) { - if(s->releasetime) - s->releasetime = runtime_cputicks(); -@@ -211,7 +211,7 @@ - typedef struct SyncSema SyncSema; - struct SyncSema - { -- Lock; -+ Lock lock; - SemaWaiter* head; - SemaWaiter* tail; - }; -@@ -238,7 +238,7 @@ - w.releasetime = -1; - } - -- runtime_lock(s); -+ runtime_lock(&s->lock); - if(s->head && s->head->nrelease > 0) { - // have pending release, consume it - wake = nil; -@@ -249,7 +249,7 @@ - if(s->head == nil) - s->tail = nil; - } -- runtime_unlock(s); -+ runtime_unlock(&s->lock); - if(wake) - runtime_ready(wake->g); - } else { -@@ -259,7 +259,7 @@ - else - s->tail->next = &w; - s->tail = &w; -- runtime_parkunlock(s, "semacquire"); -+ runtime_parkunlock(&s->lock, "semacquire"); - if(t0) - runtime_blockevent(w.releasetime - t0, 2); - } -@@ -274,7 +274,7 @@ - w.next = nil; - w.releasetime = 0; - -- runtime_lock(s); -+ runtime_lock(&s->lock); - while(w.nrelease > 0 && s->head && s->head->nrelease < 0) { - // have pending acquire, satisfy it - wake = s->head; -@@ -293,7 +293,7 @@ - else - s->tail->next = &w; - s->tail = &w; -- runtime_parkunlock(s, "semarelease"); -+ runtime_parkunlock(&s->lock, "semarelease"); - } else -- runtime_unlock(s); -+ runtime_unlock(&s->lock); - } -diff -r bb70e852004f libgo/runtime/sigqueue.goc ---- a/libgo/runtime/sigqueue.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/sigqueue.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -32,7 +32,7 @@ - #include "defs.h" - - static struct { -- Note; -+ Note note; - uint32 mask[(NSIG+31)/32]; - uint32 wanted[(NSIG+31)/32]; - uint32 state; -@@ -70,7 +70,7 @@ - new = HASSIGNAL; - if(runtime_cas(&sig.state, old, new)) { - if (old == HASWAITER) -- runtime_notewakeup(&sig); -+ runtime_notewakeup(&sig.note); - break; - } - } -@@ -107,8 +107,8 @@ - new = HASWAITER; - if(runtime_cas(&sig.state, old, new)) { - if (new == HASWAITER) { -- runtime_notetsleepg(&sig, -1); -- runtime_noteclear(&sig); -+ runtime_notetsleepg(&sig.note, -1); -+ runtime_noteclear(&sig.note); - } - break; - } -@@ -138,7 +138,7 @@ - // to use for initialization. It does not pass - // signal information in m. - sig.inuse = true; // enable reception of signals; cannot disable -- runtime_noteclear(&sig); -+ runtime_noteclear(&sig.note); - return; - } - -diff -r bb70e852004f libgo/runtime/time.goc ---- a/libgo/runtime/time.goc Fri Jan 16 13:28:21 2015 -0800 -+++ b/libgo/runtime/time.goc Fri Apr 03 17:31:02 2015 -0700 -@@ -92,17 +92,17 @@ - t.fv = &readyv; - t.arg.__object = g; - t.seq = 0; -- runtime_lock(&timers); -+ runtime_lock(&timers.lock); - addtimer(&t); -- runtime_parkunlock(&timers, reason); -+ runtime_parkunlock(&timers.lock, reason); - } - - void - runtime_addtimer(Timer *t) - { -- runtime_lock(&timers); -+ runtime_lock(&timers.lock); - addtimer(t); -- runtime_unlock(&timers); -+ runtime_unlock(&timers.lock); - } - - // Add a timer to the heap and start or kick the timer proc -@@ -167,14 +167,14 @@ - i = t->i; - gi = i; - -- runtime_lock(&timers); -+ runtime_lock(&timers.lock); - - // t may not be registered anymore and may have - // a bogus i (typically 0, if generated by Go). - // Verify it before proceeding. - i = t->i; - if(i < 0 || i >= timers.len || timers.t[i] != t) { -- runtime_unlock(&timers); -+ runtime_unlock(&timers.lock); - return false; - } - -@@ -190,7 +190,7 @@ - } - if(debug) - dumptimers("deltimer"); -- runtime_unlock(&timers); -+ runtime_unlock(&timers.lock); - return true; - } - -@@ -209,7 +209,7 @@ - uintptr seq; - - for(;;) { -- runtime_lock(&timers); -+ runtime_lock(&timers.lock); - timers.sleeping = false; - now = runtime_nanotime(); - for(;;) { -@@ -236,7 +236,7 @@ - f = (void*)t->fv->fn; - arg = t->arg; - seq = t->seq; -- runtime_unlock(&timers); -+ runtime_unlock(&timers.lock); - __builtin_call_with_static_chain(f(arg, seq), fv); - - // clear f and arg to avoid leak while sleeping for next timer -@@ -246,20 +246,20 @@ - arg.__object = nil; - USED(&arg); - -- runtime_lock(&timers); -+ runtime_lock(&timers.lock); - } - if(delta < 0) { - // No timers left - put goroutine to sleep. - timers.rescheduling = true; - runtime_g()->isbackground = true; -- runtime_parkunlock(&timers, "timer goroutine (idle)"); -+ runtime_parkunlock(&timers.lock, "timer goroutine (idle)"); - runtime_g()->isbackground = false; - continue; - } - // At least one timer pending. Sleep until then. - timers.sleeping = true; - runtime_noteclear(&timers.waitnote); -- runtime_unlock(&timers); -+ runtime_unlock(&timers.lock); - runtime_notetsleepg(&timers.waitnote, delta); - } - } diff --git a/llgo/llgo-go.sh b/llgo/llgo-go.sh deleted file mode 100644 index a29be01a55e3539f580945084cfbcc3ce9202abc..0000000000000000000000000000000000000000 --- a/llgo/llgo-go.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -e - -scriptpath=$(which "$0") -scriptpath=$(readlink -f "$scriptpath") -bindir=$(dirname "$scriptpath") -prefix=$(dirname "$bindir") - -cmd="$1" - -case "$cmd" in -build | get | install | run | test) - shift - PATH="$prefix/lib/llgo/go-path:$PATH" exec go "$cmd" -compiler gccgo "$@" - ;; - -*) - exec go "$@" - ;; -esac diff --git a/llgo/ssaopt/esc.go b/llgo/ssaopt/esc.go deleted file mode 100644 index 34a86e1f2518cb44e45324c7083d0c3b4c4b6e38..0000000000000000000000000000000000000000 --- a/llgo/ssaopt/esc.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2014 The llgo Authors. -// Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -package ssaopt - -import ( - "go/token" - - "llvm.org/llgo/third_party/gotools/go/ssa" -) - -func escapes(val ssa.Value, bb *ssa.BasicBlock, pending []ssa.Value) bool { - for _, p := range pending { - if val == p { - return false - } - } - - for _, ref := range *val.Referrers() { - switch ref := ref.(type) { - case *ssa.Phi: - // We must consider the variable to have escaped if it is - // possible for the program to see more than one "version" - // of the variable at once, as this requires the program - // to use heap allocation for the multiple versions. - // - // I (pcc) think that this is only possible (without stores) - // in the case where a phi node that (directly or indirectly) - // refers to the allocation dominates the allocation. - if ref.Block().Dominates(bb) { - return true - } - if escapes(ref, bb, append(pending, val)) { - return true - } - - case *ssa.BinOp, *ssa.ChangeType, *ssa.Convert, *ssa.ChangeInterface, *ssa.MakeInterface, *ssa.Slice, *ssa.FieldAddr, *ssa.IndexAddr, *ssa.TypeAssert, *ssa.Extract: - if escapes(ref.(ssa.Value), bb, append(pending, val)) { - return true - } - - case *ssa.Range, *ssa.DebugRef: - continue - - case *ssa.UnOp: - if ref.Op == token.MUL || ref.Op == token.ARROW { - continue - } - if escapes(ref, bb, append(pending, val)) { - return true - } - - case *ssa.Store: - if val == ref.Val { - return true - } - - case *ssa.Call: - if builtin, ok := ref.Call.Value.(*ssa.Builtin); ok { - switch builtin.Name() { - case "cap", "len", "copy", "ssa:wrapnilchk": - continue - case "append": - if ref.Call.Args[0] == val && escapes(ref, bb, append(pending, val)) { - return true - } - default: - return true - } - } else { - return true - } - - default: - return true - } - } - - return false -} - -func LowerAllocsToStack(f *ssa.Function) { - pending := make([]ssa.Value, 0, 10) - - for _, b := range f.Blocks { - for _, instr := range b.Instrs { - if alloc, ok := instr.(*ssa.Alloc); ok && alloc.Heap && !escapes(alloc, alloc.Block(), pending) { - alloc.Heap = false - f.Locals = append(f.Locals, alloc) - } - } - } -} diff --git a/llgo/test/CMakeLists.txt b/llgo/test/CMakeLists.txt deleted file mode 100644 index c8a346f3db63162c3f43bee43b5ca9b6477b1217..0000000000000000000000000000000000000000 --- a/llgo/test/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -configure_lit_site_cfg( - ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in - ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg - ) - -add_lit_testsuite(check-llgo "Running the llgo regression tests" - ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS - FileCheck - count - llgo - llgoi - libgo - not - ) -set_target_properties(check-llgo PROPERTIES FOLDER "Tests") diff --git a/llgo/test/debuginfo/emptyname.go b/llgo/test/debuginfo/emptyname.go deleted file mode 100644 index 28ad10df5140b08232e647cadf69b5d217c02b3b..0000000000000000000000000000000000000000 --- a/llgo/test/debuginfo/emptyname.go +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: llgo -c -o /dev/null -g %s - -package main - -//line :1 -func main() { -} diff --git a/llgo/test/driver/parse-arguments.go b/llgo/test/driver/parse-arguments.go deleted file mode 100644 index 36b3c5c615cd1ec173fb4fa51672e80dfe81d3d8..0000000000000000000000000000000000000000 --- a/llgo/test/driver/parse-arguments.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: not llgo -B 2>&1 | FileCheck --check-prefix=B %s -// RUN: not llgo -D 2>&1 | FileCheck --check-prefix=D %s -// RUN: not llgo -I 2>&1 | FileCheck --check-prefix=I %s -// RUN: not llgo -isystem 2>&1 | FileCheck --check-prefix=isystem %s -// RUN: not llgo -L 2>&1 | FileCheck --check-prefix=L %s -// RUN: not llgo -fload-plugin 2>&1 | FileCheck --check-prefix=fload-plugin %s -// RUN: not llgo -mllvm 2>&1 | FileCheck --check-prefix=mllvm %s -// RUN: not llgo -o 2>&1 | FileCheck --check-prefix=o %s - -// B: missing argument after '-B' -// D: missing argument after '-D' -// I: missing argument after '-I' -// isystem: missing argument after '-isystem' -// L: missing argument after '-L' -// fload-plugin: missing argument after '-fload-plugin' -// mllvm: missing argument after '-mllvm' -// o: missing argument after '-o' diff --git a/llgo/test/execution/Inputs/init2.go b/llgo/test/execution/Inputs/init2.go deleted file mode 100644 index 041d7647b3e91b10bef46480fc7e23ef8ccc556f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/Inputs/init2.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func init() { - println("do some other stuff before main") -} diff --git a/llgo/test/execution/arrays/compare.go b/llgo/test/execution/arrays/compare.go deleted file mode 100644 index b99d4fd8f8e759f2783c1b0b1fe8a74879c84af3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/arrays/compare.go +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: false -// CHECK-NEXT: true -// CHECK-NEXT: false - -package main - -func main() { - a := [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - b := [...]int{10, 1, 2, 3, 4, 5, 6, 7, 8, 9} - c := [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} - - println(a == b) - println(a == c) - println(b == c) -} diff --git a/llgo/test/execution/arrays/index.go b/llgo/test/execution/arrays/index.go deleted file mode 100644 index 78c53150aa2eae2befb738feaa60e3ef1a674b81..0000000000000000000000000000000000000000 --- a/llgo/test/execution/arrays/index.go +++ /dev/null @@ -1,288 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: 10 -// CHECK-NEXT: 11 -// CHECK-NEXT: 12 -// CHECK-NEXT: 13 -// CHECK-NEXT: 14 -// CHECK-NEXT: 15 -// CHECK-NEXT: 16 -// CHECK-NEXT: 17 -// CHECK-NEXT: 18 -// CHECK-NEXT: 19 -// CHECK-NEXT: 20 -// CHECK-NEXT: 21 -// CHECK-NEXT: 22 -// CHECK-NEXT: 23 -// CHECK-NEXT: 24 -// CHECK-NEXT: 25 -// CHECK-NEXT: 26 -// CHECK-NEXT: 27 -// CHECK-NEXT: 28 -// CHECK-NEXT: 29 -// CHECK-NEXT: 30 -// CHECK-NEXT: 31 -// CHECK-NEXT: 32 -// CHECK-NEXT: 33 -// CHECK-NEXT: 34 -// CHECK-NEXT: 35 -// CHECK-NEXT: 36 -// CHECK-NEXT: 37 -// CHECK-NEXT: 38 -// CHECK-NEXT: 39 -// CHECK-NEXT: 40 -// CHECK-NEXT: 41 -// CHECK-NEXT: 42 -// CHECK-NEXT: 43 -// CHECK-NEXT: 44 -// CHECK-NEXT: 45 -// CHECK-NEXT: 46 -// CHECK-NEXT: 47 -// CHECK-NEXT: 48 -// CHECK-NEXT: 49 -// CHECK-NEXT: 50 -// CHECK-NEXT: 51 -// CHECK-NEXT: 52 -// CHECK-NEXT: 53 -// CHECK-NEXT: 54 -// CHECK-NEXT: 55 -// CHECK-NEXT: 56 -// CHECK-NEXT: 57 -// CHECK-NEXT: 58 -// CHECK-NEXT: 59 -// CHECK-NEXT: 60 -// CHECK-NEXT: 61 -// CHECK-NEXT: 62 -// CHECK-NEXT: 63 -// CHECK-NEXT: 64 -// CHECK-NEXT: 65 -// CHECK-NEXT: 66 -// CHECK-NEXT: 67 -// CHECK-NEXT: 68 -// CHECK-NEXT: 69 -// CHECK-NEXT: 70 -// CHECK-NEXT: 71 -// CHECK-NEXT: 72 -// CHECK-NEXT: 73 -// CHECK-NEXT: 74 -// CHECK-NEXT: 75 -// CHECK-NEXT: 76 -// CHECK-NEXT: 77 -// CHECK-NEXT: 78 -// CHECK-NEXT: 79 -// CHECK-NEXT: 80 -// CHECK-NEXT: 81 -// CHECK-NEXT: 82 -// CHECK-NEXT: 83 -// CHECK-NEXT: 84 -// CHECK-NEXT: 85 -// CHECK-NEXT: 86 -// CHECK-NEXT: 87 -// CHECK-NEXT: 88 -// CHECK-NEXT: 89 -// CHECK-NEXT: 90 -// CHECK-NEXT: 91 -// CHECK-NEXT: 92 -// CHECK-NEXT: 93 -// CHECK-NEXT: 94 -// CHECK-NEXT: 95 -// CHECK-NEXT: 96 -// CHECK-NEXT: 97 -// CHECK-NEXT: 98 -// CHECK-NEXT: 99 -// CHECK-NEXT: 100 -// CHECK-NEXT: 101 -// CHECK-NEXT: 102 -// CHECK-NEXT: 103 -// CHECK-NEXT: 104 -// CHECK-NEXT: 105 -// CHECK-NEXT: 106 -// CHECK-NEXT: 107 -// CHECK-NEXT: 108 -// CHECK-NEXT: 109 -// CHECK-NEXT: 110 -// CHECK-NEXT: 111 -// CHECK-NEXT: 112 -// CHECK-NEXT: 113 -// CHECK-NEXT: 114 -// CHECK-NEXT: 115 -// CHECK-NEXT: 116 -// CHECK-NEXT: 117 -// CHECK-NEXT: 118 -// CHECK-NEXT: 119 -// CHECK-NEXT: 120 -// CHECK-NEXT: 121 -// CHECK-NEXT: 122 -// CHECK-NEXT: 123 -// CHECK-NEXT: 124 -// CHECK-NEXT: 125 -// CHECK-NEXT: 126 -// CHECK-NEXT: 127 -// CHECK-NEXT: 128 -// CHECK-NEXT: 129 -// CHECK-NEXT: 130 -// CHECK-NEXT: 131 -// CHECK-NEXT: 132 -// CHECK-NEXT: 133 -// CHECK-NEXT: 134 -// CHECK-NEXT: 135 -// CHECK-NEXT: 136 -// CHECK-NEXT: 137 -// CHECK-NEXT: 138 -// CHECK-NEXT: 139 -// CHECK-NEXT: 140 -// CHECK-NEXT: 141 -// CHECK-NEXT: 142 -// CHECK-NEXT: 143 -// CHECK-NEXT: 144 -// CHECK-NEXT: 145 -// CHECK-NEXT: 146 -// CHECK-NEXT: 147 -// CHECK-NEXT: 148 -// CHECK-NEXT: 149 -// CHECK-NEXT: 150 -// CHECK-NEXT: 151 -// CHECK-NEXT: 152 -// CHECK-NEXT: 153 -// CHECK-NEXT: 154 -// CHECK-NEXT: 155 -// CHECK-NEXT: 156 -// CHECK-NEXT: 157 -// CHECK-NEXT: 158 -// CHECK-NEXT: 159 -// CHECK-NEXT: 160 -// CHECK-NEXT: 161 -// CHECK-NEXT: 162 -// CHECK-NEXT: 163 -// CHECK-NEXT: 164 -// CHECK-NEXT: 165 -// CHECK-NEXT: 166 -// CHECK-NEXT: 167 -// CHECK-NEXT: 168 -// CHECK-NEXT: 169 -// CHECK-NEXT: 170 -// CHECK-NEXT: 171 -// CHECK-NEXT: 172 -// CHECK-NEXT: 173 -// CHECK-NEXT: 174 -// CHECK-NEXT: 175 -// CHECK-NEXT: 176 -// CHECK-NEXT: 177 -// CHECK-NEXT: 178 -// CHECK-NEXT: 179 -// CHECK-NEXT: 180 -// CHECK-NEXT: 181 -// CHECK-NEXT: 182 -// CHECK-NEXT: 183 -// CHECK-NEXT: 184 -// CHECK-NEXT: 185 -// CHECK-NEXT: 186 -// CHECK-NEXT: 187 -// CHECK-NEXT: 188 -// CHECK-NEXT: 189 -// CHECK-NEXT: 190 -// CHECK-NEXT: 191 -// CHECK-NEXT: 192 -// CHECK-NEXT: 193 -// CHECK-NEXT: 194 -// CHECK-NEXT: 195 -// CHECK-NEXT: 196 -// CHECK-NEXT: 197 -// CHECK-NEXT: 198 -// CHECK-NEXT: 199 -// CHECK-NEXT: 200 -// CHECK-NEXT: 201 -// CHECK-NEXT: 202 -// CHECK-NEXT: 203 -// CHECK-NEXT: 204 -// CHECK-NEXT: 205 -// CHECK-NEXT: 206 -// CHECK-NEXT: 207 -// CHECK-NEXT: 208 -// CHECK-NEXT: 209 -// CHECK-NEXT: 210 -// CHECK-NEXT: 211 -// CHECK-NEXT: 212 -// CHECK-NEXT: 213 -// CHECK-NEXT: 214 -// CHECK-NEXT: 215 -// CHECK-NEXT: 216 -// CHECK-NEXT: 217 -// CHECK-NEXT: 218 -// CHECK-NEXT: 219 -// CHECK-NEXT: 220 -// CHECK-NEXT: 221 -// CHECK-NEXT: 222 -// CHECK-NEXT: 223 -// CHECK-NEXT: 224 -// CHECK-NEXT: 225 -// CHECK-NEXT: 226 -// CHECK-NEXT: 227 -// CHECK-NEXT: 228 -// CHECK-NEXT: 229 -// CHECK-NEXT: 230 -// CHECK-NEXT: 231 -// CHECK-NEXT: 232 -// CHECK-NEXT: 233 -// CHECK-NEXT: 234 -// CHECK-NEXT: 235 -// CHECK-NEXT: 236 -// CHECK-NEXT: 237 -// CHECK-NEXT: 238 -// CHECK-NEXT: 239 -// CHECK-NEXT: 240 -// CHECK-NEXT: 241 -// CHECK-NEXT: 242 -// CHECK-NEXT: 243 -// CHECK-NEXT: 244 -// CHECK-NEXT: 245 -// CHECK-NEXT: 246 -// CHECK-NEXT: 247 -// CHECK-NEXT: 248 -// CHECK-NEXT: 249 -// CHECK-NEXT: 250 -// CHECK-NEXT: 251 -// CHECK-NEXT: 252 -// CHECK-NEXT: 253 -// CHECK-NEXT: 254 - -package main - -func testBasics() { - var i [2]int - j := &i - i[0] = 123 - i[1] = 456 - println(i[0], i[1]) - println(j[0], j[1]) - i[0]++ - i[1]-- - println(i[0], i[1]) - println(j[0], j[1]) -} - -func testByteIndex() { - var a [255]int - for i := 0; i < len(a); i++ { - a[i] = i - } - for i := byte(0); i < byte(len(a)); i++ { - println(a[i]) - } -} - -func main() { - //testBasics() - testByteIndex() -} diff --git a/llgo/test/execution/arrays/range.go b/llgo/test/execution/arrays/range.go deleted file mode 100644 index 37d22f62bdae3e3367da7fbc9c5208c12ce0d667..0000000000000000000000000000000000000000 --- a/llgo/test/execution/arrays/range.go +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 0 0 -// CHECK-NEXT: 1 1 1 -// CHECK-NEXT: 2 2 2 -// CHECK-NEXT: 3 0 0 -// CHECK-NEXT: 4 4 4 -// CHECK-NEXT: 0 10 -// CHECK-NEXT: 1 20 -// CHECK-NEXT: 2 30 - -package main - -func main() { - a := [...]int{1: 1, 2: 2, 4: 4} - for i, val := range a { - println(i, val, a[i]) - } - for i, val := range [...]int{10, 20, 30} { - println(i, val) - } -} diff --git a/llgo/test/execution/arrays/slice.go b/llgo/test/execution/arrays/slice.go deleted file mode 100644 index e2880906d92c9bcdd59fdcd78e3421c1f7d55751..0000000000000000000000000000000000000000 --- a/llgo/test/execution/arrays/slice.go +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 10 -// CHECK-NEXT: 9 - -package main - -func main() { - var a [10]int - b := a[1:] - println(len(a)) - println(len(b)) -} diff --git a/llgo/test/execution/assignment/arrays.go b/llgo/test/execution/assignment/arrays.go deleted file mode 100644 index 30921a4cabd00eadcdf2c8625dac269bbbcecaee..0000000000000000000000000000000000000000 --- a/llgo/test/execution/assignment/arrays.go +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: +1.000000e+000 -// CHECK-NEXT: +2.000000e+000 -// CHECK-NEXT: +3.000000e+000 - -package main - -var a1 = [...]float32{1.0, 2.0, 3.0} - -func main() { - var a2 [3]float32 - a2 = a1 - println(a2[0]) - println(a2[1]) - println(a2[2]) - - // broken due to lack of promotion of - // stack to heap. - //println(a2[0], a2[1], a2[2]) -} diff --git a/llgo/test/execution/assignment/binop.go b/llgo/test/execution/assignment/binop.go deleted file mode 100644 index 51793ff4c5c526e9a619abd5d8929df20f10a034..0000000000000000000000000000000000000000 --- a/llgo/test/execution/assignment/binop.go +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 246 -// CHECK-NEXT: 123 -// CHECK-NEXT: 124 -// CHECK-NEXT: 123 - -package main - -func main() { - x := 123 - x *= 2 - println(x) - x /= 2 - println(x) - x += 1 - println(x) - x -= 1 - println(x) -} diff --git a/llgo/test/execution/assignment/dereferencing.go b/llgo/test/execution/assignment/dereferencing.go deleted file mode 100644 index 607e28d590933fbd366562dd934dc836e74b9e17..0000000000000000000000000000000000000000 --- a/llgo/test/execution/assignment/dereferencing.go +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 123 - -package main - -func main() { - var x int - px := &x - *px = 123 - println(x) -} diff --git a/llgo/test/execution/assignment/multi.go b/llgo/test/execution/assignment/multi.go deleted file mode 100644 index 60b8805debfd8f4161b1ff583810492dac713a43..0000000000000000000000000000000000000000 --- a/llgo/test/execution/assignment/multi.go +++ /dev/null @@ -1,40 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 123 456 -// CHECK-NEXT: 456 123 -// CHECK-NEXT: 456 123 -// CHECK-NEXT: 123 456 -// CHECK-NEXT: 123 456 - -package main - -func xyz() (int, int) { - return 123, 456 -} - -func abc() (int, int) { - var a, b = xyz() - return a, b -} - -type S struct { - a int - b int -} - -func main() { - a, b := xyz() - println(a, b) - b, a = abc() - println(a, b) - - // swap - println(a, b) - a, b = b, a - println(a, b) - - var s S - s.a, s.b = a, b - println(s.a, s.b) -} diff --git a/llgo/test/execution/assignment/namedresult.go b/llgo/test/execution/assignment/namedresult.go deleted file mode 100644 index daf9b003c618c60712a2848cb66bab61c467d7aa..0000000000000000000000000000000000000000 --- a/llgo/test/execution/assignment/namedresult.go +++ /dev/null @@ -1,42 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 123 -// CHECK-NEXT: 456 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: 666 0 - -package main - -func f1() (x int) { - x = 123 - return -} - -func f2() (x int) { - return 456 -} - -func f3() (x, y int) { - y, x = 2, 1 - return -} - -func f4() (x, _ int) { - x = 666 - return -} - -func main() { - x := f1() - println(x) - x = f2() - println(x) - - var y int - x, y = f3() - println(x, y) - - x, y = f4() - println(x, y) -} diff --git a/llgo/test/execution/branching/goto.go b/llgo/test/execution/branching/goto.go deleted file mode 100644 index 748c666da42e1f711640944b9b8edc96aa54411f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/branching/goto.go +++ /dev/null @@ -1,43 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: done -// CHECK-NEXT: ! - -package main - -func f1() { - goto labeled -labeled: - goto done - return -done: - println("!") -} - -func main() { - i := 0 -start: - if i < 10 { - println(i) - i++ - goto start - } else { - goto end - } - return -end: - println("done") - f1() - return -} diff --git a/llgo/test/execution/branching/labeled.go b/llgo/test/execution/branching/labeled.go deleted file mode 100644 index efff5ef1d21bb4c2b333c01d76667a12ffd1eb68..0000000000000000000000000000000000000000 --- a/llgo/test/execution/branching/labeled.go +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 - -package main - -func labeledBreak() { - var i int -L: - for ; i < 10; i++ { - switch { - default: - break L - } - } - println(i) -} - -func main() { - labeledBreak() -} diff --git a/llgo/test/execution/chan/buffered.go b/llgo/test/execution/chan/buffered.go deleted file mode 100644 index 9247ce32e045b96e19152bb898f3817fc3ba984f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/chan/buffered.go +++ /dev/null @@ -1,41 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 0 -// CHECK-NEXT: 0 1 -// CHECK-NEXT: 10 -// CHECK-NEXT: 20 -// CHECK-NEXT: 30 -// CHECK-NEXT: 40 -// CHECK-NEXT: 50 -// CHECK-NEXT: 60 -// CHECK-NEXT: 70 -// CHECK-NEXT: 80 -// CHECK-NEXT: 90 -// CHECK-NEXT: 100 -// CHECK-NEXT: -1 - -package main - -func main() { - c := make(chan int) - println(len(c), cap(c)) - c1 := make(chan int, 1) - println(len(c1), cap(c1)) - f := func() { - n, ok := <-c - if ok { - c1 <- n * 10 - } else { - c1 <- -1 - } - } - for i := 0; i < 10; i++ { - go f() - c <- i + 1 - println(<-c1) - } - go f() - close(c) - println(<-c1) -} diff --git a/llgo/test/execution/chan/range.go b/llgo/test/execution/chan/range.go deleted file mode 100644 index eeaedb7f9823815dcb7b29f841f937aafda9a13c..0000000000000000000000000000000000000000 --- a/llgo/test/execution/chan/range.go +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 - -package main - -func main() { - ch := make(chan int) - go func() { - for i := 0; i < 10; i++ { - ch <- i - } - close(ch) - }() - for n := range ch { - println(n) - } -} diff --git a/llgo/test/execution/chan/select.go b/llgo/test/execution/chan/select.go deleted file mode 100644 index 80872f578ce32960f1589cbe5d768995307a49d3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/chan/select.go +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: sent a value -// CHECK-NEXT: received 123 -// CHECK-NEXT: default - -package main - -func f1() { - c := make(chan int, 1) - for i := 0; i < 3; i++ { - select { - case n, _ := <-c: - println("received", n) - c = nil - case c <- 123: - println("sent a value") - default: - println("default") - } - } -} - -func main() { - f1() -} diff --git a/llgo/test/execution/chan/self.go b/llgo/test/execution/chan/self.go deleted file mode 100644 index d26ee4a22f3c11d9fb3b5f5517ef2718a20092fc..0000000000000000000000000000000000000000 --- a/llgo/test/execution/chan/self.go +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: true - -package main - -func main() { - ch := make(chan int, uint8(1)) - - ch <- 1 - println(<-ch) - - ch <- 2 - x, ok := <-ch - println(x) - println(ok) -} diff --git a/llgo/test/execution/circulartype.go b/llgo/test/execution/circulartype.go deleted file mode 100644 index 01e9ce44493ee5b3cabc63a382f0dbcff69608e3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/circulartype.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | count 0 - -package main - -type A struct { - b1, b2 B -} - -type B struct { - a1, a2 *A -} - -func main() { - var a A - _ = a -} diff --git a/llgo/test/execution/closures/basic.go b/llgo/test/execution/closures/basic.go deleted file mode 100644 index 2a84fc130e8bd8c2f816c2364d4962b006a2aa0f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/closures/basic.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: abc - -package main - -func cat(a, b string) func(string) string { - return func(c string) string { return a + b + c } -} - -func main() { - f := cat("a", "b") - println(f("c")) -} diff --git a/llgo/test/execution/closures/issue176.go b/llgo/test/execution/closures/issue176.go deleted file mode 100644 index 4a505ca19b0c531742561d96536e712dd6693798..0000000000000000000000000000000000000000 --- a/llgo/test/execution/closures/issue176.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: false - -package main - -func main() { - a := false - f := func() { - make(chan *bool, 1) <- &a - } - f() - println(a) -} diff --git a/llgo/test/execution/complex.go b/llgo/test/execution/complex.go deleted file mode 100644 index ad2a87bbd3cd5a51b402d035c0d426d2d36a9791..0000000000000000000000000000000000000000 --- a/llgo/test/execution/complex.go +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: (+1.000000e+000+2.000000e+000i) -// CHECK-NEXT: (-1.000000e+000-2.000000e+000i) -// CHECK-NEXT: true -// CHECK-NEXT: (+1.000000e+000+2.000000e+000i) -// CHECK-NEXT: (-1.000000e+000-2.000000e+000i) -// CHECK-NEXT: true - -package main - -func main() { - var f32 float32 = 1 - var f64 float64 = 1 - c64 := complex(f32, f32+1) - println(c64) - println(-c64) - println(c64 == c64) - c128 := complex(f64, f64+1) - println(c128) - println(-c128) - println(c128 == c128) -} diff --git a/llgo/test/execution/const.go b/llgo/test/execution/const.go deleted file mode 100644 index 45dbb0f03cda68594055f46e1933e49018255cd3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/const.go +++ /dev/null @@ -1,78 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 1 -// CHECK-NEXT: 1 1 1 4 -// CHECK-NEXT: 2147483647 -// CHECK-NEXT: -2147483648 -// CHECK-NEXT: 2147483647 -// CHECK-NEXT: -127 -// CHECK-NEXT: false -// CHECK-NEXT: 10000000000 -// CHECK-NEXT: 1 -// CHECK-NEXT: 3 - -package main - -import "runtime" - -const ( - a = iota * 2 - A = 1 - B - C - D = Z + iota -) - -const ( - Z = iota - Big = 1<<31 - 1 - Big2 = -2147483648 - Big3 = 2147483647 -) - -const ( - expbits32 uint = 8 - bias32 = -1<<(expbits32-1) + 1 - darwinAMD64 = runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" -) - -func f1() float32 { - return 0 -} - -func constArrayLen() { - a := [...]int{1, 2, 3} - const x = len(a) - println(x) -} - -func main() { - println(a) - println(B) - println(A, A) - println(A, B, C, D) - println(Big) - println(Big2) - println(Big3) - println(bias32) - - // Currently fails, due to difference in C printf and Go's println - // formatting of the exponent. - //println(10 * 1e9) - println(darwinAMD64) - - // Test conversion. - println(int64(10) * 1e9) - - // Ensure consts work just as well when declared inside a function. - const ( - x_ = iota - y_ - ) - println(y_) - - constArrayLen() -} diff --git a/llgo/test/execution/conversions/complex.go b/llgo/test/execution/conversions/complex.go deleted file mode 100644 index 91dd366c43448be8906b99cb21b975427e1cca5a..0000000000000000000000000000000000000000 --- a/llgo/test/execution/conversions/complex.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | count 0 - -package main - -func constIntToComplex() complex128 { - return 0 -} - -func main() { - var c64 complex64 - var c128 complex128 - c128 = complex128(c64) - c64 = complex64(c128) -} diff --git a/llgo/test/execution/conversions/float.go b/llgo/test/execution/conversions/float.go deleted file mode 100644 index def11d1699a914f3940663acfdc48f8d8326b1b4..0000000000000000000000000000000000000000 --- a/llgo/test/execution/conversions/float.go +++ /dev/null @@ -1,103 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: 133 -// CHECK-NEXT: 65413 -// CHECK-NEXT: 4294967173 -// CHECK-NEXT: 18446744073709551493 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: 123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: -123 -// CHECK-NEXT: 133 -// CHECK-NEXT: 65413 -// CHECK-NEXT: 4294967173 -// CHECK-NEXT: 18446744073709551493 -// CHECK-NEXT: +1.230000e+002 -// CHECK-NEXT: +1.230000e+002 -// CHECK-NEXT: +1.230000e+002 -// CHECK-NEXT: +1.230000e+002 -// CHECK-NEXT: +1.234500e+004 -// CHECK-NEXT: +1.234500e+004 -// CHECK-NEXT: +1.234500e+004 -// CHECK-NEXT: +1.234500e+004 -// CHECK-NEXT: +1.234560e+005 -// CHECK-NEXT: +1.234560e+005 -// CHECK-NEXT: +1.234560e+005 -// CHECK-NEXT: +1.234560e+005 -// CHECK-NEXT: +1.234568e+010 -// CHECK-NEXT: +1.234568e+010 -// CHECK-NEXT: +1.234568e+010 -// CHECK-NEXT: +1.234568e+010 - -package main - -func main() { - // float to int - for _, f32 := range []float32{123.456, -123.456} { - println(int8(f32)) - println(int16(f32)) - println(int32(f32)) - println(int64(f32)) - println(uint8(f32)) - println(uint16(f32)) - println(uint32(f32)) - println(uint64(f32)) - } - for _, f64 := range []float64{123.456, -123.456} { - println(int8(f64)) - println(int16(f64)) - println(int32(f64)) - println(int64(f64)) - println(uint8(f64)) - println(uint16(f64)) - println(uint32(f64)) - println(uint64(f64)) - } - - // int to float - var i8 int8 = 123 - println(float32(i8)) - println(float64(i8)) - var ui8 uint8 = 123 - println(float32(ui8)) - println(float64(ui8)) - var i16 int32 = 12345 - println(float32(i16)) - println(float64(i16)) - var ui16 uint32 = 12345 - println(float32(ui16)) - println(float64(ui16)) - var i32 int32 = 123456 - println(float32(i32)) - println(float64(i32)) - var ui32 uint32 = 123456 - println(float32(ui32)) - println(float64(ui32)) - var i64 int64 = 12345678910 - println(float32(i64)) - println(float64(i64)) - var ui64 uint64 = 12345678910 - println(float32(ui64)) - println(float64(ui64)) -} diff --git a/llgo/test/execution/conversions/int.go b/llgo/test/execution/conversions/int.go deleted file mode 100644 index 092003b3b89977e6fd85a2af31477eb29d920a6f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/conversions/int.go +++ /dev/null @@ -1,44 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 2147483647 -// CHECK-NEXT: 2147483647 -// CHECK-NEXT: 2147483647 -// CHECK-NEXT: 2147483648 -// CHECK-NEXT: -2147483648 -// CHECK-NEXT: 18446744071562067968 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: -1 -// CHECK-NEXT: 4294967295 -// CHECK-NEXT: 4294967295 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 - -package main - -func signed(i32 int32) { - println(uint32(i32)) - println(int64(i32)) - println(uint64(i32)) -} - -func unsigned(u32 uint32) { - println(int32(u32)) - println(int64(u32)) - println(uint64(u32)) -} - -func main() { - signed(1<<31 - 1) - signed(-1 << 31) - signed(0) - unsigned(1<<32 - 1) - unsigned(0) - unsigned(1) -} diff --git a/llgo/test/execution/conversions/sameunderlying.go b/llgo/test/execution/conversions/sameunderlying.go deleted file mode 100644 index 8208cfba116aaf2828570a7d6cbdb3947aa3d97c..0000000000000000000000000000000000000000 --- a/llgo/test/execution/conversions/sameunderlying.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | count 0 - -package main - -type X struct{} -type Y X - -func main() { - var x X - px := &x - py := (*Y)(&x) - py = (*Y)(px) - _ = py -} diff --git a/llgo/test/execution/defer.go b/llgo/test/execution/defer.go deleted file mode 100644 index ba1b63217b8e4fabce705f88697576a148507c4f..0000000000000000000000000000000000000000 --- a/llgo/test/execution/defer.go +++ /dev/null @@ -1,125 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: f2.1 -// CHECK-NEXT: f5 -// CHECK-NEXT: recovered no error -// CHECK-NEXT: f5 -// CHECK-NEXT: recovered: meep meep -// CHECK-NEXT: 888 -// CHECK-NEXT: f5 -// CHECK-NEXT: recovered no error -// CHECK-NEXT: f5 -// CHECK-NEXT: recovered no error -// CHECK-NEXT: 888 -// CHECK-NEXT: 456 -// CHECK-NEXT: 999 -// CHECK-NEXT: 999 -// CHECK-NEXT: 123 -// CHECK-NEXT: 999 -// CHECK-NEXT: 999 -// CHECK-NEXT: 246 -// CHECK-NEXT: f2.2 -// CHECK-NEXT: f2.3 -// CHECK-NEXT: f1.1 -// CHECK-NEXT: f1.2 -// CHECK-NEXT: recovered: second -// CHECK-NEXT: ahoy - -package main - -type T struct { - value int -} - -type T1 struct { - T -} - -func (t T) abc() { - println(t.value) -} - -func (t *T) def() { - println(t.value) -} - -func (t *T) ghi(v int) { - println(v) -} - -func printerr(err interface{}) { - if err != nil { - println("recovered:", err.(string)) - } else { - println("recovered no error") - } -} - -func f6() { - defer func() { printerr(recover()) }() - defer func() { panic("second") }() - panic("first") -} - -func f5(panic_ bool) { - var t1 T1 - t1.T.value = 888 - defer t1.abc() - var f func(int) - f = func(recursion int) { - if recursion > 0 { - f(recursion - 1) - return - } - println("f5") - printerr(recover()) - } - defer f(0) // will recover (after f(1)) - defer f(1) // won't recover - if panic_ { - panic("meep meep") - } -} - -func f4() { - var a T = T{999} - var b *T = &a - defer a.abc() - defer a.def() - defer a.ghi(123) - defer b.abc() - defer b.def() - defer b.ghi(456) - f5(true) - f5(false) // verify the recover in f5 works -} - -func f3() (a int) { - defer func() { a *= 2 }() - f4() - return 123 -} - -func f2() { - defer func() { println("f2.3") }() - defer func(s string) { println(s) }("f2.2") - println("f2.1") - println(f3()) -} - -func f1() { - defer func() { println("f1.2") }() - defer func() { println("f1.1") }() - f2() -} - -func builtins() { - defer println("ahoy") -} - -func main() { - f1() - f6() - builtins() -} diff --git a/llgo/test/execution/errors/recover.go b/llgo/test/execution/errors/recover.go deleted file mode 100644 index 70ee2ac15a785fe0408ac26901ab50fbc63bcebf..0000000000000000000000000000000000000000 --- a/llgo/test/execution/errors/recover.go +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: (0x0,0x0) - -package main - -func main() { - err := recover() - println(err) -} diff --git a/llgo/test/execution/for/branch.go b/llgo/test/execution/for/branch.go deleted file mode 100644 index 5484c891adf1f2c8be099f03c77fa5ad52f52d99..0000000000000000000000000000000000000000 --- a/llgo/test/execution/for/branch.go +++ /dev/null @@ -1,41 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 0 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 - -package main - -func main() { - for i := 0; true; i++ { - println(i) - if i == 2 { - println(3) - break - } - println(1) - i++ - continue - println("unreachable") - } - - nums := [...]int{0, 1, 2, 3, 4, 5} - for n := range nums { - if n == 1 { - continue - } - println(n) - if n == 4 { - { - break - } - println("!") - } - } -} diff --git a/llgo/test/execution/fun.go b/llgo/test/execution/fun.go deleted file mode 100644 index c70fe69172d21bbb5752d8802df7376163999fc2..0000000000000000000000000000000000000000 --- a/llgo/test/execution/fun.go +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 246 -// CHECK-NEXT: 123 true false - -// vim: set ft=go : - -package main - -func test() func() int { - return blah -} - -func blah() int { - return 123 -} - -func sret() (int, bool, bool) { - return 123, true, false -} - -func main() { - f := test() - println(2 * f()) - a, b, c := sret() - println(a, b, c) -} diff --git a/llgo/test/execution/functions/compare.go b/llgo/test/execution/functions/compare.go deleted file mode 100644 index 9daa062efe9101452d594035f82ed7b43cb9c181..0000000000000000000000000000000000000000 --- a/llgo/test/execution/functions/compare.go +++ /dev/null @@ -1,26 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: true - -package main - -func main() { - var f func() - println(f == nil) - println(f != nil) - println(nil == f) - println(nil != f) - f = func() {} - println(f == nil) - println(f != nil) - println(nil == f) - println(nil != f) -} diff --git a/llgo/test/execution/functions/multivalue.go b/llgo/test/execution/functions/multivalue.go deleted file mode 100644 index a3ce79b3fc0ef06ce463143e4eb36bd644c24f76..0000000000000000000000000000000000000000 --- a/llgo/test/execution/functions/multivalue.go +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 20 -// CHECK-NEXT: extra: 10 - -package main - -func swap(a, b int) (int, int) { - return b, a -} - -func sub(a, b int) int { - return a - b -} - -func printint(a int, extra ...int) { - println(a) - for _, b := range extra { - println("extra:", b) - } -} - -func main() { - println(sub(swap(1, 2))) - printint(swap(10, 20)) -} diff --git a/llgo/test/execution/functions/unreachable.go b/llgo/test/execution/functions/unreachable.go deleted file mode 100644 index 436012c4e417e5fc60a9e98ae7e50b2031bdb9fd..0000000000000000000000000000000000000000 --- a/llgo/test/execution/functions/unreachable.go +++ /dev/null @@ -1,53 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: f1 -// CHECK-NEXT: f2 -// CHECK-NEXT: f3 -// CHECK-NEXT: f4 -// CHECK-NEXT: 123 - -package main - -func f1() { - if true { - println("f1") - return - } - for { - } -} - -func f2() { - defer func() { println("f2") }() - if true { - return - } - for { - } -} - -func f3() int { - if true { - println("f3") - return 123 - } - for { - } -} - -func f4() int { - defer func() { println("f4") }() - if true { - return 123 - } - for { - } -} - -func main() { - f1() - f2() - f3() - println(f4()) -} diff --git a/llgo/test/execution/go.go b/llgo/test/execution/go.go deleted file mode 100644 index 2bfe775ff9240e17bb9cf874993c69a1d97e593b..0000000000000000000000000000000000000000 --- a/llgo/test/execution/go.go +++ /dev/null @@ -1,34 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: hello from T 1 -// CHECK-NEXT: hello from T 2 - -package main - -type T struct { - val int -} - -func (t T) Hello(done chan bool) { - println("hello from T", t.val) - done <- true -} - -type I interface { - Hello(chan bool) -} - -func main() { - done := make(chan bool) - - t := T{1} - go t.Hello(done) - <-done - - var i I = T{2} - go i.Hello(done) - <-done - - go println("hello builtin") -} diff --git a/llgo/test/execution/if/lazy.go b/llgo/test/execution/if/lazy.go deleted file mode 100644 index 5171a774fa9b1ef16f3ea72f793c3f21ad4b804a..0000000000000000000000000000000000000000 --- a/llgo/test/execution/if/lazy.go +++ /dev/null @@ -1,46 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: False() -// CHECK-NEXT: False() -// CHECK-NEXT: false -// CHECK-NEXT: False() -// CHECK-NEXT: True() -// CHECK-NEXT: true -// CHECK-NEXT: True() -// CHECK-NEXT: true -// CHECK-NEXT: True() -// CHECK-NEXT: true -// CHECK-NEXT: False() -// CHECK-NEXT: false -// CHECK-NEXT: False() -// CHECK-NEXT: false -// CHECK-NEXT: True() -// CHECK-NEXT: False() -// CHECK-NEXT: false -// CHECK-NEXT: True() -// CHECK-NEXT: True() -// CHECK-NEXT: true - -package main - -func False() bool { - println("False()") - return false -} - -func True() bool { - println("True()") - return true -} - -func main() { - println(False() || False()) - println(False() || True()) - println(True() || False()) - println(True() || True()) - println(False() && False()) - println(False() && True()) - println(True() && False()) - println(True() && True()) -} diff --git a/llgo/test/execution/init.go b/llgo/test/execution/init.go deleted file mode 100644 index 46c7fa16212e2b40ea652dac3de80885f09932bc..0000000000000000000000000000000000000000 --- a/llgo/test/execution/init.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s %p/Inputs/init2.go -// RUN: %t 2>&1 | FileCheck %s - -package main - -// CHECK-DAG: do some other stuff before main -//func init() - -// CHECK-DAG: do some stuff before main -func init() { - println("do some stuff before main") -} - -// CHECK: main has been called -func main() { - println("main has been called") -} diff --git a/llgo/test/execution/interfaces/assert.go b/llgo/test/execution/interfaces/assert.go deleted file mode 100644 index 4c5db7dad77ded4276d2718c55dd99a809c184c8..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/assert.go +++ /dev/null @@ -1,61 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: x is nil -// CHECK-NEXT: i2v: 123456 -// CHECK-NEXT: ! -// CHECK-NEXT: (*X).F1: 123456 - -package main - -type X struct{ x int } - -func (x *X) F1() { println("(*X).F1:", x.x) } -func (x *X) F2() { println("(*X).F2") } - -type I interface { - F1() - F2() -} - -func main() { - var x interface{} - - // x is nil. Let's make sure an assertion on it - // won't cause a panic. - if x, ok := x.(int32); ok { - println("i2v:", x) - } - if x == nil { - println("x is nil") - } - - x = int32(123456) - - // Let's try an interface-to-value assertion. - if x, ok := x.(int32); ok { - println("i2v:", x) - } - if x, ok := x.(int64); ok { - println("i2v:", x) - } - - // This will fail the assertion. - if i, ok := x.(I); ok { - i.F1() - _ = i - } else { - println("!") - } - - // Assign an *X, which should pass the assertion. - x_ := new(X) - x_.x = 123456 - x = x_ //&X{x: 123456} - if i, ok := x.(I); ok { - i.F1() - _ = i - } else { - println("!") - } -} diff --git a/llgo/test/execution/interfaces/basic.go b/llgo/test/execution/interfaces/basic.go deleted file mode 100644 index 6c754dae1c9bff9645d69800326704d182b96584..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/basic.go +++ /dev/null @@ -1,43 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: expected: y != z - -package main - -type any interface{} - -type Stringer interface { - String() string -} - -type lessThanAWord struct { - a byte -} - -func (l lessThanAWord) String() string { - return "!" -} - -func makeAStringer() Stringer { - return lessThanAWord{} -} - -func main() { - var x1, x2 int = 1, 2 - var y any = x1 - var z any = x2 - if y != z { - println("expected: y != z") - } else { - println("unexpected: y == z") - } - /* - if y == x1 { - println("expected: y == x1") - } else { - println("unexpected: y == x1") - } - */ - //println(y.(int)) -} diff --git a/llgo/test/execution/interfaces/comparei2i.go b/llgo/test/execution/interfaces/comparei2i.go deleted file mode 100644 index 5a1f2660e21023d7fea98e5a22ea8ce540ad02f6..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/comparei2i.go +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: true - -package main - -import "unsafe" - -type I interface { - X() -} - -type T int - -func (t T) X() { -} - -func main() { - var highbit uint32 = 1 << 31 - var pos0 float32 = 0 - var neg0 float32 = *(*float32)(unsafe.Pointer(&highbit)) - var i1 interface{} = pos0 - var i2 interface{} = neg0 - println(i1 == i2) - var i3 interface{} = T(123) - var i4 I = T(123) - println(i3 == i4) -} diff --git a/llgo/test/execution/interfaces/comparei2v.go b/llgo/test/execution/interfaces/comparei2v.go deleted file mode 100644 index 6547360e60e9ac4e52e8cda4c2b50c0407d5e517..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/comparei2v.go +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false - -package main - -func main() { - var x interface{} = 123 - println(x == 123) - println(x != 123) -} diff --git a/llgo/test/execution/interfaces/e2i_conversion.go b/llgo/test/execution/interfaces/e2i_conversion.go deleted file mode 100644 index 6596e7806783f76d7d8fb5c83fb550dc271d9b8a..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/e2i_conversion.go +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | count 0 - -package main - -import "io" - -type rdr struct{} - -func (r rdr) Read(b []byte) (int, error) { - return 0, nil -} - -func F(i interface{}) { - _ = i.(io.Reader) -} - -func main() { - var r rdr - F(r) - F(&r) -} diff --git a/llgo/test/execution/interfaces/embedded.go b/llgo/test/execution/interfaces/embedded.go deleted file mode 100644 index 053afb1c6025d986f024ad03cb7ff10573f0da73..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/embedded.go +++ /dev/null @@ -1,32 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: A -// CHECK-NEXT: B - -package main - -type BI interface { - B() -} - -type AI interface { - A() - BI -} - -type S struct{} - -func (s S) A() { - println("A") -} - -func (s S) B() { - println("B") -} - -func main() { - var ai AI = S{} - ai.A() - ai.B() -} diff --git a/llgo/test/execution/interfaces/error.go b/llgo/test/execution/interfaces/error.go deleted file mode 100644 index 17244360e0b9774cbe1138cc31ec559f1507474d..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/error.go +++ /dev/null @@ -1,43 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: !!!! 123 -// CHECK-NEXT: errno 123 - -package main - -var errors = [...]string{} - -func itoa(val int) string { // do it here rather than with fmt to avoid dependency - if val < 0 { - return "-" + itoa(-val) - } - var buf [32]byte // big enough for int64 - i := len(buf) - 1 - for val >= 10 { - buf[i] = byte(val%10 + '0') - i-- - val /= 10 - } - buf[i] = byte(val + '0') - return string(buf[i:]) -} - -type Errno uintptr - -func (e Errno) Error() string { - println("!!!!", uintptr(e)) - if 0 <= int(e) && int(e) < len(errors) { - s := errors[e] - if s != "" { - return s - } - } - return "errno " + itoa(int(e)) -} - -func main() { - e := Errno(123) - i := (interface{})(e) - println(i.(error).Error()) -} diff --git a/llgo/test/execution/interfaces/i2i_conversion.go b/llgo/test/execution/interfaces/i2i_conversion.go deleted file mode 100644 index b55d8404a12647b8fad98d936cc62b94a74e945c..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/i2i_conversion.go +++ /dev/null @@ -1,33 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 666 -// CHECK-NEXT: The Beast - -package main - -type Numbered interface { - Number() int -} - -type Named interface { - Name() string -} - -type Beast struct{} - -func (b *Beast) Number() int { - return 666 -} - -func (b *Beast) Name() string { - return "The Beast" -} - -func main() { - var b Beast - var numbered Numbered = &b - var named Named = numbered.(Named) - println(numbered.Number()) - println(named.Name()) -} diff --git a/llgo/test/execution/interfaces/import.go b/llgo/test/execution/interfaces/import.go deleted file mode 100644 index 3305ee6a8498f91438f57d0f16fda22af3a67fbb..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/import.go +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -package main - -import "syscall" - -type Signal interface { - Signal() -} - -func main() { - var s Signal = syscall.SIGINT - // CHECK: ({{.*}},{{.*}}) - println(s) -} diff --git a/llgo/test/execution/interfaces/methods.go b/llgo/test/execution/interfaces/methods.go deleted file mode 100644 index 5fb704cd9b1a255aacfcd75c392ffe6a41df1769..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/methods.go +++ /dev/null @@ -1,53 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: X() -// CHECK-NEXT: Y() -// CHECK-NEXT: X() -// CHECK-NEXT: Y() -// CHECK-NEXT: X() - -package main - -type Stringer interface { - String() string -} - -type X int -type Y int - -type Z1 struct { - X -} - -type Z2 struct { - Stringer -} - -func (x X) String() string { - return "X()" -} - -func (y *Y) String() string { - return "Y()" -} - -func makeX() X { - return X(0) -} - -func main() { - var z Stringer = X(0) - println(z.String()) - - z = new(Y) - println(z.String()) - - z = Z1{} - println(z.String()) - - z = Z2{new(Y)} - println(z.String()) - - println(makeX().String()) -} diff --git a/llgo/test/execution/interfaces/static_conversion.go b/llgo/test/execution/interfaces/static_conversion.go deleted file mode 100644 index e63f10d64add5b1558afe2e511d93f40ec29bee2..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/static_conversion.go +++ /dev/null @@ -1,35 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 666 -// CHECK-NEXT: 3 - -package main - -type Blah interface{} -type Numbered interface { - Blah - Number() int -} - -type Beast struct{} - -func (b *Beast) Number() int { - return 666 -} - -type MagicNumber int - -func (m MagicNumber) Number() int { - return int(m) -} - -func main() { - var b Beast - var m MagicNumber = 3 - var n Numbered = &b - println(n.Number()) - - n = m - println(n.Number()) -} diff --git a/llgo/test/execution/interfaces/wordsize.go b/llgo/test/execution/interfaces/wordsize.go deleted file mode 100644 index e2de5d54895c8c364dcedf75e0d5029d7a8fa9d2..0000000000000000000000000000000000000000 --- a/llgo/test/execution/interfaces/wordsize.go +++ /dev/null @@ -1,40 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: StringStringer(abc) -// CHECK-NEXT: abc 1 2 3 - -package main - -type Stringer interface { - String() string -} - -type StringStringer string - -func (s StringStringer) String() string { - return "StringStringer(" + string(s) + ")" -} - -func (s StringStringer) MethodWithArgs(a, b, c int) { - println(s, a, b, c) -} - -type I interface { - MethodWithArgs(a, b, c int) -} - -func testLargerThanWord() { - // string is larger than a word. Make sure it works - // well as a method receiver when using interfaces. - var s Stringer = StringStringer("abc") - println(s.String()) - - // Test calling a method which takes parameters - // beyond the receiver. - s.(I).MethodWithArgs(1, 2, 3) -} - -func main() { - testLargerThanWord() -} diff --git a/llgo/test/execution/literals/array.go b/llgo/test/execution/literals/array.go deleted file mode 100644 index 975ec02760ffed4f8e776d3ed6a5389f5ce46a34..0000000000000000000000000000000000000000 --- a/llgo/test/execution/literals/array.go +++ /dev/null @@ -1,78 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 9223372036854775808 -63 false -// CHECK-NEXT: 11529215046068469760 -60 false -// CHECK-NEXT: 14411518807585587200 -57 false -// CHECK-NEXT: 18014398509481984000 -54 false -// CHECK-NEXT: 11258999068426240000 -50 false -// CHECK-NEXT: 14073748835532800000 -47 false -// CHECK-NEXT: 17592186044416000000 -44 false -// CHECK-NEXT: 10995116277760000000 -40 false -// CHECK-NEXT: 0 0 -// CHECK-NEXT: 1 0 -// CHECK-NEXT: 2 1 -// CHECK-NEXT: 3 0 -// CHECK-NEXT: 4 2 -// CHECK-NEXT: 5 0 -// CHECK-NEXT: 6 3 -// CHECK-NEXT: 7 0 -// CHECK-NEXT: 8 4 -// CHECK-NEXT: 9 0 -// CHECK-NEXT: 0 1 -// CHECK-NEXT: 1 2 - -package main - -// An extFloat represents an extended floating-point number, with more -// precision than a float64. It does not try to save bits: the -// number represented by the structure is mant*(2^exp), with a negative -// sign if neg is true. -type extFloat struct { - mant uint64 - exp int - neg bool -} - -var smallPowersOfTen = [...]extFloat{ - {1 << 63, -63, false}, // 1 - {0xa << 60, -60, false}, // 1e1 - {0x64 << 57, -57, false}, // 1e2 - {0x3e8 << 54, -54, false}, // 1e3 - {0x2710 << 50, -50, false}, // 1e4 - {0x186a0 << 47, -47, false}, // 1e5 - {0xf4240 << 44, -44, false}, // 1e6 - {0x989680 << 40, -40, false}, // 1e7 -} - -var arrayWithHoles = [10]int{ - 2: 1, - 4: 2, - 6: 3, - 8: 4, -} - -type namedInt int32 - -const N0 namedInt = 0 -const N1 namedInt = 1 - -var arrayWithNamedIndices = [...]int{ - N0: 1, - N1: 2, -} - -func main() { - for i := range smallPowersOfTen { - s := smallPowersOfTen[i] - println(s.mant, s.exp, s.neg) - } - - for i, value := range arrayWithHoles { - println(i, value) - } - - for i, value := range arrayWithNamedIndices { - println(i, value) - } -} diff --git a/llgo/test/execution/literals/func.go b/llgo/test/execution/literals/func.go deleted file mode 100644 index b8dbef340fad02c4d2e43ba792f53176a72514f7..0000000000000000000000000000000000000000 --- a/llgo/test/execution/literals/func.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false - -package main - -func main() { - f := func(x bool) { - println(x) - } - f(true) - f(false) -} diff --git a/llgo/test/execution/literals/map.go b/llgo/test/execution/literals/map.go deleted file mode 100644 index 32173f50d932da27d0a0e5462b6c904cf01d4a04..0000000000000000000000000000000000000000 --- a/llgo/test/execution/literals/map.go +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: false -// CHECK-NEXT: 2 -// CHECK-NEXT: 1 0 3 -// CHECK-NEXT: 0.1 -// CHECK-NEXT: 0.2 -// CHECK-NEXT: 0.3 - -package main - -func main() { - type IntMap map[int]int - m := IntMap{0: 1, 2: 3} - println(m == nil) - println(len(m)) - println(m[0], m[1], m[2]) - - f32tostr := map[float32]string{0.1: "0.1", 0.2: "0.2", 0.3: "0.3"} - println(f32tostr[0.1]) - println(f32tostr[0.2]) - println(f32tostr[0.3]) -} diff --git a/llgo/test/execution/literals/slice.go b/llgo/test/execution/literals/slice.go deleted file mode 100644 index dbb02bff718ded28e5ea962059da353e7e98cf1a..0000000000000000000000000000000000000000 --- a/llgo/test/execution/literals/slice.go +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: abc -// CHECK-NEXT: 123 -// CHECK-NEXT: abc -// CHECK-NEXT: 123 - -package main - -func main() { - x := []string{"abc", "123"} - println(x[0]) - println(x[1]) - - // Elements are composite literals, so the '&' can be elided. - type S struct{ string } - y := []*S{{"abc"}, {"123"}} - println(y[0].string) - println(y[1].string) -} diff --git a/llgo/test/execution/literals/struct.go b/llgo/test/execution/literals/struct.go deleted file mode 100644 index 4fede950784bde19305c3828fa0d00548c7a0c7d..0000000000000000000000000000000000000000 --- a/llgo/test/execution/literals/struct.go +++ /dev/null @@ -1,62 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 2 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: 0 1 2 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: 3 4 - -package main - -type E struct { - e *E -} - -type S struct { - *E - a, b int -} - -type File struct { -} - -type Reader struct { -} - -type Response struct { -} - -type reader struct { - *Reader - fd *File - resp *Response -} - -type Range32 struct { - Lo uint32 - Hi uint32 - Stride uint32 -} - -func main() { - s := &S{nil, 1, 2} - println(s.a, s.b) - s = &S{a: 1, b: 2} - println(s.a, s.b) - - _ = &reader{} - - r := Range32{ - Lo: 0, - Stride: 2, - Hi: 1, - } - println(r.Lo, r.Hi, r.Stride) - - // slice of structs - ss := []S{{nil, 1, 2}, {nil, 3, 4}} - for _, s := range ss { - println(s.a, s.b) - } -} diff --git a/llgo/test/execution/maps/delete.go b/llgo/test/execution/maps/delete.go deleted file mode 100644 index 6879974e9c9ac6ba60842ae6b5e5ea6d98b3b457..0000000000000000000000000000000000000000 --- a/llgo/test/execution/maps/delete.go +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 1 1 -// CHECK-NEXT: 0 0 - -package main - -func main() { - m := make(map[int]int) - delete(m, 0) // no-op - m[0] = 1 - println(len(m)) - delete(m, 1) // no-op - println(len(m), m[0]) - delete(m, 0) // delete element in map - println(len(m), m[0]) -} diff --git a/llgo/test/execution/maps/insert.go b/llgo/test/execution/maps/insert.go deleted file mode 100644 index 90b31cc96c145c3fae4804e12d884f8c6836fc40..0000000000000000000000000000000000000000 --- a/llgo/test/execution/maps/insert.go +++ /dev/null @@ -1,29 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 456 -// CHECK-NEXT: 1 -// CHECK-NEXT: 789 - -package main - -func main() { - { - var m map[int]int - println(len(m)) // 0 - println(m[123]) // 0, despite map being nil - } - - { - m := make(map[int]int) - m[123] = 456 - println(len(m)) // 1 - println(m[123]) - m[123] = 789 - println(len(m)) // 1 - println(m[123]) - } -} diff --git a/llgo/test/execution/maps/lookup.go b/llgo/test/execution/maps/lookup.go deleted file mode 100644 index 69d28788205f02475e6515c3d6d3ad54e45392ff..0000000000000000000000000000000000000000 --- a/llgo/test/execution/maps/lookup.go +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 false -// CHECK-NEXT: 1 true -// CHECK-NEXT: 1 true -// CHECK-NEXT: 1 true - -package main - -func main() { - m := make(map[int]int) - v, ok := m[8] - println(v, ok) - m[8] = 1 - v, ok = m[8] - println(v, ok) - - type S struct{ s1, s2 string } - sm := make(map[S]int) - sm[S{"ABC", "DEF"}] = 1 - sv, ok := sm[S{string([]byte{65, 66, 67}), string([]byte{68, 69, 70})}] - println(sv, ok) - - type A [2]string - am := make(map[A]int) - am[A{"ABC", "DEF"}] = 1 - av, ok := am[A{string([]byte{65, 66, 67}), string([]byte{68, 69, 70})}] - println(av, ok) -} diff --git a/llgo/test/execution/maps/range.go b/llgo/test/execution/maps/range.go deleted file mode 100644 index f3dc03fbd9e35f884dd8b1822655fbfafb8ff9a7..0000000000000000000000000000000000000000 --- a/llgo/test/execution/maps/range.go +++ /dev/null @@ -1,48 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 0 3 -// CHECK-NEXT: 1 4 -// CHECK-NEXT: 2 5 -// CHECK-NEXT: 1 -// CHECK-NEXT: done - -package main - -func main() { - defer println("done") - m := make(map[int]int) - m[0] = 3 - m[1] = 4 - m[2] = 5 - for k := range m { - println(k) - } - for k, _ := range m { - println(k) - } - for _, v := range m { - println(v) - } - for k, v := range m { - println(k, v) - } - - // test deletion. - i := 0 - for k, _ := range m { - i++ - delete(m, (k+1)%3) - delete(m, (k+2)%3) - } - println(i) -} diff --git a/llgo/test/execution/methods/methodvalues.go b/llgo/test/execution/methods/methodvalues.go deleted file mode 100644 index cf8a980df08bceef22582dc2e5243590060c5b4c..0000000000000000000000000000000000000000 --- a/llgo/test/execution/methods/methodvalues.go +++ /dev/null @@ -1,64 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 246 -// CHECK-NEXT: T2.f() -// CHECK-NEXT: 10 -// CHECK-NEXT: abc - -package main - -type T1 struct { - value int -} - -func (t *T1) f(m int) int { - return m * t.value -} - -func f1() { - var t T1 - var f func(int) int = t.f - t.value = 2 - println(f(123)) -} - -type T2 struct{} - -func (T2) f() { - println("T2.f()") -} - -func f2() { - var f func() = T2{}.f - f() -} - -type T3 complex128 - -func (t T3) f() int { - return int(real(t)) -} - -func f3() { - var f func() int = T3(10).f - println(f()) -} - -type T4 string - -func (t T4) f() string { - return string(t) -} - -func f4() { - var f func() string = T4("abc").f - println(f()) -} - -func main() { - f1() - f2() - f3() - f4() -} diff --git a/llgo/test/execution/methods/nilrecv.go b/llgo/test/execution/methods/nilrecv.go deleted file mode 100644 index defe2f437231162adf31b1acadc2edc426e071a4..0000000000000000000000000000000000000000 --- a/llgo/test/execution/methods/nilrecv.go +++ /dev/null @@ -1,31 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false - -package main - -type T1 int - -func (t *T1) t1() { println(t == nil) } - -func constNilRecv() { - (*T1)(nil).t1() -} - -func nonConstNilRecv() { - var v1 T1 - v1.t1() - var v2 *T1 - v2.t1() - v2 = &v1 - v2.t1() -} - -func main() { - constNilRecv() - nonConstNilRecv() -} diff --git a/llgo/test/execution/methods/selectors.go b/llgo/test/execution/methods/selectors.go deleted file mode 100644 index bcd417366fbfc87b47bee90dd5b767c0078d5675..0000000000000000000000000000000000000000 --- a/llgo/test/execution/methods/selectors.go +++ /dev/null @@ -1,45 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: F1 -// CHECK-NEXT: F2 -// CHECK-NEXT: F1 -// CHECK-NEXT: F2 - -package main - -type S1 struct{} -type S2 struct { - S1 -} - -func (s S1) F1() { - println("F1") -} - -func (s *S2) F2() { - println("F2") -} - -func testUnnamedStructMethods() { - // Test method lookup on an unnamed struct type. - var x struct { - S1 - S2 - } - x.F1() - x.F2() -} - -func main() { - var s S2 - - // Derive pointer-receiver function. - f1 := (*S2).F1 - f1(&s) - - f2 := (*S2).F2 - f2(&s) - - testUnnamedStructMethods() -} diff --git a/llgo/test/execution/new.go b/llgo/test/execution/new.go deleted file mode 100644 index 24773de7f350c80c22a1169338069d9e66dfeed6..0000000000000000000000000000000000000000 --- a/llgo/test/execution/new.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 - -package main - -func main() { - x := new(int) - println(*x) - *x = 2 - println(*x) - *x = *x * *x - println(*x) -} diff --git a/llgo/test/execution/nil.go b/llgo/test/execution/nil.go deleted file mode 100644 index 0aa94e7c0d47c5af1b9b980749d3ce2c6cd2e5fd..0000000000000000000000000000000000000000 --- a/llgo/test/execution/nil.go +++ /dev/null @@ -1,32 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0x0 -// CHECK-NEXT: x is nil -// CHECK-NEXT: y is nil -// CHECK-NEXT: z is nil - -package main - -func main() { - var x *int = nil - println(x) - - if x == nil { - println("x is nil") - } - - var y interface{} - var z interface{} = y - if y == nil { - println("y is nil") - } else { - println("y is not nil") - } - - if z == nil { - println("z is nil") - } else { - println("z is not nil") - } -} diff --git a/llgo/test/execution/operators/basics.go b/llgo/test/execution/operators/basics.go deleted file mode 100644 index 19425868f556e8dcbe03ec095276fd982897cb7e..0000000000000000000000000000000000000000 --- a/llgo/test/execution/operators/basics.go +++ /dev/null @@ -1,133 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 4096 -// CHECK-NEXT: 256 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 4096 -// CHECK-NEXT: 256 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 65280 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 61184 -// CHECK-NEXT: 65024 -// CHECK-NEXT: 65296 -// CHECK-NEXT: 65281 -// CHECK-NEXT: 61184 -// CHECK-NEXT: 65024 -// CHECK-NEXT: 65296 -// CHECK-NEXT: 65281 -// CHECK-NEXT: -62 -// CHECK-NEXT: -246 -// CHECK-NEXT: +1.224560e+002 -// CHECK-NEXT: 3 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 122 -// CHECK-NEXT: -124 -// CHECK-NEXT: 120 -// CHECK-NEXT: 18446744073709547520 -// CHECK-NEXT: false -// CHECK-NEXT: 2147483648 -// CHECK-NEXT: 9223372036854775808 -// CHECK-NEXT: 2147483648 2147483648 -// CHECK-NEXT: 9223372036854775808 9223372036854775808 - -package main - -import "unsafe" - -var global string - -var hi = 0xFF00 -var lo = 0xFF00 - -// borrowed from math package to avoid dependency on standard library -func float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) } -func float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) } - -func main() { - println(hi & 0x1000) - println(hi & 0x0100) - println(hi & 0x0010) - println(hi & 0x0001) - println(lo & 0x1000) - println(lo & 0x0100) - println(lo & 0x0010) - println(lo & 0x0001) - println(hi | lo) - println(hi ^ hi) - println(hi ^ lo) - println(lo ^ lo) - println(hi ^ 0x1000) - println(hi ^ 0x0100) - println(hi ^ 0x0010) - println(hi ^ 0x0001) - println(lo ^ 0x1000) - println(lo ^ 0x0100) - println(lo ^ 0x0010) - println(lo ^ 0x0001) - println(-123 >> 1) - println(-123 << 1) - - var f float64 = 123.456 - f-- - println(f) - - // context of '&' op is used to type the untyped lhs - // operand of the shift expression. - shift := uint(2) - println(uint64(0xFFFFFFFF) & (1<> (63 - _uint) - if x == 2<<_uint { - println("!") - } - } - - // There was a bug related to compound expressions involving - // multiple binary logical operators. - var a, b, c int - if a == 0 && (b != 0 || c != 0) { - println("!") - } - - var si int = -123 - var ui int = 123 - println(^si) - println(^ui) - println(ui &^ 3) - - // test case from math/modf.go - var x uint64 = 0xFFFFFFFFFFFFFFFF - var e uint = 40 - x &^= 1<<(64-12-e) - 1 - println(x) - - // compare global to non-global - println(new(string) == &global) - - // negative zero - var f32 float32 - var f64 float64 - var c64 complex64 - var c128 complex128 - f32 = -f32 - f64 = -f64 - c64 = -c64 - c128 = -c128 - println(float32bits(f32)) - println(float64bits(f64)) - println(float32bits(real(c64)), float32bits(imag(c64))) - println(float64bits(real(c128)), float64bits(imag(c128))) -} diff --git a/llgo/test/execution/operators/binary_untyped.go b/llgo/test/execution/operators/binary_untyped.go deleted file mode 100644 index f152985ffb523a735c42fa5e02450e60277c3e1b..0000000000000000000000000000000000000000 --- a/llgo/test/execution/operators/binary_untyped.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true - -package main - -func f1(b bool) bool { - return b -} - -func main() { - x := false - y := x - x = !y - println(x || y) -} diff --git a/llgo/test/execution/operators/shifts.go b/llgo/test/execution/operators/shifts.go deleted file mode 100644 index 728b32b57bf47c94348810ad0141e30b14a9800d..0000000000000000000000000000000000000000 --- a/llgo/test/execution/operators/shifts.go +++ /dev/null @@ -1,290 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 4294967295 -// CHECK-NEXT: 4294967295 -// CHECK-NEXT: 2147483647 -// CHECK-NEXT: 4294967294 -// CHECK-NEXT: 1073741823 -// CHECK-NEXT: 4294967292 -// CHECK-NEXT: 536870911 -// CHECK-NEXT: 4294967288 -// CHECK-NEXT: 268435455 -// CHECK-NEXT: 4294967280 -// CHECK-NEXT: 134217727 -// CHECK-NEXT: 4294967264 -// CHECK-NEXT: 67108863 -// CHECK-NEXT: 4294967232 -// CHECK-NEXT: 33554431 -// CHECK-NEXT: 4294967168 -// CHECK-NEXT: 16777215 -// CHECK-NEXT: 4294967040 -// CHECK-NEXT: 8388607 -// CHECK-NEXT: 4294966784 -// CHECK-NEXT: 4194303 -// CHECK-NEXT: 4294966272 -// CHECK-NEXT: 2097151 -// CHECK-NEXT: 4294965248 -// CHECK-NEXT: 1048575 -// CHECK-NEXT: 4294963200 -// CHECK-NEXT: 524287 -// CHECK-NEXT: 4294959104 -// CHECK-NEXT: 262143 -// CHECK-NEXT: 4294950912 -// CHECK-NEXT: 131071 -// CHECK-NEXT: 4294934528 -// CHECK-NEXT: 65535 -// CHECK-NEXT: 4294901760 -// CHECK-NEXT: 32767 -// CHECK-NEXT: 4294836224 -// CHECK-NEXT: 16383 -// CHECK-NEXT: 4294705152 -// CHECK-NEXT: 8191 -// CHECK-NEXT: 4294443008 -// CHECK-NEXT: 4095 -// CHECK-NEXT: 4293918720 -// CHECK-NEXT: 2047 -// CHECK-NEXT: 4292870144 -// CHECK-NEXT: 1023 -// CHECK-NEXT: 4290772992 -// CHECK-NEXT: 511 -// CHECK-NEXT: 4286578688 -// CHECK-NEXT: 255 -// CHECK-NEXT: 4278190080 -// CHECK-NEXT: 127 -// CHECK-NEXT: 4261412864 -// CHECK-NEXT: 63 -// CHECK-NEXT: 4227858432 -// CHECK-NEXT: 31 -// CHECK-NEXT: 4160749568 -// CHECK-NEXT: 15 -// CHECK-NEXT: 4026531840 -// CHECK-NEXT: 7 -// CHECK-NEXT: 3758096384 -// CHECK-NEXT: 3 -// CHECK-NEXT: 3221225472 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2147483648 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: 4026531839 -// CHECK-NEXT: 4026531839 -// CHECK-NEXT: 2013265919 -// CHECK-NEXT: 3758096382 -// CHECK-NEXT: 1006632959 -// CHECK-NEXT: 3221225468 -// CHECK-NEXT: 503316479 -// CHECK-NEXT: 2147483640 -// CHECK-NEXT: 251658239 -// CHECK-NEXT: 4294967280 -// CHECK-NEXT: 125829119 -// CHECK-NEXT: 4294967264 -// CHECK-NEXT: 62914559 -// CHECK-NEXT: 4294967232 -// CHECK-NEXT: 31457279 -// CHECK-NEXT: 4294967168 -// CHECK-NEXT: 15728639 -// CHECK-NEXT: 4294967040 -// CHECK-NEXT: 7864319 -// CHECK-NEXT: 4294966784 -// CHECK-NEXT: 3932159 -// CHECK-NEXT: 4294966272 -// CHECK-NEXT: 1966079 -// CHECK-NEXT: 4294965248 -// CHECK-NEXT: 983039 -// CHECK-NEXT: 4294963200 -// CHECK-NEXT: 491519 -// CHECK-NEXT: 4294959104 -// CHECK-NEXT: 245759 -// CHECK-NEXT: 4294950912 -// CHECK-NEXT: 122879 -// CHECK-NEXT: 4294934528 -// CHECK-NEXT: 61439 -// CHECK-NEXT: 4294901760 -// CHECK-NEXT: 30719 -// CHECK-NEXT: 4294836224 -// CHECK-NEXT: 15359 -// CHECK-NEXT: 4294705152 -// CHECK-NEXT: 7679 -// CHECK-NEXT: 4294443008 -// CHECK-NEXT: 3839 -// CHECK-NEXT: 4293918720 -// CHECK-NEXT: 1919 -// CHECK-NEXT: 4292870144 -// CHECK-NEXT: 959 -// CHECK-NEXT: 4290772992 -// CHECK-NEXT: 479 -// CHECK-NEXT: 4286578688 -// CHECK-NEXT: 239 -// CHECK-NEXT: 4278190080 -// CHECK-NEXT: 119 -// CHECK-NEXT: 4261412864 -// CHECK-NEXT: 59 -// CHECK-NEXT: 4227858432 -// CHECK-NEXT: 29 -// CHECK-NEXT: 4160749568 -// CHECK-NEXT: 14 -// CHECK-NEXT: 4026531840 -// CHECK-NEXT: 7 -// CHECK-NEXT: 3758096384 -// CHECK-NEXT: 3 -// CHECK-NEXT: 3221225472 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2147483648 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 -// CHECK-NEXT: -1 -// CHECK-NEXT: -1 -// CHECK-NEXT: -1 -// CHECK-NEXT: -2 -// CHECK-NEXT: -1 -// CHECK-NEXT: -4 -// CHECK-NEXT: -1 -// CHECK-NEXT: -8 -// CHECK-NEXT: -1 -// CHECK-NEXT: -16 -// CHECK-NEXT: -1 -// CHECK-NEXT: -32 -// CHECK-NEXT: -1 -// CHECK-NEXT: -64 -// CHECK-NEXT: -1 -// CHECK-NEXT: -128 -// CHECK-NEXT: -1 -// CHECK-NEXT: -256 -// CHECK-NEXT: -1 -// CHECK-NEXT: -512 -// CHECK-NEXT: -1 -// CHECK-NEXT: -1024 -// CHECK-NEXT: -1 -// CHECK-NEXT: -2048 -// CHECK-NEXT: -1 -// CHECK-NEXT: -4096 -// CHECK-NEXT: -1 -// CHECK-NEXT: -8192 -// CHECK-NEXT: -1 -// CHECK-NEXT: -16384 -// CHECK-NEXT: -1 -// CHECK-NEXT: -32768 -// CHECK-NEXT: -1 -// CHECK-NEXT: -65536 -// CHECK-NEXT: -1 -// CHECK-NEXT: -131072 -// CHECK-NEXT: -1 -// CHECK-NEXT: -262144 -// CHECK-NEXT: -1 -// CHECK-NEXT: -524288 -// CHECK-NEXT: -1 -// CHECK-NEXT: -1048576 -// CHECK-NEXT: -1 -// CHECK-NEXT: -2097152 -// CHECK-NEXT: -1 -// CHECK-NEXT: -4194304 -// CHECK-NEXT: -1 -// CHECK-NEXT: -8388608 -// CHECK-NEXT: -1 -// CHECK-NEXT: -16777216 -// CHECK-NEXT: -1 -// CHECK-NEXT: -33554432 -// CHECK-NEXT: -1 -// CHECK-NEXT: -67108864 -// CHECK-NEXT: -1 -// CHECK-NEXT: -134217728 -// CHECK-NEXT: -1 -// CHECK-NEXT: -268435456 -// CHECK-NEXT: -1 -// CHECK-NEXT: -536870912 -// CHECK-NEXT: -1 -// CHECK-NEXT: -1073741824 -// CHECK-NEXT: -1 -// CHECK-NEXT: -2147483648 -// CHECK-NEXT: -1 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 1 -// CHECK-NEXT: 0 -// CHECK-NEXT: 2 -// CHECK-NEXT: 0 -// CHECK-NEXT: 4 -// CHECK-NEXT: 0 -// CHECK-NEXT: 8 -// CHECK-NEXT: 0 -// CHECK-NEXT: 16 -// CHECK-NEXT: 0 -// CHECK-NEXT: 32 -// CHECK-NEXT: 0 -// CHECK-NEXT: 64 -// CHECK-NEXT: 0 -// CHECK-NEXT: 128 -// CHECK-NEXT: 0 -// CHECK-NEXT: 256 -// CHECK-NEXT: 0 -// CHECK-NEXT: 512 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1024 -// CHECK-NEXT: 0 -// CHECK-NEXT: 2048 -// CHECK-NEXT: 0 -// CHECK-NEXT: 4096 -// CHECK-NEXT: 0 -// CHECK-NEXT: 8192 -// CHECK-NEXT: 0 -// CHECK-NEXT: 16384 -// CHECK-NEXT: 0 -// CHECK-NEXT: 32768 -// CHECK-NEXT: 0 -// CHECK-NEXT: 65536 -// CHECK-NEXT: 0 -// CHECK-NEXT: 131072 -// CHECK-NEXT: 0 -// CHECK-NEXT: 262144 -// CHECK-NEXT: 0 -// CHECK-NEXT: 524288 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1048576 -// CHECK-NEXT: 0 -// CHECK-NEXT: 2097152 -// CHECK-NEXT: 0 -// CHECK-NEXT: 4194304 -// CHECK-NEXT: 0 -// CHECK-NEXT: 8388608 -// CHECK-NEXT: 0 -// CHECK-NEXT: 16777216 -// CHECK-NEXT: 0 -// CHECK-NEXT: 33554432 -// CHECK-NEXT: 0 -// CHECK-NEXT: 67108864 -// CHECK-NEXT: 0 -// CHECK-NEXT: 134217728 -// CHECK-NEXT: 0 -// CHECK-NEXT: 268435456 -// CHECK-NEXT: 0 -// CHECK-NEXT: 536870912 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1073741824 -// CHECK-NEXT: 0 -// CHECK-NEXT: -2147483648 -// CHECK-NEXT: 0 -// CHECK-NEXT: 0 - -package main - -func testShrUint32(v uint32) { - for i := uint(0); i <= 32; i++ { - println(v >> i) - println(v << i) - } -} - -func testShrInt32(v int32) { - for i := uint(0); i <= 32; i++ { - println(v >> i) - println(v << i) - } -} - -func main() { - testShrUint32(0xFFFFFFFF) - testShrUint32(0xEFFFFFFF) - testShrInt32(-1) - testShrInt32(1) -} diff --git a/llgo/test/execution/slices/append.go b/llgo/test/execution/slices/append.go deleted file mode 100644 index 50db2ac27f622ae19c92cc5e92d88cda4580847c..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/append.go +++ /dev/null @@ -1,254 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: 10 -// CHECK-NEXT: 11 -// CHECK-NEXT: 12 -// CHECK-NEXT: 13 -// CHECK-NEXT: 14 -// CHECK-NEXT: 15 -// CHECK-NEXT: 16 -// CHECK-NEXT: 17 -// CHECK-NEXT: 18 -// CHECK-NEXT: 19 -// CHECK-NEXT: 20 -// CHECK-NEXT: 21 -// CHECK-NEXT: 22 -// CHECK-NEXT: 23 -// CHECK-NEXT: 24 -// CHECK-NEXT: 25 -// CHECK-NEXT: 26 -// CHECK-NEXT: 27 -// CHECK-NEXT: 28 -// CHECK-NEXT: 29 -// CHECK-NEXT: 30 -// CHECK-NEXT: 31 -// CHECK-NEXT: 32 -// CHECK-NEXT: 33 -// CHECK-NEXT: 34 -// CHECK-NEXT: 35 -// CHECK-NEXT: 36 -// CHECK-NEXT: 37 -// CHECK-NEXT: 38 -// CHECK-NEXT: 39 -// CHECK-NEXT: 40 -// CHECK-NEXT: 41 -// CHECK-NEXT: 42 -// CHECK-NEXT: 43 -// CHECK-NEXT: 44 -// CHECK-NEXT: 45 -// CHECK-NEXT: 46 -// CHECK-NEXT: 47 -// CHECK-NEXT: 48 -// CHECK-NEXT: 49 -// CHECK-NEXT: 50 -// CHECK-NEXT: 51 -// CHECK-NEXT: 52 -// CHECK-NEXT: 53 -// CHECK-NEXT: 54 -// CHECK-NEXT: 55 -// CHECK-NEXT: 56 -// CHECK-NEXT: 57 -// CHECK-NEXT: 58 -// CHECK-NEXT: 59 -// CHECK-NEXT: 60 -// CHECK-NEXT: 61 -// CHECK-NEXT: 62 -// CHECK-NEXT: 63 -// CHECK-NEXT: 64 -// CHECK-NEXT: 65 -// CHECK-NEXT: 66 -// CHECK-NEXT: 67 -// CHECK-NEXT: 68 -// CHECK-NEXT: 69 -// CHECK-NEXT: 70 -// CHECK-NEXT: 71 -// CHECK-NEXT: 72 -// CHECK-NEXT: 73 -// CHECK-NEXT: 74 -// CHECK-NEXT: 75 -// CHECK-NEXT: 76 -// CHECK-NEXT: 77 -// CHECK-NEXT: 78 -// CHECK-NEXT: 79 -// CHECK-NEXT: 80 -// CHECK-NEXT: 81 -// CHECK-NEXT: 82 -// CHECK-NEXT: 83 -// CHECK-NEXT: 84 -// CHECK-NEXT: 85 -// CHECK-NEXT: 86 -// CHECK-NEXT: 87 -// CHECK-NEXT: 88 -// CHECK-NEXT: 89 -// CHECK-NEXT: 90 -// CHECK-NEXT: 91 -// CHECK-NEXT: 92 -// CHECK-NEXT: 93 -// CHECK-NEXT: 94 -// CHECK-NEXT: 95 -// CHECK-NEXT: 96 -// CHECK-NEXT: 97 -// CHECK-NEXT: 98 -// CHECK-NEXT: 99 -// CHECK-NEXT: 0 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: 4 -// CHECK-NEXT: 5 -// CHECK-NEXT: 6 -// CHECK-NEXT: 7 -// CHECK-NEXT: 8 -// CHECK-NEXT: 9 -// CHECK-NEXT: 10 -// CHECK-NEXT: 11 -// CHECK-NEXT: 12 -// CHECK-NEXT: 13 -// CHECK-NEXT: 14 -// CHECK-NEXT: 15 -// CHECK-NEXT: 16 -// CHECK-NEXT: 17 -// CHECK-NEXT: 18 -// CHECK-NEXT: 19 -// CHECK-NEXT: 20 -// CHECK-NEXT: 21 -// CHECK-NEXT: 22 -// CHECK-NEXT: 23 -// CHECK-NEXT: 24 -// CHECK-NEXT: 25 -// CHECK-NEXT: 26 -// CHECK-NEXT: 27 -// CHECK-NEXT: 28 -// CHECK-NEXT: 29 -// CHECK-NEXT: 30 -// CHECK-NEXT: 31 -// CHECK-NEXT: 32 -// CHECK-NEXT: 33 -// CHECK-NEXT: 34 -// CHECK-NEXT: 35 -// CHECK-NEXT: 36 -// CHECK-NEXT: 37 -// CHECK-NEXT: 38 -// CHECK-NEXT: 39 -// CHECK-NEXT: 40 -// CHECK-NEXT: 41 -// CHECK-NEXT: 42 -// CHECK-NEXT: 43 -// CHECK-NEXT: 44 -// CHECK-NEXT: 45 -// CHECK-NEXT: 46 -// CHECK-NEXT: 47 -// CHECK-NEXT: 48 -// CHECK-NEXT: 49 -// CHECK-NEXT: 50 -// CHECK-NEXT: 51 -// CHECK-NEXT: 52 -// CHECK-NEXT: 53 -// CHECK-NEXT: 54 -// CHECK-NEXT: 55 -// CHECK-NEXT: 56 -// CHECK-NEXT: 57 -// CHECK-NEXT: 58 -// CHECK-NEXT: 59 -// CHECK-NEXT: 60 -// CHECK-NEXT: 61 -// CHECK-NEXT: 62 -// CHECK-NEXT: 63 -// CHECK-NEXT: 64 -// CHECK-NEXT: 65 -// CHECK-NEXT: 66 -// CHECK-NEXT: 67 -// CHECK-NEXT: 68 -// CHECK-NEXT: 69 -// CHECK-NEXT: 70 -// CHECK-NEXT: 71 -// CHECK-NEXT: 72 -// CHECK-NEXT: 73 -// CHECK-NEXT: 74 -// CHECK-NEXT: 75 -// CHECK-NEXT: 76 -// CHECK-NEXT: 77 -// CHECK-NEXT: 78 -// CHECK-NEXT: 79 -// CHECK-NEXT: 80 -// CHECK-NEXT: 81 -// CHECK-NEXT: 82 -// CHECK-NEXT: 83 -// CHECK-NEXT: 84 -// CHECK-NEXT: 85 -// CHECK-NEXT: 86 -// CHECK-NEXT: 87 -// CHECK-NEXT: 88 -// CHECK-NEXT: 89 -// CHECK-NEXT: 90 -// CHECK-NEXT: 91 -// CHECK-NEXT: 92 -// CHECK-NEXT: 93 -// CHECK-NEXT: 94 -// CHECK-NEXT: 95 -// CHECK-NEXT: 96 -// CHECK-NEXT: 97 -// CHECK-NEXT: 98 -// CHECK-NEXT: 99 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 -// CHECK-NEXT: abcdef -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: false false -// CHECK-NEXT: true true -// CHECK-NEXT: false false - -package main - -func stringtobytes() { - var b []byte - b = append(b, "abc"...) - b = append(b, "def"...) - println(string(b)) -} - -func appendnothing() { - var x []string - println(append(x) == nil) - x = append(x, "!") - println(len(append(x)) == 1) -} - -func appendmulti() { - a := append([]bool{}, []bool{false, true, false}...) - b := append([]bool{}, false, true, false) - for i := range a { - println(a[i], b[i]) - } -} - -func main() { - x := []int{} - for i := 0; i < 100; i++ { - x = append(x, i) - } - for i := 0; i < len(x); i++ { - println(x[i]) - } - y := []int{1, 2, 3} - x = append(x, y...) - for i := 0; i < len(x); i++ { - println(x[i]) - } - stringtobytes() - appendnothing() - appendmulti() -} diff --git a/llgo/test/execution/slices/cap.go b/llgo/test/execution/slices/cap.go deleted file mode 100644 index 33a34ff1a38c9f09ac5d39dec312dc8db546ba70..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/cap.go +++ /dev/null @@ -1,50 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 0 -// CHECK-NEXT: 0 0 -// CHECK-NEXT: 0 0 -// CHECK-NEXT: 1 1 -// CHECK-NEXT: 1 1 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: 2 9 -// CHECK-NEXT: 3 9 -// CHECK-NEXT: 999 -// CHECK-NEXT: 999 -// CHECK-NEXT: 1 2 - -package main - -func test(l, c int) { - var s []int - if l != -1 { - if c == -1 { - s = make([]int, l) - } else { - s = make([]int, l, c) - } - } - println(len(s), cap(s)) -} - -func main() { - test(-1, -1) - test(0, -1) - test(0, 0) - test(1, -1) - test(1, 1) - test(1, 2) - - // make sure capacity is transferred to slice - s := make([]int, 5, 10) - s1 := s[1:3] - println(len(s1), cap(s1)) - - s2 := append(s1, 999) - println(len(s2), cap(s2)) - println(s2[2]) - println(s[3]) - - s3 := s1[0:1:2] - println(len(s3), cap(s3)) -} diff --git a/llgo/test/execution/slices/compare.go b/llgo/test/execution/slices/compare.go deleted file mode 100644 index 93e3071397ee4ffcf596004a4c144a20f111ce59..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/compare.go +++ /dev/null @@ -1,26 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: true - -package main - -func main() { - var s []int - println(s == nil) - println(s != nil) - println(nil == s) - println(nil != s) - s = make([]int, 0) - println(s == nil) - println(s != nil) - println(nil == s) - println(nil != s) -} diff --git a/llgo/test/execution/slices/copy.go b/llgo/test/execution/slices/copy.go deleted file mode 100644 index a6bf6c56454aa687f4b6a047e76adc009299d923..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/copy.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 5 -// CHECK-NEXT: 0 - -package main - -func main() { - a := make([]int, 10) - b := make([]int, 10) - for i, _ := range b { - b[i] = 1 - } - println(copy(a[:5], b)) // expect 5 - println(a[5]) // expect 0 -} diff --git a/llgo/test/execution/slices/index.go b/llgo/test/execution/slices/index.go deleted file mode 100644 index 20d213e1a4ee7c93584d282be80ba0099ea36552..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/index.go +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 - -package main - -func blah() []int { - return make([]int, 1) -} - -func main() { - println(blah()[0]) -} diff --git a/llgo/test/execution/slices/literal.go b/llgo/test/execution/slices/literal.go deleted file mode 100644 index 42adabf76bdcf28217752ca9cd21e723d5a39638..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/literal.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 - -package main - -func main() { - x := []int{1, 2, 3} - for i := 0; i < len(x); i++ { - println(x[i]) - } -} diff --git a/llgo/test/execution/slices/make.go b/llgo/test/execution/slices/make.go deleted file mode 100644 index 30ecd6cbb0e83b60308b770146d6aef80cb28768..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/make.go +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 0 -// CHECK-NEXT: 1 0 -// CHECK-NEXT: 2 0 -// CHECK-NEXT: 3 0 -// CHECK-NEXT: 4 0 -// CHECK-NEXT: 5 666 -// CHECK-NEXT: 6 0 -// CHECK-NEXT: 7 0 -// CHECK-NEXT: 8 0 -// CHECK-NEXT: 9 0 - -package main - -func main() { - x := make([]int, 10) - x[5] = 666 - for i, val := range x { - println(i, val) - } -} diff --git a/llgo/test/execution/slices/sliceexpr.go b/llgo/test/execution/slices/sliceexpr.go deleted file mode 100644 index 56a7b528d9f0605b0664d32307c1703d16a0bee3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/slices/sliceexpr.go +++ /dev/null @@ -1,39 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: a -// CHECK-NEXT: 0 2 -// CHECK-NEXT: 1 3 -// CHECK-NEXT: b -// CHECK-NEXT: 0 3 -// CHECK-NEXT: 1 4 -// CHECK-NEXT: c -// CHECK-NEXT: 0 1 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: d -// CHECK-NEXT: 0 1 -// CHECK-NEXT: 1 2 -// CHECK-NEXT: 2 3 -// CHECK-NEXT: 3 4 - -package main - -func main() { - x := []int{1, 2, 3, 4} - println("a") - for i, val := range x[1:3] { - println(i, val) - } - println("b") - for i, val := range x[2:] { - println(i, val) - } - println("c") - for i, val := range x[:2] { - println(i, val) - } - println("d") - for i, val := range x[:] { - println(i, val) - } -} diff --git a/llgo/test/execution/strings/add.go b/llgo/test/execution/strings/add.go deleted file mode 100644 index daf69215591253de9a445f8608516c9258ea23fe..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/add.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 3 3 6 -// CHECK-NEXT: abc123 - -package main - -func main() { - a := "abc" - b := "123" - c := a + b - println(len(a), len(b), len(c)) - println(c) -} diff --git a/llgo/test/execution/strings/bytes.go b/llgo/test/execution/strings/bytes.go deleted file mode 100644 index a2c450a17478321a7cb4e52ada558398fbf299a3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/bytes.go +++ /dev/null @@ -1,41 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: testBytesConversion: true -// CHECK-NEXT: 97 -// CHECK-NEXT: 98 -// CHECK-NEXT: 99 -// CHECK-NEXT: abc -// CHECK-NEXT: !bc -// CHECK-NEXT: testBytesCopy: true - -package main - -type namedByte byte - -func testBytesConversion() { - s := "abc" - b := []byte(s) - println("testBytesConversion:", s == string(b)) - nb := []namedByte(s) - for _, v := range nb { - println(v) - } - b[0] = '!' - println(s) - s = string(b) - b[0] = 'a' - println(s) -} - -func testBytesCopy() { - s := "abc" - b := make([]byte, len(s)) - copy(b, s) - println("testBytesCopy:", string(b) == s) -} - -func main() { - testBytesConversion() - testBytesCopy() -} diff --git a/llgo/test/execution/strings/compare.go b/llgo/test/execution/strings/compare.go deleted file mode 100644 index c8e4f0914d286768f2a446253fd4ae988c38b144..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/compare.go +++ /dev/null @@ -1,54 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true - -package main - -func main() { - x := "abc" - y := "def" - z := "abcd" - - println(x == x) // true - println(x == y) // false - println(x != x) // false - println(x != y) // true - println(x < x) // false - println(x < y) // true - println(y < x) // false - println(x > x) // false - println(x > y) // false - println(y > x) // true - - println(x == z) // false - println(z == x) // false - println(x < z) // true - println(x > z) // false - println(z < x) // false - println(z > x) // true - - println(x <= x) // true - println(x <= y) // true - println(x >= x) // true - println(y >= x) // true -} diff --git a/llgo/test/execution/strings/index.go b/llgo/test/execution/strings/index.go deleted file mode 100644 index dca7ddf8f106da99ef734644d48efb6185583a1b..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/index.go +++ /dev/null @@ -1,11 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 97 98 99 - -package main - -func main() { - s := "abc" - println(s[0], s[1], s[2]) -} diff --git a/llgo/test/execution/strings/range.go b/llgo/test/execution/strings/range.go deleted file mode 100644 index c68b02a6680a3da0195a171358b22c156ec547b1..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/range.go +++ /dev/null @@ -1,86 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 46 1 -// CHECK-NEXT: 0 46 -// CHECK-NEXT: 0 169 1 -// CHECK-NEXT: 0 169 -// CHECK-NEXT: 0 8364 1 -// CHECK-NEXT: 0 8364 -// CHECK-NEXT: 0 66560 1 -// CHECK-NEXT: 0 66560 -// CHECK-NEXT: 0 83 1 -// CHECK-NEXT: 1 97 2 -// CHECK-NEXT: 2 108 3 -// CHECK-NEXT: 3 101 4 -// CHECK-NEXT: 4 32 5 -// CHECK-NEXT: 5 112 6 -// CHECK-NEXT: 6 114 7 -// CHECK-NEXT: 7 105 8 -// CHECK-NEXT: 8 99 9 -// CHECK-NEXT: 9 101 10 -// CHECK-NEXT: 10 58 11 -// CHECK-NEXT: 11 32 12 -// CHECK-NEXT: 12 8364 13 -// CHECK-NEXT: 15 48 14 -// CHECK-NEXT: 16 46 15 -// CHECK-NEXT: 17 57 16 -// CHECK-NEXT: 18 57 17 -// CHECK-NEXT: 0 83 -// CHECK-NEXT: 1 97 -// CHECK-NEXT: 2 108 -// CHECK-NEXT: 3 101 -// CHECK-NEXT: 4 32 -// CHECK-NEXT: 5 112 -// CHECK-NEXT: 6 114 -// CHECK-NEXT: 7 105 -// CHECK-NEXT: 8 99 -// CHECK-NEXT: 9 101 -// CHECK-NEXT: 10 58 -// CHECK-NEXT: 11 32 -// CHECK-NEXT: 12 8364 -// CHECK-NEXT: 15 48 -// CHECK-NEXT: 16 46 -// CHECK-NEXT: 17 57 -// CHECK-NEXT: 18 57 - -package main - -func printchars(s string) { - var x int - for i, c := range s { - // test loop-carried dependence (x++), introducing a Phi node - x++ - println(i, c, x) - } - - // now test with plain old assignment - var i int - var c rune - for i, c = range s { - println(i, c) - if i == len(s)-1 { - // test multiple branches to loop header - continue - } - } -} - -func main() { - // 1 bytes - printchars(".") - - // 2 bytes - printchars("©") - - // 3 bytes - printchars("€") - - // 4 bytes - printchars("𐐀") - - // mixed - printchars("Sale price: €0.99") - - // TODO add test cases for invalid sequences -} diff --git a/llgo/test/execution/strings/runetostring.go b/llgo/test/execution/strings/runetostring.go deleted file mode 100644 index e6a8c5de413dec62952f068b4c10e7256a8ba384..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/runetostring.go +++ /dev/null @@ -1,74 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: test( 46 ) -// CHECK-NEXT: . -// CHECK-NEXT: 46 -// CHECK-NEXT: 0 46 -// CHECK-NEXT: test( 169 ) -// CHECK-NEXT: © -// CHECK-NEXT: 194 -// CHECK-NEXT: 169 -// CHECK-NEXT: 0 169 -// CHECK-NEXT: test( 8364 ) -// CHECK-NEXT: € -// CHECK-NEXT: 226 -// CHECK-NEXT: 130 -// CHECK-NEXT: 172 -// CHECK-NEXT: 0 8364 -// CHECK-NEXT: test( 66560 ) -// CHECK-NEXT: 𐐀 -// CHECK-NEXT: 240 -// CHECK-NEXT: 144 -// CHECK-NEXT: 144 -// CHECK-NEXT: 128 -// CHECK-NEXT: 0 66560 -// CHECK-NEXT: .©€𐐀 -// CHECK-NEXT: 4 4 4 -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: true - -package main - -func test(r rune) { - println("test(", r, ")") - s := string(r) - println(s) - for i := 0; i < len(s); i++ { - println(s[i]) - } - for i, r := range s { - println(i, r) - } -} - -type namedRune rune - -func testslice(r1 []rune) { - s := string(r1) - println(s) - r2 := []rune(s) - r3 := []namedRune(s) - println(len(r1), len(r2), len(r3)) - if len(r2) == len(r1) && len(r3) == len(r1) { - for i := range r2 { - println(r1[i] == r2[i]) - println(r1[i] == rune(r3[i])) - } - } -} - -func main() { - var runes = []rune{'.', '©', '€', '𐐀'} - test(runes[0]) - test(runes[1]) - test(runes[2]) - test(runes[3]) - testslice(runes) -} diff --git a/llgo/test/execution/strings/slice.go b/llgo/test/execution/strings/slice.go deleted file mode 100644 index ec1b40ce719237463f7800b16dea929353cc1359..0000000000000000000000000000000000000000 --- a/llgo/test/execution/strings/slice.go +++ /dev/null @@ -1,17 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: abcdef -// CHECK-NEXT: bcdef -// CHECK-NEXT: abc -// CHECK-NEXT: bcd - -package main - -func main() { - s := "abcdef" - println(s[:]) - println(s[1:]) - println(s[:3]) - println(s[1:4]) -} diff --git a/llgo/test/execution/structs/compare.go b/llgo/test/execution/structs/compare.go deleted file mode 100644 index 20a8ead72f724531076be930289ebb44f66e8970..0000000000000000000000000000000000000000 --- a/llgo/test/execution/structs/compare.go +++ /dev/null @@ -1,52 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true -// CHECK-NEXT: true -// CHECK-NEXT: false -// CHECK-NEXT: false -// CHECK-NEXT: true - -package main - -type S0 struct{} - -type S1 struct { - a int -} - -type S2 struct { - a, b int -} - -func testS0() { - println(S0{} == S0{}) - println(S0{} != S0{}) -} - -func testS1() { - println(S1{1} == S1{1}) - println(S1{1} != S1{1}) - println(S1{1} == S1{2}) - println(S1{1} != S1{2}) -} - -func testS2() { - s1 := S2{1, 2} - s2 := S2{1, 3} - println(s1 == s1) - println(s1 == s2) - println(s1 != s1) - println(s1 != s2) -} - -func main() { - testS0() - testS1() - testS2() -} diff --git a/llgo/test/execution/structs/embed.go b/llgo/test/execution/structs/embed.go deleted file mode 100644 index d5197945eefcd2d9d968efb3e11d6d1f005d8953..0000000000000000000000000000000000000000 --- a/llgo/test/execution/structs/embed.go +++ /dev/null @@ -1,58 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: A.test 1 -// CHECK-NEXT: A.testA -// CHECK-NEXT: A.testA2 -// CHECK-NEXT: B.test 2 -// CHECK-NEXT: A.testA -// CHECK-NEXT: A.testA2 -// CHECK-NEXT: A.testA - -package main - -type A struct{ aval int } - -func (a *A) test() { - println("A.test", a.aval) -} - -func (a *A) testA() { - println("A.testA") -} - -func (a A) testA2() { - println("A.testA2") -} - -type B struct { - A - bval int -} - -func (b B) test() { - println("B.test", b.bval) -} - -type C struct { - *B - cval int -} - -func main() { - var b B - b.aval = 1 - b.bval = 2 - b.A.test() - b.A.testA() - b.A.testA2() - b.test() - b.testA() - b.testA2() - - var c C - c.B = &b - c.cval = 3 - c.testA() - //c.testA2() -} diff --git a/llgo/test/execution/switch/branch.go b/llgo/test/execution/switch/branch.go deleted file mode 100644 index a7bca9a7bed4ca32db81164fdb7a4aa30e64f66a..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/branch.go +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: true -// CHECK-NEXT: false - -package main - -func main() { - switch true { - default: - break - println("default") - } - - switch true { - case true: - println("true") - fallthrough - case false: - println("false") - } -} diff --git a/llgo/test/execution/switch/default.go b/llgo/test/execution/switch/default.go deleted file mode 100644 index 2ae8509707017412241a71d56474e5322bcfbbce..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/default.go +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: default -// CHECK-NEXT: true - -package main - -func main() { - switch true { - default: - println("default") - } - - switch { - default: - println("default") - case true: - println("true") - } -} diff --git a/llgo/test/execution/switch/empty.go b/llgo/test/execution/switch/empty.go deleted file mode 100644 index 4d20679e4b1a68d993de18c8c17be880525da6d3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/empty.go +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: f was called - -package main - -func f() int { - println("f was called") - return 123 -} - -func main() { - switch f() { - } -} diff --git a/llgo/test/execution/switch/scope.go b/llgo/test/execution/switch/scope.go deleted file mode 100644 index 73bab3cd747422a65f8e9d4033135370101f8933..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/scope.go +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 2 - -package main - -func main() { - // case clauses have their own scope. - switch { - case true, false: - x := 1 - println(x) - fallthrough - default: - x := 2 - println(x) - } -} diff --git a/llgo/test/execution/switch/strings.go b/llgo/test/execution/switch/strings.go deleted file mode 100644 index 7f0c99d441cfd3388bcd035f299b9dfe9ffe3b54..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/strings.go +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: abc -// CHECK-NEXT: def, abc - -package main - -func main() { - switch "abc" { - case "def": - println("def") - case "abc": - println("abc") - } - - switch "abc" { - case "def", "abc": - println("def, abc") - } -} diff --git a/llgo/test/execution/switch/type.go b/llgo/test/execution/switch/type.go deleted file mode 100644 index b43231cd935e2a4269dddc9539344be683ad15f3..0000000000000000000000000000000000000000 --- a/llgo/test/execution/switch/type.go +++ /dev/null @@ -1,72 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: int64 123 -// CHECK-NEXT: default -// CHECK-NEXT: uint8 or int8 -// CHECK-NEXT: uint8 or int8 -// CHECK-NEXT: N - -package main - -func test(i interface{}) { - switch x := i.(type) { - case int64: - println("int64", x) - // FIXME - //case string: - // println("string", x) - default: - println("default") - } -} - -type stringer interface { - String() string -} - -func printany(i interface{}) { - switch v := i.(type) { - case nil: - print("nil", v) - case stringer: - print(v.String()) - case error: - print(v.Error()) - case int: - print(v) - case string: - print(v) - } -} - -func multi(i interface{}) { - switch i.(type) { - case uint8, int8: - println("uint8 or int8") - default: - println("something else") - } -} - -type N int - -func (n N) String() string { return "N" } - -func named() { - var x interface{} = N(123) - switch x := x.(type) { - case N: - // Test for bug: previously, type switch was - // assigning underlying type of N (int). - println(x.String()) - } -} - -func main() { - test(int64(123)) - test("abc") - multi(uint8(123)) - multi(int8(123)) - named() -} diff --git a/llgo/test/execution/types/named.go b/llgo/test/execution/types/named.go deleted file mode 100644 index 08fd791ec833ace2648cc52abb1d25c3a8624ae8..0000000000000000000000000000000000000000 --- a/llgo/test/execution/types/named.go +++ /dev/null @@ -1,37 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 24 -// CHECK-NEXT: 16 -// CHECK-NEXT: 0 - -package main - -import "unsafe" - -func f1() { - type T struct { - a, b, c int - } - var t T - println(unsafe.Sizeof(t)) -} - -func f2() { - type T interface{} - var t T - t = 1 - println(unsafe.Sizeof(t)) -} - -func f3() { - type T struct{} - var t T - println(unsafe.Sizeof(t)) -} - -func main() { - f1() - f2() - f3() -} diff --git a/llgo/test/execution/types/recursive.go b/llgo/test/execution/types/recursive.go deleted file mode 100644 index 69ac09b45fb2bd2b3a65ef5da58f290bfe5b1c0e..0000000000000000000000000000000000000000 --- a/llgo/test/execution/types/recursive.go +++ /dev/null @@ -1,29 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 3 -// CHECK-NEXT: 4 - -package main - -type T1 *T1 - -func count(t T1) int { - if t == nil { - return 1 - } - return 1 + count(*t) -} - -func testSelfPointer() { - var a T1 - var b T1 - var c T1 = &b - *c = &a - println(count(c)) - println(count(&c)) -} - -func main() { - testSelfPointer() -} diff --git a/llgo/test/execution/unsafe/const_sizeof.go b/llgo/test/execution/unsafe/const_sizeof.go deleted file mode 100644 index ade9d0bc22ba9aaf604cc25e0b7414602a124ea2..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/const_sizeof.go +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 8 -// CHECK-NEXT: 8 - -package main - -import "unsafe" - -const ptrSize = unsafe.Sizeof((*byte)(nil)) - -var x [ptrSize]int - -func main() { - println(ptrSize) - println(len(x)) -} diff --git a/llgo/test/execution/unsafe/offsetof.go b/llgo/test/execution/unsafe/offsetof.go deleted file mode 100644 index 88b313ab5e130f1a890610369e2dacd5b693b59e..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/offsetof.go +++ /dev/null @@ -1,26 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 0 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 16 - -package main - -import "unsafe" - -type S struct { - a int16 - b int32 - c int8 - d int64 -} - -func main() { - var s S - println(unsafe.Offsetof(s.a)) - println(unsafe.Offsetof(s.b)) - println(unsafe.Offsetof(s.c)) - println(unsafe.Offsetof(s.d)) -} diff --git a/llgo/test/execution/unsafe/pointer.go b/llgo/test/execution/unsafe/pointer.go deleted file mode 100644 index 20dc64f073f272c5e7007d73e8bffb029f8580ce..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/pointer.go +++ /dev/null @@ -1,21 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 123 -// CHECK-NEXT: 456 - -package main - -import "unsafe" - -func main() { - var i [2]int - i[0] = 123 - i[1] = 456 - ptr := &i[0] - println(*ptr) - ptr_i := unsafe.Pointer(ptr) - ptr_i = unsafe.Pointer(uintptr(ptr_i) + unsafe.Sizeof(i[0])) - ptr = (*int)(ptr_i) - println(*ptr) -} diff --git a/llgo/test/execution/unsafe/sizeof_array.go b/llgo/test/execution/unsafe/sizeof_array.go deleted file mode 100644 index 2928de793275a2e0bcf1dfb8f84c1f965c848849..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/sizeof_array.go +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 12 - -package main - -import "unsafe" - -type uint24 struct { - a uint16 - b uint8 -} - -func main() { - var a [3]uint24 - println(unsafe.Sizeof(a)) -} diff --git a/llgo/test/execution/unsafe/sizeof_basic.go b/llgo/test/execution/unsafe/sizeof_basic.go deleted file mode 100644 index a9a467bd114bd536fc640e21764a9116c8e958da..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/sizeof_basic.go +++ /dev/null @@ -1,102 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 1 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 16 -// CHECK-NEXT: 16 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 4 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 -// CHECK-NEXT: 8 - -package main - -import "unsafe" - -func main() { - var b bool - var i int - var i8 int8 - var i16 int16 - var i32 int32 - var i64 int64 - var u uint - var u8 uint8 - var u16 uint16 - var u32 uint32 - var u64 uint64 - var f32 float32 - var f64 float64 - var c64 complex64 - var c128 complex128 - var s string - var p unsafe.Pointer - var up uintptr - - println(unsafe.Sizeof(b)) - println(unsafe.Sizeof(i)) - println(unsafe.Sizeof(i8)) - println(unsafe.Sizeof(i16)) - println(unsafe.Sizeof(i32)) - println(unsafe.Sizeof(i64)) - println(unsafe.Sizeof(u)) - println(unsafe.Sizeof(u8)) - println(unsafe.Sizeof(u16)) - println(unsafe.Sizeof(u32)) - println(unsafe.Sizeof(u64)) - println(unsafe.Sizeof(f32)) - println(unsafe.Sizeof(f64)) - println(unsafe.Sizeof(c64)) - println(unsafe.Sizeof(c128)) - println(unsafe.Sizeof(s)) - println(unsafe.Sizeof(p)) - println(unsafe.Sizeof(up)) - - println(unsafe.Alignof(b)) - println(unsafe.Alignof(i)) - println(unsafe.Alignof(i8)) - println(unsafe.Alignof(i16)) - println(unsafe.Alignof(i32)) - println(unsafe.Alignof(i64)) - println(unsafe.Alignof(u)) - println(unsafe.Alignof(u8)) - println(unsafe.Alignof(u16)) - println(unsafe.Alignof(u32)) - println(unsafe.Alignof(u64)) - println(unsafe.Alignof(f32)) - println(unsafe.Alignof(f64)) - println(unsafe.Alignof(c64)) - println(unsafe.Alignof(c128)) - println(unsafe.Alignof(s)) - println(unsafe.Alignof(p)) - println(unsafe.Alignof(up)) -} diff --git a/llgo/test/execution/unsafe/sizeof_struct.go b/llgo/test/execution/unsafe/sizeof_struct.go deleted file mode 100644 index e8612d2ea6cce4f7e153968b8500e7251e410731..0000000000000000000000000000000000000000 --- a/llgo/test/execution/unsafe/sizeof_struct.go +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 24 - -package main - -import "unsafe" - -type a struct { - a int16 - b int32 - c int8 - d int64 -} - -func main() { - println(unsafe.Sizeof(a{})) -} diff --git a/llgo/test/execution/var.go b/llgo/test/execution/var.go deleted file mode 100644 index 71b025df45b2a6282fbf879f66917806e39b83ce..0000000000000000000000000000000000000000 --- a/llgo/test/execution/var.go +++ /dev/null @@ -1,37 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: woobie -// CHECK-NEXT: 579 456 -// CHECK-NEXT: 12 +3.450000e+000 -// CHECK-NEXT: -1 - -package main - -func Blah() int { - println("woobie") - return 123 -} - -func F1() (int, float64) { - return 12, 3.45 -} - -var X = Y + Blah() // == 579 -var Y = 123 + Z // == 456 - -var X1, Y1 = F1() - -const ( - _ = 333 * iota - Z -) - -var I interface{} = -1 -var I1 = I.(int) - -func main() { - println(X, Y) - println(X1, Y1) - println(I1) -} diff --git a/llgo/test/execution/varargs.go b/llgo/test/execution/varargs.go deleted file mode 100644 index ca994164e46e11e47554c6604efcdea0ff7fd789..0000000000000000000000000000000000000000 --- a/llgo/test/execution/varargs.go +++ /dev/null @@ -1,31 +0,0 @@ -// RUN: llgo -o %t %s -// RUN: %t 2>&1 | FileCheck %s - -// CHECK: 3 -// CHECK-NEXT: 123 -// CHECK-NEXT: 456 -// CHECK-NEXT: 789 -// CHECK-NEXT: 4 -// CHECK-NEXT: 123 -// CHECK-NEXT: 456 -// CHECK-NEXT: 789 -// CHECK-NEXT: 101112 -// CHECK-NEXT: 3 -// CHECK-NEXT: 1 -// CHECK-NEXT: 2 -// CHECK-NEXT: 3 - -package main - -func p(i ...int) { - println(len(i)) - for j := 0; j < len(i); j++ { - println(i[j]) - } -} - -func main() { - p(123, 456, 789) - p(123, 456, 789, 101112) - p([]int{1, 2, 3}...) -} diff --git a/llgo/test/gllgo/dead.go b/llgo/test/gllgo/dead.go deleted file mode 100644 index 31d0de85487faf749f3a63fcdc72b123e16c3999..0000000000000000000000000000000000000000 --- a/llgo/test/gllgo/dead.go +++ /dev/null @@ -1,6 +0,0 @@ -// RUN: llgo -O0 -S -o - %s | FileCheck %s - -package gotest - -// CHECK-NOT: deadfunc -func deadfunc() diff --git a/llgo/test/irgen/Inputs/mangling-synthetic-p.go b/llgo/test/irgen/Inputs/mangling-synthetic-p.go deleted file mode 100644 index c59588a51ba60a5b9809b4bc8dd86563ec11916f..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/Inputs/mangling-synthetic-p.go +++ /dev/null @@ -1,4 +0,0 @@ -package p - -type U struct{} -func (U) f() diff --git a/llgo/test/irgen/avoidload.go b/llgo/test/irgen/avoidload.go deleted file mode 100644 index 0dec74eb92f2364d974a19f5e5cba727066b0e18..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/avoidload.go +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -type X struct { - indices [1]int -} - -// CHECK-NOT: load [200 x i64] -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i64 160000, i32 1, i1 false) -var _ = [100][200]int{}[0][0] - -// CHECK-NOT: load [1024 x i64] -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i64 8192, i32 1, i1 false) -var _ = [1024]int{}[X{}.indices[0]] diff --git a/llgo/test/irgen/cabi.go b/llgo/test/irgen/cabi.go deleted file mode 100644 index bff2d7c8f89c7106a822a3ec5c0f2e5d3be6250e..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/cabi.go +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -// CHECK: define void @foo.Test01_SI8(i8* nest, i8 signext) -func Test01_SI8(x int8) {} -// CHECK: define void @foo.Test02_UI8(i8* nest, i8 zeroext) -func Test02_UI8(x uint8) {} - -// CHECK: define void @foo.Test03_SI16(i8* nest, i16 signext) -func Test03_SI16(x int16) {} -// CHECK: define void @foo.Test04_UI16(i8* nest, i16 zeroext) -func Test04_UI16(x uint16) {} - -// CHECK: define void @foo.Test05_SI32(i8* nest, i32) -func Test05_SI32(x int32) {} -// CHECK: define void @foo.Test06_UI32(i8* nest, i32) -func Test06_UI32(x uint32) {} - -// CHECK: define void @foo.Test07_SI64(i8* nest, i64) -func Test07_SI64(x int64) {} -// CHECK: define void @foo.Test08_UI64(i8* nest, i64) -func Test08_UI64(x uint64) {} diff --git a/llgo/test/irgen/go-panic.go b/llgo/test/irgen/go-panic.go deleted file mode 100644 index 35b0a47bb9b55d325848a5dea415830cc63e5588..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/go-panic.go +++ /dev/null @@ -1,10 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -func F() { - // CHECK: call void @__go_panic - // CHECK-NEXT: ret void - // CHECK-NEXT: } - go panic("") -} diff --git a/llgo/test/irgen/imports.go b/llgo/test/irgen/imports.go deleted file mode 100644 index c0f9f56a325041368d343aa960c298d1516829ec..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/imports.go +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -import _ "fmt" - -var X interface{} - -// CHECK: @"init$guard" = internal global i1 false - -// CHECK: define void @foo..import(i8* nest) -// CHECK-NEXT: : -// CHECK-NEXT: %[[N:.*]] = load i1, i1* @"init$guard" -// CHECK-NEXT: br i1 %[[N]], label %{{.*}}, label %[[L:.*]] - -// CHECK: [[L]]: -// CHECK-NEXT: call void @__go_register_gc_roots -// CHECK-NEXT: store i1 true, i1* @"init$guard" -// CHECK-NEXT: call void @fmt..import(i8* undef) -// CHECK-NEXT: br label diff --git a/llgo/test/irgen/mangling-dot.go b/llgo/test/irgen/mangling-dot.go deleted file mode 100644 index aff73cb8acb8eb8237d1be37a2cb0c03ba934dfc..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/mangling-dot.go +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: llgo -fgo-pkgpath=llvm.org/llvm -S -emit-llvm -o - %s | FileCheck %s - -package llvm - -// CHECK: @llvm_org_llvm.F -func F() { -} diff --git a/llgo/test/irgen/mangling-synthetic.go b/llgo/test/irgen/mangling-synthetic.go deleted file mode 100644 index ab043a69b97883deb681e979c86592a6379adeaf..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/mangling-synthetic.go +++ /dev/null @@ -1,14 +0,0 @@ -// RUN: llgo -fgo-pkgpath=p -c -o %T/p.o %S/Inputs/mangling-synthetic-p.go -// RUN: llgo -fgo-pkgpath=q -I %T -S -emit-llvm -o - %s | FileCheck %s - -package q - -import "p" - -// CHECK-DAG: define linkonce_odr void @p.f.N3_q.T(i8* nest, i8*) -// CHECK-DAG: define linkonce_odr void @p.f.pN3_q.T(i8* nest, i8*) -type T struct { p.U } - -// CHECK-DAG: declare void @q.f.N3_q.T(i8* nest, i8*) -// CHECK-DAG: define linkonce_odr void @q.f.pN3_q.T(i8* nest, i8*) -func (T) f() diff --git a/llgo/test/irgen/select.go b/llgo/test/irgen/select.go deleted file mode 100644 index 748277a4f49a98da0911e188d9fa7b4d5bf6d325..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/select.go +++ /dev/null @@ -1,18 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -// CHECK-NOT: alloca [1024 x i8] -// CHECK-NOT: alloca [2048 x i8] -// CHECK: alloca [4096 x i8] -func F() { - ch1 := make(chan [1024]byte) - ch2 := make(chan [2048]byte) - ch3 := make(chan [4096]byte) - select { - case <-ch1: - case _ = <-ch2: - case x := <-ch3: - _ = x[0] - } -} diff --git a/llgo/test/irgen/switch.go b/llgo/test/irgen/switch.go deleted file mode 100644 index af05d41ffcfb5b326ed70ba59daaa83b03fc200e..0000000000000000000000000000000000000000 --- a/llgo/test/irgen/switch.go +++ /dev/null @@ -1,62 +0,0 @@ -// RUN: llgo -S -emit-llvm -o - %s | FileCheck %s - -package foo - -// CHECK: switch i32 -// CHECK-NEXT: i32 0, label %[[L0:.*]] -// CHECK-NEXT: i32 1, label %[[L1:.*]] -// CHECK-NEXT: i32 2, label %[[L2:.*]] -// CHECK-NEXT: ] -// CHECK: [[L0]]: -// CHECK-NEXT: ret i32 1 -// CHECK: [[L1]]: -// CHECK-NEXT: ret i32 2 -// CHECK: [[L2]]: -// CHECK-NEXT: ret i32 0 -func F1(x int32) int32 { - switch x { - case 0: - return 1 - case 1: - return 2 - case 2: - return 0 - } - panic("unreachable") -} - -// CHECK: switch i64 -// CHECK-NEXT: i64 0 -// CHECK-NEXT: ] -// CHECK: icmp eq i64 {{.*}}, 1 -func F2(x int64) bool { - return x == 0 || x == 0 || x == 1 -} - -// CHECK: switch i64 -// CHECK-NEXT: i64 0 -// CHECK-NEXT: ] -func F3(x int64) bool { - return x == 0 || x == 0 || x == 0 -} - -// CHECK: switch i64 -// CHECK-NEXT: i64 0 -// CHECK-NEXT: i64 1 -// CHECK-NEXT: i64 2 -// CHECK-NEXT: ] -// CHECK: icmp eq i64 {{.*}}, 3 -func F4(x int64) bool { - return x == 0 || x == 1 || x == 2 || x == 3 -} - -// CHECK-NOT: switch double -func F5(x float64) float64 { - switch x { - case 0: - return 1.0 - case 1.0: - return 0 - } - panic("unreachable") -} diff --git a/llgo/test/lit.cfg b/llgo/test/lit.cfg deleted file mode 100644 index a94e33e7a175e9aa4c13bc1629be13211a4ef0c4..0000000000000000000000000000000000000000 --- a/llgo/test/lit.cfg +++ /dev/null @@ -1,16 +0,0 @@ -import lit.formats -import os -import sys - -config.name = 'llgo' -config.suffixes = ['.go', '.test'] -config.test_format = lit.formats.ShTest() -config.test_source_root = config.llvm_src_root + '/tools/llgo/test' -config.test_exec_root = config.llvm_obj_root + '/tools/llgo/test' -config.excludes = ['Inputs'] - -config.substitutions.append((r"\bllgo\b", config.llvm_obj_root + '/bin/llgo -static-libgo')) -config.substitutions.append((r"\bllgoi\b", config.llvm_obj_root + '/bin/llgoi')) -config.substitutions.append((r"\bFileCheck\b", config.llvm_obj_root + '/bin/FileCheck')) -config.substitutions.append((r"\bcount\b", config.llvm_obj_root + '/bin/count')) -config.substitutions.append((r"\bnot\b", config.llvm_obj_root + '/bin/not')) diff --git a/llgo/test/lit.site.cfg.in b/llgo/test/lit.site.cfg.in deleted file mode 100644 index 2c3838618bfed0f105f50ba3ac860dba9e8e95a9..0000000000000000000000000000000000000000 --- a/llgo/test/lit.site.cfg.in +++ /dev/null @@ -1,4 +0,0 @@ -config.llvm_src_root = "@LLVM_SOURCE_DIR@" -config.llvm_obj_root = "@LLVM_BINARY_DIR@" - -lit_config.load_config(config, "@CMAKE_CURRENT_SOURCE_DIR@/lit.cfg") diff --git a/llgo/test/llgoi/Inputs/src/bar/answer.go b/llgo/test/llgoi/Inputs/src/bar/answer.go deleted file mode 100644 index 202b509652598eb32cf06dc0c5a9d42cc3ec32dc..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/Inputs/src/bar/answer.go +++ /dev/null @@ -1,8 +0,0 @@ -package bar - -import "strconv" - -func Answer() int { - n, _ := strconv.Atoi("42") - return n -} diff --git a/llgo/test/llgoi/Inputs/src/foo/answer.go b/llgo/test/llgoi/Inputs/src/foo/answer.go deleted file mode 100644 index 1593e36491eb36a7a36ba7671e15b93a024750ec..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/Inputs/src/foo/answer.go +++ /dev/null @@ -1,7 +0,0 @@ -package foo - -import "bar" - -func Answer() int { - return bar.Answer() -} diff --git a/llgo/test/llgoi/Inputs/src/foo_cgo/answer.go b/llgo/test/llgoi/Inputs/src/foo_cgo/answer.go deleted file mode 100644 index 5fe8a31c34ce8c135ffb8ec3317b7aa641d9d790..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/Inputs/src/foo_cgo/answer.go +++ /dev/null @@ -1,8 +0,0 @@ -package foo_cgo - -// #include -import "C" - -func Answer() C.uint64_t { - return 42 -} diff --git a/llgo/test/llgoi/arith.test b/llgo/test/llgoi/arith.test deleted file mode 100644 index b7869a9e1e31a6e7a4b2560155e7103fe9948836..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/arith.test +++ /dev/null @@ -1,4 +0,0 @@ -// RUN: llgoi < %s | FileCheck %s - -1 + 1 -// CHECK: 2 diff --git a/llgo/test/llgoi/import-binary.test b/llgo/test/llgoi/import-binary.test deleted file mode 100644 index 542054e11f0ede75ebfc74dd354c16edb88079fe..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/import-binary.test +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: llgoi < %s | FileCheck %s - -import "fmt" -fmt.Println(1, "two", 3) -// CHECK: 1 two 3 diff --git a/llgo/test/llgoi/import-source.test b/llgo/test/llgoi/import-source.test deleted file mode 100644 index 3619fb4ba9a4e544d8aa49b20d3cdbcefe399d5a..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/import-source.test +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: env GOPATH=%S/Inputs llgoi < %s 2>&1 | FileCheck %s - -// make sure user symbols do not conflict with imported source package -Answer := 1 - -import "foo" - -// Test that importing binary after source works. -import "strconv" - -foo.Answer() -// CHECK: 42 - -strconv.FormatBool(true) -// CHECK: true - -var v1 strconv.NumError -var v2 strconv.NumError - -// v1 and v2 should have the same type identity. -// CHECK-NOT: cannot assign -v1 = v2 - -// Method lookup relies on v1 having a consistent type. -v1.Error - -import "foo_cgo" -// CHECK: foo_cgo: cannot load cgo package diff --git a/llgo/test/llgoi/import-source2.test b/llgo/test/llgoi/import-source2.test deleted file mode 100644 index 0be45ee685cbbdd2eb2b442842fcbfb220000e1d..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/import-source2.test +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: env GOPATH=%S/Inputs llgoi < %s | FileCheck %s - -// Test that importing binary before source works. -import "strconv" - -import "foo" - -foo.Answer() -// CHECK: 42 - -strconv.FormatBool(true) -// CHECK: true diff --git a/llgo/test/llgoi/interfaces.test b/llgo/test/llgoi/interfaces.test deleted file mode 100644 index 125e015791619097f7f3304ec8bc244b7ea299a8..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/interfaces.test +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: llgoi < %s | FileCheck %s - -import "errors" -err := errors.New("foo") -err -// CHECK: foo - -err.(interface{Foo()}) -// CHECK: panic: interface conversion - -_, ok := err.(interface{Foo()}) -ok -// CHECK: false - -err.(interface{Error() string}) -// CHECK: foo - -iface, ok := err.(interface{Error() string}) -iface -// CHECK: foo -ok -// CHECK: true diff --git a/llgo/test/llgoi/maps.test b/llgo/test/llgoi/maps.test deleted file mode 100644 index ab1ba7eaa11a13fc582602b5643a00b0dc3ecd49..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/maps.test +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: llgoi < %s | FileCheck %s - -m := make(map[int]int) -m -// CHECK: map[] - -m[0] -// CHECK: 0 - -m0, ok := m[0] -m0 -// CHECK: 0 -ok -// CHECK: false - -func() { - m[0] = 1 -}() - -m[0] -// CHECK: 1 - -m0, ok = m[0] -m0 -// CHECK: 1 -ok -// CHECK: true diff --git a/llgo/test/llgoi/panic.test b/llgo/test/llgoi/panic.test deleted file mode 100644 index 65ecd7b085a7af215bc06025d18e385be5080e5c..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/panic.test +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: llgoi < %s | FileCheck %s - -panic("msg") -// CHECK: panic: msg - -import "fmt" -func() { - defer func() { - r := recover() - fmt.Println("recovered", r) - }() - panic("msg") -}() -// CHECK-NOT: {{^}}panic: -// CHECK: recovered msg -// CHECK-NOT: {{^}}panic: diff --git a/llgo/test/llgoi/vars.test b/llgo/test/llgoi/vars.test deleted file mode 100644 index c28198cf0f1ac4c462312f92777de257b2a68ac2..0000000000000000000000000000000000000000 --- a/llgo/test/llgoi/vars.test +++ /dev/null @@ -1,30 +0,0 @@ -// RUN: llgoi < %s 2>&1 | FileCheck %s - -x := 3 -x -// CHECK: 3 - -x + x -// CHECK: 6 - -x * x -// CHECK: 9 - -x = 4 -x + x -// CHECK: 8 - -x := true -// CHECK: cannot assign {{.*}} to x (variable of type int) - -x, y := func() (int, int) { - return 1, 2 -}() -// CHECK: 1 -// CHECK: 2 - -x, _ = func() (int, int) { - return 3, 4 -}() -x -// CHECK: 3 diff --git a/llgo/third_party/gofrontend/LICENSE b/llgo/third_party/gofrontend/LICENSE deleted file mode 100644 index 6a66aea5eafe0ca6a688840c47219556c552488e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. 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 Google Inc. 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 -OWNER 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. diff --git a/llgo/third_party/gofrontend/config-ml.in b/llgo/third_party/gofrontend/config-ml.in deleted file mode 100644 index 927bad66dc094283cceae5abf8f09e3414b99e51..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/config-ml.in +++ /dev/null @@ -1,885 +0,0 @@ -# Configure fragment invoked in the post-target section for subdirs -# wanting multilib support. -# -# Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2010, 2011, 2014 Free Software Foundation, Inc. -# -# This file 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. -# -# Please report bugs to -# and send patches to . - -# It is advisable to support a few --enable/--disable options to let the -# user select which libraries s/he really wants. -# -# Subdirectories wishing to use multilib should put the following lines -# in the "post-target" section of configure.in. -# -# if [ "${srcdir}" = "." ] ; then -# if [ "${with_target_subdir}" != "." ] ; then -# . ${with_multisrctop}../../config-ml.in -# else -# . ${with_multisrctop}../config-ml.in -# fi -# else -# . ${srcdir}/../config-ml.in -# fi -# -# -# Things are complicated because 6 separate cases must be handled: -# 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6. -# -# srcdir=. is special. It must handle make programs that don't handle VPATH. -# To implement this, a symlink tree is built for each library and for each -# multilib subdir. -# -# The build tree is layed out as -# -# ./ -# newlib -# m68020/ -# newlib -# m68881/ -# newlib -# -# The nice feature about this arrangement is that inter-library references -# in the build tree work without having to care where you are. Note that -# inter-library references also work in the source tree because symlink trees -# are built when srcdir=. -# -# Unfortunately, trying to access the libraries in the build tree requires -# the user to manually choose which library to use as GCC won't be able to -# find the right one. This is viewed as the lesser of two evils. -# -# Configure variables: -# ${with_target_subdir} = "." for native, or ${target_alias} for cross. -# Set by top level Makefile. -# ${with_multisrctop} = how many levels of multilibs there are in the source -# tree. It exists to handle the case of configuring in the source tree: -# ${srcdir} is not constant. -# ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). -# -# Makefile variables: -# MULTISRCTOP = number of multilib levels in source tree (+1 if cross) -# (FIXME: note that this is different than ${with_multisrctop}. Check out.). -# MULTIBUILDTOP = number of multilib levels in build tree -# MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) -# (only defined in each library's main Makefile). -# MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) -# (only defined in each multilib subdir). - -# FIXME: Multilib is currently disabled by default for everything other than -# newlib. It is up to each target to turn on multilib support for the other -# libraries as desired. - -# Autoconf incoming variables: -# srcdir, host, ac_configure_args -# -# We *could* figure srcdir and host out, but we'd have to do work that -# our caller has already done to figure them out and requiring these two -# seems reasonable. -# Note that `host' in this case is GCC's `target'. Target libraries are -# configured for a particular host. - -Makefile=${ac_file-Makefile} -ml_config_shell=${CONFIG_SHELL-/bin/sh} -ml_realsrcdir=${srcdir} - -# Scan all the arguments and set all the ones we need. - -scan_arguments () -{ - ml_verbose=--verbose - for option - do - # Strip single quotes surrounding individual options, that is, remove one - # level of shell quoting for these. - case $option in - \'*\') eval option=$option ;; - esac - - case $option in - --*) ;; - -*) option=-$option ;; - esac - - case $option in - --*=*) - optarg=`echo $option | sed -e 's/^[^=]*=//'` - ;; - esac - - case $option in - --disable-*) - enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` - eval $enableopt=no - ;; - --enable-*) - case "$option" in - *=*) ;; - *) optarg=yes ;; - esac - enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` - # enable_shared and enable_static are handled by configure. - # Don't undo its work. - case $enableopt in - enable_shared | enable_static) ;; - *) eval $enableopt='$optarg' ;; - esac - ;; - --norecursion | --no-recursion) - ml_norecursion=yes - ;; - --silent | --sil* | --quiet | --q*) - ml_verbose=--silent - ;; - --verbose | --v | --verb*) - ml_verbose=--verbose - ;; - --with-*) - case "$option" in - *=*) ;; - *) optarg=yes ;; - esac - withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` - eval $withopt='$optarg' - ;; - --without-*) - withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` - eval $withopt=no - ;; - esac - done -} -# Use eval to properly handle configure arguments such as -# --enable-foo='--enable-a=1 --enable-b=2 --enable-c=3'. -eval scan_arguments "${ac_configure_args}" -unset scan_arguments - -# Only do this if --enable-multilib. -if [ "${enable_multilib}" = yes ]; then - -# Compute whether this is the library's top level directory -# (ie: not a multilib subdirectory, and not a subdirectory like newlib/src). -# ${with_multisubdir} tells us we're in the right branch, but we could be -# in a subdir of that. -# ??? The previous version could void this test by separating the process into -# two files: one that only the library's toplevel configure.in ran (to -# configure the multilib subdirs), and another that all configure.in's ran to -# update the Makefile. It seemed reasonable to collapse all multilib support -# into one file, but it does leave us with having to perform this test. -ml_toplevel_p=no -if [ -z "${with_multisubdir}" ]; then - if [ "${srcdir}" = "." ]; then - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. - # ${with_target_subdir} = "." for native, otherwise target alias. - if [ "${with_target_subdir}" = "." ]; then - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then - ml_toplevel_p=yes - fi - else - if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then - ml_toplevel_p=yes - fi - fi - else - # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. - if [ -f ${ml_realsrcdir}/../config-ml.in ]; then - ml_toplevel_p=yes - fi - fi -fi - -# If this is the library's top level directory, set multidirs to the -# multilib subdirs to support. This lives at the top because we need -# `multidirs' set right away. - -if [ "${ml_toplevel_p}" = yes ]; then - -multidirs= -for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do - dir=`echo $i | sed -e 's/;.*$//'` - if [ "${dir}" = "." ]; then - true - else - if [ -z "${multidirs}" ]; then - multidirs="${dir}" - else - multidirs="${multidirs} ${dir}" - fi - fi -done - -# Target libraries are configured for the host they run on, so we check -# $host here, not $target. - -case "${host}" in -arm-*-*) - if [ x"$enable_fpu" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *fpu*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_26bit" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *26bit*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_underscore" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *under*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_interwork" = xno ] - then - old_multidirs=${multidirs} - multidirs="" - for x in ${old_multidirs}; do - case "${x}" in - *interwork*) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *le* ) : ;; - *be* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x"$enable_nofmult" = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *nofmult* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -m68*-*-*) - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68881 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68881* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68000 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68000* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_m68020 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *m68020* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -mips*-*-*) - if [ x$enable_single_float = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *single* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *el* ) : ;; - *eb* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -powerpc*-*-* | rs6000*-*-*) - if [ x$enable_aix64 = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *ppc64* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_pthread = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *pthread* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_softfloat = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *soft-float* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powercpu = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - power | */power | */power/* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powerpccpu = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *powerpc* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_powerpcos = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mcall-linux* | *mcall-solaris* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_biendian = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mlittle* | *mbig* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - if [ x$enable_sysv = xno ] - then - old_multidirs="${multidirs}" - multidirs="" - for x in ${old_multidirs}; do - case "$x" in - *mcall-sysv* ) : ;; - *) multidirs="${multidirs} ${x}" ;; - esac - done - fi - ;; -esac - -# Remove extraneous blanks from multidirs. -# Tests like `if [ -n "$multidirs" ]' require it. -multidirs=`echo "$multidirs" | sed -e 's/^[ ][ ]*//' -e 's/[ ][ ]*$//' -e 's/[ ][ ]*/ /g'` - -# Add code to library's top level makefile to handle building the multilib -# subdirs. - -cat > Multi.tem <<\EOF - -PWD_COMMAND=$${PWDCMD-pwd} - -# FIXME: There should be an @-sign in front of the `if'. -# Leave out until this is tested a bit more. -multi-do: - if [ -z "$(MULTIDIRS)" ]; then \ - true; \ - else \ - rootpre=`${PWD_COMMAND}`/; export rootpre; \ - srcrootpre=`cd $(srcdir); ${PWD_COMMAND}`/; export srcrootpre; \ - lib=`echo "$${rootpre}" | sed -e 's,^.*/\([^/][^/]*\)/$$,\1,'`; \ - compiler="$(CC)"; \ - for i in `$${compiler} --print-multi-lib 2>/dev/null`; do \ - dir=`echo $$i | sed -e 's/;.*$$//'`; \ - if [ "$${dir}" = "." ]; then \ - true; \ - else \ - if [ -d ../$${dir}/$${lib} ]; then \ - flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \ - if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) \ - CFLAGS="$(CFLAGS) $${flags}" \ - CCASFLAGS="$(CCASFLAGS) $${flags}" \ - FCFLAGS="$(FCFLAGS) $${flags}" \ - FFLAGS="$(FFLAGS) $${flags}" \ - ADAFLAGS="$(ADAFLAGS) $${flags}" \ - prefix="$(prefix)" \ - exec_prefix="$(exec_prefix)" \ - GCJFLAGS="$(GCJFLAGS) $${flags}" \ - GOCFLAGS="$(GOCFLAGS) $${flags}" \ - CXXFLAGS="$(CXXFLAGS) $${flags}" \ - LIBCFLAGS="$(LIBCFLAGS) $${flags}" \ - LIBCXXFLAGS="$(LIBCXXFLAGS) $${flags}" \ - LDFLAGS="$(LDFLAGS) $${flags}" \ - MULTIFLAGS="$${flags}" \ - DESTDIR="$(DESTDIR)" \ - INSTALL="$(INSTALL)" \ - INSTALL_DATA="$(INSTALL_DATA)" \ - INSTALL_PROGRAM="$(INSTALL_PROGRAM)" \ - INSTALL_SCRIPT="$(INSTALL_SCRIPT)" \ - $(DO)); then \ - true; \ - else \ - exit 1; \ - fi; \ - else true; \ - fi; \ - fi; \ - done; \ - fi - -# FIXME: There should be an @-sign in front of the `if'. -# Leave out until this is tested a bit more. -multi-clean: - if [ -z "$(MULTIDIRS)" ]; then \ - true; \ - else \ - lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ - for dir in : $(MULTIDIRS); do \ - test $$dir != : || continue; \ -EOF -cat >>Multi.tem <>Multi.tem <<\EOF - if (cd ../$${dir}/$${lib}; $(MAKE) $(FLAGS_TO_PASS) $(DO)); \ - then true; \ - else exit 1; \ - fi; \ - else true; \ - fi; \ - done; \ - fi -EOF - -cat ${Makefile} Multi.tem > Makefile.tem -rm -f ${Makefile} Multi.tem -mv Makefile.tem ${Makefile} - -fi # ${ml_toplevel_p} = yes - -if [ "${ml_verbose}" = --verbose ]; then - echo "Adding multilib support to ${Makefile} in ${ml_realsrcdir}" - if [ "${ml_toplevel_p}" = yes ]; then - echo "multidirs=${multidirs}" - fi - echo "with_multisubdir=${with_multisubdir}" -fi - -if [ "${srcdir}" = "." ]; then - if [ "${with_target_subdir}" != "." ]; then - ml_srcdotdot="../" - else - ml_srcdotdot="" - fi -else - ml_srcdotdot="" -fi - -if [ -z "${with_multisubdir}" ]; then - ml_subdir= - ml_builddotdot= - : # ml_srcdotdot= # already set -else - ml_subdir="/${with_multisubdir}" - # The '[^/][^/]*' appears that way to work around a SunOS sed bug. - ml_builddotdot=`echo ${with_multisubdir} | sed -e 's:[^/][^/]*:..:g'`/ - if [ "$srcdir" = "." ]; then - ml_srcdotdot=${ml_srcdotdot}${ml_builddotdot} - else - : # ml_srcdotdot= # already set - fi -fi - -if [ "${ml_toplevel_p}" = yes ]; then - ml_do='$(MAKE)' - ml_clean='$(MAKE)' -else - ml_do=true - ml_clean=true -fi - -# TOP is used by newlib and should not be used elsewhere for this purpose. -# MULTI{SRC,BUILD}TOP are the proper ones to use. MULTISRCTOP is empty -# when srcdir != builddir. MULTIBUILDTOP is always some number of ../'s. -# FIXME: newlib needs to be updated to use MULTI{SRC,BUILD}TOP so we can -# delete TOP. Newlib may wish to continue to use TOP for its own purposes -# of course. -# MULTIDIRS is non-empty for the cpu top level Makefile (eg: newlib/Makefile) -# and lists the subdirectories to recurse into. -# MULTISUBDIR is non-empty in each cpu subdirectory's Makefile -# (eg: newlib/h8300h/Makefile) and is the installed subdirectory name with -# a leading '/'. -# MULTIDO is used for targets like all, install, and check where -# $(FLAGS_TO_PASS) augmented with the subdir's compiler option is needed. -# MULTICLEAN is used for the *clean targets. -# -# ??? It is possible to merge MULTIDO and MULTICLEAN into one. They are -# currently kept separate because we don't want the *clean targets to require -# the existence of the compiler (which MULTIDO currently requires) and -# therefore we'd have to record the directory options as well as names -# (currently we just record the names and use --print-multi-lib to get the -# options). - -sed -e "s:^TOP[ ]*=[ ]*\([./]*\)[ ]*$:TOP = ${ml_builddotdot}\1:" \ - -e "s:^MULTISRCTOP[ ]*=.*$:MULTISRCTOP = ${ml_srcdotdot}:" \ - -e "s:^MULTIBUILDTOP[ ]*=.*$:MULTIBUILDTOP = ${ml_builddotdot}:" \ - -e "s:^MULTIDIRS[ ]*=.*$:MULTIDIRS = ${multidirs}:" \ - -e "s:^MULTISUBDIR[ ]*=.*$:MULTISUBDIR = ${ml_subdir}:" \ - -e "s:^MULTIDO[ ]*=.*$:MULTIDO = $ml_do:" \ - -e "s:^MULTICLEAN[ ]*=.*$:MULTICLEAN = $ml_clean:" \ - ${Makefile} > Makefile.tem -rm -f ${Makefile} -mv Makefile.tem ${Makefile} - -# If this is the library's top level, configure each multilib subdir. -# This is done at the end because this is the loop that runs configure -# in each multilib subdir and it seemed reasonable to finish updating the -# Makefile before going on to configure the subdirs. - -if [ "${ml_toplevel_p}" = yes ]; then - -# We must freshly configure each subdirectory. This bit of code is -# actually partially stolen from the main configure script. FIXME. - -if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then - - if [ "${ml_verbose}" = --verbose ]; then - echo "Running configure in multilib subdirs ${multidirs}" - echo "pwd: `${PWDCMD-pwd}`" - fi - - ml_origdir=`${PWDCMD-pwd}` - ml_libdir=`echo "$ml_origdir" | sed -e 's,^.*/,,'` - # cd to top-level-build-dir/${with_target_subdir} - cd .. - - for ml_dir in ${multidirs}; do - - if [ "${ml_verbose}" = --verbose ]; then - echo "Running configure in multilib subdir ${ml_dir}" - echo "pwd: `${PWDCMD-pwd}`" - fi - - if [ -d ${ml_dir} ]; then true; else - # ``mkdir -p ${ml_dir}'' See also mkinstalldirs. - pathcomp="" - for d in `echo ":${ml_dir}" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? - fi - if test ! -d "$pathcomp"; then - exit $lasterr - fi - pathcomp="$pathcomp/" - done - fi - if [ -d ${ml_dir}/${ml_libdir} ]; then true; else mkdir ${ml_dir}/${ml_libdir}; fi - - # Eg: if ${ml_dir} = m68000/m68881, dotdot = ../../ - dotdot=../`echo ${ml_dir} | sed -e 's|[^/]||g' -e 's|/|../|g'` - - case ${srcdir} in - ".") - echo "Building symlink tree in `${PWDCMD-pwd}`/${ml_dir}/${ml_libdir}" - if [ "${with_target_subdir}" != "." ]; then - ml_unsubdir="../" - else - ml_unsubdir="" - fi - (cd ${ml_dir}/${ml_libdir}; - ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "") - if [ -f ${ml_dir}/${ml_libdir}/${Makefile} ]; then - if [ x"${MAKE}" = x ]; then - (cd ${ml_dir}/${ml_libdir}; make distclean) - else - (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean) - fi - fi - ml_newsrcdir="." - ml_srcdiroption= - multisrctop=${dotdot} - ;; - *) - case "${srcdir}" in - /* | [A-Za-z]:[\\/]* ) # absolute path - ml_newsrcdir=${srcdir} - ;; - *) # otherwise relative - ml_newsrcdir=${dotdot}${srcdir} - ;; - esac - ml_srcdiroption="-srcdir=${ml_newsrcdir}" - multisrctop= - ;; - esac - - case "${progname}" in - /* | [A-Za-z]:[\\/]* ) ml_recprog=${progname} ;; - *) ml_recprog=${dotdot}${progname} ;; - esac - - # FIXME: POPDIR=${PWD=`pwd`} doesn't work here. - ML_POPDIR=`${PWDCMD-pwd}` - cd ${ml_dir}/${ml_libdir} - - if [ -f ${ml_newsrcdir}/configure ]; then - ml_recprog="${ml_newsrcdir}/configure" - fi - - # find compiler flag corresponding to ${ml_dir} - for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do - dir=`echo $i | sed -e 's/;.*$//'` - if [ "${dir}" = "${ml_dir}" ]; then - flags=`echo $i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'` - break - fi - done - ml_config_env='CC="${CC_}$flags" CXX="${CXX_}$flags" F77="${F77_}$flags" GCJ="${GCJ_}$flags" GFORTRAN="${GFORTRAN_}$flags" GOC="${GOC_}$flags"' - - if [ "${with_target_subdir}" = "." ]; then - CC_=$CC' ' - CXX_=$CXX' ' - F77_=$F77' ' - GCJ_=$GCJ' ' - GFORTRAN_=$GFORTRAN' ' - GOC_=$GOC' ' - else - # Create a regular expression that matches any string as long - # as ML_POPDIR. - popdir_rx=`echo "${ML_POPDIR}" | sed 's,.,.,g'` - CC_= - for arg in ${CC}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\1/p"`' ' ;; - "${ML_POPDIR}"/*) - CC_="${CC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - CC_="${CC_}${arg} " ;; - esac - done - - CXX_= - for arg in ${CXX}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - CXX_="${CXX_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - CXX_="${CXX_}${arg} " ;; - esac - done - - F77_= - for arg in ${F77}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - F77_="${F77_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - F77_="${F77_}${arg} " ;; - esac - done - - GCJ_= - for arg in ${GCJ}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - GCJ_="${GCJ_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - GCJ_="${GCJ_}${arg} " ;; - esac - done - - GFORTRAN_= - for arg in ${GFORTRAN}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - GFORTRAN_="${GFORTRAN_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - GFORTRAN_="${GFORTRAN_}${arg} " ;; - esac - done - - GOC_= - for arg in ${GOC}; do - case $arg in - -[BIL]"${ML_POPDIR}"/*) - GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(-[BIL]${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X-[BIL]${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - "${ML_POPDIR}"/*) - GOC_="${GOC_}"`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"`' ' ;; - *) - GOC_="${GOC_}${arg} " ;; - esac - done - - if test "x${LD_LIBRARY_PATH+set}" = xset; then - LD_LIBRARY_PATH_= - for arg in `echo "$LD_LIBRARY_PATH" | tr ':' ' '`; do - case "$arg" in - "${ML_POPDIR}"/*) - arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` - ;; - esac - if test "x$LD_LIBRARY_PATH_" != x; then - LD_LIBRARY_PATH_=$LD_LIBRARY_PATH_:$arg - else - LD_LIBRARY_PATH_=$arg - fi - done - ml_config_env="$ml_config_env LD_LIBRARY_PATH=$LD_LIBRARY_PATH_" - fi - - if test "x${SHLIB_PATH+set}" = xset; then - SHLIB_PATH_= - for arg in `echo "$SHLIB_PATH" | tr ':' ' '`; do - case "$arg" in - "${ML_POPDIR}"/*) - arg=`echo "X${arg}" | sed -n "s/X\\(${popdir_rx}\\).*/\\1/p"`/${ml_dir}`echo "X${arg}" | sed -n "s/X${popdir_rx}\\(.*\\)/\\1/p"` - ;; - esac - if test "x$SHLIB_PATH_" != x; then - SHLIB_PATH_=$SHLIB_PATH_:$arg - else - SHLIB_PATH_=$arg - fi - done - ml_config_env="$ml_config_env SHLIB_PATH=$SHLIB_PATH_" - fi - fi - - if eval ${ml_config_env} ${ml_config_shell} ${ml_recprog} \ - --with-multisubdir=${ml_dir} --with-multisrctop=${multisrctop} \ - "${ac_configure_args}" ${ml_config_env} ${ml_srcdiroption} ; then - true - else - exit 1 - fi - - cd "${ML_POPDIR}" - - done - - cd "${ml_origdir}" -fi - -fi # ${ml_toplevel_p} = yes -fi # ${enable_multilib} = yes diff --git a/llgo/third_party/gofrontend/config.guess b/llgo/third_party/gofrontend/config.guess deleted file mode 100755 index 8bf4226db321efae603071adffc229413db7bb44..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/config.guess +++ /dev/null @@ -1,1532 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-08-20' - -# This file 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. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64*:Linux:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) # Haiku running on x86_64. - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -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` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/llgo/third_party/gofrontend/config.sub b/llgo/third_party/gofrontend/config.sub deleted file mode 100755 index 2583c901235ab0b80de890be89e33ce1c5d9e32e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/config.sub +++ /dev/null @@ -1,1770 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-11-02' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | aarch64 | aarch64_be \ - | be32 | be64 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | hexagon \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | aarch64-* | aarch64_be-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hexagon-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -bitrig*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -ps4) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/llgo/third_party/gofrontend/depcomp b/llgo/third_party/gofrontend/depcomp deleted file mode 100644 index 4e70ff0bbcfa0af15376b94f83b72cdfd3ab3c02..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/depcomp +++ /dev/null @@ -1,756 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2013-05-30.07; # UTC - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by 'PROGRAMS ARGS'. - object Object file output by 'PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputting dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - -# A tabulation character. -tab=' ' -# A newline character. -nl=' -' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Avoid interferences from the environment. -gccflag= dashmflag= - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -cygpath_u="cygpath -u -f -" -if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp -fi - -if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 -fi - -if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the "deleted header file" problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. -## Some versions of gcc put a space before the ':'. On the theory -## that the space means something, we add a space to the output as -## well. hp depmode also adds that space, but also prefixes the VPATH -## to the object. Take care to not repeat it in the output. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -xlc) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts '$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.u - tmpdepfile2=$base.u - tmpdepfile3=$dir.libs/$base.u - "$@" -Wc,-M - else - tmpdepfile1=$dir$base.u - tmpdepfile2=$dir$base.u - tmpdepfile3=$dir$base.u - "$@" -M - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" - rm -f "$tmpdepfile" - ;; - -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" - # Add 'dependent.h:' lines. - sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" - else - make_dummy_depfile - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" - - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; - -msvc7) - if test "$libtool" = yes; then - showIncludes=-Wc,-showIncludes - else - showIncludes=-showIncludes - fi - "$@" $showIncludes > "$tmpdepfile" - stat=$? - grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - # The first sed program below extracts the file names and escapes - # backslashes for cygpath. The second sed program outputs the file - # name when reading, but also accumulates all include files in the - # hold buffer in order to output them again at the end. This only - # works with sed implementations that can handle large buffers. - sed < "$tmpdepfile" -n ' -/^Note: including file: *\(.*\)/ { - s//\1/ - s/\\/\\\\/g - p -}' | $cygpath_u | sort -u | sed -n ' -s/ /\\ /g -s/\(.*\)/'"$tab"'\1 \\/p -s/.\(.*\) \\/\1:/ -H -$ { - s/.*/'"$tab"'/ - G - p -}' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash - rm -f "$tmpdepfile" - ;; - -msvc7msys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for ':' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. - "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no eat=no - for arg - do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - if test $eat = yes; then - eat=no - continue - fi - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -arch) - eat=yes ;; - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix=`echo "$object" | sed 's/^.*\././'` - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - # makedepend may prepend the VPATH from the source file name to the object. - # No need to regex-escape $object, excess matching of '.' is harmless. - sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - # Remove '-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test "X$1" != 'X--mode=compile'; do - shift - done - shift - fi - - IFS=" " - for arg - do - case "$arg" in - -o) - shift - ;; - $object) - shift - ;; - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E 2>/dev/null | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" - echo "$tab" >> "$depfile" - sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvcmsys) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/llgo/third_party/gofrontend/include/dwarf2.def b/llgo/third_party/gofrontend/include/dwarf2.def deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/llgo/third_party/gofrontend/include/dwarf2.h b/llgo/third_party/gofrontend/include/dwarf2.h deleted file mode 100644 index 9824fc079d5ef4cecb069cd82fe16910fce2f5ae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/include/dwarf2.h +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------- dwarf2.h -------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// DWARF constants. Derived from: -// - libcxxabi/src/Unwind/dwarf2.h -// - DWARF 4 specification -// -//===----------------------------------------------------------------------===// - -#ifndef DWARF2_H -#define DWARF2_H - -enum dwarf_attribute { - DW_AT_name = 0x03, - DW_AT_stmt_list = 0x10, - DW_AT_low_pc = 0x11, - DW_AT_high_pc = 0x12, - DW_AT_comp_dir = 0x1b, - DW_AT_abstract_origin = 0x31, - DW_AT_specification = 0x47, - DW_AT_ranges = 0x55, - DW_AT_call_file = 0x58, - DW_AT_call_line = 0x59, - DW_AT_linkage_name = 0x6e, - DW_AT_MIPS_linkage_name = 0x2007 -}; - -enum dwarf_form { - DW_FORM_addr = 0x01, - DW_FORM_block2 = 0x03, - DW_FORM_block4 = 0x04, - DW_FORM_data2 = 0x05, - DW_FORM_data4 = 0x06, - DW_FORM_data8 = 0x07, - DW_FORM_string = 0x08, - DW_FORM_block = 0x09, - DW_FORM_block1 = 0x0a, - DW_FORM_data1 = 0x0b, - DW_FORM_flag = 0x0c, - DW_FORM_sdata = 0x0d, - DW_FORM_strp = 0x0e, - DW_FORM_udata = 0x0f, - DW_FORM_ref_addr = 0x10, - DW_FORM_ref1 = 0x11, - DW_FORM_ref2 = 0x12, - DW_FORM_ref4 = 0x13, - DW_FORM_ref8 = 0x14, - DW_FORM_ref_udata = 0x15, - DW_FORM_indirect = 0x16, - DW_FORM_sec_offset = 0x17, - DW_FORM_exprloc = 0x18, - DW_FORM_flag_present = 0x19, - DW_FORM_ref_sig8 = 0x20, - DW_FORM_GNU_addr_index = 0x1f01, - DW_FORM_GNU_str_index = 0x1f02, - DW_FORM_GNU_ref_alt = 0x1f20, - DW_FORM_GNU_strp_alt = 0x1f21 -}; - -enum dwarf_tag { - DW_TAG_entry_point = 0x03, - DW_TAG_compile_unit = 0x11, - DW_TAG_inlined_subroutine = 0x1d, - DW_TAG_subprogram = 0x2e -}; - -enum dwarf_lns { - DW_LNS_extended_op = 0x00, - DW_LNS_copy = 0x01, - DW_LNS_advance_pc = 0x02, - DW_LNS_advance_line = 0x03, - DW_LNS_set_file = 0x04, - DW_LNS_set_column = 0x05, - DW_LNS_negate_stmt = 0x06, - DW_LNS_set_basic_block = 0x07, - DW_LNS_const_add_pc = 0x08, - DW_LNS_fixed_advance_pc = 0x09, - DW_LNS_set_prologue_end = 0x0a, - DW_LNS_set_epilogue_begin = 0x0b, - DW_LNS_set_isa = 0x0c -}; - -enum dwarf_lne { - DW_LNE_end_sequence = 0x01, - DW_LNE_set_address = 0x02, - DW_LNE_define_file = 0x03, - DW_LNE_set_discriminator = 0x04 -}; - -#endif // DWARF2_H diff --git a/llgo/third_party/gofrontend/include/filenames.h b/llgo/third_party/gofrontend/include/filenames.h deleted file mode 100644 index 005b302159e3e643187c1b0a7e557e80eef07016..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/include/filenames.h +++ /dev/null @@ -1,14 +0,0 @@ -//===----------------------------- filenames.h ----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef FILENAMES_H -#define FILENAMES_H - -#define IS_ABSOLUTE_PATH(path) ((path)[0] == '/') - -#endif diff --git a/llgo/third_party/gofrontend/install-sh b/llgo/third_party/gofrontend/install-sh deleted file mode 100644 index 0b0fdcbba69ab6dd05ca162a5328828d46ab1d54..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/install-sh +++ /dev/null @@ -1,501 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2013-12-25.23; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/llgo/third_party/gofrontend/libbacktrace/ChangeLog b/llgo/third_party/gofrontend/libbacktrace/ChangeLog deleted file mode 100644 index 1e70595f2feb67680db6540826e3f1cfcb84f1de..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/ChangeLog +++ /dev/null @@ -1,456 +0,0 @@ -2015-01-05 Jakub Jelinek - - Update copyright years. - -2014-11-21 H.J. Lu - - PR bootstrap/63784 - * configure: Regenerated. - -2014-11-11 David Malcolm - - * ChangeLog.jit: New. - -2014-11-11 Francois-Xavier Coudert - - PR target/63610 - * configure: Regenerate. - -2014-10-23 Ian Lance Taylor - - * internal.h (backtrace_atomic_load_pointer) [no atomic or sync]: - Fix to return void *. - -2014-05-08 Ian Lance Taylor - - * mmap.c (backtrace_free): If freeing a large aligned block of - memory, call munmap rather than holding onto it. - (backtrace_vector_grow): When growing a vector, double the number - of pages requested. When releasing the old version of a grown - vector, pass the correct size to backtrace_free. - -2014-03-07 Ian Lance Taylor - - * sort.c (backtrace_qsort): Use middle element as pivot. - -2014-03-06 Ian Lance Taylor - - * sort.c: New file. - * stest.c: New file. - * internal.h (backtrace_qsort): Declare. - * dwarf.c (read_abbrevs): Call backtrace_qsort instead of qsort. - (read_line_info, read_function_entry): Likewise. - (read_function_info, build_dwarf_data): Likewise. - * elf.c (elf_initialize_syminfo): Likewise. - * Makefile.am (libbacktrace_la_SOURCES): Add sort.c. - (stest_SOURCES, stest_LDADD): Define. - (check_PROGRAMS): Add stest. - -2014-02-07 Misty De Meo - - PR target/58710 - * configure.ac: Use AC_LINK_IFELSE in check for - _Unwind_GetIPInfo. - * configure: Regenerate. - -2014-01-02 Richard Sandiford - - Update copyright years - -2013-12-06 Jakub Jelinek - - * elf.c (ET_DYN): Undefine and define again. - (elf_add): Add exe argument, if true and ehdr.e_type is ET_DYN, - return early -1 without closing the descriptor. - (struct phdr_data): Add exe_descriptor. - (phdr_callback): If pd->exe_descriptor is not -1, for very first - call if dlpi_name is NULL just call elf_add with the exe_descriptor, - otherwise backtrace_close the exe_descriptor if not -1. Adjust - call to elf_add. - (backtrace_initialize): Adjust call to elf_add. If it returns - -1, set pd.exe_descriptor to descriptor, otherwise set it to -1. - -2013-12-05 Ian Lance Taylor - - * alloc.c (backtrace_vector_finish): Add error_callback and data - parameters. Call backtrace_vector_release. Return address base. - * mmap.c (backtrace_vector_finish): Add error_callback and data - parameters. Return address base. - * dwarf.c (read_function_info): Get new address base from - backtrace_vector_finish. - * internal.h (backtrace_vector_finish): Update declaration. - -2013-11-27 Ian Lance Taylor - - * dwarf.c (find_address_ranges): New static function, broken out - of build_address_map. - (build_address_map): Call it. - * btest.c (check): Check for missing filename or function, rather - than crashing. - (f3): Check that enough frames were returned. - -2013-11-19 Jakub Jelinek - - * backtrace.h (backtrace_syminfo_callback): Add symsize argument. - * elf.c (elf_syminfo): Pass 0 or sym->size to the callback as - last argument. - * btest.c (struct symdata): Add size field. - (callback_three): Add symsize argument. Copy it to the data->size - field. - (f23): Set symdata.size to 0. - (test5): Likewise. If sizeof (int) > 1, lookup address of - ((uintptr_t) &global) + 1. Verify symdata.val and symdata.size - values. - - * atomic.c: Include sys/types.h. - -2013-11-18 Ian Lance Taylor - - * configure.ac: Check for support of __atomic extensions. - * internal.h: Declare or #define atomic functions for use in - backtrace code. - * atomic.c: New file. - * dwarf.c (dwarf_lookup_pc): Use atomic functions. - (dwarf_fileline, backtrace_dwarf_add): Likewise. - * elf.c (elf_add_syminfo_data, elf_syminfo): Likewise. - (backtrace_initialize): Likewise. - * fileline.c (fileline_initialize): Likewise. - * Makefile.am (libbacktrace_la_SOURCES): Add atomic.c. - * configure, config.h.in, Makefile.in: Rebuild. - -2013-11-18 Jakub Jelinek - - * elf.c (SHN_UNDEF): Define. - (elf_initialize_syminfo): Add base_address argument. Ignore symbols - with st_shndx == SHN_UNDEF. Add base_address to address fields. - (elf_add): Adjust caller. - - * elf.c (phdr_callback): Process info->dlpi_addr == 0 normally. - -2013-11-16 Ian Lance Taylor - - * backtrace.h (backtrace_create_state): Correct comment about - threading. - -2013-11-15 Ian Lance Taylor - - * backtrace.h (backtrace_syminfo): Update comment and parameter - name to take any address, not just a PC value. - * elf.c (STT_OBJECT): Define. - (elf_nosyms): Rename parameter pc to addr. - (elf_symbol_search): Rename local variable pc to addr. - (elf_initialize_syminfo): Add STT_OBJECT symbols to elf_symbols. - (elf_syminfo): Rename parameter pc to addr. - * btest.c (global): New global variable. - (test5): New test. - (main): Call test5. - -2013-10-17 Ian Lance Taylor - - * elf.c (elf_add): Don't get the wrong offsets if a debug section - is missing. - -2013-10-15 David Malcolm - - * configure.ac: Add --enable-host-shared, setting up - pre-existing PIC_FLAG variable within Makefile.am et al. - * configure: Regenerate. - -2013-09-20 Alan Modra - - * configure: Regenerate. - -2013-07-23 Alexander Monakov - - * elf.c (elf_syminfo): Loop over the elf_syminfo_data chain. - -2013-07-23 Alexander Monakov - - * elf.c (backtrace_initialize): Pass elf_fileline_fn to - dl_iterate_phdr callbacks. - -2013-03-25 Ian Lance Taylor - - * alloc.c: #include . - * mmap.c: Likewise. - -2013-01-31 Ian Lance Taylor - - * dwarf.c (read_function_info): Permit fvec parameter to be NULL. - (dwarf_lookup_pc): Don't use ddata->fvec if threaded. - -2013-01-25 Jakub Jelinek - - PR other/56076 - * dwarf.c (read_line_header): Don't crash if DW_AT_comp_dir - attribute was not seen. - -2013-01-16 Ian Lance Taylor - - * dwarf.c (struct unit): Add filename and abs_filename fields. - (build_address_map): Set new fields when reading unit. - (dwarf_lookup_pc): If we don't find an entry in the line table, - just return the main file name. - -2013-01-14 Richard Sandiford - - Update copyright years. - -2013-01-01 Ian Lance Taylor - - PR bootstrap/54834 - * Makefile.am (AM_CPPFLAGS): Remove -I ../gcc/include and -I - $(MULTIBUILDTOP)/../../gcc/include. - * Makefile.in: Rebuild. - -2013-01-01 Ian Lance Taylor - - PR other/55536 - * mmap.c (backtrace_alloc): Don't call sync functions if not - threaded. - (backtrace_free): Likewise. - -2012-12-12 John David Anglin - - * mmapio.c: Define MAP_FAILED if not defined. - -2012-12-11 Jakub Jelinek - - PR bootstrap/54926 - * Makefile.am (AM_CFLAGS): Remove -frandom-seed=$@. - * configure.ac: If --with-target-subdir, add -frandom-seed=$@ - to EXTRA_FLAGS unconditionally, otherwise check whether the compiler - accepts it. - * Makefile.in: Regenerated. - * configure: Regenerated. - -2012-12-07 Jakub Jelinek - - PR bootstrap/54926 - * Makefile.am (AM_CFLAGS): Add -frandom-seed=$@. - * Makefile.in: Regenerated. - -2012-11-20 Ian Lance Taylor - - * dwarf.c (read_attribute): Always clear val. - -2012-11-13 Ian Lance Taylor - - PR other/55312 - * configure.ac: Only add -Werror if building a target library. - * configure: Rebuild. - -2012-11-12 Ian Lance Taylor - Rainer Orth - Gerald Pfeifer - - * configure.ac: Check for getexecname. - * fileline.c: #include . Define getexecname if not - available. - (fileline_initialize): Try to find the executable in a few - different ways. - * print.c (error_callback): Only print the filename if it came - from the backtrace state. - * configure, config.h.in: Rebuild. - -2012-10-29 Ian Lance Taylor - - * mmap.c (backtrace_vector_release): Correct last patch: add - aligned, not size. - -2012-10-29 Ian Lance Taylor - - * mmap.c (backtrace_vector_release): Make sure freed block is - aligned on 8-byte boundary. - -2012-10-26 Ian Lance Taylor - - PR other/55087 - * posix.c (backtrace_open): Add does_not_exist parameter. - * elf.c (phdr_callback): Do not warn if shared library could not - be opened. - * fileline.c (fileline_initialize): Update calls to - backtrace_open. - * internal.h (backtrace_open): Update declaration. - -2012-10-26 Jack Howarth - - PR target/55061 - * configure.ac: Check for _Unwind_GetIPInfo function declaration. - * configure: Regenerate. - -2012-10-24 Ian Lance Taylor - - PR target/55061 - * configure.ac: Check whether -funwind-tables option works. - * configure: Rebuild. - -2012-10-11 Ian Lance Taylor - - * configure.ac: Do not use dl_iterate_phdr on Solaris 10. - * configure: Rebuild. - -2012-10-10 Ian Lance Taylor - - * elf.c: Rename all Elf typedefs to start with b_elf, and be all - lower case. - -2012-10-10 Hans-Peter Nilsson - - * elf.c (elf_add_syminfo_data): Add casts to avoid warning. - -2012-10-09 Ian Lance Taylor - - * dwarf.c (dwarf_fileline): Add cast to avoid warning. - (backtrace_dwarf_add): Likewise. - -2012-10-09 Ian Lance Taylor - - Add support for tracing through shared libraries. - * configure.ac: Check for link.h and dl_iterate_phdr. - * elf.c: #include if system has dl_iterate_phdr. #undef - ELF macros before #defining them. - (dl_phdr_info, dl_iterate_phdr): Define if system does not have - dl_iterate_phdr. - (struct elf_syminfo_data): Add next field. - (elf_initialize_syminfo): Initialize next field. - (elf_add_syminfo_data): New static function. - (elf_add): New static function, broken out of - backtrace_initialize. Call backtrace_dwarf_add instead of - backtrace_dwarf_initialize. - (struct phdr_data): Define. - (phdr_callback): New static function. - (backtrace_initialize): Call elf_add. - * dwarf.c (struct dwarf_data): Add next and base_address fields. - (add_unit_addr): Add base_address parameter. Change all callers. - (add_unit_ranges, build_address_map): Likewise. - (add_line): Add ddata parameter. Change all callers. - (read_line_program, add_function_range): Likewise. - (dwarf_lookup_pc): New static function, broken out of - dwarf_fileline. - (dwarf_fileline): Call dwarf_lookup_pc. - (build_dwarf_data): New static function. - (backtrace_dwarf_add): New function. - (backtrace_dwarf_initialize): Remove. - * internal.h (backtrace_dwarf_initialize): Don't declare. - (backtrace_dwarf_add): Declare. - * configure, config.h.in: Rebuild. - -2012-10-04 Gerald Pfeifer - - * btest.c (f23): Avoid uninitialized variable warning. - -2012-10-04 Ian Lance Taylor - - * dwarf.c: If the system header files do not declare strnlen, - provide our own version. - -2012-10-03 Ian Lance Taylor - - * dwarf.c (read_uleb128): Fix overflow test. - (read_sleb128): Likewise. - (build_address_map): Don't change unit_buf.start. - -2012-10-02 Uros Bizjak - - PR other/54761 - * configure.ac (EXTRA_FLAGS): New. - * Makefile.am (AM_FLAGS): Add $(EXTRA_FLAGS). - * configure, Makefile.in: Regenerate. - -2012-09-29 Ian Lance Taylor - - PR other/54749 - * fileline.c (fileline_initialize): Pass errnum as -1 when - reporting that we could not read executable information after a - previous failure. - -2012-09-27 Ian Lance Taylor - - PR bootstrap/54732 - * configure.ac: Add no-dependencies to AM_INIT_AUTOMAKE. - * Makefile.am: Add dependencies for all objects. - * configure, aclocal.m4, Makefile.in: Rebuild. - -2012-09-27 Ian Lance Taylor - - PR other/54726 - * elf.c (backtrace_initialize): Set *fileln_fn, not - state->fileln_fn. - -2012-09-19 Ian Lance Taylor - - * configure.ac: Only use GCC_CHECK_UNWIND_GETIPINFO when compiled - as a target library. - * configure: Rebuild. - -2012-09-19 Rainer Orth - Ian Lance Taylor - - * configure.ac (GCC_HEADER_STDINT): Invoke. - * backtrace.h: If we can't find , use "gstdint.h". - * btest.c: Don't include . - * dwarf.c: Likewise. - * configure, aclocal.m4, Makefile.in, config.h.in: Rebuild. - -2012-09-18 Ian Lance Taylor - - PR bootstrap/54623 - * Makefile.am (AM_CPPFLAGS): Define. - (AM_CFLAGS): Remove -I options. - * Makefile.in: Rebuild. - -2012-09-18 Ian Lance Taylor - - * posix.c (O_BINARY): Define if not defined. - (backtrace_open): Pass O_BINARY to open. Only call fcntl if - HAVE_FCNTL is defined. - * configure.ac: Test for the fcntl function. - * configure, config.h.in: Rebuild. - -2012-09-18 Ian Lance Taylor - - * btest.c (test1, test2, test3, test4): Add the unused attribute. - -2012-09-18 Ian Lance Taylor - - * dwarf.c: Correct test of HAVE_DECL_STRNLEN. - -2012-09-18 Ian Lance Taylor - - * configure.ac: Add AC_USE_SYSTEM_EXTENSIONS. - * mmapio.c: Don't define _GNU_SOURCE. - * configure, config.h.in: Rebuild. - -2012-09-18 Ian Lance Taylor - - * configure.ac: Check whether strnlen is declared. - * dwarf.c: Declare strnlen if not declared. - * configure, config.h.in: Rebuild. - -2012-09-18 Rainer Orth - - * fileline.c: Include . - * mmap.c: Likewise. - -2012-09-17 Ian Lance Taylor - - PR bootstrap/54611 - * nounwind.c (backtrace_full): Rename from backtrace. Add state - parameter. - -2012-09-17 Gerald Pfeifer - - PR bootstrap/54611 - * nounwind.c (backtrace_simple): Add state parameter. - -2012-09-17 Ian Lance Taylor - - PR bootstrap/54609 - * unknown.c (unknown_fileline): Add state parameter, remove - fileline_data parameter, name error_callback parameter. - (backtrace_initialize): Add state parameter. - -2012-09-17 Ian Lance Taylor - - * Initial implementation. diff --git a/llgo/third_party/gofrontend/libbacktrace/ChangeLog.jit b/llgo/third_party/gofrontend/libbacktrace/ChangeLog.jit deleted file mode 100644 index 6b60e3b3b07382a48c7ffbaf992876426234bdee..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/ChangeLog.jit +++ /dev/null @@ -1,14 +0,0 @@ -2014-09-24 David Malcolm - - * ChangeLog.jit: Add copyright footer. - -2013-10-03 David Malcolm - - * configure.ac: Add --enable-host-shared. - * configure: Regenerate. - -Copyright (C) 2013-2014 Free Software Foundation, Inc. - -Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. diff --git a/llgo/third_party/gofrontend/libbacktrace/Makefile.am b/llgo/third_party/gofrontend/libbacktrace/Makefile.am deleted file mode 100644 index a93b82a91b133a508cddd427c10268f66a772121..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/Makefile.am +++ /dev/null @@ -1,132 +0,0 @@ -# Makefile.am -- Backtrace Makefile. -# Copyright (C) 2012-2015 Free Software Foundation, Inc. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: - -# (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. - -# (2) 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. - -# (3) The name of the author may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - -ACLOCAL_AMFLAGS = -I .. -I ../config - -AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \ - -I ../libgcc - -AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) - -noinst_LTLIBRARIES = libbacktrace.la - -libbacktrace_la_SOURCES = \ - backtrace.h \ - atomic.c \ - dwarf.c \ - fileline.c \ - internal.h \ - posix.c \ - print.c \ - sort.c \ - state.c - -BACKTRACE_FILES = \ - backtrace.c \ - simple.c \ - nounwind.c - -FORMAT_FILES = \ - elf.c \ - unknown.c - -VIEW_FILES = \ - read.c \ - mmapio.c - -ALLOC_FILES = \ - alloc.c \ - mmap.c - -EXTRA_libbacktrace_la_SOURCES = \ - $(BACKTRACE_FILES) \ - $(FORMAT_FILES) \ - $(VIEW_FILES) \ - $(ALLOC_FILES) - -libbacktrace_la_LIBADD = \ - $(BACKTRACE_FILE) \ - $(FORMAT_FILE) \ - $(VIEW_FILE) \ - $(ALLOC_FILE) - -libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) - -# Testsuite. - -check_PROGRAMS = - -TESTS = $(check_PROGRAMS) - -if NATIVE - -btest_SOURCES = btest.c -btest_CFLAGS = $(AM_CFLAGS) -g -O -btest_LDADD = libbacktrace.la - -check_PROGRAMS += btest - -stest_SOURCES = stest.c -stest_LDADD = libbacktrace.la - -check_PROGRAMS += stest - -endif NATIVE - -# We can't use automake's automatic dependency tracking, because it -# breaks when using bootstrap-lean. Automatic dependency tracking -# with GCC bootstrap will cause some of the objects to depend on -# header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When -# using bootstrap-lean, prev-gcc is removed after each stage. When -# running "make install", those header files will be gone, causing the -# library to be rebuilt at install time. That may not succeed. - -# These manual dependencies do not include dependencies on unwind.h, -# even though that is part of GCC, because where to find it depends on -# whether we are being built as a host library or a target library. - -INCDIR = $(top_srcdir)/../include -alloc.lo: config.h backtrace.h internal.h -backtrace.lo: config.h backtrace.h -btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h -dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ - $(INCDIR)/filenames.h backtrace.h internal.h -elf.lo: config.h backtrace.h internal.h -fileline.lo: config.h backtrace.h internal.h -mmap.lo: config.h backtrace.h internal.h -mmapio.lo: config.h backtrace.h internal.h -nounwind.lo: config.h internal.h -posix.lo: config.h backtrace.h internal.h -print.lo: config.h backtrace.h internal.h -read.lo: config.h backtrace.h internal.h -simple.lo: config.h backtrace.h internal.h -state.lo: config.h backtrace.h backtrace-supported.h internal.h -unknown.lo: config.h backtrace.h internal.h diff --git a/llgo/third_party/gofrontend/libbacktrace/Makefile.in b/llgo/third_party/gofrontend/libbacktrace/Makefile.in deleted file mode 100644 index f2821fc15262f90749ad545bae0800698f23d0e3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/Makefile.in +++ /dev/null @@ -1,739 +0,0 @@ -# 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@ - -# Makefile.am -- Backtrace Makefile. -# Copyright (C) 2012-2014 Free Software Foundation, Inc. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: - -# (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. - -# (2) 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. - -# (3) The name of the author may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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@ -check_PROGRAMS = $(am__EXEEXT_1) -@NATIVE_TRUE@am__append_1 = btest stest -subdir = . -DIST_COMMON = README ChangeLog $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(srcdir)/config.h.in \ - $(srcdir)/../mkinstalldirs $(srcdir)/backtrace-supported.h.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/lead-dot.m4 \ - $(top_srcdir)/../config/multi.m4 \ - $(top_srcdir)/../config/override.m4 \ - $(top_srcdir)/../config/stdint.m4 \ - $(top_srcdir)/../config/unwind_ipinfo.m4 \ - $(top_srcdir)/../config/warnings.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_HEADER = config.h -CONFIG_CLEAN_FILES = backtrace-supported.h -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -am__DEPENDENCIES_1 = -am_libbacktrace_la_OBJECTS = atomic.lo dwarf.lo fileline.lo posix.lo \ - print.lo sort.lo state.lo -libbacktrace_la_OBJECTS = $(am_libbacktrace_la_OBJECTS) -@NATIVE_TRUE@am__EXEEXT_1 = btest$(EXEEXT) stest$(EXEEXT) -@NATIVE_TRUE@am_btest_OBJECTS = btest-btest.$(OBJEXT) -btest_OBJECTS = $(am_btest_OBJECTS) -@NATIVE_TRUE@btest_DEPENDENCIES = libbacktrace.la -btest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(btest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -@NATIVE_TRUE@am_stest_OBJECTS = stest.$(OBJEXT) -stest_OBJECTS = $(am_stest_OBJECTS) -@NATIVE_TRUE@stest_DEPENDENCIES = libbacktrace.la -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libbacktrace_la_SOURCES) $(EXTRA_libbacktrace_la_SOURCES) \ - $(btest_SOURCES) $(stest_SOURCES) -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true -ETAGS = etags -CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= -ACLOCAL = @ACLOCAL@ -ALLOC_FILE = @ALLOC_FILE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BACKTRACE_FILE = @BACKTRACE_FILE@ -BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@ -BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@ -BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@ -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -EXTRA_FLAGS = @EXTRA_FLAGS@ -FGREP = @FGREP@ -FORMAT_FILE = @FORMAT_FILE@ -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@ -PIC_FLAG = @PIC_FLAG@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -VIEW_FILE = @VIEW_FILE@ -WARN_FLAGS = @WARN_FLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__leading_dot = @am__leading_dot@ -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@ -libtool_VERSION = @libtool_VERSION@ -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@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -ACLOCAL_AMFLAGS = -I .. -I ../config -AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \ - -I ../libgcc - -AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) -noinst_LTLIBRARIES = libbacktrace.la -libbacktrace_la_SOURCES = \ - backtrace.h \ - atomic.c \ - dwarf.c \ - fileline.c \ - internal.h \ - posix.c \ - print.c \ - sort.c \ - state.c - -BACKTRACE_FILES = \ - backtrace.c \ - simple.c \ - nounwind.c - -FORMAT_FILES = \ - elf.c \ - unknown.c - -VIEW_FILES = \ - read.c \ - mmapio.c - -ALLOC_FILES = \ - alloc.c \ - mmap.c - -EXTRA_libbacktrace_la_SOURCES = \ - $(BACKTRACE_FILES) \ - $(FORMAT_FILES) \ - $(VIEW_FILES) \ - $(ALLOC_FILES) - -libbacktrace_la_LIBADD = \ - $(BACKTRACE_FILE) \ - $(FORMAT_FILE) \ - $(VIEW_FILE) \ - $(ALLOC_FILE) - -libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) -TESTS = $(check_PROGRAMS) -@NATIVE_TRUE@btest_SOURCES = btest.c -@NATIVE_TRUE@btest_CFLAGS = $(AM_CFLAGS) -g -O -@NATIVE_TRUE@btest_LDADD = libbacktrace.la -@NATIVE_TRUE@stest_SOURCES = stest.c -@NATIVE_TRUE@stest_LDADD = libbacktrace.la - -# We can't use automake's automatic dependency tracking, because it -# breaks when using bootstrap-lean. Automatic dependency tracking -# with GCC bootstrap will cause some of the objects to depend on -# header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When -# using bootstrap-lean, prev-gcc is removed after each stage. When -# running "make install", those header files will be gone, causing the -# library to be rebuilt at install time. That may not succeed. - -# These manual dependencies do not include dependencies on unwind.h, -# even though that is part of GCC, because where to find it depends on -# whether we are being built as a host library or a target library. -INCDIR = $(top_srcdir)/../include -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .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 --ignore-deps'; \ - $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign --ignore-deps 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): - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -backtrace-supported.h: $(top_builddir)/config.status $(srcdir)/backtrace-supported.h.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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 -libbacktrace.la: $(libbacktrace_la_OBJECTS) $(libbacktrace_la_DEPENDENCIES) - $(LINK) $(libbacktrace_la_OBJECTS) $(libbacktrace_la_LIBADD) $(LIBS) - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -btest$(EXEEXT): $(btest_OBJECTS) $(btest_DEPENDENCIES) - @rm -f btest$(EXEEXT) - $(btest_LINK) $(btest_OBJECTS) $(btest_LDADD) $(LIBS) -stest$(EXEEXT): $(stest_OBJECTS) $(stest_DEPENDENCIES) - @rm -f stest$(EXEEXT) - $(LINK) $(stest_OBJECTS) $(stest_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -.c.o: - $(COMPILE) -c $< - -.c.obj: - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: - $(LTCOMPILE) -c -o $@ $< - -btest-btest.o: btest.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.o `test -f 'btest.c' || echo '$(srcdir)/'`btest.c - -btest-btest.obj: btest.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(btest_CFLAGS) $(CFLAGS) -c -o btest-btest.obj `if test -f 'btest.c'; then $(CYGPATH_W) 'btest.c'; else $(CYGPATH_W) '$(srcdir)/btest.c'; fi` - -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) - -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) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(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) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(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-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ - ;; \ - *) \ - col=$$grn; res=PASS; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ - xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ - fi; \ - echo "$${col}$$res$${std}: $$tst"; \ - done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ - else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ - else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - echo "$$grn$$dashes"; \ - else \ - echo "$$red$$dashes"; \ - fi; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes$$std"; \ - test "$$failed" -eq 0; \ - else :; fi -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(LTLIBRARIES) all-multi config.h -installdirs: -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-checkPROGRAMS clean-generic clean-libtool \ - clean-noinstLTLIBRARIES mostlyclean-am - -distclean: distclean-am distclean-multi - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-multi - -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 -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: - -.MAKE: all all-multi check-am 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-TESTS \ - check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ - clean-multi clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-hdr \ - 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-ps install-ps-am install-strip \ - 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 - -alloc.lo: config.h backtrace.h internal.h -backtrace.lo: config.h backtrace.h -btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h -dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ - $(INCDIR)/filenames.h backtrace.h internal.h -elf.lo: config.h backtrace.h internal.h -fileline.lo: config.h backtrace.h internal.h -mmap.lo: config.h backtrace.h internal.h -mmapio.lo: config.h backtrace.h internal.h -nounwind.lo: config.h internal.h -posix.lo: config.h backtrace.h internal.h -print.lo: config.h backtrace.h internal.h -read.lo: config.h backtrace.h internal.h -simple.lo: config.h backtrace.h internal.h -state.lo: config.h backtrace.h backtrace-supported.h internal.h -unknown.lo: config.h backtrace.h internal.h - -# 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/llgo/third_party/gofrontend/libbacktrace/README b/llgo/third_party/gofrontend/libbacktrace/README deleted file mode 100644 index e8b225745c9c639e67ea4f6fa0f97041ba978276..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/README +++ /dev/null @@ -1,23 +0,0 @@ -The libbacktrace library -Initially written by Ian Lance Taylor - -The libbacktrace library may be linked into a program or library and -used to produce symbolic backtraces. Sample uses would be to print a -detailed backtrace when an error occurs or to gather detailed -profiling information. - -The libbacktrace library is provided under a BSD license. See the -source files for the exact license text. - -The public functions are declared and documented in the header file -backtrace.h, which should be #include'd by a user of the library. - -Building libbacktrace will generate a file backtrace-supported.h, -which a user of the library may use to determine whether backtraces -will work. See the source file backtrace-supported.h.in for the -macros that it defines. - -As of September 2012, libbacktrace only supports ELF executables with -DWARF debugging information. The library is written to make it -straightforward to add support for other object file and debugging -formats. diff --git a/llgo/third_party/gofrontend/libbacktrace/aclocal.m4 b/llgo/third_party/gofrontend/libbacktrace/aclocal.m4 deleted file mode 100644 index 42214c2233ac87437820fa06383933884281d3c4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/aclocal.m4 +++ /dev/null @@ -1,667 +0,0 @@ -# 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])]) - -# 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]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 6 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([../config/lead-dot.m4]) -m4_include([../config/multi.m4]) -m4_include([../config/override.m4]) -m4_include([../config/stdint.m4]) -m4_include([../config/unwind_ipinfo.m4]) -m4_include([../config/warnings.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/llgo/third_party/gofrontend/libbacktrace/alloc.c b/llgo/third_party/gofrontend/libbacktrace/alloc.c deleted file mode 100644 index 143ef68ca5148943104b14eb40cc1f3fa8808f7a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/alloc.c +++ /dev/null @@ -1,152 +0,0 @@ -/* alloc.c -- Memory allocation without mmap. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* Allocation routines to use on systems that do not support anonymous - mmap. This implementation just uses malloc, which means that the - backtrace functions may not be safely invoked from a signal - handler. */ - -/* Allocate memory like malloc. */ - -void * -backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED, - size_t size, backtrace_error_callback error_callback, - void *data) -{ - void *ret; - - ret = malloc (size); - if (ret == NULL) - error_callback (data, "malloc", errno); - return ret; -} - -/* Free memory. */ - -void -backtrace_free (struct backtrace_state *state ATTRIBUTE_UNUSED, - void *p, size_t size ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - free (p); -} - -/* Grow VEC by SIZE bytes. */ - -void * -backtrace_vector_grow (struct backtrace_state *state ATTRIBUTE_UNUSED, - size_t size, backtrace_error_callback error_callback, - void *data, struct backtrace_vector *vec) -{ - void *ret; - - if (size > vec->alc) - { - size_t alc; - void *base; - - if (vec->size == 0) - alc = 32 * size; - else if (vec->size >= 4096) - alc = vec->size + 4096; - else - alc = 2 * vec->size; - - if (alc < vec->size + size) - alc = vec->size + size; - - base = realloc (vec->base, alc); - if (base == NULL) - { - error_callback (data, "realloc", errno); - return NULL; - } - - vec->base = base; - vec->alc = alc - vec->size; - } - - ret = (char *) vec->base + vec->size; - vec->size += size; - vec->alc -= size; - return ret; -} - -/* Finish the current allocation on VEC. */ - -void * -backtrace_vector_finish (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data) -{ - void *ret; - - /* With this allocator we call realloc in backtrace_vector_grow, - which means we can't easily reuse the memory here. So just - release it. */ - if (!backtrace_vector_release (state, vec, error_callback, data)) - return NULL; - ret = vec->base; - vec->base = NULL; - vec->size = 0; - vec->alc = 0; - return ret; -} - -/* Release any extra space allocated for VEC. */ - -int -backtrace_vector_release (struct backtrace_state *state ATTRIBUTE_UNUSED, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data) -{ - vec->base = realloc (vec->base, vec->size); - if (vec->base == NULL) - { - error_callback (data, "realloc", errno); - return 0; - } - vec->alc = 0; - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/atomic.c b/llgo/third_party/gofrontend/libbacktrace/atomic.c deleted file mode 100644 index fdd2490da7c6bdcd50e9e328e5ba495b11557e47..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/atomic.c +++ /dev/null @@ -1,113 +0,0 @@ -/* atomic.c -- Support for atomic functions if not present. - Copyright (C) 2013-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include - -#include "backtrace.h" -#include "backtrace-supported.h" -#include "internal.h" - -/* This file holds implementations of the atomic functions that are - used if the host compiler has the sync functions but not the atomic - functions, as is true of versions of GCC before 4.7. */ - -#if !defined (HAVE_ATOMIC_FUNCTIONS) && defined (HAVE_SYNC_FUNCTIONS) - -/* Do an atomic load of a pointer. */ - -void * -backtrace_atomic_load_pointer (void *arg) -{ - void **pp; - void *p; - - pp = (void **) arg; - p = *pp; - while (!__sync_bool_compare_and_swap (pp, p, p)) - p = *pp; - return p; -} - -/* Do an atomic load of an int. */ - -int -backtrace_atomic_load_int (int *p) -{ - int i; - - i = *p; - while (!__sync_bool_compare_and_swap (p, i, i)) - i = *p; - return i; -} - -/* Do an atomic store of a pointer. */ - -void -backtrace_atomic_store_pointer (void *arg, void *p) -{ - void **pp; - void *old; - - pp = (void **) arg; - old = *pp; - while (!__sync_bool_compare_and_swap (pp, old, p)) - old = *pp; -} - -/* Do an atomic store of a size_t value. */ - -void -backtrace_atomic_store_size_t (size_t *p, size_t v) -{ - size_t old; - - old = *p; - while (!__sync_bool_compare_and_swap (p, old, v)) - old = *p; -} - -/* Do an atomic store of a int value. */ - -void -backtrace_atomic_store_int (int *p, int v) -{ - size_t old; - - old = *p; - while (!__sync_bool_compare_and_swap (p, old, v)) - old = *p; -} - -#endif diff --git a/llgo/third_party/gofrontend/libbacktrace/backtrace-supported.h.in b/llgo/third_party/gofrontend/libbacktrace/backtrace-supported.h.in deleted file mode 100644 index 5115ce1e6151015385b94abaca19697da9870af1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/backtrace-supported.h.in +++ /dev/null @@ -1,61 +0,0 @@ -/* backtrace-supported.h.in -- Whether stack backtrace is supported. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 file backtrace-supported.h.in is used by configure to generate - the file backtrace-supported.h. The file backtrace-supported.h may - be #include'd to see whether the backtrace library will be able to - get a backtrace and produce symbolic information. */ - - -/* BACKTRACE_SUPPORTED will be #define'd as 1 if the backtrace library - should work, 0 if it will not. Libraries may #include this to make - other arrangements. */ - -#define BACKTRACE_SUPPORTED @BACKTRACE_SUPPORTED@ - -/* BACKTRACE_USES_MALLOC will be #define'd as 1 if the backtrace - library will call malloc as it works, 0 if it will call mmap - instead. This may be used to determine whether it is safe to call - the backtrace functions from a signal handler. In general this - only applies to calls like backtrace and backtrace_pcinfo. It does - not apply to backtrace_simple, which never calls malloc. It does - not apply to backtrace_print, which always calls fprintf and - therefore malloc. */ - -#define BACKTRACE_USES_MALLOC @BACKTRACE_USES_MALLOC@ - -/* BACKTRACE_SUPPORTS_THREADS will be #define'd as 1 if the backtrace - library is configured with threading support, 0 if not. If this is - 0, the threaded parameter to backtrace_create_state must be passed - as 0. */ - -#define BACKTRACE_SUPPORTS_THREADS @BACKTRACE_SUPPORTS_THREADS@ diff --git a/llgo/third_party/gofrontend/libbacktrace/backtrace.c b/llgo/third_party/gofrontend/libbacktrace/backtrace.c deleted file mode 100644 index d352d27a4006d98a755a1a16cbeeb53a4c2d3cf2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/backtrace.c +++ /dev/null @@ -1,108 +0,0 @@ -/* backtrace.c -- Entry point for stack backtrace library. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include "unwind.h" -#include "backtrace.h" - -/* The main backtrace_full routine. */ - -/* Data passed through _Unwind_Backtrace. */ - -struct backtrace_data -{ - /* Number of frames to skip. */ - int skip; - /* Library state. */ - struct backtrace_state *state; - /* Callback routine. */ - backtrace_full_callback callback; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data to pass to callback routines. */ - void *data; - /* Value to return from backtrace_full. */ - int ret; -}; - -/* Unwind library callback routine. This is passed to - _Unwind_Backtrace. */ - -static _Unwind_Reason_Code -unwind (struct _Unwind_Context *context, void *vdata) -{ - struct backtrace_data *bdata = (struct backtrace_data *) vdata; - uintptr_t pc; - int ip_before_insn = 0; - -#ifdef HAVE_GETIPINFO - pc = _Unwind_GetIPInfo (context, &ip_before_insn); -#else - pc = _Unwind_GetIP (context); -#endif - - if (bdata->skip > 0) - { - --bdata->skip; - return _URC_NO_REASON; - } - - if (!ip_before_insn) - --pc; - - bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback, - bdata->error_callback, bdata->data); - if (bdata->ret != 0) - return _URC_END_OF_STACK; - - return _URC_NO_REASON; -} - -/* Get a stack backtrace. */ - -int -backtrace_full (struct backtrace_state *state, int skip, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct backtrace_data bdata; - - bdata.skip = skip + 1; - bdata.state = state; - bdata.callback = callback; - bdata.error_callback = error_callback; - bdata.data = data; - bdata.ret = 0; - _Unwind_Backtrace (unwind, &bdata); - return bdata.ret; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/backtrace.h b/llgo/third_party/gofrontend/libbacktrace/backtrace.h deleted file mode 100644 index 50dcd40751b22c7268ef001e8a397cf274d79b7a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/backtrace.h +++ /dev/null @@ -1,199 +0,0 @@ -/* backtrace.h -- Public header file for stack backtrace library. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 BACKTRACE_H -#define BACKTRACE_H - -#include -#include - -/* We want to get a definition for uintptr_t, but we still care about - systems that don't have . */ -#if defined(__GLIBC__) && __GLIBC__ >= 2 - -#include - -#elif defined(HAVE_STDINT_H) - -#include - -#else - -/* Systems that don't have must provide gstdint.h, e.g., - from GCC_HEADER_STDINT in configure.ac. */ -#include "gstdint.h" - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* The backtrace state. This struct is intentionally not defined in - the public interface. */ - -struct backtrace_state; - -/* The type of the error callback argument to backtrace functions. - This function, if not NULL, will be called for certain error cases. - The DATA argument is passed to the function that calls this one. - The MSG argument is an error message. The ERRNUM argument, if - greater than 0, holds an errno value. The MSG buffer may become - invalid after this function returns. - - As a special case, the ERRNUM argument will be passed as -1 if no - debug info can be found for the executable, but the function - requires debug info (e.g., backtrace_full, backtrace_pcinfo). The - MSG in this case will be something along the lines of "no debug - info". Similarly, ERRNUM will be passed as -1 if there is no - symbol table, but the function requires a symbol table (e.g., - backtrace_syminfo). This may be used as a signal that some other - approach should be tried. */ - -typedef void (*backtrace_error_callback) (void *data, const char *msg, - int errnum); - -/* Create state information for the backtrace routines. This must be - called before any of the other routines, and its return value must - be passed to all of the other routines. FILENAME is the path name - of the executable file; if it is NULL the library will try - system-specific path names. If not NULL, FILENAME must point to a - permanent buffer. If THREADED is non-zero the state may be - accessed by multiple threads simultaneously, and the library will - use appropriate atomic operations. If THREADED is zero the state - may only be accessed by one thread at a time. This returns a state - pointer on success, NULL on error. If an error occurs, this will - call the ERROR_CALLBACK routine. */ - -extern struct backtrace_state *backtrace_create_state ( - const char *filename, int threaded, - backtrace_error_callback error_callback, void *data); - -/* The type of the callback argument to the backtrace_full function. - DATA is the argument passed to backtrace_full. PC is the program - counter. FILENAME is the name of the file containing PC, or NULL - if not available. LINENO is the line number in FILENAME containing - PC, or 0 if not available. FUNCTION is the name of the function - containing PC, or NULL if not available. This should return 0 to - continuing tracing. The FILENAME and FUNCTION buffers may become - invalid after this function returns. */ - -typedef int (*backtrace_full_callback) (void *data, uintptr_t pc, - const char *filename, int lineno, - const char *function); - -/* Get a full stack backtrace. SKIP is the number of frames to skip; - passing 0 will start the trace with the function calling - backtrace_full. DATA is passed to the callback routine. If any - call to CALLBACK returns a non-zero value, the stack backtrace - stops, and backtrace returns that value; this may be used to limit - the number of stack frames desired. If all calls to CALLBACK - return 0, backtrace returns 0. The backtrace_full function will - make at least one call to either CALLBACK or ERROR_CALLBACK. This - function requires debug info for the executable. */ - -extern int backtrace_full (struct backtrace_state *state, int skip, - backtrace_full_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* The type of the callback argument to the backtrace_simple function. - DATA is the argument passed to simple_backtrace. PC is the program - counter. This should return 0 to continue tracing. */ - -typedef int (*backtrace_simple_callback) (void *data, uintptr_t pc); - -/* Get a simple backtrace. SKIP is the number of frames to skip, as - in backtrace. DATA is passed to the callback routine. If any call - to CALLBACK returns a non-zero value, the stack backtrace stops, - and backtrace_simple returns that value. Otherwise - backtrace_simple returns 0. The backtrace_simple function will - make at least one call to either CALLBACK or ERROR_CALLBACK. This - function does not require any debug info for the executable. */ - -extern int backtrace_simple (struct backtrace_state *state, int skip, - backtrace_simple_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* Print the current backtrace in a user readable format to a FILE. - SKIP is the number of frames to skip, as in backtrace_full. Any - error messages are printed to stderr. This function requires debug - info for the executable. */ - -extern void backtrace_print (struct backtrace_state *state, int skip, FILE *); - -/* Given PC, a program counter in the current program, call the - callback function with filename, line number, and function name - information. This will normally call the callback function exactly - once. However, if the PC happens to describe an inlined call, and - the debugging information contains the necessary information, then - this may call the callback function multiple times. This will make - at least one call to either CALLBACK or ERROR_CALLBACK. This - returns the first non-zero value returned by CALLBACK, or 0. */ - -extern int backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, - void *data); - -/* The type of the callback argument to backtrace_syminfo. DATA and - PC are the arguments passed to backtrace_syminfo. SYMNAME is the - name of the symbol for the corresponding code. SYMVAL is the - value and SYMSIZE is the size of the symbol. SYMNAME will be NULL - if no error occurred but the symbol could not be found. */ - -typedef void (*backtrace_syminfo_callback) (void *data, uintptr_t pc, - const char *symname, - uintptr_t symval, - uintptr_t symsize); - -/* Given ADDR, an address or program counter in the current program, - call the callback information with the symbol name and value - describing the function or variable in which ADDR may be found. - This will call either CALLBACK or ERROR_CALLBACK exactly once. - This returns 1 on success, 0 on failure. This function requires - the symbol table but does not require the debug info. Note that if - the symbol table is present but ADDR could not be found in the - table, CALLBACK will be called with a NULL SYMNAME argument. - Returns 1 on success, 0 on error. */ - -extern int backtrace_syminfo (struct backtrace_state *state, uintptr_t addr, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, - void *data); - -#ifdef __cplusplus -} /* End extern "C". */ -#endif - -#endif diff --git a/llgo/third_party/gofrontend/libbacktrace/btest.c b/llgo/third_party/gofrontend/libbacktrace/btest.c deleted file mode 100644 index 9424a927f2d8917511c600250a04e1adba4a34a2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/btest.c +++ /dev/null @@ -1,715 +0,0 @@ -/* btest.c -- Test for libbacktrace library - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 program tests the externally visible interfaces of the - libbacktrace library. */ - -#include -#include -#include -#include - -#include "filenames.h" - -#include "backtrace.h" -#include "backtrace-supported.h" - -/* Portable attribute syntax. Actually some of these tests probably - won't work if the attributes are not recognized. */ - -#ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif - -#if (GCC_VERSION < 2007) -# define __attribute__(x) -#endif - -#ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif - -/* Used to collect backtrace info. */ - -struct info -{ - char *filename; - int lineno; - char *function; -}; - -/* Passed to backtrace callback function. */ - -struct bdata -{ - struct info *all; - size_t index; - size_t max; - int failed; -}; - -/* Passed to backtrace_simple callback function. */ - -struct sdata -{ - uintptr_t *addrs; - size_t index; - size_t max; - int failed; -}; - -/* Passed to backtrace_syminfo callback function. */ - -struct symdata -{ - const char *name; - uintptr_t val, size; - int failed; -}; - -/* The backtrace state. */ - -static void *state; - -/* The number of failures. */ - -static int failures; - -/* Return the base name in a path. */ - -static const char * -base (const char *p) -{ - const char *last; - const char *s; - - last = NULL; - for (s = p; *s != '\0'; ++s) - { - if (IS_DIR_SEPARATOR (*s)) - last = s + 1; - } - return last != NULL ? last : p; -} - -/* Check an entry in a struct info array. */ - -static void -check (const char *name, int index, const struct info *all, int want_lineno, - const char *want_function, int *failed) -{ - if (*failed) - return; - if (all[index].filename == NULL || all[index].function == NULL) - { - fprintf (stderr, "%s: [%d]: missing file name or function name\n", - name, index); - *failed = 1; - return; - } - if (strcmp (base (all[index].filename), "btest.c") != 0) - { - fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index, - all[index].filename); - *failed = 1; - } - if (all[index].lineno != want_lineno) - { - fprintf (stderr, "%s: [%d]: got %d expected %d\n", name, index, - all[index].lineno, want_lineno); - *failed = 1; - } - if (strcmp (all[index].function, want_function) != 0) - { - fprintf (stderr, "%s: [%d]: got %s expected %s\n", name, index, - all[index].function, want_function); - *failed = 1; - } -} - -/* The backtrace callback function. */ - -static int -callback_one (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED, - const char *filename, int lineno, const char *function) -{ - struct bdata *data = (struct bdata *) vdata; - struct info *p; - - if (data->index >= data->max) - { - fprintf (stderr, "callback_one: callback called too many times\n"); - data->failed = 1; - return 1; - } - - p = &data->all[data->index]; - if (filename == NULL) - p->filename = NULL; - else - { - p->filename = strdup (filename); - assert (p->filename != NULL); - } - p->lineno = lineno; - if (function == NULL) - p->function = NULL; - else - { - p->function = strdup (function); - assert (p->function != NULL); - } - ++data->index; - - return 0; -} - -/* An error callback passed to backtrace. */ - -static void -error_callback_one (void *vdata, const char *msg, int errnum) -{ - struct bdata *data = (struct bdata *) vdata; - - fprintf (stderr, "%s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fprintf (stderr, "\n"); - data->failed = 1; -} - -/* The backtrace_simple callback function. */ - -static int -callback_two (void *vdata, uintptr_t pc) -{ - struct sdata *data = (struct sdata *) vdata; - - if (data->index >= data->max) - { - fprintf (stderr, "callback_two: callback called too many times\n"); - data->failed = 1; - return 1; - } - - data->addrs[data->index] = pc; - ++data->index; - - return 0; -} - -/* An error callback passed to backtrace_simple. */ - -static void -error_callback_two (void *vdata, const char *msg, int errnum) -{ - struct sdata *data = (struct sdata *) vdata; - - fprintf (stderr, "%s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fprintf (stderr, "\n"); - data->failed = 1; -} - -/* The backtrace_syminfo callback function. */ - -static void -callback_three (void *vdata, uintptr_t pc ATTRIBUTE_UNUSED, - const char *symname, uintptr_t symval, - uintptr_t symsize) -{ - struct symdata *data = (struct symdata *) vdata; - - if (symname == NULL) - data->name = NULL; - else - { - data->name = strdup (symname); - assert (data->name != NULL); - } - data->val = symval; - data->size = symsize; -} - -/* The backtrace_syminfo error callback function. */ - -static void -error_callback_three (void *vdata, const char *msg, int errnum) -{ - struct symdata *data = (struct symdata *) vdata; - - fprintf (stderr, "%s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fprintf (stderr, "\n"); - data->failed = 1; -} - -/* Test the backtrace function with non-inlined functions. */ - -static int test1 (void) __attribute__ ((noinline, unused)); -static int f2 (int) __attribute__ ((noinline)); -static int f3 (int, int) __attribute__ ((noinline)); - -static int -test1 (void) -{ - /* Returning a value here and elsewhere avoids a tailcall which - would mess up the backtrace. */ - return f2 (__LINE__) + 1; -} - -static int -f2 (int f1line) -{ - return f3 (f1line, __LINE__) + 2; -} - -static int -f3 (int f1line, int f2line) -{ - struct info all[20]; - struct bdata data; - int f3line; - int i; - - data.all = &all[0]; - data.index = 0; - data.max = 20; - data.failed = 0; - - f3line = __LINE__ + 1; - i = backtrace_full (state, 0, callback_one, error_callback_one, &data); - - if (i != 0) - { - fprintf (stderr, "test1: unexpected return value %d\n", i); - data.failed = 1; - } - - if (data.index < 3) - { - fprintf (stderr, - "test1: not enough frames; got %zu, expected at least 3\n", - data.index); - data.failed = 1; - } - - check ("test1", 0, all, f3line, "f3", &data.failed); - check ("test1", 1, all, f2line, "f2", &data.failed); - check ("test1", 2, all, f1line, "test1", &data.failed); - - printf ("%s: backtrace_full noinline\n", data.failed ? "FAIL" : "PASS"); - - if (data.failed) - ++failures; - - return failures; -} - -/* Test the backtrace function with inlined functions. */ - -static inline int test2 (void) __attribute__ ((always_inline, unused)); -static inline int f12 (int) __attribute__ ((always_inline)); -static inline int f13 (int, int) __attribute__ ((always_inline)); - -static inline int -test2 (void) -{ - return f12 (__LINE__) + 1; -} - -static inline int -f12 (int f1line) -{ - return f13 (f1line, __LINE__) + 2; -} - -static inline int -f13 (int f1line, int f2line) -{ - struct info all[20]; - struct bdata data; - int f3line; - int i; - - data.all = &all[0]; - data.index = 0; - data.max = 20; - data.failed = 0; - - f3line = __LINE__ + 1; - i = backtrace_full (state, 0, callback_one, error_callback_one, &data); - - if (i != 0) - { - fprintf (stderr, "test2: unexpected return value %d\n", i); - data.failed = 1; - } - - check ("test2", 0, all, f3line, "f13", &data.failed); - check ("test2", 1, all, f2line, "f12", &data.failed); - check ("test2", 2, all, f1line, "test2", &data.failed); - - printf ("%s: backtrace_full inline\n", data.failed ? "FAIL" : "PASS"); - - if (data.failed) - ++failures; - - return failures; -} - -/* Test the backtrace_simple function with non-inlined functions. */ - -static int test3 (void) __attribute__ ((noinline, unused)); -static int f22 (int) __attribute__ ((noinline)); -static int f23 (int, int) __attribute__ ((noinline)); - -static int -test3 (void) -{ - return f22 (__LINE__) + 1; -} - -static int -f22 (int f1line) -{ - return f23 (f1line, __LINE__) + 2; -} - -static int -f23 (int f1line, int f2line) -{ - uintptr_t addrs[20]; - struct sdata data; - int f3line; - int i; - - data.addrs = &addrs[0]; - data.index = 0; - data.max = 20; - data.failed = 0; - - f3line = __LINE__ + 1; - i = backtrace_simple (state, 0, callback_two, error_callback_two, &data); - - if (i != 0) - { - fprintf (stderr, "test3: unexpected return value %d\n", i); - data.failed = 1; - } - - if (!data.failed) - { - struct info all[20]; - struct bdata bdata; - int j; - - bdata.all = &all[0]; - bdata.index = 0; - bdata.max = 20; - bdata.failed = 0; - - for (j = 0; j < 3; ++j) - { - i = backtrace_pcinfo (state, addrs[j], callback_one, - error_callback_one, &bdata); - if (i != 0) - { - fprintf (stderr, - ("test3: unexpected return value " - "from backtrace_pcinfo %d\n"), - i); - bdata.failed = 1; - } - if (!bdata.failed && bdata.index != (size_t) (j + 1)) - { - fprintf (stderr, - ("wrong number of calls from backtrace_pcinfo " - "got %u expected %d\n"), - (unsigned int) bdata.index, j + 1); - bdata.failed = 1; - } - } - - check ("test3", 0, all, f3line, "f23", &bdata.failed); - check ("test3", 1, all, f2line, "f22", &bdata.failed); - check ("test3", 2, all, f1line, "test3", &bdata.failed); - - if (bdata.failed) - data.failed = 1; - - for (j = 0; j < 3; ++j) - { - struct symdata symdata; - - symdata.name = NULL; - symdata.val = 0; - symdata.size = 0; - symdata.failed = 0; - - i = backtrace_syminfo (state, addrs[j], callback_three, - error_callback_three, &symdata); - if (i == 0) - { - fprintf (stderr, - ("test3: [%d]: unexpected return value " - "from backtrace_syminfo %d\n"), - j, i); - symdata.failed = 1; - } - - if (!symdata.failed) - { - const char *expected; - - switch (j) - { - case 0: - expected = "f23"; - break; - case 1: - expected = "f22"; - break; - case 2: - expected = "test3"; - break; - default: - assert (0); - } - - if (symdata.name == NULL) - { - fprintf (stderr, "test3: [%d]: NULL syminfo name\n", j); - symdata.failed = 1; - } - /* Use strncmp, not strcmp, because GCC might create a - clone. */ - else if (strncmp (symdata.name, expected, strlen (expected)) - != 0) - { - fprintf (stderr, - ("test3: [%d]: unexpected syminfo name " - "got %s expected %s\n"), - j, symdata.name, expected); - symdata.failed = 1; - } - } - - if (symdata.failed) - data.failed = 1; - } - } - - printf ("%s: backtrace_simple noinline\n", data.failed ? "FAIL" : "PASS"); - - if (data.failed) - ++failures; - - return failures; -} - -/* Test the backtrace_simple function with inlined functions. */ - -static inline int test4 (void) __attribute__ ((always_inline, unused)); -static inline int f32 (int) __attribute__ ((always_inline)); -static inline int f33 (int, int) __attribute__ ((always_inline)); - -static inline int -test4 (void) -{ - return f32 (__LINE__) + 1; -} - -static inline int -f32 (int f1line) -{ - return f33 (f1line, __LINE__) + 2; -} - -static inline int -f33 (int f1line, int f2line) -{ - uintptr_t addrs[20]; - struct sdata data; - int f3line; - int i; - - data.addrs = &addrs[0]; - data.index = 0; - data.max = 20; - data.failed = 0; - - f3line = __LINE__ + 1; - i = backtrace_simple (state, 0, callback_two, error_callback_two, &data); - - if (i != 0) - { - fprintf (stderr, "test3: unexpected return value %d\n", i); - data.failed = 1; - } - - if (!data.failed) - { - struct info all[20]; - struct bdata bdata; - - bdata.all = &all[0]; - bdata.index = 0; - bdata.max = 20; - bdata.failed = 0; - - i = backtrace_pcinfo (state, addrs[0], callback_one, error_callback_one, - &bdata); - if (i != 0) - { - fprintf (stderr, - ("test4: unexpected return value " - "from backtrace_pcinfo %d\n"), - i); - bdata.failed = 1; - } - - check ("test4", 0, all, f3line, "f33", &bdata.failed); - check ("test4", 1, all, f2line, "f32", &bdata.failed); - check ("test4", 2, all, f1line, "test4", &bdata.failed); - - if (bdata.failed) - data.failed = 1; - } - - printf ("%s: backtrace_simple inline\n", data.failed ? "FAIL" : "PASS"); - - if (data.failed) - ++failures; - - return failures; -} - -int global = 1; - -static int -test5 (void) -{ - struct symdata symdata; - int i; - uintptr_t addr = (uintptr_t) &global; - - if (sizeof (global) > 1) - addr += 1; - - symdata.name = NULL; - symdata.val = 0; - symdata.size = 0; - symdata.failed = 0; - - i = backtrace_syminfo (state, addr, callback_three, - error_callback_three, &symdata); - if (i == 0) - { - fprintf (stderr, - "test5: unexpected return value from backtrace_syminfo %d\n", - i); - symdata.failed = 1; - } - - if (!symdata.failed) - { - if (symdata.name == NULL) - { - fprintf (stderr, "test5: NULL syminfo name\n"); - symdata.failed = 1; - } - else if (strcmp (symdata.name, "global") != 0) - { - fprintf (stderr, - "test5: unexpected syminfo name got %s expected %s\n", - symdata.name, "global"); - symdata.failed = 1; - } - else if (symdata.val != (uintptr_t) &global) - { - fprintf (stderr, - "test5: unexpected syminfo value got %lx expected %lx\n", - (unsigned long) symdata.val, - (unsigned long) (uintptr_t) &global); - symdata.failed = 1; - } - else if (symdata.size != sizeof (global)) - { - fprintf (stderr, - "test5: unexpected syminfo size got %lx expected %lx\n", - (unsigned long) symdata.size, - (unsigned long) sizeof (global)); - symdata.failed = 1; - } - } - - printf ("%s: backtrace_syminfo variable\n", - symdata.failed ? "FAIL" : "PASS"); - - if (symdata.failed) - ++failures; - - return failures; -} - -static void -error_callback_create (void *data ATTRIBUTE_UNUSED, const char *msg, - int errnum) -{ - fprintf (stderr, "%s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fprintf (stderr, "\n"); - exit (EXIT_FAILURE); -} - -/* Run all the tests. */ - -int -main (int argc ATTRIBUTE_UNUSED, char **argv) -{ - state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS, - error_callback_create, NULL); - -#if BACKTRACE_SUPPORTED - test1 (); - test2 (); - test3 (); - test4 (); - test5 (); -#endif - - exit (failures ? EXIT_FAILURE : EXIT_SUCCESS); -} diff --git a/llgo/third_party/gofrontend/libbacktrace/config.h.in b/llgo/third_party/gofrontend/libbacktrace/config.h.in deleted file mode 100644 index 87cb805984d4f06782ed96a509fe18a290377f33..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/config.h.in +++ /dev/null @@ -1,134 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* ELF size: 32 or 64 */ -#undef BACKTRACE_ELF_SIZE - -/* Define to 1 if you have the __atomic functions */ -#undef HAVE_ATOMIC_FUNCTIONS - -/* Define to 1 if you have the declaration of `strnlen', and to 0 if you - don't. */ -#undef HAVE_DECL_STRNLEN - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define if dl_iterate_phdr is available. */ -#undef HAVE_DL_ITERATE_PHDR - -/* Define to 1 if you have the fcntl function */ -#undef HAVE_FCNTL - -/* Define if getexecname is available. */ -#undef HAVE_GETEXECNAME - -/* Define if _Unwind_GetIPInfo is available. */ -#undef HAVE_GETIPINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the __sync functions */ -#undef HAVE_SYNC_FUNCTIONS - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* The size of `char', as computed by sizeof. */ -#undef SIZEOF_CHAR - -/* The size of `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of `short', as computed by sizeof. */ -#undef SIZEOF_SHORT - -/* The size of `void *', as computed by sizeof. */ -#undef SIZEOF_VOID_P - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE diff --git a/llgo/third_party/gofrontend/libbacktrace/configure b/llgo/third_party/gofrontend/libbacktrace/configure deleted file mode 100755 index d6abc7d72fa06750c2f1819f971305ec0739b89c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/configure +++ /dev/null @@ -1,15156 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for package-unused version-unused. -# -# 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 &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='package-unused' -PACKAGE_TARNAME='libbacktrace' -PACKAGE_VERSION='version-unused' -PACKAGE_STRING='package-unused version-unused' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_unique_file="backtrace.h" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -NATIVE_FALSE -NATIVE_TRUE -BACKTRACE_USES_MALLOC -ALLOC_FILE -VIEW_FILE -BACKTRACE_SUPPORTED -FORMAT_FILE -BACKTRACE_SUPPORTS_THREADS -PIC_FLAG -WARN_FLAGS -EXTRA_FLAGS -BACKTRACE_FILE -multi_basedir -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -SED -LIBTOOL -RANLIB -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 -libtool_VERSION -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -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 -with_target_subdir -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -enable_libtool_lock -enable_multilib -with_system_libunwind -enable_host_shared -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information." - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures package-unused version-unused 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/libbacktrace] - --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 package-unused version-unused:";; - 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 - --enable-shared[=PKGS] build shared libraries [default=no] - --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) - --enable-multilib build many library versions (default) - --enable-host-shared build host code as shared libraries - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-target-subdir=SUBDIR Configuring in a subdirectory for target - --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] - --with-system-libunwind use installed libunwind - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -package-unused configure version-unused -generated by GNU Autoconf 2.64 - -Copyright (C) 2009 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile - -# 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_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - 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 - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=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 -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_type - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 -$as_echo_n "checking whether $as_decl_name is declared... " >&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 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_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_decl -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 package-unused $as_me version-unused, 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_config_headers="$ac_config_headers config.h" - - -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} - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -fi -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - - -libtool_VERSION=1:0:0 - - -# 1.11.1: Require that version of automake. -# foreign: Don't require README, INSTALL, NEWS, etc. -# no-define: Don't define PACKAGE and VERSION. -# no-dependencies: Don't generate automatic dependencies. -# (because it breaks when using bootstrap-lean, since some of the -# headers are gone at "make install" time). -# -Wall: Issue all automake warnings. -# -Wno-portability: Don't warn about constructs supported by GNU make. -# (because GCC requires GNU make anyhow). -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='libbacktrace' - VERSION='version-unused' - - -# 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 - - - - -# Check whether --with-target-subdir was given. -if test "${with_target_subdir+set}" = set; then : - withval=$with_target_subdir; -fi - - -# We must force CC to /not/ be precious variables; otherwise -# the wrong, non-multilib-adjusted value will be used in multilibs. -# As a side effect, we have to subst CFLAGS ourselves. - - -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 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - -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 - - -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 - -case "$AWK" in -"") as_fn_error "can't build without awk" "$LINENO" 5 ;; -esac - -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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$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 -# 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=no -fi - - - - - - - - - - - enable_dlopen=no - - - enable_win32_dll=no - - - - # 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 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=' $pic_flag' - 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.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`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 11092 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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 11198 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - - -backtrace_supported=yes - -if test -n "${with_target_subdir}"; then - # We are compiling a GCC library. We can assume that the unwind - # library exists. - # 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" - - BACKTRACE_FILE="backtrace.lo simple.lo" -else - ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default" -if test "x$ac_cv_header_unwind_h" = x""yes; then : - ac_fn_c_check_func "$LINENO" "_Unwind_Backtrace" "ac_cv_func__Unwind_Backtrace" -if test "x$ac_cv_func__Unwind_Backtrace" = x""yes; then : - BACKTRACE_FILE="backtrace.lo simple.lo" -else - BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no -fi - -else - BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no -fi - - -fi - - -EXTRA_FLAGS= -if test -n "${with_target_subdir}"; then - EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -funwind-tables option" >&5 -$as_echo_n "checking for -funwind-tables option... " >&6; } -if test "${libbacktrace_cv_c_unwind_tables+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold="$CFLAGS" - CFLAGS="$CFLAGS -funwind-tables" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -static int f() { return 0; } -int -main () -{ -return f(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libbacktrace_cv_c_unwind_tables=yes -else - libbacktrace_cv_c_unwind_tables=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$CFLAGS_hold" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_unwind_tables" >&5 -$as_echo "$libbacktrace_cv_c_unwind_tables" >&6; } - if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then - EXTRA_FLAGS=-funwind-tables - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -frandom-seed=string option" >&5 -$as_echo_n "checking for -frandom-seed=string option... " >&6; } -if test "${libbacktrace_cv_c_random_seed_string+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold="$CFLAGS" - CFLAGS="$CFLAGS -frandom-seed=conftest.lo" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libbacktrace_cv_c_random_seed_string=yes -else - libbacktrace_cv_c_random_seed_string=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS="$CFLAGS_hold" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_c_random_seed_string" >&5 -$as_echo "$libbacktrace_cv_c_random_seed_string" >&6; } - if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then - EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@" - fi -fi - - -WARN_FLAGS= -save_CFLAGS="$CFLAGS" -for real_option in -W -Wall -Wwrite-strings -Wstrict-prototypes \ - -Wmissing-prototypes -Wold-style-definition \ - -Wmissing-format-attribute -Wcast-qual; do - # Do the check with the no- prefix removed since gcc silently - # accepts any -Wno-* option on purpose - case $real_option in - -Wno-*) option=-W`expr x$real_option : 'x-Wno-\(.*\)'` ;; - *) option=$real_option ;; - esac - as_acx_Woption=`$as_echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh` - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports $option" >&5 -$as_echo_n "checking whether $CC supports $option... " >&6; } -if { as_var=$as_acx_Woption; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS="$option" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$as_acx_Woption=yes" -else - eval "$as_acx_Woption=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -eval ac_res=\$$as_acx_Woption - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - if test `eval 'as_val=${'$as_acx_Woption'};$as_echo "$as_val"'` = yes; then : - WARN_FLAGS="$WARN_FLAGS${WARN_FLAGS:+ }$real_option" -fi - done -CFLAGS="$save_CFLAGS" - - -if test -n "${with_target_subdir}"; then - WARN_FLAGS="$WARN_FLAGS -Werror" -fi - - - -if test -n "${with_target_subdir}"; then - - -# Check whether --with-system-libunwind was given. -if test "${with_system_libunwind+set}" = set; then : - withval=$with_system_libunwind; -fi - - # If system-libunwind was not specifically set, pick a default setting. - if test x$with_system_libunwind = x; then - case ${target} in - ia64-*-hpux*) with_system_libunwind=yes ;; - *) with_system_libunwind=no ;; - esac - fi - # Based on system-libunwind and target, do we have ipinfo? - if test x$with_system_libunwind = xyes; then - case ${target} in - ia64-*-*) have_unwind_getipinfo=no ;; - *) have_unwind_getipinfo=yes ;; - esac - else - # Darwin before version 9 does not have _Unwind_GetIPInfo. - - case ${target} in - *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;; - *) have_unwind_getipinfo=yes ;; - esac - - fi - - if test x$have_unwind_getipinfo = xyes; then - -$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h - - fi - -else - ac_save_CFFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror-implicit-function-declaration" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_GetIPInfo" >&5 -$as_echo_n "checking for _Unwind_GetIPInfo... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include "unwind.h" - struct _Unwind_Context *context; - int ip_before_insn = 0; -int -main () -{ -return _Unwind_GetIPInfo (context, &ip_before_insn); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have_unwind_getipinfo=yes -else - have_unwind_getipinfo=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$ac_save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5 -$as_echo "$have_unwind_getipinfo" >&6; } - if test "$have_unwind_getipinfo" = "yes"; then - -$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h - - fi -fi - -# When building as a target library, shared libraries may want to link -# this in. We don't want to provide another shared library to -# complicate dependencies. Instead, we just compile with -fPIC. -PIC_FLAG= -if test -n "${with_target_subdir}"; then - PIC_FLAG=-fPIC -fi -# Similarly, use -fPIC with --enable-host-shared: -# Check whether --enable-host-shared was given. -if test "${enable_host_shared+set}" = set; then : - enableval=$enable_host_shared; PIC_FLAG=-fPIC -fi - - - -# Test for __sync support. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __sync extensions" >&5 -$as_echo_n "checking __sync extensions... " >&6; } -if test "${libbacktrace_cv_sys_sync+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "${with_target_subdir}"; then - libbacktrace_cv_sys_sync=yes - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -int -main () -{ -__sync_bool_compare_and_swap (&i, i, i); - __sync_lock_test_and_set (&i, 1); - __sync_lock_release (&i); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libbacktrace_cv_sys_sync=yes -else - libbacktrace_cv_sys_sync=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_sync" >&5 -$as_echo "$libbacktrace_cv_sys_sync" >&6; } -BACKTRACE_SUPPORTS_THREADS=0 -if test "$libbacktrace_cv_sys_sync" = "yes"; then - BACKTRACE_SUPPORTS_THREADS=1 - -$as_echo "#define HAVE_SYNC_FUNCTIONS 1" >>confdefs.h - -fi - - -# Test for __atomic support. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __atomic extensions" >&5 -$as_echo_n "checking __atomic extensions... " >&6; } -if test "${libbacktrace_cv_sys_atomic+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "${with_target_subdir}"; then - libbacktrace_cv_sys_atomic=yes - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -int -main () -{ -__atomic_load_n (&i, __ATOMIC_ACQUIRE); - __atomic_store_n (&i, 1, __ATOMIC_RELEASE); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libbacktrace_cv_sys_atomic=yes -else - libbacktrace_cv_sys_atomic=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_atomic" >&5 -$as_echo "$libbacktrace_cv_sys_atomic" >&6; } -if test "$libbacktrace_cv_sys_atomic" = "yes"; then - -$as_echo "#define HAVE_ATOMIC_FUNCTIONS 1" >>confdefs.h - -fi - -# The library needs to be able to read the executable itself. Compile -# a file to determine the executable format. The awk script -# filetype.awk prints out the file type. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking output filetype" >&5 -$as_echo_n "checking output filetype... " >&6; } -if test "${libbacktrace_cv_sys_filetype+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - filetype= -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -int -main () -{ -int j; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext` -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 "compiler failed -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -libbacktrace_cv_sys_filetype=$filetype -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_filetype" >&5 -$as_echo "$libbacktrace_cv_sys_filetype" >&6; } - -# Match the file type to decide what files to compile. -FORMAT_FILE= -case "$libbacktrace_cv_sys_filetype" in -elf*) FORMAT_FILE="elf.lo" ;; -*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not determine output file type" >&5 -$as_echo "$as_me: WARNING: could not determine output file type" >&2;} - FORMAT_FILE="unknown.lo" - backtrace_supported=no - ;; -esac - - -# ELF defines. -elfsize= -case "$libbacktrace_cv_sys_filetype" in -elf32) elfsize=32 ;; -elf64) elfsize=64 ;; -esac - -cat >>confdefs.h <<_ACEOF -#define BACKTRACE_ELF_SIZE $elfsize -_ACEOF - - -BACKTRACE_SUPPORTED=0 -if test "$backtrace_supported" = "yes"; then - BACKTRACE_SUPPORTED=1 -fi - - - - -inttype_headers=`echo inttypes.h sys/inttypes.h | sed -e 's/,/ /g'` - -acx_cv_header_stdint=stddef.h -acx_cv_header_stdint_kind="(already complete)" -for i in stdint.h $inttype_headers; do - unset ac_cv_type_uintptr_t - unset ac_cv_type_uintmax_t - unset ac_cv_type_int_least32_t - unset ac_cv_type_int_fast32_t - unset ac_cv_type_uint64_t - $as_echo_n "looking for a compliant stdint.h in $i, " >&6 - ac_fn_c_check_type "$LINENO" "uintmax_t" "ac_cv_type_uintmax_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uintmax_t" = x""yes; then : - acx_cv_header_stdint=$i -else - continue -fi - - ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uintptr_t" = x""yes; then : - -else - acx_cv_header_stdint_kind="(mostly complete)" -fi - - ac_fn_c_check_type "$LINENO" "int_least32_t" "ac_cv_type_int_least32_t" "#include -#include <$i> -" -if test "x$ac_cv_type_int_least32_t" = x""yes; then : - -else - acx_cv_header_stdint_kind="(mostly complete)" -fi - - ac_fn_c_check_type "$LINENO" "int_fast32_t" "ac_cv_type_int_fast32_t" "#include -#include <$i> -" -if test "x$ac_cv_type_int_fast32_t" = x""yes; then : - -else - acx_cv_header_stdint_kind="(mostly complete)" -fi - - ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uint64_t" = x""yes; then : - -else - acx_cv_header_stdint_kind="(lacks uint64_t)" -fi - - break -done -if test "$acx_cv_header_stdint" = stddef.h; then - acx_cv_header_stdint_kind="(lacks uintmax_t)" - for i in stdint.h $inttype_headers; do - unset ac_cv_type_uintptr_t - unset ac_cv_type_uint32_t - unset ac_cv_type_uint64_t - $as_echo_n "looking for an incomplete stdint.h in $i, " >&6 - ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uint32_t" = x""yes; then : - acx_cv_header_stdint=$i -else - continue -fi - - ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uint64_t" = x""yes; then : - -fi - - ac_fn_c_check_type "$LINENO" "uintptr_t" "ac_cv_type_uintptr_t" "#include -#include <$i> -" -if test "x$ac_cv_type_uintptr_t" = x""yes; then : - -fi - - break - done -fi -if test "$acx_cv_header_stdint" = stddef.h; then - acx_cv_header_stdint_kind="(u_intXX_t style)" - for i in sys/types.h $inttype_headers; do - unset ac_cv_type_u_int32_t - unset ac_cv_type_u_int64_t - $as_echo_n "looking for u_intXX_t types in $i, " >&6 - ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "#include -#include <$i> -" -if test "x$ac_cv_type_u_int32_t" = x""yes; then : - acx_cv_header_stdint=$i -else - continue -fi - - ac_fn_c_check_type "$LINENO" "u_int64_t" "ac_cv_type_u_int64_t" "#include -#include <$i> -" -if test "x$ac_cv_type_u_int64_t" = x""yes; then : - -fi - - break - done -fi -if test "$acx_cv_header_stdint" = stddef.h; then - acx_cv_header_stdint_kind="(using manual detection)" -fi - -test -z "$ac_cv_type_uintptr_t" && ac_cv_type_uintptr_t=no -test -z "$ac_cv_type_uint64_t" && ac_cv_type_uint64_t=no -test -z "$ac_cv_type_u_int64_t" && ac_cv_type_u_int64_t=no -test -z "$ac_cv_type_int_least32_t" && ac_cv_type_int_least32_t=no -test -z "$ac_cv_type_int_fast32_t" && ac_cv_type_int_fast32_t=no - -# ----------------- Summarize what we found so far - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what to include in gstdint.h" >&5 -$as_echo_n "checking what to include in gstdint.h... " >&6; } - -case `$as_basename -- gstdint.h || -$as_expr X/gstdint.h : '.*/\([^/][^/]*\)/*$' \| \ - Xgstdint.h : 'X\(//\)$' \| \ - Xgstdint.h : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/gstdint.h | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` in - stdint.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5 -$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; - inttypes.h) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: are you sure you want it there?" >&5 -$as_echo "$as_me: WARNING: are you sure you want it there?" >&2;} ;; - *) ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_header_stdint $acx_cv_header_stdint_kind" >&5 -$as_echo "$acx_cv_header_stdint $acx_cv_header_stdint_kind" >&6; } - -# ----------------- done included file, check C basic types -------- - -# Lacking an uintptr_t? Test size of void * -case "$acx_cv_header_stdint:$ac_cv_type_uintptr_t" in - stddef.h:* | *:no) # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } -if test "${ac_cv_sizeof_void_p+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_void_p" = yes; then - { { $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 "cannot compute sizeof (void *) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_void_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF - - ;; -esac - -# Lacking an uint64_t? Test size of long -case "$acx_cv_header_stdint:$ac_cv_type_uint64_t:$ac_cv_type_u_int64_t" in - stddef.h:*:* | *:no:no) # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } -if test "${ac_cv_sizeof_long+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long" = yes; then - { { $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 "cannot compute sizeof (long) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_long=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG $ac_cv_sizeof_long -_ACEOF - - ;; -esac - -if test $acx_cv_header_stdint = stddef.h; then - # Lacking a good header? Test size of everything and deduce all types. - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } -if test "${ac_cv_sizeof_int+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_int" = yes; then - { { $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 "cannot compute sizeof (int) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_int=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_INT $ac_cv_sizeof_int -_ACEOF - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } -if test "${ac_cv_sizeof_short+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_short" = yes; then - { { $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 "cannot compute sizeof (short) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_short=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SHORT $ac_cv_sizeof_short -_ACEOF - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5 -$as_echo_n "checking size of char... " >&6; } -if test "${ac_cv_sizeof_char+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_char" = yes; then - { { $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 "cannot compute sizeof (char) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_char=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5 -$as_echo "$ac_cv_sizeof_char" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_CHAR $ac_cv_sizeof_char -_ACEOF - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int8_t" >&5 -$as_echo_n "checking for type equivalent to int8_t... " >&6; } - case "$ac_cv_sizeof_char" in - 1) acx_cv_type_int8_t=char ;; - *) as_fn_error "no 8-bit type, please report a bug" "$LINENO" 5 - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int8_t" >&5 -$as_echo "$acx_cv_type_int8_t" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int16_t" >&5 -$as_echo_n "checking for type equivalent to int16_t... " >&6; } - case "$ac_cv_sizeof_int:$ac_cv_sizeof_short" in - 2:*) acx_cv_type_int16_t=int ;; - *:2) acx_cv_type_int16_t=short ;; - *) as_fn_error "no 16-bit type, please report a bug" "$LINENO" 5 - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int16_t" >&5 -$as_echo "$acx_cv_type_int16_t" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int32_t" >&5 -$as_echo_n "checking for type equivalent to int32_t... " >&6; } - case "$ac_cv_sizeof_int:$ac_cv_sizeof_long" in - 4:*) acx_cv_type_int32_t=int ;; - *:4) acx_cv_type_int32_t=long ;; - *) as_fn_error "no 32-bit type, please report a bug" "$LINENO" 5 - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_int32_t" >&5 -$as_echo "$acx_cv_type_int32_t" >&6; } -fi - -# These tests are here to make the output prettier - -if test "$ac_cv_type_uint64_t" != yes && test "$ac_cv_type_u_int64_t" != yes; then - case "$ac_cv_sizeof_long" in - 8) acx_cv_type_int64_t=long ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to int64_t" >&5 -$as_echo_n "checking for type equivalent to int64_t... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${acx_cv_type_int64_t-'using preprocessor symbols'}" >&5 -$as_echo "${acx_cv_type_int64_t-'using preprocessor symbols'}" >&6; } -fi - -# Now we can use the above types - -if test "$ac_cv_type_uintptr_t" != yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for type equivalent to intptr_t" >&5 -$as_echo_n "checking for type equivalent to intptr_t... " >&6; } - case $ac_cv_sizeof_void_p in - 2) acx_cv_type_intptr_t=int16_t ;; - 4) acx_cv_type_intptr_t=int32_t ;; - 8) acx_cv_type_intptr_t=int64_t ;; - *) as_fn_error "no equivalent for intptr_t, please report a bug" "$LINENO" 5 - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_cv_type_intptr_t" >&5 -$as_echo "$acx_cv_type_intptr_t" >&6; } -fi - -# ----------------- done all checks, emit header ------------- -ac_config_commands="$ac_config_commands gstdint.h" - - - - -for ac_header in sys/mman.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_MMAN_H 1 -_ACEOF - -fi - -done - -if test "$ac_cv_header_sys_mman_h" = "no"; then - have_mmap=no -else - if test -n "${with_target_subdir}"; then - # When built as a GCC target library, we can't do a link test. We - # simply assume that if we have mman.h, we have mmap. - have_mmap=yes - else - ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : - have_mmap=yes -else - have_mmap=no -fi - - fi -fi -if test "$have_mmap" = "no"; then - VIEW_FILE=read.lo - ALLOC_FILE=alloc.lo -else - VIEW_FILE=mmapio.lo - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON) - #error no MAP_ANONYMOUS -#endif - -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ALLOC_FILE=mmap.lo -else - ALLOC_FILE=alloc.lo -fi -rm -f conftest.err conftest.$ac_ext -fi - - - -BACKTRACE_USES_MALLOC=0 -if test "$ALLOC_FILE" = "alloc.lo"; then - BACKTRACE_USES_MALLOC=1 -fi - - -# Check for dl_iterate_phdr. -for ac_header in link.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "link.h" "ac_cv_header_link_h" "$ac_includes_default" -if test "x$ac_cv_header_link_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LINK_H 1 -_ACEOF - -fi - -done - -if test "$ac_cv_header_link_h" = "no"; then - have_dl_iterate_phdr=no -else - if test -n "${with_target_subdir}"; then - # When built as a GCC target library, we can't do a link test. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "dl_iterate_phdr" >/dev/null 2>&1; then : - have_dl_iterate_phdr=yes -else - have_dl_iterate_phdr=no -fi -rm -f conftest* - - case "${host}" in - *-*-solaris2.10*) - # Avoid dl_iterate_phdr on Solaris 10, where it is in the - # header file but is only in -ldl. - have_dl_iterate_phdr=no ;; - esac - else - ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr" -if test "x$ac_cv_func_dl_iterate_phdr" = x""yes; then : - have_dl_iterate_phdr=yes -else - have_dl_iterate_phdr=no -fi - - fi -fi -if test "$have_dl_iterate_phdr" = "yes"; then - -$as_echo "#define HAVE_DL_ITERATE_PHDR 1" >>confdefs.h - -fi - -# Check for the fcntl function. -if test -n "${with_target_subdir}"; then - case "${host}" in - *-*-mingw*) have_fcntl=no ;; - *) have_fcntl=yes ;; - esac -else - ac_fn_c_check_func "$LINENO" "fcntl" "ac_cv_func_fcntl" -if test "x$ac_cv_func_fcntl" = x""yes; then : - have_fcntl=yes -else - have_fcntl=no -fi - -fi -if test "$have_fcntl" = "yes"; then - -$as_echo "#define HAVE_FCNTL 1" >>confdefs.h - -fi - -ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default" -if test "x$ac_cv_have_decl_strnlen" = x""yes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_STRNLEN $ac_have_decl -_ACEOF - - -# Check for getexecname function. -if test -n "${with_target_subdir}"; then - case "${host}" in - *-*-solaris2*) have_getexecname=yes ;; - *) have_getexecname=no ;; - esac -else - ac_fn_c_check_func "$LINENO" "getexecname" "ac_cv_func_getexecname" -if test "x$ac_cv_func_getexecname" = x""yes; then : - have_getexecname=yes -else - have_getexecname=no -fi - -fi -if test "$have_getexecname" = "yes"; then - -$as_echo "#define HAVE_GETEXECNAME 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tests can run" >&5 -$as_echo_n "checking whether tests can run... " >&6; } -if test "${libbacktrace_cv_sys_native+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - libbacktrace_cv_sys_native=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libbacktrace_cv_sys_native=yes -else - libbacktrace_cv_sys_native=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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libbacktrace_cv_sys_native" >&5 -$as_echo "$libbacktrace_cv_sys_native" >&6; } - if test "$libbacktrace_cv_sys_native" = "yes"; then - NATIVE_TRUE= - NATIVE_FALSE='#' -else - NATIVE_TRUE='#' - NATIVE_FALSE= -fi - - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -ac_config_files="$ac_config_files Makefile backtrace-supported.h" - - -# We need multilib support, but only if configuring for the target. -ac_config_commands="$ac_config_commands default" - - -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}' - -DEFS=-DHAVE_CONFIG_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 "${NATIVE_TRUE}" && test -z "${NATIVE_FALSE}"; then - as_fn_error "conditional \"NATIVE\" 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 package-unused $as_me version-unused, 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 - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -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 - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -package-unused config.status version-unused -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;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --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 -# - - -# 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"`' - -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; 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; 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' - - - - -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" - -GCC="$GCC" -CC="$CC" -acx_cv_header_stdint="$acx_cv_header_stdint" -acx_cv_type_int8_t="$acx_cv_type_int8_t" -acx_cv_type_int16_t="$acx_cv_type_int16_t" -acx_cv_type_int32_t="$acx_cv_type_int32_t" -acx_cv_type_int64_t="$acx_cv_type_int64_t" -acx_cv_type_intptr_t="$acx_cv_type_intptr_t" -ac_cv_type_uintmax_t="$ac_cv_type_uintmax_t" -ac_cv_type_uintptr_t="$ac_cv_type_uintptr_t" -ac_cv_type_uint64_t="$ac_cv_type_uint64_t" -ac_cv_type_u_int64_t="$ac_cv_type_u_int64_t" -ac_cv_type_u_int32_t="$ac_cv_type_u_int32_t" -ac_cv_type_int_least32_t="$ac_cv_type_int_least32_t" -ac_cv_type_int_fast32_t="$ac_cv_type_int_fast32_t" -ac_cv_sizeof_void_p="$ac_cv_sizeof_void_p" - - -# Variables needed in config.status (file generation) which aren't already -# passed by autoconf. -SUBDIRS="$SUBDIRS" - - -_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 - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "backtrace-supported.h") CONFIG_FILES="$CONFIG_FILES backtrace-supported.h" ;; - "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - - *) 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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :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 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_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" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :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 - "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="" - -# ### 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 - -# ### 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" - - ;; - "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 ;; - "gstdint.h":C) -if test "$GCC" = yes; then - echo "/* generated for " `$CC --version | sed 1q` "*/" > tmp-stdint.h -else - echo "/* generated for $CC */" > tmp-stdint.h -fi - -sed 's/^ *//' >> tmp-stdint.h < -EOF - -if test "$acx_cv_header_stdint" != stdint.h; then - echo "#include " >> tmp-stdint.h -fi -if test "$acx_cv_header_stdint" != stddef.h; then - echo "#include <$acx_cv_header_stdint>" >> tmp-stdint.h -fi - -sed 's/^ *//' >> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <= 199901L - #ifndef _INT64_T - #define _INT64_T - #ifndef __int64_t_defined - #ifndef int64_t - typedef long long int64_t; - #endif - #endif - #endif - #ifndef _UINT64_T - #define _UINT64_T - #ifndef uint64_t - typedef unsigned long long uint64_t; - #endif - #endif - - #elif defined __GNUC__ && defined (__STDC__) && __STDC__-0 - /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and - does not implement __extension__. But that compiler doesn't define - __GNUC_MINOR__. */ - # if __GNUC__ < 2 || (__NeXT__ && !__GNUC_MINOR__) - # define __extension__ - # endif - - # ifndef _INT64_T - # define _INT64_T - # ifndef int64_t - __extension__ typedef long long int64_t; - # endif - # endif - # ifndef _UINT64_T - # define _UINT64_T - # ifndef uint64_t - __extension__ typedef unsigned long long uint64_t; - # endif - # endif - - #elif !defined __STRICT_ANSI__ - # if defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ - - # ifndef _INT64_T - # define _INT64_T - # ifndef int64_t - typedef __int64 int64_t; - # endif - # endif - # ifndef _UINT64_T - # define _UINT64_T - # ifndef uint64_t - typedef unsigned __int64 uint64_t; - # endif - # endif - # endif /* compiler */ - - #endif /* ANSI version */ -EOF -fi - -# ------------- done int64_t types, emit intptr types ------------ -if test "$ac_cv_type_uintptr_t" != yes; then - sed 's/^ *//' >> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h <> tmp-stdint.h < - # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually - # append it here. Only modify Makefiles that have just been created. - # - # Also, get rid of this simulated-VPATH thing that automake does. - cat > vpsed << \_EOF - s!`test -f '$<' || echo '$(srcdir)/'`!! -_EOF - for i in $SUBDIRS; do - case $CONFIG_FILES in - *${i}/Makefile*) - #echo "Adding MULTISUBDIR to $i/Makefile" - sed -f vpsed $i/Makefile > tmp - grep '^MULTISUBDIR =' Makefile >> tmp - mv tmp $i/Makefile - ;; - esac - done - rm vpsed - fi - fi - ;; - - 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/llgo/third_party/gofrontend/libbacktrace/configure.ac b/llgo/third_party/gofrontend/libbacktrace/configure.ac deleted file mode 100644 index ef881122c994abf7c2cc214fa01f3a1468998856..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/configure.ac +++ /dev/null @@ -1,391 +0,0 @@ -# configure.ac -- Backtrace configure script. -# Copyright (C) 2012-2015 Free Software Foundation, Inc. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: - -# (1) Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. - -# (2) 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. - -# (3) The name of the author may not be used to -# endorse or promote products derived from this software without -# specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - -AC_PREREQ(2.64) -AC_INIT(package-unused, version-unused,, libbacktrace) -AC_CONFIG_SRCDIR(backtrace.h) -AC_CONFIG_HEADER(config.h) - -AC_CANONICAL_SYSTEM -target_alias=${target_alias-$host_alias} - -AC_USE_SYSTEM_EXTENSIONS - -libtool_VERSION=1:0:0 -AC_SUBST(libtool_VERSION) - -# 1.11.1: Require that version of automake. -# foreign: Don't require README, INSTALL, NEWS, etc. -# no-define: Don't define PACKAGE and VERSION. -# no-dependencies: Don't generate automatic dependencies. -# (because it breaks when using bootstrap-lean, since some of the -# headers are gone at "make install" time). -# -Wall: Issue all automake warnings. -# -Wno-portability: Don't warn about constructs supported by GNU make. -# (because GCC requires GNU make anyhow). -AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability]) - -AM_MAINTAINER_MODE - -AC_ARG_WITH(target-subdir, -[ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) - -# We must force CC to /not/ be precious variables; otherwise -# the wrong, non-multilib-adjusted value will be used in multilibs. -# As a side effect, we have to subst CFLAGS ourselves. -m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS]) -m4_define([_AC_ARG_VAR_PRECIOUS],[]) -AC_PROG_CC -m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) - -AC_SUBST(CFLAGS) - -AC_PROG_RANLIB - -AC_PROG_AWK -case "$AWK" in -"") AC_MSG_ERROR([can't build without awk]) ;; -esac - -LT_INIT([disable-shared]) -AM_PROG_LIBTOOL - -backtrace_supported=yes - -if test -n "${with_target_subdir}"; then - # We are compiling a GCC library. We can assume that the unwind - # library exists. - AM_ENABLE_MULTILIB(, ..) - BACKTRACE_FILE="backtrace.lo simple.lo" -else - AC_CHECK_HEADER([unwind.h], - [AC_CHECK_FUNC([_Unwind_Backtrace], - [BACKTRACE_FILE="backtrace.lo simple.lo"], - [BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no])], - [BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no]) -fi -AC_SUBST(BACKTRACE_FILE) - -EXTRA_FLAGS= -if test -n "${with_target_subdir}"; then - EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@" -else - AC_CACHE_CHECK([for -funwind-tables option], - [libbacktrace_cv_c_unwind_tables], - [CFLAGS_hold="$CFLAGS" - CFLAGS="$CFLAGS -funwind-tables" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])], - [libbacktrace_cv_c_unwind_tables=yes], - [libbacktrace_cv_c_unwind_tables=no]) - CFLAGS="$CFLAGS_hold"]) - if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then - EXTRA_FLAGS=-funwind-tables - fi - AC_CACHE_CHECK([for -frandom-seed=string option], - [libbacktrace_cv_c_random_seed_string], - [CFLAGS_hold="$CFLAGS" - CFLAGS="$CFLAGS -frandom-seed=conftest.lo" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([], [return 0;])], - [libbacktrace_cv_c_random_seed_string=yes], - [libbacktrace_cv_c_random_seed_string=no]) - CFLAGS="$CFLAGS_hold"]) - if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then - EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@" - fi -fi -AC_SUBST(EXTRA_FLAGS) - -ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \ - -Wmissing-prototypes -Wold-style-definition \ - -Wmissing-format-attribute -Wcast-qual], - [WARN_FLAGS]) - -if test -n "${with_target_subdir}"; then - WARN_FLAGS="$WARN_FLAGS -Werror" -fi - -AC_SUBST(WARN_FLAGS) - -if test -n "${with_target_subdir}"; then - GCC_CHECK_UNWIND_GETIPINFO -else - ac_save_CFFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror-implicit-function-declaration" - AC_MSG_CHECKING([for _Unwind_GetIPInfo]) - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include "unwind.h" - struct _Unwind_Context *context; - int ip_before_insn = 0;], - [return _Unwind_GetIPInfo (context, &ip_before_insn);])], - [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no]) - CFLAGS="$ac_save_CFLAGS" - AC_MSG_RESULT([$have_unwind_getipinfo]) - if test "$have_unwind_getipinfo" = "yes"; then - AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) - fi -fi - -# When building as a target library, shared libraries may want to link -# this in. We don't want to provide another shared library to -# complicate dependencies. Instead, we just compile with -fPIC. -PIC_FLAG= -if test -n "${with_target_subdir}"; then - PIC_FLAG=-fPIC -fi -# Similarly, use -fPIC with --enable-host-shared: -AC_ARG_ENABLE(host-shared, -[AS_HELP_STRING([--enable-host-shared], - [build host code as shared libraries])], -[PIC_FLAG=-fPIC], []) -AC_SUBST(PIC_FLAG) - -# Test for __sync support. -AC_CACHE_CHECK([__sync extensions], -[libbacktrace_cv_sys_sync], -[if test -n "${with_target_subdir}"; then - libbacktrace_cv_sys_sync=yes - else - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([int i;], - [__sync_bool_compare_and_swap (&i, i, i); - __sync_lock_test_and_set (&i, 1); - __sync_lock_release (&i);])], - [libbacktrace_cv_sys_sync=yes], - [libbacktrace_cv_sys_sync=no]) - fi]) -BACKTRACE_SUPPORTS_THREADS=0 -if test "$libbacktrace_cv_sys_sync" = "yes"; then - BACKTRACE_SUPPORTS_THREADS=1 - AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1, - [Define to 1 if you have the __sync functions]) -fi -AC_SUBST(BACKTRACE_SUPPORTS_THREADS) - -# Test for __atomic support. -AC_CACHE_CHECK([__atomic extensions], -[libbacktrace_cv_sys_atomic], -[if test -n "${with_target_subdir}"; then - libbacktrace_cv_sys_atomic=yes - else - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([int i;], - [__atomic_load_n (&i, __ATOMIC_ACQUIRE); - __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])], - [libbacktrace_cv_sys_atomic=yes], - [libbacktrace_cv_sys_atomic=no]) - fi]) -if test "$libbacktrace_cv_sys_atomic" = "yes"; then - AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1, - [Define to 1 if you have the __atomic functions]) -fi - -# The library needs to be able to read the executable itself. Compile -# a file to determine the executable format. The awk script -# filetype.awk prints out the file type. -AC_CACHE_CHECK([output filetype], -[libbacktrace_cv_sys_filetype], -[filetype= -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([int i;], [int j;])], - [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`], - [AC_MSG_FAILURE([compiler failed])]) -libbacktrace_cv_sys_filetype=$filetype]) - -# Match the file type to decide what files to compile. -FORMAT_FILE= -case "$libbacktrace_cv_sys_filetype" in -elf*) FORMAT_FILE="elf.lo" ;; -*) AC_MSG_WARN([could not determine output file type]) - FORMAT_FILE="unknown.lo" - backtrace_supported=no - ;; -esac -AC_SUBST(FORMAT_FILE) - -# ELF defines. -elfsize= -case "$libbacktrace_cv_sys_filetype" in -elf32) elfsize=32 ;; -elf64) elfsize=64 ;; -esac -AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64]) - -BACKTRACE_SUPPORTED=0 -if test "$backtrace_supported" = "yes"; then - BACKTRACE_SUPPORTED=1 -fi -AC_SUBST(BACKTRACE_SUPPORTED) - -GCC_HEADER_STDINT(gstdint.h) - -AC_CHECK_HEADERS(sys/mman.h) -if test "$ac_cv_header_sys_mman_h" = "no"; then - have_mmap=no -else - if test -n "${with_target_subdir}"; then - # When built as a GCC target library, we can't do a link test. We - # simply assume that if we have mman.h, we have mmap. - have_mmap=yes - else - AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no]) - fi -fi -if test "$have_mmap" = "no"; then - VIEW_FILE=read.lo - ALLOC_FILE=alloc.lo -else - VIEW_FILE=mmapio.lo - AC_PREPROC_IFELSE([ -#include -#if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON) - #error no MAP_ANONYMOUS -#endif -], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo]) -fi -AC_SUBST(VIEW_FILE) -AC_SUBST(ALLOC_FILE) - -BACKTRACE_USES_MALLOC=0 -if test "$ALLOC_FILE" = "alloc.lo"; then - BACKTRACE_USES_MALLOC=1 -fi -AC_SUBST(BACKTRACE_USES_MALLOC) - -# Check for dl_iterate_phdr. -AC_CHECK_HEADERS(link.h) -if test "$ac_cv_header_link_h" = "no"; then - have_dl_iterate_phdr=no -else - if test -n "${with_target_subdir}"; then - # When built as a GCC target library, we can't do a link test. - AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes], - [have_dl_iterate_phdr=no]) - case "${host}" in - *-*-solaris2.10*) - # Avoid dl_iterate_phdr on Solaris 10, where it is in the - # header file but is only in -ldl. - have_dl_iterate_phdr=no ;; - esac - else - AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], - [have_dl_iterate_phdr=no]) - fi -fi -if test "$have_dl_iterate_phdr" = "yes"; then - AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.]) -fi - -# Check for the fcntl function. -if test -n "${with_target_subdir}"; then - case "${host}" in - *-*-mingw*) have_fcntl=no ;; - *) have_fcntl=yes ;; - esac -else - AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) -fi -if test "$have_fcntl" = "yes"; then - AC_DEFINE([HAVE_FCNTL], 1, - [Define to 1 if you have the fcntl function]) -fi - -AC_CHECK_DECLS(strnlen) - -# Check for getexecname function. -if test -n "${with_target_subdir}"; then - case "${host}" in - *-*-solaris2*) have_getexecname=yes ;; - *) have_getexecname=no ;; - esac -else - AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no]) -fi -if test "$have_getexecname" = "yes"; then - AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.]) -fi - -AC_CACHE_CHECK([whether tests can run], - [libbacktrace_cv_sys_native], - [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])], - [libbacktrace_cv_sys_native=yes], - [libbacktrace_cv_sys_native=no], - [libbacktrace_cv_sys_native=no])]) -AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes") - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -AC_CONFIG_FILES(Makefile backtrace-supported.h) - -# We need multilib support, but only if configuring for the target. -AC_CONFIG_COMMANDS([default], -[if test -n "$CONFIG_FILES"; then - if test -n "${with_target_subdir}"; then - # Multilibs need MULTISUBDIR defined correctly in certain makefiles so - # that multilib installs will end up installed in the correct place. - # The testsuite needs it for multilib-aware ABI baseline files. - # To work around this not being passed down from config-ml.in -> - # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually - # append it here. Only modify Makefiles that have just been created. - # - # Also, get rid of this simulated-VPATH thing that automake does. - cat > vpsed << \_EOF - s!`test -f '$<' || echo '$(srcdir)/'`!! -_EOF - for i in $SUBDIRS; do - case $CONFIG_FILES in - *${i}/Makefile*) - #echo "Adding MULTISUBDIR to $i/Makefile" - sed -f vpsed $i/Makefile > tmp - grep '^MULTISUBDIR =' Makefile >> tmp - mv tmp $i/Makefile - ;; - esac - done - rm vpsed - fi - fi -], -[ -# Variables needed in config.status (file generation) which aren't already -# passed by autoconf. -SUBDIRS="$SUBDIRS" -]) - -AC_OUTPUT diff --git a/llgo/third_party/gofrontend/libbacktrace/dwarf.c b/llgo/third_party/gofrontend/libbacktrace/dwarf.c deleted file mode 100644 index 919b568c786ce264971d7aa4db807d12ab8d624c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/dwarf.c +++ /dev/null @@ -1,3022 +0,0 @@ -/* dwarf.c -- Get file/line information from DWARF for backtraces. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include - -#include "dwarf2.h" -#include "filenames.h" - -#include "backtrace.h" -#include "internal.h" - -#if !defined(HAVE_DECL_STRNLEN) || !HAVE_DECL_STRNLEN - -/* If strnlen is not declared, provide our own version. */ - -static size_t -xstrnlen (const char *s, size_t maxlen) -{ - size_t i; - - for (i = 0; i < maxlen; ++i) - if (s[i] == '\0') - break; - return i; -} - -#define strnlen xstrnlen - -#endif - -/* A buffer to read DWARF info. */ - -struct dwarf_buf -{ - /* Buffer name for error messages. */ - const char *name; - /* Start of the buffer. */ - const unsigned char *start; - /* Next byte to read. */ - const unsigned char *buf; - /* The number of bytes remaining. */ - size_t left; - /* Whether the data is big-endian. */ - int is_bigendian; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data for error_callback. */ - void *data; - /* Non-zero if we've reported an underflow error. */ - int reported_underflow; -}; - -/* A single attribute in a DWARF abbreviation. */ - -struct attr -{ - /* The attribute name. */ - enum dwarf_attribute name; - /* The attribute form. */ - enum dwarf_form form; -}; - -/* A single DWARF abbreviation. */ - -struct abbrev -{ - /* The abbrev code--the number used to refer to the abbrev. */ - uint64_t code; - /* The entry tag. */ - enum dwarf_tag tag; - /* Non-zero if this abbrev has child entries. */ - int has_children; - /* The number of attributes. */ - size_t num_attrs; - /* The attributes. */ - struct attr *attrs; -}; - -/* The DWARF abbreviations for a compilation unit. This structure - only exists while reading the compilation unit. Most DWARF readers - seem to a hash table to map abbrev ID's to abbrev entries. - However, we primarily care about GCC, and GCC simply issues ID's in - numerical order starting at 1. So we simply keep a sorted vector, - and try to just look up the code. */ - -struct abbrevs -{ - /* The number of abbrevs in the vector. */ - size_t num_abbrevs; - /* The abbrevs, sorted by the code field. */ - struct abbrev *abbrevs; -}; - -/* The different kinds of attribute values. */ - -enum attr_val_encoding -{ - /* An address. */ - ATTR_VAL_ADDRESS, - /* A unsigned integer. */ - ATTR_VAL_UINT, - /* A sigd integer. */ - ATTR_VAL_SINT, - /* A string. */ - ATTR_VAL_STRING, - /* An offset to other data in the containing unit. */ - ATTR_VAL_REF_UNIT, - /* An offset to other data within the .dwarf_info section. */ - ATTR_VAL_REF_INFO, - /* An offset to data in some other section. */ - ATTR_VAL_REF_SECTION, - /* A type signature. */ - ATTR_VAL_REF_TYPE, - /* A block of data (not represented). */ - ATTR_VAL_BLOCK, - /* An expression (not represented). */ - ATTR_VAL_EXPR, -}; - -/* An attribute value. */ - -struct attr_val -{ - /* How the value is stored in the field u. */ - enum attr_val_encoding encoding; - union - { - /* ATTR_VAL_ADDRESS, ATTR_VAL_UINT, ATTR_VAL_REF*. */ - uint64_t uint; - /* ATTR_VAL_SINT. */ - int64_t sint; - /* ATTR_VAL_STRING. */ - const char *string; - /* ATTR_VAL_BLOCK not stored. */ - } u; -}; - -/* The line number program header. */ - -struct line_header -{ - /* The version of the line number information. */ - int version; - /* The minimum instruction length. */ - unsigned int min_insn_len; - /* The maximum number of ops per instruction. */ - unsigned int max_ops_per_insn; - /* The line base for special opcodes. */ - int line_base; - /* The line range for special opcodes. */ - unsigned int line_range; - /* The opcode base--the first special opcode. */ - unsigned int opcode_base; - /* Opcode lengths, indexed by opcode - 1. */ - const unsigned char *opcode_lengths; - /* The number of directory entries. */ - size_t dirs_count; - /* The directory entries. */ - const char **dirs; - /* The number of filenames. */ - size_t filenames_count; - /* The filenames. */ - const char **filenames; -}; - -/* Map a single PC value to a file/line. We will keep a vector of - these sorted by PC value. Each file/line will be correct from the - PC up to the PC of the next entry if there is one. We allocate one - extra entry at the end so that we can use bsearch. */ - -struct line -{ - /* PC. */ - uintptr_t pc; - /* File name. Many entries in the array are expected to point to - the same file name. */ - const char *filename; - /* Line number. */ - int lineno; -}; - -/* A growable vector of line number information. This is used while - reading the line numbers. */ - -struct line_vector -{ - /* Memory. This is an array of struct line. */ - struct backtrace_vector vec; - /* Number of valid mappings. */ - size_t count; -}; - -/* A function described in the debug info. */ - -struct function -{ - /* The name of the function. */ - const char *name; - /* If this is an inlined function, the filename of the call - site. */ - const char *caller_filename; - /* If this is an inlined function, the line number of the call - site. */ - int caller_lineno; - /* Map PC ranges to inlined functions. */ - struct function_addrs *function_addrs; - size_t function_addrs_count; -}; - -/* An address range for a function. This maps a PC value to a - specific function. */ - -struct function_addrs -{ - /* Range is LOW <= PC < HIGH. */ - uint64_t low; - uint64_t high; - /* Function for this address range. */ - struct function *function; -}; - -/* A growable vector of function address ranges. */ - -struct function_vector -{ - /* Memory. This is an array of struct function_addrs. */ - struct backtrace_vector vec; - /* Number of address ranges present. */ - size_t count; -}; - -/* A DWARF compilation unit. This only holds the information we need - to map a PC to a file and line. */ - -struct unit -{ - /* The first entry for this compilation unit. */ - const unsigned char *unit_data; - /* The length of the data for this compilation unit. */ - size_t unit_data_len; - /* The offset of UNIT_DATA from the start of the information for - this compilation unit. */ - size_t unit_data_offset; - /* DWARF version. */ - int version; - /* Whether unit is DWARF64. */ - int is_dwarf64; - /* Address size. */ - int addrsize; - /* Offset into line number information. */ - off_t lineoff; - /* Primary source file. */ - const char *filename; - /* Compilation command working directory. */ - const char *comp_dir; - /* Absolute file name, only set if needed. */ - const char *abs_filename; - /* The abbreviations for this unit. */ - struct abbrevs abbrevs; - - /* The fields above this point are read in during initialization and - may be accessed freely. The fields below this point are read in - as needed, and therefore require care, as different threads may - try to initialize them simultaneously. */ - - /* PC to line number mapping. This is NULL if the values have not - been read. This is (struct line *) -1 if there was an error - reading the values. */ - struct line *lines; - /* Number of entries in lines. */ - size_t lines_count; - /* PC ranges to function. */ - struct function_addrs *function_addrs; - size_t function_addrs_count; -}; - -/* An address range for a compilation unit. This maps a PC value to a - specific compilation unit. Note that we invert the representation - in DWARF: instead of listing the units and attaching a list of - ranges, we list the ranges and have each one point to the unit. - This lets us do a binary search to find the unit. */ - -struct unit_addrs -{ - /* Range is LOW <= PC < HIGH. */ - uint64_t low; - uint64_t high; - /* Compilation unit for this address range. */ - struct unit *u; -}; - -/* A growable vector of compilation unit address ranges. */ - -struct unit_addrs_vector -{ - /* Memory. This is an array of struct unit_addrs. */ - struct backtrace_vector vec; - /* Number of address ranges present. */ - size_t count; -}; - -/* The information we need to map a PC to a file and line. */ - -struct dwarf_data -{ - /* The data for the next file we know about. */ - struct dwarf_data *next; - /* The base address for this file. */ - uintptr_t base_address; - /* A sorted list of address ranges. */ - struct unit_addrs *addrs; - /* Number of address ranges in list. */ - size_t addrs_count; - /* The unparsed .debug_info section. */ - const unsigned char *dwarf_info; - size_t dwarf_info_size; - /* The unparsed .debug_line section. */ - const unsigned char *dwarf_line; - size_t dwarf_line_size; - /* The unparsed .debug_ranges section. */ - const unsigned char *dwarf_ranges; - size_t dwarf_ranges_size; - /* The unparsed .debug_str section. */ - const unsigned char *dwarf_str; - size_t dwarf_str_size; - /* Whether the data is big-endian or not. */ - int is_bigendian; - /* A vector used for function addresses. We keep this here so that - we can grow the vector as we read more functions. */ - struct function_vector fvec; -}; - -/* Report an error for a DWARF buffer. */ - -static void -dwarf_buf_error (struct dwarf_buf *buf, const char *msg) -{ - char b[200]; - - snprintf (b, sizeof b, "%s in %s at %d", - msg, buf->name, (int) (buf->buf - buf->start)); - buf->error_callback (buf->data, b, 0); -} - -/* Require at least COUNT bytes in BUF. Return 1 if all is well, 0 on - error. */ - -static int -require (struct dwarf_buf *buf, size_t count) -{ - if (buf->left >= count) - return 1; - - if (!buf->reported_underflow) - { - dwarf_buf_error (buf, "DWARF underflow"); - buf->reported_underflow = 1; - } - - return 0; -} - -/* Advance COUNT bytes in BUF. Return 1 if all is well, 0 on - error. */ - -static int -advance (struct dwarf_buf *buf, size_t count) -{ - if (!require (buf, count)) - return 0; - buf->buf += count; - buf->left -= count; - return 1; -} - -/* Read one byte from BUF and advance 1 byte. */ - -static unsigned char -read_byte (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 1)) - return 0; - return p[0]; -} - -/* Read a signed char from BUF and advance 1 byte. */ - -static signed char -read_sbyte (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 1)) - return 0; - return (*p ^ 0x80) - 0x80; -} - -/* Read a uint16 from BUF and advance 2 bytes. */ - -static uint16_t -read_uint16 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 2)) - return 0; - if (buf->is_bigendian) - return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; - else - return ((uint16_t) p[1] << 8) | (uint16_t) p[0]; -} - -/* Read a uint32 from BUF and advance 4 bytes. */ - -static uint32_t -read_uint32 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 4)) - return 0; - if (buf->is_bigendian) - return (((uint32_t) p[0] << 24) | ((uint32_t) p[1] << 16) - | ((uint32_t) p[2] << 8) | (uint32_t) p[3]); - else - return (((uint32_t) p[3] << 24) | ((uint32_t) p[2] << 16) - | ((uint32_t) p[1] << 8) | (uint32_t) p[0]); -} - -/* Read a uint64 from BUF and advance 8 bytes. */ - -static uint64_t -read_uint64 (struct dwarf_buf *buf) -{ - const unsigned char *p = buf->buf; - - if (!advance (buf, 8)) - return 0; - if (buf->is_bigendian) - return (((uint64_t) p[0] << 56) | ((uint64_t) p[1] << 48) - | ((uint64_t) p[2] << 40) | ((uint64_t) p[3] << 32) - | ((uint64_t) p[4] << 24) | ((uint64_t) p[5] << 16) - | ((uint64_t) p[6] << 8) | (uint64_t) p[7]); - else - return (((uint64_t) p[7] << 56) | ((uint64_t) p[6] << 48) - | ((uint64_t) p[5] << 40) | ((uint64_t) p[4] << 32) - | ((uint64_t) p[3] << 24) | ((uint64_t) p[2] << 16) - | ((uint64_t) p[1] << 8) | (uint64_t) p[0]); -} - -/* Read an offset from BUF and advance the appropriate number of - bytes. */ - -static uint64_t -read_offset (struct dwarf_buf *buf, int is_dwarf64) -{ - if (is_dwarf64) - return read_uint64 (buf); - else - return read_uint32 (buf); -} - -/* Read an address from BUF and advance the appropriate number of - bytes. */ - -static uint64_t -read_address (struct dwarf_buf *buf, int addrsize) -{ - switch (addrsize) - { - case 1: - return read_byte (buf); - case 2: - return read_uint16 (buf); - case 4: - return read_uint32 (buf); - case 8: - return read_uint64 (buf); - default: - dwarf_buf_error (buf, "unrecognized address size"); - return 0; - } -} - -/* Return whether a value is the highest possible address, given the - address size. */ - -static int -is_highest_address (uint64_t address, int addrsize) -{ - switch (addrsize) - { - case 1: - return address == (unsigned char) -1; - case 2: - return address == (uint16_t) -1; - case 4: - return address == (uint32_t) -1; - case 8: - return address == (uint64_t) -1; - default: - return 0; - } -} - -/* Read an unsigned LEB128 number. */ - -static uint64_t -read_uleb128 (struct dwarf_buf *buf) -{ - uint64_t ret; - unsigned int shift; - int overflow; - unsigned char b; - - ret = 0; - shift = 0; - overflow = 0; - do - { - const unsigned char *p; - - p = buf->buf; - if (!advance (buf, 1)) - return 0; - b = *p; - if (shift < 64) - ret |= ((uint64_t) (b & 0x7f)) << shift; - else if (!overflow) - { - dwarf_buf_error (buf, "LEB128 overflows uint64_t"); - overflow = 1; - } - shift += 7; - } - while ((b & 0x80) != 0); - - return ret; -} - -/* Read a signed LEB128 number. */ - -static int64_t -read_sleb128 (struct dwarf_buf *buf) -{ - uint64_t val; - unsigned int shift; - int overflow; - unsigned char b; - - val = 0; - shift = 0; - overflow = 0; - do - { - const unsigned char *p; - - p = buf->buf; - if (!advance (buf, 1)) - return 0; - b = *p; - if (shift < 64) - val |= ((uint64_t) (b & 0x7f)) << shift; - else if (!overflow) - { - dwarf_buf_error (buf, "signed LEB128 overflows uint64_t"); - overflow = 1; - } - shift += 7; - } - while ((b & 0x80) != 0); - - if ((b & 0x40) != 0 && shift < 64) - val |= ((uint64_t) -1) << shift; - - return (int64_t) val; -} - -/* Return the length of an LEB128 number. */ - -static size_t -leb128_len (const unsigned char *p) -{ - size_t ret; - - ret = 1; - while ((*p & 0x80) != 0) - { - ++p; - ++ret; - } - return ret; -} - -/* Free an abbreviations structure. */ - -static void -free_abbrevs (struct backtrace_state *state, struct abbrevs *abbrevs, - backtrace_error_callback error_callback, void *data) -{ - size_t i; - - for (i = 0; i < abbrevs->num_abbrevs; ++i) - backtrace_free (state, abbrevs->abbrevs[i].attrs, - abbrevs->abbrevs[i].num_attrs * sizeof (struct attr), - error_callback, data); - backtrace_free (state, abbrevs->abbrevs, - abbrevs->num_abbrevs * sizeof (struct abbrev), - error_callback, data); - abbrevs->num_abbrevs = 0; - abbrevs->abbrevs = NULL; -} - -/* Read an attribute value. Returns 1 on success, 0 on failure. If - the value can be represented as a uint64_t, sets *VAL and sets - *IS_VALID to 1. We don't try to store the value of other attribute - forms, because we don't care about them. */ - -static int -read_attribute (enum dwarf_form form, struct dwarf_buf *buf, - int is_dwarf64, int version, int addrsize, - const unsigned char *dwarf_str, size_t dwarf_str_size, - struct attr_val *val) -{ - /* Avoid warnings about val.u.FIELD may be used uninitialized if - this function is inlined. The warnings aren't valid but can - occur because the different fields are set and used - conditionally. */ - memset (val, 0, sizeof *val); - - switch (form) - { - case DW_FORM_addr: - val->encoding = ATTR_VAL_ADDRESS; - val->u.uint = read_address (buf, addrsize); - return 1; - case DW_FORM_block2: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uint16 (buf)); - case DW_FORM_block4: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uint32 (buf)); - case DW_FORM_data2: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint16 (buf); - return 1; - case DW_FORM_data4: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint32 (buf); - return 1; - case DW_FORM_data8: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_string: - val->encoding = ATTR_VAL_STRING; - val->u.string = (const char *) buf->buf; - return advance (buf, strnlen ((const char *) buf->buf, buf->left) + 1); - case DW_FORM_block: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_uleb128 (buf)); - case DW_FORM_block1: - val->encoding = ATTR_VAL_BLOCK; - return advance (buf, read_byte (buf)); - case DW_FORM_data1: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_flag: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_sdata: - val->encoding = ATTR_VAL_SINT; - val->u.sint = read_sleb128 (buf); - return 1; - case DW_FORM_strp: - { - uint64_t offset; - - offset = read_offset (buf, is_dwarf64); - if (offset >= dwarf_str_size) - { - dwarf_buf_error (buf, "DW_FORM_strp out of range"); - return 0; - } - val->encoding = ATTR_VAL_STRING; - val->u.string = (const char *) dwarf_str + offset; - return 1; - } - case DW_FORM_udata: - val->encoding = ATTR_VAL_UINT; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_ref_addr: - val->encoding = ATTR_VAL_REF_INFO; - if (version == 2) - val->u.uint = read_address (buf, addrsize); - else - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - case DW_FORM_ref1: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_byte (buf); - return 1; - case DW_FORM_ref2: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint16 (buf); - return 1; - case DW_FORM_ref4: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint32 (buf); - return 1; - case DW_FORM_ref8: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_ref_udata: - val->encoding = ATTR_VAL_REF_UNIT; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_indirect: - { - uint64_t form; - - form = read_uleb128 (buf); - return read_attribute ((enum dwarf_form) form, buf, is_dwarf64, - version, addrsize, dwarf_str, dwarf_str_size, - val); - } - case DW_FORM_sec_offset: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - case DW_FORM_exprloc: - val->encoding = ATTR_VAL_EXPR; - return advance (buf, read_uleb128 (buf)); - case DW_FORM_flag_present: - val->encoding = ATTR_VAL_UINT; - val->u.uint = 1; - return 1; - case DW_FORM_ref_sig8: - val->encoding = ATTR_VAL_REF_TYPE; - val->u.uint = read_uint64 (buf); - return 1; - case DW_FORM_GNU_addr_index: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_GNU_str_index: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_uleb128 (buf); - return 1; - case DW_FORM_GNU_ref_alt: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - case DW_FORM_GNU_strp_alt: - val->encoding = ATTR_VAL_REF_SECTION; - val->u.uint = read_offset (buf, is_dwarf64); - return 1; - default: - dwarf_buf_error (buf, "unrecognized DWARF form"); - return 0; - } -} - -/* Compare function_addrs for qsort. When ranges are nested, make the - smallest one sort last. */ - -static int -function_addrs_compare (const void *v1, const void *v2) -{ - const struct function_addrs *a1 = (const struct function_addrs *) v1; - const struct function_addrs *a2 = (const struct function_addrs *) v2; - - if (a1->low < a2->low) - return -1; - if (a1->low > a2->low) - return 1; - if (a1->high < a2->high) - return 1; - if (a1->high > a2->high) - return -1; - return strcmp (a1->function->name, a2->function->name); -} - -/* Compare a PC against a function_addrs for bsearch. Note that if - there are multiple ranges containing PC, which one will be returned - is unpredictable. We compensate for that in dwarf_fileline. */ - -static int -function_addrs_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct function_addrs *entry = (const struct function_addrs *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->low) - return -1; - else if (pc >= entry->high) - return 1; - else - return 0; -} - -/* Add a new compilation unit address range to a vector. Returns 1 on - success, 0 on failure. */ - -static int -add_unit_addr (struct backtrace_state *state, uintptr_t base_address, - struct unit_addrs addrs, - backtrace_error_callback error_callback, void *data, - struct unit_addrs_vector *vec) -{ - struct unit_addrs *p; - - /* Add in the base address of the module here, so that we can look - up the PC directly. */ - addrs.low += base_address; - addrs.high += base_address; - - /* Try to merge with the last entry. */ - if (vec->count > 0) - { - p = (struct unit_addrs *) vec->vec.base + (vec->count - 1); - if ((addrs.low == p->high || addrs.low == p->high + 1) - && addrs.u == p->u) - { - if (addrs.high > p->high) - p->high = addrs.high; - return 1; - } - } - - p = ((struct unit_addrs *) - backtrace_vector_grow (state, sizeof (struct unit_addrs), - error_callback, data, &vec->vec)); - if (p == NULL) - return 0; - - *p = addrs; - ++vec->count; - return 1; -} - -/* Free a unit address vector. */ - -static void -free_unit_addrs_vector (struct backtrace_state *state, - struct unit_addrs_vector *vec, - backtrace_error_callback error_callback, void *data) -{ - struct unit_addrs *addrs; - size_t i; - - addrs = (struct unit_addrs *) vec->vec.base; - for (i = 0; i < vec->count; ++i) - free_abbrevs (state, &addrs[i].u->abbrevs, error_callback, data); -} - -/* Compare unit_addrs for qsort. When ranges are nested, make the - smallest one sort last. */ - -static int -unit_addrs_compare (const void *v1, const void *v2) -{ - const struct unit_addrs *a1 = (const struct unit_addrs *) v1; - const struct unit_addrs *a2 = (const struct unit_addrs *) v2; - - if (a1->low < a2->low) - return -1; - if (a1->low > a2->low) - return 1; - if (a1->high < a2->high) - return 1; - if (a1->high > a2->high) - return -1; - if (a1->u->lineoff < a2->u->lineoff) - return -1; - if (a1->u->lineoff > a2->u->lineoff) - return 1; - return 0; -} - -/* Compare a PC against a unit_addrs for bsearch. Note that if there - are multiple ranges containing PC, which one will be returned is - unpredictable. We compensate for that in dwarf_fileline. */ - -static int -unit_addrs_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct unit_addrs *entry = (const struct unit_addrs *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->low) - return -1; - else if (pc >= entry->high) - return 1; - else - return 0; -} - -/* Sort the line vector by PC. We want a stable sort here. We know - that the pointers are into the same array, so it is safe to compare - them directly. */ - -static int -line_compare (const void *v1, const void *v2) -{ - const struct line *ln1 = (const struct line *) v1; - const struct line *ln2 = (const struct line *) v2; - - if (ln1->pc < ln2->pc) - return -1; - else if (ln1->pc > ln2->pc) - return 1; - else if (ln1 < ln2) - return -1; - else if (ln1 > ln2) - return 1; - else - return 0; -} - -/* Find a PC in a line vector. We always allocate an extra entry at - the end of the lines vector, so that this routine can safely look - at the next entry. Note that when there are multiple mappings for - the same PC value, this will return the last one. */ - -static int -line_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct line *entry = (const struct line *) ventry; - uintptr_t pc; - - pc = *key; - if (pc < entry->pc) - return -1; - else if (pc >= (entry + 1)->pc) - return 1; - else - return 0; -} - -/* Sort the abbrevs by the abbrev code. This function is passed to - both qsort and bsearch. */ - -static int -abbrev_compare (const void *v1, const void *v2) -{ - const struct abbrev *a1 = (const struct abbrev *) v1; - const struct abbrev *a2 = (const struct abbrev *) v2; - - if (a1->code < a2->code) - return -1; - else if (a1->code > a2->code) - return 1; - else - { - /* This really shouldn't happen. It means there are two - different abbrevs with the same code, and that means we don't - know which one lookup_abbrev should return. */ - return 0; - } -} - -/* Read the abbreviation table for a compilation unit. Returns 1 on - success, 0 on failure. */ - -static int -read_abbrevs (struct backtrace_state *state, uint64_t abbrev_offset, - const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size, - int is_bigendian, backtrace_error_callback error_callback, - void *data, struct abbrevs *abbrevs) -{ - struct dwarf_buf abbrev_buf; - struct dwarf_buf count_buf; - size_t num_abbrevs; - - abbrevs->num_abbrevs = 0; - abbrevs->abbrevs = NULL; - - if (abbrev_offset >= dwarf_abbrev_size) - { - error_callback (data, "abbrev offset out of range", 0); - return 0; - } - - abbrev_buf.name = ".debug_abbrev"; - abbrev_buf.start = dwarf_abbrev; - abbrev_buf.buf = dwarf_abbrev + abbrev_offset; - abbrev_buf.left = dwarf_abbrev_size - abbrev_offset; - abbrev_buf.is_bigendian = is_bigendian; - abbrev_buf.error_callback = error_callback; - abbrev_buf.data = data; - abbrev_buf.reported_underflow = 0; - - /* Count the number of abbrevs in this list. */ - - count_buf = abbrev_buf; - num_abbrevs = 0; - while (read_uleb128 (&count_buf) != 0) - { - if (count_buf.reported_underflow) - return 0; - ++num_abbrevs; - // Skip tag. - read_uleb128 (&count_buf); - // Skip has_children. - read_byte (&count_buf); - // Skip attributes. - while (read_uleb128 (&count_buf) != 0) - read_uleb128 (&count_buf); - // Skip form of last attribute. - read_uleb128 (&count_buf); - } - - if (count_buf.reported_underflow) - return 0; - - if (num_abbrevs == 0) - return 1; - - abbrevs->num_abbrevs = num_abbrevs; - abbrevs->abbrevs = ((struct abbrev *) - backtrace_alloc (state, - num_abbrevs * sizeof (struct abbrev), - error_callback, data)); - if (abbrevs->abbrevs == NULL) - return 0; - memset (abbrevs->abbrevs, 0, num_abbrevs * sizeof (struct abbrev)); - - num_abbrevs = 0; - while (1) - { - uint64_t code; - struct abbrev a; - size_t num_attrs; - struct attr *attrs; - - if (abbrev_buf.reported_underflow) - goto fail; - - code = read_uleb128 (&abbrev_buf); - if (code == 0) - break; - - a.code = code; - a.tag = (enum dwarf_tag) read_uleb128 (&abbrev_buf); - a.has_children = read_byte (&abbrev_buf); - - count_buf = abbrev_buf; - num_attrs = 0; - while (read_uleb128 (&count_buf) != 0) - { - ++num_attrs; - read_uleb128 (&count_buf); - } - - if (num_attrs == 0) - { - attrs = NULL; - read_uleb128 (&abbrev_buf); - read_uleb128 (&abbrev_buf); - } - else - { - attrs = ((struct attr *) - backtrace_alloc (state, num_attrs * sizeof *attrs, - error_callback, data)); - if (attrs == NULL) - goto fail; - num_attrs = 0; - while (1) - { - uint64_t name; - uint64_t form; - - name = read_uleb128 (&abbrev_buf); - form = read_uleb128 (&abbrev_buf); - if (name == 0) - break; - attrs[num_attrs].name = (enum dwarf_attribute) name; - attrs[num_attrs].form = (enum dwarf_form) form; - ++num_attrs; - } - } - - a.num_attrs = num_attrs; - a.attrs = attrs; - - abbrevs->abbrevs[num_abbrevs] = a; - ++num_abbrevs; - } - - backtrace_qsort (abbrevs->abbrevs, abbrevs->num_abbrevs, - sizeof (struct abbrev), abbrev_compare); - - return 1; - - fail: - free_abbrevs (state, abbrevs, error_callback, data); - return 0; -} - -/* Return the abbrev information for an abbrev code. */ - -static const struct abbrev * -lookup_abbrev (struct abbrevs *abbrevs, uint64_t code, - backtrace_error_callback error_callback, void *data) -{ - struct abbrev key; - void *p; - - /* With GCC, where abbrevs are simply numbered in order, we should - be able to just look up the entry. */ - if (code - 1 < abbrevs->num_abbrevs - && abbrevs->abbrevs[code - 1].code == code) - return &abbrevs->abbrevs[code - 1]; - - /* Otherwise we have to search. */ - memset (&key, 0, sizeof key); - key.code = code; - p = bsearch (&key, abbrevs->abbrevs, abbrevs->num_abbrevs, - sizeof (struct abbrev), abbrev_compare); - if (p == NULL) - { - error_callback (data, "invalid abbreviation code", 0); - return NULL; - } - return (const struct abbrev *) p; -} - -/* Add non-contiguous address ranges for a compilation unit. Returns - 1 on success, 0 on failure. */ - -static int -add_unit_ranges (struct backtrace_state *state, uintptr_t base_address, - struct unit *u, uint64_t ranges, uint64_t base, - int is_bigendian, const unsigned char *dwarf_ranges, - size_t dwarf_ranges_size, - backtrace_error_callback error_callback, void *data, - struct unit_addrs_vector *addrs) -{ - struct dwarf_buf ranges_buf; - - if (ranges >= dwarf_ranges_size) - { - error_callback (data, "ranges offset out of range", 0); - return 0; - } - - ranges_buf.name = ".debug_ranges"; - ranges_buf.start = dwarf_ranges; - ranges_buf.buf = dwarf_ranges + ranges; - ranges_buf.left = dwarf_ranges_size - ranges; - ranges_buf.is_bigendian = is_bigendian; - ranges_buf.error_callback = error_callback; - ranges_buf.data = data; - ranges_buf.reported_underflow = 0; - - while (1) - { - uint64_t low; - uint64_t high; - - if (ranges_buf.reported_underflow) - return 0; - - low = read_address (&ranges_buf, u->addrsize); - high = read_address (&ranges_buf, u->addrsize); - - if (low == 0 && high == 0) - break; - - if (is_highest_address (low, u->addrsize)) - base = high; - else - { - struct unit_addrs a; - - a.low = low + base; - a.high = high + base; - a.u = u; - if (!add_unit_addr (state, base_address, a, error_callback, data, - addrs)) - return 0; - } - } - - if (ranges_buf.reported_underflow) - return 0; - - return 1; -} - -/* Find the address range covered by a compilation unit, reading from - UNIT_BUF and adding values to U. Returns 1 if all data could be - read, 0 if there is some error. */ - -static int -find_address_ranges (struct backtrace_state *state, uintptr_t base_address, - struct dwarf_buf *unit_buf, - const unsigned char *dwarf_str, size_t dwarf_str_size, - const unsigned char *dwarf_ranges, - size_t dwarf_ranges_size, - int is_bigendian, backtrace_error_callback error_callback, - void *data, struct unit *u, - struct unit_addrs_vector *addrs) -{ - while (unit_buf->left > 0) - { - uint64_t code; - const struct abbrev *abbrev; - uint64_t lowpc; - int have_lowpc; - uint64_t highpc; - int have_highpc; - int highpc_is_relative; - uint64_t ranges; - int have_ranges; - size_t i; - - code = read_uleb128 (unit_buf); - if (code == 0) - return 1; - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return 0; - - lowpc = 0; - have_lowpc = 0; - highpc = 0; - have_highpc = 0; - highpc_is_relative = 0; - ranges = 0; - have_ranges = 0; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, unit_buf, - u->is_dwarf64, u->version, u->addrsize, - dwarf_str, dwarf_str_size, &val)) - return 0; - - switch (abbrev->attrs[i].name) - { - case DW_AT_low_pc: - if (val.encoding == ATTR_VAL_ADDRESS) - { - lowpc = val.u.uint; - have_lowpc = 1; - } - break; - - case DW_AT_high_pc: - if (val.encoding == ATTR_VAL_ADDRESS) - { - highpc = val.u.uint; - have_highpc = 1; - } - else if (val.encoding == ATTR_VAL_UINT) - { - highpc = val.u.uint; - have_highpc = 1; - highpc_is_relative = 1; - } - break; - - case DW_AT_ranges: - if (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_SECTION) - { - ranges = val.u.uint; - have_ranges = 1; - } - break; - - case DW_AT_stmt_list: - if (abbrev->tag == DW_TAG_compile_unit - && (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_SECTION)) - u->lineoff = val.u.uint; - break; - - case DW_AT_name: - if (abbrev->tag == DW_TAG_compile_unit - && val.encoding == ATTR_VAL_STRING) - u->filename = val.u.string; - break; - - case DW_AT_comp_dir: - if (abbrev->tag == DW_TAG_compile_unit - && val.encoding == ATTR_VAL_STRING) - u->comp_dir = val.u.string; - break; - - default: - break; - } - } - - if (abbrev->tag == DW_TAG_compile_unit - || abbrev->tag == DW_TAG_subprogram) - { - if (have_ranges) - { - if (!add_unit_ranges (state, base_address, u, ranges, lowpc, - is_bigendian, dwarf_ranges, - dwarf_ranges_size, error_callback, - data, addrs)) - return 0; - } - else if (have_lowpc && have_highpc) - { - struct unit_addrs a; - - if (highpc_is_relative) - highpc += lowpc; - a.low = lowpc; - a.high = highpc; - a.u = u; - - if (!add_unit_addr (state, base_address, a, error_callback, data, - addrs)) - return 0; - } - - /* If we found the PC range in the DW_TAG_compile_unit, we - can stop now. */ - if (abbrev->tag == DW_TAG_compile_unit - && (have_ranges || (have_lowpc && have_highpc))) - return 1; - } - - if (abbrev->has_children) - { - if (!find_address_ranges (state, base_address, unit_buf, - dwarf_str, dwarf_str_size, - dwarf_ranges, dwarf_ranges_size, - is_bigendian, error_callback, data, - u, addrs)) - return 0; - } - } - - return 1; -} - -/* Build a mapping from address ranges to the compilation units where - the line number information for that range can be found. Returns 1 - on success, 0 on failure. */ - -static int -build_address_map (struct backtrace_state *state, uintptr_t base_address, - const unsigned char *dwarf_info, size_t dwarf_info_size, - const unsigned char *dwarf_abbrev, size_t dwarf_abbrev_size, - const unsigned char *dwarf_ranges, size_t dwarf_ranges_size, - const unsigned char *dwarf_str, size_t dwarf_str_size, - int is_bigendian, backtrace_error_callback error_callback, - void *data, struct unit_addrs_vector *addrs) -{ - struct dwarf_buf info; - struct abbrevs abbrevs; - - memset (&addrs->vec, 0, sizeof addrs->vec); - addrs->count = 0; - - /* Read through the .debug_info section. FIXME: Should we use the - .debug_aranges section? gdb and addr2line don't use it, but I'm - not sure why. */ - - info.name = ".debug_info"; - info.start = dwarf_info; - info.buf = dwarf_info; - info.left = dwarf_info_size; - info.is_bigendian = is_bigendian; - info.error_callback = error_callback; - info.data = data; - info.reported_underflow = 0; - - memset (&abbrevs, 0, sizeof abbrevs); - while (info.left > 0) - { - const unsigned char *unit_data_start; - uint64_t len; - int is_dwarf64; - struct dwarf_buf unit_buf; - int version; - uint64_t abbrev_offset; - int addrsize; - struct unit *u; - - if (info.reported_underflow) - goto fail; - - unit_data_start = info.buf; - - is_dwarf64 = 0; - len = read_uint32 (&info); - if (len == 0xffffffff) - { - len = read_uint64 (&info); - is_dwarf64 = 1; - } - - unit_buf = info; - unit_buf.left = len; - - if (!advance (&info, len)) - goto fail; - - version = read_uint16 (&unit_buf); - if (version < 2 || version > 4) - { - dwarf_buf_error (&unit_buf, "unrecognized DWARF version"); - goto fail; - } - - abbrev_offset = read_offset (&unit_buf, is_dwarf64); - if (!read_abbrevs (state, abbrev_offset, dwarf_abbrev, dwarf_abbrev_size, - is_bigendian, error_callback, data, &abbrevs)) - goto fail; - - addrsize = read_byte (&unit_buf); - - u = ((struct unit *) - backtrace_alloc (state, sizeof *u, error_callback, data)); - if (u == NULL) - goto fail; - u->unit_data = unit_buf.buf; - u->unit_data_len = unit_buf.left; - u->unit_data_offset = unit_buf.buf - unit_data_start; - u->version = version; - u->is_dwarf64 = is_dwarf64; - u->addrsize = addrsize; - u->filename = NULL; - u->comp_dir = NULL; - u->abs_filename = NULL; - u->lineoff = 0; - u->abbrevs = abbrevs; - memset (&abbrevs, 0, sizeof abbrevs); - - /* The actual line number mappings will be read as needed. */ - u->lines = NULL; - u->lines_count = 0; - u->function_addrs = NULL; - u->function_addrs_count = 0; - - if (!find_address_ranges (state, base_address, &unit_buf, - dwarf_str, dwarf_str_size, - dwarf_ranges, dwarf_ranges_size, - is_bigendian, error_callback, data, - u, addrs)) - { - free_abbrevs (state, &u->abbrevs, error_callback, data); - backtrace_free (state, u, sizeof *u, error_callback, data); - goto fail; - } - - if (unit_buf.reported_underflow) - { - free_abbrevs (state, &u->abbrevs, error_callback, data); - backtrace_free (state, u, sizeof *u, error_callback, data); - goto fail; - } - } - if (info.reported_underflow) - goto fail; - - return 1; - - fail: - free_abbrevs (state, &abbrevs, error_callback, data); - free_unit_addrs_vector (state, addrs, error_callback, data); - return 0; -} - -/* Add a new mapping to the vector of line mappings that we are - building. Returns 1 on success, 0 on failure. */ - -static int -add_line (struct backtrace_state *state, struct dwarf_data *ddata, - uintptr_t pc, const char *filename, int lineno, - backtrace_error_callback error_callback, void *data, - struct line_vector *vec) -{ - struct line *ln; - - /* If we are adding the same mapping, ignore it. This can happen - when using discriminators. */ - if (vec->count > 0) - { - ln = (struct line *) vec->vec.base + (vec->count - 1); - if (pc == ln->pc && filename == ln->filename && lineno == ln->lineno) - return 1; - } - - ln = ((struct line *) - backtrace_vector_grow (state, sizeof (struct line), error_callback, - data, &vec->vec)); - if (ln == NULL) - return 0; - - /* Add in the base address here, so that we can look up the PC - directly. */ - ln->pc = pc + ddata->base_address; - - ln->filename = filename; - ln->lineno = lineno; - - ++vec->count; - - return 1; -} - -/* Free the line header information. If FREE_FILENAMES is true we - free the file names themselves, otherwise we leave them, as there - may be line structures pointing to them. */ - -static void -free_line_header (struct backtrace_state *state, struct line_header *hdr, - backtrace_error_callback error_callback, void *data) -{ - backtrace_free (state, hdr->dirs, hdr->dirs_count * sizeof (const char *), - error_callback, data); - backtrace_free (state, hdr->filenames, - hdr->filenames_count * sizeof (char *), - error_callback, data); -} - -/* Read the line header. Return 1 on success, 0 on failure. */ - -static int -read_line_header (struct backtrace_state *state, struct unit *u, - int is_dwarf64, struct dwarf_buf *line_buf, - struct line_header *hdr) -{ - uint64_t hdrlen; - struct dwarf_buf hdr_buf; - const unsigned char *p; - const unsigned char *pend; - size_t i; - - hdr->version = read_uint16 (line_buf); - if (hdr->version < 2 || hdr->version > 4) - { - dwarf_buf_error (line_buf, "unsupported line number version"); - return 0; - } - - hdrlen = read_offset (line_buf, is_dwarf64); - - hdr_buf = *line_buf; - hdr_buf.left = hdrlen; - - if (!advance (line_buf, hdrlen)) - return 0; - - hdr->min_insn_len = read_byte (&hdr_buf); - if (hdr->version < 4) - hdr->max_ops_per_insn = 1; - else - hdr->max_ops_per_insn = read_byte (&hdr_buf); - - /* We don't care about default_is_stmt. */ - read_byte (&hdr_buf); - - hdr->line_base = read_sbyte (&hdr_buf); - hdr->line_range = read_byte (&hdr_buf); - - hdr->opcode_base = read_byte (&hdr_buf); - hdr->opcode_lengths = hdr_buf.buf; - if (!advance (&hdr_buf, hdr->opcode_base - 1)) - return 0; - - /* Count the number of directory entries. */ - hdr->dirs_count = 0; - p = hdr_buf.buf; - pend = p + hdr_buf.left; - while (p < pend && *p != '\0') - { - p += strnlen((const char *) p, pend - p) + 1; - ++hdr->dirs_count; - } - - hdr->dirs = ((const char **) - backtrace_alloc (state, - hdr->dirs_count * sizeof (const char *), - line_buf->error_callback, line_buf->data)); - if (hdr->dirs == NULL) - return 0; - - i = 0; - while (*hdr_buf.buf != '\0') - { - if (hdr_buf.reported_underflow) - return 0; - - hdr->dirs[i] = (const char *) hdr_buf.buf; - ++i; - if (!advance (&hdr_buf, - strnlen ((const char *) hdr_buf.buf, hdr_buf.left) + 1)) - return 0; - } - if (!advance (&hdr_buf, 1)) - return 0; - - /* Count the number of file entries. */ - hdr->filenames_count = 0; - p = hdr_buf.buf; - pend = p + hdr_buf.left; - while (p < pend && *p != '\0') - { - p += strnlen ((const char *) p, pend - p) + 1; - p += leb128_len (p); - p += leb128_len (p); - p += leb128_len (p); - ++hdr->filenames_count; - } - - hdr->filenames = ((const char **) - backtrace_alloc (state, - hdr->filenames_count * sizeof (char *), - line_buf->error_callback, - line_buf->data)); - if (hdr->filenames == NULL) - return 0; - i = 0; - while (*hdr_buf.buf != '\0') - { - const char *filename; - uint64_t dir_index; - - if (hdr_buf.reported_underflow) - return 0; - - filename = (const char *) hdr_buf.buf; - if (!advance (&hdr_buf, - strnlen ((const char *) hdr_buf.buf, hdr_buf.left) + 1)) - return 0; - dir_index = read_uleb128 (&hdr_buf); - if (IS_ABSOLUTE_PATH (filename) - || (dir_index == 0 && u->comp_dir == NULL)) - hdr->filenames[i] = filename; - else - { - const char *dir; - size_t dir_len; - size_t filename_len; - char *s; - - if (dir_index == 0) - dir = u->comp_dir; - else if (dir_index - 1 < hdr->dirs_count) - dir = hdr->dirs[dir_index - 1]; - else - { - dwarf_buf_error (line_buf, - ("invalid directory index in " - "line number program header")); - return 0; - } - dir_len = strlen (dir); - filename_len = strlen (filename); - s = ((char *) - backtrace_alloc (state, dir_len + filename_len + 2, - line_buf->error_callback, line_buf->data)); - if (s == NULL) - return 0; - memcpy (s, dir, dir_len); - /* FIXME: If we are on a DOS-based file system, and the - directory or the file name use backslashes, then we - should use a backslash here. */ - s[dir_len] = '/'; - memcpy (s + dir_len + 1, filename, filename_len + 1); - hdr->filenames[i] = s; - } - - /* Ignore the modification time and size. */ - read_uleb128 (&hdr_buf); - read_uleb128 (&hdr_buf); - - ++i; - } - - if (hdr_buf.reported_underflow) - return 0; - - return 1; -} - -/* Read the line program, adding line mappings to VEC. Return 1 on - success, 0 on failure. */ - -static int -read_line_program (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, const struct line_header *hdr, - struct dwarf_buf *line_buf, struct line_vector *vec) -{ - uint64_t address; - unsigned int op_index; - const char *reset_filename; - const char *filename; - int lineno; - - address = 0; - op_index = 0; - if (hdr->filenames_count > 0) - reset_filename = hdr->filenames[0]; - else - reset_filename = ""; - filename = reset_filename; - lineno = 1; - while (line_buf->left > 0) - { - unsigned int op; - - op = read_byte (line_buf); - if (op >= hdr->opcode_base) - { - unsigned int advance; - - /* Special opcode. */ - op -= hdr->opcode_base; - advance = op / hdr->line_range; - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - lineno += hdr->line_base + (int) (op % hdr->line_range); - add_line (state, ddata, address, filename, lineno, - line_buf->error_callback, line_buf->data, vec); - } - else if (op == DW_LNS_extended_op) - { - uint64_t len; - - len = read_uleb128 (line_buf); - op = read_byte (line_buf); - switch (op) - { - case DW_LNE_end_sequence: - /* FIXME: Should we mark the high PC here? It seems - that we already have that information from the - compilation unit. */ - address = 0; - op_index = 0; - filename = reset_filename; - lineno = 1; - break; - case DW_LNE_set_address: - address = read_address (line_buf, u->addrsize); - break; - case DW_LNE_define_file: - { - const char *f; - unsigned int dir_index; - - f = (const char *) line_buf->buf; - if (!advance (line_buf, strnlen (f, line_buf->left) + 1)) - return 0; - dir_index = read_uleb128 (line_buf); - /* Ignore that time and length. */ - read_uleb128 (line_buf); - read_uleb128 (line_buf); - if (IS_ABSOLUTE_PATH (f)) - filename = f; - else - { - const char *dir; - size_t dir_len; - size_t f_len; - char *p; - - if (dir_index == 0) - dir = u->comp_dir; - else if (dir_index - 1 < hdr->dirs_count) - dir = hdr->dirs[dir_index - 1]; - else - { - dwarf_buf_error (line_buf, - ("invalid directory index " - "in line number program")); - return 0; - } - dir_len = strlen (dir); - f_len = strlen (f); - p = ((char *) - backtrace_alloc (state, dir_len + f_len + 2, - line_buf->error_callback, - line_buf->data)); - if (p == NULL) - return 0; - memcpy (p, dir, dir_len); - /* FIXME: If we are on a DOS-based file system, - and the directory or the file name use - backslashes, then we should use a backslash - here. */ - p[dir_len] = '/'; - memcpy (p + dir_len + 1, f, f_len + 1); - filename = p; - } - } - break; - case DW_LNE_set_discriminator: - /* We don't care about discriminators. */ - read_uleb128 (line_buf); - break; - default: - if (!advance (line_buf, len - 1)) - return 0; - break; - } - } - else - { - switch (op) - { - case DW_LNS_copy: - add_line (state, ddata, address, filename, lineno, - line_buf->error_callback, line_buf->data, vec); - break; - case DW_LNS_advance_pc: - { - uint64_t advance; - - advance = read_uleb128 (line_buf); - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - } - break; - case DW_LNS_advance_line: - lineno += (int) read_sleb128 (line_buf); - break; - case DW_LNS_set_file: - { - uint64_t fileno; - - fileno = read_uleb128 (line_buf); - if (fileno == 0) - filename = ""; - else - { - if (fileno - 1 >= hdr->filenames_count) - { - dwarf_buf_error (line_buf, - ("invalid file number in " - "line number program")); - return 0; - } - filename = hdr->filenames[fileno - 1]; - } - } - break; - case DW_LNS_set_column: - read_uleb128 (line_buf); - break; - case DW_LNS_negate_stmt: - break; - case DW_LNS_set_basic_block: - break; - case DW_LNS_const_add_pc: - { - unsigned int advance; - - op = 255 - hdr->opcode_base; - advance = op / hdr->line_range; - address += (hdr->min_insn_len * (op_index + advance) - / hdr->max_ops_per_insn); - op_index = (op_index + advance) % hdr->max_ops_per_insn; - } - break; - case DW_LNS_fixed_advance_pc: - address += read_uint16 (line_buf); - op_index = 0; - break; - case DW_LNS_set_prologue_end: - break; - case DW_LNS_set_epilogue_begin: - break; - case DW_LNS_set_isa: - read_uleb128 (line_buf); - break; - default: - { - unsigned int i; - - for (i = hdr->opcode_lengths[op - 1]; i > 0; --i) - read_uleb128 (line_buf); - } - break; - } - } - } - - return 1; -} - -/* Read the line number information for a compilation unit. Returns 1 - on success, 0 on failure. */ - -static int -read_line_info (struct backtrace_state *state, struct dwarf_data *ddata, - backtrace_error_callback error_callback, void *data, - struct unit *u, struct line_header *hdr, struct line **lines, - size_t *lines_count) -{ - struct line_vector vec; - struct dwarf_buf line_buf; - uint64_t len; - int is_dwarf64; - struct line *ln; - - memset (&vec.vec, 0, sizeof vec.vec); - vec.count = 0; - - memset (hdr, 0, sizeof *hdr); - - if (u->lineoff != (off_t) (size_t) u->lineoff - || (size_t) u->lineoff >= ddata->dwarf_line_size) - { - error_callback (data, "unit line offset out of range", 0); - goto fail; - } - - line_buf.name = ".debug_line"; - line_buf.start = ddata->dwarf_line; - line_buf.buf = ddata->dwarf_line + u->lineoff; - line_buf.left = ddata->dwarf_line_size - u->lineoff; - line_buf.is_bigendian = ddata->is_bigendian; - line_buf.error_callback = error_callback; - line_buf.data = data; - line_buf.reported_underflow = 0; - - is_dwarf64 = 0; - len = read_uint32 (&line_buf); - if (len == 0xffffffff) - { - len = read_uint64 (&line_buf); - is_dwarf64 = 1; - } - line_buf.left = len; - - if (!read_line_header (state, u, is_dwarf64, &line_buf, hdr)) - goto fail; - - if (!read_line_program (state, ddata, u, hdr, &line_buf, &vec)) - goto fail; - - if (line_buf.reported_underflow) - goto fail; - - if (vec.count == 0) - { - /* This is not a failure in the sense of a generating an error, - but it is a failure in that sense that we have no useful - information. */ - goto fail; - } - - /* Allocate one extra entry at the end. */ - ln = ((struct line *) - backtrace_vector_grow (state, sizeof (struct line), error_callback, - data, &vec.vec)); - if (ln == NULL) - goto fail; - ln->pc = (uintptr_t) -1; - ln->filename = NULL; - ln->lineno = 0; - - if (!backtrace_vector_release (state, &vec.vec, error_callback, data)) - goto fail; - - ln = (struct line *) vec.vec.base; - backtrace_qsort (ln, vec.count, sizeof (struct line), line_compare); - - *lines = ln; - *lines_count = vec.count; - - return 1; - - fail: - vec.vec.alc += vec.vec.size; - vec.vec.size = 0; - backtrace_vector_release (state, &vec.vec, error_callback, data); - free_line_header (state, hdr, error_callback, data); - *lines = (struct line *) (uintptr_t) -1; - *lines_count = 0; - return 0; -} - -/* Read the name of a function from a DIE referenced by a - DW_AT_abstract_origin or DW_AT_specification tag. OFFSET is within - the same compilation unit. */ - -static const char * -read_referenced_name (struct dwarf_data *ddata, struct unit *u, - uint64_t offset, backtrace_error_callback error_callback, - void *data) -{ - struct dwarf_buf unit_buf; - uint64_t code; - const struct abbrev *abbrev; - const char *ret; - size_t i; - - /* OFFSET is from the start of the data for this compilation unit. - U->unit_data is the data, but it starts U->unit_data_offset bytes - from the beginning. */ - - if (offset < u->unit_data_offset - || offset - u->unit_data_offset >= u->unit_data_len) - { - error_callback (data, - "abstract origin or specification out of range", - 0); - return NULL; - } - - offset -= u->unit_data_offset; - - unit_buf.name = ".debug_info"; - unit_buf.start = ddata->dwarf_info; - unit_buf.buf = u->unit_data + offset; - unit_buf.left = u->unit_data_len - offset; - unit_buf.is_bigendian = ddata->is_bigendian; - unit_buf.error_callback = error_callback; - unit_buf.data = data; - unit_buf.reported_underflow = 0; - - code = read_uleb128 (&unit_buf); - if (code == 0) - { - dwarf_buf_error (&unit_buf, "invalid abstract origin or specification"); - return NULL; - } - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return NULL; - - ret = NULL; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, &unit_buf, - u->is_dwarf64, u->version, u->addrsize, - ddata->dwarf_str, ddata->dwarf_str_size, - &val)) - return NULL; - - switch (abbrev->attrs[i].name) - { - case DW_AT_name: - /* We prefer the linkage name if get one. */ - if (val.encoding == ATTR_VAL_STRING) - ret = val.u.string; - break; - - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: - if (val.encoding == ATTR_VAL_STRING) - return val.u.string; - break; - - case DW_AT_specification: - if (abbrev->attrs[i].form == DW_FORM_ref_addr - || abbrev->attrs[i].form == DW_FORM_ref_sig8) - { - /* This refers to a specification defined in some other - compilation unit. We can handle this case if we - must, but it's harder. */ - break; - } - if (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_UNIT) - { - const char *name; - - name = read_referenced_name (ddata, u, val.u.uint, - error_callback, data); - if (name != NULL) - ret = name; - } - break; - - default: - break; - } - } - - return ret; -} - -/* Add a single range to U that maps to function. Returns 1 on - success, 0 on error. */ - -static int -add_function_range (struct backtrace_state *state, struct dwarf_data *ddata, - struct function *function, uint64_t lowpc, uint64_t highpc, - backtrace_error_callback error_callback, - void *data, struct function_vector *vec) -{ - struct function_addrs *p; - - /* Add in the base address here, so that we can look up the PC - directly. */ - lowpc += ddata->base_address; - highpc += ddata->base_address; - - if (vec->count > 0) - { - p = (struct function_addrs *) vec->vec.base + vec->count - 1; - if ((lowpc == p->high || lowpc == p->high + 1) - && function == p->function) - { - if (highpc > p->high) - p->high = highpc; - return 1; - } - } - - p = ((struct function_addrs *) - backtrace_vector_grow (state, sizeof (struct function_addrs), - error_callback, data, &vec->vec)); - if (p == NULL) - return 0; - - p->low = lowpc; - p->high = highpc; - p->function = function; - ++vec->count; - return 1; -} - -/* Add PC ranges to U that map to FUNCTION. Returns 1 on success, 0 - on error. */ - -static int -add_function_ranges (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, struct function *function, - uint64_t ranges, uint64_t base, - backtrace_error_callback error_callback, void *data, - struct function_vector *vec) -{ - struct dwarf_buf ranges_buf; - - if (ranges >= ddata->dwarf_ranges_size) - { - error_callback (data, "function ranges offset out of range", 0); - return 0; - } - - ranges_buf.name = ".debug_ranges"; - ranges_buf.start = ddata->dwarf_ranges; - ranges_buf.buf = ddata->dwarf_ranges + ranges; - ranges_buf.left = ddata->dwarf_ranges_size - ranges; - ranges_buf.is_bigendian = ddata->is_bigendian; - ranges_buf.error_callback = error_callback; - ranges_buf.data = data; - ranges_buf.reported_underflow = 0; - - while (1) - { - uint64_t low; - uint64_t high; - - if (ranges_buf.reported_underflow) - return 0; - - low = read_address (&ranges_buf, u->addrsize); - high = read_address (&ranges_buf, u->addrsize); - - if (low == 0 && high == 0) - break; - - if (is_highest_address (low, u->addrsize)) - base = high; - else - { - if (!add_function_range (state, ddata, function, low + base, - high + base, error_callback, data, vec)) - return 0; - } - } - - if (ranges_buf.reported_underflow) - return 0; - - return 1; -} - -/* Read one entry plus all its children. Add function addresses to - VEC. Returns 1 on success, 0 on error. */ - -static int -read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, - struct unit *u, uint64_t base, struct dwarf_buf *unit_buf, - const struct line_header *lhdr, - backtrace_error_callback error_callback, void *data, - struct function_vector *vec) -{ - while (unit_buf->left > 0) - { - uint64_t code; - const struct abbrev *abbrev; - int is_function; - struct function *function; - size_t i; - uint64_t lowpc; - int have_lowpc; - uint64_t highpc; - int have_highpc; - int highpc_is_relative; - uint64_t ranges; - int have_ranges; - - code = read_uleb128 (unit_buf); - if (code == 0) - return 1; - - abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); - if (abbrev == NULL) - return 0; - - is_function = (abbrev->tag == DW_TAG_subprogram - || abbrev->tag == DW_TAG_entry_point - || abbrev->tag == DW_TAG_inlined_subroutine); - - function = NULL; - if (is_function) - { - function = ((struct function *) - backtrace_alloc (state, sizeof *function, - error_callback, data)); - if (function == NULL) - return 0; - memset (function, 0, sizeof *function); - } - - lowpc = 0; - have_lowpc = 0; - highpc = 0; - have_highpc = 0; - highpc_is_relative = 0; - ranges = 0; - have_ranges = 0; - for (i = 0; i < abbrev->num_attrs; ++i) - { - struct attr_val val; - - if (!read_attribute (abbrev->attrs[i].form, unit_buf, - u->is_dwarf64, u->version, u->addrsize, - ddata->dwarf_str, ddata->dwarf_str_size, - &val)) - return 0; - - /* The compile unit sets the base address for any address - ranges in the function entries. */ - if (abbrev->tag == DW_TAG_compile_unit - && abbrev->attrs[i].name == DW_AT_low_pc - && val.encoding == ATTR_VAL_ADDRESS) - base = val.u.uint; - - if (is_function) - { - switch (abbrev->attrs[i].name) - { - case DW_AT_call_file: - if (val.encoding == ATTR_VAL_UINT) - { - if (val.u.uint == 0) - function->caller_filename = ""; - else - { - if (val.u.uint - 1 >= lhdr->filenames_count) - { - dwarf_buf_error (unit_buf, - ("invalid file number in " - "DW_AT_call_file attribute")); - return 0; - } - function->caller_filename = - lhdr->filenames[val.u.uint - 1]; - } - } - break; - - case DW_AT_call_line: - if (val.encoding == ATTR_VAL_UINT) - function->caller_lineno = val.u.uint; - break; - - case DW_AT_abstract_origin: - case DW_AT_specification: - if (abbrev->attrs[i].form == DW_FORM_ref_addr - || abbrev->attrs[i].form == DW_FORM_ref_sig8) - { - /* This refers to an abstract origin defined in - some other compilation unit. We can handle - this case if we must, but it's harder. */ - break; - } - if (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_UNIT) - { - const char *name; - - name = read_referenced_name (ddata, u, val.u.uint, - error_callback, data); - if (name != NULL) - function->name = name; - } - break; - - case DW_AT_name: - if (val.encoding == ATTR_VAL_STRING) - { - /* Don't override a name we found in some other - way, as it will normally be more - useful--e.g., this name is normally not - mangled. */ - if (function->name == NULL) - function->name = val.u.string; - } - break; - - case DW_AT_linkage_name: - case DW_AT_MIPS_linkage_name: - if (val.encoding == ATTR_VAL_STRING) - function->name = val.u.string; - break; - - case DW_AT_low_pc: - if (val.encoding == ATTR_VAL_ADDRESS) - { - lowpc = val.u.uint; - have_lowpc = 1; - } - break; - - case DW_AT_high_pc: - if (val.encoding == ATTR_VAL_ADDRESS) - { - highpc = val.u.uint; - have_highpc = 1; - } - else if (val.encoding == ATTR_VAL_UINT) - { - highpc = val.u.uint; - have_highpc = 1; - highpc_is_relative = 1; - } - break; - - case DW_AT_ranges: - if (val.encoding == ATTR_VAL_UINT - || val.encoding == ATTR_VAL_REF_SECTION) - { - ranges = val.u.uint; - have_ranges = 1; - } - break; - - default: - break; - } - } - } - - /* If we couldn't find a name for the function, we have no use - for it. */ - if (is_function && function->name == NULL) - { - backtrace_free (state, function, sizeof *function, - error_callback, data); - is_function = 0; - } - - if (is_function) - { - if (have_ranges) - { - if (!add_function_ranges (state, ddata, u, function, ranges, - base, error_callback, data, vec)) - return 0; - } - else if (have_lowpc && have_highpc) - { - if (highpc_is_relative) - highpc += lowpc; - if (!add_function_range (state, ddata, function, lowpc, highpc, - error_callback, data, vec)) - return 0; - } - else - { - backtrace_free (state, function, sizeof *function, - error_callback, data); - is_function = 0; - } - } - - if (abbrev->has_children) - { - if (!is_function) - { - if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr, - error_callback, data, vec)) - return 0; - } - else - { - struct function_vector fvec; - - /* Gather any information for inlined functions in - FVEC. */ - - memset (&fvec, 0, sizeof fvec); - - if (!read_function_entry (state, ddata, u, base, unit_buf, lhdr, - error_callback, data, &fvec)) - return 0; - - if (fvec.count > 0) - { - struct function_addrs *faddrs; - - if (!backtrace_vector_release (state, &fvec.vec, - error_callback, data)) - return 0; - - faddrs = (struct function_addrs *) fvec.vec.base; - backtrace_qsort (faddrs, fvec.count, - sizeof (struct function_addrs), - function_addrs_compare); - - function->function_addrs = faddrs; - function->function_addrs_count = fvec.count; - } - } - } - } - - return 1; -} - -/* Read function name information for a compilation unit. We look - through the whole unit looking for function tags. */ - -static void -read_function_info (struct backtrace_state *state, struct dwarf_data *ddata, - const struct line_header *lhdr, - backtrace_error_callback error_callback, void *data, - struct unit *u, struct function_vector *fvec, - struct function_addrs **ret_addrs, - size_t *ret_addrs_count) -{ - struct function_vector lvec; - struct function_vector *pfvec; - struct dwarf_buf unit_buf; - struct function_addrs *addrs; - size_t addrs_count; - - /* Use FVEC if it is not NULL. Otherwise use our own vector. */ - if (fvec != NULL) - pfvec = fvec; - else - { - memset (&lvec, 0, sizeof lvec); - pfvec = &lvec; - } - - unit_buf.name = ".debug_info"; - unit_buf.start = ddata->dwarf_info; - unit_buf.buf = u->unit_data; - unit_buf.left = u->unit_data_len; - unit_buf.is_bigendian = ddata->is_bigendian; - unit_buf.error_callback = error_callback; - unit_buf.data = data; - unit_buf.reported_underflow = 0; - - while (unit_buf.left > 0) - { - if (!read_function_entry (state, ddata, u, 0, &unit_buf, lhdr, - error_callback, data, pfvec)) - return; - } - - if (pfvec->count == 0) - return; - - addrs_count = pfvec->count; - - if (fvec == NULL) - { - if (!backtrace_vector_release (state, &lvec.vec, error_callback, data)) - return; - addrs = (struct function_addrs *) pfvec->vec.base; - } - else - { - /* Finish this list of addresses, but leave the remaining space in - the vector available for the next function unit. */ - addrs = ((struct function_addrs *) - backtrace_vector_finish (state, &fvec->vec, - error_callback, data)); - if (addrs == NULL) - return; - fvec->count = 0; - } - - backtrace_qsort (addrs, addrs_count, sizeof (struct function_addrs), - function_addrs_compare); - - *ret_addrs = addrs; - *ret_addrs_count = addrs_count; -} - -/* See if PC is inlined in FUNCTION. If it is, print out the inlined - information, and update FILENAME and LINENO for the caller. - Returns whatever CALLBACK returns, or 0 to keep going. */ - -static int -report_inlined_functions (uintptr_t pc, struct function *function, - backtrace_full_callback callback, void *data, - const char **filename, int *lineno) -{ - struct function_addrs *function_addrs; - struct function *inlined; - int ret; - - if (function->function_addrs_count == 0) - return 0; - - function_addrs = ((struct function_addrs *) - bsearch (&pc, function->function_addrs, - function->function_addrs_count, - sizeof (struct function_addrs), - function_addrs_search)); - if (function_addrs == NULL) - return 0; - - while (((size_t) (function_addrs - function->function_addrs) + 1 - < function->function_addrs_count) - && pc >= (function_addrs + 1)->low - && pc < (function_addrs + 1)->high) - ++function_addrs; - - /* We found an inlined call. */ - - inlined = function_addrs->function; - - /* Report any calls inlined into this one. */ - ret = report_inlined_functions (pc, inlined, callback, data, - filename, lineno); - if (ret != 0) - return ret; - - /* Report this inlined call. */ - ret = callback (data, pc, *filename, *lineno, inlined->name); - if (ret != 0) - return ret; - - /* Our caller will report the caller of the inlined function; tell - it the appropriate filename and line number. */ - *filename = inlined->caller_filename; - *lineno = inlined->caller_lineno; - - return 0; -} - -/* Look for a PC in the DWARF mapping for one module. On success, - call CALLBACK and return whatever it returns. On error, call - ERROR_CALLBACK and return 0. Sets *FOUND to 1 if the PC is found, - 0 if not. */ - -static int -dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata, - uintptr_t pc, backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data, - int *found) -{ - struct unit_addrs *entry; - struct unit *u; - int new_data; - struct line *lines; - struct line *ln; - struct function_addrs *function_addrs; - struct function *function; - const char *filename; - int lineno; - int ret; - - *found = 1; - - /* Find an address range that includes PC. */ - entry = bsearch (&pc, ddata->addrs, ddata->addrs_count, - sizeof (struct unit_addrs), unit_addrs_search); - - if (entry == NULL) - { - *found = 0; - return 0; - } - - /* If there are multiple ranges that contain PC, use the last one, - in order to produce predictable results. If we assume that all - ranges are properly nested, then the last range will be the - smallest one. */ - while ((size_t) (entry - ddata->addrs) + 1 < ddata->addrs_count - && pc >= (entry + 1)->low - && pc < (entry + 1)->high) - ++entry; - - /* We need the lines, lines_count, function_addrs, - function_addrs_count fields of u. If they are not set, we need - to set them. When running in threaded mode, we need to allow for - the possibility that some other thread is setting them - simultaneously. */ - - u = entry->u; - lines = u->lines; - - /* Skip units with no useful line number information by walking - backward. Useless line number information is marked by setting - lines == -1. */ - while (entry > ddata->addrs - && pc >= (entry - 1)->low - && pc < (entry - 1)->high) - { - if (state->threaded) - lines = (struct line *) backtrace_atomic_load_pointer (&u->lines); - - if (lines != (struct line *) (uintptr_t) -1) - break; - - --entry; - - u = entry->u; - lines = u->lines; - } - - if (state->threaded) - lines = backtrace_atomic_load_pointer (&u->lines); - - new_data = 0; - if (lines == NULL) - { - size_t function_addrs_count; - struct line_header lhdr; - size_t count; - - /* We have never read the line information for this unit. Read - it now. */ - - function_addrs = NULL; - function_addrs_count = 0; - if (read_line_info (state, ddata, error_callback, data, entry->u, &lhdr, - &lines, &count)) - { - struct function_vector *pfvec; - - /* If not threaded, reuse DDATA->FVEC for better memory - consumption. */ - if (state->threaded) - pfvec = NULL; - else - pfvec = &ddata->fvec; - read_function_info (state, ddata, &lhdr, error_callback, data, - entry->u, pfvec, &function_addrs, - &function_addrs_count); - free_line_header (state, &lhdr, error_callback, data); - new_data = 1; - } - - /* Atomically store the information we just read into the unit. - If another thread is simultaneously writing, it presumably - read the same information, and we don't care which one we - wind up with; we just leak the other one. We do have to - write the lines field last, so that the acquire-loads above - ensure that the other fields are set. */ - - if (!state->threaded) - { - u->lines_count = count; - u->function_addrs = function_addrs; - u->function_addrs_count = function_addrs_count; - u->lines = lines; - } - else - { - backtrace_atomic_store_size_t (&u->lines_count, count); - backtrace_atomic_store_pointer (&u->function_addrs, function_addrs); - backtrace_atomic_store_size_t (&u->function_addrs_count, - function_addrs_count); - backtrace_atomic_store_pointer (&u->lines, lines); - } - } - - /* Now all fields of U have been initialized. */ - - if (lines == (struct line *) (uintptr_t) -1) - { - /* If reading the line number information failed in some way, - try again to see if there is a better compilation unit for - this PC. */ - if (new_data) - return dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, found); - return callback (data, pc, NULL, 0, NULL); - } - - /* Search for PC within this unit. */ - - ln = (struct line *) bsearch (&pc, lines, entry->u->lines_count, - sizeof (struct line), line_search); - if (ln == NULL) - { - /* The PC is between the low_pc and high_pc attributes of the - compilation unit, but no entry in the line table covers it. - This implies that the start of the compilation unit has no - line number information. */ - - if (entry->u->abs_filename == NULL) - { - const char *filename; - - filename = entry->u->filename; - if (filename != NULL - && !IS_ABSOLUTE_PATH (filename) - && entry->u->comp_dir != NULL) - { - size_t filename_len; - const char *dir; - size_t dir_len; - char *s; - - filename_len = strlen (filename); - dir = entry->u->comp_dir; - dir_len = strlen (dir); - s = (char *) backtrace_alloc (state, dir_len + filename_len + 2, - error_callback, data); - if (s == NULL) - { - *found = 0; - return 0; - } - memcpy (s, dir, dir_len); - /* FIXME: Should use backslash if DOS file system. */ - s[dir_len] = '/'; - memcpy (s + dir_len + 1, filename, filename_len + 1); - filename = s; - } - entry->u->abs_filename = filename; - } - - return callback (data, pc, entry->u->abs_filename, 0, NULL); - } - - /* Search for function name within this unit. */ - - if (entry->u->function_addrs_count == 0) - return callback (data, pc, ln->filename, ln->lineno, NULL); - - function_addrs = ((struct function_addrs *) - bsearch (&pc, entry->u->function_addrs, - entry->u->function_addrs_count, - sizeof (struct function_addrs), - function_addrs_search)); - if (function_addrs == NULL) - return callback (data, pc, ln->filename, ln->lineno, NULL); - - /* If there are multiple function ranges that contain PC, use the - last one, in order to produce predictable results. */ - - while (((size_t) (function_addrs - entry->u->function_addrs + 1) - < entry->u->function_addrs_count) - && pc >= (function_addrs + 1)->low - && pc < (function_addrs + 1)->high) - ++function_addrs; - - function = function_addrs->function; - - filename = ln->filename; - lineno = ln->lineno; - - ret = report_inlined_functions (pc, function, callback, data, - &filename, &lineno); - if (ret != 0) - return ret; - - return callback (data, pc, filename, lineno, function->name); -} - - -/* Return the file/line information for a PC using the DWARF mapping - we built earlier. */ - -static int -dwarf_fileline (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct dwarf_data *ddata; - int found; - int ret; - - if (!state->threaded) - { - for (ddata = (struct dwarf_data *) state->fileline_data; - ddata != NULL; - ddata = ddata->next) - { - ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, &found); - if (ret != 0 || found) - return ret; - } - } - else - { - struct dwarf_data **pp; - - pp = (struct dwarf_data **) (void *) &state->fileline_data; - while (1) - { - ddata = backtrace_atomic_load_pointer (pp); - if (ddata == NULL) - break; - - ret = dwarf_lookup_pc (state, ddata, pc, callback, error_callback, - data, &found); - if (ret != 0 || found) - return ret; - - pp = &ddata->next; - } - } - - /* FIXME: See if any libraries have been dlopen'ed. */ - - return callback (data, pc, NULL, 0, NULL); -} - -/* Initialize our data structures from the DWARF debug info for a - file. Return NULL on failure. */ - -static struct dwarf_data * -build_dwarf_data (struct backtrace_state *state, - uintptr_t base_address, - const unsigned char *dwarf_info, - size_t dwarf_info_size, - const unsigned char *dwarf_line, - size_t dwarf_line_size, - const unsigned char *dwarf_abbrev, - size_t dwarf_abbrev_size, - const unsigned char *dwarf_ranges, - size_t dwarf_ranges_size, - const unsigned char *dwarf_str, - size_t dwarf_str_size, - int is_bigendian, - backtrace_error_callback error_callback, - void *data) -{ - struct unit_addrs_vector addrs_vec; - struct unit_addrs *addrs; - size_t addrs_count; - struct dwarf_data *fdata; - - if (!build_address_map (state, base_address, dwarf_info, dwarf_info_size, - dwarf_abbrev, dwarf_abbrev_size, dwarf_ranges, - dwarf_ranges_size, dwarf_str, dwarf_str_size, - is_bigendian, error_callback, data, &addrs_vec)) - return NULL; - - if (!backtrace_vector_release (state, &addrs_vec.vec, error_callback, data)) - return NULL; - addrs = (struct unit_addrs *) addrs_vec.vec.base; - addrs_count = addrs_vec.count; - backtrace_qsort (addrs, addrs_count, sizeof (struct unit_addrs), - unit_addrs_compare); - - fdata = ((struct dwarf_data *) - backtrace_alloc (state, sizeof (struct dwarf_data), - error_callback, data)); - if (fdata == NULL) - return NULL; - - fdata->next = NULL; - fdata->base_address = base_address; - fdata->addrs = addrs; - fdata->addrs_count = addrs_count; - fdata->dwarf_info = dwarf_info; - fdata->dwarf_info_size = dwarf_info_size; - fdata->dwarf_line = dwarf_line; - fdata->dwarf_line_size = dwarf_line_size; - fdata->dwarf_ranges = dwarf_ranges; - fdata->dwarf_ranges_size = dwarf_ranges_size; - fdata->dwarf_str = dwarf_str; - fdata->dwarf_str_size = dwarf_str_size; - fdata->is_bigendian = is_bigendian; - memset (&fdata->fvec, 0, sizeof fdata->fvec); - - return fdata; -} - -/* Build our data structures from the DWARF sections for a module. - Set FILELINE_FN and STATE->FILELINE_DATA. Return 1 on success, 0 - on failure. */ - -int -backtrace_dwarf_add (struct backtrace_state *state, - uintptr_t base_address, - const unsigned char *dwarf_info, - size_t dwarf_info_size, - const unsigned char *dwarf_line, - size_t dwarf_line_size, - const unsigned char *dwarf_abbrev, - size_t dwarf_abbrev_size, - const unsigned char *dwarf_ranges, - size_t dwarf_ranges_size, - const unsigned char *dwarf_str, - size_t dwarf_str_size, - int is_bigendian, - backtrace_error_callback error_callback, - void *data, fileline *fileline_fn) -{ - struct dwarf_data *fdata; - - fdata = build_dwarf_data (state, base_address, dwarf_info, dwarf_info_size, - dwarf_line, dwarf_line_size, dwarf_abbrev, - dwarf_abbrev_size, dwarf_ranges, dwarf_ranges_size, - dwarf_str, dwarf_str_size, is_bigendian, - error_callback, data); - if (fdata == NULL) - return 0; - - if (!state->threaded) - { - struct dwarf_data **pp; - - for (pp = (struct dwarf_data **) (void *) &state->fileline_data; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = fdata; - } - else - { - while (1) - { - struct dwarf_data **pp; - - pp = (struct dwarf_data **) (void *) &state->fileline_data; - - while (1) - { - struct dwarf_data *p; - - p = backtrace_atomic_load_pointer (pp); - - if (p == NULL) - break; - - pp = &p->next; - } - - if (__sync_bool_compare_and_swap (pp, NULL, fdata)) - break; - } - } - - *fileline_fn = dwarf_fileline; - - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/elf.c b/llgo/third_party/gofrontend/libbacktrace/elf.c deleted file mode 100644 index 3f14b11a43c8388f9220122ce8b3e47e1137e0b5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/elf.c +++ /dev/null @@ -1,976 +0,0 @@ -/* elf.c -- Get debug data from an ELF file for backtraces. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include - -#ifdef HAVE_DL_ITERATE_PHDR -#include -#endif - -#include "backtrace.h" -#include "internal.h" - -#ifndef HAVE_DL_ITERATE_PHDR - -/* Dummy version of dl_iterate_phdr for systems that don't have it. */ - -#define dl_phdr_info x_dl_phdr_info -#define dl_iterate_phdr x_dl_iterate_phdr - -struct dl_phdr_info -{ - uintptr_t dlpi_addr; - const char *dlpi_name; -}; - -static int -dl_iterate_phdr (int (*callback) (struct dl_phdr_info *, - size_t, void *) ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - return 0; -} - -#endif /* ! defined (HAVE_DL_ITERATE_PHDR) */ - -/* The configure script must tell us whether we are 32-bit or 64-bit - ELF. We could make this code test and support either possibility, - but there is no point. This code only works for the currently - running executable, which means that we know the ELF mode at - configure mode. */ - -#if BACKTRACE_ELF_SIZE != 32 && BACKTRACE_ELF_SIZE != 64 -#error "Unknown BACKTRACE_ELF_SIZE" -#endif - -/* might #include which might define our constants - with slightly different values. Undefine them to be safe. */ - -#undef EI_NIDENT -#undef EI_MAG0 -#undef EI_MAG1 -#undef EI_MAG2 -#undef EI_MAG3 -#undef EI_CLASS -#undef EI_DATA -#undef EI_VERSION -#undef ELF_MAG0 -#undef ELF_MAG1 -#undef ELF_MAG2 -#undef ELF_MAG3 -#undef ELFCLASS32 -#undef ELFCLASS64 -#undef ELFDATA2LSB -#undef ELFDATA2MSB -#undef EV_CURRENT -#undef ET_DYN -#undef SHN_LORESERVE -#undef SHN_XINDEX -#undef SHN_UNDEF -#undef SHT_SYMTAB -#undef SHT_STRTAB -#undef SHT_DYNSYM -#undef STT_OBJECT -#undef STT_FUNC - -/* Basic types. */ - -typedef uint16_t b_elf_half; /* Elf_Half. */ -typedef uint32_t b_elf_word; /* Elf_Word. */ -typedef int32_t b_elf_sword; /* Elf_Sword. */ - -#if BACKTRACE_ELF_SIZE == 32 - -typedef uint32_t b_elf_addr; /* Elf_Addr. */ -typedef uint32_t b_elf_off; /* Elf_Off. */ - -typedef uint32_t b_elf_wxword; /* 32-bit Elf_Word, 64-bit ELF_Xword. */ - -#else - -typedef uint64_t b_elf_addr; /* Elf_Addr. */ -typedef uint64_t b_elf_off; /* Elf_Off. */ -typedef uint64_t b_elf_xword; /* Elf_Xword. */ -typedef int64_t b_elf_sxword; /* Elf_Sxword. */ - -typedef uint64_t b_elf_wxword; /* 32-bit Elf_Word, 64-bit ELF_Xword. */ - -#endif - -/* Data structures and associated constants. */ - -#define EI_NIDENT 16 - -typedef struct { - unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ - b_elf_half e_type; /* Identifies object file type */ - b_elf_half e_machine; /* Specifies required architecture */ - b_elf_word e_version; /* Identifies object file version */ - b_elf_addr e_entry; /* Entry point virtual address */ - b_elf_off e_phoff; /* Program header table file offset */ - b_elf_off e_shoff; /* Section header table file offset */ - b_elf_word e_flags; /* Processor-specific flags */ - b_elf_half e_ehsize; /* ELF header size in bytes */ - b_elf_half e_phentsize; /* Program header table entry size */ - b_elf_half e_phnum; /* Program header table entry count */ - b_elf_half e_shentsize; /* Section header table entry size */ - b_elf_half e_shnum; /* Section header table entry count */ - b_elf_half e_shstrndx; /* Section header string table index */ -} b_elf_ehdr; /* Elf_Ehdr. */ - -#define EI_MAG0 0 -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 - -#define ELFMAG0 0x7f -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' - -#define ELFCLASS32 1 -#define ELFCLASS64 2 - -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -#define EV_CURRENT 1 - -#define ET_DYN 3 - -typedef struct { - b_elf_word sh_name; /* Section name, index in string tbl */ - b_elf_word sh_type; /* Type of section */ - b_elf_wxword sh_flags; /* Miscellaneous section attributes */ - b_elf_addr sh_addr; /* Section virtual addr at execution */ - b_elf_off sh_offset; /* Section file offset */ - b_elf_wxword sh_size; /* Size of section in bytes */ - b_elf_word sh_link; /* Index of another section */ - b_elf_word sh_info; /* Additional section information */ - b_elf_wxword sh_addralign; /* Section alignment */ - b_elf_wxword sh_entsize; /* Entry size if section holds table */ -} b_elf_shdr; /* Elf_Shdr. */ - -#define SHN_UNDEF 0x0000 /* Undefined section */ -#define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */ -#define SHN_XINDEX 0xFFFF /* Section index is held elsewhere */ - -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_DYNSYM 11 - -#if BACKTRACE_ELF_SIZE == 32 - -typedef struct -{ - b_elf_word st_name; /* Symbol name, index in string tbl */ - b_elf_addr st_value; /* Symbol value */ - b_elf_word st_size; /* Symbol size */ - unsigned char st_info; /* Symbol binding and type */ - unsigned char st_other; /* Visibility and other data */ - b_elf_half st_shndx; /* Symbol section index */ -} b_elf_sym; /* Elf_Sym. */ - -#else /* BACKTRACE_ELF_SIZE != 32 */ - -typedef struct -{ - b_elf_word st_name; /* Symbol name, index in string tbl */ - unsigned char st_info; /* Symbol binding and type */ - unsigned char st_other; /* Visibility and other data */ - b_elf_half st_shndx; /* Symbol section index */ - b_elf_addr st_value; /* Symbol value */ - b_elf_xword st_size; /* Symbol size */ -} b_elf_sym; /* Elf_Sym. */ - -#endif /* BACKTRACE_ELF_SIZE != 32 */ - -#define STT_OBJECT 1 -#define STT_FUNC 2 - -/* An index of ELF sections we care about. */ - -enum debug_section -{ - DEBUG_INFO, - DEBUG_LINE, - DEBUG_ABBREV, - DEBUG_RANGES, - DEBUG_STR, - DEBUG_MAX -}; - -/* Names of sections, indexed by enum elf_section. */ - -static const char * const debug_section_names[DEBUG_MAX] = -{ - ".debug_info", - ".debug_line", - ".debug_abbrev", - ".debug_ranges", - ".debug_str" -}; - -/* Information we gather for the sections we care about. */ - -struct debug_section_info -{ - /* Section file offset. */ - off_t offset; - /* Section size. */ - size_t size; - /* Section contents, after read from file. */ - const unsigned char *data; -}; - -/* Information we keep for an ELF symbol. */ - -struct elf_symbol -{ - /* The name of the symbol. */ - const char *name; - /* The address of the symbol. */ - uintptr_t address; - /* The size of the symbol. */ - size_t size; -}; - -/* Information to pass to elf_syminfo. */ - -struct elf_syminfo_data -{ - /* Symbols for the next module. */ - struct elf_syminfo_data *next; - /* The ELF symbols, sorted by address. */ - struct elf_symbol *symbols; - /* The number of symbols. */ - size_t count; -}; - -/* A dummy callback function used when we can't find any debug info. */ - -static int -elf_nodebug (struct backtrace_state *state ATTRIBUTE_UNUSED, - uintptr_t pc ATTRIBUTE_UNUSED, - backtrace_full_callback callback ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback, void *data) -{ - error_callback (data, "no debug info in ELF executable", -1); - return 0; -} - -/* A dummy callback function used when we can't find a symbol - table. */ - -static void -elf_nosyms (struct backtrace_state *state ATTRIBUTE_UNUSED, - uintptr_t addr ATTRIBUTE_UNUSED, - backtrace_syminfo_callback callback ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback, void *data) -{ - error_callback (data, "no symbol table in ELF executable", -1); -} - -/* Compare struct elf_symbol for qsort. */ - -static int -elf_symbol_compare (const void *v1, const void *v2) -{ - const struct elf_symbol *e1 = (const struct elf_symbol *) v1; - const struct elf_symbol *e2 = (const struct elf_symbol *) v2; - - if (e1->address < e2->address) - return -1; - else if (e1->address > e2->address) - return 1; - else - return 0; -} - -/* Compare an ADDR against an elf_symbol for bsearch. We allocate one - extra entry in the array so that this can look safely at the next - entry. */ - -static int -elf_symbol_search (const void *vkey, const void *ventry) -{ - const uintptr_t *key = (const uintptr_t *) vkey; - const struct elf_symbol *entry = (const struct elf_symbol *) ventry; - uintptr_t addr; - - addr = *key; - if (addr < entry->address) - return -1; - else if (addr >= entry->address + entry->size) - return 1; - else - return 0; -} - -/* Initialize the symbol table info for elf_syminfo. */ - -static int -elf_initialize_syminfo (struct backtrace_state *state, - uintptr_t base_address, - const unsigned char *symtab_data, size_t symtab_size, - const unsigned char *strtab, size_t strtab_size, - backtrace_error_callback error_callback, - void *data, struct elf_syminfo_data *sdata) -{ - size_t sym_count; - const b_elf_sym *sym; - size_t elf_symbol_count; - size_t elf_symbol_size; - struct elf_symbol *elf_symbols; - size_t i; - unsigned int j; - - sym_count = symtab_size / sizeof (b_elf_sym); - - /* We only care about function symbols. Count them. */ - sym = (const b_elf_sym *) symtab_data; - elf_symbol_count = 0; - for (i = 0; i < sym_count; ++i, ++sym) - { - int info; - - info = sym->st_info & 0xf; - if ((info == STT_FUNC || info == STT_OBJECT) - && sym->st_shndx != SHN_UNDEF) - ++elf_symbol_count; - } - - elf_symbol_size = elf_symbol_count * sizeof (struct elf_symbol); - elf_symbols = ((struct elf_symbol *) - backtrace_alloc (state, elf_symbol_size, error_callback, - data)); - if (elf_symbols == NULL) - return 0; - - sym = (const b_elf_sym *) symtab_data; - j = 0; - for (i = 0; i < sym_count; ++i, ++sym) - { - int info; - - info = sym->st_info & 0xf; - if (info != STT_FUNC && info != STT_OBJECT) - continue; - if (sym->st_shndx == SHN_UNDEF) - continue; - if (sym->st_name >= strtab_size) - { - error_callback (data, "symbol string index out of range", 0); - backtrace_free (state, elf_symbols, elf_symbol_size, error_callback, - data); - return 0; - } - elf_symbols[j].name = (const char *) strtab + sym->st_name; - elf_symbols[j].address = sym->st_value + base_address; - elf_symbols[j].size = sym->st_size; - ++j; - } - - backtrace_qsort (elf_symbols, elf_symbol_count, sizeof (struct elf_symbol), - elf_symbol_compare); - - sdata->next = NULL; - sdata->symbols = elf_symbols; - sdata->count = elf_symbol_count; - - return 1; -} - -/* Add EDATA to the list in STATE. */ - -static void -elf_add_syminfo_data (struct backtrace_state *state, - struct elf_syminfo_data *edata) -{ - if (!state->threaded) - { - struct elf_syminfo_data **pp; - - for (pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - *pp != NULL; - pp = &(*pp)->next) - ; - *pp = edata; - } - else - { - while (1) - { - struct elf_syminfo_data **pp; - - pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - - while (1) - { - struct elf_syminfo_data *p; - - p = backtrace_atomic_load_pointer (pp); - - if (p == NULL) - break; - - pp = &p->next; - } - - if (__sync_bool_compare_and_swap (pp, NULL, edata)) - break; - } - } -} - -/* Return the symbol name and value for an ADDR. */ - -static void -elf_syminfo (struct backtrace_state *state, uintptr_t addr, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data) -{ - struct elf_syminfo_data *edata; - struct elf_symbol *sym = NULL; - - if (!state->threaded) - { - for (edata = (struct elf_syminfo_data *) state->syminfo_data; - edata != NULL; - edata = edata->next) - { - sym = ((struct elf_symbol *) - bsearch (&addr, edata->symbols, edata->count, - sizeof (struct elf_symbol), elf_symbol_search)); - if (sym != NULL) - break; - } - } - else - { - struct elf_syminfo_data **pp; - - pp = (struct elf_syminfo_data **) (void *) &state->syminfo_data; - while (1) - { - edata = backtrace_atomic_load_pointer (pp); - if (edata == NULL) - break; - - sym = ((struct elf_symbol *) - bsearch (&addr, edata->symbols, edata->count, - sizeof (struct elf_symbol), elf_symbol_search)); - if (sym != NULL) - break; - - pp = &edata->next; - } - } - - if (sym == NULL) - callback (data, addr, NULL, 0, 0); - else - callback (data, addr, sym->name, sym->address, sym->size); -} - -/* Add the backtrace data for one ELF file. Returns 1 on success, - 0 on failure (in both cases descriptor is closed) or -1 if exe - is non-zero and the ELF file is ET_DYN, which tells the caller that - elf_add will need to be called on the descriptor again after - base_address is determined. */ - -static int -elf_add (struct backtrace_state *state, int descriptor, uintptr_t base_address, - backtrace_error_callback error_callback, void *data, - fileline *fileline_fn, int *found_sym, int *found_dwarf, int exe) -{ - struct backtrace_view ehdr_view; - b_elf_ehdr ehdr; - off_t shoff; - unsigned int shnum; - unsigned int shstrndx; - struct backtrace_view shdrs_view; - int shdrs_view_valid; - const b_elf_shdr *shdrs; - const b_elf_shdr *shstrhdr; - size_t shstr_size; - off_t shstr_off; - struct backtrace_view names_view; - int names_view_valid; - const char *names; - unsigned int symtab_shndx; - unsigned int dynsym_shndx; - unsigned int i; - struct debug_section_info sections[DEBUG_MAX]; - struct backtrace_view symtab_view; - int symtab_view_valid; - struct backtrace_view strtab_view; - int strtab_view_valid; - off_t min_offset; - off_t max_offset; - struct backtrace_view debug_view; - int debug_view_valid; - - *found_sym = 0; - *found_dwarf = 0; - - shdrs_view_valid = 0; - names_view_valid = 0; - symtab_view_valid = 0; - strtab_view_valid = 0; - debug_view_valid = 0; - - if (!backtrace_get_view (state, descriptor, 0, sizeof ehdr, error_callback, - data, &ehdr_view)) - goto fail; - - memcpy (&ehdr, ehdr_view.data, sizeof ehdr); - - backtrace_release_view (state, &ehdr_view, error_callback, data); - - if (ehdr.e_ident[EI_MAG0] != ELFMAG0 - || ehdr.e_ident[EI_MAG1] != ELFMAG1 - || ehdr.e_ident[EI_MAG2] != ELFMAG2 - || ehdr.e_ident[EI_MAG3] != ELFMAG3) - { - error_callback (data, "executable file is not ELF", 0); - goto fail; - } - if (ehdr.e_ident[EI_VERSION] != EV_CURRENT) - { - error_callback (data, "executable file is unrecognized ELF version", 0); - goto fail; - } - -#if BACKTRACE_ELF_SIZE == 32 -#define BACKTRACE_ELFCLASS ELFCLASS32 -#else -#define BACKTRACE_ELFCLASS ELFCLASS64 -#endif - - if (ehdr.e_ident[EI_CLASS] != BACKTRACE_ELFCLASS) - { - error_callback (data, "executable file is unexpected ELF class", 0); - goto fail; - } - - if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB - && ehdr.e_ident[EI_DATA] != ELFDATA2MSB) - { - error_callback (data, "executable file has unknown endianness", 0); - goto fail; - } - - /* If the executable is ET_DYN, it is either a PIE, or we are running - directly a shared library with .interp. We need to wait for - dl_iterate_phdr in that case to determine the actual base_address. */ - if (exe && ehdr.e_type == ET_DYN) - return -1; - - shoff = ehdr.e_shoff; - shnum = ehdr.e_shnum; - shstrndx = ehdr.e_shstrndx; - - if ((shnum == 0 || shstrndx == SHN_XINDEX) - && shoff != 0) - { - struct backtrace_view shdr_view; - const b_elf_shdr *shdr; - - if (!backtrace_get_view (state, descriptor, shoff, sizeof shdr, - error_callback, data, &shdr_view)) - goto fail; - - shdr = (const b_elf_shdr *) shdr_view.data; - - if (shnum == 0) - shnum = shdr->sh_size; - - if (shstrndx == SHN_XINDEX) - { - shstrndx = shdr->sh_link; - - /* Versions of the GNU binutils between 2.12 and 2.18 did - not handle objects with more than SHN_LORESERVE sections - correctly. All large section indexes were offset by - 0x100. There is more information at - http://sourceware.org/bugzilla/show_bug.cgi?id-5900 . - Fortunately these object files are easy to detect, as the - GNU binutils always put the section header string table - near the end of the list of sections. Thus if the - section header string table index is larger than the - number of sections, then we know we have to subtract - 0x100 to get the real section index. */ - if (shstrndx >= shnum && shstrndx >= SHN_LORESERVE + 0x100) - shstrndx -= 0x100; - } - - backtrace_release_view (state, &shdr_view, error_callback, data); - } - - /* To translate PC to file/line when using DWARF, we need to find - the .debug_info and .debug_line sections. */ - - /* Read the section headers, skipping the first one. */ - - if (!backtrace_get_view (state, descriptor, shoff + sizeof (b_elf_shdr), - (shnum - 1) * sizeof (b_elf_shdr), - error_callback, data, &shdrs_view)) - goto fail; - shdrs_view_valid = 1; - shdrs = (const b_elf_shdr *) shdrs_view.data; - - /* Read the section names. */ - - shstrhdr = &shdrs[shstrndx - 1]; - shstr_size = shstrhdr->sh_size; - shstr_off = shstrhdr->sh_offset; - - if (!backtrace_get_view (state, descriptor, shstr_off, shstr_size, - error_callback, data, &names_view)) - goto fail; - names_view_valid = 1; - names = (const char *) names_view.data; - - symtab_shndx = 0; - dynsym_shndx = 0; - - memset (sections, 0, sizeof sections); - - /* Look for the symbol table. */ - for (i = 1; i < shnum; ++i) - { - const b_elf_shdr *shdr; - unsigned int sh_name; - const char *name; - int j; - - shdr = &shdrs[i - 1]; - - if (shdr->sh_type == SHT_SYMTAB) - symtab_shndx = i; - else if (shdr->sh_type == SHT_DYNSYM) - dynsym_shndx = i; - - sh_name = shdr->sh_name; - if (sh_name >= shstr_size) - { - error_callback (data, "ELF section name out of range", 0); - goto fail; - } - - name = names + sh_name; - - for (j = 0; j < (int) DEBUG_MAX; ++j) - { - if (strcmp (name, debug_section_names[j]) == 0) - { - sections[j].offset = shdr->sh_offset; - sections[j].size = shdr->sh_size; - break; - } - } - } - - if (symtab_shndx == 0) - symtab_shndx = dynsym_shndx; - if (symtab_shndx != 0) - { - const b_elf_shdr *symtab_shdr; - unsigned int strtab_shndx; - const b_elf_shdr *strtab_shdr; - struct elf_syminfo_data *sdata; - - symtab_shdr = &shdrs[symtab_shndx - 1]; - strtab_shndx = symtab_shdr->sh_link; - if (strtab_shndx >= shnum) - { - error_callback (data, - "ELF symbol table strtab link out of range", 0); - goto fail; - } - strtab_shdr = &shdrs[strtab_shndx - 1]; - - if (!backtrace_get_view (state, descriptor, symtab_shdr->sh_offset, - symtab_shdr->sh_size, error_callback, data, - &symtab_view)) - goto fail; - symtab_view_valid = 1; - - if (!backtrace_get_view (state, descriptor, strtab_shdr->sh_offset, - strtab_shdr->sh_size, error_callback, data, - &strtab_view)) - goto fail; - strtab_view_valid = 1; - - sdata = ((struct elf_syminfo_data *) - backtrace_alloc (state, sizeof *sdata, error_callback, data)); - if (sdata == NULL) - goto fail; - - if (!elf_initialize_syminfo (state, base_address, - symtab_view.data, symtab_shdr->sh_size, - strtab_view.data, strtab_shdr->sh_size, - error_callback, data, sdata)) - { - backtrace_free (state, sdata, sizeof *sdata, error_callback, data); - goto fail; - } - - /* We no longer need the symbol table, but we hold on to the - string table permanently. */ - backtrace_release_view (state, &symtab_view, error_callback, data); - - *found_sym = 1; - - elf_add_syminfo_data (state, sdata); - } - - /* FIXME: Need to handle compressed debug sections. */ - - backtrace_release_view (state, &shdrs_view, error_callback, data); - shdrs_view_valid = 0; - backtrace_release_view (state, &names_view, error_callback, data); - names_view_valid = 0; - - /* Read all the debug sections in a single view, since they are - probably adjacent in the file. We never release this view. */ - - min_offset = 0; - max_offset = 0; - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - off_t end; - - if (sections[i].size == 0) - continue; - if (min_offset == 0 || sections[i].offset < min_offset) - min_offset = sections[i].offset; - end = sections[i].offset + sections[i].size; - if (end > max_offset) - max_offset = end; - } - if (min_offset == 0 || max_offset == 0) - { - if (!backtrace_close (descriptor, error_callback, data)) - goto fail; - *fileline_fn = elf_nodebug; - return 1; - } - - if (!backtrace_get_view (state, descriptor, min_offset, - max_offset - min_offset, - error_callback, data, &debug_view)) - goto fail; - debug_view_valid = 1; - - /* We've read all we need from the executable. */ - if (!backtrace_close (descriptor, error_callback, data)) - goto fail; - descriptor = -1; - - for (i = 0; i < (int) DEBUG_MAX; ++i) - { - if (sections[i].size == 0) - sections[i].data = NULL; - else - sections[i].data = ((const unsigned char *) debug_view.data - + (sections[i].offset - min_offset)); - } - - if (!backtrace_dwarf_add (state, base_address, - sections[DEBUG_INFO].data, - sections[DEBUG_INFO].size, - sections[DEBUG_LINE].data, - sections[DEBUG_LINE].size, - sections[DEBUG_ABBREV].data, - sections[DEBUG_ABBREV].size, - sections[DEBUG_RANGES].data, - sections[DEBUG_RANGES].size, - sections[DEBUG_STR].data, - sections[DEBUG_STR].size, - ehdr.e_ident[EI_DATA] == ELFDATA2MSB, - error_callback, data, fileline_fn)) - goto fail; - - *found_dwarf = 1; - - return 1; - - fail: - if (shdrs_view_valid) - backtrace_release_view (state, &shdrs_view, error_callback, data); - if (names_view_valid) - backtrace_release_view (state, &names_view, error_callback, data); - if (symtab_view_valid) - backtrace_release_view (state, &symtab_view, error_callback, data); - if (strtab_view_valid) - backtrace_release_view (state, &strtab_view, error_callback, data); - if (debug_view_valid) - backtrace_release_view (state, &debug_view, error_callback, data); - if (descriptor != -1) - backtrace_close (descriptor, error_callback, data); - return 0; -} - -/* Data passed to phdr_callback. */ - -struct phdr_data -{ - struct backtrace_state *state; - backtrace_error_callback error_callback; - void *data; - fileline *fileline_fn; - int *found_sym; - int *found_dwarf; - int exe_descriptor; -}; - -/* Callback passed to dl_iterate_phdr. Load debug info from shared - libraries. */ - -static int -phdr_callback (struct dl_phdr_info *info, size_t size ATTRIBUTE_UNUSED, - void *pdata) -{ - struct phdr_data *pd = (struct phdr_data *) pdata; - int descriptor; - int does_not_exist; - fileline elf_fileline_fn; - int found_dwarf; - - /* There is not much we can do if we don't have the module name, - unless executable is ET_DYN, where we expect the very first - phdr_callback to be for the PIE. */ - if (info->dlpi_name == NULL || info->dlpi_name[0] == '\0') - { - if (pd->exe_descriptor == -1) - return 0; - descriptor = pd->exe_descriptor; - pd->exe_descriptor = -1; - } - else - { - if (pd->exe_descriptor != -1) - { - backtrace_close (pd->exe_descriptor, pd->error_callback, pd->data); - pd->exe_descriptor = -1; - } - - descriptor = backtrace_open (info->dlpi_name, pd->error_callback, - pd->data, &does_not_exist); - if (descriptor < 0) - return 0; - } - - if (elf_add (pd->state, descriptor, info->dlpi_addr, pd->error_callback, - pd->data, &elf_fileline_fn, pd->found_sym, &found_dwarf, 0)) - { - if (found_dwarf) - { - *pd->found_dwarf = 1; - *pd->fileline_fn = elf_fileline_fn; - } - } - - return 0; -} - -/* Initialize the backtrace data we need from an ELF executable. At - the ELF level, all we need to do is find the debug info - sections. */ - -int -backtrace_initialize (struct backtrace_state *state, int descriptor, - backtrace_error_callback error_callback, - void *data, fileline *fileline_fn) -{ - int ret; - int found_sym; - int found_dwarf; - fileline elf_fileline_fn; - struct phdr_data pd; - - ret = elf_add (state, descriptor, 0, error_callback, data, &elf_fileline_fn, - &found_sym, &found_dwarf, 1); - if (!ret) - return 0; - - pd.state = state; - pd.error_callback = error_callback; - pd.data = data; - pd.fileline_fn = &elf_fileline_fn; - pd.found_sym = &found_sym; - pd.found_dwarf = &found_dwarf; - pd.exe_descriptor = ret < 0 ? descriptor : -1; - - dl_iterate_phdr (phdr_callback, (void *) &pd); - - if (!state->threaded) - { - if (found_sym) - state->syminfo_fn = elf_syminfo; - else if (state->syminfo_fn == NULL) - state->syminfo_fn = elf_nosyms; - } - else - { - if (found_sym) - backtrace_atomic_store_pointer (&state->syminfo_fn, elf_syminfo); - else - __sync_bool_compare_and_swap (&state->syminfo_fn, NULL, elf_nosyms); - } - - if (!state->threaded) - { - if (state->fileline_fn == NULL || state->fileline_fn == elf_nodebug) - *fileline_fn = elf_fileline_fn; - } - else - { - fileline current_fn; - - current_fn = backtrace_atomic_load_pointer (&state->fileline_fn); - if (current_fn == NULL || current_fn == elf_nodebug) - *fileline_fn = elf_fileline_fn; - } - - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/fileline.c b/llgo/third_party/gofrontend/libbacktrace/fileline.c deleted file mode 100644 index 0acad0603eeb071a4b114cf3a7f544536a1be405..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/fileline.c +++ /dev/null @@ -1,194 +0,0 @@ -/* fileline.c -- Get file and line number information in a backtrace. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -#ifndef HAVE_GETEXECNAME -#define getexecname() NULL -#endif - -/* Initialize the fileline information from the executable. Returns 1 - on success, 0 on failure. */ - -static int -fileline_initialize (struct backtrace_state *state, - backtrace_error_callback error_callback, void *data) -{ - int failed; - fileline fileline_fn; - int pass; - int called_error_callback; - int descriptor; - - if (!state->threaded) - failed = state->fileline_initialization_failed; - else - failed = backtrace_atomic_load_int (&state->fileline_initialization_failed); - - if (failed) - { - error_callback (data, "failed to read executable information", -1); - return 0; - } - - if (!state->threaded) - fileline_fn = state->fileline_fn; - else - fileline_fn = backtrace_atomic_load_pointer (&state->fileline_fn); - if (fileline_fn != NULL) - return 1; - - /* We have not initialized the information. Do it now. */ - - descriptor = -1; - called_error_callback = 0; - for (pass = 0; pass < 4; ++pass) - { - const char *filename; - int does_not_exist; - - switch (pass) - { - case 0: - filename = state->filename; - break; - case 1: - filename = getexecname (); - break; - case 2: - filename = "/proc/self/exe"; - break; - case 3: - filename = "/proc/curproc/file"; - break; - default: - abort (); - } - - if (filename == NULL) - continue; - - descriptor = backtrace_open (filename, error_callback, data, - &does_not_exist); - if (descriptor < 0 && !does_not_exist) - { - called_error_callback = 1; - break; - } - if (descriptor >= 0) - break; - } - - if (descriptor < 0) - { - if (!called_error_callback) - { - if (state->filename != NULL) - error_callback (data, state->filename, ENOENT); - else - error_callback (data, - "libbacktrace could not find executable to open", - 0); - } - failed = 1; - } - - if (!failed) - { - if (!backtrace_initialize (state, descriptor, error_callback, data, - &fileline_fn)) - failed = 1; - } - - if (failed) - { - if (!state->threaded) - state->fileline_initialization_failed = 1; - else - backtrace_atomic_store_int (&state->fileline_initialization_failed, 1); - return 0; - } - - if (!state->threaded) - state->fileline_fn = fileline_fn; - else - { - backtrace_atomic_store_pointer (&state->fileline_fn, fileline_fn); - - /* Note that if two threads initialize at once, one of the data - sets may be leaked. */ - } - - return 1; -} - -/* Given a PC, find the file name, line number, and function name. */ - -int -backtrace_pcinfo (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data) -{ - if (!fileline_initialize (state, error_callback, data)) - return 0; - - if (state->fileline_initialization_failed) - return 0; - - return state->fileline_fn (state, pc, callback, error_callback, data); -} - -/* Given a PC, find the symbol for it, and its value. */ - -int -backtrace_syminfo (struct backtrace_state *state, uintptr_t pc, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, void *data) -{ - if (!fileline_initialize (state, error_callback, data)) - return 0; - - if (state->fileline_initialization_failed) - return 0; - - state->syminfo_fn (state, pc, callback, error_callback, data); - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/filetype.awk b/llgo/third_party/gofrontend/libbacktrace/filetype.awk deleted file mode 100644 index 0a656f75ba1f2e029785eb31427562fdd2162e91..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/filetype.awk +++ /dev/null @@ -1,3 +0,0 @@ -# An awk script to determine the type of a file. -/\177ELF\001/ { if (NR == 1) { print "elf32"; exit } } -/\177ELF\002/ { if (NR == 1) { print "elf64"; exit } } diff --git a/llgo/third_party/gofrontend/libbacktrace/internal.h b/llgo/third_party/gofrontend/libbacktrace/internal.h deleted file mode 100644 index 30f99ca127f8e8035b18c4b772adf989aa508fbf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/internal.h +++ /dev/null @@ -1,292 +0,0 @@ -/* internal.h -- Internal header file for stack backtrace library. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 BACKTRACE_INTERNAL_H -#define BACKTRACE_INTERNAL_H - -/* We assume that and "backtrace.h" have already been - included. */ - -#ifndef GCC_VERSION -# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) -#endif - -#if (GCC_VERSION < 2007) -# define __attribute__(x) -#endif - -#ifndef ATTRIBUTE_UNUSED -# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) -#endif - -#ifndef ATTRIBUTE_MALLOC -# if (GCC_VERSION >= 2096) -# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) -# else -# define ATTRIBUTE_MALLOC -# endif -#endif - -#ifndef HAVE_SYNC_FUNCTIONS - -/* Define out the sync functions. These should never be called if - they are not available. */ - -#define __sync_bool_compare_and_swap(A, B, C) (abort(), 1) -#define __sync_lock_test_and_set(A, B) (abort(), 0) -#define __sync_lock_release(A) abort() - -#endif /* !defined (HAVE_SYNC_FUNCTIONS) */ - -#ifdef HAVE_ATOMIC_FUNCTIONS - -/* We have the atomic builtin functions. */ - -#define backtrace_atomic_load_pointer(p) \ - __atomic_load_n ((p), __ATOMIC_ACQUIRE) -#define backtrace_atomic_load_int(p) \ - __atomic_load_n ((p), __ATOMIC_ACQUIRE) -#define backtrace_atomic_store_pointer(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) -#define backtrace_atomic_store_size_t(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) -#define backtrace_atomic_store_int(p, v) \ - __atomic_store_n ((p), (v), __ATOMIC_RELEASE) - -#else /* !defined (HAVE_ATOMIC_FUNCTIONS) */ -#ifdef HAVE_SYNC_FUNCTIONS - -/* We have the sync functions but not the atomic functions. Define - the atomic ones in terms of the sync ones. */ - -extern void *backtrace_atomic_load_pointer (void *); -extern int backtrace_atomic_load_int (int *); -extern void backtrace_atomic_store_pointer (void *, void *); -extern void backtrace_atomic_store_size_t (size_t *, size_t); -extern void backtrace_atomic_store_int (int *, int); - -#else /* !defined (HAVE_SYNC_FUNCTIONS) */ - -/* We have neither the sync nor the atomic functions. These will - never be called. */ - -#define backtrace_atomic_load_pointer(p) (abort(), (void *) NULL) -#define backtrace_atomic_load_int(p) (abort(), 0) -#define backtrace_atomic_store_pointer(p, v) abort() -#define backtrace_atomic_store_size_t(p, v) abort() -#define backtrace_atomic_store_int(p, v) abort() - -#endif /* !defined (HAVE_SYNC_FUNCTIONS) */ -#endif /* !defined (HAVE_ATOMIC_FUNCTIONS) */ - -/* The type of the function that collects file/line information. This - is like backtrace_pcinfo. */ - -typedef int (*fileline) (struct backtrace_state *state, uintptr_t pc, - backtrace_full_callback callback, - backtrace_error_callback error_callback, void *data); - -/* The type of the function that collects symbol information. This is - like backtrace_syminfo. */ - -typedef void (*syminfo) (struct backtrace_state *state, uintptr_t pc, - backtrace_syminfo_callback callback, - backtrace_error_callback error_callback, void *data); - -/* What the backtrace state pointer points to. */ - -struct backtrace_state -{ - /* The name of the executable. */ - const char *filename; - /* Non-zero if threaded. */ - int threaded; - /* The master lock for fileline_fn, fileline_data, syminfo_fn, - syminfo_data, fileline_initialization_failed and everything the - data pointers point to. */ - void *lock; - /* The function that returns file/line information. */ - fileline fileline_fn; - /* The data to pass to FILELINE_FN. */ - void *fileline_data; - /* The function that returns symbol information. */ - syminfo syminfo_fn; - /* The data to pass to SYMINFO_FN. */ - void *syminfo_data; - /* Whether initializing the file/line information failed. */ - int fileline_initialization_failed; - /* The lock for the freelist. */ - int lock_alloc; - /* The freelist when using mmap. */ - struct backtrace_freelist_struct *freelist; -}; - -/* Open a file for reading. Returns -1 on error. If DOES_NOT_EXIST - is not NULL, *DOES_NOT_EXIST will be set to 0 normally and set to 1 - if the file does not exist. If the file does not exist and - DOES_NOT_EXIST is not NULL, the function will return -1 and will - not call ERROR_CALLBACK. On other errors, or if DOES_NOT_EXIST is - NULL, the function will call ERROR_CALLBACK before returning. */ -extern int backtrace_open (const char *filename, - backtrace_error_callback error_callback, - void *data, - int *does_not_exist); - -/* A view of the contents of a file. This supports mmap when - available. A view will remain in memory even after backtrace_close - is called on the file descriptor from which the view was - obtained. */ - -struct backtrace_view -{ - /* The data that the caller requested. */ - const void *data; - /* The base of the view. */ - void *base; - /* The total length of the view. */ - size_t len; -}; - -/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. Store the - result in *VIEW. Returns 1 on success, 0 on error. */ -extern int backtrace_get_view (struct backtrace_state *state, int descriptor, - off_t offset, size_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_view *view); - -/* Release a view created by backtrace_get_view. */ -extern void backtrace_release_view (struct backtrace_state *state, - struct backtrace_view *view, - backtrace_error_callback error_callback, - void *data); - -/* Close a file opened by backtrace_open. Returns 1 on success, 0 on - error. */ - -extern int backtrace_close (int descriptor, - backtrace_error_callback error_callback, - void *data); - -/* Sort without using memory. */ - -extern void backtrace_qsort (void *base, size_t count, size_t size, - int (*compar) (const void *, const void *)); - -/* Allocate memory. This is like malloc. */ - -extern void *backtrace_alloc (struct backtrace_state *state, size_t size, - backtrace_error_callback error_callback, - void *data) ATTRIBUTE_MALLOC; - -/* Free memory allocated by backtrace_alloc. */ - -extern void backtrace_free (struct backtrace_state *state, void *mem, - size_t size, - backtrace_error_callback error_callback, - void *data); - -/* A growable vector of some struct. This is used for more efficient - allocation when we don't know the final size of some group of data - that we want to represent as an array. */ - -struct backtrace_vector -{ - /* The base of the vector. */ - void *base; - /* The number of bytes in the vector. */ - size_t size; - /* The number of bytes available at the current allocation. */ - size_t alc; -}; - -/* Grow VEC by SIZE bytes. Return a pointer to the newly allocated - bytes. Note that this may move the entire vector to a new memory - location. Returns NULL on failure. */ - -extern void *backtrace_vector_grow (struct backtrace_state *state, size_t size, - backtrace_error_callback error_callback, - void *data, - struct backtrace_vector *vec); - -/* Finish the current allocation on VEC. Prepare to start a new - allocation. The finished allocation will never be freed. Returns - a pointer to the base of the finished entries, or NULL on - failure. */ - -extern void* backtrace_vector_finish (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data); - -/* Release any extra space allocated for VEC. This may change - VEC->base. Returns 1 on success, 0 on failure. */ - -extern int backtrace_vector_release (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data); - -/* Read initial debug data from a descriptor, and set the - fileline_data, syminfo_fn, and syminfo_data fields of STATE. - Return the fileln_fn field in *FILELN_FN--this is done this way so - that the synchronization code is only implemented once. This is - called after the descriptor has first been opened. It will close - the descriptor if it is no longer needed. Returns 1 on success, 0 - on error. There will be multiple implementations of this function, - for different file formats. Each system will compile the - appropriate one. */ - -extern int backtrace_initialize (struct backtrace_state *state, - int descriptor, - backtrace_error_callback error_callback, - void *data, - fileline *fileline_fn); - -/* Add file/line information for a DWARF module. */ - -extern int backtrace_dwarf_add (struct backtrace_state *state, - uintptr_t base_address, - const unsigned char* dwarf_info, - size_t dwarf_info_size, - const unsigned char *dwarf_line, - size_t dwarf_line_size, - const unsigned char *dwarf_abbrev, - size_t dwarf_abbrev_size, - const unsigned char *dwarf_ranges, - size_t dwarf_range_size, - const unsigned char *dwarf_str, - size_t dwarf_str_size, - int is_bigendian, - backtrace_error_callback error_callback, - void *data, fileline *fileline_fn); - -#endif diff --git a/llgo/third_party/gofrontend/libbacktrace/mmap.c b/llgo/third_party/gofrontend/libbacktrace/mmap.c deleted file mode 100644 index 1ecf131191142879ca808b864eb47810a71c5bbe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/mmap.c +++ /dev/null @@ -1,295 +0,0 @@ -/* mmap.c -- Memory allocation with mmap. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* Memory allocation on systems that provide anonymous mmap. This - permits the backtrace functions to be invoked from a signal - handler, assuming that mmap is async-signal safe. */ - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -/* A list of free memory blocks. */ - -struct backtrace_freelist_struct -{ - /* Next on list. */ - struct backtrace_freelist_struct *next; - /* Size of this block, including this structure. */ - size_t size; -}; - -/* Free memory allocated by backtrace_alloc. */ - -static void -backtrace_free_locked (struct backtrace_state *state, void *addr, size_t size) -{ - /* Just leak small blocks. We don't have to be perfect. */ - if (size >= sizeof (struct backtrace_freelist_struct)) - { - struct backtrace_freelist_struct *p; - - p = (struct backtrace_freelist_struct *) addr; - p->next = state->freelist; - p->size = size; - state->freelist = p; - } -} - -/* Allocate memory like malloc. */ - -void * -backtrace_alloc (struct backtrace_state *state, - size_t size, backtrace_error_callback error_callback, - void *data) -{ - void *ret; - int locked; - struct backtrace_freelist_struct **pp; - size_t pagesize; - size_t asksize; - void *page; - - ret = NULL; - - /* If we can acquire the lock, then see if there is space on the - free list. If we can't acquire the lock, drop straight into - using mmap. __sync_lock_test_and_set returns the old state of - the lock, so we have acquired it if it returns 0. */ - - if (!state->threaded) - locked = 1; - else - locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0; - - if (locked) - { - for (pp = &state->freelist; *pp != NULL; pp = &(*pp)->next) - { - if ((*pp)->size >= size) - { - struct backtrace_freelist_struct *p; - - p = *pp; - *pp = p->next; - - /* Round for alignment; we assume that no type we care about - is more than 8 bytes. */ - size = (size + 7) & ~ (size_t) 7; - if (size < p->size) - backtrace_free_locked (state, (char *) p + size, - p->size - size); - - ret = (void *) p; - - break; - } - } - - if (state->threaded) - __sync_lock_release (&state->lock_alloc); - } - - if (ret == NULL) - { - /* Allocate a new page. */ - - pagesize = getpagesize (); - asksize = (size + pagesize - 1) & ~ (pagesize - 1); - page = mmap (NULL, asksize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (page == NULL) - error_callback (data, "mmap", errno); - else - { - size = (size + 7) & ~ (size_t) 7; - if (size < asksize) - backtrace_free (state, (char *) page + size, asksize - size, - error_callback, data); - - ret = page; - } - } - - return ret; -} - -/* Free memory allocated by backtrace_alloc. */ - -void -backtrace_free (struct backtrace_state *state, void *addr, size_t size, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - int locked; - - /* If we are freeing a large aligned block, just release it back to - the system. This case arises when growing a vector for a large - binary with lots of debug info. Calling munmap here may cause us - to call mmap again if there is also a large shared library; we - just live with that. */ - if (size >= 16 * 4096) - { - size_t pagesize; - - pagesize = getpagesize (); - if (((uintptr_t) addr & (pagesize - 1)) == 0 - && (size & (pagesize - 1)) == 0) - { - /* If munmap fails for some reason, just add the block to - the freelist. */ - if (munmap (addr, size) == 0) - return; - } - } - - /* If we can acquire the lock, add the new space to the free list. - If we can't acquire the lock, just leak the memory. - __sync_lock_test_and_set returns the old state of the lock, so we - have acquired it if it returns 0. */ - - if (!state->threaded) - locked = 1; - else - locked = __sync_lock_test_and_set (&state->lock_alloc, 1) == 0; - - if (locked) - { - backtrace_free_locked (state, addr, size); - - if (state->threaded) - __sync_lock_release (&state->lock_alloc); - } -} - -/* Grow VEC by SIZE bytes. */ - -void * -backtrace_vector_grow (struct backtrace_state *state,size_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_vector *vec) -{ - void *ret; - - if (size > vec->alc) - { - size_t pagesize; - size_t alc; - void *base; - - pagesize = getpagesize (); - alc = vec->size + size; - if (vec->size == 0) - alc = 16 * size; - else if (alc < pagesize) - { - alc *= 2; - if (alc > pagesize) - alc = pagesize; - } - else - { - alc *= 2; - alc = (alc + pagesize - 1) & ~ (pagesize - 1); - } - base = backtrace_alloc (state, alc, error_callback, data); - if (base == NULL) - return NULL; - if (vec->base != NULL) - { - memcpy (base, vec->base, vec->size); - backtrace_free (state, vec->base, vec->size + vec->alc, - error_callback, data); - } - vec->base = base; - vec->alc = alc - vec->size; - } - - ret = (char *) vec->base + vec->size; - vec->size += size; - vec->alc -= size; - return ret; -} - -/* Finish the current allocation on VEC. */ - -void * -backtrace_vector_finish ( - struct backtrace_state *state ATTRIBUTE_UNUSED, - struct backtrace_vector *vec, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - void *ret; - - ret = vec->base; - vec->base = (char *) vec->base + vec->size; - vec->size = 0; - return ret; -} - -/* Release any extra space allocated for VEC. */ - -int -backtrace_vector_release (struct backtrace_state *state, - struct backtrace_vector *vec, - backtrace_error_callback error_callback, - void *data) -{ - size_t size; - size_t alc; - size_t aligned; - - /* Make sure that the block that we free is aligned on an 8-byte - boundary. */ - size = vec->size; - alc = vec->alc; - aligned = (size + 7) & ~ (size_t) 7; - alc -= aligned - size; - - backtrace_free (state, (char *) vec->base + aligned, alc, - error_callback, data); - vec->alc = 0; - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/mmapio.c b/llgo/third_party/gofrontend/libbacktrace/mmapio.c deleted file mode 100644 index b5a787e0aa6fd8bd8a50a37167b1d0ef3c9922bc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/mmapio.c +++ /dev/null @@ -1,100 +0,0 @@ -/* mmapio.c -- File views using mmap. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* This file implements file views and memory allocation when mmap is - available. */ - -/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. */ - -int -backtrace_get_view (struct backtrace_state *state ATTRIBUTE_UNUSED, - int descriptor, off_t offset, size_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_view *view) -{ - size_t pagesize; - unsigned int inpage; - off_t pageoff; - void *map; - - pagesize = getpagesize (); - inpage = offset % pagesize; - pageoff = offset - inpage; - - size += inpage; - size = (size + (pagesize - 1)) & ~ (pagesize - 1); - - map = mmap (NULL, size, PROT_READ, MAP_PRIVATE, descriptor, pageoff); - if (map == MAP_FAILED) - { - error_callback (data, "mmap", errno); - return 0; - } - - view->data = (char *) map + inpage; - view->base = map; - view->len = size; - - return 1; -} - -/* Release a view read by backtrace_get_view. */ - -void -backtrace_release_view (struct backtrace_state *state ATTRIBUTE_UNUSED, - struct backtrace_view *view, - backtrace_error_callback error_callback, - void *data) -{ - union { - const void *cv; - void *v; - } const_cast; - - const_cast.cv = view->base; - if (munmap (const_cast.v, view->len) < 0) - error_callback (data, "munmap", errno); -} diff --git a/llgo/third_party/gofrontend/libbacktrace/nounwind.c b/llgo/third_party/gofrontend/libbacktrace/nounwind.c deleted file mode 100644 index f53f906b5a89cb2c617067ed3b43b99acd0cec01..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/nounwind.c +++ /dev/null @@ -1,66 +0,0 @@ -/* backtrace.c -- Entry point for stack backtrace library. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include - -#include "backtrace.h" - -#include "internal.h" - -/* This source file is compiled if the unwind library is not - available. */ - -int -backtrace_full (struct backtrace_state *state ATTRIBUTE_UNUSED, - int skip ATTRIBUTE_UNUSED, - backtrace_full_callback callback ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback, void *data) -{ - error_callback (data, - "no stack trace because unwind library not available", - 0); - return 0; -} - -int -backtrace_simple (struct backtrace_state *state ATTRIBUTE_UNUSED, - int skip ATTRIBUTE_UNUSED, - backtrace_simple_callback callback ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback, void *data) -{ - error_callback (data, - "no stack trace because unwind library not available", - 0); - return 0; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/posix.c b/llgo/third_party/gofrontend/libbacktrace/posix.c deleted file mode 100644 index 7fa7cd0d5da6760713ca827d90858105a4d4ab12..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/posix.c +++ /dev/null @@ -1,100 +0,0 @@ -/* posix.c -- POSIX file I/O routines for the backtrace library. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#ifndef O_CLOEXEC -#define O_CLOEXEC 0 -#endif - -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif - -/* Open a file for reading. */ - -int -backtrace_open (const char *filename, backtrace_error_callback error_callback, - void *data, int *does_not_exist) -{ - int descriptor; - - if (does_not_exist != NULL) - *does_not_exist = 0; - - descriptor = open (filename, O_RDONLY | O_BINARY | O_CLOEXEC); - if (descriptor < 0) - { - if (does_not_exist != NULL && errno == ENOENT) - *does_not_exist = 1; - else - error_callback (data, filename, errno); - return -1; - } - -#ifdef HAVE_FCNTL - /* Set FD_CLOEXEC just in case the kernel does not support - O_CLOEXEC. It doesn't matter if this fails for some reason. - FIXME: At some point it should be safe to only do this if - O_CLOEXEC == 0. */ - fcntl (descriptor, F_SETFD, FD_CLOEXEC); -#endif - - return descriptor; -} - -/* Close DESCRIPTOR. */ - -int -backtrace_close (int descriptor, backtrace_error_callback error_callback, - void *data) -{ - if (close (descriptor) < 0) - { - error_callback (data, "close", errno); - return 0; - } - return 1; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/print.c b/llgo/third_party/gofrontend/libbacktrace/print.c deleted file mode 100644 index 90ecaf89edad0258b80aed7232cba4fe87352500..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/print.c +++ /dev/null @@ -1,92 +0,0 @@ -/* print.c -- Print the current backtrace. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* Passed to callbacks. */ - -struct print_data -{ - struct backtrace_state *state; - FILE *f; -}; - -/* Print one level of a backtrace. */ - -static int -print_callback (void *data, uintptr_t pc, const char *filename, int lineno, - const char *function) -{ - struct print_data *pdata = (struct print_data *) data; - - fprintf (pdata->f, "0x%lx %s\n\t%s:%d\n", - (unsigned long) pc, - function == NULL ? "???" : function, - filename == NULL ? "???" : filename, - lineno); - return 0; -} - -/* Print errors to stderr. */ - -static void -error_callback (void *data, const char *msg, int errnum) -{ - struct print_data *pdata = (struct print_data *) data; - - if (pdata->state->filename != NULL) - fprintf (stderr, "%s: ", pdata->state->filename); - fprintf (stderr, "libbacktrace: %s", msg); - if (errnum > 0) - fprintf (stderr, ": %s", strerror (errnum)); - fputc ('\n', stderr); -} - -/* Print a backtrace. */ - -void -backtrace_print (struct backtrace_state *state, int skip, FILE *f) -{ - struct print_data data; - - data.state = state; - data.f = f; - backtrace_full (state, skip + 1, print_callback, error_callback, - (void *) &data); -} diff --git a/llgo/third_party/gofrontend/libbacktrace/read.c b/llgo/third_party/gofrontend/libbacktrace/read.c deleted file mode 100644 index 299f77ba7c629848f8e22b113f15f2c96747c0ea..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/read.c +++ /dev/null @@ -1,96 +0,0 @@ -/* read.c -- File views without mmap. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* This file implements file views when mmap is not available. */ - -/* Create a view of SIZE bytes from DESCRIPTOR at OFFSET. */ - -int -backtrace_get_view (struct backtrace_state *state, int descriptor, - off_t offset, size_t size, - backtrace_error_callback error_callback, - void *data, struct backtrace_view *view) -{ - ssize_t got; - - if (lseek (descriptor, offset, SEEK_SET) < 0) - { - error_callback (data, "lseek", errno); - return 0; - } - - view->base = backtrace_alloc (state, size, error_callback, data); - if (view->base == NULL) - return 0; - view->data = view->base; - view->len = size; - - got = read (descriptor, view->base, size); - if (got < 0) - { - error_callback (data, "read", errno); - free (view->base); - return 0; - } - - if ((size_t) got < size) - { - error_callback (data, "file too short", 0); - free (view->base); - return 0; - } - - return 1; -} - -/* Release a view read by backtrace_get_view. */ - -void -backtrace_release_view (struct backtrace_state *state, - struct backtrace_view *view, - backtrace_error_callback error_callback, - void *data) -{ - backtrace_free (state, view->base, view->len, error_callback, data); - view->data = NULL; - view->base = NULL; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/simple.c b/llgo/third_party/gofrontend/libbacktrace/simple.c deleted file mode 100644 index 39c2e902ff77b17adf036f388fd6bc8b25f36aa4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/simple.c +++ /dev/null @@ -1,108 +0,0 @@ -/* simple.c -- The backtrace_simple function. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include "unwind.h" -#include "backtrace.h" - -/* The simple_backtrace routine. */ - -/* Data passed through _Unwind_Backtrace. */ - -struct backtrace_simple_data -{ - /* Number of frames to skip. */ - int skip; - /* Library state. */ - struct backtrace_state *state; - /* Callback routine. */ - backtrace_simple_callback callback; - /* Error callback routine. */ - backtrace_error_callback error_callback; - /* Data to pass to callback routine. */ - void *data; - /* Value to return from backtrace. */ - int ret; -}; - -/* Unwind library callback routine. This is passd to - _Unwind_Backtrace. */ - -static _Unwind_Reason_Code -simple_unwind (struct _Unwind_Context *context, void *vdata) -{ - struct backtrace_simple_data *bdata = (struct backtrace_simple_data *) vdata; - uintptr_t pc; - int ip_before_insn = 0; - -#ifdef HAVE_GETIPINFO - pc = _Unwind_GetIPInfo (context, &ip_before_insn); -#else - pc = _Unwind_GetIP (context); -#endif - - if (bdata->skip > 0) - { - --bdata->skip; - return _URC_NO_REASON; - } - - if (!ip_before_insn) - --pc; - - bdata->ret = bdata->callback (bdata->data, pc); - - if (bdata->ret != 0) - return _URC_END_OF_STACK; - - return _URC_NO_REASON; -} - -/* Get a simple stack backtrace. */ - -int -backtrace_simple (struct backtrace_state *state, int skip, - backtrace_simple_callback callback, - backtrace_error_callback error_callback, void *data) -{ - struct backtrace_simple_data bdata; - - bdata.skip = skip + 1; - bdata.state = state; - bdata.callback = callback; - bdata.error_callback = error_callback; - bdata.data = data; - bdata.ret = 0; - _Unwind_Backtrace (simple_unwind, &bdata); - return bdata.ret; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/sort.c b/llgo/third_party/gofrontend/libbacktrace/sort.c deleted file mode 100644 index bcc765e93aa777e736ed0b685015398c5fb67dc5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/sort.c +++ /dev/null @@ -1,108 +0,0 @@ -/* sort.c -- Sort without allocating memory - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* The GNU glibc version of qsort allocates memory, which we must not - do if we are invoked by a signal handler. So provide our own - sort. */ - -static void -swap (char *a, char *b, size_t size) -{ - size_t i; - - for (i = 0; i < size; i++, a++, b++) - { - char t; - - t = *a; - *a = *b; - *b = t; - } -} - -void -backtrace_qsort (void *basearg, size_t count, size_t size, - int (*compar) (const void *, const void *)) -{ - char *base = (char *) basearg; - size_t i; - size_t mid; - - tail_recurse: - if (count < 2) - return; - - /* The symbol table and DWARF tables, which is all we use this - routine for, tend to be roughly sorted. Pick the middle element - in the array as our pivot point, so that we are more likely to - cut the array in half for each recursion step. */ - swap (base, base + (count / 2) * size, size); - - mid = 0; - for (i = 1; i < count; i++) - { - if ((*compar) (base, base + i * size) > 0) - { - ++mid; - if (i != mid) - swap (base + mid * size, base + i * size, size); - } - } - - if (mid > 0) - swap (base, base + mid * size, size); - - /* Recurse with the smaller array, loop with the larger one. That - ensures that our maximum stack depth is log count. */ - if (2 * mid < count) - { - backtrace_qsort (base, mid, size, compar); - base += (mid + 1) * size; - count -= mid + 1; - goto tail_recurse; - } - else - { - backtrace_qsort (base + (mid + 1) * size, count - (mid + 1), - size, compar); - count = mid; - goto tail_recurse; - } -} diff --git a/llgo/third_party/gofrontend/libbacktrace/state.c b/llgo/third_party/gofrontend/libbacktrace/state.c deleted file mode 100644 index a846378e903c2c7876b9a875cde369c5ffa0332e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/state.c +++ /dev/null @@ -1,72 +0,0 @@ -/* state.c -- Create the backtrace state. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include - -#include "backtrace.h" -#include "backtrace-supported.h" -#include "internal.h" - -/* Create the backtrace state. This will then be passed to all the - other routines. */ - -struct backtrace_state * -backtrace_create_state (const char *filename, int threaded, - backtrace_error_callback error_callback, - void *data) -{ - struct backtrace_state init_state; - struct backtrace_state *state; - -#ifndef HAVE_SYNC_FUNCTIONS - if (threaded) - { - error_callback (data, "backtrace library does not support threads", 0); - return NULL; - } -#endif - - memset (&init_state, 0, sizeof init_state); - init_state.filename = filename; - init_state.threaded = threaded; - - state = ((struct backtrace_state *) - backtrace_alloc (&init_state, sizeof *state, error_callback, data)); - if (state == NULL) - return NULL; - *state = init_state; - - return state; -} diff --git a/llgo/third_party/gofrontend/libbacktrace/stest.c b/llgo/third_party/gofrontend/libbacktrace/stest.c deleted file mode 100644 index ec93e680e89ed8cda9571e03ff92939190d89e5f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/stest.c +++ /dev/null @@ -1,137 +0,0 @@ -/* stest.c -- Test for libbacktrace internal sort function - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include -#include -#include -#include - -#include "backtrace.h" -#include "internal.h" - -/* Test the local qsort implementation. */ - -#define MAX 10 - -struct test -{ - size_t count; - int input[MAX]; - int output[MAX]; -}; - -static struct test tests[] = - { - { - 10, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 } - }, - { - 9, - { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9 } - }, - { - 10, - { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, - }, - { - 9, - { 9, 8, 7, 6, 5, 4, 3, 2, 1 }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, - }, - { - 10, - { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, - }, - { - 5, - { 4, 5, 3, 1, 2 }, - { 1, 2, 3, 4, 5 }, - }, - { - 5, - { 1, 1, 1, 1, 1 }, - { 1, 1, 1, 1, 1 }, - }, - { - 5, - { 1, 1, 2, 1, 1 }, - { 1, 1, 1, 1, 2 }, - }, - { - 5, - { 2, 1, 1, 1, 1 }, - { 1, 1, 1, 1, 2 }, - }, - }; - -static int -compare (const void *a, const void *b) -{ - const int *ai = (const int *) a; - const int *bi = (const int *) b; - - return *ai - *bi; -} - -int -main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) -{ - int failures; - size_t i; - int a[MAX]; - - failures = 0; - for (i = 0; i < sizeof tests / sizeof tests[0]; i++) - { - memcpy (a, tests[i].input, tests[i].count * sizeof (int)); - backtrace_qsort (a, tests[i].count, sizeof (int), compare); - if (memcmp (a, tests[i].output, tests[i].count * sizeof (int)) != 0) - { - size_t j; - - fprintf (stderr, "test %d failed:", (int) i); - for (j = 0; j < tests[i].count; j++) - fprintf (stderr, " %d", a[j]); - fprintf (stderr, "\n"); - ++failures; - } - } - - exit (failures > 0 ? EXIT_FAILURE : EXIT_SUCCESS); -} diff --git a/llgo/third_party/gofrontend/libbacktrace/unknown.c b/llgo/third_party/gofrontend/libbacktrace/unknown.c deleted file mode 100644 index e89cba96f7d91565d1ab307c238cc6b23dbed283..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libbacktrace/unknown.c +++ /dev/null @@ -1,64 +0,0 @@ -/* unknown.c -- used when backtrace configury does not know file format. - Copyright (C) 2012-2015 Free Software Foundation, Inc. - Written by Ian Lance Taylor, Google. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - (1) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - (2) 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. - - (3) The name of the author may not be used to - endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "config.h" - -#include - -#include "backtrace.h" -#include "internal.h" - -/* A trivial routine that always fails to find fileline data. */ - -static int -unknown_fileline (struct backtrace_state *state ATTRIBUTE_UNUSED, - uintptr_t pc, backtrace_full_callback callback, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data) - -{ - return callback (data, pc, NULL, 0, NULL); -} - -/* Initialize the backtrace data when we don't know how to read the - debug info. */ - -int -backtrace_initialize (struct backtrace_state *state ATTRIBUTE_UNUSED, - int descriptor ATTRIBUTE_UNUSED, - backtrace_error_callback error_callback ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED, fileline *fileline_fn) -{ - state->fileline_data = NULL; - *fileline_fn = unknown_fileline; - return 1; -} diff --git a/llgo/third_party/gofrontend/libffi/ChangeLog.libffi b/llgo/third_party/gofrontend/libffi/ChangeLog.libffi deleted file mode 100644 index f3ee8b0040cc0f133d84ab149dc06e0c049c448b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/ChangeLog.libffi +++ /dev/null @@ -1,584 +0,0 @@ -2011-02-08 Andreas Tobler - - * testsuite/lib/libffi.exp: Tweak for stand-alone mode. - -2009-12-25 Samuli Suominen - - * configure.ac: Undefine _AC_ARG_VAR_PRECIOUS for autoconf 2.64. - * configure: Rebuilt. - * fficonfig.h.in: Rebuilt. - -2009-06-16 Andrew Haley - - * testsuite/libffi.call/cls_align_sint64.c, - testsuite/libffi.call/cls_align_uint64.c, - testsuite/libffi.call/cls_longdouble_va.c, - testsuite/libffi.call/cls_ulonglong.c, - testsuite/libffi.call/return_ll1.c, - testsuite/libffi.call/stret_medium2.c: Fix printf format - specifiers. - * testsuite/libffi.call/huge_struct.c: Ad x86 XFAILs. - * testsuite/libffi.call/float2.c: Fix dg-excess-errors. - * testsuite/libffi.call/ffitest.h, - testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define. - -2009-06-12 Andrew Haley - - * testsuite/libffi.call/cls_align_sint64.c, - testsuite/libffi.call/cls_align_uint64.c, - testsuite/libffi.call/cls_ulonglong.c, - testsuite/libffi.call/return_ll1.c, - testsuite/libffi.call/stret_medium2.c: Fix printf format - specifiers. - testsuite/libffi.special/unwindtest.cc: include stdint.h. - -2009-06-11 Timothy Wall - - * Makefile.am, - configure.ac, - include/ffi.h.in, - include/ffi_common.h, - src/closures.c, - src/dlmalloc.c, - src/x86/ffi.c, - src/x86/ffitarget.h, - src/x86/win64.S (new), - README: Added win64 support (mingw or MSVC) - * Makefile.in, - include/Makefile.in, - man/Makefile.in, - testsuite/Makefile.in, - configure, - aclocal.m4: Regenerated - * ltcf-c.sh: properly escape cygwin/w32 path - * man/ffi_call.3: Clarify size requirements for return value. - * src/x86/ffi64.c: Fix filename in comment. - * src/x86/win32.S: Remove unused extern. - - * testsuite/libffi.call/closure_fn0.c, - testsuite/libffi.call/closure_fn1.c, - testsuite/libffi.call/closure_fn2.c, - testsuite/libffi.call/closure_fn3.c, - testsuite/libffi.call/closure_fn4.c, - testsuite/libffi.call/closure_fn5.c, - testsuite/libffi.call/closure_fn6.c, - testsuite/libffi.call/closure_stdcall.c, - testsuite/libffi.call/cls_12byte.c, - testsuite/libffi.call/cls_16byte.c, - testsuite/libffi.call/cls_18byte.c, - testsuite/libffi.call/cls_19byte.c, - testsuite/libffi.call/cls_1_1byte.c, - testsuite/libffi.call/cls_20byte.c, - testsuite/libffi.call/cls_20byte1.c, - testsuite/libffi.call/cls_24byte.c, - testsuite/libffi.call/cls_2byte.c, - testsuite/libffi.call/cls_3_1byte.c, - testsuite/libffi.call/cls_3byte1.c, - testsuite/libffi.call/cls_3byte2.c, - testsuite/libffi.call/cls_4_1byte.c, - testsuite/libffi.call/cls_4byte.c, - testsuite/libffi.call/cls_5_1_byte.c, - testsuite/libffi.call/cls_5byte.c, - testsuite/libffi.call/cls_64byte.c, - testsuite/libffi.call/cls_6_1_byte.c, - testsuite/libffi.call/cls_6byte.c, - testsuite/libffi.call/cls_7_1_byte.c, - testsuite/libffi.call/cls_7byte.c, - testsuite/libffi.call/cls_8byte.c, - testsuite/libffi.call/cls_9byte1.c, - testsuite/libffi.call/cls_9byte2.c, - testsuite/libffi.call/cls_align_double.c, - testsuite/libffi.call/cls_align_float.c, - testsuite/libffi.call/cls_align_longdouble.c, - testsuite/libffi.call/cls_align_longdouble_split.c, - testsuite/libffi.call/cls_align_longdouble_split2.c, - testsuite/libffi.call/cls_align_pointer.c, - testsuite/libffi.call/cls_align_sint16.c, - testsuite/libffi.call/cls_align_sint32.c, - testsuite/libffi.call/cls_align_sint64.c, - testsuite/libffi.call/cls_align_uint16.c, - testsuite/libffi.call/cls_align_uint32.c, - testsuite/libffi.call/cls_align_uint64.c, - testsuite/libffi.call/cls_dbls_struct.c, - testsuite/libffi.call/cls_double.c, - testsuite/libffi.call/cls_double_va.c, - testsuite/libffi.call/cls_float.c, - testsuite/libffi.call/cls_longdouble.c, - testsuite/libffi.call/cls_longdouble_va.c, - testsuite/libffi.call/cls_multi_schar.c, - testsuite/libffi.call/cls_multi_sshort.c, - testsuite/libffi.call/cls_multi_sshortchar.c, - testsuite/libffi.call/cls_multi_uchar.c, - testsuite/libffi.call/cls_multi_ushort.c, - testsuite/libffi.call/cls_multi_ushortchar.c, - testsuite/libffi.call/cls_pointer.c, - testsuite/libffi.call/cls_pointer_stack.c, - testsuite/libffi.call/cls_schar.c, - testsuite/libffi.call/cls_sint.c, - testsuite/libffi.call/cls_sshort.c, - testsuite/libffi.call/cls_uchar.c, - testsuite/libffi.call/cls_uint.c, - testsuite/libffi.call/cls_ulonglong.c, - testsuite/libffi.call/cls_ushort.c, - testsuite/libffi.call/err_bad_abi.c, - testsuite/libffi.call/err_bad_typedef.c, - testsuite/libffi.call/float2.c, - testsuite/libffi.call/huge_struct.c, - testsuite/libffi.call/nested_struct.c, - testsuite/libffi.call/nested_struct1.c, - testsuite/libffi.call/nested_struct10.c, - testsuite/libffi.call/nested_struct2.c, - testsuite/libffi.call/nested_struct3.c, - testsuite/libffi.call/nested_struct4.c, - testsuite/libffi.call/nested_struct5.c, - testsuite/libffi.call/nested_struct6.c, - testsuite/libffi.call/nested_struct7.c, - testsuite/libffi.call/nested_struct8.c, - testsuite/libffi.call/nested_struct9.c, - testsuite/libffi.call/problem1.c, - testsuite/libffi.call/return_ldl.c, - testsuite/libffi.call/return_ll1.c, - testsuite/libffi.call/stret_large.c, - testsuite/libffi.call/stret_large2.c, - testsuite/libffi.call/stret_medium.c, - testsuite/libffi.call/stret_medium2.c, - testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead - of checking for MMAP. Use intptr_t instead of long casts. - -2009-06-04 Andrew Haley - - * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. - -2009-06-04 Andrew Haley - - * src/mips/o32.S, - src/mips/n32.S: Fix licence formatting. - -2009-06-04 Andrew Haley - - * src/x86/darwin.S: Fix licence formatting. - src/x86/win32.S: Likewise. - src/sh64/sysv.S: Likewise. - src/sh/sysv.S: Likewise. - -2009-06-04 Andrew Haley - - * src/sh64/ffi.c: Remove lint directives. Was missing from merge - of Andreas Tobler's patch from 2006-04-22. - -2009-06-04 Andrew Haley - - * src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of - 2007-03-07. - -2008-12-26 Timothy Wall - - * testsuite/libffi.call/cls_longdouble.c, - testsuite/libffi.call/cls_longdouble_va.c, - testsuite/libffi.call/cls_align_longdouble.c, - testsuite/libffi.call/cls_align_longdouble_split.c, - testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected - failures on x86_64 cygwin/mingw. - -2008-12-22 Timothy Wall - - * testsuite/libffi.call/closure_fn0.c, - testsuite/libffi.call/closure_fn1.c, - testsuite/libffi.call/closure_fn2.c, - testsuite/libffi.call/closure_fn3.c, - testsuite/libffi.call/closure_fn4.c, - testsuite/libffi.call/closure_fn5.c, - testsuite/libffi.call/closure_fn6.c, - testsuite/libffi.call/closure_loc_fn0.c, - testsuite/libffi.call/closure_stdcall.c, - testsuite/libffi.call/cls_align_pointer.c, - testsuite/libffi.call/cls_pointer.c, - testsuite/libffi.call/cls_pointer_stack.c: use portable cast from - pointer to integer (intptr_t). - * testsuite/libffi.call/cls_longdouble.c: disable for win64. - -2008-12-19 Anthony Green - - * configure.ac: Bump version to 3.0.8. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-11-11 Anthony Green - - * configure.ac: Bump version to 3.0.7. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-08-25 Andreas Tobler - - * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and - FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. - Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. - Adjust copyright notice. - * src/powerpc/ffi.c: Add two new flags to indicate if we have one - register or two register to use for FFI_SYSV structs. - (ffi_prep_cif_machdep): Pass the right register flag introduced above. - (ffi_closure_helper_SYSV): Fix the return type for - FFI_SYSV_TYPE_SMALL_STRUCT. Comment. - Adjust copyright notice. - -2008-07-24 Anthony Green - - * testsuite/libffi.call/cls_dbls_struct.c, - testsuite/libffi.call/cls_double_va.c, - testsuite/libffi.call/cls_longdouble.c, - testsuite/libffi.call/cls_longdouble_va.c, - testsuite/libffi.call/cls_pointer.c, - testsuite/libffi.call/cls_pointer_stack.c, - testsuite/libffi.call/err_bad_abi.c: Clean up failures from - compiler warnings. - -2008-07-17 Anthony Green - - * configure.ac: Bump version to 3.0.6. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. Add documentation. - * README: Update for new release. - -2008-07-16 Kaz Kojima - - * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned - int. - -2008-07-16 Kaz Kojima - - * src/sh/sysv.S: Add .note.GNU-stack on Linux. - * src/sh64/sysv.S: Likewise. - -2008-04-03 Anthony Green - - * libffi.pc.in (Libs): Add -L${libdir}. - * configure.ac: Bump version to 3.0.5. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-04-03 Anthony Green - Xerces Ranby - - * include/ffi.h.in: Wrap definition of target architecture to - protect from double definitions. - -2008-03-22 Moriyoshi Koizumi - - * src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in - closure_loc_fn0.c. - * testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0): - New test. - -2008-03-04 Anthony Green - Blake Chaffin - hos@tamanegi.org - - * testsuite/libffi.call/cls_align_longdouble_split2.c - testsuite/libffi.call/cls_align_longdouble_split.c - testsuite/libffi.call/cls_dbls_struct.c - testsuite/libffi.call/cls_double_va.c - testsuite/libffi.call/cls_longdouble.c - testsuite/libffi.call/cls_longdouble_va.c - testsuite/libffi.call/cls_pointer.c - testsuite/libffi.call/cls_pointer_stack.c - testsuite/libffi.call/err_bad_abi.c - testsuite/libffi.call/err_bad_typedef.c - testsuite/libffi.call/huge_struct.c - testsuite/libffi.call/stret_large2.c - testsuite/libffi.call/stret_large.c - testsuite/libffi.call/stret_medium2.c - testsuite/libffi.call/stret_medium.c: New tests from Apple. - -2008-02-26 Jakub Jelinek - Anthony Green - - * src/alpha/osf.S: Add .note.GNU-stack on Linux. - * src/s390/sysv.S: Likewise. - * src/powerpc/linux64.S: Likewise. - * src/powerpc/linux64_closure.S: Likewise. - * src/powerpc/ppc_closure.S: Likewise. - * src/powerpc/sysv.S: Likewise. - * src/x86/unix64.S: Likewise. - * src/x86/sysv.S: Likewise. - * src/sparc/v8.S: Likewise. - * src/sparc/v9.S: Likewise. - * src/m68k/sysv.S: Likewise. - * src/ia64/unix.S: Likewise. - * src/arm/sysv.S: Likewise. - -2008-02-26 Anthony Green - Thomas Heller - - * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C - comment. - -2008-02-26 Anthony Green - Thomas Heller - - * include/ffi.h.in: Change void (*)() to void (*)(void). - -2008-02-26 Anthony Green - Thomas Heller - - * src/alpha/ffi.c: Change void (*)() to void (*)(void). - src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c, - src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c, - src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S, - src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c, - src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c, - src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S, - src/x86/ffi64.c: Ditto. - -2008-02-24 Anthony Green - - * configure.ac: Accept openbsd*, not just openbsd. - Bump version to 3.0.4. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-02-22 Anthony Green - - * README: Clean up list of tested platforms. - -2008-02-22 Anthony Green - - * configure.ac: Bump version to 3.0.3. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. Clean up test docs. - -2008-02-22 Bjoern Koenig - Andreas Tobler - - * configure.ac: Add amd64-*-freebsd* target. - * configure: Regenerate. - -2008-02-22 Thomas Heller - - * configure.ac: Add x86 OpenBSD support. - * configure: Rebuilt. - -2008-02-21 Thomas Heller - - * README: Change "make test" to "make check". - -2008-02-21 Anthony Green - - * configure.ac: Bump version to 3.0.2. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-02-21 Björn König - - * src/x86/freebsd.S: New file. - * configure.ac: Add x86 FreeBSD support. - * Makefile.am: Ditto. - -2008-02-15 Anthony Green - - * configure.ac: Bump version to 3.0.1. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * libtool-version: Increment revision. - * README: Update for new release. - -2008-02-15 David Daney - - * src/mips/ffi.c: Remove extra '>' from include directive. - (ffi_prep_closure_loc): Use clear_location instead of tramp. - -2008-02-15 Anthony Green - - * configure.ac: Bump version to 3.0.0. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - -2008-02-15 David Daney - - * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): - Define (conditionally), and use it to include cachectl.h. - (ffi_prep_closure_loc): Fix cache flushing. - * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. - -2008-02-15 Anthony Green - - * man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3: - Update dates and remove all references to ffi_prep_closure. - * configure.ac: Bump version to 2.99.9. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - -2008-02-15 Anthony Green - - * man/ffi_prep_closure.3: Delete. - * man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3. - (man_MANS): Ditto. - * man/Makefile.in: Rebuilt. - * configure.ac: Bump version to 2.99.8. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - -2008-02-14 Anthony Green - - * configure.ac: Bump version to 2.99.7. - * configure, doc/stamp-vti, doc/version.texi: Rebuilt. - * include/ffi.h.in LICENSE src/debug.c src/closures.c - src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h - src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c - src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S - src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c - src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c - src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S - src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h - src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c - src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S - src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h - src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h - src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S - src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h - src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S - src/arm/ffitarget.h src/prep_cif.c: Update license text. - -2008-02-14 Anthony Green - - * README: Update tested platforms. - * configure.ac: Bump version to 2.99.6. - * configure: Rebuilt. - -2008-02-14 Anthony Green - - * configure.ac: Bump version to 2.99.5. - * configure: Rebuilt. - * Makefile.am (EXTRA_DIST): Add darwin64.S - * Makefile.in: Rebuilt. - * testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree. - * LICENSE: Update WARRANTY. - -2008-02-14 Anthony Green - - * libffi.pc.in (libdir): Fix libdir definition. - * configure.ac: Bump version to 2.99.4. - * configure: Rebuilt. - -2008-02-14 Anthony Green - - * README: Update. - * libffi.info: New file. - * doc/stamp-vti: New file. - * configure.ac: Bump version to 2.99.3. - * configure: Rebuilt. - -2008-02-14 Anthony Green - - * Makefile.am (SUBDIRS): Add man dir. - * Makefile.in: Rebuilt. - * configure.ac: Create Makefile. - * configure: Rebuilt. - * man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3 - man/Makefile.am man/Makefile.in: New files. - -2008-02-14 Tom Tromey - - * aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt. - * mdate-sh, texinfo.tex: New files. - * Makefile.am (info_TEXINFOS): New variable. - * doc/libffi.texi: New file. - * doc/version.texi: Likewise. - -2008-02-14 Anthony Green - - * Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET). - (lib_LTLIBRARIES): Define. - (toolexeclib_LIBRARIES): Undefine. - * Makefile.in: Rebuilt. - * configure.ac: Reset version to 2.99.1. - * configure.in: Rebuilt. - -2008-02-14 Anthony Green - - * libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@. - * configure.ac: Reset version to 2.99.1. - * configure.in: Rebuilt. - * Makefile.am (EXTRA_DIST): Add ChangeLog.libffi. - * Makefile.in: Rebuilt. - * LICENSE: Update copyright notice. - -2008-02-14 Anthony Green - - * include/Makefile.am (nodist_includes_HEADERS): Define. Don't - distribute ffitarget.h or ffi.h from the build include dir. - * Makefile.in: Rebuilt. - -2008-02-14 Anthony Green - - * include/Makefile.am (includesdir): Install headers under libdir. - (pkgconfigdir): Define. Install libffi.pc. - * include/Makefile.in: Rebuilt. - * libffi.pc.in: Create. - * libtool-version: Increment CURRENT - * configure.ac: Add libffi.pc.in - * configure: Rebuilt. - -2008-02-03 Anthony Green - - * include/Makefile.am (includesdir): Fix header install with - DESTDIR. - * include/Makefile.in: Rebuilt. - -2008-02-03 Timothy Wall - - * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return - offset based on code pointer, not data pointer. - -2008-02-01 Anthony Green - - * include/Makefile.am: Fix header installs. - * Makefile.am: Ditto. - * include/Makefile.in: Rebuilt. - * Makefile.in: Ditto. - -2008-02-01 Anthony Green - - * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL, - FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last - patch. - -2008-01-31 Anthony Green - - * Makefile.am (EXTRA_DIST): Add missing files. - * testsuite/Makefile.am: Ditto. - * Makefile.in, testsuite/Makefile.in: Rebuilt. - -2008-01-31 Timothy Wall - - * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall - closures. - * src/x86/ffitarget.h: Increase size of trampoline for stdcall - closures. - * src/x86/win32.S: Add assembly for stdcall closure. - * src/x86/ffi.c: Initialize stdcall closure trampoline. - -2008-01-30 H.J. Lu - - PR libffi/34612 - * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when - returning struct. - - * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer" - tests. - -2008-01-30 Anthony Green - - * Makefile.am, include/Makefile.am: Move headers to - libffi_la_SOURCES for new automake. - * Makefile.in, include/Makefile.in: Rebuilt. - - * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for - execution outside of gcc tree. - * testsuite/lib/target-libpath.exp: Ditto. - - * testsuite/lib/libffi-dg.exp: Many changes to allow for execution - outside of gcc tree. - diff --git a/llgo/third_party/gofrontend/libffi/ChangeLog.libgcj b/llgo/third_party/gofrontend/libffi/ChangeLog.libgcj deleted file mode 100644 index ea5d02f19ba325cc87665cbe299d35d98d15d529..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/ChangeLog.libgcj +++ /dev/null @@ -1,40 +0,0 @@ -2004-01-14 Kelley Cook - - * configure.in: Add in AC_PREREQ(2.13) - -2003-02-20 Alexandre Oliva - - * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to - config.status. - * configure: Rebuilt. - -2002-01-27 Alexandre Oliva - - * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. - Remove USE_LIBDIR conditional. - * Makefile.am (toolexecdir, toolexeclibdir): Don't override. - * Makefile.in, configure: Rebuilt. - -Mon Aug 9 18:33:38 1999 Rainer Orth - - * include/Makefile.in: Rebuilt. - * Makefile.in: Rebuilt - * Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native - builds. - Use USE_LIBDIR. - - * configure: Rebuilt. - * configure.in (USE_LIBDIR): Define for native builds. - Use lowercase in configure --help explanations. - -1999-08-08 Anthony Green - - * include/ffi.h.in (FFI_FN): Remove `...'. - -1999-08-08 Anthony Green - - * Makefile.in: Rebuilt. - * Makefile.am (AM_CFLAGS): Compile with -fexceptions. - - * src/x86/sysv.S: Add exception handling metadata. - diff --git a/llgo/third_party/gofrontend/libffi/ChangeLog.v1 b/llgo/third_party/gofrontend/libffi/ChangeLog.v1 deleted file mode 100644 index 369820cbdb02a22c2e29e202f44c51623932afb4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/ChangeLog.v1 +++ /dev/null @@ -1,764 +0,0 @@ -The libffi version 1 ChangeLog archive. - -Version 1 of libffi had per-directory ChangeLogs. Current and future -versions have a single ChangeLog file in the root directory. The -version 1 ChangeLogs have all been concatonated into this file for -future reference only. - ---- libffi ---------------------------------------------------------------- - -Mon Oct 5 02:17:50 1998 Anthony Green - - * configure.in: Boosted rev. - * configure, Makefile.in, aclocal.m4: Rebuilt. - * README: Boosted rev and updated release notes. - -Mon Oct 5 01:03:03 1998 Anthony Green - - * configure.in: Boosted rev. - * configure, Makefile.in, aclocal.m4: Rebuilt. - * README: Boosted rev and updated release notes. - -1998-07-25 Andreas Schwab - - * m68k/ffi.c (ffi_prep_cif_machdep): Use bitmask for cif->flags. - Correctly handle small structures. - (ffi_prep_args): Also handle small structures. - (ffi_call): Pass size of return type to ffi_call_SYSV. - * m68k/sysv.S: Adjust for above changes. Correctly align small - structures in the return value. - - * types.c (uint64, sint64) [M68K]: Change alignment to 4. - -Fri Apr 17 17:26:58 1998 Anthony Green - - * configure.in: Boosted rev. - * configure,Makefile.in,aclocal.m4: Rebuilt. - * README: Boosted rev and added release notes. - -Sun Feb 22 00:50:41 1998 Geoff Keating - - * configure.in: Add PowerPC config bits. - -1998-02-14 Andreas Schwab - - * configure.in: Add m68k config bits. Change AC_CANONICAL_SYSTEM - to AC_CANONICAL_HOST, this is not a compiler. Use $host instead - of $target. Remove AC_CHECK_SIZEOF(char), we already know the - result. Fix argument of AC_ARG_ENABLE. - * configure, fficonfig.h.in: Rebuilt. - -Tue Feb 10 20:53:40 1998 Richard Henderson - - * configure.in: Add Alpha config bits. - -Tue May 13 13:39:20 1997 Anthony Green - - * README: Updated dates and reworded Irix comments. - - * configure.in: Removed AC_PROG_RANLIB. - - * Makefile.in, aclocal.m4, config.guess, config.sub, configure, - ltmain.sh, */Makefile.in: libtoolized again and rebuilt with - automake and autoconf. - -Sat May 10 18:44:50 1997 Tom Tromey - - * configure, aclocal.m4: Rebuilt. - * configure.in: Don't compute EXTRADIST; now handled in - src/Makefile.in. Removed macros implied by AM_INIT_AUTOMAKE. - Don't run AM_MAINTAINER_MODE. - -Thu May 8 14:34:05 1997 Anthony Green - - * missing, ltmain.sh, ltconfig.sh: Created. These are new files - required by automake and libtool. - - * README: Boosted rev to 1.14. Added notes. - - * acconfig.h: Moved PACKAGE and VERSION for new automake. - - * configure.in: Changes for libtool. - - * Makefile.am (check): make test now make check. Uses libtool now. - - * Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt. - -Thu May 1 16:27:07 1997 Anthony Green - - * missing: Added file required by new automake. - -Tue Nov 26 14:10:42 1996 Anthony Green - - * acconfig.h: Added USING_PURIFY flag. This is defined when - --enable-purify-safety was used at configure time. - - * configure.in (allsources): Added --enable-purify-safety switch. - (VERSION): Boosted rev to 1.13. - * configure: Rebuilt. - -Fri Nov 22 06:46:12 1996 Anthony Green - - * configure.in (VERSION): Boosted rev to 1.12. - Removed special CFLAGS hack for gcc. - * configure: Rebuilt. - - * README: Boosted rev to 1.12. Added notes. - - * Many files: Cygnus Support changed to Cygnus Solutions. - -Wed Oct 30 11:15:25 1996 Anthony Green - - * configure.in (VERSION): Boosted rev to 1.11. - * configure: Rebuilt. - - * README: Boosted rev to 1.11. Added notes about GNU make. - -Tue Oct 29 12:25:12 1996 Anthony Green - - * configure.in: Fixed -Wall trick. - (VERSION): Boosted rev. - * configure: Rebuilt - - * acconfig.h: Needed for --enable-debug configure switch. - - * README: Boosted rev to 1.09. Added more notes on building - libffi, and LCLint. - - * configure.in: Added --enable-debug switch. Boosted rev to - 1.09. - * configure: Rebuilt - -Tue Oct 15 13:11:28 1996 Anthony Green - - * configure.in (VERSION): Boosted rev to 1.08 - * configure: Rebuilt. - - * README: Added n32 bug fix notes. - - * Makefile.am: Added "make lint" production. - * Makefile.in: Rebuilt. - -Mon Oct 14 10:54:46 1996 Anthony Green - - * README: Added web page reference. - - * configure.in, README: Boosted rev to 1.05 - * configure: Rebuilt. - - * README: Fixed n32 sample code. - -Fri Oct 11 17:09:28 1996 Anthony Green - - * README: Added sparc notes. - - * configure.in, README: Boosted rev to 1.04. - * configure: Rebuilt. - -Thu Oct 10 10:31:03 1996 Anthony Green - - * configure.in, README: Boosted rev to 1.03. - * configure: Rebuilt. - - * README: Added struct notes. - - * Makefile.am (EXTRA_DIST): Added LICENSE to distribution. - * Makefile.in: Rebuilt. - - * README: Removed Linux section. No special notes now - because aggregates arg/return types work. - -Wed Oct 9 16:16:42 1996 Anthony Green - - * README, configure.in (VERSION): Boosted rev to 1.02 - * configure: Rebuilt. - -Tue Oct 8 11:56:33 1996 Anthony Green - - * README (NOTE): Added n32 notes. - - * Makefile.am: Added test production. - * Makefile: Rebuilt - - * README: spell checked! - - * configure.in (VERSION): Boosted rev to 1.01 - * configure: Rebuilt. - -Mon Oct 7 15:50:22 1996 Anthony Green - - * configure.in: Added nasty bit to support SGI tools. - * configure: Rebuilt. - - * README: Added SGI notes. Added note about automake bug. - -Mon Oct 7 11:00:28 1996 Anthony Green - - * README: Rewrote intro, and fixed examples. - -Fri Oct 4 10:19:55 1996 Anthony Green - - * configure.in: -D$TARGET is no longer used as a compiler switch. - It is now inserted into ffi.h at configure time. - * configure: Rebuilt. - - * FFI_ABI and FFI_STATUS are now ffi_abi and ffi_status. - -Thu Oct 3 13:47:34 1996 Anthony Green - - * README, LICENSE: Created. Wrote some docs. - - * configure.in: Don't barf on i586-unknown-linuxaout. - Added EXTRADIST code for "make dist". - * configure: Rebuilt. - - * */Makefile.in: Rebuilt with patched automake. - -Tue Oct 1 17:12:25 1996 Anthony Green - - * Makefile.am, aclocal.m4, config.guess, config.sub, - configure.in, fficonfig.h.in, install-sh, mkinstalldirs, - stamp-h.in: Created - * Makefile.in, configure: Generated - ---- libffi/include -------------------------------------------------------- - -Tue Feb 24 13:09:36 1998 Anthony Green - - * ffi_mips.h: Updated FFI_TYPE_STRUCT_* values based on - ffi.h.in changes. This is a work-around for SGI's "simple" - assembler. - -Sun Feb 22 00:51:55 1998 Geoff Keating - - * ffi.h.in: PowerPC support. - -1998-02-14 Andreas Schwab - - * ffi.h.in: Add m68k support. - (FFI_TYPE_LONGDOUBLE): Make it a separate value. - -Tue Feb 10 20:55:16 1998 Richard Henderson - - * ffi.h.in (SIZEOF_ARG): Use a pointer type by default. - - * ffi.h.in: Alpha support. - -Fri Nov 22 06:48:45 1996 Anthony Green - - * ffi.h.in, ffi_common.h: Cygnus Support -> Cygnus Solutions. - -Wed Nov 20 22:31:01 1996 Anthony Green - - * ffi.h.in: Added ffi_type_void definition. - -Tue Oct 29 12:22:40 1996 Anthony Green - - * Makefile.am (hack_DATA): Always install ffi_mips.h. - - * ffi.h.in: Removed FFI_DEBUG. It's now in the correct - place (acconfig.h). - Added #include for size_t definition. - -Tue Oct 15 17:23:35 1996 Anthony Green - - * ffi.h.in, ffi_common.h, ffi_mips.h: More clean up. - Commented out #define of FFI_DEBUG. - -Tue Oct 15 13:01:06 1996 Anthony Green - - * ffi_common.h: Added bool definition. - - * ffi.h.in, ffi_common.h: Clean up based on LCLint output. - Added funny /*@...@*/ comments to annotate source. - -Mon Oct 14 12:29:23 1996 Anthony Green - - * ffi.h.in: Interface changes based on feedback from Jim - Blandy. - -Fri Oct 11 16:49:35 1996 Anthony Green - - * ffi.h.in: Small change for sparc support. - -Thu Oct 10 14:53:37 1996 Anthony Green - - * ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for - special structure return types. - -Wed Oct 9 13:55:57 1996 Anthony Green - - * ffi.h.in: Added SIZEOF_ARG definition for X86 - -Tue Oct 8 11:40:36 1996 Anthony Green - - * ffi.h.in (FFI_FN): Added macro for eliminating compiler warnings. - Use it to case your function pointers to the proper type. - - * ffi_mips.h (SIZEOF_ARG): Added magic to fix type promotion bug. - - * Makefile.am (EXTRA_DIST): Added ffi_mips.h to EXTRA_DIST. - * Makefile: Rebuilt. - - * ffi_mips.h: Created. Moved all common mips definitions here. - -Mon Oct 7 10:58:12 1996 Anthony Green - - * ffi.h.in: The SGI assember is very picky about parens. Redefined - some macros to avoid problems. - - * ffi.h.in: Added FFI_DEFAULT_ABI definitions. Also added - externs for pointer, and 64bit integral ffi_types. - -Fri Oct 4 09:51:37 1996 Anthony Green - - * ffi.h.in: Added FFI_ABI member to ffi_cif and changed - function prototypes accordingly. - Added #define @TARGET@. Now programs including ffi.h don't - have to specify this themselves. - -Thu Oct 3 15:36:44 1996 Anthony Green - - * ffi.h.in: Changed ffi_prep_cif's values from void* to void** - - * Makefile.am (EXTRA_DIST): Added EXTRA_DIST for "make dist" - to work. - * Makefile.in: Regenerated. - -Wed Oct 2 10:16:59 1996 Anthony Green - - * Makefile.am: Created - * Makefile.in: Generated - - * ffi_common.h: Added rcsid comment - -Tue Oct 1 17:13:51 1996 Anthony Green - - * ffi.h.in, ffi_common.h: Created - ---- libffi/src ------------------------------------------------------------ - -Mon Oct 5 02:17:50 1998 Anthony Green - - * arm/ffi.c, arm/sysv.S: Created. - - * Makefile.am: Added arm files. - * Makefile.in: Rebuilt. - -Mon Oct 5 01:41:38 1998 Anthony Green - - * Makefile.am (libffi_la_LDFLAGS): Incremented revision. - -Sun Oct 4 16:27:17 1998 Anthony Green - - * alpha/osf.S (ffi_call_osf): Patch for DU assembler. - - * ffitest.c (main): long long and long double return values work - for x86. - -Fri Apr 17 11:50:58 1998 Anthony Green - - * Makefile.in: Rebuilt. - - * ffitest.c (main): Floating point tests not executed for systems - with broken lond double (SunOS 4 w/ GCC). - - * types.c: Fixed x86 alignment info for long long types. - -Thu Apr 16 07:15:28 1998 Anthony Green - - * ffitest.c: Added more notes about GCC bugs under Irix 6. - -Wed Apr 15 08:42:22 1998 Anthony Green - - * ffitest.c (struct5): New test function. - (main): New test with struct5. - -Thu Mar 5 10:48:11 1998 Anthony Green - - * prep_cif.c (initialize_aggregate): Fix assertion for - nested structures. - -Tue Feb 24 16:33:41 1998 Anthony Green - - * prep_cif.c (ffi_prep_cif): Added long double support for sparc. - -Sun Feb 22 00:52:18 1998 Geoff Keating - - * powerpc/asm.h: New file. - * powerpc/ffi.c: New file. - * powerpc/sysv.S: New file. - * Makefile.am: PowerPC port. - * ffitest.c (main): Allow all tests to run even in presence of gcc - bug on PowerPC. - -1998-02-17 Anthony Green - - * mips/ffi.c: Fixed comment typo. - - * x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat): - Fixed x86 long double return handling. - - * types.c: Fixed x86 long double alignment info. - -1998-02-14 Andreas Schwab - - * types.c: Add m68k support. - - * ffitest.c (floating): Add long double parameter. - (return_ll, ldblit): New functions to test long long and long - double return value. - (main): Fix type error in assignment of ts[1-4]_type.elements. - Add tests for long long and long double arguments and return - values. - - * prep_cif.c (ffi_prep_cif) [M68K]: Don't allocate argument for - struct value pointer. - - * m68k/ffi.c, m68k/sysv.S: New files. - * Makefile.am: Add bits for m68k port. Add kludge to work around - automake deficiency. - (test): Don't require "." in $PATH. - * Makefile.in: Rebuilt. - -Wed Feb 11 07:36:50 1998 Anthony Green - - * Makefile.in: Rebuilt. - -Tue Feb 10 20:56:00 1998 Richard Henderson - - * alpha/ffi.c, alpha/osf.S: New files. - * Makefile.am: Alpha port. - -Tue Nov 18 14:12:07 1997 Anthony Green - - * mips/ffi.c (ffi_prep_cif_machdep): Initialize rstruct_flag - for n32. - -Tue Jun 3 17:18:20 1997 Anthony Green - - * ffitest.c (main): Added hack to get structure tests working - correctly. - -Sat May 10 19:06:42 1997 Tom Tromey - - * Makefile.in: Rebuilt. - * Makefile.am (EXTRA_DIST): Explicitly list all distributable - files in subdirs. - (VERSION, CC): Removed. - -Thu May 8 17:19:01 1997 Anthony Green - - * Makefile.am: Many changes for new automake and libtool. - * Makefile.in: Rebuilt. - -Fri Nov 22 06:57:56 1996 Anthony Green - - * ffitest.c (main): Fixed test case for non mips machines. - -Wed Nov 20 22:31:59 1996 Anthony Green - - * types.c: Added ffi_type_void declaration. - -Tue Oct 29 13:07:19 1996 Anthony Green - - * ffitest.c (main): Fixed character constants. - (main): Emit warning for structure test 3 failure on Sun. - - * Makefile.am (VPATH): Fixed VPATH def'n so automake won't - strip it out. - Moved distdir hack from libffi to automake. - (ffitest): Added missing -c for $(COMPILE) (change in automake). - * Makefile.in: Rebuilt. - -Tue Oct 15 13:08:20 1996 Anthony Green - - * Makefile.am: Added "make lint" production. - * Makefile.in: Rebuilt. - - * prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro. - Clean up based on LCLint output. Added funny /*@...@*/ comments to - annotate source. - - * ffitest.c, debug.c: Cleaned up code. - -Mon Oct 14 12:26:56 1996 Anthony Green - - * ffitest.c: Changes based on interface changes. - - * prep_cif.c (ffi_prep_cif): Cleaned up interface based on - feedback from Jim Blandy. - -Fri Oct 11 15:53:18 1996 Anthony Green - - * ffitest.c: Reordered tests while porting to sparc. - Made changes to handle lame structure passing for sparc. - Removed calls to fflush(). - - * prep_cif.c (ffi_prep_cif): Added special case for sparc - aggregate type arguments. - -Thu Oct 10 09:56:51 1996 Anthony Green - - * ffitest.c (main): Added structure passing/returning tests. - - * prep_cif.c (ffi_prep_cif): Perform proper initialization - of structure return types if needed. - (initialize_aggregate): Bug fix - -Wed Oct 9 16:04:20 1996 Anthony Green - - * types.c: Added special definitions for x86 (double doesn't - need double word alignment). - - * ffitest.c: Added many tests - -Tue Oct 8 09:19:22 1996 Anthony Green - - * prep_cif.c (ffi_prep_cif): Fixed assertion. - - * debug.c (ffi_assert): Must return a non void now. - - * Makefile.am: Added test production. - * Makefile: Rebuilt. - - * ffitest.c (main): Created. - - * types.c: Created. Stripped common code out of */ffi.c. - - * prep_cif.c: Added missing stdlib.h include. - - * debug.c (ffi_type_test): Used "a" to eliminate compiler - warnings in non-debug builds. Included ffi_common.h. - -Mon Oct 7 15:36:42 1996 Anthony Green - - * Makefile.am: Added a rule for .s -> .o - This is required by the SGI compiler. - * Makefile: Rebuilt. - -Fri Oct 4 09:51:08 1996 Anthony Green - - * prep_cif.c (initialize_aggregate): Moved abi specification - to ffi_prep_cif(). - -Thu Oct 3 15:37:37 1996 Anthony Green - - * prep_cif.c (ffi_prep_cif): Changed values from void* to void**. - (initialize_aggregate): Fixed aggregate type initialization. - - * Makefile.am (EXTRA_DIST): Added support code for "make dist". - * Makefile.in: Regenerated. - -Wed Oct 2 11:41:57 1996 Anthony Green - - * debug.c, prep_cif: Created. - - * Makefile.am: Added debug.o and prep_cif.o to OBJ. - * Makefile.in: Regenerated. - - * Makefile.am (INCLUDES): Added missing -I../include - * Makefile.in: Regenerated. - -Tue Oct 1 17:11:51 1996 Anthony Green - - * error.c, Makefile.am: Created. - * Makefile.in: Generated. - ---- libffi/src/x86 -------------------------------------------------------- - -Sun Oct 4 16:27:17 1998 Anthony Green - - * sysv.S (retlongdouble): Fixed long long return value support. - * ffi.c (ffi_prep_cif_machdep): Ditto. - -Wed May 13 04:30:33 1998 Anthony Green - - * ffi.c (ffi_prep_cif_machdep): Fixed long double return value - support. - -Wed Apr 15 08:43:20 1998 Anthony Green - - * ffi.c (ffi_prep_args): small struct support was missing. - -Thu May 8 16:53:58 1997 Anthony Green - - * objects.mak: Removed. - -Mon Dec 2 15:12:58 1996 Tom Tromey - - * sysv.S: Use .balign, for a.out Linux boxes. - -Tue Oct 15 13:06:50 1996 Anthony Green - - * ffi.c: Clean up based on LCLint output. - Added funny /*@...@*/ comments to annotate source. - -Fri Oct 11 16:43:38 1996 Anthony Green - - * ffi.c (ffi_call): Added assertion for bad ABIs. - -Wed Oct 9 13:57:27 1996 Anthony Green - - * sysv.S (retdouble): Fixed double return problems. - - * ffi.c (ffi_call): Corrected fn arg definition. - (ffi_prep_cif_machdep): Fixed double return problems - -Tue Oct 8 12:12:49 1996 Anthony Green - - * ffi.c: Moved ffi_type definitions to types.c. - (ffi_prep_args): Fixed type promotion bug. - -Mon Oct 7 15:53:06 1996 Anthony Green - - * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' - -Fri Oct 4 09:54:53 1996 Anthony Green - - * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped - remaining args. - -Wed Oct 2 10:07:05 1996 Anthony Green - - * ffi.c, sysv.S, objects.mak: Created. - (ffi_prep_cif): cif->rvalue no longer initialized to NULL. - (ffi_prep_cif_machdep): Moved machine independent cif processing - to src/prep_cif.c. Introduced ffi_prep_cif_machdep(). - ---- libffi/src/mips ------------------------------------------------------- - -Tue Feb 17 17:18:07 1998 Anthony Green - - * o32.S: Fixed typo in comment. - - * ffi.c (ffi_prep_cif_machdep): Fixed argument processing. - -Thu May 8 16:53:58 1997 Anthony Green - - * o32.s, n32.s: Wrappers for SGI tool support. - - * objects.mak: Removed. - -Tue Oct 29 14:37:45 1996 Anthony Green - - * ffi.c (ffi_prep_args): Changed int z to size_t z. - -Tue Oct 15 13:17:25 1996 Anthony Green - - * n32.S: Fixed bad stack munging. - - * ffi.c: Moved prototypes for ffi_call_?32() to here from - ffi_mips.h because extended_cif is not defined in ffi_mips.h. - -Mon Oct 14 12:42:02 1996 Anthony Green - - * ffi.c: Interface changes based on feedback from Jim Blandy. - -Thu Oct 10 11:22:16 1996 Anthony Green - - * n32.S, ffi.c: Lots of changes to support passing and - returning structures with the n32 calling convention. - - * n32.S: Fixed fn pointer bug. - - * ffi.c (ffi_prep_cif_machdep): Fix for o32 structure - return values. - (ffi_prep_args): Fixed n32 structure passing when structures - partially fit in registers. - -Wed Oct 9 13:49:25 1996 Anthony Green - - * objects.mak: Added n32.o. - - * n32.S: Created. - - * ffi.c (ffi_prep_args): Added magic to support proper - n32 processing. - -Tue Oct 8 10:37:35 1996 Anthony Green - - * ffi.c: Moved ffi_type definitions to types.c. - (ffi_prep_args): Fixed type promotion bug. - - * o32.S: This code is only built for o32 compiles. - A lot of the #define cruft has moved to ffi_mips.h. - - * ffi.c (ffi_prep_cif_machdep): Fixed arg flags. Second arg - is only processed if the first is either a float or double. - -Mon Oct 7 15:33:59 1996 Anthony Green - - * o32.S: Modified to compile under each of o32, n32 and n64. - - * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' - -Fri Oct 4 09:53:25 1996 Anthony Green - - * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped - remaining args. - -Wed Oct 2 17:41:22 1996 Anthony Green - - * o32.S: Removed crufty definitions. - -Wed Oct 2 12:53:42 1996 Anthony Green - - * ffi.c (ffi_prep_cif): cif->rvalue no longer initialized to NULL. - (ffi_prep_cif_machdep): Moved all machine independent cif processing - to src/prep_cif.c. Introduced ffi_prep_cif_machdep. Return types - of FFI_TYPE_STRUCT are no different than FFI_TYPE_INT. - -Tue Oct 1 17:11:02 1996 Anthony Green - - * ffi.c, o32.S, object.mak: Created - ---- libffi/src/sparc ------------------------------------------------------ - -Tue Feb 24 16:33:18 1998 Anthony Green - - * ffi.c (ffi_prep_args): Added long double support. - -Thu May 8 16:53:58 1997 Anthony Green - - * objects.mak: Removed. - -Thu May 1 16:07:56 1997 Anthony Green - - * v8.S: Fixed minor portability problem reported by - Russ McManus . - -Tue Nov 26 14:12:43 1996 Anthony Green - - * v8.S: Used STACKFRAME define elsewhere. - - * ffi.c (ffi_prep_args): Zero out space when USING_PURIFY - is set. - (ffi_prep_cif_machdep): Allocate the correct stack frame - space for functions with < 6 args. - -Tue Oct 29 15:08:55 1996 Anthony Green - - * ffi.c (ffi_prep_args): int z is now size_t z. - -Mon Oct 14 13:31:24 1996 Anthony Green - - * v8.S (ffi_call_V8): Gordon rewrites this again. It looks - great now. - - * ffi.c (ffi_call): The comment about hijacked registers - is no longer valid after gordoni hacked v8.S. - - * v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler. - - * v8.S, ffi.c: ffi_call() had changed to accept more than - two args, so v8.S had to change (because it hijacks incoming - arg registers). - - * ffi.c: Interface changes based on feedback from Jim Blandy. - -Thu Oct 10 17:48:16 1996 Anthony Green - - * ffi.c, v8.S, objects.mak: Created. - - diff --git a/llgo/third_party/gofrontend/libffi/LICENSE b/llgo/third_party/gofrontend/libffi/LICENSE deleted file mode 100644 index a66fab4f25a05b6b7d2ac8b438e86214c02135b8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -libffi - Copyright (c) 1996-2014 Anthony Green, Red Hat, Inc and others. -See source files for details. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -``Software''), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/llgo/third_party/gofrontend/libffi/Makefile.am b/llgo/third_party/gofrontend/libffi/Makefile.am deleted file mode 100644 index 64ff1c1e530159f6dcbe47bc0b15b6fd091b7888..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/Makefile.am +++ /dev/null @@ -1,219 +0,0 @@ -## Process this with automake to create Makefile.in - -AUTOMAKE_OPTIONS = foreign subdir-objects - -ACLOCAL_AMFLAGS = -I .. -I ../config - -SUBDIRS = include testsuite man - -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj \ - ChangeLog.libffi ChangeLog.libffi-3.1 \ - m4/libtool.m4 m4/lt~obsolete.m4 \ - m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ - m4/ltversion.m4 src/debug.c msvcc.sh \ - generate-darwin-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj \ - libtool-ldflags - -# Automake Documentation: -# If your package has Texinfo files in many directories, you can use the -# variable TEXINFO_TEX to tell Automake where to find the canonical -# `texinfo.tex' for your package. The value of this variable should be -# the relative path from the current `Makefile.am' to `texinfo.tex'. -TEXINFO_TEX = ../gcc/doc/include/texinfo.tex - -# Defines info, dvi, pdf and html targets -MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include -info_TEXINFOS = doc/libffi.texi - -# AM_CONDITIONAL on configure option --generated-files-in-srcdir -if GENINSRC -STAMP_GENINSRC = stamp-geninsrc -else -STAMP_GENINSRC = -endif - -# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO]) -if BUILD_INFO -STAMP_BUILD_INFO = stamp-build-info -else -STAMP_BUILD_INFO = -endif - -all-local: $(STAMP_GENINSRC) - -stamp-geninsrc: doc/libffi.info - cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info - @touch $@ - -doc/libffi.info: $(STAMP_BUILD_INFO) - -stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) - $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi - @touch $@ - -CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info -MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info - -## ################################################################ - -## -## This section is for make and multilib madness. -## - -# 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)' \ - 'RUNTESTFLAGS=$(RUNTESTFLAGS)' \ - 'SHELL=$(SHELL)' \ - 'exec_prefix=$(exec_prefix)' \ - 'infodir=$(infodir)' \ - 'libdir=$(libdir)' \ - 'mandir=$(mandir)' \ - 'prefix=$(prefix)' \ - 'AR=$(AR)' \ - 'AS=$(AS)' \ - 'CC=$(CC)' \ - 'CXX=$(CXX)' \ - 'LD=$(LD)' \ - 'NM=$(NM)' \ - 'RANLIB=$(RANLIB)' \ - 'DESTDIR=$(DESTDIR)' - -# Subdir rules rely on $(FLAGS_TO_PASS) -FLAGS_TO_PASS = $(AM_MAKEFLAGS) - -MAKEOVERRIDES= - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libffi.pc - -toolexeclib_LTLIBRARIES = libffi.la -noinst_LTLIBRARIES = libffi_convenience.la - -libffi_la_SOURCES = src/prep_cif.c src/types.c \ - src/raw_api.c src/java_raw_api.c src/closures.c - -if FFI_DEBUG -libffi_la_SOURCES += src/debug.c -endif - -noinst_HEADERS = \ - src/aarch64/ffitarget.h src/aarch64/internal.h \ - src/alpha/ffitarget.h src/alpha/internal.h \ - src/arc/ffitarget.h \ - src/arm/ffitarget.h src/arm/internal.h \ - src/avr32/ffitarget.h \ - src/bfin/ffitarget.h \ - src/cris/ffitarget.h \ - src/frv/ffitarget.h \ - src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/m32r/ffitarget.h \ - src/m68k/ffitarget.h \ - src/m88k/ffitarget.h \ - src/metag/ffitarget.h \ - src/microblaze/ffitarget.h \ - src/mips/ffitarget.h \ - src/moxie/ffitarget.h \ - src/nios2/ffitarget.h \ - src/or1k/ffitarget.h \ - src/pa/ffitarget.h \ - src/powerpc/ffitarget.h src/powerpc/asm.h src/powerpc/ffi_powerpc.h \ - src/s390/ffitarget.h \ - src/sh/ffitarget.h \ - src/sh64/ffitarget.h \ - src/sparc/ffitarget.h src/sparc/internal.h \ - src/tile/ffitarget.h \ - src/vax/ffitarget.h \ - src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \ - src/xtensa/ffitarget.h \ - src/dlmalloc.c - -EXTRA_libffi_la_SOURCES = \ - src/aarch64/ffi.c src/aarch64/sysv.S \ - src/alpha/ffi.c src/alpha/osf.S \ - src/arc/ffi.c src/arc/arcompact.S \ - src/arm/ffi.c src/arm/sysv.S \ - src/avr32/ffi.c src/avr32/sysv.S \ - src/bfin/ffi.c src/bfin/sysv.S \ - src/cris/ffi.c src/cris/sysv.S \ - src/frv/ffi.c src/frv/eabi.S \ - src/ia64/ffi.c src/ia64/unix.S \ - src/m32r/ffi.c src/m32r/sysv.S \ - src/m68k/ffi.c src/m68k/sysv.S \ - src/m88k/ffi.c src/m88k/obsd.S \ - src/metag/ffi.c src/metag/sysv.S \ - src/microblaze/ffi.c src/microblaze/sysv.S \ - src/mips/ffi.c src/mips/o32.S src/mips/n32.S \ - src/moxie/ffi.c src/moxie/eabi.S \ - src/nios2/ffi.c src/nios2/sysv.S \ - src/or1k/ffi.c src/or1k/sysv.S \ - src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \ - src/powerpc/sysv.S src/powerpc/linux64.S \ - src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ - src/powerpc/aix.S src/powerpc/darwin.S src/powerpc/aix_closure.S \ - src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \ - src/s390/ffi.c src/s390/sysv.S \ - src/sh/ffi.c src/sh/sysv.S \ - src/sh64/ffi.c src/sh64/sysv.S \ - src/sparc/ffi.c src/sparc/ffi64.c src/sparc/v8.S src/sparc/v9.S \ - src/tile/ffi.c src/tile/tile.S \ - src/vax/ffi.c src/vax/elfbsd.S \ - src/x86/ffi.c src/x86/sysv.S \ - src/x86/ffiw64.c src/x86/win64.S \ - src/x86/ffi64.c src/x86/unix64.S \ - src/x86/darwin64.S src/x86/darwin.S \ - src/x86/darwin64_c.c src/x86/darwin_c.c \ - src/xtensa/ffi.c src/xtensa/sysv.S - -TARGET_OBJ = @TARGET_OBJ@ -libffi_la_LIBADD = $(TARGET_OBJ) -libffi_la_DEPENDENCIES = $(TARGET_OBJ) - -libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) -EXTRA_libffi_convenience_la_SOURCES = $(EXTRA_libffi_la_SOURCES) -libffi_convenience_la_LIBADD = $(libffi_la_LIBADD) -libffi_convenience_la_DEPENDENCIES = $(libffi_la_DEPENDENCIES) -nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) - -LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) - -AM_CFLAGS = -Wall -g -fexceptions -if FFI_DEBUG -# Build debug. Define FFI_DEBUG on the commandline so that, when building with -# MSVC, it can link against the debug CRT. -AM_CFLAGS += -DFFI_DEBUG -endif - -libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) - -AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src -AM_CCASFLAGS = $(AM_CPPFLAGS) - -# Multilib support. Automake should provide these on its own. -all-recursive: all-multi -install-recursive: install-multi -mostlyclean-recursive: mostlyclean-multi -clean-recursive: clean-multi -distclean-recursive: distclean-multi -maintainer-clean-recursive: maintainer-clean-multi diff --git a/llgo/third_party/gofrontend/libffi/Makefile.in b/llgo/third_party/gofrontend/libffi/Makefile.in deleted file mode 100644 index 80ad274cef30590431038db714c129bd4e829d52..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/Makefile.in +++ /dev/null @@ -1,1860 +0,0 @@ -# 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@ - - - -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@ -@FFI_DEBUG_TRUE@am__append_1 = src/debug.c -# Build debug. Define FFI_DEBUG on the commandline so that, when building with -# MSVC, it can link against the debug CRT. -@FFI_DEBUG_TRUE@am__append_2 = -DFFI_DEBUG -subdir = . -DIST_COMMON = README ChangeLog $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(srcdir)/fficonfig.h.in \ - $(srcdir)/../mkinstalldirs $(srcdir)/libffi.pc.in \ - $(srcdir)/../depcomp mdate-sh $(srcdir)/doc/version.texi \ - $(srcdir)/doc/stamp-vti $(noinst_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ - $(top_srcdir)/../config/asmcfi.m4 \ - $(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)/acinclude.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_HEADER = fficonfig.h -CONFIG_CLEAN_FILES = libffi.pc -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)$(infodir)" \ - "$(DESTDIR)$(pkgconfigdir)" -LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) -am__DEPENDENCIES_1 = -am__dirstamp = $(am__leading_dot)dirstamp -@FFI_DEBUG_TRUE@am__objects_1 = src/debug.lo -am_libffi_la_OBJECTS = src/prep_cif.lo src/types.lo src/raw_api.lo \ - src/java_raw_api.lo src/closures.lo $(am__objects_1) -libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) -libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ -am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -am__objects_2 = src/prep_cif.lo src/types.lo src/raw_api.lo \ - src/java_raw_api.lo src/closures.lo $(am__objects_1) -am_libffi_convenience_la_OBJECTS = $(am__objects_2) -nodist_libffi_convenience_la_OBJECTS = -libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ - $(nodist_libffi_convenience_la_OBJECTS) -DEFAULT_INCLUDES = -I.@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/../depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libffi_la_SOURCES) $(EXTRA_libffi_la_SOURCES) \ - $(libffi_convenience_la_SOURCES) \ - $(EXTRA_libffi_convenience_la_SOURCES) \ - $(nodist_libffi_convenience_la_SOURCES) -MULTISRCTOP = -MULTIBUILDTOP = -MULTIDIRS = -MULTISUBDIR = -MULTIDO = true -MULTICLEAN = true -INFO_DEPS = doc/libffi.info -am__TEXINFO_TEX_DIR = $(srcdir)/../gcc/doc/include -DVIS = doc/libffi.dvi -PDFS = doc/libffi.pdf -PSS = doc/libffi.ps -HTMLS = doc/libffi.html -TEXINFOS = doc/libffi.texi -TEXI2DVI = texi2dvi -TEXI2PDF = $(TEXI2DVI) --pdf --batch -MAKEINFOHTML = $(MAKEINFO) --html -AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) -DVIPS = dvips -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 -DATA = $(pkgconfig_DATA) -HEADERS = $(noinst_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@ -AM_LTLDFLAGS = @AM_LTLDFLAGS@ -AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -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@ -FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ -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@ -TARGET = @TARGET@ -TARGETDIR = @TARGETDIR@ -TARGET_OBJ = @TARGET_OBJ@ -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@ -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 subdir-objects -ACLOCAL_AMFLAGS = -I .. -I ../config -SUBDIRS = include testsuite man -EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj \ - ChangeLog.libffi ChangeLog.libffi-3.1 \ - m4/libtool.m4 m4/lt~obsolete.m4 \ - m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ - m4/ltversion.m4 src/debug.c msvcc.sh \ - generate-darwin-source-and-headers.py \ - libffi.xcodeproj/project.pbxproj \ - libtool-ldflags - - -# Automake Documentation: -# If your package has Texinfo files in many directories, you can use the -# variable TEXINFO_TEX to tell Automake where to find the canonical -# `texinfo.tex' for your package. The value of this variable should be -# the relative path from the current `Makefile.am' to `texinfo.tex'. -TEXINFO_TEX = ../gcc/doc/include/texinfo.tex - -# Defines info, dvi, pdf and html targets -MAKEINFOFLAGS = -I $(srcdir)/../gcc/doc/include -info_TEXINFOS = doc/libffi.texi -@GENINSRC_FALSE@STAMP_GENINSRC = - -# AM_CONDITIONAL on configure option --generated-files-in-srcdir -@GENINSRC_TRUE@STAMP_GENINSRC = stamp-geninsrc -@BUILD_INFO_FALSE@STAMP_BUILD_INFO = - -# AM_CONDITIONAL on configure check ACX_CHECK_PROG_VER([MAKEINFO]) -@BUILD_INFO_TRUE@STAMP_BUILD_INFO = stamp-build-info -CLEANFILES = $(STAMP_GENINSRC) $(STAMP_BUILD_INFO) doc/libffi.info -MAINTAINERCLEANFILES = $(srcdir)/doc/libffi.info - -# 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)' \ - 'RUNTESTFLAGS=$(RUNTESTFLAGS)' \ - 'SHELL=$(SHELL)' \ - 'exec_prefix=$(exec_prefix)' \ - 'infodir=$(infodir)' \ - 'libdir=$(libdir)' \ - 'mandir=$(mandir)' \ - 'prefix=$(prefix)' \ - 'AR=$(AR)' \ - 'AS=$(AS)' \ - 'CC=$(CC)' \ - 'CXX=$(CXX)' \ - 'LD=$(LD)' \ - 'NM=$(NM)' \ - 'RANLIB=$(RANLIB)' \ - 'DESTDIR=$(DESTDIR)' - - -# Subdir rules rely on $(FLAGS_TO_PASS) -FLAGS_TO_PASS = $(AM_MAKEFLAGS) -MAKEOVERRIDES = -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libffi.pc -toolexeclib_LTLIBRARIES = libffi.la -noinst_LTLIBRARIES = libffi_convenience.la -libffi_la_SOURCES = src/prep_cif.c src/types.c src/raw_api.c \ - src/java_raw_api.c src/closures.c $(am__append_1) -noinst_HEADERS = \ - src/aarch64/ffitarget.h src/aarch64/internal.h \ - src/alpha/ffitarget.h src/alpha/internal.h \ - src/arc/ffitarget.h \ - src/arm/ffitarget.h src/arm/internal.h \ - src/avr32/ffitarget.h \ - src/bfin/ffitarget.h \ - src/cris/ffitarget.h \ - src/frv/ffitarget.h \ - src/ia64/ffitarget.h src/ia64/ia64_flags.h \ - src/m32r/ffitarget.h \ - src/m68k/ffitarget.h \ - src/m88k/ffitarget.h \ - src/metag/ffitarget.h \ - src/microblaze/ffitarget.h \ - src/mips/ffitarget.h \ - src/moxie/ffitarget.h \ - src/nios2/ffitarget.h \ - src/or1k/ffitarget.h \ - src/pa/ffitarget.h \ - src/powerpc/ffitarget.h src/powerpc/asm.h src/powerpc/ffi_powerpc.h \ - src/s390/ffitarget.h \ - src/sh/ffitarget.h \ - src/sh64/ffitarget.h \ - src/sparc/ffitarget.h src/sparc/internal.h \ - src/tile/ffitarget.h \ - src/vax/ffitarget.h \ - src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \ - src/xtensa/ffitarget.h \ - src/dlmalloc.c - -EXTRA_libffi_la_SOURCES = \ - src/aarch64/ffi.c src/aarch64/sysv.S \ - src/alpha/ffi.c src/alpha/osf.S \ - src/arc/ffi.c src/arc/arcompact.S \ - src/arm/ffi.c src/arm/sysv.S \ - src/avr32/ffi.c src/avr32/sysv.S \ - src/bfin/ffi.c src/bfin/sysv.S \ - src/cris/ffi.c src/cris/sysv.S \ - src/frv/ffi.c src/frv/eabi.S \ - src/ia64/ffi.c src/ia64/unix.S \ - src/m32r/ffi.c src/m32r/sysv.S \ - src/m68k/ffi.c src/m68k/sysv.S \ - src/m88k/ffi.c src/m88k/obsd.S \ - src/metag/ffi.c src/metag/sysv.S \ - src/microblaze/ffi.c src/microblaze/sysv.S \ - src/mips/ffi.c src/mips/o32.S src/mips/n32.S \ - src/moxie/ffi.c src/moxie/eabi.S \ - src/nios2/ffi.c src/nios2/sysv.S \ - src/or1k/ffi.c src/or1k/sysv.S \ - src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/powerpc/ffi.c src/powerpc/ffi_sysv.c src/powerpc/ffi_linux64.c \ - src/powerpc/sysv.S src/powerpc/linux64.S \ - src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ - src/powerpc/aix.S src/powerpc/darwin.S src/powerpc/aix_closure.S \ - src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \ - src/s390/ffi.c src/s390/sysv.S \ - src/sh/ffi.c src/sh/sysv.S \ - src/sh64/ffi.c src/sh64/sysv.S \ - src/sparc/ffi.c src/sparc/ffi64.c src/sparc/v8.S src/sparc/v9.S \ - src/tile/ffi.c src/tile/tile.S \ - src/vax/ffi.c src/vax/elfbsd.S \ - src/x86/ffi.c src/x86/sysv.S \ - src/x86/ffiw64.c src/x86/win64.S \ - src/x86/ffi64.c src/x86/unix64.S \ - src/x86/darwin64.S src/x86/darwin.S \ - src/x86/darwin64_c.c src/x86/darwin_c.c \ - src/xtensa/ffi.c src/xtensa/sysv.S - -libffi_la_LIBADD = $(TARGET_OBJ) -libffi_la_DEPENDENCIES = $(TARGET_OBJ) -libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) -EXTRA_libffi_convenience_la_SOURCES = $(EXTRA_libffi_la_SOURCES) -libffi_convenience_la_LIBADD = $(libffi_la_LIBADD) -libffi_convenience_la_DEPENDENCIES = $(libffi_la_DEPENDENCIES) -nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) -LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) -AM_CFLAGS = -Wall -g -fexceptions $(am__append_2) -libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) -AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src -AM_CCASFLAGS = $(AM_CPPFLAGS) -all: fficonfig.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .S .c .dvi .lo .o .obj .ps -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): - -fficonfig.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h -$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f fficonfig.h stamp-h1 -libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_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 -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 -src/$(am__dirstamp): - @$(MKDIR_P) src - @: > src/$(am__dirstamp) -src/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/$(DEPDIR) - @: > src/$(DEPDIR)/$(am__dirstamp) -src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) -src/aarch64/$(am__dirstamp): - @$(MKDIR_P) src/aarch64 - @: > src/aarch64/$(am__dirstamp) -src/aarch64/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/aarch64/$(DEPDIR) - @: > src/aarch64/$(DEPDIR)/$(am__dirstamp) -src/aarch64/ffi.lo: src/aarch64/$(am__dirstamp) \ - src/aarch64/$(DEPDIR)/$(am__dirstamp) -src/aarch64/sysv.lo: src/aarch64/$(am__dirstamp) \ - src/aarch64/$(DEPDIR)/$(am__dirstamp) -src/alpha/$(am__dirstamp): - @$(MKDIR_P) src/alpha - @: > src/alpha/$(am__dirstamp) -src/alpha/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/alpha/$(DEPDIR) - @: > src/alpha/$(DEPDIR)/$(am__dirstamp) -src/alpha/ffi.lo: src/alpha/$(am__dirstamp) \ - src/alpha/$(DEPDIR)/$(am__dirstamp) -src/alpha/osf.lo: src/alpha/$(am__dirstamp) \ - src/alpha/$(DEPDIR)/$(am__dirstamp) -src/arc/$(am__dirstamp): - @$(MKDIR_P) src/arc - @: > src/arc/$(am__dirstamp) -src/arc/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/arc/$(DEPDIR) - @: > src/arc/$(DEPDIR)/$(am__dirstamp) -src/arc/ffi.lo: src/arc/$(am__dirstamp) \ - src/arc/$(DEPDIR)/$(am__dirstamp) -src/arc/arcompact.lo: src/arc/$(am__dirstamp) \ - src/arc/$(DEPDIR)/$(am__dirstamp) -src/arm/$(am__dirstamp): - @$(MKDIR_P) src/arm - @: > src/arm/$(am__dirstamp) -src/arm/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/arm/$(DEPDIR) - @: > src/arm/$(DEPDIR)/$(am__dirstamp) -src/arm/ffi.lo: src/arm/$(am__dirstamp) \ - src/arm/$(DEPDIR)/$(am__dirstamp) -src/arm/sysv.lo: src/arm/$(am__dirstamp) \ - src/arm/$(DEPDIR)/$(am__dirstamp) -src/avr32/$(am__dirstamp): - @$(MKDIR_P) src/avr32 - @: > src/avr32/$(am__dirstamp) -src/avr32/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/avr32/$(DEPDIR) - @: > src/avr32/$(DEPDIR)/$(am__dirstamp) -src/avr32/ffi.lo: src/avr32/$(am__dirstamp) \ - src/avr32/$(DEPDIR)/$(am__dirstamp) -src/avr32/sysv.lo: src/avr32/$(am__dirstamp) \ - src/avr32/$(DEPDIR)/$(am__dirstamp) -src/bfin/$(am__dirstamp): - @$(MKDIR_P) src/bfin - @: > src/bfin/$(am__dirstamp) -src/bfin/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/bfin/$(DEPDIR) - @: > src/bfin/$(DEPDIR)/$(am__dirstamp) -src/bfin/ffi.lo: src/bfin/$(am__dirstamp) \ - src/bfin/$(DEPDIR)/$(am__dirstamp) -src/bfin/sysv.lo: src/bfin/$(am__dirstamp) \ - src/bfin/$(DEPDIR)/$(am__dirstamp) -src/cris/$(am__dirstamp): - @$(MKDIR_P) src/cris - @: > src/cris/$(am__dirstamp) -src/cris/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/cris/$(DEPDIR) - @: > src/cris/$(DEPDIR)/$(am__dirstamp) -src/cris/ffi.lo: src/cris/$(am__dirstamp) \ - src/cris/$(DEPDIR)/$(am__dirstamp) -src/cris/sysv.lo: src/cris/$(am__dirstamp) \ - src/cris/$(DEPDIR)/$(am__dirstamp) -src/frv/$(am__dirstamp): - @$(MKDIR_P) src/frv - @: > src/frv/$(am__dirstamp) -src/frv/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/frv/$(DEPDIR) - @: > src/frv/$(DEPDIR)/$(am__dirstamp) -src/frv/ffi.lo: src/frv/$(am__dirstamp) \ - src/frv/$(DEPDIR)/$(am__dirstamp) -src/frv/eabi.lo: src/frv/$(am__dirstamp) \ - src/frv/$(DEPDIR)/$(am__dirstamp) -src/ia64/$(am__dirstamp): - @$(MKDIR_P) src/ia64 - @: > src/ia64/$(am__dirstamp) -src/ia64/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/ia64/$(DEPDIR) - @: > src/ia64/$(DEPDIR)/$(am__dirstamp) -src/ia64/ffi.lo: src/ia64/$(am__dirstamp) \ - src/ia64/$(DEPDIR)/$(am__dirstamp) -src/ia64/unix.lo: src/ia64/$(am__dirstamp) \ - src/ia64/$(DEPDIR)/$(am__dirstamp) -src/m32r/$(am__dirstamp): - @$(MKDIR_P) src/m32r - @: > src/m32r/$(am__dirstamp) -src/m32r/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/m32r/$(DEPDIR) - @: > src/m32r/$(DEPDIR)/$(am__dirstamp) -src/m32r/ffi.lo: src/m32r/$(am__dirstamp) \ - src/m32r/$(DEPDIR)/$(am__dirstamp) -src/m32r/sysv.lo: src/m32r/$(am__dirstamp) \ - src/m32r/$(DEPDIR)/$(am__dirstamp) -src/m68k/$(am__dirstamp): - @$(MKDIR_P) src/m68k - @: > src/m68k/$(am__dirstamp) -src/m68k/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/m68k/$(DEPDIR) - @: > src/m68k/$(DEPDIR)/$(am__dirstamp) -src/m68k/ffi.lo: src/m68k/$(am__dirstamp) \ - src/m68k/$(DEPDIR)/$(am__dirstamp) -src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ - src/m68k/$(DEPDIR)/$(am__dirstamp) -src/m88k/$(am__dirstamp): - @$(MKDIR_P) src/m88k - @: > src/m88k/$(am__dirstamp) -src/m88k/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/m88k/$(DEPDIR) - @: > src/m88k/$(DEPDIR)/$(am__dirstamp) -src/m88k/ffi.lo: src/m88k/$(am__dirstamp) \ - src/m88k/$(DEPDIR)/$(am__dirstamp) -src/m88k/obsd.lo: src/m88k/$(am__dirstamp) \ - src/m88k/$(DEPDIR)/$(am__dirstamp) -src/metag/$(am__dirstamp): - @$(MKDIR_P) src/metag - @: > src/metag/$(am__dirstamp) -src/metag/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/metag/$(DEPDIR) - @: > src/metag/$(DEPDIR)/$(am__dirstamp) -src/metag/ffi.lo: src/metag/$(am__dirstamp) \ - src/metag/$(DEPDIR)/$(am__dirstamp) -src/metag/sysv.lo: src/metag/$(am__dirstamp) \ - src/metag/$(DEPDIR)/$(am__dirstamp) -src/microblaze/$(am__dirstamp): - @$(MKDIR_P) src/microblaze - @: > src/microblaze/$(am__dirstamp) -src/microblaze/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/microblaze/$(DEPDIR) - @: > src/microblaze/$(DEPDIR)/$(am__dirstamp) -src/microblaze/ffi.lo: src/microblaze/$(am__dirstamp) \ - src/microblaze/$(DEPDIR)/$(am__dirstamp) -src/microblaze/sysv.lo: src/microblaze/$(am__dirstamp) \ - src/microblaze/$(DEPDIR)/$(am__dirstamp) -src/mips/$(am__dirstamp): - @$(MKDIR_P) src/mips - @: > src/mips/$(am__dirstamp) -src/mips/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/mips/$(DEPDIR) - @: > src/mips/$(DEPDIR)/$(am__dirstamp) -src/mips/ffi.lo: src/mips/$(am__dirstamp) \ - src/mips/$(DEPDIR)/$(am__dirstamp) -src/mips/o32.lo: src/mips/$(am__dirstamp) \ - src/mips/$(DEPDIR)/$(am__dirstamp) -src/mips/n32.lo: src/mips/$(am__dirstamp) \ - src/mips/$(DEPDIR)/$(am__dirstamp) -src/moxie/$(am__dirstamp): - @$(MKDIR_P) src/moxie - @: > src/moxie/$(am__dirstamp) -src/moxie/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/moxie/$(DEPDIR) - @: > src/moxie/$(DEPDIR)/$(am__dirstamp) -src/moxie/ffi.lo: src/moxie/$(am__dirstamp) \ - src/moxie/$(DEPDIR)/$(am__dirstamp) -src/moxie/eabi.lo: src/moxie/$(am__dirstamp) \ - src/moxie/$(DEPDIR)/$(am__dirstamp) -src/nios2/$(am__dirstamp): - @$(MKDIR_P) src/nios2 - @: > src/nios2/$(am__dirstamp) -src/nios2/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/nios2/$(DEPDIR) - @: > src/nios2/$(DEPDIR)/$(am__dirstamp) -src/nios2/ffi.lo: src/nios2/$(am__dirstamp) \ - src/nios2/$(DEPDIR)/$(am__dirstamp) -src/nios2/sysv.lo: src/nios2/$(am__dirstamp) \ - src/nios2/$(DEPDIR)/$(am__dirstamp) -src/or1k/$(am__dirstamp): - @$(MKDIR_P) src/or1k - @: > src/or1k/$(am__dirstamp) -src/or1k/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/or1k/$(DEPDIR) - @: > src/or1k/$(DEPDIR)/$(am__dirstamp) -src/or1k/ffi.lo: src/or1k/$(am__dirstamp) \ - src/or1k/$(DEPDIR)/$(am__dirstamp) -src/or1k/sysv.lo: src/or1k/$(am__dirstamp) \ - src/or1k/$(DEPDIR)/$(am__dirstamp) -src/pa/$(am__dirstamp): - @$(MKDIR_P) src/pa - @: > src/pa/$(am__dirstamp) -src/pa/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/pa/$(DEPDIR) - @: > src/pa/$(DEPDIR)/$(am__dirstamp) -src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) -src/pa/linux.lo: src/pa/$(am__dirstamp) \ - src/pa/$(DEPDIR)/$(am__dirstamp) -src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ - src/pa/$(DEPDIR)/$(am__dirstamp) -src/powerpc/$(am__dirstamp): - @$(MKDIR_P) src/powerpc - @: > src/powerpc/$(am__dirstamp) -src/powerpc/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/powerpc/$(DEPDIR) - @: > src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/ffi_sysv.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/ffi_linux64.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/sysv.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/linux64.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/linux64_closure.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/ppc_closure.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/aix.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/darwin.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/aix_closure.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/powerpc/ffi_darwin.lo: src/powerpc/$(am__dirstamp) \ - src/powerpc/$(DEPDIR)/$(am__dirstamp) -src/s390/$(am__dirstamp): - @$(MKDIR_P) src/s390 - @: > src/s390/$(am__dirstamp) -src/s390/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/s390/$(DEPDIR) - @: > src/s390/$(DEPDIR)/$(am__dirstamp) -src/s390/ffi.lo: src/s390/$(am__dirstamp) \ - src/s390/$(DEPDIR)/$(am__dirstamp) -src/s390/sysv.lo: src/s390/$(am__dirstamp) \ - src/s390/$(DEPDIR)/$(am__dirstamp) -src/sh/$(am__dirstamp): - @$(MKDIR_P) src/sh - @: > src/sh/$(am__dirstamp) -src/sh/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/sh/$(DEPDIR) - @: > src/sh/$(DEPDIR)/$(am__dirstamp) -src/sh/ffi.lo: src/sh/$(am__dirstamp) src/sh/$(DEPDIR)/$(am__dirstamp) -src/sh/sysv.lo: src/sh/$(am__dirstamp) \ - src/sh/$(DEPDIR)/$(am__dirstamp) -src/sh64/$(am__dirstamp): - @$(MKDIR_P) src/sh64 - @: > src/sh64/$(am__dirstamp) -src/sh64/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/sh64/$(DEPDIR) - @: > src/sh64/$(DEPDIR)/$(am__dirstamp) -src/sh64/ffi.lo: src/sh64/$(am__dirstamp) \ - src/sh64/$(DEPDIR)/$(am__dirstamp) -src/sh64/sysv.lo: src/sh64/$(am__dirstamp) \ - src/sh64/$(DEPDIR)/$(am__dirstamp) -src/sparc/$(am__dirstamp): - @$(MKDIR_P) src/sparc - @: > src/sparc/$(am__dirstamp) -src/sparc/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/sparc/$(DEPDIR) - @: > src/sparc/$(DEPDIR)/$(am__dirstamp) -src/sparc/ffi.lo: src/sparc/$(am__dirstamp) \ - src/sparc/$(DEPDIR)/$(am__dirstamp) -src/sparc/ffi64.lo: src/sparc/$(am__dirstamp) \ - src/sparc/$(DEPDIR)/$(am__dirstamp) -src/sparc/v8.lo: src/sparc/$(am__dirstamp) \ - src/sparc/$(DEPDIR)/$(am__dirstamp) -src/sparc/v9.lo: src/sparc/$(am__dirstamp) \ - src/sparc/$(DEPDIR)/$(am__dirstamp) -src/tile/$(am__dirstamp): - @$(MKDIR_P) src/tile - @: > src/tile/$(am__dirstamp) -src/tile/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/tile/$(DEPDIR) - @: > src/tile/$(DEPDIR)/$(am__dirstamp) -src/tile/ffi.lo: src/tile/$(am__dirstamp) \ - src/tile/$(DEPDIR)/$(am__dirstamp) -src/tile/tile.lo: src/tile/$(am__dirstamp) \ - src/tile/$(DEPDIR)/$(am__dirstamp) -src/vax/$(am__dirstamp): - @$(MKDIR_P) src/vax - @: > src/vax/$(am__dirstamp) -src/vax/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/vax/$(DEPDIR) - @: > src/vax/$(DEPDIR)/$(am__dirstamp) -src/vax/ffi.lo: src/vax/$(am__dirstamp) \ - src/vax/$(DEPDIR)/$(am__dirstamp) -src/vax/elfbsd.lo: src/vax/$(am__dirstamp) \ - src/vax/$(DEPDIR)/$(am__dirstamp) -src/x86/$(am__dirstamp): - @$(MKDIR_P) src/x86 - @: > src/x86/$(am__dirstamp) -src/x86/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/x86/$(DEPDIR) - @: > src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/ffi.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/sysv.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/ffiw64.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/win64.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/ffi64.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/unix64.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/darwin64.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/darwin.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/darwin64_c.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/x86/darwin_c.lo: src/x86/$(am__dirstamp) \ - src/x86/$(DEPDIR)/$(am__dirstamp) -src/xtensa/$(am__dirstamp): - @$(MKDIR_P) src/xtensa - @: > src/xtensa/$(am__dirstamp) -src/xtensa/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) src/xtensa/$(DEPDIR) - @: > src/xtensa/$(DEPDIR)/$(am__dirstamp) -src/xtensa/ffi.lo: src/xtensa/$(am__dirstamp) \ - src/xtensa/$(DEPDIR)/$(am__dirstamp) -src/xtensa/sysv.lo: src/xtensa/$(am__dirstamp) \ - src/xtensa/$(DEPDIR)/$(am__dirstamp) -libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) - $(libffi_la_LINK) -rpath $(toolexeclibdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) -libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) - $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -rm -f src/aarch64/ffi.$(OBJEXT) - -rm -f src/aarch64/ffi.lo - -rm -f src/aarch64/sysv.$(OBJEXT) - -rm -f src/aarch64/sysv.lo - -rm -f src/alpha/ffi.$(OBJEXT) - -rm -f src/alpha/ffi.lo - -rm -f src/alpha/osf.$(OBJEXT) - -rm -f src/alpha/osf.lo - -rm -f src/arc/arcompact.$(OBJEXT) - -rm -f src/arc/arcompact.lo - -rm -f src/arc/ffi.$(OBJEXT) - -rm -f src/arc/ffi.lo - -rm -f src/arm/ffi.$(OBJEXT) - -rm -f src/arm/ffi.lo - -rm -f src/arm/sysv.$(OBJEXT) - -rm -f src/arm/sysv.lo - -rm -f src/avr32/ffi.$(OBJEXT) - -rm -f src/avr32/ffi.lo - -rm -f src/avr32/sysv.$(OBJEXT) - -rm -f src/avr32/sysv.lo - -rm -f src/bfin/ffi.$(OBJEXT) - -rm -f src/bfin/ffi.lo - -rm -f src/bfin/sysv.$(OBJEXT) - -rm -f src/bfin/sysv.lo - -rm -f src/closures.$(OBJEXT) - -rm -f src/closures.lo - -rm -f src/cris/ffi.$(OBJEXT) - -rm -f src/cris/ffi.lo - -rm -f src/cris/sysv.$(OBJEXT) - -rm -f src/cris/sysv.lo - -rm -f src/debug.$(OBJEXT) - -rm -f src/debug.lo - -rm -f src/frv/eabi.$(OBJEXT) - -rm -f src/frv/eabi.lo - -rm -f src/frv/ffi.$(OBJEXT) - -rm -f src/frv/ffi.lo - -rm -f src/ia64/ffi.$(OBJEXT) - -rm -f src/ia64/ffi.lo - -rm -f src/ia64/unix.$(OBJEXT) - -rm -f src/ia64/unix.lo - -rm -f src/java_raw_api.$(OBJEXT) - -rm -f src/java_raw_api.lo - -rm -f src/m32r/ffi.$(OBJEXT) - -rm -f src/m32r/ffi.lo - -rm -f src/m32r/sysv.$(OBJEXT) - -rm -f src/m32r/sysv.lo - -rm -f src/m68k/ffi.$(OBJEXT) - -rm -f src/m68k/ffi.lo - -rm -f src/m68k/sysv.$(OBJEXT) - -rm -f src/m68k/sysv.lo - -rm -f src/m88k/ffi.$(OBJEXT) - -rm -f src/m88k/ffi.lo - -rm -f src/m88k/obsd.$(OBJEXT) - -rm -f src/m88k/obsd.lo - -rm -f src/metag/ffi.$(OBJEXT) - -rm -f src/metag/ffi.lo - -rm -f src/metag/sysv.$(OBJEXT) - -rm -f src/metag/sysv.lo - -rm -f src/microblaze/ffi.$(OBJEXT) - -rm -f src/microblaze/ffi.lo - -rm -f src/microblaze/sysv.$(OBJEXT) - -rm -f src/microblaze/sysv.lo - -rm -f src/mips/ffi.$(OBJEXT) - -rm -f src/mips/ffi.lo - -rm -f src/mips/n32.$(OBJEXT) - -rm -f src/mips/n32.lo - -rm -f src/mips/o32.$(OBJEXT) - -rm -f src/mips/o32.lo - -rm -f src/moxie/eabi.$(OBJEXT) - -rm -f src/moxie/eabi.lo - -rm -f src/moxie/ffi.$(OBJEXT) - -rm -f src/moxie/ffi.lo - -rm -f src/nios2/ffi.$(OBJEXT) - -rm -f src/nios2/ffi.lo - -rm -f src/nios2/sysv.$(OBJEXT) - -rm -f src/nios2/sysv.lo - -rm -f src/or1k/ffi.$(OBJEXT) - -rm -f src/or1k/ffi.lo - -rm -f src/or1k/sysv.$(OBJEXT) - -rm -f src/or1k/sysv.lo - -rm -f src/pa/ffi.$(OBJEXT) - -rm -f src/pa/ffi.lo - -rm -f src/pa/hpux32.$(OBJEXT) - -rm -f src/pa/hpux32.lo - -rm -f src/pa/linux.$(OBJEXT) - -rm -f src/pa/linux.lo - -rm -f src/powerpc/aix.$(OBJEXT) - -rm -f src/powerpc/aix.lo - -rm -f src/powerpc/aix_closure.$(OBJEXT) - -rm -f src/powerpc/aix_closure.lo - -rm -f src/powerpc/darwin.$(OBJEXT) - -rm -f src/powerpc/darwin.lo - -rm -f src/powerpc/darwin_closure.$(OBJEXT) - -rm -f src/powerpc/darwin_closure.lo - -rm -f src/powerpc/ffi.$(OBJEXT) - -rm -f src/powerpc/ffi.lo - -rm -f src/powerpc/ffi_darwin.$(OBJEXT) - -rm -f src/powerpc/ffi_darwin.lo - -rm -f src/powerpc/ffi_linux64.$(OBJEXT) - -rm -f src/powerpc/ffi_linux64.lo - -rm -f src/powerpc/ffi_sysv.$(OBJEXT) - -rm -f src/powerpc/ffi_sysv.lo - -rm -f src/powerpc/linux64.$(OBJEXT) - -rm -f src/powerpc/linux64.lo - -rm -f src/powerpc/linux64_closure.$(OBJEXT) - -rm -f src/powerpc/linux64_closure.lo - -rm -f src/powerpc/ppc_closure.$(OBJEXT) - -rm -f src/powerpc/ppc_closure.lo - -rm -f src/powerpc/sysv.$(OBJEXT) - -rm -f src/powerpc/sysv.lo - -rm -f src/prep_cif.$(OBJEXT) - -rm -f src/prep_cif.lo - -rm -f src/raw_api.$(OBJEXT) - -rm -f src/raw_api.lo - -rm -f src/s390/ffi.$(OBJEXT) - -rm -f src/s390/ffi.lo - -rm -f src/s390/sysv.$(OBJEXT) - -rm -f src/s390/sysv.lo - -rm -f src/sh/ffi.$(OBJEXT) - -rm -f src/sh/ffi.lo - -rm -f src/sh/sysv.$(OBJEXT) - -rm -f src/sh/sysv.lo - -rm -f src/sh64/ffi.$(OBJEXT) - -rm -f src/sh64/ffi.lo - -rm -f src/sh64/sysv.$(OBJEXT) - -rm -f src/sh64/sysv.lo - -rm -f src/sparc/ffi.$(OBJEXT) - -rm -f src/sparc/ffi.lo - -rm -f src/sparc/ffi64.$(OBJEXT) - -rm -f src/sparc/ffi64.lo - -rm -f src/sparc/v8.$(OBJEXT) - -rm -f src/sparc/v8.lo - -rm -f src/sparc/v9.$(OBJEXT) - -rm -f src/sparc/v9.lo - -rm -f src/tile/ffi.$(OBJEXT) - -rm -f src/tile/ffi.lo - -rm -f src/tile/tile.$(OBJEXT) - -rm -f src/tile/tile.lo - -rm -f src/types.$(OBJEXT) - -rm -f src/types.lo - -rm -f src/vax/elfbsd.$(OBJEXT) - -rm -f src/vax/elfbsd.lo - -rm -f src/vax/ffi.$(OBJEXT) - -rm -f src/vax/ffi.lo - -rm -f src/x86/darwin.$(OBJEXT) - -rm -f src/x86/darwin.lo - -rm -f src/x86/darwin64.$(OBJEXT) - -rm -f src/x86/darwin64.lo - -rm -f src/x86/darwin64_c.$(OBJEXT) - -rm -f src/x86/darwin64_c.lo - -rm -f src/x86/darwin_c.$(OBJEXT) - -rm -f src/x86/darwin_c.lo - -rm -f src/x86/ffi.$(OBJEXT) - -rm -f src/x86/ffi.lo - -rm -f src/x86/ffi64.$(OBJEXT) - -rm -f src/x86/ffi64.lo - -rm -f src/x86/ffiw64.$(OBJEXT) - -rm -f src/x86/ffiw64.lo - -rm -f src/x86/sysv.$(OBJEXT) - -rm -f src/x86/sysv.lo - -rm -f src/x86/unix64.$(OBJEXT) - -rm -f src/x86/unix64.lo - -rm -f src/x86/win64.$(OBJEXT) - -rm -f src/x86/win64.lo - -rm -f src/xtensa/ffi.$(OBJEXT) - -rm -f src/xtensa/ffi.lo - -rm -f src/xtensa/sysv.$(OBJEXT) - -rm -f src/xtensa/sysv.lo - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/closures.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/java_raw_api.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/prep_cif.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/raw_api.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/types.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/aarch64/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/aarch64/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/osf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/arc/$(DEPDIR)/arcompact.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/arc/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/bfin/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/bfin/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/eabi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/unix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m88k/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/m88k/$(DEPDIR)/obsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/metag/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/metag/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/microblaze/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/microblaze/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/n32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/o32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/eabi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/moxie/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/nios2/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/nios2/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/or1k/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/or1k/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/linux.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix_closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin_closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_darwin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_linux64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64_closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ppc_closure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/ffi64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v8.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v9.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/tile/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/tile/$(DEPDIR)/tile.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/vax/$(DEPDIR)/elfbsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/vax/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin64_c.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin_c.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffiw64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/sysv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/unix64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/xtensa/$(DEPDIR)/ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/xtensa/$(DEPDIR)/sysv.Plo@am__quote@ - -.S.o: -@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< - -.S.obj: -@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.S.lo: -@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< - -.c.o: -@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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 -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.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 -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -rm -rf src/.libs src/_libs - -rm -rf src/aarch64/.libs src/aarch64/_libs - -rm -rf src/alpha/.libs src/alpha/_libs - -rm -rf src/arc/.libs src/arc/_libs - -rm -rf src/arm/.libs src/arm/_libs - -rm -rf src/avr32/.libs src/avr32/_libs - -rm -rf src/bfin/.libs src/bfin/_libs - -rm -rf src/cris/.libs src/cris/_libs - -rm -rf src/frv/.libs src/frv/_libs - -rm -rf src/ia64/.libs src/ia64/_libs - -rm -rf src/m32r/.libs src/m32r/_libs - -rm -rf src/m68k/.libs src/m68k/_libs - -rm -rf src/m88k/.libs src/m88k/_libs - -rm -rf src/metag/.libs src/metag/_libs - -rm -rf src/microblaze/.libs src/microblaze/_libs - -rm -rf src/mips/.libs src/mips/_libs - -rm -rf src/moxie/.libs src/moxie/_libs - -rm -rf src/nios2/.libs src/nios2/_libs - -rm -rf src/or1k/.libs src/or1k/_libs - -rm -rf src/pa/.libs src/pa/_libs - -rm -rf src/powerpc/.libs src/powerpc/_libs - -rm -rf src/s390/.libs src/s390/_libs - -rm -rf src/sh/.libs src/sh/_libs - -rm -rf src/sh64/.libs src/sh64/_libs - -rm -rf src/sparc/.libs src/sparc/_libs - -rm -rf src/tile/.libs src/tile/_libs - -rm -rf src/vax/.libs src/vax/_libs - -rm -rf src/x86/.libs src/x86/_libs - -rm -rf src/xtensa/.libs src/xtensa/_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) -doc/$(am__dirstamp): - @$(MKDIR_P) doc - @: > doc/$(am__dirstamp) - -doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi - -doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ - $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi - -doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) - rm -rf $(@:.html=.htp) - if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ - -o $(@:.html=.htp) `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi; \ - then \ - rm -rf $@; \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ - else \ - if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ - rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ - exit 1; \ - fi -$(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti -$(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure - test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) - @(dir=.; test -f ./doc/libffi.texi || dir=$(srcdir); \ - set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/libffi.texi`; \ - echo "@set UPDATED $$1 $$2 $$3"; \ - echo "@set UPDATED-MONTH $$2 $$3"; \ - echo "@set EDITION $(VERSION)"; \ - echo "@set VERSION $(VERSION)") > vti.tmp - @cmp -s vti.tmp $(srcdir)/doc/version.texi \ - || (echo "Updating $(srcdir)/doc/version.texi"; \ - cp vti.tmp $(srcdir)/doc/version.texi) - -@rm -f vti.tmp - @cp $(srcdir)/doc/version.texi $@ - -mostlyclean-vti: - -rm -f vti.tmp - -maintainer-clean-vti: -@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi -.dvi.ps: - TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ - $(DVIPS) -o $@ $< - -uninstall-dvi-am: - @$(NORMAL_UNINSTALL) - @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ - rm -f "$(DESTDIR)$(dvidir)/$$f"; \ - done - -uninstall-html-am: - @$(NORMAL_UNINSTALL) - @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ - rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ - done - -uninstall-info-am: - @$(PRE_UNINSTALL) - @if test -d '$(DESTDIR)$(infodir)' && \ - (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ - if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ - then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ - done; \ - else :; fi - @$(NORMAL_UNINSTALL) - @list='$(INFO_DEPS)'; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ - echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ - rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ - else :; fi); \ - done - -uninstall-pdf-am: - @$(NORMAL_UNINSTALL) - @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ - rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ - done - -uninstall-ps-am: - @$(NORMAL_UNINSTALL) - @list='$(PSS)'; test -n "$(psdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ - rm -f "$(DESTDIR)$(psdir)/$$f"; \ - done - -dist-info: $(INFO_DEPS) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; \ - for base in $$list; do \ - case $$base in \ - $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$base; then d=.; else d=$(srcdir); fi; \ - base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ - for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ - if test -f $$file; then \ - relfile=`expr "$$file" : "$$d/\(.*\)"`; \ - test -f "$(distdir)/$$relfile" || \ - cp -p $$file "$(distdir)/$$relfile"; \ - else :; fi; \ - done; \ - done - -mostlyclean-aminfo: - -rm -rf libffi.aux libffi.cp libffi.cps libffi.fn libffi.ky libffi.log \ - libffi.pg libffi.tmp libffi.toc libffi.tp libffi.vr - -clean-aminfo: - -test -z "doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html" \ - || rm -rf doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html - -maintainer-clean-aminfo: - @list='$(INFO_DEPS)'; for i in $$list; do \ - i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ - echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ - rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ - done -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || 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_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(pkgconfigdir)" && 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) fficonfig.h.in $(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) fficonfig.h.in $(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) fficonfig.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) fficonfig.h.in $(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 $(INFO_DEPS) $(LTLIBRARIES) all-multi $(DATA) \ - $(HEADERS) fficonfig.h all-local -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; 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: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -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) - -rm -f doc/$(am__dirstamp) - -rm -f src/$(DEPDIR)/$(am__dirstamp) - -rm -f src/$(am__dirstamp) - -rm -f src/aarch64/$(DEPDIR)/$(am__dirstamp) - -rm -f src/aarch64/$(am__dirstamp) - -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) - -rm -f src/alpha/$(am__dirstamp) - -rm -f src/arc/$(DEPDIR)/$(am__dirstamp) - -rm -f src/arc/$(am__dirstamp) - -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) - -rm -f src/arm/$(am__dirstamp) - -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) - -rm -f src/avr32/$(am__dirstamp) - -rm -f src/bfin/$(DEPDIR)/$(am__dirstamp) - -rm -f src/bfin/$(am__dirstamp) - -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) - -rm -f src/cris/$(am__dirstamp) - -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) - -rm -f src/frv/$(am__dirstamp) - -rm -f src/ia64/$(DEPDIR)/$(am__dirstamp) - -rm -f src/ia64/$(am__dirstamp) - -rm -f src/m32r/$(DEPDIR)/$(am__dirstamp) - -rm -f src/m32r/$(am__dirstamp) - -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) - -rm -f src/m68k/$(am__dirstamp) - -rm -f src/m88k/$(DEPDIR)/$(am__dirstamp) - -rm -f src/m88k/$(am__dirstamp) - -rm -f src/metag/$(DEPDIR)/$(am__dirstamp) - -rm -f src/metag/$(am__dirstamp) - -rm -f src/microblaze/$(DEPDIR)/$(am__dirstamp) - -rm -f src/microblaze/$(am__dirstamp) - -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) - -rm -f src/mips/$(am__dirstamp) - -rm -f src/moxie/$(DEPDIR)/$(am__dirstamp) - -rm -f src/moxie/$(am__dirstamp) - -rm -f src/nios2/$(DEPDIR)/$(am__dirstamp) - -rm -f src/nios2/$(am__dirstamp) - -rm -f src/or1k/$(DEPDIR)/$(am__dirstamp) - -rm -f src/or1k/$(am__dirstamp) - -rm -f src/pa/$(DEPDIR)/$(am__dirstamp) - -rm -f src/pa/$(am__dirstamp) - -rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp) - -rm -f src/powerpc/$(am__dirstamp) - -rm -f src/s390/$(DEPDIR)/$(am__dirstamp) - -rm -f src/s390/$(am__dirstamp) - -rm -f src/sh/$(DEPDIR)/$(am__dirstamp) - -rm -f src/sh/$(am__dirstamp) - -rm -f src/sh64/$(DEPDIR)/$(am__dirstamp) - -rm -f src/sh64/$(am__dirstamp) - -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) - -rm -f src/sparc/$(am__dirstamp) - -rm -f src/tile/$(DEPDIR)/$(am__dirstamp) - -rm -f src/tile/$(am__dirstamp) - -rm -f src/vax/$(DEPDIR)/$(am__dirstamp) - -rm -f src/vax/$(am__dirstamp) - -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) - -rm -f src/x86/$(am__dirstamp) - -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp) - -rm -f src/xtensa/$(am__dirstamp) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-multi clean-recursive - -clean-am: clean-aminfo clean-generic clean-libtool \ - clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-multi distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arc/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/m88k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/nios2/$(DEPDIR) src/or1k/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/vax/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-hdr distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: $(DVIS) - -html: html-recursive - -html-am: $(HTMLS) - -info: info-recursive - -info-am: $(INFO_DEPS) - -install-data-am: install-info-am install-pkgconfigDATA - -install-dvi: install-dvi-recursive - -install-dvi-am: $(DVIS) - @$(NORMAL_INSTALL) - test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" - @list='$(DVIS)'; test -n "$(dvidir)" || 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_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ - done -install-exec-am: install-multi install-toolexeclibLTLIBRARIES - -install-html: install-html-recursive - -install-html-am: $(HTMLS) - @$(NORMAL_INSTALL) - test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" - @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ - for p in $$list; do \ - if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ - $(am__strip_dir) \ - if test -d "$$d$$p"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ - $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ - echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ - $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ - else \ - list2="$$list2 $$d$$p"; \ - fi; \ - done; \ - test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ - done; } -install-info: install-info-recursive - -install-info-am: $(INFO_DEPS) - @$(NORMAL_INSTALL) - test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ - for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - esac; \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ - for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ - $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ - if test -f $$ifile; then \ - echo "$$ifile"; \ - else : ; fi; \ - done; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done - @$(POST_INSTALL) - @if (install-info --version && \ - install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ - list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ - for file in $$list; do \ - relfile=`echo "$$file" | sed 's|^.*/||'`; \ - echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ - install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ - done; \ - else : ; fi -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: $(PDFS) - @$(NORMAL_INSTALL) - test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" - @list='$(PDFS)'; test -n "$(pdfdir)" || 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_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done -install-ps: install-ps-recursive - -install-ps-am: $(PSS) - @$(NORMAL_INSTALL) - test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" - @list='$(PSS)'; test -n "$(psdir)" || 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_DATA) $$files '$(DESTDIR)$(psdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done -installcheck-am: - -maintainer-clean: maintainer-clean-multi maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf src/$(DEPDIR) src/aarch64/$(DEPDIR) src/alpha/$(DEPDIR) src/arc/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/bfin/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/m88k/$(DEPDIR) src/metag/$(DEPDIR) src/microblaze/$(DEPDIR) src/mips/$(DEPDIR) src/moxie/$(DEPDIR) src/nios2/$(DEPDIR) src/or1k/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/tile/$(DEPDIR) src/vax/$(DEPDIR) src/x86/$(DEPDIR) src/xtensa/$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-aminfo \ - maintainer-clean-generic maintainer-clean-vti - -mostlyclean: mostlyclean-multi mostlyclean-recursive - -mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool mostlyclean-vti - -pdf: pdf-recursive - -pdf-am: $(PDFS) - -ps: ps-recursive - -ps-am: $(PSS) - -uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am \ - uninstall-toolexeclibLTLIBRARIES - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all 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-aminfo clean-generic clean-libtool clean-multi \ - clean-noinstLTLIBRARIES clean-toolexeclibLTLIBRARIES ctags \ - ctags-recursive dist-info distclean distclean-compile \ - distclean-generic distclean-hdr 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-pkgconfigDATA install-ps install-ps-am install-strip \ - install-toolexeclibLTLIBRARIES installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-aminfo maintainer-clean-generic \ - maintainer-clean-multi maintainer-clean-vti mostlyclean \ - mostlyclean-aminfo mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-multi mostlyclean-vti pdf \ - pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-dvi-am uninstall-html-am uninstall-info-am \ - uninstall-pdf-am uninstall-pkgconfigDATA uninstall-ps-am \ - uninstall-toolexeclibLTLIBRARIES - - -all-local: $(STAMP_GENINSRC) - -stamp-geninsrc: doc/libffi.info - cp -p $(top_builddir)/doc/libffi.info $(srcdir)/doc/libffi.info - @touch $@ - -doc/libffi.info: $(STAMP_BUILD_INFO) - -stamp-build-info: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) - $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)/doc -o doc/libffi.info $(srcdir)/doc/libffi.texi - @touch $@ - -# Multilib support. Automake should provide these on its own. -all-recursive: all-multi -install-recursive: install-multi -mostlyclean-recursive: mostlyclean-multi -clean-recursive: clean-multi -distclean-recursive: distclean-multi -maintainer-clean-recursive: maintainer-clean-multi - -# 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/llgo/third_party/gofrontend/libffi/README b/llgo/third_party/gofrontend/libffi/README deleted file mode 100644 index c072101789172f89c84ed9a7fc24fc1607fc0634..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/README +++ /dev/null @@ -1,450 +0,0 @@ -Status -====== - -libffi-4?? was released on TBD. Check the libffi web -page for updates: . - - -What is libffi? -=============== - -Compilers for high level languages generate code that follow certain -conventions. These conventions are necessary, in part, for separate -compilation to work. One such convention is the "calling -convention". The "calling convention" is essentially a set of -assumptions made by the compiler about where function arguments will -be found on entry to a function. A "calling convention" also specifies -where the return value for a function is found. - -Some programs may not know at the time of compilation what arguments -are to be passed to a function. For instance, an interpreter may be -told at run-time about the number and types of arguments used to call -a given function. Libffi can be used in such programs to provide a -bridge from the interpreter program to compiled code. - -The libffi library provides a portable, high level programming -interface to various calling conventions. This allows a programmer to -call any function specified by a call interface description at run -time. - -FFI stands for Foreign Function Interface. A foreign function -interface is the popular name for the interface that allows code -written in one language to call code written in another language. The -libffi library really only provides the lowest, machine dependent -layer of a fully featured foreign function interface. A layer must -exist above libffi that handles type conversions for values passed -between the two languages. - - -Supported Platforms -=================== - -Libffi has been ported to many different platforms. -For specific configuration details and testing status, please -refer to the wiki page here: - - http://www.moxielogic.org/wiki/index.php?title=Libffi_3.2 - -At the time of release, the following basic configurations have been -tested: - -|-----------------+------------------+-------------------------| -| Architecture | Operating System | Compiler | -|-----------------+------------------+-------------------------| -| AArch64 (ARM64) | iOS | Clang | -| AArch64 | Linux | GCC | -| Alpha | Linux | GCC | -| Alpha | Tru64 | GCC | -| ARC | Linux | GCC | -| ARM | Linux | GCC | -| ARM | iOS | GCC | -| AVR32 | Linux | GCC | -| Blackfin | uClinux | GCC | -| HPPA | HPUX | GCC | -| IA-64 | Linux | GCC | -| M68K | FreeMiNT | GCC | -| M68K | Linux | GCC | -| M68K | RTEMS | GCC | -| M88K | OpenBSD/mvme88k | GCC | -| Meta | Linux | GCC | -| MicroBlaze | Linux | GCC | -| MIPS | IRIX | GCC | -| MIPS | Linux | GCC | -| MIPS | RTEMS | GCC | -| MIPS64 | Linux | GCC | -| Moxie | Bare metal | GCC | -| Nios II | Linux | GCC | -| OpenRISC | Linux | GCC | -| PowerPC 32-bit | AIX | IBM XL C | -| PowerPC 64-bit | AIX | IBM XL C | -| PowerPC | AMIGA | GCC | -| PowerPC | Linux | GCC | -| PowerPC | Mac OSX | GCC | -| PowerPC | FreeBSD | GCC | -| PowerPC 64-bit | FreeBSD | GCC | -| PowerPC 64-bit | Linux ELFv1 | GCC | -| PowerPC 64-bit | Linux ELFv2 | GCC | -| S390 | Linux | GCC | -| S390X | Linux | GCC | -| SPARC | Linux | GCC | -| SPARC | Solaris | GCC | -| SPARC | Solaris | Oracle Solaris Studio C | -| SPARC64 | Linux | GCC | -| SPARC64 | FreeBSD | GCC | -| SPARC64 | Solaris | Oracle Solaris Studio C | -| TILE-Gx/TILEPro | Linux | GCC | -| VAX | OpenBSD/vax | GCC | -| X86 | FreeBSD | GCC | -| X86 | GNU HURD | GCC | -| X86 | Interix | GCC | -| X86 | kFreeBSD | GCC | -| X86 | Linux | GCC | -| X86 | Mac OSX | GCC | -| X86 | OpenBSD | GCC | -| X86 | OS/2 | GCC | -| X86 | Solaris | GCC | -| X86 | Solaris | Oracle Solaris Studio C | -| X86 | Windows/Cygwin | GCC | -| X86 | Windows/MingW | GCC | -| X86-64 | FreeBSD | GCC | -| X86-64 | Linux | GCC | -| X86-64 | Linux/x32 | GCC | -| X86-64 | OpenBSD | GCC | -| X86-64 | Solaris | Oracle Solaris Studio C | -| X86-64 | Windows/Cygwin | GCC | -| X86-64 | Windows/MingW | GCC | -| Xtensa | Linux | GCC | -|-----------------+------------------+-------------------------| - -Please send additional platform test results to -libffi-discuss@sourceware.org and feel free to update the wiki page -above. - -Installing libffi -================= - -First you must configure the distribution for your particular -system. Go to the directory you wish to build libffi in and run the -"configure" program found in the root directory of the libffi source -distribution. - -If you're building libffi directly from version control, configure won't -exist yet; run ./autogen.sh first. - -You may want to tell configure where to install the libffi library and -header files. To do that, use the --prefix configure switch. Libffi -will install under /usr/local by default. - -If you want to enable extra run-time debugging checks use the the ---enable-debug configure switch. This is useful when your program dies -mysteriously while using libffi. - -Another useful configure switch is --enable-purify-safety. Using this -will add some extra code which will suppress certain warnings when you -are using Purify with libffi. Only use this switch when using -Purify, as it will slow down the library. - -It's also possible to build libffi on Windows platforms with -Microsoft's Visual C++ compiler. In this case, use the msvcc.sh -wrapper script during configuration like so: - -path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" - -For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64" and -CXX="path/to/msvcc.sh -m64". You may also need to specify --build -appropriately. - -It is also possible to build libffi on Windows platforms with the LLVM -project's clang-cl compiler, like below: - -path/to/configure CC="path/to/msvcc.sh -clang-cl" CXX="path/to/msvcc.sh -clang-cl" LD=link CPP="clang-cl -EP" - -When building with MSVC under a MingW environment, you may need to -remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath' -command. ('cygpath' is not present in MingW, and is not required when -using MingW-style paths.) - -For iOS builds, the 'libffi.xcodeproj' Xcode project is available. - -Configure has many other options. Use "configure --help" to see them all. - -Once configure has finished, type "make". Note that you must be using -GNU make. You can ftp GNU make from ftp.gnu.org:/pub/gnu/make . - -To ensure that libffi is working as advertised, type "make check". -This will require that you have DejaGNU installed. - -To install the library and header files, type "make install". - - -History -======= - -See the git log for details at http://github.com/atgreen/libffi. - -4.0 TBD - New API in support of GO closures. - -3.2.1 Nov-12-14 - Build fix for non-iOS AArch64 targets. - -3.2 Nov-11-14 - Add C99 Complex Type support (currently only supported on - s390). - Add support for PASCAL and REGISTER calling conventions on x86 - Windows/Linux. - Add OpenRISC and Cygwin-64 support. - Bug fixes. - -3.1 May-19-14 - Add AArch64 (ARM64) iOS support. - Add Nios II support. - Add m88k and DEC VAX support. - Add support for stdcall, thiscall, and fastcall on non-Windows - 32-bit x86 targets such as Linux. - Various Android, MIPS N32, x86, FreeBSD and UltraSPARC IIi - fixes. - Make the testsuite more robust: eliminate several spurious - failures, and respect the $CC and $CXX environment variables. - Archive off the manually maintained ChangeLog in favor of git - log. - -3.0.13 Mar-17-13 - Add Meta support. - Add missing Moxie bits. - Fix stack alignment bug on 32-bit x86. - Build fix for m68000 targets. - Build fix for soft-float Power targets. - Fix the install dir location for some platforms when building - with GCC (OS X, Solaris). - Fix Cygwin regression. - -3.0.12 Feb-11-13 - Add Moxie support. - Add AArch64 support. - Add Blackfin support. - Add TILE-Gx/TILEPro support. - Add MicroBlaze support. - Add Xtensa support. - Add support for PaX enabled kernels with MPROTECT. - Add support for native vendor compilers on - Solaris and AIX. - Work around LLVM/GCC interoperability issue on x86_64. - -3.0.11 Apr-11-12 - Lots of build fixes. - Add support for variadic functions (ffi_prep_cif_var). - Add Linux/x32 support. - Add thiscall, fastcall and MSVC cdecl support on Windows. - Add Amiga and newer MacOS support. - Add m68k FreeMiNT support. - Integration with iOS' xcode build tools. - Fix Octeon and MC68881 support. - Fix code pessimizations. - -3.0.10 Aug-23-11 - Add support for Apple's iOS. - Add support for ARM VFP ABI. - Add RTEMS support for MIPS and M68K. - Fix instruction cache clearing problems on - ARM and SPARC. - Fix the N64 build on mips-sgi-irix6.5. - Enable builds with Microsoft's compiler. - Enable x86 builds with Oracle's Solaris compiler. - Fix support for calling code compiled with Oracle's Sparc - Solaris compiler. - Testsuite fixes for Tru64 Unix. - Additional platform support. - -3.0.9 Dec-31-09 - Add AVR32 and win64 ports. Add ARM softfp support. - Many fixes for AIX, Solaris, HP-UX, *BSD. - Several PowerPC and x86-64 bug fixes. - Build DLL for windows. - -3.0.8 Dec-19-08 - Add *BSD, BeOS, and PA-Linux support. - -3.0.7 Nov-11-08 - Fix for ppc FreeBSD. - (thanks to Andreas Tobler) - -3.0.6 Jul-17-08 - Fix for closures on sh. - Mark the sh/sh64 stack as non-executable. - (both thanks to Kaz Kojima) - -3.0.5 Apr-3-08 - Fix libffi.pc file. - Fix #define ARM for IcedTea users. - Fix x86 closure bug. - -3.0.4 Feb-24-08 - Fix x86 OpenBSD configury. - -3.0.3 Feb-22-08 - Enable x86 OpenBSD thanks to Thomas Heller, and - x86-64 FreeBSD thanks to Björn König and Andreas Tobler. - Clean up test instruction in README. - -3.0.2 Feb-21-08 - Improved x86 FreeBSD support. - Thanks to Björn König. - -3.0.1 Feb-15-08 - Fix instruction cache flushing bug on MIPS. - Thanks to David Daney. - -3.0.0 Feb-15-08 - Many changes, mostly thanks to the GCC project. - Cygnus Solutions is now Red Hat. - - [10 years go by...] - -1.20 Oct-5-98 - Raffaele Sena produces ARM port. - -1.19 Oct-5-98 - Fixed x86 long double and long long return support. - m68k bug fixes from Andreas Schwab. - Patch for DU assembler compatibility for the Alpha from Richard - Henderson. - -1.18 Apr-17-98 - Bug fixes and MIPS configuration changes. - -1.17 Feb-24-98 - Bug fixes and m68k port from Andreas Schwab. PowerPC port from - Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes. - -1.16 Feb-11-98 - Richard Henderson produces Alpha port. - -1.15 Dec-4-97 - Fixed an n32 ABI bug. New libtool, auto* support. - -1.14 May-13-97 - libtool is now used to generate shared and static libraries. - Fixed a minor portability problem reported by Russ McManus - . - -1.13 Dec-2-96 - Added --enable-purify-safety to keep Purify from complaining - about certain low level code. - Sparc fix for calling functions with < 6 args. - Linux x86 a.out fix. - -1.12 Nov-22-96 - Added missing ffi_type_void, needed for supporting void return - types. Fixed test case for non MIPS machines. Cygnus Support - is now Cygnus Solutions. - -1.11 Oct-30-96 - Added notes about GNU make. - -1.10 Oct-29-96 - Added configuration fix for non GNU compilers. - -1.09 Oct-29-96 - Added --enable-debug configure switch. Clean-ups based on LCLint - feedback. ffi_mips.h is always installed. Many configuration - fixes. Fixed ffitest.c for sparc builds. - -1.08 Oct-15-96 - Fixed n32 problem. Many clean-ups. - -1.07 Oct-14-96 - Gordon Irlam rewrites v8.S again. Bug fixes. - -1.06 Oct-14-96 - Gordon Irlam improved the sparc port. - -1.05 Oct-14-96 - Interface changes based on feedback. - -1.04 Oct-11-96 - Sparc port complete (modulo struct passing bug). - -1.03 Oct-10-96 - Passing struct args, and returning struct values works for - all architectures/calling conventions. Expanded tests. - -1.02 Oct-9-96 - Added SGI n32 support. Fixed bugs in both o32 and Linux support. - Added "make test". - -1.01 Oct-8-96 - Fixed float passing bug in mips version. Restructured some - of the code. Builds cleanly with SGI tools. - -1.00 Oct-7-96 - First release. No public announcement. - - -Authors & Credits -================= - -libffi was originally written by Anthony Green . - -The developers of the GNU Compiler Collection project have made -innumerable valuable contributions. See the ChangeLog file for -details. - -Some of the ideas behind libffi were inspired by Gianni Mariani's free -gencall library for Silicon Graphics machines. - -The closure mechanism was designed and implemented by Kresten Krab -Thorup. - -Major processor architecture ports were contributed by the following -developers: - -aarch64 Marcus Shawcroft, James Greenhalgh -alpha Richard Henderson -arm Raffaele Sena -blackfin Alexandre Keunecke I. de Mendonca -cris Simon Posnjak, Hans-Peter Nilsson -frv Anthony Green -ia64 Hans Boehm -m32r Kazuhiro Inaoka -m68k Andreas Schwab -m88k Miod Vallat -microblaze Nathan Rossi -mips Anthony Green, Casey Marshall -mips64 David Daney -moxie Anthony Green -nios ii Sandra Loosemore -openrisc Sebastian Macke -pa Randolph Chung, Dave Anglin, Andreas Tobler -powerpc Geoffrey Keating, Andreas Tobler, - David Edelsohn, John Hornkvist -powerpc64 Jakub Jelinek -s390 Gerhard Tonn, Ulrich Weigand -sh Kaz Kojima -sh64 Kaz Kojima -sparc Anthony Green, Gordon Irlam -tile-gx/tilepro Walter Lee -vax Miod Vallat -x86 Anthony Green, Jon Beniston -x86-64 Bo Thorsen -xtensa Chris Zankel - -Jesper Skov and Andrew Haley both did more than their fair share of -stepping through the code and tracking down bugs. - -Thanks also to Tom Tromey for bug fixes, documentation and -configuration help. - -Thanks to Jim Blandy, who provided some useful feedback on the libffi -interface. - -Andreas Tobler has done a tremendous amount of work on the testsuite. - -Alex Oliva solved the executable page problem for SElinux. - -The list above is almost certainly incomplete and inaccurate. I'm -happy to make corrections or additions upon request. - -If you have a problem, or have found a bug, please send a note to the -author at green@moxielogic.com, or the project mailing list at -libffi-discuss@sourceware.org. diff --git a/llgo/third_party/gofrontend/libffi/acinclude.m4 b/llgo/third_party/gofrontend/libffi/acinclude.m4 deleted file mode 100644 index 3e8f8ba570d548212d0a7afc4da04a6791e77c01..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/acinclude.m4 +++ /dev/null @@ -1,92 +0,0 @@ -# mmap(2) blacklisting. Some platforms provide the mmap library routine -# but don't support all of the features we need from it. -AC_DEFUN([AC_FUNC_MMAP_BLACKLIST], -[ -AC_CHECK_HEADER([sys/mman.h], - [libffi_header_sys_mman_h=yes], [libffi_header_sys_mman_h=no]) -AC_CHECK_FUNC([mmap], [libffi_func_mmap=yes], [libffi_func_mmap=no]) -if test "$libffi_header_sys_mman_h" != yes \ - || test "$libffi_func_mmap" != yes; then - ac_cv_func_mmap_file=no - ac_cv_func_mmap_dev_zero=no - ac_cv_func_mmap_anon=no -else - AC_CACHE_CHECK([whether read-only mmap of a plain file works], - ac_cv_func_mmap_file, - [# Add a system to this blacklist if - # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a - # memory area containing the same data that you'd get if you applied - # read() to the same fd. The only system known to have a problem here - # is VMS, where text files have record structure. - case "$host_os" in - vms* | ultrix*) - ac_cv_func_mmap_file=no ;; - *) - ac_cv_func_mmap_file=yes;; - esac]) - AC_CACHE_CHECK([whether mmap from /dev/zero works], - ac_cv_func_mmap_dev_zero, - [# Add a system to this blacklist if it has mmap() but /dev/zero - # does not exist, or if mmapping /dev/zero does not give anonymous - # zeroed pages with both the following properties: - # 1. If you map N consecutive pages in with one call, and then - # unmap any subset of those pages, the pages that were not - # explicitly unmapped remain accessible. - # 2. If you map two adjacent blocks of memory and then unmap them - # both at once, they must both go away. - # Systems known to be in this category are Windows (all variants), - # VMS, and Darwin. - case "$host_os" in - vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) - ac_cv_func_mmap_dev_zero=no ;; - *) - ac_cv_func_mmap_dev_zero=yes;; - esac]) - - # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. - AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon, - [AC_TRY_COMPILE( -[#include -#include -#include - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif -], -[int n = MAP_ANONYMOUS;], - ac_cv_decl_map_anon=yes, - ac_cv_decl_map_anon=no)]) - - if test $ac_cv_decl_map_anon = no; then - ac_cv_func_mmap_anon=no - else - AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], - ac_cv_func_mmap_anon, - [# Add a system to this blacklist if it has mmap() and MAP_ANON or - # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) - # doesn't give anonymous zeroed pages with the same properties listed - # above for use of /dev/zero. - # Systems known to be in this category are Windows, VMS, and SCO Unix. - case "$host_os" in - vms* | cygwin* | pe | mingw* | sco* | udk* ) - ac_cv_func_mmap_anon=no ;; - *) - ac_cv_func_mmap_anon=yes;; - esac]) - fi -fi - -if test $ac_cv_func_mmap_file = yes; then - AC_DEFINE(HAVE_MMAP_FILE, 1, - [Define if read-only mmap of a plain file works.]) -fi -if test $ac_cv_func_mmap_dev_zero = yes; then - AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, - [Define if mmap of /dev/zero works.]) -fi -if test $ac_cv_func_mmap_anon = yes; then - AC_DEFINE(HAVE_MMAP_ANON, 1, - [Define if mmap with MAP_ANON(YMOUS) works.]) -fi -]) diff --git a/llgo/third_party/gofrontend/libffi/aclocal.m4 b/llgo/third_party/gofrontend/libffi/aclocal.m4 deleted file mode 100644 index 93d09b3a3ca981bea29077a501a8c953c6e91c46..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/aclocal.m4 +++ /dev/null @@ -1,1039 +0,0 @@ -# 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]))]) - -# Figure out how to run the assembler. -*- Autoconf -*- - -# Copyright (C) 2001, 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. - -# serial 5 - -# AM_PROG_AS -# ---------- -AC_DEFUN([AM_PROG_AS], -[# By default we simply use the C compiler to build assembly code. -AC_REQUIRE([AC_PROG_CC]) -test "${CCAS+set}" = set || CCAS=$CC -test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS -AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) -AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) -_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl -]) - -# 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 -]) - -# Copyright (C) 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_PROG_CC_C_O -# -------------- -# Like AC_PROG_CC_C_O, but changed for automake. -AC_DEFUN([AM_PROG_CC_C_O], -[AC_REQUIRE([AC_PROG_CC_C_O])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -dnl Make sure AC_PROG_CC is never called again, or it will override our -dnl setting of CC. -m4_define([AC_PROG_CC], - [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 6 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; -esac - -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006, 2008 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([../config/acx.m4]) -m4_include([../config/asmcfi.m4]) -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]) -m4_include([acinclude.m4]) diff --git a/llgo/third_party/gofrontend/libffi/configure b/llgo/third_party/gofrontend/libffi/configure deleted file mode 100755 index f580af0f69bc0350580b8e4924164429e429c512..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/configure +++ /dev/null @@ -1,18792 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for libffi 3.99999. -# -# Report bugs to . -# -# 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 and -$0: http://github.com/atgreen/libffi/issues about your -$0: system, 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 &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='libffi' -PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.99999' -PACKAGE_STRING='libffi 3.99999' -PACKAGE_BUGREPORT='http://github.com/atgreen/libffi/issues' -PACKAGE_URL='' - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -toolexeclibdir -toolexecdir -FFI_DEBUG_FALSE -FFI_DEBUG_TRUE -TARGET_OBJ -TARGETDIR -TARGET -FFI_EXEC_TRAMPOLINE_TABLE -FFI_EXEC_TRAMPOLINE_TABLE_FALSE -FFI_EXEC_TRAMPOLINE_TABLE_TRUE -HAVE_LONG_DOUBLE_VARIANT -HAVE_LONG_DOUBLE -ALLOCA -AM_LTLDFLAGS -AM_RUNTESTFLAGS -TESTSUBDIR_FALSE -TESTSUBDIR_TRUE -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE -CXXCPP -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -RANLIB -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -LIBTOOL -am__fastdepCCAS_FALSE -am__fastdepCCAS_TRUE -CCASDEPMODE -CCASFLAGS -CCAS -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 -GENINSRC_FALSE -GENINSRC_TRUE -BUILD_INFO_FALSE -BUILD_INFO_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 -multi_basedir -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_multilib -enable_generated_files_in_srcdir -enable_dependency_tracking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -enable_libtool_lock -enable_maintainer_mode -enable_pax_emutramp -enable_debug -enable_structs -enable_raw_api -enable_purify_safety -' - ac_precious_vars='build_alias -host_alias -target_alias -CCAS -CCASFLAGS -CPP -CPPFLAGS -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 libffi 3.99999 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/libffi] - --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 libffi 3.99999:";; - 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-multilib build many library versions (default) - --enable-generated-files-in-srcdir - put copies of generated files in source dir intended - for creating source tarballs for users without - texinfo bison or flex - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC - --enable-debug debugging mode - --disable-structs omit code for struct support - --disable-raw-api make the raw api unavailable - --enable-purify-safety purify-safe mode - -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 if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CCAS assembler compiler command (defaults to CC) - CCASFLAGS assembler compiler flags (defaults to CFLAGS) - 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 . -_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 -libffi configure 3.99999 -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 declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func - -# 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 - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &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;} -( cat <<\_ASBOX -## ------------------------------------------------------ ## -## Report this to http://github.com/atgreen/libffi/issues ## -## ------------------------------------------------------ ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&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 -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 libffi $as_me 3.99999, 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_config_headers="$ac_config_headers fficonfig.h" - - -# 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" - - -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='libffi' - VERSION='3.99999' - - -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 -' - - - - - - -# See if makeinfo has been installed and is modern enough -# that we can use it. - - # Extract the first word of "makeinfo", so it can be a program name with args. -set dummy makeinfo; 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_MAKEINFO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MAKEINFO"; then - ac_cv_prog_MAKEINFO="$MAKEINFO" # 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_MAKEINFO="makeinfo" - $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 -MAKEINFO=$ac_cv_prog_MAKEINFO -if test -n "$MAKEINFO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKEINFO" >&5 -$as_echo "$MAKEINFO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -n "$MAKEINFO"; then - # Found it, now check the version. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for modern makeinfo" >&5 -$as_echo_n "checking for modern makeinfo... " >&6; } -if test "${gcc_cv_prog_makeinfo_modern+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_prog_version=`eval $MAKEINFO --version 2>&1 | - sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - - case $ac_prog_version in - '') gcc_cv_prog_makeinfo_modern=no;; - 4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*) gcc_cv_prog_makeinfo_modern=yes;; - *) gcc_cv_prog_makeinfo_modern=no;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_prog_makeinfo_modern" >&5 -$as_echo "$gcc_cv_prog_makeinfo_modern" >&6; } - else - gcc_cv_prog_makeinfo_modern=no - fi - if test $gcc_cv_prog_makeinfo_modern = no; then - MAKEINFO="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing makeinfo" - fi - - if test $gcc_cv_prog_makeinfo_modern = "yes"; then - BUILD_INFO_TRUE= - BUILD_INFO_FALSE='#' -else - BUILD_INFO_TRUE='#' - BUILD_INFO_FALSE= -fi - - -# We would like our source tree to be readonly. However when releases or -# pre-releases are generated, the flex/bison generated files as well as the -# various formats of manuals need to be included along with the rest of the -# sources. Therefore we have --enable-generated-files-in-srcdir to do -# just that. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking generated-files-in-srcdir" >&5 -$as_echo_n "checking generated-files-in-srcdir... " >&6; } -# Check whether --enable-generated-files-in-srcdir was given. -if test "${enable_generated_files_in_srcdir+set}" = set; then : - enableval=$enable_generated_files_in_srcdir; case "$enableval" in - yes) enable_generated_files_in_srcdir=yes ;; - no) enable_generated_files_in_srcdir=no ;; - *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;; - esac -else - enable_generated_files_in_srcdir=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_generated_files_in_srcdir" >&5 -$as_echo "$enable_generated_files_in_srcdir" >&6; } - if test "$enable_generated_files_in_srcdir" = yes; then - GENINSRC_TRUE= - GENINSRC_FALSE='#' -else - GENINSRC_TRUE='#' - GENINSRC_FALSE= -fi - - -# The same as in boehm-gc and libstdc++. Have to borrow it from there. -# We must force CC to /not/ be precious variables; otherwise -# the wrong, non-multilib-adjusted value will be used in multilibs. -# As a side effect, we have to subst CFLAGS ourselves. -# Also save and restore CFLAGS, since AC_PROG_CC will come up with -# defaults of its own if none are provided. - - - -save_CFLAGS=$CFLAGS -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -fi -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -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 - - -CFLAGS=$save_CFLAGS - - - - - -# By default we simply use the C compiler to build assembly code. - -test "${CCAS+set}" = set || CCAS=$CC -test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS - - - -depcc="$CCAS" 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_CCAS_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_CCAS_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 - - - 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_CCAS_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CCAS_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } -CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then - am__fastdepCCAS_TRUE= - am__fastdepCCAS_FALSE='#' -else - am__fastdepCCAS_TRUE='#' - am__fastdepCCAS_FALSE= -fi - - -if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 -$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 -$as_echo_n "checking whether cc understands -c and -o together... " >&6; } -fi -set dummy $CC; ac_cc=`$as_echo "$2" | - sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -# Make sure it works both with $CC and with simple cc. -# We do the test twice because some compilers refuse to overwrite an -# existing .o file with -o, though they will create one. -ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { 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; } && - test -f conftest2.$ac_objext && { { 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 - eval ac_cv_prog_cc_${ac_cc}_c_o=yes - if test "x$CC" != xcc; then - # Test first that cc exists at all. - if { ac_try='cc -c conftest.$ac_ext >&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_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' - rm -f conftest2.* - if { { 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; } && - test -f conftest2.$ac_objext && { { 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 - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi -else - eval ac_cv_prog_cc_${ac_cc}_c_o=no -fi -rm -f core conftest* - -fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h - -fi - -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.2.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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if test "${lt_cv_path_NM+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$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 to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if test "${lt_cv_objdir+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# 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 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=' $pic_flag' - 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.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`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 11373 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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 11479 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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 to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_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 -_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 to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_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 -_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 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # 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 $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -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 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.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`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: - - - -# Test for 64-bit build. -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of size_t" >&5 -$as_echo_n "checking size of size_t... " >&6; } -if test "${ac_cv_sizeof_size_t+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (size_t))" "ac_cv_sizeof_size_t" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_size_t" = yes; then - { { $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 "cannot compute sizeof (size_t) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_size_t=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_size_t" >&5 -$as_echo "$ac_cv_sizeof_size_t" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_SIZE_T $ac_cv_sizeof_size_t -_ACEOF - - - - -{ $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 - - - -for ac_header in sys/mman.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_MMAN_H 1 -_ACEOF - -fi - -done - -for ac_func in mmap mkostemp -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 - - -ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = x""yes; then : - libffi_header_sys_mman_h=yes -else - libffi_header_sys_mman_h=no -fi - - -ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = x""yes; then : - libffi_func_mmap=yes -else - libffi_func_mmap=no -fi - -if test "$libffi_header_sys_mman_h" != yes \ - || test "$libffi_func_mmap" != yes; then - ac_cv_func_mmap_file=no - ac_cv_func_mmap_dev_zero=no - ac_cv_func_mmap_anon=no -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 -$as_echo_n "checking whether read-only mmap of a plain file works... " >&6; } -if test "${ac_cv_func_mmap_file+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Add a system to this blacklist if - # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a - # memory area containing the same data that you'd get if you applied - # read() to the same fd. The only system known to have a problem here - # is VMS, where text files have record structure. - case "$host_os" in - vms* | ultrix*) - ac_cv_func_mmap_file=no ;; - *) - ac_cv_func_mmap_file=yes;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_file" >&5 -$as_echo "$ac_cv_func_mmap_file" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 -$as_echo_n "checking whether mmap from /dev/zero works... " >&6; } -if test "${ac_cv_func_mmap_dev_zero+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Add a system to this blacklist if it has mmap() but /dev/zero - # does not exist, or if mmapping /dev/zero does not give anonymous - # zeroed pages with both the following properties: - # 1. If you map N consecutive pages in with one call, and then - # unmap any subset of those pages, the pages that were not - # explicitly unmapped remain accessible. - # 2. If you map two adjacent blocks of memory and then unmap them - # both at once, they must both go away. - # Systems known to be in this category are Windows (all variants), - # VMS, and Darwin. - case "$host_os" in - vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) - ac_cv_func_mmap_dev_zero=no ;; - *) - ac_cv_func_mmap_dev_zero=yes;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_dev_zero" >&5 -$as_echo "$ac_cv_func_mmap_dev_zero" >&6; } - - # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 -$as_echo_n "checking for MAP_ANON(YMOUS)... " >&6; } -if test "${ac_cv_decl_map_anon+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -int -main () -{ -int n = MAP_ANONYMOUS; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_decl_map_anon=yes -else - ac_cv_decl_map_anon=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_decl_map_anon" >&5 -$as_echo "$ac_cv_decl_map_anon" >&6; } - - if test $ac_cv_decl_map_anon = no; then - ac_cv_func_mmap_anon=no - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 -$as_echo_n "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } -if test "${ac_cv_func_mmap_anon+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # Add a system to this blacklist if it has mmap() and MAP_ANON or - # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) - # doesn't give anonymous zeroed pages with the same properties listed - # above for use of /dev/zero. - # Systems known to be in this category are Windows, VMS, and SCO Unix. - case "$host_os" in - vms* | cygwin* | pe | mingw* | sco* | udk* ) - ac_cv_func_mmap_anon=no ;; - *) - ac_cv_func_mmap_anon=yes;; - esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_anon" >&5 -$as_echo "$ac_cv_func_mmap_anon" >&6; } - fi -fi - -if test $ac_cv_func_mmap_file = yes; then - -$as_echo "#define HAVE_MMAP_FILE 1" >>confdefs.h - -fi -if test $ac_cv_func_mmap_dev_zero = yes; then - -$as_echo "#define HAVE_MMAP_DEV_ZERO 1" >>confdefs.h - -fi -if test $ac_cv_func_mmap_anon = yes; then - -$as_echo "#define HAVE_MMAP_ANON 1" >>confdefs.h - -fi - - - if test -d $srcdir/testsuite; then - TESTSUBDIR_TRUE= - TESTSUBDIR_FALSE='#' -else - TESTSUBDIR_TRUE='#' - TESTSUBDIR_FALSE= -fi - - -TARGETDIR="unknown" -HAVE_LONG_DOUBLE_VARIANT=0 - -. ${srcdir}/configure.host - -if test -n "${UNSUPPORTED}"; then - as_fn_error "\"libffi has not been ported to $host.\"" "$LINENO" 5 -fi - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -for ac_func in memcpy -do : - ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" -if test "x$ac_cv_func_memcpy" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MEMCPY 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 -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 -# define alloca _alloca -# else -# ifdef HAVE_ALLOCA_H -# include -# 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 - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 -$as_echo_n "checking size of double... " >&6; } -if test "${ac_cv_sizeof_double+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_double" = yes; then - { { $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 "cannot compute sizeof (double) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_double=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 -$as_echo "$ac_cv_sizeof_double" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_DOUBLE $ac_cv_sizeof_double -_ACEOF - - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 -$as_echo_n "checking size of long double... " >&6; } -if test "${ac_cv_sizeof_long_double+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_long_double" = yes; then - { { $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 "cannot compute sizeof (long double) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_long_double=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5 -$as_echo "$ac_cv_sizeof_long_double" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double -_ACEOF - - - -# Also AC_SUBST this variable for ffi.h. -if test -z "$HAVE_LONG_DOUBLE"; then - HAVE_LONG_DOUBLE=0 - if test $ac_cv_sizeof_long_double != 0; then - if test $HAVE_LONG_DOUBLE_VARIANT != 0; then - -$as_echo "#define HAVE_LONG_DOUBLE_VARIANT 1" >>confdefs.h - - HAVE_LONG_DOUBLE=1 - else - if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then - HAVE_LONG_DOUBLE=1 - -$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h - - fi - fi - fi -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -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 - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -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 - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -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_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .cfi pseudo-op support" >&5 -$as_echo_n "checking assembler .cfi pseudo-op support... " >&6; } -if test "${gcc_cv_as_cfi_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - gcc_cv_as_cfi_pseudo_op=unknown - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -asm (".cfi_startproc\n\t.cfi_endproc"); -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gcc_cv_as_cfi_pseudo_op=yes -else - gcc_cv_as_cfi_pseudo_op=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_cfi_pseudo_op" >&5 -$as_echo "$gcc_cv_as_cfi_pseudo_op" >&6; } - if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then - -$as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.h - - fi - - -if test x$TARGET = xSPARC; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5 -$as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; } -if test "${libffi_cv_as_sparc_ua_pcrel+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - save_CFLAGS="$CFLAGS" - save_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS -fpic" - LDFLAGS="$LDFLAGS -shared" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text"); -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libffi_cv_as_sparc_ua_pcrel=yes -else - libffi_cv_as_sparc_ua_pcrel=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_sparc_ua_pcrel" >&5 -$as_echo "$libffi_cv_as_sparc_ua_pcrel" >&6; } - if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then - -$as_echo "#define HAVE_AS_SPARC_UA_PCREL 1" >>confdefs.h - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .register pseudo-op support" >&5 -$as_echo_n "checking assembler .register pseudo-op support... " >&6; } -if test "${libffi_cv_as_register_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_register_pseudo_op=unknown - # Check if we have .register - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm (".register %g2, #scratch"); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libffi_cv_as_register_pseudo_op=yes -else - libffi_cv_as_register_pseudo_op=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_register_pseudo_op" >&5 -$as_echo "$libffi_cv_as_register_pseudo_op" >&6; } - if test "x$libffi_cv_as_register_pseudo_op" = xyes; then - -$as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h - - fi -fi - -if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 -$as_echo_n "checking assembler supports pc related relocs... " >&6; } -if test "${libffi_cv_as_x86_pcrel+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_x86_pcrel=no - echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_pcrel" >&5 -$as_echo "$libffi_cv_as_x86_pcrel" >&6; } - if test "x$libffi_cv_as_x86_pcrel" = xyes; then - -$as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5 -$as_echo_n "checking assembler .ascii pseudo-op support... " >&6; } -if test "${libffi_cv_as_ascii_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_ascii_pseudo_op=unknown - # Check if we have .ascii - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm (".ascii \\"string\\""); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libffi_cv_as_ascii_pseudo_op=yes -else - libffi_cv_as_ascii_pseudo_op=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5 -$as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; } - if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then - -$as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5 -$as_echo_n "checking assembler .string pseudo-op support... " >&6; } -if test "${libffi_cv_as_string_pseudo_op+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_string_pseudo_op=unknown - # Check if we have .string - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -asm (".string \\"string\\""); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libffi_cv_as_string_pseudo_op=yes -else - libffi_cv_as_string_pseudo_op=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5 -$as_echo "$libffi_cv_as_string_pseudo_op" >&6; } - if test "x$libffi_cv_as_string_pseudo_op" = xyes; then - -$as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h - - fi -fi - -if test x$TARGET = xS390; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler uses zarch features" >&5 -$as_echo_n "checking compiler uses zarch features... " >&6; } -if test "${libffi_cv_as_s390_zarch+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_as_s390_zarch=no - echo 'void foo(void) { bar(); bar(); }' > conftest.c - if $CC $CFLAGS -S conftest.c > /dev/null 2>&1; then - if grep -q brasl conftest.s; then - libffi_cv_as_s390_zarch=yes - fi - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_s390_zarch" >&5 -$as_echo "$libffi_cv_as_s390_zarch" >&6; } - if test "x$libffi_cv_as_s390_zarch" = xyes; then - -$as_echo "#define HAVE_AS_S390_ZARCH 1" >>confdefs.h - - fi -fi - -# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. -# Check whether --enable-pax_emutramp was given. -if test "${enable_pax_emutramp+set}" = set; then : - enableval=$enable_pax_emutramp; if test "$enable_pax_emutramp" = "yes"; then - -$as_echo "#define FFI_MMAP_EXEC_EMUTRAMP_PAX 1" >>confdefs.h - - fi -fi - - -FFI_EXEC_TRAMPOLINE_TABLE=0 -case "$target" in - *arm*-apple-darwin*) - FFI_EXEC_TRAMPOLINE_TABLE=1 - -$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h - - ;; - *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) - -$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h - - ;; -esac - if test x$FFI_EXEC_TRAMPOLINE_TABLE = x1; then - FFI_EXEC_TRAMPOLINE_TABLE_TRUE= - FFI_EXEC_TRAMPOLINE_TABLE_FALSE='#' -else - FFI_EXEC_TRAMPOLINE_TABLE_TRUE='#' - FFI_EXEC_TRAMPOLINE_TABLE_FALSE= -fi - - - -if test x$TARGET = xX86_64; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking toolchain supports unwind section type" >&5 -$as_echo_n "checking toolchain supports unwind section type... " >&6; } -if test "${libffi_cv_as_x86_64_unwind_section_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - cat > conftest1.s << EOF -.text -.globl foo -foo: -jmp bar -.section .eh_frame,"a",@unwind -bar: -EOF - - cat > conftest2.c << EOF -extern void foo(); -int main(){foo();} -EOF - - libffi_cv_as_x86_64_unwind_section_type=no - # we ensure that we can compile _and_ link an assembly file containing an @unwind section - # since the compiler can support it and not the linker (ie old binutils) - if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ - $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then - libffi_cv_as_x86_64_unwind_section_type=yes - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 -$as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } - if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then - -$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h - - fi -fi - -if test "x$GCC" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 -$as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } -if test "${libffi_cv_ro_eh_frame+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then - objdump -h conftest.o > conftest.dump 2>&1 - libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` - if test "x$libffi_eh_frame_line" != "x"; then - libffi_test_line=`expr $libffi_eh_frame_line + 1`p - sed -n $libffi_test_line conftest.dump > conftest.line - if grep READONLY conftest.line > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi - fi - fi - rm -f conftest.* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5 -$as_echo "$libffi_cv_ro_eh_frame" >&6; } - if test "x$libffi_cv_ro_eh_frame" = xyes; then - -$as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h - - -$as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h - - else - -$as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 -$as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; } -if test "${libffi_cv_hidden_visibility_attribute+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 - (eval $ac_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5 -$as_echo "$libffi_cv_hidden_visibility_attribute" >&6; } - if test $libffi_cv_hidden_visibility_attribute = yes; then - -$as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h - - fi -fi - - - - - - - -TARGET_OBJ= -for i in $SOURCES; do - TARGET_OBJ="${TARGET_OBJ} src/${TARGETDIR}/"`echo $i | sed 's/[cS]$/lo/'` -done - - - - - -# Check whether --enable-debug was given. -if test "${enable_debug+set}" = set; then : - enableval=$enable_debug; if test "$enable_debug" = "yes"; then - -$as_echo "#define FFI_DEBUG 1" >>confdefs.h - - fi -fi - - if test "$enable_debug" = "yes"; then - FFI_DEBUG_TRUE= - FFI_DEBUG_FALSE='#' -else - FFI_DEBUG_TRUE='#' - FFI_DEBUG_FALSE= -fi - - -# Check whether --enable-structs was given. -if test "${enable_structs+set}" = set; then : - enableval=$enable_structs; if test "$enable_structs" = "no"; then - -$as_echo "#define FFI_NO_STRUCTS 1" >>confdefs.h - - fi -fi - - if test "$enable_debug" = "yes"; then - FFI_DEBUG_TRUE= - FFI_DEBUG_FALSE='#' -else - FFI_DEBUG_TRUE='#' - FFI_DEBUG_FALSE= -fi - - -# Check whether --enable-raw-api was given. -if test "${enable_raw_api+set}" = set; then : - enableval=$enable_raw_api; if test "$enable_raw_api" = "no"; then - -$as_echo "#define FFI_NO_RAW_API 1" >>confdefs.h - - fi -fi - - -# Check whether --enable-purify-safety was given. -if test "${enable_purify_safety+set}" = set; then : - enableval=$enable_purify_safety; if test "$enable_purify_safety" = "yes"; then - -$as_echo "#define USING_PURIFY 1" >>confdefs.h - - fi -fi - - -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - 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 - - - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -ac_config_commands="$ac_config_commands include" - -ac_config_commands="$ac_config_commands src" - - -ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h" - - -ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" - - -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}' - -DEFS=-DHAVE_CONFIG_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 "${BUILD_INFO_TRUE}" && test -z "${BUILD_INFO_FALSE}"; then - as_fn_error "conditional \"BUILD_INFO\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${GENINSRC_TRUE}" && test -z "${GENINSRC_FALSE}"; then - as_fn_error "conditional \"GENINSRC\" 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 "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then - as_fn_error "conditional \"am__fastdepCCAS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -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 "${TESTSUBDIR_TRUE}" && test -z "${TESTSUBDIR_FALSE}"; then - as_fn_error "conditional \"TESTSUBDIR\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then - as_fn_error "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then - as_fn_error "conditional \"FFI_DEBUG\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then - as_fn_error "conditional \"FFI_DEBUG\" 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 libffi $as_me 3.99999, 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 - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_links="$ac_config_links" -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 - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration links: -$config_links - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -libffi config.status 3.99999 -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;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --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 -# - -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" -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$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' - - - - - -TARGETDIR="$TARGETDIR" - -_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 - "fficonfig.h") CONFIG_HEADERS="$CONFIG_HEADERS fficonfig.h" ;; - "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;; - "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;; - "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;; - "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; - "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; - "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; - - *) 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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :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 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_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" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - :L) - # - # CONFIG_LINK - # - - if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then - : - else - # Prefer the file from the source tree if names are identical. - if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then - ac_source=$srcdir/$ac_source - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 -$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} - - if test ! -r "$ac_source"; then - as_fn_error "$ac_source: file not found" "$LINENO" 5 - fi - rm -f "$ac_file" - - # Try a relative symlink, then a hard link, then a copy. - case $srcdir in - [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; - *) ac_rel_source=$ac_top_build_prefix$ac_source ;; - esac - ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || - ln "$ac_source" "$ac_file" 2>/dev/null || - cp -p "$ac_source" "$ac_file" || - as_fn_error "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 - fi - ;; - :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 - "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 ;; - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 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 - - ;; - "include":C) test -d include || mkdir include ;; - "src":C) -test -d src || mkdir src -test -d src/$TARGETDIR || mkdir src/$TARGETDIR - ;; - - 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/llgo/third_party/gofrontend/libffi/configure.ac b/llgo/third_party/gofrontend/libffi/configure.ac deleted file mode 100644 index 07ec10d42e7221547ef4d3a7bcfaf2a97d2b1886..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/configure.ac +++ /dev/null @@ -1,392 +0,0 @@ -dnl Process this with autoconf to create configure - -AC_PREREQ(2.64) - -AC_INIT([libffi], [3.99999], [http://github.com/atgreen/libffi/issues]) -AC_CONFIG_HEADERS([fficonfig.h]) - -AM_ENABLE_MULTILIB(, ..) - -AC_CANONICAL_SYSTEM -target_alias=${target_alias-$host_alias} - -AM_INIT_AUTOMAKE([no-dist]) - -# See if makeinfo has been installed and is modern enough -# that we can use it. -ACX_CHECK_PROG_VER([MAKEINFO], [makeinfo], [--version], - [GNU texinfo.* \([0-9][0-9.]*\)], - [4.[4-9]*|4.[1-9][0-9]*|[5-9]*|[1-9][0-9]*]) -AM_CONDITIONAL(BUILD_INFO, test $gcc_cv_prog_makeinfo_modern = "yes") - -# We would like our source tree to be readonly. However when releases or -# pre-releases are generated, the flex/bison generated files as well as the -# various formats of manuals need to be included along with the rest of the -# sources. Therefore we have --enable-generated-files-in-srcdir to do -# just that. -AC_MSG_CHECKING(generated-files-in-srcdir) -AC_ARG_ENABLE(generated-files-in-srcdir, -AS_HELP_STRING([--enable-generated-files-in-srcdir], - [put copies of generated files in source dir intended for creating source tarballs for users without texinfo bison or flex]), -[case "$enableval" in - yes) enable_generated_files_in_srcdir=yes ;; - no) enable_generated_files_in_srcdir=no ;; - *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; - esac], -[enable_generated_files_in_srcdir=no]) -AC_MSG_RESULT($enable_generated_files_in_srcdir) -AM_CONDITIONAL(GENINSRC, test "$enable_generated_files_in_srcdir" = yes) - -# The same as in boehm-gc and libstdc++. Have to borrow it from there. -# We must force CC to /not/ be precious variables; otherwise -# the wrong, non-multilib-adjusted value will be used in multilibs. -# As a side effect, we have to subst CFLAGS ourselves. -# Also save and restore CFLAGS, since AC_PROG_CC will come up with -# defaults of its own if none are provided. - -m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) -m4_define([_AC_ARG_VAR_PRECIOUS],[]) -save_CFLAGS=$CFLAGS -AC_PROG_CC -AC_PROG_CXX -CFLAGS=$save_CFLAGS -m4_undefine([_AC_ARG_VAR_PRECIOUS]) -m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) - -AC_SUBST(CFLAGS) - -AM_PROG_AS -AM_PROG_CC_C_O -AC_PROG_LIBTOOL - -# Test for 64-bit build. -AC_CHECK_SIZEOF([size_t]) - -AM_MAINTAINER_MODE - -AC_CHECK_HEADERS(sys/mman.h) -AC_CHECK_FUNCS([mmap mkostemp]) -AC_FUNC_MMAP_BLACKLIST - -dnl The -no-testsuite modules omit the test subdir. -AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) - -TARGETDIR="unknown" -HAVE_LONG_DOUBLE_VARIANT=0 - -. ${srcdir}/configure.host - -if test -n "${UNSUPPORTED}"; then - AC_MSG_ERROR(["libffi has not been ported to $host."]) -fi - -AC_SUBST(AM_RUNTESTFLAGS) -AC_SUBST(AM_LTLDFLAGS) - -AC_HEADER_STDC -AC_CHECK_FUNCS(memcpy) -AC_FUNC_ALLOCA - -AC_CHECK_SIZEOF(double) -AC_CHECK_SIZEOF(long double) - -# Also AC_SUBST this variable for ffi.h. -if test -z "$HAVE_LONG_DOUBLE"; then - HAVE_LONG_DOUBLE=0 - if test $ac_cv_sizeof_long_double != 0; then - if test $HAVE_LONG_DOUBLE_VARIANT != 0; then - AC_DEFINE(HAVE_LONG_DOUBLE_VARIANT, 1, [Define if you support more than one size of the long double type]) - HAVE_LONG_DOUBLE=1 - else - if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then - HAVE_LONG_DOUBLE=1 - AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) - fi - fi - fi -fi -AC_SUBST(HAVE_LONG_DOUBLE) -AC_SUBST(HAVE_LONG_DOUBLE_VARIANT) - -AC_C_BIGENDIAN - -GCC_AS_CFI_PSEUDO_OP - -if test x$TARGET = xSPARC; then - AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], - libffi_cv_as_sparc_ua_pcrel, [ - save_CFLAGS="$CFLAGS" - save_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS -fpic" - LDFLAGS="$LDFLAGS -shared" - AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],, - [libffi_cv_as_sparc_ua_pcrel=yes], - [libffi_cv_as_sparc_ua_pcrel=no]) - CFLAGS="$save_CFLAGS" - LDFLAGS="$save_LDFLAGS"]) - if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then - AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, - [Define if your assembler and linker support unaligned PC relative relocs.]) - fi - - AC_CACHE_CHECK([assembler .register pseudo-op support], - libffi_cv_as_register_pseudo_op, [ - libffi_cv_as_register_pseudo_op=unknown - # Check if we have .register - AC_TRY_COMPILE(,[asm (".register %g2, #scratch");], - [libffi_cv_as_register_pseudo_op=yes], - [libffi_cv_as_register_pseudo_op=no]) - ]) - if test "x$libffi_cv_as_register_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, - [Define if your assembler supports .register.]) - fi -fi - -if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then - AC_CACHE_CHECK([assembler supports pc related relocs], - libffi_cv_as_x86_pcrel, [ - libffi_cv_as_x86_pcrel=no - echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s - if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libffi_cv_as_x86_pcrel=yes - fi - ]) - if test "x$libffi_cv_as_x86_pcrel" = xyes; then - AC_DEFINE(HAVE_AS_X86_PCREL, 1, - [Define if your assembler supports PC relative relocs.]) - fi - - AC_CACHE_CHECK([assembler .ascii pseudo-op support], - libffi_cv_as_ascii_pseudo_op, [ - libffi_cv_as_ascii_pseudo_op=unknown - # Check if we have .ascii - AC_TRY_COMPILE(,[asm (".ascii \\"string\\"");], - [libffi_cv_as_ascii_pseudo_op=yes], - [libffi_cv_as_ascii_pseudo_op=no]) - ]) - if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, - [Define if your assembler supports .ascii.]) - fi - - AC_CACHE_CHECK([assembler .string pseudo-op support], - libffi_cv_as_string_pseudo_op, [ - libffi_cv_as_string_pseudo_op=unknown - # Check if we have .string - AC_TRY_COMPILE(,[asm (".string \\"string\\"");], - [libffi_cv_as_string_pseudo_op=yes], - [libffi_cv_as_string_pseudo_op=no]) - ]) - if test "x$libffi_cv_as_string_pseudo_op" = xyes; then - AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, - [Define if your assembler supports .string.]) - fi -fi - -if test x$TARGET = xS390; then - AC_CACHE_CHECK([compiler uses zarch features], - libffi_cv_as_s390_zarch, [ - libffi_cv_as_s390_zarch=no - echo 'void foo(void) { bar(); bar(); }' > conftest.c - if $CC $CFLAGS -S conftest.c > /dev/null 2>&1; then - if grep -q brasl conftest.s; then - libffi_cv_as_s390_zarch=yes - fi - fi - ]) - if test "x$libffi_cv_as_s390_zarch" = xyes; then - AC_DEFINE(HAVE_AS_S390_ZARCH, 1, - [Define if the compiler uses zarch features.]) - fi -fi - -# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. -AC_ARG_ENABLE(pax_emutramp, - [ --enable-pax_emutramp enable pax emulated trampolines, for we can't use PROT_EXEC], - if test "$enable_pax_emutramp" = "yes"; then - AC_DEFINE(FFI_MMAP_EXEC_EMUTRAMP_PAX, 1, - [Define this if you want to enable pax emulated trampolines]) - fi) - -FFI_EXEC_TRAMPOLINE_TABLE=0 -case "$target" in - *arm*-apple-darwin*) - FFI_EXEC_TRAMPOLINE_TABLE=1 - AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1, - [Cannot use PROT_EXEC on this target, so, we revert to - alternative means]) - ;; - *-apple-darwin1* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*) - AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, - [Cannot use malloc on this target, so, we revert to - alternative means]) - ;; -esac -AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) -AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) - -if test x$TARGET = xX86_64; then - AC_CACHE_CHECK([toolchain supports unwind section type], - libffi_cv_as_x86_64_unwind_section_type, [ - cat > conftest1.s << EOF -.text -.globl foo -foo: -jmp bar -.section .eh_frame,"a",@unwind -bar: -EOF - - cat > conftest2.c << EOF -extern void foo(); -int main(){foo();} -EOF - - libffi_cv_as_x86_64_unwind_section_type=no - # we ensure that we can compile _and_ link an assembly file containing an @unwind section - # since the compiler can support it and not the linker (ie old binutils) - if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ - $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then - libffi_cv_as_x86_64_unwind_section_type=yes - fi - ]) - if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then - AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, - [Define if your assembler supports unwind section type.]) - fi -fi - -if test "x$GCC" = "xyes"; then - AC_CACHE_CHECK([whether .eh_frame section should be read-only], - libffi_cv_ro_eh_frame, [ - libffi_cv_ro_eh_frame=no - echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c - if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then - objdump -h conftest.o > conftest.dump 2>&1 - libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1` - if test "x$libffi_eh_frame_line" != "x"; then - libffi_test_line=`expr $libffi_eh_frame_line + 1`p - sed -n $libffi_test_line conftest.dump > conftest.line - if grep READONLY conftest.line > /dev/null; then - libffi_cv_ro_eh_frame=yes - fi - fi - fi - rm -f conftest.* - ]) - if test "x$libffi_cv_ro_eh_frame" = xyes; then - AC_DEFINE(HAVE_RO_EH_FRAME, 1, - [Define if .eh_frame sections should be read-only.]) - AC_DEFINE(EH_FRAME_FLAGS, "a", - [Define to the flags needed for the .section .eh_frame directive. ]) - else - AC_DEFINE(EH_FRAME_FLAGS, "aw", - [Define to the flags needed for the .section .eh_frame directive. ]) - fi - - AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], - libffi_cv_hidden_visibility_attribute, [ - echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c - libffi_cv_hidden_visibility_attribute=no - if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then - if grep '\.hidden.*foo' conftest.s >/dev/null; then - libffi_cv_hidden_visibility_attribute=yes - fi - fi - rm -f conftest.* - ]) - if test $libffi_cv_hidden_visibility_attribute = yes; then - AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, - [Define if __attribute__((visibility("hidden"))) is supported.]) - fi -fi - -AH_BOTTOM([ -#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) .hidden name -#else -#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) -#endif -#else -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) -#else -#define FFI_HIDDEN -#endif -#endif -]) - -AC_SUBST(TARGET) -AC_SUBST(TARGETDIR) - -changequote(<,>) -TARGET_OBJ= -for i in $SOURCES; do - TARGET_OBJ="${TARGET_OBJ} src/${TARGETDIR}/"`echo $i | sed 's/[cS]$/lo/'` -done -changequote([,]) -AC_SUBST(TARGET_OBJ) - -AC_SUBST(SHELL) - -AC_ARG_ENABLE(debug, -[ --enable-debug debugging mode], - if test "$enable_debug" = "yes"; then - AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) - fi) -AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") - -AC_ARG_ENABLE(structs, -[ --disable-structs omit code for struct support], - if test "$enable_structs" = "no"; then - AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this if you do not want support for aggregate types.]) - fi) -AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") - -AC_ARG_ENABLE(raw-api, -[ --disable-raw-api make the raw api unavailable], - if test "$enable_raw_api" = "no"; then - AC_DEFINE(FFI_NO_RAW_API, 1, [Define this if you do not want support for the raw API.]) - fi) - -AC_ARG_ENABLE(purify-safety, -[ --enable-purify-safety purify-safe mode], - if test "$enable_purify_safety" = "yes"; then - AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) - fi) - -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - 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 -AC_SUBST(toolexecdir) -AC_SUBST(toolexeclibdir) - -if test "${multilib}" = "yes"; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) -AC_CONFIG_COMMANDS(src, [ -test -d src || mkdir src -test -d src/$TARGETDIR || mkdir src/$TARGETDIR -], [TARGETDIR="$TARGETDIR"]) - -AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) - -AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) - -AC_OUTPUT diff --git a/llgo/third_party/gofrontend/libffi/configure.host b/llgo/third_party/gofrontend/libffi/configure.host deleted file mode 100644 index 90de638b30cbb6352cb181af3a6e0df8d673ec9e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/configure.host +++ /dev/null @@ -1,265 +0,0 @@ -# configure.host -# -# This shell script handles all host based configuration for libffi. -# - -# THIS TABLE IS SORTED. KEEP IT THAT WAY. -# Most of the time we can define all the variables all at once... -case "${host}" in - aarch64*-*-*) - TARGET=AARCH64; TARGETDIR=aarch64 - SOURCES="ffi.c sysv.S" - ;; - - alpha*-*-*) - TARGET=ALPHA; TARGETDIR=alpha; - # Support 128-bit long double, changeable via command-line switch. - HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' - SOURCES="ffi.c osf.S" - ;; - - arc*-*-*) - TARGET=ARC; TARGETDIR=arc - SOURCES="ffi.c arcompact.S" - ;; - - arm*-*-*) - TARGET=ARM; TARGETDIR=arm - SOURCES="ffi.c sysv.S" - ;; - - avr32*-*-*) - TARGET=AVR32; TARGETDIR=avr32 - SOURCES="ffi.c sysv.S" - ;; - - bfin*) - TARGET=BFIN; TARGETDIR=bfin - SOURCES="ffi.c sysv.S" - ;; - - cris-*-*) - TARGET=LIBFFI_CRIS; TARGETDIR=cris - SOURCES="ffi.c sysv.S" - ;; - - frv-*-*) - TARGET=FRV; TARGETDIR=frv - SOURCES="ffi.c eabi.S" - ;; - - hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) - TARGET=PA_LINUX; TARGETDIR=pa - SOURCES="ffi.c linux.S" - ;; - hppa*64-*-hpux*) - TARGET=PA64_HPUX; TARGETDIR=pa - ;; - hppa*-*-hpux*) - TARGET=PA_HPUX; TARGETDIR=pa - SOURCES="ffi.c hpux32.S" - ;; - - i?86-*-freebsd* | i?86-*-openbsd*) - TARGET=X86_FREEBSD; TARGETDIR=x86 - ;; - - i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix* \ - | x86_64-*-cygwin* | x86_64-*-mingw*) - TARGETDIR=x86 - if test $ac_cv_sizeof_size_t = 4; then - TARGET=X86_WIN32 - else - TARGET=X86_WIN64 - fi - # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. - # We must also check with_cross_host to decide if this is a native - # or cross-build and select where to install dlls appropriately. - if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; - else - AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; - fi - ;; - - i?86-*-darwin* | x86_64-*-darwin*) - TARGETDIR=x86 - if test $ac_cv_sizeof_size_t = 4; then - TARGET=X86_DARWIN - else - TARGET=X86_64_DARWIN - fi - ;; - - i?86-*-* | x86_64-*-* | amd64-*) - TARGETDIR=x86 - if test $ac_cv_sizeof_size_t = 4; then - case "$host" in - *-gnux32) - TARGET=X86_64 - ;; - *) - TARGET=X86 - ;; - esac - else - TARGET=X86_64; - fi - ;; - - ia64*-*-*) - TARGET=IA64; TARGETDIR=ia64 - SOURCES="ffi.c unix.S" - ;; - - m32r*-*-*) - TARGET=M32R; TARGETDIR=m32r - SOURCES="ffi.c sysv.S" - ;; - - m68k-*-*) - TARGET=M68K; TARGETDIR=m68k - SOURCES="ffi.c sysv.S" - ;; - - m88k-*-*) - TARGET=M88K; TARGETDIR=m88k - SOURCES="ffi.c obsd.S" - ;; - - microblaze*-*-*) - TARGET=MICROBLAZE; TARGETDIR=microblaze - SOURCES="ffi.c sysv.S" - ;; - - moxie-*-*) - TARGET=MOXIE; TARGETDIR=moxie - SOURCES="ffi.c eabi.S" - ;; - - metag-*-*) - TARGET=METAG; TARGETDIR=metag - SOURCES="ffi.c sysv.S" - ;; - - mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) - TARGET=MIPS; TARGETDIR=mips - ;; - mips*-*linux* | mips*-*-openbsd*) - # Support 128-bit long double for NewABI. - HAVE_LONG_DOUBLE='defined(__mips64)' - TARGET=MIPS; TARGETDIR=mips - ;; - - nios2*-linux*) - TARGET=NIOS2; TARGETDIR=nios2 - SOURCES="ffi.c sysv.S" - ;; - - or1k*-linux*) - TARGET=OR1K; TARGETDIR=or1k - SOURCES="ffi.c sysv.S" - ;; - - powerpc*-*-linux* | powerpc-*-sysv*) - TARGET=POWERPC; TARGETDIR=powerpc - HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc-*-amigaos*) - TARGET=POWERPC; TARGETDIR=powerpc - ;; - powerpc-*-beos*) - TARGET=POWERPC; TARGETDIR=powerpc - ;; - powerpc-*-darwin* | powerpc64-*-darwin*) - TARGET=POWERPC_DARWIN; TARGETDIR=powerpc - ;; - powerpc-*-aix* | rs6000-*-aix*) - TARGET=POWERPC_AIX; TARGETDIR=powerpc - ;; - powerpc-*-freebsd* | powerpc-*-openbsd*) - TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc - HAVE_LONG_DOUBLE_VARIANT=1 - ;; - powerpc64-*-freebsd*) - TARGET=POWERPC; TARGETDIR=powerpc - ;; - powerpc*-*-rtems*) - TARGET=POWERPC; TARGETDIR=powerpc - ;; - - s390-*-* | s390x-*-*) - TARGET=S390; TARGETDIR=s390 - SOURCES="ffi.c sysv.S" - ;; - - sh-*-* | sh[[34]]*-*-*) - TARGET=SH; TARGETDIR=sh - SOURCES="ffi.c sysv.S" - ;; - sh64-*-* | sh5*-*-*) - TARGET=SH64; TARGETDIR=sh64 - SOURCES="ffi.c sysv.S" - ;; - - sparc*-*-*) - TARGET=SPARC; TARGETDIR=sparc - SOURCES="ffi.c ffi64.c v8.S v9.S" - ;; - - tile*-*) - TARGET=TILE; TARGETDIR=tile - SOURCES="ffi.c tile.S" - ;; - - vax-*-*) - TARGET=VAX; TARGETDIR=vax - SOURCES="ffi.c elfbsd.S" - ;; - - xtensa*-*) - TARGET=XTENSA; TARGETDIR=xtensa - SOURCES="ffi.c sysv.S" - ;; -esac - -# ... but some of the cases above share configury. -case "${TARGET}" in - MIPS) - SOURCES="ffi.c o32.S n32.S" - ;; - POWERPC) - SOURCES="ffi.c ffi_sysv.c ffi_linux64.c sysv.S ppc_closure.S" - SOURCES="${SOURCES} linux64.S linux64_closure.S" - ;; - POWERPC_AIX) - SOURCES="ffi_darwin.c aix.S aix_closure.S" - ;; - POWERPC_DARWIN) - SOURCES="ffi_darwin.c darwin.S darwin_closure.S" - ;; - POWERPC_FREEBSD) - SOURCES="ffi.c ffi_sysv.c sysv.S ppc_closure.S" - ;; - X86 | X86_FREEBSD | X86_WIN32) - SOURCES="ffi.c sysv.S" - ;; - X86_64) - SOURCES="ffi64.c unix64.S" - ;; - X86_WIN64) - SOURCES="ffiw64.c win64.S" - ;; - X86_DARWIN) - SOURCES="darwin_c.c darwin.S" - ;; - X86_64_DARWIN) - SOURCES="darwin64_c.c darwin64.S" - ;; -esac - -# If we failed to configure SOURCES, we can't do anything. -if test -z "${SOURCES}"; then - UNSUPPORTED=1 -fi diff --git a/llgo/third_party/gofrontend/libffi/doc/libffi.texi b/llgo/third_party/gofrontend/libffi/doc/libffi.texi deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/llgo/third_party/gofrontend/libffi/doc/version.texi b/llgo/third_party/gofrontend/libffi/doc/version.texi deleted file mode 100644 index ccef70f4931366583c4d4865681fbc4930eeaa3e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/doc/version.texi +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 8 November 2014 -@set UPDATED-MONTH November 2014 -@set EDITION 3.2.1 -@set VERSION 3.2.1 diff --git a/llgo/third_party/gofrontend/libffi/fficonfig.h.in b/llgo/third_party/gofrontend/libffi/fficonfig.h.in deleted file mode 100644 index f245ce00da260c6019d1ee6bc878ed41d2679374..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/fficonfig.h.in +++ /dev/null @@ -1,211 +0,0 @@ -/* fficonfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to the flags needed for the .section .eh_frame directive. */ -#undef EH_FRAME_FLAGS - -/* Define this if you want extra debugging. */ -#undef FFI_DEBUG - -/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ -#undef FFI_EXEC_TRAMPOLINE_TABLE - -/* Define this if you want to enable pax emulated trampolines */ -#undef FFI_MMAP_EXEC_EMUTRAMP_PAX - -/* Cannot use malloc on this target, so, we revert to alternative means */ -#undef FFI_MMAP_EXEC_WRIT - -/* Define this if you do not want support for the raw API. */ -#undef FFI_NO_RAW_API - -/* Define this if you do not want support for aggregate types. */ -#undef FFI_NO_STRUCTS - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define if your assembler supports .ascii. */ -#undef HAVE_AS_ASCII_PSEUDO_OP - -/* Define if your assembler supports .cfi_* directives. */ -#undef HAVE_AS_CFI_PSEUDO_OP - -/* Define if your assembler supports .register. */ -#undef HAVE_AS_REGISTER_PSEUDO_OP - -/* Define if the compiler uses zarch features. */ -#undef HAVE_AS_S390_ZARCH - -/* Define if your assembler and linker support unaligned PC relative relocs. - */ -#undef HAVE_AS_SPARC_UA_PCREL - -/* Define if your assembler supports .string. */ -#undef HAVE_AS_STRING_PSEUDO_OP - -/* Define if your assembler supports unwind section type. */ -#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE - -/* Define if your assembler supports PC relative relocs. */ -#undef HAVE_AS_X86_PCREL - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define if __attribute__((visibility("hidden"))) is supported. */ -#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if you have the long double type and it is bigger than a double */ -#undef HAVE_LONG_DOUBLE - -/* Define if you support more than one size of the long double type */ -#undef HAVE_LONG_DOUBLE_VARIANT - -/* Define to 1 if you have the `memcpy' function. */ -#undef HAVE_MEMCPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mkostemp' function. */ -#undef HAVE_MKOSTEMP - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define if mmap with MAP_ANON(YMOUS) works. */ -#undef HAVE_MMAP_ANON - -/* Define if mmap of /dev/zero works. */ -#undef HAVE_MMAP_DEV_ZERO - -/* Define if read-only mmap of a plain file works. */ -#undef HAVE_MMAP_FILE - -/* Define if .eh_frame sections should be read-only. */ -#undef HAVE_RO_EH_FRAME - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#undef NO_MINUS_C_MINUS_O - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* The size of `double', as computed by sizeof. */ -#undef SIZEOF_DOUBLE - -/* The size of `long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - -/* The size of `size_t', as computed by sizeof. */ -#undef SIZEOF_SIZE_T - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define this if you are using Purify and want to suppress spurious messages. - */ -#undef USING_PURIFY - -/* Version number of package */ -#undef VERSION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - - -#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) .hidden name -#else -#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) -#endif -#else -#ifdef LIBFFI_ASM -#define FFI_HIDDEN(name) -#else -#define FFI_HIDDEN -#endif -#endif - diff --git a/llgo/third_party/gofrontend/libffi/generate-darwin-source-and-headers.py b/llgo/third_party/gofrontend/libffi/generate-darwin-source-and-headers.py deleted file mode 100644 index 306136fe44694b2bc224dcf2aedd6891a923b800..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/generate-darwin-source-and-headers.py +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/env python -import subprocess -import os -import errno -import collections -import glob -import argparse - -class Platform(object): - pass - -class simulator_platform(Platform): - directory = 'darwin_ios' - sdk = 'iphonesimulator' - arch = 'i386' - triple = 'i386-apple-darwin11' - version_min = '-miphoneos-version-min=7.0' - - prefix = "#ifdef __i386__\n\n" - suffix = "\n\n#endif" - src_dir = 'x86' - src_files = ['darwin.S', 'win32.S', 'ffi.c'] - - -class simulator64_platform(Platform): - directory = 'darwin_ios' - sdk = 'iphonesimulator' - arch = 'x86_64' - triple = 'x86_64-apple-darwin13' - version_min = '-miphoneos-version-min=7.0' - - prefix = "#ifdef __x86_64__\n\n" - suffix = "\n\n#endif" - src_dir = 'x86' - src_files = ['darwin64.S', 'ffi64.c'] - - -class device_platform(Platform): - directory = 'darwin_ios' - sdk = 'iphoneos' - arch = 'armv7' - triple = 'arm-apple-darwin11' - version_min = '-miphoneos-version-min=7.0' - - prefix = "#ifdef __arm__\n\n" - suffix = "\n\n#endif" - src_dir = 'arm' - src_files = ['sysv.S', 'trampoline.S', 'ffi.c'] - - -class device64_platform(Platform): - directory = 'darwin_ios' - sdk = 'iphoneos' - arch = 'arm64' - triple = 'aarch64-apple-darwin13' - version_min = '-miphoneos-version-min=7.0' - - prefix = "#ifdef __arm64__\n\n" - suffix = "\n\n#endif" - src_dir = 'aarch64' - src_files = ['sysv.S', 'ffi.c'] - - -class desktop32_platform(Platform): - directory = 'darwin_osx' - sdk = 'macosx' - arch = 'i386' - triple = 'i386-apple-darwin10' - version_min = '-mmacosx-version-min=10.6' - src_dir = 'x86' - src_files = ['darwin.S', 'win32.S', 'ffi.c'] - - prefix = "#ifdef __i386__\n\n" - suffix = "\n\n#endif" - - -class desktop64_platform(Platform): - directory = 'darwin_osx' - sdk = 'macosx' - arch = 'x86_64' - triple = 'x86_64-apple-darwin10' - version_min = '-mmacosx-version-min=10.6' - - prefix = "#ifdef __x86_64__\n\n" - suffix = "\n\n#endif" - src_dir = 'x86' - src_files = ['darwin64.S', 'ffi64.c'] - - -def mkdir_p(path): - try: - os.makedirs(path) - except OSError as exc: # Python >2.5 - if exc.errno == errno.EEXIST: - pass - else: - raise - - -def move_file(src_dir, dst_dir, filename, file_suffix=None, prefix='', suffix=''): - mkdir_p(dst_dir) - out_filename = filename - - if file_suffix: - split_name = os.path.splitext(filename) - out_filename = "%s_%s%s" % (split_name[0], file_suffix, split_name[1]) - - with open(os.path.join(src_dir, filename)) as in_file: - with open(os.path.join(dst_dir, out_filename), 'w') as out_file: - if prefix: - out_file.write(prefix) - - out_file.write(in_file.read()) - - if suffix: - out_file.write(suffix) - - -def list_files(src_dir, pattern=None, filelist=None): - if pattern: filelist = glob.iglob(os.path.join(src_dir, pattern)) - for file in filelist: - yield os.path.basename(file) - - -def copy_files(src_dir, dst_dir, pattern=None, filelist=None, file_suffix=None, prefix=None, suffix=None): - for filename in list_files(src_dir, pattern=pattern, filelist=filelist): - move_file(src_dir, dst_dir, filename, file_suffix=file_suffix, prefix=prefix, suffix=suffix) - - -def copy_src_platform_files(platform): - src_dir = os.path.join('src', platform.src_dir) - dst_dir = os.path.join(platform.directory, 'src', platform.src_dir) - copy_files(src_dir, dst_dir, filelist=platform.src_files, file_suffix=platform.arch, prefix=platform.prefix, suffix=platform.suffix) - - -def build_target(platform, platform_headers): - def xcrun_cmd(cmd): - return 'xcrun -sdk %s %s -arch %s' % (platform.sdk, cmd, platform.arch) - - tag='%s-%s' % (platform.sdk, platform.arch) - build_dir = 'build_%s' % tag - mkdir_p(build_dir) - env = dict(CC=xcrun_cmd('clang'), - LD=xcrun_cmd('ld'), - CFLAGS='%s' % (platform.version_min)) - working_dir = os.getcwd() - try: - os.chdir(build_dir) - subprocess.check_call(['../configure', '-host', platform.triple], env=env) - finally: - os.chdir(working_dir) - - for src_dir in [build_dir, os.path.join(build_dir, 'include')]: - copy_files(src_dir, - os.path.join(platform.directory, 'include'), - pattern='*.h', - file_suffix=platform.arch, - prefix=platform.prefix, - suffix=platform.suffix) - - for filename in list_files(src_dir, pattern='*.h'): - platform_headers[filename].add((platform.prefix, platform.arch, platform.suffix)) - - -def make_tramp(): - with open('src/arm/trampoline.S', 'w') as tramp_out: - p = subprocess.Popen(['bash', 'src/arm/gentramp.sh'], stdout=tramp_out) - p.wait() - - -def generate_source_and_headers(generate_osx=True, generate_ios=True): - copy_files('src', 'darwin_common/src', pattern='*.c') - copy_files('include', 'darwin_common/include', pattern='*.h') - - if generate_ios: - make_tramp() - copy_src_platform_files(simulator_platform) - copy_src_platform_files(simulator64_platform) - copy_src_platform_files(device_platform) - copy_src_platform_files(device64_platform) - if generate_osx: - copy_src_platform_files(desktop32_platform) - copy_src_platform_files(desktop64_platform) - - platform_headers = collections.defaultdict(set) - - if generate_ios: - build_target(simulator_platform, platform_headers) - build_target(simulator64_platform, platform_headers) - build_target(device_platform, platform_headers) - build_target(device64_platform, platform_headers) - if generate_osx: - build_target(desktop32_platform, platform_headers) - build_target(desktop64_platform, platform_headers) - - mkdir_p('darwin_common/include') - for header_name, tag_tuples in platform_headers.iteritems(): - basename, suffix = os.path.splitext(header_name) - with open(os.path.join('darwin_common/include', header_name), 'w') as header: - for tag_tuple in tag_tuples: - header.write('%s#include <%s_%s%s>\n%s\n' % (tag_tuple[0], basename, tag_tuple[1], suffix, tag_tuple[2])) - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--only-ios', action='store_true', default=False) - parser.add_argument('--only-osx', action='store_true', default=False) - args = parser.parse_args() - - generate_source_and_headers(generate_osx=not args.only_ios, generate_ios=not args.only_osx) diff --git a/llgo/third_party/gofrontend/libffi/include/Makefile.am b/llgo/third_party/gofrontend/libffi/include/Makefile.am deleted file mode 100644 index 79f222c482ce63912245fe368215e533ab82f6e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/include/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this with automake to create Makefile.in - -AUTOMAKE_OPTIONS=foreign - -DISTCLEANFILES=ffitarget.h -noinst_HEADERS=ffi_common.h ffi_cfi.h -EXTRA_DIST=ffi.h.in - -# Where generated headers like ffitarget.h get installed. -gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) -toollibffidir := $(libdir)/gcc/$(target_alias)/$(gcc_version)/include - -toollibffi_HEADERS = ffi.h ffitarget.h diff --git a/llgo/third_party/gofrontend/libffi/include/Makefile.in b/llgo/third_party/gofrontend/libffi/include/Makefile.in deleted file mode 100644 index d8d17f1daef11b70a96e85aff0ace948987e2765..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/include/Makefile.in +++ /dev/null @@ -1,458 +0,0 @@ -# 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@ - -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 = include -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(srcdir)/ffi.h.in $(noinst_HEADERS) $(toollibffi_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ - $(top_srcdir)/../config/asmcfi.m4 \ - $(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)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fficonfig.h -CONFIG_CLEAN_FILES = ffi.h ffitarget.h -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -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)$(toollibffidir)" -HEADERS = $(noinst_HEADERS) $(toollibffi_HEADERS) -ETAGS = etags -CTAGS = ctags -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_LTLDFLAGS = @AM_LTLDFLAGS@ -AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -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@ -FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ -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@ -TARGET = @TARGET@ -TARGETDIR = @TARGETDIR@ -TARGET_OBJ = @TARGET_OBJ@ -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@ -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 -DISTCLEANFILES = ffitarget.h -noinst_HEADERS = ffi_common.h ffi_cfi.h -EXTRA_DIST = ffi.h.in - -# Where generated headers like ffitarget.h get installed. -gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) -toollibffidir := $(libdir)/gcc/$(target_alias)/$(gcc_version)/include -toollibffi_HEADERS = ffi.h ffitarget.h -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign include/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -ffi.h: $(top_builddir)/config.status $(srcdir)/ffi.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-toollibffiHEADERS: $(toollibffi_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(toollibffidir)" || $(MKDIR_P) "$(DESTDIR)$(toollibffidir)" - @list='$(toollibffi_HEADERS)'; test -n "$(toollibffidir)" || 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)$(toollibffidir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(toollibffidir)" || exit $$?; \ - done - -uninstall-toollibffiHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(toollibffi_HEADERS)'; test -n "$(toollibffidir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(toollibffidir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(toollibffidir)" && 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 $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(toollibffidir)"; 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) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-toollibffiHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-toollibffiHEADERS - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool 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-pdf install-pdf-am install-ps \ - install-ps-am install-strip install-toollibffiHEADERS \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-toollibffiHEADERS - - -# 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/llgo/third_party/gofrontend/libffi/include/ffi.h.in b/llgo/third_party/gofrontend/libffi/include/ffi.h.in deleted file mode 100644 index c43d52fd51faf0e9c68805675d3846821109395e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/include/ffi.h.in +++ /dev/null @@ -1,503 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - libffi @VERSION@ - Copyright (c) 2011, 2014 Anthony Green - - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the ``Software''), to deal in the Software without - restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -/* ------------------------------------------------------------------- - The basic API is described in the README file. - - The raw API is designed to bypass some of the argument packing - and unpacking on architectures for which it can be avoided. - - The closure API allows interpreted functions to be packaged up - inside a C function pointer, so that they can be called as C functions, - with no understanding on the client side that they are interpreted. - It can also be used in other cases in which it is necessary to package - up a user specified parameter and a function pointer as a single - function pointer. - - The closure API must be implemented in order to get its functionality, - e.g. for use by gij. Routines are provided to emulate the raw API - if the underlying platform doesn't allow faster implementation. - - More details on the raw and cloure API can be found in: - - http://gcc.gnu.org/ml/java/1999-q3/msg00138.html - - and - - http://gcc.gnu.org/ml/java/1999-q3/msg00174.html - -------------------------------------------------------------------- */ - -#ifndef LIBFFI_H -#define LIBFFI_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* Specify which architecture libffi is configured for. */ -#ifndef @TARGET@ -#define @TARGET@ -#endif - -/* ---- System configuration information --------------------------------- */ - -#include - -#ifndef LIBFFI_ASM - -#if defined(_MSC_VER) && !defined(__clang__) -#define __attribute__(X) -#endif - -#include -#include - -/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). - But we can find it either under the correct ANSI name, or under GNU - C's internal name. */ - -#define FFI_64_BIT_MAX 9223372036854775807 - -#ifdef LONG_LONG_MAX -# define FFI_LONG_LONG_MAX LONG_LONG_MAX -#else -# ifdef LLONG_MAX -# define FFI_LONG_LONG_MAX LLONG_MAX -# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ -# undef FFI_64_BIT_MAX -# define FFI_64_BIT_MAX 9223372036854775807LL -# endif /* _AIX52 or newer */ -# else -# ifdef __GNUC__ -# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ -# endif -# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ -# ifndef __PPC64__ -# if defined (__IBMC__) || defined (__IBMCPP__) -# define FFI_LONG_LONG_MAX LONGLONG_MAX -# endif -# endif /* __PPC64__ */ -# undef FFI_64_BIT_MAX -# define FFI_64_BIT_MAX 9223372036854775807LL -# endif -# endif -#endif - -/* The closure code assumes that this works on pointers, i.e. a size_t */ -/* can hold a pointer. */ - -typedef struct _ffi_type -{ - size_t size; - unsigned short alignment; - unsigned short type; - struct _ffi_type **elements; -} ffi_type; - -#ifndef LIBFFI_HIDE_BASIC_TYPES -#if SCHAR_MAX == 127 -# define ffi_type_uchar ffi_type_uint8 -# define ffi_type_schar ffi_type_sint8 -#else - #error "char size not supported" -#endif - -#if SHRT_MAX == 32767 -# define ffi_type_ushort ffi_type_uint16 -# define ffi_type_sshort ffi_type_sint16 -#elif SHRT_MAX == 2147483647 -# define ffi_type_ushort ffi_type_uint32 -# define ffi_type_sshort ffi_type_sint32 -#else - #error "short size not supported" -#endif - -#if INT_MAX == 32767 -# define ffi_type_uint ffi_type_uint16 -# define ffi_type_sint ffi_type_sint16 -#elif INT_MAX == 2147483647 -# define ffi_type_uint ffi_type_uint32 -# define ffi_type_sint ffi_type_sint32 -#elif INT_MAX == 9223372036854775807 -# define ffi_type_uint ffi_type_uint64 -# define ffi_type_sint ffi_type_sint64 -#else - #error "int size not supported" -#endif - -#if LONG_MAX == 2147483647 -# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX - #error "no 64-bit data type supported" -# endif -#elif LONG_MAX != FFI_64_BIT_MAX - #error "long size not supported" -#endif - -#if LONG_MAX == 2147483647 -# define ffi_type_ulong ffi_type_uint32 -# define ffi_type_slong ffi_type_sint32 -#elif LONG_MAX == FFI_64_BIT_MAX -# define ffi_type_ulong ffi_type_uint64 -# define ffi_type_slong ffi_type_sint64 -#else - #error "long size not supported" -#endif - -/* Need minimal decorations for DLLs to works on Windows. */ -/* GCC has autoimport and autoexport. Rely on Libtool to */ -/* help MSVC export from a DLL, but always declare data */ -/* to be imported for MSVC clients. This costs an extra */ -/* indirection for MSVC clients using the static version */ -/* of the library, but don't worry about that. Besides, */ -/* as a workaround, they can define FFI_BUILDING if they */ -/* *know* they are going to link with the static library. */ -#if defined _MSC_VER && !defined FFI_BUILDING -#define FFI_EXTERN extern __declspec(dllimport) -#else -#define FFI_EXTERN extern -#endif - -/* These are defined in types.c */ -FFI_EXTERN ffi_type ffi_type_void; -FFI_EXTERN ffi_type ffi_type_uint8; -FFI_EXTERN ffi_type ffi_type_sint8; -FFI_EXTERN ffi_type ffi_type_uint16; -FFI_EXTERN ffi_type ffi_type_sint16; -FFI_EXTERN ffi_type ffi_type_uint32; -FFI_EXTERN ffi_type ffi_type_sint32; -FFI_EXTERN ffi_type ffi_type_uint64; -FFI_EXTERN ffi_type ffi_type_sint64; -FFI_EXTERN ffi_type ffi_type_float; -FFI_EXTERN ffi_type ffi_type_double; -FFI_EXTERN ffi_type ffi_type_pointer; - -#if @HAVE_LONG_DOUBLE@ -FFI_EXTERN ffi_type ffi_type_longdouble; -#else -#define ffi_type_longdouble ffi_type_double -#endif - -#ifdef FFI_TARGET_HAS_COMPLEX_TYPE -FFI_EXTERN ffi_type ffi_type_complex_float; -FFI_EXTERN ffi_type ffi_type_complex_double; -#if @HAVE_LONG_DOUBLE@ -FFI_EXTERN ffi_type ffi_type_complex_longdouble; -#else -#define ffi_type_complex_longdouble ffi_type_complex_double -#endif -#endif -#endif /* LIBFFI_HIDE_BASIC_TYPES */ - -typedef enum { - FFI_OK = 0, - FFI_BAD_TYPEDEF, - FFI_BAD_ABI -} ffi_status; - -typedef unsigned FFI_TYPE; - -typedef struct { - ffi_abi abi; - unsigned nargs; - ffi_type **arg_types; - ffi_type *rtype; - unsigned bytes; - unsigned flags; -#ifdef FFI_EXTRA_CIF_FIELDS - FFI_EXTRA_CIF_FIELDS; -#endif -} ffi_cif; - -#if @HAVE_LONG_DOUBLE_VARIANT@ -/* Used to adjust size/alignment of ffi types. */ -void ffi_prep_types (ffi_abi abi); -#endif - -/* Used internally, but overridden by some architectures */ -ffi_status ffi_prep_cif_core(ffi_cif *cif, - ffi_abi abi, - unsigned int isvariadic, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - -/* ---- Definitions for the raw API -------------------------------------- */ - -#ifndef FFI_SIZEOF_ARG -# if LONG_MAX == 2147483647 -# define FFI_SIZEOF_ARG 4 -# elif LONG_MAX == FFI_64_BIT_MAX -# define FFI_SIZEOF_ARG 8 -# endif -#endif - -#ifndef FFI_SIZEOF_JAVA_RAW -# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG -#endif - -typedef union { - ffi_sarg sint; - ffi_arg uint; - float flt; - char data[FFI_SIZEOF_ARG]; - void* ptr; -} ffi_raw; - -#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 -/* This is a special case for mips64/n32 ABI (and perhaps others) where - sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ -typedef union { - signed int sint; - unsigned int uint; - float flt; - char data[FFI_SIZEOF_JAVA_RAW]; - void* ptr; -} ffi_java_raw; -#else -typedef ffi_raw ffi_java_raw; -#endif - - -void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - -void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -size_t ffi_raw_size (ffi_cif *cif); - -/* This is analogous to the raw API, except it uses Java parameter */ -/* packing, even on 64-bit machines. I.e. on 64-bit machines */ -/* longs and doubles are followed by an empty 64-bit word. */ - -void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - -void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -size_t ffi_java_raw_size (ffi_cif *cif); - -/* ---- Definitions for closures ----------------------------------------- */ - -#if FFI_CLOSURES - -#ifdef _MSC_VER -__declspec(align(8)) -#endif -typedef struct { -#if @FFI_EXEC_TRAMPOLINE_TABLE@ - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - ffi_cif *cif; - void (*fun)(ffi_cif*,void*,void**,void*); - void *user_data; -#ifdef __GNUC__ -} ffi_closure __attribute__((aligned (8))); -#else -} ffi_closure; -# ifdef __sgi -# pragma pack 0 -# endif -#endif - -void *ffi_closure_alloc (size_t size, void **code); -void ffi_closure_free (void *); - -ffi_status -ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data); - -ffi_status -ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void*codeloc); - -#ifdef __sgi -# pragma pack 8 -#endif -typedef struct { -#if @FFI_EXEC_TRAMPOLINE_TABLE@ - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_raw*,void*); - void *user_data; - -} ffi_raw_closure; - -typedef struct { -#if @FFI_EXEC_TRAMPOLINE_TABLE@ - void *trampoline_table; - void *trampoline_table_entry; -#else - char tramp[FFI_TRAMPOLINE_SIZE]; -#endif - - ffi_cif *cif; - -#if !FFI_NATIVE_RAW_API - - /* if this is enabled, then a raw closure has the same layout - as a regular closure. We use this to install an intermediate - handler to do the transaltion, void** -> ffi_raw*. */ - - void (*translate_args)(ffi_cif*,void*,void**,void*); - void *this_closure; - -#endif - - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); - void *user_data; - -} ffi_java_raw_closure; - -ffi_status -ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - -ffi_status -ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - -ffi_status -ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data, - void *codeloc); - -#endif /* FFI_CLOSURES */ - -#if FFI_GO_CLOSURES - -typedef struct { - void *tramp; - ffi_cif *cif; - void (*fun)(ffi_cif*,void*,void**,void*); -} ffi_go_closure; - -ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*)); - -void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure); - -#endif /* FFI_GO_CLOSURES */ - -/* ---- Public interface definition -------------------------------------- */ - -ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - -ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); - -/* Useful for eliminating compiler warnings */ -#define FFI_FN(f) ((void (*)(void))f) - -/* ---- Definitions shared with assembly code ---------------------------- */ - -#endif - -/* If these change, update src/mips/ffitarget.h. */ -#define FFI_TYPE_VOID 0 -#define FFI_TYPE_INT 1 -#define FFI_TYPE_FLOAT 2 -#define FFI_TYPE_DOUBLE 3 -#if @HAVE_LONG_DOUBLE@ -#define FFI_TYPE_LONGDOUBLE 4 -#else -#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE -#endif -#define FFI_TYPE_UINT8 5 -#define FFI_TYPE_SINT8 6 -#define FFI_TYPE_UINT16 7 -#define FFI_TYPE_SINT16 8 -#define FFI_TYPE_UINT32 9 -#define FFI_TYPE_SINT32 10 -#define FFI_TYPE_UINT64 11 -#define FFI_TYPE_SINT64 12 -#define FFI_TYPE_STRUCT 13 -#define FFI_TYPE_POINTER 14 -#define FFI_TYPE_COMPLEX 15 - -/* This should always refer to the last type code (for sanity checks) */ -#define FFI_TYPE_LAST FFI_TYPE_COMPLEX - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/llgo/third_party/gofrontend/libffi/include/ffi_cfi.h b/llgo/third_party/gofrontend/libffi/include/ffi_cfi.h deleted file mode 100644 index 244ce572be740e79b87d98229ef85d9c643cd3e5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/include/ffi_cfi.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_cfi.h - Copyright (c) 2014 Red Hat, Inc. - - Conditionally assemble cfi directives. Only necessary for building libffi. - ----------------------------------------------------------------------- */ - -#ifndef FFI_CFI_H -#define FFI_CFI_H - -#ifdef HAVE_AS_CFI_PSEUDO_OP - -# define cfi_startproc .cfi_startproc -# define cfi_endproc .cfi_endproc -# define cfi_def_cfa(reg, off) .cfi_def_cfa reg, off -# define cfi_def_cfa_register(reg) .cfi_def_cfa_register reg -# define cfi_def_cfa_offset(off) .cfi_def_cfa_offset off -# define cfi_adjust_cfa_offset(off) .cfi_adjust_cfa_offset off -# define cfi_offset(reg, off) .cfi_offset reg, off -# define cfi_rel_offset(reg, off) .cfi_rel_offset reg, off -# define cfi_register(r1, r2) .cfi_register r1, r2 -# define cfi_return_column(reg) .cfi_return_column reg -# define cfi_restore(reg) .cfi_restore reg -# define cfi_same_value(reg) .cfi_same_value reg -# define cfi_undefined(reg) .cfi_undefined reg -# define cfi_remember_state .cfi_remember_state -# define cfi_restore_state .cfi_restore_state -# define cfi_window_save .cfi_window_save -# define cfi_personality(enc, exp) .cfi_personality enc, exp -# define cfi_lsda(enc, exp) .cfi_lsda enc, exp -# define cfi_escape(...) .cfi_escape __VA_ARGS__ - -#else - -# define cfi_startproc -# define cfi_endproc -# define cfi_def_cfa(reg, off) -# define cfi_def_cfa_register(reg) -# define cfi_def_cfa_offset(off) -# define cfi_adjust_cfa_offset(off) -# define cfi_offset(reg, off) -# define cfi_rel_offset(reg, off) -# define cfi_register(r1, r2) -# define cfi_return_column(reg) -# define cfi_restore(reg) -# define cfi_same_value(reg) -# define cfi_undefined(reg) -# define cfi_remember_state -# define cfi_restore_state -# define cfi_window_save -# define cfi_personality(enc, exp) -# define cfi_lsda(enc, exp) -# define cfi_escape(...) - -#endif /* HAVE_AS_CFI_PSEUDO_OP */ -#endif /* FFI_CFI_H */ diff --git a/llgo/third_party/gofrontend/libffi/include/ffi_common.h b/llgo/third_party/gofrontend/libffi/include/ffi_common.h deleted file mode 100644 index 37f5a9e92494d555530aed7cc9381806d3b2e0f8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/include/ffi_common.h +++ /dev/null @@ -1,132 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_common.h - Copyright (C) 2011, 2012, 2013 Anthony Green - Copyright (C) 2007 Free Software Foundation, Inc - Copyright (c) 1996 Red Hat, Inc. - - Common internal definitions and macros. Only necessary for building - libffi. - ----------------------------------------------------------------------- */ - -#ifndef FFI_COMMON_H -#define FFI_COMMON_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Do not move this. Some versions of AIX are very picky about where - this is positioned. */ -#ifdef __GNUC__ -# if HAVE_ALLOCA_H -# include -# else - /* mingw64 defines this already in malloc.h. */ -# ifndef alloca -# define alloca __builtin_alloca -# endif -# endif -# define MAYBE_UNUSED __attribute__((__unused__)) -#else -# define MAYBE_UNUSED -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX -# pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -# ifdef _MSC_VER -# define alloca _alloca -# else -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -/* Check for the existence of memcpy. */ -#if STDC_HEADERS -# include -#else -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# endif -#endif - -#if defined(FFI_DEBUG) -#include -#endif - -#ifdef FFI_DEBUG -void ffi_assert(char *expr, char *file, int line); -void ffi_stop_here(void); -void ffi_type_test(ffi_type *a, char *file, int line); - -#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) -#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) -#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) -#else -#define FFI_ASSERT(x) -#define FFI_ASSERT_AT(x, f, l) -#define FFI_ASSERT_VALID_TYPE(x) -#endif - -#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) -#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif); -ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, - unsigned int nfixedargs, unsigned int ntotalargs); - -/* Extended cif, used in callback from assembly routine */ -typedef struct -{ - ffi_cif *cif; - void *rvalue; - void **avalue; -} extended_cif; - -/* Terse sized type definitions. */ -#if defined(_MSC_VER) || defined(__sgi) || defined(__SUNPRO_C) -typedef unsigned char UINT8; -typedef signed char SINT8; -typedef unsigned short UINT16; -typedef signed short SINT16; -typedef unsigned int UINT32; -typedef signed int SINT32; -# ifdef _MSC_VER -typedef unsigned __int64 UINT64; -typedef signed __int64 SINT64; -# else -# include -typedef uint64_t UINT64; -typedef int64_t SINT64; -# endif -#else -typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); -typedef signed int SINT8 __attribute__((__mode__(__QI__))); -typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); -typedef signed int SINT16 __attribute__((__mode__(__HI__))); -typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); -typedef signed int SINT32 __attribute__((__mode__(__SI__))); -typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); -typedef signed int SINT64 __attribute__((__mode__(__DI__))); -#endif - -typedef float FLOAT32; - -#ifndef __GNUC__ -#define __builtin_expect(x, expected_value) (x) -#endif -#define LIKELY(x) __builtin_expect(!!(x),1) -#define UNLIKELY(x) __builtin_expect((x)!=0,0) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/llgo/third_party/gofrontend/libffi/libffi.pc.in b/llgo/third_party/gofrontend/libffi/libffi.pc.in deleted file mode 100644 index edf6fde5e2be6d624a78f40b8b29b26cdbf475f8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/libffi.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -toolexeclibdir=@toolexeclibdir@ -includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include - -Name: @PACKAGE_NAME@ -Description: Library supporting Foreign Function Interfaces -Version: @PACKAGE_VERSION@ -Libs: -L${toolexeclibdir} -lffi -Cflags: -I${includedir} diff --git a/llgo/third_party/gofrontend/libffi/libffi.xcodeproj/project.pbxproj b/llgo/third_party/gofrontend/libffi/libffi.xcodeproj/project.pbxproj deleted file mode 100644 index 1cf396ffa1e42bfdf0c55d9d20f4c29a68f03490..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/libffi.xcodeproj/project.pbxproj +++ /dev/null @@ -1,637 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - DBFA714A187F1D8600A76262 /* ffi.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713E187F1D8600A76262 /* ffi.h */; }; - DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA713F187F1D8600A76262 /* ffi_common.h */; }; - DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7140187F1D8600A76262 /* fficonfig.h */; }; - DBFA714D187F1D8600A76262 /* ffitarget.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7141187F1D8600A76262 /* ffitarget.h */; }; - DBFA714E187F1D8600A76262 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7143187F1D8600A76262 /* closures.c */; }; - DBFA714F187F1D8600A76262 /* closures.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7143187F1D8600A76262 /* closures.c */; }; - DBFA7156187F1D8600A76262 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7147187F1D8600A76262 /* prep_cif.c */; }; - DBFA7157187F1D8600A76262 /* prep_cif.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7147187F1D8600A76262 /* prep_cif.c */; }; - DBFA7158187F1D8600A76262 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7148187F1D8600A76262 /* raw_api.c */; }; - DBFA7159187F1D8600A76262 /* raw_api.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7148187F1D8600A76262 /* raw_api.c */; }; - DBFA715A187F1D8600A76262 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7149187F1D8600A76262 /* types.c */; }; - DBFA715B187F1D8600A76262 /* types.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7149187F1D8600A76262 /* types.c */; }; - DBFA7177187F1D9B00A76262 /* ffi_arm64.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA716C187F1D9B00A76262 /* ffi_arm64.c */; }; - DBFA7178187F1D9B00A76262 /* sysv_arm64.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA716D187F1D9B00A76262 /* sysv_arm64.S */; }; - DBFA7179187F1D9B00A76262 /* ffi_armv7.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA716F187F1D9B00A76262 /* ffi_armv7.c */; }; - DBFA717A187F1D9B00A76262 /* sysv_armv7.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7170187F1D9B00A76262 /* sysv_armv7.S */; }; - DBFA717B187F1D9B00A76262 /* trampoline_armv7.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7171187F1D9B00A76262 /* trampoline_armv7.S */; }; - DBFA717C187F1D9B00A76262 /* darwin64_x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7173187F1D9B00A76262 /* darwin64_x86_64.S */; }; - DBFA717D187F1D9B00A76262 /* darwin_i386.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7174187F1D9B00A76262 /* darwin_i386.S */; }; - DBFA717E187F1D9B00A76262 /* ffi64_x86_64.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7175187F1D9B00A76262 /* ffi64_x86_64.c */; }; - DBFA717F187F1D9B00A76262 /* ffi_i386.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA7176187F1D9B00A76262 /* ffi_i386.c */; }; - DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7182187F1DA100A76262 /* ffi_i386.h */; }; - DBFA718F187F1DA100A76262 /* ffi_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7183187F1DA100A76262 /* ffi_x86_64.h */; }; - DBFA7190187F1DA100A76262 /* fficonfig_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7184187F1DA100A76262 /* fficonfig_i386.h */; }; - DBFA7191187F1DA100A76262 /* fficonfig_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7185187F1DA100A76262 /* fficonfig_x86_64.h */; }; - DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7186187F1DA100A76262 /* ffitarget_i386.h */; }; - DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFA7187187F1DA100A76262 /* ffitarget_x86_64.h */; }; - DBFA7194187F1DA100A76262 /* darwin64_x86_64.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718A187F1DA100A76262 /* darwin64_x86_64.S */; }; - DBFA7195187F1DA100A76262 /* darwin_i386.S in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718B187F1DA100A76262 /* darwin_i386.S */; }; - DBFA7196187F1DA100A76262 /* ffi64_x86_64.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718C187F1DA100A76262 /* ffi64_x86_64.c */; }; - DBFA7197187F1DA100A76262 /* ffi_i386.c in Sources */ = {isa = PBXBuildFile; fileRef = DBFA718D187F1DA100A76262 /* ffi_i386.c */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - DB13B1641849DF1E0010F42D /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 8; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - DB13B1661849DF1E0010F42D /* libffi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libffi.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DB13B1911849DF510010F42D /* ffi.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = ffi.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - DBFA713E187F1D8600A76262 /* ffi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi.h; sourceTree = ""; }; - DBFA713F187F1D8600A76262 /* ffi_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_common.h; sourceTree = ""; }; - DBFA7140187F1D8600A76262 /* fficonfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig.h; sourceTree = ""; }; - DBFA7141187F1D8600A76262 /* ffitarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget.h; sourceTree = ""; }; - DBFA7143187F1D8600A76262 /* closures.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = closures.c; sourceTree = ""; }; - DBFA7145187F1D8600A76262 /* dlmalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dlmalloc.c; sourceTree = ""; }; - DBFA7147187F1D8600A76262 /* prep_cif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prep_cif.c; sourceTree = ""; }; - DBFA7148187F1D8600A76262 /* raw_api.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raw_api.c; sourceTree = ""; }; - DBFA7149187F1D8600A76262 /* types.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = types.c; sourceTree = ""; }; - DBFA715E187F1D9B00A76262 /* ffi_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_arm64.h; sourceTree = ""; }; - DBFA715F187F1D9B00A76262 /* ffi_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_armv7.h; sourceTree = ""; }; - DBFA7160187F1D9B00A76262 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; - DBFA7161187F1D9B00A76262 /* ffi_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = ""; }; - DBFA7162187F1D9B00A76262 /* fficonfig_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_arm64.h; sourceTree = ""; }; - DBFA7163187F1D9B00A76262 /* fficonfig_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_armv7.h; sourceTree = ""; }; - DBFA7164187F1D9B00A76262 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; - DBFA7165187F1D9B00A76262 /* fficonfig_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_x86_64.h; sourceTree = ""; }; - DBFA7166187F1D9B00A76262 /* ffitarget_arm64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_arm64.h; sourceTree = ""; }; - DBFA7167187F1D9B00A76262 /* ffitarget_armv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_armv7.h; sourceTree = ""; }; - DBFA7168187F1D9B00A76262 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; - DBFA7169187F1D9B00A76262 /* ffitarget_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = ""; }; - DBFA716C187F1D9B00A76262 /* ffi_arm64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi_arm64.c; sourceTree = ""; }; - DBFA716D187F1D9B00A76262 /* sysv_arm64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sysv_arm64.S; sourceTree = ""; }; - DBFA716F187F1D9B00A76262 /* ffi_armv7.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi_armv7.c; sourceTree = ""; }; - DBFA7170187F1D9B00A76262 /* sysv_armv7.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = sysv_armv7.S; sourceTree = ""; }; - DBFA7171187F1D9B00A76262 /* trampoline_armv7.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = trampoline_armv7.S; sourceTree = ""; }; - DBFA7173187F1D9B00A76262 /* darwin64_x86_64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64_x86_64.S; sourceTree = ""; }; - DBFA7174187F1D9B00A76262 /* darwin_i386.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin_i386.S; sourceTree = ""; }; - DBFA7175187F1D9B00A76262 /* ffi64_x86_64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64_x86_64.c; sourceTree = ""; }; - DBFA7176187F1D9B00A76262 /* ffi_i386.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi_i386.c; sourceTree = ""; }; - DBFA7182187F1DA100A76262 /* ffi_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_i386.h; sourceTree = ""; }; - DBFA7183187F1DA100A76262 /* ffi_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffi_x86_64.h; sourceTree = ""; }; - DBFA7184187F1DA100A76262 /* fficonfig_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_i386.h; sourceTree = ""; }; - DBFA7185187F1DA100A76262 /* fficonfig_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fficonfig_x86_64.h; sourceTree = ""; }; - DBFA7186187F1DA100A76262 /* ffitarget_i386.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_i386.h; sourceTree = ""; }; - DBFA7187187F1DA100A76262 /* ffitarget_x86_64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ffitarget_x86_64.h; sourceTree = ""; }; - DBFA718A187F1DA100A76262 /* darwin64_x86_64.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin64_x86_64.S; sourceTree = ""; }; - DBFA718B187F1DA100A76262 /* darwin_i386.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = darwin_i386.S; sourceTree = ""; }; - DBFA718C187F1DA100A76262 /* ffi64_x86_64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi64_x86_64.c; sourceTree = ""; }; - DBFA718D187F1DA100A76262 /* ffi_i386.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ffi_i386.c; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - DB13B15B1849DEB70010F42D = { - isa = PBXGroup; - children = ( - DBFA713C187F1D8600A76262 /* darwin_common */, - DBFA715C187F1D9B00A76262 /* darwin_ios */, - DBFA7180187F1DA100A76262 /* darwin_osx */, - DB13B1671849DF1E0010F42D /* Products */, - ); - sourceTree = ""; - }; - DB13B1671849DF1E0010F42D /* Products */ = { - isa = PBXGroup; - children = ( - DB13B1661849DF1E0010F42D /* libffi.a */, - DB13B1911849DF510010F42D /* ffi.dylib */, - ); - name = Products; - sourceTree = ""; - }; - DBFA713C187F1D8600A76262 /* darwin_common */ = { - isa = PBXGroup; - children = ( - DBFA713D187F1D8600A76262 /* include */, - DBFA7142187F1D8600A76262 /* src */, - ); - path = "darwin_common"; - sourceTree = ""; - }; - DBFA713D187F1D8600A76262 /* include */ = { - isa = PBXGroup; - children = ( - DBFA713E187F1D8600A76262 /* ffi.h */, - DBFA713F187F1D8600A76262 /* ffi_common.h */, - DBFA7140187F1D8600A76262 /* fficonfig.h */, - DBFA7141187F1D8600A76262 /* ffitarget.h */, - ); - path = include; - sourceTree = ""; - }; - DBFA7142187F1D8600A76262 /* src */ = { - isa = PBXGroup; - children = ( - DBFA7143187F1D8600A76262 /* closures.c */, - DBFA7145187F1D8600A76262 /* dlmalloc.c */, - DBFA7147187F1D8600A76262 /* prep_cif.c */, - DBFA7148187F1D8600A76262 /* raw_api.c */, - DBFA7149187F1D8600A76262 /* types.c */, - ); - path = src; - sourceTree = ""; - }; - DBFA715C187F1D9B00A76262 /* darwin_ios */ = { - isa = PBXGroup; - children = ( - DBFA715D187F1D9B00A76262 /* include */, - DBFA716A187F1D9B00A76262 /* src */, - ); - path = "darwin_ios"; - sourceTree = ""; - }; - DBFA715D187F1D9B00A76262 /* include */ = { - isa = PBXGroup; - children = ( - DBFA715E187F1D9B00A76262 /* ffi_arm64.h */, - DBFA715F187F1D9B00A76262 /* ffi_armv7.h */, - DBFA7160187F1D9B00A76262 /* ffi_i386.h */, - DBFA7161187F1D9B00A76262 /* ffi_x86_64.h */, - DBFA7162187F1D9B00A76262 /* fficonfig_arm64.h */, - DBFA7163187F1D9B00A76262 /* fficonfig_armv7.h */, - DBFA7164187F1D9B00A76262 /* fficonfig_i386.h */, - DBFA7165187F1D9B00A76262 /* fficonfig_x86_64.h */, - DBFA7166187F1D9B00A76262 /* ffitarget_arm64.h */, - DBFA7167187F1D9B00A76262 /* ffitarget_armv7.h */, - DBFA7168187F1D9B00A76262 /* ffitarget_i386.h */, - DBFA7169187F1D9B00A76262 /* ffitarget_x86_64.h */, - ); - path = include; - sourceTree = ""; - }; - DBFA716A187F1D9B00A76262 /* src */ = { - isa = PBXGroup; - children = ( - DBFA716B187F1D9B00A76262 /* aarch64 */, - DBFA716E187F1D9B00A76262 /* arm */, - DBFA7172187F1D9B00A76262 /* x86 */, - ); - path = src; - sourceTree = ""; - }; - DBFA716B187F1D9B00A76262 /* aarch64 */ = { - isa = PBXGroup; - children = ( - DBFA716C187F1D9B00A76262 /* ffi_arm64.c */, - DBFA716D187F1D9B00A76262 /* sysv_arm64.S */, - ); - path = aarch64; - sourceTree = ""; - }; - DBFA716E187F1D9B00A76262 /* arm */ = { - isa = PBXGroup; - children = ( - DBFA716F187F1D9B00A76262 /* ffi_armv7.c */, - DBFA7170187F1D9B00A76262 /* sysv_armv7.S */, - DBFA7171187F1D9B00A76262 /* trampoline_armv7.S */, - ); - path = arm; - sourceTree = ""; - }; - DBFA7172187F1D9B00A76262 /* x86 */ = { - isa = PBXGroup; - children = ( - DBFA7173187F1D9B00A76262 /* darwin64_x86_64.S */, - DBFA7174187F1D9B00A76262 /* darwin_i386.S */, - DBFA7175187F1D9B00A76262 /* ffi64_x86_64.c */, - DBFA7176187F1D9B00A76262 /* ffi_i386.c */, - ); - path = x86; - sourceTree = ""; - }; - DBFA7180187F1DA100A76262 /* darwin_osx */ = { - isa = PBXGroup; - children = ( - DBFA7181187F1DA100A76262 /* include */, - DBFA7188187F1DA100A76262 /* src */, - ); - path = "darwin_osx"; - sourceTree = ""; - }; - DBFA7181187F1DA100A76262 /* include */ = { - isa = PBXGroup; - children = ( - DBFA7182187F1DA100A76262 /* ffi_i386.h */, - DBFA7183187F1DA100A76262 /* ffi_x86_64.h */, - DBFA7184187F1DA100A76262 /* fficonfig_i386.h */, - DBFA7185187F1DA100A76262 /* fficonfig_x86_64.h */, - DBFA7186187F1DA100A76262 /* ffitarget_i386.h */, - DBFA7187187F1DA100A76262 /* ffitarget_x86_64.h */, - ); - path = include; - sourceTree = ""; - }; - DBFA7188187F1DA100A76262 /* src */ = { - isa = PBXGroup; - children = ( - DBFA7189187F1DA100A76262 /* x86 */, - ); - path = src; - sourceTree = ""; - }; - DBFA7189187F1DA100A76262 /* x86 */ = { - isa = PBXGroup; - children = ( - DBFA718A187F1DA100A76262 /* darwin64_x86_64.S */, - DBFA718B187F1DA100A76262 /* darwin_i386.S */, - DBFA718C187F1DA100A76262 /* ffi64_x86_64.c */, - DBFA718D187F1DA100A76262 /* ffi_i386.c */, - ); - path = x86; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - DB13B18F1849DF510010F42D /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DBFA714C187F1D8600A76262 /* fficonfig.h in Headers */, - DBFA714D187F1D8600A76262 /* ffitarget.h in Headers */, - DBFA714A187F1D8600A76262 /* ffi.h in Headers */, - DBFA718F187F1DA100A76262 /* ffi_x86_64.h in Headers */, - DBFA7191187F1DA100A76262 /* fficonfig_x86_64.h in Headers */, - DBFA718E187F1DA100A76262 /* ffi_i386.h in Headers */, - DBFA7190187F1DA100A76262 /* fficonfig_i386.h in Headers */, - DBFA714B187F1D8600A76262 /* ffi_common.h in Headers */, - DBFA7193187F1DA100A76262 /* ffitarget_x86_64.h in Headers */, - DBFA7192187F1DA100A76262 /* ffitarget_i386.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - DB13B1651849DF1E0010F42D /* libffi-iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB13B18B1849DF1E0010F42D /* Build configuration list for PBXNativeTarget "libffi-iOS" */; - buildPhases = ( - DB13B3051849E01C0010F42D /* ShellScript */, - DB13B1621849DF1E0010F42D /* Sources */, - DB13B1641849DF1E0010F42D /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "libffi-iOS"; - productName = ffi; - productReference = DB13B1661849DF1E0010F42D /* libffi.a */; - productType = "com.apple.product-type.library.static"; - }; - DB13B1901849DF510010F42D /* libffi-Mac */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB13B1B01849DF520010F42D /* Build configuration list for PBXNativeTarget "libffi-Mac" */; - buildPhases = ( - DB13B3061849E0490010F42D /* ShellScript */, - DB13B18D1849DF510010F42D /* Sources */, - DB13B18F1849DF510010F42D /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "libffi-Mac"; - productName = ffi; - productReference = DB13B1911849DF510010F42D /* ffi.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - DB13B15C1849DEB70010F42D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0510; - }; - buildConfigurationList = DB13B15F1849DEB70010F42D /* Build configuration list for PBXProject "libffi" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = DB13B15B1849DEB70010F42D; - productRefGroup = DB13B1671849DF1E0010F42D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - DB13B1651849DF1E0010F42D /* libffi-iOS */, - DB13B1901849DF510010F42D /* libffi-Mac */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXShellScriptBuildPhase section */ - DB13B3051849E01C0010F42D /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/bin/python generate-darwin-source-and-headers.py --only-ios"; - }; - DB13B3061849E0490010F42D /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/usr/bin/python generate-darwin-source-and-headers.py --only-osx"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - DB13B1621849DF1E0010F42D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DBFA717E187F1D9B00A76262 /* ffi64_x86_64.c in Sources */, - DBFA7179187F1D9B00A76262 /* ffi_armv7.c in Sources */, - DBFA717B187F1D9B00A76262 /* trampoline_armv7.S in Sources */, - DBFA714E187F1D8600A76262 /* closures.c in Sources */, - DBFA717A187F1D9B00A76262 /* sysv_armv7.S in Sources */, - DBFA717D187F1D9B00A76262 /* darwin_i386.S in Sources */, - DBFA7156187F1D8600A76262 /* prep_cif.c in Sources */, - DBFA717F187F1D9B00A76262 /* ffi_i386.c in Sources */, - DBFA7158187F1D8600A76262 /* raw_api.c in Sources */, - DBFA7178187F1D9B00A76262 /* sysv_arm64.S in Sources */, - DBFA717C187F1D9B00A76262 /* darwin64_x86_64.S in Sources */, - DBFA715A187F1D8600A76262 /* types.c in Sources */, - DBFA7177187F1D9B00A76262 /* ffi_arm64.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB13B18D1849DF510010F42D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DBFA7196187F1DA100A76262 /* ffi64_x86_64.c in Sources */, - DBFA7195187F1DA100A76262 /* darwin_i386.S in Sources */, - DBFA7157187F1D8600A76262 /* prep_cif.c in Sources */, - DBFA7197187F1DA100A76262 /* ffi_i386.c in Sources */, - DBFA715B187F1D8600A76262 /* types.c in Sources */, - DBFA7159187F1D8600A76262 /* raw_api.c in Sources */, - DBFA714F187F1D8600A76262 /* closures.c in Sources */, - DBFA7194187F1DA100A76262 /* darwin64_x86_64.S in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - DB13B1601849DEB70010F42D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_common/include", - ); - ONLY_ACTIVE_ARCH = YES; - }; - name = Debug; - }; - DB13B1611849DEB70010F42D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_common/include", - ); - }; - name = Release; - }; - DB13B1871849DF1E0010F42D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DSTROOT = /tmp/ffi.dst; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_ios/include", - ); - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - "IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 7.0; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = ffi; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - DB13B1881849DF1E0010F42D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DSTROOT = /tmp/ffi.dst; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_ios/include", - ); - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - "IPHONEOS_DEPLOYMENT_TARGET[arch=arm64]" = 7.0; - OTHER_LDFLAGS = "-ObjC"; - PRODUCT_NAME = ffi; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - DB13B1B11849DF520010F42D /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_osx/include", - ); - MACOSX_DEPLOYMENT_TARGET = 10.6; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = "-Wl,-no_compact_unwind"; - PRODUCT_NAME = ffi; - SDKROOT = macosx; - }; - name = Debug; - }; - DB13B1B21849DF520010F42D /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "darwin_osx/include", - ); - MACOSX_DEPLOYMENT_TARGET = 10.6; - OTHER_LDFLAGS = "-Wl,-no_compact_unwind"; - PRODUCT_NAME = ffi; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - DB13B15F1849DEB70010F42D /* Build configuration list for PBXProject "libffi" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB13B1601849DEB70010F42D /* Debug */, - DB13B1611849DEB70010F42D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DB13B18B1849DF1E0010F42D /* Build configuration list for PBXNativeTarget "libffi-iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB13B1871849DF1E0010F42D /* Debug */, - DB13B1881849DF1E0010F42D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DB13B1B01849DF520010F42D /* Build configuration list for PBXNativeTarget "libffi-Mac" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB13B1B11849DF520010F42D /* Debug */, - DB13B1B21849DF520010F42D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = DB13B15C1849DEB70010F42D /* Project object */; -} diff --git a/llgo/third_party/gofrontend/libffi/libtool-version b/llgo/third_party/gofrontend/libffi/libtool-version deleted file mode 100644 index 67532867c7764d7ecefbfe96b2d7336c3fb757a9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/libtool-version +++ /dev/null @@ -1,6 +0,0 @@ -# This file is used to maintain libtool version info for libffi. See -# the libtool manual to understand the meaning of the fields. This is -# a separate file so that version updates don't involve re-running -# automake. -# CURRENT:REVISION:AGE -4:1:0 diff --git a/llgo/third_party/gofrontend/libffi/man/Makefile.am b/llgo/third_party/gofrontend/libffi/man/Makefile.am deleted file mode 100644 index afcbfb69f1d3de0cce6c171f357c5927972db76b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -## Process this with automake to create Makefile.in - -AUTOMAKE_OPTIONS=foreign - -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 - -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 - diff --git a/llgo/third_party/gofrontend/libffi/man/Makefile.in b/llgo/third_party/gofrontend/libffi/man/Makefile.in deleted file mode 100644 index 39f6cbf89f735aa109c5cb0e96bfdb608bf66e7b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/Makefile.in +++ /dev/null @@ -1,420 +0,0 @@ -# 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@ -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 = man -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ - $(top_srcdir)/../config/asmcfi.m4 \ - $(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)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fficonfig.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -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' -man3dir = $(mandir)/man3 -am__installdirs = "$(DESTDIR)$(man3dir)" -NROFF = nroff -MANS = $(man_MANS) -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_LTLDFLAGS = @AM_LTLDFLAGS@ -AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -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@ -FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ -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@ -TARGET = @TARGET@ -TARGETDIR = @TARGETDIR@ -TARGET_OBJ = @TARGET_OBJ@ -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@ -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 -EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 -man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3 -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign man/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man3: $(man_MANS) - @$(NORMAL_INSTALL) - test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" - @list=''; test -n "$(man3dir)" || exit 0; \ - { for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ - done; } - -uninstall-man3: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man3dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.3[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - test -z "$$files" || { \ - echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - -check-am: all-am -check: check-am -all-am: Makefile $(MANS) -installdirs: - for dir in "$(DESTDIR)$(man3dir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-man - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man3 - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-man - -uninstall-man: uninstall-man3 - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool 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-man3 install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-man uninstall-man3 - - -# 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/llgo/third_party/gofrontend/libffi/man/ffi.3 b/llgo/third_party/gofrontend/libffi/man/ffi.3 deleted file mode 100644 index 1f1d3031c99772fb01aa08c126ea0e654aef5e2b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/ffi.3 +++ /dev/null @@ -1,41 +0,0 @@ -.Dd February 15, 2008 -.Dt FFI 3 -.Sh NAME -.Nm FFI -.Nd Foreign Function Interface -.Sh LIBRARY -libffi, -lffi -.Sh SYNOPSIS -.In ffi.h -.Ft ffi_status -.Fo ffi_prep_cif -.Fa "ffi_cif *cif" -.Fa "ffi_abi abi" -.Fa "unsigned int nargs" -.Fa "ffi_type *rtype" -.Fa "ffi_type **atypes" -.Fc -.Ft void -.Fo ffi_prep_cif_var -.Fa "ffi_cif *cif" -.Fa "ffi_abi abi" -.Fa "unsigned int nfixedargs" -.Fa "unsigned int ntotalargs" -.Fa "ffi_type *rtype" -.Fa "ffi_type **atypes" -.Fc -.Ft void -.Fo ffi_call -.Fa "ffi_cif *cif" -.Fa "void (*fn)(void)" -.Fa "void *rvalue" -.Fa "void **avalue" -.Fc -.Sh DESCRIPTION -The foreign function interface provides a mechanism by which a function can -generate a call to another function at runtime without requiring knowledge of -the called function's interface at compile time. -.Sh SEE ALSO -.Xr ffi_prep_cif 3 , -.Xr ffi_prep_cif_var 3 , -.Xr ffi_call 3 diff --git a/llgo/third_party/gofrontend/libffi/man/ffi_call.3 b/llgo/third_party/gofrontend/libffi/man/ffi_call.3 deleted file mode 100644 index 5351513f90d86e310cd8cffe31112c75057d664b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/ffi_call.3 +++ /dev/null @@ -1,103 +0,0 @@ -.Dd February 15, 2008 -.Dt ffi_call 3 -.Sh NAME -.Nm ffi_call -.Nd Invoke a foreign function. -.Sh SYNOPSIS -.In ffi.h -.Ft void -.Fo ffi_call -.Fa "ffi_cif *cif" -.Fa "void (*fn)(void)" -.Fa "void *rvalue" -.Fa "void **avalue" -.Fc -.Sh DESCRIPTION -The -.Nm ffi_call -function provides a simple mechanism for invoking a function without -requiring knowledge of the function's interface at compile time. -.Fa fn -is called with the values retrieved from the pointers in the -.Fa avalue -array. The return value from -.Fa fn -is placed in storage pointed to by -.Fa rvalue . -.Fa cif -contains information describing the data types, sizes and alignments of the -arguments to and return value from -.Fa fn , -and must be initialized with -.Nm ffi_prep_cif -before it is used with -.Nm ffi_call . -.Pp -.Fa rvalue -must point to storage that is sizeof(ffi_arg) or larger for non-floating point -types. For smaller-sized return value types, the -.Nm ffi_arg -or -.Nm ffi_sarg -integral type must be used to hold -the return value. -.Sh EXAMPLES -.Bd -literal -#include -#include - -unsigned char -foo(unsigned int, float); - -int -main(int argc, const char **argv) -{ - ffi_cif cif; - ffi_type *arg_types[2]; - void *arg_values[2]; - ffi_status status; - - // Because the return value from foo() is smaller than sizeof(long), it - // must be passed as ffi_arg or ffi_sarg. - ffi_arg result; - - // Specify the data type of each argument. Available types are defined - // in . - arg_types[0] = &ffi_type_uint; - arg_types[1] = &ffi_type_float; - - // Prepare the ffi_cif structure. - if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, - 2, &ffi_type_uint8, arg_types)) != FFI_OK) - { - // Handle the ffi_status error. - } - - // Specify the values of each argument. - unsigned int arg1 = 42; - float arg2 = 5.1; - - arg_values[0] = &arg1; - arg_values[1] = &arg2; - - // Invoke the function. - ffi_call(&cif, FFI_FN(foo), &result, arg_values); - - // The ffi_arg 'result' now contains the unsigned char returned from foo(), - // which can be accessed by a typecast. - printf("result is %hhu", (unsigned char)result); - - return 0; -} - -// The target function. -unsigned char -foo(unsigned int x, float y) -{ - unsigned char result = x - y; - return result; -} -.Ed -.Sh SEE ALSO -.Xr ffi 3 , -.Xr ffi_prep_cif 3 diff --git a/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif.3 b/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif.3 deleted file mode 100644 index ab2be8adc17a19af2507c495887fce1c31c7a4e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif.3 +++ /dev/null @@ -1,68 +0,0 @@ -.Dd February 15, 2008 -.Dt ffi_prep_cif 3 -.Sh NAME -.Nm ffi_prep_cif -.Nd Prepare a -.Nm ffi_cif -structure for use with -.Nm ffi_call -. -.Sh SYNOPSIS -.In ffi.h -.Ft ffi_status -.Fo ffi_prep_cif -.Fa "ffi_cif *cif" -.Fa "ffi_abi abi" -.Fa "unsigned int nargs" -.Fa "ffi_type *rtype" -.Fa "ffi_type **atypes" -.Fc -.Sh DESCRIPTION -The -.Nm ffi_prep_cif -function prepares a -.Nm ffi_cif -structure for use with -.Nm ffi_call -. -.Fa abi -specifies a set of calling conventions to use. -.Fa atypes -is an array of -.Fa nargs -pointers to -.Nm ffi_type -structs that describe the data type, size and alignment of each argument. -.Fa rtype -points to an -.Nm ffi_type -that describes the data type, size and alignment of the -return value. Note that to call a variadic function -.Nm ffi_prep_cif_var -must be used instead. -.Sh RETURN VALUES -Upon successful completion, -.Nm ffi_prep_cif -returns -.Nm FFI_OK . -It will return -.Nm FFI_BAD_TYPEDEF -if -.Fa cif -is -.Nm NULL -or -.Fa atypes -or -.Fa rtype -is malformed. If -.Fa abi -does not refer to a valid ABI, -.Nm FFI_BAD_ABI -will be returned. Available ABIs are -defined in -.Nm . -.Sh SEE ALSO -.Xr ffi 3 , -.Xr ffi_call 3 , -.Xr ffi_prep_cif_var 3 diff --git a/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif_var.3 b/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif_var.3 deleted file mode 100644 index 7e19d0b070f17fed3f0890dd433e188b890d1466..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/man/ffi_prep_cif_var.3 +++ /dev/null @@ -1,73 +0,0 @@ -.Dd January 25, 2011 -.Dt ffi_prep_cif_var 3 -.Sh NAME -.Nm ffi_prep_cif_var -.Nd Prepare a -.Nm ffi_cif -structure for use with -.Nm ffi_call -for variadic functions. -.Sh SYNOPSIS -.In ffi.h -.Ft ffi_status -.Fo ffi_prep_cif_var -.Fa "ffi_cif *cif" -.Fa "ffi_abi abi" -.Fa "unsigned int nfixedargs" -.Fa "unsigned int ntotalargs" -.Fa "ffi_type *rtype" -.Fa "ffi_type **atypes" -.Fc -.Sh DESCRIPTION -The -.Nm ffi_prep_cif_var -function prepares a -.Nm ffi_cif -structure for use with -.Nm ffi_call -for variadic functions. -.Fa abi -specifies a set of calling conventions to use. -.Fa atypes -is an array of -.Fa ntotalargs -pointers to -.Nm ffi_type -structs that describe the data type, size and alignment of each argument. -.Fa rtype -points to an -.Nm ffi_type -that describes the data type, size and alignment of the -return value. -.Fa nfixedargs -must contain the number of fixed (non-variadic) arguments. -Note that to call a non-variadic function -.Nm ffi_prep_cif -must be used. -.Sh RETURN VALUES -Upon successful completion, -.Nm ffi_prep_cif_var -returns -.Nm FFI_OK . -It will return -.Nm FFI_BAD_TYPEDEF -if -.Fa cif -is -.Nm NULL -or -.Fa atypes -or -.Fa rtype -is malformed. If -.Fa abi -does not refer to a valid ABI, -.Nm FFI_BAD_ABI -will be returned. Available ABIs are -defined in -.Nm -. -.Sh SEE ALSO -.Xr ffi 3 , -.Xr ffi_call 3 , -.Xr ffi_prep_cif 3 diff --git a/llgo/third_party/gofrontend/libffi/mdate-sh b/llgo/third_party/gofrontend/libffi/mdate-sh deleted file mode 100644 index e631b2219a3cc2ccb992cb1a5f2f42e6b6d84765..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/mdate-sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/sh -# Get modification time of a file or directory and pretty-print it. - -scriptversion=2009-04-28.21; # UTC - -# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009 Free -# Software Foundation, Inc. -# written by Ulrich Drepper , June 1995 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No file. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: mdate-sh [--help] [--version] FILE - -Pretty-print the modification time of FILE. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "mdate-sh $scriptversion" - exit $? - ;; -esac - -# Prevent date giving response in another language. -LANG=C -export LANG -LC_ALL=C -export LC_ALL -LC_TIME=C -export LC_TIME - -# GNU ls changes its time format in response to the TIME_STYLE -# variable. Since we cannot assume `unset' works, revert this -# variable to its documented default. -if test "${TIME_STYLE+set}" = set; then - TIME_STYLE=posix-long-iso - export TIME_STYLE -fi - -save_arg1=$1 - -# Find out how to get the extended ls output of a file or directory. -if ls -L /dev/null 1>/dev/null 2>&1; then - ls_command='ls -L -l -d' -else - ls_command='ls -l -d' -fi -# Avoid user/group names that might have spaces, when possible. -if ls -n /dev/null 1>/dev/null 2>&1; then - ls_command="$ls_command -n" -fi - -# A `ls -l' line looks as follows on OS/2. -# drwxrwx--- 0 Aug 11 2001 foo -# This differs from Unix, which adds ownership information. -# drwxrwx--- 2 root root 4096 Aug 11 2001 foo -# -# To find the date, we split the line on spaces and iterate on words -# until we find a month. This cannot work with files whose owner is a -# user named `Jan', or `Feb', etc. However, it's unlikely that `/' -# will be owned by a user whose name is a month. So we first look at -# the extended ls output of the root directory to decide how many -# words should be skipped to get the date. - -# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. -set x`$ls_command /` - -# Find which argument is the month. -month= -command= -until test $month -do - shift - # Add another shift to the command. - command="$command shift;" - case $1 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; - esac -done - -# Get the extended ls output of the file or directory. -set dummy x`eval "$ls_command \"\$save_arg1\""` - -# Remove all preceding arguments -eval $command - -# Because of the dummy argument above, month is in $2. -# -# On a POSIX system, we should have -# -# $# = 5 -# $1 = file size -# $2 = month -# $3 = day -# $4 = year or time -# $5 = filename -# -# On Darwin 7.7.0 and 7.6.0, we have -# -# $# = 4 -# $1 = day -# $2 = month -# $3 = year or time -# $4 = filename - -# Get the month. -case $2 in - Jan) month=January; nummonth=1;; - Feb) month=February; nummonth=2;; - Mar) month=March; nummonth=3;; - Apr) month=April; nummonth=4;; - May) month=May; nummonth=5;; - Jun) month=June; nummonth=6;; - Jul) month=July; nummonth=7;; - Aug) month=August; nummonth=8;; - Sep) month=September; nummonth=9;; - Oct) month=October; nummonth=10;; - Nov) month=November; nummonth=11;; - Dec) month=December; nummonth=12;; -esac - -case $3 in - ???*) day=$1;; - *) day=$3; shift;; -esac - -# Here we have to deal with the problem that the ls output gives either -# the time of day or the year. -case $3 in - *:*) set `date`; eval year=\$$# - case $2 in - Jan) nummonthtod=1;; - Feb) nummonthtod=2;; - Mar) nummonthtod=3;; - Apr) nummonthtod=4;; - May) nummonthtod=5;; - Jun) nummonthtod=6;; - Jul) nummonthtod=7;; - Aug) nummonthtod=8;; - Sep) nummonthtod=9;; - Oct) nummonthtod=10;; - Nov) nummonthtod=11;; - Dec) nummonthtod=12;; - esac - # For the first six month of the year the time notation can also - # be used for files modified in the last year. - if (expr $nummonth \> $nummonthtod) > /dev/null; - then - year=`expr $year - 1` - fi;; - *) year=$3;; -esac - -# The result. -echo $day $month $year - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/llgo/third_party/gofrontend/libffi/src/aarch64/ffi.c b/llgo/third_party/gofrontend/libffi/src/aarch64/ffi.c deleted file mode 100644 index 0cace9d8e7c38b6c6f68e26bc4b8c8c738e06f5a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/aarch64/ffi.c +++ /dev/null @@ -1,910 +0,0 @@ -/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -``Software''), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include -#include -#include -#include -#include -#include "internal.h" - -/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE -# if FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -#else -# undef FFI_TYPE_LONGDOUBLE -# define FFI_TYPE_LONGDOUBLE 4 -#endif - -union _d -{ - UINT64 d; - UINT32 s[2]; -}; - -struct _v -{ - union _d d[2] __attribute__((aligned(16))); -}; - -struct call_context -{ - struct _v v[N_V_ARG_REG]; - UINT64 x[N_X_ARG_REG]; -}; - -#if defined (__clang__) && defined (__APPLE__) -extern void sys_icache_invalidate (void *start, size_t len); -#endif - -static inline void -ffi_clear_cache (void *start, void *end) -{ -#if defined (__clang__) && defined (__APPLE__) - sys_icache_invalidate (start, (char *)end - (char *)start); -#elif defined (__GNUC__) - __builtin___clear_cache (start, end); -#else -#error "Missing builtin to flush instruction cache" -#endif -} - -/* A subroutine of is_vfp_type. Given a structure type, return the type code - of the first non-structure element. Recurse for structure elements. - Return -1 if the structure is in fact empty, i.e. no nested elements. */ - -static int -is_hfa0 (const ffi_type *ty) -{ - ffi_type **elements = ty->elements; - int i, ret = -1; - - if (elements != NULL) - for (i = 0; elements[i]; ++i) - { - ret = elements[i]->type; - if (ret == FFI_TYPE_STRUCT || ret == FFI_TYPE_COMPLEX) - { - ret = is_hfa0 (elements[i]); - if (ret < 0) - continue; - } - break; - } - - return ret; -} - -/* A subroutine of is_vfp_type. Given a structure type, return true if all - of the non-structure elements are the same as CANDIDATE. */ - -static int -is_hfa1 (const ffi_type *ty, int candidate) -{ - ffi_type **elements = ty->elements; - int i; - - if (elements != NULL) - for (i = 0; elements[i]; ++i) - { - int t = elements[i]->type; - if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX) - { - if (!is_hfa1 (elements[i], candidate)) - return 0; - } - else if (t != candidate) - return 0; - } - - return 1; -} - -/* Determine if TY may be allocated to the FP registers. This is both an - fp scalar type as well as an homogenous floating point aggregate (HFA). - That is, a structure consisting of 1 to 4 members of all the same type, - where that type is an fp scalar. - - Returns non-zero iff TY is an HFA. The result is the AARCH64_RET_* - constant for the type. */ - -static int -is_vfp_type (const ffi_type *ty) -{ - ffi_type **elements; - int candidate, i; - size_t size, ele_count; - - /* Quickest tests first. */ - candidate = ty->type; - switch (candidate) - { - default: - return 0; - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - ele_count = 1; - goto done; - case FFI_TYPE_COMPLEX: - candidate = ty->elements[0]->type; - switch (candidate) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - ele_count = 2; - goto done; - } - return 0; - case FFI_TYPE_STRUCT: - break; - } - - /* No HFA types are smaller than 4 bytes, or larger than 64 bytes. */ - size = ty->size; - if (size < 4 || size > 64) - return 0; - - /* Find the type of the first non-structure member. */ - elements = ty->elements; - candidate = elements[0]->type; - if (candidate == FFI_TYPE_STRUCT || candidate == FFI_TYPE_COMPLEX) - { - for (i = 0; ; ++i) - { - candidate = is_hfa0 (elements[i]); - if (candidate >= 0) - break; - } - } - - /* If the first member is not a floating point type, it's not an HFA. - Also quickly re-check the size of the structure. */ - switch (candidate) - { - case FFI_TYPE_FLOAT: - ele_count = size / sizeof(float); - if (size != ele_count * sizeof(float)) - return 0; - break; - case FFI_TYPE_DOUBLE: - ele_count = size / sizeof(double); - if (size != ele_count * sizeof(double)) - return 0; - break; - case FFI_TYPE_LONGDOUBLE: - ele_count = size / sizeof(long double); - if (size != ele_count * sizeof(long double)) - return 0; - break; - default: - return 0; - } - if (ele_count > 4) - return 0; - - /* Finally, make sure that all scalar elements are the same type. */ - for (i = 0; elements[i]; ++i) - { - int t = elements[i]->type; - if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX) - { - if (!is_hfa1 (elements[i], candidate)) - return 0; - } - else if (t != candidate) - return 0; - } - - /* All tests succeeded. Encode the result. */ - done: - return candidate * 4 + (4 - ele_count); -} - -/* Representation of the procedure call argument marshalling - state. - - The terse state variable names match the names used in the AARCH64 - PCS. */ - -struct arg_state -{ - unsigned ngrn; /* Next general-purpose register number. */ - unsigned nsrn; /* Next vector register number. */ - size_t nsaa; /* Next stack offset. */ - -#if defined (__APPLE__) - unsigned allocating_variadic; -#endif -}; - -/* Initialize a procedure call argument marshalling state. */ -static void -arg_init (struct arg_state *state) -{ - state->ngrn = 0; - state->nsrn = 0; - state->nsaa = 0; -#if defined (__APPLE__) - state->allocating_variadic = 0; -#endif -} - -/* Allocate an aligned slot on the stack and return a pointer to it. */ -static void * -allocate_to_stack (struct arg_state *state, void *stack, - size_t alignment, size_t size) -{ - size_t nsaa = state->nsaa; - - /* Round up the NSAA to the larger of 8 or the natural - alignment of the argument's type. */ -#if defined (__APPLE__) - if (state->allocating_variadic && alignment < 8) - alignment = 8; -#else - if (alignment < 8) - alignment = 8; -#endif - - nsaa = ALIGN (nsaa, alignment); - state->nsaa = nsaa + size; - - return (char *)stack + nsaa; -} - -static ffi_arg -extend_integer_type (void *source, int type) -{ - switch (type) - { - case FFI_TYPE_UINT8: - return *(UINT8 *) source; - case FFI_TYPE_SINT8: - return *(SINT8 *) source; - case FFI_TYPE_UINT16: - return *(UINT16 *) source; - case FFI_TYPE_SINT16: - return *(SINT16 *) source; - case FFI_TYPE_UINT32: - return *(UINT32 *) source; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - return *(SINT32 *) source; - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - return *(UINT64 *) source; - break; - case FFI_TYPE_POINTER: - return *(uintptr_t *) source; - default: - abort(); - } -} - -static void -extend_hfa_type (void *dest, void *src, int h) -{ - int f = h - AARCH64_RET_S4; - void *x0; - - asm volatile ( - "adr %0, 0f\n" -" add %0, %0, %1\n" -" br %0\n" -"0: ldp s16, s17, [%3]\n" /* S4 */ -" ldp s18, s19, [%3, #8]\n" -" b 4f\n" -" ldp s16, s17, [%3]\n" /* S3 */ -" ldr s18, [%3, #8]\n" -" b 3f\n" -" ldp s16, s17, [%3]\n" /* S2 */ -" b 2f\n" -" nop\n" -" ldr s16, [%3]\n" /* S1 */ -" b 1f\n" -" nop\n" -" ldp d16, d17, [%3]\n" /* D4 */ -" ldp d18, d19, [%3, #16]\n" -" b 4f\n" -" ldp d16, d17, [%3]\n" /* D3 */ -" ldr d18, [%3, #16]\n" -" b 3f\n" -" ldp d16, d17, [%3]\n" /* D2 */ -" b 2f\n" -" nop\n" -" ldr d16, [%3]\n" /* D1 */ -" b 1f\n" -" nop\n" -" ldp q16, q17, [%3]\n" /* Q4 */ -" ldp q18, q19, [%3, #16]\n" -" b 4f\n" -" ldp q16, q17, [%3]\n" /* Q3 */ -" ldr q18, [%3, #16]\n" -" b 3f\n" -" ldp q16, q17, [%3]\n" /* Q2 */ -" b 2f\n" -" nop\n" -" ldr q16, [%3]\n" /* Q1 */ -" b 1f\n" -"4: str q19, [%2, #48]\n" -"3: str q18, [%2, #32]\n" -"2: str q17, [%2, #16]\n" -"1: str q16, [%2]" - : "=&r"(x0) - : "r"(f * 12), "r"(dest), "r"(src) - : "memory", "v16", "v17", "v18", "v19"); -} - -static void * -compress_hfa_type (void *dest, void *reg, int h) -{ - switch (h) - { - case AARCH64_RET_S1: - if (dest == reg) - { -#ifdef __AARCH64EB__ - dest += 12; -#endif - } - else - *(float *)dest = *(float *)reg; - break; - case AARCH64_RET_S2: - asm ("ldp q16, q17, [%1]\n\t" - "st2 { v16.s, v17.s }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17"); - break; - case AARCH64_RET_S3: - asm ("ldp q16, q17, [%1]\n\t" - "ldr q18, [%1, #32]\n\t" - "st3 { v16.s, v17.s, v18.s }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18"); - break; - case AARCH64_RET_S4: - asm ("ldp q16, q17, [%1]\n\t" - "ldp q18, q19, [%1, #32]\n\t" - "st4 { v16.s, v17.s, v18.s, v19.s }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19"); - break; - - case AARCH64_RET_D1: - if (dest == reg) - { -#ifdef __AARCH64EB__ - dest += 8; -#endif - } - else - *(double *)dest = *(double *)reg; - break; - case AARCH64_RET_D2: - asm ("ldp q16, q17, [%1]\n\t" - "st2 { v16.d, v17.d }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17"); - break; - case AARCH64_RET_D3: - asm ("ldp q16, q17, [%1]\n\t" - "ldr q18, [%1, #32]\n\t" - "st3 { v16.d, v17.d, v18.d }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18"); - break; - case AARCH64_RET_D4: - asm ("ldp q16, q17, [%1]\n\t" - "ldp q18, q19, [%1, #32]\n\t" - "st4 { v16.d, v17.d, v18.d, v19.d }[0], [%0]" - : : "r"(dest), "r"(reg) : "memory", "v16", "v17", "v18", "v19"); - break; - - default: - if (dest != reg) - return memcpy (dest, reg, 16 * (4 - (h & 3))); - break; - } - return dest; -} - -/* Either allocate an appropriate register for the argument type, or if - none are available, allocate a stack slot and return a pointer - to the allocated space. */ - -static void * -allocate_int_to_reg_or_stack (struct call_context *context, - struct arg_state *state, - void *stack, size_t size) -{ - if (state->ngrn < N_X_ARG_REG) - return &context->x[state->ngrn++]; - - state->ngrn = N_X_ARG_REG; - return allocate_to_stack (state, stack, size, size); -} - -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - ffi_type *rtype = cif->rtype; - size_t bytes = cif->bytes; - int flags, i, n; - - switch (rtype->type) - { - case FFI_TYPE_VOID: - flags = AARCH64_RET_VOID; - break; - case FFI_TYPE_UINT8: - flags = AARCH64_RET_UINT8; - break; - case FFI_TYPE_UINT16: - flags = AARCH64_RET_UINT16; - break; - case FFI_TYPE_UINT32: - flags = AARCH64_RET_UINT32; - break; - case FFI_TYPE_SINT8: - flags = AARCH64_RET_SINT8; - break; - case FFI_TYPE_SINT16: - flags = AARCH64_RET_SINT16; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - flags = AARCH64_RET_SINT32; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - flags = AARCH64_RET_INT64; - break; - case FFI_TYPE_POINTER: - flags = (sizeof(void *) == 4 ? AARCH64_RET_UINT32 : AARCH64_RET_INT64); - break; - - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - flags = is_vfp_type (rtype); - if (flags == 0) - { - size_t s = rtype->size; - if (s > 16) - { - flags = AARCH64_RET_VOID | AARCH64_RET_IN_MEM; - bytes += 8; - } - else if (s == 16) - flags = AARCH64_RET_INT128; - else if (s == 8) - flags = AARCH64_RET_INT64; - else - flags = AARCH64_RET_INT128 | AARCH64_RET_NEED_COPY; - } - break; - - default: - abort(); - } - - for (i = 0, n = cif->nargs; i < n; i++) - if (is_vfp_type (cif->arg_types[i])) - { - flags |= AARCH64_FLAG_ARG_V; - break; - } - - /* Round the stack up to a multiple of the stack alignment requirement. */ - cif->bytes = ALIGN(bytes, 16); - cif->flags = flags; -#if defined (__APPLE__) - cif->aarch64_nfixedargs = 0; -#endif - - return FFI_OK; -} - -#if defined (__APPLE__) -/* Perform Apple-specific cif processing for variadic calls */ -ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, - unsigned int nfixedargs, - unsigned int ntotalargs) -{ - ffi_status status = ffi_prep_cif_machdep (cif); - cif->aarch64_nfixedargs = nfixedargs; - return status; -} -#endif /* __APPLE__ */ - -extern void ffi_call_SYSV (struct call_context *context, void *frame, - void (*fn)(void), void *rvalue, int flags, - void *closure) FFI_HIDDEN; - -/* Call a function with the provided arguments and capture the return - value. */ -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - void **avalue, void *closure) -{ - struct call_context *context; - void *stack, *frame, *rvalue; - struct arg_state state; - size_t stack_bytes, rtype_size, rsize; - int i, nargs, flags; - ffi_type *rtype; - - flags = cif->flags; - rtype = cif->rtype; - rtype_size = rtype->size; - stack_bytes = cif->bytes; - - /* If the target function returns a structure via hidden pointer, - then we cannot allow a null rvalue. Otherwise, mash a null - rvalue to void return type. */ - rsize = 0; - if (flags & AARCH64_RET_IN_MEM) - { - if (orig_rvalue == NULL) - rsize = rtype_size; - } - else if (orig_rvalue == NULL) - flags &= AARCH64_FLAG_ARG_V; - else if (flags & AARCH64_RET_NEED_COPY) - rsize = 16; - - /* Allocate consectutive stack for everything we'll need. */ - context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize); - stack = context + 1; - frame = stack + stack_bytes; - rvalue = (rsize ? frame + 32 : orig_rvalue); - - arg_init (&state); - for (i = 0, nargs = cif->nargs; i < nargs; i++) - { - ffi_type *ty = cif->arg_types[i]; - size_t s = ty->size; - void *a = avalue[i]; - int h, t; - - t = ty->type; - switch (t) - { - case FFI_TYPE_VOID: - FFI_ASSERT (0); - break; - - /* If the argument is a basic type the argument is allocated to an - appropriate register, or if none are available, to the stack. */ - case FFI_TYPE_INT: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - do_pointer: - { - ffi_arg ext = extend_integer_type (a, t); - if (state.ngrn < N_X_ARG_REG) - context->x[state.ngrn++] = ext; - else - { - void *d = allocate_to_stack (&state, stack, ty->alignment, s); - state.ngrn = N_X_ARG_REG; - /* Note that the default abi extends each argument - to a full 64-bit slot, while the iOS abi allocates - only enough space. */ -#ifdef __APPLE__ - memcpy(d, a, s); -#else - *(ffi_arg *)d = ext; -#endif - } - } - break; - - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - { - void *dest; - - h = is_vfp_type (ty); - if (h) - { - int elems = 4 - (h & 3); - if (state.nsrn + elems <= N_V_ARG_REG) - { - dest = &context->v[state.nsrn]; - state.nsrn += elems; - extend_hfa_type (dest, a, h); - break; - } - state.nsrn = N_V_ARG_REG; - dest = allocate_to_stack (&state, stack, ty->alignment, s); - } - else if (s > 16) - { - /* If the argument is a composite type that is larger than 16 - bytes, then the argument has been copied to memory, and - the argument is replaced by a pointer to the copy. */ - a = &avalue[i]; - t = FFI_TYPE_POINTER; - goto do_pointer; - } - else - { - size_t n = (s + 7) / 8; - if (state.ngrn + n <= N_X_ARG_REG) - { - /* If the argument is a composite type and the size in - double-words is not more than the number of available - X registers, then the argument is copied into - consecutive X registers. */ - dest = &context->x[state.ngrn]; - state.ngrn += n; - } - else - { - /* Otherwise, there are insufficient X registers. Further - X register allocations are prevented, the NSAA is - adjusted and the argument is copied to memory at the - adjusted NSAA. */ - state.ngrn = N_X_ARG_REG; - dest = allocate_to_stack (&state, stack, ty->alignment, s); - } - } - memcpy (dest, a, s); - } - break; - - default: - abort(); - } - -#if defined (__APPLE__) - if (i + 1 == cif->aarch64_nfixedargs) - { - state.ngrn = N_X_ARG_REG; - state.nsrn = N_V_ARG_REG; - state.allocating_variadic = 1; - } -#endif - } - - ffi_call_SYSV (context, frame, fn, rvalue, flags, closure); - - if (flags & AARCH64_RET_NEED_COPY) - memcpy (orig_rvalue, rvalue, rtype_size); -} - -void -ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -#ifdef FFI_GO_CLOSURES -void -ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} -#endif /* FFI_GO_CLOSURES */ - -/* Build a trampoline. */ - -extern void ffi_closure_SYSV (void) FFI_HIDDEN; -extern void ffi_closure_SYSV_V (void) FFI_HIDDEN; - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - static const unsigned char trampoline[16] = { - 0x90, 0x00, 0x00, 0x58, /* ldr x16, tramp+16 */ - 0xf1, 0xff, 0xff, 0x10, /* adr x17, tramp+0 */ - 0x00, 0x02, 0x1f, 0xd6 /* br x16 */ - }; - char *tramp = closure->tramp; - void (*start)(void); - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - memcpy (tramp, trampoline, sizeof(trampoline)); - - if (cif->flags & AARCH64_FLAG_ARG_V) - start = ffi_closure_SYSV_V; - else - start = ffi_closure_SYSV; - *(UINT64 *)(tramp + 16) = (uintptr_t)start; - - ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE); - - return FFI_OK; -} - -#ifdef FFI_GO_CLOSURES -extern void ffi_go_closure_SYSV (void) FFI_HIDDEN; -extern void ffi_go_closure_SYSV_V (void) FFI_HIDDEN; - -ffi_status -ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*)) -{ - void (*start)(void); - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - if (cif->flags & AARCH64_FLAG_ARG_V) - start = ffi_go_closure_SYSV_V; - else - start = ffi_go_closure_SYSV; - - closure->tramp = start; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} -#endif /* FFI_GO_CLOSURES */ - -/* Primary handler to setup and invoke a function within a closure. - - A closure when invoked enters via the assembler wrapper - ffi_closure_SYSV(). The wrapper allocates a call context on the - stack, saves the interesting registers (from the perspective of - the calling convention) into the context then passes control to - ffi_closure_SYSV_inner() passing the saved context and a pointer to - the stack at the point ffi_closure_SYSV() was invoked. - - On the return path the assembler wrapper will reload call context - registers. - - ffi_closure_SYSV_inner() marshalls the call context into ffi value - descriptors, invokes the wrapped function, then marshalls the return - value back into the call context. */ - -int FFI_HIDDEN -ffi_closure_SYSV_inner (ffi_cif *cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - struct call_context *context, - void *stack, void *rvalue, void *struct_rvalue) -{ - void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); - int i, h, nargs, flags; - struct arg_state state; - - arg_init (&state); - - for (i = 0, nargs = cif->nargs; i < nargs; i++) - { - ffi_type *ty = cif->arg_types[i]; - int t = ty->type; - size_t n, s = ty->size; - - switch (t) - { - case FFI_TYPE_VOID: - FFI_ASSERT (0); - break; - - case FFI_TYPE_INT: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - avalue[i] = allocate_int_to_reg_or_stack (context, &state, stack, s); - break; - - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - h = is_vfp_type (ty); - if (h) - { - n = 4 - (h & 3); - if (state.nsrn + n <= N_V_ARG_REG) - { - void *reg = &context->v[state.nsrn]; - state.nsrn += n; - - /* Eeek! We need a pointer to the structure, however the - homogeneous float elements are being passed in individual - registers, therefore for float and double the structure - is not represented as a contiguous sequence of bytes in - our saved register context. We don't need the original - contents of the register storage, so we reformat the - structure into the same memory. */ - avalue[i] = compress_hfa_type (reg, reg, h); - } - else - { - state.nsrn = N_V_ARG_REG; - avalue[i] = allocate_to_stack (&state, stack, - ty->alignment, s); - } - } - else if (s > 16) - { - /* Replace Composite type of size greater than 16 with a - pointer. */ - avalue[i] = *(void **) - allocate_int_to_reg_or_stack (context, &state, stack, - sizeof (void *)); - } - else - { - n = (s + 7) / 8; - if (state.ngrn + n <= N_X_ARG_REG) - { - avalue[i] = &context->x[state.ngrn]; - state.ngrn += n; - } - else - { - state.ngrn = N_X_ARG_REG; - avalue[i] = allocate_to_stack (&state, stack, - ty->alignment, s); - } - } - break; - - default: - abort(); - } - } - - flags = cif->flags; - if (flags & AARCH64_RET_IN_MEM) - rvalue = struct_rvalue; - - fun (cif, rvalue, avalue, user_data); - - return flags; -} diff --git a/llgo/third_party/gofrontend/libffi/src/aarch64/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/aarch64/ffitarget.h deleted file mode 100644 index 80d09af16812f754cf4270e565216a205b214908..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/aarch64/ffitarget.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -``Software''), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi - { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV - } ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 24 -#define FFI_NATIVE_RAW_API 0 - -/* ---- Internal ---- */ - -#if defined (__APPLE__) -#define FFI_TARGET_SPECIFIC_VARIADIC -#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs -#else -/* iOS reserves x18 for the system. Disable Go closures until - a new static chain is chosen. */ -#define FFI_GO_CLOSURES 1 -#endif - -#define FFI_TARGET_HAS_COMPLEX_TYPE - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/aarch64/internal.h b/llgo/third_party/gofrontend/libffi/src/aarch64/internal.h deleted file mode 100644 index 9c3e07725a0583e472fd4e72c2f909cc837da429..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/aarch64/internal.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -``Software''), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#define AARCH64_RET_VOID 0 -#define AARCH64_RET_INT64 1 -#define AARCH64_RET_INT128 2 - -#define AARCH64_RET_UNUSED3 3 -#define AARCH64_RET_UNUSED4 4 -#define AARCH64_RET_UNUSED5 5 -#define AARCH64_RET_UNUSED6 6 -#define AARCH64_RET_UNUSED7 7 - -/* Note that FFI_TYPE_FLOAT == 2, _DOUBLE == 3, _LONGDOUBLE == 4, - so _S4 through _Q1 are layed out as (TYPE * 4) + (4 - COUNT). */ -#define AARCH64_RET_S4 8 -#define AARCH64_RET_S3 9 -#define AARCH64_RET_S2 10 -#define AARCH64_RET_S1 11 - -#define AARCH64_RET_D4 12 -#define AARCH64_RET_D3 13 -#define AARCH64_RET_D2 14 -#define AARCH64_RET_D1 15 - -#define AARCH64_RET_Q4 16 -#define AARCH64_RET_Q3 17 -#define AARCH64_RET_Q2 18 -#define AARCH64_RET_Q1 19 - -/* Note that each of the sub-64-bit integers gets two entries. */ -#define AARCH64_RET_UINT8 20 -#define AARCH64_RET_UINT16 22 -#define AARCH64_RET_UINT32 24 - -#define AARCH64_RET_SINT8 26 -#define AARCH64_RET_SINT16 28 -#define AARCH64_RET_SINT32 30 - -#define AARCH64_RET_MASK 31 - -#define AARCH64_RET_IN_MEM (1 << 5) -#define AARCH64_RET_NEED_COPY (1 << 6) - -#define AARCH64_FLAG_ARG_V_BIT 7 -#define AARCH64_FLAG_ARG_V (1 << AARCH64_FLAG_ARG_V_BIT) - -#define N_X_ARG_REG 8 -#define N_V_ARG_REG 8 -#define CALL_CONTEXT_SIZE (N_V_ARG_REG * 16 + N_X_ARG_REG * 8) diff --git a/llgo/third_party/gofrontend/libffi/src/aarch64/sysv.S b/llgo/third_party/gofrontend/libffi/src/aarch64/sysv.S deleted file mode 100644 index 5c9cdda18c5e1173821e839c8a17beeb01f00c57..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/aarch64/sysv.S +++ /dev/null @@ -1,403 +0,0 @@ -/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -``Software''), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#define LIBFFI_ASM -#include -#include -#include -#include "internal.h" - -#ifdef HAVE_MACHINE_ASM_H -#include -#else -#ifdef __USER_LABEL_PREFIX__ -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ -#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) -#else -#define CNAME(x) x -#endif -#endif - -#ifdef __AARCH64EB__ -# define BE(X) X -#else -# define BE(X) 0 -#endif - - .text - .align 4 - -/* ffi_call_SYSV - extern void ffi_call_SYSV (void *stack, void *frame, - void (*fn)(void), void *rvalue, - int flags, void *closure); - - Therefore on entry we have: - - x0 stack - x1 frame - x2 fn - x3 rvalue - x4 flags - x5 closure -*/ - - cfi_startproc -CNAME(ffi_call_SYSV): - /* Use a stack frame allocated by our caller. */ - cfi_def_cfa(x1, 32); - stp x29, x30, [x1] - mov x29, x1 - mov sp, x0 - cfi_def_cfa_register(x29) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) - - mov x9, x2 /* save fn */ - mov x8, x3 /* install structure return */ -#ifdef FFI_GO_CLOSURES - mov x18, x5 /* install static chain */ -#endif - stp x3, x4, [x29, #16] /* save rvalue and flags */ - - /* Load the vector argument passing registers, if necessary. */ - tbz w4, #AARCH64_FLAG_ARG_V_BIT, 1f - ldp q0, q1, [sp, #0] - ldp q2, q3, [sp, #32] - ldp q4, q5, [sp, #64] - ldp q6, q7, [sp, #96] -1: - /* Load the core argument passing registers, including - the structure return pointer. */ - ldp x0, x1, [sp, #16*N_V_ARG_REG + 0] - ldp x2, x3, [sp, #16*N_V_ARG_REG + 16] - ldp x4, x5, [sp, #16*N_V_ARG_REG + 32] - ldp x6, x7, [sp, #16*N_V_ARG_REG + 48] - - /* Deallocate the context, leaving the stacked arguments. */ - add sp, sp, #CALL_CONTEXT_SIZE - - blr x9 /* call fn */ - - ldp x3, x4, [x29, #16] /* reload rvalue and flags */ - - /* Partially deconstruct the stack frame. */ - mov sp, x29 - cfi_def_cfa_register (sp) - ldp x29, x30, [x29] - - /* Save the return value as directed. */ - adr x5, 0f - and w4, w4, #AARCH64_RET_MASK - add x5, x5, x4, lsl #3 - br x5 - - /* Note that each table entry is 2 insns, and thus 8 bytes. - For integer data, note that we're storing into ffi_arg - and therefore we want to extend to 64 bits; these types - have two consecutive entries allocated for them. */ - .align 4 -0: ret /* VOID */ - nop -1: str x0, [x3] /* INT64 */ - ret -2: stp x0, x1, [x3] /* INT128 */ - ret -3: brk #1000 /* UNUSED */ - ret -4: brk #1000 /* UNUSED */ - ret -5: brk #1000 /* UNUSED */ - ret -6: brk #1000 /* UNUSED */ - ret -7: brk #1000 /* UNUSED */ - ret -8: st4 { v0.s-v3.s }[0], [x3] /* S4 */ - ret -9: st3 { v0.s-v2.s }[0], [x3] /* S3 */ - ret -10: stp s0, s1, [x3] /* S2 */ - ret -11: str s0, [x3] /* S1 */ - ret -12: st4 { v0.d-v3.d }[0], [x3] /* D4 */ - ret -13: st3 { v0.d-v2.d }[0], [x3] /* D3 */ - ret -14: stp d0, d1, [x3] /* D2 */ - ret -15: str d0, [x3] /* D1 */ - ret -16: str q3, [x3, #48] /* Q4 */ - nop -17: str q2, [x3, #32] /* Q3 */ - nop -18: stp q0, q1, [x3] /* Q2 */ - ret -19: str q0, [x3] /* Q1 */ - ret -20: uxtb w0, w0 /* UINT8 */ - str x0, [x3] -21: ret /* reserved */ - nop -22: uxth w0, w0 /* UINT16 */ - str x0, [x3] -23: ret /* reserved */ - nop -24: mov w0, w0 /* UINT32 */ - str x0, [x3] -25: ret /* reserved */ - nop -26: sxtb x0, w0 /* SINT8 */ - str x0, [x3] -27: ret /* reserved */ - nop -28: sxth x0, w0 /* SINT16 */ - str x0, [x3] -29: ret /* reserved */ - nop -30: sxtw x0, w0 /* SINT32 */ - str x0, [x3] -31: ret /* reserved */ - nop - - cfi_endproc - - .globl CNAME(ffi_call_SYSV) -#ifdef __ELF__ - .type CNAME(ffi_call_SYSV), #function - .hidden CNAME(ffi_call_SYSV) - .size CNAME(ffi_call_SYSV), .-CNAME(ffi_call_SYSV) -#endif - -/* ffi_closure_SYSV - - Closure invocation glue. This is the low level code invoked directly by - the closure trampoline to setup and call a closure. - - On entry x17 points to a struct ffi_closure, x16 has been clobbered - all other registers are preserved. - - We allocate a call context and save the argument passing registers, - then invoked the generic C ffi_closure_SYSV_inner() function to do all - the real work, on return we load the result passing registers back from - the call context. -*/ - -#define ffi_closure_SYSV_FS (8*2 + CALL_CONTEXT_SIZE + 64) - - .align 4 -CNAME(ffi_closure_SYSV_V): - cfi_startproc - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) - - /* Save the argument passing vector registers. */ - stp q0, q1, [sp, #16 + 0] - stp q2, q3, [sp, #16 + 32] - stp q4, q5, [sp, #16 + 64] - stp q6, q7, [sp, #16 + 96] - b 0f - cfi_endproc - - .globl CNAME(ffi_closure_SYSV_V) -#ifdef __ELF__ - .type CNAME(ffi_closure_SYSV_V), #function - .hidden CNAME(ffi_closure_SYSV_V) - .size CNAME(ffi_closure_SYSV_V), . - CNAME(ffi_closure_SYSV_V) -#endif - - .align 4 - cfi_startproc -CNAME(ffi_closure_SYSV): - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) -0: - mov x29, sp - - /* Save the argument passing core registers. */ - stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0] - stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16] - stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32] - stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48] - - /* Load ffi_closure_inner arguments. */ - ldp x0, x1, [x17, #FFI_TRAMPOLINE_SIZE] /* load cif, fn */ - ldr x2, [x17, #FFI_TRAMPOLINE_SIZE+16] /* load user_data */ -.Ldo_closure: - add x3, sp, #16 /* load context */ - add x4, sp, #ffi_closure_SYSV_FS /* load stack */ - add x5, sp, #16+CALL_CONTEXT_SIZE /* load rvalue */ - mov x6, x8 /* load struct_rval */ - bl CNAME(ffi_closure_SYSV_inner) - - /* Load the return value as directed. */ - adr x1, 0f - and w0, w0, #AARCH64_RET_MASK - add x1, x1, x0, lsl #3 - add x3, sp, #16+CALL_CONTEXT_SIZE - br x1 - - /* Note that each table entry is 2 insns, and thus 8 bytes. */ - .align 4 -0: b 99f /* VOID */ - nop -1: ldr x0, [x3] /* INT64 */ - b 99f -2: ldp x0, x1, [x3] /* INT128 */ - b 99f -3: brk #1000 /* UNUSED */ - nop -4: brk #1000 /* UNUSED */ - nop -5: brk #1000 /* UNUSED */ - nop -6: brk #1000 /* UNUSED */ - nop -7: brk #1000 /* UNUSED */ - nop -8: ldr s3, [x3, #12] /* S4 */ - nop -9: ldr s2, [x2, #8] /* S3 */ - nop -10: ldp s0, s1, [x3] /* S2 */ - b 99f -11: ldr s0, [x3] /* S1 */ - b 99f -12: ldr d3, [x3, #24] /* D4 */ - nop -13: ldr d2, [x3, #16] /* D3 */ - nop -14: ldp d0, d1, [x3] /* D2 */ - b 99f -15: ldr d0, [x3] /* D1 */ - b 99f -16: ldr q3, [x3, #48] /* Q4 */ - nop -17: ldr q2, [x3, #32] /* Q3 */ - nop -18: ldp q0, q1, [x3] /* Q2 */ - b 99f -19: ldr q0, [x3] /* Q1 */ - b 99f -20: ldrb w0, [x3, #BE(7)] /* UINT8 */ - b 99f -21: brk #1000 /* reserved */ - nop -22: ldrh w0, [x3, #BE(6)] /* UINT16 */ - b 99f -23: brk #1000 /* reserved */ - nop -24: ldr w0, [x3, #BE(4)] /* UINT32 */ - b 99f -25: brk #1000 /* reserved */ - nop -26: ldrsb x0, [x3, #BE(7)] /* SINT8 */ - b 99f -27: brk #1000 /* reserved */ - nop -28: ldrsh x0, [x3, #BE(6)] /* SINT16 */ - b 99f -29: brk #1000 /* reserved */ - nop -30: ldrsw x0, [x3, #BE(4)] /* SINT32 */ - nop -31: /* reserved */ -99: ldp x29, x30, [sp], #ffi_closure_SYSV_FS - cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS) - cfi_restore (x29) - cfi_restore (x30) - ret - cfi_endproc - - .globl CNAME(ffi_closure_SYSV) -#ifdef __ELF__ - .type CNAME(ffi_closure_SYSV), #function - .hidden CNAME(ffi_closure_SYSV) - .size CNAME(ffi_closure_SYSV), . - CNAME(ffi_closure_SYSV) -#endif - -#ifdef FFI_GO_CLOSURES - .align 4 -CNAME(ffi_go_closure_SYSV_V): - cfi_startproc - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) - - /* Save the argument passing vector registers. */ - stp q0, q1, [sp, #16 + 0] - stp q2, q3, [sp, #16 + 32] - stp q4, q5, [sp, #16 + 64] - stp q6, q7, [sp, #16 + 96] - b 0f - cfi_endproc - - .globl CNAME(ffi_go_closure_SYSV_V) -#ifdef __ELF__ - .type CNAME(ffi_go_closure_SYSV_V), #function - .hidden CNAME(ffi_go_closure_SYSV_V) - .size CNAME(ffi_go_closure_SYSV_V), . - CNAME(ffi_go_closure_SYSV_V) -#endif - - .align 4 - cfi_startproc -CNAME(ffi_go_closure_SYSV): - stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! - cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) - cfi_rel_offset (x29, 0) - cfi_rel_offset (x30, 8) -0: - mov x29, sp - - /* Save the argument passing core registers. */ - stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0] - stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16] - stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32] - stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48] - - /* Load ffi_closure_inner arguments. */ - ldp x0, x1, [x18, #8] /* load cif, fn */ - mov x2, x18 /* load user_data */ - b .Ldo_closure - cfi_endproc - - .globl CNAME(ffi_go_closure_SYSV) -#ifdef __ELF__ - .type CNAME(ffi_go_closure_SYSV), #function - .hidden CNAME(ffi_go_closure_SYSV) - .size CNAME(ffi_go_closure_SYSV), . - CNAME(ffi_go_closure_SYSV) -#endif -#endif /* FFI_GO_CLOSURES */ - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",%progbits -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/alpha/ffi.c b/llgo/third_party/gofrontend/libffi/src/alpha/ffi.c deleted file mode 100644 index efae4cc3d671a549852130ae57515e94f043bb00..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/alpha/ffi.c +++ /dev/null @@ -1,521 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2012 Anthony Green - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. - - Alpha Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include "internal.h" - -/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -#if defined(__LONG_DOUBLE_128__) -# if FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -#else -# undef FFI_TYPE_LONGDOUBLE -# define FFI_TYPE_LONGDOUBLE 4 -#endif - -extern void ffi_call_osf(void *stack, void *frame, unsigned flags, - void *raddr, void (*fn)(void), void *closure) - FFI_HIDDEN; -extern void ffi_closure_osf(void) FFI_HIDDEN; -extern void ffi_go_closure_osf(void) FFI_HIDDEN; - -/* Promote a float value to its in-register double representation. - Unlike actually casting to double, this does not trap on NaN. */ -static inline UINT64 lds(void *ptr) -{ - UINT64 ret; - asm("lds %0,%1" : "=f"(ret) : "m"(*(UINT32 *)ptr)); - return ret; -} - -/* And the reverse. */ -static inline void sts(void *ptr, UINT64 val) -{ - asm("sts %1,%0" : "=m"(*(UINT32 *)ptr) : "f"(val)); -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep(ffi_cif *cif) -{ - size_t bytes = 0; - int flags, i, avn; - ffi_type *rtype, *itype; - - if (cif->abi != FFI_OSF) - return FFI_BAD_ABI; - - /* Compute the size of the argument area. */ - for (i = 0, avn = cif->nargs; i < avn; i++) - { - itype = cif->arg_types[i]; - switch (itype->type) - { - case FFI_TYPE_INT: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - /* All take one 8 byte slot. */ - bytes += 8; - break; - - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - /* Passed by value in N slots. */ - bytes += ALIGN(itype->size, FFI_SIZEOF_ARG); - break; - - case FFI_TYPE_COMPLEX: - /* _Complex long double passed by reference; others in 2 slots. */ - if (itype->elements[0]->type == FFI_TYPE_LONGDOUBLE) - bytes += 8; - else - bytes += 16; - break; - - default: - abort(); - } - } - - /* Set the return type flag */ - rtype = cif->rtype; - switch (rtype->type) - { - case FFI_TYPE_VOID: - flags = ALPHA_FLAGS(ALPHA_ST_VOID, ALPHA_LD_VOID); - break; - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_INT32); - break; - case FFI_TYPE_FLOAT: - flags = ALPHA_FLAGS(ALPHA_ST_FLOAT, ALPHA_LD_FLOAT); - break; - case FFI_TYPE_DOUBLE: - flags = ALPHA_FLAGS(ALPHA_ST_DOUBLE, ALPHA_LD_DOUBLE); - break; - case FFI_TYPE_UINT8: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_UINT8); - break; - case FFI_TYPE_SINT8: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_SINT8); - break; - case FFI_TYPE_UINT16: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_UINT16); - break; - case FFI_TYPE_SINT16: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_SINT16); - break; - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_INT64); - break; - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_STRUCT: - /* Passed in memory, with a hidden pointer. */ - flags = ALPHA_RET_IN_MEM; - break; - case FFI_TYPE_COMPLEX: - itype = rtype->elements[0]; - switch (itype->type) - { - case FFI_TYPE_FLOAT: - flags = ALPHA_FLAGS(ALPHA_ST_CPLXF, ALPHA_LD_CPLXF); - break; - case FFI_TYPE_DOUBLE: - flags = ALPHA_FLAGS(ALPHA_ST_CPLXD, ALPHA_LD_CPLXD); - break; - default: - if (rtype->size <= 8) - flags = ALPHA_FLAGS(ALPHA_ST_INT, ALPHA_LD_INT64); - else - flags = ALPHA_RET_IN_MEM; - break; - } - break; - default: - abort(); - } - cif->flags = flags; - - /* Include the hidden structure pointer in args requirement. */ - if (flags == ALPHA_RET_IN_MEM) - bytes += 8; - /* Minimum size is 6 slots, so that ffi_call_osf can pop them. */ - if (bytes < 6*8) - bytes = 6*8; - cif->bytes = bytes; - - return FFI_OK; -} - -static unsigned long -extend_basic_type(void *valp, int type, int argn) -{ - switch (type) - { - case FFI_TYPE_SINT8: - return *(SINT8 *)valp; - case FFI_TYPE_UINT8: - return *(UINT8 *)valp; - case FFI_TYPE_SINT16: - return *(SINT16 *)valp; - case FFI_TYPE_UINT16: - return *(UINT16 *)valp; - - case FFI_TYPE_FLOAT: - if (argn < 6) - return lds(valp); - /* FALLTHRU */ - - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - /* Note that unsigned 32-bit quantities are sign extended. */ - return *(SINT32 *)valp; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - case FFI_TYPE_DOUBLE: - return *(UINT64 *)valp; - - default: - abort(); - } -} - -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - unsigned long *argp; - long i, avn, argn, flags = cif->flags; - ffi_type **arg_types; - void *frame; - - /* If the return value is a struct and we don't have a return - value address then we need to make one. */ - if (rvalue == NULL && flags == ALPHA_RET_IN_MEM) - rvalue = alloca(cif->rtype->size); - - /* Allocate the space for the arguments, plus 4 words of temp - space for ffi_call_osf. */ - argp = frame = alloca(cif->bytes + 4*FFI_SIZEOF_ARG); - frame += cif->bytes; - - argn = 0; - if (flags == ALPHA_RET_IN_MEM) - argp[argn++] = (unsigned long)rvalue; - - avn = cif->nargs; - arg_types = cif->arg_types; - - for (i = 0, avn = cif->nargs; i < avn; i++) - { - ffi_type *ty = arg_types[i]; - void *valp = avalue[i]; - int type = ty->type; - size_t size; - - switch (type) - { - case FFI_TYPE_INT: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - argp[argn] = extend_basic_type(valp, type, argn); - argn++; - break; - - case FFI_TYPE_LONGDOUBLE: - by_reference: - /* Note that 128-bit long double is passed by reference. */ - argp[argn++] = (unsigned long)valp; - break; - - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - size = ty->size; - memcpy(argp + argn, valp, size); - argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - break; - - case FFI_TYPE_COMPLEX: - type = ty->elements[0]->type; - if (type == FFI_TYPE_LONGDOUBLE) - goto by_reference; - - /* Most complex types passed as two separate arguments. */ - size = ty->elements[0]->size; - argp[argn] = extend_basic_type(valp, type, argn); - argp[argn + 1] = extend_basic_type(valp + size, type, argn + 1); - argn += 2; - break; - - default: - abort(); - } - } - - flags = (flags >> ALPHA_ST_SHIFT) & 0xff; - ffi_call_osf(argp, frame, flags, rvalue, fn, closure); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int(cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int(cif, fn, rvalue, avalue, closure); -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp; - - if (cif->abi != FFI_OSF) - return FFI_BAD_ABI; - - tramp = (unsigned int *) &closure->tramp[0]; - tramp[0] = 0x47fb0401; /* mov $27,$1 */ - tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ - tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */ - tramp[3] = 0x47ff041f; /* nop */ - *(void **) &tramp[4] = ffi_closure_osf; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - /* Flush the Icache. - - Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal - instead, since both Compaq as and gas can handle it. - - 0x86 is PAL_imb in Tru64 UNIX . */ - asm volatile ("call_pal 0x86" : : : "memory"); - - return FFI_OK; -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*)) -{ - if (cif->abi != FFI_OSF) - return FFI_BAD_ABI; - - closure->tramp = (void *)ffi_go_closure_osf; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -long FFI_HIDDEN -ffi_closure_osf_inner (ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *rvalue, unsigned long *argp) -{ - void **avalue; - ffi_type **arg_types; - long i, avn, argn, flags; - - avalue = alloca(cif->nargs * sizeof(void *)); - flags = cif->flags; - argn = 0; - - /* Copy the caller's structure return address to that the closure - returns the data directly to the caller. */ - if (flags == ALPHA_RET_IN_MEM) - { - rvalue = (void *) argp[0]; - argn = 1; - } - - arg_types = cif->arg_types; - - /* Grab the addresses of the arguments from the stack frame. */ - for (i = 0, avn = cif->nargs; i < avn; i++) - { - ffi_type *ty = arg_types[i]; - int type = ty->type; - void *valp = &argp[argn]; - size_t size; - - switch (type) - { - case FFI_TYPE_INT: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - argn += 1; - break; - - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - size = ty->size; - argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - break; - - case FFI_TYPE_FLOAT: - /* Floats coming from registers need conversion from double - back to float format. */ - if (argn < 6) - { - valp = &argp[argn - 6]; - sts(valp, argp[argn - 6]); - } - argn += 1; - break; - - case FFI_TYPE_DOUBLE: - if (argn < 6) - valp = &argp[argn - 6]; - argn += 1; - break; - - case FFI_TYPE_LONGDOUBLE: - by_reference: - /* 128-bit long double is passed by reference. */ - valp = (void *)argp[argn]; - argn += 1; - break; - - case FFI_TYPE_COMPLEX: - type = ty->elements[0]->type; - switch (type) - { - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - /* Passed as separate arguments, but they wind up sequential. */ - break; - - case FFI_TYPE_INT: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - /* Passed as separate arguments. Disjoint, but there's room - enough in one slot to hold the pair. */ - size = ty->elements[0]->size; - memcpy(valp + size, valp + 8, size); - break; - - case FFI_TYPE_FLOAT: - /* Passed as separate arguments. Disjoint, and each piece - may need conversion back to float. */ - if (argn < 6) - { - valp = &argp[argn - 6]; - sts(valp, argp[argn - 6]); - } - if (argn + 1 < 6) - sts(valp + 4, argp[argn + 1 - 6]); - else - *(UINT32 *)(valp + 4) = argp[argn + 1]; - break; - - case FFI_TYPE_DOUBLE: - /* Passed as separate arguments. Only disjoint if one part - is in fp regs and the other is on the stack. */ - if (argn < 5) - valp = &argp[argn - 6]; - else if (argn == 5) - { - valp = alloca(16); - ((UINT64 *)valp)[0] = argp[5 - 6]; - ((UINT64 *)valp)[1] = argp[6]; - } - break; - - case FFI_TYPE_LONGDOUBLE: - goto by_reference; - - default: - abort(); - } - argn += 2; - break; - - default: - abort (); - } - - avalue[i] = valp; - } - - /* Invoke the closure. */ - fun (cif, rvalue, avalue, user_data); - - /* Tell ffi_closure_osf how to perform return type promotions. */ - return (flags >> ALPHA_LD_SHIFT) & 0xff; -} diff --git a/llgo/third_party/gofrontend/libffi/src/alpha/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/alpha/ffitarget.h deleted file mode 100644 index a02dbd04f6df303448cfed370f5dd963330d0006..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/alpha/ffitarget.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for Alpha. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_OSF, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_OSF -} ffi_abi; -#endif - -#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION -#define FFI_TARGET_HAS_COMPLEX_TYPE - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_GO_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 24 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/alpha/internal.h b/llgo/third_party/gofrontend/libffi/src/alpha/internal.h deleted file mode 100644 index 44da1922bb9fed46f45aec80eba4bfe495db109b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/alpha/internal.h +++ /dev/null @@ -1,23 +0,0 @@ -#define ALPHA_ST_VOID 0 -#define ALPHA_ST_INT 1 -#define ALPHA_ST_FLOAT 2 -#define ALPHA_ST_DOUBLE 3 -#define ALPHA_ST_CPLXF 4 -#define ALPHA_ST_CPLXD 5 - -#define ALPHA_LD_VOID 0 -#define ALPHA_LD_INT64 1 -#define ALPHA_LD_INT32 2 -#define ALPHA_LD_UINT16 3 -#define ALPHA_LD_SINT16 4 -#define ALPHA_LD_UINT8 5 -#define ALPHA_LD_SINT8 6 -#define ALPHA_LD_FLOAT 7 -#define ALPHA_LD_DOUBLE 8 -#define ALPHA_LD_CPLXF 9 -#define ALPHA_LD_CPLXD 10 - -#define ALPHA_ST_SHIFT 0 -#define ALPHA_LD_SHIFT 8 -#define ALPHA_RET_IN_MEM 0x10000 -#define ALPHA_FLAGS(S, L) (((L) << ALPHA_LD_SHIFT) | (S)) diff --git a/llgo/third_party/gofrontend/libffi/src/alpha/osf.S b/llgo/third_party/gofrontend/libffi/src/alpha/osf.S deleted file mode 100644 index b0318282a015ac2802a7dc0fcbe313c4ce4a082e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/alpha/osf.S +++ /dev/null @@ -1,282 +0,0 @@ -/* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011, 2014 Red Hat - - Alpha/OSF Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include -#include "internal.h" - - .arch ev6 - .text - -/* Aid in building a direct addressed jump table, 4 insns per entry. */ -.macro E index - .align 4 - .org 99b + \index * 16 -.endm - -/* ffi_call_osf (void *stack, void *frame, unsigned flags, - void *raddr, void (*fnaddr)(void), void *closure) - - Bit o trickiness here -- FRAME is the base of the stack frame - for this function. This has been allocated by ffi_call. We also - deallocate some of the stack that has been alloca'd. */ - - .align 4 - .globl ffi_call_osf - .ent ffi_call_osf - FFI_HIDDEN(ffi_call_osf) - -ffi_call_osf: - cfi_startproc - cfi_def_cfa($17, 32) - mov $16, $30 - stq $26, 0($17) - stq $15, 8($17) - mov $17, $15 - .prologue 0 - cfi_def_cfa_register($15) - cfi_rel_offset($26, 0) - cfi_rel_offset($15, 8) - - stq $18, 16($17) # save flags into frame - stq $19, 24($17) # save rvalue into frame - mov $20, $27 # fn into place for call - mov $21, $1 # closure into static chain - - # Load up all of the (potential) argument registers. - ldq $16, 0($30) - ldt $f16, 0($30) - ldt $f17, 8($30) - ldq $17, 8($30) - ldt $f18, 16($30) - ldq $18, 16($30) - ldt $f19, 24($30) - ldq $19, 24($30) - ldt $f20, 32($30) - ldq $20, 32($30) - ldt $f21, 40($30) - ldq $21, 40($30) - - # Deallocate the register argument area. - lda $30, 48($30) - - jsr $26, ($27), 0 -0: - ldah $29, 0($26) !gpdisp!1 - ldq $2, 24($15) # reload rvalue - lda $29, 0($29) !gpdisp!1 - ldq $3, 16($15) # reload flags - lda $1, 99f-0b($26) - ldq $26, 0($15) - ldq $15, 8($15) - cfi_restore($26) - cfi_restore($15) - cfi_def_cfa($sp, 0) - cmoveq $2, ALPHA_ST_VOID, $3 # mash null rvalue to void - addq $3, $3, $3 - s8addq $3, $1, $1 # 99f + stcode * 16 - jmp $31, ($1), $st_int - - .align 4 -99: -E ALPHA_ST_VOID - ret -E ALPHA_ST_INT -$st_int: - stq $0, 0($2) - ret -E ALPHA_ST_FLOAT - sts $f0, 0($2) - ret -E ALPHA_ST_DOUBLE - stt $f0, 0($2) - ret -E ALPHA_ST_CPLXF - sts $f0, 0($2) - sts $f1, 4($2) - ret -E ALPHA_ST_CPLXD - stt $f0, 0($2) - stt $f1, 8($2) - ret - - cfi_endproc - .end ffi_call_osf - -/* ffi_closure_osf(...) - - Receives the closure argument in $1. */ - -#define CLOSURE_FS (16*8) - - .align 4 - .globl ffi_go_closure_osf - .ent ffi_go_closure_osf - FFI_HIDDEN(ffi_go_closure_osf) - -ffi_go_closure_osf: - cfi_startproc - ldgp $29, 0($27) - subq $30, CLOSURE_FS, $30 - cfi_adjust_cfa_offset(CLOSURE_FS) - stq $26, 0($30) - .prologue 1 - cfi_rel_offset($26, 0) - - stq $16, 10*8($30) - stq $17, 11*8($30) - stq $18, 12*8($30) - - ldq $16, 8($1) # load cif - ldq $17, 16($1) # load fun - mov $1, $18 # closure is user_data - br $do_closure - - cfi_endproc - .end ffi_go_closure_osf - - .align 4 - .globl ffi_closure_osf - .ent ffi_closure_osf - FFI_HIDDEN(ffi_closure_osf) - -ffi_closure_osf: - cfi_startproc - ldgp $29, 0($27) - subq $30, CLOSURE_FS, $30 - cfi_adjust_cfa_offset(CLOSURE_FS) - stq $26, 0($30) - .prologue 1 - cfi_rel_offset($26, 0) - - # Store all of the potential argument registers in va_list format. - stq $16, 10*8($30) - stq $17, 11*8($30) - stq $18, 12*8($30) - - ldq $16, 24($1) # load cif - ldq $17, 32($1) # load fun - ldq $18, 40($1) # load user_data - -$do_closure: - stq $19, 13*8($30) - stq $20, 14*8($30) - stq $21, 15*8($30) - stt $f16, 4*8($30) - stt $f17, 5*8($30) - stt $f18, 6*8($30) - stt $f19, 7*8($30) - stt $f20, 8*8($30) - stt $f21, 9*8($30) - - # Call ffi_closure_osf_inner to do the bulk of the work. - lda $19, 2*8($30) - lda $20, 10*8($30) - jsr $26, ffi_closure_osf_inner -0: - ldah $29, 0($26) !gpdisp!2 - lda $2, 99f-0b($26) - s4addq $0, 0, $1 # ldcode * 4 - ldq $0, 16($30) # preload return value - s4addq $1, $2, $1 # 99f + ldcode * 16 - lda $29, 0($29) !gpdisp!2 - ldq $26, 0($30) - cfi_restore($26) - jmp $31, ($1), $load_32 - -.macro epilogue - addq $30, CLOSURE_FS, $30 - cfi_adjust_cfa_offset(-CLOSURE_FS) - ret - .align 4 - cfi_adjust_cfa_offset(CLOSURE_FS) -.endm - - .align 4 -99: -E ALPHA_LD_VOID - epilogue - -E ALPHA_LD_INT64 - epilogue - -E ALPHA_LD_INT32 -$load_32: - sextl $0, $0 - epilogue - -E ALPHA_LD_UINT16 - zapnot $0, 3, $0 - epilogue - -E ALPHA_LD_SINT16 -#ifdef __alpha_bwx__ - sextw $0, $0 -#else - sll $0, 48, $0 - sra $0, 48, $0 -#endif - epilogue - -E ALPHA_LD_UINT8 - and $0, 0xff, $0 - epilogue - -E ALPHA_LD_SINT8 -#ifdef __alpha_bwx__ - sextb $0, $0 -#else - sll $0, 56, $0 - sra $0, 56, $0 -#endif - epilogue - -E ALPHA_LD_FLOAT - lds $f0, 16($sp) - epilogue - -E ALPHA_LD_DOUBLE - ldt $f0, 16($sp) - epilogue - -E ALPHA_LD_CPLXF - lds $f0, 16($sp) - lds $f1, 20($sp) - epilogue - -E ALPHA_LD_CPLXD - ldt $f0, 16($sp) - ldt $f1, 24($sp) - epilogue - - cfi_endproc - .end ffi_closure_osf - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/arc/arcompact.S b/llgo/third_party/gofrontend/libffi/src/arc/arcompact.S deleted file mode 100644 index 03715fde49f7a1ff02c82be3b09362cf0b871e17..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arc/arcompact.S +++ /dev/null @@ -1,135 +0,0 @@ -/* ----------------------------------------------------------------------- - arcompact.S - Copyright (c) 2013 Synposys, Inc. (www.synopsys.com) - - ARCompact Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -#define CNAME(x) x -#define ENTRY(x) .globl CNAME(x)` .type CNAME(x),%function` CNAME(x): -#endif - -.text - - /* R0: ffi_prep_args */ - /* R1: &ecif */ - /* R2: cif->bytes */ - /* R3: fig->flags */ - /* R4: ecif.rvalue */ - /* R5: fn */ -ENTRY(ffi_call_ARCompact) - /* Save registers. */ - st.a fp, [sp, -4] /* fp + 20, fp */ - push_s blink /* fp + 16, blink */ - st.a r4, [sp, -4] /* fp + 12, ecif.rvalue */ - push_s r3 /* fp + 8, fig->flags */ - st.a r5, [sp, -4] /* fp + 4, fn */ - push_s r2 /* fp + 0, cif->bytes */ - mov fp, sp - - /* Make room for all of the new args. */ - sub sp, sp, r2 - - /* Place all of the ffi_prep_args in position. */ - /* ffi_prep_args(char *stack, extended_cif *ecif) */ - /* R1 already set. */ - - /* And call. */ - jl_s.d [r0] - mov_s r0, sp - - ld.ab r12, [fp, 4] /* cif->bytes */ - ld.ab r11, [fp, 4] /* fn */ - - /* Move first 8 parameters in registers... */ - ld_s r0, [sp] - ld_s r1, [sp, 4] - ld_s r2, [sp, 8] - ld_s r3, [sp, 12] - ld r4, [sp, 16] - ld r5, [sp, 20] - ld r6, [sp, 24] - ld r7, [sp, 28] - - /* ...and adjust the stack. */ - min r12, r12, 32 - - /* Call the function. */ - jl.d [r11] - add sp, sp, r12 - - mov sp, fp - pop_s r3 /* fig->flags, return type */ - pop_s r2 /* ecif.rvalue, pointer for return value */ - - /* If the return value pointer is NULL, assume no return value. */ - breq.d r2, 0, epilogue - pop_s blink - - /* Return INT. */ - brne r3, FFI_TYPE_INT, return_double - b.d epilogue - st_s r0, [r2] - -return_double: - brne r3, FFI_TYPE_DOUBLE, epilogue - st_s r0, [r2] - st_s r1, [r2,4] - -epilogue: - j_s.d [blink] - ld.ab fp, [sp, 4] - -ENTRY(ffi_closure_ARCompact) - st.a r0, [sp, -32] - st_s r1, [sp, 4] - st_s r2, [sp, 8] - st_s r3, [sp, 12] - st r4, [sp, 16] - st r5, [sp, 20] - st r6, [sp, 24] - st r7, [sp, 28] - - /* pointer to arguments */ - mov_s r2, sp - - /* return value goes here */ - sub sp, sp, 8 - mov_s r1, sp - - push_s blink - - bl.d ffi_closure_inner_ARCompact - mov_s r0, r8 /* codeloc, set by trampoline */ - - pop_s blink - - /* set return value to r1:r0 */ - pop_s r0 - pop_s r1 - j_s.d [blink] - add_s sp, sp, 32 diff --git a/llgo/third_party/gofrontend/libffi/src/arc/ffi.c b/llgo/third_party/gofrontend/libffi/src/arc/ffi.c deleted file mode 100644 index 32f82a7d5bb54fcb674c43590f4d9bfa646e69ad..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arc/ffi.c +++ /dev/null @@ -1,268 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2013 Synopsys, Inc. (www.synopsys.com) - - ARC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include - -#include - -/* for little endian ARC, the code is in fact stored as mixed endian for - performance reasons */ -#if __BIG_ENDIAN__ -#define CODE_ENDIAN(x) (x) -#else -#define CODE_ENDIAN(x) ( (((uint32_t) (x)) << 16) | (((uint32_t) (x)) >> 16)) -#endif - -/* ffi_prep_args is called by the assembly routine once stack - space has been allocated for the function's arguments. */ - -void -ffi_prep_args (char *stack, extended_cif * ecif) -{ - unsigned int i; - int tmp; - void **p_argv; - char *argp; - ffi_type **p_arg; - - tmp = 0; - argp = stack; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) - { - *(void **) argp = ecif->rvalue; - argp += 4; - } - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); i--, p_arg++) - { - size_t z; - int alignment; - - /* align alignment to 4 */ - alignment = (((*p_arg)->alignment - 1) | 3) + 1; - - /* Align if necessary. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) ALIGN (argp, alignment); - - z = (*p_arg)->size; - if (z < sizeof (int)) - { - z = sizeof (int); - - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) (*p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) (*p_argv); - break; - - case FFI_TYPE_STRUCT: - memcpy (argp, *p_argv, (*p_arg)->size); - break; - - default: - FFI_ASSERT (0); - } - } - else if (z == sizeof (int)) - { - *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); - } - else - { - if ((*p_arg)->type == FFI_TYPE_STRUCT) - { - memcpy (argp, *p_argv, z); - } - else - { - /* Double or long long 64bit. */ - memcpy (argp, *p_argv, z); - } - } - p_argv++; - argp += z; - } - - return; -} - -/* Perform machine dependent cif processing. */ -ffi_status -ffi_prep_cif_machdep (ffi_cif * cif) -{ - /* Set the return type flag. */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_STRUCT: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - cif->flags = FFI_TYPE_DOUBLE; - break; - - case FFI_TYPE_FLOAT: - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -extern void ffi_call_ARCompact (void (*)(char *, extended_cif *), - extended_cif *, unsigned, unsigned, - unsigned *, void (*fn) (void)); - -void -ffi_call (ffi_cif * cif, void (*fn) (void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have - a return value address then we need to make one. */ - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca (cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_ARCOMPACT: - ffi_call_ARCompact (ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - - default: - FFI_ASSERT (0); - break; - } -} - -int -ffi_closure_inner_ARCompact (ffi_closure * closure, void *rvalue, - ffi_arg * args) -{ - void **arg_area, **p_argv; - ffi_cif *cif = closure->cif; - char *argp = (char *) args; - ffi_type **p_argt; - int i; - - arg_area = (void **) alloca (cif->nargs * sizeof (void *)); - - /* handle hidden argument */ - if (cif->flags == FFI_TYPE_STRUCT) - { - rvalue = *(void **) argp; - argp += 4; - } - - p_argv = arg_area; - - for (i = 0, p_argt = cif->arg_types; i < cif->nargs; - i++, p_argt++, p_argv++) - { - size_t z; - int alignment; - - /* align alignment to 4 */ - alignment = (((*p_argt)->alignment - 1) | 3) + 1; - - /* Align if necessary. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) ALIGN (argp, alignment); - - z = (*p_argt)->size; - *p_argv = (void *) argp; - argp += z; - } - - (closure->fun) (cif, rvalue, arg_area, closure->user_data); - - return cif->flags; -} - -extern void ffi_closure_ARCompact (void); - -ffi_status -ffi_prep_closure_loc (ffi_closure * closure, ffi_cif * cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, void *codeloc) -{ - uint32_t *tramp = (uint32_t *) & (closure->tramp[0]); - - switch (cif->abi) - { - case FFI_ARCOMPACT: - FFI_ASSERT (tramp == codeloc); - tramp[0] = CODE_ENDIAN (0x200a1fc0); /* mov r8, pcl */ - tramp[1] = CODE_ENDIAN (0x20200f80); /* j [long imm] */ - tramp[2] = CODE_ENDIAN (ffi_closure_ARCompact); - break; - - default: - return FFI_BAD_ABI; - } - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - cacheflush (codeloc, FFI_TRAMPOLINE_SIZE, BCACHE); - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/arc/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/arc/ffitarget.h deleted file mode 100644 index bf8311bc832c52a64c31784c496c49e820d041d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arc/ffitarget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ----------------------------------------------------------------------- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 2013 Synopsys, Inc. (www.synopsys.com) - Target configuration macros for ARC. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- Generic type definitions ----------------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi -{ - FFI_FIRST_ABI = 0, - FFI_ARCOMPACT, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_ARCOMPACT -} ffi_abi; -#endif - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 12 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/arm/ffi.c b/llgo/third_party/gofrontend/libffi/src/arm/ffi.c deleted file mode 100644 index 9c8732d158cd1573544e095cd5e568e7c4a1e9f3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arm/ffi.c +++ /dev/null @@ -1,1043 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011 Timothy Wall - Copyright (c) 2011 Plausible Labs Cooperative, Inc. - Copyright (c) 2011 Anthony Green - Copyright (c) 2011 Free Software Foundation - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. - - ARM Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include "internal.h" - -/* Forward declares. */ -static int vfp_type_p (const ffi_type *); -static void layout_vfp_args (ffi_cif *); - -static void * -ffi_align (ffi_type *ty, void *p) -{ - /* Align if necessary */ - size_t alignment; -#ifdef _WIN32_WCE - alignment = 4; -#else - alignment = ty->alignment; - if (alignment < 4) - alignment = 4; -#endif - return (void *) ALIGN (p, alignment); -} - -static size_t -ffi_put_arg (ffi_type *ty, void *src, void *dst) -{ - size_t z = ty->size; - - switch (ty->type) - { - case FFI_TYPE_SINT8: - *(UINT32 *)dst = *(SINT8 *)src; - break; - case FFI_TYPE_UINT8: - *(UINT32 *)dst = *(UINT8 *)src; - break; - case FFI_TYPE_SINT16: - *(UINT32 *)dst = *(SINT16 *)src; - break; - case FFI_TYPE_UINT16: - *(UINT32 *)dst = *(UINT16 *)src; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - case FFI_TYPE_FLOAT: - *(UINT32 *)dst = *(UINT32 *)src; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - *(UINT64 *)dst = *(UINT64 *)src; - break; - - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - memcpy (dst, src, z); - break; - - default: - abort(); - } - - return ALIGN (z, 4); -} - -/* ffi_prep_args is called once stack space has been allocated - for the function's arguments. - - The vfp_space parameter is the load area for VFP regs, the return - value is cif->vfp_used (word bitset of VFP regs used for passing - arguments). These are only used for the VFP hard-float ABI. -*/ -static void -ffi_prep_args_SYSV (ffi_cif *cif, int flags, void *rvalue, - void **avalue, char *argp) -{ - ffi_type **arg_types = cif->arg_types; - int i, n; - - if (flags == ARM_TYPE_STRUCT) - { - *(void **) argp = rvalue; - argp += 4; - } - - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *ty = arg_types[i]; - argp = ffi_align (ty, argp); - argp += ffi_put_arg (ty, avalue[i], argp); - } -} - -static void -ffi_prep_args_VFP (ffi_cif *cif, int flags, void *rvalue, - void **avalue, char *stack, char *vfp_space) -{ - ffi_type **arg_types = cif->arg_types; - int i, n, vi = 0; - char *argp, *regp, *eo_regp; - char stack_used = 0; - char done_with_regs = 0; - - /* The first 4 words on the stack are used for values - passed in core registers. */ - regp = stack; - eo_regp = argp = regp + 16; - - /* If the function returns an FFI_TYPE_STRUCT in memory, - that address is passed in r0 to the function. */ - if (flags == ARM_TYPE_STRUCT) - { - *(void **) regp = rvalue; - regp += 4; - } - - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *ty = arg_types[i]; - void *a = avalue[i]; - int is_vfp_type = vfp_type_p (ty); - - /* Allocated in VFP registers. */ - if (vi < cif->vfp_nargs && is_vfp_type) - { - char *vfp_slot = vfp_space + cif->vfp_args[vi++] * 4; - ffi_put_arg (ty, a, vfp_slot); - continue; - } - /* Try allocating in core registers. */ - else if (!done_with_regs && !is_vfp_type) - { - char *tregp = ffi_align (ty, regp); - size_t size = ty->size; - size = (size < 4) ? 4 : size; // pad - /* Check if there is space left in the aligned register - area to place the argument. */ - if (tregp + size <= eo_regp) - { - regp = tregp + ffi_put_arg (ty, a, tregp); - done_with_regs = (regp == argp); - // ensure we did not write into the stack area - FFI_ASSERT (regp <= argp); - continue; - } - /* In case there are no arguments in the stack area yet, - the argument is passed in the remaining core registers - and on the stack. */ - else if (!stack_used) - { - stack_used = 1; - done_with_regs = 1; - argp = tregp + ffi_put_arg (ty, a, tregp); - FFI_ASSERT (eo_regp < argp); - continue; - } - } - /* Base case, arguments are passed on the stack */ - stack_used = 1; - argp = ffi_align (ty, argp); - argp += ffi_put_arg (ty, a, argp); - } -} - -/* Perform machine dependent cif processing */ -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - int flags = 0, cabi = cif->abi; - size_t bytes = cif->bytes; - - /* Map out the register placements of VFP register args. The VFP - hard-float calling conventions are slightly more sophisticated - than the base calling conventions, so we do it here instead of - in ffi_prep_args(). */ - if (cabi == FFI_VFP) - layout_vfp_args (cif); - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - flags = ARM_TYPE_VOID; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - flags = ARM_TYPE_INT; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - flags = ARM_TYPE_INT64; - break; - - case FFI_TYPE_FLOAT: - flags = (cabi == FFI_VFP ? ARM_TYPE_VFP_S : ARM_TYPE_INT); - break; - case FFI_TYPE_DOUBLE: - flags = (cabi == FFI_VFP ? ARM_TYPE_VFP_D : ARM_TYPE_INT64); - break; - - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - if (cabi == FFI_VFP) - { - int h = vfp_type_p (cif->rtype); - - flags = ARM_TYPE_VFP_N; - if (h == 0x100 + FFI_TYPE_FLOAT) - flags = ARM_TYPE_VFP_S; - if (h == 0x100 + FFI_TYPE_DOUBLE) - flags = ARM_TYPE_VFP_D; - if (h != 0) - break; - } - - /* A Composite Type not larger than 4 bytes is returned in r0. - A Composite Type larger than 4 bytes, or whose size cannot - be determined statically ... is stored in memory at an - address passed [in r0]. */ - if (cif->rtype->size <= 4) - flags = ARM_TYPE_INT; - else - { - flags = ARM_TYPE_STRUCT; - bytes += 4; - } - break; - - default: - abort(); - } - - /* Round the stack up to a multiple of 8 bytes. This isn't needed - everywhere, but it is on some platforms, and it doesn't harm anything - when it isn't needed. */ - bytes = ALIGN (bytes, 8); - - /* Minimum stack space is the 4 register arguments that we pop. */ - if (bytes < 4*4) - bytes = 4*4; - - cif->bytes = bytes; - cif->flags = flags; - - return FFI_OK; -} - -/* Perform machine dependent cif processing for variadic calls */ -ffi_status -ffi_prep_cif_machdep_var (ffi_cif * cif, - unsigned int nfixedargs, unsigned int ntotalargs) -{ - /* VFP variadic calls actually use the SYSV ABI */ - if (cif->abi == FFI_VFP) - cif->abi = FFI_SYSV; - - return ffi_prep_cif_machdep (cif); -} - -/* Prototypes for assembly functions, in sysv.S. */ - -struct call_frame -{ - void *fp; - void *lr; - void *rvalue; - int flags; - void *closure; -}; - -extern void ffi_call_SYSV (void *stack, struct call_frame *, - void (*fn) (void)) FFI_HIDDEN; -extern void ffi_call_VFP (void *vfp_space, struct call_frame *, - void (*fn) (void), unsigned vfp_used) FFI_HIDDEN; - -static void -ffi_call_int (ffi_cif * cif, void (*fn) (void), void *rvalue, - void **avalue, void *closure) -{ - int flags = cif->flags; - ffi_type *rtype = cif->rtype; - size_t bytes, rsize, vfp_size; - char *stack, *vfp_space, *new_rvalue; - struct call_frame *frame; - - rsize = 0; - if (rvalue == NULL) - { - /* If the return value is a struct and we don't have a return - value address then we need to make one. Otherwise the return - value is in registers and we can ignore them. */ - if (flags == ARM_TYPE_STRUCT) - rsize = rtype->size; - else - flags = ARM_TYPE_VOID; - } - else if (flags == ARM_TYPE_VFP_N) - { - /* Largest case is double x 4. */ - rsize = 32; - } - else if (flags == ARM_TYPE_INT && rtype->type == FFI_TYPE_STRUCT) - rsize = 4; - - /* Largest case. */ - vfp_size = (cif->abi == FFI_VFP && cif->vfp_used ? 8*8: 0); - - bytes = cif->bytes; - stack = alloca (vfp_size + bytes + sizeof(struct call_frame) + rsize); - - vfp_space = NULL; - if (vfp_size) - { - vfp_space = stack; - stack += vfp_size; - } - - frame = (struct call_frame *)(stack + bytes); - - new_rvalue = rvalue; - if (rsize) - new_rvalue = (void *)(frame + 1); - - frame->rvalue = new_rvalue; - frame->flags = flags; - frame->closure = closure; - - if (vfp_space) - { - ffi_prep_args_VFP (cif, flags, new_rvalue, avalue, stack, vfp_space); - ffi_call_VFP (vfp_space, frame, fn, cif->vfp_used); - } - else - { - ffi_prep_args_SYSV (cif, flags, new_rvalue, avalue, stack); - ffi_call_SYSV (stack, frame, fn); - } - - if (rvalue && rvalue != new_rvalue) - memcpy (rvalue, new_rvalue, rtype->size); -} - -void -ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - -static void * -ffi_prep_incoming_args_SYSV (ffi_cif *cif, void *rvalue, - char *argp, void **avalue) -{ - ffi_type **arg_types = cif->arg_types; - int i, n; - - if (cif->flags == ARM_TYPE_STRUCT) - { - rvalue = *(void **) argp; - argp += 4; - } - - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *ty = arg_types[i]; - size_t z = ty->size; - - argp = ffi_align (ty, argp); - avalue[i] = (void *) argp; - argp += z; - } - - return rvalue; -} - -static void * -ffi_prep_incoming_args_VFP (ffi_cif *cif, void *rvalue, char *stack, - char *vfp_space, void **avalue) -{ - ffi_type **arg_types = cif->arg_types; - int i, n, vi = 0; - char *argp, *regp, *eo_regp; - char done_with_regs = 0; - char stack_used = 0; - - regp = stack; - eo_regp = argp = regp + 16; - - if (cif->flags == ARM_TYPE_STRUCT) - { - rvalue = *(void **) regp; - regp += 4; - } - - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *ty = arg_types[i]; - int is_vfp_type = vfp_type_p (ty); - size_t z = ty->size; - - if (vi < cif->vfp_nargs && is_vfp_type) - { - avalue[i] = vfp_space + cif->vfp_args[vi++] * 4; - continue; - } - else if (!done_with_regs && !is_vfp_type) - { - char *tregp = ffi_align (ty, regp); - - z = (z < 4) ? 4 : z; // pad - - /* If the arguments either fits into the registers or uses registers - and stack, while we haven't read other things from the stack */ - if (tregp + z <= eo_regp || !stack_used) - { - /* Because we're little endian, this is what it turns into. */ - avalue[i] = (void *) tregp; - regp = tregp + z; - - /* If we read past the last core register, make sure we - have not read from the stack before and continue - reading after regp. */ - if (regp > eo_regp) - { - FFI_ASSERT (!stack_used); - argp = regp; - } - if (regp >= eo_regp) - { - done_with_regs = 1; - stack_used = 1; - } - continue; - } - } - - stack_used = 1; - argp = ffi_align (ty, argp); - avalue[i] = (void *) argp; - argp += z; - } - - return rvalue; -} - -struct closure_frame -{ - char vfp_space[8*8] __attribute__((aligned(8))); - char result[8*4]; - char argp[]; -}; - -int FFI_HIDDEN -ffi_closure_inner_SYSV (ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - struct closure_frame *frame) -{ - void **avalue = (void **) alloca (cif->nargs * sizeof (void *)); - void *rvalue = ffi_prep_incoming_args_SYSV (cif, frame->result, - frame->argp, avalue); - fun (cif, rvalue, avalue, user_data); - return cif->flags; -} - -int FFI_HIDDEN -ffi_closure_inner_VFP (ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - struct closure_frame *frame) -{ - void **avalue = (void **) alloca (cif->nargs * sizeof (void *)); - void *rvalue = ffi_prep_incoming_args_VFP (cif, frame->result, frame->argp, - frame->vfp_space, avalue); - fun (cif, rvalue, avalue, user_data); - return cif->flags; -} - -void ffi_closure_SYSV (void) FFI_HIDDEN; -void ffi_closure_VFP (void) FFI_HIDDEN; -void ffi_go_closure_SYSV (void) FFI_HIDDEN; -void ffi_go_closure_VFP (void) FFI_HIDDEN; - -#if FFI_EXEC_TRAMPOLINE_TABLE - -#include -#include -#include -#include - -extern void *ffi_closure_trampoline_table_page; - -typedef struct ffi_trampoline_table ffi_trampoline_table; -typedef struct ffi_trampoline_table_entry ffi_trampoline_table_entry; - -struct ffi_trampoline_table -{ - /* contiguous writable and executable pages */ - vm_address_t config_page; - vm_address_t trampoline_page; - - /* free list tracking */ - uint16_t free_count; - ffi_trampoline_table_entry *free_list; - ffi_trampoline_table_entry *free_list_pool; - - ffi_trampoline_table *prev; - ffi_trampoline_table *next; -}; - -struct ffi_trampoline_table_entry -{ - void *(*trampoline) (); - ffi_trampoline_table_entry *next; -}; - -/* Override the standard architecture trampoline size */ -// XXX TODO - Fix -#undef FFI_TRAMPOLINE_SIZE -#define FFI_TRAMPOLINE_SIZE 12 - -/* The trampoline configuration is placed at 4080 bytes prior to the trampoline's entry point */ -#define FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc) ((void **) (((uint8_t *) codeloc) - 4080)); - -/* The first 16 bytes of the config page are unused, as they are unaddressable from the trampoline page. */ -#define FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET 16 - -/* Total number of trampolines that fit in one trampoline table */ -#define FFI_TRAMPOLINE_COUNT ((PAGE_SIZE - FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) / FFI_TRAMPOLINE_SIZE) - -static pthread_mutex_t ffi_trampoline_lock = PTHREAD_MUTEX_INITIALIZER; -static ffi_trampoline_table *ffi_trampoline_tables = NULL; - -static ffi_trampoline_table * -ffi_trampoline_table_alloc () -{ - ffi_trampoline_table *table = NULL; - - /* Loop until we can allocate two contiguous pages */ - while (table == NULL) - { - vm_address_t config_page = 0x0; - kern_return_t kt; - - /* Try to allocate two pages */ - kt = - vm_allocate (mach_task_self (), &config_page, PAGE_SIZE * 2, - VM_FLAGS_ANYWHERE); - if (kt != KERN_SUCCESS) - { - fprintf (stderr, "vm_allocate() failure: %d at %s:%d\n", kt, - __FILE__, __LINE__); - break; - } - - /* Now drop the second half of the allocation to make room for the trampoline table */ - vm_address_t trampoline_page = config_page + PAGE_SIZE; - kt = vm_deallocate (mach_task_self (), trampoline_page, PAGE_SIZE); - if (kt != KERN_SUCCESS) - { - fprintf (stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, - __FILE__, __LINE__); - break; - } - - /* Remap the trampoline table to directly follow the config page */ - vm_prot_t cur_prot; - vm_prot_t max_prot; - - kt = - vm_remap (mach_task_self (), &trampoline_page, PAGE_SIZE, 0x0, FALSE, - mach_task_self (), - (vm_address_t) & ffi_closure_trampoline_table_page, FALSE, - &cur_prot, &max_prot, VM_INHERIT_SHARE); - - /* If we lost access to the destination trampoline page, drop our config allocation mapping and retry */ - if (kt != KERN_SUCCESS) - { - /* Log unexpected failures */ - if (kt != KERN_NO_SPACE) - { - fprintf (stderr, "vm_remap() failure: %d at %s:%d\n", kt, - __FILE__, __LINE__); - } - - vm_deallocate (mach_task_self (), config_page, PAGE_SIZE); - continue; - } - - /* We have valid trampoline and config pages */ - table = calloc (1, sizeof (ffi_trampoline_table)); - table->free_count = FFI_TRAMPOLINE_COUNT; - table->config_page = config_page; - table->trampoline_page = trampoline_page; - - /* Create and initialize the free list */ - table->free_list_pool = - calloc (FFI_TRAMPOLINE_COUNT, sizeof (ffi_trampoline_table_entry)); - - uint16_t i; - for (i = 0; i < table->free_count; i++) - { - ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; - entry->trampoline = - (void *) (table->trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); - - if (i < table->free_count - 1) - entry->next = &table->free_list_pool[i + 1]; - } - - table->free_list = table->free_list_pool; - } - - return table; -} - -void * -ffi_closure_alloc (size_t size, void **code) -{ - /* Create the closure */ - ffi_closure *closure = malloc (size); - if (closure == NULL) - return NULL; - - pthread_mutex_lock (&ffi_trampoline_lock); - - /* Check for an active trampoline table with available entries. */ - ffi_trampoline_table *table = ffi_trampoline_tables; - if (table == NULL || table->free_list == NULL) - { - table = ffi_trampoline_table_alloc (); - if (table == NULL) - { - free (closure); - return NULL; - } - - /* Insert the new table at the top of the list */ - table->next = ffi_trampoline_tables; - if (table->next != NULL) - table->next->prev = table; - - ffi_trampoline_tables = table; - } - - /* Claim the free entry */ - ffi_trampoline_table_entry *entry = ffi_trampoline_tables->free_list; - ffi_trampoline_tables->free_list = entry->next; - ffi_trampoline_tables->free_count--; - entry->next = NULL; - - pthread_mutex_unlock (&ffi_trampoline_lock); - - /* Initialize the return values */ - *code = entry->trampoline; - closure->trampoline_table = table; - closure->trampoline_table_entry = entry; - - return closure; -} - -void -ffi_closure_free (void *ptr) -{ - ffi_closure *closure = ptr; - - pthread_mutex_lock (&ffi_trampoline_lock); - - /* Fetch the table and entry references */ - ffi_trampoline_table *table = closure->trampoline_table; - ffi_trampoline_table_entry *entry = closure->trampoline_table_entry; - - /* Return the entry to the free list */ - entry->next = table->free_list; - table->free_list = entry; - table->free_count++; - - /* If all trampolines within this table are free, and at least one other table exists, deallocate - * the table */ - if (table->free_count == FFI_TRAMPOLINE_COUNT - && ffi_trampoline_tables != table) - { - /* Remove from the list */ - if (table->prev != NULL) - table->prev->next = table->next; - - if (table->next != NULL) - table->next->prev = table->prev; - - /* Deallocate pages */ - kern_return_t kt; - kt = vm_deallocate (mach_task_self (), table->config_page, PAGE_SIZE); - if (kt != KERN_SUCCESS) - fprintf (stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, - __FILE__, __LINE__); - - kt = - vm_deallocate (mach_task_self (), table->trampoline_page, PAGE_SIZE); - if (kt != KERN_SUCCESS) - fprintf (stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, - __FILE__, __LINE__); - - /* Deallocate free list */ - free (table->free_list_pool); - free (table); - } - else if (ffi_trampoline_tables != table) - { - /* Otherwise, bump this table to the top of the list */ - table->prev = NULL; - table->next = ffi_trampoline_tables; - if (ffi_trampoline_tables != NULL) - ffi_trampoline_tables->prev = table; - - ffi_trampoline_tables = table; - } - - pthread_mutex_unlock (&ffi_trampoline_lock); - - /* Free the closure */ - free (closure); -} - -#else - -extern unsigned int ffi_arm_trampoline[2] FFI_HIDDEN; - -#endif - -/* the cif must already be prep'ed */ - -ffi_status -ffi_prep_closure_loc (ffi_closure * closure, - ffi_cif * cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, void *codeloc) -{ - void (*closure_func) (void) = ffi_closure_SYSV; - - if (cif->abi == FFI_VFP) - { - /* We only need take the vfp path if there are vfp arguments. */ - if (cif->vfp_used) - closure_func = ffi_closure_VFP; - } - else if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - -#if FFI_EXEC_TRAMPOLINE_TABLE - void **config = FFI_TRAMPOLINE_CODELOC_CONFIG (codeloc); - config[0] = closure; - config[1] = closure_func; -#else - memcpy (closure->tramp, ffi_arm_trampoline, 8); - __clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */ - __clear_cache(codeloc, codeloc + 8); /* clear insn map */ - *(void (**)(void))(closure->tramp + 8) = closure_func; -#endif - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *)) -{ - void (*closure_func) (void) = ffi_go_closure_SYSV; - - if (cif->abi == FFI_VFP) - { - /* We only need take the vfp path if there are vfp arguments. */ - if (cif->vfp_used) - closure_func = ffi_go_closure_VFP; - } - else if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - closure->tramp = closure_func; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -/* Below are routines for VFP hard-float support. */ - -/* A subroutine of vfp_type_p. Given a structure type, return the type code - of the first non-structure element. Recurse for structure elements. - Return -1 if the structure is in fact empty, i.e. no nested elements. */ - -static int -is_hfa0 (const ffi_type *ty) -{ - ffi_type **elements = ty->elements; - int i, ret = -1; - - if (elements != NULL) - for (i = 0; elements[i]; ++i) - { - ret = elements[i]->type; - if (ret == FFI_TYPE_STRUCT || ret == FFI_TYPE_COMPLEX) - { - ret = is_hfa0 (elements[i]); - if (ret < 0) - continue; - } - break; - } - - return ret; -} - -/* A subroutine of vfp_type_p. Given a structure type, return true if all - of the non-structure elements are the same as CANDIDATE. */ - -static int -is_hfa1 (const ffi_type *ty, int candidate) -{ - ffi_type **elements = ty->elements; - int i; - - if (elements != NULL) - for (i = 0; elements[i]; ++i) - { - int t = elements[i]->type; - if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX) - { - if (!is_hfa1 (elements[i], candidate)) - return 0; - } - else if (t != candidate) - return 0; - } - - return 1; -} - -/* Determine if TY is an homogenous floating point aggregate (HFA). - That is, a structure consisting of 1 to 4 members of all the same type, - where that type is a floating point scalar. - - Returns non-zero iff TY is an HFA. The result is an encoded value where - bits 0-7 contain the type code, and bits 8-10 contain the element count. */ - -static int -vfp_type_p (const ffi_type *ty) -{ - ffi_type **elements; - int candidate, i; - size_t size, ele_count; - - /* Quickest tests first. */ - candidate = ty->type; - switch (ty->type) - { - default: - return 0; - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - ele_count = 1; - goto done; - case FFI_TYPE_COMPLEX: - candidate = ty->elements[0]->type; - if (candidate != FFI_TYPE_FLOAT && candidate != FFI_TYPE_DOUBLE) - return 0; - ele_count = 2; - goto done; - case FFI_TYPE_STRUCT: - break; - } - - /* No HFA types are smaller than 4 bytes, or larger than 32 bytes. */ - size = ty->size; - if (size < 4 || size > 32) - return 0; - - /* Find the type of the first non-structure member. */ - elements = ty->elements; - candidate = elements[0]->type; - if (candidate == FFI_TYPE_STRUCT || candidate == FFI_TYPE_COMPLEX) - { - for (i = 0; ; ++i) - { - candidate = is_hfa0 (elements[i]); - if (candidate >= 0) - break; - } - } - - /* If the first member is not a floating point type, it's not an HFA. - Also quickly re-check the size of the structure. */ - switch (candidate) - { - case FFI_TYPE_FLOAT: - ele_count = size / sizeof(float); - if (size != ele_count * sizeof(float)) - return 0; - break; - case FFI_TYPE_DOUBLE: - ele_count = size / sizeof(double); - if (size != ele_count * sizeof(double)) - return 0; - break; - default: - return 0; - } - if (ele_count > 4) - return 0; - - /* Finally, make sure that all scalar elements are the same type. */ - for (i = 0; elements[i]; ++i) - { - int t = elements[i]->type; - if (t == FFI_TYPE_STRUCT || t == FFI_TYPE_COMPLEX) - { - if (!is_hfa1 (elements[i], candidate)) - return 0; - } - else if (t != candidate) - return 0; - } - - /* All tests succeeded. Encode the result. */ - done: - return (ele_count << 8) | candidate; -} - -static int -place_vfp_arg (ffi_cif *cif, int h) -{ - unsigned short reg = cif->vfp_reg_free; - int align = 1, nregs = h >> 8; - - if ((h & 0xff) == FFI_TYPE_DOUBLE) - align = 2, nregs *= 2; - - /* Align register number. */ - if ((reg & 1) && align == 2) - reg++; - - while (reg + nregs <= 16) - { - int s, new_used = 0; - for (s = reg; s < reg + nregs; s++) - { - new_used |= (1 << s); - if (cif->vfp_used & (1 << s)) - { - reg += align; - goto next_reg; - } - } - /* Found regs to allocate. */ - cif->vfp_used |= new_used; - cif->vfp_args[cif->vfp_nargs++] = reg; - - /* Update vfp_reg_free. */ - if (cif->vfp_used & (1 << cif->vfp_reg_free)) - { - reg += nregs; - while (cif->vfp_used & (1 << reg)) - reg += 1; - cif->vfp_reg_free = reg; - } - return 0; - next_reg:; - } - // done, mark all regs as used - cif->vfp_reg_free = 16; - cif->vfp_used = 0xFFFF; - return 1; -} - -static void -layout_vfp_args (ffi_cif * cif) -{ - int i; - /* Init VFP fields */ - cif->vfp_used = 0; - cif->vfp_nargs = 0; - cif->vfp_reg_free = 0; - memset (cif->vfp_args, -1, 16); /* Init to -1. */ - - for (i = 0; i < cif->nargs; i++) - { - int h = vfp_type_p (cif->arg_types[i]); - if (h && place_vfp_arg (cif, h) == 1) - break; - } -} diff --git a/llgo/third_party/gofrontend/libffi/src/arm/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/arm/ffitarget.h deleted file mode 100644 index 4f473f929b4f4cea1b3e7dac71251c3b6e5d1bee..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arm/ffitarget.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 2010 CodeSourcery - Copyright (c) 1996-2003 Red Hat, Inc. - - Target configuration macros for ARM. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_VFP, - FFI_LAST_ABI, -#ifdef __ARM_PCS_VFP - FFI_DEFAULT_ABI = FFI_VFP, -#else - FFI_DEFAULT_ABI = FFI_SYSV, -#endif -} ffi_abi; -#endif - -#define FFI_EXTRA_CIF_FIELDS \ - int vfp_used; \ - unsigned short vfp_reg_free, vfp_nargs; \ - signed char vfp_args[16] \ - -#define FFI_TARGET_SPECIFIC_VARIADIC -#define FFI_TARGET_HAS_COMPLEX_TYPE - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_GO_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 12 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/arm/internal.h b/llgo/third_party/gofrontend/libffi/src/arm/internal.h deleted file mode 100644 index 6cf0b2ae5dab8105ca110af96d668958b69abed3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arm/internal.h +++ /dev/null @@ -1,7 +0,0 @@ -#define ARM_TYPE_VFP_S 0 -#define ARM_TYPE_VFP_D 1 -#define ARM_TYPE_VFP_N 2 -#define ARM_TYPE_INT64 3 -#define ARM_TYPE_INT 4 -#define ARM_TYPE_VOID 5 -#define ARM_TYPE_STRUCT 6 diff --git a/llgo/third_party/gofrontend/libffi/src/arm/sysv.S b/llgo/third_party/gofrontend/libffi/src/arm/sysv.S deleted file mode 100644 index fd165890e02cbe73da7915419b0edc268abe543f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/arm/sysv.S +++ /dev/null @@ -1,335 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. - Copyright (c) 2011 Plausible Labs Cooperative, Inc. - - ARM Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include -#include "internal.h" - -/* GCC 4.8 provides __ARM_ARCH; construct it otherwise. */ -#ifndef __ARM_ARCH -# if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ - || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ - || defined(__ARM_ARCH_7EM__) -# define __ARM_ARCH 7 -# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ - || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ - || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ - || defined(__ARM_ARCH_6M__) -# define __ARM_ARCH 6 -# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ - || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ - || defined(__ARM_ARCH_5TEJ__) -# define __ARM_ARCH 5 -# else -# define __ARM_ARCH 4 -# endif -#endif - -/* Conditionally compile unwinder directives. */ -.macro UNWIND text:vararg -#ifdef __ARM_EABI__ - \text -#endif -.endm -#if defined(HAVE_AS_CFI_PSEUDO_OP) && defined(__ARM_EABI__) - .cfi_sections .debug_frame -#endif - -#define CONCAT(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -#ifdef __USER_LABEL_PREFIX__ -# define CNAME(X) CONCAT (__USER_LABEL_PREFIX__, X) -#else -# define CNAME(X) X -#endif -#ifdef __ELF__ -# define SIZE(X) .size CNAME(X), . - CNAME(X) -# define TYPE(X, Y) .type CNAME(X), Y -#else -# define SIZE(X) -# define TYPE(X, Y) -#endif - -#define ARM_FUNC_START(name, gl) \ - .align 3; \ - .ifne gl; .globl CNAME(name); FFI_HIDDEN(CNAME(name)); .endif; \ - TYPE(name, %function); \ - CNAME(name): - -#define ARM_FUNC_END(name) \ - SIZE(name) - -/* Aid in defining a jump table with 8 bytes between entries. */ -.macro E index - .if . - 0b - 8*\index - .error "type table out of sync" - .endif -.endm - - .text - .syntax unified - .arm - - /* We require interworking on LDM, which implies ARMv5T, - which implies the existance of BLX. */ - .arch armv5t - - /* Note that we use STC and LDC to encode VFP instructions, - so that we do not need ".fpu vfp", nor get that added to - the object file attributes. These will not be executed - unless the FFI_VFP abi is used. */ - - @ r0: stack - @ r1: frame - @ r2: fn - @ r3: vfp_used - -ARM_FUNC_START(ffi_call_VFP, 1) - UNWIND .fnstart - cfi_startproc - - cmp r3, #3 @ load only d0 if possible - ldcle p11, cr0, [r0] @ vldrle d0, [sp] - ldcgt p11, cr0, [r0], {16} @ vldmgt sp, {d0-d7} - add r0, r0, #64 @ discard the vfp register args - /* FALLTHRU */ -ARM_FUNC_END(ffi_call_VFP) - -ARM_FUNC_START(ffi_call_SYSV, 1) - stm r1, {fp, lr} - mov fp, r1 - - @ This is a bit of a lie wrt the origin of the unwind info, but - @ now we've got the usual frame pointer and two saved registers. - UNWIND .save {fp,lr} - UNWIND .setfp fp, sp - cfi_def_cfa(fp, 8) - cfi_rel_offset(fp, 0) - cfi_rel_offset(lr, 4) - - mov sp, r0 @ install the stack pointer - mov lr, r2 @ move the fn pointer out of the way - ldr ip, [fp, #16] @ install the static chain - ldmia sp!, {r0-r3} @ move first 4 parameters in registers. - blx lr @ call fn - - @ Load r2 with the pointer to storage for the return value - @ Load r3 with the return type code - ldr r2, [fp, #8] - ldr r3, [fp, #12] - - @ Deallocate the stack with the arguments. - mov sp, fp - cfi_def_cfa_register(sp) - - @ Store values stored in registers. - .align 3 - add pc, pc, r3, lsl #3 - nop -0: -E ARM_TYPE_VFP_S - stc p10, cr0, [r2] @ vstr s0, [r2] - pop {fp,pc} -E ARM_TYPE_VFP_D - stc p11, cr0, [r2] @ vstr d0, [r2] - pop {fp,pc} -E ARM_TYPE_VFP_N - stc p11, cr0, [r2], {8} @ vstm r2, {d0-d3} - pop {fp,pc} -E ARM_TYPE_INT64 - str r1, [r2, #4] - nop -E ARM_TYPE_INT - str r0, [r2] - pop {fp,pc} -E ARM_TYPE_VOID - pop {fp,pc} - nop -E ARM_TYPE_STRUCT - pop {fp,pc} - - cfi_endproc - UNWIND .fnend -ARM_FUNC_END(ffi_call_SYSV) - - -/* - int ffi_closure_inner_* (cif, fun, user_data, frame) -*/ - -ARM_FUNC_START(ffi_go_closure_SYSV, 1) - cfi_startproc - stmdb sp!, {r0-r3} @ save argument regs - cfi_adjust_cfa_offset(16) - ldr r0, [ip, #4] @ load cif - ldr r1, [ip, #8] @ load fun - mov r2, ip @ load user_data - b 0f - cfi_endproc -ARM_FUNC_END(ffi_go_closure_SYSV) - -ARM_FUNC_START(ffi_closure_SYSV, 1) - UNWIND .fnstart - cfi_startproc - stmdb sp!, {r0-r3} @ save argument regs - cfi_adjust_cfa_offset(16) - ldr r0, [ip, #FFI_TRAMPOLINE_SIZE] @ load cif - ldr r1, [ip, #FFI_TRAMPOLINE_SIZE+4] @ load fun - ldr r2, [ip, #FFI_TRAMPOLINE_SIZE+8] @ load user_data -0: - add ip, sp, #16 @ compute entry sp - sub sp, sp, #64+32 @ allocate frame - cfi_adjust_cfa_offset(64+32) - stmdb sp!, {ip,lr} - - /* Remember that EABI unwind info only applies at call sites. - We need do nothing except note the save of the stack pointer - and the link registers. */ - UNWIND .save {sp,lr} - cfi_adjust_cfa_offset(8) - cfi_rel_offset(lr, 4) - - add r3, sp, #8 @ load frame - bl CNAME(ffi_closure_inner_SYSV) - - @ Load values returned in registers. - add r2, sp, #8+64 @ load result - adr r3, CNAME(ffi_closure_ret) - add pc, r3, r0, lsl #3 - cfi_endproc - UNWIND .fnend -ARM_FUNC_END(ffi_closure_SYSV) - -ARM_FUNC_START(ffi_go_closure_VFP, 1) - cfi_startproc - stmdb sp!, {r0-r3} @ save argument regs - cfi_adjust_cfa_offset(16) - ldr r0, [ip, #4] @ load cif - ldr r1, [ip, #8] @ load fun - mov r2, ip @ load user_data - b 0f - cfi_endproc -ARM_FUNC_END(ffi_go_closure_VFP) - -ARM_FUNC_START(ffi_closure_VFP, 1) - UNWIND .fnstart - cfi_startproc - stmdb sp!, {r0-r3} @ save argument regs - cfi_adjust_cfa_offset(16) - ldr r0, [ip, #FFI_TRAMPOLINE_SIZE] @ load cif - ldr r1, [ip, #FFI_TRAMPOLINE_SIZE+4] @ load fun - ldr r2, [ip, #FFI_TRAMPOLINE_SIZE+8] @ load user_data -0: - add ip, sp, #16 - sub sp, sp, #64+32 @ allocate frame - cfi_adjust_cfa_offset(64+32) - stc p11, cr0, [sp], {16} @ vstm sp, {d0-d7} - stmdb sp!, {ip,lr} - - /* See above. */ - UNWIND .save {sp,lr} - cfi_adjust_cfa_offset(8) - cfi_rel_offset(lr, 4) - - add r3, sp, #8 @ load frame - bl CNAME(ffi_closure_inner_VFP) - - @ Load values returned in registers. - add r2, sp, #8+64 @ load result - adr r3, CNAME(ffi_closure_ret) - add pc, r3, r0, lsl #3 - cfi_endproc - UNWIND .fnend -ARM_FUNC_END(ffi_closure_VFP) - -/* Load values returned in registers for both closure entry points. - Note that we use LDM with SP in the register set. This is deprecated - by ARM, but not yet unpredictable. */ - -ARM_FUNC_START(ffi_closure_ret, 0) - cfi_startproc - cfi_rel_offset(sp, 0) - cfi_rel_offset(lr, 4) -0: -E ARM_TYPE_VFP_S - ldc p10, cr0, [r2] @ vldr s0, [r2] - ldm sp, {sp,pc} -E ARM_TYPE_VFP_D - ldc p11, cr0, [r2] @ vldr d0, [r2] - ldm sp, {sp,pc} -E ARM_TYPE_VFP_N - ldc p11, cr0, [r2], {8} @ vldm r2, {d0-d3} - ldm sp, {sp,pc} -E ARM_TYPE_INT64 - ldr r1, [r2, #4] - nop -E ARM_TYPE_INT - ldr r0, [r2] - ldm sp, {sp,pc} -E ARM_TYPE_VOID - ldm sp, {sp,pc} - nop -E ARM_TYPE_STRUCT - ldm sp, {sp,pc} - cfi_endproc -ARM_FUNC_END(ffi_closure_ret) - -#if FFI_EXEC_TRAMPOLINE_TABLE - -/* ??? The iOS support should be updated. The first insn used to - be STMFD, but that's been moved into ffi_closure_SYSV. If the - writable page is put after this one we can make use of the - pc+8 feature of the architecture. We can also reduce the size - of the thunk to 8 and pack more of these into the page. - - In the meantime, simply replace the STMFD with a NOP so as to - keep all the magic numbers the same within ffi.c. */ - - .align 12 -ARM_FUNC_START(ffi_closure_trampoline_table_page) -.rept 4096 / 12 - nop - ldr ip, [pc, #-4092] - ldr pc, [pc, #-4092] -.endr - -#else - -ARM_FUNC_START(ffi_arm_trampoline, 1) -0: adr ip, 0b - ldr pc, 1f -1: .long 0 -ARM_FUNC_END(ffi_arm_trampoline) - -#endif /* FFI_EXEC_TRAMPOLINE_TABLE */ - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",%progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/avr32/ffi.c b/llgo/third_party/gofrontend/libffi/src/avr32/ffi.c deleted file mode 100644 index 3d43397b03ad1f505f0b3b77f71c321be55450c5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/avr32/ffi.c +++ /dev/null @@ -1,423 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011 Anthony Green - Copyright (c) 2009 Bradley Smith - - AVR32 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include -#include -#include - -/* #define DEBUG */ - -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned int, unsigned int, unsigned int*, unsigned int, - void (*fn)(void)); -extern void ffi_closure_SYSV (ffi_closure *); - -unsigned int pass_struct_on_stack(ffi_type *type) -{ - if(type->type != FFI_TYPE_STRUCT) - return 0; - - if(type->alignment < type->size && - !(type->size == 4 || type->size == 8) && - !(type->size == 8 && type->alignment >= 4)) - return 1; - - if(type->size == 3 || type->size == 5 || type->size == 6 || - type->size == 7) - return 1; - - return 0; -} - -/* ffi_prep_args is called by the assembly routine once stack space - * has been allocated for the function's arguments - * - * This is annoyingly complex since we need to keep track of used - * registers. - */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - unsigned int i; - void **p_argv; - ffi_type **p_arg; - char *reg_base = stack; - char *stack_base = stack + 20; - unsigned int stack_offset = 0; - unsigned int reg_mask = 0; - - p_argv = ecif->avalue; - - /* If cif->flags is struct then we know it's not passed in registers */ - if(ecif->cif->flags == FFI_TYPE_STRUCT) - { - *(void**)reg_base = ecif->rvalue; - reg_mask |= 1; - } - - for(i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; - i++, p_arg++) - { - size_t z = (*p_arg)->size; - int alignment = (*p_arg)->alignment; - int type = (*p_arg)->type; - char *addr = 0; - - if(z % 4 != 0) - z += (4 - z % 4); - - if(reg_mask != 0x1f) - { - if(pass_struct_on_stack(*p_arg)) - { - addr = stack_base + stack_offset; - stack_offset += z; - } - else if(z == sizeof(int)) - { - char index = 0; - - while((reg_mask >> index) & 1) - index++; - - addr = reg_base + (index * 4); - reg_mask |= (1 << index); - } - else if(z == 2 * sizeof(int)) - { - if(!((reg_mask >> 1) & 1)) - { - addr = reg_base + 4; - reg_mask |= (3 << 1); - } - else if(!((reg_mask >> 3) & 1)) - { - addr = reg_base + 12; - reg_mask |= (3 << 3); - } - } - } - - if(!addr) - { - addr = stack_base + stack_offset; - stack_offset += z; - } - - if(type == FFI_TYPE_STRUCT && (*p_arg)->elements[1] == NULL) - type = (*p_arg)->elements[0]->type; - - switch(type) - { - case FFI_TYPE_UINT8: - *(unsigned int *)addr = (unsigned int)*(UINT8 *)(*p_argv); - break; - case FFI_TYPE_SINT8: - *(signed int *)addr = (signed int)*(SINT8 *)(*p_argv); - break; - case FFI_TYPE_UINT16: - *(unsigned int *)addr = (unsigned int)*(UINT16 *)(*p_argv); - break; - case FFI_TYPE_SINT16: - *(signed int *)addr = (signed int)*(SINT16 *)(*p_argv); - break; - default: - memcpy(addr, *p_argv, z); - } - - p_argv++; - } - -#ifdef DEBUG - /* Debugging */ - for(i = 0; i < 5; i++) - { - if((reg_mask & (1 << i)) == 0) - printf("r%d: (unused)\n", 12 - i); - else - printf("r%d: 0x%08x\n", 12 - i, ((unsigned int*)reg_base)[i]); - } - - for(i = 0; i < stack_offset / 4; i++) - { - printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack_base)[i]); - } -#endif -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* Round the stack up to a multiple of 8 bytes. This isn't needed - * everywhere, but it is on some platforms, and it doesn't harm - * anything when it isn't needed. */ - cif->bytes = (cif->bytes + 7) & ~7; - - /* Flag to indicate that he return value is in fact a struct */ - cif->rstruct_flag = 0; - - /* Set the return type flag */ - switch(cif->rtype->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - cif->flags = (unsigned)FFI_TYPE_UINT8; - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - cif->flags = (unsigned)FFI_TYPE_UINT16; - break; - case FFI_TYPE_FLOAT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - cif->flags = (unsigned)FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = (unsigned)FFI_TYPE_UINT64; - break; - case FFI_TYPE_STRUCT: - cif->rstruct_flag = 1; - if(!pass_struct_on_stack(cif->rtype)) - { - if(cif->rtype->size <= 1) - cif->flags = (unsigned)FFI_TYPE_UINT8; - else if(cif->rtype->size <= 2) - cif->flags = (unsigned)FFI_TYPE_UINT16; - else if(cif->rtype->size <= 4) - cif->flags = (unsigned)FFI_TYPE_UINT32; - else if(cif->rtype->size <= 8) - cif->flags = (unsigned)FFI_TYPE_UINT64; - else - cif->flags = (unsigned)cif->rtype->type; - } - else - cif->flags = (unsigned)cif->rtype->type; - break; - default: - cif->flags = (unsigned)cif->rtype->type; - break; - } - - return FFI_OK; -} - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - unsigned int size = 0, i = 0; - ffi_type **p_arg; - - ecif.cif = cif; - ecif.avalue = avalue; - - for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) - size += (*p_arg)->size + (4 - (*p_arg)->size % 4); - - /* If the return value is a struct and we don't have a return value - * address then we need to make one */ - - /* If cif->flags is struct then it's not suitable for registers */ - if((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) - ecif.rvalue = alloca(cif->rtype->size); - else - ecif.rvalue = rvalue; - - switch(cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, size, cif->flags, - ecif.rvalue, cif->rstruct_flag, fn); - break; - default: - FFI_ASSERT(0); - break; - } -} - -static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif) -{ - register unsigned int i, reg_mask = 0; - register void **p_argv; - register ffi_type **p_arg; - register char *reg_base = stack; - register char *stack_base = stack + 20; - register unsigned int stack_offset = 0; - -#ifdef DEBUG - /* Debugging */ - for(i = 0; i < cif->nargs + 7; i++) - { - printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack)[i]); - } -#endif - - /* If cif->flags is struct then we know it's not passed in registers */ - if(cif->flags == FFI_TYPE_STRUCT) - { - *rvalue = *(void **)reg_base; - reg_mask |= 1; - } - - p_argv = avalue; - - for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) - { - size_t z = (*p_arg)->size; - int alignment = (*p_arg)->alignment; - - *p_argv = 0; - - if(z % 4 != 0) - z += (4 - z % 4); - - if(reg_mask != 0x1f) - { - if(pass_struct_on_stack(*p_arg)) - { - *p_argv = (void*)stack_base + stack_offset; - stack_offset += z; - } - else if(z <= sizeof(int)) - { - char index = 0; - - while((reg_mask >> index) & 1) - index++; - - *p_argv = (void*)reg_base + (index * 4); - reg_mask |= (1 << index); - } - else if(z == 2 * sizeof(int)) - { - if(!((reg_mask >> 1) & 1)) - { - *p_argv = (void*)reg_base + 4; - reg_mask |= (3 << 1); - } - else if(!((reg_mask >> 3) & 1)) - { - *p_argv = (void*)reg_base + 12; - reg_mask |= (3 << 3); - } - } - } - - if(!*p_argv) - { - *p_argv = (void*)stack_base + stack_offset; - stack_offset += z; - } - - if((*p_arg)->type != FFI_TYPE_STRUCT || - (*p_arg)->elements[1] == NULL) - { - if(alignment == 1) - **(unsigned int**)p_argv <<= 24; - else if(alignment == 2) - **(unsigned int**)p_argv <<= 16; - } - - p_argv++; - } - -#ifdef DEBUG - /* Debugging */ - for(i = 0; i < cif->nargs; i++) - { - printf("sp+%d: 0x%08x\n", i*4, *(((unsigned int**)avalue)[i])); - } -#endif -} - -/* This function is jumped to by the trampoline */ - -unsigned int ffi_closure_SYSV_inner(ffi_closure *closure, void **respp, - void *args) -{ - ffi_cif *cif; - void **arg_area; - unsigned int i, size = 0; - ffi_type **p_arg; - - cif = closure->cif; - - for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) - size += (*p_arg)->size + (4 - (*p_arg)->size % 4); - - arg_area = (void **)alloca(size); - - /* this call will initialize ARG_AREA, such that each element in that - * array points to the corresponding value on the stack; and if the - * function returns a structure, it will re-set RESP to point to the - * structure return address. */ - - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); - - (closure->fun)(cif, *respp, arg_area, closure->user_data); - - return cif->flags; -} - -ffi_status ffi_prep_closure_loc(ffi_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, - void *codeloc) -{ - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); - unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); - unsigned int __ctx = (unsigned int)(codeloc); - unsigned int __rstruct_flag = (unsigned int)(cif->rstruct_flag); - unsigned int __inner = (unsigned int)(&ffi_closure_SYSV_inner); - *(unsigned int*) &__tramp[0] = 0xebcd1f00; /* pushm r8-r12 */ - *(unsigned int*) &__tramp[4] = 0xfefc0010; /* ld.w r12, pc[16] */ - *(unsigned int*) &__tramp[8] = 0xfefb0010; /* ld.w r11, pc[16] */ - *(unsigned int*) &__tramp[12] = 0xfefa0010; /* ld.w r10, pc[16] */ - *(unsigned int*) &__tramp[16] = 0xfeff0010; /* ld.w pc, pc[16] */ - *(unsigned int*) &__tramp[20] = __ctx; - *(unsigned int*) &__tramp[24] = __rstruct_flag; - *(unsigned int*) &__tramp[28] = __inner; - *(unsigned int*) &__tramp[32] = __fun; - syscall(__NR_cacheflush, 0, (&__tramp[0]), 36); - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} - diff --git a/llgo/third_party/gofrontend/libffi/src/avr32/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/avr32/ffitarget.h deleted file mode 100644 index d0c7586f9a8b032459906a182def691d29c88eb3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/avr32/ffitarget.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 2009 Bradley Smith - Target configuration macros for AVR32. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -#define FFI_EXTRA_CIF_FIELDS unsigned int rstruct_flag - -/* Definitions for closures */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 36 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/avr32/sysv.S b/llgo/third_party/gofrontend/libffi/src/avr32/sysv.S deleted file mode 100644 index a984b3c88a3095a737bb8fdace60d48f92401515..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/avr32/sysv.S +++ /dev/null @@ -1,208 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2009 Bradley Smith - - AVR32 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - --------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - /* r12: ffi_prep_args - * r11: &ecif - * r10: size - * r9: cif->flags - * r8: ecif.rvalue - * sp+0: cif->rstruct_flag - * sp+4: fn */ - - .text - .align 1 - .globl ffi_call_SYSV - .type ffi_call_SYSV, @function -ffi_call_SYSV: - stm --sp, r0,r1,lr - stm --sp, r8-r12 - mov r0, sp - - /* Make room for all of the new args. */ - sub sp, r10 - /* Pad to make way for potential skipped registers */ - sub sp, 20 - - /* Call ffi_prep_args(stack, &ecif). */ - /* r11 already set */ - mov r1, r12 - mov r12, sp - icall r1 - - /* Save new argument size */ - mov r1, r12 - - /* Move first 5 parameters in registers. */ - ldm sp++, r8-r12 - - /* call (fn) (...). */ - ld.w r1, r0[36] - icall r1 - - /* Remove the space we pushed for the args. */ - mov sp, r0 - - /* Load r1 with the rstruct flag. */ - ld.w r1, sp[32] - - /* Load r9 with the return type code. */ - ld.w r9, sp[12] - - /* Load r8 with the return value pointer. */ - ld.w r8, sp[16] - - /* If the return value pointer is NULL, assume no return value. */ - cp.w r8, 0 - breq .Lend - - /* Check if return type is actually a struct */ - cp.w r1, 0 - breq 1f - - /* Return 8bit */ - cp.w r9, FFI_TYPE_UINT8 - breq .Lstore8 - - /* Return 16bit */ - cp.w r9, FFI_TYPE_UINT16 - breq .Lstore16 - -1: - /* Return 32bit */ - cp.w r9, FFI_TYPE_UINT32 - breq .Lstore32 - cp.w r9, FFI_TYPE_UINT16 - breq .Lstore32 - cp.w r9, FFI_TYPE_UINT8 - breq .Lstore32 - - /* Return 64bit */ - cp.w r9, FFI_TYPE_UINT64 - breq .Lstore64 - - /* Didn't match anything */ - bral .Lend - -.Lstore64: - st.w r8[0], r11 - st.w r8[4], r10 - bral .Lend - -.Lstore32: - st.w r8[0], r12 - bral .Lend - -.Lstore16: - st.h r8[0], r12 - bral .Lend - -.Lstore8: - st.b r8[0], r12 - bral .Lend - -.Lend: - sub sp, -20 - ldm sp++, r0,r1,pc - - .size ffi_call_SYSV, . - ffi_call_SYSV - - - /* r12: __ctx - * r11: __rstruct_flag - * r10: __inner */ - - .align 1 - .globl ffi_closure_SYSV - .type ffi_closure_SYSV, @function -ffi_closure_SYSV: - stm --sp, r0,lr - mov r0, r11 - mov r8, r10 - sub r10, sp, -8 - sub sp, 12 - st.w sp[8], sp - sub r11, sp, -8 - icall r8 - - /* Check if return type is actually a struct */ - cp.w r0, 0 - breq 1f - - /* Return 8bit */ - cp.w r12, FFI_TYPE_UINT8 - breq .Lget8 - - /* Return 16bit */ - cp.w r12, FFI_TYPE_UINT16 - breq .Lget16 - -1: - /* Return 32bit */ - cp.w r12, FFI_TYPE_UINT32 - breq .Lget32 - cp.w r12, FFI_TYPE_UINT16 - breq .Lget32 - cp.w r12, FFI_TYPE_UINT8 - breq .Lget32 - - /* Return 64bit */ - cp.w r12, FFI_TYPE_UINT64 - breq .Lget64 - - /* Didn't match anything */ - bral .Lclend - -.Lget64: - ld.w r11, sp[0] - ld.w r10, sp[4] - bral .Lclend - -.Lget32: - ld.w r12, sp[0] - bral .Lclend - -.Lget16: - ld.uh r12, sp[0] - bral .Lclend - -.Lget8: - ld.ub r12, sp[0] - bral .Lclend - -.Lclend: - sub sp, -12 - ldm sp++, r0,lr - sub sp, -20 - mov pc, lr - - .size ffi_closure_SYSV, . - ffi_closure_SYSV - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/bfin/ffi.c b/llgo/third_party/gofrontend/libffi/src/bfin/ffi.c deleted file mode 100644 index 22a2acdac192c1b912a51c962aefc02dac1ae8ee..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/bfin/ffi.c +++ /dev/null @@ -1,196 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2012 Alexandre K. I. de Mendonca , - Paulo Pizarro - - Blackfin Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ -#include -#include - -#include -#include - -/* Maximum number of GPRs available for argument passing. */ -#define MAX_GPRARGS 3 - -/* - * Return types - */ -#define FFIBFIN_RET_VOID 0 -#define FFIBFIN_RET_BYTE 1 -#define FFIBFIN_RET_HALFWORD 2 -#define FFIBFIN_RET_INT64 3 -#define FFIBFIN_RET_INT32 4 - -/*====================================================================*/ -/* PROTOTYPE * - /*====================================================================*/ -void ffi_prep_args(unsigned char *, extended_cif *); - -/*====================================================================*/ -/* Externals */ -/* (Assembly) */ -/*====================================================================*/ - -extern void ffi_call_SYSV(unsigned, extended_cif *, void(*)(unsigned char *, extended_cif *), unsigned, void *, void(*fn)(void)); - -/*====================================================================*/ -/* Implementation */ -/* */ -/*====================================================================*/ - - -/* - * This function calculates the return type (size) based on type. - */ - -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* --------------------------------------* - * Return handling * - * --------------------------------------*/ - switch (cif->rtype->type) { - case FFI_TYPE_VOID: - cif->flags = FFIBFIN_RET_VOID; - break; - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - cif->flags = FFIBFIN_RET_HALFWORD; - break; - case FFI_TYPE_UINT8: - cif->flags = FFIBFIN_RET_BYTE; - break; - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_FLOAT: - case FFI_TYPE_POINTER: - case FFI_TYPE_SINT8: - cif->flags = FFIBFIN_RET_INT32; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - cif->flags = FFIBFIN_RET_INT64; - break; - case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4){ - cif->flags = FFIBFIN_RET_INT32; - }else if (cif->rtype->size == 8){ - cif->flags = FFIBFIN_RET_INT64; - }else{ - //it will return via a hidden pointer in P0 - cif->flags = FFIBFIN_RET_VOID; - } - break; - default: - FFI_ASSERT(0); - break; - } - return FFI_OK; -} - -/* - * This will prepare the arguments and will call the assembly routine - * cif = the call interface - * fn = the function to be called - * rvalue = the return value - * avalue = the arguments - */ -void ffi_call(ffi_cif *cif, void(*fn)(void), void *rvalue, void **avalue) -{ - int ret_type = cif->flags; - extended_cif ecif; - ecif.cif = cif; - ecif.avalue = avalue; - ecif.rvalue = rvalue; - - switch (cif->abi) { - case FFI_SYSV: - ffi_call_SYSV(cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); - break; - default: - FFI_ASSERT(0); - break; - } -} - - -/* -* This function prepares the parameters (copies them from the ecif to the stack) -* to call the function (ffi_prep_args is called by the assembly routine in file -* sysv.S, which also calls the actual function) -*/ -void ffi_prep_args(unsigned char *stack, extended_cif *ecif) -{ - register unsigned int i = 0; - void **p_argv; - unsigned char *argp; - ffi_type **p_arg; - argp = stack; - p_argv = ecif->avalue; - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); - i--, p_arg++) { - size_t z; - z = (*p_arg)->size; - if (z < sizeof(int)) { - z = sizeof(int); - switch ((*p_arg)->type) { - case FFI_TYPE_SINT8: { - signed char v = *(SINT8 *)(* p_argv); - signed int t = v; - *(signed int *) argp = t; - } - break; - case FFI_TYPE_UINT8: { - unsigned char v = *(UINT8 *)(* p_argv); - unsigned int t = v; - *(unsigned int *) argp = t; - } - break; - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) * (SINT16 *)(* p_argv); - break; - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) * (UINT16 *)(* p_argv); - break; - case FFI_TYPE_STRUCT: - memcpy(argp, *p_argv, (*p_arg)->size); - break; - default: - FFI_ASSERT(0); - break; - } - } else if (z == sizeof(int)) { - *(unsigned int *) argp = (unsigned int) * (UINT32 *)(* p_argv); - } else { - memcpy(argp, *p_argv, z); - } - p_argv++; - argp += z; - } -} - - - diff --git a/llgo/third_party/gofrontend/libffi/src/bfin/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/bfin/ffitarget.h deleted file mode 100644 index 2175c010162f6ec6dab831ffb3848257a9242d41..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/bfin/ffitarget.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ----------------------------------------------------------------------- - ffitarget.h - Copyright (c) 2012 Alexandre K. I. de Mendonca - - Blackfin Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/bfin/sysv.S b/llgo/third_party/gofrontend/libffi/src/bfin/sysv.S deleted file mode 100644 index f4278be2426d2540b26cbef1f1bf0d0d32e3fd38..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/bfin/sysv.S +++ /dev/null @@ -1,179 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2012 Alexandre K. I. de Mendonca , - Paulo Pizarro - - Blackfin Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -.text -.align 4 - - /* - There is a "feature" in the bfin toolchain that it puts a _ before function names - that's why the function here it's called _ffi_call_SYSV and not ffi_call_SYSV - */ - .global _ffi_call_SYSV; - .type _ffi_call_SYSV, STT_FUNC; - .func ffi_call_SYSV - - /* - cif->bytes = R0 (fp+8) - &ecif = R1 (fp+12) - ffi_prep_args = R2 (fp+16) - ret_type = stack (fp+20) - ecif.rvalue = stack (fp+24) - fn = stack (fp+28) - got (fp+32) - - There is room for improvement here (we can use temporary registers - instead of saving the values in the memory) - REGS: - P5 => Stack pointer (function arguments) - R5 => cif->bytes - R4 => ret->type - - FP-20 = P3 - FP-16 = SP (parameters area) - FP-12 = SP (temp) - FP-08 = function return part 1 [R0] - FP-04 = function return part 2 [R1] - */ - -_ffi_call_SYSV: -.prologue: - LINK 20; - [FP-20] = P3; - [FP+8] = R0; - [FP+12] = R1; - [FP+16] = R2; - -.allocate_stack: - //alocate cif->bytes into the stack - R1 = [FP+8]; - R0 = SP; - R0 = R0 - R1; - R1 = 4; - R0 = R0 - R1; - [FP-12] = SP; - SP = R0; - [FP-16] = SP; - -.call_prep_args: - //get the addr of prep_args - P0 = [P3 + _ffi_prep_args@FUNCDESC_GOT17M4]; - P1 = [P0]; - P3 = [P0+4]; - R0 = [FP-16];//SP (parameter area) - R1 = [FP+12];//ecif - call (P1); - -.call_user_function: - //ajust SP so as to allow the user function access the parameters on the stack - SP = [FP-16]; //point to function parameters - R0 = [SP]; - R1 = [SP+4]; - R2 = [SP+8]; - //load user function address - P0 = FP; - P0 +=28; - P1 = [P0]; - P1 = [P1]; - P3 = [P0+4]; - /* - For functions returning aggregate values (struct) occupying more than 8 bytes, - the caller allocates the return value object on the stack and the address - of this object is passed to the callee as a hidden argument in register P0. - */ - P0 = [FP+24]; - - call (P1); - SP = [FP-12]; -.compute_return: - P2 = [FP-20]; - [FP-8] = R0; - [FP-4] = R1; - - R0 = [FP+20]; - R1 = R0 << 2; - - R0 = [P2+.rettable@GOT17M4]; - R0 = R1 + R0; - P2 = R0; - R1 = [P2]; - - P2 = [FP+-20]; - R0 = [P2+.rettable@GOT17M4]; - R0 = R1 + R0; - P2 = R0; - R0 = [FP-8]; - R1 = [FP-4]; - jump (P2); - -/* -#define FFIBFIN_RET_VOID 0 -#define FFIBFIN_RET_BYTE 1 -#define FFIBFIN_RET_HALFWORD 2 -#define FFIBFIN_RET_INT64 3 -#define FFIBFIN_RET_INT32 4 -*/ -.align 4 -.align 4 -.rettable: - .dd .epilogue - .rettable - .dd .rbyte - .rettable; - .dd .rhalfword - .rettable; - .dd .rint64 - .rettable; - .dd .rint32 - .rettable; - -.rbyte: - P0 = [FP+24]; - R0 = R0.B (Z); - [P0] = R0; - JUMP .epilogue -.rhalfword: - P0 = [FP+24]; - R0 = R0.L; - [P0] = R0; - JUMP .epilogue -.rint64: - P0 = [FP+24];// &rvalue - [P0] = R0; - [P0+4] = R1; - JUMP .epilogue -.rint32: - P0 = [FP+24]; - [P0] = R0; -.epilogue: - R0 = [FP+8]; - R1 = [FP+12]; - R2 = [FP+16]; - P3 = [FP-20]; - UNLINK; - RTS; - -.size _ffi_call_SYSV,.-_ffi_call_SYSV; -.endfunc diff --git a/llgo/third_party/gofrontend/libffi/src/closures.c b/llgo/third_party/gofrontend/libffi/src/closures.c deleted file mode 100644 index 721ff00ea43bce8decb67d9fef6a233d55ddd6ba..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/closures.c +++ /dev/null @@ -1,688 +0,0 @@ -/* ----------------------------------------------------------------------- - closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc - Copyright (c) 2011 Plausible Labs Cooperative, Inc. - - Code to allocate and deallocate memory for closures. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#if defined __linux__ && !defined _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include - -#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE -# if __gnu_linux__ && !defined(__ANDROID__) -/* This macro indicates it may be forbidden to map anonymous memory - with both write and execute permission. Code compiled when this - option is defined will attempt to map such pages once, but if it - fails, it falls back to creating a temporary file in a writable and - executable filesystem and mapping pages from it into separate - locations in the virtual memory space, one location writable and - another executable. */ -# define FFI_MMAP_EXEC_WRIT 1 -# define HAVE_MNTENT 1 -# endif -# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) -/* Windows systems may have Data Execution Protection (DEP) enabled, - which requires the use of VirtualMalloc/VirtualFree to alloc/free - executable memory. */ -# define FFI_MMAP_EXEC_WRIT 1 -# endif -#endif - -#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX -# ifdef __linux__ -/* When defined to 1 check for SELinux and if SELinux is active, - don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that - might cause audit messages. */ -# define FFI_MMAP_EXEC_SELINUX 1 -# endif -#endif - -#if FFI_CLOSURES - -# if FFI_EXEC_TRAMPOLINE_TABLE - -// Per-target implementation; It's unclear what can reasonable be shared between two OS/architecture implementations. - -# elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ - -#define USE_LOCKS 1 -#define USE_DL_PREFIX 1 -#ifdef __GNUC__ -#ifndef USE_BUILTIN_FFS -#define USE_BUILTIN_FFS 1 -#endif -#endif - -/* We need to use mmap, not sbrk. */ -#define HAVE_MORECORE 0 - -/* We could, in theory, support mremap, but it wouldn't buy us anything. */ -#define HAVE_MREMAP 0 - -/* We have no use for this, so save some code and data. */ -#define NO_MALLINFO 1 - -/* We need all allocations to be in regular segments, otherwise we - lose track of the corresponding code address. */ -#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T - -/* Don't allocate more than a page unless needed. */ -#define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize) - -#if FFI_CLOSURE_TEST -/* Don't release single pages, to avoid a worst-case scenario of - continuously allocating and releasing single pages, but release - pairs of pages, which should do just as well given that allocations - are likely to be small. */ -#define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize) -#endif - -#include -#include -#include -#include -#ifndef _MSC_VER -#include -#endif -#include -#include -#if !defined(X86_WIN32) && !defined(X86_WIN64) -#ifdef HAVE_MNTENT -#include -#endif /* HAVE_MNTENT */ -#include -#include - -/* We don't want sys/mman.h to be included after we redefine mmap and - dlmunmap. */ -#include -#define LACKS_SYS_MMAN_H 1 - -#if FFI_MMAP_EXEC_SELINUX -#include -#include - -static int selinux_enabled = -1; - -static int -selinux_enabled_check (void) -{ - struct statfs sfs; - FILE *f; - char *buf = NULL; - size_t len = 0; - - if (statfs ("/selinux", &sfs) >= 0 - && (unsigned int) sfs.f_type == 0xf97cff8cU) - return 1; - f = fopen ("/proc/mounts", "r"); - if (f == NULL) - return 0; - while (getline (&buf, &len, f) >= 0) - { - char *p = strchr (buf, ' '); - if (p == NULL) - break; - p = strchr (p + 1, ' '); - if (p == NULL) - break; - if (strncmp (p + 1, "selinuxfs ", 10) == 0) - { - free (buf); - fclose (f); - return 1; - } - } - free (buf); - fclose (f); - return 0; -} - -#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ - : (selinux_enabled = selinux_enabled_check ())) - -#else - -#define is_selinux_enabled() 0 - -#endif /* !FFI_MMAP_EXEC_SELINUX */ - -/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ -#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX -#include - -static int emutramp_enabled = -1; - -static int -emutramp_enabled_check (void) -{ - char *buf = NULL; - size_t len = 0; - FILE *f; - int ret; - f = fopen ("/proc/self/status", "r"); - if (f == NULL) - return 0; - ret = 0; - - while (getline (&buf, &len, f) != -1) - if (!strncmp (buf, "PaX:", 4)) - { - char emutramp; - if (sscanf (buf, "%*s %*c%c", &emutramp) == 1) - ret = (emutramp == 'E'); - break; - } - free (buf); - fclose (f); - return ret; -} - -#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ - : (emutramp_enabled = emutramp_enabled_check ())) -#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ - -#elif defined (__CYGWIN__) || defined(__INTERIX) - -#include - -/* Cygwin is Linux-like, but not quite that Linux-like. */ -#define is_selinux_enabled() 0 - -#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ - -#ifndef FFI_MMAP_EXEC_EMUTRAMP_PAX -#define is_emutramp_enabled() 0 -#endif /* FFI_MMAP_EXEC_EMUTRAMP_PAX */ - -/* Declare all functions defined in dlmalloc.c as static. */ -static void *dlmalloc(size_t); -static void dlfree(void*); -static void *dlcalloc(size_t, size_t) MAYBE_UNUSED; -static void *dlrealloc(void *, size_t) MAYBE_UNUSED; -static void *dlmemalign(size_t, size_t) MAYBE_UNUSED; -static void *dlvalloc(size_t) MAYBE_UNUSED; -static int dlmallopt(int, int) MAYBE_UNUSED; -static size_t dlmalloc_footprint(void) MAYBE_UNUSED; -static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED; -static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED; -static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED; -static void *dlpvalloc(size_t) MAYBE_UNUSED; -static int dlmalloc_trim(size_t) MAYBE_UNUSED; -static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; -static void dlmalloc_stats(void) MAYBE_UNUSED; - -#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) -/* Use these for mmap and munmap within dlmalloc.c. */ -static void *dlmmap(void *, size_t, int, int, int, off_t); -static int dlmunmap(void *, size_t); -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ - -#define mmap dlmmap -#define munmap dlmunmap - -#include "dlmalloc.c" - -#undef mmap -#undef munmap - -#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) - -/* A mutex used to synchronize access to *exec* variables in this file. */ -static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; - -/* A file descriptor of a temporary file from which we'll map - executable pages. */ -static int execfd = -1; - -/* The amount of space already allocated from the temporary file. */ -static size_t execsize = 0; - -/* Open a temporary file name, and immediately unlink it. */ -static int -open_temp_exec_file_name (char *name, int flags) -{ - int fd; - -#ifdef HAVE_MKOSTEMP - fd = mkostemp (name, flags); -#else - fd = mkstemp (name); -#endif - - if (fd != -1) - unlink (name); - - return fd; -} - -/* Open a temporary file in the named directory. */ -static int -open_temp_exec_file_dir (const char *dir) -{ - static const char suffix[] = "/ffiXXXXXX"; - int lendir, flags; - char *tempname; -#ifdef O_TMPFILE - int fd; -#endif - -#ifdef O_CLOEXEC - flags = O_CLOEXEC; -#else - flags = 0; -#endif - -#ifdef O_TMPFILE - fd = open (dir, flags | O_RDWR | O_EXCL | O_TMPFILE, 0700); - /* If the running system does not support the O_TMPFILE flag then retry without it. */ - if (fd != -1 || (errno != EINVAL && errno != EISDIR && errno != EOPNOTSUPP)) { - return fd; - } else { - errno = 0; - } -#endif - - lendir = strlen (dir); - tempname = __builtin_alloca (lendir + sizeof (suffix)); - - if (!tempname) - return -1; - - memcpy (tempname, dir, lendir); - memcpy (tempname + lendir, suffix, sizeof (suffix)); - - return open_temp_exec_file_name (tempname, flags); -} - -/* Open a temporary file in the directory in the named environment - variable. */ -static int -open_temp_exec_file_env (const char *envvar) -{ - const char *value = getenv (envvar); - - if (!value) - return -1; - - return open_temp_exec_file_dir (value); -} - -#ifdef HAVE_MNTENT -/* Open a temporary file in an executable and writable mount point - listed in the mounts file. Subsequent calls with the same mounts - keep searching for mount points in the same file. Providing NULL - as the mounts file closes the file. */ -static int -open_temp_exec_file_mnt (const char *mounts) -{ - static const char *last_mounts; - static FILE *last_mntent; - - if (mounts != last_mounts) - { - if (last_mntent) - endmntent (last_mntent); - - last_mounts = mounts; - - if (mounts) - last_mntent = setmntent (mounts, "r"); - else - last_mntent = NULL; - } - - if (!last_mntent) - return -1; - - for (;;) - { - int fd; - struct mntent mnt; - char buf[MAXPATHLEN * 3]; - - if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL) - return -1; - - if (hasmntopt (&mnt, "ro") - || hasmntopt (&mnt, "noexec") - || access (mnt.mnt_dir, W_OK)) - continue; - - fd = open_temp_exec_file_dir (mnt.mnt_dir); - - if (fd != -1) - return fd; - } -} -#endif /* HAVE_MNTENT */ - -/* Instructions to look for a location to hold a temporary file that - can be mapped in for execution. */ -static struct -{ - int (*func)(const char *); - const char *arg; - int repeat; -} open_temp_exec_file_opts[] = { - { open_temp_exec_file_env, "TMPDIR", 0 }, - { open_temp_exec_file_dir, "/tmp", 0 }, - { open_temp_exec_file_dir, "/var/tmp", 0 }, - { open_temp_exec_file_dir, "/dev/shm", 0 }, - { open_temp_exec_file_env, "HOME", 0 }, -#ifdef HAVE_MNTENT - { open_temp_exec_file_mnt, "/etc/mtab", 1 }, - { open_temp_exec_file_mnt, "/proc/mounts", 1 }, -#endif /* HAVE_MNTENT */ -}; - -/* Current index into open_temp_exec_file_opts. */ -static int open_temp_exec_file_opts_idx = 0; - -/* Reset a current multi-call func, then advances to the next entry. - If we're at the last, go back to the first and return nonzero, - otherwise return zero. */ -static int -open_temp_exec_file_opts_next (void) -{ - if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) - open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL); - - open_temp_exec_file_opts_idx++; - if (open_temp_exec_file_opts_idx - == (sizeof (open_temp_exec_file_opts) - / sizeof (*open_temp_exec_file_opts))) - { - open_temp_exec_file_opts_idx = 0; - return 1; - } - - return 0; -} - -/* Return a file descriptor of a temporary zero-sized file in a - writable and executable filesystem. */ -static int -open_temp_exec_file (void) -{ - int fd; - - do - { - fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func - (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg); - - if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat - || fd == -1) - { - if (open_temp_exec_file_opts_next ()) - break; - } - } - while (fd == -1); - - return fd; -} - -/* Map in a chunk of memory from the temporary exec file into separate - locations in the virtual memory address space, one writable and one - executable. Returns the address of the writable portion, after - storing an offset to the corresponding executable portion at the - last word of the requested chunk. */ -static void * -dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) -{ - void *ptr; - - if (execfd == -1) - { - open_temp_exec_file_opts_idx = 0; - retry_open: - execfd = open_temp_exec_file (); - if (execfd == -1) - return MFAIL; - } - - offset = execsize; - - if (ftruncate (execfd, offset + length)) - return MFAIL; - - flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); - flags |= MAP_SHARED; - - ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC, - flags, execfd, offset); - if (ptr == MFAIL) - { - if (!offset) - { - close (execfd); - goto retry_open; - } - ftruncate (execfd, offset); - return MFAIL; - } - else if (!offset - && open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) - open_temp_exec_file_opts_next (); - - start = mmap (start, length, prot, flags, execfd, offset); - - if (start == MFAIL) - { - munmap (ptr, length); - ftruncate (execfd, offset); - return start; - } - - mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start; - - execsize += length; - - return start; -} - -/* Map in a writable and executable chunk of memory if possible. - Failing that, fall back to dlmmap_locked. */ -static void * -dlmmap (void *start, size_t length, int prot, - int flags, int fd, off_t offset) -{ - void *ptr; - - assert (start == NULL && length % malloc_getpagesize == 0 - && prot == (PROT_READ | PROT_WRITE) - && flags == (MAP_PRIVATE | MAP_ANONYMOUS) - && fd == -1 && offset == 0); - -#if FFI_CLOSURE_TEST - printf ("mapping in %zi\n", length); -#endif - - if (execfd == -1 && is_emutramp_enabled ()) - { - ptr = mmap (start, length, prot & ~PROT_EXEC, flags, fd, offset); - return ptr; - } - - if (execfd == -1 && !is_selinux_enabled ()) - { - ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); - - if (ptr != MFAIL || (errno != EPERM && errno != EACCES)) - /* Cool, no need to mess with separate segments. */ - return ptr; - - /* If MREMAP_DUP is ever introduced and implemented, try mmap - with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with - MREMAP_DUP and prot at this point. */ - } - - if (execsize == 0 || execfd == -1) - { - pthread_mutex_lock (&open_temp_exec_file_mutex); - ptr = dlmmap_locked (start, length, prot, flags, offset); - pthread_mutex_unlock (&open_temp_exec_file_mutex); - - return ptr; - } - - return dlmmap_locked (start, length, prot, flags, offset); -} - -/* Release memory at the given address, as well as the corresponding - executable page if it's separate. */ -static int -dlmunmap (void *start, size_t length) -{ - /* We don't bother decreasing execsize or truncating the file, since - we can't quite tell whether we're unmapping the end of the file. - We don't expect frequent deallocation anyway. If we did, we - could locate pages in the file by writing to the pages being - deallocated and checking that the file contents change. - Yuck. */ - msegmentptr seg = segment_holding (gm, start); - void *code; - -#if FFI_CLOSURE_TEST - printf ("unmapping %zi\n", length); -#endif - - if (seg && (code = add_segment_exec_offset (start, seg)) != start) - { - int ret = munmap (code, length); - if (ret) - return ret; - } - - return munmap (start, length); -} - -#if FFI_CLOSURE_FREE_CODE -/* Return segment holding given code address. */ -static msegmentptr -segment_holding_code (mstate m, char* addr) -{ - msegmentptr sp = &m->seg; - for (;;) { - if (addr >= add_segment_exec_offset (sp->base, sp) - && addr < add_segment_exec_offset (sp->base, sp) + sp->size) - return sp; - if ((sp = sp->next) == 0) - return 0; - } -} -#endif - -#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ - -/* Allocate a chunk of memory with the given size. Returns a pointer - to the writable address, and sets *CODE to the executable - corresponding virtual address. */ -void * -ffi_closure_alloc (size_t size, void **code) -{ - void *ptr; - - if (!code) - return NULL; - - ptr = dlmalloc (size); - - if (ptr) - { - msegmentptr seg = segment_holding (gm, ptr); - - *code = add_segment_exec_offset (ptr, seg); - } - - return ptr; -} - -/* Release a chunk of memory allocated with ffi_closure_alloc. If - FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the - writable or the executable address given. Otherwise, only the - writable address can be provided here. */ -void -ffi_closure_free (void *ptr) -{ -#if FFI_CLOSURE_FREE_CODE - msegmentptr seg = segment_holding_code (gm, ptr); - - if (seg) - ptr = sub_segment_exec_offset (ptr, seg); -#endif - - dlfree (ptr); -} - - -#if FFI_CLOSURE_TEST -/* Do some internal sanity testing to make sure allocation and - deallocation of pages are working as intended. */ -int main () -{ - void *p[3]; -#define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0) -#define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0) - GET (0, malloc_getpagesize / 2); - GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*)); - PUT (1); - GET (1, 2 * malloc_getpagesize); - GET (2, malloc_getpagesize / 2); - PUT (1); - PUT (0); - PUT (2); - return 0; -} -#endif /* FFI_CLOSURE_TEST */ -# else /* ! FFI_MMAP_EXEC_WRIT */ - -/* On many systems, memory returned by malloc is writable and - executable, so just use it. */ - -#include - -void * -ffi_closure_alloc (size_t size, void **code) -{ - if (!code) - return NULL; - - return *code = malloc (size); -} - -void -ffi_closure_free (void *ptr) -{ - free (ptr); -} - -# endif /* ! FFI_MMAP_EXEC_WRIT */ -#endif /* FFI_CLOSURES */ diff --git a/llgo/third_party/gofrontend/libffi/src/cris/ffi.c b/llgo/third_party/gofrontend/libffi/src/cris/ffi.c deleted file mode 100644 index aaca5b1cbaa4d17732a0b3d8c8b612d8be9e1f64..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/cris/ffi.c +++ /dev/null @@ -1,386 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998 Cygnus Solutions - Copyright (c) 2004 Simon Posnjak - Copyright (c) 2005 Axis Communications AB - Copyright (C) 2007 Free Software Foundation, Inc. - - CRIS Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) - -static ffi_status -initialize_aggregate_packed_struct (ffi_type * arg) -{ - ffi_type **ptr; - - FFI_ASSERT (arg != NULL); - - FFI_ASSERT (arg->elements != NULL); - FFI_ASSERT (arg->size == 0); - FFI_ASSERT (arg->alignment == 0); - - ptr = &(arg->elements[0]); - - while ((*ptr) != NULL) - { - if (((*ptr)->size == 0) - && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - FFI_ASSERT (ffi_type_test ((*ptr))); - - arg->size += (*ptr)->size; - - arg->alignment = (arg->alignment > (*ptr)->alignment) ? - arg->alignment : (*ptr)->alignment; - - ptr++; - } - - if (arg->size == 0) - return FFI_BAD_TYPEDEF; - else - return FFI_OK; -} - -int -ffi_prep_args (char *stack, extended_cif * ecif) -{ - unsigned int i; - unsigned int struct_count = 0; - void **p_argv; - char *argp; - ffi_type **p_arg; - - argp = stack; - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); i--, p_arg++) - { - size_t z; - - switch ((*p_arg)->type) - { - case FFI_TYPE_STRUCT: - { - z = (*p_arg)->size; - if (z <= 4) - { - memcpy (argp, *p_argv, z); - z = 4; - } - else if (z <= 8) - { - memcpy (argp, *p_argv, z); - z = 8; - } - else - { - unsigned int uiLocOnStack; - z = sizeof (void *); - uiLocOnStack = 4 * ecif->cif->nargs + struct_count; - struct_count = struct_count + (*p_arg)->size; - *(unsigned int *) argp = - (unsigned int) (UINT32 *) (stack + uiLocOnStack); - memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size); - } - break; - } - default: - z = (*p_arg)->size; - if (z < sizeof (int)) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = - (unsigned int) *(UINT8 *) (*p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = - (unsigned int) *(UINT16 *) (*p_argv); - break; - - default: - FFI_ASSERT (0); - } - z = sizeof (int); - } - else if (z == sizeof (int)) - *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); - else - memcpy (argp, *p_argv, z); - break; - } - p_argv++; - argp += z; - } - - return (struct_count); -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_core (ffi_cif * cif, - ffi_abi abi, unsigned int isvariadic, - unsigned int nfixedargs, unsigned int ntotalargs, - ffi_type * rtype, ffi_type ** atypes) -{ - unsigned bytes = 0; - unsigned int i; - ffi_type **ptr; - - FFI_ASSERT (cif != NULL); - FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); - FFI_ASSERT(nfixedargs <= ntotalargs); - FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); - - cif->abi = abi; - cif->arg_types = atypes; - cif->nargs = ntotalargs; - cif->rtype = rtype; - - cif->flags = 0; - - if ((cif->rtype->size == 0) - && (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - FFI_ASSERT_VALID_TYPE (cif->rtype); - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - if (((*ptr)->size == 0) - && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) - return FFI_BAD_TYPEDEF; - - FFI_ASSERT_VALID_TYPE (*ptr); - - if (((*ptr)->alignment - 1) & bytes) - bytes = ALIGN (bytes, (*ptr)->alignment); - if ((*ptr)->type == FFI_TYPE_STRUCT) - { - if ((*ptr)->size > 8) - { - bytes += (*ptr)->size; - bytes += sizeof (void *); - } - else - { - if ((*ptr)->size > 4) - bytes += 8; - else - bytes += 4; - } - } - else - bytes += STACK_ARG_SIZE ((*ptr)->size); - } - - cif->bytes = bytes; - - return ffi_prep_cif_machdep (cif); -} - -ffi_status -ffi_prep_cif_machdep (ffi_cif * cif) -{ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = (unsigned) cif->rtype->type; - break; - - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -extern void ffi_call_SYSV (int (*)(char *, extended_cif *), - extended_cif *, - unsigned, unsigned, unsigned *, void (*fn) ()) - __attribute__ ((__visibility__ ("hidden"))); - -void -ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca (cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - default: - FFI_ASSERT (0); - break; - } -} - -/* Because the following variables are not exported outside libffi, we - mark them hidden. */ - -/* Assembly code for the jump stub. */ -extern const char ffi_cris_trampoline_template[] - __attribute__ ((__visibility__ ("hidden"))); - -/* Offset into ffi_cris_trampoline_template of where to put the - ffi_prep_closure_inner function. */ -extern const int ffi_cris_trampoline_fn_offset - __attribute__ ((__visibility__ ("hidden"))); - -/* Offset into ffi_cris_trampoline_template of where to put the - closure data. */ -extern const int ffi_cris_trampoline_closure_offset - __attribute__ ((__visibility__ ("hidden"))); - -/* This function is sibling-called (jumped to) by the closure - trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at - PARAMS[4] to simplify handling of a straddling parameter. A copy - of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are - put at the appropriate place in CLOSURE which is then executed and - the return value is passed back to the caller. */ - -static unsigned long long -ffi_prep_closure_inner (void **params, ffi_closure* closure) -{ - char *register_args = (char *) params; - void *struct_ret = params[5]; - char *stack_args = params[6]; - char *ptr = register_args; - ffi_cif *cif = closure->cif; - ffi_type **arg_types = cif->arg_types; - - /* Max room needed is number of arguments as 64-bit values. */ - void **avalue = alloca (closure->cif->nargs * sizeof(void *)); - int i; - int doing_regs; - long long llret = 0; - - /* Find the address of each argument. */ - for (i = 0, doing_regs = 1; i < cif->nargs; i++) - { - /* Types up to and including 8 bytes go by-value. */ - if (arg_types[i]->size <= 4) - { - avalue[i] = ptr; - ptr += 4; - } - else if (arg_types[i]->size <= 8) - { - avalue[i] = ptr; - ptr += 8; - } - else - { - FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT); - - /* Passed by-reference, so copy the pointer. */ - avalue[i] = *(void **) ptr; - ptr += 4; - } - - /* If we've handled more arguments than fit in registers, start - looking at the those passed on the stack. Step over the - first one if we had a straddling parameter. */ - if (doing_regs && ptr >= register_args + 4*4) - { - ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0); - doing_regs = 0; - } - } - - /* Invoke the closure. */ - (closure->fun) (cif, - - cif->rtype->type == FFI_TYPE_STRUCT - /* The caller allocated space for the return - structure, and passed a pointer to this space in - R9. */ - ? struct_ret - - /* We take advantage of being able to ignore that - the high part isn't set if the return value is - not in R10:R11, but in R10 only. */ - : (void *) &llret, - - avalue, closure->user_data); - - return llret; -} - -/* API function: Prepare the trampoline. */ - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif *, void *, void **, void*), - void *user_data, - void *codeloc) -{ - void *innerfn = ffi_prep_closure_inner; - FFI_ASSERT (cif->abi == FFI_SYSV); - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - memcpy (closure->tramp, ffi_cris_trampoline_template, - FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE); - memcpy (closure->tramp + ffi_cris_trampoline_fn_offset, - &innerfn, sizeof (void *)); - memcpy (closure->tramp + ffi_cris_trampoline_closure_offset, - &codeloc, sizeof (void *)); - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/cris/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/cris/ffitarget.h deleted file mode 100644 index b837e976e4e8b695420f6edfb5594d206e9a3501..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/cris/ffitarget.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for CRIS. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36 -#define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4) -#define FFI_TRAMPOLINE_SIZE \ - (FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE) -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/cris/sysv.S b/llgo/third_party/gofrontend/libffi/src/cris/sysv.S deleted file mode 100644 index 79abaee4d959ce87cad13857a68ddb63fc3a95e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/cris/sysv.S +++ /dev/null @@ -1,215 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2004 Simon Posnjak - Copyright (c) 2005 Axis Communications AB - - CRIS Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#define CONCAT(x,y) x ## y -#define XCONCAT(x,y) CONCAT (x, y) -#define L(x) XCONCAT (__USER_LABEL_PREFIX__, x) - - .text - - ;; OK, when we get called we should have this (according to - ;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3). - ;; - ;; R10: ffi_prep_args (func. pointer) - ;; R11: &ecif - ;; R12: cif->bytes - ;; R13: fig->flags - ;; sp+0: ecif.rvalue - ;; sp+4: fn (function pointer to the function that we need to call) - - .globl L(ffi_call_SYSV) - .type L(ffi_call_SYSV),@function - .hidden L(ffi_call_SYSV) - -L(ffi_call_SYSV): - ;; Save the regs to the stack. - push $srp - ;; Used for stack pointer saving. - push $r6 - ;; Used for function address pointer. - push $r7 - ;; Used for stack pointer saving. - push $r8 - ;; We save fig->flags to stack we will need them after we - ;; call The Function. - push $r13 - - ;; Saving current stack pointer. - move.d $sp,$r8 - move.d $sp,$r6 - - ;; Move address of ffi_prep_args to r13. - move.d $r10,$r13 - - ;; Make room on the stack for the args of fn. - sub.d $r12,$sp - - ;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are: - ;; r10 <-- stack pointer - ;; r11 <-- &ecif (already there) - move.d $sp,$r10 - - ;; Call the function. - jsr $r13 - - ;; Save the size of the structures which are passed on stack. - move.d $r10,$r7 - - ;; Move first four args in to r10..r13. - move.d [$sp+0],$r10 - move.d [$sp+4],$r11 - move.d [$sp+8],$r12 - move.d [$sp+12],$r13 - - ;; Adjust the stack and check if any parameters are given on stack. - addq 16,$sp - sub.d $r7,$r6 - cmp.d $sp,$r6 - - bpl go_on - nop - -go_on_no_params_on_stack: - move.d $r6,$sp - -go_on: - ;; Discover if we need to put rval address in to r9. - move.d [$r8+0],$r7 - cmpq FFI_TYPE_STRUCT,$r7 - bne call_now - nop - - ;; Move rval address to $r9. - move.d [$r8+20],$r9 - -call_now: - ;; Move address of The Function in to r7. - move.d [$r8+24],$r7 - - ;; Call The Function. - jsr $r7 - - ;; Reset stack. - move.d $r8,$sp - - ;; Load rval type (fig->flags) in to r13. - pop $r13 - - ;; Detect rval type. - cmpq FFI_TYPE_VOID,$r13 - beq epilogue - - cmpq FFI_TYPE_STRUCT,$r13 - beq epilogue - - cmpq FFI_TYPE_DOUBLE,$r13 - beq return_double_or_longlong - - cmpq FFI_TYPE_UINT64,$r13 - beq return_double_or_longlong - - cmpq FFI_TYPE_SINT64,$r13 - beq return_double_or_longlong - nop - - ;; Just return the 32 bit value. - ba return - nop - -return_double_or_longlong: - ;; Load half of the rval to r10 and the other half to r11. - move.d [$sp+16],$r13 - move.d $r10,[$r13] - addq 4,$r13 - move.d $r11,[$r13] - ba epilogue - nop - -return: - ;; Load the rval to r10. - move.d [$sp+16],$r13 - move.d $r10,[$r13] - -epilogue: - pop $r8 - pop $r7 - pop $r6 - Jump [$sp+] - - .size ffi_call_SYSV,.-ffi_call_SYSV - -/* Save R10..R13 into an array, somewhat like varargs. Copy the next - argument too, to simplify handling of any straddling parameter. - Save R9 and SP after those. Jump to function handling the rest. - Since this is a template, copied and the main function filled in by - the user. */ - - .globl L(ffi_cris_trampoline_template) - .type L(ffi_cris_trampoline_template),@function - .hidden L(ffi_cris_trampoline_template) - -L(ffi_cris_trampoline_template): -0: - /* The value we get for "PC" is right after the prefix instruction, - two bytes from the beginning, i.e. 0b+2. */ - move.d $r10,[$pc+2f-(0b+2)] - move.d $pc,$r10 -1: - addq 2f-1b+4,$r10 - move.d $r11,[$r10+] - move.d $r12,[$r10+] - move.d $r13,[$r10+] - move.d [$sp],$r11 - move.d $r11,[$r10+] - move.d $r9,[$r10+] - move.d $sp,[$r10+] - subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10 - move.d 0,$r11 -3: - jump 0 -2: - .size ffi_cris_trampoline_template,.-0b - -/* This macro create a constant usable as "extern const int \name" in - C from within libffi, when \name has no prefix decoration. */ - - .macro const name,value - .globl \name - .type \name,@object - .hidden \name -\name: - .dword \value - .size \name,4 - .endm - -/* Constants for offsets within the trampoline. We could do this with - just symbols, avoiding memory contents and memory accesses, but the - C usage code would look a bit stranger. */ - - const L(ffi_cris_trampoline_fn_offset),2b-4-0b - const L(ffi_cris_trampoline_closure_offset),3b-4-0b diff --git a/llgo/third_party/gofrontend/libffi/src/debug.c b/llgo/third_party/gofrontend/libffi/src/debug.c deleted file mode 100644 index f3172b1ef6c9a9f04870cc76815984091de95da9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/debug.c +++ /dev/null @@ -1,64 +0,0 @@ -/* ----------------------------------------------------------------------- - debug.c - Copyright (c) 1996 Red Hat, Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include - -/* General debugging routines */ - -void ffi_stop_here(void) -{ - /* This function is only useful for debugging purposes. - Place a breakpoint on ffi_stop_here to be notified of - significant events. */ -} - -/* This function should only be called via the FFI_ASSERT() macro */ - -void ffi_assert(char *expr, char *file, int line) -{ - fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); - ffi_stop_here(); - abort(); -} - -/* Perform a sanity check on an ffi_type structure */ - -void ffi_type_test(ffi_type *a, char *file, int line) -{ - FFI_ASSERT_AT(a != NULL, file, line); - - FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); - FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); - FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); - FFI_ASSERT_AT((a->type != FFI_TYPE_STRUCT && a->type != FFI_TYPE_COMPLEX) - || a->elements != NULL, file, line); - FFI_ASSERT_AT(a->type != FFI_TYPE_COMPLEX - || (a->elements != NULL - && a->elements[0] != NULL && a->elements[1] == NULL), - file, line); - -} diff --git a/llgo/third_party/gofrontend/libffi/src/dlmalloc.c b/llgo/third_party/gofrontend/libffi/src/dlmalloc.c deleted file mode 100644 index 7e4ea83b7d2beac958d49311bc8ff9e05fa64684..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/dlmalloc.c +++ /dev/null @@ -1,5161 +0,0 @@ -/* - This is a version (aka dlmalloc) of malloc/free/realloc written by - Doug Lea and released to the public domain, as explained at - http://creativecommons.org/licenses/publicdomain. Send questions, - comments, complaints, performance data, etc to dl@cs.oswego.edu - -* Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee) - - Note: There may be an updated version of this malloc obtainable at - ftp://gee.cs.oswego.edu/pub/misc/malloc.c - Check before installing! - -* Quickstart - - This library is all in one file to simplify the most common usage: - ftp it, compile it (-O3), and link it into another program. All of - the compile-time options default to reasonable values for use on - most platforms. You might later want to step through various - compile-time and dynamic tuning options. - - For convenience, an include file for code using this malloc is at: - ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h - You don't really need this .h file unless you call functions not - defined in your system include files. The .h file contains only the - excerpts from this file needed for using this malloc on ANSI C/C++ - systems, so long as you haven't changed compile-time options about - naming and tuning parameters. If you do, then you can create your - own malloc.h that does include all settings by cutting at the point - indicated below. Note that you may already by default be using a C - library containing a malloc that is based on some version of this - malloc (for example in linux). You might still want to use the one - in this file to customize settings or to avoid overheads associated - with library versions. - -* Vital statistics: - - Supported pointer/size_t representation: 4 or 8 bytes - size_t MUST be an unsigned type of the same width as - pointers. (If you are using an ancient system that declares - size_t as a signed type, or need it to be a different width - than pointers, you can use a previous release of this malloc - (e.g. 2.7.2) supporting these.) - - Alignment: 8 bytes (default) - This suffices for nearly all current machines and C compilers. - However, you can define MALLOC_ALIGNMENT to be wider than this - if necessary (up to 128bytes), at the expense of using more space. - - Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) - 8 or 16 bytes (if 8byte sizes) - Each malloced chunk has a hidden word of overhead holding size - and status information, and additional cross-check word - if FOOTERS is defined. - - Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) - 8-byte ptrs: 32 bytes (including overhead) - - Even a request for zero bytes (i.e., malloc(0)) returns a - pointer to something of the minimum allocatable size. - The maximum overhead wastage (i.e., number of extra bytes - allocated than were requested in malloc) is less than or equal - to the minimum size, except for requests >= mmap_threshold that - are serviced via mmap(), where the worst case wastage is about - 32 bytes plus the remainder from a system page (the minimal - mmap unit); typically 4096 or 8192 bytes. - - Security: static-safe; optionally more or less - The "security" of malloc refers to the ability of malicious - code to accentuate the effects of errors (for example, freeing - space that is not currently malloc'ed or overwriting past the - ends of chunks) in code that calls malloc. This malloc - guarantees not to modify any memory locations below the base of - heap, i.e., static variables, even in the presence of usage - errors. The routines additionally detect most improper frees - and reallocs. All this holds as long as the static bookkeeping - for malloc itself is not corrupted by some other means. This - is only one aspect of security -- these checks do not, and - cannot, detect all possible programming errors. - - If FOOTERS is defined nonzero, then each allocated chunk - carries an additional check word to verify that it was malloced - from its space. These check words are the same within each - execution of a program using malloc, but differ across - executions, so externally crafted fake chunks cannot be - freed. This improves security by rejecting frees/reallocs that - could corrupt heap memory, in addition to the checks preventing - writes to statics that are always on. This may further improve - security at the expense of time and space overhead. (Note that - FOOTERS may also be worth using with MSPACES.) - - By default detected errors cause the program to abort (calling - "abort()"). You can override this to instead proceed past - errors by defining PROCEED_ON_ERROR. In this case, a bad free - has no effect, and a malloc that encounters a bad address - caused by user overwrites will ignore the bad address by - dropping pointers and indices to all known memory. This may - be appropriate for programs that should continue if at all - possible in the face of programming errors, although they may - run out of memory because dropped memory is never reclaimed. - - If you don't like either of these options, you can define - CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything - else. And if if you are sure that your program using malloc has - no errors or vulnerabilities, you can define INSECURE to 1, - which might (or might not) provide a small performance improvement. - - Thread-safety: NOT thread-safe unless USE_LOCKS defined - When USE_LOCKS is defined, each public call to malloc, free, - etc is surrounded with either a pthread mutex or a win32 - spinlock (depending on WIN32). This is not especially fast, and - can be a major bottleneck. It is designed only to provide - minimal protection in concurrent environments, and to provide a - basis for extensions. If you are using malloc in a concurrent - program, consider instead using ptmalloc, which is derived from - a version of this malloc. (See http://www.malloc.de). - - System requirements: Any combination of MORECORE and/or MMAP/MUNMAP - This malloc can use unix sbrk or any emulation (invoked using - the CALL_MORECORE macro) and/or mmap/munmap or any emulation - (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system - memory. On most unix systems, it tends to work best if both - MORECORE and MMAP are enabled. On Win32, it uses emulations - based on VirtualAlloc. It also uses common C library functions - like memset. - - Compliance: I believe it is compliant with the Single Unix Specification - (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably - others as well. - -* Overview of algorithms - - This is not the fastest, most space-conserving, most portable, or - most tunable malloc ever written. However it is among the fastest - while also being among the most space-conserving, portable and - tunable. Consistent balance across these factors results in a good - general-purpose allocator for malloc-intensive programs. - - In most ways, this malloc is a best-fit allocator. Generally, it - chooses the best-fitting existing chunk for a request, with ties - broken in approximately least-recently-used order. (This strategy - normally maintains low fragmentation.) However, for requests less - than 256bytes, it deviates from best-fit when there is not an - exactly fitting available chunk by preferring to use space adjacent - to that used for the previous small request, as well as by breaking - ties in approximately most-recently-used order. (These enhance - locality of series of small allocations.) And for very large requests - (>= 256Kb by default), it relies on system memory mapping - facilities, if supported. (This helps avoid carrying around and - possibly fragmenting memory used only for large chunks.) - - All operations (except malloc_stats and mallinfo) have execution - times that are bounded by a constant factor of the number of bits in - a size_t, not counting any clearing in calloc or copying in realloc, - or actions surrounding MORECORE and MMAP that have times - proportional to the number of non-contiguous regions returned by - system allocation routines, which is often just 1. - - The implementation is not very modular and seriously overuses - macros. Perhaps someday all C compilers will do as good a job - inlining modular code as can now be done by brute-force expansion, - but now, enough of them seem not to. - - Some compilers issue a lot of warnings about code that is - dead/unreachable only on some platforms, and also about intentional - uses of negation on unsigned types. All known cases of each can be - ignored. - - For a longer but out of date high-level description, see - http://gee.cs.oswego.edu/dl/html/malloc.html - -* MSPACES - If MSPACES is defined, then in addition to malloc, free, etc., - this file also defines mspace_malloc, mspace_free, etc. These - are versions of malloc routines that take an "mspace" argument - obtained using create_mspace, to control all internal bookkeeping. - If ONLY_MSPACES is defined, only these versions are compiled. - So if you would like to use this allocator for only some allocations, - and your system malloc for others, you can compile with - ONLY_MSPACES and then do something like... - static mspace mymspace = create_mspace(0,0); // for example - #define mymalloc(bytes) mspace_malloc(mymspace, bytes) - - (Note: If you only need one instance of an mspace, you can instead - use "USE_DL_PREFIX" to relabel the global malloc.) - - You can similarly create thread-local allocators by storing - mspaces as thread-locals. For example: - static __thread mspace tlms = 0; - void* tlmalloc(size_t bytes) { - if (tlms == 0) tlms = create_mspace(0, 0); - return mspace_malloc(tlms, bytes); - } - void tlfree(void* mem) { mspace_free(tlms, mem); } - - Unless FOOTERS is defined, each mspace is completely independent. - You cannot allocate from one and free to another (although - conformance is only weakly checked, so usage errors are not always - caught). If FOOTERS is defined, then each chunk carries around a tag - indicating its originating mspace, and frees are directed to their - originating spaces. - - ------------------------- Compile-time options --------------------------- - -Be careful in setting #define values for numerical constants of type -size_t. On some systems, literal values are not automatically extended -to size_t precision unless they are explicitly casted. - -WIN32 default: defined if _WIN32 defined - Defining WIN32 sets up defaults for MS environment and compilers. - Otherwise defaults are for unix. - -MALLOC_ALIGNMENT default: (size_t)8 - Controls the minimum alignment for malloc'ed chunks. It must be a - power of two and at least 8, even on machines for which smaller - alignments would suffice. It may be defined as larger than this - though. Note however that code and data structures are optimized for - the case of 8-byte alignment. - -MSPACES default: 0 (false) - If true, compile in support for independent allocation spaces. - This is only supported if HAVE_MMAP is true. - -ONLY_MSPACES default: 0 (false) - If true, only compile in mspace versions, not regular versions. - -USE_LOCKS default: 0 (false) - Causes each call to each public routine to be surrounded with - pthread or WIN32 mutex lock/unlock. (If set true, this can be - overridden on a per-mspace basis for mspace versions.) - -FOOTERS default: 0 - If true, provide extra checking and dispatching by placing - information in the footers of allocated chunks. This adds - space and time overhead. - -INSECURE default: 0 - If true, omit checks for usage errors and heap space overwrites. - -USE_DL_PREFIX default: NOT defined - Causes compiler to prefix all public routines with the string 'dl'. - This can be useful when you only want to use this malloc in one part - of a program, using your regular system malloc elsewhere. - -ABORT default: defined as abort() - Defines how to abort on failed checks. On most systems, a failed - check cannot die with an "assert" or even print an informative - message, because the underlying print routines in turn call malloc, - which will fail again. Generally, the best policy is to simply call - abort(). It's not very useful to do more than this because many - errors due to overwriting will show up as address faults (null, odd - addresses etc) rather than malloc-triggered checks, so will also - abort. Also, most compilers know that abort() does not return, so - can better optimize code conditionally calling it. - -PROCEED_ON_ERROR default: defined as 0 (false) - Controls whether detected bad addresses cause them to bypassed - rather than aborting. If set, detected bad arguments to free and - realloc are ignored. And all bookkeeping information is zeroed out - upon a detected overwrite of freed heap space, thus losing the - ability to ever return it from malloc again, but enabling the - application to proceed. If PROCEED_ON_ERROR is defined, the - static variable malloc_corruption_error_count is compiled in - and can be examined to see if errors have occurred. This option - generates slower code than the default abort policy. - -DEBUG default: NOT defined - The DEBUG setting is mainly intended for people trying to modify - this code or diagnose problems when porting to new platforms. - However, it may also be able to better isolate user errors than just - using runtime checks. The assertions in the check routines spell - out in more detail the assumptions and invariants underlying the - algorithms. The checking is fairly extensive, and will slow down - execution noticeably. Calling malloc_stats or mallinfo with DEBUG - set will attempt to check every non-mmapped allocated and free chunk - in the course of computing the summaries. - -ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) - Debugging assertion failures can be nearly impossible if your - version of the assert macro causes malloc to be called, which will - lead to a cascade of further failures, blowing the runtime stack. - ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), - which will usually make debugging easier. - -MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 - The action to take before "return 0" when malloc fails to be able to - return memory because there is none available. - -HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES - True if this system supports sbrk or an emulation of it. - -MORECORE default: sbrk - The name of the sbrk-style system routine to call to obtain more - memory. See below for guidance on writing custom MORECORE - functions. The type of the argument to sbrk/MORECORE varies across - systems. It cannot be size_t, because it supports negative - arguments, so it is normally the signed type of the same width as - size_t (sometimes declared as "intptr_t"). It doesn't much matter - though. Internally, we only call it with arguments less than half - the max value of a size_t, which should work across all reasonable - possibilities, although sometimes generating compiler warnings. See - near the end of this file for guidelines for creating a custom - version of MORECORE. - -MORECORE_CONTIGUOUS default: 1 (true) - If true, take advantage of fact that consecutive calls to MORECORE - with positive arguments always return contiguous increasing - addresses. This is true of unix sbrk. It does not hurt too much to - set it true anyway, since malloc copes with non-contiguities. - Setting it false when definitely non-contiguous saves time - and possibly wasted space it would take to discover this though. - -MORECORE_CANNOT_TRIM default: NOT defined - True if MORECORE cannot release space back to the system when given - negative arguments. This is generally necessary only if you are - using a hand-crafted MORECORE function that cannot handle negative - arguments. - -HAVE_MMAP default: 1 (true) - True if this system supports mmap or an emulation of it. If so, and - HAVE_MORECORE is not true, MMAP is used for all system - allocation. If set and HAVE_MORECORE is true as well, MMAP is - primarily used to directly allocate very large blocks. It is also - used as a backup strategy in cases where MORECORE fails to provide - space from system. Note: A single call to MUNMAP is assumed to be - able to unmap memory that may have be allocated using multiple calls - to MMAP, so long as they are adjacent. - -HAVE_MREMAP default: 1 on linux, else 0 - If true realloc() uses mremap() to re-allocate large blocks and - extend or shrink allocation spaces. - -MMAP_CLEARS default: 1 on unix - True if mmap clears memory so calloc doesn't need to. This is true - for standard unix mmap using /dev/zero. - -USE_BUILTIN_FFS default: 0 (i.e., not used) - Causes malloc to use the builtin ffs() function to compute indices. - Some compilers may recognize and intrinsify ffs to be faster than the - supplied C version. Also, the case of x86 using gcc is special-cased - to an asm instruction, so is already as fast as it can be, and so - this setting has no effect. (On most x86s, the asm version is only - slightly faster than the C version.) - -malloc_getpagesize default: derive from system includes, or 4096. - The system page size. To the extent possible, this malloc manages - memory from the system in page-size units. This may be (and - usually is) a function rather than a constant. This is ignored - if WIN32, where page size is determined using getSystemInfo during - initialization. - -USE_DEV_RANDOM default: 0 (i.e., not used) - Causes malloc to use /dev/random to initialize secure magic seed for - stamping footers. Otherwise, the current time is used. - -NO_MALLINFO default: 0 - If defined, don't compile "mallinfo". This can be a simple way - of dealing with mismatches between system declarations and - those in this file. - -MALLINFO_FIELD_TYPE default: size_t - The type of the fields in the mallinfo struct. This was originally - defined as "int" in SVID etc, but is more usefully defined as - size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set - -REALLOC_ZERO_BYTES_FREES default: not defined - This should be set if a call to realloc with zero bytes should - be the same as a call to free. Some people think it should. Otherwise, - since this malloc returns a unique pointer for malloc(0), so does - realloc(p, 0). - -LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H -LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H -LACKS_STDLIB_H default: NOT defined unless on WIN32 - Define these if your system does not have these header files. - You might need to manually insert some of the declarations they provide. - -DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, - system_info.dwAllocationGranularity in WIN32, - otherwise 64K. - Also settable using mallopt(M_GRANULARITY, x) - The unit for allocating and deallocating memory from the system. On - most systems with contiguous MORECORE, there is no reason to - make this more than a page. However, systems with MMAP tend to - either require or encourage larger granularities. You can increase - this value to prevent system allocation functions to be called so - often, especially if they are slow. The value must be at least one - page and must be a power of two. Setting to 0 causes initialization - to either page size or win32 region size. (Note: In previous - versions of malloc, the equivalent of this option was called - "TOP_PAD") - -DEFAULT_TRIM_THRESHOLD default: 2MB - Also settable using mallopt(M_TRIM_THRESHOLD, x) - The maximum amount of unused top-most memory to keep before - releasing via malloc_trim in free(). Automatic trimming is mainly - useful in long-lived programs using contiguous MORECORE. Because - trimming via sbrk can be slow on some systems, and can sometimes be - wasteful (in cases where programs immediately afterward allocate - more large chunks) the value should be high enough so that your - overall system performance would improve by releasing this much - memory. As a rough guide, you might set to a value close to the - average size of a process (program) running on your system. - Releasing this much memory would allow such a process to run in - memory. Generally, it is worth tuning trim thresholds when a - program undergoes phases where several large chunks are allocated - and released in ways that can reuse each other's storage, perhaps - mixed with phases where there are no such chunks at all. The trim - value must be greater than page size to have any useful effect. To - disable trimming completely, you can set to MAX_SIZE_T. Note that the trick - some people use of mallocing a huge space and then freeing it at - program startup, in an attempt to reserve system memory, doesn't - have the intended effect under automatic trimming, since that memory - will immediately be returned to the system. - -DEFAULT_MMAP_THRESHOLD default: 256K - Also settable using mallopt(M_MMAP_THRESHOLD, x) - The request size threshold for using MMAP to directly service a - request. Requests of at least this size that cannot be allocated - using already-existing space will be serviced via mmap. (If enough - normal freed space already exists it is used instead.) Using mmap - segregates relatively large chunks of memory so that they can be - individually obtained and released from the host system. A request - serviced through mmap is never reused by any other request (at least - not directly; the system may just so happen to remap successive - requests to the same locations). Segregating space in this way has - the benefits that: Mmapped space can always be individually released - back to the system, which helps keep the system level memory demands - of a long-lived program low. Also, mapped memory doesn't become - `locked' between other chunks, as can happen with normally allocated - chunks, which means that even trimming via malloc_trim would not - release them. However, it has the disadvantage that the space - cannot be reclaimed, consolidated, and then used to service later - requests, as happens with normal chunks. The advantages of mmap - nearly always outweigh disadvantages for "large" chunks, but the - value of "large" may vary across systems. The default is an - empirically derived value that works well in most systems. You can - disable mmap by setting to MAX_SIZE_T. - -*/ - -#ifndef WIN32 -#ifdef _WIN32 -#define WIN32 1 -#endif /* _WIN32 */ -#endif /* WIN32 */ -#ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#define HAVE_MMAP 1 -#define HAVE_MORECORE 0 -#define LACKS_UNISTD_H -#define LACKS_SYS_PARAM_H -#define LACKS_SYS_MMAN_H -#define LACKS_STRING_H -#define LACKS_STRINGS_H -#define LACKS_SYS_TYPES_H -#define LACKS_ERRNO_H -#define MALLOC_FAILURE_ACTION -#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ -#endif /* WIN32 */ - -#ifdef __OS2__ -#define INCL_DOS -#include -#define HAVE_MMAP 1 -#define HAVE_MORECORE 0 -#define LACKS_SYS_MMAN_H -#endif /* __OS2__ */ - -#if defined(DARWIN) || defined(_DARWIN) -/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ -#ifndef HAVE_MORECORE -#define HAVE_MORECORE 0 -#define HAVE_MMAP 1 -#endif /* HAVE_MORECORE */ -#endif /* DARWIN */ - -#ifndef LACKS_SYS_TYPES_H -#include /* For size_t */ -#endif /* LACKS_SYS_TYPES_H */ - -/* The maximum possible size_t value has all bits set */ -#define MAX_SIZE_T (~(size_t)0) - -#ifndef ONLY_MSPACES -#define ONLY_MSPACES 0 -#endif /* ONLY_MSPACES */ -#ifndef MSPACES -#if ONLY_MSPACES -#define MSPACES 1 -#else /* ONLY_MSPACES */ -#define MSPACES 0 -#endif /* ONLY_MSPACES */ -#endif /* MSPACES */ -#ifndef MALLOC_ALIGNMENT -#define MALLOC_ALIGNMENT ((size_t)8U) -#endif /* MALLOC_ALIGNMENT */ -#ifndef FOOTERS -#define FOOTERS 0 -#endif /* FOOTERS */ -#ifndef ABORT -#define ABORT abort() -#endif /* ABORT */ -#ifndef ABORT_ON_ASSERT_FAILURE -#define ABORT_ON_ASSERT_FAILURE 1 -#endif /* ABORT_ON_ASSERT_FAILURE */ -#ifndef PROCEED_ON_ERROR -#define PROCEED_ON_ERROR 0 -#endif /* PROCEED_ON_ERROR */ -#ifndef USE_LOCKS -#define USE_LOCKS 0 -#endif /* USE_LOCKS */ -#ifndef INSECURE -#define INSECURE 0 -#endif /* INSECURE */ -#ifndef HAVE_MMAP -#define HAVE_MMAP 1 -#endif /* HAVE_MMAP */ -#ifndef MMAP_CLEARS -#define MMAP_CLEARS 1 -#endif /* MMAP_CLEARS */ -#ifndef HAVE_MREMAP -#ifdef linux -#define HAVE_MREMAP 1 -#else /* linux */ -#define HAVE_MREMAP 0 -#endif /* linux */ -#endif /* HAVE_MREMAP */ -#ifndef MALLOC_FAILURE_ACTION -#define MALLOC_FAILURE_ACTION errno = ENOMEM; -#endif /* MALLOC_FAILURE_ACTION */ -#ifndef HAVE_MORECORE -#if ONLY_MSPACES -#define HAVE_MORECORE 0 -#else /* ONLY_MSPACES */ -#define HAVE_MORECORE 1 -#endif /* ONLY_MSPACES */ -#endif /* HAVE_MORECORE */ -#if !HAVE_MORECORE -#define MORECORE_CONTIGUOUS 0 -#else /* !HAVE_MORECORE */ -#ifndef MORECORE -#define MORECORE sbrk -#endif /* MORECORE */ -#ifndef MORECORE_CONTIGUOUS -#define MORECORE_CONTIGUOUS 1 -#endif /* MORECORE_CONTIGUOUS */ -#endif /* HAVE_MORECORE */ -#ifndef DEFAULT_GRANULARITY -#if MORECORE_CONTIGUOUS -#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ -#else /* MORECORE_CONTIGUOUS */ -#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) -#endif /* MORECORE_CONTIGUOUS */ -#endif /* DEFAULT_GRANULARITY */ -#ifndef DEFAULT_TRIM_THRESHOLD -#ifndef MORECORE_CANNOT_TRIM -#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) -#else /* MORECORE_CANNOT_TRIM */ -#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T -#endif /* MORECORE_CANNOT_TRIM */ -#endif /* DEFAULT_TRIM_THRESHOLD */ -#ifndef DEFAULT_MMAP_THRESHOLD -#if HAVE_MMAP -#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) -#else /* HAVE_MMAP */ -#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T -#endif /* HAVE_MMAP */ -#endif /* DEFAULT_MMAP_THRESHOLD */ -#ifndef USE_BUILTIN_FFS -#define USE_BUILTIN_FFS 0 -#endif /* USE_BUILTIN_FFS */ -#ifndef USE_DEV_RANDOM -#define USE_DEV_RANDOM 0 -#endif /* USE_DEV_RANDOM */ -#ifndef NO_MALLINFO -#define NO_MALLINFO 0 -#endif /* NO_MALLINFO */ -#ifndef MALLINFO_FIELD_TYPE -#define MALLINFO_FIELD_TYPE size_t -#endif /* MALLINFO_FIELD_TYPE */ - -/* - mallopt tuning options. SVID/XPG defines four standard parameter - numbers for mallopt, normally defined in malloc.h. None of these - are used in this malloc, so setting them has no effect. But this - malloc does support the following options. -*/ - -#define M_TRIM_THRESHOLD (-1) -#define M_GRANULARITY (-2) -#define M_MMAP_THRESHOLD (-3) - -/* ------------------------ Mallinfo declarations ------------------------ */ - -#if !NO_MALLINFO -/* - This version of malloc supports the standard SVID/XPG mallinfo - routine that returns a struct containing usage properties and - statistics. It should work on any system that has a - /usr/include/malloc.h defining struct mallinfo. The main - declaration needed is the mallinfo struct that is returned (by-copy) - by mallinfo(). The malloinfo struct contains a bunch of fields that - are not even meaningful in this version of malloc. These fields are - are instead filled by mallinfo() with other numbers that might be of - interest. - - HAVE_USR_INCLUDE_MALLOC_H should be set if you have a - /usr/include/malloc.h file that includes a declaration of struct - mallinfo. If so, it is included; else a compliant version is - declared below. These must be precisely the same for mallinfo() to - work. The original SVID version of this struct, defined on most - systems with mallinfo, declares all fields as ints. But some others - define as unsigned long. If your system defines the fields using a - type of different width than listed here, you MUST #include your - system version and #define HAVE_USR_INCLUDE_MALLOC_H. -*/ - -/* #define HAVE_USR_INCLUDE_MALLOC_H */ - -#ifdef HAVE_USR_INCLUDE_MALLOC_H -#include "/usr/include/malloc.h" -#else /* HAVE_USR_INCLUDE_MALLOC_H */ - -/* HP-UX's stdlib.h redefines mallinfo unless _STRUCT_MALLINFO is defined */ -#define _STRUCT_MALLINFO - -struct mallinfo { - MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ - MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ - MALLINFO_FIELD_TYPE smblks; /* always 0 */ - MALLINFO_FIELD_TYPE hblks; /* always 0 */ - MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ - MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ - MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ - MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ - MALLINFO_FIELD_TYPE fordblks; /* total free space */ - MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ -}; - -#endif /* HAVE_USR_INCLUDE_MALLOC_H */ -#endif /* NO_MALLINFO */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#if !ONLY_MSPACES - -/* ------------------- Declarations of public routines ------------------- */ - -#ifndef USE_DL_PREFIX -#define dlcalloc calloc -#define dlfree free -#define dlmalloc malloc -#define dlmemalign memalign -#define dlrealloc realloc -#define dlvalloc valloc -#define dlpvalloc pvalloc -#define dlmallinfo mallinfo -#define dlmallopt mallopt -#define dlmalloc_trim malloc_trim -#define dlmalloc_stats malloc_stats -#define dlmalloc_usable_size malloc_usable_size -#define dlmalloc_footprint malloc_footprint -#define dlmalloc_max_footprint malloc_max_footprint -#define dlindependent_calloc independent_calloc -#define dlindependent_comalloc independent_comalloc -#endif /* USE_DL_PREFIX */ - - -/* - malloc(size_t n) - Returns a pointer to a newly allocated chunk of at least n bytes, or - null if no space is available, in which case errno is set to ENOMEM - on ANSI C systems. - - If n is zero, malloc returns a minimum-sized chunk. (The minimum - size is 16 bytes on most 32bit systems, and 32 bytes on 64bit - systems.) Note that size_t is an unsigned type, so calls with - arguments that would be negative if signed are interpreted as - requests for huge amounts of space, which will often fail. The - maximum supported value of n differs across systems, but is in all - cases less than the maximum representable value of a size_t. -*/ -void* dlmalloc(size_t); - -/* - free(void* p) - Releases the chunk of memory pointed to by p, that had been previously - allocated using malloc or a related routine such as realloc. - It has no effect if p is null. If p was not malloced or already - freed, free(p) will by default cause the current program to abort. -*/ -void dlfree(void*); - -/* - calloc(size_t n_elements, size_t element_size); - Returns a pointer to n_elements * element_size bytes, with all locations - set to zero. -*/ -void* dlcalloc(size_t, size_t); - -/* - realloc(void* p, size_t n) - Returns a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes, or null - if no space is available. - - The returned pointer may or may not be the same as p. The algorithm - prefers extending p in most cases when possible, otherwise it - employs the equivalent of a malloc-copy-free sequence. - - If p is null, realloc is equivalent to malloc. - - If space is not available, realloc returns null, errno is set (if on - ANSI) and p is NOT freed. - - if n is for fewer bytes than already held by p, the newly unused - space is lopped off and freed if possible. realloc with a size - argument of zero (re)allocates a minimum-sized chunk. - - The old unix realloc convention of allowing the last-free'd chunk - to be used as an argument to realloc is not supported. -*/ - -void* dlrealloc(void*, size_t); - -/* - memalign(size_t alignment, size_t n); - Returns a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument. - - The alignment argument should be a power of two. If the argument is - not a power of two, the nearest greater power is used. - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. -*/ -void* dlmemalign(size_t, size_t); - -/* - valloc(size_t n); - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system. If the pagesize is unknown, 4096 is used. -*/ -void* dlvalloc(size_t); - -/* - mallopt(int parameter_number, int parameter_value) - Sets tunable parameters The format is to provide a - (parameter-number, parameter-value) pair. mallopt then sets the - corresponding parameter to the argument value if it can (i.e., so - long as the value is meaningful), and returns 1 if successful else - 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, - normally defined in malloc.h. None of these are use in this malloc, - so setting them has no effect. But this malloc also supports other - options in mallopt. See below for details. Briefly, supported - parameters are as follows (listed defaults are for "typical" - configurations). - - Symbol param # default allowed param values - M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) - M_GRANULARITY -2 page size any power of 2 >= page size - M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) -*/ -int dlmallopt(int, int); - -/* - malloc_footprint(); - Returns the number of bytes obtained from the system. The total - number of bytes allocated by malloc, realloc etc., is less than this - value. Unlike mallinfo, this function returns only a precomputed - result, so can be called frequently to monitor memory consumption. - Even if locks are otherwise defined, this function does not use them, - so results might not be up to date. -*/ -size_t dlmalloc_footprint(void); - -/* - malloc_max_footprint(); - Returns the maximum number of bytes obtained from the system. This - value will be greater than current footprint if deallocated space - has been reclaimed by the system. The peak number of bytes allocated - by malloc, realloc etc., is less than this value. Unlike mallinfo, - this function returns only a precomputed result, so can be called - frequently to monitor memory consumption. Even if locks are - otherwise defined, this function does not use them, so results might - not be up to date. -*/ -size_t dlmalloc_max_footprint(void); - -#if !NO_MALLINFO -/* - mallinfo() - Returns (by copy) a struct containing various summary statistics: - - arena: current total non-mmapped bytes allocated from system - ordblks: the number of free chunks - smblks: always zero. - hblks: current number of mmapped regions - hblkhd: total bytes held in mmapped regions - usmblks: the maximum total allocated space. This will be greater - than current total if trimming has occurred. - fsmblks: always zero - uordblks: current total allocated space (normal or mmapped) - fordblks: total free space - keepcost: the maximum number of bytes that could ideally be released - back to system via malloc_trim. ("ideally" means that - it ignores page restrictions etc.) - - Because these fields are ints, but internal bookkeeping may - be kept as longs, the reported values may wrap around zero and - thus be inaccurate. -*/ -struct mallinfo dlmallinfo(void); -#endif /* NO_MALLINFO */ - -/* - independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); - - independent_calloc is similar to calloc, but instead of returning a - single cleared space, it returns an array of pointers to n_elements - independent elements that can hold contents of size elem_size, each - of which starts out cleared, and can be independently freed, - realloc'ed etc. The elements are guaranteed to be adjacently - allocated (this is not guaranteed to occur with multiple callocs or - mallocs), which may also improve cache locality in some - applications. - - The "chunks" argument is optional (i.e., may be null, which is - probably the most typical usage). If it is null, the returned array - is itself dynamically allocated and should also be freed when it is - no longer needed. Otherwise, the chunks array must be of at least - n_elements in length. It is filled in with the pointers to the - chunks. - - In either case, independent_calloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and "chunks" - is null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use regular calloc and assign pointers into this - space to represent elements. (In this case though, you cannot - independently free elements.) - - independent_calloc simplifies and speeds up implementations of many - kinds of pools. It may also be useful when constructing large data - structures that initially have a fixed number of fixed-sized nodes, - but the number is not known at compile time, and some of the nodes - may later need to be freed. For example: - - struct Node { int item; struct Node* next; }; - - struct Node* build_list() { - struct Node** pool; - int n = read_number_of_nodes_needed(); - if (n <= 0) return 0; - pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); - if (pool == 0) die(); - // organize into a linked list... - struct Node* first = pool[0]; - for (i = 0; i < n-1; ++i) - pool[i]->next = pool[i+1]; - free(pool); // Can now free the array (or not, if it is needed later) - return first; - } -*/ -void** dlindependent_calloc(size_t, size_t, void**); - -/* - independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); - - independent_comalloc allocates, all at once, a set of n_elements - chunks with sizes indicated in the "sizes" array. It returns - an array of pointers to these elements, each of which can be - independently freed, realloc'ed etc. The elements are guaranteed to - be adjacently allocated (this is not guaranteed to occur with - multiple callocs or mallocs), which may also improve cache locality - in some applications. - - The "chunks" argument is optional (i.e., may be null). If it is null - the returned array is itself dynamically allocated and should also - be freed when it is no longer needed. Otherwise, the chunks array - must be of at least n_elements in length. It is filled in with the - pointers to the chunks. - - In either case, independent_comalloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and chunks is - null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use a single regular malloc, and assign pointers at - particular offsets in the aggregate space. (In this case though, you - cannot independently free elements.) - - independent_comallac differs from independent_calloc in that each - element may have a different size, and also that it does not - automatically clear elements. - - independent_comalloc can be used to speed up allocation in cases - where several structs or objects must always be allocated at the - same time. For example: - - struct Head { ... } - struct Foot { ... } - - void send_message(char* msg) { - int msglen = strlen(msg); - size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; - void* chunks[3]; - if (independent_comalloc(3, sizes, chunks) == 0) - die(); - struct Head* head = (struct Head*)(chunks[0]); - char* body = (char*)(chunks[1]); - struct Foot* foot = (struct Foot*)(chunks[2]); - // ... - } - - In general though, independent_comalloc is worth using only for - larger values of n_elements. For small values, you probably won't - detect enough difference from series of malloc calls to bother. - - Overuse of independent_comalloc can increase overall memory usage, - since it cannot reuse existing noncontiguous small chunks that - might be available for some of the elements. -*/ -void** dlindependent_comalloc(size_t, size_t*, void**); - - -/* - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - */ -void* dlpvalloc(size_t); - -/* - malloc_trim(size_t pad); - - If possible, gives memory back to the system (via negative arguments - to sbrk) if there is unused memory at the `high' end of the malloc - pool or in unused MMAP segments. You can call this after freeing - large blocks of memory to potentially reduce the system-level memory - requirements of a program. However, it cannot guarantee to reduce - memory. Under some allocation patterns, some large free blocks of - memory will be locked between two used chunks, so they cannot be - given back to the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, only - the minimum amount of memory to maintain internal data structures - will be left. Non-zero arguments can be supplied to maintain enough - trailing space to service future expected allocations without having - to re-obtain memory from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. -*/ -int dlmalloc_trim(size_t); - -/* - malloc_usable_size(void* p); - - Returns the number of bytes you can actually use in - an allocated chunk, which may be more than you requested (although - often not) due to alignment and minimum size constraints. - You can use this many bytes without worrying about - overwriting other allocated objects. This is not a particularly great - programming practice. malloc_usable_size can be more useful in - debugging and assertions, for example: - - p = malloc(n); - assert(malloc_usable_size(p) >= 256); -*/ -size_t dlmalloc_usable_size(void*); - -/* - malloc_stats(); - Prints on stderr the amount of space obtained from the system (both - via sbrk and mmap), the maximum amount (which may be more than - current if malloc_trim and/or munmap got called), and the current - number of bytes allocated via malloc (or realloc, etc) but not yet - freed. Note that this is the number of bytes allocated, not the - number requested. It will be larger than the number requested - because of alignment and bookkeeping overhead. Because it includes - alignment wastage as being in use, this figure may be greater than - zero even when no user-level chunks are allocated. - - The reported current and maximum system memory can be inaccurate if - a program makes other calls to system memory allocation functions - (normally sbrk) outside of malloc. - - malloc_stats prints only the most commonly interesting statistics. - More information can be obtained by calling mallinfo. -*/ -void dlmalloc_stats(void); - -#endif /* ONLY_MSPACES */ - -#if MSPACES - -/* - mspace is an opaque type representing an independent - region of space that supports mspace_malloc, etc. -*/ -typedef void* mspace; - -/* - create_mspace creates and returns a new independent space with the - given initial capacity, or, if 0, the default granularity size. It - returns null if there is no system memory available to create the - space. If argument locked is non-zero, the space uses a separate - lock to control access. The capacity of the space will grow - dynamically as needed to service mspace_malloc requests. You can - control the sizes of incremental increases of this space by - compiling with a different DEFAULT_GRANULARITY or dynamically - setting with mallopt(M_GRANULARITY, value). -*/ -mspace create_mspace(size_t capacity, int locked); - -/* - destroy_mspace destroys the given space, and attempts to return all - of its memory back to the system, returning the total number of - bytes freed. After destruction, the results of access to all memory - used by the space become undefined. -*/ -size_t destroy_mspace(mspace msp); - -/* - create_mspace_with_base uses the memory supplied as the initial base - of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this - space is used for bookkeeping, so the capacity must be at least this - large. (Otherwise 0 is returned.) When this initial space is - exhausted, additional memory will be obtained from the system. - Destroying this space will deallocate all additionally allocated - space (if possible) but not the initial base. -*/ -mspace create_mspace_with_base(void* base, size_t capacity, int locked); - -/* - mspace_malloc behaves as malloc, but operates within - the given space. -*/ -void* mspace_malloc(mspace msp, size_t bytes); - -/* - mspace_free behaves as free, but operates within - the given space. - - If compiled with FOOTERS==1, mspace_free is not actually needed. - free may be called instead of mspace_free because freed chunks from - any space are handled by their originating spaces. -*/ -void mspace_free(mspace msp, void* mem); - -/* - mspace_realloc behaves as realloc, but operates within - the given space. - - If compiled with FOOTERS==1, mspace_realloc is not actually - needed. realloc may be called instead of mspace_realloc because - realloced chunks from any space are handled by their originating - spaces. -*/ -void* mspace_realloc(mspace msp, void* mem, size_t newsize); - -/* - mspace_calloc behaves as calloc, but operates within - the given space. -*/ -void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); - -/* - mspace_memalign behaves as memalign, but operates within - the given space. -*/ -void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); - -/* - mspace_independent_calloc behaves as independent_calloc, but - operates within the given space. -*/ -void** mspace_independent_calloc(mspace msp, size_t n_elements, - size_t elem_size, void* chunks[]); - -/* - mspace_independent_comalloc behaves as independent_comalloc, but - operates within the given space. -*/ -void** mspace_independent_comalloc(mspace msp, size_t n_elements, - size_t sizes[], void* chunks[]); - -/* - mspace_footprint() returns the number of bytes obtained from the - system for this space. -*/ -size_t mspace_footprint(mspace msp); - -/* - mspace_max_footprint() returns the peak number of bytes obtained from the - system for this space. -*/ -size_t mspace_max_footprint(mspace msp); - - -#if !NO_MALLINFO -/* - mspace_mallinfo behaves as mallinfo, but reports properties of - the given space. -*/ -struct mallinfo mspace_mallinfo(mspace msp); -#endif /* NO_MALLINFO */ - -/* - mspace_malloc_stats behaves as malloc_stats, but reports - properties of the given space. -*/ -void mspace_malloc_stats(mspace msp); - -/* - mspace_trim behaves as malloc_trim, but - operates within the given space. -*/ -int mspace_trim(mspace msp, size_t pad); - -/* - An alias for mallopt. -*/ -int mspace_mallopt(int, int); - -#endif /* MSPACES */ - -#ifdef __cplusplus -}; /* end of extern "C" */ -#endif /* __cplusplus */ - -/* - ======================================================================== - To make a fully customizable malloc.h header file, cut everything - above this line, put into file malloc.h, edit to suit, and #include it - on the next line, as well as in programs that use this malloc. - ======================================================================== -*/ - -/* #include "malloc.h" */ - -/*------------------------------ internal #includes ---------------------- */ - -#ifdef _MSC_VER -#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ -#endif /* _MSC_VER */ - -#include /* for printing in malloc_stats */ - -#ifndef LACKS_ERRNO_H -#include /* for MALLOC_FAILURE_ACTION */ -#endif /* LACKS_ERRNO_H */ -#if FOOTERS -#include /* for magic initialization */ -#endif /* FOOTERS */ -#ifndef LACKS_STDLIB_H -#include /* for abort() */ -#endif /* LACKS_STDLIB_H */ -#ifdef DEBUG -#if ABORT_ON_ASSERT_FAILURE -#define assert(x) if(!(x)) ABORT -#else /* ABORT_ON_ASSERT_FAILURE */ -#include -#endif /* ABORT_ON_ASSERT_FAILURE */ -#else /* DEBUG */ -#define assert(x) -#endif /* DEBUG */ -#ifndef LACKS_STRING_H -#include /* for memset etc */ -#endif /* LACKS_STRING_H */ -#if USE_BUILTIN_FFS -#ifndef LACKS_STRINGS_H -#include /* for ffs */ -#endif /* LACKS_STRINGS_H */ -#endif /* USE_BUILTIN_FFS */ -#if HAVE_MMAP -#ifndef LACKS_SYS_MMAN_H -#include /* for mmap */ -#endif /* LACKS_SYS_MMAN_H */ -#ifndef LACKS_FCNTL_H -#include -#endif /* LACKS_FCNTL_H */ -#endif /* HAVE_MMAP */ -#if HAVE_MORECORE -#ifndef LACKS_UNISTD_H -#include /* for sbrk */ -#else /* LACKS_UNISTD_H */ -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) -extern void* sbrk(ptrdiff_t); -#endif /* FreeBSD etc */ -#endif /* LACKS_UNISTD_H */ -#endif /* HAVE_MMAP */ - -#ifndef WIN32 -#ifndef malloc_getpagesize -# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ -# ifndef _SC_PAGE_SIZE -# define _SC_PAGE_SIZE _SC_PAGESIZE -# endif -# endif -# ifdef _SC_PAGE_SIZE -# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) -# else -# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) - extern size_t getpagesize(); -# define malloc_getpagesize getpagesize() -# else -# ifdef WIN32 /* use supplied emulation of getpagesize */ -# define malloc_getpagesize getpagesize() -# else -# ifndef LACKS_SYS_PARAM_H -# include -# endif -# ifdef EXEC_PAGESIZE -# define malloc_getpagesize EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define malloc_getpagesize NBPG -# else -# define malloc_getpagesize (NBPG * CLSIZE) -# endif -# else -# ifdef NBPC -# define malloc_getpagesize NBPC -# else -# ifdef PAGESIZE -# define malloc_getpagesize PAGESIZE -# else /* just guess */ -# define malloc_getpagesize ((size_t)4096U) -# endif -# endif -# endif -# endif -# endif -# endif -# endif -#endif -#endif - -/* ------------------- size_t and alignment properties -------------------- */ - -/* The byte and bit size of a size_t */ -#define SIZE_T_SIZE (sizeof(size_t)) -#define SIZE_T_BITSIZE (sizeof(size_t) << 3) - -/* Some constants coerced to size_t */ -/* Annoying but necessary to avoid errors on some platforms */ -#define SIZE_T_ZERO ((size_t)0) -#define SIZE_T_ONE ((size_t)1) -#define SIZE_T_TWO ((size_t)2) -#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) -#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) -#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) -#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) - -/* The bit mask value corresponding to MALLOC_ALIGNMENT */ -#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) - -/* True if address a has acceptable alignment */ -#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) - -/* the number of bytes to offset an address to align it */ -#define align_offset(A)\ - ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ - ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) - -/* -------------------------- MMAP preliminaries ------------------------- */ - -/* - If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and - checks to fail so compiler optimizer can delete code rather than - using so many "#if"s. -*/ - - -/* MORECORE and MMAP must return MFAIL on failure */ -#define MFAIL ((void*)(MAX_SIZE_T)) -#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ - -#if !HAVE_MMAP -#define IS_MMAPPED_BIT (SIZE_T_ZERO) -#define USE_MMAP_BIT (SIZE_T_ZERO) -#define CALL_MMAP(s) MFAIL -#define CALL_MUNMAP(a, s) (-1) -#define DIRECT_MMAP(s) MFAIL - -#else /* HAVE_MMAP */ -#define IS_MMAPPED_BIT (SIZE_T_ONE) -#define USE_MMAP_BIT (SIZE_T_ONE) - -#if !defined(WIN32) && !defined (__OS2__) -#define CALL_MUNMAP(a, s) munmap((a), (s)) -#define MMAP_PROT (PROT_READ|PROT_WRITE) -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif /* MAP_ANON */ -#ifdef MAP_ANONYMOUS -#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) -#define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) -#else /* MAP_ANONYMOUS */ -/* - Nearly all versions of mmap support MAP_ANONYMOUS, so the following - is unlikely to be needed, but is supplied just in case. -*/ -#define MMAP_FLAGS (MAP_PRIVATE) -static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ -#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \ - (dev_zero_fd = open("/dev/zero", O_RDWR), \ - mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ - mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) -#endif /* MAP_ANONYMOUS */ - -#define DIRECT_MMAP(s) CALL_MMAP(s) - -#elif defined(__OS2__) - -/* OS/2 MMAP via DosAllocMem */ -static void* os2mmap(size_t size) { - void* ptr; - if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && - DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) - return MFAIL; - return ptr; -} - -#define os2direct_mmap(n) os2mmap(n) - -/* This function supports releasing coalesed segments */ -static int os2munmap(void* ptr, size_t size) { - while (size) { - ULONG ulSize = size; - ULONG ulFlags = 0; - if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) - return -1; - if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || - ulSize > size) - return -1; - if (DosFreeMem(ptr) != 0) - return -1; - ptr = ( void * ) ( ( char * ) ptr + ulSize ); - size -= ulSize; - } - return 0; -} - -#define CALL_MMAP(s) os2mmap(s) -#define CALL_MUNMAP(a, s) os2munmap((a), (s)) -#define DIRECT_MMAP(s) os2direct_mmap(s) - -#else /* WIN32 */ - -/* Win32 MMAP via VirtualAlloc */ -static void* win32mmap(size_t size) { - void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); - return (ptr != 0)? ptr: MFAIL; -} - -/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ -static void* win32direct_mmap(size_t size) { - void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, - PAGE_EXECUTE_READWRITE); - return (ptr != 0)? ptr: MFAIL; -} - -/* This function supports releasing coalesed segments */ -static int win32munmap(void* ptr, size_t size) { - MEMORY_BASIC_INFORMATION minfo; - char* cptr = ptr; - while (size) { - if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) - return -1; - if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || - minfo.State != MEM_COMMIT || minfo.RegionSize > size) - return -1; - if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) - return -1; - cptr += minfo.RegionSize; - size -= minfo.RegionSize; - } - return 0; -} - -#define CALL_MMAP(s) win32mmap(s) -#define CALL_MUNMAP(a, s) win32munmap((a), (s)) -#define DIRECT_MMAP(s) win32direct_mmap(s) -#endif /* WIN32 */ -#endif /* HAVE_MMAP */ - -#if HAVE_MMAP && HAVE_MREMAP -#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) -#else /* HAVE_MMAP && HAVE_MREMAP */ -#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL -#endif /* HAVE_MMAP && HAVE_MREMAP */ - -#if HAVE_MORECORE -#define CALL_MORECORE(S) MORECORE(S) -#else /* HAVE_MORECORE */ -#define CALL_MORECORE(S) MFAIL -#endif /* HAVE_MORECORE */ - -/* mstate bit set if contiguous morecore disabled or failed */ -#define USE_NONCONTIGUOUS_BIT (4U) - -/* segment bit set in create_mspace_with_base */ -#define EXTERN_BIT (8U) - - -/* --------------------------- Lock preliminaries ------------------------ */ - -#if USE_LOCKS - -/* - When locks are defined, there are up to two global locks: - - * If HAVE_MORECORE, morecore_mutex protects sequences of calls to - MORECORE. In many cases sys_alloc requires two calls, that should - not be interleaved with calls by other threads. This does not - protect against direct calls to MORECORE by other threads not - using this lock, so there is still code to cope the best we can on - interference. - - * magic_init_mutex ensures that mparams.magic and other - unique mparams values are initialized only once. -*/ - -#if !defined(WIN32) && !defined(__OS2__) -/* By default use posix locks */ -#include -#define MLOCK_T pthread_mutex_t -#define INITIAL_LOCK(l) pthread_mutex_init(l, NULL) -#define ACQUIRE_LOCK(l) pthread_mutex_lock(l) -#define RELEASE_LOCK(l) pthread_mutex_unlock(l) - -#if HAVE_MORECORE -static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif /* HAVE_MORECORE */ - -static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; - -#elif defined(__OS2__) -#define MLOCK_T HMTX -#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) -#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) -#define RELEASE_LOCK(l) DosReleaseMutexSem(*l) -#if HAVE_MORECORE -static MLOCK_T morecore_mutex; -#endif /* HAVE_MORECORE */ -static MLOCK_T magic_init_mutex; - -#else /* WIN32 */ -/* - Because lock-protected regions have bounded times, and there - are no recursive lock calls, we can use simple spinlocks. -*/ - -#define MLOCK_T long -static int win32_acquire_lock (MLOCK_T *sl) { - for (;;) { -#ifdef InterlockedCompareExchangePointer - if (!InterlockedCompareExchange(sl, 1, 0)) - return 0; -#else /* Use older void* version */ - if (!InterlockedCompareExchange((void**)sl, (void*)1, (void*)0)) - return 0; -#endif /* InterlockedCompareExchangePointer */ - Sleep (0); - } -} - -static void win32_release_lock (MLOCK_T *sl) { - InterlockedExchange (sl, 0); -} - -#define INITIAL_LOCK(l) *(l)=0 -#define ACQUIRE_LOCK(l) win32_acquire_lock(l) -#define RELEASE_LOCK(l) win32_release_lock(l) -#if HAVE_MORECORE -static MLOCK_T morecore_mutex; -#endif /* HAVE_MORECORE */ -static MLOCK_T magic_init_mutex; -#endif /* WIN32 */ - -#define USE_LOCK_BIT (2U) -#else /* USE_LOCKS */ -#define USE_LOCK_BIT (0U) -#define INITIAL_LOCK(l) -#endif /* USE_LOCKS */ - -#if USE_LOCKS && HAVE_MORECORE -#define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); -#define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); -#else /* USE_LOCKS && HAVE_MORECORE */ -#define ACQUIRE_MORECORE_LOCK() -#define RELEASE_MORECORE_LOCK() -#endif /* USE_LOCKS && HAVE_MORECORE */ - -#if USE_LOCKS -#define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); -#define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); -#else /* USE_LOCKS */ -#define ACQUIRE_MAGIC_INIT_LOCK() -#define RELEASE_MAGIC_INIT_LOCK() -#endif /* USE_LOCKS */ - - -/* ----------------------- Chunk representations ------------------------ */ - -/* - (The following includes lightly edited explanations by Colin Plumb.) - - The malloc_chunk declaration below is misleading (but accurate and - necessary). It declares a "view" into memory allowing access to - necessary fields at known offsets from a given base. - - Chunks of memory are maintained using a `boundary tag' method as - originally described by Knuth. (See the paper by Paul Wilson - ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such - techniques.) Sizes of free chunks are stored both in the front of - each chunk and at the end. This makes consolidating fragmented - chunks into bigger chunks fast. The head fields also hold bits - representing whether chunks are free or in use. - - Here are some pictures to make it clearer. They are "exploded" to - show that the state of a chunk can be thought of as extending from - the high 31 bits of the head field of its header through the - prev_foot and PINUSE_BIT bit of the following chunk header. - - A chunk that's in use looks like: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk (if P = 1) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| - | Size of this chunk 1| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - +- -+ - | | - +- -+ - | : - +- size - sizeof(size_t) available payload bytes -+ - : | - chunk-> +- -+ - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| - | Size of next chunk (may or may not be in use) | +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - And if it's free, it looks like this: - - chunk-> +- -+ - | User payload (must be in use, or we would have merged!) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| - | Size of this chunk 0| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Next pointer | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Prev pointer | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | : - +- size - sizeof(struct chunk) unused bytes -+ - : | - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of this chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| - | Size of next chunk (must be in use, or we would have merged)| +-+ - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | : - +- User payload -+ - : | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |0| - +-+ - Note that since we always merge adjacent free chunks, the chunks - adjacent to a free chunk must be in use. - - Given a pointer to a chunk (which can be derived trivially from the - payload pointer) we can, in O(1) time, find out whether the adjacent - chunks are free, and if so, unlink them from the lists that they - are on and merge them with the current chunk. - - Chunks always begin on even word boundaries, so the mem portion - (which is returned to the user) is also on an even word boundary, and - thus at least double-word aligned. - - The P (PINUSE_BIT) bit, stored in the unused low-order bit of the - chunk size (which is always a multiple of two words), is an in-use - bit for the *previous* chunk. If that bit is *clear*, then the - word before the current chunk size contains the previous chunk - size, and can be used to find the front of the previous chunk. - The very first chunk allocated always has this bit set, preventing - access to non-existent (or non-owned) memory. If pinuse is set for - any given chunk, then you CANNOT determine the size of the - previous chunk, and might even get a memory addressing fault when - trying to do so. - - The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of - the chunk size redundantly records whether the current chunk is - inuse. This redundancy enables usage checks within free and realloc, - and reduces indirection when freeing and consolidating chunks. - - Each freshly allocated chunk must have both cinuse and pinuse set. - That is, each allocated chunk borders either a previously allocated - and still in-use chunk, or the base of its memory arena. This is - ensured by making all allocations from the the `lowest' part of any - found chunk. Further, no free chunk physically borders another one, - so each free chunk is known to be preceded and followed by either - inuse chunks or the ends of memory. - - Note that the `foot' of the current chunk is actually represented - as the prev_foot of the NEXT chunk. This makes it easier to - deal with alignments etc but can be very confusing when trying - to extend or adapt this code. - - The exceptions to all this are - - 1. The special chunk `top' is the top-most available chunk (i.e., - the one bordering the end of available memory). It is treated - specially. Top is never included in any bin, is used only if - no other chunk is available, and is released back to the - system if it is very large (see M_TRIM_THRESHOLD). In effect, - the top chunk is treated as larger (and thus less well - fitting) than any other available chunk. The top chunk - doesn't update its trailing size field since there is no next - contiguous chunk that would have to index off it. However, - space is still allocated for it (TOP_FOOT_SIZE) to enable - separation or merging when space is extended. - - 3. Chunks allocated via mmap, which have the lowest-order bit - (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set - PINUSE_BIT in their head fields. Because they are allocated - one-by-one, each must carry its own prev_foot field, which is - also used to hold the offset this chunk has within its mmapped - region, which is needed to preserve alignment. Each mmapped - chunk is trailed by the first two fields of a fake next-chunk - for sake of usage checks. - -*/ - -struct malloc_chunk { - size_t prev_foot; /* Size of previous chunk (if free). */ - size_t head; /* Size and inuse bits. */ - struct malloc_chunk* fd; /* double links -- used only if free. */ - struct malloc_chunk* bk; -}; - -typedef struct malloc_chunk mchunk; -typedef struct malloc_chunk* mchunkptr; -typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ -typedef size_t bindex_t; /* Described below */ -typedef unsigned int binmap_t; /* Described below */ -typedef unsigned int flag_t; /* The type of various bit flag sets */ - -/* ------------------- Chunks sizes and alignments ----------------------- */ - -#define MCHUNK_SIZE (sizeof(mchunk)) - -#if FOOTERS -#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) -#else /* FOOTERS */ -#define CHUNK_OVERHEAD (SIZE_T_SIZE) -#endif /* FOOTERS */ - -/* MMapped chunks need a second word of overhead ... */ -#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) -/* ... and additional padding for fake next-chunk at foot */ -#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) - -/* The smallest size we can malloc is an aligned minimal chunk */ -#define MIN_CHUNK_SIZE\ - ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) - -/* conversion from malloc headers to user pointers, and back */ -#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) -#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) -/* chunk associated with aligned address A */ -#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) - -/* Bounds on request (not chunk) sizes. */ -#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) -#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) - -/* pad request bytes into a usable size */ -#define pad_request(req) \ - (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) - -/* pad request, checking for minimum (but not maximum) */ -#define request2size(req) \ - (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) - - -/* ------------------ Operations on head and foot fields ----------------- */ - -/* - The head field of a chunk is or'ed with PINUSE_BIT when previous - adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in - use. If the chunk was obtained with mmap, the prev_foot field has - IS_MMAPPED_BIT set, otherwise holding the offset of the base of the - mmapped region to the base of the chunk. -*/ - -#define PINUSE_BIT (SIZE_T_ONE) -#define CINUSE_BIT (SIZE_T_TWO) -#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) - -/* Head value for fenceposts */ -#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) - -/* extraction of fields from head words */ -#define cinuse(p) ((p)->head & CINUSE_BIT) -#define pinuse(p) ((p)->head & PINUSE_BIT) -#define chunksize(p) ((p)->head & ~(INUSE_BITS)) - -#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) -#define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) - -/* Treat space at ptr +/- offset as a chunk */ -#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) -#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) - -/* Ptr to next or previous physical malloc_chunk. */ -#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) -#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) - -/* extract next chunk's pinuse bit */ -#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) - -/* Get/set size at footer */ -#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) -#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) - -/* Set size, pinuse bit, and foot */ -#define set_size_and_pinuse_of_free_chunk(p, s)\ - ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) - -/* Set size, pinuse bit, foot, and clear next pinuse */ -#define set_free_with_pinuse(p, s, n)\ - (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) - -#define is_mmapped(p)\ - (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) - -/* Get the internal overhead associated with chunk p */ -#define overhead_for(p)\ - (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) - -/* Return true if malloced space is not necessarily cleared */ -#if MMAP_CLEARS -#define calloc_must_clear(p) (!is_mmapped(p)) -#else /* MMAP_CLEARS */ -#define calloc_must_clear(p) (1) -#endif /* MMAP_CLEARS */ - -/* ---------------------- Overlaid data structures ----------------------- */ - -/* - When chunks are not in use, they are treated as nodes of either - lists or trees. - - "Small" chunks are stored in circular doubly-linked lists, and look - like this: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space (may be 0 bytes long) . - . . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - Larger chunks are kept in a form of bitwise digital trees (aka - tries) keyed on chunksizes. Because malloc_tree_chunks are only for - free chunks greater than 256 bytes, their size doesn't impose any - constraints on user chunk sizes. Each node looks like: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk of same size | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk of same size | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to left child (child[0]) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to right child (child[1]) | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Pointer to parent | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | bin index of this chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - Each tree holding treenodes is a tree of unique chunk sizes. Chunks - of the same size are arranged in a circularly-linked list, with only - the oldest chunk (the next to be used, in our FIFO ordering) - actually in the tree. (Tree members are distinguished by a non-null - parent pointer.) If a chunk with the same size an an existing node - is inserted, it is linked off the existing node using pointers that - work in the same way as fd/bk pointers of small chunks. - - Each tree contains a power of 2 sized range of chunk sizes (the - smallest is 0x100 <= x < 0x180), which is is divided in half at each - tree level, with the chunks in the smaller half of the range (0x100 - <= x < 0x140 for the top nose) in the left subtree and the larger - half (0x140 <= x < 0x180) in the right subtree. This is, of course, - done by inspecting individual bits. - - Using these rules, each node's left subtree contains all smaller - sizes than its right subtree. However, the node at the root of each - subtree has no particular ordering relationship to either. (The - dividing line between the subtree sizes is based on trie relation.) - If we remove the last chunk of a given size from the interior of the - tree, we need to replace it with a leaf node. The tree ordering - rules permit a node to be replaced by any leaf below it. - - The smallest chunk in a tree (a common operation in a best-fit - allocator) can be found by walking a path to the leftmost leaf in - the tree. Unlike a usual binary tree, where we follow left child - pointers until we reach a null, here we follow the right child - pointer any time the left one is null, until we reach a leaf with - both child pointers null. The smallest chunk in the tree will be - somewhere along that path. - - The worst case number of steps to add, find, or remove a node is - bounded by the number of bits differentiating chunks within - bins. Under current bin calculations, this ranges from 6 up to 21 - (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case - is of course much better. -*/ - -struct malloc_tree_chunk { - /* The first four fields must be compatible with malloc_chunk */ - size_t prev_foot; - size_t head; - struct malloc_tree_chunk* fd; - struct malloc_tree_chunk* bk; - - struct malloc_tree_chunk* child[2]; - struct malloc_tree_chunk* parent; - bindex_t index; -}; - -typedef struct malloc_tree_chunk tchunk; -typedef struct malloc_tree_chunk* tchunkptr; -typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ - -/* A little helper macro for trees */ -#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) - -/* ----------------------------- Segments -------------------------------- */ - -/* - Each malloc space may include non-contiguous segments, held in a - list headed by an embedded malloc_segment record representing the - top-most space. Segments also include flags holding properties of - the space. Large chunks that are directly allocated by mmap are not - included in this list. They are instead independently created and - destroyed without otherwise keeping track of them. - - Segment management mainly comes into play for spaces allocated by - MMAP. Any call to MMAP might or might not return memory that is - adjacent to an existing segment. MORECORE normally contiguously - extends the current space, so this space is almost always adjacent, - which is simpler and faster to deal with. (This is why MORECORE is - used preferentially to MMAP when both are available -- see - sys_alloc.) When allocating using MMAP, we don't use any of the - hinting mechanisms (inconsistently) supported in various - implementations of unix mmap, or distinguish reserving from - committing memory. Instead, we just ask for space, and exploit - contiguity when we get it. It is probably possible to do - better than this on some systems, but no general scheme seems - to be significantly better. - - Management entails a simpler variant of the consolidation scheme - used for chunks to reduce fragmentation -- new adjacent memory is - normally prepended or appended to an existing segment. However, - there are limitations compared to chunk consolidation that mostly - reflect the fact that segment processing is relatively infrequent - (occurring only when getting memory from system) and that we - don't expect to have huge numbers of segments: - - * Segments are not indexed, so traversal requires linear scans. (It - would be possible to index these, but is not worth the extra - overhead and complexity for most programs on most platforms.) - * New segments are only appended to old ones when holding top-most - memory; if they cannot be prepended to others, they are held in - different segments. - - Except for the top-most segment of an mstate, each segment record - is kept at the tail of its segment. Segments are added by pushing - segment records onto the list headed by &mstate.seg for the - containing mstate. - - Segment flags control allocation/merge/deallocation policies: - * If EXTERN_BIT set, then we did not allocate this segment, - and so should not try to deallocate or merge with others. - (This currently holds only for the initial segment passed - into create_mspace_with_base.) - * If IS_MMAPPED_BIT set, the segment may be merged with - other surrounding mmapped segments and trimmed/de-allocated - using munmap. - * If neither bit is set, then the segment was obtained using - MORECORE so can be merged with surrounding MORECORE'd segments - and deallocated/trimmed using MORECORE with negative arguments. -*/ - -struct malloc_segment { - char* base; /* base address */ - size_t size; /* allocated size */ - struct malloc_segment* next; /* ptr to next segment */ -#if FFI_MMAP_EXEC_WRIT - /* The mmap magic is supposed to store the address of the executable - segment at the very end of the requested block. */ - -# define mmap_exec_offset(b,s) (*(ptrdiff_t*)((b)+(s)-sizeof(ptrdiff_t))) - - /* We can only merge segments if their corresponding executable - segments are at identical offsets. */ -# define check_segment_merge(S,b,s) \ - (mmap_exec_offset((b),(s)) == (S)->exec_offset) - -# define add_segment_exec_offset(p,S) ((char*)(p) + (S)->exec_offset) -# define sub_segment_exec_offset(p,S) ((char*)(p) - (S)->exec_offset) - - /* The removal of sflags only works with HAVE_MORECORE == 0. */ - -# define get_segment_flags(S) (IS_MMAPPED_BIT) -# define set_segment_flags(S,v) \ - (((v) != IS_MMAPPED_BIT) ? (ABORT, (v)) : \ - (((S)->exec_offset = \ - mmap_exec_offset((S)->base, (S)->size)), \ - (mmap_exec_offset((S)->base + (S)->exec_offset, (S)->size) != \ - (S)->exec_offset) ? (ABORT, (v)) : \ - (mmap_exec_offset((S)->base, (S)->size) = 0), (v))) - - /* We use an offset here, instead of a pointer, because then, when - base changes, we don't have to modify this. On architectures - with segmented addresses, this might not work. */ - ptrdiff_t exec_offset; -#else - -# define get_segment_flags(S) ((S)->sflags) -# define set_segment_flags(S,v) ((S)->sflags = (v)) -# define check_segment_merge(S,b,s) (1) - - flag_t sflags; /* mmap and extern flag */ -#endif -}; - -#define is_mmapped_segment(S) (get_segment_flags(S) & IS_MMAPPED_BIT) -#define is_extern_segment(S) (get_segment_flags(S) & EXTERN_BIT) - -typedef struct malloc_segment msegment; -typedef struct malloc_segment* msegmentptr; - -/* ---------------------------- malloc_state ----------------------------- */ - -/* - A malloc_state holds all of the bookkeeping for a space. - The main fields are: - - Top - The topmost chunk of the currently active segment. Its size is - cached in topsize. The actual size of topmost space is - topsize+TOP_FOOT_SIZE, which includes space reserved for adding - fenceposts and segment records if necessary when getting more - space from the system. The size at which to autotrim top is - cached from mparams in trim_check, except that it is disabled if - an autotrim fails. - - Designated victim (dv) - This is the preferred chunk for servicing small requests that - don't have exact fits. It is normally the chunk split off most - recently to service another small request. Its size is cached in - dvsize. The link fields of this chunk are not maintained since it - is not kept in a bin. - - SmallBins - An array of bin headers for free chunks. These bins hold chunks - with sizes less than MIN_LARGE_SIZE bytes. Each bin contains - chunks of all the same size, spaced 8 bytes apart. To simplify - use in double-linked lists, each bin header acts as a malloc_chunk - pointing to the real first node, if it exists (else pointing to - itself). This avoids special-casing for headers. But to avoid - waste, we allocate only the fd/bk pointers of bins, and then use - repositioning tricks to treat these as the fields of a chunk. - - TreeBins - Treebins are pointers to the roots of trees holding a range of - sizes. There are 2 equally spaced treebins for each power of two - from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything - larger. - - Bin maps - There is one bit map for small bins ("smallmap") and one for - treebins ("treemap). Each bin sets its bit when non-empty, and - clears the bit when empty. Bit operations are then used to avoid - bin-by-bin searching -- nearly all "search" is done without ever - looking at bins that won't be selected. The bit maps - conservatively use 32 bits per map word, even if on 64bit system. - For a good description of some of the bit-based techniques used - here, see Henry S. Warren Jr's book "Hacker's Delight" (and - supplement at http://hackersdelight.org/). Many of these are - intended to reduce the branchiness of paths through malloc etc, as - well as to reduce the number of memory locations read or written. - - Segments - A list of segments headed by an embedded malloc_segment record - representing the initial space. - - Address check support - The least_addr field is the least address ever obtained from - MORECORE or MMAP. Attempted frees and reallocs of any address less - than this are trapped (unless INSECURE is defined). - - Magic tag - A cross-check field that should always hold same value as mparams.magic. - - Flags - Bits recording whether to use MMAP, locks, or contiguous MORECORE - - Statistics - Each space keeps track of current and maximum system memory - obtained via MORECORE or MMAP. - - Locking - If USE_LOCKS is defined, the "mutex" lock is acquired and released - around every public call using this mspace. -*/ - -/* Bin types, widths and sizes */ -#define NSMALLBINS (32U) -#define NTREEBINS (32U) -#define SMALLBIN_SHIFT (3U) -#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) -#define TREEBIN_SHIFT (8U) -#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) -#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) -#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) - -struct malloc_state { - binmap_t smallmap; - binmap_t treemap; - size_t dvsize; - size_t topsize; - char* least_addr; - mchunkptr dv; - mchunkptr top; - size_t trim_check; - size_t magic; - mchunkptr smallbins[(NSMALLBINS+1)*2]; - tbinptr treebins[NTREEBINS]; - size_t footprint; - size_t max_footprint; - flag_t mflags; -#if USE_LOCKS - MLOCK_T mutex; /* locate lock among fields that rarely change */ -#endif /* USE_LOCKS */ - msegment seg; -}; - -typedef struct malloc_state* mstate; - -/* ------------- Global malloc_state and malloc_params ------------------- */ - -/* - malloc_params holds global properties, including those that can be - dynamically set using mallopt. There is a single instance, mparams, - initialized in init_mparams. -*/ - -struct malloc_params { - size_t magic; - size_t page_size; - size_t granularity; - size_t mmap_threshold; - size_t trim_threshold; - flag_t default_mflags; -}; - -static struct malloc_params mparams; - -/* The global malloc_state used for all non-"mspace" calls */ -static struct malloc_state _gm_; -#define gm (&_gm_) -#define is_global(M) ((M) == &_gm_) -#define is_initialized(M) ((M)->top != 0) - -/* -------------------------- system alloc setup ------------------------- */ - -/* Operations on mflags */ - -#define use_lock(M) ((M)->mflags & USE_LOCK_BIT) -#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) -#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) - -#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) -#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) -#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) - -#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) -#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) - -#define set_lock(M,L)\ - ((M)->mflags = (L)?\ - ((M)->mflags | USE_LOCK_BIT) :\ - ((M)->mflags & ~USE_LOCK_BIT)) - -/* page-align a size */ -#define page_align(S)\ - (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) - -/* granularity-align a size */ -#define granularity_align(S)\ - (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) - -#define is_page_aligned(S)\ - (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) -#define is_granularity_aligned(S)\ - (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) - -/* True if segment S holds address A */ -#define segment_holds(S, A)\ - ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) - -/* Return segment holding given address */ -static msegmentptr segment_holding(mstate m, char* addr) { - msegmentptr sp = &m->seg; - for (;;) { - if (addr >= sp->base && addr < sp->base + sp->size) - return sp; - if ((sp = sp->next) == 0) - return 0; - } -} - -/* Return true if segment contains a segment link */ -static int has_segment_link(mstate m, msegmentptr ss) { - msegmentptr sp = &m->seg; - for (;;) { - if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) - return 1; - if ((sp = sp->next) == 0) - return 0; - } -} - -#ifndef MORECORE_CANNOT_TRIM -#define should_trim(M,s) ((s) > (M)->trim_check) -#else /* MORECORE_CANNOT_TRIM */ -#define should_trim(M,s) (0) -#endif /* MORECORE_CANNOT_TRIM */ - -/* - TOP_FOOT_SIZE is padding at the end of a segment, including space - that may be needed to place segment records and fenceposts when new - noncontiguous segments are added. -*/ -#define TOP_FOOT_SIZE\ - (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) - - -/* ------------------------------- Hooks -------------------------------- */ - -/* - PREACTION should be defined to return 0 on success, and nonzero on - failure. If you are not using locking, you can redefine these to do - anything you like. -*/ - -#if USE_LOCKS - -/* Ensure locks are initialized */ -#define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) - -#define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) -#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } -#else /* USE_LOCKS */ - -#ifndef PREACTION -#define PREACTION(M) (0) -#endif /* PREACTION */ - -#ifndef POSTACTION -#define POSTACTION(M) -#endif /* POSTACTION */ - -#endif /* USE_LOCKS */ - -/* - CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. - USAGE_ERROR_ACTION is triggered on detected bad frees and - reallocs. The argument p is an address that might have triggered the - fault. It is ignored by the two predefined actions, but might be - useful in custom actions that try to help diagnose errors. -*/ - -#if PROCEED_ON_ERROR - -/* A count of the number of corruption errors causing resets */ -int malloc_corruption_error_count; - -/* default corruption action */ -static void reset_on_error(mstate m); - -#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) -#define USAGE_ERROR_ACTION(m, p) - -#else /* PROCEED_ON_ERROR */ - -#ifndef CORRUPTION_ERROR_ACTION -#define CORRUPTION_ERROR_ACTION(m) ABORT -#endif /* CORRUPTION_ERROR_ACTION */ - -#ifndef USAGE_ERROR_ACTION -#define USAGE_ERROR_ACTION(m,p) ABORT -#endif /* USAGE_ERROR_ACTION */ - -#endif /* PROCEED_ON_ERROR */ - -/* -------------------------- Debugging setup ---------------------------- */ - -#if ! DEBUG - -#define check_free_chunk(M,P) -#define check_inuse_chunk(M,P) -#define check_malloced_chunk(M,P,N) -#define check_mmapped_chunk(M,P) -#define check_malloc_state(M) -#define check_top_chunk(M,P) - -#else /* DEBUG */ -#define check_free_chunk(M,P) do_check_free_chunk(M,P) -#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) -#define check_top_chunk(M,P) do_check_top_chunk(M,P) -#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) -#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) -#define check_malloc_state(M) do_check_malloc_state(M) - -static void do_check_any_chunk(mstate m, mchunkptr p); -static void do_check_top_chunk(mstate m, mchunkptr p); -static void do_check_mmapped_chunk(mstate m, mchunkptr p); -static void do_check_inuse_chunk(mstate m, mchunkptr p); -static void do_check_free_chunk(mstate m, mchunkptr p); -static void do_check_malloced_chunk(mstate m, void* mem, size_t s); -static void do_check_tree(mstate m, tchunkptr t); -static void do_check_treebin(mstate m, bindex_t i); -static void do_check_smallbin(mstate m, bindex_t i); -static void do_check_malloc_state(mstate m); -static int bin_find(mstate m, mchunkptr x); -static size_t traverse_and_check(mstate m); -#endif /* DEBUG */ - -/* ---------------------------- Indexing Bins ---------------------------- */ - -#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) -#define small_index(s) ((s) >> SMALLBIN_SHIFT) -#define small_index2size(i) ((i) << SMALLBIN_SHIFT) -#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) - -/* addressing by index. See above about smallbin repositioning */ -#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) -#define treebin_at(M,i) (&((M)->treebins[i])) - -/* assign tree index for size S to variable I */ -#if defined(__GNUC__) && defined(__i386__) -#define compute_tree_index(S, I)\ -{\ - size_t X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int K;\ - __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\ - I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ - }\ -} -#else /* GNUC */ -#define compute_tree_index(S, I)\ -{\ - size_t X = S >> TREEBIN_SHIFT;\ - if (X == 0)\ - I = 0;\ - else if (X > 0xFFFF)\ - I = NTREEBINS-1;\ - else {\ - unsigned int Y = (unsigned int)X;\ - unsigned int N = ((Y - 0x100) >> 16) & 8;\ - unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ - N += K;\ - N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ - K = 14 - N + ((Y <<= K) >> 15);\ - I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ - }\ -} -#endif /* GNUC */ - -/* Bit representing maximum resolved size in a treebin at i */ -#define bit_for_tree_index(i) \ - (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) - -/* Shift placing maximum resolved bit in a treebin at i as sign bit */ -#define leftshift_for_tree_index(i) \ - ((i == NTREEBINS-1)? 0 : \ - ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) - -/* The size of the smallest chunk held in bin with index i */ -#define minsize_for_tree_index(i) \ - ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ - (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) - - -/* ------------------------ Operations on bin maps ----------------------- */ - -/* bit corresponding to given index */ -#define idx2bit(i) ((binmap_t)(1) << (i)) - -/* Mark/Clear bits with given index */ -#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) -#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) -#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) - -#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) -#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) -#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) - -/* index corresponding to given bit */ - -#if defined(__GNUC__) && defined(__i386__) -#define compute_bit2idx(X, I)\ -{\ - unsigned int J;\ - __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\ - I = (bindex_t)J;\ -} - -#else /* GNUC */ -#if USE_BUILTIN_FFS -#define compute_bit2idx(X, I) I = ffs(X)-1 - -#else /* USE_BUILTIN_FFS */ -#define compute_bit2idx(X, I)\ -{\ - unsigned int Y = X - 1;\ - unsigned int K = Y >> (16-4) & 16;\ - unsigned int N = K; Y >>= K;\ - N += K = Y >> (8-3) & 8; Y >>= K;\ - N += K = Y >> (4-2) & 4; Y >>= K;\ - N += K = Y >> (2-1) & 2; Y >>= K;\ - N += K = Y >> (1-0) & 1; Y >>= K;\ - I = (bindex_t)(N + Y);\ -} -#endif /* USE_BUILTIN_FFS */ -#endif /* GNUC */ - -/* isolate the least set bit of a bitmap */ -#define least_bit(x) ((x) & -(x)) - -/* mask with all bits to left of least bit of x on */ -#define left_bits(x) ((x<<1) | -(x<<1)) - -/* mask with all bits to left of or equal to least bit of x on */ -#define same_or_left_bits(x) ((x) | -(x)) - - -/* ----------------------- Runtime Check Support ------------------------- */ - -/* - For security, the main invariant is that malloc/free/etc never - writes to a static address other than malloc_state, unless static - malloc_state itself has been corrupted, which cannot occur via - malloc (because of these checks). In essence this means that we - believe all pointers, sizes, maps etc held in malloc_state, but - check all of those linked or offsetted from other embedded data - structures. These checks are interspersed with main code in a way - that tends to minimize their run-time cost. - - When FOOTERS is defined, in addition to range checking, we also - verify footer fields of inuse chunks, which can be used guarantee - that the mstate controlling malloc/free is intact. This is a - streamlined version of the approach described by William Robertson - et al in "Run-time Detection of Heap-based Overflows" LISA'03 - http://www.usenix.org/events/lisa03/tech/robertson.html The footer - of an inuse chunk holds the xor of its mstate and a random seed, - that is checked upon calls to free() and realloc(). This is - (probablistically) unguessable from outside the program, but can be - computed by any code successfully malloc'ing any chunk, so does not - itself provide protection against code that has already broken - security through some other means. Unlike Robertson et al, we - always dynamically check addresses of all offset chunks (previous, - next, etc). This turns out to be cheaper than relying on hashes. -*/ - -#if !INSECURE -/* Check if address a is at least as high as any from MORECORE or MMAP */ -#define ok_address(M, a) ((char*)(a) >= (M)->least_addr) -/* Check if address of next chunk n is higher than base chunk p */ -#define ok_next(p, n) ((char*)(p) < (char*)(n)) -/* Check if p has its cinuse bit on */ -#define ok_cinuse(p) cinuse(p) -/* Check if p has its pinuse bit on */ -#define ok_pinuse(p) pinuse(p) - -#else /* !INSECURE */ -#define ok_address(M, a) (1) -#define ok_next(b, n) (1) -#define ok_cinuse(p) (1) -#define ok_pinuse(p) (1) -#endif /* !INSECURE */ - -#if (FOOTERS && !INSECURE) -/* Check if (alleged) mstate m has expected magic field */ -#define ok_magic(M) ((M)->magic == mparams.magic) -#else /* (FOOTERS && !INSECURE) */ -#define ok_magic(M) (1) -#endif /* (FOOTERS && !INSECURE) */ - - -/* In gcc, use __builtin_expect to minimize impact of checks */ -#if !INSECURE -#if defined(__GNUC__) && __GNUC__ >= 3 -#define RTCHECK(e) __builtin_expect(e, 1) -#else /* GNUC */ -#define RTCHECK(e) (e) -#endif /* GNUC */ -#else /* !INSECURE */ -#define RTCHECK(e) (1) -#endif /* !INSECURE */ - -/* macros to set up inuse chunks with or without footers */ - -#if !FOOTERS - -#define mark_inuse_foot(M,p,s) - -/* Set cinuse bit and pinuse bit of next chunk */ -#define set_inuse(M,p,s)\ - ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ - ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) - -/* Set cinuse and pinuse of this chunk and pinuse of next chunk */ -#define set_inuse_and_pinuse(M,p,s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) - -/* Set size, cinuse and pinuse bit of this chunk */ -#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) - -#else /* FOOTERS */ - -/* Set foot of inuse chunk to be xor of mstate and seed */ -#define mark_inuse_foot(M,p,s)\ - (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) - -#define get_mstate_for(p)\ - ((mstate)(((mchunkptr)((char*)(p) +\ - (chunksize(p))))->prev_foot ^ mparams.magic)) - -#define set_inuse(M,p,s)\ - ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ - (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ - mark_inuse_foot(M,p,s)) - -#define set_inuse_and_pinuse(M,p,s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ - mark_inuse_foot(M,p,s)) - -#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ - ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ - mark_inuse_foot(M, p, s)) - -#endif /* !FOOTERS */ - -/* ---------------------------- setting mparams -------------------------- */ - -/* Initialize mparams */ -static int init_mparams(void) { - if (mparams.page_size == 0) { - size_t s; - - mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; - mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; -#if MORECORE_CONTIGUOUS - mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; -#else /* MORECORE_CONTIGUOUS */ - mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; -#endif /* MORECORE_CONTIGUOUS */ - -#if (FOOTERS && !INSECURE) - { -#if USE_DEV_RANDOM - int fd; - unsigned char buf[sizeof(size_t)]; - /* Try to use /dev/urandom, else fall back on using time */ - if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && - read(fd, buf, sizeof(buf)) == sizeof(buf)) { - s = *((size_t *) buf); - close(fd); - } - else -#endif /* USE_DEV_RANDOM */ - s = (size_t)(time(0) ^ (size_t)0x55555555U); - - s |= (size_t)8U; /* ensure nonzero */ - s &= ~(size_t)7U; /* improve chances of fault for bad values */ - - } -#else /* (FOOTERS && !INSECURE) */ - s = (size_t)0x58585858U; -#endif /* (FOOTERS && !INSECURE) */ - ACQUIRE_MAGIC_INIT_LOCK(); - if (mparams.magic == 0) { - mparams.magic = s; - /* Set up lock for main malloc area */ - INITIAL_LOCK(&gm->mutex); - gm->mflags = mparams.default_mflags; - } - RELEASE_MAGIC_INIT_LOCK(); - -#if !defined(WIN32) && !defined(__OS2__) - mparams.page_size = malloc_getpagesize; - mparams.granularity = ((DEFAULT_GRANULARITY != 0)? - DEFAULT_GRANULARITY : mparams.page_size); -#elif defined (__OS2__) - /* if low-memory is used, os2munmap() would break - if it were anything other than 64k */ - mparams.page_size = 4096u; - mparams.granularity = 65536u; -#else /* WIN32 */ - { - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - mparams.page_size = system_info.dwPageSize; - mparams.granularity = system_info.dwAllocationGranularity; - } -#endif /* WIN32 */ - - /* Sanity-check configuration: - size_t must be unsigned and as wide as pointer type. - ints must be at least 4 bytes. - alignment must be at least 8. - Alignment, min chunk size, and page size must all be powers of 2. - */ - if ((sizeof(size_t) != sizeof(char*)) || - (MAX_SIZE_T < MIN_CHUNK_SIZE) || - (sizeof(int) < 4) || - (MALLOC_ALIGNMENT < (size_t)8U) || - ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || - ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || - ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) || - ((mparams.page_size & (mparams.page_size-SIZE_T_ONE)) != 0)) - ABORT; - } - return 0; -} - -/* support for mallopt */ -static int change_mparam(int param_number, int value) { - size_t val = (size_t)value; - init_mparams(); - switch(param_number) { - case M_TRIM_THRESHOLD: - mparams.trim_threshold = val; - return 1; - case M_GRANULARITY: - if (val >= mparams.page_size && ((val & (val-1)) == 0)) { - mparams.granularity = val; - return 1; - } - else - return 0; - case M_MMAP_THRESHOLD: - mparams.mmap_threshold = val; - return 1; - default: - return 0; - } -} - -#if DEBUG -/* ------------------------- Debugging Support --------------------------- */ - -/* Check properties of any chunk, whether free, inuse, mmapped etc */ -static void do_check_any_chunk(mstate m, mchunkptr p) { - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); -} - -/* Check properties of top chunk */ -static void do_check_top_chunk(mstate m, mchunkptr p) { - msegmentptr sp = segment_holding(m, (char*)p); - size_t sz = chunksize(p); - assert(sp != 0); - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); - assert(sz == m->topsize); - assert(sz > 0); - assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); - assert(pinuse(p)); - assert(!next_pinuse(p)); -} - -/* Check properties of (inuse) mmapped chunks */ -static void do_check_mmapped_chunk(mstate m, mchunkptr p) { - size_t sz = chunksize(p); - size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD); - assert(is_mmapped(p)); - assert(use_mmap(m)); - assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); - assert(ok_address(m, p)); - assert(!is_small(sz)); - assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); - assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); - assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); -} - -/* Check properties of inuse chunks */ -static void do_check_inuse_chunk(mstate m, mchunkptr p) { - do_check_any_chunk(m, p); - assert(cinuse(p)); - assert(next_pinuse(p)); - /* If not pinuse and not mmapped, previous chunk has OK offset */ - assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); - if (is_mmapped(p)) - do_check_mmapped_chunk(m, p); -} - -/* Check properties of free chunks */ -static void do_check_free_chunk(mstate m, mchunkptr p) { - size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); - mchunkptr next = chunk_plus_offset(p, sz); - do_check_any_chunk(m, p); - assert(!cinuse(p)); - assert(!next_pinuse(p)); - assert (!is_mmapped(p)); - if (p != m->dv && p != m->top) { - if (sz >= MIN_CHUNK_SIZE) { - assert((sz & CHUNK_ALIGN_MASK) == 0); - assert(is_aligned(chunk2mem(p))); - assert(next->prev_foot == sz); - assert(pinuse(p)); - assert (next == m->top || cinuse(next)); - assert(p->fd->bk == p); - assert(p->bk->fd == p); - } - else /* markers are always of size SIZE_T_SIZE */ - assert(sz == SIZE_T_SIZE); - } -} - -/* Check properties of malloced chunks at the point they are malloced */ -static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); - size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); - do_check_inuse_chunk(m, p); - assert((sz & CHUNK_ALIGN_MASK) == 0); - assert(sz >= MIN_CHUNK_SIZE); - assert(sz >= s); - /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ - assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); - } -} - -/* Check a tree and its subtrees. */ -static void do_check_tree(mstate m, tchunkptr t) { - tchunkptr head = 0; - tchunkptr u = t; - bindex_t tindex = t->index; - size_t tsize = chunksize(t); - bindex_t idx; - compute_tree_index(tsize, idx); - assert(tindex == idx); - assert(tsize >= MIN_LARGE_SIZE); - assert(tsize >= minsize_for_tree_index(idx)); - assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); - - do { /* traverse through chain of same-sized nodes */ - do_check_any_chunk(m, ((mchunkptr)u)); - assert(u->index == tindex); - assert(chunksize(u) == tsize); - assert(!cinuse(u)); - assert(!next_pinuse(u)); - assert(u->fd->bk == u); - assert(u->bk->fd == u); - if (u->parent == 0) { - assert(u->child[0] == 0); - assert(u->child[1] == 0); - } - else { - assert(head == 0); /* only one node on chain has parent */ - head = u; - assert(u->parent != u); - assert (u->parent->child[0] == u || - u->parent->child[1] == u || - *((tbinptr*)(u->parent)) == u); - if (u->child[0] != 0) { - assert(u->child[0]->parent == u); - assert(u->child[0] != u); - do_check_tree(m, u->child[0]); - } - if (u->child[1] != 0) { - assert(u->child[1]->parent == u); - assert(u->child[1] != u); - do_check_tree(m, u->child[1]); - } - if (u->child[0] != 0 && u->child[1] != 0) { - assert(chunksize(u->child[0]) < chunksize(u->child[1])); - } - } - u = u->fd; - } while (u != t); - assert(head != 0); -} - -/* Check all the chunks in a treebin. */ -static void do_check_treebin(mstate m, bindex_t i) { - tbinptr* tb = treebin_at(m, i); - tchunkptr t = *tb; - int empty = (m->treemap & (1U << i)) == 0; - if (t == 0) - assert(empty); - if (!empty) - do_check_tree(m, t); -} - -/* Check all the chunks in a smallbin. */ -static void do_check_smallbin(mstate m, bindex_t i) { - sbinptr b = smallbin_at(m, i); - mchunkptr p = b->bk; - unsigned int empty = (m->smallmap & (1U << i)) == 0; - if (p == b) - assert(empty); - if (!empty) { - for (; p != b; p = p->bk) { - size_t size = chunksize(p); - mchunkptr q; - /* each chunk claims to be free */ - do_check_free_chunk(m, p); - /* chunk belongs in bin */ - assert(small_index(size) == i); - assert(p->bk == b || chunksize(p->bk) == chunksize(p)); - /* chunk is followed by an inuse chunk */ - q = next_chunk(p); - if (q->head != FENCEPOST_HEAD) - do_check_inuse_chunk(m, q); - } - } -} - -/* Find x in a bin. Used in other check functions. */ -static int bin_find(mstate m, mchunkptr x) { - size_t size = chunksize(x); - if (is_small(size)) { - bindex_t sidx = small_index(size); - sbinptr b = smallbin_at(m, sidx); - if (smallmap_is_marked(m, sidx)) { - mchunkptr p = b; - do { - if (p == x) - return 1; - } while ((p = p->fd) != b); - } - } - else { - bindex_t tidx; - compute_tree_index(size, tidx); - if (treemap_is_marked(m, tidx)) { - tchunkptr t = *treebin_at(m, tidx); - size_t sizebits = size << leftshift_for_tree_index(tidx); - while (t != 0 && chunksize(t) != size) { - t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; - sizebits <<= 1; - } - if (t != 0) { - tchunkptr u = t; - do { - if (u == (tchunkptr)x) - return 1; - } while ((u = u->fd) != t); - } - } - } - return 0; -} - -/* Traverse each chunk and check it; return total */ -static size_t traverse_and_check(mstate m) { - size_t sum = 0; - if (is_initialized(m)) { - msegmentptr s = &m->seg; - sum += m->topsize + TOP_FOOT_SIZE; - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - mchunkptr lastq = 0; - assert(pinuse(q)); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - sum += chunksize(q); - if (cinuse(q)) { - assert(!bin_find(m, q)); - do_check_inuse_chunk(m, q); - } - else { - assert(q == m->dv || bin_find(m, q)); - assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */ - do_check_free_chunk(m, q); - } - lastq = q; - q = next_chunk(q); - } - s = s->next; - } - } - return sum; -} - -/* Check all properties of malloc_state. */ -static void do_check_malloc_state(mstate m) { - bindex_t i; - size_t total; - /* check bins */ - for (i = 0; i < NSMALLBINS; ++i) - do_check_smallbin(m, i); - for (i = 0; i < NTREEBINS; ++i) - do_check_treebin(m, i); - - if (m->dvsize != 0) { /* check dv chunk */ - do_check_any_chunk(m, m->dv); - assert(m->dvsize == chunksize(m->dv)); - assert(m->dvsize >= MIN_CHUNK_SIZE); - assert(bin_find(m, m->dv) == 0); - } - - if (m->top != 0) { /* check top chunk */ - do_check_top_chunk(m, m->top); - assert(m->topsize == chunksize(m->top)); - assert(m->topsize > 0); - assert(bin_find(m, m->top) == 0); - } - - total = traverse_and_check(m); - assert(total <= m->footprint); - assert(m->footprint <= m->max_footprint); -} -#endif /* DEBUG */ - -/* ----------------------------- statistics ------------------------------ */ - -#if !NO_MALLINFO -static struct mallinfo internal_mallinfo(mstate m) { - struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - if (!PREACTION(m)) { - check_malloc_state(m); - if (is_initialized(m)) { - size_t nfree = SIZE_T_ONE; /* top always free */ - size_t mfree = m->topsize + TOP_FOOT_SIZE; - size_t sum = mfree; - msegmentptr s = &m->seg; - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - size_t sz = chunksize(q); - sum += sz; - if (!cinuse(q)) { - mfree += sz; - ++nfree; - } - q = next_chunk(q); - } - s = s->next; - } - - nm.arena = sum; - nm.ordblks = nfree; - nm.hblkhd = m->footprint - sum; - nm.usmblks = m->max_footprint; - nm.uordblks = m->footprint - mfree; - nm.fordblks = mfree; - nm.keepcost = m->topsize; - } - - POSTACTION(m); - } - return nm; -} -#endif /* !NO_MALLINFO */ - -static void internal_malloc_stats(mstate m) { - if (!PREACTION(m)) { - size_t maxfp = 0; - size_t fp = 0; - size_t used = 0; - check_malloc_state(m); - if (is_initialized(m)) { - msegmentptr s = &m->seg; - maxfp = m->max_footprint; - fp = m->footprint; - used = fp - (m->topsize + TOP_FOOT_SIZE); - - while (s != 0) { - mchunkptr q = align_as_chunk(s->base); - while (segment_holds(s, q) && - q != m->top && q->head != FENCEPOST_HEAD) { - if (!cinuse(q)) - used -= chunksize(q); - q = next_chunk(q); - } - s = s->next; - } - } - - fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); - fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); - fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); - - POSTACTION(m); - } -} - -/* ----------------------- Operations on smallbins ----------------------- */ - -/* - Various forms of linking and unlinking are defined as macros. Even - the ones for trees, which are very long but have very short typical - paths. This is ugly but reduces reliance on inlining support of - compilers. -*/ - -/* Link a free chunk into a smallbin */ -#define insert_small_chunk(M, P, S) {\ - bindex_t I = small_index(S);\ - mchunkptr B = smallbin_at(M, I);\ - mchunkptr F = B;\ - assert(S >= MIN_CHUNK_SIZE);\ - if (!smallmap_is_marked(M, I))\ - mark_smallmap(M, I);\ - else if (RTCHECK(ok_address(M, B->fd)))\ - F = B->fd;\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - B->fd = P;\ - F->bk = P;\ - P->fd = F;\ - P->bk = B;\ -} - -/* Unlink a chunk from a smallbin */ -#define unlink_small_chunk(M, P, S) {\ - mchunkptr F = P->fd;\ - mchunkptr B = P->bk;\ - bindex_t I = small_index(S);\ - assert(P != B);\ - assert(P != F);\ - assert(chunksize(P) == small_index2size(I));\ - if (F == B)\ - clear_smallmap(M, I);\ - else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ - (B == smallbin_at(M,I) || ok_address(M, B)))) {\ - F->bk = B;\ - B->fd = F;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ -} - -/* Unlink the first chunk from a smallbin */ -#define unlink_first_small_chunk(M, B, P, I) {\ - mchunkptr F = P->fd;\ - assert(P != B);\ - assert(P != F);\ - assert(chunksize(P) == small_index2size(I));\ - if (B == F)\ - clear_smallmap(M, I);\ - else if (RTCHECK(ok_address(M, F))) {\ - B->fd = F;\ - F->bk = B;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ -} - -/* Replace dv node, binning the old one */ -/* Used only when dvsize known to be small */ -#define replace_dv(M, P, S) {\ - size_t DVS = M->dvsize;\ - if (DVS != 0) {\ - mchunkptr DV = M->dv;\ - assert(is_small(DVS));\ - insert_small_chunk(M, DV, DVS);\ - }\ - M->dvsize = S;\ - M->dv = P;\ -} - -/* ------------------------- Operations on trees ------------------------- */ - -/* Insert chunk into tree */ -#define insert_large_chunk(M, X, S) {\ - tbinptr* H;\ - bindex_t I;\ - compute_tree_index(S, I);\ - H = treebin_at(M, I);\ - X->index = I;\ - X->child[0] = X->child[1] = 0;\ - if (!treemap_is_marked(M, I)) {\ - mark_treemap(M, I);\ - *H = X;\ - X->parent = (tchunkptr)H;\ - X->fd = X->bk = X;\ - }\ - else {\ - tchunkptr T = *H;\ - size_t K = S << leftshift_for_tree_index(I);\ - for (;;) {\ - if (chunksize(T) != S) {\ - tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ - K <<= 1;\ - if (*C != 0)\ - T = *C;\ - else if (RTCHECK(ok_address(M, C))) {\ - *C = X;\ - X->parent = T;\ - X->fd = X->bk = X;\ - break;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - break;\ - }\ - }\ - else {\ - tchunkptr F = T->fd;\ - if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ - T->fd = F->bk = X;\ - X->fd = F;\ - X->bk = T;\ - X->parent = 0;\ - break;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - break;\ - }\ - }\ - }\ - }\ -} - -/* - Unlink steps: - - 1. If x is a chained node, unlink it from its same-sized fd/bk links - and choose its bk node as its replacement. - 2. If x was the last node of its size, but not a leaf node, it must - be replaced with a leaf node (not merely one with an open left or - right), to make sure that lefts and rights of descendants - correspond properly to bit masks. We use the rightmost descendant - of x. We could use any other leaf, but this is easy to locate and - tends to counteract removal of leftmosts elsewhere, and so keeps - paths shorter than minimally guaranteed. This doesn't loop much - because on average a node in a tree is near the bottom. - 3. If x is the base of a chain (i.e., has parent links) relink - x's parent and children to x's replacement (or null if none). -*/ - -#define unlink_large_chunk(M, X) {\ - tchunkptr XP = X->parent;\ - tchunkptr R;\ - if (X->bk != X) {\ - tchunkptr F = X->fd;\ - R = X->bk;\ - if (RTCHECK(ok_address(M, F))) {\ - F->bk = R;\ - R->fd = F;\ - }\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - else {\ - tchunkptr* RP;\ - if (((R = *(RP = &(X->child[1]))) != 0) ||\ - ((R = *(RP = &(X->child[0]))) != 0)) {\ - tchunkptr* CP;\ - while ((*(CP = &(R->child[1])) != 0) ||\ - (*(CP = &(R->child[0])) != 0)) {\ - R = *(RP = CP);\ - }\ - if (RTCHECK(ok_address(M, RP)))\ - *RP = 0;\ - else {\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - }\ - if (XP != 0) {\ - tbinptr* H = treebin_at(M, X->index);\ - if (X == *H) {\ - if ((*H = R) == 0) \ - clear_treemap(M, X->index);\ - }\ - else if (RTCHECK(ok_address(M, XP))) {\ - if (XP->child[0] == X) \ - XP->child[0] = R;\ - else \ - XP->child[1] = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - if (R != 0) {\ - if (RTCHECK(ok_address(M, R))) {\ - tchunkptr C0, C1;\ - R->parent = XP;\ - if ((C0 = X->child[0]) != 0) {\ - if (RTCHECK(ok_address(M, C0))) {\ - R->child[0] = C0;\ - C0->parent = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - if ((C1 = X->child[1]) != 0) {\ - if (RTCHECK(ok_address(M, C1))) {\ - R->child[1] = C1;\ - C1->parent = R;\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ - else\ - CORRUPTION_ERROR_ACTION(M);\ - }\ - }\ -} - -/* Relays to large vs small bin operations */ - -#define insert_chunk(M, P, S)\ - if (is_small(S)) insert_small_chunk(M, P, S)\ - else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } - -#define unlink_chunk(M, P, S)\ - if (is_small(S)) unlink_small_chunk(M, P, S)\ - else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } - - -/* Relays to internal calls to malloc/free from realloc, memalign etc */ - -#if ONLY_MSPACES -#define internal_malloc(m, b) mspace_malloc(m, b) -#define internal_free(m, mem) mspace_free(m,mem); -#else /* ONLY_MSPACES */ -#if MSPACES -#define internal_malloc(m, b)\ - (m == gm)? dlmalloc(b) : mspace_malloc(m, b) -#define internal_free(m, mem)\ - if (m == gm) dlfree(mem); else mspace_free(m,mem); -#else /* MSPACES */ -#define internal_malloc(m, b) dlmalloc(b) -#define internal_free(m, mem) dlfree(mem) -#endif /* MSPACES */ -#endif /* ONLY_MSPACES */ - -/* ----------------------- Direct-mmapping chunks ----------------------- */ - -/* - Directly mmapped chunks are set up with an offset to the start of - the mmapped region stored in the prev_foot field of the chunk. This - allows reconstruction of the required argument to MUNMAP when freed, - and also allows adjustment of the returned chunk to meet alignment - requirements (especially in memalign). There is also enough space - allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain - the PINUSE bit so frees can be checked. -*/ - -/* Malloc using mmap */ -static void* mmap_alloc(mstate m, size_t nb) { - size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); - if (mmsize > nb) { /* Check for wrap around 0 */ - char* mm = (char*)(DIRECT_MMAP(mmsize)); - if (mm != CMFAIL) { - size_t offset = align_offset(chunk2mem(mm)); - size_t psize = mmsize - offset - MMAP_FOOT_PAD; - mchunkptr p = (mchunkptr)(mm + offset); - p->prev_foot = offset | IS_MMAPPED_BIT; - (p)->head = (psize|CINUSE_BIT); - mark_inuse_foot(m, p, psize); - chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; - chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; - - if (mm < m->least_addr) - m->least_addr = mm; - if ((m->footprint += mmsize) > m->max_footprint) - m->max_footprint = m->footprint; - assert(is_aligned(chunk2mem(p))); - check_mmapped_chunk(m, p); - return chunk2mem(p); - } - } - return 0; -} - -/* Realloc using mmap */ -static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { - size_t oldsize = chunksize(oldp); - if (is_small(nb)) /* Can't shrink mmap regions below small size */ - return 0; - /* Keep old chunk if big enough but not too big */ - if (oldsize >= nb + SIZE_T_SIZE && - (oldsize - nb) <= (mparams.granularity << 1)) - return oldp; - else { - size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT; - size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; - size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES + - CHUNK_ALIGN_MASK); - char* cp = (char*)CALL_MREMAP((char*)oldp - offset, - oldmmsize, newmmsize, 1); - if (cp != CMFAIL) { - mchunkptr newp = (mchunkptr)(cp + offset); - size_t psize = newmmsize - offset - MMAP_FOOT_PAD; - newp->head = (psize|CINUSE_BIT); - mark_inuse_foot(m, newp, psize); - chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; - chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; - - if (cp < m->least_addr) - m->least_addr = cp; - if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) - m->max_footprint = m->footprint; - check_mmapped_chunk(m, newp); - return newp; - } - } - return 0; -} - -/* -------------------------- mspace management -------------------------- */ - -/* Initialize top chunk and its size */ -static void init_top(mstate m, mchunkptr p, size_t psize) { - /* Ensure alignment */ - size_t offset = align_offset(chunk2mem(p)); - p = (mchunkptr)((char*)p + offset); - psize -= offset; - - m->top = p; - m->topsize = psize; - p->head = psize | PINUSE_BIT; - /* set size of fake trailing chunk holding overhead space only once */ - chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; - m->trim_check = mparams.trim_threshold; /* reset on each update */ -} - -/* Initialize bins for a new mstate that is otherwise zeroed out */ -static void init_bins(mstate m) { - /* Establish circular links for smallbins */ - bindex_t i; - for (i = 0; i < NSMALLBINS; ++i) { - sbinptr bin = smallbin_at(m,i); - bin->fd = bin->bk = bin; - } -} - -#if PROCEED_ON_ERROR - -/* default corruption action */ -static void reset_on_error(mstate m) { - int i; - ++malloc_corruption_error_count; - /* Reinitialize fields to forget about all memory */ - m->smallbins = m->treebins = 0; - m->dvsize = m->topsize = 0; - m->seg.base = 0; - m->seg.size = 0; - m->seg.next = 0; - m->top = m->dv = 0; - for (i = 0; i < NTREEBINS; ++i) - *treebin_at(m, i) = 0; - init_bins(m); -} -#endif /* PROCEED_ON_ERROR */ - -/* Allocate chunk and prepend remainder with chunk in successor base. */ -static void* prepend_alloc(mstate m, char* newbase, char* oldbase, - size_t nb) { - mchunkptr p = align_as_chunk(newbase); - mchunkptr oldfirst = align_as_chunk(oldbase); - size_t psize = (char*)oldfirst - (char*)p; - mchunkptr q = chunk_plus_offset(p, nb); - size_t qsize = psize - nb; - set_size_and_pinuse_of_inuse_chunk(m, p, nb); - - assert((char*)oldfirst > (char*)q); - assert(pinuse(oldfirst)); - assert(qsize >= MIN_CHUNK_SIZE); - - /* consolidate remainder with first chunk of old base */ - if (oldfirst == m->top) { - size_t tsize = m->topsize += qsize; - m->top = q; - q->head = tsize | PINUSE_BIT; - check_top_chunk(m, q); - } - else if (oldfirst == m->dv) { - size_t dsize = m->dvsize += qsize; - m->dv = q; - set_size_and_pinuse_of_free_chunk(q, dsize); - } - else { - if (!cinuse(oldfirst)) { - size_t nsize = chunksize(oldfirst); - unlink_chunk(m, oldfirst, nsize); - oldfirst = chunk_plus_offset(oldfirst, nsize); - qsize += nsize; - } - set_free_with_pinuse(q, qsize, oldfirst); - insert_chunk(m, q, qsize); - check_free_chunk(m, q); - } - - check_malloced_chunk(m, chunk2mem(p), nb); - return chunk2mem(p); -} - - -/* Add a segment to hold a new noncontiguous region */ -static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { - /* Determine locations and sizes of segment, fenceposts, old top */ - char* old_top = (char*)m->top; - msegmentptr oldsp = segment_holding(m, old_top); - char* old_end = oldsp->base + oldsp->size; - size_t ssize = pad_request(sizeof(struct malloc_segment)); - char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); - size_t offset = align_offset(chunk2mem(rawsp)); - char* asp = rawsp + offset; - char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; - mchunkptr sp = (mchunkptr)csp; - msegmentptr ss = (msegmentptr)(chunk2mem(sp)); - mchunkptr tnext = chunk_plus_offset(sp, ssize); - mchunkptr p = tnext; - int nfences = 0; - - /* reset top to new space */ - init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); - - /* Set up segment record */ - assert(is_aligned(ss)); - set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); - *ss = m->seg; /* Push current record */ - m->seg.base = tbase; - m->seg.size = tsize; - (void)set_segment_flags(&m->seg, mmapped); - m->seg.next = ss; - - /* Insert trailing fenceposts */ - for (;;) { - mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); - p->head = FENCEPOST_HEAD; - ++nfences; - if ((char*)(&(nextp->head)) < old_end) - p = nextp; - else - break; - } - assert(nfences >= 2); - - /* Insert the rest of old top into a bin as an ordinary free chunk */ - if (csp != old_top) { - mchunkptr q = (mchunkptr)old_top; - size_t psize = csp - old_top; - mchunkptr tn = chunk_plus_offset(q, psize); - set_free_with_pinuse(q, psize, tn); - insert_chunk(m, q, psize); - } - - check_top_chunk(m, m->top); -} - -/* -------------------------- System allocation -------------------------- */ - -/* Get memory from system using MORECORE or MMAP */ -static void* sys_alloc(mstate m, size_t nb) { - char* tbase = CMFAIL; - size_t tsize = 0; - flag_t mmap_flag = 0; - - init_mparams(); - - /* Directly map large chunks */ - if (use_mmap(m) && nb >= mparams.mmap_threshold) { - void* mem = mmap_alloc(m, nb); - if (mem != 0) - return mem; - } - - /* - Try getting memory in any of three ways (in most-preferred to - least-preferred order): - 1. A call to MORECORE that can normally contiguously extend memory. - (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or - or main space is mmapped or a previous contiguous call failed) - 2. A call to MMAP new space (disabled if not HAVE_MMAP). - Note that under the default settings, if MORECORE is unable to - fulfill a request, and HAVE_MMAP is true, then mmap is - used as a noncontiguous system allocator. This is a useful backup - strategy for systems with holes in address spaces -- in this case - sbrk cannot contiguously expand the heap, but mmap may be able to - find space. - 3. A call to MORECORE that cannot usually contiguously extend memory. - (disabled if not HAVE_MORECORE) - */ - - if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { - char* br = CMFAIL; - msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); - size_t asize = 0; - ACQUIRE_MORECORE_LOCK(); - - if (ss == 0) { /* First time through or recovery */ - char* base = (char*)CALL_MORECORE(0); - if (base != CMFAIL) { - asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); - /* Adjust to end on a page boundary */ - if (!is_page_aligned(base)) - asize += (page_align((size_t)base) - (size_t)base); - /* Can't call MORECORE if size is negative when treated as signed */ - if (asize < HALF_MAX_SIZE_T && - (br = (char*)(CALL_MORECORE(asize))) == base) { - tbase = base; - tsize = asize; - } - } - } - else { - /* Subtract out existing available top space from MORECORE request. */ - asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE); - /* Use mem here only if it did continuously extend old space */ - if (asize < HALF_MAX_SIZE_T && - (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { - tbase = br; - tsize = asize; - } - } - - if (tbase == CMFAIL) { /* Cope with partial failure */ - if (br != CMFAIL) { /* Try to use/extend the space we did get */ - if (asize < HALF_MAX_SIZE_T && - asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) { - size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize); - if (esize < HALF_MAX_SIZE_T) { - char* end = (char*)CALL_MORECORE(esize); - if (end != CMFAIL) - asize += esize; - else { /* Can't use; try to release */ - (void)CALL_MORECORE(-asize); - br = CMFAIL; - } - } - } - } - if (br != CMFAIL) { /* Use the space we did get */ - tbase = br; - tsize = asize; - } - else - disable_contiguous(m); /* Don't try contiguous path in the future */ - } - - RELEASE_MORECORE_LOCK(); - } - - if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ - size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE; - size_t rsize = granularity_align(req); - if (rsize > nb) { /* Fail if wraps around zero */ - char* mp = (char*)(CALL_MMAP(rsize)); - if (mp != CMFAIL) { - tbase = mp; - tsize = rsize; - mmap_flag = IS_MMAPPED_BIT; - } - } - } - - if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ - size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); - if (asize < HALF_MAX_SIZE_T) { - char* br = CMFAIL; - char* end = CMFAIL; - ACQUIRE_MORECORE_LOCK(); - br = (char*)(CALL_MORECORE(asize)); - end = (char*)(CALL_MORECORE(0)); - RELEASE_MORECORE_LOCK(); - if (br != CMFAIL && end != CMFAIL && br < end) { - size_t ssize = end - br; - if (ssize > nb + TOP_FOOT_SIZE) { - tbase = br; - tsize = ssize; - } - } - } - } - - if (tbase != CMFAIL) { - - if ((m->footprint += tsize) > m->max_footprint) - m->max_footprint = m->footprint; - - if (!is_initialized(m)) { /* first-time initialization */ - m->seg.base = m->least_addr = tbase; - m->seg.size = tsize; - (void)set_segment_flags(&m->seg, mmap_flag); - m->magic = mparams.magic; - init_bins(m); - if (is_global(m)) - init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); - else { - /* Offset top by embedded malloc_state */ - mchunkptr mn = next_chunk(mem2chunk(m)); - init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); - } - } - - else { - /* Try to merge with an existing segment */ - msegmentptr sp = &m->seg; - while (sp != 0 && tbase != sp->base + sp->size) - sp = sp->next; - if (sp != 0 && - !is_extern_segment(sp) && - check_segment_merge(sp, tbase, tsize) && - (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag && - segment_holds(sp, m->top)) { /* append */ - sp->size += tsize; - init_top(m, m->top, m->topsize + tsize); - } - else { - if (tbase < m->least_addr) - m->least_addr = tbase; - sp = &m->seg; - while (sp != 0 && sp->base != tbase + tsize) - sp = sp->next; - if (sp != 0 && - !is_extern_segment(sp) && - check_segment_merge(sp, tbase, tsize) && - (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag) { - char* oldbase = sp->base; - sp->base = tbase; - sp->size += tsize; - return prepend_alloc(m, tbase, oldbase, nb); - } - else - add_segment(m, tbase, tsize, mmap_flag); - } - } - - if (nb < m->topsize) { /* Allocate from new or extended top space */ - size_t rsize = m->topsize -= nb; - mchunkptr p = m->top; - mchunkptr r = m->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(m, p, nb); - check_top_chunk(m, m->top); - check_malloced_chunk(m, chunk2mem(p), nb); - return chunk2mem(p); - } - } - - MALLOC_FAILURE_ACTION; - return 0; -} - -/* ----------------------- system deallocation -------------------------- */ - -/* Unmap and unlink any mmapped segments that don't contain used chunks */ -static size_t release_unused_segments(mstate m) { - size_t released = 0; - msegmentptr pred = &m->seg; - msegmentptr sp = pred->next; - while (sp != 0) { - char* base = sp->base; - size_t size = sp->size; - msegmentptr next = sp->next; - if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { - mchunkptr p = align_as_chunk(base); - size_t psize = chunksize(p); - /* Can unmap if first chunk holds entire segment and not pinned */ - if (!cinuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { - tchunkptr tp = (tchunkptr)p; - assert(segment_holds(sp, (char*)sp)); - if (p == m->dv) { - m->dv = 0; - m->dvsize = 0; - } - else { - unlink_large_chunk(m, tp); - } - if (CALL_MUNMAP(base, size) == 0) { - released += size; - m->footprint -= size; - /* unlink obsoleted record */ - sp = pred; - sp->next = next; - } - else { /* back out if cannot unmap */ - insert_large_chunk(m, tp, psize); - } - } - } - pred = sp; - sp = next; - } - return released; -} - -static int sys_trim(mstate m, size_t pad) { - size_t released = 0; - if (pad < MAX_REQUEST && is_initialized(m)) { - pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ - - if (m->topsize > pad) { - /* Shrink top space in granularity-size units, keeping at least one */ - size_t unit = mparams.granularity; - size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - - SIZE_T_ONE) * unit; - msegmentptr sp = segment_holding(m, (char*)m->top); - - if (!is_extern_segment(sp)) { - if (is_mmapped_segment(sp)) { - if (HAVE_MMAP && - sp->size >= extra && - !has_segment_link(m, sp)) { /* can't shrink if pinned */ - size_t newsize = sp->size - extra; - /* Prefer mremap, fall back to munmap */ - if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || - (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { - released = extra; - } - } - } - else if (HAVE_MORECORE) { - if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ - extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; - ACQUIRE_MORECORE_LOCK(); - { - /* Make sure end of memory is where we last set it. */ - char* old_br = (char*)(CALL_MORECORE(0)); - if (old_br == sp->base + sp->size) { - char* rel_br = (char*)(CALL_MORECORE(-extra)); - char* new_br = (char*)(CALL_MORECORE(0)); - if (rel_br != CMFAIL && new_br < old_br) - released = old_br - new_br; - } - } - RELEASE_MORECORE_LOCK(); - } - } - - if (released != 0) { - sp->size -= released; - m->footprint -= released; - init_top(m, m->top, m->topsize - released); - check_top_chunk(m, m->top); - } - } - - /* Unmap any unused mmapped segments */ - if (HAVE_MMAP) - released += release_unused_segments(m); - - /* On failure, disable autotrim to avoid repeated failed future calls */ - if (released == 0) - m->trim_check = MAX_SIZE_T; - } - - return (released != 0)? 1 : 0; -} - -/* ---------------------------- malloc support --------------------------- */ - -/* allocate a large request from the best fitting chunk in a treebin */ -static void* tmalloc_large(mstate m, size_t nb) { - tchunkptr v = 0; - size_t rsize = -nb; /* Unsigned negation */ - tchunkptr t; - bindex_t idx; - compute_tree_index(nb, idx); - - if ((t = *treebin_at(m, idx)) != 0) { - /* Traverse tree for this bin looking for node with size == nb */ - size_t sizebits = nb << leftshift_for_tree_index(idx); - tchunkptr rst = 0; /* The deepest untaken right subtree */ - for (;;) { - tchunkptr rt; - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - v = t; - if ((rsize = trem) == 0) - break; - } - rt = t->child[1]; - t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; - if (rt != 0 && rt != t) - rst = rt; - if (t == 0) { - t = rst; /* set t to least subtree holding sizes > nb */ - break; - } - sizebits <<= 1; - } - } - - if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ - binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; - if (leftbits != 0) { - bindex_t i; - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - t = *treebin_at(m, i); - } - } - - while (t != 0) { /* find smallest of tree or subtree */ - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - rsize = trem; - v = t; - } - t = leftmost_child(t); - } - - /* If dv is a better fit, return 0 so malloc will use it */ - if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { - if (RTCHECK(ok_address(m, v))) { /* split */ - mchunkptr r = chunk_plus_offset(v, nb); - assert(chunksize(v) == rsize + nb); - if (RTCHECK(ok_next(v, r))) { - unlink_large_chunk(m, v); - if (rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(m, v, (rsize + nb)); - else { - set_size_and_pinuse_of_inuse_chunk(m, v, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - insert_chunk(m, r, rsize); - } - return chunk2mem(v); - } - } - CORRUPTION_ERROR_ACTION(m); - } - return 0; -} - -/* allocate a small request from the best fitting chunk in a treebin */ -static void* tmalloc_small(mstate m, size_t nb) { - tchunkptr t, v; - size_t rsize; - bindex_t i; - binmap_t leastbit = least_bit(m->treemap); - compute_bit2idx(leastbit, i); - - v = t = *treebin_at(m, i); - rsize = chunksize(t) - nb; - - while ((t = leftmost_child(t)) != 0) { - size_t trem = chunksize(t) - nb; - if (trem < rsize) { - rsize = trem; - v = t; - } - } - - if (RTCHECK(ok_address(m, v))) { - mchunkptr r = chunk_plus_offset(v, nb); - assert(chunksize(v) == rsize + nb); - if (RTCHECK(ok_next(v, r))) { - unlink_large_chunk(m, v); - if (rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(m, v, (rsize + nb)); - else { - set_size_and_pinuse_of_inuse_chunk(m, v, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(m, r, rsize); - } - return chunk2mem(v); - } - } - - CORRUPTION_ERROR_ACTION(m); - return 0; -} - -/* --------------------------- realloc support --------------------------- */ - -static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { - if (bytes >= MAX_REQUEST) { - MALLOC_FAILURE_ACTION; - return 0; - } - if (!PREACTION(m)) { - mchunkptr oldp = mem2chunk(oldmem); - size_t oldsize = chunksize(oldp); - mchunkptr next = chunk_plus_offset(oldp, oldsize); - mchunkptr newp = 0; - void* extra = 0; - - /* Try to either shrink or extend into top. Else malloc-copy-free */ - - if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) && - ok_next(oldp, next) && ok_pinuse(next))) { - size_t nb = request2size(bytes); - if (is_mmapped(oldp)) - newp = mmap_resize(m, oldp, nb); - else if (oldsize >= nb) { /* already big enough */ - size_t rsize = oldsize - nb; - newp = oldp; - if (rsize >= MIN_CHUNK_SIZE) { - mchunkptr remainder = chunk_plus_offset(newp, nb); - set_inuse(m, newp, nb); - set_inuse(m, remainder, rsize); - extra = chunk2mem(remainder); - } - } - else if (next == m->top && oldsize + m->topsize > nb) { - /* Expand into top */ - size_t newsize = oldsize + m->topsize; - size_t newtopsize = newsize - nb; - mchunkptr newtop = chunk_plus_offset(oldp, nb); - set_inuse(m, oldp, nb); - newtop->head = newtopsize |PINUSE_BIT; - m->top = newtop; - m->topsize = newtopsize; - newp = oldp; - } - } - else { - USAGE_ERROR_ACTION(m, oldmem); - POSTACTION(m); - return 0; - } - - POSTACTION(m); - - if (newp != 0) { - if (extra != 0) { - internal_free(m, extra); - } - check_inuse_chunk(m, newp); - return chunk2mem(newp); - } - else { - void* newmem = internal_malloc(m, bytes); - if (newmem != 0) { - size_t oc = oldsize - overhead_for(oldp); - memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); - internal_free(m, oldmem); - } - return newmem; - } - } - return 0; -} - -/* --------------------------- memalign support -------------------------- */ - -static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { - if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ - return internal_malloc(m, bytes); - if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ - alignment = MIN_CHUNK_SIZE; - if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ - size_t a = MALLOC_ALIGNMENT << 1; - while (a < alignment) a <<= 1; - alignment = a; - } - - if (bytes >= MAX_REQUEST - alignment) { - if (m != 0) { /* Test isn't needed but avoids compiler warning */ - MALLOC_FAILURE_ACTION; - } - } - else { - size_t nb = request2size(bytes); - size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; - char* mem = (char*)internal_malloc(m, req); - if (mem != 0) { - void* leader = 0; - void* trailer = 0; - mchunkptr p = mem2chunk(mem); - - if (PREACTION(m)) return 0; - if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ - /* - Find an aligned spot inside chunk. Since we need to give - back leading space in a chunk of at least MIN_CHUNK_SIZE, if - the first calculation places us at a spot with less than - MIN_CHUNK_SIZE leader, we can move to the next aligned spot. - We've allocated enough total room so that this is always - possible. - */ - char* br = (char*)mem2chunk((size_t)(((size_t)(mem + - alignment - - SIZE_T_ONE)) & - -alignment)); - char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? - br : br+alignment; - mchunkptr newp = (mchunkptr)pos; - size_t leadsize = pos - (char*)(p); - size_t newsize = chunksize(p) - leadsize; - - if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ - newp->prev_foot = p->prev_foot + leadsize; - newp->head = (newsize|CINUSE_BIT); - } - else { /* Otherwise, give back leader, use the rest */ - set_inuse(m, newp, newsize); - set_inuse(m, p, leadsize); - leader = chunk2mem(p); - } - p = newp; - } - - /* Give back spare room at the end */ - if (!is_mmapped(p)) { - size_t size = chunksize(p); - if (size > nb + MIN_CHUNK_SIZE) { - size_t remainder_size = size - nb; - mchunkptr remainder = chunk_plus_offset(p, nb); - set_inuse(m, p, nb); - set_inuse(m, remainder, remainder_size); - trailer = chunk2mem(remainder); - } - } - - assert (chunksize(p) >= nb); - assert((((size_t)(chunk2mem(p))) % alignment) == 0); - check_inuse_chunk(m, p); - POSTACTION(m); - if (leader != 0) { - internal_free(m, leader); - } - if (trailer != 0) { - internal_free(m, trailer); - } - return chunk2mem(p); - } - } - return 0; -} - -/* ------------------------ comalloc/coalloc support --------------------- */ - -static void** ialloc(mstate m, - size_t n_elements, - size_t* sizes, - int opts, - void* chunks[]) { - /* - This provides common support for independent_X routines, handling - all of the combinations that can result. - - The opts arg has: - bit 0 set if all elements are same size (using sizes[0]) - bit 1 set if elements should be zeroed - */ - - size_t element_size; /* chunksize of each element, if all same */ - size_t contents_size; /* total size of elements */ - size_t array_size; /* request size of pointer array */ - void* mem; /* malloced aggregate space */ - mchunkptr p; /* corresponding chunk */ - size_t remainder_size; /* remaining bytes while splitting */ - void** marray; /* either "chunks" or malloced ptr array */ - mchunkptr array_chunk; /* chunk for malloced ptr array */ - flag_t was_enabled; /* to disable mmap */ - size_t size; - size_t i; - - /* compute array length, if needed */ - if (chunks != 0) { - if (n_elements == 0) - return chunks; /* nothing to do */ - marray = chunks; - array_size = 0; - } - else { - /* if empty req, must still return chunk representing empty array */ - if (n_elements == 0) - return (void**)internal_malloc(m, 0); - marray = 0; - array_size = request2size(n_elements * (sizeof(void*))); - } - - /* compute total element size */ - if (opts & 0x1) { /* all-same-size */ - element_size = request2size(*sizes); - contents_size = n_elements * element_size; - } - else { /* add up all the sizes */ - element_size = 0; - contents_size = 0; - for (i = 0; i != n_elements; ++i) - contents_size += request2size(sizes[i]); - } - - size = contents_size + array_size; - - /* - Allocate the aggregate chunk. First disable direct-mmapping so - malloc won't use it, since we would not be able to later - free/realloc space internal to a segregated mmap region. - */ - was_enabled = use_mmap(m); - disable_mmap(m); - mem = internal_malloc(m, size - CHUNK_OVERHEAD); - if (was_enabled) - enable_mmap(m); - if (mem == 0) - return 0; - - if (PREACTION(m)) return 0; - p = mem2chunk(mem); - remainder_size = chunksize(p); - - assert(!is_mmapped(p)); - - if (opts & 0x2) { /* optionally clear the elements */ - memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); - } - - /* If not provided, allocate the pointer array as final part of chunk */ - if (marray == 0) { - size_t array_chunk_size; - array_chunk = chunk_plus_offset(p, contents_size); - array_chunk_size = remainder_size - contents_size; - marray = (void**) (chunk2mem(array_chunk)); - set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); - remainder_size = contents_size; - } - - /* split out elements */ - for (i = 0; ; ++i) { - marray[i] = chunk2mem(p); - if (i != n_elements-1) { - if (element_size != 0) - size = element_size; - else - size = request2size(sizes[i]); - remainder_size -= size; - set_size_and_pinuse_of_inuse_chunk(m, p, size); - p = chunk_plus_offset(p, size); - } - else { /* the final element absorbs any overallocation slop */ - set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); - break; - } - } - -#if DEBUG - if (marray != chunks) { - /* final element must have exactly exhausted chunk */ - if (element_size != 0) { - assert(remainder_size == element_size); - } - else { - assert(remainder_size == request2size(sizes[i])); - } - check_inuse_chunk(m, mem2chunk(marray)); - } - for (i = 0; i != n_elements; ++i) - check_inuse_chunk(m, mem2chunk(marray[i])); - -#endif /* DEBUG */ - - POSTACTION(m); - return marray; -} - - -/* -------------------------- public routines ---------------------------- */ - -#if !ONLY_MSPACES - -void* dlmalloc(size_t bytes) { - /* - Basic algorithm: - If a small request (< 256 bytes minus per-chunk overhead): - 1. If one exists, use a remainderless chunk in associated smallbin. - (Remainderless means that there are too few excess bytes to - represent as a chunk.) - 2. If it is big enough, use the dv chunk, which is normally the - chunk adjacent to the one used for the most recent small request. - 3. If one exists, split the smallest available chunk in a bin, - saving remainder in dv. - 4. If it is big enough, use the top chunk. - 5. If available, get memory from system and use it - Otherwise, for a large request: - 1. Find the smallest available binned chunk that fits, and use it - if it is better fitting than dv chunk, splitting if necessary. - 2. If better fitting than any binned chunk, use the dv chunk. - 3. If it is big enough, use the top chunk. - 4. If request size >= mmap threshold, try to directly mmap this chunk. - 5. If available, get memory from system and use it - - The ugly goto's here ensure that postaction occurs along all paths. - */ - - if (!PREACTION(gm)) { - void* mem; - size_t nb; - if (bytes <= MAX_SMALL_REQUEST) { - bindex_t idx; - binmap_t smallbits; - nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); - idx = small_index(nb); - smallbits = gm->smallmap >> idx; - - if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ - mchunkptr b, p; - idx += ~smallbits & 1; /* Uses next bin if idx empty */ - b = smallbin_at(gm, idx); - p = b->fd; - assert(chunksize(p) == small_index2size(idx)); - unlink_first_small_chunk(gm, b, p, idx); - set_inuse_and_pinuse(gm, p, small_index2size(idx)); - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (nb > gm->dvsize) { - if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ - mchunkptr b, p, r; - size_t rsize; - bindex_t i; - binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - b = smallbin_at(gm, i); - p = b->fd; - assert(chunksize(p) == small_index2size(i)); - unlink_first_small_chunk(gm, b, p, i); - rsize = small_index2size(i) - nb; - /* Fit here cannot be remainderless if 4byte sizes */ - if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(gm, p, small_index2size(i)); - else { - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - r = chunk_plus_offset(p, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(gm, r, rsize); - } - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - } - } - else if (bytes >= MAX_REQUEST) - nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ - else { - nb = pad_request(bytes); - if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - } - - if (nb <= gm->dvsize) { - size_t rsize = gm->dvsize - nb; - mchunkptr p = gm->dv; - if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ - mchunkptr r = gm->dv = chunk_plus_offset(p, nb); - gm->dvsize = rsize; - set_size_and_pinuse_of_free_chunk(r, rsize); - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - } - else { /* exhaust dv */ - size_t dvs = gm->dvsize; - gm->dvsize = 0; - gm->dv = 0; - set_inuse_and_pinuse(gm, p, dvs); - } - mem = chunk2mem(p); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - else if (nb < gm->topsize) { /* Split top */ - size_t rsize = gm->topsize -= nb; - mchunkptr p = gm->top; - mchunkptr r = gm->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(gm, p, nb); - mem = chunk2mem(p); - check_top_chunk(gm, gm->top); - check_malloced_chunk(gm, mem, nb); - goto postaction; - } - - mem = sys_alloc(gm, nb); - - postaction: - POSTACTION(gm); - return mem; - } - - return 0; -} - -void dlfree(void* mem) { - /* - Consolidate freed chunks with preceding or succeeding bordering - free chunks, if they exist, and then place in a bin. Intermixed - with special cases for top, dv, mmapped chunks, and usage errors. - */ - - if (mem != 0) { - mchunkptr p = mem2chunk(mem); -#if FOOTERS - mstate fm = get_mstate_for(p); - if (!ok_magic(fm)) { - USAGE_ERROR_ACTION(fm, p); - return; - } -#else /* FOOTERS */ -#define fm gm -#endif /* FOOTERS */ - if (!PREACTION(fm)) { - check_inuse_chunk(fm, p); - if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { - size_t psize = chunksize(p); - mchunkptr next = chunk_plus_offset(p, psize); - if (!pinuse(p)) { - size_t prevsize = p->prev_foot; - if ((prevsize & IS_MMAPPED_BIT) != 0) { - prevsize &= ~IS_MMAPPED_BIT; - psize += prevsize + MMAP_FOOT_PAD; - if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) - fm->footprint -= psize; - goto postaction; - } - else { - mchunkptr prev = chunk_minus_offset(p, prevsize); - psize += prevsize; - p = prev; - if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ - if (p != fm->dv) { - unlink_chunk(fm, p, prevsize); - } - else if ((next->head & INUSE_BITS) == INUSE_BITS) { - fm->dvsize = psize; - set_free_with_pinuse(p, psize, next); - goto postaction; - } - } - else - goto erroraction; - } - } - - if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { - if (!cinuse(next)) { /* consolidate forward */ - if (next == fm->top) { - size_t tsize = fm->topsize += psize; - fm->top = p; - p->head = tsize | PINUSE_BIT; - if (p == fm->dv) { - fm->dv = 0; - fm->dvsize = 0; - } - if (should_trim(fm, tsize)) - sys_trim(fm, 0); - goto postaction; - } - else if (next == fm->dv) { - size_t dsize = fm->dvsize += psize; - fm->dv = p; - set_size_and_pinuse_of_free_chunk(p, dsize); - goto postaction; - } - else { - size_t nsize = chunksize(next); - psize += nsize; - unlink_chunk(fm, next, nsize); - set_size_and_pinuse_of_free_chunk(p, psize); - if (p == fm->dv) { - fm->dvsize = psize; - goto postaction; - } - } - } - else - set_free_with_pinuse(p, psize, next); - insert_chunk(fm, p, psize); - check_free_chunk(fm, p); - goto postaction; - } - } - erroraction: - USAGE_ERROR_ACTION(fm, p); - postaction: - POSTACTION(fm); - } - } -#if !FOOTERS -#undef fm -#endif /* FOOTERS */ -} - -void* dlcalloc(size_t n_elements, size_t elem_size) { - void* mem; - size_t req = 0; - if (n_elements != 0) { - req = n_elements * elem_size; - if (((n_elements | elem_size) & ~(size_t)0xffff) && - (req / n_elements != elem_size)) - req = MAX_SIZE_T; /* force downstream failure on overflow */ - } - mem = dlmalloc(req); - if (mem != 0 && calloc_must_clear(mem2chunk(mem))) - memset(mem, 0, req); - return mem; -} - -void* dlrealloc(void* oldmem, size_t bytes) { - if (oldmem == 0) - return dlmalloc(bytes); -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0) { - dlfree(oldmem); - return 0; - } -#endif /* REALLOC_ZERO_BYTES_FREES */ - else { -#if ! FOOTERS - mstate m = gm; -#else /* FOOTERS */ - mstate m = get_mstate_for(mem2chunk(oldmem)); - if (!ok_magic(m)) { - USAGE_ERROR_ACTION(m, oldmem); - return 0; - } -#endif /* FOOTERS */ - return internal_realloc(m, oldmem, bytes); - } -} - -void* dlmemalign(size_t alignment, size_t bytes) { - return internal_memalign(gm, alignment, bytes); -} - -void** dlindependent_calloc(size_t n_elements, size_t elem_size, - void* chunks[]) { - size_t sz = elem_size; /* serves as 1-element array */ - return ialloc(gm, n_elements, &sz, 3, chunks); -} - -void** dlindependent_comalloc(size_t n_elements, size_t sizes[], - void* chunks[]) { - return ialloc(gm, n_elements, sizes, 0, chunks); -} - -void* dlvalloc(size_t bytes) { - size_t pagesz; - init_mparams(); - pagesz = mparams.page_size; - return dlmemalign(pagesz, bytes); -} - -void* dlpvalloc(size_t bytes) { - size_t pagesz; - init_mparams(); - pagesz = mparams.page_size; - return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); -} - -int dlmalloc_trim(size_t pad) { - int result = 0; - if (!PREACTION(gm)) { - result = sys_trim(gm, pad); - POSTACTION(gm); - } - return result; -} - -size_t dlmalloc_footprint(void) { - return gm->footprint; -} - -size_t dlmalloc_max_footprint(void) { - return gm->max_footprint; -} - -#if !NO_MALLINFO -struct mallinfo dlmallinfo(void) { - return internal_mallinfo(gm); -} -#endif /* NO_MALLINFO */ - -void dlmalloc_stats() { - internal_malloc_stats(gm); -} - -size_t dlmalloc_usable_size(void* mem) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); - if (cinuse(p)) - return chunksize(p) - overhead_for(p); - } - return 0; -} - -int dlmallopt(int param_number, int value) { - return change_mparam(param_number, value); -} - -#endif /* !ONLY_MSPACES */ - -/* ----------------------------- user mspaces ---------------------------- */ - -#if MSPACES - -static mstate init_user_mstate(char* tbase, size_t tsize) { - size_t msize = pad_request(sizeof(struct malloc_state)); - mchunkptr mn; - mchunkptr msp = align_as_chunk(tbase); - mstate m = (mstate)(chunk2mem(msp)); - memset(m, 0, msize); - INITIAL_LOCK(&m->mutex); - msp->head = (msize|PINUSE_BIT|CINUSE_BIT); - m->seg.base = m->least_addr = tbase; - m->seg.size = m->footprint = m->max_footprint = tsize; - m->magic = mparams.magic; - m->mflags = mparams.default_mflags; - disable_contiguous(m); - init_bins(m); - mn = next_chunk(mem2chunk(m)); - init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); - check_top_chunk(m, m->top); - return m; -} - -mspace create_mspace(size_t capacity, int locked) { - mstate m = 0; - size_t msize = pad_request(sizeof(struct malloc_state)); - init_mparams(); /* Ensure pagesize etc initialized */ - - if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { - size_t rs = ((capacity == 0)? mparams.granularity : - (capacity + TOP_FOOT_SIZE + msize)); - size_t tsize = granularity_align(rs); - char* tbase = (char*)(CALL_MMAP(tsize)); - if (tbase != CMFAIL) { - m = init_user_mstate(tbase, tsize); - set_segment_flags(&m->seg, IS_MMAPPED_BIT); - set_lock(m, locked); - } - } - return (mspace)m; -} - -mspace create_mspace_with_base(void* base, size_t capacity, int locked) { - mstate m = 0; - size_t msize = pad_request(sizeof(struct malloc_state)); - init_mparams(); /* Ensure pagesize etc initialized */ - - if (capacity > msize + TOP_FOOT_SIZE && - capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { - m = init_user_mstate((char*)base, capacity); - set_segment_flags(&m->seg, EXTERN_BIT); - set_lock(m, locked); - } - return (mspace)m; -} - -size_t destroy_mspace(mspace msp) { - size_t freed = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - msegmentptr sp = &ms->seg; - while (sp != 0) { - char* base = sp->base; - size_t size = sp->size; - flag_t flag = get_segment_flags(sp); - sp = sp->next; - if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) && - CALL_MUNMAP(base, size) == 0) - freed += size; - } - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return freed; -} - -/* - mspace versions of routines are near-clones of the global - versions. This is not so nice but better than the alternatives. -*/ - - -void* mspace_malloc(mspace msp, size_t bytes) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - if (!PREACTION(ms)) { - void* mem; - size_t nb; - if (bytes <= MAX_SMALL_REQUEST) { - bindex_t idx; - binmap_t smallbits; - nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); - idx = small_index(nb); - smallbits = ms->smallmap >> idx; - - if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ - mchunkptr b, p; - idx += ~smallbits & 1; /* Uses next bin if idx empty */ - b = smallbin_at(ms, idx); - p = b->fd; - assert(chunksize(p) == small_index2size(idx)); - unlink_first_small_chunk(ms, b, p, idx); - set_inuse_and_pinuse(ms, p, small_index2size(idx)); - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (nb > ms->dvsize) { - if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ - mchunkptr b, p, r; - size_t rsize; - bindex_t i; - binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); - binmap_t leastbit = least_bit(leftbits); - compute_bit2idx(leastbit, i); - b = smallbin_at(ms, i); - p = b->fd; - assert(chunksize(p) == small_index2size(i)); - unlink_first_small_chunk(ms, b, p, i); - rsize = small_index2size(i) - nb; - /* Fit here cannot be remainderless if 4byte sizes */ - if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) - set_inuse_and_pinuse(ms, p, small_index2size(i)); - else { - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - r = chunk_plus_offset(p, nb); - set_size_and_pinuse_of_free_chunk(r, rsize); - replace_dv(ms, r, rsize); - } - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - } - } - else if (bytes >= MAX_REQUEST) - nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ - else { - nb = pad_request(bytes); - if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - } - - if (nb <= ms->dvsize) { - size_t rsize = ms->dvsize - nb; - mchunkptr p = ms->dv; - if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ - mchunkptr r = ms->dv = chunk_plus_offset(p, nb); - ms->dvsize = rsize; - set_size_and_pinuse_of_free_chunk(r, rsize); - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - } - else { /* exhaust dv */ - size_t dvs = ms->dvsize; - ms->dvsize = 0; - ms->dv = 0; - set_inuse_and_pinuse(ms, p, dvs); - } - mem = chunk2mem(p); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - else if (nb < ms->topsize) { /* Split top */ - size_t rsize = ms->topsize -= nb; - mchunkptr p = ms->top; - mchunkptr r = ms->top = chunk_plus_offset(p, nb); - r->head = rsize | PINUSE_BIT; - set_size_and_pinuse_of_inuse_chunk(ms, p, nb); - mem = chunk2mem(p); - check_top_chunk(ms, ms->top); - check_malloced_chunk(ms, mem, nb); - goto postaction; - } - - mem = sys_alloc(ms, nb); - - postaction: - POSTACTION(ms); - return mem; - } - - return 0; -} - -void mspace_free(mspace msp, void* mem) { - if (mem != 0) { - mchunkptr p = mem2chunk(mem); -#if FOOTERS - mstate fm = get_mstate_for(p); -#else /* FOOTERS */ - mstate fm = (mstate)msp; -#endif /* FOOTERS */ - if (!ok_magic(fm)) { - USAGE_ERROR_ACTION(fm, p); - return; - } - if (!PREACTION(fm)) { - check_inuse_chunk(fm, p); - if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { - size_t psize = chunksize(p); - mchunkptr next = chunk_plus_offset(p, psize); - if (!pinuse(p)) { - size_t prevsize = p->prev_foot; - if ((prevsize & IS_MMAPPED_BIT) != 0) { - prevsize &= ~IS_MMAPPED_BIT; - psize += prevsize + MMAP_FOOT_PAD; - if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) - fm->footprint -= psize; - goto postaction; - } - else { - mchunkptr prev = chunk_minus_offset(p, prevsize); - psize += prevsize; - p = prev; - if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ - if (p != fm->dv) { - unlink_chunk(fm, p, prevsize); - } - else if ((next->head & INUSE_BITS) == INUSE_BITS) { - fm->dvsize = psize; - set_free_with_pinuse(p, psize, next); - goto postaction; - } - } - else - goto erroraction; - } - } - - if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { - if (!cinuse(next)) { /* consolidate forward */ - if (next == fm->top) { - size_t tsize = fm->topsize += psize; - fm->top = p; - p->head = tsize | PINUSE_BIT; - if (p == fm->dv) { - fm->dv = 0; - fm->dvsize = 0; - } - if (should_trim(fm, tsize)) - sys_trim(fm, 0); - goto postaction; - } - else if (next == fm->dv) { - size_t dsize = fm->dvsize += psize; - fm->dv = p; - set_size_and_pinuse_of_free_chunk(p, dsize); - goto postaction; - } - else { - size_t nsize = chunksize(next); - psize += nsize; - unlink_chunk(fm, next, nsize); - set_size_and_pinuse_of_free_chunk(p, psize); - if (p == fm->dv) { - fm->dvsize = psize; - goto postaction; - } - } - } - else - set_free_with_pinuse(p, psize, next); - insert_chunk(fm, p, psize); - check_free_chunk(fm, p); - goto postaction; - } - } - erroraction: - USAGE_ERROR_ACTION(fm, p); - postaction: - POSTACTION(fm); - } - } -} - -void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { - void* mem; - size_t req = 0; - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - if (n_elements != 0) { - req = n_elements * elem_size; - if (((n_elements | elem_size) & ~(size_t)0xffff) && - (req / n_elements != elem_size)) - req = MAX_SIZE_T; /* force downstream failure on overflow */ - } - mem = internal_malloc(ms, req); - if (mem != 0 && calloc_must_clear(mem2chunk(mem))) - memset(mem, 0, req); - return mem; -} - -void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { - if (oldmem == 0) - return mspace_malloc(msp, bytes); -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0) { - mspace_free(msp, oldmem); - return 0; - } -#endif /* REALLOC_ZERO_BYTES_FREES */ - else { -#if FOOTERS - mchunkptr p = mem2chunk(oldmem); - mstate ms = get_mstate_for(p); -#else /* FOOTERS */ - mstate ms = (mstate)msp; -#endif /* FOOTERS */ - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return internal_realloc(ms, oldmem, bytes); - } -} - -void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return internal_memalign(ms, alignment, bytes); -} - -void** mspace_independent_calloc(mspace msp, size_t n_elements, - size_t elem_size, void* chunks[]) { - size_t sz = elem_size; /* serves as 1-element array */ - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return ialloc(ms, n_elements, &sz, 3, chunks); -} - -void** mspace_independent_comalloc(mspace msp, size_t n_elements, - size_t sizes[], void* chunks[]) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - return 0; - } - return ialloc(ms, n_elements, sizes, 0, chunks); -} - -int mspace_trim(mspace msp, size_t pad) { - int result = 0; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - if (!PREACTION(ms)) { - result = sys_trim(ms, pad); - POSTACTION(ms); - } - } - else { - USAGE_ERROR_ACTION(ms,ms); - } - return result; -} - -void mspace_malloc_stats(mspace msp) { - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - internal_malloc_stats(ms); - } - else { - USAGE_ERROR_ACTION(ms,ms); - } -} - -size_t mspace_footprint(mspace msp) { - size_t result; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - result = ms->footprint; - } - USAGE_ERROR_ACTION(ms,ms); - return result; -} - - -size_t mspace_max_footprint(mspace msp) { - size_t result; - mstate ms = (mstate)msp; - if (ok_magic(ms)) { - result = ms->max_footprint; - } - USAGE_ERROR_ACTION(ms,ms); - return result; -} - - -#if !NO_MALLINFO -struct mallinfo mspace_mallinfo(mspace msp) { - mstate ms = (mstate)msp; - if (!ok_magic(ms)) { - USAGE_ERROR_ACTION(ms,ms); - } - return internal_mallinfo(ms); -} -#endif /* NO_MALLINFO */ - -int mspace_mallopt(int param_number, int value) { - return change_mparam(param_number, value); -} - -#endif /* MSPACES */ - -/* -------------------- Alternative MORECORE functions ------------------- */ - -/* - Guidelines for creating a custom version of MORECORE: - - * For best performance, MORECORE should allocate in multiples of pagesize. - * MORECORE may allocate more memory than requested. (Or even less, - but this will usually result in a malloc failure.) - * MORECORE must not allocate memory when given argument zero, but - instead return one past the end address of memory from previous - nonzero call. - * For best performance, consecutive calls to MORECORE with positive - arguments should return increasing addresses, indicating that - space has been contiguously extended. - * Even though consecutive calls to MORECORE need not return contiguous - addresses, it must be OK for malloc'ed chunks to span multiple - regions in those cases where they do happen to be contiguous. - * MORECORE need not handle negative arguments -- it may instead - just return MFAIL when given negative arguments. - Negative arguments are always multiples of pagesize. MORECORE - must not misinterpret negative args as large positive unsigned - args. You can suppress all such calls from even occurring by defining - MORECORE_CANNOT_TRIM, - - As an example alternative MORECORE, here is a custom allocator - kindly contributed for pre-OSX macOS. It uses virtually but not - necessarily physically contiguous non-paged memory (locked in, - present and won't get swapped out). You can use it by uncommenting - this section, adding some #includes, and setting up the appropriate - defines above: - - #define MORECORE osMoreCore - - There is also a shutdown routine that should somehow be called for - cleanup upon program exit. - - #define MAX_POOL_ENTRIES 100 - #define MINIMUM_MORECORE_SIZE (64 * 1024U) - static int next_os_pool; - void *our_os_pools[MAX_POOL_ENTRIES]; - - void *osMoreCore(int size) - { - void *ptr = 0; - static void *sbrk_top = 0; - - if (size > 0) - { - if (size < MINIMUM_MORECORE_SIZE) - size = MINIMUM_MORECORE_SIZE; - if (CurrentExecutionLevel() == kTaskLevel) - ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); - if (ptr == 0) - { - return (void *) MFAIL; - } - // save ptrs so they can be freed during cleanup - our_os_pools[next_os_pool] = ptr; - next_os_pool++; - ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); - sbrk_top = (char *) ptr + size; - return ptr; - } - else if (size < 0) - { - // we don't currently support shrink behavior - return (void *) MFAIL; - } - else - { - return sbrk_top; - } - } - - // cleanup any allocated memory pools - // called as last thing before shutting down driver - - void osCleanupMem(void) - { - void **ptr; - - for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) - if (*ptr) - { - PoolDeallocate(*ptr); - *ptr = 0; - } - } - -*/ - - -/* ----------------------------------------------------------------------- -History: - V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) - * Add max_footprint functions - * Ensure all appropriate literals are size_t - * Fix conditional compilation problem for some #define settings - * Avoid concatenating segments with the one provided - in create_mspace_with_base - * Rename some variables to avoid compiler shadowing warnings - * Use explicit lock initialization. - * Better handling of sbrk interference. - * Simplify and fix segment insertion, trimming and mspace_destroy - * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x - * Thanks especially to Dennis Flanagan for help on these. - - V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) - * Fix memalign brace error. - - V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) - * Fix improper #endif nesting in C++ - * Add explicit casts needed for C++ - - V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) - * Use trees for large bins - * Support mspaces - * Use segments to unify sbrk-based and mmap-based system allocation, - removing need for emulation on most platforms without sbrk. - * Default safety checks - * Optional footer checks. Thanks to William Robertson for the idea. - * Internal code refactoring - * Incorporate suggestions and platform-specific changes. - Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, - Aaron Bachmann, Emery Berger, and others. - * Speed up non-fastbin processing enough to remove fastbins. - * Remove useless cfree() to avoid conflicts with other apps. - * Remove internal memcpy, memset. Compilers handle builtins better. - * Remove some options that no one ever used and rename others. - - V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) - * Fix malloc_state bitmap array misdeclaration - - V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) - * Allow tuning of FIRST_SORTED_BIN_SIZE - * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. - * Better detection and support for non-contiguousness of MORECORE. - Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger - * Bypass most of malloc if no frees. Thanks To Emery Berger. - * Fix freeing of old top non-contiguous chunk im sysmalloc. - * Raised default trim and map thresholds to 256K. - * Fix mmap-related #defines. Thanks to Lubos Lunak. - * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. - * Branch-free bin calculation - * Default trim and mmap thresholds now 256K. - - V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) - * Introduce independent_comalloc and independent_calloc. - Thanks to Michael Pachos for motivation and help. - * Make optional .h file available - * Allow > 2GB requests on 32bit systems. - * new WIN32 sbrk, mmap, munmap, lock code from . - Thanks also to Andreas Mueller , - and Anonymous. - * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for - helping test this.) - * memalign: check alignment arg - * realloc: don't try to shift chunks backwards, since this - leads to more fragmentation in some programs and doesn't - seem to help in any others. - * Collect all cases in malloc requiring system memory into sysmalloc - * Use mmap as backup to sbrk - * Place all internal state in malloc_state - * Introduce fastbins (although similar to 2.5.1) - * Many minor tunings and cosmetic improvements - * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK - * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS - Thanks to Tony E. Bennett and others. - * Include errno.h to support default failure action. - - V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) - * return null for negative arguments - * Added Several WIN32 cleanups from Martin C. Fong - * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' - (e.g. WIN32 platforms) - * Cleanup header file inclusion for WIN32 platforms - * Cleanup code to avoid Microsoft Visual C++ compiler complaints - * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing - memory allocation routines - * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) - * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to - usage of 'assert' in non-WIN32 code - * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to - avoid infinite loop - * Always call 'fREe()' rather than 'free()' - - V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) - * Fixed ordering problem with boundary-stamping - - V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) - * Added pvalloc, as recommended by H.J. Liu - * Added 64bit pointer support mainly from Wolfram Gloger - * Added anonymously donated WIN32 sbrk emulation - * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen - * malloc_extend_top: fix mask error that caused wastage after - foreign sbrks - * Add linux mremap support code from HJ Liu - - V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) - * Integrated most documentation with the code. - * Add support for mmap, with help from - Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Use last_remainder in more cases. - * Pack bins using idea from colin@nyx10.cs.du.edu - * Use ordered bins instead of best-fit threshold - * Eliminate block-local decls to simplify tracing and debugging. - * Support another case of realloc via move into top - * Fix error occurring when initial sbrk_base not word-aligned. - * Rely on page size for units instead of SBRK_UNIT to - avoid surprises about sbrk alignment conventions. - * Add mallinfo, mallopt. Thanks to Raymond Nijssen - (raymond@es.ele.tue.nl) for the suggestion. - * Add `pad' argument to malloc_trim and top_pad mallopt parameter. - * More precautions for cases where other routines call sbrk, - courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Added macros etc., allowing use in linux libc from - H.J. Lu (hjl@gnu.ai.mit.edu) - * Inverted this history list - - V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) - * Re-tuned and fixed to behave more nicely with V2.6.0 changes. - * Removed all preallocation code since under current scheme - the work required to undo bad preallocations exceeds - the work saved in good cases for most test programs. - * No longer use return list or unconsolidated bins since - no scheme using them consistently outperforms those that don't - given above changes. - * Use best fit for very large chunks to prevent some worst-cases. - * Added some support for debugging - - V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) - * Removed footers when chunks are in use. Thanks to - Paul Wilson (wilson@cs.texas.edu) for the suggestion. - - V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) - * Added malloc_trim, with help from Wolfram Gloger - (wmglo@Dent.MED.Uni-Muenchen.DE). - - V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) - - V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) - * realloc: try to expand in both directions - * malloc: swap order of clean-bin strategy; - * realloc: only conditionally expand backwards - * Try not to scavenge used bins - * Use bin counts as a guide to preallocation - * Occasionally bin return list chunks in first scan - * Add a few optimizations from colin@nyx10.cs.du.edu - - V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) - * faster bin computation & slightly different binning - * merged all consolidations to one part of malloc proper - (eliminating old malloc_find_space & malloc_clean_bin) - * Scan 2 returns chunks (not just 1) - * Propagate failure in realloc if malloc returns 0 - * Add stuff to allow compilation on non-ANSI compilers - from kpv@research.att.com - - V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) - * removed potential for odd address access in prev_chunk - * removed dependency on getpagesize.h - * misc cosmetics and a bit more internal documentation - * anticosmetics: mangled names in macros to evade debugger strangeness - * tested on sparc, hp-700, dec-mips, rs6000 - with gcc & native cc (hp, dec only) allowing - Detlefs & Zorn comparison study (in SIGPLAN Notices.) - - Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) - * Based loosely on libg++-1.2X malloc. (It retains some of the overall - structure of old version, but most details differ.) - -*/ diff --git a/llgo/third_party/gofrontend/libffi/src/frv/eabi.S b/llgo/third_party/gofrontend/libffi/src/frv/eabi.S deleted file mode 100644 index 379ea4bb0a743d6e5d249b56880f638594a1f758..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/frv/eabi.S +++ /dev/null @@ -1,128 +0,0 @@ -/* ----------------------------------------------------------------------- - eabi.S - Copyright (c) 2004 Anthony Green - - FR-V Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - .globl ffi_prep_args_EABI - - .text - .p2align 4 - .globl ffi_call_EABI - .type ffi_call_EABI, @function - - # gr8 : ffi_prep_args - # gr9 : &ecif - # gr10: cif->bytes - # gr11: fig->flags - # gr12: ecif.rvalue - # gr13: fn - -ffi_call_EABI: - addi sp, #-80, sp - sti fp, @(sp, #24) - addi sp, #24, fp - movsg lr, gr5 - - /* Make room for the new arguments. */ - /* subi sp, fp, gr10 */ - - /* Store return address and incoming args on stack. */ - sti gr5, @(fp, #8) - sti gr8, @(fp, #-4) - sti gr9, @(fp, #-8) - sti gr10, @(fp, #-12) - sti gr11, @(fp, #-16) - sti gr12, @(fp, #-20) - sti gr13, @(fp, #-24) - - sub sp, gr10, sp - - /* Call ffi_prep_args. */ - ldi @(fp, #-4), gr4 - addi sp, #0, gr8 - ldi @(fp, #-8), gr9 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif - - /* ffi_prep_args returns the new stack pointer. */ - mov gr8, gr4 - - ldi @(sp, #0), gr8 - ldi @(sp, #4), gr9 - ldi @(sp, #8), gr10 - ldi @(sp, #12), gr11 - ldi @(sp, #16), gr12 - ldi @(sp, #20), gr13 - - /* Always copy the return value pointer into the hidden - parameter register. This is only strictly necessary - when we're returning an aggregate type, but it doesn't - hurt to do this all the time, and it saves a branch. */ - ldi @(fp, #-20), gr3 - - /* Use the ffi_prep_args return value for the new sp. */ - mov gr4, sp - - /* Call the target function. */ - ldi @(fp, -24), gr4 -#ifdef __FRV_FDPIC__ - ldd @(gr4, gr0), gr14 - calll @(gr14, gr0) -#else - calll @(gr4, gr0) -#endif - - /* Store the result. */ - ldi @(fp, #-16), gr10 /* fig->flags */ - ldi @(fp, #-20), gr4 /* ecif.rvalue */ - - /* Is the return value stored in two registers? */ - cmpi gr10, #8, icc0 - bne icc0, 0, .L2 - /* Yes, save them. */ - sti gr8, @(gr4, #0) - sti gr9, @(gr4, #4) - bra .L3 -.L2: - /* Is the return value a structure? */ - cmpi gr10, #-1, icc0 - beq icc0, 0, .L3 - /* No, save a 4 byte return value. */ - sti gr8, @(gr4, #0) -.L3: - - /* Restore the stack, and return. */ - ldi @(fp, 8), gr5 - ld @(fp, gr0), fp - addi sp,#80,sp - jmpl @(gr5,gr0) - .size ffi_call_EABI, .-ffi_call_EABI - diff --git a/llgo/third_party/gofrontend/libffi/src/frv/ffi.c b/llgo/third_party/gofrontend/libffi/src/frv/ffi.c deleted file mode 100644 index 5698c89c351f8b9bfc013d34e9b49ad3ef703f69..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/frv/ffi.c +++ /dev/null @@ -1,292 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2004 Anthony Green - Copyright (C) 2007 Free Software Foundation, Inc. - Copyright (C) 2008 Red Hat, Inc. - - FR-V Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void *ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - register int count = 0; - - p_argv = ecif->avalue; - argp = stack; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); - i--, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - - if ((*p_arg)->type == FFI_TYPE_STRUCT) - { - z = sizeof(void*); - *(void **) argp = *p_argv; - } - /* if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (count > 24) - { - // This is going on the stack. Turn it into a double. - *(double *) argp = (double) *(float*)(* p_argv); - z = sizeof(double); - } - else - *(void **) argp = *(void **)(* p_argv); - } */ - else if (z < sizeof(int)) - { - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - default: - FFI_ASSERT(0); - } - } - else if (z == sizeof(int)) - { - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - } - else - { - memcpy(argp, *p_argv, z); - } - p_argv++; - argp += z; - count += z; - } - - return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - if (cif->rtype->type == FFI_TYPE_STRUCT) - cif->flags = -1; - else - cif->flags = cif->rtype->size; - - cif->bytes = ALIGN (cif->bytes, 8); - - return FFI_OK; -} - -extern void ffi_call_EABI(void *(*)(char *, extended_cif *), - extended_cif *, - unsigned, unsigned, - unsigned *, - void (*fn)(void)); - -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - - switch (cif->abi) - { - case FFI_EABI: - ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - default: - FFI_ASSERT(0); - break; - } -} - -void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, - unsigned arg4, unsigned arg5, unsigned arg6) -{ - /* This function is called by a trampoline. The trampoline stows a - pointer to the ffi_closure object in gr7. We must save this - pointer in a place that will persist while we do our work. */ - register ffi_closure *creg __asm__ ("gr7"); - ffi_closure *closure = creg; - - /* Arguments that don't fit in registers are found on the stack - at a fixed offset above the current frame pointer. */ - register char *frame_pointer __asm__ ("fp"); - char *stack_args = frame_pointer + 16; - - /* Lay the register arguments down in a continuous chunk of memory. */ - unsigned register_args[6] = - { arg1, arg2, arg3, arg4, arg5, arg6 }; - - ffi_cif *cif = closure->cif; - ffi_type **arg_types = cif->arg_types; - void **avalue = alloca (cif->nargs * sizeof(void *)); - char *ptr = (char *) register_args; - int i; - - /* Find the address of each argument. */ - for (i = 0; i < cif->nargs; i++) - { - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = ptr + 3; - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = ptr + 2; - break; - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - avalue[i] = ptr; - break; - case FFI_TYPE_STRUCT: - avalue[i] = *(void**)ptr; - break; - default: - /* This is an 8-byte value. */ - avalue[i] = ptr; - ptr += 4; - break; - } - ptr += 4; - - /* If we've handled more arguments than fit in registers, - start looking at the those passed on the stack. */ - if (ptr == ((char *)register_args + (6*4))) - ptr = stack_args; - } - - /* Invoke the closure. */ - if (cif->rtype->type == FFI_TYPE_STRUCT) - { - /* The caller allocates space for the return structure, and - passes a pointer to this space in gr3. Use this value directly - as the return value. */ - register void *return_struct_ptr __asm__("gr3"); - (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); - } - else - { - /* Allocate space for the return value and call the function. */ - long long rvalue; - (closure->fun) (cif, &rvalue, avalue, closure->user_data); - - /* Functions return 4-byte or smaller results in gr8. 8-byte - values also use gr9. We fill the both, even for small return - values, just to avoid a branch. */ - asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); - asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); - } -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - unsigned long fn = (long) ffi_closure_eabi; - unsigned long cls = (long) codeloc; -#ifdef __FRV_FDPIC__ - register void *got __asm__("gr15"); -#endif - int i; - - fn = (unsigned long) ffi_closure_eabi; - -#ifdef __FRV_FDPIC__ - tramp[0] = &((unsigned int *)codeloc)[2]; - tramp[1] = got; - tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ - tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ - tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ - tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ - tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */ - tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */ -#else - tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ - tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ - tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ - tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ - tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ -#endif - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - /* Cache flushing. */ - for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) - __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), - "r" (codeloc)); - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/frv/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/frv/ffitarget.h deleted file mode 100644 index d42540e53d3ad65a474952d3f14e1d186babd0b1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/frv/ffitarget.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2004 Red Hat, Inc. - Target configuration macros for FR-V - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_EABI, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_EABI -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 - -#ifdef __FRV_FDPIC__ -/* Trampolines are 8 4-byte instructions long. */ -#define FFI_TRAMPOLINE_SIZE (8*4) -#else -/* Trampolines are 5 4-byte instructions long. */ -#define FFI_TRAMPOLINE_SIZE (5*4) -#endif - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/ia64/ffi.c b/llgo/third_party/gofrontend/libffi/src/ia64/ffi.c deleted file mode 100644 index b77a836ddcf7d9c16bbb3bc386d78536a32f973e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/ia64/ffi.c +++ /dev/null @@ -1,586 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2007, 2008, 2012 Red Hat, Inc. - Copyright (c) 2000 Hewlett Packard Company - Copyright (c) 2011 Anthony Green - - IA64 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include -#include - -#include "ia64_flags.h" - -/* A 64-bit pointer value. In LP64 mode, this is effectively a plain - pointer. In ILP32 mode, it's a pointer that's been extended to - 64 bits by "addp4". */ -typedef void *PTR64 __attribute__((mode(DI))); - -/* Memory image of fp register contents. This is the implementation - specific format used by ldf.fill/stf.spill. All we care about is - that it wants a 16 byte aligned slot. */ -typedef struct -{ - UINT64 x[2] __attribute__((aligned(16))); -} fpreg; - - -/* The stack layout given to ffi_call_unix and ffi_closure_unix_inner. */ - -struct ia64_args -{ - fpreg fp_regs[8]; /* Contents of 8 fp arg registers. */ - UINT64 gp_regs[8]; /* Contents of 8 gp arg registers. */ - UINT64 other_args[]; /* Arguments passed on stack, variable size. */ -}; - - -/* Adjust ADDR, a pointer to an 8 byte slot, to point to the low LEN bytes. */ - -static inline void * -endian_adjust (void *addr, size_t len) -{ -#ifdef __BIG_ENDIAN__ - return addr + (8 - len); -#else - return addr; -#endif -} - -/* Store VALUE to ADDR in the current cpu implementation's fp spill format. - This is a macro instead of a function, so that it works for all 3 floating - point types without type conversions. Type conversion to long double breaks - the denorm support. */ - -#define stf_spill(addr, value) \ - asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); - -/* Load a value from ADDR, which is in the current cpu implementation's - fp spill format. As above, this must also be a macro. */ - -#define ldf_fill(result, addr) \ - asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); - -/* Return the size of the C type associated with with TYPE. Which will - be one of the FFI_IA64_TYPE_HFA_* values. */ - -static size_t -hfa_type_size (int type) -{ - switch (type) - { - case FFI_IA64_TYPE_HFA_FLOAT: - return sizeof(float); - case FFI_IA64_TYPE_HFA_DOUBLE: - return sizeof(double); - case FFI_IA64_TYPE_HFA_LDOUBLE: - return sizeof(__float80); - default: - abort (); - } -} - -/* Load from ADDR a value indicated by TYPE. Which will be one of - the FFI_IA64_TYPE_HFA_* values. */ - -static void -hfa_type_load (fpreg *fpaddr, int type, void *addr) -{ - switch (type) - { - case FFI_IA64_TYPE_HFA_FLOAT: - stf_spill (fpaddr, *(float *) addr); - return; - case FFI_IA64_TYPE_HFA_DOUBLE: - stf_spill (fpaddr, *(double *) addr); - return; - case FFI_IA64_TYPE_HFA_LDOUBLE: - stf_spill (fpaddr, *(__float80 *) addr); - return; - default: - abort (); - } -} - -/* Load VALUE into ADDR as indicated by TYPE. Which will be one of - the FFI_IA64_TYPE_HFA_* values. */ - -static void -hfa_type_store (int type, void *addr, fpreg *fpaddr) -{ - switch (type) - { - case FFI_IA64_TYPE_HFA_FLOAT: - { - float result; - ldf_fill (result, fpaddr); - *(float *) addr = result; - break; - } - case FFI_IA64_TYPE_HFA_DOUBLE: - { - double result; - ldf_fill (result, fpaddr); - *(double *) addr = result; - break; - } - case FFI_IA64_TYPE_HFA_LDOUBLE: - { - __float80 result; - ldf_fill (result, fpaddr); - *(__float80 *) addr = result; - break; - } - default: - abort (); - } -} - -/* Is TYPE a struct containing floats, doubles, or extended doubles, - all of the same fp type? If so, return the element type. Return - FFI_TYPE_VOID if not. */ - -static int -hfa_element_type (ffi_type *type, int nested) -{ - int element = FFI_TYPE_VOID; - - switch (type->type) - { - case FFI_TYPE_FLOAT: - /* We want to return VOID for raw floating-point types, but the - synthetic HFA type if we're nested within an aggregate. */ - if (nested) - element = FFI_IA64_TYPE_HFA_FLOAT; - break; - - case FFI_TYPE_DOUBLE: - /* Similarly. */ - if (nested) - element = FFI_IA64_TYPE_HFA_DOUBLE; - break; - - case FFI_TYPE_LONGDOUBLE: - /* Similarly, except that that HFA is true for double extended, - but not quad precision. Both have sizeof == 16, so tell the - difference based on the precision. */ - if (LDBL_MANT_DIG == 64 && nested) - element = FFI_IA64_TYPE_HFA_LDOUBLE; - break; - - case FFI_TYPE_STRUCT: - { - ffi_type **ptr = &type->elements[0]; - - for (ptr = &type->elements[0]; *ptr ; ptr++) - { - int sub_element = hfa_element_type (*ptr, 1); - if (sub_element == FFI_TYPE_VOID) - return FFI_TYPE_VOID; - - if (element == FFI_TYPE_VOID) - element = sub_element; - else if (element != sub_element) - return FFI_TYPE_VOID; - } - } - break; - - default: - return FFI_TYPE_VOID; - } - - return element; -} - - -/* Perform machine dependent cif processing. */ - -ffi_status -ffi_prep_cif_machdep(ffi_cif *cif) -{ - int flags; - - /* Adjust cif->bytes to include space for the bits of the ia64_args frame - that precedes the integer register portion. The estimate that the - generic bits did for the argument space required is good enough for the - integer component. */ - cif->bytes += offsetof(struct ia64_args, gp_regs[0]); - if (cif->bytes < sizeof(struct ia64_args)) - cif->bytes = sizeof(struct ia64_args); - - /* Set the return type flag. */ - flags = cif->rtype->type; - switch (cif->rtype->type) - { - case FFI_TYPE_LONGDOUBLE: - /* Leave FFI_TYPE_LONGDOUBLE as meaning double extended precision, - and encode quad precision as a two-word integer structure. */ - if (LDBL_MANT_DIG != 64) - flags = FFI_IA64_TYPE_SMALL_STRUCT | (16 << 8); - break; - - case FFI_TYPE_STRUCT: - { - size_t size = cif->rtype->size; - int hfa_type = hfa_element_type (cif->rtype, 0); - - if (hfa_type != FFI_TYPE_VOID) - { - size_t nelts = size / hfa_type_size (hfa_type); - if (nelts <= 8) - flags = hfa_type | (size << 8); - } - else - { - if (size <= 32) - flags = FFI_IA64_TYPE_SMALL_STRUCT | (size << 8); - } - } - break; - - default: - break; - } - cif->flags = flags; - - return FFI_OK; -} - -extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64); - -void -ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - struct ia64_args *stack; - long i, avn, gpcount, fpcount; - ffi_type **p_arg; - - FFI_ASSERT (cif->abi == FFI_UNIX); - - /* If we have no spot for a return value, make one. */ - if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID) - rvalue = alloca (cif->rtype->size); - - /* Allocate the stack frame. */ - stack = alloca (cif->bytes); - - gpcount = fpcount = 0; - avn = cif->nargs; - for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - stack->gp_regs[gpcount++] = *(SINT8 *)avalue[i]; - break; - case FFI_TYPE_UINT8: - stack->gp_regs[gpcount++] = *(UINT8 *)avalue[i]; - break; - case FFI_TYPE_SINT16: - stack->gp_regs[gpcount++] = *(SINT16 *)avalue[i]; - break; - case FFI_TYPE_UINT16: - stack->gp_regs[gpcount++] = *(UINT16 *)avalue[i]; - break; - case FFI_TYPE_SINT32: - stack->gp_regs[gpcount++] = *(SINT32 *)avalue[i]; - break; - case FFI_TYPE_UINT32: - stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; - break; - - case FFI_TYPE_POINTER: - stack->gp_regs[gpcount++] = (UINT64)(PTR64) *(void **)avalue[i]; - break; - - case FFI_TYPE_FLOAT: - if (gpcount < 8 && fpcount < 8) - stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); - { - UINT32 tmp; - memcpy (&tmp, avalue[i], sizeof (UINT32)); - stack->gp_regs[gpcount++] = tmp; - } - break; - - case FFI_TYPE_DOUBLE: - if (gpcount < 8 && fpcount < 8) - stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); - memcpy (&stack->gp_regs[gpcount++], avalue[i], sizeof (UINT64)); - break; - - case FFI_TYPE_LONGDOUBLE: - if (gpcount & 1) - gpcount++; - if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) - stf_spill (&stack->fp_regs[fpcount++], *(__float80 *)avalue[i]); - memcpy (&stack->gp_regs[gpcount], avalue[i], 16); - gpcount += 2; - break; - - case FFI_TYPE_STRUCT: - { - size_t size = (*p_arg)->size; - size_t align = (*p_arg)->alignment; - int hfa_type = hfa_element_type (*p_arg, 0); - - FFI_ASSERT (align <= 16); - if (align == 16 && (gpcount & 1)) - gpcount++; - - if (hfa_type != FFI_TYPE_VOID) - { - size_t hfa_size = hfa_type_size (hfa_type); - size_t offset = 0; - size_t gp_offset = gpcount * 8; - - while (fpcount < 8 - && offset < size - && gp_offset < 8 * 8) - { - hfa_type_load (&stack->fp_regs[fpcount], hfa_type, - avalue[i] + offset); - offset += hfa_size; - gp_offset += hfa_size; - fpcount += 1; - } - } - - memcpy (&stack->gp_regs[gpcount], avalue[i], size); - gpcount += (size + 7) / 8; - } - break; - - default: - abort (); - } - } - - ffi_call_unix (stack, rvalue, fn, cif->flags); -} - -/* Closures represent a pair consisting of a function pointer, and - some user data. A closure is invoked by reinterpreting the closure - as a function pointer, and branching to it. Thus we can make an - interpreted function callable as a C function: We turn the - interpreter itself, together with a pointer specifying the - interpreted procedure, into a closure. - - For IA64, function pointer are already pairs consisting of a code - pointer, and a gp pointer. The latter is needed to access global - variables. Here we set up such a pair as the first two words of - the closure (in the "trampoline" area), but we replace the gp - pointer with a pointer to the closure itself. We also add the real - gp pointer to the closure. This allows the function entry code to - both retrieve the user data, and to restore the correct gp pointer. */ - -extern void ffi_closure_unix (); - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - /* The layout of a function descriptor. A C function pointer really - points to one of these. */ - struct ia64_fd - { - UINT64 code_pointer; - UINT64 gp; - }; - - struct ffi_ia64_trampoline_struct - { - UINT64 code_pointer; /* Pointer to ffi_closure_unix. */ - UINT64 fake_gp; /* Pointer to closure, installed as gp. */ - UINT64 real_gp; /* Real gp value. */ - }; - - struct ffi_ia64_trampoline_struct *tramp; - struct ia64_fd *fd; - - if (cif->abi != FFI_UNIX) - return FFI_BAD_ABI; - - tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; - fd = (struct ia64_fd *)(void *)ffi_closure_unix; - - tramp->code_pointer = fd->code_pointer; - tramp->real_gp = fd->gp; - tramp->fake_gp = (UINT64)(PTR64)codeloc; - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} - - -UINT64 -ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, - void *rvalue, void *r8) -{ - ffi_cif *cif; - void **avalue; - ffi_type **p_arg; - long i, avn, gpcount, fpcount; - - cif = closure->cif; - avn = cif->nargs; - avalue = alloca (avn * sizeof (void *)); - - /* If the structure return value is passed in memory get that location - from r8 so as to pass the value directly back to the caller. */ - if (cif->flags == FFI_TYPE_STRUCT) - rvalue = r8; - - gpcount = fpcount = 0; - for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 1); - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 2); - break; - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 4); - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - avalue[i] = &stack->gp_regs[gpcount++]; - break; - case FFI_TYPE_POINTER: - avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], sizeof(void*)); - break; - - case FFI_TYPE_FLOAT: - if (gpcount < 8 && fpcount < 8) - { - fpreg *addr = &stack->fp_regs[fpcount++]; - float result; - avalue[i] = addr; - ldf_fill (result, addr); - *(float *)addr = result; - } - else - avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4); - gpcount++; - break; - - case FFI_TYPE_DOUBLE: - if (gpcount < 8 && fpcount < 8) - { - fpreg *addr = &stack->fp_regs[fpcount++]; - double result; - avalue[i] = addr; - ldf_fill (result, addr); - *(double *)addr = result; - } - else - avalue[i] = &stack->gp_regs[gpcount]; - gpcount++; - break; - - case FFI_TYPE_LONGDOUBLE: - if (gpcount & 1) - gpcount++; - if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) - { - fpreg *addr = &stack->fp_regs[fpcount++]; - __float80 result; - avalue[i] = addr; - ldf_fill (result, addr); - *(__float80 *)addr = result; - } - else - avalue[i] = &stack->gp_regs[gpcount]; - gpcount += 2; - break; - - case FFI_TYPE_STRUCT: - { - size_t size = (*p_arg)->size; - size_t align = (*p_arg)->alignment; - int hfa_type = hfa_element_type (*p_arg, 0); - - FFI_ASSERT (align <= 16); - if (align == 16 && (gpcount & 1)) - gpcount++; - - if (hfa_type != FFI_TYPE_VOID) - { - size_t hfa_size = hfa_type_size (hfa_type); - size_t offset = 0; - size_t gp_offset = gpcount * 8; - void *addr = alloca (size); - - avalue[i] = addr; - - while (fpcount < 8 - && offset < size - && gp_offset < 8 * 8) - { - hfa_type_store (hfa_type, addr + offset, - &stack->fp_regs[fpcount]); - offset += hfa_size; - gp_offset += hfa_size; - fpcount += 1; - } - - if (offset < size) - memcpy (addr + offset, (char *)stack->gp_regs + gp_offset, - size - offset); - } - else - avalue[i] = &stack->gp_regs[gpcount]; - - gpcount += (size + 7) / 8; - } - break; - - default: - abort (); - } - } - - closure->fun (cif, rvalue, avalue, closure->user_data); - - return cif->flags; -} diff --git a/llgo/third_party/gofrontend/libffi/src/ia64/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/ia64/ffitarget.h deleted file mode 100644 index e68cea61544c55b819b1b9cc483159ee8244c1b1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/ia64/ffitarget.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for IA-64. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long long ffi_arg; -typedef signed long long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_UNIX, /* Linux and all Unix variants use the same conventions */ - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_UNIX -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */ - /* can be interpreted as a C function */ - /* descriptor: */ - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/ia64/ia64_flags.h b/llgo/third_party/gofrontend/libffi/src/ia64/ia64_flags.h deleted file mode 100644 index 9d652cef14cee7b39125c156454aa65d31fe4778..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/ia64/ia64_flags.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ----------------------------------------------------------------------- - ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company - - IA64/unix Foreign Function Interface - - Original author: Hans Boehm, HP Labs - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -/* "Type" codes used between assembly and C. When used as a part of - a cfi->flags value, the low byte will be these extra type codes, - and bits 8-31 will be the actual size of the type. */ - -/* Small structures containing N words in integer registers. */ -#define FFI_IA64_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 1) - -/* Homogeneous Floating Point Aggregates (HFAs) which are returned - in FP registers. */ -#define FFI_IA64_TYPE_HFA_FLOAT (FFI_TYPE_LAST + 2) -#define FFI_IA64_TYPE_HFA_DOUBLE (FFI_TYPE_LAST + 3) -#define FFI_IA64_TYPE_HFA_LDOUBLE (FFI_TYPE_LAST + 4) diff --git a/llgo/third_party/gofrontend/libffi/src/ia64/unix.S b/llgo/third_party/gofrontend/libffi/src/ia64/unix.S deleted file mode 100644 index 4d2a86d421f3a0ef8153684f6c665f8854271fbb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/ia64/unix.S +++ /dev/null @@ -1,560 +0,0 @@ -/* ----------------------------------------------------------------------- - unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. - Copyright (c) 2000 Hewlett Packard Company - - IA64/unix Foreign Function Interface - - Primary author: Hans Boehm, HP Labs - - Loosely modeled on Cygnus code for other platforms. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include "ia64_flags.h" - - .pred.safe_across_calls p1-p5,p16-p63 -.text - -/* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, - void (*fn)(void), int flags); - */ - - .align 16 - .global ffi_call_unix - .proc ffi_call_unix -ffi_call_unix: - .prologue - /* Bit o trickiness. We actually share a stack frame with ffi_call. - Rely on the fact that ffi_call uses a vframe and don't bother - tracking one here at all. */ - .fframe 0 - .save ar.pfs, r36 // loc0 - alloc loc0 = ar.pfs, 4, 3, 8, 0 - .save rp, loc1 - mov loc1 = b0 - .body - add r16 = 16, in0 - mov loc2 = gp - mov r8 = in1 - ;; - - /* Load up all of the argument registers. */ - ldf.fill f8 = [in0], 32 - ldf.fill f9 = [r16], 32 - ;; - ldf.fill f10 = [in0], 32 - ldf.fill f11 = [r16], 32 - ;; - ldf.fill f12 = [in0], 32 - ldf.fill f13 = [r16], 32 - ;; - ldf.fill f14 = [in0], 32 - ldf.fill f15 = [r16], 24 - ;; - ld8 out0 = [in0], 16 - ld8 out1 = [r16], 16 - ;; - ld8 out2 = [in0], 16 - ld8 out3 = [r16], 16 - ;; - ld8 out4 = [in0], 16 - ld8 out5 = [r16], 16 - ;; - ld8 out6 = [in0] - ld8 out7 = [r16] - ;; - - /* Deallocate the register save area from the stack frame. */ - mov sp = in0 - - /* Call the target function. */ - ld8 r16 = [in2], 8 - ;; - ld8 gp = [in2] - mov b6 = r16 - br.call.sptk.many b0 = b6 - ;; - - /* Dispatch to handle return value. */ - mov gp = loc2 - zxt1 r16 = in3 - ;; - mov ar.pfs = loc0 - addl r18 = @ltoffx(.Lst_table), gp - ;; - ld8.mov r18 = [r18], .Lst_table - mov b0 = loc1 - ;; - shladd r18 = r16, 3, r18 - ;; - ld8 r17 = [r18] - shr in3 = in3, 8 - ;; - add r17 = r17, r18 - ;; - mov b6 = r17 - br b6 - ;; - -.Lst_void: - br.ret.sptk.many b0 - ;; -.Lst_uint8: - zxt1 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_sint8: - sxt1 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_uint16: - zxt2 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_sint16: - sxt2 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_uint32: - zxt4 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_sint32: - sxt4 r8 = r8 - ;; - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_int64: - st8 [in1] = r8 - br.ret.sptk.many b0 - ;; -.Lst_float: - stfs [in1] = f8 - br.ret.sptk.many b0 - ;; -.Lst_double: - stfd [in1] = f8 - br.ret.sptk.many b0 - ;; -.Lst_ldouble: - stfe [in1] = f8 - br.ret.sptk.many b0 - ;; - -.Lst_small_struct: - add sp = -16, sp - cmp.lt p6, p0 = 8, in3 - cmp.lt p7, p0 = 16, in3 - cmp.lt p8, p0 = 24, in3 - ;; - add r16 = 8, sp - add r17 = 16, sp - add r18 = 24, sp - ;; - st8 [sp] = r8 -(p6) st8 [r16] = r9 - mov out0 = in1 -(p7) st8 [r17] = r10 -(p8) st8 [r18] = r11 - mov out1 = sp - mov out2 = in3 - br.call.sptk.many b0 = memcpy# - ;; - mov ar.pfs = loc0 - mov b0 = loc1 - mov gp = loc2 - br.ret.sptk.many b0 - -.Lst_hfa_float: - add r16 = 4, in1 - cmp.lt p6, p0 = 4, in3 - ;; - stfs [in1] = f8, 8 -(p6) stfs [r16] = f9, 8 - cmp.lt p7, p0 = 8, in3 - cmp.lt p8, p0 = 12, in3 - ;; -(p7) stfs [in1] = f10, 8 -(p8) stfs [r16] = f11, 8 - cmp.lt p9, p0 = 16, in3 - cmp.lt p10, p0 = 20, in3 - ;; -(p9) stfs [in1] = f12, 8 -(p10) stfs [r16] = f13, 8 - cmp.lt p6, p0 = 24, in3 - cmp.lt p7, p0 = 28, in3 - ;; -(p6) stfs [in1] = f14 -(p7) stfs [r16] = f15 - br.ret.sptk.many b0 - ;; - -.Lst_hfa_double: - add r16 = 8, in1 - cmp.lt p6, p0 = 8, in3 - ;; - stfd [in1] = f8, 16 -(p6) stfd [r16] = f9, 16 - cmp.lt p7, p0 = 16, in3 - cmp.lt p8, p0 = 24, in3 - ;; -(p7) stfd [in1] = f10, 16 -(p8) stfd [r16] = f11, 16 - cmp.lt p9, p0 = 32, in3 - cmp.lt p10, p0 = 40, in3 - ;; -(p9) stfd [in1] = f12, 16 -(p10) stfd [r16] = f13, 16 - cmp.lt p6, p0 = 48, in3 - cmp.lt p7, p0 = 56, in3 - ;; -(p6) stfd [in1] = f14 -(p7) stfd [r16] = f15 - br.ret.sptk.many b0 - ;; - -.Lst_hfa_ldouble: - add r16 = 16, in1 - cmp.lt p6, p0 = 16, in3 - ;; - stfe [in1] = f8, 32 -(p6) stfe [r16] = f9, 32 - cmp.lt p7, p0 = 32, in3 - cmp.lt p8, p0 = 48, in3 - ;; -(p7) stfe [in1] = f10, 32 -(p8) stfe [r16] = f11, 32 - cmp.lt p9, p0 = 64, in3 - cmp.lt p10, p0 = 80, in3 - ;; -(p9) stfe [in1] = f12, 32 -(p10) stfe [r16] = f13, 32 - cmp.lt p6, p0 = 96, in3 - cmp.lt p7, p0 = 112, in3 - ;; -(p6) stfe [in1] = f14 -(p7) stfe [r16] = f15 - br.ret.sptk.many b0 - ;; - - .endp ffi_call_unix - - .align 16 - .global ffi_closure_unix - .proc ffi_closure_unix - -#define FRAME_SIZE (8*16 + 8*8 + 8*16) - -ffi_closure_unix: - .prologue - .save ar.pfs, r40 // loc0 - alloc loc0 = ar.pfs, 8, 4, 4, 0 - .fframe FRAME_SIZE - add r12 = -FRAME_SIZE, r12 - .save rp, loc1 - mov loc1 = b0 - .save ar.unat, loc2 - mov loc2 = ar.unat - .body - - /* Retrieve closure pointer and real gp. */ -#ifdef _ILP32 - addp4 out0 = 0, gp - addp4 gp = 16, gp -#else - mov out0 = gp - add gp = 16, gp -#endif - ;; - ld8 gp = [gp] - - /* Spill all of the possible argument registers. */ - add r16 = 16 + 8*16, sp - add r17 = 16 + 8*16 + 16, sp - ;; - stf.spill [r16] = f8, 32 - stf.spill [r17] = f9, 32 - mov loc3 = gp - ;; - stf.spill [r16] = f10, 32 - stf.spill [r17] = f11, 32 - ;; - stf.spill [r16] = f12, 32 - stf.spill [r17] = f13, 32 - ;; - stf.spill [r16] = f14, 32 - stf.spill [r17] = f15, 24 - ;; - .mem.offset 0, 0 - st8.spill [r16] = in0, 16 - .mem.offset 8, 0 - st8.spill [r17] = in1, 16 - add out1 = 16 + 8*16, sp - ;; - .mem.offset 0, 0 - st8.spill [r16] = in2, 16 - .mem.offset 8, 0 - st8.spill [r17] = in3, 16 - add out2 = 16, sp - ;; - .mem.offset 0, 0 - st8.spill [r16] = in4, 16 - .mem.offset 8, 0 - st8.spill [r17] = in5, 16 - mov out3 = r8 - ;; - .mem.offset 0, 0 - st8.spill [r16] = in6 - .mem.offset 8, 0 - st8.spill [r17] = in7 - - /* Invoke ffi_closure_unix_inner for the hard work. */ - br.call.sptk.many b0 = ffi_closure_unix_inner - ;; - - /* Dispatch to handle return value. */ - mov gp = loc3 - zxt1 r16 = r8 - ;; - addl r18 = @ltoffx(.Lld_table), gp - mov ar.pfs = loc0 - ;; - ld8.mov r18 = [r18], .Lld_table - mov b0 = loc1 - ;; - shladd r18 = r16, 3, r18 - mov ar.unat = loc2 - ;; - ld8 r17 = [r18] - shr r8 = r8, 8 - ;; - add r17 = r17, r18 - add r16 = 16, sp - ;; - mov b6 = r17 - br b6 - ;; - .label_state 1 - -.Lld_void: - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; -.Lld_int: - .body - .copy_state 1 - ld8 r8 = [r16] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; -.Lld_float: - .body - .copy_state 1 - ldfs f8 = [r16] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; -.Lld_double: - .body - .copy_state 1 - ldfd f8 = [r16] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; -.Lld_ldouble: - .body - .copy_state 1 - ldfe f8 = [r16] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; - -.Lld_small_struct: - .body - .copy_state 1 - add r17 = 8, r16 - cmp.lt p6, p0 = 8, r8 - cmp.lt p7, p0 = 16, r8 - cmp.lt p8, p0 = 24, r8 - ;; - ld8 r8 = [r16], 16 -(p6) ld8 r9 = [r17], 16 - ;; -(p7) ld8 r10 = [r16] -(p8) ld8 r11 = [r17] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; - -.Lld_hfa_float: - .body - .copy_state 1 - add r17 = 4, r16 - cmp.lt p6, p0 = 4, r8 - ;; - ldfs f8 = [r16], 8 -(p6) ldfs f9 = [r17], 8 - cmp.lt p7, p0 = 8, r8 - cmp.lt p8, p0 = 12, r8 - ;; -(p7) ldfs f10 = [r16], 8 -(p8) ldfs f11 = [r17], 8 - cmp.lt p9, p0 = 16, r8 - cmp.lt p10, p0 = 20, r8 - ;; -(p9) ldfs f12 = [r16], 8 -(p10) ldfs f13 = [r17], 8 - cmp.lt p6, p0 = 24, r8 - cmp.lt p7, p0 = 28, r8 - ;; -(p6) ldfs f14 = [r16] -(p7) ldfs f15 = [r17] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; - -.Lld_hfa_double: - .body - .copy_state 1 - add r17 = 8, r16 - cmp.lt p6, p0 = 8, r8 - ;; - ldfd f8 = [r16], 16 -(p6) ldfd f9 = [r17], 16 - cmp.lt p7, p0 = 16, r8 - cmp.lt p8, p0 = 24, r8 - ;; -(p7) ldfd f10 = [r16], 16 -(p8) ldfd f11 = [r17], 16 - cmp.lt p9, p0 = 32, r8 - cmp.lt p10, p0 = 40, r8 - ;; -(p9) ldfd f12 = [r16], 16 -(p10) ldfd f13 = [r17], 16 - cmp.lt p6, p0 = 48, r8 - cmp.lt p7, p0 = 56, r8 - ;; -(p6) ldfd f14 = [r16] -(p7) ldfd f15 = [r17] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; - -.Lld_hfa_ldouble: - .body - .copy_state 1 - add r17 = 16, r16 - cmp.lt p6, p0 = 16, r8 - ;; - ldfe f8 = [r16], 32 -(p6) ldfe f9 = [r17], 32 - cmp.lt p7, p0 = 32, r8 - cmp.lt p8, p0 = 48, r8 - ;; -(p7) ldfe f10 = [r16], 32 -(p8) ldfe f11 = [r17], 32 - cmp.lt p9, p0 = 64, r8 - cmp.lt p10, p0 = 80, r8 - ;; -(p9) ldfe f12 = [r16], 32 -(p10) ldfe f13 = [r17], 32 - cmp.lt p6, p0 = 96, r8 - cmp.lt p7, p0 = 112, r8 - ;; -(p6) ldfe f14 = [r16] -(p7) ldfe f15 = [r17] - .restore sp - add sp = FRAME_SIZE, sp - br.ret.sptk.many b0 - ;; - - .endp ffi_closure_unix - - .section .rodata - .align 8 -.Lst_table: - data8 @pcrel(.Lst_void) // FFI_TYPE_VOID - data8 @pcrel(.Lst_sint32) // FFI_TYPE_INT - data8 @pcrel(.Lst_float) // FFI_TYPE_FLOAT - data8 @pcrel(.Lst_double) // FFI_TYPE_DOUBLE - data8 @pcrel(.Lst_ldouble) // FFI_TYPE_LONGDOUBLE - data8 @pcrel(.Lst_uint8) // FFI_TYPE_UINT8 - data8 @pcrel(.Lst_sint8) // FFI_TYPE_SINT8 - data8 @pcrel(.Lst_uint16) // FFI_TYPE_UINT16 - data8 @pcrel(.Lst_sint16) // FFI_TYPE_SINT16 - data8 @pcrel(.Lst_uint32) // FFI_TYPE_UINT32 - data8 @pcrel(.Lst_sint32) // FFI_TYPE_SINT32 - data8 @pcrel(.Lst_int64) // FFI_TYPE_UINT64 - data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64 - data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT - data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER - data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT - data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT - data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE - data8 @pcrel(.Lst_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE - -.Lld_table: - data8 @pcrel(.Lld_void) // FFI_TYPE_VOID - data8 @pcrel(.Lld_int) // FFI_TYPE_INT - data8 @pcrel(.Lld_float) // FFI_TYPE_FLOAT - data8 @pcrel(.Lld_double) // FFI_TYPE_DOUBLE - data8 @pcrel(.Lld_ldouble) // FFI_TYPE_LONGDOUBLE - data8 @pcrel(.Lld_int) // FFI_TYPE_UINT8 - data8 @pcrel(.Lld_int) // FFI_TYPE_SINT8 - data8 @pcrel(.Lld_int) // FFI_TYPE_UINT16 - data8 @pcrel(.Lld_int) // FFI_TYPE_SINT16 - data8 @pcrel(.Lld_int) // FFI_TYPE_UINT32 - data8 @pcrel(.Lld_int) // FFI_TYPE_SINT32 - data8 @pcrel(.Lld_int) // FFI_TYPE_UINT64 - data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64 - data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT - data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER - data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT - data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT - data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE - data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/java_raw_api.c b/llgo/third_party/gofrontend/libffi/src/java_raw_api.c deleted file mode 100644 index 127123d5bc3a09b99116f264b88bd38769a86c2c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/java_raw_api.c +++ /dev/null @@ -1,374 +0,0 @@ -/* ----------------------------------------------------------------------- - java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc. - - Cloned from raw_api.c - - Raw_api.c author: Kresten Krab Thorup - Java_raw_api.c author: Hans-J. Boehm - - $Id $ - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -/* This defines a Java- and 64-bit specific variant of the raw API. */ -/* It assumes that "raw" argument blocks look like Java stacks on a */ -/* 64-bit machine. Arguments that can be stored in a single stack */ -/* stack slots (longs, doubles) occupy 128 bits, but only the first */ -/* 64 bits are actually used. */ - -#include -#include -#include - -#if !defined(NO_JAVA_RAW_API) - -size_t -ffi_java_raw_size (ffi_cif *cif) -{ - size_t result = 0; - int i; - - ffi_type **at = cif->arg_types; - - for (i = cif->nargs-1; i >= 0; i--, at++) - { - switch((*at) -> type) { - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_DOUBLE: - result += 2 * FFI_SIZEOF_JAVA_RAW; - break; - case FFI_TYPE_STRUCT: - /* No structure parameters in Java. */ - abort(); - case FFI_TYPE_COMPLEX: - /* Not supported yet. */ - abort(); - default: - result += FFI_SIZEOF_JAVA_RAW; - } - } - - return result; -} - - -void -ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) -{ - unsigned i; - ffi_type **tp = cif->arg_types; - -#if WORDS_BIGENDIAN - - for (i = 0; i < cif->nargs; i++, tp++, args++) - { - switch ((*tp)->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - *args = (void*) ((char*)(raw++) + 3); - break; - - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - *args = (void*) ((char*)(raw++) + 2); - break; - -#if FFI_SIZEOF_JAVA_RAW == 8 - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_DOUBLE: - *args = (void *)raw; - raw += 2; - break; -#endif - - case FFI_TYPE_POINTER: - *args = (void*) &(raw++)->ptr; - break; - - case FFI_TYPE_COMPLEX: - /* Not supported yet. */ - abort(); - - default: - *args = raw; - raw += - ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); - } - } - -#else /* WORDS_BIGENDIAN */ - -#if !PDP - - /* then assume little endian */ - for (i = 0; i < cif->nargs; i++, tp++, args++) - { -#if FFI_SIZEOF_JAVA_RAW == 8 - switch((*tp)->type) { - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_DOUBLE: - *args = (void*) raw; - raw += 2; - break; - case FFI_TYPE_COMPLEX: - /* Not supported yet. */ - abort(); - default: - *args = (void*) raw++; - } -#else /* FFI_SIZEOF_JAVA_RAW != 8 */ - *args = (void*) raw; - raw += - ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); -#endif /* FFI_SIZEOF_JAVA_RAW == 8 */ - } - -#else -#error "pdp endian not supported" -#endif /* ! PDP */ - -#endif /* WORDS_BIGENDIAN */ -} - -void -ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) -{ - unsigned i; - ffi_type **tp = cif->arg_types; - - for (i = 0; i < cif->nargs; i++, tp++, args++) - { - switch ((*tp)->type) - { - case FFI_TYPE_UINT8: -#if WORDS_BIGENDIAN - *(UINT32*)(raw++) = *(UINT8*) (*args); -#else - (raw++)->uint = *(UINT8*) (*args); -#endif - break; - - case FFI_TYPE_SINT8: -#if WORDS_BIGENDIAN - *(SINT32*)(raw++) = *(SINT8*) (*args); -#else - (raw++)->sint = *(SINT8*) (*args); -#endif - break; - - case FFI_TYPE_UINT16: -#if WORDS_BIGENDIAN - *(UINT32*)(raw++) = *(UINT16*) (*args); -#else - (raw++)->uint = *(UINT16*) (*args); -#endif - break; - - case FFI_TYPE_SINT16: -#if WORDS_BIGENDIAN - *(SINT32*)(raw++) = *(SINT16*) (*args); -#else - (raw++)->sint = *(SINT16*) (*args); -#endif - break; - - case FFI_TYPE_UINT32: -#if WORDS_BIGENDIAN - *(UINT32*)(raw++) = *(UINT32*) (*args); -#else - (raw++)->uint = *(UINT32*) (*args); -#endif - break; - - case FFI_TYPE_SINT32: -#if WORDS_BIGENDIAN - *(SINT32*)(raw++) = *(SINT32*) (*args); -#else - (raw++)->sint = *(SINT32*) (*args); -#endif - break; - - case FFI_TYPE_FLOAT: - (raw++)->flt = *(FLOAT32*) (*args); - break; - -#if FFI_SIZEOF_JAVA_RAW == 8 - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_DOUBLE: - raw->uint = *(UINT64*) (*args); - raw += 2; - break; -#endif - - case FFI_TYPE_POINTER: - (raw++)->ptr = **(void***) args; - break; - - default: -#if FFI_SIZEOF_JAVA_RAW == 8 - FFI_ASSERT(0); /* Should have covered all cases */ -#else - memcpy ((void*) raw->data, (void*)*args, (*tp)->size); - raw += - ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); -#endif - } - } -} - -#if !FFI_NATIVE_RAW_API - -static void -ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) -{ -#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 - switch (cif->rtype->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_UINT32: - *(UINT64 *)rvalue <<= 32; - break; - - case FFI_TYPE_SINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_INT: -#if FFI_SIZEOF_JAVA_RAW == 4 - case FFI_TYPE_POINTER: -#endif - *(SINT64 *)rvalue <<= 32; - break; - - case FFI_TYPE_COMPLEX: - /* Not supported yet. */ - abort(); - - default: - break; - } -#endif -} - -static void -ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) -{ -#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 - switch (cif->rtype->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_UINT32: - *(UINT64 *)rvalue >>= 32; - break; - - case FFI_TYPE_SINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_INT: - *(SINT64 *)rvalue >>= 32; - break; - - case FFI_TYPE_COMPLEX: - /* Not supported yet. */ - abort(); - - default: - break; - } -#endif -} - -/* This is a generic definition of ffi_raw_call, to be used if the - * native system does not provide a machine-specific implementation. - * Having this, allows code to be written for the raw API, without - * the need for system-specific code to handle input in that format; - * these following couple of functions will handle the translation forth - * and back automatically. */ - -void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, - ffi_java_raw *raw) -{ - void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); - ffi_java_raw_to_ptrarray (cif, raw, avalue); - ffi_call (cif, fn, rvalue, avalue); - ffi_java_rvalue_to_raw (cif, rvalue); -} - -#if FFI_CLOSURES /* base system provides closures */ - -static void -ffi_java_translate_args (ffi_cif *cif, void *rvalue, - void **avalue, void *user_data) -{ - ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif)); - ffi_raw_closure *cl = (ffi_raw_closure*)user_data; - - ffi_java_ptrarray_to_raw (cif, avalue, raw); - (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data); - ffi_java_raw_to_rvalue (cif, rvalue); -} - -ffi_status -ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data, - void *codeloc) -{ - ffi_status status; - - status = ffi_prep_closure_loc ((ffi_closure*) cl, - cif, - &ffi_java_translate_args, - codeloc, - codeloc); - if (status == FFI_OK) - { - cl->fun = fun; - cl->user_data = user_data; - } - - return status; -} - -/* Again, here is the generic version of ffi_prep_raw_closure, which - * will install an intermediate "hub" for translation of arguments from - * the pointer-array format, to the raw format */ - -ffi_status -ffi_prep_java_raw_closure (ffi_java_raw_closure* cl, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data) -{ - return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl); -} - -#endif /* FFI_CLOSURES */ -#endif /* !FFI_NATIVE_RAW_API */ -#endif /* !NO_JAVA_RAW_API */ diff --git a/llgo/third_party/gofrontend/libffi/src/m32r/ffi.c b/llgo/third_party/gofrontend/libffi/src/m32r/ffi.c deleted file mode 100644 index 300006349bf62187c2ebab82959581836dd0dcd0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m32r/ffi.c +++ /dev/null @@ -1,232 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2004 Renesas Technology - Copyright (c) 2008 Red Hat, Inc. - - M32R Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -/* ffi_prep_args is called by the assembly routine once stack - space has been allocated for the function's arguments. */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - unsigned int i; - int tmp; - unsigned int avn; - void **p_argv; - char *argp; - ffi_type **p_arg; - - tmp = 0; - argp = stack; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 8) - { - *(void **) argp = ecif->rvalue; - argp += 4; - } - - avn = ecif->cif->nargs; - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0) && (avn != 0); - i--, p_arg++) - { - size_t z; - - /* Align if necessary. */ - if (((*p_arg)->alignment - 1) & (unsigned) argp) - argp = (char *) ALIGN (argp, (*p_arg)->alignment); - - if (avn != 0) - { - avn--; - z = (*p_arg)->size; - if (z < sizeof (int)) - { - z = sizeof (int); - - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_STRUCT: - z = (*p_arg)->size; - if ((*p_arg)->alignment != 1) - memcpy (argp, *p_argv, z); - else - memcpy (argp + 4 - z, *p_argv, z); - z = sizeof (int); - break; - - default: - FFI_ASSERT(0); - } - } - else if (z == sizeof (int)) - { - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - } - else - { - if ((*p_arg)->type == FFI_TYPE_STRUCT) - { - if (z > 8) - { - *(unsigned int *) argp = (unsigned int)(void *)(* p_argv); - z = sizeof(void *); - } - else - { - memcpy(argp, *p_argv, z); - z = 8; - } - } - else - { - /* Double or long long 64bit. */ - memcpy (argp, *p_argv, z); - } - } - p_argv++; - argp += z; - } - } - - return; -} - -/* Perform machine dependent cif processing. */ -ffi_status -ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* Set the return type flag. */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_STRUCT: - if (cif->rtype->size <= 4) - cif->flags = FFI_TYPE_INT; - - else if (cif->rtype->size <= 8) - cif->flags = FFI_TYPE_DOUBLE; - - else - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - cif->flags = FFI_TYPE_DOUBLE; - break; - - case FFI_TYPE_FLOAT: - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have - a return value address then we need to make one. */ - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca (cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - if (cif->rtype->type == FFI_TYPE_STRUCT) - { - int size = cif->rtype->size; - int align = cif->rtype->alignment; - - if (size < 4) - { - if (align == 1) - *(unsigned long *)(ecif.rvalue) <<= (4 - size) * 8; - } - else if (4 < size && size < 8) - { - if (align == 1) - { - memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); - } - else if (align == 2) - { - if (size & 1) - size += 1; - - if (size != 8) - memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); - } - } - } - break; - - default: - FFI_ASSERT(0); - break; - } -} diff --git a/llgo/third_party/gofrontend/libffi/src/m32r/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/m32r/ffitarget.h deleted file mode 100644 index 6c34801982f6edef3b5a5909236b211d2ab929a8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m32r/ffitarget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 2004 Renesas Technology. - Target configuration macros for M32R. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- Generic type definitions ----------------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi - { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV - } ffi_abi; -#endif - -#define FFI_CLOSURES 0 -#define FFI_TRAMPOLINE_SIZE 24 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/m32r/sysv.S b/llgo/third_party/gofrontend/libffi/src/m32r/sysv.S deleted file mode 100644 index 06b75c22634a6722a6b3c9669455f98061e2288f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m32r/sysv.S +++ /dev/null @@ -1,121 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2004 Renesas Technology - - M32R Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -/* XXX these lose for some platforms, I'm sure. */ -#define CNAME(x) x -#define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x): -#endif - -.text - - /* R0: ffi_prep_args */ - /* R1: &ecif */ - /* R2: cif->bytes */ - /* R3: fig->flags */ - /* sp+0: ecif.rvalue */ - /* sp+4: fn */ - - /* This assumes we are using gas. */ -ENTRY(ffi_call_SYSV) - /* Save registers. */ - push fp - push lr - push r3 - push r2 - push r1 - push r0 - mv fp, sp - - /* Make room for all of the new args. */ - sub sp, r2 - - /* Place all of the ffi_prep_args in position. */ - mv lr, r0 - mv r0, sp - /* R1 already set. */ - - /* And call. */ - jl lr - - /* Move first 4 parameters in registers... */ - ld r0, @(0,sp) - ld r1, @(4,sp) - ld r2, @(8,sp) - ld r3, @(12,sp) - - /* ...and adjust the stack. */ - ld lr, @(8,fp) - cmpi lr, #16 - bc adjust_stack - ldi lr, #16 -adjust_stack: - add sp, lr - - /* Call the function. */ - ld lr, @(28,fp) - jl lr - - /* Remove the space we pushed for the args. */ - mv sp, fp - - /* Load R2 with the pointer to storage for the return value. */ - ld r2, @(24,sp) - - /* Load R3 with the return type code. */ - ld r3, @(12,sp) - - /* If the return value pointer is NULL, assume no return value. */ - beqz r2, epilogue - - /* Return INT. */ - ldi r4, #FFI_TYPE_INT - bne r3, r4, return_double - st r0, @r2 - bra epilogue - -return_double: - /* Return DOUBLE or LONGDOUBLE. */ - ldi r4, #FFI_TYPE_DOUBLE - bne r3, r4, epilogue - st r0, @r2 - st r1, @(4,r2) - -epilogue: - pop r0 - pop r1 - pop r2 - pop r3 - pop lr - pop fp - jmp lr - -.ffi_call_SYSV_end: - .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) diff --git a/llgo/third_party/gofrontend/libffi/src/m68k/ffi.c b/llgo/third_party/gofrontend/libffi/src/m68k/ffi.c deleted file mode 100644 index 0dee9383a8d88778d36f2a594ba37ef04c9cd035..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m68k/ffi.c +++ /dev/null @@ -1,362 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - - m68k Foreign Function Interface - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include -#ifdef __rtems__ -void rtems_cache_flush_multiple_data_lines( const void *, size_t ); -#else -#include -#ifdef __MINT__ -#include -#include -#else -#include -#endif -#endif - -void ffi_call_SYSV (extended_cif *, - unsigned, unsigned, - void *, void (*fn) ()); -void *ffi_prep_args (void *stack, extended_cif *ecif); -void ffi_closure_SYSV (ffi_closure *); -void ffi_closure_struct_SYSV (ffi_closure *); -unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, - void *resp, void *args); - -/* ffi_prep_args is called by the assembly routine once stack space has - been allocated for the function's arguments. */ - -void * -ffi_prep_args (void *stack, extended_cif *ecif) -{ - unsigned int i; - void **p_argv; - char *argp; - ffi_type **p_arg; - void *struct_value_ptr; - - argp = stack; - - if ( -#ifdef __MINT__ - (ecif->cif->rtype->type == FFI_TYPE_LONGDOUBLE) || -#endif - (((ecif->cif->rtype->type == FFI_TYPE_STRUCT) - && !ecif->cif->flags))) - struct_value_ptr = ecif->rvalue; - else - struct_value_ptr = NULL; - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - i != 0; - i--, p_arg++) - { - size_t z = (*p_arg)->size; - int type = (*p_arg)->type; - - if (z < sizeof (int)) - { - switch (type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; - break; - - case FFI_TYPE_STRUCT: -#ifdef __MINT__ - if (z == 1 || z == 2) - memcpy (argp + 2, *p_argv, z); - else - memcpy (argp, *p_argv, z); -#else - memcpy (argp + sizeof (int) - z, *p_argv, z); -#endif - break; - - default: - FFI_ASSERT (0); - } - z = sizeof (int); - } - else - { - memcpy (argp, *p_argv, z); - - /* Align if necessary. */ - if ((sizeof(int) - 1) & z) - z = ALIGN(z, sizeof(int)); - } - - p_argv++; - argp += z; - } - - return struct_value_ptr; -} - -#define CIF_FLAGS_INT 1 -#define CIF_FLAGS_DINT 2 -#define CIF_FLAGS_FLOAT 4 -#define CIF_FLAGS_DOUBLE 8 -#define CIF_FLAGS_LDOUBLE 16 -#define CIF_FLAGS_POINTER 32 -#define CIF_FLAGS_STRUCT1 64 -#define CIF_FLAGS_STRUCT2 128 -#define CIF_FLAGS_SINT8 256 -#define CIF_FLAGS_SINT16 512 - -/* Perform machine dependent cif processing */ -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = 0; - break; - - case FFI_TYPE_STRUCT: - if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT && - cif->rtype->elements[1]) - { - cif->flags = 0; - break; - } - - switch (cif->rtype->size) - { - case 1: -#ifdef __MINT__ - cif->flags = CIF_FLAGS_STRUCT2; -#else - cif->flags = CIF_FLAGS_STRUCT1; -#endif - break; - case 2: - cif->flags = CIF_FLAGS_STRUCT2; - break; -#ifdef __MINT__ - case 3: -#endif - case 4: - cif->flags = CIF_FLAGS_INT; - break; -#ifdef __MINT__ - case 7: -#endif - case 8: - cif->flags = CIF_FLAGS_DINT; - break; - default: - cif->flags = 0; - break; - } - break; - - case FFI_TYPE_FLOAT: - cif->flags = CIF_FLAGS_FLOAT; - break; - - case FFI_TYPE_DOUBLE: - cif->flags = CIF_FLAGS_DOUBLE; - break; - -#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE) - case FFI_TYPE_LONGDOUBLE: -#ifdef __MINT__ - cif->flags = 0; -#else - cif->flags = CIF_FLAGS_LDOUBLE; -#endif - break; -#endif - - case FFI_TYPE_POINTER: - cif->flags = CIF_FLAGS_POINTER; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = CIF_FLAGS_DINT; - break; - - case FFI_TYPE_SINT16: - cif->flags = CIF_FLAGS_SINT16; - break; - - case FFI_TYPE_SINT8: - cif->flags = CIF_FLAGS_SINT8; - break; - - default: - cif->flags = CIF_FLAGS_INT; - break; - } - - return FFI_OK; -} - -void -ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return value - address then we need to make one. */ - - if (rvalue == NULL - && cif->rtype->type == FFI_TYPE_STRUCT - && cif->rtype->size > 8) - ecif.rvalue = alloca (cif->rtype->size); - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV (&ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); - break; - - default: - FFI_ASSERT (0); - break; - } -} - -static void -ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif) -{ - unsigned int i; - void **p_argv; - char *argp; - ffi_type **p_arg; - - argp = stack; - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) - { - size_t z; - - z = (*p_arg)->size; -#ifdef __MINT__ - if (cif->flags && - cif->rtype->type == FFI_TYPE_STRUCT && - (z == 1 || z == 2)) - { - *p_argv = (void *) (argp + 2); - - z = 4; - } - else - if (cif->flags && - cif->rtype->type == FFI_TYPE_STRUCT && - (z == 3 || z == 4)) - { - *p_argv = (void *) (argp); - - z = 4; - } - else -#endif - if (z <= 4) - { - *p_argv = (void *) (argp + 4 - z); - - z = 4; - } - else - { - *p_argv = (void *) argp; - - /* Align if necessary */ - if ((sizeof(int) - 1) & z) - z = ALIGN(z, sizeof(int)); - } - - p_argv++; - argp += z; - } -} - -unsigned int -ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args) -{ - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void *)); - - ffi_prep_incoming_args_SYSV(args, arg_area, cif); - - (closure->fun) (cif, resp, arg_area, closure->user_data); - - return cif->flags; -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - *(unsigned short *)closure->tramp = 0x207c; - *(void **)(closure->tramp + 2) = codeloc; - *(unsigned short *)(closure->tramp + 6) = 0x4ef9; - - if ( -#ifdef __MINT__ - (cif->rtype->type == FFI_TYPE_LONGDOUBLE) || -#endif - (((cif->rtype->type == FFI_TYPE_STRUCT) - && !cif->flags))) - *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; - else - *(void **)(closure->tramp + 8) = ffi_closure_SYSV; - -#ifdef __rtems__ - rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE ); -#elif defined(__MINT__) - Ssystem(S_FLUSHCACHE, codeloc, FFI_TRAMPOLINE_SIZE); -#else - syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, - FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); -#endif - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/m68k/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/m68k/ffitarget.h deleted file mode 100644 index e81dde2b2eb404bc0a60c37b9635dc3b0e972cc2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m68k/ffitarget.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for Motorola 68K. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 16 -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/m68k/sysv.S b/llgo/third_party/gofrontend/libffi/src/m68k/sysv.S deleted file mode 100644 index ec2b14f3d9817daf396b5dcb4cd80fc5c48d51d4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m68k/sysv.S +++ /dev/null @@ -1,330 +0,0 @@ -/* ----------------------------------------------------------------------- - - sysv.S - Copyright (c) 2012 Alan Hourihane - Copyright (c) 1998, 2012 Andreas Schwab - Copyright (c) 2008 Red Hat, Inc. - Copyright (c) 2012 Thorsten Glaser - - m68k Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -#ifdef HAVE_AS_CFI_PSEUDO_OP -#define CFI_STARTPROC() .cfi_startproc -#define CFI_OFFSET(reg,off) .cfi_offset reg,off -#define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off -#define CFI_ENDPROC() .cfi_endproc -#else -#define CFI_STARTPROC() -#define CFI_OFFSET(reg,off) -#define CFI_DEF_CFA(reg,off) -#define CFI_ENDPROC() -#endif - -#ifdef __MINT__ -#define CALLFUNC(funcname) _ ## funcname -#else -#define CALLFUNC(funcname) funcname -#endif - - .text - - .globl CALLFUNC(ffi_call_SYSV) - .type CALLFUNC(ffi_call_SYSV),@function - .align 4 - -CALLFUNC(ffi_call_SYSV): - CFI_STARTPROC() - link %fp,#0 - CFI_OFFSET(14,-8) - CFI_DEF_CFA(14,8) - move.l %d2,-(%sp) - CFI_OFFSET(2,-12) - - | Make room for all of the new args. - sub.l 12(%fp),%sp - - | Call ffi_prep_args - move.l 8(%fp),-(%sp) - pea 4(%sp) -#if !defined __PIC__ - jsr CALLFUNC(ffi_prep_args) -#else - bsr.l CALLFUNC(ffi_prep_args@PLTPC) -#endif - addq.l #8,%sp - - | Pass pointer to struct value, if any -#ifdef __MINT__ - move.l %d0,%a1 -#else - move.l %a0,%a1 -#endif - - | Call the function - move.l 24(%fp),%a0 - jsr (%a0) - - | Remove the space we pushed for the args - add.l 12(%fp),%sp - - | Load the pointer to storage for the return value - move.l 20(%fp),%a1 - - | Load the return type code - move.l 16(%fp),%d2 - - | If the return value pointer is NULL, assume no return value. - | NOTE: On the mc68000, tst on an address register is not supported. -#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) - cmp.w #0, %a1 -#else - tst.l %a1 -#endif - jbeq noretval - - btst #0,%d2 - jbeq retlongint - move.l %d0,(%a1) - jbra epilogue - -retlongint: - btst #1,%d2 - jbeq retfloat - move.l %d0,(%a1) - move.l %d1,4(%a1) - jbra epilogue - -retfloat: - btst #2,%d2 - jbeq retdouble -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.s %fp0,(%a1) -#else - move.l %d0,(%a1) -#endif - jbra epilogue - -retdouble: - btst #3,%d2 - jbeq retlongdouble -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.d %fp0,(%a1) -#else - move.l %d0,(%a1)+ - move.l %d1,(%a1) -#endif - jbra epilogue - -retlongdouble: - btst #4,%d2 - jbeq retpointer -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.x %fp0,(%a1) -#else - move.l %d0,(%a1)+ - move.l %d1,(%a1)+ - move.l %d2,(%a1) -#endif - jbra epilogue - -retpointer: - btst #5,%d2 - jbeq retstruct1 -#ifdef __MINT__ - move.l %d0,(%a1) -#else - move.l %a0,(%a1) -#endif - jbra epilogue - -retstruct1: - btst #6,%d2 - jbeq retstruct2 - move.b %d0,(%a1) - jbra epilogue - -retstruct2: - btst #7,%d2 - jbeq retsint8 - move.w %d0,(%a1) - jbra epilogue - -retsint8: - btst #8,%d2 - jbeq retsint16 - | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. -#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) - ext.w %d0 - ext.l %d0 -#else - extb.l %d0 -#endif - move.l %d0,(%a1) - jbra epilogue - -retsint16: - btst #9,%d2 - jbeq noretval - ext.l %d0 - move.l %d0,(%a1) - -noretval: -epilogue: - move.l (%sp)+,%d2 - unlk %fp - rts - CFI_ENDPROC() - .size CALLFUNC(ffi_call_SYSV),.-CALLFUNC(ffi_call_SYSV) - - .globl CALLFUNC(ffi_closure_SYSV) - .type CALLFUNC(ffi_closure_SYSV), @function - .align 4 - -CALLFUNC(ffi_closure_SYSV): - CFI_STARTPROC() - link %fp,#-12 - CFI_OFFSET(14,-8) - CFI_DEF_CFA(14,8) - move.l %sp,-12(%fp) - pea 8(%fp) - pea -12(%fp) - move.l %a0,-(%sp) -#if !defined __PIC__ - jsr CALLFUNC(ffi_closure_SYSV_inner) -#else - bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC) -#endif - - lsr.l #1,%d0 - jne 1f - jcc .Lcls_epilogue - | CIF_FLAGS_INT - move.l -12(%fp),%d0 -.Lcls_epilogue: - | no CIF_FLAGS_* - unlk %fp - rts -1: - lea -12(%fp),%a0 - lsr.l #2,%d0 - jne 1f - jcs .Lcls_ret_float - | CIF_FLAGS_DINT - move.l (%a0)+,%d0 - move.l (%a0),%d1 - jra .Lcls_epilogue -.Lcls_ret_float: -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.s (%a0),%fp0 -#else - move.l (%a0),%d0 -#endif - jra .Lcls_epilogue -1: - lsr.l #2,%d0 - jne 1f - jcs .Lcls_ret_ldouble - | CIF_FLAGS_DOUBLE -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.d (%a0),%fp0 -#else - move.l (%a0)+,%d0 - move.l (%a0),%d1 -#endif - jra .Lcls_epilogue -.Lcls_ret_ldouble: -#if defined(__MC68881__) || defined(__HAVE_68881__) - fmove.x (%a0),%fp0 -#else - move.l (%a0)+,%d0 - move.l (%a0)+,%d1 - move.l (%a0),%d2 -#endif - jra .Lcls_epilogue -1: - lsr.l #2,%d0 - jne 1f - jcs .Lcls_ret_struct1 - | CIF_FLAGS_POINTER - move.l (%a0),%a0 - move.l %a0,%d0 - jra .Lcls_epilogue -.Lcls_ret_struct1: - move.b (%a0),%d0 - jra .Lcls_epilogue -1: - lsr.l #2,%d0 - jne 1f - jcs .Lcls_ret_sint8 - | CIF_FLAGS_STRUCT2 - move.w (%a0),%d0 - jra .Lcls_epilogue -.Lcls_ret_sint8: - move.l (%a0),%d0 - | NOTE: On the mc68000, extb is not supported. 8->16, then 16->32. -#if !defined(__mc68020__) && !defined(__mc68030__) && !defined(__mc68040__) && !defined(__mc68060__) && !defined(__mcoldfire__) - ext.w %d0 - ext.l %d0 -#else - extb.l %d0 -#endif - jra .Lcls_epilogue -1: - | CIF_FLAGS_SINT16 - move.l (%a0),%d0 - ext.l %d0 - jra .Lcls_epilogue - CFI_ENDPROC() - - .size CALLFUNC(ffi_closure_SYSV),.-CALLFUNC(ffi_closure_SYSV) - - .globl CALLFUNC(ffi_closure_struct_SYSV) - .type CALLFUNC(ffi_closure_struct_SYSV), @function - .align 4 - -CALLFUNC(ffi_closure_struct_SYSV): - CFI_STARTPROC() - link %fp,#0 - CFI_OFFSET(14,-8) - CFI_DEF_CFA(14,8) - move.l %sp,-12(%fp) - pea 8(%fp) - move.l %a1,-(%sp) - move.l %a0,-(%sp) -#if !defined __PIC__ - jsr CALLFUNC(ffi_closure_SYSV_inner) -#else - bsr.l CALLFUNC(ffi_closure_SYSV_inner@PLTPC) -#endif - unlk %fp - rts - CFI_ENDPROC() - .size CALLFUNC(ffi_closure_struct_SYSV),.-CALLFUNC(ffi_closure_struct_SYSV) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/m88k/ffi.c b/llgo/third_party/gofrontend/libffi/src/m88k/ffi.c deleted file mode 100644 index 68df494955e49f3b2c6c2e60e311c4bca495226e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m88k/ffi.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * m88k Foreign Function Interface - * - * This file attempts to provide all the FFI entry points which can reliably - * be implemented in C. - * - * Only OpenBSD/m88k is currently supported; other platforms (such as - * Motorola's SysV/m88k) could be supported with the following tweaks: - * - * - non-OpenBSD systems use an `outgoing parameter area' as part of the - * 88BCS calling convention, which is not supported under OpenBSD from - * release 3.6 onwards. Supporting it should be as easy as taking it - * into account when adjusting the stack, in the assembly code. - * - * - the logic deciding whether a function argument gets passed through - * registers, or on the stack, has changed several times in OpenBSD in - * edge cases (especially for structs larger than 32 bytes being passed - * by value). The code below attemps to match the logic used by the - * system compiler of OpenBSD 5.3, i.e. gcc 3.3.6 with many m88k backend - * fixes. - */ - -#include -#include - -#include -#include - -void ffi_call_OBSD (unsigned int, extended_cif *, unsigned int, void *, - void (*fn) ()); -void *ffi_prep_args (void *, extended_cif *); -void ffi_closure_OBSD (ffi_closure *); -void ffi_closure_struct_OBSD (ffi_closure *); -unsigned int ffi_closure_OBSD_inner (ffi_closure *, void *, unsigned int *, - char *); -void ffi_cacheflush_OBSD (unsigned int, unsigned int); - -#define CIF_FLAGS_INT (1 << 0) -#define CIF_FLAGS_DINT (1 << 1) - -/* - * Foreign Function Interface API - */ - -/* ffi_prep_args is called by the assembly routine once stack space has - been allocated for the function's arguments. */ - -void * -ffi_prep_args (void *stack, extended_cif *ecif) -{ - unsigned int i; - void **p_argv; - char *argp, *stackp; - unsigned int *regp; - unsigned int regused; - ffi_type **p_arg; - void *struct_value_ptr; - - regp = (unsigned int *)stack; - stackp = (char *)(regp + 8); - regused = 0; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT - && !ecif->cif->flags) - struct_value_ptr = ecif->rvalue; - else - struct_value_ptr = NULL; - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) - { - size_t z; - unsigned short t, a; - - z = (*p_arg)->size; - t = (*p_arg)->type; - a = (*p_arg)->alignment; - - /* - * Figure out whether the argument can be passed through registers - * or on the stack. - * The rule is that registers can only receive simple types not larger - * than 64 bits, or structs the exact size of a register and aligned to - * the size of a register. - */ - if (t == FFI_TYPE_STRUCT) - { - if (z == sizeof (int) && a == sizeof (int) && regused < 8) - argp = (char *)regp; - else - argp = stackp; - } - else - { - if (z > sizeof (int) && regused < 8 - 1) - { - /* align to an even register pair */ - if (regused & 1) - { - regp++; - regused++; - } - } - if (regused < 8) - argp = (char *)regp; - else - argp = stackp; - } - - /* Enforce proper stack alignment of 64-bit types */ - if (argp == stackp && a > sizeof (int)) - { - stackp = (char *) ALIGN(stackp, a); - argp = stackp; - } - - switch (t) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_FLOAT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - *(unsigned int *) argp = *(unsigned int *) *p_argv; - break; - - case FFI_TYPE_DOUBLE: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_STRUCT: - memcpy (argp, *p_argv, z); - break; - - default: - FFI_ASSERT (0); - } - - /* Align if necessary. */ - if ((sizeof (int) - 1) & z) - z = ALIGN(z, sizeof (int)); - - p_argv++; - - /* Be careful, once all registers are filled, and about to continue - on stack, regp == stackp. Therefore the check for regused as well. */ - if (argp == (char *)regp && regused < 8) - { - regp += z / sizeof (int); - regused += z / sizeof (int); - } - else - stackp += z; - } - - return struct_value_ptr; -} - -/* Perform machine dependent cif processing */ -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = 0; - break; - - case FFI_TYPE_STRUCT: - if (cif->rtype->size == sizeof (int) && - cif->rtype->alignment == sizeof (int)) - cif->flags = CIF_FLAGS_INT; - else - cif->flags = 0; - break; - - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = CIF_FLAGS_DINT; - break; - - default: - cif->flags = CIF_FLAGS_INT; - break; - } - - return FFI_OK; -} - -void -ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return value - address then we need to make one. */ - - if (rvalue == NULL - && cif->rtype->type == FFI_TYPE_STRUCT - && (cif->rtype->size != sizeof (int) - || cif->rtype->alignment != sizeof (int))) - ecif.rvalue = alloca (cif->rtype->size); - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_OBSD: - ffi_call_OBSD (cif->bytes, &ecif, cif->flags, ecif.rvalue, fn); - break; - - default: - FFI_ASSERT (0); - break; - } -} - -/* - * Closure API - */ - -static void -ffi_prep_closure_args_OBSD (ffi_cif *cif, void **avalue, unsigned int *regp, - char *stackp) -{ - unsigned int i; - void **p_argv; - char *argp; - unsigned int regused; - ffi_type **p_arg; - - regused = 0; - - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) - { - size_t z; - unsigned short t, a; - - z = (*p_arg)->size; - t = (*p_arg)->type; - a = (*p_arg)->alignment; - - /* - * Figure out whether the argument has been passed through registers - * or on the stack. - * The rule is that registers can only receive simple types not larger - * than 64 bits, or structs the exact size of a register and aligned to - * the size of a register. - */ - if (t == FFI_TYPE_STRUCT) - { - if (z == sizeof (int) && a == sizeof (int) && regused < 8) - argp = (char *)regp; - else - argp = stackp; - } - else - { - if (z > sizeof (int) && regused < 8 - 1) - { - /* align to an even register pair */ - if (regused & 1) - { - regp++; - regused++; - } - } - if (regused < 8) - argp = (char *)regp; - else - argp = stackp; - } - - /* Enforce proper stack alignment of 64-bit types */ - if (argp == stackp && a > sizeof (int)) - { - stackp = (char *) ALIGN(stackp, a); - argp = stackp; - } - - if (z < sizeof (int) && t != FFI_TYPE_STRUCT) - *p_argv = (void *) (argp + sizeof (int) - z); - else - *p_argv = (void *) argp; - - /* Align if necessary */ - if ((sizeof (int) - 1) & z) - z = ALIGN(z, sizeof (int)); - - p_argv++; - - /* Be careful, once all registers are exhausted, and about to fetch from - stack, regp == stackp. Therefore the check for regused as well. */ - if (argp == (char *)regp && regused < 8) - { - regp += z / sizeof (int); - regused += z / sizeof (int); - } - else - stackp += z; - } -} - -unsigned int -ffi_closure_OBSD_inner (ffi_closure *closure, void *resp, unsigned int *regp, - char *stackp) -{ - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void *)); - - ffi_prep_closure_args_OBSD(cif, arg_area, regp, stackp); - - (closure->fun) (cif, resp, arg_area, closure->user_data); - - return cif->flags; -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, void *codeloc) -{ - unsigned int *tramp = (unsigned int *) codeloc; - void *fn; - - FFI_ASSERT (cif->abi == FFI_OBSD); - - if (cif->rtype->type == FFI_TYPE_STRUCT && !cif->flags) - fn = &ffi_closure_struct_OBSD; - else - fn = &ffi_closure_OBSD; - - /* or.u %r10, %r0, %hi16(fn) */ - tramp[0] = 0x5d400000 | (((unsigned int)fn) >> 16); - /* or.u %r13, %r0, %hi16(closure) */ - tramp[1] = 0x5da00000 | ((unsigned int)closure >> 16); - /* or %r10, %r10, %lo16(fn) */ - tramp[2] = 0x594a0000 | (((unsigned int)fn) & 0xffff); - /* jmp.n %r10 */ - tramp[3] = 0xf400c40a; - /* or %r13, %r13, %lo16(closure) */ - tramp[4] = 0x59ad0000 | ((unsigned int)closure & 0xffff); - - ffi_cacheflush_OBSD((unsigned int)codeloc, FFI_TRAMPOLINE_SIZE); - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/m88k/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/m88k/ffitarget.h deleted file mode 100644 index e52bf9fa30a487468013fce1f2005f63a194fe89..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m88k/ffitarget.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * m88k Foreign Function Interface - */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_OBSD, - FFI_DEFAULT_ABI = FFI_OBSD, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 0x14 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/m88k/obsd.S b/llgo/third_party/gofrontend/libffi/src/m88k/obsd.S deleted file mode 100644 index 1944a23de424594a92cb39b4258357f6a4a1e789..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/m88k/obsd.S +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * m88k Foreign Function Interface - */ - -#define LIBFFI_ASM -#include -#include - - .text - -/* - * ffi_cacheflush_OBSD(unsigned int addr, %r2 - * unsigned int size); %r3 - */ - .align 4 - .globl ffi_cacheflush_OBSD - .type ffi_cacheflush_OBSD,@function -ffi_cacheflush_OBSD: - tb0 0, %r0, 451 - or %r0, %r0, %r0 - jmp %r1 - .size ffi_cacheflush_OBSD, . - ffi_cacheflush_OBSD - -/* - * ffi_call_OBSD(unsigned bytes, %r2 - * extended_cif *ecif, %r3 - * unsigned flags, %r4 - * void *rvalue, %r5 - * void (*fn)()); %r6 - */ - .align 4 - .globl ffi_call_OBSD - .type ffi_call_OBSD,@function -ffi_call_OBSD: - subu %r31, %r31, 32 - st %r30, %r31, 4 - st %r1, %r31, 0 - addu %r30, %r31, 32 - - | Save the few arguments we'll need after ffi_prep_args() - st.d %r4, %r31, 8 - st %r6, %r31, 16 - - | Allocate room for the image of r2-r9, and the stack space for - | the args (rounded to a 16-byte boundary) - addu %r2, %r2, (8 * 4) + 15 - clr %r2, %r2, 4<0> - subu %r31, %r31, %r2 - - | Fill register and stack image - or %r2, %r31, %r0 -#ifdef PIC - bsr ffi_prep_args#plt -#else - bsr ffi_prep_args -#endif - - | Save pointer to return struct address, if any - or %r12, %r2, %r0 - - | Get function pointer - subu %r4, %r30, 32 - ld %r1, %r4, 16 - - | Fetch the register arguments - ld.d %r2, %r31, (0 * 4) - ld.d %r4, %r31, (2 * 4) - ld.d %r6, %r31, (4 * 4) - ld.d %r8, %r31, (6 * 4) - addu %r31, %r31, (8 * 4) - - | Invoke the function - jsr %r1 - - | Restore stack now that we don't need the args anymore - subu %r31, %r30, 32 - - | Figure out what to return as the function's return value - ld %r5, %r31, 12 | rvalue - ld %r4, %r31, 8 | flags - - bcnd eq0, %r5, 9f - - bb0 0, %r4, 1f | CIF_FLAGS_INT - st %r2, %r5, 0 - br 9f - -1: - bb0 1, %r4, 1f | CIF_FLAGS_DINT - st.d %r2, %r5, 0 - br 9f - -1: -9: - ld %r1, %r31, 0 - ld %r30, %r31, 4 - jmp.n %r1 - addu %r31, %r31, 32 - .size ffi_call_OBSD, . - ffi_call_OBSD - -/* - * ffi_closure_OBSD(ffi_closure *closure); %r13 - */ - .align 4 - .globl ffi_closure_OBSD - .type ffi_closure_OBSD, @function -ffi_closure_OBSD: - subu %r31, %r31, 16 - st %r30, %r31, 4 - st %r1, %r31, 0 - addu %r30, %r31, 16 - - | Make room on the stack for saved register arguments and return - | value - subu %r31, %r31, (8 * 4) + (2 * 4) - st.d %r2, %r31, (0 * 4) - st.d %r4, %r31, (2 * 4) - st.d %r6, %r31, (4 * 4) - st.d %r8, %r31, (6 * 4) - - | Invoke the closure function - or %r5, %r30, 0 | calling stack - addu %r4, %r31, 0 | saved registers - addu %r3, %r31, (8 * 4) | return value - or %r2, %r13, %r0 | closure -#ifdef PIC - bsr ffi_closure_OBSD_inner#plt -#else - bsr ffi_closure_OBSD_inner -#endif - - | Figure out what to return as the function's return value - bb0 0, %r2, 1f | CIF_FLAGS_INT - ld %r2, %r31, (8 * 4) - br 9f - -1: - bb0 1, %r2, 1f | CIF_FLAGS_DINT - ld.d %r2, %r31, (8 * 4) - br 9f - -1: -9: - subu %r31, %r30, 16 - ld %r1, %r31, 0 - ld %r30, %r31, 4 - jmp.n %r1 - addu %r31, %r31, 16 - .size ffi_closure_OBSD,.-ffi_closure_OBSD - -/* - * ffi_closure_struct_OBSD(ffi_closure *closure); %r13 - */ - .align 4 - .globl ffi_closure_struct_OBSD - .type ffi_closure_struct_OBSD, @function -ffi_closure_struct_OBSD: - subu %r31, %r31, 16 - st %r30, %r31, 4 - st %r1, %r31, 0 - addu %r30, %r31, 16 - - | Make room on the stack for saved register arguments - subu %r31, %r31, (8 * 4) - st.d %r2, %r31, (0 * 4) - st.d %r4, %r31, (2 * 4) - st.d %r6, %r31, (4 * 4) - st.d %r8, %r31, (6 * 4) - - | Invoke the closure function - or %r5, %r30, 0 | calling stack - addu %r4, %r31, 0 | saved registers - or %r3, %r12, 0 | return value - or %r2, %r13, %r0 | closure -#ifdef PIC - bsr ffi_closure_OBSD_inner#plt -#else - bsr ffi_closure_OBSD_inner -#endif - - subu %r31, %r30, 16 - ld %r1, %r31, 0 - ld %r30, %r31, 4 - jmp.n %r1 - addu %r31, %r31, 16 - .size ffi_closure_struct_OBSD,.-ffi_closure_struct_OBSD diff --git a/llgo/third_party/gofrontend/libffi/src/metag/ffi.c b/llgo/third_party/gofrontend/libffi/src/metag/ffi.c deleted file mode 100644 index 46b383e7a3c4486d466916abeccf4b3ba30be148..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/metag/ffi.c +++ /dev/null @@ -1,330 +0,0 @@ -/* ---------------------------------------------------------------------- - ffi.c - Copyright (c) 2013 Imagination Technologies - - Meta Foreign Function Interface - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - `Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED `AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------------ */ - -#include -#include - -#include - -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - -/* - * ffi_prep_args is called by the assembly routine once stack space has been - * allocated for the function's arguments - */ - -unsigned int ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - argp = stack; - - /* Store return value */ - if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { - argp -= 4; - *(void **) argp = ecif->rvalue; - } - - p_argv = ecif->avalue; - - /* point to next location */ - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++, p_argv++) - { - size_t z; - - /* Move argp to address of argument */ - z = (*p_arg)->size; - argp -= z; - - /* Align if necessary */ - argp = (char *) ALIGN_DOWN(ALIGN_DOWN(argp, (*p_arg)->alignment), 4); - - if (z < sizeof(int)) { - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - case FFI_TYPE_STRUCT: - memcpy(argp, *p_argv, (*p_arg)->size); - break; - default: - FFI_ASSERT(0); - } - } else if ( z == sizeof(int)) { - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - } else { - memcpy(argp, *p_argv, z); - } - } - - /* return the size of the arguments to be passed in registers, - padded to an 8 byte boundary to preserve stack alignment */ - return ALIGN(MIN(stack - argp, 6*4), 8); -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - ffi_type **ptr; - unsigned i, bytes = 0; - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { - if ((*ptr)->size == 0) - return FFI_BAD_TYPEDEF; - - /* Perform a sanity check on the argument type, do this - check after the initialization. */ - FFI_ASSERT_VALID_TYPE(*ptr); - - /* Add any padding if necessary */ - if (((*ptr)->alignment - 1) & bytes) - bytes = ALIGN(bytes, (*ptr)->alignment); - - bytes += ALIGN((*ptr)->size, 4); - } - - /* Ensure arg space is aligned to an 8-byte boundary */ - bytes = ALIGN(bytes, 8); - - /* Make space for the return structure pointer */ - if (cif->rtype->type == FFI_TYPE_STRUCT) { - bytes += sizeof(void*); - - /* Ensure stack is aligned to an 8-byte boundary */ - bytes = ALIGN(bytes, 8); - } - - cif->bytes = bytes; - - /* Set the return type flag */ - switch (cif->rtype->type) { - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags = (unsigned) cif->rtype->type; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = (unsigned) FFI_TYPE_SINT64; - break; - case FFI_TYPE_STRUCT: - /* Meta can store return values which are <= 64 bits */ - if (cif->rtype->size <= 4) - /* Returned to D0Re0 as 32-bit value */ - cif->flags = (unsigned)FFI_TYPE_INT; - else if ((cif->rtype->size > 4) && (cif->rtype->size <= 8)) - /* Returned valued is stored to D1Re0|R0Re0 */ - cif->flags = (unsigned)FFI_TYPE_DOUBLE; - else - /* value stored in memory */ - cif->flags = (unsigned)FFI_TYPE_STRUCT; - break; - default: - cif->flags = (unsigned)FFI_TYPE_INT; - break; - } - return FFI_OK; -} - -extern void ffi_call_SYSV(void (*fn)(void), extended_cif *, unsigned, unsigned, double *); - -/* - * Exported in API. Entry point - * cif -> ffi_cif object - * fn -> function pointer - * rvalue -> pointer to return value - * avalue -> vector of void * pointers pointing to memory locations holding the - * arguments - */ -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - int small_struct = (((cif->flags == FFI_TYPE_INT) || (cif->flags == FFI_TYPE_DOUBLE)) && (cif->rtype->type == FFI_TYPE_STRUCT)); - ecif.cif = cif; - ecif.avalue = avalue; - - double temp; - - /* - * If the return value is a struct and we don't have a return value address - * then we need to make one - */ - - if ((rvalue == NULL ) && (cif->flags == FFI_TYPE_STRUCT)) - ecif.rvalue = alloca(cif->rtype->size); - else if (small_struct) - ecif.rvalue = &temp; - else - ecif.rvalue = rvalue; - - switch (cif->abi) { - case FFI_SYSV: - ffi_call_SYSV(fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); - break; - default: - FFI_ASSERT(0); - break; - } - - if (small_struct) - memcpy (rvalue, &temp, cif->rtype->size); -} - -/* private members */ - -static void ffi_prep_incoming_args_SYSV (char *, void **, void **, - ffi_cif*, float *); - -void ffi_closure_SYSV (ffi_closure *); - -/* Do NOT change that without changing the FFI_TRAMPOLINE_SIZE */ -extern unsigned int ffi_metag_trampoline[10]; /* 10 instructions */ - -/* end of private members */ - -/* - * __tramp: trampoline memory location - * __fun: assembly routine - * __ctx: memory location for wrapper - * - * At this point, tramp[0] == __ctx ! - */ -void ffi_init_trampoline(unsigned char *__tramp, unsigned int __fun, unsigned int __ctx) { - memcpy (__tramp, ffi_metag_trampoline, sizeof(ffi_metag_trampoline)); - *(unsigned int*) &__tramp[40] = __ctx; - *(unsigned int*) &__tramp[44] = __fun; - /* This will flush the instruction cache */ - __builtin_meta2_cachewd(&__tramp[0], 1); - __builtin_meta2_cachewd(&__tramp[47], 1); -} - - - -/* the cif must already be prepared */ - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - void (*closure_func)(ffi_closure*) = NULL; - - if (cif->abi == FFI_SYSV) - closure_func = &ffi_closure_SYSV; - else - return FFI_BAD_ABI; - - ffi_init_trampoline( - (unsigned char*)&closure->tramp[0], - (unsigned int)closure_func, - (unsigned int)codeloc); - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} - - -/* This function is jumped to by the trampoline */ -unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) - ffi_closure *closure; - void **respp; - void *args; - void *vfp_args; -{ - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); - - /* - * This call will initialize ARG_AREA, such that each - * element in that array points to the corresponding - * value on the stack; and if the function returns - * a structure, it will re-set RESP to point to the - * structure return address. - */ - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); - - (closure->fun) ( cif, *respp, arg_area, closure->user_data); - - return cif->flags; -} - -static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, - void **avalue, ffi_cif *cif, - float *vfp_stack) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - /* stack points to original arguments */ - argp = stack; - - /* Store return value */ - if ( cif->flags == FFI_TYPE_STRUCT ) { - argp -= 4; - *rvalue = *(void **) argp; - } - - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { - size_t z; - size_t alignment; - - alignment = (*p_arg)->alignment; - if (alignment < 4) - alignment = 4; - if ((alignment - 1) & (unsigned)argp) - argp = (char *) ALIGN(argp, alignment); - - z = (*p_arg)->size; - *p_argv = (void*) argp; - p_argv++; - argp -= z; - } - return; -} diff --git a/llgo/third_party/gofrontend/libffi/src/metag/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/metag/ffitarget.h deleted file mode 100644 index 7b9dbebca86919d20f0c7901343d5279b4a642ca..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/metag/ffitarget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2013 Imagination Technologies Ltd. - Target configuration macros for Meta - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_DEFAULT_ABI = FFI_SYSV, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1, -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 48 -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/metag/sysv.S b/llgo/third_party/gofrontend/libffi/src/metag/sysv.S deleted file mode 100644 index b4b2a3b26bbfbdcdc9cf5ffb6c69d4388598feab..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/metag/sysv.S +++ /dev/null @@ -1,311 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2013 Imagination Technologies Ltd. - - Meta Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -#ifdef __USER_LABEL_PREFIX__ -#define CONCAT1(a, b) CONCAT2(a, b) -#define CONCAT2(a, b) a ## b - -/* Use the right prefix for global labels. */ -#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) -#else -#define CNAME(x) x -#endif -#define ENTRY(x) .globl CNAME(x); .type CNAME(x), %function; CNAME(x): -#endif - -#ifdef __ELF__ -#define LSYM(x) .x -#else -#define LSYM(x) x -#endif - -.macro call_reg x= - .text - .balign 4 - mov D1RtP, \x - swap D1RtP, PC -.endm - -! Save register arguments -.macro SAVE_ARGS - .text - .balign 4 - setl [A0StP++], D0Ar6, D1Ar5 - setl [A0StP++], D0Ar4, D1Ar3 - setl [A0StP++], D0Ar2, D1Ar1 -.endm - -! Save retrun, frame pointer and other regs -.macro SAVE_REGS regs= - .text - .balign 4 - setl [A0StP++], D0FrT, D1RtP - ! Needs to be a pair of regs - .ifnc "\regs","" - setl [A0StP++], \regs - .endif -.endm - -! Declare a global function -.macro METAG_FUNC_START name - .text - .balign 4 - ENTRY(\name) -.endm - -! Return registers from the stack. Reverse SAVE_REGS operation -.macro RET_REGS regs=, cond= - .ifnc "\regs", "" - getl \regs, [--A0StP] - .endif - getl D0FrT, D1RtP, [--A0StP] -.endm - -! Return arguments -.macro RET_ARGS - getl D0Ar2, D1Ar1, [--A0StP] - getl D0Ar4, D1Ar3, [--A0StP] - getl D0Ar6, D1Ar5, [--A0StP] -.endm - - - ! D1Ar1: fn - ! D0Ar2: &ecif - ! D1Ar3: cif->bytes - ! D0Ar4: fig->flags - ! D1Ar5: ecif.rvalue - - ! This assumes we are using GNU as -METAG_FUNC_START ffi_call_SYSV - ! Save argument registers - - SAVE_ARGS - - ! new frame - mov D0FrT, A0FrP - add A0FrP, A0StP, #0 - - ! Preserve the old frame pointer - SAVE_REGS "D1.5, D0.5" - - ! Make room for new args. cifs->bytes is the total space for input - ! and return arguments - - add A0StP, A0StP, D1Ar3 - - ! Preserve cifs->bytes & fn - mov D0.5, D1Ar3 - mov D1.5, D1Ar1 - - ! Place all of the ffi_prep_args in position - mov D1Ar1, A0StP - - ! Call ffi_prep_args(stack, &ecif) -#ifdef __PIC__ - callr D1RtP, CNAME(ffi_prep_args@PLT) -#else - callr D1RtP, CNAME(ffi_prep_args) -#endif - - ! Restore fn pointer - - ! The foreign stack should look like this - ! XXXXX XXXXXX <--- stack pointer - ! FnArgN rvalue - ! FnArgN+2 FnArgN+1 - ! FnArgN+4 FnArgN+3 - ! .... - ! - - ! A0StP now points to the first (or return) argument + 4 - - ! Preserve cif->bytes - getl D0Ar2, D1Ar1, [--A0StP] - getl D0Ar4, D1Ar3, [--A0StP] - getl D0Ar6, D1Ar5, [--A0StP] - - ! Place A0StP to the first argument again - add A0StP, A0StP, #24 ! That's because we loaded 6 regs x 4 byte each - - ! A0FrP points to the initial stack without the reserved space for the - ! cifs->bytes, whilst A0StP points to the stack after the space allocation - - ! fn was the first argument of ffi_call_SYSV. - ! The stack at this point looks like this: - ! - ! A0StP(on entry to _SYSV) -> Arg6 Arg5 | low - ! Arg4 Arg3 | - ! Arg2 Arg1 | - ! A0FrP ----> D0FrtP D1RtP | - ! D1.5 D0.5 | - ! A0StP(bf prep_args) -> FnArgn FnArgn-1 | - ! FnArgn-2FnArgn-3 | - ! ................ | <= cifs->bytes - ! FnArg4 FnArg3 | - ! A0StP (prv_A0StP+cifs->bytes) FnArg2 FnArg1 | high - ! - ! fn was in Arg1 so it's located in in A0FrP+#-0xC - ! - - ! D0Re0 contains the size of arguments stored in registers - sub A0StP, A0StP, D0Re0 - - ! Arg1 is the function pointer for the foreign call. This has been - ! preserved in D1.5 - - ! Time to call (fn). Arguments should be like this: - ! Arg1-Arg6 are loaded to regs - ! The rest of the arguments are stored in stack pointed by A0StP - - call_reg D1.5 - - ! Reset stack. - - mov A0StP, A0FrP - - ! Load Arg1 with the pointer to storage for the return type - ! This was stored in Arg5 - - getd D1Ar1, [A0FrP+#-20] - - ! Load D0Ar2 with the return type code. This was stored in Arg4 (flags) - - getd D0Ar2, [A0FrP+#-16] - - ! We are ready to start processing the return value - ! D0Re0 (and D1Re0) hold the return value - - ! If the return value is NULL, assume no return value - cmp D1Ar1, #0 - beq LSYM(Lepilogue) - - ! return INT - cmp D0Ar2, #FFI_TYPE_INT - ! Sadly, there is no setd{cc} instruction so we need to workaround that - bne .INT64 - setd [D1Ar1], D0Re0 - b LSYM(Lepilogue) - - ! return INT64 -.INT64: - cmp D0Ar2, #FFI_TYPE_SINT64 - setleq [D1Ar1], D0Re0, D1Re0 - - ! return DOUBLE - cmp D0Ar2, #FFI_TYPE_DOUBLE - setl [D1AR1++], D0Re0, D1Re0 - -LSYM(Lepilogue): - ! At this point, the stack pointer points right after the argument - ! saved area. We need to restore 4 regs, therefore we need to move - ! 16 bytes ahead. - add A0StP, A0StP, #16 - RET_REGS "D1.5, D0.5" - RET_ARGS - getd D0Re0, [A0StP] - mov A0FrP, D0FrT - swap D1RtP, PC - -.ffi_call_SYSV_end: - .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) - - -/* - (called by ffi_metag_trampoline) - void ffi_closure_SYSV (ffi_closure*) - - (called by ffi_closure_SYSV) - unsigned int FFI_HIDDEN - ffi_closure_SYSV_inner (closure,respp, args) - ffi_closure *closure; - void **respp; - void *args; -*/ - -METAG_FUNC_START ffi_closure_SYSV - ! We assume that D1Ar1 holds the address of the - ! ffi_closure struct. We will use that to fetch the - ! arguments. The stack pointer points to an empty space - ! and it is ready to store more data. - - ! D1Ar1 is ready - ! Allocate stack space for return value - add A0StP, A0StP, #8 - ! Store it to D0Ar2 - sub D0Ar2, A0StP, #8 - - sub D1Ar3, A0FrP, #4 - - ! D1Ar3 contains the address of the original D1Ar1 argument - ! We need to subtract #4 later on - - ! Preverve D0Ar2 - mov D0.5, D0Ar2 - -#ifdef __PIC__ - callr D1RtP, CNAME(ffi_closure_SYSV_inner@PLT) -#else - callr D1RtP, CNAME(ffi_closure_SYSV_inner) -#endif - - ! Check the return value and store it to D0.5 - cmp D0Re0, #FFI_TYPE_INT - beq .Lretint - cmp D0Re0, #FFI_TYPE_DOUBLE - beq .Lretdouble -.Lclosure_epilogue: - sub A0StP, A0StP, #8 - RET_REGS "D1.5, D0.5" - RET_ARGS - swap D1RtP, PC - -.Lretint: - setd [D0.5], D0Re0 - b .Lclosure_epilogue -.Lretdouble: - setl [D0.5++], D0Re0, D1Re0 - b .Lclosure_epilogue -.ffi_closure_SYSV_end: -.size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - - -ENTRY(ffi_metag_trampoline) - SAVE_ARGS - ! New frame - mov A0FrP, A0StP - SAVE_REGS "D1.5, D0.5" - mov D0.5, PC - ! Load D1Ar1 the value of ffi_metag_trampoline - getd D1Ar1, [D0.5 + #8] - ! Jump to ffi_closure_SYSV - getd PC, [D0.5 + #12] diff --git a/llgo/third_party/gofrontend/libffi/src/microblaze/ffi.c b/llgo/third_party/gofrontend/libffi/src/microblaze/ffi.c deleted file mode 100644 index ea962ea4837d76693f7e6e85787a573bbfe90374..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/microblaze/ffi.c +++ /dev/null @@ -1,321 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2012, 2013 Xilinx, Inc - - MicroBlaze Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -extern void ffi_call_SYSV(void (*)(void*, extended_cif*), extended_cif*, - unsigned int, unsigned int, unsigned int*, void (*fn)(void), - unsigned int, unsigned int); - -extern void ffi_closure_SYSV(void); - -#define WORD_SIZE sizeof(unsigned int) -#define ARGS_REGISTER_SIZE (WORD_SIZE * 6) -#define WORD_ALIGN(x) ALIGN(x, WORD_SIZE) - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ -void ffi_prep_args(void* stack, extended_cif* ecif) -{ - unsigned int i; - ffi_type** p_arg; - void** p_argv; - void* stack_args_p = stack; - - p_argv = ecif->avalue; - - if (ecif == NULL || ecif->cif == NULL) { - return; /* no description to prepare */ - } - - if ((ecif->cif->rtype != NULL) && - (ecif->cif->rtype->type == FFI_TYPE_STRUCT)) - { - /* if return type is a struct which is referenced on the stack/reg5, - * by a pointer. Stored the return value pointer in r5. - */ - char* addr = stack_args_p; - memcpy(addr, &(ecif->rvalue), WORD_SIZE); - stack_args_p += WORD_SIZE; - } - - if (ecif->avalue == NULL) { - return; /* no arguments to prepare */ - } - - for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; - i++, p_arg++) - { - size_t size = (*p_arg)->size; - int type = (*p_arg)->type; - void* value = p_argv[i]; - char* addr = stack_args_p; - int aligned_size = WORD_ALIGN(size); - - /* force word alignment on the stack */ - stack_args_p += aligned_size; - - switch (type) - { - case FFI_TYPE_UINT8: - *(unsigned int *)addr = (unsigned int)*(UINT8*)(value); - break; - case FFI_TYPE_SINT8: - *(signed int *)addr = (signed int)*(SINT8*)(value); - break; - case FFI_TYPE_UINT16: - *(unsigned int *)addr = (unsigned int)*(UINT16*)(value); - break; - case FFI_TYPE_SINT16: - *(signed int *)addr = (signed int)*(SINT16*)(value); - break; - case FFI_TYPE_STRUCT: -#if __BIG_ENDIAN__ - /* - * MicroBlaze toolchain appears to emit: - * bsrli r5, r5, 8 (caller) - * ... - * - * ... - * bslli r5, r5, 8 (callee) - * - * For structs like "struct a { uint8_t a[3]; };", when passed - * by value. - * - * Structs like "struct b { uint16_t a; };" are also expected - * to be packed strangely in registers. - * - * This appears to be because the microblaze toolchain expects - * "struct b == uint16_t", which is only any issue for big - * endian. - * - * The following is a work around for big-endian only, for the - * above mentioned case, it will re-align the contents of a - * <= 3-byte struct value. - */ - if (size < WORD_SIZE) - { - memcpy (addr + (WORD_SIZE - size), value, size); - break; - } -#endif - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - default: - memcpy(addr, value, aligned_size); - } - } -} - -ffi_status ffi_prep_cif_machdep(ffi_cif* cif) -{ - /* check ABI */ - switch (cif->abi) - { - case FFI_SYSV: - break; - default: - return FFI_BAD_ABI; - } - return FFI_OK; -} - -void ffi_call(ffi_cif* cif, void (*fn)(void), void* rvalue, void** avalue) -{ - extended_cif ecif; - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { - ecif.rvalue = alloca(cif->rtype->size); - } else { - ecif.rvalue = rvalue; - } - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn, cif->rtype->type, cif->rtype->size); - break; - default: - FFI_ASSERT(0); - break; - } -} - -void ffi_closure_call_SYSV(void* register_args, void* stack_args, - ffi_closure* closure, void* rvalue, - unsigned int* rtype, unsigned int* rsize) -{ - /* prepare arguments for closure call */ - ffi_cif* cif = closure->cif; - ffi_type** arg_types = cif->arg_types; - - /* re-allocate data for the args. This needs to be done in order to keep - * multi-word objects (e.g. structs) in contiguous memory. Callers are not - * required to store the value of args in the lower 6 words in the stack - * (although they are allocated in the stack). - */ - char* stackclone = alloca(cif->bytes); - void** avalue = alloca(cif->nargs * sizeof(void*)); - void* struct_rvalue = NULL; - char* ptr = stackclone; - int i; - - /* copy registers into stack clone */ - int registers_used = cif->bytes; - if (registers_used > ARGS_REGISTER_SIZE) { - registers_used = ARGS_REGISTER_SIZE; - } - memcpy(stackclone, register_args, registers_used); - - /* copy stack allocated args into stack clone */ - if (cif->bytes > ARGS_REGISTER_SIZE) { - int stack_used = cif->bytes - ARGS_REGISTER_SIZE; - memcpy(stackclone + ARGS_REGISTER_SIZE, stack_args, stack_used); - } - - /* preserve struct type return pointer passing */ - if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { - struct_rvalue = *((void**)ptr); - ptr += WORD_SIZE; - } - - /* populate arg pointer list */ - for (i = 0; i < cif->nargs; i++) - { - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: -#ifdef __BIG_ENDIAN__ - avalue[i] = ptr + 3; -#else - avalue[i] = ptr; -#endif - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: -#ifdef __BIG_ENDIAN__ - avalue[i] = ptr + 2; -#else - avalue[i] = ptr; -#endif - break; - case FFI_TYPE_STRUCT: -#if __BIG_ENDIAN__ - /* - * Work around strange ABI behaviour. - * (see info in ffi_prep_args) - */ - if (arg_types[i]->size < WORD_SIZE) - { - memcpy (ptr, ptr + (WORD_SIZE - arg_types[i]->size), arg_types[i]->size); - } -#endif - avalue[i] = (void*)ptr; - break; - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_DOUBLE: - avalue[i] = ptr; - break; - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - default: - /* default 4-byte argument */ - avalue[i] = ptr; - break; - } - ptr += WORD_ALIGN(arg_types[i]->size); - } - - /* set the return type info passed back to the wrapper */ - *rsize = cif->rtype->size; - *rtype = cif->rtype->type; - if (struct_rvalue != NULL) { - closure->fun(cif, struct_rvalue, avalue, closure->user_data); - /* copy struct return pointer value into function return value */ - *((void**)rvalue) = struct_rvalue; - } else { - closure->fun(cif, rvalue, avalue, closure->user_data); - } -} - -ffi_status ffi_prep_closure_loc( - ffi_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void* user_data, void* codeloc) -{ - unsigned long* tramp = (unsigned long*)&(closure->tramp[0]); - unsigned long cls = (unsigned long)codeloc; - unsigned long fn = 0; - unsigned long fn_closure_call_sysv = (unsigned long)ffi_closure_call_SYSV; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - switch (cif->abi) - { - case FFI_SYSV: - fn = (unsigned long)ffi_closure_SYSV; - - /* load r11 (temp) with fn */ - /* imm fn(upper) */ - tramp[0] = 0xb0000000 | ((fn >> 16) & 0xffff); - /* addik r11, r0, fn(lower) */ - tramp[1] = 0x31600000 | (fn & 0xffff); - - /* load r12 (temp) with cls */ - /* imm cls(upper) */ - tramp[2] = 0xb0000000 | ((cls >> 16) & 0xffff); - /* addik r12, r0, cls(lower) */ - tramp[3] = 0x31800000 | (cls & 0xffff); - - /* load r3 (temp) with ffi_closure_call_SYSV */ - /* imm fn_closure_call_sysv(upper) */ - tramp[4] = 0xb0000000 | ((fn_closure_call_sysv >> 16) & 0xffff); - /* addik r3, r0, fn_closure_call_sysv(lower) */ - tramp[5] = 0x30600000 | (fn_closure_call_sysv & 0xffff); - /* branch/jump to address stored in r11 (fn) */ - tramp[6] = 0x98085800; /* bra r11 */ - - break; - default: - return FFI_BAD_ABI; - } - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/microblaze/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/microblaze/ffitarget.h deleted file mode 100644 index c6fa5a4115d9806a0e68808c98f5be8635a80ccf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/microblaze/ffitarget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ----------------------------------------------------------------------- - ffitarget.h - Copyright (c) 2012, 2013 Xilinx, Inc - - Target configuration macros for MicroBlaze. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -/* Definitions for closures */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 - -#define FFI_TRAMPOLINE_SIZE (4*8) - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/microblaze/sysv.S b/llgo/third_party/gofrontend/libffi/src/microblaze/sysv.S deleted file mode 100644 index ea43e9d5453943297be18372efcb2b958fcb333e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/microblaze/sysv.S +++ /dev/null @@ -1,302 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2012, 2013 Xilinx, Inc - - MicroBlaze Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - /* - * arg[0] (r5) = ffi_prep_args, - * arg[1] (r6) = &ecif, - * arg[2] (r7) = cif->bytes, - * arg[3] (r8) = cif->flags, - * arg[4] (r9) = ecif.rvalue, - * arg[5] (r10) = fn - * arg[6] (sp[0]) = cif->rtype->type - * arg[7] (sp[4]) = cif->rtype->size - */ - .text - .globl ffi_call_SYSV - .type ffi_call_SYSV, @function -ffi_call_SYSV: - /* push callee saves */ - addik r1, r1, -20 - swi r19, r1, 0 /* Frame Pointer */ - swi r20, r1, 4 /* PIC register */ - swi r21, r1, 8 /* PIC register */ - swi r22, r1, 12 /* save for locals */ - swi r23, r1, 16 /* save for locals */ - - /* save the r5-r10 registers in the stack */ - addik r1, r1, -24 /* increment sp to store 6x 32-bit words */ - swi r5, r1, 0 - swi r6, r1, 4 - swi r7, r1, 8 - swi r8, r1, 12 - swi r9, r1, 16 - swi r10, r1, 20 - - /* save function pointer */ - addik r3, r5, 0 /* copy ffi_prep_args into r3 */ - addik r22, r1, 0 /* save sp for unallocated args into r22 (callee-saved) */ - addik r23, r10, 0 /* save function address into r23 (callee-saved) */ - - /* prepare stack with allocation for n (bytes = r7) args */ - rsub r1, r7, r1 /* subtract bytes from sp */ - - /* prep args for ffi_prep_args call */ - addik r5, r1, 0 /* store stack pointer into arg[0] */ - /* r6 still holds ecif for arg[1] */ - - /* Call ffi_prep_args(stack, &ecif). */ - addik r1, r1, -4 - swi r15, r1, 0 /* store the link register in the frame */ - brald r15, r3 - nop /* branch has delay slot */ - lwi r15, r1, 0 - addik r1, r1, 4 /* restore the link register from the frame */ - /* returns calling stack pointer location */ - - /* prepare args for fn call, prep_args populates them onto the stack */ - lwi r5, r1, 0 /* arg[0] */ - lwi r6, r1, 4 /* arg[1] */ - lwi r7, r1, 8 /* arg[2] */ - lwi r8, r1, 12 /* arg[3] */ - lwi r9, r1, 16 /* arg[4] */ - lwi r10, r1, 20 /* arg[5] */ - - /* call (fn) (...). */ - addik r1, r1, -4 - swi r15, r1, 0 /* store the link register in the frame */ - brald r15, r23 - nop /* branch has delay slot */ - lwi r15, r1, 0 - addik r1, r1, 4 /* restore the link register from the frame */ - - /* Remove the space we pushed for the args. */ - addik r1, r22, 0 /* restore old SP */ - - /* restore this functions parameters */ - lwi r5, r1, 0 /* arg[0] */ - lwi r6, r1, 4 /* arg[1] */ - lwi r7, r1, 8 /* arg[2] */ - lwi r8, r1, 12 /* arg[3] */ - lwi r9, r1, 16 /* arg[4] */ - lwi r10, r1, 20 /* arg[5] */ - addik r1, r1, 24 /* decrement sp to de-allocate 6x 32-bit words */ - - /* If the return value pointer is NULL, assume no return value. */ - beqi r9, ffi_call_SYSV_end - - lwi r22, r1, 48 /* get return type (20 for locals + 28 for arg[6]) */ - lwi r23, r1, 52 /* get return size (20 for locals + 32 for arg[7]) */ - - /* Check if return type is actually a struct, do nothing */ - rsubi r11, r22, FFI_TYPE_STRUCT - beqi r11, ffi_call_SYSV_end - - /* Return 8bit */ - rsubi r11, r23, 1 - beqi r11, ffi_call_SYSV_store8 - - /* Return 16bit */ - rsubi r11, r23, 2 - beqi r11, ffi_call_SYSV_store16 - - /* Return 32bit */ - rsubi r11, r23, 4 - beqi r11, ffi_call_SYSV_store32 - - /* Return 64bit */ - rsubi r11, r23, 8 - beqi r11, ffi_call_SYSV_store64 - - /* Didn't match anything */ - bri ffi_call_SYSV_end - -ffi_call_SYSV_store64: - swi r3, r9, 0 /* store word r3 into return value */ - swi r4, r9, 4 /* store word r4 into return value */ - bri ffi_call_SYSV_end - -ffi_call_SYSV_store32: - swi r3, r9, 0 /* store word r3 into return value */ - bri ffi_call_SYSV_end - -ffi_call_SYSV_store16: -#ifdef __BIG_ENDIAN__ - shi r3, r9, 2 /* store half-word r3 into return value */ -#else - shi r3, r9, 0 /* store half-word r3 into return value */ -#endif - bri ffi_call_SYSV_end - -ffi_call_SYSV_store8: -#ifdef __BIG_ENDIAN__ - sbi r3, r9, 3 /* store byte r3 into return value */ -#else - sbi r3, r9, 0 /* store byte r3 into return value */ -#endif - bri ffi_call_SYSV_end - -ffi_call_SYSV_end: - /* callee restores */ - lwi r19, r1, 0 /* frame pointer */ - lwi r20, r1, 4 /* PIC register */ - lwi r21, r1, 8 /* PIC register */ - lwi r22, r1, 12 - lwi r23, r1, 16 - addik r1, r1, 20 - - /* return from sub-routine (with delay slot) */ - rtsd r15, 8 - nop - - .size ffi_call_SYSV, . - ffi_call_SYSV - -/* ------------------------------------------------------------------------- */ - - /* - * args passed into this function, are passed down to the callee. - * this function is the target of the closure trampoline, as such r12 is - * a pointer to the closure object. - */ - .text - .globl ffi_closure_SYSV - .type ffi_closure_SYSV, @function -ffi_closure_SYSV: - /* push callee saves */ - addik r11, r1, 28 /* save stack args start location (excluding regs/link) */ - addik r1, r1, -12 - swi r19, r1, 0 /* Frame Pointer */ - swi r20, r1, 4 /* PIC register */ - swi r21, r1, 8 /* PIC register */ - - /* store register args on stack */ - addik r1, r1, -24 - swi r5, r1, 0 - swi r6, r1, 4 - swi r7, r1, 8 - swi r8, r1, 12 - swi r9, r1, 16 - swi r10, r1, 20 - - /* setup args */ - addik r5, r1, 0 /* register_args */ - addik r6, r11, 0 /* stack_args */ - addik r7, r12, 0 /* closure object */ - addik r1, r1, -8 /* allocate return value */ - addik r8, r1, 0 /* void* rvalue */ - addik r1, r1, -8 /* allocate for return type/size values */ - addik r9, r1, 0 /* void* rtype */ - addik r10, r1, 4 /* void* rsize */ - - /* call the wrap_call function */ - addik r1, r1, -28 /* allocate args + link reg */ - swi r15, r1, 0 /* store the link register in the frame */ - brald r15, r3 - nop /* branch has delay slot */ - lwi r15, r1, 0 - addik r1, r1, 28 /* restore the link register from the frame */ - -ffi_closure_SYSV_prepare_return: - lwi r9, r1, 0 /* rtype */ - lwi r10, r1, 4 /* rsize */ - addik r1, r1, 8 /* de-allocate return info values */ - - /* Check if return type is actually a struct, store 4 bytes */ - rsubi r11, r9, FFI_TYPE_STRUCT - beqi r11, ffi_closure_SYSV_store32 - - /* Return 8bit */ - rsubi r11, r10, 1 - beqi r11, ffi_closure_SYSV_store8 - - /* Return 16bit */ - rsubi r11, r10, 2 - beqi r11, ffi_closure_SYSV_store16 - - /* Return 32bit */ - rsubi r11, r10, 4 - beqi r11, ffi_closure_SYSV_store32 - - /* Return 64bit */ - rsubi r11, r10, 8 - beqi r11, ffi_closure_SYSV_store64 - - /* Didn't match anything */ - bri ffi_closure_SYSV_end - -ffi_closure_SYSV_store64: - lwi r3, r1, 0 /* store word r3 into return value */ - lwi r4, r1, 4 /* store word r4 into return value */ - /* 64 bits == 2 words, no sign extend occurs */ - bri ffi_closure_SYSV_end - -ffi_closure_SYSV_store32: - lwi r3, r1, 0 /* store word r3 into return value */ - /* 32 bits == 1 word, no sign extend occurs */ - bri ffi_closure_SYSV_end - -ffi_closure_SYSV_store16: -#ifdef __BIG_ENDIAN__ - lhui r3, r1, 2 /* store half-word r3 into return value */ -#else - lhui r3, r1, 0 /* store half-word r3 into return value */ -#endif - rsubi r11, r9, FFI_TYPE_SINT16 - bnei r11, ffi_closure_SYSV_end - sext16 r3, r3 /* fix sign extend of sint8 */ - bri ffi_closure_SYSV_end - -ffi_closure_SYSV_store8: -#ifdef __BIG_ENDIAN__ - lbui r3, r1, 3 /* store byte r3 into return value */ -#else - lbui r3, r1, 0 /* store byte r3 into return value */ -#endif - rsubi r11, r9, FFI_TYPE_SINT8 - bnei r11, ffi_closure_SYSV_end - sext8 r3, r3 /* fix sign extend of sint8 */ - bri ffi_closure_SYSV_end - -ffi_closure_SYSV_end: - addik r1, r1, 8 /* de-allocate return value */ - - /* de-allocate stored args */ - addik r1, r1, 24 - - /* callee restores */ - lwi r19, r1, 0 /* frame pointer */ - lwi r20, r1, 4 /* PIC register */ - lwi r21, r1, 8 /* PIC register */ - addik r1, r1, 12 - - /* return from sub-routine (with delay slot) */ - rtsd r15, 8 - nop - - .size ffi_closure_SYSV, . - ffi_closure_SYSV diff --git a/llgo/third_party/gofrontend/libffi/src/mips/ffi.c b/llgo/third_party/gofrontend/libffi/src/mips/ffi.c deleted file mode 100644 index 5d0dd70cb32884a838d1855f8232a8f64d13113a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/mips/ffi.c +++ /dev/null @@ -1,1050 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011 Anthony Green - Copyright (c) 2008 David Daney - Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc. - - MIPS Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -#ifdef __GNUC__ -# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) -# define USE__BUILTIN___CLEAR_CACHE 1 -# endif -#endif - -#ifndef USE__BUILTIN___CLEAR_CACHE -# if defined(__OpenBSD__) -# include -# else -# include -# endif -#endif - -#ifdef FFI_DEBUG -# define FFI_MIPS_STOP_HERE() ffi_stop_here() -#else -# define FFI_MIPS_STOP_HERE() do {} while(0) -#endif - -#ifdef FFI_MIPS_N32 -#define FIX_ARGP \ -FFI_ASSERT(argp <= &stack[bytes]); \ -if (argp == &stack[bytes]) \ -{ \ - argp = stack; \ - FFI_MIPS_STOP_HERE(); \ -} -#else -#define FIX_ARGP -#endif - - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -static void ffi_prep_args(char *stack, - extended_cif *ecif, - int bytes, - int flags) -{ - int i; - void **p_argv; - char *argp; - ffi_type **p_arg; - -#ifdef FFI_MIPS_N32 - /* If more than 8 double words are used, the remainder go - on the stack. We reorder stuff on the stack here to - support this easily. */ - if (bytes > 8 * sizeof(ffi_arg)) - argp = &stack[bytes - (8 * sizeof(ffi_arg))]; - else - argp = stack; -#else - argp = stack; -#endif - - memset(stack, 0, bytes); - -#ifdef FFI_MIPS_N32 - if ( ecif->cif->rstruct_flag != 0 ) -#else - if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) -#endif - { - *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; - argp += sizeof(ffi_arg); - FIX_ARGP; - } - - p_argv = ecif->avalue; - - for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) - { - size_t z; - unsigned int a; - - /* Align if necessary. */ - a = (*p_arg)->alignment; - if (a < sizeof(ffi_arg)) - a = sizeof(ffi_arg); - - if ((a - 1) & (unsigned long) argp) - { - argp = (char *) ALIGN(argp, a); - FIX_ARGP; - } - - z = (*p_arg)->size; - if (z <= sizeof(ffi_arg)) - { - int type = (*p_arg)->type; - z = sizeof(ffi_arg); - - /* The size of a pointer depends on the ABI */ - if (type == FFI_TYPE_POINTER) - type = (ecif->cif->abi == FFI_N64 - || ecif->cif->abi == FFI_N64_SOFT_FLOAT) - ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; - - if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT - || ecif->cif->abi == FFI_N64_SOFT_FLOAT)) - { - switch (type) - { - case FFI_TYPE_FLOAT: - type = FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - type = FFI_TYPE_UINT64; - break; - default: - break; - } - } - switch (type) - { - case FFI_TYPE_SINT8: - *(ffi_arg *)argp = *(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(ffi_arg *)argp = *(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(ffi_arg *)argp = *(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(ffi_arg *)argp = *(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_SINT32: - *(ffi_arg *)argp = *(SINT32 *)(* p_argv); - break; - - case FFI_TYPE_UINT32: -#ifdef FFI_MIPS_N32 - /* The N32 ABI requires that 32-bit integers - be sign-extended to 64-bits, regardless of - whether they are signed or unsigned. */ - *(ffi_arg *)argp = *(SINT32 *)(* p_argv); -#else - *(ffi_arg *)argp = *(UINT32 *)(* p_argv); -#endif - break; - - /* This can only happen with 64bit slots. */ - case FFI_TYPE_FLOAT: - *(float *) argp = *(float *)(* p_argv); - break; - - /* Handle structures. */ - default: - memcpy(argp, *p_argv, (*p_arg)->size); - break; - } - } - else - { -#ifdef FFI_MIPS_O32 - memcpy(argp, *p_argv, z); -#else - { - unsigned long end = (unsigned long) argp + z; - unsigned long cap = (unsigned long) stack + bytes; - - /* Check if the data will fit within the register space. - Handle it if it doesn't. */ - - if (end <= cap) - memcpy(argp, *p_argv, z); - else - { - unsigned long portion = cap - (unsigned long)argp; - - memcpy(argp, *p_argv, portion); - argp = stack; - z -= portion; - memcpy(argp, (void*)((unsigned long)(*p_argv) + portion), - z); - } - } -#endif - } - p_argv++; - argp += z; - FIX_ARGP; - } -} - -#ifdef FFI_MIPS_N32 - -/* The n32 spec says that if "a chunk consists solely of a double - float field (but not a double, which is part of a union), it - is passed in a floating point register. Any other chunk is - passed in an integer register". This code traverses structure - definitions and generates the appropriate flags. */ - -static unsigned -calc_n32_struct_flags(int soft_float, ffi_type *arg, - unsigned *loc, unsigned *arg_reg) -{ - unsigned flags = 0; - unsigned index = 0; - - ffi_type *e; - - if (soft_float) - return 0; - - while ((e = arg->elements[index])) - { - /* Align this object. */ - *loc = ALIGN(*loc, e->alignment); - if (e->type == FFI_TYPE_DOUBLE) - { - /* Already aligned to FFI_SIZEOF_ARG. */ - *arg_reg = *loc / FFI_SIZEOF_ARG; - if (*arg_reg > 7) - break; - flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS)); - *loc += e->size; - } - else - *loc += e->size; - index++; - } - /* Next Argument register at alignment of FFI_SIZEOF_ARG. */ - *arg_reg = ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - - return flags; -} - -static unsigned -calc_n32_return_struct_flags(int soft_float, ffi_type *arg) -{ - unsigned flags = 0; - unsigned small = FFI_TYPE_SMALLSTRUCT; - ffi_type *e; - - /* Returning structures under n32 is a tricky thing. - A struct with only one or two floating point fields - is returned in $f0 (and $f2 if necessary). Any other - struct results at most 128 bits are returned in $2 - (the first 64 bits) and $3 (remainder, if necessary). - Larger structs are handled normally. */ - - if (arg->size > 16) - return 0; - - if (arg->size > 8) - small = FFI_TYPE_SMALLSTRUCT2; - - e = arg->elements[0]; - - if (e->type == FFI_TYPE_DOUBLE) - flags = FFI_TYPE_DOUBLE; - else if (e->type == FFI_TYPE_FLOAT) - flags = FFI_TYPE_FLOAT; - - if (flags && (e = arg->elements[1])) - { - if (e->type == FFI_TYPE_DOUBLE) - flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS; - else if (e->type == FFI_TYPE_FLOAT) - flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS; - else - return small; - - if (flags && (arg->elements[2])) - { - /* There are three arguments and the first two are - floats! This must be passed the old way. */ - return small; - } - if (soft_float) - flags += FFI_TYPE_STRUCT_SOFT; - } - else - if (!flags) - return small; - - return flags; -} - -#endif - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - cif->flags = 0; - -#ifdef FFI_MIPS_O32 - /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT - * does not have special handling for floating point args. - */ - - if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32) - { - if (cif->nargs > 0) - { - switch ((cif->arg_types)[0]->type) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags += (cif->arg_types)[0]->type; - break; - - default: - break; - } - - if (cif->nargs > 1) - { - /* Only handle the second argument if the first - is a float or double. */ - if (cif->flags) - { - switch ((cif->arg_types)[1]->type) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS; - break; - - default: - break; - } - } - } - } - } - - /* Set the return type flag */ - - if (cif->abi == FFI_O32_SOFT_FLOAT) - { - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); - break; - - case FFI_TYPE_FLOAT: - default: - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); - break; - } - } - else - { - /* FFI_O32 */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); - break; - - default: - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); - break; - } - } -#endif - -#ifdef FFI_MIPS_N32 - /* Set the flags necessary for N32 processing */ - { - int type; - unsigned arg_reg = 0; - unsigned loc = 0; - unsigned count = (cif->nargs < 8) ? cif->nargs : 8; - unsigned index = 0; - - unsigned struct_flags = 0; - int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT - || cif->abi == FFI_N64_SOFT_FLOAT); - - if (cif->rtype->type == FFI_TYPE_STRUCT) - { - struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype); - - if (struct_flags == 0) - { - /* This means that the structure is being passed as - a hidden argument */ - - arg_reg = 1; - count = (cif->nargs < 7) ? cif->nargs : 7; - - cif->rstruct_flag = !0; - } - else - cif->rstruct_flag = 0; - } - else - cif->rstruct_flag = 0; - - while (count-- > 0 && arg_reg < 8) - { - type = (cif->arg_types)[index]->type; - if (soft_float) - { - switch (type) - { - case FFI_TYPE_FLOAT: - type = FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - type = FFI_TYPE_UINT64; - break; - default: - break; - } - } - switch (type) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags += - ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS)); - arg_reg++; - break; - case FFI_TYPE_LONGDOUBLE: - /* Align it. */ - arg_reg = ALIGN(arg_reg, 2); - /* Treat it as two adjacent doubles. */ - if (soft_float) - { - arg_reg += 2; - } - else - { - cif->flags += - (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); - arg_reg++; - cif->flags += - (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); - arg_reg++; - } - break; - - case FFI_TYPE_STRUCT: - loc = arg_reg * FFI_SIZEOF_ARG; - cif->flags += calc_n32_struct_flags(soft_float, - (cif->arg_types)[index], - &loc, &arg_reg); - break; - - default: - arg_reg++; - break; - } - - index++; - } - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_STRUCT: - { - if (struct_flags == 0) - { - /* The structure is returned through a hidden - first argument. Do nothing, 'cause FFI_TYPE_VOID - is 0 */ - } - else - { - /* The structure is returned via some tricky - mechanism */ - cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); - cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8)); - } - break; - } - - case FFI_TYPE_VOID: - /* Do nothing, 'cause FFI_TYPE_VOID is 0 */ - break; - - case FFI_TYPE_POINTER: - if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32) - cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); - else - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); - break; - - case FFI_TYPE_FLOAT: - if (soft_float) - { - cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); - break; - } - /* else fall through */ - case FFI_TYPE_DOUBLE: - if (soft_float) - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); - else - cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); - break; - - case FFI_TYPE_LONGDOUBLE: - /* Long double is returned as if it were a struct containing - two doubles. */ - if (soft_float) - { - cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); - cif->flags += FFI_TYPE_SMALLSTRUCT2 << (4 + (FFI_FLAG_BITS * 8)); - } - else - { - cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); - cif->flags += (FFI_TYPE_DOUBLE - + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS)) - << (4 + (FFI_FLAG_BITS * 8)); - } - break; - default: - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); - break; - } - } -#endif - - return FFI_OK; -} - -/* Low level routine for calling O32 functions */ -extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), - extended_cif *, unsigned, - unsigned, unsigned *, void (*)(void)); - -/* Low level routine for calling N32 functions */ -extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), - extended_cif *, unsigned, - unsigned, void *, void (*)(void)); - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - ecif.rvalue = alloca(cif->rtype->size); - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { -#ifdef FFI_MIPS_O32 - case FFI_O32: - case FFI_O32_SOFT_FLOAT: - ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; -#endif - -#ifdef FFI_MIPS_N32 - case FFI_N32: - case FFI_N32_SOFT_FLOAT: - case FFI_N64: - case FFI_N64_SOFT_FLOAT: - { - int copy_rvalue = 0; - int copy_offset = 0; - char *rvalue_copy = ecif.rvalue; - if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16) - { - /* For structures smaller than 16 bytes we clobber memory - in 8 byte increments. Make a copy so we don't clobber - the callers memory outside of the struct bounds. */ - rvalue_copy = alloca(16); - copy_rvalue = 1; - } - else if (cif->rtype->type == FFI_TYPE_FLOAT - && (cif->abi == FFI_N64_SOFT_FLOAT - || cif->abi == FFI_N32_SOFT_FLOAT)) - { - rvalue_copy = alloca (8); - copy_rvalue = 1; -#if defined(__MIPSEB__) || defined(_MIPSEB) - copy_offset = 4; -#endif - } - ffi_call_N32(ffi_prep_args, &ecif, cif->bytes, - cif->flags, rvalue_copy, fn); - if (copy_rvalue) - memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size); - } - break; -#endif - - default: - FFI_ASSERT(0); - break; - } -} - -#if FFI_CLOSURES -#if defined(FFI_MIPS_O32) -extern void ffi_closure_O32(void); -#else -extern void ffi_closure_N32(void); -#endif /* FFI_MIPS_O32 */ - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - void * fn; - char *clear_location = (char *) codeloc; - -#if defined(FFI_MIPS_O32) - if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) - return FFI_BAD_ABI; - fn = ffi_closure_O32; -#else -#if _MIPS_SIM ==_ABIN32 - if (cif->abi != FFI_N32 - && cif->abi != FFI_N32_SOFT_FLOAT) - return FFI_BAD_ABI; -#else - if (cif->abi != FFI_N64 - && cif->abi != FFI_N64_SOFT_FLOAT) - return FFI_BAD_ABI; -#endif - fn = ffi_closure_N32; -#endif /* FFI_MIPS_O32 */ - -#if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32) - /* lui $25,high(fn) */ - tramp[0] = 0x3c190000 | ((unsigned)fn >> 16); - /* ori $25,low(fn) */ - tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff); - /* lui $12,high(codeloc) */ - tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16); - /* jr $25 */ - tramp[3] = 0x03200008; - /* ori $12,low(codeloc) */ - tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff); -#else - /* N64 has a somewhat larger trampoline. */ - /* lui $25,high(fn) */ - tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48); - /* lui $12,high(codeloc) */ - tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48); - /* ori $25,mid-high(fn) */ - tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff); - /* ori $12,mid-high(codeloc) */ - tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff); - /* dsll $25,$25,16 */ - tramp[4] = 0x0019cc38; - /* dsll $12,$12,16 */ - tramp[5] = 0x000c6438; - /* ori $25,mid-low(fn) */ - tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff); - /* ori $12,mid-low(codeloc) */ - tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff); - /* dsll $25,$25,16 */ - tramp[8] = 0x0019cc38; - /* dsll $12,$12,16 */ - tramp[9] = 0x000c6438; - /* ori $25,low(fn) */ - tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff); - /* jr $25 */ - tramp[11] = 0x03200008; - /* ori $12,low(codeloc) */ - tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff); - -#endif - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - -#ifdef USE__BUILTIN___CLEAR_CACHE - __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE); -#else - cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE); -#endif - return FFI_OK; -} - -/* - * Decodes the arguments to a function, which will be stored on the - * stack. AR is the pointer to the beginning of the integer arguments - * (and, depending upon the arguments, some floating-point arguments - * as well). FPR is a pointer to the area where floating point - * registers have been saved, if any. - * - * RVALUE is the location where the function return value will be - * stored. CLOSURE is the prepared closure to invoke. - * - * This function should only be called from assembly, which is in - * turn called from a trampoline. - * - * Returns the function return type. - * - * Based on the similar routine for sparc. - */ -int -ffi_closure_mips_inner_O32 (ffi_closure *closure, - void *rvalue, ffi_arg *ar, - double *fpr) -{ - ffi_cif *cif; - void **avaluep; - ffi_arg *avalue; - ffi_type **arg_types; - int i, avn, argn, seen_int; - - cif = closure->cif; - avalue = alloca (cif->nargs * sizeof (ffi_arg)); - avaluep = alloca (cif->nargs * sizeof (ffi_arg)); - - seen_int = (cif->abi == FFI_O32_SOFT_FLOAT); - argn = 0; - - if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT) - { - rvalue = (void *)(UINT32)ar[0]; - argn = 1; - } - - i = 0; - avn = cif->nargs; - arg_types = cif->arg_types; - - while (i < avn) - { - if (i < 2 && !seen_int && - (arg_types[i]->type == FFI_TYPE_FLOAT || - arg_types[i]->type == FFI_TYPE_DOUBLE || - arg_types[i]->type == FFI_TYPE_LONGDOUBLE)) - { -#if defined(__MIPSEB__) || defined(_MIPSEB) - if (arg_types[i]->type == FFI_TYPE_FLOAT) - avaluep[i] = ((char *) &fpr[i]) + sizeof (float); - else -#endif - avaluep[i] = (char *) &fpr[i]; - } - else - { - if (arg_types[i]->alignment == 8 && (argn & 0x1)) - argn++; - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - avaluep[i] = &avalue[i]; - *(SINT8 *) &avalue[i] = (SINT8) ar[argn]; - break; - - case FFI_TYPE_UINT8: - avaluep[i] = &avalue[i]; - *(UINT8 *) &avalue[i] = (UINT8) ar[argn]; - break; - - case FFI_TYPE_SINT16: - avaluep[i] = &avalue[i]; - *(SINT16 *) &avalue[i] = (SINT16) ar[argn]; - break; - - case FFI_TYPE_UINT16: - avaluep[i] = &avalue[i]; - *(UINT16 *) &avalue[i] = (UINT16) ar[argn]; - break; - - default: - avaluep[i] = (char *) &ar[argn]; - break; - } - seen_int = 1; - } - argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - i++; - } - - /* Invoke the closure. */ - (closure->fun) (cif, rvalue, avaluep, closure->user_data); - - if (cif->abi == FFI_O32_SOFT_FLOAT) - { - switch (cif->rtype->type) - { - case FFI_TYPE_FLOAT: - return FFI_TYPE_INT; - case FFI_TYPE_DOUBLE: - return FFI_TYPE_UINT64; - default: - return cif->rtype->type; - } - } - else - { - return cif->rtype->type; - } -} - -#if defined(FFI_MIPS_N32) - -static void -copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type, - int argn, unsigned arg_offset, ffi_arg *ar, - ffi_arg *fpr, int soft_float) -{ - ffi_type **elt_typep = type->elements; - while(*elt_typep) - { - ffi_type *elt_type = *elt_typep; - unsigned o; - char *tp; - char *argp; - char *fpp; - - o = ALIGN(offset, elt_type->alignment); - arg_offset += o - offset; - offset = o; - argn += arg_offset / sizeof(ffi_arg); - arg_offset = arg_offset % sizeof(ffi_arg); - - argp = (char *)(ar + argn); - fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn); - - tp = target + offset; - - if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float) - *(double *)tp = *(double *)fpp; - else - memcpy(tp, argp + arg_offset, elt_type->size); - - offset += elt_type->size; - arg_offset += elt_type->size; - elt_typep++; - argn += arg_offset / sizeof(ffi_arg); - arg_offset = arg_offset % sizeof(ffi_arg); - } -} - -/* - * Decodes the arguments to a function, which will be stored on the - * stack. AR is the pointer to the beginning of the integer - * arguments. FPR is a pointer to the area where floating point - * registers have been saved. - * - * RVALUE is the location where the function return value will be - * stored. CLOSURE is the prepared closure to invoke. - * - * This function should only be called from assembly, which is in - * turn called from a trampoline. - * - * Returns the function return flags. - * - */ -int -ffi_closure_mips_inner_N32 (ffi_closure *closure, - void *rvalue, ffi_arg *ar, - ffi_arg *fpr) -{ - ffi_cif *cif; - void **avaluep; - ffi_arg *avalue; - ffi_type **arg_types; - int i, avn, argn; - int soft_float; - ffi_arg *argp; - - cif = closure->cif; - soft_float = cif->abi == FFI_N64_SOFT_FLOAT - || cif->abi == FFI_N32_SOFT_FLOAT; - avalue = alloca (cif->nargs * sizeof (ffi_arg)); - avaluep = alloca (cif->nargs * sizeof (ffi_arg)); - - argn = 0; - - if (cif->rstruct_flag) - { -#if _MIPS_SIM==_ABIN32 - rvalue = (void *)(UINT32)ar[0]; -#else /* N64 */ - rvalue = (void *)ar[0]; -#endif - argn = 1; - } - - i = 0; - avn = cif->nargs; - arg_types = cif->arg_types; - - while (i < avn) - { - if (arg_types[i]->type == FFI_TYPE_FLOAT - || arg_types[i]->type == FFI_TYPE_DOUBLE - || arg_types[i]->type == FFI_TYPE_LONGDOUBLE) - { - argp = (argn >= 8 || soft_float) ? ar + argn : fpr + argn; - if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((unsigned)argp & (arg_types[i]->alignment-1))) - { - argp=(ffi_arg*)ALIGN(argp,arg_types[i]->alignment); - argn++; - } -#if defined(__MIPSEB__) || defined(_MIPSEB) - if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8) - avaluep[i] = ((char *) argp) + sizeof (float); - else -#endif - avaluep[i] = (char *) argp; - } - else - { - unsigned type = arg_types[i]->type; - - if (arg_types[i]->alignment > sizeof(ffi_arg)) - argn = ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg)); - - argp = ar + argn; - - /* The size of a pointer depends on the ABI */ - if (type == FFI_TYPE_POINTER) - type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT) - ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; - - if (soft_float && type == FFI_TYPE_FLOAT) - type = FFI_TYPE_UINT32; - - switch (type) - { - case FFI_TYPE_SINT8: - avaluep[i] = &avalue[i]; - *(SINT8 *) &avalue[i] = (SINT8) *argp; - break; - - case FFI_TYPE_UINT8: - avaluep[i] = &avalue[i]; - *(UINT8 *) &avalue[i] = (UINT8) *argp; - break; - - case FFI_TYPE_SINT16: - avaluep[i] = &avalue[i]; - *(SINT16 *) &avalue[i] = (SINT16) *argp; - break; - - case FFI_TYPE_UINT16: - avaluep[i] = &avalue[i]; - *(UINT16 *) &avalue[i] = (UINT16) *argp; - break; - - case FFI_TYPE_SINT32: - avaluep[i] = &avalue[i]; - *(SINT32 *) &avalue[i] = (SINT32) *argp; - break; - - case FFI_TYPE_UINT32: - avaluep[i] = &avalue[i]; - *(UINT32 *) &avalue[i] = (UINT32) *argp; - break; - - case FFI_TYPE_STRUCT: - if (argn < 8) - { - /* Allocate space for the struct as at least part of - it was passed in registers. */ - avaluep[i] = alloca(arg_types[i]->size); - copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i], - argn, 0, ar, fpr, soft_float); - - break; - } - /* Else fall through. */ - default: - avaluep[i] = (char *) argp; - break; - } - } - argn += ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg); - i++; - } - - /* Invoke the closure. */ - (closure->fun) (cif, rvalue, avaluep, closure->user_data); - - return cif->flags >> (FFI_FLAG_BITS * 8); -} - -#endif /* FFI_MIPS_N32 */ - -#endif /* FFI_CLOSURES */ diff --git a/llgo/third_party/gofrontend/libffi/src/mips/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/mips/ffitarget.h deleted file mode 100644 index 717d65951c36393540f018c5eea9dd119b30880b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/mips/ffitarget.h +++ /dev/null @@ -1,247 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for MIPS. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifdef linux -# include -#elif defined(__rtems__) -/* - * Subprogram calling convention - copied from sgidefs.h - */ -#define _MIPS_SIM_ABI32 1 -#define _MIPS_SIM_NABI32 2 -#define _MIPS_SIM_ABI64 3 -#elif !defined(__OpenBSD__) -# include -#endif - -# ifndef _ABIN32 -# define _ABIN32 _MIPS_SIM_NABI32 -# endif -# ifndef _ABI64 -# define _ABI64 _MIPS_SIM_ABI64 -# endif -# ifndef _ABIO32 -# define _ABIO32 _MIPS_SIM_ABI32 -# endif - -#if !defined(_MIPS_SIM) -# error -- something is very wrong -- -#else -# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) -# define FFI_MIPS_N32 -# else -# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) -# define FFI_MIPS_O32 -# else -# error -- this is an unsupported platform -- -# endif -# endif -#endif - -#ifdef FFI_MIPS_O32 -/* O32 stack frames have 32bit integer args */ -# define FFI_SIZEOF_ARG 4 -#else -/* N32 and N64 frames have 64bit integer args */ -# define FFI_SIZEOF_ARG 8 -# if _MIPS_SIM == _ABIN32 -# define FFI_SIZEOF_JAVA_RAW 4 -# endif -#endif - -#define FFI_FLAG_BITS 2 - -/* SGI's strange assembler requires that we multiply by 4 rather - than shift left by FFI_FLAG_BITS */ - -#define FFI_ARGS_D FFI_TYPE_DOUBLE -#define FFI_ARGS_F FFI_TYPE_FLOAT -#define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE -#define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT -#define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT -#define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE - -/* Needed for N32 structure returns */ -#define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8 -#define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8 - -#if 0 -/* The SGI assembler can't handle this.. */ -#define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT -/* (and so on) */ -#else -/* ...so we calculate these by hand! */ -#define FFI_TYPE_STRUCT_D 61 -#define FFI_TYPE_STRUCT_F 45 -#define FFI_TYPE_STRUCT_DD 253 -#define FFI_TYPE_STRUCT_FF 173 -#define FFI_TYPE_STRUCT_FD 237 -#define FFI_TYPE_STRUCT_DF 189 -#define FFI_TYPE_STRUCT_SMALL 93 -#define FFI_TYPE_STRUCT_SMALL2 109 - -/* and for n32 soft float, add 16 * 2^4 */ -#define FFI_TYPE_STRUCT_D_SOFT 317 -#define FFI_TYPE_STRUCT_F_SOFT 301 -#define FFI_TYPE_STRUCT_DD_SOFT 509 -#define FFI_TYPE_STRUCT_FF_SOFT 429 -#define FFI_TYPE_STRUCT_FD_SOFT 493 -#define FFI_TYPE_STRUCT_DF_SOFT 445 -#define FFI_TYPE_STRUCT_SOFT 16 -#endif - -#ifdef LIBFFI_ASM -#define v0 $2 -#define v1 $3 -#define a0 $4 -#define a1 $5 -#define a2 $6 -#define a3 $7 -#define a4 $8 -#define a5 $9 -#define a6 $10 -#define a7 $11 -#define t0 $8 -#define t1 $9 -#define t2 $10 -#define t3 $11 -#define t4 $12 -#define t5 $13 -#define t6 $14 -#define t7 $15 -#define t8 $24 -#define t9 $25 -#define ra $31 - -#ifdef FFI_MIPS_O32 -# define REG_L lw -# define REG_S sw -# define SUBU subu -# define ADDU addu -# define SRL srl -# define LI li -#else /* !FFI_MIPS_O32 */ -# define REG_L ld -# define REG_S sd -# define SUBU dsubu -# define ADDU daddu -# define SRL dsrl -# define LI dli -# if (_MIPS_SIM==_ABI64) -# define LA dla -# define EH_FRAME_ALIGN 3 -# define FDE_ADDR_BYTES .8byte -# else -# define LA la -# define EH_FRAME_ALIGN 2 -# define FDE_ADDR_BYTES .4byte -# endif /* _MIPS_SIM==_ABI64 */ -#endif /* !FFI_MIPS_O32 */ -#else /* !LIBFFI_ASM */ -# ifdef __GNUC__ -# ifdef FFI_MIPS_O32 -/* O32 stack frames have 32bit integer args */ -typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); -typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); -#else -/* N32 and N64 frames have 64bit integer args */ -typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); -typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); -# endif -# else -# ifdef FFI_MIPS_O32 -/* O32 stack frames have 32bit integer args */ -typedef __uint32_t ffi_arg; -typedef __int32_t ffi_sarg; -# else -/* N32 and N64 frames have 64bit integer args */ -typedef __uint64_t ffi_arg; -typedef __int64_t ffi_sarg; -# endif -# endif /* __GNUC__ */ - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_O32, - FFI_N32, - FFI_N64, - FFI_O32_SOFT_FLOAT, - FFI_N32_SOFT_FLOAT, - FFI_N64_SOFT_FLOAT, - FFI_LAST_ABI, - -#ifdef FFI_MIPS_O32 -#ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT -#else - FFI_DEFAULT_ABI = FFI_O32 -#endif -#else -# if _MIPS_SIM==_ABI64 -# ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT -# else - FFI_DEFAULT_ABI = FFI_N64 -# endif -# else -# ifdef __mips_soft_float - FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT -# else - FFI_DEFAULT_ABI = FFI_N32 -# endif -# endif -#endif -} ffi_abi; - -#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag -#endif /* !LIBFFI_ASM */ - -/* ---- Definitions for closures ----------------------------------------- */ - -#if defined(FFI_MIPS_O32) -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 20 -#else -/* N32/N64. */ -# define FFI_CLOSURES 1 -#if _MIPS_SIM==_ABI64 -#define FFI_TRAMPOLINE_SIZE 52 -#else -#define FFI_TRAMPOLINE_SIZE 20 -#endif -#endif /* FFI_MIPS_O32 */ -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/mips/n32.S b/llgo/third_party/gofrontend/libffi/src/mips/n32.S deleted file mode 100644 index c6985d30a6f6402edf83d0d548d2a3b9261106d9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/mips/n32.S +++ /dev/null @@ -1,576 +0,0 @@ -/* ----------------------------------------------------------------------- - n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc. - - MIPS Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -/* Only build this code if we are compiling for n32 */ - -#if defined(FFI_MIPS_N32) - -#define callback a0 -#define bytes a2 -#define flags a3 -#define raddr a4 -#define fn a5 - -#define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) - -#ifdef __GNUC__ - .abicalls -#endif - .set mips4 - .text - .align 2 - .globl ffi_call_N32 - .ent ffi_call_N32 -ffi_call_N32: -.LFB3: - .frame $fp, SIZEOF_FRAME, ra - .mask 0xc0000000,-FFI_SIZEOF_ARG - .fmask 0x00000000,0 - - # Prologue - SUBU $sp, SIZEOF_FRAME # Frame size -.LCFI0: - REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer - REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address -.LCFI1: - move $fp, $sp -.LCFI3: - move t9, callback # callback function pointer - REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes - REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags - REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr - REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn - - # Allocate at least 4 words in the argstack - move v0, bytes - bge bytes, 4 * FFI_SIZEOF_ARG, bigger - LI v0, 4 * FFI_SIZEOF_ARG - b sixteen - - bigger: - ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned - and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. - -sixteen: - SUBU $sp, $sp, v0 # move the stack pointer to reflect the - # arg space - - move a0, $sp # 4 * FFI_SIZEOF_ARG - ADDU a3, $fp, 3 * FFI_SIZEOF_ARG - - # Call ffi_prep_args - jal t9 - - # Copy the stack pointer to t9 - move t9, $sp - - # Fix the stack if there are more than 8 64bit slots worth - # of arguments. - - # Load the number of bytes - REG_L t6, 2*FFI_SIZEOF_ARG($fp) - - # Is it bigger than 8 * FFI_SIZEOF_ARG? - daddiu t8, t6, -(8 * FFI_SIZEOF_ARG) - bltz t8, loadregs - - ADDU t9, t9, t8 - -loadregs: - - REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. - - and t4, t6, ((1< -#include - -/* Only build this code if we are compiling for o32 */ - -#if defined(FFI_MIPS_O32) - -#define callback a0 -#define bytes a2 -#define flags a3 - -#define SIZEOF_FRAME (4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG) -#define A3_OFF (SIZEOF_FRAME + 3 * FFI_SIZEOF_ARG) -#define FP_OFF (SIZEOF_FRAME - 2 * FFI_SIZEOF_ARG) -#define RA_OFF (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG) - - .abicalls - .text - .align 2 - .globl ffi_call_O32 - .ent ffi_call_O32 -ffi_call_O32: -$LFB0: - # Prologue - SUBU $sp, SIZEOF_FRAME # Frame size -$LCFI0: - REG_S $fp, FP_OFF($sp) # Save frame pointer -$LCFI1: - REG_S ra, RA_OFF($sp) # Save return address -$LCFI2: - move $fp, $sp - -$LCFI3: - move t9, callback # callback function pointer - REG_S flags, A3_OFF($fp) # flags - - # Allocate at least 4 words in the argstack - LI v0, 4 * FFI_SIZEOF_ARG - blt bytes, v0, sixteen - - ADDU v0, bytes, 7 # make sure it is aligned - and v0, -8 # to an 8 byte boundry - -sixteen: - SUBU $sp, v0 # move the stack pointer to reflect the - # arg space - - ADDU a0, $sp, 4 * FFI_SIZEOF_ARG - - jalr t9 - - REG_L t0, A3_OFF($fp) # load the flags word - SRL t2, t0, 4 # shift our arg info - and t0, ((1<<4)-1) # mask out the return type - - ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args - - bnez t0, pass_d # make it quick for int - REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the - REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs. - REG_L a2, 2*FFI_SIZEOF_ARG($sp) - REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it - -pass_d: - bne t0, FFI_ARGS_D, pass_f - l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double - REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it - -pass_f: - bne t0, FFI_ARGS_F, pass_d_d - l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float - REG_L a2, 2*FFI_SIZEOF_ARG($sp) - REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it - -pass_d_d: - bne t0, FFI_ARGS_DD, pass_f_f - l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles - b call_it - -pass_f_f: - bne t0, FFI_ARGS_FF, pass_d_f - l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats - REG_L a2, 2*FFI_SIZEOF_ARG($sp) - REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it - -pass_d_f: - bne t0, FFI_ARGS_DF, pass_f_d - l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float - REG_L a3, 3*FFI_SIZEOF_ARG($sp) - b call_it - -pass_f_d: - # assume that the only other combination must be float then double - # bne t0, FFI_ARGS_F_D, call_it - l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args - l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float - -call_it: - # Load the function pointer - REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) - - # If the return value pointer is NULL, assume no return value. - REG_L t1, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) - beqz t1, noretval - - bne t2, FFI_TYPE_INT, retlonglong - jalr t9 - REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) - REG_S v0, 0(t0) - b epilogue - -retlonglong: - # Really any 64-bit int, signed or not. - bne t2, FFI_TYPE_UINT64, retfloat - jalr t9 - REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) - REG_S v1, 4(t0) - REG_S v0, 0(t0) - b epilogue - -retfloat: - bne t2, FFI_TYPE_FLOAT, retdouble - jalr t9 - REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) - s.s $f0, 0(t0) - b epilogue - -retdouble: - bne t2, FFI_TYPE_DOUBLE, noretval - jalr t9 - REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) - s.d $f0, 0(t0) - b epilogue - -noretval: - jalr t9 - - # Epilogue -epilogue: - move $sp, $fp - REG_L $fp, FP_OFF($sp) # Restore frame pointer - REG_L ra, RA_OFF($sp) # Restore return address - ADDU $sp, SIZEOF_FRAME # Fix stack pointer - j ra - -$LFE0: - .end ffi_call_O32 - - -/* ffi_closure_O32. Expects address of the passed-in ffi_closure - in t4 ($12). Stores any arguments passed in registers onto the - stack, then calls ffi_closure_mips_inner_O32, which - then decodes them. - - Stack layout: - - 3 - a3 save - 2 - a2 save - 1 - a1 save - 0 - a0 save, original sp - -1 - ra save - -2 - fp save - -3 - $16 (s0) save - -4 - cprestore - -5 - return value high (v1) - -6 - return value low (v0) - -7 - f14 (le high, be low) - -8 - f14 (le low, be high) - -9 - f12 (le high, be low) - -10 - f12 (le low, be high) - -11 - Called function a3 save - -12 - Called function a2 save - -13 - Called function a1 save - -14 - Called function a0 save, our sp and fp point here - */ - -#define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG) -#define A3_OFF2 (SIZEOF_FRAME2 + 3 * FFI_SIZEOF_ARG) -#define A2_OFF2 (SIZEOF_FRAME2 + 2 * FFI_SIZEOF_ARG) -#define A1_OFF2 (SIZEOF_FRAME2 + 1 * FFI_SIZEOF_ARG) -#define A0_OFF2 (SIZEOF_FRAME2 + 0 * FFI_SIZEOF_ARG) -#define RA_OFF2 (SIZEOF_FRAME2 - 1 * FFI_SIZEOF_ARG) -#define FP_OFF2 (SIZEOF_FRAME2 - 2 * FFI_SIZEOF_ARG) -#define S0_OFF2 (SIZEOF_FRAME2 - 3 * FFI_SIZEOF_ARG) -#define GP_OFF2 (SIZEOF_FRAME2 - 4 * FFI_SIZEOF_ARG) -#define V1_OFF2 (SIZEOF_FRAME2 - 5 * FFI_SIZEOF_ARG) -#define V0_OFF2 (SIZEOF_FRAME2 - 6 * FFI_SIZEOF_ARG) -#define FA_1_1_OFF2 (SIZEOF_FRAME2 - 7 * FFI_SIZEOF_ARG) -#define FA_1_0_OFF2 (SIZEOF_FRAME2 - 8 * FFI_SIZEOF_ARG) -#define FA_0_1_OFF2 (SIZEOF_FRAME2 - 9 * FFI_SIZEOF_ARG) -#define FA_0_0_OFF2 (SIZEOF_FRAME2 - 10 * FFI_SIZEOF_ARG) - - .text - .align 2 - .globl ffi_closure_O32 - .ent ffi_closure_O32 -ffi_closure_O32: -$LFB1: - # Prologue - .frame $fp, SIZEOF_FRAME2, ra - .set noreorder - .cpload t9 - .set reorder - SUBU $sp, SIZEOF_FRAME2 - .cprestore GP_OFF2 -$LCFI4: - REG_S $16, S0_OFF2($sp) # Save s0 - REG_S $fp, FP_OFF2($sp) # Save frame pointer - REG_S ra, RA_OFF2($sp) # Save return address -$LCFI6: - move $fp, $sp - -$LCFI7: - # Store all possible argument registers. If there are more than - # four arguments, then they are stored above where we put a3. - REG_S a0, A0_OFF2($fp) - REG_S a1, A1_OFF2($fp) - REG_S a2, A2_OFF2($fp) - REG_S a3, A3_OFF2($fp) - - # Load ABI enum to s0 - REG_L $16, 20($12) # cif pointer follows tramp. - REG_L $16, 0($16) # abi is first member. - - li $13, 1 # FFI_O32 - bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT - - # Store all possible float/double registers. - s.d $f12, FA_0_0_OFF2($fp) - s.d $f14, FA_1_0_OFF2($fp) -1: - # Call ffi_closure_mips_inner_O32 to do the work. - la t9, ffi_closure_mips_inner_O32 - move a0, $12 # Pointer to the ffi_closure - addu a1, $fp, V0_OFF2 - addu a2, $fp, A0_OFF2 - addu a3, $fp, FA_0_0_OFF2 - jalr t9 - - # Load the return value into the appropriate register. - move $8, $2 - li $9, FFI_TYPE_VOID - beq $8, $9, closure_done - - li $13, 1 # FFI_O32 - bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT - - li $9, FFI_TYPE_FLOAT - l.s $f0, V0_OFF2($fp) - beq $8, $9, closure_done - - li $9, FFI_TYPE_DOUBLE - l.d $f0, V0_OFF2($fp) - beq $8, $9, closure_done -1: - REG_L $3, V1_OFF2($fp) - REG_L $2, V0_OFF2($fp) - -closure_done: - # Epilogue - move $sp, $fp - REG_L $16, S0_OFF2($sp) # Restore s0 - REG_L $fp, FP_OFF2($sp) # Restore frame pointer - REG_L ra, RA_OFF2($sp) # Restore return address - ADDU $sp, SIZEOF_FRAME2 - j ra -$LFE1: - .end ffi_closure_O32 - -/* DWARF-2 unwind info. */ - - .section .eh_frame,"a",@progbits -$Lframe0: - .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry -$LSCIE0: - .4byte 0x0 # CIE Identifier Tag - .byte 0x1 # CIE Version - .ascii "zR\0" # CIE Augmentation - .uleb128 0x1 # CIE Code Alignment Factor - .sleb128 4 # CIE Data Alignment Factor - .byte 0x1f # CIE RA Column - .uleb128 0x1 # Augmentation size - .byte 0x00 # FDE Encoding (absptr) - .byte 0xc # DW_CFA_def_cfa - .uleb128 0x1d - .uleb128 0x0 - .align 2 -$LECIE0: -$LSFDE0: - .4byte $LEFDE0-$LASFDE0 # FDE Length -$LASFDE0: - .4byte $LASFDE0-$Lframe0 # FDE CIE offset - .4byte $LFB0 # FDE initial location - .4byte $LFE0-$LFB0 # FDE address range - .uleb128 0x0 # Augmentation size - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI0-$LFB0 - .byte 0xe # DW_CFA_def_cfa_offset - .uleb128 0x18 - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI2-$LCFI0 - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x1e # $fp - .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x1f # $ra - .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI3-$LCFI2 - .byte 0xc # DW_CFA_def_cfa - .uleb128 0x1e - .uleb128 0x18 - .align 2 -$LEFDE0: -$LSFDE1: - .4byte $LEFDE1-$LASFDE1 # FDE Length -$LASFDE1: - .4byte $LASFDE1-$Lframe0 # FDE CIE offset - .4byte $LFB1 # FDE initial location - .4byte $LFE1-$LFB1 # FDE address range - .uleb128 0x0 # Augmentation size - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI4-$LFB1 - .byte 0xe # DW_CFA_def_cfa_offset - .uleb128 0x38 - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI6-$LCFI4 - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x10 # $16 - .sleb128 -3 # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x1e # $fp - .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) - .byte 0x11 # DW_CFA_offset_extended_sf - .uleb128 0x1f # $ra - .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) - .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI7-$LCFI6 - .byte 0xc # DW_CFA_def_cfa - .uleb128 0x1e - .uleb128 0x38 - .align 2 -$LEFDE1: - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/moxie/eabi.S b/llgo/third_party/gofrontend/libffi/src/moxie/eabi.S deleted file mode 100644 index ac7aceb1a6bb12ff2e4994ccb6ab930793e1bf8c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/moxie/eabi.S +++ /dev/null @@ -1,101 +0,0 @@ -/* ----------------------------------------------------------------------- - eabi.S - Copyright (c) 2012, 2013 Anthony Green - - Moxie Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - .globl ffi_prep_args_EABI - - .text - .p2align 4 - .globl ffi_call_EABI - .type ffi_call_EABI, @function - - # $r0 : ffi_prep_args - # $r1 : &ecif - # $r2 : cif->bytes - # $r3 : fig->flags - # $r4 : ecif.rvalue - # $r5 : fn - -ffi_call_EABI: - push $sp, $r6 - push $sp, $r7 - push $sp, $r8 - dec $sp, 24 - - /* Store incoming args on stack. */ - sto.l 0($sp), $r0 /* ffi_prep_args */ - sto.l 4($sp), $r1 /* ecif */ - sto.l 8($sp), $r2 /* bytes */ - sto.l 12($sp), $r3 /* flags */ - sto.l 16($sp), $r4 /* &rvalue */ - sto.l 20($sp), $r5 /* fn */ - - /* Call ffi_prep_args. */ - mov $r6, $r4 /* Save result buffer */ - mov $r7, $r5 /* Save the target fn */ - mov $r8, $r3 /* Save the flags */ - sub.l $sp, $r2 /* Allocate stack space */ - mov $r0, $sp /* We can stomp over $r0 */ - /* $r1 is already set up */ - jsra ffi_prep_args - - /* Load register arguments. */ - ldo.l $r0, 0($sp) - ldo.l $r1, 4($sp) - ldo.l $r2, 8($sp) - ldo.l $r3, 12($sp) - ldo.l $r4, 16($sp) - ldo.l $r5, 20($sp) - - /* Call the target function. */ - jsr $r7 - - ldi.l $r7, 0xffffffff - cmp $r8, $r7 - beq retstruct - - ldi.l $r7, 4 - cmp $r8, $r7 - bgt ret2reg - - st.l ($r6), $r0 - jmpa retdone - -ret2reg: - st.l ($r6), $r0 - sto.l 4($r6), $r1 - -retstruct: -retdone: - /* Return. */ - ldo.l $r6, -4($fp) - ldo.l $r7, -8($fp) - ldo.l $r8, -12($fp) - ret - .size ffi_call_EABI, .-ffi_call_EABI - diff --git a/llgo/third_party/gofrontend/libffi/src/moxie/ffi.c b/llgo/third_party/gofrontend/libffi/src/moxie/ffi.c deleted file mode 100644 index 540a042996f5f672819f62d983d2b78f40cc333d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/moxie/ffi.c +++ /dev/null @@ -1,272 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2012, 2013 Anthony Green - - Moxie Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void *ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - register int count = 0; - - p_argv = ecif->avalue; - argp = stack; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) - { - *(void **) argp = ecif->rvalue; - argp += 4; - } - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); - i--, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - - if ((*p_arg)->type == FFI_TYPE_STRUCT) - { - z = sizeof(void*); - *(void **) argp = *p_argv; - } - else if (z < sizeof(int)) - { - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - default: - FFI_ASSERT(0); - } - } - else if (z == sizeof(int)) - { - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - } - else - { - memcpy(argp, *p_argv, z); - } - p_argv++; - argp += z; - count += z; - } - - return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - if (cif->rtype->type == FFI_TYPE_STRUCT) - cif->flags = -1; - else - cif->flags = cif->rtype->size; - - cif->bytes = ALIGN (cif->bytes, 8); - - return FFI_OK; -} - -extern void ffi_call_EABI(void *(*)(char *, extended_cif *), - extended_cif *, - unsigned, unsigned, - unsigned *, - void (*fn)(void)); - -void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_EABI: - ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - default: - FFI_ASSERT(0); - break; - } -} - -void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, - unsigned arg4, unsigned arg5, unsigned arg6) -{ - /* This function is called by a trampoline. The trampoline stows a - pointer to the ffi_closure object in $r7. We must save this - pointer in a place that will persist while we do our work. */ - register ffi_closure *creg __asm__ ("$r12"); - ffi_closure *closure = creg; - - /* Arguments that don't fit in registers are found on the stack - at a fixed offset above the current frame pointer. */ - register char *frame_pointer __asm__ ("$fp"); - - /* Pointer to a struct return value. */ - void *struct_rvalue = (void *) arg1; - - /* 6 words reserved for register args + 3 words from jsr */ - char *stack_args = frame_pointer + 9*4; - - /* Lay the register arguments down in a continuous chunk of memory. */ - unsigned register_args[6] = - { arg1, arg2, arg3, arg4, arg5, arg6 }; - char *register_args_ptr = (char *) register_args; - - ffi_cif *cif = closure->cif; - ffi_type **arg_types = cif->arg_types; - void **avalue = alloca (cif->nargs * sizeof(void *)); - char *ptr = (char *) register_args; - int i; - - /* preserve struct type return pointer passing */ - if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { - ptr += 4; - register_args_ptr = (char *)®ister_args[1]; - } - - /* Find the address of each argument. */ - for (i = 0; i < cif->nargs; i++) - { - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = ptr + 3; - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = ptr + 2; - break; - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - case FFI_TYPE_POINTER: - avalue[i] = ptr; - break; - case FFI_TYPE_STRUCT: - avalue[i] = *(void**)ptr; - break; - default: - /* This is an 8-byte value. */ - avalue[i] = ptr; - ptr += 4; - break; - } - ptr += 4; - - /* If we've handled more arguments than fit in registers, - start looking at the those passed on the stack. */ - if (ptr == ®ister_args[6]) - ptr = stack_args; - } - - /* Invoke the closure. */ - if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - (closure->fun) (cif, struct_rvalue, avalue, closure->user_data); - } - else - { - /* Allocate space for the return value and call the function. */ - long long rvalue; - (closure->fun) (cif, &rvalue, avalue, closure->user_data); - asm ("mov $r12, %0\n ld.l $r0, ($r12)\n ldo.l $r1, 4($r12)" : : "r" (&rvalue)); - } -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned short *tramp = (unsigned short *) &closure->tramp[0]; - unsigned long fn = (long) ffi_closure_eabi; - unsigned long cls = (long) codeloc; - - if (cif->abi != FFI_EABI) - return FFI_BAD_ABI; - - fn = (unsigned long) ffi_closure_eabi; - - tramp[0] = 0x01e0; /* ldi.l $r7, .... */ - tramp[1] = cls >> 16; - tramp[2] = cls & 0xffff; - tramp[3] = 0x1a00; /* jmpa .... */ - tramp[4] = fn >> 16; - tramp[5] = fn & 0xffff; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/moxie/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/moxie/ffitarget.h deleted file mode 100644 index 623e3ece57d56facd1894a8ae92d063a341849bd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/moxie/ffitarget.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012, 2013 Anthony Green - Target configuration macros for Moxie - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -/* ---- System specific configurations ----------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_EABI, - FFI_DEFAULT_ABI = FFI_EABI, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 - -/* Trampolines are 12-bytes long. See ffi_prep_closure_loc. */ -#define FFI_TRAMPOLINE_SIZE (12) - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/nios2/ffi.c b/llgo/third_party/gofrontend/libffi/src/nios2/ffi.c deleted file mode 100644 index 2efa033f9cd61f15164f3f45230bed715e486492..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/nios2/ffi.c +++ /dev/null @@ -1,304 +0,0 @@ -/* libffi support for Altera Nios II. - - Copyright (c) 2013 Mentor Graphics. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - -#include -#include - -#include - -/* The Nios II Processor Reference Handbook defines the procedure call - ABI as follows. - - Arguments are passed as if a structure containing the types of - the arguments were constructed. The first 16 bytes are passed in r4 - through r7, the remainder on the stack. The first 16 bytes of a function - taking variable arguments are passed in r4-r7 in the same way. - - Return values of types up to 8 bytes are returned in r2 and r3. For - return values greater than 8 bytes, the caller must allocate memory for - the result and pass the address as if it were argument 0. - - While this isn't specified explicitly in the ABI documentation, GCC - promotes integral arguments smaller than int size to 32 bits. - - Also of note, the ABI specifies that all structure objects are - aligned to 32 bits even if all their fields have a smaller natural - alignment. See FFI_AGGREGATE_ALIGNMENT. */ - - -/* Declare the assembly language hooks. */ - -extern UINT64 ffi_call_sysv (void (*) (char *, extended_cif *), - extended_cif *, - unsigned, - void (*fn) (void)); -extern void ffi_closure_sysv (void); - -/* Perform machine-dependent cif processing. */ - -ffi_status ffi_prep_cif_machdep (ffi_cif *cif) -{ - /* We always want at least 16 bytes in the parameter block since it - simplifies the low-level call function. Also round the parameter - block size up to a multiple of 4 bytes to preserve - 32-bit alignment of the stack pointer. */ - if (cif->bytes < 16) - cif->bytes = 16; - else - cif->bytes = (cif->bytes + 3) & ~3; - - return FFI_OK; -} - - -/* ffi_prep_args is called by the assembly routine to transfer arguments - to the stack using the pointers in the ecif array. - Note that the stack buffer is big enough to fit all the arguments, - but the first 16 bytes will be copied to registers for the actual - call. */ - -void ffi_prep_args (char *stack, extended_cif *ecif) -{ - char *argp = stack; - unsigned int i; - - /* The implicit return value pointer is passed as if it were a hidden - first argument. */ - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT - && ecif->cif->rtype->size > 8) - { - (*(void **) argp) = ecif->rvalue; - argp += 4; - } - - for (i = 0; i < ecif->cif->nargs; i++) - { - void *avalue = ecif->avalue[i]; - ffi_type *atype = ecif->cif->arg_types[i]; - size_t size = atype->size; - size_t alignment = atype->alignment; - - /* Align argp as appropriate for the argument type. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) ALIGN (argp, alignment); - - /* Copy the argument, promoting integral types smaller than a - word to word size. */ - if (size < sizeof (int)) - { - size = sizeof (int); - switch (atype->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) avalue; - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) avalue; - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) avalue; - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) avalue; - break; - - case FFI_TYPE_STRUCT: - memcpy (argp, avalue, atype->size); - break; - - default: - FFI_ASSERT(0); - } - } - else if (size == sizeof (int)) - *(unsigned int *) argp = (unsigned int) *(UINT32 *) avalue; - else - memcpy (argp, avalue, size); - argp += size; - } -} - - -/* Call FN using the prepared CIF. RVALUE points to space allocated by - the caller for the return value, and AVALUE is an array of argument - pointers. */ - -void ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue) -{ - - extended_cif ecif; - UINT64 result; - - /* If bigret is true, this is the case where a return value of larger - than 8 bytes is handled by being passed by reference as an implicit - argument. */ - int bigret = (cif->rtype->type == FFI_TYPE_STRUCT - && cif->rtype->size > 8); - - ecif.cif = cif; - ecif.avalue = avalue; - - /* Allocate space for return value if this is the pass-by-reference case - and the caller did not provide a buffer. */ - if (rvalue == NULL && bigret) - ecif.rvalue = alloca (cif->rtype->size); - else - ecif.rvalue = rvalue; - - result = ffi_call_sysv (ffi_prep_args, &ecif, cif->bytes, fn); - - /* Now result contains the 64 bit contents returned from fn in - r2 and r3. Copy the value of the appropriate size to the user-provided - rvalue buffer. */ - if (rvalue && !bigret) - switch (cif->rtype->size) - { - case 1: - *(UINT8 *)rvalue = (UINT8) result; - break; - case 2: - *(UINT16 *)rvalue = (UINT16) result; - break; - case 4: - *(UINT32 *)rvalue = (UINT32) result; - break; - case 8: - *(UINT64 *)rvalue = (UINT64) result; - break; - default: - memcpy (rvalue, (void *)&result, cif->rtype->size); - break; - } -} - -/* This function is invoked from the closure trampoline to invoke - CLOSURE with argument block ARGS. Parse ARGS according to - CLOSURE->cfi and invoke CLOSURE->fun. */ - -static UINT64 -ffi_closure_helper (unsigned char *args, - ffi_closure *closure) -{ - ffi_cif *cif = closure->cif; - unsigned char *argp = args; - void **parsed_args = alloca (cif->nargs * sizeof (void *)); - UINT64 result; - void *retptr; - unsigned int i; - - /* First figure out what to do about the return type. If this is the - big-structure-return case, the first arg is the hidden return buffer - allocated by the caller. */ - if (cif->rtype->type == FFI_TYPE_STRUCT - && cif->rtype->size > 8) - { - retptr = *((void **) argp); - argp += 4; - } - else - retptr = (void *) &result; - - /* Fill in the array of argument pointers. */ - for (i = 0; i < cif->nargs; i++) - { - size_t size = cif->arg_types[i]->size; - size_t alignment = cif->arg_types[i]->alignment; - - /* Align argp as appropriate for the argument type. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) ALIGN (argp, alignment); - - /* Arguments smaller than an int are promoted to int. */ - if (size < sizeof (int)) - size = sizeof (int); - - /* Store the pointer. */ - parsed_args[i] = argp; - argp += size; - } - - /* Call the user-supplied function. */ - (closure->fun) (cif, retptr, parsed_args, closure->user_data); - return result; -} - - -/* Initialize CLOSURE with a trampoline to call FUN with - CIF and USER_DATA. */ -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun) (ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - int i; - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - /* The trampoline looks like: - movhi r8, %hi(ffi_closure_sysv) - ori r8, r8, %lo(ffi_closure_sysv) - movhi r9, %hi(ffi_closure_helper) - ori r0, r9, %lo(ffi_closure_helper) - movhi r10, %hi(closure) - ori r10, r10, %lo(closure) - jmp r8 - and then ffi_closure_sysv retrieves the closure pointer out of r10 - in addition to the arguments passed in the normal way for the call, - and invokes ffi_closure_helper. We encode the pointer to - ffi_closure_helper in the trampoline because making a PIC call - to it in ffi_closure_sysv would be messy (it would have to indirect - through the GOT). */ - -#define HI(x) ((((unsigned int) (x)) >> 16) & 0xffff) -#define LO(x) (((unsigned int) (x)) & 0xffff) - tramp[0] = (0 << 27) | (8 << 22) | (HI (ffi_closure_sysv) << 6) | 0x34; - tramp[1] = (8 << 27) | (8 << 22) | (LO (ffi_closure_sysv) << 6) | 0x14; - tramp[2] = (0 << 27) | (9 << 22) | (HI (ffi_closure_helper) << 6) | 0x34; - tramp[3] = (9 << 27) | (9 << 22) | (LO (ffi_closure_helper) << 6) | 0x14; - tramp[4] = (0 << 27) | (10 << 22) | (HI (closure) << 6) | 0x34; - tramp[5] = (10 << 27) | (10 << 22) | (LO (closure) << 6) | 0x14; - tramp[6] = (8 << 27) | (0x0d << 11) | 0x3a; -#undef HI -#undef LO - - /* Flush the caches. - See Example 9-4 in the Nios II Software Developer's Handbook. */ - for (i = 0; i < 7; i++) - asm volatile ("flushd 0(%0); flushi %0" :: "r"(tramp + i) : "memory"); - asm volatile ("flushp" ::: "memory"); - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - diff --git a/llgo/third_party/gofrontend/libffi/src/nios2/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/nios2/ffitarget.h deleted file mode 100644 index 134d118c12a2fcd95941f482d9c074b2516e7276..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/nios2/ffitarget.h +++ /dev/null @@ -1,52 +0,0 @@ -/* libffi target includes for Altera Nios II. - - Copyright (c) 2013 Mentor Graphics. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -/* Structures have a 4-byte alignment even if all the fields have lesser - alignment requirements. */ -#define FFI_AGGREGATE_ALIGNMENT 4 - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 28 /* 7 instructions */ -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/nios2/sysv.S b/llgo/third_party/gofrontend/libffi/src/nios2/sysv.S deleted file mode 100644 index 75f442bbeeb9bb9d2f5b3cb40b617ecface12263..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/nios2/sysv.S +++ /dev/null @@ -1,136 +0,0 @@ -/* Low-level libffi support for Altera Nios II. - - Copyright (c) 2013 Mentor Graphics. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* This function is declared on the C side as - - extern UINT64 ffi_call_sysv (void (*arghook) (char *, extended_cif *), - extended_cif *ecif, - unsigned nbytes, - void (*fn) (void)); - - On input, the arguments appear as - r4 = arghook - r5 = ecif - r6 = nbytes - r7 = fn -*/ - - .section .text - .align 2 - .global ffi_call_sysv - .type ffi_call_sysv, @function - -ffi_call_sysv: - .cfi_startproc - - /* Create the stack frame, saving r16 so we can use it locally. */ - addi sp, sp, -12 - .cfi_def_cfa_offset 12 - stw ra, 8(sp) - stw fp, 4(sp) - stw r16, 0(sp) - .cfi_offset 31, -4 - .cfi_offset 28, -8 - .cfi_offset 16, -12 - mov fp, sp - .cfi_def_cfa_register 28 - mov r16, r7 - - /* Adjust the stack pointer to create the argument buffer - nbytes long. */ - sub sp, sp, r6 - - /* Call the arghook function. */ - mov r2, r4 /* fn */ - mov r4, sp /* argbuffer */ - callr r2 /* r5 already contains ecif */ - - /* Pop off the first 16 bytes of the argument buffer on the stack, - transferring the contents to the argument registers. */ - ldw r4, 0(sp) - ldw r5, 4(sp) - ldw r6, 8(sp) - ldw r7, 12(sp) - addi sp, sp, 16 - - /* Call the user function, which leaves its result in r2 and r3. */ - callr r16 - - /* Pop off the stack frame. */ - mov sp, fp - ldw ra, 8(sp) - ldw fp, 4(sp) - ldw r16, 0(sp) - addi sp, sp, 12 - ret - .cfi_endproc - .size ffi_call_sysv, .-ffi_call_sysv - - -/* Closure trampolines jump here after putting the C helper address - in r9 and the closure pointer in r10. The user-supplied arguments - to the closure are in the normal places, in r4-r7 and on the - stack. Push the register arguments on the stack too and then call the - C helper function to deal with them. */ - - .section .text - .align 2 - .global ffi_closure_sysv - .type ffi_closure_sysv, @function - -ffi_closure_sysv: - .cfi_startproc - - /* Create the stack frame, pushing the register args on the stack - just below the stack args. This is the same trick illustrated - in Figure 7-3 in the Nios II Processor Reference Handbook, used - for variable arguments and structures passed by value. */ - addi sp, sp, -20 - .cfi_def_cfa_offset 20 - stw ra, 0(sp) - .cfi_offset 31, -20 - stw r4, 4(sp) - .cfi_offset 4, -16 - stw r5, 8(sp) - .cfi_offset 5, -12 - stw r6, 12(sp) - .cfi_offset 6, -8 - stw r7, 16(sp) - .cfi_offset 7, -4 - - /* Call the helper. - r4 = pointer to arguments on stack - r5 = closure pointer (loaded in r10 by the trampoline) - r9 = address of helper function (loaded by trampoline) */ - addi r4, sp, 4 - mov r5, r10 - callr r9 - - /* Pop the stack and return. */ - ldw ra, 0(sp) - addi sp, sp, 20 - .cfi_def_cfa_offset -20 - ret - .cfi_endproc - .size ffi_closure_sysv, .-ffi_closure_sysv - diff --git a/llgo/third_party/gofrontend/libffi/src/or1k/ffi.c b/llgo/third_party/gofrontend/libffi/src/or1k/ffi.c deleted file mode 100644 index 2bad938a29f75ccfc61f680ba0686c247254159a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/or1k/ffi.c +++ /dev/null @@ -1,328 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2014 Sebastian Macke - - OpenRISC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include "ffi_common.h" - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void* ffi_prep_args(char *stack, extended_cif *ecif) -{ - char *stacktemp = stack; - int i, s; - ffi_type **arg; - int count = 0; - int nfixedargs; - - nfixedargs = ecif->cif->nfixedargs; - arg = ecif->cif->arg_types; - void **argv = ecif->avalue; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) - { - *(void **) stack = ecif->rvalue; - stack += 4; - count = 4; - } - for(i=0; icif->nargs; i++) - { - - /* variadic args are saved on stack */ - if ((nfixedargs == 0) && (count < 24)) - { - count = 24; - stack = stacktemp + 24; - } - nfixedargs--; - - s = 4; - switch((*arg)->type) - { - case FFI_TYPE_STRUCT: - *(void **)stack = *argv; - break; - - case FFI_TYPE_SINT8: - *(signed int *) stack = (signed int)*(SINT8 *)(* argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) stack = (unsigned int)*(UINT8 *)(* argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) stack = (signed int)*(SINT16 *)(* argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) stack = (unsigned int)*(UINT16 *)(* argv); - break; - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - case FFI_TYPE_POINTER: - *(int *)stack = *(int*)(*argv); - break; - - default: /* 8 byte types */ - if (count == 20) /* never split arguments */ - { - stack += 4; - count += 4; - } - s = (*arg)->size; - memcpy(stack, *argv, s); - break; - } - - stack += s; - count += s; - argv++; - arg++; - } - return stacktemp + ((count>24)?24:0); -} - -extern void ffi_call_SYSV(unsigned, - extended_cif *, - void *(*)(int *, extended_cif *), - unsigned *, - void (*fn)(void), - unsigned); - - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - int i; - int size; - ffi_type **arg; - - /* Calculate size to allocate on stack */ - - for(i = 0, arg = cif->arg_types, size=0; i < cif->nargs; i++, arg++) - { - if ((*arg)->type == FFI_TYPE_STRUCT) - size += 4; - else - if ((*arg)->size <= 4) - size += 4; - else - size += 8; - } - - /* for variadic functions more space is needed on the stack */ - if (cif->nargs != cif->nfixedargs) - size += 24; - - if (cif->rtype->type == FFI_TYPE_STRUCT) - size += 4; - - - extended_cif ecif; - ecif.cif = cif; - ecif.avalue = avalue; - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(size, &ecif, ffi_prep_args, rvalue, fn, cif->flags); - break; - default: - FFI_ASSERT(0); - break; - } -} - - -void ffi_closure_SYSV(unsigned long r3, unsigned long r4, unsigned long r5, - unsigned long r6, unsigned long r7, unsigned long r8) -{ - register int *sp __asm__ ("r17"); - register int *r13 __asm__ ("r13"); - - ffi_closure* closure = (ffi_closure*) r13; - char *stack_args = sp; - - /* Lay the register arguments down in a continuous chunk of memory. */ - unsigned register_args[6] = - { r3, r4, r5, r6, r7, r8 }; - - /* Pointer to a struct return value. */ - void *struct_rvalue = (void *) r3; - - ffi_cif *cif = closure->cif; - ffi_type **arg_types = cif->arg_types; - void **avalue = alloca (cif->nargs * sizeof(void *)); - char *ptr = (char *) register_args; - int count = 0; - int nfixedargs = cif->nfixedargs; - int i; - - /* preserve struct type return pointer passing */ - - if ((cif->rtype != NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ptr += 4; - count = 4; - } - - /* Find the address of each argument. */ - for (i = 0; i < cif->nargs; i++) - { - - /* variadic args are saved on stack */ - if ((nfixedargs == 0) && (count < 24)) - { - ptr = stack_args; - count = 24; - } - nfixedargs--; - - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = ptr + 3; - break; - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = ptr + 2; - break; - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - case FFI_TYPE_POINTER: - avalue[i] = ptr; - break; - - case FFI_TYPE_STRUCT: - avalue[i] = *(void**)ptr; - break; - - default: - /* 8-byte values */ - - /* arguments are never splitted */ - if (ptr == ®ister_args[5]) - ptr = stack_args; - avalue[i] = ptr; - ptr += 4; - count += 4; - break; - } - ptr += 4; - count += 4; - - /* If we've handled more arguments than fit in registers, - start looking at the those passed on the stack. */ - - if (count == 24) - ptr = stack_args; - } - - if (cif->rtype && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - (closure->fun) (cif, struct_rvalue, avalue, closure->user_data); - } else - { - long long rvalue; - (closure->fun) (cif, &rvalue, avalue, closure->user_data); - if (cif->rtype) - asm ("l.ori r12, %0, 0x0\n l.lwz r11, 0(r12)\n l.lwz r12, 4(r12)" : : "r" (&rvalue)); - } -} - - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - unsigned short *tramp = (unsigned short *) closure->tramp; - unsigned long fn = (unsigned long) ffi_closure_SYSV; - unsigned long cls = (unsigned long) codeloc; - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - /* write pointers to temporary registers */ - tramp[0] = (0x6 << 10) | (13 << 5); /* l.movhi r13, ... */ - tramp[1] = cls >> 16; - tramp[2] = (0x2a << 10) | (13 << 5) | 13; /* l.ori r13, r13, ... */ - tramp[3] = cls & 0xFFFF; - - tramp[4] = (0x6 << 10) | (15 << 5); /* l.movhi r15, ... */ - tramp[5] = fn >> 16; - tramp[6] = (0x2a << 10) | (15 << 5) | 15; /* l.ori r15, r15 ... */ - tramp[7] = fn & 0xFFFF; - - tramp[8] = (0x11 << 10); /* l.jr r15 */ - tramp[9] = 15 << 11; - - tramp[10] = (0x2a << 10) | (17 << 5) | 1; /* l.ori r17, r1, ... */ - tramp[11] = 0x0; - - return FFI_OK; -} - - -ffi_status ffi_prep_cif_machdep (ffi_cif *cif) -{ - cif->flags = 0; - - /* structures are returned as pointers */ - if (cif->rtype->type == FFI_TYPE_STRUCT) - cif->flags = FFI_TYPE_STRUCT; - else - if (cif->rtype->size > 4) - cif->flags = FFI_TYPE_UINT64; - - cif->nfixedargs = cif->nargs; - - return FFI_OK; -} - - -ffi_status ffi_prep_cif_machdep_var(ffi_cif *cif, - unsigned int nfixedargs, unsigned int ntotalargs) -{ - ffi_status status; - - status = ffi_prep_cif_machdep (cif); - cif->nfixedargs = nfixedargs; - return status; -} diff --git a/llgo/third_party/gofrontend/libffi/src/or1k/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/or1k/ffitarget.h deleted file mode 100644 index e55da286185a108cbea2459a05b67519eee3d334..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/or1k/ffitarget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* ----------------------------------------------------------------------- - ffitarget.h - Copyright (c) 2014 Sebastian Macke - - OpenRISC Target configuration macros - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 -#define FFI_TRAMPOLINE_SIZE (24) - -#define FFI_TARGET_SPECIFIC_VARIADIC 1 -#define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs; - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/or1k/sysv.S b/llgo/third_party/gofrontend/libffi/src/or1k/sysv.S deleted file mode 100644 index df6570ba9d3e7c90e00b2e6ae2283cb1fb12bb82..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/or1k/sysv.S +++ /dev/null @@ -1,107 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2014 Sebastian Macke - - OpenRISC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -.text - .globl ffi_call_SYSV - .type ffi_call_SYSV, @function -/* - r3: size to allocate on stack - r4: extended cif structure - r5: function pointer ffi_prep_args - r6: ret address - r7: function to call - r8: flag for return type -*/ - -ffi_call_SYSV: - /* Store registers used on stack */ - l.sw -4(r1), r9 /* return address */ - l.sw -8(r1), r1 /* stack address */ - l.sw -12(r1), r14 /* callee saved registers */ - l.sw -16(r1), r16 - l.sw -20(r1), r18 - l.sw -24(r1), r20 - - l.ori r14, r1, 0x0 /* save stack pointer */ - l.addi r1, r1, -24 - - l.ori r16, r7, 0x0 /* save function address */ - l.ori r18, r6, 0x0 /* save ret address */ - l.ori r20, r8, 0x0 /* save flag */ - - l.sub r1, r1, r3 /* reserve space on stack */ - - /* Call ffi_prep_args */ - l.ori r3, r1, 0x0 /* first argument stack address, second already ecif */ - l.jalr r5 - l.nop - - /* Load register arguments and call*/ - - l.lwz r3, 0(r1) - l.lwz r4, 4(r1) - l.lwz r5, 8(r1) - l.lwz r6, 12(r1) - l.lwz r7, 16(r1) - l.lwz r8, 20(r1) - l.ori r1, r11, 0x0 /* new stack pointer */ - l.jalr r16 - l.nop - - /* handle return values */ - - l.sfeqi r20, FFI_TYPE_STRUCT - l.bf ret /* structs don't return an rvalue */ - l.nop - - /* copy ret address */ - - l.sfeqi r20, FFI_TYPE_UINT64 - l.bnf four_byte_ret /* 8 byte value is returned */ - l.nop - - l.sw 4(r18), r12 - -four_byte_ret: - l.sw 0(r18), r11 - -ret: - /* return */ - l.ori r1, r14, 0x0 /* reset stack pointer */ - l.lwz r9, -4(r1) - l.lwz r1, -8(r1) - l.lwz r14, -12(r1) - l.lwz r16, -16(r1) - l.lwz r18, -20(r1) - l.lwz r20, -24(r1) - l.jr r9 - l.nop - -.size ffi_call_SYSV, .-ffi_call_SYSV diff --git a/llgo/third_party/gofrontend/libffi/src/pa/ffi.c b/llgo/third_party/gofrontend/libffi/src/pa/ffi.c deleted file mode 100644 index 4ce2bc6f0e4c46336acffbc05fb754c93ffbf881..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/pa/ffi.c +++ /dev/null @@ -1,719 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - (c) 2011 Anthony Green - (c) 2008 Red Hat, Inc. - (c) 2006 Free Software Foundation, Inc. - (c) 2003-2004 Randolph Chung - - HPPA Foreign Function Interface - HP-UX PA ABI support - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include - -#define ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1)) - -#define MIN_STACK_SIZE 64 -#define FIRST_ARG_SLOT 9 -#define DEBUG_LEVEL 0 - -#define fldw(addr, fpreg) \ - __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg) -#define fstw(fpreg, addr) \ - __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr)) -#define fldd(addr, fpreg) \ - __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg) -#define fstd(fpreg, addr) \ - __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr)) - -#define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0) - -static inline int ffi_struct_type(ffi_type *t) -{ - size_t sz = t->size; - - /* Small structure results are passed in registers, - larger ones are passed by pointer. Note that - small structures of size 2, 4 and 8 differ from - the corresponding integer types in that they have - different alignment requirements. */ - - if (sz <= 1) - return FFI_TYPE_UINT8; - else if (sz == 2) - return FFI_TYPE_SMALL_STRUCT2; - else if (sz == 3) - return FFI_TYPE_SMALL_STRUCT3; - else if (sz == 4) - return FFI_TYPE_SMALL_STRUCT4; - else if (sz == 5) - return FFI_TYPE_SMALL_STRUCT5; - else if (sz == 6) - return FFI_TYPE_SMALL_STRUCT6; - else if (sz == 7) - return FFI_TYPE_SMALL_STRUCT7; - else if (sz <= 8) - return FFI_TYPE_SMALL_STRUCT8; - else - return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */ -} - -/* PA has a downward growing stack, which looks like this: - - Offset - [ Variable args ] - SP = (4*(n+9)) arg word N - ... - SP-52 arg word 4 - [ Fixed args ] - SP-48 arg word 3 - SP-44 arg word 2 - SP-40 arg word 1 - SP-36 arg word 0 - [ Frame marker ] - ... - SP-20 RP - SP-4 previous SP - - The first four argument words on the stack are reserved for use by - the callee. Instead, the general and floating registers replace - the first four argument slots. Non FP arguments are passed solely - in the general registers. FP arguments are passed in both general - and floating registers when using libffi. - - Non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23. - Non-FP 64-bit args are passed in register pairs, starting - on an odd numbered register (i.e. r25+r26 and r23+r24). - FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L. - FP 64-bit arguments are passed in fr5 and fr7. - - The registers are allocated in the same manner as stack slots. - This allows the callee to save its arguments on the stack if - necessary: - - arg word 3 -> gr23 or fr7L - arg word 2 -> gr24 or fr6L or fr7R - arg word 1 -> gr25 or fr5L - arg word 0 -> gr26 or fr4L or fr5R - - Note that fr4R and fr6R are never used for arguments (i.e., - doubles are not passed in fr4 or fr6). - - The rest of the arguments are passed on the stack starting at SP-52, - but 64-bit arguments need to be aligned to an 8-byte boundary - - This means we can have holes either in the register allocation, - or in the stack. */ - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments - - The following code will put everything into the stack frame - (which was allocated by the asm routine), and on return - the asm routine will load the arguments that should be - passed by register into the appropriate registers - - NOTE: We load floating point args in this function... that means we - assume gcc will not mess with fp regs in here. */ - -void ffi_prep_args_pa32(UINT32 *stack, extended_cif *ecif, unsigned bytes) -{ - register unsigned int i; - register ffi_type **p_arg; - register void **p_argv; - unsigned int slot = FIRST_ARG_SLOT; - char *dest_cpy; - size_t len; - - debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, - ecif, bytes); - - p_arg = ecif->cif->arg_types; - p_argv = ecif->avalue; - - for (i = 0; i < ecif->cif->nargs; i++) - { - int type = (*p_arg)->type; - - switch (type) - { - case FFI_TYPE_SINT8: - *(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv); - break; - - case FFI_TYPE_UINT8: - *(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv); - break; - - case FFI_TYPE_SINT16: - *(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv); - break; - - case FFI_TYPE_UINT16: - *(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv); - break; - - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), - slot); - *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - /* Align slot for 64-bit type. */ - slot += (slot & 1) ? 1 : 2; - *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); - break; - - case FFI_TYPE_FLOAT: - /* First 4 args go in fr4L - fr7L. */ - debug(3, "Storing UINT32(float) in slot %u\n", slot); - *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); - switch (slot - FIRST_ARG_SLOT) - { - /* First 4 args go in fr4L - fr7L. */ - case 0: fldw(stack - slot, fr4); break; - case 1: fldw(stack - slot, fr5); break; - case 2: fldw(stack - slot, fr6); break; - case 3: fldw(stack - slot, fr7); break; - } - break; - - case FFI_TYPE_DOUBLE: - /* Align slot for 64-bit type. */ - slot += (slot & 1) ? 1 : 2; - debug(3, "Storing UINT64(double) at slot %u\n", slot); - *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); - switch (slot - FIRST_ARG_SLOT) - { - /* First 2 args go in fr5, fr7. */ - case 1: fldd(stack - slot, fr5); break; - case 3: fldd(stack - slot, fr7); break; - } - break; - -#ifdef PA_HPUX - case FFI_TYPE_LONGDOUBLE: - /* Long doubles are passed in the same manner as structures - larger than 8 bytes. */ - *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); - break; -#endif - - case FFI_TYPE_STRUCT: - - /* Structs smaller or equal than 4 bytes are passed in one - register. Structs smaller or equal 8 bytes are passed in two - registers. Larger structures are passed by pointer. */ - - len = (*p_arg)->size; - if (len <= 4) - { - dest_cpy = (char *)(stack - slot) + 4 - len; - memcpy(dest_cpy, (char *)*p_argv, len); - } - else if (len <= 8) - { - slot += (slot & 1) ? 1 : 2; - dest_cpy = (char *)(stack - slot) + 8 - len; - memcpy(dest_cpy, (char *)*p_argv, len); - } - else - *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); - break; - - default: - FFI_ASSERT(0); - } - - slot++; - p_arg++; - p_argv++; - } - - /* Make sure we didn't mess up and scribble on the stack. */ - { - unsigned int n; - - debug(5, "Stack setup:\n"); - for (n = 0; n < (bytes + 3) / 4; n++) - { - if ((n%4) == 0) { debug(5, "\n%08x: ", (unsigned int)(stack - n)); } - debug(5, "%08x ", *(stack - n)); - } - debug(5, "\n"); - } - - FFI_ASSERT(slot * 4 <= bytes); - - return; -} - -static void ffi_size_stack_pa32(ffi_cif *cif) -{ - ffi_type **ptr; - int i; - int z = 0; /* # stack slots */ - - for (ptr = cif->arg_types, i = 0; i < cif->nargs; ptr++, i++) - { - int type = (*ptr)->type; - - switch (type) - { - case FFI_TYPE_DOUBLE: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - z += 2 + (z & 1); /* must start on even regs, so we may waste one */ - break; - -#ifdef PA_HPUX - case FFI_TYPE_LONGDOUBLE: -#endif - case FFI_TYPE_STRUCT: - z += 1; /* pass by ptr, callee will copy */ - break; - - default: /* <= 32-bit values */ - z++; - } - } - - /* We can fit up to 6 args in the default 64-byte stack frame, - if we need more, we need more stack. */ - if (z <= 6) - cif->bytes = MIN_STACK_SIZE; /* min stack size */ - else - cif->bytes = 64 + ROUND_UP((z - 6) * sizeof(UINT32), MIN_STACK_SIZE); - - debug(3, "Calculated stack size is %u bytes\n", cif->bytes); -} - -/* Perform machine dependent cif processing. */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - cif->flags = (unsigned) cif->rtype->type; - break; - -#ifdef PA_HPUX - case FFI_TYPE_LONGDOUBLE: - /* Long doubles are treated like a structure. */ - cif->flags = FFI_TYPE_STRUCT; - break; -#endif - - case FFI_TYPE_STRUCT: - /* For the return type we have to check the size of the structures. - If the size is smaller or equal 4 bytes, the result is given back - in one register. If the size is smaller or equal 8 bytes than we - return the result in two registers. But if the size is bigger than - 8 bytes, we work with pointers. */ - cif->flags = ffi_struct_type(cif->rtype); - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - cif->flags = FFI_TYPE_UINT64; - break; - - default: - cif->flags = FFI_TYPE_INT; - break; - } - - /* Lucky us, because of the unique PA ABI we get to do our - own stack sizing. */ - switch (cif->abi) - { - case FFI_PA32: - ffi_size_stack_pa32(cif); - break; - - default: - FFI_ASSERT(0); - break; - } - - return FFI_OK; -} - -extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), - extended_cif *, unsigned, unsigned, unsigned *, - void (*fn)(void)); - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return - value address then we need to make one. */ - - if (rvalue == NULL -#ifdef PA_HPUX - && (cif->rtype->type == FFI_TYPE_STRUCT - || cif->rtype->type == FFI_TYPE_LONGDOUBLE)) -#else - && cif->rtype->type == FFI_TYPE_STRUCT) -#endif - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - - switch (cif->abi) - { - case FFI_PA32: - debug(3, "Calling ffi_call_pa32: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn); - ffi_call_pa32(ffi_prep_args_pa32, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - - default: - FFI_ASSERT(0); - break; - } -} - -#if FFI_CLOSURES -/* This is more-or-less an inverse of ffi_call -- we have arguments on - the stack, and we need to fill them into a cif structure and invoke - the user function. This really ought to be in asm to make sure - the compiler doesn't do things we don't expect. */ -ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) -{ - ffi_cif *cif; - void **avalue; - void *rvalue; - UINT32 ret[2]; /* function can return up to 64-bits in registers */ - ffi_type **p_arg; - char *tmp; - int i, avn; - unsigned int slot = FIRST_ARG_SLOT; - register UINT32 r28 asm("r28"); - - cif = closure->cif; - - /* If returning via structure, callee will write to our pointer. */ - if (cif->flags == FFI_TYPE_STRUCT) - rvalue = (void *)r28; - else - rvalue = &ret[0]; - - avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG); - avn = cif->nargs; - p_arg = cif->arg_types; - - for (i = 0; i < avn; i++) - { - int type = (*p_arg)->type; - - switch (type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - slot += (slot & 1) ? 1 : 2; - avalue[i] = (void *)(stack - slot); - break; - - case FFI_TYPE_FLOAT: -#ifdef PA_LINUX - /* The closure call is indirect. In Linux, floating point - arguments in indirect calls with a prototype are passed - in the floating point registers instead of the general - registers. So, we need to replace what was previously - stored in the current slot with the value in the - corresponding floating point register. */ - switch (slot - FIRST_ARG_SLOT) - { - case 0: fstw(fr4, (void *)(stack - slot)); break; - case 1: fstw(fr5, (void *)(stack - slot)); break; - case 2: fstw(fr6, (void *)(stack - slot)); break; - case 3: fstw(fr7, (void *)(stack - slot)); break; - } -#endif - avalue[i] = (void *)(stack - slot); - break; - - case FFI_TYPE_DOUBLE: - slot += (slot & 1) ? 1 : 2; -#ifdef PA_LINUX - /* See previous comment for FFI_TYPE_FLOAT. */ - switch (slot - FIRST_ARG_SLOT) - { - case 1: fstd(fr5, (void *)(stack - slot)); break; - case 3: fstd(fr7, (void *)(stack - slot)); break; - } -#endif - avalue[i] = (void *)(stack - slot); - break; - -#ifdef PA_HPUX - case FFI_TYPE_LONGDOUBLE: - /* Long doubles are treated like a big structure. */ - avalue[i] = (void *) *(stack - slot); - break; -#endif - - case FFI_TYPE_STRUCT: - /* Structs smaller or equal than 4 bytes are passed in one - register. Structs smaller or equal 8 bytes are passed in two - registers. Larger structures are passed by pointer. */ - if((*p_arg)->size <= 4) - { - avalue[i] = (void *)(stack - slot) + sizeof(UINT32) - - (*p_arg)->size; - } - else if ((*p_arg)->size <= 8) - { - slot += (slot & 1) ? 1 : 2; - avalue[i] = (void *)(stack - slot) + sizeof(UINT64) - - (*p_arg)->size; - } - else - avalue[i] = (void *) *(stack - slot); - break; - - default: - FFI_ASSERT(0); - } - - slot++; - p_arg++; - } - - /* Invoke the closure. */ - (closure->fun) (cif, rvalue, avalue, closure->user_data); - - debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0], - ret[1]); - - /* Store the result using the lower 2 bytes of the flags. */ - switch (cif->flags) - { - case FFI_TYPE_UINT8: - *(stack - FIRST_ARG_SLOT) = (UINT8)(ret[0] >> 24); - break; - case FFI_TYPE_SINT8: - *(stack - FIRST_ARG_SLOT) = (SINT8)(ret[0] >> 24); - break; - case FFI_TYPE_UINT16: - *(stack - FIRST_ARG_SLOT) = (UINT16)(ret[0] >> 16); - break; - case FFI_TYPE_SINT16: - *(stack - FIRST_ARG_SLOT) = (SINT16)(ret[0] >> 16); - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - *(stack - FIRST_ARG_SLOT) = ret[0]; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - *(stack - FIRST_ARG_SLOT) = ret[0]; - *(stack - FIRST_ARG_SLOT - 1) = ret[1]; - break; - - case FFI_TYPE_DOUBLE: - fldd(rvalue, fr4); - break; - - case FFI_TYPE_FLOAT: - fldw(rvalue, fr4); - break; - - case FFI_TYPE_STRUCT: - /* Don't need a return value, done by caller. */ - break; - - case FFI_TYPE_SMALL_STRUCT2: - case FFI_TYPE_SMALL_STRUCT3: - case FFI_TYPE_SMALL_STRUCT4: - tmp = (void*)(stack - FIRST_ARG_SLOT); - tmp += 4 - cif->rtype->size; - memcpy((void*)tmp, &ret[0], cif->rtype->size); - break; - - case FFI_TYPE_SMALL_STRUCT5: - case FFI_TYPE_SMALL_STRUCT6: - case FFI_TYPE_SMALL_STRUCT7: - case FFI_TYPE_SMALL_STRUCT8: - { - unsigned int ret2[2]; - int off; - - /* Right justify ret[0] and ret[1] */ - switch (cif->flags) - { - case FFI_TYPE_SMALL_STRUCT5: off = 3; break; - case FFI_TYPE_SMALL_STRUCT6: off = 2; break; - case FFI_TYPE_SMALL_STRUCT7: off = 1; break; - default: off = 0; break; - } - - memset (ret2, 0, sizeof (ret2)); - memcpy ((char *)ret2 + off, ret, 8 - off); - - *(stack - FIRST_ARG_SLOT) = ret2[0]; - *(stack - FIRST_ARG_SLOT - 1) = ret2[1]; - } - break; - - case FFI_TYPE_POINTER: - case FFI_TYPE_VOID: - break; - - default: - debug(0, "assert with cif->flags: %d\n",cif->flags); - FFI_ASSERT(0); - break; - } - return FFI_OK; -} - -/* Fill in a closure to refer to the specified fun and user_data. - cif specifies the argument and result types for fun. - The cif must already be prep'ed. */ - -extern void ffi_closure_pa32(void); - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - UINT32 *tramp = (UINT32 *)(closure->tramp); -#ifdef PA_HPUX - UINT32 *tmp; -#endif - - if (cif->abi != FFI_PA32) - return FFI_BAD_ABI; - - /* Make a small trampoline that will branch to our - handler function. Use PC-relative addressing. */ - -#ifdef PA_LINUX - tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ - tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ - tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1 ; load plabel */ - tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ - tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ - tramp[5] = 0xeac0c000; /* bv%r0(%r22) ; branch to handler */ - tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ - tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2); - - /* Flush d/icache -- have to flush up 2 two lines because of - alignment. */ - __asm__ volatile( - "fdc 0(%0)\n\t" - "fdc %1(%0)\n\t" - "fic 0(%%sr4, %0)\n\t" - "fic %1(%%sr4, %0)\n\t" - "sync\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n" - : - : "r"((unsigned long)tramp & ~31), - "r"(32 /* stride */) - : "memory"); -#endif - -#ifdef PA_HPUX - tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ - tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ - tramp[2] = 0x4aa10038; /* ldw 28(%r21),%r1 ; load plabel */ - tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ - tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ - tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20 ; load space id */ - tramp[6] = 0x00141820; /* mtsp %r20,%sr0 ; into %sr0 */ - tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22) ; branch to handler */ - tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ - tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2); - - /* Flush d/icache -- have to flush three lines because of alignment. */ - __asm__ volatile( - "copy %1,%0\n\t" - "fdc,m %2(%0)\n\t" - "fdc,m %2(%0)\n\t" - "fdc,m %2(%0)\n\t" - "ldsid (%1),%0\n\t" - "mtsp %0,%%sr0\n\t" - "copy %1,%0\n\t" - "fic,m %2(%%sr0,%0)\n\t" - "fic,m %2(%%sr0,%0)\n\t" - "fic,m %2(%%sr0,%0)\n\t" - "sync\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n" - : "=&r" ((unsigned long)tmp) - : "r" ((unsigned long)tramp & ~31), - "r" (32/* stride */) - : "memory"); -#endif - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/pa/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/pa/ffitarget.h deleted file mode 100644 index fff4c6b382e54cf1d0001883db258e849a4e5440..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/pa/ffitarget.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for hppa. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - -#ifdef PA_LINUX - FFI_PA32, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_PA32 -#endif - -#ifdef PA_HPUX - FFI_PA32, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_PA32 -#endif - -#ifdef PA64_HPUX -#error "PA64_HPUX FFI is not yet implemented" - FFI_PA64, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_PA64 -#endif -} ffi_abi; -#endif - -#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 - -#ifdef PA_LINUX -#define FFI_TRAMPOLINE_SIZE 32 -#else -#define FFI_TRAMPOLINE_SIZE 40 -#endif - -#define FFI_TYPE_SMALL_STRUCT2 -1 -#define FFI_TYPE_SMALL_STRUCT3 -2 -#define FFI_TYPE_SMALL_STRUCT4 -3 -#define FFI_TYPE_SMALL_STRUCT5 -4 -#define FFI_TYPE_SMALL_STRUCT6 -5 -#define FFI_TYPE_SMALL_STRUCT7 -6 -#define FFI_TYPE_SMALL_STRUCT8 -7 -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/pa/hpux32.S b/llgo/third_party/gofrontend/libffi/src/pa/hpux32.S deleted file mode 100644 index 40528bad7511cec19bf8c6dad08ce12561eb6720..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/pa/hpux32.S +++ /dev/null @@ -1,368 +0,0 @@ -/* ----------------------------------------------------------------------- - hpux32.S - Copyright (c) 2006 Free Software Foundation, Inc. - (c) 2008 Red Hat, Inc. - based on src/pa/linux.S - - HP-UX PA Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - .LEVEL 1.1 - .SPACE $PRIVATE$ - .IMPORT $global$,DATA - .IMPORT $$dyncall,MILLICODE - .SUBSPA $DATA$ - .align 4 - - /* void ffi_call_pa32(void (*)(char *, extended_cif *), - extended_cif *ecif, - unsigned bytes, - unsigned flags, - unsigned *rvalue, - void (*fn)(void)); - */ - - .export ffi_call_pa32,ENTRY,PRIV_LEV=3 - .import ffi_prep_args_pa32,CODE - - .SPACE $TEXT$ - .SUBSPA $CODE$ - .align 4 - -L$FB1 -ffi_call_pa32 - .proc - .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 - .entry - stw %rp, -20(%sp) - copy %r3, %r1 -L$CFI11 - copy %sp, %r3 -L$CFI12 - - /* Setup the stack for calling prep_args... - We want the stack to look like this: - - [ Previous stack ] <- %r3 - - [ 64-bytes register save area ] <- %r4 - - [ Stack space for actual call, passed as ] <- %arg0 - [ arg0 to ffi_prep_args_pa32 ] - - [ Stack for calling prep_args ] <- %sp - */ - - stwm %r1, 64(%sp) - stw %r4, 12(%r3) -L$CFI13 - copy %sp, %r4 - - addl %arg2, %r4, %arg0 ; arg stack - stw %arg3, -48(%r3) ; save flags we need it later - - /* Call prep_args: - %arg0(stack) -- set up above - %arg1(ecif) -- same as incoming param - %arg2(bytes) -- same as incoming param */ - bl ffi_prep_args_pa32,%r2 - ldo 64(%arg0), %sp - ldo -64(%sp), %sp - - /* now %sp should point where %arg0 was pointing. */ - - /* Load the arguments that should be passed in registers - The fp args are loaded by the prep_args function. */ - ldw -36(%sp), %arg0 - ldw -40(%sp), %arg1 - ldw -44(%sp), %arg2 - ldw -48(%sp), %arg3 - - /* in case the function is going to return a structure - we need to give it a place to put the result. */ - ldw -52(%r3), %ret0 ; %ret0 <- rvalue - ldw -56(%r3), %r22 ; %r22 <- function to call - bl $$dyncall, %r31 ; Call the user function - copy %r31, %rp - - /* Prepare to store the result; we need to recover flags and rvalue. */ - ldw -48(%r3), %r21 ; r21 <- flags - ldw -52(%r3), %r20 ; r20 <- rvalue - - /* Store the result according to the return type. The most - likely types should come first. */ - -L$checkint - comib,<>,n FFI_TYPE_INT, %r21, L$checkint8 - b L$done - stw %ret0, 0(%r20) - -L$checkint8 - comib,<>,n FFI_TYPE_UINT8, %r21, L$checkint16 - b L$done - stb %ret0, 0(%r20) - -L$checkint16 - comib,<>,n FFI_TYPE_UINT16, %r21, L$checkdbl - b L$done - sth %ret0, 0(%r20) - -L$checkdbl - comib,<>,n FFI_TYPE_DOUBLE, %r21, L$checkfloat - b L$done - fstd %fr4,0(%r20) - -L$checkfloat - comib,<>,n FFI_TYPE_FLOAT, %r21, L$checkll - b L$done - fstw %fr4L,0(%r20) - -L$checkll - comib,<>,n FFI_TYPE_UINT64, %r21, L$checksmst2 - stw %ret0, 0(%r20) - b L$done - stw %ret1, 4(%r20) - -L$checksmst2 - comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, L$checksmst3 - /* 2-byte structs are returned in ret0 as ????xxyy. */ - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret0, 0(%r20) - -L$checksmst3 - comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, L$checksmst4 - /* 3-byte structs are returned in ret0 as ??xxyyzz. */ - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret0, 0(%r20) - -L$checksmst4 - comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, L$checksmst5 - /* 4-byte structs are returned in ret0 as wwxxyyzz. */ - extru %ret0, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret0, 0(%r20) - -L$checksmst5 - comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, L$checksmst6 - /* 5 byte values are returned right justified: - ret0 ret1 - 5: ??????aa bbccddee */ - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret1, 0(%r20) - -L$checksmst6 - comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, L$checksmst7 - /* 6 byte values are returned right justified: - ret0 ret1 - 6: ????aabb ccddeeff */ - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret1, 0(%r20) - -L$checksmst7 - comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, L$checksmst8 - /* 7 byte values are returned right justified: - ret0 ret1 - 7: ??aabbcc ddeeffgg */ - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b L$done - stb %ret1, 0(%r20) - -L$checksmst8 - comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, L$done - /* 8 byte values are returned right justified: - ret0 ret1 - 8: aabbccdd eeffgghh */ - extru %ret0, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stb %ret1, 0(%r20) - -L$done - /* all done, return */ - copy %r4, %sp ; pop arg stack - ldw 12(%r3), %r4 - ldwm -64(%sp), %r3 ; .. and pop stack - ldw -20(%sp), %rp - bv %r0(%rp) - nop - .exit - .procend -L$FE1 - - /* void ffi_closure_pa32(void); - Called with closure argument in %r21 */ - - .SPACE $TEXT$ - .SUBSPA $CODE$ - .export ffi_closure_pa32,ENTRY,PRIV_LEV=3,RTNVAL=GR - .import ffi_closure_inner_pa32,CODE - .align 4 -L$FB2 -ffi_closure_pa32 - .proc - .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 - .entry - - stw %rp, -20(%sp) - copy %r3, %r1 -L$CFI21 - copy %sp, %r3 -L$CFI22 - stwm %r1, 64(%sp) - - /* Put arguments onto the stack and call ffi_closure_inner. */ - stw %arg0, -36(%r3) - stw %arg1, -40(%r3) - stw %arg2, -44(%r3) - stw %arg3, -48(%r3) - - copy %r21, %arg0 - bl ffi_closure_inner_pa32, %r2 - copy %r3, %arg1 - ldwm -64(%sp), %r3 - ldw -20(%sp), %rp - ldw -36(%sp), %ret0 - bv %r0(%rp) - ldw -40(%sp), %ret1 - .exit - .procend -L$FE2: - - .SPACE $PRIVATE$ - .SUBSPA $DATA$ - - .align 4 - .EXPORT _GLOBAL__F_ffi_call_pa32,DATA -_GLOBAL__F_ffi_call_pa32 -L$frame1: - .word L$ECIE1-L$SCIE1 ;# Length of Common Information Entry -L$SCIE1: - .word 0x0 ;# CIE Identifier Tag - .byte 0x1 ;# CIE Version - .ascii "\0" ;# CIE Augmentation - .uleb128 0x1 ;# CIE Code Alignment Factor - .sleb128 4 ;# CIE Data Alignment Factor - .byte 0x2 ;# CIE RA Column - .byte 0xc ;# DW_CFA_def_cfa - .uleb128 0x1e - .uleb128 0x0 - .align 4 -L$ECIE1: -L$SFDE1: - .word L$EFDE1-L$ASFDE1 ;# FDE Length -L$ASFDE1: - .word L$ASFDE1-L$frame1 ;# FDE CIE offset - .word L$FB1 ;# FDE initial location - .word L$FE1-L$FB1 ;# FDE address range - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word L$CFI11-L$FB1 - .byte 0x83 ;# DW_CFA_offset, column 0x3 - .uleb128 0x0 - .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] - .uleb128 0x2 - .sleb128 -5 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word L$CFI12-L$CFI11 - .byte 0xd ;# DW_CFA_def_cfa_register = r3 - .uleb128 0x3 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word L$CFI13-L$CFI12 - .byte 0x84 ;# DW_CFA_offset, column 0x4 - .uleb128 0x3 - - .align 4 -L$EFDE1: - -L$SFDE2: - .word L$EFDE2-L$ASFDE2 ;# FDE Length -L$ASFDE2: - .word L$ASFDE2-L$frame1 ;# FDE CIE offset - .word L$FB2 ;# FDE initial location - .word L$FE2-L$FB2 ;# FDE address range - .byte 0x4 ;# DW_CFA_advance_loc4 - .word L$CFI21-L$FB2 - .byte 0x83 ;# DW_CFA_offset, column 0x3 - .uleb128 0x0 - .byte 0x11 ;# DW_CFA_offset_extended_sf - .uleb128 0x2 - .sleb128 -5 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word L$CFI22-L$CFI21 - .byte 0xd ;# DW_CFA_def_cfa_register = r3 - .uleb128 0x3 - - .align 4 -L$EFDE2: diff --git a/llgo/third_party/gofrontend/libffi/src/pa/linux.S b/llgo/third_party/gofrontend/libffi/src/pa/linux.S deleted file mode 100644 index f11ae768074d93657a822b7be2f885efd52bfa47..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/pa/linux.S +++ /dev/null @@ -1,357 +0,0 @@ -/* ----------------------------------------------------------------------- - linux.S - (c) 2003-2004 Randolph Chung - (c) 2008 Red Hat, Inc. - - HPPA Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - .text - .level 1.1 - .align 4 - - /* void ffi_call_pa32(void (*)(char *, extended_cif *), - extended_cif *ecif, - unsigned bytes, - unsigned flags, - unsigned *rvalue, - void (*fn)(void)); - */ - - .export ffi_call_pa32,code - .import ffi_prep_args_pa32,code - - .type ffi_call_pa32, @function -.LFB1: -ffi_call_pa32: - .proc - .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 - .entry - stw %rp, -20(%sp) - copy %r3, %r1 -.LCFI11: - - copy %sp, %r3 -.LCFI12: - - /* Setup the stack for calling prep_args... - We want the stack to look like this: - - [ Previous stack ] <- %r3 - - [ 64-bytes register save area ] <- %r4 - - [ Stack space for actual call, passed as ] <- %arg0 - [ arg0 to ffi_prep_args_pa32 ] - - [ Stack for calling prep_args ] <- %sp - */ - - stwm %r1, 64(%sp) - stw %r4, 12(%r3) -.LCFI13: - copy %sp, %r4 - - addl %arg2, %r4, %arg0 /* arg stack */ - stw %arg3, -48(%r3) /* save flags; we need it later */ - - /* Call prep_args: - %arg0(stack) -- set up above - %arg1(ecif) -- same as incoming param - %arg2(bytes) -- same as incoming param */ - bl ffi_prep_args_pa32,%r2 - ldo 64(%arg0), %sp - ldo -64(%sp), %sp - - /* now %sp should point where %arg0 was pointing. */ - - /* Load the arguments that should be passed in registers - The fp args were loaded by the prep_args function. */ - ldw -36(%sp), %arg0 - ldw -40(%sp), %arg1 - ldw -44(%sp), %arg2 - ldw -48(%sp), %arg3 - - /* in case the function is going to return a structure - we need to give it a place to put the result. */ - ldw -52(%r3), %ret0 /* %ret0 <- rvalue */ - ldw -56(%r3), %r22 /* %r22 <- function to call */ - bl $$dyncall, %r31 /* Call the user function */ - copy %r31, %rp - - /* Prepare to store the result; we need to recover flags and rvalue. */ - ldw -48(%r3), %r21 /* r21 <- flags */ - ldw -52(%r3), %r20 /* r20 <- rvalue */ - - /* Store the result according to the return type. */ - -.Lcheckint: - comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8 - b .Ldone - stw %ret0, 0(%r20) - -.Lcheckint8: - comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16 - b .Ldone - stb %ret0, 0(%r20) - -.Lcheckint16: - comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl - b .Ldone - sth %ret0, 0(%r20) - -.Lcheckdbl: - comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat - b .Ldone - fstd %fr4,0(%r20) - -.Lcheckfloat: - comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll - b .Ldone - fstw %fr4L,0(%r20) - -.Lcheckll: - comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2 - stw %ret0, 0(%r20) - b .Ldone - stw %ret1, 4(%r20) - -.Lchecksmst2: - comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3 - /* 2-byte structs are returned in ret0 as ????xxyy. */ - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret0, 0(%r20) - -.Lchecksmst3: - comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4 - /* 3-byte structs are returned in ret0 as ??xxyyzz. */ - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret0, 0(%r20) - -.Lchecksmst4: - comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5 - /* 4-byte structs are returned in ret0 as wwxxyyzz. */ - extru %ret0, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret0, 0(%r20) - -.Lchecksmst5: - comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6 - /* 5 byte values are returned right justified: - ret0 ret1 - 5: ??????aa bbccddee */ - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret1, 0(%r20) - -.Lchecksmst6: - comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7 - /* 6 byte values are returned right justified: - ret0 ret1 - 6: ????aabb ccddeeff */ - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret1, 0(%r20) - -.Lchecksmst7: - comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8 - /* 7 byte values are returned right justified: - ret0 ret1 - 7: ??aabbcc ddeeffgg */ - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - b .Ldone - stb %ret1, 0(%r20) - -.Lchecksmst8: - comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone - /* 8 byte values are returned right justified: - ret0 ret1 - 8: aabbccdd eeffgghh */ - extru %ret0, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret0, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stbs,ma %ret0, 1(%r20) - extru %ret1, 7, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 15, 8, %r22 - stbs,ma %r22, 1(%r20) - extru %ret1, 23, 8, %r22 - stbs,ma %r22, 1(%r20) - stb %ret1, 0(%r20) - -.Ldone: - /* all done, return */ - copy %r4, %sp /* pop arg stack */ - ldw 12(%r3), %r4 - ldwm -64(%sp), %r3 /* .. and pop stack */ - ldw -20(%sp), %rp - bv %r0(%rp) - nop - .exit - .procend -.LFE1: - - /* void ffi_closure_pa32(void); - Called with closure argument in %r21 */ - .export ffi_closure_pa32,code - .import ffi_closure_inner_pa32,code - - .type ffi_closure_pa32, @function -.LFB2: -ffi_closure_pa32: - .proc - .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 - .entry - - stw %rp, -20(%sp) -.LCFI20: - copy %r3, %r1 -.LCFI21: - copy %sp, %r3 -.LCFI22: - stwm %r1, 64(%sp) - - /* Put arguments onto the stack and call ffi_closure_inner. */ - stw %arg0, -36(%r3) - stw %arg1, -40(%r3) - stw %arg2, -44(%r3) - stw %arg3, -48(%r3) - - copy %r21, %arg0 - bl ffi_closure_inner_pa32, %r2 - copy %r3, %arg1 - - ldwm -64(%sp), %r3 - ldw -20(%sp), %rp - ldw -36(%sp), %ret0 - bv %r0(%r2) - ldw -40(%sp), %ret1 - - .exit - .procend -.LFE2: - - .section ".eh_frame",EH_FRAME_FLAGS,@progbits -.Lframe1: - .word .LECIE1-.LSCIE1 ;# Length of Common Information Entry -.LSCIE1: - .word 0x0 ;# CIE Identifier Tag - .byte 0x1 ;# CIE Version - .ascii "\0" ;# CIE Augmentation - .uleb128 0x1 ;# CIE Code Alignment Factor - .sleb128 4 ;# CIE Data Alignment Factor - .byte 0x2 ;# CIE RA Column - .byte 0xc ;# DW_CFA_def_cfa - .uleb128 0x1e - .uleb128 0x0 - .align 4 -.LECIE1: -.LSFDE1: - .word .LEFDE1-.LASFDE1 ;# FDE Length -.LASFDE1: - .word .LASFDE1-.Lframe1 ;# FDE CIE offset - .word .LFB1 ;# FDE initial location - .word .LFE1-.LFB1 ;# FDE address range - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word .LCFI11-.LFB1 - .byte 0x83 ;# DW_CFA_offset, column 0x3 - .uleb128 0x0 - .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] - .uleb128 0x2 - .sleb128 -5 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word .LCFI12-.LCFI11 - .byte 0xd ;# DW_CFA_def_cfa_register = r3 - .uleb128 0x3 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word .LCFI13-.LCFI12 - .byte 0x84 ;# DW_CFA_offset, column 0x4 - .uleb128 0x3 - - .align 4 -.LEFDE1: - -.LSFDE2: - .word .LEFDE2-.LASFDE2 ;# FDE Length -.LASFDE2: - .word .LASFDE2-.Lframe1 ;# FDE CIE offset - .word .LFB2 ;# FDE initial location - .word .LFE2-.LFB2 ;# FDE address range - .byte 0x4 ;# DW_CFA_advance_loc4 - .word .LCFI21-.LFB2 - .byte 0x83 ;# DW_CFA_offset, column 0x3 - .uleb128 0x0 - .byte 0x11 ;# DW_CFA_offset_extended_sf - .uleb128 0x2 - .sleb128 -5 - - .byte 0x4 ;# DW_CFA_advance_loc4 - .word .LCFI22-.LCFI21 - .byte 0xd ;# DW_CFA_def_cfa_register = r3 - .uleb128 0x3 - - .align 4 -.LEFDE2: diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/aix.S b/llgo/third_party/gofrontend/libffi/src/powerpc/aix.S deleted file mode 100644 index 349e78c266e406f47f04c5a34e001fce54dea2ad..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/aix.S +++ /dev/null @@ -1,328 +0,0 @@ -/* ----------------------------------------------------------------------- - aix.S - Copyright (c) 2002, 2009 Free Software Foundation, Inc. - based on darwin.S by John Hornkvist - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - - .set r0,0 - .set r1,1 - .set r2,2 - .set r3,3 - .set r4,4 - .set r5,5 - .set r6,6 - .set r7,7 - .set r8,8 - .set r9,9 - .set r10,10 - .set r11,11 - .set r12,12 - .set r13,13 - .set r14,14 - .set r15,15 - .set r16,16 - .set r17,17 - .set r18,18 - .set r19,19 - .set r20,20 - .set r21,21 - .set r22,22 - .set r23,23 - .set r24,24 - .set r25,25 - .set r26,26 - .set r27,27 - .set r28,28 - .set r29,29 - .set r30,30 - .set r31,31 - .set f0,0 - .set f1,1 - .set f2,2 - .set f3,3 - .set f4,4 - .set f5,5 - .set f6,6 - .set f7,7 - .set f8,8 - .set f9,9 - .set f10,10 - .set f11,11 - .set f12,12 - .set f13,13 - .set f14,14 - .set f15,15 - .set f16,16 - .set f17,17 - .set f18,18 - .set f19,19 - .set f20,20 - .set f21,21 - - .extern .ffi_prep_args - -#define LIBFFI_ASM -#include -#include -#define JUMPTARGET(name) name -#define L(x) x - .file "aix.S" - .toc - - /* void ffi_call_AIX(extended_cif *ecif, unsigned long bytes, - * unsigned int flags, unsigned int *rvalue, - * void (*fn)(), - * void (*prep_args)(extended_cif*, unsigned *const)); - * r3=ecif, r4=bytes, r5=flags, r6=rvalue, r7=fn, r8=prep_args - */ - -.csect .text[PR] - .align 2 - .globl ffi_call_AIX - .globl .ffi_call_AIX -.csect ffi_call_AIX[DS] -ffi_call_AIX: -#ifdef __64BIT__ - .llong .ffi_call_AIX, TOC[tc0], 0 - .csect .text[PR] -.ffi_call_AIX: - /* Save registers we use. */ - mflr r0 - - std r28,-32(r1) - std r29,-24(r1) - std r30,-16(r1) - std r31, -8(r1) - - std r0, 16(r1) - mr r28, r1 /* our AP. */ - stdux r1, r1, r4 - - /* Save arguments over call... */ - mr r31, r5 /* flags, */ - mr r30, r6 /* rvalue, */ - mr r29, r7 /* function address. */ - std r2, 40(r1) - - /* Call ffi_prep_args. */ - mr r4, r1 - bl .ffi_prep_args - nop - - /* Now do the call. */ - ld r0, 0(r29) - ld r2, 8(r29) - ld r11, 16(r29) - /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40, r31 - mtctr r0 - /* Load all those argument registers. */ - /* We have set up a nice stack frame, just load it into registers. */ - ld r3, 40+(1*8)(r1) - ld r4, 40+(2*8)(r1) - ld r5, 40+(3*8)(r1) - ld r6, 40+(4*8)(r1) - nop - ld r7, 40+(5*8)(r1) - ld r8, 40+(6*8)(r1) - ld r9, 40+(7*8)(r1) - ld r10,40+(8*8)(r1) - -L1: - /* Load all the FP registers. */ - bf 6,L2 /* 2f + 0x18 */ - lfd f1,-32-(13*8)(r28) - lfd f2,-32-(12*8)(r28) - lfd f3,-32-(11*8)(r28) - lfd f4,-32-(10*8)(r28) - nop - lfd f5,-32-(9*8)(r28) - lfd f6,-32-(8*8)(r28) - lfd f7,-32-(7*8)(r28) - lfd f8,-32-(6*8)(r28) - nop - lfd f9,-32-(5*8)(r28) - lfd f10,-32-(4*8)(r28) - lfd f11,-32-(3*8)(r28) - lfd f12,-32-(2*8)(r28) - nop - lfd f13,-32-(1*8)(r28) - -L2: - /* Make the call. */ - bctrl - ld r2, 40(r1) - - /* Now, deal with the return value. */ - mtcrf 0x01, r31 - - bt 30, L(done_return_value) - bt 29, L(fp_return_value) - std r3, 0(r30) - - /* Fall through... */ - -L(done_return_value): - /* Restore the registers we used and return. */ - mr r1, r28 - ld r0, 16(r28) - ld r28, -32(r1) - mtlr r0 - ld r29, -24(r1) - ld r30, -16(r1) - ld r31, -8(r1) - blr - -L(fp_return_value): - bf 28, L(float_return_value) - stfd f1, 0(r30) - bf 31, L(done_return_value) - stfd f2, 8(r30) - b L(done_return_value) -L(float_return_value): - stfs f1, 0(r30) - b L(done_return_value) - -#else /* ! __64BIT__ */ - - .long .ffi_call_AIX, TOC[tc0], 0 - .csect .text[PR] -.ffi_call_AIX: - /* Save registers we use. */ - mflr r0 - - stw r28,-16(r1) - stw r29,-12(r1) - stw r30, -8(r1) - stw r31, -4(r1) - - stw r0, 8(r1) - mr r28, r1 /* out AP. */ - stwux r1, r1, r4 - - /* Save arguments over call... */ - mr r31, r5 /* flags, */ - mr r30, r6 /* rvalue, */ - mr r29, r7 /* function address, */ - stw r2, 20(r1) - - /* Call ffi_prep_args. */ - mr r4, r1 - bl .ffi_prep_args - nop - - /* Now do the call. */ - lwz r0, 0(r29) - lwz r2, 4(r29) - lwz r11, 8(r29) - /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40, r31 - mtctr r0 - /* Load all those argument registers. */ - /* We have set up a nice stack frame, just load it into registers. */ - lwz r3, 20+(1*4)(r1) - lwz r4, 20+(2*4)(r1) - lwz r5, 20+(3*4)(r1) - lwz r6, 20+(4*4)(r1) - nop - lwz r7, 20+(5*4)(r1) - lwz r8, 20+(6*4)(r1) - lwz r9, 20+(7*4)(r1) - lwz r10,20+(8*4)(r1) - -L1: - /* Load all the FP registers. */ - bf 6,L2 /* 2f + 0x18 */ - lfd f1,-16-(13*8)(r28) - lfd f2,-16-(12*8)(r28) - lfd f3,-16-(11*8)(r28) - lfd f4,-16-(10*8)(r28) - nop - lfd f5,-16-(9*8)(r28) - lfd f6,-16-(8*8)(r28) - lfd f7,-16-(7*8)(r28) - lfd f8,-16-(6*8)(r28) - nop - lfd f9,-16-(5*8)(r28) - lfd f10,-16-(4*8)(r28) - lfd f11,-16-(3*8)(r28) - lfd f12,-16-(2*8)(r28) - nop - lfd f13,-16-(1*8)(r28) - -L2: - /* Make the call. */ - bctrl - lwz r2, 20(r1) - - /* Now, deal with the return value. */ - mtcrf 0x01, r31 - - bt 30, L(done_return_value) - bt 29, L(fp_return_value) - stw r3, 0(r30) - bf 28, L(done_return_value) - stw r4, 4(r30) - - /* Fall through... */ - -L(done_return_value): - /* Restore the registers we used and return. */ - mr r1, r28 - lwz r0, 8(r28) - lwz r28,-16(r1) - mtlr r0 - lwz r29,-12(r1) - lwz r30, -8(r1) - lwz r31, -4(r1) - blr - -L(fp_return_value): - bf 28, L(float_return_value) - stfd f1, 0(r30) - b L(done_return_value) -L(float_return_value): - stfs f1, 0(r30) - b L(done_return_value) -#endif - .long 0 - .byte 0,0,0,1,128,4,0,0 -/* END(ffi_call_AIX) */ - -.csect .text[PR] - .align 2 - .globl ffi_call_DARWIN - .globl .ffi_call_DARWIN -.csect ffi_call_DARWIN[DS] -ffi_call_DARWIN: -#ifdef __64BIT__ - .llong .ffi_call_DARWIN, TOC[tc0], 0 -#else - .long .ffi_call_DARWIN, TOC[tc0], 0 -#endif - .csect .text[PR] -.ffi_call_DARWIN: - blr - .long 0 - .byte 0,0,0,0,0,0,0,0 -/* END(ffi_call_DARWIN) */ diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/aix_closure.S b/llgo/third_party/gofrontend/libffi/src/powerpc/aix_closure.S deleted file mode 100644 index aabd3c3c1eedf9749bc19c68d741b87084ca1f48..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/aix_closure.S +++ /dev/null @@ -1,447 +0,0 @@ -/* ----------------------------------------------------------------------- - aix_closure.S - Copyright (c) 2002, 2003, 2009 Free Software Foundation, Inc. - based on darwin_closure.S - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - - .set r0,0 - .set r1,1 - .set r2,2 - .set r3,3 - .set r4,4 - .set r5,5 - .set r6,6 - .set r7,7 - .set r8,8 - .set r9,9 - .set r10,10 - .set r11,11 - .set r12,12 - .set r13,13 - .set r14,14 - .set r15,15 - .set r16,16 - .set r17,17 - .set r18,18 - .set r19,19 - .set r20,20 - .set r21,21 - .set r22,22 - .set r23,23 - .set r24,24 - .set r25,25 - .set r26,26 - .set r27,27 - .set r28,28 - .set r29,29 - .set r30,30 - .set r31,31 - .set f0,0 - .set f1,1 - .set f2,2 - .set f3,3 - .set f4,4 - .set f5,5 - .set f6,6 - .set f7,7 - .set f8,8 - .set f9,9 - .set f10,10 - .set f11,11 - .set f12,12 - .set f13,13 - .set f14,14 - .set f15,15 - .set f16,16 - .set f17,17 - .set f18,18 - .set f19,19 - .set f20,20 - .set f21,21 - - .extern .ffi_closure_helper_DARWIN - -#define LIBFFI_ASM -#define JUMPTARGET(name) name -#define L(x) x - .file "aix_closure.S" - .toc -LC..60: - .tc L..60[TC],L..60 - .csect .text[PR] - .align 2 - -.csect .text[PR] - .align 2 - .globl ffi_closure_ASM - .globl .ffi_closure_ASM -.csect ffi_closure_ASM[DS] -ffi_closure_ASM: -#ifdef __64BIT__ - .llong .ffi_closure_ASM, TOC[tc0], 0 - .csect .text[PR] -.ffi_closure_ASM: -/* we want to build up an area for the parameters passed */ -/* in registers (both floating point and integer) */ - - /* we store gpr 3 to gpr 10 (aligned to 4) - in the parents outgoing area */ - std r3, 48+(0*8)(r1) - std r4, 48+(1*8)(r1) - std r5, 48+(2*8)(r1) - std r6, 48+(3*8)(r1) - mflr r0 - - std r7, 48+(4*8)(r1) - std r8, 48+(5*8)(r1) - std r9, 48+(6*8)(r1) - std r10, 48+(7*8)(r1) - std r0, 16(r1) /* save the return address */ - - - /* 48 Bytes (Linkage Area) */ - /* 64 Bytes (params) */ - /* 16 Bytes (result) */ - /* 104 Bytes (13*8 from FPR) */ - /* 8 Bytes (alignment) */ - /* 240 Bytes */ - - stdu r1, -240(r1) /* skip over caller save area - keep stack aligned to 16 */ - - /* next save fpr 1 to fpr 13 (aligned to 8) */ - stfd f1, 128+(0*8)(r1) - stfd f2, 128+(1*8)(r1) - stfd f3, 128+(2*8)(r1) - stfd f4, 128+(3*8)(r1) - stfd f5, 128+(4*8)(r1) - stfd f6, 128+(5*8)(r1) - stfd f7, 128+(6*8)(r1) - stfd f8, 128+(7*8)(r1) - stfd f9, 128+(8*8)(r1) - stfd f10, 128+(9*8)(r1) - stfd f11, 128+(10*8)(r1) - stfd f12, 128+(11*8)(r1) - stfd f13, 128+(12*8)(r1) - - /* set up registers for the routine that actually does the work */ - /* get the context pointer from the trampoline */ - mr r3, r11 - - /* now load up the pointer to the result storage */ - addi r4, r1, 112 - - /* now load up the pointer to the saved gpr registers */ - addi r5, r1, 288 - - /* now load up the pointer to the saved fpr registers */ - addi r6, r1, 128 - - /* make the call */ - bl .ffi_closure_helper_DARWIN - nop - - /* now r3 contains the return type */ - /* so use it to look up in a table */ - /* so we know how to deal with each type */ - - /* look up the proper starting point in table */ - /* by using return type as offset */ - lhz r3, 10(r3) /* load type from return type */ - ld r4, LC..60(2) /* get address of jump table */ - sldi r3, r3, 4 /* now multiply return type by 16 */ - ld r0, 240+16(r1) /* load return address */ - add r3, r3, r4 /* add contents of table to table address */ - mtctr r3 - bctr /* jump to it */ - -/* Each fragment must be exactly 16 bytes long (4 instructions). - Align to 16 byte boundary for cache and dispatch efficiency. */ - .align 4 - -L..60: -/* case FFI_TYPE_VOID */ - mtlr r0 - addi r1, r1, 240 - blr - nop - -/* case FFI_TYPE_INT */ - lwa r3, 112+4(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_FLOAT */ - lfs f1, 112+0(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_DOUBLE */ - lfd f1, 112+0(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_LONGDOUBLE */ - lfd f1, 112+0(r1) - mtlr r0 - lfd f2, 112+8(r1) - b L..finish - -/* case FFI_TYPE_UINT8 */ - lbz r3, 112+7(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_SINT8 */ - lbz r3, 112+7(r1) - mtlr r0 - extsb r3, r3 - b L..finish - -/* case FFI_TYPE_UINT16 */ - lhz r3, 112+6(r1) - mtlr r0 -L..finish: - addi r1, r1, 240 - blr - -/* case FFI_TYPE_SINT16 */ - lha r3, 112+6(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_UINT32 */ - lwz r3, 112+4(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_SINT32 */ - lwa r3, 112+4(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_UINT64 */ - ld r3, 112+0(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_SINT64 */ - ld r3, 112+0(r1) - mtlr r0 - addi r1, r1, 240 - blr - -/* case FFI_TYPE_STRUCT */ - mtlr r0 - addi r1, r1, 240 - blr - nop - -/* case FFI_TYPE_POINTER */ - ld r3, 112+0(r1) - mtlr r0 - addi r1, r1, 240 - blr - -#else /* ! __64BIT__ */ - - .long .ffi_closure_ASM, TOC[tc0], 0 - .csect .text[PR] -.ffi_closure_ASM: -/* we want to build up an area for the parameters passed */ -/* in registers (both floating point and integer) */ - - /* we store gpr 3 to gpr 10 (aligned to 4) - in the parents outgoing area */ - stw r3, 24+(0*4)(r1) - stw r4, 24+(1*4)(r1) - stw r5, 24+(2*4)(r1) - stw r6, 24+(3*4)(r1) - mflr r0 - - stw r7, 24+(4*4)(r1) - stw r8, 24+(5*4)(r1) - stw r9, 24+(6*4)(r1) - stw r10, 24+(7*4)(r1) - stw r0, 8(r1) - - /* 24 Bytes (Linkage Area) */ - /* 32 Bytes (params) */ - /* 16 Bytes (result) */ - /* 104 Bytes (13*8 from FPR) */ - /* 176 Bytes */ - - stwu r1, -176(r1) /* skip over caller save area - keep stack aligned to 16 */ - - /* next save fpr 1 to fpr 13 (aligned to 8) */ - stfd f1, 72+(0*8)(r1) - stfd f2, 72+(1*8)(r1) - stfd f3, 72+(2*8)(r1) - stfd f4, 72+(3*8)(r1) - stfd f5, 72+(4*8)(r1) - stfd f6, 72+(5*8)(r1) - stfd f7, 72+(6*8)(r1) - stfd f8, 72+(7*8)(r1) - stfd f9, 72+(8*8)(r1) - stfd f10, 72+(9*8)(r1) - stfd f11, 72+(10*8)(r1) - stfd f12, 72+(11*8)(r1) - stfd f13, 72+(12*8)(r1) - - /* set up registers for the routine that actually does the work */ - /* get the context pointer from the trampoline */ - mr r3, r11 - - /* now load up the pointer to the result storage */ - addi r4, r1, 56 - - /* now load up the pointer to the saved gpr registers */ - addi r5, r1, 200 - - /* now load up the pointer to the saved fpr registers */ - addi r6, r1, 72 - - /* make the call */ - bl .ffi_closure_helper_DARWIN - nop - - /* now r3 contains the return type */ - /* so use it to look up in a table */ - /* so we know how to deal with each type */ - - /* look up the proper starting point in table */ - /* by using return type as offset */ - lhz r3, 6(r3) /* load type from return type */ - lwz r4, LC..60(2) /* get address of jump table */ - slwi r3, r3, 4 /* now multiply return type by 16 */ - lwz r0, 176+8(r1) /* load return address */ - add r3, r3, r4 /* add contents of table to table address */ - mtctr r3 - bctr /* jump to it */ - -/* Each fragment must be exactly 16 bytes long (4 instructions). - Align to 16 byte boundary for cache and dispatch efficiency. */ - .align 4 - -L..60: -/* case FFI_TYPE_VOID */ - mtlr r0 - addi r1, r1, 176 - blr - nop - -/* case FFI_TYPE_INT */ - lwz r3, 56+0(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_FLOAT */ - lfs f1, 56+0(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_DOUBLE */ - lfd f1, 56+0(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_LONGDOUBLE */ - lfd f1, 56+0(r1) - mtlr r0 - lfd f2, 56+8(r1) - b L..finish - -/* case FFI_TYPE_UINT8 */ - lbz r3, 56+3(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_SINT8 */ - lbz r3, 56+3(r1) - mtlr r0 - extsb r3, r3 - b L..finish - -/* case FFI_TYPE_UINT16 */ - lhz r3, 56+2(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_SINT16 */ - lha r3, 56+2(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_UINT32 */ - lwz r3, 56+0(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_SINT32 */ - lwz r3, 56+0(r1) - mtlr r0 - addi r1, r1, 176 - blr - -/* case FFI_TYPE_UINT64 */ - lwz r3, 56+0(r1) - mtlr r0 - lwz r4, 56+4(r1) - b L..finish - -/* case FFI_TYPE_SINT64 */ - lwz r3, 56+0(r1) - mtlr r0 - lwz r4, 56+4(r1) - b L..finish - -/* case FFI_TYPE_STRUCT */ - mtlr r0 - addi r1, r1, 176 - blr - nop - -/* case FFI_TYPE_POINTER */ - lwz r3, 56+0(r1) - mtlr r0 -L..finish: - addi r1, r1, 176 - blr -#endif -/* END(ffi_closure_ASM) */ diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/asm.h b/llgo/third_party/gofrontend/libffi/src/powerpc/asm.h deleted file mode 100644 index 994f62d079d4742445c5165ac49f6aed7325fc39..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/asm.h +++ /dev/null @@ -1,125 +0,0 @@ -/* ----------------------------------------------------------------------- - asm.h - Copyright (c) 1998 Geoffrey Keating - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define ASM_GLOBAL_DIRECTIVE .globl - - -#define C_SYMBOL_NAME(name) name -/* Macro for a label. */ -#ifdef __STDC__ -#define C_LABEL(name) name##: -#else -#define C_LABEL(name) name/**/: -#endif - -/* This seems to always be the case on PPC. */ -#define ALIGNARG(log2) log2 -/* For ELF we need the `.type' directive to make shared libs work right. */ -#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; -#define ASM_SIZE_DIRECTIVE(name) .size name,.-name - -/* If compiled for profiling, call `_mcount' at the start of each function. */ -#ifdef PROF -/* The mcount code relies on the return address being on the stack - to locate our caller and so it can restore it; so store one just - for its benefit. */ -#ifdef PIC -#define CALL_MCOUNT \ - .pushsection; \ - .section ".data"; \ - .align ALIGNARG(2); \ -0:.long 0; \ - .previous; \ - mflr %r0; \ - stw %r0,4(%r1); \ - bl _GLOBAL_OFFSET_TABLE_@local-4; \ - mflr %r11; \ - lwz %r0,0b@got(%r11); \ - bl JUMPTARGET(_mcount); -#else /* PIC */ -#define CALL_MCOUNT \ - .section ".data"; \ - .align ALIGNARG(2); \ -0:.long 0; \ - .previous; \ - mflr %r0; \ - lis %r11,0b@ha; \ - stw %r0,4(%r1); \ - addi %r0,%r11,0b@l; \ - bl JUMPTARGET(_mcount); -#endif /* PIC */ -#else /* PROF */ -#define CALL_MCOUNT /* Do nothing. */ -#endif /* PROF */ - -#define ENTRY(name) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(2); \ - C_LABEL(name) \ - CALL_MCOUNT - -#define EALIGN_W_0 /* No words to insert. */ -#define EALIGN_W_1 nop -#define EALIGN_W_2 nop;nop -#define EALIGN_W_3 nop;nop;nop -#define EALIGN_W_4 EALIGN_W_3;nop -#define EALIGN_W_5 EALIGN_W_4;nop -#define EALIGN_W_6 EALIGN_W_5;nop -#define EALIGN_W_7 EALIGN_W_6;nop - -/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes - past a 2^align boundary. */ -#ifdef PROF -#define EALIGN(name, alignt, words) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(2); \ - C_LABEL(name) \ - CALL_MCOUNT \ - b 0f; \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - 0: -#else /* PROF */ -#define EALIGN(name, alignt, words) \ - ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ - ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ - .align ALIGNARG(alignt); \ - EALIGN_W_##words; \ - C_LABEL(name) -#endif - -#define END(name) \ - ASM_SIZE_DIRECTIVE(name) - -#ifdef PIC -#define JUMPTARGET(name) name##@plt -#else -#define JUMPTARGET(name) name -#endif - -/* Local labels stripped out by the linker. */ -#define L(x) .L##x diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/darwin.S b/llgo/third_party/gofrontend/libffi/src/powerpc/darwin.S deleted file mode 100644 index 066eb82efe9381fd2b2e0af37582ac453ebba27c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/darwin.S +++ /dev/null @@ -1,378 +0,0 @@ -/* ----------------------------------------------------------------------- - darwin.S - Copyright (c) 2000 John Hornkvist - Copyright (c) 2004, 2010 Free Software Foundation, Inc. - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#if defined(__ppc64__) -#define MODE_CHOICE(x, y) y -#else -#define MODE_CHOICE(x, y) x -#endif - -#define machine_choice MODE_CHOICE(ppc7400,ppc64) - -; Define some pseudo-opcodes for size-independent load & store of GPRs ... -#define lgu MODE_CHOICE(lwzu, ldu) -#define lg MODE_CHOICE(lwz,ld) -#define sg MODE_CHOICE(stw,std) -#define sgu MODE_CHOICE(stwu,stdu) -#define sgux MODE_CHOICE(stwux,stdux) - -; ... and the size of GPRs and their storage indicator. -#define GPR_BYTES MODE_CHOICE(4,8) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ - -; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. -#define LINKAGE_SIZE MODE_CHOICE(24,48) -#define PARAM_AREA MODE_CHOICE(32,64) -#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ - -/* If there is any FP stuff we make space for all of the regs. */ -#define SAVED_FPR_COUNT 13 -#define FPR_SIZE 8 -#define RESULT_BYTES 16 - -/* This should be kept in step with the same value in ffi_darwin.c. */ -#define ASM_NEEDS_REGISTERS 4 -#define SAVE_REGS_SIZE (ASM_NEEDS_REGISTERS * GPR_BYTES) - -#include -#include - -#define JUMPTARGET(name) name -#define L(x) x - - .text - .align 2 - .globl _ffi_prep_args - - .align 2 - .globl _ffi_call_DARWIN - - /* We arrive here with: - r3 = ptr to extended cif. - r4 = -bytes. - r5 = cif flags. - r6 = ptr to return value. - r7 = fn pointer (user func). - r8 = fn pointer (ffi_prep_args). - r9 = ffi_type* for the ret val. */ - -_ffi_call_DARWIN: -Lstartcode: - mr r12,r8 /* We only need r12 until the call, - so it does not have to be saved. */ -LFB1: - /* Save the old stack pointer as AP. */ - mr r8,r1 -LCFI0: - - /* Save the retval type in parents frame. */ - sg r9,(LINKAGE_SIZE+6*GPR_BYTES)(r8) - - /* Allocate the stack space we need. */ - sgux r1,r1,r4 - - /* Save registers we use. */ - mflr r9 - sg r9,SAVED_LR_OFFSET(r8) - - sg r28,-(4 * GPR_BYTES)(r8) - sg r29,-(3 * GPR_BYTES)(r8) - sg r30,-(2 * GPR_BYTES)(r8) - sg r31,-( GPR_BYTES)(r8) - -#if !defined(POWERPC_DARWIN) - /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ - sg r2,(5 * GPR_BYTES)(r1) -#endif - -LCFI1: - - /* Save arguments over call. */ - mr r31,r5 /* flags, */ - mr r30,r6 /* rvalue, */ - mr r29,r7 /* function address, */ - mr r28,r8 /* our AP. */ -LCFI2: - /* Call ffi_prep_args. r3 = extended cif, r4 = stack ptr copy. */ - mr r4,r1 - li r9,0 - - mtctr r12 /* r12 holds address of _ffi_prep_args. */ - bctrl - -#if !defined(POWERPC_DARWIN) - /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ - lg r2,(5 * GPR_BYTES)(r1) -#endif - /* Now do the call. - Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40,r31 - /* Get the address to call into CTR. */ - mtctr r29 - /* Load all those argument registers. - We have set up a nice stack frame, just load it into registers. */ - lg r3, (LINKAGE_SIZE )(r1) - lg r4, (LINKAGE_SIZE + GPR_BYTES)(r1) - lg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r1) - lg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r1) - nop - lg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r1) - lg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r1) - lg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r1) - lg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r1) - -L1: - /* ... Load all the FP registers. */ - bf 6,L2 /* No floats to load. */ - lfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) - lfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) - lfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) - lfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) - nop - lfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) - lfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) - lfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) - lfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) - nop - lfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) - lfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) - lfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) - lfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) - nop - lfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) - -L2: - mr r12,r29 /* Put the target address in r12 as specified. */ - mtctr r12 - nop - nop - - /* Make the call. */ - bctrl - - /* Now, deal with the return value. */ - - /* m64 structure returns can occupy the same set of registers as - would be used to pass such a structure as arg0 - so take care - not to step on any possibly hot regs. */ - - /* Get the flags.. */ - mtcrf 0x03,r31 ; we need c6 & cr7 now. - ; FLAG_RETURNS_NOTHING also covers struct ret-by-ref. - bt 30,L(done_return_value) ; FLAG_RETURNS_NOTHING - bf 27,L(scalar_return_value) ; not FLAG_RETURNS_STRUCT - - /* OK, so we have a struct. */ -#if defined(__ppc64__) - bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case - - /* OK, we have to map the return back to a mem struct. - We are about to trample the parents param area, so recover the - return type. r29 is free, since the call is done. */ - lg r29,(LINKAGE_SIZE + 6 * GPR_BYTES)(r28) - - sg r3, (LINKAGE_SIZE )(r28) - sg r4, (LINKAGE_SIZE + GPR_BYTES)(r28) - sg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r28) - sg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r28) - nop - sg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r28) - sg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r28) - sg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r28) - sg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) - /* OK, so do the block move - we trust that memcpy will not trample - the fprs... */ - mr r3,r30 ; dest - addi r4,r28,LINKAGE_SIZE ; source - /* The size is a size_t, should be long. */ - lg r5,0(r29) - /* Figure out small structs */ - cmpi 0,r5,4 - bgt L3 ; 1, 2 and 4 bytes have special rules. - cmpi 0,r5,3 - beq L3 ; not 3 - addi r4,r4,8 - subf r4,r5,r4 -L3: - bl _memcpy - - /* ... do we need the FP registers? - recover the flags.. */ - mtcrf 0x03,r31 ; we need c6 & cr7 now. - bf 29,L(done_return_value) /* No floats in the struct. */ - stfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) - stfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) - stfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) - stfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) - nop - stfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) - stfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) - stfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) - stfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) - nop - stfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) - stfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) - stfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) - stfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) - nop - stfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) - - mr r3,r29 ; ffi_type * - mr r4,r30 ; dest - addi r5,r28,-SAVE_REGS_SIZE-(13*FPR_SIZE) ; fprs - xor r6,r6,r6 - sg r6,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) - addi r6,r28,(LINKAGE_SIZE + 7 * GPR_BYTES) ; point to a zeroed counter. - bl _darwin64_struct_floats_to_mem - - b L(done_return_value) -#else - stw r3,0(r30) ; m32 the only struct return in reg is 4 bytes. -#endif - b L(done_return_value) - -L(fp_return_value): - /* Do we have long double to store? */ - bf 31,L(fd_return_value) ; FLAG_RETURNS_128BITS - stfd f1,0(r30) - stfd f2,FPR_SIZE(r30) - b L(done_return_value) - -L(fd_return_value): - /* Do we have double to store? */ - bf 28,L(float_return_value) - stfd f1,0(r30) - b L(done_return_value) - -L(float_return_value): - /* We only have a float to store. */ - stfs f1,0(r30) - b L(done_return_value) - -L(scalar_return_value): - bt 29,L(fp_return_value) ; FLAG_RETURNS_FP - ; ffi_arg is defined as unsigned long. - sg r3,0(r30) ; Save the reg. - bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS - -#if defined(__ppc64__) -L(maybe_return_128): - std r3,0(r30) - bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS - std r4,8(r30) -#else - stw r4,4(r30) -#endif - - /* Fall through. */ - /* We want this at the end to simplify eh epilog computation. */ - -L(done_return_value): - /* Restore the registers we used and return. */ - lg r29,SAVED_LR_OFFSET(r28) - ; epilog - lg r31,-(1 * GPR_BYTES)(r28) - mtlr r29 - lg r30,-(2 * GPR_BYTES)(r28) - lg r29,-(3 * GPR_BYTES)(r28) - lg r28,-(4 * GPR_BYTES)(r28) - lg r1,0(r1) - blr -LFE1: - .align 1 -/* END(_ffi_call_DARWIN) */ - -/* Provide a null definition of _ffi_call_AIX. */ - .text - .globl _ffi_call_AIX - .align 2 -_ffi_call_AIX: - blr -/* END(_ffi_call_AIX) */ - -/* EH stuff. */ - -#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) - - .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EH_frame1: - .set L$set$0,LECIE1-LSCIE1 - .long L$set$0 ; Length of Common Information Entry -LSCIE1: - .long 0x0 ; CIE Identifier Tag - .byte 0x1 ; CIE Version - .ascii "zR\0" ; CIE Augmentation - .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor - .byte 0x41 ; CIE RA Column - .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x10 ; FDE Encoding (pcrel) - .byte 0xc ; DW_CFA_def_cfa - .byte 0x1 ; uleb128 0x1 - .byte 0x0 ; uleb128 0x0 - .align LOG2_GPR_BYTES -LECIE1: - - .globl _ffi_call_DARWIN.eh -_ffi_call_DARWIN.eh: -LSFDE1: - .set L$set$1,LEFDE1-LASFDE1 - .long L$set$1 ; FDE Length -LASFDE1: - .long LASFDE1-EH_frame1 ; FDE CIE offset - .g_long Lstartcode-. ; FDE initial location - .set L$set$3,LFE1-Lstartcode - .g_long L$set$3 ; FDE address range - .byte 0x0 ; uleb128 0x0; Augmentation size - .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-Lstartcode - .long L$set$4 - .byte 0xd ; DW_CFA_def_cfa_register - .byte 0x08 ; uleb128 0x08 - .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$5,LCFI1-LCFI0 - .long L$set$5 - .byte 0x11 ; DW_CFA_offset_extended_sf - .byte 0x41 ; uleb128 0x41 - .byte 0x7e ; sleb128 -2 - .byte 0x9f ; DW_CFA_offset, column 0x1f - .byte 0x1 ; uleb128 0x1 - .byte 0x9e ; DW_CFA_offset, column 0x1e - .byte 0x2 ; uleb128 0x2 - .byte 0x9d ; DW_CFA_offset, column 0x1d - .byte 0x3 ; uleb128 0x3 - .byte 0x9c ; DW_CFA_offset, column 0x1c - .byte 0x4 ; uleb128 0x4 - .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$6,LCFI2-LCFI1 - .long L$set$6 - .byte 0xd ; DW_CFA_def_cfa_register - .byte 0x1c ; uleb128 0x1c - .align LOG2_GPR_BYTES -LEFDE1: - .align 1 - diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/darwin_closure.S b/llgo/third_party/gofrontend/libffi/src/powerpc/darwin_closure.S deleted file mode 100644 index c7734d419861064e39336c457d4046d32b2adf83..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/darwin_closure.S +++ /dev/null @@ -1,571 +0,0 @@ -/* ----------------------------------------------------------------------- - darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, - Free Software Foundation, Inc. - based on ppc_closure.S - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#define L(x) x - -#if defined(__ppc64__) -#define MODE_CHOICE(x, y) y -#else -#define MODE_CHOICE(x, y) x -#endif - -#define machine_choice MODE_CHOICE(ppc7400,ppc64) - -; Define some pseudo-opcodes for size-independent load & store of GPRs ... -#define lgu MODE_CHOICE(lwzu, ldu) -#define lg MODE_CHOICE(lwz,ld) -#define sg MODE_CHOICE(stw,std) -#define sgu MODE_CHOICE(stwu,stdu) - -; ... and the size of GPRs and their storage indicator. -#define GPR_BYTES MODE_CHOICE(4,8) -#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ -#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ - -; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. -#define LINKAGE_SIZE MODE_CHOICE(24,48) -#define PARAM_AREA MODE_CHOICE(32,64) - -#define SAVED_CR_OFFSET MODE_CHOICE(4,8) /* save position for CR */ -#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ - -/* WARNING: if ffi_type is changed... here be monsters. - Offsets of items within the result type. */ -#define FFI_TYPE_TYPE MODE_CHOICE(6,10) -#define FFI_TYPE_ELEM MODE_CHOICE(8,16) - -#define SAVED_FPR_COUNT 13 -#define FPR_SIZE 8 -/* biggest m64 struct ret is 8GPRS + 13FPRS = 168 bytes - rounded to 16bytes = 176. */ -#define RESULT_BYTES MODE_CHOICE(16,176) - -; The whole stack frame **MUST** be 16byte-aligned. -#define SAVE_SIZE (((LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)+15) & -16LL) -#define PAD_SIZE (SAVE_SIZE-(LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)) - -#define PARENT_PARM_BASE (SAVE_SIZE+LINKAGE_SIZE) -#define FP_SAVE_BASE (LINKAGE_SIZE+PARAM_AREA) - -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 -; We no longer need the pic symbol stub for Darwin >= 9. -#define BLCLS_HELP _ffi_closure_helper_DARWIN -#define STRUCT_RETVALUE_P _darwin64_struct_ret_by_value_p -#define PASS_STR_FLOATS _darwin64_pass_struct_floats -#undef WANT_STUB -#else -#define BLCLS_HELP L_ffi_closure_helper_DARWIN$stub -#define STRUCT_RETVALUE_P L_darwin64_struct_ret_by_value_p$stub -#define PASS_STR_FLOATS L_darwin64_pass_struct_floats$stub -#define WANT_STUB -#endif - -/* m32/m64 - - The stack layout looks like this: - - | Additional params... | | Higher address - ~ ~ ~ - | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS - |--------------------------------------------| | - | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | - |--------------------------------------------| | - | Reserved 2*4/8 | | - |--------------------------------------------| | - | Space for callee`s LR 4/8 | | - |--------------------------------------------| | - | Saved CR [low word for m64] 4/8 | | - |--------------------------------------------| | - | Current backchain pointer 4/8 |-/ Parent`s frame. - |--------------------------------------------| <+ <<< on entry to - | Result Bytes 16/176 | | - |--------------------------------------------| | - ~ padding to 16-byte alignment ~ ~ - |--------------------------------------------| | - | NUM_FPR_ARG_REGISTERS slots | | - | here fp13 .. fp1 13*8 | | - |--------------------------------------------| | - | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS - |--------------------------------------------| | - | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | - |--------------------------------------------| | stack | - | Reserved [compiler,binder] 2*4/8 | | grows | - |--------------------------------------------| | down V - | Space for callees LR 4/8 | | - |--------------------------------------------| | lower addresses - | Saved CR [low word for m64] 4/8 | | - |--------------------------------------------| | stack pointer here - | Current backchain pointer 4/8 |-/ during - |--------------------------------------------| <<< call. - -*/ - - .file "darwin_closure.S" - - .machine machine_choice - - .text - .globl _ffi_closure_ASM - .align LOG2_GPR_BYTES -_ffi_closure_ASM: -LFB1: -Lstartcode: - mflr r0 /* extract return address */ - sg r0,SAVED_LR_OFFSET(r1) /* save the return address */ -LCFI0: - sgu r1,-SAVE_SIZE(r1) /* skip over caller save area - keep stack aligned to 16. */ -LCFI1: - /* We want to build up an area for the parameters passed - in registers. (both floating point and integer) */ - - /* Put gpr 3 to gpr 10 in the parents outgoing area... - ... the remainder of any params that overflowed the regs will - follow here. */ - sg r3, (PARENT_PARM_BASE )(r1) - sg r4, (PARENT_PARM_BASE + GPR_BYTES )(r1) - sg r5, (PARENT_PARM_BASE + GPR_BYTES * 2)(r1) - sg r6, (PARENT_PARM_BASE + GPR_BYTES * 3)(r1) - sg r7, (PARENT_PARM_BASE + GPR_BYTES * 4)(r1) - sg r8, (PARENT_PARM_BASE + GPR_BYTES * 5)(r1) - sg r9, (PARENT_PARM_BASE + GPR_BYTES * 6)(r1) - sg r10,(PARENT_PARM_BASE + GPR_BYTES * 7)(r1) - - /* We save fpr 1 to fpr 14 in our own save frame. */ - stfd f1, (FP_SAVE_BASE )(r1) - stfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) - stfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) - stfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) - stfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) - stfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) - stfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) - stfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) - stfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) - stfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) - stfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) - stfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) - stfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) - - /* Set up registers for the routine that actually does the work - get the context pointer from the trampoline. */ - mr r3,r11 - - /* Now load up the pointer to the result storage. */ - addi r4,r1,(SAVE_SIZE-RESULT_BYTES) - - /* Now load up the pointer to the saved gpr registers. */ - addi r5,r1,PARENT_PARM_BASE - - /* Now load up the pointer to the saved fpr registers. */ - addi r6,r1,FP_SAVE_BASE - - /* Make the call. */ - bl BLCLS_HELP - - /* r3 contains the rtype pointer... save it since we will need - it later. */ - sg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type - lg r0,0(r3) ; size => r0 - lhz r3,FFI_TYPE_TYPE(r3) ; type => r3 - - /* The helper will have intercepted structure returns and inserted - the caller`s destination address for structs returned by ref. */ - - /* r3 contains the return type so use it to look up in a table - so we know how to deal with each type. */ - - addi r5,r1,(SAVE_SIZE-RESULT_BYTES) /* Otherwise, our return is here. */ - bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ - mflr r4 /* Move to r4. */ - slwi r3,r3,4 /* Now multiply return type by 16. */ - add r3,r3,r4 /* Add contents of table to table address. */ - mtctr r3 - bctr /* Jump to it. */ -LFE1: -/* Each of the ret_typeX code fragments has to be exactly 16 bytes long - (4 instructions). For cache effectiveness we align to a 16 byte boundary - first. */ - - .align 4 - - nop - nop - nop -Lget_ret_type0_addr: - blrl - -/* case FFI_TYPE_VOID */ -Lret_type0: - b Lfinish - nop - nop - nop - -/* case FFI_TYPE_INT */ -Lret_type1: - lg r3,0(r5) - b Lfinish - nop - nop - -/* case FFI_TYPE_FLOAT */ -Lret_type2: - lfs f1,0(r5) - b Lfinish - nop - nop - -/* case FFI_TYPE_DOUBLE */ -Lret_type3: - lfd f1,0(r5) - b Lfinish - nop - nop - -/* case FFI_TYPE_LONGDOUBLE */ -Lret_type4: - lfd f1,0(r5) - lfd f2,8(r5) - b Lfinish - nop - -/* case FFI_TYPE_UINT8 */ -Lret_type5: -#if defined(__ppc64__) - lbz r3,7(r5) -#else - lbz r3,3(r5) -#endif - b Lfinish - nop - nop - -/* case FFI_TYPE_SINT8 */ -Lret_type6: -#if defined(__ppc64__) - lbz r3,7(r5) -#else - lbz r3,3(r5) -#endif - extsb r3,r3 - b Lfinish - nop - -/* case FFI_TYPE_UINT16 */ -Lret_type7: -#if defined(__ppc64__) - lhz r3,6(r5) -#else - lhz r3,2(r5) -#endif - b Lfinish - nop - nop - -/* case FFI_TYPE_SINT16 */ -Lret_type8: -#if defined(__ppc64__) - lha r3,6(r5) -#else - lha r3,2(r5) -#endif - b Lfinish - nop - nop - -/* case FFI_TYPE_UINT32 */ -Lret_type9: -#if defined(__ppc64__) - lwz r3,4(r5) -#else - lwz r3,0(r5) -#endif - b Lfinish - nop - nop - -/* case FFI_TYPE_SINT32 */ -Lret_type10: -#if defined(__ppc64__) - lwz r3,4(r5) -#else - lwz r3,0(r5) -#endif - b Lfinish - nop - nop - -/* case FFI_TYPE_UINT64 */ -Lret_type11: -#if defined(__ppc64__) - lg r3,0(r5) - b Lfinish - nop -#else - lwz r3,0(r5) - lwz r4,4(r5) - b Lfinish -#endif - nop - -/* case FFI_TYPE_SINT64 */ -Lret_type12: -#if defined(__ppc64__) - lg r3,0(r5) - b Lfinish - nop -#else - lwz r3,0(r5) - lwz r4,4(r5) - b Lfinish -#endif - nop - -/* case FFI_TYPE_STRUCT */ -Lret_type13: -#if defined(__ppc64__) - lg r3,0(r5) ; we need at least this... - cmpi 0,r0,4 - bgt Lstructend ; not a special small case - b Lsmallstruct ; see if we need more. -#else - cmpi 0,r0,4 - bgt Lfinish ; not by value - lg r3,0(r5) - b Lfinish -#endif -/* case FFI_TYPE_POINTER */ -Lret_type14: - lg r3,0(r5) - b Lfinish - nop - nop - -#if defined(__ppc64__) -Lsmallstruct: - beq Lfour ; continuation of Lret13. - cmpi 0,r0,3 - beq Lfinish ; don`t adjust this - can`t be any floats here... - srdi r3,r3,48 - cmpi 0,r0,2 - beq Lfinish ; .. or here .. - srdi r3,r3,8 - b Lfinish ; .. or here. - -Lfour: - lg r6,LINKAGE_SIZE(r1) ; get the result type - lg r6,FFI_TYPE_ELEM(r6) ; elements array pointer - lg r6,0(r6) ; first element - lhz r0,FFI_TYPE_TYPE(r6) ; OK go the type - cmpi 0,r0,2 ; FFI_TYPE_FLOAT - bne Lfourint - lfs f1,0(r5) ; just one float in the struct. - b Lfinish - -Lfourint: - srdi r3,r3,32 ; four bytes. - b Lfinish - -Lstructend: - lg r3,LINKAGE_SIZE(r1) ; get the result type - bl STRUCT_RETVALUE_P - cmpi 0,r3,0 - beq Lfinish ; nope. - /* Recover a pointer to the results. */ - addi r11,r1,(SAVE_SIZE-RESULT_BYTES) - lg r3,0(r11) ; we need at least this... - lg r4,8(r11) - cmpi 0,r0,16 - beq Lfinish ; special case 16 bytes we don't consider floats. - - /* OK, frustratingly, the process of saving the struct to mem might have - messed with the FPRs, so we have to re-load them :(. - We`ll use our FPRs space again - calling: - void darwin64_pass_struct_floats (ffi_type *s, char *src, - unsigned *nfpr, double **fprs) - We`ll temporarily pinch the first two slots of the param area for local - vars used by the routine. */ - xor r6,r6,r6 - addi r5,r1,PARENT_PARM_BASE ; some space - sg r6,0(r5) ; *nfpr zeroed. - addi r6,r5,8 ; **fprs - addi r3,r1,FP_SAVE_BASE ; pointer to FPRs space - sg r3,0(r6) - mr r4,r11 ; the struct is here... - lg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type. - bl PASS_STR_FLOATS ; get struct floats into FPR save space. - /* See if we used any floats */ - lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) - cmpi 0,r0,0 - beq Lstructints ; nope. - /* OK load `em up... */ - lfd f1, (FP_SAVE_BASE )(r1) - lfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) - lfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) - lfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) - lfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) - lfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) - lfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) - lfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) - lfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) - lfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) - lfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) - lfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) - lfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) - - /* point back at our saved struct. */ -Lstructints: - addi r11,r1,(SAVE_SIZE-RESULT_BYTES) - lg r3,0(r11) ; we end up picking the - lg r4,8(r11) ; first two again. - lg r5,16(r11) - lg r6,24(r11) - lg r7,32(r11) - lg r8,40(r11) - lg r9,48(r11) - lg r10,56(r11) -#endif - -/* case done */ -Lfinish: - addi r1,r1,SAVE_SIZE /* Restore stack pointer. */ - lg r0,SAVED_LR_OFFSET(r1) /* Get return address. */ - mtlr r0 /* Reset link register. */ - blr -Lendcode: - .align 1 - -/* END(ffi_closure_ASM) */ - -/* EH frame stuff. */ -#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) -/* 176, 400 */ -#define EH_FRAME_OFFSETA MODE_CHOICE(176,0x90) -#define EH_FRAME_OFFSETB MODE_CHOICE(1,3) - - .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EH_frame1: - .set L$set$0,LECIE1-LSCIE1 - .long L$set$0 ; Length of Common Information Entry -LSCIE1: - .long 0x0 ; CIE Identifier Tag - .byte 0x1 ; CIE Version - .ascii "zR\0" ; CIE Augmentation - .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor - .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor - .byte 0x41 ; CIE RA Column - .byte 0x1 ; uleb128 0x1; Augmentation size - .byte 0x10 ; FDE Encoding (pcrel) - .byte 0xc ; DW_CFA_def_cfa - .byte 0x1 ; uleb128 0x1 - .byte 0x0 ; uleb128 0x0 - .align LOG2_GPR_BYTES -LECIE1: - .globl _ffi_closure_ASM.eh -_ffi_closure_ASM.eh: -LSFDE1: - .set L$set$1,LEFDE1-LASFDE1 - .long L$set$1 ; FDE Length - -LASFDE1: - .long LASFDE1-EH_frame1 ; FDE CIE offset - .g_long Lstartcode-. ; FDE initial location - .set L$set$3,LFE1-Lstartcode - .g_long L$set$3 ; FDE address range - .byte 0x0 ; uleb128 0x0; Augmentation size - .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$3,LCFI1-LCFI0 - .long L$set$3 - .byte 0xe ; DW_CFA_def_cfa_offset - .byte EH_FRAME_OFFSETA,EH_FRAME_OFFSETB ; uleb128 176,1/190,3 - .byte 0x4 ; DW_CFA_advance_loc4 - .set L$set$4,LCFI0-Lstartcode - .long L$set$4 - .byte 0x11 ; DW_CFA_offset_extended_sf - .byte 0x41 ; uleb128 0x41 - .byte 0x7e ; sleb128 -2 - .align LOG2_GPR_BYTES -LEFDE1: - .align 1 - -#ifdef WANT_STUB - .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align 5 -L_ffi_closure_helper_DARWIN$stub: - .indirect_symbol _ffi_closure_helper_DARWIN - mflr r0 - bcl 20,31,"L1$spb" -"L1$spb": - mflr r11 - addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L1$spb") - mtlr r0 - lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L1$spb")(r11) - mtctr r12 - bctr - .lazy_symbol_pointer -L_ffi_closure_helper_DARWIN$lazy_ptr: - .indirect_symbol _ffi_closure_helper_DARWIN - .g_long dyld_stub_binding_helper - -#if defined(__ppc64__) - .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align 5 -L_darwin64_struct_ret_by_value_p$stub: - .indirect_symbol _darwin64_struct_ret_by_value_p - mflr r0 - bcl 20,31,"L2$spb" -"L2$spb": - mflr r11 - addis r11,r11,ha16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L2$spb") - mtlr r0 - lwzu r12,lo16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L2$spb")(r11) - mtctr r12 - bctr - .lazy_symbol_pointer -L_darwin64_struct_ret_by_value_p$lazy_ptr: - .indirect_symbol _darwin64_struct_ret_by_value_p - .g_long dyld_stub_binding_helper - - .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align 5 -L_darwin64_pass_struct_floats$stub: - .indirect_symbol _darwin64_pass_struct_floats - mflr r0 - bcl 20,31,"L3$spb" -"L3$spb": - mflr r11 - addis r11,r11,ha16(L_darwin64_pass_struct_floats$lazy_ptr-"L3$spb") - mtlr r0 - lwzu r12,lo16(L_darwin64_pass_struct_floats$lazy_ptr-"L3$spb")(r11) - mtctr r12 - bctr - .lazy_symbol_pointer -L_darwin64_pass_struct_floats$lazy_ptr: - .indirect_symbol _darwin64_pass_struct_floats - .g_long dyld_stub_binding_helper -# endif -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi.c b/llgo/third_party/gofrontend/libffi/src/powerpc/ffi.c deleted file mode 100644 index 7eb543e4b3b78976579d0dfa9c907944e2826ad8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi.c +++ /dev/null @@ -1,173 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (C) 2013 IBM - Copyright (C) 2011 Anthony Green - Copyright (C) 2011 Kyle Moffett - Copyright (C) 2008 Red Hat, Inc - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include "ffi.h" -#include "ffi_common.h" -#include "ffi_powerpc.h" - -#if HAVE_LONG_DOUBLE_VARIANT -/* Adjust ffi_type_longdouble. */ -void FFI_HIDDEN -ffi_prep_types (ffi_abi abi) -{ -# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -# ifdef POWERPC64 - ffi_prep_types_linux64 (abi); -# else - ffi_prep_types_sysv (abi); -# endif -# endif -} -#endif - -/* Perform machine dependent cif processing */ -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep (ffi_cif *cif) -{ -#ifdef POWERPC64 - return ffi_prep_cif_linux64 (cif); -#else - return ffi_prep_cif_sysv (cif); -#endif -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep_var (ffi_cif *cif, - unsigned int nfixedargs MAYBE_UNUSED, - unsigned int ntotalargs MAYBE_UNUSED) -{ -#ifdef POWERPC64 - return ffi_prep_cif_linux64_var (cif, nfixedargs, ntotalargs); -#else - return ffi_prep_cif_sysv (cif); -#endif -} - -static void -ffi_call_int (ffi_cif *cif, - void (*fn) (void), - void *rvalue, - void **avalue, - void *closure) -{ - /* The final SYSV ABI says that structures smaller or equal 8 bytes - are returned in r3/r4. A draft ABI used by linux instead returns - them in memory. - - We bounce-buffer SYSV small struct return values so that sysv.S - can write r3 and r4 to memory without worrying about struct size. - - For ELFv2 ABI, use a bounce buffer for homogeneous structs too, - for similar reasons. */ - unsigned long smst_buffer[8]; - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - ecif.rvalue = rvalue; - if ((cif->flags & FLAG_RETURNS_SMST) != 0) - ecif.rvalue = smst_buffer; - /* Ensure that we have a valid struct return value. - FIXME: Isn't this just papering over a user problem? */ - else if (!rvalue && cif->rtype->type == FFI_TYPE_STRUCT) - ecif.rvalue = alloca (cif->rtype->size); - -#ifdef POWERPC64 - ffi_call_LINUX64 (&ecif, fn, ecif.rvalue, cif->flags, closure, - -(long) cif->bytes); -#else - ffi_call_SYSV (&ecif, fn, ecif.rvalue, cif->flags, closure, -cif->bytes); -#endif - - /* Check for a bounce-buffered return value */ - if (rvalue && ecif.rvalue == smst_buffer) - { - unsigned int rsize = cif->rtype->size; -#ifndef __LITTLE_ENDIAN__ - /* The SYSV ABI returns a structure of up to 4 bytes in size - left-padded in r3. */ -# ifndef POWERPC64 - if (rsize <= 4) - memcpy (rvalue, (char *) smst_buffer + 4 - rsize, rsize); - else -# endif - /* The SYSV ABI returns a structure of up to 8 bytes in size - left-padded in r3/r4, and the ELFv2 ABI similarly returns a - structure of up to 8 bytes in size left-padded in r3. */ - if (rsize <= 8) - memcpy (rvalue, (char *) smst_buffer + 8 - rsize, rsize); - else -#endif - memcpy (rvalue, smst_buffer, rsize); - } -} - -void -ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue, - void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *codeloc) -{ -#ifdef POWERPC64 - return ffi_prep_closure_loc_linux64 (closure, cif, fun, user_data, codeloc); -#else - return ffi_prep_closure_loc_sysv (closure, cif, fun, user_data, codeloc); -#endif -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure *closure, - ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *)) -{ -#ifdef POWERPC64 - closure->tramp = ffi_go_closure_linux64; -#else - closure->tramp = ffi_go_closure_sysv; -#endif - closure->cif = cif; - closure->fun = fun; - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_darwin.c b/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_darwin.c deleted file mode 100644 index cf6fb6d4b7ca024af84d25f66c82740229b0ac42..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_darwin.c +++ /dev/null @@ -1,1359 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_darwin.c - - Copyright (C) 1998 Geoffrey Keating - Copyright (C) 2001 John Hornkvist - Copyright (C) 2002, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. - - FFI support for Darwin and AIX. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -extern void ffi_closure_ASM (void); - -enum { - /* The assembly depends on these exact flags. - For Darwin64 (when FLAG_RETURNS_STRUCT is set): - FLAG_RETURNS_FP indicates that the structure embeds FP data. - FLAG_RETURNS_128BITS signals a special struct size that is not - expanded for float content. */ - FLAG_RETURNS_128BITS = 1 << (31-31), /* These go in cr7 */ - FLAG_RETURNS_NOTHING = 1 << (31-30), - FLAG_RETURNS_FP = 1 << (31-29), - FLAG_RETURNS_64BITS = 1 << (31-28), - - FLAG_RETURNS_STRUCT = 1 << (31-27), /* This goes in cr6 */ - - FLAG_ARG_NEEDS_COPY = 1 << (31- 7), - FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ - FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), - FLAG_RETVAL_REFERENCE = 1 << (31- 4) -}; - -/* About the DARWIN ABI. */ -enum { - NUM_GPR_ARG_REGISTERS = 8, - NUM_FPR_ARG_REGISTERS = 13, - LINKAGE_AREA_GPRS = 6 -}; - -enum { ASM_NEEDS_REGISTERS = 4 }; /* r28-r31 */ - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments. - - m32/m64 - - The stack layout we want looks like this: - - | Return address from ffi_call_DARWIN | higher addresses - |--------------------------------------------| - | Previous backchain pointer 4/8 | stack pointer here - |--------------------------------------------|<+ <<< on entry to - | ASM_NEEDS_REGISTERS=r28-r31 4*(4/8) | | ffi_call_DARWIN - |--------------------------------------------| | - | When we have any FP activity... the | | - | FPRs occupy NUM_FPR_ARG_REGISTERS slots | | - | here fp13 .. fp1 from high to low addr. | | - ~ ~ ~ - | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS - |--------------------------------------------| | - | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | - |--------------------------------------------| | stack | - | Reserved 2*4/8 | | grows | - |--------------------------------------------| | down V - | Space for callee's LR 4/8 | | - |--------------------------------------------| | lower addresses - | Saved CR [low word for m64] 4/8 | | - |--------------------------------------------| | stack pointer here - | Current backchain pointer 4/8 |-/ during - |--------------------------------------------| <<< ffi_call_DARWIN - - */ - -#if defined(POWERPC_DARWIN64) -static void -darwin64_pass_struct_by_value - (ffi_type *, char *, unsigned, unsigned *, double **, unsigned long **); -#endif - -/* This depends on GPR_SIZE = sizeof (unsigned long) */ - -void -ffi_prep_args (extended_cif *ecif, unsigned long *const stack) -{ - const unsigned bytes = ecif->cif->bytes; - const unsigned flags = ecif->cif->flags; - const unsigned nargs = ecif->cif->nargs; -#if !defined(POWERPC_DARWIN64) - const ffi_abi abi = ecif->cif->abi; -#endif - - /* 'stacktop' points at the previous backchain pointer. */ - unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); - - /* 'fpr_base' points at the space for fpr1, and grows upwards as - we use FPR registers. */ - double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; - int gp_count = 0, fparg_count = 0; - - /* 'next_arg' grows up as we put parameters in it. */ - unsigned long *next_arg = stack + LINKAGE_AREA_GPRS; /* 6 reserved positions. */ - - int i; - double double_tmp; - void **p_argv = ecif->avalue; - unsigned long gprvalue; - ffi_type** ptr = ecif->cif->arg_types; -#if !defined(POWERPC_DARWIN64) - char *dest_cpy; -#endif - unsigned size_al = 0; - - /* Check that everything starts aligned properly. */ - FFI_ASSERT(((unsigned) (char *) stack & 0xF) == 0); - FFI_ASSERT(((unsigned) (char *) stacktop & 0xF) == 0); - FFI_ASSERT((bytes & 0xF) == 0); - - /* Deal with return values that are actually pass-by-reference. - Rule: - Return values are referenced by r3, so r4 is the first parameter. */ - - if (flags & FLAG_RETVAL_REFERENCE) - *next_arg++ = (unsigned long) (char *) ecif->rvalue; - - /* Now for the arguments. */ - for (i = nargs; i > 0; i--, ptr++, p_argv++) - { - switch ((*ptr)->type) - { - /* If a floating-point parameter appears before all of the general- - purpose registers are filled, the corresponding GPRs that match - the size of the floating-point parameter are skipped. */ - case FFI_TYPE_FLOAT: - double_tmp = *(float *) *p_argv; - if (fparg_count < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = double_tmp; -#if defined(POWERPC_DARWIN) - *(float *)next_arg = *(float *) *p_argv; -#else - *(double *)next_arg = double_tmp; -#endif - next_arg++; - gp_count++; - fparg_count++; - FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); - break; - - case FFI_TYPE_DOUBLE: - double_tmp = *(double *) *p_argv; - if (fparg_count < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = double_tmp; - *(double *)next_arg = double_tmp; -#ifdef POWERPC64 - next_arg++; - gp_count++; -#else - next_arg += 2; - gp_count += 2; -#endif - fparg_count++; - FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - - case FFI_TYPE_LONGDOUBLE: -# if defined(POWERPC64) && !defined(POWERPC_DARWIN64) - /* ??? This will exceed the regs count when the value starts at fp13 - and it will not put the extra bit on the stack. */ - if (fparg_count < NUM_FPR_ARG_REGISTERS) - *(long double *) fpr_base++ = *(long double *) *p_argv; - else - *(long double *) next_arg = *(long double *) *p_argv; - next_arg += 2; - fparg_count += 2; -# else - double_tmp = ((double *) *p_argv)[0]; - if (fparg_count < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = double_tmp; - *(double *) next_arg = double_tmp; -# if defined(POWERPC_DARWIN64) - next_arg++; - gp_count++; -# else - next_arg += 2; - gp_count += 2; -# endif - fparg_count++; - double_tmp = ((double *) *p_argv)[1]; - if (fparg_count < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = double_tmp; - *(double *) next_arg = double_tmp; -# if defined(POWERPC_DARWIN64) - next_arg++; - gp_count++; -# else - next_arg += 2; - gp_count += 2; -# endif - fparg_count++; -# endif - FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); - break; -#endif - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#ifdef POWERPC64 - gprvalue = *(long long *) *p_argv; - goto putgpr; -#else - *(long long *) next_arg = *(long long *) *p_argv; - next_arg += 2; - gp_count += 2; -#endif - break; - case FFI_TYPE_POINTER: - gprvalue = *(unsigned long *) *p_argv; - goto putgpr; - case FFI_TYPE_UINT8: - gprvalue = *(unsigned char *) *p_argv; - goto putgpr; - case FFI_TYPE_SINT8: - gprvalue = *(signed char *) *p_argv; - goto putgpr; - case FFI_TYPE_UINT16: - gprvalue = *(unsigned short *) *p_argv; - goto putgpr; - case FFI_TYPE_SINT16: - gprvalue = *(signed short *) *p_argv; - goto putgpr; - - case FFI_TYPE_STRUCT: - size_al = (*ptr)->size; -#if defined(POWERPC_DARWIN64) - next_arg = (unsigned long *)ALIGN((char *)next_arg, (*ptr)->alignment); - darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, - (unsigned) size_al, - (unsigned int *) &fparg_count, - &fpr_base, &next_arg); -#else - dest_cpy = (char *) next_arg; - - /* If the first member of the struct is a double, then include enough - padding in the struct size to align it to double-word. */ - if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); - -# if defined(POWERPC64) - FFI_ASSERT (abi != FFI_DARWIN); - memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); - next_arg += (size_al + 7) / 8; -# else - /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, - SI 4 bytes) are aligned as if they were those modes. - Structures with 3 byte in size are padded upwards. */ - if (size_al < 3 && abi == FFI_DARWIN) - dest_cpy += 4 - size_al; - - memcpy((char *) dest_cpy, (char *) *p_argv, size_al); - next_arg += (size_al + 3) / 4; -# endif -#endif - break; - - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - gprvalue = *(signed int *) *p_argv; - goto putgpr; - - case FFI_TYPE_UINT32: - gprvalue = *(unsigned int *) *p_argv; - putgpr: - *next_arg++ = gprvalue; - gp_count++; - break; - default: - break; - } - } - - /* Check that we didn't overrun the stack... */ - /* FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); - FFI_ASSERT((unsigned *)fpr_base - <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); - FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); */ -} - -#if defined(POWERPC_DARWIN64) - -/* See if we can put some of the struct into fprs. - This should not be called for structures of size 16 bytes, since these are not - broken out this way. */ -static void -darwin64_scan_struct_for_floats (ffi_type *s, unsigned *nfpr) -{ - int i; - - FFI_ASSERT (s->type == FFI_TYPE_STRUCT) - - for (i = 0; s->elements[i] != NULL; i++) - { - ffi_type *p = s->elements[i]; - switch (p->type) - { - case FFI_TYPE_STRUCT: - darwin64_scan_struct_for_floats (p, nfpr); - break; - case FFI_TYPE_LONGDOUBLE: - (*nfpr) += 2; - break; - case FFI_TYPE_DOUBLE: - case FFI_TYPE_FLOAT: - (*nfpr) += 1; - break; - default: - break; - } - } -} - -static int -darwin64_struct_size_exceeds_gprs_p (ffi_type *s, char *src, unsigned *nfpr) -{ - unsigned struct_offset=0, i; - - for (i = 0; s->elements[i] != NULL; i++) - { - char *item_base; - ffi_type *p = s->elements[i]; - /* Find the start of this item (0 for the first one). */ - if (i > 0) - struct_offset = ALIGN(struct_offset, p->alignment); - - item_base = src + struct_offset; - - switch (p->type) - { - case FFI_TYPE_STRUCT: - if (darwin64_struct_size_exceeds_gprs_p (p, item_base, nfpr)) - return 1; - break; - case FFI_TYPE_LONGDOUBLE: - if (*nfpr >= NUM_FPR_ARG_REGISTERS) - return 1; - (*nfpr) += 1; - item_base += 8; - /* FALL THROUGH */ - case FFI_TYPE_DOUBLE: - if (*nfpr >= NUM_FPR_ARG_REGISTERS) - return 1; - (*nfpr) += 1; - break; - case FFI_TYPE_FLOAT: - if (*nfpr >= NUM_FPR_ARG_REGISTERS) - return 1; - (*nfpr) += 1; - break; - default: - /* If we try and place any item, that is non-float, once we've - exceeded the 8 GPR mark, then we can't fit the struct. */ - if ((unsigned long)item_base >= 8*8) - return 1; - break; - } - /* now count the size of what we just used. */ - struct_offset += p->size; - } - return 0; -} - -/* Can this struct be returned by value? */ -int -darwin64_struct_ret_by_value_p (ffi_type *s) -{ - unsigned nfp = 0; - - FFI_ASSERT (s && s->type == FFI_TYPE_STRUCT); - - /* The largest structure we can return is 8long + 13 doubles. */ - if (s->size > 168) - return 0; - - /* We can't pass more than 13 floats. */ - darwin64_scan_struct_for_floats (s, &nfp); - if (nfp > 13) - return 0; - - /* If there are not too many floats, and the struct is - small enough to accommodate in the GPRs, then it must be OK. */ - if (s->size <= 64) - return 1; - - /* Well, we have to look harder. */ - nfp = 0; - if (darwin64_struct_size_exceeds_gprs_p (s, NULL, &nfp)) - return 0; - - return 1; -} - -void -darwin64_pass_struct_floats (ffi_type *s, char *src, - unsigned *nfpr, double **fprs) -{ - int i; - double *fpr_base = *fprs; - unsigned struct_offset = 0; - - /* We don't assume anything about the alignment of the source. */ - for (i = 0; s->elements[i] != NULL; i++) - { - char *item_base; - ffi_type *p = s->elements[i]; - /* Find the start of this item (0 for the first one). */ - if (i > 0) - struct_offset = ALIGN(struct_offset, p->alignment); - item_base = src + struct_offset; - - switch (p->type) - { - case FFI_TYPE_STRUCT: - darwin64_pass_struct_floats (p, item_base, nfpr, - &fpr_base); - break; - case FFI_TYPE_LONGDOUBLE: - if (*nfpr < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = *(double *)item_base; - (*nfpr) += 1; - item_base += 8; - /* FALL THROUGH */ - case FFI_TYPE_DOUBLE: - if (*nfpr < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = *(double *)item_base; - (*nfpr) += 1; - break; - case FFI_TYPE_FLOAT: - if (*nfpr < NUM_FPR_ARG_REGISTERS) - *fpr_base++ = (double) *(float *)item_base; - (*nfpr) += 1; - break; - default: - break; - } - /* now count the size of what we just used. */ - struct_offset += p->size; - } - /* Update the scores. */ - *fprs = fpr_base; -} - -/* Darwin64 special rules. - Break out a struct into params and float registers. */ -static void -darwin64_pass_struct_by_value (ffi_type *s, char *src, unsigned size, - unsigned *nfpr, double **fprs, unsigned long **arg) -{ - unsigned long *next_arg = *arg; - char *dest_cpy = (char *)next_arg; - - FFI_ASSERT (s->type == FFI_TYPE_STRUCT) - - if (!size) - return; - - /* First... special cases. */ - if (size < 3 - || (size == 4 - && s->elements[0] - && s->elements[0]->type != FFI_TYPE_FLOAT)) - { - /* Must be at least one GPR, padding is unspecified in value, - let's make it zero. */ - *next_arg = 0UL; - dest_cpy += 8 - size; - memcpy ((char *) dest_cpy, src, size); - next_arg++; - } - else if (size == 16) - { - memcpy ((char *) dest_cpy, src, size); - next_arg += 2; - } - else - { - /* now the general case, we consider embedded floats. */ - memcpy ((char *) dest_cpy, src, size); - darwin64_pass_struct_floats (s, src, nfpr, fprs); - next_arg += (size+7)/8; - } - - *arg = next_arg; -} - -double * -darwin64_struct_floats_to_mem (ffi_type *s, char *dest, double *fprs, unsigned *nf) -{ - int i; - unsigned struct_offset = 0; - - /* We don't assume anything about the alignment of the source. */ - for (i = 0; s->elements[i] != NULL; i++) - { - char *item_base; - ffi_type *p = s->elements[i]; - /* Find the start of this item (0 for the first one). */ - if (i > 0) - struct_offset = ALIGN(struct_offset, p->alignment); - item_base = dest + struct_offset; - - switch (p->type) - { - case FFI_TYPE_STRUCT: - fprs = darwin64_struct_floats_to_mem (p, item_base, fprs, nf); - break; - case FFI_TYPE_LONGDOUBLE: - if (*nf < NUM_FPR_ARG_REGISTERS) - { - *(double *)item_base = *fprs++ ; - (*nf) += 1; - } - item_base += 8; - /* FALL THROUGH */ - case FFI_TYPE_DOUBLE: - if (*nf < NUM_FPR_ARG_REGISTERS) - { - *(double *)item_base = *fprs++ ; - (*nf) += 1; - } - break; - case FFI_TYPE_FLOAT: - if (*nf < NUM_FPR_ARG_REGISTERS) - { - *(float *)item_base = (float) *fprs++ ; - (*nf) += 1; - } - break; - default: - break; - } - /* now count the size of what we just used. */ - struct_offset += p->size; - } - return fprs; -} - -#endif - -/* Adjust the size of S to be correct for Darwin. - On Darwin m32, the first field of a structure has natural alignment. - On Darwin m64, all fields have natural alignment. */ - -static void -darwin_adjust_aggregate_sizes (ffi_type *s) -{ - int i; - - if (s->type != FFI_TYPE_STRUCT) - return; - - s->size = 0; - for (i = 0; s->elements[i] != NULL; i++) - { - ffi_type *p; - int align; - - p = s->elements[i]; - if (p->type == FFI_TYPE_STRUCT) - darwin_adjust_aggregate_sizes (p); -#if defined(POWERPC_DARWIN64) - /* Natural alignment for all items. */ - align = p->alignment; -#else - /* Natural alignment for the first item... */ - if (i == 0) - align = p->alignment; - else if (p->alignment == 16 || p->alignment < 4) - /* .. subsequent items with vector or align < 4 have natural align. */ - align = p->alignment; - else - /* .. or align is 4. */ - align = 4; -#endif - /* Pad, if necessary, before adding the current item. */ - s->size = ALIGN(s->size, align) + p->size; - } - - s->size = ALIGN(s->size, s->alignment); - - /* This should not be necessary on m64, but harmless. */ - if (s->elements[0]->type == FFI_TYPE_UINT64 - || s->elements[0]->type == FFI_TYPE_SINT64 - || s->elements[0]->type == FFI_TYPE_DOUBLE - || s->elements[0]->alignment == 8) - s->alignment = s->alignment > 8 ? s->alignment : 8; - /* Do not add additional tail padding. */ -} - -/* Adjust the size of S to be correct for AIX. - Word-align double unless it is the first member of a structure. */ - -static void -aix_adjust_aggregate_sizes (ffi_type *s) -{ - int i; - - if (s->type != FFI_TYPE_STRUCT) - return; - - s->size = 0; - for (i = 0; s->elements[i] != NULL; i++) - { - ffi_type *p; - int align; - - p = s->elements[i]; - aix_adjust_aggregate_sizes (p); - align = p->alignment; - if (i != 0 && p->type == FFI_TYPE_DOUBLE) - align = 4; - s->size = ALIGN(s->size, align) + p->size; - } - - s->size = ALIGN(s->size, s->alignment); - - if (s->elements[0]->type == FFI_TYPE_UINT64 - || s->elements[0]->type == FFI_TYPE_SINT64 - || s->elements[0]->type == FFI_TYPE_DOUBLE - || s->elements[0]->alignment == 8) - s->alignment = s->alignment > 8 ? s->alignment : 8; - /* Do not add additional tail padding. */ -} - -/* Perform machine dependent cif processing. */ -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - /* All this is for the DARWIN ABI. */ - unsigned i; - ffi_type **ptr; - unsigned bytes; - unsigned fparg_count = 0, intarg_count = 0; - unsigned flags = 0; - unsigned size_al = 0; - - /* All the machine-independent calculation of cif->bytes will be wrong. - All the calculation of structure sizes will also be wrong. - Redo the calculation for DARWIN. */ - - if (cif->abi == FFI_DARWIN) - { - darwin_adjust_aggregate_sizes (cif->rtype); - for (i = 0; i < cif->nargs; i++) - darwin_adjust_aggregate_sizes (cif->arg_types[i]); - } - - if (cif->abi == FFI_AIX) - { - aix_adjust_aggregate_sizes (cif->rtype); - for (i = 0; i < cif->nargs; i++) - aix_adjust_aggregate_sizes (cif->arg_types[i]); - } - - /* Space for the frame pointer, callee's LR, CR, etc, and for - the asm's temp regs. */ - - bytes = (LINKAGE_AREA_GPRS + ASM_NEEDS_REGISTERS) * sizeof(unsigned long); - - /* Return value handling. - The rules m32 are as follows: - - 32-bit (or less) integer values are returned in gpr3; - - structures of size <= 4 bytes also returned in gpr3; - - 64-bit integer values [??? and structures between 5 and 8 bytes] are - returned in gpr3 and gpr4; - - Single/double FP values are returned in fpr1; - - Long double FP (if not equivalent to double) values are returned in - fpr1 and fpr2; - m64: - - 64-bit or smaller integral values are returned in GPR3 - - Single/double FP values are returned in fpr1; - - Long double FP values are returned in fpr1 and fpr2; - m64 Structures: - - If the structure could be accommodated in registers were it to be the - first argument to a routine, then it is returned in those registers. - m32/m64 structures otherwise: - - Larger structures values are allocated space and a pointer is passed - as the first argument. */ - switch (cif->rtype->type) - { - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - flags |= FLAG_RETURNS_128BITS; - flags |= FLAG_RETURNS_FP; - break; -#endif - - case FFI_TYPE_DOUBLE: - flags |= FLAG_RETURNS_64BITS; - /* Fall through. */ - case FFI_TYPE_FLOAT: - flags |= FLAG_RETURNS_FP; - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#ifdef POWERPC64 - case FFI_TYPE_POINTER: -#endif - flags |= FLAG_RETURNS_64BITS; - break; - - case FFI_TYPE_STRUCT: -#if defined(POWERPC_DARWIN64) - { - /* Can we fit the struct into regs? */ - if (darwin64_struct_ret_by_value_p (cif->rtype)) - { - unsigned nfpr = 0; - flags |= FLAG_RETURNS_STRUCT; - if (cif->rtype->size != 16) - darwin64_scan_struct_for_floats (cif->rtype, &nfpr) ; - else - flags |= FLAG_RETURNS_128BITS; - /* Will be 0 for 16byte struct. */ - if (nfpr) - flags |= FLAG_RETURNS_FP; - } - else /* By ref. */ - { - flags |= FLAG_RETVAL_REFERENCE; - flags |= FLAG_RETURNS_NOTHING; - intarg_count++; - } - } -#elif defined(DARWIN_PPC) - if (cif->rtype->size <= 4) - flags |= FLAG_RETURNS_STRUCT; - else /* else by reference. */ - { - flags |= FLAG_RETVAL_REFERENCE; - flags |= FLAG_RETURNS_NOTHING; - intarg_count++; - } -#else /* assume we pass by ref. */ - flags |= FLAG_RETVAL_REFERENCE; - flags |= FLAG_RETURNS_NOTHING; - intarg_count++; -#endif - break; - case FFI_TYPE_VOID: - flags |= FLAG_RETURNS_NOTHING; - break; - - default: - /* Returns 32-bit integer, or similar. Nothing to do here. */ - break; - } - - /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the - first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest - goes on the stack. - ??? Structures are passed as a pointer to a copy of the structure. - Stuff on the stack needs to keep proper alignment. - For m64 the count is effectively of half-GPRs. */ - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - unsigned align_words; - switch ((*ptr)->type) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - fparg_count++; -#if !defined(POWERPC_DARWIN64) - /* If this FP arg is going on the stack, it must be - 8-byte-aligned. */ - if (fparg_count > NUM_FPR_ARG_REGISTERS - && (intarg_count & 0x01) != 0) - intarg_count++; -#endif - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - fparg_count += 2; - /* If this FP arg is going on the stack, it must be - 16-byte-aligned. */ - if (fparg_count >= NUM_FPR_ARG_REGISTERS) -#if defined (POWERPC64) - intarg_count = ALIGN(intarg_count, 2); -#else - intarg_count = ALIGN(intarg_count, 4); -#endif - break; -#endif - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#if defined(POWERPC64) - intarg_count++; -#else - /* 'long long' arguments are passed as two words, but - either both words must fit in registers or both go - on the stack. If they go on the stack, they must - be 8-byte-aligned. */ - if (intarg_count == NUM_GPR_ARG_REGISTERS-1 - || (intarg_count >= NUM_GPR_ARG_REGISTERS - && (intarg_count & 0x01) != 0)) - intarg_count++; - intarg_count += 2; -#endif - break; - - case FFI_TYPE_STRUCT: - size_al = (*ptr)->size; -#if defined(POWERPC_DARWIN64) - align_words = (*ptr)->alignment >> 3; - if (align_words) - intarg_count = ALIGN(intarg_count, align_words); - /* Base size of the struct. */ - intarg_count += (size_al + 7) / 8; - /* If 16 bytes then don't worry about floats. */ - if (size_al != 16) - /* Scan through for floats to be placed in regs. */ - darwin64_scan_struct_for_floats (*ptr, &fparg_count) ; -#else - align_words = (*ptr)->alignment >> 2; - if (align_words) - intarg_count = ALIGN(intarg_count, align_words); - /* If the first member of the struct is a double, then align - the struct to double-word. - if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN((*ptr)->size, 8); */ -# ifdef POWERPC64 - intarg_count += (size_al + 7) / 8; -# else - intarg_count += (size_al + 3) / 4; -# endif -#endif - break; - - default: - /* Everything else is passed as a 4-byte word in a GPR, either - the object itself or a pointer to it. */ - intarg_count++; - break; - } - } - - if (fparg_count != 0) - flags |= FLAG_FP_ARGUMENTS; - -#if defined(POWERPC_DARWIN64) - /* Space to image the FPR registers, if needed - which includes when they might be - used in a struct return. */ - if (fparg_count != 0 - || ((flags & FLAG_RETURNS_STRUCT) - && (flags & FLAG_RETURNS_FP))) - bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); -#else - /* Space for the FPR registers, if needed. */ - if (fparg_count != 0) - bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); -#endif - - /* Stack space. */ -#ifdef POWERPC64 - if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS) - bytes += (intarg_count + fparg_count) * sizeof(long); -#else - if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS) - bytes += (intarg_count + 2 * fparg_count) * sizeof(long); -#endif - else - bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); - - /* The stack space allocated needs to be a multiple of 16 bytes. */ - bytes = ALIGN(bytes, 16) ; - - cif->flags = flags; - cif->bytes = bytes; - - return FFI_OK; -} - -extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, - void (*fn)(void), void (*fn2)(void)); - -extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, - void (*fn)(void), void (*fn2)(void), ffi_type*); - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return - value address then we need to make one. */ - - if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca (cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_AIX: - ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - FFI_FN(ffi_prep_args)); - break; - case FFI_DARWIN: - ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, - FFI_FN(ffi_prep_args), cif->rtype); - break; - default: - FFI_ASSERT(0); - break; - } -} - -static void flush_icache(char *); -static void flush_range(char *, int); - -/* The layout of a function descriptor. A C function pointer really - points to one of these. */ - -typedef struct aix_fd_struct { - void *code_pointer; - void *toc; -} aix_fd; - -/* here I'd like to add the stack frame layout we use in darwin_closure.S - and aix_closure.S - - m32/m64 - - The stack layout looks like this: - - | Additional params... | | Higher address - ~ ~ ~ - | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS - |--------------------------------------------| | - | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | - |--------------------------------------------| | - | Reserved 2*4/8 | | - |--------------------------------------------| | - | Space for callee's LR 4/8 | | - |--------------------------------------------| | - | Saved CR [low word for m64] 4/8 | | - |--------------------------------------------| | - | Current backchain pointer 4/8 |-/ Parent's frame. - |--------------------------------------------| <+ <<< on entry to ffi_closure_ASM - | Result Bytes 16 | | - |--------------------------------------------| | - ~ padding to 16-byte alignment ~ ~ - |--------------------------------------------| | - | NUM_FPR_ARG_REGISTERS slots | | - | here fp13 .. fp1 13*8 | | - |--------------------------------------------| | - | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS - |--------------------------------------------| | - | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | - |--------------------------------------------| | stack | - | Reserved [compiler,binder] 2*4/8 | | grows | - |--------------------------------------------| | down V - | Space for callee's LR 4/8 | | - |--------------------------------------------| | lower addresses - | Saved CR [low word for m64] 4/8 | | - |--------------------------------------------| | stack pointer here - | Current backchain pointer 4/8 |-/ during - |--------------------------------------------| <<< ffi_closure_ASM. - -*/ - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp; - struct ffi_aix_trampoline_struct *tramp_aix; - aix_fd *fd; - - switch (cif->abi) - { - case FFI_DARWIN: - - FFI_ASSERT (cif->abi == FFI_DARWIN); - - tramp = (unsigned int *) &closure->tramp[0]; -#if defined(POWERPC_DARWIN64) - tramp[0] = 0x7c0802a6; /* mflr r0 */ - tramp[1] = 0x429f0015; /* bcl- 20,4*cr7+so, +0x18 (L1) */ - /* We put the addresses here. */ - tramp[6] = 0x7d6802a6; /*L1: mflr r11 */ - tramp[7] = 0xe98b0000; /* ld r12,0(r11) function address */ - tramp[8] = 0x7c0803a6; /* mtlr r0 */ - tramp[9] = 0x7d8903a6; /* mtctr r12 */ - tramp[10] = 0xe96b0008; /* lwz r11,8(r11) static chain */ - tramp[11] = 0x4e800420; /* bctr */ - - *((unsigned long *)&tramp[2]) = (unsigned long) ffi_closure_ASM; /* function */ - *((unsigned long *)&tramp[4]) = (unsigned long) codeloc; /* context */ -#else - tramp[0] = 0x7c0802a6; /* mflr r0 */ - tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ - tramp[4] = 0x7d6802a6; /* mflr r11 */ - tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ - tramp[6] = 0x7c0803a6; /* mtlr r0 */ - tramp[7] = 0x7d8903a6; /* mtctr r12 */ - tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ - tramp[9] = 0x4e800420; /* bctr */ - tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ - tramp[3] = (unsigned long) codeloc; /* context */ -#endif - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - /* Flush the icache. Only necessary on Darwin. */ - flush_range(codeloc, FFI_TRAMPOLINE_SIZE); - - break; - - case FFI_AIX: - - tramp_aix = (struct ffi_aix_trampoline_struct *) (closure->tramp); - fd = (aix_fd *)(void *)ffi_closure_ASM; - - FFI_ASSERT (cif->abi == FFI_AIX); - - tramp_aix->code_pointer = fd->code_pointer; - tramp_aix->toc = fd->toc; - tramp_aix->static_chain = codeloc; - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - break; - - default: - return FFI_BAD_ABI; - break; - } - return FFI_OK; -} - -static void -flush_icache(char *addr) -{ -#ifndef _AIX - __asm__ volatile ( - "dcbf 0,%0\n" - "\tsync\n" - "\ticbi 0,%0\n" - "\tsync\n" - "\tisync" - : : "r"(addr) : "memory"); -#endif -} - -static void -flush_range(char * addr1, int size) -{ -#define MIN_LINE_SIZE 32 - int i; - for (i = 0; i < size; i += MIN_LINE_SIZE) - flush_icache(addr1+i); - flush_icache(addr1+size-1); -} - -typedef union -{ - float f; - double d; -} ffi_dblfl; - -ffi_type * -ffi_closure_helper_DARWIN (ffi_closure *, void *, - unsigned long *, ffi_dblfl *); - -/* Basically the trampoline invokes ffi_closure_ASM, and on - entry, r11 holds the address of the closure. - After storing the registers that could possibly contain - parameters to be passed into the stack frame and setting - up space for a return value, ffi_closure_ASM invokes the - following helper function to do most of the work. */ - -ffi_type * -ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, - unsigned long *pgr, ffi_dblfl *pfr) -{ - /* rvalue is the pointer to space for return value in closure assembly - pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM - pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ - - typedef double ldbits[2]; - - union ldu - { - ldbits lb; - long double ld; - }; - - void ** avalue; - ffi_type ** arg_types; - long i, avn; - ffi_cif * cif; - ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; - unsigned size_al; -#if defined(POWERPC_DARWIN64) - unsigned fpsused = 0; -#endif - - cif = closure->cif; - avalue = alloca (cif->nargs * sizeof(void *)); - - if (cif->rtype->type == FFI_TYPE_STRUCT) - { -#if defined(POWERPC_DARWIN64) - if (!darwin64_struct_ret_by_value_p (cif->rtype)) - { - /* Won't fit into the regs - return by ref. */ - rvalue = (void *) *pgr; - pgr++; - } -#elif defined(DARWIN_PPC) - if (cif->rtype->size > 4) - { - rvalue = (void *) *pgr; - pgr++; - } -#else /* assume we return by ref. */ - rvalue = (void *) *pgr; - pgr++; -#endif - } - - i = 0; - avn = cif->nargs; - arg_types = cif->arg_types; - - /* Grab the addresses of the arguments from the stack frame. */ - while (i < avn) - { - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: -#if defined(POWERPC64) - avalue[i] = (char *) pgr + 7; -#else - avalue[i] = (char *) pgr + 3; -#endif - pgr++; - break; - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: -#if defined(POWERPC64) - avalue[i] = (char *) pgr + 6; -#else - avalue[i] = (char *) pgr + 2; -#endif - pgr++; - break; - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: -#if defined(POWERPC64) - avalue[i] = (char *) pgr + 4; -#else - case FFI_TYPE_POINTER: - avalue[i] = pgr; -#endif - pgr++; - break; - - case FFI_TYPE_STRUCT: - size_al = arg_types[i]->size; -#if defined(POWERPC_DARWIN64) - pgr = (unsigned long *)ALIGN((char *)pgr, arg_types[i]->alignment); - if (size_al < 3 || size_al == 4) - { - avalue[i] = ((char *)pgr)+8-size_al; - if (arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT - && fpsused < NUM_FPR_ARG_REGISTERS) - { - *(float *)pgr = (float) *(double *)pfr; - pfr++; - fpsused++; - } - } - else - { - if (size_al != 16) - pfr = (ffi_dblfl *) - darwin64_struct_floats_to_mem (arg_types[i], (char *)pgr, - (double *)pfr, &fpsused); - avalue[i] = pgr; - } - pgr += (size_al + 7) / 8; -#else - /* If the first member of the struct is a double, then align - the struct to double-word. */ - if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) - size_al = ALIGN(arg_types[i]->size, 8); -# if defined(POWERPC64) - FFI_ASSERT (cif->abi != FFI_DARWIN); - avalue[i] = pgr; - pgr += (size_al + 7) / 8; -# else - /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, - SI 4 bytes) are aligned as if they were those modes. */ - if (size_al < 3 && cif->abi == FFI_DARWIN) - avalue[i] = (char*) pgr + 4 - size_al; - else - avalue[i] = pgr; - pgr += (size_al + 3) / 4; -# endif -#endif - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: -#if defined(POWERPC64) - case FFI_TYPE_POINTER: - avalue[i] = pgr; - pgr++; - break; -#else - /* Long long ints are passed in two gpr's. */ - avalue[i] = pgr; - pgr += 2; - break; -#endif - - case FFI_TYPE_FLOAT: - /* A float value consumes a GPR. - There are 13 64bit floating point registers. */ - if (pfr < end_pfr) - { - double temp = pfr->d; - pfr->f = (float) temp; - avalue[i] = pfr; - pfr++; - } - else - { - avalue[i] = pgr; - } - pgr++; - break; - - case FFI_TYPE_DOUBLE: - /* A double value consumes two GPRs. - There are 13 64bit floating point registers. */ - if (pfr < end_pfr) - { - avalue[i] = pfr; - pfr++; - } - else - { - avalue[i] = pgr; - } -#ifdef POWERPC64 - pgr++; -#else - pgr += 2; -#endif - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - - case FFI_TYPE_LONGDOUBLE: -#ifdef POWERPC64 - if (pfr + 1 < end_pfr) - { - avalue[i] = pfr; - pfr += 2; - } - else - { - if (pfr < end_pfr) - { - *pgr = *(unsigned long *) pfr; - pfr++; - } - avalue[i] = pgr; - } - pgr += 2; -#else /* POWERPC64 */ - /* A long double value consumes four GPRs and two FPRs. - There are 13 64bit floating point registers. */ - if (pfr + 1 < end_pfr) - { - avalue[i] = pfr; - pfr += 2; - } - /* Here we have the situation where one part of the long double - is stored in fpr13 and the other part is already on the stack. - We use a union to pass the long double to avalue[i]. */ - else if (pfr + 1 == end_pfr) - { - union ldu temp_ld; - memcpy (&temp_ld.lb[0], pfr, sizeof(ldbits)); - memcpy (&temp_ld.lb[1], pgr + 2, sizeof(ldbits)); - avalue[i] = &temp_ld.ld; - pfr++; - } - else - { - avalue[i] = pgr; - } - pgr += 4; -#endif /* POWERPC64 */ - break; -#endif - default: - FFI_ASSERT(0); - } - i++; - } - - (closure->fun) (cif, rvalue, avalue, closure->user_data); - - /* Tell ffi_closure_ASM to perform return type promotions. */ - return cif->rtype; -} diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_linux64.c b/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_linux64.c deleted file mode 100644 index b84b91fb237d1f2fa3cfd12c2612174d4394ac5c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_linux64.c +++ /dev/null @@ -1,945 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_linux64.c - Copyright (C) 2013 IBM - Copyright (C) 2011 Anthony Green - Copyright (C) 2011 Kyle Moffett - Copyright (C) 2008 Red Hat, Inc - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include "ffi.h" - -#ifdef POWERPC64 -#include "ffi_common.h" -#include "ffi_powerpc.h" - - -/* About the LINUX64 ABI. */ -enum { - NUM_GPR_ARG_REGISTERS64 = 8, - NUM_FPR_ARG_REGISTERS64 = 13 -}; -enum { ASM_NEEDS_REGISTERS64 = 4 }; - - -#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -/* Adjust size of ffi_type_longdouble. */ -void FFI_HIDDEN -ffi_prep_types_linux64 (ffi_abi abi) -{ - if ((abi & (FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128)) == FFI_LINUX) - { - ffi_type_longdouble.size = 8; - ffi_type_longdouble.alignment = 8; - } - else - { - ffi_type_longdouble.size = 16; - ffi_type_longdouble.alignment = 16; - } -} -#endif - - -#if _CALL_ELF == 2 -static unsigned int -discover_homogeneous_aggregate (const ffi_type *t, unsigned int *elnum) -{ - switch (t->type) - { - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - *elnum = 1; - return (int) t->type; - - case FFI_TYPE_STRUCT:; - { - unsigned int base_elt = 0, total_elnum = 0; - ffi_type **el = t->elements; - while (*el) - { - unsigned int el_elt, el_elnum = 0; - el_elt = discover_homogeneous_aggregate (*el, &el_elnum); - if (el_elt == 0 - || (base_elt && base_elt != el_elt)) - return 0; - base_elt = el_elt; - total_elnum += el_elnum; - if (total_elnum > 8) - return 0; - el++; - } - *elnum = total_elnum; - return base_elt; - } - - default: - return 0; - } -} -#endif - - -/* Perform machine dependent cif processing */ -static ffi_status -ffi_prep_cif_linux64_core (ffi_cif *cif) -{ - ffi_type **ptr; - unsigned bytes; - unsigned i, fparg_count = 0, intarg_count = 0; - unsigned flags = cif->flags; -#if _CALL_ELF == 2 - unsigned int elt, elnum; -#endif - -#if FFI_TYPE_LONGDOUBLE == FFI_TYPE_DOUBLE - /* If compiled without long double support.. */ - if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) - return FFI_BAD_ABI; -#endif - - /* The machine-independent calculation of cif->bytes doesn't work - for us. Redo the calculation. */ -#if _CALL_ELF == 2 - /* Space for backchain, CR, LR, TOC and the asm's temp regs. */ - bytes = (4 + ASM_NEEDS_REGISTERS64) * sizeof (long); - - /* Space for the general registers. */ - bytes += NUM_GPR_ARG_REGISTERS64 * sizeof (long); -#else - /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp - regs. */ - bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); - - /* Space for the mandatory parm save area and general registers. */ - bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); -#endif - - /* Return value handling. */ - switch (cif->rtype->type) - { -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) - flags |= FLAG_RETURNS_128BITS; - /* Fall through. */ -#endif - case FFI_TYPE_DOUBLE: - flags |= FLAG_RETURNS_64BITS; - /* Fall through. */ - case FFI_TYPE_FLOAT: - flags |= FLAG_RETURNS_FP; - break; - - case FFI_TYPE_UINT128: - flags |= FLAG_RETURNS_128BITS; - /* Fall through. */ - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - flags |= FLAG_RETURNS_64BITS; - break; - - case FFI_TYPE_STRUCT: -#if _CALL_ELF == 2 - elt = discover_homogeneous_aggregate (cif->rtype, &elnum); - if (elt) - { - if (elt == FFI_TYPE_DOUBLE) - flags |= FLAG_RETURNS_64BITS; - flags |= FLAG_RETURNS_FP | FLAG_RETURNS_SMST; - break; - } - if (cif->rtype->size <= 16) - { - flags |= FLAG_RETURNS_SMST; - break; - } -#endif - intarg_count++; - flags |= FLAG_RETVAL_REFERENCE; - /* Fall through. */ - case FFI_TYPE_VOID: - flags |= FLAG_RETURNS_NOTHING; - break; - - default: - /* Returns 32-bit integer, or similar. Nothing to do here. */ - break; - } - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - unsigned int align; - - switch ((*ptr)->type) - { -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) - { - fparg_count++; - intarg_count++; - } - /* Fall through. */ -#endif - case FFI_TYPE_DOUBLE: - case FFI_TYPE_FLOAT: - fparg_count++; - intarg_count++; - if (fparg_count > NUM_FPR_ARG_REGISTERS64) - flags |= FLAG_ARG_NEEDS_PSAVE; - break; - - case FFI_TYPE_STRUCT: - if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) - { - align = (*ptr)->alignment; - if (align > 16) - align = 16; - align = align / 8; - if (align > 1) - intarg_count = ALIGN (intarg_count, align); - } - intarg_count += ((*ptr)->size + 7) / 8; -#if _CALL_ELF == 2 - elt = discover_homogeneous_aggregate (*ptr, &elnum); - if (elt) - { - fparg_count += elnum; - if (fparg_count > NUM_FPR_ARG_REGISTERS64) - flags |= FLAG_ARG_NEEDS_PSAVE; - } - else -#endif - { - if (intarg_count > NUM_GPR_ARG_REGISTERS64) - flags |= FLAG_ARG_NEEDS_PSAVE; - } - break; - - case FFI_TYPE_POINTER: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - /* Everything else is passed as a 8-byte word in a GPR, either - the object itself or a pointer to it. */ - intarg_count++; - if (intarg_count > NUM_GPR_ARG_REGISTERS64) - flags |= FLAG_ARG_NEEDS_PSAVE; - break; - default: - FFI_ASSERT (0); - } - } - - if (fparg_count != 0) - flags |= FLAG_FP_ARGUMENTS; - if (intarg_count > 4) - flags |= FLAG_4_GPR_ARGUMENTS; - - /* Space for the FPR registers, if needed. */ - if (fparg_count != 0) - bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); - - /* Stack space. */ -#if _CALL_ELF == 2 - if ((flags & FLAG_ARG_NEEDS_PSAVE) != 0) - bytes += intarg_count * sizeof (long); -#else - if (intarg_count > NUM_GPR_ARG_REGISTERS64) - bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); -#endif - - /* The stack space allocated needs to be a multiple of 16 bytes. */ - bytes = (bytes + 15) & ~0xF; - - cif->flags = flags; - cif->bytes = bytes; - - return FFI_OK; -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_linux64 (ffi_cif *cif) -{ - if ((cif->abi & FFI_LINUX) != 0) - cif->nfixedargs = cif->nargs; -#if _CALL_ELF != 2 - else if (cif->abi == FFI_COMPAT_LINUX64) - { - /* This call is from old code. Don't touch cif->nfixedargs - since old code will be using a smaller cif. */ - cif->flags |= FLAG_COMPAT; - /* Translate to new abi value. */ - cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128; - } -#endif - else - return FFI_BAD_ABI; - return ffi_prep_cif_linux64_core (cif); -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_linux64_var (ffi_cif *cif, - unsigned int nfixedargs, - unsigned int ntotalargs MAYBE_UNUSED) -{ - if ((cif->abi & FFI_LINUX) != 0) - cif->nfixedargs = nfixedargs; -#if _CALL_ELF != 2 - else if (cif->abi == FFI_COMPAT_LINUX64) - { - /* This call is from old code. Don't touch cif->nfixedargs - since old code will be using a smaller cif. */ - cif->flags |= FLAG_COMPAT; - /* Translate to new abi value. */ - cif->abi = FFI_LINUX | FFI_LINUX_LONG_DOUBLE_128; - } -#endif - else - return FFI_BAD_ABI; -#if _CALL_ELF == 2 - cif->flags |= FLAG_ARG_NEEDS_PSAVE; -#endif - return ffi_prep_cif_linux64_core (cif); -} - - -/* ffi_prep_args64 is called by the assembly routine once stack space - has been allocated for the function's arguments. - - The stack layout we want looks like this: - - | Ret addr from ffi_call_LINUX64 8bytes | higher addresses - |--------------------------------------------| - | CR save area 8bytes | - |--------------------------------------------| - | Previous backchain pointer 8 | stack pointer here - |--------------------------------------------|<+ <<< on entry to - | Saved r28-r31 4*8 | | ffi_call_LINUX64 - |--------------------------------------------| | - | GPR registers r3-r10 8*8 | | - |--------------------------------------------| | - | FPR registers f1-f13 (optional) 13*8 | | - |--------------------------------------------| | - | Parameter save area | | - |--------------------------------------------| | - | TOC save area 8 | | - |--------------------------------------------| | stack | - | Linker doubleword 8 | | grows | - |--------------------------------------------| | down V - | Compiler doubleword 8 | | - |--------------------------------------------| | lower addresses - | Space for callee's LR 8 | | - |--------------------------------------------| | - | CR save area 8 | | - |--------------------------------------------| | stack pointer here - | Current backchain pointer 8 |-/ during - |--------------------------------------------| <<< ffi_call_LINUX64 - -*/ - -void FFI_HIDDEN -ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) -{ - const unsigned long bytes = ecif->cif->bytes; - const unsigned long flags = ecif->cif->flags; - - typedef union - { - char *c; - unsigned long *ul; - float *f; - double *d; - size_t p; - } valp; - - /* 'stacktop' points at the previous backchain pointer. */ - valp stacktop; - - /* 'next_arg' points at the space for gpr3, and grows upwards as - we use GPR registers, then continues at rest. */ - valp gpr_base; - valp gpr_end; - valp rest; - valp next_arg; - - /* 'fpr_base' points at the space for fpr3, and grows upwards as - we use FPR registers. */ - valp fpr_base; - unsigned int fparg_count; - - unsigned int i, words, nargs, nfixedargs; - ffi_type **ptr; - double double_tmp; - union - { - void **v; - char **c; - signed char **sc; - unsigned char **uc; - signed short **ss; - unsigned short **us; - signed int **si; - unsigned int **ui; - unsigned long **ul; - float **f; - double **d; - } p_argv; - unsigned long gprvalue; - unsigned long align; - - stacktop.c = (char *) stack + bytes; - gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; - gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; -#if _CALL_ELF == 2 - rest.ul = stack + 4 + NUM_GPR_ARG_REGISTERS64; -#else - rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; -#endif - fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; - fparg_count = 0; - next_arg.ul = gpr_base.ul; - - /* Check that everything starts aligned properly. */ - FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); - FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); - FFI_ASSERT ((bytes & 0xF) == 0); - - /* Deal with return values that are actually pass-by-reference. */ - if (flags & FLAG_RETVAL_REFERENCE) - *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; - - /* Now for the arguments. */ - p_argv.v = ecif->avalue; - nargs = ecif->cif->nargs; -#if _CALL_ELF != 2 - nfixedargs = (unsigned) -1; - if ((flags & FLAG_COMPAT) == 0) -#endif - nfixedargs = ecif->cif->nfixedargs; - for (ptr = ecif->cif->arg_types, i = 0; - i < nargs; - i++, ptr++, p_argv.v++) - { -#if _CALL_ELF == 2 - unsigned int elt, elnum; -#endif - - switch ((*ptr)->type) - { -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if ((ecif->cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) - { - double_tmp = (*p_argv.d)[0]; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) - { - *fpr_base.d++ = double_tmp; -# if _CALL_ELF != 2 - if ((flags & FLAG_COMPAT) != 0) - *next_arg.d = double_tmp; -# endif - } - else - *next_arg.d = double_tmp; - if (++next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - fparg_count++; - double_tmp = (*p_argv.d)[1]; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) - { - *fpr_base.d++ = double_tmp; -# if _CALL_ELF != 2 - if ((flags & FLAG_COMPAT) != 0) - *next_arg.d = double_tmp; -# endif - } - else - *next_arg.d = double_tmp; - if (++next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - fparg_count++; - FFI_ASSERT (__LDBL_MANT_DIG__ == 106); - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; - } - /* Fall through. */ -#endif - case FFI_TYPE_DOUBLE: - double_tmp = **p_argv.d; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) - { - *fpr_base.d++ = double_tmp; -#if _CALL_ELF != 2 - if ((flags & FLAG_COMPAT) != 0) - *next_arg.d = double_tmp; -#endif - } - else - *next_arg.d = double_tmp; - if (++next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - fparg_count++; - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; - - case FFI_TYPE_FLOAT: - double_tmp = **p_argv.f; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) - { - *fpr_base.d++ = double_tmp; -#if _CALL_ELF != 2 - if ((flags & FLAG_COMPAT) != 0) - *next_arg.f = (float) double_tmp; -#endif - } - else - *next_arg.f = (float) double_tmp; - if (++next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - fparg_count++; - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; - - case FFI_TYPE_STRUCT: - if ((ecif->cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) - { - align = (*ptr)->alignment; - if (align > 16) - align = 16; - if (align > 1) - next_arg.p = ALIGN (next_arg.p, align); - } -#if _CALL_ELF == 2 - elt = discover_homogeneous_aggregate (*ptr, &elnum); - if (elt) - { - union { - void *v; - float *f; - double *d; - } arg; - - arg.v = *p_argv.v; - if (elt == FFI_TYPE_FLOAT) - { - do - { - double_tmp = *arg.f++; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 - && i < nfixedargs) - *fpr_base.d++ = double_tmp; - else - *next_arg.f = (float) double_tmp; - if (++next_arg.f == gpr_end.f) - next_arg.f = rest.f; - fparg_count++; - } - while (--elnum != 0); - if ((next_arg.p & 3) != 0) - { - if (++next_arg.f == gpr_end.f) - next_arg.f = rest.f; - } - } - else - do - { - double_tmp = *arg.d++; - if (fparg_count < NUM_FPR_ARG_REGISTERS64 && i < nfixedargs) - *fpr_base.d++ = double_tmp; - else - *next_arg.d = double_tmp; - if (++next_arg.d == gpr_end.d) - next_arg.d = rest.d; - fparg_count++; - } - while (--elnum != 0); - } - else -#endif - { - words = ((*ptr)->size + 7) / 8; - if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) - { - size_t first = gpr_end.c - next_arg.c; - memcpy (next_arg.c, *p_argv.c, first); - memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); - next_arg.c = rest.c + words * 8 - first; - } - else - { - char *where = next_arg.c; - -#ifndef __LITTLE_ENDIAN__ - /* Structures with size less than eight bytes are passed - left-padded. */ - if ((*ptr)->size < 8) - where += 8 - (*ptr)->size; -#endif - memcpy (where, *p_argv.c, (*ptr)->size); - next_arg.ul += words; - if (next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - } - } - break; - - case FFI_TYPE_UINT8: - gprvalue = **p_argv.uc; - goto putgpr; - case FFI_TYPE_SINT8: - gprvalue = **p_argv.sc; - goto putgpr; - case FFI_TYPE_UINT16: - gprvalue = **p_argv.us; - goto putgpr; - case FFI_TYPE_SINT16: - gprvalue = **p_argv.ss; - goto putgpr; - case FFI_TYPE_UINT32: - gprvalue = **p_argv.ui; - goto putgpr; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - gprvalue = **p_argv.si; - goto putgpr; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - gprvalue = **p_argv.ul; - putgpr: - *next_arg.ul++ = gprvalue; - if (next_arg.ul == gpr_end.ul) - next_arg.ul = rest.ul; - break; - } - } - - FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS - || (next_arg.ul >= gpr_base.ul - && next_arg.ul <= gpr_base.ul + 4)); -} - - -#if _CALL_ELF == 2 -#define MIN_CACHE_LINE_SIZE 8 - -static void -flush_icache (char *wraddr, char *xaddr, int size) -{ - int i; - for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) - __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" - : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); - __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" - : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) - : "memory"); -} -#endif - - -ffi_status FFI_HIDDEN -ffi_prep_closure_loc_linux64 (ffi_closure *closure, - ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *codeloc) -{ -#if _CALL_ELF == 2 - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - - if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) - return FFI_BAD_ABI; - - tramp[0] = 0xe96c0018; /* 0: ld 11,2f-0b(12) */ - tramp[1] = 0xe98c0010; /* ld 12,1f-0b(12) */ - tramp[2] = 0x7d8903a6; /* mtctr 12 */ - tramp[3] = 0x4e800420; /* bctr */ - /* 1: .quad function_addr */ - /* 2: .quad context */ - *(void **) &tramp[4] = (void *) ffi_closure_LINUX64; - *(void **) &tramp[6] = codeloc; - flush_icache ((char *) tramp, (char *) codeloc, 4 * 4); -#else - void **tramp = (void **) &closure->tramp[0]; - - if (cif->abi < FFI_LINUX || cif->abi >= FFI_LAST_ABI) - return FFI_BAD_ABI; - - /* Copy function address and TOC from ffi_closure_LINUX64 OPD. */ - memcpy (&tramp[0], (void **) ffi_closure_LINUX64, sizeof (void *)); - tramp[1] = codeloc; - memcpy (&tramp[2], (void **) ffi_closure_LINUX64 + 1, sizeof (void *)); -#endif - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - - -int FFI_HIDDEN -ffi_closure_helper_LINUX64 (ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *rvalue, - unsigned long *pst, - ffi_dblfl *pfr) -{ - /* rvalue is the pointer to space for return value in closure assembly */ - /* pst is the pointer to parameter save area - (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ - /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ - - void **avalue; - ffi_type **arg_types; - unsigned long i, avn, nfixedargs; - ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; - unsigned long align; - - avalue = alloca (cif->nargs * sizeof (void *)); - - /* Copy the caller's structure return value address so that the - closure returns the data directly to the caller. */ - if (cif->rtype->type == FFI_TYPE_STRUCT - && (cif->flags & FLAG_RETURNS_SMST) == 0) - { - rvalue = (void *) *pst; - pst++; - } - - i = 0; - avn = cif->nargs; -#if _CALL_ELF != 2 - nfixedargs = (unsigned) -1; - if ((cif->flags & FLAG_COMPAT) == 0) -#endif - nfixedargs = cif->nfixedargs; - arg_types = cif->arg_types; - - /* Grab the addresses of the arguments from the stack frame. */ - while (i < avn) - { - unsigned int elt, elnum; - - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: -#ifndef __LITTLE_ENDIAN__ - avalue[i] = (char *) pst + 7; - pst++; - break; -#endif - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: -#ifndef __LITTLE_ENDIAN__ - avalue[i] = (char *) pst + 6; - pst++; - break; -#endif - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: -#ifndef __LITTLE_ENDIAN__ - avalue[i] = (char *) pst + 4; - pst++; - break; -#endif - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - avalue[i] = pst; - pst++; - break; - - case FFI_TYPE_STRUCT: - if ((cif->abi & FFI_LINUX_STRUCT_ALIGN) != 0) - { - align = arg_types[i]->alignment; - if (align > 16) - align = 16; - if (align > 1) - pst = (unsigned long *) ALIGN ((size_t) pst, align); - } - elt = 0; -#if _CALL_ELF == 2 - elt = discover_homogeneous_aggregate (arg_types[i], &elnum); -#endif - if (elt) - { - union { - void *v; - unsigned long *ul; - float *f; - double *d; - size_t p; - } to, from; - - /* Repackage the aggregate from its parts. The - aggregate size is not greater than the space taken by - the registers so store back to the register/parameter - save arrays. */ - if (pfr + elnum <= end_pfr) - to.v = pfr; - else - to.v = pst; - - avalue[i] = to.v; - from.ul = pst; - if (elt == FFI_TYPE_FLOAT) - { - do - { - if (pfr < end_pfr && i < nfixedargs) - { - *to.f = (float) pfr->d; - pfr++; - } - else - *to.f = *from.f; - to.f++; - from.f++; - } - while (--elnum != 0); - } - else - { - do - { - if (pfr < end_pfr && i < nfixedargs) - { - *to.d = pfr->d; - pfr++; - } - else - *to.d = *from.d; - to.d++; - from.d++; - } - while (--elnum != 0); - } - } - else - { -#ifndef __LITTLE_ENDIAN__ - /* Structures with size less than eight bytes are passed - left-padded. */ - if (arg_types[i]->size < 8) - avalue[i] = (char *) pst + 8 - arg_types[i]->size; - else -#endif - avalue[i] = pst; - } - pst += (arg_types[i]->size + 7) / 8; - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if ((cif->abi & FFI_LINUX_LONG_DOUBLE_128) != 0) - { - if (pfr + 1 < end_pfr && i + 1 < nfixedargs) - { - avalue[i] = pfr; - pfr += 2; - } - else - { - if (pfr < end_pfr && i < nfixedargs) - { - /* Passed partly in f13 and partly on the stack. - Move it all to the stack. */ - *pst = *(unsigned long *) pfr; - pfr++; - } - avalue[i] = pst; - } - pst += 2; - break; - } - /* Fall through. */ -#endif - case FFI_TYPE_DOUBLE: - /* On the outgoing stack all values are aligned to 8 */ - /* there are 13 64bit floating point registers */ - - if (pfr < end_pfr && i < nfixedargs) - { - avalue[i] = pfr; - pfr++; - } - else - avalue[i] = pst; - pst++; - break; - - case FFI_TYPE_FLOAT: - if (pfr < end_pfr && i < nfixedargs) - { - /* Float values are stored as doubles in the - ffi_closure_LINUX64 code. Fix them here. */ - pfr->f = (float) pfr->d; - avalue[i] = pfr; - pfr++; - } - else - avalue[i] = pst; - pst++; - break; - - default: - FFI_ASSERT (0); - } - - i++; - } - - (*fun) (cif, rvalue, avalue, user_data); - - /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ - if ((cif->flags & FLAG_RETURNS_SMST) != 0) - { - if ((cif->flags & FLAG_RETURNS_FP) == 0) - return FFI_V2_TYPE_SMALL_STRUCT + cif->rtype->size - 1; - else if ((cif->flags & FLAG_RETURNS_64BITS) != 0) - return FFI_V2_TYPE_DOUBLE_HOMOG; - else - return FFI_V2_TYPE_FLOAT_HOMOG; - } - return cif->rtype->type; -} -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_powerpc.h b/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_powerpc.h deleted file mode 100644 index 3dcd6b57175dd36af3047c220e193362d6001658..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_powerpc.h +++ /dev/null @@ -1,94 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_powerpc.h - Copyright (C) 2013 IBM - Copyright (C) 2011 Anthony Green - Copyright (C) 2011 Kyle Moffett - Copyright (C) 2008 Red Hat, Inc - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -enum { - /* The assembly depends on these exact flags. */ - /* These go in cr7 */ - FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ - FLAG_RETURNS_NOTHING = 1 << (31-30), - FLAG_RETURNS_FP = 1 << (31-29), - FLAG_RETURNS_64BITS = 1 << (31-28), - - /* This goes in cr6 */ - FLAG_RETURNS_128BITS = 1 << (31-27), - - FLAG_COMPAT = 1 << (31- 8), /* Not used by assembly */ - - /* These go in cr1 */ - FLAG_ARG_NEEDS_COPY = 1 << (31- 7), /* Used by sysv code */ - FLAG_ARG_NEEDS_PSAVE = FLAG_ARG_NEEDS_COPY, /* Used by linux64 code */ - FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ - FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), - FLAG_RETVAL_REFERENCE = 1 << (31- 4) -}; - -typedef union -{ - float f; - double d; -} ffi_dblfl; - -void FFI_HIDDEN ffi_closure_SYSV (void); -void FFI_HIDDEN ffi_go_closure_sysv (void); -void FFI_HIDDEN ffi_call_SYSV(extended_cif *, void (*)(void), void *, - unsigned, void *, int); - -void FFI_HIDDEN ffi_prep_types_sysv (ffi_abi); -ffi_status FFI_HIDDEN ffi_prep_cif_sysv (ffi_cif *); -ffi_status FFI_HIDDEN ffi_prep_closure_loc_sysv (ffi_closure *, - ffi_cif *, - void (*) (ffi_cif *, void *, - void **, void *), - void *, void *); -int FFI_HIDDEN ffi_closure_helper_SYSV (ffi_cif *, - void (*) (ffi_cif *, void *, - void **, void *), - void *, void *, unsigned long *, - ffi_dblfl *, unsigned long *); - -void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, void (*) (void), void *, - unsigned long, void *, long); -void FFI_HIDDEN ffi_closure_LINUX64 (void); -void FFI_HIDDEN ffi_go_closure_linux64 (void); - -void FFI_HIDDEN ffi_prep_types_linux64 (ffi_abi); -ffi_status FFI_HIDDEN ffi_prep_cif_linux64 (ffi_cif *); -ffi_status FFI_HIDDEN ffi_prep_cif_linux64_var (ffi_cif *, unsigned int, - unsigned int); -void FFI_HIDDEN ffi_prep_args64 (extended_cif *, unsigned long *const); -ffi_status FFI_HIDDEN ffi_prep_closure_loc_linux64 (ffi_closure *, ffi_cif *, - void (*) (ffi_cif *, void *, - void **, void *), - void *, void *); -int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_cif *, - void (*) (ffi_cif *, void *, - void **, void *), - void *, void *, - unsigned long *, ffi_dblfl *); diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_sysv.c b/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_sysv.c deleted file mode 100644 index 646c340d5ad93da41ca1b5a9c8235ee94277b6cb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffi_sysv.c +++ /dev/null @@ -1,934 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi_sysv.c - Copyright (C) 2013 IBM - Copyright (C) 2011 Anthony Green - Copyright (C) 2011 Kyle Moffett - Copyright (C) 2008 Red Hat, Inc - Copyright (C) 2007, 2008 Free Software Foundation, Inc - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include "ffi.h" - -#ifndef POWERPC64 -#include "ffi_common.h" -#include "ffi_powerpc.h" - - -/* About the SYSV ABI. */ -#define ASM_NEEDS_REGISTERS 6 -#define NUM_GPR_ARG_REGISTERS 8 -#define NUM_FPR_ARG_REGISTERS 8 - - -#if HAVE_LONG_DOUBLE_VARIANT && FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -/* Adjust size of ffi_type_longdouble. */ -void FFI_HIDDEN -ffi_prep_types_sysv (ffi_abi abi) -{ - if ((abi & (FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128)) == FFI_SYSV) - { - ffi_type_longdouble.size = 8; - ffi_type_longdouble.alignment = 8; - } - else - { - ffi_type_longdouble.size = 16; - ffi_type_longdouble.alignment = 16; - } -} -#endif - -/* Transform long double, double and float to other types as per abi. */ -static int -translate_float (int abi, int type) -{ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - if (type == FFI_TYPE_LONGDOUBLE - && (abi & FFI_SYSV_LONG_DOUBLE_128) == 0) - type = FFI_TYPE_DOUBLE; -#endif - if ((abi & FFI_SYSV_SOFT_FLOAT) != 0) - { - if (type == FFI_TYPE_FLOAT) - type = FFI_TYPE_UINT32; - else if (type == FFI_TYPE_DOUBLE) - type = FFI_TYPE_UINT64; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - else if (type == FFI_TYPE_LONGDOUBLE) - type = FFI_TYPE_UINT128; - } - else if ((abi & FFI_SYSV_IBM_LONG_DOUBLE) == 0) - { - if (type == FFI_TYPE_LONGDOUBLE) - type = FFI_TYPE_STRUCT; -#endif - } - return type; -} - -/* Perform machine dependent cif processing */ -static ffi_status -ffi_prep_cif_sysv_core (ffi_cif *cif) -{ - ffi_type **ptr; - unsigned bytes; - unsigned i, fparg_count = 0, intarg_count = 0; - unsigned flags = cif->flags; - unsigned struct_copy_size = 0; - unsigned type = cif->rtype->type; - unsigned size = cif->rtype->size; - - /* The machine-independent calculation of cif->bytes doesn't work - for us. Redo the calculation. */ - - /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ - bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); - - /* Space for the GPR registers. */ - bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); - - /* Return value handling. The rules for SYSV are as follows: - - 32-bit (or less) integer values are returned in gpr3; - - Structures of size <= 4 bytes also returned in gpr3; - - 64-bit integer values and structures between 5 and 8 bytes are returned - in gpr3 and gpr4; - - Larger structures are allocated space and a pointer is passed as - the first argument. - - Single/double FP values are returned in fpr1; - - long doubles (if not equivalent to double) are returned in - fpr1,fpr2 for Linux and as for large structs for SysV. */ - - type = translate_float (cif->abi, type); - - switch (type) - { -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - flags |= FLAG_RETURNS_128BITS; - /* Fall through. */ -#endif - case FFI_TYPE_DOUBLE: - flags |= FLAG_RETURNS_64BITS; - /* Fall through. */ - case FFI_TYPE_FLOAT: - flags |= FLAG_RETURNS_FP; -#ifdef __NO_FPRS__ - return FFI_BAD_ABI; -#endif - break; - - case FFI_TYPE_UINT128: - flags |= FLAG_RETURNS_128BITS; - /* Fall through. */ - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - flags |= FLAG_RETURNS_64BITS; - break; - - case FFI_TYPE_STRUCT: - /* The final SYSV ABI says that structures smaller or equal 8 bytes - are returned in r3/r4. A draft ABI used by linux instead - returns them in memory. */ - if ((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8) - { - flags |= FLAG_RETURNS_SMST; - break; - } - intarg_count++; - flags |= FLAG_RETVAL_REFERENCE; - /* Fall through. */ - case FFI_TYPE_VOID: - flags |= FLAG_RETURNS_NOTHING; - break; - - default: - /* Returns 32-bit integer, or similar. Nothing to do here. */ - break; - } - - /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the - first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest - goes on the stack. Structures and long doubles (if not equivalent - to double) are passed as a pointer to a copy of the structure. - Stuff on the stack needs to keep proper alignment. */ - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - unsigned short typenum = (*ptr)->type; - - typenum = translate_float (cif->abi, typenum); - - switch (typenum) - { -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - fparg_count++; - /* Fall thru */ -#endif - case FFI_TYPE_DOUBLE: - fparg_count++; - /* If this FP arg is going on the stack, it must be - 8-byte-aligned. */ - if (fparg_count > NUM_FPR_ARG_REGISTERS - && intarg_count >= NUM_GPR_ARG_REGISTERS - && intarg_count % 2 != 0) - intarg_count++; -#ifdef __NO_FPRS__ - return FFI_BAD_ABI; -#endif - break; - - case FFI_TYPE_FLOAT: - fparg_count++; -#ifdef __NO_FPRS__ - return FFI_BAD_ABI; -#endif - break; - - case FFI_TYPE_UINT128: - /* A long double in FFI_LINUX_SOFT_FLOAT can use only a set - of four consecutive gprs. If we do not have enough, we - have to adjust the intarg_count value. */ - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 - && intarg_count < NUM_GPR_ARG_REGISTERS) - intarg_count = NUM_GPR_ARG_REGISTERS; - intarg_count += 4; - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - /* 'long long' arguments are passed as two words, but - either both words must fit in registers or both go - on the stack. If they go on the stack, they must - be 8-byte-aligned. - - Also, only certain register pairs can be used for - passing long long int -- specifically (r3,r4), (r5,r6), - (r7,r8), (r9,r10). */ - if (intarg_count == NUM_GPR_ARG_REGISTERS-1 - || intarg_count % 2 != 0) - intarg_count++; - intarg_count += 2; - break; - - case FFI_TYPE_STRUCT: - /* We must allocate space for a copy of these to enforce - pass-by-value. Pad the space up to a multiple of 16 - bytes (the maximum alignment required for anything under - the SYSV ABI). */ - struct_copy_size += ((*ptr)->size + 15) & ~0xF; - /* Fall through (allocate space for the pointer). */ - - case FFI_TYPE_POINTER: - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - /* Everything else is passed as a 4-byte word in a GPR, either - the object itself or a pointer to it. */ - intarg_count++; - break; - - default: - FFI_ASSERT (0); - } - } - - if (fparg_count != 0) - flags |= FLAG_FP_ARGUMENTS; - if (intarg_count > 4) - flags |= FLAG_4_GPR_ARGUMENTS; - if (struct_copy_size != 0) - flags |= FLAG_ARG_NEEDS_COPY; - - /* Space for the FPR registers, if needed. */ - if (fparg_count != 0) - bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); - - /* Stack space. */ - if (intarg_count > NUM_GPR_ARG_REGISTERS) - bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); - if (fparg_count > NUM_FPR_ARG_REGISTERS) - bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); - - /* The stack space allocated needs to be a multiple of 16 bytes. */ - bytes = (bytes + 15) & ~0xF; - - /* Add in the space for the copied structures. */ - bytes += struct_copy_size; - - cif->flags = flags; - cif->bytes = bytes; - - return FFI_OK; -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_sysv (ffi_cif *cif) -{ - if ((cif->abi & FFI_SYSV) == 0) - { - /* This call is from old code. Translate to new ABI values. */ - cif->flags |= FLAG_COMPAT; - switch (cif->abi) - { - default: - return FFI_BAD_ABI; - - case FFI_COMPAT_SYSV: - cif->abi = FFI_SYSV | FFI_SYSV_STRUCT_RET | FFI_SYSV_LONG_DOUBLE_128; - break; - - case FFI_COMPAT_GCC_SYSV: - cif->abi = FFI_SYSV | FFI_SYSV_LONG_DOUBLE_128; - break; - - case FFI_COMPAT_LINUX: - cif->abi = (FFI_SYSV | FFI_SYSV_IBM_LONG_DOUBLE - | FFI_SYSV_LONG_DOUBLE_128); - break; - - case FFI_COMPAT_LINUX_SOFT_FLOAT: - cif->abi = (FFI_SYSV | FFI_SYSV_SOFT_FLOAT | FFI_SYSV_IBM_LONG_DOUBLE - | FFI_SYSV_LONG_DOUBLE_128); - break; - } - } - return ffi_prep_cif_sysv_core (cif); -} - -/* ffi_prep_args_SYSV is called by the assembly routine once stack space - has been allocated for the function's arguments. - - The stack layout we want looks like this: - - | Return address from ffi_call_SYSV 4bytes | higher addresses - |--------------------------------------------| - | Previous backchain pointer 4 | stack pointer here - |--------------------------------------------|<+ <<< on entry to - | Saved r28-r31 4*4 | | ffi_call_SYSV - |--------------------------------------------| | - | GPR registers r3-r10 8*4 | | ffi_call_SYSV - |--------------------------------------------| | - | FPR registers f1-f8 (optional) 8*8 | | - |--------------------------------------------| | stack | - | Space for copied structures | | grows | - |--------------------------------------------| | down V - | Parameters that didn't fit in registers | | - |--------------------------------------------| | lower addresses - | Space for callee's LR 4 | | - |--------------------------------------------| | stack pointer here - | Current backchain pointer 4 |-/ during - |--------------------------------------------| <<< ffi_call_SYSV - -*/ - -void FFI_HIDDEN -ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) -{ - const unsigned bytes = ecif->cif->bytes; - const unsigned flags = ecif->cif->flags; - - typedef union - { - char *c; - unsigned *u; - long long *ll; - float *f; - double *d; - } valp; - - /* 'stacktop' points at the previous backchain pointer. */ - valp stacktop; - - /* 'gpr_base' points at the space for gpr3, and grows upwards as - we use GPR registers. */ - valp gpr_base; - int intarg_count; - -#ifndef __NO_FPRS__ - /* 'fpr_base' points at the space for fpr1, and grows upwards as - we use FPR registers. */ - valp fpr_base; - int fparg_count; -#endif - - /* 'copy_space' grows down as we put structures in it. It should - stay 16-byte aligned. */ - valp copy_space; - - /* 'next_arg' grows up as we put parameters in it. */ - valp next_arg; - - int i; - ffi_type **ptr; -#ifndef __NO_FPRS__ - double double_tmp; -#endif - union - { - void **v; - char **c; - signed char **sc; - unsigned char **uc; - signed short **ss; - unsigned short **us; - unsigned int **ui; - long long **ll; - float **f; - double **d; - } p_argv; - size_t struct_copy_size; - unsigned gprvalue; - - stacktop.c = (char *) stack + bytes; - gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; - intarg_count = 0; -#ifndef __NO_FPRS__ - fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; - fparg_count = 0; - copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); -#else - copy_space.c = gpr_base.c; -#endif - next_arg.u = stack + 2; - - /* Check that everything starts aligned properly. */ - FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); - FFI_ASSERT (((unsigned long) copy_space.c & 0xF) == 0); - FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); - FFI_ASSERT ((bytes & 0xF) == 0); - FFI_ASSERT (copy_space.c >= next_arg.c); - - /* Deal with return values that are actually pass-by-reference. */ - if (flags & FLAG_RETVAL_REFERENCE) - { - *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; - intarg_count++; - } - - /* Now for the arguments. */ - p_argv.v = ecif->avalue; - for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; - i > 0; - i--, ptr++, p_argv.v++) - { - unsigned int typenum = (*ptr)->type; - - typenum = translate_float (ecif->cif->abi, typenum); - - /* Now test the translated value */ - switch (typenum) - { -#ifndef __NO_FPRS__ -# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - double_tmp = (*p_argv.d)[0]; - - if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) - { - if (intarg_count >= NUM_GPR_ARG_REGISTERS - && intarg_count % 2 != 0) - { - intarg_count++; - next_arg.u++; - } - *next_arg.d = double_tmp; - next_arg.u += 2; - double_tmp = (*p_argv.d)[1]; - *next_arg.d = double_tmp; - next_arg.u += 2; - } - else - { - *fpr_base.d++ = double_tmp; - double_tmp = (*p_argv.d)[1]; - *fpr_base.d++ = double_tmp; - } - - fparg_count += 2; - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; -# endif - case FFI_TYPE_DOUBLE: - double_tmp = **p_argv.d; - - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - { - if (intarg_count >= NUM_GPR_ARG_REGISTERS - && intarg_count % 2 != 0) - { - intarg_count++; - next_arg.u++; - } - *next_arg.d = double_tmp; - next_arg.u += 2; - } - else - *fpr_base.d++ = double_tmp; - fparg_count++; - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; - - case FFI_TYPE_FLOAT: - double_tmp = **p_argv.f; - if (fparg_count >= NUM_FPR_ARG_REGISTERS) - { - *next_arg.f = (float) double_tmp; - next_arg.u += 1; - intarg_count++; - } - else - *fpr_base.d++ = double_tmp; - fparg_count++; - FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); - break; -#endif /* have FPRs */ - - case FFI_TYPE_UINT128: - /* The soft float ABI for long doubles works like this, a long double - is passed in four consecutive GPRs if available. A maximum of 2 - long doubles can be passed in gprs. If we do not have 4 GPRs - left, the long double is passed on the stack, 4-byte aligned. */ - { - unsigned int int_tmp; - unsigned int ii; - if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) - { - if (intarg_count < NUM_GPR_ARG_REGISTERS) - intarg_count = NUM_GPR_ARG_REGISTERS; - for (ii = 0; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *next_arg.u++ = int_tmp; - } - } - else - { - for (ii = 0; ii < 4; ii++) - { - int_tmp = (*p_argv.ui)[ii]; - *gpr_base.u++ = int_tmp; - } - } - intarg_count += 4; - break; - } - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - if (intarg_count == NUM_GPR_ARG_REGISTERS-1) - intarg_count++; - if (intarg_count >= NUM_GPR_ARG_REGISTERS) - { - if (intarg_count % 2 != 0) - { - intarg_count++; - next_arg.u++; - } - *next_arg.ll = **p_argv.ll; - next_arg.u += 2; - } - else - { - /* The abi states only certain register pairs can be - used for passing long long int specifically (r3,r4), - (r5,r6), (r7,r8), (r9,r10). If next arg is long long - but not correct starting register of pair then skip - until the proper starting register. */ - if (intarg_count % 2 != 0) - { - intarg_count ++; - gpr_base.u++; - } - *gpr_base.ll++ = **p_argv.ll; - } - intarg_count += 2; - break; - - case FFI_TYPE_STRUCT: - struct_copy_size = ((*ptr)->size + 15) & ~0xF; - copy_space.c -= struct_copy_size; - memcpy (copy_space.c, *p_argv.c, (*ptr)->size); - - gprvalue = (unsigned long) copy_space.c; - - FFI_ASSERT (copy_space.c > next_arg.c); - FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); - goto putgpr; - - case FFI_TYPE_UINT8: - gprvalue = **p_argv.uc; - goto putgpr; - case FFI_TYPE_SINT8: - gprvalue = **p_argv.sc; - goto putgpr; - case FFI_TYPE_UINT16: - gprvalue = **p_argv.us; - goto putgpr; - case FFI_TYPE_SINT16: - gprvalue = **p_argv.ss; - goto putgpr; - - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - - gprvalue = **p_argv.ui; - - putgpr: - if (intarg_count >= NUM_GPR_ARG_REGISTERS) - *next_arg.u++ = gprvalue; - else - *gpr_base.u++ = gprvalue; - intarg_count++; - break; - } - } - - /* Check that we didn't overrun the stack... */ - FFI_ASSERT (copy_space.c >= next_arg.c); - FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); - /* The assert below is testing that the number of integer arguments agrees - with the number found in ffi_prep_cif_machdep(). However, intarg_count - is incremented whenever we place an FP arg on the stack, so account for - that before our assert test. */ -#ifndef __NO_FPRS__ - if (fparg_count > NUM_FPR_ARG_REGISTERS) - intarg_count -= fparg_count - NUM_FPR_ARG_REGISTERS; - FFI_ASSERT (fpr_base.u - <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); -#endif - FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); -} - -#define MIN_CACHE_LINE_SIZE 8 - -static void -flush_icache (char *wraddr, char *xaddr, int size) -{ - int i; - for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) - __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" - : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); - __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" - : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) - : "memory"); -} - -ffi_status FFI_HIDDEN -ffi_prep_closure_loc_sysv (ffi_closure *closure, - ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *codeloc) -{ - unsigned int *tramp; - - if (cif->abi < FFI_SYSV || cif->abi >= FFI_LAST_ABI) - return FFI_BAD_ABI; - - tramp = (unsigned int *) &closure->tramp[0]; - tramp[0] = 0x7c0802a6; /* mflr r0 */ - tramp[1] = 0x429f0005; /* bcl 20,31,.+4 */ - tramp[2] = 0x7d6802a6; /* mflr r11 */ - tramp[3] = 0x7c0803a6; /* mtlr r0 */ - tramp[4] = 0x800b0018; /* lwz r0,24(r11) */ - tramp[5] = 0x816b001c; /* lwz r11,28(r11) */ - tramp[6] = 0x7c0903a6; /* mtctr r0 */ - tramp[7] = 0x4e800420; /* bctr */ - *(void **) &tramp[8] = (void *) ffi_closure_SYSV; /* function */ - *(void **) &tramp[9] = codeloc; /* context */ - - /* Flush the icache. */ - flush_icache ((char *)tramp, (char *)codeloc, 8 * 4); - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -/* Basically the trampoline invokes ffi_closure_SYSV, and on - entry, r11 holds the address of the closure. - After storing the registers that could possibly contain - parameters to be passed into the stack frame and setting - up space for a return value, ffi_closure_SYSV invokes the - following helper function to do most of the work. */ - -int -ffi_closure_helper_SYSV (ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *rvalue, - unsigned long *pgr, - ffi_dblfl *pfr, - unsigned long *pst) -{ - /* rvalue is the pointer to space for return value in closure assembly */ - /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ - /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ - /* pst is the pointer to outgoing parameter stack in original caller */ - - void ** avalue; - ffi_type ** arg_types; - long i, avn; -#ifndef __NO_FPRS__ - long nf = 0; /* number of floating registers already used */ -#endif - long ng = 0; /* number of general registers already used */ - - unsigned size = cif->rtype->size; - unsigned short rtypenum = cif->rtype->type; - - avalue = alloca (cif->nargs * sizeof (void *)); - - /* First translate for softfloat/nonlinux */ - rtypenum = translate_float (cif->abi, rtypenum); - - /* Copy the caller's structure return value address so that the closure - returns the data directly to the caller. - For FFI_SYSV the result is passed in r3/r4 if the struct size is less - or equal 8 bytes. */ - if (rtypenum == FFI_TYPE_STRUCT - && !((cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8)) - { - rvalue = (void *) *pgr; - ng++; - pgr++; - } - - i = 0; - avn = cif->nargs; - arg_types = cif->arg_types; - - /* Grab the addresses of the arguments from the stack frame. */ - while (i < avn) { - unsigned short typenum = arg_types[i]->type; - - /* We may need to handle some values depending on ABI. */ - typenum = translate_float (cif->abi, typenum); - - switch (typenum) - { -#ifndef __NO_FPRS__ - case FFI_TYPE_FLOAT: - /* Unfortunately float values are stored as doubles - in the ffi_closure_SYSV code (since we don't check - the type in that routine). */ - if (nf < NUM_FPR_ARG_REGISTERS) - { - /* FIXME? here we are really changing the values - stored in the original calling routines outgoing - parameter stack. This is probably a really - naughty thing to do but... */ - double temp = pfr->d; - pfr->f = (float) temp; - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - avalue[i] = pst; - pst += 1; - } - break; - - case FFI_TYPE_DOUBLE: - if (nf < NUM_FPR_ARG_REGISTERS) - { - avalue[i] = pfr; - nf++; - pfr++; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 2; - } - break; - -# if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - if (nf < NUM_FPR_ARG_REGISTERS - 1) - { - avalue[i] = pfr; - pfr += 2; - nf += 2; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 4; - nf = 8; - } - break; -# endif -#endif - - case FFI_TYPE_UINT128: - /* Test if for the whole long double, 4 gprs are available. - otherwise the stuff ends up on the stack. */ - if (ng < NUM_GPR_ARG_REGISTERS - 3) - { - avalue[i] = pgr; - pgr += 4; - ng += 4; - } - else - { - avalue[i] = pst; - pst += 4; - ng = 8+4; - } - break; - - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: -#ifndef __LITTLE_ENDIAN__ - if (ng < NUM_GPR_ARG_REGISTERS) - { - avalue[i] = (char *) pgr + 3; - ng++; - pgr++; - } - else - { - avalue[i] = (char *) pst + 3; - pst++; - } - break; -#endif - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: -#ifndef __LITTLE_ENDIAN__ - if (ng < NUM_GPR_ARG_REGISTERS) - { - avalue[i] = (char *) pgr + 2; - ng++; - pgr++; - } - else - { - avalue[i] = (char *) pst + 2; - pst++; - } - break; -#endif - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - if (ng < NUM_GPR_ARG_REGISTERS) - { - avalue[i] = pgr; - ng++; - pgr++; - } - else - { - avalue[i] = pst; - pst++; - } - break; - - case FFI_TYPE_STRUCT: - /* Structs are passed by reference. The address will appear in a - gpr if it is one of the first 8 arguments. */ - if (ng < NUM_GPR_ARG_REGISTERS) - { - avalue[i] = (void *) *pgr; - ng++; - pgr++; - } - else - { - avalue[i] = (void *) *pst; - pst++; - } - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - /* Passing long long ints are complex, they must - be passed in suitable register pairs such as - (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) - and if the entire pair aren't available then the outgoing - parameter stack is used for both but an alignment of 8 - must will be kept. So we must either look in pgr - or pst to find the correct address for this type - of parameter. */ - if (ng < NUM_GPR_ARG_REGISTERS - 1) - { - if (ng & 1) - { - /* skip r4, r6, r8 as starting points */ - ng++; - pgr++; - } - avalue[i] = pgr; - ng += 2; - pgr += 2; - } - else - { - if (((long) pst) & 4) - pst++; - avalue[i] = pst; - pst += 2; - ng = NUM_GPR_ARG_REGISTERS; - } - break; - - default: - FFI_ASSERT (0); - } - - i++; - } - - (*fun) (cif, rvalue, avalue, user_data); - - /* Tell ffi_closure_SYSV how to perform return type promotions. - Because the FFI_SYSV ABI returns the structures <= 8 bytes in - r3/r4 we have to tell ffi_closure_SYSV how to treat them. We - combine the base type FFI_SYSV_TYPE_SMALL_STRUCT with the size of - the struct less one. We never have a struct with size zero. - See the comment in ffitarget.h about ordering. */ - if (rtypenum == FFI_TYPE_STRUCT - && (cif->abi & FFI_SYSV_STRUCT_RET) != 0 && size <= 8) - return FFI_SYSV_TYPE_SMALL_STRUCT - 1 + size; - return rtypenum; -} -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/powerpc/ffitarget.h deleted file mode 100644 index 0f66d319c778da653aca29a5db34e94e9d81e6ba..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ffitarget.h +++ /dev/null @@ -1,195 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc - Copyright (c) 1996-2003 Red Hat, Inc. - - Target configuration macros for PowerPC. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ -#ifndef POWERPC64 -#define POWERPC64 -#endif -#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin64 */ -#ifndef POWERPC64 -#define POWERPC64 -#endif -#ifndef POWERPC_DARWIN64 -#define POWERPC_DARWIN64 -#endif -#elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ -#ifndef POWERPC64 -#define POWERPC64 -#endif -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - -#if defined (POWERPC_AIX) - FFI_AIX, - FFI_DARWIN, - FFI_DEFAULT_ABI = FFI_AIX, - FFI_LAST_ABI - -#elif defined (POWERPC_DARWIN) - FFI_AIX, - FFI_DARWIN, - FFI_DEFAULT_ABI = FFI_DARWIN, - FFI_LAST_ABI - -#else - /* The FFI_COMPAT values are used by old code. Since libffi may be - a shared library we have to support old values for backwards - compatibility. */ - FFI_COMPAT_SYSV, - FFI_COMPAT_GCC_SYSV, - FFI_COMPAT_LINUX64, - FFI_COMPAT_LINUX, - FFI_COMPAT_LINUX_SOFT_FLOAT, - -# if defined (POWERPC64) - /* This bit, always set in new code, must not be set in any of the - old FFI_COMPAT values that might be used for 64-bit linux. We - only need worry about FFI_COMPAT_LINUX64, but to be safe avoid - all old values. */ - FFI_LINUX = 8, - /* This and following bits can reuse FFI_COMPAT values. */ - FFI_LINUX_STRUCT_ALIGN = 1, - FFI_LINUX_LONG_DOUBLE_128 = 2, - FFI_DEFAULT_ABI = (FFI_LINUX -# ifdef __STRUCT_PARM_ALIGN__ - | FFI_LINUX_STRUCT_ALIGN -# endif -# ifdef __LONG_DOUBLE_128__ - | FFI_LINUX_LONG_DOUBLE_128 -# endif - ), - FFI_LAST_ABI = 12 - -# else - /* This bit, always set in new code, must not be set in any of the - old FFI_COMPAT values that might be used for 32-bit linux/sysv/bsd. */ - FFI_SYSV = 8, - /* This and following bits can reuse FFI_COMPAT values. */ - FFI_SYSV_SOFT_FLOAT = 1, - FFI_SYSV_STRUCT_RET = 2, - FFI_SYSV_IBM_LONG_DOUBLE = 4, - FFI_SYSV_LONG_DOUBLE_128 = 16, - - FFI_DEFAULT_ABI = (FFI_SYSV -# ifdef __NO_FPRS__ - | FFI_SYSV_SOFT_FLOAT -# endif -# if (defined (__SVR4_STRUCT_RETURN) \ - || defined (POWERPC_FREEBSD) && !defined (__AIX_STRUCT_RETURN)) - | FFI_SYSV_STRUCT_RET -# endif -# if __LDBL_MANT_DIG__ == 106 - | FFI_SYSV_IBM_LONG_DOUBLE -# endif -# ifdef __LONG_DOUBLE_128__ - | FFI_SYSV_LONG_DOUBLE_128 -# endif - ), - FFI_LAST_ABI = 32 -# endif -#endif - -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 -#if defined (POWERPC) || defined (POWERPC_FREEBSD) -# define FFI_GO_CLOSURES 1 -# define FFI_TARGET_SPECIFIC_VARIADIC 1 -# define FFI_EXTRA_CIF_FIELDS unsigned nfixedargs -#endif - -/* ppc_closure.S and linux64_closure.S expect this. */ -#define FFI_PPC_TYPE_LAST FFI_TYPE_POINTER - -/* We define additional types below. If generic types are added that - must be supported by powerpc libffi then it is likely that - FFI_PPC_TYPE_LAST needs increasing *and* the jump tables in - ppc_closure.S and linux64_closure.S be extended. */ - -#if !(FFI_TYPE_LAST == FFI_PPC_TYPE_LAST \ - || (FFI_TYPE_LAST == FFI_TYPE_COMPLEX \ - && !defined FFI_TARGET_HAS_COMPLEX_TYPE)) -# error "You likely have a broken powerpc libffi" -#endif - -/* Needed for soft-float long-double-128 support. */ -#define FFI_TYPE_UINT128 (FFI_PPC_TYPE_LAST + 1) - -/* Needed for FFI_SYSV small structure returns. */ -#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_PPC_TYPE_LAST + 2) - -/* Used by ELFv2 for homogenous structure returns. */ -#define FFI_V2_TYPE_FLOAT_HOMOG (FFI_PPC_TYPE_LAST + 1) -#define FFI_V2_TYPE_DOUBLE_HOMOG (FFI_PPC_TYPE_LAST + 2) -#define FFI_V2_TYPE_SMALL_STRUCT (FFI_PPC_TYPE_LAST + 3) - -#if _CALL_ELF == 2 -# define FFI_TRAMPOLINE_SIZE 32 -#else -# if defined(POWERPC64) || defined(POWERPC_AIX) -# if defined(POWERPC_DARWIN64) -# define FFI_TRAMPOLINE_SIZE 48 -# else -# define FFI_TRAMPOLINE_SIZE 24 -# endif -# else /* POWERPC || POWERPC_AIX */ -# define FFI_TRAMPOLINE_SIZE 40 -# endif -#endif - -#ifndef LIBFFI_ASM -#if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) -struct ffi_aix_trampoline_struct { - void * code_pointer; /* Pointer to ffi_closure_ASM */ - void * toc; /* TOC */ - void * static_chain; /* Pointer to closure */ -}; -#endif -#endif - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/linux64.S b/llgo/third_party/gofrontend/libffi/src/powerpc/linux64.S deleted file mode 100644 index b2ae60ead6e13b309fd547d6bb84c37518769e06..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/linux64.S +++ /dev/null @@ -1,228 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.h - Copyright (c) 2003 Jakub Jelinek - Copyright (c) 2008 Red Hat, Inc. - - PowerPC64 Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -#ifdef POWERPC64 - .hidden ffi_call_LINUX64 - .globl ffi_call_LINUX64 - .text - .cfi_startproc -# if _CALL_ELF == 2 -ffi_call_LINUX64: - addis %r2, %r12, .TOC.-ffi_call_LINUX64@ha - addi %r2, %r2, .TOC.-ffi_call_LINUX64@l - .localentry ffi_call_LINUX64, . - ffi_call_LINUX64 -# else - .section ".opd","aw" - .align 3 -ffi_call_LINUX64: -# ifdef _CALL_LINUX - .quad .L.ffi_call_LINUX64,.TOC.@tocbase,0 - .type ffi_call_LINUX64,@function - .text -.L.ffi_call_LINUX64: -# else - .hidden .ffi_call_LINUX64 - .globl .ffi_call_LINUX64 - .quad .ffi_call_LINUX64,.TOC.@tocbase,0 - .size ffi_call_LINUX64,24 - .type .ffi_call_LINUX64,@function - .text -.ffi_call_LINUX64: -# endif -# endif - mflr %r0 - std %r28, -32(%r1) - std %r29, -24(%r1) - std %r30, -16(%r1) - std %r31, -8(%r1) - std %r7, 8(%r1) /* closure, saved in cr field. */ - std %r0, 16(%r1) - - mr %r28, %r1 /* our AP. */ - .cfi_def_cfa_register 28 - .cfi_offset 65, 16 - .cfi_offset 31, -8 - .cfi_offset 30, -16 - .cfi_offset 29, -24 - .cfi_offset 28, -32 - - stdux %r1, %r1, %r8 - mr %r31, %r6 /* flags, */ - mr %r30, %r5 /* rvalue, */ - mr %r29, %r4 /* function address. */ -/* Save toc pointer, not for the ffi_prep_args64 call, but for the later - bctrl function call. */ -# if _CALL_ELF == 2 - std %r2, 24(%r1) -# else - std %r2, 40(%r1) -# endif - - /* Call ffi_prep_args64. */ - mr %r4, %r1 -# if defined _CALL_LINUX || _CALL_ELF == 2 - bl ffi_prep_args64 -# else - bl .ffi_prep_args64 -# endif - -# if _CALL_ELF == 2 - mr %r12, %r29 -# else - ld %r12, 0(%r29) - ld %r2, 8(%r29) -# endif - /* Now do the call. */ - /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40, %r31 - - /* Get the address to call into CTR. */ - mtctr %r12 - /* Load all those argument registers. */ - ld %r3, -32-(8*8)(%r28) - ld %r4, -32-(7*8)(%r28) - ld %r5, -32-(6*8)(%r28) - ld %r6, -32-(5*8)(%r28) - bf- 5, 1f - ld %r7, -32-(4*8)(%r28) - ld %r8, -32-(3*8)(%r28) - ld %r9, -32-(2*8)(%r28) - ld %r10, -32-(1*8)(%r28) -1: - - /* Load all the FP registers. */ - bf- 6, 2f - lfd %f1, -32-(21*8)(%r28) - lfd %f2, -32-(20*8)(%r28) - lfd %f3, -32-(19*8)(%r28) - lfd %f4, -32-(18*8)(%r28) - lfd %f5, -32-(17*8)(%r28) - lfd %f6, -32-(16*8)(%r28) - lfd %f7, -32-(15*8)(%r28) - lfd %f8, -32-(14*8)(%r28) - lfd %f9, -32-(13*8)(%r28) - lfd %f10, -32-(12*8)(%r28) - lfd %f11, -32-(11*8)(%r28) - lfd %f12, -32-(10*8)(%r28) - lfd %f13, -32-(9*8)(%r28) -2: - - /* Make the call. */ - ld %r11, 8(%r28) - bctrl - - /* This must follow the call immediately, the unwinder - uses this to find out if r2 has been saved or not. */ -# if _CALL_ELF == 2 - ld %r2, 24(%r1) -# else - ld %r2, 40(%r1) -# endif - - /* Now, deal with the return value. */ - mtcrf 0x01, %r31 - bt 31, .Lstruct_return_value - bt 30, .Ldone_return_value - bt 29, .Lfp_return_value - std %r3, 0(%r30) - /* Fall through... */ - -.Ldone_return_value: - /* Restore the registers we used and return. */ - mr %r1, %r28 - .cfi_def_cfa_register 1 - ld %r0, 16(%r28) - ld %r28, -32(%r28) - mtlr %r0 - ld %r29, -24(%r1) - ld %r30, -16(%r1) - ld %r31, -8(%r1) - blr - -.Lfp_return_value: - .cfi_def_cfa_register 28 - bf 28, .Lfloat_return_value - stfd %f1, 0(%r30) - mtcrf 0x02, %r31 /* cr6 */ - bf 27, .Ldone_return_value - stfd %f2, 8(%r30) - b .Ldone_return_value -.Lfloat_return_value: - stfs %f1, 0(%r30) - b .Ldone_return_value - -.Lstruct_return_value: - bf 29, .Lsmall_struct - bf 28, .Lfloat_homog_return_value - stfd %f1, 0(%r30) - stfd %f2, 8(%r30) - stfd %f3, 16(%r30) - stfd %f4, 24(%r30) - stfd %f5, 32(%r30) - stfd %f6, 40(%r30) - stfd %f7, 48(%r30) - stfd %f8, 56(%r30) - b .Ldone_return_value - -.Lfloat_homog_return_value: - stfs %f1, 0(%r30) - stfs %f2, 4(%r30) - stfs %f3, 8(%r30) - stfs %f4, 12(%r30) - stfs %f5, 16(%r30) - stfs %f6, 20(%r30) - stfs %f7, 24(%r30) - stfs %f8, 28(%r30) - b .Ldone_return_value - -.Lsmall_struct: - std %r3, 0(%r30) - std %r4, 8(%r30) - b .Ldone_return_value - - .cfi_endproc -# if _CALL_ELF == 2 - .size ffi_call_LINUX64,.-ffi_call_LINUX64 -# else -# ifdef _CALL_LINUX - .size ffi_call_LINUX64,.-.L.ffi_call_LINUX64 -# else - .long 0 - .byte 0,12,0,1,128,4,0,0 - .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 -# endif -# endif - -#endif - -#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/linux64_closure.S b/llgo/third_party/gofrontend/libffi/src/powerpc/linux64_closure.S deleted file mode 100644 index 6487d2a2970a11a6d71d8b2759a0b490d194ba87..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/linux64_closure.S +++ /dev/null @@ -1,488 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.h - Copyright (c) 2003 Jakub Jelinek - Copyright (c) 2008 Red Hat, Inc. - - PowerPC64 Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ -#define LIBFFI_ASM -#include -#include - - .file "linux64_closure.S" - -#ifdef POWERPC64 - FFI_HIDDEN (ffi_closure_LINUX64) - .globl ffi_closure_LINUX64 - .text - .cfi_startproc -# if _CALL_ELF == 2 -ffi_closure_LINUX64: - addis %r2, %r12, .TOC.-ffi_closure_LINUX64@ha - addi %r2, %r2, .TOC.-ffi_closure_LINUX64@l - .localentry ffi_closure_LINUX64, . - ffi_closure_LINUX64 -# else - .section ".opd","aw" - .align 3 -ffi_closure_LINUX64: -# ifdef _CALL_LINUX - .quad .L.ffi_closure_LINUX64,.TOC.@tocbase,0 - .type ffi_closure_LINUX64,@function - .text -.L.ffi_closure_LINUX64: -# else - FFI_HIDDEN (.ffi_closure_LINUX64) - .globl .ffi_closure_LINUX64 - .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 - .size ffi_closure_LINUX64,24 - .type .ffi_closure_LINUX64,@function - .text -.ffi_closure_LINUX64: -# endif -# endif - -# if _CALL_ELF == 2 -# 32 byte special reg save area + 64 byte parm save area -# + 64 byte retval area + 13*8 fpr save area + round to 16 -# define STACKFRAME 272 -# define PARMSAVE 32 -# define RETVAL PARMSAVE+64 -# else -# 48 bytes special reg save area + 64 bytes parm save area -# + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 -# define STACKFRAME 240 -# define PARMSAVE 48 -# define RETVAL PARMSAVE+64 -# endif - -# if _CALL_ELF == 2 - ld %r12, FFI_TRAMPOLINE_SIZE(%r11) # closure->cif - mflr %r0 - lwz %r12, 28(%r12) # cif->flags - mtcrf 0x40, %r12 - addi %r12, %r1, PARMSAVE - bt 7, 0f - # Our caller has not allocated a parameter save area. - # We need to allocate one here and use it to pass gprs to - # ffi_closure_helper_LINUX64. - addi %r12, %r1, -STACKFRAME+PARMSAVE -0: - # Save general regs into parm save area - std %r3, 0(%r12) - std %r4, 8(%r12) - std %r5, 16(%r12) - std %r6, 24(%r12) - std %r7, 32(%r12) - std %r8, 40(%r12) - std %r9, 48(%r12) - std %r10, 56(%r12) - - # load up the pointer to the parm save area - mr %r7, %r12 -# else - # copy r2 to r11 and load TOC into r2 - mr %r11, %r2 - ld %r2, 16(%r2) - - mflr %r0 - # Save general regs into parm save area - # This is the parameter save area set up by our caller. - std %r3, PARMSAVE+0(%r1) - std %r4, PARMSAVE+8(%r1) - std %r5, PARMSAVE+16(%r1) - std %r6, PARMSAVE+24(%r1) - std %r7, PARMSAVE+32(%r1) - std %r8, PARMSAVE+40(%r1) - std %r9, PARMSAVE+48(%r1) - std %r10, PARMSAVE+56(%r1) - - # load up the pointer to the parm save area - addi %r7, %r1, PARMSAVE -# endif - std %r0, 16(%r1) - - # closure->cif - ld %r3, FFI_TRAMPOLINE_SIZE(%r11) - # closure->fun - ld %r4, FFI_TRAMPOLINE_SIZE+8(%r11) - # closure->user_data - ld %r5, FFI_TRAMPOLINE_SIZE+16(%r11) - -.Ldoclosure: - # next save fpr 1 to fpr 13 - stfd %f1, -104+(0*8)(%r1) - stfd %f2, -104+(1*8)(%r1) - stfd %f3, -104+(2*8)(%r1) - stfd %f4, -104+(3*8)(%r1) - stfd %f5, -104+(4*8)(%r1) - stfd %f6, -104+(5*8)(%r1) - stfd %f7, -104+(6*8)(%r1) - stfd %f8, -104+(7*8)(%r1) - stfd %f9, -104+(8*8)(%r1) - stfd %f10, -104+(9*8)(%r1) - stfd %f11, -104+(10*8)(%r1) - stfd %f12, -104+(11*8)(%r1) - stfd %f13, -104+(12*8)(%r1) - - # load up the pointer to the saved fpr registers */ - addi %r8, %r1, -104 - - # load up the pointer to the result storage - addi %r6, %r1, -STACKFRAME+RETVAL - - stdu %r1, -STACKFRAME(%r1) - .cfi_def_cfa_offset STACKFRAME - .cfi_offset 65, 16 - - # make the call -# if defined _CALL_LINUX || _CALL_ELF == 2 - bl ffi_closure_helper_LINUX64 -# else - bl .ffi_closure_helper_LINUX64 -# endif -.Lret: - - # now r3 contains the return type - # so use it to look up in a table - # so we know how to deal with each type - - # look up the proper starting point in table - # by using return type as offset - ld %r0, STACKFRAME+16(%r1) - cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT - bge .Lsmall - mflr %r4 # move address of .Lret to r4 - sldi %r3, %r3, 4 # now multiply return type by 16 - addi %r4, %r4, .Lret_type0 - .Lret - add %r3, %r3, %r4 # add contents of table to table address - mtctr %r3 - bctr # jump to it - -# Each of the ret_typeX code fragments has to be exactly 16 bytes long -# (4 instructions). For cache effectiveness we align to a 16 byte boundary -# first. - .align 4 - -.Lret_type0: -# case FFI_TYPE_VOID - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME - nop -# case FFI_TYPE_INT -# ifdef __LITTLE_ENDIAN__ - lwa %r3, RETVAL+0(%r1) -# else - lwa %r3, RETVAL+4(%r1) -# endif - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_FLOAT - lfs %f1, RETVAL+0(%r1) - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_DOUBLE - lfd %f1, RETVAL+0(%r1) - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_LONGDOUBLE - lfd %f1, RETVAL+0(%r1) - mtlr %r0 - lfd %f2, RETVAL+8(%r1) - b .Lfinish -# case FFI_TYPE_UINT8 -# ifdef __LITTLE_ENDIAN__ - lbz %r3, RETVAL+0(%r1) -# else - lbz %r3, RETVAL+7(%r1) -# endif - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_SINT8 -# ifdef __LITTLE_ENDIAN__ - lbz %r3, RETVAL+0(%r1) -# else - lbz %r3, RETVAL+7(%r1) -# endif - extsb %r3,%r3 - mtlr %r0 - b .Lfinish -# case FFI_TYPE_UINT16 -# ifdef __LITTLE_ENDIAN__ - lhz %r3, RETVAL+0(%r1) -# else - lhz %r3, RETVAL+6(%r1) -# endif - mtlr %r0 -.Lfinish: - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_SINT16 -# ifdef __LITTLE_ENDIAN__ - lha %r3, RETVAL+0(%r1) -# else - lha %r3, RETVAL+6(%r1) -# endif - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_UINT32 -# ifdef __LITTLE_ENDIAN__ - lwz %r3, RETVAL+0(%r1) -# else - lwz %r3, RETVAL+4(%r1) -# endif - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_SINT32 -# ifdef __LITTLE_ENDIAN__ - lwa %r3, RETVAL+0(%r1) -# else - lwa %r3, RETVAL+4(%r1) -# endif - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_UINT64 - ld %r3, RETVAL+0(%r1) - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_SINT64 - ld %r3, RETVAL+0(%r1) - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_TYPE_STRUCT - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME - nop -# case FFI_TYPE_POINTER - ld %r3, RETVAL+0(%r1) - mtlr %r0 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -# case FFI_V2_TYPE_FLOAT_HOMOG - lfs %f1, RETVAL+0(%r1) - lfs %f2, RETVAL+4(%r1) - lfs %f3, RETVAL+8(%r1) - b .Lmorefloat -# case FFI_V2_TYPE_DOUBLE_HOMOG - lfd %f1, RETVAL+0(%r1) - lfd %f2, RETVAL+8(%r1) - lfd %f3, RETVAL+16(%r1) - lfd %f4, RETVAL+24(%r1) - mtlr %r0 - lfd %f5, RETVAL+32(%r1) - lfd %f6, RETVAL+40(%r1) - lfd %f7, RETVAL+48(%r1) - lfd %f8, RETVAL+56(%r1) - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -.Lmorefloat: - lfs %f4, RETVAL+12(%r1) - mtlr %r0 - lfs %f5, RETVAL+16(%r1) - lfs %f6, RETVAL+20(%r1) - lfs %f7, RETVAL+24(%r1) - lfs %f8, RETVAL+28(%r1) - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -.Lsmall: -# ifdef __LITTLE_ENDIAN__ - ld %r3,RETVAL+0(%r1) - mtlr %r0 - ld %r4,RETVAL+8(%r1) - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr -# else - # A struct smaller than a dword is returned in the low bits of r3 - # ie. right justified. Larger structs are passed left justified - # in r3 and r4. The return value area on the stack will have - # the structs as they are usually stored in memory. - cmpldi %r3, FFI_V2_TYPE_SMALL_STRUCT + 7 # size 8 bytes? - neg %r5, %r3 - ld %r3,RETVAL+0(%r1) - blt .Lsmalldown - mtlr %r0 - ld %r4,RETVAL+8(%r1) - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset STACKFRAME -.Lsmalldown: - addi %r5, %r5, FFI_V2_TYPE_SMALL_STRUCT + 7 - mtlr %r0 - sldi %r5, %r5, 3 - addi %r1, %r1, STACKFRAME - .cfi_def_cfa_offset 0 - srd %r3, %r3, %r5 - blr -# endif - - .cfi_endproc -# if _CALL_ELF == 2 - .size ffi_closure_LINUX64,.-ffi_closure_LINUX64 -# else -# ifdef _CALL_LINUX - .size ffi_closure_LINUX64,.-.L.ffi_closure_LINUX64 -# else - .long 0 - .byte 0,12,0,1,128,0,0,0 - .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 -# endif -# endif - - - FFI_HIDDEN (ffi_go_closure_linux64) - .globl ffi_go_closure_linux64 - .text - .cfi_startproc -# if _CALL_ELF == 2 -ffi_go_closure_linux64: - addis %r2, %r12, .TOC.-ffi_go_closure_linux64@ha - addi %r2, %r2, .TOC.-ffi_go_closure_linux64@l - .localentry ffi_go_closure_linux64, . - ffi_go_closure_linux64 -# else - .section ".opd","aw" - .align 3 -ffi_go_closure_linux64: -# ifdef _CALL_LINUX - .quad .L.ffi_go_closure_linux64,.TOC.@tocbase,0 - .type ffi_go_closure_linux64,@function - .text -.L.ffi_go_closure_linux64: -# else - FFI_HIDDEN (.ffi_go_closure_linux64) - .globl .ffi_go_closure_linux64 - .quad .ffi_go_closure_linux64,.TOC.@tocbase,0 - .size ffi_go_closure_linux64,24 - .type .ffi_go_closure_linux64,@function - .text -.ffi_go_closure_linux64: -# endif -# endif - -# if _CALL_ELF == 2 - ld %r12, 8(%r11) # closure->cif - mflr %r0 - lwz %r12, 28(%r12) # cif->flags - mtcrf 0x40, %r12 - addi %r12, %r1, PARMSAVE - bt 7, 0f - # Our caller has not allocated a parameter save area. - # We need to allocate one here and use it to pass gprs to - # ffi_closure_helper_LINUX64. - addi %r12, %r1, -STACKFRAME+PARMSAVE -0: - # Save general regs into parm save area - std %r3, 0(%r12) - std %r4, 8(%r12) - std %r5, 16(%r12) - std %r6, 24(%r12) - std %r7, 32(%r12) - std %r8, 40(%r12) - std %r9, 48(%r12) - std %r10, 56(%r12) - - # load up the pointer to the parm save area - mr %r7, %r12 -# else - mflr %r0 - # Save general regs into parm save area - # This is the parameter save area set up by our caller. - std %r3, PARMSAVE+0(%r1) - std %r4, PARMSAVE+8(%r1) - std %r5, PARMSAVE+16(%r1) - std %r6, PARMSAVE+24(%r1) - std %r7, PARMSAVE+32(%r1) - std %r8, PARMSAVE+40(%r1) - std %r9, PARMSAVE+48(%r1) - std %r10, PARMSAVE+56(%r1) - - # load up the pointer to the parm save area - addi %r7, %r1, PARMSAVE -# endif - std %r0, 16(%r1) - - # closure->cif - ld %r3, 8(%r11) - # closure->fun - ld %r4, 16(%r11) - # user_data - mr %r5, %r11 - b .Ldoclosure - - .cfi_endproc -# if _CALL_ELF == 2 - .size ffi_go_closure_linux64,.-ffi_go_closure_linux64 -# else -# ifdef _CALL_LINUX - .size ffi_go_closure_linux64,.-.L.ffi_go_closure_linux64 -# else - .long 0 - .byte 0,12,0,1,128,0,0,0 - .size .ffi_go_closure_linux64,.-.ffi_go_closure_linux64 -# endif -# endif -#endif - -#if (defined __ELF__ && defined __linux__) || _CALL_ELF == 2 - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/ppc_closure.S b/llgo/third_party/gofrontend/libffi/src/powerpc/ppc_closure.S deleted file mode 100644 index b6d209de8635c59f06767ac7f1da083816ceea76..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/ppc_closure.S +++ /dev/null @@ -1,397 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.h - Copyright (c) 2003 Jakub Jelinek - Copyright (c) 2008 Red Hat, Inc. - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ -#define LIBFFI_ASM -#include -#include -#include - - .file "ppc_closure.S" - -#ifndef POWERPC64 - -FFI_HIDDEN(ffi_closure_SYSV) -ENTRY(ffi_closure_SYSV) - .cfi_startproc - stwu %r1,-144(%r1) - .cfi_def_cfa_offset 144 - mflr %r0 - stw %r0,148(%r1) - .cfi_offset 65, 4 - -# we want to build up an areas for the parameters passed -# in registers (both floating point and integer) - - # so first save gpr 3 to gpr 10 (aligned to 4) - stw %r3, 16(%r1) - stw %r4, 20(%r1) - stw %r5, 24(%r1) - - # set up registers for the routine that does the work - - # closure->cif - lwz %r3,FFI_TRAMPOLINE_SIZE(%r11) - # closure->fun - lwz %r4,FFI_TRAMPOLINE_SIZE+4(%r11) - # closure->user_data - lwz %r5,FFI_TRAMPOLINE_SIZE+8(%r11) - -.Ldoclosure: - stw %r6, 28(%r1) - stw %r7, 32(%r1) - stw %r8, 36(%r1) - stw %r9, 40(%r1) - stw %r10,44(%r1) - -#ifndef __NO_FPRS__ - # next save fpr 1 to fpr 8 (aligned to 8) - stfd %f1, 48(%r1) - stfd %f2, 56(%r1) - stfd %f3, 64(%r1) - stfd %f4, 72(%r1) - stfd %f5, 80(%r1) - stfd %f6, 88(%r1) - stfd %f7, 96(%r1) - stfd %f8, 104(%r1) -#endif - - # pointer to the result storage - addi %r6,%r1,112 - - # pointer to the saved gpr registers - addi %r7,%r1,16 - - # pointer to the saved fpr registers - addi %r8,%r1,48 - - # pointer to the outgoing parameter save area in the previous frame - # i.e. the previous frame pointer + 8 - addi %r9,%r1,152 - - # make the call - bl ffi_closure_helper_SYSV@local -.Lret: - # now r3 contains the return type - # so use it to look up in a table - # so we know how to deal with each type - - # look up the proper starting point in table - # by using return type as offset - - mflr %r4 # move address of .Lret to r4 - slwi %r3,%r3,4 # now multiply return type by 16 - addi %r4, %r4, .Lret_type0 - .Lret - lwz %r0,148(%r1) - add %r3,%r3,%r4 # add contents of table to table address - mtctr %r3 - bctr # jump to it - -# Each of the ret_typeX code fragments has to be exactly 16 bytes long -# (4 instructions). For cache effectiveness we align to a 16 byte boundary -# first. - .align 4 -# case FFI_TYPE_VOID -.Lret_type0: - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - nop - -# case FFI_TYPE_INT - lwz %r3,112+0(%r1) - mtlr %r0 -.Lfinish: - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_FLOAT -#ifndef __NO_FPRS__ - lfs %f1,112+0(%r1) -#else - nop -#endif - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_DOUBLE -#ifndef __NO_FPRS__ - lfd %f1,112+0(%r1) -#else - nop -#endif - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_LONGDOUBLE -#ifndef __NO_FPRS__ - lfd %f1,112+0(%r1) - lfd %f2,112+8(%r1) - mtlr %r0 - b .Lfinish -#else - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - nop -#endif - -# case FFI_TYPE_UINT8 -#ifdef __LITTLE_ENDIAN__ - lbz %r3,112+0(%r1) -#else - lbz %r3,112+3(%r1) -#endif - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_SINT8 -#ifdef __LITTLE_ENDIAN__ - lbz %r3,112+0(%r1) -#else - lbz %r3,112+3(%r1) -#endif - extsb %r3,%r3 - mtlr %r0 - b .Lfinish - -# case FFI_TYPE_UINT16 -#ifdef __LITTLE_ENDIAN__ - lhz %r3,112+0(%r1) -#else - lhz %r3,112+2(%r1) -#endif - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_SINT16 -#ifdef __LITTLE_ENDIAN__ - lha %r3,112+0(%r1) -#else - lha %r3,112+2(%r1) -#endif - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_UINT32 - lwz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_SINT32 - lwz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_UINT64 - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) - mtlr %r0 - b .Lfinish - -# case FFI_TYPE_SINT64 - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) - mtlr %r0 - b .Lfinish - -# case FFI_TYPE_STRUCT - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - nop - -# case FFI_TYPE_POINTER - lwz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_TYPE_UINT128 - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) - lwz %r5,112+8(%r1) - b .Luint128 - -# The return types below are only used when the ABI type is FFI_SYSV. -# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. - lbz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct. - lhz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct. - lwz %r3,112+0(%r1) -#ifdef __LITTLE_ENDIAN__ - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 -#else - srwi %r3,%r3,8 - mtlr %r0 - b .Lfinish -#endif - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct. - lwz %r3,112+0(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct. - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) -#ifdef __LITTLE_ENDIAN__ - mtlr %r0 - b .Lfinish -#else - li %r5,24 - b .Lstruct567 -#endif - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct. - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) -#ifdef __LITTLE_ENDIAN__ - mtlr %r0 - b .Lfinish -#else - li %r5,16 - b .Lstruct567 -#endif - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct. - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) -#ifdef __LITTLE_ENDIAN__ - mtlr %r0 - b .Lfinish -#else - li %r5,8 - b .Lstruct567 -#endif - -# case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct. - lwz %r3,112+0(%r1) - lwz %r4,112+4(%r1) - mtlr %r0 - b .Lfinish - -#ifndef __LITTLE_ENDIAN__ -.Lstruct567: - subfic %r6,%r5,32 - srw %r4,%r4,%r5 - slw %r6,%r3,%r6 - srw %r3,%r3,%r5 - or %r4,%r6,%r4 - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_def_cfa_offset 144 -#endif - -.Luint128: - lwz %r6,112+12(%r1) - mtlr %r0 - addi %r1,%r1,144 - .cfi_def_cfa_offset 0 - blr - .cfi_endproc -END(ffi_closure_SYSV) - - -FFI_HIDDEN(ffi_go_closure_sysv) -ENTRY(ffi_go_closure_sysv) - .cfi_startproc - stwu %r1,-144(%r1) - .cfi_def_cfa_offset 144 - mflr %r0 - stw %r0,148(%r1) - .cfi_offset 65, 4 - - stw %r3, 16(%r1) - stw %r4, 20(%r1) - stw %r5, 24(%r1) - - # closure->cif - lwz %r3,4(%r11) - # closure->fun - lwz %r4,8(%r11) - # user_data - mr %r5,%r11 - b .Ldoclosure - .cfi_endproc -END(ffi_go_closure_sysv) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/powerpc/sysv.S b/llgo/third_party/gofrontend/libffi/src/powerpc/sysv.S deleted file mode 100644 index 1474ce702b388e19f67890111a0a6ede27330669..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/powerpc/sysv.S +++ /dev/null @@ -1,175 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 1998 Geoffrey Keating - Copyright (C) 2007 Free Software Foundation, Inc - - PowerPC Assembly glue. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include - -#ifndef POWERPC64 -FFI_HIDDEN(ffi_call_SYSV) -ENTRY(ffi_call_SYSV) - .cfi_startproc - /* Save the old stack pointer as AP. */ - mr %r10,%r1 - .cfi_def_cfa_register 10 - - /* Allocate the stack space we need. */ - stwux %r1,%r1,%r8 - /* Save registers we use. */ - mflr %r9 - stw %r28,-16(%r10) - stw %r29,-12(%r10) - stw %r30, -8(%r10) - stw %r31, -4(%r10) - stw %r9, 4(%r10) - .cfi_offset 65, 4 - .cfi_offset 31, -4 - .cfi_offset 30, -8 - .cfi_offset 29, -12 - .cfi_offset 28, -16 - - /* Save arguments over call... */ - stw %r7, -20(%r10) /* closure, */ - mr %r31,%r6 /* flags, */ - mr %r30,%r5 /* rvalue, */ - mr %r29,%r4 /* function address, */ - mr %r28,%r10 /* our AP. */ - .cfi_def_cfa_register 28 - - /* Call ffi_prep_args_SYSV. */ - mr %r4,%r1 - bl ffi_prep_args_SYSV@local - - /* Now do the call. */ - /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40,%r31 - /* Get the address to call into CTR. */ - mtctr %r29 - /* Load all those argument registers. */ - lwz %r3,-24-(8*4)(%r28) - lwz %r4,-24-(7*4)(%r28) - lwz %r5,-24-(6*4)(%r28) - lwz %r6,-24-(5*4)(%r28) - bf- 5,1f - nop - lwz %r7,-24-(4*4)(%r28) - lwz %r8,-24-(3*4)(%r28) - lwz %r9,-24-(2*4)(%r28) - lwz %r10,-24-(1*4)(%r28) - nop -1: - -#ifndef __NO_FPRS__ - /* Load all the FP registers. */ - bf- 6,2f - lfd %f1,-24-(8*4)-(8*8)(%r28) - lfd %f2,-24-(8*4)-(7*8)(%r28) - lfd %f3,-24-(8*4)-(6*8)(%r28) - lfd %f4,-24-(8*4)-(5*8)(%r28) - nop - lfd %f5,-24-(8*4)-(4*8)(%r28) - lfd %f6,-24-(8*4)-(3*8)(%r28) - lfd %f7,-24-(8*4)-(2*8)(%r28) - lfd %f8,-24-(8*4)-(1*8)(%r28) -#endif -2: - - /* Make the call. */ - lwz %r11, -20(%r28) - bctrl - - /* Now, deal with the return value. */ - mtcrf 0x01,%r31 /* cr7 */ - bt- 31,L(small_struct_return_value) - bt- 30,L(done_return_value) -#ifndef __NO_FPRS__ - bt- 29,L(fp_return_value) -#endif - stw %r3,0(%r30) - bf+ 28,L(done_return_value) - stw %r4,4(%r30) - mtcrf 0x02,%r31 /* cr6 */ - bf 27,L(done_return_value) - stw %r5,8(%r30) - stw %r6,12(%r30) - /* Fall through... */ - -L(done_return_value): - /* Restore the registers we used and return. */ - lwz %r9, 4(%r28) - lwz %r31, -4(%r28) - mtlr %r9 - lwz %r30, -8(%r28) - lwz %r29,-12(%r28) - lwz %r28,-16(%r28) - .cfi_remember_state - /* At this point we don't have a cfa register. Say all our - saved regs have been restored. */ - .cfi_same_value 65 - .cfi_same_value 31 - .cfi_same_value 30 - .cfi_same_value 29 - .cfi_same_value 28 - /* Hopefully this works.. */ - .cfi_def_cfa_register 1 - .cfi_offset 1, 0 - lwz %r1,0(%r1) - .cfi_same_value 1 - blr - -#ifndef __NO_FPRS__ -L(fp_return_value): - .cfi_restore_state - bf 28,L(float_return_value) - stfd %f1,0(%r30) - mtcrf 0x02,%r31 /* cr6 */ - bf 27,L(done_return_value) - stfd %f2,8(%r30) - b L(done_return_value) -L(float_return_value): - stfs %f1,0(%r30) - b L(done_return_value) -#endif - -L(small_struct_return_value): - /* - * The C code always allocates a properly-aligned 8-byte bounce - * buffer to make this assembly code very simple. Just write out - * r3 and r4 to the buffer to allow the C code to handle the rest. - */ - stw %r3, 0(%r30) - stw %r4, 4(%r30) - b L(done_return_value) - .cfi_endproc - -END(ffi_call_SYSV) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/prep_cif.c b/llgo/third_party/gofrontend/libffi/src/prep_cif.c deleted file mode 100644 index 5881cebd784c2bcf4c59a6ed822d84e1733b5610..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/prep_cif.c +++ /dev/null @@ -1,242 +0,0 @@ -/* ----------------------------------------------------------------------- - prep_cif.c - Copyright (c) 2011, 2012 Anthony Green - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include - -/* Round up to FFI_SIZEOF_ARG. */ - -#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) - -/* Perform machine independent initialization of aggregate type - specifications. */ - -static ffi_status initialize_aggregate(ffi_type *arg) -{ - ffi_type **ptr; - - if (UNLIKELY(arg == NULL || arg->elements == NULL)) - return FFI_BAD_TYPEDEF; - - arg->size = 0; - arg->alignment = 0; - - ptr = &(arg->elements[0]); - - if (UNLIKELY(ptr == 0)) - return FFI_BAD_TYPEDEF; - - while ((*ptr) != NULL) - { - if (UNLIKELY(((*ptr)->size == 0) - && (initialize_aggregate((*ptr)) != FFI_OK))) - return FFI_BAD_TYPEDEF; - - /* Perform a sanity check on the argument type */ - FFI_ASSERT_VALID_TYPE(*ptr); - - arg->size = ALIGN(arg->size, (*ptr)->alignment); - arg->size += (*ptr)->size; - - arg->alignment = (arg->alignment > (*ptr)->alignment) ? - arg->alignment : (*ptr)->alignment; - - ptr++; - } - - /* Structure size includes tail padding. This is important for - structures that fit in one register on ABIs like the PowerPC64 - Linux ABI that right justify small structs in a register. - It's also needed for nested structure layout, for example - struct A { long a; char b; }; struct B { struct A x; char y; }; - should find y at an offset of 2*sizeof(long) and result in a - total size of 3*sizeof(long). */ - arg->size = ALIGN (arg->size, arg->alignment); - - /* On some targets, the ABI defines that structures have an additional - alignment beyond the "natural" one based on their elements. */ -#ifdef FFI_AGGREGATE_ALIGNMENT - if (FFI_AGGREGATE_ALIGNMENT > arg->alignment) - arg->alignment = FFI_AGGREGATE_ALIGNMENT; -#endif - - if (arg->size == 0) - return FFI_BAD_TYPEDEF; - else - return FFI_OK; -} - -#ifndef __CRIS__ -/* The CRIS ABI specifies structure elements to have byte - alignment only, so it completely overrides this functions, - which assumes "natural" alignment and padding. */ - -/* Perform machine independent ffi_cif preparation, then call - machine dependent routine. */ - -/* For non variadic functions isvariadic should be 0 and - nfixedargs==ntotalargs. - - For variadic calls, isvariadic should be 1 and nfixedargs - and ntotalargs set as appropriate. nfixedargs must always be >=1 */ - - -ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, - unsigned int isvariadic, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, ffi_type **atypes) -{ - unsigned bytes = 0; - unsigned int i; - ffi_type **ptr; - - FFI_ASSERT(cif != NULL); - FFI_ASSERT((!isvariadic) || (nfixedargs >= 1)); - FFI_ASSERT(nfixedargs <= ntotalargs); - - if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) - return FFI_BAD_ABI; - - cif->abi = abi; - cif->arg_types = atypes; - cif->nargs = ntotalargs; - cif->rtype = rtype; - - cif->flags = 0; - -#if HAVE_LONG_DOUBLE_VARIANT - ffi_prep_types (abi); -#endif - - /* Initialize the return type if necessary */ - if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) - return FFI_BAD_TYPEDEF; - -#ifndef FFI_TARGET_HAS_COMPLEX_TYPE - if (rtype->type == FFI_TYPE_COMPLEX) - abort(); -#endif - /* Perform a sanity check on the return type */ - FFI_ASSERT_VALID_TYPE(cif->rtype); - - /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ -#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION - /* Make space for the return structure pointer */ - if (cif->rtype->type == FFI_TYPE_STRUCT -#ifdef TILE - && (cif->rtype->size > 10 * FFI_SIZEOF_ARG) -#endif -#ifdef XTENSA - && (cif->rtype->size > 16) -#endif -#ifdef NIOS2 - && (cif->rtype->size > 8) -#endif - ) - bytes = STACK_ARG_SIZE(sizeof(void*)); -#endif - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - - /* Initialize any uninitialized aggregate type definitions */ - if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) - return FFI_BAD_TYPEDEF; - -#ifndef FFI_TARGET_HAS_COMPLEX_TYPE - if ((*ptr)->type == FFI_TYPE_COMPLEX) - abort(); -#endif - /* Perform a sanity check on the argument type, do this - check after the initialization. */ - FFI_ASSERT_VALID_TYPE(*ptr); - -#if !defined FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION - { - /* Add any padding if necessary */ - if (((*ptr)->alignment - 1) & bytes) - bytes = (unsigned)ALIGN(bytes, (*ptr)->alignment); - -#ifdef TILE - if (bytes < 10 * FFI_SIZEOF_ARG && - bytes + STACK_ARG_SIZE((*ptr)->size) > 10 * FFI_SIZEOF_ARG) - { - /* An argument is never split between the 10 parameter - registers and the stack. */ - bytes = 10 * FFI_SIZEOF_ARG; - } -#endif -#ifdef XTENSA - if (bytes <= 6*4 && bytes + STACK_ARG_SIZE((*ptr)->size) > 6*4) - bytes = 6*4; -#endif - - bytes += STACK_ARG_SIZE((*ptr)->size); - } -#endif - } - - cif->bytes = bytes; - - /* Perform machine dependent cif processing */ -#ifdef FFI_TARGET_SPECIFIC_VARIADIC - if (isvariadic) - return ffi_prep_cif_machdep_var(cif, nfixedargs, ntotalargs); -#endif - - return ffi_prep_cif_machdep(cif); -} -#endif /* not __CRIS__ */ - -ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, - ffi_type *rtype, ffi_type **atypes) -{ - return ffi_prep_cif_core(cif, abi, 0, nargs, nargs, rtype, atypes); -} - -ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes) -{ - return ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); -} - -#if FFI_CLOSURES - -ffi_status -ffi_prep_closure (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data) -{ - return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); -} - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/raw_api.c b/llgo/third_party/gofrontend/libffi/src/raw_api.c deleted file mode 100644 index 276cb22807a5965d8d9fb0eca7bfaa204daf6390..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/raw_api.c +++ /dev/null @@ -1,267 +0,0 @@ -/* ----------------------------------------------------------------------- - raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. - - Author: Kresten Krab Thorup - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -/* This file defines generic functions for use with the raw api. */ - -#include -#include - -#if !FFI_NO_RAW_API - -size_t -ffi_raw_size (ffi_cif *cif) -{ - size_t result = 0; - int i; - - ffi_type **at = cif->arg_types; - - for (i = cif->nargs-1; i >= 0; i--, at++) - { -#if !FFI_NO_STRUCTS - if ((*at)->type == FFI_TYPE_STRUCT) - result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); - else -#endif - result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); - } - - return result; -} - - -void -ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) -{ - unsigned i; - ffi_type **tp = cif->arg_types; - -#if WORDS_BIGENDIAN - - for (i = 0; i < cif->nargs; i++, tp++, args++) - { - switch ((*tp)->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); - break; - - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); - break; - -#if FFI_SIZEOF_ARG >= 4 - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); - break; -#endif - -#if !FFI_NO_STRUCTS - case FFI_TYPE_STRUCT: - *args = (raw++)->ptr; - break; -#endif - - case FFI_TYPE_COMPLEX: - *args = (raw++)->ptr; - break; - - case FFI_TYPE_POINTER: - *args = (void*) &(raw++)->ptr; - break; - - default: - *args = raw; - raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - } - } - -#else /* WORDS_BIGENDIAN */ - -#if !PDP - - /* then assume little endian */ - for (i = 0; i < cif->nargs; i++, tp++, args++) - { -#if !FFI_NO_STRUCTS - if ((*tp)->type == FFI_TYPE_STRUCT) - { - *args = (raw++)->ptr; - } - else -#endif - if ((*tp)->type == FFI_TYPE_COMPLEX) - { - *args = (raw++)->ptr; - } - else - { - *args = (void*) raw; - raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); - } - } - -#else -#error "pdp endian not supported" -#endif /* ! PDP */ - -#endif /* WORDS_BIGENDIAN */ -} - -void -ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) -{ - unsigned i; - ffi_type **tp = cif->arg_types; - - for (i = 0; i < cif->nargs; i++, tp++, args++) - { - switch ((*tp)->type) - { - case FFI_TYPE_UINT8: - (raw++)->uint = *(UINT8*) (*args); - break; - - case FFI_TYPE_SINT8: - (raw++)->sint = *(SINT8*) (*args); - break; - - case FFI_TYPE_UINT16: - (raw++)->uint = *(UINT16*) (*args); - break; - - case FFI_TYPE_SINT16: - (raw++)->sint = *(SINT16*) (*args); - break; - -#if FFI_SIZEOF_ARG >= 4 - case FFI_TYPE_UINT32: - (raw++)->uint = *(UINT32*) (*args); - break; - - case FFI_TYPE_SINT32: - (raw++)->sint = *(SINT32*) (*args); - break; -#endif - -#if !FFI_NO_STRUCTS - case FFI_TYPE_STRUCT: - (raw++)->ptr = *args; - break; -#endif - - case FFI_TYPE_COMPLEX: - (raw++)->ptr = *args; - break; - - case FFI_TYPE_POINTER: - (raw++)->ptr = **(void***) args; - break; - - default: - memcpy ((void*) raw->data, (void*)*args, (*tp)->size); - raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; - } - } -} - -#if !FFI_NATIVE_RAW_API - - -/* This is a generic definition of ffi_raw_call, to be used if the - * native system does not provide a machine-specific implementation. - * Having this, allows code to be written for the raw API, without - * the need for system-specific code to handle input in that format; - * these following couple of functions will handle the translation forth - * and back automatically. */ - -void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) -{ - void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); - ffi_raw_to_ptrarray (cif, raw, avalue); - ffi_call (cif, fn, rvalue, avalue); -} - -#if FFI_CLOSURES /* base system provides closures */ - -static void -ffi_translate_args (ffi_cif *cif, void *rvalue, - void **avalue, void *user_data) -{ - ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); - ffi_raw_closure *cl = (ffi_raw_closure*)user_data; - - ffi_ptrarray_to_raw (cif, avalue, raw); - (*cl->fun) (cif, rvalue, raw, cl->user_data); -} - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure* cl, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc) -{ - ffi_status status; - - status = ffi_prep_closure_loc ((ffi_closure*) cl, - cif, - &ffi_translate_args, - codeloc, - codeloc); - if (status == FFI_OK) - { - cl->fun = fun; - cl->user_data = user_data; - } - - return status; -} - -#endif /* FFI_CLOSURES */ -#endif /* !FFI_NATIVE_RAW_API */ - -#if FFI_CLOSURES - -/* Again, here is the generic version of ffi_prep_raw_closure, which - * will install an intermediate "hub" for translation of arguments from - * the pointer-array format, to the raw format */ - -ffi_status -ffi_prep_raw_closure (ffi_raw_closure* cl, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data) -{ - return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); -} - -#endif /* FFI_CLOSURES */ - -#endif /* !FFI_NO_RAW_API */ diff --git a/llgo/third_party/gofrontend/libffi/src/s390/ffi.c b/llgo/third_party/gofrontend/libffi/src/s390/ffi.c deleted file mode 100644 index 4035b6e366e6655ea263dfcf8df6a678455d1293..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/s390/ffi.c +++ /dev/null @@ -1,756 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2000, 2007 Software AG - Copyright (c) 2008 Red Hat, Inc - - S390 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ -/*====================================================================*/ -/* Includes */ -/* -------- */ -/*====================================================================*/ - -#include -#include -#include -#include "internal.h" - -/*====================== End of Includes =============================*/ - -/*====================================================================*/ -/* Defines */ -/* ------- */ -/*====================================================================*/ - -/* Maximum number of GPRs available for argument passing. */ -#define MAX_GPRARGS 5 - -/* Maximum number of FPRs available for argument passing. */ -#ifdef __s390x__ -#define MAX_FPRARGS 4 -#else -#define MAX_FPRARGS 2 -#endif - -/* Round to multiple of 16. */ -#define ROUND_SIZE(size) (((size) + 15) & ~15) - -/*===================== End of Defines ===============================*/ - -/*====================================================================*/ -/* Externals */ -/* --------- */ -/*====================================================================*/ - -struct call_frame -{ - void *back_chain; - void *eos; - unsigned long gpr_args[5]; - unsigned long gpr_save[9]; - unsigned long long fpr_args[4]; -}; - -extern void FFI_HIDDEN ffi_call_SYSV(struct call_frame *, unsigned, void *, - void (*fn)(void), void *); - -extern void ffi_closure_SYSV(void); -extern void ffi_go_closure_SYSV(void); - -/*====================== End of Externals ============================*/ - -/*====================================================================*/ -/* */ -/* Name - ffi_check_struct_type. */ -/* */ -/* Function - Determine if a structure can be passed within a */ -/* general purpose or floating point register. */ -/* */ -/*====================================================================*/ - -static int -ffi_check_struct_type (ffi_type *arg) -{ - size_t size = arg->size; - - /* If the struct has just one element, look at that element - to find out whether to consider the struct as floating point. */ - while (arg->type == FFI_TYPE_STRUCT - && arg->elements[0] && !arg->elements[1]) - arg = arg->elements[0]; - - /* Structs of size 1, 2, 4, and 8 are passed in registers, - just like the corresponding int/float types. */ - switch (size) - { - case 1: - return FFI_TYPE_UINT8; - - case 2: - return FFI_TYPE_UINT16; - - case 4: - if (arg->type == FFI_TYPE_FLOAT) - return FFI_TYPE_FLOAT; - else - return FFI_TYPE_UINT32; - - case 8: - if (arg->type == FFI_TYPE_DOUBLE) - return FFI_TYPE_DOUBLE; - else - return FFI_TYPE_UINT64; - - default: - break; - } - - /* Other structs are passed via a pointer to the data. */ - return FFI_TYPE_POINTER; -} - -/*======================== End of Routine ============================*/ - -/*====================================================================*/ -/* */ -/* Name - ffi_prep_cif_machdep. */ -/* */ -/* Function - Perform machine dependent CIF processing. */ -/* */ -/*====================================================================*/ - -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep(ffi_cif *cif) -{ - size_t struct_size = 0; - int n_gpr = 0; - int n_fpr = 0; - int n_ov = 0; - - ffi_type **ptr; - int i; - - /* Determine return value handling. */ - - switch (cif->rtype->type) - { - /* Void is easy. */ - case FFI_TYPE_VOID: - cif->flags = FFI390_RET_VOID; - break; - - /* Structures and complex are returned via a hidden pointer. */ - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: - cif->flags = FFI390_RET_STRUCT; - n_gpr++; /* We need one GPR to pass the pointer. */ - break; - - /* Floating point values are returned in fpr 0. */ - case FFI_TYPE_FLOAT: - cif->flags = FFI390_RET_FLOAT; - break; - - case FFI_TYPE_DOUBLE: - cif->flags = FFI390_RET_DOUBLE; - break; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - cif->flags = FFI390_RET_STRUCT; - n_gpr++; - break; -#endif - /* Integer values are returned in gpr 2 (and gpr 3 - for 64-bit values on 31-bit machines). */ - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - cif->flags = FFI390_RET_INT64; - break; - - case FFI_TYPE_POINTER: - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - /* These are to be extended to word size. */ -#ifdef __s390x__ - cif->flags = FFI390_RET_INT64; -#else - cif->flags = FFI390_RET_INT32; -#endif - break; - - default: - FFI_ASSERT (0); - break; - } - - /* Now for the arguments. */ - - for (ptr = cif->arg_types, i = cif->nargs; - i > 0; - i--, ptr++) - { - int type = (*ptr)->type; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - /* 16-byte long double is passed like a struct. */ - if (type == FFI_TYPE_LONGDOUBLE) - type = FFI_TYPE_STRUCT; -#endif - - /* Check how a structure type is passed. */ - if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX) - { - if (type == FFI_TYPE_COMPLEX) - type = FFI_TYPE_POINTER; - else - type = ffi_check_struct_type (*ptr); - - /* If we pass the struct via pointer, we must reserve space - to copy its data for proper call-by-value semantics. */ - if (type == FFI_TYPE_POINTER) - struct_size += ROUND_SIZE ((*ptr)->size); - } - - /* Now handle all primitive int/float data types. */ - switch (type) - { - /* The first MAX_FPRARGS floating point arguments - go in FPRs, the rest overflow to the stack. */ - - case FFI_TYPE_DOUBLE: - if (n_fpr < MAX_FPRARGS) - n_fpr++; - else - n_ov += sizeof (double) / sizeof (long); - break; - - case FFI_TYPE_FLOAT: - if (n_fpr < MAX_FPRARGS) - n_fpr++; - else - n_ov++; - break; - - /* On 31-bit machines, 64-bit integers are passed in GPR pairs, - if one is still available, or else on the stack. If only one - register is free, skip the register (it won't be used for any - subsequent argument either). */ - -#ifndef __s390x__ - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - if (n_gpr == MAX_GPRARGS-1) - n_gpr = MAX_GPRARGS; - if (n_gpr < MAX_GPRARGS) - n_gpr += 2; - else - n_ov += 2; - break; -#endif - - /* Everything else is passed in GPRs (until MAX_GPRARGS - have been used) or overflows to the stack. */ - - default: - if (n_gpr < MAX_GPRARGS) - n_gpr++; - else - n_ov++; - break; - } - } - - /* Total stack space as required for overflow arguments - and temporary structure copies. */ - - cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; - - return FFI_OK; -} - -/*======================== End of Routine ============================*/ - -/*====================================================================*/ -/* */ -/* Name - ffi_call. */ -/* */ -/* Function - Call the FFI routine. */ -/* */ -/*====================================================================*/ - -static void -ffi_call_int(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue, - void *closure) -{ - int ret_type = cif->flags; - size_t rsize = 0, bytes = cif->bytes; - unsigned char *stack, *p_struct; - struct call_frame *frame; - unsigned long *p_ov, *p_gpr; - unsigned long long *p_fpr; - int n_fpr, n_gpr, n_ov, i, n; - ffi_type **arg_types; - - FFI_ASSERT (cif->abi == FFI_SYSV); - - /* If we don't have a return value, we need to fake one. */ - if (rvalue == NULL) - { - if (ret_type & FFI390_RET_IN_MEM) - rsize = cif->rtype->size; - else - ret_type = FFI390_RET_VOID; - } - - /* The stack space will be filled with those areas: - - dummy structure return (highest addresses) - FPR argument register save area - GPR argument register save area - stack frame for ffi_call_SYSV - temporary struct copies - overflow argument area (lowest addresses) - - We set up the following pointers: - - p_fpr: bottom of the FPR area (growing upwards) - p_gpr: bottom of the GPR area (growing upwards) - p_ov: bottom of the overflow area (growing upwards) - p_struct: top of the struct copy area (growing downwards) - - All areas are kept aligned to twice the word size. - - Note that we're going to create the stack frame for both - ffi_call_SYSV _and_ the target function right here. This - works because we don't make any function calls with more - than 5 arguments (indeed only memcpy and ffi_call_SYSV), - and thus we don't have any stacked outgoing parameters. */ - - stack = alloca (bytes + sizeof(struct call_frame) + rsize); - frame = (struct call_frame *)(stack + bytes); - if (rsize) - rvalue = frame + 1; - - /* Link the new frame back to the one from this function. */ - frame->back_chain = __builtin_frame_address (0); - - /* Fill in all of the argument stuff. */ - p_ov = (unsigned long *)stack; - p_struct = (unsigned char *)frame; - p_gpr = frame->gpr_args; - p_fpr = frame->fpr_args; - n_fpr = n_gpr = n_ov = 0; - - /* If we returning a structure then we set the first parameter register - to the address of where we are returning this structure. */ - if (cif->flags & FFI390_RET_IN_MEM) - p_gpr[n_gpr++] = (uintptr_t) rvalue; - - /* Now for the arguments. */ - arg_types = cif->arg_types; - for (i = 0, n = cif->nargs; i < n; ++i) - { - ffi_type *ty = arg_types[i]; - void *arg = avalue[i]; - int type = ty->type; - ffi_arg val; - - restart: - switch (type) - { - case FFI_TYPE_SINT8: - val = *(SINT8 *)arg; - goto do_int; - case FFI_TYPE_UINT8: - val = *(UINT8 *)arg; - goto do_int; - case FFI_TYPE_SINT16: - val = *(SINT16 *)arg; - goto do_int; - case FFI_TYPE_UINT16: - val = *(UINT16 *)arg; - goto do_int; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - val = *(SINT32 *)arg; - goto do_int; - case FFI_TYPE_UINT32: - val = *(UINT32 *)arg; - goto do_int; - case FFI_TYPE_POINTER: - val = *(uintptr_t *)arg; - do_int: - *(n_gpr < MAX_GPRARGS ? p_gpr + n_gpr++ : p_ov + n_ov++) = val; - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#ifdef __s390x__ - val = *(UINT64 *)arg; - goto do_int; -#else - if (n_gpr == MAX_GPRARGS-1) - n_gpr = MAX_GPRARGS; - if (n_gpr < MAX_GPRARGS) - p_gpr[n_gpr++] = ((UINT32 *) arg)[0], - p_gpr[n_gpr++] = ((UINT32 *) arg)[1]; - else - p_ov[n_ov++] = ((UINT32 *) arg)[0], - p_ov[n_ov++] = ((UINT32 *) arg)[1]; -#endif - break; - - case FFI_TYPE_DOUBLE: - if (n_fpr < MAX_FPRARGS) - p_fpr[n_fpr++] = *(UINT64 *) arg; - else - { -#ifdef __s390x__ - p_ov[n_ov++] = *(UINT64 *) arg; -#else - p_ov[n_ov++] = ((UINT32 *) arg)[0], - p_ov[n_ov++] = ((UINT32 *) arg)[1]; -#endif - } - break; - - case FFI_TYPE_FLOAT: - val = *(UINT32 *)arg; - if (n_fpr < MAX_FPRARGS) - p_fpr[n_fpr++] = (UINT64)val << 32; - else - p_ov[n_ov++] = val; - break; - - case FFI_TYPE_STRUCT: - /* Check how a structure type is passed. */ - type = ffi_check_struct_type (ty); - /* Some structures are passed via a type they contain. */ - if (type != FFI_TYPE_POINTER) - goto restart; - /* ... otherwise, passed by reference. fallthru. */ - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - /* 16-byte long double is passed via reference. */ -#endif - case FFI_TYPE_COMPLEX: - /* Complex types are passed via reference. */ - p_struct -= ROUND_SIZE (ty->size); - memcpy (p_struct, arg, ty->size); - val = (uintptr_t)p_struct; - goto do_int; - - default: - FFI_ASSERT (0); - break; - } - } - - ffi_call_SYSV (frame, ret_type & FFI360_RET_MASK, rvalue, fn, closure); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int(cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int(cif, fn, rvalue, avalue, closure); -} - -/*======================== End of Routine ============================*/ - -/*====================================================================*/ -/* */ -/* Name - ffi_closure_helper_SYSV. */ -/* */ -/* Function - Call a FFI closure target function. */ -/* */ -/*====================================================================*/ - -void FFI_HIDDEN -ffi_closure_helper_SYSV (ffi_cif *cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - unsigned long *p_gpr, - unsigned long long *p_fpr, - unsigned long *p_ov) -{ - unsigned long long ret_buffer; - - void *rvalue = &ret_buffer; - void **avalue; - void **p_arg; - - int n_gpr = 0; - int n_fpr = 0; - int n_ov = 0; - - ffi_type **ptr; - int i; - - /* Allocate buffer for argument list pointers. */ - p_arg = avalue = alloca (cif->nargs * sizeof (void *)); - - /* If we returning a structure, pass the structure address - directly to the target function. Otherwise, have the target - function store the return value to the GPR save area. */ - if (cif->flags & FFI390_RET_IN_MEM) - rvalue = (void *) p_gpr[n_gpr++]; - - /* Now for the arguments. */ - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, p_arg++, ptr++) - { - int deref_struct_pointer = 0; - int type = (*ptr)->type; - -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - /* 16-byte long double is passed like a struct. */ - if (type == FFI_TYPE_LONGDOUBLE) - type = FFI_TYPE_STRUCT; -#endif - - /* Check how a structure type is passed. */ - if (type == FFI_TYPE_STRUCT || type == FFI_TYPE_COMPLEX) - { - if (type == FFI_TYPE_COMPLEX) - type = FFI_TYPE_POINTER; - else - type = ffi_check_struct_type (*ptr); - - /* If we pass the struct via pointer, remember to - retrieve the pointer later. */ - if (type == FFI_TYPE_POINTER) - deref_struct_pointer = 1; - } - - /* Pointers are passed like UINTs of the same size. */ - if (type == FFI_TYPE_POINTER) - { -#ifdef __s390x__ - type = FFI_TYPE_UINT64; -#else - type = FFI_TYPE_UINT32; -#endif - } - - /* Now handle all primitive int/float data types. */ - switch (type) - { - case FFI_TYPE_DOUBLE: - if (n_fpr < MAX_FPRARGS) - *p_arg = &p_fpr[n_fpr++]; - else - *p_arg = &p_ov[n_ov], - n_ov += sizeof (double) / sizeof (long); - break; - - case FFI_TYPE_FLOAT: - if (n_fpr < MAX_FPRARGS) - *p_arg = &p_fpr[n_fpr++]; - else - *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#ifdef __s390x__ - if (n_gpr < MAX_GPRARGS) - *p_arg = &p_gpr[n_gpr++]; - else - *p_arg = &p_ov[n_ov++]; -#else - if (n_gpr == MAX_GPRARGS-1) - n_gpr = MAX_GPRARGS; - if (n_gpr < MAX_GPRARGS) - *p_arg = &p_gpr[n_gpr], n_gpr += 2; - else - *p_arg = &p_ov[n_ov], n_ov += 2; -#endif - break; - - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - if (n_gpr < MAX_GPRARGS) - *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4; - else - *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; - break; - - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - if (n_gpr < MAX_GPRARGS) - *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2; - else - *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2; - break; - - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - if (n_gpr < MAX_GPRARGS) - *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1; - else - *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; - break; - - default: - FFI_ASSERT (0); - break; - } - - /* If this is a struct passed via pointer, we need to - actually retrieve that pointer. */ - if (deref_struct_pointer) - *p_arg = *(void **)*p_arg; - } - - - /* Call the target function. */ - (fun) (cif, rvalue, avalue, user_data); - - /* Convert the return value. */ - switch (cif->rtype->type) - { - /* Void is easy, and so is struct. */ - case FFI_TYPE_VOID: - case FFI_TYPE_STRUCT: - case FFI_TYPE_COMPLEX: -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: -#endif - break; - - /* Floating point values are returned in fpr 0. */ - case FFI_TYPE_FLOAT: - p_fpr[0] = (long long) *(unsigned int *) rvalue << 32; - break; - - case FFI_TYPE_DOUBLE: - p_fpr[0] = *(unsigned long long *) rvalue; - break; - - /* Integer values are returned in gpr 2 (and gpr 3 - for 64-bit values on 31-bit machines). */ - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: -#ifdef __s390x__ - p_gpr[0] = *(unsigned long *) rvalue; -#else - p_gpr[0] = ((unsigned long *) rvalue)[0], - p_gpr[1] = ((unsigned long *) rvalue)[1]; -#endif - break; - - case FFI_TYPE_POINTER: - case FFI_TYPE_UINT32: - case FFI_TYPE_UINT16: - case FFI_TYPE_UINT8: - p_gpr[0] = *(unsigned long *) rvalue; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_SINT16: - case FFI_TYPE_SINT8: - p_gpr[0] = *(signed long *) rvalue; - break; - - default: - FFI_ASSERT (0); - break; - } -} - -/*======================== End of Routine ============================*/ - -/*====================================================================*/ -/* */ -/* Name - ffi_prep_closure_loc. */ -/* */ -/* Function - Prepare a FFI closure. */ -/* */ -/*====================================================================*/ - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, - void *codeloc) -{ - static unsigned short const template[] = { - 0x0d10, /* basr %r1,0 */ -#ifndef __s390x__ - 0x9801, 0x1006, /* lm %r0,%r1,6(%r1) */ -#else - 0xeb01, 0x100e, 0x0004, /* lmg %r0,%r1,14(%r1) */ -#endif - 0x07f1 /* br %r1 */ - }; - - unsigned long *tramp = (unsigned long *)&closure->tramp; - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - memcpy (tramp, template, sizeof(template)); - tramp[2] = (unsigned long)codeloc; - tramp[3] = (unsigned long)&ffi_closure_SYSV; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -/*======================== End of Routine ============================*/ - -/* Build a Go language closure. */ - -ffi_status -ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif, - void (*fun)(ffi_cif*,void*,void**,void*)) -{ - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - closure->tramp = ffi_go_closure_SYSV; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/s390/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/s390/ffitarget.h deleted file mode 100644 index d8a4ee4bf1036022cdb173315219760b3da7a820..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/s390/ffitarget.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for S390. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#if defined (__s390x__) -#ifndef S390X -#define S390X -#endif -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION -#define FFI_TARGET_HAS_COMPLEX_TYPE - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_GO_CLOSURES 1 -#ifdef S390X -#define FFI_TRAMPOLINE_SIZE 32 -#else -#define FFI_TRAMPOLINE_SIZE 16 -#endif -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/s390/internal.h b/llgo/third_party/gofrontend/libffi/src/s390/internal.h deleted file mode 100644 index b8755786f9e4f5e0d9a2d9d52ffb40a22aaae5d0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/s390/internal.h +++ /dev/null @@ -1,11 +0,0 @@ -/* If these values change, sysv.S must be adapted! */ -#define FFI390_RET_DOUBLE 0 -#define FFI390_RET_FLOAT 1 -#define FFI390_RET_INT64 2 -#define FFI390_RET_INT32 3 -#define FFI390_RET_VOID 4 - -#define FFI360_RET_MASK 7 -#define FFI390_RET_IN_MEM 8 - -#define FFI390_RET_STRUCT (FFI390_RET_VOID | FFI390_RET_IN_MEM) diff --git a/llgo/third_party/gofrontend/libffi/src/s390/sysv.S b/llgo/third_party/gofrontend/libffi/src/s390/sysv.S deleted file mode 100644 index c4b5006aed07454aba41870f4bc2bb1bac65a88e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/s390/sysv.S +++ /dev/null @@ -1,325 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2000 Software AG - Copyright (c) 2008 Red Hat, Inc. - - S390 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - - .text - -#ifndef __s390x__ - - # r2: frame - # r3: ret_type - # r4: ret_addr - # r5: fun - # r6: closure - - # This assumes we are using gas. - .balign 8 - .globl ffi_call_SYSV - FFI_HIDDEN(ffi_call_SYSV) - .type ffi_call_SYSV,%function -ffi_call_SYSV: - .cfi_startproc - st %r6,44(%r2) # Save registers - stm %r12,%r14,48(%r2) - lr %r13,%r2 # Install frame pointer - .cfi_rel_offset r6, 44 - .cfi_rel_offset r12, 48 - .cfi_rel_offset r13, 52 - .cfi_rel_offset r14, 56 - .cfi_def_cfa_register r13 - st %r2,0(%r15) # Set up back chain - sla %r3,3 # ret_type *= 8 - lr %r12,%r4 # Save ret_addr - lr %r1,%r5 # Save fun - lr %r0,%r6 # Install static chain - - # Set return address, so that there is only one indirect jump. -#ifdef HAVE_AS_S390_ZARCH - larl %r14,.Ltable - ar %r14,%r3 -#else - basr %r14,0 -0: la %r14,.Ltable-0b(%r14,%r3) -#endif - - lm %r2,%r6,8(%r13) # Load arguments - ld %f0,64(%r13) - ld %f2,72(%r13) - br %r1 # ... and call function - - .balign 8 -.Ltable: -# FFI390_RET_DOUBLE - std %f0,0(%r12) - j .Ldone - - .balign 8 -# FFI390_RET_FLOAT - ste %f0,0(%r12) - j .Ldone - - .balign 8 -# FFI390_RET_INT64 - st %r3,4(%r12) - nop - # fallthru - - .balign 8 -# FFI390_RET_INT32 - st %r2,0(%r12) - nop - # fallthru - - .balign 8 -# FFI390_RET_VOID -.Ldone: - l %r14,56(%r13) - l %r12,48(%r13) - l %r6,44(%r13) - l %r13,52(%r13) - .cfi_restore 14 - .cfi_restore 13 - .cfi_restore 12 - .cfi_restore 6 - .cfi_def_cfa r15, 96 - br %r14 - .cfi_endproc - .size ffi_call_SYSV,.-ffi_call_SYSV - - - .balign 8 - .globl ffi_go_closure_SYSV - FFI_HIDDEN(ffi_go_closure_SYSV) - .type ffi_go_closure_SYSV,%function -ffi_go_closure_SYSV: - .cfi_startproc - stm %r2,%r6,8(%r15) # Save arguments - lr %r4,%r0 # Load closure -> user_data - l %r2,4(%r4) # ->cif - l %r3,8(%r4) # ->fun - j .Ldoclosure - .cfi_endproc - - .balign 8 - .globl ffi_closure_SYSV - FFI_HIDDEN(ffi_closure_SYSV) - .type ffi_closure_SYSV,%function -ffi_closure_SYSV: - .cfi_startproc - stm %r2,%r6,8(%r15) # Save arguments - lr %r4,%r0 # Closure - l %r2,16(%r4) # ->cif - l %r3,20(%r4) # ->fun - l %r4,24(%r4) # ->user_data -.Ldoclosure: - stm %r12,%r15,48(%r15) # Save registers - lr %r12,%r15 - .cfi_def_cfa_register r12 - .cfi_rel_offset r6, 24 - .cfi_rel_offset r12, 48 - .cfi_rel_offset r13, 52 - .cfi_rel_offset r14, 56 - .cfi_rel_offset r15, 60 -#ifndef HAVE_AS_S390_ZARCH - basr %r13,0 # Set up base register -.Lcbase: - l %r1,.Lchelper-.Lcbase(%r13) # Get helper function -#endif - ahi %r15,-96-8 # Set up stack frame - st %r12,0(%r15) # Set up back chain - - std %f0,64(%r12) # Save fp arguments - std %f2,72(%r12) - - la %r5,96(%r12) # Overflow - st %r5,96(%r15) - la %r6,64(%r12) # FPRs - la %r5,8(%r12) # GPRs -#ifdef HAVE_AS_S390_ZARCH - brasl %r14,ffi_closure_helper_SYSV -#else - bas %r14,0(%r1,%r13) # Call helper -#endif - - lr %r15,%r12 - .cfi_def_cfa_register r15 - lm %r12,%r14,48(%r12) # Restore saved registers - l %r6,24(%r15) - ld %f0,64(%r15) # Load return registers - lm %r2,%r3,8(%r15) - br %r14 - .cfi_endproc - -#ifndef HAVE_AS_S390_ZARCH - .align 4 -.Lchelper: - .long ffi_closure_helper_SYSV-.Lcbase -#endif - - .size ffi_closure_SYSV,.-ffi_closure_SYSV - -#else - - # r2: frame - # r3: ret_type - # r4: ret_addr - # r5: fun - # r6: closure - - # This assumes we are using gas. - .balign 8 - .globl ffi_call_SYSV - FFI_HIDDEN(ffi_call_SYSV) - .type ffi_call_SYSV,%function -ffi_call_SYSV: - .cfi_startproc - stg %r6,88(%r2) # Save registers - stmg %r12,%r14,96(%r2) - lgr %r13,%r2 # Install frame pointer - .cfi_rel_offset r6, 88 - .cfi_rel_offset r12, 96 - .cfi_rel_offset r13, 104 - .cfi_rel_offset r14, 112 - .cfi_def_cfa_register r13 - stg %r2,0(%r15) # Set up back chain - larl %r14,.Ltable # Set up return address - slag %r3,%r3,3 # ret_type *= 8 - lgr %r12,%r4 # Save ret_addr - lgr %r1,%r5 # Save fun - lgr %r0,%r6 # Install static chain - agr %r14,%r3 - lmg %r2,%r6,16(%r13) # Load arguments - ld %f0,128(%r13) - ld %f2,136(%r13) - ld %f4,144(%r13) - ld %f6,152(%r13) - br %r1 # ... and call function - - .balign 8 -.Ltable: -# FFI390_RET_DOUBLE - std %f0,0(%r12) - j .Ldone - - .balign 8 -# FFI390_RET_DOUBLE - ste %f0,0(%r12) - j .Ldone - - .balign 8 -# FFI390_RET_INT64 - stg %r2,0(%r12) - - .balign 8 -# FFI390_RET_INT32 - # Never used, as we always store type ffi_arg. - # But the stg above is 6 bytes and we cannot - # jump around this case, so fall through. - nop - nop - - .balign 8 -# FFI390_RET_VOID -.Ldone: - lg %r14,112(%r13) - lg %r12,96(%r13) - lg %r6,88(%r13) - lg %r13,104(%r13) - .cfi_restore r14 - .cfi_restore r13 - .cfi_restore r12 - .cfi_restore r6 - .cfi_def_cfa r15, 160 - br %r14 - .cfi_endproc - .size ffi_call_SYSV,.-ffi_call_SYSV - - - .balign 8 - .globl ffi_go_closure_SYSV - FFI_HIDDEN(ffi_go_closure_SYSV) - .type ffi_go_closure_SYSV,%function -ffi_go_closure_SYSV: - .cfi_startproc - stmg %r2,%r6,16(%r15) # Save arguments - lgr %r4,%r0 # Load closure -> user_data - lg %r2,8(%r4) # ->cif - lg %r3,16(%r4) # ->fun - j .Ldoclosure - .cfi_endproc - .size ffi_go_closure_SYSV,.-ffi_go_closure_SYSV - - - .balign 8 - .globl ffi_closure_SYSV - FFI_HIDDEN(ffi_closure_SYSV) - .type ffi_closure_SYSV,%function -ffi_closure_SYSV: - .cfi_startproc - stmg %r2,%r6,16(%r15) # Save arguments - lgr %r4,%r0 # Load closure - lg %r2,32(%r4) # ->cif - lg %r3,40(%r4) # ->fun - lg %r4,48(%r4) # ->user_data -.Ldoclosure: - stmg %r13,%r15,104(%r15) # Save registers - lgr %r13,%r15 - .cfi_def_cfa_register r13 - .cfi_rel_offset r6, 48 - .cfi_rel_offset r13, 104 - .cfi_rel_offset r14, 112 - .cfi_rel_offset r15, 120 - aghi %r15,-160-16 # Set up stack frame - stg %r13,0(%r15) # Set up back chain - - std %f0,128(%r13) # Save fp arguments - std %f2,136(%r13) - std %f4,144(%r13) - std %f6,152(%r13) - la %r5,160(%r13) # Overflow - stg %r5,160(%r15) - la %r6,128(%r13) # FPRs - la %r5,16(%r13) # GPRs - brasl %r14,ffi_closure_helper_SYSV # Call helper - - lgr %r15,%r13 - .cfi_def_cfa_register r15 - lmg %r13,%r14,104(%r13) # Restore saved registers - lg %r6,48(%r15) - ld %f0,128(%r15) # Load return registers - lg %r2,16(%r15) - br %r14 - .cfi_endproc - .size ffi_closure_SYSV,.-ffi_closure_SYSV -#endif /* !s390x */ - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/sh/ffi.c b/llgo/third_party/gofrontend/libffi/src/sh/ffi.c deleted file mode 100644 index 9ec86bfb205c8f7b8c6251ea4715c6c781b9502d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh/ffi.c +++ /dev/null @@ -1,717 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2002-2008, 2012 Kaz Kojima - Copyright (c) 2008 Red Hat, Inc. - - SuperH Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -#define NGREGARG 4 -#if defined(__SH4__) -#define NFREGARG 8 -#endif - -#if defined(__HITACHI__) -#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 -#else -#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 -#endif - -/* If the structure has essentially an unique element, return its type. */ -static int -simple_type (ffi_type *arg) -{ - if (arg->type != FFI_TYPE_STRUCT) - return arg->type; - else if (arg->elements[1]) - return FFI_TYPE_STRUCT; - - return simple_type (arg->elements[0]); -} - -static int -return_type (ffi_type *arg) -{ - unsigned short type; - - if (arg->type != FFI_TYPE_STRUCT) - return arg->type; - - type = simple_type (arg->elements[0]); - if (! arg->elements[1]) - { - switch (type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - return FFI_TYPE_INT; - - default: - return type; - } - } - - /* gcc uses r0/r1 pair for some kind of structures. */ - if (arg->size <= 2 * sizeof (int)) - { - int i = 0; - ffi_type *e; - - while ((e = arg->elements[i++])) - { - type = simple_type (e); - switch (type) - { - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_INT: - case FFI_TYPE_FLOAT: - return FFI_TYPE_UINT64; - - default: - break; - } - } - } - - return FFI_TYPE_STRUCT; -} - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register int tmp; - register unsigned int avn; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - int greg, ireg; -#if defined(__SH4__) - int freg = 0; -#endif - - tmp = 0; - argp = stack; - - if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) - { - *(void **) argp = ecif->rvalue; - argp += 4; - ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; - } - else - ireg = 0; - - /* Set arguments for registers. */ - greg = ireg; - avn = ecif->cif->nargs; - p_argv = ecif->avalue; - - for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) - { - size_t z; - - z = (*p_arg)->size; - if (z < sizeof(int)) - { - if (greg++ >= NGREGARG) - continue; - - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_STRUCT: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - break; - - default: - FFI_ASSERT(0); - } - argp += z; - } - else if (z == sizeof(int)) - { -#if defined(__SH4__) - if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (freg++ >= NFREGARG) - continue; - } - else -#endif - { - if (greg++ >= NGREGARG) - continue; - } - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - argp += z; - } -#if defined(__SH4__) - else if ((*p_arg)->type == FFI_TYPE_DOUBLE) - { - if (freg + 1 >= NFREGARG) - continue; - freg = (freg + 1) & ~1; - freg += 2; - memcpy (argp, *p_argv, z); - argp += z; - } -#endif - else - { - int n = (z + sizeof (int) - 1) / sizeof (int); -#if defined(__SH4__) - if (greg + n - 1 >= NGREGARG) - continue; -#else - if (greg >= NGREGARG) - continue; -#endif - greg += n; - memcpy (argp, *p_argv, z); - argp += n * sizeof (int); - } - } - - /* Set arguments on stack. */ - greg = ireg; -#if defined(__SH4__) - freg = 0; -#endif - p_argv = ecif->avalue; - - for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) - { - size_t z; - - z = (*p_arg)->size; - if (z < sizeof(int)) - { - if (greg++ < NGREGARG) - continue; - - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_STRUCT: - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - break; - - default: - FFI_ASSERT(0); - } - argp += z; - } - else if (z == sizeof(int)) - { -#if defined(__SH4__) - if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (freg++ < NFREGARG) - continue; - } - else -#endif - { - if (greg++ < NGREGARG) - continue; - } - *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); - argp += z; - } -#if defined(__SH4__) - else if ((*p_arg)->type == FFI_TYPE_DOUBLE) - { - if (freg + 1 < NFREGARG) - { - freg = (freg + 1) & ~1; - freg += 2; - continue; - } - memcpy (argp, *p_argv, z); - argp += z; - } -#endif - else - { - int n = (z + sizeof (int) - 1) / sizeof (int); - if (greg + n - 1 < NGREGARG) - { - greg += n; - continue; - } -#if (! defined(__SH4__)) - else if (greg < NGREGARG) - { - greg = NGREGARG; - continue; - } -#endif - memcpy (argp, *p_argv, z); - argp += n * sizeof (int); - } - } - - return; -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - int i, j; - int size, type; - int n, m; - int greg; -#if defined(__SH4__) - int freg = 0; -#endif - - cif->flags = 0; - - greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) && - STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0; - -#if defined(__SH4__) - for (i = j = 0; i < cif->nargs && j < 12; i++) - { - type = (cif->arg_types)[i]->type; - switch (type) - { - case FFI_TYPE_FLOAT: - if (freg >= NFREGARG) - continue; - freg++; - cif->flags += ((cif->arg_types)[i]->type) << (2 * j); - j++; - break; - - case FFI_TYPE_DOUBLE: - if ((freg + 1) >= NFREGARG) - continue; - freg = (freg + 1) & ~1; - freg += 2; - cif->flags += ((cif->arg_types)[i]->type) << (2 * j); - j++; - break; - - default: - size = (cif->arg_types)[i]->size; - n = (size + sizeof (int) - 1) / sizeof (int); - if (greg + n - 1 >= NGREGARG) - continue; - greg += n; - for (m = 0; m < n; m++) - cif->flags += FFI_TYPE_INT << (2 * j++); - break; - } - } -#else - for (i = j = 0; i < cif->nargs && j < 4; i++) - { - size = (cif->arg_types)[i]->size; - n = (size + sizeof (int) - 1) / sizeof (int); - if (greg >= NGREGARG) - continue; - else if (greg + n - 1 >= NGREGARG) - n = NGREGARG - greg; - greg += n; - for (m = 0; m < n; m++) - cif->flags += FFI_TYPE_INT << (2 * j++); - } -#endif - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_STRUCT: - cif->flags += (unsigned) (return_type (cif->rtype)) << 24; - break; - - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags += (unsigned) cif->rtype->type << 24; - break; - - default: - cif->flags += FFI_TYPE_INT << 24; - break; - } - - return FFI_OK; -} - -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - UINT64 trvalue; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if (cif->rtype->type == FFI_TYPE_STRUCT - && return_type (cif->rtype) != FFI_TYPE_STRUCT) - ecif.rvalue = &trvalue; - else if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); - break; - default: - FFI_ASSERT(0); - break; - } - - if (rvalue - && cif->rtype->type == FFI_TYPE_STRUCT - && return_type (cif->rtype) != FFI_TYPE_STRUCT) - memcpy (rvalue, &trvalue, cif->rtype->size); -} - -extern void ffi_closure_SYSV (void); -#if defined(__SH4__) -extern void __ic_invalidate (void *line); -#endif - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp; - unsigned int insn; - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - tramp = (unsigned int *) &closure->tramp[0]; - /* Set T bit if the function returns a struct pointed with R2. */ - insn = (return_type (cif->rtype) == FFI_TYPE_STRUCT - ? 0x0018 /* sett */ - : 0x0008 /* clrt */); - -#ifdef __LITTLE_ENDIAN__ - tramp[0] = 0xd301d102; - tramp[1] = 0x0000412b | (insn << 16); -#else - tramp[0] = 0xd102d301; - tramp[1] = 0x412b0000 | insn; -#endif - *(void **) &tramp[2] = (void *)codeloc; /* ctx */ - *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */ - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - -#if defined(__SH4__) - /* Flush the icache. */ - __ic_invalidate(codeloc); -#endif - - return FFI_OK; -} - -/* Basically the trampoline invokes ffi_closure_SYSV, and on - * entry, r3 holds the address of the closure. - * After storing the registers that could possibly contain - * parameters to be passed into the stack frame and setting - * up space for a return value, ffi_closure_SYSV invokes the - * following helper function to do most of the work. - */ - -#ifdef __LITTLE_ENDIAN__ -#define OFS_INT8 0 -#define OFS_INT16 0 -#else -#define OFS_INT8 3 -#define OFS_INT16 2 -#endif - -int -ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, - unsigned long *pgr, unsigned long *pfr, - unsigned long *pst) -{ - void **avalue; - ffi_type **p_arg; - int i, avn; - int ireg, greg = 0; -#if defined(__SH4__) - int freg = 0; -#endif - ffi_cif *cif; - - cif = closure->cif; - avalue = alloca(cif->nargs * sizeof(void *)); - - /* Copy the caller's structure return value address so that the closure - returns the data directly to the caller. */ - if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG) - { - rvalue = (void *) *pgr++; - ireg = 1; - } - else - ireg = 0; - - cif = closure->cif; - greg = ireg; - avn = cif->nargs; - - /* Grab the addresses of the arguments from the stack frame. */ - for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - if (z < sizeof(int)) - { - if (greg++ >= NGREGARG) - continue; - - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = (((char *)pgr) + OFS_INT8); - break; - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = (((char *)pgr) + OFS_INT16); - break; - - case FFI_TYPE_STRUCT: - avalue[i] = pgr; - break; - - default: - FFI_ASSERT(0); - } - pgr++; - } - else if (z == sizeof(int)) - { -#if defined(__SH4__) - if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (freg++ >= NFREGARG) - continue; - avalue[i] = pfr; - pfr++; - } - else -#endif - { - if (greg++ >= NGREGARG) - continue; - avalue[i] = pgr; - pgr++; - } - } -#if defined(__SH4__) - else if ((*p_arg)->type == FFI_TYPE_DOUBLE) - { - if (freg + 1 >= NFREGARG) - continue; - if (freg & 1) - pfr++; - freg = (freg + 1) & ~1; - freg += 2; - avalue[i] = pfr; - pfr += 2; - } -#endif - else - { - int n = (z + sizeof (int) - 1) / sizeof (int); -#if defined(__SH4__) - if (greg + n - 1 >= NGREGARG) - continue; -#else - if (greg >= NGREGARG) - continue; -#endif - greg += n; - avalue[i] = pgr; - pgr += n; - } - } - - greg = ireg; -#if defined(__SH4__) - freg = 0; -#endif - - for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - if (z < sizeof(int)) - { - if (greg++ < NGREGARG) - continue; - - z = sizeof(int); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - avalue[i] = (((char *)pst) + OFS_INT8); - break; - - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - avalue[i] = (((char *)pst) + OFS_INT16); - break; - - case FFI_TYPE_STRUCT: - avalue[i] = pst; - break; - - default: - FFI_ASSERT(0); - } - pst++; - } - else if (z == sizeof(int)) - { -#if defined(__SH4__) - if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (freg++ < NFREGARG) - continue; - } - else -#endif - { - if (greg++ < NGREGARG) - continue; - } - avalue[i] = pst; - pst++; - } -#if defined(__SH4__) - else if ((*p_arg)->type == FFI_TYPE_DOUBLE) - { - if (freg + 1 < NFREGARG) - { - freg = (freg + 1) & ~1; - freg += 2; - continue; - } - avalue[i] = pst; - pst += 2; - } -#endif - else - { - int n = (z + sizeof (int) - 1) / sizeof (int); - if (greg + n - 1 < NGREGARG) - { - greg += n; - continue; - } -#if (! defined(__SH4__)) - else if (greg < NGREGARG) - { - greg += n; - pst += greg - NGREGARG; - continue; - } -#endif - avalue[i] = pst; - pst += n; - } - } - - (closure->fun) (cif, rvalue, avalue, closure->user_data); - - /* Tell ffi_closure_SYSV how to perform return type promotions. */ - return return_type (cif->rtype); -} diff --git a/llgo/third_party/gofrontend/libffi/src/sh/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/sh/ffitarget.h deleted file mode 100644 index a36bf4207046d74f53f92de4ce19eeb469321287..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh/ffitarget.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for SuperH. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- Generic type definitions ----------------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 16 -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/sh/sysv.S b/llgo/third_party/gofrontend/libffi/src/sh/sysv.S deleted file mode 100644 index 5be7516d6559e3ce84e1380905950328bcb49ced..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh/sysv.S +++ /dev/null @@ -1,850 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2002, 2003, 2004, 2006, 2008 Kaz Kojima - - SuperH Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -/* XXX these lose for some platforms, I'm sure. */ -#define CNAME(x) x -#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): -#endif - -#if defined(__HITACHI__) -#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 -#else -#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 -#endif - -.text - - # r4: ffi_prep_args - # r5: &ecif - # r6: bytes - # r7: flags - # sp+0: rvalue - # sp+4: fn - - # This assumes we are using gas. -ENTRY(ffi_call_SYSV) - # Save registers -.LFB1: - mov.l r8,@-r15 -.LCFI0: - mov.l r9,@-r15 -.LCFI1: - mov.l r10,@-r15 -.LCFI2: - mov.l r12,@-r15 -.LCFI3: - mov.l r14,@-r15 -.LCFI4: - sts.l pr,@-r15 -.LCFI5: - mov r15,r14 -.LCFI6: -#if defined(__SH4__) - mov r6,r8 - mov r7,r9 - - sub r6,r15 - add #-16,r15 - mov #~7,r0 - and r0,r15 - - mov r4,r0 - jsr @r0 - mov r15,r4 - - mov r9,r1 - shlr8 r9 - shlr8 r9 - shlr8 r9 - - mov #FFI_TYPE_STRUCT,r2 - cmp/eq r2,r9 - bf 1f -#if STRUCT_VALUE_ADDRESS_WITH_ARG - mov.l @r15+,r4 - bra 2f - mov #5,r2 -#else - mov.l @r15+,r10 -#endif -1: - mov #4,r2 -2: - mov #4,r3 - -L_pass: - cmp/pl r8 - bf L_call_it - - mov r1,r0 - and #3,r0 - -L_pass_d: - cmp/eq #FFI_TYPE_DOUBLE,r0 - bf L_pass_f - - mov r3,r0 - and #1,r0 - tst r0,r0 - bt 1f - add #1,r3 -1: - mov #12,r0 - cmp/hs r0,r3 - bt/s 3f - shlr2 r1 - bsr L_pop_d - nop -3: - add #2,r3 - bra L_pass - add #-8,r8 - -L_pop_d: - mov r3,r0 - add r0,r0 - add r3,r0 - add #-12,r0 - braf r0 - nop -#ifdef __LITTLE_ENDIAN__ - fmov.s @r15+,fr5 - rts - fmov.s @r15+,fr4 - fmov.s @r15+,fr7 - rts - fmov.s @r15+,fr6 - fmov.s @r15+,fr9 - rts - fmov.s @r15+,fr8 - fmov.s @r15+,fr11 - rts - fmov.s @r15+,fr10 -#else - fmov.s @r15+,fr4 - rts - fmov.s @r15+,fr5 - fmov.s @r15+,fr6 - rts - fmov.s @r15+,fr7 - fmov.s @r15+,fr8 - rts - fmov.s @r15+,fr9 - fmov.s @r15+,fr10 - rts - fmov.s @r15+,fr11 -#endif - -L_pass_f: - cmp/eq #FFI_TYPE_FLOAT,r0 - bf L_pass_i - - mov #12,r0 - cmp/hs r0,r3 - bt/s 2f - shlr2 r1 - bsr L_pop_f - nop -2: - add #1,r3 - bra L_pass - add #-4,r8 - -L_pop_f: - mov r3,r0 - shll2 r0 - add #-16,r0 - braf r0 - nop -#ifdef __LITTLE_ENDIAN__ - rts - fmov.s @r15+,fr5 - rts - fmov.s @r15+,fr4 - rts - fmov.s @r15+,fr7 - rts - fmov.s @r15+,fr6 - rts - fmov.s @r15+,fr9 - rts - fmov.s @r15+,fr8 - rts - fmov.s @r15+,fr11 - rts - fmov.s @r15+,fr10 -#else - rts - fmov.s @r15+,fr4 - rts - fmov.s @r15+,fr5 - rts - fmov.s @r15+,fr6 - rts - fmov.s @r15+,fr7 - rts - fmov.s @r15+,fr8 - rts - fmov.s @r15+,fr9 - rts - fmov.s @r15+,fr10 - rts - fmov.s @r15+,fr11 -#endif - -L_pass_i: - cmp/eq #FFI_TYPE_INT,r0 - bf L_call_it - - mov #8,r0 - cmp/hs r0,r2 - bt/s 2f - shlr2 r1 - bsr L_pop_i - nop -2: - add #1,r2 - bra L_pass - add #-4,r8 - -L_pop_i: - mov r2,r0 - shll2 r0 - add #-16,r0 - braf r0 - nop - rts - mov.l @r15+,r4 - rts - mov.l @r15+,r5 - rts - mov.l @r15+,r6 - rts - mov.l @r15+,r7 - -L_call_it: - # call function -#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) - mov r10, r2 -#endif - mov.l @(28,r14),r1 - jsr @r1 - nop - -L_ret_d: - mov #FFI_TYPE_DOUBLE,r2 - cmp/eq r2,r9 - bf L_ret_ll - - mov.l @(24,r14),r1 -#ifdef __LITTLE_ENDIAN__ - fmov.s fr1,@r1 - add #4,r1 - bra L_epilogue - fmov.s fr0,@r1 -#else - fmov.s fr0,@r1 - add #4,r1 - bra L_epilogue - fmov.s fr1,@r1 -#endif - -L_ret_ll: - mov #FFI_TYPE_SINT64,r2 - cmp/eq r2,r9 - bt/s 1f - mov #FFI_TYPE_UINT64,r2 - cmp/eq r2,r9 - bf L_ret_f - -1: - mov.l @(24,r14),r2 - mov.l r0,@r2 - bra L_epilogue - mov.l r1,@(4,r2) - -L_ret_f: - mov #FFI_TYPE_FLOAT,r2 - cmp/eq r2,r9 - bf L_ret_i - - mov.l @(24,r14),r1 - bra L_epilogue - fmov.s fr0,@r1 - -L_ret_i: - mov #FFI_TYPE_INT,r2 - cmp/eq r2,r9 - bf L_epilogue - - mov.l @(24,r14),r1 - bra L_epilogue - mov.l r0,@r1 - -L_epilogue: - # Remove the space we pushed for the args - mov r14,r15 - - lds.l @r15+,pr - mov.l @r15+,r14 - mov.l @r15+,r12 - mov.l @r15+,r10 - mov.l @r15+,r9 - rts - mov.l @r15+,r8 -#else - mov r6,r8 - mov r7,r9 - - sub r6,r15 - add #-16,r15 - mov #~7,r0 - and r0,r15 - - mov r4,r0 - jsr @r0 - mov r15,r4 - - mov r9,r3 - shlr8 r9 - shlr8 r9 - shlr8 r9 - - mov #FFI_TYPE_STRUCT,r2 - cmp/eq r2,r9 - bf 1f -#if STRUCT_VALUE_ADDRESS_WITH_ARG - mov.l @r15+,r4 - bra 2f - mov #5,r2 -#else - mov.l @r15+,r10 -#endif -1: - mov #4,r2 -2: - -L_pass: - cmp/pl r8 - bf L_call_it - - mov r3,r0 - and #3,r0 - -L_pass_d: - cmp/eq #FFI_TYPE_DOUBLE,r0 - bf L_pass_i - - mov r15,r0 - and #7,r0 - tst r0,r0 - bt 1f - add #4,r15 -1: - mov #8,r0 - cmp/hs r0,r2 - bt/s 2f - shlr2 r3 - bsr L_pop_d - nop -2: - add #2,r2 - bra L_pass - add #-8,r8 - -L_pop_d: - mov r2,r0 - add r0,r0 - add r2,r0 - add #-12,r0 - add r0,r0 - braf r0 - nop - mov.l @r15+,r4 - rts - mov.l @r15+,r5 - mov.l @r15+,r5 - rts - mov.l @r15+,r6 - mov.l @r15+,r6 - rts - mov.l @r15+,r7 - rts - mov.l @r15+,r7 - -L_pass_i: - cmp/eq #FFI_TYPE_INT,r0 - bf L_call_it - - mov #8,r0 - cmp/hs r0,r2 - bt/s 2f - shlr2 r3 - bsr L_pop_i - nop -2: - add #1,r2 - bra L_pass - add #-4,r8 - -L_pop_i: - mov r2,r0 - shll2 r0 - add #-16,r0 - braf r0 - nop - rts - mov.l @r15+,r4 - rts - mov.l @r15+,r5 - rts - mov.l @r15+,r6 - rts - mov.l @r15+,r7 - -L_call_it: - # call function -#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) - mov r10, r2 -#endif - mov.l @(28,r14),r1 - jsr @r1 - nop - -L_ret_d: - mov #FFI_TYPE_DOUBLE,r2 - cmp/eq r2,r9 - bf L_ret_ll - - mov.l @(24,r14),r2 - mov.l r0,@r2 - bra L_epilogue - mov.l r1,@(4,r2) - -L_ret_ll: - mov #FFI_TYPE_SINT64,r2 - cmp/eq r2,r9 - bt/s 1f - mov #FFI_TYPE_UINT64,r2 - cmp/eq r2,r9 - bf L_ret_i - -1: - mov.l @(24,r14),r2 - mov.l r0,@r2 - bra L_epilogue - mov.l r1,@(4,r2) - -L_ret_i: - mov #FFI_TYPE_FLOAT,r2 - cmp/eq r2,r9 - bt 1f - mov #FFI_TYPE_INT,r2 - cmp/eq r2,r9 - bf L_epilogue -1: - mov.l @(24,r14),r1 - bra L_epilogue - mov.l r0,@r1 - -L_epilogue: - # Remove the space we pushed for the args - mov r14,r15 - - lds.l @r15+,pr - mov.l @r15+,r14 - mov.l @r15+,r12 - mov.l @r15+,r10 - mov.l @r15+,r9 - rts - mov.l @r15+,r8 -#endif -.LFE1: -.ffi_call_SYSV_end: - .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) - -.globl ffi_closure_helper_SYSV - -ENTRY(ffi_closure_SYSV) -.LFB2: - mov.l r7,@-r15 -.LCFI7: - mov.l r6,@-r15 -.LCFI8: - mov.l r5,@-r15 -.LCFI9: - mov.l r4,@-r15 -.LCFIA: - mov.l r14,@-r15 -.LCFIB: - sts.l pr,@-r15 - - /* Stack layout: - xx bytes (on stack parameters) - 16 bytes (register parameters) - 4 bytes (saved frame pointer) - 4 bytes (saved return address) - 32 bytes (floating register parameters, SH-4 only) - 8 bytes (result) - 4 bytes (pad) - 4 bytes (5th arg) - <- new stack pointer - */ -.LCFIC: -#if defined(__SH4__) - add #-48,r15 -#else - add #-16,r15 -#endif -.LCFID: - mov r15,r14 -.LCFIE: - -#if defined(__SH4__) - mov r14,r1 - add #48,r1 -#ifdef __LITTLE_ENDIAN__ - fmov.s fr10,@-r1 - fmov.s fr11,@-r1 - fmov.s fr8,@-r1 - fmov.s fr9,@-r1 - fmov.s fr6,@-r1 - fmov.s fr7,@-r1 - fmov.s fr4,@-r1 - fmov.s fr5,@-r1 -#else - fmov.s fr11,@-r1 - fmov.s fr10,@-r1 - fmov.s fr9,@-r1 - fmov.s fr8,@-r1 - fmov.s fr7,@-r1 - fmov.s fr6,@-r1 - fmov.s fr5,@-r1 - fmov.s fr4,@-r1 -#endif - mov r1,r7 - mov r14,r6 - add #56,r6 -#else - mov r14,r6 - add #24,r6 -#endif - - bt/s 10f - mov r2, r5 - mov r14,r1 - add #8,r1 - mov r1,r5 -10: - - mov r14,r1 -#if defined(__SH4__) - add #72,r1 -#else - add #40,r1 -#endif - mov.l r1,@r14 - -#ifdef PIC - mov.l L_got,r1 - mova L_got,r0 - add r0,r1 - mov.l L_helper,r0 - add r1,r0 -#else - mov.l L_helper,r0 -#endif - jsr @r0 - mov r3,r4 - - shll r0 - mov r0,r1 - mova L_table,r0 - add r1,r0 - mov.w @r0,r0 - mov r14,r2 - braf r0 - add #8,r2 -0: - .align 2 -#ifdef PIC -L_got: - .long _GLOBAL_OFFSET_TABLE_ -L_helper: - .long ffi_closure_helper_SYSV@GOTOFF -#else -L_helper: - .long ffi_closure_helper_SYSV -#endif -L_table: - .short L_case_v - 0b /* FFI_TYPE_VOID */ - .short L_case_i - 0b /* FFI_TYPE_INT */ -#if defined(__SH4__) - .short L_case_f - 0b /* FFI_TYPE_FLOAT */ - .short L_case_d - 0b /* FFI_TYPE_DOUBLE */ - .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */ -#else - .short L_case_i - 0b /* FFI_TYPE_FLOAT */ - .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */ - .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */ -#endif - .short L_case_uq - 0b /* FFI_TYPE_UINT8 */ - .short L_case_q - 0b /* FFI_TYPE_SINT8 */ - .short L_case_uh - 0b /* FFI_TYPE_UINT16 */ - .short L_case_h - 0b /* FFI_TYPE_SINT16 */ - .short L_case_i - 0b /* FFI_TYPE_UINT32 */ - .short L_case_i - 0b /* FFI_TYPE_SINT32 */ - .short L_case_ll - 0b /* FFI_TYPE_UINT64 */ - .short L_case_ll - 0b /* FFI_TYPE_SINT64 */ - .short L_case_v - 0b /* FFI_TYPE_STRUCT */ - .short L_case_i - 0b /* FFI_TYPE_POINTER */ - -#if defined(__SH4__) -L_case_d: -#ifdef __LITTLE_ENDIAN__ - fmov.s @r2+,fr1 - bra L_case_v - fmov.s @r2,fr0 -#else - fmov.s @r2+,fr0 - bra L_case_v - fmov.s @r2,fr1 -#endif - -L_case_f: - bra L_case_v - fmov.s @r2,fr0 -#endif - -L_case_ll: - mov.l @r2+,r0 - bra L_case_v - mov.l @r2,r1 - -L_case_i: - bra L_case_v - mov.l @r2,r0 - -L_case_q: -#ifdef __LITTLE_ENDIAN__ -#else - add #3,r2 -#endif - bra L_case_v - mov.b @r2,r0 - -L_case_uq: -#ifdef __LITTLE_ENDIAN__ -#else - add #3,r2 -#endif - mov.b @r2,r0 - bra L_case_v - extu.b r0,r0 - -L_case_h: -#ifdef __LITTLE_ENDIAN__ -#else - add #2,r2 -#endif - bra L_case_v - mov.w @r2,r0 - -L_case_uh: -#ifdef __LITTLE_ENDIAN__ -#else - add #2,r2 -#endif - mov.w @r2,r0 - extu.w r0,r0 - /* fall through */ - -L_case_v: -#if defined(__SH4__) - add #48,r15 -#else - add #16,r15 -#endif - lds.l @r15+,pr - mov.l @r15+,r14 - rts - add #16,r15 -.LFE2: -.ffi_closure_SYSV_end: - .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif - - .section ".eh_frame","aw",@progbits -__FRAME_BEGIN__: - .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ -.LSCIE1: - .4byte 0x0 /* CIE Identifier Tag */ - .byte 0x1 /* CIE Version */ -#ifdef PIC - .ascii "zR\0" /* CIE Augmentation */ -#else - .byte 0x0 /* CIE Augmentation */ -#endif - .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ - .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ - .byte 0x11 /* CIE RA Column */ -#ifdef PIC - .uleb128 0x1 /* Augmentation size */ - .byte 0x10 /* FDE Encoding (pcrel) */ -#endif - .byte 0xc /* DW_CFA_def_cfa */ - .byte 0xf /* uleb128 0xf */ - .byte 0x0 /* uleb128 0x0 */ - .align 2 -.LECIE1: -.LSFDE1: - .4byte .LEFDE1-.LASFDE1 /* FDE Length */ -.LASFDE1: - .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ -#ifdef PIC - .4byte .LFB1-. /* FDE initial location */ -#else - .4byte .LFB1 /* FDE initial location */ -#endif - .4byte .LFE1-.LFB1 /* FDE address range */ -#ifdef PIC - .uleb128 0x0 /* Augmentation size */ -#endif - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI0-.LFB1 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x4 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI1-.LCFI0 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x8 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI2-.LCFI1 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0xc /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI3-.LCFI2 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x10 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI4-.LCFI3 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x14 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI5-.LCFI4 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x18 /* uleb128 0x4 */ - .byte 0x91 /* DW_CFA_offset, column 0x11 */ - .byte 0x6 /* uleb128 0x6 */ - .byte 0x8e /* DW_CFA_offset, column 0xe */ - .byte 0x5 /* uleb128 0x5 */ - .byte 0x8c /* DW_CFA_offset, column 0xc */ - .byte 0x4 /* uleb128 0x4 */ - .byte 0x8a /* DW_CFA_offset, column 0xa */ - .byte 0x3 /* uleb128 0x3 */ - .byte 0x89 /* DW_CFA_offset, column 0x9 */ - .byte 0x2 /* uleb128 0x2 */ - .byte 0x88 /* DW_CFA_offset, column 0x8 */ - .byte 0x1 /* uleb128 0x1 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI6-.LCFI5 - .byte 0xd /* DW_CFA_def_cfa_register */ - .byte 0xe /* uleb128 0xe */ - .align 2 -.LEFDE1: - -.LSFDE3: - .4byte .LEFDE3-.LASFDE3 /* FDE Length */ -.LASFDE3: - .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ -#ifdef PIC - .4byte .LFB2-. /* FDE initial location */ -#else - .4byte .LFB2 /* FDE initial location */ -#endif - .4byte .LFE2-.LFB2 /* FDE address range */ -#ifdef PIC - .uleb128 0x0 /* Augmentation size */ -#endif - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI7-.LFB2 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x4 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI8-.LCFI7 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x8 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFI9-.LCFI8 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0xc /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFIA-.LCFI9 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x10 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFIB-.LCFIA - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x14 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFIC-.LCFIB - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x18 /* uleb128 0x4 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFID-.LCFIC - .byte 0xe /* DW_CFA_def_cfa_offset */ -#if defined(__SH4__) - .byte 24+48 /* uleb128 24+48 */ -#else - .byte 24+16 /* uleb128 24+16 */ -#endif - .byte 0x91 /* DW_CFA_offset, column 0x11 */ - .byte 0x6 /* uleb128 0x6 */ - .byte 0x8e /* DW_CFA_offset, column 0xe */ - .byte 0x5 /* uleb128 0x5 */ - .byte 0x84 /* DW_CFA_offset, column 0x4 */ - .byte 0x4 /* uleb128 0x4 */ - .byte 0x85 /* DW_CFA_offset, column 0x5 */ - .byte 0x3 /* uleb128 0x3 */ - .byte 0x86 /* DW_CFA_offset, column 0x6 */ - .byte 0x2 /* uleb128 0x2 */ - .byte 0x87 /* DW_CFA_offset, column 0x7 */ - .byte 0x1 /* uleb128 0x1 */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte .LCFIE-.LCFID - .byte 0xd /* DW_CFA_def_cfa_register */ - .byte 0xe /* uleb128 0xe */ - .align 2 -.LEFDE3: diff --git a/llgo/third_party/gofrontend/libffi/src/sh64/ffi.c b/llgo/third_party/gofrontend/libffi/src/sh64/ffi.c deleted file mode 100644 index 123b87ace92f452a6fbf97e2d547a986f54f9a78..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh64/ffi.c +++ /dev/null @@ -1,469 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2003, 2004, 2006, 2007, 2012 Kaz Kojima - Copyright (c) 2008 Anthony Green - - SuperH SHmedia Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include - -#define NGREGARG 8 -#define NFREGARG 12 - -static int -return_type (ffi_type *arg) -{ - - if (arg->type != FFI_TYPE_STRUCT) - return arg->type; - - /* gcc uses r2 if the result can be packed in on register. */ - if (arg->size <= sizeof (UINT8)) - return FFI_TYPE_UINT8; - else if (arg->size <= sizeof (UINT16)) - return FFI_TYPE_UINT16; - else if (arg->size <= sizeof (UINT32)) - return FFI_TYPE_UINT32; - else if (arg->size <= sizeof (UINT64)) - return FFI_TYPE_UINT64; - - return FFI_TYPE_STRUCT; -} - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register unsigned int avn; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - argp = stack; - - if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) - { - *(void **) argp = ecif->rvalue; - argp += sizeof (UINT64); - } - - avn = ecif->cif->nargs; - p_argv = ecif->avalue; - - for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) - { - size_t z; - int align; - - z = (*p_arg)->size; - align = (*p_arg)->alignment; - if (z < sizeof (UINT32)) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(SINT64 *) argp = (SINT64) *(SINT8 *)(*p_argv); - break; - - case FFI_TYPE_UINT8: - *(UINT64 *) argp = (UINT64) *(UINT8 *)(*p_argv); - break; - - case FFI_TYPE_SINT16: - *(SINT64 *) argp = (SINT64) *(SINT16 *)(*p_argv); - break; - - case FFI_TYPE_UINT16: - *(UINT64 *) argp = (UINT64) *(UINT16 *)(*p_argv); - break; - - case FFI_TYPE_STRUCT: - memcpy (argp, *p_argv, z); - break; - - default: - FFI_ASSERT(0); - } - argp += sizeof (UINT64); - } - else if (z == sizeof (UINT32) && align == sizeof (UINT32)) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - *(SINT64 *) argp = (SINT64) *(SINT32 *) (*p_argv); - break; - - case FFI_TYPE_FLOAT: - case FFI_TYPE_POINTER: - case FFI_TYPE_UINT32: - case FFI_TYPE_STRUCT: - *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); - break; - - default: - FFI_ASSERT(0); - break; - } - argp += sizeof (UINT64); - } - else if (z == sizeof (UINT64) - && align == sizeof (UINT64) - && ((int) *p_argv & (sizeof (UINT64) - 1)) == 0) - { - *(UINT64 *) argp = *(UINT64 *) (*p_argv); - argp += sizeof (UINT64); - } - else - { - int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); - - memcpy (argp, *p_argv, z); - argp += n * sizeof (UINT64); - } - } - - return; -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - int i, j; - int size, type; - int n, m; - int greg; - int freg; - int fpair = -1; - - greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0); - freg = 0; - cif->flags2 = 0; - - for (i = j = 0; i < cif->nargs; i++) - { - type = (cif->arg_types)[i]->type; - switch (type) - { - case FFI_TYPE_FLOAT: - greg++; - cif->bytes += sizeof (UINT64) - sizeof (float); - if (freg >= NFREGARG - 1) - continue; - if (fpair < 0) - { - fpair = freg; - freg += 2; - } - else - fpair = -1; - cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); - break; - - case FFI_TYPE_DOUBLE: - if (greg++ >= NGREGARG && (freg + 1) >= NFREGARG) - continue; - if ((freg + 1) < NFREGARG) - { - freg += 2; - cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); - } - else - cif->flags2 += FFI_TYPE_INT << (2 * j++); - break; - - default: - size = (cif->arg_types)[i]->size; - if (size < sizeof (UINT64)) - cif->bytes += sizeof (UINT64) - size; - n = (size + sizeof (UINT64) - 1) / sizeof (UINT64); - if (greg >= NGREGARG) - continue; - else if (greg + n - 1 >= NGREGARG) - greg = NGREGARG; - else - greg += n; - for (m = 0; m < n; m++) - cif->flags2 += FFI_TYPE_INT << (2 * j++); - break; - } - } - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_STRUCT: - cif->flags = return_type (cif->rtype); - break; - - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - cif->flags = cif->rtype->type; - break; - - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -/*@-declundef@*/ -/*@-exportheader@*/ -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), - /*@out@*/ extended_cif *, - unsigned, unsigned, long long, - /*@out@*/ unsigned *, - void (*fn)(void)); -/*@=declundef@*/ -/*@=exportheader@*/ - -void ffi_call(/*@dependent@*/ ffi_cif *cif, - void (*fn)(void), - /*@out@*/ void *rvalue, - /*@dependent@*/ void **avalue) -{ - extended_cif ecif; - UINT64 trvalue; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if (cif->rtype->type == FFI_TYPE_STRUCT - && return_type (cif->rtype) != FFI_TYPE_STRUCT) - ecif.rvalue = &trvalue; - else if ((rvalue == NULL) && - (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2, - ecif.rvalue, fn); - break; - default: - FFI_ASSERT(0); - break; - } - - if (rvalue - && cif->rtype->type == FFI_TYPE_STRUCT - && return_type (cif->rtype) != FFI_TYPE_STRUCT) - memcpy (rvalue, &trvalue, cif->rtype->size); -} - -extern void ffi_closure_SYSV (void); -extern void __ic_invalidate (void *line); - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp; - - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - tramp = (unsigned int *) &closure->tramp[0]; - /* Since ffi_closure is an aligned object, the ffi trampoline is - called as an SHcompact code. Sigh. - SHcompact part: - mova @(1,pc),r0; add #1,r0; jmp @r0; nop; - SHmedia part: - movi fnaddr >> 16,r1; shori fnaddr,r1; ptabs/l r1,tr0 - movi cxt >> 16,r1; shori cxt,r1; blink tr0,r63 */ -#ifdef __LITTLE_ENDIAN__ - tramp[0] = 0x7001c701; - tramp[1] = 0x0009402b; -#else - tramp[0] = 0xc7017001; - tramp[1] = 0x402b0009; -#endif - tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10; - tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10; - tramp[4] = 0x6bf10600; - tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10; - tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10; - tramp[7] = 0x4401fff0; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - /* Flush the icache. */ - asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp), - "r"(codeloc)); - - return FFI_OK; -} - -/* Basically the trampoline invokes ffi_closure_SYSV, and on - * entry, r3 holds the address of the closure. - * After storing the registers that could possibly contain - * parameters to be passed into the stack frame and setting - * up space for a return value, ffi_closure_SYSV invokes the - * following helper function to do most of the work. - */ - -int -ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, - UINT64 *pgr, UINT64 *pfr, UINT64 *pst) -{ - void **avalue; - ffi_type **p_arg; - int i, avn; - int greg, freg; - ffi_cif *cif; - int fpair = -1; - - cif = closure->cif; - avalue = alloca (cif->nargs * sizeof (void *)); - - /* Copy the caller's structure return value address so that the closure - returns the data directly to the caller. */ - if (return_type (cif->rtype) == FFI_TYPE_STRUCT) - { - rvalue = (UINT64 *) *pgr; - greg = 1; - } - else - greg = 0; - - freg = 0; - cif = closure->cif; - avn = cif->nargs; - - /* Grab the addresses of the arguments from the stack frame. */ - for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) - { - size_t z; - void *p; - - z = (*p_arg)->size; - if (z < sizeof (UINT32)) - { - p = pgr + greg++; - - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - case FFI_TYPE_STRUCT: -#ifdef __LITTLE_ENDIAN__ - avalue[i] = p; -#else - avalue[i] = ((char *) p) + sizeof (UINT32) - z; -#endif - break; - - default: - FFI_ASSERT(0); - } - } - else if (z == sizeof (UINT32)) - { - if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - if (freg < NFREGARG - 1) - { - if (fpair >= 0) - { - avalue[i] = (UINT32 *) pfr + fpair; - fpair = -1; - } - else - { -#ifdef __LITTLE_ENDIAN__ - fpair = freg; - avalue[i] = (UINT32 *) pfr + (1 ^ freg); -#else - fpair = 1 ^ freg; - avalue[i] = (UINT32 *) pfr + freg; -#endif - freg += 2; - } - } - else -#ifdef __LITTLE_ENDIAN__ - avalue[i] = pgr + greg; -#else - avalue[i] = (UINT32 *) (pgr + greg) + 1; -#endif - } - else -#ifdef __LITTLE_ENDIAN__ - avalue[i] = pgr + greg; -#else - avalue[i] = (UINT32 *) (pgr + greg) + 1; -#endif - greg++; - } - else if ((*p_arg)->type == FFI_TYPE_DOUBLE) - { - if (freg + 1 >= NFREGARG) - avalue[i] = pgr + greg; - else - { - avalue[i] = pfr + (freg >> 1); - freg += 2; - } - greg++; - } - else - { - int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); - - avalue[i] = pgr + greg; - greg += n; - } - } - - (closure->fun) (cif, rvalue, avalue, closure->user_data); - - /* Tell ffi_closure_SYSV how to perform return type promotions. */ - return return_type (cif->rtype); -} - diff --git a/llgo/third_party/gofrontend/libffi/src/sh64/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/sh64/ffitarget.h deleted file mode 100644 index 08a6fe96cc71d72e8d7d1daeb3677c607ca28fd2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh64/ffitarget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for SuperH - SHmedia. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- Generic type definitions ----------------------------------------- */ - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; - -#define FFI_EXTRA_CIF_FIELDS long long flags2 -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 32 -#define FFI_NATIVE_RAW_API 0 - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/sh64/sysv.S b/llgo/third_party/gofrontend/libffi/src/sh64/sysv.S deleted file mode 100644 index c4587d5f3e732b0b4ecd0471db1342b69813fd5c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sh64/sysv.S +++ /dev/null @@ -1,539 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima - - SuperH SHmedia Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -/* XXX these lose for some platforms, I'm sure. */ -#define CNAME(x) x -#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): -#endif - -#ifdef __LITTLE_ENDIAN__ -#define OFS_FLT 0 -#else -#define OFS_FLT 4 -#endif - - .section .text..SHmedia32,"ax" - - # r2: ffi_prep_args - # r3: &ecif - # r4: bytes - # r5: flags - # r6: flags2 - # r7: rvalue - # r8: fn - - # This assumes we are using gas. - .align 5 -ENTRY(ffi_call_SYSV) - # Save registers -.LFB1: - addi.l r15, -48, r15 -.LCFI0: - st.q r15, 40, r32 - st.q r15, 32, r31 - st.q r15, 24, r30 - st.q r15, 16, r29 - st.q r15, 8, r28 - st.l r15, 4, r18 - st.l r15, 0, r14 -.LCFI1: - add.l r15, r63, r14 -.LCFI2: -# add r4, r63, r28 - add r5, r63, r29 - add r6, r63, r30 - add r7, r63, r31 - add r8, r63, r32 - - addi r4, (64 + 7), r4 - andi r4, ~7, r4 - sub.l r15, r4, r15 - - ptabs/l r2, tr0 - add r15, r63, r2 - blink tr0, r18 - - addi r15, 64, r22 - movi 0, r0 - movi 0, r1 - movi -1, r23 - - pt/l 1f, tr1 - bnei/l r29, FFI_TYPE_STRUCT, tr1 - ld.l r15, 0, r19 - addi r15, 8, r15 - addi r0, 1, r0 -1: - -.L_pass: - andi r30, 3, r20 - shlri r30, 2, r30 - - pt/l .L_call_it, tr0 - pt/l .L_pass_i, tr1 - pt/l .L_pass_f, tr2 - - beqi/l r20, FFI_TYPE_VOID, tr0 - beqi/l r20, FFI_TYPE_INT, tr1 - beqi/l r20, FFI_TYPE_FLOAT, tr2 - -.L_pass_d: - addi r0, 1, r0 - pt/l 3f, tr0 - movi 12, r20 - bge/l r1, r20, tr0 - - pt/l .L_pop_d, tr1 - pt/l 2f, tr0 - blink tr1, r63 -2: - addi.l r15, 8, r15 -3: - pt/l .L_pass, tr0 - addi r1, 2, r1 - blink tr0, r63 - -.L_pop_d: - pt/l .L_pop_d_tbl, tr1 - gettr tr1, r20 - shlli r1, 2, r21 - add r20, r21, r20 - ptabs/l r20, tr1 - blink tr1, r63 - -.L_pop_d_tbl: - fld.d r15, 0, dr0 - blink tr0, r63 - fld.d r15, 0, dr2 - blink tr0, r63 - fld.d r15, 0, dr4 - blink tr0, r63 - fld.d r15, 0, dr6 - blink tr0, r63 - fld.d r15, 0, dr8 - blink tr0, r63 - fld.d r15, 0, dr10 - blink tr0, r63 - -.L_pass_f: - addi r0, 1, r0 - pt/l 3f, tr0 - movi 12, r20 - bge/l r1, r20, tr0 - - pt/l .L_pop_f, tr1 - pt/l 2f, tr0 - blink tr1, r63 -2: - addi.l r15, 8, r15 -3: - pt/l .L_pass, tr0 - blink tr0, r63 - -.L_pop_f: - pt/l .L_pop_f_tbl, tr1 - pt/l 5f, tr2 - gettr tr1, r20 - bge/l r23, r63, tr2 - add r1, r63, r23 - shlli r1, 3, r21 - addi r1, 2, r1 - add r20, r21, r20 - ptabs/l r20, tr1 - blink tr1, r63 -5: - addi r23, 1, r21 - movi -1, r23 - shlli r21, 3, r21 - add r20, r21, r20 - ptabs/l r20, tr1 - blink tr1, r63 - -.L_pop_f_tbl: - fld.s r15, OFS_FLT, fr0 - blink tr0, r63 - fld.s r15, OFS_FLT, fr1 - blink tr0, r63 - fld.s r15, OFS_FLT, fr2 - blink tr0, r63 - fld.s r15, OFS_FLT, fr3 - blink tr0, r63 - fld.s r15, OFS_FLT, fr4 - blink tr0, r63 - fld.s r15, OFS_FLT, fr5 - blink tr0, r63 - fld.s r15, OFS_FLT, fr6 - blink tr0, r63 - fld.s r15, OFS_FLT, fr7 - blink tr0, r63 - fld.s r15, OFS_FLT, fr8 - blink tr0, r63 - fld.s r15, OFS_FLT, fr9 - blink tr0, r63 - fld.s r15, OFS_FLT, fr10 - blink tr0, r63 - fld.s r15, OFS_FLT, fr11 - blink tr0, r63 - -.L_pass_i: - pt/l 3f, tr0 - movi 8, r20 - bge/l r0, r20, tr0 - - pt/l .L_pop_i, tr1 - pt/l 2f, tr0 - blink tr1, r63 -2: - addi.l r15, 8, r15 -3: - pt/l .L_pass, tr0 - addi r0, 1, r0 - blink tr0, r63 - -.L_pop_i: - pt/l .L_pop_i_tbl, tr1 - gettr tr1, r20 - shlli r0, 3, r21 - add r20, r21, r20 - ptabs/l r20, tr1 - blink tr1, r63 - -.L_pop_i_tbl: - ld.q r15, 0, r2 - blink tr0, r63 - ld.q r15, 0, r3 - blink tr0, r63 - ld.q r15, 0, r4 - blink tr0, r63 - ld.q r15, 0, r5 - blink tr0, r63 - ld.q r15, 0, r6 - blink tr0, r63 - ld.q r15, 0, r7 - blink tr0, r63 - ld.q r15, 0, r8 - blink tr0, r63 - ld.q r15, 0, r9 - blink tr0, r63 - -.L_call_it: - # call function - pt/l 1f, tr1 - bnei/l r29, FFI_TYPE_STRUCT, tr1 - add r19, r63, r2 -1: - add r22, r63, r15 - ptabs/l r32, tr0 - blink tr0, r18 - - pt/l .L_ret_i, tr0 - pt/l .L_ret_ll, tr1 - pt/l .L_ret_d, tr2 - pt/l .L_ret_f, tr3 - pt/l .L_epilogue, tr4 - - beqi/l r29, FFI_TYPE_INT, tr0 - beqi/l r29, FFI_TYPE_UINT32, tr0 - beqi/l r29, FFI_TYPE_SINT64, tr1 - beqi/l r29, FFI_TYPE_UINT64, tr1 - beqi/l r29, FFI_TYPE_DOUBLE, tr2 - beqi/l r29, FFI_TYPE_FLOAT, tr3 - - pt/l .L_ret_q, tr0 - pt/l .L_ret_h, tr1 - - beqi/l r29, FFI_TYPE_UINT8, tr0 - beqi/l r29, FFI_TYPE_UINT16, tr1 - blink tr4, r63 - -.L_ret_d: - fst.d r31, 0, dr0 - blink tr4, r63 - -.L_ret_ll: - st.q r31, 0, r2 - blink tr4, r63 - -.L_ret_f: - fst.s r31, OFS_FLT, fr0 - blink tr4, r63 - -.L_ret_q: - st.b r31, 0, r2 - blink tr4, r63 - -.L_ret_h: - st.w r31, 0, r2 - blink tr4, r63 - -.L_ret_i: - st.l r31, 0, r2 - # Fall - -.L_epilogue: - # Remove the space we pushed for the args - add r14, r63, r15 - - ld.l r15, 0, r14 - ld.l r15, 4, r18 - ld.q r15, 8, r28 - ld.q r15, 16, r29 - ld.q r15, 24, r30 - ld.q r15, 32, r31 - ld.q r15, 40, r32 - addi.l r15, 48, r15 - ptabs r18, tr0 - blink tr0, r63 - -.LFE1: -.ffi_call_SYSV_end: - .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) - - .align 5 -ENTRY(ffi_closure_SYSV) -.LFB2: - addi.l r15, -136, r15 -.LCFI3: - st.l r15, 12, r18 - st.l r15, 8, r14 - st.l r15, 4, r12 -.LCFI4: - add r15, r63, r14 -.LCFI5: - /* Stack layout: - ... - 64 bytes (register parameters) - 48 bytes (floating register parameters) - 8 bytes (result) - 4 bytes (r18) - 4 bytes (r14) - 4 bytes (r12) - 4 bytes (for align) - <- new stack pointer - */ - fst.d r14, 24, dr0 - fst.d r14, 32, dr2 - fst.d r14, 40, dr4 - fst.d r14, 48, dr6 - fst.d r14, 56, dr8 - fst.d r14, 64, dr10 - st.q r14, 72, r2 - st.q r14, 80, r3 - st.q r14, 88, r4 - st.q r14, 96, r5 - st.q r14, 104, r6 - st.q r14, 112, r7 - st.q r14, 120, r8 - st.q r14, 128, r9 - - add r1, r63, r2 - addi r14, 16, r3 - addi r14, 72, r4 - addi r14, 24, r5 - addi r14, 136, r6 -#ifdef PIC - movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12 - shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12 -.LPCS0: ptrel/u r12, tr0 - movi ((ffi_closure_helper_SYSV@GOTPLT) & 65535), r1 - gettr tr0, r12 - ldx.l r1, r12, r1 - ptabs r1, tr0 -#else - pt/l ffi_closure_helper_SYSV, tr0 -#endif - blink tr0, r18 - - shlli r2, 1, r1 - movi (((datalabel .L_table) >> 16) & 65535), r2 - shori ((datalabel .L_table) & 65535), r2 - ldx.w r2, r1, r1 - add r1, r2, r1 - pt/l .L_case_v, tr1 - ptabs r1, tr0 - blink tr0, r63 - - .align 2 -.L_table: - .word .L_case_v - datalabel .L_table /* FFI_TYPE_VOID */ - .word .L_case_i - datalabel .L_table /* FFI_TYPE_INT */ - .word .L_case_f - datalabel .L_table /* FFI_TYPE_FLOAT */ - .word .L_case_d - datalabel .L_table /* FFI_TYPE_DOUBLE */ - .word .L_case_d - datalabel .L_table /* FFI_TYPE_LONGDOUBLE */ - .word .L_case_uq - datalabel .L_table /* FFI_TYPE_UINT8 */ - .word .L_case_q - datalabel .L_table /* FFI_TYPE_SINT8 */ - .word .L_case_uh - datalabel .L_table /* FFI_TYPE_UINT16 */ - .word .L_case_h - datalabel .L_table /* FFI_TYPE_SINT16 */ - .word .L_case_i - datalabel .L_table /* FFI_TYPE_UINT32 */ - .word .L_case_i - datalabel .L_table /* FFI_TYPE_SINT32 */ - .word .L_case_ll - datalabel .L_table /* FFI_TYPE_UINT64 */ - .word .L_case_ll - datalabel .L_table /* FFI_TYPE_SINT64 */ - .word .L_case_v - datalabel .L_table /* FFI_TYPE_STRUCT */ - .word .L_case_i - datalabel .L_table /* FFI_TYPE_POINTER */ - - .align 2 -.L_case_d: - fld.d r14, 16, dr0 - blink tr1, r63 -.L_case_f: - fld.s r14, 16, fr0 - blink tr1, r63 -.L_case_ll: - ld.q r14, 16, r2 - blink tr1, r63 -.L_case_i: - ld.l r14, 16, r2 - blink tr1, r63 -.L_case_q: - ld.b r14, 16, r2 - blink tr1, r63 -.L_case_uq: - ld.ub r14, 16, r2 - blink tr1, r63 -.L_case_h: - ld.w r14, 16, r2 - blink tr1, r63 -.L_case_uh: - ld.uw r14, 16, r2 - blink tr1, r63 -.L_case_v: - add.l r14, r63, r15 - ld.l r15, 4, r12 - ld.l r15, 8, r14 - ld.l r15, 12, r18 - addi.l r15, 136, r15 - ptabs r18, tr0 - blink tr0, r63 - -.LFE2: -.ffi_closure_SYSV_end: - .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif - - .section ".eh_frame","aw",@progbits -__FRAME_BEGIN__: - .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ -.LSCIE1: - .4byte 0x0 /* CIE Identifier Tag */ - .byte 0x1 /* CIE Version */ -#ifdef PIC - .ascii "zR\0" /* CIE Augmentation */ -#else - .byte 0x0 /* CIE Augmentation */ -#endif - .uleb128 0x1 /* CIE Code Alignment Factor */ - .sleb128 -4 /* CIE Data Alignment Factor */ - .byte 0x12 /* CIE RA Column */ -#ifdef PIC - .uleb128 0x1 /* Augmentation size */ - .byte 0x10 /* FDE Encoding (pcrel) */ -#endif - .byte 0xc /* DW_CFA_def_cfa */ - .uleb128 0xf - .uleb128 0x0 - .align 2 -.LECIE1: -.LSFDE1: - .4byte datalabel .LEFDE1-datalabel .LASFDE1 /* FDE Length */ -.LASFDE1: - .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ -#ifdef PIC - .4byte .LFB1-. /* FDE initial location */ -#else - .4byte .LFB1 /* FDE initial location */ -#endif - .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ -#ifdef PIC - .uleb128 0x0 /* Augmentation size */ -#endif - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI0-datalabel .LFB1 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .uleb128 0x30 - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI1-datalabel .LCFI0 - .byte 0x8e /* DW_CFA_offset, column 0xe */ - .uleb128 0xc - .byte 0x92 /* DW_CFA_offset, column 0x12 */ - .uleb128 0xb - .byte 0x9c /* DW_CFA_offset, column 0x1c */ - .uleb128 0xa - .byte 0x9d /* DW_CFA_offset, column 0x1d */ - .uleb128 0x8 - .byte 0x9e /* DW_CFA_offset, column 0x1e */ - .uleb128 0x6 - .byte 0x9f /* DW_CFA_offset, column 0x1f */ - .uleb128 0x4 - .byte 0xa0 /* DW_CFA_offset, column 0x20 */ - .uleb128 0x2 - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI2-datalabel .LCFI1 - .byte 0xd /* DW_CFA_def_cfa_register */ - .uleb128 0xe - .align 2 -.LEFDE1: - -.LSFDE3: - .4byte datalabel .LEFDE3-datalabel .LASFDE3 /* FDE Length */ -.LASFDE3: - .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ -#ifdef PIC - .4byte .LFB2-. /* FDE initial location */ -#else - .4byte .LFB2 /* FDE initial location */ -#endif - .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ -#ifdef PIC - .uleb128 0x0 /* Augmentation size */ -#endif - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI3-datalabel .LFB2 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .uleb128 0x88 - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI4-datalabel .LCFI3 - .byte 0x8c /* DW_CFA_offset, column 0xc */ - .uleb128 0x21 - .byte 0x8e /* DW_CFA_offset, column 0xe */ - .uleb128 0x20 - .byte 0x92 /* DW_CFA_offset, column 0x12 */ - .uleb128 0x1f - .byte 0x4 /* DW_CFA_advance_loc4 */ - .4byte datalabel .LCFI5-datalabel .LCFI4 - .byte 0xd /* DW_CFA_def_cfa_register */ - .uleb128 0xe - .align 2 -.LEFDE3: diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/ffi.c b/llgo/third_party/gofrontend/libffi/src/sparc/ffi.c deleted file mode 100644 index d5212d86e419f4b961d13c808ab48e4cf2934342..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/ffi.c +++ /dev/null @@ -1,468 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011, 2013 Anthony Green - Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. - - SPARC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include "internal.h" - -#ifndef SPARC64 - -/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -# if FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -#else -# undef FFI_TYPE_LONGDOUBLE -# define FFI_TYPE_LONGDOUBLE 4 -#endif - -/* Perform machine dependent cif processing */ -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep(ffi_cif *cif) -{ - ffi_type *rtype = cif->rtype; - int rtt = rtype->type; - size_t bytes; - int i, n, flags; - - /* Set the return type flag */ - switch (rtt) - { - case FFI_TYPE_VOID: - flags = SPARC_RET_VOID; - break; - case FFI_TYPE_FLOAT: - flags = SPARC_RET_F_1; - break; - case FFI_TYPE_DOUBLE: - flags = SPARC_RET_F_2; - break; - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_STRUCT: - flags = (rtype->size & 0xfff) << SPARC_SIZEMASK_SHIFT; - flags |= SPARC_RET_STRUCT; - break; - case FFI_TYPE_SINT8: - flags = SPARC_RET_SINT8; - break; - case FFI_TYPE_UINT8: - flags = SPARC_RET_UINT8; - break; - case FFI_TYPE_SINT16: - flags = SPARC_RET_SINT16; - break; - case FFI_TYPE_UINT16: - flags = SPARC_RET_UINT16; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - flags = SPARC_RET_UINT32; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - flags = SPARC_RET_INT64; - break; - case FFI_TYPE_COMPLEX: - rtt = rtype->elements[0]->type; - switch (rtt) - { - case FFI_TYPE_FLOAT: - flags = SPARC_RET_F_2; - break; - case FFI_TYPE_DOUBLE: - flags = SPARC_RET_F_4; - break; - case FFI_TYPE_LONGDOUBLE: - flags = SPARC_RET_F_8; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - flags = SPARC_RET_INT128; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - flags = SPARC_RET_INT64; - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - flags = SP_V8_RET_CPLX16; - break; - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - flags = SP_V8_RET_CPLX8; - break; - default: - abort(); - } - break; - default: - abort(); - } - cif->flags = flags; - - bytes = 0; - for (i = 0, n = cif->nargs; i < n; ++i) - { - ffi_type *ty = cif->arg_types[i]; - size_t z = ty->size; - int tt = ty->type; - - switch (tt) - { - case FFI_TYPE_STRUCT: - case FFI_TYPE_LONGDOUBLE: - by_reference: - /* Passed by reference. */ - z = 4; - break; - - case FFI_TYPE_COMPLEX: - tt = ty->elements[0]->type; - if (tt == FFI_TYPE_FLOAT || z > 8) - goto by_reference; - /* FALLTHRU */ - - default: - z = ALIGN(z, 4); - } - bytes += z; - } - - /* Sparc call frames require that space is allocated for 6 args, - even if they aren't used. Make that space if necessary. */ - if (bytes < 6 * 4) - bytes = 6 * 4; - - /* The ABI always requires space for the struct return pointer. */ - bytes += 4; - - /* The stack must be 2 word aligned, so round bytes up appropriately. */ - bytes = ALIGN(bytes, 2 * 4); - - /* Include the call frame to prep_args. */ - bytes += 4*16 + 4*8; - cif->bytes = bytes; - - return FFI_OK; -} - -extern void ffi_call_v8(ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, size_t bytes, void *closure) FFI_HIDDEN; - -int FFI_HIDDEN -ffi_prep_args_v8(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue) -{ - ffi_type **p_arg; - int flags = cif->flags; - int i, nargs; - - if (rvalue == NULL) - { - if ((flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT) - { - /* Since we pass the pointer to the callee, we need a value. - We allowed for this space in ffi_call, before ffi_call_v8 - alloca'd the space. */ - rvalue = (char *)argp + cif->bytes; - } - else - { - /* Otherwise, we can ignore the return value. */ - flags = SPARC_RET_VOID; - } - } - - /* This could only really be done when we are returning a structure. - However, the space is reserved so we can do it unconditionally. */ - *argp++ = (unsigned long)rvalue; - -#ifdef USING_PURIFY - /* Purify will probably complain in our assembly routine, - unless we zero out this memory. */ - memset(argp, 0, 6*4); -#endif - - p_arg = cif->arg_types; - for (i = 0, nargs = cif->nargs; i < nargs; i++) - { - ffi_type *ty = p_arg[i]; - void *a = avalue[i]; - int tt = ty->type; - size_t z; - - switch (tt) - { - case FFI_TYPE_STRUCT: - case FFI_TYPE_LONGDOUBLE: - by_reference: - *argp++ = (unsigned long)a; - break; - - case FFI_TYPE_DOUBLE: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - memcpy(argp, a, 8); - argp += 2; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_FLOAT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - *argp++ = *(unsigned *)a; - break; - - case FFI_TYPE_UINT8: - *argp++ = *(UINT8 *)a; - break; - case FFI_TYPE_SINT8: - *argp++ = *(SINT8 *)a; - break; - case FFI_TYPE_UINT16: - *argp++ = *(UINT16 *)a; - break; - case FFI_TYPE_SINT16: - *argp++ = *(SINT16 *)a; - break; - - case FFI_TYPE_COMPLEX: - tt = ty->elements[0]->type; - z = ty->size; - if (tt == FFI_TYPE_FLOAT || z > 8) - goto by_reference; - if (z < 4) - { - memcpy((char *)argp + 4 - z, a, z); - argp++; - } - else - { - memcpy(argp, a, z); - argp += z / 4; - } - break; - - default: - abort(); - } - } - - return flags; -} - -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - size_t bytes = cif->bytes; - - FFI_ASSERT (cif->abi == FFI_V8); - - /* If we've not got a return value, we need to create one if we've - got to pass the return value to the callee. Otherwise ignore it. */ - if (rvalue == NULL - && (cif->flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT) - bytes += ALIGN (cif->rtype->size, 8); - - ffi_call_v8(cif, fn, rvalue, avalue, -bytes, closure); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - -#ifdef __GNUC__ -static inline void -ffi_flush_icache (void *p) -{ - /* SPARC v8 requires 5 instructions for flush to be visible */ - asm volatile ("iflush %0; iflush %0+8; nop; nop; nop; nop; nop" - : : "r" (p) : "memory"); -} -#else -extern void ffi_flush_icache (void *) FFI_HIDDEN; -#endif - -extern void ffi_closure_v8(void) FFI_HIDDEN; -extern void ffi_go_closure_v8(void) FFI_HIDDEN; - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - unsigned long ctx = (unsigned long) closure; - unsigned long fn = (unsigned long) ffi_closure_v8; - - if (cif->abi != FFI_V8) - return FFI_BAD_ABI; - - tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ - tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ - tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */ - tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */ - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - ffi_flush_icache (closure); - - return FFI_OK; -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*)) -{ - if (cif->abi != FFI_V8) - return FFI_BAD_ABI; - - closure->tramp = ffi_go_closure_v8; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -int FFI_HIDDEN -ffi_closure_sparc_inner_v8(ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, void *rvalue, - unsigned long *argp) -{ - ffi_type **arg_types; - void **avalue; - int i, nargs, flags; - - arg_types = cif->arg_types; - nargs = cif->nargs; - flags = cif->flags; - avalue = alloca(nargs * sizeof(void *)); - - /* Copy the caller's structure return address so that the closure - returns the data directly to the caller. Also install it so we - can return the address in %o0. */ - if ((flags & SPARC_FLAG_RET_MASK) == SPARC_RET_STRUCT) - { - void *new_rvalue = (void *)*argp; - *(void **)rvalue = new_rvalue; - rvalue = new_rvalue; - } - - /* Always skip the structure return address. */ - argp++; - - /* Grab the addresses of the arguments from the stack frame. */ - for (i = 0; i < nargs; i++) - { - ffi_type *ty = arg_types[i]; - int tt = ty->type; - void *a = argp; - size_t z; - - switch (tt) - { - case FFI_TYPE_STRUCT: - case FFI_TYPE_LONGDOUBLE: - by_reference: - /* Straight copy of invisible reference. */ - a = (void *)*argp; - break; - - case FFI_TYPE_DOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - if ((unsigned long)a & 7) - { - /* Align on a 8-byte boundary. */ - UINT64 *tmp = alloca(8); - *tmp = ((UINT64)argp[0] << 32) | argp[1]; - a = tmp; - } - argp++; - break; - - case FFI_TYPE_INT: - case FFI_TYPE_FLOAT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - break; - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - a += 2; - break; - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - a += 3; - break; - - case FFI_TYPE_COMPLEX: - tt = ty->elements[0]->type; - z = ty->size; - if (tt == FFI_TYPE_FLOAT || z > 8) - goto by_reference; - if (z < 4) - a += 4 - z; - else if (z > 4) - argp++; - break; - - default: - abort(); - } - argp++; - avalue[i] = a; - } - - /* Invoke the closure. */ - fun (cif, rvalue, avalue, user_data); - - /* Tell ffi_closure_sparc how to perform return type promotions. */ - return flags; -} -#endif /* !SPARC64 */ diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/ffi64.c b/llgo/third_party/gofrontend/libffi/src/sparc/ffi64.c deleted file mode 100644 index 340b19823211d973d9ecf5a76dc8d273e2f92cc5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/ffi64.c +++ /dev/null @@ -1,608 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2011, 2013 Anthony Green - Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. - - SPARC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include "internal.h" - -/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -# if FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -#else -# undef FFI_TYPE_LONGDOUBLE -# define FFI_TYPE_LONGDOUBLE 4 -#endif - -#ifdef SPARC64 - -/* Flatten the contents of a structure to the parts that are passed in - floating point registers. The return is a bit mask wherein bit N - set means bytes [4*n, 4*n+3] are passed in %fN. - - We encode both the (running) size (maximum 32) and mask (maxumum 255) - into one integer. The size is placed in the low byte, so that align - and addition work correctly. The mask is placed in the second byte. */ - -static int -ffi_struct_float_mask (ffi_type *outer_type, int size_mask) -{ - ffi_type **elts; - ffi_type *t; - - if (outer_type->type == FFI_TYPE_COMPLEX) - { - int m = 0, tt = outer_type->elements[0]->type; - size_t z = outer_type->size; - - if (tt == FFI_TYPE_FLOAT - || tt == FFI_TYPE_DOUBLE - || tt == FFI_TYPE_LONGDOUBLE) - m = (1 << (z / 4)) - 1; - return (m << 8) | z; - } - FFI_ASSERT (outer_type->type == FFI_TYPE_STRUCT); - - for (elts = outer_type->elements; (t = *elts) != NULL; elts++) - { - size_t z = t->size; - int o, m, tt; - - size_mask = ALIGN(size_mask, t->alignment); - switch (t->type) - { - case FFI_TYPE_STRUCT: - size_mask = ffi_struct_float_mask (t, size_mask); - continue; - case FFI_TYPE_COMPLEX: - tt = t->elements[0]->type; - if (tt != FFI_TYPE_FLOAT - && tt != FFI_TYPE_DOUBLE - && tt != FFI_TYPE_LONGDOUBLE) - break; - /* FALLTHRU */ - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - m = (1 << (z / 4)) - 1; /* compute mask for type */ - o = (size_mask >> 2) & 0x3f; /* extract word offset */ - size_mask |= m << (o + 8); /* insert mask into place */ - break; - } - size_mask += z; - } - - size_mask = ALIGN(size_mask, outer_type->alignment); - FFI_ASSERT ((size_mask & 0xff) == outer_type->size); - - return size_mask; -} - -/* Merge floating point data into integer data. If the structure is - entirely floating point, simply return a pointer to the fp data. */ - -static void * -ffi_struct_float_merge (int size_mask, void *vi, void *vf) -{ - int size = size_mask & 0xff; - int mask = size_mask >> 8; - int n = size >> 2; - - if (mask == 0) - return vi; - else if (mask == (1 << n) - 1) - return vf; - else - { - unsigned int *wi = vi, *wf = vf; - int i; - - for (i = 0; i < n; ++i) - if ((mask >> i) & 1) - wi[i] = wf[i]; - - return vi; - } -} - -/* Similar, but place the data into VD in the end. */ - -void FFI_HIDDEN -ffi_struct_float_copy (int size_mask, void *vd, void *vi, void *vf) -{ - int size = size_mask & 0xff; - int mask = size_mask >> 8; - int n = size >> 2; - - if (mask == 0) - ; - else if (mask == (1 << n) - 1) - vi = vf; - else - { - unsigned int *wd = vd, *wi = vi, *wf = vf; - int i; - - for (i = 0; i < n; ++i) - wd[i] = ((mask >> i) & 1 ? wf : wi)[i]; - return; - } - memcpy (vd, vi, size); -} - -/* Perform machine dependent cif processing */ - -static ffi_status -ffi_prep_cif_machdep_core(ffi_cif *cif) -{ - ffi_type *rtype = cif->rtype; - int rtt = rtype->type; - size_t bytes = 0; - int i, n, flags; - - /* Set the return type flag */ - switch (rtt) - { - case FFI_TYPE_VOID: - flags = SPARC_RET_VOID; - break; - case FFI_TYPE_FLOAT: - flags = SPARC_RET_F_1; - break; - case FFI_TYPE_DOUBLE: - flags = SPARC_RET_F_2; - break; - case FFI_TYPE_LONGDOUBLE: - flags = SPARC_RET_F_4; - break; - - case FFI_TYPE_COMPLEX: - case FFI_TYPE_STRUCT: - if (rtype->size > 32) - { - flags = SPARC_RET_VOID | SPARC_FLAG_RET_IN_MEM; - bytes = 8; - } - else - { - int size_mask = ffi_struct_float_mask (rtype, 0); - int word_size = (size_mask >> 2) & 0x3f; - int all_mask = (1 << word_size) - 1; - int fp_mask = size_mask >> 8; - - flags = (size_mask << SPARC_SIZEMASK_SHIFT) | SPARC_RET_STRUCT; - - /* For special cases of all-int or all-fp, we can return - the value directly without popping through a struct copy. */ - if (fp_mask == 0) - { - if (rtype->alignment >= 8) - { - if (rtype->size == 8) - flags = SPARC_RET_INT64; - else if (rtype->size == 16) - flags = SPARC_RET_INT128; - } - } - else if (fp_mask == all_mask) - switch (word_size) - { - case 1: flags = SPARC_RET_F_1; break; - case 2: flags = SPARC_RET_F_2; break; - case 3: flags = SP_V9_RET_F_3; break; - case 4: flags = SPARC_RET_F_4; break; - /* 5 word structures skipped; handled via RET_STRUCT. */ - case 6: flags = SPARC_RET_F_6; break; - /* 7 word structures skipped; handled via RET_STRUCT. */ - case 8: flags = SPARC_RET_F_8; break; - } - } - break; - - case FFI_TYPE_SINT8: - flags = SPARC_RET_SINT8; - break; - case FFI_TYPE_UINT8: - flags = SPARC_RET_UINT8; - break; - case FFI_TYPE_SINT16: - flags = SPARC_RET_SINT16; - break; - case FFI_TYPE_UINT16: - flags = SPARC_RET_UINT16; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - flags = SP_V9_RET_SINT32; - break; - case FFI_TYPE_UINT32: - flags = SPARC_RET_UINT32; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - flags = SPARC_RET_INT64; - break; - - default: - abort(); - } - - bytes = 0; - for (i = 0, n = cif->nargs; i < n; ++i) - { - ffi_type *ty = cif->arg_types[i]; - size_t z = ty->size; - size_t a = ty->alignment; - - switch (ty->type) - { - case FFI_TYPE_COMPLEX: - case FFI_TYPE_STRUCT: - /* Large structs passed by reference. */ - if (z > 16) - { - a = z = 8; - break; - } - /* Small structs may be passed in integer or fp regs or both. */ - if (bytes >= 16*8) - break; - if ((ffi_struct_float_mask (ty, 0) & 0xff00) == 0) - break; - /* FALLTHRU */ - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - flags |= SPARC_FLAG_FP_ARGS; - break; - } - bytes = ALIGN(bytes, a); - bytes += ALIGN(z, 8); - } - - /* Sparc call frames require that space is allocated for 6 args, - even if they aren't used. Make that space if necessary. */ - if (bytes < 6 * 8) - bytes = 6 * 8; - - /* The stack must be 2 word aligned, so round bytes up appropriately. */ - bytes = ALIGN(bytes, 16); - - /* Include the call frame to prep_args. */ - bytes += 8*16 + 8*8; - - cif->bytes = bytes; - cif->flags = flags; - return FFI_OK; -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep(ffi_cif *cif) -{ - cif->nfixedargs = cif->nargs; - return ffi_prep_cif_machdep_core(cif); -} - -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned nfixedargs, unsigned ntotalargs) -{ - cif->nfixedargs = nfixedargs; - return ffi_prep_cif_machdep_core(cif); -} - -extern void ffi_call_v9(ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, size_t bytes, void *closure) FFI_HIDDEN; - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -int FFI_HIDDEN -ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue) -{ - ffi_type **p_arg; - int flags = cif->flags; - int i, nargs; - - if (rvalue == NULL) - { - if (flags & SPARC_FLAG_RET_IN_MEM) - { - /* Since we pass the pointer to the callee, we need a value. - We allowed for this space in ffi_call, before ffi_call_v8 - alloca'd the space. */ - rvalue = (char *)argp + cif->bytes; - } - else - { - /* Otherwise, we can ignore the return value. */ - flags = SPARC_RET_VOID; - } - } - -#ifdef USING_PURIFY - /* Purify will probably complain in our assembly routine, - unless we zero out this memory. */ - memset(argp, 0, 6*8); -#endif - - if (flags & SPARC_FLAG_RET_IN_MEM) - *argp++ = (unsigned long)rvalue; - - p_arg = cif->arg_types; - for (i = 0, nargs = cif->nargs; i < nargs; i++) - { - ffi_type *ty = p_arg[i]; - void *a = avalue[i]; - size_t z; - - switch (ty->type) - { - case FFI_TYPE_SINT8: - *argp++ = *(SINT8 *)a; - break; - case FFI_TYPE_UINT8: - *argp++ = *(UINT8 *)a; - break; - case FFI_TYPE_SINT16: - *argp++ = *(SINT16 *)a; - break; - case FFI_TYPE_UINT16: - *argp++ = *(UINT16 *)a; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - *argp++ = *(SINT32 *)a; - break; - case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: - *argp++ = *(UINT32 *)a; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_POINTER: - case FFI_TYPE_DOUBLE: - *argp++ = *(UINT64 *)a; - break; - - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_COMPLEX: - case FFI_TYPE_STRUCT: - z = ty->size; - if (z > 16) - { - /* For structures larger than 16 bytes we pass reference. */ - *argp++ = (unsigned long)a; - break; - } - if (((unsigned long)argp & 15) && ty->alignment > 8) - argp++; - memcpy(argp, a, z); - argp += ALIGN(z, 8) / 8; - break; - - default: - abort(); - } - } - - return flags; -} - -static void -ffi_call_int(ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - size_t bytes = cif->bytes; - - FFI_ASSERT (cif->abi == FFI_V9); - - if (rvalue == NULL && (cif->flags & SPARC_FLAG_RET_IN_MEM)) - bytes += ALIGN (cif->rtype->size, 16); - - ffi_call_v9(cif, fn, rvalue, avalue, -bytes, closure); -} - -void -ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int(cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go(ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int(cif, fn, rvalue, avalue, closure); -} - -#ifdef __GNUC__ -static inline void -ffi_flush_icache (void *p) -{ - asm volatile ("flush %0; flush %0+8" : : "r" (p) : "memory"); -} -#else -extern void ffi_flush_icache (void *) FFI_HIDDEN; -#endif - -extern void ffi_closure_v9(void) FFI_HIDDEN; -extern void ffi_go_closure_v9(void) FFI_HIDDEN; - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - unsigned int *tramp = (unsigned int *) &closure->tramp[0]; - unsigned long fn; - - if (cif->abi != FFI_V9) - return FFI_BAD_ABI; - - /* Trampoline address is equal to the closure address. We take advantage - of that to reduce the trampoline size by 8 bytes. */ - fn = (unsigned long) ffi_closure_v9; - tramp[0] = 0x83414000; /* rd %pc, %g1 */ - tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ - tramp[2] = 0x81c14000; /* jmp %g5 */ - tramp[3] = 0x01000000; /* nop */ - *((unsigned long *) &tramp[4]) = fn; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - ffi_flush_icache (closure); - - return FFI_OK; -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*)) -{ - if (cif->abi != FFI_V9) - return FFI_BAD_ABI; - - closure->tramp = ffi_go_closure_v9; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -int FFI_HIDDEN -ffi_closure_sparc_inner_v9(ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, void *rvalue, - unsigned long *gpr, unsigned long *fpr) -{ - ffi_type **arg_types; - void **avalue; - int i, argn, argx, nargs, flags, nfixedargs; - - arg_types = cif->arg_types; - nargs = cif->nargs; - flags = cif->flags; - nfixedargs = cif->nfixedargs; - - avalue = alloca(nargs * sizeof(void *)); - - /* Copy the caller's structure return address so that the closure - returns the data directly to the caller. */ - if (flags & SPARC_FLAG_RET_IN_MEM) - { - rvalue = (void *) gpr[0]; - /* Skip the structure return address. */ - argn = 1; - } - else - argn = 0; - - /* Grab the addresses of the arguments from the stack frame. */ - for (i = 0; i < nargs; i++, argn = argx) - { - int named = i < nfixedargs; - ffi_type *ty = arg_types[i]; - void *a = &gpr[argn]; - size_t z; - - argx = argn + 1; - switch (ty->type) - { - case FFI_TYPE_COMPLEX: - case FFI_TYPE_STRUCT: - z = ty->size; - if (z > 16) - a = *(void **)a; - else - { - argx = argn + ALIGN (z, 8) / 8; - if (named && argn < 16) - { - int size_mask = ffi_struct_float_mask (ty, 0); - int argn_mask = (0xffff00 >> argn) & 0xff00; - - /* Eliminate fp registers off the end. */ - size_mask = (size_mask & 0xff) | (size_mask & argn_mask); - a = ffi_struct_float_merge (size_mask, gpr+argn, fpr+argn); - } - } - break; - - case FFI_TYPE_LONGDOUBLE: - argn = ALIGN (argn, 2); - a = (named && argn < 16 ? fpr : gpr) + argn; - argx = argn + 2; - break; - case FFI_TYPE_DOUBLE: - if (named && argn < 16) - a = fpr + argn; - break; - case FFI_TYPE_FLOAT: - if (named && argn < 16) - a = fpr + argn; - a += 4; - break; - - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - break; - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - a += 4; - break; - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - a += 6; - break; - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - a += 7; - break; - - default: - abort(); - } - avalue[i] = a; - } - - /* Invoke the closure. */ - fun (cif, rvalue, avalue, user_data); - - /* Tell ffi_closure_sparc how to perform return type promotions. */ - return flags; -} -#endif /* SPARC64 */ diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/sparc/ffitarget.h deleted file mode 100644 index 2f4cd9a7a93369d0bc6984193f7960c911aeebb2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/ffitarget.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Anthony Green - Copyright (c) 1996-2003 Red Hat, Inc. - Target configuration macros for SPARC. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -#if defined(__arch64__) || defined(__sparcv9) -#ifndef SPARC64 -#define SPARC64 -#endif -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, -#ifdef SPARC64 - FFI_V9, - FFI_DEFAULT_ABI = FFI_V9, -#else - FFI_V8, - FFI_DEFAULT_ABI = FFI_V8, -#endif - FFI_LAST_ABI -} ffi_abi; -#endif - -#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION 1 -#define FFI_TARGET_HAS_COMPLEX_TYPE 1 - -#ifdef SPARC64 -# define FFI_TARGET_SPECIFIC_VARIADIC 1 -# define FFI_EXTRA_CIF_FIELDS unsigned int nfixedargs -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_GO_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 - -#ifdef SPARC64 -#define FFI_TRAMPOLINE_SIZE 24 -#else -#define FFI_TRAMPOLINE_SIZE 16 -#endif - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/internal.h b/llgo/third_party/gofrontend/libffi/src/sparc/internal.h deleted file mode 100644 index 0a66472bade87c84f49428ba2464c4548f6c2e08..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/internal.h +++ /dev/null @@ -1,26 +0,0 @@ -#define SPARC_RET_VOID 0 -#define SPARC_RET_STRUCT 1 -#define SPARC_RET_UINT8 2 -#define SPARC_RET_SINT8 3 -#define SPARC_RET_UINT16 4 -#define SPARC_RET_SINT16 5 -#define SPARC_RET_UINT32 6 -#define SP_V9_RET_SINT32 7 /* v9 only */ -#define SP_V8_RET_CPLX16 7 /* v8 only */ -#define SPARC_RET_INT64 8 -#define SPARC_RET_INT128 9 - -/* Note that F_7 is missing, and is handled by SPARC_RET_STRUCT. */ -#define SPARC_RET_F_8 10 -#define SPARC_RET_F_6 11 -#define SPARC_RET_F_4 12 -#define SPARC_RET_F_2 13 -#define SP_V9_RET_F_3 14 /* v9 only */ -#define SP_V8_RET_CPLX8 14 /* v8 only */ -#define SPARC_RET_F_1 15 - -#define SPARC_FLAG_RET_MASK 15 -#define SPARC_FLAG_RET_IN_MEM 32 -#define SPARC_FLAG_FP_ARGS 64 - -#define SPARC_SIZEMASK_SHIFT 8 diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/v8.S b/llgo/third_party/gofrontend/libffi/src/sparc/v8.S deleted file mode 100644 index 3a811efe05f42d887ec763ff990868082e4cab09..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/v8.S +++ /dev/null @@ -1,361 +0,0 @@ -/* ----------------------------------------------------------------------- - v8.S - Copyright (c) 2013 The Written Word, Inc. - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. - - SPARC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include -#include "internal.h" - -#ifndef SPARC64 - -#define C2(X, Y) X ## Y -#define C1(X, Y) C2(X, Y) - -#ifdef __USER_LABEL_PREFIX__ -# define C(Y) C1(__USER_LABEL_PREFIX__, Y) -#else -# define C(Y) Y -#endif -#define L(Y) C1(.L, Y) - - .text - -#ifndef __GNUC__ - .align 8 - .globl C(ffi_flush_icache) - .type C(ffi_flush_icache),@function - FFI_HIDDEN(C(ffi_flush_icache)) - -C(ffi_flush_icache): - cfi_startproc -1: iflush %o0 - iflush %o+8 - nop - nop - nop - nop - nop - retl - nop - cfi_endproc - .size C(ffi_flush_icache), . - C(ffi_flush_icache) -#endif - -.macro E index - .align 16 - .org 2b + \index * 16 -.endm - - .align 8 - .globl C(ffi_call_v8) - .type C(ffi_call_v8),@function - FFI_HIDDEN(C(ffi_call_v8)) - -C(ffi_call_v8): - cfi_startproc - ! Allocate a stack frame sized by ffi_call. - save %sp, %o4, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - mov %i0, %o0 ! copy cif - add %sp, 64+32, %o1 ! load args area - mov %i2, %o2 ! copy rvalue - call C(ffi_prep_args_v8) - mov %i3, %o3 ! copy avalue - - add %sp, 32, %sp ! deallocate prep frame - and %o0, SPARC_FLAG_RET_MASK, %l0 ! save return type - srl %o0, SPARC_SIZEMASK_SHIFT, %l1 ! save return size - ld [%sp+64+4], %o0 ! load all argument registers - ld [%sp+64+8], %o1 - ld [%sp+64+12], %o2 - ld [%sp+64+16], %o3 - cmp %l0, SPARC_RET_STRUCT ! struct return needs an unimp 4 - ld [%sp+64+20], %o4 - be 8f - ld [%sp+64+24], %o5 - - ! Call foreign function - call %i1 - mov %i5, %g2 ! load static chain - -0: call 1f ! load pc in %o7 - sll %l0, 4, %l0 -1: add %o7, %l0, %o7 ! o7 = 0b + ret_type*16 - jmp %o7+(2f-0b) - nop - - ! Note that each entry is 4 insns, enforced by the E macro. - .align 16 -2: -E SPARC_RET_VOID - ret - restore -E SPARC_RET_STRUCT - unimp -E SPARC_RET_UINT8 - and %o0, 0xff, %o0 - st %o0, [%i2] - ret - restore -E SPARC_RET_SINT8 - sll %o0, 24, %o0 - b 7f - sra %o0, 24, %o0 -E SPARC_RET_UINT16 - sll %o0, 16, %o0 - b 7f - srl %o0, 16, %o0 -E SPARC_RET_SINT16 - sll %o0, 16, %o0 - b 7f - sra %o0, 16, %o0 -E SPARC_RET_UINT32 -7: st %o0, [%i2] - ret - restore -E SP_V8_RET_CPLX16 - sth %o0, [%i2+2] - b 9f - srl %o0, 16, %o0 -E SPARC_RET_INT64 - st %o0, [%i2] - st %o1, [%i2+4] - ret - restore -E SPARC_RET_INT128 - std %o0, [%i2] - std %o2, [%i2+8] - ret - restore -E SPARC_RET_F_8 - st %f7, [%i2+7*4] - nop - st %f6, [%i2+6*4] - nop -E SPARC_RET_F_6 - st %f5, [%i2+5*4] - nop - st %f4, [%i2+4*4] - nop -E SPARC_RET_F_4 - st %f3, [%i2+3*4] - nop - st %f2, [%i2+2*4] - nop -E SPARC_RET_F_2 - st %f1, [%i2+4] - st %f0, [%i2] - ret - restore -E SP_V8_RET_CPLX8 - stb %o0, [%i2+1] - b 10f - srl %o0, 8, %o0 -E SPARC_RET_F_1 - st %f0, [%i2] - ret - restore - - .align 8 -9: sth %o0, [%i2] - ret - restore - .align 8 -10: stb %o0, [%i2] - ret - restore - - ! Struct returning functions expect and skip the unimp here. - ! To make it worse, conforming callees examine the unimp and - ! make sure the low 12 bits of the unimp match the size of - ! the struct being returned. - .align 8 -8: call 1f ! load pc in %o7 - sll %l1, 2, %l0 ! size * 4 -1: sll %l1, 4, %l1 ! size * 16 - add %l0, %l1, %l0 ! size * 20 - add %o7, %l0, %o7 ! o7 = 0b + size*20 - jmp %o7+(2f-8b) - mov %i5, %g2 ! load static chain -2: -.rept 0x1000 - call %i1 - nop - unimp (. - 2b) / 20 - ret - restore -.endr - - cfi_endproc - .size C(ffi_call_v8),. - C(ffi_call_v8) - - -/* 16*4 register window + 1*4 struct return + 6*4 args backing store - + 8*4 return storage + 1*4 alignment. */ -#define STACKFRAME (16*4 + 4 + 6*4 + 8*4 + 4) - -/* ffi_closure_v8(...) - - Receives the closure argument in %g2. */ - -#ifdef HAVE_AS_REGISTER_PSEUDO_OP - .register %g2, #scratch -#endif - - .align 8 - .globl C(ffi_go_closure_v8) - .type C(ffi_go_closure_v8),@function - FFI_HIDDEN(C(ffi_go_closure_v8)) - -C(ffi_go_closure_v8): - cfi_startproc - save %sp, -STACKFRAME, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - ld [%g2+4], %o0 ! load cif - ld [%g2+8], %o1 ! load fun - b 0f - mov %g2, %o2 ! load user_data - cfi_endproc - .size C(ffi_go_closure_v8), . - C(ffi_go_closure_v8) - - .align 8 - .globl C(ffi_closure_v8) - .type C(ffi_closure_v8),@function - FFI_HIDDEN(C(ffi_closure_v8)) - -C(ffi_closure_v8): - cfi_startproc - save %sp, -STACKFRAME, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - ld [%g2+FFI_TRAMPOLINE_SIZE], %o0 ! load cif - ld [%g2+FFI_TRAMPOLINE_SIZE+4], %o1 ! load fun - ld [%g2+FFI_TRAMPOLINE_SIZE+8], %o2 ! load user_data -0: - ! Store all of the potential argument registers in va_list format. - st %i0, [%fp+68+0] - st %i1, [%fp+68+4] - st %i2, [%fp+68+8] - st %i3, [%fp+68+12] - st %i4, [%fp+68+16] - st %i5, [%fp+68+20] - - ! Call ffi_closure_sparc_inner to do the bulk of the work. - add %fp, -8*4, %o3 - call ffi_closure_sparc_inner_v8 - add %fp, 64, %o4 - -0: call 1f - and %o0, SPARC_FLAG_RET_MASK, %o0 -1: sll %o0, 4, %o0 ! o0 = o0 * 16 - add %o7, %o0, %o7 ! o7 = 0b + o0*16 - jmp %o7+(2f-0b) - add %fp, -8*4, %i2 - - ! Note that each entry is 4 insns, enforced by the E macro. - .align 16 -2: -E SPARC_RET_VOID - ret - restore -E SPARC_RET_STRUCT - ld [%i2], %i0 - jmp %i7+12 - restore -E SPARC_RET_UINT8 - ldub [%i2+3], %i0 - ret - restore -E SPARC_RET_SINT8 - ldsb [%i2+3], %i0 - ret - restore -E SPARC_RET_UINT16 - lduh [%i2+2], %i0 - ret - restore -E SPARC_RET_SINT16 - ldsh [%i2+2], %i0 - ret - restore -E SPARC_RET_UINT32 - ld [%i2], %i0 - ret - restore -E SP_V8_RET_CPLX16 - ld [%i2], %i0 - ret - restore -E SPARC_RET_INT64 - ldd [%i2], %i0 - ret - restore -E SPARC_RET_INT128 - ldd [%i2], %i0 - ldd [%i2+8], %i2 - ret - restore -E SPARC_RET_F_8 - ld [%i2+7*4], %f7 - nop - ld [%i2+6*4], %f6 - nop -E SPARC_RET_F_6 - ld [%i2+5*4], %f5 - nop - ld [%i2+4*4], %f4 - nop -E SPARC_RET_F_4 - ld [%i2+3*4], %f3 - nop - ld [%i2+2*4], %f2 - nop -E SPARC_RET_F_2 - ldd [%i2], %f0 - ret - restore -E SP_V8_RET_CPLX8 - lduh [%i2], %i0 - ret - restore -E SPARC_RET_F_1 - ld [%i2], %f0 - ret - restore - - cfi_endproc - .size C(ffi_closure_v8), . - C(ffi_closure_v8) -#endif /* !SPARC64 */ -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/sparc/v9.S b/llgo/third_party/gofrontend/libffi/src/sparc/v9.S deleted file mode 100644 index 52732d364ea2d97aa9190f3886d4ad29b98e1608..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/sparc/v9.S +++ /dev/null @@ -1,377 +0,0 @@ -/* ----------------------------------------------------------------------- - v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. - - SPARC 64-bit Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#include -#include "internal.h" - -#ifdef SPARC64 - -#define C2(X, Y) X ## Y -#define C1(X, Y) C2(X, Y) - -#ifdef __USER_LABEL_PREFIX__ -# define C(Y) C1(__USER_LABEL_PREFIX__, Y) -#else -# define C(Y) Y -#endif -#define L(Y) C1(.L, Y) - -.macro E index - .align 16 - .org 2b + \index * 16 -.endm - -#define STACK_BIAS 2047 - - .text - .align 8 - .globl C(ffi_call_v9) - .type C(ffi_call_v9),@function - FFI_HIDDEN(C(ffi_call_v9)) - -C(ffi_call_v9): - cfi_startproc - save %sp, %o4, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - mov %i0, %o0 ! copy cif - add %sp, STACK_BIAS+128+48, %o1 ! load args area - mov %i2, %o2 ! copy rvalue - call C(ffi_prep_args_v9) - mov %i3, %o3 ! copy avalue - - andcc %o0, SPARC_FLAG_FP_ARGS, %g0 ! need fp regs? - add %sp, 48, %sp ! deallocate prep frame - be,pt %xcc, 1f - mov %o0, %l0 ! save flags - - ldd [%sp+STACK_BIAS+128], %f0 ! load all fp arg regs - ldd [%sp+STACK_BIAS+128+8], %f2 - ldd [%sp+STACK_BIAS+128+16], %f4 - ldd [%sp+STACK_BIAS+128+24], %f6 - ldd [%sp+STACK_BIAS+128+32], %f8 - ldd [%sp+STACK_BIAS+128+40], %f10 - ldd [%sp+STACK_BIAS+128+48], %f12 - ldd [%sp+STACK_BIAS+128+56], %f14 - ldd [%sp+STACK_BIAS+128+64], %f16 - ldd [%sp+STACK_BIAS+128+72], %f18 - ldd [%sp+STACK_BIAS+128+80], %f20 - ldd [%sp+STACK_BIAS+128+88], %f22 - ldd [%sp+STACK_BIAS+128+96], %f24 - ldd [%sp+STACK_BIAS+128+104], %f26 - ldd [%sp+STACK_BIAS+128+112], %f28 - ldd [%sp+STACK_BIAS+128+120], %f30 - -1: ldx [%sp+STACK_BIAS+128], %o0 ! load all int arg regs - ldx [%sp+STACK_BIAS+128+8], %o1 - ldx [%sp+STACK_BIAS+128+16], %o2 - ldx [%sp+STACK_BIAS+128+24], %o3 - ldx [%sp+STACK_BIAS+128+32], %o4 - ldx [%sp+STACK_BIAS+128+40], %o5 - call %i1 - mov %i5, %g5 ! load static chain - -0: call 1f ! load pc in %o7 - and %l0, SPARC_FLAG_RET_MASK, %l1 -1: sll %l1, 4, %l1 - add %o7, %l1, %o7 ! o7 = 0b + ret_type*16 - jmp %o7+(2f-0b) - nop - - .align 16 -2: -E SPARC_RET_VOID - return %i7+8 - nop -E SPARC_RET_STRUCT - add %sp, STACK_BIAS-64+128+48, %l2 - sub %sp, 64, %sp - b 8f - stx %o0, [%l2] -E SPARC_RET_UINT8 - and %o0, 0xff, %i0 - return %i7+8 - stx %o0, [%o2] -E SPARC_RET_SINT8 - sll %o0, 24, %o0 - sra %o0, 24, %i0 - return %i7+8 - stx %o0, [%o2] -E SPARC_RET_UINT16 - sll %o0, 16, %o0 - srl %o0, 16, %i0 - return %i7+8 - stx %o0, [%o2] -E SPARC_RET_SINT16 - sll %o0, 16, %o0 - sra %o0, 16, %i0 - return %i7+8 - stx %o0, [%o2] -E SPARC_RET_UINT32 - srl %o0, 0, %i0 - return %i7+8 - stx %o0, [%o2] -E SP_V9_RET_SINT32 - sra %o0, 0, %i0 - return %i7+8 - stx %o0, [%o2] -E SPARC_RET_INT64 - stx %o0, [%i2] - return %i7+8 - nop -E SPARC_RET_INT128 - stx %o0, [%i2] - stx %o1, [%i2+8] - return %i7+8 - nop -E SPARC_RET_F_8 - st %f7, [%i2+7*4] - nop - st %f6, [%i2+6*4] - nop -E SPARC_RET_F_6 - st %f5, [%i2+5*4] - nop - st %f4, [%i2+4*4] - nop -E SPARC_RET_F_4 - std %f2, [%i2+2*4] - return %i7+8 - std %f0, [%o2] -E SPARC_RET_F_2 - return %i7+8 - std %f0, [%o2] -E SP_V9_RET_F_3 - st %f2, [%i2+2*4] - nop - st %f1, [%i2+1*4] - nop -E SPARC_RET_F_1 - return %i7+8 - st %f0, [%o2] - - ! Finish the SPARC_RET_STRUCT sequence. - .align 8 -8: stx %o1, [%l2+8] - stx %o2, [%l2+16] - stx %o3, [%l2+24] - std %f0, [%l2+32] - std %f2, [%l2+40] - std %f4, [%l2+48] - std %f6, [%l2+56] - - ! Copy the structure into place. - srl %l0, SPARC_SIZEMASK_SHIFT, %o0 ! load size_mask - mov %i2, %o1 ! load dst - mov %l2, %o2 ! load src_gp - call C(ffi_struct_float_copy) - add %l2, 32, %o3 ! load src_fp - - return %i7+8 - nop - - cfi_endproc - .size C(ffi_call_v9), . - C(ffi_call_v9) - - -#undef STACKFRAME -#define STACKFRAME 336 /* 16*8 register window + - 6*8 args backing store + - 20*8 locals */ -#define FP %fp+STACK_BIAS - -/* ffi_closure_v9(...) - - Receives the closure argument in %g1. */ - - .align 8 - .globl C(ffi_go_closure_v9) - .type C(ffi_go_closure_v9),@function - FFI_HIDDEN(C(ffi_go_closure_v9)) - -C(ffi_go_closure_v9): - cfi_startproc - save %sp, -STACKFRAME, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - ldx [%g5+8], %o0 - ldx [%g5+16], %o1 - b 0f - mov %g5, %o2 - - cfi_endproc - .size C(ffi_go_closure_v9), . - C(ffi_go_closure_v9) - - .align 8 - .globl C(ffi_closure_v9) - .type C(ffi_closure_v9),@function - FFI_HIDDEN(C(ffi_closure_v9)) - -C(ffi_closure_v9): - cfi_startproc - save %sp, -STACKFRAME, %sp - cfi_def_cfa_register(%fp) - cfi_window_save - - ldx [%g1+FFI_TRAMPOLINE_SIZE], %o0 - ldx [%g1+FFI_TRAMPOLINE_SIZE+8], %o1 - ldx [%g1+FFI_TRAMPOLINE_SIZE+16], %o2 -0: - ! Store all of the potential argument registers in va_list format. - stx %i0, [FP+128+0] - stx %i1, [FP+128+8] - stx %i2, [FP+128+16] - stx %i3, [FP+128+24] - stx %i4, [FP+128+32] - stx %i5, [FP+128+40] - - ! Store possible floating point argument registers too. - std %f0, [FP-128] - std %f2, [FP-120] - std %f4, [FP-112] - std %f6, [FP-104] - std %f8, [FP-96] - std %f10, [FP-88] - std %f12, [FP-80] - std %f14, [FP-72] - std %f16, [FP-64] - std %f18, [FP-56] - std %f20, [FP-48] - std %f22, [FP-40] - std %f24, [FP-32] - std %f26, [FP-24] - std %f28, [FP-16] - std %f30, [FP-8] - - ! Call ffi_closure_sparc_inner to do the bulk of the work. - add %fp, STACK_BIAS-160, %o3 - add %fp, STACK_BIAS+128, %o4 - call C(ffi_closure_sparc_inner_v9) - add %fp, STACK_BIAS-128, %o5 - -0: call 1f ! load pc in %o7 - and %o0, SPARC_FLAG_RET_MASK, %o0 -1: sll %o0, 4, %o0 ! o2 = i2 * 16 - add %o7, %o0, %o7 ! o7 = 0b + i2*16 - jmp %o7+(2f-0b) - nop - - ! Note that we cannot load the data in the delay slot of - ! the return insn because the data is in the stack frame - ! that is deallocated by the return. - .align 16 -2: -E SPARC_RET_VOID - return %i7+8 - nop -E SPARC_RET_STRUCT - ldx [FP-160], %i0 - ldd [FP-160], %f0 - b 8f - ldx [FP-152], %i1 -E SPARC_RET_UINT8 - ldub [FP-160+7], %i0 - return %i7+8 - nop -E SPARC_RET_SINT8 - ldsb [FP-160+7], %i0 - return %i7+8 - nop -E SPARC_RET_UINT16 - lduh [FP-160+6], %i0 - return %i7+8 - nop -E SPARC_RET_SINT16 - ldsh [FP-160+6], %i0 - return %i7+8 - nop -E SPARC_RET_UINT32 - lduw [FP-160+4], %i0 - return %i7+8 - nop -E SP_V9_RET_SINT32 - ldsw [FP-160+4], %i0 - return %i7+8 - nop -E SPARC_RET_INT64 - ldx [FP-160], %i0 - return %i7+8 - nop -E SPARC_RET_INT128 - ldx [FP-160], %i0 - ldx [FP-160+8], %i1 - return %i7+8 - nop -E SPARC_RET_F_8 - ld [FP-160+7*4], %f7 - nop - ld [FP-160+6*4], %f6 - nop -E SPARC_RET_F_6 - ld [FP-160+5*4], %f5 - nop - ld [FP-160+4*4], %f4 - nop -E SPARC_RET_F_4 - ldd [FP-160], %f0 - ldd [FP-160+8], %f2 - return %i7+8 - nop -E SPARC_RET_F_2 - ldd [FP-160], %f0 - return %i7+8 - nop -E SP_V9_RET_F_3 - ld [FP-160+2*4], %f2 - nop - ld [FP-160+1*4], %f1 - nop -E SPARC_RET_F_1 - ld [FP-160], %f0 - return %i7+8 - nop - - ! Finish the SPARC_RET_STRUCT sequence. - .align 8 -8: ldd [FP-152], %f2 - ldx [FP-144], %i2 - ldd [FP-144], %f4 - ldx [FP-136], %i3 - ldd [FP-136], %f6 - return %i7+8 - nop - - cfi_endproc - .size C(ffi_closure_v9), . - C(ffi_closure_v9) -#endif /* SPARC64 */ -#ifdef __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/tile/ffi.c b/llgo/third_party/gofrontend/libffi/src/tile/ffi.c deleted file mode 100644 index 3a94469c7fafd921b4aef87e7dae6d02a013bab4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/tile/ffi.c +++ /dev/null @@ -1,355 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2012 Tilera Corp. - - TILE Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include -#include -#include -#include -#include - - -/* The first 10 registers are used to pass arguments and return values. */ -#define NUM_ARG_REGS 10 - -/* Performs a raw function call with the given NUM_ARG_REGS register arguments - and the specified additional stack arguments (if any). */ -extern void ffi_call_tile(ffi_sarg reg_args[NUM_ARG_REGS], - const ffi_sarg *stack_args, - size_t stack_args_bytes, - void (*fnaddr)(void)) - FFI_HIDDEN; - -/* This handles the raw call from the closure stub, cleaning up the - parameters and delegating to ffi_closure_tile_inner. */ -extern void ffi_closure_tile(void) FFI_HIDDEN; - - -ffi_status -ffi_prep_cif_machdep(ffi_cif *cif) -{ - /* We always allocate room for all registers. Even if we don't - use them as parameters, they get returned in the same array - as struct return values so we need to make room. */ - if (cif->bytes < NUM_ARG_REGS * FFI_SIZEOF_ARG) - cif->bytes = NUM_ARG_REGS * FFI_SIZEOF_ARG; - - if (cif->rtype->size > NUM_ARG_REGS * FFI_SIZEOF_ARG) - cif->flags = FFI_TYPE_STRUCT; - else - cif->flags = FFI_TYPE_INT; - - /* Nothing to do. */ - return FFI_OK; -} - - -static long -assign_to_ffi_arg(ffi_sarg *out, void *in, const ffi_type *type, - int write_to_reg) -{ - switch (type->type) - { - case FFI_TYPE_SINT8: - *out = *(SINT8 *)in; - return 1; - - case FFI_TYPE_UINT8: - *out = *(UINT8 *)in; - return 1; - - case FFI_TYPE_SINT16: - *out = *(SINT16 *)in; - return 1; - - case FFI_TYPE_UINT16: - *out = *(UINT16 *)in; - return 1; - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: -#ifndef __LP64__ - case FFI_TYPE_POINTER: -#endif - /* Note that even unsigned 32-bit quantities are sign extended - on tilegx when stored in a register. */ - *out = *(SINT32 *)in; - return 1; - - case FFI_TYPE_FLOAT: -#ifdef __tilegx__ - if (write_to_reg) - { - /* Properly sign extend the value. */ - union { float f; SINT32 s32; } val; - val.f = *(float *)in; - *out = val.s32; - } - else -#endif - { - *(float *)out = *(float *)in; - } - return 1; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: -#ifdef __LP64__ - case FFI_TYPE_POINTER: -#endif - *(UINT64 *)out = *(UINT64 *)in; - return sizeof(UINT64) / FFI_SIZEOF_ARG; - - case FFI_TYPE_STRUCT: - memcpy(out, in, type->size); - return (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; - - case FFI_TYPE_VOID: - /* Must be a return type. Nothing to do. */ - return 0; - - default: - FFI_ASSERT(0); - return -1; - } -} - - -void -ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_sarg * const arg_mem = alloca(cif->bytes); - ffi_sarg * const reg_args = arg_mem; - ffi_sarg * const stack_args = ®_args[NUM_ARG_REGS]; - ffi_sarg *argp = arg_mem; - ffi_type ** const arg_types = cif->arg_types; - const long num_args = cif->nargs; - long i; - - if (cif->flags == FFI_TYPE_STRUCT) - { - /* Pass a hidden pointer to the return value. We make sure there - is scratch space for the callee to store the return value even if - our caller doesn't care about it. */ - *argp++ = (intptr_t)(rvalue ? rvalue : alloca(cif->rtype->size)); - - /* No more work needed to return anything. */ - rvalue = NULL; - } - - for (i = 0; i < num_args; i++) - { - ffi_type *type = arg_types[i]; - void * const arg_in = avalue[i]; - ptrdiff_t arg_word = argp - arg_mem; - -#ifndef __tilegx__ - /* Doubleword-aligned values are always in an even-number register - pair, or doubleword-aligned stack slot if out of registers. */ - long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); - argp += align; - arg_word += align; -#endif - - if (type->type == FFI_TYPE_STRUCT) - { - const size_t arg_size_in_words = - (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; - - if (arg_word < NUM_ARG_REGS && - arg_word + arg_size_in_words > NUM_ARG_REGS) - { - /* Args are not allowed to span registers and the stack. */ - argp = stack_args; - } - - memcpy(argp, arg_in, type->size); - argp += arg_size_in_words; - } - else - { - argp += assign_to_ffi_arg(argp, arg_in, arg_types[i], 1); - } - } - - /* Actually do the call. */ - ffi_call_tile(reg_args, stack_args, - cif->bytes - (NUM_ARG_REGS * FFI_SIZEOF_ARG), fn); - - if (rvalue != NULL) - assign_to_ffi_arg(rvalue, reg_args, cif->rtype, 0); -} - - -/* Template code for closure. */ -extern const UINT64 ffi_template_tramp_tile[] FFI_HIDDEN; - - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ -#ifdef __tilegx__ - /* TILE-Gx */ - SINT64 c; - SINT64 h; - int s; - UINT64 *out; - - if (cif->abi != FFI_UNIX) - return FFI_BAD_ABI; - - out = (UINT64 *)closure->tramp; - - c = (intptr_t)closure; - h = (intptr_t)ffi_closure_tile; - s = 0; - - /* Find the smallest shift count that doesn't lose information - (i.e. no need to explicitly insert high bits of the address that - are just the sign extension of the low bits). */ - while ((c >> s) != (SINT16)(c >> s) || (h >> s) != (SINT16)(h >> s)) - s += 16; - -#define OPS(a, b, shift) \ - (create_Imm16_X0((a) >> (shift)) | create_Imm16_X1((b) >> (shift))) - - /* Emit the moveli. */ - *out++ = ffi_template_tramp_tile[0] | OPS(c, h, s); - for (s -= 16; s >= 0; s -= 16) - *out++ = ffi_template_tramp_tile[1] | OPS(c, h, s); - -#undef OPS - - *out++ = ffi_template_tramp_tile[2]; - -#else - /* TILEPro */ - UINT64 *out; - intptr_t delta; - - if (cif->abi != FFI_UNIX) - return FFI_BAD_ABI; - - out = (UINT64 *)closure->tramp; - delta = (intptr_t)ffi_closure_tile - (intptr_t)codeloc; - - *out++ = ffi_template_tramp_tile[0] | create_JOffLong_X1(delta >> 3); -#endif - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - invalidate_icache(closure->tramp, (char *)out - closure->tramp, - getpagesize()); - - return FFI_OK; -} - - -/* This is called by the assembly wrapper for closures. This does - all of the work. On entry reg_args[0] holds the values the registers - had when the closure was invoked. On return reg_args[1] holds the register - values to be returned to the caller (many of which may be garbage). */ -void FFI_HIDDEN -ffi_closure_tile_inner(ffi_closure *closure, - ffi_sarg reg_args[2][NUM_ARG_REGS], - ffi_sarg *stack_args) -{ - ffi_cif * const cif = closure->cif; - void ** const avalue = alloca(cif->nargs * sizeof(void *)); - void *rvalue; - ffi_type ** const arg_types = cif->arg_types; - ffi_sarg * const reg_args_in = reg_args[0]; - ffi_sarg * const reg_args_out = reg_args[1]; - ffi_sarg * argp; - long i, arg_word, nargs = cif->nargs; - /* Use a union to guarantee proper alignment for double. */ - union { ffi_sarg arg[NUM_ARG_REGS]; double d; UINT64 u64; } closure_ret; - - /* Start out reading register arguments. */ - argp = reg_args_in; - - /* Copy the caller's structure return address to that the closure - returns the data directly to the caller. */ - if (cif->flags == FFI_TYPE_STRUCT) - { - /* Return by reference via hidden pointer. */ - rvalue = (void *)(intptr_t)*argp++; - arg_word = 1; - } - else - { - /* Return the value in registers. */ - rvalue = &closure_ret; - arg_word = 0; - } - - /* Grab the addresses of the arguments. */ - for (i = 0; i < nargs; i++) - { - ffi_type * const type = arg_types[i]; - const size_t arg_size_in_words = - (type->size + FFI_SIZEOF_ARG - 1) / FFI_SIZEOF_ARG; - -#ifndef __tilegx__ - /* Doubleword-aligned values are always in an even-number register - pair, or doubleword-aligned stack slot if out of registers. */ - long align = arg_word & (type->alignment > FFI_SIZEOF_ARG); - argp += align; - arg_word += align; -#endif - - if (arg_word == NUM_ARG_REGS || - (arg_word < NUM_ARG_REGS && - arg_word + arg_size_in_words > NUM_ARG_REGS)) - { - /* Switch to reading arguments from the stack. */ - argp = stack_args; - arg_word = NUM_ARG_REGS; - } - - avalue[i] = argp; - argp += arg_size_in_words; - arg_word += arg_size_in_words; - } - - /* Invoke the closure. */ - closure->fun(cif, rvalue, avalue, closure->user_data); - - if (cif->flags != FFI_TYPE_STRUCT) - { - /* Canonicalize for register representation. */ - assign_to_ffi_arg(reg_args_out, &closure_ret, cif->rtype, 1); - } -} diff --git a/llgo/third_party/gofrontend/libffi/src/tile/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/tile/ffitarget.h deleted file mode 100644 index 679fb5d904b4a13e0fc06fb388803b4d94b71913..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/tile/ffitarget.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012 Tilera Corp. - Target configuration macros for TILE. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM - -#include - -typedef uint_reg_t ffi_arg; -typedef int_reg_t ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_UNIX, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_UNIX -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ -#define FFI_CLOSURES 1 - -#ifdef __tilegx__ -/* We always pass 8-byte values, even in -m32 mode. */ -# define FFI_SIZEOF_ARG 8 -# ifdef __LP64__ -# define FFI_TRAMPOLINE_SIZE (8 * 5) /* 5 bundles */ -# else -# define FFI_TRAMPOLINE_SIZE (8 * 3) /* 3 bundles */ -# endif -#else -# define FFI_SIZEOF_ARG 4 -# define FFI_TRAMPOLINE_SIZE 8 /* 1 bundle */ -#endif -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/tile/tile.S b/llgo/third_party/gofrontend/libffi/src/tile/tile.S deleted file mode 100644 index d1f82cb3dbfa8559db679ea2ac63b8fe2193a112..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/tile/tile.S +++ /dev/null @@ -1,360 +0,0 @@ -/* ----------------------------------------------------------------------- - tile.S - Copyright (c) 2011 Tilera Corp. - - Tilera TILEPro and TILE-Gx Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -/* Number of bytes in a register. */ -#define REG_SIZE FFI_SIZEOF_ARG - -/* Number of bytes in stack linkage area for backtracing. - - A note about the ABI: on entry to a procedure, sp points to a stack - slot where it must spill the return address if it's not a leaf. - REG_SIZE bytes beyond that is a slot owned by the caller which - contains the sp value that the caller had when it was originally - entered (i.e. the caller's frame pointer). */ -#define LINKAGE_SIZE (2 * REG_SIZE) - -/* The first 10 registers are used to pass arguments and return values. */ -#define NUM_ARG_REGS 10 - -#ifdef __tilegx__ -#define SW st -#define LW ld -#define BGZT bgtzt -#else -#define SW sw -#define LW lw -#define BGZT bgzt -#endif - - -/* void ffi_call_tile (int_reg_t reg_args[NUM_ARG_REGS], - const int_reg_t *stack_args, - unsigned long stack_args_bytes, - void (*fnaddr)(void)); - - On entry, REG_ARGS contain the outgoing register values, - and STACK_ARGS contains STACK_ARG_BYTES of additional values - to be passed on the stack. If STACK_ARG_BYTES is zero, then - STACK_ARGS is ignored. - - When the invoked function returns, the values of r0-r9 are - blindly stored back into REG_ARGS for the caller to examine. */ - - .section .text.ffi_call_tile, "ax", @progbits - .align 8 - .globl ffi_call_tile - FFI_HIDDEN(ffi_call_tile) -ffi_call_tile: - -/* Incoming arguments. */ -#define REG_ARGS r0 -#define INCOMING_STACK_ARGS r1 -#define STACK_ARG_BYTES r2 -#define ORIG_FNADDR r3 - -/* Temporary values. */ -#define FRAME_SIZE r10 -#define TMP r11 -#define TMP2 r12 -#define OUTGOING_STACK_ARGS r13 -#define REG_ADDR_PTR r14 -#define RETURN_REG_ADDR r15 -#define FNADDR r16 - - .cfi_startproc - { - /* Save return address. */ - SW sp, lr - .cfi_offset lr, 0 - /* Prepare to spill incoming r52. */ - addi TMP, sp, -REG_SIZE - /* Increase frame size to have room to spill r52 and REG_ARGS. - The +7 is to round up mod 8. */ - addi FRAME_SIZE, STACK_ARG_BYTES, \ - REG_SIZE + REG_SIZE + LINKAGE_SIZE + 7 - } - { - /* Round stack frame size to a multiple of 8 to satisfy ABI. */ - andi FRAME_SIZE, FRAME_SIZE, -8 - /* Compute where to spill REG_ARGS value. */ - addi TMP2, sp, -(REG_SIZE * 2) - } - { - /* Spill incoming r52. */ - SW TMP, r52 - .cfi_offset r52, -REG_SIZE - /* Set up our frame pointer. */ - move r52, sp - .cfi_def_cfa_register r52 - /* Push stack frame. */ - sub sp, sp, FRAME_SIZE - } - { - /* Prepare to set up stack linkage. */ - addi TMP, sp, REG_SIZE - /* Prepare to memcpy stack args. */ - addi OUTGOING_STACK_ARGS, sp, LINKAGE_SIZE - /* Save REG_ARGS which we will need after we call the subroutine. */ - SW TMP2, REG_ARGS - } - { - /* Set up linkage info to hold incoming stack pointer. */ - SW TMP, r52 - } - { - /* Skip stack args memcpy if we don't have any stack args (common). */ - blezt STACK_ARG_BYTES, .Ldone_stack_args_memcpy - } - -.Lmemcpy_stack_args: - { - /* Load incoming argument from stack_args. */ - LW TMP, INCOMING_STACK_ARGS - addi INCOMING_STACK_ARGS, INCOMING_STACK_ARGS, REG_SIZE - } - { - /* Store stack argument into outgoing stack argument area. */ - SW OUTGOING_STACK_ARGS, TMP - addi OUTGOING_STACK_ARGS, OUTGOING_STACK_ARGS, REG_SIZE - addi STACK_ARG_BYTES, STACK_ARG_BYTES, -REG_SIZE - } - { - BGZT STACK_ARG_BYTES, .Lmemcpy_stack_args - } -.Ldone_stack_args_memcpy: - - { - /* Copy aside ORIG_FNADDR so we can overwrite its register. */ - move FNADDR, ORIG_FNADDR - /* Prepare to load argument registers. */ - addi REG_ADDR_PTR, r0, REG_SIZE - /* Load outgoing r0. */ - LW r0, r0 - } - - /* Load up argument registers from the REG_ARGS array. */ -#define LOAD_REG(REG, PTR) \ - { \ - LW REG, PTR ; \ - addi PTR, PTR, REG_SIZE \ - } - - LOAD_REG(r1, REG_ADDR_PTR) - LOAD_REG(r2, REG_ADDR_PTR) - LOAD_REG(r3, REG_ADDR_PTR) - LOAD_REG(r4, REG_ADDR_PTR) - LOAD_REG(r5, REG_ADDR_PTR) - LOAD_REG(r6, REG_ADDR_PTR) - LOAD_REG(r7, REG_ADDR_PTR) - LOAD_REG(r8, REG_ADDR_PTR) - LOAD_REG(r9, REG_ADDR_PTR) - - { - /* Call the subroutine. */ - jalr FNADDR - } - - { - /* Restore original lr. */ - LW lr, r52 - /* Prepare to recover ARGS, which we spilled earlier. */ - addi TMP, r52, -(2 * REG_SIZE) - } - { - /* Restore ARGS, so we can fill it in with the return regs r0-r9. */ - LW RETURN_REG_ADDR, TMP - /* Prepare to restore original r52. */ - addi TMP, r52, -REG_SIZE - } - - { - /* Pop stack frame. */ - move sp, r52 - /* Restore original r52. */ - LW r52, TMP - } - -#define STORE_REG(REG, PTR) \ - { \ - SW PTR, REG ; \ - addi PTR, PTR, REG_SIZE \ - } - - /* Return all register values by reference. */ - STORE_REG(r0, RETURN_REG_ADDR) - STORE_REG(r1, RETURN_REG_ADDR) - STORE_REG(r2, RETURN_REG_ADDR) - STORE_REG(r3, RETURN_REG_ADDR) - STORE_REG(r4, RETURN_REG_ADDR) - STORE_REG(r5, RETURN_REG_ADDR) - STORE_REG(r6, RETURN_REG_ADDR) - STORE_REG(r7, RETURN_REG_ADDR) - STORE_REG(r8, RETURN_REG_ADDR) - STORE_REG(r9, RETURN_REG_ADDR) - - { - jrp lr - } - - .cfi_endproc - .size ffi_call_tile, .-ffi_call_tile - -/* ffi_closure_tile(...) - - On entry, lr points to the closure plus 8 bytes, and r10 - contains the actual return address. - - This function simply dumps all register parameters into a stack array - and passes the closure, the registers array, and the stack arguments - to C code that does all of the actual closure processing. */ - - .section .text.ffi_closure_tile, "ax", @progbits - .align 8 - .globl ffi_closure_tile - FFI_HIDDEN(ffi_closure_tile) - - .cfi_startproc -/* Room to spill all NUM_ARG_REGS incoming registers, plus frame linkage. */ -#define CLOSURE_FRAME_SIZE (((NUM_ARG_REGS * REG_SIZE * 2 + LINKAGE_SIZE) + 7) & -8) -ffi_closure_tile: - { -#ifdef __tilegx__ - st sp, lr - .cfi_offset lr, 0 -#else - /* Save return address (in r10 due to closure stub wrapper). */ - SW sp, r10 - .cfi_return_column r10 - .cfi_offset r10, 0 -#endif - /* Compute address for stack frame linkage. */ - addli r10, sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) - } - { - /* Save incoming stack pointer in linkage area. */ - SW r10, sp - .cfi_offset sp, -(CLOSURE_FRAME_SIZE - REG_SIZE) - /* Push a new stack frame. */ - addli sp, sp, -CLOSURE_FRAME_SIZE - .cfi_adjust_cfa_offset CLOSURE_FRAME_SIZE - } - - { - /* Create pointer to where to start spilling registers. */ - addi r10, sp, LINKAGE_SIZE - } - - /* Spill all the incoming registers. */ - STORE_REG(r0, r10) - STORE_REG(r1, r10) - STORE_REG(r2, r10) - STORE_REG(r3, r10) - STORE_REG(r4, r10) - STORE_REG(r5, r10) - STORE_REG(r6, r10) - STORE_REG(r7, r10) - STORE_REG(r8, r10) - { - /* Save r9. */ - SW r10, r9 -#ifdef __tilegx__ - /* Pointer to closure is passed in r11. */ - move r0, r11 -#else - /* Compute pointer to the closure object. Because the closure - starts with a "jal ffi_closure_tile", we can just take the - value of lr (a phony return address pointing into the closure) - and subtract 8. */ - addi r0, lr, -8 -#endif - /* Compute a pointer to the register arguments we just spilled. */ - addi r1, sp, LINKAGE_SIZE - } - { - /* Compute a pointer to the extra stack arguments (if any). */ - addli r2, sp, CLOSURE_FRAME_SIZE + LINKAGE_SIZE - /* Call C code to deal with all of the grotty details. */ - jal ffi_closure_tile_inner - } - { - addli r10, sp, CLOSURE_FRAME_SIZE - } - { - /* Restore the return address. */ - LW lr, r10 - /* Compute pointer to registers array. */ - addli r10, sp, LINKAGE_SIZE + (NUM_ARG_REGS * REG_SIZE) - } - /* Return all the register values, which C code may have set. */ - LOAD_REG(r0, r10) - LOAD_REG(r1, r10) - LOAD_REG(r2, r10) - LOAD_REG(r3, r10) - LOAD_REG(r4, r10) - LOAD_REG(r5, r10) - LOAD_REG(r6, r10) - LOAD_REG(r7, r10) - LOAD_REG(r8, r10) - LOAD_REG(r9, r10) - { - /* Pop the frame. */ - addli sp, sp, CLOSURE_FRAME_SIZE - jrp lr - } - - .cfi_endproc - .size ffi_closure_tile, . - ffi_closure_tile - - -/* What follows are code template instructions that get copied to the - closure trampoline by ffi_prep_closure_loc. The zeroed operands - get replaced by their proper values at runtime. */ - - .section .text.ffi_template_tramp_tile, "ax", @progbits - .align 8 - .globl ffi_template_tramp_tile - FFI_HIDDEN(ffi_template_tramp_tile) -ffi_template_tramp_tile: -#ifdef __tilegx__ - { - moveli r11, 0 /* backpatched to address of containing closure. */ - moveli r10, 0 /* backpatched to ffi_closure_tile. */ - } - /* Note: the following bundle gets generated multiple times - depending on the pointer value (esp. useful for -m32 mode). */ - { shl16insli r11, r11, 0 ; shl16insli r10, r10, 0 } - { info 2+8 /* for backtracer: -> pc in lr, frame size 0 */ ; jr r10 } -#else - /* 'jal .' yields a PC-relative offset of zero so we can OR in the - right offset at runtime. */ - { move r10, lr ; jal . /* ffi_closure_tile */ } -#endif - - .size ffi_template_tramp_tile, . - ffi_template_tramp_tile diff --git a/llgo/third_party/gofrontend/libffi/src/types.c b/llgo/third_party/gofrontend/libffi/src/types.c deleted file mode 100644 index 7e80aec6eb4b66da2a583cbb159da450dff6cd50..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/types.c +++ /dev/null @@ -1,106 +0,0 @@ -/* ----------------------------------------------------------------------- - types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - - Predefined ffi_types needed by libffi. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -/* Hide the basic type definitions from the header file, so that we - can redefine them here as "const". */ -#define LIBFFI_HIDE_BASIC_TYPES - -#include -#include - -/* Type definitions */ - -#define FFI_TYPEDEF(name, type, id, maybe_const)\ -struct struct_align_##name { \ - char c; \ - type x; \ -}; \ -maybe_const ffi_type ffi_type_##name = { \ - sizeof(type), \ - offsetof(struct struct_align_##name, x), \ - id, NULL \ -} - -#define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ -static ffi_type *ffi_elements_complex_##name [2] = { \ - (ffi_type *)(&ffi_type_##name), NULL \ -}; \ -struct struct_align_complex_##name { \ - char c; \ - _Complex type x; \ -}; \ -maybe_const ffi_type ffi_type_complex_##name = { \ - sizeof(_Complex type), \ - offsetof(struct struct_align_complex_##name, x), \ - FFI_TYPE_COMPLEX, \ - (ffi_type **)ffi_elements_complex_##name \ -} - -/* Size and alignment are fake here. They must not be 0. */ -const ffi_type ffi_type_void = { - 1, 1, FFI_TYPE_VOID, NULL -}; - -FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8, const); -FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8, const); -FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16, const); -FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16, const); -FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32, const); -FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32, const); -FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64, const); -FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64, const); - -FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER, const); - -FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT, const); -FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE, const); - -#if !defined HAVE_LONG_DOUBLE_VARIANT || defined __alpha__ -#define FFI_LDBL_CONST const -#else -#define FFI_LDBL_CONST -#endif - -#ifdef __alpha__ -/* Even if we're not configured to default to 128-bit long double, - maintain binary compatibility, as -mlong-double-128 can be used - at any time. */ -/* Validate the hard-coded number below. */ -# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; -#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST); -#endif - -#ifdef FFI_TARGET_HAS_COMPLEX_TYPE -FFI_COMPLEX_TYPEDEF(float, float, const); -FFI_COMPLEX_TYPEDEF(double, double, const); -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -FFI_COMPLEX_TYPEDEF(longdouble, long double, FFI_LDBL_CONST); -#endif -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/vax/elfbsd.S b/llgo/third_party/gofrontend/libffi/src/vax/elfbsd.S deleted file mode 100644 index 01ca313402b20e2f5b7aff45d2c08995b78da2d6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/vax/elfbsd.S +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * vax Foreign Function Interface - */ - -#define LIBFFI_ASM -#include -#include - - .text - -/* - * void * %r0 - * ffi_call_elfbsd(extended_cif *ecif, 4(%ap) - * unsigned bytes, 8(%ap) - * unsigned flags, 12(%ap) - * void *rvalue, 16(%ap) - * void (*fn)()); 20(%ap) - */ - .globl ffi_call_elfbsd - .type ffi_call_elfbsd,@function - .align 2 -ffi_call_elfbsd: - .word 0x00c # save R2 and R3 - - # Allocate stack space for the args - subl2 8(%ap), %sp - - # Call ffi_prep_args - pushl %sp - pushl 4(%ap) - calls $2, ffi_prep_args - - # Get function pointer - movl 20(%ap), %r1 - - # Build a CALLS frame - ashl $-2, 8(%ap), %r0 - pushl %r0 # argument stack usage - movl %sp, %r0 # future %ap - # saved registers - bbc $11, 0(%r1), 1f - pushl %r11 -1: bbc $10, 0(%r1), 1f - pushl %r10 -1: bbc $9, 0(%r1), 1f - pushl %r9 -1: bbc $8, 0(%r1), 1f - pushl %r8 -1: bbc $7, 0(%r1), 1f - pushl %r7 -1: bbc $6, 0(%r1), 1f - pushl %r6 -1: bbc $5, 0(%r1), 1f - pushl %r5 -1: bbc $4, 0(%r1), 1f - pushl %r4 -1: bbc $3, 0(%r1), 1f - pushl %r3 -1: bbc $2, 0(%r1), 1f - pushl %r2 -1: - pushal 9f - pushl %fp - pushl %ap - movl 16(%ap), %r3 # struct return address, if needed - movl %r0, %ap - movzwl 4(%fp), %r0 # previous PSW, without the saved registers mask - bisl2 $0x20000000, %r0 # calls frame - movzwl 0(%r1), %r2 - bicw2 $0xf003, %r2 # only keep R11-R2 - ashl $16, %r2, %r2 - bisl2 %r2, %r0 # saved register mask of the called function - pushl %r0 - pushl $0 - movl %sp, %fp - - # Invoke the function - pushal 2(%r1) # skip procedure entry mask - movl %r3, %r1 - bicpsw $0x000f - rsb - -9: - # Copy return value if necessary - tstl 16(%ap) - jeql 9f - movl 16(%ap), %r2 - - bbc $0, 12(%ap), 1f # CIF_FLAGS_CHAR - movb %r0, 0(%r2) - brb 9f -1: - bbc $1, 12(%ap), 1f # CIF_FLAGS_SHORT - movw %r0, 0(%r2) - brb 9f -1: - bbc $2, 12(%ap), 1f # CIF_FLAGS_INT - movl %r0, 0(%r2) - brb 9f -1: - bbc $3, 12(%ap), 1f # CIF_FLAGS_DINT - movq %r0, 0(%r2) - brb 9f -1: - movl %r1, %r0 # might have been a struct - #brb 9f - -9: - ret - -/* - * ffi_closure_elfbsd(void); - * invoked with %r0: ffi_closure *closure - */ - .globl ffi_closure_elfbsd - .type ffi_closure_elfbsd, @function - .align 2 -ffi_closure_elfbsd: - .word 0 - - # Allocate room on stack for return value - subl2 $8, %sp - - # Invoke the closure function - pushal 4(%ap) # calling stack - pushal 4(%sp) # return value - pushl %r0 # closure - calls $3, ffi_closure_elfbsd_inner - - # Copy return value if necessary - bitb $1, %r0 # CIF_FLAGS_CHAR - beql 1f - movb 0(%sp), %r0 - brb 9f -1: - bitb $2, %r0 # CIF_FLAGS_SHORT - beql 1f - movw 0(%sp), %r0 - brb 9f -1: - bitb $4, %r0 # CIF_FLAGS_INT - beql 1f - movl 0(%sp), %r0 - brb 9f -1: - bitb $8, %r0 # CIF_FLAGS_DINT - beql 1f - movq 0(%sp), %r0 - #brb 9f -1: - -9: - ret - -/* - * ffi_closure_struct_elfbsd(void); - * invoked with %r0: ffi_closure *closure - * %r1: struct return address - */ - .globl ffi_closure_struct_elfbsd - .type ffi_closure_struct_elfbsd, @function - .align 2 -ffi_closure_struct_elfbsd: - .word 0 - - # Invoke the closure function - pushal 4(%ap) # calling stack - pushl %r1 # return value - pushl %r0 # closure - calls $3, ffi_closure_elfbsd_inner - - ret diff --git a/llgo/third_party/gofrontend/libffi/src/vax/ffi.c b/llgo/third_party/gofrontend/libffi/src/vax/ffi.c deleted file mode 100644 index f4d6bbb4f404667a0defe88c9b2e4765e008aa37..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/vax/ffi.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * vax Foreign Function Interface - * - * This file attempts to provide all the FFI entry points which can reliably - * be implemented in C. - */ - -#include -#include - -#include -#include - -#define CIF_FLAGS_CHAR 1 /* for struct only */ -#define CIF_FLAGS_SHORT 2 /* for struct only */ -#define CIF_FLAGS_INT 4 -#define CIF_FLAGS_DINT 8 - -/* - * Foreign Function Interface API - */ - -void ffi_call_elfbsd (extended_cif *, unsigned, unsigned, void *, - void (*) ()); -void *ffi_prep_args (extended_cif *ecif, void *stack); - -void * -ffi_prep_args (extended_cif *ecif, void *stack) -{ - unsigned int i; - void **p_argv; - char *argp; - ffi_type **p_arg; - void *struct_value_ptr; - - argp = stack; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT - && !ecif->cif->flags) - struct_value_ptr = ecif->rvalue; - else - struct_value_ptr = NULL; - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - i != 0; - i--, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - if (z < sizeof (int)) - { - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; - break; - - case FFI_TYPE_STRUCT: - memcpy (argp, *p_argv, z); - break; - - default: - FFI_ASSERT (0); - } - z = sizeof (int); - } - else - { - memcpy (argp, *p_argv, z); - - /* Align if necessary. */ - if ((sizeof(int) - 1) & z) - z = ALIGN(z, sizeof(int)); - } - - p_argv++; - argp += z; - } - - return struct_value_ptr; -} - -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = 0; - break; - - case FFI_TYPE_STRUCT: - if (cif->rtype->elements[0]->type == FFI_TYPE_STRUCT && - cif->rtype->elements[1]) - { - cif->flags = 0; - break; - } - - if (cif->rtype->size == sizeof (char)) - cif->flags = CIF_FLAGS_CHAR; - else if (cif->rtype->size == sizeof (short)) - cif->flags = CIF_FLAGS_SHORT; - else if (cif->rtype->size == sizeof (int)) - cif->flags = CIF_FLAGS_INT; - else if (cif->rtype->size == 2 * sizeof (int)) - cif->flags = CIF_FLAGS_DINT; - else - cif->flags = 0; - break; - - default: - if (cif->rtype->size <= sizeof (int)) - cif->flags = CIF_FLAGS_INT; - else - cif->flags = CIF_FLAGS_DINT; - break; - } - - return FFI_OK; -} - -void -ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return value - address then we need to make one. */ - - if (rvalue == NULL - && cif->rtype->type == FFI_TYPE_STRUCT - && cif->flags == 0) - ecif.rvalue = alloca (cif->rtype->size); - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_ELFBSD: - ffi_call_elfbsd (&ecif, cif->bytes, cif->flags, ecif.rvalue, fn); - break; - - default: - FFI_ASSERT (0); - break; - } -} - -/* - * Closure API - */ - -void ffi_closure_elfbsd (void); -void ffi_closure_struct_elfbsd (void); -unsigned int ffi_closure_elfbsd_inner (ffi_closure *, void *, char *); - -static void -ffi_prep_closure_elfbsd (ffi_cif *cif, void **avalue, char *stackp) -{ - unsigned int i; - void **p_argv; - ffi_type **p_arg; - - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; i != 0; i--, p_arg++) - { - size_t z; - - z = (*p_arg)->size; - *p_argv = stackp; - - /* Align if necessary */ - if ((sizeof (int) - 1) & z) - z = ALIGN(z, sizeof (int)); - - p_argv++; - stackp += z; - } -} - -unsigned int -ffi_closure_elfbsd_inner (ffi_closure *closure, void *resp, char *stack) -{ - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void **) alloca (cif->nargs * sizeof (void *)); - - ffi_prep_closure_elfbsd (cif, arg_area, stack); - - (closure->fun) (cif, resp, arg_area, closure->user_data); - - return cif->flags; -} - -ffi_status -ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, - void (*fun)(ffi_cif *, void *, void **, void *), - void *user_data, void *codeloc) -{ - char *tramp = (char *) codeloc; - void *fn; - - FFI_ASSERT (cif->abi == FFI_ELFBSD); - - /* entry mask */ - *(unsigned short *)(tramp + 0) = 0x0000; - /* movl #closure, r0 */ - tramp[2] = 0xd0; - tramp[3] = 0x8f; - *(unsigned int *)(tramp + 4) = (unsigned int) closure; - tramp[8] = 0x50; - - if (cif->rtype->type == FFI_TYPE_STRUCT - && !cif->flags) - fn = &ffi_closure_struct_elfbsd; - else - fn = &ffi_closure_elfbsd; - - /* jmpl #fn */ - tramp[9] = 0x17; - tramp[10] = 0xef; - *(unsigned int *)(tramp + 11) = (unsigned int)fn + 2 - - (unsigned int)tramp - 9 - 6; - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} diff --git a/llgo/third_party/gofrontend/libffi/src/vax/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/vax/ffitarget.h deleted file mode 100644 index 2fc94881abbc3533bb94aa2c928b263abb633ced..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/vax/ffitarget.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013 Miodrag Vallat. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * ``Software''), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * vax Foreign Function Interface - */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_ELFBSD, - FFI_DEFAULT_ABI = FFI_ELFBSD, - FFI_LAST_ABI = FFI_DEFAULT_ABI + 1 -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_TRAMPOLINE_SIZE 15 -#define FFI_NATIVE_RAW_API 0 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/x86/darwin.S b/llgo/third_party/gofrontend/libffi/src/x86/darwin.S deleted file mode 100644 index 8f0f0707aaf040bda76d1172c1bd7d398421fc70..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/darwin.S +++ /dev/null @@ -1,444 +0,0 @@ -/* ----------------------------------------------------------------------- - darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. - Copyright (C) 2008 Free Software Foundation, Inc. - - X86 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- - */ - -#ifndef __x86_64__ - -#define LIBFFI_ASM -#include -#include - -.text - -.globl _ffi_prep_args - - .align 4 -.globl _ffi_call_SYSV - -_ffi_call_SYSV: -.LFB1: - pushl %ebp -.LCFI0: - movl %esp,%ebp -.LCFI1: - subl $8,%esp - /* Make room for all of the new args. */ - movl 16(%ebp),%ecx - subl %ecx,%esp - - movl %esp,%eax - - /* Place all of the ffi_prep_args in position */ - subl $8,%esp - pushl 12(%ebp) - pushl %eax - call *8(%ebp) - - /* Return stack to previous state and call the function */ - addl $16,%esp - - call *28(%ebp) - - /* Load %ecx with the return type code */ - movl 20(%ebp),%ecx - - /* Protect %esi. We're going to pop it in the epilogue. */ - pushl %esi - - /* If the return value pointer is NULL, assume no return value. */ - cmpl $0,24(%ebp) - jne 0f - - /* Even if there is no space for the return value, we are - obliged to handle floating-point values. */ - cmpl $FFI_TYPE_FLOAT,%ecx - jne noretval - fstp %st(0) - - jmp epilogue -0: - .align 4 - call 1f -.Lstore_table: - .long noretval-.Lstore_table /* FFI_TYPE_VOID */ - .long retint-.Lstore_table /* FFI_TYPE_INT */ - .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ - .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ - .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ - .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ - .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ - .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ - .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ - .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ - .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ - .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ - .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ - .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ - .long retint-.Lstore_table /* FFI_TYPE_POINTER */ - .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ - .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ -1: - pop %esi - add (%esi, %ecx, 4), %esi - jmp *%esi - - /* Sign/zero extend as appropriate. */ -retsint8: - movsbl %al, %eax - jmp retint - -retsint16: - movswl %ax, %eax - jmp retint - -retuint8: - movzbl %al, %eax - jmp retint - -retuint16: - movzwl %ax, %eax - jmp retint - -retfloat: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstps (%ecx) - jmp epilogue - -retdouble: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstpl (%ecx) - jmp epilogue - -retlongdouble: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - fstpt (%ecx) - jmp epilogue - -retint64: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movl %eax,0(%ecx) - movl %edx,4(%ecx) - jmp epilogue - -retstruct1b: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movb %al,0(%ecx) - jmp epilogue - -retstruct2b: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movw %ax,0(%ecx) - jmp epilogue - -retint: - /* Load %ecx with the pointer to storage for the return value */ - movl 24(%ebp),%ecx - movl %eax,0(%ecx) - -retstruct: - /* Nothing to do! */ - -noretval: -epilogue: - popl %esi - movl %ebp,%esp - popl %ebp - ret - -.LFE1: -.ffi_call_SYSV_end: - - .align 4 -FFI_HIDDEN (ffi_closure_SYSV) -.globl _ffi_closure_SYSV - -_ffi_closure_SYSV: -.LFB2: - pushl %ebp -.LCFI2: - movl %esp, %ebp -.LCFI3: - subl $40, %esp - leal -24(%ebp), %edx - movl %edx, -12(%ebp) /* resp */ - leal 8(%ebp), %edx - movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ - leal -12(%ebp), %edx - movl %edx, (%esp) /* &resp */ - movl %ebx, 8(%esp) -.LCFI7: - call L_ffi_closure_SYSV_inner$stub - movl 8(%esp), %ebx - movl -12(%ebp), %ecx - cmpl $FFI_TYPE_INT, %eax - je .Lcls_retint - - /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, - FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ - cmpl $FFI_TYPE_UINT64, %eax - jge 0f - cmpl $FFI_TYPE_UINT8, %eax - jge .Lcls_retint - -0: cmpl $FFI_TYPE_FLOAT, %eax - je .Lcls_retfloat - cmpl $FFI_TYPE_DOUBLE, %eax - je .Lcls_retdouble - cmpl $FFI_TYPE_LONGDOUBLE, %eax - je .Lcls_retldouble - cmpl $FFI_TYPE_SINT64, %eax - je .Lcls_retllong - cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax - je .Lcls_retstruct1b - cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax - je .Lcls_retstruct2b - cmpl $FFI_TYPE_STRUCT, %eax - je .Lcls_retstruct -.Lcls_epilogue: - movl %ebp, %esp - popl %ebp - ret -.Lcls_retint: - movl (%ecx), %eax - jmp .Lcls_epilogue -.Lcls_retfloat: - flds (%ecx) - jmp .Lcls_epilogue -.Lcls_retdouble: - fldl (%ecx) - jmp .Lcls_epilogue -.Lcls_retldouble: - fldt (%ecx) - jmp .Lcls_epilogue -.Lcls_retllong: - movl (%ecx), %eax - movl 4(%ecx), %edx - jmp .Lcls_epilogue -.Lcls_retstruct1b: - movsbl (%ecx), %eax - jmp .Lcls_epilogue -.Lcls_retstruct2b: - movswl (%ecx), %eax - jmp .Lcls_epilogue -.Lcls_retstruct: - lea -8(%ebp),%esp - movl %ebp, %esp - popl %ebp - ret $4 -.LFE2: - -#if !FFI_NO_RAW_API - -#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) -#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) -#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) -#define CIF_FLAGS_OFFSET 20 - - .align 4 -FFI_HIDDEN (ffi_closure_raw_SYSV) -.globl _ffi_closure_raw_SYSV - -_ffi_closure_raw_SYSV: -.LFB3: - pushl %ebp -.LCFI4: - movl %esp, %ebp -.LCFI5: - pushl %esi -.LCFI6: - subl $36, %esp - movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ - movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ - movl %edx, 12(%esp) /* user_data */ - leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ - movl %edx, 8(%esp) /* raw_args */ - leal -24(%ebp), %edx - movl %edx, 4(%esp) /* &res */ - movl %esi, (%esp) /* cif */ - call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ - movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ - cmpl $FFI_TYPE_INT, %eax - je .Lrcls_retint - - /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, - FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ - cmpl $FFI_TYPE_UINT64, %eax - jge 0f - cmpl $FFI_TYPE_UINT8, %eax - jge .Lrcls_retint -0: - cmpl $FFI_TYPE_FLOAT, %eax - je .Lrcls_retfloat - cmpl $FFI_TYPE_DOUBLE, %eax - je .Lrcls_retdouble - cmpl $FFI_TYPE_LONGDOUBLE, %eax - je .Lrcls_retldouble - cmpl $FFI_TYPE_SINT64, %eax - je .Lrcls_retllong -.Lrcls_epilogue: - addl $36, %esp - popl %esi - popl %ebp - ret -.Lrcls_retint: - movl -24(%ebp), %eax - jmp .Lrcls_epilogue -.Lrcls_retfloat: - flds -24(%ebp) - jmp .Lrcls_epilogue -.Lrcls_retdouble: - fldl -24(%ebp) - jmp .Lrcls_epilogue -.Lrcls_retldouble: - fldt -24(%ebp) - jmp .Lrcls_epilogue -.Lrcls_retllong: - movl -24(%ebp), %eax - movl -20(%ebp), %edx - jmp .Lrcls_epilogue -.LFE3: -#endif - -.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 -L_ffi_closure_SYSV_inner$stub: - .indirect_symbol _ffi_closure_SYSV_inner - hlt ; hlt ; hlt ; hlt ; hlt - - -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EH_frame1: - .set L$set$0,LECIE1-LSCIE1 - .long L$set$0 -LSCIE1: - .long 0x0 - .byte 0x1 - .ascii "zR\0" - .byte 0x1 - .byte 0x7c - .byte 0x8 - .byte 0x1 - .byte 0x10 - .byte 0xc - .byte 0x5 - .byte 0x4 - .byte 0x88 - .byte 0x1 - .align 2 -LECIE1: -.globl _ffi_call_SYSV.eh -_ffi_call_SYSV.eh: -LSFDE1: - .set L$set$1,LEFDE1-LASFDE1 - .long L$set$1 -LASFDE1: - .long LASFDE1-EH_frame1 - .long .LFB1-. - .set L$set$2,.LFE1-.LFB1 - .long L$set$2 - .byte 0x0 - .byte 0x4 - .set L$set$3,.LCFI0-.LFB1 - .long L$set$3 - .byte 0xe - .byte 0x8 - .byte 0x84 - .byte 0x2 - .byte 0x4 - .set L$set$4,.LCFI1-.LCFI0 - .long L$set$4 - .byte 0xd - .byte 0x4 - .align 2 -LEFDE1: -.globl _ffi_closure_SYSV.eh -_ffi_closure_SYSV.eh: -LSFDE2: - .set L$set$5,LEFDE2-LASFDE2 - .long L$set$5 -LASFDE2: - .long LASFDE2-EH_frame1 - .long .LFB2-. - .set L$set$6,.LFE2-.LFB2 - .long L$set$6 - .byte 0x0 - .byte 0x4 - .set L$set$7,.LCFI2-.LFB2 - .long L$set$7 - .byte 0xe - .byte 0x8 - .byte 0x84 - .byte 0x2 - .byte 0x4 - .set L$set$8,.LCFI3-.LCFI2 - .long L$set$8 - .byte 0xd - .byte 0x4 - .align 2 -LEFDE2: - -#if !FFI_NO_RAW_API - -.globl _ffi_closure_raw_SYSV.eh -_ffi_closure_raw_SYSV.eh: -LSFDE3: - .set L$set$10,LEFDE3-LASFDE3 - .long L$set$10 -LASFDE3: - .long LASFDE3-EH_frame1 - .long .LFB3-. - .set L$set$11,.LFE3-.LFB3 - .long L$set$11 - .byte 0x0 - .byte 0x4 - .set L$set$12,.LCFI4-.LFB3 - .long L$set$12 - .byte 0xe - .byte 0x8 - .byte 0x84 - .byte 0x2 - .byte 0x4 - .set L$set$13,.LCFI5-.LCFI4 - .long L$set$13 - .byte 0xd - .byte 0x4 - .byte 0x4 - .set L$set$14,.LCFI6-.LCFI5 - .long L$set$14 - .byte 0x85 - .byte 0x3 - .align 2 -LEFDE3: - -#endif - -#endif /* ifndef __x86_64__ */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/darwin64.S b/llgo/third_party/gofrontend/libffi/src/x86/darwin64.S deleted file mode 100644 index 2f7394ef4bfaf82aa649075199ea75ab573866fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/darwin64.S +++ /dev/null @@ -1,416 +0,0 @@ -/* ----------------------------------------------------------------------- - darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. - Copyright (c) 2008 Red Hat, Inc. - derived from unix64.S - - x86-64 Foreign Function Interface for Darwin. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifdef __x86_64__ -#define LIBFFI_ASM -#include -#include - - .file "darwin64.S" -.text - -/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)(void)); - - Bit o trickiness here -- ARGS+BYTES is the base of the stack frame - for this function. This has been allocated by ffi_call. We also - deallocate some of the stack that has been alloca'd. */ - - .align 3 - .globl _ffi_call_unix64 - -_ffi_call_unix64: -LUW0: - movq (%rsp), %r10 /* Load return address. */ - leaq (%rdi, %rsi), %rax /* Find local stack base. */ - movq %rdx, (%rax) /* Save flags. */ - movq %rcx, 8(%rax) /* Save raddr. */ - movq %rbp, 16(%rax) /* Save old frame pointer. */ - movq %r10, 24(%rax) /* Relocate return address. */ - movq %rax, %rbp /* Finalize local stack frame. */ -LUW1: - movq %rdi, %r10 /* Save a copy of the register area. */ - movq %r8, %r11 /* Save a copy of the target fn. */ - movl %r9d, %eax /* Set number of SSE registers. */ - - /* Load up all argument registers. */ - movq (%r10), %rdi - movq 8(%r10), %rsi - movq 16(%r10), %rdx - movq 24(%r10), %rcx - movq 32(%r10), %r8 - movq 40(%r10), %r9 - testl %eax, %eax - jnz Lload_sse -Lret_from_load_sse: - - /* Deallocate the reg arg area. */ - leaq 176(%r10), %rsp - - /* Call the user function. */ - call *%r11 - - /* Deallocate stack arg area; local stack frame in redzone. */ - leaq 24(%rbp), %rsp - - movq 0(%rbp), %rcx /* Reload flags. */ - movq 8(%rbp), %rdi /* Reload raddr. */ - movq 16(%rbp), %rbp /* Reload old frame pointer. */ -LUW2: - - /* The first byte of the flags contains the FFI_TYPE. */ - movzbl %cl, %r10d - leaq Lstore_table(%rip), %r11 - movslq (%r11, %r10, 4), %r10 - addq %r11, %r10 - jmp *%r10 - -Lstore_table: - .long Lst_void-Lstore_table /* FFI_TYPE_VOID */ - .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */ - .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */ - .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */ - .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */ - .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */ - .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */ - .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */ - .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */ - .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */ - .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */ - .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */ - .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */ - .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */ - .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */ - - .text - .align 3 -Lst_void: - ret - .align 3 -Lst_uint8: - movzbq %al, %rax - movq %rax, (%rdi) - ret - .align 3 -Lst_sint8: - movsbq %al, %rax - movq %rax, (%rdi) - ret - .align 3 -Lst_uint16: - movzwq %ax, %rax - movq %rax, (%rdi) - .align 3 -Lst_sint16: - movswq %ax, %rax - movq %rax, (%rdi) - ret - .align 3 -Lst_uint32: - movl %eax, %eax - movq %rax, (%rdi) - .align 3 -Lst_sint32: - cltq - movq %rax, (%rdi) - ret - .align 3 -Lst_int64: - movq %rax, (%rdi) - ret - .align 3 -Lst_float: - movss %xmm0, (%rdi) - ret - .align 3 -Lst_double: - movsd %xmm0, (%rdi) - ret -Lst_ldouble: - fstpt (%rdi) - ret - .align 3 -Lst_struct: - leaq -20(%rsp), %rsi /* Scratch area in redzone. */ - - /* We have to locate the values now, and since we don't want to - write too much data into the user's return value, we spill the - value to a 16 byte scratch area first. Bits 8, 9, and 10 - control where the values are located. Only one of the three - bits will be set; see ffi_prep_cif_machdep for the pattern. */ - movd %xmm0, %r10 - movd %xmm1, %r11 - testl $0x100, %ecx - cmovnz %rax, %rdx - cmovnz %r10, %rax - testl $0x200, %ecx - cmovnz %r10, %rdx - testl $0x400, %ecx - cmovnz %r10, %rax - cmovnz %r11, %rdx - movq %rax, (%rsi) - movq %rdx, 8(%rsi) - - /* Bits 12-31 contain the true size of the structure. Copy from - the scratch area to the true destination. */ - shrl $12, %ecx - rep movsb - ret - - /* Many times we can avoid loading any SSE registers at all. - It's not worth an indirect jump to load the exact set of - SSE registers needed; zero or all is a good compromise. */ - .align 3 -LUW3: -Lload_sse: - movdqa 48(%r10), %xmm0 - movdqa 64(%r10), %xmm1 - movdqa 80(%r10), %xmm2 - movdqa 96(%r10), %xmm3 - movdqa 112(%r10), %xmm4 - movdqa 128(%r10), %xmm5 - movdqa 144(%r10), %xmm6 - movdqa 160(%r10), %xmm7 - jmp Lret_from_load_sse - -LUW4: - .align 3 - .globl _ffi_closure_unix64 - -_ffi_closure_unix64: -LUW5: - /* The carry flag is set by the trampoline iff SSE registers - are used. Don't clobber it before the branch instruction. */ - leaq -200(%rsp), %rsp -LUW6: - movq %rdi, (%rsp) - movq %rsi, 8(%rsp) - movq %rdx, 16(%rsp) - movq %rcx, 24(%rsp) - movq %r8, 32(%rsp) - movq %r9, 40(%rsp) - jc Lsave_sse -Lret_from_save_sse: - - movq %r10, %rdi - leaq 176(%rsp), %rsi - movq %rsp, %rdx - leaq 208(%rsp), %rcx - call _ffi_closure_unix64_inner - - /* Deallocate stack frame early; return value is now in redzone. */ - addq $200, %rsp -LUW7: - - /* The first byte of the return value contains the FFI_TYPE. */ - movzbl %al, %r10d - leaq Lload_table(%rip), %r11 - movslq (%r11, %r10, 4), %r10 - addq %r11, %r10 - jmp *%r10 - -Lload_table: - .long Lld_void-Lload_table /* FFI_TYPE_VOID */ - .long Lld_int32-Lload_table /* FFI_TYPE_INT */ - .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */ - .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */ - .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */ - .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */ - .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */ - .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */ - .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */ - .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */ - .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */ - .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */ - .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */ - .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */ - .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */ - - .text - .align 3 -Lld_void: - ret - .align 3 -Lld_int8: - movzbl -24(%rsp), %eax - ret - .align 3 -Lld_int16: - movzwl -24(%rsp), %eax - ret - .align 3 -Lld_int32: - movl -24(%rsp), %eax - ret - .align 3 -Lld_int64: - movq -24(%rsp), %rax - ret - .align 3 -Lld_float: - movss -24(%rsp), %xmm0 - ret - .align 3 -Lld_double: - movsd -24(%rsp), %xmm0 - ret - .align 3 -Lld_ldouble: - fldt -24(%rsp) - ret - .align 3 -Lld_struct: - /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, - %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading - both rdx and xmm1 with the second word. For the remaining, - bit 8 set means xmm0 gets the second word, and bit 9 means - that rax gets the second word. */ - movq -24(%rsp), %rcx - movq -16(%rsp), %rdx - movq -16(%rsp), %xmm1 - testl $0x100, %eax - cmovnz %rdx, %rcx - movd %rcx, %xmm0 - testl $0x200, %eax - movq -24(%rsp), %rax - cmovnz %rdx, %rax - ret - - /* See the comment above Lload_sse; the same logic applies here. */ - .align 3 -LUW8: -Lsave_sse: - movdqa %xmm0, 48(%rsp) - movdqa %xmm1, 64(%rsp) - movdqa %xmm2, 80(%rsp) - movdqa %xmm3, 96(%rsp) - movdqa %xmm4, 112(%rsp) - movdqa %xmm5, 128(%rsp) - movdqa %xmm6, 144(%rsp) - movdqa %xmm7, 160(%rsp) - jmp Lret_from_save_sse - -LUW9: -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EH_frame1: - .set L$set$0,LECIE1-LSCIE1 /* CIE Length */ - .long L$set$0 -LSCIE1: - .long 0x0 /* CIE Identifier Tag */ - .byte 0x1 /* CIE Version */ - .ascii "zR\0" /* CIE Augmentation */ - .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ - .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */ - .byte 0x10 /* CIE RA Column */ - .byte 0x1 /* uleb128 0x1; Augmentation size */ - .byte 0x10 /* FDE Encoding (pcrel sdata4) */ - .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ - .byte 0x7 /* uleb128 0x7 */ - .byte 0x8 /* uleb128 0x8 */ - .byte 0x90 /* DW_CFA_offset, column 0x10 */ - .byte 0x1 - .align 3 -LECIE1: - .globl _ffi_call_unix64.eh -_ffi_call_unix64.eh: -LSFDE1: - .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */ - .long L$set$1 -LASFDE1: - .long LASFDE1-EH_frame1 /* FDE CIE offset */ - .quad LUW0-. /* FDE initial location */ - .set L$set$2,LUW4-LUW0 /* FDE address range */ - .quad L$set$2 - .byte 0x0 /* Augmentation size */ - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$3,LUW1-LUW0 - .long L$set$3 - - /* New stack frame based off rbp. This is a itty bit of unwind - trickery in that the CFA *has* changed. There is no easy way - to describe it correctly on entry to the function. Fortunately, - it doesn't matter too much since at all points we can correctly - unwind back to ffi_call. Note that the location to which we - moved the return address is (the new) CFA-8, so from the - perspective of the unwind info, it hasn't moved. */ - .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ - .byte 0x6 - .byte 0x20 - .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ - .byte 0x2 - .byte 0xa /* DW_CFA_remember_state */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$4,LUW2-LUW1 - .long L$set$4 - .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ - .byte 0x7 - .byte 0x8 - .byte 0xc0+6 /* DW_CFA_restore, %rbp */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$5,LUW3-LUW2 - .long L$set$5 - .byte 0xb /* DW_CFA_restore_state */ - - .align 3 -LEFDE1: - .globl _ffi_closure_unix64.eh -_ffi_closure_unix64.eh: -LSFDE3: - .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */ - .long L$set$6 -LASFDE3: - .long LASFDE3-EH_frame1 /* FDE CIE offset */ - .quad LUW5-. /* FDE initial location */ - .set L$set$7,LUW9-LUW5 /* FDE address range */ - .quad L$set$7 - .byte 0x0 /* Augmentation size */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$8,LUW6-LUW5 - .long L$set$8 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 208,1 /* uleb128 208 */ - .byte 0xa /* DW_CFA_remember_state */ - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$9,LUW7-LUW6 - .long L$set$9 - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte 0x8 - - .byte 0x4 /* DW_CFA_advance_loc4 */ - .set L$set$10,LUW8-LUW7 - .long L$set$10 - .byte 0xb /* DW_CFA_restore_state */ - - .align 3 -LEFDE3: - .subsections_via_symbols - -#endif /* __x86_64__ */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/darwin64_c.c b/llgo/third_party/gofrontend/libffi/src/x86/darwin64_c.c deleted file mode 100644 index 1daa1c0b6fd84ea47acd27a1d16047265ee980eb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/darwin64_c.c +++ /dev/null @@ -1,643 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi64.c - Copyright (c) 20011 Anthony Green - Copyright (c) 2008, 2010 Red Hat, Inc. - Copyright (c) 2002, 2007 Bo Thorsen - - x86-64 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include - -#ifdef __x86_64__ - -#define MAX_GPR_REGS 6 -#define MAX_SSE_REGS 8 - -#ifdef __INTEL_COMPILER -#define UINT128 __m128 -#else -#define UINT128 __int128_t -#endif - -struct register_args -{ - /* Registers for argument passing. */ - UINT64 gpr[MAX_GPR_REGS]; - UINT128 sse[MAX_SSE_REGS]; -}; - -extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)(void), unsigned ssecount); - -/* All reference to register classes here is identical to the code in - gcc/config/i386/i386.c. Do *not* change one without the other. */ - -/* Register class used for passing given 64bit part of the argument. - These represent classes as documented by the PS ABI, with the - exception of SSESF, SSEDF classes, that are basically SSE class, - just gcc will use SF or DFmode move instead of DImode to avoid - reformatting penalties. - - Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves - whenever possible (upper half does contain padding). */ -enum x86_64_reg_class - { - X86_64_NO_CLASS, - X86_64_INTEGER_CLASS, - X86_64_INTEGERSI_CLASS, - X86_64_SSE_CLASS, - X86_64_SSESF_CLASS, - X86_64_SSEDF_CLASS, - X86_64_SSEUP_CLASS, - X86_64_X87_CLASS, - X86_64_X87UP_CLASS, - X86_64_COMPLEX_X87_CLASS, - X86_64_MEMORY_CLASS - }; - -#define MAX_CLASSES 4 - -#define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) - -/* x86-64 register passing implementation. See x86-64 ABI for details. Goal - of this code is to classify each 8bytes of incoming argument by the register - class and assign registers accordingly. */ - -/* Return the union class of CLASS1 and CLASS2. - See the x86-64 PS ABI for details. */ - -static enum x86_64_reg_class -merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) -{ - /* Rule #1: If both classes are equal, this is the resulting class. */ - if (class1 == class2) - return class1; - - /* Rule #2: If one of the classes is NO_CLASS, the resulting class is - the other class. */ - if (class1 == X86_64_NO_CLASS) - return class2; - if (class2 == X86_64_NO_CLASS) - return class1; - - /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ - if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) - return X86_64_MEMORY_CLASS; - - /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ - if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) - || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) - return X86_64_INTEGERSI_CLASS; - if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS - || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) - return X86_64_INTEGER_CLASS; - - /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, - MEMORY is used. */ - if (class1 == X86_64_X87_CLASS - || class1 == X86_64_X87UP_CLASS - || class1 == X86_64_COMPLEX_X87_CLASS - || class2 == X86_64_X87_CLASS - || class2 == X86_64_X87UP_CLASS - || class2 == X86_64_COMPLEX_X87_CLASS) - return X86_64_MEMORY_CLASS; - - /* Rule #6: Otherwise class SSE is used. */ - return X86_64_SSE_CLASS; -} - -/* Classify the argument of type TYPE and mode MODE. - CLASSES will be filled by the register class used to pass each word - of the operand. The number of words is returned. In case the parameter - should be passed in memory, 0 is returned. As a special case for zero - sized containers, classes[0] will be NO_CLASS and 1 is returned. - - See the x86-64 PS ABI for details. -*/ -static int -classify_argument (ffi_type *type, enum x86_64_reg_class classes[], - size_t byte_offset) -{ - switch (type->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - { - int size = byte_offset + type->size; - - if (size <= 4) - { - classes[0] = X86_64_INTEGERSI_CLASS; - return 1; - } - else if (size <= 8) - { - classes[0] = X86_64_INTEGER_CLASS; - return 1; - } - else if (size <= 12) - { - classes[0] = X86_64_INTEGER_CLASS; - classes[1] = X86_64_INTEGERSI_CLASS; - return 2; - } - else if (size <= 16) - { - classes[0] = classes[1] = X86_64_INTEGERSI_CLASS; - return 2; - } - else - FFI_ASSERT (0); - } - case FFI_TYPE_FLOAT: - if (!(byte_offset % 8)) - classes[0] = X86_64_SSESF_CLASS; - else - classes[0] = X86_64_SSE_CLASS; - return 1; - case FFI_TYPE_DOUBLE: - classes[0] = X86_64_SSEDF_CLASS; - return 1; - case FFI_TYPE_LONGDOUBLE: - classes[0] = X86_64_X87_CLASS; - classes[1] = X86_64_X87UP_CLASS; - return 2; - case FFI_TYPE_STRUCT: - { - const int UNITS_PER_WORD = 8; - int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - ffi_type **ptr; - int i; - enum x86_64_reg_class subclasses[MAX_CLASSES]; - - /* If the struct is larger than 32 bytes, pass it on the stack. */ - if (type->size > 32) - return 0; - - for (i = 0; i < words; i++) - classes[i] = X86_64_NO_CLASS; - - /* Zero sized arrays or structures are NO_CLASS. We return 0 to - signalize memory class, so handle it as special case. */ - if (!words) - { - classes[0] = X86_64_NO_CLASS; - return 1; - } - - /* Merge the fields of structure. */ - for (ptr = type->elements; *ptr != NULL; ptr++) - { - int num; - - byte_offset = ALIGN (byte_offset, (*ptr)->alignment); - - num = classify_argument (*ptr, subclasses, byte_offset % 8); - if (num == 0) - return 0; - for (i = 0; i < num; i++) - { - int pos = byte_offset / 8; - classes[i + pos] = - merge_classes (subclasses[i], classes[i + pos]); - } - - byte_offset += (*ptr)->size; - } - - if (words > 2) - { - /* When size > 16 bytes, if the first one isn't - X86_64_SSE_CLASS or any other ones aren't - X86_64_SSEUP_CLASS, everything should be passed in - memory. */ - if (classes[0] != X86_64_SSE_CLASS) - return 0; - - for (i = 1; i < words; i++) - if (classes[i] != X86_64_SSEUP_CLASS) - return 0; - } - - /* Final merger cleanup. */ - for (i = 0; i < words; i++) - { - /* If one class is MEMORY, everything should be passed in - memory. */ - if (classes[i] == X86_64_MEMORY_CLASS) - return 0; - - /* The X86_64_SSEUP_CLASS should be always preceded by - X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ - if (classes[i] == X86_64_SSEUP_CLASS - && classes[i - 1] != X86_64_SSE_CLASS - && classes[i - 1] != X86_64_SSEUP_CLASS) - { - /* The first one should never be X86_64_SSEUP_CLASS. */ - FFI_ASSERT (i != 0); - classes[i] = X86_64_SSE_CLASS; - } - - /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, - everything should be passed in memory. */ - if (classes[i] == X86_64_X87UP_CLASS - && (classes[i - 1] != X86_64_X87_CLASS)) - { - /* The first one should never be X86_64_X87UP_CLASS. */ - FFI_ASSERT (i != 0); - return 0; - } - } - return words; - } - - default: - FFI_ASSERT(0); - } - return 0; /* Never reached. */ -} - -/* Examine the argument and return set number of register required in each - class. Return zero iff parameter should be passed in memory, otherwise - the number of registers. */ - -static int -examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], - _Bool in_return, int *pngpr, int *pnsse) -{ - int i, n, ngpr, nsse; - - n = classify_argument (type, classes, 0); - if (n == 0) - return 0; - - ngpr = nsse = 0; - for (i = 0; i < n; ++i) - switch (classes[i]) - { - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - ngpr++; - break; - case X86_64_SSE_CLASS: - case X86_64_SSESF_CLASS: - case X86_64_SSEDF_CLASS: - nsse++; - break; - case X86_64_NO_CLASS: - case X86_64_SSEUP_CLASS: - break; - case X86_64_X87_CLASS: - case X86_64_X87UP_CLASS: - case X86_64_COMPLEX_X87_CLASS: - return in_return != 0; - default: - abort (); - } - - *pngpr = ngpr; - *pnsse = nsse; - - return n; -} - -/* Perform machine dependent cif processing. */ - -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - int gprcount, ssecount, i, avn, n, ngpr, nsse, flags; - enum x86_64_reg_class classes[MAX_CLASSES]; - size_t bytes; - - gprcount = ssecount = 0; - - flags = cif->rtype->type; - if (flags != FFI_TYPE_VOID) - { - n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); - if (n == 0) - { - /* The return value is passed in memory. A pointer to that - memory is the first argument. Allocate a register for it. */ - gprcount++; - /* We don't have to do anything in asm for the return. */ - flags = FFI_TYPE_VOID; - } - else if (flags == FFI_TYPE_STRUCT) - { - /* Mark which registers the result appears in. */ - _Bool sse0 = SSE_CLASS_P (classes[0]); - _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); - if (sse0 && !sse1) - flags |= 1 << 8; - else if (!sse0 && sse1) - flags |= 1 << 9; - else if (sse0 && sse1) - flags |= 1 << 10; - /* Mark the true size of the structure. */ - flags |= cif->rtype->size << 12; - } - } - - /* Go over all arguments and determine the way they should be passed. - If it's in a register and there is space for it, let that be so. If - not, add it's size to the stack byte count. */ - for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) - { - if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = cif->arg_types[i]->alignment; - - if (align < 8) - align = 8; - - bytes = ALIGN (bytes, align); - bytes += cif->arg_types[i]->size; - } - else - { - gprcount += ngpr; - ssecount += nsse; - } - } - if (ssecount) - flags |= 1 << 11; - cif->flags = flags; - cif->bytes = ALIGN (bytes, 8); - - return FFI_OK; -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - enum x86_64_reg_class classes[MAX_CLASSES]; - char *stack, *argp; - ffi_type **arg_types; - int gprcount, ssecount, ngpr, nsse, i, avn; - _Bool ret_in_memory; - struct register_args *reg_args; - - /* Can't call 32-bit mode from 64-bit mode. */ - FFI_ASSERT (cif->abi == FFI_UNIX64); - - /* If the return value is a struct and we don't have a return value - address then we need to make one. Note the setting of flags to - VOID above in ffi_prep_cif_machdep. */ - ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT - && (cif->flags & 0xff) == FFI_TYPE_VOID); - if (rvalue == NULL && ret_in_memory) - rvalue = alloca (cif->rtype->size); - - /* Allocate the space for the arguments, plus 4 words of temp space. */ - stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); - reg_args = (struct register_args *) stack; - argp = stack + sizeof (struct register_args); - - gprcount = ssecount = 0; - - /* If the return value is passed in memory, add the pointer as the - first integer argument. */ - if (ret_in_memory) - reg_args->gpr[gprcount++] = (unsigned long) rvalue; - - avn = cif->nargs; - arg_types = cif->arg_types; - - for (i = 0; i < avn; ++i) - { - size_t size = arg_types[i]->size; - int n; - - n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); - if (n == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = arg_types[i]->alignment; - - /* Stack arguments are *always* at least 8 byte aligned. */ - if (align < 8) - align = 8; - - /* Pass this argument in memory. */ - argp = (void *) ALIGN (argp, align); - memcpy (argp, avalue[i], size); - argp += size; - } - else - { - /* The argument is passed entirely in registers. */ - char *a = (char *) avalue[i]; - int j; - - for (j = 0; j < n; j++, a += 8, size -= 8) - { - switch (classes[j]) - { - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - reg_args->gpr[gprcount] = 0; - memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); - gprcount++; - break; - case X86_64_SSE_CLASS: - case X86_64_SSEDF_CLASS: - reg_args->sse[ssecount++] = *(UINT64 *) a; - break; - case X86_64_SSESF_CLASS: - reg_args->sse[ssecount++] = *(UINT32 *) a; - break; - default: - abort(); - } - } - } - } - - ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), - cif->flags, rvalue, fn, ssecount); -} - - -extern void ffi_closure_unix64(void); - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - volatile unsigned short *tramp; - - /* Sanity check on the cif ABI. */ - { - int abi = cif->abi; - if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))) - return FFI_BAD_ABI; - } - - tramp = (volatile unsigned short *) &closure->tramp[0]; - - tramp[0] = 0xbb49; /* mov , %r11 */ - *((unsigned long long * volatile) &tramp[1]) - = (unsigned long) ffi_closure_unix64; - tramp[5] = 0xba49; /* mov , %r10 */ - *((unsigned long long * volatile) &tramp[6]) - = (unsigned long) codeloc; - - /* Set the carry bit iff the function uses any sse registers. - This is clc or stc, together with the first byte of the jmp. */ - tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; - - tramp[11] = 0xe3ff; /* jmp *%r11 */ - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -int -ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue, - struct register_args *reg_args, char *argp) -{ - ffi_cif *cif; - void **avalue; - ffi_type **arg_types; - long i, avn; - int gprcount, ssecount, ngpr, nsse; - int ret; - - cif = closure->cif; - avalue = alloca(cif->nargs * sizeof(void *)); - gprcount = ssecount = 0; - - ret = cif->rtype->type; - if (ret != FFI_TYPE_VOID) - { - enum x86_64_reg_class classes[MAX_CLASSES]; - int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); - if (n == 0) - { - /* The return value goes in memory. Arrange for the closure - return value to go directly back to the original caller. */ - rvalue = (void *) (unsigned long) reg_args->gpr[gprcount++]; - /* We don't have to do anything in asm for the return. */ - ret = FFI_TYPE_VOID; - } - else if (ret == FFI_TYPE_STRUCT && n == 2) - { - /* Mark which register the second word of the structure goes in. */ - _Bool sse0 = SSE_CLASS_P (classes[0]); - _Bool sse1 = SSE_CLASS_P (classes[1]); - if (!sse0 && sse1) - ret |= 1 << 8; - else if (sse0 && !sse1) - ret |= 1 << 9; - } - } - - avn = cif->nargs; - arg_types = cif->arg_types; - - for (i = 0; i < avn; ++i) - { - enum x86_64_reg_class classes[MAX_CLASSES]; - int n; - - n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); - if (n == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = arg_types[i]->alignment; - - /* Stack arguments are *always* at least 8 byte aligned. */ - if (align < 8) - align = 8; - - /* Pass this argument in memory. */ - argp = (void *) ALIGN (argp, align); - avalue[i] = argp; - argp += arg_types[i]->size; - } - /* If the argument is in a single register, or two consecutive - integer registers, then we can use that address directly. */ - else if (n == 1 - || (n == 2 && !(SSE_CLASS_P (classes[0]) - || SSE_CLASS_P (classes[1])))) - { - /* The argument is in a single register. */ - if (SSE_CLASS_P (classes[0])) - { - avalue[i] = ®_args->sse[ssecount]; - ssecount += n; - } - else - { - avalue[i] = ®_args->gpr[gprcount]; - gprcount += n; - } - } - /* Otherwise, allocate space to make them consecutive. */ - else - { - char *a = alloca (16); - int j; - - avalue[i] = a; - for (j = 0; j < n; j++, a += 8) - { - if (SSE_CLASS_P (classes[j])) - memcpy (a, ®_args->sse[ssecount++], 8); - else - memcpy (a, ®_args->gpr[gprcount++], 8); - } - } - } - - /* Invoke the closure. */ - closure->fun (cif, rvalue, avalue, closure->user_data); - - /* Tell assembly how to perform return type promotions. */ - return ret; -} - -#endif /* __x86_64__ */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/darwin_c.c b/llgo/third_party/gofrontend/libffi/src/x86/darwin_c.c deleted file mode 100644 index 6338de2a0f227b261fc6bce737b509c21c4ebe22..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/darwin_c.c +++ /dev/null @@ -1,843 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. - Copyright (c) 2002 Ranjit Mathew - Copyright (c) 2002 Bo Thorsen - Copyright (c) 2002 Roger Sayle - Copyright (C) 2008, 2010 Free Software Foundation, Inc. - - x86 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#if !defined(__x86_64__) || defined(_WIN64) || defined(__CYGWIN__) - -#ifdef _WIN64 -#include -#endif - -#include -#include - -#include - -/* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - -void ffi_prep_args(char *stack, extended_cif *ecif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; -#ifdef X86_WIN32 - size_t p_stack_args[2]; - void *p_stack_data[2]; - char *argp2 = stack; - int stack_args_count = 0; - int cabi = ecif->cif->abi; -#endif - - argp = stack; - - if ((ecif->cif->flags == FFI_TYPE_STRUCT - || ecif->cif->flags == FFI_TYPE_MS_STRUCT) -#ifdef X86_WIN64 - && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 - && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) -#endif - ) - { - *(void **) argp = ecif->rvalue; -#ifdef X86_WIN32 - /* For fastcall/thiscall this is first register-passed - argument. */ - if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL) - { - p_stack_args[stack_args_count] = sizeof (void*); - p_stack_data[stack_args_count] = argp; - ++stack_args_count; - } -#endif - argp += sizeof(void*); - } - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - i != 0; - i--, p_arg++) - { - size_t z; - - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) - argp = (char *) ALIGN(argp, sizeof(void*)); - - z = (*p_arg)->size; -#ifdef X86_WIN64 - if (z > sizeof(ffi_arg) - || ((*p_arg)->type == FFI_TYPE_STRUCT - && (z != 1 && z != 2 && z != 4 && z != 8)) -#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE - || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) -#endif - ) - { - z = sizeof(ffi_arg); - *(void **)argp = *p_argv; - } - else if ((*p_arg)->type == FFI_TYPE_FLOAT) - { - memcpy(argp, *p_argv, z); - } - else -#endif - if (z < sizeof(ffi_arg)) - { - z = sizeof(ffi_arg); - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); - break; - - case FFI_TYPE_UINT8: - *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); - break; - - case FFI_TYPE_SINT16: - *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); - break; - - case FFI_TYPE_UINT16: - *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); - break; - - case FFI_TYPE_SINT32: - *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); - break; - - case FFI_TYPE_UINT32: - *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); - break; - - case FFI_TYPE_STRUCT: - *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); - break; - - default: - FFI_ASSERT(0); - } - } - else - { - memcpy(argp, *p_argv, z); - } - -#ifdef X86_WIN32 - /* For thiscall/fastcall convention register-passed arguments - are the first two none-floating-point arguments with a size - smaller or equal to sizeof (void*). */ - if ((cabi == FFI_THISCALL && stack_args_count < 1) - || (cabi == FFI_FASTCALL && stack_args_count < 2)) - { - if (z <= 4 - && ((*p_arg)->type != FFI_TYPE_FLOAT - && (*p_arg)->type != FFI_TYPE_STRUCT)) - { - p_stack_args[stack_args_count] = z; - p_stack_data[stack_args_count] = argp; - ++stack_args_count; - } - } -#endif - p_argv++; -#ifdef X86_WIN64 - argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); -#else - argp += z; -#endif - } - -#ifdef X86_WIN32 - /* We need to move the register-passed arguments for thiscall/fastcall - on top of stack, so that those can be moved to registers ecx/edx by - call-handler. */ - if (stack_args_count > 0) - { - size_t zz = (p_stack_args[0] + 3) & ~3; - char *h; - - /* Move first argument to top-stack position. */ - if (p_stack_data[0] != argp2) - { - h = alloca (zz + 1); - memcpy (h, p_stack_data[0], zz); - memmove (argp2 + zz, argp2, - (size_t) ((char *) p_stack_data[0] - (char*)argp2)); - memcpy (argp2, h, zz); - } - - argp2 += zz; - --stack_args_count; - if (zz > 4) - stack_args_count = 0; - - /* If we have a second argument, then move it on top - after the first one. */ - if (stack_args_count > 0 && p_stack_data[1] != argp2) - { - zz = p_stack_args[1]; - zz = (zz + 3) & ~3; - h = alloca (zz + 1); - h = alloca (zz + 1); - memcpy (h, p_stack_data[1], zz); - memmove (argp2 + zz, argp2, (size_t) ((char*) p_stack_data[1] - (char*)argp2)); - memcpy (argp2, h, zz); - } - } -#endif - return; -} - -/* Perform machine dependent cif processing */ -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - unsigned int i; - ffi_type **ptr; - - /* Set the return type flag */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - case FFI_TYPE_UINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT8: - case FFI_TYPE_SINT16: -#ifdef X86_WIN64 - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: -#endif - case FFI_TYPE_SINT64: - case FFI_TYPE_FLOAT: - case FFI_TYPE_DOUBLE: -#ifndef X86_WIN64 -#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE - case FFI_TYPE_LONGDOUBLE: -#endif -#endif - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_UINT64: -#ifdef X86_WIN64 - case FFI_TYPE_POINTER: -#endif - cif->flags = FFI_TYPE_SINT64; - break; - - case FFI_TYPE_STRUCT: -#ifndef X86 - if (cif->rtype->size == 1) - { - cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ - } - else if (cif->rtype->size == 2) - { - cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ - } - else if (cif->rtype->size == 4) - { -#ifdef X86_WIN64 - cif->flags = FFI_TYPE_SMALL_STRUCT_4B; -#else - cif->flags = FFI_TYPE_INT; /* same as int type */ -#endif - } - else if (cif->rtype->size == 8) - { - cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ - } - else -#endif - { -#ifdef X86_WIN32 - if (cif->abi == FFI_MS_CDECL) - cif->flags = FFI_TYPE_MS_STRUCT; - else -#endif - cif->flags = FFI_TYPE_STRUCT; - /* allocate space for return value pointer */ - cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); - } - break; - - default: -#ifdef X86_WIN64 - cif->flags = FFI_TYPE_SINT64; - break; - case FFI_TYPE_INT: - cif->flags = FFI_TYPE_SINT32; -#else - cif->flags = FFI_TYPE_INT; -#endif - break; - } - - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - if (((*ptr)->alignment - 1) & cif->bytes) - cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); - cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); - } - -#ifdef X86_WIN64 - /* ensure space for storing four registers */ - cif->bytes += 4 * sizeof(ffi_arg); -#endif - -#ifdef X86_DARWIN - cif->bytes = (cif->bytes + 15) & ~0xF; -#endif - - return FFI_OK; -} - -#ifdef X86_WIN64 -extern int -ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); -#elif defined(X86_WIN32) -extern void -ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned, unsigned *, void (*fn)(void)); -#else -extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, - unsigned, unsigned, unsigned *, void (*fn)(void)); -#endif - -void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - -#ifdef X86_WIN64 - if (rvalue == NULL - && cif->flags == FFI_TYPE_STRUCT - && cif->rtype->size != 1 && cif->rtype->size != 2 - && cif->rtype->size != 4 && cif->rtype->size != 8) - { - ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); - } -#else - if (rvalue == NULL - && (cif->flags == FFI_TYPE_STRUCT - || cif->flags == FFI_TYPE_MS_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } -#endif - else - ecif.rvalue = rvalue; - - - switch (cif->abi) - { -#ifdef X86_WIN64 - case FFI_WIN64: - ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; -#elif defined(X86_WIN32) - case FFI_SYSV: - case FFI_STDCALL: - case FFI_MS_CDECL: - ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, - ecif.rvalue, fn); - break; - case FFI_THISCALL: - case FFI_FASTCALL: - { - unsigned int abi = cif->abi; - unsigned int i, passed_regs = 0; - - if (cif->flags == FFI_TYPE_STRUCT) - ++passed_regs; - - for (i=0; i < cif->nargs && passed_regs < 2;i++) - { - size_t sz; - - if (cif->arg_types[i]->type == FFI_TYPE_FLOAT - || cif->arg_types[i]->type == FFI_TYPE_STRUCT) - continue; - sz = (cif->arg_types[i]->size + 3) & ~3; - if (sz == 0 || sz > 4) - continue; - ++passed_regs; - } - if (passed_regs < 2 && abi == FFI_FASTCALL) - abi = FFI_THISCALL; - if (passed_regs < 1 && abi == FFI_THISCALL) - abi = FFI_STDCALL; - ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags, - ecif.rvalue, fn); - } - break; -#else - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, - fn); - break; -#endif - default: - FFI_ASSERT(0); - break; - } -} - - -/** private members **/ - -/* The following __attribute__((regparm(1))) decorations will have no effect - on MSVC - standard cdecl convention applies. */ -static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, - void** args, ffi_cif* cif); -void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) - __attribute__ ((regparm(1))); -unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) - __attribute__ ((regparm(1))); -void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) - __attribute__ ((regparm(1))); -#ifdef X86_WIN32 -void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *) - __attribute__ ((regparm(1))); -void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) - __attribute__ ((regparm(1))); -void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *) - __attribute__ ((regparm(1))); -#endif -#ifdef X86_WIN64 -void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); -#endif - -/* This function is jumped to by the trampoline */ - -#ifdef X86_WIN64 -void * FFI_HIDDEN -ffi_closure_win64_inner (ffi_closure *closure, void *args) { - ffi_cif *cif; - void **arg_area; - void *result; - void *resp = &result; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); - - /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding - * value on the stack; and if the function returns - * a structure, it will change RESP to point to the - * structure return address. */ - - ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); - - (closure->fun) (cif, resp, arg_area, closure->user_data); - - /* The result is returned in rax. This does the right thing for - result types except for floats; we have to 'mov xmm0, rax' in the - caller to correct this. - TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! - */ - return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; -} - -#else -unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) -ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) -{ - /* our various things... */ - ffi_cif *cif; - void **arg_area; - - cif = closure->cif; - arg_area = (void**) alloca (cif->nargs * sizeof (void*)); - - /* this call will initialize ARG_AREA, such that each - * element in that array points to the corresponding - * value on the stack; and if the function returns - * a structure, it will change RESP to point to the - * structure return address. */ - - ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); - - (closure->fun) (cif, *respp, arg_area, closure->user_data); - - return cif->flags; -} -#endif /* !X86_WIN64 */ - -static void -ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, - ffi_cif *cif) -{ - register unsigned int i; - register void **p_argv; - register char *argp; - register ffi_type **p_arg; - - argp = stack; - -#ifdef X86_WIN64 - if (cif->rtype->size > sizeof(ffi_arg) - || (cif->flags == FFI_TYPE_STRUCT - && (cif->rtype->size != 1 && cif->rtype->size != 2 - && cif->rtype->size != 4 && cif->rtype->size != 8))) { - *rvalue = *(void **) argp; - argp += sizeof(void *); - } -#else - if ( cif->flags == FFI_TYPE_STRUCT - || cif->flags == FFI_TYPE_MS_STRUCT ) { - *rvalue = *(void **) argp; - argp += sizeof(void *); - } -#endif - - p_argv = avalue; - - for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) - { - size_t z; - - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) { - argp = (char *) ALIGN(argp, sizeof(void*)); - } - -#ifdef X86_WIN64 - if ((*p_arg)->size > sizeof(ffi_arg) - || ((*p_arg)->type == FFI_TYPE_STRUCT - && ((*p_arg)->size != 1 && (*p_arg)->size != 2 - && (*p_arg)->size != 4 && (*p_arg)->size != 8))) - { - z = sizeof(void *); - *p_argv = *(void **)argp; - } - else -#endif - { - z = (*p_arg)->size; - - /* because we're little endian, this is what it turns into. */ - - *p_argv = (void*) argp; - } - - p_argv++; -#ifdef X86_WIN64 - argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); -#else - argp += z; -#endif - } - - return; -} - -#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ -{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - void* __fun = (void*)(FUN); \ - void* __ctx = (void*)(CTX); \ - *(unsigned char*) &__tramp[0] = 0x41; \ - *(unsigned char*) &__tramp[1] = 0xbb; \ - *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ - *(unsigned char*) &__tramp[6] = 0x48; \ - *(unsigned char*) &__tramp[7] = 0xb8; \ - *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ - *(unsigned char *) &__tramp[16] = 0x49; \ - *(unsigned char *) &__tramp[17] = 0xba; \ - *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ - *(unsigned char *) &__tramp[26] = 0x41; \ - *(unsigned char *) &__tramp[27] = 0xff; \ - *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ - } - -/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ - -#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ -{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - unsigned int __fun = (unsigned int)(FUN); \ - unsigned int __ctx = (unsigned int)(CTX); \ - unsigned int __dis = __fun - (__ctx + 10); \ - *(unsigned char*) &__tramp[0] = 0xb8; \ - *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ - *(unsigned char *) &__tramp[5] = 0xe9; \ - *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ - } - -#define FFI_INIT_TRAMPOLINE_THISCALL(TRAMP,FUN,CTX,SIZE) \ -{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - unsigned int __fun = (unsigned int)(FUN); \ - unsigned int __ctx = (unsigned int)(CTX); \ - unsigned int __dis = __fun - (__ctx + 49); \ - unsigned short __size = (unsigned short)(SIZE); \ - *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ - *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ - *(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \ - *(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \ - *(unsigned char*) &__tramp[13] = 0xb8; \ - *(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \ - *(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \ - *(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \ - *(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \ - *(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \ - *(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \ - *(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \ - *(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \ - *(unsigned char*) &__tramp[39] = 0xb8; \ - *(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \ - *(unsigned char *) &__tramp[44] = 0xe8; \ - *(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \ - *(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \ - *(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \ - } - -#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ -{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ - unsigned int __fun = (unsigned int)(FUN); \ - unsigned int __ctx = (unsigned int)(CTX); \ - unsigned int __dis = __fun - (__ctx + 10); \ - unsigned short __size = (unsigned short)(SIZE); \ - *(unsigned char*) &__tramp[0] = 0xb8; \ - *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ - *(unsigned char *) &__tramp[5] = 0xe8; \ - *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ - *(unsigned char *) &__tramp[10] = 0xc2; \ - *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ - } - -/* the cif must already be prep'ed */ - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ -#ifdef X86_WIN64 -#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) -#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) - if (cif->abi == FFI_WIN64) - { - int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); - FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], - &ffi_closure_win64, - codeloc, mask); - /* make sure we can execute here */ - } -#else - if (cif->abi == FFI_SYSV) - { - FFI_INIT_TRAMPOLINE (&closure->tramp[0], - &ffi_closure_SYSV, - (void*)codeloc); - } -#ifdef X86_WIN32 - else if (cif->abi == FFI_THISCALL) - { - FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], - &ffi_closure_THISCALL, - (void*)codeloc, - cif->bytes); - } - else if (cif->abi == FFI_STDCALL) - { - FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], - &ffi_closure_STDCALL, - (void*)codeloc, cif->bytes); - } - else if (cif->abi == FFI_MS_CDECL) - { - FFI_INIT_TRAMPOLINE (&closure->tramp[0], - &ffi_closure_SYSV, - (void*)codeloc); - } -#endif /* X86_WIN32 */ -#endif /* !X86_WIN64 */ - else - { - return FFI_BAD_ABI; - } - - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} - -/* ------- Native raw API support -------------------------------- */ - -#if !FFI_NO_RAW_API - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc) -{ - int i; - - if (cif->abi != FFI_SYSV) { -#ifdef X86_WIN32 - if (cif->abi != FFI_THISCALL) -#endif - return FFI_BAD_ABI; - } - - /* we currently don't support certain kinds of arguments for raw - closures. This should be implemented by a separate assembly - language routine, since it would require argument processing, - something we don't do now for performance. */ - - for (i = cif->nargs-1; i >= 0; i--) - { - FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); - FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); - } - -#ifdef X86_WIN32 - if (cif->abi == FFI_SYSV) - { -#endif - FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, - codeloc); -#ifdef X86_WIN32 - } - else if (cif->abi == FFI_THISCALL) - { - FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, - codeloc, cif->bytes); - } -#endif - closure->cif = cif; - closure->user_data = user_data; - closure->fun = fun; - - return FFI_OK; -} - -static void -ffi_prep_args_raw(char *stack, extended_cif *ecif) -{ - memcpy (stack, ecif->avalue, ecif->cif->bytes); -} - -/* we borrow this routine from libffi (it must be changed, though, to - * actually call the function passed in the first argument. as of - * libffi-1.20, this is not the case.) - */ - -void -ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) -{ - extended_cif ecif; - void **avalue = (void **)fake_avalue; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have a return */ - /* value address then we need to make one */ - - if (rvalue == NULL - && (cif->flags == FFI_TYPE_STRUCT - || cif->flags == FFI_TYPE_MS_STRUCT)) - { - ecif.rvalue = alloca(cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - - switch (cif->abi) - { -#ifdef X86_WIN32 - case FFI_SYSV: - case FFI_STDCALL: - case FFI_MS_CDECL: - ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags, - ecif.rvalue, fn); - break; - case FFI_THISCALL: - case FFI_FASTCALL: - { - unsigned int abi = cif->abi; - unsigned int i, passed_regs = 0; - - if (cif->flags == FFI_TYPE_STRUCT) - ++passed_regs; - - for (i=0; i < cif->nargs && passed_regs < 2;i++) - { - size_t sz; - - if (cif->arg_types[i]->type == FFI_TYPE_FLOAT - || cif->arg_types[i]->type == FFI_TYPE_STRUCT) - continue; - sz = (cif->arg_types[i]->size + 3) & ~3; - if (sz == 0 || sz > 4) - continue; - ++passed_regs; - } - if (passed_regs < 2 && abi == FFI_FASTCALL) - cif->abi = abi = FFI_THISCALL; - if (passed_regs < 1 && abi == FFI_THISCALL) - cif->abi = abi = FFI_STDCALL; - ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags, - ecif.rvalue, fn); - } - break; -#else - case FFI_SYSV: - ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, - ecif.rvalue, fn); - break; -#endif - default: - FFI_ASSERT(0); - break; - } -} - -#endif - -#endif /* !__x86_64__ || X86_WIN64 */ - diff --git a/llgo/third_party/gofrontend/libffi/src/x86/ffi.c b/llgo/third_party/gofrontend/libffi/src/x86/ffi.c deleted file mode 100644 index 3885e3995016aa7c0f825a7f8846ed0344b8ce5d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/ffi.c +++ /dev/null @@ -1,725 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. - Copyright (c) 2002 Ranjit Mathew - Copyright (c) 2002 Bo Thorsen - Copyright (c) 2002 Roger Sayle - Copyright (C) 2008, 2010 Free Software Foundation, Inc. - - x86 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef __x86_64__ -#include -#include -#include -#include "internal.h" - -/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 80-bit type. */ -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE -# if FFI_TYPE_LONGDOUBLE != 4 -# error FFI_TYPE_LONGDOUBLE out of date -# endif -#else -# undef FFI_TYPE_LONGDOUBLE -# define FFI_TYPE_LONGDOUBLE 4 -#endif - -#if defined(__GNUC__) && !defined(__declspec) -# define __declspec(x) __attribute__((x)) -#endif - -/* Perform machine dependent cif processing. */ -ffi_status FFI_HIDDEN -ffi_prep_cif_machdep(ffi_cif *cif) -{ - size_t bytes = 0; - int i, n, flags, cabi = cif->abi; - - switch (cabi) - { - case FFI_SYSV: - case FFI_STDCALL: - case FFI_THISCALL: - case FFI_FASTCALL: - case FFI_MS_CDECL: - case FFI_PASCAL: - case FFI_REGISTER: - break; - default: - return FFI_BAD_ABI; - } - - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - flags = X86_RET_VOID; - break; - case FFI_TYPE_FLOAT: - flags = X86_RET_FLOAT; - break; - case FFI_TYPE_DOUBLE: - flags = X86_RET_DOUBLE; - break; - case FFI_TYPE_LONGDOUBLE: - flags = X86_RET_LDOUBLE; - break; - case FFI_TYPE_UINT8: - flags = X86_RET_UINT8; - break; - case FFI_TYPE_UINT16: - flags = X86_RET_UINT16; - break; - case FFI_TYPE_SINT8: - flags = X86_RET_SINT8; - break; - case FFI_TYPE_SINT16: - flags = X86_RET_SINT16; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - flags = X86_RET_INT32; - break; - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - flags = X86_RET_INT64; - break; - case FFI_TYPE_STRUCT: -#ifndef X86 - /* ??? This should be a different ABI rather than an ifdef. */ - if (cif->rtype->size == 1) - flags = X86_RET_STRUCT_1B; - else if (cif->rtype->size == 2) - flags = X86_RET_STRUCT_2B; - else if (cif->rtype->size == 4) - flags = X86_RET_INT32; - else if (cif->rtype->size == 8) - flags = X86_RET_INT64; - else -#endif - { - do_struct: - switch (cabi) - { - case FFI_THISCALL: - case FFI_FASTCALL: - case FFI_STDCALL: - case FFI_MS_CDECL: - flags = X86_RET_STRUCTARG; - break; - default: - flags = X86_RET_STRUCTPOP; - break; - } - /* Allocate space for return value pointer. */ - bytes += ALIGN (sizeof(void*), FFI_SIZEOF_ARG); - } - break; - case FFI_TYPE_COMPLEX: - switch (cif->rtype->elements[0]->type) - { - case FFI_TYPE_DOUBLE: - case FFI_TYPE_LONGDOUBLE: - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - goto do_struct; - case FFI_TYPE_FLOAT: - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - flags = X86_RET_INT64; - break; - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - flags = X86_RET_INT32; - break; - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - flags = X86_RET_STRUCT_2B; - break; - default: - return FFI_BAD_TYPEDEF; - } - break; - default: - return FFI_BAD_TYPEDEF; - } - cif->flags = flags; - - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *t = cif->arg_types[i]; - - bytes = ALIGN (bytes, t->alignment); - bytes += ALIGN (t->size, FFI_SIZEOF_ARG); - } - cif->bytes = ALIGN (bytes, 16); - - return FFI_OK; -} - -static ffi_arg -extend_basic_type(void *arg, int type) -{ - switch (type) - { - case FFI_TYPE_SINT8: - return *(SINT8 *)arg; - case FFI_TYPE_UINT8: - return *(UINT8 *)arg; - case FFI_TYPE_SINT16: - return *(SINT16 *)arg; - case FFI_TYPE_UINT16: - return *(UINT16 *)arg; - - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT32: - case FFI_TYPE_POINTER: - case FFI_TYPE_FLOAT: - return *(UINT32 *)arg; - - default: - abort(); - } -} - -struct call_frame -{ - void *ebp; /* 0 */ - void *retaddr; /* 4 */ - void (*fn)(void); /* 8 */ - int flags; /* 12 */ - void *rvalue; /* 16 */ - unsigned regs[3]; /* 20-28 */ -}; - -struct abi_params -{ - int dir; /* parameter growth direction */ - int static_chain; /* the static chain register used by gcc */ - int nregs; /* number of register parameters */ - int regs[3]; -}; - -static const struct abi_params abi_params[FFI_LAST_ABI] = { - [FFI_SYSV] = { 1, R_ECX, 0 }, - [FFI_THISCALL] = { 1, R_EAX, 1, { R_ECX } }, - [FFI_FASTCALL] = { 1, R_EAX, 2, { R_ECX, R_EDX } }, - [FFI_STDCALL] = { 1, R_ECX, 0 }, - [FFI_PASCAL] = { -1, R_ECX, 0 }, - /* ??? No defined static chain; gcc does not support REGISTER. */ - [FFI_REGISTER] = { -1, R_ECX, 3, { R_EAX, R_EDX, R_ECX } }, - [FFI_MS_CDECL] = { 1, R_ECX, 0 } -}; - -extern void ffi_call_i386(struct call_frame *, char *) -#if HAVE_FASTCALL - __declspec(fastcall) -#endif - FFI_HIDDEN; - -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - size_t rsize, bytes; - struct call_frame *frame; - char *stack, *argp; - ffi_type **arg_types; - int flags, cabi, i, n, dir, narg_reg; - const struct abi_params *pabi; - - flags = cif->flags; - cabi = cif->abi; - pabi = &abi_params[cabi]; - dir = pabi->dir; - - rsize = 0; - if (rvalue == NULL) - { - switch (flags) - { - case X86_RET_FLOAT: - case X86_RET_DOUBLE: - case X86_RET_LDOUBLE: - case X86_RET_STRUCTPOP: - case X86_RET_STRUCTARG: - /* The float cases need to pop the 387 stack. - The struct cases need to pass a valid pointer to the callee. */ - rsize = cif->rtype->size; - break; - default: - /* We can pretend that the callee returns nothing. */ - flags = X86_RET_VOID; - break; - } - } - - bytes = cif->bytes; - stack = alloca(bytes + sizeof(*frame) + rsize); - argp = (dir < 0 ? stack + bytes : stack); - frame = (struct call_frame *)(stack + bytes); - if (rsize) - rvalue = frame + 1; - - frame->fn = fn; - frame->flags = flags; - frame->rvalue = rvalue; - frame->regs[pabi->static_chain] = (unsigned)closure; - - narg_reg = 0; - switch (flags) - { - case X86_RET_STRUCTARG: - /* The pointer is passed as the first argument. */ - if (pabi->nregs > 0) - { - frame->regs[pabi->regs[0]] = (unsigned)rvalue; - narg_reg = 1; - break; - } - /* fallthru */ - case X86_RET_STRUCTPOP: - *(void **)argp = rvalue; - argp += sizeof(void *); - break; - } - - arg_types = cif->arg_types; - for (i = 0, n = cif->nargs; i < n; i++) - { - ffi_type *ty = arg_types[i]; - void *valp = avalue[i]; - size_t z = ty->size; - int t = ty->type; - - if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT) - { - ffi_arg val = extend_basic_type (valp, t); - - if (t != FFI_TYPE_FLOAT && narg_reg < pabi->nregs) - frame->regs[pabi->regs[narg_reg++]] = val; - else if (dir < 0) - { - argp -= 4; - *(ffi_arg *)argp = val; - } - else - { - *(ffi_arg *)argp = val; - argp += 4; - } - } - else - { - size_t za = ALIGN (z, FFI_SIZEOF_ARG); - size_t align = FFI_SIZEOF_ARG; - - /* Alignment rules for arguments are quite complex. Vectors and - structures with 16 byte alignment get it. Note that long double - on Darwin does have 16 byte alignment, and does not get this - alignment if passed directly; a structure with a long double - inside, however, would get 16 byte alignment. Since libffi does - not support vectors, we need non concern ourselves with other - cases. */ - if (t == FFI_TYPE_STRUCT && ty->alignment >= 16) - align = 16; - - if (dir < 0) - { - /* ??? These reverse argument ABIs are probably too old - to have cared about alignment. Someone should check. */ - argp -= za; - memcpy (argp, valp, z); - } - else - { - argp = (char *)ALIGN (argp, align); - memcpy (argp, valp, z); - argp += za; - } - } - } - FFI_ASSERT (dir > 0 || argp == stack); - - ffi_call_i386 (frame, stack); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - -/** private members **/ - -void FFI_HIDDEN ffi_closure_i386(void); -void FFI_HIDDEN ffi_closure_STDCALL(void); -void FFI_HIDDEN ffi_closure_REGISTER(void); - -struct closure_frame -{ - unsigned rettemp[4]; /* 0 */ - unsigned regs[3]; /* 16-24 */ - ffi_cif *cif; /* 28 */ - void (*fun)(ffi_cif*,void*,void**,void*); /* 32 */ - void *user_data; /* 36 */ -}; - -int FFI_HIDDEN -#if HAVE_FASTCALL -__declspec(fastcall) -#endif -ffi_closure_inner (struct closure_frame *frame, char *stack) -{ - ffi_cif *cif = frame->cif; - int cabi, i, n, flags, dir, narg_reg; - const struct abi_params *pabi; - ffi_type **arg_types; - char *argp; - void *rvalue; - void **avalue; - - cabi = cif->abi; - flags = cif->flags; - narg_reg = 0; - rvalue = frame->rettemp; - pabi = &abi_params[cabi]; - dir = pabi->dir; - argp = (dir < 0 ? stack + cif->bytes : stack); - - switch (flags) - { - case X86_RET_STRUCTARG: - if (pabi->nregs > 0) - { - rvalue = (void *)frame->regs[pabi->regs[0]]; - narg_reg = 1; - frame->rettemp[0] = (unsigned)rvalue; - break; - } - /* fallthru */ - case X86_RET_STRUCTPOP: - rvalue = *(void **)argp; - argp += sizeof(void *); - frame->rettemp[0] = (unsigned)rvalue; - break; - } - - n = cif->nargs; - avalue = alloca(sizeof(void *) * n); - - arg_types = cif->arg_types; - for (i = 0; i < n; ++i) - { - ffi_type *ty = arg_types[i]; - size_t z = ty->size; - int t = ty->type; - void *valp; - - if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT) - { - if (t != FFI_TYPE_FLOAT && narg_reg < pabi->nregs) - valp = &frame->regs[pabi->regs[narg_reg++]]; - else if (dir < 0) - { - argp -= 4; - valp = argp; - } - else - { - valp = argp; - argp += 4; - } - } - else - { - size_t za = ALIGN (z, FFI_SIZEOF_ARG); - size_t align = FFI_SIZEOF_ARG; - - /* See the comment in ffi_call_int. */ - if (t == FFI_TYPE_STRUCT && ty->alignment >= 16) - align = 16; - - if (dir < 0) - { - /* ??? These reverse argument ABIs are probably too old - to have cared about alignment. Someone should check. */ - argp -= za; - valp = argp; - } - else - { - argp = (char *)ALIGN (argp, align); - valp = argp; - argp += za; - } - } - - avalue[i] = valp; - } - - frame->fun (cif, rvalue, avalue, frame->user_data); - - if (cabi == FFI_STDCALL) - return flags + (cif->bytes << X86_RET_POP_SHIFT); - else - return flags; -} - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data, - void *codeloc) -{ - char *tramp = closure->tramp; - void (*dest)(void); - int op = 0xb8; /* movl imm, %eax */ - - switch (cif->abi) - { - case FFI_SYSV: - case FFI_THISCALL: - case FFI_FASTCALL: - case FFI_MS_CDECL: - dest = ffi_closure_i386; - break; - case FFI_STDCALL: - case FFI_PASCAL: - dest = ffi_closure_STDCALL; - break; - case FFI_REGISTER: - dest = ffi_closure_REGISTER; - op = 0x68; /* pushl imm */ - default: - return FFI_BAD_ABI; - } - - /* movl or pushl immediate. */ - tramp[0] = op; - *(void **)(tramp + 1) = codeloc; - - /* jmp dest */ - tramp[5] = 0xe9; - *(unsigned *)(tramp + 6) = (unsigned)dest - ((unsigned)codeloc + 10); - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -void FFI_HIDDEN ffi_go_closure_EAX(void); -void FFI_HIDDEN ffi_go_closure_ECX(void); -void FFI_HIDDEN ffi_go_closure_STDCALL(void); - -ffi_status -ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*,void*,void**,void*)) -{ - void (*dest)(void); - - switch (cif->abi) - { - case FFI_SYSV: - case FFI_MS_CDECL: - dest = ffi_go_closure_ECX; - break; - case FFI_THISCALL: - case FFI_FASTCALL: - dest = ffi_go_closure_EAX; - break; - case FFI_STDCALL: - case FFI_PASCAL: - dest = ffi_go_closure_STDCALL; - break; - case FFI_REGISTER: - default: - return FFI_BAD_ABI; - } - - closure->tramp = dest; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -/* ------- Native raw API support -------------------------------- */ - -#if !FFI_NO_RAW_API - -void FFI_HIDDEN ffi_closure_raw_SYSV(void); -void FFI_HIDDEN ffi_closure_raw_THISCALL(void); - -ffi_status -ffi_prep_raw_closure_loc (ffi_raw_closure *closure, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc) -{ - char *tramp = closure->tramp; - void (*dest)(void); - int i; - - /* We currently don't support certain kinds of arguments for raw - closures. This should be implemented by a separate assembly - language routine, since it would require argument processing, - something we don't do now for performance. */ - for (i = cif->nargs-1; i >= 0; i--) - switch (cif->arg_types[i]->type) - { - case FFI_TYPE_STRUCT: - case FFI_TYPE_LONGDOUBLE: - return FFI_BAD_TYPEDEF; - } - - switch (cif->abi) - { - case FFI_THISCALL: - dest = ffi_closure_raw_THISCALL; - break; - case FFI_SYSV: - dest = ffi_closure_raw_SYSV; - break; - default: - return FFI_BAD_ABI; - } - - /* movl imm, %eax. */ - tramp[0] = 0xb8; - *(void **)(tramp + 1) = codeloc; - - /* jmp dest */ - tramp[5] = 0xe9; - *(unsigned *)(tramp + 6) = (unsigned)dest - ((unsigned)codeloc + 10); - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -void -ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *avalue) -{ - size_t rsize, bytes; - struct call_frame *frame; - char *stack, *argp; - ffi_type **arg_types; - int flags, cabi, i, n, narg_reg; - const struct abi_params *pabi; - - flags = cif->flags; - cabi = cif->abi; - pabi = &abi_params[cabi]; - - rsize = 0; - if (rvalue == NULL) - { - switch (flags) - { - case X86_RET_FLOAT: - case X86_RET_DOUBLE: - case X86_RET_LDOUBLE: - case X86_RET_STRUCTPOP: - case X86_RET_STRUCTARG: - /* The float cases need to pop the 387 stack. - The struct cases need to pass a valid pointer to the callee. */ - rsize = cif->rtype->size; - break; - default: - /* We can pretend that the callee returns nothing. */ - flags = X86_RET_VOID; - break; - } - } - - bytes = cif->bytes; - argp = stack = alloca(bytes + sizeof(*frame) + rsize); - frame = (struct call_frame *)(stack + bytes); - if (rsize) - rvalue = frame + 1; - - narg_reg = 0; - switch (flags) - { - case X86_RET_STRUCTARG: - /* The pointer is passed as the first argument. */ - if (pabi->nregs > 0) - { - frame->regs[pabi->regs[0]] = (unsigned)rvalue; - narg_reg = 1; - break; - } - /* fallthru */ - case X86_RET_STRUCTPOP: - *(void **)argp = rvalue; - argp += sizeof(void *); - bytes -= sizeof(void *); - break; - } - - arg_types = cif->arg_types; - for (i = 0, n = cif->nargs; narg_reg < pabi->nregs && i < n; i++) - { - ffi_type *ty = arg_types[i]; - size_t z = ty->size; - int t = ty->type; - - if (z <= FFI_SIZEOF_ARG && t != FFI_TYPE_STRUCT && t != FFI_TYPE_FLOAT) - { - ffi_arg val = extend_basic_type (avalue, t); - frame->regs[pabi->regs[narg_reg++]] = val; - z = FFI_SIZEOF_ARG; - } - else - { - memcpy (argp, avalue, z); - z = ALIGN (z, FFI_SIZEOF_ARG); - argp += z; - } - avalue += z; - bytes -= z; - } - if (i < n) - memcpy (argp, avalue, bytes); - - ffi_call_i386 (frame, stack); -} -#endif /* !FFI_NO_RAW_API */ -#endif /* !__x86_64__ */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/ffi64.c b/llgo/third_party/gofrontend/libffi/src/x86/ffi64.c deleted file mode 100644 index 131b5e3d14864130b7eef16896fadf07680617b3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/ffi64.c +++ /dev/null @@ -1,824 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi64.c - Copyright (c) 2013 The Written Word, Inc. - Copyright (c) 2011 Anthony Green - Copyright (c) 2008, 2010 Red Hat, Inc. - Copyright (c) 2002, 2007 Bo Thorsen - - x86-64 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include -#include -#include "internal64.h" - -#ifdef __x86_64__ - -#define MAX_GPR_REGS 6 -#define MAX_SSE_REGS 8 - -#if defined(__INTEL_COMPILER) -#include "xmmintrin.h" -#define UINT128 __m128 -#else -#if defined(__SUNPRO_C) -#include -#define UINT128 __m128i -#else -#define UINT128 __int128_t -#endif -#endif - -union big_int_union -{ - UINT32 i32; - UINT64 i64; - UINT128 i128; -}; - -struct register_args -{ - /* Registers for argument passing. */ - UINT64 gpr[MAX_GPR_REGS]; - union big_int_union sse[MAX_SSE_REGS]; - UINT64 rax; /* ssecount */ - UINT64 r10; /* static chain */ -}; - -extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)(void)) FFI_HIDDEN; - -/* All reference to register classes here is identical to the code in - gcc/config/i386/i386.c. Do *not* change one without the other. */ - -/* Register class used for passing given 64bit part of the argument. - These represent classes as documented by the PS ABI, with the - exception of SSESF, SSEDF classes, that are basically SSE class, - just gcc will use SF or DFmode move instead of DImode to avoid - reformatting penalties. - - Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves - whenever possible (upper half does contain padding). */ -enum x86_64_reg_class - { - X86_64_NO_CLASS, - X86_64_INTEGER_CLASS, - X86_64_INTEGERSI_CLASS, - X86_64_SSE_CLASS, - X86_64_SSESF_CLASS, - X86_64_SSEDF_CLASS, - X86_64_SSEUP_CLASS, - X86_64_X87_CLASS, - X86_64_X87UP_CLASS, - X86_64_COMPLEX_X87_CLASS, - X86_64_MEMORY_CLASS - }; - -#define MAX_CLASSES 4 - -#define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) - -/* x86-64 register passing implementation. See x86-64 ABI for details. Goal - of this code is to classify each 8bytes of incoming argument by the register - class and assign registers accordingly. */ - -/* Return the union class of CLASS1 and CLASS2. - See the x86-64 PS ABI for details. */ - -static enum x86_64_reg_class -merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) -{ - /* Rule #1: If both classes are equal, this is the resulting class. */ - if (class1 == class2) - return class1; - - /* Rule #2: If one of the classes is NO_CLASS, the resulting class is - the other class. */ - if (class1 == X86_64_NO_CLASS) - return class2; - if (class2 == X86_64_NO_CLASS) - return class1; - - /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ - if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) - return X86_64_MEMORY_CLASS; - - /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ - if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) - || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) - return X86_64_INTEGERSI_CLASS; - if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS - || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) - return X86_64_INTEGER_CLASS; - - /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, - MEMORY is used. */ - if (class1 == X86_64_X87_CLASS - || class1 == X86_64_X87UP_CLASS - || class1 == X86_64_COMPLEX_X87_CLASS - || class2 == X86_64_X87_CLASS - || class2 == X86_64_X87UP_CLASS - || class2 == X86_64_COMPLEX_X87_CLASS) - return X86_64_MEMORY_CLASS; - - /* Rule #6: Otherwise class SSE is used. */ - return X86_64_SSE_CLASS; -} - -/* Classify the argument of type TYPE and mode MODE. - CLASSES will be filled by the register class used to pass each word - of the operand. The number of words is returned. In case the parameter - should be passed in memory, 0 is returned. As a special case for zero - sized containers, classes[0] will be NO_CLASS and 1 is returned. - - See the x86-64 PS ABI for details. -*/ -static size_t -classify_argument (ffi_type *type, enum x86_64_reg_class classes[], - size_t byte_offset) -{ - switch (type->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - case FFI_TYPE_POINTER: - do_integer: - { - size_t size = byte_offset + type->size; - - if (size <= 4) - { - classes[0] = X86_64_INTEGERSI_CLASS; - return 1; - } - else if (size <= 8) - { - classes[0] = X86_64_INTEGER_CLASS; - return 1; - } - else if (size <= 12) - { - classes[0] = X86_64_INTEGER_CLASS; - classes[1] = X86_64_INTEGERSI_CLASS; - return 2; - } - else if (size <= 16) - { - classes[0] = classes[1] = X86_64_INTEGER_CLASS; - return 2; - } - else - FFI_ASSERT (0); - } - case FFI_TYPE_FLOAT: - if (!(byte_offset % 8)) - classes[0] = X86_64_SSESF_CLASS; - else - classes[0] = X86_64_SSE_CLASS; - return 1; - case FFI_TYPE_DOUBLE: - classes[0] = X86_64_SSEDF_CLASS; - return 1; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - classes[0] = X86_64_X87_CLASS; - classes[1] = X86_64_X87UP_CLASS; - return 2; -#endif - case FFI_TYPE_STRUCT: - { - const size_t UNITS_PER_WORD = 8; - size_t words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; - ffi_type **ptr; - int i; - enum x86_64_reg_class subclasses[MAX_CLASSES]; - - /* If the struct is larger than 32 bytes, pass it on the stack. */ - if (type->size > 32) - return 0; - - for (i = 0; i < words; i++) - classes[i] = X86_64_NO_CLASS; - - /* Zero sized arrays or structures are NO_CLASS. We return 0 to - signalize memory class, so handle it as special case. */ - if (!words) - { - case FFI_TYPE_VOID: - classes[0] = X86_64_NO_CLASS; - return 1; - } - - /* Merge the fields of structure. */ - for (ptr = type->elements; *ptr != NULL; ptr++) - { - size_t num; - - byte_offset = ALIGN (byte_offset, (*ptr)->alignment); - - num = classify_argument (*ptr, subclasses, byte_offset % 8); - if (num == 0) - return 0; - for (i = 0; i < num; i++) - { - size_t pos = byte_offset / 8; - classes[i + pos] = - merge_classes (subclasses[i], classes[i + pos]); - } - - byte_offset += (*ptr)->size; - } - - if (words > 2) - { - /* When size > 16 bytes, if the first one isn't - X86_64_SSE_CLASS or any other ones aren't - X86_64_SSEUP_CLASS, everything should be passed in - memory. */ - if (classes[0] != X86_64_SSE_CLASS) - return 0; - - for (i = 1; i < words; i++) - if (classes[i] != X86_64_SSEUP_CLASS) - return 0; - } - - /* Final merger cleanup. */ - for (i = 0; i < words; i++) - { - /* If one class is MEMORY, everything should be passed in - memory. */ - if (classes[i] == X86_64_MEMORY_CLASS) - return 0; - - /* The X86_64_SSEUP_CLASS should be always preceded by - X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ - if (classes[i] == X86_64_SSEUP_CLASS - && classes[i - 1] != X86_64_SSE_CLASS - && classes[i - 1] != X86_64_SSEUP_CLASS) - { - /* The first one should never be X86_64_SSEUP_CLASS. */ - FFI_ASSERT (i != 0); - classes[i] = X86_64_SSE_CLASS; - } - - /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, - everything should be passed in memory. */ - if (classes[i] == X86_64_X87UP_CLASS - && (classes[i - 1] != X86_64_X87_CLASS)) - { - /* The first one should never be X86_64_X87UP_CLASS. */ - FFI_ASSERT (i != 0); - return 0; - } - } - return words; - } - case FFI_TYPE_COMPLEX: - { - ffi_type *inner = type->elements[0]; - switch (inner->type) - { - case FFI_TYPE_INT: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - goto do_integer; - - case FFI_TYPE_FLOAT: - classes[0] = X86_64_SSE_CLASS; - if (byte_offset % 8) - { - classes[1] = X86_64_SSESF_CLASS; - return 2; - } - return 1; - case FFI_TYPE_DOUBLE: - classes[0] = classes[1] = X86_64_SSEDF_CLASS; - return 2; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - classes[0] = X86_64_COMPLEX_X87_CLASS; - return 1; -#endif - } - } - } - abort(); -} - -/* Examine the argument and return set number of register required in each - class. Return zero iff parameter should be passed in memory, otherwise - the number of registers. */ - -static size_t -examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], - _Bool in_return, int *pngpr, int *pnsse) -{ - size_t n; - int i, ngpr, nsse; - - n = classify_argument (type, classes, 0); - if (n == 0) - return 0; - - ngpr = nsse = 0; - for (i = 0; i < n; ++i) - switch (classes[i]) - { - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - ngpr++; - break; - case X86_64_SSE_CLASS: - case X86_64_SSESF_CLASS: - case X86_64_SSEDF_CLASS: - nsse++; - break; - case X86_64_NO_CLASS: - case X86_64_SSEUP_CLASS: - break; - case X86_64_X87_CLASS: - case X86_64_X87UP_CLASS: - case X86_64_COMPLEX_X87_CLASS: - return in_return != 0; - default: - abort (); - } - - *pngpr = ngpr; - *pnsse = nsse; - - return n; -} - -/* Perform machine dependent cif processing. */ - -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - int gprcount, ssecount, i, avn, ngpr, nsse, flags; - enum x86_64_reg_class classes[MAX_CLASSES]; - size_t bytes, n, rtype_size; - ffi_type *rtype; - - if (cif->abi != FFI_UNIX64) - return FFI_BAD_ABI; - - gprcount = ssecount = 0; - - rtype = cif->rtype; - rtype_size = rtype->size; - switch (rtype->type) - { - case FFI_TYPE_VOID: - flags = UNIX64_RET_VOID; - break; - case FFI_TYPE_UINT8: - flags = UNIX64_RET_UINT8; - break; - case FFI_TYPE_SINT8: - flags = UNIX64_RET_SINT8; - break; - case FFI_TYPE_UINT16: - flags = UNIX64_RET_UINT16; - break; - case FFI_TYPE_SINT16: - flags = UNIX64_RET_SINT16; - break; - case FFI_TYPE_UINT32: - flags = UNIX64_RET_UINT32; - break; - case FFI_TYPE_INT: - case FFI_TYPE_SINT32: - flags = UNIX64_RET_SINT32; - break; - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - flags = UNIX64_RET_INT64; - break; - case FFI_TYPE_POINTER: - flags = (sizeof(void *) == 4 ? UNIX64_RET_UINT32 : UNIX64_RET_INT64); - break; - case FFI_TYPE_FLOAT: - flags = UNIX64_RET_XMM32; - break; - case FFI_TYPE_DOUBLE: - flags = UNIX64_RET_XMM64; - break; - case FFI_TYPE_LONGDOUBLE: - flags = UNIX64_RET_X87; - break; - case FFI_TYPE_STRUCT: - n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); - if (n == 0) - { - /* The return value is passed in memory. A pointer to that - memory is the first argument. Allocate a register for it. */ - gprcount++; - /* We don't have to do anything in asm for the return. */ - flags = UNIX64_RET_VOID | UNIX64_FLAG_RET_IN_MEM; - } - else - { - _Bool sse0 = SSE_CLASS_P (classes[0]); - - if (rtype_size == 4 && sse0) - flags = UNIX64_RET_XMM32; - else if (rtype_size == 8) - flags = sse0 ? UNIX64_RET_XMM64 : UNIX64_RET_INT64; - else - { - _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); - if (sse0 && sse1) - flags = UNIX64_RET_ST_XMM0_XMM1; - else if (sse0) - flags = UNIX64_RET_ST_XMM0_RAX; - else if (sse1) - flags = UNIX64_RET_ST_RAX_XMM0; - else - flags = UNIX64_RET_ST_RAX_RDX; - flags |= rtype_size << UNIX64_SIZE_SHIFT; - } - } - break; - case FFI_TYPE_COMPLEX: - switch (rtype->elements[0]->type) - { - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT16: - case FFI_TYPE_SINT16: - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - flags = UNIX64_RET_ST_RAX_RDX | (rtype_size << UNIX64_SIZE_SHIFT); - break; - case FFI_TYPE_FLOAT: - flags = UNIX64_RET_XMM64; - break; - case FFI_TYPE_DOUBLE: - flags = UNIX64_RET_ST_XMM0_XMM1 | (16 << UNIX64_SIZE_SHIFT); - break; -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - flags = UNIX64_RET_X87_2; - break; -#endif - default: - return FFI_BAD_TYPEDEF; - } - break; - default: - return FFI_BAD_TYPEDEF; - } - - /* Go over all arguments and determine the way they should be passed. - If it's in a register and there is space for it, let that be so. If - not, add it's size to the stack byte count. */ - for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) - { - if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = cif->arg_types[i]->alignment; - - if (align < 8) - align = 8; - - bytes = ALIGN (bytes, align); - bytes += cif->arg_types[i]->size; - } - else - { - gprcount += ngpr; - ssecount += nsse; - } - } - if (ssecount) - flags |= UNIX64_FLAG_XMM_ARGS; - - cif->flags = flags; - cif->bytes = ALIGN (bytes, 8); - - return FFI_OK; -} - -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - enum x86_64_reg_class classes[MAX_CLASSES]; - char *stack, *argp; - ffi_type **arg_types; - int gprcount, ssecount, ngpr, nsse, i, avn, flags; - struct register_args *reg_args; - - /* Can't call 32-bit mode from 64-bit mode. */ - FFI_ASSERT (cif->abi == FFI_UNIX64); - - /* If the return value is a struct and we don't have a return value - address then we need to make one. Otherwise we can ignore it. */ - flags = cif->flags; - if (rvalue == NULL) - { - if (flags & UNIX64_FLAG_RET_IN_MEM) - rvalue = alloca (cif->rtype->size); - else - flags = UNIX64_RET_VOID; - } - - /* Allocate the space for the arguments, plus 4 words of temp space. */ - stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); - reg_args = (struct register_args *) stack; - argp = stack + sizeof (struct register_args); - - reg_args->r10 = (uintptr_t) closure; - - gprcount = ssecount = 0; - - /* If the return value is passed in memory, add the pointer as the - first integer argument. */ - if (flags & UNIX64_FLAG_RET_IN_MEM) - reg_args->gpr[gprcount++] = (unsigned long) rvalue; - - avn = cif->nargs; - arg_types = cif->arg_types; - - for (i = 0; i < avn; ++i) - { - size_t n, size = arg_types[i]->size; - - n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); - if (n == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = arg_types[i]->alignment; - - /* Stack arguments are *always* at least 8 byte aligned. */ - if (align < 8) - align = 8; - - /* Pass this argument in memory. */ - argp = (void *) ALIGN (argp, align); - memcpy (argp, avalue[i], size); - argp += size; - } - else - { - /* The argument is passed entirely in registers. */ - char *a = (char *) avalue[i]; - int j; - - for (j = 0; j < n; j++, a += 8, size -= 8) - { - switch (classes[j]) - { - case X86_64_NO_CLASS: - case X86_64_SSEUP_CLASS: - break; - case X86_64_INTEGER_CLASS: - case X86_64_INTEGERSI_CLASS: - /* Sign-extend integer arguments passed in general - purpose registers, to cope with the fact that - LLVM incorrectly assumes that this will be done - (the x86-64 PS ABI does not specify this). */ - switch (arg_types[i]->type) - { - case FFI_TYPE_SINT8: - reg_args->gpr[gprcount] = (SINT64) *((SINT8 *) a); - break; - case FFI_TYPE_SINT16: - reg_args->gpr[gprcount] = (SINT64) *((SINT16 *) a); - break; - case FFI_TYPE_SINT32: - reg_args->gpr[gprcount] = (SINT64) *((SINT32 *) a); - break; - default: - reg_args->gpr[gprcount] = 0; - memcpy (®_args->gpr[gprcount], a, size); - } - gprcount++; - break; - case X86_64_SSE_CLASS: - case X86_64_SSEDF_CLASS: - reg_args->sse[ssecount++].i64 = *(UINT64 *) a; - break; - case X86_64_SSESF_CLASS: - reg_args->sse[ssecount++].i32 = *(UINT32 *) a; - break; - default: - abort(); - } - } - } - } - reg_args->rax = ssecount; - - ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), - flags, rvalue, fn); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - -extern void ffi_closure_unix64(void) FFI_HIDDEN; -extern void ffi_closure_unix64_sse(void) FFI_HIDDEN; - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - static const unsigned char trampoline[16] = { - /* leaq -0x7(%rip),%r10 # 0x0 */ - 0x4c, 0x8d, 0x15, 0xf9, 0xff, 0xff, 0xff, - /* jmpq *0x3(%rip) # 0x10 */ - 0xff, 0x25, 0x03, 0x00, 0x00, 0x00, - /* nopl (%rax) */ - 0x0f, 0x1f, 0x00 - }; - void (*dest)(void); - char *tramp = closure->tramp; - - if (cif->abi != FFI_UNIX64) - return FFI_BAD_ABI; - - if (cif->flags & UNIX64_FLAG_XMM_ARGS) - dest = ffi_closure_unix64_sse; - else - dest = ffi_closure_unix64; - - memcpy (tramp, trampoline, sizeof(trampoline)); - *(UINT64 *)(tramp + 16) = (uintptr_t)dest; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -int FFI_HIDDEN -ffi_closure_unix64_inner(ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *rvalue, - struct register_args *reg_args, - char *argp) -{ - void **avalue; - ffi_type **arg_types; - long i, avn; - int gprcount, ssecount, ngpr, nsse; - int flags; - - avn = cif->nargs; - flags = cif->flags; - avalue = alloca(avn * sizeof(void *)); - gprcount = ssecount = 0; - - if (flags & UNIX64_FLAG_RET_IN_MEM) - { - /* On return, %rax will contain the address that was passed - by the caller in %rdi. */ - void *r = (void *)(uintptr_t)reg_args->gpr[gprcount++]; - *(void **)rvalue = r; - rvalue = r; - flags = (sizeof(void *) == 4 ? UNIX64_RET_UINT32 : UNIX64_RET_INT64); - } - - arg_types = cif->arg_types; - for (i = 0; i < avn; ++i) - { - enum x86_64_reg_class classes[MAX_CLASSES]; - size_t n; - - n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); - if (n == 0 - || gprcount + ngpr > MAX_GPR_REGS - || ssecount + nsse > MAX_SSE_REGS) - { - long align = arg_types[i]->alignment; - - /* Stack arguments are *always* at least 8 byte aligned. */ - if (align < 8) - align = 8; - - /* Pass this argument in memory. */ - argp = (void *) ALIGN (argp, align); - avalue[i] = argp; - argp += arg_types[i]->size; - } - /* If the argument is in a single register, or two consecutive - integer registers, then we can use that address directly. */ - else if (n == 1 - || (n == 2 && !(SSE_CLASS_P (classes[0]) - || SSE_CLASS_P (classes[1])))) - { - /* The argument is in a single register. */ - if (SSE_CLASS_P (classes[0])) - { - avalue[i] = ®_args->sse[ssecount]; - ssecount += n; - } - else - { - avalue[i] = ®_args->gpr[gprcount]; - gprcount += n; - } - } - /* Otherwise, allocate space to make them consecutive. */ - else - { - char *a = alloca (16); - int j; - - avalue[i] = a; - for (j = 0; j < n; j++, a += 8) - { - if (SSE_CLASS_P (classes[j])) - memcpy (a, ®_args->sse[ssecount++], 8); - else - memcpy (a, ®_args->gpr[gprcount++], 8); - } - } - } - - /* Invoke the closure. */ - fun (cif, rvalue, avalue, user_data); - - /* Tell assembly how to perform return type promotions. */ - return flags; -} - -extern void ffi_go_closure_unix64(void) FFI_HIDDEN; -extern void ffi_go_closure_unix64_sse(void) FFI_HIDDEN; - -ffi_status -ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*)) -{ - if (cif->abi != FFI_UNIX64) - return FFI_BAD_ABI; - - closure->tramp = (cif->flags & UNIX64_FLAG_XMM_ARGS - ? ffi_go_closure_unix64_sse - : ffi_go_closure_unix64); - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -#endif /* __x86_64__ */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/x86/ffitarget.h deleted file mode 100644 index 8c1dcac2a24d6e8b80e940821029b6021371c868..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/ffitarget.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2012, 2014 Anthony Green - Copyright (c) 1996-2003, 2010 Red Hat, Inc. - Copyright (C) 2008 Free Software Foundation, Inc. - - Target configuration macros for x86 and x86-64. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -/* ---- System specific configurations ----------------------------------- */ - -/* For code common to all platforms on x86 and x86_64. */ -#define X86_ANY - -#if defined (X86_64) && defined (__i386__) -#undef X86_64 -#define X86 -#endif - -#ifdef X86_WIN64 -#define FFI_SIZEOF_ARG 8 -#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ -#endif - -#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION -#ifndef _MSC_VER -#define FFI_TARGET_HAS_COMPLEX_TYPE -#endif - -/* ---- Generic type definitions ----------------------------------------- */ - -#ifndef LIBFFI_ASM -#ifdef X86_WIN64 -#ifdef _MSC_VER -typedef unsigned __int64 ffi_arg; -typedef __int64 ffi_sarg; -#else -typedef unsigned long long ffi_arg; -typedef long long ffi_sarg; -#endif -#else -#if defined __x86_64__ && defined __ILP32__ -#define FFI_SIZEOF_ARG 8 -#define FFI_SIZEOF_JAVA_RAW 4 -typedef unsigned long long ffi_arg; -typedef long long ffi_sarg; -#else -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; -#endif -#endif - -typedef enum ffi_abi { -#if defined(X86_WIN64) - FFI_FIRST_ABI = 0, - FFI_WIN64, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_WIN64 - -#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) - FFI_FIRST_ABI = 1, - FFI_UNIX64, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_UNIX64 - -#elif defined(X86_WIN32) - FFI_FIRST_ABI = 0, - FFI_SYSV = 1, - FFI_STDCALL = 2, - FFI_THISCALL = 3, - FFI_FASTCALL = 4, - FFI_MS_CDECL = 5, - FFI_PASCAL = 6, - FFI_REGISTER = 7, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_MS_CDECL -#else - FFI_FIRST_ABI = 0, - FFI_SYSV = 1, - FFI_THISCALL = 3, - FFI_FASTCALL = 4, - FFI_STDCALL = 5, - FFI_PASCAL = 6, - FFI_REGISTER = 7, - FFI_MS_CDECL = 8, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -#endif -} ffi_abi; -#endif - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_GO_CLOSURES 1 - -#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) -#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) -#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) -#define FFI_TYPE_MS_STRUCT (FFI_TYPE_LAST + 4) - -#if defined (X86_64) || defined(X86_WIN64) \ - || (defined (__x86_64__) && defined (X86_DARWIN)) -# define FFI_TRAMPOLINE_SIZE 24 -# define FFI_NATIVE_RAW_API 0 -#else -# define FFI_TRAMPOLINE_SIZE 12 -# define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ -#endif - -#endif - diff --git a/llgo/third_party/gofrontend/libffi/src/x86/ffiw64.c b/llgo/third_party/gofrontend/libffi/src/x86/ffiw64.c deleted file mode 100644 index 8a33a6c478568f99b6f109c2e21ba5424678982a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/ffiw64.c +++ /dev/null @@ -1,281 +0,0 @@ -/* ----------------------------------------------------------------------- - ffiw64.c - Copyright (c) 2014 Red Hat, Inc. - - x86 win64 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include -#include -#include - -#ifdef X86_WIN64 - -struct win64_call_frame -{ - UINT64 rbp; /* 0 */ - UINT64 retaddr; /* 8 */ - UINT64 fn; /* 16 */ - UINT64 flags; /* 24 */ - UINT64 rvalue; /* 32 */ -}; - -extern void ffi_call_win64 (void *stack, struct win64_call_frame *, - void *closure) FFI_HIDDEN; - -ffi_status -ffi_prep_cif_machdep (ffi_cif *cif) -{ - int flags, n; - - if (cif->abi != FFI_WIN64) - return FFI_BAD_ABI; - - flags = cif->rtype->type; - switch (flags) - { - default: - break; - case FFI_TYPE_LONGDOUBLE: - flags = FFI_TYPE_STRUCT; - break; - case FFI_TYPE_COMPLEX: - flags = FFI_TYPE_STRUCT; - /* FALLTHRU */ - case FFI_TYPE_STRUCT: - switch (cif->rtype->size) - { - case 8: - flags = FFI_TYPE_UINT64; - break; - case 4: - flags = FFI_TYPE_SMALL_STRUCT_4B; - break; - case 2: - flags = FFI_TYPE_SMALL_STRUCT_2B; - break; - case 1: - flags = FFI_TYPE_SMALL_STRUCT_1B; - break; - } - break; - } - cif->flags = flags; - - /* Each argument either fits in a register, an 8 byte slot, or is - passed by reference with the pointer in the 8 byte slot. */ - n = cif->nargs; - n += (flags == FFI_TYPE_STRUCT); - if (n < 4) - n = 4; - cif->bytes = n * 8; - - return FFI_OK; -} - -static void -ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - int i, j, n, flags; - UINT64 *stack; - size_t rsize; - struct win64_call_frame *frame; - - FFI_ASSERT(cif->abi == FFI_WIN64); - - flags = cif->flags; - rsize = 0; - - /* If we have no return value for a structure, we need to create one. - Otherwise we can ignore the return type entirely. */ - if (rvalue == NULL) - { - if (flags == FFI_TYPE_STRUCT) - rsize = cif->rtype->size; - else - flags = FFI_TYPE_VOID; - } - - stack = alloca(cif->bytes + sizeof(struct win64_call_frame) + rsize); - frame = (struct win64_call_frame *)((char *)stack + cif->bytes); - if (rsize) - rvalue = frame + 1; - - frame->fn = (uintptr_t)fn; - frame->flags = flags; - frame->rvalue = (uintptr_t)rvalue; - - j = 0; - if (flags == FFI_TYPE_STRUCT) - { - stack[0] = (uintptr_t)rvalue; - j = 1; - } - - for (i = 0, n = cif->nargs; i < n; ++i, ++j) - { - switch (cif->arg_types[i]->size) - { - case 8: - stack[j] = *(UINT64 *)avalue[i]; - break; - case 4: - stack[j] = *(UINT32 *)avalue[i]; - break; - case 2: - stack[j] = *(UINT16 *)avalue[i]; - break; - case 1: - stack[j] = *(UINT8 *)avalue[i]; - break; - default: - stack[j] = (uintptr_t)avalue[i]; - break; - } - } - - ffi_call_win64 (stack, frame, closure); -} - -void -ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -{ - ffi_call_int (cif, fn, rvalue, avalue, NULL); -} - -void -ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -{ - ffi_call_int (cif, fn, rvalue, avalue, closure); -} - - -extern void ffi_closure_win64(void) FFI_HIDDEN; -extern void ffi_go_closure_win64(void) FFI_HIDDEN; - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - static const unsigned char trampoline[16] = { - /* leaq -0x7(%rip),%r10 # 0x0 */ - 0x4c, 0x8d, 0x15, 0xf9, 0xff, 0xff, 0xff, - /* jmpq *0x3(%rip) # 0x10 */ - 0xff, 0x25, 0x03, 0x00, 0x00, 0x00, - /* nopl (%rax) */ - 0x0f, 0x1f, 0x00 - }; - unsigned char *tramp = closure->tramp; - - if (cif->abi != FFI_WIN64) - return FFI_BAD_ABI; - - memcpy (tramp, trampoline, sizeof(trampoline)); - *(UINT64 *)(tramp + 16) = (uintptr_t)ffi_closure_win64; - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - - return FFI_OK; -} - -ffi_status -ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*)) -{ - if (cif->abi != FFI_WIN64) - return FFI_BAD_ABI; - - closure->tramp = ffi_go_closure_win64; - closure->cif = cif; - closure->fun = fun; - - return FFI_OK; -} - -struct win64_closure_frame -{ - UINT64 rvalue[2]; - UINT64 fargs[4]; - UINT64 retaddr; - UINT64 args[]; -}; - -int FFI_HIDDEN -ffi_closure_win64_inner(ffi_cif *cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - struct win64_closure_frame *frame) -{ - void **avalue; - void *rvalue; - int i, n, nreg, flags; - - avalue = alloca(cif->nargs * sizeof(void *)); - rvalue = frame->rvalue; - nreg = 0; - - /* When returning a structure, the address is in the first argument. - We must also be prepared to return the same address in eax, so - install that address in the frame and pretend we return a pointer. */ - flags = cif->flags; - if (flags == FFI_TYPE_STRUCT) - { - rvalue = (void *)(uintptr_t)frame->args[0]; - frame->rvalue[0] = frame->args[0]; - nreg = 1; - } - - for (i = 0, n = cif->nargs; i < n; ++i, ++nreg) - { - size_t size = cif->arg_types[i]->size; - size_t type = cif->arg_types[i]->type; - void *a; - - if (type == FFI_TYPE_DOUBLE || type == FFI_TYPE_FLOAT) - { - if (nreg < 4) - a = &frame->fargs[nreg]; - else - a = &frame->args[nreg]; - } - else if (size == 1 || size == 2 || size == 4 || size == 8) - a = &frame->args[nreg]; - else - a = (void *)(uintptr_t)frame->args[nreg]; - - avalue[i] = a; - } - - /* Invoke the closure. */ - fun (cif, rvalue, avalue, user_data); - return flags; -} - -#endif /* X86_WIN64 */ diff --git a/llgo/third_party/gofrontend/libffi/src/x86/internal.h b/llgo/third_party/gofrontend/libffi/src/x86/internal.h deleted file mode 100644 index 09771ba8cfb279e3f4b8bf60e7da89e5726f722e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/internal.h +++ /dev/null @@ -1,29 +0,0 @@ -#define X86_RET_FLOAT 0 -#define X86_RET_DOUBLE 1 -#define X86_RET_LDOUBLE 2 -#define X86_RET_SINT8 3 -#define X86_RET_SINT16 4 -#define X86_RET_UINT8 5 -#define X86_RET_UINT16 6 -#define X86_RET_INT64 7 -#define X86_RET_INT32 8 -#define X86_RET_VOID 9 -#define X86_RET_STRUCTPOP 10 -#define X86_RET_STRUCTARG 11 -#define X86_RET_STRUCT_1B 12 -#define X86_RET_STRUCT_2B 13 -#define X86_RET_UNUSED14 14 -#define X86_RET_UNUSED15 15 - -#define X86_RET_TYPE_MASK 15 -#define X86_RET_POP_SHIFT 4 - -#define R_EAX 0 -#define R_EDX 1 -#define R_ECX 2 - -#ifdef __PCC__ -# define HAVE_FASTCALL 0 -#else -# define HAVE_FASTCALL 1 -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/x86/internal64.h b/llgo/third_party/gofrontend/libffi/src/x86/internal64.h deleted file mode 100644 index 512e95523e92a7e8a3b75d7d328ad706ad5ee8bd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/internal64.h +++ /dev/null @@ -1,22 +0,0 @@ -#define UNIX64_RET_VOID 0 -#define UNIX64_RET_UINT8 1 -#define UNIX64_RET_UINT16 2 -#define UNIX64_RET_UINT32 3 -#define UNIX64_RET_SINT8 4 -#define UNIX64_RET_SINT16 5 -#define UNIX64_RET_SINT32 6 -#define UNIX64_RET_INT64 7 -#define UNIX64_RET_XMM32 8 -#define UNIX64_RET_XMM64 9 -#define UNIX64_RET_X87 10 -#define UNIX64_RET_X87_2 11 -#define UNIX64_RET_ST_XMM0_RAX 12 -#define UNIX64_RET_ST_RAX_XMM0 13 -#define UNIX64_RET_ST_XMM0_XMM1 14 -#define UNIX64_RET_ST_RAX_RDX 15 - -#define UNIX64_RET_LAST 15 - -#define UNIX64_FLAG_RET_IN_MEM (1 << 10) -#define UNIX64_FLAG_XMM_ARGS (1 << 11) -#define UNIX64_SIZE_SHIFT 12 diff --git a/llgo/third_party/gofrontend/libffi/src/x86/sysv.S b/llgo/third_party/gofrontend/libffi/src/x86/sysv.S deleted file mode 100644 index ebbea5d1110215c5d30fe2fcb39ed2a12f5deb1d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/sysv.S +++ /dev/null @@ -1,1038 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2013 The Written Word, Inc. - - Copyright (c) 1996,1998,2001-2003,2005,2008,2010 Red Hat, Inc. - - X86 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef __x86_64__ - -#define LIBFFI_ASM -#include -#include -#include "internal.h" - -#define C2(X, Y) X ## Y -#define C1(X, Y) C2(X, Y) -#ifdef __USER_LABEL_PREFIX__ -# define C(X) C1(__USER_LABEL_PREFIX__, X) -#else -# define C(X) X -#endif - -#ifdef X86_DARWIN -# define L(X) C1(L, X) -#else -# define L(X) C1(.L, X) -#endif - -#ifdef __ELF__ -# define ENDF(X) .type X,@function; .size X, . - X -#else -# define ENDF(X) -#endif - -/* Handle win32 fastcall name mangling. */ -#ifdef X86_WIN32 -# define ffi_call_i386 @ffi_call_i386@8 -# define ffi_closure_inner @ffi_closure_inner@8 -#else -# define ffi_call_i386 C(ffi_call_i386) -# define ffi_closure_inner C(ffi_closure_inner) -#endif - -/* This macro allows the safe creation of jump tables without an - actual table. The entry points into the table are all 8 bytes. - The use of ORG asserts that we're at the correct location. */ -/* ??? The clang assembler doesn't handle .org with symbolic expressions. */ -#if defined(__clang__) || defined(__APPLE__) -# define E(BASE, X) .balign 8 -#else -# define E(BASE, X) .balign 8; .org BASE + X * 8 -#endif - - .text - .balign 16 - .globl ffi_call_i386 - FFI_HIDDEN(ffi_call_i386) - -/* This is declared as - - void ffi_call_i386(struct call_frame *frame, char *argp) - __attribute__((fastcall)); - - Thus the arguments are present in - - ecx: frame - edx: argp -*/ - -ffi_call_i386: -L(UW0): - # cfi_startproc -#if !HAVE_FASTCALL - movl 4(%esp), %ecx - movl 8(%esp), %edx -#endif - movl (%esp), %eax /* move the return address */ - movl %ebp, (%ecx) /* store %ebp into local frame */ - movl %eax, 4(%ecx) /* store retaddr into local frame */ - - /* New stack frame based off ebp. This is a itty bit of unwind - trickery in that the CFA *has* changed. There is no easy way - to describe it correctly on entry to the function. Fortunately, - it doesn't matter too much since at all points we can correctly - unwind back to ffi_call. Note that the location to which we - moved the return address is (the new) CFA-4, so from the - perspective of the unwind info, it hasn't moved. */ - movl %ecx, %ebp -L(UW1): - # cfi_def_cfa(%ebp, 8) - # cfi_rel_offset(%ebp, 0) - - movl %edx, %esp /* set outgoing argument stack */ - movl 20+R_EAX*4(%ebp), %eax /* set register arguments */ - movl 20+R_EDX*4(%ebp), %edx - movl 20+R_ECX*4(%ebp), %ecx - - call *8(%ebp) - - movl 12(%ebp), %ecx /* load return type code */ - movl %ebx, 8(%ebp) /* preserve %ebx */ -L(UW2): - # cfi_rel_offset(%ebx, 8) - - andl $X86_RET_TYPE_MASK, %ecx -#ifdef __PIC__ - call C(__x86.get_pc_thunk.bx) -L(pc1): - leal L(store_table)-L(pc1)(%ebx, %ecx, 8), %ebx -#else - leal L(store_table)(,%ecx, 8), %ebx -#endif - movl 16(%ebp), %ecx /* load result address */ - jmp *%ebx - - .balign 8 -L(store_table): -E(L(store_table), X86_RET_FLOAT) - fstps (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_DOUBLE) - fstpl (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_LDOUBLE) - fstpt (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_SINT8) - movsbl %al, %eax - mov %eax, (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_SINT16) - movswl %ax, %eax - mov %eax, (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_UINT8) - movzbl %al, %eax - mov %eax, (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_UINT16) - movzwl %ax, %eax - mov %eax, (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_INT64) - movl %edx, 4(%ecx) - /* fallthru */ -E(L(store_table), X86_RET_INT32) - movl %eax, (%ecx) - /* fallthru */ -E(L(store_table), X86_RET_VOID) -L(e1): - movl 8(%ebp), %ebx - movl %ebp, %esp - popl %ebp -L(UW3): - # cfi_remember_state - # cfi_def_cfa(%esp, 4) - # cfi_restore(%ebx) - # cfi_restore(%ebp) - ret -L(UW4): - # cfi_restore_state - -E(L(store_table), X86_RET_STRUCTPOP) - jmp L(e1) -E(L(store_table), X86_RET_STRUCTARG) - jmp L(e1) -E(L(store_table), X86_RET_STRUCT_1B) - movb %al, (%ecx) - jmp L(e1) -E(L(store_table), X86_RET_STRUCT_2B) - movw %ax, (%ecx) - jmp L(e1) - - /* Fill out the table so that bad values are predictable. */ -E(L(store_table), X86_RET_UNUSED14) - ud2 -E(L(store_table), X86_RET_UNUSED15) - ud2 - -L(UW5): - # cfi_endproc -ENDF(ffi_call_i386) - -/* The inner helper is declared as - - void ffi_closure_inner(struct closure_frame *frame, char *argp) - __attribute_((fastcall)) - - Thus the arguments are placed in - - ecx: frame - edx: argp -*/ - -/* Macros to help setting up the closure_data structure. */ - -#if HAVE_FASTCALL -# define closure_FS (40 + 4) -# define closure_CF 0 -#else -# define closure_FS (8 + 40 + 12) -# define closure_CF 8 -#endif - -#define FFI_CLOSURE_SAVE_REGS \ - movl %eax, closure_CF+16+R_EAX*4(%esp); \ - movl %edx, closure_CF+16+R_EDX*4(%esp); \ - movl %ecx, closure_CF+16+R_ECX*4(%esp) - -#define FFI_CLOSURE_COPY_TRAMP_DATA \ - movl FFI_TRAMPOLINE_SIZE(%eax), %edx; /* copy cif */ \ - movl FFI_TRAMPOLINE_SIZE+4(%eax), %ecx; /* copy fun */ \ - movl FFI_TRAMPOLINE_SIZE+8(%eax), %eax; /* copy user_data */ \ - movl %edx, closure_CF+28(%esp); \ - movl %ecx, closure_CF+32(%esp); \ - movl %eax, closure_CF+36(%esp) - -#if HAVE_FASTCALL -# define FFI_CLOSURE_PREP_CALL \ - movl %esp, %ecx; /* load closure_data */ \ - leal closure_FS+4(%esp), %edx; /* load incoming stack */ -#else -# define FFI_CLOSURE_PREP_CALL \ - leal closure_CF(%esp), %ecx; /* load closure_data */ \ - leal closure_FS+4(%esp), %edx; /* load incoming stack */ \ - movl %ecx, (%esp); \ - movl %edx, 4(%esp) -#endif - -#define FFI_CLOSURE_CALL_INNER(UWN) \ - call ffi_closure_inner - -#define FFI_CLOSURE_MASK_AND_JUMP(N, UW) \ - andl $X86_RET_TYPE_MASK, %eax; \ - leal L(C1(load_table,N))(, %eax, 8), %edx; \ - movl closure_CF(%esp), %eax; /* optimiztic load */ \ - jmp *%edx - -#ifdef __PIC__ -# if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -# undef FFI_CLOSURE_MASK_AND_JUMP -# define FFI_CLOSURE_MASK_AND_JUMP(N, UW) \ - andl $X86_RET_TYPE_MASK, %eax; \ - call C(__x86.get_pc_thunk.dx); \ -L(C1(pc,N)): \ - leal L(C1(load_table,N))-L(C1(pc,N))(%edx, %eax, 8), %edx; \ - movl closure_CF(%esp), %eax; /* optimiztic load */ \ - jmp *%edx -# else -# define FFI_CLOSURE_CALL_INNER_SAVE_EBX -# undef FFI_CLOSURE_CALL_INNER -# define FFI_CLOSURE_CALL_INNER(UWN) \ - movl %ebx, 40(%esp); /* save ebx */ \ -L(C1(UW,UWN)): \ - # cfi_rel_offset(%ebx, 40); \ - call C(__x86.get_pc_thunk.bx); /* load got register */ \ - addl $C(_GLOBAL_OFFSET_TABLE_), %ebx; \ - call ffi_closure_inner@PLT -# undef FFI_CLOSURE_MASK_AND_JUMP -# define FFI_CLOSURE_MASK_AND_JUMP(N, UWN) \ - andl $X86_RET_TYPE_MASK, %eax; \ - leal L(C1(load_table,N))@GOTOFF(%ebx, %eax, 8), %edx; \ - movl 40(%esp), %ebx; /* restore ebx */ \ -L(C1(UW,UWN)): \ - # cfi_restore(%ebx); \ - movl closure_CF(%esp), %eax; /* optimiztic load */ \ - jmp *%edx -# endif /* DARWIN || HIDDEN */ -#endif /* __PIC__ */ - - .balign 16 - .globl C(ffi_go_closure_EAX) - FFI_HIDDEN(C(ffi_go_closure_EAX)) -C(ffi_go_closure_EAX): -L(UW6): - # cfi_startproc - subl $closure_FS, %esp -L(UW7): - # cfi_def_cfa_offset(closure_FS + 4) - FFI_CLOSURE_SAVE_REGS - movl 4(%eax), %edx /* copy cif */ - movl 8(%eax), %ecx /* copy fun */ - movl %edx, closure_CF+28(%esp) - movl %ecx, closure_CF+32(%esp) - movl %eax, closure_CF+36(%esp) /* closure is user_data */ - jmp L(do_closure_i386) -L(UW8): - # cfi_endproc -ENDF(C(ffi_go_closure_EAX)) - - .balign 16 - .globl C(ffi_go_closure_ECX) - FFI_HIDDEN(C(ffi_go_closure_ECX)) -C(ffi_go_closure_ECX): -L(UW9): - # cfi_startproc - subl $closure_FS, %esp -L(UW10): - # cfi_def_cfa_offset(closure_FS + 4) - FFI_CLOSURE_SAVE_REGS - movl 4(%ecx), %edx /* copy cif */ - movl 8(%ecx), %eax /* copy fun */ - movl %edx, closure_CF+28(%esp) - movl %eax, closure_CF+32(%esp) - movl %ecx, closure_CF+36(%esp) /* closure is user_data */ - jmp L(do_closure_i386) -L(UW11): - # cfi_endproc -ENDF(C(ffi_go_closure_ECX)) - -/* The closure entry points are reached from the ffi_closure trampoline. - On entry, %eax contains the address of the ffi_closure. */ - - .balign 16 - .globl C(ffi_closure_i386) - FFI_HIDDEN(C(ffi_closure_i386)) - -C(ffi_closure_i386): -L(UW12): - # cfi_startproc - subl $closure_FS, %esp -L(UW13): - # cfi_def_cfa_offset(closure_FS + 4) - - FFI_CLOSURE_SAVE_REGS - FFI_CLOSURE_COPY_TRAMP_DATA - - /* Entry point from preceeding Go closures. */ -L(do_closure_i386): - - FFI_CLOSURE_PREP_CALL - FFI_CLOSURE_CALL_INNER(14) - FFI_CLOSURE_MASK_AND_JUMP(2, 15) - - .balign 8 -L(load_table2): -E(L(load_table2), X86_RET_FLOAT) - flds closure_CF(%esp) - jmp L(e2) -E(L(load_table2), X86_RET_DOUBLE) - fldl closure_CF(%esp) - jmp L(e2) -E(L(load_table2), X86_RET_LDOUBLE) - fldt closure_CF(%esp) - jmp L(e2) -E(L(load_table2), X86_RET_SINT8) - movsbl %al, %eax - jmp L(e2) -E(L(load_table2), X86_RET_SINT16) - movswl %ax, %eax - jmp L(e2) -E(L(load_table2), X86_RET_UINT8) - movzbl %al, %eax - jmp L(e2) -E(L(load_table2), X86_RET_UINT16) - movzwl %ax, %eax - jmp L(e2) -E(L(load_table2), X86_RET_INT64) - movl closure_CF+4(%esp), %edx - jmp L(e2) -E(L(load_table2), X86_RET_INT32) - nop - /* fallthru */ -E(L(load_table2), X86_RET_VOID) -L(e2): - addl $closure_FS, %esp -L(UW16): - # cfi_adjust_cfa_offset(-closure_FS) - ret -L(UW17): - # cfi_adjust_cfa_offset(closure_FS) -E(L(load_table2), X86_RET_STRUCTPOP) - addl $closure_FS, %esp -L(UW18): - # cfi_adjust_cfa_offset(-closure_FS) - ret $4 -L(UW19): - # cfi_adjust_cfa_offset(closure_FS) -E(L(load_table2), X86_RET_STRUCTARG) - jmp L(e2) -E(L(load_table2), X86_RET_STRUCT_1B) - movzbl %al, %eax - jmp L(e2) -E(L(load_table2), X86_RET_STRUCT_2B) - movzwl %ax, %eax - jmp L(e2) - - /* Fill out the table so that bad values are predictable. */ -E(L(load_table2), X86_RET_UNUSED14) - ud2 -E(L(load_table2), X86_RET_UNUSED15) - ud2 - -L(UW20): - # cfi_endproc -ENDF(C(ffi_closure_i386)) - - .balign 16 - .globl C(ffi_go_closure_STDCALL) - FFI_HIDDEN(C(ffi_go_closure_STDCALL)) -C(ffi_go_closure_STDCALL): -L(UW21): - # cfi_startproc - subl $closure_FS, %esp -L(UW22): - # cfi_def_cfa_offset(closure_FS + 4) - FFI_CLOSURE_SAVE_REGS - movl 4(%ecx), %edx /* copy cif */ - movl 8(%ecx), %eax /* copy fun */ - movl %edx, closure_CF+28(%esp) - movl %eax, closure_CF+32(%esp) - movl %ecx, closure_CF+36(%esp) /* closure is user_data */ - jmp L(do_closure_STDCALL) -L(UW23): - # cfi_endproc -ENDF(C(ffi_go_closure_STDCALL)) - -/* For REGISTER, we have no available parameter registers, and so we - enter here having pushed the closure onto the stack. */ - - .balign 16 - .globl C(ffi_closure_REGISTER) - FFI_HIDDEN(C(ffi_closure_REGISTER)) -C(ffi_closure_REGISTER): -L(UW24): - # cfi_startproc - # cfi_def_cfa(%esp, 8) - # cfi_offset(%eip, -8) - subl $closure_FS-4, %esp -L(UW25): - # cfi_def_cfa_offset(closure_FS + 4) - FFI_CLOSURE_SAVE_REGS - movl closure_FS-4(%esp), %ecx /* load retaddr */ - movl closure_FS(%esp), %eax /* load closure */ - movl %ecx, closure_FS(%esp) /* move retaddr */ - jmp L(do_closure_REGISTER) -L(UW26): - # cfi_endproc -ENDF(C(ffi_closure_REGISTER)) - -/* For STDCALL (and others), we need to pop N bytes of arguments off - the stack following the closure. The amount needing to be popped - is returned to us from ffi_closure_inner. */ - - .balign 16 - .globl C(ffi_closure_STDCALL) - FFI_HIDDEN(C(ffi_closure_STDCALL)) -C(ffi_closure_STDCALL): -L(UW27): - # cfi_startproc - subl $closure_FS, %esp -L(UW28): - # cfi_def_cfa_offset(closure_FS + 4) - - FFI_CLOSURE_SAVE_REGS - - /* Entry point from ffi_closure_REGISTER. */ -L(do_closure_REGISTER): - - FFI_CLOSURE_COPY_TRAMP_DATA - - /* Entry point from preceeding Go closure. */ -L(do_closure_STDCALL): - - FFI_CLOSURE_PREP_CALL - FFI_CLOSURE_CALL_INNER(29) - - movl %eax, %ecx - shrl $X86_RET_POP_SHIFT, %ecx /* isolate pop count */ - leal closure_FS(%esp, %ecx), %ecx /* compute popped esp */ - movl closure_FS(%esp), %edx /* move return address */ - movl %edx, (%ecx) - - /* From this point on, the value of %esp upon return is %ecx+4, - and we've copied the return address to %ecx to make return easy. - There's no point in representing this in the unwind info, as - there is always a window between the mov and the ret which - will be wrong from one point of view or another. */ - - FFI_CLOSURE_MASK_AND_JUMP(3, 30) - - .balign 8 -L(load_table3): -E(L(load_table3), X86_RET_FLOAT) - flds closure_CF(%esp) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_DOUBLE) - fldl closure_CF(%esp) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_LDOUBLE) - fldt closure_CF(%esp) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_SINT8) - movsbl %al, %eax - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_SINT16) - movswl %ax, %eax - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_UINT8) - movzbl %al, %eax - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_UINT16) - movzwl %ax, %eax - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_INT64) - movl closure_CF+4(%esp), %edx - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_INT32) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_VOID) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_STRUCTPOP) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_STRUCTARG) - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_STRUCT_1B) - movzbl %al, %eax - movl %ecx, %esp - ret -E(L(load_table3), X86_RET_STRUCT_2B) - movzwl %ax, %eax - movl %ecx, %esp - ret - - /* Fill out the table so that bad values are predictable. */ -E(L(load_table3), X86_RET_UNUSED14) - ud2 -E(L(load_table3), X86_RET_UNUSED15) - ud2 - -L(UW31): - # cfi_endproc -ENDF(C(ffi_closure_STDCALL)) - -#if !FFI_NO_RAW_API - -#define raw_closure_S_FS (16+16+12) - - .balign 16 - .globl C(ffi_closure_raw_SYSV) - FFI_HIDDEN(C(ffi_closure_raw_SYSV)) -C(ffi_closure_raw_SYSV): -L(UW32): - # cfi_startproc - subl $raw_closure_S_FS, %esp -L(UW33): - # cfi_def_cfa_offset(raw_closure_S_FS + 4) - movl %ebx, raw_closure_S_FS-4(%esp) -L(UW34): - # cfi_rel_offset(%ebx, raw_closure_S_FS-4) - - movl FFI_TRAMPOLINE_SIZE+8(%eax), %edx /* load cl->user_data */ - movl %edx, 12(%esp) - leal raw_closure_S_FS+4(%esp), %edx /* load raw_args */ - movl %edx, 8(%esp) - leal 16(%esp), %edx /* load &res */ - movl %edx, 4(%esp) - movl FFI_TRAMPOLINE_SIZE(%eax), %ebx /* load cl->cif */ - movl %ebx, (%esp) - call *FFI_TRAMPOLINE_SIZE+4(%eax) /* call cl->fun */ - - movl 20(%ebx), %eax /* load cif->flags */ - andl $X86_RET_TYPE_MASK, %eax -#ifdef __PIC__ - call C(__x86.get_pc_thunk.bx) -L(pc4): - leal L(load_table4)-L(pc4)(%ebx, %eax, 8), %ecx -#else - leal L(load_table4)(,%eax, 8), %ecx -#endif - movl raw_closure_S_FS-4(%esp), %ebx -L(UW35): - # cfi_restore(%ebx) - movl 16(%esp), %eax /* Optimistic load */ - jmp *%ecx - - .balign 8 -L(load_table4): -E(L(load_table4), X86_RET_FLOAT) - flds 16(%esp) - jmp L(e4) -E(L(load_table4), X86_RET_DOUBLE) - fldl 16(%esp) - jmp L(e4) -E(L(load_table4), X86_RET_LDOUBLE) - fldt 16(%esp) - jmp L(e4) -E(L(load_table4), X86_RET_SINT8) - movsbl %al, %eax - jmp L(e4) -E(L(load_table4), X86_RET_SINT16) - movswl %ax, %eax - jmp L(e4) -E(L(load_table4), X86_RET_UINT8) - movzbl %al, %eax - jmp L(e4) -E(L(load_table4), X86_RET_UINT16) - movzwl %ax, %eax - jmp L(e4) -E(L(load_table4), X86_RET_INT64) - movl 16+4(%esp), %edx - jmp L(e4) -E(L(load_table4), X86_RET_INT32) - nop - /* fallthru */ -E(L(load_table4), X86_RET_VOID) -L(e4): - addl $raw_closure_S_FS, %esp -L(UW36): - # cfi_adjust_cfa_offset(-raw_closure_S_FS) - ret -L(UW37): - # cfi_adjust_cfa_offset(raw_closure_S_FS) -E(L(load_table4), X86_RET_STRUCTPOP) - addl $raw_closure_S_FS, %esp -L(UW38): - # cfi_adjust_cfa_offset(-raw_closure_S_FS) - ret $4 -L(UW39): - # cfi_adjust_cfa_offset(raw_closure_S_FS) -E(L(load_table4), X86_RET_STRUCTARG) - jmp L(e4) -E(L(load_table4), X86_RET_STRUCT_1B) - movzbl %al, %eax - jmp L(e4) -E(L(load_table4), X86_RET_STRUCT_2B) - movzwl %ax, %eax - jmp L(e4) - - /* Fill out the table so that bad values are predictable. */ -E(L(load_table4), X86_RET_UNUSED14) - ud2 -E(L(load_table4), X86_RET_UNUSED15) - ud2 - -L(UW40): - # cfi_endproc -ENDF(C(ffi_closure_raw_SYSV)) - -#define raw_closure_T_FS (16+16+8) - - .balign 16 - .globl C(ffi_closure_raw_THISCALL) - FFI_HIDDEN(C(ffi_closure_raw_THISCALL)) -C(ffi_closure_raw_THISCALL): -L(UW41): - # cfi_startproc - /* Rearrange the stack such that %ecx is the first argument. - This means moving the return address. */ - popl %edx -L(UW42): - # cfi_def_cfa_offset(0) - # cfi_register(%eip, %edx) - pushl %ecx -L(UW43): - # cfi_adjust_cfa_offset(4) - pushl %edx -L(UW44): - # cfi_adjust_cfa_offset(4) - # cfi_rel_offset(%eip, 0) - subl $raw_closure_T_FS, %esp -L(UW45): - # cfi_adjust_cfa_offset(raw_closure_T_FS) - movl %ebx, raw_closure_T_FS-4(%esp) -L(UW46): - # cfi_rel_offset(%ebx, raw_closure_T_FS-4) - - movl FFI_TRAMPOLINE_SIZE+8(%eax), %edx /* load cl->user_data */ - movl %edx, 12(%esp) - leal raw_closure_T_FS+4(%esp), %edx /* load raw_args */ - movl %edx, 8(%esp) - leal 16(%esp), %edx /* load &res */ - movl %edx, 4(%esp) - movl FFI_TRAMPOLINE_SIZE(%eax), %ebx /* load cl->cif */ - movl %ebx, (%esp) - call *FFI_TRAMPOLINE_SIZE+4(%eax) /* call cl->fun */ - - movl 20(%ebx), %eax /* load cif->flags */ - andl $X86_RET_TYPE_MASK, %eax -#ifdef __PIC__ - call C(__x86.get_pc_thunk.bx) -L(pc5): - leal L(load_table5)-L(pc5)(%ebx, %eax, 8), %ecx -#else - leal L(load_table5)(,%eax, 8), %ecx -#endif - movl raw_closure_T_FS-4(%esp), %ebx -L(UW47): - # cfi_restore(%ebx) - movl 16(%esp), %eax /* Optimistic load */ - jmp *%ecx - - .balign 8 -L(load_table5): -E(L(load_table5), X86_RET_FLOAT) - flds 16(%esp) - jmp L(e5) -E(L(load_table5), X86_RET_DOUBLE) - fldl 16(%esp) - jmp L(e5) -E(L(load_table5), X86_RET_LDOUBLE) - fldt 16(%esp) - jmp L(e5) -E(L(load_table5), X86_RET_SINT8) - movsbl %al, %eax - jmp L(e5) -E(L(load_table5), X86_RET_SINT16) - movswl %ax, %eax - jmp L(e5) -E(L(load_table5), X86_RET_UINT8) - movzbl %al, %eax - jmp L(e5) -E(L(load_table5), X86_RET_UINT16) - movzwl %ax, %eax - jmp L(e5) -E(L(load_table5), X86_RET_INT64) - movl 16+4(%esp), %edx - jmp L(e5) -E(L(load_table5), X86_RET_INT32) - nop - /* fallthru */ -E(L(load_table5), X86_RET_VOID) -L(e5): - addl $raw_closure_T_FS, %esp -L(UW48): - # cfi_adjust_cfa_offset(-raw_closure_T_FS) - /* Remove the extra %ecx argument we pushed. */ - ret $4 -L(UW49): - # cfi_adjust_cfa_offset(raw_closure_T_FS) -E(L(load_table5), X86_RET_STRUCTPOP) - addl $raw_closure_T_FS, %esp -L(UW50): - # cfi_adjust_cfa_offset(-raw_closure_T_FS) - ret $8 -L(UW51): - # cfi_adjust_cfa_offset(raw_closure_T_FS) -E(L(load_table5), X86_RET_STRUCTARG) - jmp L(e5) -E(L(load_table5), X86_RET_STRUCT_1B) - movzbl %al, %eax - jmp L(e5) -E(L(load_table5), X86_RET_STRUCT_2B) - movzwl %ax, %eax - jmp L(e5) - - /* Fill out the table so that bad values are predictable. */ -E(L(load_table5), X86_RET_UNUSED14) - ud2 -E(L(load_table5), X86_RET_UNUSED15) - ud2 - -L(UW52): - # cfi_endproc -ENDF(C(ffi_closure_raw_THISCALL)) - -#endif /* !FFI_NO_RAW_API */ - -#ifdef X86_DARWIN -# define COMDAT(X) \ - .section __TEXT,__textcoal_nt,coalesced,pure_instructions; \ - .weak_definition X; \ - .private_extern X -#elif defined __ELF__ -# define COMDAT(X) \ - .section .text.X,"axG",@progbits,X,comdat; \ - .globl X; \ - FFI_HIDDEN(X) -#else -# define COMDAT(X) -#endif - -#if defined(__PIC__) - COMDAT(C(__x86.get_pc_thunk.bx)) -C(__x86.get_pc_thunk.bx): - movl (%esp), %ebx - ret -ENDF(C(__x86.get_pc_thunk.bx)) -# if defined X86_DARWIN || defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE - COMDAT(C(__x86.get_pc_thunk.dx)) -C(__x86.get_pc_thunk.dx): - movl (%esp), %edx - ret -ENDF(C(__x86.get_pc_thunk.dx)) -#endif /* DARWIN || HIDDEN */ -#endif /* __PIC__ */ - -/* Sadly, OSX cctools-as doesn't understand .cfi directives at all. */ - -#ifdef __APPLE__ -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EHFrame0: -#elif defined(HAVE_AS_X86_64_UNWIND_SECTION_TYPE) -.section .eh_frame,"a",@unwind -#else -.section .eh_frame,"a",@progbits -#endif - -#ifdef HAVE_AS_X86_PCREL -# define PCREL(X) X - . -#else -# define PCREL(X) X@rel -#endif - -/* Simplify advancing between labels. Assume DW_CFA_advance_loc1 fits. */ -#define ADV(N, P) .byte 2, L(N)-L(P) - - .balign 4 -L(CIE): - .set L(set0),L(ECIE)-L(SCIE) - .long L(set0) /* CIE Length */ -L(SCIE): - .long 0 /* CIE Identifier Tag */ - .byte 1 /* CIE Version */ - .ascii "zR\0" /* CIE Augmentation */ - .byte 1 /* CIE Code Alignment Factor */ - .byte 0x7c /* CIE Data Alignment Factor */ - .byte 0x8 /* CIE RA Column */ - .byte 1 /* Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ - .byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp offset 4 */ - .byte 0x80+8, 1 /* DW_CFA_offset, %eip offset 1*-4 */ - .balign 4 -L(ECIE): - - .set L(set1),L(EFDE1)-L(SFDE1) - .long L(set1) /* FDE Length */ -L(SFDE1): - .long L(SFDE1)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW0)) /* Initial location */ - .long L(UW5)-L(UW0) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW1, UW0) - .byte 0xc, 5, 8 /* DW_CFA_def_cfa, %ebp 8 */ - .byte 0x80+5, 2 /* DW_CFA_offset, %ebp 2*-4 */ - ADV(UW2, UW1) - .byte 0x80+3, 0 /* DW_CFA_offset, %ebx 0*-4 */ - ADV(UW3, UW2) - .byte 0xa /* DW_CFA_remember_state */ - .byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp 4 */ - .byte 0xc0+3 /* DW_CFA_restore, %ebx */ - .byte 0xc0+5 /* DW_CFA_restore, %ebp */ - ADV(UW4, UW3) - .byte 0xb /* DW_CFA_restore_state */ - .balign 4 -L(EFDE1): - - .set L(set2),L(EFDE2)-L(SFDE2) - .long L(set2) /* FDE Length */ -L(SFDE2): - .long L(SFDE2)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW6)) /* Initial location */ - .long L(UW8)-L(UW6) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW7, UW6) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE2): - - .set L(set3),L(EFDE3)-L(SFDE3) - .long L(set3) /* FDE Length */ -L(SFDE3): - .long L(SFDE3)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW9)) /* Initial location */ - .long L(UW11)-L(UW9) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW10, UW9) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE3): - - .set L(set4),L(EFDE4)-L(SFDE4) - .long L(set4) /* FDE Length */ -L(SFDE4): - .long L(SFDE4)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW12)) /* Initial location */ - .long L(UW20)-L(UW12) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW13, UW12) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ -#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX - ADV(UW14, UW13) - .byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */ - ADV(UW15, UW14) - .byte 0xc0+3 /* DW_CFA_restore %ebx */ - ADV(UW16, UW15) -#else - ADV(UW16, UW13) -#endif - .byte 0xe, 4 /* DW_CFA_def_cfa_offset */ - ADV(UW17, UW16) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - ADV(UW18, UW17) - .byte 0xe, 4 /* DW_CFA_def_cfa_offset */ - ADV(UW19, UW18) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE4): - - .set L(set5),L(EFDE5)-L(SFDE5) - .long L(set5) /* FDE Length */ -L(SFDE5): - .long L(SFDE5)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW21)) /* Initial location */ - .long L(UW23)-L(UW21) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW22, UW21) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE5): - - .set L(set6),L(EFDE6)-L(SFDE6) - .long L(set6) /* FDE Length */ -L(SFDE6): - .long L(SFDE6)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW24)) /* Initial location */ - .long L(UW26)-L(UW24) /* Address range */ - .byte 0 /* Augmentation size */ - .byte 0xe, 8 /* DW_CFA_def_cfa_offset */ - .byte 0x80+8, 2 /* DW_CFA_offset %eip, 2*-4 */ - ADV(UW25, UW24) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE6): - - .set L(set7),L(EFDE7)-L(SFDE7) - .long L(set7) /* FDE Length */ -L(SFDE7): - .long L(SFDE7)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW27)) /* Initial location */ - .long L(UW31)-L(UW27) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW28, UW27) - .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ -#ifdef FFI_CLOSURE_CALL_INNER_SAVE_EBX - ADV(UW29, UW28) - .byte 0x80+3, (40-(closure_FS+4))/-4 /* DW_CFA_offset %ebx */ - ADV(UW30, UW29) - .byte 0xc0+3 /* DW_CFA_restore %ebx */ -#endif - .balign 4 -L(EFDE7): - -#if !FFI_NO_RAW_API - .set L(set8),L(EFDE8)-L(SFDE8) - .long L(set8) /* FDE Length */ -L(SFDE8): - .long L(SFDE8)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW32)) /* Initial location */ - .long L(UW40)-L(UW32) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW33, UW32) - .byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */ - ADV(UW34, UW33) - .byte 0x80+3, 2 /* DW_CFA_offset %ebx 2*-4 */ - ADV(UW35, UW34) - .byte 0xc0+3 /* DW_CFA_restore %ebx */ - ADV(UW36, UW35) - .byte 0xe, 4 /* DW_CFA_def_cfa_offset */ - ADV(UW37, UW36) - .byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */ - ADV(UW38, UW37) - .byte 0xe, 4 /* DW_CFA_def_cfa_offset */ - ADV(UW39, UW38) - .byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE8): - - .set L(set9),L(EFDE9)-L(SFDE9) - .long L(set9) /* FDE Length */ -L(SFDE9): - .long L(SFDE9)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW41)) /* Initial location */ - .long L(UW52)-L(UW41) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW42, UW41) - .byte 0xe, 0 /* DW_CFA_def_cfa_offset */ - .byte 0x9, 8, 2 /* DW_CFA_register %eip, %edx */ - ADV(UW43, UW42) - .byte 0xe, 4 /* DW_CFA_def_cfa_offset */ - ADV(UW44, UW43) - .byte 0xe, 8 /* DW_CFA_def_cfa_offset */ - .byte 0x80+8, 2 /* DW_CFA_offset %eip 2*-4 */ - ADV(UW45, UW44) - .byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */ - ADV(UW46, UW45) - .byte 0x80+3, 3 /* DW_CFA_offset %ebx 3*-4 */ - ADV(UW47, UW46) - .byte 0xc0+3 /* DW_CFA_restore %ebx */ - ADV(UW48, UW47) - .byte 0xe, 8 /* DW_CFA_def_cfa_offset */ - ADV(UW49, UW48) - .byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */ - ADV(UW50, UW49) - .byte 0xe, 8 /* DW_CFA_def_cfa_offset */ - ADV(UW51, UW50) - .byte 0xe, raw_closure_T_FS+8 /* DW_CFA_def_cfa_offset */ - .balign 4 -L(EFDE9): -#endif /* !FFI_NO_RAW_API */ - -#endif /* ifndef __x86_64__ */ - -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/x86/unix64.S b/llgo/third_party/gofrontend/libffi/src/x86/unix64.S deleted file mode 100644 index f9f916312c5c511ac196094d8774bf8f78e8226c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/unix64.S +++ /dev/null @@ -1,546 +0,0 @@ -/* ----------------------------------------------------------------------- - unix64.S - Copyright (c) 2013 The Written Word, Inc. - - Copyright (c) 2008 Red Hat, Inc - - Copyright (c) 2002 Bo Thorsen - - x86-64 Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifdef __x86_64__ -#define LIBFFI_ASM -#include -#include -#include "internal64.h" - - .text - -#define C2(X, Y) X ## Y -#define C1(X, Y) C2(X, Y) -#ifdef __USER_LABEL_PREFIX__ -# define C(X) C1(__USER_LABEL_PREFIX__, X) -#else -# define C(X) X -#endif - -#ifdef __APPLE__ -# define L(X) C1(L, X) -#else -# define L(X) C1(.L, X) -#endif - -#ifdef __ELF__ -# define PLT(X) X@PLT -# define ENDF(X) .type X,@function; .size X, . - X -#else -# define PLT(X) X -# define ENDF(X) -#endif - -/* This macro allows the safe creation of jump tables without an - actual table. The entry points into the table are all 8 bytes. - The use of ORG asserts that we're at the correct location. */ -/* ??? The clang assembler doesn't handle .org with symbolic expressions. */ -#if defined(__clang__) || defined(__APPLE__) -# define E(BASE, X) .balign 8 -#else -# define E(BASE, X) .balign 8; .org BASE + X * 8 -#endif - -/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, - void *raddr, void (*fnaddr)(void)); - - Bit o trickiness here -- ARGS+BYTES is the base of the stack frame - for this function. This has been allocated by ffi_call. We also - deallocate some of the stack that has been alloca'd. */ - - .balign 8 - .globl C(ffi_call_unix64) - FFI_HIDDEN(C(ffi_call_unix64)) - -C(ffi_call_unix64): -L(UW0): - movq (%rsp), %r10 /* Load return address. */ - leaq (%rdi, %rsi), %rax /* Find local stack base. */ - movq %rdx, (%rax) /* Save flags. */ - movq %rcx, 8(%rax) /* Save raddr. */ - movq %rbp, 16(%rax) /* Save old frame pointer. */ - movq %r10, 24(%rax) /* Relocate return address. */ - movq %rax, %rbp /* Finalize local stack frame. */ - - /* New stack frame based off rbp. This is a itty bit of unwind - trickery in that the CFA *has* changed. There is no easy way - to describe it correctly on entry to the function. Fortunately, - it doesn't matter too much since at all points we can correctly - unwind back to ffi_call. Note that the location to which we - moved the return address is (the new) CFA-8, so from the - perspective of the unwind info, it hasn't moved. */ -L(UW1): - /* cfi_def_cfa(%rbp, 32) */ - /* cfi_rel_offset(%rbp, 16) */ - - movq %rdi, %r10 /* Save a copy of the register area. */ - movq %r8, %r11 /* Save a copy of the target fn. */ - movl %r9d, %eax /* Set number of SSE registers. */ - - /* Load up all argument registers. */ - movq (%r10), %rdi - movq 0x08(%r10), %rsi - movq 0x10(%r10), %rdx - movq 0x18(%r10), %rcx - movq 0x20(%r10), %r8 - movq 0x28(%r10), %r9 - movl 0xb0(%r10), %eax - testl %eax, %eax - jnz L(load_sse) -L(ret_from_load_sse): - - /* Deallocate the reg arg area, except for r10, then load via pop. */ - leaq 0xb8(%r10), %rsp - popq %r10 - - /* Call the user function. */ - call *%r11 - - /* Deallocate stack arg area; local stack frame in redzone. */ - leaq 24(%rbp), %rsp - - movq 0(%rbp), %rcx /* Reload flags. */ - movq 8(%rbp), %rdi /* Reload raddr. */ - movq 16(%rbp), %rbp /* Reload old frame pointer. */ -L(UW2): - /* cfi_remember_state */ - /* cfi_def_cfa(%rsp, 8) */ - /* cfi_restore(%rbp) */ - - /* The first byte of the flags contains the FFI_TYPE. */ - cmpb $UNIX64_RET_LAST, %cl - movzbl %cl, %r10d - leaq L(store_table)(%rip), %r11 - ja L(sa) - leaq (%r11, %r10, 8), %r10 - - /* Prep for the structure cases: scratch area in redzone. */ - leaq -20(%rsp), %rsi - jmp *%r10 - - .balign 8 -L(store_table): -E(L(store_table), UNIX64_RET_VOID) - ret -E(L(store_table), UNIX64_RET_UINT8) - movzbl %al, %eax - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_UINT16) - movzwl %ax, %eax - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_UINT32) - movl %eax, %eax - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_SINT8) - movsbq %al, %rax - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_SINT16) - movswq %ax, %rax - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_SINT32) - cltq - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_INT64) - movq %rax, (%rdi) - ret -E(L(store_table), UNIX64_RET_XMM32) - movd %xmm0, (%rdi) - ret -E(L(store_table), UNIX64_RET_XMM64) - movq %xmm0, (%rdi) - ret -E(L(store_table), UNIX64_RET_X87) - fstpt (%rdi) - ret -E(L(store_table), UNIX64_RET_X87_2) - fstpt (%rdi) - fstpt 16(%rdi) - ret -E(L(store_table), UNIX64_RET_ST_XMM0_RAX) - movq %rax, 8(%rsi) - jmp L(s3) -E(L(store_table), UNIX64_RET_ST_RAX_XMM0) - movq %xmm0, 8(%rsi) - jmp L(s2) -E(L(store_table), UNIX64_RET_ST_XMM0_XMM1) - movq %xmm1, 8(%rsi) - jmp L(s3) -E(L(store_table), UNIX64_RET_ST_RAX_RDX) - movq %rdx, 8(%rsi) -L(s2): - movq %rax, (%rsi) - shrl $UNIX64_SIZE_SHIFT, %ecx - rep movsb - ret - .balign 8 -L(s3): - movq %xmm0, (%rsi) - shrl $UNIX64_SIZE_SHIFT, %ecx - rep movsb - ret - -L(sa): call PLT(C(abort)) - - /* Many times we can avoid loading any SSE registers at all. - It's not worth an indirect jump to load the exact set of - SSE registers needed; zero or all is a good compromise. */ - .balign 2 -L(UW3): - /* cfi_restore_state */ -L(load_sse): - movdqa 0x30(%r10), %xmm0 - movdqa 0x40(%r10), %xmm1 - movdqa 0x50(%r10), %xmm2 - movdqa 0x60(%r10), %xmm3 - movdqa 0x70(%r10), %xmm4 - movdqa 0x80(%r10), %xmm5 - movdqa 0x90(%r10), %xmm6 - movdqa 0xa0(%r10), %xmm7 - jmp L(ret_from_load_sse) - -L(UW4): -ENDF(C(ffi_call_unix64)) - -/* 6 general registers, 8 vector registers, - 32 bytes of rvalue, 8 bytes of alignment. */ -#define ffi_closure_OFS_G 0 -#define ffi_closure_OFS_V (6*8) -#define ffi_closure_OFS_RVALUE (ffi_closure_OFS_V + 8*16) -#define ffi_closure_FS (ffi_closure_OFS_RVALUE + 32 + 8) - -/* The location of rvalue within the red zone after deallocating the frame. */ -#define ffi_closure_RED_RVALUE (ffi_closure_OFS_RVALUE - ffi_closure_FS) - - .balign 2 - .globl C(ffi_closure_unix64_sse) - FFI_HIDDEN(C(ffi_closure_unix64_sse)) - -C(ffi_closure_unix64_sse): -L(UW5): - subq $ffi_closure_FS, %rsp -L(UW6): - /* cfi_adjust_cfa_offset(ffi_closure_FS) */ - - movdqa %xmm0, ffi_closure_OFS_V+0x00(%rsp) - movdqa %xmm1, ffi_closure_OFS_V+0x10(%rsp) - movdqa %xmm2, ffi_closure_OFS_V+0x20(%rsp) - movdqa %xmm3, ffi_closure_OFS_V+0x30(%rsp) - movdqa %xmm4, ffi_closure_OFS_V+0x40(%rsp) - movdqa %xmm5, ffi_closure_OFS_V+0x50(%rsp) - movdqa %xmm6, ffi_closure_OFS_V+0x60(%rsp) - movdqa %xmm7, ffi_closure_OFS_V+0x70(%rsp) - jmp L(sse_entry1) - -L(UW7): -ENDF(C(ffi_closure_unix64_sse)) - - .balign 2 - .globl C(ffi_closure_unix64) - FFI_HIDDEN(C(ffi_closure_unix64)) - -C(ffi_closure_unix64): -L(UW8): - subq $ffi_closure_FS, %rsp -L(UW9): - /* cfi_adjust_cfa_offset(ffi_closure_FS) */ -L(sse_entry1): - movq %rdi, ffi_closure_OFS_G+0x00(%rsp) - movq %rsi, ffi_closure_OFS_G+0x08(%rsp) - movq %rdx, ffi_closure_OFS_G+0x10(%rsp) - movq %rcx, ffi_closure_OFS_G+0x18(%rsp) - movq %r8, ffi_closure_OFS_G+0x20(%rsp) - movq %r9, ffi_closure_OFS_G+0x28(%rsp) - -#ifdef __ILP32__ - movl FFI_TRAMPOLINE_SIZE(%r10), %edi /* Load cif */ - movl FFI_TRAMPOLINE_SIZE+4(%r10), %esi /* Load fun */ - movl FFI_TRAMPOLINE_SIZE+8(%r10), %edx /* Load user_data */ -#else - movq FFI_TRAMPOLINE_SIZE(%r10), %rdi /* Load cif */ - movq FFI_TRAMPOLINE_SIZE+8(%r10), %rsi /* Load fun */ - movq FFI_TRAMPOLINE_SIZE+16(%r10), %rdx /* Load user_data */ -#endif -L(do_closure): - leaq ffi_closure_OFS_RVALUE(%rsp), %rcx /* Load rvalue */ - movq %rsp, %r8 /* Load reg_args */ - leaq ffi_closure_FS+8(%rsp), %r9 /* Load argp */ - call C(ffi_closure_unix64_inner) - - /* Deallocate stack frame early; return value is now in redzone. */ - addq $ffi_closure_FS, %rsp -L(UW10): - /* cfi_adjust_cfa_offset(-ffi_closure_FS) */ - - /* The first byte of the return value contains the FFI_TYPE. */ - cmpb $UNIX64_RET_LAST, %al - movzbl %al, %r10d - leaq L(load_table)(%rip), %r11 - ja L(la) - leaq (%r11, %r10, 8), %r10 - leaq ffi_closure_RED_RVALUE(%rsp), %rsi - jmp *%r10 - - .balign 8 -L(load_table): -E(L(load_table), UNIX64_RET_VOID) - ret -E(L(load_table), UNIX64_RET_UINT8) - movzbl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_UINT16) - movzwl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_UINT32) - movl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_SINT8) - movsbl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_SINT16) - movswl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_SINT32) - movl (%rsi), %eax - ret -E(L(load_table), UNIX64_RET_INT64) - movq (%rsi), %rax - ret -E(L(load_table), UNIX64_RET_XMM32) - movd (%rsi), %xmm0 - ret -E(L(load_table), UNIX64_RET_XMM64) - movq (%rsi), %xmm0 - ret -E(L(load_table), UNIX64_RET_X87) - fldt (%rsi) - ret -E(L(load_table), UNIX64_RET_X87_2) - fldt 16(%rsi) - fldt (%rsi) - ret -E(L(load_table), UNIX64_RET_ST_XMM0_RAX) - movq 8(%rsi), %rax - jmp L(l3) -E(L(load_table), UNIX64_RET_ST_RAX_XMM0) - movq 8(%rsi), %xmm0 - jmp L(l2) -E(L(load_table), UNIX64_RET_ST_XMM0_XMM1) - movq 8(%rsi), %xmm1 - jmp L(l3) -E(L(load_table), UNIX64_RET_ST_RAX_RDX) - movq 8(%rsi), %rdx -L(l2): - movq (%rsi), %rax - ret - .balign 8 -L(l3): - movq (%rsi), %xmm0 - ret - -L(la): call PLT(C(abort)) - -L(UW11): -ENDF(C(ffi_closure_unix64)) - - .balign 2 - .globl C(ffi_go_closure_unix64_sse) - FFI_HIDDEN(C(ffi_go_closure_unix64_sse)) - -C(ffi_go_closure_unix64_sse): -L(UW12): - subq $ffi_closure_FS, %rsp -L(UW13): - /* cfi_adjust_cfa_offset(ffi_closure_FS) */ - - movdqa %xmm0, ffi_closure_OFS_V+0x00(%rsp) - movdqa %xmm1, ffi_closure_OFS_V+0x10(%rsp) - movdqa %xmm2, ffi_closure_OFS_V+0x20(%rsp) - movdqa %xmm3, ffi_closure_OFS_V+0x30(%rsp) - movdqa %xmm4, ffi_closure_OFS_V+0x40(%rsp) - movdqa %xmm5, ffi_closure_OFS_V+0x50(%rsp) - movdqa %xmm6, ffi_closure_OFS_V+0x60(%rsp) - movdqa %xmm7, ffi_closure_OFS_V+0x70(%rsp) - jmp L(sse_entry2) - -L(UW14): -ENDF(C(ffi_go_closure_unix64_sse)) - - .balign 2 - .globl C(ffi_go_closure_unix64) - FFI_HIDDEN(C(ffi_go_closure_unix64)) - -C(ffi_go_closure_unix64): -L(UW15): - subq $ffi_closure_FS, %rsp -L(UW16): - /* cfi_adjust_cfa_offset(ffi_closure_FS) */ -L(sse_entry2): - movq %rdi, ffi_closure_OFS_G+0x00(%rsp) - movq %rsi, ffi_closure_OFS_G+0x08(%rsp) - movq %rdx, ffi_closure_OFS_G+0x10(%rsp) - movq %rcx, ffi_closure_OFS_G+0x18(%rsp) - movq %r8, ffi_closure_OFS_G+0x20(%rsp) - movq %r9, ffi_closure_OFS_G+0x28(%rsp) - -#ifdef __ILP32__ - movl 4(%r10), %edi /* Load cif */ - movl 8(%r10), %esi /* Load fun */ - movl %r10d, %edx /* Load closure (user_data) */ -#else - movq 8(%r10), %rdi /* Load cif */ - movq 16(%r10), %rsi /* Load fun */ - movq %r10, %rdx /* Load closure (user_data) */ -#endif - jmp L(do_closure) - -L(UW17): -ENDF(C(ffi_go_closure_unix64)) - -/* Sadly, OSX cctools-as doesn't understand .cfi directives at all. */ - -#ifdef __APPLE__ -.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support -EHFrame0: -#elif defined(HAVE_AS_X86_64_UNWIND_SECTION_TYPE) -.section .eh_frame,"a",@unwind -#else -.section .eh_frame,"a",@progbits -#endif - -#ifdef HAVE_AS_X86_PCREL -# define PCREL(X) X - . -#else -# define PCREL(X) X@rel -#endif - -/* Simplify advancing between labels. Assume DW_CFA_advance_loc1 fits. */ -#define ADV(N, P) .byte 2, L(N)-L(P) - - .balign 8 -L(CIE): - .set L(set0),L(ECIE)-L(SCIE) - .long L(set0) /* CIE Length */ -L(SCIE): - .long 0 /* CIE Identifier Tag */ - .byte 1 /* CIE Version */ - .ascii "zR\0" /* CIE Augmentation */ - .byte 1 /* CIE Code Alignment Factor */ - .byte 0x78 /* CIE Data Alignment Factor */ - .byte 0x10 /* CIE RA Column */ - .byte 1 /* Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ - .byte 0xc, 7, 8 /* DW_CFA_def_cfa, %rsp offset 8 */ - .byte 0x80+16, 1 /* DW_CFA_offset, %rip offset 1*-8 */ - .balign 8 -L(ECIE): - - .set L(set1),L(EFDE1)-L(SFDE1) - .long L(set1) /* FDE Length */ -L(SFDE1): - .long L(SFDE1)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW0)) /* Initial location */ - .long L(UW4)-L(UW0) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW1, UW0) - .byte 0xc, 6, 32 /* DW_CFA_def_cfa, %rbp 32 */ - .byte 0x80+6, 2 /* DW_CFA_offset, %rbp 2*-8 */ - ADV(UW2, UW1) - .byte 0xa /* DW_CFA_remember_state */ - .byte 0xc, 7, 8 /* DW_CFA_def_cfa, %rsp 8 */ - .byte 0xc0+6 /* DW_CFA_restore, %rbp */ - ADV(UW3, UW2) - .byte 0xb /* DW_CFA_restore_state */ - .balign 8 -L(EFDE1): - - .set L(set2),L(EFDE2)-L(SFDE2) - .long L(set2) /* FDE Length */ -L(SFDE2): - .long L(SFDE2)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW5)) /* Initial location */ - .long L(UW7)-L(UW5) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW6, UW5) - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte ffi_closure_FS + 8, 1 /* uleb128, assuming 128 <= FS < 255 */ - .balign 8 -L(EFDE2): - - .set L(set3),L(EFDE3)-L(SFDE3) - .long L(set3) /* FDE Length */ -L(SFDE3): - .long L(SFDE3)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW8)) /* Initial location */ - .long L(UW11)-L(UW8) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW9, UW8) - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte ffi_closure_FS + 8, 1 /* uleb128, assuming 128 <= FS < 255 */ - ADV(UW10, UW9) - .byte 0xe, 8 /* DW_CFA_def_cfa_offset 8 */ -L(EFDE3): - - .set L(set4),L(EFDE4)-L(SFDE4) - .long L(set4) /* FDE Length */ -L(SFDE4): - .long L(SFDE4)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW12)) /* Initial location */ - .long L(UW14)-L(UW12) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW13, UW12) - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte ffi_closure_FS + 8, 1 /* uleb128, assuming 128 <= FS < 255 */ - .balign 8 -L(EFDE4): - - .set L(set5),L(EFDE5)-L(SFDE5) - .long L(set5) /* FDE Length */ -L(SFDE5): - .long L(SFDE5)-L(CIE) /* FDE CIE offset */ - .long PCREL(L(UW15)) /* Initial location */ - .long L(UW17)-L(UW15) /* Address range */ - .byte 0 /* Augmentation size */ - ADV(UW16, UW15) - .byte 0xe /* DW_CFA_def_cfa_offset */ - .byte ffi_closure_FS + 8, 1 /* uleb128, assuming 128 <= FS < 255 */ - .balign 8 -L(EFDE5): -#ifdef __APPLE__ - .subsections_via_symbols -#endif - -#endif /* __x86_64__ */ -#if defined __ELF__ && defined __linux__ - .section .note.GNU-stack,"",@progbits -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/x86/win64.S b/llgo/third_party/gofrontend/libffi/src/x86/win64.S deleted file mode 100644 index a5a20b6437c1cb260ba8394f323f54e5121e863c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/x86/win64.S +++ /dev/null @@ -1,219 +0,0 @@ -#define LIBFFI_ASM -#include -#include -#include - -#if defined(HAVE_AS_CFI_PSEUDO_OP) - .cfi_sections .debug_frame -#endif - -#define arg0 %rcx -#define arg1 %rdx -#define arg2 %r8 -#define arg3 %r9 - -#ifdef SYMBOL_UNDERSCORE -#define SYMBOL_NAME(name) _##name -#else -#define SYMBOL_NAME(name) name -#endif - -.macro E which - .align 8 - .org 0b + \which * 8 -.endm - - .text - -/* ffi_call_win64 (void *stack, struct win64_call_frame *frame, void *r10) - - Bit o trickiness here -- FRAME is the base of the stack frame - for this function. This has been allocated by ffi_call. We also - deallocate some of the stack that has been alloca'd. */ - - .align 8 - .globl ffi_call_win64 - - .seh_proc ffi_call_win64 -ffi_call_win64: - cfi_startproc - /* Set up the local stack frame and install it in rbp/rsp. */ - movq (%rsp), %rax - movq %rbp, (arg1) - movq %rax, 8(arg1) - movq arg1, %rbp - cfi_def_cfa(%rbp, 16) - cfi_rel_offset(%rbp, 0) - .seh_pushreg %rbp - .seh_setframe %rbp, 0 - .seh_endprologue - movq arg0, %rsp - - movq arg2, %r10 - - /* Load all slots into both general and xmm registers. */ - movq (%rsp), %rcx - movsd (%rsp), %xmm0 - movq 8(%rsp), %rdx - movsd 8(%rsp), %xmm1 - movq 16(%rsp), %r8 - movsd 16(%rsp), %xmm2 - movq 24(%rsp), %r9 - movsd 24(%rsp), %xmm3 - - call *16(%rbp) - - movl 24(%rbp), %ecx - movq 32(%rbp), %r8 - leaq 0f(%rip), %r10 - cmpl $FFI_TYPE_SMALL_STRUCT_4B, %ecx - leaq (%r10, %rcx, 8), %r10 - ja 99f - jmp *%r10 - -/* Below, we're space constrained most of the time. Thus we eschew the - modern "mov, pop, ret" sequence (5 bytes) for "leave, ret" (2 bytes). */ -.macro epilogue - leaveq - cfi_remember_state - cfi_def_cfa(%rsp, 8) - cfi_restore(%rbp) - ret - cfi_restore_state -.endm - - .align 8 -0: -E FFI_TYPE_VOID - epilogue -E FFI_TYPE_INT - movslq %eax, %rax - movq %rax, (%r8) - epilogue -E FFI_TYPE_FLOAT - movss %xmm0, (%r8) - epilogue -E FFI_TYPE_DOUBLE - movsd %xmm0, (%r8) - epilogue -E FFI_TYPE_LONGDOUBLE - call abort -E FFI_TYPE_UINT8 - movzbl %al, %eax - movq %rax, (%r8) - epilogue -E FFI_TYPE_SINT8 - movsbq %al, %rax - jmp 98f -E FFI_TYPE_UINT16 - movzwl %ax, %eax - movq %rax, (%r8) - epilogue -E FFI_TYPE_SINT16 - movswq %ax, %rax - jmp 98f -E FFI_TYPE_UINT32 - movl %eax, %eax - movq %rax, (%r8) - epilogue -E FFI_TYPE_SINT32 - movslq %eax, %rax - movq %rax, (%r8) - epilogue -E FFI_TYPE_UINT64 -98: movq %rax, (%r8) - epilogue -E FFI_TYPE_SINT64 - movq %rax, (%r8) - epilogue -E FFI_TYPE_STRUCT - epilogue -E FFI_TYPE_POINTER - movq %rax, (%r8) - epilogue -E FFI_TYPE_COMPLEX - call abort -E FFI_TYPE_SMALL_STRUCT_1B - movb %al, (%r8) - epilogue -E FFI_TYPE_SMALL_STRUCT_2B - movw %ax, (%r8) - epilogue -E FFI_TYPE_SMALL_STRUCT_4B - movl %eax, (%r8) - epilogue - - .align 8 -99: call abort - -.purgem epilogue - - cfi_endproc - .seh_endproc - - -/* 32 bytes of outgoing register stack space, 8 bytes of alignment, - 16 bytes of result, 32 bytes of xmm registers. */ -#define ffi_clo_FS (32+8+16+32) -#define ffi_clo_OFF_R (32+8) -#define ffi_clo_OFF_X (32+8+16) - - .align 8 - .globl ffi_go_closure_win64 - - .seh_proc ffi_go_closure_win64 -ffi_go_closure_win64: - cfi_startproc - /* Save all integer arguments into the incoming reg stack space. */ - movq arg0, 8(%rsp) - movq arg1, 16(%rsp) - movq arg2, 24(%rsp) - movq arg3, 32(%rsp) - - movq 8(%r10), arg0 /* load cif */ - movq 16(%r10), arg1 /* load fun */ - movq %r10, arg2 /* closure is user_data */ - jmp 0f - cfi_endproc - .seh_endproc - - .align 8 - .globl ffi_closure_win64 - - .seh_proc ffi_closure_win64 -ffi_closure_win64: - cfi_startproc - /* Save all integer arguments into the incoming reg stack space. */ - movq arg0, 8(%rsp) - movq arg1, 16(%rsp) - movq arg2, 24(%rsp) - movq arg3, 32(%rsp) - - movq FFI_TRAMPOLINE_SIZE(%r10), arg0 /* load cif */ - movq FFI_TRAMPOLINE_SIZE+8(%r10), arg1 /* load fun */ - movq FFI_TRAMPOLINE_SIZE+16(%r10), arg2 /* load user_data */ -0: - subq $ffi_clo_FS, %rsp - cfi_adjust_cfa_offset(ffi_clo_FS) - .seh_stackalloc ffi_clo_FS - .seh_endprologue - - /* Save all sse arguments into the stack frame. */ - movsd %xmm0, ffi_clo_OFF_X(%rsp) - movsd %xmm1, ffi_clo_OFF_X+8(%rsp) - movsd %xmm2, ffi_clo_OFF_X+16(%rsp) - movsd %xmm3, ffi_clo_OFF_X+24(%rsp) - - leaq ffi_clo_OFF_R(%rsp), arg3 - call ffi_closure_win64_inner - - /* Load the result into both possible result registers. */ - movq ffi_clo_OFF_R(%rsp), %rax - movsd ffi_clo_OFF_R(%rsp), %xmm0 - - addq $ffi_clo_FS, %rsp - cfi_adjust_cfa_offset(-ffi_clo_FS) - ret - - cfi_endproc - .seh_endproc diff --git a/llgo/third_party/gofrontend/libffi/src/xtensa/ffi.c b/llgo/third_party/gofrontend/libffi/src/xtensa/ffi.c deleted file mode 100644 index fd94dafbe30349e7e557e3a870333656288ba234..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/xtensa/ffi.c +++ /dev/null @@ -1,298 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2013 Tensilica, Inc. - - XTENSA Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -/* - |----------------------------------------| - | | - on entry to ffi_call ----> |----------------------------------------| - | caller stack frame for registers a0-a3 | - |----------------------------------------| - | | - | additional arguments | - entry of the function ---> |----------------------------------------| - | copy of function arguments a2-a7 | - | - - - - - - - - - - - - - | - | | - - The area below the entry line becomes the new stack frame for the function. - -*/ - - -#define FFI_TYPE_STRUCT_REGS FFI_TYPE_LAST - - -extern void ffi_call_SYSV(void *rvalue, unsigned rsize, unsigned flags, - void(*fn)(void), unsigned nbytes, extended_cif*); -extern void ffi_closure_SYSV(void) FFI_HIDDEN; - -ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -{ - switch(cif->rtype->type) { - case FFI_TYPE_SINT8: - case FFI_TYPE_UINT8: - case FFI_TYPE_SINT16: - case FFI_TYPE_UINT16: - cif->flags = cif->rtype->type; - break; - case FFI_TYPE_VOID: - case FFI_TYPE_FLOAT: - cif->flags = FFI_TYPE_UINT32; - break; - case FFI_TYPE_DOUBLE: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - cif->flags = FFI_TYPE_UINT64; // cif->rtype->type; - break; - case FFI_TYPE_STRUCT: - cif->flags = FFI_TYPE_STRUCT; //_REGS; - /* Up to 16 bytes are returned in registers */ - if (cif->rtype->size > 4 * 4) { - /* returned structure is referenced by a register; use 8 bytes - (including 4 bytes for potential additional alignment) */ - cif->flags = FFI_TYPE_STRUCT; - cif->bytes += 8; - } - break; - - default: - cif->flags = FFI_TYPE_UINT32; - break; - } - - /* Round the stack up to a full 4 register frame, just in case - (we use this size in movsp). This way, it's also a multiple of - 8 bytes for 64-bit arguments. */ - cif->bytes = ALIGN(cif->bytes, 16); - - return FFI_OK; -} - -void ffi_prep_args(extended_cif *ecif, unsigned char* stack) -{ - unsigned int i; - unsigned long *addr; - ffi_type **ptr; - - union { - void **v; - char **c; - signed char **sc; - unsigned char **uc; - signed short **ss; - unsigned short **us; - unsigned int **i; - long long **ll; - float **f; - double **d; - } p_argv; - - /* Verify that everything is aligned up properly */ - FFI_ASSERT (((unsigned long) stack & 0x7) == 0); - - p_argv.v = ecif->avalue; - addr = (unsigned long*)stack; - - /* structures with a size greater than 16 bytes are passed in memory */ - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 16) - { - *addr++ = (unsigned long)ecif->rvalue; - } - - for (i = ecif->cif->nargs, ptr = ecif->cif->arg_types; - i > 0; - i--, ptr++, p_argv.v++) - { - switch ((*ptr)->type) - { - case FFI_TYPE_SINT8: - *addr++ = **p_argv.sc; - break; - case FFI_TYPE_UINT8: - *addr++ = **p_argv.uc; - break; - case FFI_TYPE_SINT16: - *addr++ = **p_argv.ss; - break; - case FFI_TYPE_UINT16: - *addr++ = **p_argv.us; - break; - case FFI_TYPE_FLOAT: - case FFI_TYPE_INT: - case FFI_TYPE_UINT32: - case FFI_TYPE_SINT32: - case FFI_TYPE_POINTER: - *addr++ = **p_argv.i; - break; - case FFI_TYPE_DOUBLE: - case FFI_TYPE_UINT64: - case FFI_TYPE_SINT64: - if (((unsigned long)addr & 4) != 0) - addr++; - *(unsigned long long*)addr = **p_argv.ll; - addr += sizeof(unsigned long long) / sizeof (addr); - break; - - case FFI_TYPE_STRUCT: - { - unsigned long offs; - unsigned long size; - - if (((unsigned long)addr & 4) != 0 && (*ptr)->alignment > 4) - addr++; - - offs = (unsigned long) addr - (unsigned long) stack; - size = (*ptr)->size; - - /* Entire structure must fit the argument registers or referenced */ - if (offs < FFI_REGISTER_NARGS * 4 - && offs + size > FFI_REGISTER_NARGS * 4) - addr = (unsigned long*) (stack + FFI_REGISTER_NARGS * 4); - - memcpy((char*) addr, *p_argv.c, size); - addr += (size + 3) / 4; - break; - } - - default: - FFI_ASSERT(0); - } - } -} - - -void ffi_call(ffi_cif* cif, void(*fn)(void), void *rvalue, void **avalue) -{ - extended_cif ecif; - unsigned long rsize = cif->rtype->size; - int flags = cif->flags; - void *alloc = NULL; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* Note that for structures that are returned in registers (size <= 16 bytes) - we allocate a temporary buffer and use memcpy to copy it to the final - destination. The reason is that the target address might be misaligned or - the length not a multiple of 4 bytes. Handling all those cases would be - very complex. */ - - if (flags == FFI_TYPE_STRUCT && (rsize <= 16 || rvalue == NULL)) - { - alloc = alloca(ALIGN(rsize, 4)); - ecif.rvalue = alloc; - } - else - { - ecif.rvalue = rvalue; - } - - if (cif->abi != FFI_SYSV) - FFI_ASSERT(0); - - ffi_call_SYSV (ecif.rvalue, rsize, cif->flags, fn, cif->bytes, &ecif); - - if (alloc != NULL && rvalue != NULL) - memcpy(rvalue, alloc, rsize); -} - -extern void ffi_trampoline(); -extern void ffi_cacheflush(void* start, void* end); - -ffi_status -ffi_prep_closure_loc (ffi_closure* closure, - ffi_cif* cif, - void (*fun)(ffi_cif*, void*, void**, void*), - void *user_data, - void *codeloc) -{ - /* copye trampoline to stack and patch 'ffi_closure_SYSV' pointer */ - memcpy(closure->tramp, ffi_trampoline, FFI_TRAMPOLINE_SIZE); - *(unsigned int*)(&closure->tramp[8]) = (unsigned int)ffi_closure_SYSV; - - // Do we have this function? - // __builtin___clear_cache(closer->tramp, closer->tramp + FFI_TRAMPOLINE_SIZE) - ffi_cacheflush(closure->tramp, closure->tramp + FFI_TRAMPOLINE_SIZE); - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - return FFI_OK; -} - - -long FFI_HIDDEN -ffi_closure_SYSV_inner(ffi_closure *closure, void **values, void *rvalue) -{ - ffi_cif *cif; - ffi_type **arg_types; - void **avalue; - int i, areg; - - cif = closure->cif; - if (cif->abi != FFI_SYSV) - return FFI_BAD_ABI; - - areg = 0; - - int rtype = cif->rtype->type; - if (rtype == FFI_TYPE_STRUCT && cif->rtype->size > 4 * 4) - { - rvalue = *values; - areg++; - } - - cif = closure->cif; - arg_types = cif->arg_types; - avalue = alloca(cif->nargs * sizeof(void *)); - - for (i = 0; i < cif->nargs; i++) - { - if (arg_types[i]->alignment == 8 && (areg & 1) != 0) - areg++; - - // skip the entry 16,a1 framework, add 16 bytes (4 registers) - if (areg == FFI_REGISTER_NARGS) - areg += 4; - - if (arg_types[i]->type == FFI_TYPE_STRUCT) - { - int numregs = ((arg_types[i]->size + 3) & ~3) / 4; - if (areg < FFI_REGISTER_NARGS && areg + numregs > FFI_REGISTER_NARGS) - areg = FFI_REGISTER_NARGS + 4; - } - - avalue[i] = &values[areg]; - areg += (arg_types[i]->size + 3) / 4; - } - - (closure->fun)(cif, rvalue, avalue, closure->user_data); - - return rtype; -} diff --git a/llgo/third_party/gofrontend/libffi/src/xtensa/ffitarget.h b/llgo/third_party/gofrontend/libffi/src/xtensa/ffitarget.h deleted file mode 100644 index 0ba728bc948c8abe34c288b327ed9c2b41de5b9b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/xtensa/ffitarget.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 2013 Tensilica, Inc. - Target configuration macros for XTENSA. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#ifndef LIBFFI_TARGET_H -#define LIBFFI_TARGET_H - -#ifndef LIBFFI_H -#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." -#endif - -#ifndef LIBFFI_ASM -typedef unsigned long ffi_arg; -typedef signed long ffi_sarg; - -typedef enum ffi_abi { - FFI_FIRST_ABI = 0, - FFI_SYSV, - FFI_LAST_ABI, - FFI_DEFAULT_ABI = FFI_SYSV -} ffi_abi; -#endif - -#define FFI_REGISTER_NARGS 6 - -/* ---- Definitions for closures ----------------------------------------- */ - -#define FFI_CLOSURES 1 -#define FFI_NATIVE_RAW_API 0 -#define FFI_TRAMPOLINE_SIZE 24 - -#endif diff --git a/llgo/third_party/gofrontend/libffi/src/xtensa/sysv.S b/llgo/third_party/gofrontend/libffi/src/xtensa/sysv.S deleted file mode 100644 index 64e6a0918d0248d9d19177769ccf8fc91c6cb872..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/src/xtensa/sysv.S +++ /dev/null @@ -1,253 +0,0 @@ -/* ----------------------------------------------------------------------- - sysv.S - Copyright (c) 2013 Tensilica, Inc. - - XTENSA Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include - -#define ENTRY(name) .text; .globl name; .type name,@function; .align 4; name: -#define END(name) .size name , . - name - -/* Assert that the table below is in sync with ffi.h. */ - -#if FFI_TYPE_UINT8 != 5 \ - || FFI_TYPE_SINT8 != 6 \ - || FFI_TYPE_UINT16 != 7 \ - || FFI_TYPE_SINT16 != 8 \ - || FFI_TYPE_UINT32 != 9 \ - || FFI_TYPE_SINT32 != 10 \ - || FFI_TYPE_UINT64 != 11 -#error "xtensa/sysv.S out of sync with ffi.h" -#endif - - -/* ffi_call_SYSV (rvalue, rbytes, flags, (*fnaddr)(), bytes, ecif) - void *rvalue; a2 - unsigned long rbytes; a3 - unsigned flags; a4 - void (*fnaddr)(); a5 - unsigned long bytes; a6 - extended_cif* ecif) a7 -*/ - -ENTRY(ffi_call_SYSV) - - entry a1, 32 # 32 byte frame for using call8 below - - mov a10, a7 # a10(->arg0): ecif - sub a11, a1, a6 # a11(->arg1): stack pointer - mov a7, a1 # fp - movsp a1, a11 # set new sp = old_sp - bytes - - movi a8, ffi_prep_args - callx8 a8 # ffi_prep_args(ecif, stack) - - # prepare to move stack pointer back up to 6 arguments - # note that 'bytes' is already aligned - - movi a10, 6*4 - sub a11, a6, a10 - movgez a6, a10, a11 - add a6, a1, a6 - - - # we can pass up to 6 arguments in registers - # for simplicity, just load 6 arguments - # (the stack size is at least 32 bytes, so no risk to cross boundaries) - - l32i a10, a1, 0 - l32i a11, a1, 4 - l32i a12, a1, 8 - l32i a13, a1, 12 - l32i a14, a1, 16 - l32i a15, a1, 20 - - # move stack pointer - - movsp a1, a6 - - callx8 a5 # (*fn)(args...) - - # Handle return value(s) - - beqz a2, .Lexit - - movi a5, FFI_TYPE_STRUCT - bne a4, a5, .Lstore - movi a5, 16 - blt a5, a3, .Lexit - - s32i a10, a2, 0 - blti a3, 5, .Lexit - addi a3, a3, -1 - s32i a11, a2, 4 - blti a3, 8, .Lexit - s32i a12, a2, 8 - blti a3, 12, .Lexit - s32i a13, a2, 12 - -.Lexit: retw - -.Lstore: - addi a4, a4, -FFI_TYPE_UINT8 - bgei a4, 7, .Lexit # should never happen - movi a6, store_calls - add a4, a4, a4 - addx4 a6, a4, a6 # store_table + idx * 8 - jx a6 - - .align 8 -store_calls: - # UINT8 - s8i a10, a2, 0 - retw - - # SINT8 - .align 8 - s8i a10, a2, 0 - retw - - # UINT16 - .align 8 - s16i a10, a2, 0 - retw - - # SINT16 - .align 8 - s16i a10, a2, 0 - retw - - # UINT32 - .align 8 - s32i a10, a2, 0 - retw - - # SINT32 - .align 8 - s32i a10, a2, 0 - retw - - # UINT64 - .align 8 - s32i a10, a2, 0 - s32i a11, a2, 4 - retw - -END(ffi_call_SYSV) - - -/* - * void ffi_cacheflush (unsigned long start, unsigned long end) - */ - -#define EXTRA_ARGS_SIZE 24 - -ENTRY(ffi_cacheflush) - - entry a1, 16 - -1: dhwbi a2, 0 - ihi a2, 0 - addi a2, a2, 4 - blt a2, a3, 1b - - retw - -END(ffi_cacheflush) - -/* ffi_trampoline is copied to the stack */ - -ENTRY(ffi_trampoline) - - entry a1, 16 + (FFI_REGISTER_NARGS * 4) + (4 * 4) # [ 0] - j 2f # [ 3] - .align 4 # [ 6] -1: .long 0 # [ 8] -2: l32r a15, 1b # [12] - _mov a14, a0 # [15] - callx0 a15 # [18] - # [21] -END(ffi_trampoline) - -/* - * ffi_closure() - * - * a0: closure + 21 - * a14: return address (a0) - */ - -ENTRY(ffi_closure_SYSV) - - /* intentionally omitting entry here */ - - # restore return address (a0) and move pointer to closure to a10 - addi a10, a0, -21 - mov a0, a14 - - # allow up to 4 arguments as return values - addi a11, a1, 4 * 4 - - # save up to 6 arguments to stack (allocated by entry below) - s32i a2, a11, 0 - s32i a3, a11, 4 - s32i a4, a11, 8 - s32i a5, a11, 12 - s32i a6, a11, 16 - s32i a7, a11, 20 - - movi a8, ffi_closure_SYSV_inner - mov a12, a1 - callx8 a8 # .._inner(*closure, **avalue, *rvalue) - - # load up to four return arguments - l32i a2, a1, 0 - l32i a3, a1, 4 - l32i a4, a1, 8 - l32i a5, a1, 12 - - # (sign-)extend return value - movi a11, FFI_TYPE_UINT8 - bne a10, a11, 1f - extui a2, a2, 0, 8 - retw - -1: movi a11, FFI_TYPE_SINT8 - bne a10, a11, 1f - sext a2, a2, 7 - retw - -1: movi a11, FFI_TYPE_UINT16 - bne a10, a11, 1f - extui a2, a2, 0, 16 - retw - -1: movi a11, FFI_TYPE_SINT16 - bne a10, a11, 1f - sext a2, a2, 15 - -1: retw - -END(ffi_closure_SYSV) diff --git a/llgo/third_party/gofrontend/libffi/stamp-h.in b/llgo/third_party/gofrontend/libffi/stamp-h.in deleted file mode 100644 index 9788f70238c91894045d22366fa941580826c3c1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/llgo/third_party/gofrontend/libffi/testsuite/Makefile.am b/llgo/third_party/gofrontend/libffi/testsuite/Makefile.am deleted file mode 100644 index 209e8976635e0384612e4fbb1b88f82d93052a5b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/Makefile.am +++ /dev/null @@ -1,94 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -AUTOMAKE_OPTIONS = foreign dejagnu - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ - echo $(top_builddir)/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ - echo $(top_srcdir)/../dejagnu/runtest ; \ - else echo runtest; fi` - -AM_RUNTESTFLAGS = - -CLEANFILES = *.exe core* *.log *.sum - -EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ -libffi.call/closure_fn1.c \ -libffi.call/return_ul.c libffi.call/cls_align_double.c \ -libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ -libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ -libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ -libffi.call/ffitest.h libffi.call/nested_struct4.c \ -libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ -libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ -libffi.call/struct8.c libffi.call/nested_struct8.c \ -libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ -libffi.call/cls_pointer.c \ -libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ -libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ -libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ -libffi.call/call.exp libffi.call/cls_double.c \ -libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ -libffi.call/return_ll1.c libffi.call/nested_struct3.c \ -libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ -libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ -libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ -libffi.call/return_fl.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ -libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ -libffi.call/return_fl3.c libffi.call/stret_medium.c \ -libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ -libffi.call/float3.c libffi.call/many2.c \ -libffi.call/closure_simple.c libffi.call/cls_align_uint16.c \ -libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ -libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ -libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ -libffi.call/cls_sshort.c \ -libffi.call/nested_struct.c libffi.call/cls_20byte.c \ -libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ -libffi.call/return_uc.c \ -libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ -libffi.call/promotion.c \ -libffi.call/return_dbl.c libffi.call/cls_24byte.c \ -libffi.call/struct4.c libffi.call/cls_6byte.c \ -libffi.call/cls_align_uint32.c libffi.call/float.c \ -libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ -libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ -libffi.call/cls_align_float.c libffi.call/return_fl1.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/cls_align_sint64.c \ -libffi.call/stret_large2.c libffi.call/return_sl.c \ -libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ -libffi.call/cls_2byte.c libffi.call/float2.c \ -libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ -libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ -libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ -libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ -libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ -libffi.call/struct1.c libffi.call/nested_struct9.c \ -libffi.call/huge_struct.c libffi.call/problem1.c \ -libffi.call/float4.c \ -libffi.call/return_ldl.c \ -libffi.call/closure_fn5.c \ -libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ -libffi.call/return_sc.c libffi.call/struct7.c \ -libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ -libffi.call/cls_6_1_byte.c \ -libffi.call/cls_7_1_byte.c libffi.call/unwindtest.cc \ -libffi.call/unwindtest_ffi_call.cc \ -lib/wrapper.exp lib/target-libpath.exp \ -lib/libffi.exp libffi.call/cls_struct_va1.c \ -libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ -libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ -libffi.call/nested_struct11.c libffi.call/uninitialized.c \ -libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c \ -libffi.call/strlen2.c \ -libffi.call/strlen3.c \ -libffi.call/strlen4.c diff --git a/llgo/third_party/gofrontend/libffi/testsuite/Makefile.in b/llgo/third_party/gofrontend/libffi/testsuite/Makefile.in deleted file mode 100644 index cbfe35bafb47fe58c0cbd412faf52c5e8b0200d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/Makefile.in +++ /dev/null @@ -1,481 +0,0 @@ -# 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@ -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 = testsuite -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \ - $(top_srcdir)/../config/asmcfi.m4 \ - $(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)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fficonfig.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DEJATOOL = $(PACKAGE) -RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMTAR = @AMTAR@ -AM_LTLDFLAGS = @AM_LTLDFLAGS@ -AM_RUNTESTFLAGS = -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -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@ -FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ -FGREP = @FGREP@ -GREP = @GREP@ -HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ -HAVE_LONG_DOUBLE_VARIANT = @HAVE_LONG_DOUBLE_VARIANT@ -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@ -TARGET = @TARGET@ -TARGETDIR = @TARGETDIR@ -TARGET_OBJ = @TARGET_OBJ@ -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@ -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 dejagnu - -# Setup the testing framework, if you have one -EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ - echo $(top_builddir)/../expect/expect ; \ - else echo expect ; fi` - -RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ - echo $(top_srcdir)/../dejagnu/runtest ; \ - else echo runtest; fi` - -CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c \ -libffi.call/cls_align_longdouble_split.c \ -libffi.call/closure_loc_fn0.c libffi.call/cls_schar.c \ -libffi.call/closure_fn1.c \ -libffi.call/return_ul.c libffi.call/cls_align_double.c \ -libffi.call/return_fl2.c libffi.call/cls_1_1byte.c \ -libffi.call/cls_64byte.c libffi.call/nested_struct7.c \ -libffi.call/cls_align_sint32.c libffi.call/nested_struct2.c \ -libffi.call/ffitest.h libffi.call/nested_struct4.c \ -libffi.call/cls_multi_ushort.c libffi.call/struct3.c \ -libffi.call/cls_3byte1.c libffi.call/cls_16byte.c \ -libffi.call/struct8.c libffi.call/nested_struct8.c \ -libffi.call/cls_multi_sshort.c libffi.call/cls_3byte2.c \ -libffi.call/cls_pointer.c \ -libffi.call/err_bad_typedef.c libffi.call/cls_4_1byte.c \ -libffi.call/cls_9byte2.c libffi.call/cls_multi_schar.c \ -libffi.call/stret_medium2.c libffi.call/cls_5_1_byte.c \ -libffi.call/call.exp libffi.call/cls_double.c \ -libffi.call/cls_align_sint16.c libffi.call/cls_uint.c \ -libffi.call/return_ll1.c libffi.call/nested_struct3.c \ -libffi.call/cls_20byte1.c libffi.call/closure_fn4.c \ -libffi.call/cls_uchar.c libffi.call/struct2.c libffi.call/cls_7byte.c \ -libffi.call/strlen.c libffi.call/many.c libffi.call/testclosure.c \ -libffi.call/return_fl.c libffi.call/struct5.c \ -libffi.call/cls_12byte.c libffi.call/cls_multi_sshortchar.c \ -libffi.call/cls_align_longdouble_split2.c libffi.call/return_dbl2.c \ -libffi.call/return_fl3.c libffi.call/stret_medium.c \ -libffi.call/nested_struct6.c libffi.call/closure_fn3.c \ -libffi.call/float3.c libffi.call/many2.c \ -libffi.call/closure_simple.c libffi.call/cls_align_uint16.c \ -libffi.call/cls_9byte1.c libffi.call/closure_fn6.c \ -libffi.call/cls_double_va.c libffi.call/cls_align_pointer.c \ -libffi.call/cls_align_longdouble.c libffi.call/closure_fn2.c \ -libffi.call/cls_sshort.c \ -libffi.call/nested_struct.c libffi.call/cls_20byte.c \ -libffi.call/cls_longdouble.c libffi.call/cls_multi_uchar.c \ -libffi.call/return_uc.c \ -libffi.call/cls_18byte.c libffi.call/cls_8byte.c \ -libffi.call/promotion.c \ -libffi.call/return_dbl.c libffi.call/cls_24byte.c \ -libffi.call/struct4.c libffi.call/cls_6byte.c \ -libffi.call/cls_align_uint32.c libffi.call/float.c \ -libffi.call/float1.c libffi.call/float_va.c libffi.call/negint.c \ -libffi.call/return_dbl1.c libffi.call/cls_3_1byte.c \ -libffi.call/cls_align_float.c libffi.call/return_fl1.c \ -libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ -libffi.call/cls_align_sint64.c \ -libffi.call/stret_large2.c libffi.call/return_sl.c \ -libffi.call/closure_fn0.c libffi.call/cls_5byte.c \ -libffi.call/cls_2byte.c libffi.call/float2.c \ -libffi.call/cls_dbls_struct.c libffi.call/cls_sint.c \ -libffi.call/stret_large.c libffi.call/cls_ulonglong.c \ -libffi.call/cls_ushort.c libffi.call/nested_struct1.c \ -libffi.call/err_bad_abi.c libffi.call/cls_longdouble_va.c \ -libffi.call/cls_float.c libffi.call/cls_pointer_stack.c \ -libffi.call/pyobjc-tc.c libffi.call/cls_multi_ushortchar.c \ -libffi.call/struct1.c libffi.call/nested_struct9.c \ -libffi.call/huge_struct.c libffi.call/problem1.c \ -libffi.call/float4.c \ -libffi.call/return_ldl.c \ -libffi.call/closure_fn5.c \ -libffi.call/struct6.c libffi.call/return_ll.c libffi.call/struct9.c \ -libffi.call/return_sc.c libffi.call/struct7.c \ -libffi.call/cls_align_uint64.c libffi.call/cls_4byte.c \ -libffi.call/cls_6_1_byte.c \ -libffi.call/cls_7_1_byte.c libffi.call/unwindtest.cc \ -libffi.call/unwindtest_ffi_call.cc \ -lib/wrapper.exp lib/target-libpath.exp \ -lib/libffi.exp libffi.call/cls_struct_va1.c \ -libffi.call/cls_uchar_va.c libffi.call/cls_uint_va.c \ -libffi.call/cls_ulong_va.c libffi.call/cls_ushort_va.c \ -libffi.call/nested_struct11.c libffi.call/uninitialized.c \ -libffi.call/va_1.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c \ -libffi.call/strlen2.c \ -libffi.call/strlen3.c \ -libffi.call/strlen4.c - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign testsuite/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -check-DEJAGNU: site.exp - srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ - EXPECT=$(EXPECT); export EXPECT; \ - runtest=$(RUNTEST); \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ - if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ - then :; else exit_status=1; fi; \ - done; \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi; \ - exit $$exit_status -site.exp: Makefile - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set srcdir $(srcdir)' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp - @echo 'set build_alias "$(build_alias)"' >>site.tmp - @echo 'set build_triplet $(build_triplet)' >>site.tmp - @echo 'set host_alias "$(host_alias)"' >>site.tmp - @echo 'set host_triplet $(host_triplet)' >>site.tmp - @echo 'set target_alias "$(target_alias)"' >>site.tmp - @echo 'set target_triplet $(target_triplet)' >>site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - -distclean-DEJAGNU: - -rm -f site.exp site.bak - -l='$(DEJATOOL)'; for tool in $$l; do \ - rm -f $$tool.sum $$tool.log; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU -check: check-am -all-am: Makefile -installdirs: -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: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-DEJAGNU distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ - clean-libtool distclean distclean-DEJAGNU distclean-generic \ - distclean-libtool 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-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am - - -# 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/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn0.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn0.c deleted file mode 100644 index a579ff6c979f3f219cd5fab04c52678c67cf12f0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn0.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20030828 */ - - - - -/* { dg-do run } */ -#include "ffitest.h" - -static void -closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + - (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + - (int)(*(signed short *)args[4]) + - (int)(*(unsigned long long *)args[5]) + - (int)*(int *)args[6] + (int)(*(int *)args[7]) + - (int)(*(double *)args[8]) + (int)*(int *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(int *)args[13]) + - (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), - (int)(*(unsigned long long *)args[2]), - (int)*(int *)args[3], (int)(*(signed short *)args[4]), - (int)(*(unsigned long long *)args[5]), - (int)*(int *)args[6], (int)(*(int *)args[7]), - (int)(*(double *)args[8]), (int)*(int *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(int *)args[13]), - (int)(*(int *)args[14]),*(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); - -} - -typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long, - int, signed short, unsigned long long, int, - int, double, int, int, float, int, int, - int, int); - -int main (void) -{ - ffi_cif cif; - void * code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_uint64; - cl_arg_types[1] = &ffi_type_sint; - cl_arg_types[2] = &ffi_type_uint64; - cl_arg_types[3] = &ffi_type_sint; - cl_arg_types[4] = &ffi_type_sshort; - cl_arg_types[5] = &ffi_type_uint64; - cl_arg_types[6] = &ffi_type_sint; - cl_arg_types[7] = &ffi_type_sint; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_sint; - cl_arg_types[10] = &ffi_type_sint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_sint; - cl_arg_types[14] = &ffi_type_sint; - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type0)code)) - (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, - 19, 21, 1); - /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 680" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn1.c deleted file mode 100644 index 91231738c13b5240d2ee07b2d416b0738e9dac7a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Area: closure_call. - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - - -static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(float *)args[0] +(int)(*(float *)args[1]) + - (int)(*(float *)args[2]) + (int)*(float *)args[3] + - (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + - (int)*(float *)args[6] + (int)(*(int *)args[7]) + - (int)(*(double*)args[8]) + (int)*(int *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(int *)args[13]) + - (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(float *)args[0], (int)(*(float *)args[1]), - (int)(*(float *)args[2]), (int)*(float *)args[3], - (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), - (int)*(float *)args[6], (int)(*(int *)args[7]), - (int)(*(double *)args[8]), (int)*(int *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(int *)args[13]), - (int)(*(int *)args[14]), *(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); -} - -typedef int (*closure_test_type1)(float, float, float, float, signed short, - float, float, int, double, int, int, float, - int, int, int, int); -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_float; - cl_arg_types[1] = &ffi_type_float; - cl_arg_types[2] = &ffi_type_float; - cl_arg_types[3] = &ffi_type_float; - cl_arg_types[4] = &ffi_type_sshort; - cl_arg_types[5] = &ffi_type_float; - cl_arg_types[6] = &ffi_type_float; - cl_arg_types[7] = &ffi_type_sint; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_sint; - cl_arg_types[10] = &ffi_type_sint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_sint; - cl_arg_types[14] = &ffi_type_sint; - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type1)code)) - (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, - 19, 21, 1); - /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 255" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn2.c deleted file mode 100644 index 08ff9d92274c317162ec862934e7e226564ada56..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn2.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(double *)args[0] +(int)(*(double *)args[1]) + - (int)(*(double *)args[2]) + (int)*(double *)args[3] + - (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) + - (int)*(double *)args[6] + (int)(*(int *)args[7]) + - (int)(*(double *)args[8]) + (int)*(int *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(float *)args[13]) + - (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(double *)args[0], (int)(*(double *)args[1]), - (int)(*(double *)args[2]), (int)*(double *)args[3], - (int)(*(signed short *)args[4]), (int)(*(double *)args[5]), - (int)*(double *)args[6], (int)(*(int *)args[7]), - (int)(*(double*)args[8]), (int)*(int *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(float *)args[13]), - (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, - (int)*(ffi_arg *)resp); -} - -typedef int (*closure_test_type2)(double, double, double, double, signed short, - double, double, int, double, int, int, float, - int, float, int, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_double; - cl_arg_types[1] = &ffi_type_double; - cl_arg_types[2] = &ffi_type_double; - cl_arg_types[3] = &ffi_type_double; - cl_arg_types[4] = &ffi_type_sshort; - cl_arg_types[5] = &ffi_type_double; - cl_arg_types[6] = &ffi_type_double; - cl_arg_types[7] = &ffi_type_sint; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_sint; - cl_arg_types[10] = &ffi_type_sint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_float; - cl_arg_types[14] = &ffi_type_sint; - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type2)code)) - (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, - 19.0, 21, 1); - /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 255" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn3.c deleted file mode 100644 index 9b54d805c8296ad87dd89502dc158284e90a2927..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn3.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) - { - *(ffi_arg*)resp = - (int)*(float *)args[0] +(int)(*(float *)args[1]) + - (int)(*(float *)args[2]) + (int)*(float *)args[3] + - (int)(*(float *)args[4]) + (int)(*(float *)args[5]) + - (int)*(float *)args[6] + (int)(*(float *)args[7]) + - (int)(*(double *)args[8]) + (int)*(int *)args[9] + - (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(float *)args[13]) + - (int)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(float *)args[0], (int)(*(float *)args[1]), - (int)(*(float *)args[2]), (int)*(float *)args[3], - (int)(*(float *)args[4]), (int)(*(float *)args[5]), - (int)*(float *)args[6], (int)(*(float *)args[7]), - (int)(*(double *)args[8]), (int)*(int *)args[9], - (int)(*(float *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(float *)args[13]), - (int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, - (int)*(ffi_arg *)resp); - - } - -typedef int (*closure_test_type3)(float, float, float, float, float, float, - float, float, double, int, float, float, int, - float, float, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_float; - cl_arg_types[1] = &ffi_type_float; - cl_arg_types[2] = &ffi_type_float; - cl_arg_types[3] = &ffi_type_float; - cl_arg_types[4] = &ffi_type_float; - cl_arg_types[5] = &ffi_type_float; - cl_arg_types[6] = &ffi_type_float; - cl_arg_types[7] = &ffi_type_float; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_sint; - cl_arg_types[10] = &ffi_type_float; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_float; - cl_arg_types[14] = &ffi_type_float; - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type3)code)) - (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, - 19.19, 21.21, 1); - /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 135" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn4.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn4.c deleted file mode 100644 index d4a1530b065b21a0cf87a4515cd3ce216b6225db..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn4.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple long long values passing. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20031026 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static void -closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + - (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + - (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + - (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + - (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + - (int)*(unsigned long long *)args[10] + - (int)*(unsigned long long *)args[11] + - (int)*(unsigned long long *)args[12] + - (int)*(unsigned long long *)args[13] + - (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(unsigned long long *)args[0], - (int)*(unsigned long long *)args[1], - (int)*(unsigned long long *)args[2], - (int)*(unsigned long long *)args[3], - (int)*(unsigned long long *)args[4], - (int)*(unsigned long long *)args[5], - (int)*(unsigned long long *)args[6], - (int)*(unsigned long long *)args[7], - (int)*(unsigned long long *)args[8], - (int)*(unsigned long long *)args[9], - (int)*(unsigned long long *)args[10], - (int)*(unsigned long long *)args[11], - (int)*(unsigned long long *)args[12], - (int)*(unsigned long long *)args[13], - (int)*(unsigned long long *)args[14], - *(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); - -} - -typedef int (*closure_test_type0)(unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int i, res; - - for (i = 0; i < 15; i++) { - cl_arg_types[i] = &ffi_type_uint64; - } - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type0)code)) - (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL, - 13LL, 19LL, 21LL, 1); - /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 680" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn5.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn5.c deleted file mode 100644 index 99074426c67b5a65e383b48254ea0b8a8950fdda..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn5.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple long long values passing. - Exceed the limit of gpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20031026 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void -closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + - (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + - (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + - (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + - (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + - (int)*(int *)args[10] + - (int)*(unsigned long long *)args[11] + - (int)*(unsigned long long *)args[12] + - (int)*(unsigned long long *)args[13] + - (int)*(unsigned long long *)args[14] + - *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(unsigned long long *)args[0], - (int)*(unsigned long long *)args[1], - (int)*(unsigned long long *)args[2], - (int)*(unsigned long long *)args[3], - (int)*(unsigned long long *)args[4], - (int)*(unsigned long long *)args[5], - (int)*(unsigned long long *)args[6], - (int)*(unsigned long long *)args[7], - (int)*(unsigned long long *)args[8], - (int)*(unsigned long long *)args[9], - (int)*(int *)args[10], - (int)*(unsigned long long *)args[11], - (int)*(unsigned long long *)args[12], - (int)*(unsigned long long *)args[13], - (int)*(unsigned long long *)args[14], - *(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); - -} - -typedef int (*closure_test_type0)(unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, unsigned long long, - int, unsigned long long, - unsigned long long, unsigned long long, - unsigned long long, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int i, res; - - for (i = 0; i < 10; i++) { - cl_arg_types[i] = &ffi_type_uint64; - } - cl_arg_types[10] = &ffi_type_sint; - for (i = 11; i < 15; i++) { - cl_arg_types[i] = &ffi_type_uint64; - } - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type0)code)) - (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, - 13LL, 19LL, 21LL, 1); - /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 680" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn6.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn6.c deleted file mode 100644 index 73c54fd6b16016846b47c10b6d6d2f69da45f73a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_fn6.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC. - Limitations: none. - PR: PR23404 - Originator: 20050830 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void -closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(unsigned long long *)args[0] + - (int)(*(unsigned long long *)args[1]) + - (int)(*(unsigned long long *)args[2]) + - (int)*(unsigned long long *)args[3] + - (int)(*(int *)args[4]) + (int)(*(double *)args[5]) + - (int)*(double *)args[6] + (int)(*(float *)args[7]) + - (int)(*(double *)args[8]) + (int)*(double *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(int *)args[13]) + - (int)(*(double *)args[14]) + (int)*(double *)args[15] + - (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(unsigned long long *)args[0], - (int)(*(unsigned long long *)args[1]), - (int)(*(unsigned long long *)args[2]), - (int)*(unsigned long long *)args[3], - (int)(*(int *)args[4]), (int)(*(double *)args[5]), - (int)*(double *)args[6], (int)(*(float *)args[7]), - (int)(*(double *)args[8]), (int)*(double *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(int *)args[13]), - (int)(*(double *)args[14]), (int)(*(double *)args[15]), - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); - -} - -typedef int (*closure_test_type0)(unsigned long long, - unsigned long long, - unsigned long long, - unsigned long long, - int, double, double, float, double, double, - int, float, int, int, double, double); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_uint64; - cl_arg_types[1] = &ffi_type_uint64; - cl_arg_types[2] = &ffi_type_uint64; - cl_arg_types[3] = &ffi_type_uint64; - cl_arg_types[4] = &ffi_type_sint; - cl_arg_types[5] = &ffi_type_double; - cl_arg_types[6] = &ffi_type_double; - cl_arg_types[7] = &ffi_type_float; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_double; - cl_arg_types[10] = &ffi_type_sint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_sint; - cl_arg_types[14] = &ffi_type_double; - cl_arg_types[15] = &ffi_type_double; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*((closure_test_type0)code)) - (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13, - 19, 21., 1.); - /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 680" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_loc_fn0.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_loc_fn0.c deleted file mode 100644 index b3afa0bbdfcf9a8ce32568eb298be4ad622509c2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_loc_fn0.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Area: closure_call - Purpose: Check multiple values passing from different type. - Also, exceed the limit of gpr and fpr registers on PowerPC - Darwin. - Limitations: none. - PR: none. - Originator: 20030828 */ - - - - -/* { dg-do run } */ -#include "ffitest.h" - -static void -closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + - (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + - (int)(*(signed short *)args[4]) + - (int)(*(unsigned long long *)args[5]) + - (int)*(int *)args[6] + (int)(*(int *)args[7]) + - (int)(*(double *)args[8]) + (int)*(int *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(int *)args[13]) + - (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), - (int)(*(unsigned long long *)args[2]), - (int)*(int *)args[3], (int)(*(signed short *)args[4]), - (int)(*(unsigned long long *)args[5]), - (int)*(int *)args[6], (int)(*(int *)args[7]), - (int)(*(double *)args[8]), (int)*(int *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(int *)args[13]), - (int)(*(int *)args[14]),*(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); - -} - -typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, - int, signed short, unsigned long long, int, - int, double, int, int, float, int, int, - int, int); - -int main (void) -{ - ffi_cif cif; - ffi_closure *pcl; - ffi_type * cl_arg_types[17]; - int res; - void *codeloc; - - cl_arg_types[0] = &ffi_type_uint64; - cl_arg_types[1] = &ffi_type_sint; - cl_arg_types[2] = &ffi_type_uint64; - cl_arg_types[3] = &ffi_type_sint; - cl_arg_types[4] = &ffi_type_sshort; - cl_arg_types[5] = &ffi_type_uint64; - cl_arg_types[6] = &ffi_type_sint; - cl_arg_types[7] = &ffi_type_sint; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_sint; - cl_arg_types[10] = &ffi_type_sint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_sint; - cl_arg_types[13] = &ffi_type_sint; - cl_arg_types[14] = &ffi_type_sint; - cl_arg_types[15] = &ffi_type_sint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); - CHECK(pcl != NULL); - CHECK(codeloc != NULL); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, - (void *) 3 /* userdata */, codeloc) == FFI_OK); - - CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); - - res = (*((closure_loc_test_type0)codeloc)) - (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, - 19, 21, 1); - /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 680" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_simple.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_simple.c deleted file mode 100644 index 5a4e728d4a42a72ff4d5f1dfdabc35880c44cd9d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/closure_simple.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Area: closure_call - Purpose: Check simple closure handling with all ABIs - Limitations: none. - PR: none. - Originator: */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void -closure_test(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) -{ - *(ffi_arg*)resp = - (int)*(int *)args[0] + (int)(*(int *)args[1]) - + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) - + (int)(intptr_t)userdata; - - printf("%d %d %d %d: %d\n", - (int)*(int *)args[0], (int)(*(int *)args[1]), - (int)(*(int *)args[2]), (int)(*(int *)args[3]), - (int)*(ffi_arg *)resp); - -} - -typedef int (ABI_ATTR *closure_test_type0)(int, int, int, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - - cl_arg_types[0] = &ffi_type_uint; - cl_arg_types[1] = &ffi_type_uint; - cl_arg_types[2] = &ffi_type_uint; - cl_arg_types[3] = &ffi_type_uint; - cl_arg_types[4] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test, - (void *) 3 /* userdata */, code) == FFI_OK); - - res = (*(closure_test_type0)code)(0, 1, 2, 3); - /* { dg-output "0 1 2 3: 9" } */ - - printf("res: %d\n",res); - /* { dg-output "\nres: 9" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_12byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_12byte.c deleted file mode 100644 index ea0825d175a6571e5706505010971bc1ea86bf6a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_12byte.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_12byte { - int a; - int b; - int c; -} cls_struct_12byte; - -cls_struct_12byte cls_struct_12byte_fn(struct cls_struct_12byte b1, - struct cls_struct_12byte b2) -{ - struct cls_struct_12byte result; - - result.a = b1.a + b2.a; - result.b = b1.b + b2.b; - result.c = b1.c + b2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, - result.a, result.b, result.c); - - return result; -} - -static void cls_struct_12byte_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args , void* userdata __UNUSED__) -{ - struct cls_struct_12byte b1, b2; - - b1 = *(struct cls_struct_12byte*)(args[0]); - b2 = *(struct cls_struct_12byte*)(args[1]); - - *(cls_struct_12byte*)resp = cls_struct_12byte_fn(b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_12byte h_dbl = { 7, 4, 9 }; - struct cls_struct_12byte j_dbl = { 1, 5, 3 }; - struct cls_struct_12byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_sint; - cls_struct_fields[1] = &ffi_type_sint; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &h_dbl; - args_dbl[1] = &j_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_12byte_fn), &res_dbl, args_dbl); - /* { dg-output "7 4 9 1 5 3: 8 9 12" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 8 9 12" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK); - - res_dbl.a = 0; - res_dbl.b = 0; - res_dbl.c = 0; - - res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl); - /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 8 9 12" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_16byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_16byte.c deleted file mode 100644 index 89a08a2d97bb1a45a41dede9fab9559ed20bab54..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_16byte.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_16byte { - int a; - double b; - int c; -} cls_struct_16byte; - -cls_struct_16byte cls_struct_16byte_fn(struct cls_struct_16byte b1, - struct cls_struct_16byte b2) -{ - struct cls_struct_16byte result; - - result.a = b1.a + b2.a; - result.b = b1.b + b2.b; - result.c = b1.c + b2.c; - - printf("%d %g %d %d %g %d: %d %g %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, - result.a, result.b, result.c); - - return result; -} - -static void cls_struct_16byte_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - struct cls_struct_16byte b1, b2; - - b1 = *(struct cls_struct_16byte*)(args[0]); - b2 = *(struct cls_struct_16byte*)(args[1]); - - *(cls_struct_16byte*)resp = cls_struct_16byte_fn(b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; - struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; - struct cls_struct_16byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_sint; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &h_dbl; - args_dbl[1] = &j_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_16byte_fn), &res_dbl, args_dbl); - /* { dg-output "7 8 9 1 9 3: 8 17 12" } */ - printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 8 17 12" } */ - - res_dbl.a = 0; - res_dbl.b = 0.0; - res_dbl.c = 0; - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl); - /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */ - printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 8 17 12" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_18byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_18byte.c deleted file mode 100644 index 9f75da80aa05faa5aea74f237ac5c20e6fda0b09..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_18byte.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Double alignment check on darwin. - Limitations: none. - PR: none. - Originator: 20030915 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_18byte { - double a; - unsigned char b; - unsigned char c; - double d; -} cls_struct_18byte; - -cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1, - struct cls_struct_18byte a2) -{ - struct cls_struct_18byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - - - printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d, - a2.a, a2.b, a2.c, a2.d, - result.a, result.b, result.c, result.d); - return result; -} - -static void -cls_struct_18byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_18byte a1, a2; - - a1 = *(struct cls_struct_18byte*)(args[0]); - a2 = *(struct cls_struct_18byte*)(args[1]); - - *(cls_struct_18byte*)resp = cls_struct_18byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[5]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; - struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; - struct cls_struct_18byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_18byte_fn), &res_dbl, args_dbl); - /* { dg-output "1 127 126 3 4 125 124 5: 5 252 250 8" } */ - printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 5 252 250 8" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */ - printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 5 252 250 8" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_19byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_19byte.c deleted file mode 100644 index 278794b5b8773039a5b1d7a9c9ddcc378f98bc27..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_19byte.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Double alignment check on darwin. - Limitations: none. - PR: none. - Originator: 20030915 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_19byte { - double a; - unsigned char b; - unsigned char c; - double d; - unsigned char e; -} cls_struct_19byte; - -cls_struct_19byte cls_struct_19byte_fn(struct cls_struct_19byte a1, - struct cls_struct_19byte a2) -{ - struct cls_struct_19byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - result.e = a1.e + a2.e; - - - printf("%g %d %d %g %d %g %d %d %g %d: %g %d %d %g %d\n", - a1.a, a1.b, a1.c, a1.d, a1.e, - a2.a, a2.b, a2.c, a2.d, a2.e, - result.a, result.b, result.c, result.d, result.e); - return result; -} - -static void -cls_struct_19byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_19byte a1, a2; - - a1 = *(struct cls_struct_19byte*)(args[0]); - a2 = *(struct cls_struct_19byte*)(args[1]); - - *(cls_struct_19byte*)resp = cls_struct_19byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[6]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; - struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; - struct cls_struct_19byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_uchar; - cls_struct_fields[5] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_19byte_fn), &res_dbl, args_dbl); - /* { dg-output "1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ - printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e); - /* { dg-output "\nres: 5 252 250 8 239" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ - printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e); - /* { dg-output "\nres: 5 252 250 8 239" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_1_1byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_1_1byte.c deleted file mode 100644 index 82492c020e2bc8452b6064d5e64a88cfca910609..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_1_1byte.c +++ /dev/null @@ -1,89 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. - Limitations: none. - PR: none. - Originator: 20030902 */ - - - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_1_1byte { - unsigned char a; -} cls_struct_1_1byte; - -cls_struct_1_1byte cls_struct_1_1byte_fn(struct cls_struct_1_1byte a1, - struct cls_struct_1_1byte a2) -{ - struct cls_struct_1_1byte result; - - result.a = a1.a + a2.a; - - printf("%d %d: %d\n", a1.a, a2.a, result.a); - - return result; -} - -static void -cls_struct_1_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_1_1byte a1, a2; - - a1 = *(struct cls_struct_1_1byte*)(args[0]); - a2 = *(struct cls_struct_1_1byte*)(args[1]); - - *(cls_struct_1_1byte*)resp = cls_struct_1_1byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[2]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_1_1byte g_dbl = { 12 }; - struct cls_struct_1_1byte f_dbl = { 178 }; - struct cls_struct_1_1byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_1_1byte_fn), &res_dbl, args_dbl); - /* { dg-output "12 178: 190" } */ - printf("res: %d\n", res_dbl.a); - /* { dg-output "\nres: 190" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 178: 190" } */ - printf("res: %d\n", res_dbl.a); - /* { dg-output "\nres: 190" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte.c deleted file mode 100644 index 3f8bb28ad297cd77709923c824610128cef3fa06..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_20byte { - double a; - double b; - int c; -} cls_struct_20byte; - -cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, - struct cls_struct_20byte a2) -{ - struct cls_struct_20byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, - result.a, result.b, result.c); - return result; -} - -static void -cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_20byte a1, a2; - - a1 = *(struct cls_struct_20byte*)(args[0]); - a2 = *(struct cls_struct_20byte*)(args[1]); - - *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; - struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; - struct cls_struct_20byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); - /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ - printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 5 7 10" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ - printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 5 7 10" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte1.c deleted file mode 100644 index 65627273c84b693415f4a6d43dcbf5cffdf1f513..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_20byte1.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - - - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_20byte { - int a; - double b; - double c; -} cls_struct_20byte; - -cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, - struct cls_struct_20byte a2) -{ - struct cls_struct_20byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %g %g %d %g %g: %d %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, - result.a, result.b, result.c); - return result; -} - -static void -cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_20byte a1, a2; - - a1 = *(struct cls_struct_20byte*)(args[0]); - a2 = *(struct cls_struct_20byte*)(args[1]); - - *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; - struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; - struct cls_struct_20byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_sint; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); - /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ - printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 5 7 10" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ - printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 5 7 10" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_24byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_24byte.c deleted file mode 100644 index 1d82f6e4a45bbc8878fb9eec6a63f91c429fb55c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_24byte.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_24byte { - double a; - double b; - int c; - float d; -} cls_struct_24byte; - -cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0, - struct cls_struct_24byte b1, - struct cls_struct_24byte b2, - struct cls_struct_24byte b3) -{ - struct cls_struct_24byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - - printf("%g %g %d %g %g %g %d %g %g %g %d %g %g %g %d %g: %g %g %d %g\n", - b0.a, b0.b, b0.c, b0.d, - b1.a, b1.b, b1.c, b1.d, - b2.a, b2.b, b2.c, b2.d, - b3.a, b3.b, b3.c, b2.d, - result.a, result.b, result.c, result.d); - - return result; -} - -static void -cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_24byte b0, b1, b2, b3; - - b0 = *(struct cls_struct_24byte*)(args[0]); - b1 = *(struct cls_struct_24byte*)(args[1]); - b2 = *(struct cls_struct_24byte*)(args[2]); - b3 = *(struct cls_struct_24byte*)(args[3]); - - *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; - struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; - struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; - struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; - struct cls_struct_24byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = &ffi_type_float; - cls_struct_fields[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl); - /* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ - printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 22 15 17 25" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, - cls_struct_24byte, - cls_struct_24byte, - cls_struct_24byte)) - (code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ - printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 22 15 17 25" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_2byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_2byte.c deleted file mode 100644 index 81bb0a64a3ee50eeedfcb373b531f7e563a48913..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_2byte.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_2byte { - unsigned char a; - unsigned char b; -} cls_struct_2byte; - -cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1, - struct cls_struct_2byte a2) -{ - struct cls_struct_2byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - - printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); - - return result; -} - -static void -cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_2byte a1, a2; - - a1 = *(struct cls_struct_2byte*)(args[0]); - a2 = *(struct cls_struct_2byte*)(args[1]); - - *(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_2byte g_dbl = { 12, 127 }; - struct cls_struct_2byte f_dbl = { 1, 13 }; - struct cls_struct_2byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl); - /* { dg-output "12 127 1 13: 13 140" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 13 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 127 1 13: 13 140" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 13 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3_1byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3_1byte.c deleted file mode 100644 index b7827466f6ef43b17176c4abd0976f96d3491768..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3_1byte.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. - Limitations: none. - PR: none. - Originator: 20030902 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_3_1byte { - unsigned char a; - unsigned char b; - unsigned char c; -} cls_struct_3_1byte; - -cls_struct_3_1byte cls_struct_3_1byte_fn(struct cls_struct_3_1byte a1, - struct cls_struct_3_1byte a2) -{ - struct cls_struct_3_1byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, - a2.a, a2.b, a2.c, - result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_3_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_3_1byte a1, a2; - - a1 = *(struct cls_struct_3_1byte*)(args[0]); - a2 = *(struct cls_struct_3_1byte*)(args[1]); - - *(cls_struct_3_1byte*)resp = cls_struct_3_1byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; - struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; - struct cls_struct_3_1byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_3_1byte_fn), &res_dbl, args_dbl); - /* { dg-output "12 13 14 178 179 180: 190 192 194" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 190 192 194" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 190 192 194" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte1.c deleted file mode 100644 index a02c463af9f0f36cd81a768bb1c6d05cf3f22460..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_3byte { - unsigned short a; - unsigned char b; -} cls_struct_3byte; - -cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1, - struct cls_struct_3byte a2) -{ - struct cls_struct_3byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - - printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); - - return result; -} - -static void -cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_3byte a1, a2; - - a1 = *(struct cls_struct_3byte*)(args[0]); - a2 = *(struct cls_struct_3byte*)(args[1]); - - *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_3byte g_dbl = { 12, 119 }; - struct cls_struct_3byte f_dbl = { 1, 15 }; - struct cls_struct_3byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_ushort; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_3byte_fn), &res_dbl, args_dbl); - /* { dg-output "12 119 1 15: 13 134" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 13 134" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 119 1 15: 13 134" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 13 134" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte2.c deleted file mode 100644 index c7251cead60308e21e2f889f92ba603bdee30fe8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_3byte2.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_3byte_1 { - unsigned char a; - unsigned short b; -} cls_struct_3byte_1; - -cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1, - struct cls_struct_3byte_1 a2) -{ - struct cls_struct_3byte_1 result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - - printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); - - return result; -} - -static void -cls_struct_3byte_gn1(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_3byte_1 a1, a2; - - a1 = *(struct cls_struct_3byte_1*)(args[0]); - a2 = *(struct cls_struct_3byte_1*)(args[1]); - - *(cls_struct_3byte_1*)resp = cls_struct_3byte_fn1(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_3byte_1 g_dbl = { 15, 125 }; - struct cls_struct_3byte_1 f_dbl = { 9, 19 }; - struct cls_struct_3byte_1 res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_3byte_fn1), &res_dbl, args_dbl); - /* { dg-output "15 125 9 19: 24 144" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 24 144" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl); - /* { dg-output "\n15 125 9 19: 24 144" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 24 144" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4_1byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4_1byte.c deleted file mode 100644 index 2d6d8b622c3734c3b68c2a89294c1f5020294fae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4_1byte.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Especially with small structures which may fit in one - register. Depending on the ABI. - Limitations: none. - PR: none. - Originator: 20030902 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_4_1byte { - unsigned char a; - unsigned char b; - unsigned char c; - unsigned char d; -} cls_struct_4_1byte; - -cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1, - struct cls_struct_4_1byte a2) -{ - struct cls_struct_4_1byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - - printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, - a2.a, a2.b, a2.c, a2.d, - result.a, result.b, result.c, result.d); - - return result; -} - -static void -cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_4_1byte a1, a2; - - a1 = *(struct cls_struct_4_1byte*)(args[0]); - a2 = *(struct cls_struct_4_1byte*)(args[1]); - - *(cls_struct_4_1byte*)resp = cls_struct_4_1byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; - struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; - struct cls_struct_4_1byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_uchar; - cls_struct_fields[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_4_1byte_fn), &res_dbl, args_dbl); - /* { dg-output "12 13 14 15 178 179 180 181: 190 192 194 196" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 190 192 194 196" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 190 192 194 196" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4byte.c deleted file mode 100644 index 4ac378776b5cd1ea6792b2ffdda31fb0549a0430..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_4byte.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -typedef struct cls_struct_4byte { - unsigned short a; - unsigned short b; -} cls_struct_4byte; - -cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1, - struct cls_struct_4byte a2) -{ - struct cls_struct_4byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - - printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); - - return result; -} - -static void -cls_struct_4byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_4byte a1, a2; - - a1 = *(struct cls_struct_4byte*)(args[0]); - a2 = *(struct cls_struct_4byte*)(args[1]); - - *(cls_struct_4byte*)resp = cls_struct_4byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_4byte g_dbl = { 127, 120 }; - struct cls_struct_4byte f_dbl = { 12, 128 }; - struct cls_struct_4byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_ushort; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_4byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 12 128: 139 248" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 139 248" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 12 128: 139 248" } */ - printf("res: %d %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 139 248" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5_1_byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5_1_byte.c deleted file mode 100644 index ad9d51c248c2da4f3ee010b8e5df770e38f91dfb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5_1_byte.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20050708 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_5byte { - unsigned char a; - unsigned char b; - unsigned char c; - unsigned char d; - unsigned char e; -} cls_struct_5byte; - -cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, - struct cls_struct_5byte a2) -{ - struct cls_struct_5byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - result.e = a1.e + a2.e; - - printf("%d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d\n", - a1.a, a1.b, a1.c, a1.d, a1.e, - a2.a, a2.b, a2.c, a2.d, a2.e, - result.a, result.b, result.c, result.d, result.e); - - return result; -} - -static void -cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_5byte a1, a2; - - a1 = *(struct cls_struct_5byte*)(args[0]); - a2 = *(struct cls_struct_5byte*)(args[1]); - - *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[6]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_uchar; - cls_struct_fields[4] = &ffi_type_uchar; - cls_struct_fields[5] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ - printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e); - /* { dg-output "\nres: 139 248 10 6 8" } */ - - res_dbl.a = 0; - res_dbl.b = 0; - res_dbl.c = 0; - res_dbl.d = 0; - res_dbl.e = 0; - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ - printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e); - /* { dg-output "\nres: 139 248 10 6 8" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5byte.c deleted file mode 100644 index 4e0c0003c0aa5878c0bc327544bb279d7b5b94ed..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_5byte.c +++ /dev/null @@ -1,98 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_5byte { - unsigned short a; - unsigned short b; - unsigned char c; -} cls_struct_5byte; - -cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, - struct cls_struct_5byte a2) -{ - struct cls_struct_5byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, - a2.a, a2.b, a2.c, - result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_5byte a1, a2; - - a1 = *(struct cls_struct_5byte*)(args[0]); - a2 = *(struct cls_struct_5byte*)(args[1]); - - *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_5byte g_dbl = { 127, 120, 1 }; - struct cls_struct_5byte f_dbl = { 12, 128, 9 }; - struct cls_struct_5byte res_dbl = { 0, 0, 0 }; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_ushort; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 12 128 9: 139 248 10" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 139 248 10" } */ - - res_dbl.a = 0; - res_dbl.b = 0; - res_dbl.c = 0; - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 139 248 10" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_64byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_64byte.c deleted file mode 100644 index a55edc2c7b9df3e70689730920fab6dc03400074..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_64byte.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check bigger struct which overlaps - the gp and fp register count on Darwin/AIX/ppc64. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_64byte { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; -} cls_struct_64byte; - -cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, - struct cls_struct_64byte b1, - struct cls_struct_64byte b2, - struct cls_struct_64byte b3) -{ - struct cls_struct_64byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - result.e = b0.e + b1.e + b2.e + b3.e; - result.f = b0.f + b1.f + b2.f + b3.f; - result.g = b0.g + b1.g + b2.g + b3.g; - result.h = b0.h + b1.h + b2.h + b3.h; - - printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, - result.d, result.e, result.f, result.g, result.h); - - return result; -} - -static void -cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_64byte b0, b1, b2, b3; - - b0 = *(struct cls_struct_64byte*)(args[0]); - b1 = *(struct cls_struct_64byte*)(args[1]); - b2 = *(struct cls_struct_64byte*)(args[2]); - b3 = *(struct cls_struct_64byte*)(args[3]); - - *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[9]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; - struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; - struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; - struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; - struct cls_struct_64byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_double; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_double; - cls_struct_fields[7] = &ffi_type_double; - cls_struct_fields[8] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); - /* { dg-output "22 15 17 25 6 13 19 18" } */ - printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, - cls_struct_64byte, - cls_struct_64byte, - cls_struct_64byte)) - (code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n22 15 17 25 6 13 19 18" } */ - printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6_1_byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6_1_byte.c deleted file mode 100644 index b4dcdba47283f770454bf10f806980e7bb6b9fef..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6_1_byte.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20050708 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_6byte { - unsigned char a; - unsigned char b; - unsigned char c; - unsigned char d; - unsigned char e; - unsigned char f; -} cls_struct_6byte; - -cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, - struct cls_struct_6byte a2) -{ - struct cls_struct_6byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - result.e = a1.e + a2.e; - result.f = a1.f + a2.f; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d\n", - a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, - a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, - result.a, result.b, result.c, result.d, result.e, result.f); - - return result; -} - -static void -cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_6byte a1, a2; - - a1 = *(struct cls_struct_6byte*)(args[0]); - a2 = *(struct cls_struct_6byte*)(args[1]); - - *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[7]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; - struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_uchar; - cls_struct_fields[4] = &ffi_type_uchar; - cls_struct_fields[5] = &ffi_type_uchar; - cls_struct_fields[6] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ - printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f); - /* { dg-output "\nres: 139 248 10 6 8 10" } */ - - res_dbl.a = 0; - res_dbl.b = 0; - res_dbl.c = 0; - res_dbl.d = 0; - res_dbl.e = 0; - res_dbl.f = 0; - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ - printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f); - /* { dg-output "\nres: 139 248 10 6 8 10" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6byte.c deleted file mode 100644 index 740678017b3a021fd11a330eb7adc0e491d8209b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_6byte.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_6byte { - unsigned short a; - unsigned short b; - unsigned char c; - unsigned char d; -} cls_struct_6byte; - -cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, - struct cls_struct_6byte a2) -{ - struct cls_struct_6byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - - printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, - a2.a, a2.b, a2.c, a2.d, - result.a, result.b, result.c, result.d); - - return result; -} - -static void -cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_6byte a1, a2; - - a1 = *(struct cls_struct_6byte*)(args[0]); - a2 = *(struct cls_struct_6byte*)(args[1]); - - *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; - struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; - struct cls_struct_6byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_ushort; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_uchar; - cls_struct_fields[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 128 12 128 9 127: 139 248 10 255" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 139 248 10 255" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 139 248 10 255" } */ - - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7_1_byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7_1_byte.c deleted file mode 100644 index 14a7e96f9d6569b4f94247297ab58ba6e6a1a6da..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7_1_byte.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20050708 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_7byte { - unsigned char a; - unsigned char b; - unsigned char c; - unsigned char d; - unsigned char e; - unsigned char f; - unsigned char g; -} cls_struct_7byte; - -cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, - struct cls_struct_7byte a2) -{ - struct cls_struct_7byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - result.e = a1.e + a2.e; - result.f = a1.f + a2.f; - result.g = a1.g + a2.g; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d %d\n", - a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, - a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, - result.a, result.b, result.c, result.d, result.e, result.f, result.g); - - return result; -} - -static void -cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_7byte a1, a2; - - a1 = *(struct cls_struct_7byte*)(args[0]); - a2 = *(struct cls_struct_7byte*)(args[1]); - - *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[8]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; - struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_uchar; - cls_struct_fields[4] = &ffi_type_uchar; - cls_struct_fields[5] = &ffi_type_uchar; - cls_struct_fields[6] = &ffi_type_uchar; - cls_struct_fields[7] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ - printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ - - res_dbl.a = 0; - res_dbl.b = 0; - res_dbl.c = 0; - res_dbl.d = 0; - res_dbl.e = 0; - res_dbl.f = 0; - res_dbl.g = 0; - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ - printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7byte.c deleted file mode 100644 index 1645cc635f9afb6410c650bb68f2a066e7cee391..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_7byte.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_7byte { - unsigned short a; - unsigned short b; - unsigned char c; - unsigned short d; -} cls_struct_7byte; - -cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, - struct cls_struct_7byte a2) -{ - struct cls_struct_7byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - result.d = a1.d + a2.d; - - printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, - a2.a, a2.b, a2.c, a2.d, - result.a, result.b, result.c, result.d); - - return result; -} - -static void -cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_7byte a1, a2; - - a1 = *(struct cls_struct_7byte*)(args[0]); - a2 = *(struct cls_struct_7byte*)(args[1]); - - *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; - struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; - struct cls_struct_7byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_ushort; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = &ffi_type_ushort; - cls_struct_fields[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); - /* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 139 248 10 509" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */ - printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); - /* { dg-output "\nres: 139 248 10 509" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_8byte.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_8byte.c deleted file mode 100644 index f6c1ea570ac8638227b2e8541bc42f7f8ef71506..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_8byte.c +++ /dev/null @@ -1,88 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Check overlapping. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_8byte { - int a; - float b; -} cls_struct_8byte; - -cls_struct_8byte cls_struct_8byte_fn(struct cls_struct_8byte a1, - struct cls_struct_8byte a2) -{ - struct cls_struct_8byte result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - - printf("%d %g %d %g: %d %g\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); - - return result; -} - -static void -cls_struct_8byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_8byte a1, a2; - - a1 = *(struct cls_struct_8byte*)(args[0]); - a2 = *(struct cls_struct_8byte*)(args[1]); - - *(cls_struct_8byte*)resp = cls_struct_8byte_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_8byte g_dbl = { 1, 2.0 }; - struct cls_struct_8byte f_dbl = { 4, 5.0 }; - struct cls_struct_8byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_sint; - cls_struct_fields[1] = &ffi_type_float; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_8byte_fn), &res_dbl, args_dbl); - /* { dg-output "1 2 4 5: 5 7" } */ - printf("res: %d %g\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 5 7" } */ - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 2 4 5: 5 7" } */ - printf("res: %d %g\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 5 7" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte1.c deleted file mode 100644 index 0b8572223c9c5e5f6d8e2179535647c52916a28e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Darwin/AIX do double-word - alignment of the struct if the first element is a double. - Check that it does not here. - Limitations: none. - PR: none. - Originator: 20030914 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_9byte { - int a; - double b; -} cls_struct_9byte; - -cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, - struct cls_struct_9byte b2) -{ - struct cls_struct_9byte result; - - result.a = b1.a + b2.a; - result.b = b1.b + b2.b; - - printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b, - result.a, result.b); - - return result; -} - -static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - struct cls_struct_9byte b1, b2; - - b1 = *(struct cls_struct_9byte*)(args[0]); - b2 = *(struct cls_struct_9byte*)(args[1]); - - *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_9byte h_dbl = { 7, 8.0}; - struct cls_struct_9byte j_dbl = { 1, 9.0}; - struct cls_struct_9byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_sint; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &h_dbl; - args_dbl[1] = &j_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); - /* { dg-output "7 8 1 9: 8 17" } */ - printf("res: %d %g\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 8 17" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); - /* { dg-output "\n7 8 1 9: 8 17" } */ - printf("res: %d %g\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 8 17" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte2.c deleted file mode 100644 index edf991de73eefcbf379294528ecb8727ff19b0f9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_9byte2.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Depending on the ABI. Darwin/AIX do double-word - alignment of the struct if the first element is a double. - Check that it does here. - Limitations: none. - PR: none. - Originator: 20030914 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_9byte { - double a; - int b; -} cls_struct_9byte; - -cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, - struct cls_struct_9byte b2) -{ - struct cls_struct_9byte result; - - result.a = b1.a + b2.a; - result.b = b1.b + b2.b; - - printf("%g %d %g %d: %g %d\n", b1.a, b1.b, b2.a, b2.b, - result.a, result.b); - - return result; -} - -static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - struct cls_struct_9byte b1, b2; - - b1 = *(struct cls_struct_9byte*)(args[0]); - b2 = *(struct cls_struct_9byte*)(args[1]); - - *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_9byte h_dbl = { 7.0, 8}; - struct cls_struct_9byte j_dbl = { 1.0, 9}; - struct cls_struct_9byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_sint; - cls_struct_fields[2] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &h_dbl; - args_dbl[1] = &j_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); - /* { dg-output "7 8 1 9: 8 17" } */ - printf("res: %g %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 8 17" } */ - - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); - /* { dg-output "\n7 8 1 9: 8 17" } */ - printf("res: %g %d\n", res_dbl.a, res_dbl.b); - /* { dg-output "\nres: 8 17" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_double.c deleted file mode 100644 index aad5f3ced6a038aa1b8e93b8f27f0dea350b534f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_double.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of double. - Limitations: none. - PR: none. - Originator: 20031203 */ - - - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - double b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_float.c deleted file mode 100644 index 37e085529e7a08314effe15244faf38b8ddfac78..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_float.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of float. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - float b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_float; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble.c deleted file mode 100644 index b3322d8615136813f541c3f051fbfc4c3803c328..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of long double. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - long double b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_longdouble; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split.c deleted file mode 100644 index cc1c43b8ca45a857b3287c8be9a9858457143b29..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of long double. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ - -#include "ffitest.h" - -typedef struct cls_struct_align { - long double a; - long double b; - long double c; - long double d; - long double e; - long double f; - long double g; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn( - cls_struct_align a1, - cls_struct_align a2) -{ - struct cls_struct_align r; - - r.a = a1.a + a2.a; - r.b = a1.b + a2.b; - r.c = a1.c + a2.c; - r.d = a1.d + a2.d; - r.e = a1.e + a2.e; - r.f = a1.f + a2.f; - r.g = a1.g + a2.g; - - printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " - "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", - a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, - a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, - r.a, r.b, r.c, r.d, r.e, r.f, r.g); - - return r; -} - -cls_struct_align cls_struct_align_fn2( - cls_struct_align a1) -{ - struct cls_struct_align r; - - r.a = a1.a + 1; - r.b = a1.b + 1; - r.c = a1.c + 1; - r.d = a1.d + 1; - r.e = a1.e + 1; - r.f = a1.f + 1; - r.g = a1.g + 1; - - printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " - "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", - a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, - r.a, r.b, r.c, r.d, r.e, r.f, r.g); - - return r; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[8]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_longdouble; - cls_struct_fields[1] = &ffi_type_longdouble; - cls_struct_fields[2] = &ffi_type_longdouble; - cls_struct_fields[3] = &ffi_type_longdouble; - cls_struct_fields[4] = &ffi_type_longdouble; - cls_struct_fields[5] = &ffi_type_longdouble; - cls_struct_fields[6] = &ffi_type_longdouble; - cls_struct_fields[7] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ - printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ - printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c deleted file mode 100644 index 5d3bec071968701c32f2b24c5ed937166a3940d6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of long double. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/18/2007 -*/ - -/* { dg-do run { xfail strongarm*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ - -#include "ffitest.h" - -typedef struct cls_struct_align { - long double a; - long double b; - long double c; - long double d; - long double e; - double f; - long double g; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn( - cls_struct_align a1, - cls_struct_align a2) -{ - struct cls_struct_align r; - - r.a = a1.a + a2.a; - r.b = a1.b + a2.b; - r.c = a1.c + a2.c; - r.d = a1.d + a2.d; - r.e = a1.e + a2.e; - r.f = a1.f + a2.f; - r.g = a1.g + a2.g; - - printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " - "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", - a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, - a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, - r.a, r.b, r.c, r.d, r.e, r.f, r.g); - - return r; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[8]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[3]; - - struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; - struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_longdouble; - cls_struct_fields[1] = &ffi_type_longdouble; - cls_struct_fields[2] = &ffi_type_longdouble; - cls_struct_fields[3] = &ffi_type_longdouble; - cls_struct_fields[4] = &ffi_type_longdouble; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_longdouble; - cls_struct_fields[7] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ - printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ - printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); - /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ - - exit(0); -} - - - diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_pointer.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_pointer.c deleted file mode 100644 index 8fbf36a5c1151513c0eb6faa0d71da6b2d32692c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_pointer.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of pointer. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - void *b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); - result.c = a1.c + a2.c; - - printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", - a1.a, (uintptr_t)a1.b, a1.c, - a2.a, (uintptr_t)a2.b, a2.c, - result.a, (uintptr_t)result.b, - result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; - struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_pointer; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint16.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint16.c deleted file mode 100644 index 039b874732005140eea0cb02f941b04f9972cfc6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint16.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of sint16. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - signed short b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_sshort; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint32.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint32.c deleted file mode 100644 index c96c6d136df1bba986759d2804edba9d1ccd698a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint32.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of sint32. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - signed int b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_sint; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint64.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint64.c deleted file mode 100644 index 9aa7bdddff7a5fee1e98917c6629143cdb0b3def..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_sint64.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of sint64. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - signed long long b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_sint64; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint16.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint16.c deleted file mode 100644 index 97620b79d1fbec68d434a018453ab8db62aa723f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint16.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of uint16. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - unsigned short b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_ushort; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint32.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint32.c deleted file mode 100644 index 5766fadf0dc9b53934194558b7d7559830482693..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint32.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of uint32. - Limitations: none. - PR: none. - Originator: 20031203 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - unsigned int b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uint; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint64.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint64.c deleted file mode 100644 index a52cb8939c4fa161b383628a8d72e6b8fdd6a64e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_align_uint64.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of uint64. - Limitations: none. - PR: none. - Originator: 20031203 */ - - -/* { dg-do run } */ -/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ -#include "ffitest.h" - -typedef struct cls_struct_align { - unsigned char a; - unsigned long long b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, - struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_align g_dbl = { 12, 4951, 127 }; - struct cls_struct_align f_dbl = { 1, 9320, 13 }; - struct cls_struct_align res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uint64; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &g_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); - /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); - /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ - printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); - /* { dg-output "\nres: 13 14271 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_dbls_struct.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_dbls_struct.c deleted file mode 100644 index d6637911e584f9c11dce73d69e7d3da0811d800e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_dbls_struct.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check double arguments in structs. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/23/2007 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -typedef struct Dbls { - double x; - double y; -} Dbls; - -void -closure_test_fn(Dbls p) -{ - printf("%.1f %.1f\n", p.x, p.y); -} - -void -closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, - void** args, void* userdata __UNUSED__) -{ - closure_test_fn(*(Dbls*)args[0]); -} - -int main(int argc __UNUSED__, char** argv __UNUSED__) -{ - ffi_cif cif; - - void *code; - ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type* cl_arg_types[1]; - - ffi_type ts1_type; - ffi_type* ts1_type_elements[4]; - - Dbls arg = { 1.0, 2.0 }; - - ts1_type.size = 0; - ts1_type.alignment = 0; - ts1_type.type = FFI_TYPE_STRUCT; - ts1_type.elements = ts1_type_elements; - - ts1_type_elements[0] = &ffi_type_double; - ts1_type_elements[1] = &ffi_type_double; - ts1_type_elements[2] = NULL; - - cl_arg_types[0] = &ts1_type; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_void, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); - - ((void*(*)(Dbls))(code))(arg); - /* { dg-output "1.0 2.0\n" } */ - - closure_test_fn(arg); - /* { dg-output "1.0 2.0\n" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double.c deleted file mode 100644 index 84ad4cb7d925b69d238bd129ee3601c36a6c547b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Area: closure_call - Purpose: Check return value double. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(double *)resp = *(double *)args[0]; - - printf("%f: %f\n",*(double *)args[0], - *(double *)resp); - } -typedef double (*cls_ret_double)(double); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - double res; - - cl_arg_types[0] = &ffi_type_double; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_double, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_double)code))(21474.789); - /* { dg-output "21474.789000: 21474.789000" } */ - printf("res: %.6f\n", res); - /* { dg-output "\nres: 21474.789000" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double_va.c deleted file mode 100644 index e077f92b8638398efdf87211f0ef5af26c8978cc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_double_va.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test doubles passed in variable argument lists. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-output "" { xfail avr32*-*-* } } */ -/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ - -#include "ffitest.h" - -static void -cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - char* format = *(char**)args[0]; - double doubleValue = *(double*)args[1]; - - *(ffi_arg*)resp = printf(format, doubleValue); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[3]; - ffi_type* arg_types[3]; - - char* format = "%.1f\n"; - double doubleArg = 7; - ffi_arg res = 0; - - arg_types[0] = &ffi_type_pointer; - arg_types[1] = &ffi_type_double; - arg_types[2] = NULL; - - /* This printf call is variadic */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, - arg_types) == FFI_OK); - - args[0] = &format; - args[1] = &doubleArg; - args[2] = NULL; - - ffi_call(&cif, FFI_FN(printf), &res, args); - /* { dg-output "7.0" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 4" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, - code) == FFI_OK); - - res = ((int(*)(char*, ...))(code))(format, doubleArg); - /* { dg-output "\n7.0" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 4" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_float.c deleted file mode 100644 index 0090fed9063174d0e2e2412280e9841b4ecc86ae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_float.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: closure_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(float *)resp = *(float *)args[0]; - - printf("%g: %g\n",*(float *)args[0], - *(float *)resp); - } - -typedef float (*cls_ret_float)(float); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - float res; - - cl_arg_types[0] = &ffi_type_float; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_float, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); - res = ((((cls_ret_float)code)(-2122.12))); - /* { dg-output "\\-2122.12: \\-2122.12" } */ - printf("res: %.6f\n", res); - /* { dg-output "\nres: \-2122.120117" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble.c deleted file mode 100644 index d24e72e4aed3c48b73a1acc53e4220c523e3b682..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check long double arguments. - Limitations: none. - PR: none. - Originator: Blake Chaffin */ - -/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have - remove the xfail for arm*-*-* below, until we know more. */ -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ - -#include "ffitest.h" - -long double cls_ldouble_fn( - long double a1, - long double a2, - long double a3, - long double a4, - long double a5, - long double a6, - long double a7, - long double a8) -{ - long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; - - printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", - a1, a2, a3, a4, a5, a6, a7, a8, r); - - return r; -} - -static void -cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - long double a1 = *(long double*)args[0]; - long double a2 = *(long double*)args[1]; - long double a3 = *(long double*)args[2]; - long double a4 = *(long double*)args[3]; - long double a5 = *(long double*)args[4]; - long double a6 = *(long double*)args[5]; - long double a7 = *(long double*)args[6]; - long double a8 = *(long double*)args[7]; - - *(long double*)resp = cls_ldouble_fn( - a1, a2, a3, a4, a5, a6, a7, a8); -} - -int main(void) -{ - ffi_cif cif; - void* code; - ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[9]; - ffi_type* arg_types[9]; - long double res = 0; - - long double arg1 = 1; - long double arg2 = 2; - long double arg3 = 3; - long double arg4 = 4; - long double arg5 = 5; - long double arg6 = 6; - long double arg7 = 7; - long double arg8 = 8; - - arg_types[0] = &ffi_type_longdouble; - arg_types[1] = &ffi_type_longdouble; - arg_types[2] = &ffi_type_longdouble; - arg_types[3] = &ffi_type_longdouble; - arg_types[4] = &ffi_type_longdouble; - arg_types[5] = &ffi_type_longdouble; - arg_types[6] = &ffi_type_longdouble; - arg_types[7] = &ffi_type_longdouble; - arg_types[8] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, - arg_types) == FFI_OK); - - args[0] = &arg1; - args[1] = &arg2; - args[2] = &arg3; - args[3] = &arg4; - args[4] = &arg5; - args[5] = &arg6; - args[6] = &arg7; - args[7] = &arg8; - args[8] = NULL; - - ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); - /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ - printf("res: %Lg\n", res); - /* { dg-output "\nres: 36" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK); - - res = ((long double(*)(long double, long double, long double, long double, - long double, long double, long double, long double))(code))(arg1, arg2, - arg3, arg4, arg5, arg6, arg7, arg8); - /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ - printf("res: %Lg\n", res); - /* { dg-output "\nres: 36" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble_va.c deleted file mode 100644 index 39b438b289a85e4c8b24cde34c29ef42b895e5dd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_longdouble_va.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test long doubles passed in variable argument lists. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ -/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ - -#include "ffitest.h" - -static void -cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - char* format = *(char**)args[0]; - long double ldValue = *(long double*)args[1]; - - *(ffi_arg*)resp = printf(format, ldValue); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[3]; - ffi_type* arg_types[3]; - - char* format = "%.1Lf\n"; - long double ldArg = 7; - ffi_arg res = 0; - - arg_types[0] = &ffi_type_pointer; - arg_types[1] = &ffi_type_longdouble; - arg_types[2] = NULL; - - /* This printf call is variadic */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, &ffi_type_sint, - arg_types) == FFI_OK); - - args[0] = &format; - args[1] = &ldArg; - args[2] = NULL; - - ffi_call(&cif, FFI_FN(printf), &res, args); - /* { dg-output "7.0" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 4" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, - code) == FFI_OK); - - res = ((int(*)(char*, ...))(code))(format, ldArg); - /* { dg-output "\n7.0" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 4" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_args.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_args.c deleted file mode 100644 index 7fd6c8207ac756dd7c5583be805d5b8d6b358b15..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_args.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Area: closure_call - Purpose: Check closures called with many args of mixed types - Limitations: none. - PR: none. - Originator: */ - -/* { dg-do run } */ -#include "ffitest.h" -#include -#include - -#define NARGS 16 - -static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - int i; - double r = 0; - double t; - for(i = 0; i < NARGS; i++) - { - if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15) - { - t = *(long int *)args[i]; - CHECK(t == i+1); - } - else - { - t = *(double *)args[i]; - CHECK(fabs(t - ((i+1) * 0.1)) < FLT_EPSILON); - } - r += t; - } - *(double *)resp = r; -} -typedef double (*cls_ret_double)(double, double, double, double, long int, -double, double, double, double, long int, double, long int, double, long int, -double, long int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[NARGS]; - double res; - int i; - double expected = 64.9; - - for(i = 0; i < NARGS; i++) - { - if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15) - cl_arg_types[i] = &ffi_type_slong; - else - cl_arg_types[i] = &ffi_type_double; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NARGS, - &ffi_type_double, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); - - res = (((cls_ret_double)code))(0.1, 0.2, 0.3, 0.4, 5, 0.6, 0.7, 0.8, 0.9, 10, - 1.1, 12, 1.3, 14, 1.5, 16); - if (fabs(res - expected) < FLT_EPSILON) - exit(0); - else - abort(); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c deleted file mode 100644 index 62b0697ac01c9b7009744478dcc25f4ad03d939a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Area: closure_call - Purpose: Check register allocation for closure calls with many float and double arguments - Limitations: none. - PR: none. - Originator: */ - -/* { dg-do run } */ -#include "ffitest.h" -#include -#include - -#define NARGS 16 - -static void cls_mixed_float_double_fn(ffi_cif* cif , void* ret, void** args, - void* userdata __UNUSED__) -{ - double r = 0; - unsigned int i; - double t; - for(i=0; i < cif->nargs; i++) - { - if(cif->arg_types[i] == &ffi_type_double) { - t = *(((double**)(args))[i]); - } else { - t = *(((float**)(args))[i]); - } - r += t; - } - *((double*)ret) = r; -} -typedef double (*cls_mixed)(double, float, double, double, double, double, double, float, float, double, float, float); - -int main (void) -{ - ffi_cif cif; - ffi_closure *closure; - void* code; - ffi_type *argtypes[12] = {&ffi_type_double, &ffi_type_float, &ffi_type_double, - &ffi_type_double, &ffi_type_double, &ffi_type_double, - &ffi_type_double, &ffi_type_float, &ffi_type_float, - &ffi_type_double, &ffi_type_float, &ffi_type_float}; - - - closure = ffi_closure_alloc(sizeof(ffi_closure), (void**)&code); - if(closure ==NULL) - abort(); - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 12, &ffi_type_double, argtypes) == FFI_OK); - CHECK(ffi_prep_closure_loc(closure, &cif, cls_mixed_float_double_fn, NULL, code) == FFI_OK); - double ret = ((cls_mixed)code)(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2); - ffi_closure_free(closure); - if(fabs(ret - 7.8) < FLT_EPSILON) - exit(0); - else - abort(); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_schar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_schar.c deleted file mode 100644 index 71df7b6516e657cee68bcc430d36cbd75f1c17fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_schar.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple signed char values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -signed char test_func_fn(signed char a1, signed char a2) -{ - signed char result; - - result = a1 + a2; - - printf("%d %d: %d\n", a1, a2, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - signed char a1, a2; - - a1 = *(signed char *)avals[0]; - a2 = *(signed char *)avals[1]; - - *(ffi_arg *)rval = test_func_fn(a1, a2); - -} - -typedef signed char (*test_type)(signed char, signed char); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[3]; - ffi_type * cl_arg_types[3]; - ffi_arg res_call; - signed char a, b, res_closure; - - a = 2; - b = 125; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = NULL; - - cl_arg_types[0] = &ffi_type_schar; - cl_arg_types[1] = &ffi_type_schar; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_schar, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "2 125: 127" } */ - printf("res: %d\n", (signed char)res_call); - /* { dg-output "\nres: 127" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(2, 125); - /* { dg-output "\n2 125: 127" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 127" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshort.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshort.c deleted file mode 100644 index 4c39153266765ca91376f1c899fcc4e0d7a4dd17..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshort.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple signed short values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -signed short test_func_fn(signed short a1, signed short a2) -{ - signed short result; - - result = a1 + a2; - - printf("%d %d: %d\n", a1, a2, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - signed short a1, a2; - - a1 = *(signed short *)avals[0]; - a2 = *(signed short *)avals[1]; - - *(ffi_arg *)rval = test_func_fn(a1, a2); - -} - -typedef signed short (*test_type)(signed short, signed short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[3]; - ffi_type * cl_arg_types[3]; - ffi_arg res_call; - unsigned short a, b, res_closure; - - a = 2; - b = 32765; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = NULL; - - cl_arg_types[0] = &ffi_type_sshort; - cl_arg_types[1] = &ffi_type_sshort; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_sshort, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "2 32765: 32767" } */ - printf("res: %d\n", (unsigned short)res_call); - /* { dg-output "\nres: 32767" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(2, 32765); - /* { dg-output "\n2 32765: 32767" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 32767" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshortchar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshortchar.c deleted file mode 100644 index 1c3aeb5a66c157292dd1c87af44a9b938b3be3a0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_sshortchar.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple signed short/char values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -signed short test_func_fn(signed char a1, signed short a2, - signed char a3, signed short a4) -{ - signed short result; - - result = a1 + a2 + a3 + a4; - - printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - signed char a1, a3; - signed short a2, a4; - - a1 = *(signed char *)avals[0]; - a2 = *(signed short *)avals[1]; - a3 = *(signed char *)avals[2]; - a4 = *(signed short *)avals[3]; - - *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); - -} - -typedef signed short (*test_type)(signed char, signed short, - signed char, signed short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[5]; - ffi_type * cl_arg_types[5]; - ffi_arg res_call; - signed char a, c; - signed short b, d, res_closure; - - a = 1; - b = 32765; - c = 127; - d = -128; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = &c; - args_dbl[3] = &d; - args_dbl[4] = NULL; - - cl_arg_types[0] = &ffi_type_schar; - cl_arg_types[1] = &ffi_type_sshort; - cl_arg_types[2] = &ffi_type_schar; - cl_arg_types[3] = &ffi_type_sshort; - cl_arg_types[4] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_sshort, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "1 32765 127 -128: 32765" } */ - printf("res: %d\n", (signed short)res_call); - /* { dg-output "\nres: 32765" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(1, 32765, 127, -128); - /* { dg-output "\n1 32765 127 -128: 32765" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 32765" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_uchar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_uchar.c deleted file mode 100644 index 009c02c72ba5360c95122443520595194be3cbb0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_uchar.c +++ /dev/null @@ -1,91 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple unsigned char values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -unsigned char test_func_fn(unsigned char a1, unsigned char a2, - unsigned char a3, unsigned char a4) -{ - unsigned char result; - - result = a1 + a2 + a3 + a4; - - printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - unsigned char a1, a2, a3, a4; - - a1 = *(unsigned char *)avals[0]; - a2 = *(unsigned char *)avals[1]; - a3 = *(unsigned char *)avals[2]; - a4 = *(unsigned char *)avals[3]; - - *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); - -} - -typedef unsigned char (*test_type)(unsigned char, unsigned char, - unsigned char, unsigned char); - -void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals, - void *data __UNUSED__) -{ - printf("%d %d %d %d\n", *(unsigned char *)avals[0], - *(unsigned char *)avals[1], *(unsigned char *)avals[2], - *(unsigned char *)avals[3]); -} -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[5]; - ffi_type * cl_arg_types[5]; - ffi_arg res_call; - unsigned char a, b, c, d, res_closure; - - a = 1; - b = 2; - c = 127; - d = 125; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = &c; - args_dbl[3] = &d; - args_dbl[4] = NULL; - - cl_arg_types[0] = &ffi_type_uchar; - cl_arg_types[1] = &ffi_type_uchar; - cl_arg_types[2] = &ffi_type_uchar; - cl_arg_types[3] = &ffi_type_uchar; - cl_arg_types[4] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_uchar, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "1 2 127 125: 255" } */ - printf("res: %d\n", (unsigned char)res_call); - /* { dg-output "\nres: 255" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(1, 2, 127, 125); - /* { dg-output "\n1 2 127 125: 255" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 255" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushort.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushort.c deleted file mode 100644 index dd10ca734685dfb48cc7df9d2309722ba0cb85d1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushort.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple unsigned short values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -unsigned short test_func_fn(unsigned short a1, unsigned short a2) -{ - unsigned short result; - - result = a1 + a2; - - printf("%d %d: %d\n", a1, a2, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - unsigned short a1, a2; - - a1 = *(unsigned short *)avals[0]; - a2 = *(unsigned short *)avals[1]; - - *(ffi_arg *)rval = test_func_fn(a1, a2); - -} - -typedef unsigned short (*test_type)(unsigned short, unsigned short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[3]; - ffi_type * cl_arg_types[3]; - ffi_arg res_call; - unsigned short a, b, res_closure; - - a = 2; - b = 32765; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = NULL; - - cl_arg_types[0] = &ffi_type_ushort; - cl_arg_types[1] = &ffi_type_ushort; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_ushort, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "2 32765: 32767" } */ - printf("res: %d\n", (unsigned short)res_call); - /* { dg-output "\nres: 32767" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(2, 32765); - /* { dg-output "\n2 32765: 32767" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 32767" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushortchar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushortchar.c deleted file mode 100644 index 2588e97f987fbb5c386f78bc9b80719b674244b1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_multi_ushortchar.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check passing of multiple unsigned short/char values. - Limitations: none. - PR: PR13221. - Originator: 20031129 */ - -/* { dg-do run } */ -#include "ffitest.h" - -unsigned short test_func_fn(unsigned char a1, unsigned short a2, - unsigned char a3, unsigned short a4) -{ - unsigned short result; - - result = a1 + a2 + a3 + a4; - - printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); - - return result; - -} - -static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, - void *data __UNUSED__) -{ - unsigned char a1, a3; - unsigned short a2, a4; - - a1 = *(unsigned char *)avals[0]; - a2 = *(unsigned short *)avals[1]; - a3 = *(unsigned char *)avals[2]; - a4 = *(unsigned short *)avals[3]; - - *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); - -} - -typedef unsigned short (*test_type)(unsigned char, unsigned short, - unsigned char, unsigned short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void * args_dbl[5]; - ffi_type * cl_arg_types[5]; - ffi_arg res_call; - unsigned char a, c; - unsigned short b, d, res_closure; - - a = 1; - b = 2; - c = 127; - d = 128; - - args_dbl[0] = &a; - args_dbl[1] = &b; - args_dbl[2] = &c; - args_dbl[3] = &d; - args_dbl[4] = NULL; - - cl_arg_types[0] = &ffi_type_uchar; - cl_arg_types[1] = &ffi_type_ushort; - cl_arg_types[2] = &ffi_type_uchar; - cl_arg_types[3] = &ffi_type_ushort; - cl_arg_types[4] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_ushort, cl_arg_types) == FFI_OK); - - ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); - /* { dg-output "1 2 127 128: 258" } */ - printf("res: %d\n", (unsigned short)res_call); - /* { dg-output "\nres: 258" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); - - res_closure = (*((test_type)code))(1, 2, 127, 128); - /* { dg-output "\n1 2 127 128: 258" } */ - printf("res: %d\n", res_closure); - /* { dg-output "\nres: 258" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer.c deleted file mode 100644 index d82a87a71b6168414fdcd35bdc973ad2b1c75561..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check pointer arguments. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -#include "ffitest.h" - -void* cls_pointer_fn(void* a1, void* a2) -{ - void* result = (void*)((intptr_t)a1 + (intptr_t)a2); - - printf("0x%08x 0x%08x: 0x%08x\n", - (unsigned int)(uintptr_t) a1, - (unsigned int)(uintptr_t) a2, - (unsigned int)(uintptr_t) result); - - return result; -} - -static void -cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - void* a1 = *(void**)(args[0]); - void* a2 = *(void**)(args[1]); - - *(void**)resp = cls_pointer_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[3]; - /* ffi_type cls_pointer_type; */ - ffi_type* arg_types[3]; - -/* cls_pointer_type.size = sizeof(void*); - cls_pointer_type.alignment = 0; - cls_pointer_type.type = FFI_TYPE_POINTER; - cls_pointer_type.elements = NULL;*/ - - void* arg1 = (void*)0x12345678; - void* arg2 = (void*)0x89abcdef; - ffi_arg res = 0; - - arg_types[0] = &ffi_type_pointer; - arg_types[1] = &ffi_type_pointer; - arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, - arg_types) == FFI_OK); - - args[0] = &arg1; - args[1] = &arg2; - args[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); - /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ - printf("res: 0x%08x\n", (unsigned int) res); - /* { dg-output "\nres: 0x9be02467" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - - res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); - /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ - printf("res: 0x%08x\n", (unsigned int) res); - /* { dg-output "\nres: 0x9be02467" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer_stack.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer_stack.c deleted file mode 100644 index 1f1d9157b9d967ee82a49cc721230e6d0203cf3e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_pointer_stack.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check pointer arguments across multiple hideous stack frames. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/7/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -#include "ffitest.h" - -static long dummyVar; - -long dummy_func( - long double a1, char b1, - long double a2, char b2, - long double a3, char b3, - long double a4, char b4) -{ - return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; -} - -void* cls_pointer_fn2(void* a1, void* a2) -{ - long double trample1 = (intptr_t)a1 + (intptr_t)a2; - char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; - long double trample3 = (intptr_t)trample1 + (intptr_t)a1; - char trample4 = trample2 + ((char*)&a1)[1]; - long double trample5 = (intptr_t)trample3 + (intptr_t)a2; - char trample6 = trample4 + ((char*)&a2)[1]; - long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; - char trample8 = trample6 + trample2; - void* result; - - dummyVar = dummy_func(trample1, trample2, trample3, trample4, - trample5, trample6, trample7, trample8); - - result = (void*)((intptr_t)a1 + (intptr_t)a2); - - printf("0x%08x 0x%08x: 0x%08x\n", - (unsigned int)(uintptr_t) a1, - (unsigned int)(uintptr_t) a2, - (unsigned int)(uintptr_t) result); - - return result; -} - -void* cls_pointer_fn1(void* a1, void* a2) -{ - long double trample1 = (intptr_t)a1 + (intptr_t)a2; - char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; - long double trample3 = (intptr_t)trample1 + (intptr_t)a1; - char trample4 = trample2 + ((char*)&a1)[1]; - long double trample5 = (intptr_t)trample3 + (intptr_t)a2; - char trample6 = trample4 + ((char*)&a2)[1]; - long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; - char trample8 = trample6 + trample2; - void* result; - - dummyVar = dummy_func(trample1, trample2, trample3, trample4, - trample5, trample6, trample7, trample8); - - result = (void*)((intptr_t)a1 + (intptr_t)a2); - - printf("0x%08x 0x%08x: 0x%08x\n", - (unsigned int)(intptr_t) a1, - (unsigned int)(intptr_t) a2, - (unsigned int)(intptr_t) result); - - result = cls_pointer_fn2(result, a1); - - return result; -} - -static void -cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - void* a1 = *(void**)(args[0]); - void* a2 = *(void**)(args[1]); - - long double trample1 = (intptr_t)a1 + (intptr_t)a2; - char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; - long double trample3 = (intptr_t)trample1 + (intptr_t)a1; - char trample4 = trample2 + ((char*)&a1)[1]; - long double trample5 = (intptr_t)trample3 + (intptr_t)a2; - char trample6 = trample4 + ((char*)&a2)[1]; - long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; - char trample8 = trample6 + trample2; - - dummyVar = dummy_func(trample1, trample2, trample3, trample4, - trample5, trample6, trample7, trample8); - - *(void**)resp = cls_pointer_fn1(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[3]; - /* ffi_type cls_pointer_type; */ - ffi_type* arg_types[3]; - -/* cls_pointer_type.size = sizeof(void*); - cls_pointer_type.alignment = 0; - cls_pointer_type.type = FFI_TYPE_POINTER; - cls_pointer_type.elements = NULL;*/ - - void* arg1 = (void*)0x01234567; - void* arg2 = (void*)0x89abcdef; - ffi_arg res = 0; - - arg_types[0] = &ffi_type_pointer; - arg_types[1] = &ffi_type_pointer; - arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, - arg_types) == FFI_OK); - - args[0] = &arg1; - args[1] = &arg2; - args[2] = NULL; - - printf("\n"); - ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); - - printf("res: 0x%08x\n", (unsigned int) res); - /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ - /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ - /* { dg-output "\nres: 0x8bf258bd" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); - - res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); - - printf("res: 0x%08x\n", (unsigned int) res); - /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ - /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ - /* { dg-output "\nres: 0x8bf258bd" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_schar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_schar.c deleted file mode 100644 index 82986b172c365d2d9bf9313568b056eb922ae821..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_schar.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: closure_call - Purpose: Check return value schar. - Limitations: none. - PR: none. - Originator: 20031108 */ - - - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg*)resp = *(signed char *)args[0]; - printf("%d: %d\n",*(signed char *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef signed char (*cls_ret_schar)(signed char); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - signed char res; - - cl_arg_types[0] = &ffi_type_schar; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_schar, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_schar)code))(127); - /* { dg-output "127: 127" } */ - printf("res: %d\n", res); - /* { dg-output "\nres: 127" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sint.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sint.c deleted file mode 100644 index c7e13b73a3bae7e9f6efed156bea48e28e6c1052..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sint.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: closure_call - Purpose: Check return value sint32. - Limitations: none. - PR: none. - Originator: 20031108 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg*)resp = *(signed int *)args[0]; - printf("%d: %d\n",*(signed int *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef signed int (*cls_ret_sint)(signed int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - signed int res; - - cl_arg_types[0] = &ffi_type_sint; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_sint)code))(65534); - /* { dg-output "65534: 65534" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 65534" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sshort.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sshort.c deleted file mode 100644 index 846d57ed1ba553794ae52c4cca7cf952647dfd2e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_sshort.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: closure_call - Purpose: Check return value sshort. - Limitations: none. - PR: none. - Originator: 20031108 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg*)resp = *(signed short *)args[0]; - printf("%d: %d\n",*(signed short *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef signed short (*cls_ret_sshort)(signed short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - signed short res; - - cl_arg_types[0] = &ffi_type_sshort; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_sshort, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_sshort)code))(255); - /* { dg-output "255: 255" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 255" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_struct_va1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_struct_va1.c deleted file mode 100644 index 6d1fdaeb606ac90f09cdd1ec2408e67a846d0681..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_struct_va1.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test doubles passed in variable argument lists. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run } */ -/* { dg-output "" { xfail avr32*-*-* } } */ -#include "ffitest.h" - -struct small_tag -{ - unsigned char a; - unsigned char b; -}; - -struct large_tag -{ - unsigned a; - unsigned b; - unsigned c; - unsigned d; - unsigned e; -}; - -static void -test_fn (ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - int n = *(int*)args[0]; - struct small_tag s1 = * (struct small_tag *) args[1]; - struct large_tag l1 = * (struct large_tag *) args[2]; - struct small_tag s2 = * (struct small_tag *) args[3]; - - printf ("%d %d %d %d %d %d %d %d %d %d\n", n, s1.a, s1.b, - l1.a, l1.b, l1.c, l1.d, l1.e, - s2.a, s2.b); - * (ffi_arg*) resp = 42; -} - -int -main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc (sizeof (ffi_closure), &code); - ffi_type* arg_types[5]; - - ffi_arg res = 0; - - ffi_type s_type; - ffi_type *s_type_elements[3]; - - ffi_type l_type; - ffi_type *l_type_elements[6]; - - struct small_tag s1; - struct small_tag s2; - struct large_tag l1; - - int si; - - s_type.size = 0; - s_type.alignment = 0; - s_type.type = FFI_TYPE_STRUCT; - s_type.elements = s_type_elements; - - s_type_elements[0] = &ffi_type_uchar; - s_type_elements[1] = &ffi_type_uchar; - s_type_elements[2] = NULL; - - l_type.size = 0; - l_type.alignment = 0; - l_type.type = FFI_TYPE_STRUCT; - l_type.elements = l_type_elements; - - l_type_elements[0] = &ffi_type_uint; - l_type_elements[1] = &ffi_type_uint; - l_type_elements[2] = &ffi_type_uint; - l_type_elements[3] = &ffi_type_uint; - l_type_elements[4] = &ffi_type_uint; - l_type_elements[5] = NULL; - - arg_types[0] = &ffi_type_sint; - arg_types[1] = &s_type; - arg_types[2] = &l_type; - arg_types[3] = &s_type; - arg_types[4] = NULL; - - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, - arg_types) == FFI_OK); - - si = 4; - s1.a = 5; - s1.b = 6; - - s2.a = 20; - s2.b = 21; - - l1.a = 10; - l1.b = 11; - l1.c = 12; - l1.d = 13; - l1.e = 14; - - CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK); - - res = ((int (*)(int, ...))(code))(si, s1, l1, s2); - /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 42" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar.c deleted file mode 100644 index c1317e795fd65d1b9d5328c449a4b38ca41c2c64..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: closure_call - Purpose: Check return value uchar. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg*)resp = *(unsigned char *)args[0]; - printf("%d: %d\n",*(unsigned char *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef unsigned char (*cls_ret_uchar)(unsigned char); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - unsigned char res; - - cl_arg_types[0] = &ffi_type_uchar; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uchar, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_uchar)code))(127); - /* { dg-output "127: 127" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 127" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar_va.c deleted file mode 100644 index 6491c5b3df15ee1436995c4212e38f4d27953619..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uchar_va.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: closure_call - Purpose: Test anonymous unsigned char argument. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef unsigned char T; - -static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(ffi_arg *)resp = *(T *)args[0]; - - printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); - } - -typedef T (*cls_ret_T)(T, ...); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[3]; - T res; - - cl_arg_types[0] = &ffi_type_uchar; - cl_arg_types[1] = &ffi_type_uchar; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, - &ffi_type_uchar, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); - res = ((((cls_ret_T)code)(67, 4))); - /* { dg-output "67: 67 4" } */ - printf("res: %d\n", res); - /* { dg-output "\nres: 67" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint.c deleted file mode 100644 index 885cff5c3146831c3a2736ebf885afdea0c1f03d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Area: closure_call - Purpose: Check return value uint. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg *)resp = *(unsigned int *)args[0]; - - printf("%d: %d\n",*(unsigned int *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef unsigned int (*cls_ret_uint)(unsigned int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - unsigned int res; - - cl_arg_types[0] = &ffi_type_uint; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_uint)code))(2147483647); - /* { dg-output "2147483647: 2147483647" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 2147483647" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint_va.c deleted file mode 100644 index b04cfd19c2ce42fbd08906fd8e72aa7eac928f90..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_uint_va.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Area: closure_call - Purpose: Test anonymous unsigned int argument. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ - -#include "ffitest.h" - -typedef unsigned int T; - -static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(ffi_arg *)resp = *(T *)args[0]; - - printf("%d: %d %d\n", (int)*(ffi_arg *)resp, *(T *)args[0], *(T *)args[1]); - } - -typedef T (*cls_ret_T)(T, ...); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[3]; - T res; - - cl_arg_types[0] = &ffi_type_uint; - cl_arg_types[1] = &ffi_type_uint; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, - &ffi_type_uint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); - res = ((((cls_ret_T)code)(67, 4))); - /* { dg-output "67: 67 4" } */ - printf("res: %d\n", res); - /* { dg-output "\nres: 67" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulong_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulong_va.c deleted file mode 100644 index 0315082e093ba0154e0429ec1b7c67575b619091..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulong_va.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Area: closure_call - Purpose: Test anonymous unsigned long argument. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ - -#include "ffitest.h" - -typedef unsigned long T; - -static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(T *)resp = *(T *)args[0]; - - printf("%ld: %ld %ld\n", *(T *)resp, *(T *)args[0], *(T *)args[1]); - } - -typedef T (*cls_ret_T)(T, ...); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[3]; - T res; - - cl_arg_types[0] = &ffi_type_ulong; - cl_arg_types[1] = &ffi_type_ulong; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, - &ffi_type_ulong, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); - res = ((((cls_ret_T)code)(67, 4))); - /* { dg-output "67: 67 4" } */ - printf("res: %ld\n", res); - /* { dg-output "\nres: 67" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulonglong.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulonglong.c deleted file mode 100644 index 62f2cae63a9b48d9a2c46c148ed5864f23b5ea1c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ulonglong.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Area: closure_call - Purpose: Check return value long long. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ -#include "ffitest.h" - -static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0]; - - printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], - *(unsigned long long *)(resp)); -} -typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - unsigned long long res; - - cl_arg_types[0] = &ffi_type_uint64; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uint64, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); - res = (*((cls_ret_ulonglong)code))(214LL); - /* { dg-output "214: 1152921504606846761" } */ - printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 1152921504606846761" } */ - - res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); - /* { dg-output "\n9223372035854775808: 8070450533247928831" } */ - printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 8070450533247928831" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort.c deleted file mode 100644 index a00100e07f8c954f7a15a08ee5a873754d8558d5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Area: closure_call - Purpose: Check return value ushort. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - *(ffi_arg*)resp = *(unsigned short *)args[0]; - - printf("%d: %d\n",*(unsigned short *)args[0], - (int)*(ffi_arg *)(resp)); -} -typedef unsigned short (*cls_ret_ushort)(unsigned short); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - unsigned short res; - - cl_arg_types[0] = &ffi_type_ushort; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_ushort, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_ushort)code))(65535); - /* { dg-output "65535: 65535" } */ - printf("res: %d\n",res); - /* { dg-output "\nres: 65535" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort_va.c deleted file mode 100644 index 37aa1064ea71d80f9bcc9740f00f139a16836d1a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/cls_ushort_va.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: closure_call - Purpose: Test anonymous unsigned short argument. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef unsigned short T; - -static void cls_ret_T_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - *(ffi_arg *)resp = *(T *)args[0]; - - printf("%d: %d %d\n", (int)(*(ffi_arg *)resp), *(T *)args[0], *(T *)args[1]); - } - -typedef T (*cls_ret_T)(T, ...); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[3]; - T res; - - cl_arg_types[0] = &ffi_type_ushort; - cl_arg_types[1] = &ffi_type_ushort; - cl_arg_types[2] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 2, - &ffi_type_ushort, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_T_fn, NULL, code) == FFI_OK); - res = ((((cls_ret_T)code)(67, 4))); - /* { dg-output "67: 67 4" } */ - printf("res: %d\n", res); - /* { dg-output "\nres: 67" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_abi.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_abi.c deleted file mode 100644 index f5a73179ec96a345cc3f9f6199c54cdcb33941c0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_abi.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Area: ffi_prep_cif, ffi_prep_closure - Purpose: Test error return for bad ABIs. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static void -dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, - void** args __UNUSED__, void* userdata __UNUSED__) -{} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type* arg_types[1]; - - arg_types[0] = NULL; - - CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, - arg_types) == FFI_BAD_ABI); - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, - arg_types) == FFI_OK); - - cif.abi= 255; - - CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_typedef.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_typedef.c deleted file mode 100644 index bf6016186170d4f892ee26c5b21ef48242f4dda6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/err_bad_typedef.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Area: ffi_prep_cif - Purpose: Test error return for bad typedefs. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/6/2007 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -int main (void) -{ - ffi_cif cif; - ffi_type* arg_types[1]; - - ffi_type badType = ffi_type_void; - - arg_types[0] = NULL; - - badType.size = 0; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, - arg_types) == FFI_BAD_TYPEDEF); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/ffitest.h b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/ffitest.h deleted file mode 100644 index 15d5e44123481942d4dbd59960620f7f9d243c55..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/ffitest.h +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include -#include -#include "fficonfig.h" - -#if defined HAVE_STDINT_H -#include -#endif - -#if defined HAVE_INTTYPES_H -#include -#endif - -#define MAX_ARGS 256 - -#define CHECK(x) (void)(!(x) ? (abort(), 1) : 0) - -/* Define macros so that compilers other than gcc can run the tests. */ -#undef __UNUSED__ -#if defined(__GNUC__) -#define __UNUSED__ __attribute__((__unused__)) -#define __STDCALL__ __attribute__((stdcall)) -#define __THISCALL__ __attribute__((thiscall)) -#define __FASTCALL__ __attribute__((fastcall)) -#else -#define __UNUSED__ -#define __STDCALL__ __stdcall -#define __THISCALL__ __thiscall -#define __FASTCALL__ __fastcall -#endif - -#ifndef ABI_NUM -#define ABI_NUM FFI_DEFAULT_ABI -#define ABI_ATTR -#endif - -/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a - file open. */ -#ifdef HAVE_MMAP_ANON -# undef HAVE_MMAP_DEV_ZERO - -# include -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) -# define MAP_ANONYMOUS MAP_ANON -# endif -# define USING_MMAP - -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - -# include -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# define USING_MMAP - -#endif - -/* MinGW kludge. */ -#ifdef _WIN64 -#define PRIdLL "I64d" -#define PRIuLL "I64u" -#else -#define PRIdLL "lld" -#define PRIuLL "llu" -#endif - -/* Tru64 UNIX kludge. */ -#if defined(__alpha__) && defined(__osf__) -/* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit. */ -#undef PRIdLL -#define PRIdLL "ld" -#undef PRIuLL -#define PRIuLL "lu" -#define PRId8 "hd" -#define PRIu8 "hu" -#define PRId64 "ld" -#define PRIu64 "lu" -#define PRIuPTR "lu" -#endif - -/* PA HP-UX kludge. */ -#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR) -#define PRIuPTR "lu" -#endif - -/* IRIX kludge. */ -#if defined(__sgi) -/* IRIX 6.5 provides all definitions, but only for C99 - compilations. */ -#define PRId8 "hhd" -#define PRIu8 "hhu" -#if (_MIPS_SZLONG == 32) -#define PRId64 "lld" -#define PRIu64 "llu" -#endif -/* This doesn't match , which always has "lld" here, but the - arguments are uint64_t, int64_t, which are unsigned long, long for - 64-bit in . */ -#if (_MIPS_SZLONG == 64) -#define PRId64 "ld" -#define PRIu64 "lu" -#endif -/* This doesn't match , which has "u" here, but the arguments - are uintptr_t, which is always unsigned long. */ -#define PRIuPTR "lu" -#endif - -/* Solaris < 10 kludge. */ -#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) -#if defined(__arch64__) || defined (__x86_64__) -#define PRIuPTR "lu" -#else -#define PRIuPTR "u" -#endif -#endif - -/* MSVC kludge. */ -#if defined _MSC_VER -#define PRIuPTR "lu" -#define PRIu8 "u" -#define PRId8 "d" -#define PRIu64 "I64u" -#define PRId64 "I64d" -#endif - -#ifndef PRIuPTR -#define PRIuPTR "u" -#endif diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float.c deleted file mode 100644 index fbc272d84f1fa894f0c26e8765ed9c109f7dacff..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static int floating(int a, float b, double c, long double d) -{ - int i; - - i = (int) ((float)a/b + ((float)c/(float)d)); - - return i; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - - float f; - signed int si1; - double d; - long double ld; - - args[0] = &ffi_type_sint; - values[0] = &si1; - args[1] = &ffi_type_float; - values[1] = &f; - args[2] = &ffi_type_double; - values[2] = &d; - args[3] = &ffi_type_longdouble; - values[3] = &ld; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_sint, args) == FFI_OK); - - si1 = 6; - f = 3.14159; - d = (double)1.0/(double)3.0; - ld = 2.71828182846L; - - floating (si1, f, d, ld); - - ffi_call(&cif, FFI_FN(floating), &rint, values); - - printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld)); - - CHECK((int)rint == floating(si1, f, d, ld)); - - exit (0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float1.c deleted file mode 100644 index c48493c6b22755b8f4a67543bc845e5839f24c25..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float1.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -#include "float.h" - -#include - -typedef union -{ - double d; - unsigned char c[sizeof (double)]; -} value_type; - -#define CANARY 0xba - -static double dblit(float f) -{ - return f/3.0; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float f; - value_type result[2]; - unsigned int i; - - args[0] = &ffi_type_float; - values[0] = &f; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_double, args) == FFI_OK); - - f = 3.14159; - - /* Put a canary in the return array. This is a regression test for - a buffer overrun. */ - memset(result[1].c, CANARY, sizeof (double)); - - ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); - - /* These are not always the same!! Check for a reasonable delta */ - - CHECK(fabs(result[0].d - dblit(f)) < DBL_EPSILON); - - /* Check the canary. */ - for (i = 0; i < sizeof (double); ++i) - CHECK(result[1].c[i] == CANARY); - - exit(0); - -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float2.c deleted file mode 100644 index 20a8c402ba4680d1fab53ede572ad8cf436a1485..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value long double. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ -/* { dg-do run } */ - -#include "ffitest.h" -#include "float.h" - -#include - -static long double ldblit(float f) -{ - return (long double) (((long double) f)/ (long double) 3.0); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float f; - long double ld; - - args[0] = &ffi_type_float; - values[0] = &f; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_longdouble, args) == FFI_OK); - - f = 3.14159; - -#if 1 - /* This is ifdef'd out for now. long double support under SunOS/gcc - is pretty much non-existent. You'll get the odd bus error in library - routines like printf(). */ - printf ("%Lf\n", ldblit(f)); -#endif - ld = 666; - ffi_call(&cif, FFI_FN(ldblit), &ld, values); - -#if 1 - /* This is ifdef'd out for now. long double support under SunOS/gcc - is pretty much non-existent. You'll get the odd bus error in library - routines like printf(). */ - printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); -#endif - - /* These are not always the same!! Check for a reasonable delta */ - if (fabsl(ld - ldblit(f)) < LDBL_EPSILON) - puts("long double return value tests ok!"); - else - CHECK(0); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float3.c deleted file mode 100644 index bab3206a174fb84366638c13516d25d179666c4d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float3.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call - Purpose: Check float arguments with different orders. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" -#include "float.h" - -#include - -static double floating_1(float a, double b, long double c) -{ - return (double) a + b + (double) c; -} - -static double floating_2(long double a, double b, float c) -{ - return (double) a + b + (double) c; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - double rd; - - float f; - double d; - long double ld; - - args[0] = &ffi_type_float; - values[0] = &f; - args[1] = &ffi_type_double; - values[1] = &d; - args[2] = &ffi_type_longdouble; - values[2] = &ld; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &ffi_type_double, args) == FFI_OK); - - f = 3.14159; - d = (double)1.0/(double)3.0; - ld = 2.71828182846L; - - floating_1 (f, d, ld); - - ffi_call(&cif, FFI_FN(floating_1), &rd, values); - - CHECK(fabs(rd - floating_1(f, d, ld)) < DBL_EPSILON); - - args[0] = &ffi_type_longdouble; - values[0] = &ld; - args[1] = &ffi_type_double; - values[1] = &d; - args[2] = &ffi_type_float; - values[2] = &f; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &ffi_type_double, args) == FFI_OK); - - floating_2 (ld, d, f); - - ffi_call(&cif, FFI_FN(floating_2), &rd, values); - - CHECK(fabs(rd - floating_2(ld, d, f)) < DBL_EPSILON); - - exit (0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float4.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float4.c deleted file mode 100644 index 0dd6d85e7aa0307211322103f66f9ce7d5d614cf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float4.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Area: ffi_call - Purpose: Check denorm double value. - Limitations: none. - PR: PR26483. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -/* { dg-options "-mieee" { target alpha*-*-* } } */ - -#include "ffitest.h" -#include "float.h" - -typedef union -{ - double d; - unsigned char c[sizeof (double)]; -} value_type; - -#define CANARY 0xba - -static double dblit(double d) -{ - return d; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - double d; - value_type result[2]; - unsigned int i; - - args[0] = &ffi_type_double; - values[0] = &d; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_double, args) == FFI_OK); - - d = DBL_MIN / 2; - - /* Put a canary in the return array. This is a regression test for - a buffer overrun. */ - memset(result[1].c, CANARY, sizeof (double)); - - ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); - - /* The standard delta check doesn't work for denorms. Since we didn't do - any arithmetic, we should get the original result back, and hence an - exact check should be OK here. */ - - CHECK(result[0].d == dblit(d)); - - /* Check the canary. */ - for (i = 0; i < sizeof (double); ++i) - CHECK(result[1].c[i] == CANARY); - - exit(0); - -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float_va.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float_va.c deleted file mode 100644 index 5acff91f66333839f536c2c05cc08df2f03b0513..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/float_va.c +++ /dev/null @@ -1,107 +0,0 @@ -/* Area: fp and variadics - Purpose: check fp inputs and returns work on variadics, even the fixed params - Limitations: None - PR: none - Originator: 2011-01-25 - - Intended to stress the difference in ABI on ARM vfp -*/ - -/* { dg-do run } */ - -#include - -#include "ffitest.h" - -/* prints out all the parameters, and returns the sum of them all. - * 'x' is the number of variadic parameters all of which are double in this test - */ -double float_va_fn(unsigned int x, double y,...) -{ - double total=0.0; - va_list ap; - unsigned int i; - - total+=(double)x; - total+=y; - - printf("%u: %.1f :", x, y); - - va_start(ap, y); - for(i=0;i -#include -#include - -static float ABI_ATTR many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) -{ -#if 0 - printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", - (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, - (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, - (double) f11, (double) f12, (double) f13); -#endif - - return f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[13]; - void *values[13]; - float fa[13]; - float f, ff; - int i; - - for (i = 0; i < 13; i++) - { - args[i] = &ffi_type_float; - values[i] = &fa[i]; - fa[i] = (float) i; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 13, - &ffi_type_float, args) == FFI_OK); - - ffi_call(&cif, FFI_FN(many), &f, values); - - ff = many(fa[0], fa[1], - fa[2], fa[3], - fa[4], fa[5], - fa[6], fa[7], - fa[8], fa[9], - fa[10],fa[11],fa[12]); - - if (fabs(f - ff) < FLT_EPSILON) - exit(0); - else - abort(); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many2.c deleted file mode 100644 index 1c85746e4c4bc6488f8726a1efa8a15dccdddc04..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Area: ffi_call - Purpose: Check uint8_t arguments. - Limitations: none. - PR: PR45677. - Originator: Dan Witte 20100916 */ - -/* { dg-do run } */ - -#include "ffitest.h" - -#define NARGS 7 - -typedef unsigned char u8; - -#ifdef __GNUC__ -__attribute__((noinline)) -#endif -uint8_t -foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, - uint8_t e, uint8_t f, uint8_t g) -{ - return a + b + c + d + e + f + g; -} - -uint8_t ABI_ATTR -bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d, - uint8_t e, uint8_t f, uint8_t g) -{ - return foo (a, b, c, d, e, f, g); -} - -int -main (void) -{ - ffi_type *ffitypes[NARGS]; - int i; - ffi_cif cif; - ffi_arg result = 0; - uint8_t args[NARGS]; - void *argptrs[NARGS]; - - for (i = 0; i < NARGS; ++i) - ffitypes[i] = &ffi_type_uint8; - - CHECK (ffi_prep_cif (&cif, ABI_NUM, NARGS, - &ffi_type_uint8, ffitypes) == FFI_OK); - - for (i = 0; i < NARGS; ++i) - { - args[i] = i; - argptrs[i] = &args[i]; - } - ffi_call (&cif, FFI_FN (bar), &result, argptrs); - - CHECK (result == 21); - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_double.c deleted file mode 100644 index 4ef8c8ab28b0de3e404520b9aad2d09256f3d8c3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_double.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double, with many arguments - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -#include -#include -#include - -static double many(double f1, - double f2, - double f3, - double f4, - double f5, - double f6, - double f7, - double f8, - double f9, - double f10, - double f11, - double f12, - double f13) -{ -#if 0 - printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", - (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, - (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, - (double) f11, (double) f12, (double) f13); -#endif - - return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[13]; - void *values[13]; - double fa[13]; - double f, ff; - int i; - - for (i = 0; i < 13; i++) - { - args[i] = &ffi_type_double; - values[i] = &fa[i]; - fa[i] = (double) i; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, - &ffi_type_double, args) == FFI_OK); - - ffi_call(&cif, FFI_FN(many), &f, values); - - ff = many(fa[0], fa[1], - fa[2], fa[3], - fa[4], fa[5], - fa[6], fa[7], - fa[8], fa[9], - fa[10],fa[11],fa[12]); - if (fabs(f - ff) < FLT_EPSILON) - exit(0); - else - abort(); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_mixed.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_mixed.c deleted file mode 100644 index 85ec36ecbefaa952594f5c20bceba49638c442ce..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/many_mixed.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double, with many arguments - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -#include -#include -#include - -static double many(double f1, - double f2, - long int i1, - double f3, - double f4, - long int i2, - double f5, - double f6, - long int i3, - double f7, - double f8, - long int i4, - double f9, - double f10, - long int i5, - double f11, - double f12, - long int i6, - double f13) -{ - return ((double) (i1 + i2 + i3 + i4 + i5 + i6) + (f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[19]; - void *values[19]; - double fa[19]; - long int la[19]; - double f, ff; - int i; - - for (i = 0; i < 19; i++) - { - if( (i - 2) % 3 == 0) { - args[i] = &ffi_type_slong; - la[i] = (long int) i; - values[i] = &la[i]; - } - else { - args[i] = &ffi_type_double; - fa[i] = (double) i; - values[i] = &fa[i]; - } - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 19, - &ffi_type_double, args) == FFI_OK); - - ffi_call(&cif, FFI_FN(many), &f, values); - - ff = many(fa[0], fa[1], la[2], - fa[3], fa[4], la[5], - fa[6], fa[7], la[8], - fa[9], fa[10], la[11], - fa[12], fa[13], la[14], - fa[15], fa[16], la[17], - fa[18]); - if (fabs(f - ff) < FLT_EPSILON) - exit(0); - else - abort(); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/negint.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/negint.c deleted file mode 100644 index 6e2f26fc100e1a74dbcc8c41bd7acf030d90c9bf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/negint.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Area: ffi_call - Purpose: Check that negative integers are passed correctly. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static int checking(int a, short b, signed char c) -{ - - return (a < 0 && b < 0 && c < 0); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - - signed int si; - signed short ss; - signed char sc; - - args[0] = &ffi_type_sint; - values[0] = &si; - args[1] = &ffi_type_sshort; - values[1] = &ss; - args[2] = &ffi_type_schar; - values[2] = ≻ - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &ffi_type_sint, args) == FFI_OK); - - si = -6; - ss = -12; - sc = -1; - - checking (si, ss, sc); - - ffi_call(&cif, FFI_FN(checking), &rint, values); - - printf ("%d vs %d\n", (int)rint, checking (si, ss, sc)); - - CHECK(rint != 0); - - exit (0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct.c deleted file mode 100644 index c15e3a0338294bfea5de2bf1652f2b01875c9253..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct.c +++ /dev/null @@ -1,152 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_16byte1 { - double a; - float b; - int c; -} cls_struct_16byte1; - -typedef struct cls_struct_16byte2 { - int ii; - double dd; - float ff; -} cls_struct_16byte2; - -typedef struct cls_struct_combined { - cls_struct_16byte1 d; - cls_struct_16byte2 e; -} cls_struct_combined; - -cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, - struct cls_struct_16byte2 b1, - struct cls_struct_combined b2) -{ - struct cls_struct_combined result; - - result.d.a = b0.a + b1.dd + b2.d.a; - result.d.b = b0.b + b1.ff + b2.d.b; - result.d.c = b0.c + b1.ii + b2.d.c; - result.e.ii = b0.c + b1.ii + b2.e.ii; - result.e.dd = b0.a + b1.dd + b2.e.dd; - result.e.ff = b0.b + b1.ff + b2.e.ff; - - printf("%g %g %d %d %g %g %g %g %d %d %g %g: %g %g %d %d %g %g\n", - b0.a, b0.b, b0.c, - b1.ii, b1.dd, b1.ff, - b2.d.a, b2.d.b, b2.d.c, - b2.e.ii, b2.e.dd, b2.e.ff, - result.d.a, result.d.b, result.d.c, - result.e.ii, result.e.dd, result.e.ff); - - return result; -} - -static void -cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_16byte1 b0; - struct cls_struct_16byte2 b1; - struct cls_struct_combined b2; - - b0 = *(struct cls_struct_16byte1*)(args[0]); - b1 = *(struct cls_struct_16byte2*)(args[1]); - b2 = *(struct cls_struct_combined*)(args[2]); - - - *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type* cls_struct_fields1[5]; - ffi_type* cls_struct_fields2[5]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_combined res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_float; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = NULL; - - cls_struct_fields1[0] = &ffi_type_sint; - cls_struct_fields1[1] = &ffi_type_double; - cls_struct_fields1[2] = &ffi_type_float; - cls_struct_fields1[3] = NULL; - - cls_struct_fields2[0] = &cls_struct_type; - cls_struct_fields2[1] = &cls_struct_type1; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type2, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); - /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ - CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); - CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); - CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); - CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); - CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); - CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, - cls_struct_16byte2, - cls_struct_combined)) - (code))(e_dbl, f_dbl, g_dbl); - /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ - CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); - CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); - CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); - CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); - CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); - CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct1.c deleted file mode 100644 index 477a6b9bdee2cdb2b775b4eb678dec12b0a0ab33..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct1.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_16byte1 { - double a; - float b; - int c; -} cls_struct_16byte1; - -typedef struct cls_struct_16byte2 { - int ii; - double dd; - float ff; -} cls_struct_16byte2; - -typedef struct cls_struct_combined { - cls_struct_16byte1 d; - cls_struct_16byte2 e; -} cls_struct_combined; - -cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, - struct cls_struct_16byte2 b1, - struct cls_struct_combined b2, - struct cls_struct_16byte1 b3) -{ - struct cls_struct_combined result; - - result.d.a = b0.a + b1.dd + b2.d.a; - result.d.b = b0.b + b1.ff + b2.d.b; - result.d.c = b0.c + b1.ii + b2.d.c; - result.e.ii = b0.c + b1.ii + b2.e.ii; - result.e.dd = b0.a + b1.dd + b2.e.dd; - result.e.ff = b0.b + b1.ff + b2.e.ff; - - printf("%g %g %d %d %g %g %g %g %d %d %g %g %g %g %d: %g %g %d %d %g %g\n", - b0.a, b0.b, b0.c, - b1.ii, b1.dd, b1.ff, - b2.d.a, b2.d.b, b2.d.c, - b2.e.ii, b2.e.dd, b2.e.ff, - b3.a, b3.b, b3.c, - result.d.a, result.d.b, result.d.c, - result.e.ii, result.e.dd, result.e.ff); - - return result; -} - -static void -cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct cls_struct_16byte1 b0; - struct cls_struct_16byte2 b1; - struct cls_struct_combined b2; - struct cls_struct_16byte1 b3; - - b0 = *(struct cls_struct_16byte1*)(args[0]); - b1 = *(struct cls_struct_16byte2*)(args[1]); - b2 = *(struct cls_struct_combined*)(args[2]); - b3 = *(struct cls_struct_16byte1*)(args[3]); - - - *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[5]; - ffi_type* cls_struct_fields1[5]; - ffi_type* cls_struct_fields2[5]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; - struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; - struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, - {3, 1.0, 8.0}}; - struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; - struct cls_struct_combined res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_float; - cls_struct_fields[2] = &ffi_type_sint; - cls_struct_fields[3] = NULL; - - cls_struct_fields1[0] = &ffi_type_sint; - cls_struct_fields1[1] = &ffi_type_double; - cls_struct_fields1[2] = &ffi_type_float; - cls_struct_fields1[3] = NULL; - - cls_struct_fields2[0] = &cls_struct_type; - cls_struct_fields2[1] = &cls_struct_type1; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type2, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); - /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ - CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); - CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); - CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); - CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); - CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); - CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); - - res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, - cls_struct_16byte2, - cls_struct_combined, - cls_struct_16byte1)) - (code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ - CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); - CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); - CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); - CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); - CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); - CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - /* CHECK( 1 == 0); */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct10.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct10.c deleted file mode 100644 index 34a74e71874ddf129571c4e236226afabb2045df..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct10.c +++ /dev/null @@ -1,133 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned long long a; - unsigned char b; -} A; - -typedef struct B { - unsigned char y; - struct A x; - unsigned int z; -} B; - -typedef struct C { - unsigned long long d; - unsigned char e; -} C; - -static B B_fn(struct A b2, struct B b3, struct C b4) -{ - struct B result; - - result.x.a = b2.a + b3.x.a + b3.z + b4.d; - result.x.b = b2.b + b3.x.b + b3.y + b4.e; - result.y = b2.b + b3.x.b + b4.e; - - printf("%d %d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, b3.z, (int)b4.d, b4.e, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - struct C b2; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - b2 = *(struct C*)(args[2]); - - *(B*)resp = B_fn(b0, b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[4]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[4]; - ffi_type* cls_struct_fields2[3]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[4]; - - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = { 99, {12LL , 127}, 255}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_uint64; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &ffi_type_uchar; - cls_struct_fields1[1] = &cls_struct_type; - cls_struct_fields1[2] = &ffi_type_uint; - cls_struct_fields1[3] = NULL; - - cls_struct_fields2[0] = &ffi_type_uint64; - cls_struct_fields2[1] = &ffi_type_uchar; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99 255 2 9: 270 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); - /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct11.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct11.c deleted file mode 100644 index 351049382c620224d544f49d3bc57564d2cc0310..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct11.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check parameter passing with nested structs - of a single type. This tests the special cases - for homogeneous floating-point aggregates in the - AArch64 PCS. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - float a_x; - float a_y; -} A; - -typedef struct B { - float b_x; - float b_y; -} B; - -typedef struct C { - A a; - B b; -} C; - -static C C_fn (int x, int y, int z, C source, int i, int j, int k) -{ - C result; - result.a.a_x = source.a.a_x; - result.a.a_y = source.a.a_y; - result.b.b_x = source.b.b_x; - result.b.b_y = source.b.b_y; - - printf ("%d, %d, %d, %d, %d, %d\n", x, y, z, i, j, k); - - printf ("%.1f, %.1f, %.1f, %.1f, " - "%.1f, %.1f, %.1f, %.1f\n", - source.a.a_x, source.a.a_y, - source.b.b_x, source.b.b_y, - result.a.a_x, result.a.a_y, - result.b.b_x, result.b.b_y); - - return result; -} - -int main (void) -{ - ffi_cif cif; - - ffi_type* struct_fields_source_a[3]; - ffi_type* struct_fields_source_b[3]; - ffi_type* struct_fields_source_c[3]; - ffi_type* arg_types[8]; - - ffi_type struct_type_a, struct_type_b, struct_type_c; - - struct A source_fld_a = {1.0, 2.0}; - struct B source_fld_b = {4.0, 8.0}; - int k = 1; - - struct C result; - struct C source = {source_fld_a, source_fld_b}; - - struct_type_a.size = 0; - struct_type_a.alignment = 0; - struct_type_a.type = FFI_TYPE_STRUCT; - struct_type_a.elements = struct_fields_source_a; - - struct_type_b.size = 0; - struct_type_b.alignment = 0; - struct_type_b.type = FFI_TYPE_STRUCT; - struct_type_b.elements = struct_fields_source_b; - - struct_type_c.size = 0; - struct_type_c.alignment = 0; - struct_type_c.type = FFI_TYPE_STRUCT; - struct_type_c.elements = struct_fields_source_c; - - struct_fields_source_a[0] = &ffi_type_float; - struct_fields_source_a[1] = &ffi_type_float; - struct_fields_source_a[2] = NULL; - - struct_fields_source_b[0] = &ffi_type_float; - struct_fields_source_b[1] = &ffi_type_float; - struct_fields_source_b[2] = NULL; - - struct_fields_source_c[0] = &struct_type_a; - struct_fields_source_c[1] = &struct_type_b; - struct_fields_source_c[2] = NULL; - - arg_types[0] = &ffi_type_sint32; - arg_types[1] = &ffi_type_sint32; - arg_types[2] = &ffi_type_sint32; - arg_types[3] = &struct_type_c; - arg_types[4] = &ffi_type_sint32; - arg_types[5] = &ffi_type_sint32; - arg_types[6] = &ffi_type_sint32; - arg_types[7] = NULL; - - void *args[7]; - args[0] = &k; - args[1] = &k; - args[2] = &k; - args[3] = &source; - args[4] = &k; - args[5] = &k; - args[6] = &k; - CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, 7, &struct_type_c, - arg_types) == FFI_OK); - - ffi_call (&cif, FFI_FN (C_fn), &result, args); - /* { dg-output "1, 1, 1, 1, 1, 1\n" } */ - /* { dg-output "1.0, 2.0, 4.0, 8.0, 1.0, 2.0, 4.0, 8.0" } */ - CHECK (result.a.a_x == source.a.a_x); - CHECK (result.a.a_y == source.a.a_y); - CHECK (result.b.b_x == source.b.b_x); - CHECK (result.b.b_y == source.b.b_y); - exit (0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct2.c deleted file mode 100644 index 69268cdb8af34d690e24970564c67315f4de66d0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct2.c +++ /dev/null @@ -1,110 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20030911 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned long a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -B B_fn(struct A b0, struct B b1) -{ - struct B result; - - result.x.a = b0.a + b1.x.a; - result.x.b = b0.b + b1.x.b + b1.y; - result.y = b0.b + b1.x.b; - - printf("%lu %d %lu %d %d: %lu %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y, - result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - - *(B*)resp = B_fn(b0, b1); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type cls_struct_type, cls_struct_type1; - ffi_type* dbl_arg_types[3]; - - struct A e_dbl = { 1, 7}; - struct B f_dbl = {{12 , 127}, 99}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_fields[0] = &ffi_type_ulong; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); - /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct3.c deleted file mode 100644 index ab18cad733521046f936b8c7c672bfb0153064dd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct3.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20030911 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned long long a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -B B_fn(struct A b0, struct B b1) -{ - struct B result; - - result.x.a = b0.a + b1.x.a; - result.x.b = b0.b + b1.x.b + b1.y; - result.y = b0.b + b1.x.b; - - printf("%d %d %d %d %d: %d %d %d\n", (int)b0.a, b0.b, - (int)b1.x.a, b1.x.b, b1.y, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - - *(B*)resp = B_fn(b0, b1); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type cls_struct_type, cls_struct_type1; - ffi_type* dbl_arg_types[3]; - - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_fields[0] = &ffi_type_uint64; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); - /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct4.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct4.c deleted file mode 100644 index 2ffb4d65a0635cafa530d0f2f35f597f12c50142..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct4.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: PR 25630. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - double a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -static B B_fn(struct A b2, struct B b3) -{ - struct B result; - - result.x.a = b2.a + b3.x.a; - result.x.b = b2.b + b3.x.b + b3.y; - result.y = b2.b + b3.x.b; - - printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - - *(B*)resp = B_fn(b0, b1); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type cls_struct_type, cls_struct_type1; - ffi_type* dbl_arg_types[3]; - - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); - /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct5.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct5.c deleted file mode 100644 index 6c79845d984a68693c4a21087ebb99b9afd52e8d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct5.c +++ /dev/null @@ -1,112 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - long double a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -static B B_fn(struct A b2, struct B b3) -{ - struct B result; - - result.x.a = b2.a + b3.x.a; - result.x.b = b2.b + b3.x.b + b3.y; - result.y = b2.b + b3.x.b; - - printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - - *(B*)resp = B_fn(b0, b1); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type cls_struct_type, cls_struct_type1; - ffi_type* dbl_arg_types[3]; - - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_fields[0] = &ffi_type_longdouble; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); - /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct6.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct6.c deleted file mode 100644 index 59d35796f8def3db59580e42343f203d5c7de194..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct6.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: PR 25630. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - double a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -typedef struct C { - long d; - unsigned char e; -} C; - -static B B_fn(struct A b2, struct B b3, struct C b4) -{ - struct B result; - - result.x.a = b2.a + b3.x.a + b4.d; - result.x.b = b2.b + b3.x.b + b3.y + b4.e; - result.y = b2.b + b3.x.b + b4.e; - - printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - struct C b2; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - b2 = *(struct C*)(args[2]); - - *(B*)resp = B_fn(b0, b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[4]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type* cls_struct_fields2[3]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[4]; - - struct A e_dbl = { 1.0, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - cls_struct_fields2[0] = &ffi_type_slong; - cls_struct_fields2[1] = &ffi_type_uchar; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); - /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct7.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct7.c deleted file mode 100644 index 27595e6f5c301c151cf192d4da680f863aefca90..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct7.c +++ /dev/null @@ -1,111 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned long long a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -static B B_fn(struct A b2, struct B b3) -{ - struct B result; - - result.x.a = b2.a + b3.x.a; - result.x.b = b2.b + b3.x.b + b3.y; - result.y = b2.b + b3.x.b; - - printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - - *(B*)resp = B_fn(b0, b1); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[3]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type cls_struct_type, cls_struct_type1; - ffi_type* dbl_arg_types[3]; - - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12.0 , 127}, 99}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_fields[0] = &ffi_type_uint64; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); - /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct8.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct8.c deleted file mode 100644 index 0e6c68281e1a0ff66d8afc5e93b9466dd7e6d93e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct8.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned long long a; - unsigned char b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -typedef struct C { - unsigned long long d; - unsigned char e; -} C; - -static B B_fn(struct A b2, struct B b3, struct C b4) -{ - struct B result; - - result.x.a = b2.a + b3.x.a + b4.d; - result.x.b = b2.b + b3.x.b + b3.y + b4.e; - result.y = b2.b + b3.x.b + b4.e; - - printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, - (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, - (int)result.x.a, result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - struct C b2; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - b2 = *(struct C*)(args[2]); - - *(B*)resp = B_fn(b0, b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[4]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type* cls_struct_fields2[3]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[4]; - - struct A e_dbl = { 1LL, 7}; - struct B f_dbl = {{12LL , 127}, 99}; - struct C g_dbl = { 2LL, 9}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_uint64; - cls_struct_fields[1] = &ffi_type_uchar; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - cls_struct_fields2[0] = &ffi_type_uint64; - cls_struct_fields2[1] = &ffi_type_uchar; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); - /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct9.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct9.c deleted file mode 100644 index 5f7ac67752caa154ed93eaeeff46b706795f8f95..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/nested_struct9.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Contains structs as parameter of the struct itself. - Sample taken from Alan Modras patch to src/prep_cif.c. - Limitations: none. - PR: none. - Originator: 20051010 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct A { - unsigned char a; - unsigned long long b; -} A; - -typedef struct B { - struct A x; - unsigned char y; -} B; - -typedef struct C { - unsigned long d; - unsigned char e; -} C; - -static B B_fn(struct A b2, struct B b3, struct C b4) -{ - struct B result; - - result.x.a = b2.a + b3.x.a + b4.d; - result.x.b = b2.b + b3.x.b + b3.y + b4.e; - result.y = b2.b + b3.x.b + b4.e; - - printf("%d %d %d %d %d %d %d: %d %d %d\n", b2.a, (int)b2.b, - b3.x.a, (int)b3.x.b, b3.y, (int)b4.d, b4.e, - result.x.a, (int)result.x.b, result.y); - - return result; -} - -static void -B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct A b0; - struct B b1; - struct C b2; - - b0 = *(struct A*)(args[0]); - b1 = *(struct B*)(args[1]); - b2 = *(struct C*)(args[2]); - - *(B*)resp = B_fn(b0, b1, b2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[4]; - ffi_type* cls_struct_fields[3]; - ffi_type* cls_struct_fields1[3]; - ffi_type* cls_struct_fields2[3]; - ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; - ffi_type* dbl_arg_types[4]; - - struct A e_dbl = { 1, 7LL}; - struct B f_dbl = {{12.0 , 127}, 99}; - struct C g_dbl = { 2, 9}; - - struct B res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_type1.size = 0; - cls_struct_type1.alignment = 0; - cls_struct_type1.type = FFI_TYPE_STRUCT; - cls_struct_type1.elements = cls_struct_fields1; - - cls_struct_type2.size = 0; - cls_struct_type2.alignment = 0; - cls_struct_type2.type = FFI_TYPE_STRUCT; - cls_struct_type2.elements = cls_struct_fields2; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &ffi_type_uint64; - cls_struct_fields[2] = NULL; - - cls_struct_fields1[0] = &cls_struct_type; - cls_struct_fields1[1] = &ffi_type_uchar; - cls_struct_fields1[2] = NULL; - - cls_struct_fields2[0] = &ffi_type_ulong; - cls_struct_fields2[1] = &ffi_type_uchar; - cls_struct_fields2[2] = NULL; - - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type1; - dbl_arg_types[2] = &cls_struct_type2; - dbl_arg_types[3] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = NULL; - - ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); - /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); - - res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); - /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ - CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); - CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); - CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/problem1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/problem1.c deleted file mode 100644 index 6a91555a1fa8ddaf285b777774a9564358b19ee5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/problem1.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure passing with different structure size. - Limitations: none. - PR: none. - Originator: 20030828 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct my_ffi_struct { - double a; - double b; - double c; -} my_ffi_struct; - -my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2) -{ - struct my_ffi_struct result; - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - - printf("%g %g %g %g %g %g: %g %g %g\n", a1.a, a1.b, a1.c, - a2.a, a2.b, a2.c, result.a, result.b, result.c); - - return result; -} - -void stub(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - struct my_ffi_struct a1; - struct my_ffi_struct a2; - - a1 = *(struct my_ffi_struct*)(args[0]); - a2 = *(struct my_ffi_struct*)(args[1]); - - *(my_ffi_struct *)resp = callee(a1, a2); -} - - -int main(void) -{ - ffi_type* my_ffi_struct_fields[4]; - ffi_type my_ffi_struct_type; - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[4]; - ffi_type* arg_types[3]; - - struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; - struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; - struct my_ffi_struct res; - - my_ffi_struct_type.size = 0; - my_ffi_struct_type.alignment = 0; - my_ffi_struct_type.type = FFI_TYPE_STRUCT; - my_ffi_struct_type.elements = my_ffi_struct_fields; - - my_ffi_struct_fields[0] = &ffi_type_double; - my_ffi_struct_fields[1] = &ffi_type_double; - my_ffi_struct_fields[2] = &ffi_type_double; - my_ffi_struct_fields[3] = NULL; - - arg_types[0] = &my_ffi_struct_type; - arg_types[1] = &my_ffi_struct_type; - arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, - arg_types) == FFI_OK); - - args[0] = &g; - args[1] = &f; - args[2] = NULL; - ffi_call(&cif, FFI_FN(callee), &res, args); - /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ - printf("res: %g %g %g\n", res.a, res.b, res.c); - /* { dg-output "\nres: 2 4 6" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK); - - res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f); - /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ - printf("res: %g %g %g\n", res.a, res.b, res.c); - /* { dg-output "\nres: 2 4 6" } */ - - exit(0);; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/promotion.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/promotion.c deleted file mode 100644 index 44561615dd42e63b11eca45da270e25eb688c954..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/promotion.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Area: ffi_call - Purpose: Promotion test. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -static int promotion(signed char sc, signed short ss, - unsigned char uc, unsigned short us) -{ - int r = (int) sc + (int) ss + (int) uc + (int) us; - - return r; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - signed char sc; - unsigned char uc; - signed short ss; - unsigned short us; - unsigned long ul; - - args[0] = &ffi_type_schar; - args[1] = &ffi_type_sshort; - args[2] = &ffi_type_uchar; - args[3] = &ffi_type_ushort; - values[0] = ≻ - values[1] = &ss; - values[2] = &uc; - values[3] = &us; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_sint, args) == FFI_OK); - - us = 0; - ul = 0; - - for (sc = (signed char) -127; - sc <= (signed char) 120; sc += 1) - for (ss = -30000; ss <= 30000; ss += 10000) - for (uc = (unsigned char) 0; - uc <= (unsigned char) 200; uc += 20) - for (us = 0; us <= 60000; us += 10000) - { - ul++; - ffi_call(&cif, FFI_FN(promotion), &rint, values); - CHECK((int)rint == (signed char) sc + (signed short) ss + - (unsigned char) uc + (unsigned short) us); - } - printf("%lu promotion tests run\n", ul); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/pyobjc-tc.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/pyobjc-tc.c deleted file mode 100644 index e29bd6c28368f9c7d8dc6a83772273a7ce9b0482..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/pyobjc-tc.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Area: ffi_call - Purpose: Check different structures. - Limitations: none. - PR: none. - Originator: Ronald Oussoren 20030824 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct Point { - float x; - float y; -} Point; - -typedef struct Size { - float h; - float w; -} Size; - -typedef struct Rect { - Point o; - Size s; -} Rect; - -int doit(int o, char* s, Point p, Rect r, int last) -{ - printf("CALLED WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", - o, s, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, last); - return 42; -} - - -int main(void) -{ - ffi_type point_type; - ffi_type size_type; - ffi_type rect_type; - ffi_cif cif; - ffi_type* arglist[6]; - void* values[6]; - int r; - - /* - * First set up FFI types for the 3 struct types - */ - - point_type.size = 0; /*sizeof(Point);*/ - point_type.alignment = 0; /*__alignof__(Point);*/ - point_type.type = FFI_TYPE_STRUCT; - point_type.elements = malloc(3 * sizeof(ffi_type*)); - point_type.elements[0] = &ffi_type_float; - point_type.elements[1] = &ffi_type_float; - point_type.elements[2] = NULL; - - size_type.size = 0;/* sizeof(Size);*/ - size_type.alignment = 0;/* __alignof__(Size);*/ - size_type.type = FFI_TYPE_STRUCT; - size_type.elements = malloc(3 * sizeof(ffi_type*)); - size_type.elements[0] = &ffi_type_float; - size_type.elements[1] = &ffi_type_float; - size_type.elements[2] = NULL; - - rect_type.size = 0;/*sizeof(Rect);*/ - rect_type.alignment =0;/* __alignof__(Rect);*/ - rect_type.type = FFI_TYPE_STRUCT; - rect_type.elements = malloc(3 * sizeof(ffi_type*)); - rect_type.elements[0] = &point_type; - rect_type.elements[1] = &size_type; - rect_type.elements[2] = NULL; - - /* - * Create a CIF - */ - arglist[0] = &ffi_type_sint; - arglist[1] = &ffi_type_pointer; - arglist[2] = &point_type; - arglist[3] = &rect_type; - arglist[4] = &ffi_type_sint; - arglist[5] = NULL; - - r = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, - 5, &ffi_type_sint, arglist); - if (r != FFI_OK) { - abort(); - } - - - /* And call the function through the CIF */ - - { - Point p = { 1.0, 2.0 }; - Rect r = { { 9.0, 10.0}, { -1.0, -2.0 } }; - int o = 0; - int l = 42; - char* m = "myMethod"; - ffi_arg result; - - values[0] = &o; - values[1] = &m; - values[2] = &p; - values[3] = &r; - values[4] = &l; - values[5] = NULL; - - printf("CALLING WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", - o, m, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, l); - - ffi_call(&cif, FFI_FN(doit), &result, values); - - printf ("The result is %d\n", (int)result); - - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl.c deleted file mode 100644 index fd07e501794d8e43bfd171bc8343261052a5c6fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static double return_dbl(double dbl) -{ - printf ("%f\n", dbl); - return 2 * dbl; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - double dbl, rdbl; - - args[0] = &ffi_type_double; - values[0] = &dbl; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_double, args) == FFI_OK); - - for (dbl = -127.3; dbl < 127; dbl++) - { - ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); - printf ("%f vs %f\n", rdbl, return_dbl(dbl)); - CHECK(rdbl == 2 * dbl); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl1.c deleted file mode 100644 index 0ea5d50551afc6a045b1927173c2a833c11987b3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static double return_dbl(double dbl1, float fl2, unsigned int in3, double dbl4) -{ - return dbl1 + fl2 + in3 + dbl4; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - double dbl1, dbl4, rdbl; - float fl2; - unsigned int in3; - args[0] = &ffi_type_double; - args[1] = &ffi_type_float; - args[2] = &ffi_type_uint; - args[3] = &ffi_type_double; - values[0] = &dbl1; - values[1] = &fl2; - values[2] = &in3; - values[3] = &dbl4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_double, args) == FFI_OK); - dbl1 = 127.0; - fl2 = 128.0; - in3 = 255; - dbl4 = 512.7; - - ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); - printf ("%f vs %f\n", rdbl, return_dbl(dbl1, fl2, in3, dbl4)); - CHECK(rdbl == dbl1 + fl2 + in3 + dbl4); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl2.c deleted file mode 100644 index b3818f866b5dc946dcd78f79417814e249859533..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_dbl2.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value double. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static double return_dbl(double dbl1, double dbl2, unsigned int in3, double dbl4) -{ - return dbl1 + dbl2 + in3 + dbl4; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - double dbl1, dbl2, dbl4, rdbl; - unsigned int in3; - args[0] = &ffi_type_double; - args[1] = &ffi_type_double; - args[2] = &ffi_type_uint; - args[3] = &ffi_type_double; - values[0] = &dbl1; - values[1] = &dbl2; - values[2] = &in3; - values[3] = &dbl4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_double, args) == FFI_OK); - dbl1 = 127.0; - dbl2 = 128.0; - in3 = 255; - dbl4 = 512.7; - - ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); - printf ("%f vs %f\n", rdbl, return_dbl(dbl1, dbl2, in3, dbl4)); - CHECK(rdbl == dbl1 + dbl2 + in3 + dbl4); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl.c deleted file mode 100644 index fb8a09e32ab4fa69fc2e05e7b26450b13453036f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static float return_fl(float fl) -{ - return 2 * fl; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float fl, rfl; - - args[0] = &ffi_type_float; - values[0] = &fl; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_float, args) == FFI_OK); - - for (fl = -127.0; fl < 127; fl++) - { - ffi_call(&cif, FFI_FN(return_fl), &rfl, values); - printf ("%f vs %f\n", rfl, return_fl(fl)); - CHECK(rfl == 2 * fl); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl1.c deleted file mode 100644 index c3d92c283d0b0e4a4e71f28b50dcae087c4a2523..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static float return_fl(float fl1, float fl2) -{ - return fl1 + fl2; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float fl1, fl2, rfl; - - args[0] = &ffi_type_float; - args[1] = &ffi_type_float; - values[0] = &fl1; - values[1] = &fl2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_float, args) == FFI_OK); - fl1 = 127.0; - fl2 = 128.0; - - ffi_call(&cif, FFI_FN(return_fl), &rfl, values); - printf ("%f vs %f\n", rfl, return_fl(fl1, fl2)); - CHECK(rfl == fl1 + fl2); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl2.c deleted file mode 100644 index ddb976cc2bbc71646330747a279f5c0db8635e74..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl2.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -/* Use volatile float to avoid false negative on ix86. See PR target/323. */ -static float return_fl(float fl1, float fl2, float fl3, float fl4) -{ - volatile float sum; - - sum = fl1 + fl2 + fl3 + fl4; - return sum; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float fl1, fl2, fl3, fl4, rfl; - volatile float sum; - - args[0] = &ffi_type_float; - args[1] = &ffi_type_float; - args[2] = &ffi_type_float; - args[3] = &ffi_type_float; - values[0] = &fl1; - values[1] = &fl2; - values[2] = &fl3; - values[3] = &fl4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_float, args) == FFI_OK); - fl1 = 127.0; - fl2 = 128.0; - fl3 = 255.1; - fl4 = 512.7; - - ffi_call(&cif, FFI_FN(return_fl), &rfl, values); - printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); - - sum = fl1 + fl2 + fl3 + fl4; - CHECK(rfl == sum); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl3.c deleted file mode 100644 index c37877b18ec86fcab552d482cf8ec998468d1d71..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_fl3.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value float. - Limitations: none. - PR: none. - Originator: 20050212 */ - -/* { dg-do run } */ -#include "ffitest.h" - -static float return_fl(float fl1, float fl2, unsigned int in3, float fl4) -{ - return fl1 + fl2 + in3 + fl4; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - float fl1, fl2, fl4, rfl; - unsigned int in3; - args[0] = &ffi_type_float; - args[1] = &ffi_type_float; - args[2] = &ffi_type_uint; - args[3] = &ffi_type_float; - values[0] = &fl1; - values[1] = &fl2; - values[2] = &in3; - values[3] = &fl4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &ffi_type_float, args) == FFI_OK); - fl1 = 127.0; - fl2 = 128.0; - in3 = 255; - fl4 = 512.7; - - ffi_call(&cif, FFI_FN(return_fl), &rfl, values); - printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, in3, fl4)); - CHECK(rfl == fl1 + fl2 + in3 + fl4); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ldl.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ldl.c deleted file mode 100644 index 52a92fe0711cfde8b918525309fa12f13eab1e83..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ldl.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value long double. - Limitations: none. - PR: none. - Originator: 20071113 */ -/* { dg-do run } */ - -#include "ffitest.h" - -static long double return_ldl(long double ldl) -{ - return 2*ldl; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - long double ldl, rldl; - - args[0] = &ffi_type_longdouble; - values[0] = &ldl; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_longdouble, args) == FFI_OK); - - for (ldl = -127.0; ldl < 127.0; ldl++) - { - ffi_call(&cif, FFI_FN(return_ldl), &rldl, values); - CHECK(rldl == 2 * ldl); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll.c deleted file mode 100644 index ea4a1e44780c09fe9d7df9a6f84c255700d6a2a0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value long long. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -static long long return_ll(long long ll) -{ - return ll; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - long long rlonglong; - long long ll; - - args[0] = &ffi_type_sint64; - values[0] = ≪ - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_sint64, args) == FFI_OK); - - for (ll = 0LL; ll < 100LL; ll++) - { - ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); - CHECK(rlonglong == ll); - } - - for (ll = 55555555555000LL; ll < 55555555555100LL; ll++) - { - ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); - CHECK(rlonglong == ll); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll1.c deleted file mode 100644 index 593e8a307cec8124b723adc5b797fcbd25e4936f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ll1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Area: ffi_call - Purpose: Check if long long are passed in the corresponding regs on ppc. - Limitations: none. - PR: 20104. - Originator: 20050222 */ - -/* { dg-do run } */ -/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ -#include "ffitest.h" -static long long return_ll(int ll0, long long ll1, int ll2) -{ - return ll0 + ll1 + ll2; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - long long rlonglong; - long long ll1; - unsigned ll0, ll2; - - args[0] = &ffi_type_sint; - args[1] = &ffi_type_sint64; - args[2] = &ffi_type_sint; - values[0] = &ll0; - values[1] = &ll1; - values[2] = &ll2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &ffi_type_sint64, args) == FFI_OK); - - ll0 = 11111111; - ll1 = 11111111111000LL; - ll2 = 11111111; - - ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); - printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2); - /* { dg-output "res: 11111133333222, 11111133333222" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sc.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sc.c deleted file mode 100644 index a36cf3eb8803236f538b6145c850a752a49e369f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sc.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value signed char. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -static signed char return_sc(signed char sc) -{ - return sc; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - signed char sc; - - args[0] = &ffi_type_schar; - values[0] = ≻ - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_schar, args) == FFI_OK); - - for (sc = (signed char) -127; - sc < (signed char) 127; sc++) - { - ffi_call(&cif, FFI_FN(return_sc), &rint, values); - CHECK((signed char)rint == sc); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sl.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sl.c deleted file mode 100644 index f0fd345f7a898ea6ae663db340772a9631803220..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_sl.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Area: ffi_call - Purpose: Check if long as return type is handled correctly. - Limitations: none. - PR: none. - */ - -/* { dg-do run } */ -#include "ffitest.h" -static long return_sl(long l1, long l2) -{ - return l1 - l2; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg res; - unsigned long l1, l2; - - args[0] = &ffi_type_slong; - args[1] = &ffi_type_slong; - values[0] = &l1; - values[1] = &l2; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_slong, args) == FFI_OK); - - l1 = 1073741823L; - l2 = 1073741824L; - - ffi_call(&cif, FFI_FN(return_sl), &res, values); - printf("res: %ld, %ld\n", (long)res, l1 - l2); - /* { dg-output "res: -1, -1" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_uc.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_uc.c deleted file mode 100644 index 6fe554619d522fe481c4970c32ac3c011e6277c0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_uc.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value unsigned char. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -static unsigned char return_uc(unsigned char uc) -{ - return uc; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - - unsigned char uc; - - args[0] = &ffi_type_uchar; - values[0] = &uc; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_uchar, args) == FFI_OK); - - for (uc = (unsigned char) '\x00'; - uc < (unsigned char) '\xff'; uc++) - { - ffi_call(&cif, FFI_FN(return_uc), &rint, values); - CHECK((unsigned char)rint == uc); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ul.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ul.c deleted file mode 100644 index 12b266f0373d23c9b8790cea995abe5c84c959c9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/return_ul.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Area: ffi_call - Purpose: Check if unsigned long as return type is handled correctly. - Limitations: none. - PR: none. - Originator: 20060724 */ - -/* { dg-do run } */ -#include "ffitest.h" -static unsigned long return_ul(unsigned long ul1, unsigned long ul2) -{ - return ul1 + ul2; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg res; - unsigned long ul1, ul2; - - args[0] = &ffi_type_ulong; - args[1] = &ffi_type_ulong; - values[0] = &ul1; - values[1] = &ul2; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, - &ffi_type_ulong, args) == FFI_OK); - - ul1 = 1073741823L; - ul2 = 1073741824L; - - ffi_call(&cif, FFI_FN(return_ul), &res, values); - printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2); - /* { dg-output "res: 2147483647, 2147483647" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large.c deleted file mode 100644 index 71c2469e1c4dc6995fafe9e34533a356cc9bd6d3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure returning with different structure size. - Depending on the ABI. Check bigger struct which overlaps - the gp and fp register count on Darwin/AIX/ppc64. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/21/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -#include "ffitest.h" - -/* 13 FPRs: 104 bytes */ -/* 14 FPRs: 112 bytes */ - -typedef struct struct_108byte { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - int n; -} struct_108byte; - -struct_108byte cls_struct_108byte_fn( - struct_108byte b0, - struct_108byte b1, - struct_108byte b2, - struct_108byte b3) -{ - struct_108byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - result.e = b0.e + b1.e + b2.e + b3.e; - result.f = b0.f + b1.f + b2.f + b3.f; - result.g = b0.g + b1.g + b2.g + b3.g; - result.h = b0.h + b1.h + b2.h + b3.h; - result.i = b0.i + b1.i + b2.i + b3.i; - result.j = b0.j + b1.j + b2.j + b3.j; - result.k = b0.k + b1.k + b2.k + b3.k; - result.l = b0.l + b1.l + b2.l + b3.l; - result.m = b0.m + b1.m + b2.m + b3.m; - result.n = b0.n + b1.n + b2.n + b3.n; - - printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, - result.d, result.e, result.f, result.g, result.h, result.i, - result.j, result.k, result.l, result.m, result.n); - - return result; -} - -static void -cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) -{ - struct_108byte b0, b1, b2, b3; - - b0 = *(struct_108byte*)(args[0]); - b1 = *(struct_108byte*)(args[1]); - b2 = *(struct_108byte*)(args[2]); - b3 = *(struct_108byte*)(args[3]); - - *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[15]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; - struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; - struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; - struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; - struct_108byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_double; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_double; - cls_struct_fields[7] = &ffi_type_double; - cls_struct_fields[8] = &ffi_type_double; - cls_struct_fields[9] = &ffi_type_double; - cls_struct_fields[10] = &ffi_type_double; - cls_struct_fields[11] = &ffi_type_double; - cls_struct_fields[12] = &ffi_type_double; - cls_struct_fields[13] = &ffi_type_sint32; - cls_struct_fields[14] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); - /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, - res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, - struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, - res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large2.c deleted file mode 100644 index d9c750ee1c040928c86ab9f7193caaba57bbddd1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_large2.c +++ /dev/null @@ -1,148 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure returning with different structure size. - Depending on the ABI. Check bigger struct which overlaps - the gp and fp register count on Darwin/AIX/ppc64. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/21/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -#include "ffitest.h" - -/* 13 FPRs: 104 bytes */ -/* 14 FPRs: 112 bytes */ - -typedef struct struct_116byte { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; - double j; - double k; - double l; - double m; - double n; - int o; -} struct_116byte; - -struct_116byte cls_struct_116byte_fn( - struct_116byte b0, - struct_116byte b1, - struct_116byte b2, - struct_116byte b3) -{ - struct_116byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - result.e = b0.e + b1.e + b2.e + b3.e; - result.f = b0.f + b1.f + b2.f + b3.f; - result.g = b0.g + b1.g + b2.g + b3.g; - result.h = b0.h + b1.h + b2.h + b3.h; - result.i = b0.i + b1.i + b2.i + b3.i; - result.j = b0.j + b1.j + b2.j + b3.j; - result.k = b0.k + b1.k + b2.k + b3.k; - result.l = b0.l + b1.l + b2.l + b3.l; - result.m = b0.m + b1.m + b2.m + b3.m; - result.n = b0.n + b1.n + b2.n + b3.n; - result.o = b0.o + b1.o + b2.o + b3.o; - - printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, - result.d, result.e, result.f, result.g, result.h, result.i, - result.j, result.k, result.l, result.m, result.n, result.o); - - return result; -} - -static void -cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) -{ - struct_116byte b0, b1, b2, b3; - - b0 = *(struct_116byte*)(args[0]); - b1 = *(struct_116byte*)(args[1]); - b2 = *(struct_116byte*)(args[2]); - b3 = *(struct_116byte*)(args[3]); - - *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[16]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; - struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; - struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; - struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; - struct_116byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_double; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_double; - cls_struct_fields[7] = &ffi_type_double; - cls_struct_fields[8] = &ffi_type_double; - cls_struct_fields[9] = &ffi_type_double; - cls_struct_fields[10] = &ffi_type_double; - cls_struct_fields[11] = &ffi_type_double; - cls_struct_fields[12] = &ffi_type_double; - cls_struct_fields[13] = &ffi_type_double; - cls_struct_fields[14] = &ffi_type_sint32; - cls_struct_fields[15] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); - /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, - res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, - struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, - res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, - res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium.c deleted file mode 100644 index 973ee02ede887cc20e3e76a4f4b279337e1be679..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure returning with different structure size. - Depending on the ABI. Check bigger struct which overlaps - the gp and fp register count on Darwin/AIX/ppc64. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/21/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -#include "ffitest.h" - -typedef struct struct_72byte { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - double i; -} struct_72byte; - -struct_72byte cls_struct_72byte_fn( - struct_72byte b0, - struct_72byte b1, - struct_72byte b2, - struct_72byte b3) -{ - struct_72byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - result.e = b0.e + b1.e + b2.e + b3.e; - result.f = b0.f + b1.f + b2.f + b3.f; - result.g = b0.g + b1.g + b2.g + b3.g; - result.h = b0.h + b1.h + b2.h + b3.h; - result.i = b0.i + b1.i + b2.i + b3.i; - - printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, - result.d, result.e, result.f, result.g, result.h, result.i); - - return result; -} - -static void -cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) -{ - struct_72byte b0, b1, b2, b3; - - b0 = *(struct_72byte*)(args[0]); - b1 = *(struct_72byte*)(args[1]); - b2 = *(struct_72byte*)(args[2]); - b3 = *(struct_72byte*)(args[3]); - - *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[10]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; - struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; - struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; - struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; - struct_72byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_double; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_double; - cls_struct_fields[7] = &ffi_type_double; - cls_struct_fields[8] = &ffi_type_double; - cls_struct_fields[9] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); - /* { dg-output "22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, - struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium2.c deleted file mode 100644 index 84323d16a918c87084c443a8dbefed8afbdfc696..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/stret_medium2.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure returning with different structure size. - Depending on the ABI. Check bigger struct which overlaps - the gp and fp register count on Darwin/AIX/ppc64. - Limitations: none. - PR: none. - Originator: Blake Chaffin 6/21/2007 */ - -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ -/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ -#include "ffitest.h" - -typedef struct struct_72byte { - double a; - double b; - double c; - double d; - double e; - double f; - double g; - double h; - long long i; -} struct_72byte; - -struct_72byte cls_struct_72byte_fn( - struct_72byte b0, - struct_72byte b1, - struct_72byte b2, - struct_72byte b3) -{ - struct_72byte result; - - result.a = b0.a + b1.a + b2.a + b3.a; - result.b = b0.b + b1.b + b2.b + b3.b; - result.c = b0.c + b1.c + b2.c + b3.c; - result.d = b0.d + b1.d + b2.d + b3.d; - result.e = b0.e + b1.e + b2.e + b3.e; - result.f = b0.f + b1.f + b2.f + b3.f; - result.g = b0.g + b1.g + b2.g + b3.g; - result.h = b0.h + b1.h + b2.h + b3.h; - result.i = b0.i + b1.i + b2.i + b3.i; - - printf("%g %g %g %g %g %g %g %g %" PRIdLL "\n", result.a, result.b, result.c, - result.d, result.e, result.f, result.g, result.h, result.i); - - return result; -} - -static void -cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) -{ - struct_72byte b0, b1, b2, b3; - - b0 = *(struct_72byte*)(args[0]); - b1 = *(struct_72byte*)(args[1]); - b2 = *(struct_72byte*)(args[2]); - b3 = *(struct_72byte*)(args[3]); - - *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_dbl[5]; - ffi_type* cls_struct_fields[10]; - ffi_type cls_struct_type; - ffi_type* dbl_arg_types[5]; - - struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; - struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; - struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; - struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; - struct_72byte res_dbl; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_double; - cls_struct_fields[1] = &ffi_type_double; - cls_struct_fields[2] = &ffi_type_double; - cls_struct_fields[3] = &ffi_type_double; - cls_struct_fields[4] = &ffi_type_double; - cls_struct_fields[5] = &ffi_type_double; - cls_struct_fields[6] = &ffi_type_double; - cls_struct_fields[7] = &ffi_type_double; - cls_struct_fields[8] = &ffi_type_sint64; - cls_struct_fields[9] = NULL; - - dbl_arg_types[0] = &cls_struct_type; - dbl_arg_types[1] = &cls_struct_type; - dbl_arg_types[2] = &cls_struct_type; - dbl_arg_types[3] = &cls_struct_type; - dbl_arg_types[4] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, - dbl_arg_types) == FFI_OK); - - args_dbl[0] = &e_dbl; - args_dbl[1] = &f_dbl; - args_dbl[2] = &g_dbl; - args_dbl[3] = &h_dbl; - args_dbl[4] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); - /* { dg-output "22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); - - res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, - struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); - /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ - printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, - res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); - /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen.c deleted file mode 100644 index 35b70ea4e2e1cfb191d7030e777dfb1c734ad8b2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: ffi_call - Purpose: Check strlen function call. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -static size_t ABI_ATTR my_strlen(char *s) -{ - return (strlen(s)); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - - args[0] = &ffi_type_pointer; - values[0] = (void*) &s; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - ffi_call(&cif, FFI_FN(my_strlen), &rint, values); - CHECK(rint == 1); - - s = "1234567"; - ffi_call(&cif, FFI_FN(my_strlen), &rint, values); - CHECK(rint == 7); - - s = "1234567890123456789012345"; - ffi_call(&cif, FFI_FN(my_strlen), &rint, values); - CHECK(rint == 25); - - exit (0); -} - diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen2.c deleted file mode 100644 index 96282bc0a1fa45d8d8cdaf59ee855fdd63785cf3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen2.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Area: ffi_call - Purpose: Check strlen function call with additional arguments. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static size_t ABI_ATTR my_f(char *s, float a) -{ - return (size_t) ((int) strlen(s) + (int) a); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - float v2; - args[0] = &ffi_type_pointer; - args[1] = &ffi_type_float; - values[0] = (void*) &s; - values[1] = (void*) &v2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - v2 = 0.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 1); - - s = "1234567"; - v2 = -1.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 6); - - s = "1234567890123456789012345"; - v2 = 1.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 26); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen3.c deleted file mode 100644 index beba86e9eacf4910fc416b7ec6f443153a66536b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen3.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Area: ffi_call - Purpose: Check strlen function call with additional arguments. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static size_t ABI_ATTR my_f(float a, char *s) -{ - return (size_t) ((int) strlen(s) + (int) a); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - float v2; - args[1] = &ffi_type_pointer; - args[0] = &ffi_type_float; - values[1] = (void*) &s; - values[0] = (void*) &v2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - v2 = 0.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 1); - - s = "1234567"; - v2 = -1.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 6); - - s = "1234567890123456789012345"; - v2 = 1.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 26); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen4.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen4.c deleted file mode 100644 index d5d42b4f6ddff4d3181eafebe20c9489c5859e98..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/strlen4.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Area: ffi_call - Purpose: Check strlen function call with additional arguments. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ - -#include "ffitest.h" - -static size_t ABI_ATTR my_f(float a, char *s, int i) -{ - return (size_t) ((int) strlen(s) + (int) a + i); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - int v1; - float v2; - args[2] = &ffi_type_sint; - args[1] = &ffi_type_pointer; - args[0] = &ffi_type_float; - values[2] = (void*) &v1; - values[1] = (void*) &s; - values[0] = (void*) &v2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 3, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - v1 = 1; - v2 = 0.0; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 2); - - s = "1234567"; - v2 = -1.0; - v1 = -2; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 4); - - s = "1234567890123456789012345"; - v2 = 1.0; - v1 = 2; - ffi_call(&cif, FFI_FN(my_f), &rint, values); - CHECK(rint == 28); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct1.c deleted file mode 100644 index c13e23f872734ebc70cba1fb47796e722ddac0e0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - unsigned char uc; - double d; - unsigned int ui; -} test_structure_1; - -static test_structure_1 ABI_ATTR struct1(test_structure_1 ts) -{ - ts.uc++; - ts.d--; - ts.ui++; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts1_type; - ffi_type *ts1_type_elements[4]; - - test_structure_1 ts1_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - - ts1_type.size = 0; - ts1_type.alignment = 0; - ts1_type.type = FFI_TYPE_STRUCT; - ts1_type.elements = ts1_type_elements; - ts1_type_elements[0] = &ffi_type_uchar; - ts1_type_elements[1] = &ffi_type_double; - ts1_type_elements[2] = &ffi_type_uint; - ts1_type_elements[3] = NULL; - - args[0] = &ts1_type; - values[0] = &ts1_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, - &ts1_type, args) == FFI_OK); - - ts1_arg.uc = '\x01'; - ts1_arg.d = 3.14159; - ts1_arg.ui = 555; - - ffi_call(&cif, FFI_FN(struct1), ts1_result, values); - - CHECK(ts1_result->ui == 556); - CHECK(ts1_result->d == 3.14159 - 1); - - free (ts1_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct2.c deleted file mode 100644 index 5077a5ee45a5fe6f1658c0aa498450026a616f02..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct2.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - double d1; - double d2; -} test_structure_2; - -static test_structure_2 ABI_ATTR struct2(test_structure_2 ts) -{ - ts.d1--; - ts.d2--; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - test_structure_2 ts2_arg; - ffi_type ts2_type; - ffi_type *ts2_type_elements[3]; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_2 *ts2_result = - (test_structure_2 *) malloc (sizeof(test_structure_2)); - - ts2_type.size = 0; - ts2_type.alignment = 0; - ts2_type.type = FFI_TYPE_STRUCT; - ts2_type.elements = ts2_type_elements; - ts2_type_elements[0] = &ffi_type_double; - ts2_type_elements[1] = &ffi_type_double; - ts2_type_elements[2] = NULL; - - args[0] = &ts2_type; - values[0] = &ts2_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts2_type, args) == FFI_OK); - - ts2_arg.d1 = 5.55; - ts2_arg.d2 = 6.66; - - printf ("%g\n", ts2_arg.d1); - printf ("%g\n", ts2_arg.d2); - - ffi_call(&cif, FFI_FN(struct2), ts2_result, values); - - printf ("%g\n", ts2_result->d1); - printf ("%g\n", ts2_result->d2); - - CHECK(ts2_result->d1 == 5.55 - 1); - CHECK(ts2_result->d2 == 6.66 - 1); - - free (ts2_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct3.c deleted file mode 100644 index 7eba0ead6d6a8964263a7df59a52d7d28ec27a83..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - int si; -} test_structure_3; - -static test_structure_3 ABI_ATTR struct3(test_structure_3 ts) -{ - ts.si = -(ts.si*2); - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - int compare_value; - ffi_type ts3_type; - ffi_type *ts3_type_elements[2]; - - test_structure_3 ts3_arg; - test_structure_3 *ts3_result = - (test_structure_3 *) malloc (sizeof(test_structure_3)); - - ts3_type.size = 0; - ts3_type.alignment = 0; - ts3_type.type = FFI_TYPE_STRUCT; - ts3_type.elements = ts3_type_elements; - ts3_type_elements[0] = &ffi_type_sint; - ts3_type_elements[1] = NULL; - - args[0] = &ts3_type; - values[0] = &ts3_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, - &ts3_type, args) == FFI_OK); - - ts3_arg.si = -123; - compare_value = ts3_arg.si; - - ffi_call(&cif, FFI_FN(struct3), ts3_result, values); - - printf ("%d %d\n", ts3_result->si, -(compare_value*2)); - - CHECK(ts3_result->si == -(compare_value*2)); - - free (ts3_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct4.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct4.c deleted file mode 100644 index 66a9551dd65032cd1124fe4758ff1134cebd2b7b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct4.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - unsigned ui1; - unsigned ui2; - unsigned ui3; -} test_structure_4; - -static test_structure_4 ABI_ATTR struct4(test_structure_4 ts) -{ - ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts4_type; - ffi_type *ts4_type_elements[4]; - - test_structure_4 ts4_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_4 *ts4_result = - (test_structure_4 *) malloc (sizeof(test_structure_4)); - - ts4_type.size = 0; - ts4_type.alignment = 0; - ts4_type.type = FFI_TYPE_STRUCT; - ts4_type.elements = ts4_type_elements; - ts4_type_elements[0] = &ffi_type_uint; - ts4_type_elements[1] = &ffi_type_uint; - ts4_type_elements[2] = &ffi_type_uint; - ts4_type_elements[3] = NULL; - - args[0] = &ts4_type; - values[0] = &ts4_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts4_type, args) == FFI_OK); - - ts4_arg.ui1 = 2; - ts4_arg.ui2 = 3; - ts4_arg.ui3 = 4; - - ffi_call (&cif, FFI_FN(struct4), ts4_result, values); - - CHECK(ts4_result->ui3 == 2U * 3U * 4U); - - - free (ts4_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct5.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct5.c deleted file mode 100644 index 23e2a3f745c8b7a85df0c3bfd37f79808e855a78..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct5.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -typedef struct -{ - char c1; - char c2; -} test_structure_5; - -static test_structure_5 ABI_ATTR struct5(test_structure_5 ts1, test_structure_5 ts2) -{ - ts1.c1 += ts2.c1; - ts1.c2 -= ts2.c2; - - return ts1; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts5_type; - ffi_type *ts5_type_elements[3]; - - test_structure_5 ts5_arg1, ts5_arg2; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_5 *ts5_result = - (test_structure_5 *) malloc (sizeof(test_structure_5)); - - ts5_type.size = 0; - ts5_type.alignment = 0; - ts5_type.type = FFI_TYPE_STRUCT; - ts5_type.elements = ts5_type_elements; - ts5_type_elements[0] = &ffi_type_schar; - ts5_type_elements[1] = &ffi_type_schar; - ts5_type_elements[2] = NULL; - - args[0] = &ts5_type; - args[1] = &ts5_type; - values[0] = &ts5_arg1; - values[1] = &ts5_arg2; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts5_type, args) == FFI_OK); - - ts5_arg1.c1 = 2; - ts5_arg1.c2 = 6; - ts5_arg2.c1 = 5; - ts5_arg2.c2 = 3; - - ffi_call (&cif, FFI_FN(struct5), ts5_result, values); - - CHECK(ts5_result->c1 == 7); - CHECK(ts5_result->c2 == 3); - - - free (ts5_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct6.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct6.c deleted file mode 100644 index 173c66eb4d2bf07aba628896d51e3e8b28dde586..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct6.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -typedef struct -{ - float f; - double d; -} test_structure_6; - -static test_structure_6 ABI_ATTR struct6 (test_structure_6 ts) -{ - ts.f += 1; - ts.d += 1; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts6_type; - ffi_type *ts6_type_elements[3]; - - test_structure_6 ts6_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_6 *ts6_result = - (test_structure_6 *) malloc (sizeof(test_structure_6)); - - ts6_type.size = 0; - ts6_type.alignment = 0; - ts6_type.type = FFI_TYPE_STRUCT; - ts6_type.elements = ts6_type_elements; - ts6_type_elements[0] = &ffi_type_float; - ts6_type_elements[1] = &ffi_type_double; - ts6_type_elements[2] = NULL; - - args[0] = &ts6_type; - values[0] = &ts6_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts6_type, args) == FFI_OK); - - ts6_arg.f = 5.55f; - ts6_arg.d = 6.66; - - printf ("%g\n", ts6_arg.f); - printf ("%g\n", ts6_arg.d); - - ffi_call(&cif, FFI_FN(struct6), ts6_result, values); - - CHECK(ts6_result->f == 5.55f + 1); - CHECK(ts6_result->d == 6.66 + 1); - - free (ts6_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct7.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct7.c deleted file mode 100644 index badc7e055609387bf6c09e32b7916919a5320aa1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct7.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -typedef struct -{ - float f1; - float f2; - double d; -} test_structure_7; - -static test_structure_7 ABI_ATTR struct7 (test_structure_7 ts) -{ - ts.f1 += 1; - ts.f2 += 1; - ts.d += 1; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts7_type; - ffi_type *ts7_type_elements[4]; - - test_structure_7 ts7_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_7 *ts7_result = - (test_structure_7 *) malloc (sizeof(test_structure_7)); - - ts7_type.size = 0; - ts7_type.alignment = 0; - ts7_type.type = FFI_TYPE_STRUCT; - ts7_type.elements = ts7_type_elements; - ts7_type_elements[0] = &ffi_type_float; - ts7_type_elements[1] = &ffi_type_float; - ts7_type_elements[2] = &ffi_type_double; - ts7_type_elements[3] = NULL; - - args[0] = &ts7_type; - values[0] = &ts7_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts7_type, args) == FFI_OK); - - ts7_arg.f1 = 5.55f; - ts7_arg.f2 = 55.5f; - ts7_arg.d = 6.66; - - printf ("%g\n", ts7_arg.f1); - printf ("%g\n", ts7_arg.f2); - printf ("%g\n", ts7_arg.d); - - ffi_call(&cif, FFI_FN(struct7), ts7_result, values); - - printf ("%g\n", ts7_result->f1); - printf ("%g\n", ts7_result->f2); - printf ("%g\n", ts7_result->d); - - CHECK(ts7_result->f1 == 5.55f + 1); - CHECK(ts7_result->f2 == 55.5f + 1); - CHECK(ts7_result->d == 6.66 + 1); - - free (ts7_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct8.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct8.c deleted file mode 100644 index ef204ecbbce5074389f51b192243cf25b9a75ecc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct8.c +++ /dev/null @@ -1,81 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" -typedef struct -{ - float f1; - float f2; - float f3; - float f4; -} test_structure_8; - -static test_structure_8 ABI_ATTR struct8 (test_structure_8 ts) -{ - ts.f1 += 1; - ts.f2 += 1; - ts.f3 += 1; - ts.f4 += 1; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts8_type; - ffi_type *ts8_type_elements[5]; - - test_structure_8 ts8_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_8 *ts8_result = - (test_structure_8 *) malloc (sizeof(test_structure_8)); - - ts8_type.size = 0; - ts8_type.alignment = 0; - ts8_type.type = FFI_TYPE_STRUCT; - ts8_type.elements = ts8_type_elements; - ts8_type_elements[0] = &ffi_type_float; - ts8_type_elements[1] = &ffi_type_float; - ts8_type_elements[2] = &ffi_type_float; - ts8_type_elements[3] = &ffi_type_float; - ts8_type_elements[4] = NULL; - - args[0] = &ts8_type; - values[0] = &ts8_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts8_type, args) == FFI_OK); - - ts8_arg.f1 = 5.55f; - ts8_arg.f2 = 55.5f; - ts8_arg.f3 = -5.55f; - ts8_arg.f4 = -55.5f; - - printf ("%g\n", ts8_arg.f1); - printf ("%g\n", ts8_arg.f2); - printf ("%g\n", ts8_arg.f3); - printf ("%g\n", ts8_arg.f4); - - ffi_call(&cif, FFI_FN(struct8), ts8_result, values); - - printf ("%g\n", ts8_result->f1); - printf ("%g\n", ts8_result->f2); - printf ("%g\n", ts8_result->f3); - printf ("%g\n", ts8_result->f4); - - CHECK(ts8_result->f1 == 5.55f + 1); - CHECK(ts8_result->f2 == 55.5f + 1); - CHECK(ts8_result->f3 == -5.55f + 1); - CHECK(ts8_result->f4 == -55.5f + 1); - - free (ts8_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct9.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct9.c deleted file mode 100644 index 4a13b818c4ee0693604a6d41eb00c10067ee4273..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/struct9.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - float f; - int i; -} test_structure_9; - -static test_structure_9 ABI_ATTR struct9 (test_structure_9 ts) -{ - ts.f += 1; - ts.i += 1; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts9_type; - ffi_type *ts9_type_elements[3]; - - test_structure_9 ts9_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_9 *ts9_result = - (test_structure_9 *) malloc (sizeof(test_structure_9)); - - ts9_type.size = 0; - ts9_type.alignment = 0; - ts9_type.type = FFI_TYPE_STRUCT; - ts9_type.elements = ts9_type_elements; - ts9_type_elements[0] = &ffi_type_float; - ts9_type_elements[1] = &ffi_type_sint; - ts9_type_elements[2] = NULL; - - args[0] = &ts9_type; - values[0] = &ts9_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts9_type, args) == FFI_OK); - - ts9_arg.f = 5.55f; - ts9_arg.i = 5; - - printf ("%g\n", ts9_arg.f); - printf ("%d\n", ts9_arg.i); - - ffi_call(&cif, FFI_FN(struct9), ts9_result, values); - - printf ("%g\n", ts9_result->f); - printf ("%d\n", ts9_result->i); - - CHECK(ts9_result->f == 5.55f + 1); - CHECK(ts9_result->i == 5 + 1); - - free (ts9_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/testclosure.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/testclosure.c deleted file mode 100644 index ca31056d8c834059a936ab625cd96f967bfc6235..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/testclosure.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Area: closure_call - Purpose: Check return value float. - Limitations: none. - PR: 41908. - Originator: 20091102 */ - -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct cls_struct_combined { - float a; - float b; - float c; - float d; -} cls_struct_combined; - -void cls_struct_combined_fn(struct cls_struct_combined arg) -{ - printf("%g %g %g %g\n", - arg.a, arg.b, - arg.c, arg.d); - fflush(stdout); -} - -static void -cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, - void** args, void* userdata __UNUSED__) -{ - struct cls_struct_combined a0; - - a0 = *(struct cls_struct_combined*)(args[0]); - - cls_struct_combined_fn(a0); -} - - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type* cls_struct_fields0[5]; - ffi_type cls_struct_type0; - ffi_type* dbl_arg_types[5]; - - struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; - - cls_struct_type0.size = 0; - cls_struct_type0.alignment = 0; - cls_struct_type0.type = FFI_TYPE_STRUCT; - cls_struct_type0.elements = cls_struct_fields0; - - cls_struct_fields0[0] = &ffi_type_float; - cls_struct_fields0[1] = &ffi_type_float; - cls_struct_fields0[2] = &ffi_type_float; - cls_struct_fields0[3] = &ffi_type_float; - cls_struct_fields0[4] = NULL; - - dbl_arg_types[0] = &cls_struct_type0; - dbl_arg_types[1] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, - dbl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); - - ((void(*)(cls_struct_combined)) (code))(g_dbl); - /* { dg-output "4 5 1 8" } */ - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/uninitialized.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/uninitialized.c deleted file mode 100644 index f00d8302349dfc1e2de3b2f01a33b18763ee884d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/uninitialized.c +++ /dev/null @@ -1,61 +0,0 @@ -/* { dg-do run } */ -#include "ffitest.h" - -typedef struct -{ - unsigned char uc; - double d; - unsigned int ui; -} test_structure_1; - -static test_structure_1 struct1(test_structure_1 ts) -{ - ts.uc++; - ts.d--; - ts.ui++; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts1_type; - ffi_type *ts1_type_elements[4]; - - memset(&cif, 1, sizeof(cif)); - ts1_type.size = 0; - ts1_type.alignment = 0; - ts1_type.type = FFI_TYPE_STRUCT; - ts1_type.elements = ts1_type_elements; - ts1_type_elements[0] = &ffi_type_uchar; - ts1_type_elements[1] = &ffi_type_double; - ts1_type_elements[2] = &ffi_type_uint; - ts1_type_elements[3] = NULL; - - test_structure_1 ts1_arg; - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - - args[0] = &ts1_type; - values[0] = &ts1_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ts1_type, args) == FFI_OK); - - ts1_arg.uc = '\x01'; - ts1_arg.d = 3.14159; - ts1_arg.ui = 555; - - ffi_call(&cif, FFI_FN(struct1), ts1_result, values); - - CHECK(ts1_result->ui == 556); - CHECK(ts1_result->d == 3.14159 - 1); - - free (ts1_result); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_1.c deleted file mode 100644 index 7f96809ea9ecf180805c5ace9f57a342ab591992..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_1.c +++ /dev/null @@ -1,196 +0,0 @@ -/* Area: ffi_call - Purpose: Test passing struct in variable argument lists. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -/* { dg-output "" { xfail avr32*-*-* } } */ - -#include "ffitest.h" -#include - -struct small_tag -{ - unsigned char a; - unsigned char b; -}; - -struct large_tag -{ - unsigned a; - unsigned b; - unsigned c; - unsigned d; - unsigned e; -}; - -static int -test_fn (int n, ...) -{ - va_list ap; - struct small_tag s1; - struct small_tag s2; - struct large_tag l; - unsigned char uc; - signed char sc; - unsigned short us; - signed short ss; - unsigned int ui; - signed int si; - unsigned long ul; - signed long sl; - float f; - double d; - - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); - s2 = va_arg (ap, struct small_tag); - - uc = va_arg (ap, unsigned); - sc = va_arg (ap, signed); - - us = va_arg (ap, unsigned); - ss = va_arg (ap, signed); - - ui = va_arg (ap, unsigned int); - si = va_arg (ap, signed int); - - ul = va_arg (ap, unsigned long); - sl = va_arg (ap, signed long); - - f = va_arg (ap, double); /* C standard promotes float->double - when anonymous */ - d = va_arg (ap, double); - - printf ("%u %u %u %u %u %u %u %u %u uc=%u sc=%d %u %d %u %d %lu %ld %f %f\n", - s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, - s2.a, s2.b, - uc, sc, - us, ss, - ui, si, - ul, sl, - f, d); - va_end (ap); - return n + 1; -} - -int -main (void) -{ - ffi_cif cif; - void* args[15]; - ffi_type* arg_types[15]; - - ffi_type s_type; - ffi_type *s_type_elements[3]; - - ffi_type l_type; - ffi_type *l_type_elements[6]; - - struct small_tag s1; - struct small_tag s2; - struct large_tag l1; - - int n; - ffi_arg res; - - unsigned char uc; - signed char sc; - unsigned short us; - signed short ss; - unsigned int ui; - signed int si; - unsigned long ul; - signed long sl; - double d1; - double f1; - - s_type.size = 0; - s_type.alignment = 0; - s_type.type = FFI_TYPE_STRUCT; - s_type.elements = s_type_elements; - - s_type_elements[0] = &ffi_type_uchar; - s_type_elements[1] = &ffi_type_uchar; - s_type_elements[2] = NULL; - - l_type.size = 0; - l_type.alignment = 0; - l_type.type = FFI_TYPE_STRUCT; - l_type.elements = l_type_elements; - - l_type_elements[0] = &ffi_type_uint; - l_type_elements[1] = &ffi_type_uint; - l_type_elements[2] = &ffi_type_uint; - l_type_elements[3] = &ffi_type_uint; - l_type_elements[4] = &ffi_type_uint; - l_type_elements[5] = NULL; - - arg_types[0] = &ffi_type_sint; - arg_types[1] = &s_type; - arg_types[2] = &l_type; - arg_types[3] = &s_type; - arg_types[4] = &ffi_type_uchar; - arg_types[5] = &ffi_type_schar; - arg_types[6] = &ffi_type_ushort; - arg_types[7] = &ffi_type_sshort; - arg_types[8] = &ffi_type_uint; - arg_types[9] = &ffi_type_sint; - arg_types[10] = &ffi_type_ulong; - arg_types[11] = &ffi_type_slong; - arg_types[12] = &ffi_type_double; - arg_types[13] = &ffi_type_double; - arg_types[14] = NULL; - - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 14, &ffi_type_sint, arg_types) == FFI_OK); - - s1.a = 5; - s1.b = 6; - - l1.a = 10; - l1.b = 11; - l1.c = 12; - l1.d = 13; - l1.e = 14; - - s2.a = 7; - s2.b = 8; - - n = 41; - - uc = 9; - sc = 10; - us = 11; - ss = 12; - ui = 13; - si = 14; - ul = 15; - sl = 16; - f1 = 2.12; - d1 = 3.13; - - args[0] = &n; - args[1] = &s1; - args[2] = &l1; - args[3] = &s2; - args[4] = &uc; - args[5] = ≻ - args[6] = &us; - args[7] = &ss; - args[8] = &ui; - args[9] = &si; - args[10] = &ul; - args[11] = &sl; - args[12] = &f1; - args[13] = &d1; - args[14] = NULL; - - ffi_call(&cif, FFI_FN(test_fn), &res, args); - /* { dg-output "5 6 10 11 12 13 14 7 8 uc=9 sc=10 11 12 13 14 15 16 2.120000 3.130000" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 42" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct1.c deleted file mode 100644 index e6452061c1d3b5427c41b062186a329e080a9f41..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct1.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Area: ffi_call - Purpose: Test passing struct in variable argument lists. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -/* { dg-output "" { xfail avr32*-*-* } } */ - -#include "ffitest.h" -#include - -struct small_tag -{ - unsigned char a; - unsigned char b; -}; - -struct large_tag -{ - unsigned a; - unsigned b; - unsigned c; - unsigned d; - unsigned e; -}; - -static int -test_fn (int n, ...) -{ - va_list ap; - struct small_tag s1; - struct small_tag s2; - struct large_tag l; - - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); - s2 = va_arg (ap, struct small_tag); - printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, - s2.a, s2.b); - va_end (ap); - return n + 1; -} - -int -main (void) -{ - ffi_cif cif; - void* args[5]; - ffi_type* arg_types[5]; - - ffi_type s_type; - ffi_type *s_type_elements[3]; - - ffi_type l_type; - ffi_type *l_type_elements[6]; - - struct small_tag s1; - struct small_tag s2; - struct large_tag l1; - - int n; - ffi_arg res; - - s_type.size = 0; - s_type.alignment = 0; - s_type.type = FFI_TYPE_STRUCT; - s_type.elements = s_type_elements; - - s_type_elements[0] = &ffi_type_uchar; - s_type_elements[1] = &ffi_type_uchar; - s_type_elements[2] = NULL; - - l_type.size = 0; - l_type.alignment = 0; - l_type.type = FFI_TYPE_STRUCT; - l_type.elements = l_type_elements; - - l_type_elements[0] = &ffi_type_uint; - l_type_elements[1] = &ffi_type_uint; - l_type_elements[2] = &ffi_type_uint; - l_type_elements[3] = &ffi_type_uint; - l_type_elements[4] = &ffi_type_uint; - l_type_elements[5] = NULL; - - arg_types[0] = &ffi_type_sint; - arg_types[1] = &s_type; - arg_types[2] = &l_type; - arg_types[3] = &s_type; - arg_types[4] = NULL; - - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &ffi_type_sint, arg_types) == FFI_OK); - - s1.a = 5; - s1.b = 6; - - l1.a = 10; - l1.b = 11; - l1.c = 12; - l1.d = 13; - l1.e = 14; - - s2.a = 7; - s2.b = 8; - - n = 41; - - args[0] = &n; - args[1] = &s1; - args[2] = &l1; - args[3] = &s2; - args[4] = NULL; - - ffi_call(&cif, FFI_FN(test_fn), &res, args); - /* { dg-output "5 6 10 11 12 13 14 7 8" } */ - printf("res: %d\n", (int) res); - /* { dg-output "\nres: 42" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct2.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct2.c deleted file mode 100644 index 56f5b9c75fa387c953420c7caa36feca089d65a6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct2.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Area: ffi_call - Purpose: Test passing struct in variable argument lists. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -/* { dg-output "" { xfail avr32*-*-* } } */ - -#include "ffitest.h" -#include - -struct small_tag -{ - unsigned char a; - unsigned char b; -}; - -struct large_tag -{ - unsigned a; - unsigned b; - unsigned c; - unsigned d; - unsigned e; -}; - -static struct small_tag -test_fn (int n, ...) -{ - va_list ap; - struct small_tag s1; - struct small_tag s2; - struct large_tag l; - - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); - s2 = va_arg (ap, struct small_tag); - printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, - s2.a, s2.b); - va_end (ap); - s1.a += s2.a; - s1.b += s2.b; - return s1; -} - -int -main (void) -{ - ffi_cif cif; - void* args[5]; - ffi_type* arg_types[5]; - - ffi_type s_type; - ffi_type *s_type_elements[3]; - - ffi_type l_type; - ffi_type *l_type_elements[6]; - - struct small_tag s1; - struct small_tag s2; - struct large_tag l1; - - int n; - struct small_tag res; - - s_type.size = 0; - s_type.alignment = 0; - s_type.type = FFI_TYPE_STRUCT; - s_type.elements = s_type_elements; - - s_type_elements[0] = &ffi_type_uchar; - s_type_elements[1] = &ffi_type_uchar; - s_type_elements[2] = NULL; - - l_type.size = 0; - l_type.alignment = 0; - l_type.type = FFI_TYPE_STRUCT; - l_type.elements = l_type_elements; - - l_type_elements[0] = &ffi_type_uint; - l_type_elements[1] = &ffi_type_uint; - l_type_elements[2] = &ffi_type_uint; - l_type_elements[3] = &ffi_type_uint; - l_type_elements[4] = &ffi_type_uint; - l_type_elements[5] = NULL; - - arg_types[0] = &ffi_type_sint; - arg_types[1] = &s_type; - arg_types[2] = &l_type; - arg_types[3] = &s_type; - arg_types[4] = NULL; - - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &s_type, arg_types) == FFI_OK); - - s1.a = 5; - s1.b = 6; - - l1.a = 10; - l1.b = 11; - l1.c = 12; - l1.d = 13; - l1.e = 14; - - s2.a = 7; - s2.b = 8; - - n = 41; - - args[0] = &n; - args[1] = &s1; - args[2] = &l1; - args[3] = &s2; - args[4] = NULL; - - ffi_call(&cif, FFI_FN(test_fn), &res, args); - /* { dg-output "5 6 10 11 12 13 14 7 8" } */ - printf("res: %d %d\n", res.a, res.b); - /* { dg-output "\nres: 12 14" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct3.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct3.c deleted file mode 100644 index 9a27e7fd4a34e32a856c0ab984999b78b70044f7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.call/va_struct3.c +++ /dev/null @@ -1,125 +0,0 @@ -/* Area: ffi_call - Purpose: Test passing struct in variable argument lists. - Limitations: none. - PR: none. - Originator: ARM Ltd. */ - -/* { dg-do run } */ -/* { dg-output "" { xfail avr32*-*-* } } */ - -#include "ffitest.h" -#include - -struct small_tag -{ - unsigned char a; - unsigned char b; -}; - -struct large_tag -{ - unsigned a; - unsigned b; - unsigned c; - unsigned d; - unsigned e; -}; - -static struct large_tag -test_fn (int n, ...) -{ - va_list ap; - struct small_tag s1; - struct small_tag s2; - struct large_tag l; - - va_start (ap, n); - s1 = va_arg (ap, struct small_tag); - l = va_arg (ap, struct large_tag); - s2 = va_arg (ap, struct small_tag); - printf ("%u %u %u %u %u %u %u %u %u\n", s1.a, s1.b, l.a, l.b, l.c, l.d, l.e, - s2.a, s2.b); - va_end (ap); - l.a += s1.a; - l.b += s1.b; - l.c += s2.a; - l.d += s2.b; - return l; -} - -int -main (void) -{ - ffi_cif cif; - void* args[5]; - ffi_type* arg_types[5]; - - ffi_type s_type; - ffi_type *s_type_elements[3]; - - ffi_type l_type; - ffi_type *l_type_elements[6]; - - struct small_tag s1; - struct small_tag s2; - struct large_tag l1; - - int n; - struct large_tag res; - - s_type.size = 0; - s_type.alignment = 0; - s_type.type = FFI_TYPE_STRUCT; - s_type.elements = s_type_elements; - - s_type_elements[0] = &ffi_type_uchar; - s_type_elements[1] = &ffi_type_uchar; - s_type_elements[2] = NULL; - - l_type.size = 0; - l_type.alignment = 0; - l_type.type = FFI_TYPE_STRUCT; - l_type.elements = l_type_elements; - - l_type_elements[0] = &ffi_type_uint; - l_type_elements[1] = &ffi_type_uint; - l_type_elements[2] = &ffi_type_uint; - l_type_elements[3] = &ffi_type_uint; - l_type_elements[4] = &ffi_type_uint; - l_type_elements[5] = NULL; - - arg_types[0] = &ffi_type_sint; - arg_types[1] = &s_type; - arg_types[2] = &l_type; - arg_types[3] = &s_type; - arg_types[4] = NULL; - - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 4, &l_type, arg_types) == FFI_OK); - - s1.a = 5; - s1.b = 6; - - l1.a = 10; - l1.b = 11; - l1.c = 12; - l1.d = 13; - l1.e = 14; - - s2.a = 7; - s2.b = 8; - - n = 41; - - args[0] = &n; - args[1] = &s1; - args[2] = &l1; - args[3] = &s2; - args[4] = NULL; - - ffi_call(&cif, FFI_FN(test_fn), &res, args); - /* { dg-output "5 6 10 11 12 13 14 7 8" } */ - printf("res: %d %d %d %d %d\n", res.a, res.b, res.c, res.d, res.e); - /* { dg-output "\nres: 15 17 19 21 14" } */ - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex.inc deleted file mode 100644 index 4a812edf055e9b7d1c230e21e2c724a0a067e38a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex.inc +++ /dev/null @@ -1,91 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -typedef struct cls_struct_align { - unsigned char a; - _Complex T_C_TYPE b; - unsigned char c; -} cls_struct_align; - -cls_struct_align cls_struct_align_fn( - struct cls_struct_align a1, struct cls_struct_align a2) -{ - struct cls_struct_align result; - - result.a = a1.a + a2.a; - result.b = a1.b + a2.b; - result.c = a1.c + a2.c; - - printf("%d %f,%fi %d %d %f,%fi %d: %d %f,%fi %d\n", - a1.a, T_CONV creal (a1.b), T_CONV cimag (a1.b), a1.c, - a2.a, T_CONV creal (a2.b), T_CONV cimag (a2.b), a2.c, - result.a, T_CONV creal (result.b), T_CONV cimag (result.b), result.c); - - return result; -} - -static void -cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) -{ - - struct cls_struct_align a1, a2; - - a1 = *(struct cls_struct_align*)(args[0]); - a2 = *(struct cls_struct_align*)(args[1]); - - *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args_c[5]; - ffi_type* cls_struct_fields[4]; - ffi_type cls_struct_type; - ffi_type* c_arg_types[5]; - - struct cls_struct_align g_c = { 12, 4951 + 7 * I, 127 }; - struct cls_struct_align f_c = { 1, 9320 + 1 * I, 13 }; - struct cls_struct_align res_c; - - cls_struct_type.size = 0; - cls_struct_type.alignment = 0; - cls_struct_type.type = FFI_TYPE_STRUCT; - cls_struct_type.elements = cls_struct_fields; - - cls_struct_fields[0] = &ffi_type_uchar; - cls_struct_fields[1] = &T_FFI_TYPE; - cls_struct_fields[2] = &ffi_type_uchar; - cls_struct_fields[3] = NULL; - - c_arg_types[0] = &cls_struct_type; - c_arg_types[1] = &cls_struct_type; - c_arg_types[2] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, - c_arg_types) == FFI_OK); - - args_c[0] = &g_c; - args_c[1] = &f_c; - args_c[2] = NULL; - - ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_c, args_c); - /* { dg-output "12 4951,7i 127 1 9320,1i 13: 13 14271,8i 140" } */ - printf("res: %d %f,%fi %d\n", - res_c.a, T_CONV creal (res_c.b), T_CONV cimag (res_c.b), res_c.c); - /* { dg-output "\nres: 13 14271,8i 140" } */ - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); - - res_c = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_c, f_c); - /* { dg-output "\n12 4951,7i 127 1 9320,1i 13: 13 14271,8i 140" } */ - printf("res: %d %f,%fi %d\n", - res_c.a, T_CONV creal (res_c.b), T_CONV cimag (res_c.b), res_c.c); - /* { dg-output "\nres: 13 14271,8i 140" } */ - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_double.c deleted file mode 100644 index 0dff23ae47c35fe4eb50a388468547e63bd416c4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "cls_align_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_float.c deleted file mode 100644 index 0affbd07e53d6f842a4bd524d3faf7d291df4474..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "cls_align_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c deleted file mode 100644 index 7889ba859b54f68d2e17788ff14f813e5149aaa7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_align_complex_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check structure alignment of complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "cls_align_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex.inc deleted file mode 100644 index f9374044e8781a4b6f8ff2a685bb43a7199420d9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex.inc +++ /dev/null @@ -1,42 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -static void cls_ret_complex_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata __UNUSED__) - { - _Complex T_C_TYPE *pa; - _Complex T_C_TYPE *pr; - pa = (_Complex T_C_TYPE *)args[0]; - pr = (_Complex T_C_TYPE *)resp; - *pr = *pa; - - printf("%.6f,%.6fi: %.6f,%.6fi\n", - T_CONV creal (*pa), T_CONV cimag (*pa), - T_CONV creal (*pr), T_CONV cimag (*pr)); - } -typedef _Complex T_C_TYPE (*cls_ret_complex)(_Complex T_C_TYPE); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[2]; - _Complex T_C_TYPE res; - - cl_arg_types[0] = &T_FFI_TYPE; - cl_arg_types[1] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &T_FFI_TYPE, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_complex_fn, NULL, code) == FFI_OK); - - res = (*((cls_ret_complex)code))(0.125 + 128.0 * I); - printf("res: %.6f,%.6fi\n", T_CONV creal (res), T_CONV cimag (res)); - CHECK (res == (0.125 + 128.0 * I)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_double.c deleted file mode 100644 index 05e35340e08d9f8b7c95297dc9125b74cfe60a53..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: closure_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "cls_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_float.c deleted file mode 100644 index 5df7849d4c97d70aade6bdcb16855302e2a1793b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: closure_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "cls_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_longdouble.c deleted file mode 100644 index 2b1c320a20a852f97548d7dd8fd7cc390374851c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: closure_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "cls_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct.inc deleted file mode 100644 index df8708d1c4f98ddbaceb7a337921fef0ceee4eed..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct.inc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -typedef struct Cs { - _Complex T_C_TYPE x; - _Complex T_C_TYPE y; -} Cs; - -Cs gc; - -void -closure_test_fn(Cs p) -{ - printf("%.1f,%.1fi %.1f,%.1fi\n", - T_CONV creal (p.x), T_CONV cimag (p.x), - T_CONV creal (p.y), T_CONV cimag (p.y)); - gc = p; -} - -void -closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, - void** args, void* userdata __UNUSED__) -{ - closure_test_fn(*(Cs*)args[0]); -} - -int main(int argc __UNUSED__, char** argv __UNUSED__) -{ - ffi_cif cif; - - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type *cl_arg_types[1]; - - ffi_type ts1_type; - ffi_type* ts1_type_elements[4]; - - Cs arg = { 1.0 + 11.0 * I, 2.0 + 22.0 * I}; - - ts1_type.size = 0; - ts1_type.alignment = 0; - ts1_type.type = FFI_TYPE_STRUCT; - ts1_type.elements = ts1_type_elements; - - ts1_type_elements[0] = &T_FFI_TYPE; - ts1_type_elements[1] = &T_FFI_TYPE; - ts1_type_elements[2] = NULL; - - cl_arg_types[0] = &ts1_type; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &ffi_type_void, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); - - gc.x = 0.0 + 0.0 * I; - gc.y = 0.0 + 0.0 * I; - ((void*(*)(Cs))(code))(arg); - /* { dg-output "1.0,11.0i 2.0,22.0i\n" } */ - CHECK (gc.x == arg.x && gc.y == arg.y); - - gc.x = 0.0 + 0.0 * I; - gc.y = 0.0 + 0.0 * I; - closure_test_fn(arg); - /* { dg-output "1.0,11.0i 2.0,22.0i\n" } */ - CHECK (gc.x == arg.x && gc.y == arg.y); - - return 0; -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_double.c deleted file mode 100644 index ec71346a3fb6bfcd349bb296388e4f936660f8fb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check complex arguments in structs. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "cls_complex_struct.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_float.c deleted file mode 100644 index 96fdf750430605ba1c34f9811e0b2c5309041335..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check complex arguments in structs. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "cls_complex_struct.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c deleted file mode 100644 index 005b467398f202ff62ed5062cfaa006a9919f0dd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_struct_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Check complex arguments in structs. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "cls_complex_struct.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va.inc deleted file mode 100644 index 8a3e15f0f6af6609cb033b52b4d04571b5ca0cae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va.inc +++ /dev/null @@ -1,80 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include -#include -#include -#include - -static _Complex T_C_TYPE gComplexValue1 = 1 + 2 * I; -static _Complex T_C_TYPE gComplexValue2 = 3 + 4 * I; - -static int cls_variadic(const char *format, ...) -{ - va_list ap; - _Complex T_C_TYPE p1, p2; - - va_start (ap, format); - p1 = va_arg (ap, _Complex T_C_TYPE); - p2 = va_arg (ap, _Complex T_C_TYPE); - va_end (ap); - - return printf(format, T_CONV creal (p1), T_CONV cimag (p1), - T_CONV creal (p2), T_CONV cimag (p2)); -} - -static void -cls_complex_va_fn(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) -{ - char* format = *(char**)args[0]; - gComplexValue1 = *(_Complex T_C_TYPE*)args[1]; - gComplexValue2 = *(_Complex T_C_TYPE*)args[2]; - - *(ffi_arg*)resp = - printf(format, - T_CONV creal (gComplexValue1), T_CONV cimag (gComplexValue1), - T_CONV creal (gComplexValue2), T_CONV cimag (gComplexValue2)); -} - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - void* args[4]; - ffi_type* arg_types[4]; - char *format = "%.1f,%.1fi %.1f,%.1fi\n"; - - _Complex T_C_TYPE complexArg1 = 1.0 + 22.0 *I; - _Complex T_C_TYPE complexArg2 = 333.0 + 4444.0 *I; - ffi_arg res = 0; - - arg_types[0] = &ffi_type_pointer; - arg_types[1] = &T_FFI_TYPE; - arg_types[2] = &T_FFI_TYPE; - arg_types[3] = NULL; - - /* This printf call is variadic */ - CHECK(ffi_prep_cif_var(&cif, FFI_DEFAULT_ABI, 1, 3, &ffi_type_sint, - arg_types) == FFI_OK); - - args[0] = &format; - args[1] = &complexArg1; - args[2] = &complexArg2; - args[3] = NULL; - - ffi_call(&cif, FFI_FN(cls_variadic), &res, args); - printf("res: %d\n", (int) res); - CHECK (res == 24); - - CHECK(ffi_prep_closure_loc(pcl, &cif, cls_complex_va_fn, NULL, code) - == FFI_OK); - - res = ((int(*)(char *, ...))(code))(format, complexArg1, complexArg2); - CHECK (gComplexValue1 == complexArg1); - CHECK (gComplexValue2 == complexArg2); - printf("res: %d\n", (int) res); - CHECK (res == 24); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_double.c deleted file mode 100644 index 879ccf3b81f8a520b850c9c1a36ba633063d55dc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test complex' passed in variable argument lists. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "cls_complex_va.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_float.c deleted file mode 100644 index 2b17826045aad88915ec03a2a0e03c8523a4bc86..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_float.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test complex' passed in variable argument lists. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -/* Alpha splits _Complex into two arguments. It's illegal to pass - float through varargs, so _Complex float goes badly. In sort of - gets passed as _Complex double, but the compiler doesn't agree - with itself on this issue. */ -/* { dg-do run { xfail alpha*-*-* } } */ - -#include "complex_defs_float.inc" -#include "cls_complex_va.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c deleted file mode 100644 index 6eca9656eac5a6dfb254b4083bf3b809fa6dc8ab..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/cls_complex_va_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call, closure_call - Purpose: Test complex' passed in variable argument lists. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "cls_complex_va.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex.inc deleted file mode 100644 index 515ae3e60deab8ff012a3adf516d67fcaf637338..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex.inc +++ /dev/null @@ -1,51 +0,0 @@ -/* -*-c-*-*/ -#include "ffitest.h" -#include - -static _Complex T_C_TYPE f_complex(_Complex T_C_TYPE c, int x, int *py) -{ - c = -(2 * creal (c)) + (cimag (c) + 1)* I; - *py += x; - - return c; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - - _Complex T_C_TYPE tc_arg; - _Complex T_C_TYPE tc_result; - int tc_int_arg_x; - int tc_y; - int *tc_ptr_arg_y = &tc_y; - - args[0] = &T_FFI_TYPE; - args[1] = &ffi_type_sint; - args[2] = &ffi_type_pointer; - values[0] = &tc_arg; - values[1] = &tc_int_arg_x; - values[2] = &tc_ptr_arg_y; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &T_FFI_TYPE, args) == FFI_OK); - - tc_arg = 1 + 7 * I; - tc_int_arg_x = 1234; - tc_y = 9876; - ffi_call(&cif, FFI_FN(f_complex), &tc_result, values); - - printf ("%f,%fi %f,%fi, x %d 1234, y %d 11110\n", - T_CONV creal (tc_result), T_CONV cimag (tc_result), - T_CONV creal (2.0), T_CONV creal (8.0), tc_int_arg_x, tc_y); - - CHECK (creal (tc_result) == -2); - CHECK (cimag (tc_result) == 8); - CHECK (tc_int_arg_x == 1234); - CHECK (*tc_ptr_arg_y == 11110); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_double.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_double.inc deleted file mode 100644 index 3583e166d662796246b151bd7830364b8034d1e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_double.inc +++ /dev/null @@ -1,7 +0,0 @@ -/* -*-c-*- */ -/* Complex base type. */ -#define T_FFI_TYPE ffi_type_complex_double -/* C type corresponding to the base type. */ -#define T_C_TYPE double -/* C cast for a value of type T_C_TYPE that is passed to printf. */ -#define T_CONV diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_float.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_float.inc deleted file mode 100644 index bbd9375cbfafab361742b26b83e86b6f158aead8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_float.inc +++ /dev/null @@ -1,7 +0,0 @@ -/* -*-c-*- */ -/* Complex base type. */ -#define T_FFI_TYPE ffi_type_complex_float -/* C type corresponding to the base type. */ -#define T_C_TYPE float -/* C cast for a value of type T_C_TYPE that is passed to printf. */ -#define T_CONV (double) diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc deleted file mode 100644 index 14b9f243f480ab9e72d2e9d827db71f7c7202f65..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_defs_longdouble.inc +++ /dev/null @@ -1,7 +0,0 @@ -/* -*-c-*- */ -/* Complex base type. */ -#define T_FFI_TYPE ffi_type_complex_longdouble -/* C type corresponding to the base type. */ -#define T_C_TYPE long double -/* C cast for a value of type T_C_TYPE that is passed to printf. */ -#define T_CONV diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_double.c deleted file mode 100644 index 8a3297b2a24f35f5ef80e2029f10c61cb375ffe2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check complex types. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_float.c deleted file mode 100644 index 5044ebbcaae1c94cef350a9f4cf3a5e0c73dc645..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check complex types. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_int.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_int.c deleted file mode 100644 index bac319081e61389ff40bf51fa56a3010eccff6c4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_int.c +++ /dev/null @@ -1,86 +0,0 @@ -/* Area: ffi_call - Purpose: Check non-standard complex types. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "ffitest.h" -#include "ffi.h" -#include - -_Complex int f_complex(_Complex int c, int x, int *py) -{ - __real__ c = -2 * __real__ c; - __imag__ c = __imag__ c + 1; - *py += x; - return c; -} - -/* - * This macro can be used to define new complex type descriptors - * in a platform independent way. - * - * name: Name of the new descriptor is ffi_type_complex_. - * type: The C base type of the complex type. - */ -#define FFI_COMPLEX_TYPEDEF(name, type, ffitype) \ - static ffi_type *ffi_elements_complex_##name [2] = { \ - (ffi_type *)(&ffitype), NULL \ - }; \ - struct struct_align_complex_##name { \ - char c; \ - _Complex type x; \ - }; \ - ffi_type ffi_type_complex_##name = { \ - sizeof(_Complex type), \ - offsetof(struct struct_align_complex_##name, x), \ - FFI_TYPE_COMPLEX, \ - (ffi_type **)ffi_elements_complex_##name \ - } - -/* Define new complex type descriptors using the macro: */ -/* ffi_type_complex_sint */ -FFI_COMPLEX_TYPEDEF(sint, int, ffi_type_sint); -/* ffi_type_complex_uchar */ -FFI_COMPLEX_TYPEDEF(uchar, unsigned char, ffi_type_uint8); - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - - _Complex int tc_arg; - _Complex int tc_result; - int tc_int_arg_x; - int tc_y; - int *tc_ptr_arg_y = &tc_y; - - args[0] = &ffi_type_complex_sint; - args[1] = &ffi_type_sint; - args[2] = &ffi_type_pointer; - values[0] = &tc_arg; - values[1] = &tc_int_arg_x; - values[2] = &tc_ptr_arg_y; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_complex_sint, args) - == FFI_OK); - - tc_arg = 1 + 7 * I; - tc_int_arg_x = 1234; - tc_y = 9876; - ffi_call(&cif, FFI_FN(f_complex), &tc_result, values); - - printf ("%d,%di %d,%di, x %d 1234, y %d 11110\n", - (int)tc_result, (int)(tc_result * -I), 2, 8, tc_int_arg_x, tc_y); - /* dg-output "-2,8i 2,8i, x 1234 1234, y 11110 11110" */ - CHECK (creal (tc_result) == -2); - CHECK (cimag (tc_result) == 8); - CHECK (tc_int_arg_x == 1234); - CHECK (*tc_ptr_arg_y == 11110); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_longdouble.c deleted file mode 100644 index 7e783660930a62403ef3a13bc8e92dfe817a89fb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/complex_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check complex types. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/ffitest.h b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/ffitest.h deleted file mode 100644 index d27d362d6a6e7e99787be66a5ccbb6c2f487c3a5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/ffitest.h +++ /dev/null @@ -1 +0,0 @@ -#include "../libffi.call/ffitest.h" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex.inc deleted file mode 100644 index e37a77439765fe8357d0b092489f231bbd4d8883..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex.inc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" - -#include -#include - -static _Complex T_C_TYPE many(_Complex T_C_TYPE c1, - _Complex T_C_TYPE c2, - _Complex T_C_TYPE c3, - _Complex T_C_TYPE c4, - _Complex T_C_TYPE c5, - _Complex T_C_TYPE c6, - _Complex T_C_TYPE c7, - _Complex T_C_TYPE c8, - _Complex T_C_TYPE c9, - _Complex T_C_TYPE c10, - _Complex T_C_TYPE c11, - _Complex T_C_TYPE c12, - _Complex T_C_TYPE c13) -{ - printf("0 :%f,%fi\n" - "1 :%f,%fi\n" - "2 :%f,%fi\n" - "3 :%f,%fi\n" - "4 :%f,%fi\n" - "5 :%f,%fi\n" - "6 :%f,%fi\n" - "7 :%f,%fi\n" - "8 :%f,%fi\n" - "9 :%f,%fi\n" - "10:%f,%fi\n" - "11:%f,%fi\n" - "12:%f,%fi\n", - T_CONV creal (c1), T_CONV cimag (c1), - T_CONV creal (c2), T_CONV cimag (c2), - T_CONV creal (c3), T_CONV cimag (c3), - T_CONV creal (c4), T_CONV cimag (c4), - T_CONV creal (c5), T_CONV cimag (c5), - T_CONV creal (c6), T_CONV cimag (c6), - T_CONV creal (c7), T_CONV cimag (c7), - T_CONV creal (c8), T_CONV cimag (c8), - T_CONV creal (c9), T_CONV cimag (c9), - T_CONV creal (c10), T_CONV cimag (c10), - T_CONV creal (c11), T_CONV cimag (c11), - T_CONV creal (c12), T_CONV cimag (c12), - T_CONV creal (c13), T_CONV cimag (c13)); - - return (c1+c2-c3-c4+c5+c6+c7-c8-c9-c10-c11+c12+c13); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[13]; - void *values[13]; - _Complex T_C_TYPE ca[13]; - _Complex T_C_TYPE c, cc; - int i; - - for (i = 0; i < 13; i++) - { - args[i] = &T_FFI_TYPE; - values[i] = &ca[i]; - ca[i] = i + (-20 - i) * I; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &T_FFI_TYPE, args) == FFI_OK); - - ffi_call(&cif, FFI_FN(many), &c, values); - - cc = many(ca[0], ca[1], ca[2], ca[3], ca[4], ca[5], ca[6], ca[7], ca[8], - ca[9], ca[10], ca[11], ca[12]); - CHECK(creal (cc) == creal (c)); - CHECK(cimag (cc) == cimag (c)); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_double.c deleted file mode 100644 index 3fd53c3354d9d736007ad2e2fbc5ffe9ee645486..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex, with many arguments - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "many_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_float.c deleted file mode 100644 index c43d21cd9e1215ac3a886604ca033a96261ada61..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex, with many arguments - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "many_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_longdouble.c deleted file mode 100644 index dbab723969c1253c8eb2619238624ebb247ed222..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/many_complex_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex, with many arguments - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "many_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex.inc deleted file mode 100644 index 8bf0c1fbab8502005801aefcef93177c3dc9c131..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex.inc +++ /dev/null @@ -1,37 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -static _Complex T_C_TYPE return_c(_Complex T_C_TYPE c) -{ - printf ("%f,%fi\n", T_CONV creal (c), T_CONV cimag (c)); - return 2 * c; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - _Complex T_C_TYPE c, rc, rc2; - T_C_TYPE cr, ci; - - args[0] = &T_FFI_TYPE; - values[0] = &c; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, - &T_FFI_TYPE, args) == FFI_OK); - - for (cr = -127.0; cr < 127; cr++) - { - ci = 1000.0 - cr; - c = cr + ci * I; - ffi_call(&cif, FFI_FN(return_c), &rc, values); - rc2 = return_c(c); - printf ("%f,%fi vs %f,%fi\n", - T_CONV creal (rc), T_CONV cimag (rc), - T_CONV creal (rc2), T_CONV cimag (rc2)); - CHECK(rc == 2 * c); - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1.inc deleted file mode 100644 index 7cecc0fefa52c7c90c2ed49c4df23e50f5c0c06a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1.inc +++ /dev/null @@ -1,41 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -static _Complex T_C_TYPE return_c(_Complex T_C_TYPE c1, float fl2, unsigned int in3, _Complex T_C_TYPE c4) -{ - return c1 + fl2 + in3 + c4; -} -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - _Complex T_C_TYPE c1, c4, rc, rc2; - float fl2; - unsigned int in3; - args[0] = &T_FFI_TYPE; - args[1] = &ffi_type_float; - args[2] = &ffi_type_uint; - args[3] = &T_FFI_TYPE; - values[0] = &c1; - values[1] = &fl2; - values[2] = &in3; - values[3] = &c4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &T_FFI_TYPE, args) == FFI_OK); - c1 = 127.0 + 255.0 * I; - fl2 = 128.0; - in3 = 255; - c4 = 512.7 + 1024.1 * I; - - ffi_call(&cif, FFI_FN(return_c), &rc, values); - rc2 = return_c(c1, fl2, in3, c4); - printf ("%f,%fi vs %f,%fi\n", - T_CONV creal (rc), T_CONV cimag (rc), - T_CONV creal (rc2), T_CONV cimag (rc2)); - CHECK(rc == rc2); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_double.c deleted file mode 100644 index 727410d563da91f88258bb83eaba650fc9a284af..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "return_complex1.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_float.c deleted file mode 100644 index a2aeada84763cebf2092c3f5e6e5d2c580329e8d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "return_complex1.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_longdouble.c deleted file mode 100644 index 103504bf64e11bc96b9eee22cbc83c5c14297df0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex1_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "return_complex1.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2.inc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2.inc deleted file mode 100644 index 265170bf718285c6d65fc551e341e9fc5b1f02d9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2.inc +++ /dev/null @@ -1,44 +0,0 @@ -/* -*-c-*- */ -#include "ffitest.h" -#include - -_Complex T_C_TYPE -return_c(_Complex T_C_TYPE c1, _Complex T_C_TYPE c2, - unsigned int in3, _Complex T_C_TYPE c4) -{ - volatile _Complex T_C_TYPE r = c1 + c2 + in3 + c4; - return r; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - _Complex T_C_TYPE c1, c2, c4, rc, rc2; - unsigned int in3; - args[0] = &T_FFI_TYPE; - args[1] = &T_FFI_TYPE; - args[2] = &ffi_type_uint; - args[3] = &T_FFI_TYPE; - values[0] = &c1; - values[1] = &c2; - values[2] = &in3; - values[3] = &c4; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, - &T_FFI_TYPE, args) == FFI_OK); - c1 = 127.0 + 255.0 * I; - c2 = 128.0 + 256.0; - in3 = 255; - c4 = 512.7 + 1024.1 * I; - - ffi_call(&cif, FFI_FN(return_c), &rc, values); - rc2 = return_c(c1, c2, in3, c4); - printf ("%f,%fi vs %f,%fi\n", - T_CONV creal (rc), T_CONV cimag (rc), - T_CONV creal (rc2), T_CONV cimag (rc2)); - CHECK(rc == rc2); - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_double.c deleted file mode 100644 index ab9efacb4a856aa76773a158b67530bcc09b1f55..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "return_complex2.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_float.c deleted file mode 100644 index d7f22c2a0c78816a0d02a2d6dfb3b1de48dd4f1f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "return_complex2.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_longdouble.c deleted file mode 100644 index 3edea629df0b0c73d366755cece310ff9cb80542..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex2_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "return_complex2.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_double.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_double.c deleted file mode 100644 index e2497cc84aa048a3ea242ee765e74ac1427e9e70..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_double.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_double.inc" -#include "return_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_float.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_float.c deleted file mode 100644 index a35528ff9356b1f41af0c101491cba88277f4af0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_float.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_float.inc" -#include "return_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_longdouble.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_longdouble.c deleted file mode 100644 index 142d7becbace62a36e1ce12d4029ae9ee886a7a8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.complex/return_complex_longdouble.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Area: ffi_call - Purpose: Check return value complex. - Limitations: none. - PR: none. - Originator: . */ - -/* { dg-do run } */ - -#include "complex_defs_longdouble.inc" -#include "return_complex.inc" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/aa-direct.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/aa-direct.c deleted file mode 100644 index b00c404ab353afaff3a75eb8582bc5e82c54b573..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/aa-direct.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do run } */ - -#include "static-chain.h" - -#if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG) - -#include "ffitest.h" - -/* Blatent assumption here that the prologue doesn't clobber the - static chain for trivial functions. If this is not true, don't - define STATIC_CHAIN_REG, and we'll test what we can via other tests. */ -void *doit(void) -{ - register void *chain __asm__(STATIC_CHAIN_REG); - return chain; -} - -int main() -{ - ffi_cif cif; - void *result; - - CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); - - ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result); - - CHECK(result == &result); - - return 0; -} - -#else /* UNSUPPORTED */ -int main() { return 0; } -#endif diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/closure1.c b/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/closure1.c deleted file mode 100644 index 7b34afc88c8f3ce0f7260b7f53e4083143ff2c4f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/closure1.c +++ /dev/null @@ -1,28 +0,0 @@ -/* { dg-do run } */ - -#include "ffitest.h" - -void doit(ffi_cif *cif, void *rvalue, void **avalue, void *closure) -{ - (void)cif; - (void)avalue; - *(void **)rvalue = closure; -} - -typedef void * (*FN)(void); - -int main() -{ - ffi_cif cif; - ffi_go_closure cl; - void *result; - - CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK); - CHECK(ffi_prep_go_closure(&cl, &cif, doit) == FFI_OK); - - ffi_call_go(&cif, FFI_FN(*(FN *)&cl), &result, NULL, &cl); - - CHECK(result == &cl); - - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/ffitest.h b/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/ffitest.h deleted file mode 100644 index d27d362d6a6e7e99787be66a5ccbb6c2f487c3a5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/ffitest.h +++ /dev/null @@ -1 +0,0 @@ -#include "../libffi.call/ffitest.h" diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/static-chain.h b/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/static-chain.h deleted file mode 100644 index 3675b40a54c844358369bc8720818efe3843339f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.go/static-chain.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef __aarch64__ -# define STATIC_CHAIN_REG "x18" -#elif defined(__alpha__) -# define STATIC_CHAIN_REG "$1" -#elif defined(__arm__) -# define STATIC_CHAIN_REG "ip" -#elif defined(__sparc__) -# if defined(__arch64__) || defined(__sparcv9) -# define STATIC_CHAIN_REG "g5" -# else -# define STATIC_CHAIN_REG "g2" -# endif -#elif defined(__x86_64__) -# define STATIC_CHAIN_REG "r10" -#elif defined(__i386__) -# ifndef ABI_NUM -# define STATIC_CHAIN_REG "ecx" /* FFI_DEFAULT_ABI only */ -# endif -#endif diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/ffitestcxx.h b/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/ffitestcxx.h deleted file mode 100644 index 83f5442849e5f1b39932a89ed4216d7ea13fd898..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/ffitestcxx.h +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include -#include -#include -#include "fficonfig.h" - -#define MAX_ARGS 256 - - -/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ -#undef __UNUSED__ -#if defined(__GNUC__) -#define __UNUSED__ __attribute__((__unused__)) -#else -#define __UNUSED__ -#endif - -#define CHECK(x) (!(x) ? abort() : (void)0) - -/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a - file open. */ -#ifdef HAVE_MMAP_ANON -# undef HAVE_MMAP_DEV_ZERO - -# include -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) -# define MAP_ANONYMOUS MAP_ANON -# endif -# define USING_MMAP - -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - -# include -# ifndef MAP_FAILED -# define MAP_FAILED -1 -# endif -# define USING_MMAP - -#endif - - -/* MinGW kludge. */ -#ifdef _WIN64 -#define PRIdLL "I64d" -#define PRIuLL "I64u" -#else -#define PRIdLL "lld" -#define PRIuLL "llu" -#endif - -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (char *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - -#endif diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest.cc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest.cc deleted file mode 100644 index d7ffd4aa21477d87e5dfb6d9ad6d2c65e4adc4dc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* Area: ffi_closure, unwind info - Purpose: Check if the unwind information is passed correctly. - Limitations: none. - PR: none. - Originator: Jeff Sturm */ - -/* { dg-do run } */ -#include "ffitestcxx.h" - -#if defined HAVE_STDINT_H -#include -#endif - -#if defined HAVE_INTTYPES_H -#include -#endif - -void -closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, - void** args __UNUSED__, void* userdata __UNUSED__) -{ - throw 9; -} - -typedef void (*closure_test_type)(); - -void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, - void** args, void* userdata __UNUSED__) - { - *(ffi_arg*)resp = - (int)*(float *)args[0] +(int)(*(float *)args[1]) + - (int)(*(float *)args[2]) + (int)*(float *)args[3] + - (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + - (int)*(float *)args[6] + (int)(*(int *)args[7]) + - (int)(*(double*)args[8]) + (int)*(int *)args[9] + - (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + - (int)*(int *)args[12] + (int)(*(int *)args[13]) + - (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata; - - printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", - (int)*(float *)args[0], (int)(*(float *)args[1]), - (int)(*(float *)args[2]), (int)*(float *)args[3], - (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), - (int)*(float *)args[6], (int)(*(int *)args[7]), - (int)(*(double *)args[8]), (int)*(int *)args[9], - (int)(*(int *)args[10]), (int)(*(float *)args[11]), - (int)*(int *)args[12], (int)(*(int *)args[13]), - (int)(*(int *)args[14]), *(int *)args[15], - (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); - - throw (int)*(ffi_arg*)resp; -} - -typedef int (*closure_test_type1)(float, float, float, float, signed short, - float, float, int, double, int, int, float, - int, int, int, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - - { - cl_arg_types[1] = NULL; - - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, - &ffi_type_void, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); - - try - { - (*((closure_test_type)(code)))(); - } catch (int exception_code) - { - CHECK(exception_code == 9); - } - - printf("part one OK\n"); - /* { dg-output "part one OK" } */ - } - - { - - cl_arg_types[0] = &ffi_type_float; - cl_arg_types[1] = &ffi_type_float; - cl_arg_types[2] = &ffi_type_float; - cl_arg_types[3] = &ffi_type_float; - cl_arg_types[4] = &ffi_type_sshort; - cl_arg_types[5] = &ffi_type_float; - cl_arg_types[6] = &ffi_type_float; - cl_arg_types[7] = &ffi_type_uint; - cl_arg_types[8] = &ffi_type_double; - cl_arg_types[9] = &ffi_type_uint; - cl_arg_types[10] = &ffi_type_uint; - cl_arg_types[11] = &ffi_type_float; - cl_arg_types[12] = &ffi_type_uint; - cl_arg_types[13] = &ffi_type_uint; - cl_arg_types[14] = &ffi_type_uint; - cl_arg_types[15] = &ffi_type_uint; - cl_arg_types[16] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, - (void *) 3 /* userdata */, code) == FFI_OK); - try - { - (*((closure_test_type1)code)) - (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, - 19, 21, 1); - /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ - } catch (int exception_code) - { - CHECK(exception_code == 255); - } - printf("part two OK\n"); - /* { dg-output "\npart two OK" } */ - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc deleted file mode 100644 index 29739cdb1719b7dd7493909cf6d702d7aaf049bd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc +++ /dev/null @@ -1,53 +0,0 @@ -/* Area: ffi_call, unwind info - Purpose: Check if the unwind information is passed correctly. - Limitations: none. - PR: none. - Originator: Andreas Tobler 20061213 */ - -/* { dg-do run } */ -#include "ffitestcxx.h" - -static int checking(int a __UNUSED__, short b __UNUSED__, - signed char c __UNUSED__) -{ - throw 9; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - - signed int si; - signed short ss; - signed char sc; - - args[0] = &ffi_type_sint; - values[0] = &si; - args[1] = &ffi_type_sshort; - values[1] = &ss; - args[2] = &ffi_type_schar; - values[2] = ≻ - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, - &ffi_type_sint, args) == FFI_OK); - - si = -6; - ss = -12; - sc = -1; - { - try - { - ffi_call(&cif, FFI_FN(checking), &rint, values); - } catch (int exception_code) - { - CHECK(exception_code == 9); - } - printf("part one OK\n"); - /* { dg-output "part one OK" } */ - } - exit(0); -} diff --git a/llgo/third_party/gofrontend/libgcc/unwind-pe.h b/llgo/third_party/gofrontend/libgcc/unwind-pe.h deleted file mode 100644 index 8655a92e2fd26373f853aa36d3002438c647941e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgcc/unwind-pe.h +++ /dev/null @@ -1,200 +0,0 @@ -//===----------------------------- unwind-pe.h ----------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// Pointer-Encoding decoder. Derived from: -// - libcxxabi/src/Unwind/dwarf2.h -// - libcxxabi/src/Unwind/AddressSpace.h -// -//===----------------------------------------------------------------------===// - -#ifndef UNWIND_PE_H -#define UNWIND_PE_H - -#include -#include -#include - -// FSF exception handling Pointer-Encoding constants -// Used in CFI augmentation by GCC -enum { - DW_EH_PE_ptr = 0x00, - DW_EH_PE_uleb128 = 0x01, - DW_EH_PE_udata2 = 0x02, - DW_EH_PE_udata4 = 0x03, - DW_EH_PE_udata8 = 0x04, - DW_EH_PE_signed = 0x08, - DW_EH_PE_sleb128 = 0x09, - DW_EH_PE_sdata2 = 0x0A, - DW_EH_PE_sdata4 = 0x0B, - DW_EH_PE_sdata8 = 0x0C, - DW_EH_PE_absptr = 0x00, - DW_EH_PE_pcrel = 0x10, - DW_EH_PE_textrel = 0x20, - DW_EH_PE_datarel = 0x30, - DW_EH_PE_funcrel = 0x40, - DW_EH_PE_aligned = 0x50, - DW_EH_PE_indirect = 0x80, - DW_EH_PE_omit = 0xFF -}; - -/// Read a ULEB128 into a 64-bit word. -static uint64_t unw_getULEB128(uintptr_t *addr) { - const uint8_t *p = (uint8_t *)*addr; - uint64_t result = 0; - int bit = 0; - do { - uint64_t b; - - b = *p & 0x7f; - - if (bit >= 64 || b << bit >> bit != b) { - assert(!"malformed uleb128 expression"); - } else { - result |= b << bit; - bit += 7; - } - } while (*p++ >= 0x80); - *addr = (uintptr_t) p; - return result; -} - -/// Read a SLEB128 into a 64-bit word. -static int64_t unw_getSLEB128(uintptr_t *addr) { - const uint8_t *p = (uint8_t *)addr; - int64_t result = 0; - int bit = 0; - uint8_t byte; - do { - byte = *p++; - result |= ((byte & 0x7f) << bit); - bit += 7; - } while (byte & 0x80); - // sign extend negative numbers - if ((byte & 0x40) != 0) - result |= (-1LL) << bit; - *addr = (uintptr_t) p; - return result; -} - -static uint16_t unw_get16(uintptr_t addr) { - uint16_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uint32_t unw_get32(uintptr_t addr) { - uint32_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uint64_t unw_get64(uintptr_t addr) { - uint64_t val; - memcpy(&val, (void *)addr, sizeof(val)); - return val; -} - -static uintptr_t unw_getP(uintptr_t addr) { - if (sizeof(uintptr_t) == 8) - return unw_get64(addr); - else - return unw_get32(addr); -} - -static const unsigned char *read_uleb128(const unsigned char *p, - _uleb128_t *ret) { - uintptr_t addr = (uintptr_t)p; - *ret = unw_getULEB128(&addr); - return (unsigned char *)addr; -} - -static const unsigned char *read_encoded_value(struct _Unwind_Context *ctx, - unsigned char encoding, - const unsigned char *p, - _Unwind_Ptr *ret) { - uintptr_t addr = (uintptr_t)p; - uintptr_t startAddr = addr; - uintptr_t result; - - (void)ctx; - - // first get value - switch (encoding & 0x0F) { - case DW_EH_PE_ptr: - result = unw_getP(addr); - p += sizeof(uintptr_t); - break; - case DW_EH_PE_uleb128: - result = (uintptr_t)unw_getULEB128(&addr); - p = (const unsigned char *)addr; - break; - case DW_EH_PE_udata2: - result = unw_get16(addr); - p += 2; - break; - case DW_EH_PE_udata4: - result = unw_get32(addr); - p += 4; - break; - case DW_EH_PE_udata8: - result = (uintptr_t)unw_get64(addr); - p += 8; - break; - case DW_EH_PE_sleb128: - result = (uintptr_t)unw_getSLEB128(&addr); - p = (const unsigned char *)addr; - break; - case DW_EH_PE_sdata2: - // Sign extend from signed 16-bit value. - result = (uintptr_t)(int16_t)unw_get16(addr); - p += 2; - break; - case DW_EH_PE_sdata4: - // Sign extend from signed 32-bit value. - result = (uintptr_t)(int32_t)unw_get32(addr); - p += 4; - break; - case DW_EH_PE_sdata8: - result = (uintptr_t)unw_get64(addr); - p += 8; - break; - default: - assert(!"unknown pointer encoding"); - } - - // then add relative offset - switch (encoding & 0x70) { - case DW_EH_PE_absptr: - // do nothing - break; - case DW_EH_PE_pcrel: - result += startAddr; - break; - case DW_EH_PE_textrel: - assert(!"DW_EH_PE_textrel pointer encoding not supported"); - break; - case DW_EH_PE_datarel: - assert(!"DW_EH_PE_datarel pointer encoding not supported"); - break; - case DW_EH_PE_funcrel: - assert(!"DW_EH_PE_funcrel pointer encoding not supported"); - break; - case DW_EH_PE_aligned: - assert(!"DW_EH_PE_aligned pointer encoding not supported"); - break; - default: - assert(!"unknown pointer encoding"); - break; - } - - if (encoding & DW_EH_PE_indirect) - result = unw_getP(result); - - *ret = result; - return p; -} - -#endif // UNWIND_PE_H diff --git a/llgo/third_party/gofrontend/libgo/LICENSE b/llgo/third_party/gofrontend/libgo/LICENSE deleted file mode 100644 index 6a66aea5eafe0ca6a688840c47219556c552488e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. 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 Google Inc. 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 -OWNER 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. diff --git a/llgo/third_party/gofrontend/libgo/MERGE b/llgo/third_party/gofrontend/libgo/MERGE deleted file mode 100644 index ea32fc1cfb08ef7a4a16b9d3b90b750eb823ab2d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/MERGE +++ /dev/null @@ -1,4 +0,0 @@ -f2e4c8b5fb3660d793b2c545ef207153db0a34b1 - -The first line of this file holds the git revision number of the -last merge done from the master library sources. diff --git a/llgo/third_party/gofrontend/libgo/Makefile.am b/llgo/third_party/gofrontend/libgo/Makefile.am deleted file mode 100644 index 9080a29af57cc088776d24d6256b124751e2809d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/Makefile.am +++ /dev/null @@ -1,4372 +0,0 @@ -# Makefile.am -- Go library Makefile. - -# Copyright 2009 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# Process this file with autoreconf to produce Makefile.in. - -# Go support. -SUFFIXES = .c .go .gox .o .obj .lo .a - -if LIBGO_IS_RTEMS -subdirs = testsuite -endif - -SUBDIRS = ${subdirs} - -gcc_version := $(shell $(GOC) -dumpversion) - -MAINT_CHARSET = latin1 - -mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs -PWD_COMMAND = $${PWDCMD-pwd} -STAMP = echo timestamp > - -toolexecdir = $(glibgo_toolexecdir) -toolexeclibdir = $(glibgo_toolexeclibdir) -toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias) -libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version) - -LIBFFI = @LIBFFI@ -LIBFFIINCS = @LIBFFIINCS@ - -LIBATOMIC = @LIBATOMIC@ - -WARN_CFLAGS = $(WARN_FLAGS) $(WERROR) - -# -I/-D flags to pass when compiling. -AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS) - -ACLOCAL_AMFLAGS = -I ./config -I ../config - -AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \ - $(SPLIT_STACK) $(WARN_CFLAGS) \ - $(STRINGOPS_FLAG) $(OSCFLAGS) \ - -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \ - -I $(MULTIBUILDTOP)../../gcc/include - -if USING_SPLIT_STACK -AM_LDFLAGS = -XCClinker $(SPLIT_STACK) -endif - -# Multilib support. -MAKEOVERRIDES= - -# Work around what appears to be a GNU make 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)" \ - "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ - "CFLAGS=$(CFLAGS)" \ - "CXXFLAGS=$(CXXFLAGS)" \ - "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ - "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ - "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ - "GOC=$(GOC)" \ - "GOCFLAGS=$(GOCFLAGS)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ - "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ - "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)" \ - "includedir=$(includedir)" \ - "prefix=$(prefix)" \ - "tooldir=$(tooldir)" \ - "gxx_include_dir=$(gxx_include_dir)" \ - "AR=$(AR)" \ - "AS=$(AS)" \ - "LD=$(LD)" \ - "RANLIB=$(RANLIB)" \ - "NM=$(NM)" \ - "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ - "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ - "DESTDIR=$(DESTDIR)" \ - "WERROR=$(WERROR)" - -# 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 libgolibbegin.a libnetgo.a -endif - -toolexeclibgo_DATA = \ - bufio.gox \ - bytes.gox \ - crypto.gox \ - encoding.gox \ - errors.gox \ - expvar.gox \ - flag.gox \ - fmt.gox \ - hash.gox \ - html.gox \ - image.gox \ - io.gox \ - log.gox \ - math.gox \ - mime.gox \ - net.gox \ - os.gox \ - path.gox \ - reflect.gox \ - regexp.gox \ - runtime.gox \ - sort.gox \ - strconv.gox \ - strings.gox \ - sync.gox \ - syscall.gox \ - testing.gox \ - time.gox \ - unicode.gox - -toolexeclibgoarchivedir = $(toolexeclibgodir)/archive - -toolexeclibgoarchive_DATA = \ - archive/tar.gox \ - archive/zip.gox - -toolexeclibgocompressdir = $(toolexeclibgodir)/compress - -toolexeclibgocompress_DATA = \ - compress/bzip2.gox \ - compress/flate.gox \ - compress/gzip.gox \ - compress/lzw.gox \ - compress/zlib.gox - -toolexeclibgocontainerdir = $(toolexeclibgodir)/container - -toolexeclibgocontainer_DATA = \ - container/heap.gox \ - container/list.gox \ - container/ring.gox - -toolexeclibgocryptodir = $(toolexeclibgodir)/crypto - -toolexeclibgocrypto_DATA = \ - crypto/aes.gox \ - crypto/cipher.gox \ - crypto/des.gox \ - crypto/dsa.gox \ - crypto/ecdsa.gox \ - crypto/elliptic.gox \ - crypto/hmac.gox \ - crypto/md5.gox \ - crypto/rand.gox \ - crypto/rc4.gox \ - crypto/rsa.gox \ - crypto/sha1.gox \ - crypto/sha256.gox \ - crypto/sha512.gox \ - crypto/subtle.gox \ - crypto/tls.gox \ - crypto/x509.gox - -toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509 - -toolexeclibgocryptox509_DATA = \ - crypto/x509/pkix.gox - -toolexeclibgodatabasedir = $(toolexeclibgodir)/database - -toolexeclibgodatabase_DATA = \ - database/sql.gox - -toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql - -toolexeclibgodatabasesql_DATA = \ - database/sql/driver.gox - -toolexeclibgodebugdir = $(toolexeclibgodir)/debug - -toolexeclibgodebug_DATA = \ - debug/dwarf.gox \ - debug/elf.gox \ - debug/gosym.gox \ - debug/macho.gox \ - debug/pe.gox \ - debug/plan9obj.gox - -toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding - -toolexeclibgoencoding_DATA = \ - encoding/ascii85.gox \ - encoding/asn1.gox \ - encoding/base32.gox \ - encoding/base64.gox \ - encoding/binary.gox \ - encoding/csv.gox \ - encoding/gob.gox \ - encoding/hex.gox \ - encoding/json.gox \ - encoding/pem.gox \ - encoding/xml.gox - -toolexeclibgoexpdir = $(toolexeclibgodir)/exp - -toolexeclibgoexp_DATA = \ - exp/proxy.gox \ - exp/terminal.gox - -toolexeclibgogodir = $(toolexeclibgodir)/go - -toolexeclibgogo_DATA = \ - go/ast.gox \ - go/build.gox \ - go/constant.gox \ - go/doc.gox \ - go/format.gox \ - go/importer.gox \ - go/parser.gox \ - go/printer.gox \ - go/scanner.gox \ - go/token.gox \ - go/types.gox - -toolexeclibgohashdir = $(toolexeclibgodir)/hash - -toolexeclibgohash_DATA = \ - hash/adler32.gox \ - hash/crc32.gox \ - hash/crc64.gox \ - hash/fnv.gox - -toolexeclibgohtmldir = $(toolexeclibgodir)/html - -toolexeclibgohtml_DATA = \ - html/template.gox - -toolexeclibgoimagedir = $(toolexeclibgodir)/image - -toolexeclibgoimage_DATA = \ - image/color.gox \ - image/draw.gox \ - image/gif.gox \ - image/jpeg.gox \ - image/png.gox - -toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color - -toolexeclibgoimagecolor_DATA = \ - image/color/palette.gox - -toolexeclibgoindexdir = $(toolexeclibgodir)/index - -toolexeclibgoindex_DATA = \ - index/suffixarray.gox - -toolexeclibgoiodir = $(toolexeclibgodir)/io - -toolexeclibgoio_DATA = \ - io/ioutil.gox - -toolexeclibgologdir = $(toolexeclibgodir)/log - -toolexeclibgolog_DATA = \ - log/syslog.gox - -toolexeclibgomathdir = $(toolexeclibgodir)/math - -toolexeclibgomath_DATA = \ - math/big.gox \ - math/cmplx.gox \ - math/rand.gox - -toolexeclibgomimedir = $(toolexeclibgodir)/mime - -toolexeclibgomime_DATA = \ - mime/multipart.gox \ - mime/quotedprintable.gox - -toolexeclibgonetdir = $(toolexeclibgodir)/net - -toolexeclibgonet_DATA = \ - net/http.gox \ - net/mail.gox \ - net/rpc.gox \ - net/smtp.gox \ - net/textproto.gox \ - net/url.gox - -toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http - -toolexeclibgonethttp_DATA = \ - net/http/cgi.gox \ - net/http/cookiejar.gox \ - net/http/fcgi.gox \ - net/http/httptest.gox \ - net/http/httputil.gox \ - net/http/pprof.gox - -toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc - -toolexeclibgonetrpc_DATA = \ - net/rpc/jsonrpc.gox - -toolexeclibgoolddir = $(toolexeclibgodir)/old - -toolexeclibgoold_DATA = \ - old/regexp.gox \ - old/template.gox - -toolexeclibgoosdir = $(toolexeclibgodir)/os - -toolexeclibgoos_DATA = \ - os/exec.gox \ - os/signal.gox \ - os/user.gox - -toolexeclibgopathdir = $(toolexeclibgodir)/path - -toolexeclibgopath_DATA = \ - path/filepath.gox - -toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp - -toolexeclibgoregexp_DATA = \ - regexp/syntax.gox - -toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime - -toolexeclibgoruntime_DATA = \ - runtime/debug.gox \ - runtime/pprof.gox - -toolexeclibgosyncdir = $(toolexeclibgodir)/sync - -toolexeclibgosync_DATA = \ - sync/atomic.gox - -toolexeclibgotestingdir = $(toolexeclibgodir)/testing - -toolexeclibgotesting_DATA = \ - testing/iotest.gox \ - testing/quick.gox - -toolexeclibgotextdir = $(toolexeclibgodir)/text - -toolexeclibgotext_DATA = \ - text/scanner.gox \ - text/tabwriter.gox \ - text/template.gox - -toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template - -toolexeclibgotexttemplate_DATA = \ - text/template/parse.gox - -toolexeclibgounicodedir = $(toolexeclibgodir)/unicode - -toolexeclibgounicode_DATA = \ - unicode/utf16.gox \ - unicode/utf8.gox - -if HAVE_SYS_MMAN_H -runtime_mem_file = runtime/mem.c -else -runtime_mem_file = runtime/mem_posix_memalign.c -endif - -if LIBGO_IS_RTEMS -rtems_task_variable_add_file = runtime/rtems-task-variable-add.c -else -rtems_task_variable_add_file = -endif - -if LIBGO_IS_LINUX -runtime_lock_files = runtime/lock_futex.c runtime/thread-linux.c -else -runtime_lock_files = runtime/lock_sema.c runtime/thread-sema.c -endif - -if LIBGO_IS_LINUX -runtime_getncpu_file = runtime/getncpu-linux.c -else -if LIBGO_IS_DARWIN -runtime_getncpu_file = runtime/getncpu-bsd.c -else -if LIBGO_IS_IRIX -runtime_getncpu_file = runtime/getncpu-irix.c -else -if LIBGO_IS_SOLARIS -runtime_getncpu_file = runtime/getncpu-solaris.c -else -if LIBGO_IS_FREEBSD -runtime_getncpu_file = runtime/getncpu-bsd.c -else -if LIBGO_IS_NETBSD -runtime_getncpu_file = runtime/getncpu-bsd.c -else -runtime_getncpu_file = runtime/getncpu-none.c -endif -endif -endif -endif -endif -endif - -if LIBGO_IS_LINUX -runtime_netpoll_files = runtime/netpoll_epoll.c -else -if LIBGO_IS_SOLARIS -runtime_netpoll_files = runtime/netpoll_select.c -else -runtime_netpoll_files = runtime/netpoll_kqueue.c -endif -endif - -runtime_files = \ - runtime/go-append.c \ - runtime/go-assert.c \ - runtime/go-assert-interface.c \ - runtime/go-byte-array-to-string.c \ - runtime/go-breakpoint.c \ - runtime/go-caller.c \ - runtime/go-callers.c \ - runtime/go-can-convert-interface.c \ - runtime/go-cdiv.c \ - runtime/go-cgo.c \ - runtime/go-check-interface.c \ - runtime/go-construct-map.c \ - runtime/go-convert-interface.c \ - runtime/go-copy.c \ - runtime/go-defer.c \ - runtime/go-deferred-recover.c \ - runtime/go-eface-compare.c \ - runtime/go-eface-val-compare.c \ - runtime/go-ffi.c \ - runtime/go-fieldtrack.c \ - runtime/go-int-array-to-string.c \ - runtime/go-int-to-string.c \ - runtime/go-interface-compare.c \ - runtime/go-interface-eface-compare.c \ - runtime/go-interface-val-compare.c \ - runtime/go-make-slice.c \ - runtime/go-map-delete.c \ - runtime/go-map-index.c \ - runtime/go-map-len.c \ - runtime/go-map-range.c \ - runtime/go-matherr.c \ - runtime/go-memcmp.c \ - runtime/go-nanotime.c \ - runtime/go-now.c \ - runtime/go-new-map.c \ - runtime/go-new.c \ - runtime/go-nosys.c \ - runtime/go-panic.c \ - runtime/go-print.c \ - runtime/go-recover.c \ - runtime/go-reflect-call.c \ - runtime/go-reflect-map.c \ - runtime/go-rune.c \ - runtime/go-runtime-error.c \ - runtime/go-setenv.c \ - runtime/go-signal.c \ - runtime/go-strcmp.c \ - runtime/go-string-to-byte-array.c \ - runtime/go-string-to-int-array.c \ - runtime/go-strplus.c \ - runtime/go-strslice.c \ - runtime/go-traceback.c \ - runtime/go-type-complex.c \ - runtime/go-type-eface.c \ - runtime/go-type-error.c \ - runtime/go-type-float.c \ - runtime/go-type-identity.c \ - runtime/go-type-interface.c \ - runtime/go-type-string.c \ - runtime/go-typedesc-equal.c \ - runtime/go-unsafe-new.c \ - runtime/go-unsafe-newarray.c \ - runtime/go-unsafe-pointer.c \ - runtime/go-unsetenv.c \ - runtime/go-unwind.c \ - runtime/go-varargs.c \ - runtime/env_posix.c \ - runtime/heapdump.c \ - $(runtime_lock_files) \ - runtime/mcache.c \ - runtime/mcentral.c \ - $(runtime_mem_file) \ - runtime/mfixalloc.c \ - runtime/mgc0.c \ - runtime/mheap.c \ - runtime/msize.c \ - $(runtime_netpoll_files) \ - runtime/panic.c \ - runtime/parfor.c \ - runtime/print.c \ - runtime/proc.c \ - runtime/runtime.c \ - runtime/signal_unix.c \ - runtime/thread.c \ - runtime/yield.c \ - $(rtems_task_variable_add_file) \ - chan.c \ - cpuprof.c \ - go-iface.c \ - lfstack.c \ - malloc.c \ - map.c \ - mprof.c \ - netpoll.c \ - rdebug.c \ - reflect.c \ - runtime1.c \ - sema.c \ - sigqueue.c \ - string.c \ - time.c \ - $(runtime_getncpu_file) - -goc2c.$(OBJEXT): runtime/goc2c.c - $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $< - -goc2c: goc2c.$(OBJEXT) - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $< - -malloc.c: $(srcdir)/runtime/malloc.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -mprof.c: $(srcdir)/runtime/mprof.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -netpoll.c: $(srcdir)/runtime/netpoll.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -reflect.c: $(srcdir)/runtime/reflect.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -runtime1.c: $(srcdir)/runtime/runtime1.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -sema.c: $(srcdir)/runtime/sema.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -sigqueue.c: $(srcdir)/runtime/sigqueue.goc goc2c - ./goc2c --go-pkgpath os_signal $< > $@.tmp - mv -f $@.tmp $@ - -time.c: $(srcdir)/runtime/time.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -%.c: $(srcdir)/runtime/%.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -go_bufio_files = \ - go/bufio/bufio.go \ - go/bufio/scan.go - -go_bytes_files = \ - go/bytes/buffer.go \ - go/bytes/bytes.go \ - go/bytes/bytes_decl.go \ - go/bytes/reader.go -go_bytes_c_files = \ - go/bytes/indexbyte.c - -go_crypto_files = \ - go/crypto/crypto.go - -go_encoding_files = \ - go/encoding/encoding.go - -go_errors_files = \ - go/errors/errors.go - -go_expvar_files = \ - go/expvar/expvar.go - -go_flag_files = \ - go/flag/flag.go - -go_fmt_files = \ - go/fmt/doc.go \ - go/fmt/format.go \ - go/fmt/print.go \ - go/fmt/scan.go - -go_hash_files = \ - go/hash/hash.go - -go_html_files = \ - go/html/entity.go \ - go/html/escape.go - -go_image_files = \ - go/image/format.go \ - go/image/geom.go \ - go/image/image.go \ - go/image/names.go \ - go/image/ycbcr.go - -go_io_files = \ - go/io/multi.go \ - go/io/io.go \ - go/io/pipe.go - -go_log_files = \ - go/log/log.go - -go_math_files = \ - go/math/abs.go \ - go/math/acosh.go \ - go/math/asin.go \ - go/math/asinh.go \ - go/math/atan.go \ - go/math/atanh.go \ - go/math/atan2.go \ - go/math/bits.go \ - go/math/cbrt.go \ - go/math/const.go \ - go/math/copysign.go \ - go/math/dim.go \ - go/math/erf.go \ - go/math/exp.go \ - go/math/expm1.go \ - go/math/floor.go \ - go/math/frexp.go \ - go/math/gamma.go \ - go/math/hypot.go \ - go/math/j0.go \ - go/math/j1.go \ - go/math/jn.go \ - go/math/ldexp.go \ - go/math/lgamma.go \ - go/math/log.go \ - go/math/log1p.go \ - go/math/log10.go \ - go/math/logb.go \ - go/math/mod.go \ - go/math/modf.go \ - go/math/nextafter.go \ - go/math/pow.go \ - go/math/pow10.go \ - go/math/remainder.go \ - go/math/signbit.go \ - go/math/sin.go \ - go/math/sincos.go \ - go/math/sinh.go \ - go/math/sqrt.go \ - go/math/tan.go \ - go/math/tanh.go \ - go/math/unsafe.go - -if LIBGO_IS_OPENBSD -go_mime_type_file = go/mime/type_openbsd.go -else -if LIBGO_IS_FREEBSD -go_mime_type_file = go/mime/type_freebsd.go -else -if LIBGO_IS_DRAGONFLY -go_mime_type_file = go/mime/type_dragonfly.go -else -go_mime_type_file = -endif -endif -endif - -go_mime_files = \ - go/mime/encodedword.go \ - go/mime/grammar.go \ - go/mime/mediatype.go \ - go/mime/type.go \ - go/mime/type_unix.go \ - $(go_mime_type_file) - -if LIBGO_IS_LINUX -go_net_cgo_file = go/net/cgo_linux.go -go_net_sock_file = go/net/sock_linux.go -go_net_sockopt_file = go/net/sockopt_linux.go -go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go -go_net_cgo_sock_file = go/net/cgo_socknew.go -go_net_cgo_res_file = go/net/cgo_resnew.go -else -if LIBGO_IS_IRIX -go_net_cgo_file = go/net/cgo_linux.go -go_net_sock_file = go/net/sock_linux.go -go_net_sockopt_file = go/net/sockopt_linux.go -go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go -go_net_cgo_sock_file = go/net/cgo_socknew.go -go_net_cgo_res_file = go/net/cgo_resnew.go -else -if LIBGO_IS_SOLARIS -go_net_cgo_file = go/net/cgo_solaris.go -go_net_sock_file = go/net/sock_stub.go -go_net_sockopt_file = go/net/sockopt_solaris.go -go_net_sockoptip_file = go/net/sockoptip_stub.go -go_net_cgo_sock_file = go/net/cgo_socknew.go -go_net_cgo_res_file = go/net/cgo_resnew.go -else -if LIBGO_IS_FREEBSD -go_net_cgo_file = go/net/cgo_bsd.go -go_net_sock_file = go/net/sock_bsd.go -go_net_sockopt_file = go/net/sockopt_bsd.go -go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -go_net_cgo_sock_file = go/net/cgo_sockold.go -go_net_cgo_res_file = go/net/cgo_resold.go -else -if LIBGO_IS_NETBSD -go_net_cgo_file = go/net/cgo_netbsd.go -go_net_sock_file = go/net/sock_bsd.go -go_net_sockopt_file = go/net/sockopt_bsd.go -go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -go_net_cgo_sock_file = go/net/cgo_sockold.go -go_net_cgo_res_file = go/net/cgo_resnew.go -else -go_net_cgo_file = go/net/cgo_bsd.go -go_net_sock_file = go/net/sock_bsd.go -go_net_sockopt_file = go/net/sockopt_bsd.go -go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -go_net_cgo_sock_file = go/net/cgo_sockold.go -go_net_cgo_res_file = go/net/cgo_resold.go -endif -endif -endif -endif -endif - -if LIBGO_IS_LINUX -go_net_sendfile_file = go/net/sendfile_linux.go -else -if LIBGO_IS_FREEBSD -go_net_sendfile_file = go/net/sendfile_freebsd.go -else -if LIBGO_IS_DRAGONFLY -go_net_sendfile_file = go/net/sendfile_dragonfly.go -else -if LIBGO_IS_SOLARIS -go_net_sendfile_file = go/net/sendfile_solaris.go -else -go_net_sendfile_file = go/net/sendfile_stub.go -endif -endif -endif -endif - -if LIBGO_IS_LINUX -go_net_interface_file = go/net/interface_linux.go -else -if LIBGO_IS_NETBSD -go_net_interface_file = go/net/interface_netbsd.go -else -if LIBGO_IS_DRAGONFLY -go_net_interface_file = go/net/interface_dragonfly.go -else -go_net_interface_file = go/net/interface_stub.go -endif -endif -endif - -if LIBGO_IS_LINUX -go_net_cloexec_file = go/net/sock_cloexec.go go/net/hook_cloexec.go -else -if LIBGO_IS_FREEBSD -go_net_cloexec_file = go/net/sock_cloexec.go go/net/hook_cloexec.go -else -go_net_cloexec_file = go/net/sys_cloexec.go -endif -endif - -if LIBGO_IS_OPENBSD -go_net_tcpsockopt_file = go/net/tcpsockopt_openbsd.go -else -if LIBGO_IS_DARWIN -go_net_tcpsockopt_file = go/net/tcpsockopt_darwin.go -else -if LIBGO_IS_SOLARIS -go_net_tcpsockopt_file = go/net/tcpsockopt_solaris.go -else -if LIBGO_IS_DRAGONFLY -go_net_tcpsockopt_file = go/net/tcpsockopt_dragonfly.go -else -go_net_tcpsockopt_file = go/net/tcpsockopt_unix.go -endif -endif -endif -endif - -go_net_common_files = \ - go/net/addrselect.go \ - $(go_net_cloexec_file) \ - go/net/conf.go \ - go/net/dial.go \ - go/net/dnsclient.go \ - go/net/dnsclient_unix.go \ - go/net/dnsconfig_unix.go \ - go/net/dnsmsg.go \ - go/net/fd_mutex.go \ - go/net/fd_posix.go \ - go/net/fd_unix.go \ - go/net/file.go \ - go/net/file_unix.go \ - go/net/hook.go \ - go/net/hook_unix.go \ - go/net/hosts.go \ - go/net/interface.go \ - $(go_net_interface_file) \ - go/net/ip.go \ - go/net/iprawsock.go \ - go/net/iprawsock_posix.go \ - go/net/ipsock.go \ - go/net/ipsock_posix.go \ - go/net/lookup.go \ - go/net/lookup_unix.go \ - go/net/mac.go \ - go/net/net.go \ - go/net/nss.go \ - go/net/parse.go \ - go/net/pipe.go \ - go/net/fd_poll_runtime.go \ - go/net/port.go \ - go/net/port_unix.go \ - go/net/race0.go \ - $(go_net_sendfile_file) \ - go/net/sock_posix.go \ - $(go_net_sock_file) \ - go/net/sockopt_posix.go \ - $(go_net_sockopt_file) \ - $(go_net_sockoptip_file) \ - go/net/tcpsock.go \ - go/net/tcpsock_posix.go \ - go/net/tcpsockopt_posix.go \ - $(go_net_tcpsockopt_file) \ - go/net/udpsock.go \ - go/net/udpsock_posix.go \ - go/net/unixsock.go \ - go/net/unixsock_posix.go - -go_net_files = \ - go/net/cgo_unix.go \ - $(go_net_cgo_file) \ - $(go_net_cgo_res_file) \ - $(go_net_cgo_sock_file) \ - $(go_net_common_files) - -go_netgo_files = \ - go/net/cgo_stub.go \ - $(go_net_common_files) - -if LIBGO_IS_SOLARIS -if LIBGO_IS_386 -go_os_dir_file = go/os/dir_largefile.go -else -if LIBGO_IS_SPARC -go_os_dir_file = go/os/dir_largefile.go -else -go_os_dir_file = go/os/dir_regfile.go -endif -endif -else -if LIBGO_IS_LINUX -go_os_dir_file = go/os/dir_largefile.go -else -go_os_dir_file = go/os/dir_regfile.go -endif -endif - -if LIBGO_IS_DARWIN -go_os_getwd_file = go/os/getwd_darwin.go -else -go_os_getwd_file = -endif - -if LIBGO_IS_LINUX -go_os_sys_file = go/os/sys_linux.go -else -if LIBGO_IS_SOLARIS -go_os_sys_file = go/os/sys_uname.go -else -if LIBGO_IS_IRIX -go_os_sys_file = go/os/sys_uname.go -else -if LIBGO_IS_RTEMS -go_os_sys_file = go/os/sys_uname.go -else -go_os_sys_file = go/os/sys_bsd.go -endif -endif -endif -endif - -if LIBGO_IS_FREEBSD -go_os_cloexec_file = go/os/sys_freebsd.go -else -if LIBGO_IS_DARWIN -go_os_cloexec_file = go/os/sys_darwin.go -else -go_os_cloexec_file = go/os/sys_unix.go -endif -endif - -if LIBGO_IS_SOLARIS -if HAVE_STAT_TIMESPEC -go_os_stat_file = go/os/stat_atim.go -else -go_os_stat_file = go/os/stat_solaris.go -endif -else -if LIBGO_IS_LINUX -go_os_stat_file = go/os/stat_atim.go -else -if LIBGO_IS_OPENBSD -go_os_stat_file = go/os/stat_atim.go -else -if LIBGO_IS_DARWIN -go_os_stat_file = go/os/stat_atimespec.go -else -if LIBGO_IS_FREEBSD -go_os_stat_file = go/os/stat_atimespec.go -else -if LIBGO_IS_NETBSD -go_os_stat_file = go/os/stat_atimespec.go -else -if LIBGO_IS_DRAGONFLY -go_os_stat_file = go/os/stat_dragonfly.go -else -go_os_stat_file = go/os/stat.go -endif -endif -endif -endif -endif -endif -endif - -if LIBGO_IS_LINUX -go_os_pipe_file = go/os/pipe_linux.go -else -go_os_pipe_file = go/os/pipe_bsd.go -endif - -if LIBGO_IS_DARWIN -go_os_sticky_file = go/os/sticky_bsd.go -else -if LIBGO_IS_DRAGONFLY -go_os_sticky_file = go/os/sticky_bsd.go -else -if LIBGO_IS_FREEBSD -go_os_sticky_file = go/os/sticky_bsd.go -else -if LIBGO_IS_NETBSD -go_os_sticky_file = go/os/sticky_bsd.go -else -if LIBGO_IS_OPENBSD -go_os_sticky_file = go/os/sticky_bsd.go -else -if LIBGO_IS_SOLARIS -go_os_sticky_file = go/os/sticky_bsd.go -else -go_os_sticky_file = go/os/sticky_notbsd.go -endif -endif -endif -endif -endif -endif - -go_os_files = \ - $(go_os_dir_file) \ - go/os/dir.go \ - go/os/doc.go \ - go/os/env.go \ - go/os/error.go \ - go/os/error_unix.go \ - go/os/exec.go \ - go/os/exec_posix.go \ - go/os/exec_unix.go \ - go/os/file.go \ - go/os/file_posix.go \ - go/os/file_unix.go \ - go/os/getwd.go \ - $(go_os_getwd_file) \ - go/os/path.go \ - go/os/path_unix.go \ - $(go_os_pipe_file) \ - go/os/proc.go \ - $(go_os_stat_file) \ - $(go_os_sticky_file) \ - go/os/str.go \ - $(go_os_sys_file) \ - $(go_os_cloexec_file) \ - go/os/types.go \ - go/os/types_notwin.go - -go_path_files = \ - go/path/match.go \ - go/path/path.go - -go_reflect_files = \ - go/reflect/deepequal.go \ - go/reflect/makefunc.go \ - go/reflect/makefunc_ffi.go \ - go/reflect/type.go \ - go/reflect/value.go -go_reflect_makefunc_c_file = \ - go/reflect/makefunc_ffi_c.c - -go_regexp_files = \ - go/regexp/backtrack.go \ - go/regexp/exec.go \ - go/regexp/onepass.go \ - go/regexp/regexp.go - -go_net_rpc_files = \ - go/net/rpc/client.go \ - go/net/rpc/debug.go \ - go/net/rpc/server.go - -go_runtime_files = \ - go/runtime/compiler.go \ - go/runtime/debug.go \ - go/runtime/error.go \ - go/runtime/extern.go \ - go/runtime/mem.go \ - version.go - -version.go: s-version; @true -s-version: Makefile - rm -f version.go.tmp - echo "package runtime" > version.go.tmp - echo 'const defaultGoroot = "$(prefix)"' >> version.go.tmp - echo 'const theVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp - echo 'const theGoarch = "'$(GOARCH)'"' >> version.go.tmp - echo 'const theGoos = "'$(GOOS)'"' >> version.go.tmp - echo 'const theGccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go - $(STAMP) $@ - -noinst_DATA = zstdpkglist.go - -# Generate the list of go std packages that were included in libgo -zstdpkglist.go: s-zstdpkglist; @true -s-zstdpkglist: Makefile - rm -f zstdpkglist.go.tmp - echo 'package main' > zstdpkglist.go.tmp - echo "" >> zstdpkglist.go.tmp - echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | sed 's/\.lo/\": true,/' | sed 's/-go//' | grep -v _c | sed 's/^/\t\"/' | sort | uniq >> zstdpkglist.go.tmp - echo '}' >> zstdpkglist.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go - $(STAMP) $@ - -go_sort_files = \ - go/sort/search.go \ - go/sort/sort.go - -go_strconv_files = \ - go/strconv/atob.go \ - go/strconv/atof.go \ - go/strconv/atoi.go \ - go/strconv/decimal.go \ - go/strconv/doc.go \ - go/strconv/extfloat.go \ - go/strconv/ftoa.go \ - go/strconv/isprint.go \ - go/strconv/itoa.go \ - go/strconv/quote.go - -go_strings_files = \ - go/strings/compare.go \ - go/strings/reader.go \ - go/strings/replace.go \ - go/strings/search.go \ - go/strings/strings.go \ - go/strings/strings_decl.go -go_strings_c_files = \ - go/strings/indexbyte.c - -go_sync_files = \ - go/sync/cond.go \ - go/sync/mutex.go \ - go/sync/once.go \ - go/sync/pool.go \ - go/sync/race0.go \ - go/sync/runtime.go \ - go/sync/rwmutex.go \ - go/sync/waitgroup.go - -if LIBGO_IS_SOLARIS -go_syslog_file = go/log/syslog/syslog_libc.go -else -if LIBGO_IS_IRIX -go_syslog_file = go/log/syslog/syslog_libc.go -else -go_syslog_file = go/log/syslog/syslog_unix.go -endif -endif - -go_log_syslog_files = \ - go/log/syslog/doc.go \ - go/log/syslog/syslog.go \ - $(go_syslog_file) -go_syslog_c_files = \ - go/log/syslog/syslog_c.c - -go_testing_files = \ - go/testing/allocs.go \ - go/testing/benchmark.go \ - go/testing/cover.go \ - go/testing/example.go \ - go/testing/testing.go - -go_time_files = \ - go/time/format.go \ - go/time/sleep.go \ - go/time/sys_unix.go \ - go/time/tick.go \ - go/time/time.go \ - go/time/zoneinfo.go \ - go/time/zoneinfo_read.go \ - go/time/zoneinfo_unix.go - -go_unicode_files = \ - go/unicode/casetables.go \ - go/unicode/digit.go \ - go/unicode/graphic.go \ - go/unicode/letter.go \ - go/unicode/tables.go - -if LIBGO_IS_LINUX -archive_tar_atim_file = go/archive/tar/stat_atim.go -endif -if LIBGO_IS_OPENBSD -archive_tar_atim_file = go/archive/tar/stat_atim.go -endif -if LIBGO_IS_SOLARIS -archive_tar_atim_file = go/archive/tar/stat_atim.go -endif -if LIBGO_IS_DARWIN -archive_tar_atim_file = go/archive/tar/stat_atimespec.go -endif -if LIBGO_IS_FREEBSD -archive_tar_atim_file = go/archive/tar/stat_atimespec.go -endif -if LIBGO_IS_NETBSD -archive_tar_atim_file = go/archive/tar/stat_atimespec.go -endif - -go_archive_tar_files = \ - go/archive/tar/common.go \ - go/archive/tar/reader.go \ - go/archive/tar/stat_unix.go \ - go/archive/tar/writer.go \ - $(archive_tar_atim_file) - -go_archive_zip_files = \ - go/archive/zip/reader.go \ - go/archive/zip/register.go \ - go/archive/zip/struct.go \ - go/archive/zip/writer.go - -go_compress_bzip2_files = \ - go/compress/bzip2/bit_reader.go \ - go/compress/bzip2/bzip2.go \ - go/compress/bzip2/huffman.go \ - go/compress/bzip2/move_to_front.go - -go_compress_flate_files = \ - go/compress/flate/copy.go \ - go/compress/flate/deflate.go \ - go/compress/flate/fixedhuff.go \ - go/compress/flate/huffman_bit_writer.go \ - go/compress/flate/huffman_code.go \ - go/compress/flate/inflate.go \ - go/compress/flate/reverse_bits.go \ - go/compress/flate/token.go - -go_compress_gzip_files = \ - go/compress/gzip/gzip.go \ - go/compress/gzip/gunzip.go - -go_compress_lzw_files = \ - go/compress/lzw/reader.go \ - go/compress/lzw/writer.go - -go_compress_zlib_files = \ - go/compress/zlib/reader.go \ - go/compress/zlib/writer.go - -go_container_heap_files = \ - go/container/heap/heap.go - -go_container_list_files = \ - go/container/list/list.go - -go_container_ring_files = \ - go/container/ring/ring.go - -go_crypto_aes_files = \ - go/crypto/aes/block.go \ - go/crypto/aes/cipher.go \ - go/crypto/aes/cipher_generic.go \ - go/crypto/aes/const.go -go_crypto_cipher_files = \ - go/crypto/cipher/cbc.go \ - go/crypto/cipher/cfb.go \ - go/crypto/cipher/cipher.go \ - go/crypto/cipher/ctr.go \ - go/crypto/cipher/gcm.go \ - go/crypto/cipher/io.go \ - go/crypto/cipher/ofb.go \ - go/crypto/cipher/xor.go -go_crypto_des_files = \ - go/crypto/des/block.go \ - go/crypto/des/cipher.go \ - go/crypto/des/const.go -go_crypto_dsa_files = \ - go/crypto/dsa/dsa.go -go_crypto_ecdsa_files = \ - go/crypto/ecdsa/ecdsa.go -go_crypto_elliptic_files = \ - go/crypto/elliptic/elliptic.go \ - go/crypto/elliptic/p224.go \ - go/crypto/elliptic/p256.go -go_crypto_hmac_files = \ - go/crypto/hmac/hmac.go -go_crypto_md5_files = \ - go/crypto/md5/md5.go \ - go/crypto/md5/md5block.go \ - go/crypto/md5/md5block_generic.go - -if LIBGO_IS_LINUX -crypto_rand_file = go/crypto/rand/rand_linux.go -else -crypto_rand_file = -endif - -go_crypto_rand_files = \ - go/crypto/rand/eagain.go \ - go/crypto/rand/rand.go \ - go/crypto/rand/rand_unix.go \ - $(crypto_rand_file) \ - go/crypto/rand/util.go - -go_crypto_rc4_files = \ - go/crypto/rc4/rc4.go \ - go/crypto/rc4/rc4_ref.go -go_crypto_rsa_files = \ - go/crypto/rsa/pkcs1v15.go \ - go/crypto/rsa/pss.go \ - go/crypto/rsa/rsa.go -go_crypto_sha1_files = \ - go/crypto/sha1/sha1.go \ - go/crypto/sha1/sha1block.go \ - go/crypto/sha1/sha1block_generic.go -go_crypto_sha256_files = \ - go/crypto/sha256/sha256.go \ - go/crypto/sha256/sha256block.go -go_crypto_sha512_files = \ - go/crypto/sha512/sha512.go \ - go/crypto/sha512/sha512block.go -go_crypto_subtle_files = \ - go/crypto/subtle/constant_time.go -go_crypto_tls_files = \ - go/crypto/tls/alert.go \ - go/crypto/tls/cipher_suites.go \ - go/crypto/tls/common.go \ - go/crypto/tls/conn.go \ - go/crypto/tls/handshake_client.go \ - go/crypto/tls/handshake_messages.go \ - go/crypto/tls/handshake_server.go \ - go/crypto/tls/key_agreement.go \ - go/crypto/tls/prf.go \ - go/crypto/tls/ticket.go \ - go/crypto/tls/tls.go - -if LIBGO_IS_LINUX -go_crypto_x509_root_file = go/crypto/x509/root_linux.go -else -if LIBGO_IS_SOLARIS -go_crypto_x509_root_file = go/crypto/x509/root_solaris.go -else -if LIBGO_IS_DRAGONFLY -go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -else -if LIBGO_IS_FREEBSD -go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -else -if LIBGO_IS_NETBSD -go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -else -if LIBGO_IS_OPENBSD -go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -else -if LIBGO_IS_DARWIN -go_crypto_x509_root_file = go/crypto/x509/root_darwin.go -else -go_crypto_x509_root_file = -endif -endif -endif -endif -endif -endif -endif - -go_crypto_x509_files = \ - go/crypto/x509/cert_pool.go \ - go/crypto/x509/pem_decrypt.go \ - go/crypto/x509/pkcs1.go \ - go/crypto/x509/pkcs8.go \ - go/crypto/x509/root.go \ - go/crypto/x509/root_unix.go \ - $(go_crypto_x509_root_file) \ - go/crypto/x509/sec1.go \ - go/crypto/x509/verify.go \ - go/crypto/x509/x509.go - -go_crypto_x509_pkix_files = \ - go/crypto/x509/pkix/pkix.go - -go_database_sql_files = \ - go/database/sql/convert.go \ - go/database/sql/sql.go - -go_database_sql_driver_files = \ - go/database/sql/driver/driver.go \ - go/database/sql/driver/types.go - -go_debug_dwarf_files = \ - go/debug/dwarf/buf.go \ - go/debug/dwarf/class_string.go \ - go/debug/dwarf/const.go \ - go/debug/dwarf/entry.go \ - go/debug/dwarf/line.go \ - go/debug/dwarf/open.go \ - go/debug/dwarf/type.go \ - go/debug/dwarf/typeunit.go \ - go/debug/dwarf/unit.go -go_debug_elf_files = \ - go/debug/elf/elf.go \ - go/debug/elf/file.go -go_debug_gosym_files = \ - go/debug/gosym/pclntab.go \ - go/debug/gosym/symtab.go -go_debug_macho_files = \ - go/debug/macho/fat.go \ - go/debug/macho/file.go \ - go/debug/macho/macho.go -go_debug_pe_files = \ - go/debug/pe/file.go \ - go/debug/pe/pe.go -go_debug_plan9obj_files = \ - go/debug/plan9obj/file.go \ - go/debug/plan9obj/plan9obj.go - -go_encoding_ascii85_files = \ - go/encoding/ascii85/ascii85.go -go_encoding_asn1_files = \ - go/encoding/asn1/asn1.go \ - go/encoding/asn1/common.go \ - go/encoding/asn1/marshal.go -go_encoding_base32_files = \ - go/encoding/base32/base32.go -go_encoding_base64_files = \ - go/encoding/base64/base64.go -go_encoding_binary_files = \ - go/encoding/binary/binary.go \ - go/encoding/binary/varint.go -go_encoding_csv_files = \ - go/encoding/csv/reader.go \ - go/encoding/csv/writer.go -go_encoding_gob_files = \ - go/encoding/gob/decode.go \ - go/encoding/gob/decoder.go \ - go/encoding/gob/dec_helpers.go \ - go/encoding/gob/doc.go \ - go/encoding/gob/encode.go \ - go/encoding/gob/encoder.go \ - go/encoding/gob/enc_helpers.go \ - go/encoding/gob/error.go \ - go/encoding/gob/type.go -go_encoding_hex_files = \ - go/encoding/hex/hex.go -go_encoding_json_files = \ - go/encoding/json/decode.go \ - go/encoding/json/encode.go \ - go/encoding/json/fold.go \ - go/encoding/json/indent.go \ - go/encoding/json/scanner.go \ - go/encoding/json/stream.go \ - go/encoding/json/tags.go -go_encoding_pem_files = \ - go/encoding/pem/pem.go -go_encoding_xml_files = \ - go/encoding/xml/marshal.go \ - go/encoding/xml/read.go \ - go/encoding/xml/typeinfo.go \ - go/encoding/xml/xml.go - -go_exp_proxy_files = \ - go/exp/proxy/direct.go \ - go/exp/proxy/per_host.go \ - go/exp/proxy/proxy.go \ - go/exp/proxy/socks5.go -go_exp_terminal_files = \ - go/exp/terminal/terminal.go \ - go/exp/terminal/util.go - -go_go_ast_files = \ - go/go/ast/ast.go \ - go/go/ast/commentmap.go \ - go/go/ast/filter.go \ - go/go/ast/import.go \ - go/go/ast/print.go \ - go/go/ast/resolve.go \ - go/go/ast/scope.go \ - go/go/ast/walk.go -go_go_build_files = \ - go/go/build/build.go \ - go/go/build/doc.go \ - go/go/build/read.go \ - go/go/build/syslist.go -go_go_constant_files = \ - go/go/constant/go14.go \ - go/go/constant/value.go -go_go_doc_files = \ - go/go/doc/comment.go \ - go/go/doc/doc.go \ - go/go/doc/example.go \ - go/go/doc/exports.go \ - go/go/doc/filter.go \ - go/go/doc/reader.go \ - go/go/doc/synopsis.go -go_go_format_files = \ - go/go/format/format.go -go_go_importer_files = \ - go/go/importer/importer.go -go_go_parser_files = \ - go/go/parser/interface.go \ - go/go/parser/parser.go -go_go_printer_files = \ - go/go/printer/nodes.go \ - go/go/printer/printer.go -go_go_scanner_files = \ - go/go/scanner/errors.go \ - go/go/scanner/scanner.go -go_go_token_files = \ - go/go/token/position.go \ - go/go/token/serialize.go \ - go/go/token/token.go -go_go_types_files = \ - go/go/types/api.go \ - go/go/types/assignments.go \ - go/go/types/builtins.go \ - go/go/types/call.go \ - go/go/types/check.go \ - go/go/types/conversions.go \ - go/go/types/decl.go \ - go/go/types/errors.go \ - go/go/types/eval.go \ - go/go/types/expr.go \ - go/go/types/exprstring.go \ - go/go/types/go12.go \ - go/go/types/initorder.go \ - go/go/types/labels.go \ - go/go/types/lookup.go \ - go/go/types/methodset.go \ - go/go/types/object.go \ - go/go/types/objset.go \ - go/go/types/operand.go \ - go/go/types/ordering.go \ - go/go/types/package.go \ - go/go/types/predicates.go \ - go/go/types/resolver.go \ - go/go/types/return.go \ - go/go/types/scope.go \ - go/go/types/selection.go \ - go/go/types/stmt.go \ - go/go/types/sizes.go \ - go/go/types/type.go \ - go/go/types/typestring.go \ - go/go/types/typexpr.go \ - go/go/types/universe.go - -go_go_internal_gcimporter_files = \ - go/go/internal/gcimporter/exportdata.go \ - go/go/internal/gcimporter/gcimporter.go -go_go_internal_gccgoimporter_files = \ - go/go/internal/gccgoimporter/gccgoinstallation.go \ - go/go/internal/gccgoimporter/importer.go \ - go/go/internal/gccgoimporter/parser.go - -go_hash_adler32_files = \ - go/hash/adler32/adler32.go -go_hash_crc32_files = \ - go/hash/crc32/crc32.go \ - go/hash/crc32/crc32_generic.go -go_hash_crc64_files = \ - go/hash/crc64/crc64.go -go_hash_fnv_files = \ - go/hash/fnv/fnv.go - -go_html_template_files = \ - go/html/template/attr.go \ - go/html/template/content.go \ - go/html/template/context.go \ - go/html/template/css.go \ - go/html/template/doc.go \ - go/html/template/error.go \ - go/html/template/escape.go \ - go/html/template/html.go \ - go/html/template/js.go \ - go/html/template/template.go \ - go/html/template/transition.go \ - go/html/template/url.go - -go_image_color_files = \ - go/image/color/color.go \ - go/image/color/ycbcr.go - -go_image_color_palette_files = \ - go/image/color/palette/palette.go - -go_image_draw_files = \ - go/image/draw/draw.go - -go_image_gif_files = \ - go/image/gif/reader.go \ - go/image/gif/writer.go - -go_image_internal_imageutil_files = \ - go/image/internal/imageutil/imageutil.go \ - go/image/internal/imageutil/impl.go - -go_image_jpeg_files = \ - go/image/jpeg/fdct.go \ - go/image/jpeg/huffman.go \ - go/image/jpeg/idct.go \ - go/image/jpeg/reader.go \ - go/image/jpeg/scan.go \ - go/image/jpeg/writer.go - -go_image_png_files = \ - go/image/png/paeth.go \ - go/image/png/reader.go \ - go/image/png/writer.go - -go_index_suffixarray_files = \ - go/index/suffixarray/qsufsort.go \ - go/index/suffixarray/suffixarray.go - -go_internal_format_files = \ - go/internal/format/format.go -go_internal_singleflight_files = \ - go/internal/singleflight/singleflight.go - -if LIBGO_IS_LINUX -internal_syscall_unix_getrandom_file = go/internal/syscall/unix/getrandom_linux.go -else -internal_syscall_unix_getrandom_file = -endif - -go_internal_syscall_unix_files = \ - go/internal/syscall/unix/dummy.go \ - $(internal_syscall_unix_getrandom_file) - -go_internal_testenv_files = \ - go/internal/testenv/testenv.go -go_internal_trace_files = \ - go/internal/trace/goroutines.go \ - go/internal/trace/parser.go - -go_io_ioutil_files = \ - go/io/ioutil/ioutil.go \ - go/io/ioutil/tempfile.go - -go_math_big_files = \ - go/math/big/accuracy_string.go \ - go/math/big/arith.go \ - go/math/big/arith_decl_pure.go \ - go/math/big/decimal.go \ - go/math/big/float.go \ - go/math/big/floatconv.go \ - go/math/big/ftoa.go \ - go/math/big/int.go \ - go/math/big/intconv.go \ - go/math/big/nat.go \ - go/math/big/natconv.go \ - go/math/big/rat.go \ - go/math/big/ratconv.go \ - go/math/big/roundingmode_string.go -go_math_cmplx_files = \ - go/math/cmplx/abs.go \ - go/math/cmplx/asin.go \ - go/math/cmplx/conj.go \ - go/math/cmplx/exp.go \ - go/math/cmplx/isinf.go \ - go/math/cmplx/isnan.go \ - go/math/cmplx/log.go \ - go/math/cmplx/phase.go \ - go/math/cmplx/polar.go \ - go/math/cmplx/pow.go \ - go/math/cmplx/rect.go \ - go/math/cmplx/sin.go \ - go/math/cmplx/sqrt.go \ - go/math/cmplx/tan.go -go_math_rand_files = \ - go/math/rand/exp.go \ - go/math/rand/normal.go \ - go/math/rand/rand.go \ - go/math/rand/rng.go \ - go/math/rand/zipf.go - -go_mime_multipart_files = \ - go/mime/multipart/formdata.go \ - go/mime/multipart/multipart.go \ - go/mime/multipart/writer.go - -go_mime_quotedprintable_files = \ - go/mime/quotedprintable/reader.go \ - go/mime/quotedprintable/writer.go - -go_net_http_files = \ - go/net/http/client.go \ - go/net/http/cookie.go \ - go/net/http/filetransport.go \ - go/net/http/fs.go \ - go/net/http/header.go \ - go/net/http/jar.go \ - go/net/http/lex.go \ - go/net/http/request.go \ - go/net/http/response.go \ - go/net/http/server.go \ - go/net/http/sniff.go \ - go/net/http/status.go \ - go/net/http/transfer.go \ - go/net/http/transport.go -go_net_mail_files = \ - go/net/mail/message.go -go_net_smtp_files = \ - go/net/smtp/auth.go \ - go/net/smtp/smtp.go -go_net_textproto_files = \ - go/net/textproto/header.go \ - go/net/textproto/pipeline.go \ - go/net/textproto/reader.go \ - go/net/textproto/textproto.go \ - go/net/textproto/writer.go -go_net_url_files = \ - go/net/url/url.go - -go_net_http_cgi_files = \ - go/net/http/cgi/child.go \ - go/net/http/cgi/host.go -go_net_http_cookiejar_files = \ - go/net/http/cookiejar/jar.go \ - go/net/http/cookiejar/punycode.go -go_net_http_fcgi_files = \ - go/net/http/fcgi/child.go \ - go/net/http/fcgi/fcgi.go -go_net_http_httptest_files = \ - go/net/http/httptest/recorder.go \ - go/net/http/httptest/server.go -go_net_http_pprof_files = \ - go/net/http/pprof/pprof.go -go_net_http_httputil_files = \ - go/net/http/httputil/dump.go \ - go/net/http/httputil/httputil.go \ - go/net/http/httputil/persist.go \ - go/net/http/httputil/reverseproxy.go -go_net_http_internal_files = \ - go/net/http/internal/chunked.go - -if LIBGO_IS_LINUX -go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go -else -if LIBGO_IS_FREEBSD -go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go -else -go_net_internal_socktest_sys = -endif -endif - -go_net_internal_socktest_files = \ - go/net/internal/socktest/switch.go \ - go/net/internal/socktest/switch_posix.go \ - go/net/internal/socktest/switch_unix.go \ - go/net/internal/socktest/sys_unix.go \ - $(go_net_internal_socktest_sys) - -go_old_regexp_files = \ - go/old/regexp/regexp.go -go_old_template_files = \ - go/old/template/doc.go \ - go/old/template/execute.go \ - go/old/template/format.go \ - go/old/template/parse.go - -go_os_exec_files = \ - go/os/exec/exec.go \ - go/os/exec/exec_posix.go \ - go/os/exec/lp_unix.go - -go_os_signal_files = \ - go/os/signal/signal.go \ - go/os/signal/signal_unix.go - -if LIBGO_IS_SOLARIS -os_user_decls_file = go/os/user/decls_solaris.go -else -os_user_decls_file = go/os/user/decls_unix.go -endif - -go_os_user_files = \ - go/os/user/lookup.go \ - go/os/user/lookup_unix.go \ - go/os/user/user.go \ - $(os_user_decls_file) - -go_path_filepath_files = \ - go/path/filepath/match.go \ - go/path/filepath/path.go \ - go/path/filepath/path_unix.go \ - go/path/filepath/symlink.go \ - go/path/filepath/symlink_unix.go - -go_regexp_syntax_files = \ - go/regexp/syntax/compile.go \ - go/regexp/syntax/doc.go \ - go/regexp/syntax/parse.go \ - go/regexp/syntax/perl_groups.go \ - go/regexp/syntax/prog.go \ - go/regexp/syntax/regexp.go \ - go/regexp/syntax/simplify.go - -go_net_rpc_jsonrpc_files = \ - go/net/rpc/jsonrpc/client.go \ - go/net/rpc/jsonrpc/server.go - -go_runtime_debug_files = \ - go/runtime/debug/garbage.go \ - go/runtime/debug/stack.go -go_runtime_pprof_files = \ - go/runtime/pprof/pprof.go - -go_text_tabwriter_files = \ - go/text/tabwriter/tabwriter.go -go_text_template_files = \ - go/text/template/doc.go \ - go/text/template/exec.go \ - go/text/template/funcs.go \ - go/text/template/helper.go \ - go/text/template/option.go \ - go/text/template/template.go -go_text_template_parse_files = \ - go/text/template/parse/lex.go \ - go/text/template/parse/node.go \ - go/text/template/parse/parse.go - -go_sync_atomic_files = \ - go/sync/atomic/doc.go \ - go/sync/atomic/value.go -go_sync_atomic_c_files = \ - go/sync/atomic/atomic.c - -go_testing_iotest_files = \ - go/testing/iotest/logger.go \ - go/testing/iotest/reader.go \ - go/testing/iotest/writer.go -go_testing_quick_files = \ - go/testing/quick/quick.go - -go_text_scanner_files = \ - go/text/scanner/scanner.go - -go_unicode_utf16_files = \ - go/unicode/utf16/utf16.go -go_unicode_utf8_files = \ - go/unicode/utf8/utf8.go - -# Define Syscall and Syscall6. -if LIBGO_IS_RTEMS -syscall_syscall_file = go/syscall/syscall_stubs.go -else -syscall_syscall_file = go/syscall/syscall_unix.go -endif - -# Define ForkExec and Exec. -if LIBGO_IS_RTEMS -syscall_exec_file = go/syscall/exec_stubs.go -syscall_exec_os_file = -else -if LIBGO_IS_LINUX -syscall_exec_file = go/syscall/exec_unix.go -syscall_exec_os_file = go/syscall/exec_linux.go -else -syscall_exec_file = go/syscall/exec_unix.go -syscall_exec_os_file = go/syscall/exec_bsd.go -endif -endif - -# Define Wait4. -if LIBGO_IS_RTEMS -syscall_wait_file = -else -if HAVE_WAIT4 -syscall_wait_file = go/syscall/libcall_wait4.go -else -syscall_wait_file = go/syscall/libcall_waitpid.go -endif -endif - -# Support for pulling apart wait status. -if LIBGO_IS_RTEMS -syscall_wait_c_file = -else -syscall_wait_c_file = go/syscall/wait.c -endif - -# Define Sleep. -if LIBGO_IS_RTEMS -syscall_sleep_file = go/syscall/sleep_rtems.go -else -syscall_sleep_file = go/syscall/sleep_select.go -endif - -# Define Errstr. -if LIBGO_IS_LINUX -syscall_errstr_file = go/syscall/errstr_linux.go -else -if LIBGO_IS_RTEMS -syscall_errstr_file = go/syscall/errstr_linux.go -else -if HAVE_STRERROR_R -syscall_errstr_file = go/syscall/errstr.go -else -syscall_errstr_file = go/syscall/errstr_nor.go -endif -endif -endif - -# Declare libc functions that vary for largefile systems. -if LIBGO_IS_LINUX -# Always use lseek64 on GNU/Linux. -syscall_size_file = go/syscall/libcall_posix_largefile.go -else # !LIBGO_IS_LINUX -if LIBGO_IS_SOLARIS -if LIBGO_IS_386 -# Use lseek64 on 32-bit Solaris/x86. -syscall_size_file = go/syscall/libcall_posix_largefile.go -else # !LIBGO_IS_386 -if LIBGO_IS_SPARC -# Use lseek64 on 32-bit Solaris/SPARC. -syscall_size_file = go/syscall/libcall_posix_largefile.go -else # !LIBGO_IS_386 && !LIBGO_IS_SPARC -# Use lseek on 64-bit Solaris. -syscall_size_file = go/syscall/libcall_posix_regfile.go -endif # !LIBGO_IS_386 && !LIBGO_IS_SPARC -endif # !LIBGO_IS_SOLARIS -else # !LIBGO_IS_LINUX && !LIBGO_IS_SOLARIS -# Use lseek by default. -syscall_size_file = go/syscall/libcall_posix_regfile.go -endif # !LIBGO_IS_SOLARIS -endif # !LIBGO_IS_LINUX - -# Define socket sizes and types. -if LIBGO_IS_LINUX -syscall_socket_file = go/syscall/socket_linux.go epoll.go -if LIBGO_IS_PPC64LE -syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go -else -if LIBGO_IS_PPC64 -syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go -else -syscall_socket_type_file = go/syscall/socket_linux_type.go -endif -endif -else -syscall_socket_type_file = -if LIBGO_IS_SOLARIS -syscall_socket_file = go/syscall/socket_solaris.go -else -if LIBGO_IS_IRIX -syscall_socket_file = go/syscall/socket_irix.go -else -syscall_socket_file = go/syscall/socket_bsd.go -endif -endif -endif - -# Define socket functions. -if LIBGO_IS_SOLARIS -syscall_socket_os_file = go/syscall/socket_xnet.go -else -syscall_socket_os_file = go/syscall/socket_posix.go -endif - -# Support for uname. -if LIBGO_IS_SOLARIS -if LIBGO_IS_386 -# 32-bit Solaris 2/x86 needs _nuname, handled in libcall_solaris_386.go. -syscall_uname_file = -else # !LIBGO_IS_386 && LIBGO_IS_SOLARIS -syscall_uname_file = go/syscall/libcall_uname.go -endif -else # !LIBGO_IS_SOLARIS -syscall_uname_file = go/syscall/libcall_uname.go -endif - -# GNU/Linux specific socket control messages. -if LIBGO_IS_LINUX -syscall_sockcmsg_file = go/syscall/sockcmsg_linux.go -else -syscall_sockcmsg_file = -endif - -# Support for netlink sockets and messages. -if LIBGO_IS_LINUX -syscall_netlink_file = go/syscall/netlink_linux.go -else -syscall_netlink_file = -endif - -# GNU/Linux specific socket filters. -if LIBGO_IS_LINUX -syscall_lsf_file = go/syscall/lsf_linux.go -else -syscall_lsf_file = -endif - -# GNU/Linux specific ustat support. -if LIBGO_IS_LINUX -if LIBGO_IS_ARM64 -syscall_ustat_file = -else -syscall_ustat_file = go/syscall/libcall_linux_ustat.go -endif -else -syscall_ustat_file = -endif - -# GNU/Linux specific utimesnano support. -if LIBGO_IS_LINUX -syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go -else -syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go -endif - -# Test files. -if LIBGO_IS_LINUX -syscall_creds_test_file = go/syscall/creds_test.go -else -syscall_creds_test_file = -endif - -if LIBGO_IS_LINUX -syscall_exec_test_file = go/syscall/exec_linux_test.go go/syscall/syscall_linux_test.go -else -syscall_exec_test_file = -endif - -if LIBGO_IS_LINUX -syscall_os_file = -else -syscall_os_file = go/syscall/libcall_bsd.go -endif - -go_base_syscall_files = \ - go/syscall/env_unix.go \ - go/syscall/syscall_errno.go \ - go/syscall/libcall_support.go \ - go/syscall/libcall_posix.go \ - go/syscall/race0.go \ - go/syscall/socket.go \ - go/syscall/sockcmsg_unix.go \ - go/syscall/str.go \ - go/syscall/syscall.go \ - $(syscall_sockcmsg_file) \ - $(syscall_syscall_file) \ - $(syscall_exec_file) \ - $(syscall_exec_os_file) \ - $(syscall_wait_file) \ - $(syscall_sleep_file) \ - $(syscall_errstr_file) \ - $(syscall_size_file) \ - $(syscall_os_file) \ - $(syscall_socket_file) \ - $(syscall_socket_os_file) \ - $(syscall_socket_type_file) \ - $(syscall_uname_file) \ - $(syscall_netlink_file) \ - $(syscall_lsf_file) \ - $(syscall_ustat_file) \ - $(syscall_utimesnano_file) \ - $(GO_LIBCALL_OS_FILE) \ - $(GO_LIBCALL_OS_ARCH_FILE) \ - $(GO_SYSCALL_OS_FILE) \ - $(GO_SYSCALL_OS_ARCH_FILE) - -go_syscall_files = \ - $(go_base_syscall_files) \ - libcalls.go \ - sysinfo.go \ - syscall_arch.go -go_syscall_c_files = \ - go/syscall/errno.c \ - go/syscall/signame.c \ - $(syscall_wait_c_file) - -go_syscall_test_files = \ - $(syscall_creds_test_file) \ - $(syscall_exec_test_file) \ - go/syscall/exec_unix_test.go \ - go/syscall/export_test.go \ - go/syscall/export_unix_test.go \ - go/syscall/mmap_unix_test.go \ - go/syscall/syscall_test.go \ - go/syscall/syscall_unix_test.go - -libcalls.go: s-libcalls; @true -s-libcalls: libcalls-list go/syscall/mksyscall.awk $(go_base_syscall_files) - rm -f libcalls.go.tmp - files=`echo $^ | sed -e 's/libcalls-list//' -e 's|[^ ]*go/syscall/mksyscall.awk||'`; \ - $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk $${files} > libcalls.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go - $(STAMP) $@ - -libcalls-list: s-libcalls-list; @true -s-libcalls-list: Makefile - rm -f libcalls-list.tmp - echo $(go_base_syscall_files) > libcalls-list.tmp - $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list - $(STAMP) $@ - -syscall_arch.go: s-syscall_arch; @true -s-syscall_arch: Makefile - rm -f syscall_arch.go.tmp - echo "package syscall" > syscall_arch.go.tmp - echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp - echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go - $(STAMP) $@ - -sysinfo.go: s-sysinfo; @true -s-sysinfo: $(srcdir)/mksysinfo.sh config.h - CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh - $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go - $(STAMP) $@ - -# The epoll struct has an embedded union and is packed on x86_64, -# which is too complicated for mksysinfo.sh. We find the offset of -# the only field we care about in configure.ac, and generate the -# struct here. -epoll.go: s-epoll; @true -s-epoll: Makefile - rm -f epoll.go.tmp - echo 'package syscall' > epoll.go.tmp - echo 'type EpollEvent struct {' >> epoll.go.tmp - echo ' Events uint32' >> epoll.go.tmp - case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \ - 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \ - exit 1; ;; \ - 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \ - 12,4) echo ' Fd int32' >> epoll.go.tmp; \ - echo ' Pad [4]byte' >> epoll.go.tmp; ;; \ - 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ - echo ' Fd int32' >> epoll.go.tmp; ;; \ - 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ - echo ' Fd int32' >> epoll.go.tmp; \ - echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \ - *) echo 1>&2 "*** struct epoll_event unsupported"; \ - exit 1; ;; \ - esac - echo '}' >> epoll.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go - $(STAMP) $@ - -if LIBGO_IS_LINUX -# os_lib_inotify_lo = os/inotify.lo -os_lib_inotify_lo = -else -os_lib_inotify_lo = -endif - -libgo_go_objs = \ - bufio.lo \ - bytes.lo \ - bytes/index.lo \ - crypto.lo \ - encoding.lo \ - errors.lo \ - expvar.lo \ - flag.lo \ - fmt.lo \ - hash.lo \ - html.lo \ - image.lo \ - io.lo \ - log.lo \ - math.lo \ - mime.lo \ - net.lo \ - os.lo \ - path.lo \ - reflect-go.lo \ - reflect/makefunc_ffi_c.lo \ - regexp.lo \ - runtime-go.lo \ - sort.lo \ - strconv.lo \ - strings.lo \ - strings/index.lo \ - sync.lo \ - syscall.lo \ - syscall/errno.lo \ - syscall/signame.lo \ - syscall/wait.lo \ - testing.lo \ - time-go.lo \ - unicode.lo \ - archive/tar.lo \ - archive/zip.lo \ - compress/bzip2.lo \ - compress/flate.lo \ - compress/gzip.lo \ - compress/lzw.lo \ - compress/zlib.lo \ - container/heap.lo \ - container/list.lo \ - container/ring.lo \ - crypto/aes.lo \ - crypto/cipher.lo \ - crypto/des.lo \ - crypto/dsa.lo \ - crypto/ecdsa.lo \ - crypto/elliptic.lo \ - crypto/hmac.lo \ - crypto/md5.lo \ - crypto/rand.lo \ - crypto/rc4.lo \ - crypto/rsa.lo \ - crypto/sha1.lo \ - crypto/sha256.lo \ - crypto/sha512.lo \ - crypto/subtle.lo \ - crypto/tls.lo \ - crypto/x509.lo \ - crypto/x509/pkix.lo \ - database/sql.lo \ - database/sql/driver.lo \ - debug/dwarf.lo \ - debug/elf.lo \ - debug/gosym.lo \ - debug/macho.lo \ - debug/pe.lo \ - debug/plan9obj.lo \ - encoding/ascii85.lo \ - encoding/asn1.lo \ - encoding/base32.lo \ - encoding/base64.lo \ - encoding/binary.lo \ - encoding/csv.lo \ - encoding/gob.lo \ - encoding/hex.lo \ - encoding/json.lo \ - encoding/pem.lo \ - encoding/xml.lo \ - exp/proxy.lo \ - exp/terminal.lo \ - html/template.lo \ - go/ast.lo \ - go/build.lo \ - go/constant.lo \ - go/doc.lo \ - go/format.lo \ - go/importer.lo \ - go/internal/gcimporter.lo \ - go/internal/gccgoimporter.lo \ - go/parser.lo \ - go/printer.lo \ - go/scanner.lo \ - go/token.lo \ - go/types.lo \ - hash/adler32.lo \ - hash/crc32.lo \ - hash/crc64.lo \ - hash/fnv.lo \ - net/http/cgi.lo \ - net/http/cookiejar.lo \ - net/http/fcgi.lo \ - net/http/httptest.lo \ - net/http/httputil.lo \ - net/http/internal.lo \ - net/http/pprof.lo \ - image/color.lo \ - image/color/palette.lo \ - image/draw.lo \ - image/gif.lo \ - image/internal/imageutil.lo \ - image/jpeg.lo \ - image/png.lo \ - index/suffixarray.lo \ - internal/format.lo \ - internal/singleflight.lo \ - internal/syscall/unix.lo \ - internal/testenv.lo \ - internal/trace.lo \ - io/ioutil.lo \ - log/syslog.lo \ - log/syslog/syslog_c.lo \ - math/big.lo \ - math/cmplx.lo \ - math/rand.lo \ - mime/multipart.lo \ - mime/quotedprintable.lo \ - net/http.lo \ - net/internal/socktest.lo \ - net/mail.lo \ - net/rpc.lo \ - net/smtp.lo \ - net/textproto.lo \ - net/url.lo \ - old/regexp.lo \ - old/template.lo \ - os/exec.lo \ - $(os_lib_inotify_lo) \ - os/signal.lo \ - os/user.lo \ - path/filepath.lo \ - regexp/syntax.lo \ - net/rpc/jsonrpc.lo \ - runtime/debug.lo \ - runtime/pprof.lo \ - sync/atomic.lo \ - sync/atomic_c.lo \ - text/scanner.lo \ - text/tabwriter.lo \ - text/template.lo \ - text/template/parse.lo \ - testing/iotest.lo \ - testing/quick.lo \ - unicode/utf16.lo \ - unicode/utf8.lo - -libgo_ldflags = \ - -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) - -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 - -# Use -fPIC for libgobegin so that it can be put in a PIE. -libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC -libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC - -libgolibbegin_a_SOURCES = \ - runtime/go-libmain.c - -libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC - -libnetgo_a_SOURCES = $(go_netgo_files) -libnetgo_a_LIBADD = netgo.o - -LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) - -GOCFLAGS = $(CFLAGS) -AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK) -GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS) - -LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \ - $(AM_GOCFLAGS) $(GOCFLAGS) - -GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@ - -# Build the dependencies for a Go package. -BUILDDEPS = \ - $(MKDIR_P) $(@D); \ - $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $^ > $@.tmp; \ - mv -f $@.tmp $@ - -# Build the .go files for a package, generating a .lo file. -BUILDPACKAGE = \ - $(MKDIR_P) $(@D); \ - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files - -# Build netgo.o. -BUILDNETGO = \ - $(MKDIR_P) $(@D); \ - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(GOCOMPILE) -I . -c -fPIC -fgo-pkgpath=net -o $@ $$files - -GOTESTFLAGS = -GOBENCH = - -# Check a package. -CHECK = \ - GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ - export GC; \ - GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ - export GOLIBS; \ - RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ - export RUNTESTFLAGS; \ - MAKE="$(MAKE)"; \ - export MAKE; \ - libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \ - LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \ - LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ - export LD_LIBRARY_PATH; \ - $(MKDIR_P) $(@D); \ - rm -f $@-testsum $@-testlog; \ - if test "$(USE_DEJAGNU)" = "yes"; then \ - $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ - elif test "$(GOBENCH)" != ""; then \ - $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ - else \ - if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \ - echo "PASS: $(@D)" >> $@-testlog; \ - echo "PASS: $(@D)"; \ - echo "PASS: $(@D)" > $@-testsum; \ - else \ - echo "FAIL: $(@D)" >> $@-testlog; \ - cat $@-testlog; \ - echo "FAIL: $(@D)" > $@-testsum; \ - exit 1; \ - fi; \ - fi - -# Build all packages before checking any. -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) - -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) -bufio.lo: $(go_bufio_files) - $(BUILDPACKAGE) -bufio/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: bufio/check - -@go_include@ bytes.lo.dep -bytes.lo.dep: $(go_bytes_files) - $(BUILDDEPS) -bytes.lo: $(go_bytes_files) - $(BUILDPACKAGE) -bytes/index.lo: $(go_bytes_c_files) - @$(MKDIR_P) bytes - $(LTCOMPILE) -c -o bytes/index.lo $(srcdir)/go/bytes/indexbyte.c -bytes/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: bytes/check - -@go_include@ crypto.lo.dep -crypto.lo.dep: $(go_crypto_files) - $(BUILDDEPS) -crypto.lo: $(go_crypto_files) - $(BUILDPACKAGE) -crypto/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/check - -@go_include@ encoding.lo.dep -encoding.lo.dep: $(go_encoding_files) - $(BUILDDEPS) -encoding.lo: $(go_encoding_files) - $(BUILDPACKAGE) -encoding/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/check - -@go_include@ errors.lo.dep -errors.lo.dep: $(go_errors_files) - $(BUILDDEPS) -errors.lo: $(go_errors_files) - $(BUILDPACKAGE) -errors/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: errors/check - -@go_include@ expvar.lo.dep -expvar.lo.dep: $(go_expvar_files) - $(BUILDDEPS) -expvar.lo: $(go_expvar_files) - $(BUILDPACKAGE) -expvar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: expvar/check - -@go_include@ flag.lo.dep -flag.lo.dep: $(go_flag_files) - $(BUILDDEPS) -flag.lo: $(go_flag_files) - $(BUILDPACKAGE) -flag/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: flag/check - -@go_include@ fmt.lo.dep -fmt.lo.dep: $(go_fmt_files) - $(BUILDDEPS) -fmt.lo: $(go_fmt_files) - $(BUILDPACKAGE) -fmt/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: fmt/check - -@go_include@ hash.lo.dep -hash.lo.dep: $(go_hash_files) - $(BUILDDEPS) -hash.lo: $(go_hash_files) - $(BUILDPACKAGE) -hash/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/check - -@go_include@ html.lo.dep -html.lo.dep: $(go_html_files) - $(BUILDDEPS) -html.lo: $(go_html_files) - $(BUILDPACKAGE) -html/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: html/check - -@go_include@ image.lo.dep -image.lo.dep: $(go_image_files) - $(BUILDDEPS) -image.lo: $(go_image_files) - $(BUILDPACKAGE) -image/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/check - -@go_include@ io.lo.dep -io.lo.dep: $(go_io_files) - $(BUILDDEPS) -io.lo: $(go_io_files) - $(BUILDPACKAGE) -io/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: io/check - -@go_include@ log.lo.dep -log.lo.dep: $(go_log_files) - $(BUILDDEPS) -log.lo: $(go_log_files) - $(BUILDPACKAGE) -log/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: log/check - -@go_include@ math.lo.dep -math.lo.dep: $(go_math_files) - $(BUILDDEPS) -math.lo: $(go_math_files) - $(MKDIR_P) $(@D) - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(LTGOCOMPILE) $(MATH_FLAG) -I . -c -fgo-pkgpath=math -o $@ $$files -math/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/check - -@go_include@ mime.lo.dep -mime.lo.dep: $(go_mime_files) - $(BUILDDEPS) -mime.lo: $(go_mime_files) - $(BUILDPACKAGE) -mime/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/check - -@go_include@ net.lo.dep -net.lo.dep: $(go_net_files) - $(BUILDDEPS) -net.lo: $(go_net_files) - $(BUILDPACKAGE) -net/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/check - -@go_include@ netgo.o.dep -netgo.o.dep: $(go_netgo_files) - $(BUILDDEPS) -netgo.o: $(go_netgo_files) - $(BUILDNETGO) - -@go_include@ os.lo.dep -os.lo.dep: $(go_os_files) - $(BUILDDEPS) -os.lo: $(go_os_files) - $(BUILDPACKAGE) -os/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/check - -@go_include@ path.lo.dep -path.lo.dep: $(go_path_files) - $(BUILDDEPS) -path.lo: $(go_path_files) - $(BUILDPACKAGE) -path/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: path/check - -@go_include@ reflect-go.lo.dep -reflect-go.lo.dep: $(go_reflect_files) - $(BUILDDEPS) -reflect-go.lo: $(go_reflect_files) - $(BUILDPACKAGE) -reflect/check: $(CHECK_DEPS) - @$(CHECK) -reflect/makefunc_ffi_c.lo: $(go_reflect_makefunc_c_file) - @$(MKDIR_P) reflect - $(LTCOMPILE) -c -o $@ $< -.PHONY: reflect/check - -@go_include@ regexp.lo.dep -regexp.lo.dep: $(go_regexp_files) - $(BUILDDEPS) -regexp.lo: $(go_regexp_files) - $(BUILDPACKAGE) -regexp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: regexp/check - -@go_include@ runtime-go.lo.dep -runtime-go.lo.dep: $(go_runtime_files) - $(BUILDDEPS) -runtime-go.lo: $(go_runtime_files) - $(BUILDPACKAGE) -runtime/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/check - -@go_include@ sort.lo.dep -sort.lo.dep: $(go_sort_files) - $(BUILDDEPS) -sort.lo: $(go_sort_files) - $(BUILDPACKAGE) -sort/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sort/check - -@go_include@ strconv.lo.dep -strconv.lo.dep: $(go_strconv_files) - $(BUILDDEPS) -strconv.lo: $(go_strconv_files) - $(BUILDPACKAGE) -strconv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: strconv/check - -@go_include@ strings.lo.dep -strings.lo.dep: $(go_strings_files) - $(BUILDDEPS) -strings.lo: $(go_strings_files) - $(BUILDPACKAGE) -strings/index.lo: $(go_strings_c_files) - @$(MKDIR_P) strings - $(LTCOMPILE) -c -o strings/index.lo $(srcdir)/go/strings/indexbyte.c -strings/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: strings/check - -@go_include@ sync.lo.dep -sync.lo.dep: $(go_sync_files) - $(BUILDDEPS) -sync.lo: $(go_sync_files) - $(BUILDPACKAGE) -sync/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sync/check - -@go_include@ testing.lo.dep -testing.lo.dep: $(go_testing_files) - $(BUILDDEPS) -testing.lo: $(go_testing_files) - $(BUILDPACKAGE) -testing/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/check - -@go_include@ time-go.lo.dep -time-go.lo.dep: $(go_time_files) - $(BUILDDEPS) -time-go.lo: $(go_time_files) - $(BUILDPACKAGE) -time/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: time/check - -@go_include@ unicode.lo.dep -unicode.lo.dep: $(go_unicode_files) - $(BUILDDEPS) -unicode.lo: $(go_unicode_files) - $(BUILDPACKAGE) -unicode/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/check - -@go_include@ archive/tar.lo.dep -archive/tar.lo.dep: $(go_archive_tar_files) - $(BUILDDEPS) -archive/tar.lo: $(go_archive_tar_files) - $(BUILDPACKAGE) -archive/tar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: archive/tar/check - -@go_include@ archive/zip.lo.dep -archive/zip.lo.dep: $(go_archive_zip_files) - $(BUILDDEPS) -archive/zip.lo: $(go_archive_zip_files) - $(BUILDPACKAGE) -archive/zip/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: archive/zip/check - -@go_include@ compress/bzip2.lo.dep -compress/bzip2.lo.dep: $(go_compress_bzip2_files) - $(BUILDDEPS) -compress/bzip2.lo: $(go_compress_bzip2_files) - $(BUILDPACKAGE) -compress/bzip2/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/bzip2/check - -@go_include@ compress/flate.lo.dep -compress/flate.lo.dep: $(go_compress_flate_files) - $(BUILDDEPS) -compress/flate.lo: $(go_compress_flate_files) - $(BUILDPACKAGE) -compress/flate/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/flate/check - -@go_include@ compress/gzip.lo.dep -compress/gzip.lo.dep: $(go_compress_gzip_files) - $(BUILDDEPS) -compress/gzip.lo: $(go_compress_gzip_files) - $(BUILDPACKAGE) -compress/gzip/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/gzip/check - -@go_include@ compress/lzw.lo.dep -compress/lzw.lo.dep: $(go_compress_lzw_files) - $(BUILDDEPS) -compress/lzw.lo: $(go_compress_lzw_files) - $(BUILDPACKAGE) -compress/lzw/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/lzw/check - -@go_include@ compress/zlib.lo.dep -compress/zlib.lo.dep: $(go_compress_zlib_files) - $(BUILDDEPS) -compress/zlib.lo: $(go_compress_zlib_files) - $(BUILDPACKAGE) -compress/zlib/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/zlib/check - -@go_include@ container/heap.lo.dep -container/heap.lo.dep: $(go_container_heap_files) - $(BUILDDEPS) -container/heap.lo: $(go_container_heap_files) - $(BUILDPACKAGE) -container/heap/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/heap/check - -@go_include@ container/list.lo.dep -container/list.lo.dep: $(go_container_list_files) - $(BUILDDEPS) -container/list.lo: $(go_container_list_files) - $(BUILDPACKAGE) -container/list/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/list/check - -@go_include@ container/ring.lo.dep -container/ring.lo.dep: $(go_container_ring_files) - $(BUILDDEPS) -container/ring.lo: $(go_container_ring_files) - $(BUILDPACKAGE) -container/ring/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/ring/check - -@go_include@ crypto/aes.lo.dep -crypto/aes.lo.dep: $(go_crypto_aes_files) - $(BUILDDEPS) -crypto/aes.lo: $(go_crypto_aes_files) - $(BUILDPACKAGE) -crypto/aes/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/aes/check - -@go_include@ crypto/cipher.lo.dep -crypto/cipher.lo.dep: $(go_crypto_cipher_files) - $(BUILDDEPS) -crypto/cipher.lo: $(go_crypto_cipher_files) - $(BUILDPACKAGE) -crypto/cipher/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/cipher/check - -@go_include@ crypto/des.lo.dep -crypto/des.lo.dep: $(go_crypto_des_files) - $(BUILDDEPS) -crypto/des.lo: $(go_crypto_des_files) - $(BUILDPACKAGE) -crypto/des/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/des/check - -@go_include@ crypto/dsa.lo.dep -crypto/dsa.lo.dep: $(go_crypto_dsa_files) - $(BUILDDEPS) -crypto/dsa.lo: $(go_crypto_dsa_files) - $(BUILDPACKAGE) -crypto/dsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/dsa/check - -@go_include@ crypto/ecdsa.lo.dep -crypto/ecdsa.lo.dep: $(go_crypto_ecdsa_files) - $(BUILDDEPS) -crypto/ecdsa.lo: $(go_crypto_ecdsa_files) - $(BUILDPACKAGE) -crypto/ecdsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/ecdsa/check - -@go_include@ crypto/elliptic.lo.dep -crypto/elliptic.lo.dep: $(go_crypto_elliptic_files) - $(BUILDDEPS) -crypto/elliptic.lo: $(go_crypto_elliptic_files) - $(BUILDPACKAGE) -crypto/elliptic/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/elliptic/check - -@go_include@ crypto/hmac.lo.dep -crypto/hmac.lo.dep: $(go_crypto_hmac_files) - $(BUILDDEPS) -crypto/hmac.lo: $(go_crypto_hmac_files) - $(BUILDPACKAGE) -crypto/hmac/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/hmac/check - -@go_include@ crypto/md5.lo.dep -crypto/md5.lo.dep: $(go_crypto_md5_files) - $(BUILDDEPS) -crypto/md5.lo: $(go_crypto_md5_files) - $(BUILDPACKAGE) -crypto/md5/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/md5/check - -@go_include@ crypto/rand.lo.dep -crypto/rand.lo.dep: $(go_crypto_rand_files) - $(BUILDDEPS) -crypto/rand.lo: $(go_crypto_rand_files) - $(BUILDPACKAGE) -crypto/rand/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rand/check - -@go_include@ crypto/rc4.lo.dep -crypto/rc4.lo.dep: $(go_crypto_rc4_files) - $(BUILDDEPS) -crypto/rc4.lo: $(go_crypto_rc4_files) - $(BUILDPACKAGE) -crypto/rc4/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rc4/check - -@go_include@ crypto/rsa.lo.dep -crypto/rsa.lo.dep: $(go_crypto_rsa_files) - $(BUILDDEPS) -crypto/rsa.lo: $(go_crypto_rsa_files) - $(BUILDPACKAGE) -crypto/rsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rsa/check - -@go_include@ crypto/sha1.lo.dep -crypto/sha1.lo.dep: $(go_crypto_sha1_files) - $(BUILDDEPS) -crypto/sha1.lo: $(go_crypto_sha1_files) - $(BUILDPACKAGE) -crypto/sha1/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha1/check - -@go_include@ crypto/sha256.lo.dep -crypto/sha256.lo.dep: $(go_crypto_sha256_files) - $(BUILDDEPS) -crypto/sha256.lo: $(go_crypto_sha256_files) - $(BUILDPACKAGE) -crypto/sha256/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha256/check - -@go_include@ crypto/sha512.lo.dep -crypto/sha512.lo.dep: $(go_crypto_sha512_files) - $(BUILDDEPS) -crypto/sha512.lo: $(go_crypto_sha512_files) - $(BUILDPACKAGE) -crypto/sha512/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha512/check - -@go_include@ crypto/subtle.lo.dep -crypto/subtle.lo.dep: $(go_crypto_subtle_files) - $(BUILDDEPS) -crypto/subtle.lo: $(go_crypto_subtle_files) - $(BUILDPACKAGE) -crypto/subtle/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/subtle/check - -@go_include@ crypto/tls.lo.dep -crypto/tls.lo.dep: $(go_crypto_tls_files) - $(BUILDDEPS) -crypto/tls.lo: $(go_crypto_tls_files) - $(BUILDPACKAGE) -crypto/tls/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/tls/check - -@go_include@ crypto/x509.lo.dep -crypto/x509.lo.dep: $(go_crypto_x509_files) - $(BUILDDEPS) -crypto/x509.lo: $(go_crypto_x509_files) - $(BUILDPACKAGE) -crypto/x509/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/x509/check - -@go_include@ crypto/x509/pkix.lo.dep -crypto/x509/pkix.lo.dep: $(go_crypto_x509_pkix_files) - $(BUILDDEPS) -crypto/x509/pkix.lo: $(go_crypto_x509_pkix_files) - $(BUILDPACKAGE) -crypto/x509/pkix/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/x509/pkix/check - -@go_include@ database/sql.lo.dep -database/sql.lo.dep: $(go_database_sql_files) - $(BUILDDEPS) -database/sql.lo: $(go_database_sql_files) - $(BUILDPACKAGE) -database/sql/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: database/sql/check - -@go_include@ database/sql/driver.lo.dep -database/sql/driver.lo.dep: $(go_database_sql_driver_files) - $(BUILDDEPS) -database/sql/driver.lo: $(go_database_sql_driver_files) - $(BUILDPACKAGE) -database/sql/driver/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: database/sql/driver/check - -@go_include@ debug/dwarf.lo.dep -debug/dwarf.lo.dep: $(go_debug_dwarf_files) - $(BUILDDEPS) -debug/dwarf.lo: $(go_debug_dwarf_files) - $(BUILDPACKAGE) -debug/dwarf/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/dwarf/check - -@go_include@ debug/elf.lo.dep -debug/elf.lo.dep: $(go_debug_elf_files) - $(BUILDDEPS) -debug/elf.lo: $(go_debug_elf_files) - $(BUILDPACKAGE) -debug/elf/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/elf/check - -@go_include@ debug/gosym.lo.dep -debug/gosym.lo.dep: $(go_debug_gosym_files) - $(BUILDDEPS) -debug/gosym.lo: $(go_debug_gosym_files) - $(BUILDPACKAGE) -debug/gosym/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/gosym/check - -@go_include@ debug/macho.lo.dep -debug/macho.lo.dep: $(go_debug_macho_files) - $(BUILDDEPS) -debug/macho.lo: $(go_debug_macho_files) - $(BUILDPACKAGE) -debug/macho/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/macho/check - -@go_include@ debug/pe.lo.dep -debug/pe.lo.dep: $(go_debug_pe_files) - $(BUILDDEPS) -debug/pe.lo: $(go_debug_pe_files) - $(BUILDPACKAGE) -debug/pe/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/pe/check - -@go_include@ debug/plan9obj.lo.dep -debug/plan9obj.lo.dep: $(go_debug_plan9obj_files) - $(BUILDDEPS) -debug/plan9obj.lo: $(go_debug_plan9obj_files) - $(BUILDPACKAGE) -debug/plan9obj/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/plan9obj/check - -@go_include@ encoding/asn1.lo.dep -encoding/asn1.lo.dep: $(go_encoding_asn1_files) - $(BUILDDEPS) -encoding/asn1.lo: $(go_encoding_asn1_files) - $(BUILDPACKAGE) -encoding/asn1/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/asn1/check - -@go_include@ encoding/ascii85.lo.dep -encoding/ascii85.lo.dep: $(go_encoding_ascii85_files) - $(BUILDDEPS) -encoding/ascii85.lo: $(go_encoding_ascii85_files) - $(BUILDPACKAGE) -encoding/ascii85/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/ascii85/check - -@go_include@ encoding/base32.lo.dep -encoding/base32.lo.dep: $(go_encoding_base32_files) - $(BUILDDEPS) -encoding/base32.lo: $(go_encoding_base32_files) - $(BUILDPACKAGE) -encoding/base32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/base32/check - -@go_include@ encoding/base64.lo.dep -encoding/base64.lo.dep: $(go_encoding_base64_files) - $(BUILDDEPS) -encoding/base64.lo: $(go_encoding_base64_files) - $(BUILDPACKAGE) -encoding/base64/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/base64/check - -@go_include@ encoding/binary.lo.dep -encoding/binary.lo.dep: $(go_encoding_binary_files) - $(BUILDDEPS) -encoding/binary.lo: $(go_encoding_binary_files) - $(BUILDPACKAGE) -encoding/binary/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/binary/check - -@go_include@ encoding/csv.lo.dep -encoding/csv.lo.dep: $(go_encoding_csv_files) - $(BUILDDEPS) -encoding/csv.lo: $(go_encoding_csv_files) - $(BUILDPACKAGE) -encoding/csv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/csv/check - -@go_include@ encoding/gob.lo.dep -encoding/gob.lo.dep: $(go_encoding_gob_files) - $(BUILDDEPS) -encoding/gob.lo: $(go_encoding_gob_files) - $(BUILDPACKAGE) -encoding/gob/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/gob/check - -@go_include@ encoding/hex.lo.dep -encoding/hex.lo.dep: $(go_encoding_hex_files) - $(BUILDDEPS) -encoding/hex.lo: $(go_encoding_hex_files) - $(BUILDPACKAGE) -encoding/hex/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/hex/check - -@go_include@ encoding/json.lo.dep -encoding/json.lo.dep: $(go_encoding_json_files) - $(BUILDDEPS) -encoding/json.lo: $(go_encoding_json_files) - $(BUILDPACKAGE) -encoding/json/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/json/check - -@go_include@ encoding/pem.lo.dep -encoding/pem.lo.dep: $(go_encoding_pem_files) - $(BUILDDEPS) -encoding/pem.lo: $(go_encoding_pem_files) - $(BUILDPACKAGE) -encoding/pem/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/pem/check - -@go_include@ encoding/xml.lo.dep -encoding/xml.lo.dep: $(go_encoding_xml_files) - $(BUILDDEPS) -encoding/xml.lo: $(go_encoding_xml_files) - $(BUILDPACKAGE) -encoding/xml/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/xml/check - -@go_include@ exp/proxy.lo.dep -exp/proxy.lo.dep: $(go_exp_proxy_files) - $(BUILDDEPS) -exp/proxy.lo: $(go_exp_proxy_files) - $(BUILDPACKAGE) -exp/proxy/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: exp/proxy/check - -@go_include@ exp/terminal.lo.dep -exp/terminal.lo.dep: $(go_exp_terminal_files) - $(BUILDDEPS) -exp/terminal.lo: $(go_exp_terminal_files) - $(BUILDPACKAGE) -exp/terminal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: exp/terminal/check - -@go_include@ html/template.lo.dep -html/template.lo.dep: $(go_html_template_files) - $(BUILDDEPS) -html/template.lo: $(go_html_template_files) - $(BUILDPACKAGE) -html/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: html/template/check - -@go_include@ go/ast.lo.dep -go/ast.lo.dep: $(go_go_ast_files) - $(BUILDDEPS) -go/ast.lo: $(go_go_ast_files) - $(BUILDPACKAGE) -go/ast/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/ast/check - -@go_include@ go/build.lo.dep -go/build.lo.dep: $(go_go_build_files) - $(BUILDDEPS) -go/build.lo: $(go_go_build_files) - $(BUILDPACKAGE) -go/build/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/build/check - -@go_include@ go/constant.lo.dep -go/constant.lo.dep: $(go_go_constant_files) - $(BUILDDEPS) -go/constant.lo: $(go_go_constant_files) - $(BUILDPACKAGE) -go/constant/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/constant/check - -@go_include@ go/doc.lo.dep -go/doc.lo.dep: $(go_go_doc_files) - $(BUILDDEPS) -go/doc.lo: $(go_go_doc_files) - $(BUILDPACKAGE) -go/doc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/doc/check - -@go_include@ go/format.lo.dep -go/format.lo.dep: $(go_go_format_files) - $(BUILDDEPS) -go/format.lo: $(go_go_format_files) - $(BUILDPACKAGE) -go/format/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/format/check - -@go_include@ go/importer.lo.dep -go/importer.lo.dep: $(go_go_importer_files) - $(BUILDDEPS) -go/importer.lo: $(go_go_importer_files) - $(BUILDPACKAGE) -go/importer/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/importer/check - -@go_include@ go/parser.lo.dep -go/parser.lo.dep: $(go_go_parser_files) - $(BUILDDEPS) -go/parser.lo: $(go_go_parser_files) - $(BUILDPACKAGE) -go/parser/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/parser/check - -@go_include@ go/printer.lo.dep -go/printer.lo.dep: $(go_go_printer_files) - $(BUILDDEPS) -go/printer.lo: $(go_go_printer_files) - $(BUILDPACKAGE) -go/printer/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/printer/check - -@go_include@ go/scanner.lo.dep -go/scanner.lo.dep: $(go_go_scanner_files) - $(BUILDDEPS) -go/scanner.lo: $(go_go_scanner_files) - $(BUILDPACKAGE) -go/scanner/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/scanner/check - -@go_include@ go/token.lo.dep -go/token.lo.dep: $(go_go_token_files) - $(BUILDDEPS) -go/token.lo: $(go_go_token_files) - $(BUILDPACKAGE) -go/token/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/token/check - -@go_include@ go/types.lo.dep -go/types.lo.dep: $(go_go_types_files) - $(BUILDDEPS) -go/types.lo: $(go_go_types_files) - $(BUILDPACKAGE) -go/types/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/types/check - -@go_include@ go/internal/gcimporter.lo.dep -go/internal/gcimporter.lo.dep: $(go_go_internal_gcimporter_files) - $(BUILDDEPS) -go/internal/gcimporter.lo: $(go_go_internal_gcimporter_files) - $(BUILDPACKAGE) -go/internal/gcimporter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/internal/gcimporter/check - -@go_include@ go/internal/gccgoimporter.lo.dep -go/internal/gccgoimporter.lo.dep: $(go_go_internal_gccgoimporter_files) - $(BUILDDEPS) -go/internal/gccgoimporter.lo: $(go_go_internal_gccgoimporter_files) - $(BUILDPACKAGE) -go/internal/gccgoimporter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/internal/gccgoimporter/check - -@go_include@ hash/adler32.lo.dep -hash/adler32.lo.dep: $(go_hash_adler32_files) - $(BUILDDEPS) -hash/adler32.lo: $(go_hash_adler32_files) - $(BUILDPACKAGE) -hash/adler32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/adler32/check - -@go_include@ hash/crc32.lo.dep -hash/crc32.lo.dep: $(go_hash_crc32_files) - $(BUILDDEPS) -hash/crc32.lo: $(go_hash_crc32_files) - $(BUILDPACKAGE) -hash/crc32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/crc32/check - -@go_include@ hash/crc64.lo.dep -hash/crc64.lo.dep: $(go_hash_crc64_files) - $(BUILDDEPS) -hash/crc64.lo: $(go_hash_crc64_files) - $(BUILDPACKAGE) -hash/crc64/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/crc64/check - -@go_include@ hash/fnv.lo.dep -hash/fnv.lo.dep: $(go_hash_fnv_files) - $(BUILDDEPS) -hash/fnv.lo: $(go_hash_fnv_files) - $(BUILDPACKAGE) -hash/fnv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/fnv/check - -@go_include@ image/color.lo.dep -image/color.lo.dep: $(go_image_color_files) - $(BUILDDEPS) -image/color.lo: $(go_image_color_files) - $(BUILDPACKAGE) -image/color/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/color/check - -@go_include@ image/color/palette.lo.dep -image/color/palette.lo.dep: $(go_image_color_palette_files) - $(BUILDDEPS) -image/color/palette.lo: $(go_image_color_palette_files) - $(BUILDPACKAGE) -image/color/palette/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/color/palette/check - -@go_include@ image/draw.lo.dep -image/draw.lo.dep: $(go_image_draw_files) - $(BUILDDEPS) -image/draw.lo: $(go_image_draw_files) - $(BUILDPACKAGE) -image/draw/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/draw/check - -@go_include@ image/gif.lo.dep -image/gif.lo.dep: $(go_image_gif_files) - $(BUILDDEPS) -image/gif.lo: $(go_image_gif_files) - $(BUILDPACKAGE) -image/gif/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/gif/check - -@go_include@ image/internal/imageutil.lo.dep -image/internal/imageutil.lo.dep: $(go_image_internal_imageutil_files) - $(BUILDDEPS) -image/internal/imageutil.lo: $(go_image_internal_imageutil_files) - $(BUILDPACKAGE) -image/internal/imageutil/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/internal/imageutil/check - -@go_include@ image/jpeg.lo.dep -image/jpeg.lo.dep: $(go_image_jpeg_files) - $(BUILDDEPS) -image/jpeg.lo: $(go_image_jpeg_files) - $(BUILDPACKAGE) -image/jpeg/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/jpeg/check - -@go_include@ image/png.lo.dep -image/png.lo.dep: $(go_image_png_files) - $(BUILDDEPS) -image/png.lo: $(go_image_png_files) - $(BUILDPACKAGE) -image/png/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/png/check - -@go_include@ index/suffixarray.lo.dep -index/suffixarray.lo.dep: $(go_index_suffixarray_files) - $(BUILDDEPS) -index/suffixarray.lo: $(go_index_suffixarray_files) - $(BUILDPACKAGE) -index/suffixarray/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: index/suffixarray/check - -@go_include@ internal/format.lo.dep -internal/format.lo.dep: $(go_internal_format_files) - $(BUILDDEPS) -internal/format.lo: $(go_internal_format_files) - $(BUILDPACKAGE) -internal/format/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/format/check - -@go_include@ internal/singleflight.lo.dep -internal/singleflight.lo.dep: $(go_internal_singleflight_files) - $(BUILDDEPS) -internal/singleflight.lo: $(go_internal_singleflight_files) - $(BUILDPACKAGE) -internal/singleflight/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/singleflight/check - -@go_include@ internal/syscall/unix.lo.dep -internal/syscall/unix.lo.dep: $(go_internal_syscall_unix_files) - $(BUILDDEPS) -internal/syscall/unix.lo: $(go_internal_syscall_unix_files) - $(BUILDPACKAGE) -internal/syscall/unix/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/syscall/unix/check - -@go_include@ internal/testenv.lo.dep -internal/testenv.lo.dep: $(go_internal_testenv_files) - $(BUILDDEPS) -internal/testenv.lo: $(go_internal_testenv_files) - $(BUILDPACKAGE) -internal/testenv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/testenv/check - -@go_include@ internal/trace.lo.dep -internal/trace.lo.dep: $(go_internal_trace_files) - $(BUILDDEPS) -internal/trace.lo: $(go_internal_trace_files) - $(BUILDPACKAGE) -internal/trace/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/trace/check - -@go_include@ io/ioutil.lo.dep -io/ioutil.lo.dep: $(go_io_ioutil_files) - $(BUILDDEPS) -io/ioutil.lo: $(go_io_ioutil_files) - $(BUILDPACKAGE) -io/ioutil/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: io/ioutil/check - -@go_include@ log/syslog.lo.dep -log/syslog.lo.dep: $(go_log_syslog_files) - $(BUILDDEPS) -log/syslog.lo: $(go_log_syslog_files) - $(BUILDPACKAGE) -log/syslog/syslog_c.lo: $(go_syslog_c_files) log/syslog.lo - @$(MKDIR_P) log/syslog - $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c -log/syslog/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: log/syslog/check - -@go_include@ math/big.lo.dep -math/big.lo.dep: $(go_math_big_files) - $(BUILDDEPS) -math/big.lo: $(go_math_big_files) - $(BUILDPACKAGE) -math/big/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/big/check - -@go_include@ math/cmplx.lo.dep -math/cmplx.lo.dep: $(go_math_cmplx_files) - $(BUILDDEPS) -math/cmplx.lo: $(go_math_cmplx_files) - $(BUILDPACKAGE) -math/cmplx/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/cmplx/check - -@go_include@ math/rand.lo.dep -math/rand.lo.dep: $(go_math_rand_files) - $(BUILDDEPS) -math/rand.lo: $(go_math_rand_files) - $(BUILDPACKAGE) -math/rand/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/rand/check - -@go_include@ mime/multipart.lo.dep -mime/multipart.lo.dep: $(go_mime_multipart_files) - $(BUILDDEPS) -mime/multipart.lo: $(go_mime_multipart_files) - $(BUILDPACKAGE) -mime/multipart/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/multipart/check - -@go_include@ mime/quotedprintable.lo.dep -mime/quotedprintable.lo.dep: $(go_mime_quotedprintable_files) - $(BUILDDEPS) -mime/quotedprintable.lo: $(go_mime_quotedprintable_files) - $(BUILDPACKAGE) -mime/quotedprintable/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/quotedprintable/check - -@go_include@ net/http.lo.dep -net/http.lo.dep: $(go_net_http_files) - $(BUILDDEPS) -net/http.lo: $(go_net_http_files) - $(BUILDPACKAGE) -net/http/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/check - -@go_include@ net/mail.lo.dep -net/mail.lo.dep: $(go_net_mail_files) - $(BUILDDEPS) -net/mail.lo: $(go_net_mail_files) - $(BUILDPACKAGE) -net/mail/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/mail/check - -@go_include@ net/rpc.lo.dep -net/rpc.lo.dep: $(go_net_rpc_files) - $(BUILDDEPS) -net/rpc.lo: $(go_net_rpc_files) - $(BUILDPACKAGE) -net/rpc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/rpc/check - -@go_include@ net/smtp.lo.dep -net/smtp.lo.dep: $(go_net_smtp_files) - $(BUILDDEPS) -net/smtp.lo: $(go_net_smtp_files) - $(BUILDPACKAGE) -net/smtp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/smtp/check - -@go_include@ net/url.lo.dep -net/url.lo.dep: $(go_net_url_files) - $(BUILDDEPS) -net/url.lo: $(go_net_url_files) - $(BUILDPACKAGE) -net/url/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/url/check - -@go_include@ net/textproto.lo.dep -net/textproto.lo.dep: $(go_net_textproto_files) - $(BUILDDEPS) -net/textproto.lo: $(go_net_textproto_files) - $(BUILDPACKAGE) -net/textproto/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/textproto/check - -@go_include@ net/http/cgi.lo.dep -net/http/cgi.lo.dep: $(go_net_http_cgi_files) - $(BUILDDEPS) -net/http/cgi.lo: $(go_net_http_cgi_files) - $(BUILDPACKAGE) -net/http/cgi/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/cgi/check - -@go_include@ net/http/cookiejar.lo.dep -net/http/cookiejar.lo.dep: $(go_net_http_cookiejar_files) - $(BUILDDEPS) -net/http/cookiejar.lo: $(go_net_http_cookiejar_files) - $(BUILDPACKAGE) -net/http/cookiejar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/cookiejar/check - -@go_include@ net/http/fcgi.lo.dep -net/http/fcgi.lo.dep: $(go_net_http_fcgi_files) - $(BUILDDEPS) -net/http/fcgi.lo: $(go_net_http_fcgi_files) - $(BUILDPACKAGE) -net/http/fcgi/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/fcgi/check - -@go_include@ net/http/httptest.lo.dep -net/http/httptest.lo.dep: $(go_net_http_httptest_files) - $(BUILDDEPS) -net/http/httptest.lo: $(go_net_http_httptest_files) - $(BUILDPACKAGE) -net/http/httptest/check: $(check_deps) - @$(CHECK) -.PHONY: net/http/httptest/check - -@go_include@ net/http/httputil.lo.dep -net/http/httputil.lo.dep: $(go_net_http_httputil_files) - $(BUILDDEPS) -net/http/httputil.lo: $(go_net_http_httputil_files) - $(BUILDPACKAGE) -net/http/httputil/check: $(check_deps) - @$(CHECK) -.PHONY: net/http/httputil/check - -@go_include@ net/http/internal.lo.dep -net/http/internal.lo.dep: $(go_net_http_internal_files) - $(BUILDDEPS) -net/http/internal.lo: $(go_net_http_internal_files) - $(BUILDPACKAGE) -net/http/internal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/internal/check - -@go_include@ net/http/pprof.lo.dep -net/http/pprof.lo.dep: $(go_net_http_pprof_files) - $(BUILDDEPS) -net/http/pprof.lo: $(go_net_http_pprof_files) - $(BUILDPACKAGE) -net/http/pprof/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/pprof/check - -@go_include@ net/internal/socktest.lo.dep -net/internal/socktest.lo.dep: $(go_net_internal_socktest_files) - $(BUILDDEPS) -net/internal/socktest.lo: $(go_net_internal_socktest_files) - $(BUILDPACKAGE) -net/internal/socktest/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/internal/socktest/check - -@go_include@ net/rpc/jsonrpc.lo.dep -net/rpc/jsonrpc.lo.dep: $(go_net_rpc_jsonrpc_files) - $(BUILDDEPS) -net/rpc/jsonrpc.lo: $(go_net_rpc_jsonrpc_files) - $(BUILDPACKAGE) -net/rpc/jsonrpc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/rpc/jsonrpc/check - -@go_include@ old/regexp.lo.dep -old/regexp.lo.dep: $(go_old_regexp_files) - $(BUILDDEPS) -old/regexp.lo: $(go_old_regexp_files) - $(BUILDPACKAGE) -old/regexp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: old/regexp/check - -@go_include@ old/template.lo.dep -old/template.lo.dep: $(go_old_template_files) - $(BUILDDEPS) -old/template.lo: $(go_old_template_files) - $(BUILDPACKAGE) -old/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: old/template/check - -@go_include@ os/exec.lo.dep -os/exec.lo.dep: $(go_os_exec_files) - $(BUILDDEPS) -os/exec.lo: $(go_os_exec_files) - $(BUILDPACKAGE) -os/exec/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/exec/check - -@go_include@ os/signal.lo.dep -os/signal.lo.dep: $(go_os_signal_files) - $(BUILDDEPS) -os/signal.lo: $(go_os_signal_files) - $(BUILDPACKAGE) -os/signal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/signal/check - -@go_include@ os/user.lo.dep -os/user.lo.dep: $(go_os_user_files) - $(BUILDDEPS) -os/user.lo: $(go_os_user_files) - $(BUILDPACKAGE) -os/user/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/user/check - -@go_include@ path/filepath.lo.dep -path/filepath.lo.dep: $(go_path_filepath_files) - $(BUILDDEPS) -path/filepath.lo: $(go_path_filepath_files) - $(BUILDPACKAGE) -path/filepath/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: path/filepath/check - -@go_include@ regexp/syntax.lo.dep -regexp/syntax.lo.dep: $(go_regexp_syntax_files) - $(BUILDDEPS) -regexp/syntax.lo: $(go_regexp_syntax_files) - $(BUILDPACKAGE) -regexp/syntax/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: regexp/syntax/check - -@go_include@ runtime/debug.lo.dep -runtime/debug.lo.dep: $(go_runtime_debug_files) - $(BUILDDEPS) -runtime/debug.lo: $(go_runtime_debug_files) - $(BUILDPACKAGE) -runtime/debug/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/debug/check - -@go_include@ runtime/pprof.lo.dep -runtime/pprof.lo.dep: $(go_runtime_pprof_files) - $(BUILDDEPS) -runtime/pprof.lo: $(go_runtime_pprof_files) - $(BUILDPACKAGE) -runtime/pprof/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/pprof/check -# At least for now, we need -static-libgo for this test, because -# otherwise we can't get the line numbers. -# Also use -fno-inline to get better results from the memory profiler. -runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline - -@go_include@ sync/atomic.lo.dep -sync/atomic.lo.dep: $(go_sync_atomic_files) - $(BUILDDEPS) -sync/atomic.lo: $(go_sync_atomic_files) - $(BUILDPACKAGE) -sync/atomic_c.lo: $(go_sync_atomic_c_files) sync/atomic.lo - $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c -sync/atomic/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sync/atomic/check - -@go_include@ text/scanner.lo.dep -text/scanner.lo.dep: $(go_text_scanner_files) - $(BUILDDEPS) -text/scanner.lo: $(go_text_scanner_files) - $(BUILDPACKAGE) -text/scanner/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/scanner/check - -@go_include@ text/tabwriter.lo.dep -text/tabwriter.lo.dep: $(go_text_tabwriter_files) - $(BUILDDEPS) -text/tabwriter.lo: $(go_text_tabwriter_files) - $(BUILDPACKAGE) -text/tabwriter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/tabwriter/check - -@go_include@ text/template.lo.dep -text/template.lo.dep: $(go_text_template_files) - $(BUILDDEPS) -text/template.lo: $(go_text_template_files) - $(BUILDPACKAGE) -text/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/template/check - -@go_include@ text/template/parse.lo.dep -text/template/parse.lo.dep: $(go_text_template_parse_files) - $(BUILDDEPS) -text/template/parse.lo: $(go_text_template_parse_files) - $(BUILDPACKAGE) -text/template/parse/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/template/parse/check - -@go_include@ testing/iotest.lo.dep -testing/iotest.lo.dep: $(go_testing_iotest_files) - $(BUILDDEPS) -testing/iotest.lo: $(go_testing_iotest_files) - $(BUILDPACKAGE) -testing/iotest/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/iotest/check - -@go_include@ testing/quick.lo.dep -testing/quick.lo.dep: $(go_testing_quick_files) - $(BUILDDEPS) -testing/quick.lo: $(go_testing_quick_files) - $(BUILDPACKAGE) -testing/quick/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/quick/check - -@go_include@ unicode/utf16.lo.dep -unicode/utf16.lo.dep: $(go_unicode_utf16_files) - $(BUILDDEPS) -unicode/utf16.lo: $(go_unicode_utf16_files) - $(BUILDPACKAGE) -unicode/utf16/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/utf16/check - -@go_include@ unicode/utf8.lo.dep -unicode/utf8.lo.dep: $(go_unicode_utf8_files) - $(BUILDDEPS) -unicode/utf8.lo: $(go_unicode_utf8_files) - $(BUILDPACKAGE) -unicode/utf8/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/utf8/check - -@go_include@ syscall.lo.dep -syscall.lo.dep: $(go_syscall_files) - $(BUILDDEPS) -syscall.lo: $(go_syscall_files) - $(BUILDPACKAGE) -syscall/errno.lo: go/syscall/errno.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/signame.lo: go/syscall/signame.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/wait.lo: go/syscall/wait.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: syscall/check - -# How to build a .gox file from a .lo file. -BUILDGOX = \ - f=`echo $< | sed -e 's/.lo$$/.o/'`; \ - $(OBJCOPY) -j .go_export $$f $@.tmp && mv -f $@.tmp $@ - -bufio.gox: bufio.lo - $(BUILDGOX) -bytes.gox: bytes.lo - $(BUILDGOX) -crypto.gox: crypto.lo - $(BUILDGOX) -encoding.gox: encoding.lo - $(BUILDGOX) -errors.gox: errors.lo - $(BUILDGOX) -expvar.gox: expvar.lo - $(BUILDGOX) -flag.gox: flag.lo - $(BUILDGOX) -fmt.gox: fmt.lo - $(BUILDGOX) -hash.gox: hash.lo - $(BUILDGOX) -html.gox: html.lo - $(BUILDGOX) -image.gox: image.lo - $(BUILDGOX) -io.gox: io.lo - $(BUILDGOX) -log.gox: log.lo - $(BUILDGOX) -math.gox: math.lo - $(BUILDGOX) -mime.gox: mime.lo - $(BUILDGOX) -net.gox: net.lo - $(BUILDGOX) -os.gox: os.lo - $(BUILDGOX) -path.gox: path.lo - $(BUILDGOX) -reflect.gox: reflect-go.lo - $(BUILDGOX) -regexp.gox: regexp.lo - $(BUILDGOX) -runtime.gox: runtime-go.lo - $(BUILDGOX) -sort.gox: sort.lo - $(BUILDGOX) -strconv.gox: strconv.lo - $(BUILDGOX) -strings.gox: strings.lo - $(BUILDGOX) -sync.gox: sync.lo - $(BUILDGOX) -syscall.gox: syscall.lo - $(BUILDGOX) -testing.gox: testing.lo - $(BUILDGOX) -time.gox: time-go.lo - $(BUILDGOX) -unicode.gox: unicode.lo - $(BUILDGOX) - -archive/tar.gox: archive/tar.lo - $(BUILDGOX) -archive/zip.gox: archive/zip.lo - $(BUILDGOX) - -compress/bzip2.gox: compress/bzip2.lo - $(BUILDGOX) -compress/flate.gox: compress/flate.lo - $(BUILDGOX) -compress/gzip.gox: compress/gzip.lo - $(BUILDGOX) -compress/lzw.gox: compress/lzw.lo - $(BUILDGOX) -compress/zlib.gox: compress/zlib.lo - $(BUILDGOX) - -container/heap.gox: container/heap.lo - $(BUILDGOX) -container/list.gox: container/list.lo - $(BUILDGOX) -container/ring.gox: container/ring.lo - $(BUILDGOX) - -crypto/aes.gox: crypto/aes.lo - $(BUILDGOX) -crypto/cipher.gox: crypto/cipher.lo - $(BUILDGOX) -crypto/des.gox: crypto/des.lo - $(BUILDGOX) -crypto/dsa.gox: crypto/dsa.lo - $(BUILDGOX) -crypto/ecdsa.gox: crypto/ecdsa.lo - $(BUILDGOX) -crypto/elliptic.gox: crypto/elliptic.lo - $(BUILDGOX) -crypto/hmac.gox: crypto/hmac.lo - $(BUILDGOX) -crypto/md5.gox: crypto/md5.lo - $(BUILDGOX) -crypto/rand.gox: crypto/rand.lo - $(BUILDGOX) -crypto/rc4.gox: crypto/rc4.lo - $(BUILDGOX) -crypto/rsa.gox: crypto/rsa.lo - $(BUILDGOX) -crypto/sha1.gox: crypto/sha1.lo - $(BUILDGOX) -crypto/sha256.gox: crypto/sha256.lo - $(BUILDGOX) -crypto/sha512.gox: crypto/sha512.lo - $(BUILDGOX) -crypto/subtle.gox: crypto/subtle.lo - $(BUILDGOX) -crypto/tls.gox: crypto/tls.lo - $(BUILDGOX) -crypto/x509.gox: crypto/x509.lo - $(BUILDGOX) - -crypto/x509/pkix.gox: crypto/x509/pkix.lo - $(BUILDGOX) - -database/sql.gox: database/sql.lo - $(BUILDGOX) - -database/sql/driver.gox: database/sql/driver.lo - $(BUILDGOX) - -debug/dwarf.gox: debug/dwarf.lo - $(BUILDGOX) -debug/elf.gox: debug/elf.lo - $(BUILDGOX) -debug/gosym.gox: debug/gosym.lo - $(BUILDGOX) -debug/macho.gox: debug/macho.lo - $(BUILDGOX) -debug/pe.gox: debug/pe.lo - $(BUILDGOX) -debug/plan9obj.gox: debug/plan9obj.lo - $(BUILDGOX) - -encoding/ascii85.gox: encoding/ascii85.lo - $(BUILDGOX) -encoding/asn1.gox: encoding/asn1.lo - $(BUILDGOX) -encoding/base32.gox: encoding/base32.lo - $(BUILDGOX) -encoding/base64.gox: encoding/base64.lo - $(BUILDGOX) -encoding/binary.gox: encoding/binary.lo - $(BUILDGOX) -encoding/csv.gox: encoding/csv.lo - $(BUILDGOX) -encoding/gob.gox: encoding/gob.lo - $(BUILDGOX) -encoding/hex.gox: encoding/hex.lo - $(BUILDGOX) -encoding/json.gox: encoding/json.lo - $(BUILDGOX) -encoding/pem.gox: encoding/pem.lo - $(BUILDGOX) -encoding/xml.gox: encoding/xml.lo - $(BUILDGOX) - -exp/proxy.gox: exp/proxy.lo - $(BUILDGOX) -exp/terminal.gox: exp/terminal.lo - $(BUILDGOX) - -html/template.gox: html/template.lo - $(BUILDGOX) - -go/ast.gox: go/ast.lo - $(BUILDGOX) -go/build.gox: go/build.lo - $(BUILDGOX) -go/constant.gox: go/constant.lo - $(BUILDGOX) -go/doc.gox: go/doc.lo - $(BUILDGOX) -go/format.gox: go/format.lo - $(BUILDGOX) -go/importer.gox: go/importer.lo - $(BUILDGOX) -go/parser.gox: go/parser.lo - $(BUILDGOX) -go/printer.gox: go/printer.lo - $(BUILDGOX) -go/scanner.gox: go/scanner.lo - $(BUILDGOX) -go/token.gox: go/token.lo - $(BUILDGOX) -go/types.gox: go/types.lo - $(BUILDGOX) - -go/internal/gcimporter.gox: go/internal/gcimporter.lo - $(BUILDGOX) -go/internal/gccgoimporter.gox: go/internal/gccgoimporter.lo - $(BUILDGOX) - -hash/adler32.gox: hash/adler32.lo - $(BUILDGOX) -hash/crc32.gox: hash/crc32.lo - $(BUILDGOX) -hash/crc64.gox: hash/crc64.lo - $(BUILDGOX) -hash/fnv.gox: hash/fnv.lo - $(BUILDGOX) - -image/color.gox: image/color.lo - $(BUILDGOX) -image/draw.gox: image/draw.lo - $(BUILDGOX) -image/gif.gox: image/gif.lo - $(BUILDGOX) -image/internal/imageutil.gox: image/internal/imageutil.lo - $(BUILDGOX) -image/jpeg.gox: image/jpeg.lo - $(BUILDGOX) -image/png.gox: image/png.lo - $(BUILDGOX) - -image/color/palette.gox: image/color/palette.lo - $(BUILDGOX) - -index/suffixarray.gox: index/suffixarray.lo - $(BUILDGOX) - -internal/format.gox: internal/format.lo - $(BUILDGOX) -internal/singleflight.gox: internal/singleflight.lo - $(BUILDGOX) -internal/syscall/unix.gox: internal/syscall/unix.lo - $(BUILDGOX) -internal/testenv.gox: internal/testenv.lo - $(BUILDGOX) -internal/trace.gox: internal/trace.lo - $(BUILDGOX) - -io/ioutil.gox: io/ioutil.lo - $(BUILDGOX) - -log/syslog.gox: log/syslog.lo - $(BUILDGOX) - -math/big.gox: math/big.lo - $(BUILDGOX) -math/cmplx.gox: math/cmplx.lo - $(BUILDGOX) -math/rand.gox: math/rand.lo - $(BUILDGOX) - -mime/multipart.gox: mime/multipart.lo - $(BUILDGOX) -mime/quotedprintable.gox: mime/quotedprintable.lo - $(BUILDGOX) - -net/http.gox: net/http.lo - $(BUILDGOX) -net/mail.gox: net/mail.lo - $(BUILDGOX) -net/rpc.gox: net/rpc.lo - $(BUILDGOX) -net/smtp.gox: net/smtp.lo - $(BUILDGOX) -net/textproto.gox: net/textproto.lo - $(BUILDGOX) -net/url.gox: net/url.lo - $(BUILDGOX) - -net/http/cgi.gox: net/http/cgi.lo - $(BUILDGOX) -net/http/cookiejar.gox: net/http/cookiejar.lo - $(BUILDGOX) -net/http/fcgi.gox: net/http/fcgi.lo - $(BUILDGOX) -net/http/httptest.gox: net/http/httptest.lo - $(BUILDGOX) -net/http/httputil.gox: net/http/httputil.lo - $(BUILDGOX) -net/http/pprof.gox: net/http/pprof.lo - $(BUILDGOX) - -net/http/internal.gox: net/http/internal.lo - $(BUILDGOX) - -net/internal/socktest.gox: net/internal/socktest.lo - $(BUILDGOX) - -net/rpc/jsonrpc.gox: net/rpc/jsonrpc.lo - $(BUILDGOX) - -old/regexp.gox: old/regexp.lo - $(BUILDGOX) -old/template.gox: old/template.lo - $(BUILDGOX) - -os/exec.gox: os/exec.lo - $(BUILDGOX) -os/signal.gox: os/signal.lo - $(BUILDGOX) -os/user.gox: os/user.lo - $(BUILDGOX) - -path/filepath.gox: path/filepath.lo - $(BUILDGOX) - -regexp/syntax.gox: regexp/syntax.lo - $(BUILDGOX) - -runtime/debug.gox: runtime/debug.lo - $(BUILDGOX) -runtime/pprof.gox: runtime/pprof.lo - $(BUILDGOX) - -sync/atomic.gox: sync/atomic.lo - $(BUILDGOX) - -text/scanner.gox: text/scanner.lo - $(BUILDGOX) -text/tabwriter.gox: text/tabwriter.lo - $(BUILDGOX) -text/template.gox: text/template.lo - $(BUILDGOX) -text/template/parse.gox: text/template/parse.lo - $(BUILDGOX) - -testing/iotest.gox: testing/iotest.lo - $(BUILDGOX) -testing/quick.gox: testing/quick.lo - $(BUILDGOX) - -unicode/utf16.gox: unicode/utf16.lo - $(BUILDGOX) -unicode/utf8.gox: unicode/utf8.lo - $(BUILDGOX) - -TEST_PACKAGES = \ - bufio/check \ - bytes/check \ - errors/check \ - expvar/check \ - flag/check \ - fmt/check \ - html/check \ - image/check \ - io/check \ - log/check \ - math/check \ - mime/check \ - net/check \ - os/check \ - path/check \ - reflect/check \ - runtime/check \ - sort/check \ - strconv/check \ - strings/check \ - sync/check \ - syscall/check \ - time/check \ - unicode/check \ - archive/tar/check \ - archive/zip/check \ - compress/bzip2/check \ - compress/flate/check \ - compress/gzip/check \ - compress/lzw/check \ - compress/zlib/check \ - container/heap/check \ - container/list/check \ - container/ring/check \ - crypto/aes/check \ - crypto/cipher/check \ - crypto/des/check \ - crypto/dsa/check \ - crypto/ecdsa/check \ - crypto/elliptic/check \ - crypto/hmac/check \ - crypto/md5/check \ - crypto/rand/check \ - crypto/rc4/check \ - crypto/rsa/check \ - crypto/sha1/check \ - crypto/sha256/check \ - crypto/sha512/check \ - crypto/subtle/check \ - crypto/tls/check \ - crypto/x509/check \ - database/sql/check \ - database/sql/driver/check \ - debug/dwarf/check \ - debug/elf/check \ - debug/macho/check \ - debug/pe/check \ - debug/plan9obj/check \ - encoding/ascii85/check \ - encoding/asn1/check \ - encoding/base32/check \ - encoding/base64/check \ - encoding/binary/check \ - encoding/csv/check \ - encoding/gob/check \ - encoding/hex/check \ - encoding/json/check \ - encoding/pem/check \ - encoding/xml/check \ - exp/proxy/check \ - exp/terminal/check \ - html/template/check \ - go/ast/check \ - go/build/check \ - go/constant/check \ - go/doc/check \ - go/format/check \ - go/internal/gcimporter/check \ - go/internal/gccgoimporter/check \ - go/parser/check \ - go/printer/check \ - go/scanner/check \ - go/token/check \ - go/types/check \ - hash/adler32/check \ - hash/crc32/check \ - hash/crc64/check \ - hash/fnv/check \ - image/color/check \ - image/draw/check \ - image/jpeg/check \ - image/png/check \ - index/suffixarray/check \ - internal/singleflight/check \ - internal/trace/check \ - io/ioutil/check \ - log/syslog/check \ - math/big/check \ - math/cmplx/check \ - math/rand/check \ - mime/multipart/check \ - mime/quotedprintable/check \ - net/http/check \ - net/http/cgi/check \ - net/http/cookiejar/check \ - net/http/fcgi/check \ - net/http/httptest/check \ - net/http/httputil/check \ - net/http/internal/check \ - net/internal/socktest/check \ - net/mail/check \ - net/rpc/check \ - net/smtp/check \ - net/textproto/check \ - net/url/check \ - net/rpc/jsonrpc/check \ - old/regexp/check \ - old/template/check \ - os/exec/check \ - os/signal/check \ - os/user/check \ - path/filepath/check \ - regexp/syntax/check \ - sync/atomic/check \ - text/scanner/check \ - text/tabwriter/check \ - text/template/check \ - text/template/parse/check \ - testing/quick/check \ - unicode/utf16/check \ - unicode/utf8/check - -check: check-tail -check-recursive: check-head - -check-head: - @echo "Test Run By $${USER} on `date`" > libgo.head - @echo "Native configuration is $(host_triplet)" >> libgo.head - @echo >> libgo.head - @echo " === libgo tests ===" >> libgo.head - @echo >> libgo.head - -check-tail: check-recursive check-multi - @if test "$(USE_DEJAGNU)" = "yes"; then \ - exit 0; \ - fi; \ - lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ - for dir in . $(MULTIDIRS); do \ - mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \ - mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \ - done; \ - mv libgo.head libgo.sum; \ - cp libgo.sum libgo.log; \ - echo "Schedule of variations:" >> libgo.sum; \ - for dir in . $(MULTIDIRS); do \ - multidir=../$${dir}/$${lib}; \ - multivar=`cat $${multidir}/libgo.var`; \ - echo " $${multivar}" >> libgo.sum; \ - done; \ - echo >> libgo.sum; \ - pass=0; fail=0; untested=0; \ - for dir in . $(MULTIDIRS); do \ - multidir=../$${dir}/$${lib}; \ - multivar=`cat $${multidir}/libgo.var`; \ - echo "Running target $${multivar}" >> libgo.sum; \ - echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \ - cat $${multidir}/libgo.sum.sep >> libgo.sum; \ - cat $${multidir}/libgo.log.sep >> libgo.log; \ - if test -n "${MULTIDIRS}"; then \ - echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \ - echo >> libgo.sum; \ - fi; \ - p=`grep -c PASS $${multidir}/libgo.sum.sep`; \ - pass=`expr $$pass + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of expected passes $$p" >> libgo.sum; \ - fi; \ - p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \ - fail=`expr $$fail + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of unexpected failures $$p" >> libgo.sum; \ - fi; \ - p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \ - untested=`expr $$untested + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of untested testcases $$p" >> libgo.sum; \ - fi; \ - done; \ - echo >> libgo.sum; \ - echo " === libgo Summary ===" >> libgo.sum; \ - echo >> libgo.sum; \ - if test "$$pass" -ne "0"; then \ - echo "# of expected passes $$pass" >> libgo.sum; \ - fi; \ - if test "$$fail" -ne "0"; then \ - echo "# of unexpected failures $$fail" >> libgo.sum; \ - fi; \ - if test "$$untested" -ne "0"; then \ - echo "# of untested testcases $$untested" >> libgo.sum; \ - fi; \ - echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \ - echo >> libgo.log; \ - echo "runtest completed at `date`" >> libgo.log; \ - if test "$$fail" -ne "0"; then \ - status=1; \ - else \ - status=0; \ - fi; \ - exit $$status - -check-am: - @rm -f libgo.sum libgo.log libgo.tail - @multivar="unix"; \ - [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \ - echo "$${multivar}" > libgo.var - @for f in $(TEST_PACKAGES); do \ - rm -f $$f-testsum $$f-testlog; \ - done - -@$(MAKE) -k $(TEST_PACKAGES) - @for f in $(TEST_PACKAGES); do \ - if test -f $$f-testsum; then \ - cat $$f-testsum >> libgo.sum; \ - fi; \ - if test -f $$f-testlog; then \ - cat $$f-testlog >> libgo.log; \ - fi; \ - done - -check-multi: - $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE) - -bench: - -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=. - -MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep - -mostlyclean-local: - find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f - find . -name '*.$(OBJEXT)' -print | xargs rm -f - find . -name '*-testsum' -print | xargs rm -f - find . -name '*-testlog' -print | xargs rm -f - -CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log - -clean-local: - find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f - find . -name '*.a' -print | xargs rm -f diff --git a/llgo/third_party/gofrontend/libgo/Makefile.in b/llgo/third_party/gofrontend/libgo/Makefile.in deleted file mode 100644 index 8a807986d020c57f094cefade1b5af2ddf542a44..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/Makefile.in +++ /dev/null @@ -1,6621 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# Makefile.am -- Go library Makefile. - -# Copyright 2009 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# Process this file with autoreconf to produce Makefile.in. - - - -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -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@ -@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) \ - $(srcdir)/config.h.in $(srcdir)/../mkinstalldirs \ - $(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)/../config/unwind_ipinfo.m4 \ - $(top_srcdir)/config/go.m4 $(top_srcdir)/config/libtool.m4 \ - $(top_srcdir)/config/ltoptions.m4 \ - $(top_srcdir)/config/ltsugar.m4 \ - $(top_srcdir)/config/ltversion.m4 \ - $(top_srcdir)/config/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 -CONFIG_HEADER = config.h -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__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \ - "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibgodir)" \ - "$(DESTDIR)$(toolexeclibgoarchivedir)" \ - "$(DESTDIR)$(toolexeclibgocompressdir)" \ - "$(DESTDIR)$(toolexeclibgocontainerdir)" \ - "$(DESTDIR)$(toolexeclibgocryptodir)" \ - "$(DESTDIR)$(toolexeclibgocryptox509dir)" \ - "$(DESTDIR)$(toolexeclibgodatabasedir)" \ - "$(DESTDIR)$(toolexeclibgodatabasesqldir)" \ - "$(DESTDIR)$(toolexeclibgodebugdir)" \ - "$(DESTDIR)$(toolexeclibgoencodingdir)" \ - "$(DESTDIR)$(toolexeclibgoexpdir)" \ - "$(DESTDIR)$(toolexeclibgogodir)" \ - "$(DESTDIR)$(toolexeclibgohashdir)" \ - "$(DESTDIR)$(toolexeclibgohtmldir)" \ - "$(DESTDIR)$(toolexeclibgoimagedir)" \ - "$(DESTDIR)$(toolexeclibgoimagecolordir)" \ - "$(DESTDIR)$(toolexeclibgoindexdir)" \ - "$(DESTDIR)$(toolexeclibgoiodir)" \ - "$(DESTDIR)$(toolexeclibgologdir)" \ - "$(DESTDIR)$(toolexeclibgomathdir)" \ - "$(DESTDIR)$(toolexeclibgomimedir)" \ - "$(DESTDIR)$(toolexeclibgonetdir)" \ - "$(DESTDIR)$(toolexeclibgonethttpdir)" \ - "$(DESTDIR)$(toolexeclibgonetrpcdir)" \ - "$(DESTDIR)$(toolexeclibgoolddir)" \ - "$(DESTDIR)$(toolexeclibgoosdir)" \ - "$(DESTDIR)$(toolexeclibgopathdir)" \ - "$(DESTDIR)$(toolexeclibgoregexpdir)" \ - "$(DESTDIR)$(toolexeclibgoruntimedir)" \ - "$(DESTDIR)$(toolexeclibgosyncdir)" \ - "$(DESTDIR)$(toolexeclibgotestingdir)" \ - "$(DESTDIR)$(toolexeclibgotextdir)" \ - "$(DESTDIR)$(toolexeclibgotexttemplatedir)" \ - "$(DESTDIR)$(toolexeclibgounicodedir)" -LIBRARIES = $(toolexeclib_LIBRARIES) -ARFLAGS = cru -libgobegin_llgo_a_AR = $(AR) $(ARFLAGS) -libgobegin_llgo_a_LIBADD = -am_libgobegin_llgo_a_OBJECTS = libgobegin_llgo_a-go-main.$(OBJEXT) -libgobegin_llgo_a_OBJECTS = $(am_libgobegin_llgo_a_OBJECTS) -libgobegin_a_AR = $(AR) $(ARFLAGS) -libgobegin_a_LIBADD = -am_libgobegin_a_OBJECTS = libgobegin_a-go-main.$(OBJEXT) -libgobegin_a_OBJECTS = $(am_libgobegin_a_OBJECTS) -libgolibbegin_a_AR = $(AR) $(ARFLAGS) -libgolibbegin_a_LIBADD = -am_libgolibbegin_a_OBJECTS = libgolibbegin_a-go-libmain.$(OBJEXT) -libgolibbegin_a_OBJECTS = $(am_libgolibbegin_a_OBJECTS) -libnetgo_a_AR = $(AR) $(ARFLAGS) -libnetgo_a_DEPENDENCIES = netgo.o -am__objects_1 = -am__objects_2 = $(am__objects_1) $(am__objects_1) $(am__objects_1) \ - $(am__objects_1) $(am__objects_1) $(am__objects_1) \ - $(am__objects_1) -am__objects_3 = $(am__objects_2) -am_libnetgo_a_OBJECTS = $(am__objects_3) -libnetgo_a_OBJECTS = $(am_libnetgo_a_OBJECTS) -LTLIBRARIES = $(toolexeclib_LTLIBRARIES) -am__DEPENDENCIES_1 = -am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \ - encoding.lo errors.lo expvar.lo flag.lo fmt.lo hash.lo html.lo \ - image.lo io.lo log.lo math.lo mime.lo net.lo os.lo path.lo \ - reflect-go.lo reflect/makefunc_ffi_c.lo regexp.lo \ - runtime-go.lo sort.lo strconv.lo strings.lo strings/index.lo \ - sync.lo syscall.lo syscall/errno.lo syscall/signame.lo \ - syscall/wait.lo testing.lo time-go.lo unicode.lo \ - archive/tar.lo archive/zip.lo compress/bzip2.lo \ - compress/flate.lo compress/gzip.lo compress/lzw.lo \ - compress/zlib.lo container/heap.lo container/list.lo \ - container/ring.lo crypto/aes.lo crypto/cipher.lo crypto/des.lo \ - crypto/dsa.lo crypto/ecdsa.lo crypto/elliptic.lo \ - crypto/hmac.lo crypto/md5.lo crypto/rand.lo crypto/rc4.lo \ - crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo crypto/sha512.lo \ - crypto/subtle.lo crypto/tls.lo crypto/x509.lo \ - crypto/x509/pkix.lo database/sql.lo database/sql/driver.lo \ - debug/dwarf.lo debug/elf.lo debug/gosym.lo debug/macho.lo \ - debug/pe.lo debug/plan9obj.lo encoding/ascii85.lo \ - encoding/asn1.lo encoding/base32.lo encoding/base64.lo \ - encoding/binary.lo encoding/csv.lo encoding/gob.lo \ - encoding/hex.lo encoding/json.lo encoding/pem.lo \ - encoding/xml.lo exp/proxy.lo exp/terminal.lo html/template.lo \ - go/ast.lo go/build.lo go/constant.lo go/doc.lo go/format.lo \ - go/importer.lo go/internal/gcimporter.lo \ - go/internal/gccgoimporter.lo go/parser.lo go/printer.lo \ - go/scanner.lo go/token.lo go/types.lo hash/adler32.lo \ - hash/crc32.lo hash/crc64.lo hash/fnv.lo net/http/cgi.lo \ - net/http/cookiejar.lo net/http/fcgi.lo net/http/httptest.lo \ - net/http/httputil.lo net/http/internal.lo net/http/pprof.lo \ - image/color.lo image/color/palette.lo image/draw.lo \ - image/gif.lo image/internal/imageutil.lo image/jpeg.lo \ - image/png.lo index/suffixarray.lo internal/format.lo \ - internal/singleflight.lo internal/syscall/unix.lo \ - internal/testenv.lo internal/trace.lo io/ioutil.lo \ - log/syslog.lo log/syslog/syslog_c.lo math/big.lo math/cmplx.lo \ - math/rand.lo mime/multipart.lo mime/quotedprintable.lo \ - net/http.lo net/internal/socktest.lo net/mail.lo net/rpc.lo \ - net/smtp.lo net/textproto.lo net/url.lo old/regexp.lo \ - old/template.lo os/exec.lo $(am__DEPENDENCIES_1) os/signal.lo \ - os/user.lo path/filepath.lo regexp/syntax.lo \ - net/rpc/jsonrpc.lo runtime/debug.lo runtime/pprof.lo \ - sync/atomic.lo sync/atomic_c.lo text/scanner.lo \ - text/tabwriter.lo text/template.lo text/template/parse.lo \ - testing/iotest.lo testing/quick.lo unicode/utf16.lo \ - unicode/utf8.lo -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_4 = lock_sema.lo thread-sema.lo -@LIBGO_IS_LINUX_TRUE@am__objects_4 = lock_futex.lo thread-linux.lo -@HAVE_SYS_MMAN_H_FALSE@am__objects_5 = mem_posix_memalign.lo -@HAVE_SYS_MMAN_H_TRUE@am__objects_5 = mem.lo -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_6 = netpoll_kqueue.lo -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_6 = netpoll_select.lo -@LIBGO_IS_LINUX_TRUE@am__objects_6 = netpoll_epoll.lo -@LIBGO_IS_RTEMS_TRUE@am__objects_7 = rtems-task-variable-add.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-none.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@am__objects_8 = getncpu-bsd.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@am__objects_8 = getncpu-solaris.lo -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = getncpu-irix.lo -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@am__objects_8 = \ -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@ getncpu-bsd.lo -@LIBGO_IS_LINUX_TRUE@am__objects_8 = getncpu-linux.lo -am__objects_9 = go-append.lo go-assert.lo go-assert-interface.lo \ - go-byte-array-to-string.lo go-breakpoint.lo go-caller.lo \ - go-callers.lo go-can-convert-interface.lo go-cdiv.lo go-cgo.lo \ - go-check-interface.lo go-construct-map.lo \ - go-convert-interface.lo go-copy.lo go-defer.lo \ - go-deferred-recover.lo go-eface-compare.lo \ - go-eface-val-compare.lo go-ffi.lo go-fieldtrack.lo \ - go-int-array-to-string.lo go-int-to-string.lo \ - go-interface-compare.lo go-interface-eface-compare.lo \ - go-interface-val-compare.lo go-make-slice.lo go-map-delete.lo \ - go-map-index.lo go-map-len.lo go-map-range.lo go-matherr.lo \ - go-memcmp.lo go-nanotime.lo go-now.lo go-new-map.lo go-new.lo \ - go-nosys.lo go-panic.lo go-print.lo go-recover.lo \ - go-reflect-call.lo go-reflect-map.lo go-rune.lo \ - go-runtime-error.lo go-setenv.lo go-signal.lo go-strcmp.lo \ - go-string-to-byte-array.lo go-string-to-int-array.lo \ - go-strplus.lo go-strslice.lo go-traceback.lo \ - go-type-complex.lo go-type-eface.lo go-type-error.lo \ - go-type-float.lo go-type-identity.lo go-type-interface.lo \ - go-type-string.lo go-typedesc-equal.lo go-unsafe-new.lo \ - go-unsafe-newarray.lo go-unsafe-pointer.lo go-unsetenv.lo \ - go-unwind.lo go-varargs.lo env_posix.lo heapdump.lo \ - $(am__objects_4) mcache.lo mcentral.lo $(am__objects_5) \ - mfixalloc.lo mgc0.lo mheap.lo msize.lo $(am__objects_6) \ - panic.lo parfor.lo print.lo proc.lo runtime.lo signal_unix.lo \ - thread.lo yield.lo $(am__objects_7) chan.lo cpuprof.lo \ - go-iface.lo lfstack.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_8) -am_libgo_llgo_la_OBJECTS = $(am__objects_9) -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_9) -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 -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libgobegin_llgo_a_SOURCES) $(libgobegin_a_SOURCES) \ - $(libgolibbegin_a_SOURCES) $(libnetgo_a_SOURCES) \ - $(libgo_llgo_la_SOURCES) $(libgo_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 -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(noinst_DATA) $(toolexeclibgo_DATA) \ - $(toolexeclibgoarchive_DATA) $(toolexeclibgocompress_DATA) \ - $(toolexeclibgocontainer_DATA) $(toolexeclibgocrypto_DATA) \ - $(toolexeclibgocryptox509_DATA) $(toolexeclibgodatabase_DATA) \ - $(toolexeclibgodatabasesql_DATA) $(toolexeclibgodebug_DATA) \ - $(toolexeclibgoencoding_DATA) $(toolexeclibgoexp_DATA) \ - $(toolexeclibgogo_DATA) $(toolexeclibgohash_DATA) \ - $(toolexeclibgohtml_DATA) $(toolexeclibgoimage_DATA) \ - $(toolexeclibgoimagecolor_DATA) $(toolexeclibgoindex_DATA) \ - $(toolexeclibgoio_DATA) $(toolexeclibgolog_DATA) \ - $(toolexeclibgomath_DATA) $(toolexeclibgomime_DATA) \ - $(toolexeclibgonet_DATA) $(toolexeclibgonethttp_DATA) \ - $(toolexeclibgonetrpc_DATA) $(toolexeclibgoold_DATA) \ - $(toolexeclibgoos_DATA) $(toolexeclibgopath_DATA) \ - $(toolexeclibgoregexp_DATA) $(toolexeclibgoruntime_DATA) \ - $(toolexeclibgosync_DATA) $(toolexeclibgotesting_DATA) \ - $(toolexeclibgotext_DATA) $(toolexeclibgotexttemplate_DATA) \ - $(toolexeclibgounicode_DATA) -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 = testsuite -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GOARCH = @GOARCH@ -GOC = @GOC@ -GOCFLAGS = $(CFLAGS) -GOOS = @GOOS@ -GO_LIBCALL_OS_ARCH_FILE = @GO_LIBCALL_OS_ARCH_FILE@ -GO_LIBCALL_OS_FILE = @GO_LIBCALL_OS_FILE@ -GO_SPLIT_STACK = @GO_SPLIT_STACK@ -GO_SYSCALL_OS_ARCH_FILE = @GO_SYSCALL_OS_ARCH_FILE@ -GO_SYSCALL_OS_FILE = @GO_SYSCALL_OS_FILE@ -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@ -LIBATOMIC = @LIBATOMIC@ -LIBFFI = @LIBFFI@ -LIBFFIINCS = @LIBFFIINCS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MATH_FLAG = @MATH_FLAG@ -MATH_LIBS = @MATH_LIBS@ -MKDIR_P = @MKDIR_P@ -NET_LIBS = @NET_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJCOPY = @OBJCOPY@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OSCFLAGS = @OSCFLAGS@ -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@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SIZEOF_STRUCT_EPOLL_EVENT = @SIZEOF_STRUCT_EPOLL_EVENT@ -SPLIT_STACK = @SPLIT_STACK@ -STRINGOPS_FLAG = @STRINGOPS_FLAG@ -STRIP = @STRIP@ -STRUCT_EPOLL_EVENT_FD_OFFSET = @STRUCT_EPOLL_EVENT_FD_OFFSET@ -USE_DEJAGNU = @USE_DEJAGNU@ -VERSION = @VERSION@ -WARN_FLAGS = @WARN_FLAGS@ -WERROR = @WERROR@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -enable_shared = @enable_shared@ -enable_static = @enable_static@ -exec_prefix = @exec_prefix@ -glibgo_toolexecdir = @glibgo_toolexecdir@ -glibgo_toolexeclibdir = @glibgo_toolexeclibdir@ -go_include = @go_include@ -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@ -libtool_VERSION = @libtool_VERSION@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -multi_basedir = @multi_basedir@ -nover_glibgo_toolexeclibdir = @nover_glibgo_toolexeclibdir@ -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@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# Go support. -SUFFIXES = .c .go .gox .o .obj .lo .a -@LIBGO_IS_RTEMS_TRUE@subdirs = testsuite -SUBDIRS = ${subdirs} -gcc_version := $(shell $(GOC) -dumpversion) -MAINT_CHARSET = latin1 -mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs -PWD_COMMAND = $${PWDCMD-pwd} -STAMP = echo timestamp > -toolexecdir = $(glibgo_toolexecdir) -toolexeclibdir = $(glibgo_toolexeclibdir) -toolexeclibgodir = $(nover_glibgo_toolexeclibdir)/go/$(gcc_version)/$(target_alias) -libexecsubdir = $(libexecdir)/gcc/$(target_alias)/$(gcc_version) -WARN_CFLAGS = $(WARN_FLAGS) $(WERROR) - -# -I/-D flags to pass when compiling. -AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS) -ACLOCAL_AMFLAGS = -I ./config -I ../config -AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \ - $(SPLIT_STACK) $(WARN_CFLAGS) \ - $(STRINGOPS_FLAG) $(OSCFLAGS) \ - -I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \ - -I $(MULTIBUILDTOP)../../gcc/include - -@USING_SPLIT_STACK_TRUE@AM_LDFLAGS = -XCClinker $(SPLIT_STACK) - -# Multilib support. -MAKEOVERRIDES = - -# Work around what appears to be a GNU make 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)" \ - "CC_FOR_TARGET=$(CC_FOR_TARGET)" \ - "CFLAGS=$(CFLAGS)" \ - "CXXFLAGS=$(CXXFLAGS)" \ - "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ - "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ - "GOC_FOR_TARGET=$(GOC_FOR_TARGET)" \ - "GOC=$(GOC)" \ - "GOCFLAGS=$(GOCFLAGS)" \ - "INSTALL=$(INSTALL)" \ - "INSTALL_DATA=$(INSTALL_DATA)" \ - "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ - "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ - "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)" \ - "includedir=$(includedir)" \ - "prefix=$(prefix)" \ - "tooldir=$(tooldir)" \ - "gxx_include_dir=$(gxx_include_dir)" \ - "AR=$(AR)" \ - "AS=$(AS)" \ - "LD=$(LD)" \ - "RANLIB=$(RANLIB)" \ - "NM=$(NM)" \ - "NM_FOR_BUILD=$(NM_FOR_BUILD)" \ - "NM_FOR_TARGET=$(NM_FOR_TARGET)" \ - "DESTDIR=$(DESTDIR)" \ - "WERROR=$(WERROR)" - - -# Subdir rules rely on $(FLAGS_TO_PASS) -FLAGS_TO_PASS = $(AM_MAKEFLAGS) -@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 libgolibbegin.a libnetgo.a -@GOC_IS_LLGO_TRUE@toolexeclib_LIBRARIES = libgobegin-llgo.a -toolexeclibgo_DATA = \ - bufio.gox \ - bytes.gox \ - crypto.gox \ - encoding.gox \ - errors.gox \ - expvar.gox \ - flag.gox \ - fmt.gox \ - hash.gox \ - html.gox \ - image.gox \ - io.gox \ - log.gox \ - math.gox \ - mime.gox \ - net.gox \ - os.gox \ - path.gox \ - reflect.gox \ - regexp.gox \ - runtime.gox \ - sort.gox \ - strconv.gox \ - strings.gox \ - sync.gox \ - syscall.gox \ - testing.gox \ - time.gox \ - unicode.gox - -toolexeclibgoarchivedir = $(toolexeclibgodir)/archive -toolexeclibgoarchive_DATA = \ - archive/tar.gox \ - archive/zip.gox - -toolexeclibgocompressdir = $(toolexeclibgodir)/compress -toolexeclibgocompress_DATA = \ - compress/bzip2.gox \ - compress/flate.gox \ - compress/gzip.gox \ - compress/lzw.gox \ - compress/zlib.gox - -toolexeclibgocontainerdir = $(toolexeclibgodir)/container -toolexeclibgocontainer_DATA = \ - container/heap.gox \ - container/list.gox \ - container/ring.gox - -toolexeclibgocryptodir = $(toolexeclibgodir)/crypto -toolexeclibgocrypto_DATA = \ - crypto/aes.gox \ - crypto/cipher.gox \ - crypto/des.gox \ - crypto/dsa.gox \ - crypto/ecdsa.gox \ - crypto/elliptic.gox \ - crypto/hmac.gox \ - crypto/md5.gox \ - crypto/rand.gox \ - crypto/rc4.gox \ - crypto/rsa.gox \ - crypto/sha1.gox \ - crypto/sha256.gox \ - crypto/sha512.gox \ - crypto/subtle.gox \ - crypto/tls.gox \ - crypto/x509.gox - -toolexeclibgocryptox509dir = $(toolexeclibgocryptodir)/x509 -toolexeclibgocryptox509_DATA = \ - crypto/x509/pkix.gox - -toolexeclibgodatabasedir = $(toolexeclibgodir)/database -toolexeclibgodatabase_DATA = \ - database/sql.gox - -toolexeclibgodatabasesqldir = $(toolexeclibgodatabasedir)/sql -toolexeclibgodatabasesql_DATA = \ - database/sql/driver.gox - -toolexeclibgodebugdir = $(toolexeclibgodir)/debug -toolexeclibgodebug_DATA = \ - debug/dwarf.gox \ - debug/elf.gox \ - debug/gosym.gox \ - debug/macho.gox \ - debug/pe.gox \ - debug/plan9obj.gox - -toolexeclibgoencodingdir = $(toolexeclibgodir)/encoding -toolexeclibgoencoding_DATA = \ - encoding/ascii85.gox \ - encoding/asn1.gox \ - encoding/base32.gox \ - encoding/base64.gox \ - encoding/binary.gox \ - encoding/csv.gox \ - encoding/gob.gox \ - encoding/hex.gox \ - encoding/json.gox \ - encoding/pem.gox \ - encoding/xml.gox - -toolexeclibgoexpdir = $(toolexeclibgodir)/exp -toolexeclibgoexp_DATA = \ - exp/proxy.gox \ - exp/terminal.gox - -toolexeclibgogodir = $(toolexeclibgodir)/go -toolexeclibgogo_DATA = \ - go/ast.gox \ - go/build.gox \ - go/constant.gox \ - go/doc.gox \ - go/format.gox \ - go/importer.gox \ - go/parser.gox \ - go/printer.gox \ - go/scanner.gox \ - go/token.gox \ - go/types.gox - -toolexeclibgohashdir = $(toolexeclibgodir)/hash -toolexeclibgohash_DATA = \ - hash/adler32.gox \ - hash/crc32.gox \ - hash/crc64.gox \ - hash/fnv.gox - -toolexeclibgohtmldir = $(toolexeclibgodir)/html -toolexeclibgohtml_DATA = \ - html/template.gox - -toolexeclibgoimagedir = $(toolexeclibgodir)/image -toolexeclibgoimage_DATA = \ - image/color.gox \ - image/draw.gox \ - image/gif.gox \ - image/jpeg.gox \ - image/png.gox - -toolexeclibgoimagecolordir = $(toolexeclibgoimagedir)/color -toolexeclibgoimagecolor_DATA = \ - image/color/palette.gox - -toolexeclibgoindexdir = $(toolexeclibgodir)/index -toolexeclibgoindex_DATA = \ - index/suffixarray.gox - -toolexeclibgoiodir = $(toolexeclibgodir)/io -toolexeclibgoio_DATA = \ - io/ioutil.gox - -toolexeclibgologdir = $(toolexeclibgodir)/log -toolexeclibgolog_DATA = \ - log/syslog.gox - -toolexeclibgomathdir = $(toolexeclibgodir)/math -toolexeclibgomath_DATA = \ - math/big.gox \ - math/cmplx.gox \ - math/rand.gox - -toolexeclibgomimedir = $(toolexeclibgodir)/mime -toolexeclibgomime_DATA = \ - mime/multipart.gox \ - mime/quotedprintable.gox - -toolexeclibgonetdir = $(toolexeclibgodir)/net -toolexeclibgonet_DATA = \ - net/http.gox \ - net/mail.gox \ - net/rpc.gox \ - net/smtp.gox \ - net/textproto.gox \ - net/url.gox - -toolexeclibgonethttpdir = $(toolexeclibgonetdir)/http -toolexeclibgonethttp_DATA = \ - net/http/cgi.gox \ - net/http/cookiejar.gox \ - net/http/fcgi.gox \ - net/http/httptest.gox \ - net/http/httputil.gox \ - net/http/pprof.gox - -toolexeclibgonetrpcdir = $(toolexeclibgonetdir)/rpc -toolexeclibgonetrpc_DATA = \ - net/rpc/jsonrpc.gox - -toolexeclibgoolddir = $(toolexeclibgodir)/old -toolexeclibgoold_DATA = \ - old/regexp.gox \ - old/template.gox - -toolexeclibgoosdir = $(toolexeclibgodir)/os -toolexeclibgoos_DATA = \ - os/exec.gox \ - os/signal.gox \ - os/user.gox - -toolexeclibgopathdir = $(toolexeclibgodir)/path -toolexeclibgopath_DATA = \ - path/filepath.gox - -toolexeclibgoregexpdir = $(toolexeclibgodir)/regexp -toolexeclibgoregexp_DATA = \ - regexp/syntax.gox - -toolexeclibgoruntimedir = $(toolexeclibgodir)/runtime -toolexeclibgoruntime_DATA = \ - runtime/debug.gox \ - runtime/pprof.gox - -toolexeclibgosyncdir = $(toolexeclibgodir)/sync -toolexeclibgosync_DATA = \ - sync/atomic.gox - -toolexeclibgotestingdir = $(toolexeclibgodir)/testing -toolexeclibgotesting_DATA = \ - testing/iotest.gox \ - testing/quick.gox - -toolexeclibgotextdir = $(toolexeclibgodir)/text -toolexeclibgotext_DATA = \ - text/scanner.gox \ - text/tabwriter.gox \ - text/template.gox - -toolexeclibgotexttemplatedir = $(toolexeclibgotextdir)/template -toolexeclibgotexttemplate_DATA = \ - text/template/parse.gox - -toolexeclibgounicodedir = $(toolexeclibgodir)/unicode -toolexeclibgounicode_DATA = \ - unicode/utf16.gox \ - unicode/utf8.gox - -@HAVE_SYS_MMAN_H_FALSE@runtime_mem_file = runtime/mem_posix_memalign.c -@HAVE_SYS_MMAN_H_TRUE@runtime_mem_file = runtime/mem.c -@LIBGO_IS_RTEMS_FALSE@rtems_task_variable_add_file = -@LIBGO_IS_RTEMS_TRUE@rtems_task_variable_add_file = runtime/rtems-task-variable-add.c -@LIBGO_IS_LINUX_FALSE@runtime_lock_files = runtime/lock_sema.c runtime/thread-sema.c -@LIBGO_IS_LINUX_TRUE@runtime_lock_files = runtime/lock_futex.c runtime/thread-linux.c -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-none.c -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-bsd.c -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_getncpu_file = runtime/getncpu-bsd.c -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@runtime_getncpu_file = runtime/getncpu-solaris.c -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@runtime_getncpu_file = runtime/getncpu-irix.c -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@runtime_getncpu_file = runtime/getncpu-bsd.c -@LIBGO_IS_LINUX_TRUE@runtime_getncpu_file = runtime/getncpu-linux.c -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@runtime_netpoll_files = runtime/netpoll_kqueue.c -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@runtime_netpoll_files = runtime/netpoll_select.c -@LIBGO_IS_LINUX_TRUE@runtime_netpoll_files = runtime/netpoll_epoll.c -runtime_files = \ - runtime/go-append.c \ - runtime/go-assert.c \ - runtime/go-assert-interface.c \ - runtime/go-byte-array-to-string.c \ - runtime/go-breakpoint.c \ - runtime/go-caller.c \ - runtime/go-callers.c \ - runtime/go-can-convert-interface.c \ - runtime/go-cdiv.c \ - runtime/go-cgo.c \ - runtime/go-check-interface.c \ - runtime/go-construct-map.c \ - runtime/go-convert-interface.c \ - runtime/go-copy.c \ - runtime/go-defer.c \ - runtime/go-deferred-recover.c \ - runtime/go-eface-compare.c \ - runtime/go-eface-val-compare.c \ - runtime/go-ffi.c \ - runtime/go-fieldtrack.c \ - runtime/go-int-array-to-string.c \ - runtime/go-int-to-string.c \ - runtime/go-interface-compare.c \ - runtime/go-interface-eface-compare.c \ - runtime/go-interface-val-compare.c \ - runtime/go-make-slice.c \ - runtime/go-map-delete.c \ - runtime/go-map-index.c \ - runtime/go-map-len.c \ - runtime/go-map-range.c \ - runtime/go-matherr.c \ - runtime/go-memcmp.c \ - runtime/go-nanotime.c \ - runtime/go-now.c \ - runtime/go-new-map.c \ - runtime/go-new.c \ - runtime/go-nosys.c \ - runtime/go-panic.c \ - runtime/go-print.c \ - runtime/go-recover.c \ - runtime/go-reflect-call.c \ - runtime/go-reflect-map.c \ - runtime/go-rune.c \ - runtime/go-runtime-error.c \ - runtime/go-setenv.c \ - runtime/go-signal.c \ - runtime/go-strcmp.c \ - runtime/go-string-to-byte-array.c \ - runtime/go-string-to-int-array.c \ - runtime/go-strplus.c \ - runtime/go-strslice.c \ - runtime/go-traceback.c \ - runtime/go-type-complex.c \ - runtime/go-type-eface.c \ - runtime/go-type-error.c \ - runtime/go-type-float.c \ - runtime/go-type-identity.c \ - runtime/go-type-interface.c \ - runtime/go-type-string.c \ - runtime/go-typedesc-equal.c \ - runtime/go-unsafe-new.c \ - runtime/go-unsafe-newarray.c \ - runtime/go-unsafe-pointer.c \ - runtime/go-unsetenv.c \ - runtime/go-unwind.c \ - runtime/go-varargs.c \ - runtime/env_posix.c \ - runtime/heapdump.c \ - $(runtime_lock_files) \ - runtime/mcache.c \ - runtime/mcentral.c \ - $(runtime_mem_file) \ - runtime/mfixalloc.c \ - runtime/mgc0.c \ - runtime/mheap.c \ - runtime/msize.c \ - $(runtime_netpoll_files) \ - runtime/panic.c \ - runtime/parfor.c \ - runtime/print.c \ - runtime/proc.c \ - runtime/runtime.c \ - runtime/signal_unix.c \ - runtime/thread.c \ - runtime/yield.c \ - $(rtems_task_variable_add_file) \ - chan.c \ - cpuprof.c \ - go-iface.c \ - lfstack.c \ - malloc.c \ - map.c \ - mprof.c \ - netpoll.c \ - rdebug.c \ - reflect.c \ - runtime1.c \ - sema.c \ - sigqueue.c \ - string.c \ - time.c \ - $(runtime_getncpu_file) - -go_bufio_files = \ - go/bufio/bufio.go \ - go/bufio/scan.go - -go_bytes_files = \ - go/bytes/buffer.go \ - go/bytes/bytes.go \ - go/bytes/bytes_decl.go \ - go/bytes/reader.go - -go_bytes_c_files = \ - go/bytes/indexbyte.c - -go_crypto_files = \ - go/crypto/crypto.go - -go_encoding_files = \ - go/encoding/encoding.go - -go_errors_files = \ - go/errors/errors.go - -go_expvar_files = \ - go/expvar/expvar.go - -go_flag_files = \ - go/flag/flag.go - -go_fmt_files = \ - go/fmt/doc.go \ - go/fmt/format.go \ - go/fmt/print.go \ - go/fmt/scan.go - -go_hash_files = \ - go/hash/hash.go - -go_html_files = \ - go/html/entity.go \ - go/html/escape.go - -go_image_files = \ - go/image/format.go \ - go/image/geom.go \ - go/image/image.go \ - go/image/names.go \ - go/image/ycbcr.go - -go_io_files = \ - go/io/multi.go \ - go/io/io.go \ - go/io/pipe.go - -go_log_files = \ - go/log/log.go - -go_math_files = \ - go/math/abs.go \ - go/math/acosh.go \ - go/math/asin.go \ - go/math/asinh.go \ - go/math/atan.go \ - go/math/atanh.go \ - go/math/atan2.go \ - go/math/bits.go \ - go/math/cbrt.go \ - go/math/const.go \ - go/math/copysign.go \ - go/math/dim.go \ - go/math/erf.go \ - go/math/exp.go \ - go/math/expm1.go \ - go/math/floor.go \ - go/math/frexp.go \ - go/math/gamma.go \ - go/math/hypot.go \ - go/math/j0.go \ - go/math/j1.go \ - go/math/jn.go \ - go/math/ldexp.go \ - go/math/lgamma.go \ - go/math/log.go \ - go/math/log1p.go \ - go/math/log10.go \ - go/math/logb.go \ - go/math/mod.go \ - go/math/modf.go \ - go/math/nextafter.go \ - go/math/pow.go \ - go/math/pow10.go \ - go/math/remainder.go \ - go/math/signbit.go \ - go/math/sin.go \ - go/math/sincos.go \ - go/math/sinh.go \ - go/math/sqrt.go \ - go/math/tan.go \ - go/math/tanh.go \ - go/math/unsafe.go - -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@go_mime_type_file = -@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@go_mime_type_file = go/mime/type_dragonfly.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_OPENBSD_FALSE@go_mime_type_file = go/mime/type_freebsd.go -@LIBGO_IS_OPENBSD_TRUE@go_mime_type_file = go/mime/type_openbsd.go -go_mime_files = \ - go/mime/encodedword.go \ - go/mime/grammar.go \ - go/mime/mediatype.go \ - go/mime/type.go \ - go/mime/type_unix.go \ - $(go_mime_type_file) - -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_file = go/net/cgo_bsd.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_file = go/net/cgo_netbsd.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_file = go/net/cgo_bsd.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_cgo_file = go/net/cgo_solaris.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_cgo_file = go/net/cgo_linux.go -@LIBGO_IS_LINUX_TRUE@go_net_cgo_file = go/net/cgo_linux.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sock_file = go/net/sock_bsd.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_sock_file = go/net/sock_bsd.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sock_file = go/net/sock_bsd.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_sock_file = go/net/sock_stub.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_sock_file = go/net/sock_linux.go -@LIBGO_IS_LINUX_TRUE@go_net_sock_file = go/net/sock_linux.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockopt_file = go/net/sockopt_bsd.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockopt_file = go/net/sockopt_bsd.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockopt_file = go/net/sockopt_bsd.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_sockopt_file = go/net/sockopt_solaris.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_sockopt_file = go/net/sockopt_linux.go -@LIBGO_IS_LINUX_TRUE@go_net_sockopt_file = go/net/sockopt_linux.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_sockoptip_file = go/net/sockoptip_stub.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go -@LIBGO_IS_LINUX_TRUE@go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_sock_file = go/net/cgo_sockold.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_sock_file = go/net/cgo_sockold.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_sock_file = go/net/cgo_sockold.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_cgo_sock_file = go/net/cgo_socknew.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_cgo_sock_file = go/net/cgo_socknew.go -@LIBGO_IS_LINUX_TRUE@go_net_cgo_sock_file = go/net/cgo_socknew.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_res_file = go/net/cgo_resold.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_res_file = go/net/cgo_resnew.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_cgo_res_file = go/net/cgo_resold.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_cgo_res_file = go/net/cgo_resnew.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_cgo_res_file = go/net/cgo_resnew.go -@LIBGO_IS_LINUX_TRUE@go_net_cgo_res_file = go/net/cgo_resnew.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_sendfile_file = go/net/sendfile_stub.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_sendfile_file = go/net/sendfile_solaris.go -@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@go_net_sendfile_file = go/net/sendfile_dragonfly.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_sendfile_file = go/net/sendfile_freebsd.go -@LIBGO_IS_LINUX_TRUE@go_net_sendfile_file = go/net/sendfile_linux.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@go_net_interface_file = go/net/interface_stub.go -@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@go_net_interface_file = go/net/interface_dragonfly.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@go_net_interface_file = go/net/interface_netbsd.go -@LIBGO_IS_LINUX_TRUE@go_net_interface_file = go/net/interface_linux.go -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@go_net_cloexec_file = go/net/sys_cloexec.go -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_cloexec_file = go/net/sock_cloexec.go go/net/hook_cloexec.go -@LIBGO_IS_LINUX_TRUE@go_net_cloexec_file = go/net/sock_cloexec.go go/net/hook_cloexec.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_tcpsockopt_file = go/net/tcpsockopt_unix.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_net_tcpsockopt_file = go/net/tcpsockopt_dragonfly.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_solaris.go -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_OPENBSD_FALSE@go_net_tcpsockopt_file = go/net/tcpsockopt_darwin.go -@LIBGO_IS_OPENBSD_TRUE@go_net_tcpsockopt_file = go/net/tcpsockopt_openbsd.go -go_net_common_files = \ - go/net/addrselect.go \ - $(go_net_cloexec_file) \ - go/net/conf.go \ - go/net/dial.go \ - go/net/dnsclient.go \ - go/net/dnsclient_unix.go \ - go/net/dnsconfig_unix.go \ - go/net/dnsmsg.go \ - go/net/fd_mutex.go \ - go/net/fd_posix.go \ - go/net/fd_unix.go \ - go/net/file.go \ - go/net/file_unix.go \ - go/net/hook.go \ - go/net/hook_unix.go \ - go/net/hosts.go \ - go/net/interface.go \ - $(go_net_interface_file) \ - go/net/ip.go \ - go/net/iprawsock.go \ - go/net/iprawsock_posix.go \ - go/net/ipsock.go \ - go/net/ipsock_posix.go \ - go/net/lookup.go \ - go/net/lookup_unix.go \ - go/net/mac.go \ - go/net/net.go \ - go/net/nss.go \ - go/net/parse.go \ - go/net/pipe.go \ - go/net/fd_poll_runtime.go \ - go/net/port.go \ - go/net/port_unix.go \ - go/net/race0.go \ - $(go_net_sendfile_file) \ - go/net/sock_posix.go \ - $(go_net_sock_file) \ - go/net/sockopt_posix.go \ - $(go_net_sockopt_file) \ - $(go_net_sockoptip_file) \ - go/net/tcpsock.go \ - go/net/tcpsock_posix.go \ - go/net/tcpsockopt_posix.go \ - $(go_net_tcpsockopt_file) \ - go/net/udpsock.go \ - go/net/udpsock_posix.go \ - go/net/unixsock.go \ - go/net/unixsock_posix.go - -go_net_files = \ - go/net/cgo_unix.go \ - $(go_net_cgo_file) \ - $(go_net_cgo_res_file) \ - $(go_net_cgo_sock_file) \ - $(go_net_common_files) - -go_netgo_files = \ - go/net/cgo_stub.go \ - $(go_net_common_files) - -@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_FALSE@go_os_dir_file = go/os/dir_regfile.go -@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_TRUE@go_os_dir_file = go/os/dir_largefile.go -@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_dir_file = go/os/dir_largefile.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_regfile.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_dir_file = go/os/dir_largefile.go -@LIBGO_IS_DARWIN_FALSE@go_os_getwd_file = -@LIBGO_IS_DARWIN_TRUE@go_os_getwd_file = go/os/getwd_darwin.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_bsd.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sys_file = go/os/sys_uname.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sys_file = go/os/sys_uname.go -@LIBGO_IS_LINUX_TRUE@go_os_sys_file = go/os/sys_linux.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_unix.go -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_darwin.go -@LIBGO_IS_FREEBSD_TRUE@go_os_cloexec_file = go/os/sys_freebsd.go -@HAVE_STAT_TIMESPEC_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_solaris.go -@HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_atim.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_dragonfly.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go -@LIBGO_IS_LINUX_FALSE@go_os_pipe_file = go/os/pipe_bsd.go -@LIBGO_IS_LINUX_TRUE@go_os_pipe_file = go/os/pipe_linux.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_sticky_file = go/os/sticky_notbsd.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_NETBSD_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -@LIBGO_IS_DARWIN_TRUE@go_os_sticky_file = go/os/sticky_bsd.go -go_os_files = \ - $(go_os_dir_file) \ - go/os/dir.go \ - go/os/doc.go \ - go/os/env.go \ - go/os/error.go \ - go/os/error_unix.go \ - go/os/exec.go \ - go/os/exec_posix.go \ - go/os/exec_unix.go \ - go/os/file.go \ - go/os/file_posix.go \ - go/os/file_unix.go \ - go/os/getwd.go \ - $(go_os_getwd_file) \ - go/os/path.go \ - go/os/path_unix.go \ - $(go_os_pipe_file) \ - go/os/proc.go \ - $(go_os_stat_file) \ - $(go_os_sticky_file) \ - go/os/str.go \ - $(go_os_sys_file) \ - $(go_os_cloexec_file) \ - go/os/types.go \ - go/os/types_notwin.go - -go_path_files = \ - go/path/match.go \ - go/path/path.go - -go_reflect_files = \ - go/reflect/deepequal.go \ - go/reflect/makefunc.go \ - go/reflect/makefunc_ffi.go \ - go/reflect/type.go \ - go/reflect/value.go - -go_reflect_makefunc_c_file = \ - go/reflect/makefunc_ffi_c.c - -go_regexp_files = \ - go/regexp/backtrack.go \ - go/regexp/exec.go \ - go/regexp/onepass.go \ - go/regexp/regexp.go - -go_net_rpc_files = \ - go/net/rpc/client.go \ - go/net/rpc/debug.go \ - go/net/rpc/server.go - -go_runtime_files = \ - go/runtime/compiler.go \ - go/runtime/debug.go \ - go/runtime/error.go \ - go/runtime/extern.go \ - go/runtime/mem.go \ - version.go - -noinst_DATA = zstdpkglist.go -go_sort_files = \ - go/sort/search.go \ - go/sort/sort.go - -go_strconv_files = \ - go/strconv/atob.go \ - go/strconv/atof.go \ - go/strconv/atoi.go \ - go/strconv/decimal.go \ - go/strconv/doc.go \ - go/strconv/extfloat.go \ - go/strconv/ftoa.go \ - go/strconv/isprint.go \ - go/strconv/itoa.go \ - go/strconv/quote.go - -go_strings_files = \ - go/strings/compare.go \ - go/strings/reader.go \ - go/strings/replace.go \ - go/strings/search.go \ - go/strings/strings.go \ - go/strings/strings_decl.go - -go_strings_c_files = \ - go/strings/indexbyte.c - -go_sync_files = \ - go/sync/cond.go \ - go/sync/mutex.go \ - go/sync/once.go \ - go/sync/pool.go \ - go/sync/race0.go \ - go/sync/runtime.go \ - go/sync/rwmutex.go \ - go/sync/waitgroup.go - -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/log/syslog/syslog_unix.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_syslog_file = go/log/syslog/syslog_libc.go -@LIBGO_IS_SOLARIS_TRUE@go_syslog_file = go/log/syslog/syslog_libc.go -go_log_syslog_files = \ - go/log/syslog/doc.go \ - go/log/syslog/syslog.go \ - $(go_syslog_file) - -go_syslog_c_files = \ - go/log/syslog/syslog_c.c - -go_testing_files = \ - go/testing/allocs.go \ - go/testing/benchmark.go \ - go/testing/cover.go \ - go/testing/example.go \ - go/testing/testing.go - -go_time_files = \ - go/time/format.go \ - go/time/sleep.go \ - go/time/sys_unix.go \ - go/time/tick.go \ - go/time/time.go \ - go/time/zoneinfo.go \ - go/time/zoneinfo_read.go \ - go/time/zoneinfo_unix.go - -go_unicode_files = \ - go/unicode/casetables.go \ - go/unicode/digit.go \ - go/unicode/graphic.go \ - go/unicode/letter.go \ - go/unicode/tables.go - -@LIBGO_IS_DARWIN_TRUE@archive_tar_atim_file = go/archive/tar/stat_atimespec.go -@LIBGO_IS_FREEBSD_TRUE@archive_tar_atim_file = go/archive/tar/stat_atimespec.go -@LIBGO_IS_LINUX_TRUE@archive_tar_atim_file = go/archive/tar/stat_atim.go -@LIBGO_IS_NETBSD_TRUE@archive_tar_atim_file = go/archive/tar/stat_atimespec.go -@LIBGO_IS_OPENBSD_TRUE@archive_tar_atim_file = go/archive/tar/stat_atim.go -@LIBGO_IS_SOLARIS_TRUE@archive_tar_atim_file = go/archive/tar/stat_atim.go -go_archive_tar_files = \ - go/archive/tar/common.go \ - go/archive/tar/reader.go \ - go/archive/tar/stat_unix.go \ - go/archive/tar/writer.go \ - $(archive_tar_atim_file) - -go_archive_zip_files = \ - go/archive/zip/reader.go \ - go/archive/zip/register.go \ - go/archive/zip/struct.go \ - go/archive/zip/writer.go - -go_compress_bzip2_files = \ - go/compress/bzip2/bit_reader.go \ - go/compress/bzip2/bzip2.go \ - go/compress/bzip2/huffman.go \ - go/compress/bzip2/move_to_front.go - -go_compress_flate_files = \ - go/compress/flate/copy.go \ - go/compress/flate/deflate.go \ - go/compress/flate/fixedhuff.go \ - go/compress/flate/huffman_bit_writer.go \ - go/compress/flate/huffman_code.go \ - go/compress/flate/inflate.go \ - go/compress/flate/reverse_bits.go \ - go/compress/flate/token.go - -go_compress_gzip_files = \ - go/compress/gzip/gzip.go \ - go/compress/gzip/gunzip.go - -go_compress_lzw_files = \ - go/compress/lzw/reader.go \ - go/compress/lzw/writer.go - -go_compress_zlib_files = \ - go/compress/zlib/reader.go \ - go/compress/zlib/writer.go - -go_container_heap_files = \ - go/container/heap/heap.go - -go_container_list_files = \ - go/container/list/list.go - -go_container_ring_files = \ - go/container/ring/ring.go - -go_crypto_aes_files = \ - go/crypto/aes/block.go \ - go/crypto/aes/cipher.go \ - go/crypto/aes/cipher_generic.go \ - go/crypto/aes/const.go - -go_crypto_cipher_files = \ - go/crypto/cipher/cbc.go \ - go/crypto/cipher/cfb.go \ - go/crypto/cipher/cipher.go \ - go/crypto/cipher/ctr.go \ - go/crypto/cipher/gcm.go \ - go/crypto/cipher/io.go \ - go/crypto/cipher/ofb.go \ - go/crypto/cipher/xor.go - -go_crypto_des_files = \ - go/crypto/des/block.go \ - go/crypto/des/cipher.go \ - go/crypto/des/const.go - -go_crypto_dsa_files = \ - go/crypto/dsa/dsa.go - -go_crypto_ecdsa_files = \ - go/crypto/ecdsa/ecdsa.go - -go_crypto_elliptic_files = \ - go/crypto/elliptic/elliptic.go \ - go/crypto/elliptic/p224.go \ - go/crypto/elliptic/p256.go - -go_crypto_hmac_files = \ - go/crypto/hmac/hmac.go - -go_crypto_md5_files = \ - go/crypto/md5/md5.go \ - go/crypto/md5/md5block.go \ - go/crypto/md5/md5block_generic.go - -@LIBGO_IS_LINUX_FALSE@crypto_rand_file = -@LIBGO_IS_LINUX_TRUE@crypto_rand_file = go/crypto/rand/rand_linux.go -go_crypto_rand_files = \ - go/crypto/rand/eagain.go \ - go/crypto/rand/rand.go \ - go/crypto/rand/rand_unix.go \ - $(crypto_rand_file) \ - go/crypto/rand/util.go - -go_crypto_rc4_files = \ - go/crypto/rc4/rc4.go \ - go/crypto/rc4/rc4_ref.go - -go_crypto_rsa_files = \ - go/crypto/rsa/pkcs1v15.go \ - go/crypto/rsa/pss.go \ - go/crypto/rsa/rsa.go - -go_crypto_sha1_files = \ - go/crypto/sha1/sha1.go \ - go/crypto/sha1/sha1block.go \ - go/crypto/sha1/sha1block_generic.go - -go_crypto_sha256_files = \ - go/crypto/sha256/sha256.go \ - go/crypto/sha256/sha256block.go - -go_crypto_sha512_files = \ - go/crypto/sha512/sha512.go \ - go/crypto/sha512/sha512block.go - -go_crypto_subtle_files = \ - go/crypto/subtle/constant_time.go - -go_crypto_tls_files = \ - go/crypto/tls/alert.go \ - go/crypto/tls/cipher_suites.go \ - go/crypto/tls/common.go \ - go/crypto/tls/conn.go \ - go/crypto/tls/handshake_client.go \ - go/crypto/tls/handshake_messages.go \ - go/crypto/tls/handshake_server.go \ - go/crypto/tls/key_agreement.go \ - go/crypto/tls/prf.go \ - go/crypto/tls/ticket.go \ - go/crypto/tls/tls.go - -@LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = -@LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = go/crypto/x509/root_darwin.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_crypto_x509_root_file = go/crypto/x509/root_bsd.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_crypto_x509_root_file = go/crypto/x509/root_solaris.go -@LIBGO_IS_LINUX_TRUE@go_crypto_x509_root_file = go/crypto/x509/root_linux.go -go_crypto_x509_files = \ - go/crypto/x509/cert_pool.go \ - go/crypto/x509/pem_decrypt.go \ - go/crypto/x509/pkcs1.go \ - go/crypto/x509/pkcs8.go \ - go/crypto/x509/root.go \ - go/crypto/x509/root_unix.go \ - $(go_crypto_x509_root_file) \ - go/crypto/x509/sec1.go \ - go/crypto/x509/verify.go \ - go/crypto/x509/x509.go - -go_crypto_x509_pkix_files = \ - go/crypto/x509/pkix/pkix.go - -go_database_sql_files = \ - go/database/sql/convert.go \ - go/database/sql/sql.go - -go_database_sql_driver_files = \ - go/database/sql/driver/driver.go \ - go/database/sql/driver/types.go - -go_debug_dwarf_files = \ - go/debug/dwarf/buf.go \ - go/debug/dwarf/class_string.go \ - go/debug/dwarf/const.go \ - go/debug/dwarf/entry.go \ - go/debug/dwarf/line.go \ - go/debug/dwarf/open.go \ - go/debug/dwarf/type.go \ - go/debug/dwarf/typeunit.go \ - go/debug/dwarf/unit.go - -go_debug_elf_files = \ - go/debug/elf/elf.go \ - go/debug/elf/file.go - -go_debug_gosym_files = \ - go/debug/gosym/pclntab.go \ - go/debug/gosym/symtab.go - -go_debug_macho_files = \ - go/debug/macho/fat.go \ - go/debug/macho/file.go \ - go/debug/macho/macho.go - -go_debug_pe_files = \ - go/debug/pe/file.go \ - go/debug/pe/pe.go - -go_debug_plan9obj_files = \ - go/debug/plan9obj/file.go \ - go/debug/plan9obj/plan9obj.go - -go_encoding_ascii85_files = \ - go/encoding/ascii85/ascii85.go - -go_encoding_asn1_files = \ - go/encoding/asn1/asn1.go \ - go/encoding/asn1/common.go \ - go/encoding/asn1/marshal.go - -go_encoding_base32_files = \ - go/encoding/base32/base32.go - -go_encoding_base64_files = \ - go/encoding/base64/base64.go - -go_encoding_binary_files = \ - go/encoding/binary/binary.go \ - go/encoding/binary/varint.go - -go_encoding_csv_files = \ - go/encoding/csv/reader.go \ - go/encoding/csv/writer.go - -go_encoding_gob_files = \ - go/encoding/gob/decode.go \ - go/encoding/gob/decoder.go \ - go/encoding/gob/dec_helpers.go \ - go/encoding/gob/doc.go \ - go/encoding/gob/encode.go \ - go/encoding/gob/encoder.go \ - go/encoding/gob/enc_helpers.go \ - go/encoding/gob/error.go \ - go/encoding/gob/type.go - -go_encoding_hex_files = \ - go/encoding/hex/hex.go - -go_encoding_json_files = \ - go/encoding/json/decode.go \ - go/encoding/json/encode.go \ - go/encoding/json/fold.go \ - go/encoding/json/indent.go \ - go/encoding/json/scanner.go \ - go/encoding/json/stream.go \ - go/encoding/json/tags.go - -go_encoding_pem_files = \ - go/encoding/pem/pem.go - -go_encoding_xml_files = \ - go/encoding/xml/marshal.go \ - go/encoding/xml/read.go \ - go/encoding/xml/typeinfo.go \ - go/encoding/xml/xml.go - -go_exp_proxy_files = \ - go/exp/proxy/direct.go \ - go/exp/proxy/per_host.go \ - go/exp/proxy/proxy.go \ - go/exp/proxy/socks5.go - -go_exp_terminal_files = \ - go/exp/terminal/terminal.go \ - go/exp/terminal/util.go - -go_go_ast_files = \ - go/go/ast/ast.go \ - go/go/ast/commentmap.go \ - go/go/ast/filter.go \ - go/go/ast/import.go \ - go/go/ast/print.go \ - go/go/ast/resolve.go \ - go/go/ast/scope.go \ - go/go/ast/walk.go - -go_go_build_files = \ - go/go/build/build.go \ - go/go/build/doc.go \ - go/go/build/read.go \ - go/go/build/syslist.go - -go_go_constant_files = \ - go/go/constant/go14.go \ - go/go/constant/value.go - -go_go_doc_files = \ - go/go/doc/comment.go \ - go/go/doc/doc.go \ - go/go/doc/example.go \ - go/go/doc/exports.go \ - go/go/doc/filter.go \ - go/go/doc/reader.go \ - go/go/doc/synopsis.go - -go_go_format_files = \ - go/go/format/format.go - -go_go_importer_files = \ - go/go/importer/importer.go - -go_go_parser_files = \ - go/go/parser/interface.go \ - go/go/parser/parser.go - -go_go_printer_files = \ - go/go/printer/nodes.go \ - go/go/printer/printer.go - -go_go_scanner_files = \ - go/go/scanner/errors.go \ - go/go/scanner/scanner.go - -go_go_token_files = \ - go/go/token/position.go \ - go/go/token/serialize.go \ - go/go/token/token.go - -go_go_types_files = \ - go/go/types/api.go \ - go/go/types/assignments.go \ - go/go/types/builtins.go \ - go/go/types/call.go \ - go/go/types/check.go \ - go/go/types/conversions.go \ - go/go/types/decl.go \ - go/go/types/errors.go \ - go/go/types/eval.go \ - go/go/types/expr.go \ - go/go/types/exprstring.go \ - go/go/types/go12.go \ - go/go/types/initorder.go \ - go/go/types/labels.go \ - go/go/types/lookup.go \ - go/go/types/methodset.go \ - go/go/types/object.go \ - go/go/types/objset.go \ - go/go/types/operand.go \ - go/go/types/ordering.go \ - go/go/types/package.go \ - go/go/types/predicates.go \ - go/go/types/resolver.go \ - go/go/types/return.go \ - go/go/types/scope.go \ - go/go/types/selection.go \ - go/go/types/stmt.go \ - go/go/types/sizes.go \ - go/go/types/type.go \ - go/go/types/typestring.go \ - go/go/types/typexpr.go \ - go/go/types/universe.go - -go_go_internal_gcimporter_files = \ - go/go/internal/gcimporter/exportdata.go \ - go/go/internal/gcimporter/gcimporter.go - -go_go_internal_gccgoimporter_files = \ - go/go/internal/gccgoimporter/gccgoinstallation.go \ - go/go/internal/gccgoimporter/importer.go \ - go/go/internal/gccgoimporter/parser.go - -go_hash_adler32_files = \ - go/hash/adler32/adler32.go - -go_hash_crc32_files = \ - go/hash/crc32/crc32.go \ - go/hash/crc32/crc32_generic.go - -go_hash_crc64_files = \ - go/hash/crc64/crc64.go - -go_hash_fnv_files = \ - go/hash/fnv/fnv.go - -go_html_template_files = \ - go/html/template/attr.go \ - go/html/template/content.go \ - go/html/template/context.go \ - go/html/template/css.go \ - go/html/template/doc.go \ - go/html/template/error.go \ - go/html/template/escape.go \ - go/html/template/html.go \ - go/html/template/js.go \ - go/html/template/template.go \ - go/html/template/transition.go \ - go/html/template/url.go - -go_image_color_files = \ - go/image/color/color.go \ - go/image/color/ycbcr.go - -go_image_color_palette_files = \ - go/image/color/palette/palette.go - -go_image_draw_files = \ - go/image/draw/draw.go - -go_image_gif_files = \ - go/image/gif/reader.go \ - go/image/gif/writer.go - -go_image_internal_imageutil_files = \ - go/image/internal/imageutil/imageutil.go \ - go/image/internal/imageutil/impl.go - -go_image_jpeg_files = \ - go/image/jpeg/fdct.go \ - go/image/jpeg/huffman.go \ - go/image/jpeg/idct.go \ - go/image/jpeg/reader.go \ - go/image/jpeg/scan.go \ - go/image/jpeg/writer.go - -go_image_png_files = \ - go/image/png/paeth.go \ - go/image/png/reader.go \ - go/image/png/writer.go - -go_index_suffixarray_files = \ - go/index/suffixarray/qsufsort.go \ - go/index/suffixarray/suffixarray.go - -go_internal_format_files = \ - go/internal/format/format.go - -go_internal_singleflight_files = \ - go/internal/singleflight/singleflight.go - -@LIBGO_IS_LINUX_FALSE@internal_syscall_unix_getrandom_file = -@LIBGO_IS_LINUX_TRUE@internal_syscall_unix_getrandom_file = go/internal/syscall/unix/getrandom_linux.go -go_internal_syscall_unix_files = \ - go/internal/syscall/unix/dummy.go \ - $(internal_syscall_unix_getrandom_file) - -go_internal_testenv_files = \ - go/internal/testenv/testenv.go - -go_internal_trace_files = \ - go/internal/trace/goroutines.go \ - go/internal/trace/parser.go - -go_io_ioutil_files = \ - go/io/ioutil/ioutil.go \ - go/io/ioutil/tempfile.go - -go_math_big_files = \ - go/math/big/accuracy_string.go \ - go/math/big/arith.go \ - go/math/big/arith_decl_pure.go \ - go/math/big/decimal.go \ - go/math/big/float.go \ - go/math/big/floatconv.go \ - go/math/big/ftoa.go \ - go/math/big/int.go \ - go/math/big/intconv.go \ - go/math/big/nat.go \ - go/math/big/natconv.go \ - go/math/big/rat.go \ - go/math/big/ratconv.go \ - go/math/big/roundingmode_string.go - -go_math_cmplx_files = \ - go/math/cmplx/abs.go \ - go/math/cmplx/asin.go \ - go/math/cmplx/conj.go \ - go/math/cmplx/exp.go \ - go/math/cmplx/isinf.go \ - go/math/cmplx/isnan.go \ - go/math/cmplx/log.go \ - go/math/cmplx/phase.go \ - go/math/cmplx/polar.go \ - go/math/cmplx/pow.go \ - go/math/cmplx/rect.go \ - go/math/cmplx/sin.go \ - go/math/cmplx/sqrt.go \ - go/math/cmplx/tan.go - -go_math_rand_files = \ - go/math/rand/exp.go \ - go/math/rand/normal.go \ - go/math/rand/rand.go \ - go/math/rand/rng.go \ - go/math/rand/zipf.go - -go_mime_multipart_files = \ - go/mime/multipart/formdata.go \ - go/mime/multipart/multipart.go \ - go/mime/multipart/writer.go - -go_mime_quotedprintable_files = \ - go/mime/quotedprintable/reader.go \ - go/mime/quotedprintable/writer.go - -go_net_http_files = \ - go/net/http/client.go \ - go/net/http/cookie.go \ - go/net/http/filetransport.go \ - go/net/http/fs.go \ - go/net/http/header.go \ - go/net/http/jar.go \ - go/net/http/lex.go \ - go/net/http/request.go \ - go/net/http/response.go \ - go/net/http/server.go \ - go/net/http/sniff.go \ - go/net/http/status.go \ - go/net/http/transfer.go \ - go/net/http/transport.go - -go_net_mail_files = \ - go/net/mail/message.go - -go_net_smtp_files = \ - go/net/smtp/auth.go \ - go/net/smtp/smtp.go - -go_net_textproto_files = \ - go/net/textproto/header.go \ - go/net/textproto/pipeline.go \ - go/net/textproto/reader.go \ - go/net/textproto/textproto.go \ - go/net/textproto/writer.go - -go_net_url_files = \ - go/net/url/url.go - -go_net_http_cgi_files = \ - go/net/http/cgi/child.go \ - go/net/http/cgi/host.go - -go_net_http_cookiejar_files = \ - go/net/http/cookiejar/jar.go \ - go/net/http/cookiejar/punycode.go - -go_net_http_fcgi_files = \ - go/net/http/fcgi/child.go \ - go/net/http/fcgi/fcgi.go - -go_net_http_httptest_files = \ - go/net/http/httptest/recorder.go \ - go/net/http/httptest/server.go - -go_net_http_pprof_files = \ - go/net/http/pprof/pprof.go - -go_net_http_httputil_files = \ - go/net/http/httputil/dump.go \ - go/net/http/httputil/httputil.go \ - go/net/http/httputil/persist.go \ - go/net/http/httputil/reverseproxy.go - -go_net_http_internal_files = \ - go/net/http/internal/chunked.go - -@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@go_net_internal_socktest_sys = -@LIBGO_IS_FREEBSD_TRUE@@LIBGO_IS_LINUX_FALSE@go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go -@LIBGO_IS_LINUX_TRUE@go_net_internal_socktest_sys = go/net/internal/socktest/sys_cloexec.go -go_net_internal_socktest_files = \ - go/net/internal/socktest/switch.go \ - go/net/internal/socktest/switch_posix.go \ - go/net/internal/socktest/switch_unix.go \ - go/net/internal/socktest/sys_unix.go \ - $(go_net_internal_socktest_sys) - -go_old_regexp_files = \ - go/old/regexp/regexp.go - -go_old_template_files = \ - go/old/template/doc.go \ - go/old/template/execute.go \ - go/old/template/format.go \ - go/old/template/parse.go - -go_os_exec_files = \ - go/os/exec/exec.go \ - go/os/exec/exec_posix.go \ - go/os/exec/lp_unix.go - -go_os_signal_files = \ - go/os/signal/signal.go \ - go/os/signal/signal_unix.go - -@LIBGO_IS_SOLARIS_FALSE@os_user_decls_file = go/os/user/decls_unix.go -@LIBGO_IS_SOLARIS_TRUE@os_user_decls_file = go/os/user/decls_solaris.go -go_os_user_files = \ - go/os/user/lookup.go \ - go/os/user/lookup_unix.go \ - go/os/user/user.go \ - $(os_user_decls_file) - -go_path_filepath_files = \ - go/path/filepath/match.go \ - go/path/filepath/path.go \ - go/path/filepath/path_unix.go \ - go/path/filepath/symlink.go \ - go/path/filepath/symlink_unix.go - -go_regexp_syntax_files = \ - go/regexp/syntax/compile.go \ - go/regexp/syntax/doc.go \ - go/regexp/syntax/parse.go \ - go/regexp/syntax/perl_groups.go \ - go/regexp/syntax/prog.go \ - go/regexp/syntax/regexp.go \ - go/regexp/syntax/simplify.go - -go_net_rpc_jsonrpc_files = \ - go/net/rpc/jsonrpc/client.go \ - go/net/rpc/jsonrpc/server.go - -go_runtime_debug_files = \ - go/runtime/debug/garbage.go \ - go/runtime/debug/stack.go - -go_runtime_pprof_files = \ - go/runtime/pprof/pprof.go - -go_text_tabwriter_files = \ - go/text/tabwriter/tabwriter.go - -go_text_template_files = \ - go/text/template/doc.go \ - go/text/template/exec.go \ - go/text/template/funcs.go \ - go/text/template/helper.go \ - go/text/template/option.go \ - go/text/template/template.go - -go_text_template_parse_files = \ - go/text/template/parse/lex.go \ - go/text/template/parse/node.go \ - go/text/template/parse/parse.go - -go_sync_atomic_files = \ - go/sync/atomic/doc.go \ - go/sync/atomic/value.go - -go_sync_atomic_c_files = \ - go/sync/atomic/atomic.c - -go_testing_iotest_files = \ - go/testing/iotest/logger.go \ - go/testing/iotest/reader.go \ - go/testing/iotest/writer.go - -go_testing_quick_files = \ - go/testing/quick/quick.go - -go_text_scanner_files = \ - go/text/scanner/scanner.go - -go_unicode_utf16_files = \ - go/unicode/utf16/utf16.go - -go_unicode_utf8_files = \ - go/unicode/utf8/utf8.go - -@LIBGO_IS_RTEMS_FALSE@syscall_syscall_file = go/syscall/syscall_unix.go - -# Define Syscall and Syscall6. -@LIBGO_IS_RTEMS_TRUE@syscall_syscall_file = go/syscall/syscall_stubs.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@syscall_exec_file = go/syscall/exec_unix.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_RTEMS_FALSE@syscall_exec_file = go/syscall/exec_unix.go - -# Define ForkExec and Exec. -@LIBGO_IS_RTEMS_TRUE@syscall_exec_file = go/syscall/exec_stubs.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@syscall_exec_os_file = go/syscall/exec_bsd.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_RTEMS_FALSE@syscall_exec_os_file = go/syscall/exec_linux.go -@LIBGO_IS_RTEMS_TRUE@syscall_exec_os_file = -@HAVE_WAIT4_FALSE@@LIBGO_IS_RTEMS_FALSE@syscall_wait_file = go/syscall/libcall_waitpid.go -@HAVE_WAIT4_TRUE@@LIBGO_IS_RTEMS_FALSE@syscall_wait_file = go/syscall/libcall_wait4.go - -# Define Wait4. -@LIBGO_IS_RTEMS_TRUE@syscall_wait_file = -@LIBGO_IS_RTEMS_FALSE@syscall_wait_c_file = go/syscall/wait.c - -# Support for pulling apart wait status. -@LIBGO_IS_RTEMS_TRUE@syscall_wait_c_file = -@LIBGO_IS_RTEMS_FALSE@syscall_sleep_file = go/syscall/sleep_select.go - -# Define Sleep. -@LIBGO_IS_RTEMS_TRUE@syscall_sleep_file = go/syscall/sleep_rtems.go -@HAVE_STRERROR_R_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@syscall_errstr_file = go/syscall/errstr_nor.go -@HAVE_STRERROR_R_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_FALSE@syscall_errstr_file = go/syscall/errstr.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_RTEMS_TRUE@syscall_errstr_file = go/syscall/errstr_linux.go - -# Define Errstr. -@LIBGO_IS_LINUX_TRUE@syscall_errstr_file = go/syscall/errstr_linux.go -# Use lseek on 64-bit Solaris. -@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_FALSE@syscall_size_file = go/syscall/libcall_posix_regfile.go -# Use lseek64 on 32-bit Solaris/SPARC. -@LIBGO_IS_386_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@@LIBGO_IS_SPARC_TRUE@syscall_size_file = go/syscall/libcall_posix_largefile.go -# Use lseek64 on 32-bit Solaris/x86. -@LIBGO_IS_386_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_size_file = go/syscall/libcall_posix_largefile.go -# Use lseek by default. -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_size_file = go/syscall/libcall_posix_regfile.go - -# Declare libc functions that vary for largefile systems. -# Always use lseek64 on GNU/Linux. -@LIBGO_IS_LINUX_TRUE@syscall_size_file = go/syscall/libcall_posix_largefile.go -@LIBGO_IS_IRIX_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_file = go/syscall/socket_bsd.go -@LIBGO_IS_IRIX_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_FALSE@syscall_socket_file = go/syscall/socket_irix.go -@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_socket_file = go/syscall/socket_solaris.go - -# Define socket sizes and types. -@LIBGO_IS_LINUX_TRUE@syscall_socket_file = go/syscall/socket_linux.go epoll.go -@LIBGO_IS_LINUX_FALSE@syscall_socket_type_file = -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_FALSE@syscall_socket_type_file = go/syscall/socket_linux_type.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_FALSE@@LIBGO_IS_PPC64_TRUE@syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go -@LIBGO_IS_LINUX_TRUE@@LIBGO_IS_PPC64LE_TRUE@syscall_socket_type_file = go/syscall/socket_linux_ppc64x_type.go -@LIBGO_IS_SOLARIS_FALSE@syscall_socket_os_file = go/syscall/socket_posix.go - -# Define socket functions. -@LIBGO_IS_SOLARIS_TRUE@syscall_socket_os_file = go/syscall/socket_xnet.go -@LIBGO_IS_386_FALSE@@LIBGO_IS_SOLARIS_TRUE@syscall_uname_file = go/syscall/libcall_uname.go - -# Support for uname. -# 32-bit Solaris 2/x86 needs _nuname, handled in libcall_solaris_386.go. -@LIBGO_IS_386_TRUE@@LIBGO_IS_SOLARIS_TRUE@syscall_uname_file = -@LIBGO_IS_SOLARIS_FALSE@syscall_uname_file = go/syscall/libcall_uname.go -@LIBGO_IS_LINUX_FALSE@syscall_sockcmsg_file = - -# GNU/Linux specific socket control messages. -@LIBGO_IS_LINUX_TRUE@syscall_sockcmsg_file = go/syscall/sockcmsg_linux.go -@LIBGO_IS_LINUX_FALSE@syscall_netlink_file = - -# Support for netlink sockets and messages. -@LIBGO_IS_LINUX_TRUE@syscall_netlink_file = go/syscall/netlink_linux.go -@LIBGO_IS_LINUX_FALSE@syscall_lsf_file = - -# GNU/Linux specific socket filters. -@LIBGO_IS_LINUX_TRUE@syscall_lsf_file = go/syscall/lsf_linux.go -@LIBGO_IS_ARM64_FALSE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file = go/syscall/libcall_linux_ustat.go - -# GNU/Linux specific ustat support. -@LIBGO_IS_ARM64_TRUE@@LIBGO_IS_LINUX_TRUE@syscall_ustat_file = -@LIBGO_IS_LINUX_FALSE@syscall_ustat_file = -@LIBGO_IS_LINUX_FALSE@syscall_utimesnano_file = go/syscall/libcall_posix_utimesnano.go - -# GNU/Linux specific utimesnano support. -@LIBGO_IS_LINUX_TRUE@syscall_utimesnano_file = go/syscall/libcall_linux_utimesnano.go -@LIBGO_IS_LINUX_FALSE@syscall_creds_test_file = - -# Test files. -@LIBGO_IS_LINUX_TRUE@syscall_creds_test_file = go/syscall/creds_test.go -@LIBGO_IS_LINUX_FALSE@syscall_exec_test_file = -@LIBGO_IS_LINUX_TRUE@syscall_exec_test_file = go/syscall/exec_linux_test.go go/syscall/syscall_linux_test.go -@LIBGO_IS_LINUX_FALSE@syscall_os_file = go/syscall/libcall_bsd.go -@LIBGO_IS_LINUX_TRUE@syscall_os_file = -go_base_syscall_files = \ - go/syscall/env_unix.go \ - go/syscall/syscall_errno.go \ - go/syscall/libcall_support.go \ - go/syscall/libcall_posix.go \ - go/syscall/race0.go \ - go/syscall/socket.go \ - go/syscall/sockcmsg_unix.go \ - go/syscall/str.go \ - go/syscall/syscall.go \ - $(syscall_sockcmsg_file) \ - $(syscall_syscall_file) \ - $(syscall_exec_file) \ - $(syscall_exec_os_file) \ - $(syscall_wait_file) \ - $(syscall_sleep_file) \ - $(syscall_errstr_file) \ - $(syscall_size_file) \ - $(syscall_os_file) \ - $(syscall_socket_file) \ - $(syscall_socket_os_file) \ - $(syscall_socket_type_file) \ - $(syscall_uname_file) \ - $(syscall_netlink_file) \ - $(syscall_lsf_file) \ - $(syscall_ustat_file) \ - $(syscall_utimesnano_file) \ - $(GO_LIBCALL_OS_FILE) \ - $(GO_LIBCALL_OS_ARCH_FILE) \ - $(GO_SYSCALL_OS_FILE) \ - $(GO_SYSCALL_OS_ARCH_FILE) - -go_syscall_files = \ - $(go_base_syscall_files) \ - libcalls.go \ - sysinfo.go \ - syscall_arch.go - -go_syscall_c_files = \ - go/syscall/errno.c \ - go/syscall/signame.c \ - $(syscall_wait_c_file) - -go_syscall_test_files = \ - $(syscall_creds_test_file) \ - $(syscall_exec_test_file) \ - go/syscall/exec_unix_test.go \ - go/syscall/export_test.go \ - go/syscall/export_unix_test.go \ - go/syscall/mmap_unix_test.go \ - go/syscall/syscall_test.go \ - go/syscall/syscall_unix_test.go - -@LIBGO_IS_LINUX_FALSE@os_lib_inotify_lo = - -# os_lib_inotify_lo = os/inotify.lo -@LIBGO_IS_LINUX_TRUE@os_lib_inotify_lo = -libgo_go_objs = \ - bufio.lo \ - bytes.lo \ - bytes/index.lo \ - crypto.lo \ - encoding.lo \ - errors.lo \ - expvar.lo \ - flag.lo \ - fmt.lo \ - hash.lo \ - html.lo \ - image.lo \ - io.lo \ - log.lo \ - math.lo \ - mime.lo \ - net.lo \ - os.lo \ - path.lo \ - reflect-go.lo \ - reflect/makefunc_ffi_c.lo \ - regexp.lo \ - runtime-go.lo \ - sort.lo \ - strconv.lo \ - strings.lo \ - strings/index.lo \ - sync.lo \ - syscall.lo \ - syscall/errno.lo \ - syscall/signame.lo \ - syscall/wait.lo \ - testing.lo \ - time-go.lo \ - unicode.lo \ - archive/tar.lo \ - archive/zip.lo \ - compress/bzip2.lo \ - compress/flate.lo \ - compress/gzip.lo \ - compress/lzw.lo \ - compress/zlib.lo \ - container/heap.lo \ - container/list.lo \ - container/ring.lo \ - crypto/aes.lo \ - crypto/cipher.lo \ - crypto/des.lo \ - crypto/dsa.lo \ - crypto/ecdsa.lo \ - crypto/elliptic.lo \ - crypto/hmac.lo \ - crypto/md5.lo \ - crypto/rand.lo \ - crypto/rc4.lo \ - crypto/rsa.lo \ - crypto/sha1.lo \ - crypto/sha256.lo \ - crypto/sha512.lo \ - crypto/subtle.lo \ - crypto/tls.lo \ - crypto/x509.lo \ - crypto/x509/pkix.lo \ - database/sql.lo \ - database/sql/driver.lo \ - debug/dwarf.lo \ - debug/elf.lo \ - debug/gosym.lo \ - debug/macho.lo \ - debug/pe.lo \ - debug/plan9obj.lo \ - encoding/ascii85.lo \ - encoding/asn1.lo \ - encoding/base32.lo \ - encoding/base64.lo \ - encoding/binary.lo \ - encoding/csv.lo \ - encoding/gob.lo \ - encoding/hex.lo \ - encoding/json.lo \ - encoding/pem.lo \ - encoding/xml.lo \ - exp/proxy.lo \ - exp/terminal.lo \ - html/template.lo \ - go/ast.lo \ - go/build.lo \ - go/constant.lo \ - go/doc.lo \ - go/format.lo \ - go/importer.lo \ - go/internal/gcimporter.lo \ - go/internal/gccgoimporter.lo \ - go/parser.lo \ - go/printer.lo \ - go/scanner.lo \ - go/token.lo \ - go/types.lo \ - hash/adler32.lo \ - hash/crc32.lo \ - hash/crc64.lo \ - hash/fnv.lo \ - net/http/cgi.lo \ - net/http/cookiejar.lo \ - net/http/fcgi.lo \ - net/http/httptest.lo \ - net/http/httputil.lo \ - net/http/internal.lo \ - net/http/pprof.lo \ - image/color.lo \ - image/color/palette.lo \ - image/draw.lo \ - image/gif.lo \ - image/internal/imageutil.lo \ - image/jpeg.lo \ - image/png.lo \ - index/suffixarray.lo \ - internal/format.lo \ - internal/singleflight.lo \ - internal/syscall/unix.lo \ - internal/testenv.lo \ - internal/trace.lo \ - io/ioutil.lo \ - log/syslog.lo \ - log/syslog/syslog_c.lo \ - math/big.lo \ - math/cmplx.lo \ - math/rand.lo \ - mime/multipart.lo \ - mime/quotedprintable.lo \ - net/http.lo \ - net/internal/socktest.lo \ - net/mail.lo \ - net/rpc.lo \ - net/smtp.lo \ - net/textproto.lo \ - net/url.lo \ - old/regexp.lo \ - old/template.lo \ - os/exec.lo \ - $(os_lib_inotify_lo) \ - os/signal.lo \ - os/user.lo \ - path/filepath.lo \ - regexp/syntax.lo \ - net/rpc/jsonrpc.lo \ - runtime/debug.lo \ - runtime/pprof.lo \ - sync/atomic.lo \ - sync/atomic_c.lo \ - text/scanner.lo \ - text/tabwriter.lo \ - text/template.lo \ - text/template/parse.lo \ - testing/iotest.lo \ - testing/quick.lo \ - unicode/utf16.lo \ - unicode/utf8.lo - -libgo_ldflags = \ - -version-info $(libtool_VERSION) $(PTHREAD_CFLAGS) $(AM_LDFLAGS) - -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 - - -# Use -fPIC for libgobegin so that it can be put in a PIE. -libgobegin_a_CFLAGS = $(AM_CFLAGS) -fPIC -libgobegin_llgo_a_CFLAGS = $(AM_CFLAGS) -fPIC -libgolibbegin_a_SOURCES = \ - runtime/go-libmain.c - -libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC -libnetgo_a_SOURCES = $(go_netgo_files) -libnetgo_a_LIBADD = netgo.o -LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) -AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK) -GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS) -LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \ - $(AM_GOCFLAGS) $(GOCFLAGS) - -GOLINK = $(LIBTOOL) --tag GO --mode-link $(GOC) \ - $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_GOCFLAGS) $(LTLDFLAGS) -o $@ - - -# Build the dependencies for a Go package. -BUILDDEPS = \ - $(MKDIR_P) $(@D); \ - $(SHELL) $(srcdir)/godeps.sh `echo $@ | sed -e 's/.dep$$//'` $^ > $@.tmp; \ - mv -f $@.tmp $@ - - -# Build the .go files for a package, generating a .lo file. -BUILDPACKAGE = \ - $(MKDIR_P) $(@D); \ - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(LTGOCOMPILE) -I . -c -fgo-pkgpath=`echo $@ | sed -e 's/.lo$$//' -e 's/-go$$//'` -o $@ $$files - - -# Build netgo.o. -BUILDNETGO = \ - $(MKDIR_P) $(@D); \ - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(GOCOMPILE) -I . -c -fPIC -fgo-pkgpath=net -o $@ $$files - -GOTESTFLAGS = -GOBENCH = - -# Check a package. -CHECK = \ - GC="$(GOC) $(GOCFLAGS) $($(subst /,_,$@)_GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \ - export GC; \ - GOLIBS="$(MATH_LIBS) $(NET_LIBS) $(LIBS)"; \ - export GOLIBS; \ - RUNTESTFLAGS="$(RUNTESTFLAGS)"; \ - export RUNTESTFLAGS; \ - MAKE="$(MAKE)"; \ - export MAKE; \ - libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \ - LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \ - LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \ - export LD_LIBRARY_PATH; \ - $(MKDIR_P) $(@D); \ - rm -f $@-testsum $@-testlog; \ - if test "$(USE_DEJAGNU)" = "yes"; then \ - $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --dejagnu=yes --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --testname="$(@D)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ - elif test "$(GOBENCH)" != ""; then \ - $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" --bench="$(GOBENCH)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files); \ - else \ - if $(SHELL) $(srcdir)/testsuite/gotest --goarch=$(GOARCH) --goos=$(GOOS) --basedir=$(srcdir) --srcdir=$(srcdir)/go/$(@D) --pkgpath="$(@D)" --pkgfiles="$(go_$(subst /,_,$(@D))_files)" $(GOTESTFLAGS) $(go_$(subst /,_,$(@D))_test_files) >>$@-testlog 2>&1; then \ - echo "PASS: $(@D)" >> $@-testlog; \ - echo "PASS: $(@D)"; \ - echo "PASS: $(@D)" > $@-testsum; \ - else \ - echo "FAIL: $(@D)" >> $@-testlog; \ - cat $@-testlog; \ - echo "FAIL: $(@D)" > $@-testsum; \ - exit 1; \ - fi; \ - fi - - -# Build all packages before checking any. -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. -# Also use -fno-inline to get better results from the memory profiler. -runtime_pprof_check_GOCFLAGS = -static-libgo -fno-inline - -# How to build a .gox file from a .lo file. -BUILDGOX = \ - f=`echo $< | sed -e 's/.lo$$/.o/'`; \ - $(OBJCOPY) -j .go_export $$f $@.tmp && mv -f $@.tmp $@ - -TEST_PACKAGES = \ - bufio/check \ - bytes/check \ - errors/check \ - expvar/check \ - flag/check \ - fmt/check \ - html/check \ - image/check \ - io/check \ - log/check \ - math/check \ - mime/check \ - net/check \ - os/check \ - path/check \ - reflect/check \ - runtime/check \ - sort/check \ - strconv/check \ - strings/check \ - sync/check \ - syscall/check \ - time/check \ - unicode/check \ - archive/tar/check \ - archive/zip/check \ - compress/bzip2/check \ - compress/flate/check \ - compress/gzip/check \ - compress/lzw/check \ - compress/zlib/check \ - container/heap/check \ - container/list/check \ - container/ring/check \ - crypto/aes/check \ - crypto/cipher/check \ - crypto/des/check \ - crypto/dsa/check \ - crypto/ecdsa/check \ - crypto/elliptic/check \ - crypto/hmac/check \ - crypto/md5/check \ - crypto/rand/check \ - crypto/rc4/check \ - crypto/rsa/check \ - crypto/sha1/check \ - crypto/sha256/check \ - crypto/sha512/check \ - crypto/subtle/check \ - crypto/tls/check \ - crypto/x509/check \ - database/sql/check \ - database/sql/driver/check \ - debug/dwarf/check \ - debug/elf/check \ - debug/macho/check \ - debug/pe/check \ - debug/plan9obj/check \ - encoding/ascii85/check \ - encoding/asn1/check \ - encoding/base32/check \ - encoding/base64/check \ - encoding/binary/check \ - encoding/csv/check \ - encoding/gob/check \ - encoding/hex/check \ - encoding/json/check \ - encoding/pem/check \ - encoding/xml/check \ - exp/proxy/check \ - exp/terminal/check \ - html/template/check \ - go/ast/check \ - go/build/check \ - go/constant/check \ - go/doc/check \ - go/format/check \ - go/internal/gcimporter/check \ - go/internal/gccgoimporter/check \ - go/parser/check \ - go/printer/check \ - go/scanner/check \ - go/token/check \ - go/types/check \ - hash/adler32/check \ - hash/crc32/check \ - hash/crc64/check \ - hash/fnv/check \ - image/color/check \ - image/draw/check \ - image/jpeg/check \ - image/png/check \ - index/suffixarray/check \ - internal/singleflight/check \ - internal/trace/check \ - io/ioutil/check \ - log/syslog/check \ - math/big/check \ - math/cmplx/check \ - math/rand/check \ - mime/multipart/check \ - mime/quotedprintable/check \ - net/http/check \ - net/http/cgi/check \ - net/http/cookiejar/check \ - net/http/fcgi/check \ - net/http/httptest/check \ - net/http/httputil/check \ - net/http/internal/check \ - net/internal/socktest/check \ - net/mail/check \ - net/rpc/check \ - net/smtp/check \ - net/textproto/check \ - net/url/check \ - net/rpc/jsonrpc/check \ - old/regexp/check \ - old/template/check \ - os/exec/check \ - os/signal/check \ - os/user/check \ - path/filepath/check \ - regexp/syntax/check \ - sync/atomic/check \ - text/scanner/check \ - text/tabwriter/check \ - text/template/check \ - text/template/parse/check \ - testing/quick/check \ - unicode/utf16/check \ - unicode/utf8/check - -MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep -CLEANFILES = *.go *.gox goc2c *.c s-version libgo.sum libgo.log -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .go .gox .o .obj .lo .a -am--refresh: Makefile - @: -$(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): - -config.h: stamp-h1 - @if test ! -f $@; then rm -f stamp-h1; else :; fi - @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -install-toolexeclibLIBRARIES: $(toolexeclib_LIBRARIES) - @$(NORMAL_INSTALL) - @list='$(toolexeclib_LIBRARIES)'; 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 " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ - echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \ - $(INSTALL_DATA) $$list2 "$(DESTDIR)$(toolexeclibdir)" || exit $$?; } - @$(POST_INSTALL) - @list='$(toolexeclib_LIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ - for p in $$list; do \ - if test -f $$p; then \ - $(am__strip_dir) \ - echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && $(RANLIB) $$f )"; \ - ( cd "$(DESTDIR)$(toolexeclibdir)" && $(RANLIB) $$f ) || exit $$?; \ - else :; fi; \ - done - -uninstall-toolexeclibLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclib_LIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir) - -clean-toolexeclibLIBRARIES: - -test -z "$(toolexeclib_LIBRARIES)" || rm -f $(toolexeclib_LIBRARIES) -libgobegin-llgo.a: $(libgobegin_llgo_a_OBJECTS) $(libgobegin_llgo_a_DEPENDENCIES) $(EXTRA_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) $(EXTRA_libgobegin_a_DEPENDENCIES) - -rm -f libgobegin.a - $(libgobegin_a_AR) libgobegin.a $(libgobegin_a_OBJECTS) $(libgobegin_a_LIBADD) - $(RANLIB) libgobegin.a -libgolibbegin.a: $(libgolibbegin_a_OBJECTS) $(libgolibbegin_a_DEPENDENCIES) $(EXTRA_libgolibbegin_a_DEPENDENCIES) - -rm -f libgolibbegin.a - $(libgolibbegin_a_AR) libgolibbegin.a $(libgolibbegin_a_OBJECTS) $(libgolibbegin_a_LIBADD) - $(RANLIB) libgolibbegin.a -libnetgo.a: $(libnetgo_a_OBJECTS) $(libnetgo_a_DEPENDENCIES) $(EXTRA_libnetgo_a_DEPENDENCIES) - -rm -f libnetgo.a - $(libnetgo_a_AR) libnetgo.a $(libnetgo_a_OBJECTS) $(libnetgo_a_LIBADD) - $(RANLIB) libnetgo.a -install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @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 " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \ - 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 -libgo-llgo.la: $(libgo_llgo_la_OBJECTS) $(libgo_llgo_la_DEPENDENCIES) $(EXTRA_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) $(EXTRA_libgo_la_DEPENDENCIES) - $(libgo_la_LINK) $(am_libgo_la_rpath) $(libgo_la_OBJECTS) $(libgo_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpuprof.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/env_posix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-bsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-irix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-linux.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-none.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getncpu-solaris.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-append.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-assert-interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-assert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-breakpoint.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-byte-array-to-string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-caller.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-callers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-can-convert-interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cdiv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-cgo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-check-interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-construct-map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-convert-interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-copy.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-defer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-deferred-recover.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-compare.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-eface-val-compare.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-ffi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-fieldtrack.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-iface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-array-to-string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-int-to-string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-interface-compare.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-interface-eface-compare.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-interface-val-compare.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-make-slice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-map-delete.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-map-index.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-map-len.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-map-range.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-matherr.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-memcmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-nanotime.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-new-map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-new.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-nosys.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-now.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-panic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-print.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-recover.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-reflect-call.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-reflect-map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-rune.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-runtime-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-setenv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-signal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-strcmp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-string-to-byte-array.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-string-to-int-array.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-strplus.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-strslice.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-traceback.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-complex.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-eface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-float.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-identity.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-interface.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-type-string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-typedesc-equal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-new.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-newarray.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsafe-pointer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unsetenv.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-unwind.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/go-varargs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/heapdump.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lfstack.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgobegin_a-go-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgobegin_llgo_a-go-main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgolibbegin_a-go-libmain.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_futex.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock_sema.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcentral.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem_posix_memalign.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mfixalloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mgc0.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mheap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mprof.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msize.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netpoll.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netpoll_epoll.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netpoll_kqueue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netpoll_select.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/panic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parfor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/print.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/proc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdebug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reflect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rtems-task-variable-add.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtime1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sema.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal_unix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigqueue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-linux.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread-sema.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/thread.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yield.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 $@ $< - -libgobegin_llgo_a-go-main.o: runtime/go-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_llgo_a_CFLAGS) $(CFLAGS) -MT libgobegin_llgo_a-go-main.o -MD -MP -MF $(DEPDIR)/libgobegin_llgo_a-go-main.Tpo -c -o libgobegin_llgo_a-go-main.o `test -f 'runtime/go-main.c' || echo '$(srcdir)/'`runtime/go-main.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgobegin_llgo_a-go-main.Tpo $(DEPDIR)/libgobegin_llgo_a-go-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-main.c' object='libgobegin_llgo_a-go-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_llgo_a_CFLAGS) $(CFLAGS) -c -o libgobegin_llgo_a-go-main.o `test -f 'runtime/go-main.c' || echo '$(srcdir)/'`runtime/go-main.c - -libgobegin_llgo_a-go-main.obj: runtime/go-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_llgo_a_CFLAGS) $(CFLAGS) -MT libgobegin_llgo_a-go-main.obj -MD -MP -MF $(DEPDIR)/libgobegin_llgo_a-go-main.Tpo -c -o libgobegin_llgo_a-go-main.obj `if test -f 'runtime/go-main.c'; then $(CYGPATH_W) 'runtime/go-main.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-main.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgobegin_llgo_a-go-main.Tpo $(DEPDIR)/libgobegin_llgo_a-go-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-main.c' object='libgobegin_llgo_a-go-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_llgo_a_CFLAGS) $(CFLAGS) -c -o libgobegin_llgo_a-go-main.obj `if test -f 'runtime/go-main.c'; then $(CYGPATH_W) 'runtime/go-main.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-main.c'; fi` - -libgobegin_a-go-main.o: runtime/go-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_a_CFLAGS) $(CFLAGS) -MT libgobegin_a-go-main.o -MD -MP -MF $(DEPDIR)/libgobegin_a-go-main.Tpo -c -o libgobegin_a-go-main.o `test -f 'runtime/go-main.c' || echo '$(srcdir)/'`runtime/go-main.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgobegin_a-go-main.Tpo $(DEPDIR)/libgobegin_a-go-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-main.c' object='libgobegin_a-go-main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_a_CFLAGS) $(CFLAGS) -c -o libgobegin_a-go-main.o `test -f 'runtime/go-main.c' || echo '$(srcdir)/'`runtime/go-main.c - -libgobegin_a-go-main.obj: runtime/go-main.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_a_CFLAGS) $(CFLAGS) -MT libgobegin_a-go-main.obj -MD -MP -MF $(DEPDIR)/libgobegin_a-go-main.Tpo -c -o libgobegin_a-go-main.obj `if test -f 'runtime/go-main.c'; then $(CYGPATH_W) 'runtime/go-main.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-main.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgobegin_a-go-main.Tpo $(DEPDIR)/libgobegin_a-go-main.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-main.c' object='libgobegin_a-go-main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgobegin_a_CFLAGS) $(CFLAGS) -c -o libgobegin_a-go-main.obj `if test -f 'runtime/go-main.c'; then $(CYGPATH_W) 'runtime/go-main.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-main.c'; fi` - -libgolibbegin_a-go-libmain.o: runtime/go-libmain.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgolibbegin_a_CFLAGS) $(CFLAGS) -MT libgolibbegin_a-go-libmain.o -MD -MP -MF $(DEPDIR)/libgolibbegin_a-go-libmain.Tpo -c -o libgolibbegin_a-go-libmain.o `test -f 'runtime/go-libmain.c' || echo '$(srcdir)/'`runtime/go-libmain.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgolibbegin_a-go-libmain.Tpo $(DEPDIR)/libgolibbegin_a-go-libmain.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-libmain.c' object='libgolibbegin_a-go-libmain.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgolibbegin_a_CFLAGS) $(CFLAGS) -c -o libgolibbegin_a-go-libmain.o `test -f 'runtime/go-libmain.c' || echo '$(srcdir)/'`runtime/go-libmain.c - -libgolibbegin_a-go-libmain.obj: runtime/go-libmain.c -@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgolibbegin_a_CFLAGS) $(CFLAGS) -MT libgolibbegin_a-go-libmain.obj -MD -MP -MF $(DEPDIR)/libgolibbegin_a-go-libmain.Tpo -c -o libgolibbegin_a-go-libmain.obj `if test -f 'runtime/go-libmain.c'; then $(CYGPATH_W) 'runtime/go-libmain.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-libmain.c'; fi` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgolibbegin_a-go-libmain.Tpo $(DEPDIR)/libgolibbegin_a-go-libmain.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-libmain.c' object='libgolibbegin_a-go-libmain.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgolibbegin_a_CFLAGS) $(CFLAGS) -c -o libgolibbegin_a-go-libmain.obj `if test -f 'runtime/go-libmain.c'; then $(CYGPATH_W) 'runtime/go-libmain.c'; else $(CYGPATH_W) '$(srcdir)/runtime/go-libmain.c'; fi` - -go-append.lo: runtime/go-append.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-append.lo -MD -MP -MF $(DEPDIR)/go-append.Tpo -c -o go-append.lo `test -f 'runtime/go-append.c' || echo '$(srcdir)/'`runtime/go-append.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-append.Tpo $(DEPDIR)/go-append.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-append.c' object='go-append.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-append.lo `test -f 'runtime/go-append.c' || echo '$(srcdir)/'`runtime/go-append.c - -go-assert.lo: runtime/go-assert.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-assert.lo -MD -MP -MF $(DEPDIR)/go-assert.Tpo -c -o go-assert.lo `test -f 'runtime/go-assert.c' || echo '$(srcdir)/'`runtime/go-assert.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-assert.Tpo $(DEPDIR)/go-assert.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-assert.c' object='go-assert.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-assert.lo `test -f 'runtime/go-assert.c' || echo '$(srcdir)/'`runtime/go-assert.c - -go-assert-interface.lo: runtime/go-assert-interface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-assert-interface.lo -MD -MP -MF $(DEPDIR)/go-assert-interface.Tpo -c -o go-assert-interface.lo `test -f 'runtime/go-assert-interface.c' || echo '$(srcdir)/'`runtime/go-assert-interface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-assert-interface.Tpo $(DEPDIR)/go-assert-interface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-assert-interface.c' object='go-assert-interface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-assert-interface.lo `test -f 'runtime/go-assert-interface.c' || echo '$(srcdir)/'`runtime/go-assert-interface.c - -go-byte-array-to-string.lo: runtime/go-byte-array-to-string.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-byte-array-to-string.lo -MD -MP -MF $(DEPDIR)/go-byte-array-to-string.Tpo -c -o go-byte-array-to-string.lo `test -f 'runtime/go-byte-array-to-string.c' || echo '$(srcdir)/'`runtime/go-byte-array-to-string.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-byte-array-to-string.Tpo $(DEPDIR)/go-byte-array-to-string.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-byte-array-to-string.c' object='go-byte-array-to-string.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-byte-array-to-string.lo `test -f 'runtime/go-byte-array-to-string.c' || echo '$(srcdir)/'`runtime/go-byte-array-to-string.c - -go-breakpoint.lo: runtime/go-breakpoint.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-breakpoint.lo -MD -MP -MF $(DEPDIR)/go-breakpoint.Tpo -c -o go-breakpoint.lo `test -f 'runtime/go-breakpoint.c' || echo '$(srcdir)/'`runtime/go-breakpoint.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-breakpoint.Tpo $(DEPDIR)/go-breakpoint.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-breakpoint.c' object='go-breakpoint.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-breakpoint.lo `test -f 'runtime/go-breakpoint.c' || echo '$(srcdir)/'`runtime/go-breakpoint.c - -go-caller.lo: runtime/go-caller.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-caller.lo -MD -MP -MF $(DEPDIR)/go-caller.Tpo -c -o go-caller.lo `test -f 'runtime/go-caller.c' || echo '$(srcdir)/'`runtime/go-caller.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-caller.Tpo $(DEPDIR)/go-caller.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-caller.c' object='go-caller.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-caller.lo `test -f 'runtime/go-caller.c' || echo '$(srcdir)/'`runtime/go-caller.c - -go-callers.lo: runtime/go-callers.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-callers.lo -MD -MP -MF $(DEPDIR)/go-callers.Tpo -c -o go-callers.lo `test -f 'runtime/go-callers.c' || echo '$(srcdir)/'`runtime/go-callers.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-callers.Tpo $(DEPDIR)/go-callers.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-callers.c' object='go-callers.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-callers.lo `test -f 'runtime/go-callers.c' || echo '$(srcdir)/'`runtime/go-callers.c - -go-can-convert-interface.lo: runtime/go-can-convert-interface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-can-convert-interface.lo -MD -MP -MF $(DEPDIR)/go-can-convert-interface.Tpo -c -o go-can-convert-interface.lo `test -f 'runtime/go-can-convert-interface.c' || echo '$(srcdir)/'`runtime/go-can-convert-interface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-can-convert-interface.Tpo $(DEPDIR)/go-can-convert-interface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-can-convert-interface.c' object='go-can-convert-interface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-can-convert-interface.lo `test -f 'runtime/go-can-convert-interface.c' || echo '$(srcdir)/'`runtime/go-can-convert-interface.c - -go-cdiv.lo: runtime/go-cdiv.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cdiv.lo -MD -MP -MF $(DEPDIR)/go-cdiv.Tpo -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cdiv.Tpo $(DEPDIR)/go-cdiv.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cdiv.c' object='go-cdiv.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-cdiv.lo `test -f 'runtime/go-cdiv.c' || echo '$(srcdir)/'`runtime/go-cdiv.c - -go-cgo.lo: runtime/go-cgo.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-cgo.lo -MD -MP -MF $(DEPDIR)/go-cgo.Tpo -c -o go-cgo.lo `test -f 'runtime/go-cgo.c' || echo '$(srcdir)/'`runtime/go-cgo.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-cgo.Tpo $(DEPDIR)/go-cgo.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-cgo.c' object='go-cgo.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-cgo.lo `test -f 'runtime/go-cgo.c' || echo '$(srcdir)/'`runtime/go-cgo.c - -go-check-interface.lo: runtime/go-check-interface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-check-interface.lo -MD -MP -MF $(DEPDIR)/go-check-interface.Tpo -c -o go-check-interface.lo `test -f 'runtime/go-check-interface.c' || echo '$(srcdir)/'`runtime/go-check-interface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-check-interface.Tpo $(DEPDIR)/go-check-interface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-check-interface.c' object='go-check-interface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-check-interface.lo `test -f 'runtime/go-check-interface.c' || echo '$(srcdir)/'`runtime/go-check-interface.c - -go-construct-map.lo: runtime/go-construct-map.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-construct-map.lo -MD -MP -MF $(DEPDIR)/go-construct-map.Tpo -c -o go-construct-map.lo `test -f 'runtime/go-construct-map.c' || echo '$(srcdir)/'`runtime/go-construct-map.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-construct-map.Tpo $(DEPDIR)/go-construct-map.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-construct-map.c' object='go-construct-map.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-construct-map.lo `test -f 'runtime/go-construct-map.c' || echo '$(srcdir)/'`runtime/go-construct-map.c - -go-convert-interface.lo: runtime/go-convert-interface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-convert-interface.lo -MD -MP -MF $(DEPDIR)/go-convert-interface.Tpo -c -o go-convert-interface.lo `test -f 'runtime/go-convert-interface.c' || echo '$(srcdir)/'`runtime/go-convert-interface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-convert-interface.Tpo $(DEPDIR)/go-convert-interface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-convert-interface.c' object='go-convert-interface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-convert-interface.lo `test -f 'runtime/go-convert-interface.c' || echo '$(srcdir)/'`runtime/go-convert-interface.c - -go-copy.lo: runtime/go-copy.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-copy.lo -MD -MP -MF $(DEPDIR)/go-copy.Tpo -c -o go-copy.lo `test -f 'runtime/go-copy.c' || echo '$(srcdir)/'`runtime/go-copy.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-copy.Tpo $(DEPDIR)/go-copy.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-copy.c' object='go-copy.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-copy.lo `test -f 'runtime/go-copy.c' || echo '$(srcdir)/'`runtime/go-copy.c - -go-defer.lo: runtime/go-defer.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-defer.lo -MD -MP -MF $(DEPDIR)/go-defer.Tpo -c -o go-defer.lo `test -f 'runtime/go-defer.c' || echo '$(srcdir)/'`runtime/go-defer.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-defer.Tpo $(DEPDIR)/go-defer.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-defer.c' object='go-defer.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-defer.lo `test -f 'runtime/go-defer.c' || echo '$(srcdir)/'`runtime/go-defer.c - -go-deferred-recover.lo: runtime/go-deferred-recover.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-deferred-recover.lo -MD -MP -MF $(DEPDIR)/go-deferred-recover.Tpo -c -o go-deferred-recover.lo `test -f 'runtime/go-deferred-recover.c' || echo '$(srcdir)/'`runtime/go-deferred-recover.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-deferred-recover.Tpo $(DEPDIR)/go-deferred-recover.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-deferred-recover.c' object='go-deferred-recover.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-deferred-recover.lo `test -f 'runtime/go-deferred-recover.c' || echo '$(srcdir)/'`runtime/go-deferred-recover.c - -go-eface-compare.lo: runtime/go-eface-compare.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-eface-compare.lo -MD -MP -MF $(DEPDIR)/go-eface-compare.Tpo -c -o go-eface-compare.lo `test -f 'runtime/go-eface-compare.c' || echo '$(srcdir)/'`runtime/go-eface-compare.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-eface-compare.Tpo $(DEPDIR)/go-eface-compare.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-eface-compare.c' object='go-eface-compare.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-eface-compare.lo `test -f 'runtime/go-eface-compare.c' || echo '$(srcdir)/'`runtime/go-eface-compare.c - -go-eface-val-compare.lo: runtime/go-eface-val-compare.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-eface-val-compare.lo -MD -MP -MF $(DEPDIR)/go-eface-val-compare.Tpo -c -o go-eface-val-compare.lo `test -f 'runtime/go-eface-val-compare.c' || echo '$(srcdir)/'`runtime/go-eface-val-compare.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-eface-val-compare.Tpo $(DEPDIR)/go-eface-val-compare.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-eface-val-compare.c' object='go-eface-val-compare.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-eface-val-compare.lo `test -f 'runtime/go-eface-val-compare.c' || echo '$(srcdir)/'`runtime/go-eface-val-compare.c - -go-ffi.lo: runtime/go-ffi.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-ffi.lo -MD -MP -MF $(DEPDIR)/go-ffi.Tpo -c -o go-ffi.lo `test -f 'runtime/go-ffi.c' || echo '$(srcdir)/'`runtime/go-ffi.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-ffi.Tpo $(DEPDIR)/go-ffi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-ffi.c' object='go-ffi.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-ffi.lo `test -f 'runtime/go-ffi.c' || echo '$(srcdir)/'`runtime/go-ffi.c - -go-fieldtrack.lo: runtime/go-fieldtrack.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-fieldtrack.lo -MD -MP -MF $(DEPDIR)/go-fieldtrack.Tpo -c -o go-fieldtrack.lo `test -f 'runtime/go-fieldtrack.c' || echo '$(srcdir)/'`runtime/go-fieldtrack.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-fieldtrack.Tpo $(DEPDIR)/go-fieldtrack.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-fieldtrack.c' object='go-fieldtrack.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-fieldtrack.lo `test -f 'runtime/go-fieldtrack.c' || echo '$(srcdir)/'`runtime/go-fieldtrack.c - -go-int-array-to-string.lo: runtime/go-int-array-to-string.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-int-array-to-string.lo -MD -MP -MF $(DEPDIR)/go-int-array-to-string.Tpo -c -o go-int-array-to-string.lo `test -f 'runtime/go-int-array-to-string.c' || echo '$(srcdir)/'`runtime/go-int-array-to-string.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-int-array-to-string.Tpo $(DEPDIR)/go-int-array-to-string.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-int-array-to-string.c' object='go-int-array-to-string.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-int-array-to-string.lo `test -f 'runtime/go-int-array-to-string.c' || echo '$(srcdir)/'`runtime/go-int-array-to-string.c - -go-int-to-string.lo: runtime/go-int-to-string.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-int-to-string.lo -MD -MP -MF $(DEPDIR)/go-int-to-string.Tpo -c -o go-int-to-string.lo `test -f 'runtime/go-int-to-string.c' || echo '$(srcdir)/'`runtime/go-int-to-string.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-int-to-string.Tpo $(DEPDIR)/go-int-to-string.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-int-to-string.c' object='go-int-to-string.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-int-to-string.lo `test -f 'runtime/go-int-to-string.c' || echo '$(srcdir)/'`runtime/go-int-to-string.c - -go-interface-compare.lo: runtime/go-interface-compare.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-interface-compare.lo -MD -MP -MF $(DEPDIR)/go-interface-compare.Tpo -c -o go-interface-compare.lo `test -f 'runtime/go-interface-compare.c' || echo '$(srcdir)/'`runtime/go-interface-compare.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-interface-compare.Tpo $(DEPDIR)/go-interface-compare.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-interface-compare.c' object='go-interface-compare.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-interface-compare.lo `test -f 'runtime/go-interface-compare.c' || echo '$(srcdir)/'`runtime/go-interface-compare.c - -go-interface-eface-compare.lo: runtime/go-interface-eface-compare.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-interface-eface-compare.lo -MD -MP -MF $(DEPDIR)/go-interface-eface-compare.Tpo -c -o go-interface-eface-compare.lo `test -f 'runtime/go-interface-eface-compare.c' || echo '$(srcdir)/'`runtime/go-interface-eface-compare.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-interface-eface-compare.Tpo $(DEPDIR)/go-interface-eface-compare.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-interface-eface-compare.c' object='go-interface-eface-compare.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-interface-eface-compare.lo `test -f 'runtime/go-interface-eface-compare.c' || echo '$(srcdir)/'`runtime/go-interface-eface-compare.c - -go-interface-val-compare.lo: runtime/go-interface-val-compare.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-interface-val-compare.lo -MD -MP -MF $(DEPDIR)/go-interface-val-compare.Tpo -c -o go-interface-val-compare.lo `test -f 'runtime/go-interface-val-compare.c' || echo '$(srcdir)/'`runtime/go-interface-val-compare.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-interface-val-compare.Tpo $(DEPDIR)/go-interface-val-compare.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-interface-val-compare.c' object='go-interface-val-compare.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-interface-val-compare.lo `test -f 'runtime/go-interface-val-compare.c' || echo '$(srcdir)/'`runtime/go-interface-val-compare.c - -go-make-slice.lo: runtime/go-make-slice.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-make-slice.lo -MD -MP -MF $(DEPDIR)/go-make-slice.Tpo -c -o go-make-slice.lo `test -f 'runtime/go-make-slice.c' || echo '$(srcdir)/'`runtime/go-make-slice.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-make-slice.Tpo $(DEPDIR)/go-make-slice.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-make-slice.c' object='go-make-slice.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-make-slice.lo `test -f 'runtime/go-make-slice.c' || echo '$(srcdir)/'`runtime/go-make-slice.c - -go-map-delete.lo: runtime/go-map-delete.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-map-delete.lo -MD -MP -MF $(DEPDIR)/go-map-delete.Tpo -c -o go-map-delete.lo `test -f 'runtime/go-map-delete.c' || echo '$(srcdir)/'`runtime/go-map-delete.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-map-delete.Tpo $(DEPDIR)/go-map-delete.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-map-delete.c' object='go-map-delete.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-map-delete.lo `test -f 'runtime/go-map-delete.c' || echo '$(srcdir)/'`runtime/go-map-delete.c - -go-map-index.lo: runtime/go-map-index.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-map-index.lo -MD -MP -MF $(DEPDIR)/go-map-index.Tpo -c -o go-map-index.lo `test -f 'runtime/go-map-index.c' || echo '$(srcdir)/'`runtime/go-map-index.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-map-index.Tpo $(DEPDIR)/go-map-index.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-map-index.c' object='go-map-index.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-map-index.lo `test -f 'runtime/go-map-index.c' || echo '$(srcdir)/'`runtime/go-map-index.c - -go-map-len.lo: runtime/go-map-len.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-map-len.lo -MD -MP -MF $(DEPDIR)/go-map-len.Tpo -c -o go-map-len.lo `test -f 'runtime/go-map-len.c' || echo '$(srcdir)/'`runtime/go-map-len.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-map-len.Tpo $(DEPDIR)/go-map-len.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-map-len.c' object='go-map-len.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-map-len.lo `test -f 'runtime/go-map-len.c' || echo '$(srcdir)/'`runtime/go-map-len.c - -go-map-range.lo: runtime/go-map-range.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-map-range.lo -MD -MP -MF $(DEPDIR)/go-map-range.Tpo -c -o go-map-range.lo `test -f 'runtime/go-map-range.c' || echo '$(srcdir)/'`runtime/go-map-range.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-map-range.Tpo $(DEPDIR)/go-map-range.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-map-range.c' object='go-map-range.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-map-range.lo `test -f 'runtime/go-map-range.c' || echo '$(srcdir)/'`runtime/go-map-range.c - -go-matherr.lo: runtime/go-matherr.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-matherr.lo -MD -MP -MF $(DEPDIR)/go-matherr.Tpo -c -o go-matherr.lo `test -f 'runtime/go-matherr.c' || echo '$(srcdir)/'`runtime/go-matherr.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-matherr.Tpo $(DEPDIR)/go-matherr.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-matherr.c' object='go-matherr.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-matherr.lo `test -f 'runtime/go-matherr.c' || echo '$(srcdir)/'`runtime/go-matherr.c - -go-memcmp.lo: runtime/go-memcmp.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-memcmp.lo -MD -MP -MF $(DEPDIR)/go-memcmp.Tpo -c -o go-memcmp.lo `test -f 'runtime/go-memcmp.c' || echo '$(srcdir)/'`runtime/go-memcmp.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-memcmp.Tpo $(DEPDIR)/go-memcmp.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-memcmp.c' object='go-memcmp.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-memcmp.lo `test -f 'runtime/go-memcmp.c' || echo '$(srcdir)/'`runtime/go-memcmp.c - -go-nanotime.lo: runtime/go-nanotime.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-nanotime.lo -MD -MP -MF $(DEPDIR)/go-nanotime.Tpo -c -o go-nanotime.lo `test -f 'runtime/go-nanotime.c' || echo '$(srcdir)/'`runtime/go-nanotime.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-nanotime.Tpo $(DEPDIR)/go-nanotime.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-nanotime.c' object='go-nanotime.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-nanotime.lo `test -f 'runtime/go-nanotime.c' || echo '$(srcdir)/'`runtime/go-nanotime.c - -go-now.lo: runtime/go-now.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-now.lo -MD -MP -MF $(DEPDIR)/go-now.Tpo -c -o go-now.lo `test -f 'runtime/go-now.c' || echo '$(srcdir)/'`runtime/go-now.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-now.Tpo $(DEPDIR)/go-now.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-now.c' object='go-now.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-now.lo `test -f 'runtime/go-now.c' || echo '$(srcdir)/'`runtime/go-now.c - -go-new-map.lo: runtime/go-new-map.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-new-map.lo -MD -MP -MF $(DEPDIR)/go-new-map.Tpo -c -o go-new-map.lo `test -f 'runtime/go-new-map.c' || echo '$(srcdir)/'`runtime/go-new-map.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-new-map.Tpo $(DEPDIR)/go-new-map.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-new-map.c' object='go-new-map.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-new-map.lo `test -f 'runtime/go-new-map.c' || echo '$(srcdir)/'`runtime/go-new-map.c - -go-new.lo: runtime/go-new.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-new.lo -MD -MP -MF $(DEPDIR)/go-new.Tpo -c -o go-new.lo `test -f 'runtime/go-new.c' || echo '$(srcdir)/'`runtime/go-new.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-new.Tpo $(DEPDIR)/go-new.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-new.c' object='go-new.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-new.lo `test -f 'runtime/go-new.c' || echo '$(srcdir)/'`runtime/go-new.c - -go-nosys.lo: runtime/go-nosys.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-nosys.lo -MD -MP -MF $(DEPDIR)/go-nosys.Tpo -c -o go-nosys.lo `test -f 'runtime/go-nosys.c' || echo '$(srcdir)/'`runtime/go-nosys.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-nosys.Tpo $(DEPDIR)/go-nosys.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-nosys.c' object='go-nosys.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-nosys.lo `test -f 'runtime/go-nosys.c' || echo '$(srcdir)/'`runtime/go-nosys.c - -go-panic.lo: runtime/go-panic.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-panic.lo -MD -MP -MF $(DEPDIR)/go-panic.Tpo -c -o go-panic.lo `test -f 'runtime/go-panic.c' || echo '$(srcdir)/'`runtime/go-panic.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-panic.Tpo $(DEPDIR)/go-panic.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-panic.c' object='go-panic.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-panic.lo `test -f 'runtime/go-panic.c' || echo '$(srcdir)/'`runtime/go-panic.c - -go-print.lo: runtime/go-print.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-print.lo -MD -MP -MF $(DEPDIR)/go-print.Tpo -c -o go-print.lo `test -f 'runtime/go-print.c' || echo '$(srcdir)/'`runtime/go-print.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-print.Tpo $(DEPDIR)/go-print.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-print.c' object='go-print.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-print.lo `test -f 'runtime/go-print.c' || echo '$(srcdir)/'`runtime/go-print.c - -go-recover.lo: runtime/go-recover.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-recover.lo -MD -MP -MF $(DEPDIR)/go-recover.Tpo -c -o go-recover.lo `test -f 'runtime/go-recover.c' || echo '$(srcdir)/'`runtime/go-recover.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-recover.Tpo $(DEPDIR)/go-recover.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-recover.c' object='go-recover.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-recover.lo `test -f 'runtime/go-recover.c' || echo '$(srcdir)/'`runtime/go-recover.c - -go-reflect-call.lo: runtime/go-reflect-call.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-reflect-call.lo -MD -MP -MF $(DEPDIR)/go-reflect-call.Tpo -c -o go-reflect-call.lo `test -f 'runtime/go-reflect-call.c' || echo '$(srcdir)/'`runtime/go-reflect-call.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-reflect-call.Tpo $(DEPDIR)/go-reflect-call.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-reflect-call.c' object='go-reflect-call.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-reflect-call.lo `test -f 'runtime/go-reflect-call.c' || echo '$(srcdir)/'`runtime/go-reflect-call.c - -go-reflect-map.lo: runtime/go-reflect-map.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-reflect-map.lo -MD -MP -MF $(DEPDIR)/go-reflect-map.Tpo -c -o go-reflect-map.lo `test -f 'runtime/go-reflect-map.c' || echo '$(srcdir)/'`runtime/go-reflect-map.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-reflect-map.Tpo $(DEPDIR)/go-reflect-map.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-reflect-map.c' object='go-reflect-map.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-reflect-map.lo `test -f 'runtime/go-reflect-map.c' || echo '$(srcdir)/'`runtime/go-reflect-map.c - -go-rune.lo: runtime/go-rune.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-rune.lo -MD -MP -MF $(DEPDIR)/go-rune.Tpo -c -o go-rune.lo `test -f 'runtime/go-rune.c' || echo '$(srcdir)/'`runtime/go-rune.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-rune.Tpo $(DEPDIR)/go-rune.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-rune.c' object='go-rune.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-rune.lo `test -f 'runtime/go-rune.c' || echo '$(srcdir)/'`runtime/go-rune.c - -go-runtime-error.lo: runtime/go-runtime-error.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-runtime-error.lo -MD -MP -MF $(DEPDIR)/go-runtime-error.Tpo -c -o go-runtime-error.lo `test -f 'runtime/go-runtime-error.c' || echo '$(srcdir)/'`runtime/go-runtime-error.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-runtime-error.Tpo $(DEPDIR)/go-runtime-error.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-runtime-error.c' object='go-runtime-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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-runtime-error.lo `test -f 'runtime/go-runtime-error.c' || echo '$(srcdir)/'`runtime/go-runtime-error.c - -go-setenv.lo: runtime/go-setenv.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-setenv.lo -MD -MP -MF $(DEPDIR)/go-setenv.Tpo -c -o go-setenv.lo `test -f 'runtime/go-setenv.c' || echo '$(srcdir)/'`runtime/go-setenv.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-setenv.Tpo $(DEPDIR)/go-setenv.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-setenv.c' object='go-setenv.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-setenv.lo `test -f 'runtime/go-setenv.c' || echo '$(srcdir)/'`runtime/go-setenv.c - -go-signal.lo: runtime/go-signal.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-signal.lo -MD -MP -MF $(DEPDIR)/go-signal.Tpo -c -o go-signal.lo `test -f 'runtime/go-signal.c' || echo '$(srcdir)/'`runtime/go-signal.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-signal.Tpo $(DEPDIR)/go-signal.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-signal.c' object='go-signal.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-signal.lo `test -f 'runtime/go-signal.c' || echo '$(srcdir)/'`runtime/go-signal.c - -go-strcmp.lo: runtime/go-strcmp.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-strcmp.lo -MD -MP -MF $(DEPDIR)/go-strcmp.Tpo -c -o go-strcmp.lo `test -f 'runtime/go-strcmp.c' || echo '$(srcdir)/'`runtime/go-strcmp.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-strcmp.Tpo $(DEPDIR)/go-strcmp.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-strcmp.c' object='go-strcmp.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-strcmp.lo `test -f 'runtime/go-strcmp.c' || echo '$(srcdir)/'`runtime/go-strcmp.c - -go-string-to-byte-array.lo: runtime/go-string-to-byte-array.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-string-to-byte-array.lo -MD -MP -MF $(DEPDIR)/go-string-to-byte-array.Tpo -c -o go-string-to-byte-array.lo `test -f 'runtime/go-string-to-byte-array.c' || echo '$(srcdir)/'`runtime/go-string-to-byte-array.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-string-to-byte-array.Tpo $(DEPDIR)/go-string-to-byte-array.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-string-to-byte-array.c' object='go-string-to-byte-array.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-string-to-byte-array.lo `test -f 'runtime/go-string-to-byte-array.c' || echo '$(srcdir)/'`runtime/go-string-to-byte-array.c - -go-string-to-int-array.lo: runtime/go-string-to-int-array.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-string-to-int-array.lo -MD -MP -MF $(DEPDIR)/go-string-to-int-array.Tpo -c -o go-string-to-int-array.lo `test -f 'runtime/go-string-to-int-array.c' || echo '$(srcdir)/'`runtime/go-string-to-int-array.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-string-to-int-array.Tpo $(DEPDIR)/go-string-to-int-array.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-string-to-int-array.c' object='go-string-to-int-array.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-string-to-int-array.lo `test -f 'runtime/go-string-to-int-array.c' || echo '$(srcdir)/'`runtime/go-string-to-int-array.c - -go-strplus.lo: runtime/go-strplus.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-strplus.lo -MD -MP -MF $(DEPDIR)/go-strplus.Tpo -c -o go-strplus.lo `test -f 'runtime/go-strplus.c' || echo '$(srcdir)/'`runtime/go-strplus.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-strplus.Tpo $(DEPDIR)/go-strplus.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-strplus.c' object='go-strplus.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-strplus.lo `test -f 'runtime/go-strplus.c' || echo '$(srcdir)/'`runtime/go-strplus.c - -go-strslice.lo: runtime/go-strslice.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-strslice.lo -MD -MP -MF $(DEPDIR)/go-strslice.Tpo -c -o go-strslice.lo `test -f 'runtime/go-strslice.c' || echo '$(srcdir)/'`runtime/go-strslice.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-strslice.Tpo $(DEPDIR)/go-strslice.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-strslice.c' object='go-strslice.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-strslice.lo `test -f 'runtime/go-strslice.c' || echo '$(srcdir)/'`runtime/go-strslice.c - -go-traceback.lo: runtime/go-traceback.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-traceback.lo -MD -MP -MF $(DEPDIR)/go-traceback.Tpo -c -o go-traceback.lo `test -f 'runtime/go-traceback.c' || echo '$(srcdir)/'`runtime/go-traceback.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-traceback.Tpo $(DEPDIR)/go-traceback.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-traceback.c' object='go-traceback.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-traceback.lo `test -f 'runtime/go-traceback.c' || echo '$(srcdir)/'`runtime/go-traceback.c - -go-type-complex.lo: runtime/go-type-complex.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-complex.lo -MD -MP -MF $(DEPDIR)/go-type-complex.Tpo -c -o go-type-complex.lo `test -f 'runtime/go-type-complex.c' || echo '$(srcdir)/'`runtime/go-type-complex.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-complex.Tpo $(DEPDIR)/go-type-complex.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-complex.c' object='go-type-complex.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-complex.lo `test -f 'runtime/go-type-complex.c' || echo '$(srcdir)/'`runtime/go-type-complex.c - -go-type-eface.lo: runtime/go-type-eface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-eface.lo -MD -MP -MF $(DEPDIR)/go-type-eface.Tpo -c -o go-type-eface.lo `test -f 'runtime/go-type-eface.c' || echo '$(srcdir)/'`runtime/go-type-eface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-eface.Tpo $(DEPDIR)/go-type-eface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-eface.c' object='go-type-eface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-eface.lo `test -f 'runtime/go-type-eface.c' || echo '$(srcdir)/'`runtime/go-type-eface.c - -go-type-error.lo: runtime/go-type-error.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-error.lo -MD -MP -MF $(DEPDIR)/go-type-error.Tpo -c -o go-type-error.lo `test -f 'runtime/go-type-error.c' || echo '$(srcdir)/'`runtime/go-type-error.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-error.Tpo $(DEPDIR)/go-type-error.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-error.c' object='go-type-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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-error.lo `test -f 'runtime/go-type-error.c' || echo '$(srcdir)/'`runtime/go-type-error.c - -go-type-float.lo: runtime/go-type-float.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-float.lo -MD -MP -MF $(DEPDIR)/go-type-float.Tpo -c -o go-type-float.lo `test -f 'runtime/go-type-float.c' || echo '$(srcdir)/'`runtime/go-type-float.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-float.Tpo $(DEPDIR)/go-type-float.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-float.c' object='go-type-float.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-float.lo `test -f 'runtime/go-type-float.c' || echo '$(srcdir)/'`runtime/go-type-float.c - -go-type-identity.lo: runtime/go-type-identity.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-identity.lo -MD -MP -MF $(DEPDIR)/go-type-identity.Tpo -c -o go-type-identity.lo `test -f 'runtime/go-type-identity.c' || echo '$(srcdir)/'`runtime/go-type-identity.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-identity.Tpo $(DEPDIR)/go-type-identity.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-identity.c' object='go-type-identity.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-identity.lo `test -f 'runtime/go-type-identity.c' || echo '$(srcdir)/'`runtime/go-type-identity.c - -go-type-interface.lo: runtime/go-type-interface.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-interface.lo -MD -MP -MF $(DEPDIR)/go-type-interface.Tpo -c -o go-type-interface.lo `test -f 'runtime/go-type-interface.c' || echo '$(srcdir)/'`runtime/go-type-interface.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-interface.Tpo $(DEPDIR)/go-type-interface.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-interface.c' object='go-type-interface.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-interface.lo `test -f 'runtime/go-type-interface.c' || echo '$(srcdir)/'`runtime/go-type-interface.c - -go-type-string.lo: runtime/go-type-string.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-type-string.lo -MD -MP -MF $(DEPDIR)/go-type-string.Tpo -c -o go-type-string.lo `test -f 'runtime/go-type-string.c' || echo '$(srcdir)/'`runtime/go-type-string.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-type-string.Tpo $(DEPDIR)/go-type-string.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-type-string.c' object='go-type-string.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-type-string.lo `test -f 'runtime/go-type-string.c' || echo '$(srcdir)/'`runtime/go-type-string.c - -go-typedesc-equal.lo: runtime/go-typedesc-equal.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-typedesc-equal.lo -MD -MP -MF $(DEPDIR)/go-typedesc-equal.Tpo -c -o go-typedesc-equal.lo `test -f 'runtime/go-typedesc-equal.c' || echo '$(srcdir)/'`runtime/go-typedesc-equal.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-typedesc-equal.Tpo $(DEPDIR)/go-typedesc-equal.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-typedesc-equal.c' object='go-typedesc-equal.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-typedesc-equal.lo `test -f 'runtime/go-typedesc-equal.c' || echo '$(srcdir)/'`runtime/go-typedesc-equal.c - -go-unsafe-new.lo: runtime/go-unsafe-new.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsafe-new.lo -MD -MP -MF $(DEPDIR)/go-unsafe-new.Tpo -c -o go-unsafe-new.lo `test -f 'runtime/go-unsafe-new.c' || echo '$(srcdir)/'`runtime/go-unsafe-new.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsafe-new.Tpo $(DEPDIR)/go-unsafe-new.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-unsafe-new.c' object='go-unsafe-new.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unsafe-new.lo `test -f 'runtime/go-unsafe-new.c' || echo '$(srcdir)/'`runtime/go-unsafe-new.c - -go-unsafe-newarray.lo: runtime/go-unsafe-newarray.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsafe-newarray.lo -MD -MP -MF $(DEPDIR)/go-unsafe-newarray.Tpo -c -o go-unsafe-newarray.lo `test -f 'runtime/go-unsafe-newarray.c' || echo '$(srcdir)/'`runtime/go-unsafe-newarray.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsafe-newarray.Tpo $(DEPDIR)/go-unsafe-newarray.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-unsafe-newarray.c' object='go-unsafe-newarray.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unsafe-newarray.lo `test -f 'runtime/go-unsafe-newarray.c' || echo '$(srcdir)/'`runtime/go-unsafe-newarray.c - -go-unsafe-pointer.lo: runtime/go-unsafe-pointer.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsafe-pointer.lo -MD -MP -MF $(DEPDIR)/go-unsafe-pointer.Tpo -c -o go-unsafe-pointer.lo `test -f 'runtime/go-unsafe-pointer.c' || echo '$(srcdir)/'`runtime/go-unsafe-pointer.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsafe-pointer.Tpo $(DEPDIR)/go-unsafe-pointer.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-unsafe-pointer.c' object='go-unsafe-pointer.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unsafe-pointer.lo `test -f 'runtime/go-unsafe-pointer.c' || echo '$(srcdir)/'`runtime/go-unsafe-pointer.c - -go-unsetenv.lo: runtime/go-unsetenv.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unsetenv.lo -MD -MP -MF $(DEPDIR)/go-unsetenv.Tpo -c -o go-unsetenv.lo `test -f 'runtime/go-unsetenv.c' || echo '$(srcdir)/'`runtime/go-unsetenv.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unsetenv.Tpo $(DEPDIR)/go-unsetenv.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-unsetenv.c' object='go-unsetenv.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unsetenv.lo `test -f 'runtime/go-unsetenv.c' || echo '$(srcdir)/'`runtime/go-unsetenv.c - -go-unwind.lo: runtime/go-unwind.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-unwind.lo -MD -MP -MF $(DEPDIR)/go-unwind.Tpo -c -o go-unwind.lo `test -f 'runtime/go-unwind.c' || echo '$(srcdir)/'`runtime/go-unwind.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-unwind.Tpo $(DEPDIR)/go-unwind.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-unwind.c' object='go-unwind.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-unwind.lo `test -f 'runtime/go-unwind.c' || echo '$(srcdir)/'`runtime/go-unwind.c - -go-varargs.lo: runtime/go-varargs.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT go-varargs.lo -MD -MP -MF $(DEPDIR)/go-varargs.Tpo -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/go-varargs.Tpo $(DEPDIR)/go-varargs.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/go-varargs.c' object='go-varargs.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o go-varargs.lo `test -f 'runtime/go-varargs.c' || echo '$(srcdir)/'`runtime/go-varargs.c - -env_posix.lo: runtime/env_posix.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT env_posix.lo -MD -MP -MF $(DEPDIR)/env_posix.Tpo -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/env_posix.Tpo $(DEPDIR)/env_posix.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/env_posix.c' object='env_posix.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o env_posix.lo `test -f 'runtime/env_posix.c' || echo '$(srcdir)/'`runtime/env_posix.c - -heapdump.lo: runtime/heapdump.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT heapdump.lo -MD -MP -MF $(DEPDIR)/heapdump.Tpo -c -o heapdump.lo `test -f 'runtime/heapdump.c' || echo '$(srcdir)/'`runtime/heapdump.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/heapdump.Tpo $(DEPDIR)/heapdump.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/heapdump.c' object='heapdump.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o heapdump.lo `test -f 'runtime/heapdump.c' || echo '$(srcdir)/'`runtime/heapdump.c - -lock_sema.lo: runtime/lock_sema.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lock_sema.lo -MD -MP -MF $(DEPDIR)/lock_sema.Tpo -c -o lock_sema.lo `test -f 'runtime/lock_sema.c' || echo '$(srcdir)/'`runtime/lock_sema.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lock_sema.Tpo $(DEPDIR)/lock_sema.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/lock_sema.c' object='lock_sema.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lock_sema.lo `test -f 'runtime/lock_sema.c' || echo '$(srcdir)/'`runtime/lock_sema.c - -thread-sema.lo: runtime/thread-sema.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT thread-sema.lo -MD -MP -MF $(DEPDIR)/thread-sema.Tpo -c -o thread-sema.lo `test -f 'runtime/thread-sema.c' || echo '$(srcdir)/'`runtime/thread-sema.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/thread-sema.Tpo $(DEPDIR)/thread-sema.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/thread-sema.c' object='thread-sema.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o thread-sema.lo `test -f 'runtime/thread-sema.c' || echo '$(srcdir)/'`runtime/thread-sema.c - -lock_futex.lo: runtime/lock_futex.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lock_futex.lo -MD -MP -MF $(DEPDIR)/lock_futex.Tpo -c -o lock_futex.lo `test -f 'runtime/lock_futex.c' || echo '$(srcdir)/'`runtime/lock_futex.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lock_futex.Tpo $(DEPDIR)/lock_futex.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/lock_futex.c' object='lock_futex.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lock_futex.lo `test -f 'runtime/lock_futex.c' || echo '$(srcdir)/'`runtime/lock_futex.c - -thread-linux.lo: runtime/thread-linux.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT thread-linux.lo -MD -MP -MF $(DEPDIR)/thread-linux.Tpo -c -o thread-linux.lo `test -f 'runtime/thread-linux.c' || echo '$(srcdir)/'`runtime/thread-linux.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/thread-linux.Tpo $(DEPDIR)/thread-linux.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/thread-linux.c' object='thread-linux.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o thread-linux.lo `test -f 'runtime/thread-linux.c' || echo '$(srcdir)/'`runtime/thread-linux.c - -mcache.lo: runtime/mcache.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mcache.lo -MD -MP -MF $(DEPDIR)/mcache.Tpo -c -o mcache.lo `test -f 'runtime/mcache.c' || echo '$(srcdir)/'`runtime/mcache.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mcache.Tpo $(DEPDIR)/mcache.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mcache.c' object='mcache.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mcache.lo `test -f 'runtime/mcache.c' || echo '$(srcdir)/'`runtime/mcache.c - -mcentral.lo: runtime/mcentral.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mcentral.lo -MD -MP -MF $(DEPDIR)/mcentral.Tpo -c -o mcentral.lo `test -f 'runtime/mcentral.c' || echo '$(srcdir)/'`runtime/mcentral.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mcentral.Tpo $(DEPDIR)/mcentral.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mcentral.c' object='mcentral.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mcentral.lo `test -f 'runtime/mcentral.c' || echo '$(srcdir)/'`runtime/mcentral.c - -mem_posix_memalign.lo: runtime/mem_posix_memalign.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mem_posix_memalign.lo -MD -MP -MF $(DEPDIR)/mem_posix_memalign.Tpo -c -o mem_posix_memalign.lo `test -f 'runtime/mem_posix_memalign.c' || echo '$(srcdir)/'`runtime/mem_posix_memalign.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mem_posix_memalign.Tpo $(DEPDIR)/mem_posix_memalign.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mem_posix_memalign.c' object='mem_posix_memalign.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mem_posix_memalign.lo `test -f 'runtime/mem_posix_memalign.c' || echo '$(srcdir)/'`runtime/mem_posix_memalign.c - -mem.lo: runtime/mem.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mem.lo -MD -MP -MF $(DEPDIR)/mem.Tpo -c -o mem.lo `test -f 'runtime/mem.c' || echo '$(srcdir)/'`runtime/mem.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mem.Tpo $(DEPDIR)/mem.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mem.c' object='mem.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mem.lo `test -f 'runtime/mem.c' || echo '$(srcdir)/'`runtime/mem.c - -mfixalloc.lo: runtime/mfixalloc.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mfixalloc.lo -MD -MP -MF $(DEPDIR)/mfixalloc.Tpo -c -o mfixalloc.lo `test -f 'runtime/mfixalloc.c' || echo '$(srcdir)/'`runtime/mfixalloc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mfixalloc.Tpo $(DEPDIR)/mfixalloc.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mfixalloc.c' object='mfixalloc.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mfixalloc.lo `test -f 'runtime/mfixalloc.c' || echo '$(srcdir)/'`runtime/mfixalloc.c - -mgc0.lo: runtime/mgc0.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mgc0.lo -MD -MP -MF $(DEPDIR)/mgc0.Tpo -c -o mgc0.lo `test -f 'runtime/mgc0.c' || echo '$(srcdir)/'`runtime/mgc0.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mgc0.Tpo $(DEPDIR)/mgc0.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mgc0.c' object='mgc0.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mgc0.lo `test -f 'runtime/mgc0.c' || echo '$(srcdir)/'`runtime/mgc0.c - -mheap.lo: runtime/mheap.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mheap.lo -MD -MP -MF $(DEPDIR)/mheap.Tpo -c -o mheap.lo `test -f 'runtime/mheap.c' || echo '$(srcdir)/'`runtime/mheap.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mheap.Tpo $(DEPDIR)/mheap.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/mheap.c' object='mheap.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mheap.lo `test -f 'runtime/mheap.c' || echo '$(srcdir)/'`runtime/mheap.c - -msize.lo: runtime/msize.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT msize.lo -MD -MP -MF $(DEPDIR)/msize.Tpo -c -o msize.lo `test -f 'runtime/msize.c' || echo '$(srcdir)/'`runtime/msize.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/msize.Tpo $(DEPDIR)/msize.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/msize.c' object='msize.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o msize.lo `test -f 'runtime/msize.c' || echo '$(srcdir)/'`runtime/msize.c - -netpoll_kqueue.lo: runtime/netpoll_kqueue.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netpoll_kqueue.lo -MD -MP -MF $(DEPDIR)/netpoll_kqueue.Tpo -c -o netpoll_kqueue.lo `test -f 'runtime/netpoll_kqueue.c' || echo '$(srcdir)/'`runtime/netpoll_kqueue.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/netpoll_kqueue.Tpo $(DEPDIR)/netpoll_kqueue.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/netpoll_kqueue.c' object='netpoll_kqueue.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netpoll_kqueue.lo `test -f 'runtime/netpoll_kqueue.c' || echo '$(srcdir)/'`runtime/netpoll_kqueue.c - -netpoll_select.lo: runtime/netpoll_select.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netpoll_select.lo -MD -MP -MF $(DEPDIR)/netpoll_select.Tpo -c -o netpoll_select.lo `test -f 'runtime/netpoll_select.c' || echo '$(srcdir)/'`runtime/netpoll_select.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/netpoll_select.Tpo $(DEPDIR)/netpoll_select.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/netpoll_select.c' object='netpoll_select.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netpoll_select.lo `test -f 'runtime/netpoll_select.c' || echo '$(srcdir)/'`runtime/netpoll_select.c - -netpoll_epoll.lo: runtime/netpoll_epoll.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netpoll_epoll.lo -MD -MP -MF $(DEPDIR)/netpoll_epoll.Tpo -c -o netpoll_epoll.lo `test -f 'runtime/netpoll_epoll.c' || echo '$(srcdir)/'`runtime/netpoll_epoll.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/netpoll_epoll.Tpo $(DEPDIR)/netpoll_epoll.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/netpoll_epoll.c' object='netpoll_epoll.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netpoll_epoll.lo `test -f 'runtime/netpoll_epoll.c' || echo '$(srcdir)/'`runtime/netpoll_epoll.c - -panic.lo: runtime/panic.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT panic.lo -MD -MP -MF $(DEPDIR)/panic.Tpo -c -o panic.lo `test -f 'runtime/panic.c' || echo '$(srcdir)/'`runtime/panic.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/panic.Tpo $(DEPDIR)/panic.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/panic.c' object='panic.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o panic.lo `test -f 'runtime/panic.c' || echo '$(srcdir)/'`runtime/panic.c - -parfor.lo: runtime/parfor.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT parfor.lo -MD -MP -MF $(DEPDIR)/parfor.Tpo -c -o parfor.lo `test -f 'runtime/parfor.c' || echo '$(srcdir)/'`runtime/parfor.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/parfor.Tpo $(DEPDIR)/parfor.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/parfor.c' object='parfor.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o parfor.lo `test -f 'runtime/parfor.c' || echo '$(srcdir)/'`runtime/parfor.c - -print.lo: runtime/print.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT print.lo -MD -MP -MF $(DEPDIR)/print.Tpo -c -o print.lo `test -f 'runtime/print.c' || echo '$(srcdir)/'`runtime/print.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/print.Tpo $(DEPDIR)/print.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/print.c' object='print.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o print.lo `test -f 'runtime/print.c' || echo '$(srcdir)/'`runtime/print.c - -proc.lo: runtime/proc.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT proc.lo -MD -MP -MF $(DEPDIR)/proc.Tpo -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/proc.Tpo $(DEPDIR)/proc.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/proc.c' object='proc.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o proc.lo `test -f 'runtime/proc.c' || echo '$(srcdir)/'`runtime/proc.c - -runtime.lo: runtime/runtime.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT runtime.lo -MD -MP -MF $(DEPDIR)/runtime.Tpo -c -o runtime.lo `test -f 'runtime/runtime.c' || echo '$(srcdir)/'`runtime/runtime.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/runtime.Tpo $(DEPDIR)/runtime.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/runtime.c' object='runtime.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o runtime.lo `test -f 'runtime/runtime.c' || echo '$(srcdir)/'`runtime/runtime.c - -signal_unix.lo: runtime/signal_unix.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT signal_unix.lo -MD -MP -MF $(DEPDIR)/signal_unix.Tpo -c -o signal_unix.lo `test -f 'runtime/signal_unix.c' || echo '$(srcdir)/'`runtime/signal_unix.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/signal_unix.Tpo $(DEPDIR)/signal_unix.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/signal_unix.c' object='signal_unix.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o signal_unix.lo `test -f 'runtime/signal_unix.c' || echo '$(srcdir)/'`runtime/signal_unix.c - -thread.lo: runtime/thread.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT thread.lo -MD -MP -MF $(DEPDIR)/thread.Tpo -c -o thread.lo `test -f 'runtime/thread.c' || echo '$(srcdir)/'`runtime/thread.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/thread.Tpo $(DEPDIR)/thread.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/thread.c' object='thread.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o thread.lo `test -f 'runtime/thread.c' || echo '$(srcdir)/'`runtime/thread.c - -yield.lo: runtime/yield.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT yield.lo -MD -MP -MF $(DEPDIR)/yield.Tpo -c -o yield.lo `test -f 'runtime/yield.c' || echo '$(srcdir)/'`runtime/yield.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/yield.Tpo $(DEPDIR)/yield.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/yield.c' object='yield.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o yield.lo `test -f 'runtime/yield.c' || echo '$(srcdir)/'`runtime/yield.c - -rtems-task-variable-add.lo: runtime/rtems-task-variable-add.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rtems-task-variable-add.lo -MD -MP -MF $(DEPDIR)/rtems-task-variable-add.Tpo -c -o rtems-task-variable-add.lo `test -f 'runtime/rtems-task-variable-add.c' || echo '$(srcdir)/'`runtime/rtems-task-variable-add.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/rtems-task-variable-add.Tpo $(DEPDIR)/rtems-task-variable-add.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/rtems-task-variable-add.c' object='rtems-task-variable-add.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rtems-task-variable-add.lo `test -f 'runtime/rtems-task-variable-add.c' || echo '$(srcdir)/'`runtime/rtems-task-variable-add.c - -getncpu-none.lo: runtime/getncpu-none.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-none.lo -MD -MP -MF $(DEPDIR)/getncpu-none.Tpo -c -o getncpu-none.lo `test -f 'runtime/getncpu-none.c' || echo '$(srcdir)/'`runtime/getncpu-none.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-none.Tpo $(DEPDIR)/getncpu-none.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-none.c' object='getncpu-none.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-none.lo `test -f 'runtime/getncpu-none.c' || echo '$(srcdir)/'`runtime/getncpu-none.c - -getncpu-bsd.lo: runtime/getncpu-bsd.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-bsd.lo -MD -MP -MF $(DEPDIR)/getncpu-bsd.Tpo -c -o getncpu-bsd.lo `test -f 'runtime/getncpu-bsd.c' || echo '$(srcdir)/'`runtime/getncpu-bsd.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-bsd.Tpo $(DEPDIR)/getncpu-bsd.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-bsd.c' object='getncpu-bsd.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-bsd.lo `test -f 'runtime/getncpu-bsd.c' || echo '$(srcdir)/'`runtime/getncpu-bsd.c - -getncpu-solaris.lo: runtime/getncpu-solaris.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-solaris.lo -MD -MP -MF $(DEPDIR)/getncpu-solaris.Tpo -c -o getncpu-solaris.lo `test -f 'runtime/getncpu-solaris.c' || echo '$(srcdir)/'`runtime/getncpu-solaris.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-solaris.Tpo $(DEPDIR)/getncpu-solaris.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-solaris.c' object='getncpu-solaris.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-solaris.lo `test -f 'runtime/getncpu-solaris.c' || echo '$(srcdir)/'`runtime/getncpu-solaris.c - -getncpu-irix.lo: runtime/getncpu-irix.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-irix.lo -MD -MP -MF $(DEPDIR)/getncpu-irix.Tpo -c -o getncpu-irix.lo `test -f 'runtime/getncpu-irix.c' || echo '$(srcdir)/'`runtime/getncpu-irix.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-irix.Tpo $(DEPDIR)/getncpu-irix.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-irix.c' object='getncpu-irix.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-irix.lo `test -f 'runtime/getncpu-irix.c' || echo '$(srcdir)/'`runtime/getncpu-irix.c - -getncpu-linux.lo: runtime/getncpu-linux.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT getncpu-linux.lo -MD -MP -MF $(DEPDIR)/getncpu-linux.Tpo -c -o getncpu-linux.lo `test -f 'runtime/getncpu-linux.c' || echo '$(srcdir)/'`runtime/getncpu-linux.c -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/getncpu-linux.Tpo $(DEPDIR)/getncpu-linux.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runtime/getncpu-linux.c' object='getncpu-linux.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o getncpu-linux.lo `test -f 'runtime/getncpu-linux.c' || echo '$(srcdir)/'`runtime/getncpu-linux.c - -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-toolexeclibgoDATA: $(toolexeclibgo_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgo_DATA)'; test -n "$(toolexeclibgodir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgodir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgodir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgodir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgodir)" || exit $$?; \ - done - -uninstall-toolexeclibgoDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgo_DATA)'; test -n "$(toolexeclibgodir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgodir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoarchiveDATA: $(toolexeclibgoarchive_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoarchive_DATA)'; test -n "$(toolexeclibgoarchivedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoarchivedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoarchivedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoarchivedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoarchivedir)" || exit $$?; \ - done - -uninstall-toolexeclibgoarchiveDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoarchive_DATA)'; test -n "$(toolexeclibgoarchivedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoarchivedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgocompressDATA: $(toolexeclibgocompress_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgocompress_DATA)'; test -n "$(toolexeclibgocompressdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgocompressdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgocompressdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgocompressdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgocompressdir)" || exit $$?; \ - done - -uninstall-toolexeclibgocompressDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgocompress_DATA)'; test -n "$(toolexeclibgocompressdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgocompressdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgocontainerDATA: $(toolexeclibgocontainer_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgocontainer_DATA)'; test -n "$(toolexeclibgocontainerdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgocontainerdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgocontainerdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgocontainerdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgocontainerdir)" || exit $$?; \ - done - -uninstall-toolexeclibgocontainerDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgocontainer_DATA)'; test -n "$(toolexeclibgocontainerdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgocontainerdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgocryptoDATA: $(toolexeclibgocrypto_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgocrypto_DATA)'; test -n "$(toolexeclibgocryptodir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgocryptodir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgocryptodir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgocryptodir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgocryptodir)" || exit $$?; \ - done - -uninstall-toolexeclibgocryptoDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgocrypto_DATA)'; test -n "$(toolexeclibgocryptodir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgocryptodir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgocryptox509DATA: $(toolexeclibgocryptox509_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgocryptox509_DATA)'; test -n "$(toolexeclibgocryptox509dir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgocryptox509dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgocryptox509dir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgocryptox509dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgocryptox509dir)" || exit $$?; \ - done - -uninstall-toolexeclibgocryptox509DATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgocryptox509_DATA)'; test -n "$(toolexeclibgocryptox509dir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgocryptox509dir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgodatabaseDATA: $(toolexeclibgodatabase_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgodatabase_DATA)'; test -n "$(toolexeclibgodatabasedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgodatabasedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgodatabasedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgodatabasedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgodatabasedir)" || exit $$?; \ - done - -uninstall-toolexeclibgodatabaseDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgodatabase_DATA)'; test -n "$(toolexeclibgodatabasedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgodatabasedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgodatabasesqlDATA: $(toolexeclibgodatabasesql_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgodatabasesql_DATA)'; test -n "$(toolexeclibgodatabasesqldir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgodatabasesqldir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgodatabasesqldir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgodatabasesqldir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgodatabasesqldir)" || exit $$?; \ - done - -uninstall-toolexeclibgodatabasesqlDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgodatabasesql_DATA)'; test -n "$(toolexeclibgodatabasesqldir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgodatabasesqldir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgodebugDATA: $(toolexeclibgodebug_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgodebug_DATA)'; test -n "$(toolexeclibgodebugdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgodebugdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgodebugdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgodebugdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgodebugdir)" || exit $$?; \ - done - -uninstall-toolexeclibgodebugDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgodebug_DATA)'; test -n "$(toolexeclibgodebugdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgodebugdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoencodingDATA: $(toolexeclibgoencoding_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoencoding_DATA)'; test -n "$(toolexeclibgoencodingdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoencodingdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoencodingdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoencodingdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoencodingdir)" || exit $$?; \ - done - -uninstall-toolexeclibgoencodingDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoencoding_DATA)'; test -n "$(toolexeclibgoencodingdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoencodingdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoexpDATA: $(toolexeclibgoexp_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoexp_DATA)'; test -n "$(toolexeclibgoexpdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoexpdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoexpdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoexpdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoexpdir)" || exit $$?; \ - done - -uninstall-toolexeclibgoexpDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoexp_DATA)'; test -n "$(toolexeclibgoexpdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoexpdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgogoDATA: $(toolexeclibgogo_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgogo_DATA)'; test -n "$(toolexeclibgogodir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgogodir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgogodir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgogodir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgogodir)" || exit $$?; \ - done - -uninstall-toolexeclibgogoDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgogo_DATA)'; test -n "$(toolexeclibgogodir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgogodir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgohashDATA: $(toolexeclibgohash_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgohash_DATA)'; test -n "$(toolexeclibgohashdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgohashdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgohashdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgohashdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgohashdir)" || exit $$?; \ - done - -uninstall-toolexeclibgohashDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgohash_DATA)'; test -n "$(toolexeclibgohashdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgohashdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgohtmlDATA: $(toolexeclibgohtml_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgohtml_DATA)'; test -n "$(toolexeclibgohtmldir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgohtmldir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgohtmldir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgohtmldir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgohtmldir)" || exit $$?; \ - done - -uninstall-toolexeclibgohtmlDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgohtml_DATA)'; test -n "$(toolexeclibgohtmldir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgohtmldir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoimageDATA: $(toolexeclibgoimage_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoimage_DATA)'; test -n "$(toolexeclibgoimagedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoimagedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoimagedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoimagedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoimagedir)" || exit $$?; \ - done - -uninstall-toolexeclibgoimageDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoimage_DATA)'; test -n "$(toolexeclibgoimagedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoimagedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoimagecolorDATA: $(toolexeclibgoimagecolor_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoimagecolor_DATA)'; test -n "$(toolexeclibgoimagecolordir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoimagecolordir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoimagecolordir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoimagecolordir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoimagecolordir)" || exit $$?; \ - done - -uninstall-toolexeclibgoimagecolorDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoimagecolor_DATA)'; test -n "$(toolexeclibgoimagecolordir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoimagecolordir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoindexDATA: $(toolexeclibgoindex_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoindex_DATA)'; test -n "$(toolexeclibgoindexdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoindexdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoindexdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoindexdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoindexdir)" || exit $$?; \ - done - -uninstall-toolexeclibgoindexDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoindex_DATA)'; test -n "$(toolexeclibgoindexdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoindexdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoioDATA: $(toolexeclibgoio_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoio_DATA)'; test -n "$(toolexeclibgoiodir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoiodir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoiodir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoiodir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoiodir)" || exit $$?; \ - done - -uninstall-toolexeclibgoioDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoio_DATA)'; test -n "$(toolexeclibgoiodir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoiodir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgologDATA: $(toolexeclibgolog_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgolog_DATA)'; test -n "$(toolexeclibgologdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgologdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgologdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgologdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgologdir)" || exit $$?; \ - done - -uninstall-toolexeclibgologDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgolog_DATA)'; test -n "$(toolexeclibgologdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgologdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgomathDATA: $(toolexeclibgomath_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgomath_DATA)'; test -n "$(toolexeclibgomathdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgomathdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgomathdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgomathdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgomathdir)" || exit $$?; \ - done - -uninstall-toolexeclibgomathDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgomath_DATA)'; test -n "$(toolexeclibgomathdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgomathdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgomimeDATA: $(toolexeclibgomime_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgomime_DATA)'; test -n "$(toolexeclibgomimedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgomimedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgomimedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgomimedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgomimedir)" || exit $$?; \ - done - -uninstall-toolexeclibgomimeDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgomime_DATA)'; test -n "$(toolexeclibgomimedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgomimedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgonetDATA: $(toolexeclibgonet_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgonet_DATA)'; test -n "$(toolexeclibgonetdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgonetdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgonetdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgonetdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgonetdir)" || exit $$?; \ - done - -uninstall-toolexeclibgonetDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgonet_DATA)'; test -n "$(toolexeclibgonetdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgonetdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgonethttpDATA: $(toolexeclibgonethttp_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgonethttp_DATA)'; test -n "$(toolexeclibgonethttpdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgonethttpdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgonethttpdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgonethttpdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgonethttpdir)" || exit $$?; \ - done - -uninstall-toolexeclibgonethttpDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgonethttp_DATA)'; test -n "$(toolexeclibgonethttpdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgonethttpdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgonetrpcDATA: $(toolexeclibgonetrpc_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgonetrpc_DATA)'; test -n "$(toolexeclibgonetrpcdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgonetrpcdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgonetrpcdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgonetrpcdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgonetrpcdir)" || exit $$?; \ - done - -uninstall-toolexeclibgonetrpcDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgonetrpc_DATA)'; test -n "$(toolexeclibgonetrpcdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgonetrpcdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgooldDATA: $(toolexeclibgoold_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoold_DATA)'; test -n "$(toolexeclibgoolddir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoolddir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoolddir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoolddir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoolddir)" || exit $$?; \ - done - -uninstall-toolexeclibgooldDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoold_DATA)'; test -n "$(toolexeclibgoolddir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoolddir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoosDATA: $(toolexeclibgoos_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoos_DATA)'; test -n "$(toolexeclibgoosdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoosdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoosdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoosdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoosdir)" || exit $$?; \ - done - -uninstall-toolexeclibgoosDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoos_DATA)'; test -n "$(toolexeclibgoosdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoosdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgopathDATA: $(toolexeclibgopath_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgopath_DATA)'; test -n "$(toolexeclibgopathdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgopathdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgopathdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgopathdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgopathdir)" || exit $$?; \ - done - -uninstall-toolexeclibgopathDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgopath_DATA)'; test -n "$(toolexeclibgopathdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgopathdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoregexpDATA: $(toolexeclibgoregexp_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoregexp_DATA)'; test -n "$(toolexeclibgoregexpdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoregexpdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoregexpdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoregexpdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoregexpdir)" || exit $$?; \ - done - -uninstall-toolexeclibgoregexpDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoregexp_DATA)'; test -n "$(toolexeclibgoregexpdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoregexpdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgoruntimeDATA: $(toolexeclibgoruntime_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgoruntime_DATA)'; test -n "$(toolexeclibgoruntimedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgoruntimedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgoruntimedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgoruntimedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgoruntimedir)" || exit $$?; \ - done - -uninstall-toolexeclibgoruntimeDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgoruntime_DATA)'; test -n "$(toolexeclibgoruntimedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgoruntimedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgosyncDATA: $(toolexeclibgosync_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgosync_DATA)'; test -n "$(toolexeclibgosyncdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgosyncdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgosyncdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgosyncdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgosyncdir)" || exit $$?; \ - done - -uninstall-toolexeclibgosyncDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgosync_DATA)'; test -n "$(toolexeclibgosyncdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgosyncdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgotestingDATA: $(toolexeclibgotesting_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgotesting_DATA)'; test -n "$(toolexeclibgotestingdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgotestingdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgotestingdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgotestingdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgotestingdir)" || exit $$?; \ - done - -uninstall-toolexeclibgotestingDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgotesting_DATA)'; test -n "$(toolexeclibgotestingdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgotestingdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgotextDATA: $(toolexeclibgotext_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgotext_DATA)'; test -n "$(toolexeclibgotextdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgotextdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgotextdir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgotextdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgotextdir)" || exit $$?; \ - done - -uninstall-toolexeclibgotextDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgotext_DATA)'; test -n "$(toolexeclibgotextdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgotextdir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgotexttemplateDATA: $(toolexeclibgotexttemplate_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgotexttemplate_DATA)'; test -n "$(toolexeclibgotexttemplatedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgotexttemplatedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgotexttemplatedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgotexttemplatedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgotexttemplatedir)" || exit $$?; \ - done - -uninstall-toolexeclibgotexttemplateDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgotexttemplate_DATA)'; test -n "$(toolexeclibgotexttemplatedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgotexttemplatedir)'; $(am__uninstall_files_from_dir) -install-toolexeclibgounicodeDATA: $(toolexeclibgounicode_DATA) - @$(NORMAL_INSTALL) - @list='$(toolexeclibgounicode_DATA)'; test -n "$(toolexeclibgounicodedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibgounicodedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(toolexeclibgounicodedir)" || exit 1; \ - fi; \ - 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_DATA) $$files '$(DESTDIR)$(toolexeclibgounicodedir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibgounicodedir)" || exit $$?; \ - done - -uninstall-toolexeclibgounicodeDATA: - @$(NORMAL_UNINSTALL) - @list='$(toolexeclibgounicode_DATA)'; test -n "$(toolexeclibgounicodedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(toolexeclibgounicodedir)'; $(am__uninstall_files_from_dir) - -# 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) config.h.in $(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) config.h.in $(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) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) config.h.in $(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 $(LIBRARIES) $(LTLIBRARIES) all-multi $(DATA) \ - config.h -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(toolexeclibgodir)" "$(DESTDIR)$(toolexeclibgoarchivedir)" "$(DESTDIR)$(toolexeclibgocompressdir)" "$(DESTDIR)$(toolexeclibgocontainerdir)" "$(DESTDIR)$(toolexeclibgocryptodir)" "$(DESTDIR)$(toolexeclibgocryptox509dir)" "$(DESTDIR)$(toolexeclibgodatabasedir)" "$(DESTDIR)$(toolexeclibgodatabasesqldir)" "$(DESTDIR)$(toolexeclibgodebugdir)" "$(DESTDIR)$(toolexeclibgoencodingdir)" "$(DESTDIR)$(toolexeclibgoexpdir)" "$(DESTDIR)$(toolexeclibgogodir)" "$(DESTDIR)$(toolexeclibgohashdir)" "$(DESTDIR)$(toolexeclibgohtmldir)" "$(DESTDIR)$(toolexeclibgoimagedir)" "$(DESTDIR)$(toolexeclibgoimagecolordir)" "$(DESTDIR)$(toolexeclibgoindexdir)" "$(DESTDIR)$(toolexeclibgoiodir)" "$(DESTDIR)$(toolexeclibgologdir)" "$(DESTDIR)$(toolexeclibgomathdir)" "$(DESTDIR)$(toolexeclibgomimedir)" "$(DESTDIR)$(toolexeclibgonetdir)" "$(DESTDIR)$(toolexeclibgonethttpdir)" "$(DESTDIR)$(toolexeclibgonetrpcdir)" "$(DESTDIR)$(toolexeclibgoolddir)" "$(DESTDIR)$(toolexeclibgoosdir)" "$(DESTDIR)$(toolexeclibgopathdir)" "$(DESTDIR)$(toolexeclibgoregexpdir)" "$(DESTDIR)$(toolexeclibgoruntimedir)" "$(DESTDIR)$(toolexeclibgosyncdir)" "$(DESTDIR)$(toolexeclibgotestingdir)" "$(DESTDIR)$(toolexeclibgotextdir)" "$(DESTDIR)$(toolexeclibgotexttemplatedir)" "$(DESTDIR)$(toolexeclibgounicodedir)"; 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: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -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-local \ - clean-toolexeclibLIBRARIES 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-hdr distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-multi install-toolexeclibLIBRARIES \ - install-toolexeclibLTLIBRARIES install-toolexeclibgoDATA \ - install-toolexeclibgoarchiveDATA \ - install-toolexeclibgocompressDATA \ - install-toolexeclibgocontainerDATA \ - install-toolexeclibgocryptoDATA \ - install-toolexeclibgocryptox509DATA \ - install-toolexeclibgodatabaseDATA \ - install-toolexeclibgodatabasesqlDATA \ - install-toolexeclibgodebugDATA \ - install-toolexeclibgoencodingDATA install-toolexeclibgoexpDATA \ - install-toolexeclibgogoDATA install-toolexeclibgohashDATA \ - install-toolexeclibgohtmlDATA install-toolexeclibgoimageDATA \ - install-toolexeclibgoimagecolorDATA \ - install-toolexeclibgoindexDATA install-toolexeclibgoioDATA \ - install-toolexeclibgologDATA install-toolexeclibgomathDATA \ - install-toolexeclibgomimeDATA install-toolexeclibgonetDATA \ - install-toolexeclibgonethttpDATA \ - install-toolexeclibgonetrpcDATA install-toolexeclibgooldDATA \ - install-toolexeclibgoosDATA install-toolexeclibgopathDATA \ - install-toolexeclibgoregexpDATA \ - install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \ - install-toolexeclibgotestingDATA install-toolexeclibgotextDATA \ - install-toolexeclibgotexttemplateDATA \ - install-toolexeclibgounicodeDATA - -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 mostlyclean-local - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-toolexeclibLIBRARIES \ - uninstall-toolexeclibLTLIBRARIES uninstall-toolexeclibgoDATA \ - uninstall-toolexeclibgoarchiveDATA \ - uninstall-toolexeclibgocompressDATA \ - uninstall-toolexeclibgocontainerDATA \ - uninstall-toolexeclibgocryptoDATA \ - uninstall-toolexeclibgocryptox509DATA \ - uninstall-toolexeclibgodatabaseDATA \ - uninstall-toolexeclibgodatabasesqlDATA \ - uninstall-toolexeclibgodebugDATA \ - uninstall-toolexeclibgoencodingDATA \ - uninstall-toolexeclibgoexpDATA uninstall-toolexeclibgogoDATA \ - uninstall-toolexeclibgohashDATA \ - uninstall-toolexeclibgohtmlDATA \ - uninstall-toolexeclibgoimageDATA \ - uninstall-toolexeclibgoimagecolorDATA \ - uninstall-toolexeclibgoindexDATA uninstall-toolexeclibgoioDATA \ - uninstall-toolexeclibgologDATA uninstall-toolexeclibgomathDATA \ - uninstall-toolexeclibgomimeDATA uninstall-toolexeclibgonetDATA \ - uninstall-toolexeclibgonethttpDATA \ - uninstall-toolexeclibgonetrpcDATA \ - uninstall-toolexeclibgooldDATA uninstall-toolexeclibgoosDATA \ - uninstall-toolexeclibgopathDATA \ - uninstall-toolexeclibgoregexpDATA \ - uninstall-toolexeclibgoruntimeDATA \ - uninstall-toolexeclibgosyncDATA \ - uninstall-toolexeclibgotestingDATA \ - uninstall-toolexeclibgotextDATA \ - uninstall-toolexeclibgotexttemplateDATA \ - uninstall-toolexeclibgounicodeDATA - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all 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-multi am--refresh check check-am clean \ - clean-generic clean-libtool clean-local clean-multi \ - clean-toolexeclibLIBRARIES clean-toolexeclibLTLIBRARIES ctags \ - ctags-recursive distclean distclean-compile distclean-generic \ - distclean-hdr 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-ps install-ps-am \ - install-strip install-toolexeclibLIBRARIES \ - install-toolexeclibLTLIBRARIES install-toolexeclibgoDATA \ - install-toolexeclibgoarchiveDATA \ - install-toolexeclibgocompressDATA \ - install-toolexeclibgocontainerDATA \ - install-toolexeclibgocryptoDATA \ - install-toolexeclibgocryptox509DATA \ - install-toolexeclibgodatabaseDATA \ - install-toolexeclibgodatabasesqlDATA \ - install-toolexeclibgodebugDATA \ - install-toolexeclibgoencodingDATA install-toolexeclibgoexpDATA \ - install-toolexeclibgogoDATA install-toolexeclibgohashDATA \ - install-toolexeclibgohtmlDATA install-toolexeclibgoimageDATA \ - install-toolexeclibgoimagecolorDATA \ - install-toolexeclibgoindexDATA install-toolexeclibgoioDATA \ - install-toolexeclibgologDATA install-toolexeclibgomathDATA \ - install-toolexeclibgomimeDATA install-toolexeclibgonetDATA \ - install-toolexeclibgonethttpDATA \ - install-toolexeclibgonetrpcDATA install-toolexeclibgooldDATA \ - install-toolexeclibgoosDATA install-toolexeclibgopathDATA \ - install-toolexeclibgoregexpDATA \ - install-toolexeclibgoruntimeDATA install-toolexeclibgosyncDATA \ - install-toolexeclibgotestingDATA install-toolexeclibgotextDATA \ - install-toolexeclibgotexttemplateDATA \ - install-toolexeclibgounicodeDATA installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic maintainer-clean-multi mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - mostlyclean-local mostlyclean-multi pdf pdf-am ps ps-am tags \ - tags-recursive uninstall uninstall-am \ - uninstall-toolexeclibLIBRARIES \ - uninstall-toolexeclibLTLIBRARIES uninstall-toolexeclibgoDATA \ - uninstall-toolexeclibgoarchiveDATA \ - uninstall-toolexeclibgocompressDATA \ - uninstall-toolexeclibgocontainerDATA \ - uninstall-toolexeclibgocryptoDATA \ - uninstall-toolexeclibgocryptox509DATA \ - uninstall-toolexeclibgodatabaseDATA \ - uninstall-toolexeclibgodatabasesqlDATA \ - uninstall-toolexeclibgodebugDATA \ - uninstall-toolexeclibgoencodingDATA \ - uninstall-toolexeclibgoexpDATA uninstall-toolexeclibgogoDATA \ - uninstall-toolexeclibgohashDATA \ - uninstall-toolexeclibgohtmlDATA \ - uninstall-toolexeclibgoimageDATA \ - uninstall-toolexeclibgoimagecolorDATA \ - uninstall-toolexeclibgoindexDATA uninstall-toolexeclibgoioDATA \ - uninstall-toolexeclibgologDATA uninstall-toolexeclibgomathDATA \ - uninstall-toolexeclibgomimeDATA uninstall-toolexeclibgonetDATA \ - uninstall-toolexeclibgonethttpDATA \ - uninstall-toolexeclibgonetrpcDATA \ - uninstall-toolexeclibgooldDATA uninstall-toolexeclibgoosDATA \ - uninstall-toolexeclibgopathDATA \ - uninstall-toolexeclibgoregexpDATA \ - uninstall-toolexeclibgoruntimeDATA \ - uninstall-toolexeclibgosyncDATA \ - uninstall-toolexeclibgotestingDATA \ - uninstall-toolexeclibgotextDATA \ - uninstall-toolexeclibgotexttemplateDATA \ - uninstall-toolexeclibgounicodeDATA - - -goc2c.$(OBJEXT): runtime/goc2c.c - $(CC_FOR_BUILD) -c $(CFLAGS_FOR_BUILD) $< - -goc2c: goc2c.$(OBJEXT) - $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ $< - -malloc.c: $(srcdir)/runtime/malloc.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -mprof.c: $(srcdir)/runtime/mprof.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -netpoll.c: $(srcdir)/runtime/netpoll.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -reflect.c: $(srcdir)/runtime/reflect.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -runtime1.c: $(srcdir)/runtime/runtime1.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -sema.c: $(srcdir)/runtime/sema.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -sigqueue.c: $(srcdir)/runtime/sigqueue.goc goc2c - ./goc2c --go-pkgpath os_signal $< > $@.tmp - mv -f $@.tmp $@ - -time.c: $(srcdir)/runtime/time.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -%.c: $(srcdir)/runtime/%.goc goc2c - ./goc2c $< > $@.tmp - mv -f $@.tmp $@ - -version.go: s-version; @true -s-version: Makefile - rm -f version.go.tmp - echo "package runtime" > version.go.tmp - echo 'const defaultGoroot = "$(prefix)"' >> version.go.tmp - echo 'const theVersion = "'`cat $(srcdir)/VERSION | sed 1q`' '`$(GOC) --version | sed 1q`'"' >> version.go.tmp - echo 'const theGoarch = "'$(GOARCH)'"' >> version.go.tmp - echo 'const theGoos = "'$(GOOS)'"' >> version.go.tmp - echo 'const theGccgoToolDir = "$(libexecsubdir)"' >> version.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh version.go.tmp version.go - $(STAMP) $@ - -# Generate the list of go std packages that were included in libgo -zstdpkglist.go: s-zstdpkglist; @true -s-zstdpkglist: Makefile - rm -f zstdpkglist.go.tmp - echo 'package main' > zstdpkglist.go.tmp - echo "" >> zstdpkglist.go.tmp - echo 'var stdpkg = map[string]bool{' >> zstdpkglist.go.tmp - echo $(libgo_go_objs) 'unsafe.lo' 'runtime/cgo.lo' | sed 's/\.lo /\": true,\n/g' | sed 's/\.lo/\": true,/' | sed 's/-go//' | grep -v _c | sed 's/^/\t\"/' | sort | uniq >> zstdpkglist.go.tmp - echo '}' >> zstdpkglist.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh zstdpkglist.go.tmp zstdpkglist.go - $(STAMP) $@ - -libcalls.go: s-libcalls; @true -s-libcalls: libcalls-list go/syscall/mksyscall.awk $(go_base_syscall_files) - rm -f libcalls.go.tmp - files=`echo $^ | sed -e 's/libcalls-list//' -e 's|[^ ]*go/syscall/mksyscall.awk||'`; \ - $(AWK) -f $(srcdir)/go/syscall/mksyscall.awk $${files} > libcalls.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh libcalls.go.tmp libcalls.go - $(STAMP) $@ - -libcalls-list: s-libcalls-list; @true -s-libcalls-list: Makefile - rm -f libcalls-list.tmp - echo $(go_base_syscall_files) > libcalls-list.tmp - $(SHELL) $(srcdir)/mvifdiff.sh libcalls-list.tmp libcalls-list - $(STAMP) $@ - -syscall_arch.go: s-syscall_arch; @true -s-syscall_arch: Makefile - rm -f syscall_arch.go.tmp - echo "package syscall" > syscall_arch.go.tmp - echo 'const ARCH = "'$(GOARCH)'"' >> syscall_arch.go.tmp - echo 'const OS = "'$(GOOS)'"' >> syscall_arch.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh syscall_arch.go.tmp syscall_arch.go - $(STAMP) $@ - -sysinfo.go: s-sysinfo; @true -s-sysinfo: $(srcdir)/mksysinfo.sh config.h - CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh - $(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go - $(STAMP) $@ - -# The epoll struct has an embedded union and is packed on x86_64, -# which is too complicated for mksysinfo.sh. We find the offset of -# the only field we care about in configure.ac, and generate the -# struct here. -epoll.go: s-epoll; @true -s-epoll: Makefile - rm -f epoll.go.tmp - echo 'package syscall' > epoll.go.tmp - echo 'type EpollEvent struct {' >> epoll.go.tmp - echo ' Events uint32' >> epoll.go.tmp - case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \ - 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \ - exit 1; ;; \ - 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \ - 12,4) echo ' Fd int32' >> epoll.go.tmp; \ - echo ' Pad [4]byte' >> epoll.go.tmp; ;; \ - 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ - echo ' Fd int32' >> epoll.go.tmp; ;; \ - 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \ - echo ' Fd int32' >> epoll.go.tmp; \ - echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \ - *) echo 1>&2 "*** struct epoll_event unsupported"; \ - exit 1; ;; \ - esac - echo '}' >> epoll.go.tmp - $(SHELL) $(srcdir)/mvifdiff.sh epoll.go.tmp epoll.go - $(STAMP) $@ - -@go_include@ bufio.lo.dep -bufio.lo.dep: $(go_bufio_files) - $(BUILDDEPS) -bufio.lo: $(go_bufio_files) - $(BUILDPACKAGE) -bufio/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: bufio/check - -@go_include@ bytes.lo.dep -bytes.lo.dep: $(go_bytes_files) - $(BUILDDEPS) -bytes.lo: $(go_bytes_files) - $(BUILDPACKAGE) -bytes/index.lo: $(go_bytes_c_files) - @$(MKDIR_P) bytes - $(LTCOMPILE) -c -o bytes/index.lo $(srcdir)/go/bytes/indexbyte.c -bytes/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: bytes/check - -@go_include@ crypto.lo.dep -crypto.lo.dep: $(go_crypto_files) - $(BUILDDEPS) -crypto.lo: $(go_crypto_files) - $(BUILDPACKAGE) -crypto/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/check - -@go_include@ encoding.lo.dep -encoding.lo.dep: $(go_encoding_files) - $(BUILDDEPS) -encoding.lo: $(go_encoding_files) - $(BUILDPACKAGE) -encoding/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/check - -@go_include@ errors.lo.dep -errors.lo.dep: $(go_errors_files) - $(BUILDDEPS) -errors.lo: $(go_errors_files) - $(BUILDPACKAGE) -errors/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: errors/check - -@go_include@ expvar.lo.dep -expvar.lo.dep: $(go_expvar_files) - $(BUILDDEPS) -expvar.lo: $(go_expvar_files) - $(BUILDPACKAGE) -expvar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: expvar/check - -@go_include@ flag.lo.dep -flag.lo.dep: $(go_flag_files) - $(BUILDDEPS) -flag.lo: $(go_flag_files) - $(BUILDPACKAGE) -flag/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: flag/check - -@go_include@ fmt.lo.dep -fmt.lo.dep: $(go_fmt_files) - $(BUILDDEPS) -fmt.lo: $(go_fmt_files) - $(BUILDPACKAGE) -fmt/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: fmt/check - -@go_include@ hash.lo.dep -hash.lo.dep: $(go_hash_files) - $(BUILDDEPS) -hash.lo: $(go_hash_files) - $(BUILDPACKAGE) -hash/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/check - -@go_include@ html.lo.dep -html.lo.dep: $(go_html_files) - $(BUILDDEPS) -html.lo: $(go_html_files) - $(BUILDPACKAGE) -html/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: html/check - -@go_include@ image.lo.dep -image.lo.dep: $(go_image_files) - $(BUILDDEPS) -image.lo: $(go_image_files) - $(BUILDPACKAGE) -image/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/check - -@go_include@ io.lo.dep -io.lo.dep: $(go_io_files) - $(BUILDDEPS) -io.lo: $(go_io_files) - $(BUILDPACKAGE) -io/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: io/check - -@go_include@ log.lo.dep -log.lo.dep: $(go_log_files) - $(BUILDDEPS) -log.lo: $(go_log_files) - $(BUILDPACKAGE) -log/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: log/check - -@go_include@ math.lo.dep -math.lo.dep: $(go_math_files) - $(BUILDDEPS) -math.lo: $(go_math_files) - $(MKDIR_P) $(@D) - files=`echo $^ | sed -e 's/[^ ]*\.gox//g'`; \ - $(LTGOCOMPILE) $(MATH_FLAG) -I . -c -fgo-pkgpath=math -o $@ $$files -math/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/check - -@go_include@ mime.lo.dep -mime.lo.dep: $(go_mime_files) - $(BUILDDEPS) -mime.lo: $(go_mime_files) - $(BUILDPACKAGE) -mime/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/check - -@go_include@ net.lo.dep -net.lo.dep: $(go_net_files) - $(BUILDDEPS) -net.lo: $(go_net_files) - $(BUILDPACKAGE) -net/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/check - -@go_include@ netgo.o.dep -netgo.o.dep: $(go_netgo_files) - $(BUILDDEPS) -netgo.o: $(go_netgo_files) - $(BUILDNETGO) - -@go_include@ os.lo.dep -os.lo.dep: $(go_os_files) - $(BUILDDEPS) -os.lo: $(go_os_files) - $(BUILDPACKAGE) -os/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/check - -@go_include@ path.lo.dep -path.lo.dep: $(go_path_files) - $(BUILDDEPS) -path.lo: $(go_path_files) - $(BUILDPACKAGE) -path/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: path/check - -@go_include@ reflect-go.lo.dep -reflect-go.lo.dep: $(go_reflect_files) - $(BUILDDEPS) -reflect-go.lo: $(go_reflect_files) - $(BUILDPACKAGE) -reflect/check: $(CHECK_DEPS) - @$(CHECK) -reflect/makefunc_ffi_c.lo: $(go_reflect_makefunc_c_file) - @$(MKDIR_P) reflect - $(LTCOMPILE) -c -o $@ $< -.PHONY: reflect/check - -@go_include@ regexp.lo.dep -regexp.lo.dep: $(go_regexp_files) - $(BUILDDEPS) -regexp.lo: $(go_regexp_files) - $(BUILDPACKAGE) -regexp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: regexp/check - -@go_include@ runtime-go.lo.dep -runtime-go.lo.dep: $(go_runtime_files) - $(BUILDDEPS) -runtime-go.lo: $(go_runtime_files) - $(BUILDPACKAGE) -runtime/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/check - -@go_include@ sort.lo.dep -sort.lo.dep: $(go_sort_files) - $(BUILDDEPS) -sort.lo: $(go_sort_files) - $(BUILDPACKAGE) -sort/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sort/check - -@go_include@ strconv.lo.dep -strconv.lo.dep: $(go_strconv_files) - $(BUILDDEPS) -strconv.lo: $(go_strconv_files) - $(BUILDPACKAGE) -strconv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: strconv/check - -@go_include@ strings.lo.dep -strings.lo.dep: $(go_strings_files) - $(BUILDDEPS) -strings.lo: $(go_strings_files) - $(BUILDPACKAGE) -strings/index.lo: $(go_strings_c_files) - @$(MKDIR_P) strings - $(LTCOMPILE) -c -o strings/index.lo $(srcdir)/go/strings/indexbyte.c -strings/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: strings/check - -@go_include@ sync.lo.dep -sync.lo.dep: $(go_sync_files) - $(BUILDDEPS) -sync.lo: $(go_sync_files) - $(BUILDPACKAGE) -sync/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sync/check - -@go_include@ testing.lo.dep -testing.lo.dep: $(go_testing_files) - $(BUILDDEPS) -testing.lo: $(go_testing_files) - $(BUILDPACKAGE) -testing/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/check - -@go_include@ time-go.lo.dep -time-go.lo.dep: $(go_time_files) - $(BUILDDEPS) -time-go.lo: $(go_time_files) - $(BUILDPACKAGE) -time/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: time/check - -@go_include@ unicode.lo.dep -unicode.lo.dep: $(go_unicode_files) - $(BUILDDEPS) -unicode.lo: $(go_unicode_files) - $(BUILDPACKAGE) -unicode/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/check - -@go_include@ archive/tar.lo.dep -archive/tar.lo.dep: $(go_archive_tar_files) - $(BUILDDEPS) -archive/tar.lo: $(go_archive_tar_files) - $(BUILDPACKAGE) -archive/tar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: archive/tar/check - -@go_include@ archive/zip.lo.dep -archive/zip.lo.dep: $(go_archive_zip_files) - $(BUILDDEPS) -archive/zip.lo: $(go_archive_zip_files) - $(BUILDPACKAGE) -archive/zip/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: archive/zip/check - -@go_include@ compress/bzip2.lo.dep -compress/bzip2.lo.dep: $(go_compress_bzip2_files) - $(BUILDDEPS) -compress/bzip2.lo: $(go_compress_bzip2_files) - $(BUILDPACKAGE) -compress/bzip2/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/bzip2/check - -@go_include@ compress/flate.lo.dep -compress/flate.lo.dep: $(go_compress_flate_files) - $(BUILDDEPS) -compress/flate.lo: $(go_compress_flate_files) - $(BUILDPACKAGE) -compress/flate/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/flate/check - -@go_include@ compress/gzip.lo.dep -compress/gzip.lo.dep: $(go_compress_gzip_files) - $(BUILDDEPS) -compress/gzip.lo: $(go_compress_gzip_files) - $(BUILDPACKAGE) -compress/gzip/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/gzip/check - -@go_include@ compress/lzw.lo.dep -compress/lzw.lo.dep: $(go_compress_lzw_files) - $(BUILDDEPS) -compress/lzw.lo: $(go_compress_lzw_files) - $(BUILDPACKAGE) -compress/lzw/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/lzw/check - -@go_include@ compress/zlib.lo.dep -compress/zlib.lo.dep: $(go_compress_zlib_files) - $(BUILDDEPS) -compress/zlib.lo: $(go_compress_zlib_files) - $(BUILDPACKAGE) -compress/zlib/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: compress/zlib/check - -@go_include@ container/heap.lo.dep -container/heap.lo.dep: $(go_container_heap_files) - $(BUILDDEPS) -container/heap.lo: $(go_container_heap_files) - $(BUILDPACKAGE) -container/heap/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/heap/check - -@go_include@ container/list.lo.dep -container/list.lo.dep: $(go_container_list_files) - $(BUILDDEPS) -container/list.lo: $(go_container_list_files) - $(BUILDPACKAGE) -container/list/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/list/check - -@go_include@ container/ring.lo.dep -container/ring.lo.dep: $(go_container_ring_files) - $(BUILDDEPS) -container/ring.lo: $(go_container_ring_files) - $(BUILDPACKAGE) -container/ring/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: container/ring/check - -@go_include@ crypto/aes.lo.dep -crypto/aes.lo.dep: $(go_crypto_aes_files) - $(BUILDDEPS) -crypto/aes.lo: $(go_crypto_aes_files) - $(BUILDPACKAGE) -crypto/aes/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/aes/check - -@go_include@ crypto/cipher.lo.dep -crypto/cipher.lo.dep: $(go_crypto_cipher_files) - $(BUILDDEPS) -crypto/cipher.lo: $(go_crypto_cipher_files) - $(BUILDPACKAGE) -crypto/cipher/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/cipher/check - -@go_include@ crypto/des.lo.dep -crypto/des.lo.dep: $(go_crypto_des_files) - $(BUILDDEPS) -crypto/des.lo: $(go_crypto_des_files) - $(BUILDPACKAGE) -crypto/des/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/des/check - -@go_include@ crypto/dsa.lo.dep -crypto/dsa.lo.dep: $(go_crypto_dsa_files) - $(BUILDDEPS) -crypto/dsa.lo: $(go_crypto_dsa_files) - $(BUILDPACKAGE) -crypto/dsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/dsa/check - -@go_include@ crypto/ecdsa.lo.dep -crypto/ecdsa.lo.dep: $(go_crypto_ecdsa_files) - $(BUILDDEPS) -crypto/ecdsa.lo: $(go_crypto_ecdsa_files) - $(BUILDPACKAGE) -crypto/ecdsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/ecdsa/check - -@go_include@ crypto/elliptic.lo.dep -crypto/elliptic.lo.dep: $(go_crypto_elliptic_files) - $(BUILDDEPS) -crypto/elliptic.lo: $(go_crypto_elliptic_files) - $(BUILDPACKAGE) -crypto/elliptic/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/elliptic/check - -@go_include@ crypto/hmac.lo.dep -crypto/hmac.lo.dep: $(go_crypto_hmac_files) - $(BUILDDEPS) -crypto/hmac.lo: $(go_crypto_hmac_files) - $(BUILDPACKAGE) -crypto/hmac/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/hmac/check - -@go_include@ crypto/md5.lo.dep -crypto/md5.lo.dep: $(go_crypto_md5_files) - $(BUILDDEPS) -crypto/md5.lo: $(go_crypto_md5_files) - $(BUILDPACKAGE) -crypto/md5/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/md5/check - -@go_include@ crypto/rand.lo.dep -crypto/rand.lo.dep: $(go_crypto_rand_files) - $(BUILDDEPS) -crypto/rand.lo: $(go_crypto_rand_files) - $(BUILDPACKAGE) -crypto/rand/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rand/check - -@go_include@ crypto/rc4.lo.dep -crypto/rc4.lo.dep: $(go_crypto_rc4_files) - $(BUILDDEPS) -crypto/rc4.lo: $(go_crypto_rc4_files) - $(BUILDPACKAGE) -crypto/rc4/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rc4/check - -@go_include@ crypto/rsa.lo.dep -crypto/rsa.lo.dep: $(go_crypto_rsa_files) - $(BUILDDEPS) -crypto/rsa.lo: $(go_crypto_rsa_files) - $(BUILDPACKAGE) -crypto/rsa/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/rsa/check - -@go_include@ crypto/sha1.lo.dep -crypto/sha1.lo.dep: $(go_crypto_sha1_files) - $(BUILDDEPS) -crypto/sha1.lo: $(go_crypto_sha1_files) - $(BUILDPACKAGE) -crypto/sha1/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha1/check - -@go_include@ crypto/sha256.lo.dep -crypto/sha256.lo.dep: $(go_crypto_sha256_files) - $(BUILDDEPS) -crypto/sha256.lo: $(go_crypto_sha256_files) - $(BUILDPACKAGE) -crypto/sha256/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha256/check - -@go_include@ crypto/sha512.lo.dep -crypto/sha512.lo.dep: $(go_crypto_sha512_files) - $(BUILDDEPS) -crypto/sha512.lo: $(go_crypto_sha512_files) - $(BUILDPACKAGE) -crypto/sha512/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/sha512/check - -@go_include@ crypto/subtle.lo.dep -crypto/subtle.lo.dep: $(go_crypto_subtle_files) - $(BUILDDEPS) -crypto/subtle.lo: $(go_crypto_subtle_files) - $(BUILDPACKAGE) -crypto/subtle/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/subtle/check - -@go_include@ crypto/tls.lo.dep -crypto/tls.lo.dep: $(go_crypto_tls_files) - $(BUILDDEPS) -crypto/tls.lo: $(go_crypto_tls_files) - $(BUILDPACKAGE) -crypto/tls/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/tls/check - -@go_include@ crypto/x509.lo.dep -crypto/x509.lo.dep: $(go_crypto_x509_files) - $(BUILDDEPS) -crypto/x509.lo: $(go_crypto_x509_files) - $(BUILDPACKAGE) -crypto/x509/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/x509/check - -@go_include@ crypto/x509/pkix.lo.dep -crypto/x509/pkix.lo.dep: $(go_crypto_x509_pkix_files) - $(BUILDDEPS) -crypto/x509/pkix.lo: $(go_crypto_x509_pkix_files) - $(BUILDPACKAGE) -crypto/x509/pkix/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: crypto/x509/pkix/check - -@go_include@ database/sql.lo.dep -database/sql.lo.dep: $(go_database_sql_files) - $(BUILDDEPS) -database/sql.lo: $(go_database_sql_files) - $(BUILDPACKAGE) -database/sql/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: database/sql/check - -@go_include@ database/sql/driver.lo.dep -database/sql/driver.lo.dep: $(go_database_sql_driver_files) - $(BUILDDEPS) -database/sql/driver.lo: $(go_database_sql_driver_files) - $(BUILDPACKAGE) -database/sql/driver/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: database/sql/driver/check - -@go_include@ debug/dwarf.lo.dep -debug/dwarf.lo.dep: $(go_debug_dwarf_files) - $(BUILDDEPS) -debug/dwarf.lo: $(go_debug_dwarf_files) - $(BUILDPACKAGE) -debug/dwarf/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/dwarf/check - -@go_include@ debug/elf.lo.dep -debug/elf.lo.dep: $(go_debug_elf_files) - $(BUILDDEPS) -debug/elf.lo: $(go_debug_elf_files) - $(BUILDPACKAGE) -debug/elf/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/elf/check - -@go_include@ debug/gosym.lo.dep -debug/gosym.lo.dep: $(go_debug_gosym_files) - $(BUILDDEPS) -debug/gosym.lo: $(go_debug_gosym_files) - $(BUILDPACKAGE) -debug/gosym/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/gosym/check - -@go_include@ debug/macho.lo.dep -debug/macho.lo.dep: $(go_debug_macho_files) - $(BUILDDEPS) -debug/macho.lo: $(go_debug_macho_files) - $(BUILDPACKAGE) -debug/macho/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/macho/check - -@go_include@ debug/pe.lo.dep -debug/pe.lo.dep: $(go_debug_pe_files) - $(BUILDDEPS) -debug/pe.lo: $(go_debug_pe_files) - $(BUILDPACKAGE) -debug/pe/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/pe/check - -@go_include@ debug/plan9obj.lo.dep -debug/plan9obj.lo.dep: $(go_debug_plan9obj_files) - $(BUILDDEPS) -debug/plan9obj.lo: $(go_debug_plan9obj_files) - $(BUILDPACKAGE) -debug/plan9obj/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: debug/plan9obj/check - -@go_include@ encoding/asn1.lo.dep -encoding/asn1.lo.dep: $(go_encoding_asn1_files) - $(BUILDDEPS) -encoding/asn1.lo: $(go_encoding_asn1_files) - $(BUILDPACKAGE) -encoding/asn1/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/asn1/check - -@go_include@ encoding/ascii85.lo.dep -encoding/ascii85.lo.dep: $(go_encoding_ascii85_files) - $(BUILDDEPS) -encoding/ascii85.lo: $(go_encoding_ascii85_files) - $(BUILDPACKAGE) -encoding/ascii85/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/ascii85/check - -@go_include@ encoding/base32.lo.dep -encoding/base32.lo.dep: $(go_encoding_base32_files) - $(BUILDDEPS) -encoding/base32.lo: $(go_encoding_base32_files) - $(BUILDPACKAGE) -encoding/base32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/base32/check - -@go_include@ encoding/base64.lo.dep -encoding/base64.lo.dep: $(go_encoding_base64_files) - $(BUILDDEPS) -encoding/base64.lo: $(go_encoding_base64_files) - $(BUILDPACKAGE) -encoding/base64/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/base64/check - -@go_include@ encoding/binary.lo.dep -encoding/binary.lo.dep: $(go_encoding_binary_files) - $(BUILDDEPS) -encoding/binary.lo: $(go_encoding_binary_files) - $(BUILDPACKAGE) -encoding/binary/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/binary/check - -@go_include@ encoding/csv.lo.dep -encoding/csv.lo.dep: $(go_encoding_csv_files) - $(BUILDDEPS) -encoding/csv.lo: $(go_encoding_csv_files) - $(BUILDPACKAGE) -encoding/csv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/csv/check - -@go_include@ encoding/gob.lo.dep -encoding/gob.lo.dep: $(go_encoding_gob_files) - $(BUILDDEPS) -encoding/gob.lo: $(go_encoding_gob_files) - $(BUILDPACKAGE) -encoding/gob/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/gob/check - -@go_include@ encoding/hex.lo.dep -encoding/hex.lo.dep: $(go_encoding_hex_files) - $(BUILDDEPS) -encoding/hex.lo: $(go_encoding_hex_files) - $(BUILDPACKAGE) -encoding/hex/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/hex/check - -@go_include@ encoding/json.lo.dep -encoding/json.lo.dep: $(go_encoding_json_files) - $(BUILDDEPS) -encoding/json.lo: $(go_encoding_json_files) - $(BUILDPACKAGE) -encoding/json/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/json/check - -@go_include@ encoding/pem.lo.dep -encoding/pem.lo.dep: $(go_encoding_pem_files) - $(BUILDDEPS) -encoding/pem.lo: $(go_encoding_pem_files) - $(BUILDPACKAGE) -encoding/pem/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/pem/check - -@go_include@ encoding/xml.lo.dep -encoding/xml.lo.dep: $(go_encoding_xml_files) - $(BUILDDEPS) -encoding/xml.lo: $(go_encoding_xml_files) - $(BUILDPACKAGE) -encoding/xml/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: encoding/xml/check - -@go_include@ exp/proxy.lo.dep -exp/proxy.lo.dep: $(go_exp_proxy_files) - $(BUILDDEPS) -exp/proxy.lo: $(go_exp_proxy_files) - $(BUILDPACKAGE) -exp/proxy/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: exp/proxy/check - -@go_include@ exp/terminal.lo.dep -exp/terminal.lo.dep: $(go_exp_terminal_files) - $(BUILDDEPS) -exp/terminal.lo: $(go_exp_terminal_files) - $(BUILDPACKAGE) -exp/terminal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: exp/terminal/check - -@go_include@ html/template.lo.dep -html/template.lo.dep: $(go_html_template_files) - $(BUILDDEPS) -html/template.lo: $(go_html_template_files) - $(BUILDPACKAGE) -html/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: html/template/check - -@go_include@ go/ast.lo.dep -go/ast.lo.dep: $(go_go_ast_files) - $(BUILDDEPS) -go/ast.lo: $(go_go_ast_files) - $(BUILDPACKAGE) -go/ast/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/ast/check - -@go_include@ go/build.lo.dep -go/build.lo.dep: $(go_go_build_files) - $(BUILDDEPS) -go/build.lo: $(go_go_build_files) - $(BUILDPACKAGE) -go/build/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/build/check - -@go_include@ go/constant.lo.dep -go/constant.lo.dep: $(go_go_constant_files) - $(BUILDDEPS) -go/constant.lo: $(go_go_constant_files) - $(BUILDPACKAGE) -go/constant/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/constant/check - -@go_include@ go/doc.lo.dep -go/doc.lo.dep: $(go_go_doc_files) - $(BUILDDEPS) -go/doc.lo: $(go_go_doc_files) - $(BUILDPACKAGE) -go/doc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/doc/check - -@go_include@ go/format.lo.dep -go/format.lo.dep: $(go_go_format_files) - $(BUILDDEPS) -go/format.lo: $(go_go_format_files) - $(BUILDPACKAGE) -go/format/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/format/check - -@go_include@ go/importer.lo.dep -go/importer.lo.dep: $(go_go_importer_files) - $(BUILDDEPS) -go/importer.lo: $(go_go_importer_files) - $(BUILDPACKAGE) -go/importer/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/importer/check - -@go_include@ go/parser.lo.dep -go/parser.lo.dep: $(go_go_parser_files) - $(BUILDDEPS) -go/parser.lo: $(go_go_parser_files) - $(BUILDPACKAGE) -go/parser/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/parser/check - -@go_include@ go/printer.lo.dep -go/printer.lo.dep: $(go_go_printer_files) - $(BUILDDEPS) -go/printer.lo: $(go_go_printer_files) - $(BUILDPACKAGE) -go/printer/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/printer/check - -@go_include@ go/scanner.lo.dep -go/scanner.lo.dep: $(go_go_scanner_files) - $(BUILDDEPS) -go/scanner.lo: $(go_go_scanner_files) - $(BUILDPACKAGE) -go/scanner/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/scanner/check - -@go_include@ go/token.lo.dep -go/token.lo.dep: $(go_go_token_files) - $(BUILDDEPS) -go/token.lo: $(go_go_token_files) - $(BUILDPACKAGE) -go/token/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/token/check - -@go_include@ go/types.lo.dep -go/types.lo.dep: $(go_go_types_files) - $(BUILDDEPS) -go/types.lo: $(go_go_types_files) - $(BUILDPACKAGE) -go/types/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/types/check - -@go_include@ go/internal/gcimporter.lo.dep -go/internal/gcimporter.lo.dep: $(go_go_internal_gcimporter_files) - $(BUILDDEPS) -go/internal/gcimporter.lo: $(go_go_internal_gcimporter_files) - $(BUILDPACKAGE) -go/internal/gcimporter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/internal/gcimporter/check - -@go_include@ go/internal/gccgoimporter.lo.dep -go/internal/gccgoimporter.lo.dep: $(go_go_internal_gccgoimporter_files) - $(BUILDDEPS) -go/internal/gccgoimporter.lo: $(go_go_internal_gccgoimporter_files) - $(BUILDPACKAGE) -go/internal/gccgoimporter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: go/internal/gccgoimporter/check - -@go_include@ hash/adler32.lo.dep -hash/adler32.lo.dep: $(go_hash_adler32_files) - $(BUILDDEPS) -hash/adler32.lo: $(go_hash_adler32_files) - $(BUILDPACKAGE) -hash/adler32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/adler32/check - -@go_include@ hash/crc32.lo.dep -hash/crc32.lo.dep: $(go_hash_crc32_files) - $(BUILDDEPS) -hash/crc32.lo: $(go_hash_crc32_files) - $(BUILDPACKAGE) -hash/crc32/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/crc32/check - -@go_include@ hash/crc64.lo.dep -hash/crc64.lo.dep: $(go_hash_crc64_files) - $(BUILDDEPS) -hash/crc64.lo: $(go_hash_crc64_files) - $(BUILDPACKAGE) -hash/crc64/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/crc64/check - -@go_include@ hash/fnv.lo.dep -hash/fnv.lo.dep: $(go_hash_fnv_files) - $(BUILDDEPS) -hash/fnv.lo: $(go_hash_fnv_files) - $(BUILDPACKAGE) -hash/fnv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: hash/fnv/check - -@go_include@ image/color.lo.dep -image/color.lo.dep: $(go_image_color_files) - $(BUILDDEPS) -image/color.lo: $(go_image_color_files) - $(BUILDPACKAGE) -image/color/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/color/check - -@go_include@ image/color/palette.lo.dep -image/color/palette.lo.dep: $(go_image_color_palette_files) - $(BUILDDEPS) -image/color/palette.lo: $(go_image_color_palette_files) - $(BUILDPACKAGE) -image/color/palette/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/color/palette/check - -@go_include@ image/draw.lo.dep -image/draw.lo.dep: $(go_image_draw_files) - $(BUILDDEPS) -image/draw.lo: $(go_image_draw_files) - $(BUILDPACKAGE) -image/draw/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/draw/check - -@go_include@ image/gif.lo.dep -image/gif.lo.dep: $(go_image_gif_files) - $(BUILDDEPS) -image/gif.lo: $(go_image_gif_files) - $(BUILDPACKAGE) -image/gif/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/gif/check - -@go_include@ image/internal/imageutil.lo.dep -image/internal/imageutil.lo.dep: $(go_image_internal_imageutil_files) - $(BUILDDEPS) -image/internal/imageutil.lo: $(go_image_internal_imageutil_files) - $(BUILDPACKAGE) -image/internal/imageutil/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/internal/imageutil/check - -@go_include@ image/jpeg.lo.dep -image/jpeg.lo.dep: $(go_image_jpeg_files) - $(BUILDDEPS) -image/jpeg.lo: $(go_image_jpeg_files) - $(BUILDPACKAGE) -image/jpeg/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/jpeg/check - -@go_include@ image/png.lo.dep -image/png.lo.dep: $(go_image_png_files) - $(BUILDDEPS) -image/png.lo: $(go_image_png_files) - $(BUILDPACKAGE) -image/png/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: image/png/check - -@go_include@ index/suffixarray.lo.dep -index/suffixarray.lo.dep: $(go_index_suffixarray_files) - $(BUILDDEPS) -index/suffixarray.lo: $(go_index_suffixarray_files) - $(BUILDPACKAGE) -index/suffixarray/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: index/suffixarray/check - -@go_include@ internal/format.lo.dep -internal/format.lo.dep: $(go_internal_format_files) - $(BUILDDEPS) -internal/format.lo: $(go_internal_format_files) - $(BUILDPACKAGE) -internal/format/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/format/check - -@go_include@ internal/singleflight.lo.dep -internal/singleflight.lo.dep: $(go_internal_singleflight_files) - $(BUILDDEPS) -internal/singleflight.lo: $(go_internal_singleflight_files) - $(BUILDPACKAGE) -internal/singleflight/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/singleflight/check - -@go_include@ internal/syscall/unix.lo.dep -internal/syscall/unix.lo.dep: $(go_internal_syscall_unix_files) - $(BUILDDEPS) -internal/syscall/unix.lo: $(go_internal_syscall_unix_files) - $(BUILDPACKAGE) -internal/syscall/unix/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/syscall/unix/check - -@go_include@ internal/testenv.lo.dep -internal/testenv.lo.dep: $(go_internal_testenv_files) - $(BUILDDEPS) -internal/testenv.lo: $(go_internal_testenv_files) - $(BUILDPACKAGE) -internal/testenv/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/testenv/check - -@go_include@ internal/trace.lo.dep -internal/trace.lo.dep: $(go_internal_trace_files) - $(BUILDDEPS) -internal/trace.lo: $(go_internal_trace_files) - $(BUILDPACKAGE) -internal/trace/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: internal/trace/check - -@go_include@ io/ioutil.lo.dep -io/ioutil.lo.dep: $(go_io_ioutil_files) - $(BUILDDEPS) -io/ioutil.lo: $(go_io_ioutil_files) - $(BUILDPACKAGE) -io/ioutil/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: io/ioutil/check - -@go_include@ log/syslog.lo.dep -log/syslog.lo.dep: $(go_log_syslog_files) - $(BUILDDEPS) -log/syslog.lo: $(go_log_syslog_files) - $(BUILDPACKAGE) -log/syslog/syslog_c.lo: $(go_syslog_c_files) log/syslog.lo - @$(MKDIR_P) log/syslog - $(LTCOMPILE) -c -o $@ $(srcdir)/go/log/syslog/syslog_c.c -log/syslog/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: log/syslog/check - -@go_include@ math/big.lo.dep -math/big.lo.dep: $(go_math_big_files) - $(BUILDDEPS) -math/big.lo: $(go_math_big_files) - $(BUILDPACKAGE) -math/big/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/big/check - -@go_include@ math/cmplx.lo.dep -math/cmplx.lo.dep: $(go_math_cmplx_files) - $(BUILDDEPS) -math/cmplx.lo: $(go_math_cmplx_files) - $(BUILDPACKAGE) -math/cmplx/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/cmplx/check - -@go_include@ math/rand.lo.dep -math/rand.lo.dep: $(go_math_rand_files) - $(BUILDDEPS) -math/rand.lo: $(go_math_rand_files) - $(BUILDPACKAGE) -math/rand/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: math/rand/check - -@go_include@ mime/multipart.lo.dep -mime/multipart.lo.dep: $(go_mime_multipart_files) - $(BUILDDEPS) -mime/multipart.lo: $(go_mime_multipart_files) - $(BUILDPACKAGE) -mime/multipart/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/multipart/check - -@go_include@ mime/quotedprintable.lo.dep -mime/quotedprintable.lo.dep: $(go_mime_quotedprintable_files) - $(BUILDDEPS) -mime/quotedprintable.lo: $(go_mime_quotedprintable_files) - $(BUILDPACKAGE) -mime/quotedprintable/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: mime/quotedprintable/check - -@go_include@ net/http.lo.dep -net/http.lo.dep: $(go_net_http_files) - $(BUILDDEPS) -net/http.lo: $(go_net_http_files) - $(BUILDPACKAGE) -net/http/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/check - -@go_include@ net/mail.lo.dep -net/mail.lo.dep: $(go_net_mail_files) - $(BUILDDEPS) -net/mail.lo: $(go_net_mail_files) - $(BUILDPACKAGE) -net/mail/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/mail/check - -@go_include@ net/rpc.lo.dep -net/rpc.lo.dep: $(go_net_rpc_files) - $(BUILDDEPS) -net/rpc.lo: $(go_net_rpc_files) - $(BUILDPACKAGE) -net/rpc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/rpc/check - -@go_include@ net/smtp.lo.dep -net/smtp.lo.dep: $(go_net_smtp_files) - $(BUILDDEPS) -net/smtp.lo: $(go_net_smtp_files) - $(BUILDPACKAGE) -net/smtp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/smtp/check - -@go_include@ net/url.lo.dep -net/url.lo.dep: $(go_net_url_files) - $(BUILDDEPS) -net/url.lo: $(go_net_url_files) - $(BUILDPACKAGE) -net/url/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/url/check - -@go_include@ net/textproto.lo.dep -net/textproto.lo.dep: $(go_net_textproto_files) - $(BUILDDEPS) -net/textproto.lo: $(go_net_textproto_files) - $(BUILDPACKAGE) -net/textproto/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/textproto/check - -@go_include@ net/http/cgi.lo.dep -net/http/cgi.lo.dep: $(go_net_http_cgi_files) - $(BUILDDEPS) -net/http/cgi.lo: $(go_net_http_cgi_files) - $(BUILDPACKAGE) -net/http/cgi/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/cgi/check - -@go_include@ net/http/cookiejar.lo.dep -net/http/cookiejar.lo.dep: $(go_net_http_cookiejar_files) - $(BUILDDEPS) -net/http/cookiejar.lo: $(go_net_http_cookiejar_files) - $(BUILDPACKAGE) -net/http/cookiejar/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/cookiejar/check - -@go_include@ net/http/fcgi.lo.dep -net/http/fcgi.lo.dep: $(go_net_http_fcgi_files) - $(BUILDDEPS) -net/http/fcgi.lo: $(go_net_http_fcgi_files) - $(BUILDPACKAGE) -net/http/fcgi/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/fcgi/check - -@go_include@ net/http/httptest.lo.dep -net/http/httptest.lo.dep: $(go_net_http_httptest_files) - $(BUILDDEPS) -net/http/httptest.lo: $(go_net_http_httptest_files) - $(BUILDPACKAGE) -net/http/httptest/check: $(check_deps) - @$(CHECK) -.PHONY: net/http/httptest/check - -@go_include@ net/http/httputil.lo.dep -net/http/httputil.lo.dep: $(go_net_http_httputil_files) - $(BUILDDEPS) -net/http/httputil.lo: $(go_net_http_httputil_files) - $(BUILDPACKAGE) -net/http/httputil/check: $(check_deps) - @$(CHECK) -.PHONY: net/http/httputil/check - -@go_include@ net/http/internal.lo.dep -net/http/internal.lo.dep: $(go_net_http_internal_files) - $(BUILDDEPS) -net/http/internal.lo: $(go_net_http_internal_files) - $(BUILDPACKAGE) -net/http/internal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/internal/check - -@go_include@ net/http/pprof.lo.dep -net/http/pprof.lo.dep: $(go_net_http_pprof_files) - $(BUILDDEPS) -net/http/pprof.lo: $(go_net_http_pprof_files) - $(BUILDPACKAGE) -net/http/pprof/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/http/pprof/check - -@go_include@ net/internal/socktest.lo.dep -net/internal/socktest.lo.dep: $(go_net_internal_socktest_files) - $(BUILDDEPS) -net/internal/socktest.lo: $(go_net_internal_socktest_files) - $(BUILDPACKAGE) -net/internal/socktest/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/internal/socktest/check - -@go_include@ net/rpc/jsonrpc.lo.dep -net/rpc/jsonrpc.lo.dep: $(go_net_rpc_jsonrpc_files) - $(BUILDDEPS) -net/rpc/jsonrpc.lo: $(go_net_rpc_jsonrpc_files) - $(BUILDPACKAGE) -net/rpc/jsonrpc/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: net/rpc/jsonrpc/check - -@go_include@ old/regexp.lo.dep -old/regexp.lo.dep: $(go_old_regexp_files) - $(BUILDDEPS) -old/regexp.lo: $(go_old_regexp_files) - $(BUILDPACKAGE) -old/regexp/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: old/regexp/check - -@go_include@ old/template.lo.dep -old/template.lo.dep: $(go_old_template_files) - $(BUILDDEPS) -old/template.lo: $(go_old_template_files) - $(BUILDPACKAGE) -old/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: old/template/check - -@go_include@ os/exec.lo.dep -os/exec.lo.dep: $(go_os_exec_files) - $(BUILDDEPS) -os/exec.lo: $(go_os_exec_files) - $(BUILDPACKAGE) -os/exec/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/exec/check - -@go_include@ os/signal.lo.dep -os/signal.lo.dep: $(go_os_signal_files) - $(BUILDDEPS) -os/signal.lo: $(go_os_signal_files) - $(BUILDPACKAGE) -os/signal/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/signal/check - -@go_include@ os/user.lo.dep -os/user.lo.dep: $(go_os_user_files) - $(BUILDDEPS) -os/user.lo: $(go_os_user_files) - $(BUILDPACKAGE) -os/user/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: os/user/check - -@go_include@ path/filepath.lo.dep -path/filepath.lo.dep: $(go_path_filepath_files) - $(BUILDDEPS) -path/filepath.lo: $(go_path_filepath_files) - $(BUILDPACKAGE) -path/filepath/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: path/filepath/check - -@go_include@ regexp/syntax.lo.dep -regexp/syntax.lo.dep: $(go_regexp_syntax_files) - $(BUILDDEPS) -regexp/syntax.lo: $(go_regexp_syntax_files) - $(BUILDPACKAGE) -regexp/syntax/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: regexp/syntax/check - -@go_include@ runtime/debug.lo.dep -runtime/debug.lo.dep: $(go_runtime_debug_files) - $(BUILDDEPS) -runtime/debug.lo: $(go_runtime_debug_files) - $(BUILDPACKAGE) -runtime/debug/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/debug/check - -@go_include@ runtime/pprof.lo.dep -runtime/pprof.lo.dep: $(go_runtime_pprof_files) - $(BUILDDEPS) -runtime/pprof.lo: $(go_runtime_pprof_files) - $(BUILDPACKAGE) -runtime/pprof/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: runtime/pprof/check - -@go_include@ sync/atomic.lo.dep -sync/atomic.lo.dep: $(go_sync_atomic_files) - $(BUILDDEPS) -sync/atomic.lo: $(go_sync_atomic_files) - $(BUILDPACKAGE) -sync/atomic_c.lo: $(go_sync_atomic_c_files) sync/atomic.lo - $(LTCOMPILE) -c -o $@ $(srcdir)/go/sync/atomic/atomic.c -sync/atomic/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: sync/atomic/check - -@go_include@ text/scanner.lo.dep -text/scanner.lo.dep: $(go_text_scanner_files) - $(BUILDDEPS) -text/scanner.lo: $(go_text_scanner_files) - $(BUILDPACKAGE) -text/scanner/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/scanner/check - -@go_include@ text/tabwriter.lo.dep -text/tabwriter.lo.dep: $(go_text_tabwriter_files) - $(BUILDDEPS) -text/tabwriter.lo: $(go_text_tabwriter_files) - $(BUILDPACKAGE) -text/tabwriter/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/tabwriter/check - -@go_include@ text/template.lo.dep -text/template.lo.dep: $(go_text_template_files) - $(BUILDDEPS) -text/template.lo: $(go_text_template_files) - $(BUILDPACKAGE) -text/template/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/template/check - -@go_include@ text/template/parse.lo.dep -text/template/parse.lo.dep: $(go_text_template_parse_files) - $(BUILDDEPS) -text/template/parse.lo: $(go_text_template_parse_files) - $(BUILDPACKAGE) -text/template/parse/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: text/template/parse/check - -@go_include@ testing/iotest.lo.dep -testing/iotest.lo.dep: $(go_testing_iotest_files) - $(BUILDDEPS) -testing/iotest.lo: $(go_testing_iotest_files) - $(BUILDPACKAGE) -testing/iotest/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/iotest/check - -@go_include@ testing/quick.lo.dep -testing/quick.lo.dep: $(go_testing_quick_files) - $(BUILDDEPS) -testing/quick.lo: $(go_testing_quick_files) - $(BUILDPACKAGE) -testing/quick/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: testing/quick/check - -@go_include@ unicode/utf16.lo.dep -unicode/utf16.lo.dep: $(go_unicode_utf16_files) - $(BUILDDEPS) -unicode/utf16.lo: $(go_unicode_utf16_files) - $(BUILDPACKAGE) -unicode/utf16/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/utf16/check - -@go_include@ unicode/utf8.lo.dep -unicode/utf8.lo.dep: $(go_unicode_utf8_files) - $(BUILDDEPS) -unicode/utf8.lo: $(go_unicode_utf8_files) - $(BUILDPACKAGE) -unicode/utf8/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: unicode/utf8/check - -@go_include@ syscall.lo.dep -syscall.lo.dep: $(go_syscall_files) - $(BUILDDEPS) -syscall.lo: $(go_syscall_files) - $(BUILDPACKAGE) -syscall/errno.lo: go/syscall/errno.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/signame.lo: go/syscall/signame.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/wait.lo: go/syscall/wait.c - @$(MKDIR_P) syscall - $(LTCOMPILE) -c -o $@ $< -syscall/check: $(CHECK_DEPS) - @$(CHECK) -.PHONY: syscall/check - -bufio.gox: bufio.lo - $(BUILDGOX) -bytes.gox: bytes.lo - $(BUILDGOX) -crypto.gox: crypto.lo - $(BUILDGOX) -encoding.gox: encoding.lo - $(BUILDGOX) -errors.gox: errors.lo - $(BUILDGOX) -expvar.gox: expvar.lo - $(BUILDGOX) -flag.gox: flag.lo - $(BUILDGOX) -fmt.gox: fmt.lo - $(BUILDGOX) -hash.gox: hash.lo - $(BUILDGOX) -html.gox: html.lo - $(BUILDGOX) -image.gox: image.lo - $(BUILDGOX) -io.gox: io.lo - $(BUILDGOX) -log.gox: log.lo - $(BUILDGOX) -math.gox: math.lo - $(BUILDGOX) -mime.gox: mime.lo - $(BUILDGOX) -net.gox: net.lo - $(BUILDGOX) -os.gox: os.lo - $(BUILDGOX) -path.gox: path.lo - $(BUILDGOX) -reflect.gox: reflect-go.lo - $(BUILDGOX) -regexp.gox: regexp.lo - $(BUILDGOX) -runtime.gox: runtime-go.lo - $(BUILDGOX) -sort.gox: sort.lo - $(BUILDGOX) -strconv.gox: strconv.lo - $(BUILDGOX) -strings.gox: strings.lo - $(BUILDGOX) -sync.gox: sync.lo - $(BUILDGOX) -syscall.gox: syscall.lo - $(BUILDGOX) -testing.gox: testing.lo - $(BUILDGOX) -time.gox: time-go.lo - $(BUILDGOX) -unicode.gox: unicode.lo - $(BUILDGOX) - -archive/tar.gox: archive/tar.lo - $(BUILDGOX) -archive/zip.gox: archive/zip.lo - $(BUILDGOX) - -compress/bzip2.gox: compress/bzip2.lo - $(BUILDGOX) -compress/flate.gox: compress/flate.lo - $(BUILDGOX) -compress/gzip.gox: compress/gzip.lo - $(BUILDGOX) -compress/lzw.gox: compress/lzw.lo - $(BUILDGOX) -compress/zlib.gox: compress/zlib.lo - $(BUILDGOX) - -container/heap.gox: container/heap.lo - $(BUILDGOX) -container/list.gox: container/list.lo - $(BUILDGOX) -container/ring.gox: container/ring.lo - $(BUILDGOX) - -crypto/aes.gox: crypto/aes.lo - $(BUILDGOX) -crypto/cipher.gox: crypto/cipher.lo - $(BUILDGOX) -crypto/des.gox: crypto/des.lo - $(BUILDGOX) -crypto/dsa.gox: crypto/dsa.lo - $(BUILDGOX) -crypto/ecdsa.gox: crypto/ecdsa.lo - $(BUILDGOX) -crypto/elliptic.gox: crypto/elliptic.lo - $(BUILDGOX) -crypto/hmac.gox: crypto/hmac.lo - $(BUILDGOX) -crypto/md5.gox: crypto/md5.lo - $(BUILDGOX) -crypto/rand.gox: crypto/rand.lo - $(BUILDGOX) -crypto/rc4.gox: crypto/rc4.lo - $(BUILDGOX) -crypto/rsa.gox: crypto/rsa.lo - $(BUILDGOX) -crypto/sha1.gox: crypto/sha1.lo - $(BUILDGOX) -crypto/sha256.gox: crypto/sha256.lo - $(BUILDGOX) -crypto/sha512.gox: crypto/sha512.lo - $(BUILDGOX) -crypto/subtle.gox: crypto/subtle.lo - $(BUILDGOX) -crypto/tls.gox: crypto/tls.lo - $(BUILDGOX) -crypto/x509.gox: crypto/x509.lo - $(BUILDGOX) - -crypto/x509/pkix.gox: crypto/x509/pkix.lo - $(BUILDGOX) - -database/sql.gox: database/sql.lo - $(BUILDGOX) - -database/sql/driver.gox: database/sql/driver.lo - $(BUILDGOX) - -debug/dwarf.gox: debug/dwarf.lo - $(BUILDGOX) -debug/elf.gox: debug/elf.lo - $(BUILDGOX) -debug/gosym.gox: debug/gosym.lo - $(BUILDGOX) -debug/macho.gox: debug/macho.lo - $(BUILDGOX) -debug/pe.gox: debug/pe.lo - $(BUILDGOX) -debug/plan9obj.gox: debug/plan9obj.lo - $(BUILDGOX) - -encoding/ascii85.gox: encoding/ascii85.lo - $(BUILDGOX) -encoding/asn1.gox: encoding/asn1.lo - $(BUILDGOX) -encoding/base32.gox: encoding/base32.lo - $(BUILDGOX) -encoding/base64.gox: encoding/base64.lo - $(BUILDGOX) -encoding/binary.gox: encoding/binary.lo - $(BUILDGOX) -encoding/csv.gox: encoding/csv.lo - $(BUILDGOX) -encoding/gob.gox: encoding/gob.lo - $(BUILDGOX) -encoding/hex.gox: encoding/hex.lo - $(BUILDGOX) -encoding/json.gox: encoding/json.lo - $(BUILDGOX) -encoding/pem.gox: encoding/pem.lo - $(BUILDGOX) -encoding/xml.gox: encoding/xml.lo - $(BUILDGOX) - -exp/proxy.gox: exp/proxy.lo - $(BUILDGOX) -exp/terminal.gox: exp/terminal.lo - $(BUILDGOX) - -html/template.gox: html/template.lo - $(BUILDGOX) - -go/ast.gox: go/ast.lo - $(BUILDGOX) -go/build.gox: go/build.lo - $(BUILDGOX) -go/constant.gox: go/constant.lo - $(BUILDGOX) -go/doc.gox: go/doc.lo - $(BUILDGOX) -go/format.gox: go/format.lo - $(BUILDGOX) -go/importer.gox: go/importer.lo - $(BUILDGOX) -go/parser.gox: go/parser.lo - $(BUILDGOX) -go/printer.gox: go/printer.lo - $(BUILDGOX) -go/scanner.gox: go/scanner.lo - $(BUILDGOX) -go/token.gox: go/token.lo - $(BUILDGOX) -go/types.gox: go/types.lo - $(BUILDGOX) - -go/internal/gcimporter.gox: go/internal/gcimporter.lo - $(BUILDGOX) -go/internal/gccgoimporter.gox: go/internal/gccgoimporter.lo - $(BUILDGOX) - -hash/adler32.gox: hash/adler32.lo - $(BUILDGOX) -hash/crc32.gox: hash/crc32.lo - $(BUILDGOX) -hash/crc64.gox: hash/crc64.lo - $(BUILDGOX) -hash/fnv.gox: hash/fnv.lo - $(BUILDGOX) - -image/color.gox: image/color.lo - $(BUILDGOX) -image/draw.gox: image/draw.lo - $(BUILDGOX) -image/gif.gox: image/gif.lo - $(BUILDGOX) -image/internal/imageutil.gox: image/internal/imageutil.lo - $(BUILDGOX) -image/jpeg.gox: image/jpeg.lo - $(BUILDGOX) -image/png.gox: image/png.lo - $(BUILDGOX) - -image/color/palette.gox: image/color/palette.lo - $(BUILDGOX) - -index/suffixarray.gox: index/suffixarray.lo - $(BUILDGOX) - -internal/format.gox: internal/format.lo - $(BUILDGOX) -internal/singleflight.gox: internal/singleflight.lo - $(BUILDGOX) -internal/syscall/unix.gox: internal/syscall/unix.lo - $(BUILDGOX) -internal/testenv.gox: internal/testenv.lo - $(BUILDGOX) -internal/trace.gox: internal/trace.lo - $(BUILDGOX) - -io/ioutil.gox: io/ioutil.lo - $(BUILDGOX) - -log/syslog.gox: log/syslog.lo - $(BUILDGOX) - -math/big.gox: math/big.lo - $(BUILDGOX) -math/cmplx.gox: math/cmplx.lo - $(BUILDGOX) -math/rand.gox: math/rand.lo - $(BUILDGOX) - -mime/multipart.gox: mime/multipart.lo - $(BUILDGOX) -mime/quotedprintable.gox: mime/quotedprintable.lo - $(BUILDGOX) - -net/http.gox: net/http.lo - $(BUILDGOX) -net/mail.gox: net/mail.lo - $(BUILDGOX) -net/rpc.gox: net/rpc.lo - $(BUILDGOX) -net/smtp.gox: net/smtp.lo - $(BUILDGOX) -net/textproto.gox: net/textproto.lo - $(BUILDGOX) -net/url.gox: net/url.lo - $(BUILDGOX) - -net/http/cgi.gox: net/http/cgi.lo - $(BUILDGOX) -net/http/cookiejar.gox: net/http/cookiejar.lo - $(BUILDGOX) -net/http/fcgi.gox: net/http/fcgi.lo - $(BUILDGOX) -net/http/httptest.gox: net/http/httptest.lo - $(BUILDGOX) -net/http/httputil.gox: net/http/httputil.lo - $(BUILDGOX) -net/http/pprof.gox: net/http/pprof.lo - $(BUILDGOX) - -net/http/internal.gox: net/http/internal.lo - $(BUILDGOX) - -net/internal/socktest.gox: net/internal/socktest.lo - $(BUILDGOX) - -net/rpc/jsonrpc.gox: net/rpc/jsonrpc.lo - $(BUILDGOX) - -old/regexp.gox: old/regexp.lo - $(BUILDGOX) -old/template.gox: old/template.lo - $(BUILDGOX) - -os/exec.gox: os/exec.lo - $(BUILDGOX) -os/signal.gox: os/signal.lo - $(BUILDGOX) -os/user.gox: os/user.lo - $(BUILDGOX) - -path/filepath.gox: path/filepath.lo - $(BUILDGOX) - -regexp/syntax.gox: regexp/syntax.lo - $(BUILDGOX) - -runtime/debug.gox: runtime/debug.lo - $(BUILDGOX) -runtime/pprof.gox: runtime/pprof.lo - $(BUILDGOX) - -sync/atomic.gox: sync/atomic.lo - $(BUILDGOX) - -text/scanner.gox: text/scanner.lo - $(BUILDGOX) -text/tabwriter.gox: text/tabwriter.lo - $(BUILDGOX) -text/template.gox: text/template.lo - $(BUILDGOX) -text/template/parse.gox: text/template/parse.lo - $(BUILDGOX) - -testing/iotest.gox: testing/iotest.lo - $(BUILDGOX) -testing/quick.gox: testing/quick.lo - $(BUILDGOX) - -unicode/utf16.gox: unicode/utf16.lo - $(BUILDGOX) -unicode/utf8.gox: unicode/utf8.lo - $(BUILDGOX) - -check: check-tail -check-recursive: check-head - -check-head: - @echo "Test Run By $${USER} on `date`" > libgo.head - @echo "Native configuration is $(host_triplet)" >> libgo.head - @echo >> libgo.head - @echo " === libgo tests ===" >> libgo.head - @echo >> libgo.head - -check-tail: check-recursive check-multi - @if test "$(USE_DEJAGNU)" = "yes"; then \ - exit 0; \ - fi; \ - lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \ - for dir in . $(MULTIDIRS); do \ - mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \ - mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \ - done; \ - mv libgo.head libgo.sum; \ - cp libgo.sum libgo.log; \ - echo "Schedule of variations:" >> libgo.sum; \ - for dir in . $(MULTIDIRS); do \ - multidir=../$${dir}/$${lib}; \ - multivar=`cat $${multidir}/libgo.var`; \ - echo " $${multivar}" >> libgo.sum; \ - done; \ - echo >> libgo.sum; \ - pass=0; fail=0; untested=0; \ - for dir in . $(MULTIDIRS); do \ - multidir=../$${dir}/$${lib}; \ - multivar=`cat $${multidir}/libgo.var`; \ - echo "Running target $${multivar}" >> libgo.sum; \ - echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \ - cat $${multidir}/libgo.sum.sep >> libgo.sum; \ - cat $${multidir}/libgo.log.sep >> libgo.log; \ - if test -n "${MULTIDIRS}"; then \ - echo " === libgo Summary for $${multivar} ===" >> libgo.sum; \ - echo >> libgo.sum; \ - fi; \ - p=`grep -c PASS $${multidir}/libgo.sum.sep`; \ - pass=`expr $$pass + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of expected passes $$p" >> libgo.sum; \ - fi; \ - p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \ - fail=`expr $$fail + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of unexpected failures $$p" >> libgo.sum; \ - fi; \ - p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \ - untested=`expr $$untested + $$p`; \ - if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \ - echo "# of untested testcases $$p" >> libgo.sum; \ - fi; \ - done; \ - echo >> libgo.sum; \ - echo " === libgo Summary ===" >> libgo.sum; \ - echo >> libgo.sum; \ - if test "$$pass" -ne "0"; then \ - echo "# of expected passes $$pass" >> libgo.sum; \ - fi; \ - if test "$$fail" -ne "0"; then \ - echo "# of unexpected failures $$fail" >> libgo.sum; \ - fi; \ - if test "$$untested" -ne "0"; then \ - echo "# of untested testcases $$untested" >> libgo.sum; \ - fi; \ - echo `echo $(GOC) | sed -e 's/ .*//'` `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \ - echo >> libgo.log; \ - echo "runtest completed at `date`" >> libgo.log; \ - if test "$$fail" -ne "0"; then \ - status=1; \ - else \ - status=0; \ - fi; \ - exit $$status - -check-am: - @rm -f libgo.sum libgo.log libgo.tail - @multivar="unix"; \ - [ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \ - echo "$${multivar}" > libgo.var - @for f in $(TEST_PACKAGES); do \ - rm -f $$f-testsum $$f-testlog; \ - done - -@$(MAKE) -k $(TEST_PACKAGES) - @for f in $(TEST_PACKAGES); do \ - if test -f $$f-testsum; then \ - cat $$f-testsum >> libgo.sum; \ - fi; \ - if test -f $$f-testlog; then \ - cat $$f-testlog >> libgo.log; \ - fi; \ - done - -check-multi: - $(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE) - -bench: - -@$(MAKE) -k $(TEST_PACKAGES) GOBENCH=. - -mostlyclean-local: - find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f - find . -name '*.$(OBJEXT)' -print | xargs rm -f - find . -name '*-testsum' -print | xargs rm -f - find . -name '*-testlog' -print | xargs rm -f - -clean-local: - find . -name '*.la' -print | xargs $(LIBTOOL) --mode=clean rm -f - find . -name '*.a' -print | xargs rm -f - -# 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/llgo/third_party/gofrontend/libgo/PATENTS b/llgo/third_party/gofrontend/libgo/PATENTS deleted file mode 100644 index 733099041f84fa1e58611ab2e11af51c1f26d1d2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/llgo/third_party/gofrontend/libgo/README b/llgo/third_party/gofrontend/libgo/README deleted file mode 100644 index d5af7e2fd168e6bbb9879259034134648b676387..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/README +++ /dev/null @@ -1,44 +0,0 @@ -See ../README. - -This is the runtime support library for the Go programming language. -This library is intended for use with the Go frontend. - -This library should not be stripped when it is installed. Go code -relies on being able to look up file/line information, which comes -from the debugging info using the libbacktrace library. - -The library has only been tested on GNU/Linux using glibc, and on -Solaris. It should not be difficult to port to other operating -systems. - -Directories: - -go - A copy of the Go library from http://golang.org/, with several - changes for gccgo. - -runtime - Runtime functions, written in C, which are called directly by the - compiler or by the library. - -Contributing -============ - -To contribute patches to the files in this directory, please see -http://golang.org/doc/gccgo_contribute.html . - -The master copy of these files is hosted at -http://code.google.com/p/gofrontend . Changes to these files require -signing a Google contributor license agreement. If you are the -copyright holder, you will need to agree to the individual contributor -license agreement at -http://code.google.com/legal/individual-cla-v1.0.html. This agreement -can be completed online. - -If your organization is the copyright holder, the organization will -need to agree to the corporate contributor license agreement at -http://code.google.com/legal/corporate-cla-v1.0.html. - -If the copyright holder for your code has already completed the -agreement in connection with another Google open source project, it -does not need to be completed again. diff --git a/llgo/third_party/gofrontend/libgo/README.gcc b/llgo/third_party/gofrontend/libgo/README.gcc deleted file mode 100644 index d5aabb0f9c2284bd482fce9102350d07d44374e3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/README.gcc +++ /dev/null @@ -1,7 +0,0 @@ -The files in this directory are mirrored from the gofrontend project -hosted at http://code.google.com/p/gofrontend. These files are the -ones in the libgo subdirectory of that project. - -By default, the networking tests are not run. In order to run all the -libgo tests, you need to define the environment variable -GCCGO_RUN_ALL_TESTS to a non-empty string. diff --git a/llgo/third_party/gofrontend/libgo/VERSION b/llgo/third_party/gofrontend/libgo/VERSION deleted file mode 100644 index 77af434f110af853a21db3f2317bc0586ecb4bb8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/VERSION +++ /dev/null @@ -1 +0,0 @@ -go1.5.1 \ No newline at end of file diff --git a/llgo/third_party/gofrontend/libgo/aclocal.m4 b/llgo/third_party/gofrontend/libgo/aclocal.m4 deleted file mode 100644 index aefbad20a0b5dbf016866c6eba22dfb8a3bffd80..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/aclocal.m4 +++ /dev/null @@ -1,1001 +0,0 @@ -# generated automatically by aclocal 1.11.6 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009, 2010, 2011 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, 2011 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 1 - -# 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.6], [], - [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.6])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, 2011 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 1 - -# 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, -# 2010, 2011 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 12 - -# 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'. - rm -rf conftest.dir - 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 - ;; - msvc7 | msvc7msys | 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='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])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, 2011 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 1 - -# 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, -# 2011 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 enable 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, 2011 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 1 - -# 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, 2010 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_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, 2011 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 1 - -# 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, 2010 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 3 - -# _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, 2012 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. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([../config/depstand.m4]) -m4_include([../config/lead-dot.m4]) -m4_include([../config/multi.m4]) -m4_include([../config/override.m4]) -m4_include([../config/unwind_ipinfo.m4]) -m4_include([config/go.m4]) -m4_include([config/libtool.m4]) -m4_include([config/ltoptions.m4]) -m4_include([config/ltsugar.m4]) -m4_include([config/ltversion.m4]) -m4_include([config/lt~obsolete.m4]) diff --git a/llgo/third_party/gofrontend/libgo/config.h.in b/llgo/third_party/gofrontend/libgo/config.h.in deleted file mode 100644 index 298b8d660e3a157416955d617a561536d77dfafd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config.h.in +++ /dev/null @@ -1,399 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to the flags needed for the .section .eh_frame directive. */ -#undef EH_FRAME_FLAGS - -/* Define to 1 if you have the `accept4' function. */ -#undef HAVE_ACCEPT4 - -/* Define to 1 if you have the `acosl' function. */ -#undef HAVE_ACOSL - -/* Define to 1 if you have the `asinl' function. */ -#undef HAVE_ASINL - -/* Define if your assembler supports GNU comdat group syntax. */ -#undef HAVE_AS_COMDAT_GAS - -/* Define if your assembler supports unwind section type. */ -#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE - -/* Define if your assembler supports PC relative relocs. */ -#undef HAVE_AS_X86_PCREL - -/* Define to 1 if you have the `atan2l' function. */ -#undef HAVE_ATAN2L - -/* Define to 1 if you have the `atanl' function. */ -#undef HAVE_ATANL - -/* Define to 1 if you have the `cosl' function. */ -#undef HAVE_COSL - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `dl_iterate_phdr' function. */ -#undef HAVE_DL_ITERATE_PHDR - -/* Define to 1 if you have the `dup3' function. */ -#undef HAVE_DUP3 - -/* Define to 1 if you have the `epoll_create1' function. */ -#undef HAVE_EPOLL_CREATE1 - -/* Define to 1 if you have the `expl' function. */ -#undef HAVE_EXPL - -/* Define to 1 if you have the `expm1l' function. */ -#undef HAVE_EXPM1L - -/* Define to 1 if you have the `faccessat' function. */ -#undef HAVE_FACCESSAT - -/* Define to 1 if you have the `fallocate' function. */ -#undef HAVE_FALLOCATE - -/* Define to 1 if you have the `fchmodat' function. */ -#undef HAVE_FCHMODAT - -/* Define to 1 if you have the `fchownat' function. */ -#undef HAVE_FCHOWNAT - -/* Define to 1 if you have the `futimesat' function. */ -#undef HAVE_FUTIMESAT - -/* Define if _Unwind_GetIPInfo is available. */ -#undef HAVE_GETIPINFO - -/* Define to 1 if you have the `getxattr' function. */ -#undef HAVE_GETXATTR - -/* Define to 1 if you have the `inotify_add_watch' function. */ -#undef HAVE_INOTIFY_ADD_WATCH - -/* Define to 1 if you have the `inotify_init' function. */ -#undef HAVE_INOTIFY_INIT - -/* Define to 1 if you have the `inotify_init1' function. */ -#undef HAVE_INOTIFY_INIT1 - -/* Define to 1 if you have the `inotify_rm_watch' function. */ -#undef HAVE_INOTIFY_RM_WATCH - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `ldexpl' function. */ -#undef HAVE_LDEXPL - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FILTER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_FS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_ADDR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_IF_TUN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_NETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_REBOOT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_RTNETLINK_H - -/* Define to 1 if you have the `listxattr' function. */ -#undef HAVE_LISTXATTR - -/* Define to 1 if the system has the type `loff_t'. */ -#undef HAVE_LOFF_T - -/* Define to 1 if you have the `log10l' function. */ -#undef HAVE_LOG10L - -/* Define to 1 if you have the `log1pl' function. */ -#undef HAVE_LOG1PL - -/* Define to 1 if you have the `logl' function. */ -#undef HAVE_LOGL - -/* Define to 1 if you have the `matherr' function. */ -#undef HAVE_MATHERR - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mincore' function. */ -#undef HAVE_MINCORE - -/* Define to 1 if you have the `mkdirat' function. */ -#undef HAVE_MKDIRAT - -/* Define to 1 if you have the `mknodat' function. */ -#undef HAVE_MKNODAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_ICMP6_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_SYST_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_MROUTE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETPACKET_PACKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_ARP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_ROUTE_H - -/* Define to 1 if the system has the type `off64_t'. */ -#undef HAVE_OFF64_T - -/* Define to 1 if you have the `open64' function. */ -#undef HAVE_OPEN64 - -/* Define to 1 if you have the `openat' function. */ -#undef HAVE_OPENAT - -/* Define to 1 if you have the `pipe2' function. */ -#undef HAVE_PIPE2 - -/* Define to 1 if you have the `removexattr' function. */ -#undef HAVE_REMOVEXATTR - -/* Define to 1 if you have the `renameat' function. */ -#undef HAVE_RENAMEAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_SCHED_H - -/* Define to 1 if you have the `sem_timedwait' function. */ -#undef HAVE_SEM_TIMEDWAIT - -/* Define to 1 if you have the `setenv' function. */ -#undef HAVE_SETENV - -/* Define to 1 if you have the `setxattr' function. */ -#undef HAVE_SETXATTR - -/* Define to 1 if you have the `sinl' function. */ -#undef HAVE_SINL - -/* Define to 1 if you have the `splice' function. */ -#undef HAVE_SPLICE - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strerror_r' function. */ -#undef HAVE_STRERROR_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strsignal' function. */ -#undef HAVE_STRSIGNAL - -/* Define to 1 if defines struct exception */ -#undef HAVE_STRUCT_EXCEPTION - -/* Define to 1 if the compiler provides the __sync_add_and_fetch function for - uint64 */ -#undef HAVE_SYNC_ADD_AND_FETCH_8 - -/* Define to 1 if the compiler provides the __sync_bool_compare_and_swap - function for uint32 */ -#undef HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4 - -/* Define to 1 if the compiler provides the __sync_bool_compare_and_swap - function for uint64 */ -#undef HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8 - -/* Define to 1 if the compiler provides the __sync_fetch_and_add function for - uint32 */ -#undef HAVE_SYNC_FETCH_AND_ADD_4 - -/* Define to 1 if you have the `sync_file_range' function. */ -#undef HAVE_SYNC_FILE_RANGE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYSCALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_INOTIFY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PRCTL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PTRACE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATFS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSCALL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSINFO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMEX_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_USER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_VFS_H - -/* Define to 1 if you have the `tanl' function. */ -#undef HAVE_TANL - -/* Define to 1 if you have the `tee' function. */ -#undef HAVE_TEE - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `unlinkat' function. */ -#undef HAVE_UNLINKAT - -/* Define to 1 if you have the `unsetenv' function. */ -#undef HAVE_UNSETENV - -/* Define to 1 if you have the `unshare' function. */ -#undef HAVE_UNSHARE - -/* Define to 1 if you have the header file and it works. */ -#undef HAVE_USTAT_H - -/* Define to 1 if you have the `utimensat' function. */ -#undef HAVE_UTIMENSAT - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define to 1 if you have the `wait4' function. */ -#undef HAVE_WAIT4 - -/* Define if the linker support split stack adjustments */ -#undef LINKER_SUPPORTS_SPLIT_STACK - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define if setcontext clobbers TLS variables */ -#undef SETCONTEXT_CLOBBERS_TLS - -/* The size of `void *', as computed by sizeof. */ -#undef SIZEOF_VOID_P - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if we're to use libffi. */ -#undef USE_LIBFFI - -/* Define if the compiler supports -fsplit-stack */ -#undef USING_SPLIT_STACK - -/* Version number of package */ -#undef VERSION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to `long int' if does not define. */ -#undef off_t diff --git a/llgo/third_party/gofrontend/libgo/config/README b/llgo/third_party/gofrontend/libgo/config/README deleted file mode 100644 index 06e8bf51555346ca3d68b9f3281424e3c0dd1461..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory holds files needed temporarily until Go support is -added to autoconf and libtool. diff --git a/llgo/third_party/gofrontend/libgo/config/go.m4 b/llgo/third_party/gofrontend/libgo/config/go.m4 deleted file mode 100644 index 65a27cbdf00442618f4235e8b630b8218589d7ea..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/go.m4 +++ /dev/null @@ -1,92 +0,0 @@ -dnl acinclude.m4 -- configure macros - -dnl Copyright 2009 The Go Authors. All rights reserved. -dnl Use of this source code is governed by a BSD-style -dnl license that can be found in the LICENSE file. - -dnl Go support--this could be in autoconf. -dnl This version is probably autoconf 2.64 specific. - -AC_LANG_DEFINE([Go], [go], [GO], [], -[ac_ext=go -ac_compile='$GOC -c $GOCFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD' -ac_link='$GOC -o conftest$ac_exeext $GOCFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD' -ac_compile_gnu=yes -]) - -AU_DEFUN([AC_LANG_GO], [AC_LANG(Go)]) - -m4_define([AC_LANG_PROGRAM(Go)], -[package main -$1 -func main() { -$2 -}]) - -m4_define([AC_LANG_IO_PROGRAM(Go)], -[AC_LANG_PROGRAM([import "os"], -[if f, err := os.Open("conftest.out", os.O_WRONLY), err != nil { - os.Exit(1); - } - if err := f.Close(); err != nil { - os.Exit(1); - } - os.Exit(0); -])]) - -m4_define([AC_LANG_CALL(Go)], -[AC_LANG_PROGRAM([$1 -m4_if([$2], [main], , -[func $2();])],[$2();])]) - -m4_define([AC_LANG_FUNC_LINK_TRY(Go)], -[AC_LANG_PROGRAM( -[func $1() int; -var f := $1; -], [return f();])]) - -m4_define([AC_LANG_BOOL_COMPILE_TRY(Go)], -[AC_LANG_PROGRAM([$1], [var test_array @<:@1 - 2 * !($2)@:>@; -test_array @<:@0@:>@ = 0 -])]) - -m4_define([AC_LANG_INT_SAVE(Go)], -[AC_LANG_PROGRAM([$1 -import os -func longval() long { return $2 } -func ulongval() ulong { return $2 }], -[panic("unimplemented")])]) - -AC_DEFUN([AC_LANG_COMPILER(Go)], -[AC_REQUIRE([AC_PROG_GO])]) - -AN_MAKEVAR([GOC], [AC_PROG_GO]) -AN_PROGRAM([gccgo], [AC_PROG_GO]) -AC_DEFUN([AC_PROG_GO], -[AC_LANG_PUSH(Go)dnl -AC_ARG_VAR([GOC], [Go compiler command])dnl -AC_ARG_VAR([GOCFLAGS], [Go compiler flags])dnl -_AC_ARG_VAR_LDFLAGS()dnl -m4_ifval([$1], - [AC_CHECK_TOOLS(GOC, [$1])], -[AC_CHECK_TOOL(GOC, gccgo) -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [$ac_tool_prefix}gccgo]) - fi -fi -if test -z "$GOC"; then - AC_CHECK_PROG(GOC, gccgo, gccgo, , , gccgo) -fi -]) - -# Provide some information about the compiler. -_AS_ECHO_LOG([checking for _AC_LANG compiler version]) -set X $ac_compile -ac_compiler=$[2] -_AC_DO_LIMIT([$ac_compiler --version >&AS_MESSAGE_LOG_FD]) -m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl -m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl -GOCFLAGS="-g -O2" -AC_LANG_POP(Go)dnl -])# AC_PROG_GO diff --git a/llgo/third_party/gofrontend/libgo/config/libtool.m4 b/llgo/third_party/gofrontend/libgo/config/libtool.m4 deleted file mode 100644 index f70059474540a211387edf6f56096508eaf5041a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/libtool.m4 +++ /dev/null @@ -1,7518 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# 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 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. - -m4_define([_LT_COPYING], [dnl -# 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. -]) - -# serial 56 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; 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-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# 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 -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -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 - -_LT_CC_BASENAME([$compiler]) - -# 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 - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# 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' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - -## ------------------------------------- ## -## Accumulate code for creating libtool. ## -## ------------------------------------- ## - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - -## ------------------------ ## -## FIXME: Eliminate VARNAME ## -## ------------------------ ## - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# 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' -_LT_CONFIG_STATUS_DECLARATIONS -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 lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); 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 lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); 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 - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2009 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [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. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### 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 - - _LT_PROG_LTMAIN - - # 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) - - _LT_PROG_XSI_SHELLFNS - - 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" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([AC_PROG_GO], - [LT_LANG(GO)], - [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# 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 -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -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* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -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* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [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" >&AS_MESSAGE_LOG_FD - $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 >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [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" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $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 >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - 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 -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_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 - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="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}" - _LT_TAGVAR(module_expsym_cmds, $1)="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}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$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}" - _LT_TAGVAR(archive_expsym_cmds, $1)="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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -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],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# 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*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - 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" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -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 AC_TRY_EVAL(ac_compile); 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 AC_TRY_EVAL(ac_compile); 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 AC_TRY_EVAL(ac_compile); 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" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - 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 AC_TRY_EVAL(ac_compile); 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" -])# _LT_ENABLE_LOCK - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# 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 -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # 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\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - 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 - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - 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>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - 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 -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line __oline__ "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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 AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -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 - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - 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" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - 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 -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=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\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - 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_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $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* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - 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 - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[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]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != 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, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = 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 -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -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" - AC_MSG_RESULT([yes]) -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" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -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.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`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}' -m4_if([$1], [],[ - 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`' -m4_if([$1], [],[ - 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 - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - 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 -AC_MSG_RESULT([$dynamic_linker]) -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 - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[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]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[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 -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - 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]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - 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 - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[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 &1 /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 -]) -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 - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[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]) -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 - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# 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 AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && 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_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && 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" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - 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 -]) -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 - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-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 - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - 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_TAGVAR(lt_prog_compiler_pic, $1)=-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_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--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_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+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_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-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 - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - 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_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-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). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$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 - _LT_TAGVAR(export_symbols_cmds, $1)='$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 - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$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' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # 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'. - _LT_TAGVAR(exclude_expsyms, $1)=['_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. -dnl Note also adjust exclude_expsyms for C++ above. - 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 - - _LT_TAGVAR(ld_shlibs, $1)=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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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 - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - 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 - _LT_TAGVAR(ld_shlibs, $1)=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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$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)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds, $1)='$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... - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - 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 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(ld_shlibs, $1)=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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$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. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=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 - _LT_TAGVAR(export_symbols_cmds, $1)='$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 - _LT_TAGVAR(export_symbols_cmds, $1)='$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. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${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 - _LT_TAGVAR(hardcode_direct, $1)=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 - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - 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 - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. - _LT_TAGVAR(always_export_symbols, $1)=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. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$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. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$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)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-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. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=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. - _LT_TAGVAR(archive_cmds, $1)='$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. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=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*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$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*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # 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) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$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" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$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' - ) - LDFLAGS="$save_LDFLAGS" - else - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='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='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='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}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=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 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=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. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) 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. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [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]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$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);}' - -_LT_TAG_COMPILER -# 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 -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## 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_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - 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 - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$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. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # 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 - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - 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_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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 - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - 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. - _LT_TAGVAR(archive_cmds, $1)='$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 - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=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. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${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 - _LT_TAGVAR(hardcode_direct, $1)=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 - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - 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 - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. - _LT_TAGVAR(always_export_symbols, $1)=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. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$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. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${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. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$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 - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$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... - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=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 - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=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 - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$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*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='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++ - _LT_TAGVAR(archive_cmds, $1)='$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. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds, $1)='$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 - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=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. - _LT_TAGVAR(archive_cmds, $1)='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' - _LT_TAGVAR(archive_expsym_cmds, $1)='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"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$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."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='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`"' - _LT_TAGVAR(old_archive_cmds, $1)='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' - _LT_TAGVAR(archive_cmds, $1)='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' - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # 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 - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${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' - _LT_TAGVAR(compiler_needs_object, $1)=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. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=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*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=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. - _LT_TAGVAR(archive_cmds, $1)='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' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$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' - _LT_TAGVAR(archive_expsym_cmds, $1)='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' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # 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 - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$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' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$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 - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # 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 - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='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' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=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?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=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. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$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. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='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. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='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 - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$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 - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$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... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - 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_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF -package foo -func foo() { } -_LT_EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); 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 "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${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 "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[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. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -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 - _LT_TAGVAR(postdeps,$1)='-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 - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 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_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${F77-"f77"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - 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 - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$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... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC 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_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${FC-"f95"} - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - 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 - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$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... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## 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_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GCJ_CONFIG - -# _LT_LANG_GO_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Go compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GO_CONFIG], -[AC_REQUIRE([LT_PROG_GO])dnl -AC_LANG_SAVE - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC="$GCC" -GCC=yes -CC=${GOC-"gccgo"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# Go did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds - -## 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_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GO_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC="$lt_save_CC" -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - -# LT_PROG_GO -# ----------- -AC_DEFUN([LT_PROG_GO], -[AC_CHECK_TOOL(GOC, gccgo,) -]) - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# 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 -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# 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 -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[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"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# 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 -]) diff --git a/llgo/third_party/gofrontend/libgo/config/ltmain.sh b/llgo/third_party/gofrontend/libgo/config/ltmain.sh deleted file mode 100644 index ce66b44906a2cd23eeaccb35bdfe6843305021a6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/ltmain.sh +++ /dev/null @@ -1,8636 +0,0 @@ -# Generated from ltmain.m4sh. - -# libtool (GNU libtool 1.3134 2009-11-29) 2.2.7a -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# 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. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --no-finish let install mode avoid finish commands -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool 1.3134 2009-11-29) 2.2.7a -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . - -PROGRAM=libtool -PACKAGE=libtool -VERSION=2.2.7a -TIMESTAMP=" 1.3134 2009-11-29" -package_revision=1.3134 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs 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 -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done - -$lt_unset CDPATH - - - - - - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -: ${ECHO=$as_echo} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/mount/endor/wildenhu/local-x86_64/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# 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 () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} - -# Generated shell functions inserted here. - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname${mode+: }$mode: $*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - - - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# // - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $SED -n '/^# Usage:/,/^# *-h/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $SED -n '/^# Usage:/,/# Report bugs to/ { - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - }' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - func_error "missing argument for $1" - exit_cmd=exit -} - -exit_cmd=: - - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -# $mode is unset -nonopt= -execute_dlfiles= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -opt_dry_run=false -opt_finish=: -opt_duplicate_deps=false -opt_silent=false -opt_debug=: - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - --no-finish) opt_finish=false ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - opt_verbose=false - ;; - - --no-quiet|--no-silent) - preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - opt_verbose=: - ;; - - --no-verbose) preserve_args="$preserve_args $opt" - opt_verbose=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --help-all) opt_help=': help-all' ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* ) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval "std_shrext=\"$shrext_cmds\"" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval "cmd=\"$cmd\"" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T <?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - removelist="$removelist $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - if test -n "$fix_srcfile_path"; then - eval "srcfile=\"$fix_srcfile_path\"" - fi - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval test -z \"\$$shlibpath_var\"; then - eval $shlibpath_var=\$dir - else - eval $shlibpath_var=\$dir:\$$shlibpath_var - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval "flag=\"$hardcode_libdir_flag_spec\"" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS -} - -test "$mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - install_shared_prog="$install_shared_prog $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs" && $opt_finish; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - $EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - ${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols" - case $host in - *cygwin* | *mingw* | *cegcc* ) - echo EXPORTS > "$output_objdir/$outputname.def" - cat "$export_symbols" >> "$output_objdir/$outputname.def" - ;; - esac - } - else - $opt_dry_run || { - ${SED} -e 's/\([].[*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/' < "$export_symbols" > "$output_objdir/$outputname.exp" - $GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - case $host in - *cygwin* | *mingw* | *cegcc* ) - echo EXPORTS > "$output_objdir/$outputname.def" - cat "$nlist" >> "$output_objdir/$outputname.def" - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - $opt_dry_run || { - $ECHO ": $name " >> "$nlist" - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - echo >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - echo >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - if $OBJDUMP -f "$1" | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - win32_nmres=`$NM -f posix -A "$1" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs 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 -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# 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 - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi\ - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \"\$relink_command\" 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_result=`cygpath -w "$1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result= - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_pathlist_tmp1=$func_stripname_result - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - func_to_host_pathlist_result=` - ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_append func_to_host_pathlist_result ";$func_to_host_path_result" - fi - fi - fi - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result"; then - func_error "Could not determine the host path(s) corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_append func_to_host_pathlist_result ";" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#undef LTWRAPPER_DEBUGPRINTF -#if defined LT_DEBUGWRAPPER -# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args -static void -ltwrapper_debugprintf (const char *fmt, ...) -{ - va_list args; - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); -} -#else -# define LTWRAPPER_DEBUGPRINTF(args) -#endif - -const char *program_name = NULL; - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_fatal (const char *message, ...); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <"))); - for (i = 0; i < newargc; i++) - { - LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : ""))); - } - -EOF - - case $host_os in - mingw*) - cat <<"EOF" - /* execv doesn't actually work on mingw as expected on unix */ - newargz = prepare_spawn (newargz); - rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz); - if (rval == -1) - { - /* failed to start process */ - LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno)); - return 127; - } - return rval; -EOF - ;; - *) - cat <<"EOF" - execv (lt_argv_zero, newargz); - return rval; /* =127, but avoids unused variable warning */ -EOF - ;; - esac - - cat <<"EOF" -} - -void * -xmalloc (size_t num) -{ - void *p = (void *) malloc (num); - if (!p) - lt_fatal ("Memory exhausted"); - - return p; -} - -char * -xstrdup (const char *string) -{ - return string ? strcpy ((char *) xmalloc (strlen (string) + 1), - string) : NULL; -} - -const char * -base_name (const char *name) -{ - const char *base; - -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - /* Skip over the disk name in MSDOS pathnames. */ - if (isalpha ((unsigned char) name[0]) && name[1] == ':') - name += 2; -#endif - - for (base = name; *name; name++) - if (IS_DIR_SEPARATOR (*name)) - base = name + 1; - return base; -} - -int -check_executable (const char *path) -{ - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if ((stat (path, &st) >= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n", - path ? (*path ? path : "EMPTY!") : "NULL!")); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - LTWRAPPER_DEBUGPRINTF (("(find_executable) : %s\n", - wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!")); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal ("getcwd failed"); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n", - tmp_pathspec)); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - char *errstr = strerror (errno); - lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal ("Could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -static void -lt_error_core (int exit_status, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s: %s: ", program_name, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, "FATAL", message, ap); - va_end (ap); -} - -void -lt_setenv (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n", - (name ? name : ""), - (value ? value : ""))); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - (name ? name : ""), - (value ? value : ""))); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval "$file_magic_cmd \"\$1\" 2>/dev/null" | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - weak_libs="$weak_libs $arg" - prev= - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - *-*-linux*) - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # -64, -mips[0-9] enable 64-bit mode on the SGI compiler - # -r[0-9][0-9]* specifies the processor on the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler - # +DA*, +DD* enable 64-bit mode on the HP compiler - # -q* pass through compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* pass through architecture-specific - # compiler args for GCC - # -F/path gives path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval "arg=\"$export_dynamic_flag_spec\"" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval "sys_lib_search_path=\"$sys_lib_search_path_spec\"" - eval "sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_duplicate_deps ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - case $lib in - *.la) func_source "$lib" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - dir=$func_stripname_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - eval "libname=\"$libname_spec\"" - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval "soname=\"$soname_spec\"" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_dirname "$deplib" "" "." - dir="$func_dirname_result" - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\$$var - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\$tmp_libs - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval "shared_ext=\"$shrext_cmds\"" - eval "libname=\"$libname_spec\"" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval "shared_ext=\"$shrext_cmds\"" - eval "libname=\"$libname_spec\"" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval "$file_magic_cmd \"\$potlib\"" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - eval "libname=\"$libname_spec\"" - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval "flag=\"$hardcode_libdir_flag_spec\"" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval "dep_rpath=\"$hardcode_libdir_flag_spec_ld\"" - else - eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval $runpath_var=\$rpath\$$runpath_var - export $runpath_var - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval $shlibpath_var=\$shlibpath\$$shlibpath_var - export $shlibpath_var - fi - - # Get the real and link names of the library. - eval "shared_ext=\"$shrext_cmds\"" - eval "library_names=\"$library_names_spec\"" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval "soname=\"$soname_spec\"" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval "cmd=\"$cmd\"" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols" - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval "libobjs=\"\$libobjs $whole_archive_flag_spec\"" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval "flag=\"$thread_safe_flag_spec\"" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $opt_dry_run || (cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U) || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval "test_cmds=\"$module_expsym_cmds\"" - cmds=$module_expsym_cmds - else - eval "test_cmds=\"$module_cmds\"" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval "test_cmds=\"$archive_expsym_cmds\"" - cmds=$archive_expsym_cmds - else - eval "test_cmds=\"$archive_cmds\"" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - $ECHO "$obj" >> $output - done - echo ')' >> $output - delfiles="$delfiles $output" - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - $ECHO "$obj" >> $output - done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval "test_cmds=\"$reload_cmds\"" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval "concat_cmds=\"$reload_cmds\"" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval "concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval "concat_cmds=\"\${concat_cmds}$reload_cmds\"" - if test -n "$last_robj"; then - eval "concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"" - fi - delfiles="$delfiles $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval "concat_cmds=\"\$concat_cmds$export_symbols_cmds\"" - if test -n "$last_robj"; then - eval "concat_cmds=\"\$concat_cmds~\$RM $last_robj\"" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols" - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval "libobjs=\"\$libobjs $whole_archive_flag_spec\"" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval "cmds=\"\$cmds~\$RM $delfiles\"" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval "cmd=\"$cmd\"" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $opt_dry_run || (cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname) || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval "tmp_whole_archive_flags=\"$whole_archive_flag_spec\"" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || echo timestamp > $libobj || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval "flag=\"$hardcode_libdir_flag_spec\"" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "rpath=\" $hardcode_libdir_flag_spec\"" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval "flag=\"$hardcode_libdir_flag_spec\"" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "rpath=\" $hardcode_libdir_flag_spec\"" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval "cmds=\"$old_archive_cmds\"" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval "test_cmds=\"$old_archive_cmds\"" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval "concat_cmds=\"\${concat_cmds}$old_archive_cmds\"" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval "cmds=\"\$concat_cmds\"" - else - eval "cmds=\"\$concat_cmds~\$old_archive_cmds\"" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" - ;; - *) newdlfiles="$newdlfiles $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$mode" = link || test "$mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$mode" = uninstall || test "$mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/llgo/third_party/gofrontend/libgo/config/ltoptions.m4 b/llgo/third_party/gofrontend/libgo/config/ltoptions.m4 deleted file mode 100644 index 5ef12ced2a81d6b6da1d643222fbce41ec4482f1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/ltoptions.m4 +++ /dev/null @@ -1,369 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# 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 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - -## --------------------------------- ## -## Macros to handle LT_INIT options. ## -## --------------------------------- ## - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [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], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [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], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [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], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - -## ----------------- ## -## LTDL_INIT Options ## -## ----------------- ## - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/llgo/third_party/gofrontend/libgo/config/ltsugar.m4 b/llgo/third_party/gofrontend/libgo/config/ltsugar.m4 deleted file mode 100644 index 9000a057d31ddf75cb85ccda8757de4493bcdbe7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# 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 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/llgo/third_party/gofrontend/libgo/config/ltversion.m4 b/llgo/third_party/gofrontend/libgo/config/ltversion.m4 deleted file mode 100644 index bf87f77132d122e2ad60ce0ca7f62a518099ec6c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/ltversion.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# 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. - -# Generated from ltversion.in. - -# serial 3134 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.2.7a]) -m4_define([LT_PACKAGE_REVISION], [1.3134]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.7a' -macro_revision='1.3134' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) diff --git a/llgo/third_party/gofrontend/libgo/config/lt~obsolete.m4 b/llgo/third_party/gofrontend/libgo/config/lt~obsolete.m4 deleted file mode 100644 index bf92b5e0790a4b1d39cc75ce05c4df4d24e87e01..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/config/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# 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 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/llgo/third_party/gofrontend/libgo/configure b/llgo/third_party/gofrontend/libgo/configure deleted file mode 100755 index e024b2f4b6294681f36184008fbd0bc2ad9c6bb0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/configure +++ /dev/null @@ -1,18345 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.64 for package-unused version-unused. -# -# 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 &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='package-unused' -PACKAGE_TARNAME='libgo' -PACKAGE_VERSION='version-unused' -PACKAGE_STRING='package-unused version-unused' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_unique_file="Makefile.am" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='am__EXEEXT_FALSE -am__EXEEXT_TRUE -LTLIBOBJS -LIBOBJS -HAVE_STAT_TIMESPEC_FALSE -HAVE_STAT_TIMESPEC_TRUE -STRUCT_EPOLL_EVENT_FD_OFFSET -SIZEOF_STRUCT_EPOLL_EVENT -MATH_FLAG -STRINGOPS_FLAG -HAVE_WAIT4_FALSE -HAVE_WAIT4_TRUE -HAVE_STRERROR_R_FALSE -HAVE_STRERROR_R_TRUE -HAVE_SYS_MMAN_H_FALSE -HAVE_SYS_MMAN_H_TRUE -PTHREAD_LIBS -PTHREAD_CFLAGS -NET_LIBS -MATH_LIBS -GOC_IS_LLGO_FALSE -GOC_IS_LLGO_TRUE -GO_SPLIT_STACK -USING_SPLIT_STACK_FALSE -USING_SPLIT_STACK_TRUE -SPLIT_STACK -OSCFLAGS -GO_SYSCALL_OS_ARCH_FILE -GO_SYSCALL_OS_FILE -GO_LIBCALL_OS_ARCH_FILE -GO_LIBCALL_OS_FILE -GOARCH -LIBGO_IS_X86_64_FALSE -LIBGO_IS_X86_64_TRUE -LIBGO_IS_SPARC64_FALSE -LIBGO_IS_SPARC64_TRUE -LIBGO_IS_SPARC_FALSE -LIBGO_IS_SPARC_TRUE -LIBGO_IS_S390X_FALSE -LIBGO_IS_S390X_TRUE -LIBGO_IS_S390_FALSE -LIBGO_IS_S390_TRUE -LIBGO_IS_PPC64LE_FALSE -LIBGO_IS_PPC64LE_TRUE -LIBGO_IS_PPC64_FALSE -LIBGO_IS_PPC64_TRUE -LIBGO_IS_PPC_FALSE -LIBGO_IS_PPC_TRUE -LIBGO_IS_MIPSO64_FALSE -LIBGO_IS_MIPSO64_TRUE -LIBGO_IS_MIPSN64_FALSE -LIBGO_IS_MIPSN64_TRUE -LIBGO_IS_MIPSN32_FALSE -LIBGO_IS_MIPSN32_TRUE -LIBGO_IS_MIPSO32_FALSE -LIBGO_IS_MIPSO32_TRUE -LIBGO_IS_MIPS_FALSE -LIBGO_IS_MIPS_TRUE -LIBGO_IS_M68K_FALSE -LIBGO_IS_M68K_TRUE -LIBGO_IS_ARM64_FALSE -LIBGO_IS_ARM64_TRUE -LIBGO_IS_ARM_FALSE -LIBGO_IS_ARM_TRUE -LIBGO_IS_ALPHA_FALSE -LIBGO_IS_ALPHA_TRUE -LIBGO_IS_386_FALSE -LIBGO_IS_386_TRUE -USE_DEJAGNU -GOOS -LIBGO_IS_SOLARIS_FALSE -LIBGO_IS_SOLARIS_TRUE -LIBGO_IS_RTEMS_FALSE -LIBGO_IS_RTEMS_TRUE -LIBGO_IS_DRAGONFLY_FALSE -LIBGO_IS_DRAGONFLY_TRUE -LIBGO_IS_OPENBSD_FALSE -LIBGO_IS_OPENBSD_TRUE -LIBGO_IS_NETBSD_FALSE -LIBGO_IS_NETBSD_TRUE -LIBGO_IS_LINUX_FALSE -LIBGO_IS_LINUX_TRUE -LIBGO_IS_IRIX_FALSE -LIBGO_IS_IRIX_TRUE -LIBGO_IS_FREEBSD_FALSE -LIBGO_IS_FREEBSD_TRUE -LIBGO_IS_DARWIN_FALSE -LIBGO_IS_DARWIN_TRUE -go_include -LIBATOMIC -LIBFFIINCS -LIBFFI -nover_glibgo_toolexeclibdir -glibgo_toolexeclibdir -glibgo_toolexecdir -WERROR -WARN_FLAGS -CC_FOR_BUILD -enable_static -enable_shared -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LIBTOOL -OBJCOPY -RANLIB -LD -FGREP -EGREP -GREP -SED -MAINT -MAINTAINER_MODE_FALSE -MAINTAINER_MODE_TRUE -GOCFLAGS -GOC -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -am__nodep -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_os -target_vendor -target_cpu -target -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -multi_basedir -libtool_VERSION -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_multilib -enable_dependency_tracking -enable_maintainer_mode -with_gnu_ld -enable_shared -enable_static -with_pic -enable_fast_install -enable_libtool_lock -enable_werror -enable_version_specific_runtime_libs -with_libffi -with_libatomic -with_system_libunwind -' - ac_precious_vars='build_alias -host_alias -target_alias -CPP -CPPFLAGS' - - -# 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 package-unused version-unused 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/libgo] - --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 package-unused version-unused:";; - 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-multilib build many library versions (default) - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-maintainer-mode enable make rules and dependencies not useful - (and sometimes confusing) to the casual installer - --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) - --enable-werror turns on -Werror [default=yes] - --enable-version-specific-runtime-libs - Specify that runtime libraries should be installed - in a compiler-specific directory - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --without-libffi don't use libffi - --without-libatomic don't use libatomic - --with-system-libunwind use installed libunwind - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - GOC Go compiler command - GOCFLAGS Go compiler flags - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -package-unused configure version-unused -generated by GNU Autoconf 2.64 - -Copyright (C) 2009 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - return $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_func - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - 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 - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=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 -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_type - -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 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 package-unused $as_me version-unused, 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_config_headers="$ac_config_headers config.h" - - -libtool_VERSION=8:0:0 - - -# 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" - - -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='libgo' - VERSION='version-unused' - - -# 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. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AMTAR='$${TAR-tar}' - -am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "no acceptable C compiler found in \$PATH -See \`config.log' for more details." "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - rm -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -if test -z "$ac_file"; then : - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ as_fn_set_status 77 -as_fn_error "C compiler cannot create executables -See \`config.log' for more details." "$LINENO" 5; }; } -fi -ac_exeext=$ac_cv_exeext - -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out -ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "cannot compute suffix of object files: cannot compile -See \`config.log' for more details." "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from `make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -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'. - rm -rf conftest.dir - 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 - ;; - msvc7 | msvc7msys | 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=go -ac_compile='$GOC -c $GOCFLAGS conftest.$ac_ext >&5' -ac_link='$GOC -o conftest$ac_exeext $GOCFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compile_gnu=yes -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gccgo", so it can be a program name with args. -set dummy ${ac_tool_prefix}gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GOC"; then - ac_cv_prog_GOC="$GOC" # 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_GOC="${ac_tool_prefix}gccgo" - $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 -GOC=$ac_cv_prog_GOC -if test -n "$GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GOC" >&5 -$as_echo "$GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_GOC"; then - ac_ct_GOC=$GOC - # Extract the first word of "gccgo", so it can be a program name with args. -set dummy gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_GOC"; then - ac_cv_prog_ac_ct_GOC="$ac_ct_GOC" # 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_GOC="gccgo" - $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_GOC=$ac_cv_prog_ac_ct_GOC -if test -n "$ac_ct_GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GOC" >&5 -$as_echo "$ac_ct_GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_GOC" = x; then - GOC="" - 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 - GOC=$ac_ct_GOC - fi -else - GOC="$ac_cv_prog_GOC" -fi - -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gccgo", so it can be a program name with args. -set dummy ${ac_tool_prefix}gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GOC"; then - ac_cv_prog_GOC="$GOC" # 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_GOC="$ac_tool_prefix}gccgo" - $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 -GOC=$ac_cv_prog_GOC -if test -n "$GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GOC" >&5 -$as_echo "$GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$GOC"; then - # Extract the first word of "gccgo", so it can be a program name with args. -set dummy gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GOC"; then - ac_cv_prog_GOC="$GOC" # 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" = "gccgo"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_GOC="gccgo" - $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_GOC - 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 GOC to just the basename; use the full file name. - shift - ac_cv_prog_GOC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -GOC=$ac_cv_prog_GOC -if test -n "$GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GOC" >&5 -$as_echo "$GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi - - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for Go compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -{ { ac_try="$ac_compiler --version >&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 --version >&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; } -GOCFLAGS="-g -O2" -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 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 - - - -{ $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 - - - - - - - - - - - - - - - - - -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 - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if test "${lt_cv_path_LD+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if test "${lt_cv_prog_gnu_ld+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -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 - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. -set dummy ${ac_tool_prefix}objcopy; 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_OBJCOPY+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJCOPY"; then - ac_cv_prog_OBJCOPY="$OBJCOPY" # 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_OBJCOPY="${ac_tool_prefix}objcopy" - $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 -OBJCOPY=$ac_cv_prog_OBJCOPY -if test -n "$OBJCOPY"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCOPY" >&5 -$as_echo "$OBJCOPY" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJCOPY"; then - ac_ct_OBJCOPY=$OBJCOPY - # Extract the first word of "objcopy", so it can be a program name with args. -set dummy objcopy; 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_OBJCOPY+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJCOPY"; then - ac_cv_prog_ac_ct_OBJCOPY="$ac_ct_OBJCOPY" # 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_OBJCOPY="objcopy" - $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_OBJCOPY=$ac_cv_prog_ac_ct_OBJCOPY -if test -n "$ac_ct_OBJCOPY"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJCOPY" >&5 -$as_echo "$ac_ct_OBJCOPY" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJCOPY" = x; then - OBJCOPY="missing-objcopy" - 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 - OBJCOPY=$ac_ct_OBJCOPY - fi -else - OBJCOPY="$ac_cv_prog_OBJCOPY" -fi - - -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' - -{ $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 to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -eval as_val=\$$as_ac_Header - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gccgo", so it can be a program name with args. -set dummy ${ac_tool_prefix}gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$GOC"; then - ac_cv_prog_GOC="$GOC" # 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_GOC="${ac_tool_prefix}gccgo" - $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 -GOC=$ac_cv_prog_GOC -if test -n "$GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GOC" >&5 -$as_echo "$GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_GOC"; then - ac_ct_GOC=$GOC - # Extract the first word of "gccgo", so it can be a program name with args. -set dummy gccgo; 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_GOC+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_GOC"; then - ac_cv_prog_ac_ct_GOC="$ac_ct_GOC" # 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_GOC="gccgo" - $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_GOC=$ac_cv_prog_ac_ct_GOC -if test -n "$ac_ct_GOC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_GOC" >&5 -$as_echo "$ac_ct_GOC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_GOC" = x; then - GOC="" - 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 - GOC=$ac_ct_GOC - fi -else - GOC="$ac_cv_prog_GOC" -fi - - - - - - -# 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 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.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`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 11127 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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 11233 "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* 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" - - - - - - - - - - - - - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -objext_GO=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# 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_GCC="$GCC" -GCC=yes -CC=${GOC-"gccgo"} -compiler=$CC -compiler_GO=$CC -LD_GO="$LD" -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-%%"` - - -# Go did not exist at the time GCC didn't implicitly link libc in. -archive_cmds_need_lc_GO=no - -old_archive_cmds_GO=$old_archive_cmds - -## 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_GO= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag_GO=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag_GO=' -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_GO="$lt_prog_compiler_no_builtin_flag_GO -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - lt_prog_compiler_wl_GO= -lt_prog_compiler_pic_GO= -lt_prog_compiler_static_GO= - -{ $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_GO='-Wl,' - lt_prog_compiler_static_GO='-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_GO='-Bstatic' - fi - lt_prog_compiler_pic_GO='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_GO='-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_GO='-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_GO='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_GO='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_GO= - ;; - - 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_GO='-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_GO=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_GO='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_GO=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic_GO='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl_GO='-Xlinker ' - lt_prog_compiler_pic_GO='-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_GO='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_GO='-Bstatic' - else - lt_prog_compiler_static_GO='-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_GO='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl_GO='-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_GO='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static_GO='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl_GO='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static_GO='-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_GO='-Wl,' - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_pic_GO='-fPIC' - lt_prog_compiler_static_GO='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_pic_GO='--shared' - lt_prog_compiler_static_GO='--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_GO='-Wl,' - lt_prog_compiler_pic_GO='-fpic' - lt_prog_compiler_static_GO='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl_GO='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static_GO='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_pic_GO='-qpic' - lt_prog_compiler_static_GO='-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_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - lt_prog_compiler_wl_GO='' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - lt_prog_compiler_wl_GO='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_GO='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl_GO='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static_GO='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static_GO='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - case $cc_basename in - f77* | f90* | f95*) - lt_prog_compiler_wl_GO='-Qoption ld ';; - *) - lt_prog_compiler_wl_GO='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl_GO='-Qoption ld ' - lt_prog_compiler_pic_GO='-PIC' - lt_prog_compiler_static_GO='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic_GO='-Kconform_pic' - lt_prog_compiler_static_GO='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_pic_GO='-KPIC' - lt_prog_compiler_static_GO='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl_GO='-Wl,' - lt_prog_compiler_can_build_shared_GO=no - ;; - - uts4*) - lt_prog_compiler_pic_GO='-pic' - lt_prog_compiler_static_GO='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared_GO=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_GO= - ;; - *) - lt_prog_compiler_pic_GO="$lt_prog_compiler_pic_GO" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_GO" >&5 -$as_echo "$lt_prog_compiler_pic_GO" >&6; } - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_GO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_GO works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GO works... " >&6; } -if test "${lt_cv_prog_compiler_pic_works_GO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works_GO=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_GO" - # 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_GO=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_GO" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_GO" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works_GO" = xyes; then - case $lt_prog_compiler_pic_GO in - "" | " "*) ;; - *) lt_prog_compiler_pic_GO=" $lt_prog_compiler_pic_GO" ;; - esac -else - lt_prog_compiler_pic_GO= - lt_prog_compiler_can_build_shared_GO=no -fi - -fi - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_GO eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GO\" -{ $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_GO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works_GO=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_GO=yes - fi - else - lt_cv_prog_compiler_static_works_GO=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_GO" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_GO" >&6; } - -if test x"$lt_cv_prog_compiler_static_works_GO" = xyes; then - : -else - lt_prog_compiler_static_GO= -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_GO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_GO=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_GO=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_GO" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_GO" >&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_GO+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_GO=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_GO=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_GO" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_GO" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_GO" = 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_GO= - always_export_symbols_GO=no - archive_cmds_GO= - archive_expsym_cmds_GO= - compiler_needs_object_GO=no - enable_shared_with_static_runtimes_GO=no - export_dynamic_flag_spec_GO= - export_symbols_cmds_GO='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic_GO=no - hardcode_direct_GO=no - hardcode_direct_absolute_GO=no - hardcode_libdir_flag_spec_GO= - hardcode_libdir_flag_spec_ld_GO= - hardcode_libdir_separator_GO= - hardcode_minus_L_GO=no - hardcode_shlibpath_var_GO=unsupported - inherit_rpath_GO=no - link_all_deplibs_GO=unknown - module_cmds_GO= - module_expsym_cmds_GO= - old_archive_from_new_cmds_GO= - old_archive_from_expsyms_cmds_GO= - thread_safe_flag_spec_GO= - whole_archive_flag_spec_GO= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms_GO= - # 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_GO='_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_GO=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_GO='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_GO='${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_GO="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_GO= - 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_GO=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_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='' - ;; - m68k) - archive_cmds_GO='$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_GO='-L$libdir' - hardcode_minus_L_GO=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_GO=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_GO='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_GO=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, GO) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_GO='-L$libdir' - export_dynamic_flag_spec_GO='${wl}--export-all-symbols' - allow_undefined_flag_GO=unsupported - always_export_symbols_GO=no - enable_shared_with_static_runtimes_GO=yes - export_symbols_cmds_GO='$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_GO='$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_GO='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_GO=no - fi - ;; - - haiku*) - archive_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs_GO=yes - ;; - - interix[3-9]*) - hardcode_direct_GO=no - hardcode_shlibpath_var_GO=no - hardcode_libdir_flag_spec_GO='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GO='${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_GO='$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_GO='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_GO='${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_GO='${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_GO= - 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_GO='${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_GO=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec_GO='${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_GO=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds_GO='$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_GO='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_GO='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec_GO= - hardcode_libdir_flag_spec_ld_GO='-rpath $libdir' - archive_cmds_GO='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds_GO='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_GO=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_GO='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='$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_GO=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_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GO=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs_GO=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_GO='${wl}-rpath ${wl}$libdir' - archive_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GO=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds_GO='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs_GO=no - fi - ;; - esac - - if test "$ld_shlibs_GO" = no; then - runpath_var= - hardcode_libdir_flag_spec_GO= - export_dynamic_flag_spec_GO= - whole_archive_flag_spec_GO= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag_GO=unsupported - always_export_symbols_GO=yes - archive_expsym_cmds_GO='$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_GO=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_GO=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_GO='$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_GO='$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_GO='' - hardcode_direct_GO=yes - hardcode_direct_absolute_GO=yes - hardcode_libdir_separator_GO=':' - link_all_deplibs_GO=yes - file_list_spec_GO='${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_GO=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_GO=yes - hardcode_libdir_flag_spec_GO='-L$libdir' - hardcode_libdir_separator_GO= - 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_GO='${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_GO=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_GO='-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_GO='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_GO='$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_GO='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_GO="-z nodefs" - archive_expsym_cmds_GO="\$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_GO='${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_GO=' ${wl}-bernotok' - allow_undefined_flag_GO=' ${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_GO='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_GO='$convenience' - fi - archive_cmds_need_lc_GO=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds_GO="\$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_GO='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_GO='' - ;; - m68k) - archive_cmds_GO='$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_GO='-L$libdir' - hardcode_minus_L_GO=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec_GO=-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_GO=' ' - allow_undefined_flag_GO=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_GO='$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_GO='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds_GO='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path_GO='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes_GO=yes - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc_GO=no - hardcode_direct_GO=no - hardcode_automatic_GO=yes - hardcode_shlibpath_var_GO=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec_GO='`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_GO='' - fi - link_all_deplibs_GO=yes - allow_undefined_flag_GO="$_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_GO="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_GO="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_GO="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_GO="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_GO=no - fi - - ;; - - dgux*) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GO='-L$libdir' - hardcode_shlibpath_var_GO=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_GO='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec_GO='-R$libdir' - hardcode_direct_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - archive_cmds_GO='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GO=yes - hardcode_minus_L_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds_GO='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GO='-R$libdir' - hardcode_direct_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds_GO='$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_GO='$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_GO='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GO=: - hardcode_direct_GO=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GO=yes - export_dynamic_flag_spec_GO='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds_GO='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GO='$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_GO='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld_GO='+b $libdir' - hardcode_libdir_separator_GO=: - hardcode_direct_GO=yes - hardcode_direct_absolute_GO=yes - export_dynamic_flag_spec_GO='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GO=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds_GO='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GO='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GO='$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_GO='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds_GO='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_GO='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec_GO='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_GO=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_GO=no - hardcode_shlibpath_var_GO=no - ;; - *) - hardcode_direct_GO=yes - hardcode_direct_absolute_GO=yes - export_dynamic_flag_spec_GO='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L_GO=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds_GO='$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_GO='$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_GO='$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_GO='$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_GO='no' - hardcode_libdir_flag_spec_GO='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GO=: - inherit_rpath_GO=yes - link_all_deplibs_GO=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_GO='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds_GO='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec_GO='-R$libdir' - hardcode_direct_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - newsos6) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GO=yes - hardcode_libdir_flag_spec_GO='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GO=: - hardcode_shlibpath_var_GO=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_GO=yes - hardcode_shlibpath_var_GO=no - hardcode_direct_absolute_GO=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds_GO='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec_GO='${wl}-rpath,$libdir' - export_dynamic_flag_spec_GO='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds_GO='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GO='-R$libdir' - ;; - *) - archive_cmds_GO='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec_GO='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs_GO=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec_GO='-L$libdir' - hardcode_minus_L_GO=yes - allow_undefined_flag_GO=unsupported - archive_cmds_GO='$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_GO='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag_GO=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GO='$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_GO=' -expect_unresolved \*' - archive_cmds_GO='$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_GO='no' - hardcode_libdir_flag_spec_GO='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_GO=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag_GO=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_GO='$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_GO='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag_GO=' -expect_unresolved \*' - archive_cmds_GO='$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_GO='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_GO='-rpath $libdir' - fi - archive_cmds_need_lc_GO='no' - hardcode_libdir_separator_GO=: - ;; - - solaris*) - no_undefined_flag_GO=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds_GO='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='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_GO='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds_GO='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_GO='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='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_GO='-R$libdir' - hardcode_shlibpath_var_GO=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_GO='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec_GO='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs_GO=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_GO='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GO='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec_GO='-L$libdir' - hardcode_direct_GO=yes - hardcode_minus_L_GO=yes - hardcode_shlibpath_var_GO=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GO=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds_GO='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds_GO='$CC -r -o $output$reload_objs' - hardcode_direct_GO=no - ;; - motorola) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct_GO=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var_GO=no - ;; - - sysv4.3*) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GO=no - export_dynamic_flag_spec_GO='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var_GO=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs_GO=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_GO='${wl}-z,text' - archive_cmds_need_lc_GO=no - hardcode_shlibpath_var_GO=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GO='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GO='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='$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_GO='${wl}-z,text' - allow_undefined_flag_GO='${wl}-z,nodefs' - archive_cmds_need_lc_GO=no - hardcode_shlibpath_var_GO=no - hardcode_libdir_flag_spec_GO='${wl}-R,$libdir' - hardcode_libdir_separator_GO=':' - link_all_deplibs_GO=yes - export_dynamic_flag_spec_GO='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds_GO='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds_GO='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_GO='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds_GO='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec_GO='-L$libdir' - hardcode_shlibpath_var_GO=no - ;; - - *) - ld_shlibs_GO=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec_GO='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_GO" >&5 -$as_echo "$ld_shlibs_GO" >&6; } -test "$ld_shlibs_GO" = no && can_build_shared=no - -with_gnu_ld_GO=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_GO" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_GO=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_GO 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_GO+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_GO - pic_flag=$lt_prog_compiler_pic_GO - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_GO - allow_undefined_flag_GO= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_GO 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_GO 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_GO=no - else - lt_cv_archive_cmds_need_lc_GO=yes - fi - allow_undefined_flag_GO=$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_GO" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_GO" >&6; } - archive_cmds_need_lc_GO=$lt_cv_archive_cmds_need_lc_GO - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $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_GO= -if test -n "$hardcode_libdir_flag_spec_GO" || - test -n "$runpath_var_GO" || - test "X$hardcode_automatic_GO" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct_GO" != 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, GO)" != no && - test "$hardcode_minus_L_GO" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_GO=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_GO=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_GO=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_GO" >&5 -$as_echo "$hardcode_action_GO" >&6; } - -if test "$hardcode_action_GO" = relink || - test "$inherit_rpath_GO" = 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 - -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 - - -GCC=$lt_save_GCC -CC="$lt_save_CC" - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - - - -CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} - - -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 - - -WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' - - -# Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : - enableval=$enable_werror; -fi - -if test "x$enable_werror" != "xno"; then - WERROR="-Werror" -fi - - -glibgo_toolexecdir=no -glibgo_toolexeclibdir=no - -{ $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) version_specific_libs=yes ;; - no) version_specific_libs=no ;; - *) as_fn_error "Unknown argument to enable/disable version-specific libs" "$LINENO" 5;; - esac -else - version_specific_libs=no -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5 -$as_echo "$version_specific_libs" >&6; } - -# Version-specific runtime libs processing. -if test $version_specific_libs = yes; then - glibgo_toolexecdir='${libdir}/gcc/${host_alias}' - glibgo_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' -fi - -# Calculate glibgo_toolexecdir, glibgo_toolexeclibdir -# Install a library built with a cross compiler in tooldir, not libdir. -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - nover_glibgo_toolexecdir='${exec_prefix}/${host_alias}' - nover_glibgo_toolexeclibdir='${toolexecdir}/lib' -else - nover_glibgo_toolexecdir='${libdir}/gcc/${host_alias}' - nover_glibgo_toolexeclibdir='${libdir}' -fi -multi_os_directory=`$GOC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) nover_glibgo_toolexeclibdir=${nover_glibgo_toolexeclibdir}/${multi_os_directory} ;; -esac - -if test x"$glibgo_toolexecdir" = x"no"; then - glibgo_toolexecdir="${nover_glibgo_toolexecdir}" - glibgo_toolexeclibdir="${nover_glibgo_toolexeclibdir}" -fi - - - - - -# See if the user wants to configure without libffi. Some -# architectures don't support it. FIXME: We should set a default -# based on the host. - -# Check whether --with-libffi was given. -if test "${with_libffi+set}" = set; then : - withval=$with_libffi; : -else - with_libffi=${with_libffi_default-yes} -fi - - -LIBFFI= -LIBFFIINCS= -if test "$with_libffi" != no; then - -$as_echo "#define USE_LIBFFI 1" >>confdefs.h - - LIBFFI=../libffi/libffi_convenience.la - LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include' -fi - - - -# See if the user wants to configure without libatomic. This is useful if we are -# on an architecture for which libgo does not need an atomic support library and -# libatomic does not support our C compiler. - -# Check whether --with-libatomic was given. -if test "${with_libatomic+set}" = set; then : - withval=$with_libatomic; : -else - with_libatomic=${with_libatomic_default-yes} -fi - - -LIBATOMIC= -if test "$with_libatomic" != no; then - LIBATOMIC=../libatomic/libatomic_convenience.la -fi - - -# Used to tell GNU make to include a file without telling automake to -# include it. -go_include="-include" - - -is_darwin=no -is_freebsd=no -is_irix=no -is_linux=no -is_netbsd=no -is_openbsd=no -is_dragonfly=no -is_rtems=no -is_solaris=no -GOOS=unknown -case ${host} in - *-*-darwin*) is_darwin=yes; GOOS=darwin ;; - *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;; - *-*-irix6*) is_irix=yes; GOOS=irix ;; - *-*-linux*) is_linux=yes; GOOS=linux ;; - *-*-netbsd*) is_netbsd=yes; GOOS=netbsd ;; - *-*-openbsd*) is_openbsd=yes; GOOS=openbsd ;; - *-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;; - *-*-rtems*) is_rtems=yes; GOOS=rtems ;; - *-*-solaris2*) is_solaris=yes; GOOS=solaris ;; -esac - if test $is_darwin = yes; then - LIBGO_IS_DARWIN_TRUE= - LIBGO_IS_DARWIN_FALSE='#' -else - LIBGO_IS_DARWIN_TRUE='#' - LIBGO_IS_DARWIN_FALSE= -fi - - if test $is_freebsd = yes; then - LIBGO_IS_FREEBSD_TRUE= - LIBGO_IS_FREEBSD_FALSE='#' -else - LIBGO_IS_FREEBSD_TRUE='#' - LIBGO_IS_FREEBSD_FALSE= -fi - - if test $is_irix = yes; then - LIBGO_IS_IRIX_TRUE= - LIBGO_IS_IRIX_FALSE='#' -else - LIBGO_IS_IRIX_TRUE='#' - LIBGO_IS_IRIX_FALSE= -fi - - if test $is_linux = yes; then - LIBGO_IS_LINUX_TRUE= - LIBGO_IS_LINUX_FALSE='#' -else - LIBGO_IS_LINUX_TRUE='#' - LIBGO_IS_LINUX_FALSE= -fi - - if test $is_netbsd = yes; then - LIBGO_IS_NETBSD_TRUE= - LIBGO_IS_NETBSD_FALSE='#' -else - LIBGO_IS_NETBSD_TRUE='#' - LIBGO_IS_NETBSD_FALSE= -fi - - if test $is_openbsd = yes; then - LIBGO_IS_OPENBSD_TRUE= - LIBGO_IS_OPENBSD_FALSE='#' -else - LIBGO_IS_OPENBSD_TRUE='#' - LIBGO_IS_OPENBSD_FALSE= -fi - - if test $is_dragonfly = yes; then - LIBGO_IS_DRAGONFLY_TRUE= - LIBGO_IS_DRAGONFLY_FALSE='#' -else - LIBGO_IS_DRAGONFLY_TRUE='#' - LIBGO_IS_DRAGONFLY_FALSE= -fi - - if test $is_rtems = yes; then - LIBGO_IS_RTEMS_TRUE= - LIBGO_IS_RTEMS_FALSE='#' -else - LIBGO_IS_RTEMS_TRUE='#' - LIBGO_IS_RTEMS_FALSE= -fi - - if test $is_solaris = yes; then - LIBGO_IS_SOLARIS_TRUE= - LIBGO_IS_SOLARIS_FALSE='#' -else - LIBGO_IS_SOLARIS_TRUE='#' - LIBGO_IS_SOLARIS_FALSE= -fi - - - -USE_DEJAGNU=no -case ${host} in - *-*-rtems*) USE_DEJAGNU=yes ;; - ${build}) ;; - *) USE_DEJAGNU=yes ;; -esac - - -is_386=no -is_alpha=no -is_arm=no -is_arm64=no -is_m68k=no -mips_abi=unknown -is_ppc=no -is_ppc64=no -is_ppc64le=no -is_s390=no -is_s390x=no -is_sparc=no -is_sparc64=no -is_x86_64=no -GOARCH=unknown -case ${host} in - alpha*-*-*) - is_alpha=yes - GOARCH=alpha - ;; - aarch64-*-*) - is_arm64=yes - GOARCH=arm64 - ;; - arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) - is_arm=yes - GOARCH=arm - ;; - i[34567]86-*-* | x86_64-*-*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __x86_64__ -#error 64-bit -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - is_386=yes -else - is_x86_64=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$is_386" = "yes"; then - GOARCH=386 - else - GOARCH=amd64 - fi - ;; - m68k*-*-*) - is_m68k=yes - GOARCH=m68k - ;; - mips*-*-*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if _MIPS_SIM != _ABIO32 -#error not o32 -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - mips_abi="o32" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if _MIPS_SIM != _ABIN32 -#error not n32 -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - mips_abi="n32" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if _MIPS_SIM != _ABI64 -#error not n64 -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - mips_abi="n64" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if _MIPS_SIM != _ABIO64 -#error not o64 -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - mips_abi="o64" -else - as_fn_error "unknown MIPS ABI" "$LINENO" 5 -mips_abi="n32" -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 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - case "$mips_abi" in - "o32") GOARCH=mipso32 ;; - "n32") GOARCH=mipsn32 ;; - "n64") GOARCH=mipsn64 ;; - "o64") GOARCH=mipso64 ;; - esac - ;; - rs6000*-*-* | powerpc*-*-*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef _ARCH_PPC64 -#error 64-bit -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - is_ppc=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) -#error 64be -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - is_ppc64le=yes -else - is_ppc64=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 - if test "$is_ppc" = "yes"; then - GOARCH=ppc - elif test "$is_ppc64" = "yes"; then - GOARCH=ppc64 - else - GOARCH=ppc64le - fi - ;; - s390*-*-*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if defined(__s390x__) -#error 64-bit -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - is_s390=yes -else - is_s390x=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$is_s390" = "yes"; then - GOARCH=s390 - else - GOARCH=s390x - fi - ;; - sparc*-*-*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#if defined(__sparcv9) || defined(__arch64__) -#error 64-bit -#endif -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - is_sparc=yes -else - is_sparc64=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$is_sparc" = "yes"; then - GOARCH=sparc - else - GOARCH=sparc64 - fi - ;; -esac - if test $is_386 = yes; then - LIBGO_IS_386_TRUE= - LIBGO_IS_386_FALSE='#' -else - LIBGO_IS_386_TRUE='#' - LIBGO_IS_386_FALSE= -fi - - if test $is_alpha = yes; then - LIBGO_IS_ALPHA_TRUE= - LIBGO_IS_ALPHA_FALSE='#' -else - LIBGO_IS_ALPHA_TRUE='#' - LIBGO_IS_ALPHA_FALSE= -fi - - if test $is_arm = yes; then - LIBGO_IS_ARM_TRUE= - LIBGO_IS_ARM_FALSE='#' -else - LIBGO_IS_ARM_TRUE='#' - LIBGO_IS_ARM_FALSE= -fi - - if test $is_arm64 = yes; then - LIBGO_IS_ARM64_TRUE= - LIBGO_IS_ARM64_FALSE='#' -else - LIBGO_IS_ARM64_TRUE='#' - LIBGO_IS_ARM64_FALSE= -fi - - if test $is_m68k = yes; then - LIBGO_IS_M68K_TRUE= - LIBGO_IS_M68K_FALSE='#' -else - LIBGO_IS_M68K_TRUE='#' - LIBGO_IS_M68K_FALSE= -fi - - if test $mips_abi != unknown; then - LIBGO_IS_MIPS_TRUE= - LIBGO_IS_MIPS_FALSE='#' -else - LIBGO_IS_MIPS_TRUE='#' - LIBGO_IS_MIPS_FALSE= -fi - - if test $mips_abi = o32; then - LIBGO_IS_MIPSO32_TRUE= - LIBGO_IS_MIPSO32_FALSE='#' -else - LIBGO_IS_MIPSO32_TRUE='#' - LIBGO_IS_MIPSO32_FALSE= -fi - - if test $mips_abi = n32; then - LIBGO_IS_MIPSN32_TRUE= - LIBGO_IS_MIPSN32_FALSE='#' -else - LIBGO_IS_MIPSN32_TRUE='#' - LIBGO_IS_MIPSN32_FALSE= -fi - - if test $mips_abi = n64; then - LIBGO_IS_MIPSN64_TRUE= - LIBGO_IS_MIPSN64_FALSE='#' -else - LIBGO_IS_MIPSN64_TRUE='#' - LIBGO_IS_MIPSN64_FALSE= -fi - - if test $mips_abi = o64; then - LIBGO_IS_MIPSO64_TRUE= - LIBGO_IS_MIPSO64_FALSE='#' -else - LIBGO_IS_MIPSO64_TRUE='#' - LIBGO_IS_MIPSO64_FALSE= -fi - - if test $is_ppc = yes; then - LIBGO_IS_PPC_TRUE= - LIBGO_IS_PPC_FALSE='#' -else - LIBGO_IS_PPC_TRUE='#' - LIBGO_IS_PPC_FALSE= -fi - - if test $is_ppc64 = yes; then - LIBGO_IS_PPC64_TRUE= - LIBGO_IS_PPC64_FALSE='#' -else - LIBGO_IS_PPC64_TRUE='#' - LIBGO_IS_PPC64_FALSE= -fi - - if test $is_ppc64le = yes; then - LIBGO_IS_PPC64LE_TRUE= - LIBGO_IS_PPC64LE_FALSE='#' -else - LIBGO_IS_PPC64LE_TRUE='#' - LIBGO_IS_PPC64LE_FALSE= -fi - - if test $is_s390 = yes; then - LIBGO_IS_S390_TRUE= - LIBGO_IS_S390_FALSE='#' -else - LIBGO_IS_S390_TRUE='#' - LIBGO_IS_S390_FALSE= -fi - - if test $is_s390x = yes; then - LIBGO_IS_S390X_TRUE= - LIBGO_IS_S390X_FALSE='#' -else - LIBGO_IS_S390X_TRUE='#' - LIBGO_IS_S390X_FALSE= -fi - - if test $is_sparc = yes; then - LIBGO_IS_SPARC_TRUE= - LIBGO_IS_SPARC_FALSE='#' -else - LIBGO_IS_SPARC_TRUE='#' - LIBGO_IS_SPARC_FALSE= -fi - - if test $is_sparc64 = yes; then - LIBGO_IS_SPARC64_TRUE= - LIBGO_IS_SPARC64_FALSE='#' -else - LIBGO_IS_SPARC64_TRUE='#' - LIBGO_IS_SPARC64_FALSE= -fi - - if test $is_x86_64 = yes; then - LIBGO_IS_X86_64_TRUE= - LIBGO_IS_X86_64_FALSE='#' -else - LIBGO_IS_X86_64_TRUE='#' - LIBGO_IS_X86_64_FALSE= -fi - - - -GO_LIBCALL_OS_FILE= -GO_LIBCALL_OS_ARCH_FILE= -GO_SYSCALL_OS_FILE= -GO_SYSCALL_OS_ARCH_FILE= -if test -f "${srcdir}/go/syscall/libcall_${GOOS}.go"; then - GO_LIBCALL_OS_FILE="go/syscall/libcall_${GOOS}.go" -fi -if test -f "${srcdir}/go/syscall/libcall_${GOOS}_${GOARCH}.go"; then - GO_LIBCALL_OS_ARCH_FILE="go/syscall/libcall_${GOOS}_${GOARCH}.go" -fi -if test -f "${srcdir}/go/syscall/syscall_${GOOS}.go"; then - GO_SYSCALL_OS_FILE="go/syscall/syscall_${GOOS}.go" -fi -if test -f "${srcdir}/go/syscall/syscall_${GOOS}_${GOARCH}.go"; then - GO_SYSCALL_OS_ARCH_FILE="go/syscall/syscall_${GOOS}_${GOARCH}.go" -fi - - - - - -OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -case "$target" in - mips-sgi-irix6.5*) - # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct - # msghdr in . - OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500" - ;; - *-*-solaris2.1[01]) - # Solaris 10+ needs this so struct msghdr gets the msg_control - # etc. fields in (_XPG4_2). _XOPEN_SOURCE=600 as - # above doesn't work with C99. - OSCFLAGS="$OSCFLAGS -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" - ;; -esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is supported" >&5 -$as_echo_n "checking whether -fsplit-stack is supported... " >&6; } -if test "${libgo_cv_c_split_stack_supported+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -fsplit-stack" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_c_split_stack_supported=yes -else - libgo_cv_c_split_stack_supported=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_split_stack_supported" >&5 -$as_echo "$libgo_cv_c_split_stack_supported" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether linker supports split/non-split linked together" >&5 -$as_echo_n "checking whether linker supports split/non-split linked together... " >&6; } -if test "${libgo_cv_c_linker_split_non_split+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat > conftest1.c << EOF -extern void f(); -int main() { f(); return 0; } -EOF -cat > conftest2.c << EOF -void f() {} -EOF -$CC -c -fsplit-stack $CFLAGS $CPPFLAGS conftest1.c -$CC -c $CFLAGS $CPPFLAGS conftest2.c -if $CC -o conftest conftest1.$ac_objext conftest2.$ac_objext; then - libgo_cv_c_linker_split_non_split=yes -else - libgo_cv_c_linker_split_non_split=no -fi -rm -f conftest1.* conftest2.* conftest -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_linker_split_non_split" >&5 -$as_echo "$libgo_cv_c_linker_split_non_split" >&6; } - -if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then - SPLIT_STACK=-fsplit-stack - -$as_echo "#define USING_SPLIT_STACK 1" >>confdefs.h - -else - SPLIT_STACK= -fi - - if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then - USING_SPLIT_STACK_TRUE= - USING_SPLIT_STACK_FALSE='#' -else - USING_SPLIT_STACK_TRUE='#' - USING_SPLIT_STACK_FALSE= -fi - - -if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = no; then - GO_SPLIT_STACK=-fno-split-stack -else - GO_SPLIT_STACK= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether linker supports split stack" >&5 -$as_echo_n "checking whether linker supports split stack... " >&6; } -if test "${libgo_cv_c_linker_supports_split_stack+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libgo_cv_c_linker_supports_split_stack=no -if $GOC -Wl,--help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then - libgo_cv_c_linker_supports_split_stack=yes -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_linker_supports_split_stack" >&5 -$as_echo "$libgo_cv_c_linker_supports_split_stack" >&6; } -if test "$libgo_cv_c_linker_supports_split_stack" = yes; then - -$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; } -if test "${ac_cv_lib_m_sqrt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $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 sqrt (); -int -main () -{ -return sqrt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_m_sqrt=yes -else - ac_cv_lib_m_sqrt=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_m_sqrt" >&5 -$as_echo "$ac_cv_lib_m_sqrt" >&6; } -if test "x$ac_cv_lib_m_sqrt" = x""yes; then : - MATH_LIBS=-lm -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket libraries" >&5 -$as_echo_n "checking for socket libraries... " >&6; } -if test "${libgo_cv_lib_sockets+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - libgo_cv_lib_sockets= - libgo_check_both=no - ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = x""yes; then : - libgo_check_socket=no -else - libgo_check_socket=yes -fi - - if test "$libgo_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 : - libgo_cv_lib_sockets="-lsocket" -else - libgo_check_both=yes -fi - - fi - if test "$libgo_check_both" = "yes"; then - libgo_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 : - libgo_check_nsl=no - libgo_cv_lib_sockets="-lsocket -lnsl" -fi - - unset ac_cv_func_accept - LIBS=$libgo_old_libs - fi - unset ac_cv_func_gethostbyname - libgo_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 : - libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl" -fi - -fi - - unset ac_cv_func_gethostbyname - ac_fn_c_check_func "$LINENO" "sendfile" "ac_cv_func_sendfile" -if test "x$ac_cv_func_sendfile" = x""yes; then : - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lsendfile" >&5 -$as_echo_n "checking for main in -lsendfile... " >&6; } -if test "${ac_cv_lib_sendfile_main+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsendfile $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_sendfile_main=yes -else - ac_cv_lib_sendfile_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_sendfile_main" >&5 -$as_echo "$ac_cv_lib_sendfile_main" >&6; } -if test "x$ac_cv_lib_sendfile_main" = x""yes; then : - libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lsendfile" -fi - -fi - - LIBS=$libgo_old_libs - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_lib_sockets" >&5 -$as_echo "$libgo_cv_lib_sockets" >&6; } -NET_LIBS="$libgo_cv_lib_sockets" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -pthread is supported" >&5 -$as_echo_n "checking whether -pthread is supported... " >&6; } -if test "${libgo_cv_lib_pthread+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -pthread" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_lib_pthread=yes -else - libgo_cv_lib_pthread=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_lib_pthread" >&5 -$as_echo "$libgo_cv_lib_pthread" >&6; } -PTHREAD_CFLAGS= -if test "$libgo_cv_lib_pthread" = yes; then - PTHREAD_CFLAGS=-pthread -fi - - -PTHREAD_LIBS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $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 pthread_create (); -int -main () -{ -return pthread_create (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_create=yes -else - ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then : - PTHREAD_LIBS=-lpthread -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing sched_yield" >&5 -$as_echo_n "checking for library containing sched_yield... " >&6; } -if test "${ac_cv_search_sched_yield+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$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 sched_yield (); -int -main () -{ -return sched_yield (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_sched_yield=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_sched_yield+set}" = set; then : - break -fi -done -if test "${ac_cv_search_sched_yield+set}" = set; then : - -else - ac_cv_search_sched_yield=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_sched_yield" >&5 -$as_echo "$ac_cv_search_sched_yield" >&6; } -ac_res=$ac_cv_search_sched_yield -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 -$as_echo_n "checking for library containing nanosleep... " >&6; } -if test "${ac_cv_search_nanosleep+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$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 nanosleep (); -int -main () -{ -return nanosleep (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_nanosleep=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_nanosleep+set}" = set; then : - break -fi -done -if test "${ac_cv_search_nanosleep+set}" = set; then : - -else - ac_cv_search_nanosleep=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 -$as_echo "$ac_cv_search_nanosleep" >&6; } -ac_res=$ac_cv_search_nanosleep -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 -$as_echo_n "checking for library containing clock_gettime... " >&6; } -if test "${ac_cv_search_clock_gettime+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$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 clock_gettime (); -int -main () -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_clock_gettime=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_clock_gettime+set}" = set; then : - break -fi -done -if test "${ac_cv_search_clock_gettime+set}" = set; then : - -else - ac_cv_search_clock_gettime=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 -$as_echo "$ac_cv_search_clock_gettime" >&6; } -ac_res=$ac_cv_search_clock_gettime -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -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 - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -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 - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -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_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - - - -# Check whether --with-system-libunwind was given. -if test "${with_system_libunwind+set}" = set; then : - withval=$with_system_libunwind; -fi - - # If system-libunwind was not specifically set, pick a default setting. - if test x$with_system_libunwind = x; then - case ${target} in - ia64-*-hpux*) with_system_libunwind=yes ;; - *) with_system_libunwind=no ;; - esac - fi - # Based on system-libunwind and target, do we have ipinfo? - if test x$with_system_libunwind = xyes; then - case ${target} in - ia64-*-*) have_unwind_getipinfo=no ;; - *) have_unwind_getipinfo=yes ;; - esac - else - # Darwin before version 9 does not have _Unwind_GetIPInfo. - - case ${target} in - *-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;; - *) have_unwind_getipinfo=yes ;; - esac - - fi - - if test x$have_unwind_getipinfo = xyes; then - -$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h - - fi - - -for ac_header in sched.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$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 linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.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" "#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -" -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 - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether can be used" >&5 -$as_echo_n "checking whether can be used... " >&6; } -if test "${libgo_cv_c_ustat_h+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#ifdef HAVE_LINUX_FILTER_H -#include -#endif -#include - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_c_ustat_h=yes -else - libgo_cv_c_ustat_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_ustat_h" >&5 -$as_echo "$libgo_cv_c_ustat_h" >&6; } -if test $libgo_cv_c_ustat_h = yes; then - -$as_echo "#define HAVE_USTAT_H 1" >>confdefs.h - -fi - - if test "$ac_cv_header_sys_mman_h" = yes; then - HAVE_SYS_MMAN_H_TRUE= - HAVE_SYS_MMAN_H_FALSE='#' -else - HAVE_SYS_MMAN_H_TRUE='#' - HAVE_SYS_MMAN_H_FALSE= -fi - - -for ac_func in strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr -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 - - if test "$ac_cv_func_strerror_r" = yes; then - HAVE_STRERROR_R_TRUE= - HAVE_STRERROR_R_FALSE='#' -else - HAVE_STRERROR_R_TRUE='#' - HAVE_STRERROR_R_FALSE= -fi - - if test "$ac_cv_func_wait4" = yes; then - HAVE_WAIT4_TRUE= - HAVE_WAIT4_FALSE='#' -else - HAVE_WAIT4_TRUE='#' - HAVE_WAIT4_FALSE= -fi - - -for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat -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 - -ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = x""yes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define off_t long int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "loff_t" "ac_cv_type_loff_t" "$ac_includes_default" -if test "x$ac_cv_type_loff_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_LOFF_T 1 -_ACEOF - - -fi - - -LIBS_hold="$LIBS" -LIBS="$LIBS -lm" -for ac_func in cosl expl logl sinl tanl acosl asinl atanl atan2l expm1l ldexpl log10l log1pl -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 - -LIBS="$LIBS_hold" - -CFLAGS_hold="$CFLAGS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -LIBS_hold="$LIBS" -LIBS="$LIBS $PTHREAD_LIBS" -for ac_func in sem_timedwait -do : - ac_fn_c_check_func "$LINENO" "sem_timedwait" "ac_cv_func_sem_timedwait" -if test "x$ac_cv_func_sem_timedwait" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SEM_TIMEDWAIT 1 -_ACEOF - -fi -done - -CFLAGS="$CFLAGS_hold" -LIBS="$LIBS_hold" - -LIBS_hold="$LIBS" -LIBS="$LIBS $MATH_LIBS" -for ac_func in matherr -do : - ac_fn_c_check_func "$LINENO" "matherr" "ac_cv_func_matherr" -if test "x$ac_cv_func_matherr" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MATHERR 1 -_ACEOF - -fi -done - -LIBS="$LIBS_hold" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_bool_compare_and_swap_4" >&5 -$as_echo_n "checking for __sync_bool_compare_and_swap_4... " >&6; } -if test "${libgo_cv_func___sync_bool_compare_and_swap_4+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -typedef unsigned int uint32 __attribute__ ((mode (SI))); -uint32 i; -int main() { return __sync_bool_compare_and_swap (&i, 0, 1); } - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libgo_cv_func___sync_bool_compare_and_swap_4=yes -else - libgo_cv_func___sync_bool_compare_and_swap_4=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: $libgo_cv_func___sync_bool_compare_and_swap_4" >&5 -$as_echo "$libgo_cv_func___sync_bool_compare_and_swap_4" >&6; } -if test "$libgo_cv_func___sync_bool_compare_and_swap_4" = "yes"; then - -$as_echo "#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_bool_compare_and_swap_8" >&5 -$as_echo_n "checking for __sync_bool_compare_and_swap_8... " >&6; } -if test "${libgo_cv_func___sync_bool_compare_and_swap_8+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -typedef unsigned int uint64 __attribute__ ((mode (DI))); -uint64 i; -int main() { return __sync_bool_compare_and_swap (&i, 0, 1); } - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libgo_cv_func___sync_bool_compare_and_swap_8=yes -else - libgo_cv_func___sync_bool_compare_and_swap_8=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: $libgo_cv_func___sync_bool_compare_and_swap_8" >&5 -$as_echo "$libgo_cv_func___sync_bool_compare_and_swap_8" >&6; } -if test "$libgo_cv_func___sync_bool_compare_and_swap_8" = "yes"; then - -$as_echo "#define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_fetch_and_add_4" >&5 -$as_echo_n "checking for __sync_fetch_and_add_4... " >&6; } -if test "${libgo_cv_func___sync_fetch_and_add_4+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -typedef unsigned int uint32 __attribute__ ((mode (SI))); -uint32 i; -int main() { return __sync_fetch_and_add (&i, 1); } - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libgo_cv_func___sync_fetch_and_add_4=yes -else - libgo_cv_func___sync_fetch_and_add_4=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: $libgo_cv_func___sync_fetch_and_add_4" >&5 -$as_echo "$libgo_cv_func___sync_fetch_and_add_4" >&6; } -if test "$libgo_cv_func___sync_fetch_and_add_4" = "yes"; then - -$as_echo "#define HAVE_SYNC_FETCH_AND_ADD_4 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_add_and_fetch_8" >&5 -$as_echo_n "checking for __sync_add_and_fetch_8... " >&6; } -if test "${libgo_cv_func___sync_add_and_fetch_8+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -typedef unsigned int uint64 __attribute__ ((mode (DI))); -uint64 i; -int main() { return __sync_add_and_fetch (&i, 1); } - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - libgo_cv_func___sync_add_and_fetch_8=yes -else - libgo_cv_func___sync_add_and_fetch_8=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: $libgo_cv_func___sync_add_and_fetch_8" >&5 -$as_echo "$libgo_cv_func___sync_add_and_fetch_8" >&6; } -if test "$libgo_cv_func___sync_add_and_fetch_8" = "yes"; then - -$as_echo "#define HAVE_SYNC_ADD_AND_FETCH_8 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -minline-all-stringops" >&5 -$as_echo_n "checking whether compiler supports -minline-all-stringops... " >&6; } -if test "${libgo_cv_c_stringops+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -minline-all-stringops" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_c_stringops=yes -else - libgo_cv_c_stringops=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_stringops" >&5 -$as_echo "$libgo_cv_c_stringops" >&6; } -STRINGOPS_FLAG= -if test "$libgo_cv_c_stringops" = yes; then - STRINGOPS_FLAG=-minline-all-stringops -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -mfancy-math-387" >&5 -$as_echo_n "checking whether compiler supports -mfancy-math-387... " >&6; } -if test "${libgo_cv_c_fancymath+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -mfancy-math-387" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_c_fancymath=yes -else - libgo_cv_c_fancymath=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_fancymath" >&5 -$as_echo "$libgo_cv_c_fancymath" >&6; } -MATH_FLAG= -if test "$libgo_cv_c_fancymath" = yes; then - MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations" -else - MATH_FLAG="-ffp-contract=off" -fi - - -CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" -ac_fn_c_check_type "$LINENO" "off64_t" "ac_cv_type_off64_t" "$ac_includes_default" -if test "x$ac_cv_type_off64_t" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_OFF64_T 1 -_ACEOF - - -fi - -CFLAGS=$CFLAGS_hold - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking epoll_event size" >&5 -$as_echo_n "checking epoll_event size... " >&6; } -if test "${libgo_cv_c_epoll_event_size+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof (struct epoll_event)" "libgo_cv_c_epoll_event_size" "#include "; then : - -else - libgo_cv_c_epoll_event_size=0 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_epoll_event_size" >&5 -$as_echo "$libgo_cv_c_epoll_event_size" >&6; } -SIZEOF_STRUCT_EPOLL_EVENT=${libgo_cv_c_epoll_event_size} - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking epoll_event data.fd offset" >&5 -$as_echo_n "checking epoll_event data.fd offset... " >&6; } -if test "${libgo_cv_c_epoll_event_fd_offset+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "offsetof (struct epoll_event, data.fd)" "libgo_cv_c_epoll_event_fd_offset" "#include -#include "; then : - -else - libgo_cv_c_epoll_event_fd_offset=0 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_epoll_event_fd_offset" >&5 -$as_echo "$libgo_cv_c_epoll_event_fd_offset" >&6; } -STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} - - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "timespec_t.*st_atim" >/dev/null 2>&1; then : - have_stat_timespec=yes -else - have_stat_timespec=no -fi -rm -f conftest* - - if test $have_stat_timespec = yes; then - HAVE_STAT_TIMESPEC_TRUE= - HAVE_STAT_TIMESPEC_FALSE='#' -else - HAVE_STAT_TIMESPEC_TRUE='#' - HAVE_STAT_TIMESPEC_FALSE= -fi - - -ac_fn_c_check_type "$LINENO" "struct exception" "ac_cv_type_struct_exception" "#include -" -if test "x$ac_cv_type_struct_exception" = x""yes; then : - libgo_has_struct_exception=yes -else - libgo_has_struct_exception=no -fi - -if test "$libgo_has_struct_exception" = "yes"; then - -$as_echo "#define HAVE_STRUCT_EXCEPTION 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setcontext clobbers TLS variables" >&5 -$as_echo_n "checking whether setcontext clobbers TLS variables... " >&6; } -if test "${libgo_cv_lib_setcontext_clobbers_tls+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold="$CFLAGS" -CFLAGS="$PTHREAD_CFLAGS" -LIBS_hold="$LIBS" -LIBS="$LIBS $PTHREAD_LIBS" -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } -if test "${ac_cv_sizeof_void_p+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_void_p" = yes; then - { { $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 "cannot compute sizeof (void *) -See \`config.log' for more details." "$LINENO" 5; }; } - else - ac_cv_sizeof_void_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF - - -as_fn_arith $ac_cv_sizeof_void_p \* 8 && ptr_type_size=$as_val -if test "$cross_compiling" = yes; then : - case "$target:$ptr_type_size" in - i?86-*-solaris2.1[01]:64 | x86_64*-*-solaris2.1[01]:64) - libgo_cv_lib_setcontext_clobbers_tls=yes ;; - *) - libgo_cv_lib_setcontext_clobbers_tls=no ;; - esac - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include - -__thread int tls; - -static char stack[10 * 1024 * 1024]; -static ucontext_t c; - -/* Called via makecontext/setcontext. */ - -static void -cfn (void) -{ - exit (tls); -} - -/* Called via pthread_create. */ - -static void * -tfn (void *dummy) -{ - /* The thread should still see this value after calling - setcontext. */ - tls = 0; - - setcontext (&c); - - /* The call to setcontext should not return. */ - abort (); -} - -int -main () -{ - pthread_t tid; - - /* The thread should not see this value. */ - tls = 1; - - if (getcontext (&c) < 0) - abort (); - - c.uc_stack.ss_sp = stack; -#ifdef MAKECONTEXT_STACK_TOP - c.uc_stack.ss_sp += sizeof stack; -#endif - c.uc_stack.ss_flags = 0; - c.uc_stack.ss_size = sizeof stack; - c.uc_link = NULL; - makecontext (&c, cfn, 0); - - if (pthread_create (&tid, NULL, tfn, NULL) != 0) - abort (); - - if (pthread_join (tid, NULL) != 0) - abort (); - - /* The thread should have called exit. */ - abort (); -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - libgo_cv_lib_setcontext_clobbers_tls=no -else - libgo_cv_lib_setcontext_clobbers_tls=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -CFLAGS="$CFLAGS_hold" -LIBS="$LIBS_hold" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_lib_setcontext_clobbers_tls" >&5 -$as_echo "$libgo_cv_lib_setcontext_clobbers_tls" >&6; } -if test "$libgo_cv_lib_setcontext_clobbers_tls" = "yes"; then - -$as_echo "#define SETCONTEXT_CLOBBERS_TLS 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 -$as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } -if test "${libgo_cv_ro_eh_frame+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -libgo_cv_ro_eh_frame=no -echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c -if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libgo_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libgo_cv_ro_eh_frame=yes - fi -fi -rm -f conftest.* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_ro_eh_frame" >&5 -$as_echo "$libgo_cv_ro_eh_frame" >&6; } -if test "x$libgo_cv_ro_eh_frame" = xyes; then - -$as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h - -else - -$as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler supports -Qunused-arguments" >&5 -$as_echo_n "checking if compiler supports -Qunused-arguments... " >&6; } -if test "${libgo_cv_c_unused_arguments+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -Qunused-arguments" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int i; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - libgo_cv_c_unused_arguments=yes -else - libgo_cv_c_unused_arguments=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -CFLAGS=$CFLAGS_hold -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_unused_arguments" >&5 -$as_echo "$libgo_cv_c_unused_arguments" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if assembler supports GNU comdat group syntax" >&5 -$as_echo_n "checking if assembler supports GNU comdat group syntax... " >&6; } -if test "${libgo_cv_as_comdat_gnu+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libgo_cv_as_comdat_gnu=yes -else - libgo_cv_as_comdat_gnu=no -fi -CFLAGS=$CFLAGS_hold - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_comdat_gnu" >&5 -$as_echo "$libgo_cv_as_comdat_gnu" >&6; } -if test "x$libgo_cv_as_comdat_gnu" = xyes; then - -$as_echo "#define HAVE_AS_COMDAT_GAS 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 -$as_echo_n "checking assembler supports pc related relocs... " >&6; } -if test "${libgo_cv_as_x86_pcrel+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -libgo_cv_as_x86_pcrel=yes -echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then - libgo_cv_as_x86_pcrel=no -fi -CFLAGS=$CFLAGS_hold - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_x86_pcrel" >&5 -$as_echo "$libgo_cv_as_x86_pcrel" >&6; } -if test "x$libgo_cv_as_x86_pcrel" = xyes; then - -$as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 -$as_echo_n "checking assembler supports unwind section type... " >&6; } -if test "${libgo_cv_as_x86_64_unwind_section_type+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - -libgo_cv_as_x86_64_unwind_section_type=yes -echo '.section .eh_frame,"a",@unwind' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libgo_cv_as_x86_64_unwind_section_type=no -fi -CFLAGS=$CFLAGS_hold - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_as_x86_64_unwind_section_type" >&5 -$as_echo "$libgo_cv_as_x86_64_unwind_section_type" >&6; } -if test "x$libgo_cv_as_x86_64_unwind_section_type" = xyes; then - -$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h - -fi - -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 - -if test ${multilib} = yes; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -ac_config_files="$ac_config_files Makefile testsuite/Makefile" - - -ac_config_commands="$ac_config_commands default" - - -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}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - if test -n "$EXEEXT"; then - am__EXEEXT_TRUE= - am__EXEEXT_FALSE='#' -else - am__EXEEXT_TRUE='#' - am__EXEEXT_FALSE= -fi - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -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 "${LIBGO_IS_DARWIN_TRUE}" && test -z "${LIBGO_IS_DARWIN_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_DARWIN\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_FREEBSD_TRUE}" && test -z "${LIBGO_IS_FREEBSD_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_FREEBSD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_IRIX_TRUE}" && test -z "${LIBGO_IS_IRIX_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_IRIX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_LINUX_TRUE}" && test -z "${LIBGO_IS_LINUX_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_LINUX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_NETBSD_TRUE}" && test -z "${LIBGO_IS_NETBSD_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_NETBSD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_OPENBSD_TRUE}" && test -z "${LIBGO_IS_OPENBSD_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_OPENBSD\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_DRAGONFLY_TRUE}" && test -z "${LIBGO_IS_DRAGONFLY_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_DRAGONFLY\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_RTEMS_TRUE}" && test -z "${LIBGO_IS_RTEMS_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_RTEMS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_SOLARIS_TRUE}" && test -z "${LIBGO_IS_SOLARIS_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_SOLARIS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_386_TRUE}" && test -z "${LIBGO_IS_386_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_386\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_ALPHA_TRUE}" && test -z "${LIBGO_IS_ALPHA_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_ALPHA\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_ARM_TRUE}" && test -z "${LIBGO_IS_ARM_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_ARM\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_ARM64_TRUE}" && test -z "${LIBGO_IS_ARM64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_ARM64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_M68K_TRUE}" && test -z "${LIBGO_IS_M68K_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_M68K\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_MIPS_TRUE}" && test -z "${LIBGO_IS_MIPS_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_MIPS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_MIPSO32_TRUE}" && test -z "${LIBGO_IS_MIPSO32_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_MIPSO32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_MIPSN32_TRUE}" && test -z "${LIBGO_IS_MIPSN32_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_MIPSN32\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_MIPSN64_TRUE}" && test -z "${LIBGO_IS_MIPSN64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_MIPSN64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_MIPSO64_TRUE}" && test -z "${LIBGO_IS_MIPSO64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_MIPSO64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_PPC_TRUE}" && test -z "${LIBGO_IS_PPC_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_PPC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_PPC64_TRUE}" && test -z "${LIBGO_IS_PPC64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_PPC64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_PPC64LE_TRUE}" && test -z "${LIBGO_IS_PPC64LE_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_PPC64LE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_S390_TRUE}" && test -z "${LIBGO_IS_S390_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_S390\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_S390X_TRUE}" && test -z "${LIBGO_IS_S390X_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_S390X\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_SPARC_TRUE}" && test -z "${LIBGO_IS_SPARC_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_SPARC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_SPARC64_TRUE}" && test -z "${LIBGO_IS_SPARC64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_SPARC64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${LIBGO_IS_X86_64_TRUE}" && test -z "${LIBGO_IS_X86_64_FALSE}"; then - as_fn_error "conditional \"LIBGO_IS_X86_64\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}"; then - 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. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_STRERROR_R_TRUE}" && test -z "${HAVE_STRERROR_R_FALSE}"; then - as_fn_error "conditional \"HAVE_STRERROR_R\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_WAIT4_TRUE}" && test -z "${HAVE_WAIT4_FALSE}"; then - as_fn_error "conditional \"HAVE_WAIT4\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_STAT_TIMESPEC_TRUE}" && test -z "${HAVE_STAT_TIMESPEC_FALSE}"; then - as_fn_error "conditional \"HAVE_STAT_TIMESPEC\" 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 package-unused $as_me version-unused, 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 - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -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 - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to the package provider." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_version="\\ -package-unused config.status version-unused -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;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --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 -# - -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" -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -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"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_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"`' -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"`' -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"`' -LD_GO='`$ECHO "$LD_GO" | $SED "$delay_single_quote_subst"`' -reload_flag_GO='`$ECHO "$reload_flag_GO" | $SED "$delay_single_quote_subst"`' -reload_cmds_GO='`$ECHO "$reload_cmds_GO" | $SED "$delay_single_quote_subst"`' -old_archive_cmds_GO='`$ECHO "$old_archive_cmds_GO" | $SED "$delay_single_quote_subst"`' -compiler_GO='`$ECHO "$compiler_GO" | $SED "$delay_single_quote_subst"`' -GCC_GO='`$ECHO "$GCC_GO" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_GO='`$ECHO "$lt_prog_compiler_no_builtin_flag_GO" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_GO='`$ECHO "$lt_prog_compiler_wl_GO" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic_GO='`$ECHO "$lt_prog_compiler_pic_GO" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static_GO='`$ECHO "$lt_prog_compiler_static_GO" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_GO='`$ECHO "$lt_cv_prog_compiler_c_o_GO" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc_GO='`$ECHO "$archive_cmds_need_lc_GO" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_GO='`$ECHO "$enable_shared_with_static_runtimes_GO" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec_GO='`$ECHO "$export_dynamic_flag_spec_GO" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec_GO='`$ECHO "$whole_archive_flag_spec_GO" | $SED "$delay_single_quote_subst"`' -compiler_needs_object_GO='`$ECHO "$compiler_needs_object_GO" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds_GO='`$ECHO "$old_archive_from_new_cmds_GO" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_GO='`$ECHO "$old_archive_from_expsyms_cmds_GO" | $SED "$delay_single_quote_subst"`' -archive_cmds_GO='`$ECHO "$archive_cmds_GO" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds_GO='`$ECHO "$archive_expsym_cmds_GO" | $SED "$delay_single_quote_subst"`' -module_cmds_GO='`$ECHO "$module_cmds_GO" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds_GO='`$ECHO "$module_expsym_cmds_GO" | $SED "$delay_single_quote_subst"`' -with_gnu_ld_GO='`$ECHO "$with_gnu_ld_GO" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag_GO='`$ECHO "$allow_undefined_flag_GO" | $SED "$delay_single_quote_subst"`' -no_undefined_flag_GO='`$ECHO "$no_undefined_flag_GO" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_GO='`$ECHO "$hardcode_libdir_flag_spec_GO" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld_GO='`$ECHO "$hardcode_libdir_flag_spec_ld_GO" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator_GO='`$ECHO "$hardcode_libdir_separator_GO" | $SED "$delay_single_quote_subst"`' -hardcode_direct_GO='`$ECHO "$hardcode_direct_GO" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute_GO='`$ECHO "$hardcode_direct_absolute_GO" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L_GO='`$ECHO "$hardcode_minus_L_GO" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var_GO='`$ECHO "$hardcode_shlibpath_var_GO" | $SED "$delay_single_quote_subst"`' -hardcode_automatic_GO='`$ECHO "$hardcode_automatic_GO" | $SED "$delay_single_quote_subst"`' -inherit_rpath_GO='`$ECHO "$inherit_rpath_GO" | $SED "$delay_single_quote_subst"`' -link_all_deplibs_GO='`$ECHO "$link_all_deplibs_GO" | $SED "$delay_single_quote_subst"`' -fix_srcfile_path_GO='`$ECHO "$fix_srcfile_path_GO" | $SED "$delay_single_quote_subst"`' -always_export_symbols_GO='`$ECHO "$always_export_symbols_GO" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds_GO='`$ECHO "$export_symbols_cmds_GO" | $SED "$delay_single_quote_subst"`' -exclude_expsyms_GO='`$ECHO "$exclude_expsyms_GO" | $SED "$delay_single_quote_subst"`' -include_expsyms_GO='`$ECHO "$include_expsyms_GO" | $SED "$delay_single_quote_subst"`' -prelink_cmds_GO='`$ECHO "$prelink_cmds_GO" | $SED "$delay_single_quote_subst"`' -file_list_spec_GO='`$ECHO "$file_list_spec_GO" | $SED "$delay_single_quote_subst"`' -hardcode_action_GO='`$ECHO "$hardcode_action_GO" | $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 SED \ -GREP \ -EGREP \ -FGREP \ -SHELL \ -ECHO \ -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 \ -LD_GO \ -reload_flag_GO \ -compiler_GO \ -lt_prog_compiler_no_builtin_flag_GO \ -lt_prog_compiler_wl_GO \ -lt_prog_compiler_pic_GO \ -lt_prog_compiler_static_GO \ -lt_cv_prog_compiler_c_o_GO \ -export_dynamic_flag_spec_GO \ -whole_archive_flag_spec_GO \ -compiler_needs_object_GO \ -with_gnu_ld_GO \ -allow_undefined_flag_GO \ -no_undefined_flag_GO \ -hardcode_libdir_flag_spec_GO \ -hardcode_libdir_flag_spec_ld_GO \ -hardcode_libdir_separator_GO \ -fix_srcfile_path_GO \ -exclude_expsyms_GO \ -include_expsyms_GO \ -file_list_spec_GO; 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_GO \ -old_archive_cmds_GO \ -old_archive_from_new_cmds_GO \ -old_archive_from_expsyms_cmds_GO \ -archive_cmds_GO \ -archive_expsym_cmds_GO \ -module_cmds_GO \ -module_expsym_cmds_GO \ -export_symbols_cmds_GO \ -prelink_cmds_GO; 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' - - - - - - -# Variables needed in config.status (file generation) which aren't already -# passed by autoconf. -SUBDIRS="$SUBDIRS" - - -_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 - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; - "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - - *) 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_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= - trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || as_fn_error "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ -s/:*$// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :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 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || as_fn_error "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_arg="$ac_file" -_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" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$_am_arg" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :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 - "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 ;; - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 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="GO " - -# ### BEGIN LIBTOOL CONFIG - -# 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 - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A 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 - -# ### 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: GO - -# The linker used to build libraries. -LD=$lt_LD_GO - -# How to create reloadable object files. -reload_flag=$lt_reload_flag_GO -reload_cmds=$lt_reload_cmds_GO - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_GO - -# A language specific compiler. -CC=$lt_compiler_GO - -# Is the compiler the GNU compiler? -with_gcc=$GCC_GO - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GO - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_GO - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_GO - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_GO - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GO - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_GO - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GO - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GO - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_GO - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_GO - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GO - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GO - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_GO -archive_expsym_cmds=$lt_archive_expsym_cmds_GO - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_GO -module_expsym_cmds=$lt_module_expsym_cmds_GO - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_GO - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_GO - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_GO - -# 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_GO - -# 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_GO - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_GO - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_GO - -# 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_GO - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_GO - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_GO - -# 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_GO - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_GO - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_GO - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path_GO - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_GO - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_GO - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_GO - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_GO - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_GO - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_GO - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_GO - -# ### END LIBTOOL TAG CONFIG: GO -_LT_EOF - - ;; - "default":C) if test -n "$CONFIG_FILES"; then - # Multilibs need MULTISUBDIR defined correctly in certain makefiles so - # that multilib installs will end up installed in the correct place. - # The testsuite needs it for multilib-aware ABI baseline files. - # To work around this not being passed down from config-ml.in -> - # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually - # append it here. Only modify Makefiles that have just been created. - # - # Also, get rid of this simulated-VPATH thing that automake does. - cat > vpsed << \_EOF -s!`test -f '$<' || echo '$(srcdir)/'`!! -_EOF - for i in $SUBDIRS; do - case $CONFIG_FILES in - *${i}/Makefile*) - #echo "Adding MULTISUBDIR to $i/Makefile" - sed -f vpsed $i/Makefile > tmp - grep '^MULTISUBDIR =' Makefile >> tmp - mv tmp $i/Makefile - ;; - esac - done - rm vpsed - fi - ;; - - 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/llgo/third_party/gofrontend/libgo/configure.ac b/llgo/third_party/gofrontend/libgo/configure.ac deleted file mode 100644 index 6eddb860974dd04f8050eca56a87d7d947f86950..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/configure.ac +++ /dev/null @@ -1,920 +0,0 @@ -# configure.ac -- Go library configure script. - -# Copyright 2009 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# Process this file with autoreconf to produce configure. - -AC_PREREQ(2.64) -AC_INIT(package-unused, version-unused,, libgo) -AC_CONFIG_SRCDIR(Makefile.am) -AC_CONFIG_HEADER(config.h) - -libtool_VERSION=8:0:0 -AC_SUBST(libtool_VERSION) - -AM_ENABLE_MULTILIB(, ..) - -AC_CANONICAL_SYSTEM -target_alias=${target_alias-$host_alias} - -AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dist -Wall -Wno-portability]) -AH_TEMPLATE(PACKAGE, [Name of package]) -AH_TEMPLATE(VERSION, [Version number of package]) - -m4_rename([_AC_ARG_VAR_PRECIOUS],[glibgo_PRECIOUS]) -m4_define([_AC_ARG_VAR_PRECIOUS],[]) -AC_PROG_CC -AC_PROG_GO -m4_rename_force([glibgo_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) - -AC_SUBST(CFLAGS) - -AM_MAINTAINER_MODE - -AC_PROG_LD -AC_PROG_RANLIB -AC_CHECK_TOOL(OBJCOPY, objcopy, missing-objcopy) - -AC_LIBTOOL_DLOPEN -AM_PROG_LIBTOOL -AC_SUBST(enable_shared) -AC_SUBST(enable_static) - -CC_FOR_BUILD=${CC_FOR_BUILD:-gcc} -AC_SUBST(CC_FOR_BUILD) - -AC_PROG_AWK - -WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' -AC_SUBST(WARN_FLAGS) - -AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror], - [turns on -Werror @<:@default=yes@:>@])]) -if test "x$enable_werror" != "xno"; then - WERROR="-Werror" -fi -AC_SUBST(WERROR) - -glibgo_toolexecdir=no -glibgo_toolexeclibdir=no - -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) version_specific_libs=yes ;; - no) version_specific_libs=no ;; - *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; - esac], - [version_specific_libs=no]) -AC_MSG_RESULT($version_specific_libs) - -# Version-specific runtime libs processing. -if test $version_specific_libs = yes; then - glibgo_toolexecdir='${libdir}/gcc/${host_alias}' - glibgo_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' -fi - -# Calculate glibgo_toolexecdir, glibgo_toolexeclibdir -# Install a library built with a cross compiler in tooldir, not libdir. -if test -n "$with_cross_host" && - test x"$with_cross_host" != x"no"; then - nover_glibgo_toolexecdir='${exec_prefix}/${host_alias}' - nover_glibgo_toolexeclibdir='${toolexecdir}/lib' -else - nover_glibgo_toolexecdir='${libdir}/gcc/${host_alias}' - nover_glibgo_toolexeclibdir='${libdir}' -fi -multi_os_directory=`$GOC -print-multi-os-directory` -case $multi_os_directory in - .) ;; # Avoid trailing /. - *) nover_glibgo_toolexeclibdir=${nover_glibgo_toolexeclibdir}/${multi_os_directory} ;; -esac - -if test x"$glibgo_toolexecdir" = x"no"; then - glibgo_toolexecdir="${nover_glibgo_toolexecdir}" - glibgo_toolexeclibdir="${nover_glibgo_toolexeclibdir}" -fi - -AC_SUBST(glibgo_toolexecdir) -AC_SUBST(glibgo_toolexeclibdir) -AC_SUBST(nover_glibgo_toolexeclibdir) - -# See if the user wants to configure without libffi. Some -# architectures don't support it. FIXME: We should set a default -# based on the host. -AC_ARG_WITH(libffi, - AS_HELP_STRING([--without-libffi], - [don't use libffi]), - [:], - [with_libffi=${with_libffi_default-yes}]) - -LIBFFI= -LIBFFIINCS= -if test "$with_libffi" != no; then - AC_DEFINE(USE_LIBFFI, 1, [Define if we're to use libffi.]) - LIBFFI=../libffi/libffi_convenience.la - LIBFFIINCS='-I$(top_srcdir)/../libffi/include -I../libffi/include' -fi -AC_SUBST(LIBFFI) -AC_SUBST(LIBFFIINCS) - -# See if the user wants to configure without libatomic. This is useful if we are -# on an architecture for which libgo does not need an atomic support library and -# libatomic does not support our C compiler. -AC_ARG_WITH(libatomic, - AS_HELP_STRING([--without-libatomic], - [don't use libatomic]), - [:], - [with_libatomic=${with_libatomic_default-yes}]) - -LIBATOMIC= -if test "$with_libatomic" != no; then - LIBATOMIC=../libatomic/libatomic_convenience.la -fi -AC_SUBST(LIBATOMIC) - -# Used to tell GNU make to include a file without telling automake to -# include it. -go_include="-include" -AC_SUBST(go_include) - -is_darwin=no -is_freebsd=no -is_irix=no -is_linux=no -is_netbsd=no -is_openbsd=no -is_dragonfly=no -is_rtems=no -is_solaris=no -GOOS=unknown -case ${host} in - *-*-darwin*) is_darwin=yes; GOOS=darwin ;; - *-*-freebsd*) is_freebsd=yes; GOOS=freebsd ;; - *-*-irix6*) is_irix=yes; GOOS=irix ;; - *-*-linux*) is_linux=yes; GOOS=linux ;; - *-*-netbsd*) is_netbsd=yes; GOOS=netbsd ;; - *-*-openbsd*) is_openbsd=yes; GOOS=openbsd ;; - *-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;; - *-*-rtems*) is_rtems=yes; GOOS=rtems ;; - *-*-solaris2*) is_solaris=yes; GOOS=solaris ;; -esac -AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes) -AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes) -AM_CONDITIONAL(LIBGO_IS_IRIX, test $is_irix = yes) -AM_CONDITIONAL(LIBGO_IS_LINUX, test $is_linux = yes) -AM_CONDITIONAL(LIBGO_IS_NETBSD, test $is_netbsd = yes) -AM_CONDITIONAL(LIBGO_IS_OPENBSD, test $is_openbsd = yes) -AM_CONDITIONAL(LIBGO_IS_DRAGONFLY, test $is_dragonfly = yes) -AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes) -AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes) -AC_SUBST(GOOS) - -dnl Test whether we need to use DejaGNU or whether we can use the -dnl simpler gotest approach. We can only use gotest for a native -dnl build. -USE_DEJAGNU=no -case ${host} in - *-*-rtems*) USE_DEJAGNU=yes ;; - ${build}) ;; - *) USE_DEJAGNU=yes ;; -esac -AC_SUBST(USE_DEJAGNU) - -dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch). -is_386=no -is_alpha=no -is_arm=no -is_arm64=no -is_m68k=no -mips_abi=unknown -is_ppc=no -is_ppc64=no -is_ppc64le=no -is_s390=no -is_s390x=no -is_sparc=no -is_sparc64=no -is_x86_64=no -GOARCH=unknown -case ${host} in - alpha*-*-*) - is_alpha=yes - GOARCH=alpha - ;; - aarch64-*-*) - is_arm64=yes - GOARCH=arm64 - ;; - arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) - is_arm=yes - GOARCH=arm - ;; -changequote(,)dnl - i[34567]86-*-* | x86_64-*-*) -changequote([,])dnl - AC_COMPILE_IFELSE([ -#ifdef __x86_64__ -#error 64-bit -#endif], -[is_386=yes], [is_x86_64=yes]) - if test "$is_386" = "yes"; then - GOARCH=386 - else - GOARCH=amd64 - fi - ;; - m68k*-*-*) - is_m68k=yes - GOARCH=m68k - ;; - mips*-*-*) - AC_COMPILE_IFELSE([ -#if _MIPS_SIM != _ABIO32 -#error not o32 -#endif], -[mips_abi="o32"], - [AC_COMPILE_IFELSE([ -#if _MIPS_SIM != _ABIN32 -#error not n32 -#endif], -[mips_abi="n32"], - [AC_COMPILE_IFELSE([ -#if _MIPS_SIM != _ABI64 -#error not n64 -#endif], -[mips_abi="n64"], - [AC_COMPILE_IFELSE([ -#if _MIPS_SIM != _ABIO64 -#error not o64 -#endif], -[mips_abi="o64"], - [AC_MSG_ERROR([unknown MIPS ABI]) -[mips_abi="n32"]])])])]) - case "$mips_abi" in - "o32") GOARCH=mipso32 ;; - "n32") GOARCH=mipsn32 ;; - "n64") GOARCH=mipsn64 ;; - "o64") GOARCH=mipso64 ;; - esac - ;; - rs6000*-*-* | powerpc*-*-*) - AC_COMPILE_IFELSE([ -#ifdef _ARCH_PPC64 -#error 64-bit -#endif], -[is_ppc=yes], - [AC_COMPILE_IFELSE([ -#if defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) -#error 64be -#endif], -[is_ppc64le=yes],[is_ppc64=yes])]) - if test "$is_ppc" = "yes"; then - GOARCH=ppc - elif test "$is_ppc64" = "yes"; then - GOARCH=ppc64 - else - GOARCH=ppc64le - fi - ;; - s390*-*-*) - AC_COMPILE_IFELSE([ -#if defined(__s390x__) -#error 64-bit -#endif], -[is_s390=yes], [is_s390x=yes]) - if test "$is_s390" = "yes"; then - GOARCH=s390 - else - GOARCH=s390x - fi - ;; - sparc*-*-*) - AC_COMPILE_IFELSE([ -#if defined(__sparcv9) || defined(__arch64__) -#error 64-bit -#endif], -[is_sparc=yes], [is_sparc64=yes]) - if test "$is_sparc" = "yes"; then - GOARCH=sparc - else - GOARCH=sparc64 - fi - ;; -esac -AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes) -AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes) -AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes) -AM_CONDITIONAL(LIBGO_IS_ARM64, test $is_arm64 = yes) -AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes) -AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown) -AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32) -AM_CONDITIONAL(LIBGO_IS_MIPSN32, test $mips_abi = n32) -AM_CONDITIONAL(LIBGO_IS_MIPSN64, test $mips_abi = n64) -AM_CONDITIONAL(LIBGO_IS_MIPSO64, test $mips_abi = o64) -AM_CONDITIONAL(LIBGO_IS_PPC, test $is_ppc = yes) -AM_CONDITIONAL(LIBGO_IS_PPC64, test $is_ppc64 = yes) -AM_CONDITIONAL(LIBGO_IS_PPC64LE, test $is_ppc64le = yes) -AM_CONDITIONAL(LIBGO_IS_S390, test $is_s390 = yes) -AM_CONDITIONAL(LIBGO_IS_S390X, test $is_s390x = yes) -AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes) -AM_CONDITIONAL(LIBGO_IS_SPARC64, test $is_sparc64 = yes) -AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes) -AC_SUBST(GOARCH) - -dnl Some files are only present when needed for specific architectures. -GO_LIBCALL_OS_FILE= -GO_LIBCALL_OS_ARCH_FILE= -GO_SYSCALL_OS_FILE= -GO_SYSCALL_OS_ARCH_FILE= -if test -f "${srcdir}/go/syscall/libcall_${GOOS}.go"; then - GO_LIBCALL_OS_FILE="go/syscall/libcall_${GOOS}.go" -fi -if test -f "${srcdir}/go/syscall/libcall_${GOOS}_${GOARCH}.go"; then - GO_LIBCALL_OS_ARCH_FILE="go/syscall/libcall_${GOOS}_${GOARCH}.go" -fi -if test -f "${srcdir}/go/syscall/syscall_${GOOS}.go"; then - GO_SYSCALL_OS_FILE="go/syscall/syscall_${GOOS}.go" -fi -if test -f "${srcdir}/go/syscall/syscall_${GOOS}_${GOARCH}.go"; then - GO_SYSCALL_OS_ARCH_FILE="go/syscall/syscall_${GOOS}_${GOARCH}.go" -fi -AC_SUBST(GO_LIBCALL_OS_FILE) -AC_SUBST(GO_LIBCALL_OS_ARCH_FILE) -AC_SUBST(GO_SYSCALL_OS_FILE) -AC_SUBST(GO_SYSCALL_OS_ARCH_FILE) - -dnl Special flags used to generate sysinfo.go. -OSCFLAGS="-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -case "$target" in - mips-sgi-irix6.5*) - # IRIX 6 needs _XOPEN_SOURCE=500 for the XPG5 version of struct - # msghdr in . - OSCFLAGS="$OSCFLAGS -D_XOPEN_SOURCE=500" - ;; - *-*-solaris2.1[[01]]) - # Solaris 10+ needs this so struct msghdr gets the msg_control - # etc. fields in (_XPG4_2). _XOPEN_SOURCE=600 as - # above doesn't work with C99. - OSCFLAGS="$OSCFLAGS -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" - ;; -esac -AC_SUBST(OSCFLAGS) - -dnl Use -fsplit-stack when compiling C code if available. -AC_CACHE_CHECK([whether -fsplit-stack is supported], -[libgo_cv_c_split_stack_supported], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -fsplit-stack" -AC_COMPILE_IFELSE([[int i;]], -[libgo_cv_c_split_stack_supported=yes], -[libgo_cv_c_split_stack_supported=no]) -CFLAGS=$CFLAGS_hold]) - -dnl Make sure the linker permits -fsplit-stack. Old versions of gold will -dnl reject split-stack code calling non-split-stack code on targets -dnl they don't support. -AC_CACHE_CHECK([whether linker supports split/non-split linked together], -[libgo_cv_c_linker_split_non_split], -[cat > conftest1.c << EOF -extern void f(); -int main() { f(); return 0; } -EOF -cat > conftest2.c << EOF -void f() {} -EOF -$CC -c -fsplit-stack $CFLAGS $CPPFLAGS conftest1.c -$CC -c $CFLAGS $CPPFLAGS conftest2.c -if $CC -o conftest conftest1.$ac_objext conftest2.$ac_objext; then - libgo_cv_c_linker_split_non_split=yes -else - libgo_cv_c_linker_split_non_split=no -fi -rm -f conftest1.* conftest2.* conftest]) - -if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then - SPLIT_STACK=-fsplit-stack - AC_DEFINE(USING_SPLIT_STACK, 1, - [Define if the compiler supports -fsplit-stack]) -else - SPLIT_STACK= -fi -AC_SUBST(SPLIT_STACK) -AM_CONDITIONAL(USING_SPLIT_STACK, - test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes) - -dnl If the compiler supports split-stack but the linker does not, then -dnl we need to explicitly disable split-stack for Go. -if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = no; then - GO_SPLIT_STACK=-fno-split-stack -else - GO_SPLIT_STACK= -fi -AC_SUBST(GO_SPLIT_STACK) - -dnl Check whether the linker does stack munging when calling from -dnl split-stack into non-split-stack code. We check this by looking -dnl at the --help output. FIXME: This is only half right: it's -dnl possible for the linker to support this for some targets but not -dnl others. -dnl This is slightly different from the above check, which is whether -dnl the linker permits the call at all. -AC_CACHE_CHECK([whether linker supports split stack], -[libgo_cv_c_linker_supports_split_stack], -[libgo_cv_c_linker_supports_split_stack=no -if $GOC -Wl,--help 2>/dev/null | grep split-stack-adjust-size >/dev/null 2>&1; then - libgo_cv_c_linker_supports_split_stack=yes -fi]) -if test "$libgo_cv_c_linker_supports_split_stack" = yes; then - AC_DEFINE(LINKER_SUPPORTS_SPLIT_STACK, 1, - [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) -AC_SUBST(MATH_LIBS) - -dnl Test for -lsocket and -lnsl. Copied from libjava/configure.ac. -AC_CACHE_CHECK([for socket libraries], libgo_cv_lib_sockets, - [libgo_cv_lib_sockets= - libgo_check_both=no - AC_CHECK_FUNC(connect, libgo_check_socket=no, libgo_check_socket=yes) - if test "$libgo_check_socket" = "yes"; then - unset ac_cv_func_connect - AC_CHECK_LIB(socket, main, libgo_cv_lib_sockets="-lsocket", - libgo_check_both=yes) - fi - if test "$libgo_check_both" = "yes"; then - libgo_old_libs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - unset ac_cv_func_accept - AC_CHECK_FUNC(accept, - [libgo_check_nsl=no - libgo_cv_lib_sockets="-lsocket -lnsl"]) - unset ac_cv_func_accept - LIBS=$libgo_old_libs - fi - unset ac_cv_func_gethostbyname - libgo_old_libs="$LIBS" - AC_CHECK_FUNC(gethostbyname, , - [AC_CHECK_LIB(nsl, main, - [libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lnsl"])]) - unset ac_cv_func_gethostbyname - AC_CHECK_FUNC(sendfile, , - [AC_CHECK_LIB(sendfile, main, - [libgo_cv_lib_sockets="$libgo_cv_lib_sockets -lsendfile"])]) - LIBS=$libgo_old_libs -]) -NET_LIBS="$libgo_cv_lib_sockets" -AC_SUBST(NET_LIBS) - -dnl Test whether the compiler supports the -pthread option. -AC_CACHE_CHECK([whether -pthread is supported], -[libgo_cv_lib_pthread], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -pthread" -AC_COMPILE_IFELSE([[int i;]], -[libgo_cv_lib_pthread=yes], -[libgo_cv_lib_pthread=no]) -CFLAGS=$CFLAGS_hold]) -PTHREAD_CFLAGS= -if test "$libgo_cv_lib_pthread" = yes; then - PTHREAD_CFLAGS=-pthread -fi -AC_SUBST(PTHREAD_CFLAGS) - -dnl Test for the -lpthread library. -PTHREAD_LIBS= -AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS=-lpthread) -AC_SUBST(PTHREAD_LIBS) - -dnl Test if -lrt is required for sched_yield or nanosleep or clock_gettime. -AC_SEARCH_LIBS([sched_yield], [rt]) -AC_SEARCH_LIBS([nanosleep], [rt]) -AC_SEARCH_LIBS([clock_gettime], [rt]) - -AC_C_BIGENDIAN - -GCC_CHECK_UNWIND_GETIPINFO - -AC_CHECK_HEADERS(sched.h sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/icmp6.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h) - -AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.h], [], [], -[#ifdef HAVE_SYS_SOCKET_H -#include -#endif -]) - -AC_CACHE_CHECK([whether can be used], -[libgo_cv_c_ustat_h], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE $OSCFLAGS" -AC_COMPILE_IFELSE( -[AC_LANG_SOURCE([ -#include -#ifdef HAVE_LINUX_FILTER_H -#include -#endif -#include -])], [libgo_cv_c_ustat_h=yes], [libgo_cv_c_ustat_h=no]) -CFLAGS=$CFLAGS_hold]) -if test $libgo_cv_c_ustat_h = yes; then - AC_DEFINE(HAVE_USTAT_H, 1, - [Define to 1 if you have the header file and it works.]) -fi - -AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes) - -AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv unsetenv dl_iterate_phdr) -AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) -AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) - -AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat open64 openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat) -AC_TYPE_OFF_T -AC_CHECK_TYPES([loff_t]) - -LIBS_hold="$LIBS" -LIBS="$LIBS -lm" -AC_CHECK_FUNCS(cosl expl logl sinl tanl acosl asinl atanl atan2l expm1l ldexpl log10l log1pl) -LIBS="$LIBS_hold" - -CFLAGS_hold="$CFLAGS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -LIBS_hold="$LIBS" -LIBS="$LIBS $PTHREAD_LIBS" -AC_CHECK_FUNCS(sem_timedwait) -CFLAGS="$CFLAGS_hold" -LIBS="$LIBS_hold" - -LIBS_hold="$LIBS" -LIBS="$LIBS $MATH_LIBS" -AC_CHECK_FUNCS(matherr) -LIBS="$LIBS_hold" - -AC_CACHE_CHECK([for __sync_bool_compare_and_swap_4], -[libgo_cv_func___sync_bool_compare_and_swap_4], -[AC_LINK_IFELSE([ -typedef unsigned int uint32 __attribute__ ((mode (SI))); -uint32 i; -int main() { return __sync_bool_compare_and_swap (&i, 0, 1); } -], -[libgo_cv_func___sync_bool_compare_and_swap_4=yes], -[libgo_cv_func___sync_bool_compare_and_swap_4=no])]) -if test "$libgo_cv_func___sync_bool_compare_and_swap_4" = "yes"; then - AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_4, 1, - [Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint32]) -fi - -AC_CACHE_CHECK([for __sync_bool_compare_and_swap_8], -[libgo_cv_func___sync_bool_compare_and_swap_8], -[AC_LINK_IFELSE([ -typedef unsigned int uint64 __attribute__ ((mode (DI))); -uint64 i; -int main() { return __sync_bool_compare_and_swap (&i, 0, 1); } -], -[libgo_cv_func___sync_bool_compare_and_swap_8=yes], -[libgo_cv_func___sync_bool_compare_and_swap_8=no])]) -if test "$libgo_cv_func___sync_bool_compare_and_swap_8" = "yes"; then - AC_DEFINE(HAVE_SYNC_BOOL_COMPARE_AND_SWAP_8, 1, - [Define to 1 if the compiler provides the __sync_bool_compare_and_swap function for uint64]) -fi - -AC_CACHE_CHECK([for __sync_fetch_and_add_4], -[libgo_cv_func___sync_fetch_and_add_4], -[AC_LINK_IFELSE([ -typedef unsigned int uint32 __attribute__ ((mode (SI))); -uint32 i; -int main() { return __sync_fetch_and_add (&i, 1); } -], -[libgo_cv_func___sync_fetch_and_add_4=yes], -[libgo_cv_func___sync_fetch_and_add_4=no])]) -if test "$libgo_cv_func___sync_fetch_and_add_4" = "yes"; then - AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD_4, 1, - [Define to 1 if the compiler provides the __sync_fetch_and_add function for uint32]) -fi - -AC_CACHE_CHECK([for __sync_add_and_fetch_8], -[libgo_cv_func___sync_add_and_fetch_8], -[AC_LINK_IFELSE([ -typedef unsigned int uint64 __attribute__ ((mode (DI))); -uint64 i; -int main() { return __sync_add_and_fetch (&i, 1); } -], -[libgo_cv_func___sync_add_and_fetch_8=yes], -[libgo_cv_func___sync_add_and_fetch_8=no])]) -if test "$libgo_cv_func___sync_add_and_fetch_8" = "yes"; then - AC_DEFINE(HAVE_SYNC_ADD_AND_FETCH_8, 1, - [Define to 1 if the compiler provides the __sync_add_and_fetch function for uint64]) -fi - -dnl For x86 we want to use the -minline-all-stringops option to avoid -dnl forcing a stack split when calling memcpy and friends. -AC_CACHE_CHECK([whether compiler supports -minline-all-stringops], -[libgo_cv_c_stringops], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -minline-all-stringops" -AC_COMPILE_IFELSE([int i;], -[libgo_cv_c_stringops=yes], -[libgo_cv_c_stringops=no]) -CFLAGS=$CFLAGS_hold]) -STRINGOPS_FLAG= -if test "$libgo_cv_c_stringops" = yes; then - STRINGOPS_FLAG=-minline-all-stringops -fi -AC_SUBST(STRINGOPS_FLAG) - -dnl For x86 we want to compile the math library with -mfancy-math-387 -dnl -funsafe-math-optimizations so that we can use the builtin -dnl instructions directly. -AC_CACHE_CHECK([whether compiler supports -mfancy-math-387], -[libgo_cv_c_fancymath], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -mfancy-math-387" -AC_COMPILE_IFELSE([int i;], -[libgo_cv_c_fancymath=yes], -[libgo_cv_c_fancymath=no]) -CFLAGS=$CFLAGS_hold]) -MATH_FLAG= -if test "$libgo_cv_c_fancymath" = yes; then - MATH_FLAG="-mfancy-math-387 -funsafe-math-optimizations" -else - MATH_FLAG="-ffp-contract=off" -fi -AC_SUBST(MATH_FLAG) - -CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE" -AC_CHECK_TYPES([off64_t]) -CFLAGS=$CFLAGS_hold - -dnl Work out the size of the epoll_events struct on GNU/Linux. -AC_CACHE_CHECK([epoll_event size], -[libgo_cv_c_epoll_event_size], -[AC_COMPUTE_INT(libgo_cv_c_epoll_event_size, -[sizeof (struct epoll_event)], -[#include ], -[libgo_cv_c_epoll_event_size=0])]) -SIZEOF_STRUCT_EPOLL_EVENT=${libgo_cv_c_epoll_event_size} -AC_SUBST(SIZEOF_STRUCT_EPOLL_EVENT) - -dnl Work out the offset of the fd field in the epoll_events struct on -dnl GNU/Linux. -AC_CACHE_CHECK([epoll_event data.fd offset], -[libgo_cv_c_epoll_event_fd_offset], -[AC_COMPUTE_INT(libgo_cv_c_epoll_event_fd_offset, -[offsetof (struct epoll_event, data.fd)], -[#include -#include ], -[libgo_cv_c_epoll_event_fd_offset=0])]) -STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} -AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET) - -dnl Check if uses timespec_t for st_?tim members. Introduced -dnl in Solaris 12 for XPG7 compatibility. -AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h], - [have_stat_timespec=yes], [have_stat_timespec=no]) -AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes) - -dnl See if struct exception is defined in . -AC_CHECK_TYPE([struct exception], -[libgo_has_struct_exception=yes], -[libgo_has_struct_exception=no], -[#include ]) -if test "$libgo_has_struct_exception" = "yes"; then - AC_DEFINE(HAVE_STRUCT_EXCEPTION, 1, - [Define to 1 if defines struct exception]) -fi - -dnl See whether setcontext changes the value of TLS variables. -AC_CACHE_CHECK([whether setcontext clobbers TLS variables], -[libgo_cv_lib_setcontext_clobbers_tls], -[CFLAGS_hold="$CFLAGS" -CFLAGS="$PTHREAD_CFLAGS" -LIBS_hold="$LIBS" -LIBS="$LIBS $PTHREAD_LIBS" -AC_CHECK_SIZEOF([void *]) -AS_VAR_ARITH([ptr_type_size], [$ac_cv_sizeof_void_p \* 8]) -AC_RUN_IFELSE( - [AC_LANG_SOURCE([ -#include -#include -#include -#include - -__thread int tls; - -static char stack[[10 * 1024 * 1024]]; -static ucontext_t c; - -/* Called via makecontext/setcontext. */ - -static void -cfn (void) -{ - exit (tls); -} - -/* Called via pthread_create. */ - -static void * -tfn (void *dummy) -{ - /* The thread should still see this value after calling - setcontext. */ - tls = 0; - - setcontext (&c); - - /* The call to setcontext should not return. */ - abort (); -} - -int -main () -{ - pthread_t tid; - - /* The thread should not see this value. */ - tls = 1; - - if (getcontext (&c) < 0) - abort (); - - c.uc_stack.ss_sp = stack; -#ifdef MAKECONTEXT_STACK_TOP - c.uc_stack.ss_sp += sizeof stack; -#endif - c.uc_stack.ss_flags = 0; - c.uc_stack.ss_size = sizeof stack; - c.uc_link = NULL; - makecontext (&c, cfn, 0); - - if (pthread_create (&tid, NULL, tfn, NULL) != 0) - abort (); - - if (pthread_join (tid, NULL) != 0) - abort (); - - /* The thread should have called exit. */ - abort (); -} -])], -[libgo_cv_lib_setcontext_clobbers_tls=no], -[libgo_cv_lib_setcontext_clobbers_tls=yes], -[case "$target:$ptr_type_size" in - i?86-*-solaris2.1[[01]]:64 | x86_64*-*-solaris2.1[[01]]:64) - libgo_cv_lib_setcontext_clobbers_tls=yes ;; - *) - libgo_cv_lib_setcontext_clobbers_tls=no ;; - esac -]) -CFLAGS="$CFLAGS_hold" -LIBS="$LIBS_hold" -]) -if test "$libgo_cv_lib_setcontext_clobbers_tls" = "yes"; then - AC_DEFINE(SETCONTEXT_CLOBBERS_TLS, 1, - [Define if setcontext clobbers TLS variables]) -fi - -AC_CACHE_CHECK([whether .eh_frame section should be read-only], -libgo_cv_ro_eh_frame, [ -libgo_cv_ro_eh_frame=no -echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c -if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then - if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then - libgo_cv_ro_eh_frame=yes - elif grep '.section.*eh_frame.*#alloc' conftest.c \ - | grep -v '#write' > /dev/null; then - libgo_cv_ro_eh_frame=yes - fi -fi -rm -f conftest.* -]) -if test "x$libgo_cv_ro_eh_frame" = xyes; then - AC_DEFINE(EH_FRAME_FLAGS, "a", - [Define to the flags needed for the .section .eh_frame directive.]) -else - AC_DEFINE(EH_FRAME_FLAGS, "aw", - [Define to the flags needed for the .section .eh_frame directive.]) -fi - -AC_CACHE_CHECK([if compiler supports -Qunused-arguments], -[libgo_cv_c_unused_arguments], -[CFLAGS_hold=$CFLAGS -CFLAGS="$CFLAGS -Qunused-arguments" -AC_COMPILE_IFELSE([[int i;]], -[libgo_cv_c_unused_arguments=yes], -[libgo_cv_c_unused_arguments=no]) -CFLAGS=$CFLAGS_hold]) - -AC_CACHE_CHECK([if assembler supports GNU comdat group syntax], -libgo_cv_as_comdat_gnu, [ -echo '.section .text,"axG",@progbits,.foo,comdat' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then - libgo_cv_as_comdat_gnu=yes -else - libgo_cv_as_comdat_gnu=no -fi -CFLAGS=$CFLAGS_hold -]) -if test "x$libgo_cv_as_comdat_gnu" = xyes; then - AC_DEFINE(HAVE_AS_COMDAT_GAS, 1, - [Define if your assembler supports GNU comdat group syntax.]) -fi - -AC_CACHE_CHECK([assembler supports pc related relocs], -libgo_cv_as_x86_pcrel, [ -libgo_cv_as_x86_pcrel=yes -echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then - libgo_cv_as_x86_pcrel=no -fi -CFLAGS=$CFLAGS_hold -]) -if test "x$libgo_cv_as_x86_pcrel" = xyes; then - AC_DEFINE(HAVE_AS_X86_PCREL, 1, - [Define if your assembler supports PC relative relocs.]) -fi - -AC_CACHE_CHECK([assembler supports unwind section type], -libgo_cv_as_x86_64_unwind_section_type, [ -libgo_cv_as_x86_64_unwind_section_type=yes -echo '.section .eh_frame,"a",@unwind' > conftest.s -CFLAGS_hold=$CFLAGS -if test "$libgo_cv_c_unused_arguments" = yes; then - CFLAGS="$CFLAGS -Qunused-arguments" -fi -if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libgo_cv_as_x86_64_unwind_section_type=no -fi -CFLAGS=$CFLAGS_hold -]) -if test "x$libgo_cv_as_x86_64_unwind_section_type" = xyes; then - AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, - [Define if your assembler supports unwind section type.]) -fi - -AC_CACHE_SAVE - -if test ${multilib} = yes; then - multilib_arg="--enable-multilib" -else - multilib_arg= -fi - -AC_CONFIG_FILES(Makefile testsuite/Makefile) - -AC_CONFIG_COMMANDS([default], -[if test -n "$CONFIG_FILES"; then - # Multilibs need MULTISUBDIR defined correctly in certain makefiles so - # that multilib installs will end up installed in the correct place. - # The testsuite needs it for multilib-aware ABI baseline files. - # To work around this not being passed down from config-ml.in -> - # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually - # append it here. Only modify Makefiles that have just been created. - # - # Also, get rid of this simulated-VPATH thing that automake does. - cat > vpsed << \_EOF -s!`test -f '$<' || echo '$(srcdir)/'`!! -_EOF - for i in $SUBDIRS; do - case $CONFIG_FILES in - *${i}/Makefile*) - #echo "Adding MULTISUBDIR to $i/Makefile" - sed -f vpsed $i/Makefile > tmp - grep '^MULTISUBDIR =' Makefile >> tmp - mv tmp $i/Makefile - ;; - esac - done - rm vpsed - fi -], -[ -# Variables needed in config.status (file generation) which aren't already -# passed by autoconf. -SUBDIRS="$SUBDIRS" -]) - -AC_OUTPUT diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/common.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/common.go deleted file mode 100644 index c31df062f7ea54577bafe6eb25dfb06ef2a2a55f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/common.go +++ /dev/null @@ -1,329 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package tar implements access to tar archives. -// It aims to cover most of the variations, including those produced -// by GNU and BSD tars. -// -// References: -// http://www.freebsd.org/cgi/man.cgi?query=tar&sektion=5 -// http://www.gnu.org/software/tar/manual/html_node/Standard.html -// http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html -package tar - -import ( - "bytes" - "errors" - "fmt" - "os" - "path" - "time" -) - -const ( - blockSize = 512 - - // Types - TypeReg = '0' // regular file - TypeRegA = '\x00' // regular file - TypeLink = '1' // hard link - TypeSymlink = '2' // symbolic link - TypeChar = '3' // character device node - TypeBlock = '4' // block device node - TypeDir = '5' // directory - TypeFifo = '6' // fifo node - TypeCont = '7' // reserved - TypeXHeader = 'x' // extended header - TypeXGlobalHeader = 'g' // global extended header - TypeGNULongName = 'L' // Next file has a long name - TypeGNULongLink = 'K' // Next file symlinks to a file w/ a long name - TypeGNUSparse = 'S' // sparse file -) - -// A Header represents a single header in a tar archive. -// Some fields may not be populated. -type Header struct { - Name string // name of header file entry - Mode int64 // permission and mode bits - Uid int // user id of owner - Gid int // group id of owner - Size int64 // length in bytes - ModTime time.Time // modified time - Typeflag byte // type of header entry - Linkname string // target name of link - Uname string // user name of owner - Gname string // group name of owner - Devmajor int64 // major number of character or block device - Devminor int64 // minor number of character or block device - AccessTime time.Time // access time - ChangeTime time.Time // status change time - Xattrs map[string]string -} - -// File name constants from the tar spec. -const ( - fileNameSize = 100 // Maximum number of bytes in a standard tar name. - fileNamePrefixSize = 155 // Maximum number of ustar extension bytes. -) - -// FileInfo returns an os.FileInfo for the Header. -func (h *Header) FileInfo() os.FileInfo { - return headerFileInfo{h} -} - -// headerFileInfo implements os.FileInfo. -type headerFileInfo struct { - h *Header -} - -func (fi headerFileInfo) Size() int64 { return fi.h.Size } -func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() } -func (fi headerFileInfo) ModTime() time.Time { return fi.h.ModTime } -func (fi headerFileInfo) Sys() interface{} { return fi.h } - -// Name returns the base name of the file. -func (fi headerFileInfo) Name() string { - if fi.IsDir() { - return path.Base(path.Clean(fi.h.Name)) - } - return path.Base(fi.h.Name) -} - -// Mode returns the permission and mode bits for the headerFileInfo. -func (fi headerFileInfo) Mode() (mode os.FileMode) { - // Set file permission bits. - mode = os.FileMode(fi.h.Mode).Perm() - - // Set setuid, setgid and sticky bits. - if fi.h.Mode&c_ISUID != 0 { - // setuid - mode |= os.ModeSetuid - } - if fi.h.Mode&c_ISGID != 0 { - // setgid - mode |= os.ModeSetgid - } - if fi.h.Mode&c_ISVTX != 0 { - // sticky - mode |= os.ModeSticky - } - - // Set file mode bits. - // clear perm, setuid, setgid and sticky bits. - m := os.FileMode(fi.h.Mode) &^ 07777 - if m == c_ISDIR { - // directory - mode |= os.ModeDir - } - if m == c_ISFIFO { - // named pipe (FIFO) - mode |= os.ModeNamedPipe - } - if m == c_ISLNK { - // symbolic link - mode |= os.ModeSymlink - } - if m == c_ISBLK { - // device file - mode |= os.ModeDevice - } - if m == c_ISCHR { - // Unix character device - mode |= os.ModeDevice - mode |= os.ModeCharDevice - } - if m == c_ISSOCK { - // Unix domain socket - mode |= os.ModeSocket - } - - switch fi.h.Typeflag { - case TypeSymlink: - // symbolic link - mode |= os.ModeSymlink - case TypeChar: - // character device node - mode |= os.ModeDevice - mode |= os.ModeCharDevice - case TypeBlock: - // block device node - mode |= os.ModeDevice - case TypeDir: - // directory - mode |= os.ModeDir - case TypeFifo: - // fifo node - mode |= os.ModeNamedPipe - } - - return mode -} - -// sysStat, if non-nil, populates h from system-dependent fields of fi. -var sysStat func(fi os.FileInfo, h *Header) error - -// Mode constants from the tar spec. -const ( - c_ISUID = 04000 // Set uid - c_ISGID = 02000 // Set gid - c_ISVTX = 01000 // Save text (sticky bit) - c_ISDIR = 040000 // Directory - c_ISFIFO = 010000 // FIFO - c_ISREG = 0100000 // Regular file - c_ISLNK = 0120000 // Symbolic link - c_ISBLK = 060000 // Block special file - c_ISCHR = 020000 // Character special file - c_ISSOCK = 0140000 // Socket -) - -// Keywords for the PAX Extended Header -const ( - paxAtime = "atime" - paxCharset = "charset" - paxComment = "comment" - paxCtime = "ctime" // please note that ctime is not a valid pax header. - paxGid = "gid" - paxGname = "gname" - paxLinkpath = "linkpath" - paxMtime = "mtime" - paxPath = "path" - paxSize = "size" - paxUid = "uid" - paxUname = "uname" - paxXattr = "SCHILY.xattr." - paxNone = "" -) - -// FileInfoHeader creates a partially-populated Header from fi. -// If fi describes a symlink, FileInfoHeader records link as the link target. -// If fi describes a directory, a slash is appended to the name. -// Because os.FileInfo's Name method returns only the base name of -// the file it describes, it may be necessary to modify the Name field -// of the returned header to provide the full path name of the file. -func FileInfoHeader(fi os.FileInfo, link string) (*Header, error) { - if fi == nil { - return nil, errors.New("tar: FileInfo is nil") - } - fm := fi.Mode() - h := &Header{ - Name: fi.Name(), - ModTime: fi.ModTime(), - Mode: int64(fm.Perm()), // or'd with c_IS* constants later - } - switch { - case fm.IsRegular(): - h.Mode |= c_ISREG - h.Typeflag = TypeReg - h.Size = fi.Size() - case fi.IsDir(): - h.Typeflag = TypeDir - h.Mode |= c_ISDIR - h.Name += "/" - case fm&os.ModeSymlink != 0: - h.Typeflag = TypeSymlink - h.Mode |= c_ISLNK - h.Linkname = link - case fm&os.ModeDevice != 0: - if fm&os.ModeCharDevice != 0 { - h.Mode |= c_ISCHR - h.Typeflag = TypeChar - } else { - h.Mode |= c_ISBLK - h.Typeflag = TypeBlock - } - case fm&os.ModeNamedPipe != 0: - h.Typeflag = TypeFifo - h.Mode |= c_ISFIFO - case fm&os.ModeSocket != 0: - h.Mode |= c_ISSOCK - default: - return nil, fmt.Errorf("archive/tar: unknown file mode %v", fm) - } - if fm&os.ModeSetuid != 0 { - h.Mode |= c_ISUID - } - if fm&os.ModeSetgid != 0 { - h.Mode |= c_ISGID - } - if fm&os.ModeSticky != 0 { - h.Mode |= c_ISVTX - } - // If possible, populate additional fields from OS-specific - // FileInfo fields. - if sys, ok := fi.Sys().(*Header); ok { - // This FileInfo came from a Header (not the OS). Use the - // original Header to populate all remaining fields. - h.Uid = sys.Uid - h.Gid = sys.Gid - h.Uname = sys.Uname - h.Gname = sys.Gname - h.AccessTime = sys.AccessTime - h.ChangeTime = sys.ChangeTime - if sys.Xattrs != nil { - h.Xattrs = make(map[string]string) - for k, v := range sys.Xattrs { - h.Xattrs[k] = v - } - } - if sys.Typeflag == TypeLink { - // hard link - h.Typeflag = TypeLink - h.Size = 0 - h.Linkname = sys.Linkname - } - } - if sysStat != nil { - return h, sysStat(fi, h) - } - return h, nil -} - -var zeroBlock = make([]byte, blockSize) - -// POSIX specifies a sum of the unsigned byte values, but the Sun tar uses signed byte values. -// We compute and return both. -func checksum(header []byte) (unsigned int64, signed int64) { - for i := 0; i < len(header); i++ { - if i == 148 { - // The chksum field (header[148:156]) is special: it should be treated as space bytes. - unsigned += ' ' * 8 - signed += ' ' * 8 - i += 7 - continue - } - unsigned += int64(header[i]) - signed += int64(int8(header[i])) - } - return -} - -type slicer []byte - -func (sp *slicer) next(n int) (b []byte) { - s := *sp - b, *sp = s[0:n], s[n:] - return -} - -func isASCII(s string) bool { - for _, c := range s { - if c >= 0x80 { - return false - } - } - return true -} - -func toASCII(s string) string { - if isASCII(s) { - return s - } - var buf bytes.Buffer - for _, c := range s { - if c < 0x80 { - buf.WriteByte(byte(c)) - } - } - return buf.String() -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/reader.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/reader.go deleted file mode 100644 index 67daca27a95b4aa9d4968c66bad117165d6e278b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/reader.go +++ /dev/null @@ -1,835 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tar - -// TODO(dsymonds): -// - pax extensions - -import ( - "bytes" - "errors" - "io" - "io/ioutil" - "os" - "strconv" - "strings" - "time" -) - -var ( - ErrHeader = errors.New("archive/tar: invalid tar header") -) - -const maxNanoSecondIntSize = 9 - -// A Reader provides sequential access to the contents of a tar archive. -// A tar archive consists of a sequence of files. -// The Next method advances to the next file in the archive (including the first), -// and then it can be treated as an io.Reader to access the file's data. -type Reader struct { - r io.Reader - err error - pad int64 // amount of padding (ignored) after current file entry - curr numBytesReader // reader for current file entry - hdrBuff [blockSize]byte // buffer to use in readHeader -} - -// A numBytesReader is an io.Reader with a numBytes method, returning the number -// of bytes remaining in the underlying encoded data. -type numBytesReader interface { - io.Reader - numBytes() int64 -} - -// A regFileReader is a numBytesReader for reading file data from a tar archive. -type regFileReader struct { - r io.Reader // underlying reader - nb int64 // number of unread bytes for current file entry -} - -// A sparseFileReader is a numBytesReader for reading sparse file data from a tar archive. -type sparseFileReader struct { - rfr *regFileReader // reads the sparse-encoded file data - sp []sparseEntry // the sparse map for the file - pos int64 // keeps track of file position - tot int64 // total size of the file -} - -// Keywords for GNU sparse files in a PAX extended header -const ( - paxGNUSparseNumBlocks = "GNU.sparse.numblocks" - paxGNUSparseOffset = "GNU.sparse.offset" - paxGNUSparseNumBytes = "GNU.sparse.numbytes" - paxGNUSparseMap = "GNU.sparse.map" - paxGNUSparseName = "GNU.sparse.name" - paxGNUSparseMajor = "GNU.sparse.major" - paxGNUSparseMinor = "GNU.sparse.minor" - paxGNUSparseSize = "GNU.sparse.size" - paxGNUSparseRealSize = "GNU.sparse.realsize" -) - -// Keywords for old GNU sparse headers -const ( - oldGNUSparseMainHeaderOffset = 386 - oldGNUSparseMainHeaderIsExtendedOffset = 482 - oldGNUSparseMainHeaderNumEntries = 4 - oldGNUSparseExtendedHeaderIsExtendedOffset = 504 - oldGNUSparseExtendedHeaderNumEntries = 21 - oldGNUSparseOffsetSize = 12 - oldGNUSparseNumBytesSize = 12 -) - -// NewReader creates a new Reader reading from r. -func NewReader(r io.Reader) *Reader { return &Reader{r: r} } - -// Next advances to the next entry in the tar archive. -// -// io.EOF is returned at the end of the input. -func (tr *Reader) Next() (*Header, error) { - var hdr *Header - if tr.err == nil { - tr.skipUnread() - } - if tr.err != nil { - return hdr, tr.err - } - hdr = tr.readHeader() - if hdr == nil { - return hdr, tr.err - } - // Check for PAX/GNU header. - switch hdr.Typeflag { - case TypeXHeader: - // PAX extended header - headers, err := parsePAX(tr) - if err != nil { - return nil, err - } - // We actually read the whole file, - // but this skips alignment padding - tr.skipUnread() - if tr.err != nil { - return nil, tr.err - } - hdr = tr.readHeader() - if hdr == nil { - return nil, tr.err - } - mergePAX(hdr, headers) - - // Check for a PAX format sparse file - sp, err := tr.checkForGNUSparsePAXHeaders(hdr, headers) - if err != nil { - tr.err = err - return nil, err - } - if sp != nil { - // Current file is a PAX format GNU sparse file. - // Set the current file reader to a sparse file reader. - tr.curr = &sparseFileReader{rfr: tr.curr.(*regFileReader), sp: sp, tot: hdr.Size} - } - return hdr, nil - case TypeGNULongName: - // We have a GNU long name header. Its contents are the real file name. - realname, err := ioutil.ReadAll(tr) - if err != nil { - return nil, err - } - hdr, err := tr.Next() - hdr.Name = cString(realname) - return hdr, err - case TypeGNULongLink: - // We have a GNU long link header. - realname, err := ioutil.ReadAll(tr) - if err != nil { - return nil, err - } - hdr, err := tr.Next() - hdr.Linkname = cString(realname) - return hdr, err - } - return hdr, tr.err -} - -// checkForGNUSparsePAXHeaders checks the PAX headers for GNU sparse headers. If they are found, then -// this function reads the sparse map and returns it. Unknown sparse formats are ignored, causing the file to -// be treated as a regular file. -func (tr *Reader) checkForGNUSparsePAXHeaders(hdr *Header, headers map[string]string) ([]sparseEntry, error) { - var sparseFormat string - - // Check for sparse format indicators - major, majorOk := headers[paxGNUSparseMajor] - minor, minorOk := headers[paxGNUSparseMinor] - sparseName, sparseNameOk := headers[paxGNUSparseName] - _, sparseMapOk := headers[paxGNUSparseMap] - sparseSize, sparseSizeOk := headers[paxGNUSparseSize] - sparseRealSize, sparseRealSizeOk := headers[paxGNUSparseRealSize] - - // Identify which, if any, sparse format applies from which PAX headers are set - if majorOk && minorOk { - sparseFormat = major + "." + minor - } else if sparseNameOk && sparseMapOk { - sparseFormat = "0.1" - } else if sparseSizeOk { - sparseFormat = "0.0" - } else { - // Not a PAX format GNU sparse file. - return nil, nil - } - - // Check for unknown sparse format - if sparseFormat != "0.0" && sparseFormat != "0.1" && sparseFormat != "1.0" { - return nil, nil - } - - // Update hdr from GNU sparse PAX headers - if sparseNameOk { - hdr.Name = sparseName - } - if sparseSizeOk { - realSize, err := strconv.ParseInt(sparseSize, 10, 0) - if err != nil { - return nil, ErrHeader - } - hdr.Size = realSize - } else if sparseRealSizeOk { - realSize, err := strconv.ParseInt(sparseRealSize, 10, 0) - if err != nil { - return nil, ErrHeader - } - hdr.Size = realSize - } - - // Set up the sparse map, according to the particular sparse format in use - var sp []sparseEntry - var err error - switch sparseFormat { - case "0.0", "0.1": - sp, err = readGNUSparseMap0x1(headers) - case "1.0": - sp, err = readGNUSparseMap1x0(tr.curr) - } - return sp, err -} - -// mergePAX merges well known headers according to PAX standard. -// In general headers with the same name as those found -// in the header struct overwrite those found in the header -// struct with higher precision or longer values. Esp. useful -// for name and linkname fields. -func mergePAX(hdr *Header, headers map[string]string) error { - for k, v := range headers { - switch k { - case paxPath: - hdr.Name = v - case paxLinkpath: - hdr.Linkname = v - case paxGname: - hdr.Gname = v - case paxUname: - hdr.Uname = v - case paxUid: - uid, err := strconv.ParseInt(v, 10, 0) - if err != nil { - return err - } - hdr.Uid = int(uid) - case paxGid: - gid, err := strconv.ParseInt(v, 10, 0) - if err != nil { - return err - } - hdr.Gid = int(gid) - case paxAtime: - t, err := parsePAXTime(v) - if err != nil { - return err - } - hdr.AccessTime = t - case paxMtime: - t, err := parsePAXTime(v) - if err != nil { - return err - } - hdr.ModTime = t - case paxCtime: - t, err := parsePAXTime(v) - if err != nil { - return err - } - hdr.ChangeTime = t - case paxSize: - size, err := strconv.ParseInt(v, 10, 0) - if err != nil { - return err - } - hdr.Size = int64(size) - default: - if strings.HasPrefix(k, paxXattr) { - if hdr.Xattrs == nil { - hdr.Xattrs = make(map[string]string) - } - hdr.Xattrs[k[len(paxXattr):]] = v - } - } - } - return nil -} - -// parsePAXTime takes a string of the form %d.%d as described in -// the PAX specification. -func parsePAXTime(t string) (time.Time, error) { - buf := []byte(t) - pos := bytes.IndexByte(buf, '.') - var seconds, nanoseconds int64 - var err error - if pos == -1 { - seconds, err = strconv.ParseInt(t, 10, 0) - if err != nil { - return time.Time{}, err - } - } else { - seconds, err = strconv.ParseInt(string(buf[:pos]), 10, 0) - if err != nil { - return time.Time{}, err - } - nano_buf := string(buf[pos+1:]) - // Pad as needed before converting to a decimal. - // For example .030 -> .030000000 -> 30000000 nanoseconds - if len(nano_buf) < maxNanoSecondIntSize { - // Right pad - nano_buf += strings.Repeat("0", maxNanoSecondIntSize-len(nano_buf)) - } else if len(nano_buf) > maxNanoSecondIntSize { - // Right truncate - nano_buf = nano_buf[:maxNanoSecondIntSize] - } - nanoseconds, err = strconv.ParseInt(string(nano_buf), 10, 0) - if err != nil { - return time.Time{}, err - } - } - ts := time.Unix(seconds, nanoseconds) - return ts, nil -} - -// parsePAX parses PAX headers. -// If an extended header (type 'x') is invalid, ErrHeader is returned -func parsePAX(r io.Reader) (map[string]string, error) { - buf, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - // For GNU PAX sparse format 0.0 support. - // This function transforms the sparse format 0.0 headers into sparse format 0.1 headers. - var sparseMap bytes.Buffer - - headers := make(map[string]string) - // Each record is constructed as - // "%d %s=%s\n", length, keyword, value - for len(buf) > 0 { - // or the header was empty to start with. - var sp int - // The size field ends at the first space. - sp = bytes.IndexByte(buf, ' ') - if sp == -1 { - return nil, ErrHeader - } - // Parse the first token as a decimal integer. - n, err := strconv.ParseInt(string(buf[:sp]), 10, 0) - if err != nil || n < 5 || int64(len(buf)) < n { - return nil, ErrHeader - } - // Extract everything between the decimal and the n -1 on the - // beginning to eat the ' ', -1 on the end to skip the newline. - var record []byte - record, buf = buf[sp+1:n-1], buf[n:] - // The first equals is guaranteed to mark the end of the key. - // Everything else is value. - eq := bytes.IndexByte(record, '=') - if eq == -1 { - return nil, ErrHeader - } - key, value := record[:eq], record[eq+1:] - - keyStr := string(key) - if keyStr == paxGNUSparseOffset || keyStr == paxGNUSparseNumBytes { - // GNU sparse format 0.0 special key. Write to sparseMap instead of using the headers map. - sparseMap.Write(value) - sparseMap.Write([]byte{','}) - } else { - // Normal key. Set the value in the headers map. - headers[keyStr] = string(value) - } - } - if sparseMap.Len() != 0 { - // Add sparse info to headers, chopping off the extra comma - sparseMap.Truncate(sparseMap.Len() - 1) - headers[paxGNUSparseMap] = sparseMap.String() - } - return headers, nil -} - -// cString parses bytes as a NUL-terminated C-style string. -// If a NUL byte is not found then the whole slice is returned as a string. -func cString(b []byte) string { - n := 0 - for n < len(b) && b[n] != 0 { - n++ - } - return string(b[0:n]) -} - -func (tr *Reader) octal(b []byte) int64 { - // Check for binary format first. - if len(b) > 0 && b[0]&0x80 != 0 { - var x int64 - for i, c := range b { - if i == 0 { - c &= 0x7f // ignore signal bit in first byte - } - x = x<<8 | int64(c) - } - return x - } - - // Because unused fields are filled with NULs, we need - // to skip leading NULs. Fields may also be padded with - // spaces or NULs. - // So we remove leading and trailing NULs and spaces to - // be sure. - b = bytes.Trim(b, " \x00") - - if len(b) == 0 { - return 0 - } - x, err := strconv.ParseUint(cString(b), 8, 64) - if err != nil { - tr.err = err - } - return int64(x) -} - -// skipUnread skips any unread bytes in the existing file entry, as well as any alignment padding. -func (tr *Reader) skipUnread() { - nr := tr.numBytes() + tr.pad // number of bytes to skip - tr.curr, tr.pad = nil, 0 - if sr, ok := tr.r.(io.Seeker); ok { - if _, err := sr.Seek(nr, os.SEEK_CUR); err == nil { - return - } - } - _, tr.err = io.CopyN(ioutil.Discard, tr.r, nr) -} - -func (tr *Reader) verifyChecksum(header []byte) bool { - if tr.err != nil { - return false - } - - given := tr.octal(header[148:156]) - unsigned, signed := checksum(header) - return given == unsigned || given == signed -} - -func (tr *Reader) readHeader() *Header { - header := tr.hdrBuff[:] - copy(header, zeroBlock) - - if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil { - return nil - } - - // Two blocks of zero bytes marks the end of the archive. - if bytes.Equal(header, zeroBlock[0:blockSize]) { - if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil { - return nil - } - if bytes.Equal(header, zeroBlock[0:blockSize]) { - tr.err = io.EOF - } else { - tr.err = ErrHeader // zero block and then non-zero block - } - return nil - } - - if !tr.verifyChecksum(header) { - tr.err = ErrHeader - return nil - } - - // Unpack - hdr := new(Header) - s := slicer(header) - - hdr.Name = cString(s.next(100)) - hdr.Mode = tr.octal(s.next(8)) - hdr.Uid = int(tr.octal(s.next(8))) - hdr.Gid = int(tr.octal(s.next(8))) - hdr.Size = tr.octal(s.next(12)) - if hdr.Size < 0 { - tr.err = ErrHeader - return nil - } - hdr.ModTime = time.Unix(tr.octal(s.next(12)), 0) - s.next(8) // chksum - hdr.Typeflag = s.next(1)[0] - hdr.Linkname = cString(s.next(100)) - - // The remainder of the header depends on the value of magic. - // The original (v7) version of tar had no explicit magic field, - // so its magic bytes, like the rest of the block, are NULs. - magic := string(s.next(8)) // contains version field as well. - var format string - switch { - case magic[:6] == "ustar\x00": // POSIX tar (1003.1-1988) - if string(header[508:512]) == "tar\x00" { - format = "star" - } else { - format = "posix" - } - case magic == "ustar \x00": // old GNU tar - format = "gnu" - } - - switch format { - case "posix", "gnu", "star": - hdr.Uname = cString(s.next(32)) - hdr.Gname = cString(s.next(32)) - devmajor := s.next(8) - devminor := s.next(8) - if hdr.Typeflag == TypeChar || hdr.Typeflag == TypeBlock { - hdr.Devmajor = tr.octal(devmajor) - hdr.Devminor = tr.octal(devminor) - } - var prefix string - switch format { - case "posix", "gnu": - prefix = cString(s.next(155)) - case "star": - prefix = cString(s.next(131)) - hdr.AccessTime = time.Unix(tr.octal(s.next(12)), 0) - hdr.ChangeTime = time.Unix(tr.octal(s.next(12)), 0) - } - if len(prefix) > 0 { - hdr.Name = prefix + "/" + hdr.Name - } - } - - if tr.err != nil { - tr.err = ErrHeader - return nil - } - - // Maximum value of hdr.Size is 64 GB (12 octal digits), - // so there's no risk of int64 overflowing. - nb := int64(hdr.Size) - tr.pad = -nb & (blockSize - 1) // blockSize is a power of two - - // Set the current file reader. - tr.curr = ®FileReader{r: tr.r, nb: nb} - - // Check for old GNU sparse format entry. - if hdr.Typeflag == TypeGNUSparse { - // Get the real size of the file. - hdr.Size = tr.octal(header[483:495]) - - // Read the sparse map. - sp := tr.readOldGNUSparseMap(header) - if tr.err != nil { - return nil - } - // Current file is a GNU sparse file. Update the current file reader. - tr.curr = &sparseFileReader{rfr: tr.curr.(*regFileReader), sp: sp, tot: hdr.Size} - } - - return hdr -} - -// A sparseEntry holds a single entry in a sparse file's sparse map. -// A sparse entry indicates the offset and size in a sparse file of a -// block of data. -type sparseEntry struct { - offset int64 - numBytes int64 -} - -// readOldGNUSparseMap reads the sparse map as stored in the old GNU sparse format. -// The sparse map is stored in the tar header if it's small enough. If it's larger than four entries, -// then one or more extension headers are used to store the rest of the sparse map. -func (tr *Reader) readOldGNUSparseMap(header []byte) []sparseEntry { - isExtended := header[oldGNUSparseMainHeaderIsExtendedOffset] != 0 - spCap := oldGNUSparseMainHeaderNumEntries - if isExtended { - spCap += oldGNUSparseExtendedHeaderNumEntries - } - sp := make([]sparseEntry, 0, spCap) - s := slicer(header[oldGNUSparseMainHeaderOffset:]) - - // Read the four entries from the main tar header - for i := 0; i < oldGNUSparseMainHeaderNumEntries; i++ { - offset := tr.octal(s.next(oldGNUSparseOffsetSize)) - numBytes := tr.octal(s.next(oldGNUSparseNumBytesSize)) - if tr.err != nil { - tr.err = ErrHeader - return nil - } - if offset == 0 && numBytes == 0 { - break - } - sp = append(sp, sparseEntry{offset: offset, numBytes: numBytes}) - } - - for isExtended { - // There are more entries. Read an extension header and parse its entries. - sparseHeader := make([]byte, blockSize) - if _, tr.err = io.ReadFull(tr.r, sparseHeader); tr.err != nil { - return nil - } - isExtended = sparseHeader[oldGNUSparseExtendedHeaderIsExtendedOffset] != 0 - s = slicer(sparseHeader) - for i := 0; i < oldGNUSparseExtendedHeaderNumEntries; i++ { - offset := tr.octal(s.next(oldGNUSparseOffsetSize)) - numBytes := tr.octal(s.next(oldGNUSparseNumBytesSize)) - if tr.err != nil { - tr.err = ErrHeader - return nil - } - if offset == 0 && numBytes == 0 { - break - } - sp = append(sp, sparseEntry{offset: offset, numBytes: numBytes}) - } - } - return sp -} - -// readGNUSparseMap1x0 reads the sparse map as stored in GNU's PAX sparse format version 1.0. -// The sparse map is stored just before the file data and padded out to the nearest block boundary. -func readGNUSparseMap1x0(r io.Reader) ([]sparseEntry, error) { - buf := make([]byte, 2*blockSize) - sparseHeader := buf[:blockSize] - - // readDecimal is a helper function to read a decimal integer from the sparse map - // while making sure to read from the file in blocks of size blockSize - readDecimal := func() (int64, error) { - // Look for newline - nl := bytes.IndexByte(sparseHeader, '\n') - if nl == -1 { - if len(sparseHeader) >= blockSize { - // This is an error - return 0, ErrHeader - } - oldLen := len(sparseHeader) - newLen := oldLen + blockSize - if cap(sparseHeader) < newLen { - // There's more header, but we need to make room for the next block - copy(buf, sparseHeader) - sparseHeader = buf[:newLen] - } else { - // There's more header, and we can just reslice - sparseHeader = sparseHeader[:newLen] - } - - // Now that sparseHeader is large enough, read next block - if _, err := io.ReadFull(r, sparseHeader[oldLen:newLen]); err != nil { - return 0, err - } - - // Look for a newline in the new data - nl = bytes.IndexByte(sparseHeader[oldLen:newLen], '\n') - if nl == -1 { - // This is an error - return 0, ErrHeader - } - nl += oldLen // We want the position from the beginning - } - // Now that we've found a newline, read a number - n, err := strconv.ParseInt(string(sparseHeader[:nl]), 10, 0) - if err != nil { - return 0, ErrHeader - } - - // Update sparseHeader to consume this number - sparseHeader = sparseHeader[nl+1:] - return n, nil - } - - // Read the first block - if _, err := io.ReadFull(r, sparseHeader); err != nil { - return nil, err - } - - // The first line contains the number of entries - numEntries, err := readDecimal() - if err != nil { - return nil, err - } - - // Read all the entries - sp := make([]sparseEntry, 0, numEntries) - for i := int64(0); i < numEntries; i++ { - // Read the offset - offset, err := readDecimal() - if err != nil { - return nil, err - } - // Read numBytes - numBytes, err := readDecimal() - if err != nil { - return nil, err - } - - sp = append(sp, sparseEntry{offset: offset, numBytes: numBytes}) - } - - return sp, nil -} - -// readGNUSparseMap0x1 reads the sparse map as stored in GNU's PAX sparse format version 0.1. -// The sparse map is stored in the PAX headers. -func readGNUSparseMap0x1(headers map[string]string) ([]sparseEntry, error) { - // Get number of entries - numEntriesStr, ok := headers[paxGNUSparseNumBlocks] - if !ok { - return nil, ErrHeader - } - numEntries, err := strconv.ParseInt(numEntriesStr, 10, 0) - if err != nil { - return nil, ErrHeader - } - - sparseMap := strings.Split(headers[paxGNUSparseMap], ",") - - // There should be two numbers in sparseMap for each entry - if int64(len(sparseMap)) != 2*numEntries { - return nil, ErrHeader - } - - // Loop through the entries in the sparse map - sp := make([]sparseEntry, 0, numEntries) - for i := int64(0); i < numEntries; i++ { - offset, err := strconv.ParseInt(sparseMap[2*i], 10, 0) - if err != nil { - return nil, ErrHeader - } - numBytes, err := strconv.ParseInt(sparseMap[2*i+1], 10, 0) - if err != nil { - return nil, ErrHeader - } - sp = append(sp, sparseEntry{offset: offset, numBytes: numBytes}) - } - - return sp, nil -} - -// numBytes returns the number of bytes left to read in the current file's entry -// in the tar archive, or 0 if there is no current file. -func (tr *Reader) numBytes() int64 { - if tr.curr == nil { - // No current file, so no bytes - return 0 - } - return tr.curr.numBytes() -} - -// Read reads from the current entry in the tar archive. -// It returns 0, io.EOF when it reaches the end of that entry, -// until Next is called to advance to the next entry. -func (tr *Reader) Read(b []byte) (n int, err error) { - if tr.curr == nil { - return 0, io.EOF - } - n, err = tr.curr.Read(b) - if err != nil && err != io.EOF { - tr.err = err - } - return -} - -func (rfr *regFileReader) Read(b []byte) (n int, err error) { - if rfr.nb == 0 { - // file consumed - return 0, io.EOF - } - if int64(len(b)) > rfr.nb { - b = b[0:rfr.nb] - } - n, err = rfr.r.Read(b) - rfr.nb -= int64(n) - - if err == io.EOF && rfr.nb > 0 { - err = io.ErrUnexpectedEOF - } - return -} - -// numBytes returns the number of bytes left to read in the file's data in the tar archive. -func (rfr *regFileReader) numBytes() int64 { - return rfr.nb -} - -// readHole reads a sparse file hole ending at offset toOffset -func (sfr *sparseFileReader) readHole(b []byte, toOffset int64) int { - n64 := toOffset - sfr.pos - if n64 > int64(len(b)) { - n64 = int64(len(b)) - } - n := int(n64) - for i := 0; i < n; i++ { - b[i] = 0 - } - sfr.pos += n64 - return n -} - -// Read reads the sparse file data in expanded form. -func (sfr *sparseFileReader) Read(b []byte) (n int, err error) { - if len(sfr.sp) == 0 { - // No more data fragments to read from. - if sfr.pos < sfr.tot { - // We're in the last hole - n = sfr.readHole(b, sfr.tot) - return - } - // Otherwise, we're at the end of the file - return 0, io.EOF - } - if sfr.tot < sfr.sp[0].offset { - return 0, io.ErrUnexpectedEOF - } - if sfr.pos < sfr.sp[0].offset { - // We're in a hole - n = sfr.readHole(b, sfr.sp[0].offset) - return - } - - // We're not in a hole, so we'll read from the next data fragment - posInFragment := sfr.pos - sfr.sp[0].offset - bytesLeft := sfr.sp[0].numBytes - posInFragment - if int64(len(b)) > bytesLeft { - b = b[0:bytesLeft] - } - - n, err = sfr.rfr.Read(b) - sfr.pos += int64(n) - - if int64(n) == bytesLeft { - // We're done with this fragment - sfr.sp = sfr.sp[1:] - } - - if err == io.EOF && sfr.pos < sfr.tot { - // We reached the end of the last fragment's data, but there's a final hole - err = nil - } - return -} - -// numBytes returns the number of bytes left to read in the sparse file's -// sparse-encoded data in the tar archive. -func (sfr *sparseFileReader) numBytes() int64 { - return sfr.rfr.nb -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/reader_test.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/reader_test.go deleted file mode 100644 index da01f265911806985c60c2be78a5fa67301fe875..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/reader_test.go +++ /dev/null @@ -1,798 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tar - -import ( - "bytes" - "crypto/md5" - "fmt" - "io" - "io/ioutil" - "os" - "reflect" - "strings" - "testing" - "time" -) - -type untarTest struct { - file string - headers []*Header - cksums []string -} - -var gnuTarTest = &untarTest{ - file: "testdata/gnu.tar", - headers: []*Header{ - { - Name: "small.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 5, - ModTime: time.Unix(1244428340, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - }, - { - Name: "small2.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 11, - ModTime: time.Unix(1244436044, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - }, - }, - cksums: []string{ - "e38b27eaccb4391bdec553a7f3ae6b2f", - "c65bd2e50a56a2138bf1716f2fd56fe9", - }, -} - -var sparseTarTest = &untarTest{ - file: "testdata/sparse-formats.tar", - headers: []*Header{ - { - Name: "sparse-gnu", - Mode: 420, - Uid: 1000, - Gid: 1000, - Size: 200, - ModTime: time.Unix(1392395740, 0), - Typeflag: 0x53, - Linkname: "", - Uname: "david", - Gname: "david", - Devmajor: 0, - Devminor: 0, - }, - { - Name: "sparse-posix-0.0", - Mode: 420, - Uid: 1000, - Gid: 1000, - Size: 200, - ModTime: time.Unix(1392342187, 0), - Typeflag: 0x30, - Linkname: "", - Uname: "david", - Gname: "david", - Devmajor: 0, - Devminor: 0, - }, - { - Name: "sparse-posix-0.1", - Mode: 420, - Uid: 1000, - Gid: 1000, - Size: 200, - ModTime: time.Unix(1392340456, 0), - Typeflag: 0x30, - Linkname: "", - Uname: "david", - Gname: "david", - Devmajor: 0, - Devminor: 0, - }, - { - Name: "sparse-posix-1.0", - Mode: 420, - Uid: 1000, - Gid: 1000, - Size: 200, - ModTime: time.Unix(1392337404, 0), - Typeflag: 0x30, - Linkname: "", - Uname: "david", - Gname: "david", - Devmajor: 0, - Devminor: 0, - }, - { - Name: "end", - Mode: 420, - Uid: 1000, - Gid: 1000, - Size: 4, - ModTime: time.Unix(1392398319, 0), - Typeflag: 0x30, - Linkname: "", - Uname: "david", - Gname: "david", - Devmajor: 0, - Devminor: 0, - }, - }, - cksums: []string{ - "6f53234398c2449fe67c1812d993012f", - "6f53234398c2449fe67c1812d993012f", - "6f53234398c2449fe67c1812d993012f", - "6f53234398c2449fe67c1812d993012f", - "b0061974914468de549a2af8ced10316", - }, -} - -var untarTests = []*untarTest{ - gnuTarTest, - sparseTarTest, - { - file: "testdata/star.tar", - headers: []*Header{ - { - Name: "small.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 5, - ModTime: time.Unix(1244592783, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - AccessTime: time.Unix(1244592783, 0), - ChangeTime: time.Unix(1244592783, 0), - }, - { - Name: "small2.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 11, - ModTime: time.Unix(1244592783, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - AccessTime: time.Unix(1244592783, 0), - ChangeTime: time.Unix(1244592783, 0), - }, - }, - }, - { - file: "testdata/v7.tar", - headers: []*Header{ - { - Name: "small.txt", - Mode: 0444, - Uid: 73025, - Gid: 5000, - Size: 5, - ModTime: time.Unix(1244593104, 0), - Typeflag: '\x00', - }, - { - Name: "small2.txt", - Mode: 0444, - Uid: 73025, - Gid: 5000, - Size: 11, - ModTime: time.Unix(1244593104, 0), - Typeflag: '\x00', - }, - }, - }, - { - file: "testdata/pax.tar", - headers: []*Header{ - { - Name: "a/123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100", - Mode: 0664, - Uid: 1000, - Gid: 1000, - Uname: "shane", - Gname: "shane", - Size: 7, - ModTime: time.Unix(1350244992, 23960108), - ChangeTime: time.Unix(1350244992, 23960108), - AccessTime: time.Unix(1350244992, 23960108), - Typeflag: TypeReg, - }, - { - Name: "a/b", - Mode: 0777, - Uid: 1000, - Gid: 1000, - Uname: "shane", - Gname: "shane", - Size: 0, - ModTime: time.Unix(1350266320, 910238425), - ChangeTime: time.Unix(1350266320, 910238425), - AccessTime: time.Unix(1350266320, 910238425), - Typeflag: TypeSymlink, - Linkname: "123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100", - }, - }, - }, - { - file: "testdata/nil-uid.tar", // golang.org/issue/5290 - headers: []*Header{ - { - Name: "P1050238.JPG.log", - Mode: 0664, - Uid: 0, - Gid: 0, - Size: 14, - ModTime: time.Unix(1365454838, 0), - Typeflag: TypeReg, - Linkname: "", - Uname: "eyefi", - Gname: "eyefi", - Devmajor: 0, - Devminor: 0, - }, - }, - }, - { - file: "testdata/xattrs.tar", - headers: []*Header{ - { - Name: "small.txt", - Mode: 0644, - Uid: 1000, - Gid: 10, - Size: 5, - ModTime: time.Unix(1386065770, 448252320), - Typeflag: '0', - Uname: "alex", - Gname: "wheel", - AccessTime: time.Unix(1389782991, 419875220), - ChangeTime: time.Unix(1389782956, 794414986), - Xattrs: map[string]string{ - "user.key": "value", - "user.key2": "value2", - // Interestingly, selinux encodes the terminating null inside the xattr - "security.selinux": "unconfined_u:object_r:default_t:s0\x00", - }, - }, - { - Name: "small2.txt", - Mode: 0644, - Uid: 1000, - Gid: 10, - Size: 11, - ModTime: time.Unix(1386065770, 449252304), - Typeflag: '0', - Uname: "alex", - Gname: "wheel", - AccessTime: time.Unix(1389782991, 419875220), - ChangeTime: time.Unix(1386065770, 449252304), - Xattrs: map[string]string{ - "security.selinux": "unconfined_u:object_r:default_t:s0\x00", - }, - }, - }, - }, -} - -func TestReader(t *testing.T) { -testLoop: - for i, test := range untarTests { - f, err := os.Open(test.file) - if err != nil { - t.Errorf("test %d: Unexpected error: %v", i, err) - continue - } - defer f.Close() - tr := NewReader(f) - for j, header := range test.headers { - hdr, err := tr.Next() - if err != nil || hdr == nil { - t.Errorf("test %d, entry %d: Didn't get entry: %v", i, j, err) - f.Close() - continue testLoop - } - if !reflect.DeepEqual(*hdr, *header) { - t.Errorf("test %d, entry %d: Incorrect header:\nhave %+v\nwant %+v", - i, j, *hdr, *header) - } - } - hdr, err := tr.Next() - if err == io.EOF { - continue testLoop - } - if hdr != nil || err != nil { - t.Errorf("test %d: Unexpected entry or error: hdr=%v err=%v", i, hdr, err) - } - } -} - -func TestPartialRead(t *testing.T) { - f, err := os.Open("testdata/gnu.tar") - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer f.Close() - - tr := NewReader(f) - - // Read the first four bytes; Next() should skip the last byte. - hdr, err := tr.Next() - if err != nil || hdr == nil { - t.Fatalf("Didn't get first file: %v", err) - } - buf := make([]byte, 4) - if _, err := io.ReadFull(tr, buf); err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if expected := []byte("Kilt"); !bytes.Equal(buf, expected) { - t.Errorf("Contents = %v, want %v", buf, expected) - } - - // Second file - hdr, err = tr.Next() - if err != nil || hdr == nil { - t.Fatalf("Didn't get second file: %v", err) - } - buf = make([]byte, 6) - if _, err := io.ReadFull(tr, buf); err != nil { - t.Fatalf("Unexpected error: %v", err) - } - if expected := []byte("Google"); !bytes.Equal(buf, expected) { - t.Errorf("Contents = %v, want %v", buf, expected) - } -} - -func TestIncrementalRead(t *testing.T) { - test := gnuTarTest - f, err := os.Open(test.file) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer f.Close() - - tr := NewReader(f) - - headers := test.headers - cksums := test.cksums - nread := 0 - - // loop over all files - for ; ; nread++ { - hdr, err := tr.Next() - if hdr == nil || err == io.EOF { - break - } - - // check the header - if !reflect.DeepEqual(*hdr, *headers[nread]) { - t.Errorf("Incorrect header:\nhave %+v\nwant %+v", - *hdr, headers[nread]) - } - - // read file contents in little chunks EOF, - // checksumming all the way - h := md5.New() - rdbuf := make([]uint8, 8) - for { - nr, err := tr.Read(rdbuf) - if err == io.EOF { - break - } - if err != nil { - t.Errorf("Read: unexpected error %v\n", err) - break - } - h.Write(rdbuf[0:nr]) - } - // verify checksum - have := fmt.Sprintf("%x", h.Sum(nil)) - want := cksums[nread] - if want != have { - t.Errorf("Bad checksum on file %s:\nhave %+v\nwant %+v", hdr.Name, have, want) - } - } - if nread != len(headers) { - t.Errorf("Didn't process all files\nexpected: %d\nprocessed %d\n", len(headers), nread) - } -} - -func TestNonSeekable(t *testing.T) { - test := gnuTarTest - f, err := os.Open(test.file) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer f.Close() - - type readerOnly struct { - io.Reader - } - tr := NewReader(readerOnly{f}) - nread := 0 - - for ; ; nread++ { - _, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - } - - if nread != len(test.headers) { - t.Errorf("Didn't process all files\nexpected: %d\nprocessed %d\n", len(test.headers), nread) - } -} - -func TestParsePAXHeader(t *testing.T) { - paxTests := [][3]string{ - {"a", "a=name", "10 a=name\n"}, // Test case involving multiple acceptable lengths - {"a", "a=name", "9 a=name\n"}, // Test case involving multiple acceptable length - {"mtime", "mtime=1350244992.023960108", "30 mtime=1350244992.023960108\n"}} - for _, test := range paxTests { - key, expected, raw := test[0], test[1], test[2] - reader := bytes.NewReader([]byte(raw)) - headers, err := parsePAX(reader) - if err != nil { - t.Errorf("Couldn't parse correctly formatted headers: %v", err) - continue - } - if strings.EqualFold(headers[key], expected) { - t.Errorf("mtime header incorrectly parsed: got %s, wanted %s", headers[key], expected) - continue - } - trailer := make([]byte, 100) - n, err := reader.Read(trailer) - if err != io.EOF || n != 0 { - t.Error("Buffer wasn't consumed") - } - } - badHeaderTests := [][]byte{ - []byte("3 somelongkey=\n"), - []byte("50 tooshort=\n"), - } - for _, test := range badHeaderTests { - if _, err := parsePAX(bytes.NewReader(test)); err != ErrHeader { - t.Fatal("Unexpected success when parsing bad header") - } - } -} - -func TestParsePAXTime(t *testing.T) { - // Some valid PAX time values - timestamps := map[string]time.Time{ - "1350244992.023960108": time.Unix(1350244992, 23960108), // The common case - "1350244992.02396010": time.Unix(1350244992, 23960100), // Lower precision value - "1350244992.0239601089": time.Unix(1350244992, 23960108), // Higher precision value - "1350244992": time.Unix(1350244992, 0), // Low precision value - } - for input, expected := range timestamps { - ts, err := parsePAXTime(input) - if err != nil { - t.Fatal(err) - } - if !ts.Equal(expected) { - t.Fatalf("Time parsing failure %s %s", ts, expected) - } - } -} - -func TestMergePAX(t *testing.T) { - hdr := new(Header) - // Test a string, integer, and time based value. - headers := map[string]string{ - "path": "a/b/c", - "uid": "1000", - "mtime": "1350244992.023960108", - } - err := mergePAX(hdr, headers) - if err != nil { - t.Fatal(err) - } - want := &Header{ - Name: "a/b/c", - Uid: 1000, - ModTime: time.Unix(1350244992, 23960108), - } - if !reflect.DeepEqual(hdr, want) { - t.Errorf("incorrect merge: got %+v, want %+v", hdr, want) - } -} - -func TestSparseEndToEnd(t *testing.T) { - test := sparseTarTest - f, err := os.Open(test.file) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer f.Close() - - tr := NewReader(f) - - headers := test.headers - cksums := test.cksums - nread := 0 - - // loop over all files - for ; ; nread++ { - hdr, err := tr.Next() - if hdr == nil || err == io.EOF { - break - } - - // check the header - if !reflect.DeepEqual(*hdr, *headers[nread]) { - t.Errorf("Incorrect header:\nhave %+v\nwant %+v", - *hdr, headers[nread]) - } - - // read and checksum the file data - h := md5.New() - _, err = io.Copy(h, tr) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - - // verify checksum - have := fmt.Sprintf("%x", h.Sum(nil)) - want := cksums[nread] - if want != have { - t.Errorf("Bad checksum on file %s:\nhave %+v\nwant %+v", hdr.Name, have, want) - } - } - if nread != len(headers) { - t.Errorf("Didn't process all files\nexpected: %d\nprocessed %d\n", len(headers), nread) - } -} - -type sparseFileReadTest struct { - sparseData []byte - sparseMap []sparseEntry - realSize int64 - expected []byte -} - -var sparseFileReadTests = []sparseFileReadTest{ - { - sparseData: []byte("abcde"), - sparseMap: []sparseEntry{ - {offset: 0, numBytes: 2}, - {offset: 5, numBytes: 3}, - }, - realSize: 8, - expected: []byte("ab\x00\x00\x00cde"), - }, - { - sparseData: []byte("abcde"), - sparseMap: []sparseEntry{ - {offset: 0, numBytes: 2}, - {offset: 5, numBytes: 3}, - }, - realSize: 10, - expected: []byte("ab\x00\x00\x00cde\x00\x00"), - }, - { - sparseData: []byte("abcde"), - sparseMap: []sparseEntry{ - {offset: 1, numBytes: 3}, - {offset: 6, numBytes: 2}, - }, - realSize: 8, - expected: []byte("\x00abc\x00\x00de"), - }, - { - sparseData: []byte("abcde"), - sparseMap: []sparseEntry{ - {offset: 1, numBytes: 3}, - {offset: 6, numBytes: 2}, - }, - realSize: 10, - expected: []byte("\x00abc\x00\x00de\x00\x00"), - }, - { - sparseData: []byte(""), - sparseMap: nil, - realSize: 2, - expected: []byte("\x00\x00"), - }, -} - -func TestSparseFileReader(t *testing.T) { - for i, test := range sparseFileReadTests { - r := bytes.NewReader(test.sparseData) - nb := int64(r.Len()) - sfr := &sparseFileReader{ - rfr: ®FileReader{r: r, nb: nb}, - sp: test.sparseMap, - pos: 0, - tot: test.realSize, - } - if sfr.numBytes() != nb { - t.Errorf("test %d: Before reading, sfr.numBytes() = %d, want %d", i, sfr.numBytes(), nb) - } - buf, err := ioutil.ReadAll(sfr) - if err != nil { - t.Errorf("test %d: Unexpected error: %v", i, err) - } - if e := test.expected; !bytes.Equal(buf, e) { - t.Errorf("test %d: Contents = %v, want %v", i, buf, e) - } - if sfr.numBytes() != 0 { - t.Errorf("test %d: After draining the reader, numBytes() was nonzero", i) - } - } -} - -func TestSparseIncrementalRead(t *testing.T) { - sparseMap := []sparseEntry{{10, 2}} - sparseData := []byte("Go") - expected := "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00Go\x00\x00\x00\x00\x00\x00\x00\x00" - - r := bytes.NewReader(sparseData) - nb := int64(r.Len()) - sfr := &sparseFileReader{ - rfr: ®FileReader{r: r, nb: nb}, - sp: sparseMap, - pos: 0, - tot: int64(len(expected)), - } - - // We'll read the data 6 bytes at a time, with a hole of size 10 at - // the beginning and one of size 8 at the end. - var outputBuf bytes.Buffer - buf := make([]byte, 6) - for { - n, err := sfr.Read(buf) - if err == io.EOF { - break - } - if err != nil { - t.Errorf("Read: unexpected error %v\n", err) - } - if n > 0 { - _, err := outputBuf.Write(buf[:n]) - if err != nil { - t.Errorf("Write: unexpected error %v\n", err) - } - } - } - got := outputBuf.String() - if got != expected { - t.Errorf("Contents = %v, want %v", got, expected) - } -} - -func TestReadGNUSparseMap0x1(t *testing.T) { - headers := map[string]string{ - paxGNUSparseNumBlocks: "4", - paxGNUSparseMap: "0,5,10,5,20,5,30,5", - } - expected := []sparseEntry{ - {offset: 0, numBytes: 5}, - {offset: 10, numBytes: 5}, - {offset: 20, numBytes: 5}, - {offset: 30, numBytes: 5}, - } - - sp, err := readGNUSparseMap0x1(headers) - if err != nil { - t.Errorf("Unexpected error: %v", err) - } - if !reflect.DeepEqual(sp, expected) { - t.Errorf("Incorrect sparse map: got %v, wanted %v", sp, expected) - } -} - -func TestReadGNUSparseMap1x0(t *testing.T) { - // This test uses lots of holes so the sparse header takes up more than two blocks - numEntries := 100 - expected := make([]sparseEntry, 0, numEntries) - sparseMap := new(bytes.Buffer) - - fmt.Fprintf(sparseMap, "%d\n", numEntries) - for i := 0; i < numEntries; i++ { - offset := int64(2048 * i) - numBytes := int64(1024) - expected = append(expected, sparseEntry{offset: offset, numBytes: numBytes}) - fmt.Fprintf(sparseMap, "%d\n%d\n", offset, numBytes) - } - - // Make the header the smallest multiple of blockSize that fits the sparseMap - headerBlocks := (sparseMap.Len() + blockSize - 1) / blockSize - bufLen := blockSize * headerBlocks - buf := make([]byte, bufLen) - copy(buf, sparseMap.Bytes()) - - // Get an reader to read the sparse map - r := bytes.NewReader(buf) - - // Read the sparse map - sp, err := readGNUSparseMap1x0(r) - if err != nil { - t.Errorf("Unexpected error: %v", err) - } - if !reflect.DeepEqual(sp, expected) { - t.Errorf("Incorrect sparse map: got %v, wanted %v", sp, expected) - } -} - -func TestUninitializedRead(t *testing.T) { - test := gnuTarTest - f, err := os.Open(test.file) - if err != nil { - t.Fatalf("Unexpected error: %v", err) - } - defer f.Close() - - tr := NewReader(f) - _, err = tr.Read([]byte{}) - if err == nil || err != io.EOF { - t.Errorf("Unexpected error: %v, wanted %v", err, io.EOF) - } - -} - -// Negative header size should not cause panic. -// Issues 10959 and 10960. -func TestNegativeHdrSize(t *testing.T) { - f, err := os.Open("testdata/neg-size.tar") - if err != nil { - t.Fatal(err) - } - defer f.Close() - r := NewReader(f) - _, err = r.Next() - if err != ErrHeader { - t.Error("want ErrHeader, got", err) - } - io.Copy(ioutil.Discard, r) -} - -// This used to hang in (*sparseFileReader).readHole due to missing -// verification of sparse offsets against file size. -func TestIssue10968(t *testing.T) { - f, err := os.Open("testdata/issue10968.tar") - if err != nil { - t.Fatal(err) - } - defer f.Close() - r := NewReader(f) - _, err = r.Next() - if err != nil { - t.Fatal(err) - } - _, err = io.Copy(ioutil.Discard, r) - if err != io.ErrUnexpectedEOF { - t.Fatalf("expected %q, got %q", io.ErrUnexpectedEOF, err) - } -} - -// Do not panic if there are errors in header blocks after the pax header. -// Issue 11169 -func TestIssue11169(t *testing.T) { - f, err := os.Open("testdata/issue11169.tar") - if err != nil { - t.Fatal(err) - } - defer f.Close() - r := NewReader(f) - _, err = r.Next() - if err == nil { - t.Fatal("Unexpected success") - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atim.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atim.go deleted file mode 100644 index cf9cc79c5915bace0af0e81fa4df961f3a68553c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atim.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux dragonfly openbsd solaris - -package tar - -import ( - "syscall" - "time" -) - -func statAtime(st *syscall.Stat_t) time.Time { - return time.Unix(st.Atim.Unix()) -} - -func statCtime(st *syscall.Stat_t) time.Time { - return time.Unix(st.Ctim.Unix()) -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atimespec.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atimespec.go deleted file mode 100644 index 6f17dbe30725c120218885cc662587b8c7dcb4d2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_atimespec.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin freebsd netbsd - -package tar - -import ( - "syscall" - "time" -) - -func statAtime(st *syscall.Stat_t) time.Time { - return time.Unix(st.Atimespec.Unix()) -} - -func statCtime(st *syscall.Stat_t) time.Time { - return time.Unix(st.Ctimespec.Unix()) -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_unix.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_unix.go deleted file mode 100644 index cb843db4cfd65815830128cc0aa285dee36f7123..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/stat_unix.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin dragonfly freebsd openbsd netbsd solaris - -package tar - -import ( - "os" - "syscall" -) - -func init() { - sysStat = statUnix -} - -func statUnix(fi os.FileInfo, h *Header) error { - sys, ok := fi.Sys().(*syscall.Stat_t) - if !ok { - return nil - } - h.Uid = int(sys.Uid) - h.Gid = int(sys.Gid) - // TODO(bradfitz): populate username & group. os/user - // doesn't cache LookupId lookups, and lacks group - // lookup functions. - h.AccessTime = statAtime(sys) - h.ChangeTime = statCtime(sys) - // TODO(bradfitz): major/minor device numbers? - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/tar_test.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/tar_test.go deleted file mode 100644 index d63c072eb9aaa489c5ec76552db060fa50f2a3ef..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/tar_test.go +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tar - -import ( - "bytes" - "io/ioutil" - "os" - "path" - "reflect" - "strings" - "testing" - "time" -) - -func TestFileInfoHeader(t *testing.T) { - fi, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - h, err := FileInfoHeader(fi, "") - if err != nil { - t.Fatalf("FileInfoHeader: %v", err) - } - if g, e := h.Name, "small.txt"; g != e { - t.Errorf("Name = %q; want %q", g, e) - } - if g, e := h.Mode, int64(fi.Mode().Perm())|c_ISREG; g != e { - t.Errorf("Mode = %#o; want %#o", g, e) - } - if g, e := h.Size, int64(5); g != e { - t.Errorf("Size = %v; want %v", g, e) - } - if g, e := h.ModTime, fi.ModTime(); !g.Equal(e) { - t.Errorf("ModTime = %v; want %v", g, e) - } - // FileInfoHeader should error when passing nil FileInfo - if _, err := FileInfoHeader(nil, ""); err == nil { - t.Fatalf("Expected error when passing nil to FileInfoHeader") - } -} - -func TestFileInfoHeaderDir(t *testing.T) { - fi, err := os.Stat("testdata") - if err != nil { - t.Fatal(err) - } - h, err := FileInfoHeader(fi, "") - if err != nil { - t.Fatalf("FileInfoHeader: %v", err) - } - if g, e := h.Name, "testdata/"; g != e { - t.Errorf("Name = %q; want %q", g, e) - } - // Ignoring c_ISGID for golang.org/issue/4867 - if g, e := h.Mode&^c_ISGID, int64(fi.Mode().Perm())|c_ISDIR; g != e { - t.Errorf("Mode = %#o; want %#o", g, e) - } - if g, e := h.Size, int64(0); g != e { - t.Errorf("Size = %v; want %v", g, e) - } - if g, e := h.ModTime, fi.ModTime(); !g.Equal(e) { - t.Errorf("ModTime = %v; want %v", g, e) - } -} - -func TestFileInfoHeaderSymlink(t *testing.T) { - h, err := FileInfoHeader(symlink{}, "some-target") - if err != nil { - t.Fatal(err) - } - if g, e := h.Name, "some-symlink"; g != e { - t.Errorf("Name = %q; want %q", g, e) - } - if g, e := h.Linkname, "some-target"; g != e { - t.Errorf("Linkname = %q; want %q", g, e) - } -} - -type symlink struct{} - -func (symlink) Name() string { return "some-symlink" } -func (symlink) Size() int64 { return 0 } -func (symlink) Mode() os.FileMode { return os.ModeSymlink } -func (symlink) ModTime() time.Time { return time.Time{} } -func (symlink) IsDir() bool { return false } -func (symlink) Sys() interface{} { return nil } - -func TestRoundTrip(t *testing.T) { - data := []byte("some file contents") - - var b bytes.Buffer - tw := NewWriter(&b) - hdr := &Header{ - Name: "file.txt", - Uid: 1 << 21, // too big for 8 octal digits - Size: int64(len(data)), - ModTime: time.Now(), - } - // tar only supports second precision. - hdr.ModTime = hdr.ModTime.Add(-time.Duration(hdr.ModTime.Nanosecond()) * time.Nanosecond) - if err := tw.WriteHeader(hdr); err != nil { - t.Fatalf("tw.WriteHeader: %v", err) - } - if _, err := tw.Write(data); err != nil { - t.Fatalf("tw.Write: %v", err) - } - if err := tw.Close(); err != nil { - t.Fatalf("tw.Close: %v", err) - } - - // Read it back. - tr := NewReader(&b) - rHdr, err := tr.Next() - if err != nil { - t.Fatalf("tr.Next: %v", err) - } - if !reflect.DeepEqual(rHdr, hdr) { - t.Errorf("Header mismatch.\n got %+v\nwant %+v", rHdr, hdr) - } - rData, err := ioutil.ReadAll(tr) - if err != nil { - t.Fatalf("Read: %v", err) - } - if !bytes.Equal(rData, data) { - t.Errorf("Data mismatch.\n got %q\nwant %q", rData, data) - } -} - -type headerRoundTripTest struct { - h *Header - fm os.FileMode -} - -func TestHeaderRoundTrip(t *testing.T) { - golden := []headerRoundTripTest{ - // regular file. - { - h: &Header{ - Name: "test.txt", - Mode: 0644 | c_ISREG, - Size: 12, - ModTime: time.Unix(1360600916, 0), - Typeflag: TypeReg, - }, - fm: 0644, - }, - // symbolic link. - { - h: &Header{ - Name: "link.txt", - Mode: 0777 | c_ISLNK, - Size: 0, - ModTime: time.Unix(1360600852, 0), - Typeflag: TypeSymlink, - }, - fm: 0777 | os.ModeSymlink, - }, - // character device node. - { - h: &Header{ - Name: "dev/null", - Mode: 0666 | c_ISCHR, - Size: 0, - ModTime: time.Unix(1360578951, 0), - Typeflag: TypeChar, - }, - fm: 0666 | os.ModeDevice | os.ModeCharDevice, - }, - // block device node. - { - h: &Header{ - Name: "dev/sda", - Mode: 0660 | c_ISBLK, - Size: 0, - ModTime: time.Unix(1360578954, 0), - Typeflag: TypeBlock, - }, - fm: 0660 | os.ModeDevice, - }, - // directory. - { - h: &Header{ - Name: "dir/", - Mode: 0755 | c_ISDIR, - Size: 0, - ModTime: time.Unix(1360601116, 0), - Typeflag: TypeDir, - }, - fm: 0755 | os.ModeDir, - }, - // fifo node. - { - h: &Header{ - Name: "dev/initctl", - Mode: 0600 | c_ISFIFO, - Size: 0, - ModTime: time.Unix(1360578949, 0), - Typeflag: TypeFifo, - }, - fm: 0600 | os.ModeNamedPipe, - }, - // setuid. - { - h: &Header{ - Name: "bin/su", - Mode: 0755 | c_ISREG | c_ISUID, - Size: 23232, - ModTime: time.Unix(1355405093, 0), - Typeflag: TypeReg, - }, - fm: 0755 | os.ModeSetuid, - }, - // setguid. - { - h: &Header{ - Name: "group.txt", - Mode: 0750 | c_ISREG | c_ISGID, - Size: 0, - ModTime: time.Unix(1360602346, 0), - Typeflag: TypeReg, - }, - fm: 0750 | os.ModeSetgid, - }, - // sticky. - { - h: &Header{ - Name: "sticky.txt", - Mode: 0600 | c_ISREG | c_ISVTX, - Size: 7, - ModTime: time.Unix(1360602540, 0), - Typeflag: TypeReg, - }, - fm: 0600 | os.ModeSticky, - }, - // hard link. - { - h: &Header{ - Name: "hard.txt", - Mode: 0644 | c_ISREG, - Size: 0, - Linkname: "file.txt", - ModTime: time.Unix(1360600916, 0), - Typeflag: TypeLink, - }, - fm: 0644, - }, - // More information. - { - h: &Header{ - Name: "info.txt", - Mode: 0600 | c_ISREG, - Size: 0, - Uid: 1000, - Gid: 1000, - ModTime: time.Unix(1360602540, 0), - Uname: "slartibartfast", - Gname: "users", - Typeflag: TypeReg, - }, - fm: 0600, - }, - } - - for i, g := range golden { - fi := g.h.FileInfo() - h2, err := FileInfoHeader(fi, "") - if err != nil { - t.Error(err) - continue - } - if strings.Contains(fi.Name(), "/") { - t.Errorf("FileInfo of %q contains slash: %q", g.h.Name, fi.Name()) - } - name := path.Base(g.h.Name) - if fi.IsDir() { - name += "/" - } - if got, want := h2.Name, name; got != want { - t.Errorf("i=%d: Name: got %v, want %v", i, got, want) - } - if got, want := h2.Size, g.h.Size; got != want { - t.Errorf("i=%d: Size: got %v, want %v", i, got, want) - } - if got, want := h2.Uid, g.h.Uid; got != want { - t.Errorf("i=%d: Uid: got %d, want %d", i, got, want) - } - if got, want := h2.Gid, g.h.Gid; got != want { - t.Errorf("i=%d: Gid: got %d, want %d", i, got, want) - } - if got, want := h2.Uname, g.h.Uname; got != want { - t.Errorf("i=%d: Uname: got %q, want %q", i, got, want) - } - if got, want := h2.Gname, g.h.Gname; got != want { - t.Errorf("i=%d: Gname: got %q, want %q", i, got, want) - } - if got, want := h2.Linkname, g.h.Linkname; got != want { - t.Errorf("i=%d: Linkname: got %v, want %v", i, got, want) - } - if got, want := h2.Typeflag, g.h.Typeflag; got != want { - t.Logf("%#v %#v", g.h, fi.Sys()) - t.Errorf("i=%d: Typeflag: got %q, want %q", i, got, want) - } - if got, want := h2.Mode, g.h.Mode; got != want { - t.Errorf("i=%d: Mode: got %o, want %o", i, got, want) - } - if got, want := fi.Mode(), g.fm; got != want { - t.Errorf("i=%d: fi.Mode: got %o, want %o", i, got, want) - } - if got, want := h2.AccessTime, g.h.AccessTime; got != want { - t.Errorf("i=%d: AccessTime: got %v, want %v", i, got, want) - } - if got, want := h2.ChangeTime, g.h.ChangeTime; got != want { - t.Errorf("i=%d: ChangeTime: got %v, want %v", i, got, want) - } - if got, want := h2.ModTime, g.h.ModTime; got != want { - t.Errorf("i=%d: ModTime: got %v, want %v", i, got, want) - } - if sysh, ok := fi.Sys().(*Header); !ok || sysh != g.h { - t.Errorf("i=%d: Sys didn't return original *Header", i) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/gnu.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/gnu.tar deleted file mode 100644 index fc899dc8dc2ad9952f5c5f67a0c76ca2d87249e9..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/gnu.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/hardlink.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/hardlink.tar deleted file mode 100644 index 9cd1a26572e44150ded8a628fefb28fa089645d1..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/hardlink.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue10968.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue10968.tar deleted file mode 100644 index 1cc837bcff14cd822a26e43034955c82e852ab29..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue10968.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue11169.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue11169.tar deleted file mode 100644 index 4d71fa15260609ecee0c8c751cfebf49be8763ac..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/issue11169.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/neg-size.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/neg-size.tar deleted file mode 100644 index 5deea3d05c4da5a4ddda34ef7ad781088464e71b..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/neg-size.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/nil-uid.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/nil-uid.tar deleted file mode 100644 index cc9cfaa33cc5de0a28b4183c1705d801f788c96a..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/nil-uid.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/pax.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/pax.tar deleted file mode 100644 index 9bc24b6587d726c7fca4e533d9c61a3801a34688..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/pax.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small.txt b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small.txt deleted file mode 100644 index b249bfc518a8c96f83747c9fde1ad3529fa3672d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small.txt +++ /dev/null @@ -1 +0,0 @@ -Kilts \ No newline at end of file diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small2.txt b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small2.txt deleted file mode 100644 index 394ee3ecd0edf3e17799ced62c774d17c1e57d31..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/small2.txt +++ /dev/null @@ -1 +0,0 @@ -Google.com diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/sparse-formats.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/sparse-formats.tar deleted file mode 100644 index 8bd4e74d50f9c8961f80a887ab7d6449e032048b..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/sparse-formats.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/star.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/star.tar deleted file mode 100644 index 59e2d4e604611eeac3e2a0f3d6f71d2623c50449..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/star.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/ustar.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/ustar.tar deleted file mode 100644 index 29679d9a305fc0293f31212541335af824ab32c7..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/ustar.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/v7.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/v7.tar deleted file mode 100644 index eb65fc9410721efd98cb7c5e274f547ec530252d..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/v7.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big-long.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big-long.tar deleted file mode 100644 index 5960ee824784ffeacb976a9c648be41b0281508b..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big-long.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big.tar deleted file mode 100644 index 753e883cebf52ac1291f1b7bf1b7a37ae517b2d9..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer-big.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer.tar deleted file mode 100644 index e6d816ad0775d56d09242d6f5d1dbe56af310a32..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/writer.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/xattrs.tar b/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/xattrs.tar deleted file mode 100644 index 9701950edd1f0dc82858b7117136b37391be0b08..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/tar/testdata/xattrs.tar and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/writer.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/writer.go deleted file mode 100644 index 9dbc01a2ffbc4b223e0a28cfff3a40dc4817ca19..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/writer.go +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tar - -// TODO(dsymonds): -// - catch more errors (no first header, etc.) - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "path" - "strconv" - "strings" - "time" -) - -var ( - ErrWriteTooLong = errors.New("archive/tar: write too long") - ErrFieldTooLong = errors.New("archive/tar: header field too long") - ErrWriteAfterClose = errors.New("archive/tar: write after close") - errNameTooLong = errors.New("archive/tar: name too long") - errInvalidHeader = errors.New("archive/tar: header field too long or contains invalid values") -) - -// A Writer provides sequential writing of a tar archive in POSIX.1 format. -// A tar archive consists of a sequence of files. -// Call WriteHeader to begin a new file, and then call Write to supply that file's data, -// writing at most hdr.Size bytes in total. -type Writer struct { - w io.Writer - err error - nb int64 // number of unwritten bytes for current file entry - pad int64 // amount of padding to write after current file entry - closed bool - usedBinary bool // whether the binary numeric field extension was used - preferPax bool // use pax header instead of binary numeric header - hdrBuff [blockSize]byte // buffer to use in writeHeader when writing a regular header - paxHdrBuff [blockSize]byte // buffer to use in writeHeader when writing a pax header -} - -// NewWriter creates a new Writer writing to w. -func NewWriter(w io.Writer) *Writer { return &Writer{w: w} } - -// Flush finishes writing the current file (optional). -func (tw *Writer) Flush() error { - if tw.nb > 0 { - tw.err = fmt.Errorf("archive/tar: missed writing %d bytes", tw.nb) - return tw.err - } - - n := tw.nb + tw.pad - for n > 0 && tw.err == nil { - nr := n - if nr > blockSize { - nr = blockSize - } - var nw int - nw, tw.err = tw.w.Write(zeroBlock[0:nr]) - n -= int64(nw) - } - tw.nb = 0 - tw.pad = 0 - return tw.err -} - -// Write s into b, terminating it with a NUL if there is room. -// If the value is too long for the field and allowPax is true add a paxheader record instead -func (tw *Writer) cString(b []byte, s string, allowPax bool, paxKeyword string, paxHeaders map[string]string) { - needsPaxHeader := allowPax && len(s) > len(b) || !isASCII(s) - if needsPaxHeader { - paxHeaders[paxKeyword] = s - return - } - if len(s) > len(b) { - if tw.err == nil { - tw.err = ErrFieldTooLong - } - return - } - ascii := toASCII(s) - copy(b, ascii) - if len(ascii) < len(b) { - b[len(ascii)] = 0 - } -} - -// Encode x as an octal ASCII string and write it into b with leading zeros. -func (tw *Writer) octal(b []byte, x int64) { - s := strconv.FormatInt(x, 8) - // leading zeros, but leave room for a NUL. - for len(s)+1 < len(b) { - s = "0" + s - } - tw.cString(b, s, false, paxNone, nil) -} - -// Write x into b, either as octal or as binary (GNUtar/star extension). -// If the value is too long for the field and writingPax is enabled both for the field and the add a paxheader record instead -func (tw *Writer) numeric(b []byte, x int64, allowPax bool, paxKeyword string, paxHeaders map[string]string) { - // Try octal first. - s := strconv.FormatInt(x, 8) - if len(s) < len(b) { - tw.octal(b, x) - return - } - - // If it is too long for octal, and pax is preferred, use a pax header - if allowPax && tw.preferPax { - tw.octal(b, 0) - s := strconv.FormatInt(x, 10) - paxHeaders[paxKeyword] = s - return - } - - // Too big: use binary (big-endian). - tw.usedBinary = true - for i := len(b) - 1; x > 0 && i >= 0; i-- { - b[i] = byte(x) - x >>= 8 - } - b[0] |= 0x80 // highest bit indicates binary format -} - -var ( - minTime = time.Unix(0, 0) - // There is room for 11 octal digits (33 bits) of mtime. - maxTime = minTime.Add((1<<33 - 1) * time.Second) -) - -// WriteHeader writes hdr and prepares to accept the file's contents. -// WriteHeader calls Flush if it is not the first header. -// Calling after a Close will return ErrWriteAfterClose. -func (tw *Writer) WriteHeader(hdr *Header) error { - return tw.writeHeader(hdr, true) -} - -// WriteHeader writes hdr and prepares to accept the file's contents. -// WriteHeader calls Flush if it is not the first header. -// Calling after a Close will return ErrWriteAfterClose. -// As this method is called internally by writePax header to allow it to -// suppress writing the pax header. -func (tw *Writer) writeHeader(hdr *Header, allowPax bool) error { - if tw.closed { - return ErrWriteAfterClose - } - if tw.err == nil { - tw.Flush() - } - if tw.err != nil { - return tw.err - } - - // a map to hold pax header records, if any are needed - paxHeaders := make(map[string]string) - - // TODO(shanemhansen): we might want to use PAX headers for - // subsecond time resolution, but for now let's just capture - // too long fields or non ascii characters - - var header []byte - - // We need to select which scratch buffer to use carefully, - // since this method is called recursively to write PAX headers. - // If allowPax is true, this is the non-recursive call, and we will use hdrBuff. - // If allowPax is false, we are being called by writePAXHeader, and hdrBuff is - // already being used by the non-recursive call, so we must use paxHdrBuff. - header = tw.hdrBuff[:] - if !allowPax { - header = tw.paxHdrBuff[:] - } - copy(header, zeroBlock) - s := slicer(header) - - // keep a reference to the filename to allow to overwrite it later if we detect that we can use ustar longnames instead of pax - pathHeaderBytes := s.next(fileNameSize) - - tw.cString(pathHeaderBytes, hdr.Name, true, paxPath, paxHeaders) - - // Handle out of range ModTime carefully. - var modTime int64 - if !hdr.ModTime.Before(minTime) && !hdr.ModTime.After(maxTime) { - modTime = hdr.ModTime.Unix() - } - - tw.octal(s.next(8), hdr.Mode) // 100:108 - tw.numeric(s.next(8), int64(hdr.Uid), true, paxUid, paxHeaders) // 108:116 - tw.numeric(s.next(8), int64(hdr.Gid), true, paxGid, paxHeaders) // 116:124 - tw.numeric(s.next(12), hdr.Size, true, paxSize, paxHeaders) // 124:136 - tw.numeric(s.next(12), modTime, false, paxNone, nil) // 136:148 --- consider using pax for finer granularity - s.next(8) // chksum (148:156) - s.next(1)[0] = hdr.Typeflag // 156:157 - - tw.cString(s.next(100), hdr.Linkname, true, paxLinkpath, paxHeaders) - - copy(s.next(8), []byte("ustar\x0000")) // 257:265 - tw.cString(s.next(32), hdr.Uname, true, paxUname, paxHeaders) // 265:297 - tw.cString(s.next(32), hdr.Gname, true, paxGname, paxHeaders) // 297:329 - tw.numeric(s.next(8), hdr.Devmajor, false, paxNone, nil) // 329:337 - tw.numeric(s.next(8), hdr.Devminor, false, paxNone, nil) // 337:345 - - // keep a reference to the prefix to allow to overwrite it later if we detect that we can use ustar longnames instead of pax - prefixHeaderBytes := s.next(155) - tw.cString(prefixHeaderBytes, "", false, paxNone, nil) // 345:500 prefix - - // Use the GNU magic instead of POSIX magic if we used any GNU extensions. - if tw.usedBinary { - copy(header[257:265], []byte("ustar \x00")) - } - - _, paxPathUsed := paxHeaders[paxPath] - // try to use a ustar header when only the name is too long - if !tw.preferPax && len(paxHeaders) == 1 && paxPathUsed { - suffix := hdr.Name - prefix := "" - if len(hdr.Name) > fileNameSize && isASCII(hdr.Name) { - var err error - prefix, suffix, err = tw.splitUSTARLongName(hdr.Name) - if err == nil { - // ok we can use a ustar long name instead of pax, now correct the fields - - // remove the path field from the pax header. this will suppress the pax header - delete(paxHeaders, paxPath) - - // update the path fields - tw.cString(pathHeaderBytes, suffix, false, paxNone, nil) - tw.cString(prefixHeaderBytes, prefix, false, paxNone, nil) - - // Use the ustar magic if we used ustar long names. - if len(prefix) > 0 && !tw.usedBinary { - copy(header[257:265], []byte("ustar\x00")) - } - } - } - } - - // The chksum field is terminated by a NUL and a space. - // This is different from the other octal fields. - chksum, _ := checksum(header) - tw.octal(header[148:155], chksum) - header[155] = ' ' - - if tw.err != nil { - // problem with header; probably integer too big for a field. - return tw.err - } - - if allowPax { - for k, v := range hdr.Xattrs { - paxHeaders[paxXattr+k] = v - } - } - - if len(paxHeaders) > 0 { - if !allowPax { - return errInvalidHeader - } - if err := tw.writePAXHeader(hdr, paxHeaders); err != nil { - return err - } - } - tw.nb = int64(hdr.Size) - tw.pad = (blockSize - (tw.nb % blockSize)) % blockSize - - _, tw.err = tw.w.Write(header) - return tw.err -} - -// writeUSTARLongName splits a USTAR long name hdr.Name. -// name must be < 256 characters. errNameTooLong is returned -// if hdr.Name can't be split. The splitting heuristic -// is compatible with gnu tar. -func (tw *Writer) splitUSTARLongName(name string) (prefix, suffix string, err error) { - length := len(name) - if length > fileNamePrefixSize+1 { - length = fileNamePrefixSize + 1 - } else if name[length-1] == '/' { - length-- - } - i := strings.LastIndex(name[:length], "/") - // nlen contains the resulting length in the name field. - // plen contains the resulting length in the prefix field. - nlen := len(name) - i - 1 - plen := i - if i <= 0 || nlen > fileNameSize || nlen == 0 || plen > fileNamePrefixSize { - err = errNameTooLong - return - } - prefix, suffix = name[:i], name[i+1:] - return -} - -// writePaxHeader writes an extended pax header to the -// archive. -func (tw *Writer) writePAXHeader(hdr *Header, paxHeaders map[string]string) error { - // Prepare extended header - ext := new(Header) - ext.Typeflag = TypeXHeader - // Setting ModTime is required for reader parsing to - // succeed, and seems harmless enough. - ext.ModTime = hdr.ModTime - // The spec asks that we namespace our pseudo files - // with the current pid. - pid := os.Getpid() - dir, file := path.Split(hdr.Name) - fullName := path.Join(dir, - fmt.Sprintf("PaxHeaders.%d", pid), file) - - ascii := toASCII(fullName) - if len(ascii) > 100 { - ascii = ascii[:100] - } - ext.Name = ascii - // Construct the body - var buf bytes.Buffer - - for k, v := range paxHeaders { - fmt.Fprint(&buf, paxHeader(k+"="+v)) - } - - ext.Size = int64(len(buf.Bytes())) - if err := tw.writeHeader(ext, false); err != nil { - return err - } - if _, err := tw.Write(buf.Bytes()); err != nil { - return err - } - if err := tw.Flush(); err != nil { - return err - } - return nil -} - -// paxHeader formats a single pax record, prefixing it with the appropriate length -func paxHeader(msg string) string { - const padding = 2 // Extra padding for space and newline - size := len(msg) + padding - size += len(strconv.Itoa(size)) - record := fmt.Sprintf("%d %s\n", size, msg) - if len(record) != size { - // Final adjustment if adding size increased - // the number of digits in size - size = len(record) - record = fmt.Sprintf("%d %s\n", size, msg) - } - return record -} - -// Write writes to the current entry in the tar archive. -// Write returns the error ErrWriteTooLong if more than -// hdr.Size bytes are written after WriteHeader. -func (tw *Writer) Write(b []byte) (n int, err error) { - if tw.closed { - err = ErrWriteAfterClose - return - } - overwrite := false - if int64(len(b)) > tw.nb { - b = b[0:tw.nb] - overwrite = true - } - n, err = tw.w.Write(b) - tw.nb -= int64(n) - if err == nil && overwrite { - err = ErrWriteTooLong - return - } - tw.err = err - return -} - -// Close closes the tar archive, flushing any unwritten -// data to the underlying writer. -func (tw *Writer) Close() error { - if tw.err != nil || tw.closed { - return tw.err - } - tw.Flush() - tw.closed = true - if tw.err != nil { - return tw.err - } - - // trailer: two zero blocks - for i := 0; i < 2; i++ { - _, tw.err = tw.w.Write(zeroBlock) - if tw.err != nil { - break - } - } - return tw.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/tar/writer_test.go b/llgo/third_party/gofrontend/libgo/go/archive/tar/writer_test.go deleted file mode 100644 index fe46a67ce38b1ce4c5943553b146ffb3b2e5e395..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/tar/writer_test.go +++ /dev/null @@ -1,546 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tar - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "reflect" - "strings" - "testing" - "testing/iotest" - "time" -) - -type writerTestEntry struct { - header *Header - contents string -} - -type writerTest struct { - file string // filename of expected output - entries []*writerTestEntry -} - -var writerTests = []*writerTest{ - // The writer test file was produced with this command: - // tar (GNU tar) 1.26 - // ln -s small.txt link.txt - // tar -b 1 --format=ustar -c -f writer.tar small.txt small2.txt link.txt - { - file: "testdata/writer.tar", - entries: []*writerTestEntry{ - { - header: &Header{ - Name: "small.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 5, - ModTime: time.Unix(1246508266, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - }, - contents: "Kilts", - }, - { - header: &Header{ - Name: "small2.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 11, - ModTime: time.Unix(1245217492, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - }, - contents: "Google.com\n", - }, - { - header: &Header{ - Name: "link.txt", - Mode: 0777, - Uid: 1000, - Gid: 1000, - Size: 0, - ModTime: time.Unix(1314603082, 0), - Typeflag: '2', - Linkname: "small.txt", - Uname: "strings", - Gname: "strings", - }, - // no contents - }, - }, - }, - // The truncated test file was produced using these commands: - // dd if=/dev/zero bs=1048576 count=16384 > /tmp/16gig.txt - // tar -b 1 -c -f- /tmp/16gig.txt | dd bs=512 count=8 > writer-big.tar - { - file: "testdata/writer-big.tar", - entries: []*writerTestEntry{ - { - header: &Header{ - Name: "tmp/16gig.txt", - Mode: 0640, - Uid: 73025, - Gid: 5000, - Size: 16 << 30, - ModTime: time.Unix(1254699560, 0), - Typeflag: '0', - Uname: "dsymonds", - Gname: "eng", - }, - // fake contents - contents: strings.Repeat("\x00", 4<<10), - }, - }, - }, - // The truncated test file was produced using these commands: - // dd if=/dev/zero bs=1048576 count=16384 > (longname/)*15 /16gig.txt - // tar -b 1 -c -f- (longname/)*15 /16gig.txt | dd bs=512 count=8 > writer-big-long.tar - { - file: "testdata/writer-big-long.tar", - entries: []*writerTestEntry{ - { - header: &Header{ - Name: strings.Repeat("longname/", 15) + "16gig.txt", - Mode: 0644, - Uid: 1000, - Gid: 1000, - Size: 16 << 30, - ModTime: time.Unix(1399583047, 0), - Typeflag: '0', - Uname: "guillaume", - Gname: "guillaume", - }, - // fake contents - contents: strings.Repeat("\x00", 4<<10), - }, - }, - }, - // This file was produced using gnu tar 1.17 - // gnutar -b 4 --format=ustar (longname/)*15 + file.txt - { - file: "testdata/ustar.tar", - entries: []*writerTestEntry{ - { - header: &Header{ - Name: strings.Repeat("longname/", 15) + "file.txt", - Mode: 0644, - Uid: 0765, - Gid: 024, - Size: 06, - ModTime: time.Unix(1360135598, 0), - Typeflag: '0', - Uname: "shane", - Gname: "staff", - }, - contents: "hello\n", - }, - }, - }, - // This file was produced using gnu tar 1.26 - // echo "Slartibartfast" > file.txt - // ln file.txt hard.txt - // tar -b 1 --format=ustar -c -f hardlink.tar file.txt hard.txt - { - file: "testdata/hardlink.tar", - entries: []*writerTestEntry{ - { - header: &Header{ - Name: "file.txt", - Mode: 0644, - Uid: 1000, - Gid: 100, - Size: 15, - ModTime: time.Unix(1425484303, 0), - Typeflag: '0', - Uname: "vbatts", - Gname: "users", - }, - contents: "Slartibartfast\n", - }, - { - header: &Header{ - Name: "hard.txt", - Mode: 0644, - Uid: 1000, - Gid: 100, - Size: 0, - ModTime: time.Unix(1425484303, 0), - Typeflag: '1', - Linkname: "file.txt", - Uname: "vbatts", - Gname: "users", - }, - // no contents - }, - }, - }, -} - -// Render byte array in a two-character hexadecimal string, spaced for easy visual inspection. -func bytestr(offset int, b []byte) string { - const rowLen = 32 - s := fmt.Sprintf("%04x ", offset) - for _, ch := range b { - switch { - case '0' <= ch && ch <= '9', 'A' <= ch && ch <= 'Z', 'a' <= ch && ch <= 'z': - s += fmt.Sprintf(" %c", ch) - default: - s += fmt.Sprintf(" %02x", ch) - } - } - return s -} - -// Render a pseudo-diff between two blocks of bytes. -func bytediff(a []byte, b []byte) string { - const rowLen = 32 - s := fmt.Sprintf("(%d bytes vs. %d bytes)\n", len(a), len(b)) - for offset := 0; len(a)+len(b) > 0; offset += rowLen { - na, nb := rowLen, rowLen - if na > len(a) { - na = len(a) - } - if nb > len(b) { - nb = len(b) - } - sa := bytestr(offset, a[0:na]) - sb := bytestr(offset, b[0:nb]) - if sa != sb { - s += fmt.Sprintf("-%v\n+%v\n", sa, sb) - } - a = a[na:] - b = b[nb:] - } - return s -} - -func TestWriter(t *testing.T) { -testLoop: - for i, test := range writerTests { - expected, err := ioutil.ReadFile(test.file) - if err != nil { - t.Errorf("test %d: Unexpected error: %v", i, err) - continue - } - - buf := new(bytes.Buffer) - tw := NewWriter(iotest.TruncateWriter(buf, 4<<10)) // only catch the first 4 KB - big := false - for j, entry := range test.entries { - big = big || entry.header.Size > 1<<10 - if err := tw.WriteHeader(entry.header); err != nil { - t.Errorf("test %d, entry %d: Failed writing header: %v", i, j, err) - continue testLoop - } - if _, err := io.WriteString(tw, entry.contents); err != nil { - t.Errorf("test %d, entry %d: Failed writing contents: %v", i, j, err) - continue testLoop - } - } - // Only interested in Close failures for the small tests. - if err := tw.Close(); err != nil && !big { - t.Errorf("test %d: Failed closing archive: %v", i, err) - continue testLoop - } - - actual := buf.Bytes() - if !bytes.Equal(expected, actual) { - t.Errorf("test %d: Incorrect result: (-=expected, +=actual)\n%v", - i, bytediff(expected, actual)) - } - if testing.Short() { // The second test is expensive. - break - } - } -} - -func TestPax(t *testing.T) { - // Create an archive with a large name - fileinfo, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - hdr, err := FileInfoHeader(fileinfo, "") - if err != nil { - t.Fatalf("os.Stat: %v", err) - } - // Force a PAX long name to be written - longName := strings.Repeat("ab", 100) - contents := strings.Repeat(" ", int(hdr.Size)) - hdr.Name = longName - var buf bytes.Buffer - writer := NewWriter(&buf) - if err := writer.WriteHeader(hdr); err != nil { - t.Fatal(err) - } - if _, err = writer.Write([]byte(contents)); err != nil { - t.Fatal(err) - } - if err := writer.Close(); err != nil { - t.Fatal(err) - } - // Simple test to make sure PAX extensions are in effect - if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { - t.Fatal("Expected at least one PAX header to be written.") - } - // Test that we can get a long name back out of the archive. - reader := NewReader(&buf) - hdr, err = reader.Next() - if err != nil { - t.Fatal(err) - } - if hdr.Name != longName { - t.Fatal("Couldn't recover long file name") - } -} - -func TestPaxSymlink(t *testing.T) { - // Create an archive with a large linkname - fileinfo, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - hdr, err := FileInfoHeader(fileinfo, "") - hdr.Typeflag = TypeSymlink - if err != nil { - t.Fatalf("os.Stat:1 %v", err) - } - // Force a PAX long linkname to be written - longLinkname := strings.Repeat("1234567890/1234567890", 10) - hdr.Linkname = longLinkname - - hdr.Size = 0 - var buf bytes.Buffer - writer := NewWriter(&buf) - if err := writer.WriteHeader(hdr); err != nil { - t.Fatal(err) - } - if err := writer.Close(); err != nil { - t.Fatal(err) - } - // Simple test to make sure PAX extensions are in effect - if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { - t.Fatal("Expected at least one PAX header to be written.") - } - // Test that we can get a long name back out of the archive. - reader := NewReader(&buf) - hdr, err = reader.Next() - if err != nil { - t.Fatal(err) - } - if hdr.Linkname != longLinkname { - t.Fatal("Couldn't recover long link name") - } -} - -func TestPaxNonAscii(t *testing.T) { - // Create an archive with non ascii. These should trigger a pax header - // because pax headers have a defined utf-8 encoding. - fileinfo, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - - hdr, err := FileInfoHeader(fileinfo, "") - if err != nil { - t.Fatalf("os.Stat:1 %v", err) - } - - // some sample data - chineseFilename := "文件名" - chineseGroupname := "組" - chineseUsername := "用戶名" - - hdr.Name = chineseFilename - hdr.Gname = chineseGroupname - hdr.Uname = chineseUsername - - contents := strings.Repeat(" ", int(hdr.Size)) - - var buf bytes.Buffer - writer := NewWriter(&buf) - if err := writer.WriteHeader(hdr); err != nil { - t.Fatal(err) - } - if _, err = writer.Write([]byte(contents)); err != nil { - t.Fatal(err) - } - if err := writer.Close(); err != nil { - t.Fatal(err) - } - // Simple test to make sure PAX extensions are in effect - if !bytes.Contains(buf.Bytes(), []byte("PaxHeaders.")) { - t.Fatal("Expected at least one PAX header to be written.") - } - // Test that we can get a long name back out of the archive. - reader := NewReader(&buf) - hdr, err = reader.Next() - if err != nil { - t.Fatal(err) - } - if hdr.Name != chineseFilename { - t.Fatal("Couldn't recover unicode name") - } - if hdr.Gname != chineseGroupname { - t.Fatal("Couldn't recover unicode group") - } - if hdr.Uname != chineseUsername { - t.Fatal("Couldn't recover unicode user") - } -} - -func TestPaxXattrs(t *testing.T) { - xattrs := map[string]string{ - "user.key": "value", - } - - // Create an archive with an xattr - fileinfo, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - hdr, err := FileInfoHeader(fileinfo, "") - if err != nil { - t.Fatalf("os.Stat: %v", err) - } - contents := "Kilts" - hdr.Xattrs = xattrs - var buf bytes.Buffer - writer := NewWriter(&buf) - if err := writer.WriteHeader(hdr); err != nil { - t.Fatal(err) - } - if _, err = writer.Write([]byte(contents)); err != nil { - t.Fatal(err) - } - if err := writer.Close(); err != nil { - t.Fatal(err) - } - // Test that we can get the xattrs back out of the archive. - reader := NewReader(&buf) - hdr, err = reader.Next() - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(hdr.Xattrs, xattrs) { - t.Fatalf("xattrs did not survive round trip: got %+v, want %+v", - hdr.Xattrs, xattrs) - } -} - -func TestPAXHeader(t *testing.T) { - medName := strings.Repeat("CD", 50) - longName := strings.Repeat("AB", 100) - paxTests := [][2]string{ - {paxPath + "=/etc/hosts", "19 path=/etc/hosts\n"}, - {"a=b", "6 a=b\n"}, // Single digit length - {"a=names", "11 a=names\n"}, // Test case involving carries - {paxPath + "=" + longName, fmt.Sprintf("210 path=%s\n", longName)}, - {paxPath + "=" + medName, fmt.Sprintf("110 path=%s\n", medName)}} - - for _, test := range paxTests { - key, expected := test[0], test[1] - if result := paxHeader(key); result != expected { - t.Fatalf("paxHeader: got %s, expected %s", result, expected) - } - } -} - -func TestUSTARLongName(t *testing.T) { - // Create an archive with a path that failed to split with USTAR extension in previous versions. - fileinfo, err := os.Stat("testdata/small.txt") - if err != nil { - t.Fatal(err) - } - hdr, err := FileInfoHeader(fileinfo, "") - hdr.Typeflag = TypeDir - if err != nil { - t.Fatalf("os.Stat:1 %v", err) - } - // Force a PAX long name to be written. The name was taken from a practical example - // that fails and replaced ever char through numbers to anonymize the sample. - longName := "/0000_0000000/00000-000000000/0000_0000000/00000-0000000000000/0000_0000000/00000-0000000-00000000/0000_0000000/00000000/0000_0000000/000/0000_0000000/00000000v00/0000_0000000/000000/0000_0000000/0000000/0000_0000000/00000y-00/0000/0000/00000000/0x000000/" - hdr.Name = longName - - hdr.Size = 0 - var buf bytes.Buffer - writer := NewWriter(&buf) - if err := writer.WriteHeader(hdr); err != nil { - t.Fatal(err) - } - if err := writer.Close(); err != nil { - t.Fatal(err) - } - // Test that we can get a long name back out of the archive. - reader := NewReader(&buf) - hdr, err = reader.Next() - if err != nil { - t.Fatal(err) - } - if hdr.Name != longName { - t.Fatal("Couldn't recover long name") - } -} - -func TestValidTypeflagWithPAXHeader(t *testing.T) { - var buffer bytes.Buffer - tw := NewWriter(&buffer) - - fileName := strings.Repeat("ab", 100) - - hdr := &Header{ - Name: fileName, - Size: 4, - Typeflag: 0, - } - if err := tw.WriteHeader(hdr); err != nil { - t.Fatalf("Failed to write header: %s", err) - } - if _, err := tw.Write([]byte("fooo")); err != nil { - t.Fatalf("Failed to write the file's data: %s", err) - } - tw.Close() - - tr := NewReader(&buffer) - - for { - header, err := tr.Next() - if err == io.EOF { - break - } - if err != nil { - t.Fatalf("Failed to read header: %s", err) - } - if header.Typeflag != 0 { - t.Fatalf("Typeflag should've been 0, found %d", header.Typeflag) - } - } -} - -func TestWriteAfterClose(t *testing.T) { - var buffer bytes.Buffer - tw := NewWriter(&buffer) - - hdr := &Header{ - Name: "small.txt", - Size: 5, - } - if err := tw.WriteHeader(hdr); err != nil { - t.Fatalf("Failed to write header: %s", err) - } - tw.Close() - if _, err := tw.Write([]byte("Kilts")); err != ErrWriteAfterClose { - t.Fatalf("Write: got %v; want ErrWriteAfterClose", err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/reader.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/reader.go deleted file mode 100644 index 519748bac4006325228819074c7c984b9865063b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/reader.go +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zip - -import ( - "bufio" - "encoding/binary" - "errors" - "fmt" - "hash" - "hash/crc32" - "io" - "os" -) - -var ( - ErrFormat = errors.New("zip: not a valid zip file") - ErrAlgorithm = errors.New("zip: unsupported compression algorithm") - ErrChecksum = errors.New("zip: checksum error") -) - -type Reader struct { - r io.ReaderAt - File []*File - Comment string -} - -type ReadCloser struct { - f *os.File - Reader -} - -type File struct { - FileHeader - zipr io.ReaderAt - zipsize int64 - headerOffset int64 -} - -func (f *File) hasDataDescriptor() bool { - return f.Flags&0x8 != 0 -} - -// OpenReader will open the Zip file specified by name and return a ReadCloser. -func OpenReader(name string) (*ReadCloser, error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - fi, err := f.Stat() - if err != nil { - f.Close() - return nil, err - } - r := new(ReadCloser) - if err := r.init(f, fi.Size()); err != nil { - f.Close() - return nil, err - } - r.f = f - return r, nil -} - -// NewReader returns a new Reader reading from r, which is assumed to -// have the given size in bytes. -func NewReader(r io.ReaderAt, size int64) (*Reader, error) { - zr := new(Reader) - if err := zr.init(r, size); err != nil { - return nil, err - } - return zr, nil -} - -func (z *Reader) init(r io.ReaderAt, size int64) error { - end, err := readDirectoryEnd(r, size) - if err != nil { - return err - } - if end.directoryRecords > uint64(size)/fileHeaderLen { - return fmt.Errorf("archive/zip: TOC declares impossible %d files in %d byte zip", end.directoryRecords, size) - } - z.r = r - z.File = make([]*File, 0, end.directoryRecords) - z.Comment = end.comment - rs := io.NewSectionReader(r, 0, size) - if _, err = rs.Seek(int64(end.directoryOffset), os.SEEK_SET); err != nil { - return err - } - buf := bufio.NewReader(rs) - - // The count of files inside a zip is truncated to fit in a uint16. - // Gloss over this by reading headers until we encounter - // a bad one, and then only report a ErrFormat or UnexpectedEOF if - // the file count modulo 65536 is incorrect. - for { - f := &File{zipr: r, zipsize: size} - err = readDirectoryHeader(f, buf) - if err == ErrFormat || err == io.ErrUnexpectedEOF { - break - } - if err != nil { - return err - } - z.File = append(z.File, f) - } - if uint16(len(z.File)) != uint16(end.directoryRecords) { // only compare 16 bits here - // Return the readDirectoryHeader error if we read - // the wrong number of directory entries. - return err - } - return nil -} - -// Close closes the Zip file, rendering it unusable for I/O. -func (rc *ReadCloser) Close() error { - return rc.f.Close() -} - -// DataOffset returns the offset of the file's possibly-compressed -// data, relative to the beginning of the zip file. -// -// Most callers should instead use Open, which transparently -// decompresses data and verifies checksums. -func (f *File) DataOffset() (offset int64, err error) { - bodyOffset, err := f.findBodyOffset() - if err != nil { - return - } - return f.headerOffset + bodyOffset, nil -} - -// Open returns a ReadCloser that provides access to the File's contents. -// Multiple files may be read concurrently. -func (f *File) Open() (rc io.ReadCloser, err error) { - bodyOffset, err := f.findBodyOffset() - if err != nil { - return - } - size := int64(f.CompressedSize64) - r := io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset, size) - dcomp := decompressor(f.Method) - if dcomp == nil { - err = ErrAlgorithm - return - } - rc = dcomp(r) - var desr io.Reader - if f.hasDataDescriptor() { - desr = io.NewSectionReader(f.zipr, f.headerOffset+bodyOffset+size, dataDescriptorLen) - } - rc = &checksumReader{ - rc: rc, - hash: crc32.NewIEEE(), - f: f, - desr: desr, - } - return -} - -type checksumReader struct { - rc io.ReadCloser - hash hash.Hash32 - nread uint64 // number of bytes read so far - f *File - desr io.Reader // if non-nil, where to read the data descriptor - err error // sticky error -} - -func (r *checksumReader) Read(b []byte) (n int, err error) { - if r.err != nil { - return 0, r.err - } - n, err = r.rc.Read(b) - r.hash.Write(b[:n]) - r.nread += uint64(n) - if err == nil { - return - } - if err == io.EOF { - if r.nread != r.f.UncompressedSize64 { - return 0, io.ErrUnexpectedEOF - } - if r.desr != nil { - if err1 := readDataDescriptor(r.desr, r.f); err1 != nil { - if err1 == io.EOF { - err = io.ErrUnexpectedEOF - } else { - err = err1 - } - } else if r.hash.Sum32() != r.f.CRC32 { - err = ErrChecksum - } - } else { - // If there's not a data descriptor, we still compare - // the CRC32 of what we've read against the file header - // or TOC's CRC32, if it seems like it was set. - if r.f.CRC32 != 0 && r.hash.Sum32() != r.f.CRC32 { - err = ErrChecksum - } - } - } - r.err = err - return -} - -func (r *checksumReader) Close() error { return r.rc.Close() } - -// findBodyOffset does the minimum work to verify the file has a header -// and returns the file body offset. -func (f *File) findBodyOffset() (int64, error) { - var buf [fileHeaderLen]byte - if _, err := f.zipr.ReadAt(buf[:], f.headerOffset); err != nil { - return 0, err - } - b := readBuf(buf[:]) - if sig := b.uint32(); sig != fileHeaderSignature { - return 0, ErrFormat - } - b = b[22:] // skip over most of the header - filenameLen := int(b.uint16()) - extraLen := int(b.uint16()) - return int64(fileHeaderLen + filenameLen + extraLen), nil -} - -// readDirectoryHeader attempts to read a directory header from r. -// It returns io.ErrUnexpectedEOF if it cannot read a complete header, -// and ErrFormat if it doesn't find a valid header signature. -func readDirectoryHeader(f *File, r io.Reader) error { - var buf [directoryHeaderLen]byte - if _, err := io.ReadFull(r, buf[:]); err != nil { - return err - } - b := readBuf(buf[:]) - if sig := b.uint32(); sig != directoryHeaderSignature { - return ErrFormat - } - f.CreatorVersion = b.uint16() - f.ReaderVersion = b.uint16() - f.Flags = b.uint16() - f.Method = b.uint16() - f.ModifiedTime = b.uint16() - f.ModifiedDate = b.uint16() - f.CRC32 = b.uint32() - f.CompressedSize = b.uint32() - f.UncompressedSize = b.uint32() - f.CompressedSize64 = uint64(f.CompressedSize) - f.UncompressedSize64 = uint64(f.UncompressedSize) - filenameLen := int(b.uint16()) - extraLen := int(b.uint16()) - commentLen := int(b.uint16()) - b = b[4:] // skipped start disk number and internal attributes (2x uint16) - f.ExternalAttrs = b.uint32() - f.headerOffset = int64(b.uint32()) - d := make([]byte, filenameLen+extraLen+commentLen) - if _, err := io.ReadFull(r, d); err != nil { - return err - } - f.Name = string(d[:filenameLen]) - f.Extra = d[filenameLen : filenameLen+extraLen] - f.Comment = string(d[filenameLen+extraLen:]) - - if len(f.Extra) > 0 { - b := readBuf(f.Extra) - for len(b) >= 4 { // need at least tag and size - tag := b.uint16() - size := b.uint16() - if int(size) > len(b) { - return ErrFormat - } - if tag == zip64ExtraId { - // update directory values from the zip64 extra block - eb := readBuf(b[:size]) - if len(eb) >= 8 { - f.UncompressedSize64 = eb.uint64() - } - if len(eb) >= 8 { - f.CompressedSize64 = eb.uint64() - } - if len(eb) >= 8 { - f.headerOffset = int64(eb.uint64()) - } - } - b = b[size:] - } - // Should have consumed the whole header. - // But popular zip & JAR creation tools are broken and - // may pad extra zeros at the end, so accept those - // too. See golang.org/issue/8186. - for _, v := range b { - if v != 0 { - return ErrFormat - } - } - } - return nil -} - -func readDataDescriptor(r io.Reader, f *File) error { - var buf [dataDescriptorLen]byte - - // The spec says: "Although not originally assigned a - // signature, the value 0x08074b50 has commonly been adopted - // as a signature value for the data descriptor record. - // Implementers should be aware that ZIP files may be - // encountered with or without this signature marking data - // descriptors and should account for either case when reading - // ZIP files to ensure compatibility." - // - // dataDescriptorLen includes the size of the signature but - // first read just those 4 bytes to see if it exists. - if _, err := io.ReadFull(r, buf[:4]); err != nil { - return err - } - off := 0 - maybeSig := readBuf(buf[:4]) - if maybeSig.uint32() != dataDescriptorSignature { - // No data descriptor signature. Keep these four - // bytes. - off += 4 - } - if _, err := io.ReadFull(r, buf[off:12]); err != nil { - return err - } - b := readBuf(buf[:12]) - if b.uint32() != f.CRC32 { - return ErrChecksum - } - - // The two sizes that follow here can be either 32 bits or 64 bits - // but the spec is not very clear on this and different - // interpretations has been made causing incompatibilities. We - // already have the sizes from the central directory so we can - // just ignore these. - - return nil -} - -func readDirectoryEnd(r io.ReaderAt, size int64) (dir *directoryEnd, err error) { - // look for directoryEndSignature in the last 1k, then in the last 65k - var buf []byte - var directoryEndOffset int64 - for i, bLen := range []int64{1024, 65 * 1024} { - if bLen > size { - bLen = size - } - buf = make([]byte, int(bLen)) - if _, err := r.ReadAt(buf, size-bLen); err != nil && err != io.EOF { - return nil, err - } - if p := findSignatureInBlock(buf); p >= 0 { - buf = buf[p:] - directoryEndOffset = size - bLen + int64(p) - break - } - if i == 1 || bLen == size { - return nil, ErrFormat - } - } - - // read header into struct - b := readBuf(buf[4:]) // skip signature - d := &directoryEnd{ - diskNbr: uint32(b.uint16()), - dirDiskNbr: uint32(b.uint16()), - dirRecordsThisDisk: uint64(b.uint16()), - directoryRecords: uint64(b.uint16()), - directorySize: uint64(b.uint32()), - directoryOffset: uint64(b.uint32()), - commentLen: b.uint16(), - } - l := int(d.commentLen) - if l > len(b) { - return nil, errors.New("zip: invalid comment length") - } - d.comment = string(b[:l]) - - p, err := findDirectory64End(r, directoryEndOffset) - if err == nil && p >= 0 { - err = readDirectory64End(r, p, d) - } - if err != nil { - return nil, err - } - - // Make sure directoryOffset points to somewhere in our file. - if o := int64(d.directoryOffset); o < 0 || o >= size { - return nil, ErrFormat - } - return d, nil -} - -// findDirectory64End tries to read the zip64 locator just before the -// directory end and returns the offset of the zip64 directory end if -// found. -func findDirectory64End(r io.ReaderAt, directoryEndOffset int64) (int64, error) { - locOffset := directoryEndOffset - directory64LocLen - if locOffset < 0 { - return -1, nil // no need to look for a header outside the file - } - buf := make([]byte, directory64LocLen) - if _, err := r.ReadAt(buf, locOffset); err != nil { - return -1, err - } - b := readBuf(buf) - if sig := b.uint32(); sig != directory64LocSignature { - return -1, nil - } - b = b[4:] // skip number of the disk with the start of the zip64 end of central directory - p := b.uint64() // relative offset of the zip64 end of central directory record - return int64(p), nil -} - -// readDirectory64End reads the zip64 directory end and updates the -// directory end with the zip64 directory end values. -func readDirectory64End(r io.ReaderAt, offset int64, d *directoryEnd) (err error) { - buf := make([]byte, directory64EndLen) - if _, err := r.ReadAt(buf, offset); err != nil { - return err - } - - b := readBuf(buf) - if sig := b.uint32(); sig != directory64EndSignature { - return ErrFormat - } - - b = b[12:] // skip dir size, version and version needed (uint64 + 2x uint16) - d.diskNbr = b.uint32() // number of this disk - d.dirDiskNbr = b.uint32() // number of the disk with the start of the central directory - d.dirRecordsThisDisk = b.uint64() // total number of entries in the central directory on this disk - d.directoryRecords = b.uint64() // total number of entries in the central directory - d.directorySize = b.uint64() // size of the central directory - d.directoryOffset = b.uint64() // offset of start of central directory with respect to the starting disk number - - return nil -} - -func findSignatureInBlock(b []byte) int { - for i := len(b) - directoryEndLen; i >= 0; i-- { - // defined from directoryEndSignature in struct.go - if b[i] == 'P' && b[i+1] == 'K' && b[i+2] == 0x05 && b[i+3] == 0x06 { - // n is length of comment - n := int(b[i+directoryEndLen-2]) | int(b[i+directoryEndLen-1])<<8 - if n+directoryEndLen+i <= len(b) { - return i - } - } - } - return -1 -} - -type readBuf []byte - -func (b *readBuf) uint16() uint16 { - v := binary.LittleEndian.Uint16(*b) - *b = (*b)[2:] - return v -} - -func (b *readBuf) uint32() uint32 { - v := binary.LittleEndian.Uint32(*b) - *b = (*b)[4:] - return v -} - -func (b *readBuf) uint64() uint64 { - v := binary.LittleEndian.Uint64(*b) - *b = (*b)[8:] - return v -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/reader_test.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/reader_test.go deleted file mode 100644 index 547dd39048e21749faa6bebb159734bc4caf1599..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/reader_test.go +++ /dev/null @@ -1,607 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zip - -import ( - "bytes" - "encoding/binary" - "encoding/hex" - "io" - "io/ioutil" - "os" - "path/filepath" - "regexp" - "strings" - "testing" - "time" -) - -type ZipTest struct { - Name string - Source func() (r io.ReaderAt, size int64) // if non-nil, used instead of testdata/ file - Comment string - File []ZipTestFile - Error error // the error that Opening this file should return -} - -type ZipTestFile struct { - Name string - Content []byte // if blank, will attempt to compare against File - ContentErr error - File string // name of file to compare to (relative to testdata/) - Mtime string // modified time in format "mm-dd-yy hh:mm:ss" - Mode os.FileMode -} - -// Caution: The Mtime values found for the test files should correspond to -// the values listed with unzip -l . However, the values -// listed by unzip appear to be off by some hours. When creating -// fresh test files and testing them, this issue is not present. -// The test files were created in Sydney, so there might be a time -// zone issue. The time zone information does have to be encoded -// somewhere, because otherwise unzip -l could not provide a different -// time from what the archive/zip package provides, but there appears -// to be no documentation about this. - -var tests = []ZipTest{ - { - Name: "test.zip", - Comment: "This is a zipfile comment.", - File: []ZipTestFile{ - { - Name: "test.txt", - Content: []byte("This is a test text file.\n"), - Mtime: "09-05-10 12:12:02", - Mode: 0644, - }, - { - Name: "gophercolor16x16.png", - File: "gophercolor16x16.png", - Mtime: "09-05-10 15:52:58", - Mode: 0644, - }, - }, - }, - { - Name: "test-trailing-junk.zip", - Comment: "This is a zipfile comment.", - File: []ZipTestFile{ - { - Name: "test.txt", - Content: []byte("This is a test text file.\n"), - Mtime: "09-05-10 12:12:02", - Mode: 0644, - }, - { - Name: "gophercolor16x16.png", - File: "gophercolor16x16.png", - Mtime: "09-05-10 15:52:58", - Mode: 0644, - }, - }, - }, - { - Name: "r.zip", - Source: returnRecursiveZip, - File: []ZipTestFile{ - { - Name: "r/r.zip", - Content: rZipBytes(), - Mtime: "03-04-10 00:24:16", - Mode: 0666, - }, - }, - }, - { - Name: "symlink.zip", - File: []ZipTestFile{ - { - Name: "symlink", - Content: []byte("../target"), - Mode: 0777 | os.ModeSymlink, - }, - }, - }, - { - Name: "readme.zip", - }, - { - Name: "readme.notzip", - Error: ErrFormat, - }, - { - Name: "dd.zip", - File: []ZipTestFile{ - { - Name: "filename", - Content: []byte("This is a test textfile.\n"), - Mtime: "02-02-11 13:06:20", - Mode: 0666, - }, - }, - }, - { - // created in windows XP file manager. - Name: "winxp.zip", - File: crossPlatform, - }, - { - // created by Zip 3.0 under Linux - Name: "unix.zip", - File: crossPlatform, - }, - { - // created by Go, before we wrote the "optional" data - // descriptor signatures (which are required by OS X) - Name: "go-no-datadesc-sig.zip", - File: []ZipTestFile{ - { - Name: "foo.txt", - Content: []byte("foo\n"), - Mtime: "03-08-12 16:59:10", - Mode: 0644, - }, - { - Name: "bar.txt", - Content: []byte("bar\n"), - Mtime: "03-08-12 16:59:12", - Mode: 0644, - }, - }, - }, - { - // created by Go, after we wrote the "optional" data - // descriptor signatures (which are required by OS X) - Name: "go-with-datadesc-sig.zip", - File: []ZipTestFile{ - { - Name: "foo.txt", - Content: []byte("foo\n"), - Mode: 0666, - }, - { - Name: "bar.txt", - Content: []byte("bar\n"), - Mode: 0666, - }, - }, - }, - { - Name: "Bad-CRC32-in-data-descriptor", - Source: returnCorruptCRC32Zip, - File: []ZipTestFile{ - { - Name: "foo.txt", - Content: []byte("foo\n"), - Mode: 0666, - ContentErr: ErrChecksum, - }, - { - Name: "bar.txt", - Content: []byte("bar\n"), - Mode: 0666, - }, - }, - }, - // Tests that we verify (and accept valid) crc32s on files - // with crc32s in their file header (not in data descriptors) - { - Name: "crc32-not-streamed.zip", - File: []ZipTestFile{ - { - Name: "foo.txt", - Content: []byte("foo\n"), - Mtime: "03-08-12 16:59:10", - Mode: 0644, - }, - { - Name: "bar.txt", - Content: []byte("bar\n"), - Mtime: "03-08-12 16:59:12", - Mode: 0644, - }, - }, - }, - // Tests that we verify (and reject invalid) crc32s on files - // with crc32s in their file header (not in data descriptors) - { - Name: "crc32-not-streamed.zip", - Source: returnCorruptNotStreamedZip, - File: []ZipTestFile{ - { - Name: "foo.txt", - Content: []byte("foo\n"), - Mtime: "03-08-12 16:59:10", - Mode: 0644, - ContentErr: ErrChecksum, - }, - { - Name: "bar.txt", - Content: []byte("bar\n"), - Mtime: "03-08-12 16:59:12", - Mode: 0644, - }, - }, - }, - { - Name: "zip64.zip", - File: []ZipTestFile{ - { - Name: "README", - Content: []byte("This small file is in ZIP64 format.\n"), - Mtime: "08-10-12 14:33:32", - Mode: 0644, - }, - }, - }, - // Another zip64 file with different Extras fields. (golang.org/issue/7069) - { - Name: "zip64-2.zip", - File: []ZipTestFile{ - { - Name: "README", - Content: []byte("This small file is in ZIP64 format.\n"), - Mtime: "08-10-12 14:33:32", - Mode: 0644, - }, - }, - }, -} - -var crossPlatform = []ZipTestFile{ - { - Name: "hello", - Content: []byte("world \r\n"), - Mode: 0666, - }, - { - Name: "dir/bar", - Content: []byte("foo \r\n"), - Mode: 0666, - }, - { - Name: "dir/empty/", - Content: []byte{}, - Mode: os.ModeDir | 0777, - }, - { - Name: "readonly", - Content: []byte("important \r\n"), - Mode: 0444, - }, -} - -func TestReader(t *testing.T) { - for _, zt := range tests { - readTestZip(t, zt) - } -} - -func readTestZip(t *testing.T, zt ZipTest) { - var z *Reader - var err error - if zt.Source != nil { - rat, size := zt.Source() - z, err = NewReader(rat, size) - } else { - var rc *ReadCloser - rc, err = OpenReader(filepath.Join("testdata", zt.Name)) - if err == nil { - defer rc.Close() - z = &rc.Reader - } - } - if err != zt.Error { - t.Errorf("%s: error=%v, want %v", zt.Name, err, zt.Error) - return - } - - // bail if file is not zip - if err == ErrFormat { - return - } - - // bail here if no Files expected to be tested - // (there may actually be files in the zip, but we don't care) - if zt.File == nil { - return - } - - if z.Comment != zt.Comment { - t.Errorf("%s: comment=%q, want %q", zt.Name, z.Comment, zt.Comment) - } - if len(z.File) != len(zt.File) { - t.Fatalf("%s: file count=%d, want %d", zt.Name, len(z.File), len(zt.File)) - } - - // test read of each file - for i, ft := range zt.File { - readTestFile(t, zt, ft, z.File[i]) - } - - // test simultaneous reads - n := 0 - done := make(chan bool) - for i := 0; i < 5; i++ { - for j, ft := range zt.File { - go func(j int, ft ZipTestFile) { - readTestFile(t, zt, ft, z.File[j]) - done <- true - }(j, ft) - n++ - } - } - for ; n > 0; n-- { - <-done - } -} - -func readTestFile(t *testing.T, zt ZipTest, ft ZipTestFile, f *File) { - if f.Name != ft.Name { - t.Errorf("%s: name=%q, want %q", zt.Name, f.Name, ft.Name) - } - - if ft.Mtime != "" { - mtime, err := time.Parse("01-02-06 15:04:05", ft.Mtime) - if err != nil { - t.Error(err) - return - } - if ft := f.ModTime(); !ft.Equal(mtime) { - t.Errorf("%s: %s: mtime=%s, want %s", zt.Name, f.Name, ft, mtime) - } - } - - testFileMode(t, zt.Name, f, ft.Mode) - - var b bytes.Buffer - r, err := f.Open() - if err != nil { - t.Errorf("%s: %v", zt.Name, err) - return - } - - _, err = io.Copy(&b, r) - if err != ft.ContentErr { - t.Errorf("%s: copying contents: %v (want %v)", zt.Name, err, ft.ContentErr) - } - if err != nil { - return - } - r.Close() - - size := uint64(f.UncompressedSize) - if size == uint32max { - size = f.UncompressedSize64 - } - if g := uint64(b.Len()); g != size { - t.Errorf("%v: read %v bytes but f.UncompressedSize == %v", f.Name, g, size) - } - - var c []byte - if ft.Content != nil { - c = ft.Content - } else if c, err = ioutil.ReadFile("testdata/" + ft.File); err != nil { - t.Error(err) - return - } - - if b.Len() != len(c) { - t.Errorf("%s: len=%d, want %d", f.Name, b.Len(), len(c)) - return - } - - for i, b := range b.Bytes() { - if b != c[i] { - t.Errorf("%s: content[%d]=%q want %q", f.Name, i, b, c[i]) - return - } - } -} - -func testFileMode(t *testing.T, zipName string, f *File, want os.FileMode) { - mode := f.Mode() - if want == 0 { - t.Errorf("%s: %s mode: got %v, want none", zipName, f.Name, mode) - } else if mode != want { - t.Errorf("%s: %s mode: want %v, got %v", zipName, f.Name, want, mode) - } -} - -func TestInvalidFiles(t *testing.T) { - const size = 1024 * 70 // 70kb - b := make([]byte, size) - - // zeroes - _, err := NewReader(bytes.NewReader(b), size) - if err != ErrFormat { - t.Errorf("zeroes: error=%v, want %v", err, ErrFormat) - } - - // repeated directoryEndSignatures - sig := make([]byte, 4) - binary.LittleEndian.PutUint32(sig, directoryEndSignature) - for i := 0; i < size-4; i += 4 { - copy(b[i:i+4], sig) - } - _, err = NewReader(bytes.NewReader(b), size) - if err != ErrFormat { - t.Errorf("sigs: error=%v, want %v", err, ErrFormat) - } -} - -func messWith(fileName string, corrupter func(b []byte)) (r io.ReaderAt, size int64) { - data, err := ioutil.ReadFile(filepath.Join("testdata", fileName)) - if err != nil { - panic("Error reading " + fileName + ": " + err.Error()) - } - corrupter(data) - return bytes.NewReader(data), int64(len(data)) -} - -func returnCorruptCRC32Zip() (r io.ReaderAt, size int64) { - return messWith("go-with-datadesc-sig.zip", func(b []byte) { - // Corrupt one of the CRC32s in the data descriptor: - b[0x2d]++ - }) -} - -func returnCorruptNotStreamedZip() (r io.ReaderAt, size int64) { - return messWith("crc32-not-streamed.zip", func(b []byte) { - // Corrupt foo.txt's final crc32 byte, in both - // the file header and TOC. (0x7e -> 0x7f) - b[0x11]++ - b[0x9d]++ - - // TODO(bradfitz): add a new test that only corrupts - // one of these values, and verify that that's also an - // error. Currently, the reader code doesn't verify the - // fileheader and TOC's crc32 match if they're both - // non-zero and only the second line above, the TOC, - // is what matters. - }) -} - -// rZipBytes returns the bytes of a recursive zip file, without -// putting it on disk and triggering certain virus scanners. -func rZipBytes() []byte { - s := ` -0000000 50 4b 03 04 14 00 00 00 08 00 08 03 64 3c f9 f4 -0000010 89 64 48 01 00 00 b8 01 00 00 07 00 00 00 72 2f -0000020 72 2e 7a 69 70 00 25 00 da ff 50 4b 03 04 14 00 -0000030 00 00 08 00 08 03 64 3c f9 f4 89 64 48 01 00 00 -0000040 b8 01 00 00 07 00 00 00 72 2f 72 2e 7a 69 70 00 -0000050 2f 00 d0 ff 00 25 00 da ff 50 4b 03 04 14 00 00 -0000060 00 08 00 08 03 64 3c f9 f4 89 64 48 01 00 00 b8 -0000070 01 00 00 07 00 00 00 72 2f 72 2e 7a 69 70 00 2f -0000080 00 d0 ff c2 54 8e 57 39 00 05 00 fa ff c2 54 8e -0000090 57 39 00 05 00 fa ff 00 05 00 fa ff 00 14 00 eb -00000a0 ff c2 54 8e 57 39 00 05 00 fa ff 00 05 00 fa ff -00000b0 00 14 00 eb ff 42 88 21 c4 00 00 14 00 eb ff 42 -00000c0 88 21 c4 00 00 14 00 eb ff 42 88 21 c4 00 00 14 -00000d0 00 eb ff 42 88 21 c4 00 00 14 00 eb ff 42 88 21 -00000e0 c4 00 00 00 00 ff ff 00 00 00 ff ff 00 34 00 cb -00000f0 ff 42 88 21 c4 00 00 00 00 ff ff 00 00 00 ff ff -0000100 00 34 00 cb ff 42 e8 21 5e 0f 00 00 00 ff ff 0a -0000110 f0 66 64 12 61 c0 15 dc e8 a0 48 bf 48 af 2a b3 -0000120 20 c0 9b 95 0d c4 67 04 42 53 06 06 06 40 00 06 -0000130 00 f9 ff 6d 01 00 00 00 00 42 e8 21 5e 0f 00 00 -0000140 00 ff ff 0a f0 66 64 12 61 c0 15 dc e8 a0 48 bf -0000150 48 af 2a b3 20 c0 9b 95 0d c4 67 04 42 53 06 06 -0000160 06 40 00 06 00 f9 ff 6d 01 00 00 00 00 50 4b 01 -0000170 02 14 00 14 00 00 00 08 00 08 03 64 3c f9 f4 89 -0000180 64 48 01 00 00 b8 01 00 00 07 00 00 00 00 00 00 -0000190 00 00 00 00 00 00 00 00 00 00 00 72 2f 72 2e 7a -00001a0 69 70 50 4b 05 06 00 00 00 00 01 00 01 00 35 00 -00001b0 00 00 6d 01 00 00 00 00` - s = regexp.MustCompile(`[0-9a-f]{7}`).ReplaceAllString(s, "") - s = regexp.MustCompile(`\s+`).ReplaceAllString(s, "") - b, err := hex.DecodeString(s) - if err != nil { - panic(err) - } - return b -} - -func returnRecursiveZip() (r io.ReaderAt, size int64) { - b := rZipBytes() - return bytes.NewReader(b), int64(len(b)) -} - -func TestIssue8186(t *testing.T) { - // Directory headers & data found in the TOC of a JAR file. - dirEnts := []string{ - "PK\x01\x02\n\x00\n\x00\x00\b\x00\x004\x9d3?\xaa\x1b\x06\xf0\x81\x02\x00\x00\x81\x02\x00\x00-\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00res/drawable-xhdpi-v4/ic_actionbar_accept.png\xfe\xca\x00\x00\x00", - "PK\x01\x02\n\x00\n\x00\x00\b\x00\x004\x9d3?\x90K\x89\xc7t\n\x00\x00t\n\x00\x00\x0e\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x02\x00\x00resources.arsc\x00\x00\x00", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?\xff$\x18\xed3\x03\x00\x00\xb4\b\x00\x00\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00t\r\x00\x00AndroidManifest.xml", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?\x14\xc5K\xab\x192\x02\x00\xc8\xcd\x04\x00\v\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xe8\x10\x00\x00classes.dex", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?E\x96\nD\xac\x01\x00\x00P\x03\x00\x00&\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:C\x02\x00res/layout/actionbar_set_wallpaper.xml", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?Ļ\x14\xe3\xd8\x01\x00\x00\xd8\x03\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00:E\x02\x00res/layout/wallpaper_cropper.xml", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?}\xc1\x15\x9eZ\x01\x00\x00!\x02\x00\x00\x14\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00`G\x02\x00META-INF/MANIFEST.MF", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?\xe6\x98Ьo\x01\x00\x00\x84\x02\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfcH\x02\x00META-INF/CERT.SF", - "PK\x01\x02\x14\x00\x14\x00\b\b\b\x004\x9d3?\xbfP\x96b\x86\x04\x00\x00\xb2\x06\x00\x00\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa9J\x02\x00META-INF/CERT.RSA", - } - for i, s := range dirEnts { - var f File - err := readDirectoryHeader(&f, strings.NewReader(s)) - if err != nil { - t.Errorf("error reading #%d: %v", i, err) - } - } -} - -// Verify we return ErrUnexpectedEOF when length is short. -func TestIssue10957(t *testing.T) { - data := []byte("PK\x03\x040000000PK\x01\x0200000" + - "0000000000000000000\x00" + - "\x00\x00\x00\x00\x00000000000000PK\x01" + - "\x020000000000000000000" + - "00000\v\x00\x00\x00\x00\x00000000000" + - "00000000000000PK\x01\x0200" + - "00000000000000000000" + - "00\v\x00\x00\x00\x00\x00000000000000" + - "00000000000PK\x01\x020000<" + - "0\x00\x0000000000000000\v\x00\v" + - "\x00\x00\x00\x00\x0000000000\x00\x00\x00\x00000" + - "00000000PK\x01\x0200000000" + - "0000000000000000\v\x00\x00\x00" + - "\x00\x0000PK\x05\x06000000\x05\x000000" + - "\v\x00\x00\x00\x00\x00") - z, err := NewReader(bytes.NewReader(data), int64(len(data))) - if err != nil { - t.Fatal(err) - } - for i, f := range z.File { - r, err := f.Open() - if err != nil { - continue - } - if f.UncompressedSize64 < 1e6 { - n, err := io.Copy(ioutil.Discard, r) - if i == 3 && err != io.ErrUnexpectedEOF { - t.Errorf("File[3] error = %v; want io.ErrUnexpectedEOF", err) - } - if err == nil && uint64(n) != f.UncompressedSize64 { - t.Errorf("file %d: bad size: copied=%d; want=%d", i, n, f.UncompressedSize64) - } - } - r.Close() - } -} - -// Verify the number of files is sane. -func TestIssue10956(t *testing.T) { - data := []byte("PK\x06\x06PK\x06\a0000\x00\x00\x00\x00\x00\x00\x00\x00" + - "0000PK\x05\x06000000000000" + - "0000\v\x00000\x00\x00\x00\x00\x00\x00\x000") - _, err := NewReader(bytes.NewReader(data), int64(len(data))) - const want = "TOC declares impossible 3472328296227680304 files in 57 byte" - if err == nil && !strings.Contains(err.Error(), want) { - t.Errorf("error = %v; want %q", err, want) - } -} - -// Verify we return ErrUnexpectedEOF when reading truncated data descriptor. -func TestIssue11146(t *testing.T) { - data := []byte("PK\x03\x040000000000000000" + - "000000\x01\x00\x00\x000\x01\x00\x00\xff\xff0000" + - "0000000000000000PK\x01\x02" + - "0000\b0\b\x00000000000000" + - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x000000PK\x05\x06\x00\x00" + - "\x00\x0000\x01\x0000008\x00\x00\x00\x00\x00") - z, err := NewReader(bytes.NewReader(data), int64(len(data))) - if err != nil { - t.Fatal(err) - } - r, err := z.File[0].Open() - if err != nil { - t.Fatal(err) - } - _, err = ioutil.ReadAll(r) - if err != io.ErrUnexpectedEOF { - t.Errorf("File[0] error = %v; want io.ErrUnexpectedEOF", err) - } - r.Close() -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/register.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/register.go deleted file mode 100644 index 4211ec7af7ba8ee56c5dcd194959230c5a000e07..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/register.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zip - -import ( - "compress/flate" - "errors" - "io" - "io/ioutil" - "sync" -) - -// A Compressor returns a compressing writer, writing to the -// provided writer. On Close, any pending data should be flushed. -type Compressor func(io.Writer) (io.WriteCloser, error) - -// Decompressor is a function that wraps a Reader with a decompressing Reader. -// The decompressed ReadCloser is returned to callers who open files from -// within the archive. These callers are responsible for closing this reader -// when they're finished reading. -type Decompressor func(io.Reader) io.ReadCloser - -var flateWriterPool sync.Pool - -func newFlateWriter(w io.Writer) io.WriteCloser { - fw, ok := flateWriterPool.Get().(*flate.Writer) - if ok { - fw.Reset(w) - } else { - fw, _ = flate.NewWriter(w, 5) - } - return &pooledFlateWriter{fw: fw} -} - -type pooledFlateWriter struct { - mu sync.Mutex // guards Close and Write - fw *flate.Writer -} - -func (w *pooledFlateWriter) Write(p []byte) (n int, err error) { - w.mu.Lock() - defer w.mu.Unlock() - if w.fw == nil { - return 0, errors.New("Write after Close") - } - return w.fw.Write(p) -} - -func (w *pooledFlateWriter) Close() error { - w.mu.Lock() - defer w.mu.Unlock() - var err error - if w.fw != nil { - err = w.fw.Close() - flateWriterPool.Put(w.fw) - w.fw = nil - } - return err -} - -var ( - mu sync.RWMutex // guards compressor and decompressor maps - - compressors = map[uint16]Compressor{ - Store: func(w io.Writer) (io.WriteCloser, error) { return &nopCloser{w}, nil }, - Deflate: func(w io.Writer) (io.WriteCloser, error) { return newFlateWriter(w), nil }, - } - - decompressors = map[uint16]Decompressor{ - Store: ioutil.NopCloser, - Deflate: flate.NewReader, - } -) - -// RegisterDecompressor allows custom decompressors for a specified method ID. -func RegisterDecompressor(method uint16, d Decompressor) { - mu.Lock() - defer mu.Unlock() - - if _, ok := decompressors[method]; ok { - panic("decompressor already registered") - } - decompressors[method] = d -} - -// RegisterCompressor registers custom compressors for a specified method ID. -// The common methods Store and Deflate are built in. -func RegisterCompressor(method uint16, comp Compressor) { - mu.Lock() - defer mu.Unlock() - - if _, ok := compressors[method]; ok { - panic("compressor already registered") - } - compressors[method] = comp -} - -func compressor(method uint16) Compressor { - mu.RLock() - defer mu.RUnlock() - return compressors[method] -} - -func decompressor(method uint16) Decompressor { - mu.RLock() - defer mu.RUnlock() - return decompressors[method] -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/struct.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/struct.go deleted file mode 100644 index 137d0495fd993439b32cc151a67be54017cb6270..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/struct.go +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package zip provides support for reading and writing ZIP archives. - -See: http://www.pkware.com/documents/casestudies/APPNOTE.TXT - -This package does not support disk spanning. - -A note about ZIP64: - -To be backwards compatible the FileHeader has both 32 and 64 bit Size -fields. The 64 bit fields will always contain the correct value and -for normal archives both fields will be the same. For files requiring -the ZIP64 format the 32 bit fields will be 0xffffffff and the 64 bit -fields must be used instead. -*/ -package zip - -import ( - "os" - "path" - "time" -) - -// Compression methods. -const ( - Store uint16 = 0 - Deflate uint16 = 8 -) - -const ( - fileHeaderSignature = 0x04034b50 - directoryHeaderSignature = 0x02014b50 - directoryEndSignature = 0x06054b50 - directory64LocSignature = 0x07064b50 - directory64EndSignature = 0x06064b50 - dataDescriptorSignature = 0x08074b50 // de-facto standard; required by OS X Finder - fileHeaderLen = 30 // + filename + extra - directoryHeaderLen = 46 // + filename + extra + comment - directoryEndLen = 22 // + comment - dataDescriptorLen = 16 // four uint32: descriptor signature, crc32, compressed size, size - dataDescriptor64Len = 24 // descriptor with 8 byte sizes - directory64LocLen = 20 // - directory64EndLen = 56 // + extra - - // Constants for the first byte in CreatorVersion - creatorFAT = 0 - creatorUnix = 3 - creatorNTFS = 11 - creatorVFAT = 14 - creatorMacOSX = 19 - - // version numbers - zipVersion20 = 20 // 2.0 - zipVersion45 = 45 // 4.5 (reads and writes zip64 archives) - - // limits for non zip64 files - uint16max = (1 << 16) - 1 - uint32max = (1 << 32) - 1 - - // extra header id's - zip64ExtraId = 0x0001 // zip64 Extended Information Extra Field -) - -// FileHeader describes a file within a zip file. -// See the zip spec for details. -type FileHeader struct { - // Name is the name of the file. - // It must be a relative path: it must not start with a drive - // letter (e.g. C:) or leading slash, and only forward slashes - // are allowed. - Name string - - CreatorVersion uint16 - ReaderVersion uint16 - Flags uint16 - Method uint16 - ModifiedTime uint16 // MS-DOS time - ModifiedDate uint16 // MS-DOS date - CRC32 uint32 - CompressedSize uint32 // Deprecated: Use CompressedSize64 instead. - UncompressedSize uint32 // Deprecated: Use UncompressedSize64 instead. - CompressedSize64 uint64 - UncompressedSize64 uint64 - Extra []byte - ExternalAttrs uint32 // Meaning depends on CreatorVersion - Comment string -} - -// FileInfo returns an os.FileInfo for the FileHeader. -func (h *FileHeader) FileInfo() os.FileInfo { - return headerFileInfo{h} -} - -// headerFileInfo implements os.FileInfo. -type headerFileInfo struct { - fh *FileHeader -} - -func (fi headerFileInfo) Name() string { return path.Base(fi.fh.Name) } -func (fi headerFileInfo) Size() int64 { - if fi.fh.UncompressedSize64 > 0 { - return int64(fi.fh.UncompressedSize64) - } - return int64(fi.fh.UncompressedSize) -} -func (fi headerFileInfo) IsDir() bool { return fi.Mode().IsDir() } -func (fi headerFileInfo) ModTime() time.Time { return fi.fh.ModTime() } -func (fi headerFileInfo) Mode() os.FileMode { return fi.fh.Mode() } -func (fi headerFileInfo) Sys() interface{} { return fi.fh } - -// FileInfoHeader creates a partially-populated FileHeader from an -// os.FileInfo. -// Because os.FileInfo's Name method returns only the base name of -// the file it describes, it may be necessary to modify the Name field -// of the returned header to provide the full path name of the file. -func FileInfoHeader(fi os.FileInfo) (*FileHeader, error) { - size := fi.Size() - fh := &FileHeader{ - Name: fi.Name(), - UncompressedSize64: uint64(size), - } - fh.SetModTime(fi.ModTime()) - fh.SetMode(fi.Mode()) - if fh.UncompressedSize64 > uint32max { - fh.UncompressedSize = uint32max - } else { - fh.UncompressedSize = uint32(fh.UncompressedSize64) - } - return fh, nil -} - -type directoryEnd struct { - diskNbr uint32 // unused - dirDiskNbr uint32 // unused - dirRecordsThisDisk uint64 // unused - directoryRecords uint64 - directorySize uint64 - directoryOffset uint64 // relative to file - commentLen uint16 - comment string -} - -// msDosTimeToTime converts an MS-DOS date and time into a time.Time. -// The resolution is 2s. -// See: http://msdn.microsoft.com/en-us/library/ms724247(v=VS.85).aspx -func msDosTimeToTime(dosDate, dosTime uint16) time.Time { - return time.Date( - // date bits 0-4: day of month; 5-8: month; 9-15: years since 1980 - int(dosDate>>9+1980), - time.Month(dosDate>>5&0xf), - int(dosDate&0x1f), - - // time bits 0-4: second/2; 5-10: minute; 11-15: hour - int(dosTime>>11), - int(dosTime>>5&0x3f), - int(dosTime&0x1f*2), - 0, // nanoseconds - - time.UTC, - ) -} - -// timeToMsDosTime converts a time.Time to an MS-DOS date and time. -// The resolution is 2s. -// See: http://msdn.microsoft.com/en-us/library/ms724274(v=VS.85).aspx -func timeToMsDosTime(t time.Time) (fDate uint16, fTime uint16) { - t = t.In(time.UTC) - fDate = uint16(t.Day() + int(t.Month())<<5 + (t.Year()-1980)<<9) - fTime = uint16(t.Second()/2 + t.Minute()<<5 + t.Hour()<<11) - return -} - -// ModTime returns the modification time in UTC. -// The resolution is 2s. -func (h *FileHeader) ModTime() time.Time { - return msDosTimeToTime(h.ModifiedDate, h.ModifiedTime) -} - -// SetModTime sets the ModifiedTime and ModifiedDate fields to the given time in UTC. -// The resolution is 2s. -func (h *FileHeader) SetModTime(t time.Time) { - h.ModifiedDate, h.ModifiedTime = timeToMsDosTime(t) -} - -const ( - // Unix constants. The specification doesn't mention them, - // but these seem to be the values agreed on by tools. - s_IFMT = 0xf000 - s_IFSOCK = 0xc000 - s_IFLNK = 0xa000 - s_IFREG = 0x8000 - s_IFBLK = 0x6000 - s_IFDIR = 0x4000 - s_IFCHR = 0x2000 - s_IFIFO = 0x1000 - s_ISUID = 0x800 - s_ISGID = 0x400 - s_ISVTX = 0x200 - - msdosDir = 0x10 - msdosReadOnly = 0x01 -) - -// Mode returns the permission and mode bits for the FileHeader. -func (h *FileHeader) Mode() (mode os.FileMode) { - switch h.CreatorVersion >> 8 { - case creatorUnix, creatorMacOSX: - mode = unixModeToFileMode(h.ExternalAttrs >> 16) - case creatorNTFS, creatorVFAT, creatorFAT: - mode = msdosModeToFileMode(h.ExternalAttrs) - } - if len(h.Name) > 0 && h.Name[len(h.Name)-1] == '/' { - mode |= os.ModeDir - } - return mode -} - -// SetMode changes the permission and mode bits for the FileHeader. -func (h *FileHeader) SetMode(mode os.FileMode) { - h.CreatorVersion = h.CreatorVersion&0xff | creatorUnix<<8 - h.ExternalAttrs = fileModeToUnixMode(mode) << 16 - - // set MSDOS attributes too, as the original zip does. - if mode&os.ModeDir != 0 { - h.ExternalAttrs |= msdosDir - } - if mode&0200 == 0 { - h.ExternalAttrs |= msdosReadOnly - } -} - -// isZip64 reports whether the file size exceeds the 32 bit limit -func (fh *FileHeader) isZip64() bool { - return fh.CompressedSize64 > uint32max || fh.UncompressedSize64 > uint32max -} - -func msdosModeToFileMode(m uint32) (mode os.FileMode) { - if m&msdosDir != 0 { - mode = os.ModeDir | 0777 - } else { - mode = 0666 - } - if m&msdosReadOnly != 0 { - mode &^= 0222 - } - return mode -} - -func fileModeToUnixMode(mode os.FileMode) uint32 { - var m uint32 - switch mode & os.ModeType { - default: - m = s_IFREG - case os.ModeDir: - m = s_IFDIR - case os.ModeSymlink: - m = s_IFLNK - case os.ModeNamedPipe: - m = s_IFIFO - case os.ModeSocket: - m = s_IFSOCK - case os.ModeDevice: - if mode&os.ModeCharDevice != 0 { - m = s_IFCHR - } else { - m = s_IFBLK - } - } - if mode&os.ModeSetuid != 0 { - m |= s_ISUID - } - if mode&os.ModeSetgid != 0 { - m |= s_ISGID - } - if mode&os.ModeSticky != 0 { - m |= s_ISVTX - } - return m | uint32(mode&0777) -} - -func unixModeToFileMode(m uint32) os.FileMode { - mode := os.FileMode(m & 0777) - switch m & s_IFMT { - case s_IFBLK: - mode |= os.ModeDevice - case s_IFCHR: - mode |= os.ModeDevice | os.ModeCharDevice - case s_IFDIR: - mode |= os.ModeDir - case s_IFIFO: - mode |= os.ModeNamedPipe - case s_IFLNK: - mode |= os.ModeSymlink - case s_IFREG: - // nothing to do - case s_IFSOCK: - mode |= os.ModeSocket - } - if m&s_ISGID != 0 { - mode |= os.ModeSetgid - } - if m&s_ISUID != 0 { - mode |= os.ModeSetuid - } - if m&s_ISVTX != 0 { - mode |= os.ModeSticky - } - return mode -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/crc32-not-streamed.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/crc32-not-streamed.zip deleted file mode 100644 index f268d88732f837723525285c0922231d9c3fcb46..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/crc32-not-streamed.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/dd.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/dd.zip deleted file mode 100644 index e53378b0b0e56203a08c139b83c67a9b918c0b81..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/dd.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-no-datadesc-sig.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-no-datadesc-sig.zip deleted file mode 100644 index c3d593f44f988ab96b59549096903a5c7f7a10d2..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-no-datadesc-sig.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-with-datadesc-sig.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-with-datadesc-sig.zip deleted file mode 100644 index bcfe121bb63c79be6849ca64589feea612015512..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/go-with-datadesc-sig.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/gophercolor16x16.png b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/gophercolor16x16.png deleted file mode 100644 index 48854ff3b7225c8b4e8aa8a25754e1d0b7c77b6e..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/gophercolor16x16.png and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.notzip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.notzip deleted file mode 100644 index 81737275c6ebf5ea69b992753ab4050f031f31b8..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.notzip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.zip deleted file mode 100644 index 5642a67e77d5f5a45c92ea701801ae0b993f4724..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/readme.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/symlink.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/symlink.zip deleted file mode 100644 index af846938cde293ccc3dfb310fdfbda641382dd3f..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/symlink.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test-trailing-junk.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test-trailing-junk.zip deleted file mode 100644 index 42281b4e3053eec7924b58d234d04e492c3baa38..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test-trailing-junk.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test.zip deleted file mode 100644 index 03890c05d4c12196086a99b7f6f51276156b4394..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/test.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/unix.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/unix.zip deleted file mode 100644 index ce1a981b2806d7e7a4026383622bf033aac426a4..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/unix.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/winxp.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/winxp.zip deleted file mode 100644 index 3919322f0c5f8be8f1a214af712b6e86b4d04aef..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/winxp.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64-2.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64-2.zip deleted file mode 100644 index f844e35373e8a28289f8556032bc8d6f6ee92ec2..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64-2.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64.zip b/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64.zip deleted file mode 100644 index a2ee1fa33dca48e1ec8dfc7507640bfa09bddeb6..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/archive/zip/testdata/zip64.zip and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/writer.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/writer.go deleted file mode 100644 index 3be2b5fdb2f29417c0e9b384407fc56cad6bdc3e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/writer.go +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zip - -import ( - "bufio" - "encoding/binary" - "errors" - "hash" - "hash/crc32" - "io" -) - -// TODO(adg): support zip file comments -// TODO(adg): support specifying deflate level - -// Writer implements a zip file writer. -type Writer struct { - cw *countWriter - dir []*header - last *fileWriter - closed bool -} - -type header struct { - *FileHeader - offset uint64 -} - -// NewWriter returns a new Writer writing a zip file to w. -func NewWriter(w io.Writer) *Writer { - return &Writer{cw: &countWriter{w: bufio.NewWriter(w)}} -} - -// SetOffset sets the offset of the beginning of the zip data within the -// underlying writer. It should be used when the zip data is appended to an -// existing file, such as a binary executable. -// It must be called before any data is written. -func (w *Writer) SetOffset(n int64) { - if w.cw.count != 0 { - panic("zip: SetOffset called after data was written") - } - w.cw.count = n -} - -// Flush flushes any buffered data to the underlying writer. -// Calling Flush is not normally necessary; calling Close is sufficient. -func (w *Writer) Flush() error { - return w.cw.w.(*bufio.Writer).Flush() -} - -// Close finishes writing the zip file by writing the central directory. -// It does not (and can not) close the underlying writer. -func (w *Writer) Close() error { - if w.last != nil && !w.last.closed { - if err := w.last.close(); err != nil { - return err - } - w.last = nil - } - if w.closed { - return errors.New("zip: writer closed twice") - } - w.closed = true - - // write central directory - start := w.cw.count - for _, h := range w.dir { - var buf [directoryHeaderLen]byte - b := writeBuf(buf[:]) - b.uint32(uint32(directoryHeaderSignature)) - b.uint16(h.CreatorVersion) - b.uint16(h.ReaderVersion) - b.uint16(h.Flags) - b.uint16(h.Method) - b.uint16(h.ModifiedTime) - b.uint16(h.ModifiedDate) - b.uint32(h.CRC32) - if h.isZip64() || h.offset > uint32max { - // the file needs a zip64 header. store maxint in both - // 32 bit size fields (and offset later) to signal that the - // zip64 extra header should be used. - b.uint32(uint32max) // compressed size - b.uint32(uint32max) // uncompressed size - - // append a zip64 extra block to Extra - var buf [28]byte // 2x uint16 + 3x uint64 - eb := writeBuf(buf[:]) - eb.uint16(zip64ExtraId) - eb.uint16(24) // size = 3x uint64 - eb.uint64(h.UncompressedSize64) - eb.uint64(h.CompressedSize64) - eb.uint64(h.offset) - h.Extra = append(h.Extra, buf[:]...) - } else { - b.uint32(h.CompressedSize) - b.uint32(h.UncompressedSize) - } - b.uint16(uint16(len(h.Name))) - b.uint16(uint16(len(h.Extra))) - b.uint16(uint16(len(h.Comment))) - b = b[4:] // skip disk number start and internal file attr (2x uint16) - b.uint32(h.ExternalAttrs) - if h.offset > uint32max { - b.uint32(uint32max) - } else { - b.uint32(uint32(h.offset)) - } - if _, err := w.cw.Write(buf[:]); err != nil { - return err - } - if _, err := io.WriteString(w.cw, h.Name); err != nil { - return err - } - if _, err := w.cw.Write(h.Extra); err != nil { - return err - } - if _, err := io.WriteString(w.cw, h.Comment); err != nil { - return err - } - } - end := w.cw.count - - records := uint64(len(w.dir)) - size := uint64(end - start) - offset := uint64(start) - - if records > uint16max || size > uint32max || offset > uint32max { - var buf [directory64EndLen + directory64LocLen]byte - b := writeBuf(buf[:]) - - // zip64 end of central directory record - b.uint32(directory64EndSignature) - b.uint64(directory64EndLen - 12) // length minus signature (uint32) and length fields (uint64) - b.uint16(zipVersion45) // version made by - b.uint16(zipVersion45) // version needed to extract - b.uint32(0) // number of this disk - b.uint32(0) // number of the disk with the start of the central directory - b.uint64(records) // total number of entries in the central directory on this disk - b.uint64(records) // total number of entries in the central directory - b.uint64(size) // size of the central directory - b.uint64(offset) // offset of start of central directory with respect to the starting disk number - - // zip64 end of central directory locator - b.uint32(directory64LocSignature) - b.uint32(0) // number of the disk with the start of the zip64 end of central directory - b.uint64(uint64(end)) // relative offset of the zip64 end of central directory record - b.uint32(1) // total number of disks - - if _, err := w.cw.Write(buf[:]); err != nil { - return err - } - - // store max values in the regular end record to signal that - // that the zip64 values should be used instead - records = uint16max - size = uint32max - offset = uint32max - } - - // write end record - var buf [directoryEndLen]byte - b := writeBuf(buf[:]) - b.uint32(uint32(directoryEndSignature)) - b = b[4:] // skip over disk number and first disk number (2x uint16) - b.uint16(uint16(records)) // number of entries this disk - b.uint16(uint16(records)) // number of entries total - b.uint32(uint32(size)) // size of directory - b.uint32(uint32(offset)) // start of directory - // skipped size of comment (always zero) - if _, err := w.cw.Write(buf[:]); err != nil { - return err - } - - return w.cw.w.(*bufio.Writer).Flush() -} - -// Create adds a file to the zip file using the provided name. -// It returns a Writer to which the file contents should be written. -// The name must be a relative path: it must not start with a drive -// letter (e.g. C:) or leading slash, and only forward slashes are -// allowed. -// The file's contents must be written to the io.Writer before the next -// call to Create, CreateHeader, or Close. -func (w *Writer) Create(name string) (io.Writer, error) { - header := &FileHeader{ - Name: name, - Method: Deflate, - } - return w.CreateHeader(header) -} - -// CreateHeader adds a file to the zip file using the provided FileHeader -// for the file metadata. -// It returns a Writer to which the file contents should be written. -// -// The file's contents must be written to the io.Writer before the next -// call to Create, CreateHeader, or Close. The provided FileHeader fh -// must not be modified after a call to CreateHeader. -func (w *Writer) CreateHeader(fh *FileHeader) (io.Writer, error) { - if w.last != nil && !w.last.closed { - if err := w.last.close(); err != nil { - return nil, err - } - } - if len(w.dir) > 0 && w.dir[len(w.dir)-1].FileHeader == fh { - // See https://golang.org/issue/11144 confusion. - return nil, errors.New("archive/zip: invalid duplicate FileHeader") - } - - fh.Flags |= 0x8 // we will write a data descriptor - - fh.CreatorVersion = fh.CreatorVersion&0xff00 | zipVersion20 // preserve compatibility byte - fh.ReaderVersion = zipVersion20 - - fw := &fileWriter{ - zipw: w.cw, - compCount: &countWriter{w: w.cw}, - crc32: crc32.NewIEEE(), - } - comp := compressor(fh.Method) - if comp == nil { - return nil, ErrAlgorithm - } - var err error - fw.comp, err = comp(fw.compCount) - if err != nil { - return nil, err - } - fw.rawCount = &countWriter{w: fw.comp} - - h := &header{ - FileHeader: fh, - offset: uint64(w.cw.count), - } - w.dir = append(w.dir, h) - fw.header = h - - if err := writeHeader(w.cw, fh); err != nil { - return nil, err - } - - w.last = fw - return fw, nil -} - -func writeHeader(w io.Writer, h *FileHeader) error { - var buf [fileHeaderLen]byte - b := writeBuf(buf[:]) - b.uint32(uint32(fileHeaderSignature)) - b.uint16(h.ReaderVersion) - b.uint16(h.Flags) - b.uint16(h.Method) - b.uint16(h.ModifiedTime) - b.uint16(h.ModifiedDate) - b.uint32(0) // since we are writing a data descriptor crc32, - b.uint32(0) // compressed size, - b.uint32(0) // and uncompressed size should be zero - b.uint16(uint16(len(h.Name))) - b.uint16(uint16(len(h.Extra))) - if _, err := w.Write(buf[:]); err != nil { - return err - } - if _, err := io.WriteString(w, h.Name); err != nil { - return err - } - _, err := w.Write(h.Extra) - return err -} - -type fileWriter struct { - *header - zipw io.Writer - rawCount *countWriter - comp io.WriteCloser - compCount *countWriter - crc32 hash.Hash32 - closed bool -} - -func (w *fileWriter) Write(p []byte) (int, error) { - if w.closed { - return 0, errors.New("zip: write to closed file") - } - w.crc32.Write(p) - return w.rawCount.Write(p) -} - -func (w *fileWriter) close() error { - if w.closed { - return errors.New("zip: file closed twice") - } - w.closed = true - if err := w.comp.Close(); err != nil { - return err - } - - // update FileHeader - fh := w.header.FileHeader - fh.CRC32 = w.crc32.Sum32() - fh.CompressedSize64 = uint64(w.compCount.count) - fh.UncompressedSize64 = uint64(w.rawCount.count) - - if fh.isZip64() { - fh.CompressedSize = uint32max - fh.UncompressedSize = uint32max - fh.ReaderVersion = zipVersion45 // requires 4.5 - File uses ZIP64 format extensions - } else { - fh.CompressedSize = uint32(fh.CompressedSize64) - fh.UncompressedSize = uint32(fh.UncompressedSize64) - } - - // Write data descriptor. This is more complicated than one would - // think, see e.g. comments in zipfile.c:putextended() and - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7073588. - // The approach here is to write 8 byte sizes if needed without - // adding a zip64 extra in the local header (too late anyway). - var buf []byte - if fh.isZip64() { - buf = make([]byte, dataDescriptor64Len) - } else { - buf = make([]byte, dataDescriptorLen) - } - b := writeBuf(buf) - b.uint32(dataDescriptorSignature) // de-facto standard, required by OS X - b.uint32(fh.CRC32) - if fh.isZip64() { - b.uint64(fh.CompressedSize64) - b.uint64(fh.UncompressedSize64) - } else { - b.uint32(fh.CompressedSize) - b.uint32(fh.UncompressedSize) - } - _, err := w.zipw.Write(buf) - return err -} - -type countWriter struct { - w io.Writer - count int64 -} - -func (w *countWriter) Write(p []byte) (int, error) { - n, err := w.w.Write(p) - w.count += int64(n) - return n, err -} - -type nopCloser struct { - io.Writer -} - -func (w nopCloser) Close() error { - return nil -} - -type writeBuf []byte - -func (b *writeBuf) uint16(v uint16) { - binary.LittleEndian.PutUint16(*b, v) - *b = (*b)[2:] -} - -func (b *writeBuf) uint32(v uint32) { - binary.LittleEndian.PutUint32(*b, v) - *b = (*b)[4:] -} - -func (b *writeBuf) uint64(v uint64) { - binary.LittleEndian.PutUint64(*b, v) - *b = (*b)[8:] -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/writer_test.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/writer_test.go deleted file mode 100644 index 01b63f2358d41c258baf08b1f5206b11f41dfcc9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/writer_test.go +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zip - -import ( - "bytes" - "io" - "io/ioutil" - "math/rand" - "os" - "testing" -) - -// TODO(adg): a more sophisticated test suite - -type WriteTest struct { - Name string - Data []byte - Method uint16 - Mode os.FileMode -} - -var writeTests = []WriteTest{ - { - Name: "foo", - Data: []byte("Rabbits, guinea pigs, gophers, marsupial rats, and quolls."), - Method: Store, - Mode: 0666, - }, - { - Name: "bar", - Data: nil, // large data set in the test - Method: Deflate, - Mode: 0644, - }, - { - Name: "setuid", - Data: []byte("setuid file"), - Method: Deflate, - Mode: 0755 | os.ModeSetuid, - }, - { - Name: "setgid", - Data: []byte("setgid file"), - Method: Deflate, - Mode: 0755 | os.ModeSetgid, - }, - { - Name: "symlink", - Data: []byte("../link/target"), - Method: Deflate, - Mode: 0755 | os.ModeSymlink, - }, -} - -func TestWriter(t *testing.T) { - largeData := make([]byte, 1<<17) - for i := range largeData { - largeData[i] = byte(rand.Int()) - } - writeTests[1].Data = largeData - defer func() { - writeTests[1].Data = nil - }() - - // write a zip file - buf := new(bytes.Buffer) - w := NewWriter(buf) - - for _, wt := range writeTests { - testCreate(t, w, &wt) - } - - if err := w.Close(); err != nil { - t.Fatal(err) - } - - // read it back - r, err := NewReader(bytes.NewReader(buf.Bytes()), int64(buf.Len())) - if err != nil { - t.Fatal(err) - } - for i, wt := range writeTests { - testReadFile(t, r.File[i], &wt) - } -} - -func TestWriterOffset(t *testing.T) { - largeData := make([]byte, 1<<17) - for i := range largeData { - largeData[i] = byte(rand.Int()) - } - writeTests[1].Data = largeData - defer func() { - writeTests[1].Data = nil - }() - - // write a zip file - buf := new(bytes.Buffer) - existingData := []byte{1, 2, 3, 1, 2, 3, 1, 2, 3} - n, _ := buf.Write(existingData) - w := NewWriter(buf) - w.SetOffset(int64(n)) - - for _, wt := range writeTests { - testCreate(t, w, &wt) - } - - if err := w.Close(); err != nil { - t.Fatal(err) - } - - // read it back - r, err := NewReader(bytes.NewReader(buf.Bytes()), int64(buf.Len())) - if err != nil { - t.Fatal(err) - } - for i, wt := range writeTests { - testReadFile(t, r.File[i], &wt) - } -} - -func TestWriterFlush(t *testing.T) { - var buf bytes.Buffer - w := NewWriter(struct{ io.Writer }{&buf}) - _, err := w.Create("foo") - if err != nil { - t.Fatal(err) - } - if buf.Len() > 0 { - t.Fatalf("Unexpected %d bytes already in buffer", buf.Len()) - } - if err := w.Flush(); err != nil { - t.Fatal(err) - } - if buf.Len() == 0 { - t.Fatal("No bytes written after Flush") - } -} - -func testCreate(t *testing.T, w *Writer, wt *WriteTest) { - header := &FileHeader{ - Name: wt.Name, - Method: wt.Method, - } - if wt.Mode != 0 { - header.SetMode(wt.Mode) - } - f, err := w.CreateHeader(header) - if err != nil { - t.Fatal(err) - } - _, err = f.Write(wt.Data) - if err != nil { - t.Fatal(err) - } -} - -func testReadFile(t *testing.T, f *File, wt *WriteTest) { - if f.Name != wt.Name { - t.Fatalf("File name: got %q, want %q", f.Name, wt.Name) - } - testFileMode(t, wt.Name, f, wt.Mode) - rc, err := f.Open() - if err != nil { - t.Fatal("opening:", err) - } - b, err := ioutil.ReadAll(rc) - if err != nil { - t.Fatal("reading:", err) - } - err = rc.Close() - if err != nil { - t.Fatal("closing:", err) - } - if !bytes.Equal(b, wt.Data) { - t.Errorf("File contents %q, want %q", b, wt.Data) - } -} - -func BenchmarkCompressedZipGarbage(b *testing.B) { - b.ReportAllocs() - var buf bytes.Buffer - bigBuf := bytes.Repeat([]byte("a"), 1<<20) - for i := 0; i < b.N; i++ { - buf.Reset() - zw := NewWriter(&buf) - for j := 0; j < 3; j++ { - w, _ := zw.CreateHeader(&FileHeader{ - Name: "foo", - Method: Deflate, - }) - w.Write(bigBuf) - } - zw.Close() - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/archive/zip/zip_test.go b/llgo/third_party/gofrontend/libgo/go/archive/zip/zip_test.go deleted file mode 100644 index f00ff47d37ecb29d0fa89cb303a6a17f01cdb812..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/archive/zip/zip_test.go +++ /dev/null @@ -1,427 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests that involve both reading and writing. - -package zip - -import ( - "bytes" - "fmt" - "hash" - "io" - "io/ioutil" - "sort" - "strings" - "testing" - "time" -) - -func TestOver65kFiles(t *testing.T) { - buf := new(bytes.Buffer) - w := NewWriter(buf) - const nFiles = (1 << 16) + 42 - for i := 0; i < nFiles; i++ { - _, err := w.CreateHeader(&FileHeader{ - Name: fmt.Sprintf("%d.dat", i), - Method: Store, // avoid Issue 6136 and Issue 6138 - }) - if err != nil { - t.Fatalf("creating file %d: %v", i, err) - } - } - if err := w.Close(); err != nil { - t.Fatalf("Writer.Close: %v", err) - } - s := buf.String() - zr, err := NewReader(strings.NewReader(s), int64(len(s))) - if err != nil { - t.Fatalf("NewReader: %v", err) - } - if got := len(zr.File); got != nFiles { - t.Fatalf("File contains %d files, want %d", got, nFiles) - } - for i := 0; i < nFiles; i++ { - want := fmt.Sprintf("%d.dat", i) - if zr.File[i].Name != want { - t.Fatalf("File(%d) = %q, want %q", i, zr.File[i].Name, want) - } - } -} - -func TestModTime(t *testing.T) { - var testTime = time.Date(2009, time.November, 10, 23, 45, 58, 0, time.UTC) - fh := new(FileHeader) - fh.SetModTime(testTime) - outTime := fh.ModTime() - if !outTime.Equal(testTime) { - t.Errorf("times don't match: got %s, want %s", outTime, testTime) - } -} - -func testHeaderRoundTrip(fh *FileHeader, wantUncompressedSize uint32, wantUncompressedSize64 uint64, t *testing.T) { - fi := fh.FileInfo() - fh2, err := FileInfoHeader(fi) - if err != nil { - t.Fatal(err) - } - if got, want := fh2.Name, fh.Name; got != want { - t.Errorf("Name: got %s, want %s\n", got, want) - } - if got, want := fh2.UncompressedSize, wantUncompressedSize; got != want { - t.Errorf("UncompressedSize: got %d, want %d\n", got, want) - } - if got, want := fh2.UncompressedSize64, wantUncompressedSize64; got != want { - t.Errorf("UncompressedSize64: got %d, want %d\n", got, want) - } - if got, want := fh2.ModifiedTime, fh.ModifiedTime; got != want { - t.Errorf("ModifiedTime: got %d, want %d\n", got, want) - } - if got, want := fh2.ModifiedDate, fh.ModifiedDate; got != want { - t.Errorf("ModifiedDate: got %d, want %d\n", got, want) - } - - if sysfh, ok := fi.Sys().(*FileHeader); !ok && sysfh != fh { - t.Errorf("Sys didn't return original *FileHeader") - } -} - -func TestFileHeaderRoundTrip(t *testing.T) { - fh := &FileHeader{ - Name: "foo.txt", - UncompressedSize: 987654321, - ModifiedTime: 1234, - ModifiedDate: 5678, - } - testHeaderRoundTrip(fh, fh.UncompressedSize, uint64(fh.UncompressedSize), t) -} - -func TestFileHeaderRoundTrip64(t *testing.T) { - fh := &FileHeader{ - Name: "foo.txt", - UncompressedSize64: 9876543210, - ModifiedTime: 1234, - ModifiedDate: 5678, - } - testHeaderRoundTrip(fh, uint32max, fh.UncompressedSize64, t) -} - -type repeatedByte struct { - off int64 - b byte - n int64 -} - -// rleBuffer is a run-length-encoded byte buffer. -// It's an io.Writer (like a bytes.Buffer) and also an io.ReaderAt, -// allowing random-access reads. -type rleBuffer struct { - buf []repeatedByte -} - -func (r *rleBuffer) Size() int64 { - if len(r.buf) == 0 { - return 0 - } - last := &r.buf[len(r.buf)-1] - return last.off + last.n -} - -func (r *rleBuffer) Write(p []byte) (n int, err error) { - var rp *repeatedByte - if len(r.buf) > 0 { - rp = &r.buf[len(r.buf)-1] - // Fast path, if p is entirely the same byte repeated. - if lastByte := rp.b; len(p) > 0 && p[0] == lastByte { - all := true - for _, b := range p { - if b != lastByte { - all = false - break - } - } - if all { - rp.n += int64(len(p)) - return len(p), nil - } - } - } - - for _, b := range p { - if rp == nil || rp.b != b { - r.buf = append(r.buf, repeatedByte{r.Size(), b, 1}) - rp = &r.buf[len(r.buf)-1] - } else { - rp.n++ - } - } - return len(p), nil -} - -func (r *rleBuffer) ReadAt(p []byte, off int64) (n int, err error) { - if len(p) == 0 { - return - } - skipParts := sort.Search(len(r.buf), func(i int) bool { - part := &r.buf[i] - return part.off+part.n > off - }) - parts := r.buf[skipParts:] - if len(parts) > 0 { - skipBytes := off - parts[0].off - for len(parts) > 0 { - part := parts[0] - for i := skipBytes; i < part.n; i++ { - if n == len(p) { - return - } - p[n] = part.b - n++ - } - parts = parts[1:] - skipBytes = 0 - } - } - if n != len(p) { - err = io.ErrUnexpectedEOF - } - return -} - -// Just testing the rleBuffer used in the Zip64 test above. Not used by the zip code. -func TestRLEBuffer(t *testing.T) { - b := new(rleBuffer) - var all []byte - writes := []string{"abcdeee", "eeeeeee", "eeeefghaaiii"} - for _, w := range writes { - b.Write([]byte(w)) - all = append(all, w...) - } - if len(b.buf) != 10 { - t.Fatalf("len(b.buf) = %d; want 10", len(b.buf)) - } - - for i := 0; i < len(all); i++ { - for j := 0; j < len(all)-i; j++ { - buf := make([]byte, j) - n, err := b.ReadAt(buf, int64(i)) - if err != nil || n != len(buf) { - t.Errorf("ReadAt(%d, %d) = %d, %v; want %d, nil", i, j, n, err, len(buf)) - } - if !bytes.Equal(buf, all[i:i+j]) { - t.Errorf("ReadAt(%d, %d) = %q; want %q", i, j, buf, all[i:i+j]) - } - } - } -} - -// fakeHash32 is a dummy Hash32 that always returns 0. -type fakeHash32 struct { - hash.Hash32 -} - -func (fakeHash32) Write(p []byte) (int, error) { return len(p), nil } -func (fakeHash32) Sum32() uint32 { return 0 } - -func TestZip64(t *testing.T) { - if testing.Short() { - t.Skip("slow test; skipping") - } - const size = 1 << 32 // before the "END\n" part - buf := testZip64(t, size) - testZip64DirectoryRecordLength(buf, t) -} - -func testZip64(t testing.TB, size int64) *rleBuffer { - const chunkSize = 1024 - chunks := int(size / chunkSize) - // write 2^32 bytes plus "END\n" to a zip file - buf := new(rleBuffer) - w := NewWriter(buf) - f, err := w.CreateHeader(&FileHeader{ - Name: "huge.txt", - Method: Store, - }) - if err != nil { - t.Fatal(err) - } - f.(*fileWriter).crc32 = fakeHash32{} - chunk := make([]byte, chunkSize) - for i := range chunk { - chunk[i] = '.' - } - for i := 0; i < chunks; i++ { - _, err := f.Write(chunk) - if err != nil { - t.Fatal("write chunk:", err) - } - } - end := []byte("END\n") - _, err = f.Write(end) - if err != nil { - t.Fatal("write end:", err) - } - if err := w.Close(); err != nil { - t.Fatal(err) - } - - // read back zip file and check that we get to the end of it - r, err := NewReader(buf, int64(buf.Size())) - if err != nil { - t.Fatal("reader:", err) - } - f0 := r.File[0] - rc, err := f0.Open() - if err != nil { - t.Fatal("opening:", err) - } - rc.(*checksumReader).hash = fakeHash32{} - for i := 0; i < chunks; i++ { - _, err := io.ReadFull(rc, chunk) - if err != nil { - t.Fatal("read:", err) - } - } - gotEnd, err := ioutil.ReadAll(rc) - if err != nil { - t.Fatal("read end:", err) - } - if !bytes.Equal(gotEnd, end) { - t.Errorf("End of zip64 archive %q, want %q", gotEnd, end) - } - err = rc.Close() - if err != nil { - t.Fatal("closing:", err) - } - if size == 1<<32 { - if got, want := f0.UncompressedSize, uint32(uint32max); got != want { - t.Errorf("UncompressedSize %d, want %d", got, want) - } - } - - if got, want := f0.UncompressedSize64, uint64(size)+uint64(len(end)); got != want { - t.Errorf("UncompressedSize64 %d, want %d", got, want) - } - - return buf -} - -// Issue 9857 -func testZip64DirectoryRecordLength(buf *rleBuffer, t *testing.T) { - d := make([]byte, 1024) - if _, err := buf.ReadAt(d, buf.Size()-int64(len(d))); err != nil { - t.Fatal("read:", err) - } - - sigOff := findSignatureInBlock(d) - dirOff, err := findDirectory64End(buf, buf.Size()-int64(len(d))+int64(sigOff)) - if err != nil { - t.Fatal("findDirectory64End:", err) - } - - d = make([]byte, directory64EndLen) - if _, err := buf.ReadAt(d, dirOff); err != nil { - t.Fatal("read:", err) - } - - b := readBuf(d) - if sig := b.uint32(); sig != directory64EndSignature { - t.Fatalf("Expected directory64EndSignature (%d), got %d", directory64EndSignature, sig) - } - - size := b.uint64() - if size != directory64EndLen-12 { - t.Fatalf("Expected length of %d, got %d", directory64EndLen-12, size) - } -} - -func testInvalidHeader(h *FileHeader, t *testing.T) { - var buf bytes.Buffer - z := NewWriter(&buf) - - f, err := z.CreateHeader(h) - if err != nil { - t.Fatalf("error creating header: %v", err) - } - if _, err := f.Write([]byte("hi")); err != nil { - t.Fatalf("error writing content: %v", err) - } - if err := z.Close(); err != nil { - t.Fatalf("error closing zip writer: %v", err) - } - - b := buf.Bytes() - if _, err = NewReader(bytes.NewReader(b), int64(len(b))); err != ErrFormat { - t.Fatalf("got %v, expected ErrFormat", err) - } -} - -func testValidHeader(h *FileHeader, t *testing.T) { - var buf bytes.Buffer - z := NewWriter(&buf) - - f, err := z.CreateHeader(h) - if err != nil { - t.Fatalf("error creating header: %v", err) - } - if _, err := f.Write([]byte("hi")); err != nil { - t.Fatalf("error writing content: %v", err) - } - if err := z.Close(); err != nil { - t.Fatalf("error closing zip writer: %v", err) - } - - b := buf.Bytes() - if _, err = NewReader(bytes.NewReader(b), int64(len(b))); err != nil { - t.Fatalf("got %v, expected nil", err) - } -} - -// Issue 4302. -func TestHeaderInvalidTagAndSize(t *testing.T) { - const timeFormat = "20060102T150405.000.txt" - - ts := time.Now() - filename := ts.Format(timeFormat) - - h := FileHeader{ - Name: filename, - Method: Deflate, - Extra: []byte(ts.Format(time.RFC3339Nano)), // missing tag and len - } - h.SetModTime(ts) - - testInvalidHeader(&h, t) -} - -func TestHeaderTooShort(t *testing.T) { - h := FileHeader{ - Name: "foo.txt", - Method: Deflate, - Extra: []byte{zip64ExtraId}, // missing size - } - testInvalidHeader(&h, t) -} - -// Issue 4393. It is valid to have an extra data header -// which contains no body. -func TestZeroLengthHeader(t *testing.T) { - h := FileHeader{ - Name: "extadata.txt", - Method: Deflate, - Extra: []byte{ - 85, 84, 5, 0, 3, 154, 144, 195, 77, // tag 21589 size 5 - 85, 120, 0, 0, // tag 30805 size 0 - }, - } - testValidHeader(&h, t) -} - -// Just benchmarking how fast the Zip64 test above is. Not related to -// our zip performance, since the test above disabled CRC32 and flate. -func BenchmarkZip64Test(b *testing.B) { - for i := 0; i < b.N; i++ { - testZip64(b, 1<<26) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/bufio.go b/llgo/third_party/gofrontend/libgo/go/bufio/bufio.go deleted file mode 100644 index 3bbb933df3569886ade4c370144d08ae63101c86..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/bufio.go +++ /dev/null @@ -1,730 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package bufio implements buffered I/O. It wraps an io.Reader or io.Writer -// object, creating another object (Reader or Writer) that also implements -// the interface but provides buffering and some help for textual I/O. -package bufio - -import ( - "bytes" - "errors" - "io" - "unicode/utf8" -) - -const ( - defaultBufSize = 4096 -) - -var ( - ErrInvalidUnreadByte = errors.New("bufio: invalid use of UnreadByte") - ErrInvalidUnreadRune = errors.New("bufio: invalid use of UnreadRune") - ErrBufferFull = errors.New("bufio: buffer full") - ErrNegativeCount = errors.New("bufio: negative count") -) - -// Buffered input. - -// Reader implements buffering for an io.Reader object. -type Reader struct { - buf []byte - rd io.Reader // reader provided by the client - r, w int // buf read and write positions - err error - lastByte int - lastRuneSize int -} - -const minReadBufferSize = 16 -const maxConsecutiveEmptyReads = 100 - -// NewReaderSize returns a new Reader whose buffer has at least the specified -// size. If the argument io.Reader is already a Reader with large enough -// size, it returns the underlying Reader. -func NewReaderSize(rd io.Reader, size int) *Reader { - // Is it already a Reader? - b, ok := rd.(*Reader) - if ok && len(b.buf) >= size { - return b - } - if size < minReadBufferSize { - size = minReadBufferSize - } - r := new(Reader) - r.reset(make([]byte, size), rd) - return r -} - -// NewReader returns a new Reader whose buffer has the default size. -func NewReader(rd io.Reader) *Reader { - return NewReaderSize(rd, defaultBufSize) -} - -// Reset discards any buffered data, resets all state, and switches -// the buffered reader to read from r. -func (b *Reader) Reset(r io.Reader) { - b.reset(b.buf, r) -} - -func (b *Reader) reset(buf []byte, r io.Reader) { - *b = Reader{ - buf: buf, - rd: r, - lastByte: -1, - lastRuneSize: -1, - } -} - -var errNegativeRead = errors.New("bufio: reader returned negative count from Read") - -// fill reads a new chunk into the buffer. -func (b *Reader) fill() { - // Slide existing data to beginning. - if b.r > 0 { - copy(b.buf, b.buf[b.r:b.w]) - b.w -= b.r - b.r = 0 - } - - if b.w >= len(b.buf) { - panic("bufio: tried to fill full buffer") - } - - // Read new data: try a limited number of times. - for i := maxConsecutiveEmptyReads; i > 0; i-- { - n, err := b.rd.Read(b.buf[b.w:]) - if n < 0 { - panic(errNegativeRead) - } - b.w += n - if err != nil { - b.err = err - return - } - if n > 0 { - return - } - } - b.err = io.ErrNoProgress -} - -func (b *Reader) readErr() error { - err := b.err - b.err = nil - return err -} - -// Peek returns the next n bytes without advancing the reader. The bytes stop -// being valid at the next read call. If Peek returns fewer than n bytes, it -// also returns an error explaining why the read is short. The error is -// ErrBufferFull if n is larger than b's buffer size. -func (b *Reader) Peek(n int) ([]byte, error) { - if n < 0 { - return nil, ErrNegativeCount - } - if n > len(b.buf) { - return nil, ErrBufferFull - } - // 0 <= n <= len(b.buf) - for b.w-b.r < n && b.err == nil { - b.fill() // b.w-b.r < len(b.buf) => buffer is not full - } - - var err error - if avail := b.w - b.r; avail < n { - // not enough data in buffer - n = avail - err = b.readErr() - if err == nil { - err = ErrBufferFull - } - } - return b.buf[b.r : b.r+n], err -} - -// Discard skips the next n bytes, returning the number of bytes discarded. -// -// If Discard skips fewer than n bytes, it also returns an error. -// If 0 <= n <= b.Buffered(), Discard is guaranteed to succeed without -// reading from the underlying io.Reader. -func (b *Reader) Discard(n int) (discarded int, err error) { - if n < 0 { - return 0, ErrNegativeCount - } - if n == 0 { - return - } - remain := n - for { - skip := b.Buffered() - if skip == 0 { - b.fill() - skip = b.Buffered() - } - if skip > remain { - skip = remain - } - b.r += skip - remain -= skip - if remain == 0 { - return n, nil - } - if b.err != nil { - return n - remain, b.readErr() - } - } -} - -// Read reads data into p. -// It returns the number of bytes read into p. -// It calls Read at most once on the underlying Reader, -// hence n may be less than len(p). -// At EOF, the count will be zero and err will be io.EOF. -func (b *Reader) Read(p []byte) (n int, err error) { - n = len(p) - if n == 0 { - return 0, b.readErr() - } - if b.r == b.w { - if b.err != nil { - return 0, b.readErr() - } - if len(p) >= len(b.buf) { - // Large read, empty buffer. - // Read directly into p to avoid copy. - n, b.err = b.rd.Read(p) - if n < 0 { - panic(errNegativeRead) - } - if n > 0 { - b.lastByte = int(p[n-1]) - b.lastRuneSize = -1 - } - return n, b.readErr() - } - b.fill() // buffer is empty - if b.r == b.w { - return 0, b.readErr() - } - } - - // copy as much as we can - n = copy(p, b.buf[b.r:b.w]) - b.r += n - b.lastByte = int(b.buf[b.r-1]) - b.lastRuneSize = -1 - return n, nil -} - -// ReadByte reads and returns a single byte. -// If no byte is available, returns an error. -func (b *Reader) ReadByte() (c byte, err error) { - b.lastRuneSize = -1 - for b.r == b.w { - if b.err != nil { - return 0, b.readErr() - } - b.fill() // buffer is empty - } - c = b.buf[b.r] - b.r++ - b.lastByte = int(c) - return c, nil -} - -// UnreadByte unreads the last byte. Only the most recently read byte can be unread. -func (b *Reader) UnreadByte() error { - if b.lastByte < 0 || b.r == 0 && b.w > 0 { - return ErrInvalidUnreadByte - } - // b.r > 0 || b.w == 0 - if b.r > 0 { - b.r-- - } else { - // b.r == 0 && b.w == 0 - b.w = 1 - } - b.buf[b.r] = byte(b.lastByte) - b.lastByte = -1 - b.lastRuneSize = -1 - return nil -} - -// ReadRune reads a single UTF-8 encoded Unicode character and returns the -// rune and its size in bytes. If the encoded rune is invalid, it consumes one byte -// and returns unicode.ReplacementChar (U+FFFD) with a size of 1. -func (b *Reader) ReadRune() (r rune, size int, err error) { - for b.r+utf8.UTFMax > b.w && !utf8.FullRune(b.buf[b.r:b.w]) && b.err == nil && b.w-b.r < len(b.buf) { - b.fill() // b.w-b.r < len(buf) => buffer is not full - } - b.lastRuneSize = -1 - if b.r == b.w { - return 0, 0, b.readErr() - } - r, size = rune(b.buf[b.r]), 1 - if r >= 0x80 { - r, size = utf8.DecodeRune(b.buf[b.r:b.w]) - } - b.r += size - b.lastByte = int(b.buf[b.r-1]) - b.lastRuneSize = size - return r, size, nil -} - -// UnreadRune unreads the last rune. If the most recent read operation on -// the buffer was not a ReadRune, UnreadRune returns an error. (In this -// regard it is stricter than UnreadByte, which will unread the last byte -// from any read operation.) -func (b *Reader) UnreadRune() error { - if b.lastRuneSize < 0 || b.r < b.lastRuneSize { - return ErrInvalidUnreadRune - } - b.r -= b.lastRuneSize - b.lastByte = -1 - b.lastRuneSize = -1 - return nil -} - -// Buffered returns the number of bytes that can be read from the current buffer. -func (b *Reader) Buffered() int { return b.w - b.r } - -// ReadSlice reads until the first occurrence of delim in the input, -// returning a slice pointing at the bytes in the buffer. -// The bytes stop being valid at the next read. -// If ReadSlice encounters an error before finding a delimiter, -// it returns all the data in the buffer and the error itself (often io.EOF). -// ReadSlice fails with error ErrBufferFull if the buffer fills without a delim. -// Because the data returned from ReadSlice will be overwritten -// by the next I/O operation, most clients should use -// ReadBytes or ReadString instead. -// ReadSlice returns err != nil if and only if line does not end in delim. -func (b *Reader) ReadSlice(delim byte) (line []byte, err error) { - for { - // Search buffer. - if i := bytes.IndexByte(b.buf[b.r:b.w], delim); i >= 0 { - line = b.buf[b.r : b.r+i+1] - b.r += i + 1 - break - } - - // Pending error? - if b.err != nil { - line = b.buf[b.r:b.w] - b.r = b.w - err = b.readErr() - break - } - - // Buffer full? - if b.Buffered() >= len(b.buf) { - b.r = b.w - line = b.buf - err = ErrBufferFull - break - } - - b.fill() // buffer is not full - } - - // Handle last byte, if any. - if i := len(line) - 1; i >= 0 { - b.lastByte = int(line[i]) - b.lastRuneSize = -1 - } - - return -} - -// ReadLine is a low-level line-reading primitive. Most callers should use -// ReadBytes('\n') or ReadString('\n') instead or use a Scanner. -// -// ReadLine tries to return a single line, not including the end-of-line bytes. -// If the line was too long for the buffer then isPrefix is set and the -// beginning of the line is returned. The rest of the line will be returned -// from future calls. isPrefix will be false when returning the last fragment -// of the line. The returned buffer is only valid until the next call to -// ReadLine. ReadLine either returns a non-nil line or it returns an error, -// never both. -// -// The text returned from ReadLine does not include the line end ("\r\n" or "\n"). -// No indication or error is given if the input ends without a final line end. -// Calling UnreadByte after ReadLine will always unread the last byte read -// (possibly a character belonging to the line end) even if that byte is not -// part of the line returned by ReadLine. -func (b *Reader) ReadLine() (line []byte, isPrefix bool, err error) { - line, err = b.ReadSlice('\n') - if err == ErrBufferFull { - // Handle the case where "\r\n" straddles the buffer. - if len(line) > 0 && line[len(line)-1] == '\r' { - // Put the '\r' back on buf and drop it from line. - // Let the next call to ReadLine check for "\r\n". - if b.r == 0 { - // should be unreachable - panic("bufio: tried to rewind past start of buffer") - } - b.r-- - line = line[:len(line)-1] - } - return line, true, nil - } - - if len(line) == 0 { - if err != nil { - line = nil - } - return - } - err = nil - - if line[len(line)-1] == '\n' { - drop := 1 - if len(line) > 1 && line[len(line)-2] == '\r' { - drop = 2 - } - line = line[:len(line)-drop] - } - return -} - -// ReadBytes reads until the first occurrence of delim in the input, -// returning a slice containing the data up to and including the delimiter. -// If ReadBytes encounters an error before finding a delimiter, -// it returns the data read before the error and the error itself (often io.EOF). -// ReadBytes returns err != nil if and only if the returned data does not end in -// delim. -// For simple uses, a Scanner may be more convenient. -func (b *Reader) ReadBytes(delim byte) (line []byte, err error) { - // Use ReadSlice to look for array, - // accumulating full buffers. - var frag []byte - var full [][]byte - - for { - var e error - frag, e = b.ReadSlice(delim) - if e == nil { // got final fragment - break - } - if e != ErrBufferFull { // unexpected error - err = e - break - } - - // Make a copy of the buffer. - buf := make([]byte, len(frag)) - copy(buf, frag) - full = append(full, buf) - } - - // Allocate new buffer to hold the full pieces and the fragment. - n := 0 - for i := range full { - n += len(full[i]) - } - n += len(frag) - - // Copy full pieces and fragment in. - buf := make([]byte, n) - n = 0 - for i := range full { - n += copy(buf[n:], full[i]) - } - copy(buf[n:], frag) - return buf, err -} - -// ReadString reads until the first occurrence of delim in the input, -// returning a string containing the data up to and including the delimiter. -// If ReadString encounters an error before finding a delimiter, -// it returns the data read before the error and the error itself (often io.EOF). -// ReadString returns err != nil if and only if the returned data does not end in -// delim. -// For simple uses, a Scanner may be more convenient. -func (b *Reader) ReadString(delim byte) (line string, err error) { - bytes, err := b.ReadBytes(delim) - line = string(bytes) - return line, err -} - -// WriteTo implements io.WriterTo. -func (b *Reader) WriteTo(w io.Writer) (n int64, err error) { - n, err = b.writeBuf(w) - if err != nil { - return - } - - if r, ok := b.rd.(io.WriterTo); ok { - m, err := r.WriteTo(w) - n += m - return n, err - } - - if w, ok := w.(io.ReaderFrom); ok { - m, err := w.ReadFrom(b.rd) - n += m - return n, err - } - - if b.w-b.r < len(b.buf) { - b.fill() // buffer not full - } - - for b.r < b.w { - // b.r < b.w => buffer is not empty - m, err := b.writeBuf(w) - n += m - if err != nil { - return n, err - } - b.fill() // buffer is empty - } - - if b.err == io.EOF { - b.err = nil - } - - return n, b.readErr() -} - -var errNegativeWrite = errors.New("bufio: writer returned negative count from Write") - -// writeBuf writes the Reader's buffer to the writer. -func (b *Reader) writeBuf(w io.Writer) (int64, error) { - n, err := w.Write(b.buf[b.r:b.w]) - if n < 0 { - panic(errNegativeWrite) - } - b.r += n - return int64(n), err -} - -// buffered output - -// Writer implements buffering for an io.Writer object. -// If an error occurs writing to a Writer, no more data will be -// accepted and all subsequent writes will return the error. -// After all data has been written, the client should call the -// Flush method to guarantee all data has been forwarded to -// the underlying io.Writer. -type Writer struct { - err error - buf []byte - n int - wr io.Writer -} - -// NewWriterSize returns a new Writer whose buffer has at least the specified -// size. If the argument io.Writer is already a Writer with large enough -// size, it returns the underlying Writer. -func NewWriterSize(w io.Writer, size int) *Writer { - // Is it already a Writer? - b, ok := w.(*Writer) - if ok && len(b.buf) >= size { - return b - } - if size <= 0 { - size = defaultBufSize - } - return &Writer{ - buf: make([]byte, size), - wr: w, - } -} - -// NewWriter returns a new Writer whose buffer has the default size. -func NewWriter(w io.Writer) *Writer { - return NewWriterSize(w, defaultBufSize) -} - -// Reset discards any unflushed buffered data, clears any error, and -// resets b to write its output to w. -func (b *Writer) Reset(w io.Writer) { - b.err = nil - b.n = 0 - b.wr = w -} - -// Flush writes any buffered data to the underlying io.Writer. -func (b *Writer) Flush() error { - err := b.flush() - return err -} - -func (b *Writer) flush() error { - if b.err != nil { - return b.err - } - if b.n == 0 { - return nil - } - n, err := b.wr.Write(b.buf[0:b.n]) - if n < b.n && err == nil { - err = io.ErrShortWrite - } - if err != nil { - if n > 0 && n < b.n { - copy(b.buf[0:b.n-n], b.buf[n:b.n]) - } - b.n -= n - b.err = err - return err - } - b.n = 0 - return nil -} - -// Available returns how many bytes are unused in the buffer. -func (b *Writer) Available() int { return len(b.buf) - b.n } - -// Buffered returns the number of bytes that have been written into the current buffer. -func (b *Writer) Buffered() int { return b.n } - -// Write writes the contents of p into the buffer. -// It returns the number of bytes written. -// If nn < len(p), it also returns an error explaining -// why the write is short. -func (b *Writer) Write(p []byte) (nn int, err error) { - for len(p) > b.Available() && b.err == nil { - var n int - if b.Buffered() == 0 { - // Large write, empty buffer. - // Write directly from p to avoid copy. - n, b.err = b.wr.Write(p) - } else { - n = copy(b.buf[b.n:], p) - b.n += n - b.flush() - } - nn += n - p = p[n:] - } - if b.err != nil { - return nn, b.err - } - n := copy(b.buf[b.n:], p) - b.n += n - nn += n - return nn, nil -} - -// WriteByte writes a single byte. -func (b *Writer) WriteByte(c byte) error { - if b.err != nil { - return b.err - } - if b.Available() <= 0 && b.flush() != nil { - return b.err - } - b.buf[b.n] = c - b.n++ - return nil -} - -// WriteRune writes a single Unicode code point, returning -// the number of bytes written and any error. -func (b *Writer) WriteRune(r rune) (size int, err error) { - if r < utf8.RuneSelf { - err = b.WriteByte(byte(r)) - if err != nil { - return 0, err - } - return 1, nil - } - if b.err != nil { - return 0, b.err - } - n := b.Available() - if n < utf8.UTFMax { - if b.flush(); b.err != nil { - return 0, b.err - } - n = b.Available() - if n < utf8.UTFMax { - // Can only happen if buffer is silly small. - return b.WriteString(string(r)) - } - } - size = utf8.EncodeRune(b.buf[b.n:], r) - b.n += size - return size, nil -} - -// WriteString writes a string. -// It returns the number of bytes written. -// If the count is less than len(s), it also returns an error explaining -// why the write is short. -func (b *Writer) WriteString(s string) (int, error) { - nn := 0 - for len(s) > b.Available() && b.err == nil { - n := copy(b.buf[b.n:], s) - b.n += n - nn += n - s = s[n:] - b.flush() - } - if b.err != nil { - return nn, b.err - } - n := copy(b.buf[b.n:], s) - b.n += n - nn += n - return nn, nil -} - -// ReadFrom implements io.ReaderFrom. -func (b *Writer) ReadFrom(r io.Reader) (n int64, err error) { - if b.Buffered() == 0 { - if w, ok := b.wr.(io.ReaderFrom); ok { - return w.ReadFrom(r) - } - } - var m int - for { - if b.Available() == 0 { - if err1 := b.flush(); err1 != nil { - return n, err1 - } - } - nr := 0 - for nr < maxConsecutiveEmptyReads { - m, err = r.Read(b.buf[b.n:]) - if m != 0 || err != nil { - break - } - nr++ - } - if nr == maxConsecutiveEmptyReads { - return n, io.ErrNoProgress - } - b.n += m - n += int64(m) - if err != nil { - break - } - } - if err == io.EOF { - // If we filled the buffer exactly, flush pre-emptively. - if b.Available() == 0 { - err = b.flush() - } else { - err = nil - } - } - return n, err -} - -// buffered input and output - -// ReadWriter stores pointers to a Reader and a Writer. -// It implements io.ReadWriter. -type ReadWriter struct { - *Reader - *Writer -} - -// NewReadWriter allocates a new ReadWriter that dispatches to r and w. -func NewReadWriter(r *Reader, w *Writer) *ReadWriter { - return &ReadWriter{r, w} -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/bufio_test.go b/llgo/third_party/gofrontend/libgo/go/bufio/bufio_test.go deleted file mode 100644 index 666c44e15a938be90bb2f9095fea82a18e9401e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/bufio_test.go +++ /dev/null @@ -1,1572 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bufio_test - -import ( - . "bufio" - "bytes" - "errors" - "fmt" - "io" - "io/ioutil" - "strings" - "testing" - "testing/iotest" - "time" - "unicode/utf8" -) - -// Reads from a reader and rot13s the result. -type rot13Reader struct { - r io.Reader -} - -func newRot13Reader(r io.Reader) *rot13Reader { - r13 := new(rot13Reader) - r13.r = r - return r13 -} - -func (r13 *rot13Reader) Read(p []byte) (int, error) { - n, err := r13.r.Read(p) - for i := 0; i < n; i++ { - c := p[i] | 0x20 // lowercase byte - if 'a' <= c && c <= 'm' { - p[i] += 13 - } else if 'n' <= c && c <= 'z' { - p[i] -= 13 - } - } - return n, err -} - -// Call ReadByte to accumulate the text of a file -func readBytes(buf *Reader) string { - var b [1000]byte - nb := 0 - for { - c, err := buf.ReadByte() - if err == io.EOF { - break - } - if err == nil { - b[nb] = c - nb++ - } else if err != iotest.ErrTimeout { - panic("Data: " + err.Error()) - } - } - return string(b[0:nb]) -} - -func TestReaderSimple(t *testing.T) { - data := "hello world" - b := NewReader(strings.NewReader(data)) - if s := readBytes(b); s != "hello world" { - t.Errorf("simple hello world test failed: got %q", s) - } - - b = NewReader(newRot13Reader(strings.NewReader(data))) - if s := readBytes(b); s != "uryyb jbeyq" { - t.Errorf("rot13 hello world test failed: got %q", s) - } -} - -type readMaker struct { - name string - fn func(io.Reader) io.Reader -} - -var readMakers = []readMaker{ - {"full", func(r io.Reader) io.Reader { return r }}, - {"byte", iotest.OneByteReader}, - {"half", iotest.HalfReader}, - {"data+err", iotest.DataErrReader}, - {"timeout", iotest.TimeoutReader}, -} - -// Call ReadString (which ends up calling everything else) -// to accumulate the text of a file. -func readLines(b *Reader) string { - s := "" - for { - s1, err := b.ReadString('\n') - if err == io.EOF { - break - } - if err != nil && err != iotest.ErrTimeout { - panic("GetLines: " + err.Error()) - } - s += s1 - } - return s -} - -// Call Read to accumulate the text of a file -func reads(buf *Reader, m int) string { - var b [1000]byte - nb := 0 - for { - n, err := buf.Read(b[nb : nb+m]) - nb += n - if err == io.EOF { - break - } - } - return string(b[0:nb]) -} - -type bufReader struct { - name string - fn func(*Reader) string -} - -var bufreaders = []bufReader{ - {"1", func(b *Reader) string { return reads(b, 1) }}, - {"2", func(b *Reader) string { return reads(b, 2) }}, - {"3", func(b *Reader) string { return reads(b, 3) }}, - {"4", func(b *Reader) string { return reads(b, 4) }}, - {"5", func(b *Reader) string { return reads(b, 5) }}, - {"7", func(b *Reader) string { return reads(b, 7) }}, - {"bytes", readBytes}, - {"lines", readLines}, -} - -const minReadBufferSize = 16 - -var bufsizes = []int{ - 0, minReadBufferSize, 23, 32, 46, 64, 93, 128, 1024, 4096, -} - -func TestReader(t *testing.T) { - var texts [31]string - str := "" - all := "" - for i := 0; i < len(texts)-1; i++ { - texts[i] = str + "\n" - all += texts[i] - str += string(i%26 + 'a') - } - texts[len(texts)-1] = all - - for h := 0; h < len(texts); h++ { - text := texts[h] - for i := 0; i < len(readMakers); i++ { - for j := 0; j < len(bufreaders); j++ { - for k := 0; k < len(bufsizes); k++ { - readmaker := readMakers[i] - bufreader := bufreaders[j] - bufsize := bufsizes[k] - read := readmaker.fn(strings.NewReader(text)) - buf := NewReaderSize(read, bufsize) - s := bufreader.fn(buf) - if s != text { - t.Errorf("reader=%s fn=%s bufsize=%d want=%q got=%q", - readmaker.name, bufreader.name, bufsize, text, s) - } - } - } - } - } -} - -type zeroReader struct{} - -func (zeroReader) Read(p []byte) (int, error) { - return 0, nil -} - -func TestZeroReader(t *testing.T) { - var z zeroReader - r := NewReader(z) - - c := make(chan error) - go func() { - _, err := r.ReadByte() - c <- err - }() - - select { - case err := <-c: - if err == nil { - t.Error("error expected") - } else if err != io.ErrNoProgress { - t.Error("unexpected error:", err) - } - case <-time.After(time.Second): - t.Error("test timed out (endless loop in ReadByte?)") - } -} - -// A StringReader delivers its data one string segment at a time via Read. -type StringReader struct { - data []string - step int -} - -func (r *StringReader) Read(p []byte) (n int, err error) { - if r.step < len(r.data) { - s := r.data[r.step] - n = copy(p, s) - r.step++ - } else { - err = io.EOF - } - return -} - -func readRuneSegments(t *testing.T, segments []string) { - got := "" - want := strings.Join(segments, "") - r := NewReader(&StringReader{data: segments}) - for { - r, _, err := r.ReadRune() - if err != nil { - if err != io.EOF { - return - } - break - } - got += string(r) - } - if got != want { - t.Errorf("segments=%v got=%s want=%s", segments, got, want) - } -} - -var segmentList = [][]string{ - {}, - {""}, - {"日", "本語"}, - {"\u65e5", "\u672c", "\u8a9e"}, - {"\U000065e5", "\U0000672c", "\U00008a9e"}, - {"\xe6", "\x97\xa5\xe6", "\x9c\xac\xe8\xaa\x9e"}, - {"Hello", ", ", "World", "!"}, - {"Hello", ", ", "", "World", "!"}, -} - -func TestReadRune(t *testing.T) { - for _, s := range segmentList { - readRuneSegments(t, s) - } -} - -func TestUnreadRune(t *testing.T) { - segments := []string{"Hello, world:", "日本語"} - r := NewReader(&StringReader{data: segments}) - got := "" - want := strings.Join(segments, "") - // Normal execution. - for { - r1, _, err := r.ReadRune() - if err != nil { - if err != io.EOF { - t.Error("unexpected error on ReadRune:", err) - } - break - } - got += string(r1) - // Put it back and read it again. - if err = r.UnreadRune(); err != nil { - t.Fatal("unexpected error on UnreadRune:", err) - } - r2, _, err := r.ReadRune() - if err != nil { - t.Fatal("unexpected error reading after unreading:", err) - } - if r1 != r2 { - t.Fatalf("incorrect rune after unread: got %c, want %c", r1, r2) - } - } - if got != want { - t.Errorf("got %q, want %q", got, want) - } -} - -func TestUnreadByte(t *testing.T) { - segments := []string{"Hello, ", "world"} - r := NewReader(&StringReader{data: segments}) - got := "" - want := strings.Join(segments, "") - // Normal execution. - for { - b1, err := r.ReadByte() - if err != nil { - if err != io.EOF { - t.Error("unexpected error on ReadByte:", err) - } - break - } - got += string(b1) - // Put it back and read it again. - if err = r.UnreadByte(); err != nil { - t.Fatal("unexpected error on UnreadByte:", err) - } - b2, err := r.ReadByte() - if err != nil { - t.Fatal("unexpected error reading after unreading:", err) - } - if b1 != b2 { - t.Fatalf("incorrect byte after unread: got %q, want %q", b1, b2) - } - } - if got != want { - t.Errorf("got %q, want %q", got, want) - } -} - -func TestUnreadByteMultiple(t *testing.T) { - segments := []string{"Hello, ", "world"} - data := strings.Join(segments, "") - for n := 0; n <= len(data); n++ { - r := NewReader(&StringReader{data: segments}) - // Read n bytes. - for i := 0; i < n; i++ { - b, err := r.ReadByte() - if err != nil { - t.Fatalf("n = %d: unexpected error on ReadByte: %v", n, err) - } - if b != data[i] { - t.Fatalf("n = %d: incorrect byte returned from ReadByte: got %q, want %q", n, b, data[i]) - } - } - // Unread one byte if there is one. - if n > 0 { - if err := r.UnreadByte(); err != nil { - t.Errorf("n = %d: unexpected error on UnreadByte: %v", n, err) - } - } - // Test that we cannot unread any further. - if err := r.UnreadByte(); err == nil { - t.Errorf("n = %d: expected error on UnreadByte", n) - } - } -} - -func TestUnreadByteOthers(t *testing.T) { - // A list of readers to use in conjunction with UnreadByte. - var readers = []func(*Reader, byte) ([]byte, error){ - (*Reader).ReadBytes, - (*Reader).ReadSlice, - func(r *Reader, delim byte) ([]byte, error) { - data, err := r.ReadString(delim) - return []byte(data), err - }, - // ReadLine doesn't fit the data/pattern easily - // so we leave it out. It should be covered via - // the ReadSlice test since ReadLine simply calls - // ReadSlice, and it's that function that handles - // the last byte. - } - - // Try all readers with UnreadByte. - for rno, read := range readers { - // Some input data that is longer than the minimum reader buffer size. - const n = 10 - var buf bytes.Buffer - for i := 0; i < n; i++ { - buf.WriteString("abcdefg") - } - - r := NewReaderSize(&buf, minReadBufferSize) - readTo := func(delim byte, want string) { - data, err := read(r, delim) - if err != nil { - t.Fatalf("#%d: unexpected error reading to %c: %v", rno, delim, err) - } - if got := string(data); got != want { - t.Fatalf("#%d: got %q, want %q", rno, got, want) - } - } - - // Read the data with occasional UnreadByte calls. - for i := 0; i < n; i++ { - readTo('d', "abcd") - for j := 0; j < 3; j++ { - if err := r.UnreadByte(); err != nil { - t.Fatalf("#%d: unexpected error on UnreadByte: %v", rno, err) - } - readTo('d', "d") - } - readTo('g', "efg") - } - - // All data should have been read. - _, err := r.ReadByte() - if err != io.EOF { - t.Errorf("#%d: got error %v; want EOF", rno, err) - } - } -} - -// Test that UnreadRune fails if the preceding operation was not a ReadRune. -func TestUnreadRuneError(t *testing.T) { - buf := make([]byte, 3) // All runes in this test are 3 bytes long - r := NewReader(&StringReader{data: []string{"日本語日本語日本語"}}) - if r.UnreadRune() == nil { - t.Error("expected error on UnreadRune from fresh buffer") - } - _, _, err := r.ReadRune() - if err != nil { - t.Error("unexpected error on ReadRune (1):", err) - } - if err = r.UnreadRune(); err != nil { - t.Error("unexpected error on UnreadRune (1):", err) - } - if r.UnreadRune() == nil { - t.Error("expected error after UnreadRune (1)") - } - // Test error after Read. - _, _, err = r.ReadRune() // reset state - if err != nil { - t.Error("unexpected error on ReadRune (2):", err) - } - _, err = r.Read(buf) - if err != nil { - t.Error("unexpected error on Read (2):", err) - } - if r.UnreadRune() == nil { - t.Error("expected error after Read (2)") - } - // Test error after ReadByte. - _, _, err = r.ReadRune() // reset state - if err != nil { - t.Error("unexpected error on ReadRune (2):", err) - } - for range buf { - _, err = r.ReadByte() - if err != nil { - t.Error("unexpected error on ReadByte (2):", err) - } - } - if r.UnreadRune() == nil { - t.Error("expected error after ReadByte") - } - // Test error after UnreadByte. - _, _, err = r.ReadRune() // reset state - if err != nil { - t.Error("unexpected error on ReadRune (3):", err) - } - _, err = r.ReadByte() - if err != nil { - t.Error("unexpected error on ReadByte (3):", err) - } - err = r.UnreadByte() - if err != nil { - t.Error("unexpected error on UnreadByte (3):", err) - } - if r.UnreadRune() == nil { - t.Error("expected error after UnreadByte (3)") - } - // Test error after ReadSlice. - _, _, err = r.ReadRune() // reset state - if err != nil { - t.Error("unexpected error on ReadRune (4):", err) - } - _, err = r.ReadSlice(0) - if err != io.EOF { - t.Error("unexpected error on ReadSlice (4):", err) - } - if r.UnreadRune() == nil { - t.Error("expected error after ReadSlice (4)") - } -} - -func TestUnreadRuneAtEOF(t *testing.T) { - // UnreadRune/ReadRune should error at EOF (was a bug; used to panic) - r := NewReader(strings.NewReader("x")) - r.ReadRune() - r.ReadRune() - r.UnreadRune() - _, _, err := r.ReadRune() - if err == nil { - t.Error("expected error at EOF") - } else if err != io.EOF { - t.Error("expected EOF; got", err) - } -} - -func TestReadWriteRune(t *testing.T) { - const NRune = 1000 - byteBuf := new(bytes.Buffer) - w := NewWriter(byteBuf) - // Write the runes out using WriteRune - buf := make([]byte, utf8.UTFMax) - for r := rune(0); r < NRune; r++ { - size := utf8.EncodeRune(buf, r) - nbytes, err := w.WriteRune(r) - if err != nil { - t.Fatalf("WriteRune(0x%x) error: %s", r, err) - } - if nbytes != size { - t.Fatalf("WriteRune(0x%x) expected %d, got %d", r, size, nbytes) - } - } - w.Flush() - - r := NewReader(byteBuf) - // Read them back with ReadRune - for r1 := rune(0); r1 < NRune; r1++ { - size := utf8.EncodeRune(buf, r1) - nr, nbytes, err := r.ReadRune() - if nr != r1 || nbytes != size || err != nil { - t.Fatalf("ReadRune(0x%x) got 0x%x,%d not 0x%x,%d (err=%s)", r1, nr, nbytes, r1, size, err) - } - } -} - -func TestWriter(t *testing.T) { - var data [8192]byte - - for i := 0; i < len(data); i++ { - data[i] = byte(' ' + i%('~'-' ')) - } - w := new(bytes.Buffer) - for i := 0; i < len(bufsizes); i++ { - for j := 0; j < len(bufsizes); j++ { - nwrite := bufsizes[i] - bs := bufsizes[j] - - // Write nwrite bytes using buffer size bs. - // Check that the right amount makes it out - // and that the data is correct. - - w.Reset() - buf := NewWriterSize(w, bs) - context := fmt.Sprintf("nwrite=%d bufsize=%d", nwrite, bs) - n, e1 := buf.Write(data[0:nwrite]) - if e1 != nil || n != nwrite { - t.Errorf("%s: buf.Write %d = %d, %v", context, nwrite, n, e1) - continue - } - if e := buf.Flush(); e != nil { - t.Errorf("%s: buf.Flush = %v", context, e) - } - - written := w.Bytes() - if len(written) != nwrite { - t.Errorf("%s: %d bytes written", context, len(written)) - } - for l := 0; l < len(written); l++ { - if written[i] != data[i] { - t.Errorf("wrong bytes written") - t.Errorf("want=%q", data[0:len(written)]) - t.Errorf("have=%q", written) - } - } - } - } -} - -// Check that write errors are returned properly. - -type errorWriterTest struct { - n, m int - err error - expect error -} - -func (w errorWriterTest) Write(p []byte) (int, error) { - return len(p) * w.n / w.m, w.err -} - -var errorWriterTests = []errorWriterTest{ - {0, 1, nil, io.ErrShortWrite}, - {1, 2, nil, io.ErrShortWrite}, - {1, 1, nil, nil}, - {0, 1, io.ErrClosedPipe, io.ErrClosedPipe}, - {1, 2, io.ErrClosedPipe, io.ErrClosedPipe}, - {1, 1, io.ErrClosedPipe, io.ErrClosedPipe}, -} - -func TestWriteErrors(t *testing.T) { - for _, w := range errorWriterTests { - buf := NewWriter(w) - _, e := buf.Write([]byte("hello world")) - if e != nil { - t.Errorf("Write hello to %v: %v", w, e) - continue - } - // Two flushes, to verify the error is sticky. - for i := 0; i < 2; i++ { - e = buf.Flush() - if e != w.expect { - t.Errorf("Flush %d/2 %v: got %v, wanted %v", i+1, w, e, w.expect) - } - } - } -} - -func TestNewReaderSizeIdempotent(t *testing.T) { - const BufSize = 1000 - b := NewReaderSize(strings.NewReader("hello world"), BufSize) - // Does it recognize itself? - b1 := NewReaderSize(b, BufSize) - if b1 != b { - t.Error("NewReaderSize did not detect underlying Reader") - } - // Does it wrap if existing buffer is too small? - b2 := NewReaderSize(b, 2*BufSize) - if b2 == b { - t.Error("NewReaderSize did not enlarge buffer") - } -} - -func TestNewWriterSizeIdempotent(t *testing.T) { - const BufSize = 1000 - b := NewWriterSize(new(bytes.Buffer), BufSize) - // Does it recognize itself? - b1 := NewWriterSize(b, BufSize) - if b1 != b { - t.Error("NewWriterSize did not detect underlying Writer") - } - // Does it wrap if existing buffer is too small? - b2 := NewWriterSize(b, 2*BufSize) - if b2 == b { - t.Error("NewWriterSize did not enlarge buffer") - } -} - -func TestWriteString(t *testing.T) { - const BufSize = 8 - buf := new(bytes.Buffer) - b := NewWriterSize(buf, BufSize) - b.WriteString("0") // easy - b.WriteString("123456") // still easy - b.WriteString("7890") // easy after flush - b.WriteString("abcdefghijklmnopqrstuvwxy") // hard - b.WriteString("z") - if err := b.Flush(); err != nil { - t.Error("WriteString", err) - } - s := "01234567890abcdefghijklmnopqrstuvwxyz" - if string(buf.Bytes()) != s { - t.Errorf("WriteString wants %q gets %q", s, string(buf.Bytes())) - } -} - -func TestBufferFull(t *testing.T) { - const longString = "And now, hello, world! It is the time for all good men to come to the aid of their party" - buf := NewReaderSize(strings.NewReader(longString), minReadBufferSize) - line, err := buf.ReadSlice('!') - if string(line) != "And now, hello, " || err != ErrBufferFull { - t.Errorf("first ReadSlice(,) = %q, %v", line, err) - } - line, err = buf.ReadSlice('!') - if string(line) != "world!" || err != nil { - t.Errorf("second ReadSlice(,) = %q, %v", line, err) - } -} - -func TestPeek(t *testing.T) { - p := make([]byte, 10) - // string is 16 (minReadBufferSize) long. - buf := NewReaderSize(strings.NewReader("abcdefghijklmnop"), minReadBufferSize) - if s, err := buf.Peek(1); string(s) != "a" || err != nil { - t.Fatalf("want %q got %q, err=%v", "a", string(s), err) - } - if s, err := buf.Peek(4); string(s) != "abcd" || err != nil { - t.Fatalf("want %q got %q, err=%v", "abcd", string(s), err) - } - if _, err := buf.Peek(-1); err != ErrNegativeCount { - t.Fatalf("want ErrNegativeCount got %v", err) - } - if _, err := buf.Peek(32); err != ErrBufferFull { - t.Fatalf("want ErrBufFull got %v", err) - } - if _, err := buf.Read(p[0:3]); string(p[0:3]) != "abc" || err != nil { - t.Fatalf("want %q got %q, err=%v", "abc", string(p[0:3]), err) - } - if s, err := buf.Peek(1); string(s) != "d" || err != nil { - t.Fatalf("want %q got %q, err=%v", "d", string(s), err) - } - if s, err := buf.Peek(2); string(s) != "de" || err != nil { - t.Fatalf("want %q got %q, err=%v", "de", string(s), err) - } - if _, err := buf.Read(p[0:3]); string(p[0:3]) != "def" || err != nil { - t.Fatalf("want %q got %q, err=%v", "def", string(p[0:3]), err) - } - if s, err := buf.Peek(4); string(s) != "ghij" || err != nil { - t.Fatalf("want %q got %q, err=%v", "ghij", string(s), err) - } - if _, err := buf.Read(p[0:]); string(p[0:]) != "ghijklmnop" || err != nil { - t.Fatalf("want %q got %q, err=%v", "ghijklmnop", string(p[0:minReadBufferSize]), err) - } - if s, err := buf.Peek(0); string(s) != "" || err != nil { - t.Fatalf("want %q got %q, err=%v", "", string(s), err) - } - if _, err := buf.Peek(1); err != io.EOF { - t.Fatalf("want EOF got %v", err) - } - - // Test for issue 3022, not exposing a reader's error on a successful Peek. - buf = NewReaderSize(dataAndEOFReader("abcd"), 32) - if s, err := buf.Peek(2); string(s) != "ab" || err != nil { - t.Errorf(`Peek(2) on "abcd", EOF = %q, %v; want "ab", nil`, string(s), err) - } - if s, err := buf.Peek(4); string(s) != "abcd" || err != nil { - t.Errorf(`Peek(4) on "abcd", EOF = %q, %v; want "abcd", nil`, string(s), err) - } - if n, err := buf.Read(p[0:5]); string(p[0:n]) != "abcd" || err != nil { - t.Fatalf("Read after peek = %q, %v; want abcd, EOF", p[0:n], err) - } - if n, err := buf.Read(p[0:1]); string(p[0:n]) != "" || err != io.EOF { - t.Fatalf(`second Read after peek = %q, %v; want "", EOF`, p[0:n], err) - } -} - -type dataAndEOFReader string - -func (r dataAndEOFReader) Read(p []byte) (int, error) { - return copy(p, r), io.EOF -} - -func TestPeekThenUnreadRune(t *testing.T) { - // This sequence used to cause a crash. - r := NewReader(strings.NewReader("x")) - r.ReadRune() - r.Peek(1) - r.UnreadRune() - r.ReadRune() // Used to panic here -} - -var testOutput = []byte("0123456789abcdefghijklmnopqrstuvwxy") -var testInput = []byte("012\n345\n678\n9ab\ncde\nfgh\nijk\nlmn\nopq\nrst\nuvw\nxy") -var testInputrn = []byte("012\r\n345\r\n678\r\n9ab\r\ncde\r\nfgh\r\nijk\r\nlmn\r\nopq\r\nrst\r\nuvw\r\nxy\r\n\n\r\n") - -// TestReader wraps a []byte and returns reads of a specific length. -type testReader struct { - data []byte - stride int -} - -func (t *testReader) Read(buf []byte) (n int, err error) { - n = t.stride - if n > len(t.data) { - n = len(t.data) - } - if n > len(buf) { - n = len(buf) - } - copy(buf, t.data) - t.data = t.data[n:] - if len(t.data) == 0 { - err = io.EOF - } - return -} - -func testReadLine(t *testing.T, input []byte) { - //for stride := 1; stride < len(input); stride++ { - for stride := 1; stride < 2; stride++ { - done := 0 - reader := testReader{input, stride} - l := NewReaderSize(&reader, len(input)+1) - for { - line, isPrefix, err := l.ReadLine() - if len(line) > 0 && err != nil { - t.Errorf("ReadLine returned both data and error: %s", err) - } - if isPrefix { - t.Errorf("ReadLine returned prefix") - } - if err != nil { - if err != io.EOF { - t.Fatalf("Got unknown error: %s", err) - } - break - } - if want := testOutput[done : done+len(line)]; !bytes.Equal(want, line) { - t.Errorf("Bad line at stride %d: want: %x got: %x", stride, want, line) - } - done += len(line) - } - if done != len(testOutput) { - t.Errorf("ReadLine didn't return everything: got: %d, want: %d (stride: %d)", done, len(testOutput), stride) - } - } -} - -func TestReadLine(t *testing.T) { - testReadLine(t, testInput) - testReadLine(t, testInputrn) -} - -func TestLineTooLong(t *testing.T) { - data := make([]byte, 0) - for i := 0; i < minReadBufferSize*5/2; i++ { - data = append(data, '0'+byte(i%10)) - } - buf := bytes.NewReader(data) - l := NewReaderSize(buf, minReadBufferSize) - line, isPrefix, err := l.ReadLine() - if !isPrefix || !bytes.Equal(line, data[:minReadBufferSize]) || err != nil { - t.Errorf("bad result for first line: got %q want %q %v", line, data[:minReadBufferSize], err) - } - data = data[len(line):] - line, isPrefix, err = l.ReadLine() - if !isPrefix || !bytes.Equal(line, data[:minReadBufferSize]) || err != nil { - t.Errorf("bad result for second line: got %q want %q %v", line, data[:minReadBufferSize], err) - } - data = data[len(line):] - line, isPrefix, err = l.ReadLine() - if isPrefix || !bytes.Equal(line, data[:minReadBufferSize/2]) || err != nil { - t.Errorf("bad result for third line: got %q want %q %v", line, data[:minReadBufferSize/2], err) - } - line, isPrefix, err = l.ReadLine() - if isPrefix || err == nil { - t.Errorf("expected no more lines: %x %s", line, err) - } -} - -func TestReadAfterLines(t *testing.T) { - line1 := "this is line1" - restData := "this is line2\nthis is line 3\n" - inbuf := bytes.NewReader([]byte(line1 + "\n" + restData)) - outbuf := new(bytes.Buffer) - maxLineLength := len(line1) + len(restData)/2 - l := NewReaderSize(inbuf, maxLineLength) - line, isPrefix, err := l.ReadLine() - if isPrefix || err != nil || string(line) != line1 { - t.Errorf("bad result for first line: isPrefix=%v err=%v line=%q", isPrefix, err, string(line)) - } - n, err := io.Copy(outbuf, l) - if int(n) != len(restData) || err != nil { - t.Errorf("bad result for Read: n=%d err=%v", n, err) - } - if outbuf.String() != restData { - t.Errorf("bad result for Read: got %q; expected %q", outbuf.String(), restData) - } -} - -func TestReadEmptyBuffer(t *testing.T) { - l := NewReaderSize(new(bytes.Buffer), minReadBufferSize) - line, isPrefix, err := l.ReadLine() - if err != io.EOF { - t.Errorf("expected EOF from ReadLine, got '%s' %t %s", line, isPrefix, err) - } -} - -func TestLinesAfterRead(t *testing.T) { - l := NewReaderSize(bytes.NewReader([]byte("foo")), minReadBufferSize) - _, err := ioutil.ReadAll(l) - if err != nil { - t.Error(err) - return - } - - line, isPrefix, err := l.ReadLine() - if err != io.EOF { - t.Errorf("expected EOF from ReadLine, got '%s' %t %s", line, isPrefix, err) - } -} - -func TestReadLineNonNilLineOrError(t *testing.T) { - r := NewReader(strings.NewReader("line 1\n")) - for i := 0; i < 2; i++ { - l, _, err := r.ReadLine() - if l != nil && err != nil { - t.Fatalf("on line %d/2; ReadLine=%#v, %v; want non-nil line or Error, but not both", - i+1, l, err) - } - } -} - -type readLineResult struct { - line []byte - isPrefix bool - err error -} - -var readLineNewlinesTests = []struct { - input string - expect []readLineResult -}{ - {"012345678901234\r\n012345678901234\r\n", []readLineResult{ - {[]byte("012345678901234"), true, nil}, - {nil, false, nil}, - {[]byte("012345678901234"), true, nil}, - {nil, false, nil}, - {nil, false, io.EOF}, - }}, - {"0123456789012345\r012345678901234\r", []readLineResult{ - {[]byte("0123456789012345"), true, nil}, - {[]byte("\r012345678901234"), true, nil}, - {[]byte("\r"), false, nil}, - {nil, false, io.EOF}, - }}, -} - -func TestReadLineNewlines(t *testing.T) { - for _, e := range readLineNewlinesTests { - testReadLineNewlines(t, e.input, e.expect) - } -} - -func testReadLineNewlines(t *testing.T, input string, expect []readLineResult) { - b := NewReaderSize(strings.NewReader(input), minReadBufferSize) - for i, e := range expect { - line, isPrefix, err := b.ReadLine() - if !bytes.Equal(line, e.line) { - t.Errorf("%q call %d, line == %q, want %q", input, i, line, e.line) - return - } - if isPrefix != e.isPrefix { - t.Errorf("%q call %d, isPrefix == %v, want %v", input, i, isPrefix, e.isPrefix) - return - } - if err != e.err { - t.Errorf("%q call %d, err == %v, want %v", input, i, err, e.err) - return - } - } -} - -func createTestInput(n int) []byte { - input := make([]byte, n) - for i := range input { - // 101 and 251 are arbitrary prime numbers. - // The idea is to create an input sequence - // which doesn't repeat too frequently. - input[i] = byte(i % 251) - if i%101 == 0 { - input[i] ^= byte(i / 101) - } - } - return input -} - -func TestReaderWriteTo(t *testing.T) { - input := createTestInput(8192) - r := NewReader(onlyReader{bytes.NewReader(input)}) - w := new(bytes.Buffer) - if n, err := r.WriteTo(w); err != nil || n != int64(len(input)) { - t.Fatalf("r.WriteTo(w) = %d, %v, want %d, nil", n, err, len(input)) - } - - for i, val := range w.Bytes() { - if val != input[i] { - t.Errorf("after write: out[%d] = %#x, want %#x", i, val, input[i]) - } - } -} - -type errorWriterToTest struct { - rn, wn int - rerr, werr error - expected error -} - -func (r errorWriterToTest) Read(p []byte) (int, error) { - return len(p) * r.rn, r.rerr -} - -func (w errorWriterToTest) Write(p []byte) (int, error) { - return len(p) * w.wn, w.werr -} - -var errorWriterToTests = []errorWriterToTest{ - {1, 0, nil, io.ErrClosedPipe, io.ErrClosedPipe}, - {0, 1, io.ErrClosedPipe, nil, io.ErrClosedPipe}, - {0, 0, io.ErrUnexpectedEOF, io.ErrClosedPipe, io.ErrClosedPipe}, - {0, 1, io.EOF, nil, nil}, -} - -func TestReaderWriteToErrors(t *testing.T) { - for i, rw := range errorWriterToTests { - r := NewReader(rw) - if _, err := r.WriteTo(rw); err != rw.expected { - t.Errorf("r.WriteTo(errorWriterToTests[%d]) = _, %v, want _,%v", i, err, rw.expected) - } - } -} - -func TestWriterReadFrom(t *testing.T) { - ws := []func(io.Writer) io.Writer{ - func(w io.Writer) io.Writer { return onlyWriter{w} }, - func(w io.Writer) io.Writer { return w }, - } - - rs := []func(io.Reader) io.Reader{ - iotest.DataErrReader, - func(r io.Reader) io.Reader { return r }, - } - - for ri, rfunc := range rs { - for wi, wfunc := range ws { - input := createTestInput(8192) - b := new(bytes.Buffer) - w := NewWriter(wfunc(b)) - r := rfunc(bytes.NewReader(input)) - if n, err := w.ReadFrom(r); err != nil || n != int64(len(input)) { - t.Errorf("ws[%d],rs[%d]: w.ReadFrom(r) = %d, %v, want %d, nil", wi, ri, n, err, len(input)) - continue - } - if err := w.Flush(); err != nil { - t.Errorf("Flush returned %v", err) - continue - } - if got, want := b.String(), string(input); got != want { - t.Errorf("ws[%d], rs[%d]:\ngot %q\nwant %q\n", wi, ri, got, want) - } - } - } -} - -type errorReaderFromTest struct { - rn, wn int - rerr, werr error - expected error -} - -func (r errorReaderFromTest) Read(p []byte) (int, error) { - return len(p) * r.rn, r.rerr -} - -func (w errorReaderFromTest) Write(p []byte) (int, error) { - return len(p) * w.wn, w.werr -} - -var errorReaderFromTests = []errorReaderFromTest{ - {0, 1, io.EOF, nil, nil}, - {1, 1, io.EOF, nil, nil}, - {0, 1, io.ErrClosedPipe, nil, io.ErrClosedPipe}, - {0, 0, io.ErrClosedPipe, io.ErrShortWrite, io.ErrClosedPipe}, - {1, 0, nil, io.ErrShortWrite, io.ErrShortWrite}, -} - -func TestWriterReadFromErrors(t *testing.T) { - for i, rw := range errorReaderFromTests { - w := NewWriter(rw) - if _, err := w.ReadFrom(rw); err != rw.expected { - t.Errorf("w.ReadFrom(errorReaderFromTests[%d]) = _, %v, want _,%v", i, err, rw.expected) - } - } -} - -// TestWriterReadFromCounts tests that using io.Copy to copy into a -// bufio.Writer does not prematurely flush the buffer. For example, when -// buffering writes to a network socket, excessive network writes should be -// avoided. -func TestWriterReadFromCounts(t *testing.T) { - var w0 writeCountingDiscard - b0 := NewWriterSize(&w0, 1234) - b0.WriteString(strings.Repeat("x", 1000)) - if w0 != 0 { - t.Fatalf("write 1000 'x's: got %d writes, want 0", w0) - } - b0.WriteString(strings.Repeat("x", 200)) - if w0 != 0 { - t.Fatalf("write 1200 'x's: got %d writes, want 0", w0) - } - io.Copy(b0, onlyReader{strings.NewReader(strings.Repeat("x", 30))}) - if w0 != 0 { - t.Fatalf("write 1230 'x's: got %d writes, want 0", w0) - } - io.Copy(b0, onlyReader{strings.NewReader(strings.Repeat("x", 9))}) - if w0 != 1 { - t.Fatalf("write 1239 'x's: got %d writes, want 1", w0) - } - - var w1 writeCountingDiscard - b1 := NewWriterSize(&w1, 1234) - b1.WriteString(strings.Repeat("x", 1200)) - b1.Flush() - if w1 != 1 { - t.Fatalf("flush 1200 'x's: got %d writes, want 1", w1) - } - b1.WriteString(strings.Repeat("x", 89)) - if w1 != 1 { - t.Fatalf("write 1200 + 89 'x's: got %d writes, want 1", w1) - } - io.Copy(b1, onlyReader{strings.NewReader(strings.Repeat("x", 700))}) - if w1 != 1 { - t.Fatalf("write 1200 + 789 'x's: got %d writes, want 1", w1) - } - io.Copy(b1, onlyReader{strings.NewReader(strings.Repeat("x", 600))}) - if w1 != 2 { - t.Fatalf("write 1200 + 1389 'x's: got %d writes, want 2", w1) - } - b1.Flush() - if w1 != 3 { - t.Fatalf("flush 1200 + 1389 'x's: got %d writes, want 3", w1) - } -} - -// A writeCountingDiscard is like ioutil.Discard and counts the number of times -// Write is called on it. -type writeCountingDiscard int - -func (w *writeCountingDiscard) Write(p []byte) (int, error) { - *w++ - return len(p), nil -} - -type negativeReader int - -func (r *negativeReader) Read([]byte) (int, error) { return -1, nil } - -func TestNegativeRead(t *testing.T) { - // should panic with a description pointing at the reader, not at itself. - // (should NOT panic with slice index error, for example.) - b := NewReader(new(negativeReader)) - defer func() { - switch err := recover().(type) { - case nil: - t.Fatal("read did not panic") - case error: - if !strings.Contains(err.Error(), "reader returned negative count from Read") { - t.Fatalf("wrong panic: %v", err) - } - default: - t.Fatalf("unexpected panic value: %T(%v)", err, err) - } - }() - b.Read(make([]byte, 100)) -} - -var errFake = errors.New("fake error") - -type errorThenGoodReader struct { - didErr bool - nread int -} - -func (r *errorThenGoodReader) Read(p []byte) (int, error) { - r.nread++ - if !r.didErr { - r.didErr = true - return 0, errFake - } - return len(p), nil -} - -func TestReaderClearError(t *testing.T) { - r := &errorThenGoodReader{} - b := NewReader(r) - buf := make([]byte, 1) - if _, err := b.Read(nil); err != nil { - t.Fatalf("1st nil Read = %v; want nil", err) - } - if _, err := b.Read(buf); err != errFake { - t.Fatalf("1st Read = %v; want errFake", err) - } - if _, err := b.Read(nil); err != nil { - t.Fatalf("2nd nil Read = %v; want nil", err) - } - if _, err := b.Read(buf); err != nil { - t.Fatalf("3rd Read with buffer = %v; want nil", err) - } - if r.nread != 2 { - t.Errorf("num reads = %d; want 2", r.nread) - } -} - -// Test for golang.org/issue/5947 -func TestWriterReadFromWhileFull(t *testing.T) { - buf := new(bytes.Buffer) - w := NewWriterSize(buf, 10) - - // Fill buffer exactly. - n, err := w.Write([]byte("0123456789")) - if n != 10 || err != nil { - t.Fatalf("Write returned (%v, %v), want (10, nil)", n, err) - } - - // Use ReadFrom to read in some data. - n2, err := w.ReadFrom(strings.NewReader("abcdef")) - if n2 != 6 || err != nil { - t.Fatalf("ReadFrom returned (%v, %v), want (6, nil)", n2, err) - } -} - -type emptyThenNonEmptyReader struct { - r io.Reader - n int -} - -func (r *emptyThenNonEmptyReader) Read(p []byte) (int, error) { - if r.n <= 0 { - return r.r.Read(p) - } - r.n-- - return 0, nil -} - -// Test for golang.org/issue/7611 -func TestWriterReadFromUntilEOF(t *testing.T) { - buf := new(bytes.Buffer) - w := NewWriterSize(buf, 5) - - // Partially fill buffer - n, err := w.Write([]byte("0123")) - if n != 4 || err != nil { - t.Fatalf("Write returned (%v, %v), want (4, nil)", n, err) - } - - // Use ReadFrom to read in some data. - r := &emptyThenNonEmptyReader{r: strings.NewReader("abcd"), n: 3} - n2, err := w.ReadFrom(r) - if n2 != 4 || err != nil { - t.Fatalf("ReadFrom returned (%v, %v), want (4, nil)", n2, err) - } - w.Flush() - if got, want := string(buf.Bytes()), "0123abcd"; got != want { - t.Fatalf("buf.Bytes() returned %q, want %q", got, want) - } -} - -func TestWriterReadFromErrNoProgress(t *testing.T) { - buf := new(bytes.Buffer) - w := NewWriterSize(buf, 5) - - // Partially fill buffer - n, err := w.Write([]byte("0123")) - if n != 4 || err != nil { - t.Fatalf("Write returned (%v, %v), want (4, nil)", n, err) - } - - // Use ReadFrom to read in some data. - r := &emptyThenNonEmptyReader{r: strings.NewReader("abcd"), n: 100} - n2, err := w.ReadFrom(r) - if n2 != 0 || err != io.ErrNoProgress { - t.Fatalf("buf.Bytes() returned (%v, %v), want (0, io.ErrNoProgress)", n2, err) - } -} - -func TestReaderReset(t *testing.T) { - r := NewReader(strings.NewReader("foo foo")) - buf := make([]byte, 3) - r.Read(buf) - if string(buf) != "foo" { - t.Errorf("buf = %q; want foo", buf) - } - r.Reset(strings.NewReader("bar bar")) - all, err := ioutil.ReadAll(r) - if err != nil { - t.Fatal(err) - } - if string(all) != "bar bar" { - t.Errorf("ReadAll = %q; want bar bar", all) - } -} - -func TestWriterReset(t *testing.T) { - var buf1, buf2 bytes.Buffer - w := NewWriter(&buf1) - w.WriteString("foo") - w.Reset(&buf2) // and not flushed - w.WriteString("bar") - w.Flush() - if buf1.String() != "" { - t.Errorf("buf1 = %q; want empty", buf1.String()) - } - if buf2.String() != "bar" { - t.Errorf("buf2 = %q; want bar", buf2.String()) - } -} - -func TestReaderDiscard(t *testing.T) { - tests := []struct { - name string - r io.Reader - bufSize int // 0 means 16 - peekSize int - - n int // input to Discard - - want int // from Discard - wantErr error // from Discard - - wantBuffered int - }{ - { - name: "normal case", - r: strings.NewReader("abcdefghijklmnopqrstuvwxyz"), - peekSize: 16, - n: 6, - want: 6, - wantBuffered: 10, - }, - { - name: "discard causing read", - r: strings.NewReader("abcdefghijklmnopqrstuvwxyz"), - n: 6, - want: 6, - wantBuffered: 10, - }, - { - name: "discard all without peek", - r: strings.NewReader("abcdefghijklmnopqrstuvwxyz"), - n: 26, - want: 26, - wantBuffered: 0, - }, - { - name: "discard more than end", - r: strings.NewReader("abcdefghijklmnopqrstuvwxyz"), - n: 27, - want: 26, - wantErr: io.EOF, - wantBuffered: 0, - }, - // Any error from filling shouldn't show up until we - // get past the valid bytes. Here we return we return 5 valid bytes at the same time - // as an error, but test that we don't see the error from Discard. - { - name: "fill error, discard less", - r: newScriptedReader(func(p []byte) (n int, err error) { - if len(p) < 5 { - panic("unexpected small read") - } - return 5, errors.New("5-then-error") - }), - n: 4, - want: 4, - wantErr: nil, - wantBuffered: 1, - }, - { - name: "fill error, discard equal", - r: newScriptedReader(func(p []byte) (n int, err error) { - if len(p) < 5 { - panic("unexpected small read") - } - return 5, errors.New("5-then-error") - }), - n: 5, - want: 5, - wantErr: nil, - wantBuffered: 0, - }, - { - name: "fill error, discard more", - r: newScriptedReader(func(p []byte) (n int, err error) { - if len(p) < 5 { - panic("unexpected small read") - } - return 5, errors.New("5-then-error") - }), - n: 6, - want: 5, - wantErr: errors.New("5-then-error"), - wantBuffered: 0, - }, - // Discard of 0 shouldn't cause a read: - { - name: "discard zero", - r: newScriptedReader(), // will panic on Read - n: 0, - want: 0, - wantErr: nil, - wantBuffered: 0, - }, - { - name: "discard negative", - r: newScriptedReader(), // will panic on Read - n: -1, - want: 0, - wantErr: ErrNegativeCount, - wantBuffered: 0, - }, - } - for _, tt := range tests { - br := NewReaderSize(tt.r, tt.bufSize) - if tt.peekSize > 0 { - peekBuf, err := br.Peek(tt.peekSize) - if err != nil { - t.Errorf("%s: Peek(%d): %v", tt.name, tt.peekSize, err) - continue - } - if len(peekBuf) != tt.peekSize { - t.Errorf("%s: len(Peek(%d)) = %v; want %v", tt.name, tt.peekSize, len(peekBuf), tt.peekSize) - continue - } - } - discarded, err := br.Discard(tt.n) - if ge, we := fmt.Sprint(err), fmt.Sprint(tt.wantErr); discarded != tt.want || ge != we { - t.Errorf("%s: Discard(%d) = (%v, %v); want (%v, %v)", tt.name, tt.n, discarded, ge, tt.want, we) - continue - } - if bn := br.Buffered(); bn != tt.wantBuffered { - t.Errorf("%s: after Discard, Buffered = %d; want %d", tt.name, bn, tt.wantBuffered) - } - } - -} - -// An onlyReader only implements io.Reader, no matter what other methods the underlying implementation may have. -type onlyReader struct { - io.Reader -} - -// An onlyWriter only implements io.Writer, no matter what other methods the underlying implementation may have. -type onlyWriter struct { - io.Writer -} - -// A scriptedReader is an io.Reader that executes its steps sequentially. -type scriptedReader []func(p []byte) (n int, err error) - -func (sr *scriptedReader) Read(p []byte) (n int, err error) { - if len(*sr) == 0 { - panic("too many Read calls on scripted Reader. No steps remain.") - } - step := (*sr)[0] - *sr = (*sr)[1:] - return step(p) -} - -func newScriptedReader(steps ...func(p []byte) (n int, err error)) io.Reader { - sr := scriptedReader(steps) - return &sr -} - -func BenchmarkReaderCopyOptimal(b *testing.B) { - // Optimal case is where the underlying reader implements io.WriterTo - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - src := NewReader(srcBuf) - dstBuf := new(bytes.Buffer) - dst := onlyWriter{dstBuf} - for i := 0; i < b.N; i++ { - srcBuf.Reset() - src.Reset(srcBuf) - dstBuf.Reset() - io.Copy(dst, src) - } -} - -func BenchmarkReaderCopyUnoptimal(b *testing.B) { - // Unoptimal case is where the underlying reader doesn't implement io.WriterTo - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - src := NewReader(onlyReader{srcBuf}) - dstBuf := new(bytes.Buffer) - dst := onlyWriter{dstBuf} - for i := 0; i < b.N; i++ { - srcBuf.Reset() - src.Reset(onlyReader{srcBuf}) - dstBuf.Reset() - io.Copy(dst, src) - } -} - -func BenchmarkReaderCopyNoWriteTo(b *testing.B) { - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - srcReader := NewReader(srcBuf) - src := onlyReader{srcReader} - dstBuf := new(bytes.Buffer) - dst := onlyWriter{dstBuf} - for i := 0; i < b.N; i++ { - srcBuf.Reset() - srcReader.Reset(srcBuf) - dstBuf.Reset() - io.Copy(dst, src) - } -} - -func BenchmarkReaderWriteToOptimal(b *testing.B) { - const bufSize = 16 << 10 - buf := make([]byte, bufSize) - r := bytes.NewReader(buf) - srcReader := NewReaderSize(onlyReader{r}, 1<<10) - if _, ok := ioutil.Discard.(io.ReaderFrom); !ok { - b.Fatal("ioutil.Discard doesn't support ReaderFrom") - } - for i := 0; i < b.N; i++ { - r.Seek(0, 0) - srcReader.Reset(onlyReader{r}) - n, err := srcReader.WriteTo(ioutil.Discard) - if err != nil { - b.Fatal(err) - } - if n != bufSize { - b.Fatalf("n = %d; want %d", n, bufSize) - } - } -} - -func BenchmarkWriterCopyOptimal(b *testing.B) { - // Optimal case is where the underlying writer implements io.ReaderFrom - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - src := onlyReader{srcBuf} - dstBuf := new(bytes.Buffer) - dst := NewWriter(dstBuf) - for i := 0; i < b.N; i++ { - srcBuf.Reset() - dstBuf.Reset() - dst.Reset(dstBuf) - io.Copy(dst, src) - } -} - -func BenchmarkWriterCopyUnoptimal(b *testing.B) { - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - src := onlyReader{srcBuf} - dstBuf := new(bytes.Buffer) - dst := NewWriter(onlyWriter{dstBuf}) - for i := 0; i < b.N; i++ { - srcBuf.Reset() - dstBuf.Reset() - dst.Reset(onlyWriter{dstBuf}) - io.Copy(dst, src) - } -} - -func BenchmarkWriterCopyNoReadFrom(b *testing.B) { - srcBuf := bytes.NewBuffer(make([]byte, 8192)) - src := onlyReader{srcBuf} - dstBuf := new(bytes.Buffer) - dstWriter := NewWriter(dstBuf) - dst := onlyWriter{dstWriter} - for i := 0; i < b.N; i++ { - srcBuf.Reset() - dstBuf.Reset() - dstWriter.Reset(dstBuf) - io.Copy(dst, src) - } -} - -func BenchmarkReaderEmpty(b *testing.B) { - b.ReportAllocs() - str := strings.Repeat("x", 16<<10) - for i := 0; i < b.N; i++ { - br := NewReader(strings.NewReader(str)) - n, err := io.Copy(ioutil.Discard, br) - if err != nil { - b.Fatal(err) - } - if n != int64(len(str)) { - b.Fatal("wrong length") - } - } -} - -func BenchmarkWriterEmpty(b *testing.B) { - b.ReportAllocs() - str := strings.Repeat("x", 1<<10) - bs := []byte(str) - for i := 0; i < b.N; i++ { - bw := NewWriter(ioutil.Discard) - bw.Flush() - bw.WriteByte('a') - bw.Flush() - bw.WriteRune('B') - bw.Flush() - bw.Write(bs) - bw.Flush() - bw.WriteString(str) - bw.Flush() - } -} - -func BenchmarkWriterFlush(b *testing.B) { - b.ReportAllocs() - bw := NewWriter(ioutil.Discard) - str := strings.Repeat("x", 50) - for i := 0; i < b.N; i++ { - bw.WriteString(str) - bw.Flush() - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/example_test.go b/llgo/third_party/gofrontend/libgo/go/bufio/example_test.go deleted file mode 100644 index 3da914142194895ea37e660c621d3835fb251a86..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/example_test.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bufio_test - -import ( - "bufio" - "fmt" - "os" - "strconv" - "strings" -) - -func ExampleWriter() { - w := bufio.NewWriter(os.Stdout) - fmt.Fprint(w, "Hello, ") - fmt.Fprint(w, "world!") - w.Flush() // Don't forget to flush! - // Output: Hello, world! -} - -// The simplest use of a Scanner, to read standard input as a set of lines. -func ExampleScanner_lines() { - scanner := bufio.NewScanner(os.Stdin) - for scanner.Scan() { - fmt.Println(scanner.Text()) // Println will add back the final '\n' - } - if err := scanner.Err(); err != nil { - fmt.Fprintln(os.Stderr, "reading standard input:", err) - } -} - -// Use a Scanner to implement a simple word-count utility by scanning the -// input as a sequence of space-delimited tokens. -func ExampleScanner_words() { - // An artificial input source. - const input = "Now is the winter of our discontent,\nMade glorious summer by this sun of York.\n" - scanner := bufio.NewScanner(strings.NewReader(input)) - // Set the split function for the scanning operation. - scanner.Split(bufio.ScanWords) - // Count the words. - count := 0 - for scanner.Scan() { - count++ - } - if err := scanner.Err(); err != nil { - fmt.Fprintln(os.Stderr, "reading input:", err) - } - fmt.Printf("%d\n", count) - // Output: 15 -} - -// Use a Scanner with a custom split function (built by wrapping ScanWords) to validate -// 32-bit decimal input. -func ExampleScanner_custom() { - // An artificial input source. - const input = "1234 5678 1234567901234567890" - scanner := bufio.NewScanner(strings.NewReader(input)) - // Create a custom split function by wrapping the existing ScanWords function. - split := func(data []byte, atEOF bool) (advance int, token []byte, err error) { - advance, token, err = bufio.ScanWords(data, atEOF) - if err == nil && token != nil { - _, err = strconv.ParseInt(string(token), 10, 32) - } - return - } - // Set the split function for the scanning operation. - scanner.Split(split) - // Validate the input - for scanner.Scan() { - fmt.Printf("%s\n", scanner.Text()) - } - - if err := scanner.Err(); err != nil { - fmt.Printf("Invalid input: %s", err) - } - // Output: - // 1234 - // 5678 - // Invalid input: strconv.ParseInt: parsing "1234567901234567890": value out of range -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/export_test.go b/llgo/third_party/gofrontend/libgo/go/bufio/export_test.go deleted file mode 100644 index 3d3bb27d8da51b72e343579b1e54b115b3becb9a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/export_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bufio - -// Exported for testing only. -import ( - "unicode/utf8" -) - -var IsSpace = isSpace - -func (s *Scanner) MaxTokenSize(n int) { - if n < utf8.UTFMax || n > 1e9 { - panic("bad max token size") - } - if n < len(s.buf) { - s.buf = make([]byte, n) - } - s.maxTokenSize = n -} - -// ErrOrEOF is like Err, but returns EOF. Used to test a corner case. -func (s *Scanner) ErrOrEOF() error { - return s.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/scan.go b/llgo/third_party/gofrontend/libgo/go/bufio/scan.go deleted file mode 100644 index 7a349fa8fab7e5d0a7dc37c12af4cb8279b2a612..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/scan.go +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bufio - -import ( - "bytes" - "errors" - "io" - "unicode/utf8" -) - -// Scanner provides a convenient interface for reading data such as -// a file of newline-delimited lines of text. Successive calls to -// the Scan method will step through the 'tokens' of a file, skipping -// the bytes between the tokens. The specification of a token is -// defined by a split function of type SplitFunc; the default split -// function breaks the input into lines with line termination stripped. Split -// functions are defined in this package for scanning a file into -// lines, bytes, UTF-8-encoded runes, and space-delimited words. The -// client may instead provide a custom split function. -// -// Scanning stops unrecoverably at EOF, the first I/O error, or a token too -// large to fit in the buffer. When a scan stops, the reader may have -// advanced arbitrarily far past the last token. Programs that need more -// control over error handling or large tokens, or must run sequential scans -// on a reader, should use bufio.Reader instead. -// -type Scanner struct { - r io.Reader // The reader provided by the client. - split SplitFunc // The function to split the tokens. - maxTokenSize int // Maximum size of a token; modified by tests. - token []byte // Last token returned by split. - buf []byte // Buffer used as argument to split. - start int // First non-processed byte in buf. - end int // End of data in buf. - err error // Sticky error. - empties int // Count of successive empty tokens. -} - -// SplitFunc is the signature of the split function used to tokenize the -// input. The arguments are an initial substring of the remaining unprocessed -// data and a flag, atEOF, that reports whether the Reader has no more data -// to give. The return values are the number of bytes to advance the input -// and the next token to return to the user, plus an error, if any. If the -// data does not yet hold a complete token, for instance if it has no newline -// while scanning lines, SplitFunc can return (0, nil, nil) to signal the -// Scanner to read more data into the slice and try again with a longer slice -// starting at the same point in the input. -// -// If the returned error is non-nil, scanning stops and the error -// is returned to the client. -// -// The function is never called with an empty data slice unless atEOF -// is true. If atEOF is true, however, data may be non-empty and, -// as always, holds unprocessed text. -type SplitFunc func(data []byte, atEOF bool) (advance int, token []byte, err error) - -// Errors returned by Scanner. -var ( - ErrTooLong = errors.New("bufio.Scanner: token too long") - ErrNegativeAdvance = errors.New("bufio.Scanner: SplitFunc returns negative advance count") - ErrAdvanceTooFar = errors.New("bufio.Scanner: SplitFunc returns advance count beyond input") -) - -const ( - // MaxScanTokenSize is the maximum size used to buffer a token. - // The actual maximum token size may be smaller as the buffer - // may need to include, for instance, a newline. - MaxScanTokenSize = 64 * 1024 -) - -// NewScanner returns a new Scanner to read from r. -// The split function defaults to ScanLines. -func NewScanner(r io.Reader) *Scanner { - return &Scanner{ - r: r, - split: ScanLines, - maxTokenSize: MaxScanTokenSize, - buf: make([]byte, 4096), // Plausible starting size; needn't be large. - } -} - -// Err returns the first non-EOF error that was encountered by the Scanner. -func (s *Scanner) Err() error { - if s.err == io.EOF { - return nil - } - return s.err -} - -// Bytes returns the most recent token generated by a call to Scan. -// The underlying array may point to data that will be overwritten -// by a subsequent call to Scan. It does no allocation. -func (s *Scanner) Bytes() []byte { - return s.token -} - -// Text returns the most recent token generated by a call to Scan -// as a newly allocated string holding its bytes. -func (s *Scanner) Text() string { - return string(s.token) -} - -// Scan advances the Scanner to the next token, which will then be -// available through the Bytes or Text method. It returns false when the -// scan stops, either by reaching the end of the input or an error. -// After Scan returns false, the Err method will return any error that -// occurred during scanning, except that if it was io.EOF, Err -// will return nil. -// Scan panics if the split function returns 100 empty tokens without -// advancing the input. This is a common error mode for scanners. -func (s *Scanner) Scan() bool { - // Loop until we have a token. - for { - // See if we can get a token with what we already have. - // If we've run out of data but have an error, give the split function - // a chance to recover any remaining, possibly empty token. - if s.end > s.start || s.err != nil { - advance, token, err := s.split(s.buf[s.start:s.end], s.err != nil) - if err != nil { - s.setErr(err) - return false - } - if !s.advance(advance) { - return false - } - s.token = token - if token != nil { - if s.err == nil || advance > 0 { - s.empties = 0 - } else { - // Returning tokens not advancing input at EOF. - s.empties++ - if s.empties > 100 { - panic("bufio.Scan: 100 empty tokens without progressing") - } - } - return true - } - } - // We cannot generate a token with what we are holding. - // If we've already hit EOF or an I/O error, we are done. - if s.err != nil { - // Shut it down. - s.start = 0 - s.end = 0 - return false - } - // Must read more data. - // First, shift data to beginning of buffer if there's lots of empty space - // or space is needed. - if s.start > 0 && (s.end == len(s.buf) || s.start > len(s.buf)/2) { - copy(s.buf, s.buf[s.start:s.end]) - s.end -= s.start - s.start = 0 - } - // Is the buffer full? If so, resize. - if s.end == len(s.buf) { - if len(s.buf) >= s.maxTokenSize { - s.setErr(ErrTooLong) - return false - } - newSize := len(s.buf) * 2 - if newSize > s.maxTokenSize { - newSize = s.maxTokenSize - } - newBuf := make([]byte, newSize) - copy(newBuf, s.buf[s.start:s.end]) - s.buf = newBuf - s.end -= s.start - s.start = 0 - continue - } - // Finally we can read some input. Make sure we don't get stuck with - // a misbehaving Reader. Officially we don't need to do this, but let's - // be extra careful: Scanner is for safe, simple jobs. - for loop := 0; ; { - n, err := s.r.Read(s.buf[s.end:len(s.buf)]) - s.end += n - if err != nil { - s.setErr(err) - break - } - if n > 0 { - s.empties = 0 - break - } - loop++ - if loop > maxConsecutiveEmptyReads { - s.setErr(io.ErrNoProgress) - break - } - } - } -} - -// advance consumes n bytes of the buffer. It reports whether the advance was legal. -func (s *Scanner) advance(n int) bool { - if n < 0 { - s.setErr(ErrNegativeAdvance) - return false - } - if n > s.end-s.start { - s.setErr(ErrAdvanceTooFar) - return false - } - s.start += n - return true -} - -// setErr records the first error encountered. -func (s *Scanner) setErr(err error) { - if s.err == nil || s.err == io.EOF { - s.err = err - } -} - -// Split sets the split function for the Scanner. If called, it must be -// called before Scan. The default split function is ScanLines. -func (s *Scanner) Split(split SplitFunc) { - s.split = split -} - -// Split functions - -// ScanBytes is a split function for a Scanner that returns each byte as a token. -func ScanBytes(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF && len(data) == 0 { - return 0, nil, nil - } - return 1, data[0:1], nil -} - -var errorRune = []byte(string(utf8.RuneError)) - -// ScanRunes is a split function for a Scanner that returns each -// UTF-8-encoded rune as a token. The sequence of runes returned is -// equivalent to that from a range loop over the input as a string, which -// means that erroneous UTF-8 encodings translate to U+FFFD = "\xef\xbf\xbd". -// Because of the Scan interface, this makes it impossible for the client to -// distinguish correctly encoded replacement runes from encoding errors. -func ScanRunes(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF && len(data) == 0 { - return 0, nil, nil - } - - // Fast path 1: ASCII. - if data[0] < utf8.RuneSelf { - return 1, data[0:1], nil - } - - // Fast path 2: Correct UTF-8 decode without error. - _, width := utf8.DecodeRune(data) - if width > 1 { - // It's a valid encoding. Width cannot be one for a correctly encoded - // non-ASCII rune. - return width, data[0:width], nil - } - - // We know it's an error: we have width==1 and implicitly r==utf8.RuneError. - // Is the error because there wasn't a full rune to be decoded? - // FullRune distinguishes correctly between erroneous and incomplete encodings. - if !atEOF && !utf8.FullRune(data) { - // Incomplete; get more bytes. - return 0, nil, nil - } - - // We have a real UTF-8 encoding error. Return a properly encoded error rune - // but advance only one byte. This matches the behavior of a range loop over - // an incorrectly encoded string. - return 1, errorRune, nil -} - -// dropCR drops a terminal \r from the data. -func dropCR(data []byte) []byte { - if len(data) > 0 && data[len(data)-1] == '\r' { - return data[0 : len(data)-1] - } - return data -} - -// ScanLines is a split function for a Scanner that returns each line of -// text, stripped of any trailing end-of-line marker. The returned line may -// be empty. The end-of-line marker is one optional carriage return followed -// by one mandatory newline. In regular expression notation, it is `\r?\n`. -// The last non-empty line of input will be returned even if it has no -// newline. -func ScanLines(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF && len(data) == 0 { - return 0, nil, nil - } - if i := bytes.IndexByte(data, '\n'); i >= 0 { - // We have a full newline-terminated line. - return i + 1, dropCR(data[0:i]), nil - } - // If we're at EOF, we have a final, non-terminated line. Return it. - if atEOF { - return len(data), dropCR(data), nil - } - // Request more data. - return 0, nil, nil -} - -// isSpace reports whether the character is a Unicode white space character. -// We avoid dependency on the unicode package, but check validity of the implementation -// in the tests. -func isSpace(r rune) bool { - if r <= '\u00FF' { - // Obvious ASCII ones: \t through \r plus space. Plus two Latin-1 oddballs. - switch r { - case ' ', '\t', '\n', '\v', '\f', '\r': - return true - case '\u0085', '\u00A0': - return true - } - return false - } - // High-valued ones. - if '\u2000' <= r && r <= '\u200a' { - return true - } - switch r { - case '\u1680', '\u2028', '\u2029', '\u202f', '\u205f', '\u3000': - return true - } - return false -} - -// ScanWords is a split function for a Scanner that returns each -// space-separated word of text, with surrounding spaces deleted. It will -// never return an empty string. The definition of space is set by -// unicode.IsSpace. -func ScanWords(data []byte, atEOF bool) (advance int, token []byte, err error) { - // Skip leading spaces. - start := 0 - for width := 0; start < len(data); start += width { - var r rune - r, width = utf8.DecodeRune(data[start:]) - if !isSpace(r) { - break - } - } - // Scan until space, marking end of word. - for width, i := 0, start; i < len(data); i += width { - var r rune - r, width = utf8.DecodeRune(data[i:]) - if isSpace(r) { - return i + width, data[start:i], nil - } - } - // If we're at EOF, we have a final, non-empty, non-terminated word. Return it. - if atEOF && len(data) > start { - return len(data), data[start:], nil - } - // Request more data. - return start, nil, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/bufio/scan_test.go b/llgo/third_party/gofrontend/libgo/go/bufio/scan_test.go deleted file mode 100644 index eea87cbf7b39de26059bb7f1dd673b37820d868e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bufio/scan_test.go +++ /dev/null @@ -1,524 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bufio_test - -import ( - . "bufio" - "bytes" - "errors" - "io" - "strings" - "testing" - "unicode" - "unicode/utf8" -) - -const smallMaxTokenSize = 256 // Much smaller for more efficient testing. - -// Test white space table matches the Unicode definition. -func TestSpace(t *testing.T) { - for r := rune(0); r <= utf8.MaxRune; r++ { - if IsSpace(r) != unicode.IsSpace(r) { - t.Fatalf("white space property disagrees: %#U should be %t", r, unicode.IsSpace(r)) - } - } -} - -var scanTests = []string{ - "", - "a", - "¼", - "☹", - "\x81", // UTF-8 error - "\uFFFD", // correctly encoded RuneError - "abcdefgh", - "abc def\n\t\tgh ", - "abc¼☹\x81\uFFFD日本語\x82abc", -} - -func TestScanByte(t *testing.T) { - for n, test := range scanTests { - buf := strings.NewReader(test) - s := NewScanner(buf) - s.Split(ScanBytes) - var i int - for i = 0; s.Scan(); i++ { - if b := s.Bytes(); len(b) != 1 || b[0] != test[i] { - t.Errorf("#%d: %d: expected %q got %q", n, i, test, b) - } - } - if i != len(test) { - t.Errorf("#%d: termination expected at %d; got %d", n, len(test), i) - } - err := s.Err() - if err != nil { - t.Errorf("#%d: %v", n, err) - } - } -} - -// Test that the rune splitter returns same sequence of runes (not bytes) as for range string. -func TestScanRune(t *testing.T) { - for n, test := range scanTests { - buf := strings.NewReader(test) - s := NewScanner(buf) - s.Split(ScanRunes) - var i, runeCount int - var expect rune - // Use a string range loop to validate the sequence of runes. - for i, expect = range string(test) { - if !s.Scan() { - break - } - runeCount++ - got, _ := utf8.DecodeRune(s.Bytes()) - if got != expect { - t.Errorf("#%d: %d: expected %q got %q", n, i, expect, got) - } - } - if s.Scan() { - t.Errorf("#%d: scan ran too long, got %q", n, s.Text()) - } - testRuneCount := utf8.RuneCountInString(test) - if runeCount != testRuneCount { - t.Errorf("#%d: termination expected at %d; got %d", n, testRuneCount, runeCount) - } - err := s.Err() - if err != nil { - t.Errorf("#%d: %v", n, err) - } - } -} - -var wordScanTests = []string{ - "", - " ", - "\n", - "a", - " a ", - "abc def", - " abc def ", - " abc\tdef\nghi\rjkl\fmno\vpqr\u0085stu\u00a0\n", -} - -// Test that the word splitter returns the same data as strings.Fields. -func TestScanWords(t *testing.T) { - for n, test := range wordScanTests { - buf := strings.NewReader(test) - s := NewScanner(buf) - s.Split(ScanWords) - words := strings.Fields(test) - var wordCount int - for wordCount = 0; wordCount < len(words); wordCount++ { - if !s.Scan() { - break - } - got := s.Text() - if got != words[wordCount] { - t.Errorf("#%d: %d: expected %q got %q", n, wordCount, words[wordCount], got) - } - } - if s.Scan() { - t.Errorf("#%d: scan ran too long, got %q", n, s.Text()) - } - if wordCount != len(words) { - t.Errorf("#%d: termination expected at %d; got %d", n, len(words), wordCount) - } - err := s.Err() - if err != nil { - t.Errorf("#%d: %v", n, err) - } - } -} - -// slowReader is a reader that returns only a few bytes at a time, to test the incremental -// reads in Scanner.Scan. -type slowReader struct { - max int - buf io.Reader -} - -func (sr *slowReader) Read(p []byte) (n int, err error) { - if len(p) > sr.max { - p = p[0:sr.max] - } - return sr.buf.Read(p) -} - -// genLine writes to buf a predictable but non-trivial line of text of length -// n, including the terminal newline and an occasional carriage return. -// If addNewline is false, the \r and \n are not emitted. -func genLine(buf *bytes.Buffer, lineNum, n int, addNewline bool) { - buf.Reset() - doCR := lineNum%5 == 0 - if doCR { - n-- - } - for i := 0; i < n-1; i++ { // Stop early for \n. - c := 'a' + byte(lineNum+i) - if c == '\n' || c == '\r' { // Don't confuse us. - c = 'N' - } - buf.WriteByte(c) - } - if addNewline { - if doCR { - buf.WriteByte('\r') - } - buf.WriteByte('\n') - } - return -} - -// Test the line splitter, including some carriage returns but no long lines. -func TestScanLongLines(t *testing.T) { - // Build a buffer of lots of line lengths up to but not exceeding smallMaxTokenSize. - tmp := new(bytes.Buffer) - buf := new(bytes.Buffer) - lineNum := 0 - j := 0 - for i := 0; i < 2*smallMaxTokenSize; i++ { - genLine(tmp, lineNum, j, true) - if j < smallMaxTokenSize { - j++ - } else { - j-- - } - buf.Write(tmp.Bytes()) - lineNum++ - } - s := NewScanner(&slowReader{1, buf}) - s.Split(ScanLines) - s.MaxTokenSize(smallMaxTokenSize) - j = 0 - for lineNum := 0; s.Scan(); lineNum++ { - genLine(tmp, lineNum, j, false) - if j < smallMaxTokenSize { - j++ - } else { - j-- - } - line := tmp.String() // We use the string-valued token here, for variety. - if s.Text() != line { - t.Errorf("%d: bad line: %d %d\n%.100q\n%.100q\n", lineNum, len(s.Bytes()), len(line), s.Text(), line) - } - } - err := s.Err() - if err != nil { - t.Fatal(err) - } -} - -// Test that the line splitter errors out on a long line. -func TestScanLineTooLong(t *testing.T) { - const smallMaxTokenSize = 256 // Much smaller for more efficient testing. - // Build a buffer of lots of line lengths up to but not exceeding smallMaxTokenSize. - tmp := new(bytes.Buffer) - buf := new(bytes.Buffer) - lineNum := 0 - j := 0 - for i := 0; i < 2*smallMaxTokenSize; i++ { - genLine(tmp, lineNum, j, true) - j++ - buf.Write(tmp.Bytes()) - lineNum++ - } - s := NewScanner(&slowReader{3, buf}) - s.Split(ScanLines) - s.MaxTokenSize(smallMaxTokenSize) - j = 0 - for lineNum := 0; s.Scan(); lineNum++ { - genLine(tmp, lineNum, j, false) - if j < smallMaxTokenSize { - j++ - } else { - j-- - } - line := tmp.Bytes() - if !bytes.Equal(s.Bytes(), line) { - t.Errorf("%d: bad line: %d %d\n%.100q\n%.100q\n", lineNum, len(s.Bytes()), len(line), s.Bytes(), line) - } - } - err := s.Err() - if err != ErrTooLong { - t.Fatalf("expected ErrTooLong; got %s", err) - } -} - -// Test that the line splitter handles a final line without a newline. -func testNoNewline(text string, lines []string, t *testing.T) { - buf := strings.NewReader(text) - s := NewScanner(&slowReader{7, buf}) - s.Split(ScanLines) - for lineNum := 0; s.Scan(); lineNum++ { - line := lines[lineNum] - if s.Text() != line { - t.Errorf("%d: bad line: %d %d\n%.100q\n%.100q\n", lineNum, len(s.Bytes()), len(line), s.Bytes(), line) - } - } - err := s.Err() - if err != nil { - t.Fatal(err) - } -} - -var noNewlineLines = []string{ - "abcdefghijklmn\nopqrstuvwxyz", -} - -// Test that the line splitter handles a final line without a newline. -func TestScanLineNoNewline(t *testing.T) { - const text = "abcdefghijklmn\nopqrstuvwxyz" - lines := []string{ - "abcdefghijklmn", - "opqrstuvwxyz", - } - testNoNewline(text, lines, t) -} - -// Test that the line splitter handles a final line with a carriage return but no newline. -func TestScanLineReturnButNoNewline(t *testing.T) { - const text = "abcdefghijklmn\nopqrstuvwxyz\r" - lines := []string{ - "abcdefghijklmn", - "opqrstuvwxyz", - } - testNoNewline(text, lines, t) -} - -// Test that the line splitter handles a final empty line. -func TestScanLineEmptyFinalLine(t *testing.T) { - const text = "abcdefghijklmn\nopqrstuvwxyz\n\n" - lines := []string{ - "abcdefghijklmn", - "opqrstuvwxyz", - "", - } - testNoNewline(text, lines, t) -} - -// Test that the line splitter handles a final empty line with a carriage return but no newline. -func TestScanLineEmptyFinalLineWithCR(t *testing.T) { - const text = "abcdefghijklmn\nopqrstuvwxyz\n\r" - lines := []string{ - "abcdefghijklmn", - "opqrstuvwxyz", - "", - } - testNoNewline(text, lines, t) -} - -var testError = errors.New("testError") - -// Test the correct error is returned when the split function errors out. -func TestSplitError(t *testing.T) { - // Create a split function that delivers a little data, then a predictable error. - numSplits := 0 - const okCount = 7 - errorSplit := func(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF { - panic("didn't get enough data") - } - if numSplits >= okCount { - return 0, nil, testError - } - numSplits++ - return 1, data[0:1], nil - } - // Read the data. - const text = "abcdefghijklmnopqrstuvwxyz" - buf := strings.NewReader(text) - s := NewScanner(&slowReader{1, buf}) - s.Split(errorSplit) - var i int - for i = 0; s.Scan(); i++ { - if len(s.Bytes()) != 1 || text[i] != s.Bytes()[0] { - t.Errorf("#%d: expected %q got %q", i, text[i], s.Bytes()[0]) - } - } - // Check correct termination location and error. - if i != okCount { - t.Errorf("unexpected termination; expected %d tokens got %d", okCount, i) - } - err := s.Err() - if err != testError { - t.Fatalf("expected %q got %v", testError, err) - } -} - -// Test that an EOF is overridden by a user-generated scan error. -func TestErrAtEOF(t *testing.T) { - s := NewScanner(strings.NewReader("1 2 33")) - // This spitter will fail on last entry, after s.err==EOF. - split := func(data []byte, atEOF bool) (advance int, token []byte, err error) { - advance, token, err = ScanWords(data, atEOF) - if len(token) > 1 { - if s.ErrOrEOF() != io.EOF { - t.Fatal("not testing EOF") - } - err = testError - } - return - } - s.Split(split) - for s.Scan() { - } - if s.Err() != testError { - t.Fatal("wrong error:", s.Err()) - } -} - -// Test for issue 5268. -type alwaysError struct{} - -func (alwaysError) Read(p []byte) (int, error) { - return 0, io.ErrUnexpectedEOF -} - -func TestNonEOFWithEmptyRead(t *testing.T) { - scanner := NewScanner(alwaysError{}) - for scanner.Scan() { - t.Fatal("read should fail") - } - err := scanner.Err() - if err != io.ErrUnexpectedEOF { - t.Errorf("unexpected error: %v", err) - } -} - -// Test that Scan finishes if we have endless empty reads. -type endlessZeros struct{} - -func (endlessZeros) Read(p []byte) (int, error) { - return 0, nil -} - -func TestBadReader(t *testing.T) { - scanner := NewScanner(endlessZeros{}) - for scanner.Scan() { - t.Fatal("read should fail") - } - err := scanner.Err() - if err != io.ErrNoProgress { - t.Errorf("unexpected error: %v", err) - } -} - -func TestScanWordsExcessiveWhiteSpace(t *testing.T) { - const word = "ipsum" - s := strings.Repeat(" ", 4*smallMaxTokenSize) + word - scanner := NewScanner(strings.NewReader(s)) - scanner.MaxTokenSize(smallMaxTokenSize) - scanner.Split(ScanWords) - if !scanner.Scan() { - t.Fatalf("scan failed: %v", scanner.Err()) - } - if token := scanner.Text(); token != word { - t.Fatalf("unexpected token: %v", token) - } -} - -// Test that empty tokens, including at end of line or end of file, are found by the scanner. -// Issue 8672: Could miss final empty token. - -func commaSplit(data []byte, atEOF bool) (advance int, token []byte, err error) { - for i := 0; i < len(data); i++ { - if data[i] == ',' { - return i + 1, data[:i], nil - } - } - if !atEOF { - return 0, nil, nil - } - return 0, data, nil -} - -func TestEmptyTokens(t *testing.T) { - s := NewScanner(strings.NewReader("1,2,3,")) - values := []string{"1", "2", "3", ""} - s.Split(commaSplit) - var i int - for i = 0; i < len(values); i++ { - if !s.Scan() { - break - } - if s.Text() != values[i] { - t.Errorf("%d: expected %q got %q", i, values[i], s.Text()) - } - } - if i != len(values) { - t.Errorf("got %d fields, expected %d", i, len(values)) - } - if err := s.Err(); err != nil { - t.Fatal(err) - } -} - -func loopAtEOFSplit(data []byte, atEOF bool) (advance int, token []byte, err error) { - if len(data) > 0 { - return 1, data[:1], nil - } - return 0, data, nil -} - -func TestDontLoopForever(t *testing.T) { - s := NewScanner(strings.NewReader("abc")) - s.Split(loopAtEOFSplit) - // Expect a panic - defer func() { - err := recover() - if err == nil { - t.Fatal("should have panicked") - } - if msg, ok := err.(string); !ok || !strings.Contains(msg, "empty tokens") { - panic(err) - } - }() - for count := 0; s.Scan(); count++ { - if count > 1000 { - t.Fatal("looping") - } - } - if s.Err() != nil { - t.Fatal("after scan:", s.Err()) - } -} - -func TestBlankLines(t *testing.T) { - s := NewScanner(strings.NewReader(strings.Repeat("\n", 1000))) - for count := 0; s.Scan(); count++ { - if count > 2000 { - t.Fatal("looping") - } - } - if s.Err() != nil { - t.Fatal("after scan:", s.Err()) - } -} - -type countdown int - -func (c *countdown) split(data []byte, atEOF bool) (advance int, token []byte, err error) { - if *c > 0 { - *c-- - return 1, data[:1], nil - } - return 0, nil, nil -} - -// Check that the looping-at-EOF check doesn't trigger for merely empty tokens. -func TestEmptyLinesOK(t *testing.T) { - c := countdown(10000) - s := NewScanner(strings.NewReader(strings.Repeat("\n", 10000))) - s.Split(c.split) - for s.Scan() { - } - if s.Err() != nil { - t.Fatal("after scan:", s.Err()) - } - if c != 0 { - t.Fatalf("stopped with %d left to process", c) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/builtin/builtin.go b/llgo/third_party/gofrontend/libgo/go/builtin/builtin.go deleted file mode 100644 index d63ad22c32d46d7fbf68702c7d08113a6830a328..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/builtin/builtin.go +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* - Package builtin provides documentation for Go's predeclared identifiers. - The items documented here are not actually in package builtin - but their descriptions here allow godoc to present documentation - for the language's special identifiers. -*/ -package builtin - -// bool is the set of boolean values, true and false. -type bool bool - -// true and false are the two untyped boolean values. -const ( - true = 0 == 0 // Untyped bool. - false = 0 != 0 // Untyped bool. -) - -// uint8 is the set of all unsigned 8-bit integers. -// Range: 0 through 255. -type uint8 uint8 - -// uint16 is the set of all unsigned 16-bit integers. -// Range: 0 through 65535. -type uint16 uint16 - -// uint32 is the set of all unsigned 32-bit integers. -// Range: 0 through 4294967295. -type uint32 uint32 - -// uint64 is the set of all unsigned 64-bit integers. -// Range: 0 through 18446744073709551615. -type uint64 uint64 - -// int8 is the set of all signed 8-bit integers. -// Range: -128 through 127. -type int8 int8 - -// int16 is the set of all signed 16-bit integers. -// Range: -32768 through 32767. -type int16 int16 - -// int32 is the set of all signed 32-bit integers. -// Range: -2147483648 through 2147483647. -type int32 int32 - -// int64 is the set of all signed 64-bit integers. -// Range: -9223372036854775808 through 9223372036854775807. -type int64 int64 - -// float32 is the set of all IEEE-754 32-bit floating-point numbers. -type float32 float32 - -// float64 is the set of all IEEE-754 64-bit floating-point numbers. -type float64 float64 - -// complex64 is the set of all complex numbers with float32 real and -// imaginary parts. -type complex64 complex64 - -// complex128 is the set of all complex numbers with float64 real and -// imaginary parts. -type complex128 complex128 - -// string is the set of all strings of 8-bit bytes, conventionally but not -// necessarily representing UTF-8-encoded text. A string may be empty, but -// not nil. Values of string type are immutable. -type string string - -// int is a signed integer type that is at least 32 bits in size. It is a -// distinct type, however, and not an alias for, say, int32. -type int int - -// uint is an unsigned integer type that is at least 32 bits in size. It is a -// distinct type, however, and not an alias for, say, uint32. -type uint uint - -// uintptr is an integer type that is large enough to hold the bit pattern of -// any pointer. -type uintptr uintptr - -// byte is an alias for uint8 and is equivalent to uint8 in all ways. It is -// used, by convention, to distinguish byte values from 8-bit unsigned -// integer values. -type byte byte - -// rune is an alias for int32 and is equivalent to int32 in all ways. It is -// used, by convention, to distinguish character values from integer values. -type rune rune - -// iota is a predeclared identifier representing the untyped integer ordinal -// number of the current const specification in a (usually parenthesized) -// const declaration. It is zero-indexed. -const iota = 0 // Untyped int. - -// nil is a predeclared identifier representing the zero value for a -// pointer, channel, func, interface, map, or slice type. -var nil Type // Type must be a pointer, channel, func, interface, map, or slice type - -// Type is here for the purposes of documentation only. It is a stand-in -// for any Go type, but represents the same type for any given function -// invocation. -type Type int - -// Type1 is here for the purposes of documentation only. It is a stand-in -// for any Go type, but represents the same type for any given function -// invocation. -type Type1 int - -// IntegerType is here for the purposes of documentation only. It is a stand-in -// for any integer type: int, uint, int8 etc. -type IntegerType int - -// FloatType is here for the purposes of documentation only. It is a stand-in -// for either float type: float32 or float64. -type FloatType float32 - -// ComplexType is here for the purposes of documentation only. It is a -// stand-in for either complex type: complex64 or complex128. -type ComplexType complex64 - -// The append built-in function appends elements to the end of a slice. If -// it has sufficient capacity, the destination is resliced to accommodate the -// new elements. If it does not, a new underlying array will be allocated. -// Append returns the updated slice. It is therefore necessary to store the -// result of append, often in the variable holding the slice itself: -// slice = append(slice, elem1, elem2) -// slice = append(slice, anotherSlice...) -// As a special case, it is legal to append a string to a byte slice, like this: -// slice = append([]byte("hello "), "world"...) -func append(slice []Type, elems ...Type) []Type - -// The copy built-in function copies elements from a source slice into a -// destination slice. (As a special case, it also will copy bytes from a -// string to a slice of bytes.) The source and destination may overlap. Copy -// returns the number of elements copied, which will be the minimum of -// len(src) and len(dst). -func copy(dst, src []Type) int - -// The delete built-in function deletes the element with the specified key -// (m[key]) from the map. If m is nil or there is no such element, delete -// is a no-op. -func delete(m map[Type]Type1, key Type) - -// The len built-in function returns the length of v, according to its type: -// Array: the number of elements in v. -// Pointer to array: the number of elements in *v (even if v is nil). -// Slice, or map: the number of elements in v; if v is nil, len(v) is zero. -// String: the number of bytes in v. -// Channel: the number of elements queued (unread) in the channel buffer; -// if v is nil, len(v) is zero. -func len(v Type) int - -// The cap built-in function returns the capacity of v, according to its type: -// Array: the number of elements in v (same as len(v)). -// Pointer to array: the number of elements in *v (same as len(v)). -// Slice: the maximum length the slice can reach when resliced; -// if v is nil, cap(v) is zero. -// Channel: the channel buffer capacity, in units of elements; -// if v is nil, cap(v) is zero. -func cap(v Type) int - -// The make built-in function allocates and initializes an object of type -// slice, map, or chan (only). Like new, the first argument is a type, not a -// value. Unlike new, make's return type is the same as the type of its -// argument, not a pointer to it. The specification of the result depends on -// the type: -// Slice: The size specifies the length. The capacity of the slice is -// equal to its length. A second integer argument may be provided to -// specify a different capacity; it must be no smaller than the -// length, so make([]int, 0, 10) allocates a slice of length 0 and -// capacity 10. -// Map: An initial allocation is made according to the size but the -// resulting map has length 0. The size may be omitted, in which case -// a small starting size is allocated. -// Channel: The channel's buffer is initialized with the specified -// buffer capacity. If zero, or the size is omitted, the channel is -// unbuffered. -func make(Type, size IntegerType) Type - -// The new built-in function allocates memory. The first argument is a type, -// not a value, and the value returned is a pointer to a newly -// allocated zero value of that type. -func new(Type) *Type - -// The complex built-in function constructs a complex value from two -// floating-point values. The real and imaginary parts must be of the same -// size, either float32 or float64 (or assignable to them), and the return -// value will be the corresponding complex type (complex64 for float32, -// complex128 for float64). -func complex(r, i FloatType) ComplexType - -// The real built-in function returns the real part of the complex number c. -// The return value will be floating point type corresponding to the type of c. -func real(c ComplexType) FloatType - -// The imag built-in function returns the imaginary part of the complex -// number c. The return value will be floating point type corresponding to -// the type of c. -func imag(c ComplexType) FloatType - -// The close built-in function closes a channel, which must be either -// bidirectional or send-only. It should be executed only by the sender, -// never the receiver, and has the effect of shutting down the channel after -// the last sent value is received. After the last value has been received -// from a closed channel c, any receive from c will succeed without -// blocking, returning the zero value for the channel element. The form -// x, ok := <-c -// will also set ok to false for a closed channel. -func close(c chan<- Type) - -// The panic built-in function stops normal execution of the current -// goroutine. When a function F calls panic, normal execution of F stops -// immediately. Any functions whose execution was deferred by F are run in -// the usual way, and then F returns to its caller. To the caller G, the -// invocation of F then behaves like a call to panic, terminating G's -// execution and running any deferred functions. This continues until all -// functions in the executing goroutine have stopped, in reverse order. At -// that point, the program is terminated and the error condition is reported, -// including the value of the argument to panic. This termination sequence -// is called panicking and can be controlled by the built-in function -// recover. -func panic(v interface{}) - -// The recover built-in function allows a program to manage behavior of a -// panicking goroutine. Executing a call to recover inside a deferred -// function (but not any function called by it) stops the panicking sequence -// by restoring normal execution and retrieves the error value passed to the -// call of panic. If recover is called outside the deferred function it will -// not stop a panicking sequence. In this case, or when the goroutine is not -// panicking, or if the argument supplied to panic was nil, recover returns -// nil. Thus the return value from recover reports whether the goroutine is -// panicking. -func recover() interface{} - -// The print built-in function formats its arguments in an -// implementation-specific way and writes the result to standard error. -// Print is useful for bootstrapping and debugging; it is not guaranteed -// to stay in the language. -func print(args ...Type) - -// The println built-in function formats its arguments in an -// implementation-specific way and writes the result to standard error. -// Spaces are always added between arguments and a newline is appended. -// Println is useful for bootstrapping and debugging; it is not guaranteed -// to stay in the language. -func println(args ...Type) - -// The error built-in interface type is the conventional interface for -// representing an error condition, with the nil value representing no error. -type error interface { - Error() string -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/buffer.go b/llgo/third_party/gofrontend/libgo/go/bytes/buffer.go deleted file mode 100644 index 4db93867d9aa890faed03430b8d9116714e4c9ea..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/buffer.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes - -// Simple byte buffer for marshaling data. - -import ( - "errors" - "io" - "unicode/utf8" -) - -// A Buffer is a variable-sized buffer of bytes with Read and Write methods. -// The zero value for Buffer is an empty buffer ready to use. -type Buffer struct { - buf []byte // contents are the bytes buf[off : len(buf)] - off int // read at &buf[off], write at &buf[len(buf)] - runeBytes [utf8.UTFMax]byte // avoid allocation of slice on each WriteByte or Rune - bootstrap [64]byte // memory to hold first slice; helps small buffers (Printf) avoid allocation. - lastRead readOp // last read operation, so that Unread* can work correctly. -} - -// The readOp constants describe the last action performed on -// the buffer, so that UnreadRune and UnreadByte can -// check for invalid usage. -type readOp int - -const ( - opInvalid readOp = iota // Non-read operation. - opReadRune // Read rune. - opRead // Any other read operation. -) - -// ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer. -var ErrTooLarge = errors.New("bytes.Buffer: too large") - -// Bytes returns a slice of the contents of the unread portion of the buffer; -// len(b.Bytes()) == b.Len(). If the caller changes the contents of the -// returned slice, the contents of the buffer will change provided there -// are no intervening method calls on the Buffer. -func (b *Buffer) Bytes() []byte { return b.buf[b.off:] } - -// String returns the contents of the unread portion of the buffer -// as a string. If the Buffer is a nil pointer, it returns "". -func (b *Buffer) String() string { - if b == nil { - // Special case, useful in debugging. - return "" - } - return string(b.buf[b.off:]) -} - -// Len returns the number of bytes of the unread portion of the buffer; -// b.Len() == len(b.Bytes()). -func (b *Buffer) Len() int { return len(b.buf) - b.off } - -// Cap returns the capacity of the buffer's underlying byte slice, that is, the -// total space allocated for the buffer's data. -func (b *Buffer) Cap() int { return cap(b.buf) } - -// Truncate discards all but the first n unread bytes from the buffer. -// It panics if n is negative or greater than the length of the buffer. -func (b *Buffer) Truncate(n int) { - b.lastRead = opInvalid - switch { - case n < 0 || n > b.Len(): - panic("bytes.Buffer: truncation out of range") - case n == 0: - // Reuse buffer space. - b.off = 0 - } - b.buf = b.buf[0 : b.off+n] -} - -// Reset resets the buffer so it has no content. -// b.Reset() is the same as b.Truncate(0). -func (b *Buffer) Reset() { b.Truncate(0) } - -// grow grows the buffer to guarantee space for n more bytes. -// It returns the index where bytes should be written. -// If the buffer can't grow it will panic with ErrTooLarge. -func (b *Buffer) grow(n int) int { - m := b.Len() - // If buffer is empty, reset to recover space. - if m == 0 && b.off != 0 { - b.Truncate(0) - } - if len(b.buf)+n > cap(b.buf) { - var buf []byte - if b.buf == nil && n <= len(b.bootstrap) { - buf = b.bootstrap[0:] - } else if m+n <= cap(b.buf)/2 { - // We can slide things down instead of allocating a new - // slice. We only need m+n <= cap(b.buf) to slide, but - // we instead let capacity get twice as large so we - // don't spend all our time copying. - copy(b.buf[:], b.buf[b.off:]) - buf = b.buf[:m] - } else { - // not enough space anywhere - buf = makeSlice(2*cap(b.buf) + n) - copy(buf, b.buf[b.off:]) - } - b.buf = buf - b.off = 0 - } - b.buf = b.buf[0 : b.off+m+n] - return b.off + m -} - -// Grow grows the buffer's capacity, if necessary, to guarantee space for -// another n bytes. After Grow(n), at least n bytes can be written to the -// buffer without another allocation. -// If n is negative, Grow will panic. -// If the buffer can't grow it will panic with ErrTooLarge. -func (b *Buffer) Grow(n int) { - if n < 0 { - panic("bytes.Buffer.Grow: negative count") - } - m := b.grow(n) - b.buf = b.buf[0:m] -} - -// Write appends the contents of p to the buffer, growing the buffer as -// needed. The return value n is the length of p; err is always nil. If the -// buffer becomes too large, Write will panic with ErrTooLarge. -func (b *Buffer) Write(p []byte) (n int, err error) { - b.lastRead = opInvalid - m := b.grow(len(p)) - return copy(b.buf[m:], p), nil -} - -// WriteString appends the contents of s to the buffer, growing the buffer as -// needed. The return value n is the length of s; err is always nil. If the -// buffer becomes too large, WriteString will panic with ErrTooLarge. -func (b *Buffer) WriteString(s string) (n int, err error) { - b.lastRead = opInvalid - m := b.grow(len(s)) - return copy(b.buf[m:], s), nil -} - -// MinRead is the minimum slice size passed to a Read call by -// Buffer.ReadFrom. As long as the Buffer has at least MinRead bytes beyond -// what is required to hold the contents of r, ReadFrom will not grow the -// underlying buffer. -const MinRead = 512 - -// ReadFrom reads data from r until EOF and appends it to the buffer, growing -// the buffer as needed. The return value n is the number of bytes read. Any -// error except io.EOF encountered during the read is also returned. If the -// buffer becomes too large, ReadFrom will panic with ErrTooLarge. -func (b *Buffer) ReadFrom(r io.Reader) (n int64, err error) { - b.lastRead = opInvalid - // If buffer is empty, reset to recover space. - if b.off >= len(b.buf) { - b.Truncate(0) - } - for { - if free := cap(b.buf) - len(b.buf); free < MinRead { - // not enough space at end - newBuf := b.buf - if b.off+free < MinRead { - // not enough space using beginning of buffer; - // double buffer capacity - newBuf = makeSlice(2*cap(b.buf) + MinRead) - } - copy(newBuf, b.buf[b.off:]) - b.buf = newBuf[:len(b.buf)-b.off] - b.off = 0 - } - m, e := r.Read(b.buf[len(b.buf):cap(b.buf)]) - b.buf = b.buf[0 : len(b.buf)+m] - n += int64(m) - if e == io.EOF { - break - } - if e != nil { - return n, e - } - } - return n, nil // err is EOF, so return nil explicitly -} - -// makeSlice allocates a slice of size n. If the allocation fails, it panics -// with ErrTooLarge. -func makeSlice(n int) []byte { - // If the make fails, give a known error. - defer func() { - if recover() != nil { - panic(ErrTooLarge) - } - }() - return make([]byte, n) -} - -// WriteTo writes data to w until the buffer is drained or an error occurs. -// The return value n is the number of bytes written; it always fits into an -// int, but it is int64 to match the io.WriterTo interface. Any error -// encountered during the write is also returned. -func (b *Buffer) WriteTo(w io.Writer) (n int64, err error) { - b.lastRead = opInvalid - if b.off < len(b.buf) { - nBytes := b.Len() - m, e := w.Write(b.buf[b.off:]) - if m > nBytes { - panic("bytes.Buffer.WriteTo: invalid Write count") - } - b.off += m - n = int64(m) - if e != nil { - return n, e - } - // all bytes should have been written, by definition of - // Write method in io.Writer - if m != nBytes { - return n, io.ErrShortWrite - } - } - // Buffer is now empty; reset. - b.Truncate(0) - return -} - -// WriteByte appends the byte c to the buffer, growing the buffer as needed. -// The returned error is always nil, but is included to match bufio.Writer's -// WriteByte. If the buffer becomes too large, WriteByte will panic with -// ErrTooLarge. -func (b *Buffer) WriteByte(c byte) error { - b.lastRead = opInvalid - m := b.grow(1) - b.buf[m] = c - return nil -} - -// WriteRune appends the UTF-8 encoding of Unicode code point r to the -// buffer, returning its length and an error, which is always nil but is -// included to match bufio.Writer's WriteRune. The buffer is grown as needed; -// if it becomes too large, WriteRune will panic with ErrTooLarge. -func (b *Buffer) WriteRune(r rune) (n int, err error) { - if r < utf8.RuneSelf { - b.WriteByte(byte(r)) - return 1, nil - } - n = utf8.EncodeRune(b.runeBytes[0:], r) - b.Write(b.runeBytes[0:n]) - return n, nil -} - -// Read reads the next len(p) bytes from the buffer or until the buffer -// is drained. The return value n is the number of bytes read. If the -// buffer has no data to return, err is io.EOF (unless len(p) is zero); -// otherwise it is nil. -func (b *Buffer) Read(p []byte) (n int, err error) { - b.lastRead = opInvalid - if b.off >= len(b.buf) { - // Buffer is empty, reset to recover space. - b.Truncate(0) - if len(p) == 0 { - return - } - return 0, io.EOF - } - n = copy(p, b.buf[b.off:]) - b.off += n - if n > 0 { - b.lastRead = opRead - } - return -} - -// Next returns a slice containing the next n bytes from the buffer, -// advancing the buffer as if the bytes had been returned by Read. -// If there are fewer than n bytes in the buffer, Next returns the entire buffer. -// The slice is only valid until the next call to a read or write method. -func (b *Buffer) Next(n int) []byte { - b.lastRead = opInvalid - m := b.Len() - if n > m { - n = m - } - data := b.buf[b.off : b.off+n] - b.off += n - if n > 0 { - b.lastRead = opRead - } - return data -} - -// ReadByte reads and returns the next byte from the buffer. -// If no byte is available, it returns error io.EOF. -func (b *Buffer) ReadByte() (c byte, err error) { - b.lastRead = opInvalid - if b.off >= len(b.buf) { - // Buffer is empty, reset to recover space. - b.Truncate(0) - return 0, io.EOF - } - c = b.buf[b.off] - b.off++ - b.lastRead = opRead - return c, nil -} - -// ReadRune reads and returns the next UTF-8-encoded -// Unicode code point from the buffer. -// If no bytes are available, the error returned is io.EOF. -// If the bytes are an erroneous UTF-8 encoding, it -// consumes one byte and returns U+FFFD, 1. -func (b *Buffer) ReadRune() (r rune, size int, err error) { - b.lastRead = opInvalid - if b.off >= len(b.buf) { - // Buffer is empty, reset to recover space. - b.Truncate(0) - return 0, 0, io.EOF - } - b.lastRead = opReadRune - c := b.buf[b.off] - if c < utf8.RuneSelf { - b.off++ - return rune(c), 1, nil - } - r, n := utf8.DecodeRune(b.buf[b.off:]) - b.off += n - return r, n, nil -} - -// UnreadRune unreads the last rune returned by ReadRune. -// If the most recent read or write operation on the buffer was -// not a ReadRune, UnreadRune returns an error. (In this regard -// it is stricter than UnreadByte, which will unread the last byte -// from any read operation.) -func (b *Buffer) UnreadRune() error { - if b.lastRead != opReadRune { - return errors.New("bytes.Buffer: UnreadRune: previous operation was not ReadRune") - } - b.lastRead = opInvalid - if b.off > 0 { - _, n := utf8.DecodeLastRune(b.buf[0:b.off]) - b.off -= n - } - return nil -} - -// UnreadByte unreads the last byte returned by the most recent -// read operation. If write has happened since the last read, UnreadByte -// returns an error. -func (b *Buffer) UnreadByte() error { - if b.lastRead != opReadRune && b.lastRead != opRead { - return errors.New("bytes.Buffer: UnreadByte: previous operation was not a read") - } - b.lastRead = opInvalid - if b.off > 0 { - b.off-- - } - return nil -} - -// ReadBytes reads until the first occurrence of delim in the input, -// returning a slice containing the data up to and including the delimiter. -// If ReadBytes encounters an error before finding a delimiter, -// it returns the data read before the error and the error itself (often io.EOF). -// ReadBytes returns err != nil if and only if the returned data does not end in -// delim. -func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) { - slice, err := b.readSlice(delim) - // return a copy of slice. The buffer's backing array may - // be overwritten by later calls. - line = append(line, slice...) - return -} - -// readSlice is like ReadBytes but returns a reference to internal buffer data. -func (b *Buffer) readSlice(delim byte) (line []byte, err error) { - i := IndexByte(b.buf[b.off:], delim) - end := b.off + i + 1 - if i < 0 { - end = len(b.buf) - err = io.EOF - } - line = b.buf[b.off:end] - b.off = end - b.lastRead = opRead - return line, err -} - -// ReadString reads until the first occurrence of delim in the input, -// returning a string containing the data up to and including the delimiter. -// If ReadString encounters an error before finding a delimiter, -// it returns the data read before the error and the error itself (often io.EOF). -// ReadString returns err != nil if and only if the returned data does not end -// in delim. -func (b *Buffer) ReadString(delim byte) (line string, err error) { - slice, err := b.readSlice(delim) - return string(slice), err -} - -// NewBuffer creates and initializes a new Buffer using buf as its initial -// contents. It is intended to prepare a Buffer to read existing data. It -// can also be used to size the internal buffer for writing. To do that, -// buf should have the desired capacity but a length of zero. -// -// In most cases, new(Buffer) (or just declaring a Buffer variable) is -// sufficient to initialize a Buffer. -func NewBuffer(buf []byte) *Buffer { return &Buffer{buf: buf} } - -// NewBufferString creates and initializes a new Buffer using string s as its -// initial contents. It is intended to prepare a buffer to read an existing -// string. -// -// In most cases, new(Buffer) (or just declaring a Buffer variable) is -// sufficient to initialize a Buffer. -func NewBufferString(s string) *Buffer { - return &Buffer{buf: []byte(s)} -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/buffer_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/buffer_test.go deleted file mode 100644 index 7de17ae47e28ff00f00dd295637a9917779e9e32..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/buffer_test.go +++ /dev/null @@ -1,544 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes_test - -import ( - . "bytes" - "io" - "math/rand" - "runtime" - "testing" - "unicode/utf8" -) - -const N = 10000 // make this bigger for a larger (and slower) test -var data string // test data for write tests -var testBytes []byte // test data; same as data but as a slice. - -func init() { - testBytes = make([]byte, N) - for i := 0; i < N; i++ { - testBytes[i] = 'a' + byte(i%26) - } - data = string(testBytes) -} - -// Verify that contents of buf match the string s. -func check(t *testing.T, testname string, buf *Buffer, s string) { - bytes := buf.Bytes() - str := buf.String() - if buf.Len() != len(bytes) { - t.Errorf("%s: buf.Len() == %d, len(buf.Bytes()) == %d", testname, buf.Len(), len(bytes)) - } - - if buf.Len() != len(str) { - t.Errorf("%s: buf.Len() == %d, len(buf.String()) == %d", testname, buf.Len(), len(str)) - } - - if buf.Len() != len(s) { - t.Errorf("%s: buf.Len() == %d, len(s) == %d", testname, buf.Len(), len(s)) - } - - if string(bytes) != s { - t.Errorf("%s: string(buf.Bytes()) == %q, s == %q", testname, string(bytes), s) - } -} - -// Fill buf through n writes of string fus. -// The initial contents of buf corresponds to the string s; -// the result is the final contents of buf returned as a string. -func fillString(t *testing.T, testname string, buf *Buffer, s string, n int, fus string) string { - check(t, testname+" (fill 1)", buf, s) - for ; n > 0; n-- { - m, err := buf.WriteString(fus) - if m != len(fus) { - t.Errorf(testname+" (fill 2): m == %d, expected %d", m, len(fus)) - } - if err != nil { - t.Errorf(testname+" (fill 3): err should always be nil, found err == %s", err) - } - s += fus - check(t, testname+" (fill 4)", buf, s) - } - return s -} - -// Fill buf through n writes of byte slice fub. -// The initial contents of buf corresponds to the string s; -// the result is the final contents of buf returned as a string. -func fillBytes(t *testing.T, testname string, buf *Buffer, s string, n int, fub []byte) string { - check(t, testname+" (fill 1)", buf, s) - for ; n > 0; n-- { - m, err := buf.Write(fub) - if m != len(fub) { - t.Errorf(testname+" (fill 2): m == %d, expected %d", m, len(fub)) - } - if err != nil { - t.Errorf(testname+" (fill 3): err should always be nil, found err == %s", err) - } - s += string(fub) - check(t, testname+" (fill 4)", buf, s) - } - return s -} - -func TestNewBuffer(t *testing.T) { - buf := NewBuffer(testBytes) - check(t, "NewBuffer", buf, data) -} - -func TestNewBufferString(t *testing.T) { - buf := NewBufferString(data) - check(t, "NewBufferString", buf, data) -} - -// Empty buf through repeated reads into fub. -// The initial contents of buf corresponds to the string s. -func empty(t *testing.T, testname string, buf *Buffer, s string, fub []byte) { - check(t, testname+" (empty 1)", buf, s) - - for { - n, err := buf.Read(fub) - if n == 0 { - break - } - if err != nil { - t.Errorf(testname+" (empty 2): err should always be nil, found err == %s", err) - } - s = s[n:] - check(t, testname+" (empty 3)", buf, s) - } - - check(t, testname+" (empty 4)", buf, "") -} - -func TestBasicOperations(t *testing.T) { - var buf Buffer - - for i := 0; i < 5; i++ { - check(t, "TestBasicOperations (1)", &buf, "") - - buf.Reset() - check(t, "TestBasicOperations (2)", &buf, "") - - buf.Truncate(0) - check(t, "TestBasicOperations (3)", &buf, "") - - n, err := buf.Write([]byte(data[0:1])) - if n != 1 { - t.Errorf("wrote 1 byte, but n == %d", n) - } - if err != nil { - t.Errorf("err should always be nil, but err == %s", err) - } - check(t, "TestBasicOperations (4)", &buf, "a") - - buf.WriteByte(data[1]) - check(t, "TestBasicOperations (5)", &buf, "ab") - - n, err = buf.Write([]byte(data[2:26])) - if n != 24 { - t.Errorf("wrote 25 bytes, but n == %d", n) - } - check(t, "TestBasicOperations (6)", &buf, string(data[0:26])) - - buf.Truncate(26) - check(t, "TestBasicOperations (7)", &buf, string(data[0:26])) - - buf.Truncate(20) - check(t, "TestBasicOperations (8)", &buf, string(data[0:20])) - - empty(t, "TestBasicOperations (9)", &buf, string(data[0:20]), make([]byte, 5)) - empty(t, "TestBasicOperations (10)", &buf, "", make([]byte, 100)) - - buf.WriteByte(data[1]) - c, err := buf.ReadByte() - if err != nil { - t.Error("ReadByte unexpected eof") - } - if c != data[1] { - t.Errorf("ReadByte wrong value c=%v", c) - } - c, err = buf.ReadByte() - if err == nil { - t.Error("ReadByte unexpected not eof") - } - } -} - -func TestLargeStringWrites(t *testing.T) { - var buf Buffer - limit := 30 - if testing.Short() { - limit = 9 - } - for i := 3; i < limit; i += 3 { - s := fillString(t, "TestLargeWrites (1)", &buf, "", 5, data) - empty(t, "TestLargeStringWrites (2)", &buf, s, make([]byte, len(data)/i)) - } - check(t, "TestLargeStringWrites (3)", &buf, "") -} - -func TestLargeByteWrites(t *testing.T) { - var buf Buffer - limit := 30 - if testing.Short() { - limit = 9 - } - for i := 3; i < limit; i += 3 { - s := fillBytes(t, "TestLargeWrites (1)", &buf, "", 5, testBytes) - empty(t, "TestLargeByteWrites (2)", &buf, s, make([]byte, len(data)/i)) - } - check(t, "TestLargeByteWrites (3)", &buf, "") -} - -func TestLargeStringReads(t *testing.T) { - var buf Buffer - for i := 3; i < 30; i += 3 { - s := fillString(t, "TestLargeReads (1)", &buf, "", 5, data[0:len(data)/i]) - empty(t, "TestLargeReads (2)", &buf, s, make([]byte, len(data))) - } - check(t, "TestLargeStringReads (3)", &buf, "") -} - -func TestLargeByteReads(t *testing.T) { - var buf Buffer - for i := 3; i < 30; i += 3 { - s := fillBytes(t, "TestLargeReads (1)", &buf, "", 5, testBytes[0:len(testBytes)/i]) - empty(t, "TestLargeReads (2)", &buf, s, make([]byte, len(data))) - } - check(t, "TestLargeByteReads (3)", &buf, "") -} - -func TestMixedReadsAndWrites(t *testing.T) { - var buf Buffer - s := "" - for i := 0; i < 50; i++ { - wlen := rand.Intn(len(data)) - if i%2 == 0 { - s = fillString(t, "TestMixedReadsAndWrites (1)", &buf, s, 1, data[0:wlen]) - } else { - s = fillBytes(t, "TestMixedReadsAndWrites (1)", &buf, s, 1, testBytes[0:wlen]) - } - - rlen := rand.Intn(len(data)) - fub := make([]byte, rlen) - n, _ := buf.Read(fub) - s = s[n:] - } - empty(t, "TestMixedReadsAndWrites (2)", &buf, s, make([]byte, buf.Len())) -} - -func TestCapWithPreallocatedSlice(t *testing.T) { - buf := NewBuffer(make([]byte, 10)) - n := buf.Cap() - if n != 10 { - t.Errorf("expected 10, got %d", n) - } -} - -func TestCapWithSliceAndWrittenData(t *testing.T) { - buf := NewBuffer(make([]byte, 0, 10)) - buf.Write([]byte("test")) - n := buf.Cap() - if n != 10 { - t.Errorf("expected 10, got %d", n) - } -} - -func TestNil(t *testing.T) { - var b *Buffer - if b.String() != "" { - t.Errorf("expected ; got %q", b.String()) - } -} - -func TestReadFrom(t *testing.T) { - var buf Buffer - for i := 3; i < 30; i += 3 { - s := fillBytes(t, "TestReadFrom (1)", &buf, "", 5, testBytes[0:len(testBytes)/i]) - var b Buffer - b.ReadFrom(&buf) - empty(t, "TestReadFrom (2)", &b, s, make([]byte, len(data))) - } -} - -func TestWriteTo(t *testing.T) { - var buf Buffer - for i := 3; i < 30; i += 3 { - s := fillBytes(t, "TestWriteTo (1)", &buf, "", 5, testBytes[0:len(testBytes)/i]) - var b Buffer - buf.WriteTo(&b) - empty(t, "TestWriteTo (2)", &b, s, make([]byte, len(data))) - } -} - -func TestRuneIO(t *testing.T) { - const NRune = 1000 - // Built a test slice while we write the data - b := make([]byte, utf8.UTFMax*NRune) - var buf Buffer - n := 0 - for r := rune(0); r < NRune; r++ { - size := utf8.EncodeRune(b[n:], r) - nbytes, err := buf.WriteRune(r) - if err != nil { - t.Fatalf("WriteRune(%U) error: %s", r, err) - } - if nbytes != size { - t.Fatalf("WriteRune(%U) expected %d, got %d", r, size, nbytes) - } - n += size - } - b = b[0:n] - - // Check the resulting bytes - if !Equal(buf.Bytes(), b) { - t.Fatalf("incorrect result from WriteRune: %q not %q", buf.Bytes(), b) - } - - p := make([]byte, utf8.UTFMax) - // Read it back with ReadRune - for r := rune(0); r < NRune; r++ { - size := utf8.EncodeRune(p, r) - nr, nbytes, err := buf.ReadRune() - if nr != r || nbytes != size || err != nil { - t.Fatalf("ReadRune(%U) got %U,%d not %U,%d (err=%s)", r, nr, nbytes, r, size, err) - } - } - - // Check that UnreadRune works - buf.Reset() - buf.Write(b) - for r := rune(0); r < NRune; r++ { - r1, size, _ := buf.ReadRune() - if err := buf.UnreadRune(); err != nil { - t.Fatalf("UnreadRune(%U) got error %q", r, err) - } - r2, nbytes, err := buf.ReadRune() - if r1 != r2 || r1 != r || nbytes != size || err != nil { - t.Fatalf("ReadRune(%U) after UnreadRune got %U,%d not %U,%d (err=%s)", r, r2, nbytes, r, size, err) - } - } -} - -func TestNext(t *testing.T) { - b := []byte{0, 1, 2, 3, 4} - tmp := make([]byte, 5) - for i := 0; i <= 5; i++ { - for j := i; j <= 5; j++ { - for k := 0; k <= 6; k++ { - // 0 <= i <= j <= 5; 0 <= k <= 6 - // Check that if we start with a buffer - // of length j at offset i and ask for - // Next(k), we get the right bytes. - buf := NewBuffer(b[0:j]) - n, _ := buf.Read(tmp[0:i]) - if n != i { - t.Fatalf("Read %d returned %d", i, n) - } - bb := buf.Next(k) - want := k - if want > j-i { - want = j - i - } - if len(bb) != want { - t.Fatalf("in %d,%d: len(Next(%d)) == %d", i, j, k, len(bb)) - } - for l, v := range bb { - if v != byte(l+i) { - t.Fatalf("in %d,%d: Next(%d)[%d] = %d, want %d", i, j, k, l, v, l+i) - } - } - } - } - } -} - -var readBytesTests = []struct { - buffer string - delim byte - expected []string - err error -}{ - {"", 0, []string{""}, io.EOF}, - {"a\x00", 0, []string{"a\x00"}, nil}, - {"abbbaaaba", 'b', []string{"ab", "b", "b", "aaab"}, nil}, - {"hello\x01world", 1, []string{"hello\x01"}, nil}, - {"foo\nbar", 0, []string{"foo\nbar"}, io.EOF}, - {"alpha\nbeta\ngamma\n", '\n', []string{"alpha\n", "beta\n", "gamma\n"}, nil}, - {"alpha\nbeta\ngamma", '\n', []string{"alpha\n", "beta\n", "gamma"}, io.EOF}, -} - -func TestReadBytes(t *testing.T) { - for _, test := range readBytesTests { - buf := NewBufferString(test.buffer) - var err error - for _, expected := range test.expected { - var bytes []byte - bytes, err = buf.ReadBytes(test.delim) - if string(bytes) != expected { - t.Errorf("expected %q, got %q", expected, bytes) - } - if err != nil { - break - } - } - if err != test.err { - t.Errorf("expected error %v, got %v", test.err, err) - } - } -} - -func TestReadString(t *testing.T) { - for _, test := range readBytesTests { - buf := NewBufferString(test.buffer) - var err error - for _, expected := range test.expected { - var s string - s, err = buf.ReadString(test.delim) - if s != expected { - t.Errorf("expected %q, got %q", expected, s) - } - if err != nil { - break - } - } - if err != test.err { - t.Errorf("expected error %v, got %v", test.err, err) - } - } -} - -func BenchmarkReadString(b *testing.B) { - const n = 32 << 10 - - data := make([]byte, n) - data[n-1] = 'x' - b.SetBytes(int64(n)) - for i := 0; i < b.N; i++ { - buf := NewBuffer(data) - _, err := buf.ReadString('x') - if err != nil { - b.Fatal(err) - } - } -} - -func TestGrow(t *testing.T) { - x := []byte{'x'} - y := []byte{'y'} - tmp := make([]byte, 72) - for _, startLen := range []int{0, 100, 1000, 10000, 100000} { - xBytes := Repeat(x, startLen) - for _, growLen := range []int{0, 100, 1000, 10000, 100000} { - buf := NewBuffer(xBytes) - // If we read, this affects buf.off, which is good to test. - readBytes, _ := buf.Read(tmp) - buf.Grow(growLen) - yBytes := Repeat(y, growLen) - // Check no allocation occurs in write, as long as we're single-threaded. - var m1, m2 runtime.MemStats - runtime.ReadMemStats(&m1) - buf.Write(yBytes) - runtime.ReadMemStats(&m2) - if runtime.GOMAXPROCS(-1) == 1 && m1.Mallocs != m2.Mallocs { - t.Errorf("allocation occurred during write") - } - // Check that buffer has correct data. - if !Equal(buf.Bytes()[0:startLen-readBytes], xBytes[readBytes:]) { - t.Errorf("bad initial data at %d %d", startLen, growLen) - } - if !Equal(buf.Bytes()[startLen-readBytes:startLen-readBytes+growLen], yBytes) { - t.Errorf("bad written data at %d %d", startLen, growLen) - } - } - } -} - -// Was a bug: used to give EOF reading empty slice at EOF. -func TestReadEmptyAtEOF(t *testing.T) { - b := new(Buffer) - slice := make([]byte, 0) - n, err := b.Read(slice) - if err != nil { - t.Errorf("read error: %v", err) - } - if n != 0 { - t.Errorf("wrong count; got %d want 0", n) - } -} - -func TestUnreadByte(t *testing.T) { - b := new(Buffer) - b.WriteString("abcdefghijklmnopqrstuvwxyz") - - _, err := b.ReadBytes('m') - if err != nil { - t.Fatalf("ReadBytes: %v", err) - } - - err = b.UnreadByte() - if err != nil { - t.Fatalf("UnreadByte: %v", err) - } - c, err := b.ReadByte() - if err != nil { - t.Fatalf("ReadByte: %v", err) - } - if c != 'm' { - t.Errorf("ReadByte = %q; want %q", c, 'm') - } -} - -// Tests that we occasionally compact. Issue 5154. -func TestBufferGrowth(t *testing.T) { - var b Buffer - buf := make([]byte, 1024) - b.Write(buf[0:1]) - var cap0 int - for i := 0; i < 5<<10; i++ { - b.Write(buf) - b.Read(buf) - if i == 0 { - cap0 = b.Cap() - } - } - cap1 := b.Cap() - // (*Buffer).grow allows for 2x capacity slop before sliding, - // so set our error threshold at 3x. - if cap1 > cap0*3 { - t.Errorf("buffer cap = %d; too big (grew from %d)", cap1, cap0) - } -} - -// From Issue 5154. -func BenchmarkBufferNotEmptyWriteRead(b *testing.B) { - buf := make([]byte, 1024) - for i := 0; i < b.N; i++ { - var b Buffer - b.Write(buf[0:1]) - for i := 0; i < 5<<10; i++ { - b.Write(buf) - b.Read(buf) - } - } -} - -// Check that we don't compact too often. From Issue 5154. -func BenchmarkBufferFullSmallReads(b *testing.B) { - buf := make([]byte, 1024) - for i := 0; i < b.N; i++ { - var b Buffer - b.Write(buf) - for b.Len()+20 < b.Cap() { - b.Write(buf[:10]) - } - for i := 0; i < 5<<10; i++ { - b.Read(buf[:1]) - b.Write(buf[:1]) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go b/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go deleted file mode 100644 index b86824087e5356405855d4581aeb728fa50f8ae1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/bytes.go +++ /dev/null @@ -1,714 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package bytes implements functions for the manipulation of byte slices. -// It is analogous to the facilities of the strings package. -package bytes - -import ( - "unicode" - "unicode/utf8" -) - -func equalPortable(a, b []byte) bool { - if len(a) != len(b) { - return false - } - for i, c := range a { - if c != b[i] { - return false - } - } - return true -} - -// explode splits s into a slice of UTF-8 sequences, one per Unicode code point (still slices of bytes), -// up to a maximum of n byte slices. Invalid UTF-8 sequences are chopped into individual bytes. -func explode(s []byte, n int) [][]byte { - if n <= 0 { - n = len(s) - } - a := make([][]byte, n) - var size int - na := 0 - for len(s) > 0 { - if na+1 >= n { - a[na] = s - na++ - break - } - _, size = utf8.DecodeRune(s) - a[na] = s[0:size] - s = s[size:] - na++ - } - return a[0:na] -} - -// Count counts the number of non-overlapping instances of sep in s. -// If sep is an empty slice, Count returns 1 + the number of Unicode code points in s. -func Count(s, sep []byte) int { - n := len(sep) - if n == 0 { - return utf8.RuneCount(s) + 1 - } - if n > len(s) { - return 0 - } - count := 0 - c := sep[0] - i := 0 - t := s[:len(s)-n+1] - for i < len(t) { - if t[i] != c { - o := IndexByte(t[i:], c) - if o < 0 { - break - } - i += o - } - if n == 1 || Equal(s[i:i+n], sep) { - count++ - i += n - continue - } - i++ - } - return count -} - -// Contains reports whether subslice is within b. -func Contains(b, subslice []byte) bool { - return Index(b, subslice) != -1 -} - -// Index returns the index of the first instance of sep in s, or -1 if sep is not present in s. -func Index(s, sep []byte) int { - n := len(sep) - if n == 0 { - return 0 - } - if n > len(s) { - return -1 - } - c := sep[0] - if n == 1 { - return IndexByte(s, c) - } - i := 0 - t := s[:len(s)-n+1] - for i < len(t) { - if t[i] != c { - o := IndexByte(t[i:], c) - if o < 0 { - break - } - i += o - } - if Equal(s[i:i+n], sep) { - return i - } - i++ - } - return -1 -} - -func indexBytePortable(s []byte, c byte) int { - for i, b := range s { - if b == c { - return i - } - } - return -1 -} - -// LastIndex returns the index of the last instance of sep in s, or -1 if sep is not present in s. -func LastIndex(s, sep []byte) int { - n := len(sep) - if n == 0 { - return len(s) - } - c := sep[0] - for i := len(s) - n; i >= 0; i-- { - if s[i] == c && (n == 1 || Equal(s[i:i+n], sep)) { - return i - } - } - return -1 -} - -// LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s. -func LastIndexByte(s []byte, c byte) int { - for i := len(s) - 1; i >= 0; i-- { - if s[i] == c { - return i - } - } - return -1 -} - -// IndexRune interprets s as a sequence of UTF-8-encoded Unicode code points. -// It returns the byte index of the first occurrence in s of the given rune. -// It returns -1 if rune is not present in s. -func IndexRune(s []byte, r rune) int { - for i := 0; i < len(s); { - r1, size := utf8.DecodeRune(s[i:]) - if r == r1 { - return i - } - i += size - } - return -1 -} - -// IndexAny interprets s as a sequence of UTF-8-encoded Unicode code points. -// It returns the byte index of the first occurrence in s of any of the Unicode -// code points in chars. It returns -1 if chars is empty or if there is no code -// point in common. -func IndexAny(s []byte, chars string) int { - if len(chars) > 0 { - var r rune - var width int - for i := 0; i < len(s); i += width { - r = rune(s[i]) - if r < utf8.RuneSelf { - width = 1 - } else { - r, width = utf8.DecodeRune(s[i:]) - } - for _, ch := range chars { - if r == ch { - return i - } - } - } - } - return -1 -} - -// LastIndexAny interprets s as a sequence of UTF-8-encoded Unicode code -// points. It returns the byte index of the last occurrence in s of any of -// the Unicode code points in chars. It returns -1 if chars is empty or if -// there is no code point in common. -func LastIndexAny(s []byte, chars string) int { - if len(chars) > 0 { - for i := len(s); i > 0; { - r, size := utf8.DecodeLastRune(s[0:i]) - i -= size - for _, ch := range chars { - if r == ch { - return i - } - } - } - } - return -1 -} - -// Generic split: splits after each instance of sep, -// including sepSave bytes of sep in the subslices. -func genSplit(s, sep []byte, sepSave, n int) [][]byte { - if n == 0 { - return nil - } - if len(sep) == 0 { - return explode(s, n) - } - if n < 0 { - n = Count(s, sep) + 1 - } - c := sep[0] - start := 0 - a := make([][]byte, n) - na := 0 - for i := 0; i+len(sep) <= len(s) && na+1 < n; i++ { - if s[i] == c && (len(sep) == 1 || Equal(s[i:i+len(sep)], sep)) { - a[na] = s[start : i+sepSave] - na++ - start = i + len(sep) - i += len(sep) - 1 - } - } - a[na] = s[start:] - return a[0 : na+1] -} - -// SplitN slices s into subslices separated by sep and returns a slice of -// the subslices between those separators. -// If sep is empty, SplitN splits after each UTF-8 sequence. -// The count determines the number of subslices to return: -// n > 0: at most n subslices; the last subslice will be the unsplit remainder. -// n == 0: the result is nil (zero subslices) -// n < 0: all subslices -func SplitN(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) } - -// SplitAfterN slices s into subslices after each instance of sep and -// returns a slice of those subslices. -// If sep is empty, SplitAfterN splits after each UTF-8 sequence. -// The count determines the number of subslices to return: -// n > 0: at most n subslices; the last subslice will be the unsplit remainder. -// n == 0: the result is nil (zero subslices) -// n < 0: all subslices -func SplitAfterN(s, sep []byte, n int) [][]byte { - return genSplit(s, sep, len(sep), n) -} - -// Split slices s into all subslices separated by sep and returns a slice of -// the subslices between those separators. -// If sep is empty, Split splits after each UTF-8 sequence. -// It is equivalent to SplitN with a count of -1. -func Split(s, sep []byte) [][]byte { return genSplit(s, sep, 0, -1) } - -// SplitAfter slices s into all subslices after each instance of sep and -// returns a slice of those subslices. -// If sep is empty, SplitAfter splits after each UTF-8 sequence. -// It is equivalent to SplitAfterN with a count of -1. -func SplitAfter(s, sep []byte) [][]byte { - return genSplit(s, sep, len(sep), -1) -} - -// Fields splits the slice s around each instance of one or more consecutive white space -// characters, returning a slice of subslices of s or an empty list if s contains only white space. -func Fields(s []byte) [][]byte { - return FieldsFunc(s, unicode.IsSpace) -} - -// FieldsFunc interprets s as a sequence of UTF-8-encoded Unicode code points. -// It splits the slice s at each run of code points c satisfying f(c) and -// returns a slice of subslices of s. If all code points in s satisfy f(c), or -// len(s) == 0, an empty slice is returned. -// FieldsFunc makes no guarantees about the order in which it calls f(c). -// If f does not return consistent results for a given c, FieldsFunc may crash. -func FieldsFunc(s []byte, f func(rune) bool) [][]byte { - n := 0 - inField := false - for i := 0; i < len(s); { - r, size := utf8.DecodeRune(s[i:]) - wasInField := inField - inField = !f(r) - if inField && !wasInField { - n++ - } - i += size - } - - a := make([][]byte, n) - na := 0 - fieldStart := -1 - for i := 0; i <= len(s) && na < n; { - r, size := utf8.DecodeRune(s[i:]) - if fieldStart < 0 && size > 0 && !f(r) { - fieldStart = i - i += size - continue - } - if fieldStart >= 0 && (size == 0 || f(r)) { - a[na] = s[fieldStart:i] - na++ - fieldStart = -1 - } - if size == 0 { - break - } - i += size - } - return a[0:na] -} - -// Join concatenates the elements of s to create a new byte slice. The separator -// sep is placed between elements in the resulting slice. -func Join(s [][]byte, sep []byte) []byte { - if len(s) == 0 { - return []byte{} - } - if len(s) == 1 { - // Just return a copy. - return append([]byte(nil), s[0]...) - } - n := len(sep) * (len(s) - 1) - for _, v := range s { - n += len(v) - } - - b := make([]byte, n) - bp := copy(b, s[0]) - for _, v := range s[1:] { - bp += copy(b[bp:], sep) - bp += copy(b[bp:], v) - } - return b -} - -// HasPrefix tests whether the byte slice s begins with prefix. -func HasPrefix(s, prefix []byte) bool { - return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix) -} - -// HasSuffix tests whether the byte slice s ends with suffix. -func HasSuffix(s, suffix []byte) bool { - return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix) -} - -// Map returns a copy of the byte slice s with all its characters modified -// according to the mapping function. If mapping returns a negative value, the character is -// dropped from the string with no replacement. The characters in s and the -// output are interpreted as UTF-8-encoded Unicode code points. -func Map(mapping func(r rune) rune, s []byte) []byte { - // In the worst case, the slice can grow when mapped, making - // things unpleasant. But it's so rare we barge in assuming it's - // fine. It could also shrink but that falls out naturally. - maxbytes := len(s) // length of b - nbytes := 0 // number of bytes encoded in b - b := make([]byte, maxbytes) - for i := 0; i < len(s); { - wid := 1 - r := rune(s[i]) - if r >= utf8.RuneSelf { - r, wid = utf8.DecodeRune(s[i:]) - } - r = mapping(r) - if r >= 0 { - rl := utf8.RuneLen(r) - if rl < 0 { - rl = len(string(utf8.RuneError)) - } - if nbytes+rl > maxbytes { - // Grow the buffer. - maxbytes = maxbytes*2 + utf8.UTFMax - nb := make([]byte, maxbytes) - copy(nb, b[0:nbytes]) - b = nb - } - nbytes += utf8.EncodeRune(b[nbytes:maxbytes], r) - } - i += wid - } - return b[0:nbytes] -} - -// Repeat returns a new byte slice consisting of count copies of b. -func Repeat(b []byte, count int) []byte { - nb := make([]byte, len(b)*count) - bp := copy(nb, b) - for bp < len(nb) { - copy(nb[bp:], nb[:bp]) - bp *= 2 - } - return nb -} - -// ToUpper returns a copy of the byte slice s with all Unicode letters mapped to their upper case. -func ToUpper(s []byte) []byte { return Map(unicode.ToUpper, s) } - -// ToLower returns a copy of the byte slice s with all Unicode letters mapped to their lower case. -func ToLower(s []byte) []byte { return Map(unicode.ToLower, s) } - -// ToTitle returns a copy of the byte slice s with all Unicode letters mapped to their title case. -func ToTitle(s []byte) []byte { return Map(unicode.ToTitle, s) } - -// ToUpperSpecial returns a copy of the byte slice s with all Unicode letters mapped to their -// upper case, giving priority to the special casing rules. -func ToUpperSpecial(_case unicode.SpecialCase, s []byte) []byte { - return Map(func(r rune) rune { return _case.ToUpper(r) }, s) -} - -// ToLowerSpecial returns a copy of the byte slice s with all Unicode letters mapped to their -// lower case, giving priority to the special casing rules. -func ToLowerSpecial(_case unicode.SpecialCase, s []byte) []byte { - return Map(func(r rune) rune { return _case.ToLower(r) }, s) -} - -// ToTitleSpecial returns a copy of the byte slice s with all Unicode letters mapped to their -// title case, giving priority to the special casing rules. -func ToTitleSpecial(_case unicode.SpecialCase, s []byte) []byte { - return Map(func(r rune) rune { return _case.ToTitle(r) }, s) -} - -// isSeparator reports whether the rune could mark a word boundary. -// TODO: update when package unicode captures more of the properties. -func isSeparator(r rune) bool { - // ASCII alphanumerics and underscore are not separators - if r <= 0x7F { - switch { - case '0' <= r && r <= '9': - return false - case 'a' <= r && r <= 'z': - return false - case 'A' <= r && r <= 'Z': - return false - case r == '_': - return false - } - return true - } - // Letters and digits are not separators - if unicode.IsLetter(r) || unicode.IsDigit(r) { - return false - } - // Otherwise, all we can do for now is treat spaces as separators. - return unicode.IsSpace(r) -} - -// Title returns a copy of s with all Unicode letters that begin words -// mapped to their title case. -// -// BUG(rsc): The rule Title uses for word boundaries does not handle Unicode punctuation properly. -func Title(s []byte) []byte { - // Use a closure here to remember state. - // Hackish but effective. Depends on Map scanning in order and calling - // the closure once per rune. - prev := ' ' - return Map( - func(r rune) rune { - if isSeparator(prev) { - prev = r - return unicode.ToTitle(r) - } - prev = r - return r - }, - s) -} - -// TrimLeftFunc returns a subslice of s by slicing off all leading UTF-8-encoded -// Unicode code points c that satisfy f(c). -func TrimLeftFunc(s []byte, f func(r rune) bool) []byte { - i := indexFunc(s, f, false) - if i == -1 { - return nil - } - return s[i:] -} - -// TrimRightFunc returns a subslice of s by slicing off all trailing UTF-8 -// encoded Unicode code points c that satisfy f(c). -func TrimRightFunc(s []byte, f func(r rune) bool) []byte { - i := lastIndexFunc(s, f, false) - if i >= 0 && s[i] >= utf8.RuneSelf { - _, wid := utf8.DecodeRune(s[i:]) - i += wid - } else { - i++ - } - return s[0:i] -} - -// TrimFunc returns a subslice of s by slicing off all leading and trailing -// UTF-8-encoded Unicode code points c that satisfy f(c). -func TrimFunc(s []byte, f func(r rune) bool) []byte { - return TrimRightFunc(TrimLeftFunc(s, f), f) -} - -// TrimPrefix returns s without the provided leading prefix string. -// If s doesn't start with prefix, s is returned unchanged. -func TrimPrefix(s, prefix []byte) []byte { - if HasPrefix(s, prefix) { - return s[len(prefix):] - } - return s -} - -// TrimSuffix returns s without the provided trailing suffix string. -// If s doesn't end with suffix, s is returned unchanged. -func TrimSuffix(s, suffix []byte) []byte { - if HasSuffix(s, suffix) { - return s[:len(s)-len(suffix)] - } - return s -} - -// IndexFunc interprets s as a sequence of UTF-8-encoded Unicode code points. -// It returns the byte index in s of the first Unicode -// code point satisfying f(c), or -1 if none do. -func IndexFunc(s []byte, f func(r rune) bool) int { - return indexFunc(s, f, true) -} - -// LastIndexFunc interprets s as a sequence of UTF-8-encoded Unicode code points. -// It returns the byte index in s of the last Unicode -// code point satisfying f(c), or -1 if none do. -func LastIndexFunc(s []byte, f func(r rune) bool) int { - return lastIndexFunc(s, f, true) -} - -// indexFunc is the same as IndexFunc except that if -// truth==false, the sense of the predicate function is -// inverted. -func indexFunc(s []byte, f func(r rune) bool, truth bool) int { - start := 0 - for start < len(s) { - wid := 1 - r := rune(s[start]) - if r >= utf8.RuneSelf { - r, wid = utf8.DecodeRune(s[start:]) - } - if f(r) == truth { - return start - } - start += wid - } - return -1 -} - -// lastIndexFunc is the same as LastIndexFunc except that if -// truth==false, the sense of the predicate function is -// inverted. -func lastIndexFunc(s []byte, f func(r rune) bool, truth bool) int { - for i := len(s); i > 0; { - r, size := rune(s[i-1]), 1 - if r >= utf8.RuneSelf { - r, size = utf8.DecodeLastRune(s[0:i]) - } - i -= size - if f(r) == truth { - return i - } - } - return -1 -} - -func makeCutsetFunc(cutset string) func(r rune) bool { - return func(r rune) bool { - for _, c := range cutset { - if c == r { - return true - } - } - return false - } -} - -// Trim returns a subslice of s by slicing off all leading and -// trailing UTF-8-encoded Unicode code points contained in cutset. -func Trim(s []byte, cutset string) []byte { - return TrimFunc(s, makeCutsetFunc(cutset)) -} - -// TrimLeft returns a subslice of s by slicing off all leading -// UTF-8-encoded Unicode code points contained in cutset. -func TrimLeft(s []byte, cutset string) []byte { - return TrimLeftFunc(s, makeCutsetFunc(cutset)) -} - -// TrimRight returns a subslice of s by slicing off all trailing -// UTF-8-encoded Unicode code points that are contained in cutset. -func TrimRight(s []byte, cutset string) []byte { - return TrimRightFunc(s, makeCutsetFunc(cutset)) -} - -// TrimSpace returns a subslice of s by slicing off all leading and -// trailing white space, as defined by Unicode. -func TrimSpace(s []byte) []byte { - return TrimFunc(s, unicode.IsSpace) -} - -// Runes returns a slice of runes (Unicode code points) equivalent to s. -func Runes(s []byte) []rune { - t := make([]rune, utf8.RuneCount(s)) - i := 0 - for len(s) > 0 { - r, l := utf8.DecodeRune(s) - t[i] = r - i++ - s = s[l:] - } - return t -} - -// Replace returns a copy of the slice s with the first n -// non-overlapping instances of old replaced by new. -// If old is empty, it matches at the beginning of the slice -// and after each UTF-8 sequence, yielding up to k+1 replacements -// for a k-rune slice. -// If n < 0, there is no limit on the number of replacements. -func Replace(s, old, new []byte, n int) []byte { - m := 0 - if n != 0 { - // Compute number of replacements. - m = Count(s, old) - } - if m == 0 { - // Just return a copy. - return append([]byte(nil), s...) - } - if n < 0 || m < n { - n = m - } - - // Apply replacements to buffer. - t := make([]byte, len(s)+n*(len(new)-len(old))) - w := 0 - start := 0 - for i := 0; i < n; i++ { - j := start - if len(old) == 0 { - if i > 0 { - _, wid := utf8.DecodeRune(s[start:]) - j += wid - } - } else { - j += Index(s[start:], old) - } - w += copy(t[w:], s[start:j]) - w += copy(t[w:], new) - start = j + len(old) - } - w += copy(t[w:], s[start:]) - return t[0:w] -} - -// EqualFold reports whether s and t, interpreted as UTF-8 strings, -// are equal under Unicode case-folding. -func EqualFold(s, t []byte) bool { - for len(s) != 0 && len(t) != 0 { - // Extract first rune from each. - var sr, tr rune - if s[0] < utf8.RuneSelf { - sr, s = rune(s[0]), s[1:] - } else { - r, size := utf8.DecodeRune(s) - sr, s = r, s[size:] - } - if t[0] < utf8.RuneSelf { - tr, t = rune(t[0]), t[1:] - } else { - r, size := utf8.DecodeRune(t) - tr, t = r, t[size:] - } - - // If they match, keep going; if not, return false. - - // Easy case. - if tr == sr { - continue - } - - // Make sr < tr to simplify what follows. - if tr < sr { - tr, sr = sr, tr - } - // Fast check for ASCII. - if tr < utf8.RuneSelf && 'A' <= sr && sr <= 'Z' { - // ASCII, and sr is upper case. tr must be lower case. - if tr == sr+'a'-'A' { - continue - } - return false - } - - // General case. SimpleFold(x) returns the next equivalent rune > x - // or wraps around to smaller values. - r := unicode.SimpleFold(sr) - for r != sr && r < tr { - r = unicode.SimpleFold(r) - } - if r == tr { - continue - } - return false - } - - // One string is empty. Are both? - return len(s) == len(t) -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/bytes_decl.go b/llgo/third_party/gofrontend/libgo/go/bytes/bytes_decl.go deleted file mode 100644 index b453f21aa4352d33e8e32443e221e22fb2fee613..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/bytes_decl.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes - -//go:noescape - -// IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s. -func IndexByte(s []byte, c byte) int // ../runtime/asm_$GOARCH.s - -//go:noescape - -// Equal returns a boolean reporting whether a and b -// are the same length and contain the same bytes. -// A nil argument is equivalent to an empty slice. -func Equal(a, b []byte) bool // ../runtime/asm_$GOARCH.s - -//go:noescape - -// Compare returns an integer comparing two byte slices lexicographically. -// The result will be 0 if a==b, -1 if a < b, and +1 if a > b. -// A nil argument is equivalent to an empty slice. -func Compare(a, b []byte) int // ../runtime/noasm.go or ../runtime/asm_{386,amd64}.s diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/bytes_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/bytes_test.go deleted file mode 100644 index 6245e481805779e8665965053bde7cae4ce31e78..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/bytes_test.go +++ /dev/null @@ -1,1257 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes_test - -import ( - . "bytes" - "math/rand" - "reflect" - "testing" - "unicode" - "unicode/utf8" -) - -func eq(a, b []string) bool { - if len(a) != len(b) { - return false - } - for i := 0; i < len(a); i++ { - if a[i] != b[i] { - return false - } - } - return true -} - -func sliceOfString(s [][]byte) []string { - result := make([]string, len(s)) - for i, v := range s { - result[i] = string(v) - } - return result -} - -// For ease of reading, the test cases use strings that are converted to byte -// slices before invoking the functions. - -var abcd = "abcd" -var faces = "☺☻☹" -var commas = "1,2,3,4" -var dots = "1....2....3....4" - -type BinOpTest struct { - a string - b string - i int -} - -var equalTests = []struct { - a, b []byte - i int -}{ - {[]byte(""), []byte(""), 0}, - {[]byte("a"), []byte(""), 1}, - {[]byte(""), []byte("a"), -1}, - {[]byte("abc"), []byte("abc"), 0}, - {[]byte("ab"), []byte("abc"), -1}, - {[]byte("abc"), []byte("ab"), 1}, - {[]byte("x"), []byte("ab"), 1}, - {[]byte("ab"), []byte("x"), -1}, - {[]byte("x"), []byte("a"), 1}, - {[]byte("b"), []byte("x"), -1}, - // test runtime·memeq's chunked implementation - {[]byte("abcdefgh"), []byte("abcdefgh"), 0}, - {[]byte("abcdefghi"), []byte("abcdefghi"), 0}, - {[]byte("abcdefghi"), []byte("abcdefghj"), -1}, - // nil tests - {nil, nil, 0}, - {[]byte(""), nil, 0}, - {nil, []byte(""), 0}, - {[]byte("a"), nil, 1}, - {nil, []byte("a"), -1}, -} - -func TestEqual(t *testing.T) { - for _, tt := range compareTests { - eql := Equal(tt.a, tt.b) - if eql != (tt.i == 0) { - t.Errorf(`Equal(%q, %q) = %v`, tt.a, tt.b, eql) - } - eql = EqualPortable(tt.a, tt.b) - if eql != (tt.i == 0) { - t.Errorf(`EqualPortable(%q, %q) = %v`, tt.a, tt.b, eql) - } - } -} - -func TestEqualExhaustive(t *testing.T) { - var size = 128 - if testing.Short() { - size = 32 - } - a := make([]byte, size) - b := make([]byte, size) - b_init := make([]byte, size) - // randomish but deterministic data - for i := 0; i < size; i++ { - a[i] = byte(17 * i) - b_init[i] = byte(23*i + 100) - } - - for len := 0; len <= size; len++ { - for x := 0; x <= size-len; x++ { - for y := 0; y <= size-len; y++ { - copy(b, b_init) - copy(b[y:y+len], a[x:x+len]) - if !Equal(a[x:x+len], b[y:y+len]) || !Equal(b[y:y+len], a[x:x+len]) { - t.Errorf("Equal(%d, %d, %d) = false", len, x, y) - } - } - } - } -} - -// make sure Equal returns false for minimally different strings. The data -// is all zeros except for a single one in one location. -func TestNotEqual(t *testing.T) { - var size = 128 - if testing.Short() { - size = 32 - } - a := make([]byte, size) - b := make([]byte, size) - - for len := 0; len <= size; len++ { - for x := 0; x <= size-len; x++ { - for y := 0; y <= size-len; y++ { - for diffpos := x; diffpos < x+len; diffpos++ { - a[diffpos] = 1 - if Equal(a[x:x+len], b[y:y+len]) || Equal(b[y:y+len], a[x:x+len]) { - t.Errorf("NotEqual(%d, %d, %d, %d) = true", len, x, y, diffpos) - } - a[diffpos] = 0 - } - } - } - } -} - -var indexTests = []BinOpTest{ - {"", "", 0}, - {"", "a", -1}, - {"", "foo", -1}, - {"fo", "foo", -1}, - {"foo", "baz", -1}, - {"foo", "foo", 0}, - {"oofofoofooo", "f", 2}, - {"oofofoofooo", "foo", 4}, - {"barfoobarfoo", "foo", 3}, - {"foo", "", 0}, - {"foo", "o", 1}, - {"abcABCabc", "A", 3}, - // cases with one byte strings - test IndexByte and special case in Index() - {"", "a", -1}, - {"x", "a", -1}, - {"x", "x", 0}, - {"abc", "a", 0}, - {"abc", "b", 1}, - {"abc", "c", 2}, - {"abc", "x", -1}, - {"barfoobarfooyyyzzzyyyzzzyyyzzzyyyxxxzzzyyy", "x", 33}, - {"foofyfoobarfoobar", "y", 4}, - {"oooooooooooooooooooooo", "r", -1}, -} - -var lastIndexTests = []BinOpTest{ - {"", "", 0}, - {"", "a", -1}, - {"", "foo", -1}, - {"fo", "foo", -1}, - {"foo", "foo", 0}, - {"foo", "f", 0}, - {"oofofoofooo", "f", 7}, - {"oofofoofooo", "foo", 7}, - {"barfoobarfoo", "foo", 9}, - {"foo", "", 3}, - {"foo", "o", 2}, - {"abcABCabc", "A", 3}, - {"abcABCabc", "a", 6}, -} - -var indexAnyTests = []BinOpTest{ - {"", "", -1}, - {"", "a", -1}, - {"", "abc", -1}, - {"a", "", -1}, - {"a", "a", 0}, - {"aaa", "a", 0}, - {"abc", "xyz", -1}, - {"abc", "xcz", 2}, - {"ab☺c", "x☺yz", 2}, - {"aRegExp*", ".(|)*+?^$[]", 7}, - {dots + dots + dots, " ", -1}, -} - -var lastIndexAnyTests = []BinOpTest{ - {"", "", -1}, - {"", "a", -1}, - {"", "abc", -1}, - {"a", "", -1}, - {"a", "a", 0}, - {"aaa", "a", 2}, - {"abc", "xyz", -1}, - {"abc", "ab", 1}, - {"a☺b☻c☹d", "uvw☻xyz", 2 + len("☺")}, - {"a.RegExp*", ".(|)*+?^$[]", 8}, - {dots + dots + dots, " ", -1}, -} - -var indexRuneTests = []BinOpTest{ - {"", "a", -1}, - {"", "☺", -1}, - {"foo", "☹", -1}, - {"foo", "o", 1}, - {"foo☺bar", "☺", 3}, - {"foo☺☻☹bar", "☹", 9}, -} - -// Execute f on each test case. funcName should be the name of f; it's used -// in failure reports. -func runIndexTests(t *testing.T, f func(s, sep []byte) int, funcName string, testCases []BinOpTest) { - for _, test := range testCases { - a := []byte(test.a) - b := []byte(test.b) - actual := f(a, b) - if actual != test.i { - t.Errorf("%s(%q,%q) = %v; want %v", funcName, a, b, actual, test.i) - } - } -} - -func runIndexAnyTests(t *testing.T, f func(s []byte, chars string) int, funcName string, testCases []BinOpTest) { - for _, test := range testCases { - a := []byte(test.a) - actual := f(a, test.b) - if actual != test.i { - t.Errorf("%s(%q,%q) = %v; want %v", funcName, a, test.b, actual, test.i) - } - } -} - -func TestIndex(t *testing.T) { runIndexTests(t, Index, "Index", indexTests) } -func TestLastIndex(t *testing.T) { runIndexTests(t, LastIndex, "LastIndex", lastIndexTests) } -func TestIndexAny(t *testing.T) { runIndexAnyTests(t, IndexAny, "IndexAny", indexAnyTests) } -func TestLastIndexAny(t *testing.T) { - runIndexAnyTests(t, LastIndexAny, "LastIndexAny", lastIndexAnyTests) -} - -func TestIndexByte(t *testing.T) { - for _, tt := range indexTests { - if len(tt.b) != 1 { - continue - } - a := []byte(tt.a) - b := tt.b[0] - pos := IndexByte(a, b) - if pos != tt.i { - t.Errorf(`IndexByte(%q, '%c') = %v`, tt.a, b, pos) - } - posp := IndexBytePortable(a, b) - if posp != tt.i { - t.Errorf(`indexBytePortable(%q, '%c') = %v`, tt.a, b, posp) - } - } -} - -func TestLastIndexByte(t *testing.T) { - testCases := []BinOpTest{ - {"", "q", -1}, - {"abcdef", "q", -1}, - {"abcdefabcdef", "a", len("abcdef")}, // something in the middle - {"abcdefabcdef", "f", len("abcdefabcde")}, // last byte - {"zabcdefabcdef", "z", 0}, // first byte - {"a☺b☻c☹d", "b", len("a☺")}, // non-ascii - } - for _, test := range testCases { - actual := LastIndexByte([]byte(test.a), test.b[0]) - if actual != test.i { - t.Errorf("LastIndexByte(%q,%c) = %v; want %v", test.a, test.b[0], actual, test.i) - } - } -} - -// test a larger buffer with different sizes and alignments -func TestIndexByteBig(t *testing.T) { - var n = 1024 - if testing.Short() { - n = 128 - } - b := make([]byte, n) - for i := 0; i < n; i++ { - // different start alignments - b1 := b[i:] - for j := 0; j < len(b1); j++ { - b1[j] = 'x' - pos := IndexByte(b1, 'x') - if pos != j { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - b1[j] = 0 - pos = IndexByte(b1, 'x') - if pos != -1 { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - } - // different end alignments - b1 = b[:i] - for j := 0; j < len(b1); j++ { - b1[j] = 'x' - pos := IndexByte(b1, 'x') - if pos != j { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - b1[j] = 0 - pos = IndexByte(b1, 'x') - if pos != -1 { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - } - // different start and end alignments - b1 = b[i/2 : n-(i+1)/2] - for j := 0; j < len(b1); j++ { - b1[j] = 'x' - pos := IndexByte(b1, 'x') - if pos != j { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - b1[j] = 0 - pos = IndexByte(b1, 'x') - if pos != -1 { - t.Errorf("IndexByte(%q, 'x') = %v", b1, pos) - } - } - } -} - -func TestIndexRune(t *testing.T) { - for _, tt := range indexRuneTests { - a := []byte(tt.a) - r, _ := utf8.DecodeRuneInString(tt.b) - pos := IndexRune(a, r) - if pos != tt.i { - t.Errorf(`IndexRune(%q, '%c') = %v`, tt.a, r, pos) - } - } -} - -var bmbuf []byte - -func BenchmarkIndexByte32(b *testing.B) { bmIndexByte(b, IndexByte, 32) } -func BenchmarkIndexByte4K(b *testing.B) { bmIndexByte(b, IndexByte, 4<<10) } -func BenchmarkIndexByte4M(b *testing.B) { bmIndexByte(b, IndexByte, 4<<20) } -func BenchmarkIndexByte64M(b *testing.B) { bmIndexByte(b, IndexByte, 64<<20) } -func BenchmarkIndexBytePortable32(b *testing.B) { bmIndexByte(b, IndexBytePortable, 32) } -func BenchmarkIndexBytePortable4K(b *testing.B) { bmIndexByte(b, IndexBytePortable, 4<<10) } -func BenchmarkIndexBytePortable4M(b *testing.B) { bmIndexByte(b, IndexBytePortable, 4<<20) } -func BenchmarkIndexBytePortable64M(b *testing.B) { bmIndexByte(b, IndexBytePortable, 64<<20) } - -func bmIndexByte(b *testing.B, index func([]byte, byte) int, n int) { - if len(bmbuf) < n { - bmbuf = make([]byte, n) - } - b.SetBytes(int64(n)) - buf := bmbuf[0:n] - buf[n-1] = 'x' - for i := 0; i < b.N; i++ { - j := index(buf, 'x') - if j != n-1 { - b.Fatal("bad index", j) - } - } - buf[n-1] = '\x00' -} - -func BenchmarkEqual0(b *testing.B) { - var buf [4]byte - buf1 := buf[0:0] - buf2 := buf[1:1] - for i := 0; i < b.N; i++ { - eq := Equal(buf1, buf2) - if !eq { - b.Fatal("bad equal") - } - } -} - -func BenchmarkEqual1(b *testing.B) { bmEqual(b, Equal, 1) } -func BenchmarkEqual6(b *testing.B) { bmEqual(b, Equal, 6) } -func BenchmarkEqual9(b *testing.B) { bmEqual(b, Equal, 9) } -func BenchmarkEqual15(b *testing.B) { bmEqual(b, Equal, 15) } -func BenchmarkEqual16(b *testing.B) { bmEqual(b, Equal, 16) } -func BenchmarkEqual20(b *testing.B) { bmEqual(b, Equal, 20) } -func BenchmarkEqual32(b *testing.B) { bmEqual(b, Equal, 32) } -func BenchmarkEqual4K(b *testing.B) { bmEqual(b, Equal, 4<<10) } -func BenchmarkEqual4M(b *testing.B) { bmEqual(b, Equal, 4<<20) } -func BenchmarkEqual64M(b *testing.B) { bmEqual(b, Equal, 64<<20) } -func BenchmarkEqualPort1(b *testing.B) { bmEqual(b, EqualPortable, 1) } -func BenchmarkEqualPort6(b *testing.B) { bmEqual(b, EqualPortable, 6) } -func BenchmarkEqualPort32(b *testing.B) { bmEqual(b, EqualPortable, 32) } -func BenchmarkEqualPort4K(b *testing.B) { bmEqual(b, EqualPortable, 4<<10) } -func BenchmarkEqualPortable4M(b *testing.B) { bmEqual(b, EqualPortable, 4<<20) } -func BenchmarkEqualPortable64M(b *testing.B) { bmEqual(b, EqualPortable, 64<<20) } - -func bmEqual(b *testing.B, equal func([]byte, []byte) bool, n int) { - if len(bmbuf) < 2*n { - bmbuf = make([]byte, 2*n) - } - b.SetBytes(int64(n)) - buf1 := bmbuf[0:n] - buf2 := bmbuf[n : 2*n] - buf1[n-1] = 'x' - buf2[n-1] = 'x' - for i := 0; i < b.N; i++ { - eq := equal(buf1, buf2) - if !eq { - b.Fatal("bad equal") - } - } - buf1[n-1] = '\x00' - buf2[n-1] = '\x00' -} - -func BenchmarkIndex32(b *testing.B) { bmIndex(b, Index, 32) } -func BenchmarkIndex4K(b *testing.B) { bmIndex(b, Index, 4<<10) } -func BenchmarkIndex4M(b *testing.B) { bmIndex(b, Index, 4<<20) } -func BenchmarkIndex64M(b *testing.B) { bmIndex(b, Index, 64<<20) } - -func bmIndex(b *testing.B, index func([]byte, []byte) int, n int) { - if len(bmbuf) < n { - bmbuf = make([]byte, n) - } - b.SetBytes(int64(n)) - buf := bmbuf[0:n] - buf[n-1] = 'x' - for i := 0; i < b.N; i++ { - j := index(buf, buf[n-7:]) - if j != n-7 { - b.Fatal("bad index", j) - } - } - buf[n-1] = '\x00' -} - -func BenchmarkIndexEasy32(b *testing.B) { bmIndexEasy(b, Index, 32) } -func BenchmarkIndexEasy4K(b *testing.B) { bmIndexEasy(b, Index, 4<<10) } -func BenchmarkIndexEasy4M(b *testing.B) { bmIndexEasy(b, Index, 4<<20) } -func BenchmarkIndexEasy64M(b *testing.B) { bmIndexEasy(b, Index, 64<<20) } - -func bmIndexEasy(b *testing.B, index func([]byte, []byte) int, n int) { - if len(bmbuf) < n { - bmbuf = make([]byte, n) - } - b.SetBytes(int64(n)) - buf := bmbuf[0:n] - buf[n-1] = 'x' - buf[n-7] = 'x' - for i := 0; i < b.N; i++ { - j := index(buf, buf[n-7:]) - if j != n-7 { - b.Fatal("bad index", j) - } - } - buf[n-1] = '\x00' - buf[n-7] = '\x00' -} - -func BenchmarkCount32(b *testing.B) { bmCount(b, Count, 32) } -func BenchmarkCount4K(b *testing.B) { bmCount(b, Count, 4<<10) } -func BenchmarkCount4M(b *testing.B) { bmCount(b, Count, 4<<20) } -func BenchmarkCount64M(b *testing.B) { bmCount(b, Count, 64<<20) } - -func bmCount(b *testing.B, count func([]byte, []byte) int, n int) { - if len(bmbuf) < n { - bmbuf = make([]byte, n) - } - b.SetBytes(int64(n)) - buf := bmbuf[0:n] - buf[n-1] = 'x' - for i := 0; i < b.N; i++ { - j := count(buf, buf[n-7:]) - if j != 1 { - b.Fatal("bad count", j) - } - } - buf[n-1] = '\x00' -} - -func BenchmarkCountEasy32(b *testing.B) { bmCountEasy(b, Count, 32) } -func BenchmarkCountEasy4K(b *testing.B) { bmCountEasy(b, Count, 4<<10) } -func BenchmarkCountEasy4M(b *testing.B) { bmCountEasy(b, Count, 4<<20) } -func BenchmarkCountEasy64M(b *testing.B) { bmCountEasy(b, Count, 64<<20) } - -func bmCountEasy(b *testing.B, count func([]byte, []byte) int, n int) { - if len(bmbuf) < n { - bmbuf = make([]byte, n) - } - b.SetBytes(int64(n)) - buf := bmbuf[0:n] - buf[n-1] = 'x' - buf[n-7] = 'x' - for i := 0; i < b.N; i++ { - j := count(buf, buf[n-7:]) - if j != 1 { - b.Fatal("bad count", j) - } - } - buf[n-1] = '\x00' - buf[n-7] = '\x00' -} - -type ExplodeTest struct { - s string - n int - a []string -} - -var explodetests = []ExplodeTest{ - {"", -1, []string{}}, - {abcd, -1, []string{"a", "b", "c", "d"}}, - {faces, -1, []string{"☺", "☻", "☹"}}, - {abcd, 2, []string{"a", "bcd"}}, -} - -func TestExplode(t *testing.T) { - for _, tt := range explodetests { - a := SplitN([]byte(tt.s), nil, tt.n) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf(`Explode("%s", %d) = %v; want %v`, tt.s, tt.n, result, tt.a) - continue - } - s := Join(a, []byte{}) - if string(s) != tt.s { - t.Errorf(`Join(Explode("%s", %d), "") = "%s"`, tt.s, tt.n, s) - } - } -} - -type SplitTest struct { - s string - sep string - n int - a []string -} - -var splittests = []SplitTest{ - {abcd, "a", 0, nil}, - {abcd, "a", -1, []string{"", "bcd"}}, - {abcd, "z", -1, []string{"abcd"}}, - {abcd, "", -1, []string{"a", "b", "c", "d"}}, - {commas, ",", -1, []string{"1", "2", "3", "4"}}, - {dots, "...", -1, []string{"1", ".2", ".3", ".4"}}, - {faces, "☹", -1, []string{"☺☻", ""}}, - {faces, "~", -1, []string{faces}}, - {faces, "", -1, []string{"☺", "☻", "☹"}}, - {"1 2 3 4", " ", 3, []string{"1", "2", "3 4"}}, - {"1 2", " ", 3, []string{"1", "2"}}, - {"123", "", 2, []string{"1", "23"}}, - {"123", "", 17, []string{"1", "2", "3"}}, -} - -func TestSplit(t *testing.T) { - for _, tt := range splittests { - a := SplitN([]byte(tt.s), []byte(tt.sep), tt.n) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf(`Split(%q, %q, %d) = %v; want %v`, tt.s, tt.sep, tt.n, result, tt.a) - continue - } - if tt.n == 0 { - continue - } - s := Join(a, []byte(tt.sep)) - if string(s) != tt.s { - t.Errorf(`Join(Split(%q, %q, %d), %q) = %q`, tt.s, tt.sep, tt.n, tt.sep, s) - } - if tt.n < 0 { - b := Split([]byte(tt.s), []byte(tt.sep)) - if !reflect.DeepEqual(a, b) { - t.Errorf("Split disagrees withSplitN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) - } - } - if len(a) > 0 { - in, out := a[0], s - if cap(in) == cap(out) && &in[:1][0] == &out[:1][0] { - t.Errorf("Join(%#v, %q) didn't copy", a, tt.sep) - } - } - } -} - -var splitaftertests = []SplitTest{ - {abcd, "a", -1, []string{"a", "bcd"}}, - {abcd, "z", -1, []string{"abcd"}}, - {abcd, "", -1, []string{"a", "b", "c", "d"}}, - {commas, ",", -1, []string{"1,", "2,", "3,", "4"}}, - {dots, "...", -1, []string{"1...", ".2...", ".3...", ".4"}}, - {faces, "☹", -1, []string{"☺☻☹", ""}}, - {faces, "~", -1, []string{faces}}, - {faces, "", -1, []string{"☺", "☻", "☹"}}, - {"1 2 3 4", " ", 3, []string{"1 ", "2 ", "3 4"}}, - {"1 2 3", " ", 3, []string{"1 ", "2 ", "3"}}, - {"1 2", " ", 3, []string{"1 ", "2"}}, - {"123", "", 2, []string{"1", "23"}}, - {"123", "", 17, []string{"1", "2", "3"}}, -} - -func TestSplitAfter(t *testing.T) { - for _, tt := range splitaftertests { - a := SplitAfterN([]byte(tt.s), []byte(tt.sep), tt.n) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf(`Split(%q, %q, %d) = %v; want %v`, tt.s, tt.sep, tt.n, result, tt.a) - continue - } - s := Join(a, nil) - if string(s) != tt.s { - t.Errorf(`Join(Split(%q, %q, %d), %q) = %q`, tt.s, tt.sep, tt.n, tt.sep, s) - } - if tt.n < 0 { - b := SplitAfter([]byte(tt.s), []byte(tt.sep)) - if !reflect.DeepEqual(a, b) { - t.Errorf("SplitAfter disagrees withSplitAfterN(%q, %q, %d) = %v; want %v", tt.s, tt.sep, tt.n, b, a) - } - } - } -} - -type FieldsTest struct { - s string - a []string -} - -var fieldstests = []FieldsTest{ - {"", []string{}}, - {" ", []string{}}, - {" \t ", []string{}}, - {" abc ", []string{"abc"}}, - {"1 2 3 4", []string{"1", "2", "3", "4"}}, - {"1 2 3 4", []string{"1", "2", "3", "4"}}, - {"1\t\t2\t\t3\t4", []string{"1", "2", "3", "4"}}, - {"1\u20002\u20013\u20024", []string{"1", "2", "3", "4"}}, - {"\u2000\u2001\u2002", []string{}}, - {"\n™\t™\n", []string{"™", "™"}}, - {faces, []string{faces}}, -} - -func TestFields(t *testing.T) { - for _, tt := range fieldstests { - a := Fields([]byte(tt.s)) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf("Fields(%q) = %v; want %v", tt.s, a, tt.a) - continue - } - } -} - -func TestFieldsFunc(t *testing.T) { - for _, tt := range fieldstests { - a := FieldsFunc([]byte(tt.s), unicode.IsSpace) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf("FieldsFunc(%q, unicode.IsSpace) = %v; want %v", tt.s, a, tt.a) - continue - } - } - pred := func(c rune) bool { return c == 'X' } - var fieldsFuncTests = []FieldsTest{ - {"", []string{}}, - {"XX", []string{}}, - {"XXhiXXX", []string{"hi"}}, - {"aXXbXXXcX", []string{"a", "b", "c"}}, - } - for _, tt := range fieldsFuncTests { - a := FieldsFunc([]byte(tt.s), pred) - result := sliceOfString(a) - if !eq(result, tt.a) { - t.Errorf("FieldsFunc(%q) = %v, want %v", tt.s, a, tt.a) - } - } -} - -// Test case for any function which accepts and returns a byte slice. -// For ease of creation, we write the byte slices as strings. -type StringTest struct { - in, out string -} - -var upperTests = []StringTest{ - {"", ""}, - {"abc", "ABC"}, - {"AbC123", "ABC123"}, - {"azAZ09_", "AZAZ09_"}, - {"\u0250\u0250\u0250\u0250\u0250", "\u2C6F\u2C6F\u2C6F\u2C6F\u2C6F"}, // grows one byte per char -} - -var lowerTests = []StringTest{ - {"", ""}, - {"abc", "abc"}, - {"AbC123", "abc123"}, - {"azAZ09_", "azaz09_"}, - {"\u2C6D\u2C6D\u2C6D\u2C6D\u2C6D", "\u0251\u0251\u0251\u0251\u0251"}, // shrinks one byte per char -} - -const space = "\t\v\r\f\n\u0085\u00a0\u2000\u3000" - -var trimSpaceTests = []StringTest{ - {"", ""}, - {"abc", "abc"}, - {space + "abc" + space, "abc"}, - {" ", ""}, - {" \t\r\n \t\t\r\r\n\n ", ""}, - {" \t\r\n x\t\t\r\r\n\n ", "x"}, - {" \u2000\t\r\n x\t\t\r\r\ny\n \u3000", "x\t\t\r\r\ny"}, - {"1 \t\r\n2", "1 \t\r\n2"}, - {" x\x80", "x\x80"}, - {" x\xc0", "x\xc0"}, - {"x \xc0\xc0 ", "x \xc0\xc0"}, - {"x \xc0", "x \xc0"}, - {"x \xc0 ", "x \xc0"}, - {"x \xc0\xc0 ", "x \xc0\xc0"}, - {"x ☺\xc0\xc0 ", "x ☺\xc0\xc0"}, - {"x ☺ ", "x ☺"}, -} - -// Execute f on each test case. funcName should be the name of f; it's used -// in failure reports. -func runStringTests(t *testing.T, f func([]byte) []byte, funcName string, testCases []StringTest) { - for _, tc := range testCases { - actual := string(f([]byte(tc.in))) - if actual != tc.out { - t.Errorf("%s(%q) = %q; want %q", funcName, tc.in, actual, tc.out) - } - } -} - -func tenRunes(r rune) string { - runes := make([]rune, 10) - for i := range runes { - runes[i] = r - } - return string(runes) -} - -// User-defined self-inverse mapping function -func rot13(r rune) rune { - const step = 13 - if r >= 'a' && r <= 'z' { - return ((r - 'a' + step) % 26) + 'a' - } - if r >= 'A' && r <= 'Z' { - return ((r - 'A' + step) % 26) + 'A' - } - return r -} - -func TestMap(t *testing.T) { - // Run a couple of awful growth/shrinkage tests - a := tenRunes('a') - - // 1. Grow. This triggers two reallocations in Map. - maxRune := func(r rune) rune { return unicode.MaxRune } - m := Map(maxRune, []byte(a)) - expect := tenRunes(unicode.MaxRune) - if string(m) != expect { - t.Errorf("growing: expected %q got %q", expect, m) - } - - // 2. Shrink - minRune := func(r rune) rune { return 'a' } - m = Map(minRune, []byte(tenRunes(unicode.MaxRune))) - expect = a - if string(m) != expect { - t.Errorf("shrinking: expected %q got %q", expect, m) - } - - // 3. Rot13 - m = Map(rot13, []byte("a to zed")) - expect = "n gb mrq" - if string(m) != expect { - t.Errorf("rot13: expected %q got %q", expect, m) - } - - // 4. Rot13^2 - m = Map(rot13, Map(rot13, []byte("a to zed"))) - expect = "a to zed" - if string(m) != expect { - t.Errorf("rot13: expected %q got %q", expect, m) - } - - // 5. Drop - dropNotLatin := func(r rune) rune { - if unicode.Is(unicode.Latin, r) { - return r - } - return -1 - } - m = Map(dropNotLatin, []byte("Hello, 세계")) - expect = "Hello" - if string(m) != expect { - t.Errorf("drop: expected %q got %q", expect, m) - } - - // 6. Invalid rune - invalidRune := func(r rune) rune { - return utf8.MaxRune + 1 - } - m = Map(invalidRune, []byte("x")) - expect = "\uFFFD" - if string(m) != expect { - t.Errorf("invalidRune: expected %q got %q", expect, m) - } -} - -func TestToUpper(t *testing.T) { runStringTests(t, ToUpper, "ToUpper", upperTests) } - -func TestToLower(t *testing.T) { runStringTests(t, ToLower, "ToLower", lowerTests) } - -func TestTrimSpace(t *testing.T) { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) } - -type RepeatTest struct { - in, out string - count int -} - -var RepeatTests = []RepeatTest{ - {"", "", 0}, - {"", "", 1}, - {"", "", 2}, - {"-", "", 0}, - {"-", "-", 1}, - {"-", "----------", 10}, - {"abc ", "abc abc abc ", 3}, -} - -func TestRepeat(t *testing.T) { - for _, tt := range RepeatTests { - tin := []byte(tt.in) - tout := []byte(tt.out) - a := Repeat(tin, tt.count) - if !Equal(a, tout) { - t.Errorf("Repeat(%q, %d) = %q; want %q", tin, tt.count, a, tout) - continue - } - } -} - -func runesEqual(a, b []rune) bool { - if len(a) != len(b) { - return false - } - for i, r := range a { - if r != b[i] { - return false - } - } - return true -} - -type RunesTest struct { - in string - out []rune - lossy bool -} - -var RunesTests = []RunesTest{ - {"", []rune{}, false}, - {" ", []rune{32}, false}, - {"ABC", []rune{65, 66, 67}, false}, - {"abc", []rune{97, 98, 99}, false}, - {"\u65e5\u672c\u8a9e", []rune{26085, 26412, 35486}, false}, - {"ab\x80c", []rune{97, 98, 0xFFFD, 99}, true}, - {"ab\xc0c", []rune{97, 98, 0xFFFD, 99}, true}, -} - -func TestRunes(t *testing.T) { - for _, tt := range RunesTests { - tin := []byte(tt.in) - a := Runes(tin) - if !runesEqual(a, tt.out) { - t.Errorf("Runes(%q) = %v; want %v", tin, a, tt.out) - continue - } - if !tt.lossy { - // can only test reassembly if we didn't lose information - s := string(a) - if s != tt.in { - t.Errorf("string(Runes(%q)) = %x; want %x", tin, s, tin) - } - } - } -} - -type TrimTest struct { - f string - in, arg, out string -} - -var trimTests = []TrimTest{ - {"Trim", "abba", "a", "bb"}, - {"Trim", "abba", "ab", ""}, - {"TrimLeft", "abba", "ab", ""}, - {"TrimRight", "abba", "ab", ""}, - {"TrimLeft", "abba", "a", "bba"}, - {"TrimRight", "abba", "a", "abb"}, - {"Trim", "", "<>", "tag"}, - {"Trim", "* listitem", " *", "listitem"}, - {"Trim", `"quote"`, `"`, "quote"}, - {"Trim", "\u2C6F\u2C6F\u0250\u0250\u2C6F\u2C6F", "\u2C6F", "\u0250\u0250"}, - //empty string tests - {"Trim", "abba", "", "abba"}, - {"Trim", "", "123", ""}, - {"Trim", "", "", ""}, - {"TrimLeft", "abba", "", "abba"}, - {"TrimLeft", "", "123", ""}, - {"TrimLeft", "", "", ""}, - {"TrimRight", "abba", "", "abba"}, - {"TrimRight", "", "123", ""}, - {"TrimRight", "", "", ""}, - {"TrimRight", "☺\xc0", "☺", "☺\xc0"}, - {"TrimPrefix", "aabb", "a", "abb"}, - {"TrimPrefix", "aabb", "b", "aabb"}, - {"TrimSuffix", "aabb", "a", "aabb"}, - {"TrimSuffix", "aabb", "b", "aab"}, -} - -func TestTrim(t *testing.T) { - for _, tc := range trimTests { - name := tc.f - var f func([]byte, string) []byte - var fb func([]byte, []byte) []byte - switch name { - case "Trim": - f = Trim - case "TrimLeft": - f = TrimLeft - case "TrimRight": - f = TrimRight - case "TrimPrefix": - fb = TrimPrefix - case "TrimSuffix": - fb = TrimSuffix - default: - t.Errorf("Undefined trim function %s", name) - } - var actual string - if f != nil { - actual = string(f([]byte(tc.in), tc.arg)) - } else { - actual = string(fb([]byte(tc.in), []byte(tc.arg))) - } - if actual != tc.out { - t.Errorf("%s(%q, %q) = %q; want %q", name, tc.in, tc.arg, actual, tc.out) - } - } -} - -type predicate struct { - f func(r rune) bool - name string -} - -var isSpace = predicate{unicode.IsSpace, "IsSpace"} -var isDigit = predicate{unicode.IsDigit, "IsDigit"} -var isUpper = predicate{unicode.IsUpper, "IsUpper"} -var isValidRune = predicate{ - func(r rune) bool { - return r != utf8.RuneError - }, - "IsValidRune", -} - -type TrimFuncTest struct { - f predicate - in, out string -} - -func not(p predicate) predicate { - return predicate{ - func(r rune) bool { - return !p.f(r) - }, - "not " + p.name, - } -} - -var trimFuncTests = []TrimFuncTest{ - {isSpace, space + " hello " + space, "hello"}, - {isDigit, "\u0e50\u0e5212hello34\u0e50\u0e51", "hello"}, - {isUpper, "\u2C6F\u2C6F\u2C6F\u2C6FABCDhelloEF\u2C6F\u2C6FGH\u2C6F\u2C6F", "hello"}, - {not(isSpace), "hello" + space + "hello", space}, - {not(isDigit), "hello\u0e50\u0e521234\u0e50\u0e51helo", "\u0e50\u0e521234\u0e50\u0e51"}, - {isValidRune, "ab\xc0a\xc0cd", "\xc0a\xc0"}, - {not(isValidRune), "\xc0a\xc0", "a"}, -} - -func TestTrimFunc(t *testing.T) { - for _, tc := range trimFuncTests { - actual := string(TrimFunc([]byte(tc.in), tc.f.f)) - if actual != tc.out { - t.Errorf("TrimFunc(%q, %q) = %q; want %q", tc.in, tc.f.name, actual, tc.out) - } - } -} - -type IndexFuncTest struct { - in string - f predicate - first, last int -} - -var indexFuncTests = []IndexFuncTest{ - {"", isValidRune, -1, -1}, - {"abc", isDigit, -1, -1}, - {"0123", isDigit, 0, 3}, - {"a1b", isDigit, 1, 1}, - {space, isSpace, 0, len(space) - 3}, // last rune in space is 3 bytes - {"\u0e50\u0e5212hello34\u0e50\u0e51", isDigit, 0, 18}, - {"\u2C6F\u2C6F\u2C6F\u2C6FABCDhelloEF\u2C6F\u2C6FGH\u2C6F\u2C6F", isUpper, 0, 34}, - {"12\u0e50\u0e52hello34\u0e50\u0e51", not(isDigit), 8, 12}, - - // tests of invalid UTF-8 - {"\x801", isDigit, 1, 1}, - {"\x80abc", isDigit, -1, -1}, - {"\xc0a\xc0", isValidRune, 1, 1}, - {"\xc0a\xc0", not(isValidRune), 0, 2}, - {"\xc0☺\xc0", not(isValidRune), 0, 4}, - {"\xc0☺\xc0\xc0", not(isValidRune), 0, 5}, - {"ab\xc0a\xc0cd", not(isValidRune), 2, 4}, - {"a\xe0\x80cd", not(isValidRune), 1, 2}, -} - -func TestIndexFunc(t *testing.T) { - for _, tc := range indexFuncTests { - first := IndexFunc([]byte(tc.in), tc.f.f) - if first != tc.first { - t.Errorf("IndexFunc(%q, %s) = %d; want %d", tc.in, tc.f.name, first, tc.first) - } - last := LastIndexFunc([]byte(tc.in), tc.f.f) - if last != tc.last { - t.Errorf("LastIndexFunc(%q, %s) = %d; want %d", tc.in, tc.f.name, last, tc.last) - } - } -} - -type ReplaceTest struct { - in string - old, new string - n int - out string -} - -var ReplaceTests = []ReplaceTest{ - {"hello", "l", "L", 0, "hello"}, - {"hello", "l", "L", -1, "heLLo"}, - {"hello", "x", "X", -1, "hello"}, - {"", "x", "X", -1, ""}, - {"radar", "r", "", -1, "ada"}, - {"", "", "<>", -1, "<>"}, - {"banana", "a", "<>", -1, "b<>n<>n<>"}, - {"banana", "a", "<>", 1, "b<>nana"}, - {"banana", "a", "<>", 1000, "b<>n<>n<>"}, - {"banana", "an", "<>", -1, "b<><>a"}, - {"banana", "ana", "<>", -1, "b<>na"}, - {"banana", "", "<>", -1, "<>b<>a<>n<>a<>n<>a<>"}, - {"banana", "", "<>", 10, "<>b<>a<>n<>a<>n<>a<>"}, - {"banana", "", "<>", 6, "<>b<>a<>n<>a<>n<>a"}, - {"banana", "", "<>", 5, "<>b<>a<>n<>a<>na"}, - {"banana", "", "<>", 1, "<>banana"}, - {"banana", "a", "a", -1, "banana"}, - {"banana", "a", "a", 1, "banana"}, - {"☺☻☹", "", "<>", -1, "<>☺<>☻<>☹<>"}, -} - -func TestReplace(t *testing.T) { - for _, tt := range ReplaceTests { - in := append([]byte(tt.in), ""...) - in = in[:len(tt.in)] - out := Replace(in, []byte(tt.old), []byte(tt.new), tt.n) - if s := string(out); s != tt.out { - t.Errorf("Replace(%q, %q, %q, %d) = %q, want %q", tt.in, tt.old, tt.new, tt.n, s, tt.out) - } - if cap(in) == cap(out) && &in[:1][0] == &out[:1][0] { - t.Errorf("Replace(%q, %q, %q, %d) didn't copy", tt.in, tt.old, tt.new, tt.n) - } - } -} - -type TitleTest struct { - in, out string -} - -var TitleTests = []TitleTest{ - {"", ""}, - {"a", "A"}, - {" aaa aaa aaa ", " Aaa Aaa Aaa "}, - {" Aaa Aaa Aaa ", " Aaa Aaa Aaa "}, - {"123a456", "123a456"}, - {"double-blind", "Double-Blind"}, - {"ÿøû", "Ÿøû"}, - {"with_underscore", "With_underscore"}, - {"unicode \xe2\x80\xa8 line separator", "Unicode \xe2\x80\xa8 Line Separator"}, -} - -func TestTitle(t *testing.T) { - for _, tt := range TitleTests { - if s := string(Title([]byte(tt.in))); s != tt.out { - t.Errorf("Title(%q) = %q, want %q", tt.in, s, tt.out) - } - } -} - -var ToTitleTests = []TitleTest{ - {"", ""}, - {"a", "A"}, - {" aaa aaa aaa ", " AAA AAA AAA "}, - {" Aaa Aaa Aaa ", " AAA AAA AAA "}, - {"123a456", "123A456"}, - {"double-blind", "DOUBLE-BLIND"}, - {"ÿøû", "ŸØÛ"}, -} - -func TestToTitle(t *testing.T) { - for _, tt := range ToTitleTests { - if s := string(ToTitle([]byte(tt.in))); s != tt.out { - t.Errorf("ToTitle(%q) = %q, want %q", tt.in, s, tt.out) - } - } -} - -var EqualFoldTests = []struct { - s, t string - out bool -}{ - {"abc", "abc", true}, - {"ABcd", "ABcd", true}, - {"123abc", "123ABC", true}, - {"αβδ", "ΑΒΔ", true}, - {"abc", "xyz", false}, - {"abc", "XYZ", false}, - {"abcdefghijk", "abcdefghijX", false}, - {"abcdefghijk", "abcdefghij\u212A", true}, - {"abcdefghijK", "abcdefghij\u212A", true}, - {"abcdefghijkz", "abcdefghij\u212Ay", false}, - {"abcdefghijKz", "abcdefghij\u212Ay", false}, -} - -func TestEqualFold(t *testing.T) { - for _, tt := range EqualFoldTests { - if out := EqualFold([]byte(tt.s), []byte(tt.t)); out != tt.out { - t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.s, tt.t, out, tt.out) - } - if out := EqualFold([]byte(tt.t), []byte(tt.s)); out != tt.out { - t.Errorf("EqualFold(%#q, %#q) = %v, want %v", tt.t, tt.s, out, tt.out) - } - } -} - -func TestBufferGrowNegative(t *testing.T) { - defer func() { - if err := recover(); err == nil { - t.Fatal("Grow(-1) should have panicked") - } - }() - var b Buffer - b.Grow(-1) -} - -func TestBufferTruncateNegative(t *testing.T) { - defer func() { - if err := recover(); err == nil { - t.Fatal("Truncate(-1) should have panicked") - } - }() - var b Buffer - b.Truncate(-1) -} - -func TestBufferTruncateOutOfRange(t *testing.T) { - defer func() { - if err := recover(); err == nil { - t.Fatal("Truncate(20) should have panicked") - } - }() - var b Buffer - b.Write(make([]byte, 10)) - b.Truncate(20) -} - -var containsTests = []struct { - b, subslice []byte - want bool -}{ - {[]byte("hello"), []byte("hel"), true}, - {[]byte("日本語"), []byte("日本"), true}, - {[]byte("hello"), []byte("Hello, world"), false}, - {[]byte("東京"), []byte("京東"), false}, -} - -func TestContains(t *testing.T) { - for _, tt := range containsTests { - if got := Contains(tt.b, tt.subslice); got != tt.want { - t.Errorf("Contains(%q, %q) = %v, want %v", tt.b, tt.subslice, got, tt.want) - } - } -} - -var makeFieldsInput = func() []byte { - x := make([]byte, 1<<20) - // Input is ~10% space, ~10% 2-byte UTF-8, rest ASCII non-space. - for i := range x { - switch rand.Intn(10) { - case 0: - x[i] = ' ' - case 1: - if i > 0 && x[i-1] == 'x' { - copy(x[i-1:], "χ") - break - } - fallthrough - default: - x[i] = 'x' - } - } - return x -} - -var fieldsInput = makeFieldsInput() - -func BenchmarkFields(b *testing.B) { - b.SetBytes(int64(len(fieldsInput))) - for i := 0; i < b.N; i++ { - Fields(fieldsInput) - } -} - -func BenchmarkFieldsFunc(b *testing.B) { - b.SetBytes(int64(len(fieldsInput))) - for i := 0; i < b.N; i++ { - FieldsFunc(fieldsInput, unicode.IsSpace) - } -} - -func BenchmarkTrimSpace(b *testing.B) { - s := []byte(" Some text. \n") - for i := 0; i < b.N; i++ { - TrimSpace(s) - } -} - -func BenchmarkRepeat(b *testing.B) { - for i := 0; i < b.N; i++ { - Repeat([]byte("-"), 80) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/compare_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/compare_test.go deleted file mode 100644 index f2d81d5310c0b915eeb304a8bae03f4b60d47d82..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/compare_test.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes_test - -import ( - . "bytes" - "testing" -) - -var compareTests = []struct { - a, b []byte - i int -}{ - {[]byte(""), []byte(""), 0}, - {[]byte("a"), []byte(""), 1}, - {[]byte(""), []byte("a"), -1}, - {[]byte("abc"), []byte("abc"), 0}, - {[]byte("abd"), []byte("abc"), 1}, - {[]byte("abc"), []byte("abd"), -1}, - {[]byte("ab"), []byte("abc"), -1}, - {[]byte("abc"), []byte("ab"), 1}, - {[]byte("x"), []byte("ab"), 1}, - {[]byte("ab"), []byte("x"), -1}, - {[]byte("x"), []byte("a"), 1}, - {[]byte("b"), []byte("x"), -1}, - // test runtime·memeq's chunked implementation - {[]byte("abcdefgh"), []byte("abcdefgh"), 0}, - {[]byte("abcdefghi"), []byte("abcdefghi"), 0}, - {[]byte("abcdefghi"), []byte("abcdefghj"), -1}, - {[]byte("abcdefghj"), []byte("abcdefghi"), 1}, - // nil tests - {nil, nil, 0}, - {[]byte(""), nil, 0}, - {nil, []byte(""), 0}, - {[]byte("a"), nil, 1}, - {nil, []byte("a"), -1}, -} - -func TestCompare(t *testing.T) { - for _, tt := range compareTests { - cmp := Compare(tt.a, tt.b) - if cmp != tt.i { - t.Errorf(`Compare(%q, %q) = %v`, tt.a, tt.b, cmp) - } - } -} - -func TestCompareIdenticalSlice(t *testing.T) { - var b = []byte("Hello Gophers!") - if Compare(b, b) != 0 { - t.Error("b != b") - } - if Compare(b, b[:1]) != 1 { - t.Error("b > b[:1] failed") - } -} - -func TestCompareBytes(t *testing.T) { - n := 128 - a := make([]byte, n+1) - b := make([]byte, n+1) - for len := 0; len < 128; len++ { - // randomish but deterministic data. No 0 or 255. - for i := 0; i < len; i++ { - a[i] = byte(1 + 31*i%254) - b[i] = byte(1 + 31*i%254) - } - // data past the end is different - for i := len; i <= n; i++ { - a[i] = 8 - b[i] = 9 - } - cmp := Compare(a[:len], b[:len]) - if cmp != 0 { - t.Errorf(`CompareIdentical(%d) = %d`, len, cmp) - } - if len > 0 { - cmp = Compare(a[:len-1], b[:len]) - if cmp != -1 { - t.Errorf(`CompareAshorter(%d) = %d`, len, cmp) - } - cmp = Compare(a[:len], b[:len-1]) - if cmp != 1 { - t.Errorf(`CompareBshorter(%d) = %d`, len, cmp) - } - } - for k := 0; k < len; k++ { - b[k] = a[k] - 1 - cmp = Compare(a[:len], b[:len]) - if cmp != 1 { - t.Errorf(`CompareAbigger(%d,%d) = %d`, len, k, cmp) - } - b[k] = a[k] + 1 - cmp = Compare(a[:len], b[:len]) - if cmp != -1 { - t.Errorf(`CompareBbigger(%d,%d) = %d`, len, k, cmp) - } - b[k] = a[k] - } - } -} - -func BenchmarkCompareBytesEqual(b *testing.B) { - b1 := []byte("Hello Gophers!") - b2 := []byte("Hello Gophers!") - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 0 { - b.Fatal("b1 != b2") - } - } -} - -func BenchmarkCompareBytesToNil(b *testing.B) { - b1 := []byte("Hello Gophers!") - var b2 []byte - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 1 { - b.Fatal("b1 > b2 failed") - } - } -} - -func BenchmarkCompareBytesEmpty(b *testing.B) { - b1 := []byte("") - b2 := b1 - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 0 { - b.Fatal("b1 != b2") - } - } -} - -func BenchmarkCompareBytesIdentical(b *testing.B) { - b1 := []byte("Hello Gophers!") - b2 := b1 - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 0 { - b.Fatal("b1 != b2") - } - } -} - -func BenchmarkCompareBytesSameLength(b *testing.B) { - b1 := []byte("Hello Gophers!") - b2 := []byte("Hello, Gophers") - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != -1 { - b.Fatal("b1 < b2 failed") - } - } -} - -func BenchmarkCompareBytesDifferentLength(b *testing.B) { - b1 := []byte("Hello Gophers!") - b2 := []byte("Hello, Gophers!") - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != -1 { - b.Fatal("b1 < b2 failed") - } - } -} - -func BenchmarkCompareBytesBigUnaligned(b *testing.B) { - b.StopTimer() - b1 := make([]byte, 0, 1<<20) - for len(b1) < 1<<20 { - b1 = append(b1, "Hello Gophers!"...) - } - b2 := append([]byte("hello"), b1...) - b.StartTimer() - for i := 0; i < b.N; i++ { - if Compare(b1, b2[len("hello"):]) != 0 { - b.Fatal("b1 != b2") - } - } - b.SetBytes(int64(len(b1))) -} - -func BenchmarkCompareBytesBig(b *testing.B) { - b.StopTimer() - b1 := make([]byte, 0, 1<<20) - for len(b1) < 1<<20 { - b1 = append(b1, "Hello Gophers!"...) - } - b2 := append([]byte{}, b1...) - b.StartTimer() - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 0 { - b.Fatal("b1 != b2") - } - } - b.SetBytes(int64(len(b1))) -} - -func BenchmarkCompareBytesBigIdentical(b *testing.B) { - b.StopTimer() - b1 := make([]byte, 0, 1<<20) - for len(b1) < 1<<20 { - b1 = append(b1, "Hello Gophers!"...) - } - b2 := b1 - b.StartTimer() - for i := 0; i < b.N; i++ { - if Compare(b1, b2) != 0 { - b.Fatal("b1 != b2") - } - } - b.SetBytes(int64(len(b1))) -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/equal_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/equal_test.go deleted file mode 100644 index 1bf19a74b80193c8be4d7952b18981ec0228e153..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/equal_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. -// -// +build linux - -package bytes_test - -import ( - . "bytes" - "syscall" - "testing" - "unsafe" -) - -// This file tests the situation where memeq is checking -// data very near to a page boundary. We want to make sure -// equal does not read across the boundary and cause a page -// fault where it shouldn't. - -// This test runs only on linux. The code being tested is -// not OS-specific, so it does not need to be tested on all -// operating systems. - -func TestEqualNearPageBoundary(t *testing.T) { - pagesize := syscall.Getpagesize() - b := make([]byte, 4*pagesize) - i := pagesize - for ; uintptr(unsafe.Pointer(&b[i]))%uintptr(pagesize) != 0; i++ { - } - syscall.Mprotect(b[i-pagesize:i], 0) - syscall.Mprotect(b[i+pagesize:i+2*pagesize], 0) - defer syscall.Mprotect(b[i-pagesize:i], syscall.PROT_READ|syscall.PROT_WRITE) - defer syscall.Mprotect(b[i+pagesize:i+2*pagesize], syscall.PROT_READ|syscall.PROT_WRITE) - - // both of these should fault - //pagesize += int(b[i-1]) - //pagesize += int(b[i+pagesize]) - - for j := 0; j < pagesize; j++ { - b[i+j] = 'A' - } - for j := 0; j <= pagesize; j++ { - Equal(b[i:i+j], b[i+pagesize-j:i+pagesize]) - Equal(b[i+pagesize-j:i+pagesize], b[i:i+j]) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/example_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/example_test.go deleted file mode 100644 index ad2dbc69b77a73362fbd79dfe318c61b0ae0c026..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/example_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes_test - -import ( - "bytes" - "encoding/base64" - "fmt" - "io" - "os" - "sort" -) - -func ExampleBuffer() { - var b bytes.Buffer // A Buffer needs no initialization. - b.Write([]byte("Hello ")) - fmt.Fprintf(&b, "world!") - b.WriteTo(os.Stdout) - // Output: Hello world! -} - -func ExampleBuffer_reader() { - // A Buffer can turn a string or a []byte into an io.Reader. - buf := bytes.NewBufferString("R29waGVycyBydWxlIQ==") - dec := base64.NewDecoder(base64.StdEncoding, buf) - io.Copy(os.Stdout, dec) - // Output: Gophers rule! -} - -func ExampleCompare() { - // Interpret Compare's result by comparing it to zero. - var a, b []byte - if bytes.Compare(a, b) < 0 { - // a less b - } - if bytes.Compare(a, b) <= 0 { - // a less or equal b - } - if bytes.Compare(a, b) > 0 { - // a greater b - } - if bytes.Compare(a, b) >= 0 { - // a greater or equal b - } - - // Prefer Equal to Compare for equality comparisons. - if bytes.Equal(a, b) { - // a equal b - } - if !bytes.Equal(a, b) { - // a not equal b - } -} - -func ExampleCompare_search() { - // Binary search to find a matching byte slice. - var needle []byte - var haystack [][]byte // Assume sorted - i := sort.Search(len(haystack), func(i int) bool { - // Return haystack[i] >= needle. - return bytes.Compare(haystack[i], needle) >= 0 - }) - if i < len(haystack) && bytes.Equal(haystack[i], needle) { - // Found it! - } -} - -func ExampleTrimSuffix() { - var b = []byte("Hello, goodbye, etc!") - b = bytes.TrimSuffix(b, []byte("goodbye, etc!")) - b = bytes.TrimSuffix(b, []byte("gopher")) - b = append(b, bytes.TrimSuffix([]byte("world!"), []byte("x!"))...) - os.Stdout.Write(b) - // Output: Hello, world! -} - -func ExampleTrimPrefix() { - var b = []byte("Goodbye,, world!") - b = bytes.TrimPrefix(b, []byte("Goodbye,")) - b = bytes.TrimPrefix(b, []byte("See ya,")) - fmt.Printf("Hello%s", b) - // Output: Hello, world! -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/export_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/export_test.go deleted file mode 100644 index f61523e60bbb3fd209594912ebcaa76cde9acd20..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/export_test.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes - -// Export func for testing -var IndexBytePortable = indexBytePortable -var EqualPortable = equalPortable diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/indexbyte.c b/llgo/third_party/gofrontend/libgo/go/bytes/indexbyte.c deleted file mode 100644 index b248108e404a5dec4e19a730d50a272bbeafdff5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/indexbyte.c +++ /dev/null @@ -1,73 +0,0 @@ -/* indexbyte.c -- implement bytes.IndexByte for Go. - - Copyright 2009 The Go Authors. All rights reserved. - Use of this source code is governed by a BSD-style - license that can be found in the LICENSE file. */ - -#include - -#include "runtime.h" -#include "array.h" - -/* This is in C so that the compiler can optimize it appropriately. - We deliberately don't split the stack in case it does call the - library function, which shouldn't need much stack space. */ - -intgo IndexByte (struct __go_open_array, char) - __asm__ (GOSYM_PREFIX "bytes.IndexByte") - __attribute__ ((no_split_stack)); - -intgo -IndexByte (struct __go_open_array s, char b) -{ - char *p; - - p = __builtin_memchr (s.__values, b, s.__count); - if (p == NULL) - return -1; - return p - (char *) s.__values; -} - -/* Comparison. */ - -_Bool Equal (struct __go_open_array a, struct __go_open_array b) - __asm__ (GOSYM_PREFIX "bytes.Equal") - __attribute__ ((no_split_stack)); - -_Bool -Equal (struct __go_open_array a, struct __go_open_array b) -{ - if (a.__count != b.__count) - return 0; - return __builtin_memcmp (a.__values, b.__values, a.__count) == 0; -} - -intgo Compare (struct __go_open_array a, struct __go_open_array b) - __asm__ (GOSYM_PREFIX "bytes.Compare") - __attribute__ ((no_split_stack)); - -intgo -Compare (struct __go_open_array a, struct __go_open_array b) -{ - intgo len; - - len = a.__count; - if (len > b.__count) - len = b.__count; - if (len > 0) - { - intgo ret; - - ret = __builtin_memcmp (a.__values, b.__values, len); - if (ret < 0) - return -1; - else if (ret > 0) - return 1; - } - if (a.__count < b.__count) - return -1; - else if (a.__count > b.__count) - return 1; - else - return 0; -} diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/reader.go b/llgo/third_party/gofrontend/libgo/go/bytes/reader.go deleted file mode 100644 index b89d1548f1b78ea16e5fa1bdb25e4228a5c684c9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/reader.go +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes - -import ( - "errors" - "io" - "unicode/utf8" -) - -// A Reader implements the io.Reader, io.ReaderAt, io.WriterTo, io.Seeker, -// io.ByteScanner, and io.RuneScanner interfaces by reading from -// a byte slice. -// Unlike a Buffer, a Reader is read-only and supports seeking. -type Reader struct { - s []byte - i int64 // current reading index - prevRune int // index of previous rune; or < 0 -} - -// Len returns the number of bytes of the unread portion of the -// slice. -func (r *Reader) Len() int { - if r.i >= int64(len(r.s)) { - return 0 - } - return int(int64(len(r.s)) - r.i) -} - -// Size returns the original length of the underlying byte slice. -// Size is the number of bytes available for reading via ReadAt. -// The returned value is always the same and is not affected by calls -// to any other method. -func (r *Reader) Size() int64 { return int64(len(r.s)) } - -func (r *Reader) Read(b []byte) (n int, err error) { - if len(b) == 0 { - return 0, nil - } - if r.i >= int64(len(r.s)) { - return 0, io.EOF - } - r.prevRune = -1 - n = copy(b, r.s[r.i:]) - r.i += int64(n) - return -} - -func (r *Reader) ReadAt(b []byte, off int64) (n int, err error) { - // cannot modify state - see io.ReaderAt - if off < 0 { - return 0, errors.New("bytes.Reader.ReadAt: negative offset") - } - if off >= int64(len(r.s)) { - return 0, io.EOF - } - n = copy(b, r.s[off:]) - if n < len(b) { - err = io.EOF - } - return -} - -func (r *Reader) ReadByte() (b byte, err error) { - r.prevRune = -1 - if r.i >= int64(len(r.s)) { - return 0, io.EOF - } - b = r.s[r.i] - r.i++ - return -} - -func (r *Reader) UnreadByte() error { - r.prevRune = -1 - if r.i <= 0 { - return errors.New("bytes.Reader.UnreadByte: at beginning of slice") - } - r.i-- - return nil -} - -func (r *Reader) ReadRune() (ch rune, size int, err error) { - if r.i >= int64(len(r.s)) { - r.prevRune = -1 - return 0, 0, io.EOF - } - r.prevRune = int(r.i) - if c := r.s[r.i]; c < utf8.RuneSelf { - r.i++ - return rune(c), 1, nil - } - ch, size = utf8.DecodeRune(r.s[r.i:]) - r.i += int64(size) - return -} - -func (r *Reader) UnreadRune() error { - if r.prevRune < 0 { - return errors.New("bytes.Reader.UnreadRune: previous operation was not ReadRune") - } - r.i = int64(r.prevRune) - r.prevRune = -1 - return nil -} - -// Seek implements the io.Seeker interface. -func (r *Reader) Seek(offset int64, whence int) (int64, error) { - r.prevRune = -1 - var abs int64 - switch whence { - case 0: - abs = offset - case 1: - abs = int64(r.i) + offset - case 2: - abs = int64(len(r.s)) + offset - default: - return 0, errors.New("bytes.Reader.Seek: invalid whence") - } - if abs < 0 { - return 0, errors.New("bytes.Reader.Seek: negative position") - } - r.i = abs - return abs, nil -} - -// WriteTo implements the io.WriterTo interface. -func (r *Reader) WriteTo(w io.Writer) (n int64, err error) { - r.prevRune = -1 - if r.i >= int64(len(r.s)) { - return 0, nil - } - b := r.s[r.i:] - m, err := w.Write(b) - if m > len(b) { - panic("bytes.Reader.WriteTo: invalid Write count") - } - r.i += int64(m) - n = int64(m) - if m != len(b) && err == nil { - err = io.ErrShortWrite - } - return -} - -// NewReader returns a new Reader reading from b. -func NewReader(b []byte) *Reader { return &Reader{b, 0, -1} } diff --git a/llgo/third_party/gofrontend/libgo/go/bytes/reader_test.go b/llgo/third_party/gofrontend/libgo/go/bytes/reader_test.go deleted file mode 100644 index b929a2826096d501966925b00244c3af79dee42a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/bytes/reader_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bytes_test - -import ( - . "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "sync" - "testing" -) - -func TestReader(t *testing.T) { - r := NewReader([]byte("0123456789")) - tests := []struct { - off int64 - seek int - n int - want string - wantpos int64 - seekerr string - }{ - {seek: os.SEEK_SET, off: 0, n: 20, want: "0123456789"}, - {seek: os.SEEK_SET, off: 1, n: 1, want: "1"}, - {seek: os.SEEK_CUR, off: 1, wantpos: 3, n: 2, want: "34"}, - {seek: os.SEEK_SET, off: -1, seekerr: "bytes.Reader.Seek: negative position"}, - {seek: os.SEEK_SET, off: 1 << 33, wantpos: 1 << 33}, - {seek: os.SEEK_CUR, off: 1, wantpos: 1<<33 + 1}, - {seek: os.SEEK_SET, n: 5, want: "01234"}, - {seek: os.SEEK_CUR, n: 5, want: "56789"}, - {seek: os.SEEK_END, off: -1, n: 1, wantpos: 9, want: "9"}, - } - - for i, tt := range tests { - pos, err := r.Seek(tt.off, tt.seek) - if err == nil && tt.seekerr != "" { - t.Errorf("%d. want seek error %q", i, tt.seekerr) - continue - } - if err != nil && err.Error() != tt.seekerr { - t.Errorf("%d. seek error = %q; want %q", i, err.Error(), tt.seekerr) - continue - } - if tt.wantpos != 0 && tt.wantpos != pos { - t.Errorf("%d. pos = %d, want %d", i, pos, tt.wantpos) - } - buf := make([]byte, tt.n) - n, err := r.Read(buf) - if err != nil { - t.Errorf("%d. read = %v", i, err) - continue - } - got := string(buf[:n]) - if got != tt.want { - t.Errorf("%d. got %q; want %q", i, got, tt.want) - } - } -} - -func TestReadAfterBigSeek(t *testing.T) { - r := NewReader([]byte("0123456789")) - if _, err := r.Seek(1<<31+5, os.SEEK_SET); err != nil { - t.Fatal(err) - } - if n, err := r.Read(make([]byte, 10)); n != 0 || err != io.EOF { - t.Errorf("Read = %d, %v; want 0, EOF", n, err) - } -} - -func TestReaderAt(t *testing.T) { - r := NewReader([]byte("0123456789")) - tests := []struct { - off int64 - n int - want string - wanterr interface{} - }{ - {0, 10, "0123456789", nil}, - {1, 10, "123456789", io.EOF}, - {1, 9, "123456789", nil}, - {11, 10, "", io.EOF}, - {0, 0, "", nil}, - {-1, 0, "", "bytes.Reader.ReadAt: negative offset"}, - } - for i, tt := range tests { - b := make([]byte, tt.n) - rn, err := r.ReadAt(b, tt.off) - got := string(b[:rn]) - if got != tt.want { - t.Errorf("%d. got %q; want %q", i, got, tt.want) - } - if fmt.Sprintf("%v", err) != fmt.Sprintf("%v", tt.wanterr) { - t.Errorf("%d. got error = %v; want %v", i, err, tt.wanterr) - } - } -} - -func TestReaderAtConcurrent(t *testing.T) { - // Test for the race detector, to verify ReadAt doesn't mutate - // any state. - r := NewReader([]byte("0123456789")) - var wg sync.WaitGroup - for i := 0; i < 5; i++ { - wg.Add(1) - go func(i int) { - defer wg.Done() - var buf [1]byte - r.ReadAt(buf[:], int64(i)) - }(i) - } - wg.Wait() -} - -func TestEmptyReaderConcurrent(t *testing.T) { - // Test for the race detector, to verify a Read that doesn't yield any bytes - // is okay to use from multiple goroutines. This was our historic behavior. - // See golang.org/issue/7856 - r := NewReader([]byte{}) - var wg sync.WaitGroup - for i := 0; i < 5; i++ { - wg.Add(2) - go func() { - defer wg.Done() - var buf [1]byte - r.Read(buf[:]) - }() - go func() { - defer wg.Done() - r.Read(nil) - }() - } - wg.Wait() -} - -func TestReaderWriteTo(t *testing.T) { - for i := 0; i < 30; i += 3 { - var l int - if i > 0 { - l = len(data) / i - } - s := data[:l] - r := NewReader(testBytes[:l]) - var b Buffer - n, err := r.WriteTo(&b) - if expect := int64(len(s)); n != expect { - t.Errorf("got %v; want %v", n, expect) - } - if err != nil { - t.Errorf("for length %d: got error = %v; want nil", l, err) - } - if b.String() != s { - t.Errorf("got string %q; want %q", b.String(), s) - } - if r.Len() != 0 { - t.Errorf("reader contains %v bytes; want 0", r.Len()) - } - } -} - -func TestReaderLen(t *testing.T) { - const data = "hello world" - r := NewReader([]byte(data)) - if got, want := r.Len(), 11; got != want { - t.Errorf("r.Len(): got %d, want %d", got, want) - } - if n, err := r.Read(make([]byte, 10)); err != nil || n != 10 { - t.Errorf("Read failed: read %d %v", n, err) - } - if got, want := r.Len(), 1; got != want { - t.Errorf("r.Len(): got %d, want %d", got, want) - } - if n, err := r.Read(make([]byte, 1)); err != nil || n != 1 { - t.Errorf("Read failed: read %d %v", n, err) - } - if got, want := r.Len(), 0; got != want { - t.Errorf("r.Len(): got %d, want %d", got, want) - } -} - -var UnreadRuneErrorTests = []struct { - name string - f func(*Reader) -}{ - {"Read", func(r *Reader) { r.Read([]byte{0}) }}, - {"ReadByte", func(r *Reader) { r.ReadByte() }}, - {"UnreadRune", func(r *Reader) { r.UnreadRune() }}, - {"Seek", func(r *Reader) { r.Seek(0, 1) }}, - {"WriteTo", func(r *Reader) { r.WriteTo(&Buffer{}) }}, -} - -func TestUnreadRuneError(t *testing.T) { - for _, tt := range UnreadRuneErrorTests { - reader := NewReader([]byte("0123456789")) - if _, _, err := reader.ReadRune(); err != nil { - // should not happen - t.Fatal(err) - } - tt.f(reader) - err := reader.UnreadRune() - if err == nil { - t.Errorf("Unreading after %s: expected error", tt.name) - } - } -} - -func TestReaderDoubleUnreadRune(t *testing.T) { - buf := NewBuffer([]byte("groucho")) - if _, _, err := buf.ReadRune(); err != nil { - // should not happen - t.Fatal(err) - } - if err := buf.UnreadByte(); err != nil { - // should not happen - t.Fatal(err) - } - if err := buf.UnreadByte(); err == nil { - t.Fatal("UnreadByte: expected error, got nil") - } -} - -// verify that copying from an empty reader always has the same results, -// regardless of the presence of a WriteTo method. -func TestReaderCopyNothing(t *testing.T) { - type nErr struct { - n int64 - err error - } - type justReader struct { - io.Reader - } - type justWriter struct { - io.Writer - } - discard := justWriter{ioutil.Discard} // hide ReadFrom - - var with, withOut nErr - with.n, with.err = io.Copy(discard, NewReader(nil)) - withOut.n, withOut.err = io.Copy(discard, justReader{NewReader(nil)}) - if with != withOut { - t.Errorf("behavior differs: with = %#v; without: %#v", with, withOut) - } -} - -// tests that Len is affected by reads, but Size is not. -func TestReaderLenSize(t *testing.T) { - r := NewReader([]byte("abc")) - io.CopyN(ioutil.Discard, r, 1) - if r.Len() != 2 { - t.Errorf("Len = %d; want 2", r.Len()) - } - if r.Size() != 3 { - t.Errorf("Size = %d; want 3", r.Size()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/ast.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/ast.go deleted file mode 100644 index 8bbd1cc52e66e06edf8ec04665b9da2757d9ac03..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/ast.go +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Parse input AST and prepare Prog structure. - -package main - -import ( - "fmt" - "go/ast" - "go/parser" - "go/scanner" - "go/token" - "os" - "path/filepath" - "strings" -) - -func parse(name string, flags parser.Mode) *ast.File { - ast1, err := parser.ParseFile(fset, name, nil, flags) - if err != nil { - if list, ok := err.(scanner.ErrorList); ok { - // If err is a scanner.ErrorList, its String will print just - // the first error and then (+n more errors). - // Instead, turn it into a new Error that will return - // details for all the errors. - for _, e := range list { - fmt.Fprintln(os.Stderr, e) - } - os.Exit(2) - } - fatalf("parsing %s: %s", name, err) - } - return ast1 -} - -func sourceLine(n ast.Node) int { - return fset.Position(n.Pos()).Line -} - -// ReadGo populates f with information learned from reading the -// Go source file with the given file name. It gathers the C preamble -// attached to the import "C" comment, a list of references to C.xxx, -// a list of exported functions, and the actual AST, to be rewritten and -// printed. -func (f *File) ReadGo(name string) { - // Create absolute path for file, so that it will be used in error - // messages and recorded in debug line number information. - // This matches the rest of the toolchain. See golang.org/issue/5122. - if aname, err := filepath.Abs(name); err == nil { - name = aname - } - - // Two different parses: once with comments, once without. - // The printer is not good enough at printing comments in the - // right place when we start editing the AST behind its back, - // so we use ast1 to look for the doc comments on import "C" - // and on exported functions, and we use ast2 for translating - // and reprinting. - ast1 := parse(name, parser.ParseComments) - ast2 := parse(name, 0) - - f.Package = ast1.Name.Name - f.Name = make(map[string]*Name) - - // In ast1, find the import "C" line and get any extra C preamble. - sawC := false - for _, decl := range ast1.Decls { - d, ok := decl.(*ast.GenDecl) - if !ok { - continue - } - for _, spec := range d.Specs { - s, ok := spec.(*ast.ImportSpec) - if !ok || string(s.Path.Value) != `"C"` { - continue - } - sawC = true - if s.Name != nil { - error_(s.Path.Pos(), `cannot rename import "C"`) - } - cg := s.Doc - if cg == nil && len(d.Specs) == 1 { - cg = d.Doc - } - if cg != nil { - f.Preamble += fmt.Sprintf("#line %d %q\n", sourceLine(cg), name) - f.Preamble += commentText(cg) + "\n" - } - } - } - if !sawC { - error_(token.NoPos, `cannot find import "C"`) - } - - // In ast2, strip the import "C" line. - w := 0 - for _, decl := range ast2.Decls { - d, ok := decl.(*ast.GenDecl) - if !ok { - ast2.Decls[w] = decl - w++ - continue - } - ws := 0 - for _, spec := range d.Specs { - s, ok := spec.(*ast.ImportSpec) - if !ok || string(s.Path.Value) != `"C"` { - d.Specs[ws] = spec - ws++ - } - } - if ws == 0 { - continue - } - d.Specs = d.Specs[0:ws] - ast2.Decls[w] = d - w++ - } - ast2.Decls = ast2.Decls[0:w] - - // Accumulate pointers to uses of C.x. - if f.Ref == nil { - f.Ref = make([]*Ref, 0, 8) - } - f.walk(ast2, "prog", (*File).saveRef) - - // Accumulate exported functions. - // The comments are only on ast1 but we need to - // save the function bodies from ast2. - // The first walk fills in ExpFunc, and the - // second walk changes the entries to - // refer to ast2 instead. - f.walk(ast1, "prog", (*File).saveExport) - f.walk(ast2, "prog", (*File).saveExport2) - - f.Comments = ast1.Comments - f.AST = ast2 -} - -// Like ast.CommentGroup's Text method but preserves -// leading blank lines, so that line numbers line up. -func commentText(g *ast.CommentGroup) string { - if g == nil { - return "" - } - var pieces []string - for _, com := range g.List { - c := string(com.Text) - // Remove comment markers. - // The parser has given us exactly the comment text. - switch c[1] { - case '/': - //-style comment (no newline at the end) - c = c[2:] + "\n" - case '*': - /*-style comment */ - c = c[2 : len(c)-2] - } - pieces = append(pieces, c) - } - return strings.Join(pieces, "") -} - -// Save references to C.xxx for later processing. -func (f *File) saveRef(x interface{}, context string) { - n, ok := x.(*ast.Expr) - if !ok { - return - } - if sel, ok := (*n).(*ast.SelectorExpr); ok { - // For now, assume that the only instance of capital C is - // when used as the imported package identifier. - // The parser should take care of scoping in the future, - // so that we will be able to distinguish a "top-level C" - // from a local C. - if l, ok := sel.X.(*ast.Ident); ok && l.Name == "C" { - if context == "as2" { - context = "expr" - } - if context == "embed-type" { - error_(sel.Pos(), "cannot embed C type") - } - goname := sel.Sel.Name - if goname == "errno" { - error_(sel.Pos(), "cannot refer to errno directly; see documentation") - return - } - if goname == "_CMalloc" { - error_(sel.Pos(), "cannot refer to C._CMalloc; use C.malloc") - return - } - if goname == "malloc" { - goname = "_CMalloc" - } - name := f.Name[goname] - if name == nil { - name = &Name{ - Go: goname, - } - f.Name[goname] = name - } - f.Ref = append(f.Ref, &Ref{ - Name: name, - Expr: n, - Context: context, - }) - return - } - } -} - -// If a function should be exported add it to ExpFunc. -func (f *File) saveExport(x interface{}, context string) { - n, ok := x.(*ast.FuncDecl) - if !ok { - return - } - - if n.Doc == nil { - return - } - for _, c := range n.Doc.List { - if !strings.HasPrefix(string(c.Text), "//export ") { - continue - } - - name := strings.TrimSpace(string(c.Text[9:])) - if name == "" { - error_(c.Pos(), "export missing name") - } - - if name != n.Name.Name { - error_(c.Pos(), "export comment has wrong name %q, want %q", name, n.Name.Name) - } - - doc := "" - for _, c1 := range n.Doc.List { - if c1 != c { - doc += c1.Text + "\n" - } - } - - f.ExpFunc = append(f.ExpFunc, &ExpFunc{ - Func: n, - ExpName: name, - Doc: doc, - }) - break - } -} - -// Make f.ExpFunc[i] point at the Func from this AST instead of the other one. -func (f *File) saveExport2(x interface{}, context string) { - n, ok := x.(*ast.FuncDecl) - if !ok { - return - } - - for _, exp := range f.ExpFunc { - if exp.Func.Name.Name == n.Name.Name { - exp.Func = n - break - } - } -} - -// walk walks the AST x, calling visit(f, x, context) for each node. -func (f *File) walk(x interface{}, context string, visit func(*File, interface{}, string)) { - visit(f, x, context) - switch n := x.(type) { - case *ast.Expr: - f.walk(*n, context, visit) - - // everything else just recurs - default: - error_(token.NoPos, "unexpected type %T in walk", x, visit) - panic("unexpected type") - - case nil: - - // These are ordered and grouped to match ../../go/ast/ast.go - case *ast.Field: - if len(n.Names) == 0 && context == "field" { - f.walk(&n.Type, "embed-type", visit) - } else { - f.walk(&n.Type, "type", visit) - } - case *ast.FieldList: - for _, field := range n.List { - f.walk(field, context, visit) - } - case *ast.BadExpr: - case *ast.Ident: - case *ast.Ellipsis: - case *ast.BasicLit: - case *ast.FuncLit: - f.walk(n.Type, "type", visit) - f.walk(n.Body, "stmt", visit) - case *ast.CompositeLit: - f.walk(&n.Type, "type", visit) - f.walk(n.Elts, "expr", visit) - case *ast.ParenExpr: - f.walk(&n.X, context, visit) - case *ast.SelectorExpr: - f.walk(&n.X, "selector", visit) - case *ast.IndexExpr: - f.walk(&n.X, "expr", visit) - f.walk(&n.Index, "expr", visit) - case *ast.SliceExpr: - f.walk(&n.X, "expr", visit) - if n.Low != nil { - f.walk(&n.Low, "expr", visit) - } - if n.High != nil { - f.walk(&n.High, "expr", visit) - } - if n.Max != nil { - f.walk(&n.Max, "expr", visit) - } - case *ast.TypeAssertExpr: - f.walk(&n.X, "expr", visit) - f.walk(&n.Type, "type", visit) - case *ast.CallExpr: - if context == "as2" { - f.walk(&n.Fun, "call2", visit) - } else { - f.walk(&n.Fun, "call", visit) - } - f.walk(n.Args, "expr", visit) - case *ast.StarExpr: - f.walk(&n.X, context, visit) - case *ast.UnaryExpr: - f.walk(&n.X, "expr", visit) - case *ast.BinaryExpr: - f.walk(&n.X, "expr", visit) - f.walk(&n.Y, "expr", visit) - case *ast.KeyValueExpr: - f.walk(&n.Key, "expr", visit) - f.walk(&n.Value, "expr", visit) - - case *ast.ArrayType: - f.walk(&n.Len, "expr", visit) - f.walk(&n.Elt, "type", visit) - case *ast.StructType: - f.walk(n.Fields, "field", visit) - case *ast.FuncType: - f.walk(n.Params, "param", visit) - if n.Results != nil { - f.walk(n.Results, "param", visit) - } - case *ast.InterfaceType: - f.walk(n.Methods, "field", visit) - case *ast.MapType: - f.walk(&n.Key, "type", visit) - f.walk(&n.Value, "type", visit) - case *ast.ChanType: - f.walk(&n.Value, "type", visit) - - case *ast.BadStmt: - case *ast.DeclStmt: - f.walk(n.Decl, "decl", visit) - case *ast.EmptyStmt: - case *ast.LabeledStmt: - f.walk(n.Stmt, "stmt", visit) - case *ast.ExprStmt: - f.walk(&n.X, "expr", visit) - case *ast.SendStmt: - f.walk(&n.Chan, "expr", visit) - f.walk(&n.Value, "expr", visit) - case *ast.IncDecStmt: - f.walk(&n.X, "expr", visit) - case *ast.AssignStmt: - f.walk(n.Lhs, "expr", visit) - if len(n.Lhs) == 2 && len(n.Rhs) == 1 { - f.walk(n.Rhs, "as2", visit) - } else { - f.walk(n.Rhs, "expr", visit) - } - case *ast.GoStmt: - f.walk(n.Call, "expr", visit) - case *ast.DeferStmt: - f.walk(n.Call, "expr", visit) - case *ast.ReturnStmt: - f.walk(n.Results, "expr", visit) - case *ast.BranchStmt: - case *ast.BlockStmt: - f.walk(n.List, context, visit) - case *ast.IfStmt: - f.walk(n.Init, "stmt", visit) - f.walk(&n.Cond, "expr", visit) - f.walk(n.Body, "stmt", visit) - f.walk(n.Else, "stmt", visit) - case *ast.CaseClause: - if context == "typeswitch" { - context = "type" - } else { - context = "expr" - } - f.walk(n.List, context, visit) - f.walk(n.Body, "stmt", visit) - case *ast.SwitchStmt: - f.walk(n.Init, "stmt", visit) - f.walk(&n.Tag, "expr", visit) - f.walk(n.Body, "switch", visit) - case *ast.TypeSwitchStmt: - f.walk(n.Init, "stmt", visit) - f.walk(n.Assign, "stmt", visit) - f.walk(n.Body, "typeswitch", visit) - case *ast.CommClause: - f.walk(n.Comm, "stmt", visit) - f.walk(n.Body, "stmt", visit) - case *ast.SelectStmt: - f.walk(n.Body, "stmt", visit) - case *ast.ForStmt: - f.walk(n.Init, "stmt", visit) - f.walk(&n.Cond, "expr", visit) - f.walk(n.Post, "stmt", visit) - f.walk(n.Body, "stmt", visit) - case *ast.RangeStmt: - f.walk(&n.Key, "expr", visit) - f.walk(&n.Value, "expr", visit) - f.walk(&n.X, "expr", visit) - f.walk(n.Body, "stmt", visit) - - case *ast.ImportSpec: - case *ast.ValueSpec: - f.walk(&n.Type, "type", visit) - f.walk(n.Values, "expr", visit) - case *ast.TypeSpec: - f.walk(&n.Type, "type", visit) - - case *ast.BadDecl: - case *ast.GenDecl: - f.walk(n.Specs, "spec", visit) - case *ast.FuncDecl: - if n.Recv != nil { - f.walk(n.Recv, "param", visit) - } - f.walk(n.Type, "type", visit) - if n.Body != nil { - f.walk(n.Body, "stmt", visit) - } - - case *ast.File: - f.walk(n.Decls, "decl", visit) - - case *ast.Package: - for _, file := range n.Files { - f.walk(file, "file", visit) - } - - case []ast.Decl: - for _, d := range n { - f.walk(d, context, visit) - } - case []ast.Expr: - for i := range n { - f.walk(&n[i], context, visit) - } - case []ast.Stmt: - for _, s := range n { - f.walk(s, context, visit) - } - case []ast.Spec: - for _, s := range n { - f.walk(s, context, visit) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/doc.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/doc.go deleted file mode 100644 index b2a5428f3f4dfac7c42356014e3fd0cc7a85fa4a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/doc.go +++ /dev/null @@ -1,771 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* - -Cgo enables the creation of Go packages that call C code. - -Using cgo with the go command - -To use cgo write normal Go code that imports a pseudo-package "C". -The Go code can then refer to types such as C.size_t, variables such -as C.stdout, or functions such as C.putchar. - -If the import of "C" is immediately preceded by a comment, that -comment, called the preamble, is used as a header when compiling -the C parts of the package. For example: - - // #include - // #include - import "C" - -The preamble may contain any C code, including function and variable -declarations and definitions. These may then be referred to from Go -code as though they were defined in the package "C". All names -declared in the preamble may be used, even if they start with a -lower-case letter. Exception: static variables in the preamble may -not be referenced from Go code; static functions are permitted. - -See $GOROOT/misc/cgo/stdio and $GOROOT/misc/cgo/gmp for examples. See -"C? Go? Cgo!" for an introduction to using cgo: -https://golang.org/doc/articles/c_go_cgo.html. - -CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS may be defined with pseudo #cgo -directives within these comments to tweak the behavior of the C or C++ -compiler. Values defined in multiple directives are concatenated -together. The directive can include a list of build constraints limiting its -effect to systems satisfying one of the constraints -(see https://golang.org/pkg/go/build/#hdr-Build_Constraints for details about the constraint syntax). -For example: - - // #cgo CFLAGS: -DPNG_DEBUG=1 - // #cgo amd64 386 CFLAGS: -DX86=1 - // #cgo LDFLAGS: -lpng - // #include - import "C" - -Alternatively, CPPFLAGS and LDFLAGS may be obtained via the pkg-config -tool using a '#cgo pkg-config:' directive followed by the package names. -For example: - - // #cgo pkg-config: png cairo - // #include - import "C" - -When building, the CGO_CFLAGS, CGO_CPPFLAGS, CGO_CXXFLAGS and -CGO_LDFLAGS environment variables are added to the flags derived from -these directives. Package-specific flags should be set using the -directives, not the environment variables, so that builds work in -unmodified environments. - -All the cgo CPPFLAGS and CFLAGS directives in a package are concatenated and -used to compile C files in that package. All the CPPFLAGS and CXXFLAGS -directives in a package are concatenated and used to compile C++ files in that -package. All the LDFLAGS directives in any package in the program are -concatenated and used at link time. All the pkg-config directives are -concatenated and sent to pkg-config simultaneously to add to each appropriate -set of command-line flags. - -When the cgo directives are parsed, any occurrence of the string ${SRCDIR} -will be replaced by the absolute path to the directory containing the source -file. This allows pre-compiled static libraries to be included in the package -directory and linked properly. -For example if package foo is in the directory /go/src/foo: - - // #cgo LDFLAGS: -L${SRCDIR}/libs -lfoo - -Will be expanded to: - - // #cgo LDFLAGS: -L/go/src/foo/libs -lfoo - -When the Go tool sees that one or more Go files use the special import -"C", it will look for other non-Go files in the directory and compile -them as part of the Go package. Any .c, .s, or .S files will be -compiled with the C compiler. Any .cc, .cpp, or .cxx files will be -compiled with the C++ compiler. Any .h, .hh, .hpp, or .hxx files will -not be compiled separately, but, if these header files are changed, -the C and C++ files will be recompiled. The default C and C++ -compilers may be changed by the CC and CXX environment variables, -respectively; those environment variables may include command line -options. - -The cgo tool is enabled by default for native builds on systems where -it is expected to work. It is disabled by default when -cross-compiling. You can control this by setting the CGO_ENABLED -environment variable when running the go tool: set it to 1 to enable -the use of cgo, and to 0 to disable it. The go tool will set the -build constraint "cgo" if cgo is enabled. - -When cross-compiling, you must specify a C cross-compiler for cgo to -use. You can do this by setting the CC_FOR_TARGET environment -variable when building the toolchain using make.bash, or by setting -the CC environment variable any time you run the go tool. The -CXX_FOR_TARGET and CXX environment variables work in a similar way for -C++ code. - -Go references to C - -Within the Go file, C's struct field names that are keywords in Go -can be accessed by prefixing them with an underscore: if x points at a C -struct with a field named "type", x._type accesses the field. -C struct fields that cannot be expressed in Go, such as bit fields -or misaligned data, are omitted in the Go struct, replaced by -appropriate padding to reach the next field or the end of the struct. - -The standard C numeric types are available under the names -C.char, C.schar (signed char), C.uchar (unsigned char), -C.short, C.ushort (unsigned short), C.int, C.uint (unsigned int), -C.long, C.ulong (unsigned long), C.longlong (long long), -C.ulonglong (unsigned long long), C.float, C.double. -The C type void* is represented by Go's unsafe.Pointer. - -To access a struct, union, or enum type directly, prefix it with -struct_, union_, or enum_, as in C.struct_stat. - -As Go doesn't have support for C's union type in the general case, -C's union types are represented as a Go byte array with the same length. - -Go structs cannot embed fields with C types. - -Cgo translates C types into equivalent unexported Go types. -Because the translations are unexported, a Go package should not -expose C types in its exported API: a C type used in one Go package -is different from the same C type used in another. - -Any C function (even void functions) may be called in a multiple -assignment context to retrieve both the return value (if any) and the -C errno variable as an error (use _ to skip the result value if the -function returns void). For example: - - n, err := C.sqrt(-1) - _, err := C.voidFunc() - -Calling C function pointers is currently not supported, however you can -declare Go variables which hold C function pointers and pass them -back and forth between Go and C. C code may call function pointers -received from Go. For example: - - package main - - // typedef int (*intFunc) (); - // - // int - // bridge_int_func(intFunc f) - // { - // return f(); - // } - // - // int fortytwo() - // { - // return 42; - // } - import "C" - import "fmt" - - func main() { - f := C.intFunc(C.fortytwo) - fmt.Println(int(C.bridge_int_func(f))) - // Output: 42 - } - -In C, a function argument written as a fixed size array -actually requires a pointer to the first element of the array. -C compilers are aware of this calling convention and adjust -the call accordingly, but Go cannot. In Go, you must pass -the pointer to the first element explicitly: C.f(&C.x[0]). - -A few special functions convert between Go and C types -by making copies of the data. In pseudo-Go definitions: - - // Go string to C string - // The C string is allocated in the C heap using malloc. - // It is the caller's responsibility to arrange for it to be - // freed, such as by calling C.free (be sure to include stdlib.h - // if C.free is needed). - func C.CString(string) *C.char - - // C string to Go string - func C.GoString(*C.char) string - - // C string, length to Go string - func C.GoStringN(*C.char, C.int) string - - // C pointer, length to Go []byte - func C.GoBytes(unsafe.Pointer, C.int) []byte - -C references to Go - -Go functions can be exported for use by C code in the following way: - - //export MyFunction - func MyFunction(arg1, arg2 int, arg3 string) int64 {...} - - //export MyFunction2 - func MyFunction2(arg1, arg2 int, arg3 string) (int64, *C.char) {...} - -They will be available in the C code as: - - extern int64 MyFunction(int arg1, int arg2, GoString arg3); - extern struct MyFunction2_return MyFunction2(int arg1, int arg2, GoString arg3); - -found in the _cgo_export.h generated header, after any preambles -copied from the cgo input files. Functions with multiple -return values are mapped to functions returning a struct. -Not all Go types can be mapped to C types in a useful way. - -Using //export in a file places a restriction on the preamble: -since it is copied into two different C output files, it must not -contain any definitions, only declarations. If a file contains both -definitions and declarations, then the two output files will produce -duplicate symbols and the linker will fail. To avoid this, definitions -must be placed in preambles in other files, or in C source files. - -Using cgo directly - -Usage: - go tool cgo [cgo options] [-- compiler options] gofiles... - -Cgo transforms the specified input Go source files into several output -Go and C source files. - -The compiler options are passed through uninterpreted when -invoking the C compiler to compile the C parts of the package. - -The following options are available when running cgo directly: - - -dynimport file - Write list of symbols imported by file. Write to - -dynout argument or to standard output. Used by go - build when building a cgo package. - -dynout file - Write -dynimport output to file. - -dynpackage package - Set Go package for -dynimport output. - -dynlinker - Write dynamic linker as part of -dynimport output. - -godefs - Write out input file in Go syntax replacing C package - names with real values. Used to generate files in the - syscall package when bootstrapping a new target. - -objdir directory - Put all generated files in directory. - -importpath string - The import path for the Go package. Optional; used for - nicer comments in the generated files. - -exportheader file - If there are any exported functions, write the - generated export declarations to file. - C code can #include this to see the declarations. - -gccgo - Generate output for the gccgo compiler rather than the - gc compiler. - -gccgoprefix prefix - The -fgo-prefix option to be used with gccgo. - -gccgopkgpath path - The -fgo-pkgpath option to be used with gccgo. - -import_runtime_cgo - If set (which it is by default) import runtime/cgo in - generated output. - -import_syscall - If set (which it is by default) import syscall in - generated output. - -debug-define - Debugging option. Print #defines. - -debug-gcc - Debugging option. Trace C compiler execution and output. -*/ -package main - -/* -Implementation details. - -Cgo provides a way for Go programs to call C code linked into the same -address space. This comment explains the operation of cgo. - -Cgo reads a set of Go source files and looks for statements saying -import "C". If the import has a doc comment, that comment is -taken as literal C code to be used as a preamble to any C code -generated by cgo. A typical preamble #includes necessary definitions: - - // #include - import "C" - -For more details about the usage of cgo, see the documentation -comment at the top of this file. - -Understanding C - -Cgo scans the Go source files that import "C" for uses of that -package, such as C.puts. It collects all such identifiers. The next -step is to determine each kind of name. In C.xxx the xxx might refer -to a type, a function, a constant, or a global variable. Cgo must -decide which. - -The obvious thing for cgo to do is to process the preamble, expanding -#includes and processing the corresponding C code. That would require -a full C parser and type checker that was also aware of any extensions -known to the system compiler (for example, all the GNU C extensions) as -well as the system-specific header locations and system-specific -pre-#defined macros. This is certainly possible to do, but it is an -enormous amount of work. - -Cgo takes a different approach. It determines the meaning of C -identifiers not by parsing C code but by feeding carefully constructed -programs into the system C compiler and interpreting the generated -error messages, debug information, and object files. In practice, -parsing these is significantly less work and more robust than parsing -C source. - -Cgo first invokes gcc -E -dM on the preamble, in order to find out -about simple #defines for constants and the like. These are recorded -for later use. - -Next, cgo needs to identify the kinds for each identifier. For the -identifiers C.foo and C.bar, cgo generates this C program: - - - #line 1 "not-declared" - void __cgo_f_xxx_1(void) { __typeof__(foo) *__cgo_undefined__; } - #line 1 "not-type" - void __cgo_f_xxx_2(void) { foo *__cgo_undefined__; } - #line 1 "not-const" - void __cgo_f_xxx_3(void) { enum { __cgo_undefined__ = (foo)*1 }; } - #line 2 "not-declared" - void __cgo_f_xxx_1(void) { __typeof__(bar) *__cgo_undefined__; } - #line 2 "not-type" - void __cgo_f_xxx_2(void) { bar *__cgo_undefined__; } - #line 2 "not-const" - void __cgo_f_xxx_3(void) { enum { __cgo_undefined__ = (bar)*1 }; } - -This program will not compile, but cgo can use the presence or absence -of an error message on a given line to deduce the information it -needs. The program is syntactically valid regardless of whether each -name is a type or an ordinary identifier, so there will be no syntax -errors that might stop parsing early. - -An error on not-declared:1 indicates that foo is undeclared. -An error on not-type:1 indicates that foo is not a type (if declared at all, it is an identifier). -An error on not-const:1 indicates that foo is not an integer constant. - -The line number specifies the name involved. In the example, 1 is foo and 2 is bar. - -Next, cgo must learn the details of each type, variable, function, or -constant. It can do this by reading object files. If cgo has decided -that t1 is a type, v2 and v3 are variables or functions, and c4, c5, -and c6 are constants, it generates: - - - __typeof__(t1) *__cgo__1; - __typeof__(v2) *__cgo__2; - __typeof__(v3) *__cgo__3; - __typeof__(c4) *__cgo__4; - enum { __cgo_enum__4 = c4 }; - __typeof__(c5) *__cgo__5; - enum { __cgo_enum__5 = c5 }; - __typeof__(c6) *__cgo__6; - enum { __cgo_enum__6 = c6 }; - - long long __cgo_debug_data[] = { - 0, // t1 - 0, // v2 - 0, // v3 - c4, - c5, - c6, - 1 - }; - -and again invokes the system C compiler, to produce an object file -containing debug information. Cgo parses the DWARF debug information -for __cgo__N to learn the type of each identifier. (The types also -distinguish functions from global variables.) If using a standard gcc, -cgo can parse the DWARF debug information for the __cgo_enum__N to -learn the identifier's value. The LLVM-based gcc on OS X emits -incomplete DWARF information for enums; in that case cgo reads the -constant values from the __cgo_debug_data from the object file's data -segment. - -At this point cgo knows the meaning of each C.xxx well enough to start -the translation process. - -Translating Go - -[The rest of this comment refers to 6g, the Go compiler that is part -of the amd64 port of the gc Go toolchain. Everything here applies to -another architecture's compilers as well.] - -Given the input Go files x.go and y.go, cgo generates these source -files: - - x.cgo1.go # for 6g - y.cgo1.go # for 6g - _cgo_gotypes.go # for 6g - _cgo_import.go # for 6g (if -dynout _cgo_import.go) - x.cgo2.c # for gcc - y.cgo2.c # for gcc - _cgo_defun.c # for gcc (if -gccgo) - _cgo_export.c # for gcc - _cgo_export.h # for gcc - _cgo_main.c # for gcc - _cgo_flags # for alternative build tools - -The file x.cgo1.go is a copy of x.go with the import "C" removed and -references to C.xxx replaced with names like _Cfunc_xxx or _Ctype_xxx. -The definitions of those identifiers, written as Go functions, types, -or variables, are provided in _cgo_gotypes.go. - -Here is a _cgo_gotypes.go containing definitions for needed C types: - - type _Ctype_char int8 - type _Ctype_int int32 - type _Ctype_void [0]byte - -The _cgo_gotypes.go file also contains the definitions of the -functions. They all have similar bodies that invoke runtime·cgocall -to make a switch from the Go runtime world to the system C (GCC-based) -world. - -For example, here is the definition of _Cfunc_puts: - - //go:cgo_import_static _cgo_be59f0f25121_Cfunc_puts - //go:linkname __cgofn__cgo_be59f0f25121_Cfunc_puts _cgo_be59f0f25121_Cfunc_puts - var __cgofn__cgo_be59f0f25121_Cfunc_puts byte - var _cgo_be59f0f25121_Cfunc_puts = unsafe.Pointer(&__cgofn__cgo_be59f0f25121_Cfunc_puts) - - func _Cfunc_puts(p0 *_Ctype_char) (r1 _Ctype_int) { - _cgo_runtime_cgocall(_cgo_be59f0f25121_Cfunc_puts, uintptr(unsafe.Pointer(&p0))) - return - } - -The hexadecimal number is a hash of cgo's input, chosen to be -deterministic yet unlikely to collide with other uses. The actual -function _cgo_be59f0f25121_Cfunc_puts is implemented in a C source -file compiled by gcc, the file x.cgo2.c: - - void - _cgo_be59f0f25121_Cfunc_puts(void *v) - { - _cgo_wait_runtime_init_done(); - struct { - char* p0; - int r; - char __pad12[4]; - } __attribute__((__packed__, __gcc_struct__)) *a = v; - a->r = puts((void*)a->p0); - } - -It waits for Go runtime to be initialized (required for shared libraries), -extracts the arguments from the pointer to _Cfunc_puts's argument -frame, invokes the system C function (in this case, puts), stores the -result in the frame, and returns. - -Linking - -Once the _cgo_export.c and *.cgo2.c files have been compiled with gcc, -they need to be linked into the final binary, along with the libraries -they might depend on (in the case of puts, stdio). 6l has been -extended to understand basic ELF files, but it does not understand ELF -in the full complexity that modern C libraries embrace, so it cannot -in general generate direct references to the system libraries. - -Instead, the build process generates an object file using dynamic -linkage to the desired libraries. The main function is provided by -_cgo_main.c: - - int main() { return 0; } - void crosscall2(void(*fn)(void*, int), void *a, int c) { } - void _cgo_wait_runtime_init_done() { } - void _cgo_allocate(void *a, int c) { } - void _cgo_panic(void *a, int c) { } - -The extra functions here are stubs to satisfy the references in the C -code generated for gcc. The build process links this stub, along with -_cgo_export.c and *.cgo2.c, into a dynamic executable and then lets -cgo examine the executable. Cgo records the list of shared library -references and resolved names and writes them into a new file -_cgo_import.go, which looks like: - - //go:cgo_dynamic_linker "/lib64/ld-linux-x86-64.so.2" - //go:cgo_import_dynamic puts puts#GLIBC_2.2.5 "libc.so.6" - //go:cgo_import_dynamic __libc_start_main __libc_start_main#GLIBC_2.2.5 "libc.so.6" - //go:cgo_import_dynamic stdout stdout#GLIBC_2.2.5 "libc.so.6" - //go:cgo_import_dynamic fflush fflush#GLIBC_2.2.5 "libc.so.6" - //go:cgo_import_dynamic _ _ "libpthread.so.0" - //go:cgo_import_dynamic _ _ "libc.so.6" - -In the end, the compiled Go package, which will eventually be -presented to 6l as part of a larger program, contains: - - _go_.6 # 6g-compiled object for _cgo_gotypes.go, _cgo_import.go, *.cgo1.go - _all.o # gcc-compiled object for _cgo_export.c, *.cgo2.c - -The final program will be a dynamic executable, so that 6l can avoid -needing to process arbitrary .o files. It only needs to process the .o -files generated from C files that cgo writes, and those are much more -limited in the ELF or other features that they use. - -In essence, the _cgo_import.6 file includes the extra linking -directives that 6l is not sophisticated enough to derive from _all.o -on its own. Similarly, the _all.o uses dynamic references to real -system object code because 6l is not sophisticated enough to process -the real code. - -The main benefits of this system are that 6l remains relatively simple -(it does not need to implement a complete ELF and Mach-O linker) and -that gcc is not needed after the package is compiled. For example, -package net uses cgo for access to name resolution functions provided -by libc. Although gcc is needed to compile package net, gcc is not -needed to link programs that import package net. - -Runtime - -When using cgo, Go must not assume that it owns all details of the -process. In particular it needs to coordinate with C in the use of -threads and thread-local storage. The runtime package declares a few -variables: - - var ( - iscgo bool - _cgo_init unsafe.Pointer - _cgo_thread_start unsafe.Pointer - ) - -Any package using cgo imports "runtime/cgo", which provides -initializations for these variables. It sets iscgo to true, _cgo_init -to a gcc-compiled function that can be called early during program -startup, and _cgo_thread_start to a gcc-compiled function that can be -used to create a new thread, in place of the runtime's usual direct -system calls. - -Internal and External Linking - -The text above describes "internal" linking, in which 6l parses and -links host object files (ELF, Mach-O, PE, and so on) into the final -executable itself. Keeping 6l simple means we cannot possibly -implement the full semantics of the host linker, so the kinds of -objects that can be linked directly into the binary is limited (other -code can only be used as a dynamic library). On the other hand, when -using internal linking, 6l can generate Go binaries by itself. - -In order to allow linking arbitrary object files without requiring -dynamic libraries, cgo supports an "external" linking mode too. In -external linking mode, 6l does not process any host object files. -Instead, it collects all the Go code and writes a single go.o object -file containing it. Then it invokes the host linker (usually gcc) to -combine the go.o object file and any supporting non-Go code into a -final executable. External linking avoids the dynamic library -requirement but introduces a requirement that the host linker be -present to create such a binary. - -Most builds both compile source code and invoke the linker to create a -binary. When cgo is involved, the compile step already requires gcc, so -it is not problematic for the link step to require gcc too. - -An important exception is builds using a pre-compiled copy of the -standard library. In particular, package net uses cgo on most systems, -and we want to preserve the ability to compile pure Go code that -imports net without requiring gcc to be present at link time. (In this -case, the dynamic library requirement is less significant, because the -only library involved is libc.so, which can usually be assumed -present.) - -This conflict between functionality and the gcc requirement means we -must support both internal and external linking, depending on the -circumstances: if net is the only cgo-using package, then internal -linking is probably fine, but if other packages are involved, so that there -are dependencies on libraries beyond libc, external linking is likely -to work better. The compilation of a package records the relevant -information to support both linking modes, leaving the decision -to be made when linking the final binary. - -Linking Directives - -In either linking mode, package-specific directives must be passed -through to 6l. These are communicated by writing //go: directives in a -Go source file compiled by 6g. The directives are copied into the .6 -object file and then processed by the linker. - -The directives are: - -//go:cgo_import_dynamic [ [""]] - - In internal linking mode, allow an unresolved reference to - , assuming it will be resolved by a dynamic library - symbol. The optional specifies the symbol's name and - possibly version in the dynamic library, and the optional "" - names the specific library where the symbol should be found. - - In the , # or @ can be used to introduce a symbol version. - - Examples: - //go:cgo_import_dynamic puts - //go:cgo_import_dynamic puts puts#GLIBC_2.2.5 - //go:cgo_import_dynamic puts puts#GLIBC_2.2.5 "libc.so.6" - - A side effect of the cgo_import_dynamic directive with a - library is to make the final binary depend on that dynamic - library. To get the dependency without importing any specific - symbols, use _ for local and remote. - - Example: - //go:cgo_import_dynamic _ _ "libc.so.6" - - For compatibility with current versions of SWIG, - #pragma dynimport is an alias for //go:cgo_import_dynamic. - -//go:cgo_dynamic_linker "" - - In internal linking mode, use "" as the dynamic linker - in the final binary. This directive is only needed from one - package when constructing a binary; by convention it is - supplied by runtime/cgo. - - Example: - //go:cgo_dynamic_linker "/lib/ld-linux.so.2" - -//go:cgo_export_dynamic - - In internal linking mode, put the Go symbol - named into the program's exported symbol table as - , so that C code can refer to it by that name. This - mechanism makes it possible for C code to call back into Go or - to share Go's data. - - For compatibility with current versions of SWIG, - #pragma dynexport is an alias for //go:cgo_export_dynamic. - -//go:cgo_import_static - - In external linking mode, allow unresolved references to - in the go.o object file prepared for the host linker, - under the assumption that will be supplied by the - other object files that will be linked with go.o. - - Example: - //go:cgo_import_static puts_wrapper - -//go:cgo_export_static - - In external linking mode, put the Go symbol - named into the program's exported symbol table as - , so that C code can refer to it by that name. This - mechanism makes it possible for C code to call back into Go or - to share Go's data. - -//go:cgo_ldflag "" - - In external linking mode, invoke the host linker (usually gcc) - with "" as a command-line argument following the .o files. - Note that the arguments are for "gcc", not "ld". - - Example: - //go:cgo_ldflag "-lpthread" - //go:cgo_ldflag "-L/usr/local/sqlite3/lib" - -A package compiled with cgo will include directives for both -internal and external linking; the linker will select the appropriate -subset for the chosen linking mode. - -Example - -As a simple example, consider a package that uses cgo to call C.sin. -The following code will be generated by cgo: - - // compiled by 6g - - //go:cgo_ldflag "-lm" - - type _Ctype_double float64 - - //go:cgo_import_static _cgo_gcc_Cfunc_sin - //go:linkname __cgo_gcc_Cfunc_sin _cgo_gcc_Cfunc_sin - var __cgo_gcc_Cfunc_sin byte - var _cgo_gcc_Cfunc_sin = unsafe.Pointer(&__cgo_gcc_Cfunc_sin) - - func _Cfunc_sin(p0 _Ctype_double) (r1 _Ctype_double) { - _cgo_runtime_cgocall(_cgo_gcc_Cfunc_sin, uintptr(unsafe.Pointer(&p0))) - return - } - - // compiled by gcc, into foo.cgo2.o - - void - _cgo_gcc_Cfunc_sin(void *v) - { - struct { - double p0; - double r; - } __attribute__((__packed__)) *a = v; - a->r = sin(a->p0); - } - -What happens at link time depends on whether the final binary is linked -using the internal or external mode. If other packages are compiled in -"external only" mode, then the final link will be an external one. -Otherwise the link will be an internal one. - -The linking directives are used according to the kind of final link -used. - -In internal mode, 6l itself processes all the host object files, in -particular foo.cgo2.o. To do so, it uses the cgo_import_dynamic and -cgo_dynamic_linker directives to learn that the otherwise undefined -reference to sin in foo.cgo2.o should be rewritten to refer to the -symbol sin with version GLIBC_2.2.5 from the dynamic library -"libm.so.6", and the binary should request "/lib/ld-linux.so.2" as its -runtime dynamic linker. - -In external mode, 6l does not process any host object files, in -particular foo.cgo2.o. It links together the 6g-generated object -files, along with any other Go code, into a go.o file. While doing -that, 6l will discover that there is no definition for -_cgo_gcc_Cfunc_sin, referred to by the 6g-compiled source file. This -is okay, because 6l also processes the cgo_import_static directive and -knows that _cgo_gcc_Cfunc_sin is expected to be supplied by a host -object file, so 6l does not treat the missing symbol as an error when -creating go.o. Indeed, the definition for _cgo_gcc_Cfunc_sin will be -provided to the host linker by foo2.cgo.o, which in turn will need the -symbol 'sin'. 6l also processes the cgo_ldflag directives, so that it -knows that the eventual host link command must include the -lm -argument, so that the host linker will be able to find 'sin' in the -math library. - -6l Command Line Interface - -The go command and any other Go-aware build systems invoke 6l -to link a collection of packages into a single binary. By default, 6l will -present the same interface it does today: - - 6l main.a - -produces a file named 6.out, even if 6l does so by invoking the host -linker in external linking mode. - -By default, 6l will decide the linking mode as follows: if the only -packages using cgo are those on a whitelist of standard library -packages (net, os/user, runtime/cgo), 6l will use internal linking -mode. Otherwise, there are non-standard cgo packages involved, and 6l -will use external linking mode. The first rule means that a build of -the godoc binary, which uses net but no other cgo, can run without -needing gcc available. The second rule means that a build of a -cgo-wrapped library like sqlite3 can generate a standalone executable -instead of needing to refer to a dynamic library. The specific choice -can be overridden using a command line flag: 6l -linkmode=internal or -6l -linkmode=external. - -In an external link, 6l will create a temporary directory, write any -host object files found in package archives to that directory (renamed -to avoid conflicts), write the go.o file to that directory, and invoke -the host linker. The default value for the host linker is $CC, split -into fields, or else "gcc". The specific host linker command line can -be overridden using command line flags: 6l -extld=clang --extldflags='-ggdb -O3'. If any package in a build includes a .cc or -other file compiled by the C++ compiler, the go tool will use the --extld option to set the host linker to the C++ compiler. - -These defaults mean that Go-aware build systems can ignore the linking -changes and keep running plain '6l' and get reasonable results, but -they can also control the linking details if desired. - -*/ diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/gcc.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/gcc.go deleted file mode 100644 index e0b89ec14cb78232a39a673be3d3b5a6f5fb0e27..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/gcc.go +++ /dev/null @@ -1,1770 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Annotate Ref in Prog with C types by parsing gcc debug output. -// Conversion of debug output to Go types. - -package main - -import ( - "bytes" - "debug/dwarf" - "debug/elf" - "debug/macho" - "debug/pe" - "encoding/binary" - "errors" - "flag" - "fmt" - "go/ast" - "go/parser" - "go/token" - "os" - "strconv" - "strings" - "unicode" - "unicode/utf8" -) - -var debugDefine = flag.Bool("debug-define", false, "print relevant #defines") -var debugGcc = flag.Bool("debug-gcc", false, "print gcc invocations") - -var nameToC = map[string]string{ - "schar": "signed char", - "uchar": "unsigned char", - "ushort": "unsigned short", - "uint": "unsigned int", - "ulong": "unsigned long", - "longlong": "long long", - "ulonglong": "unsigned long long", - "complexfloat": "float complex", - "complexdouble": "double complex", -} - -// cname returns the C name to use for C.s. -// The expansions are listed in nameToC and also -// struct_foo becomes "struct foo", and similarly for -// union and enum. -func cname(s string) string { - if t, ok := nameToC[s]; ok { - return t - } - - if strings.HasPrefix(s, "struct_") { - return "struct " + s[len("struct_"):] - } - if strings.HasPrefix(s, "union_") { - return "union " + s[len("union_"):] - } - if strings.HasPrefix(s, "enum_") { - return "enum " + s[len("enum_"):] - } - if strings.HasPrefix(s, "sizeof_") { - return "sizeof(" + cname(s[len("sizeof_"):]) + ")" - } - return s -} - -// DiscardCgoDirectives processes the import C preamble, and discards -// all #cgo CFLAGS and LDFLAGS directives, so they don't make their -// way into _cgo_export.h. -func (f *File) DiscardCgoDirectives() { - linesIn := strings.Split(f.Preamble, "\n") - linesOut := make([]string, 0, len(linesIn)) - for _, line := range linesIn { - l := strings.TrimSpace(line) - if len(l) < 5 || l[:4] != "#cgo" || !unicode.IsSpace(rune(l[4])) { - linesOut = append(linesOut, line) - } else { - linesOut = append(linesOut, "") - } - } - f.Preamble = strings.Join(linesOut, "\n") -} - -// addToFlag appends args to flag. All flags are later written out onto the -// _cgo_flags file for the build system to use. -func (p *Package) addToFlag(flag string, args []string) { - p.CgoFlags[flag] = append(p.CgoFlags[flag], args...) - if flag == "CFLAGS" { - // We'll also need these when preprocessing for dwarf information. - p.GccOptions = append(p.GccOptions, args...) - } -} - -// splitQuoted splits the string s around each instance of one or more consecutive -// white space characters while taking into account quotes and escaping, and -// returns an array of substrings of s or an empty list if s contains only white space. -// Single quotes and double quotes are recognized to prevent splitting within the -// quoted region, and are removed from the resulting substrings. If a quote in s -// isn't closed err will be set and r will have the unclosed argument as the -// last element. The backslash is used for escaping. -// -// For example, the following string: -// -// `a b:"c d" 'e''f' "g\""` -// -// Would be parsed as: -// -// []string{"a", "b:c d", "ef", `g"`} -// -func splitQuoted(s string) (r []string, err error) { - var args []string - arg := make([]rune, len(s)) - escaped := false - quoted := false - quote := '\x00' - i := 0 - for _, r := range s { - switch { - case escaped: - escaped = false - case r == '\\': - escaped = true - continue - case quote != 0: - if r == quote { - quote = 0 - continue - } - case r == '"' || r == '\'': - quoted = true - quote = r - continue - case unicode.IsSpace(r): - if quoted || i > 0 { - quoted = false - args = append(args, string(arg[:i])) - i = 0 - } - continue - } - arg[i] = r - i++ - } - if quoted || i > 0 { - args = append(args, string(arg[:i])) - } - if quote != 0 { - err = errors.New("unclosed quote") - } else if escaped { - err = errors.New("unfinished escaping") - } - return args, err -} - -// Translate rewrites f.AST, the original Go input, to remove -// references to the imported package C, replacing them with -// references to the equivalent Go types, functions, and variables. -func (p *Package) Translate(f *File) { - for _, cref := range f.Ref { - // Convert C.ulong to C.unsigned long, etc. - cref.Name.C = cname(cref.Name.Go) - } - p.loadDefines(f) - needType := p.guessKinds(f) - if len(needType) > 0 { - p.loadDWARF(f, needType) - } - p.rewriteRef(f) -} - -// loadDefines coerces gcc into spitting out the #defines in use -// in the file f and saves relevant renamings in f.Name[name].Define. -func (p *Package) loadDefines(f *File) { - var b bytes.Buffer - b.WriteString(f.Preamble) - b.WriteString(builtinProlog) - stdout := p.gccDefines(b.Bytes()) - - for _, line := range strings.Split(stdout, "\n") { - if len(line) < 9 || line[0:7] != "#define" { - continue - } - - line = strings.TrimSpace(line[8:]) - - var key, val string - spaceIndex := strings.Index(line, " ") - tabIndex := strings.Index(line, "\t") - - if spaceIndex == -1 && tabIndex == -1 { - continue - } else if tabIndex == -1 || (spaceIndex != -1 && spaceIndex < tabIndex) { - key = line[0:spaceIndex] - val = strings.TrimSpace(line[spaceIndex:]) - } else { - key = line[0:tabIndex] - val = strings.TrimSpace(line[tabIndex:]) - } - - if key == "__clang__" { - p.GccIsClang = true - } - - if n := f.Name[key]; n != nil { - if *debugDefine { - fmt.Fprintf(os.Stderr, "#define %s %s\n", key, val) - } - n.Define = val - } - } -} - -// guessKinds tricks gcc into revealing the kind of each -// name xxx for the references C.xxx in the Go input. -// The kind is either a constant, type, or variable. -func (p *Package) guessKinds(f *File) []*Name { - // Determine kinds for names we already know about, - // like #defines or 'struct foo', before bothering with gcc. - var names, needType []*Name - for _, key := range nameKeys(f.Name) { - n := f.Name[key] - // If we've already found this name as a #define - // and we can translate it as a constant value, do so. - if n.Define != "" { - isConst := false - if _, err := strconv.Atoi(n.Define); err == nil { - isConst = true - } else if n.Define[0] == '"' || n.Define[0] == '\'' { - if _, err := parser.ParseExpr(n.Define); err == nil { - isConst = true - } - } - if isConst { - n.Kind = "const" - // Turn decimal into hex, just for consistency - // with enum-derived constants. Otherwise - // in the cgo -godefs output half the constants - // are in hex and half are in whatever the #define used. - i, err := strconv.ParseInt(n.Define, 0, 64) - if err == nil { - n.Const = fmt.Sprintf("%#x", i) - } else { - n.Const = n.Define - } - continue - } - - if isName(n.Define) { - n.C = n.Define - } - } - - needType = append(needType, n) - - // If this is a struct, union, or enum type name, no need to guess the kind. - if strings.HasPrefix(n.C, "struct ") || strings.HasPrefix(n.C, "union ") || strings.HasPrefix(n.C, "enum ") { - n.Kind = "type" - continue - } - - // Otherwise, we'll need to find out from gcc. - names = append(names, n) - } - - // Bypass gcc if there's nothing left to find out. - if len(names) == 0 { - return needType - } - - // Coerce gcc into telling us whether each name is a type, a value, or undeclared. - // For names, find out whether they are integer constants. - // We used to look at specific warning or error messages here, but that tied the - // behavior too closely to specific versions of the compilers. - // Instead, arrange that we can infer what we need from only the presence or absence - // of an error on a specific line. - // - // For each name, we generate these lines, where xxx is the index in toSniff plus one. - // - // #line xxx "not-declared" - // void __cgo_f_xxx_1(void) { __typeof__(name) *__cgo_undefined__; } - // #line xxx "not-type" - // void __cgo_f_xxx_2(void) { name *__cgo_undefined__; } - // #line xxx "not-const" - // void __cgo_f_xxx_3(void) { enum { __cgo_undefined__ = (name)*1 }; } - // - // If we see an error at not-declared:xxx, the corresponding name is not declared. - // If we see an error at not-type:xxx, the corresponding name is a type. - // If we see an error at not-const:xxx, the corresponding name is not an integer constant. - // If we see no errors, we assume the name is an expression but not a constant - // (so a variable or a function). - // - // The specific input forms are chosen so that they are valid C syntax regardless of - // whether name denotes a type or an expression. - - var b bytes.Buffer - b.WriteString(f.Preamble) - b.WriteString(builtinProlog) - - for i, n := range names { - fmt.Fprintf(&b, "#line %d \"not-declared\"\n"+ - "void __cgo_f_%d_1(void) { __typeof__(%s) *__cgo_undefined__; }\n"+ - "#line %d \"not-type\"\n"+ - "void __cgo_f_%d_2(void) { %s *__cgo_undefined__; }\n"+ - "#line %d \"not-const\"\n"+ - "void __cgo_f_%d_3(void) { enum { __cgo__undefined__ = (%s)*1 }; }\n", - i+1, i+1, n.C, - i+1, i+1, n.C, - i+1, i+1, n.C) - } - fmt.Fprintf(&b, "#line 1 \"completed\"\n"+ - "int __cgo__1 = __cgo__2;\n") - - stderr := p.gccErrors(b.Bytes()) - if stderr == "" { - fatalf("%s produced no output\non input:\n%s", p.gccBaseCmd()[0], b.Bytes()) - } - - completed := false - sniff := make([]int, len(names)) - const ( - notType = 1 << iota - notConst - notDeclared - ) - for _, line := range strings.Split(stderr, "\n") { - if !strings.Contains(line, ": error:") { - // we only care about errors. - // we tried to turn off warnings on the command line, but one never knows. - continue - } - - c1 := strings.Index(line, ":") - if c1 < 0 { - continue - } - c2 := strings.Index(line[c1+1:], ":") - if c2 < 0 { - continue - } - c2 += c1 + 1 - - filename := line[:c1] - i, _ := strconv.Atoi(line[c1+1 : c2]) - i-- - if i < 0 || i >= len(names) { - continue - } - - switch filename { - case "completed": - // Strictly speaking, there is no guarantee that seeing the error at completed:1 - // (at the end of the file) means we've seen all the errors from earlier in the file, - // but usually it does. Certainly if we don't see the completed:1 error, we did - // not get all the errors we expected. - completed = true - - case "not-declared": - sniff[i] |= notDeclared - case "not-type": - sniff[i] |= notType - case "not-const": - sniff[i] |= notConst - } - } - - if !completed { - fatalf("%s did not produce error at completed:1\non input:\n%s\nfull error output:\n%s", p.gccBaseCmd()[0], b.Bytes(), stderr) - } - - for i, n := range names { - switch sniff[i] { - default: - error_(token.NoPos, "could not determine kind of name for C.%s", fixGo(n.Go)) - case notType: - n.Kind = "const" - case notConst: - n.Kind = "type" - case notConst | notType: - n.Kind = "not-type" - } - } - if nerrors > 0 { - // Check if compiling the preamble by itself causes any errors, - // because the messages we've printed out so far aren't helpful - // to users debugging preamble mistakes. See issue 8442. - preambleErrors := p.gccErrors([]byte(f.Preamble)) - if len(preambleErrors) > 0 { - error_(token.NoPos, "\n%s errors for preamble:\n%s", p.gccBaseCmd()[0], preambleErrors) - } - - fatalf("unresolved names") - } - - needType = append(needType, names...) - return needType -} - -// loadDWARF parses the DWARF debug information generated -// by gcc to learn the details of the constants, variables, and types -// being referred to as C.xxx. -func (p *Package) loadDWARF(f *File, names []*Name) { - // Extract the types from the DWARF section of an object - // from a well-formed C program. Gcc only generates DWARF info - // for symbols in the object file, so it is not enough to print the - // preamble and hope the symbols we care about will be there. - // Instead, emit - // __typeof__(names[i]) *__cgo__i; - // for each entry in names and then dereference the type we - // learn for __cgo__i. - var b bytes.Buffer - b.WriteString(f.Preamble) - b.WriteString(builtinProlog) - for i, n := range names { - fmt.Fprintf(&b, "__typeof__(%s) *__cgo__%d;\n", n.C, i) - if n.Kind == "const" { - fmt.Fprintf(&b, "enum { __cgo_enum__%d = %s };\n", i, n.C) - } - } - - // Apple's LLVM-based gcc does not include the enumeration - // names and values in its DWARF debug output. In case we're - // using such a gcc, create a data block initialized with the values. - // We can read them out of the object file. - fmt.Fprintf(&b, "long long __cgodebug_data[] = {\n") - for _, n := range names { - if n.Kind == "const" { - fmt.Fprintf(&b, "\t%s,\n", n.C) - } else { - fmt.Fprintf(&b, "\t0,\n") - } - } - // for the last entry, we can not use 0, otherwise - // in case all __cgodebug_data is zero initialized, - // LLVM-based gcc will place the it in the __DATA.__common - // zero-filled section (our debug/macho doesn't support - // this) - fmt.Fprintf(&b, "\t1\n") - fmt.Fprintf(&b, "};\n") - - d, bo, debugData := p.gccDebug(b.Bytes()) - enumVal := make([]int64, len(debugData)/8) - for i := range enumVal { - enumVal[i] = int64(bo.Uint64(debugData[i*8:])) - } - - // Scan DWARF info for top-level TagVariable entries with AttrName __cgo__i. - types := make([]dwarf.Type, len(names)) - enums := make([]dwarf.Offset, len(names)) - nameToIndex := make(map[*Name]int) - for i, n := range names { - nameToIndex[n] = i - } - nameToRef := make(map[*Name]*Ref) - for _, ref := range f.Ref { - nameToRef[ref.Name] = ref - } - r := d.Reader() - for { - e, err := r.Next() - if err != nil { - fatalf("reading DWARF entry: %s", err) - } - if e == nil { - break - } - switch e.Tag { - case dwarf.TagEnumerationType: - offset := e.Offset - for { - e, err := r.Next() - if err != nil { - fatalf("reading DWARF entry: %s", err) - } - if e.Tag == 0 { - break - } - if e.Tag == dwarf.TagEnumerator { - entryName := e.Val(dwarf.AttrName).(string) - if strings.HasPrefix(entryName, "__cgo_enum__") { - n, _ := strconv.Atoi(entryName[len("__cgo_enum__"):]) - if 0 <= n && n < len(names) { - enums[n] = offset - } - } - } - } - case dwarf.TagVariable: - name, _ := e.Val(dwarf.AttrName).(string) - typOff, _ := e.Val(dwarf.AttrType).(dwarf.Offset) - if name == "" || typOff == 0 { - if e.Val(dwarf.AttrSpecification) != nil { - // Since we are reading all the DWARF, - // assume we will see the variable elsewhere. - break - } - fatalf("malformed DWARF TagVariable entry") - } - if !strings.HasPrefix(name, "__cgo__") { - break - } - typ, err := d.Type(typOff) - if err != nil { - fatalf("loading DWARF type: %s", err) - } - t, ok := typ.(*dwarf.PtrType) - if !ok || t == nil { - fatalf("internal error: %s has non-pointer type", name) - } - i, err := strconv.Atoi(name[7:]) - if err != nil { - fatalf("malformed __cgo__ name: %s", name) - } - if enums[i] != 0 { - t, err := d.Type(enums[i]) - if err != nil { - fatalf("loading DWARF type: %s", err) - } - types[i] = t - } else { - types[i] = t.Type - } - } - if e.Tag != dwarf.TagCompileUnit { - r.SkipChildren() - } - } - - // Record types and typedef information. - var conv typeConv - conv.Init(p.PtrSize, p.IntSize) - for i, n := range names { - if types[i] == nil { - continue - } - pos := token.NoPos - if ref, ok := nameToRef[n]; ok { - pos = ref.Pos() - } - f, fok := types[i].(*dwarf.FuncType) - if n.Kind != "type" && fok { - n.Kind = "func" - n.FuncType = conv.FuncType(f, pos) - } else { - n.Type = conv.Type(types[i], pos) - if enums[i] != 0 && n.Type.EnumValues != nil { - k := fmt.Sprintf("__cgo_enum__%d", i) - n.Kind = "const" - n.Const = fmt.Sprintf("%#x", n.Type.EnumValues[k]) - // Remove injected enum to ensure the value will deep-compare - // equally in future loads of the same constant. - delete(n.Type.EnumValues, k) - } - // Prefer debug data over DWARF debug output, if we have it. - if n.Kind == "const" && i < len(enumVal) { - n.Const = fmt.Sprintf("%#x", enumVal[i]) - } - } - conv.FinishType(pos) - } -} - -// mangleName does name mangling to translate names -// from the original Go source files to the names -// used in the final Go files generated by cgo. -func (p *Package) mangleName(n *Name) { - // When using gccgo variables have to be - // exported so that they become global symbols - // that the C code can refer to. - prefix := "_C" - if *gccgo && n.IsVar() { - prefix = "C" - } - n.Mangle = prefix + n.Kind + "_" + n.Go -} - -// rewriteRef rewrites all the C.xxx references in f.AST to refer to the -// Go equivalents, now that we have figured out the meaning of all -// the xxx. In *godefs mode, rewriteRef replaces the names -// with full definitions instead of mangled names. -func (p *Package) rewriteRef(f *File) { - // Keep a list of all the functions, to remove the ones - // only used as expressions and avoid generating bridge - // code for them. - functions := make(map[string]bool) - - // Assign mangled names. - for _, n := range f.Name { - if n.Kind == "not-type" { - n.Kind = "var" - } - if n.Mangle == "" { - p.mangleName(n) - } - if n.Kind == "func" { - functions[n.Go] = false - } - } - - // Now that we have all the name types filled in, - // scan through the Refs to identify the ones that - // are trying to do a ,err call. Also check that - // functions are only used in calls. - for _, r := range f.Ref { - if r.Name.Kind == "const" && r.Name.Const == "" { - error_(r.Pos(), "unable to find value of constant C.%s", fixGo(r.Name.Go)) - } - var expr ast.Expr = ast.NewIdent(r.Name.Mangle) // default - switch r.Context { - case "call", "call2": - if r.Name.Kind != "func" { - if r.Name.Kind == "type" { - r.Context = "type" - expr = r.Name.Type.Go - break - } - error_(r.Pos(), "call of non-function C.%s", fixGo(r.Name.Go)) - break - } - functions[r.Name.Go] = true - if r.Context == "call2" { - if r.Name.Go == "_CMalloc" { - error_(r.Pos(), "no two-result form for C.malloc") - break - } - // Invent new Name for the two-result function. - n := f.Name["2"+r.Name.Go] - if n == nil { - n = new(Name) - *n = *r.Name - n.AddError = true - n.Mangle = "_C2func_" + n.Go - f.Name["2"+r.Name.Go] = n - } - expr = ast.NewIdent(n.Mangle) - r.Name = n - break - } - case "expr": - if r.Name.Kind == "func" { - // Function is being used in an expression, to e.g. pass around a C function pointer. - // Create a new Name for this Ref which causes the variable to be declared in Go land. - fpName := "fp_" + r.Name.Go - name := f.Name[fpName] - if name == nil { - name = &Name{ - Go: fpName, - C: r.Name.C, - Kind: "fpvar", - Type: &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("void*"), Go: ast.NewIdent("unsafe.Pointer")}, - } - p.mangleName(name) - f.Name[fpName] = name - } - r.Name = name - // Rewrite into call to _Cgo_ptr to prevent assignments. The _Cgo_ptr - // function is defined in out.go and simply returns its argument. See - // issue 7757. - expr = &ast.CallExpr{ - Fun: &ast.Ident{NamePos: (*r.Expr).Pos(), Name: "_Cgo_ptr"}, - Args: []ast.Expr{ast.NewIdent(name.Mangle)}, - } - } else if r.Name.Kind == "type" { - // Okay - might be new(T) - expr = r.Name.Type.Go - } else if r.Name.Kind == "var" { - expr = &ast.StarExpr{Star: (*r.Expr).Pos(), X: expr} - } - - case "selector": - if r.Name.Kind == "var" { - expr = &ast.StarExpr{Star: (*r.Expr).Pos(), X: expr} - } else { - error_(r.Pos(), "only C variables allowed in selector expression", fixGo(r.Name.Go)) - } - - case "type": - if r.Name.Kind != "type" { - error_(r.Pos(), "expression C.%s used as type", fixGo(r.Name.Go)) - } else if r.Name.Type == nil { - // Use of C.enum_x, C.struct_x or C.union_x without C definition. - // GCC won't raise an error when using pointers to such unknown types. - error_(r.Pos(), "type C.%s: undefined C type '%s'", fixGo(r.Name.Go), r.Name.C) - } else { - expr = r.Name.Type.Go - } - default: - if r.Name.Kind == "func" { - error_(r.Pos(), "must call C.%s", fixGo(r.Name.Go)) - } - } - if *godefs { - // Substitute definition for mangled type name. - if id, ok := expr.(*ast.Ident); ok { - if t := typedef[id.Name]; t != nil { - expr = t.Go - } - if id.Name == r.Name.Mangle && r.Name.Const != "" { - expr = ast.NewIdent(r.Name.Const) - } - } - } - - // Copy position information from old expr into new expr, - // in case expression being replaced is first on line. - // See golang.org/issue/6563. - pos := (*r.Expr).Pos() - switch x := expr.(type) { - case *ast.Ident: - expr = &ast.Ident{NamePos: pos, Name: x.Name} - } - - *r.Expr = expr - } - - // Remove functions only used as expressions, so their respective - // bridge functions are not generated. - for name, used := range functions { - if !used { - delete(f.Name, name) - } - } -} - -// gccBaseCmd returns the start of the compiler command line. -// It uses $CC if set, or else $GCC, or else the compiler recorded -// during the initial build as defaultCC. -// defaultCC is defined in zdefaultcc.go, written by cmd/dist. -func (p *Package) gccBaseCmd() []string { - // Use $CC if set, since that's what the build uses. - if ret := strings.Fields(os.Getenv("CC")); len(ret) > 0 { - return ret - } - // Try $GCC if set, since that's what we used to use. - if ret := strings.Fields(os.Getenv("GCC")); len(ret) > 0 { - return ret - } - return strings.Fields(defaultCC) -} - -// gccMachine returns the gcc -m flag to use, either "-m32", "-m64" or "-marm". -func (p *Package) gccMachine() []string { - switch goarch { - case "amd64": - return []string{"-m64"} - case "386": - return []string{"-m32"} - case "arm": - return []string{"-marm"} // not thumb - case "s390": - return []string{"-m31"} - case "s390x": - return []string{"-m64"} - } - return nil -} - -func gccTmp() string { - return *objDir + "_cgo_.o" -} - -// gccCmd returns the gcc command line to use for compiling -// the input. -func (p *Package) gccCmd() []string { - c := append(p.gccBaseCmd(), - "-w", // no warnings - "-Wno-error", // warnings are not errors - "-o"+gccTmp(), // write object to tmp - "-gdwarf-2", // generate DWARF v2 debugging symbols - "-c", // do not link - "-xc", // input language is C - ) - if p.GccIsClang { - c = append(c, - "-ferror-limit=0", - // Apple clang version 1.7 (tags/Apple/clang-77) (based on LLVM 2.9svn) - // doesn't have -Wno-unneeded-internal-declaration, so we need yet another - // flag to disable the warning. Yes, really good diagnostics, clang. - "-Wno-unknown-warning-option", - "-Wno-unneeded-internal-declaration", - "-Wno-unused-function", - "-Qunused-arguments", - // Clang embeds prototypes for some builtin functions, - // like malloc and calloc, but all size_t parameters are - // incorrectly typed unsigned long. We work around that - // by disabling the builtin functions (this is safe as - // it won't affect the actual compilation of the C code). - // See: https://golang.org/issue/6506. - "-fno-builtin", - ) - } - - c = append(c, p.GccOptions...) - c = append(c, p.gccMachine()...) - c = append(c, "-") //read input from standard input - return c -} - -// gccDebug runs gcc -gdwarf-2 over the C program stdin and -// returns the corresponding DWARF data and, if present, debug data block. -func (p *Package) gccDebug(stdin []byte) (*dwarf.Data, binary.ByteOrder, []byte) { - runGcc(stdin, p.gccCmd()) - - isDebugData := func(s string) bool { - // Some systems use leading _ to denote non-assembly symbols. - return s == "__cgodebug_data" || s == "___cgodebug_data" - } - - if f, err := macho.Open(gccTmp()); err == nil { - defer f.Close() - d, err := f.DWARF() - if err != nil { - fatalf("cannot load DWARF output from %s: %v", gccTmp(), err) - } - var data []byte - if f.Symtab != nil { - for i := range f.Symtab.Syms { - s := &f.Symtab.Syms[i] - if isDebugData(s.Name) { - // Found it. Now find data section. - if i := int(s.Sect) - 1; 0 <= i && i < len(f.Sections) { - sect := f.Sections[i] - if sect.Addr <= s.Value && s.Value < sect.Addr+sect.Size { - if sdat, err := sect.Data(); err == nil { - data = sdat[s.Value-sect.Addr:] - } - } - } - } - } - } - return d, f.ByteOrder, data - } - - if f, err := elf.Open(gccTmp()); err == nil { - defer f.Close() - d, err := f.DWARF() - if err != nil { - fatalf("cannot load DWARF output from %s: %v", gccTmp(), err) - } - var data []byte - symtab, err := f.Symbols() - if err == nil { - for i := range symtab { - s := &symtab[i] - if isDebugData(s.Name) { - // Found it. Now find data section. - if i := int(s.Section); 0 <= i && i < len(f.Sections) { - sect := f.Sections[i] - if sect.Addr <= s.Value && s.Value < sect.Addr+sect.Size { - if sdat, err := sect.Data(); err == nil { - data = sdat[s.Value-sect.Addr:] - } - } - } - } - } - } - return d, f.ByteOrder, data - } - - if f, err := pe.Open(gccTmp()); err == nil { - defer f.Close() - d, err := f.DWARF() - if err != nil { - fatalf("cannot load DWARF output from %s: %v", gccTmp(), err) - } - var data []byte - for _, s := range f.Symbols { - if isDebugData(s.Name) { - if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) { - sect := f.Sections[i] - if s.Value < sect.Size { - if sdat, err := sect.Data(); err == nil { - data = sdat[s.Value:] - } - } - } - } - } - return d, binary.LittleEndian, data - } - - fatalf("cannot parse gcc output %s as ELF, Mach-O, PE object", gccTmp()) - panic("not reached") -} - -// gccDefines runs gcc -E -dM -xc - over the C program stdin -// and returns the corresponding standard output, which is the -// #defines that gcc encountered while processing the input -// and its included files. -func (p *Package) gccDefines(stdin []byte) string { - base := append(p.gccBaseCmd(), "-E", "-dM", "-xc") - base = append(base, p.gccMachine()...) - stdout, _ := runGcc(stdin, append(append(base, p.GccOptions...), "-")) - return stdout -} - -// gccErrors runs gcc over the C program stdin and returns -// the errors that gcc prints. That is, this function expects -// gcc to fail. -func (p *Package) gccErrors(stdin []byte) string { - // TODO(rsc): require failure - args := p.gccCmd() - - if *debugGcc { - fmt.Fprintf(os.Stderr, "$ %s < 0 { - dtype := c.ptrKeys[0] - c.ptrKeys = c.ptrKeys[1:] - - // Note Type might invalidate c.ptrs[dtype]. - t := c.Type(dtype, pos) - for _, ptr := range c.ptrs[dtype] { - ptr.Go.(*ast.StarExpr).X = t.Go - ptr.C.Set("%s*", t.C) - } - c.ptrs[dtype] = nil // retain the map key - } -} - -// Type returns a *Type with the same memory layout as -// dtype when used as the type of a variable or a struct field. -func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { - if t, ok := c.m[dtype]; ok { - if t.Go == nil { - fatalf("%s: type conversion loop at %s", lineno(pos), dtype) - } - return t - } - - t := new(Type) - t.Size = dtype.Size() // note: wrong for array of pointers, corrected below - t.Align = -1 - t.C = &TypeRepr{Repr: dtype.Common().Name} - c.m[dtype] = t - - switch dt := dtype.(type) { - default: - fatalf("%s: unexpected type: %s", lineno(pos), dtype) - - case *dwarf.AddrType: - if t.Size != c.ptrSize { - fatalf("%s: unexpected: %d-byte address type - %s", lineno(pos), t.Size, dtype) - } - t.Go = c.uintptr - t.Align = t.Size - - case *dwarf.ArrayType: - if dt.StrideBitSize > 0 { - // Cannot represent bit-sized elements in Go. - t.Go = c.Opaque(t.Size) - break - } - count := dt.Count - if count == -1 { - // Indicates flexible array member, which Go doesn't support. - // Translate to zero-length array instead. - count = 0 - } - sub := c.Type(dt.Type, pos) - t.Align = sub.Align - t.Go = &ast.ArrayType{ - Len: c.intExpr(count), - Elt: sub.Go, - } - // Recalculate t.Size now that we know sub.Size. - t.Size = count * sub.Size - t.C.Set("__typeof__(%s[%d])", sub.C, dt.Count) - - case *dwarf.BoolType: - t.Go = c.bool - t.Align = 1 - - case *dwarf.CharType: - if t.Size != 1 { - fatalf("%s: unexpected: %d-byte char type - %s", lineno(pos), t.Size, dtype) - } - t.Go = c.int8 - t.Align = 1 - - case *dwarf.EnumType: - if t.Align = t.Size; t.Align >= c.ptrSize { - t.Align = c.ptrSize - } - t.C.Set("enum " + dt.EnumName) - signed := 0 - t.EnumValues = make(map[string]int64) - for _, ev := range dt.Val { - t.EnumValues[ev.Name] = ev.Val - if ev.Val < 0 { - signed = signedDelta - } - } - switch t.Size + int64(signed) { - default: - fatalf("%s: unexpected: %d-byte enum type - %s", lineno(pos), t.Size, dtype) - case 1: - t.Go = c.uint8 - case 2: - t.Go = c.uint16 - case 4: - t.Go = c.uint32 - case 8: - t.Go = c.uint64 - case 1 + signedDelta: - t.Go = c.int8 - case 2 + signedDelta: - t.Go = c.int16 - case 4 + signedDelta: - t.Go = c.int32 - case 8 + signedDelta: - t.Go = c.int64 - } - - case *dwarf.FloatType: - switch t.Size { - default: - fatalf("%s: unexpected: %d-byte float type - %s", lineno(pos), t.Size, dtype) - case 4: - t.Go = c.float32 - case 8: - t.Go = c.float64 - } - if t.Align = t.Size; t.Align >= c.ptrSize { - t.Align = c.ptrSize - } - - case *dwarf.ComplexType: - switch t.Size { - default: - fatalf("%s: unexpected: %d-byte complex type - %s", lineno(pos), t.Size, dtype) - case 8: - t.Go = c.complex64 - case 16: - t.Go = c.complex128 - } - if t.Align = t.Size; t.Align >= c.ptrSize { - t.Align = c.ptrSize - } - - case *dwarf.FuncType: - // No attempt at translation: would enable calls - // directly between worlds, but we need to moderate those. - t.Go = c.uintptr - t.Align = c.ptrSize - - case *dwarf.IntType: - if dt.BitSize > 0 { - fatalf("%s: unexpected: %d-bit int type - %s", lineno(pos), dt.BitSize, dtype) - } - switch t.Size { - default: - fatalf("%s: unexpected: %d-byte int type - %s", lineno(pos), t.Size, dtype) - case 1: - t.Go = c.int8 - case 2: - t.Go = c.int16 - case 4: - t.Go = c.int32 - case 8: - t.Go = c.int64 - } - if t.Align = t.Size; t.Align >= c.ptrSize { - t.Align = c.ptrSize - } - - case *dwarf.PtrType: - // Clang doesn't emit DW_AT_byte_size for pointer types. - if t.Size != c.ptrSize && t.Size != -1 { - fatalf("%s: unexpected: %d-byte pointer type - %s", lineno(pos), t.Size, dtype) - } - t.Size = c.ptrSize - t.Align = c.ptrSize - - if _, ok := base(dt.Type).(*dwarf.VoidType); ok { - t.Go = c.goVoidPtr - t.C.Set("void*") - break - } - - // Placeholder initialization; completed in FinishType. - t.Go = &ast.StarExpr{} - t.C.Set("*") - if _, ok := c.ptrs[dt.Type]; !ok { - c.ptrKeys = append(c.ptrKeys, dt.Type) - } - c.ptrs[dt.Type] = append(c.ptrs[dt.Type], t) - - case *dwarf.QualType: - // Ignore qualifier. - t = c.Type(dt.Type, pos) - c.m[dtype] = t - return t - - case *dwarf.StructType: - // Convert to Go struct, being careful about alignment. - // Have to give it a name to simulate C "struct foo" references. - tag := dt.StructName - if dt.ByteSize < 0 && tag == "" { // opaque unnamed struct - should not be possible - break - } - if tag == "" { - tag = "__" + strconv.Itoa(tagGen) - tagGen++ - } else if t.C.Empty() { - t.C.Set(dt.Kind + " " + tag) - } - name := c.Ident("_Ctype_" + dt.Kind + "_" + tag) - t.Go = name // publish before recursive calls - goIdent[name.Name] = name - if dt.ByteSize < 0 { - // Size calculation in c.Struct/c.Opaque will die with size=-1 (unknown), - // so execute the basic things that the struct case would do - // other than try to determine a Go representation. - tt := *t - tt.C = &TypeRepr{"%s %s", []interface{}{dt.Kind, tag}} - tt.Go = c.Ident("struct{}") - typedef[name.Name] = &tt - break - } - switch dt.Kind { - case "class", "union": - t.Go = c.Opaque(t.Size) - if t.C.Empty() { - t.C.Set("__typeof__(unsigned char[%d])", t.Size) - } - t.Align = 1 // TODO: should probably base this on field alignment. - typedef[name.Name] = t - case "struct": - g, csyntax, align := c.Struct(dt, pos) - if t.C.Empty() { - t.C.Set(csyntax) - } - t.Align = align - tt := *t - if tag != "" { - tt.C = &TypeRepr{"struct %s", []interface{}{tag}} - } - tt.Go = g - typedef[name.Name] = &tt - } - - case *dwarf.TypedefType: - // Record typedef for printing. - if dt.Name == "_GoString_" { - // Special C name for Go string type. - // Knows string layout used by compilers: pointer plus length, - // which rounds up to 2 pointers after alignment. - t.Go = c.string - t.Size = c.ptrSize * 2 - t.Align = c.ptrSize - break - } - if dt.Name == "_GoBytes_" { - // Special C name for Go []byte type. - // Knows slice layout used by compilers: pointer, length, cap. - t.Go = c.Ident("[]byte") - t.Size = c.ptrSize + 4 + 4 - t.Align = c.ptrSize - break - } - name := c.Ident("_Ctype_" + dt.Name) - goIdent[name.Name] = name - sub := c.Type(dt.Type, pos) - t.Go = name - t.Size = sub.Size - t.Align = sub.Align - oldType := typedef[name.Name] - if oldType == nil { - tt := *t - tt.Go = sub.Go - typedef[name.Name] = &tt - } - - // If sub.Go.Name is "_Ctype_struct_foo" or "_Ctype_union_foo" or "_Ctype_class_foo", - // use that as the Go form for this typedef too, so that the typedef will be interchangeable - // with the base type. - // In -godefs mode, do this for all typedefs. - if isStructUnionClass(sub.Go) || *godefs { - t.Go = sub.Go - - if isStructUnionClass(sub.Go) { - // Use the typedef name for C code. - typedef[sub.Go.(*ast.Ident).Name].C = t.C - } - - // If we've seen this typedef before, and it - // was an anonymous struct/union/class before - // too, use the old definition. - // TODO: it would be safer to only do this if - // we verify that the types are the same. - if oldType != nil && isStructUnionClass(oldType.Go) { - t.Go = oldType.Go - } - } - - case *dwarf.UcharType: - if t.Size != 1 { - fatalf("%s: unexpected: %d-byte uchar type - %s", lineno(pos), t.Size, dtype) - } - t.Go = c.uint8 - t.Align = 1 - - case *dwarf.UintType: - if dt.BitSize > 0 { - fatalf("%s: unexpected: %d-bit uint type - %s", lineno(pos), dt.BitSize, dtype) - } - switch t.Size { - default: - fatalf("%s: unexpected: %d-byte uint type - %s", lineno(pos), t.Size, dtype) - case 1: - t.Go = c.uint8 - case 2: - t.Go = c.uint16 - case 4: - t.Go = c.uint32 - case 8: - t.Go = c.uint64 - } - if t.Align = t.Size; t.Align >= c.ptrSize { - t.Align = c.ptrSize - } - - case *dwarf.VoidType: - t.Go = c.goVoid - t.C.Set("void") - t.Align = 1 - } - - switch dtype.(type) { - case *dwarf.AddrType, *dwarf.BoolType, *dwarf.CharType, *dwarf.IntType, *dwarf.FloatType, *dwarf.UcharType, *dwarf.UintType: - s := dtype.Common().Name - if s != "" { - if ss, ok := dwarfToName[s]; ok { - s = ss - } - s = strings.Join(strings.Split(s, " "), "") // strip spaces - name := c.Ident("_Ctype_" + s) - tt := *t - typedef[name.Name] = &tt - if !*godefs { - t.Go = name - } - } - } - - if t.Size < 0 { - // Unsized types are [0]byte, unless they're typedefs of other types - // or structs with tags. - // if so, use the name we've already defined. - t.Size = 0 - switch dt := dtype.(type) { - case *dwarf.TypedefType: - // ok - case *dwarf.StructType: - if dt.StructName != "" { - break - } - t.Go = c.Opaque(0) - default: - t.Go = c.Opaque(0) - } - if t.C.Empty() { - t.C.Set("void") - } - } - - if t.C.Empty() { - fatalf("%s: internal error: did not create C name for %s", lineno(pos), dtype) - } - - return t -} - -// isStructUnionClass reports whether the type described by the Go syntax x -// is a struct, union, or class with a tag. -func isStructUnionClass(x ast.Expr) bool { - id, ok := x.(*ast.Ident) - if !ok { - return false - } - name := id.Name - return strings.HasPrefix(name, "_Ctype_struct_") || - strings.HasPrefix(name, "_Ctype_union_") || - strings.HasPrefix(name, "_Ctype_class_") -} - -// FuncArg returns a Go type with the same memory layout as -// dtype when used as the type of a C function argument. -func (c *typeConv) FuncArg(dtype dwarf.Type, pos token.Pos) *Type { - t := c.Type(dtype, pos) - switch dt := dtype.(type) { - case *dwarf.ArrayType: - // Arrays are passed implicitly as pointers in C. - // In Go, we must be explicit. - tr := &TypeRepr{} - tr.Set("%s*", t.C) - return &Type{ - Size: c.ptrSize, - Align: c.ptrSize, - Go: &ast.StarExpr{X: t.Go}, - C: tr, - } - case *dwarf.TypedefType: - // C has much more relaxed rules than Go for - // implicit type conversions. When the parameter - // is type T defined as *X, simulate a little of the - // laxness of C by making the argument *X instead of T. - if ptr, ok := base(dt.Type).(*dwarf.PtrType); ok { - // Unless the typedef happens to point to void* since - // Go has special rules around using unsafe.Pointer. - if _, void := base(ptr.Type).(*dwarf.VoidType); void { - break - } - - t = c.Type(ptr, pos) - if t == nil { - return nil - } - - // Remember the C spelling, in case the struct - // has __attribute__((unavailable)) on it. See issue 2888. - t.Typedef = dt.Name - } - } - return t -} - -// FuncType returns the Go type analogous to dtype. -// There is no guarantee about matching memory layout. -func (c *typeConv) FuncType(dtype *dwarf.FuncType, pos token.Pos) *FuncType { - p := make([]*Type, len(dtype.ParamType)) - gp := make([]*ast.Field, len(dtype.ParamType)) - for i, f := range dtype.ParamType { - // gcc's DWARF generator outputs a single DotDotDotType parameter for - // function pointers that specify no parameters (e.g. void - // (*__cgo_0)()). Treat this special case as void. This case is - // invalid according to ISO C anyway (i.e. void (*__cgo_1)(...) is not - // legal). - if _, ok := f.(*dwarf.DotDotDotType); ok && i == 0 { - p, gp = nil, nil - break - } - p[i] = c.FuncArg(f, pos) - gp[i] = &ast.Field{Type: p[i].Go} - } - var r *Type - var gr []*ast.Field - if _, ok := dtype.ReturnType.(*dwarf.VoidType); ok { - gr = []*ast.Field{{Type: c.goVoid}} - } else if dtype.ReturnType != nil { - r = c.Type(dtype.ReturnType, pos) - gr = []*ast.Field{{Type: r.Go}} - } - return &FuncType{ - Params: p, - Result: r, - Go: &ast.FuncType{ - Params: &ast.FieldList{List: gp}, - Results: &ast.FieldList{List: gr}, - }, - } -} - -// Identifier -func (c *typeConv) Ident(s string) *ast.Ident { - return ast.NewIdent(s) -} - -// Opaque type of n bytes. -func (c *typeConv) Opaque(n int64) ast.Expr { - return &ast.ArrayType{ - Len: c.intExpr(n), - Elt: c.byte, - } -} - -// Expr for integer n. -func (c *typeConv) intExpr(n int64) ast.Expr { - return &ast.BasicLit{ - Kind: token.INT, - Value: strconv.FormatInt(n, 10), - } -} - -// Add padding of given size to fld. -func (c *typeConv) pad(fld []*ast.Field, sizes []int64, size int64) ([]*ast.Field, []int64) { - n := len(fld) - fld = fld[0 : n+1] - fld[n] = &ast.Field{Names: []*ast.Ident{c.Ident("_")}, Type: c.Opaque(size)} - sizes = sizes[0 : n+1] - sizes[n] = size - return fld, sizes -} - -// Struct conversion: return Go and (gc) C syntax for type. -func (c *typeConv) Struct(dt *dwarf.StructType, pos token.Pos) (expr *ast.StructType, csyntax string, align int64) { - // Minimum alignment for a struct is 1 byte. - align = 1 - - var buf bytes.Buffer - buf.WriteString("struct {") - fld := make([]*ast.Field, 0, 2*len(dt.Field)+1) // enough for padding around every field - sizes := make([]int64, 0, 2*len(dt.Field)+1) - off := int64(0) - - // Rename struct fields that happen to be named Go keywords into - // _{keyword}. Create a map from C ident -> Go ident. The Go ident will - // be mangled. Any existing identifier that already has the same name on - // the C-side will cause the Go-mangled version to be prefixed with _. - // (e.g. in a struct with fields '_type' and 'type', the latter would be - // rendered as '__type' in Go). - ident := make(map[string]string) - used := make(map[string]bool) - for _, f := range dt.Field { - ident[f.Name] = f.Name - used[f.Name] = true - } - - if !*godefs { - for cid, goid := range ident { - if token.Lookup(goid).IsKeyword() { - // Avoid keyword - goid = "_" + goid - - // Also avoid existing fields - for _, exist := used[goid]; exist; _, exist = used[goid] { - goid = "_" + goid - } - - used[goid] = true - ident[cid] = goid - } - } - } - - anon := 0 - for _, f := range dt.Field { - if f.ByteOffset > off { - fld, sizes = c.pad(fld, sizes, f.ByteOffset-off) - off = f.ByteOffset - } - - name := f.Name - ft := f.Type - - // In godefs mode, if this field is a C11 - // anonymous union then treat the first field in the - // union as the field in the struct. This handles - // cases like the glibc file; see - // issue 6677. - if *godefs { - if st, ok := f.Type.(*dwarf.StructType); ok && name == "" && st.Kind == "union" && len(st.Field) > 0 && !used[st.Field[0].Name] { - name = st.Field[0].Name - ident[name] = name - ft = st.Field[0].Type - } - } - - // TODO: Handle fields that are anonymous structs by - // promoting the fields of the inner struct. - - t := c.Type(ft, pos) - tgo := t.Go - size := t.Size - talign := t.Align - if f.BitSize > 0 { - if f.BitSize%8 != 0 { - continue - } - size = f.BitSize / 8 - name := tgo.(*ast.Ident).String() - if strings.HasPrefix(name, "int") { - name = "int" - } else { - name = "uint" - } - tgo = ast.NewIdent(name + fmt.Sprint(f.BitSize)) - talign = size - } - - if talign > 0 && f.ByteOffset%talign != 0 { - // Drop misaligned fields, the same way we drop integer bit fields. - // The goal is to make available what can be made available. - // Otherwise one bad and unneeded field in an otherwise okay struct - // makes the whole program not compile. Much of the time these - // structs are in system headers that cannot be corrected. - continue - } - n := len(fld) - fld = fld[0 : n+1] - if name == "" { - name = fmt.Sprintf("anon%d", anon) - anon++ - ident[name] = name - } - fld[n] = &ast.Field{Names: []*ast.Ident{c.Ident(ident[name])}, Type: tgo} - sizes = sizes[0 : n+1] - sizes[n] = size - off += size - buf.WriteString(t.C.String()) - buf.WriteString(" ") - buf.WriteString(name) - buf.WriteString("; ") - if talign > align { - align = talign - } - } - if off < dt.ByteSize { - fld, sizes = c.pad(fld, sizes, dt.ByteSize-off) - off = dt.ByteSize - } - - // If the last field in a non-zero-sized struct is zero-sized - // the compiler is going to pad it by one (see issue 9401). - // We can't permit that, because then the size of the Go - // struct will not be the same as the size of the C struct. - // Our only option in such a case is to remove the field, - // which means that it can not be referenced from Go. - for off > 0 && sizes[len(sizes)-1] == 0 { - n := len(sizes) - fld = fld[0 : n-1] - sizes = sizes[0 : n-1] - } - - if off != dt.ByteSize { - fatalf("%s: struct size calculation error off=%d bytesize=%d", lineno(pos), off, dt.ByteSize) - } - buf.WriteString("}") - csyntax = buf.String() - - if *godefs { - godefsFields(fld) - } - expr = &ast.StructType{Fields: &ast.FieldList{List: fld}} - return -} - -func upper(s string) string { - if s == "" { - return "" - } - r, size := utf8.DecodeRuneInString(s) - if r == '_' { - return "X" + s - } - return string(unicode.ToUpper(r)) + s[size:] -} - -// godefsFields rewrites field names for use in Go or C definitions. -// It strips leading common prefixes (like tv_ in tv_sec, tv_usec) -// converts names to upper case, and rewrites _ into Pad_godefs_n, -// so that all fields are exported. -func godefsFields(fld []*ast.Field) { - prefix := fieldPrefix(fld) - npad := 0 - for _, f := range fld { - for _, n := range f.Names { - if n.Name != prefix { - n.Name = strings.TrimPrefix(n.Name, prefix) - } - if n.Name == "_" { - // Use exported name instead. - n.Name = "Pad_cgo_" + strconv.Itoa(npad) - npad++ - } - n.Name = upper(n.Name) - } - } -} - -// fieldPrefix returns the prefix that should be removed from all the -// field names when generating the C or Go code. For generated -// C, we leave the names as is (tv_sec, tv_usec), since that's what -// people are used to seeing in C. For generated Go code, such as -// package syscall's data structures, we drop a common prefix -// (so sec, usec, which will get turned into Sec, Usec for exporting). -func fieldPrefix(fld []*ast.Field) string { - prefix := "" - for _, f := range fld { - for _, n := range f.Names { - // Ignore field names that don't have the prefix we're - // looking for. It is common in C headers to have fields - // named, say, _pad in an otherwise prefixed header. - // If the struct has 3 fields tv_sec, tv_usec, _pad1, then we - // still want to remove the tv_ prefix. - // The check for "orig_" here handles orig_eax in the - // x86 ptrace register sets, which otherwise have all fields - // with reg_ prefixes. - if strings.HasPrefix(n.Name, "orig_") || strings.HasPrefix(n.Name, "_") { - continue - } - i := strings.Index(n.Name, "_") - if i < 0 { - continue - } - if prefix == "" { - prefix = n.Name[:i+1] - } else if prefix != n.Name[:i+1] { - return "" - } - } - } - return prefix -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/godefs.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/godefs.go deleted file mode 100644 index 1b0ece29ef4895d03aa3ca7d2eb3550c3e16d694..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/godefs.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "fmt" - "go/ast" - "go/printer" - "go/token" - "os" - "strings" -) - -// godefs returns the output for -godefs mode. -func (p *Package) godefs(f *File, srcfile string) string { - var buf bytes.Buffer - - fmt.Fprintf(&buf, "// Created by cgo -godefs - DO NOT EDIT\n") - fmt.Fprintf(&buf, "// %s\n", strings.Join(os.Args, " ")) - fmt.Fprintf(&buf, "\n") - - override := make(map[string]string) - - // Allow source file to specify override mappings. - // For example, the socket data structures refer - // to in_addr and in_addr6 structs but we want to be - // able to treat them as byte arrays, so the godefs - // inputs in package syscall say - // - // // +godefs map struct_in_addr [4]byte - // // +godefs map struct_in_addr6 [16]byte - // - for _, g := range f.Comments { - for _, c := range g.List { - i := strings.Index(c.Text, "+godefs map") - if i < 0 { - continue - } - s := strings.TrimSpace(c.Text[i+len("+godefs map"):]) - i = strings.Index(s, " ") - if i < 0 { - fmt.Fprintf(os.Stderr, "invalid +godefs map comment: %s\n", c.Text) - continue - } - override["_Ctype_"+strings.TrimSpace(s[:i])] = strings.TrimSpace(s[i:]) - } - } - for _, n := range f.Name { - if s := override[n.Go]; s != "" { - override[n.Mangle] = s - } - } - - // Otherwise, if the source file says type T C.whatever, - // use "T" as the mangling of C.whatever, - // except in the definition (handled at end of function). - refName := make(map[*ast.Expr]*Name) - for _, r := range f.Ref { - refName[r.Expr] = r.Name - } - for _, d := range f.AST.Decls { - d, ok := d.(*ast.GenDecl) - if !ok || d.Tok != token.TYPE { - continue - } - for _, s := range d.Specs { - s := s.(*ast.TypeSpec) - n := refName[&s.Type] - if n != nil && n.Mangle != "" { - override[n.Mangle] = s.Name.Name - } - } - } - - // Extend overrides using typedefs: - // If we know that C.xxx should format as T - // and xxx is a typedef for yyy, make C.yyy format as T. - for typ, def := range typedef { - if new := override[typ]; new != "" { - if id, ok := def.Go.(*ast.Ident); ok { - override[id.Name] = new - } - } - } - - // Apply overrides. - for old, new := range override { - if id := goIdent[old]; id != nil { - id.Name = new - } - } - - // Any names still using the _C syntax are not going to compile, - // although in general we don't know whether they all made it - // into the file, so we can't warn here. - // - // The most common case is union types, which begin with - // _Ctype_union and for which typedef[name] is a Go byte - // array of the appropriate size (such as [4]byte). - // Substitute those union types with byte arrays. - for name, id := range goIdent { - if id.Name == name && strings.Contains(name, "_Ctype_union") { - if def := typedef[name]; def != nil { - id.Name = gofmt(def) - } - } - } - - conf.Fprint(&buf, fset, f.AST) - - return buf.String() -} - -var gofmtBuf bytes.Buffer - -// gofmt returns the gofmt-formatted string for an AST node. -func gofmt(n interface{}) string { - gofmtBuf.Reset() - err := printer.Fprint(&gofmtBuf, fset, n) - if err != nil { - return "<" + err.Error() + ">" - } - return gofmtBuf.String() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go deleted file mode 100644 index c8cd1610baf221f3f5d644d4e61f43e99225dce4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/main.go +++ /dev/null @@ -1,380 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Cgo; see gmp.go for an overview. - -// TODO(rsc): -// Emit correct line number annotations. -// Make gc understand the annotations. - -package main - -import ( - "crypto/md5" - "flag" - "fmt" - "go/ast" - "go/printer" - "go/token" - "io" - "os" - "path/filepath" - "reflect" - "runtime" - "sort" - "strings" -) - -// A Package collects information about the package we're going to write. -type Package struct { - PackageName string // name of package - PackagePath string - PtrSize int64 - IntSize int64 - GccOptions []string - GccIsClang bool - CgoFlags map[string][]string // #cgo flags (CFLAGS, LDFLAGS) - Written map[string]bool - Name map[string]*Name // accumulated Name from Files - ExpFunc []*ExpFunc // accumulated ExpFunc from Files - Decl []ast.Decl - GoFiles []string // list of Go files - GccFiles []string // list of gcc output files - Preamble string // collected preamble for _cgo_export.h -} - -// A File collects information about a single Go input file. -type File struct { - AST *ast.File // parsed AST - Comments []*ast.CommentGroup // comments from file - Package string // Package name - Preamble string // C preamble (doc comment on import "C") - Ref []*Ref // all references to C.xxx in AST - ExpFunc []*ExpFunc // exported functions for this file - Name map[string]*Name // map from Go name to Name -} - -func nameKeys(m map[string]*Name) []string { - var ks []string - for k := range m { - ks = append(ks, k) - } - sort.Strings(ks) - return ks -} - -// A Ref refers to an expression of the form C.xxx in the AST. -type Ref struct { - Name *Name - Expr *ast.Expr - Context string // "type", "expr", "call", or "call2" -} - -func (r *Ref) Pos() token.Pos { - return (*r.Expr).Pos() -} - -// A Name collects information about C.xxx. -type Name struct { - Go string // name used in Go referring to package C - Mangle string // name used in generated Go - C string // name used in C - Define string // #define expansion - Kind string // "const", "type", "var", "fpvar", "func", "not-type" - Type *Type // the type of xxx - FuncType *FuncType - AddError bool - Const string // constant definition -} - -// IsVar reports whether Kind is either "var" or "fpvar" -func (n *Name) IsVar() bool { - return n.Kind == "var" || n.Kind == "fpvar" -} - -// A ExpFunc is an exported function, callable from C. -// Such functions are identified in the Go input file -// by doc comments containing the line //export ExpName -type ExpFunc struct { - Func *ast.FuncDecl - ExpName string // name to use from C - Doc string -} - -// A TypeRepr contains the string representation of a type. -type TypeRepr struct { - Repr string - FormatArgs []interface{} -} - -// A Type collects information about a type in both the C and Go worlds. -type Type struct { - Size int64 - Align int64 - C *TypeRepr - Go ast.Expr - EnumValues map[string]int64 - Typedef string -} - -// A FuncType collects information about a function type in both the C and Go worlds. -type FuncType struct { - Params []*Type - Result *Type - Go *ast.FuncType -} - -func usage() { - fmt.Fprint(os.Stderr, "usage: cgo -- [compiler options] file.go ...\n") - flag.PrintDefaults() - os.Exit(2) -} - -var ptrSizeMap = map[string]int64{ - "386": 4, - "alpha": 8, - "amd64": 8, - "arm": 4, - "arm64": 8, - "m68k": 4, - "mipso32": 4, - "mipsn32": 4, - "mipso64": 8, - "mipsn64": 8, - "ppc": 4, - "ppc64": 8, - "ppc64le": 8, - "s390": 4, - "s390x": 8, - "sparc": 4, - "sparc64": 8, -} - -var intSizeMap = map[string]int64{ - "386": 4, - "alpha": 8, - "amd64": 8, - "arm": 4, - "arm64": 8, - "m68k": 4, - "mipso32": 4, - "mipsn32": 4, - "mipso64": 8, - "mipsn64": 8, - "ppc": 4, - "ppc64": 8, - "ppc64le": 8, - "s390": 4, - "s390x": 8, - "sparc": 4, - "sparc64": 8, -} - -var cPrefix string - -var fset = token.NewFileSet() - -var dynobj = flag.String("dynimport", "", "if non-empty, print dynamic import data for that file") -var dynout = flag.String("dynout", "", "write -dynimport output to this file") -var dynpackage = flag.String("dynpackage", "main", "set Go package for -dynimport output") -var dynlinker = flag.Bool("dynlinker", false, "record dynamic linker information in -dynimport mode") - -// This flag is for bootstrapping a new Go implementation, -// to generate Go types that match the data layout and -// constant values used in the host's C libraries and system calls. -var godefs = flag.Bool("godefs", false, "for bootstrap: write Go definitions for C file to standard output") - -var objDir = flag.String("objdir", "", "object directory") -var importPath = flag.String("importpath", "", "import path of package being built (for comments in generated files)") -var exportHeader = flag.String("exportheader", "", "where to write export header if any exported functions") - -var gccgo = flag.Bool("gccgo", false, "generate files for use with gccgo") -var gccgoprefix = flag.String("gccgoprefix", "", "-fgo-prefix option used with gccgo") -var gccgopkgpath = flag.String("gccgopkgpath", "", "-fgo-pkgpath option used with gccgo") -var importRuntimeCgo = flag.Bool("import_runtime_cgo", true, "import runtime/cgo in generated code") -var importSyscall = flag.Bool("import_syscall", true, "import syscall in generated code") -var goarch, goos string - -func main() { - flag.Usage = usage - flag.Parse() - - if *dynobj != "" { - // cgo -dynimport is essentially a separate helper command - // built into the cgo binary. It scans a gcc-produced executable - // and dumps information about the imported symbols and the - // imported libraries. The 'go build' rules for cgo prepare an - // appropriate executable and then use its import information - // instead of needing to make the linkers duplicate all the - // specialized knowledge gcc has about where to look for imported - // symbols and which ones to use. - dynimport(*dynobj) - return - } - - if *godefs { - // Generating definitions pulled from header files, - // to be checked into Go repositories. - // Line numbers are just noise. - conf.Mode &^= printer.SourcePos - } - - args := flag.Args() - if len(args) < 1 { - usage() - } - - // Find first arg that looks like a go file and assume everything before - // that are options to pass to gcc. - var i int - for i = len(args); i > 0; i-- { - if !strings.HasSuffix(args[i-1], ".go") { - break - } - } - if i == len(args) { - usage() - } - - goFiles := args[i:] - - p := newPackage(args[:i]) - - // Record CGO_LDFLAGS from the environment for external linking. - if ldflags := os.Getenv("CGO_LDFLAGS"); ldflags != "" { - args, err := splitQuoted(ldflags) - if err != nil { - fatalf("bad CGO_LDFLAGS: %q (%s)", ldflags, err) - } - p.addToFlag("LDFLAGS", args) - } - - // Need a unique prefix for the global C symbols that - // we use to coordinate between gcc and ourselves. - // We already put _cgo_ at the beginning, so the main - // concern is other cgo wrappers for the same functions. - // Use the beginning of the md5 of the input to disambiguate. - h := md5.New() - for _, input := range goFiles { - f, err := os.Open(input) - if err != nil { - fatalf("%s", err) - } - io.Copy(h, f) - f.Close() - } - cPrefix = fmt.Sprintf("_%x", h.Sum(nil)[0:6]) - - fs := make([]*File, len(goFiles)) - for i, input := range goFiles { - f := new(File) - f.ReadGo(input) - f.DiscardCgoDirectives() - fs[i] = f - } - - if *objDir == "" { - // make sure that _obj directory exists, so that we can write - // all the output files there. - os.Mkdir("_obj", 0777) - *objDir = "_obj" - } - *objDir += string(filepath.Separator) - - for i, input := range goFiles { - f := fs[i] - p.Translate(f) - for _, cref := range f.Ref { - switch cref.Context { - case "call", "call2": - if cref.Name.Kind != "type" { - break - } - *cref.Expr = cref.Name.Type.Go - } - } - if nerrors > 0 { - os.Exit(2) - } - pkg := f.Package - if dir := os.Getenv("CGOPKGPATH"); dir != "" { - pkg = filepath.Join(dir, pkg) - } - p.PackagePath = pkg - p.Record(f) - if *godefs { - os.Stdout.WriteString(p.godefs(f, input)) - } else { - p.writeOutput(f, input) - } - } - - if !*godefs { - p.writeDefs() - } - if nerrors > 0 { - os.Exit(2) - } -} - -// newPackage returns a new Package that will invoke -// gcc with the additional arguments specified in args. -func newPackage(args []string) *Package { - goarch = runtime.GOARCH - if s := os.Getenv("GOARCH"); s != "" { - goarch = s - } - goos = runtime.GOOS - if s := os.Getenv("GOOS"); s != "" { - goos = s - } - ptrSize := ptrSizeMap[goarch] - if ptrSize == 0 { - fatalf("unknown ptrSize for $GOARCH %q", goarch) - } - intSize := intSizeMap[goarch] - if intSize == 0 { - fatalf("unknown intSize for $GOARCH %q", goarch) - } - - // Reset locale variables so gcc emits English errors [sic]. - os.Setenv("LANG", "en_US.UTF-8") - os.Setenv("LC_ALL", "C") - - p := &Package{ - PtrSize: ptrSize, - IntSize: intSize, - CgoFlags: make(map[string][]string), - Written: make(map[string]bool), - } - p.addToFlag("CFLAGS", args) - return p -} - -// Record what needs to be recorded about f. -func (p *Package) Record(f *File) { - if p.PackageName == "" { - p.PackageName = f.Package - } else if p.PackageName != f.Package { - error_(token.NoPos, "inconsistent package names: %s, %s", p.PackageName, f.Package) - } - - if p.Name == nil { - p.Name = f.Name - } else { - for k, v := range f.Name { - if p.Name[k] == nil { - p.Name[k] = v - } else if !reflect.DeepEqual(p.Name[k], v) { - error_(token.NoPos, "inconsistent definitions for C.%s", fixGo(k)) - } - } - } - - if f.ExpFunc != nil { - p.ExpFunc = append(p.ExpFunc, f.ExpFunc...) - p.Preamble += "\n" + f.Preamble - } - p.Decl = append(p.Decl, f.AST.Decls...) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/out.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/out.go deleted file mode 100644 index 90a744196228e1e93c53e97a01984adb64efde02..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/out.go +++ /dev/null @@ -1,1419 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "debug/elf" - "debug/macho" - "debug/pe" - "fmt" - "go/ast" - "go/printer" - "go/token" - "io" - "os" - "sort" - "strings" -) - -var conf = printer.Config{Mode: printer.SourcePos, Tabwidth: 8} - -// writeDefs creates output files to be compiled by gc and gcc. -func (p *Package) writeDefs() { - var fgo2, fc io.Writer - f := creat(*objDir + "_cgo_gotypes.go") - defer f.Close() - fgo2 = f - if *gccgo { - f := creat(*objDir + "_cgo_defun.c") - defer f.Close() - fc = f - } - fm := creat(*objDir + "_cgo_main.c") - - var gccgoInit bytes.Buffer - - fflg := creat(*objDir + "_cgo_flags") - for k, v := range p.CgoFlags { - fmt.Fprintf(fflg, "_CGO_%s=%s\n", k, strings.Join(v, " ")) - if k == "LDFLAGS" && !*gccgo { - for _, arg := range v { - fmt.Fprintf(fgo2, "//go:cgo_ldflag %q\n", arg) - } - } - } - fflg.Close() - - // Write C main file for using gcc to resolve imports. - fmt.Fprintf(fm, "int main() { return 0; }\n") - if *importRuntimeCgo { - fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int), void *a, int c) { }\n") - fmt.Fprintf(fm, "void _cgo_wait_runtime_init_done() { }\n") - fmt.Fprintf(fm, "char* _cgo_topofstack(void) { return (char*)0; }\n") - } else { - // If we're not importing runtime/cgo, we *are* runtime/cgo, - // which provides these functions. We just need a prototype. - fmt.Fprintf(fm, "void crosscall2(void(*fn)(void*, int), void *a, int c);\n") - fmt.Fprintf(fm, "void _cgo_wait_runtime_init_done();\n") - } - fmt.Fprintf(fm, "void _cgo_allocate(void *a, int c) { }\n") - fmt.Fprintf(fm, "void _cgo_panic(void *a, int c) { }\n") - fmt.Fprintf(fm, "void _cgo_reginit(void) { }\n") - - // Write second Go output: definitions of _C_xxx. - // In a separate file so that the import of "unsafe" does not - // pollute the original file. - fmt.Fprintf(fgo2, "// Created by cgo - DO NOT EDIT\n\n") - fmt.Fprintf(fgo2, "package %s\n\n", p.PackageName) - fmt.Fprintf(fgo2, "import \"unsafe\"\n\n") - if !*gccgo && *importRuntimeCgo { - fmt.Fprintf(fgo2, "import _ \"runtime/cgo\"\n\n") - } - if *importSyscall { - fmt.Fprintf(fgo2, "import \"syscall\"\n\n") - fmt.Fprintf(fgo2, "var _ syscall.Errno\n") - } - fmt.Fprintf(fgo2, "func _Cgo_ptr(ptr unsafe.Pointer) unsafe.Pointer { return ptr }\n\n") - - if !*gccgo { - fmt.Fprintf(fgo2, "//go:linkname _Cgo_always_false runtime.cgoAlwaysFalse\n") - fmt.Fprintf(fgo2, "var _Cgo_always_false bool\n") - fmt.Fprintf(fgo2, "//go:linkname _Cgo_use runtime.cgoUse\n") - fmt.Fprintf(fgo2, "func _Cgo_use(interface{})\n") - } - - typedefNames := make([]string, 0, len(typedef)) - for name := range typedef { - typedefNames = append(typedefNames, name) - } - sort.Strings(typedefNames) - for _, name := range typedefNames { - def := typedef[name] - fmt.Fprintf(fgo2, "type %s ", name) - conf.Fprint(fgo2, fset, def.Go) - fmt.Fprintf(fgo2, "\n\n") - } - if *gccgo { - fmt.Fprintf(fgo2, "type _Ctype_void byte\n") - } else { - fmt.Fprintf(fgo2, "type _Ctype_void [0]byte\n") - } - - if *gccgo { - fmt.Fprint(fc, p.cPrologGccgo()) - } else { - fmt.Fprint(fgo2, goProlog) - } - - gccgoSymbolPrefix := p.gccgoSymbolPrefix() - - cVars := make(map[string]bool) - for _, key := range nameKeys(p.Name) { - n := p.Name[key] - if !n.IsVar() { - continue - } - - if !cVars[n.C] { - if *gccgo { - fmt.Fprintf(fc, "extern byte *%s;\n", n.C) - } else { - fmt.Fprintf(fm, "extern char %s[];\n", n.C) - fmt.Fprintf(fm, "void *_cgohack_%s = %s;\n\n", n.C, n.C) - fmt.Fprintf(fgo2, "//go:linkname __cgo_%s %s\n", n.C, n.C) - fmt.Fprintf(fgo2, "//go:cgo_import_static %s\n", n.C) - fmt.Fprintf(fgo2, "var __cgo_%s byte\n", n.C) - } - cVars[n.C] = true - } - - var node ast.Node - if n.Kind == "var" { - node = &ast.StarExpr{X: n.Type.Go} - } else if n.Kind == "fpvar" { - node = n.Type.Go - } else { - panic(fmt.Errorf("invalid var kind %q", n.Kind)) - } - if *gccgo { - fmt.Fprintf(fc, `extern void *%s __asm__("%s.%s");`, n.Mangle, gccgoSymbolPrefix, n.Mangle) - fmt.Fprintf(&gccgoInit, "\t%s = &%s;\n", n.Mangle, n.C) - fmt.Fprintf(fc, "\n") - } - - fmt.Fprintf(fgo2, "var %s ", n.Mangle) - conf.Fprint(fgo2, fset, node) - if !*gccgo { - fmt.Fprintf(fgo2, " = (") - conf.Fprint(fgo2, fset, node) - fmt.Fprintf(fgo2, ")(unsafe.Pointer(&__cgo_%s))", n.C) - } - fmt.Fprintf(fgo2, "\n") - } - if *gccgo { - fmt.Fprintf(fc, "\n") - } - - for _, key := range nameKeys(p.Name) { - n := p.Name[key] - if n.Const != "" { - fmt.Fprintf(fgo2, "const _Cconst_%s = %s\n", n.Go, n.Const) - } - } - fmt.Fprintf(fgo2, "\n") - - for _, key := range nameKeys(p.Name) { - n := p.Name[key] - if n.FuncType != nil { - p.writeDefsFunc(fgo2, n) - } - } - - fgcc := creat(*objDir + "_cgo_export.c") - fgcch := creat(*objDir + "_cgo_export.h") - if *gccgo { - p.writeGccgoExports(fgo2, fm, fgcc, fgcch) - } else { - p.writeExports(fgo2, fm, fgcc, fgcch) - } - if err := fgcc.Close(); err != nil { - fatalf("%s", err) - } - if err := fgcch.Close(); err != nil { - fatalf("%s", err) - } - - if *exportHeader != "" && len(p.ExpFunc) > 0 { - fexp := creat(*exportHeader) - fgcch, err := os.Open(*objDir + "_cgo_export.h") - if err != nil { - fatalf("%s", err) - } - _, err = io.Copy(fexp, fgcch) - if err != nil { - fatalf("%s", err) - } - if err = fexp.Close(); err != nil { - fatalf("%s", err) - } - } - - init := gccgoInit.String() - if init != "" { - fmt.Fprintln(fc, "static void init(void) __attribute__ ((constructor));") - fmt.Fprintln(fc, "static void init(void) {") - fmt.Fprint(fc, init) - fmt.Fprintln(fc, "}") - } -} - -func dynimport(obj string) { - stdout := os.Stdout - if *dynout != "" { - f, err := os.Create(*dynout) - if err != nil { - fatalf("%s", err) - } - stdout = f - } - - fmt.Fprintf(stdout, "package %s\n", *dynpackage) - - if f, err := elf.Open(obj); err == nil { - if *dynlinker { - // Emit the cgo_dynamic_linker line. - if sec := f.Section(".interp"); sec != nil { - if data, err := sec.Data(); err == nil && len(data) > 1 { - // skip trailing \0 in data - fmt.Fprintf(stdout, "//go:cgo_dynamic_linker %q\n", string(data[:len(data)-1])) - } - } - } - sym, err := f.ImportedSymbols() - if err != nil { - fatalf("cannot load imported symbols from ELF file %s: %v", obj, err) - } - for _, s := range sym { - targ := s.Name - if s.Version != "" { - targ += "#" + s.Version - } - fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s.Name, targ, s.Library) - } - lib, err := f.ImportedLibraries() - if err != nil { - fatalf("cannot load imported libraries from ELF file %s: %v", obj, err) - } - for _, l := range lib { - fmt.Fprintf(stdout, "//go:cgo_import_dynamic _ _ %q\n", l) - } - return - } - - if f, err := macho.Open(obj); err == nil { - sym, err := f.ImportedSymbols() - if err != nil { - fatalf("cannot load imported symbols from Mach-O file %s: %v", obj, err) - } - for _, s := range sym { - if len(s) > 0 && s[0] == '_' { - s = s[1:] - } - fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", s, s, "") - } - lib, err := f.ImportedLibraries() - if err != nil { - fatalf("cannot load imported libraries from Mach-O file %s: %v", obj, err) - } - for _, l := range lib { - fmt.Fprintf(stdout, "//go:cgo_import_dynamic _ _ %q\n", l) - } - return - } - - if f, err := pe.Open(obj); err == nil { - sym, err := f.ImportedSymbols() - if err != nil { - fatalf("cannot load imported symbols from PE file %s: %v", obj, err) - } - for _, s := range sym { - ss := strings.Split(s, ":") - name := strings.Split(ss[0], "@")[0] - fmt.Fprintf(stdout, "//go:cgo_import_dynamic %s %s %q\n", name, ss[0], strings.ToLower(ss[1])) - } - return - } - - fatalf("cannot parse %s as ELF, Mach-O or PE", obj) -} - -// Construct a gcc struct matching the gc argument frame. -// Assumes that in gcc, char is 1 byte, short 2 bytes, int 4 bytes, long long 8 bytes. -// These assumptions are checked by the gccProlog. -// Also assumes that gc convention is to word-align the -// input and output parameters. -func (p *Package) structType(n *Name) (string, int64) { - var buf bytes.Buffer - fmt.Fprint(&buf, "struct {\n") - off := int64(0) - for i, t := range n.FuncType.Params { - if off%t.Align != 0 { - pad := t.Align - off%t.Align - fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) - off += pad - } - c := t.Typedef - if c == "" { - c = t.C.String() - } - fmt.Fprintf(&buf, "\t\t%s p%d;\n", c, i) - off += t.Size - } - if off%p.PtrSize != 0 { - pad := p.PtrSize - off%p.PtrSize - fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) - off += pad - } - if t := n.FuncType.Result; t != nil { - if off%t.Align != 0 { - pad := t.Align - off%t.Align - fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) - off += pad - } - qual := "" - if c := t.C.String(); c[len(c)-1] == '*' { - qual = "const " - } - fmt.Fprintf(&buf, "\t\t%s%s r;\n", qual, t.C) - off += t.Size - } - if off%p.PtrSize != 0 { - pad := p.PtrSize - off%p.PtrSize - fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) - off += pad - } - if off == 0 { - fmt.Fprintf(&buf, "\t\tchar unused;\n") // avoid empty struct - } - fmt.Fprintf(&buf, "\t}") - return buf.String(), off -} - -func (p *Package) writeDefsFunc(fgo2 io.Writer, n *Name) { - name := n.Go - gtype := n.FuncType.Go - void := gtype.Results == nil || len(gtype.Results.List) == 0 - if n.AddError { - // Add "error" to return type list. - // Type list is known to be 0 or 1 element - it's a C function. - err := &ast.Field{Type: ast.NewIdent("error")} - l := gtype.Results.List - if len(l) == 0 { - l = []*ast.Field{err} - } else { - l = []*ast.Field{l[0], err} - } - t := new(ast.FuncType) - *t = *gtype - t.Results = &ast.FieldList{List: l} - gtype = t - } - - // Go func declaration. - d := &ast.FuncDecl{ - Name: ast.NewIdent(n.Mangle), - Type: gtype, - } - - // Builtins defined in the C prolog. - inProlog := builtinDefs[name] != "" - cname := fmt.Sprintf("_cgo%s%s", cPrefix, n.Mangle) - paramnames := []string(nil) - for i, param := range d.Type.Params.List { - paramName := fmt.Sprintf("p%d", i) - param.Names = []*ast.Ident{ast.NewIdent(paramName)} - paramnames = append(paramnames, paramName) - } - - if *gccgo { - // Gccgo style hooks. - fmt.Fprint(fgo2, "\n") - conf.Fprint(fgo2, fset, d) - fmt.Fprint(fgo2, " {\n") - if !inProlog { - fmt.Fprint(fgo2, "\tdefer syscall.CgocallDone()\n") - fmt.Fprint(fgo2, "\tsyscall.Cgocall()\n") - } - if n.AddError { - fmt.Fprint(fgo2, "\tsyscall.SetErrno(0)\n") - } - fmt.Fprint(fgo2, "\t") - if !void { - fmt.Fprint(fgo2, "r := ") - } - fmt.Fprintf(fgo2, "%s(%s)\n", cname, strings.Join(paramnames, ", ")) - - if n.AddError { - fmt.Fprint(fgo2, "\te := syscall.GetErrno()\n") - fmt.Fprint(fgo2, "\tif e != 0 {\n") - fmt.Fprint(fgo2, "\t\treturn ") - if !void { - fmt.Fprint(fgo2, "r, ") - } - fmt.Fprint(fgo2, "e\n") - fmt.Fprint(fgo2, "\t}\n") - fmt.Fprint(fgo2, "\treturn ") - if !void { - fmt.Fprint(fgo2, "r, ") - } - fmt.Fprint(fgo2, "nil\n") - } else if !void { - fmt.Fprint(fgo2, "\treturn r\n") - } - - fmt.Fprint(fgo2, "}\n") - - // declare the C function. - fmt.Fprintf(fgo2, "//extern %s\n", cname) - d.Name = ast.NewIdent(cname) - if n.AddError { - l := d.Type.Results.List - d.Type.Results.List = l[:len(l)-1] - } - conf.Fprint(fgo2, fset, d) - fmt.Fprint(fgo2, "\n") - - return - } - - if inProlog { - fmt.Fprint(fgo2, builtinDefs[name]) - return - } - - // Wrapper calls into gcc, passing a pointer to the argument frame. - fmt.Fprintf(fgo2, "//go:cgo_import_static %s\n", cname) - fmt.Fprintf(fgo2, "//go:linkname __cgofn_%s %s\n", cname, cname) - fmt.Fprintf(fgo2, "var __cgofn_%s byte\n", cname) - fmt.Fprintf(fgo2, "var %s = unsafe.Pointer(&__cgofn_%s)\n", cname, cname) - - nret := 0 - if !void { - d.Type.Results.List[0].Names = []*ast.Ident{ast.NewIdent("r1")} - nret = 1 - } - if n.AddError { - d.Type.Results.List[nret].Names = []*ast.Ident{ast.NewIdent("r2")} - } - - fmt.Fprint(fgo2, "\n") - conf.Fprint(fgo2, fset, d) - fmt.Fprint(fgo2, " {\n") - - // NOTE: Using uintptr to hide from escape analysis. - arg := "0" - if len(paramnames) > 0 { - arg = "uintptr(unsafe.Pointer(&p0))" - } else if !void { - arg = "uintptr(unsafe.Pointer(&r1))" - } - - prefix := "" - if n.AddError { - prefix = "errno := " - } - fmt.Fprintf(fgo2, "\t%s_cgo_runtime_cgocall(%s, %s)\n", prefix, cname, arg) - if n.AddError { - fmt.Fprintf(fgo2, "\tif errno != 0 { r2 = syscall.Errno(errno) }\n") - } - fmt.Fprintf(fgo2, "\tif _Cgo_always_false {\n") - for i := range d.Type.Params.List { - fmt.Fprintf(fgo2, "\t\t_Cgo_use(p%d)\n", i) - } - fmt.Fprintf(fgo2, "\t}\n") - fmt.Fprintf(fgo2, "\treturn\n") - fmt.Fprintf(fgo2, "}\n") -} - -// writeOutput creates stubs for a specific source file to be compiled by gc -func (p *Package) writeOutput(f *File, srcfile string) { - base := srcfile - if strings.HasSuffix(base, ".go") { - base = base[0 : len(base)-3] - } - base = strings.Map(slashToUnderscore, base) - fgo1 := creat(*objDir + base + ".cgo1.go") - fgcc := creat(*objDir + base + ".cgo2.c") - - p.GoFiles = append(p.GoFiles, base+".cgo1.go") - p.GccFiles = append(p.GccFiles, base+".cgo2.c") - - // Write Go output: Go input with rewrites of C.xxx to _C_xxx. - fmt.Fprintf(fgo1, "// Created by cgo - DO NOT EDIT\n\n") - conf.Fprint(fgo1, fset, f.AST) - - // While we process the vars and funcs, also write gcc output. - // Gcc output starts with the preamble. - fmt.Fprintf(fgcc, "%s\n", f.Preamble) - fmt.Fprintf(fgcc, "%s\n", gccProlog) - - for _, key := range nameKeys(f.Name) { - n := f.Name[key] - if n.FuncType != nil { - p.writeOutputFunc(fgcc, n) - } - } - - fgo1.Close() - fgcc.Close() -} - -// fixGo converts the internal Name.Go field into the name we should show -// to users in error messages. There's only one for now: on input we rewrite -// C.malloc into C._CMalloc, so change it back here. -func fixGo(name string) string { - if name == "_CMalloc" { - return "malloc" - } - return name -} - -var isBuiltin = map[string]bool{ - "_Cfunc_CString": true, - "_Cfunc_GoString": true, - "_Cfunc_GoStringN": true, - "_Cfunc_GoBytes": true, - "_Cfunc__CMalloc": true, -} - -func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) { - name := n.Mangle - if isBuiltin[name] || p.Written[name] { - // The builtins are already defined in the C prolog, and we don't - // want to duplicate function definitions we've already done. - return - } - p.Written[name] = true - - if *gccgo { - p.writeGccgoOutputFunc(fgcc, n) - return - } - - ctype, _ := p.structType(n) - - // Gcc wrapper unpacks the C argument struct - // and calls the actual C function. - if n.AddError { - fmt.Fprintf(fgcc, "int\n") - } else { - fmt.Fprintf(fgcc, "void\n") - } - fmt.Fprintf(fgcc, "_cgo%s%s(void *v)\n", cPrefix, n.Mangle) - fmt.Fprintf(fgcc, "{\n") - if n.AddError { - fmt.Fprintf(fgcc, "\terrno = 0;\n") - } - // We're trying to write a gcc struct that matches gc's layout. - // Use packed attribute to force no padding in this struct in case - // gcc has different packing requirements. - fmt.Fprintf(fgcc, "\t%s %v *a = v;\n", ctype, p.packedAttribute()) - if n.FuncType.Result != nil { - // Save the stack top for use below. - fmt.Fprintf(fgcc, "\tchar *stktop = _cgo_topofstack();\n") - } - fmt.Fprintf(fgcc, "\t") - if t := n.FuncType.Result; t != nil { - fmt.Fprintf(fgcc, "__typeof__(a->r) r = ") - if c := t.C.String(); c[len(c)-1] == '*' { - fmt.Fprint(fgcc, "(__typeof__(a->r)) ") - } - } - fmt.Fprintf(fgcc, "%s(", n.C) - for i, t := range n.FuncType.Params { - if i > 0 { - fmt.Fprintf(fgcc, ", ") - } - // We know the type params are correct, because - // the Go equivalents had good type params. - // However, our version of the type omits the magic - // words const and volatile, which can provoke - // C compiler warnings. Silence them by casting - // all pointers to void*. (Eventually that will produce - // other warnings.) - if c := t.C.String(); c[len(c)-1] == '*' { - fmt.Fprintf(fgcc, "(void*)") - } - fmt.Fprintf(fgcc, "a->p%d", i) - } - fmt.Fprintf(fgcc, ");\n") - if n.FuncType.Result != nil { - // The cgo call may have caused a stack copy (via a callback). - // Adjust the return value pointer appropriately. - fmt.Fprintf(fgcc, "\ta = (void*)((char*)a + (_cgo_topofstack() - stktop));\n") - // Save the return value. - fmt.Fprintf(fgcc, "\ta->r = r;\n") - } - if n.AddError { - fmt.Fprintf(fgcc, "\treturn errno;\n") - } - fmt.Fprintf(fgcc, "}\n") - fmt.Fprintf(fgcc, "\n") -} - -// Write out a wrapper for a function when using gccgo. This is a -// simple wrapper that just calls the real function. We only need a -// wrapper to support static functions in the prologue--without a -// wrapper, we can't refer to the function, since the reference is in -// a different file. -func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) { - if t := n.FuncType.Result; t != nil { - fmt.Fprintf(fgcc, "%s\n", t.C.String()) - } else { - fmt.Fprintf(fgcc, "void\n") - } - fmt.Fprintf(fgcc, "_cgo%s%s(", cPrefix, n.Mangle) - for i, t := range n.FuncType.Params { - if i > 0 { - fmt.Fprintf(fgcc, ", ") - } - c := t.Typedef - if c == "" { - c = t.C.String() - } - fmt.Fprintf(fgcc, "%s p%d", c, i) - } - fmt.Fprintf(fgcc, ")\n") - fmt.Fprintf(fgcc, "{\n") - fmt.Fprintf(fgcc, "\t") - if t := n.FuncType.Result; t != nil { - fmt.Fprintf(fgcc, "return ") - // Cast to void* to avoid warnings due to omitted qualifiers. - if c := t.C.String(); c[len(c)-1] == '*' { - fmt.Fprintf(fgcc, "(void*)") - } - } - fmt.Fprintf(fgcc, "%s(", n.C) - for i, t := range n.FuncType.Params { - if i > 0 { - fmt.Fprintf(fgcc, ", ") - } - // Cast to void* to avoid warnings due to omitted qualifiers. - if c := t.C.String(); c[len(c)-1] == '*' { - fmt.Fprintf(fgcc, "(void*)") - } - fmt.Fprintf(fgcc, "p%d", i) - } - fmt.Fprintf(fgcc, ");\n") - fmt.Fprintf(fgcc, "}\n") - fmt.Fprintf(fgcc, "\n") -} - -// packedAttribute returns host compiler struct attribute that will be -// used to match gc's struct layout. For example, on 386 Windows, -// gcc wants to 8-align int64s, but gc does not. -// Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86, -// and https://golang.org/issue/5603. -func (p *Package) packedAttribute() string { - s := "__attribute__((__packed__" - if !p.GccIsClang && (goarch == "amd64" || goarch == "386") { - s += ", __gcc_struct__" - } - return s + "))" -} - -// Write out the various stubs we need to support functions exported -// from Go so that they are callable from C. -func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) { - p.writeExportHeader(fgcch) - - fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n") - fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n\n") - - fmt.Fprintf(fgcc, "extern void crosscall2(void (*fn)(void *, int), void *, int);\n") - fmt.Fprintf(fgcc, "extern void _cgo_wait_runtime_init_done();\n\n") - - for _, exp := range p.ExpFunc { - fn := exp.Func - - // Construct a gcc struct matching the gc argument and - // result frame. The gcc struct will be compiled with - // __attribute__((packed)) so all padding must be accounted - // for explicitly. - ctype := "struct {\n" - off := int64(0) - npad := 0 - if fn.Recv != nil { - t := p.cgoType(fn.Recv.List[0].Type) - ctype += fmt.Sprintf("\t\t%s recv;\n", t.C) - off += t.Size - } - fntype := fn.Type - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - t := p.cgoType(atype) - if off%t.Align != 0 { - pad := t.Align - off%t.Align - ctype += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad) - off += pad - npad++ - } - ctype += fmt.Sprintf("\t\t%s p%d;\n", t.C, i) - off += t.Size - }) - if off%p.PtrSize != 0 { - pad := p.PtrSize - off%p.PtrSize - ctype += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad) - off += pad - npad++ - } - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - t := p.cgoType(atype) - if off%t.Align != 0 { - pad := t.Align - off%t.Align - ctype += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad) - off += pad - npad++ - } - ctype += fmt.Sprintf("\t\t%s r%d;\n", t.C, i) - off += t.Size - }) - if off%p.PtrSize != 0 { - pad := p.PtrSize - off%p.PtrSize - ctype += fmt.Sprintf("\t\tchar __pad%d[%d];\n", npad, pad) - off += pad - npad++ - } - if ctype == "struct {\n" { - ctype += "\t\tchar unused;\n" // avoid empty struct - } - ctype += "\t}" - - // Get the return type of the wrapper function - // compiled by gcc. - gccResult := "" - if fntype.Results == nil || len(fntype.Results.List) == 0 { - gccResult = "void" - } else if len(fntype.Results.List) == 1 && len(fntype.Results.List[0].Names) <= 1 { - gccResult = p.cgoType(fntype.Results.List[0].Type).C.String() - } else { - fmt.Fprintf(fgcch, "\n/* Return type for %s */\n", exp.ExpName) - fmt.Fprintf(fgcch, "struct %s_return {\n", exp.ExpName) - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - fmt.Fprintf(fgcch, "\t%s r%d;\n", p.cgoType(atype).C, i) - }) - fmt.Fprintf(fgcch, "};\n") - gccResult = "struct " + exp.ExpName + "_return" - } - - // Build the wrapper function compiled by gcc. - s := fmt.Sprintf("%s %s(", gccResult, exp.ExpName) - if fn.Recv != nil { - s += p.cgoType(fn.Recv.List[0].Type).C.String() - s += " recv" - } - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 || fn.Recv != nil { - s += ", " - } - s += fmt.Sprintf("%s p%d", p.cgoType(atype).C, i) - }) - s += ")" - - if len(exp.Doc) > 0 { - fmt.Fprintf(fgcch, "\n%s", exp.Doc) - } - fmt.Fprintf(fgcch, "\nextern %s;\n", s) - - fmt.Fprintf(fgcc, "extern void _cgoexp%s_%s(void *, int);\n", cPrefix, exp.ExpName) - fmt.Fprintf(fgcc, "\n%s\n", s) - fmt.Fprintf(fgcc, "{\n") - fmt.Fprintf(fgcc, "\t_cgo_wait_runtime_init_done();\n") - fmt.Fprintf(fgcc, "\t%s %v a;\n", ctype, p.packedAttribute()) - if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) { - fmt.Fprintf(fgcc, "\t%s r;\n", gccResult) - } - if fn.Recv != nil { - fmt.Fprintf(fgcc, "\ta.recv = recv;\n") - } - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - fmt.Fprintf(fgcc, "\ta.p%d = p%d;\n", i, i) - }) - fmt.Fprintf(fgcc, "\tcrosscall2(_cgoexp%s_%s, &a, %d);\n", cPrefix, exp.ExpName, off) - if gccResult != "void" { - if len(fntype.Results.List) == 1 && len(fntype.Results.List[0].Names) <= 1 { - fmt.Fprintf(fgcc, "\treturn a.r0;\n") - } else { - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - fmt.Fprintf(fgcc, "\tr.r%d = a.r%d;\n", i, i) - }) - fmt.Fprintf(fgcc, "\treturn r;\n") - } - } - fmt.Fprintf(fgcc, "}\n") - - // Build the wrapper function compiled by gc. - goname := exp.Func.Name.Name - if fn.Recv != nil { - goname = "_cgoexpwrap" + cPrefix + "_" + fn.Recv.List[0].Names[0].Name + "_" + goname - } - fmt.Fprintf(fgo2, "//go:cgo_export_dynamic %s\n", goname) - fmt.Fprintf(fgo2, "//go:linkname _cgoexp%s_%s _cgoexp%s_%s\n", cPrefix, exp.ExpName, cPrefix, exp.ExpName) - fmt.Fprintf(fgo2, "//go:cgo_export_static _cgoexp%s_%s\n", cPrefix, exp.ExpName) - fmt.Fprintf(fgo2, "//go:nosplit\n") // no split stack, so no use of m or g - fmt.Fprintf(fgo2, "//go:norace\n") // must not have race detector calls inserted - fmt.Fprintf(fgo2, "func _cgoexp%s_%s(a unsafe.Pointer, n int32) {", cPrefix, exp.ExpName) - fmt.Fprintf(fgo2, "\tfn := %s\n", goname) - // The indirect here is converting from a Go function pointer to a C function pointer. - fmt.Fprintf(fgo2, "\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n));\n") - fmt.Fprintf(fgo2, "}\n") - - fmt.Fprintf(fm, "int _cgoexp%s_%s;\n", cPrefix, exp.ExpName) - - // Calling a function with a receiver from C requires - // a Go wrapper function. - if fn.Recv != nil { - fmt.Fprintf(fgo2, "func %s(recv ", goname) - conf.Fprint(fgo2, fset, fn.Recv.List[0].Type) - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - fmt.Fprintf(fgo2, ", p%d ", i) - conf.Fprint(fgo2, fset, atype) - }) - fmt.Fprintf(fgo2, ")") - if gccResult != "void" { - fmt.Fprint(fgo2, " (") - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - if i > 0 { - fmt.Fprint(fgo2, ", ") - } - conf.Fprint(fgo2, fset, atype) - }) - fmt.Fprint(fgo2, ")") - } - fmt.Fprint(fgo2, " {\n") - fmt.Fprint(fgo2, "\t") - if gccResult != "void" { - fmt.Fprint(fgo2, "return ") - } - fmt.Fprintf(fgo2, "recv.%s(", exp.Func.Name) - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 { - fmt.Fprint(fgo2, ", ") - } - fmt.Fprintf(fgo2, "p%d", i) - }) - fmt.Fprint(fgo2, ")\n") - fmt.Fprint(fgo2, "}\n") - } - } - - fmt.Fprintf(fgcch, "%s", gccExportHeaderEpilog) -} - -// Write out the C header allowing C code to call exported gccgo functions. -func (p *Package) writeGccgoExports(fgo2, fm, fgcc, fgcch io.Writer) { - gccgoSymbolPrefix := p.gccgoSymbolPrefix() - - p.writeExportHeader(fgcch) - - fmt.Fprintf(fgcc, "/* Created by cgo - DO NOT EDIT. */\n") - fmt.Fprintf(fgcc, "#include \"_cgo_export.h\"\n") - - fmt.Fprintf(fgcc, "%s\n", gccgoExportFileProlog) - - for _, exp := range p.ExpFunc { - fn := exp.Func - fntype := fn.Type - - cdeclBuf := new(bytes.Buffer) - resultCount := 0 - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { resultCount++ }) - switch resultCount { - case 0: - fmt.Fprintf(cdeclBuf, "void") - case 1: - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - t := p.cgoType(atype) - fmt.Fprintf(cdeclBuf, "%s", t.C) - }) - default: - // Declare a result struct. - fmt.Fprintf(fgcch, "\n/* Return type for %s */\n", exp.ExpName) - fmt.Fprintf(fgcch, "struct %s_result {\n", exp.ExpName) - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - t := p.cgoType(atype) - fmt.Fprintf(fgcch, "\t%s r%d;\n", t.C, i) - }) - fmt.Fprintf(fgcch, "};\n") - fmt.Fprintf(cdeclBuf, "struct %s_result", exp.ExpName) - } - - cRet := cdeclBuf.String() - - cdeclBuf = new(bytes.Buffer) - fmt.Fprintf(cdeclBuf, "(") - if fn.Recv != nil { - fmt.Fprintf(cdeclBuf, "%s recv", p.cgoType(fn.Recv.List[0].Type).C.String()) - } - // Function parameters. - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 || fn.Recv != nil { - fmt.Fprintf(cdeclBuf, ", ") - } - t := p.cgoType(atype) - fmt.Fprintf(cdeclBuf, "%s p%d", t.C, i) - }) - fmt.Fprintf(cdeclBuf, ")") - cParams := cdeclBuf.String() - - if len(exp.Doc) > 0 { - fmt.Fprintf(fgcch, "\n%s", exp.Doc) - } - - // We need to use a name that will be exported by the - // Go code; otherwise gccgo will make it static and we - // will not be able to link against it from the C - // code. - goName := "Cgoexp_" + exp.ExpName - fmt.Fprintf(fgcch, `extern %s %s %s __asm__("%s.%s");`, cRet, goName, cParams, gccgoSymbolPrefix, goName) - fmt.Fprint(fgcch, "\n") - - // Use a #define so that the C code that includes - // cgo_export.h will be able to refer to the Go - // function using the expected name. - fmt.Fprintf(fgcch, "#define %s %s\n", exp.ExpName, goName) - - // Use a #undef in _cgo_export.c so that we ignore the - // #define from cgo_export.h, since here we are - // defining the real function. - fmt.Fprintf(fgcc, "#undef %s\n", exp.ExpName) - - fmt.Fprint(fgcc, "\n") - fmt.Fprintf(fgcc, "%s %s %s {\n", cRet, exp.ExpName, cParams) - fmt.Fprintf(fgcc, "\tif(_cgo_wait_runtime_init_done)\n") - fmt.Fprintf(fgcc, "\t\t_cgo_wait_runtime_init_done();\n") - fmt.Fprint(fgcc, "\t") - if resultCount > 0 { - fmt.Fprint(fgcc, "return ") - } - fmt.Fprintf(fgcc, "%s(", goName) - if fn.Recv != nil { - fmt.Fprint(fgcc, "recv") - } - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 || fn.Recv != nil { - fmt.Fprintf(fgcc, ", ") - } - fmt.Fprintf(fgcc, "p%d", i) - }) - fmt.Fprint(fgcc, ");\n") - fmt.Fprint(fgcc, "}\n") - - // Dummy declaration for _cgo_main.c - fmt.Fprintf(fm, `char %s[1] __asm__("%s.%s");`, goName, gccgoSymbolPrefix, goName) - fmt.Fprint(fm, "\n") - - // For gccgo we use a wrapper function in Go, in order - // to call CgocallBack and CgocallBackDone. - - // This code uses printer.Fprint, not conf.Fprint, - // because we don't want //line comments in the middle - // of the function types. - fmt.Fprint(fgo2, "\n") - fmt.Fprintf(fgo2, "func %s(", goName) - if fn.Recv != nil { - fmt.Fprint(fgo2, "recv ") - printer.Fprint(fgo2, fset, fn.Recv.List[0].Type) - } - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 || fn.Recv != nil { - fmt.Fprintf(fgo2, ", ") - } - fmt.Fprintf(fgo2, "p%d ", i) - printer.Fprint(fgo2, fset, atype) - }) - fmt.Fprintf(fgo2, ")") - if resultCount > 0 { - fmt.Fprintf(fgo2, " (") - forFieldList(fntype.Results, - func(i int, atype ast.Expr) { - if i > 0 { - fmt.Fprint(fgo2, ", ") - } - printer.Fprint(fgo2, fset, atype) - }) - fmt.Fprint(fgo2, ")") - } - fmt.Fprint(fgo2, " {\n") - fmt.Fprint(fgo2, "\tsyscall.CgocallBack()\n") - fmt.Fprint(fgo2, "\tdefer syscall.CgocallBackDone()\n") - fmt.Fprint(fgo2, "\t") - if resultCount > 0 { - fmt.Fprint(fgo2, "return ") - } - if fn.Recv != nil { - fmt.Fprint(fgo2, "recv.") - } - fmt.Fprintf(fgo2, "%s(", exp.Func.Name) - forFieldList(fntype.Params, - func(i int, atype ast.Expr) { - if i > 0 { - fmt.Fprint(fgo2, ", ") - } - fmt.Fprintf(fgo2, "p%d", i) - }) - fmt.Fprint(fgo2, ")\n") - fmt.Fprint(fgo2, "}\n") - } - - fmt.Fprintf(fgcch, "%s", gccExportHeaderEpilog) -} - -// writeExportHeader writes out the start of the _cgo_export.h file. -func (p *Package) writeExportHeader(fgcch io.Writer) { - fmt.Fprintf(fgcch, "/* Created by \"go tool cgo\" - DO NOT EDIT. */\n\n") - pkg := *importPath - if pkg == "" { - pkg = p.PackagePath - } - fmt.Fprintf(fgcch, "/* package %s */\n\n", pkg) - - fmt.Fprintf(fgcch, "/* Start of preamble from import \"C\" comments. */\n\n") - fmt.Fprintf(fgcch, "%s\n", p.Preamble) - fmt.Fprintf(fgcch, "\n/* End of preamble from import \"C\" comments. */\n\n") - - fmt.Fprintf(fgcch, "%s\n", p.gccExportHeaderProlog()) -} - -// Return the package prefix when using gccgo. -func (p *Package) gccgoSymbolPrefix() string { - if !*gccgo { - return "" - } - - clean := func(r rune) rune { - switch { - case 'A' <= r && r <= 'Z', 'a' <= r && r <= 'z', - '0' <= r && r <= '9': - return r - } - return '_' - } - - if *gccgopkgpath != "" { - return strings.Map(clean, *gccgopkgpath) - } - if *gccgoprefix == "" && p.PackageName == "main" { - return "main" - } - prefix := strings.Map(clean, *gccgoprefix) - if prefix == "" { - prefix = "go" - } - return prefix + "." + p.PackageName -} - -// Call a function for each entry in an ast.FieldList, passing the -// index into the list and the type. -func forFieldList(fl *ast.FieldList, fn func(int, ast.Expr)) { - if fl == nil { - return - } - i := 0 - for _, r := range fl.List { - if r.Names == nil { - fn(i, r.Type) - i++ - } else { - for range r.Names { - fn(i, r.Type) - i++ - } - } - } -} - -func c(repr string, args ...interface{}) *TypeRepr { - return &TypeRepr{repr, args} -} - -// Map predeclared Go types to Type. -var goTypes = map[string]*Type{ - "bool": {Size: 1, Align: 1, C: c("GoUint8")}, - "byte": {Size: 1, Align: 1, C: c("GoUint8")}, - "int": {Size: 0, Align: 0, C: c("GoInt")}, - "uint": {Size: 0, Align: 0, C: c("GoUint")}, - "rune": {Size: 4, Align: 4, C: c("GoInt32")}, - "int8": {Size: 1, Align: 1, C: c("GoInt8")}, - "uint8": {Size: 1, Align: 1, C: c("GoUint8")}, - "int16": {Size: 2, Align: 2, C: c("GoInt16")}, - "uint16": {Size: 2, Align: 2, C: c("GoUint16")}, - "int32": {Size: 4, Align: 4, C: c("GoInt32")}, - "uint32": {Size: 4, Align: 4, C: c("GoUint32")}, - "int64": {Size: 8, Align: 8, C: c("GoInt64")}, - "uint64": {Size: 8, Align: 8, C: c("GoUint64")}, - "float32": {Size: 4, Align: 4, C: c("GoFloat32")}, - "float64": {Size: 8, Align: 8, C: c("GoFloat64")}, - "complex64": {Size: 8, Align: 8, C: c("GoComplex64")}, - "complex128": {Size: 16, Align: 16, C: c("GoComplex128")}, -} - -// Map an ast type to a Type. -func (p *Package) cgoType(e ast.Expr) *Type { - switch t := e.(type) { - case *ast.StarExpr: - x := p.cgoType(t.X) - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("%s*", x.C)} - case *ast.ArrayType: - if t.Len == nil { - // Slice: pointer, len, cap. - return &Type{Size: p.PtrSize * 3, Align: p.PtrSize, C: c("GoSlice")} - } - case *ast.StructType: - // TODO - case *ast.FuncType: - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("void*")} - case *ast.InterfaceType: - return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")} - case *ast.MapType: - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("GoMap")} - case *ast.ChanType: - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("GoChan")} - case *ast.Ident: - // Look up the type in the top level declarations. - // TODO: Handle types defined within a function. - for _, d := range p.Decl { - gd, ok := d.(*ast.GenDecl) - if !ok || gd.Tok != token.TYPE { - continue - } - for _, spec := range gd.Specs { - ts, ok := spec.(*ast.TypeSpec) - if !ok { - continue - } - if ts.Name.Name == t.Name { - return p.cgoType(ts.Type) - } - } - } - if def := typedef[t.Name]; def != nil { - return def - } - if t.Name == "uintptr" { - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("GoUintptr")} - } - if t.Name == "string" { - // The string data is 1 pointer + 1 (pointer-sized) int. - return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoString")} - } - if t.Name == "error" { - return &Type{Size: 2 * p.PtrSize, Align: p.PtrSize, C: c("GoInterface")} - } - if r, ok := goTypes[t.Name]; ok { - if r.Size == 0 { // int or uint - rr := new(Type) - *rr = *r - rr.Size = p.IntSize - rr.Align = p.IntSize - r = rr - } - if r.Align > p.PtrSize { - r.Align = p.PtrSize - } - return r - } - error_(e.Pos(), "unrecognized Go type %s", t.Name) - return &Type{Size: 4, Align: 4, C: c("int")} - case *ast.SelectorExpr: - id, ok := t.X.(*ast.Ident) - if ok && id.Name == "unsafe" && t.Sel.Name == "Pointer" { - return &Type{Size: p.PtrSize, Align: p.PtrSize, C: c("void*")} - } - } - error_(e.Pos(), "Go type not supported in export: %s", gofmt(e)) - return &Type{Size: 4, Align: 4, C: c("int")} -} - -const gccProlog = ` -// Usual nonsense: if x and y are not equal, the type will be invalid -// (have a negative array count) and an inscrutable error will come -// out of the compiler and hopefully mention "name". -#define __cgo_compile_assert_eq(x, y, name) typedef char name[(x-y)*(x-y)*-2+1]; - -// Check at compile time that the sizes we use match our expectations. -#define __cgo_size_assert(t, n) __cgo_compile_assert_eq(sizeof(t), n, _cgo_sizeof_##t##_is_not_##n) - -__cgo_size_assert(char, 1) -__cgo_size_assert(short, 2) -__cgo_size_assert(int, 4) -typedef long long __cgo_long_long; -__cgo_size_assert(__cgo_long_long, 8) -__cgo_size_assert(float, 4) -__cgo_size_assert(double, 8) - -extern char* _cgo_topofstack(void); - -#include -#include -` - -const builtinProlog = ` -#include /* for ptrdiff_t and size_t below */ - -/* Define intgo when compiling with GCC. */ -typedef ptrdiff_t intgo; - -typedef struct { char *p; intgo n; } _GoString_; -typedef struct { char *p; intgo n; intgo c; } _GoBytes_; -_GoString_ GoString(char *p); -_GoString_ GoStringN(char *p, int l); -_GoBytes_ GoBytes(void *p, int n); -char *CString(_GoString_); -void *_CMalloc(size_t); -` - -const goProlog = ` -//go:linkname _cgo_runtime_cgocall runtime.cgocall -func _cgo_runtime_cgocall(unsafe.Pointer, uintptr) int32 - -//go:linkname _cgo_runtime_cmalloc runtime.cmalloc -func _cgo_runtime_cmalloc(uintptr) unsafe.Pointer - -//go:linkname _cgo_runtime_cgocallback runtime.cgocallback -func _cgo_runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr) -` - -const goStringDef = ` -//go:linkname _cgo_runtime_gostring runtime.gostring -func _cgo_runtime_gostring(*_Ctype_char) string - -func _Cfunc_GoString(p *_Ctype_char) string { - return _cgo_runtime_gostring(p) -} -` - -const goStringNDef = ` -//go:linkname _cgo_runtime_gostringn runtime.gostringn -func _cgo_runtime_gostringn(*_Ctype_char, int) string - -func _Cfunc_GoStringN(p *_Ctype_char, l _Ctype_int) string { - return _cgo_runtime_gostringn(p, int(l)) -} -` - -const goBytesDef = ` -//go:linkname _cgo_runtime_gobytes runtime.gobytes -func _cgo_runtime_gobytes(unsafe.Pointer, int) []byte - -func _Cfunc_GoBytes(p unsafe.Pointer, l _Ctype_int) []byte { - return _cgo_runtime_gobytes(p, int(l)) -} -` - -const cStringDef = ` -func _Cfunc_CString(s string) *_Ctype_char { - p := _cgo_runtime_cmalloc(uintptr(len(s)+1)) - pp := (*[1<<30]byte)(p) - copy(pp[:], s) - pp[len(s)] = 0 - return (*_Ctype_char)(p) -} -` - -const cMallocDef = ` -func _Cfunc__CMalloc(n _Ctype_size_t) unsafe.Pointer { - return _cgo_runtime_cmalloc(uintptr(n)) -} -` - -var builtinDefs = map[string]string{ - "GoString": goStringDef, - "GoStringN": goStringNDef, - "GoBytes": goBytesDef, - "CString": cStringDef, - "_CMalloc": cMallocDef, -} - -func (p *Package) cPrologGccgo() string { - return strings.Replace(cPrologGccgo, "PREFIX", cPrefix, -1) -} - -const cPrologGccgo = ` -#include -#include -#include - -typedef unsigned char byte; -typedef intptr_t intgo; - -struct __go_string { - const unsigned char *__data; - intgo __length; -}; - -typedef struct __go_open_array { - void* __values; - intgo __count; - intgo __capacity; -} Slice; - -struct __go_string __go_byte_array_to_string(const void* p, intgo len); -struct __go_open_array __go_string_to_byte_array (struct __go_string str); - -const char *_cgoPREFIX_Cfunc_CString(struct __go_string s) { - char *p = malloc(s.__length+1); - memmove(p, s.__data, s.__length); - p[s.__length] = 0; - return p; -} - -struct __go_string _cgoPREFIX_Cfunc_GoString(char *p) { - intgo len = (p != NULL) ? strlen(p) : 0; - return __go_byte_array_to_string(p, len); -} - -struct __go_string _cgoPREFIX_Cfunc_GoStringN(char *p, int32_t n) { - return __go_byte_array_to_string(p, n); -} - -Slice _cgoPREFIX_Cfunc_GoBytes(char *p, int32_t n) { - struct __go_string s = { (const unsigned char *)p, n }; - return __go_string_to_byte_array(s); -} - -extern void runtime_throw(const char *); -void *_cgoPREFIX_Cfunc__CMalloc(size_t n) { - void *p = malloc(n); - if(p == NULL && n == 0) - p = malloc(1); - if(p == NULL) - runtime_throw("runtime: C malloc failed"); - return p; -} -` - -func (p *Package) gccExportHeaderProlog() string { - return strings.Replace(gccExportHeaderProlog, "GOINTBITS", fmt.Sprint(8*p.IntSize), -1) -} - -const gccExportHeaderProlog = ` -/* Start of boilerplate cgo prologue. */ - -#ifndef GO_CGO_PROLOGUE_H -#define GO_CGO_PROLOGUE_H - -typedef signed char GoInt8; -typedef unsigned char GoUint8; -typedef short GoInt16; -typedef unsigned short GoUint16; -typedef int GoInt32; -typedef unsigned int GoUint32; -typedef long long GoInt64; -typedef unsigned long long GoUint64; -typedef GoIntGOINTBITS GoInt; -typedef GoUintGOINTBITS GoUint; -typedef __SIZE_TYPE__ GoUintptr; -typedef float GoFloat32; -typedef double GoFloat64; -typedef __complex float GoComplex64; -typedef __complex double GoComplex128; - -// static assertion to make sure the file is being used on architecture -// at least with matching size of GoInt. -typedef char _check_for_GOINTBITS_bit_pointer_matching_GoInt[sizeof(void*)==GOINTBITS/8 ? 1:-1]; - -typedef struct { char *p; GoInt n; } GoString; -typedef void *GoMap; -typedef void *GoChan; -typedef struct { void *t; void *v; } GoInterface; -typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; - -#endif - -/* End of boilerplate cgo prologue. */ - -#ifdef __cplusplus -extern "C" { -#endif -` - -// gccExportHeaderEpilog goes at the end of the generated header file. -const gccExportHeaderEpilog = ` -#ifdef __cplusplus -} -#endif -` - -// gccgoExportFileProlog is written to the _cgo_export.c file when -// using gccgo. -// We use weak declarations, and test the addresses, so that this code -// works with older versions of gccgo. -const gccgoExportFileProlog = ` -extern _Bool runtime_iscgo __attribute__ ((weak)); - -static void GoInit(void) __attribute__ ((constructor)); -static void GoInit(void) { - if(&runtime_iscgo) - runtime_iscgo = 1; -} - -extern void _cgo_wait_runtime_init_done() __attribute__ ((weak)); -` diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/util.go b/llgo/third_party/gofrontend/libgo/go/cmd/cgo/util.go deleted file mode 100644 index 3adb8e87836c21adc289b70711ebfbb326370b81..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/cgo/util.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "fmt" - "go/token" - "os" - "os/exec" -) - -// run runs the command argv, feeding in stdin on standard input. -// It returns the output to standard output and standard error. -// ok indicates whether the command exited successfully. -func run(stdin []byte, argv []string) (stdout, stderr []byte, ok bool) { - p := exec.Command(argv[0], argv[1:]...) - p.Stdin = bytes.NewReader(stdin) - var bout, berr bytes.Buffer - p.Stdout = &bout - p.Stderr = &berr - err := p.Run() - if _, ok := err.(*exec.ExitError); err != nil && !ok { - fatalf("%s", err) - } - ok = p.ProcessState.Success() - stdout, stderr = bout.Bytes(), berr.Bytes() - return -} - -func lineno(pos token.Pos) string { - return fset.Position(pos).String() -} - -// Die with an error message. -func fatalf(msg string, args ...interface{}) { - // If we've already printed other errors, they might have - // caused the fatal condition. Assume they're enough. - if nerrors == 0 { - fmt.Fprintf(os.Stderr, msg+"\n", args...) - } - os.Exit(2) -} - -var nerrors int - -func error_(pos token.Pos, msg string, args ...interface{}) { - nerrors++ - if pos.IsValid() { - fmt.Fprintf(os.Stderr, "%s: ", fset.Position(pos).String()) - } - fmt.Fprintf(os.Stderr, msg, args...) - fmt.Fprintf(os.Stderr, "\n") -} - -// isName reports whether s is a valid C identifier -func isName(s string) bool { - for i, v := range s { - if v != '_' && (v < 'A' || v > 'Z') && (v < 'a' || v > 'z') && (v < '0' || v > '9') { - return false - } - if i == 0 && '0' <= v && v <= '9' { - return false - } - } - return s != "" -} - -func creat(name string) *os.File { - f, err := os.Create(name) - if err != nil { - fatalf("%s", err) - } - return f -} - -func slashToUnderscore(c rune) rune { - if c == '/' || c == '\\' || c == ':' { - c = '_' - } - return c -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/alldocs.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/alldocs.go deleted file mode 100644 index 1134997eaaa277f0b0f6592a23c615438b97b327..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/alldocs.go +++ /dev/null @@ -1,1481 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// DO NOT EDIT THIS FILE. GENERATED BY mkalldocs.sh. -// Edit the documentation in other files and rerun mkalldocs.sh to generate this one. - -/* -Go is a tool for managing Go source code. - -Usage: - - go command [arguments] - -The commands are: - - build compile packages and dependencies - clean remove object files - doc show documentation for package or symbol - env print Go environment information - fix run go tool fix on packages - fmt run gofmt on package sources - generate generate Go files by processing source - get download and install packages and dependencies - install compile and install packages and dependencies - list list packages - run compile and run Go program - test test packages - tool run specified go tool - version print Go version - vet run go tool vet on packages - -Use "go help [command]" for more information about a command. - -Additional help topics: - - c calling between Go and C - buildmode description of build modes - filetype file types - gopath GOPATH environment variable - environment environment variables - importpath import path syntax - packages description of package lists - testflag description of testing flags - testfunc description of testing functions - -Use "go help [topic]" for more information about that topic. - - -Compile packages and dependencies - -Usage: - - go build [-o output] [-i] [build flags] [packages] - -Build compiles the packages named by the import paths, -along with their dependencies, but it does not install the results. - -If the arguments to build are a list of .go files, build treats -them as a list of source files specifying a single package. - -When compiling a single main package, build writes -the resulting executable to an output file named after -the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') -or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe'). -The '.exe' suffix is added when writing a Windows executable. - -When compiling multiple packages or a single non-main package, -build compiles the packages but discards the resulting object, -serving only as a check that the packages can be built. - -The -o flag, only allowed when compiling a single package, -forces build to write the resulting executable or object -to the named output file, instead of the default behavior described -in the last two paragraphs. - -The -i flag installs the packages that are dependencies of the target. - -The build flags are shared by the build, clean, get, install, list, run, -and test commands: - - -a - force rebuilding of packages that are already up-to-date. - -n - print the commands but do not run them. - -p n - the number of builds that can be run in parallel. - The default is the number of CPUs available, except - on darwin/arm which defaults to 1. - -race - enable data race detection. - Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. - -v - print the names of packages as they are compiled. - -work - print the name of the temporary work directory and - do not delete it when exiting. - -x - print the commands. - - -asmflags 'flag list' - arguments to pass on each go tool asm invocation. - -buildmode mode - build mode to use. See 'go help buildmode' for more. - -compiler name - name of compiler to use, as in runtime.Compiler (gccgo or gc). - -gccgoflags 'arg list' - arguments to pass on each gccgo compiler/linker invocation. - -gcflags 'arg list' - arguments to pass on each go tool compile invocation. - -installsuffix suffix - a suffix to use in the name of the package installation directory, - in order to keep output separate from default builds. - If using the -race flag, the install suffix is automatically set to race - or, if set explicitly, has _race appended to it. Using a -buildmode - option that requires non-default compile flags has a similar effect. - -ldflags 'flag list' - arguments to pass on each go tool link invocation. - -linkshared - link against shared libraries previously created with - -buildmode=shared - -pkgdir dir - install and load all packages from dir instead of the usual locations. - For example, when building with a non-standard configuration, - use -pkgdir to keep generated packages in a separate location. - -tags 'tag list' - a list of build tags to consider satisfied during the build. - For more information about build tags, see the description of - build constraints in the documentation for the go/build package. - -toolexec 'cmd args' - a program to use to invoke toolchain programs like vet and asm. - For example, instead of running asm, the go command will run - 'cmd args /path/to/asm '. - -The list flags accept a space-separated list of strings. To embed spaces -in an element in the list, surround it with either single or double quotes. - -For more about specifying packages, see 'go help packages'. -For more about where packages and binaries are installed, -run 'go help gopath'. -For more about calling between Go and C/C++, run 'go help c'. - -Note: Build adheres to certain conventions such as those described -by 'go help gopath'. Not all projects can follow these conventions, -however. Installations that have their own conventions or that use -a separate software build system may choose to use lower-level -invocations such as 'go tool compile' and 'go tool link' to avoid -some of the overheads and design decisions of the build tool. - -See also: go install, go get, go clean. - - -Remove object files - -Usage: - - go clean [-i] [-r] [-n] [-x] [build flags] [packages] - -Clean removes object files from package source directories. -The go command builds most objects in a temporary directory, -so go clean is mainly concerned with object files left by other -tools or by manual invocations of go build. - -Specifically, clean removes the following files from each of the -source directories corresponding to the import paths: - - _obj/ old object directory, left from Makefiles - _test/ old test directory, left from Makefiles - _testmain.go old gotest file, left from Makefiles - test.out old test log, left from Makefiles - build.out old test log, left from Makefiles - *.[568ao] object files, left from Makefiles - - DIR(.exe) from go build - DIR.test(.exe) from go test -c - MAINFILE(.exe) from go build MAINFILE.go - *.so from SWIG - -In the list, DIR represents the final path element of the -directory, and MAINFILE is the base name of any Go source -file in the directory that is not included when building -the package. - -The -i flag causes clean to remove the corresponding installed -archive or binary (what 'go install' would create). - -The -n flag causes clean to print the remove commands it would execute, -but not run them. - -The -r flag causes clean to be applied recursively to all the -dependencies of the packages named by the import paths. - -The -x flag causes clean to print remove commands as it executes them. - -For more about build flags, see 'go help build'. - -For more about specifying packages, see 'go help packages'. - - -Show documentation for package or symbol - -Usage: - - go doc [-u] [-c] [package|[package.]symbol[.method]] - -Doc prints the documentation comments associated with the item identified by its -arguments (a package, const, func, type, var, or method) followed by a one-line -summary of each of the first-level items "under" that item (package-level -declarations for a package, methods for a type, etc.). - -Doc accepts zero, one, or two arguments. - -Given no arguments, that is, when run as - - go doc - -it prints the package documentation for the package in the current directory. -If the package is a command (package main), the exported symbols of the package -are elided from the presentation unless the -cmd flag is provided. - -When run with one argument, the argument is treated as a Go-syntax-like -representation of the item to be documented. What the argument selects depends -on what is installed in GOROOT and GOPATH, as well as the form of the argument, -which is schematically one of these: - - go doc - go doc [.] - go doc [].[.] - -The first item in this list matched by the argument is the one whose -documentation is printed. (See the examples below.) For packages, the order of -scanning is determined lexically, but the GOROOT tree is always scanned before -GOPATH. - -If there is no package specified or matched, the package in the current -directory is selected, so "go doc Foo" shows the documentation for symbol Foo in -the current package. - -The package path must be either a qualified path or a proper suffix of a -path. The go tool's usual package mechanism does not apply: package path -elements like . and ... are not implemented by go doc. - -When run with two arguments, the first must be a full package path (not just a -suffix), and the second is a symbol or symbol and method; this is similar to the -syntax accepted by godoc: - - go doc [.] - -In all forms, when matching symbols, lower-case letters in the argument match -either case but upper-case letters match exactly. This means that there may be -multiple matches of a lower-case argument in a package if different symbols have -different cases. If this occurs, documentation for all matches is printed. - -Examples: - go doc - Show documentation for current package. - go doc Foo - Show documentation for Foo in the current package. - (Foo starts with a capital letter so it cannot match - a package path.) - go doc encoding/json - Show documentation for the encoding/json package. - go doc json - Shorthand for encoding/json. - go doc json.Number (or go doc json.number) - Show documentation and method summary for json.Number. - go doc json.Number.Int64 (or go doc json.number.int64) - Show documentation for json.Number's Int64 method. - go doc cmd/doc - Show package docs for the doc command. - go doc -cmd cmd/doc - Show package docs and exported symbols within the doc command. - go doc template.new - Show documentation for html/template's New function. - (html/template is lexically before text/template) - go doc text/template.new # One argument - Show documentation for text/template's New function. - go doc text/template new # Two arguments - Show documentation for text/template's New function. - -Flags: - -c - Respect case when matching symbols. - -cmd - Treat a command (package main) like a regular package. - Otherwise package main's exported symbols are hidden - when showing the package's top-level documentation. - -u - Show documentation for unexported as well as exported - symbols and methods. - - -Print Go environment information - -Usage: - - go env [var ...] - -Env prints Go environment information. - -By default env prints information as a shell script -(on Windows, a batch file). If one or more variable -names is given as arguments, env prints the value of -each named variable on its own line. - - -Run go tool fix on packages - -Usage: - - go fix [packages] - -Fix runs the Go fix command on the packages named by the import paths. - -For more about fix, see 'go doc cmd/fix'. -For more about specifying packages, see 'go help packages'. - -To run fix with specific options, run 'go tool fix'. - -See also: go fmt, go vet. - - -Run gofmt on package sources - -Usage: - - go fmt [-n] [-x] [packages] - -Fmt runs the command 'gofmt -l -w' on the packages named -by the import paths. It prints the names of the files that are modified. - -For more about gofmt, see 'go doc cmd/gofmt'. -For more about specifying packages, see 'go help packages'. - -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -To run gofmt with specific options, run gofmt itself. - -See also: go fix, go vet. - - -Generate Go files by processing source - -Usage: - - go generate [-run regexp] [file.go... | packages] - -Generate runs commands described by directives within existing -files. Those commands can run any process but the intent is to -create or update Go source files, for instance by running yacc. - -Go generate is never run automatically by go build, go get, go test, -and so on. It must be run explicitly. - -Go generate scans the file for directives, which are lines of -the form, - - //go:generate command argument... - -(note: no leading spaces and no space in "//go") where command -is the generator to be run, corresponding to an executable file -that can be run locally. It must either be in the shell path -(gofmt), a fully qualified path (/usr/you/bin/mytool), or a -command alias, described below. - -Note that go generate does not parse the file, so lines that look -like directives in comments or multiline strings will be treated -as directives. - -The arguments to the directive are space-separated tokens or -double-quoted strings passed to the generator as individual -arguments when it is run. - -Quoted strings use Go syntax and are evaluated before execution; a -quoted string appears as a single argument to the generator. - -Go generate sets several variables when it runs the generator: - - $GOARCH - The execution architecture (arm, amd64, etc.) - $GOOS - The execution operating system (linux, windows, etc.) - $GOFILE - The base name of the file. - $GOLINE - The line number of the directive in the source file. - $GOPACKAGE - The name of the package of the file containing the directive. - $DOLLAR - A dollar sign. - -Other than variable substitution and quoted-string evaluation, no -special processing such as "globbing" is performed on the command -line. - -As a last step before running the command, any invocations of any -environment variables with alphanumeric names, such as $GOFILE or -$HOME, are expanded throughout the command line. The syntax for -variable expansion is $NAME on all operating systems. Due to the -order of evaluation, variables are expanded even inside quoted -strings. If the variable NAME is not set, $NAME expands to the -empty string. - -A directive of the form, - - //go:generate -command xxx args... - -specifies, for the remainder of this source file only, that the -string xxx represents the command identified by the arguments. This -can be used to create aliases or to handle multiword generators. -For example, - - //go:generate -command yacc go tool yacc - -specifies that the command "yacc" represents the generator -"go tool yacc". - -Generate processes packages in the order given on the command line, -one at a time. If the command line lists .go files, they are treated -as a single package. Within a package, generate processes the -source files in a package in file name order, one at a time. Within -a source file, generate runs generators in the order they appear -in the file, one at a time. - -If any generator returns an error exit status, "go generate" skips -all further processing for that package. - -The generator is run in the package's source directory. - -Go generate accepts one specific flag: - - -run="" - if non-empty, specifies a regular expression to select - directives whose full original source text (excluding - any trailing spaces and final newline) matches the - expression. - -It also accepts the standard build flags -v, -n, and -x. -The -v flag prints the names of packages and files as they are -processed. -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -For more about specifying packages, see 'go help packages'. - - -Download and install packages and dependencies - -Usage: - - go get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages] - -Get downloads and installs the packages named by the import paths, -along with their dependencies. - -The -d flag instructs get to stop after downloading the packages; that is, -it instructs get not to install the packages. - -The -f flag, valid only when -u is set, forces get -u not to verify that -each package has been checked out from the source control repository -implied by its import path. This can be useful if the source is a local fork -of the original. - -The -fix flag instructs get to run the fix tool on the downloaded packages -before resolving dependencies or building the code. - -The -insecure flag permits fetching from repositories and resolving -custom domains using insecure schemes such as HTTP. Use with caution. - -The -t flag instructs get to also download the packages required to build -the tests for the specified packages. - -The -u flag instructs get to use the network to update the named packages -and their dependencies. By default, get uses the network to check out -missing packages but does not use it to look for updates to existing packages. - -Get also accepts build flags to control the installation. See 'go help build'. - -When checking out or updating a package, get looks for a branch or tag -that matches the locally installed version of Go. The most important -rule is that if the local installation is running version "go1", get -searches for a branch or tag named "go1". If no such version exists it -retrieves the most recent version of the package. - -If the vendoring experiment is enabled (see 'go help gopath'), -then when go get checks out or updates a Git repository, -it also updates any git submodules referenced by the repository. - -For more about specifying packages, see 'go help packages'. - -For more about how 'go get' finds source code to -download, see 'go help importpath'. - -See also: go build, go install, go clean. - - -Compile and install packages and dependencies - -Usage: - - go install [build flags] [packages] - -Install compiles and installs the packages named by the import paths, -along with their dependencies. - -For more about the build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. - -See also: go build, go get, go clean. - - -List packages - -Usage: - - go list [-e] [-f format] [-json] [build flags] [packages] - -List lists the packages named by the import paths, one per line. - -The default output shows the package import path: - - bytes - encoding/json - github.com/gorilla/mux - golang.org/x/net/html - -The -f flag specifies an alternate format for the list, using the -syntax of package template. The default output is equivalent to -f -'{{.ImportPath}}'. The struct being passed to the template is: - - type Package struct { - Dir string // directory containing package sources - ImportPath string // import path of package in dir - ImportComment string // path in import comment on package statement - Name string // package name - Doc string // package documentation string - Target string // install path - Shlib string // the shared library that contains this package (only set when -linkshared) - Goroot bool // is this package in the Go root? - Standard bool // is this package part of the standard Go library? - Stale bool // would 'go install' do anything for this package? - Root string // Go root or Go path dir containing this package - - // Source files - GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) - CgoFiles []string // .go sources files that import "C" - IgnoredGoFiles []string // .go sources ignored due to build constraints - CFiles []string // .c source files - CXXFiles []string // .cc, .cxx and .cpp source files - MFiles []string // .m source files - HFiles []string // .h, .hh, .hpp and .hxx source files - SFiles []string // .s source files - SwigFiles []string // .swig files - SwigCXXFiles []string // .swigcxx files - SysoFiles []string // .syso object files to add to archive - - // Cgo directives - CgoCFLAGS []string // cgo: flags for C compiler - CgoCPPFLAGS []string // cgo: flags for C preprocessor - CgoCXXFLAGS []string // cgo: flags for C++ compiler - CgoLDFLAGS []string // cgo: flags for linker - CgoPkgConfig []string // cgo: pkg-config names - - // Dependency information - Imports []string // import paths used by this package - Deps []string // all (recursively) imported dependencies - - // Error information - Incomplete bool // this package or a dependency has an error - Error *PackageError // error loading package - DepsErrors []*PackageError // errors loading dependencies - - TestGoFiles []string // _test.go files in package - TestImports []string // imports from TestGoFiles - XTestGoFiles []string // _test.go files outside package - XTestImports []string // imports from XTestGoFiles - } - -The template function "join" calls strings.Join. - -The template function "context" returns the build context, defined as: - - type Context struct { - GOARCH string // target architecture - GOOS string // target operating system - GOROOT string // Go root - GOPATH string // Go path - CgoEnabled bool // whether cgo can be used - UseAllFiles bool // use files regardless of +build lines, file names - Compiler string // compiler to assume when computing target paths - BuildTags []string // build constraints to match in +build lines - ReleaseTags []string // releases the current release is compatible with - InstallSuffix string // suffix to use in the name of the install dir - } - -For more information about the meaning of these fields see the documentation -for the go/build package's Context type. - -The -json flag causes the package data to be printed in JSON format -instead of using the template format. - -The -e flag changes the handling of erroneous packages, those that -cannot be found or are malformed. By default, the list command -prints an error to standard error for each erroneous package and -omits the packages from consideration during the usual printing. -With the -e flag, the list command never prints errors to standard -error and instead processes the erroneous packages with the usual -printing. Erroneous packages will have a non-empty ImportPath and -a non-nil Error field; other information may or may not be missing -(zeroed). - -For more about build flags, see 'go help build'. - -For more about specifying packages, see 'go help packages'. - - -Compile and run Go program - -Usage: - - go run [build flags] [-exec xprog] gofiles... [arguments...] - -Run compiles and runs the main package comprising the named Go source files. -A Go source file is defined to be a file ending in a literal ".go" suffix. - -By default, 'go run' runs the compiled binary directly: 'a.out arguments...'. -If the -exec flag is given, 'go run' invokes the binary using xprog: - 'xprog a.out arguments...'. -If the -exec flag is not given, GOOS or GOARCH is different from the system -default, and a program named go_$GOOS_$GOARCH_exec can be found -on the current search path, 'go run' invokes the binary using that program, -for example 'go_nacl_386_exec a.out arguments...'. This allows execution of -cross-compiled programs when a simulator or other execution method is -available. - -For more about build flags, see 'go help build'. - -See also: go build. - - -Test packages - -Usage: - - go test [-c] [-i] [build and test flags] [packages] [flags for test binary] - -'Go test' automates testing the packages named by the import paths. -It prints a summary of the test results in the format: - - ok archive/tar 0.011s - FAIL archive/zip 0.022s - ok compress/gzip 0.033s - ... - -followed by detailed output for each failed package. - -'Go test' recompiles each package along with any files with names matching -the file pattern "*_test.go". -Files whose names begin with "_" (including "_test.go") or "." are ignored. -These additional files can contain test functions, benchmark functions, and -example functions. See 'go help testfunc' for more. -Each listed package causes the execution of a separate test binary. - -Test files that declare a package with the suffix "_test" will be compiled as a -separate package, and then linked and run with the main test binary. - -By default, go test needs no arguments. It compiles and tests the package -with source in the current directory, including tests, and runs the tests. - -The package is built in a temporary directory so it does not interfere with the -non-test installation. - -In addition to the build flags, the flags handled by 'go test' itself are: - - -c - Compile the test binary to pkg.test but do not run it - (where pkg is the last element of the package's import path). - The file name can be changed with the -o flag. - - -exec xprog - Run the test binary using xprog. The behavior is the same as - in 'go run'. See 'go help run' for details. - - -i - Install packages that are dependencies of the test. - Do not run the test. - - -o file - Compile the test binary to the named file. - The test still runs (unless -c or -i is specified). - -The test binary also accepts flags that control execution of the test; these -flags are also accessible by 'go test'. See 'go help testflag' for details. - -If the test binary needs any other flags, they should be presented after the -package names. The go tool treats as a flag the first argument that begins with -a minus sign that it does not recognize itself; that argument and all subsequent -arguments are passed as arguments to the test binary. - -For more about build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. - -See also: go build, go vet. - - -Run specified go tool - -Usage: - - go tool [-n] command [args...] - -Tool runs the go tool command identified by the arguments. -With no arguments it prints the list of known tools. - -The -n flag causes tool to print the command that would be -executed but not execute it. - -For more about each tool command, see 'go tool command -h'. - - -Print Go version - -Usage: - - go version - -Version prints the Go version, as reported by runtime.Version. - - -Run go tool vet on packages - -Usage: - - go vet [-n] [-x] [build flags] [packages] - -Vet runs the Go vet command on the packages named by the import paths. - -For more about vet, see 'go doc cmd/vet'. -For more about specifying packages, see 'go help packages'. - -To run the vet tool with specific options, run 'go tool vet'. - -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -For more about build flags, see 'go help build'. - -See also: go fmt, go fix. - - -Calling between Go and C - -There are two different ways to call between Go and C/C++ code. - -The first is the cgo tool, which is part of the Go distribution. For -information on how to use it see the cgo documentation (go doc cmd/cgo). - -The second is the SWIG program, which is a general tool for -interfacing between languages. For information on SWIG see -http://swig.org/. When running go build, any file with a .swig -extension will be passed to SWIG. Any file with a .swigcxx extension -will be passed to SWIG with the -c++ option. - -When either cgo or SWIG is used, go build will pass any .c, .m, .s, -or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++ -compiler. The CC or CXX environment variables may be set to determine -the C or C++ compiler, respectively, to use. - - -Description of build modes - -The 'go build' and 'go install' commands take a -buildmode argument which -indicates which kind of object file is to be built. Currently supported values -are: - - -buildmode=archive - Build the listed non-main packages into .a files. Packages named - main are ignored. - - -buildmode=c-archive - Build the listed main package, plus all packages it imports, - into a C archive file. The only callable symbols will be those - functions exported using a cgo //export comment. Requires - exactly one main package to be listed. - - -buildmode=c-shared - Build the listed main packages, plus all packages that they - import, into C shared libraries. The only callable symbols will - be those functions exported using a cgo //export comment. - Non-main packages are ignored. - - -buildmode=default - Listed main packages are built into executables and listed - non-main packages are built into .a files (the default - behavior). - - -buildmode=shared - Combine all the listed non-main packages into a single shared - library that will be used when building with the -linkshared - option. Packages named main are ignored. - - -buildmode=exe - Build the listed main packages and everything they import into - executables. Packages not named main are ignored. - - -File types - -The go command examines the contents of a restricted set of files -in each directory. It identifies which files to examine based on -the extension of the file name. These extensions are: - - .go - Go source files. - .c, .h - C source files. - If the package uses cgo or SWIG, these will be compiled with the - OS-native compiler (typically gcc); otherwise they will - trigger an error. - .cc, .cpp, .cxx, .hh, .hpp, .hxx - C++ source files. Only useful with cgo or SWIG, and always - compiled with the OS-native compiler. - .m - Objective-C source files. Only useful with cgo, and always - compiled with the OS-native compiler. - .s, .S - Assembler source files. - If the package uses cgo or SWIG, these will be assembled with the - OS-native assembler (typically gcc (sic)); otherwise they - will be assembled with the Go assembler. - .swig, .swigcxx - SWIG definition files. - .syso - System object files. - -Files of each of these types except .syso may contain build -constraints, but the go command stops scanning for build constraints -at the first item in the file that is not a blank line or //-style -line comment. - - -GOPATH environment variable - -The Go path is used to resolve import statements. -It is implemented by and documented in the go/build package. - -The GOPATH environment variable lists places to look for Go code. -On Unix, the value is a colon-separated string. -On Windows, the value is a semicolon-separated string. -On Plan 9, the value is a list. - -GOPATH must be set to get, build and install packages outside the -standard Go tree. - -Each directory listed in GOPATH must have a prescribed structure: - -The src directory holds source code. The path below src -determines the import path or executable name. - -The pkg directory holds installed package objects. -As in the Go tree, each target operating system and -architecture pair has its own subdirectory of pkg -(pkg/GOOS_GOARCH). - -If DIR is a directory listed in the GOPATH, a package with -source in DIR/src/foo/bar can be imported as "foo/bar" and -has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". - -The bin directory holds compiled commands. -Each command is named for its source directory, but only -the final element, not the entire path. That is, the -command with source in DIR/src/foo/quux is installed into -DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped -so that you can add DIR/bin to your PATH to get at the -installed commands. If the GOBIN environment variable is -set, commands are installed to the directory it names instead -of DIR/bin. - -Here's an example directory layout: - - GOPATH=/home/user/gocode - - /home/user/gocode/ - src/ - foo/ - bar/ (go code in package bar) - x.go - quux/ (go code in package main) - y.go - bin/ - quux (installed command) - pkg/ - linux_amd64/ - foo/ - bar.a (installed package object) - -Go searches each directory listed in GOPATH to find source code, -but new packages are always downloaded into the first directory -in the list. - -See https://golang.org/doc/code.html for an example. - -Internal Directories - -Code in or below a directory named "internal" is importable only -by code in the directory tree rooted at the parent of "internal". -Here's an extended version of the directory layout above: - - /home/user/gocode/ - src/ - crash/ - bang/ (go code in package bang) - b.go - foo/ (go code in package foo) - f.go - bar/ (go code in package bar) - x.go - internal/ - baz/ (go code in package baz) - z.go - quux/ (go code in package main) - y.go - - -The code in z.go is imported as "foo/internal/baz", but that -import statement can only appear in source files in the subtree -rooted at foo. The source files foo/f.go, foo/bar/x.go, and -foo/quux/y.go can all import "foo/internal/baz", but the source file -crash/bang/b.go cannot. - -See https://golang.org/s/go14internal for details. - -Vendor Directories - -Go 1.5 includes experimental support for using local copies -of external dependencies to satisfy imports of those dependencies, -often referred to as vendoring. Setting the environment variable -GO15VENDOREXPERIMENT=1 enables that experimental support. - -When the vendor experiment is enabled, -code below a directory named "vendor" is importable only -by code in the directory tree rooted at the parent of "vendor", -and only using an import path that omits the prefix up to and -including the vendor element. - -Here's the example from the previous section, -but with the "internal" directory renamed to "vendor" -and a new foo/vendor/crash/bang directory added: - - /home/user/gocode/ - src/ - crash/ - bang/ (go code in package bang) - b.go - foo/ (go code in package foo) - f.go - bar/ (go code in package bar) - x.go - vendor/ - crash/ - bang/ (go code in package bang) - b.go - baz/ (go code in package baz) - z.go - quux/ (go code in package main) - y.go - -The same visibility rules apply as for internal, but the code -in z.go is imported as "baz", not as "foo/vendor/baz". - -Code in vendor directories deeper in the source tree shadows -code in higher directories. Within the subtree rooted at foo, an import -of "crash/bang" resolves to "foo/vendor/crash/bang", not the -top-level "crash/bang". - -Code in vendor directories is not subject to import path -checking (see 'go help importpath'). - -When the vendor experiment is enabled, 'go get' checks out -submodules when checking out or updating a git repository -(see 'go help get'). - -The vendoring semantics are an experiment, and they may change -in future releases. Once settled, they will be on by default. - -See https://golang.org/s/go15vendor for details. - - -Environment variables - -The go command, and the tools it invokes, examine a few different -environment variables. For many of these, you can see the default -value of on your system by running 'go env NAME', where NAME is the -name of the variable. - -General-purpose environment variables: - - GCCGO - The gccgo command to run for 'go build -compiler=gccgo'. - GOARCH - The architecture, or processor, for which to compile code. - Examples are amd64, 386, arm, ppc64. - GOBIN - The directory where 'go install' will install a command. - GOOS - The operating system for which to compile code. - Examples are linux, darwin, windows, netbsd. - GOPATH - See 'go help gopath'. - GORACE - Options for the race detector. - See https://golang.org/doc/articles/race_detector.html. - GOROOT - The root of the go tree. - -Environment variables for use with cgo: - - CC - The command to use to compile C code. - CGO_ENABLED - Whether the cgo command is supported. Either 0 or 1. - CGO_CFLAGS - Flags that cgo will pass to the compiler when compiling - C code. - CGO_CPPFLAGS - Flags that cgo will pass to the compiler when compiling - C or C++ code. - CGO_CXXFLAGS - Flags that cgo will pass to the compiler when compiling - C++ code. - CGO_LDFLAGS - Flags that cgo will pass to the compiler when linking. - CXX - The command to use to compile C++ code. - -Architecture-specific environment variables: - - GOARM - For GOARCH=arm, the ARM architecture for which to compile. - Valid values are 5, 6, 7. - GO386 - For GOARCH=386, the floating point instruction set. - Valid values are 387, sse2. - -Special-purpose environment variables: - - GOROOT_FINAL - The root of the installed Go tree, when it is - installed in a location other than where it is built. - File names in stack traces are rewritten from GOROOT to - GOROOT_FINAL. - GO15VENDOREXPERIMENT - Set to 1 to enable the Go 1.5 vendoring experiment. - GO_EXTLINK_ENABLED - Whether the linker should use external linking mode - when using -linkmode=auto with code that uses cgo. - Set to 0 to disable external linking mode, 1 to enable it. - - -Import path syntax - -An import path (see 'go help packages') denotes a package -stored in the local file system. In general, an import path denotes -either a standard package (such as "unicode/utf8") or a package -found in one of the work spaces (see 'go help gopath'). - -Relative import paths - -An import path beginning with ./ or ../ is called a relative path. -The toolchain supports relative import paths as a shortcut in two ways. - -First, a relative path can be used as a shorthand on the command line. -If you are working in the directory containing the code imported as -"unicode" and want to run the tests for "unicode/utf8", you can type -"go test ./utf8" instead of needing to specify the full path. -Similarly, in the reverse situation, "go test .." will test "unicode" from -the "unicode/utf8" directory. Relative patterns are also allowed, like -"go test ./..." to test all subdirectories. See 'go help packages' for details -on the pattern syntax. - -Second, if you are compiling a Go program not in a work space, -you can use a relative path in an import statement in that program -to refer to nearby code also not in a work space. -This makes it easy to experiment with small multipackage programs -outside of the usual work spaces, but such programs cannot be -installed with "go install" (there is no work space in which to install them), -so they are rebuilt from scratch each time they are built. -To avoid ambiguity, Go programs cannot use relative import paths -within a work space. - -Remote import paths - -Certain import paths also -describe how to obtain the source code for the package using -a revision control system. - -A few common code hosting sites have special syntax: - - Bitbucket (Git, Mercurial) - - import "bitbucket.org/user/project" - import "bitbucket.org/user/project/sub/directory" - - GitHub (Git) - - import "github.com/user/project" - import "github.com/user/project/sub/directory" - - Google Code Project Hosting (Git, Mercurial, Subversion) - - import "code.google.com/p/project" - import "code.google.com/p/project/sub/directory" - - import "code.google.com/p/project.subrepository" - import "code.google.com/p/project.subrepository/sub/directory" - - Launchpad (Bazaar) - - import "launchpad.net/project" - import "launchpad.net/project/series" - import "launchpad.net/project/series/sub/directory" - - import "launchpad.net/~user/project/branch" - import "launchpad.net/~user/project/branch/sub/directory" - - IBM DevOps Services (Git) - - import "hub.jazz.net/git/user/project" - import "hub.jazz.net/git/user/project/sub/directory" - -For code hosted on other servers, import paths may either be qualified -with the version control type, or the go tool can dynamically fetch -the import path over https/http and discover where the code resides -from a tag in the HTML. - -To declare the code location, an import path of the form - - repository.vcs/path - -specifies the given repository, with or without the .vcs suffix, -using the named version control system, and then the path inside -that repository. The supported version control systems are: - - Bazaar .bzr - Git .git - Mercurial .hg - Subversion .svn - -For example, - - import "example.org/user/foo.hg" - -denotes the root directory of the Mercurial repository at -example.org/user/foo or foo.hg, and - - import "example.org/repo.git/foo/bar" - -denotes the foo/bar directory of the Git repository at -example.org/repo or repo.git. - -When a version control system supports multiple protocols, -each is tried in turn when downloading. For example, a Git -download tries https://, then git+ssh://. - -If the import path is not a known code hosting site and also lacks a -version control qualifier, the go tool attempts to fetch the import -over https/http and looks for a tag in the document's HTML -. - -The meta tag has the form: - - - -The import-prefix is the import path corresponding to the repository -root. It must be a prefix or an exact match of the package being -fetched with "go get". If it's not an exact match, another http -request is made at the prefix to verify the tags match. - -The meta tag should appear as early in the file as possible. -In particular, it should appear before any raw JavaScript or CSS, -to avoid confusing the go command's restricted parser. - -The vcs is one of "git", "hg", "svn", etc, - -The repo-root is the root of the version control system -containing a scheme and not containing a .vcs qualifier. - -For example, - - import "example.org/pkg/foo" - -will result in the following requests: - - https://example.org/pkg/foo?go-get=1 (preferred) - http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure) - -If that page contains the meta tag - - - -the go tool will verify that https://example.org/?go-get=1 contains the -same meta tag and then git clone https://code.org/r/p/exproj into -GOPATH/src/example.org. - -New downloaded packages are written to the first directory -listed in the GOPATH environment variable (see 'go help gopath'). - -The go command attempts to download the version of the -package appropriate for the Go release being used. -Run 'go help get' for more. - -Import path checking - -When the custom import path feature described above redirects to a -known code hosting site, each of the resulting packages has two possible -import paths, using the custom domain or the known hosting site. - -A package statement is said to have an "import comment" if it is immediately -followed (before the next newline) by a comment of one of these two forms: - - package math // import "path" - package math /* import "path" * / - -The go command will refuse to install a package with an import comment -unless it is being referred to by that import path. In this way, import comments -let package authors make sure the custom import path is used and not a -direct path to the underlying code hosting site. - -If the vendoring experiment is enabled (see 'go help gopath'), -then import path checking is disabled for code found within vendor trees. -This makes it possible to copy code into alternate locations in vendor trees -without needing to update import comments. - -See https://golang.org/s/go14customimport for details. - - -Description of package lists - -Many commands apply to a set of packages: - - go action [packages] - -Usually, [packages] is a list of import paths. - -An import path that is a rooted path or that begins with -a . or .. element is interpreted as a file system path and -denotes the package in that directory. - -Otherwise, the import path P denotes the package found in -the directory DIR/src/P for some DIR listed in the GOPATH -environment variable (see 'go help gopath'). - -If no import paths are given, the action applies to the -package in the current directory. - -There are four reserved names for paths that should not be used -for packages to be built with the go tool: - -- "main" denotes the top-level package in a stand-alone executable. - -- "all" expands to all package directories found in all the GOPATH -trees. For example, 'go list all' lists all the packages on the local -system. - -- "std" is like all but expands to just the packages in the standard -Go library. - -- "cmd" expands to the Go repository's commands and their -internal libraries. - -An import path is a pattern if it includes one or more "..." wildcards, -each of which can match any string, including the empty string and -strings containing slashes. Such a pattern expands to all package -directories found in the GOPATH trees with names matching the -patterns. As a special case, x/... matches x as well as x's subdirectories. -For example, net/... expands to net and packages in its subdirectories. - -An import path can also name a package to be downloaded from -a remote repository. Run 'go help importpath' for details. - -Every package in a program must have a unique import path. -By convention, this is arranged by starting each path with a -unique prefix that belongs to you. For example, paths used -internally at Google all begin with 'google', and paths -denoting remote repositories begin with the path to the code, -such as 'github.com/user/repo'. - -As a special case, if the package list is a list of .go files from a -single directory, the command is applied to a single synthesized -package made up of exactly those files, ignoring any build constraints -in those files and ignoring any other files in the directory. - -Directory and file names that begin with "." or "_" are ignored -by the go tool, as are directories named "testdata". - - -Description of testing flags - -The 'go test' command takes both flags that apply to 'go test' itself -and flags that apply to the resulting test binary. - -Several of the flags control profiling and write an execution profile -suitable for "go tool pprof"; run "go tool pprof -h" for more -information. The --alloc_space, --alloc_objects, and --show_bytes -options of pprof control how the information is presented. - -The following flags are recognized by the 'go test' command and -control the execution of any test: - - -bench regexp - Run benchmarks matching the regular expression. - By default, no benchmarks run. To run all benchmarks, - use '-bench .' or '-bench=.'. - - -benchmem - Print memory allocation statistics for benchmarks. - - -benchtime t - Run enough iterations of each benchmark to take t, specified - as a time.Duration (for example, -benchtime 1h30s). - The default is 1 second (1s). - - -blockprofile block.out - Write a goroutine blocking profile to the specified file - when all tests are complete. - Writes test binary as -c would. - - -blockprofilerate n - Control the detail provided in goroutine blocking profiles by - calling runtime.SetBlockProfileRate with n. - See 'go doc runtime.SetBlockProfileRate'. - The profiler aims to sample, on average, one blocking event every - n nanoseconds the program spends blocked. By default, - if -test.blockprofile is set without this flag, all blocking events - are recorded, equivalent to -test.blockprofilerate=1. - - -count n - Run each test and benchmark n times (default 1). - If -cpu is set, run n times for each GOMAXPROCS value. - Examples are always run once. - - -cover - Enable coverage analysis. - - -covermode set,count,atomic - Set the mode for coverage analysis for the package[s] - being tested. The default is "set" unless -race is enabled, - in which case it is "atomic". - The values: - set: bool: does this statement run? - count: int: how many times does this statement run? - atomic: int: count, but correct in multithreaded tests; - significantly more expensive. - Sets -cover. - - -coverpkg pkg1,pkg2,pkg3 - Apply coverage analysis in each test to the given list of packages. - The default is for each test to analyze only the package being tested. - Packages are specified as import paths. - Sets -cover. - - -coverprofile cover.out - Write a coverage profile to the file after all tests have passed. - Sets -cover. - - -cpu 1,2,4 - Specify a list of GOMAXPROCS values for which the tests or - benchmarks should be executed. The default is the current value - of GOMAXPROCS. - - -cpuprofile cpu.out - Write a CPU profile to the specified file before exiting. - Writes test binary as -c would. - - -memprofile mem.out - Write a memory profile to the file after all tests have passed. - Writes test binary as -c would. - - -memprofilerate n - Enable more precise (and expensive) memory profiles by setting - runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'. - To profile all memory allocations, use -test.memprofilerate=1 - and pass --alloc_space flag to the pprof tool. - - -outputdir directory - Place output files from profiling in the specified directory, - by default the directory in which "go test" is running. - - -parallel n - Allow parallel execution of test functions that call t.Parallel. - The value of this flag is the maximum number of tests to run - simultaneously; by default, it is set to the value of GOMAXPROCS. - - -run regexp - Run only those tests and examples matching the regular - expression. - - -short - Tell long-running tests to shorten their run time. - It is off by default but set during all.bash so that installing - the Go tree can run a sanity check but not spend time running - exhaustive tests. - - -timeout t - If a test runs longer than t, panic. - The default is 10 minutes (10m). - - -trace trace.out - Write an execution trace to the specified file before exiting. - Writes test binary as -c would. - - -v - Verbose output: log all tests as they are run. Also print all - text from Log and Logf calls even if the test succeeds. - -The test binary, called pkg.test where pkg is the name of the -directory containing the package sources, can be invoked directly -after building it with 'go test -c'. When invoking the test binary -directly, each of the standard flag names must be prefixed with 'test.', -as in -test.run=TestMyFunc or -test.v. - -When running 'go test', flags not listed above are passed through -unaltered. For instance, the command - - go test -x -v -cpuprofile=prof.out -dir=testdata -update - -will compile the test binary and then run it as - - pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update - -The test flags that generate profiles (other than for coverage) also -leave the test binary in pkg.test for use when analyzing the profiles. - -Flags not recognized by 'go test' must be placed after any specified packages. - - -Description of testing functions - -The 'go test' command expects to find test, benchmark, and example functions -in the "*_test.go" files corresponding to the package under test. - -A test function is one named TestXXX (where XXX is any alphanumeric string -not starting with a lower case letter) and should have the signature, - - func TestXXX(t *testing.T) { ... } - -A benchmark function is one named BenchmarkXXX and should have the signature, - - func BenchmarkXXX(b *testing.B) { ... } - -An example function is similar to a test function but, instead of using -*testing.T to report success or failure, prints output to os.Stdout. -That output is compared against the function's "Output:" comment, which -must be the last comment in the function body (see example below). An -example with no such comment, or with no text after "Output:" is compiled -but not executed. - -Godoc displays the body of ExampleXXX to demonstrate the use -of the function, constant, or variable XXX. An example of a method M with -receiver type T or *T is named ExampleT_M. There may be multiple examples -for a given function, constant, or variable, distinguished by a trailing _xxx, -where xxx is a suffix not beginning with an upper case letter. - -Here is an example of an example: - - func ExamplePrintln() { - Println("The output of\nthis example.") - // Output: The output of - // this example. - } - -The entire test file is presented as the example when it contains a single -example function, at least one other function, type, variable, or constant -declaration, and no test or benchmark functions. - -See the documentation of the testing package for more information. - - -*/ -package main diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/bootstrap.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/bootstrap.go deleted file mode 100644 index 1686df77afd863914fcfc04d8ceab716db357276..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/bootstrap.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build cmd_go_bootstrap - -// This code is compiled only into the bootstrap 'go' binary. -// These stubs avoid importing packages with large dependency -// trees, like the use of "net/http" in vcs.go. - -package main - -import ( - "errors" - "io" -) - -var errHTTP = errors.New("no http in bootstrap go command") - -type httpError struct { - statusCode int -} - -func (e *httpError) Error() string { - panic("unreachable") -} - -func httpGET(url string) ([]byte, error) { - return nil, errHTTP -} - -func httpsOrHTTP(importPath string, security securityMode) (string, io.ReadCloser, error) { - return "", nil, errHTTP -} - -func parseMetaGoImports(r io.Reader) ([]metaImport, error) { - panic("unreachable") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/build.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/build.go deleted file mode 100644 index 865871c5314a7e82860c8fa95c2da1c602f6c6d3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/build.go +++ /dev/null @@ -1,3370 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bufio" - "bytes" - "container/heap" - "debug/elf" - "errors" - "flag" - "fmt" - "go/build" - "io" - "io/ioutil" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "regexp" - "runtime" - "strconv" - "strings" - "sync" - "time" -) - -var cmdBuild = &Command{ - UsageLine: "build [-o output] [-i] [build flags] [packages]", - Short: "compile packages and dependencies", - Long: ` -Build compiles the packages named by the import paths, -along with their dependencies, but it does not install the results. - -If the arguments to build are a list of .go files, build treats -them as a list of source files specifying a single package. - -When compiling a single main package, build writes -the resulting executable to an output file named after -the first source file ('go build ed.go rx.go' writes 'ed' or 'ed.exe') -or the source code directory ('go build unix/sam' writes 'sam' or 'sam.exe'). -The '.exe' suffix is added when writing a Windows executable. - -When compiling multiple packages or a single non-main package, -build compiles the packages but discards the resulting object, -serving only as a check that the packages can be built. - -The -o flag, only allowed when compiling a single package, -forces build to write the resulting executable or object -to the named output file, instead of the default behavior described -in the last two paragraphs. - -The -i flag installs the packages that are dependencies of the target. - -The build flags are shared by the build, clean, get, install, list, run, -and test commands: - - -a - force rebuilding of packages that are already up-to-date. - -n - print the commands but do not run them. - -p n - the number of builds that can be run in parallel. - The default is the number of CPUs available, except - on darwin/arm which defaults to 1. - -race - enable data race detection. - Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64. - -v - print the names of packages as they are compiled. - -work - print the name of the temporary work directory and - do not delete it when exiting. - -x - print the commands. - - -asmflags 'flag list' - arguments to pass on each go tool asm invocation. - -buildmode mode - build mode to use. See 'go help buildmode' for more. - -compiler name - name of compiler to use, as in runtime.Compiler (gccgo or gc). - -gccgoflags 'arg list' - arguments to pass on each gccgo compiler/linker invocation. - -gcflags 'arg list' - arguments to pass on each go tool compile invocation. - -installsuffix suffix - a suffix to use in the name of the package installation directory, - in order to keep output separate from default builds. - If using the -race flag, the install suffix is automatically set to race - or, if set explicitly, has _race appended to it. Using a -buildmode - option that requires non-default compile flags has a similar effect. - -ldflags 'flag list' - arguments to pass on each go tool link invocation. - -linkshared - link against shared libraries previously created with - -buildmode=shared - -pkgdir dir - install and load all packages from dir instead of the usual locations. - For example, when building with a non-standard configuration, - use -pkgdir to keep generated packages in a separate location. - -tags 'tag list' - a list of build tags to consider satisfied during the build. - For more information about build tags, see the description of - build constraints in the documentation for the go/build package. - -toolexec 'cmd args' - a program to use to invoke toolchain programs like vet and asm. - For example, instead of running asm, the go command will run - 'cmd args /path/to/asm '. - -The list flags accept a space-separated list of strings. To embed spaces -in an element in the list, surround it with either single or double quotes. - -For more about specifying packages, see 'go help packages'. -For more about where packages and binaries are installed, -run 'go help gopath'. -For more about calling between Go and C/C++, run 'go help c'. - -Note: Build adheres to certain conventions such as those described -by 'go help gopath'. Not all projects can follow these conventions, -however. Installations that have their own conventions or that use -a separate software build system may choose to use lower-level -invocations such as 'go tool compile' and 'go tool link' to avoid -some of the overheads and design decisions of the build tool. - -See also: go install, go get, go clean. - `, -} - -func init() { - // break init cycle - cmdBuild.Run = runBuild - cmdInstall.Run = runInstall - - cmdBuild.Flag.BoolVar(&buildI, "i", false, "") - - addBuildFlags(cmdBuild) - addBuildFlags(cmdInstall) - - if buildContext.GOOS == "darwin" { - switch buildContext.GOARCH { - case "arm", "arm64": - // darwin/arm cannot run multiple tests simultaneously. - // Parallelism is limited in go_darwin_arm_exec, but - // also needs to be limited here so go test std does not - // timeout tests that waiting to run. - buildP = 1 - } - } -} - -// Flags set by multiple commands. -var buildA bool // -a flag -var buildN bool // -n flag -var buildP = runtime.NumCPU() // -p flag -var buildV bool // -v flag -var buildX bool // -x flag -var buildI bool // -i flag -var buildO = cmdBuild.Flag.String("o", "", "output file") -var buildWork bool // -work flag -var buildAsmflags []string // -asmflags flag -var buildGcflags []string // -gcflags flag -var buildLdflags []string // -ldflags flag -var buildGccgoflags []string // -gccgoflags flag -var buildRace bool // -race flag -var buildToolExec []string // -toolexec flag -var buildBuildmode string // -buildmode flag -var buildLinkshared bool // -linkshared flag -var buildPkgdir string // -pkgdir flag - -// Require the source for go std packages -var reqStdPkgSrc bool -var buildContext = build.Default -var buildToolchain toolchain = noToolchain{} -var ldBuildmode string - -// buildCompiler implements flag.Var. -// It implements Set by updating both -// buildToolchain and buildContext.Compiler. -type buildCompiler struct{} - -func (c buildCompiler) Set(value string) error { - switch value { - case "gc": - buildToolchain = gcToolchain{} - case "gccgo": - buildToolchain = gccgoToolchain{} - default: - return fmt.Errorf("unknown compiler %q", value) - } - buildContext.Compiler = value - return nil -} - -func (c buildCompiler) String() string { - return buildContext.Compiler -} - -func init() { - switch build.Default.Compiler { - case "gc": - buildToolchain = gcToolchain{} - case "gccgo": - buildToolchain = gccgoToolchain{} - } -} - -// addBuildFlags adds the flags common to the build, clean, get, -// install, list, run, and test commands. -func addBuildFlags(cmd *Command) { - cmd.Flag.BoolVar(&buildA, "a", false, "") - cmd.Flag.BoolVar(&buildN, "n", false, "") - cmd.Flag.IntVar(&buildP, "p", buildP, "") - cmd.Flag.BoolVar(&buildV, "v", false, "") - cmd.Flag.BoolVar(&buildX, "x", false, "") - - cmd.Flag.Var((*stringsFlag)(&buildAsmflags), "asmflags", "") - cmd.Flag.Var(buildCompiler{}, "compiler", "") - cmd.Flag.StringVar(&buildBuildmode, "buildmode", "default", "") - cmd.Flag.Var((*stringsFlag)(&buildGcflags), "gcflags", "") - cmd.Flag.Var((*stringsFlag)(&buildGccgoflags), "gccgoflags", "") - cmd.Flag.StringVar(&buildContext.InstallSuffix, "installsuffix", "", "") - cmd.Flag.Var((*stringsFlag)(&buildLdflags), "ldflags", "") - cmd.Flag.BoolVar(&buildLinkshared, "linkshared", false, "") - cmd.Flag.StringVar(&buildPkgdir, "pkgdir", "", "") - cmd.Flag.BoolVar(&buildRace, "race", false, "") - cmd.Flag.Var((*stringsFlag)(&buildContext.BuildTags), "tags", "") - cmd.Flag.Var((*stringsFlag)(&buildToolExec), "toolexec", "") - cmd.Flag.BoolVar(&buildWork, "work", false, "") - switch build.Default.Compiler { - case "gc": - reqStdPkgSrc = true - case "gccgo": - reqStdPkgSrc = false - } -} - -func addBuildFlagsNX(cmd *Command) { - cmd.Flag.BoolVar(&buildN, "n", false, "") - cmd.Flag.BoolVar(&buildX, "x", false, "") -} - -func isSpaceByte(c byte) bool { - return c == ' ' || c == '\t' || c == '\n' || c == '\r' -} - -// fileExtSplit expects a filename and returns the name -// and ext (without the dot). If the file has no -// extension, ext will be empty. -func fileExtSplit(file string) (name, ext string) { - dotExt := filepath.Ext(file) - name = file[:len(file)-len(dotExt)] - if dotExt != "" { - ext = dotExt[1:] - } - return -} - -type stringsFlag []string - -func (v *stringsFlag) Set(s string) error { - var err error - *v, err = splitQuotedFields(s) - if *v == nil { - *v = []string{} - } - return err -} - -func splitQuotedFields(s string) ([]string, error) { - // Split fields allowing '' or "" around elements. - // Quotes further inside the string do not count. - var f []string - for len(s) > 0 { - for len(s) > 0 && isSpaceByte(s[0]) { - s = s[1:] - } - if len(s) == 0 { - break - } - // Accepted quoted string. No unescaping inside. - if s[0] == '"' || s[0] == '\'' { - quote := s[0] - s = s[1:] - i := 0 - for i < len(s) && s[i] != quote { - i++ - } - if i >= len(s) { - return nil, fmt.Errorf("unterminated %c string", quote) - } - f = append(f, s[:i]) - s = s[i+1:] - continue - } - i := 0 - for i < len(s) && !isSpaceByte(s[i]) { - i++ - } - f = append(f, s[:i]) - s = s[i:] - } - return f, nil -} - -func (v *stringsFlag) String() string { - return "" -} - -func pkgsMain(pkgs []*Package) (res []*Package) { - for _, p := range pkgs { - if p.Name == "main" { - res = append(res, p) - } - } - return res -} - -func pkgsNotMain(pkgs []*Package) (res []*Package) { - for _, p := range pkgs { - if p.Name != "main" { - res = append(res, p) - } - } - return res -} - -var pkgsFilter = func(pkgs []*Package) []*Package { return pkgs } - -func buildModeInit() { - _, gccgo := buildToolchain.(gccgoToolchain) - var codegenArg string - platform := goos + "/" + goarch - switch buildBuildmode { - case "archive": - pkgsFilter = pkgsNotMain - case "c-archive": - pkgsFilter = func(p []*Package) []*Package { - if len(p) != 1 || p[0].Name != "main" { - fatalf("-buildmode=c-archive requires exactly one main package") - } - return p - } - exeSuffix = ".a" - ldBuildmode = "c-archive" - case "c-shared": - pkgsFilter = pkgsMain - if gccgo { - codegenArg = "-fPIC" - } else { - switch platform { - case "linux/amd64": - codegenArg = "-shared" - case "linux/arm": - buildAsmflags = append(buildAsmflags, "-shared") - case "darwin/amd64": - case "android/arm": - default: - fatalf("-buildmode=c-shared not supported on %s\n", platform) - } - } - ldBuildmode = "c-shared" - case "default": - ldBuildmode = "exe" - case "exe": - pkgsFilter = pkgsMain - ldBuildmode = "exe" - case "shared": - pkgsFilter = pkgsNotMain - if gccgo { - codegenArg = "-fPIC" - } else { - switch platform { - case "linux/amd64": - default: - fatalf("-buildmode=shared not supported on %s\n", platform) - } - codegenArg = "-dynlink" - } - if *buildO != "" { - fatalf("-buildmode=shared and -o not supported together") - } - ldBuildmode = "shared" - default: - fatalf("buildmode=%s not supported", buildBuildmode) - } - if buildLinkshared { - if gccgo { - codegenArg = "-fPIC" - } else { - if platform != "linux/amd64" { - fmt.Fprintf(os.Stderr, "go %s: -linkshared is only supported on linux/amd64\n", flag.Args()[0]) - os.Exit(2) - } - codegenArg = "-dynlink" - // TODO(mwhudson): remove -w when that gets fixed in linker. - buildLdflags = append(buildLdflags, "-linkshared", "-w") - } - } - if codegenArg != "" { - if gccgo { - buildGccgoflags = append(buildGccgoflags, codegenArg) - } else { - buildAsmflags = append(buildAsmflags, codegenArg) - buildGcflags = append(buildGcflags, codegenArg) - } - if buildContext.InstallSuffix != "" { - buildContext.InstallSuffix += "_" - } - buildContext.InstallSuffix += codegenArg[1:] - } -} - -func runBuild(cmd *Command, args []string) { - raceInit() - buildModeInit() - var b builder - b.init() - - pkgs := packagesForBuild(args) - - if len(pkgs) == 1 && pkgs[0].Name == "main" && *buildO == "" { - _, *buildO = path.Split(pkgs[0].ImportPath) - *buildO += exeSuffix - } - - // sanity check some often mis-used options - switch buildContext.Compiler { - case "gccgo": - if len(buildGcflags) != 0 { - fmt.Println("go build: when using gccgo toolchain, please pass compiler flags using -gccgoflags, not -gcflags") - } - if len(buildLdflags) != 0 { - fmt.Println("go build: when using gccgo toolchain, please pass linker flags using -gccgoflags, not -ldflags") - } - case "gc": - if len(buildGccgoflags) != 0 { - fmt.Println("go build: when using gc toolchain, please pass compile flags using -gcflags, and linker flags using -ldflags") - } - } - - depMode := modeBuild - if buildI { - depMode = modeInstall - } - - if *buildO != "" { - if len(pkgs) > 1 { - fatalf("go build: cannot use -o with multiple packages") - } else if len(pkgs) == 0 { - fatalf("no packages to build") - } - p := pkgs[0] - p.target = *buildO - p.Stale = true // must build - not up to date - a := b.action(modeInstall, depMode, p) - b.do(a) - return - } - - var a *action - if buildBuildmode == "shared" { - a = b.libaction(libname(args), pkgsFilter(packages(args)), modeBuild, depMode) - } else { - a = &action{} - for _, p := range pkgsFilter(packages(args)) { - a.deps = append(a.deps, b.action(modeBuild, depMode, p)) - } - } - b.do(a) -} - -var cmdInstall = &Command{ - UsageLine: "install [build flags] [packages]", - Short: "compile and install packages and dependencies", - Long: ` -Install compiles and installs the packages named by the import paths, -along with their dependencies. - -For more about the build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. - -See also: go build, go get, go clean. - `, -} - -// libname returns the filename to use for the shared library when using -// -buildmode=shared. The rules we use are: -// 1) Drop any trailing "/..."s if present -// 2) Change / to - -// 3) Join arguments with , -// So std -> libstd.so -// a b/... -> liba,b.so -// gopkg.in/tomb.v2 -> libgopkg.in-tomb.v2.so -func libname(args []string) string { - var libname string - for _, arg := range args { - arg = strings.TrimSuffix(arg, "/...") - arg = strings.Replace(arg, "/", "-", -1) - if libname == "" { - libname = arg - } else { - libname += "," + arg - } - } - // TODO(mwhudson): Needs to change for platforms that use different naming - // conventions... - return "lib" + libname + ".so" -} - -func runInstall(cmd *Command, args []string) { - raceInit() - buildModeInit() - pkgs := pkgsFilter(packagesForBuild(args)) - - for _, p := range pkgs { - if p.Target == "" && (!p.Standard || p.ImportPath != "unsafe") { - switch { - case p.gobinSubdir: - errorf("go install: cannot install cross-compiled binaries when GOBIN is set") - case p.cmdline: - errorf("go install: no install location for .go files listed on command line (GOBIN not set)") - case p.ConflictDir != "": - errorf("go install: no install location for %s: hidden by %s", p.Dir, p.ConflictDir) - default: - errorf("go install: no install location for directory %s outside GOPATH\n"+ - "\tFor more details see: go help gopath", p.Dir) - } - } - } - exitIfErrors() - - var b builder - b.init() - var a *action - if buildBuildmode == "shared" { - a = b.libaction(libname(args), pkgs, modeInstall, modeInstall) - } else { - a = &action{} - var tools []*action - for _, p := range pkgs { - // If p is a tool, delay the installation until the end of the build. - // This avoids installing assemblers/compilers that are being executed - // by other steps in the build. - // cmd/cgo is handled specially in b.action, so that we can - // both build and use it in the same 'go install'. - action := b.action(modeInstall, modeInstall, p) - if goTools[p.ImportPath] == toTool && p.ImportPath != "cmd/cgo" { - a.deps = append(a.deps, action.deps...) - action.deps = append(action.deps, a) - tools = append(tools, action) - continue - } - a.deps = append(a.deps, action) - } - if len(tools) > 0 { - a = &action{ - deps: tools, - } - } - } - b.do(a) - exitIfErrors() - - // Success. If this command is 'go install' with no arguments - // and the current directory (the implicit argument) is a command, - // remove any leftover command binary from a previous 'go build'. - // The binary is installed; it's not needed here anymore. - // And worse it might be a stale copy, which you don't want to find - // instead of the installed one if $PATH contains dot. - // One way to view this behavior is that it is as if 'go install' first - // runs 'go build' and the moves the generated file to the install dir. - // See issue 9645. - if len(args) == 0 && len(pkgs) == 1 && pkgs[0].Name == "main" { - // Compute file 'go build' would have created. - // If it exists and is an executable file, remove it. - _, targ := filepath.Split(pkgs[0].ImportPath) - targ += exeSuffix - if filepath.Join(pkgs[0].Dir, targ) != pkgs[0].Target { // maybe $GOBIN is the current directory - fi, err := os.Stat(targ) - if err == nil { - m := fi.Mode() - if m.IsRegular() { - if m&0111 != 0 || goos == "windows" { // windows never sets executable bit - os.Remove(targ) - } - } - } - } - } -} - -// Global build parameters (used during package load) -var ( - goarch string - goos string - exeSuffix string -) - -func init() { - goarch = buildContext.GOARCH - goos = buildContext.GOOS - if goos == "windows" { - exeSuffix = ".exe" - } -} - -// A builder holds global state about a build. -// It does not hold per-package state, because we -// build packages in parallel, and the builder is shared. -type builder struct { - work string // the temporary work directory (ends in filepath.Separator) - actionCache map[cacheKey]*action // a cache of already-constructed actions - mkdirCache map[string]bool // a cache of created directories - print func(args ...interface{}) (int, error) - - output sync.Mutex - scriptDir string // current directory in printed script - - exec sync.Mutex - readySema chan bool - ready actionQueue -} - -// An action represents a single action in the action graph. -type action struct { - p *Package // the package this action works on - deps []*action // actions that must happen before this one - triggers []*action // inverse of deps - cgo *action // action for cgo binary if needed - args []string // additional args for runProgram - testOutput *bytes.Buffer // test output buffer - - f func(*builder, *action) error // the action itself (nil = no-op) - ignoreFail bool // whether to run f even if dependencies fail - - // Generated files, directories. - link bool // target is executable, not just package - pkgdir string // the -I or -L argument to use when importing this package - objdir string // directory for intermediate objects - objpkg string // the intermediate package .a file created during the action - target string // goal of the action: the created package or executable - - // Execution state. - pending int // number of deps yet to complete - priority int // relative execution priority - failed bool // whether the action failed -} - -// cacheKey is the key for the action cache. -type cacheKey struct { - mode buildMode - p *Package - shlib string -} - -// buildMode specifies the build mode: -// are we just building things or also installing the results? -type buildMode int - -const ( - modeBuild buildMode = iota - modeInstall -) - -var ( - goroot = filepath.Clean(runtime.GOROOT()) - gobin = os.Getenv("GOBIN") - gorootBin = filepath.Join(goroot, "bin") - gorootPkg = filepath.Join(goroot, "pkg") - gorootSrc = filepath.Join(goroot, "src") -) - -func (b *builder) init() { - var err error - b.print = func(a ...interface{}) (int, error) { - return fmt.Fprint(os.Stderr, a...) - } - b.actionCache = make(map[cacheKey]*action) - b.mkdirCache = make(map[string]bool) - - if buildN { - b.work = "$WORK" - } else { - b.work, err = ioutil.TempDir("", "go-build") - if err != nil { - fatalf("%s", err) - } - if buildX || buildWork { - fmt.Fprintf(os.Stderr, "WORK=%s\n", b.work) - } - if !buildWork { - workdir := b.work - atexit(func() { os.RemoveAll(workdir) }) - } - } -} - -// goFilesPackage creates a package for building a collection of Go files -// (typically named on the command line). The target is named p.a for -// package p or named after the first Go file for package main. -func goFilesPackage(gofiles []string) *Package { - // TODO: Remove this restriction. - for _, f := range gofiles { - if !strings.HasSuffix(f, ".go") { - fatalf("named files must be .go files") - } - } - - var stk importStack - ctxt := buildContext - ctxt.UseAllFiles = true - - // Synthesize fake "directory" that only shows the named files, - // to make it look like this is a standard package or - // command directory. So that local imports resolve - // consistently, the files must all be in the same directory. - var dirent []os.FileInfo - var dir string - for _, file := range gofiles { - fi, err := os.Stat(file) - if err != nil { - fatalf("%s", err) - } - if fi.IsDir() { - fatalf("%s is a directory, should be a Go file", file) - } - dir1, _ := filepath.Split(file) - if dir1 == "" { - dir1 = "./" - } - if dir == "" { - dir = dir1 - } else if dir != dir1 { - fatalf("named files must all be in one directory; have %s and %s", dir, dir1) - } - dirent = append(dirent, fi) - } - ctxt.ReadDir = func(string) ([]os.FileInfo, error) { return dirent, nil } - - var err error - if dir == "" { - dir = cwd - } - dir, err = filepath.Abs(dir) - if err != nil { - fatalf("%s", err) - } - - bp, err := ctxt.ImportDir(dir, 0) - pkg := new(Package) - pkg.local = true - pkg.cmdline = true - pkg.load(&stk, bp, err) - pkg.localPrefix = dirToImportPath(dir) - pkg.ImportPath = "command-line-arguments" - pkg.target = "" - - if pkg.Name == "main" { - _, elem := filepath.Split(gofiles[0]) - exe := elem[:len(elem)-len(".go")] + exeSuffix - if *buildO == "" { - *buildO = exe - } - if gobin != "" { - pkg.target = filepath.Join(gobin, exe) - } - } - - pkg.Target = pkg.target - pkg.Stale = true - - computeStale(pkg) - return pkg -} - -// readpkglist returns the list of packages that were built into the shared library -// at shlibpath. For the native toolchain this list is stored, newline separated, in -// an ELF note with name "Go\x00\x00" and type 1. For GCCGO it is extracted from the -// .go_export section. -func readpkglist(shlibpath string) (pkgs []*Package) { - var stk importStack - if _, gccgo := buildToolchain.(gccgoToolchain); gccgo { - f, _ := elf.Open(shlibpath) - sect := f.Section(".go_export") - data, _ := sect.Data() - scanner := bufio.NewScanner(bytes.NewBuffer(data)) - for scanner.Scan() { - t := scanner.Text() - if strings.HasPrefix(t, "pkgpath ") { - t = strings.TrimPrefix(t, "pkgpath ") - t = strings.TrimSuffix(t, ";") - pkgs = append(pkgs, loadPackage(t, &stk)) - } - } - } else { - pkglistbytes, err := readELFNote(shlibpath, "Go\x00\x00", 1) - if err != nil { - fatalf("readELFNote failed: %v", err) - } - scanner := bufio.NewScanner(bytes.NewBuffer(pkglistbytes)) - for scanner.Scan() { - t := scanner.Text() - pkgs = append(pkgs, loadPackage(t, &stk)) - } - } - return -} - -// action returns the action for applying the given operation (mode) to the package. -// depMode is the action to use when building dependencies. -// action never looks for p in a shared library. -func (b *builder) action(mode buildMode, depMode buildMode, p *Package) *action { - return b.action1(mode, depMode, p, false) -} - -// action1 returns the action for applying the given operation (mode) to the package. -// depMode is the action to use when building dependencies. -// action1 will look for p in a shared library if lookshared is true. -func (b *builder) action1(mode buildMode, depMode buildMode, p *Package, lookshared bool) *action { - shlib := "" - if lookshared { - shlib = p.Shlib - } - key := cacheKey{mode, p, shlib} - - a := b.actionCache[key] - if a != nil { - return a - } - if shlib != "" { - key2 := cacheKey{modeInstall, nil, shlib} - a = b.actionCache[key2] - if a != nil { - b.actionCache[key] = a - return a - } - pkgs := readpkglist(shlib) - a = b.libaction(filepath.Base(shlib), pkgs, modeInstall, depMode) - b.actionCache[key2] = a - b.actionCache[key] = a - return a - } - - a = &action{p: p, pkgdir: p.build.PkgRoot} - if p.pkgdir != "" { // overrides p.t - a.pkgdir = p.pkgdir - } - b.actionCache[key] = a - - for _, p1 := range p.imports { - ls := buildLinkshared - // If p1 is part of the same shared library as p, we need the action - // that builds p here, not the shared libary or we get action loops. - if p1.Shlib == p.Shlib { - ls = false - } - a.deps = append(a.deps, b.action1(depMode, depMode, p1, ls)) - } - - // If we are not doing a cross-build, then record the binary we'll - // generate for cgo as a dependency of the build of any package - // using cgo, to make sure we do not overwrite the binary while - // a package is using it. If this is a cross-build, then the cgo we - // are writing is not the cgo we need to use. - if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace && reqStdPkgSrc { - if (len(p.CgoFiles) > 0 || p.Standard && p.ImportPath == "runtime/cgo") && !buildLinkshared && buildBuildmode != "shared" { - var stk importStack - p1 := loadPackage("cmd/cgo", &stk) - if p1.Error != nil { - fatalf("load cmd/cgo: %v", p1.Error) - } - a.cgo = b.action(depMode, depMode, p1) - a.deps = append(a.deps, a.cgo) - } - } - - if p.Standard { - switch p.ImportPath { - case "builtin", "unsafe": - // Fake packages - nothing to build. - return a - } - // gccgo standard library is "fake" too. - if _, ok := buildToolchain.(gccgoToolchain); ok { - // the target name is needed for cgo. - a.target = p.target - return a - } - } - - if !p.Stale && p.target != "" { - // p.Stale==false implies that p.target is up-to-date. - // Record target name for use by actions depending on this one. - a.target = p.target - return a - } - - if p.local && p.target == "" { - // Imported via local path. No permanent target. - mode = modeBuild - } - work := p.pkgdir - if work == "" { - work = b.work - } - a.objdir = filepath.Join(work, a.p.ImportPath, "_obj") + string(filepath.Separator) - a.objpkg = buildToolchain.pkgpath(work, a.p) - a.link = p.Name == "main" - - switch mode { - case modeInstall: - a.f = (*builder).install - a.deps = []*action{b.action1(modeBuild, depMode, p, lookshared)} - a.target = a.p.target - - // Install header for cgo in c-archive and c-shared modes. - if p.usesCgo() && (buildBuildmode == "c-archive" || buildBuildmode == "c-shared") { - ah := &action{ - p: a.p, - deps: []*action{a.deps[0]}, - f: (*builder).installHeader, - pkgdir: a.pkgdir, - objdir: a.objdir, - target: a.target[:len(a.target)-len(filepath.Ext(a.target))] + ".h", - } - a.deps = append(a.deps, ah) - } - - case modeBuild: - a.f = (*builder).build - a.target = a.objpkg - if a.link { - // An executable file. (This is the name of a temporary file.) - // Because we run the temporary file in 'go run' and 'go test', - // the name will show up in ps listings. If the caller has specified - // a name, use that instead of a.out. The binary is generated - // in an otherwise empty subdirectory named exe to avoid - // naming conflicts. The only possible conflict is if we were - // to create a top-level package named exe. - name := "a.out" - if p.exeName != "" { - name = p.exeName - } else if goos == "darwin" && buildBuildmode == "c-shared" && p.target != "" { - // On OS X, the linker output name gets recorded in the - // shared library's LC_ID_DYLIB load command. - // The code invoking the linker knows to pass only the final - // path element. Arrange that the path element matches what - // we'll install it as; otherwise the library is only loadable as "a.out". - _, name = filepath.Split(p.target) - } - a.target = a.objdir + filepath.Join("exe", name) + exeSuffix - } - } - - return a -} - -func (b *builder) libaction(libname string, pkgs []*Package, mode, depMode buildMode) *action { - a := &action{} - if mode == modeBuild { - a.f = (*builder).linkShared - a.target = filepath.Join(b.work, libname) - for _, p := range pkgs { - if p.target == "" { - continue - } - a.deps = append(a.deps, b.action(depMode, depMode, p)) - } - } else if mode == modeInstall { - // Currently build mode shared forces external linking mode, and - // external linking mode forces an import of runtime/cgo. So if it - // was not passed on the command line and it is not present in - // another shared library, add it here. - seencgo := false - _, gccgo := buildToolchain.(gccgoToolchain) - if !gccgo { - for _, p := range pkgs { - seencgo = seencgo || (p.Standard && p.ImportPath == "runtime/cgo") - } - if !seencgo { - var stk importStack - p := loadPackage("runtime/cgo", &stk) - if p.Error != nil { - fatalf("load runtime/cgo: %v", p.Error) - } - computeStale(p) - // If runtime/cgo is in another shared library, then that's - // also the shared library that contains runtime, so - // something will depend on it and so runtime/cgo's staleness - // will be checked when processing that library. - if p.Shlib == "" || p.Shlib == libname { - pkgs = append([]*Package{}, pkgs...) - pkgs = append(pkgs, p) - } - } - } - - // Figure out where the library will go. - var libdir string - for _, p := range pkgs { - plibdir := p.build.PkgTargetRoot - if gccgo { - plibdir = filepath.Join(plibdir, "shlibs") - } - if libdir == "" { - libdir = plibdir - } else if libdir != plibdir { - fatalf("multiple roots %s & %s", libdir, plibdir) - } - } - a.target = filepath.Join(libdir, libname) - - // Now we can check whether we need to rebuild it. - stale := false - var built time.Time - if fi, err := os.Stat(a.target); err == nil { - built = fi.ModTime() - } - for _, p := range pkgs { - if p.target == "" { - continue - } - stale = stale || p.Stale - lstat, err := os.Stat(p.target) - if err != nil || lstat.ModTime().After(built) { - stale = true - } - a.deps = append(a.deps, b.action(depMode, depMode, p)) - } - - if stale { - a.f = (*builder).install - buildAction := b.libaction(libname, pkgs, modeBuild, depMode) - a.deps = []*action{buildAction} - for _, p := range pkgs { - if p.target == "" { - continue - } - shlibnameaction := &action{} - shlibnameaction.f = (*builder).installShlibname - shlibnameaction.target = p.target[:len(p.target)-2] + ".shlibname" - a.deps = append(a.deps, shlibnameaction) - shlibnameaction.deps = append(shlibnameaction.deps, buildAction) - } - } - } else { - fatalf("unregonized mode %v", mode) - } - return a -} - -// actionList returns the list of actions in the dag rooted at root -// as visited in a depth-first post-order traversal. -func actionList(root *action) []*action { - seen := map[*action]bool{} - all := []*action{} - var walk func(*action) - walk = func(a *action) { - if seen[a] { - return - } - seen[a] = true - for _, a1 := range a.deps { - walk(a1) - } - all = append(all, a) - } - walk(root) - return all -} - -// allArchiveActions returns a list of the archive dependencies of root. -// This is needed because if package p depends on package q that is in libr.so, the -// action graph looks like p->libr.so->q and so just scanning through p's -// dependencies does not find the import dir for q. -func allArchiveActions(root *action) []*action { - seen := map[*action]bool{} - r := []*action{} - var walk func(*action) - walk = func(a *action) { - if seen[a] { - return - } - seen[a] = true - if strings.HasSuffix(a.target, ".so") || a == root { - for _, a1 := range a.deps { - walk(a1) - } - } else if strings.HasSuffix(a.target, ".a") { - r = append(r, a) - } - } - walk(root) - return r -} - -// do runs the action graph rooted at root. -func (b *builder) do(root *action) { - // Build list of all actions, assigning depth-first post-order priority. - // The original implementation here was a true queue - // (using a channel) but it had the effect of getting - // distracted by low-level leaf actions to the detriment - // of completing higher-level actions. The order of - // work does not matter much to overall execution time, - // but when running "go test std" it is nice to see each test - // results as soon as possible. The priorities assigned - // ensure that, all else being equal, the execution prefers - // to do what it would have done first in a simple depth-first - // dependency order traversal. - all := actionList(root) - for i, a := range all { - a.priority = i - } - - b.readySema = make(chan bool, len(all)) - - // Initialize per-action execution state. - for _, a := range all { - for _, a1 := range a.deps { - a1.triggers = append(a1.triggers, a) - } - a.pending = len(a.deps) - if a.pending == 0 { - b.ready.push(a) - b.readySema <- true - } - } - - // Handle runs a single action and takes care of triggering - // any actions that are runnable as a result. - handle := func(a *action) { - var err error - if a.f != nil && (!a.failed || a.ignoreFail) { - err = a.f(b, a) - } - - // The actions run in parallel but all the updates to the - // shared work state are serialized through b.exec. - b.exec.Lock() - defer b.exec.Unlock() - - if err != nil { - if err == errPrintedOutput { - setExitStatus(2) - } else { - errorf("%s", err) - } - a.failed = true - } - - for _, a0 := range a.triggers { - if a.failed { - a0.failed = true - } - if a0.pending--; a0.pending == 0 { - b.ready.push(a0) - b.readySema <- true - } - } - - if a == root { - close(b.readySema) - } - } - - var wg sync.WaitGroup - - // Kick off goroutines according to parallelism. - // If we are using the -n flag (just printing commands) - // drop the parallelism to 1, both to make the output - // deterministic and because there is no real work anyway. - par := buildP - if buildN { - par = 1 - } - for i := 0; i < par; i++ { - wg.Add(1) - go func() { - defer wg.Done() - for { - select { - case _, ok := <-b.readySema: - if !ok { - return - } - // Receiving a value from b.readySema entitles - // us to take from the ready queue. - b.exec.Lock() - a := b.ready.pop() - b.exec.Unlock() - handle(a) - case <-interrupted: - setExitStatus(1) - return - } - } - }() - } - - wg.Wait() -} - -// hasString reports whether s appears in the list of strings. -func hasString(strings []string, s string) bool { - for _, t := range strings { - if s == t { - return true - } - } - return false -} - -// build is the action for building a single package or command. -func (b *builder) build(a *action) (err error) { - // Return an error if the package has CXX files but it's not using - // cgo nor SWIG, since the CXX files can only be processed by cgo - // and SWIG. - if len(a.p.CXXFiles) > 0 && !a.p.usesCgo() && !a.p.usesSwig() { - return fmt.Errorf("can't build package %s because it contains C++ files (%s) but it's not using cgo nor SWIG", - a.p.ImportPath, strings.Join(a.p.CXXFiles, ",")) - } - // Same as above for Objective-C files - if len(a.p.MFiles) > 0 && !a.p.usesCgo() && !a.p.usesSwig() { - return fmt.Errorf("can't build package %s because it contains Objective-C files (%s) but it's not using cgo nor SWIG", - a.p.ImportPath, strings.Join(a.p.MFiles, ",")) - } - defer func() { - if err != nil && err != errPrintedOutput { - err = fmt.Errorf("go build %s: %v", a.p.ImportPath, err) - } - }() - if buildN { - // In -n mode, print a banner between packages. - // The banner is five lines so that when changes to - // different sections of the bootstrap script have to - // be merged, the banners give patch something - // to use to find its context. - fmt.Printf("\n#\n# %s\n#\n\n", a.p.ImportPath) - } - - if buildV { - fmt.Fprintf(os.Stderr, "%s\n", a.p.ImportPath) - } - - if a.p.Standard && a.p.ImportPath == "runtime" && buildContext.Compiler == "gc" && - (!hasString(a.p.GoFiles, "zgoos_"+buildContext.GOOS+".go") || - !hasString(a.p.GoFiles, "zgoarch_"+buildContext.GOARCH+".go")) { - return fmt.Errorf("%s/%s must be bootstrapped using make%v", buildContext.GOOS, buildContext.GOARCH, defaultSuffix()) - } - - // Make build directory. - obj := a.objdir - if err := b.mkdir(obj); err != nil { - return err - } - - // make target directory - dir, _ := filepath.Split(a.target) - if dir != "" { - if err := b.mkdir(dir); err != nil { - return err - } - } - - var gofiles, cgofiles, cfiles, sfiles, cxxfiles, objects, cgoObjects, pcCFLAGS, pcLDFLAGS []string - - gofiles = append(gofiles, a.p.GoFiles...) - cgofiles = append(cgofiles, a.p.CgoFiles...) - cfiles = append(cfiles, a.p.CFiles...) - sfiles = append(sfiles, a.p.SFiles...) - cxxfiles = append(cxxfiles, a.p.CXXFiles...) - - if a.p.usesCgo() || a.p.usesSwig() { - if pcCFLAGS, pcLDFLAGS, err = b.getPkgConfigFlags(a.p); err != nil { - return - } - } - - // Run SWIG on each .swig and .swigcxx file. - // Each run will generate two files, a .go file and a .c or .cxx file. - // The .go file will use import "C" and is to be processed by cgo. - if a.p.usesSwig() { - outGo, outC, outCXX, err := b.swig(a.p, obj, pcCFLAGS) - if err != nil { - return err - } - cgofiles = append(cgofiles, outGo...) - cfiles = append(cfiles, outC...) - cxxfiles = append(cxxfiles, outCXX...) - } - - // Run cgo. - if a.p.usesCgo() || a.p.usesSwig() { - // In a package using cgo, cgo compiles the C, C++ and assembly files with gcc. - // There is one exception: runtime/cgo's job is to bridge the - // cgo and non-cgo worlds, so it necessarily has files in both. - // In that case gcc only gets the gcc_* files. - var gccfiles []string - if a.p.Standard && a.p.ImportPath == "runtime/cgo" { - filter := func(files, nongcc, gcc []string) ([]string, []string) { - for _, f := range files { - if strings.HasPrefix(f, "gcc_") { - gcc = append(gcc, f) - } else { - nongcc = append(nongcc, f) - } - } - return nongcc, gcc - } - cfiles, gccfiles = filter(cfiles, cfiles[:0], gccfiles) - sfiles, gccfiles = filter(sfiles, sfiles[:0], gccfiles) - } else { - gccfiles = append(cfiles, sfiles...) - cfiles = nil - sfiles = nil - } - - cgoExe := tool("cgo") - if a.cgo != nil && a.cgo.target != "" { - cgoExe = a.cgo.target - } - outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles) - if err != nil { - return err - } - cgoObjects = append(cgoObjects, outObj...) - gofiles = append(gofiles, outGo...) - } - - if len(gofiles) == 0 { - return &build.NoGoError{Dir: a.p.Dir} - } - - // If we're doing coverage, preprocess the .go files and put them in the work directory - if a.p.coverMode != "" { - for i, file := range gofiles { - var sourceFile string - var coverFile string - var key string - if strings.HasSuffix(file, ".cgo1.go") { - // cgo files have absolute paths - base := filepath.Base(file) - sourceFile = file - coverFile = filepath.Join(obj, base) - key = strings.TrimSuffix(base, ".cgo1.go") + ".go" - } else { - sourceFile = filepath.Join(a.p.Dir, file) - coverFile = filepath.Join(obj, file) - key = file - } - cover := a.p.coverVars[key] - if cover == nil || isTestFile(file) { - // Not covering this file. - continue - } - if err := b.cover(a, coverFile, sourceFile, 0666, cover.Var); err != nil { - return err - } - gofiles[i] = coverFile - } - } - - // Prepare Go import path list. - inc := b.includeArgs("-I", allArchiveActions(a)) - - // Compile Go. - ofile, out, err := buildToolchain.gc(b, a.p, a.objpkg, obj, len(sfiles) > 0, inc, gofiles) - if len(out) > 0 { - b.showOutput(a.p.Dir, a.p.ImportPath, b.processOutput(out)) - if err != nil { - return errPrintedOutput - } - } - if err != nil { - return err - } - if ofile != a.objpkg { - objects = append(objects, ofile) - } - - // Copy .h files named for goos or goarch or goos_goarch - // to names using GOOS and GOARCH. - // For example, defs_linux_amd64.h becomes defs_GOOS_GOARCH.h. - _goos_goarch := "_" + goos + "_" + goarch - _goos := "_" + goos - _goarch := "_" + goarch - for _, file := range a.p.HFiles { - name, ext := fileExtSplit(file) - switch { - case strings.HasSuffix(name, _goos_goarch): - targ := file[:len(name)-len(_goos_goarch)] + "_GOOS_GOARCH." + ext - if err := b.copyFile(a, obj+targ, filepath.Join(a.p.Dir, file), 0644, true); err != nil { - return err - } - case strings.HasSuffix(name, _goarch): - targ := file[:len(name)-len(_goarch)] + "_GOARCH." + ext - if err := b.copyFile(a, obj+targ, filepath.Join(a.p.Dir, file), 0644, true); err != nil { - return err - } - case strings.HasSuffix(name, _goos): - targ := file[:len(name)-len(_goos)] + "_GOOS." + ext - if err := b.copyFile(a, obj+targ, filepath.Join(a.p.Dir, file), 0644, true); err != nil { - return err - } - } - } - - for _, file := range cfiles { - out := file[:len(file)-len(".c")] + ".o" - if err := buildToolchain.cc(b, a.p, obj, obj+out, file); err != nil { - return err - } - objects = append(objects, out) - } - - // Assemble .s files. - for _, file := range sfiles { - out := file[:len(file)-len(".s")] + ".o" - if err := buildToolchain.asm(b, a.p, obj, obj+out, file); err != nil { - return err - } - objects = append(objects, out) - } - - // NOTE(rsc): On Windows, it is critically important that the - // gcc-compiled objects (cgoObjects) be listed after the ordinary - // objects in the archive. I do not know why this is. - // https://golang.org/issue/2601 - objects = append(objects, cgoObjects...) - - // Add system object files. - for _, syso := range a.p.SysoFiles { - objects = append(objects, filepath.Join(a.p.Dir, syso)) - } - - // Pack into archive in obj directory. - // If the Go compiler wrote an archive, we only need to add the - // object files for non-Go sources to the archive. - // If the Go compiler wrote an archive and the package is entirely - // Go sources, there is no pack to execute at all. - if len(objects) > 0 { - if err := buildToolchain.pack(b, a.p, obj, a.objpkg, objects); err != nil { - return err - } - } - - // Link if needed. - if a.link { - // The compiler only cares about direct imports, but the - // linker needs the whole dependency tree. - all := actionList(a) - all = all[:len(all)-1] // drop a - if err := buildToolchain.ld(b, a, a.target, all, a.objpkg, objects); err != nil { - return err - } - } - - return nil -} - -// Calls pkg-config if needed and returns the cflags/ldflags needed to build the package. -func (b *builder) getPkgConfigFlags(p *Package) (cflags, ldflags []string, err error) { - if pkgs := p.CgoPkgConfig; len(pkgs) > 0 { - var out []byte - out, err = b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--cflags", pkgs) - if err != nil { - b.showOutput(p.Dir, "pkg-config --cflags "+strings.Join(pkgs, " "), string(out)) - b.print(err.Error() + "\n") - err = errPrintedOutput - return - } - if len(out) > 0 { - cflags = strings.Fields(string(out)) - } - out, err = b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--libs", pkgs) - if err != nil { - b.showOutput(p.Dir, "pkg-config --libs "+strings.Join(pkgs, " "), string(out)) - b.print(err.Error() + "\n") - err = errPrintedOutput - return - } - if len(out) > 0 { - ldflags = strings.Fields(string(out)) - } - } - return -} - -func (b *builder) installShlibname(a *action) error { - a1 := a.deps[0] - err := ioutil.WriteFile(a.target, []byte(filepath.Base(a1.target)+"\n"), 0644) - if err != nil { - return err - } - if buildX { - b.showcmd("", "echo '%s' > %s # internal", filepath.Base(a1.target), a.target) - } - return nil -} - -func (b *builder) linkShared(a *action) (err error) { - allactions := actionList(a) - allactions = allactions[:len(allactions)-1] - return buildToolchain.ldShared(b, a.deps, a.target, allactions) -} - -// install is the action for installing a single package or executable. -func (b *builder) install(a *action) (err error) { - defer func() { - if err != nil && err != errPrintedOutput { - err = fmt.Errorf("go install %s: %v", a.p.ImportPath, err) - } - }() - a1 := a.deps[0] - perm := os.FileMode(0644) - if a1.link { - switch buildBuildmode { - case "c-archive", "c-shared": - default: - perm = 0755 - } - } - - // make target directory - dir, _ := filepath.Split(a.target) - if dir != "" { - if err := b.mkdir(dir); err != nil { - return err - } - } - - // remove object dir to keep the amount of - // garbage down in a large build. On an operating system - // with aggressive buffering, cleaning incrementally like - // this keeps the intermediate objects from hitting the disk. - if !buildWork { - defer os.RemoveAll(a1.objdir) - defer os.Remove(a1.target) - } - - return b.moveOrCopyFile(a, a.target, a1.target, perm, false) -} - -// includeArgs returns the -I or -L directory list for access -// to the results of the list of actions. -func (b *builder) includeArgs(flag string, all []*action) []string { - inc := []string{} - incMap := map[string]bool{ - b.work: true, // handled later - gorootPkg: true, - "": true, // ignore empty strings - } - - // Look in the temporary space for results of test-specific actions. - // This is the $WORK/my/package/_test directory for the - // package being built, so there are few of these. - for _, a1 := range all { - if a1.p == nil { - continue - } - if dir := a1.pkgdir; dir != a1.p.build.PkgRoot && !incMap[dir] { - incMap[dir] = true - inc = append(inc, flag, dir) - } - } - - // Also look in $WORK for any non-test packages that have - // been built but not installed. - inc = append(inc, flag, b.work) - - // Finally, look in the installed package directories for each action. - for _, a1 := range all { - if a1.p == nil { - continue - } - if dir := a1.pkgdir; dir == a1.p.build.PkgRoot && !incMap[dir] { - incMap[dir] = true - inc = append(inc, flag, a1.p.build.PkgTargetRoot) - } - } - - return inc -} - -// moveOrCopyFile is like 'mv src dst' or 'cp src dst'. -func (b *builder) moveOrCopyFile(a *action, dst, src string, perm os.FileMode, force bool) error { - if buildN { - b.showcmd("", "mv %s %s", src, dst) - return nil - } - - // If we can update the mode and rename to the dst, do it. - // Otherwise fall back to standard copy. - if err := os.Chmod(src, perm); err == nil { - if err := os.Rename(src, dst); err == nil { - if buildX { - b.showcmd("", "mv %s %s", src, dst) - } - return nil - } - } - - return b.copyFile(a, dst, src, perm, force) -} - -// copyFile is like 'cp src dst'. -func (b *builder) copyFile(a *action, dst, src string, perm os.FileMode, force bool) error { - if buildN || buildX { - b.showcmd("", "cp %s %s", src, dst) - if buildN { - return nil - } - } - - sf, err := os.Open(src) - if err != nil { - return err - } - defer sf.Close() - - // Be careful about removing/overwriting dst. - // Do not remove/overwrite if dst exists and is a directory - // or a non-object file. - if fi, err := os.Stat(dst); err == nil { - if fi.IsDir() { - return fmt.Errorf("build output %q already exists and is a directory", dst) - } - if !force && !isObject(dst) { - return fmt.Errorf("build output %q already exists and is not an object file", dst) - } - } - - // On Windows, remove lingering ~ file from last attempt. - if toolIsWindows { - if _, err := os.Stat(dst + "~"); err == nil { - os.Remove(dst + "~") - } - } - - os.Remove(dst) - df, err := os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm) - if err != nil && toolIsWindows { - // Windows does not allow deletion of a binary file - // while it is executing. Try to move it out of the way. - // If the move fails, which is likely, we'll try again the - // next time we do an install of this binary. - if err := os.Rename(dst, dst+"~"); err == nil { - os.Remove(dst + "~") - } - df, err = os.OpenFile(dst, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm) - } - if err != nil { - return err - } - - _, err = io.Copy(df, sf) - df.Close() - if err != nil { - os.Remove(dst) - return fmt.Errorf("copying %s to %s: %v", src, dst, err) - } - return nil -} - -// Install the cgo export header file, if there is one. -func (b *builder) installHeader(a *action) error { - src := a.objdir + "_cgo_install.h" - if _, err := os.Stat(src); os.IsNotExist(err) { - // If the file does not exist, there are no exported - // functions, and we do not install anything. - return nil - } - - dir, _ := filepath.Split(a.target) - if dir != "" { - if err := b.mkdir(dir); err != nil { - return err - } - } - - return b.moveOrCopyFile(a, a.target, src, 0644, true) -} - -// cover runs, in effect, -// go tool cover -mode=b.coverMode -var="varName" -o dst.go src.go -func (b *builder) cover(a *action, dst, src string, perm os.FileMode, varName string) error { - return b.run(a.objdir, "cover "+a.p.ImportPath, nil, - buildToolExec, - tool("cover"), - "-mode", a.p.coverMode, - "-var", varName, - "-o", dst, - src) -} - -var objectMagic = [][]byte{ - {'!', '<', 'a', 'r', 'c', 'h', '>', '\n'}, // Package archive - {'\x7F', 'E', 'L', 'F'}, // ELF - {0xFE, 0xED, 0xFA, 0xCE}, // Mach-O big-endian 32-bit - {0xFE, 0xED, 0xFA, 0xCF}, // Mach-O big-endian 64-bit - {0xCE, 0xFA, 0xED, 0xFE}, // Mach-O little-endian 32-bit - {0xCF, 0xFA, 0xED, 0xFE}, // Mach-O little-endian 64-bit - {0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00}, // PE (Windows) as generated by 6l/8l and gcc - {0x00, 0x00, 0x01, 0xEB}, // Plan 9 i386 - {0x00, 0x00, 0x8a, 0x97}, // Plan 9 amd64 -} - -func isObject(s string) bool { - f, err := os.Open(s) - if err != nil { - return false - } - defer f.Close() - buf := make([]byte, 64) - io.ReadFull(f, buf) - for _, magic := range objectMagic { - if bytes.HasPrefix(buf, magic) { - return true - } - } - return false -} - -// fmtcmd formats a command in the manner of fmt.Sprintf but also: -// -// If dir is non-empty and the script is not in dir right now, -// fmtcmd inserts "cd dir\n" before the command. -// -// fmtcmd replaces the value of b.work with $WORK. -// fmtcmd replaces the value of goroot with $GOROOT. -// fmtcmd replaces the value of b.gobin with $GOBIN. -// -// fmtcmd replaces the name of the current directory with dot (.) -// but only when it is at the beginning of a space-separated token. -// -func (b *builder) fmtcmd(dir string, format string, args ...interface{}) string { - cmd := fmt.Sprintf(format, args...) - if dir != "" && dir != "/" { - cmd = strings.Replace(" "+cmd, " "+dir, " .", -1)[1:] - if b.scriptDir != dir { - b.scriptDir = dir - cmd = "cd " + dir + "\n" + cmd - } - } - if b.work != "" { - cmd = strings.Replace(cmd, b.work, "$WORK", -1) - } - return cmd -} - -// showcmd prints the given command to standard output -// for the implementation of -n or -x. -func (b *builder) showcmd(dir string, format string, args ...interface{}) { - b.output.Lock() - defer b.output.Unlock() - b.print(b.fmtcmd(dir, format, args...) + "\n") -} - -// showOutput prints "# desc" followed by the given output. -// The output is expected to contain references to 'dir', usually -// the source directory for the package that has failed to build. -// showOutput rewrites mentions of dir with a relative path to dir -// when the relative path is shorter. This is usually more pleasant. -// For example, if fmt doesn't compile and we are in src/html, -// the output is -// -// $ go build -// # fmt -// ../fmt/print.go:1090: undefined: asdf -// $ -// -// instead of -// -// $ go build -// # fmt -// /usr/gopher/go/src/fmt/print.go:1090: undefined: asdf -// $ -// -// showOutput also replaces references to the work directory with $WORK. -// -func (b *builder) showOutput(dir, desc, out string) { - prefix := "# " + desc - suffix := "\n" + out - if reldir := shortPath(dir); reldir != dir { - suffix = strings.Replace(suffix, " "+dir, " "+reldir, -1) - suffix = strings.Replace(suffix, "\n"+dir, "\n"+reldir, -1) - } - suffix = strings.Replace(suffix, " "+b.work, " $WORK", -1) - - b.output.Lock() - defer b.output.Unlock() - b.print(prefix, suffix) -} - -// shortPath returns an absolute or relative name for path, whatever is shorter. -func shortPath(path string) string { - if rel, err := filepath.Rel(cwd, path); err == nil && len(rel) < len(path) { - return rel - } - return path -} - -// relPaths returns a copy of paths with absolute paths -// made relative to the current directory if they would be shorter. -func relPaths(paths []string) []string { - var out []string - pwd, _ := os.Getwd() - for _, p := range paths { - rel, err := filepath.Rel(pwd, p) - if err == nil && len(rel) < len(p) { - p = rel - } - out = append(out, p) - } - return out -} - -// errPrintedOutput is a special error indicating that a command failed -// but that it generated output as well, and that output has already -// been printed, so there's no point showing 'exit status 1' or whatever -// the wait status was. The main executor, builder.do, knows not to -// print this error. -var errPrintedOutput = errors.New("already printed output - no need to show error") - -var cgoLine = regexp.MustCompile(`\[[^\[\]]+\.cgo1\.go:[0-9]+\]`) -var cgoTypeSigRe = regexp.MustCompile(`\b_Ctype_\B`) - -// run runs the command given by cmdline in the directory dir. -// If the command fails, run prints information about the failure -// and returns a non-nil error. -func (b *builder) run(dir string, desc string, env []string, cmdargs ...interface{}) error { - out, err := b.runOut(dir, desc, env, cmdargs...) - if len(out) > 0 { - if desc == "" { - desc = b.fmtcmd(dir, "%s", strings.Join(stringList(cmdargs...), " ")) - } - b.showOutput(dir, desc, b.processOutput(out)) - if err != nil { - err = errPrintedOutput - } - } - return err -} - -// processOutput prepares the output of runOut to be output to the console. -func (b *builder) processOutput(out []byte) string { - if out[len(out)-1] != '\n' { - out = append(out, '\n') - } - messages := string(out) - // Fix up output referring to cgo-generated code to be more readable. - // Replace x.go:19[/tmp/.../x.cgo1.go:18] with x.go:19. - // Replace *[100]_Ctype_foo with *[100]C.foo. - // If we're using -x, assume we're debugging and want the full dump, so disable the rewrite. - if !buildX && cgoLine.MatchString(messages) { - messages = cgoLine.ReplaceAllString(messages, "") - messages = cgoTypeSigRe.ReplaceAllString(messages, "C.") - } - return messages -} - -// runOut runs the command given by cmdline in the directory dir. -// It returns the command output and any errors that occurred. -func (b *builder) runOut(dir string, desc string, env []string, cmdargs ...interface{}) ([]byte, error) { - cmdline := stringList(cmdargs...) - if buildN || buildX { - var envcmdline string - for i := range env { - envcmdline += env[i] - envcmdline += " " - } - envcmdline += joinUnambiguously(cmdline) - b.showcmd(dir, "%s", envcmdline) - if buildN { - return nil, nil - } - } - - nbusy := 0 - for { - var buf bytes.Buffer - cmd := exec.Command(cmdline[0], cmdline[1:]...) - cmd.Stdout = &buf - cmd.Stderr = &buf - cmd.Dir = dir - cmd.Env = mergeEnvLists(env, envForDir(cmd.Dir, os.Environ())) - err := cmd.Run() - - // cmd.Run will fail on Unix if some other process has the binary - // we want to run open for writing. This can happen here because - // we build and install the cgo command and then run it. - // If another command was kicked off while we were writing the - // cgo binary, the child process for that command may be holding - // a reference to the fd, keeping us from running exec. - // - // But, you might reasonably wonder, how can this happen? - // The cgo fd, like all our fds, is close-on-exec, so that we need - // not worry about other processes inheriting the fd accidentally. - // The answer is that running a command is fork and exec. - // A child forked while the cgo fd is open inherits that fd. - // Until the child has called exec, it holds the fd open and the - // kernel will not let us run cgo. Even if the child were to close - // the fd explicitly, it would still be open from the time of the fork - // until the time of the explicit close, and the race would remain. - // - // On Unix systems, this results in ETXTBSY, which formats - // as "text file busy". Rather than hard-code specific error cases, - // we just look for that string. If this happens, sleep a little - // and try again. We let this happen three times, with increasing - // sleep lengths: 100+200+400 ms = 0.7 seconds. - // - // An alternate solution might be to split the cmd.Run into - // separate cmd.Start and cmd.Wait, and then use an RWLock - // to make sure that copyFile only executes when no cmd.Start - // call is in progress. However, cmd.Start (really syscall.forkExec) - // only guarantees that when it returns, the exec is committed to - // happen and succeed. It uses a close-on-exec file descriptor - // itself to determine this, so we know that when cmd.Start returns, - // at least one close-on-exec file descriptor has been closed. - // However, we cannot be sure that all of them have been closed, - // so the program might still encounter ETXTBSY even with such - // an RWLock. The race window would be smaller, perhaps, but not - // guaranteed to be gone. - // - // Sleeping when we observe the race seems to be the most reliable - // option we have. - // - // https://golang.org/issue/3001 - // - if err != nil && nbusy < 3 && strings.Contains(err.Error(), "text file busy") { - time.Sleep(100 * time.Millisecond << uint(nbusy)) - nbusy++ - continue - } - - // err can be something like 'exit status 1'. - // Add information about what program was running. - // Note that if buf.Bytes() is non-empty, the caller usually - // shows buf.Bytes() and does not print err at all, so the - // prefix here does not make most output any more verbose. - if err != nil { - err = errors.New(cmdline[0] + ": " + err.Error()) - } - return buf.Bytes(), err - } -} - -// joinUnambiguously prints the slice, quoting where necessary to make the -// output unambiguous. -// TODO: See issue 5279. The printing of commands needs a complete redo. -func joinUnambiguously(a []string) string { - var buf bytes.Buffer - for i, s := range a { - if i > 0 { - buf.WriteByte(' ') - } - q := strconv.Quote(s) - if s == "" || strings.Contains(s, " ") || len(q) > len(s)+2 { - buf.WriteString(q) - } else { - buf.WriteString(s) - } - } - return buf.String() -} - -// mkdir makes the named directory. -func (b *builder) mkdir(dir string) error { - b.exec.Lock() - defer b.exec.Unlock() - // We can be a little aggressive about being - // sure directories exist. Skip repeated calls. - if b.mkdirCache[dir] { - return nil - } - b.mkdirCache[dir] = true - - if buildN || buildX { - b.showcmd("", "mkdir -p %s", dir) - if buildN { - return nil - } - } - - if err := os.MkdirAll(dir, 0777); err != nil { - return err - } - return nil -} - -// mkAbs returns an absolute path corresponding to -// evaluating f in the directory dir. -// We always pass absolute paths of source files so that -// the error messages will include the full path to a file -// in need of attention. -func mkAbs(dir, f string) string { - // Leave absolute paths alone. - // Also, during -n mode we use the pseudo-directory $WORK - // instead of creating an actual work directory that won't be used. - // Leave paths beginning with $WORK alone too. - if filepath.IsAbs(f) || strings.HasPrefix(f, "$WORK") { - return f - } - return filepath.Join(dir, f) -} - -type toolchain interface { - // gc runs the compiler in a specific directory on a set of files - // and returns the name of the generated output file. - // The compiler runs in the directory dir. - gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, out []byte, err error) - // cc runs the toolchain's C compiler in a directory on a C file - // to produce an output file. - cc(b *builder, p *Package, objdir, ofile, cfile string) error - // asm runs the assembler in a specific directory on a specific file - // to generate the named output file. - asm(b *builder, p *Package, obj, ofile, sfile string) error - // pkgpath builds an appropriate path for a temporary package file. - pkgpath(basedir string, p *Package) string - // pack runs the archive packer in a specific directory to create - // an archive from a set of object files. - // typically it is run in the object directory. - pack(b *builder, p *Package, objDir, afile string, ofiles []string) error - // ld runs the linker to create an executable starting at mainpkg. - ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error - // ldShared runs the linker to create a shared library containing the pkgs built by toplevelactions - ldShared(b *builder, toplevelactions []*action, out string, allactions []*action) error - - compiler() string - linker() string -} - -type noToolchain struct{} - -func noCompiler() error { - log.Fatalf("unknown compiler %q", buildContext.Compiler) - return nil -} - -func (noToolchain) compiler() string { - noCompiler() - return "" -} - -func (noToolchain) linker() string { - noCompiler() - return "" -} - -func (noToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, out []byte, err error) { - return "", nil, noCompiler() -} - -func (noToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error { - return noCompiler() -} - -func (noToolchain) pkgpath(basedir string, p *Package) string { - noCompiler() - return "" -} - -func (noToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles []string) error { - return noCompiler() -} - -func (noToolchain) ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error { - return noCompiler() -} - -func (noToolchain) ldShared(b *builder, toplevelactions []*action, out string, allactions []*action) error { - return noCompiler() -} - -func (noToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error { - return noCompiler() -} - -// The Go toolchain. -type gcToolchain struct{} - -func (gcToolchain) compiler() string { - return tool("compile") -} - -func (gcToolchain) linker() string { - return tool("link") -} - -func (gcToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, output []byte, err error) { - if archive != "" { - ofile = archive - } else { - out := "_go_.o" - ofile = obj + out - } - - gcargs := []string{"-p", p.ImportPath} - if p.Name == "main" { - gcargs[1] = "main" - } - if p.Standard && p.ImportPath == "runtime" { - // runtime compiles with a special gc flag to emit - // additional reflect type data. - gcargs = append(gcargs, "-+") - } - - // If we're giving the compiler the entire package (no C etc files), tell it that, - // so that it can give good error messages about forward declarations. - // Exceptions: a few standard packages have forward declarations for - // pieces supplied behind-the-scenes by package runtime. - extFiles := len(p.CgoFiles) + len(p.CFiles) + len(p.CXXFiles) + len(p.MFiles) + len(p.SFiles) + len(p.SysoFiles) + len(p.SwigFiles) + len(p.SwigCXXFiles) - if p.Standard { - switch p.ImportPath { - case "bytes", "net", "os", "runtime/pprof", "sync", "time": - extFiles++ - } - } - if extFiles == 0 { - gcargs = append(gcargs, "-complete") - } - if buildContext.InstallSuffix != "" { - gcargs = append(gcargs, "-installsuffix", buildContext.InstallSuffix) - } - if p.buildID != "" { - gcargs = append(gcargs, "-buildid", p.buildID) - } - - for _, path := range p.Imports { - if i := strings.LastIndex(path, "/vendor/"); i >= 0 { - gcargs = append(gcargs, "-importmap", path[i+len("/vendor/"):]+"="+path) - } else if strings.HasPrefix(path, "vendor/") { - gcargs = append(gcargs, "-importmap", path[len("vendor/"):]+"="+path) - } - } - - for _, path := range p.Imports { - if i := strings.LastIndex(path, "/vendor/"); i >= 0 { - gcargs = append(gcargs, "-importmap", path[i+len("/vendor/"):]+"="+path) - } else if strings.HasPrefix(path, "vendor/") { - gcargs = append(gcargs, "-importmap", path[len("vendor/"):]+"="+path) - } - } - - args := []interface{}{buildToolExec, tool("compile"), "-o", ofile, "-trimpath", b.work, buildGcflags, gcargs, "-D", p.localPrefix, importArgs} - if ofile == archive { - args = append(args, "-pack") - } - if asmhdr { - args = append(args, "-asmhdr", obj+"go_asm.h") - } - for _, f := range gofiles { - args = append(args, mkAbs(p.Dir, f)) - } - - output, err = b.runOut(p.Dir, p.ImportPath, nil, args...) - return ofile, output, err -} - -func (gcToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error { - // Add -I pkg/GOOS_GOARCH so #include "textflag.h" works in .s files. - inc := filepath.Join(goroot, "pkg", "include") - sfile = mkAbs(p.Dir, sfile) - args := []interface{}{buildToolExec, tool("asm"), "-o", ofile, "-trimpath", b.work, "-I", obj, "-I", inc, "-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch, buildAsmflags, sfile} - if err := b.run(p.Dir, p.ImportPath, nil, args...); err != nil { - return err - } - return nil -} - -// toolVerify checks that the command line args writes the same output file -// if run using newTool instead. -// Unused now but kept around for future use. -func toolVerify(b *builder, p *Package, newTool string, ofile string, args []interface{}) error { - newArgs := make([]interface{}, len(args)) - copy(newArgs, args) - newArgs[1] = tool(newTool) - newArgs[3] = ofile + ".new" // x.6 becomes x.6.new - if err := b.run(p.Dir, p.ImportPath, nil, newArgs...); err != nil { - return err - } - data1, err := ioutil.ReadFile(ofile) - if err != nil { - return err - } - data2, err := ioutil.ReadFile(ofile + ".new") - if err != nil { - return err - } - if !bytes.Equal(data1, data2) { - return fmt.Errorf("%s and %s produced different output files:\n%s\n%s", filepath.Base(args[1].(string)), newTool, strings.Join(stringList(args...), " "), strings.Join(stringList(newArgs...), " ")) - } - os.Remove(ofile + ".new") - return nil -} - -func (gcToolchain) pkgpath(basedir string, p *Package) string { - end := filepath.FromSlash(p.ImportPath + ".a") - return filepath.Join(basedir, end) -} - -func (gcToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles []string) error { - var absOfiles []string - for _, f := range ofiles { - absOfiles = append(absOfiles, mkAbs(objDir, f)) - } - cmd := "c" - absAfile := mkAbs(objDir, afile) - appending := false - if _, err := os.Stat(absAfile); err == nil { - appending = true - cmd = "r" - } - - cmdline := stringList("pack", cmd, absAfile, absOfiles) - - if appending { - if buildN || buildX { - b.showcmd(p.Dir, "%s # internal", joinUnambiguously(cmdline)) - } - if buildN { - return nil - } - if err := packInternal(b, absAfile, absOfiles); err != nil { - b.showOutput(p.Dir, p.ImportPath, err.Error()+"\n") - return errPrintedOutput - } - return nil - } - - // Need actual pack. - cmdline[0] = tool("pack") - return b.run(p.Dir, p.ImportPath, nil, buildToolExec, cmdline) -} - -func packInternal(b *builder, afile string, ofiles []string) error { - dst, err := os.OpenFile(afile, os.O_WRONLY|os.O_APPEND, 0) - if err != nil { - return err - } - defer dst.Close() // only for error returns or panics - w := bufio.NewWriter(dst) - - for _, ofile := range ofiles { - src, err := os.Open(ofile) - if err != nil { - return err - } - fi, err := src.Stat() - if err != nil { - src.Close() - return err - } - // Note: Not using %-16.16s format because we care - // about bytes, not runes. - name := fi.Name() - if len(name) > 16 { - name = name[:16] - } else { - name += strings.Repeat(" ", 16-len(name)) - } - size := fi.Size() - fmt.Fprintf(w, "%s%-12d%-6d%-6d%-8o%-10d`\n", - name, 0, 0, 0, 0644, size) - n, err := io.Copy(w, src) - src.Close() - if err == nil && n < size { - err = io.ErrUnexpectedEOF - } else if err == nil && n > size { - err = fmt.Errorf("file larger than size reported by stat") - } - if err != nil { - return fmt.Errorf("copying %s to %s: %v", ofile, afile, err) - } - if size&1 != 0 { - w.WriteByte(0) - } - } - - if err := w.Flush(); err != nil { - return err - } - return dst.Close() -} - -// setextld sets the appropriate linker flags for the specified compiler. -func setextld(ldflags []string, compiler []string) []string { - for _, f := range ldflags { - if f == "-extld" || strings.HasPrefix(f, "-extld=") { - // don't override -extld if supplied - return ldflags - } - } - ldflags = append(ldflags, "-extld="+compiler[0]) - if len(compiler) > 1 { - extldflags := false - add := strings.Join(compiler[1:], " ") - for i, f := range ldflags { - if f == "-extldflags" && i+1 < len(ldflags) { - ldflags[i+1] = add + " " + ldflags[i+1] - extldflags = true - break - } else if strings.HasPrefix(f, "-extldflags=") { - ldflags[i] = "-extldflags=" + add + " " + ldflags[i][len("-extldflags="):] - extldflags = true - break - } - } - if !extldflags { - ldflags = append(ldflags, "-extldflags="+add) - } - } - return ldflags -} - -func (gcToolchain) ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error { - importArgs := b.includeArgs("-L", allactions) - cxx := len(root.p.CXXFiles) > 0 || len(root.p.SwigCXXFiles) > 0 - for _, a := range allactions { - if a.p != nil && (len(a.p.CXXFiles) > 0 || len(a.p.SwigCXXFiles) > 0) { - cxx = true - } - } - var ldflags []string - if buildContext.InstallSuffix != "" { - ldflags = append(ldflags, "-installsuffix", buildContext.InstallSuffix) - } - if root.p.omitDWARF { - ldflags = append(ldflags, "-w") - } - - // If the user has not specified the -extld option, then specify the - // appropriate linker. In case of C++ code, use the compiler named - // by the CXX environment variable or defaultCXX if CXX is not set. - // Else, use the CC environment variable and defaultCC as fallback. - var compiler []string - if cxx { - compiler = envList("CXX", defaultCXX) - } else { - compiler = envList("CC", defaultCC) - } - ldflags = setextld(ldflags, compiler) - ldflags = append(ldflags, "-buildmode="+ldBuildmode) - if root.p.buildID != "" { - ldflags = append(ldflags, "-buildid="+root.p.buildID) - } - ldflags = append(ldflags, buildLdflags...) - - // On OS X when using external linking to build a shared library, - // the argument passed here to -o ends up recorded in the final - // shared library in the LC_ID_DYLIB load command. - // To avoid putting the temporary output directory name there - // (and making the resulting shared library useless), - // run the link in the output directory so that -o can name - // just the final path element. - dir := "." - if goos == "darwin" && buildBuildmode == "c-shared" { - dir, out = filepath.Split(out) - } - - return b.run(dir, root.p.ImportPath, nil, buildToolExec, tool("link"), "-o", out, importArgs, ldflags, mainpkg) -} - -func (gcToolchain) ldShared(b *builder, toplevelactions []*action, out string, allactions []*action) error { - importArgs := b.includeArgs("-L", allactions) - ldflags := []string{"-installsuffix", buildContext.InstallSuffix} - ldflags = append(ldflags, "-buildmode=shared") - ldflags = append(ldflags, buildLdflags...) - cxx := false - for _, a := range allactions { - if a.p != nil && (len(a.p.CXXFiles) > 0 || len(a.p.SwigCXXFiles) > 0) { - cxx = true - } - } - // If the user has not specified the -extld option, then specify the - // appropriate linker. In case of C++ code, use the compiler named - // by the CXX environment variable or defaultCXX if CXX is not set. - // Else, use the CC environment variable and defaultCC as fallback. - var compiler []string - if cxx { - compiler = envList("CXX", defaultCXX) - } else { - compiler = envList("CC", defaultCC) - } - ldflags = setextld(ldflags, compiler) - for _, d := range toplevelactions { - if !strings.HasSuffix(d.target, ".a") { // omit unsafe etc and actions for other shared libraries - continue - } - ldflags = append(ldflags, d.p.ImportPath+"="+d.target) - } - return b.run(".", out, nil, buildToolExec, tool("link"), "-o", out, importArgs, ldflags) -} - -func (gcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error { - return fmt.Errorf("%s: C source files not supported without cgo", mkAbs(p.Dir, cfile)) -} - -// The Gccgo toolchain. -type gccgoToolchain struct{} - -var gccgoName, gccgoBin string - -func init() { - gccgoName = os.Getenv("GCCGO") - if gccgoName == "" { - gccgoName = defaultGCCGO - } - gccgoBin, _ = exec.LookPath(gccgoName) -} - -func (gccgoToolchain) compiler() string { - return gccgoBin -} - -func (gccgoToolchain) linker() string { - return gccgoBin -} - -func (tools gccgoToolchain) gc(b *builder, p *Package, archive, obj string, asmhdr bool, importArgs []string, gofiles []string) (ofile string, output []byte, err error) { - out := "_go_.o" - ofile = obj + out - gcargs := []string{"-g"} - gcargs = append(gcargs, b.gccArchArgs()...) - if pkgpath := gccgoPkgpath(p); pkgpath != "" { - gcargs = append(gcargs, "-fgo-pkgpath="+pkgpath) - } - if p.localPrefix != "" { - gcargs = append(gcargs, "-fgo-relative-import-path="+p.localPrefix) - } - args := stringList(tools.compiler(), importArgs, "-c", gcargs, "-o", ofile, buildGccgoflags) - for _, f := range gofiles { - args = append(args, mkAbs(p.Dir, f)) - } - - output, err = b.runOut(p.Dir, p.ImportPath, nil, args) - return ofile, output, err -} - -func (tools gccgoToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error { - sfile = mkAbs(p.Dir, sfile) - defs := []string{"-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch} - if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" { - defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`) - } - defs = tools.maybePIC(defs) - defs = append(defs, b.gccArchArgs()...) - return b.run(p.Dir, p.ImportPath, nil, tools.compiler(), "-c", "-I", obj, "-o", ofile, defs, sfile) -} - -func (gccgoToolchain) pkgpath(basedir string, p *Package) string { - end := filepath.FromSlash(p.ImportPath + ".a") - afile := filepath.Join(basedir, end) - // add "lib" to the final element - return filepath.Join(filepath.Dir(afile), "lib"+filepath.Base(afile)) -} - -func (gccgoToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles []string) error { - var absOfiles []string - for _, f := range ofiles { - absOfiles = append(absOfiles, mkAbs(objDir, f)) - } - return b.run(p.Dir, p.ImportPath, nil, "ar", "cru", mkAbs(objDir, afile), absOfiles) -} - -func (tools gccgoToolchain) ld(b *builder, root *action, out string, allactions []*action, mainpkg string, ofiles []string) error { - // gccgo needs explicit linking with all package dependencies, - // and all LDFLAGS from cgo dependencies. - apackagesSeen := make(map[*Package]bool) - afiles := []string{} - shlibs := []string{} - xfiles := []string{} - ldflags := b.gccArchArgs() - cgoldflags := []string{} - usesCgo := false - cxx := len(root.p.CXXFiles) > 0 || len(root.p.SwigCXXFiles) > 0 - objc := len(root.p.MFiles) > 0 - - actionsSeen := make(map[*action]bool) - // Make a pre-order depth-first traversal of the action graph, taking note of - // whether a shared library action has been seen on the way to an action (the - // construction of the graph means that if any path to a node passes through - // a shared library action, they all do). - var walk func(a *action, seenShlib bool) - walk = func(a *action, seenShlib bool) { - if actionsSeen[a] { - return - } - actionsSeen[a] = true - if a.p != nil && !seenShlib { - if a.p.Standard { - return - } - // We record the target of the first time we see a .a file - // for a package to make sure that we prefer the 'install' - // rather than the 'build' location (which may not exist any - // more). We still need to traverse the dependencies of the - // build action though so saying - // if apackagesSeen[a.p] { return } - // doesn't work. - if !apackagesSeen[a.p] { - apackagesSeen[a.p] = true - if a.p.fake && a.p.external { - // external _tests, if present must come before - // internal _tests. Store these on a separate list - // and place them at the head after this loop. - xfiles = append(xfiles, a.target) - } else if a.p.fake { - // move _test files to the top of the link order - afiles = append([]string{a.target}, afiles...) - } else { - afiles = append(afiles, a.target) - } - } - } - if strings.HasSuffix(a.target, ".so") { - shlibs = append(shlibs, a.target) - seenShlib = true - } - for _, a1 := range a.deps { - walk(a1, seenShlib) - } - } - for _, a1 := range root.deps { - walk(a1, false) - } - afiles = append(xfiles, afiles...) - - for _, a := range allactions { - // Gather CgoLDFLAGS, but not from standard packages. - // The go tool can dig up runtime/cgo from GOROOT and - // think that it should use its CgoLDFLAGS, but gccgo - // doesn't use runtime/cgo. - if a.p == nil { - continue - } - if !a.p.Standard { - cgoldflags = append(cgoldflags, a.p.CgoLDFLAGS...) - } - if len(a.p.CgoFiles) > 0 { - usesCgo = true - } - if a.p.usesSwig() { - usesCgo = true - } - if len(a.p.CXXFiles) > 0 || len(a.p.SwigCXXFiles) > 0 { - cxx = true - } - if len(a.p.MFiles) > 0 { - objc = true - } - } - - ldflags = append(ldflags, "-Wl,--whole-archive") - ldflags = append(ldflags, afiles...) - ldflags = append(ldflags, "-Wl,--no-whole-archive") - - ldflags = append(ldflags, cgoldflags...) - ldflags = append(ldflags, envList("CGO_LDFLAGS", "")...) - ldflags = append(ldflags, root.p.CgoLDFLAGS...) - - ldflags = stringList("-Wl,-(", ldflags, "-Wl,-)") - - for _, shlib := range shlibs { - ldflags = append( - ldflags, - "-L"+filepath.Dir(shlib), - "-Wl,-rpath="+filepath.Dir(shlib), - "-l"+strings.TrimSuffix( - strings.TrimPrefix(filepath.Base(shlib), "lib"), - ".so")) - } - - var realOut string - switch ldBuildmode { - case "exe": - if usesCgo && goos == "linux" { - ldflags = append(ldflags, "-Wl,-E") - } - - case "c-archive": - // Link the Go files into a single .o, and also link - // in -lgolibbegin. - // - // We need to use --whole-archive with -lgolibbegin - // because it doesn't define any symbols that will - // cause the contents to be pulled in; it's just - // initialization code. - // - // The user remains responsible for linking against - // -lgo -lpthread -lm in the final link. We can't use - // -r to pick them up because we can't combine - // split-stack and non-split-stack code in a single -r - // link, and libgo picks up non-split-stack code from - // libffi. - ldflags = append(ldflags, "-Wl,-r", "-nostdlib", "-Wl,--whole-archive", "-lgolibbegin", "-Wl,--no-whole-archive") - - // We are creating an object file, so we don't want a build ID. - ldflags = b.disableBuildID(ldflags) - - realOut = out - out = out + ".o" - - case "c-shared": - ldflags = append(ldflags, "-shared", "-nostdlib", "-Wl,--whole-archive", "-lgolibbegin", "-Wl,--no-whole-archive", "-lgo", "-lgcc_s", "-lgcc") - - default: - fatalf("-buildmode=%s not supported for gccgo", ldBuildmode) - } - - switch ldBuildmode { - case "exe", "c-shared": - if cxx { - ldflags = append(ldflags, "-lstdc++") - } - if objc { - ldflags = append(ldflags, "-lobjc") - } - } - - if err := b.run(".", root.p.ImportPath, nil, tools.linker(), "-o", out, ofiles, ldflags, buildGccgoflags); err != nil { - return err - } - - switch ldBuildmode { - case "c-archive": - if err := b.run(".", root.p.ImportPath, nil, "ar", "rc", realOut, out); err != nil { - return err - } - } - return nil -} - -func (tools gccgoToolchain) ldShared(b *builder, toplevelactions []*action, out string, allactions []*action) error { - args := []string{"-o", out, "-shared", "-nostdlib", "-zdefs", "-Wl,--whole-archive"} - for _, a := range toplevelactions { - args = append(args, a.target) - } - args = append(args, "-Wl,--no-whole-archive", "-shared", "-nostdlib", "-lgo", "-lgcc_s", "-lgcc", "-lc") - shlibs := []string{} - for _, a := range allactions { - if strings.HasSuffix(a.target, ".so") { - shlibs = append(shlibs, a.target) - } - } - for _, shlib := range shlibs { - args = append( - args, - "-L"+filepath.Dir(shlib), - "-Wl,-rpath="+filepath.Dir(shlib), - "-l"+strings.TrimSuffix( - strings.TrimPrefix(filepath.Base(shlib), "lib"), - ".so")) - } - return b.run(".", out, nil, tools.linker(), args, buildGccgoflags) -} - -func (tools gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error { - inc := filepath.Join(goroot, "pkg", "include") - cfile = mkAbs(p.Dir, cfile) - defs := []string{"-D", "GOOS_" + goos, "-D", "GOARCH_" + goarch} - defs = append(defs, b.gccArchArgs()...) - if pkgpath := gccgoCleanPkgpath(p); pkgpath != "" { - defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`) - } - switch goarch { - case "386", "amd64": - defs = append(defs, "-fsplit-stack") - } - defs = tools.maybePIC(defs) - return b.run(p.Dir, p.ImportPath, nil, envList("CC", defaultCC), "-Wall", "-g", - "-I", objdir, "-I", inc, "-o", ofile, defs, "-c", cfile) -} - -// maybePIC adds -fPIC to the list of arguments if needed. -func (tools gccgoToolchain) maybePIC(args []string) []string { - switch buildBuildmode { - case "c-shared", "shared": - args = append(args, "-fPIC") - } - return args -} - -func gccgoPkgpath(p *Package) string { - if p.build.IsCommand() && !p.forceLibrary { - return "" - } - return p.ImportPath -} - -func gccgoCleanPkgpath(p *Package) string { - clean := func(r rune) rune { - switch { - case 'A' <= r && r <= 'Z', 'a' <= r && r <= 'z', - '0' <= r && r <= '9': - return r - } - return '_' - } - return strings.Map(clean, gccgoPkgpath(p)) -} - -// libgcc returns the filename for libgcc, as determined by invoking gcc with -// the -print-libgcc-file-name option. -func (b *builder) libgcc(p *Package) (string, error) { - var buf bytes.Buffer - - gccCmd := b.gccCmd(p.Dir) - - prev := b.print - if buildN { - // In -n mode we temporarily swap out the builder's - // print function to capture the command-line. This - // let's us assign it to $LIBGCC and produce a valid - // buildscript for cgo packages. - b.print = func(a ...interface{}) (int, error) { - return fmt.Fprint(&buf, a...) - } - } - f, err := b.runOut(p.Dir, p.ImportPath, nil, gccCmd, "-print-libgcc-file-name") - if err != nil { - return "", fmt.Errorf("gcc -print-libgcc-file-name: %v (%s)", err, f) - } - if buildN { - s := fmt.Sprintf("LIBGCC=$(%s)\n", buf.Next(buf.Len()-1)) - b.print = prev - b.print(s) - return "$LIBGCC", nil - } - - // The compiler might not be able to find libgcc, and in that case, - // it will simply return "libgcc.a", which is of no use to us. - if !filepath.IsAbs(string(f)) { - return "", nil - } - - return strings.Trim(string(f), "\r\n"), nil -} - -// gcc runs the gcc C compiler to create an object from a single C file. -func (b *builder) gcc(p *Package, out string, flags []string, cfile string) error { - return b.ccompile(p, out, flags, cfile, b.gccCmd(p.Dir)) -} - -// gxx runs the g++ C++ compiler to create an object from a single C++ file. -func (b *builder) gxx(p *Package, out string, flags []string, cxxfile string) error { - return b.ccompile(p, out, flags, cxxfile, b.gxxCmd(p.Dir)) -} - -// ccompile runs the given C or C++ compiler and creates an object from a single source file. -func (b *builder) ccompile(p *Package, out string, flags []string, file string, compiler []string) error { - file = mkAbs(p.Dir, file) - return b.run(p.Dir, p.ImportPath, nil, compiler, flags, "-o", out, "-c", file) -} - -// gccld runs the gcc linker to create an executable from a set of object files. -func (b *builder) gccld(p *Package, out string, flags []string, obj []string) error { - var cmd []string - if len(p.CXXFiles) > 0 || len(p.SwigCXXFiles) > 0 { - cmd = b.gxxCmd(p.Dir) - } else { - cmd = b.gccCmd(p.Dir) - } - return b.run(p.Dir, p.ImportPath, nil, cmd, "-o", out, obj, flags) -} - -// gccCmd returns a gcc command line prefix -// defaultCC is defined in zdefaultcc.go, written by cmd/dist. -func (b *builder) gccCmd(objdir string) []string { - return b.ccompilerCmd("CC", defaultCC, objdir) -} - -// gxxCmd returns a g++ command line prefix -// defaultCXX is defined in zdefaultcc.go, written by cmd/dist. -func (b *builder) gxxCmd(objdir string) []string { - return b.ccompilerCmd("CXX", defaultCXX, objdir) -} - -// ccompilerCmd returns a command line prefix for the given environment -// variable and using the default command when the variable is empty. -func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string { - // NOTE: env.go's mkEnv knows that the first three - // strings returned are "gcc", "-I", objdir (and cuts them off). - - compiler := envList(envvar, defcmd) - a := []string{compiler[0], "-I", objdir} - a = append(a, compiler[1:]...) - - // Definitely want -fPIC but on Windows gcc complains - // "-fPIC ignored for target (all code is position independent)" - if goos != "windows" { - a = append(a, "-fPIC") - } - a = append(a, b.gccArchArgs()...) - // gcc-4.5 and beyond require explicit "-pthread" flag - // for multithreading with pthread library. - if buildContext.CgoEnabled { - switch goos { - case "windows": - a = append(a, "-mthreads") - default: - a = append(a, "-pthread") - } - } - - if strings.Contains(a[0], "clang") { - // disable ASCII art in clang errors, if possible - a = append(a, "-fno-caret-diagnostics") - // clang is too smart about command-line arguments - a = append(a, "-Qunused-arguments") - } - - // disable word wrapping in error messages - a = append(a, "-fmessage-length=0") - - // On OS X, some of the compilers behave as if -fno-common - // is always set, and the Mach-O linker in 6l/8l assumes this. - // See https://golang.org/issue/3253. - if goos == "darwin" { - a = append(a, "-fno-common") - } - - return a -} - -// gccArchArgs returns arguments to pass to gcc based on the architecture. -func (b *builder) gccArchArgs() []string { - switch goarch { - case "386": - return []string{"-m32"} - case "amd64", "amd64p32": - return []string{"-m64"} - case "arm": - return []string{"-marm"} // not thumb - } - return nil -} - -// envList returns the value of the given environment variable broken -// into fields, using the default value when the variable is empty. -func envList(key, def string) []string { - v := os.Getenv(key) - if v == "" { - v = def - } - return strings.Fields(v) -} - -// Return the flags to use when invoking the C or C++ compilers, or cgo. -func (b *builder) cflags(p *Package, def bool) (cppflags, cflags, cxxflags, ldflags []string) { - var defaults string - if def { - defaults = "-g -O2" - } - - cppflags = stringList(envList("CGO_CPPFLAGS", ""), p.CgoCPPFLAGS) - cflags = stringList(envList("CGO_CFLAGS", defaults), p.CgoCFLAGS) - cxxflags = stringList(envList("CGO_CXXFLAGS", defaults), p.CgoCXXFLAGS) - ldflags = stringList(envList("CGO_LDFLAGS", defaults), p.CgoLDFLAGS) - return -} - -var cgoRe = regexp.MustCompile(`[/\\:]`) - -var ( - cgoLibGccFile string - cgoLibGccErr error - cgoLibGccFileOnce sync.Once -) - -func (b *builder) cgo(p *Package, cgoExe, obj string, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, gxxfiles, mfiles []string) (outGo, outObj []string, err error) { - cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, cgoLDFLAGS := b.cflags(p, true) - _, cgoexeCFLAGS, _, _ := b.cflags(p, false) - cgoCPPFLAGS = append(cgoCPPFLAGS, pcCFLAGS...) - cgoLDFLAGS = append(cgoLDFLAGS, pcLDFLAGS...) - // If we are compiling Objective-C code, then we need to link against libobjc - if len(mfiles) > 0 { - cgoLDFLAGS = append(cgoLDFLAGS, "-lobjc") - } - - // Allows including _cgo_export.h from .[ch] files in the package. - cgoCPPFLAGS = append(cgoCPPFLAGS, "-I", obj) - - // cgo - // TODO: CGOPKGPATH, CGO_FLAGS? - gofiles := []string{obj + "_cgo_gotypes.go"} - cfiles := []string{"_cgo_main.c", "_cgo_export.c"} - for _, fn := range cgofiles { - f := cgoRe.ReplaceAllString(fn[:len(fn)-2], "_") - gofiles = append(gofiles, obj+f+"cgo1.go") - cfiles = append(cfiles, f+"cgo2.c") - } - defunC := obj + "_cgo_defun.c" - - cgoflags := []string{} - // TODO: make cgo not depend on $GOARCH? - - if p.Standard && p.ImportPath == "runtime/cgo" { - cgoflags = append(cgoflags, "-import_runtime_cgo=false") - } - if p.Standard && (p.ImportPath == "runtime/race" || p.ImportPath == "runtime/cgo") { - cgoflags = append(cgoflags, "-import_syscall=false") - } - - // Update $CGO_LDFLAGS with p.CgoLDFLAGS. - var cgoenv []string - if len(cgoLDFLAGS) > 0 { - flags := make([]string, len(cgoLDFLAGS)) - for i, f := range cgoLDFLAGS { - flags[i] = strconv.Quote(f) - } - cgoenv = []string{"CGO_LDFLAGS=" + strings.Join(flags, " ")} - } - - if _, ok := buildToolchain.(gccgoToolchain); ok { - switch goarch { - case "386", "amd64": - cgoCFLAGS = append(cgoCFLAGS, "-fsplit-stack") - } - cgoflags = append(cgoflags, "-gccgo") - if pkgpath := gccgoPkgpath(p); pkgpath != "" { - cgoflags = append(cgoflags, "-gccgopkgpath="+pkgpath) - } - } - - switch buildBuildmode { - case "c-archive", "c-shared": - // Tell cgo that if there are any exported functions - // it should generate a header file that C code can - // #include. - cgoflags = append(cgoflags, "-exportheader="+obj+"_cgo_install.h") - } - - if err := b.run(p.Dir, p.ImportPath, cgoenv, buildToolExec, cgoExe, "-objdir", obj, "-importpath", p.ImportPath, cgoflags, "--", cgoCPPFLAGS, cgoexeCFLAGS, cgofiles); err != nil { - return nil, nil, err - } - outGo = append(outGo, gofiles...) - - // cc _cgo_defun.c - _, gccgo := buildToolchain.(gccgoToolchain) - if gccgo { - defunObj := obj + "_cgo_defun.o" - if err := buildToolchain.cc(b, p, obj, defunObj, defunC); err != nil { - return nil, nil, err - } - outObj = append(outObj, defunObj) - } - - // gcc - var linkobj []string - - var bareLDFLAGS []string - // filter out -lsomelib, -l somelib, *.{so,dll,dylib}, and (on Darwin) -framework X - for i := 0; i < len(cgoLDFLAGS); i++ { - f := cgoLDFLAGS[i] - switch { - // skip "-lc" or "-l somelib" - case strings.HasPrefix(f, "-l"): - if f == "-l" { - i++ - } - // skip "-framework X" on Darwin - case goos == "darwin" && f == "-framework": - i++ - // skip "*.{dylib,so,dll}" - case strings.HasSuffix(f, ".dylib"), - strings.HasSuffix(f, ".so"), - strings.HasSuffix(f, ".dll"): - continue - // Remove any -fsanitize=foo flags. - // Otherwise the compiler driver thinks that we are doing final link - // and links sanitizer runtime into the object file. But we are not doing - // the final link, we will link the resulting object file again. And - // so the program ends up with two copies of sanitizer runtime. - // See issue 8788 for details. - case strings.HasPrefix(f, "-fsanitize="): - continue - default: - bareLDFLAGS = append(bareLDFLAGS, f) - } - } - - cgoLibGccFileOnce.Do(func() { - cgoLibGccFile, cgoLibGccErr = b.libgcc(p) - }) - if cgoLibGccFile == "" && cgoLibGccErr != nil { - return nil, nil, err - } - - var staticLibs []string - if goos == "windows" { - // libmingw32 and libmingwex might also use libgcc, so libgcc must come last, - // and they also have some inter-dependencies, so must use linker groups. - staticLibs = []string{"-Wl,--start-group", "-lmingwex", "-lmingw32", "-Wl,--end-group"} - } - if cgoLibGccFile != "" { - staticLibs = append(staticLibs, cgoLibGccFile) - } - - cflags := stringList(cgoCPPFLAGS, cgoCFLAGS) - for _, cfile := range cfiles { - ofile := obj + cfile[:len(cfile)-1] + "o" - if err := b.gcc(p, ofile, cflags, obj+cfile); err != nil { - return nil, nil, err - } - linkobj = append(linkobj, ofile) - if !strings.HasSuffix(ofile, "_cgo_main.o") { - outObj = append(outObj, ofile) - } - } - - for _, file := range gccfiles { - ofile := obj + cgoRe.ReplaceAllString(file[:len(file)-1], "_") + "o" - if err := b.gcc(p, ofile, cflags, file); err != nil { - return nil, nil, err - } - linkobj = append(linkobj, ofile) - outObj = append(outObj, ofile) - } - - cxxflags := stringList(cgoCPPFLAGS, cgoCXXFLAGS) - for _, file := range gxxfiles { - // Append .o to the file, just in case the pkg has file.c and file.cpp - ofile := obj + cgoRe.ReplaceAllString(file, "_") + ".o" - if err := b.gxx(p, ofile, cxxflags, file); err != nil { - return nil, nil, err - } - linkobj = append(linkobj, ofile) - outObj = append(outObj, ofile) - } - - for _, file := range mfiles { - // Append .o to the file, just in case the pkg has file.c and file.m - ofile := obj + cgoRe.ReplaceAllString(file, "_") + ".o" - if err := b.gcc(p, ofile, cflags, file); err != nil { - return nil, nil, err - } - linkobj = append(linkobj, ofile) - outObj = append(outObj, ofile) - } - - linkobj = append(linkobj, p.SysoFiles...) - dynobj := obj + "_cgo_.o" - pie := goarch == "arm" && (goos == "linux" || goos == "android") - if pie { // we need to use -pie for Linux/ARM to get accurate imported sym - cgoLDFLAGS = append(cgoLDFLAGS, "-pie") - } - if err := b.gccld(p, dynobj, cgoLDFLAGS, linkobj); err != nil { - return nil, nil, err - } - if pie { // but we don't need -pie for normal cgo programs - cgoLDFLAGS = cgoLDFLAGS[0 : len(cgoLDFLAGS)-1] - } - - if _, ok := buildToolchain.(gccgoToolchain); ok { - // we don't use dynimport when using gccgo. - return outGo, outObj, nil - } - - // cgo -dynimport - importGo := obj + "_cgo_import.go" - cgoflags = []string{} - if p.Standard && p.ImportPath == "runtime/cgo" { - cgoflags = append(cgoflags, "-dynlinker") // record path to dynamic linker - } - if err := b.run(p.Dir, p.ImportPath, nil, buildToolExec, cgoExe, "-objdir", obj, "-dynpackage", p.Name, "-dynimport", dynobj, "-dynout", importGo, cgoflags); err != nil { - return nil, nil, err - } - outGo = append(outGo, importGo) - - ofile := obj + "_all.o" - var gccObjs, nonGccObjs []string - for _, f := range outObj { - if strings.HasSuffix(f, ".o") { - gccObjs = append(gccObjs, f) - } else { - nonGccObjs = append(nonGccObjs, f) - } - } - ldflags := stringList(bareLDFLAGS, "-Wl,-r", "-nostdlib", staticLibs) - - // We are creating an object file, so we don't want a build ID. - ldflags = b.disableBuildID(ldflags) - - if err := b.gccld(p, ofile, ldflags, gccObjs); err != nil { - return nil, nil, err - } - - // NOTE(rsc): The importObj is a 5c/6c/8c object and on Windows - // must be processed before the gcc-generated objects. - // Put it first. https://golang.org/issue/2601 - outObj = stringList(nonGccObjs, ofile) - - return outGo, outObj, nil -} - -// Run SWIG on all SWIG input files. -// TODO: Don't build a shared library, once SWIG emits the necessary -// pragmas for external linking. -func (b *builder) swig(p *Package, obj string, pcCFLAGS []string) (outGo, outC, outCXX []string, err error) { - if err := b.swigVersionCheck(); err != nil { - return nil, nil, nil, err - } - - intgosize, err := b.swigIntSize(obj) - if err != nil { - return nil, nil, nil, err - } - - for _, f := range p.SwigFiles { - goFile, cFile, err := b.swigOne(p, f, obj, pcCFLAGS, false, intgosize) - if err != nil { - return nil, nil, nil, err - } - if goFile != "" { - outGo = append(outGo, goFile) - } - if cFile != "" { - outC = append(outC, cFile) - } - } - for _, f := range p.SwigCXXFiles { - goFile, cxxFile, err := b.swigOne(p, f, obj, pcCFLAGS, true, intgosize) - if err != nil { - return nil, nil, nil, err - } - if goFile != "" { - outGo = append(outGo, goFile) - } - if cxxFile != "" { - outCXX = append(outCXX, cxxFile) - } - } - return outGo, outC, outCXX, nil -} - -// Make sure SWIG is new enough. -var ( - swigCheckOnce sync.Once - swigCheck error -) - -func (b *builder) swigDoVersionCheck() error { - out, err := b.runOut("", "", nil, "swig", "-version") - if err != nil { - return err - } - re := regexp.MustCompile(`[vV]ersion +([\d]+)([.][\d]+)?([.][\d]+)?`) - matches := re.FindSubmatch(out) - if matches == nil { - // Can't find version number; hope for the best. - return nil - } - - major, err := strconv.Atoi(string(matches[1])) - if err != nil { - // Can't find version number; hope for the best. - return nil - } - const errmsg = "must have SWIG version >= 3.0.6" - if major < 3 { - return errors.New(errmsg) - } - if major > 3 { - // 4.0 or later - return nil - } - - // We have SWIG version 3.x. - if len(matches[2]) > 0 { - minor, err := strconv.Atoi(string(matches[2][1:])) - if err != nil { - return nil - } - if minor > 0 { - // 3.1 or later - return nil - } - } - - // We have SWIG version 3.0.x. - if len(matches[3]) > 0 { - patch, err := strconv.Atoi(string(matches[3][1:])) - if err != nil { - return nil - } - if patch < 6 { - // Before 3.0.6. - return errors.New(errmsg) - } - } - - return nil -} - -func (b *builder) swigVersionCheck() error { - swigCheckOnce.Do(func() { - swigCheck = b.swigDoVersionCheck() - }) - return swigCheck -} - -// This code fails to build if sizeof(int) <= 32 -const swigIntSizeCode = ` -package main -const i int = 1 << 32 -` - -// Determine the size of int on the target system for the -intgosize option -// of swig >= 2.0.9 -func (b *builder) swigIntSize(obj string) (intsize string, err error) { - if buildN { - return "$INTBITS", nil - } - src := filepath.Join(b.work, "swig_intsize.go") - if err = ioutil.WriteFile(src, []byte(swigIntSizeCode), 0644); err != nil { - return - } - srcs := []string{src} - - p := goFilesPackage(srcs) - - if _, _, e := buildToolchain.gc(b, p, "", obj, false, nil, srcs); e != nil { - return "32", nil - } - return "64", nil -} - -// Run SWIG on one SWIG input file. -func (b *builder) swigOne(p *Package, file, obj string, pcCFLAGS []string, cxx bool, intgosize string) (outGo, outC string, err error) { - cgoCPPFLAGS, cgoCFLAGS, cgoCXXFLAGS, _ := b.cflags(p, true) - var cflags []string - if cxx { - cflags = stringList(cgoCPPFLAGS, pcCFLAGS, cgoCXXFLAGS) - } else { - cflags = stringList(cgoCPPFLAGS, pcCFLAGS, cgoCFLAGS) - } - - n := 5 // length of ".swig" - if cxx { - n = 8 // length of ".swigcxx" - } - base := file[:len(file)-n] - goFile := base + ".go" - gccBase := base + "_wrap." - gccExt := "c" - if cxx { - gccExt = "cxx" - } - - _, gccgo := buildToolchain.(gccgoToolchain) - - // swig - args := []string{ - "-go", - "-cgo", - "-intgosize", intgosize, - "-module", base, - "-o", obj + gccBase + gccExt, - "-outdir", obj, - } - - for _, f := range cflags { - if len(f) > 3 && f[:2] == "-I" { - args = append(args, f) - } - } - - if gccgo { - args = append(args, "-gccgo") - if pkgpath := gccgoPkgpath(p); pkgpath != "" { - args = append(args, "-go-pkgpath", pkgpath) - } - } - if cxx { - args = append(args, "-c++") - } - - out, err := b.runOut(p.Dir, p.ImportPath, nil, "swig", args, file) - if err != nil { - if len(out) > 0 { - if bytes.Contains(out, []byte("-intgosize")) || bytes.Contains(out, []byte("-cgo")) { - return "", "", errors.New("must have SWIG version >= 3.0.6") - } - b.showOutput(p.Dir, p.ImportPath, b.processOutput(out)) // swig error - return "", "", errPrintedOutput - } - return "", "", err - } - if len(out) > 0 { - b.showOutput(p.Dir, p.ImportPath, b.processOutput(out)) // swig warning - } - - return obj + goFile, obj + gccBase + gccExt, nil -} - -// disableBuildID adjusts a linker command line to avoid creating a -// build ID when creating an object file rather than an executable or -// shared library. Some systems, such as Ubuntu, always add -// --build-id to every link, but we don't want a build ID when we are -// producing an object file. On some of those system a plain -r (not -// -Wl,-r) will turn off --build-id, but clang 3.0 doesn't support a -// plain -r. I don't know how to turn off --build-id when using clang -// other than passing a trailing --build-id=none. So that is what we -// do, but only on systems likely to support it, which is to say, -// systems that normally use gold or the GNU linker. -func (b *builder) disableBuildID(ldflags []string) []string { - switch goos { - case "android", "dragonfly", "linux", "netbsd": - ldflags = append(ldflags, "-Wl,--build-id=none") - } - return ldflags -} - -// An actionQueue is a priority queue of actions. -type actionQueue []*action - -// Implement heap.Interface -func (q *actionQueue) Len() int { return len(*q) } -func (q *actionQueue) Swap(i, j int) { (*q)[i], (*q)[j] = (*q)[j], (*q)[i] } -func (q *actionQueue) Less(i, j int) bool { return (*q)[i].priority < (*q)[j].priority } -func (q *actionQueue) Push(x interface{}) { *q = append(*q, x.(*action)) } -func (q *actionQueue) Pop() interface{} { - n := len(*q) - 1 - x := (*q)[n] - *q = (*q)[:n] - return x -} - -func (q *actionQueue) push(a *action) { - heap.Push(q, a) -} - -func (q *actionQueue) pop() *action { - return heap.Pop(q).(*action) -} - -func raceInit() { - if !buildRace { - return - } - if goarch != "amd64" || goos != "linux" && goos != "freebsd" && goos != "darwin" && goos != "windows" { - fmt.Fprintf(os.Stderr, "go %s: -race is only supported on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64\n", flag.Args()[0]) - os.Exit(2) - } - buildGcflags = append(buildGcflags, "-race") - buildLdflags = append(buildLdflags, "-race") - if buildContext.InstallSuffix != "" { - buildContext.InstallSuffix += "_" - } - buildContext.InstallSuffix += "race" - buildContext.BuildTags = append(buildContext.BuildTags, "race") -} - -// defaultSuffix returns file extension used for command files in -// current os environment. -func defaultSuffix() string { - switch runtime.GOOS { - case "windows": - return ".bat" - case "plan9": - return ".rc" - default: - return ".bash" - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/clean.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/clean.go deleted file mode 100644 index 16054a5b5bc33869a78ac1eaac2fe4a19c6a8587..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/clean.go +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" -) - -var cmdClean = &Command{ - UsageLine: "clean [-i] [-r] [-n] [-x] [build flags] [packages]", - Short: "remove object files", - Long: ` -Clean removes object files from package source directories. -The go command builds most objects in a temporary directory, -so go clean is mainly concerned with object files left by other -tools or by manual invocations of go build. - -Specifically, clean removes the following files from each of the -source directories corresponding to the import paths: - - _obj/ old object directory, left from Makefiles - _test/ old test directory, left from Makefiles - _testmain.go old gotest file, left from Makefiles - test.out old test log, left from Makefiles - build.out old test log, left from Makefiles - *.[568ao] object files, left from Makefiles - - DIR(.exe) from go build - DIR.test(.exe) from go test -c - MAINFILE(.exe) from go build MAINFILE.go - *.so from SWIG - -In the list, DIR represents the final path element of the -directory, and MAINFILE is the base name of any Go source -file in the directory that is not included when building -the package. - -The -i flag causes clean to remove the corresponding installed -archive or binary (what 'go install' would create). - -The -n flag causes clean to print the remove commands it would execute, -but not run them. - -The -r flag causes clean to be applied recursively to all the -dependencies of the packages named by the import paths. - -The -x flag causes clean to print remove commands as it executes them. - -For more about build flags, see 'go help build'. - -For more about specifying packages, see 'go help packages'. - `, -} - -var cleanI bool // clean -i flag -var cleanR bool // clean -r flag - -func init() { - // break init cycle - cmdClean.Run = runClean - - cmdClean.Flag.BoolVar(&cleanI, "i", false, "") - cmdClean.Flag.BoolVar(&cleanR, "r", false, "") - // -n and -x are important enough to be - // mentioned explicitly in the docs but they - // are part of the build flags. - - addBuildFlags(cmdClean) -} - -func runClean(cmd *Command, args []string) { - for _, pkg := range packagesAndErrors(args) { - clean(pkg) - } -} - -var cleaned = map[*Package]bool{} - -// TODO: These are dregs left by Makefile-based builds. -// Eventually, can stop deleting these. -var cleanDir = map[string]bool{ - "_test": true, - "_obj": true, -} - -var cleanFile = map[string]bool{ - "_testmain.go": true, - "test.out": true, - "build.out": true, - "a.out": true, -} - -var cleanExt = map[string]bool{ - ".5": true, - ".6": true, - ".8": true, - ".a": true, - ".o": true, - ".so": true, -} - -func clean(p *Package) { - if cleaned[p] { - return - } - cleaned[p] = true - - if p.Dir == "" { - errorf("can't load package: %v", p.Error) - return - } - dirs, err := ioutil.ReadDir(p.Dir) - if err != nil { - errorf("go clean %s: %v", p.Dir, err) - return - } - - var b builder - b.print = fmt.Print - - packageFile := map[string]bool{} - if p.Name != "main" { - // Record which files are not in package main. - // The others are. - keep := func(list []string) { - for _, f := range list { - packageFile[f] = true - } - } - keep(p.GoFiles) - keep(p.CgoFiles) - keep(p.TestGoFiles) - keep(p.XTestGoFiles) - } - - _, elem := filepath.Split(p.Dir) - var allRemove []string - - // Remove dir-named executable only if this is package main. - if p.Name == "main" { - allRemove = append(allRemove, - elem, - elem+".exe", - ) - } - - // Remove package test executables. - allRemove = append(allRemove, - elem+".test", - elem+".test.exe", - ) - - // Remove a potential executable for each .go file in the directory that - // is not part of the directory's package. - for _, dir := range dirs { - name := dir.Name() - if packageFile[name] { - continue - } - if !dir.IsDir() && strings.HasSuffix(name, ".go") { - // TODO(adg,rsc): check that this .go file is actually - // in "package main", and therefore capable of building - // to an executable file. - base := name[:len(name)-len(".go")] - allRemove = append(allRemove, base, base+".exe") - } - } - - if buildN || buildX { - b.showcmd(p.Dir, "rm -f %s", strings.Join(allRemove, " ")) - } - - toRemove := map[string]bool{} - for _, name := range allRemove { - toRemove[name] = true - } - for _, dir := range dirs { - name := dir.Name() - if dir.IsDir() { - // TODO: Remove once Makefiles are forgotten. - if cleanDir[name] { - if buildN || buildX { - b.showcmd(p.Dir, "rm -r %s", name) - if buildN { - continue - } - } - if err := os.RemoveAll(filepath.Join(p.Dir, name)); err != nil { - errorf("go clean: %v", err) - } - } - continue - } - - if buildN { - continue - } - - if cleanFile[name] || cleanExt[filepath.Ext(name)] || toRemove[name] { - removeFile(filepath.Join(p.Dir, name)) - } - } - - if cleanI && p.target != "" { - if buildN || buildX { - b.showcmd("", "rm -f %s", p.target) - } - if !buildN { - removeFile(p.target) - } - } - - if cleanR { - for _, p1 := range p.imports { - clean(p1) - } - } -} - -// removeFile tries to remove file f, if error other than file doesn't exist -// occurs, it will report the error. -func removeFile(f string) { - err := os.Remove(f) - if err == nil || os.IsNotExist(err) { - return - } - // Windows does not allow deletion of a binary file while it is executing. - if toolIsWindows { - // Remove lingering ~ file from last attempt. - if _, err2 := os.Stat(f + "~"); err2 == nil { - os.Remove(f + "~") - } - // Try to move it out of the way. If the move fails, - // which is likely, we'll try again the - // next time we do an install of this binary. - if err2 := os.Rename(f, f+"~"); err2 == nil { - os.Remove(f + "~") - return - } - } - errorf("go clean: %v", err) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/context.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/context.go deleted file mode 100644 index 68e518259f45b3798db7e738808ca0aafc038b37..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/context.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "go/build" -) - -type Context struct { - GOARCH string `json:",omitempty"` // target architecture - GOOS string `json:",omitempty"` // target operating system - GOROOT string `json:",omitempty"` // Go root - GOPATH string `json:",omitempty"` // Go path - CgoEnabled bool `json:",omitempty"` // whether cgo can be used - UseAllFiles bool `json:",omitempty"` // use files regardless of +build lines, file names - Compiler string `json:",omitempty"` // compiler to assume when computing target paths - BuildTags []string `json:",omitempty"` // build constraints to match in +build lines - ReleaseTags []string `json:",omitempty"` // releases the current release is compatible with - InstallSuffix string `json:",omitempty"` // suffix to use in the name of the install dir -} - -func newContext(c *build.Context) *Context { - return &Context{ - GOARCH: c.GOARCH, - GOOS: c.GOOS, - GOROOT: c.GOROOT, - CgoEnabled: c.CgoEnabled, - UseAllFiles: c.UseAllFiles, - Compiler: c.Compiler, - BuildTags: c.BuildTags, - ReleaseTags: c.ReleaseTags, - InstallSuffix: c.InstallSuffix, - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/discovery.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/discovery.go deleted file mode 100644 index b9f42799546e306f8f3762d00d2c6d273d3e50a2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/discovery.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !cmd_go_bootstrap - -// This code is compiled into the real 'go' binary, but it is not -// compiled into the binary that is built during all.bash, so as -// to avoid needing to build net (and thus use cgo) during the -// bootstrap process. - -package main - -import ( - "encoding/xml" - "fmt" - "io" - "strings" -) - -// charsetReader returns a reader for the given charset. Currently -// it only supports UTF-8 and ASCII. Otherwise, it returns a meaningful -// error which is printed by go get, so the user can find why the package -// wasn't downloaded if the encoding is not supported. Note that, in -// order to reduce potential errors, ASCII is treated as UTF-8 (i.e. characters -// greater than 0x7f are not rejected). -func charsetReader(charset string, input io.Reader) (io.Reader, error) { - switch strings.ToLower(charset) { - case "ascii": - return input, nil - default: - return nil, fmt.Errorf("can't decode XML document using charset %q", charset) - } -} - -// parseMetaGoImports returns meta imports from the HTML in r. -// Parsing ends at the end of the section or the beginning of the . -func parseMetaGoImports(r io.Reader) (imports []metaImport, err error) { - d := xml.NewDecoder(r) - d.CharsetReader = charsetReader - d.Strict = false - var t xml.Token - for { - t, err = d.Token() - if err != nil { - if err == io.EOF { - err = nil - } - return - } - if e, ok := t.(xml.StartElement); ok && strings.EqualFold(e.Name.Local, "body") { - return - } - if e, ok := t.(xml.EndElement); ok && strings.EqualFold(e.Name.Local, "head") { - return - } - e, ok := t.(xml.StartElement) - if !ok || !strings.EqualFold(e.Name.Local, "meta") { - continue - } - if attrValue(e.Attr, "name") != "go-import" { - continue - } - if f := strings.Fields(attrValue(e.Attr, "content")); len(f) == 3 { - imports = append(imports, metaImport{ - Prefix: f[0], - VCS: f[1], - RepoRoot: f[2], - }) - } - } -} - -// attrValue returns the attribute value for the case-insensitive key -// `name', or the empty string if nothing is found. -func attrValue(attrs []xml.Attr, name string) string { - for _, a := range attrs { - if strings.EqualFold(a.Name.Local, name) { - return a.Value - } - } - return "" -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/doc.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/doc.go deleted file mode 100644 index 4a07dfe11f4e76a76a3aa6feceaa55c964ccf367..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/doc.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -var cmdDoc = &Command{ - Run: runDoc, - UsageLine: "doc [-u] [-c] [package|[package.]symbol[.method]]", - CustomFlags: true, - Short: "show documentation for package or symbol", - Long: ` -Doc prints the documentation comments associated with the item identified by its -arguments (a package, const, func, type, var, or method) followed by a one-line -summary of each of the first-level items "under" that item (package-level -declarations for a package, methods for a type, etc.). - -Doc accepts zero, one, or two arguments. - -Given no arguments, that is, when run as - - go doc - -it prints the package documentation for the package in the current directory. -If the package is a command (package main), the exported symbols of the package -are elided from the presentation unless the -cmd flag is provided. - -When run with one argument, the argument is treated as a Go-syntax-like -representation of the item to be documented. What the argument selects depends -on what is installed in GOROOT and GOPATH, as well as the form of the argument, -which is schematically one of these: - - go doc - go doc [.] - go doc [].[.] - -The first item in this list matched by the argument is the one whose -documentation is printed. (See the examples below.) For packages, the order of -scanning is determined lexically, but the GOROOT tree is always scanned before -GOPATH. - -If there is no package specified or matched, the package in the current -directory is selected, so "go doc Foo" shows the documentation for symbol Foo in -the current package. - -The package path must be either a qualified path or a proper suffix of a -path. The go tool's usual package mechanism does not apply: package path -elements like . and ... are not implemented by go doc. - -When run with two arguments, the first must be a full package path (not just a -suffix), and the second is a symbol or symbol and method; this is similar to the -syntax accepted by godoc: - - go doc [.] - -In all forms, when matching symbols, lower-case letters in the argument match -either case but upper-case letters match exactly. This means that there may be -multiple matches of a lower-case argument in a package if different symbols have -different cases. If this occurs, documentation for all matches is printed. - -Examples: - go doc - Show documentation for current package. - go doc Foo - Show documentation for Foo in the current package. - (Foo starts with a capital letter so it cannot match - a package path.) - go doc encoding/json - Show documentation for the encoding/json package. - go doc json - Shorthand for encoding/json. - go doc json.Number (or go doc json.number) - Show documentation and method summary for json.Number. - go doc json.Number.Int64 (or go doc json.number.int64) - Show documentation for json.Number's Int64 method. - go doc cmd/doc - Show package docs for the doc command. - go doc -cmd cmd/doc - Show package docs and exported symbols within the doc command. - go doc template.new - Show documentation for html/template's New function. - (html/template is lexically before text/template) - go doc text/template.new # One argument - Show documentation for text/template's New function. - go doc text/template new # Two arguments - Show documentation for text/template's New function. - -Flags: - -c - Respect case when matching symbols. - -cmd - Treat a command (package main) like a regular package. - Otherwise package main's exported symbols are hidden - when showing the package's top-level documentation. - -u - Show documentation for unexported as well as exported - symbols and methods. -`, -} - -func runDoc(cmd *Command, args []string) { - run(buildToolExec, tool("doc"), args) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/env.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/env.go deleted file mode 100644 index 600accac03f2767bf086d45b8a94ec5313d8d123..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/env.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "os" - "runtime" - "strings" -) - -var cmdEnv = &Command{ - Run: runEnv, - UsageLine: "env [var ...]", - Short: "print Go environment information", - Long: ` -Env prints Go environment information. - -By default env prints information as a shell script -(on Windows, a batch file). If one or more variable -names is given as arguments, env prints the value of -each named variable on its own line. - `, -} - -type envVar struct { - name, value string -} - -func mkEnv() []envVar { - var b builder - b.init() - - env := []envVar{ - {"GOARCH", goarch}, - {"GOBIN", gobin}, - {"GOEXE", exeSuffix}, - {"GOHOSTARCH", runtime.GOARCH}, - {"GOHOSTOS", runtime.GOOS}, - {"GOOS", goos}, - {"GOPATH", os.Getenv("GOPATH")}, - {"GORACE", os.Getenv("GORACE")}, - {"GOROOT", goroot}, - {"GOTOOLDIR", toolDir}, - {"GO15VENDOREXPERIMENT", os.Getenv("GO15VENDOREXPERIMENT")}, - - // disable escape codes in clang errors - {"TERM", "dumb"}, - } - - if goos != "plan9" { - cmd := b.gccCmd(".") - env = append(env, envVar{"CC", cmd[0]}) - env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")}) - cmd = b.gxxCmd(".") - env = append(env, envVar{"CXX", cmd[0]}) - } - - if buildContext.CgoEnabled { - env = append(env, envVar{"CGO_ENABLED", "1"}) - } else { - env = append(env, envVar{"CGO_ENABLED", "0"}) - } - - return env -} - -func findEnv(env []envVar, name string) string { - for _, e := range env { - if e.name == name { - return e.value - } - } - return "" -} - -func runEnv(cmd *Command, args []string) { - env := mkEnv() - if len(args) > 0 { - for _, name := range args { - fmt.Printf("%s\n", findEnv(env, name)) - } - return - } - - for _, e := range env { - if e.name != "TERM" { - switch runtime.GOOS { - default: - fmt.Printf("%s=\"%s\"\n", e.name, e.value) - case "plan9": - if strings.IndexByte(e.value, '\x00') < 0 { - fmt.Printf("%s='%s'\n", e.name, strings.Replace(e.value, "'", "''", -1)) - } else { - v := strings.Split(e.value, "\x00") - fmt.Printf("%s=(", e.name) - for x, s := range v { - if x > 0 { - fmt.Printf(" ") - } - fmt.Printf("%s", s) - } - fmt.Printf(")\n") - } - case "windows": - fmt.Printf("set %s=%s\n", e.name, e.value) - } - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/fix.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/fix.go deleted file mode 100644 index 94fd22e3c2150ec64d4840d15a262e025968a463..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/fix.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -var cmdFix = &Command{ - Run: runFix, - UsageLine: "fix [packages]", - Short: "run go tool fix on packages", - Long: ` -Fix runs the Go fix command on the packages named by the import paths. - -For more about fix, see 'go doc cmd/fix'. -For more about specifying packages, see 'go help packages'. - -To run fix with specific options, run 'go tool fix'. - -See also: go fmt, go vet. - `, -} - -func runFix(cmd *Command, args []string) { - for _, pkg := range packages(args) { - // Use pkg.gofiles instead of pkg.Dir so that - // the command only applies to this package, - // not to packages in subdirectories. - run(stringList(buildToolExec, tool("fix"), relPaths(pkg.allgofiles))) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/fmt.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/fmt.go deleted file mode 100644 index 57c02ad26477f483c4fe3422809076a7a32070d4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/fmt.go +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "os" - "path/filepath" -) - -func init() { - addBuildFlagsNX(cmdFmt) -} - -var cmdFmt = &Command{ - Run: runFmt, - UsageLine: "fmt [-n] [-x] [packages]", - Short: "run gofmt on package sources", - Long: ` -Fmt runs the command 'gofmt -l -w' on the packages named -by the import paths. It prints the names of the files that are modified. - -For more about gofmt, see 'go doc cmd/gofmt'. -For more about specifying packages, see 'go help packages'. - -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -To run gofmt with specific options, run gofmt itself. - -See also: go fix, go vet. - `, -} - -func runFmt(cmd *Command, args []string) { - gofmt := gofmtPath() - for _, pkg := range packages(args) { - // Use pkg.gofiles instead of pkg.Dir so that - // the command only applies to this package, - // not to packages in subdirectories. - run(stringList(gofmt, "-l", "-w", relPaths(pkg.allgofiles))) - } -} - -func gofmtPath() string { - gofmt := "gofmt" - if toolIsWindows { - gofmt += toolWindowsExtension - } - - gofmtPath := filepath.Join(gobin, gofmt) - if _, err := os.Stat(gofmtPath); err == nil { - return gofmtPath - } - - gofmtPath = filepath.Join(goroot, "bin", gofmt) - if _, err := os.Stat(gofmtPath); err == nil { - return gofmtPath - } - - // fallback to looking for gofmt in $PATH - return "gofmt" -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/generate.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/generate.go deleted file mode 100644 index efdc229b2281a2e0463e12d4308c85299ed56c74..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/generate.go +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bufio" - "bytes" - "fmt" - "io" - "log" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strconv" - "strings" - "unicode" -) - -var cmdGenerate = &Command{ - Run: runGenerate, - UsageLine: "generate [-run regexp] [file.go... | packages]", - Short: "generate Go files by processing source", - Long: ` -Generate runs commands described by directives within existing -files. Those commands can run any process but the intent is to -create or update Go source files, for instance by running yacc. - -Go generate is never run automatically by go build, go get, go test, -and so on. It must be run explicitly. - -Go generate scans the file for directives, which are lines of -the form, - - //go:generate command argument... - -(note: no leading spaces and no space in "//go") where command -is the generator to be run, corresponding to an executable file -that can be run locally. It must either be in the shell path -(gofmt), a fully qualified path (/usr/you/bin/mytool), or a -command alias, described below. - -Note that go generate does not parse the file, so lines that look -like directives in comments or multiline strings will be treated -as directives. - -The arguments to the directive are space-separated tokens or -double-quoted strings passed to the generator as individual -arguments when it is run. - -Quoted strings use Go syntax and are evaluated before execution; a -quoted string appears as a single argument to the generator. - -Go generate sets several variables when it runs the generator: - - $GOARCH - The execution architecture (arm, amd64, etc.) - $GOOS - The execution operating system (linux, windows, etc.) - $GOFILE - The base name of the file. - $GOLINE - The line number of the directive in the source file. - $GOPACKAGE - The name of the package of the file containing the directive. - $DOLLAR - A dollar sign. - -Other than variable substitution and quoted-string evaluation, no -special processing such as "globbing" is performed on the command -line. - -As a last step before running the command, any invocations of any -environment variables with alphanumeric names, such as $GOFILE or -$HOME, are expanded throughout the command line. The syntax for -variable expansion is $NAME on all operating systems. Due to the -order of evaluation, variables are expanded even inside quoted -strings. If the variable NAME is not set, $NAME expands to the -empty string. - -A directive of the form, - - //go:generate -command xxx args... - -specifies, for the remainder of this source file only, that the -string xxx represents the command identified by the arguments. This -can be used to create aliases or to handle multiword generators. -For example, - - //go:generate -command yacc go tool yacc - -specifies that the command "yacc" represents the generator -"go tool yacc". - -Generate processes packages in the order given on the command line, -one at a time. If the command line lists .go files, they are treated -as a single package. Within a package, generate processes the -source files in a package in file name order, one at a time. Within -a source file, generate runs generators in the order they appear -in the file, one at a time. - -If any generator returns an error exit status, "go generate" skips -all further processing for that package. - -The generator is run in the package's source directory. - -Go generate accepts one specific flag: - - -run="" - if non-empty, specifies a regular expression to select - directives whose full original source text (excluding - any trailing spaces and final newline) matches the - expression. - -It also accepts the standard build flags -v, -n, and -x. -The -v flag prints the names of packages and files as they are -processed. -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -For more about specifying packages, see 'go help packages'. - `, -} - -var ( - generateRunFlag string // generate -run flag - generateRunRE *regexp.Regexp // compiled expression for -run -) - -func init() { - addBuildFlags(cmdGenerate) - cmdGenerate.Flag.StringVar(&generateRunFlag, "run", "", "") -} - -func runGenerate(cmd *Command, args []string) { - if generateRunFlag != "" { - var err error - generateRunRE, err = regexp.Compile(generateRunFlag) - if err != nil { - log.Fatalf("generate: %s", err) - } - } - // Even if the arguments are .go files, this loop suffices. - for _, pkg := range packages(args) { - for _, file := range pkg.gofiles { - if !generate(pkg.Name, file) { - break - } - } - } -} - -// generate runs the generation directives for a single file. -func generate(pkg, absFile string) bool { - fd, err := os.Open(absFile) - if err != nil { - log.Fatalf("generate: %s", err) - } - defer fd.Close() - g := &Generator{ - r: fd, - path: absFile, - pkg: pkg, - commands: make(map[string][]string), - } - return g.run() -} - -// A Generator represents the state of a single Go source file -// being scanned for generator commands. -type Generator struct { - r io.Reader - path string // full rooted path name. - dir string // full rooted directory of file. - file string // base name of file. - pkg string - commands map[string][]string - lineNum int // current line number. -} - -// run runs the generators in the current file. -func (g *Generator) run() (ok bool) { - // Processing below here calls g.errorf on failure, which does panic(stop). - // If we encounter an error, we abort the package. - defer func() { - e := recover() - if e != nil { - ok = false - if e != stop { - panic(e) - } - setExitStatus(1) - } - }() - g.dir, g.file = filepath.Split(g.path) - g.dir = filepath.Clean(g.dir) // No final separator please. - if buildV { - fmt.Fprintf(os.Stderr, "%s\n", shortPath(g.path)) - } - - // Scan for lines that start "//go:generate". - // Can't use bufio.Scanner because it can't handle long lines, - // which are likely to appear when using generate. - input := bufio.NewReader(g.r) - var err error - // One line per loop. - for { - g.lineNum++ // 1-indexed. - var buf []byte - buf, err = input.ReadSlice('\n') - if err == bufio.ErrBufferFull { - // Line too long - consume and ignore. - if isGoGenerate(buf) { - g.errorf("directive too long") - } - for err == bufio.ErrBufferFull { - _, err = input.ReadSlice('\n') - } - if err != nil { - break - } - continue - } - - if err != nil { - // Check for marker at EOF without final \n. - if err == io.EOF && isGoGenerate(buf) { - err = io.ErrUnexpectedEOF - } - break - } - - if !isGoGenerate(buf) { - continue - } - if generateRunFlag != "" { - if !generateRunRE.Match(bytes.TrimSpace(buf)) { - continue - } - } - - words := g.split(string(buf)) - if len(words) == 0 { - g.errorf("no arguments to directive") - } - if words[0] == "-command" { - g.setShorthand(words) - continue - } - // Run the command line. - if buildN || buildX { - fmt.Fprintf(os.Stderr, "%s\n", strings.Join(words, " ")) - } - if buildN { - continue - } - g.exec(words) - } - if err != nil && err != io.EOF { - g.errorf("error reading %s: %s", shortPath(g.path), err) - } - return true -} - -func isGoGenerate(buf []byte) bool { - return bytes.HasPrefix(buf, []byte("//go:generate ")) || bytes.HasPrefix(buf, []byte("//go:generate\t")) -} - -// split breaks the line into words, evaluating quoted -// strings and evaluating environment variables. -// The initial //go:generate element is present in line. -func (g *Generator) split(line string) []string { - // Parse line, obeying quoted strings. - var words []string - line = line[len("//go:generate ") : len(line)-1] // Drop preamble and final newline. - // There may still be a carriage return. - if len(line) > 0 && line[len(line)-1] == '\r' { - line = line[:len(line)-1] - } - // One (possibly quoted) word per iteration. -Words: - for { - line = strings.TrimLeft(line, " \t") - if len(line) == 0 { - break - } - if line[0] == '"' { - for i := 1; i < len(line); i++ { - c := line[i] // Only looking for ASCII so this is OK. - switch c { - case '\\': - if i+1 == len(line) { - g.errorf("bad backslash") - } - i++ // Absorb next byte (If it's a multibyte we'll get an error in Unquote). - case '"': - word, err := strconv.Unquote(line[0 : i+1]) - if err != nil { - g.errorf("bad quoted string") - } - words = append(words, word) - line = line[i+1:] - // Check the next character is space or end of line. - if len(line) > 0 && line[0] != ' ' && line[0] != '\t' { - g.errorf("expect space after quoted argument") - } - continue Words - } - } - g.errorf("mismatched quoted string") - } - i := strings.IndexAny(line, " \t") - if i < 0 { - i = len(line) - } - words = append(words, line[0:i]) - line = line[i:] - } - // Substitute command if required. - if len(words) > 0 && g.commands[words[0]] != nil { - // Replace 0th word by command substitution. - words = append(g.commands[words[0]], words[1:]...) - } - // Substitute environment variables. - for i, word := range words { - words[i] = os.Expand(word, g.expandVar) - } - return words -} - -var stop = fmt.Errorf("error in generation") - -// errorf logs an error message prefixed with the file and line number. -// It then exits the program (with exit status 1) because generation stops -// at the first error. -func (g *Generator) errorf(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, "%s:%d: %s\n", shortPath(g.path), g.lineNum, - fmt.Sprintf(format, args...)) - panic(stop) -} - -// expandVar expands the $XXX invocation in word. It is called -// by os.Expand. -func (g *Generator) expandVar(word string) string { - switch word { - case "GOARCH": - return buildContext.GOARCH - case "GOOS": - return buildContext.GOOS - case "GOFILE": - return g.file - case "GOLINE": - return fmt.Sprint(g.lineNum) - case "GOPACKAGE": - return g.pkg - case "DOLLAR": - return "$" - default: - return os.Getenv(word) - } -} - -// identLength returns the length of the identifier beginning the string. -func (g *Generator) identLength(word string) int { - for i, r := range word { - if r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r) { - continue - } - return i - } - return len(word) -} - -// setShorthand installs a new shorthand as defined by a -command directive. -func (g *Generator) setShorthand(words []string) { - // Create command shorthand. - if len(words) == 1 { - g.errorf("no command specified for -command") - } - command := words[1] - if g.commands[command] != nil { - g.errorf("command %q defined multiply defined", command) - } - g.commands[command] = words[2:len(words):len(words)] // force later append to make copy -} - -// exec runs the command specified by the argument. The first word is -// the command name itself. -func (g *Generator) exec(words []string) { - cmd := exec.Command(words[0], words[1:]...) - // Standard in and out of generator should be the usual. - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - // Run the command in the package directory. - cmd.Dir = g.dir - env := []string{ - "GOARCH=" + runtime.GOARCH, - "GOOS=" + runtime.GOOS, - "GOFILE=" + g.file, - "GOPACKAGE=" + g.pkg, - } - cmd.Env = mergeEnvLists(env, origEnv) - err := cmd.Run() - if err != nil { - g.errorf("running %q: %s", words[0], err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/generate_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/generate_test.go deleted file mode 100644 index 169d71ca812b7515e12a3c5909f21dce38b9cf02..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/generate_test.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "reflect" - "runtime" - "testing" -) - -type splitTest struct { - in string - out []string -} - -var splitTests = []splitTest{ - {"", nil}, - {"x", []string{"x"}}, - {" a b\tc ", []string{"a", "b", "c"}}, - {` " a " `, []string{" a "}}, - {"$GOARCH", []string{runtime.GOARCH}}, - {"$GOOS", []string{runtime.GOOS}}, - {"$GOFILE", []string{"proc.go"}}, - {"$GOPACKAGE", []string{"sys"}}, - {"a $XXNOTDEFINEDXX b", []string{"a", "", "b"}}, - {"/$XXNOTDEFINED/", []string{"//"}}, - {"/$DOLLAR/", []string{"/$/"}}, - {"yacc -o $GOARCH/yacc_$GOFILE", []string{"go", "tool", "yacc", "-o", runtime.GOARCH + "/yacc_proc.go"}}, -} - -func TestGenerateCommandParse(t *testing.T) { - g := &Generator{ - r: nil, // Unused here. - path: "/usr/ken/sys/proc.go", - dir: "/usr/ken/sys", - file: "proc.go", - pkg: "sys", - commands: make(map[string][]string), - } - g.setShorthand([]string{"-command", "yacc", "go", "tool", "yacc"}) - for _, test := range splitTests { - // First with newlines. - got := g.split("//go:generate " + test.in + "\n") - if !reflect.DeepEqual(got, test.out) { - t.Errorf("split(%q): got %q expected %q", test.in, got, test.out) - } - // Then with CRLFs, thank you Windows. - got = g.split("//go:generate " + test.in + "\r\n") - if !reflect.DeepEqual(got, test.out) { - t.Errorf("split(%q): got %q expected %q", test.in, got, test.out) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/get.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/get.go deleted file mode 100644 index e95201a69307b040de55a24082c37701c20b6a40..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/get.go +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "go/build" - "os" - "path/filepath" - "regexp" - "runtime" - "strconv" - "strings" -) - -var cmdGet = &Command{ - UsageLine: "get [-d] [-f] [-fix] [-insecure] [-t] [-u] [build flags] [packages]", - Short: "download and install packages and dependencies", - Long: ` -Get downloads and installs the packages named by the import paths, -along with their dependencies. - -The -d flag instructs get to stop after downloading the packages; that is, -it instructs get not to install the packages. - -The -f flag, valid only when -u is set, forces get -u not to verify that -each package has been checked out from the source control repository -implied by its import path. This can be useful if the source is a local fork -of the original. - -The -fix flag instructs get to run the fix tool on the downloaded packages -before resolving dependencies or building the code. - -The -insecure flag permits fetching from repositories and resolving -custom domains using insecure schemes such as HTTP. Use with caution. - -The -t flag instructs get to also download the packages required to build -the tests for the specified packages. - -The -u flag instructs get to use the network to update the named packages -and their dependencies. By default, get uses the network to check out -missing packages but does not use it to look for updates to existing packages. - -Get also accepts build flags to control the installation. See 'go help build'. - -When checking out or updating a package, get looks for a branch or tag -that matches the locally installed version of Go. The most important -rule is that if the local installation is running version "go1", get -searches for a branch or tag named "go1". If no such version exists it -retrieves the most recent version of the package. - -If the vendoring experiment is enabled (see 'go help gopath'), -then when go get checks out or updates a Git repository, -it also updates any git submodules referenced by the repository. - -For more about specifying packages, see 'go help packages'. - -For more about how 'go get' finds source code to -download, see 'go help importpath'. - -See also: go build, go install, go clean. - `, -} - -var getD = cmdGet.Flag.Bool("d", false, "") -var getF = cmdGet.Flag.Bool("f", false, "") -var getT = cmdGet.Flag.Bool("t", false, "") -var getU = cmdGet.Flag.Bool("u", false, "") -var getFix = cmdGet.Flag.Bool("fix", false, "") -var getInsecure = cmdGet.Flag.Bool("insecure", false, "") - -func init() { - addBuildFlags(cmdGet) - cmdGet.Run = runGet // break init loop -} - -func runGet(cmd *Command, args []string) { - if *getF && !*getU { - fatalf("go get: cannot use -f flag without -u") - } - - // Disable any prompting for passwords by Git. - // Only has an effect for 2.3.0 or later, but avoiding - // the prompt in earlier versions is just too hard. - // See golang.org/issue/9341. - os.Setenv("GIT_TERMINAL_PROMPT", "0") - - // Phase 1. Download/update. - var stk importStack - mode := 0 - if *getT { - mode |= getTestDeps - } - for _, arg := range downloadPaths(args) { - download(arg, nil, &stk, mode) - } - exitIfErrors() - - // Phase 2. Rescan packages and re-evaluate args list. - - // Code we downloaded and all code that depends on it - // needs to be evicted from the package cache so that - // the information will be recomputed. Instead of keeping - // track of the reverse dependency information, evict - // everything. - for name := range packageCache { - delete(packageCache, name) - } - - args = importPaths(args) - packagesForBuild(args) - - // Phase 3. Install. - if *getD { - // Download only. - // Check delayed until now so that importPaths - // and packagesForBuild have a chance to print errors. - return - } - - runInstall(cmd, args) -} - -// downloadPaths prepares the list of paths to pass to download. -// It expands ... patterns that can be expanded. If there is no match -// for a particular pattern, downloadPaths leaves it in the result list, -// in the hope that we can figure out the repository from the -// initial ...-free prefix. -func downloadPaths(args []string) []string { - args = importPathsNoDotExpansion(args) - var out []string - for _, a := range args { - if strings.Contains(a, "...") { - var expand []string - // Use matchPackagesInFS to avoid printing - // warnings. They will be printed by the - // eventual call to importPaths instead. - if build.IsLocalImport(a) { - expand = matchPackagesInFS(a) - } else { - expand = matchPackages(a) - } - if len(expand) > 0 { - out = append(out, expand...) - continue - } - } - out = append(out, a) - } - return out -} - -// downloadCache records the import paths we have already -// considered during the download, to avoid duplicate work when -// there is more than one dependency sequence leading to -// a particular package. -var downloadCache = map[string]bool{} - -// downloadRootCache records the version control repository -// root directories we have already considered during the download. -// For example, all the packages in the code.google.com/p/codesearch repo -// share the same root (the directory for that path), and we only need -// to run the hg commands to consider each repository once. -var downloadRootCache = map[string]bool{} - -// download runs the download half of the get command -// for the package named by the argument. -func download(arg string, parent *Package, stk *importStack, mode int) { - load := func(path string, mode int) *Package { - if parent == nil { - return loadPackage(path, stk) - } - return loadImport(path, parent.Dir, parent, stk, nil, mode) - } - - p := load(arg, mode) - if p.Error != nil && p.Error.hard { - errorf("%s", p.Error) - return - } - - // loadPackage inferred the canonical ImportPath from arg. - // Use that in the following to prevent hysteresis effects - // in e.g. downloadCache and packageCache. - // This allows invocations such as: - // mkdir -p $GOPATH/src/github.com/user - // cd $GOPATH/src/github.com/user - // go get ./foo - // see: golang.org/issue/9767 - arg = p.ImportPath - - // There's nothing to do if this is a package in the standard library. - if p.Standard { - return - } - - // Only process each package once. - // (Unless we're fetching test dependencies for this package, - // in which case we want to process it again.) - if downloadCache[arg] && mode&getTestDeps == 0 { - return - } - downloadCache[arg] = true - - pkgs := []*Package{p} - wildcardOkay := len(*stk) == 0 - isWildcard := false - - // Download if the package is missing, or update if we're using -u. - if p.Dir == "" || *getU { - // The actual download. - stk.push(arg) - err := downloadPackage(p) - if err != nil { - errorf("%s", &PackageError{ImportStack: stk.copy(), Err: err.Error()}) - stk.pop() - return - } - - // Warn that code.google.com is shutting down. We - // issue the warning here because this is where we - // have the import stack. - if strings.HasPrefix(p.ImportPath, "code.google.com") { - fmt.Fprintf(os.Stderr, "warning: code.google.com is shutting down; import path %v will stop working\n", p.ImportPath) - if len(*stk) > 1 { - fmt.Fprintf(os.Stderr, "warning: package %v\n", strings.Join(*stk, "\n\timports ")) - } - } - stk.pop() - - args := []string{arg} - // If the argument has a wildcard in it, re-evaluate the wildcard. - // We delay this until after reloadPackage so that the old entry - // for p has been replaced in the package cache. - if wildcardOkay && strings.Contains(arg, "...") { - if build.IsLocalImport(arg) { - args = matchPackagesInFS(arg) - } else { - args = matchPackages(arg) - } - isWildcard = true - } - - // Clear all relevant package cache entries before - // doing any new loads. - for _, arg := range args { - p := packageCache[arg] - if p != nil { - delete(packageCache, p.Dir) - delete(packageCache, p.ImportPath) - } - } - - pkgs = pkgs[:0] - for _, arg := range args { - // Note: load calls loadPackage or loadImport, - // which push arg onto stk already. - // Do not push here too, or else stk will say arg imports arg. - p := load(arg, mode) - if p.Error != nil { - errorf("%s", p.Error) - continue - } - pkgs = append(pkgs, p) - } - } - - // Process package, which might now be multiple packages - // due to wildcard expansion. - for _, p := range pkgs { - if *getFix { - run(buildToolExec, stringList(tool("fix"), relPaths(p.allgofiles))) - - // The imports might have changed, so reload again. - p = reloadPackage(arg, stk) - if p.Error != nil { - errorf("%s", p.Error) - return - } - } - - if isWildcard { - // Report both the real package and the - // wildcard in any error message. - stk.push(p.ImportPath) - } - - // Process dependencies, now that we know what they are. - for _, path := range p.Imports { - if path == "C" { - continue - } - // Don't get test dependencies recursively. - // Imports is already vendor-expanded. - download(path, p, stk, 0) - } - if mode&getTestDeps != 0 { - // Process test dependencies when -t is specified. - // (Don't get test dependencies for test dependencies.) - // We pass useVendor here because p.load does not - // vendor-expand TestImports and XTestImports. - // The call to loadImport inside download needs to do that. - for _, path := range p.TestImports { - if path == "C" { - continue - } - download(path, p, stk, useVendor) - } - for _, path := range p.XTestImports { - if path == "C" { - continue - } - download(path, p, stk, useVendor) - } - } - - if isWildcard { - stk.pop() - } - } -} - -// downloadPackage runs the create or download command -// to make the first copy of or update a copy of the given package. -func downloadPackage(p *Package) error { - var ( - vcs *vcsCmd - repo, rootPath string - err error - ) - - security := secure - if *getInsecure { - security = insecure - } - - if p.build.SrcRoot != "" { - // Directory exists. Look for checkout along path to src. - vcs, rootPath, err = vcsForDir(p) - if err != nil { - return err - } - repo = "" // should be unused; make distinctive - - // Double-check where it came from. - if *getU && vcs.remoteRepo != nil { - dir := filepath.Join(p.build.SrcRoot, rootPath) - remote, err := vcs.remoteRepo(vcs, dir) - if err != nil { - return err - } - repo = remote - if !*getF { - if rr, err := repoRootForImportPath(p.ImportPath, security); err == nil { - repo := rr.repo - if rr.vcs.resolveRepo != nil { - resolved, err := rr.vcs.resolveRepo(rr.vcs, dir, repo) - if err == nil { - repo = resolved - } - } - if remote != repo && p.ImportComment != "" { - return fmt.Errorf("%s is a custom import path for %s, but %s is checked out from %s", rr.root, repo, dir, remote) - } - } - } - } - } else { - // Analyze the import path to determine the version control system, - // repository, and the import path for the root of the repository. - rr, err := repoRootForImportPath(p.ImportPath, security) - if err != nil { - return err - } - vcs, repo, rootPath = rr.vcs, rr.repo, rr.root - } - if !vcs.isSecure(repo) && !*getInsecure { - return fmt.Errorf("cannot download, %v uses insecure protocol", repo) - } - - if p.build.SrcRoot == "" { - // Package not found. Put in first directory of $GOPATH. - list := filepath.SplitList(buildContext.GOPATH) - if len(list) == 0 { - return fmt.Errorf("cannot download, $GOPATH not set. For more details see: go help gopath") - } - // Guard against people setting GOPATH=$GOROOT. - if list[0] == goroot { - return fmt.Errorf("cannot download, $GOPATH must not be set to $GOROOT. For more details see: go help gopath") - } - p.build.SrcRoot = filepath.Join(list[0], "src") - p.build.PkgRoot = filepath.Join(list[0], "pkg") - } - root := filepath.Join(p.build.SrcRoot, rootPath) - // If we've considered this repository already, don't do it again. - if downloadRootCache[root] { - return nil - } - downloadRootCache[root] = true - - if buildV { - fmt.Fprintf(os.Stderr, "%s (download)\n", rootPath) - } - - // Check that this is an appropriate place for the repo to be checked out. - // The target directory must either not exist or have a repo checked out already. - meta := filepath.Join(root, "."+vcs.cmd) - st, err := os.Stat(meta) - if err == nil && !st.IsDir() { - return fmt.Errorf("%s exists but is not a directory", meta) - } - if err != nil { - // Metadata directory does not exist. Prepare to checkout new copy. - // Some version control tools require the target directory not to exist. - // We require that too, just to avoid stepping on existing work. - if _, err := os.Stat(root); err == nil { - return fmt.Errorf("%s exists but %s does not - stale checkout?", root, meta) - } - // Some version control tools require the parent of the target to exist. - parent, _ := filepath.Split(root) - if err = os.MkdirAll(parent, 0777); err != nil { - return err - } - if err = vcs.create(root, repo); err != nil { - return err - } - } else { - // Metadata directory does exist; download incremental updates. - if err = vcs.download(root); err != nil { - return err - } - } - - if buildN { - // Do not show tag sync in -n; it's noise more than anything, - // and since we're not running commands, no tag will be found. - // But avoid printing nothing. - fmt.Fprintf(os.Stderr, "# cd %s; %s sync/update\n", root, vcs.cmd) - return nil - } - - // Select and sync to appropriate version of the repository. - tags, err := vcs.tags(root) - if err != nil { - return err - } - vers := runtime.Version() - if i := strings.Index(vers, " "); i >= 0 { - vers = vers[:i] - } - if err := vcs.tagSync(root, selectTag(vers, tags)); err != nil { - return err - } - - return nil -} - -// goTag matches go release tags such as go1 and go1.2.3. -// The numbers involved must be small (at most 4 digits), -// have no unnecessary leading zeros, and the version cannot -// end in .0 - it is go1, not go1.0 or go1.0.0. -var goTag = regexp.MustCompile( - `^go((0|[1-9][0-9]{0,3})\.)*([1-9][0-9]{0,3})$`, -) - -// selectTag returns the closest matching tag for a given version. -// Closest means the latest one that is not after the current release. -// Version "goX" (or "goX.Y" or "goX.Y.Z") matches tags of the same form. -// Version "release.rN" matches tags of the form "go.rN" (N being a floating-point number). -// Version "weekly.YYYY-MM-DD" matches tags like "go.weekly.YYYY-MM-DD". -// -// NOTE(rsc): Eventually we will need to decide on some logic here. -// For now, there is only "go1". This matches the docs in go help get. -func selectTag(goVersion string, tags []string) (match string) { - for _, t := range tags { - if t == "go1" { - return "go1" - } - } - return "" - - /* - if goTag.MatchString(goVersion) { - v := goVersion - for _, t := range tags { - if !goTag.MatchString(t) { - continue - } - if cmpGoVersion(match, t) < 0 && cmpGoVersion(t, v) <= 0 { - match = t - } - } - } - - return match - */ -} - -// cmpGoVersion returns -1, 0, +1 reporting whether -// x < y, x == y, or x > y. -func cmpGoVersion(x, y string) int { - // Malformed strings compare less than well-formed strings. - if !goTag.MatchString(x) { - return -1 - } - if !goTag.MatchString(y) { - return +1 - } - - // Compare numbers in sequence. - xx := strings.Split(x[len("go"):], ".") - yy := strings.Split(y[len("go"):], ".") - - for i := 0; i < len(xx) && i < len(yy); i++ { - // The Atoi are guaranteed to succeed - // because the versions match goTag. - xi, _ := strconv.Atoi(xx[i]) - yi, _ := strconv.Atoi(yy[i]) - if xi < yi { - return -1 - } else if xi > yi { - return +1 - } - } - - if len(xx) < len(yy) { - return -1 - } - if len(xx) > len(yy) { - return +1 - } - return 0 -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/go11.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/go11.go deleted file mode 100644 index 8a434dfed1ca7f6c3601e9056c8b82b67e8d86b4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/go11.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.1 - -package main - -// Test that go1.1 tag above is included in builds. main.go refers to this definition. -const go11tag = true diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/go_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/go_test.go deleted file mode 100644 index 77b2628982bb81675d07d2705017aa1dd7c1efe4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/go_test.go +++ /dev/null @@ -1,2389 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main_test - -import ( - "bytes" - "flag" - "fmt" - "go/build" - "go/format" - "internal/testenv" - "io" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "regexp" - "runtime" - "strconv" - "strings" - "testing" - "time" -) - -var ( - canRun = true // whether we can run go or ./testgo - canRace = false // whether we can run the race detector - canCgo = false // whether we can use cgo - - exeSuffix string // ".exe" on Windows - - builder = testenv.Builder() - skipExternalBuilder = false // skip external tests on this builder -) - -func init() { - switch runtime.GOOS { - case "android", "nacl": - canRun = false - case "darwin": - switch runtime.GOARCH { - case "arm", "arm64": - canRun = false - } - } - - if strings.HasPrefix(builder+"-", "freebsd-arm-") { - skipExternalBuilder = true - canRun = false - } - - switch runtime.GOOS { - case "windows": - exeSuffix = ".exe" - } -} - -// The TestMain function creates a go command for testing purposes and -// deletes it after the tests have been run. -func TestMain(m *testing.M) { - flag.Parse() - - if canRun { - out, err := exec.Command("go", "build", "-tags", "testgo", "-o", "testgo"+exeSuffix).CombinedOutput() - if err != nil { - fmt.Fprintf(os.Stderr, "building testgo failed: %v\n%s", err, out) - os.Exit(2) - } - - if out, err := exec.Command("./testgo"+exeSuffix, "env", "CGO_ENABLED").Output(); err != nil { - fmt.Fprintf(os.Stderr, "running testgo failed: %v\n", err) - canRun = false - } else { - canCgo, err = strconv.ParseBool(strings.TrimSpace(string(out))) - if err != nil { - fmt.Fprintf(os.Stderr, "can't parse go env CGO_ENABLED output: %v\n", strings.TrimSpace(string(out))) - } - } - - switch runtime.GOOS { - case "linux", "darwin", "freebsd", "windows": - canRace = canCgo && runtime.GOARCH == "amd64" - } - - measureTick("./testgo" + exeSuffix) - } - - // Don't let these environment variables confuse the test. - os.Unsetenv("GOBIN") - os.Unsetenv("GOPATH") - - r := m.Run() - - if canRun { - os.Remove("testgo" + exeSuffix) - } - - os.Exit(r) -} - -// The length of an mtime tick on this system. This is an estimate of -// how long we need to sleep to ensure that the mtime of two files is -// different. -var mtimeTick time.Duration - -// measureTick sets mtimeTick by looking at the rounding of the mtime -// of a file. -func measureTick(path string) { - st, err := os.Stat(path) - if err != nil { - // Default to one second, the most conservative value. - mtimeTick = time.Second - return - } - mtime := st.ModTime() - t := time.Microsecond - for mtime.Round(t).Equal(mtime) && t < time.Second { - t *= 10 - } - mtimeTick = t -} - -// Manage a single run of the testgo binary. -type testgoData struct { - t *testing.T - temps []string - wd string - env []string - tempdir string - ran bool - inParallel bool - stdout, stderr bytes.Buffer -} - -// testgo sets up for a test that runs testgo. -func testgo(t *testing.T) *testgoData { - testenv.MustHaveGoBuild(t) - - if skipExternalBuilder { - t.Skip("skipping external tests on %s builder", builder) - } - - return &testgoData{t: t} -} - -// must gives a fatal error if err is not nil. -func (tg *testgoData) must(err error) { - if err != nil { - tg.t.Fatal(err) - } -} - -// check gives a test non-fatal error if err is not nil. -func (tg *testgoData) check(err error) { - if err != nil { - tg.t.Error(err) - } -} - -// parallel runs the test in parallel by calling t.Parallel. -func (tg *testgoData) parallel() { - if tg.ran { - tg.t.Fatal("internal testsuite error: call to parallel after run") - } - if tg.wd != "" { - tg.t.Fatal("internal testsuite error: call to parallel after cd") - } - for _, e := range tg.env { - if strings.HasPrefix(e, "GOROOT=") || strings.HasPrefix(e, "GOPATH=") || strings.HasPrefix(e, "GOBIN=") { - val := e[strings.Index(e, "=")+1:] - if strings.HasPrefix(val, "testdata") || strings.HasPrefix(val, "./testdata") { - tg.t.Fatalf("internal testsuite error: call to parallel with testdata in environment (%s)", e) - } - } - } - tg.inParallel = true - tg.t.Parallel() -} - -// pwd returns the current directory. -func (tg *testgoData) pwd() string { - wd, err := os.Getwd() - if err != nil { - tg.t.Fatalf("could not get working directory: %v", err) - } - return wd -} - -// cd changes the current directory to the named directory. Note that -// using this means that the test must not be run in parallel with any -// other tests. -func (tg *testgoData) cd(dir string) { - if tg.inParallel { - tg.t.Fatal("internal testsuite error: changing directory when running in parallel") - } - if tg.wd == "" { - tg.wd = tg.pwd() - } - abs, err := filepath.Abs(dir) - tg.must(os.Chdir(dir)) - if err == nil { - tg.setenv("PWD", abs) - } -} - -// sleep sleeps for one tick, where a tick is a conservative estimate -// of how long it takes for a file modification to get a different -// mtime. -func (tg *testgoData) sleep() { - time.Sleep(mtimeTick) -} - -// setenv sets an environment variable to use when running the test go -// command. -func (tg *testgoData) setenv(name, val string) { - if tg.inParallel && (name == "GOROOT" || name == "GOPATH" || name == "GOBIN") && (strings.HasPrefix(val, "testdata") || strings.HasPrefix(val, "./testdata")) { - tg.t.Fatalf("internal testsuite error: call to setenv with testdata (%s=%s) after parallel", name, val) - } - tg.unsetenv(name) - tg.env = append(tg.env, name+"="+val) -} - -// unsetenv removes an environment variable. -func (tg *testgoData) unsetenv(name string) { - if tg.env == nil { - tg.env = append([]string(nil), os.Environ()...) - } - for i, v := range tg.env { - if strings.HasPrefix(v, name+"=") { - tg.env = append(tg.env[:i], tg.env[i+1:]...) - break - } - } -} - -// doRun runs the test go command, recording stdout and stderr and -// returning exit status. -func (tg *testgoData) doRun(args []string) error { - if !canRun { - panic("testgoData.doRun called but canRun false") - } - if tg.inParallel { - for _, arg := range args { - if strings.HasPrefix(arg, "testdata") || strings.HasPrefix(arg, "./testdata") { - tg.t.Fatal("internal testsuite error: parallel run using testdata") - } - } - } - tg.t.Logf("running testgo %v", args) - var prog string - if tg.wd == "" { - prog = "./testgo" + exeSuffix - } else { - prog = filepath.Join(tg.wd, "testgo"+exeSuffix) - } - cmd := exec.Command(prog, args...) - tg.stdout.Reset() - tg.stderr.Reset() - cmd.Stdout = &tg.stdout - cmd.Stderr = &tg.stderr - cmd.Env = tg.env - status := cmd.Run() - if tg.stdout.Len() > 0 { - tg.t.Log("standard output:") - tg.t.Log(tg.stdout.String()) - } - if tg.stderr.Len() > 0 { - tg.t.Log("standard error:") - tg.t.Log(tg.stderr.String()) - } - tg.ran = true - return status -} - -// run runs the test go command, and expects it to succeed. -func (tg *testgoData) run(args ...string) { - if status := tg.doRun(args); status != nil { - tg.t.Logf("go %v failed unexpectedly: %v", args, status) - tg.t.FailNow() - } -} - -// runFail runs the test go command, and expects it to fail. -func (tg *testgoData) runFail(args ...string) { - if status := tg.doRun(args); status == nil { - tg.t.Fatal("testgo succeeded unexpectedly") - } else { - tg.t.Log("testgo failed as expected:", status) - } -} - -// runGit runs a git command, and expects it to succeed. -func (tg *testgoData) runGit(dir string, args ...string) { - cmd := exec.Command("git", args...) - tg.stdout.Reset() - tg.stderr.Reset() - cmd.Stdout = &tg.stdout - cmd.Stderr = &tg.stderr - cmd.Dir = dir - cmd.Env = tg.env - status := cmd.Run() - if tg.stdout.Len() > 0 { - tg.t.Log("git standard output:") - tg.t.Log(tg.stdout.String()) - } - if tg.stderr.Len() > 0 { - tg.t.Log("git standard error:") - tg.t.Log(tg.stderr.String()) - } - if status != nil { - tg.t.Logf("git %v failed unexpectedly: %v", args, status) - tg.t.FailNow() - } -} - -// getStdout returns standard output of the testgo run as a string. -func (tg *testgoData) getStdout() string { - if !tg.ran { - tg.t.Fatal("internal testsuite error: stdout called before run") - } - return tg.stdout.String() -} - -// getStderr returns standard error of the testgo run as a string. -func (tg *testgoData) getStderr() string { - if !tg.ran { - tg.t.Fatal("internal testsuite error: stdout called before run") - } - return tg.stderr.String() -} - -// doGrepMatch looks for a regular expression in a buffer, and returns -// whether it is found. The regular expression is matched against -// each line separately, as with the grep command. -func (tg *testgoData) doGrepMatch(match string, b *bytes.Buffer) bool { - if !tg.ran { - tg.t.Fatal("internal testsuite error: grep called before run") - } - re := regexp.MustCompile(match) - for _, ln := range bytes.Split(b.Bytes(), []byte{'\n'}) { - if re.Match(ln) { - return true - } - } - return false -} - -// doGrep looks for a regular expression in a buffer and fails if it -// is not found. The name argument is the name of the output we are -// searching, "output" or "error". The msg argument is logged on -// failure. -func (tg *testgoData) doGrep(match string, b *bytes.Buffer, name, msg string) { - if !tg.doGrepMatch(match, b) { - tg.t.Log(msg) - tg.t.Logf("pattern %v not found in standard %s", match, name) - tg.t.FailNow() - } -} - -// grepStdout looks for a regular expression in the test run's -// standard output and fails, logging msg, if it is not found. -func (tg *testgoData) grepStdout(match, msg string) { - tg.doGrep(match, &tg.stdout, "output", msg) -} - -// grepStderr looks for a regular expression in the test run's -// standard error and fails, logging msg, if it is not found. -func (tg *testgoData) grepStderr(match, msg string) { - tg.doGrep(match, &tg.stderr, "error", msg) -} - -// grepBoth looks for a regular expression in the test run's standard -// output or stand error and fails, logging msg, if it is not found. -func (tg *testgoData) grepBoth(match, msg string) { - if !tg.doGrepMatch(match, &tg.stdout) && !tg.doGrepMatch(match, &tg.stderr) { - tg.t.Log(msg) - tg.t.Logf("pattern %v not found in standard output or standard error", match) - tg.t.FailNow() - } -} - -// doGrepNot looks for a regular expression in a buffer and fails if -// it is found. The name and msg arguments are as for doGrep. -func (tg *testgoData) doGrepNot(match string, b *bytes.Buffer, name, msg string) { - if tg.doGrepMatch(match, b) { - tg.t.Log(msg) - tg.t.Logf("pattern %v found unexpectedly in standard %s", match, name) - tg.t.FailNow() - } -} - -// grepStdoutNot looks for a regular expression in the test run's -// standard output and fails, logging msg, if it is found. -func (tg *testgoData) grepStdoutNot(match, msg string) { - tg.doGrepNot(match, &tg.stdout, "output", msg) -} - -// grepStderrNot looks for a regular expression in the test run's -// standard error and fails, logging msg, if it is found. -func (tg *testgoData) grepStderrNot(match, msg string) { - tg.doGrepNot(match, &tg.stderr, "error", msg) -} - -// grepBothNot looks for a regular expression in the test run's -// standard output or stand error and fails, logging msg, if it is -// found. -func (tg *testgoData) grepBothNot(match, msg string) { - if tg.doGrepMatch(match, &tg.stdout) || tg.doGrepMatch(match, &tg.stderr) { - tg.t.Log(msg) - tg.t.Fatalf("pattern %v found unexpectedly in standard output or standard error", match) - } -} - -// doGrepCount counts the number of times a regexp is seen in a buffer. -func (tg *testgoData) doGrepCount(match string, b *bytes.Buffer) int { - if !tg.ran { - tg.t.Fatal("internal testsuite error: doGrepCount called before run") - } - re := regexp.MustCompile(match) - c := 0 - for _, ln := range bytes.Split(b.Bytes(), []byte{'\n'}) { - if re.Match(ln) { - c++ - } - } - return c -} - -// grepCountStdout returns the number of times a regexp is seen in -// standard output. -func (tg *testgoData) grepCountStdout(match string) int { - return tg.doGrepCount(match, &tg.stdout) -} - -// grepCountStderr returns the number of times a regexp is seen in -// standard error. -func (tg *testgoData) grepCountStderr(match string) int { - return tg.doGrepCount(match, &tg.stderr) -} - -// grepCountBoth returns the number of times a regexp is seen in both -// standard output and standard error. -func (tg *testgoData) grepCountBoth(match string) int { - return tg.doGrepCount(match, &tg.stdout) + tg.doGrepCount(match, &tg.stderr) -} - -// creatingTemp records that the test plans to create a temporary file -// or directory. If the file or directory exists already, it will be -// removed. When the test completes, the file or directory will be -// removed if it exists. -func (tg *testgoData) creatingTemp(path string) { - if filepath.IsAbs(path) && !strings.HasPrefix(path, tg.tempdir) { - tg.t.Fatal("internal testsuite error: creatingTemp(%q) with absolute path not in temporary directory", path) - } - // If we have changed the working directory, make sure we have - // an absolute path, because we are going to change directory - // back before we remove the temporary. - if tg.wd != "" && !filepath.IsAbs(path) { - path = filepath.Join(tg.pwd(), path) - } - tg.must(os.RemoveAll(path)) - tg.temps = append(tg.temps, path) -} - -// makeTempdir makes a temporary directory for a run of testgo. If -// the temporary directory was already created, this does nothing. -func (tg *testgoData) makeTempdir() { - if tg.tempdir == "" { - var err error - tg.tempdir, err = ioutil.TempDir("", "gotest") - tg.must(err) - } -} - -// tempFile adds a temporary file for a run of testgo. -func (tg *testgoData) tempFile(path, contents string) { - tg.makeTempdir() - tg.must(os.MkdirAll(filepath.Join(tg.tempdir, filepath.Dir(path)), 0755)) - bytes := []byte(contents) - if strings.HasSuffix(path, ".go") { - formatted, err := format.Source(bytes) - if err == nil { - bytes = formatted - } - } - tg.must(ioutil.WriteFile(filepath.Join(tg.tempdir, path), bytes, 0644)) -} - -// tempDir adds a temporary directory for a run of testgo. -func (tg *testgoData) tempDir(path string) { - tg.makeTempdir() - if err := os.MkdirAll(filepath.Join(tg.tempdir, path), 0755); err != nil && !os.IsExist(err) { - tg.t.Fatal(err) - } -} - -// path returns the absolute pathname to file with the temporary -// directory. -func (tg *testgoData) path(name string) string { - if tg.tempdir == "" { - tg.t.Fatalf("internal testsuite error: path(%q) with no tempdir", name) - } - if name == "." { - return tg.tempdir - } - return filepath.Join(tg.tempdir, name) -} - -// mustNotExist fails if path exists. -func (tg *testgoData) mustNotExist(path string) { - if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) { - tg.t.Fatalf("%s exists but should not (%v)", path, err) - } -} - -// wantExecutable fails with msg if path is not executable. -func (tg *testgoData) wantExecutable(path, msg string) { - if st, err := os.Stat(path); err != nil { - if !os.IsNotExist(err) { - tg.t.Log(err) - } - tg.t.Fatal(msg) - } else { - if runtime.GOOS != "windows" && st.Mode()&0111 == 0 { - tg.t.Fatalf("binary %s exists but is not executable", path) - } - } -} - -// wantArchive fails if path is not an archive. -func (tg *testgoData) wantArchive(path string) { - f, err := os.Open(path) - if err != nil { - tg.t.Fatal(err) - } - buf := make([]byte, 100) - io.ReadFull(f, buf) - f.Close() - if !bytes.HasPrefix(buf, []byte("!\n")) { - tg.t.Fatalf("file %s exists but is not an archive", path) - } -} - -// isStale returns whether pkg is stale. -func (tg *testgoData) isStale(pkg string) bool { - tg.run("list", "-f", "{{.Stale}}", pkg) - switch v := strings.TrimSpace(tg.getStdout()); v { - case "true": - return true - case "false": - return false - default: - tg.t.Fatalf("unexpected output checking staleness of package %v: %v", pkg, v) - panic("unreachable") - } -} - -// wantStale fails with msg if pkg is not stale. -func (tg *testgoData) wantStale(pkg, msg string) { - if !tg.isStale(pkg) { - tg.t.Fatal(msg) - } -} - -// wantNotStale fails with msg if pkg is stale. -func (tg *testgoData) wantNotStale(pkg, msg string) { - if tg.isStale(pkg) { - tg.t.Fatal(msg) - } -} - -// cleanup cleans up a test that runs testgo. -func (tg *testgoData) cleanup() { - if tg.wd != "" { - if err := os.Chdir(tg.wd); err != nil { - // We are unlikely to be able to continue. - fmt.Fprintln(os.Stderr, "could not restore working directory, crashing:", err) - os.Exit(2) - } - } - for _, path := range tg.temps { - tg.check(os.RemoveAll(path)) - } - if tg.tempdir != "" { - tg.check(os.RemoveAll(tg.tempdir)) - } -} - -// resetReadOnlyFlagAll resets windows read-only flag -// set on path and any children it contains. -// The flag is set by git and has to be removed. -// os.Remove refuses to remove files with read-only flag set. -func (tg *testgoData) resetReadOnlyFlagAll(path string) { - fi, err := os.Stat(path) - if err != nil { - tg.t.Fatalf("resetReadOnlyFlagAll(%q) failed: %v", path, err) - } - if !fi.IsDir() { - err := os.Chmod(path, 0666) - if err != nil { - tg.t.Fatalf("resetReadOnlyFlagAll(%q) failed: %v", path, err) - } - } - fd, err := os.Open(path) - if err != nil { - tg.t.Fatalf("resetReadOnlyFlagAll(%q) failed: %v", path, err) - } - defer fd.Close() - names, _ := fd.Readdirnames(-1) - for _, name := range names { - tg.resetReadOnlyFlagAll(path + string(filepath.Separator) + name) - } -} - -// failSSH puts an ssh executable in the PATH that always fails. -// This is to stub out uses of ssh by go get. -func (tg *testgoData) failSSH() { - wd, err := os.Getwd() - if err != nil { - tg.t.Fatal(err) - } - fail := filepath.Join(wd, "testdata/failssh") - tg.setenv("PATH", fmt.Sprintf("%v%c%v", fail, filepath.ListSeparator, os.Getenv("PATH"))) -} - -func TestFileLineInErrorMessages(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("err.go", `package main; import "bar"`) - path := tg.path("err.go") - tg.runFail("run", path) - shortPath := path - if rel, err := filepath.Rel(tg.pwd(), path); err == nil && len(rel) < len(path) { - shortPath = rel - } - tg.grepStderr("^"+regexp.QuoteMeta(shortPath)+":", "missing file:line in error message") -} - -func TestProgramNameInCrashMessages(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("triv.go", `package main; func main() {}`) - tg.runFail("build", "-ldflags", "-crash_for_testing", tg.path("triv.go")) - tg.grepStderr(`[/\\]tool[/\\].*[/\\]link`, "missing linker name in error message") -} - -func TestBrokenTestsWithoutTestFunctionsAllFail(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("test", "./testdata/src/badtest/...") - tg.grepBothNot("^ok", "test passed unexpectedly") - tg.grepBoth("FAIL.*badtest/badexec", "test did not run everything") - tg.grepBoth("FAIL.*badtest/badsyntax", "test did not run everything") - tg.grepBoth("FAIL.*badtest/badvar", "test did not run everything") -} - -func TestGoBuildDashAInDevBranch(t *testing.T) { - if testing.Short() { - t.Skip("don't rebuild the standard library in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("install", "math") // should be up to date already but just in case - tg.setenv("TESTGO_IS_GO_RELEASE", "0") - tg.run("build", "-v", "-a", "math") - tg.grepStderr("runtime", "testgo build -a math in dev branch DID NOT build runtime, but should have") -} - -func TestGoBuilDashAInReleaseBranch(t *testing.T) { - if testing.Short() { - t.Skip("don't rebuild the standard library in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("install", "math") // should be up to date already but just in case - tg.setenv("TESTGO_IS_GO_RELEASE", "1") - tg.run("build", "-v", "-a", "math") - tg.grepStderr("runtime", "testgo build -a math in dev branch did not build runtime, but should have") -} - -func TestGoInstallCleansUpAfterGoBuild(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("src/mycmd/main.go", `package main; func main(){}`) - tg.setenv("GOPATH", tg.path(".")) - tg.cd(tg.path("src/mycmd")) - - doesNotExist := func(file, msg string) { - if _, err := os.Stat(file); err == nil { - t.Fatal(msg) - } else if !os.IsNotExist(err) { - t.Fatal(msg, "error:", err) - } - } - - tg.run("build") - tg.wantExecutable("mycmd"+exeSuffix, "testgo build did not write command binary") - tg.run("install") - doesNotExist("mycmd"+exeSuffix, "testgo install did not remove command binary") - tg.run("build") - tg.wantExecutable("mycmd"+exeSuffix, "testgo build did not write command binary (second time)") - // Running install with arguments does not remove the target, - // even in the same directory. - tg.run("install", "mycmd") - tg.wantExecutable("mycmd"+exeSuffix, "testgo install mycmd removed command binary when run in mycmd") - tg.run("build") - tg.wantExecutable("mycmd"+exeSuffix, "testgo build did not write command binary (third time)") - // And especially not outside the directory. - tg.cd(tg.path(".")) - if data, err := ioutil.ReadFile("src/mycmd/mycmd" + exeSuffix); err != nil { - t.Fatal("could not read file:", err) - } else { - if err := ioutil.WriteFile("mycmd"+exeSuffix, data, 0555); err != nil { - t.Fatal("could not write file:", err) - } - } - tg.run("install", "mycmd") - tg.wantExecutable("src/mycmd/mycmd"+exeSuffix, "testgo install mycmd removed command binary from its source dir when run outside mycmd") - tg.wantExecutable("mycmd"+exeSuffix, "testgo install mycmd removed command binary from current dir when run outside mycmd") -} - -func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("d1/src/p1/p1.go", `package p1 - import "p2" - func F() { p2.F() }`) - tg.tempFile("d2/src/p2/p2.go", `package p2 - func F() {}`) - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", tg.path("d1")+sep+tg.path("d2")) - tg.run("install", "p1") - tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale, incorrectly") - tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale, incorrectly") - tg.sleep() - if f, err := os.OpenFile(tg.path("d2/src/p2/p2.go"), os.O_WRONLY|os.O_APPEND, 0); err != nil { - t.Fatal(err) - } else if _, err = f.WriteString(`func G() {}`); err != nil { - t.Fatal(err) - } else { - tg.must(f.Close()) - } - tg.wantStale("p2", "./testgo list mypkg claims p2 is NOT stale, incorrectly") - tg.wantStale("p1", "./testgo list mypkg claims p1 is NOT stale, incorrectly") - - tg.run("install", "p1") - tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale after reinstall, incorrectly") - tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale after reinstall, incorrectly") -} - -func TestGoInstallDetectsRemovedFiles(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/mypkg/x.go", `package mypkg`) - tg.tempFile("src/mypkg/y.go", `package mypkg`) - tg.tempFile("src/mypkg/z.go", `// +build missingtag - - package mypkg`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("install", "mypkg") - tg.wantNotStale("mypkg", "./testgo list mypkg claims mypkg is stale, incorrectly") - // z.go was not part of the build; removing it is okay. - tg.must(os.Remove(tg.path("src/mypkg/z.go"))) - tg.wantNotStale("mypkg", "./testgo list mypkg claims mypkg is stale after removing z.go; should not be stale") - // y.go was part of the package; removing it should be detected. - tg.must(os.Remove(tg.path("src/mypkg/y.go"))) - tg.wantStale("mypkg", "./testgo list mypkg claims mypkg is NOT stale after removing y.go; should be stale") -} - -func TestGoInstallErrorOnCrossCompileToBin(t *testing.T) { - if testing.Short() { - t.Skip("don't install into GOROOT in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("src/mycmd/x.go", `package main - func main() {}`) - tg.setenv("GOPATH", tg.path(".")) - tg.cd(tg.path("src/mycmd")) - - tg.run("build", "mycmd") - - goarch := "386" - if runtime.GOARCH == "386" { - goarch = "amd64" - } - tg.setenv("GOOS", "linux") - tg.setenv("GOARCH", goarch) - tg.run("install", "mycmd") - tg.setenv("GOBIN", tg.path(".")) - tg.runFail("install", "mycmd") - tg.run("install", "cmd/pack") -} - -func TestGoInstallDetectsRemovedFilesInPackageMain(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/mycmd/x.go", `package main - func main() {}`) - tg.tempFile("src/mycmd/y.go", `package main`) - tg.tempFile("src/mycmd/z.go", `// +build missingtag - - package main`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("install", "mycmd") - tg.wantNotStale("mycmd", "./testgo list mypkg claims mycmd is stale, incorrectly") - // z.go was not part of the build; removing it is okay. - tg.must(os.Remove(tg.path("src/mycmd/z.go"))) - tg.wantNotStale("mycmd", "./testgo list mycmd claims mycmd is stale after removing z.go; should not be stale") - // y.go was part of the package; removing it should be detected. - tg.must(os.Remove(tg.path("src/mycmd/y.go"))) - tg.wantStale("mycmd", "./testgo list mycmd claims mycmd is NOT stale after removing y.go; should be stale") -} - -func testLocalRun(tg *testgoData, exepath, local, match string) { - out, err := exec.Command(exepath).Output() - if err != nil { - tg.t.Fatalf("error running %v: %v", exepath, err) - } - if !regexp.MustCompile(match).Match(out) { - tg.t.Log(string(out)) - tg.t.Errorf("testdata/%s/easy.go did not generate expected output", local) - } -} - -func testLocalEasy(tg *testgoData, local string) { - exepath := "./easy" + exeSuffix - tg.creatingTemp(exepath) - tg.run("build", "-o", exepath, filepath.Join("testdata", local, "easy.go")) - testLocalRun(tg, exepath, local, `(?m)^easysub\.Hello`) -} - -func testLocalEasySub(tg *testgoData, local string) { - exepath := "./easysub" + exeSuffix - tg.creatingTemp(exepath) - tg.run("build", "-o", exepath, filepath.Join("testdata", local, "easysub", "main.go")) - testLocalRun(tg, exepath, local, `(?m)^easysub\.Hello`) -} - -func testLocalHard(tg *testgoData, local string) { - exepath := "./hard" + exeSuffix - tg.creatingTemp(exepath) - tg.run("build", "-o", exepath, filepath.Join("testdata", local, "hard.go")) - testLocalRun(tg, exepath, local, `(?m)^sub\.Hello`) -} - -func testLocalInstall(tg *testgoData, local string) { - tg.runFail("install", filepath.Join("testdata", local, "easy.go")) -} - -func TestLocalImportsEasy(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - testLocalEasy(tg, "local") -} - -func TestLocalImportsEasySub(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - testLocalEasySub(tg, "local") -} - -func TestLocalImportsHard(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - testLocalHard(tg, "local") -} - -func TestLocalImportsGoInstallShouldFail(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - testLocalInstall(tg, "local") -} - -const badDirName = `#$%:, &()*;<=>?\^{}` - -func copyBad(tg *testgoData) { - if runtime.GOOS == "windows" { - tg.t.Skipf("skipping test because %q is an invalid directory name", badDirName) - } - - tg.must(filepath.Walk("testdata/local", - func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if info.IsDir() { - return nil - } - var data []byte - data, err = ioutil.ReadFile(path) - if err != nil { - return err - } - newpath := strings.Replace(path, "local", badDirName, 1) - tg.tempFile(newpath, string(data)) - return nil - })) - tg.cd(tg.path(".")) -} - -func TestBadImportsEasy(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - copyBad(tg) - testLocalEasy(tg, badDirName) -} - -func TestBadImportsEasySub(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - copyBad(tg) - testLocalEasySub(tg, badDirName) -} - -func TestBadImportsHard(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - copyBad(tg) - testLocalHard(tg, badDirName) -} - -func TestBadImportsGoInstallShouldFail(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - copyBad(tg) - testLocalInstall(tg, badDirName) -} - -func TestInternalPackagesInGOROOTAreRespected(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("build", "-v", "./testdata/testinternal") - tg.grepBoth("use of internal package not allowed", "wrong error message for testdata/testinternal") -} - -func TestInternalPackagesOutsideGOROOTAreRespected(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("build", "-v", "./testdata/testinternal2") - tg.grepBoth("use of internal package not allowed", "wrote error message for testdata/testinternal2") -} - -func testMove(t *testing.T, vcs, url, base, config string) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src") - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "-d", url) - tg.run("get", "-d", "-u", url) - switch vcs { - case "svn": - // SVN doesn't believe in text files so we can't just edit the config. - // Check out a different repo into the wrong place. - tg.must(os.RemoveAll(tg.path("src/code.google.com/p/rsc-svn"))) - tg.run("get", "-d", "-u", "code.google.com/p/rsc-svn2/trunk") - tg.must(os.Rename(tg.path("src/code.google.com/p/rsc-svn2"), tg.path("src/code.google.com/p/rsc-svn"))) - default: - path := tg.path(filepath.Join("src", config)) - data, err := ioutil.ReadFile(path) - tg.must(err) - data = bytes.Replace(data, []byte(base), []byte(base+"XXX"), -1) - tg.must(ioutil.WriteFile(path, data, 0644)) - } - if vcs == "git" { - // git will ask for a username and password when we - // run go get -d -f -u. An empty username and - // password will work. Prevent asking by setting - // GIT_ASKPASS. - tg.creatingTemp("sink" + exeSuffix) - tg.tempFile("src/sink/sink.go", `package main; func main() {}`) - tg.run("build", "-o", "sink"+exeSuffix, "sink") - tg.setenv("GIT_ASKPASS", filepath.Join(tg.pwd(), "sink"+exeSuffix)) - } - tg.runFail("get", "-d", "-u", url) - tg.grepStderr("is a custom import path for", "go get -d -u "+url+" failed for wrong reason") - tg.runFail("get", "-d", "-f", "-u", url) - tg.grepStderr("validating server certificate|not found", "go get -d -f -u "+url+" failed for wrong reason") -} - -func TestInternalPackageErrorsAreHandled(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("list", "./testdata/testinternal3") -} - -func TestInternalCache(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/testinternal4")) - tg.runFail("build", "p") - tg.grepStderr("internal", "did not fail to build p") -} - -func TestMoveGit(t *testing.T) { - testMove(t, "git", "rsc.io/pdf", "pdf", "rsc.io/pdf/.git/config") -} - -// TODO(rsc): Set up a test case on bitbucket for hg. -// func TestMoveHG(t *testing.T) { -// testMove(t, "hg", "rsc.io/x86/x86asm", "x86", "rsc.io/x86/.hg/hgrc") -// } - -// TODO(rsc): Set up a test case on SourceForge (?) for svn. -// func testMoveSVN(t *testing.T) { -// testMove(t, "svn", "code.google.com/p/rsc-svn/trunk", "-", "-") -// } - -func TestImportCommandMatch(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.run("build", "./testdata/importcom/works.go") -} - -func TestImportCommentMismatch(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/wrongplace.go") - tg.grepStderr(`wrongplace expects import "my/x"`, "go build did not mention incorrect import") -} - -func TestImportCommentSyntaxError(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/bad.go") - tg.grepStderr("cannot parse import comment", "go build did not mention syntax error") -} - -func TestImportCommentConflict(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/importcom")) - tg.runFail("build", "./testdata/importcom/conflict.go") - tg.grepStderr("found import comments", "go build did not mention comment conflict") -} - -// cmd/go: custom import path checking should not apply to github.com/xxx/yyy. -func TestIssue10952(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - if _, err := exec.LookPath("git"); err != nil { - t.Skip("skipping because git binary not found") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src") - tg.setenv("GOPATH", tg.path(".")) - const importPath = "github.com/zombiezen/go-get-issue-10952" - tg.run("get", "-d", "-u", importPath) - repoDir := tg.path("src/" + importPath) - defer tg.resetReadOnlyFlagAll(repoDir) - tg.runGit(repoDir, "remote", "set-url", "origin", "https://"+importPath+".git") - tg.run("get", "-d", "-u", importPath) -} - -func TestDisallowedCSourceFiles(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("build", "badc") - tg.grepStderr("C source files not allowed", "go test did not say C source files not allowed") -} - -func TestErrorMessageForSyntaxErrorInTestGoFileSaysFAIL(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "syntaxerror") - tg.grepStderr("FAIL", "go test did not say FAIL") -} - -func TestWildcardsDoNotLookInUselessDirectories(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("list", "...") - tg.grepBoth("badpkg", "go list ... failure does not mention badpkg") - tg.run("list", "m...") -} - -func TestRelativeImportsGoTest(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "./testdata/testimport") -} - -func TestRelativeImportsGoTestDashI(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "-i", "./testdata/testimport") -} - -func TestRelativeImportsInCommandLinePackage(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - files, err := filepath.Glob("./testdata/testimport/*.go") - tg.must(err) - tg.run(append([]string{"test"}, files...)...) -} - -func TestVersionControlErrorMessageIncludesCorrectDirectory(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/shadow/root1")) - tg.runFail("get", "-u", "foo") - - // TODO(iant): We should not have to use strconv.Quote here. - // The code in vcs.go should be changed so that it is not required. - quoted := strconv.Quote(filepath.Join("testdata", "shadow", "root1", "src", "foo")) - quoted = quoted[1 : len(quoted)-1] - - tg.grepStderr(regexp.QuoteMeta(quoted), "go get -u error does not mention shadow/root1/src/foo") -} - -func TestInstallFailsWithNoBuildableFiles(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("CGO_ENABLED", "0") - tg.runFail("install", "cgotest") - tg.grepStderr("no buildable Go source files", "go install cgotest did not report 'no buildable Go Source files'") -} - -// Test that without $GOBIN set, binaries get installed -// into the GOPATH bin directory. -func TestInstallIntoGOPATH(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("testdata/bin/go-cmd-test" + exeSuffix) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("install", "go-cmd-test") - tg.wantExecutable("testdata/bin/go-cmd-test"+exeSuffix, "go install go-cmd-test did not write to testdata/bin/go-cmd-test") -} - -func TestPackageMainTestImportsArchiveNotBinary(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - gobin := filepath.Join(tg.pwd(), "testdata", "bin") - tg.creatingTemp(gobin) - tg.setenv("GOBIN", gobin) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.must(os.Chtimes("./testdata/src/main_test/m.go", time.Now(), time.Now())) - tg.sleep() - tg.run("test", "main_test") - tg.run("install", "main_test") - tg.wantNotStale("main_test", "after go install, main listed as stale") - tg.run("test", "main_test") -} - -// With $GOBIN set, binaries get installed to $GOBIN. -func TestInstallIntoGOBIN(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - gobin := filepath.Join(tg.pwd(), "testdata", "bin1") - tg.creatingTemp(gobin) - tg.setenv("GOBIN", gobin) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("install", "go-cmd-test") - tg.wantExecutable("testdata/bin1/go-cmd-test"+exeSuffix, "go install go-cmd-test did not write to testdata/bin1/go-cmd-test") -} - -// Issue 11065 -func TestInstallToCurrentDirectoryCreatesExecutable(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - pkg := filepath.Join(tg.pwd(), "testdata", "src", "go-cmd-test") - tg.creatingTemp(filepath.Join(pkg, "go-cmd-test"+exeSuffix)) - tg.setenv("GOBIN", pkg) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.cd(pkg) - tg.run("install") - tg.wantExecutable("go-cmd-test"+exeSuffix, "go install did not write to current directory") -} - -// Without $GOBIN set, installing a program outside $GOPATH should fail -// (there is nowhere to install it). -func TestInstallWithoutDestinationFails(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("install", "testdata/src/go-cmd-test/helloworld.go") - tg.grepStderr("no install location for .go files listed on command line", "wrong error") -} - -// With $GOBIN set, should install there. -func TestInstallToGOBINCommandLinePackage(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - gobin := filepath.Join(tg.pwd(), "testdata", "bin1") - tg.creatingTemp(gobin) - tg.setenv("GOBIN", gobin) - tg.run("install", "testdata/src/go-cmd-test/helloworld.go") - tg.wantExecutable("testdata/bin1/helloworld"+exeSuffix, "go install testdata/src/go-cmd-test/helloworld.go did not write testdata/bin1/helloworld") -} - -func TestGodocInstalls(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - // godoc installs into GOBIN - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("gobin") - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GOBIN", tg.path("gobin")) - tg.run("get", "golang.org/x/tools/cmd/godoc") - tg.wantExecutable(tg.path("gobin/godoc"), "did not install godoc to $GOBIN") - tg.unsetenv("GOBIN") - - // godoc installs into GOROOT - goroot := runtime.GOROOT() - tg.setenv("GOROOT", goroot) - tg.check(os.RemoveAll(filepath.Join(goroot, "bin", "godoc"))) - tg.run("install", "golang.org/x/tools/cmd/godoc") - tg.wantExecutable(filepath.Join(goroot, "bin", "godoc"), "did not install godoc to $GOROOT/bin") -} - -func TestGoGetNonPkg(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.tempDir("gobin") - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GOBIN", tg.path("gobin")) - tg.runFail("get", "-d", "golang.org/x/tools") - tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error") - tg.runFail("get", "-d", "-u", "golang.org/x/tools") - tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error") - tg.runFail("get", "-d", "golang.org/x/tools") - tg.grepStderr("golang.org/x/tools: no buildable Go source files", "missing error") -} - -func TestInstalls(t *testing.T) { - if testing.Short() { - t.Skip("don't install into GOROOT in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("gobin") - tg.setenv("GOPATH", tg.path(".")) - goroot := runtime.GOROOT() - tg.setenv("GOROOT", goroot) - - // cmd/fix installs into tool - tg.run("env", "GOOS") - goos := strings.TrimSpace(tg.getStdout()) - tg.setenv("GOOS", goos) - tg.run("env", "GOARCH") - goarch := strings.TrimSpace(tg.getStdout()) - tg.setenv("GOARCH", goarch) - fixbin := filepath.Join(goroot, "pkg", "tool", goos+"_"+goarch, "fix") + exeSuffix - tg.must(os.RemoveAll(fixbin)) - tg.run("install", "cmd/fix") - tg.wantExecutable(fixbin, "did not install cmd/fix to $GOROOT/pkg/tool") - tg.must(os.Remove(fixbin)) - tg.setenv("GOBIN", tg.path("gobin")) - tg.run("install", "cmd/fix") - tg.wantExecutable(fixbin, "did not install cmd/fix to $GOROOT/pkg/tool with $GOBIN set") - tg.unsetenv("GOBIN") - - // gopath program installs into GOBIN - tg.tempFile("src/progname/p.go", `package main; func main() {}`) - tg.setenv("GOBIN", tg.path("gobin")) - tg.run("install", "progname") - tg.unsetenv("GOBIN") - tg.wantExecutable(tg.path("gobin/progname")+exeSuffix, "did not install progname to $GOBIN/progname") - - // gopath program installs into GOPATH/bin - tg.run("install", "progname") - tg.wantExecutable(tg.path("bin/progname")+exeSuffix, "did not install progname to $GOPATH/bin/progname") -} - -func TestRejectRelativeDotPathInGOPATHCommandLinePackage(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", ".") - tg.runFail("build", "testdata/src/go-cmd-test/helloworld.go") - tg.grepStderr("GOPATH entry is relative", "expected an error message rejecting relative GOPATH entries") -} - -func TestRejectRelativePathsInGOPATH(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", sep+filepath.Join(tg.pwd(), "testdata")+sep+".") - tg.runFail("build", "go-cmd-test") - tg.grepStderr("GOPATH entry is relative", "expected an error message rejecting relative GOPATH entries") -} - -func TestRejectRelativePathsInGOPATHCommandLinePackage(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", "testdata") - tg.runFail("build", "testdata/src/go-cmd-test/helloworld.go") - tg.grepStderr("GOPATH entry is relative", "expected an error message rejecting relative GOPATH entries") -} - -// Issue 4104. -func TestGoTestWithPackageListedMultipleTimes(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.run("test", "errors", "errors", "errors", "errors", "errors") - if strings.Index(strings.TrimSpace(tg.getStdout()), "\n") != -1 { - t.Error("go test errors errors errors errors errors tested the same package multiple times") - } -} - -func TestGoListHasAConsistentOrder(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("list", "std") - first := tg.getStdout() - tg.run("list", "std") - if first != tg.getStdout() { - t.Error("go list std ordering is inconsistent") - } -} - -func TestGoListStdDoesNotIncludeCommands(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("list", "std") - tg.grepStdoutNot("cmd/", "go list std shows commands") -} - -func TestGoListCmdOnlyShowsCommands(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("list", "cmd") - out := strings.TrimSpace(tg.getStdout()) - for _, line := range strings.Split(out, "\n") { - if strings.Index(line, "cmd/") == -1 { - t.Error("go list cmd shows non-commands") - break - } - } -} - -// Issue 4096. Validate the output of unsuccessful go install foo/quxx. -func TestUnsuccessfulGoInstallShouldMentionMissingPackage(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(`cannot find package "foo/quxx" in any of`) != 1 { - t.Error(`go install foo/quxx expected error: .*cannot find package "foo/quxx" in any of`) - } -} - -func TestGOROOTSearchFailureReporting(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(regexp.QuoteMeta(filepath.Join("foo", "quxx"))+` \(from \$GOROOT\)$`) != 1 { - t.Error(`go install foo/quxx expected error: .*foo/quxx (from $GOROOT)`) - } -} - -func TestMultipleGOPATHEntriesReportedSeparately(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata", "a")+sep+filepath.Join(tg.pwd(), "testdata", "b")) - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(`testdata[/\\].[/\\]src[/\\]foo[/\\]quxx`) != 2 { - t.Error(`go install foo/quxx expected error: .*testdata/a/src/foo/quxx (from $GOPATH)\n.*testdata/b/src/foo/quxx`) - } -} - -// Test (from $GOPATH) annotation is reported for the first GOPATH entry, -func TestMentionGOPATHInFirstGOPATHEntry(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata", "a")+sep+filepath.Join(tg.pwd(), "testdata", "b")) - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(regexp.QuoteMeta(filepath.Join("testdata", "a", "src", "foo", "quxx"))+` \(from \$GOPATH\)$`) != 1 { - t.Error(`go install foo/quxx expected error: .*testdata/a/src/foo/quxx (from $GOPATH)`) - } -} - -// but not on the second. -func TestMentionGOPATHNotOnSecondEntry(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata", "a")+sep+filepath.Join(tg.pwd(), "testdata", "b")) - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(regexp.QuoteMeta(filepath.Join("testdata", "b", "src", "foo", "quxx"))+`$`) != 1 { - t.Error(`go install foo/quxx expected error: .*testdata/b/src/foo/quxx`) - } -} - -// Test missing GOPATH is reported. -func TestMissingGOPATHIsReported(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", "") - tg.runFail("install", "foo/quxx") - if tg.grepCountBoth(`\(\$GOPATH not set\)$`) != 1 { - t.Error(`go install foo/quxx expected error: ($GOPATH not set)`) - } -} - -// Issue 4186. go get cannot be used to download packages to $GOROOT. -// Test that without GOPATH set, go get should fail. -func TestWithoutGOPATHGoGetFails(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src") - tg.setenv("GOPATH", "") - tg.setenv("GOROOT", tg.path(".")) - tg.runFail("get", "-d", "golang.org/x/codereview/cmd/hgpatch") -} - -// Test that with GOPATH=$GOROOT, go get should fail. -func TestWithGOPATHEqualsGOROOTGoGetFails(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src") - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GOROOT", tg.path(".")) - tg.runFail("get", "-d", "golang.org/x/codereview/cmd/hgpatch") -} - -func TestLdflagsArgumentsWithSpacesIssue3941(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("main.go", `package main - var extern string - func main() { - println(extern) - }`) - tg.run("run", "-ldflags", `-X main.extern "hello world"`, tg.path("main.go")) - tg.grepStderr("^hello world", `ldflags -X main.extern 'hello world' failed`) -} - -func TestGoTestCpuprofileLeavesBinaryBehind(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.cd(tg.path(".")) - tg.run("test", "-cpuprofile", "errors.prof", "errors") - tg.wantExecutable("errors.test"+exeSuffix, "go test -cpuprofile did not create errors.test") -} - -func TestGoTestCpuprofileDashOControlsBinaryLocation(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.cd(tg.path(".")) - tg.run("test", "-cpuprofile", "errors.prof", "-o", "myerrors.test"+exeSuffix, "errors") - tg.wantExecutable("myerrors.test"+exeSuffix, "go test -cpuprofile -o myerrors.test did not create myerrors.test") -} - -func TestGoTestDashCDashOControlsBinaryLocation(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.makeTempdir() - tg.run("test", "-c", "-o", tg.path("myerrors.test"+exeSuffix), "errors") - tg.wantExecutable(tg.path("myerrors.test"+exeSuffix), "go test -c -o myerrors.test did not create myerrors.test") -} - -func TestGoTestDashOWritesBinary(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.makeTempdir() - tg.run("test", "-o", tg.path("myerrors.test"+exeSuffix), "errors") - tg.wantExecutable(tg.path("myerrors.test"+exeSuffix), "go test -o myerrors.test did not create myerrors.test") -} - -// Issue 4568. -func TestSymlinksDoNotConfuseGoList(t *testing.T) { - switch runtime.GOOS { - case "plan9", "windows": - t.Skipf("skipping symlink test on %s", runtime.GOOS) - } - - tg := testgo(t) - defer tg.cleanup() - tg.tempDir("src") - tg.must(os.Symlink(tg.path("."), tg.path("src/dir1"))) - tg.tempFile("src/dir1/p.go", "package p") - tg.setenv("GOPATH", tg.path(".")) - tg.cd(tg.path("src")) - tg.run("list", "-f", "{{.Root}}", "dir1") - if strings.TrimSpace(tg.getStdout()) != tg.path(".") { - t.Error("confused by symlinks") - } -} - -// Issue 4515. -func TestInstallWithTags(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("bin") - tg.tempFile("src/example/a/main.go", `package main - func main() {}`) - tg.tempFile("src/example/b/main.go", `// +build mytag - - package main - func main() {}`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("install", "-tags", "mytag", "example/a", "example/b") - tg.wantExecutable(tg.path("bin/a"+exeSuffix), "go install example/a example/b did not install binaries") - tg.wantExecutable(tg.path("bin/b"+exeSuffix), "go install example/a example/b did not install binaries") - tg.must(os.Remove(tg.path("bin/a" + exeSuffix))) - tg.must(os.Remove(tg.path("bin/b" + exeSuffix))) - tg.run("install", "-tags", "mytag", "example/...") - tg.wantExecutable(tg.path("bin/a"+exeSuffix), "go install example/... did not install binaries") - tg.wantExecutable(tg.path("bin/b"+exeSuffix), "go install example/... did not install binaries") - tg.run("list", "-tags", "mytag", "example/b...") - if strings.TrimSpace(tg.getStdout()) != "example/b" { - t.Error("go list example/b did not find example/b") - } -} - -// Issue 4773 -func TestCaseCollisions(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src/example/a/pkg") - tg.tempDir("src/example/a/Pkg") - tg.tempDir("src/example/b") - tg.setenv("GOPATH", tg.path(".")) - tg.tempFile("src/example/a/a.go", `package p - import ( - _ "example/a/pkg" - _ "example/a/Pkg" - )`) - tg.tempFile("src/example/a/pkg/pkg.go", `package pkg`) - tg.tempFile("src/example/a/Pkg/pkg.go", `package pkg`) - tg.runFail("list", "example/a") - tg.grepStderr("case-insensitive import collision", "go list example/a did not report import collision") - tg.tempFile("src/example/b/file.go", `package b`) - tg.tempFile("src/example/b/FILE.go", `package b`) - f, err := os.Open(tg.path("src/example/b")) - tg.must(err) - names, err := f.Readdirnames(0) - tg.must(err) - tg.check(f.Close()) - args := []string{"list"} - if len(names) == 2 { - // case-sensitive file system, let directory read find both files - args = append(args, "example/b") - } else { - // case-insensitive file system, list files explicitly on command line - args = append(args, tg.path("src/example/b/file.go"), tg.path("src/example/b/FILE.go")) - } - tg.runFail(args...) - tg.grepStderr("case-insensitive file name collision", "go list example/b did not report file name collision") -} - -// Issue 8181. -func TestGoGetDashTIssue8181(t *testing.T) { - if testing.Short() { - t.Skip("skipping test that uses network in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "-v", "-t", "github.com/rsc/go-get-issue-8181/a", "github.com/rsc/go-get-issue-8181/b") - tg.run("list", "...") - tg.grepStdout("x/build/cmd/cl", "missing expected x/build/cmd/cl") -} - -func TestIssue11307(t *testing.T) { - // go get -u was not working except in checkout directory - if testing.Short() { - t.Skip("skipping test that uses network in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "github.com/rsc/go-get-issue-11307") - tg.run("get", "-u", "github.com/rsc/go-get-issue-11307") // was failing -} - -func TestShadowingLogic(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - pwd := tg.pwd() - sep := string(filepath.ListSeparator) - tg.setenv("GOPATH", filepath.Join(pwd, "testdata", "shadow", "root1")+sep+filepath.Join(pwd, "testdata", "shadow", "root2")) - - // The math in root1 is not "math" because the standard math is. - tg.run("list", "-f", "({{.ImportPath}}) ({{.ConflictDir}})", "./testdata/shadow/root1/src/math") - pwdForwardSlash := strings.Replace(pwd, string(os.PathSeparator), "/", -1) - if !strings.HasPrefix(pwdForwardSlash, "/") { - pwdForwardSlash = "/" + pwdForwardSlash - } - // The output will have makeImportValid applies, but we only - // bother to deal with characters we might reasonably see. - pwdForwardSlash = strings.Replace(pwdForwardSlash, ":", "_", -1) - want := "(_" + pwdForwardSlash + "/testdata/shadow/root1/src/math) (" + filepath.Join(runtime.GOROOT(), "src", "math") + ")" - if strings.TrimSpace(tg.getStdout()) != want { - t.Error("shadowed math is not shadowed; looking for", want) - } - - // The foo in root1 is "foo". - tg.run("list", "-f", "({{.ImportPath}}) ({{.ConflictDir}})", "./testdata/shadow/root1/src/foo") - if strings.TrimSpace(tg.getStdout()) != "(foo) ()" { - t.Error("unshadowed foo is shadowed") - } - - // The foo in root2 is not "foo" because the foo in root1 got there first. - tg.run("list", "-f", "({{.ImportPath}}) ({{.ConflictDir}})", "./testdata/shadow/root2/src/foo") - want = "(_" + pwdForwardSlash + "/testdata/shadow/root2/src/foo) (" + filepath.Join(pwd, "testdata", "shadow", "root1", "src", "foo") + ")" - if strings.TrimSpace(tg.getStdout()) != want { - t.Error("shadowed foo is not shadowed; looking for", want) - } - - // The error for go install should mention the conflicting directory. - tg.runFail("install", "./testdata/shadow/root2/src/foo") - want = "go install: no install location for " + filepath.Join(pwd, "testdata", "shadow", "root2", "src", "foo") + ": hidden by " + filepath.Join(pwd, "testdata", "shadow", "root1", "src", "foo") - if strings.TrimSpace(tg.getStderr()) != want { - t.Error("wrong shadowed install error; looking for", want) - } -} - -// Only succeeds if source order is preserved. -func TestSourceFileNameOrderPreserved(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/example1_test.go", "testdata/example2_test.go") -} - -// Check that coverage analysis works at all. -// Don't worry about the exact numbers but require not 0.0%. -func checkCoverage(tg *testgoData, data string) { - if regexp.MustCompile(`[^0-9]0\.0%`).MatchString(data) { - tg.t.Error("some coverage results are 0.0%") - } - tg.t.Log(data) -} - -func TestCoverageRuns(t *testing.T) { - if testing.Short() { - t.Skip("don't build libraries for coverage in short mode") - } - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "-short", "-coverpkg=strings", "strings", "regexp") - data := tg.getStdout() + tg.getStderr() - tg.run("test", "-short", "-cover", "strings", "math", "regexp") - data += tg.getStdout() + tg.getStderr() - checkCoverage(tg, data) -} - -// Check that coverage analysis uses set mode. -func TestCoverageUsesSetMode(t *testing.T) { - if testing.Short() { - t.Skip("don't build libraries for coverage in short mode") - } - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("testdata/cover.out") - tg.run("test", "-short", "-cover", "encoding/binary", "-coverprofile=testdata/cover.out") - data := tg.getStdout() + tg.getStderr() - if out, err := ioutil.ReadFile("testdata/cover.out"); err != nil { - t.Error(err) - } else { - if !bytes.Contains(out, []byte("mode: set")) { - t.Error("missing mode: set") - } - } - checkCoverage(tg, data) -} - -func TestCoverageUsesAtomicModeForRace(t *testing.T) { - if testing.Short() { - t.Skip("don't build libraries for coverage in short mode") - } - if !canRace { - t.Skip("skipping because race detector not supported") - } - - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("testdata/cover.out") - tg.run("test", "-short", "-race", "-cover", "encoding/binary", "-coverprofile=testdata/cover.out") - data := tg.getStdout() + tg.getStderr() - if out, err := ioutil.ReadFile("testdata/cover.out"); err != nil { - t.Error(err) - } else { - if !bytes.Contains(out, []byte("mode: atomic")) { - t.Error("missing mode: atomic") - } - } - checkCoverage(tg, data) -} - -func TestCoverageUsesActualSettingToOverrideEvenForRace(t *testing.T) { - if testing.Short() { - t.Skip("don't build libraries for coverage in short mode") - } - if !canRace { - t.Skip("skipping because race detector not supported") - } - - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("testdata/cover.out") - tg.run("test", "-short", "-race", "-cover", "encoding/binary", "-covermode=count", "-coverprofile=testdata/cover.out") - data := tg.getStdout() + tg.getStderr() - if out, err := ioutil.ReadFile("testdata/cover.out"); err != nil { - t.Error(err) - } else { - if !bytes.Contains(out, []byte("mode: count")) { - t.Error("missing mode: count") - } - } - checkCoverage(tg, data) -} - -func TestCoverageWithCgo(t *testing.T) { - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "-short", "-cover", "./testdata/cgocover") - data := tg.getStdout() + tg.getStderr() - checkCoverage(tg, data) -} - -func TestCgoDependsOnSyscall(t *testing.T) { - if testing.Short() { - t.Skip("skipping test that removes $GOROOT/pkg/*_race in short mode") - } - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - if !canRace { - t.Skip("skipping because race detector not supported") - } - - tg := testgo(t) - defer tg.cleanup() - files, err := filepath.Glob(filepath.Join(runtime.GOROOT(), "pkg", "*_race")) - tg.must(err) - for _, file := range files { - tg.check(os.RemoveAll(file)) - } - tg.tempFile("src/foo/foo.go", ` - package foo - //#include - import "C"`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("build", "-race", "foo") -} - -func TestCgoShowsFullPathNames(t *testing.T) { - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/x/y/dirname/foo.go", ` - package foo - import "C" - func f() {`) - tg.setenv("GOPATH", tg.path(".")) - tg.runFail("build", "x/y/dirname") - tg.grepBoth("x/y/dirname", "error did not use full path") -} - -func TestCgoHandlesWlORIGIN(t *testing.T) { - if !canCgo { - t.Skip("skipping because cgo not enabled") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/origin/origin.go", `package origin - // #cgo !darwin LDFLAGS: -Wl,-rpath -Wl,$ORIGIN - // void f(void) {} - import "C" - func f() { C.f() }`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("build", "origin") -} - -// "go test -c -test.bench=XXX errors" should not hang -func TestIssue6480(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.cd(tg.path(".")) - tg.run("test", "-c", "-test.bench=XXX", "errors") -} - -// cmd/cgo: undefined reference when linking a C-library using gccgo -func TestIssue7573(t *testing.T) { - if _, err := exec.LookPath("gccgo"); err != nil { - t.Skip("skipping because no gccgo compiler found") - } - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/cgoref/cgoref.go", ` -package main -// #cgo LDFLAGS: -L alibpath -lalib -// void f(void) {} -import "C" - -func main() { C.f() }`) - tg.setenv("GOPATH", tg.path(".")) - tg.run("build", "-n", "-compiler", "gccgo", "cgoref") - tg.grepStderr(`gccgo.*\-L alibpath \-lalib`, `no Go-inline "#cgo LDFLAGS:" ("-L alibpath -lalib") passed to gccgo linking stage`) -} - -func TestListTemplateCanUseContextFunction(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("list", "-f", "GOARCH: {{context.GOARCH}}") -} - -// cmd/go: "go test" should fail if package does not build -func TestIssue7108(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "notest") -} - -// cmd/go: go test -a foo does not rebuild regexp. -func TestIssue6844(t *testing.T) { - if testing.Short() { - t.Skip("don't rebuild the standard libary in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - tg.creatingTemp("deps.test" + exeSuffix) - tg.run("test", "-x", "-a", "-c", "testdata/dep_test.go") - tg.grepStderr("regexp", "go test -x -a -c testdata/dep-test.go did not rebuild regexp") -} - -func TestBuildDashIInstallsDependencies(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempFile("src/x/y/foo/foo.go", `package foo - func F() {}`) - tg.tempFile("src/x/y/bar/bar.go", `package bar - import "x/y/foo" - func F() { foo.F() }`) - tg.setenv("GOPATH", tg.path(".")) - - checkbar := func(desc string) { - tg.sleep() - tg.must(os.Chtimes(tg.path("src/x/y/foo/foo.go"), time.Now(), time.Now())) - tg.sleep() - tg.run("build", "-v", "-i", "x/y/bar") - tg.grepBoth("x/y/foo", "first build -i "+desc+" did not build x/y/foo") - tg.run("build", "-v", "-i", "x/y/bar") - tg.grepBothNot("x/y/foo", "second build -i "+desc+" built x/y/foo") - } - checkbar("pkg") - tg.creatingTemp("bar" + exeSuffix) - tg.tempFile("src/x/y/bar/bar.go", `package main - import "x/y/foo" - func main() { foo.F() }`) - checkbar("cmd") -} - -func TestGoBuildInTestOnlyDirectoryFailsWithAGoodError(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.runFail("build", "./testdata/testonly") - tg.grepStderr("no buildable Go", "go build ./testdata/testonly produced unexpected error") -} - -func TestGoTestDetectsTestOnlyImportCycles(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "-c", "testcycle/p3") - tg.grepStderr("import cycle not allowed in test", "go test testcycle/p3 produced unexpected error") - - tg.runFail("test", "-c", "testcycle/q1") - tg.grepStderr("import cycle not allowed in test", "go test testcycle/q1 produced unexpected error") -} - -func TestGoTestFooTestWorks(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "testdata/standalone_test.go") -} - -func TestGoTestXtestonlyWorks(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.run("clean", "-i", "xtestonly") - tg.run("test", "xtestonly") -} - -func TestGoTestBuildsAnXtestContainingOnlyNonRunnableExamples(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.run("test", "-v", "./testdata/norunexample") - tg.grepStdout("File with non-runnable example was built.", "file with non-runnable example was not built") -} - -func TestGoGenerateHandlesSimpleCommand(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping because windows has no echo command") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("generate", "./testdata/generate/test1.go") - tg.grepStdout("Success", "go generate ./testdata/generate/test1.go generated wrong output") -} - -func TestGoGenerateHandlesCommandAlias(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping because windows has no echo command") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("generate", "./testdata/generate/test2.go") - tg.grepStdout("Now is the time for all good men", "go generate ./testdata/generate/test2.go generated wrong output") -} - -func TestGoGenerateVariableSubstitution(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping because windows has no echo command") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("generate", "./testdata/generate/test3.go") - tg.grepStdout(runtime.GOARCH+" test3.go:7 pabc xyzp/test3.go/123", "go generate ./testdata/generate/test3.go generated wrong output") -} - -func TestGoGenerateRunFlag(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping because windows has no echo command") - } - - tg := testgo(t) - defer tg.cleanup() - tg.run("generate", "-run", "y.s", "./testdata/generate/test4.go") - tg.grepStdout("yes", "go generate -run yes ./testdata/generate/test4.go did not select yes") - tg.grepStdoutNot("no", "go generate -run yes ./testdata/generate/test4.go selected no") -} - -func TestGoGetCustomDomainWildcard(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "-u", "rsc.io/pdf/...") - tg.wantExecutable(tg.path("bin/pdfpasswd"+exeSuffix), "did not build rsc/io/pdf/pdfpasswd") -} - -func TestGoGetInternalWildcard(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - // used to fail with errors about internal packages - tg.run("get", "github.com/rsc/go-get-issue-11960/...") -} - -func TestGoVetWithExternalTests(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "golang.org/x/tools/cmd/vet") - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("vet", "vetpkg") - tg.grepBoth("missing argument for Printf", "go vet vetpkg did not find missing argument for Printf") -} - -func TestGoVetWithTags(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.run("get", "golang.org/x/tools/cmd/vet") - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("vet", "-tags", "tagtest", "vetpkg") - tg.grepBoth(`c\.go.*wrong number of args for format`, "go get vetpkg did not run scan tagged file") -} - -// Issue 9767. -func TestGoGetRscIoToolstash(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.tempDir("src/rsc.io") - tg.setenv("GOPATH", tg.path(".")) - tg.cd(tg.path("src/rsc.io")) - tg.run("get", "./toolstash") -} - -// Test that you can not import a main package. -func TestIssue4210(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("src/x/main.go", `package main - var X int - func main() {}`) - tg.tempFile("src/y/main.go", `package main - import "fmt" - import xmain "x" - func main() { - fmt.Println(xmain.X) - }`) - tg.setenv("GOPATH", tg.path(".")) - tg.runFail("build", "y") - tg.grepBoth("is a program", `did not find expected error message ("is a program")`) -} - -func TestGoGetInsecure(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.failSSH() - - const repo = "wh3rd.net/git.git" - - // Try go get -d of HTTP-only repo (should fail). - tg.runFail("get", "-d", repo) - - // Try again with -insecure (should succeed). - tg.run("get", "-d", "-insecure", repo) - - // Try updating without -insecure (should fail). - tg.runFail("get", "-d", "-u", "-f", repo) -} - -func TestGoGetUpdateInsecure(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - - const repo = "github.com/golang/example" - - // Clone the repo via HTTP manually. - cmd := exec.Command("git", "clone", "-q", "http://"+repo, tg.path("src/"+repo)) - if out, err := cmd.CombinedOutput(); err != nil { - t.Fatalf("cloning %v repo: %v\n%s", repo, err, out) - } - - // Update without -insecure should fail. - // Update with -insecure should succeed. - // We need -f to ignore import comments. - const pkg = repo + "/hello" - tg.runFail("get", "-d", "-u", "-f", pkg) - tg.run("get", "-d", "-u", "-f", "-insecure", pkg) -} - -func TestGoGetInsecureCustomDomain(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - - const repo = "wh3rd.net/repo" - tg.runFail("get", "-d", repo) - tg.run("get", "-d", "-insecure", repo) -} - -func TestIssue10193(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.parallel() - tg.tempDir("src") - tg.setenv("GOPATH", tg.path(".")) - tg.runFail("get", "code.google.com/p/rsc/pdf") - tg.grepStderr("is shutting down", "missed warning about code.google.com") -} - -func TestGoRunDirs(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.cd("testdata/rundir") - tg.runFail("run", "x.go", "sub/sub.go") - tg.grepStderr("named files must all be in one directory; have ./ and sub/", "wrong output") - tg.runFail("run", "sub/sub.go", "x.go") - tg.grepStderr("named files must all be in one directory; have sub/ and ./", "wrong output") -} - -func TestGoInstallPkgdir(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - pkg := tg.path(".") - tg.run("install", "-pkgdir", pkg, "errors") - _, err := os.Stat(filepath.Join(pkg, "errors.a")) - tg.must(err) - _, err = os.Stat(filepath.Join(pkg, "runtime.a")) - tg.must(err) -} - -func TestGoTestRaceInstallCgo(t *testing.T) { - switch sys := runtime.GOOS + "/" + runtime.GOARCH; sys { - case "darwin/amd64", "freebsd/amd64", "linux/amd64", "windows/amd64": - // ok - default: - t.Skip("no race detector on %s", sys) - } - - if !build.Default.CgoEnabled { - t.Skip("no race detector without cgo") - } - - // golang.org/issue/10500. - // This used to install a race-enabled cgo. - tg := testgo(t) - defer tg.cleanup() - tg.run("tool", "-n", "cgo") - cgo := strings.TrimSpace(tg.stdout.String()) - old, err := os.Stat(cgo) - tg.must(err) - tg.run("test", "-race", "-i", "runtime/race") - new, err := os.Stat(cgo) - tg.must(err) - if new.ModTime() != old.ModTime() { - t.Fatalf("go test -i runtime/race reinstalled cmd/cgo") - } -} - -func TestGoTestImportErrorStack(t *testing.T) { - const out = `package testdep/p1 (test) - imports testdep/p2 - imports testdep/p3: no buildable Go source files` - - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.runFail("test", "testdep/p1") - if !strings.Contains(tg.stderr.String(), out) { - t.Fatal("did not give full import stack:\n\n%s", tg.stderr.String()) - } -} - -func TestGoGetUpdate(t *testing.T) { - // golang.org/issue/9224. - // The recursive updating was trying to walk to - // former dependencies, not current ones. - - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - - rewind := func() { - tg.run("get", "github.com/rsc/go-get-issue-9224-cmd") - cmd := exec.Command("git", "reset", "--hard", "HEAD~") - cmd.Dir = tg.path("src/github.com/rsc/go-get-issue-9224-lib") - out, err := cmd.CombinedOutput() - if err != nil { - t.Fatalf("git: %v\n%s", err, out) - } - } - - rewind() - tg.run("get", "-u", "github.com/rsc/go-get-issue-9224-cmd") - - // Again with -d -u. - rewind() - tg.run("get", "-d", "-u", "github.com/rsc/go-get-issue-9224-cmd") -} - -func TestGoGetDomainRoot(t *testing.T) { - // golang.org/issue/9357. - // go get foo.io (not foo.io/subdir) was not working consistently. - - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - - // go-get-issue-9357.appspot.com is running - // the code at github.com/rsc/go-get-issue-9357, - // a trivial Go on App Engine app that serves a - // tag for the domain root. - tg.run("get", "-d", "go-get-issue-9357.appspot.com") - tg.run("get", "go-get-issue-9357.appspot.com") - tg.run("get", "-u", "go-get-issue-9357.appspot.com") - - tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) - tg.run("get", "go-get-issue-9357.appspot.com") - - tg.must(os.RemoveAll(tg.path("src/go-get-issue-9357.appspot.com"))) - tg.run("get", "-u", "go-get-issue-9357.appspot.com") -} - -func TestGoInstallShadowedGOPATH(t *testing.T) { - // golang.org/issue/3652. - // go get foo.io (not foo.io/subdir) was not working consistently. - - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path("gopath1")+string(filepath.ListSeparator)+tg.path("gopath2")) - - tg.tempDir("gopath1/src/test") - tg.tempDir("gopath2/src/test") - tg.tempFile("gopath2/src/test/main.go", "package main\nfunc main(){}\n") - - tg.cd(tg.path("gopath2/src/test")) - tg.runFail("install") - tg.grepStderr("no install location for.*gopath2.src.test: hidden by .*gopath1.src.test", "missing error") -} - -func TestIssue11709(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("run.go", ` - package main - import "os" - func main() { - if os.Getenv("TERM") != "" { - os.Exit(1) - } - }`) - tg.unsetenv("TERM") - tg.run("run", tg.path("run.go")) -} - -func TestIssue12096(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("test_test.go", ` - package main - import ("os"; "testing") - func TestEnv(t *testing.T) { - if os.Getenv("TERM") != "" { - t.Fatal("TERM is set") - } - }`) - tg.unsetenv("TERM") - tg.run("test", tg.path("test_test.go")) -} - -func TestGoBuildOutput(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - - tg.makeTempdir() - tg.cd(tg.path(".")) - - nonExeSuffix := ".exe" - if exeSuffix == ".exe" { - nonExeSuffix = "" - } - - tg.tempFile("x.go", "package main\nfunc main(){}\n") - tg.run("build", "x.go") - tg.wantExecutable("x"+exeSuffix, "go build x.go did not write x"+exeSuffix) - tg.must(os.Remove(tg.path("x" + exeSuffix))) - tg.mustNotExist("x" + nonExeSuffix) - - tg.run("build", "-o", "myprog", "x.go") - tg.mustNotExist("x") - tg.mustNotExist("x.exe") - tg.wantExecutable("myprog", "go build -o myprog x.go did not write myprog") - tg.mustNotExist("myprog.exe") - - tg.tempFile("p.go", "package p\n") - tg.run("build", "p.go") - tg.mustNotExist("p") - tg.mustNotExist("p.a") - tg.mustNotExist("p.o") - tg.mustNotExist("p.exe") - - tg.run("build", "-o", "p.a", "p.go") - tg.wantArchive("p.a") - - tg.run("build", "cmd/gofmt") - tg.wantExecutable("gofmt"+exeSuffix, "go build cmd/gofmt did not write gofmt"+exeSuffix) - tg.must(os.Remove(tg.path("gofmt" + exeSuffix))) - tg.mustNotExist("gofmt" + nonExeSuffix) - - tg.run("build", "-o", "mygofmt", "cmd/gofmt") - tg.wantExecutable("mygofmt", "go build -o mygofmt cmd/gofmt did not write mygofmt") - tg.mustNotExist("mygofmt.exe") - tg.mustNotExist("gofmt") - tg.mustNotExist("gofmt.exe") - - tg.run("build", "sync/atomic") - tg.mustNotExist("atomic") - tg.mustNotExist("atomic.exe") - - tg.run("build", "-o", "myatomic.a", "sync/atomic") - tg.wantArchive("myatomic.a") - tg.mustNotExist("atomic") - tg.mustNotExist("atomic.a") - tg.mustNotExist("atomic.exe") - - tg.runFail("build", "-o", "whatever", "cmd/gofmt", "sync/atomic") - tg.grepStderr("multiple packages", "did not reject -o with multiple packages") -} - -func TestGoBuildARM(t *testing.T) { - if testing.Short() { - t.Skip("skipping cross-compile in short mode") - } - - tg := testgo(t) - defer tg.cleanup() - - tg.makeTempdir() - tg.cd(tg.path(".")) - - tg.setenv("GOARCH", "arm") - tg.setenv("GOOS", "linux") - tg.setenv("GOARM", "5") - tg.tempFile("hello.go", `package main - func main() {}`) - tg.run("build", "hello.go") - tg.grepStderrNot("unable to find math.a", "did not build math.a correctly") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/go_windows_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/go_windows_test.go deleted file mode 100644 index 53d695cccc8a72c6285ce5b7bcfa87bccef22e26..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/go_windows_test.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" -) - -func TestAbsolutePath(t *testing.T) { - tmp, err := ioutil.TempDir("", "TestAbsolutePath") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(tmp) - - file := filepath.Join(tmp, "a.go") - err = ioutil.WriteFile(file, []byte{}, 0644) - if err != nil { - t.Fatal(err) - } - dir := filepath.Join(tmp, "dir") - err = os.Mkdir(dir, 0777) - if err != nil { - t.Fatal(err) - } - - wd, err := os.Getwd() - if err != nil { - t.Fatal(err) - } - defer os.Chdir(wd) - - // Chdir so current directory and a.go reside on the same drive. - err = os.Chdir(dir) - if err != nil { - t.Fatal(err) - } - - noVolume := file[len(filepath.VolumeName(file)):] - wrongPath := filepath.Join(dir, noVolume) - output, err := exec.Command("go", "build", noVolume).CombinedOutput() - if err == nil { - t.Fatal("build should fail") - } - if strings.Contains(string(output), wrongPath) { - t.Fatalf("wrong output found: %v %v", err, string(output)) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/help.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/help.go deleted file mode 100644 index 5dff2670f1b990471dee5a4338fee5e3ee9ab6a8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/help.go +++ /dev/null @@ -1,574 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -var helpC = &Command{ - UsageLine: "c", - Short: "calling between Go and C", - Long: ` -There are two different ways to call between Go and C/C++ code. - -The first is the cgo tool, which is part of the Go distribution. For -information on how to use it see the cgo documentation (go doc cmd/cgo). - -The second is the SWIG program, which is a general tool for -interfacing between languages. For information on SWIG see -http://swig.org/. When running go build, any file with a .swig -extension will be passed to SWIG. Any file with a .swigcxx extension -will be passed to SWIG with the -c++ option. - -When either cgo or SWIG is used, go build will pass any .c, .m, .s, -or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++ -compiler. The CC or CXX environment variables may be set to determine -the C or C++ compiler, respectively, to use. - `, -} - -var helpPackages = &Command{ - UsageLine: "packages", - Short: "description of package lists", - Long: ` -Many commands apply to a set of packages: - - go action [packages] - -Usually, [packages] is a list of import paths. - -An import path that is a rooted path or that begins with -a . or .. element is interpreted as a file system path and -denotes the package in that directory. - -Otherwise, the import path P denotes the package found in -the directory DIR/src/P for some DIR listed in the GOPATH -environment variable (see 'go help gopath'). - -If no import paths are given, the action applies to the -package in the current directory. - -There are four reserved names for paths that should not be used -for packages to be built with the go tool: - -- "main" denotes the top-level package in a stand-alone executable. - -- "all" expands to all package directories found in all the GOPATH -trees. For example, 'go list all' lists all the packages on the local -system. - -- "std" is like all but expands to just the packages in the standard -Go library. - -- "cmd" expands to the Go repository's commands and their -internal libraries. - -An import path is a pattern if it includes one or more "..." wildcards, -each of which can match any string, including the empty string and -strings containing slashes. Such a pattern expands to all package -directories found in the GOPATH trees with names matching the -patterns. As a special case, x/... matches x as well as x's subdirectories. -For example, net/... expands to net and packages in its subdirectories. - -An import path can also name a package to be downloaded from -a remote repository. Run 'go help importpath' for details. - -Every package in a program must have a unique import path. -By convention, this is arranged by starting each path with a -unique prefix that belongs to you. For example, paths used -internally at Google all begin with 'google', and paths -denoting remote repositories begin with the path to the code, -such as 'github.com/user/repo'. - -As a special case, if the package list is a list of .go files from a -single directory, the command is applied to a single synthesized -package made up of exactly those files, ignoring any build constraints -in those files and ignoring any other files in the directory. - -Directory and file names that begin with "." or "_" are ignored -by the go tool, as are directories named "testdata". - `, -} - -var helpImportPath = &Command{ - UsageLine: "importpath", - Short: "import path syntax", - Long: ` - -An import path (see 'go help packages') denotes a package -stored in the local file system. In general, an import path denotes -either a standard package (such as "unicode/utf8") or a package -found in one of the work spaces (see 'go help gopath'). - -Relative import paths - -An import path beginning with ./ or ../ is called a relative path. -The toolchain supports relative import paths as a shortcut in two ways. - -First, a relative path can be used as a shorthand on the command line. -If you are working in the directory containing the code imported as -"unicode" and want to run the tests for "unicode/utf8", you can type -"go test ./utf8" instead of needing to specify the full path. -Similarly, in the reverse situation, "go test .." will test "unicode" from -the "unicode/utf8" directory. Relative patterns are also allowed, like -"go test ./..." to test all subdirectories. See 'go help packages' for details -on the pattern syntax. - -Second, if you are compiling a Go program not in a work space, -you can use a relative path in an import statement in that program -to refer to nearby code also not in a work space. -This makes it easy to experiment with small multipackage programs -outside of the usual work spaces, but such programs cannot be -installed with "go install" (there is no work space in which to install them), -so they are rebuilt from scratch each time they are built. -To avoid ambiguity, Go programs cannot use relative import paths -within a work space. - -Remote import paths - -Certain import paths also -describe how to obtain the source code for the package using -a revision control system. - -A few common code hosting sites have special syntax: - - Bitbucket (Git, Mercurial) - - import "bitbucket.org/user/project" - import "bitbucket.org/user/project/sub/directory" - - GitHub (Git) - - import "github.com/user/project" - import "github.com/user/project/sub/directory" - - Google Code Project Hosting (Git, Mercurial, Subversion) - - import "code.google.com/p/project" - import "code.google.com/p/project/sub/directory" - - import "code.google.com/p/project.subrepository" - import "code.google.com/p/project.subrepository/sub/directory" - - Launchpad (Bazaar) - - import "launchpad.net/project" - import "launchpad.net/project/series" - import "launchpad.net/project/series/sub/directory" - - import "launchpad.net/~user/project/branch" - import "launchpad.net/~user/project/branch/sub/directory" - - IBM DevOps Services (Git) - - import "hub.jazz.net/git/user/project" - import "hub.jazz.net/git/user/project/sub/directory" - -For code hosted on other servers, import paths may either be qualified -with the version control type, or the go tool can dynamically fetch -the import path over https/http and discover where the code resides -from a tag in the HTML. - -To declare the code location, an import path of the form - - repository.vcs/path - -specifies the given repository, with or without the .vcs suffix, -using the named version control system, and then the path inside -that repository. The supported version control systems are: - - Bazaar .bzr - Git .git - Mercurial .hg - Subversion .svn - -For example, - - import "example.org/user/foo.hg" - -denotes the root directory of the Mercurial repository at -example.org/user/foo or foo.hg, and - - import "example.org/repo.git/foo/bar" - -denotes the foo/bar directory of the Git repository at -example.org/repo or repo.git. - -When a version control system supports multiple protocols, -each is tried in turn when downloading. For example, a Git -download tries https://, then git+ssh://. - -If the import path is not a known code hosting site and also lacks a -version control qualifier, the go tool attempts to fetch the import -over https/http and looks for a tag in the document's HTML -. - -The meta tag has the form: - - - -The import-prefix is the import path corresponding to the repository -root. It must be a prefix or an exact match of the package being -fetched with "go get". If it's not an exact match, another http -request is made at the prefix to verify the tags match. - -The meta tag should appear as early in the file as possible. -In particular, it should appear before any raw JavaScript or CSS, -to avoid confusing the go command's restricted parser. - -The vcs is one of "git", "hg", "svn", etc, - -The repo-root is the root of the version control system -containing a scheme and not containing a .vcs qualifier. - -For example, - - import "example.org/pkg/foo" - -will result in the following requests: - - https://example.org/pkg/foo?go-get=1 (preferred) - http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure) - -If that page contains the meta tag - - - -the go tool will verify that https://example.org/?go-get=1 contains the -same meta tag and then git clone https://code.org/r/p/exproj into -GOPATH/src/example.org. - -New downloaded packages are written to the first directory -listed in the GOPATH environment variable (see 'go help gopath'). - -The go command attempts to download the version of the -package appropriate for the Go release being used. -Run 'go help get' for more. - -Import path checking - -When the custom import path feature described above redirects to a -known code hosting site, each of the resulting packages has two possible -import paths, using the custom domain or the known hosting site. - -A package statement is said to have an "import comment" if it is immediately -followed (before the next newline) by a comment of one of these two forms: - - package math // import "path" - package math /* import "path" */ - -The go command will refuse to install a package with an import comment -unless it is being referred to by that import path. In this way, import comments -let package authors make sure the custom import path is used and not a -direct path to the underlying code hosting site. - -If the vendoring experiment is enabled (see 'go help gopath'), -then import path checking is disabled for code found within vendor trees. -This makes it possible to copy code into alternate locations in vendor trees -without needing to update import comments. - -See https://golang.org/s/go14customimport for details. - `, -} - -var helpGopath = &Command{ - UsageLine: "gopath", - Short: "GOPATH environment variable", - Long: ` -The Go path is used to resolve import statements. -It is implemented by and documented in the go/build package. - -The GOPATH environment variable lists places to look for Go code. -On Unix, the value is a colon-separated string. -On Windows, the value is a semicolon-separated string. -On Plan 9, the value is a list. - -GOPATH must be set to get, build and install packages outside the -standard Go tree. - -Each directory listed in GOPATH must have a prescribed structure: - -The src directory holds source code. The path below src -determines the import path or executable name. - -The pkg directory holds installed package objects. -As in the Go tree, each target operating system and -architecture pair has its own subdirectory of pkg -(pkg/GOOS_GOARCH). - -If DIR is a directory listed in the GOPATH, a package with -source in DIR/src/foo/bar can be imported as "foo/bar" and -has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". - -The bin directory holds compiled commands. -Each command is named for its source directory, but only -the final element, not the entire path. That is, the -command with source in DIR/src/foo/quux is installed into -DIR/bin/quux, not DIR/bin/foo/quux. The "foo/" prefix is stripped -so that you can add DIR/bin to your PATH to get at the -installed commands. If the GOBIN environment variable is -set, commands are installed to the directory it names instead -of DIR/bin. - -Here's an example directory layout: - - GOPATH=/home/user/gocode - - /home/user/gocode/ - src/ - foo/ - bar/ (go code in package bar) - x.go - quux/ (go code in package main) - y.go - bin/ - quux (installed command) - pkg/ - linux_amd64/ - foo/ - bar.a (installed package object) - -Go searches each directory listed in GOPATH to find source code, -but new packages are always downloaded into the first directory -in the list. - -See https://golang.org/doc/code.html for an example. - -Internal Directories - -Code in or below a directory named "internal" is importable only -by code in the directory tree rooted at the parent of "internal". -Here's an extended version of the directory layout above: - - /home/user/gocode/ - src/ - crash/ - bang/ (go code in package bang) - b.go - foo/ (go code in package foo) - f.go - bar/ (go code in package bar) - x.go - internal/ - baz/ (go code in package baz) - z.go - quux/ (go code in package main) - y.go - - -The code in z.go is imported as "foo/internal/baz", but that -import statement can only appear in source files in the subtree -rooted at foo. The source files foo/f.go, foo/bar/x.go, and -foo/quux/y.go can all import "foo/internal/baz", but the source file -crash/bang/b.go cannot. - -See https://golang.org/s/go14internal for details. - -Vendor Directories - -Go 1.5 includes experimental support for using local copies -of external dependencies to satisfy imports of those dependencies, -often referred to as vendoring. Setting the environment variable -GO15VENDOREXPERIMENT=1 enables that experimental support. - -When the vendor experiment is enabled, -code below a directory named "vendor" is importable only -by code in the directory tree rooted at the parent of "vendor", -and only using an import path that omits the prefix up to and -including the vendor element. - -Here's the example from the previous section, -but with the "internal" directory renamed to "vendor" -and a new foo/vendor/crash/bang directory added: - - /home/user/gocode/ - src/ - crash/ - bang/ (go code in package bang) - b.go - foo/ (go code in package foo) - f.go - bar/ (go code in package bar) - x.go - vendor/ - crash/ - bang/ (go code in package bang) - b.go - baz/ (go code in package baz) - z.go - quux/ (go code in package main) - y.go - -The same visibility rules apply as for internal, but the code -in z.go is imported as "baz", not as "foo/vendor/baz". - -Code in vendor directories deeper in the source tree shadows -code in higher directories. Within the subtree rooted at foo, an import -of "crash/bang" resolves to "foo/vendor/crash/bang", not the -top-level "crash/bang". - -Code in vendor directories is not subject to import path -checking (see 'go help importpath'). - -When the vendor experiment is enabled, 'go get' checks out -submodules when checking out or updating a git repository -(see 'go help get'). - -The vendoring semantics are an experiment, and they may change -in future releases. Once settled, they will be on by default. - -See https://golang.org/s/go15vendor for details. - `, -} - -var helpEnvironment = &Command{ - UsageLine: "environment", - Short: "environment variables", - Long: ` - -The go command, and the tools it invokes, examine a few different -environment variables. For many of these, you can see the default -value of on your system by running 'go env NAME', where NAME is the -name of the variable. - -General-purpose environment variables: - - GCCGO - The gccgo command to run for 'go build -compiler=gccgo'. - GOARCH - The architecture, or processor, for which to compile code. - Examples are amd64, 386, arm, ppc64. - GOBIN - The directory where 'go install' will install a command. - GOOS - The operating system for which to compile code. - Examples are linux, darwin, windows, netbsd. - GOPATH - See 'go help gopath'. - GORACE - Options for the race detector. - See https://golang.org/doc/articles/race_detector.html. - GOROOT - The root of the go tree. - -Environment variables for use with cgo: - - CC - The command to use to compile C code. - CGO_ENABLED - Whether the cgo command is supported. Either 0 or 1. - CGO_CFLAGS - Flags that cgo will pass to the compiler when compiling - C code. - CGO_CPPFLAGS - Flags that cgo will pass to the compiler when compiling - C or C++ code. - CGO_CXXFLAGS - Flags that cgo will pass to the compiler when compiling - C++ code. - CGO_LDFLAGS - Flags that cgo will pass to the compiler when linking. - CXX - The command to use to compile C++ code. - -Architecture-specific environment variables: - - GOARM - For GOARCH=arm, the ARM architecture for which to compile. - Valid values are 5, 6, 7. - GO386 - For GOARCH=386, the floating point instruction set. - Valid values are 387, sse2. - -Special-purpose environment variables: - - GOROOT_FINAL - The root of the installed Go tree, when it is - installed in a location other than where it is built. - File names in stack traces are rewritten from GOROOT to - GOROOT_FINAL. - GO15VENDOREXPERIMENT - Set to 1 to enable the Go 1.5 vendoring experiment. - GO_EXTLINK_ENABLED - Whether the linker should use external linking mode - when using -linkmode=auto with code that uses cgo. - Set to 0 to disable external linking mode, 1 to enable it. - `, -} - -var helpFileType = &Command{ - UsageLine: "filetype", - Short: "file types", - Long: ` -The go command examines the contents of a restricted set of files -in each directory. It identifies which files to examine based on -the extension of the file name. These extensions are: - - .go - Go source files. - .c, .h - C source files. - If the package uses cgo or SWIG, these will be compiled with the - OS-native compiler (typically gcc); otherwise they will - trigger an error. - .cc, .cpp, .cxx, .hh, .hpp, .hxx - C++ source files. Only useful with cgo or SWIG, and always - compiled with the OS-native compiler. - .m - Objective-C source files. Only useful with cgo, and always - compiled with the OS-native compiler. - .s, .S - Assembler source files. - If the package uses cgo or SWIG, these will be assembled with the - OS-native assembler (typically gcc (sic)); otherwise they - will be assembled with the Go assembler. - .swig, .swigcxx - SWIG definition files. - .syso - System object files. - -Files of each of these types except .syso may contain build -constraints, but the go command stops scanning for build constraints -at the first item in the file that is not a blank line or //-style -line comment. - `, -} - -var helpBuildmode = &Command{ - UsageLine: "buildmode", - Short: "description of build modes", - Long: ` -The 'go build' and 'go install' commands take a -buildmode argument which -indicates which kind of object file is to be built. Currently supported values -are: - - -buildmode=archive - Build the listed non-main packages into .a files. Packages named - main are ignored. - - -buildmode=c-archive - Build the listed main package, plus all packages it imports, - into a C archive file. The only callable symbols will be those - functions exported using a cgo //export comment. Requires - exactly one main package to be listed. - - -buildmode=c-shared - Build the listed main packages, plus all packages that they - import, into C shared libraries. The only callable symbols will - be those functions exported using a cgo //export comment. - Non-main packages are ignored. - - -buildmode=default - Listed main packages are built into executables and listed - non-main packages are built into .a files (the default - behavior). - - -buildmode=shared - Combine all the listed non-main packages into a single shared - library that will be used when building with the -linkshared - option. Packages named main are ignored. - - -buildmode=exe - Build the listed main packages and everything they import into - executables. Packages not named main are ignored. -`, -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/http.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/http.go deleted file mode 100644 index 7979c41b11bae8a59a68eb23d1f184009fd0aa4f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/http.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !cmd_go_bootstrap - -// This code is compiled into the real 'go' binary, but it is not -// compiled into the binary that is built during all.bash, so as -// to avoid needing to build net (and thus use cgo) during the -// bootstrap process. - -package main - -import ( - "fmt" - "io" - "io/ioutil" - "log" - "net/http" - "net/url" - "time" -) - -// httpClient is the default HTTP client, but a variable so it can be -// changed by tests, without modifying http.DefaultClient. -var httpClient = http.DefaultClient -var impatientHTTPClient = &http.Client{ - Timeout: time.Duration(5 * time.Second), -} - -type httpError struct { - status string - statusCode int - url string -} - -func (e *httpError) Error() string { - return fmt.Sprintf("%s: %s", e.url, e.status) -} - -// httpGET returns the data from an HTTP GET request for the given URL. -func httpGET(url string) ([]byte, error) { - resp, err := httpClient.Get(url) - if err != nil { - return nil, err - } - defer resp.Body.Close() - if resp.StatusCode != 200 { - err := &httpError{status: resp.Status, statusCode: resp.StatusCode, url: url} - - return nil, err - } - b, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("%s: %v", url, err) - } - return b, nil -} - -// httpsOrHTTP returns the body of either the importPath's -// https resource or, if unavailable, the http resource. -func httpsOrHTTP(importPath string, security securityMode) (urlStr string, body io.ReadCloser, err error) { - fetch := func(scheme string) (urlStr string, res *http.Response, err error) { - u, err := url.Parse(scheme + "://" + importPath) - if err != nil { - return "", nil, err - } - u.RawQuery = "go-get=1" - urlStr = u.String() - if buildV { - log.Printf("Fetching %s", urlStr) - } - if security == insecure && scheme == "https" { // fail earlier - res, err = impatientHTTPClient.Get(urlStr) - } else { - res, err = httpClient.Get(urlStr) - } - return - } - closeBody := func(res *http.Response) { - if res != nil { - res.Body.Close() - } - } - urlStr, res, err := fetch("https") - if err != nil || res.StatusCode != 200 { - if buildV { - if err != nil { - log.Printf("https fetch failed.") - } else { - log.Printf("ignoring https fetch with status code %d", res.StatusCode) - } - } - closeBody(res) - if security == insecure { - urlStr, res, err = fetch("http") - } - } - if err != nil { - closeBody(res) - return "", nil, err - } - // Note: accepting a non-200 OK here, so people can serve a - // meta import in their http 404 page. - if buildV { - log.Printf("Parsing meta tags from %s (status code %d)", urlStr, res.StatusCode) - } - return urlStr, res.Body, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/list.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/list.go deleted file mode 100644 index 35c7cc4f2a73a8168570695625c88f6a2b56700e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/list.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bufio" - "encoding/json" - "io" - "os" - "strings" - "text/template" -) - -var cmdList = &Command{ - UsageLine: "list [-e] [-f format] [-json] [build flags] [packages]", - Short: "list packages", - Long: ` -List lists the packages named by the import paths, one per line. - -The default output shows the package import path: - - bytes - encoding/json - github.com/gorilla/mux - golang.org/x/net/html - -The -f flag specifies an alternate format for the list, using the -syntax of package template. The default output is equivalent to -f -'{{.ImportPath}}'. The struct being passed to the template is: - - type Package struct { - Dir string // directory containing package sources - ImportPath string // import path of package in dir - ImportComment string // path in import comment on package statement - Name string // package name - Doc string // package documentation string - Target string // install path - Shlib string // the shared library that contains this package (only set when -linkshared) - Goroot bool // is this package in the Go root? - Standard bool // is this package part of the standard Go library? - Stale bool // would 'go install' do anything for this package? - Root string // Go root or Go path dir containing this package - - // Source files - GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) - CgoFiles []string // .go sources files that import "C" - IgnoredGoFiles []string // .go sources ignored due to build constraints - CFiles []string // .c source files - CXXFiles []string // .cc, .cxx and .cpp source files - MFiles []string // .m source files - HFiles []string // .h, .hh, .hpp and .hxx source files - SFiles []string // .s source files - SwigFiles []string // .swig files - SwigCXXFiles []string // .swigcxx files - SysoFiles []string // .syso object files to add to archive - - // Cgo directives - CgoCFLAGS []string // cgo: flags for C compiler - CgoCPPFLAGS []string // cgo: flags for C preprocessor - CgoCXXFLAGS []string // cgo: flags for C++ compiler - CgoLDFLAGS []string // cgo: flags for linker - CgoPkgConfig []string // cgo: pkg-config names - - // Dependency information - Imports []string // import paths used by this package - Deps []string // all (recursively) imported dependencies - - // Error information - Incomplete bool // this package or a dependency has an error - Error *PackageError // error loading package - DepsErrors []*PackageError // errors loading dependencies - - TestGoFiles []string // _test.go files in package - TestImports []string // imports from TestGoFiles - XTestGoFiles []string // _test.go files outside package - XTestImports []string // imports from XTestGoFiles - } - -The template function "join" calls strings.Join. - -The template function "context" returns the build context, defined as: - - type Context struct { - GOARCH string // target architecture - GOOS string // target operating system - GOROOT string // Go root - GOPATH string // Go path - CgoEnabled bool // whether cgo can be used - UseAllFiles bool // use files regardless of +build lines, file names - Compiler string // compiler to assume when computing target paths - BuildTags []string // build constraints to match in +build lines - ReleaseTags []string // releases the current release is compatible with - InstallSuffix string // suffix to use in the name of the install dir - } - -For more information about the meaning of these fields see the documentation -for the go/build package's Context type. - -The -json flag causes the package data to be printed in JSON format -instead of using the template format. - -The -e flag changes the handling of erroneous packages, those that -cannot be found or are malformed. By default, the list command -prints an error to standard error for each erroneous package and -omits the packages from consideration during the usual printing. -With the -e flag, the list command never prints errors to standard -error and instead processes the erroneous packages with the usual -printing. Erroneous packages will have a non-empty ImportPath and -a non-nil Error field; other information may or may not be missing -(zeroed). - -For more about build flags, see 'go help build'. - -For more about specifying packages, see 'go help packages'. - `, -} - -func init() { - cmdList.Run = runList // break init cycle - addBuildFlags(cmdList) -} - -var listE = cmdList.Flag.Bool("e", false, "") -var listFmt = cmdList.Flag.String("f", "{{.ImportPath}}", "") -var listJson = cmdList.Flag.Bool("json", false, "") -var nl = []byte{'\n'} - -func runList(cmd *Command, args []string) { - buildModeInit() - out := newTrackingWriter(os.Stdout) - defer out.w.Flush() - - var do func(*Package) - if *listJson { - do = func(p *Package) { - b, err := json.MarshalIndent(p, "", "\t") - if err != nil { - out.Flush() - fatalf("%s", err) - } - out.Write(b) - out.Write(nl) - } - } else { - var cachedCtxt *Context - context := func() *Context { - if cachedCtxt == nil { - cachedCtxt = newContext(&buildContext) - } - return cachedCtxt - } - fm := template.FuncMap{ - "join": strings.Join, - "context": context, - } - tmpl, err := template.New("main").Funcs(fm).Parse(*listFmt) - if err != nil { - fatalf("%s", err) - } - do = func(p *Package) { - if err := tmpl.Execute(out, p); err != nil { - out.Flush() - fatalf("%s", err) - } - if out.NeedNL() { - out.Write(nl) - } - } - } - - load := packages - if *listE { - load = packagesAndErrors - } - - for _, pkg := range load(args) { - // Show vendor-expanded paths in listing - pkg.TestImports = pkg.vendored(pkg.TestImports) - pkg.XTestImports = pkg.vendored(pkg.XTestImports) - - do(pkg) - } -} - -// TrackingWriter tracks the last byte written on every write so -// we can avoid printing a newline if one was already written or -// if there is no output at all. -type TrackingWriter struct { - w *bufio.Writer - last byte -} - -func newTrackingWriter(w io.Writer) *TrackingWriter { - return &TrackingWriter{ - w: bufio.NewWriter(w), - last: '\n', - } -} - -func (t *TrackingWriter) Write(p []byte) (n int, err error) { - n, err = t.w.Write(p) - if n > 0 { - t.last = p[n-1] - } - return -} - -func (t *TrackingWriter) Flush() { - t.w.Flush() -} - -func (t *TrackingWriter) NeedNL() bool { - return t.last != '\n' -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/main.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/main.go deleted file mode 100644 index 8ebde8925990dc5a4ad1f19a7da298d20302fd8b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/main.go +++ /dev/null @@ -1,761 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "go/build" - "io" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "regexp" - "runtime" - "strings" - "sync" - "text/template" - "unicode" - "unicode/utf8" -) - -// A Command is an implementation of a go command -// like go build or go fix. -type Command struct { - // Run runs the command. - // The args are the arguments after the command name. - Run func(cmd *Command, args []string) - - // UsageLine is the one-line usage message. - // The first word in the line is taken to be the command name. - UsageLine string - - // Short is the short description shown in the 'go help' output. - Short string - - // Long is the long message shown in the 'go help ' output. - Long string - - // Flag is a set of flags specific to this command. - Flag flag.FlagSet - - // CustomFlags indicates that the command will do its own - // flag parsing. - CustomFlags bool -} - -// Name returns the command's name: the first word in the usage line. -func (c *Command) Name() string { - name := c.UsageLine - i := strings.Index(name, " ") - if i >= 0 { - name = name[:i] - } - return name -} - -func (c *Command) Usage() { - fmt.Fprintf(os.Stderr, "usage: %s\n\n", c.UsageLine) - fmt.Fprintf(os.Stderr, "%s\n", strings.TrimSpace(c.Long)) - os.Exit(2) -} - -// Runnable reports whether the command can be run; otherwise -// it is a documentation pseudo-command such as importpath. -func (c *Command) Runnable() bool { - return c.Run != nil -} - -// Commands lists the available commands and help topics. -// The order here is the order in which they are printed by 'go help'. -var commands = []*Command{ - cmdBuild, - cmdClean, - cmdDoc, - cmdEnv, - cmdFix, - cmdFmt, - cmdGenerate, - cmdGet, - cmdInstall, - cmdList, - cmdRun, - cmdTest, - cmdTool, - cmdVersion, - cmdVet, - - helpC, - helpBuildmode, - helpFileType, - helpGopath, - helpEnvironment, - helpImportPath, - helpPackages, - helpTestflag, - helpTestfunc, -} - -var exitStatus = 0 -var exitMu sync.Mutex - -func setExitStatus(n int) { - exitMu.Lock() - if exitStatus < n { - exitStatus = n - } - exitMu.Unlock() -} - -var origEnv []string - -func main() { - _ = go11tag - flag.Usage = usage - flag.Parse() - log.SetFlags(0) - - args := flag.Args() - if len(args) < 1 { - usage() - } - - if args[0] == "help" { - help(args[1:]) - return - } - - // Diagnose common mistake: GOPATH==GOROOT. - // This setting is equivalent to not setting GOPATH at all, - // which is not what most people want when they do it. - if gopath := os.Getenv("GOPATH"); gopath == runtime.GOROOT() { - fmt.Fprintf(os.Stderr, "warning: GOPATH set to GOROOT (%s) has no effect\n", gopath) - } else { - for _, p := range filepath.SplitList(gopath) { - // Note: using HasPrefix instead of Contains because a ~ can appear - // in the middle of directory elements, such as /tmp/git-1.8.2~rc3 - // or C:\PROGRA~1. Only ~ as a path prefix has meaning to the shell. - if strings.HasPrefix(p, "~") { - fmt.Fprintf(os.Stderr, "go: GOPATH entry cannot start with shell metacharacter '~': %q\n", p) - os.Exit(2) - } - if !filepath.IsAbs(p) { - fmt.Fprintf(os.Stderr, "go: GOPATH entry is relative; must be absolute path: %q.\nRun 'go help gopath' for usage.\n", p) - os.Exit(2) - } - } - } - - if fi, err := os.Stat(goroot); err != nil || !fi.IsDir() { - fmt.Fprintf(os.Stderr, "go: cannot find GOROOT directory: %v\n", goroot) - os.Exit(2) - } - - // Set environment (GOOS, GOARCH, etc) explicitly. - // In theory all the commands we invoke should have - // the same default computation of these as we do, - // but in practice there might be skew - // This makes sure we all agree. - origEnv = os.Environ() - for _, env := range mkEnv() { - if os.Getenv(env.name) != env.value { - os.Setenv(env.name, env.value) - } - } - - for _, cmd := range commands { - if cmd.Name() == args[0] && cmd.Runnable() { - cmd.Flag.Usage = func() { cmd.Usage() } - if cmd.CustomFlags { - args = args[1:] - } else { - cmd.Flag.Parse(args[1:]) - args = cmd.Flag.Args() - } - cmd.Run(cmd, args) - exit() - return - } - } - - fmt.Fprintf(os.Stderr, "go: unknown subcommand %q\nRun 'go help' for usage.\n", args[0]) - setExitStatus(2) - exit() -} - -var usageTemplate = `Go is a tool for managing Go source code. - -Usage: - - go command [arguments] - -The commands are: -{{range .}}{{if .Runnable}} - {{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}} - -Use "go help [command]" for more information about a command. - -Additional help topics: -{{range .}}{{if not .Runnable}} - {{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}} - -Use "go help [topic]" for more information about that topic. - -` - -var helpTemplate = `{{if .Runnable}}usage: go {{.UsageLine}} - -{{end}}{{.Long | trim}} -` - -var documentationTemplate = `// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// DO NOT EDIT THIS FILE. GENERATED BY mkalldocs.sh. -// Edit the documentation in other files and rerun mkalldocs.sh to generate this one. - -/* -{{range .}}{{if .Short}}{{.Short | capitalize}} - -{{end}}{{if .Runnable}}Usage: - - go {{.UsageLine}} - -{{end}}{{.Long | trim}} - - -{{end}}*/ -package main -` - -// An errWriter wraps a writer, recording whether a write error occurred. -type errWriter struct { - w io.Writer - err error -} - -func (w *errWriter) Write(b []byte) (int, error) { - n, err := w.w.Write(b) - if err != nil { - w.err = err - } - return n, err -} - -// tmpl executes the given template text on data, writing the result to w. -func tmpl(w io.Writer, text string, data interface{}) { - t := template.New("top") - t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize}) - template.Must(t.Parse(text)) - ew := &errWriter{w: w} - err := t.Execute(ew, data) - if ew.err != nil { - // I/O error writing. Ignore write on closed pipe. - if strings.Contains(ew.err.Error(), "pipe") { - os.Exit(1) - } - fatalf("writing output: %v", ew.err) - } - if err != nil { - panic(err) - } -} - -func capitalize(s string) string { - if s == "" { - return s - } - r, n := utf8.DecodeRuneInString(s) - return string(unicode.ToTitle(r)) + s[n:] -} - -func printUsage(w io.Writer) { - bw := bufio.NewWriter(w) - tmpl(bw, usageTemplate, commands) - bw.Flush() -} - -func usage() { - // special case "go test -h" - if len(os.Args) > 1 && os.Args[1] == "test" { - os.Stdout.WriteString(testUsage + "\n\n" + - strings.TrimSpace(testFlag1) + "\n\n" + - strings.TrimSpace(testFlag2) + "\n") - os.Exit(2) - } - printUsage(os.Stderr) - os.Exit(2) -} - -// help implements the 'help' command. -func help(args []string) { - if len(args) == 0 { - printUsage(os.Stdout) - // not exit 2: succeeded at 'go help'. - return - } - if len(args) != 1 { - fmt.Fprintf(os.Stderr, "usage: go help command\n\nToo many arguments given.\n") - os.Exit(2) // failed at 'go help' - } - - arg := args[0] - - // 'go help documentation' generates doc.go. - if arg == "documentation" { - buf := new(bytes.Buffer) - printUsage(buf) - usage := &Command{Long: buf.String()} - tmpl(os.Stdout, documentationTemplate, append([]*Command{usage}, commands...)) - return - } - - for _, cmd := range commands { - if cmd.Name() == arg { - tmpl(os.Stdout, helpTemplate, cmd) - // not exit 2: succeeded at 'go help cmd'. - return - } - } - - fmt.Fprintf(os.Stderr, "Unknown help topic %#q. Run 'go help'.\n", arg) - os.Exit(2) // failed at 'go help cmd' -} - -// importPathsNoDotExpansion returns the import paths to use for the given -// command line, but it does no ... expansion. -func importPathsNoDotExpansion(args []string) []string { - if len(args) == 0 { - return []string{"."} - } - var out []string - for _, a := range args { - // Arguments are supposed to be import paths, but - // as a courtesy to Windows developers, rewrite \ to / - // in command-line arguments. Handles .\... and so on. - if filepath.Separator == '\\' { - a = strings.Replace(a, `\`, `/`, -1) - } - - // Put argument in canonical form, but preserve leading ./. - if strings.HasPrefix(a, "./") { - a = "./" + path.Clean(a) - if a == "./." { - a = "." - } - } else { - a = path.Clean(a) - } - if a == "all" || a == "std" || a == "cmd" { - out = append(out, allPackages(a)...) - continue - } - out = append(out, a) - } - return out -} - -// importPaths returns the import paths to use for the given command line. -func importPaths(args []string) []string { - args = importPathsNoDotExpansion(args) - var out []string - for _, a := range args { - if strings.Contains(a, "...") { - if build.IsLocalImport(a) { - out = append(out, allPackagesInFS(a)...) - } else { - out = append(out, allPackages(a)...) - } - continue - } - out = append(out, a) - } - return out -} - -var atexitFuncs []func() - -func atexit(f func()) { - atexitFuncs = append(atexitFuncs, f) -} - -func exit() { - for _, f := range atexitFuncs { - f() - } - os.Exit(exitStatus) -} - -func fatalf(format string, args ...interface{}) { - errorf(format, args...) - exit() -} - -func errorf(format string, args ...interface{}) { - log.Printf(format, args...) - setExitStatus(1) -} - -var logf = log.Printf - -func exitIfErrors() { - if exitStatus != 0 { - exit() - } -} - -func run(cmdargs ...interface{}) { - cmdline := stringList(cmdargs...) - if buildN || buildX { - fmt.Printf("%s\n", strings.Join(cmdline, " ")) - if buildN { - return - } - } - - cmd := exec.Command(cmdline[0], cmdline[1:]...) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - errorf("%v", err) - } -} - -func runOut(dir string, cmdargs ...interface{}) []byte { - cmdline := stringList(cmdargs...) - cmd := exec.Command(cmdline[0], cmdline[1:]...) - cmd.Dir = dir - out, err := cmd.CombinedOutput() - if err != nil { - os.Stderr.Write(out) - errorf("%v", err) - out = nil - } - return out -} - -// envForDir returns a copy of the environment -// suitable for running in the given directory. -// The environment is the current process's environment -// but with an updated $PWD, so that an os.Getwd in the -// child will be faster. -func envForDir(dir string, base []string) []string { - // Internally we only use rooted paths, so dir is rooted. - // Even if dir is not rooted, no harm done. - return mergeEnvLists([]string{"PWD=" + dir}, base) -} - -// mergeEnvLists merges the two environment lists such that -// variables with the same name in "in" replace those in "out". -func mergeEnvLists(in, out []string) []string { -NextVar: - for _, inkv := range in { - k := strings.SplitAfterN(inkv, "=", 2)[0] - for i, outkv := range out { - if strings.HasPrefix(outkv, k) { - out[i] = inkv - continue NextVar - } - } - out = append(out, inkv) - } - return out -} - -// matchPattern(pattern)(name) reports whether -// name matches pattern. Pattern is a limited glob -// pattern in which '...' means 'any string' and there -// is no other special syntax. -func matchPattern(pattern string) func(name string) bool { - re := regexp.QuoteMeta(pattern) - re = strings.Replace(re, `\.\.\.`, `.*`, -1) - // Special case: foo/... matches foo too. - if strings.HasSuffix(re, `/.*`) { - re = re[:len(re)-len(`/.*`)] + `(/.*)?` - } - reg := regexp.MustCompile(`^` + re + `$`) - return func(name string) bool { - return reg.MatchString(name) - } -} - -// hasPathPrefix reports whether the path s begins with the -// elements in prefix. -func hasPathPrefix(s, prefix string) bool { - switch { - default: - return false - case len(s) == len(prefix): - return s == prefix - case len(s) > len(prefix): - if prefix != "" && prefix[len(prefix)-1] == '/' { - return strings.HasPrefix(s, prefix) - } - return s[len(prefix)] == '/' && s[:len(prefix)] == prefix - } -} - -// hasFilePathPrefix reports whether the filesystem path s begins with the -// elements in prefix. -func hasFilePathPrefix(s, prefix string) bool { - sv := strings.ToUpper(filepath.VolumeName(s)) - pv := strings.ToUpper(filepath.VolumeName(prefix)) - s = s[len(sv):] - prefix = prefix[len(pv):] - switch { - default: - return false - case sv != pv: - return false - case len(s) == len(prefix): - return s == prefix - case len(s) > len(prefix): - if prefix != "" && prefix[len(prefix)-1] == filepath.Separator { - return strings.HasPrefix(s, prefix) - } - return s[len(prefix)] == filepath.Separator && s[:len(prefix)] == prefix - } -} - -// treeCanMatchPattern(pattern)(name) reports whether -// name or children of name can possibly match pattern. -// Pattern is the same limited glob accepted by matchPattern. -func treeCanMatchPattern(pattern string) func(name string) bool { - wildCard := false - if i := strings.Index(pattern, "..."); i >= 0 { - wildCard = true - pattern = pattern[:i] - } - return func(name string) bool { - return len(name) <= len(pattern) && hasPathPrefix(pattern, name) || - wildCard && strings.HasPrefix(name, pattern) - } -} - -// allPackages returns all the packages that can be found -// under the $GOPATH directories and $GOROOT matching pattern. -// The pattern is either "all" (all packages), "std" (standard packages), -// "cmd" (standard commands), or a path including "...". -func allPackages(pattern string) []string { - pkgs := matchPackages(pattern) - if len(pkgs) == 0 { - fmt.Fprintf(os.Stderr, "warning: %q matched no packages\n", pattern) - } - return pkgs -} - -func matchPackages(pattern string) []string { - match := func(string) bool { return true } - treeCanMatch := func(string) bool { return true } - if pattern != "all" && pattern != "std" && pattern != "cmd" { - match = matchPattern(pattern) - treeCanMatch = treeCanMatchPattern(pattern) - } - - have := map[string]bool{ - "builtin": true, // ignore pseudo-package that exists only for documentation - } - if !buildContext.CgoEnabled { - have["runtime/cgo"] = true // ignore during walk - } - var pkgs []string - - for _, src := range buildContext.SrcDirs() { - if (pattern == "std" || pattern == "cmd") && src != gorootSrc { - continue - } - src = filepath.Clean(src) + string(filepath.Separator) - root := src - if pattern == "cmd" { - root += "cmd" + string(filepath.Separator) - } - filepath.Walk(root, func(path string, fi os.FileInfo, err error) error { - if err != nil || !fi.IsDir() || path == src { - return nil - } - - // Avoid .foo, _foo, and testdata directory trees. - _, elem := filepath.Split(path) - if strings.HasPrefix(elem, ".") || strings.HasPrefix(elem, "_") || elem == "testdata" { - return filepath.SkipDir - } - - name := filepath.ToSlash(path[len(src):]) - if pattern == "std" && (strings.Contains(name, ".") || name == "cmd") { - // The name "std" is only the standard library. - // If the name has a dot, assume it's a domain name for go get, - // and if the name is cmd, it's the root of the command tree. - return filepath.SkipDir - } - if !treeCanMatch(name) { - return filepath.SkipDir - } - if have[name] { - return nil - } - have[name] = true - if !match(name) { - return nil - } - _, err = buildContext.ImportDir(path, 0) - if err != nil { - if _, noGo := err.(*build.NoGoError); noGo { - return nil - } - } - pkgs = append(pkgs, name) - return nil - }) - } - return pkgs -} - -// allPackagesInFS is like allPackages but is passed a pattern -// beginning ./ or ../, meaning it should scan the tree rooted -// at the given directory. There are ... in the pattern too. -func allPackagesInFS(pattern string) []string { - pkgs := matchPackagesInFS(pattern) - if len(pkgs) == 0 { - fmt.Fprintf(os.Stderr, "warning: %q matched no packages\n", pattern) - } - return pkgs -} - -func matchPackagesInFS(pattern string) []string { - // Find directory to begin the scan. - // Could be smarter but this one optimization - // is enough for now, since ... is usually at the - // end of a path. - i := strings.Index(pattern, "...") - dir, _ := path.Split(pattern[:i]) - - // pattern begins with ./ or ../. - // path.Clean will discard the ./ but not the ../. - // We need to preserve the ./ for pattern matching - // and in the returned import paths. - prefix := "" - if strings.HasPrefix(pattern, "./") { - prefix = "./" - } - match := matchPattern(pattern) - - var pkgs []string - filepath.Walk(dir, func(path string, fi os.FileInfo, err error) error { - if err != nil || !fi.IsDir() { - return nil - } - if path == dir { - // filepath.Walk starts at dir and recurses. For the recursive case, - // the path is the result of filepath.Join, which calls filepath.Clean. - // The initial case is not Cleaned, though, so we do this explicitly. - // - // This converts a path like "./io/" to "io". Without this step, running - // "cd $GOROOT/src; go list ./io/..." would incorrectly skip the io - // package, because prepending the prefix "./" to the unclean path would - // result in "././io", and match("././io") returns false. - path = filepath.Clean(path) - } - - // Avoid .foo, _foo, and testdata directory trees, but do not avoid "." or "..". - _, elem := filepath.Split(path) - dot := strings.HasPrefix(elem, ".") && elem != "." && elem != ".." - if dot || strings.HasPrefix(elem, "_") || elem == "testdata" { - return filepath.SkipDir - } - - name := prefix + filepath.ToSlash(path) - if !match(name) { - return nil - } - if _, err = build.ImportDir(path, 0); err != nil { - if _, noGo := err.(*build.NoGoError); !noGo { - log.Print(err) - } - return nil - } - pkgs = append(pkgs, name) - return nil - }) - return pkgs -} - -// stringList's arguments should be a sequence of string or []string values. -// stringList flattens them into a single []string. -func stringList(args ...interface{}) []string { - var x []string - for _, arg := range args { - switch arg := arg.(type) { - case []string: - x = append(x, arg...) - case string: - x = append(x, arg) - default: - panic("stringList: invalid argument of type " + fmt.Sprintf("%T", arg)) - } - } - return x -} - -// toFold returns a string with the property that -// strings.EqualFold(s, t) iff toFold(s) == toFold(t) -// This lets us test a large set of strings for fold-equivalent -// duplicates without making a quadratic number of calls -// to EqualFold. Note that strings.ToUpper and strings.ToLower -// have the desired property in some corner cases. -func toFold(s string) string { - // Fast path: all ASCII, no upper case. - // Most paths look like this already. - for i := 0; i < len(s); i++ { - c := s[i] - if c >= utf8.RuneSelf || 'A' <= c && c <= 'Z' { - goto Slow - } - } - return s - -Slow: - var buf bytes.Buffer - for _, r := range s { - // SimpleFold(x) cycles to the next equivalent rune > x - // or wraps around to smaller values. Iterate until it wraps, - // and we've found the minimum value. - for { - r0 := r - r = unicode.SimpleFold(r0) - if r <= r0 { - break - } - } - // Exception to allow fast path above: A-Z => a-z - if 'A' <= r && r <= 'Z' { - r += 'a' - 'A' - } - buf.WriteRune(r) - } - return buf.String() -} - -// foldDup reports a pair of strings from the list that are -// equal according to strings.EqualFold. -// It returns "", "" if there are no such strings. -func foldDup(list []string) (string, string) { - clash := map[string]string{} - for _, s := range list { - fold := toFold(s) - if t := clash[fold]; t != "" { - if s > t { - s, t = t, s - } - return s, t - } - clash[fold] = s - } - return "", "" -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/match_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/match_test.go deleted file mode 100644 index 38b9b115e7c0be2f093595f4e977067f6ef8f826..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/match_test.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "testing" - -var matchPatternTests = []stringPairTest{ - {"...", "foo", true}, - {"net", "net", true}, - {"net", "net/http", false}, - {"net/http", "net", false}, - {"net/http", "net/http", true}, - {"net...", "netchan", true}, - {"net...", "net", true}, - {"net...", "net/http", true}, - {"net...", "not/http", false}, - {"net/...", "netchan", false}, - {"net/...", "net", true}, - {"net/...", "net/http", true}, - {"net/...", "not/http", false}, -} - -func TestMatchPattern(t *testing.T) { - testStringPairs(t, "matchPattern", matchPatternTests, func(pattern, name string) bool { - return matchPattern(pattern)(name) - }) -} - -var treeCanMatchPatternTests = []stringPairTest{ - {"...", "foo", true}, - {"net", "net", true}, - {"net", "net/http", false}, - {"net/http", "net", true}, - {"net/http", "net/http", true}, - {"net...", "netchan", true}, - {"net...", "net", true}, - {"net...", "net/http", true}, - {"net...", "not/http", false}, - {"net/...", "netchan", false}, - {"net/...", "net", true}, - {"net/...", "net/http", true}, - {"net/...", "not/http", false}, - {"abc.../def", "abcxyz", true}, - {"abc.../def", "xyxabc", false}, - {"x/y/z/...", "x", true}, - {"x/y/z/...", "x/y", true}, - {"x/y/z/...", "x/y/z", true}, - {"x/y/z/...", "x/y/z/w", true}, - {"x/y/z", "x", true}, - {"x/y/z", "x/y", true}, - {"x/y/z", "x/y/z", true}, - {"x/y/z", "x/y/z/w", false}, - {"x/.../y/z", "x/a/b/c", true}, - {"x/.../y/z", "y/x/a/b/c", false}, -} - -func TestChildrenCanMatchPattern(t *testing.T) { - testStringPairs(t, "treeCanMatchPattern", treeCanMatchPatternTests, func(pattern, name string) bool { - return treeCanMatchPattern(pattern)(name) - }) -} - -var hasPathPrefixTests = []stringPairTest{ - {"abc", "a", false}, - {"a/bc", "a", true}, - {"a", "a", true}, - {"a/bc", "a/", true}, -} - -func TestHasPathPrefix(t *testing.T) { - testStringPairs(t, "hasPathPrefix", hasPathPrefixTests, hasPathPrefix) -} - -type stringPairTest struct { - in1 string - in2 string - out bool -} - -func testStringPairs(t *testing.T, name string, tests []stringPairTest, f func(string, string) bool) { - for _, tt := range tests { - if out := f(tt.in1, tt.in2); out != tt.out { - t.Errorf("%s(%q, %q) = %v, want %v", name, tt.in1, tt.in2, out, tt.out) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/mkdoc.sh b/llgo/third_party/gofrontend/libgo/go/cmd/go/mkdoc.sh deleted file mode 100755 index 12fd7ba3e7f62e4fc874cb1581be9d332767a60b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/mkdoc.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# Copyright 2012 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -go install # So the next line will produce updated documentation. -go help documentation > doc.go -gofmt -w doc.go - diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/note.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/note.go deleted file mode 100644 index 97e18651e4acca486f3ab3383ab07b1ad872c433..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/note.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "debug/elf" - "encoding/binary" - "fmt" - "io" - "os" -) - -func readAligned4(r io.Reader, sz int32) ([]byte, error) { - full := (sz + 3) &^ 3 - data := make([]byte, full) - _, err := io.ReadFull(r, data) - if err != nil { - return nil, err - } - data = data[:sz] - return data, nil -} - -func readELFNote(filename, name string, typ int32) ([]byte, error) { - f, err := elf.Open(filename) - if err != nil { - return nil, err - } - for _, sect := range f.Sections { - if sect.Type != elf.SHT_NOTE { - continue - } - r := sect.Open() - for { - var namesize, descsize, noteType int32 - err = binary.Read(r, f.ByteOrder, &namesize) - if err != nil { - if err == io.EOF { - break - } - return nil, fmt.Errorf("read namesize failed: %v", err) - } - err = binary.Read(r, f.ByteOrder, &descsize) - if err != nil { - return nil, fmt.Errorf("read descsize failed: %v", err) - } - err = binary.Read(r, f.ByteOrder, ¬eType) - if err != nil { - return nil, fmt.Errorf("read type failed: %v", err) - } - noteName, err := readAligned4(r, namesize) - if err != nil { - return nil, fmt.Errorf("read name failed: %v", err) - } - desc, err := readAligned4(r, descsize) - if err != nil { - return nil, fmt.Errorf("read desc failed: %v", err) - } - if name == string(noteName) && typ == noteType { - return desc, nil - } - } - } - return nil, nil -} - -var elfGoNote = []byte("Go\x00\x00") - -// readELFGoBuildID the Go build ID string from an ELF binary. -// The Go build ID is stored in a note described by an ELF PT_NOTE prog header. -// The caller has already opened filename, to get f, and read the first 4 kB out, in data. -func readELFGoBuildID(filename string, f *os.File, data []byte) (buildid string, err error) { - // Assume the note content is in the first 4 kB, already read. - // Rewrite the ELF header to set shnum to 0, so that we can pass - // the data to elf.NewFile and it will decode the Prog list but not - // try to read the section headers and the string table from disk. - // That's a waste of I/O when all we care about is the Prog list - // and the one ELF note. - switch elf.Class(data[elf.EI_CLASS]) { - case elf.ELFCLASS32: - data[48] = 0 - data[49] = 0 - case elf.ELFCLASS64: - data[60] = 0 - data[61] = 0 - } - - const elfGoBuildIDTag = 4 - - ef, err := elf.NewFile(bytes.NewReader(data)) - if err != nil { - return "", &os.PathError{Path: filename, Op: "parse", Err: err} - } - for _, p := range ef.Progs { - if p.Type != elf.PT_NOTE || p.Off >= uint64(len(data)) || p.Off+p.Filesz >= uint64(len(data)) || p.Filesz < 16 { - continue - } - - note := data[p.Off : p.Off+p.Filesz] - nameSize := ef.ByteOrder.Uint32(note) - valSize := ef.ByteOrder.Uint32(note[4:]) - tag := ef.ByteOrder.Uint32(note[8:]) - name := note[12:16] - if nameSize != 4 || 16+valSize > uint32(len(note)) || tag != elfGoBuildIDTag || !bytes.Equal(name, elfGoNote) { - continue - } - - return string(note[16 : 16+valSize]), nil - } - - // No note. Treat as successful but build ID empty. - return "", nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/note_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/note_test.go deleted file mode 100644 index 3d644518c6897de348b57f8928f1b2e06b139769..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/note_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main_test - -import ( - main "cmd/go" - "runtime" - "testing" -) - -func TestNoteReading(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("hello.go", `package main; func main() { print("hello, world\n") }`) - const buildID = "TestNoteReading-Build-ID" - tg.run("build", "-ldflags", "-buildid="+buildID, "-o", tg.path("hello.exe"), tg.path("hello.go")) - id, err := main.ReadBuildIDFromBinary(tg.path("hello.exe")) - if err != nil { - t.Fatalf("reading build ID from hello binary: %v", err) - } - if id != buildID { - t.Fatalf("buildID in hello binary = %q, want %q", id, buildID) - } - - if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le" { - t.Skipf("skipping - golang.org/issue/11184") - } - - switch runtime.GOOS { - case "plan9": - // no external linking - t.Logf("no external linking - skipping linkmode=external test") - - case "solaris": - t.Logf("skipping - golang.org/issue/12178") - - default: - tg.run("build", "-ldflags", "-buildid="+buildID+" -linkmode=external", "-o", tg.path("hello.exe"), tg.path("hello.go")) - id, err := main.ReadBuildIDFromBinary(tg.path("hello.exe")) - if err != nil { - t.Fatalf("reading build ID from hello binary (linkmode=external): %v", err) - } - if id != buildID { - t.Fatalf("buildID in hello binary = %q, want %q (linkmode=external)", id, buildID) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg.go deleted file mode 100644 index 3270a8b52364b9e4113ae76ec7251261be976cb1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg.go +++ /dev/null @@ -1,1861 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "crypto/sha1" - "errors" - "fmt" - "go/build" - "go/scanner" - "go/token" - "io" - "io/ioutil" - "os" - pathpkg "path" - "path/filepath" - "runtime" - "sort" - "strconv" - "strings" - "unicode" -) - -// A Package describes a single package found in a directory. -type Package struct { - // Note: These fields are part of the go command's public API. - // See list.go. It is okay to add fields, but not to change or - // remove existing ones. Keep in sync with list.go - Dir string `json:",omitempty"` // directory containing package sources - ImportPath string `json:",omitempty"` // import path of package in dir - ImportComment string `json:",omitempty"` // path in import comment on package statement - Name string `json:",omitempty"` // package name - Doc string `json:",omitempty"` // package documentation string - Target string `json:",omitempty"` // install path - Shlib string `json:",omitempty"` // the shared library that contains this package (only set when -linkshared) - Goroot bool `json:",omitempty"` // is this package found in the Go root? - Standard bool `json:",omitempty"` // is this package part of the standard Go library? - Stale bool `json:",omitempty"` // would 'go install' do anything for this package? - Root string `json:",omitempty"` // Go root or Go path dir containing this package - ConflictDir string `json:",omitempty"` // Dir is hidden by this other directory - - // Source files - GoFiles []string `json:",omitempty"` // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles) - CgoFiles []string `json:",omitempty"` // .go sources files that import "C" - IgnoredGoFiles []string `json:",omitempty"` // .go sources ignored due to build constraints - CFiles []string `json:",omitempty"` // .c source files - CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files - MFiles []string `json:",omitempty"` // .m source files - HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files - SFiles []string `json:",omitempty"` // .s source files - SwigFiles []string `json:",omitempty"` // .swig files - SwigCXXFiles []string `json:",omitempty"` // .swigcxx files - SysoFiles []string `json:",omitempty"` // .syso system object files added to package - - // Cgo directives - CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler - CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor - CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler - CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker - CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names - - // Dependency information - Imports []string `json:",omitempty"` // import paths used by this package - Deps []string `json:",omitempty"` // all (recursively) imported dependencies - - // Error information - Incomplete bool `json:",omitempty"` // was there an error loading this package or dependencies? - Error *PackageError `json:",omitempty"` // error loading this package (not dependencies) - DepsErrors []*PackageError `json:",omitempty"` // errors loading dependencies - - // Test information - TestGoFiles []string `json:",omitempty"` // _test.go files in package - TestImports []string `json:",omitempty"` // imports from TestGoFiles - XTestGoFiles []string `json:",omitempty"` // _test.go files outside package - XTestImports []string `json:",omitempty"` // imports from XTestGoFiles - - // Unexported fields are not part of the public API. - build *build.Package - pkgdir string // overrides build.PkgDir - imports []*Package - deps []*Package - gofiles []string // GoFiles+CgoFiles+TestGoFiles+XTestGoFiles files, absolute paths - sfiles []string - allgofiles []string // gofiles + IgnoredGoFiles, absolute paths - target string // installed file for this package (may be executable) - fake bool // synthesized package - external bool // synthesized external test package - forceBuild bool // this package must be rebuilt - forceLibrary bool // this package is a library (even if named "main") - cmdline bool // defined by files listed on command line - local bool // imported via local path (./ or ../) - localPrefix string // interpret ./ and ../ imports relative to this prefix - exeName string // desired name for temporary executable - coverMode string // preprocess Go source files with the coverage tool in this mode - coverVars map[string]*CoverVar // variables created by coverage analysis - omitDWARF bool // tell linker not to write DWARF information - buildID string // expected build ID for generated package - gobinSubdir bool // install target would be subdir of GOBIN -} - -// vendored returns the vendor-resolved version of imports, -// which should be p.TestImports or p.XTestImports, NOT p.Imports. -// The imports in p.TestImports and p.XTestImports are not recursively -// loaded during the initial load of p, so they list the imports found in -// the source file, but most processing should be over the vendor-resolved -// import paths. We do this resolution lazily both to avoid file system work -// and because the eventual real load of the test imports (during 'go test') -// can produce better error messages if it starts with the original paths. -// The initial load of p loads all the non-test imports and rewrites -// the vendored paths, so nothing should ever call p.vendored(p.Imports). -func (p *Package) vendored(imports []string) []string { - if len(imports) > 0 && len(p.Imports) > 0 && &imports[0] == &p.Imports[0] { - panic("internal error: p.vendored(p.Imports) called") - } - seen := make(map[string]bool) - var all []string - for _, path := range imports { - path, _ = vendoredImportPath(p, path) - if !seen[path] { - seen[path] = true - all = append(all, path) - } - } - sort.Strings(all) - return all -} - -// CoverVar holds the name of the generated coverage variables targeting the named file. -type CoverVar struct { - File string // local file name - Var string // name of count struct -} - -func (p *Package) copyBuild(pp *build.Package) { - p.build = pp - - if pp.PkgTargetRoot != "" && buildPkgdir != "" { - old := pp.PkgTargetRoot - pp.PkgRoot = buildPkgdir - pp.PkgTargetRoot = buildPkgdir - pp.PkgObj = filepath.Join(buildPkgdir, strings.TrimPrefix(pp.PkgObj, old)) - } - - p.Dir = pp.Dir - p.ImportPath = pp.ImportPath - p.ImportComment = pp.ImportComment - p.Name = pp.Name - p.Doc = pp.Doc - p.Root = pp.Root - p.ConflictDir = pp.ConflictDir - // TODO? Target - p.Goroot = pp.Goroot - if buildContext.Compiler == "gccgo" { - p.Standard = stdpkg[p.ImportPath] - } else { - p.Standard = p.Goroot && p.ImportPath != "" && !strings.Contains(p.ImportPath, ".") - } - p.GoFiles = pp.GoFiles - p.CgoFiles = pp.CgoFiles - p.IgnoredGoFiles = pp.IgnoredGoFiles - p.CFiles = pp.CFiles - p.CXXFiles = pp.CXXFiles - p.MFiles = pp.MFiles - p.HFiles = pp.HFiles - p.SFiles = pp.SFiles - p.SwigFiles = pp.SwigFiles - p.SwigCXXFiles = pp.SwigCXXFiles - p.SysoFiles = pp.SysoFiles - p.CgoCFLAGS = pp.CgoCFLAGS - p.CgoCPPFLAGS = pp.CgoCPPFLAGS - p.CgoCXXFLAGS = pp.CgoCXXFLAGS - p.CgoLDFLAGS = pp.CgoLDFLAGS - p.CgoPkgConfig = pp.CgoPkgConfig - p.Imports = pp.Imports - p.TestGoFiles = pp.TestGoFiles - p.TestImports = pp.TestImports - p.XTestGoFiles = pp.XTestGoFiles - p.XTestImports = pp.XTestImports -} - -// A PackageError describes an error loading information about a package. -type PackageError struct { - ImportStack []string // shortest path from package named on command line to this one - Pos string // position of error - Err string // the error itself - isImportCycle bool // the error is an import cycle - hard bool // whether the error is soft or hard; soft errors are ignored in some places -} - -func (p *PackageError) Error() string { - // Import cycles deserve special treatment. - if p.isImportCycle { - return fmt.Sprintf("%s\npackage %s\n", p.Err, strings.Join(p.ImportStack, "\n\timports ")) - } - if p.Pos != "" { - // Omit import stack. The full path to the file where the error - // is the most important thing. - return p.Pos + ": " + p.Err - } - if len(p.ImportStack) == 0 { - return p.Err - } - return "package " + strings.Join(p.ImportStack, "\n\timports ") + ": " + p.Err -} - -// An importStack is a stack of import paths. -type importStack []string - -func (s *importStack) push(p string) { - *s = append(*s, p) -} - -func (s *importStack) pop() { - *s = (*s)[0 : len(*s)-1] -} - -func (s *importStack) copy() []string { - return append([]string{}, *s...) -} - -// shorterThan reports whether sp is shorter than t. -// We use this to record the shortest import sequence -// that leads to a particular package. -func (sp *importStack) shorterThan(t []string) bool { - s := *sp - if len(s) != len(t) { - return len(s) < len(t) - } - // If they are the same length, settle ties using string ordering. - for i := range s { - if s[i] != t[i] { - return s[i] < t[i] - } - } - return false // they are equal -} - -// packageCache is a lookup cache for loadPackage, -// so that if we look up a package multiple times -// we return the same pointer each time. -var packageCache = map[string]*Package{} - -// reloadPackage is like loadPackage but makes sure -// not to use the package cache. -func reloadPackage(arg string, stk *importStack) *Package { - p := packageCache[arg] - if p != nil { - delete(packageCache, p.Dir) - delete(packageCache, p.ImportPath) - } - return loadPackage(arg, stk) -} - -// The Go 1.5 vendoring experiment is enabled by setting GO15VENDOREXPERIMENT=1. -// The variable is obnoxiously long so that years from now when people find it in -// their profiles and wonder what it does, there is some chance that a web search -// might answer the question. -var go15VendorExperiment = os.Getenv("GO15VENDOREXPERIMENT") == "1" - -// dirToImportPath returns the pseudo-import path we use for a package -// outside the Go path. It begins with _/ and then contains the full path -// to the directory. If the package lives in c:\home\gopher\my\pkg then -// the pseudo-import path is _/c_/home/gopher/my/pkg. -// Using a pseudo-import path like this makes the ./ imports no longer -// a special case, so that all the code to deal with ordinary imports works -// automatically. -func dirToImportPath(dir string) string { - return pathpkg.Join("_", strings.Map(makeImportValid, filepath.ToSlash(dir))) -} - -func makeImportValid(r rune) rune { - // Should match Go spec, compilers, and ../../go/parser/parser.go:/isValidImport. - const illegalChars = `!"#$%&'()*,:;<=>?[\]^{|}` + "`\uFFFD" - if !unicode.IsGraphic(r) || unicode.IsSpace(r) || strings.ContainsRune(illegalChars, r) { - return '_' - } - return r -} - -// Mode flags for loadImport and download (in get.go). -const ( - // useVendor means that loadImport should do vendor expansion - // (provided the vendoring experiment is enabled). - // That is, useVendor means that the import path came from - // a source file and has not been vendor-expanded yet. - // Every import path should be loaded initially with useVendor, - // and then the expanded version (with the /vendor/ in it) gets - // recorded as the canonical import path. At that point, future loads - // of that package must not pass useVendor, because - // disallowVendor will reject direct use of paths containing /vendor/. - useVendor = 1 << iota - - // getTestDeps is for download (part of "go get") and indicates - // that test dependencies should be fetched too. - getTestDeps -) - -// loadImport scans the directory named by path, which must be an import path, -// but possibly a local import path (an absolute file system path or one beginning -// with ./ or ../). A local relative path is interpreted relative to srcDir. -// It returns a *Package describing the package found in that directory. -func loadImport(path, srcDir string, parent *Package, stk *importStack, importPos []token.Position, mode int) *Package { - stk.push(path) - defer stk.pop() - - // Determine canonical identifier for this package. - // For a local import the identifier is the pseudo-import path - // we create from the full directory to the package. - // Otherwise it is the usual import path. - // For vendored imports, it is the expanded form. - importPath := path - origPath := path - isLocal := build.IsLocalImport(path) - var vendorSearch []string - if isLocal { - importPath = dirToImportPath(filepath.Join(srcDir, path)) - } else if mode&useVendor != 0 { - path, vendorSearch = vendoredImportPath(parent, path) - importPath = path - } - - if p := packageCache[importPath]; p != nil { - if perr := disallowInternal(srcDir, p, stk); perr != p { - return perr - } - if mode&useVendor != 0 { - if perr := disallowVendor(srcDir, origPath, p, stk); perr != p { - return perr - } - } - return reusePackage(p, stk) - } - - p := new(Package) - p.local = isLocal - p.ImportPath = importPath - packageCache[importPath] = p - - // Load package. - // Import always returns bp != nil, even if an error occurs, - // in order to return partial information. - // - // TODO: After Go 1, decide when to pass build.AllowBinary here. - // See issue 3268 for mistakes to avoid. - bp, err := buildContext.Import(path, srcDir, build.ImportComment) - - // If we got an error from go/build about package not found, - // it contains the directories from $GOROOT and $GOPATH that - // were searched. Add to that message the vendor directories - // that were searched. - if err != nil && len(vendorSearch) > 0 { - // NOTE(rsc): The direct text manipulation here is fairly awful, - // but it avoids defining new go/build API (an exported error type) - // late in the Go 1.5 release cycle. If this turns out to be a more general - // problem we could define a real error type when the decision can be - // considered more carefully. - text := err.Error() - if strings.Contains(text, "cannot find package \"") && strings.Contains(text, "\" in any of:\n\t") { - old := strings.SplitAfter(text, "\n") - lines := []string{old[0]} - for _, dir := range vendorSearch { - lines = append(lines, "\t"+dir+" (vendor tree)\n") - } - lines = append(lines, old[1:]...) - err = errors.New(strings.Join(lines, "")) - } - } - bp.ImportPath = importPath - if gobin != "" { - bp.BinDir = gobin - } - if err == nil && !isLocal && bp.ImportComment != "" && bp.ImportComment != path && - (!go15VendorExperiment || (!strings.Contains(path, "/vendor/") && !strings.HasPrefix(path, "vendor/"))) { - err = fmt.Errorf("code in directory %s expects import %q", bp.Dir, bp.ImportComment) - } - p.load(stk, bp, err) - if p.Error != nil && len(importPos) > 0 { - pos := importPos[0] - pos.Filename = shortPath(pos.Filename) - p.Error.Pos = pos.String() - } - - if perr := disallowInternal(srcDir, p, stk); perr != p { - return perr - } - if mode&useVendor != 0 { - if perr := disallowVendor(srcDir, origPath, p, stk); perr != p { - return perr - } - } - - return p -} - -var isDirCache = map[string]bool{} - -func isDir(path string) bool { - result, ok := isDirCache[path] - if ok { - return result - } - - fi, err := os.Stat(path) - result = err == nil && fi.IsDir() - isDirCache[path] = result - return result -} - -// vendoredImportPath returns the expansion of path when it appears in parent. -// If parent is x/y/z, then path might expand to x/y/z/vendor/path, x/y/vendor/path, -// x/vendor/path, vendor/path, or else stay x/y/z if none of those exist. -// vendoredImportPath returns the expanded path or, if no expansion is found, the original. -// If no expansion is found, vendoredImportPath also returns a list of vendor directories -// it searched along the way, to help prepare a useful error message should path turn -// out not to exist. -func vendoredImportPath(parent *Package, path string) (found string, searched []string) { - if parent == nil || parent.Root == "" || !go15VendorExperiment { - return path, nil - } - dir := filepath.Clean(parent.Dir) - root := filepath.Join(parent.Root, "src") - if !hasFilePathPrefix(dir, root) || len(dir) <= len(root) || dir[len(root)] != filepath.Separator { - fatalf("invalid vendoredImportPath: dir=%q root=%q separator=%q", dir, root, string(filepath.Separator)) - } - vpath := "vendor/" + path - for i := len(dir); i >= len(root); i-- { - if i < len(dir) && dir[i] != filepath.Separator { - continue - } - // Note: checking for the vendor directory before checking - // for the vendor/path directory helps us hit the - // isDir cache more often. It also helps us prepare a more useful - // list of places we looked, to report when an import is not found. - if !isDir(filepath.Join(dir[:i], "vendor")) { - continue - } - targ := filepath.Join(dir[:i], vpath) - if isDir(targ) { - // We started with parent's dir c:\gopath\src\foo\bar\baz\quux\xyzzy. - // We know the import path for parent's dir. - // We chopped off some number of path elements and - // added vendor\path to produce c:\gopath\src\foo\bar\baz\vendor\path. - // Now we want to know the import path for that directory. - // Construct it by chopping the same number of path elements - // (actually the same number of bytes) from parent's import path - // and then append /vendor/path. - chopped := len(dir) - i - if chopped == len(parent.ImportPath)+1 { - // We walked up from c:\gopath\src\foo\bar - // and found c:\gopath\src\vendor\path. - // We chopped \foo\bar (length 8) but the import path is "foo/bar" (length 7). - // Use "vendor/path" without any prefix. - return vpath, nil - } - return parent.ImportPath[:len(parent.ImportPath)-chopped] + "/" + vpath, nil - } - // Note the existence of a vendor directory in case path is not found anywhere. - searched = append(searched, targ) - } - return path, searched -} - -// reusePackage reuses package p to satisfy the import at the top -// of the import stack stk. If this use causes an import loop, -// reusePackage updates p's error information to record the loop. -func reusePackage(p *Package, stk *importStack) *Package { - // We use p.imports==nil to detect a package that - // is in the midst of its own loadPackage call - // (all the recursion below happens before p.imports gets set). - if p.imports == nil { - if p.Error == nil { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: "import cycle not allowed", - isImportCycle: true, - } - } - p.Incomplete = true - } - // Don't rewrite the import stack in the error if we have an import cycle. - // If we do, we'll lose the path that describes the cycle. - if p.Error != nil && !p.Error.isImportCycle && stk.shorterThan(p.Error.ImportStack) { - p.Error.ImportStack = stk.copy() - } - return p -} - -// disallowInternal checks that srcDir is allowed to import p. -// If the import is allowed, disallowInternal returns the original package p. -// If not, it returns a new package containing just an appropriate error. -func disallowInternal(srcDir string, p *Package, stk *importStack) *Package { - // golang.org/s/go14internal: - // An import of a path containing the element “internal” - // is disallowed if the importing code is outside the tree - // rooted at the parent of the “internal” directory. - - // There was an error loading the package; stop here. - if p.Error != nil { - return p - } - - // The stack includes p.ImportPath. - // If that's the only thing on the stack, we started - // with a name given on the command line, not an - // import. Anything listed on the command line is fine. - if len(*stk) == 1 { - return p - } - - // Check for "internal" element: four cases depending on begin of string and/or end of string. - i, ok := findInternal(p.ImportPath) - if !ok { - return p - } - - // Internal is present. - // Map import path back to directory corresponding to parent of internal. - if i > 0 { - i-- // rewind over slash in ".../internal" - } - parent := p.Dir[:i+len(p.Dir)-len(p.ImportPath)] - if hasPathPrefix(filepath.ToSlash(srcDir), filepath.ToSlash(parent)) { - return p - } - - // Internal is present, and srcDir is outside parent's tree. Not allowed. - perr := *p - perr.Error = &PackageError{ - ImportStack: stk.copy(), - Err: "use of internal package not allowed", - } - perr.Incomplete = true - return &perr -} - -// findInternal looks for the final "internal" path element in the given import path. -// If there isn't one, findInternal returns ok=false. -// Otherwise, findInternal returns ok=true and the index of the "internal". -func findInternal(path string) (index int, ok bool) { - // Four cases, depending on internal at start/end of string or not. - // The order matters: we must return the index of the final element, - // because the final one produces the most restrictive requirement - // on the importer. - switch { - case strings.HasSuffix(path, "/internal"): - return len(path) - len("internal"), true - case strings.Contains(path, "/internal/"): - return strings.LastIndex(path, "/internal/") + 1, true - case path == "internal", strings.HasPrefix(path, "internal/"): - return 0, true - } - return 0, false -} - -// disallowVendor checks that srcDir is allowed to import p as path. -// If the import is allowed, disallowVendor returns the original package p. -// If not, it returns a new package containing just an appropriate error. -func disallowVendor(srcDir, path string, p *Package, stk *importStack) *Package { - if !go15VendorExperiment { - return p - } - - // The stack includes p.ImportPath. - // If that's the only thing on the stack, we started - // with a name given on the command line, not an - // import. Anything listed on the command line is fine. - if len(*stk) == 1 { - return p - } - - if perr := disallowVendorVisibility(srcDir, p, stk); perr != p { - return perr - } - - // Paths like x/vendor/y must be imported as y, never as x/vendor/y. - if i, ok := findVendor(path); ok { - perr := *p - perr.Error = &PackageError{ - ImportStack: stk.copy(), - Err: "must be imported as " + path[i+len("vendor/"):], - } - perr.Incomplete = true - return &perr - } - - return p -} - -// disallowVendorVisibility checks that srcDir is allowed to import p. -// The rules are the same as for /internal/ except that a path ending in /vendor -// is not subject to the rules, only subdirectories of vendor. -// This allows people to have packages and commands named vendor, -// for maximal compatibility with existing source trees. -func disallowVendorVisibility(srcDir string, p *Package, stk *importStack) *Package { - // The stack includes p.ImportPath. - // If that's the only thing on the stack, we started - // with a name given on the command line, not an - // import. Anything listed on the command line is fine. - if len(*stk) == 1 { - return p - } - - // Check for "vendor" element. - i, ok := findVendor(p.ImportPath) - if !ok { - return p - } - - // Vendor is present. - // Map import path back to directory corresponding to parent of vendor. - if i > 0 { - i-- // rewind over slash in ".../vendor" - } - truncateTo := i + len(p.Dir) - len(p.ImportPath) - if truncateTo < 0 || len(p.Dir) < truncateTo { - return p - } - parent := p.Dir[:truncateTo] - if hasPathPrefix(filepath.ToSlash(srcDir), filepath.ToSlash(parent)) { - return p - } - - // Vendor is present, and srcDir is outside parent's tree. Not allowed. - perr := *p - perr.Error = &PackageError{ - ImportStack: stk.copy(), - Err: "use of vendored package not allowed", - } - perr.Incomplete = true - return &perr -} - -// findVendor looks for the last non-terminating "vendor" path element in the given import path. -// If there isn't one, findVendor returns ok=false. -// Otherwise, findInternal returns ok=true and the index of the "vendor". -// -// Note that terminating "vendor" elements don't count: "x/vendor" is its own package, -// not the vendored copy of an import "" (the empty import path). -// This will allow people to have packages or commands named vendor. -// This may help reduce breakage, or it may just be confusing. We'll see. -func findVendor(path string) (index int, ok bool) { - // Two cases, depending on internal at start of string or not. - // The order matters: we must return the index of the final element, - // because the final one is where the effective import path starts. - switch { - case strings.Contains(path, "/vendor/"): - return strings.LastIndex(path, "/vendor/") + 1, true - case strings.HasPrefix(path, "vendor/"): - return 0, true - } - return 0, false -} - -type targetDir int - -const ( - toRoot targetDir = iota // to bin dir inside package root (default) - toTool // GOROOT/pkg/tool - toBin // GOROOT/bin - stalePath // the old import path; fail to build -) - -// goTools is a map of Go program import path to install target directory. -var goTools = map[string]targetDir{ - "cmd/addr2line": toTool, - "cmd/api": toTool, - "cmd/asm": toTool, - "cmd/compile": toTool, - "cmd/cgo": toTool, - "cmd/cover": toTool, - "cmd/dist": toTool, - "cmd/doc": toTool, - "cmd/fix": toTool, - "cmd/link": toTool, - "cmd/newlink": toTool, - "cmd/nm": toTool, - "cmd/objdump": toTool, - "cmd/pack": toTool, - "cmd/pprof": toTool, - "cmd/trace": toTool, - "cmd/vet": toTool, - "cmd/yacc": toTool, - "golang.org/x/tools/cmd/godoc": toBin, - "code.google.com/p/go.tools/cmd/cover": stalePath, - "code.google.com/p/go.tools/cmd/godoc": stalePath, - "code.google.com/p/go.tools/cmd/vet": stalePath, -} - -// expandScanner expands a scanner.List error into all the errors in the list. -// The default Error method only shows the first error. -func expandScanner(err error) error { - // Look for parser errors. - if err, ok := err.(scanner.ErrorList); ok { - // Prepare error with \n before each message. - // When printed in something like context: %v - // this will put the leading file positions each on - // its own line. It will also show all the errors - // instead of just the first, as err.Error does. - var buf bytes.Buffer - for _, e := range err { - e.Pos.Filename = shortPath(e.Pos.Filename) - buf.WriteString("\n") - buf.WriteString(e.Error()) - } - return errors.New(buf.String()) - } - return err -} - -var raceExclude = map[string]bool{ - "runtime/race": true, - "runtime/cgo": true, - "cmd/cgo": true, - "syscall": true, - "errors": true, -} - -var cgoExclude = map[string]bool{ - "runtime/cgo": true, -} - -var cgoSyscallExclude = map[string]bool{ - "runtime/cgo": true, - "runtime/race": true, -} - -// load populates p using information from bp, err, which should -// be the result of calling build.Context.Import. -func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package { - p.copyBuild(bp) - - // The localPrefix is the path we interpret ./ imports relative to. - // Synthesized main packages sometimes override this. - p.localPrefix = dirToImportPath(p.Dir) - - if err != nil { - p.Incomplete = true - err = expandScanner(err) - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: err.Error(), - } - return p - } - - useBindir := p.Name == "main" - if !p.Standard { - switch buildBuildmode { - case "c-archive", "c-shared": - useBindir = false - } - } - - if useBindir { - // Report an error when the old code.google.com/p/go.tools paths are used. - if goTools[p.ImportPath] == stalePath { - newPath := strings.Replace(p.ImportPath, "code.google.com/p/go.", "golang.org/x/", 1) - e := fmt.Sprintf("the %v command has moved; use %v instead.", p.ImportPath, newPath) - p.Error = &PackageError{Err: e} - return p - } - _, elem := filepath.Split(p.Dir) - full := buildContext.GOOS + "_" + buildContext.GOARCH + "/" + elem - if buildContext.GOOS != toolGOOS || buildContext.GOARCH != toolGOARCH { - // Install cross-compiled binaries to subdirectories of bin. - elem = full - } - if p.build.BinDir != gobin && goTools[p.ImportPath] == toBin { - // Override BinDir. - // This is from a subrepo but installs to $GOROOT/bin - // by default anyway (like godoc). - p.target = filepath.Join(gorootBin, elem) - } else if p.build.BinDir != "" { - // Install to GOBIN or bin of GOPATH entry. - p.target = filepath.Join(p.build.BinDir, elem) - if !p.Goroot && strings.Contains(elem, "/") && gobin != "" { - // Do not create $GOBIN/goos_goarch/elem. - p.target = "" - p.gobinSubdir = true - } - } - if goTools[p.ImportPath] == toTool { - // This is for 'go tool'. - // Override all the usual logic and force it into the tool directory. - if buildContext.Compiler == "gccgo" { - p.target = filepath.Join(runtime.GCCGOTOOLDIR, elem) - } else { - p.target = filepath.Join(gorootPkg, "tool", full) - } - } - if p.target != "" && buildContext.GOOS == "windows" { - p.target += ".exe" - } - } else if p.local { - // Local import turned into absolute path. - // No permanent install target. - p.target = "" - } else { - p.target = p.build.PkgObj - if buildLinkshared { - shlibnamefile := p.target[:len(p.target)-2] + ".shlibname" - shlib, err := ioutil.ReadFile(shlibnamefile) - if err == nil { - libname := strings.TrimSpace(string(shlib)) - if buildContext.Compiler == "gccgo" { - p.Shlib = filepath.Join(p.build.PkgTargetRoot, "shlibs", libname) - } else { - p.Shlib = filepath.Join(p.build.PkgTargetRoot, libname) - - } - } else if !os.IsNotExist(err) { - fatalf("unexpected error reading %s: %v", shlibnamefile, err) - } - } - } - - importPaths := p.Imports - // Packages that use cgo import runtime/cgo implicitly. - // Packages that use cgo also import syscall implicitly, - // to wrap errno. - // Exclude certain packages to avoid circular dependencies. - if len(p.CgoFiles) > 0 && (!p.Standard || !cgoExclude[p.ImportPath]) { - importPaths = append(importPaths, "runtime/cgo") - } - if len(p.CgoFiles) > 0 && (!p.Standard || !cgoSyscallExclude[p.ImportPath]) { - importPaths = append(importPaths, "syscall") - } - - // Currently build mode c-shared, or -linkshared, forces - // external linking mode, and external linking mode forces an - // import of runtime/cgo. - if p.Name == "main" && !p.Goroot && (buildBuildmode == "c-shared" || buildLinkshared) { - importPaths = append(importPaths, "runtime/cgo") - } - - // Everything depends on runtime, except runtime and unsafe. - if !p.Standard || (p.ImportPath != "runtime" && p.ImportPath != "unsafe") { - importPaths = append(importPaths, "runtime") - // When race detection enabled everything depends on runtime/race. - // Exclude certain packages to avoid circular dependencies. - if buildRace && (!p.Standard || !raceExclude[p.ImportPath]) { - importPaths = append(importPaths, "runtime/race") - } - // On ARM with GOARM=5, everything depends on math for the link. - if p.Name == "main" && goarch == "arm" { - importPaths = append(importPaths, "math") - } - } - - // Build list of full paths to all Go files in the package, - // for use by commands like go fmt. - p.gofiles = stringList(p.GoFiles, p.CgoFiles, p.TestGoFiles, p.XTestGoFiles) - for i := range p.gofiles { - p.gofiles[i] = filepath.Join(p.Dir, p.gofiles[i]) - } - sort.Strings(p.gofiles) - - p.sfiles = stringList(p.SFiles) - for i := range p.sfiles { - p.sfiles[i] = filepath.Join(p.Dir, p.sfiles[i]) - } - sort.Strings(p.sfiles) - - p.allgofiles = stringList(p.IgnoredGoFiles) - for i := range p.allgofiles { - p.allgofiles[i] = filepath.Join(p.Dir, p.allgofiles[i]) - } - p.allgofiles = append(p.allgofiles, p.gofiles...) - sort.Strings(p.allgofiles) - - // Check for case-insensitive collision of input files. - // To avoid problems on case-insensitive files, we reject any package - // where two different input files have equal names under a case-insensitive - // comparison. - f1, f2 := foldDup(stringList( - p.GoFiles, - p.CgoFiles, - p.IgnoredGoFiles, - p.CFiles, - p.CXXFiles, - p.MFiles, - p.HFiles, - p.SFiles, - p.SysoFiles, - p.SwigFiles, - p.SwigCXXFiles, - p.TestGoFiles, - p.XTestGoFiles, - )) - if f1 != "" { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("case-insensitive file name collision: %q and %q", f1, f2), - } - return p - } - - // Build list of imported packages and full dependency list. - imports := make([]*Package, 0, len(p.Imports)) - deps := make(map[string]*Package) - for i, path := range importPaths { - if path == "C" { - continue - } - p1 := loadImport(path, p.Dir, p, stk, p.build.ImportPos[path], useVendor) - if !reqStdPkgSrc && p1.Standard { - continue - } - if p1.Name == "main" { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("import %q is a program, not an importable package", path), - } - pos := p.build.ImportPos[path] - if len(pos) > 0 { - p.Error.Pos = pos[0].String() - } - } - if p1.local { - if !p.local && p.Error == nil { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("local import %q in non-local package", path), - } - pos := p.build.ImportPos[path] - if len(pos) > 0 { - p.Error.Pos = pos[0].String() - } - } - } - path = p1.ImportPath - importPaths[i] = path - if i < len(p.Imports) { - p.Imports[i] = path - } - deps[path] = p1 - imports = append(imports, p1) - for _, dep := range p1.deps { - // The same import path could produce an error or not, - // depending on what tries to import it. - // Prefer to record entries with errors, so we can report them. - if deps[dep.ImportPath] == nil || dep.Error != nil { - deps[dep.ImportPath] = dep - } - } - if p1.Incomplete { - p.Incomplete = true - } - } - p.imports = imports - - p.Deps = make([]string, 0, len(deps)) - for dep := range deps { - p.Deps = append(p.Deps, dep) - } - sort.Strings(p.Deps) - for _, dep := range p.Deps { - p1 := deps[dep] - if p1 == nil { - panic("impossible: missing entry in package cache for " + dep + " imported by " + p.ImportPath) - } - p.deps = append(p.deps, p1) - if p1.Error != nil { - p.DepsErrors = append(p.DepsErrors, p1.Error) - } - } - - // unsafe is a fake package. - if p.Standard && (p.ImportPath == "unsafe" || buildContext.Compiler == "gccgo") { - p.target = "" - } - p.Target = p.target - - // The gc toolchain only permits C source files with cgo. - if len(p.CFiles) > 0 && !p.usesCgo() && !p.usesSwig() && buildContext.Compiler == "gc" { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("C source files not allowed when not using cgo or SWIG: %s", strings.Join(p.CFiles, " ")), - } - return p - } - - // In the absence of errors lower in the dependency tree, - // check for case-insensitive collisions of import paths. - if len(p.DepsErrors) == 0 { - dep1, dep2 := foldDup(p.Deps) - if dep1 != "" { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("case-insensitive import collision: %q and %q", dep1, dep2), - } - return p - } - } - - computeBuildID(p) - return p -} - -// usesSwig reports whether the package needs to run SWIG. -func (p *Package) usesSwig() bool { - return len(p.SwigFiles) > 0 || len(p.SwigCXXFiles) > 0 -} - -// usesCgo reports whether the package needs to run cgo -func (p *Package) usesCgo() bool { - return len(p.CgoFiles) > 0 -} - -// packageList returns the list of packages in the dag rooted at roots -// as visited in a depth-first post-order traversal. -func packageList(roots []*Package) []*Package { - seen := map[*Package]bool{} - all := []*Package{} - var walk func(*Package) - walk = func(p *Package) { - if seen[p] { - return - } - seen[p] = true - for _, p1 := range p.imports { - walk(p1) - } - all = append(all, p) - } - for _, root := range roots { - walk(root) - } - return all -} - -// computeStale computes the Stale flag in the package dag that starts -// at the named pkgs (command-line arguments). -func computeStale(pkgs ...*Package) { - for _, p := range packageList(pkgs) { - p.Stale = isStale(p) - } -} - -// The runtime version string takes one of two forms: -// "go1.X[.Y]" for Go releases, and "devel +hash" at tip. -// Determine whether we are in a released copy by -// inspecting the version. -var isGoRelease = strings.HasPrefix(runtime.Version(), "go1") - -// isStale and computeBuildID -// -// Theory of Operation -// -// There is an installed copy of the package (or binary). -// Can we reuse the installed copy, or do we need to build a new one? -// -// We can use the installed copy if it matches what we'd get -// by building a new one. The hard part is predicting that without -// actually running a build. -// -// To start, we must know the set of inputs to the build process that can -// affect the generated output. At a minimum, that includes the source -// files for the package and also any compiled packages imported by those -// source files. The *Package has these, and we use them. One might also -// argue for including in the input set: the build tags, whether the race -// detector is in use, the target operating system and architecture, the -// compiler and linker binaries being used, the additional flags being -// passed to those, the cgo binary being used, the additional flags cgo -// passes to the host C compiler, the host C compiler being used, the set -// of host C include files and installed C libraries, and so on. -// We include some but not all of this information. -// -// Once we have decided on a set of inputs, we must next decide how to -// tell whether the content of that set has changed since the last build -// of p. If there have been no changes, then we assume a new build would -// produce the same result and reuse the installed package or binary. -// But if there have been changes, then we assume a new build might not -// produce the same result, so we rebuild. -// -// There are two common ways to decide whether the content of the set has -// changed: modification times and content hashes. We use a mixture of both. -// -// The use of modification times (mtimes) was pioneered by make: -// assuming that a file's mtime is an accurate record of when that file was last written, -// and assuming that the modification time of an installed package or -// binary is the time that it was built, if the mtimes of the inputs -// predate the mtime of the installed object, then the build of that -// object saw those versions of the files, and therefore a rebuild using -// those same versions would produce the same object. In contrast, if any -// mtime of an input is newer than the mtime of the installed object, a -// change has occurred since the build, and the build should be redone. -// -// Modification times are attractive because the logic is easy to -// understand and the file system maintains the mtimes automatically -// (less work for us). Unfortunately, there are a variety of ways in -// which the mtime approach fails to detect a change and reuses a stale -// object file incorrectly. (Making the opposite mistake, rebuilding -// unnecessarily, is only a performance problem and not a correctness -// problem, so we ignore that one.) -// -// As a warmup, one problem is that to be perfectly precise, we need to -// compare the input mtimes against the time at the beginning of the -// build, but the object file time is the time at the end of the build. -// If an input file changes after being read but before the object is -// written, the next build will see an object newer than the input and -// will incorrectly decide that the object is up to date. We make no -// attempt to detect or solve this problem. -// -// Another problem is that due to file system imprecision, an input and -// output that are actually ordered in time have the same mtime. -// This typically happens on file systems with 1-second (or, worse, -// 2-second) mtime granularity and with automated scripts that write an -// input and then immediately run a build, or vice versa. If an input and -// an output have the same mtime, the conservative behavior is to treat -// the output as out-of-date and rebuild. This can cause one or more -// spurious rebuilds, but only for 1 second, until the object finally has -// an mtime later than the input. -// -// Another problem is that binary distributions often set the mtime on -// all files to the same time. If the distribution includes both inputs -// and cached build outputs, the conservative solution to the previous -// problem will cause unnecessary rebuilds. Worse, in such a binary -// distribution, those rebuilds might not even have permission to update -// the cached build output. To avoid these write errors, if an input and -// output have the same mtime, we assume the output is up-to-date. -// This is the opposite of what the previous problem would have us do, -// but binary distributions are more common than instances of the -// previous problem. -// -// A variant of the last problem is that some binary distributions do not -// set the mtime on all files to the same time. Instead they let the file -// system record mtimes as the distribution is unpacked. If the outputs -// are unpacked before the inputs, they'll be older and a build will try -// to rebuild them. That rebuild might hit the same write errors as in -// the last scenario. We don't make any attempt to solve this, and we -// haven't had many reports of it. Perhaps the only time this happens is -// when people manually unpack the distribution, and most of the time -// that's done as the same user who will be using it, so an initial -// rebuild on first use succeeds quietly. -// -// More generally, people and programs change mtimes on files. The last -// few problems were specific examples of this, but it's a general problem. -// For example, instead of a binary distribution, copying a home -// directory from one directory or machine to another might copy files -// but not preserve mtimes. If the inputs are new than the outputs on the -// first machine but copied first, they end up older than the outputs on -// the second machine. -// -// Because many other build systems have the same sensitivity to mtimes, -// most programs manipulating source code take pains not to break the -// mtime assumptions. For example, Git does not set the mtime of files -// during a checkout operation, even when checking out an old version of -// the code. This decision was made specifically to work well with -// mtime-based build systems. -// -// The killer problem, though, for mtime-based build systems is that the -// build only has access to the mtimes of the inputs that still exist. -// If it is possible to remove an input without changing any other inputs, -// a later build will think the object is up-to-date when it is not. -// This happens for Go because a package is made up of all source -// files in a directory. If a source file is removed, there is no newer -// mtime available recording that fact. The mtime on the directory could -// be used, but it also changes when unrelated files are added to or -// removed from the directory, so including the directory mtime would -// cause unnecessary rebuilds, possibly many. It would also exacerbate -// the problems mentioned earlier, since even programs that are careful -// to maintain mtimes on files rarely maintain mtimes on directories. -// -// A variant of the last problem is when the inputs change for other -// reasons. For example, Go 1.4 and Go 1.5 both install $GOPATH/src/mypkg -// into the same target, $GOPATH/pkg/$GOOS_$GOARCH/mypkg.a. -// If Go 1.4 has built mypkg into mypkg.a, a build using Go 1.5 must -// rebuild mypkg.a, but from mtimes alone mypkg.a looks up-to-date. -// If Go 1.5 has just been installed, perhaps the compiler will have a -// newer mtime; since the compiler is considered an input, that would -// trigger a rebuild. But only once, and only the last Go 1.4 build of -// mypkg.a happened before Go 1.5 was installed. If a user has the two -// versions installed in different locations and flips back and forth, -// mtimes alone cannot tell what to do. Changing the toolchain is -// changing the set of inputs, without affecting any mtimes. -// -// To detect the set of inputs changing, we turn away from mtimes and to -// an explicit data comparison. Specifically, we build a list of the -// inputs to the build, compute its SHA1 hash, and record that as the -// ``build ID'' in the generated object. At the next build, we can -// recompute the buid ID and compare it to the one in the generated -// object. If they differ, the list of inputs has changed, so the object -// is out of date and must be rebuilt. -// -// Because this build ID is computed before the build begins, the -// comparison does not have the race that mtime comparison does. -// -// Making the build sensitive to changes in other state is -// straightforward: include the state in the build ID hash, and if it -// changes, so does the build ID, triggering a rebuild. -// -// To detect changes in toolchain, we include the toolchain version in -// the build ID hash for package runtime, and then we include the build -// IDs of all imported packages in the build ID for p. -// -// It is natural to think about including build tags in the build ID, but -// the naive approach of just dumping the tags into the hash would cause -// spurious rebuilds. For example, 'go install' and 'go install -tags neverusedtag' -// produce the same binaries (assuming neverusedtag is never used). -// A more precise approach would be to include only tags that have an -// effect on the build. But the effect of a tag on the build is to -// include or exclude a file from the compilation, and that file list is -// already in the build ID hash. So the build ID is already tag-sensitive -// in a perfectly precise way. So we do NOT explicitly add build tags to -// the build ID hash. -// -// We do not include as part of the build ID the operating system, -// architecture, or whether the race detector is enabled, even though all -// three have an effect on the output, because that information is used -// to decide the install location. Binaries for linux and binaries for -// darwin are written to different directory trees; including that -// information in the build ID is unnecessary (although it would be -// harmless). -// -// TODO(rsc): Investigate the cost of putting source file content into -// the build ID hash as a replacement for the use of mtimes. Using the -// file content would avoid all the mtime problems, but it does require -// reading all the source files, something we avoid today (we read the -// beginning to find the build tags and the imports, but we stop as soon -// as we see the import block is over). If the package is stale, the compiler -// is going to read the files anyway. But if the package is up-to-date, the -// read is overhead. -// -// TODO(rsc): Investigate the complexity of making the build more -// precise about when individual results are needed. To be fully precise, -// there are two results of a compilation: the entire .a file used by the link -// and the subpiece used by later compilations (__.PKGDEF only). -// If a rebuild is needed but produces the previous __.PKGDEF, then -// no more recompilation due to the rebuilt package is needed, only -// relinking. To date, there is nothing in the Go command to express this. -// -// Special Cases -// -// When the go command makes the wrong build decision and does not -// rebuild something it should, users fall back to adding the -a flag. -// Any common use of the -a flag should be considered prima facie evidence -// that isStale is returning an incorrect false result in some important case. -// Bugs reported in the behavior of -a itself should prompt the question -// ``Why is -a being used at all? What bug does that indicate?'' -// -// There is a long history of changes to isStale to try to make -a into a -// suitable workaround for bugs in the mtime-based decisions. -// It is worth recording that history to inform (and, as much as possible, deter) future changes. -// -// (1) Before the build IDs were introduced, building with alternate tags -// would happily reuse installed objects built without those tags. -// For example, "go build -tags netgo myprog.go" would use the installed -// copy of package net, even if that copy had been built without netgo. -// (The netgo tag controls whether package net uses cgo or pure Go for -// functionality such as name resolution.) -// Using the installed non-netgo package defeats the purpose. -// -// Users worked around this with "go build -tags netgo -a myprog.go". -// -// Build IDs have made that workaround unnecessary: -// "go build -tags netgo myprog.go" -// cannot use a non-netgo copy of package net. -// -// (2) Before the build IDs were introduced, building with different toolchains, -// especially changing between toolchains, tried to reuse objects stored in -// $GOPATH/pkg, resulting in link-time errors about object file mismatches. -// -// Users worked around this with "go install -a ./...". -// -// Build IDs have made that workaround unnecessary: -// "go install ./..." will rebuild any objects it finds that were built against -// a different toolchain. -// -// (3) The common use of "go install -a ./..." led to reports of problems -// when the -a forced the rebuild of the standard library, which for some -// users was not writable. Because we didn't understand that the real -// problem was the bug -a was working around, we changed -a not to -// apply to the standard library. -// -// (4) The common use of "go build -tags netgo -a myprog.go" broke -// when we changed -a not to apply to the standard library, because -// if go build doesn't rebuild package net, it uses the non-netgo version. -// -// Users worked around this with "go build -tags netgo -installsuffix barf myprog.go". -// The -installsuffix here is making the go command look for packages -// in pkg/$GOOS_$GOARCH_barf instead of pkg/$GOOS_$GOARCH. -// Since the former presumably doesn't exist, go build decides to rebuild -// everything, including the standard library. Since go build doesn't -// install anything it builds, nothing is ever written to pkg/$GOOS_$GOARCH_barf, -// so repeated invocations continue to work. -// -// If the use of -a wasn't a red flag, the use of -installsuffix to point to -// a non-existent directory in a command that installs nothing should -// have been. -// -// (5) Now that (1) and (2) no longer need -a, we have removed the kludge -// introduced in (3): once again, -a means ``rebuild everything,'' not -// ``rebuild everything except the standard library.'' Only Go 1.4 had -// the restricted meaning. -// -// In addition to these cases trying to trigger rebuilds, there are -// special cases trying NOT to trigger rebuilds. The main one is that for -// a variety of reasons (see above), the install process for a Go release -// cannot be relied upon to set the mtimes such that the go command will -// think the standard library is up to date. So the mtime evidence is -// ignored for the standard library if we find ourselves in a release -// version of Go. Build ID-based staleness checks still apply to the -// standard library, even in release versions. This makes -// 'go build -tags netgo' work, among other things. - -// isStale reports whether package p needs to be rebuilt. -func isStale(p *Package) bool { - if p.Standard && (p.ImportPath == "unsafe" || buildContext.Compiler == "gccgo") { - // fake, builtin package - return false - } - if p.Error != nil { - return true - } - - // A package without Go sources means we only found - // the installed .a file. Since we don't know how to rebuild - // it, it can't be stale, even if -a is set. This enables binary-only - // distributions of Go packages, although such binaries are - // only useful with the specific version of the toolchain that - // created them. - if len(p.gofiles) == 0 && !p.usesSwig() { - return false - } - - // If the -a flag is given, rebuild everything. - if buildA { - return true - } - - // If there's no install target or it's already marked stale, we have to rebuild. - if p.target == "" || p.Stale { - return true - } - - // Package is stale if completely unbuilt. - fi, err := os.Stat(p.target) - if err != nil { - return true - } - - // Package is stale if the expected build ID differs from the - // recorded build ID. This catches changes like a source file - // being removed from a package directory. See issue 3895. - // It also catches changes in build tags that affect the set of - // files being compiled. See issue 9369. - // It also catches changes in toolchain, like when flipping between - // two versions of Go compiling a single GOPATH. - // See issue 8290 and issue 10702. - targetBuildID, err := readBuildID(p) - if err == nil && targetBuildID != p.buildID { - return true - } - - // Package is stale if a dependency is. - for _, p1 := range p.deps { - if p1.Stale { - return true - } - } - - // The checks above are content-based staleness. - // We assume they are always accurate. - // - // The checks below are mtime-based staleness. - // We hope they are accurate, but we know that they fail in the case of - // prebuilt Go installations that don't preserve the build mtimes - // (for example, if the pkg/ mtimes are before the src/ mtimes). - // See the large comment above isStale for details. - - // If we are running a release copy of Go and didn't find a content-based - // reason to rebuild the standard packages, do not rebuild them. - // They may not be writable anyway, but they are certainly not changing. - // This makes 'go build' skip the standard packages when - // using an official release, even when the mtimes have been changed. - // See issue 3036, issue 3149, issue 4106, issue 8290. - // (If a change to a release tree must be made by hand, the way to force the - // install is to run make.bash, which will remove the old package archives - // before rebuilding.) - if p.Standard && isGoRelease { - return false - } - - // Time-based staleness. - - built := fi.ModTime() - - olderThan := func(file string) bool { - fi, err := os.Stat(file) - return err != nil || fi.ModTime().After(built) - } - - // Package is stale if a dependency is, or if a dependency is newer. - for _, p1 := range p.deps { - if p1.target != "" && olderThan(p1.target) { - return true - } - } - - // As a courtesy to developers installing new versions of the compiler - // frequently, define that packages are stale if they are - // older than the compiler, and commands if they are older than - // the linker. This heuristic will not work if the binaries are - // back-dated, as some binary distributions may do, but it does handle - // a very common case. - // See issue 3036. - // Exclude $GOROOT, under the assumption that people working on - // the compiler may want to control when everything gets rebuilt, - // and people updating the Go repository will run make.bash or all.bash - // and get a full rebuild anyway. - // Excluding $GOROOT used to also fix issue 4106, but that's now - // taken care of above (at least when the installed Go is a released version). - if p.Root != goroot { - if olderThan(buildToolchain.compiler()) { - return true - } - if p.build.IsCommand() && olderThan(buildToolchain.linker()) { - return true - } - } - - // Note: Until Go 1.5, we had an additional shortcut here. - // We built a list of the workspace roots ($GOROOT, each $GOPATH) - // containing targets directly named on the command line, - // and if p were not in any of those, it would be treated as up-to-date - // as long as it is built. The goal was to avoid rebuilding a system-installed - // $GOROOT, unless something from $GOROOT were explicitly named - // on the command line (like go install math). - // That's now handled by the isGoRelease clause above. - // The other effect of the shortcut was to isolate different entries in - // $GOPATH from each other. This had the unfortunate effect that - // if you had (say), GOPATH listing two entries, one for commands - // and one for libraries, and you did a 'git pull' in the library one - // and then tried 'go install commands/...', it would build the new libraries - // during the first build (because they wouldn't have been installed at all) - // but then subsequent builds would not rebuild the libraries, even if the - // mtimes indicate they are stale, because the different GOPATH entries - // were treated differently. This behavior was confusing when using - // non-trivial GOPATHs, which were particularly common with some - // code management conventions, like the original godep. - // Since the $GOROOT case (the original motivation) is handled separately, - // we no longer put a barrier between the different $GOPATH entries. - // - // One implication of this is that if there is a system directory for - // non-standard Go packages that is included in $GOPATH, the mtimes - // on those compiled packages must be no earlier than the mtimes - // on the source files. Since most distributions use the same mtime - // for all files in a tree, they will be unaffected. People using plain - // tar x to extract system-installed packages will need to adjust mtimes, - // but it's better to force them to get the mtimes right than to ignore - // the mtimes and thereby do the wrong thing in common use cases. - // - // So there is no GOPATH vs GOPATH shortcut here anymore. - // - // If something needs to come back here, we could try writing a dummy - // file with a random name to the $GOPATH/pkg directory (and removing it) - // to test for write access, and then skip GOPATH roots we don't have write - // access to. But hopefully we can just use the mtimes always. - - srcs := stringList(p.GoFiles, p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.SFiles, p.CgoFiles, p.SysoFiles, p.SwigFiles, p.SwigCXXFiles) - for _, src := range srcs { - if olderThan(filepath.Join(p.Dir, src)) { - return true - } - } - - return false -} - -// computeBuildID computes the build ID for p, leaving it in p.buildID. -// Build ID is a hash of the information we want to detect changes in. -// See the long comment in isStale for details. -func computeBuildID(p *Package) { - h := sha1.New() - - // Include the list of files compiled as part of the package. - // This lets us detect removed files. See issue 3895. - inputFiles := stringList( - p.GoFiles, - p.CgoFiles, - p.CFiles, - p.CXXFiles, - p.MFiles, - p.HFiles, - p.SFiles, - p.SysoFiles, - p.SwigFiles, - p.SwigCXXFiles, - ) - for _, file := range inputFiles { - fmt.Fprintf(h, "file %s\n", file) - } - - // Include the content of runtime/zversion.go in the hash - // for package runtime. This will give package runtime a - // different build ID in each Go release. - if p.Standard && p.ImportPath == "runtime" { - data, _ := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go")) - fmt.Fprintf(h, "zversion %q\n", string(data)) - } - - // Include the build IDs of any dependencies in the hash. - // This, combined with the runtime/zversion content, - // will cause packages to have different build IDs when - // compiled with different Go releases. - // This helps the go command know to recompile when - // people use the same GOPATH but switch between - // different Go releases. See issue 10702. - // This is also a better fix for issue 8290. - for _, p1 := range p.deps { - fmt.Fprintf(h, "dep %s %s\n", p1.ImportPath, p1.buildID) - } - - p.buildID = fmt.Sprintf("%x", h.Sum(nil)) -} - -var cwd, _ = os.Getwd() - -var cmdCache = map[string]*Package{} - -// loadPackage is like loadImport but is used for command-line arguments, -// not for paths found in import statements. In addition to ordinary import paths, -// loadPackage accepts pseudo-paths beginning with cmd/ to denote commands -// in the Go command directory, as well as paths to those directories. -func loadPackage(arg string, stk *importStack) *Package { - if build.IsLocalImport(arg) { - dir := arg - if !filepath.IsAbs(dir) { - if abs, err := filepath.Abs(dir); err == nil { - // interpret relative to current directory - dir = abs - } - } - if sub, ok := hasSubdir(gorootSrc, dir); ok && strings.HasPrefix(sub, "cmd/") && !strings.Contains(sub[4:], "/") { - arg = sub - } - } - if strings.HasPrefix(arg, "cmd/") && !strings.Contains(arg[4:], "/") { - if p := cmdCache[arg]; p != nil { - return p - } - stk.push(arg) - defer stk.pop() - - bp, err := buildContext.ImportDir(filepath.Join(gorootSrc, arg), 0) - bp.ImportPath = arg - bp.Goroot = true - bp.BinDir = gorootBin - if gobin != "" { - bp.BinDir = gobin - } - bp.Root = goroot - bp.SrcRoot = gorootSrc - p := new(Package) - cmdCache[arg] = p - p.load(stk, bp, err) - if p.Error == nil && p.Name != "main" { - p.Error = &PackageError{ - ImportStack: stk.copy(), - Err: fmt.Sprintf("expected package main but found package %s in %s", p.Name, p.Dir), - } - } - return p - } - - // Wasn't a command; must be a package. - // If it is a local import path but names a standard package, - // we treat it as if the user specified the standard package. - // This lets you run go test ./ioutil in package io and be - // referring to io/ioutil rather than a hypothetical import of - // "./ioutil". - if build.IsLocalImport(arg) { - bp, _ := buildContext.ImportDir(filepath.Join(cwd, arg), build.FindOnly) - if bp.ImportPath != "" && bp.ImportPath != "." { - arg = bp.ImportPath - } - } - - return loadImport(arg, cwd, nil, stk, nil, 0) -} - -// packages returns the packages named by the -// command line arguments 'args'. If a named package -// cannot be loaded at all (for example, if the directory does not exist), -// then packages prints an error and does not include that -// package in the results. However, if errors occur trying -// to load dependencies of a named package, the named -// package is still returned, with p.Incomplete = true -// and details in p.DepsErrors. -func packages(args []string) []*Package { - var pkgs []*Package - for _, pkg := range packagesAndErrors(args) { - if pkg.Error != nil { - errorf("can't load package: %s", pkg.Error) - continue - } - pkgs = append(pkgs, pkg) - } - return pkgs -} - -// packagesAndErrors is like 'packages' but returns a -// *Package for every argument, even the ones that -// cannot be loaded at all. -// The packages that fail to load will have p.Error != nil. -func packagesAndErrors(args []string) []*Package { - if len(args) > 0 && strings.HasSuffix(args[0], ".go") { - return []*Package{goFilesPackage(args)} - } - - args = importPaths(args) - var pkgs []*Package - var stk importStack - var set = make(map[string]bool) - - for _, arg := range args { - if !set[arg] { - pkgs = append(pkgs, loadPackage(arg, &stk)) - set[arg] = true - } - } - computeStale(pkgs...) - - return pkgs -} - -// packagesForBuild is like 'packages' but fails if any of -// the packages or their dependencies have errors -// (cannot be built). -func packagesForBuild(args []string) []*Package { - pkgs := packagesAndErrors(args) - printed := map[*PackageError]bool{} - for _, pkg := range pkgs { - if pkg.Error != nil { - errorf("can't load package: %s", pkg.Error) - } - for _, err := range pkg.DepsErrors { - // Since these are errors in dependencies, - // the same error might show up multiple times, - // once in each package that depends on it. - // Only print each once. - if !printed[err] { - printed[err] = true - errorf("%s", err) - } - } - } - exitIfErrors() - - // Check for duplicate loads of the same package. - // That should be impossible, but if it does happen then - // we end up trying to build the same package twice, - // usually in parallel overwriting the same files, - // which doesn't work very well. - seen := map[string]bool{} - reported := map[string]bool{} - for _, pkg := range packageList(pkgs) { - if seen[pkg.ImportPath] && !reported[pkg.ImportPath] { - reported[pkg.ImportPath] = true - errorf("internal error: duplicate loads of %s", pkg.ImportPath) - } - seen[pkg.ImportPath] = true - } - exitIfErrors() - - return pkgs -} - -// hasSubdir reports whether dir is a subdirectory of -// (possibly multiple levels below) root. -// If so, it sets rel to the path fragment that must be -// appended to root to reach dir. -func hasSubdir(root, dir string) (rel string, ok bool) { - if p, err := filepath.EvalSymlinks(root); err == nil { - root = p - } - if p, err := filepath.EvalSymlinks(dir); err == nil { - dir = p - } - const sep = string(filepath.Separator) - root = filepath.Clean(root) - if !strings.HasSuffix(root, sep) { - root += sep - } - dir = filepath.Clean(dir) - if !strings.HasPrefix(dir, root) { - return "", false - } - return filepath.ToSlash(dir[len(root):]), true -} - -var ( - errBuildIDToolchain = fmt.Errorf("build ID only supported in gc toolchain") - errBuildIDMalformed = fmt.Errorf("malformed object file") - errBuildIDUnknown = fmt.Errorf("lost build ID") -) - -var ( - bangArch = []byte("!") - pkgdef = []byte("__.PKGDEF") - goobject = []byte("go object ") - buildid = []byte("build id ") -) - -// readBuildID reads the build ID from an archive or binary. -// It only supports the gc toolchain. -// Other toolchain maintainers should adjust this function. -func readBuildID(p *Package) (id string, err error) { - if buildToolchain != (gcToolchain{}) { - return "", errBuildIDToolchain - } - - // For commands, read build ID directly from binary. - if p.Name == "main" { - return ReadBuildIDFromBinary(p.Target) - } - - // Otherwise, we expect to have an archive (.a) file, - // and we can read the build ID from the Go export data. - if !strings.HasSuffix(p.Target, ".a") { - return "", &os.PathError{Op: "parse", Path: p.Target, Err: errBuildIDUnknown} - } - - // Read just enough of the target to fetch the build ID. - // The archive is expected to look like: - // - // ! - // __.PKGDEF 0 0 0 644 7955 ` - // go object darwin amd64 devel X:none - // build id "b41e5c45250e25c9fd5e9f9a1de7857ea0d41224" - // - // The variable-sized strings are GOOS, GOARCH, and the experiment list (X:none). - // Reading the first 1024 bytes should be plenty. - f, err := os.Open(p.Target) - if err != nil { - return "", err - } - data := make([]byte, 1024) - n, err := io.ReadFull(f, data) - f.Close() - - if err != nil && n == 0 { - return "", err - } - - bad := func() (string, error) { - return "", &os.PathError{Op: "parse", Path: p.Target, Err: errBuildIDMalformed} - } - - // Archive header. - for i := 0; ; i++ { // returns during i==3 - j := bytes.IndexByte(data, '\n') - if j < 0 { - return bad() - } - line := data[:j] - data = data[j+1:] - switch i { - case 0: - if !bytes.Equal(line, bangArch) { - return bad() - } - case 1: - if !bytes.HasPrefix(line, pkgdef) { - return bad() - } - case 2: - if !bytes.HasPrefix(line, goobject) { - return bad() - } - case 3: - if !bytes.HasPrefix(line, buildid) { - // Found the object header, just doesn't have a build id line. - // Treat as successful, with empty build id. - return "", nil - } - id, err := strconv.Unquote(string(line[len(buildid):])) - if err != nil { - return bad() - } - return id, nil - } - } -} - -var ( - goBuildPrefix = []byte("\xff Go build ID: \"") - goBuildEnd = []byte("\"\n \xff") - - elfPrefix = []byte("\x7fELF") -) - -// ReadBuildIDFromBinary reads the build ID from a binary. -// -// ELF binaries store the build ID in a proper PT_NOTE section. -// -// Other binary formats are not so flexible. For those, the linker -// stores the build ID as non-instruction bytes at the very beginning -// of the text segment, which should appear near the beginning -// of the file. This is clumsy but fairly portable. Custom locations -// can be added for other binary types as needed, like we did for ELF. -func ReadBuildIDFromBinary(filename string) (id string, err error) { - if filename == "" { - return "", &os.PathError{Op: "parse", Path: filename, Err: errBuildIDUnknown} - } - - // Read the first 16 kB of the binary file. - // That should be enough to find the build ID. - // In ELF files, the build ID is in the leading headers, - // which are typically less than 4 kB, not to mention 16 kB. - // On other systems, we're trying to read enough that - // we get the beginning of the text segment in the read. - // The offset where the text segment begins in a hello - // world compiled for each different object format today: - // - // Plan 9: 0x20 - // Windows: 0x600 - // Mach-O: 0x2000 - // - f, err := os.Open(filename) - if err != nil { - return "", err - } - defer f.Close() - - data := make([]byte, 16*1024) - _, err = io.ReadFull(f, data) - if err == io.ErrUnexpectedEOF { - err = nil - } - if err != nil { - return "", err - } - - if bytes.HasPrefix(data, elfPrefix) { - return readELFGoBuildID(filename, f, data) - } - - i := bytes.Index(data, goBuildPrefix) - if i < 0 { - // Missing. Treat as successful but build ID empty. - return "", nil - } - - j := bytes.Index(data[i+len(goBuildPrefix):], goBuildEnd) - if j < 0 { - return "", &os.PathError{Op: "parse", Path: filename, Err: errBuildIDMalformed} - } - - quoted := data[i+len(goBuildPrefix)-1 : i+len(goBuildPrefix)+j+1] - id, err = strconv.Unquote(string(quoted)) - if err != nil { - return "", &os.PathError{Op: "parse", Path: filename, Err: errBuildIDMalformed} - } - - return id, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg_test.go deleted file mode 100644 index 06b9f0ac6ebcb0fe1802756c8355edc86d07b72d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/pkg_test.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "reflect" - "strings" - "testing" -) - -var foldDupTests = []struct { - list []string - f1, f2 string -}{ - {stringList("math/rand", "math/big"), "", ""}, - {stringList("math", "strings"), "", ""}, - {stringList("strings"), "", ""}, - {stringList("strings", "strings"), "strings", "strings"}, - {stringList("Rand", "rand", "math", "math/rand", "math/Rand"), "Rand", "rand"}, -} - -func TestFoldDup(t *testing.T) { - for _, tt := range foldDupTests { - f1, f2 := foldDup(tt.list) - if f1 != tt.f1 || f2 != tt.f2 { - t.Errorf("foldDup(%q) = %q, %q, want %q, %q", tt.list, f1, f2, tt.f1, tt.f2) - } - } -} - -var parseMetaGoImportsTests = []struct { - in string - out []metaImport -}{ - { - ``, - []metaImport{{"foo/bar", "git", "https://github.com/rsc/foo/bar"}}, - }, - { - ` - `, - []metaImport{ - {"foo/bar", "git", "https://github.com/rsc/foo/bar"}, - {"baz/quux", "git", "http://github.com/rsc/baz/quux"}, - }, - }, - { - ` - - `, - []metaImport{{"foo/bar", "git", "https://github.com/rsc/foo/bar"}}, - }, - { - ` - `, - []metaImport{{"foo/bar", "git", "https://github.com/rsc/foo/bar"}}, - }, -} - -func TestParseMetaGoImports(t *testing.T) { - for i, tt := range parseMetaGoImportsTests { - out, err := parseMetaGoImports(strings.NewReader(tt.in)) - if err != nil { - t.Errorf("test#%d: %v", i, err) - continue - } - if !reflect.DeepEqual(out, tt.out) { - t.Errorf("test#%d:\n\thave %q\n\twant %q", i, out, tt.out) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/run.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/run.go deleted file mode 100644 index f6da373e2522d4b491a58af224859e8d862f39d9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/run.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "os" - "os/exec" - "runtime" - "strings" -) - -var execCmd []string // -exec flag, for run and test - -func findExecCmd() []string { - if execCmd != nil { - return execCmd - } - execCmd = []string{} // avoid work the second time - if goos == runtime.GOOS && goarch == runtime.GOARCH { - return execCmd - } - path, err := exec.LookPath(fmt.Sprintf("go_%s_%s_exec", goos, goarch)) - if err == nil { - execCmd = []string{path} - } - return execCmd -} - -var cmdRun = &Command{ - UsageLine: "run [build flags] [-exec xprog] gofiles... [arguments...]", - Short: "compile and run Go program", - Long: ` -Run compiles and runs the main package comprising the named Go source files. -A Go source file is defined to be a file ending in a literal ".go" suffix. - -By default, 'go run' runs the compiled binary directly: 'a.out arguments...'. -If the -exec flag is given, 'go run' invokes the binary using xprog: - 'xprog a.out arguments...'. -If the -exec flag is not given, GOOS or GOARCH is different from the system -default, and a program named go_$GOOS_$GOARCH_exec can be found -on the current search path, 'go run' invokes the binary using that program, -for example 'go_nacl_386_exec a.out arguments...'. This allows execution of -cross-compiled programs when a simulator or other execution method is -available. - -For more about build flags, see 'go help build'. - -See also: go build. - `, -} - -func init() { - cmdRun.Run = runRun // break init loop - - addBuildFlags(cmdRun) - cmdRun.Flag.Var((*stringsFlag)(&execCmd), "exec", "") -} - -func printStderr(args ...interface{}) (int, error) { - return fmt.Fprint(os.Stderr, args...) -} - -func runRun(cmd *Command, args []string) { - raceInit() - buildModeInit() - var b builder - b.init() - b.print = printStderr - i := 0 - for i < len(args) && strings.HasSuffix(args[i], ".go") { - i++ - } - files, cmdArgs := args[:i], args[i:] - if len(files) == 0 { - fatalf("go run: no go files listed") - } - for _, file := range files { - if strings.HasSuffix(file, "_test.go") { - // goFilesPackage is going to assign this to TestGoFiles. - // Reject since it won't be part of the build. - fatalf("go run: cannot run *_test.go files (%s)", file) - } - } - p := goFilesPackage(files) - if p.Error != nil { - fatalf("%s", p.Error) - } - p.omitDWARF = true - for _, err := range p.DepsErrors { - errorf("%s", err) - } - exitIfErrors() - if p.Name != "main" { - fatalf("go run: cannot run non-main package") - } - p.target = "" // must build - not up to date - var src string - if len(p.GoFiles) > 0 { - src = p.GoFiles[0] - } else if len(p.CgoFiles) > 0 { - src = p.CgoFiles[0] - } else { - // this case could only happen if the provided source uses cgo - // while cgo is disabled. - hint := "" - if !buildContext.CgoEnabled { - hint = " (cgo is disabled)" - } - fatalf("go run: no suitable source files%s", hint) - } - p.exeName = src[:len(src)-len(".go")] // name temporary executable for first go file - a1 := b.action(modeBuild, modeBuild, p) - a := &action{f: (*builder).runProgram, args: cmdArgs, deps: []*action{a1}} - b.do(a) -} - -// runProgram is the action for running a binary that has already -// been compiled. We ignore exit status. -func (b *builder) runProgram(a *action) error { - cmdline := stringList(findExecCmd(), a.deps[0].target, a.args) - if buildN || buildX { - b.showcmd("", "%s", strings.Join(cmdline, " ")) - if buildN { - return nil - } - } - - runStdin(cmdline) - return nil -} - -// runStdin is like run, but connects Stdin. -func runStdin(cmdline []string) { - cmd := exec.Command(cmdline[0], cmdline[1:]...) - cmd.Stdin = os.Stdin - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - cmd.Env = origEnv - startSigHandlers() - if err := cmd.Run(); err != nil { - errorf("%v", err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/script b/llgo/third_party/gofrontend/libgo/go/cmd/go/script deleted file mode 100755 index 340a7e824cafd64b280d8e50454d752f2f0d0640..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/script +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -x() { - echo '--- ' "$@" - "$@" - echo '---' - echo -} - -x go help -x go help build -x go help clean -x go help install -x go help fix -x go help fmt -x go help get -x go help list -x go help test -x go help version -x go help vet -x go help gopath -x go help importpath -x go help remote diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/script.txt b/llgo/third_party/gofrontend/libgo/go/cmd/go/script.txt deleted file mode 100644 index a672146584e6cae5c5606e25d9effd8a94a2093a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/script.txt +++ /dev/null @@ -1,352 +0,0 @@ ---- go help -usage: go command [arguments] - -go manages Go source code. - -The commands are: - - build compile and install packages and dependencies - clean remove intermediate objects - fix run gofix on packages - fmt run gofmt -w on packages - get download and install packages and dependencies - install install packages and dependencies - list list packages - test test packages - version print Go version - vet run govet on packages - -Use "go help [command]" for more information about a command. - -Additional help topics: - - gopath GOPATH environment variable - importpath description of import paths - remote remote import path syntax - -Use "go help [topic]" for more information about that topic. - ---- - ---- go help build -usage: go build [-n] [-v] [importpath...] - -Build compiles the packages named by the import paths, -along with their dependencies, but it does not install the results. - -The -n flag prints the commands but does not run them. -The -v flag prints the commands. - -For more about import paths, see 'go help importpath'. - -See also: go install, go get, go clean. ---- - ---- go help clean -usage: go clean [-nuke] [importpath...] - -Clean removes intermediate object files generated during -the compilation of the packages named by the import paths, -but by default it does not remove the installed package binaries. - -The -nuke flag causes clean to remove the installed package binaries too. - -TODO: Clean does not clean dependencies of the packages. - -For more about import paths, see 'go help importpath'. ---- - ---- go help install -usage: go install [-n] [-v] [importpath...] - -Install compiles and installs the packages named by the import paths, -along with their dependencies. - -The -n flag prints the commands but does not run them. -The -v flag prints the commands. - -For more about import paths, see 'go help importpath'. - -See also: go build, go get, go clean. ---- - ---- go help fix -usage: go fix [importpath...] - -Fix runs the gofix command on the packages named by the import paths. - -For more about gofix, see 'godoc gofix'. -For more about import paths, see 'go help importpath'. - -To run gofix with specific options, run gofix itself. - -See also: go fmt, go vet. ---- - ---- go help fmt -usage: go fmt [importpath...] - -Fmt runs the command 'gofmt -w' on the packages named by the import paths. - -For more about gofmt, see 'godoc gofmt'. -For more about import paths, see 'go help importpath'. - -To run gofmt with specific options, run gofmt itself. - -See also: go fix, go vet. ---- - ---- go help get -usage: go get [importpath...] - -Get downloads and installs the packages named by the import paths, -along with their dependencies. - -After downloading the code, 'go get' looks for a tag beginning -with "go." that corresponds to the local Go version. -For Go "release.r58" it looks for a tag named "go.r58". -For "weekly.2011-06-03" it looks for "go.weekly.2011-06-03". -If the specific "go.X" tag is not found, it uses the latest earlier -version it can find. Otherwise, it uses the default version for -the version control system: HEAD for git, tip for Mercurial, -and so on. - -TODO: Explain versions better. - -For more about import paths, see 'go help importpath'. - -For more about how 'go get' finds source code to -download, see 'go help remote'. - -See also: go build, go install, go clean. ---- - ---- go help list -usage: go list [-f format] [-json] [importpath...] - -List lists the packages named by the import paths. - -The default output shows the package name and file system location: - - books /home/you/src/google-api-go-client.googlecode.com/hg/books/v1 - oauth /home/you/src/goauth2.googlecode.com/hg/oauth - sqlite /home/you/src/gosqlite.googlecode.com/hg/sqlite - -The -f flag specifies an alternate format for the list, -using the syntax of package template. The default output -is equivalent to -f '{{.Name}} {{.Dir}}' The struct -being passed to the template is: - - type Package struct { - Name string // package name - Doc string // package documentation string - GoFiles []string // names of Go source files in package - ImportPath string // import path denoting package - Imports []string // import paths used by this package - Deps []string // all (recursively) imported dependencies - Dir string // directory containing package sources - Version string // version of installed package - } - -The -json flag causes the package data to be printed in JSON format. - -For more about import paths, see 'go help importpath'. ---- - ---- go help test -usage: go test [importpath...] - -Test runs gotest to test the packages named by the import paths. -It prints a summary of the test results in the format: - - test archive/tar - FAIL archive/zip - test compress/gzip - ... - -followed by gotest output for each failed package. - -For more about import paths, see 'go help importpath'. - -See also: go build, go compile, go vet. ---- - ---- go help version -usage: go version - -Version prints the Go version, as reported by runtime.Version. ---- - ---- go help vet -usage: go vet [importpath...] - -Vet runs the govet command on the packages named by the import paths. - -For more about govet, see 'godoc govet'. -For more about import paths, see 'go help importpath'. - -To run govet with specific options, run govet itself. - -See also: go fmt, go fix. ---- - ---- go help gopath -The GOPATH environment variable lists places to look for Go code. -On Unix, the value is a colon-separated string. -On Windows, the value is a semicolon-separated string. -On Plan 9, the value is a list. - -GOPATH must be set to build and install packages outside the -standard Go tree. - -Each directory listed in GOPATH must have a prescribed structure: - -The src/ directory holds source code. The path below 'src' -determines the import path or executable name. - -The pkg/ directory holds installed package objects. -As in the Go tree, each target operating system and -architecture pair has its own subdirectory of pkg -(pkg/GOOS_GOARCH). - -If DIR is a directory listed in the GOPATH, a package with -source in DIR/src/foo/bar can be imported as "foo/bar" and -has its compiled form installed to "DIR/pkg/GOOS_GOARCH/foo/bar.a". - -The bin/ directory holds compiled commands. -Each command is named for its source directory, but only -the final element, not the entire path. That is, the -command with source in DIR/src/foo/quux is installed into -DIR/bin/quux, not DIR/bin/foo/quux. The foo/ is stripped -so that you can add DIR/bin to your PATH to get at the -installed commands. - -Here's an example directory layout: - - GOPATH=/home/user/gocode - - /home/user/gocode/ - src/ - foo/ - bar/ (go code in package bar) - x.go - quux/ (go code in package main) - y.go - bin/ - quux (installed command) - pkg/ - linux_amd64/ - foo/ - bar.a (installed package object) - -Go searches each directory listed in GOPATH to find source code, -but new packages are always downloaded into the first directory -in the list. ---- - ---- go help importpath -Many commands apply to a set of packages named by import paths: - - go action [importpath...] - -An import path that is a rooted path or that begins with -a . or .. element is interpreted as a file system path and -denotes the package in that directory. - -Otherwise, the import path P denotes the package found in -the directory DIR/src/P for some DIR listed in the GOPATH -environment variable (see 'go help gopath'). - -If no import paths are given, the action applies to the -package in the current directory. - -The special import path "all" expands to all package directories -found in all the GOPATH trees. For example, 'go list all' -lists all the packages on the local system. - -An import path can also name a package to be downloaded from -a remote repository. Run 'go help remote' for details. - -Every package in a program must have a unique import path. -By convention, this is arranged by starting each path with a -unique prefix that belongs to you. For example, paths used -internally at Google all begin with 'google', and paths -denoting remote repositories begin with the path to the code, -such as 'project.googlecode.com/'. ---- - ---- go help remote -An import path (see 'go help importpath') denotes a package -stored in the local file system. Certain import paths also -describe how to obtain the source code for the package using -a revision control system. - -A few common code hosting sites have special syntax: - - BitBucket (Mercurial) - - import "bitbucket.org/user/project" - import "bitbucket.org/user/project/sub/directory" - - GitHub (Git) - - import "github.com/user/project" - import "github.com/user/project/sub/directory" - - Google Code Project Hosting (Git, Mercurial, Subversion) - - import "project.googlecode.com/git" - import "project.googlecode.com/git/sub/directory" - - import "project.googlecode.com/hg" - import "project.googlecode.com/hg/sub/directory" - - import "project.googlecode.com/svn/trunk" - import "project.googlecode.com/svn/trunk/sub/directory" - - Launchpad (Bazaar) - - import "launchpad.net/project" - import "launchpad.net/project/series" - import "launchpad.net/project/series/sub/directory" - - import "launchpad.net/~user/project/branch" - import "launchpad.net/~user/project/branch/sub/directory" - -For code hosted on other servers, an import path of the form - - repository.vcs/path - -specifies the given repository, with or without the .vcs suffix, -using the named version control system, and then the path inside -that repository. The supported version control systems are: - - Bazaar .bzr - Git .git - Mercurial .hg - Subversion .svn - -For example, - - import "example.org/user/foo.hg" - -denotes the root directory of the Mercurial repository at -example.org/user/foo or foo.hg, and - - import "example.org/repo.git/foo/bar" - -denotes the foo/bar directory of the Git repository at -example.com/repo or repo.git. - -When a version control system supports multiple protocols, -each is tried in turn when downloading. For example, a Git -download tries git://, then https://, then http://. - -New downloaded packages are written to the first directory -listed in the GOPATH environment variable (see 'go help gopath'). - -The go command attempts to download the version of the -package appropriate for the Go release being used. -Run 'go help install' for more. ---- - diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/signal.go deleted file mode 100644 index e8ba0d36556ad4efd9f2a83e8c8b37cf0e95c24e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "os" - "os/signal" - "sync" -) - -// interrupted is closed, if go process is interrupted. -var interrupted = make(chan struct{}) - -// processSignals setups signal handler. -func processSignals() { - sig := make(chan os.Signal) - signal.Notify(sig, signalsToIgnore...) - go func() { - <-sig - close(interrupted) - }() -} - -var onceProcessSignals sync.Once - -// startSigHandlers start signal handlers. -func startSigHandlers() { - onceProcessSignals.Do(processSignals) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_notunix.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_notunix.go deleted file mode 100644 index 29aa9d8c209ada3ee07d17dbb1e623b98bc6e379..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_notunix.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build plan9 windows - -package main - -import ( - "os" -) - -var signalsToIgnore = []os.Signal{os.Interrupt} - -// signalTrace is the signal to send to make a Go program -// crash with a stack trace. -var signalTrace os.Signal = nil diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_unix.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_unix.go deleted file mode 100644 index e86cd4652311ccdb851d7cfa72c596a6dbb2fdf9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/signal_unix.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris - -package main - -import ( - "os" - "syscall" -) - -var signalsToIgnore = []os.Signal{os.Interrupt, syscall.SIGQUIT} - -// signalTrace is the signal to send to make a Go program -// crash with a stack trace. -var signalTrace os.Signal = syscall.SIGQUIT diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/tag_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/tag_test.go deleted file mode 100644 index ffe218c7b6d5d77154e2428c12837f08b8871dc2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/tag_test.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "testing" - -var selectTagTestTags = []string{ - "go.r58", - "go.r58.1", - "go.r59", - "go.r59.1", - "go.r61", - "go.r61.1", - "go.weekly.2010-01-02", - "go.weekly.2011-10-12", - "go.weekly.2011-10-12.1", - "go.weekly.2011-10-14", - "go.weekly.2011-11-01", - "go1", - "go1.0.1", - "go1.999", - "go1.9.2", - "go5", - - // these should be ignored: - "release.r59", - "release.r59.1", - "release", - "weekly.2011-10-12", - "weekly.2011-10-12.1", - "weekly", - "foo", - "bar", - "go.f00", - "go!r60", - "go.1999-01-01", - "go.2x", - "go.20000000000000", - "go.2.", - "go.2.0", - "go2x", - "go20000000000000", - "go2.", - "go2.0", -} - -var selectTagTests = []struct { - version string - selected string -}{ - /* - {"release.r57", ""}, - {"release.r58.2", "go.r58.1"}, - {"release.r59", "go.r59"}, - {"release.r59.1", "go.r59.1"}, - {"release.r60", "go.r59.1"}, - {"release.r60.1", "go.r59.1"}, - {"release.r61", "go.r61"}, - {"release.r66", "go.r61.1"}, - {"weekly.2010-01-01", ""}, - {"weekly.2010-01-02", "go.weekly.2010-01-02"}, - {"weekly.2010-01-02.1", "go.weekly.2010-01-02"}, - {"weekly.2010-01-03", "go.weekly.2010-01-02"}, - {"weekly.2011-10-12", "go.weekly.2011-10-12"}, - {"weekly.2011-10-12.1", "go.weekly.2011-10-12.1"}, - {"weekly.2011-10-13", "go.weekly.2011-10-12.1"}, - {"weekly.2011-10-14", "go.weekly.2011-10-14"}, - {"weekly.2011-10-14.1", "go.weekly.2011-10-14"}, - {"weekly.2011-11-01", "go.weekly.2011-11-01"}, - {"weekly.2014-01-01", "go.weekly.2011-11-01"}, - {"weekly.3000-01-01", "go.weekly.2011-11-01"}, - {"go1", "go1"}, - {"go1.1", "go1.0.1"}, - {"go1.998", "go1.9.2"}, - {"go1.1000", "go1.999"}, - {"go6", "go5"}, - - // faulty versions: - {"release.f00", ""}, - {"weekly.1999-01-01", ""}, - {"junk", ""}, - {"", ""}, - {"go2x", ""}, - {"go200000000000", ""}, - {"go2.", ""}, - {"go2.0", ""}, - */ - {"anything", "go1"}, -} - -func TestSelectTag(t *testing.T) { - for _, c := range selectTagTests { - selected := selectTag(c.version, selectTagTestTags) - if selected != c.selected { - t.Errorf("selectTag(%q) = %q, want %q", c.version, selected, c.selected) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/test.bash b/llgo/third_party/gofrontend/libgo/go/cmd/go/test.bash deleted file mode 100755 index 0060ce2185f3f8e2f3d3545344db5b2814ee9306..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/test.bash +++ /dev/null @@ -1,820 +0,0 @@ -#!/bin/bash -# Copyright 2012 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -set -e -go build -o testgo -go() { - echo TEST ERROR: ran go, not testgo: go "$@" >&2 - exit 2 -} - -started=false -TEST() { - if $started; then - stop - fi - echo TEST: "$@" - started=true - ok=true -} -stop() { - if ! $started; then - echo TEST ERROR: stop missing start >&2 - exit 2 - fi - started=false - if $ok; then - echo PASS - else - echo FAIL - allok=false - fi -} - -ok=true -allok=true - -unset GOBIN -unset GOPATH -unset GOROOT - -TEST 'file:line in error messages' -# Test that error messages have file:line information at beginning of -# the line. Also test issue 4917: that the error is on stderr. -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -fn=$d/err.go -echo "package main" > $fn -echo 'import "bar"' >> $fn -./testgo run $fn 2>$d/err.out || true -if ! grep -q "^$fn:" $d/err.out; then - echo "missing file:line in error message" - cat $d/err.out - ok=false -fi -rm -r $d - -# Test local (./) imports. -testlocal() { - local="$1" - TEST local imports $2 '(easy)' - ./testgo build -o hello "testdata/$local/easy.go" - ./hello >hello.out - if ! grep -q '^easysub\.Hello' hello.out; then - echo "testdata/$local/easy.go did not generate expected output" - cat hello.out - ok=false - fi - - TEST local imports $2 '(easysub)' - ./testgo build -o hello "testdata/$local/easysub/main.go" - ./hello >hello.out - if ! grep -q '^easysub\.Hello' hello.out; then - echo "testdata/$local/easysub/main.go did not generate expected output" - cat hello.out - ok=false - fi - - TEST local imports $2 '(hard)' - ./testgo build -o hello "testdata/$local/hard.go" - ./hello >hello.out - if ! grep -q '^sub\.Hello' hello.out || ! grep -q '^subsub\.Hello' hello.out ; then - echo "testdata/$local/hard.go did not generate expected output" - cat hello.out - ok=false - fi - - rm -f hello.out hello - - # Test that go install x.go fails. - TEST local imports $2 '(go install should fail)' - if ./testgo install "testdata/$local/easy.go" >/dev/null 2>&1; then - echo "go install testdata/$local/easy.go succeeded" - ok=false - fi -} - -# Test local imports -testlocal local '' - -# Test local imports again, with bad characters in the directory name. -bad='#$%:, &()*;<=>?\^{}' -rm -rf "testdata/$bad" -cp -R testdata/local "testdata/$bad" -testlocal "$bad" 'with bad characters in path' -rm -rf "testdata/$bad" - -TEST error message for syntax error in test go file says FAIL -export GOPATH=$(pwd)/testdata -if ./testgo test syntaxerror 2>testdata/err; then - echo 'go test syntaxerror succeeded' - ok=false -elif ! grep FAIL testdata/err >/dev/null; then - echo 'go test did not say FAIL:' - cat testdata/err - ok=false -fi -rm -f ./testdata/err -unset GOPATH - -TEST wildcards do not look in useless directories -export GOPATH=$(pwd)/testdata -if ./testgo list ... >testdata/err 2>&1; then - echo "go list ... succeeded" - ok=false -elif ! grep badpkg testdata/err >/dev/null; then - echo "go list ... failure does not mention badpkg" - cat testdata/err - ok=false -elif ! ./testgo list m... >testdata/err 2>&1; then - echo "go list m... failed" - ok=false -fi -rm -rf ./testdata/err -unset GOPATH - -# Test tests with relative imports. -TEST relative imports '(go test)' -if ! ./testgo test ./testdata/testimport; then - echo "go test ./testdata/testimport failed" - ok=false -fi - -# Test installation with relative imports. -TEST relative imports '(go test -i)' -if ! ./testgo test -i ./testdata/testimport; then - echo "go test -i ./testdata/testimport failed" - ok=false -fi - -# Test tests with relative imports in packages synthesized -# from Go files named on the command line. -TEST relative imports in command-line package -if ! ./testgo test ./testdata/testimport/*.go; then - echo "go test ./testdata/testimport/*.go failed" - ok=false -fi - -TEST version control error message includes correct directory -export GOPATH=$(pwd)/testdata/shadow/root1 -if ./testgo get -u foo 2>testdata/err; then - echo "go get -u foo succeeded unexpectedly" - ok=false -elif ! grep testdata/shadow/root1/src/foo testdata/err >/dev/null; then - echo "go get -u error does not mention shadow/root1/src/foo:" - cat testdata/err - ok=false -fi -unset GOPATH - -TEST go install fails with no buildable files -export GOPATH=$(pwd)/testdata -export CGO_ENABLED=0 -if ./testgo install cgotest 2>testdata/err; then - echo "go install cgotest succeeded unexpectedly" -elif ! grep 'no buildable Go source files' testdata/err >/dev/null; then - echo "go install cgotest did not report 'no buildable Go source files'" - cat testdata/err - ok=false -fi -unset CGO_ENABLED -unset GOPATH - -# Test that without $GOBIN set, binaries get installed -# into the GOPATH bin directory. -TEST install into GOPATH -rm -rf testdata/bin -if ! GOPATH=$(pwd)/testdata ./testgo install go-cmd-test; then - echo "go install go-cmd-test failed" - ok=false -elif ! test -x testdata/bin/go-cmd-test; then - echo "go install go-cmd-test did not write to testdata/bin/go-cmd-test" - ok=false -fi - -TEST package main_test imports archive not binary -export GOBIN=$(pwd)/testdata/bin -mkdir -p $GOBIN -export GOPATH=$(pwd)/testdata -touch ./testdata/src/main_test/m.go -if ! ./testgo test main_test; then - echo "go test main_test failed without install" - ok=false -elif ! ./testgo install main_test; then - echo "go test main_test failed" - ok=false -elif [ "$(./testgo list -f '{{.Stale}}' main_test)" != false ]; then - echo "after go install, main listed as stale" - ok=false -elif ! ./testgo test main_test; then - echo "go test main_test failed after install" - ok=false -fi -rm -rf $GOBIN -unset GOBIN - -# And with $GOBIN set, binaries get installed to $GOBIN. -TEST install into GOBIN -if ! GOBIN=$(pwd)/testdata/bin1 GOPATH=$(pwd)/testdata ./testgo install go-cmd-test; then - echo "go install go-cmd-test failed" - ok=false -elif ! test -x testdata/bin1/go-cmd-test; then - echo "go install go-cmd-test did not write to testdata/bin1/go-cmd-test" - ok=false -fi - -# Without $GOBIN set, installing a program outside $GOPATH should fail -# (there is nowhere to install it). -TEST install without destination fails -if ./testgo install testdata/src/go-cmd-test/helloworld.go 2>testdata/err; then - echo "go install testdata/src/go-cmd-test/helloworld.go should have failed, did not" - ok=false -elif ! grep 'no install location for .go files listed on command line' testdata/err; then - echo "wrong error:" - cat testdata/err - ok=false -fi -rm -f testdata/err - -# With $GOBIN set, should install there. -TEST install to GOBIN '(command-line package)' -if ! GOBIN=$(pwd)/testdata/bin1 ./testgo install testdata/src/go-cmd-test/helloworld.go; then - echo "go install testdata/src/go-cmd-test/helloworld.go failed" - ok=false -elif ! test -x testdata/bin1/helloworld; then - echo "go install testdata/src/go-cmd-test/helloworld.go did not write testdata/bin1/helloworld" - ok=false -fi - -TEST godoc installs into GOBIN -d=$(mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir $d/gobin -GOBIN=$d/gobin ./testgo get code.google.com/p/go.tools/cmd/godoc -if [ ! -x $d/gobin/godoc ]; then - echo did not install godoc to '$GOBIN' - GOBIN=$d/gobin ./testgo list -f 'Target: {{.Target}}' code.google.com/p/go.tools/cmd/godoc - ok=false -fi - -TEST godoc installs into GOROOT -GOROOT=$(./testgo env GOROOT) -rm -f $GOROOT/bin/godoc -./testgo install code.google.com/p/go.tools/cmd/godoc -if [ ! -x $GOROOT/bin/godoc ]; then - echo did not install godoc to '$GOROOT/bin' - ./testgo list -f 'Target: {{.Target}}' code.google.com/p/go.tools/cmd/godoc - ok=false -fi - -TEST cmd/fix installs into tool -GOOS=$(./testgo env GOOS) -GOARCH=$(./testgo env GOARCH) -rm -f $GOROOT/pkg/tool/${GOOS}_${GOARCH}/fix -./testgo install cmd/fix -if [ ! -x $GOROOT/pkg/tool/${GOOS}_${GOARCH}/fix ]; then - echo 'did not install cmd/fix to $GOROOT/pkg/tool' - GOBIN=$d/gobin ./testgo list -f 'Target: {{.Target}}' cmd/fix - ok=false -fi -rm -f $GOROOT/pkg/tool/${GOOS}_${GOARCH}/fix -GOBIN=$d/gobin ./testgo install cmd/fix -if [ ! -x $GOROOT/pkg/tool/${GOOS}_${GOARCH}/fix ]; then - echo 'did not install cmd/fix to $GOROOT/pkg/tool with $GOBIN set' - GOBIN=$d/gobin ./testgo list -f 'Target: {{.Target}}' cmd/fix - ok=false -fi - -TEST gopath program installs into GOBIN -mkdir $d/src/progname -echo 'package main; func main() {}' >$d/src/progname/p.go -GOBIN=$d/gobin ./testgo install progname -if [ ! -x $d/gobin/progname ]; then - echo 'did not install progname to $GOBIN/progname' - ./testgo list -f 'Target: {{.Target}}' cmd/api - ok=false -fi -rm -f $d/gobin/progname $d/bin/progname - -TEST gopath program installs into GOPATH/bin -./testgo install progname -if [ ! -x $d/bin/progname ]; then - echo 'did not install progname to $GOPATH/bin/progname' - ./testgo list -f 'Target: {{.Target}}' progname - ok=false -fi - -unset GOPATH -rm -rf $d - -# Reject relative paths in GOPATH. -TEST reject relative paths in GOPATH '(command-line package)' -if GOPATH=. ./testgo build testdata/src/go-cmd-test/helloworld.go; then - echo 'GOPATH="." go build should have failed, did not' - ok=false -fi - -TEST reject relative paths in GOPATH -if GOPATH=:$(pwd)/testdata:. ./testgo build go-cmd-test; then - echo 'GOPATH=":$(pwd)/testdata:." go build should have failed, did not' - ok=false -fi - -# issue 4104 -TEST go test with package listed multiple times -if [ $(./testgo test fmt fmt fmt fmt fmt | wc -l) -ne 1 ] ; then - echo 'go test fmt fmt fmt fmt fmt tested the same package multiple times' - ok=false -fi - -# ensure that output of 'go list' is consistent between runs -TEST go list is consistent -./testgo list std > test_std.list -if ! ./testgo list std | cmp -s test_std.list - ; then - echo "go list std ordering is inconsistent" - ok=false -fi -rm -f test_std.list - -# issue 4096. Validate the output of unsuccessful go install foo/quxx -TEST unsuccessful go install should mention missing package -if [ $(./testgo install 'foo/quxx' 2>&1 | grep -c 'cannot find package "foo/quxx" in any of') -ne 1 ] ; then - echo 'go install foo/quxx expected error: .*cannot find package "foo/quxx" in any of' - ok=false -fi -# test GOROOT search failure is reported -TEST GOROOT search failure reporting -if [ $(./testgo install 'foo/quxx' 2>&1 | egrep -c 'foo/quxx \(from \$GOROOT\)$') -ne 1 ] ; then - echo 'go install foo/quxx expected error: .*foo/quxx (from $GOROOT)' - ok=false -fi -# test multiple GOPATH entries are reported separately -TEST multiple GOPATH entries reported separately -if [ $(GOPATH=$(pwd)/testdata/a:$(pwd)/testdata/b ./testgo install 'foo/quxx' 2>&1 | egrep -c 'testdata/./src/foo/quxx') -ne 2 ] ; then - echo 'go install foo/quxx expected error: .*testdata/a/src/foo/quxx (from $GOPATH)\n.*testdata/b/src/foo/quxx' - ok=false -fi -# test (from $GOPATH) annotation is reported for the first GOPATH entry -TEST mention GOPATH in first GOPATH entry -if [ $(GOPATH=$(pwd)/testdata/a:$(pwd)/testdata/b ./testgo install 'foo/quxx' 2>&1 | egrep -c 'testdata/a/src/foo/quxx \(from \$GOPATH\)$') -ne 1 ] ; then - echo 'go install foo/quxx expected error: .*testdata/a/src/foo/quxx (from $GOPATH)' - ok=false -fi -# but not on the second -TEST but not the second entry -if [ $(GOPATH=$(pwd)/testdata/a:$(pwd)/testdata/b ./testgo install 'foo/quxx' 2>&1 | egrep -c 'testdata/b/src/foo/quxx$') -ne 1 ] ; then - echo 'go install foo/quxx expected error: .*testdata/b/src/foo/quxx' - ok=false -fi -# test missing GOPATH is reported -TEST missing GOPATH is reported -if [ $(GOPATH= ./testgo install 'foo/quxx' 2>&1 | egrep -c '\(\$GOPATH not set\)$') -ne 1 ] ; then - echo 'go install foo/quxx expected error: ($GOPATH not set)' - ok=false -fi - -# issue 4186. go get cannot be used to download packages to $GOROOT -# Test that without GOPATH set, go get should fail -TEST without GOPATH, go get fails -d=$(mktemp -d -t testgoXXX) -mkdir -p $d/src/pkg -if GOPATH= GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then - echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with $GOPATH unset' - ok=false -fi -rm -rf $d - -# Test that with GOPATH=$GOROOT, go get should fail -TEST with GOPATH=GOROOT, go get fails -d=$(mktemp -d -t testgoXXX) -mkdir -p $d/src/pkg -if GOPATH=$d GOROOT=$d ./testgo get -d code.google.com/p/go.codereview/cmd/hgpatch ; then - echo 'go get code.google.com/p/go.codereview/cmd/hgpatch should not succeed with GOPATH=$GOROOT' - ok=false -fi -rm -rf $d - -TEST ldflags arguments with spaces '(issue 3941)' -d=$(mktemp -d -t testgoXXX) -cat >$d/main.go<hello.out -if ! grep -q '^hello world' hello.out; then - echo "ldflags -X main.extern 'hello world' failed. Output:" - cat hello.out - ok=false -fi -rm -rf $d hello.out - -TEST go test -cpuprofile leaves binary behind -./testgo test -cpuprofile strings.prof strings || ok=false -if [ ! -x strings.test ]; then - echo "go test -cpuprofile did not create strings.test" - ok=false -fi -rm -f strings.prof strings.test - -TEST symlinks do not confuse go list '(issue 4568)' -old=$(pwd) -tmp=$(cd /tmp && pwd -P) -d=$(TMPDIR=$tmp mktemp -d -t testgoXXX) -mkdir -p $d/src -( - ln -s $d $d/src/dir1 - cd $d/src - echo package p >dir1/p.go - export GOPATH=$d - if [ "$($old/testgo list -f '{{.Root}}' dir1)" != "$d" ]; then - echo Confused by symlinks. - echo "Package in current directory $(pwd) should have Root $d" - env|grep WD - $old/testgo list -json . dir1 - touch $d/failed - fi -) -if [ -f $d/failed ]; then - ok=false -fi -rm -rf $d - -TEST 'install with tags (issue 4515)' -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -mkdir -p $d/src/example/a $d/src/example/b $d/bin -cat >$d/src/example/a/main.go <$d/src/example/b/main.go <$d/src/example/a/a.go <$d/src/example/a/pkg/pkg.go <$d/src/example/a/Pkg/pkg.go <$d/out; then - echo go list example/a should have failed, did not. - ok=false -elif ! grep "case-insensitive import collision" $d/out >/dev/null; then - echo go list example/a did not report import collision. - ok=false -fi -cat >$d/src/example/b/file.go <$d/src/example/b/FILE.go <$d/out; then - echo go list example/b should have failed, did not. - ok=false -elif ! grep "case-insensitive file name collision" $d/out >/dev/null; then - echo go list example/b did not report file name collision. - ok=false -fi - -TEST go get cover -./testgo get code.google.com/p/go.tools/cmd/cover || ok=false - -unset GOPATH -rm -rf $d - -TEST shadowing logic -export GOPATH=$(pwd)/testdata/shadow/root1:$(pwd)/testdata/shadow/root2 - -# The math in root1 is not "math" because the standard math is. -cdir=$(./testgo list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./testdata/shadow/root1/src/math) -if [ "$cdir" != "(_$(pwd)/testdata/shadow/root1/src/math) ($GOROOT/src/pkg/math)" ]; then - echo shadowed math is not shadowed: "$cdir" - ok=false -fi - -# The foo in root1 is "foo". -cdir=$(./testgo list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./testdata/shadow/root1/src/foo) -if [ "$cdir" != "(foo) ()" ]; then - echo unshadowed foo is shadowed: "$cdir" - ok=false -fi - -# The foo in root2 is not "foo" because the foo in root1 got there first. -cdir=$(./testgo list -f '({{.ImportPath}}) ({{.ConflictDir}})' ./testdata/shadow/root2/src/foo) -if [ "$cdir" != "(_$(pwd)/testdata/shadow/root2/src/foo) ($(pwd)/testdata/shadow/root1/src/foo)" ]; then - echo shadowed foo is not shadowed: "$cdir" - ok=false -fi - -# The error for go install should mention the conflicting directory. -err=$(! ./testgo install ./testdata/shadow/root2/src/foo 2>&1) -if [ "$err" != "go install: no install location for $(pwd)/testdata/shadow/root2/src/foo: hidden by $(pwd)/testdata/shadow/root1/src/foo" ]; then - echo wrong shadowed install error: "$err" - ok=false -fi - -# Only succeeds if source order is preserved. -TEST source file name order preserved -./testgo test testdata/example[12]_test.go || ok=false - -# Check that coverage analysis works at all. -# Don't worry about the exact numbers but require not 0.0%. -checkcoverage() { - if grep '[^0-9]0\.0%' testdata/cover.txt >/dev/null; then - echo 'some coverage results are 0.0%' - ok=false - fi - cat testdata/cover.txt - rm -f testdata/cover.txt -} - -TEST coverage runs -./testgo test -short -coverpkg=strings strings regexp >testdata/cover.txt 2>&1 || ok=false -./testgo test -short -cover strings math regexp >>testdata/cover.txt 2>&1 || ok=false -checkcoverage - -# Check that coverage analysis uses set mode. -TEST coverage uses set mode -if ./testgo test -short -cover encoding/binary -coverprofile=testdata/cover.out >testdata/cover.txt 2>&1; then - if ! grep -q 'mode: set' testdata/cover.out; then - ok=false - fi - checkcoverage -else - ok=false -fi -rm -f testdata/cover.out testdata/cover.txt - -TEST coverage uses atomic mode for -race. -if ./testgo test -short -race -cover encoding/binary -coverprofile=testdata/cover.out >testdata/cover.txt 2>&1; then - if ! grep -q 'mode: atomic' testdata/cover.out; then - ok=false - fi - checkcoverage -else - ok=false -fi -rm -f testdata/cover.out - -TEST coverage uses actual setting to override even for -race. -if ./testgo test -short -race -cover encoding/binary -covermode=count -coverprofile=testdata/cover.out >testdata/cover.txt 2>&1; then - if ! grep -q 'mode: count' testdata/cover.out; then - ok=false - fi - checkcoverage -else - ok=false -fi -rm -f testdata/cover.out - -TEST coverage with cgo -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -./testgo test -short -cover ./testdata/cgocover >testdata/cover.txt 2>&1 || ok=false -checkcoverage - -TEST cgo depends on syscall -rm -rf $GOROOT/pkg/*_race -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir -p $d/src/foo -echo ' -package foo -//#include -import "C" -' >$d/src/foo/foo.go -./testgo build -race foo || ok=false -rm -rf $d -unset GOPATH - -TEST cgo shows full path names -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir -p $d/src/x/y/dirname -echo ' -package foo -import "C" -func f() { -' >$d/src/x/y/dirname/foo.go -if ./testgo build x/y/dirname >$d/err 2>&1; then - echo build succeeded unexpectedly. - ok=false -elif ! grep x/y/dirname $d/err >/dev/null; then - echo error did not use full path. - cat $d/err - ok=false -fi -rm -rf $d -unset GOPATH - -TEST 'cgo handles -Wl,$ORIGIN' -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir -p $d/src/origin -echo ' -package origin -// #cgo !darwin LDFLAGS: -Wl,-rpath -Wl,$ORIGIN -// void f(void) {} -import "C" - -func f() { C.f() } -' >$d/src/origin/origin.go -if ! ./testgo build origin; then - echo build failed - ok=false -fi -rm -rf $d -unset GOPATH - -TEST 'Issue 6480: "go test -c -test.bench=XXX fmt" should not hang' -if ! ./testgo test -c -test.bench=XXX fmt; then - echo build test failed - ok=false -fi -rm -f fmt.test - -TEST 'Issue 7573: cmd/cgo: undefined reference when linking a C-library using gccgo' -d=$(mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir -p $d/src/cgoref -ldflags="-L alibpath -lalib" -echo " -package main -// #cgo LDFLAGS: $ldflags -// void f(void) {} -import \"C\" - -func main() { C.f() } -" >$d/src/cgoref/cgoref.go -go_cmds="$(./testgo build -n -compiler gccgo cgoref 2>&1 1>/dev/null)" -ldflags_count="$(echo "$go_cmds" | egrep -c "^gccgo.*$(echo $ldflags | sed -e 's/-/\\-/g')" || true)" -if [ "$ldflags_count" -lt 1 ]; then - echo "No Go-inline "#cgo LDFLAGS:" (\"$ldflags\") passed to gccgo linking stage." - ok=false -fi -rm -rf $d -unset ldflags_count -unset go_cmds -unset ldflags -unset GOPATH - -TEST list template can use context function -if ! ./testgo list -f "GOARCH: {{context.GOARCH}}"; then - echo unable to use context in list template - ok=false -fi - -TEST 'Issue 7108: cmd/go: "go test" should fail if package does not build' -export GOPATH=$(pwd)/testdata -if ./testgo test notest >/dev/null 2>&1; then - echo 'go test notest succeeded, but should fail' - ok=false -fi -unset GOPATH - -TEST 'Issue 6844: cmd/go: go test -a foo does not rebuild regexp' -if ! ./testgo test -x -a -c testdata/dep_test.go 2>deplist; then - echo "go test -x -a -c testdata/dep_test.go failed" - ok=false -elif ! grep -q regexp deplist; then - echo "go test -x -a -c testdata/dep_test.go did not rebuild regexp" - ok=false -fi -rm -f deplist -rm -f deps.test - -TEST list template can use context function -if ! ./testgo list -f "GOARCH: {{context.GOARCH}}"; then - echo unable to use context in list template - ok=false -fi - -TEST build -i installs dependencies -d=$(TMPDIR=/var/tmp mktemp -d -t testgoXXX) -export GOPATH=$d -mkdir -p $d/src/x/y/foo $d/src/x/y/bar -echo ' -package foo -func F() {} -' >$d/src/x/y/foo/foo.go -echo ' -package bar -import "x/y/foo" -func F() { foo.F() } -' >$d/src/x/y/bar/bar.go -if ! ./testgo build -v -i x/y/bar &> $d/err; then - echo build -i failed - cat $d/err - ok=false -elif ! grep x/y/foo $d/err >/dev/null; then - echo first build -i did not build x/y/foo - cat $d/err - ok=false -fi -if ! ./testgo build -v -i x/y/bar &> $d/err; then - echo second build -i failed - cat $d/err - ok=false -elif grep x/y/foo $d/err >/dev/null; then - echo second build -i built x/y/foo - cat $d/err - ok=false -fi -rm -rf $d -unset GOPATH - -TEST 'go build in test-only directory fails with a good error' -if ./testgo build ./testdata/testonly 2>testdata/err.out; then - echo "go build ./testdata/testonly succeeded, should have failed" - ok=false -elif ! grep 'no buildable Go' testdata/err.out >/dev/null; then - echo "go build ./testdata/testonly produced unexpected error:" - cat testdata/err.out - ok=false -fi -rm -f testdata/err.out - -TEST 'go test detects test-only import cycles' -export GOPATH=$(pwd)/testdata -if ./testgo test -c testcycle/p3 2>testdata/err.out; then - echo "go test testcycle/p3 succeeded, should have failed" - ok=false -elif ! grep 'import cycle not allowed in test' testdata/err.out >/dev/null; then - echo "go test testcycle/p3 produced unexpected error:" - cat testdata/err.out - ok=false -fi -rm -f testdata/err.out -unset GOPATH - -TEST 'go test foo_test.go works' -if ! ./testgo test testdata/standalone_test.go; then - echo "go test testdata/standalone_test.go failed" - ok=false -fi - -TEST 'go test xtestonly works' -export GOPATH=$(pwd)/testdata -./testgo clean -i xtestonly -if ! ./testgo test xtestonly >/dev/null; then - echo "go test xtestonly failed" - ok=false -fi -unset GOPATH - - -# clean up -if $started; then stop; fi -rm -rf testdata/bin testdata/bin1 -rm -f testgo - -if $allok; then - echo PASS -else - echo FAIL - exit 1 -fi diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/test.go deleted file mode 100644 index aadfdf67cceed41f22d9d9cae659ea56d326c534..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/test.go +++ /dev/null @@ -1,1459 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "errors" - "fmt" - "go/ast" - "go/build" - "go/doc" - "go/parser" - "go/token" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "regexp" - "runtime" - "sort" - "strings" - "text/template" - "time" - "unicode" - "unicode/utf8" -) - -// Break init loop. -func init() { - cmdTest.Run = runTest -} - -const testUsage = "test [-c] [-i] [build and test flags] [packages] [flags for test binary]" - -var cmdTest = &Command{ - CustomFlags: true, - UsageLine: testUsage, - Short: "test packages", - Long: ` -'Go test' automates testing the packages named by the import paths. -It prints a summary of the test results in the format: - - ok archive/tar 0.011s - FAIL archive/zip 0.022s - ok compress/gzip 0.033s - ... - -followed by detailed output for each failed package. - -'Go test' recompiles each package along with any files with names matching -the file pattern "*_test.go". -Files whose names begin with "_" (including "_test.go") or "." are ignored. -These additional files can contain test functions, benchmark functions, and -example functions. See 'go help testfunc' for more. -Each listed package causes the execution of a separate test binary. - -Test files that declare a package with the suffix "_test" will be compiled as a -separate package, and then linked and run with the main test binary. - -By default, go test needs no arguments. It compiles and tests the package -with source in the current directory, including tests, and runs the tests. - -The package is built in a temporary directory so it does not interfere with the -non-test installation. - -` + strings.TrimSpace(testFlag1) + ` See 'go help testflag' for details. - -If the test binary needs any other flags, they should be presented after the -package names. The go tool treats as a flag the first argument that begins with -a minus sign that it does not recognize itself; that argument and all subsequent -arguments are passed as arguments to the test binary. - -For more about build flags, see 'go help build'. -For more about specifying packages, see 'go help packages'. - -See also: go build, go vet. -`, -} - -const testFlag1 = ` -In addition to the build flags, the flags handled by 'go test' itself are: - - -c - Compile the test binary to pkg.test but do not run it - (where pkg is the last element of the package's import path). - The file name can be changed with the -o flag. - - -exec xprog - Run the test binary using xprog. The behavior is the same as - in 'go run'. See 'go help run' for details. - - -i - Install packages that are dependencies of the test. - Do not run the test. - - -o file - Compile the test binary to the named file. - The test still runs (unless -c or -i is specified). - -The test binary also accepts flags that control execution of the test; these -flags are also accessible by 'go test'. -` - -var helpTestflag = &Command{ - UsageLine: "testflag", - Short: "description of testing flags", - Long: ` -The 'go test' command takes both flags that apply to 'go test' itself -and flags that apply to the resulting test binary. - -Several of the flags control profiling and write an execution profile -suitable for "go tool pprof"; run "go tool pprof -h" for more -information. The --alloc_space, --alloc_objects, and --show_bytes -options of pprof control how the information is presented. - -The following flags are recognized by the 'go test' command and -control the execution of any test: - - ` + strings.TrimSpace(testFlag2) + ` -`, -} - -const testFlag2 = ` - -bench regexp - Run benchmarks matching the regular expression. - By default, no benchmarks run. To run all benchmarks, - use '-bench .' or '-bench=.'. - - -benchmem - Print memory allocation statistics for benchmarks. - - -benchtime t - Run enough iterations of each benchmark to take t, specified - as a time.Duration (for example, -benchtime 1h30s). - The default is 1 second (1s). - - -blockprofile block.out - Write a goroutine blocking profile to the specified file - when all tests are complete. - Writes test binary as -c would. - - -blockprofilerate n - Control the detail provided in goroutine blocking profiles by - calling runtime.SetBlockProfileRate with n. - See 'go doc runtime.SetBlockProfileRate'. - The profiler aims to sample, on average, one blocking event every - n nanoseconds the program spends blocked. By default, - if -test.blockprofile is set without this flag, all blocking events - are recorded, equivalent to -test.blockprofilerate=1. - - -count n - Run each test and benchmark n times (default 1). - If -cpu is set, run n times for each GOMAXPROCS value. - Examples are always run once. - - -cover - Enable coverage analysis. - - -covermode set,count,atomic - Set the mode for coverage analysis for the package[s] - being tested. The default is "set" unless -race is enabled, - in which case it is "atomic". - The values: - set: bool: does this statement run? - count: int: how many times does this statement run? - atomic: int: count, but correct in multithreaded tests; - significantly more expensive. - Sets -cover. - - -coverpkg pkg1,pkg2,pkg3 - Apply coverage analysis in each test to the given list of packages. - The default is for each test to analyze only the package being tested. - Packages are specified as import paths. - Sets -cover. - - -coverprofile cover.out - Write a coverage profile to the file after all tests have passed. - Sets -cover. - - -cpu 1,2,4 - Specify a list of GOMAXPROCS values for which the tests or - benchmarks should be executed. The default is the current value - of GOMAXPROCS. - - -cpuprofile cpu.out - Write a CPU profile to the specified file before exiting. - Writes test binary as -c would. - - -memprofile mem.out - Write a memory profile to the file after all tests have passed. - Writes test binary as -c would. - - -memprofilerate n - Enable more precise (and expensive) memory profiles by setting - runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'. - To profile all memory allocations, use -test.memprofilerate=1 - and pass --alloc_space flag to the pprof tool. - - -outputdir directory - Place output files from profiling in the specified directory, - by default the directory in which "go test" is running. - - -parallel n - Allow parallel execution of test functions that call t.Parallel. - The value of this flag is the maximum number of tests to run - simultaneously; by default, it is set to the value of GOMAXPROCS. - - -run regexp - Run only those tests and examples matching the regular - expression. - - -short - Tell long-running tests to shorten their run time. - It is off by default but set during all.bash so that installing - the Go tree can run a sanity check but not spend time running - exhaustive tests. - - -timeout t - If a test runs longer than t, panic. - The default is 10 minutes (10m). - - -trace trace.out - Write an execution trace to the specified file before exiting. - Writes test binary as -c would. - - -v - Verbose output: log all tests as they are run. Also print all - text from Log and Logf calls even if the test succeeds. - -The test binary, called pkg.test where pkg is the name of the -directory containing the package sources, can be invoked directly -after building it with 'go test -c'. When invoking the test binary -directly, each of the standard flag names must be prefixed with 'test.', -as in -test.run=TestMyFunc or -test.v. - -When running 'go test', flags not listed above are passed through -unaltered. For instance, the command - - go test -x -v -cpuprofile=prof.out -dir=testdata -update - -will compile the test binary and then run it as - - pkg.test -test.v -test.cpuprofile=prof.out -dir=testdata -update - -The test flags that generate profiles (other than for coverage) also -leave the test binary in pkg.test for use when analyzing the profiles. - -Flags not recognized by 'go test' must be placed after any specified packages. -` - -var helpTestfunc = &Command{ - UsageLine: "testfunc", - Short: "description of testing functions", - Long: ` -The 'go test' command expects to find test, benchmark, and example functions -in the "*_test.go" files corresponding to the package under test. - -A test function is one named TestXXX (where XXX is any alphanumeric string -not starting with a lower case letter) and should have the signature, - - func TestXXX(t *testing.T) { ... } - -A benchmark function is one named BenchmarkXXX and should have the signature, - - func BenchmarkXXX(b *testing.B) { ... } - -An example function is similar to a test function but, instead of using -*testing.T to report success or failure, prints output to os.Stdout. -That output is compared against the function's "Output:" comment, which -must be the last comment in the function body (see example below). An -example with no such comment, or with no text after "Output:" is compiled -but not executed. - -Godoc displays the body of ExampleXXX to demonstrate the use -of the function, constant, or variable XXX. An example of a method M with -receiver type T or *T is named ExampleT_M. There may be multiple examples -for a given function, constant, or variable, distinguished by a trailing _xxx, -where xxx is a suffix not beginning with an upper case letter. - -Here is an example of an example: - - func ExamplePrintln() { - Println("The output of\nthis example.") - // Output: The output of - // this example. - } - -The entire test file is presented as the example when it contains a single -example function, at least one other function, type, variable, or constant -declaration, and no test or benchmark functions. - -See the documentation of the testing package for more information. -`, -} - -var ( - testC bool // -c flag - testCover bool // -cover flag - testCoverMode string // -covermode flag - testCoverPaths []string // -coverpkg flag - testCoverPkgs []*Package // -coverpkg flag - testO string // -o flag - testProfile bool // some profiling flag - testNeedBinary bool // profile needs to keep binary around - testV bool // -v flag - testTimeout string // -timeout flag - testArgs []string - testBench bool - testStreamOutput bool // show output as it is generated - testShowPass bool // show passing output - - testKillTimeout = 10 * time.Minute -) - -var testMainDeps = map[string]bool{ - // Dependencies for testmain. - "testing": true, - "regexp": true, - "os": true, -} - -func runTest(cmd *Command, args []string) { - var pkgArgs []string - pkgArgs, testArgs = testFlags(args) - - findExecCmd() // initialize cached result - - raceInit() - buildModeInit() - pkgs := packagesForBuild(pkgArgs) - if len(pkgs) == 0 { - fatalf("no packages to test") - } - - if testC && len(pkgs) != 1 { - fatalf("cannot use -c flag with multiple packages") - } - if testO != "" && len(pkgs) != 1 { - fatalf("cannot use -o flag with multiple packages") - } - if testProfile && len(pkgs) != 1 { - fatalf("cannot use test profile flag with multiple packages") - } - - // If a test timeout was given and is parseable, set our kill timeout - // to that timeout plus one minute. This is a backup alarm in case - // the test wedges with a goroutine spinning and its background - // timer does not get a chance to fire. - if dt, err := time.ParseDuration(testTimeout); err == nil && dt > 0 { - testKillTimeout = dt + 1*time.Minute - } - - // show passing test output (after buffering) with -v flag. - // must buffer because tests are running in parallel, and - // otherwise the output will get mixed. - testShowPass = testV - - // stream test output (no buffering) when no package has - // been given on the command line (implicit current directory) - // or when benchmarking. - // Also stream if we're showing output anyway with a - // single package under test or if parallelism is set to 1. - // In these cases, streaming the output produces the same result - // as not streaming, just more immediately. - testStreamOutput = len(pkgArgs) == 0 || testBench || - (testShowPass && (len(pkgs) == 1 || buildP == 1)) - - var b builder - b.init() - - if buildI { - buildV = testV - - deps := make(map[string]bool) - for dep := range testMainDeps { - deps[dep] = true - } - - for _, p := range pkgs { - // Dependencies for each test. - for _, path := range p.Imports { - deps[path] = true - } - for _, path := range p.vendored(p.TestImports) { - deps[path] = true - } - for _, path := range p.vendored(p.XTestImports) { - deps[path] = true - } - } - - // translate C to runtime/cgo - if deps["C"] { - delete(deps, "C") - deps["runtime/cgo"] = true - if goos == runtime.GOOS && goarch == runtime.GOARCH && !buildRace { - deps["cmd/cgo"] = true - } - } - // Ignore pseudo-packages. - delete(deps, "unsafe") - - all := []string{} - for path := range deps { - if !build.IsLocalImport(path) { - all = append(all, path) - } - } - sort.Strings(all) - - a := &action{} - for _, p := range packagesForBuild(all) { - if !reqStdPkgSrc && p.Standard { - continue - } - a.deps = append(a.deps, b.action(modeInstall, modeInstall, p)) - } - b.do(a) - if !testC || a.failed { - return - } - b.init() - } - - var builds, runs, prints []*action - - if testCoverPaths != nil { - // Load packages that were asked about for coverage. - // packagesForBuild exits if the packages cannot be loaded. - testCoverPkgs = packagesForBuild(testCoverPaths) - - // Warn about -coverpkg arguments that are not actually used. - used := make(map[string]bool) - for _, p := range pkgs { - used[p.ImportPath] = true - for _, dep := range p.Deps { - used[dep] = true - } - } - for _, p := range testCoverPkgs { - if !used[p.ImportPath] { - log.Printf("warning: no packages being tested depend on %s", p.ImportPath) - } - } - - // Mark all the coverage packages for rebuilding with coverage. - for _, p := range testCoverPkgs { - // There is nothing to cover in package unsafe; it comes from the compiler. - if p.ImportPath == "unsafe" { - continue - } - p.Stale = true // rebuild - p.fake = true // do not warn about rebuild - p.coverMode = testCoverMode - var coverFiles []string - coverFiles = append(coverFiles, p.GoFiles...) - coverFiles = append(coverFiles, p.CgoFiles...) - coverFiles = append(coverFiles, p.TestGoFiles...) - p.coverVars = declareCoverVars(p.ImportPath, coverFiles...) - } - } - - // Prepare build + run + print actions for all packages being tested. - for _, p := range pkgs { - buildTest, runTest, printTest, err := b.test(p) - if err != nil { - str := err.Error() - if strings.HasPrefix(str, "\n") { - str = str[1:] - } - failed := fmt.Sprintf("FAIL\t%s [setup failed]\n", p.ImportPath) - - if p.ImportPath != "" { - errorf("# %s\n%s\n%s", p.ImportPath, str, failed) - } else { - errorf("%s\n%s", str, failed) - } - continue - } - builds = append(builds, buildTest) - runs = append(runs, runTest) - prints = append(prints, printTest) - } - - // Ultimately the goal is to print the output. - root := &action{deps: prints} - - // Force the printing of results to happen in order, - // one at a time. - for i, a := range prints { - if i > 0 { - a.deps = append(a.deps, prints[i-1]) - } - } - - // Force benchmarks to run in serial. - if !testC && testBench { - // The first run must wait for all builds. - // Later runs must wait for the previous run's print. - for i, run := range runs { - if i == 0 { - run.deps = append(run.deps, builds...) - } else { - run.deps = append(run.deps, prints[i-1]) - } - } - } - - // If we are building any out-of-date packages other - // than those under test, warn. - okBuild := map[*Package]bool{} - for _, p := range pkgs { - okBuild[p] = true - } - warned := false - for _, a := range actionList(root) { - if a.p == nil || okBuild[a.p] { - continue - } - okBuild[a.p] = true // warn at most once - - // Don't warn about packages being rebuilt because of - // things like coverage analysis. - for _, p1 := range a.p.imports { - if p1.fake { - a.p.fake = true - } - } - - if a.f != nil && !okBuild[a.p] && !a.p.fake && !a.p.local { - if !warned { - fmt.Fprintf(os.Stderr, "warning: building out-of-date packages:\n") - warned = true - } - fmt.Fprintf(os.Stderr, "\t%s\n", a.p.ImportPath) - } - } - if warned { - args := strings.Join(pkgArgs, " ") - if args != "" { - args = " " + args - } - extraOpts := "" - if buildRace { - extraOpts = "-race " - } - fmt.Fprintf(os.Stderr, "installing these packages with 'go test %s-i%s' will speed future tests.\n\n", extraOpts, args) - } - - b.do(root) -} - -func contains(x []string, s string) bool { - for _, t := range x { - if t == s { - return true - } - } - return false -} - -var windowsBadWords = []string{ - "install", - "patch", - "setup", - "update", -} - -func (b *builder) test(p *Package) (buildAction, runAction, printAction *action, err error) { - if len(p.TestGoFiles)+len(p.XTestGoFiles) == 0 { - build := b.action(modeBuild, modeBuild, p) - run := &action{p: p, deps: []*action{build}} - print := &action{f: (*builder).notest, p: p, deps: []*action{run}} - return build, run, print, nil - } - - // Build Package structs describing: - // ptest - package + test files - // pxtest - package of external test files - // pmain - pkg.test binary - var ptest, pxtest, pmain *Package - - var imports, ximports []*Package - var stk importStack - stk.push(p.ImportPath + " (test)") - for i, path := range p.TestImports { - p1 := loadImport(path, p.Dir, p, &stk, p.build.TestImportPos[path], useVendor) - if !reqStdPkgSrc && p1.Standard { - continue - } - if p1.Error != nil { - return nil, nil, nil, p1.Error - } - if len(p1.DepsErrors) > 0 { - err := p1.DepsErrors[0] - err.Pos = "" // show full import stack - return nil, nil, nil, err - } - if contains(p1.Deps, p.ImportPath) || p1.ImportPath == p.ImportPath { - // Same error that loadPackage returns (via reusePackage) in pkg.go. - // Can't change that code, because that code is only for loading the - // non-test copy of a package. - err := &PackageError{ - ImportStack: testImportStack(stk[0], p1, p.ImportPath), - Err: "import cycle not allowed in test", - isImportCycle: true, - } - return nil, nil, nil, err - } - p.TestImports[i] = p1.ImportPath - imports = append(imports, p1) - } - stk.pop() - stk.push(p.ImportPath + "_test") - pxtestNeedsPtest := false - for i, path := range p.XTestImports { - p1 := loadImport(path, p.Dir, p, &stk, p.build.XTestImportPos[path], useVendor) - if !reqStdPkgSrc && p1.Standard { - continue - } - if p1.Error != nil { - return nil, nil, nil, p1.Error - } - if len(p1.DepsErrors) > 0 { - err := p1.DepsErrors[0] - err.Pos = "" // show full import stack - return nil, nil, nil, err - } - if p1.ImportPath == p.ImportPath { - pxtestNeedsPtest = true - } else { - ximports = append(ximports, p1) - } - p.XTestImports[i] = p1.ImportPath - } - stk.pop() - - // Use last element of import path, not package name. - // They differ when package name is "main". - // But if the import path is "command-line-arguments", - // like it is during 'go run', use the package name. - var elem string - if p.ImportPath == "command-line-arguments" { - elem = p.Name - } else { - _, elem = path.Split(p.ImportPath) - } - testBinary := elem + ".test" - - // The ptest package needs to be importable under the - // same import path that p has, but we cannot put it in - // the usual place in the temporary tree, because then - // other tests will see it as the real package. - // Instead we make a _test directory under the import path - // and then repeat the import path there. We tell the - // compiler and linker to look in that _test directory first. - // - // That is, if the package under test is unicode/utf8, - // then the normal place to write the package archive is - // $WORK/unicode/utf8.a, but we write the test package archive to - // $WORK/unicode/utf8/_test/unicode/utf8.a. - // We write the external test package archive to - // $WORK/unicode/utf8/_test/unicode/utf8_test.a. - testDir := filepath.Join(b.work, filepath.FromSlash(p.ImportPath+"/_test")) - ptestObj := buildToolchain.pkgpath(testDir, p) - - // Create the directory for the .a files. - ptestDir, _ := filepath.Split(ptestObj) - if err := b.mkdir(ptestDir); err != nil { - return nil, nil, nil, err - } - - // Should we apply coverage analysis locally, - // only for this package and only for this test? - // Yes, if -cover is on but -coverpkg has not specified - // a list of packages for global coverage. - localCover := testCover && testCoverPaths == nil - - // Test package. - if len(p.TestGoFiles) > 0 || localCover || p.Name == "main" { - ptest = new(Package) - *ptest = *p - ptest.GoFiles = nil - ptest.GoFiles = append(ptest.GoFiles, p.GoFiles...) - ptest.GoFiles = append(ptest.GoFiles, p.TestGoFiles...) - ptest.target = "" - ptest.Imports = stringList(p.Imports, p.TestImports) - ptest.imports = append(append([]*Package{}, p.imports...), imports...) - ptest.pkgdir = testDir - ptest.fake = true - ptest.forceLibrary = true - ptest.Stale = true - ptest.build = new(build.Package) - *ptest.build = *p.build - m := map[string][]token.Position{} - for k, v := range p.build.ImportPos { - m[k] = append(m[k], v...) - } - for k, v := range p.build.TestImportPos { - m[k] = append(m[k], v...) - } - ptest.build.ImportPos = m - - if localCover { - ptest.coverMode = testCoverMode - var coverFiles []string - coverFiles = append(coverFiles, ptest.GoFiles...) - coverFiles = append(coverFiles, ptest.CgoFiles...) - ptest.coverVars = declareCoverVars(ptest.ImportPath, coverFiles...) - } - } else { - ptest = p - } - - // External test package. - if len(p.XTestGoFiles) > 0 { - pxtest = &Package{ - Name: p.Name + "_test", - ImportPath: p.ImportPath + "_test", - localPrefix: p.localPrefix, - Root: p.Root, - Dir: p.Dir, - GoFiles: p.XTestGoFiles, - Imports: p.XTestImports, - build: &build.Package{ - ImportPos: p.build.XTestImportPos, - }, - imports: ximports, - pkgdir: testDir, - fake: true, - external: true, - Stale: true, - } - if pxtestNeedsPtest { - pxtest.imports = append(pxtest.imports, ptest) - } - } - - // Action for building pkg.test. - pmain = &Package{ - Name: "main", - Dir: testDir, - GoFiles: []string{"_testmain.go"}, - ImportPath: "testmain", - Root: p.Root, - build: &build.Package{Name: "main"}, - pkgdir: testDir, - fake: true, - Stale: true, - omitDWARF: !testC && !testNeedBinary, - } - - // The generated main also imports testing, regexp, and os. - stk.push("testmain") - for dep := range testMainDeps { - if dep == ptest.ImportPath { - pmain.imports = append(pmain.imports, ptest) - } else { - p1 := loadImport(dep, "", nil, &stk, nil, 0) - if !reqStdPkgSrc && p1.Standard { - continue - } - if p1.Error != nil { - return nil, nil, nil, p1.Error - } - pmain.imports = append(pmain.imports, p1) - } - } - - if testCoverPkgs != nil { - // Add imports, but avoid duplicates. - seen := map[*Package]bool{p: true, ptest: true} - for _, p1 := range pmain.imports { - seen[p1] = true - } - for _, p1 := range testCoverPkgs { - if !seen[p1] { - seen[p1] = true - pmain.imports = append(pmain.imports, p1) - } - } - } - - // Do initial scan for metadata needed for writing _testmain.go - // Use that metadata to update the list of imports for package main. - // The list of imports is used by recompileForTest and by the loop - // afterward that gathers t.Cover information. - t, err := loadTestFuncs(ptest) - if err != nil { - return nil, nil, nil, err - } - if len(ptest.GoFiles) > 0 { - pmain.imports = append(pmain.imports, ptest) - t.ImportTest = true - } - if pxtest != nil { - pmain.imports = append(pmain.imports, pxtest) - t.ImportXtest = true - } - - if ptest != p && localCover { - // We have made modifications to the package p being tested - // and are rebuilding p (as ptest), writing it to the testDir tree. - // Arrange to rebuild, writing to that same tree, all packages q - // such that the test depends on q, and q depends on p. - // This makes sure that q sees the modifications to p. - // Strictly speaking, the rebuild is only necessary if the - // modifications to p change its export metadata, but - // determining that is a bit tricky, so we rebuild always. - // - // This will cause extra compilation, so for now we only do it - // when testCover is set. The conditions are more general, though, - // and we may find that we need to do it always in the future. - recompileForTest(pmain, p, ptest, testDir) - } - - if buildContext.GOOS == "darwin" { - if buildContext.GOARCH == "arm" || buildContext.GOARCH == "arm64" { - t.NeedCgo = true - } - } - - for _, cp := range pmain.imports { - if len(cp.coverVars) > 0 { - t.Cover = append(t.Cover, coverInfo{cp, cp.coverVars}) - } - } - - // writeTestmain writes _testmain.go. This must happen after recompileForTest, - // because recompileForTest modifies XXX. - if err := writeTestmain(filepath.Join(testDir, "_testmain.go"), t); err != nil { - return nil, nil, nil, err - } - - computeStale(pmain) - - if ptest != p { - a := b.action(modeBuild, modeBuild, ptest) - a.objdir = testDir + string(filepath.Separator) + "_obj_test" + string(filepath.Separator) - a.objpkg = ptestObj - a.target = ptestObj - a.link = false - } - - if pxtest != nil { - a := b.action(modeBuild, modeBuild, pxtest) - a.objdir = testDir + string(filepath.Separator) + "_obj_xtest" + string(filepath.Separator) - a.objpkg = buildToolchain.pkgpath(testDir, pxtest) - a.target = a.objpkg - } - - a := b.action(modeBuild, modeBuild, pmain) - a.objdir = testDir + string(filepath.Separator) - a.objpkg = filepath.Join(testDir, "main.a") - a.target = filepath.Join(testDir, testBinary) + exeSuffix - if goos == "windows" { - // There are many reserved words on Windows that, - // if used in the name of an executable, cause Windows - // to try to ask for extra permissions. - // The word list includes setup, install, update, and patch, - // but it does not appear to be defined anywhere. - // We have run into this trying to run the - // go.codereview/patch tests. - // For package names containing those words, use test.test.exe - // instead of pkgname.test.exe. - // Note that this file name is only used in the Go command's - // temporary directory. If the -c or other flags are - // given, the code below will still use pkgname.test.exe. - // There are two user-visible effects of this change. - // First, you can actually run 'go test' in directories that - // have names that Windows thinks are installer-like, - // without getting a dialog box asking for more permissions. - // Second, in the Windows process listing during go test, - // the test shows up as test.test.exe, not pkgname.test.exe. - // That second one is a drawback, but it seems a small - // price to pay for the test running at all. - // If maintaining the list of bad words is too onerous, - // we could just do this always on Windows. - for _, bad := range windowsBadWords { - if strings.Contains(testBinary, bad) { - a.target = filepath.Join(testDir, "test.test") + exeSuffix - break - } - } - } - buildAction = a - - if testC || testNeedBinary { - // -c or profiling flag: create action to copy binary to ./test.out. - target := filepath.Join(cwd, testBinary+exeSuffix) - if testO != "" { - target = testO - if !filepath.IsAbs(target) { - target = filepath.Join(cwd, target) - } - } - buildAction = &action{ - f: (*builder).install, - deps: []*action{buildAction}, - p: pmain, - target: target, - } - runAction = buildAction // make sure runAction != nil even if not running test - } - if testC { - printAction = &action{p: p, deps: []*action{runAction}} // nop - } else { - // run test - runAction = &action{ - f: (*builder).runTest, - deps: []*action{buildAction}, - p: p, - ignoreFail: true, - } - cleanAction := &action{ - f: (*builder).cleanTest, - deps: []*action{runAction}, - p: p, - } - printAction = &action{ - f: (*builder).printTest, - deps: []*action{cleanAction}, - p: p, - } - } - - return buildAction, runAction, printAction, nil -} - -func testImportStack(top string, p *Package, target string) []string { - stk := []string{top, p.ImportPath} -Search: - for p.ImportPath != target { - for _, p1 := range p.imports { - if p1.ImportPath == target || contains(p1.Deps, target) { - stk = append(stk, p1.ImportPath) - p = p1 - continue Search - } - } - // Can't happen, but in case it does... - stk = append(stk, "") - break - } - return stk -} - -func recompileForTest(pmain, preal, ptest *Package, testDir string) { - // The "test copy" of preal is ptest. - // For each package that depends on preal, make a "test copy" - // that depends on ptest. And so on, up the dependency tree. - testCopy := map[*Package]*Package{preal: ptest} - for _, p := range packageList([]*Package{pmain}) { - // Copy on write. - didSplit := false - split := func() { - if didSplit { - return - } - didSplit = true - if p.pkgdir != testDir { - p1 := new(Package) - testCopy[p] = p1 - *p1 = *p - p1.imports = make([]*Package, len(p.imports)) - copy(p1.imports, p.imports) - p = p1 - p.pkgdir = testDir - p.target = "" - p.fake = true - p.Stale = true - } - } - - // Update p.deps and p.imports to use at test copies. - for i, dep := range p.deps { - if p1 := testCopy[dep]; p1 != nil && p1 != dep { - split() - p.deps[i] = p1 - } - } - for i, imp := range p.imports { - if p1 := testCopy[imp]; p1 != nil && p1 != imp { - split() - p.imports[i] = p1 - } - } - } -} - -var coverIndex = 0 - -// isTestFile reports whether the source file is a set of tests and should therefore -// be excluded from coverage analysis. -func isTestFile(file string) bool { - // We don't cover tests, only the code they test. - return strings.HasSuffix(file, "_test.go") -} - -// declareCoverVars attaches the required cover variables names -// to the files, to be used when annotating the files. -func declareCoverVars(importPath string, files ...string) map[string]*CoverVar { - coverVars := make(map[string]*CoverVar) - for _, file := range files { - if isTestFile(file) { - continue - } - coverVars[file] = &CoverVar{ - File: filepath.Join(importPath, file), - Var: fmt.Sprintf("GoCover_%d", coverIndex), - } - coverIndex++ - } - return coverVars -} - -// runTest is the action for running a test binary. -func (b *builder) runTest(a *action) error { - args := stringList(findExecCmd(), a.deps[0].target, testArgs) - a.testOutput = new(bytes.Buffer) - - if buildN || buildX { - b.showcmd("", "%s", strings.Join(args, " ")) - if buildN { - return nil - } - } - - if a.failed { - // We were unable to build the binary. - a.failed = false - fmt.Fprintf(a.testOutput, "FAIL\t%s [build failed]\n", a.p.ImportPath) - setExitStatus(1) - return nil - } - - cmd := exec.Command(args[0], args[1:]...) - cmd.Dir = a.p.Dir - cmd.Env = envForDir(cmd.Dir, origEnv) - var buf bytes.Buffer - if testStreamOutput { - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - } else { - cmd.Stdout = &buf - cmd.Stderr = &buf - } - - // If there are any local SWIG dependencies, we want to load - // the shared library from the build directory. - if a.p.usesSwig() { - env := cmd.Env - found := false - prefix := "LD_LIBRARY_PATH=" - for i, v := range env { - if strings.HasPrefix(v, prefix) { - env[i] = v + ":." - found = true - break - } - } - if !found { - env = append(env, "LD_LIBRARY_PATH=.") - } - cmd.Env = env - } - - t0 := time.Now() - err := cmd.Start() - - // This is a last-ditch deadline to detect and - // stop wedged test binaries, to keep the builders - // running. - if err == nil { - tick := time.NewTimer(testKillTimeout) - startSigHandlers() - done := make(chan error) - go func() { - done <- cmd.Wait() - }() - Outer: - select { - case err = <-done: - // ok - case <-tick.C: - if signalTrace != nil { - // Send a quit signal in the hope that the program will print - // a stack trace and exit. Give it five seconds before resorting - // to Kill. - cmd.Process.Signal(signalTrace) - select { - case err = <-done: - fmt.Fprintf(&buf, "*** Test killed with %v: ran too long (%v).\n", signalTrace, testKillTimeout) - break Outer - case <-time.After(5 * time.Second): - } - } - cmd.Process.Kill() - err = <-done - fmt.Fprintf(&buf, "*** Test killed: ran too long (%v).\n", testKillTimeout) - } - tick.Stop() - } - out := buf.Bytes() - t := fmt.Sprintf("%.3fs", time.Since(t0).Seconds()) - if err == nil { - if testShowPass { - a.testOutput.Write(out) - } - fmt.Fprintf(a.testOutput, "ok \t%s\t%s%s\n", a.p.ImportPath, t, coveragePercentage(out)) - return nil - } - - setExitStatus(1) - if len(out) > 0 { - a.testOutput.Write(out) - // assume printing the test binary's exit status is superfluous - } else { - fmt.Fprintf(a.testOutput, "%s\n", err) - } - fmt.Fprintf(a.testOutput, "FAIL\t%s\t%s\n", a.p.ImportPath, t) - - return nil -} - -// coveragePercentage returns the coverage results (if enabled) for the -// test. It uncovers the data by scanning the output from the test run. -func coveragePercentage(out []byte) string { - if !testCover { - return "" - } - // The string looks like - // test coverage for encoding/binary: 79.9% of statements - // Extract the piece from the percentage to the end of the line. - re := regexp.MustCompile(`coverage: (.*)\n`) - matches := re.FindSubmatch(out) - if matches == nil { - // Probably running "go test -cover" not "go test -cover fmt". - // The coverage output will appear in the output directly. - return "" - } - return fmt.Sprintf("\tcoverage: %s", matches[1]) -} - -// cleanTest is the action for cleaning up after a test. -func (b *builder) cleanTest(a *action) error { - if buildWork { - return nil - } - run := a.deps[0] - testDir := filepath.Join(b.work, filepath.FromSlash(run.p.ImportPath+"/_test")) - os.RemoveAll(testDir) - return nil -} - -// printTest is the action for printing a test result. -func (b *builder) printTest(a *action) error { - clean := a.deps[0] - run := clean.deps[0] - os.Stdout.Write(run.testOutput.Bytes()) - run.testOutput = nil - return nil -} - -// notest is the action for testing a package with no test files. -func (b *builder) notest(a *action) error { - fmt.Printf("? \t%s\t[no test files]\n", a.p.ImportPath) - return nil -} - -// isTestMain tells whether fn is a TestMain(m *testing.M) function. -func isTestMain(fn *ast.FuncDecl) bool { - if fn.Name.String() != "TestMain" || - fn.Type.Results != nil && len(fn.Type.Results.List) > 0 || - fn.Type.Params == nil || - len(fn.Type.Params.List) != 1 || - len(fn.Type.Params.List[0].Names) > 1 { - return false - } - ptr, ok := fn.Type.Params.List[0].Type.(*ast.StarExpr) - if !ok { - return false - } - // We can't easily check that the type is *testing.M - // because we don't know how testing has been imported, - // but at least check that it's *M or *something.M. - if name, ok := ptr.X.(*ast.Ident); ok && name.Name == "M" { - return true - } - if sel, ok := ptr.X.(*ast.SelectorExpr); ok && sel.Sel.Name == "M" { - return true - } - return false -} - -// isTest tells whether name looks like a test (or benchmark, according to prefix). -// It is a Test (say) if there is a character after Test that is not a lower-case letter. -// We don't want TesticularCancer. -func isTest(name, prefix string) bool { - if !strings.HasPrefix(name, prefix) { - return false - } - if len(name) == len(prefix) { // "Test" is ok - return true - } - rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) - return !unicode.IsLower(rune) -} - -type coverInfo struct { - Package *Package - Vars map[string]*CoverVar -} - -// loadTestFuncs returns the testFuncs describing the tests that will be run. -func loadTestFuncs(ptest *Package) (*testFuncs, error) { - t := &testFuncs{ - Package: ptest, - } - for _, file := range ptest.TestGoFiles { - if err := t.load(filepath.Join(ptest.Dir, file), "_test", &t.ImportTest, &t.NeedTest); err != nil { - return nil, err - } - } - for _, file := range ptest.XTestGoFiles { - if err := t.load(filepath.Join(ptest.Dir, file), "_xtest", &t.ImportXtest, &t.NeedXtest); err != nil { - return nil, err - } - } - return t, nil -} - -// writeTestmain writes the _testmain.go file for t to the file named out. -func writeTestmain(out string, t *testFuncs) error { - f, err := os.Create(out) - if err != nil { - return err - } - defer f.Close() - - if err := testmainTmpl.Execute(f, t); err != nil { - return err - } - - return nil -} - -type testFuncs struct { - Tests []testFunc - Benchmarks []testFunc - Examples []testFunc - TestMain *testFunc - Package *Package - ImportTest bool - NeedTest bool - ImportXtest bool - NeedXtest bool - NeedCgo bool - Cover []coverInfo -} - -func (t *testFuncs) CoverMode() string { - return testCoverMode -} - -func (t *testFuncs) CoverEnabled() bool { - return testCover -} - -// Covered returns a string describing which packages are being tested for coverage. -// If the covered package is the same as the tested package, it returns the empty string. -// Otherwise it is a comma-separated human-readable list of packages beginning with -// " in", ready for use in the coverage message. -func (t *testFuncs) Covered() string { - if testCoverPaths == nil { - return "" - } - return " in " + strings.Join(testCoverPaths, ", ") -} - -// Tested returns the name of the package being tested. -func (t *testFuncs) Tested() string { - return t.Package.Name -} - -type testFunc struct { - Package string // imported package name (_test or _xtest) - Name string // function name - Output string // output, for examples -} - -var testFileSet = token.NewFileSet() - -func (t *testFuncs) load(filename, pkg string, doImport, seen *bool) error { - f, err := parser.ParseFile(testFileSet, filename, nil, parser.ParseComments) - if err != nil { - return expandScanner(err) - } - for _, d := range f.Decls { - n, ok := d.(*ast.FuncDecl) - if !ok { - continue - } - if n.Recv != nil { - continue - } - name := n.Name.String() - switch { - case isTestMain(n): - if t.TestMain != nil { - return errors.New("multiple definitions of TestMain") - } - t.TestMain = &testFunc{pkg, name, ""} - *doImport, *seen = true, true - case isTest(name, "Test"): - t.Tests = append(t.Tests, testFunc{pkg, name, ""}) - *doImport, *seen = true, true - case isTest(name, "Benchmark"): - t.Benchmarks = append(t.Benchmarks, testFunc{pkg, name, ""}) - *doImport, *seen = true, true - } - } - ex := doc.Examples(f) - sort.Sort(byOrder(ex)) - for _, e := range ex { - *doImport = true // import test file whether executed or not - if e.Output == "" && !e.EmptyOutput { - // Don't run examples with no output. - continue - } - t.Examples = append(t.Examples, testFunc{pkg, "Example" + e.Name, e.Output}) - *seen = true - } - return nil -} - -type byOrder []*doc.Example - -func (x byOrder) Len() int { return len(x) } -func (x byOrder) Swap(i, j int) { x[i], x[j] = x[j], x[i] } -func (x byOrder) Less(i, j int) bool { return x[i].Order < x[j].Order } - -var testmainTmpl = template.Must(template.New("main").Parse(` -package main - -import ( -{{if not .TestMain}} - "os" -{{end}} - "regexp" - "testing" - -{{if .ImportTest}} - {{if .NeedTest}}_test{{else}}_{{end}} {{.Package.ImportPath | printf "%q"}} -{{end}} -{{if .ImportXtest}} - {{if .NeedXtest}}_xtest{{else}}_{{end}} {{.Package.ImportPath | printf "%s_test" | printf "%q"}} -{{end}} -{{range $i, $p := .Cover}} - _cover{{$i}} {{$p.Package.ImportPath | printf "%q"}} -{{end}} - -{{if .NeedCgo}} - _ "runtime/cgo" -{{end}} -) - -var tests = []testing.InternalTest{ -{{range .Tests}} - {"{{.Name}}", {{.Package}}.{{.Name}}}, -{{end}} -} - -var benchmarks = []testing.InternalBenchmark{ -{{range .Benchmarks}} - {"{{.Name}}", {{.Package}}.{{.Name}}}, -{{end}} -} - -var examples = []testing.InternalExample{ -{{range .Examples}} - {"{{.Name}}", {{.Package}}.{{.Name}}, {{.Output | printf "%q"}}}, -{{end}} -} - -var matchPat string -var matchRe *regexp.Regexp - -func matchString(pat, str string) (result bool, err error) { - if matchRe == nil || matchPat != pat { - matchPat = pat - matchRe, err = regexp.Compile(matchPat) - if err != nil { - return - } - } - return matchRe.MatchString(str), nil -} - -{{if .CoverEnabled}} - -// Only updated by init functions, so no need for atomicity. -var ( - coverCounters = make(map[string][]uint32) - coverBlocks = make(map[string][]testing.CoverBlock) -) - -func init() { - {{range $i, $p := .Cover}} - {{range $file, $cover := $p.Vars}} - coverRegisterFile({{printf "%q" $cover.File}}, _cover{{$i}}.{{$cover.Var}}.Count[:], _cover{{$i}}.{{$cover.Var}}.Pos[:], _cover{{$i}}.{{$cover.Var}}.NumStmt[:]) - {{end}} - {{end}} -} - -func coverRegisterFile(fileName string, counter []uint32, pos []uint32, numStmts []uint16) { - if 3*len(counter) != len(pos) || len(counter) != len(numStmts) { - panic("coverage: mismatched sizes") - } - if coverCounters[fileName] != nil { - // Already registered. - return - } - coverCounters[fileName] = counter - block := make([]testing.CoverBlock, len(counter)) - for i := range counter { - block[i] = testing.CoverBlock{ - Line0: pos[3*i+0], - Col0: uint16(pos[3*i+2]), - Line1: pos[3*i+1], - Col1: uint16(pos[3*i+2]>>16), - Stmts: numStmts[i], - } - } - coverBlocks[fileName] = block -} -{{end}} - -func main() { -{{if .CoverEnabled}} - testing.RegisterCover(testing.Cover{ - Mode: {{printf "%q" .CoverMode}}, - Counters: coverCounters, - Blocks: coverBlocks, - CoveredPackages: {{printf "%q" .Covered}}, - }) -{{end}} - m := testing.MainStart(matchString, tests, benchmarks, examples) -{{with .TestMain}} - {{.Package}}.{{.Name}}(m) -{{else}} - os.Exit(m.Run()) -{{end}} -} - -`)) diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p.go deleted file mode 100644 index a6a3891cd4e029d5e82f43ed0a3bedd0b158e30b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p.go +++ /dev/null @@ -1,19 +0,0 @@ -package p - -/* -void -f(void) -{ -} -*/ -import "C" - -var b bool - -func F() { - if b { - for { - } - } - C.f() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p_test.go deleted file mode 100644 index a8f057e358767230643d2cb226c69cfb75303b52..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/cgocover/p_test.go +++ /dev/null @@ -1,7 +0,0 @@ -package p - -import "testing" - -func TestF(t *testing.T) { - F() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/dep_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/dep_test.go deleted file mode 100644 index 0c53ac4f963517191f614aa17044b1df0d63f0c8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/dep_test.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package deps - -import _ "testing" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example1_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example1_test.go deleted file mode 100644 index ec7092e972b712211df90d7c7fc45966625310b0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example1_test.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Make sure that go test runs Example_Z before Example_A, preserving source order. - -package p - -import "fmt" - -var n int - -func Example_Z() { - n++ - fmt.Println(n) - // Output: 1 -} - -func Example_A() { - n++ - fmt.Println(n) - // Output: 2 -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example2_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example2_test.go deleted file mode 100644 index 1e0e80b80f03e1157654014df0b21b7d379150f0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/example2_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Make sure that go test runs Example_Y before Example_B, preserving source order. - -package p - -import "fmt" - -func Example_Y() { - n++ - fmt.Println(n) - // Output: 3 -} - -func Example_B() { - n++ - fmt.Println(n) - // Output: 4 -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test1.go deleted file mode 100644 index 1f05734f04f5bcbcf573e9a43168150ff265c1ab..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test1.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Simple test for go generate. - -// We include a build tag that go generate should ignore. - -// +build ignore - -//go:generate echo Success - -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test2.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test2.go deleted file mode 100644 index ef1a3d9515903d7481b60bf1631e3560b3195cda..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test2.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Test that go generate handles command aliases. - -//go:generate -command run echo Now is the time -//go:generate run for all good men - -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test3.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test3.go deleted file mode 100644 index 3d6a8a5c7420fe33031ced2907aa1f89eed3a15c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test3.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Test go generate variable substitution. - -//go:generate echo $GOARCH $GOFILE:$GOLINE ${GOPACKAGE}abc xyz$GOPACKAGE/$GOFILE/123 - -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test4.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test4.go deleted file mode 100644 index a7631c4a45652c6dbdb050911a3bccdd463d7314..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/generate/test4.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Test -run flag - -//go:generate echo oh yes my man -//go:generate echo no, no, a thousand times no - -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/bad.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/bad.go deleted file mode 100644 index e104c2e992b35026a3cece0a4e41ca42b6a26abd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/bad.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "bad" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/conflict.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/conflict.go deleted file mode 100644 index 995556c51148eec79bf7d4332159fe5cab15238d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/conflict.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "conflict" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go deleted file mode 100644 index bc51fd3fdeeb120877a927a0548dcd0f94e3aadb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/bad/bad.go +++ /dev/null @@ -1 +0,0 @@ -package bad // import diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go deleted file mode 100644 index 2d677035119bab23b86a306ef0d0f9a0a0e8d25c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/a.go +++ /dev/null @@ -1 +0,0 @@ -package conflict // import "a" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go deleted file mode 100644 index 8fcfb3c8bd3c7f39844814b434a3aa92b34d62a2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/conflict/b.go +++ /dev/null @@ -1 +0,0 @@ -package conflict /* import "b" */ diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go deleted file mode 100644 index 044c6eca803b62bca73e737d2c06fb037400014f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x.go +++ /dev/null @@ -1 +0,0 @@ -package x // import "works/x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go deleted file mode 100644 index 2449b29df51ef066e551ef72d9f7d17ce68a571f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/works/x/x1.go +++ /dev/null @@ -1 +0,0 @@ -package x // important! not an import comment diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go deleted file mode 100644 index b89849da78598b01ec6bfdca94fc4355f5174c8d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/src/wrongplace/x.go +++ /dev/null @@ -1 +0,0 @@ -package x // import "my/x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/works.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/works.go deleted file mode 100644 index 31b55d08a37f08e425e06c082bc2dd476b7d2c26..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/works.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import _ "works/x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/wrongplace.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/wrongplace.go deleted file mode 100644 index e2535e01ae0efbb973995828a5a5cbd2b107d8bd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/importcom/wrongplace.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "wrongplace" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easy.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easy.go deleted file mode 100644 index 4eeb517da15acf0bf8bc9f46a344fb85dfb46cda..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easy.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "./easysub" - -func main() { - easysub.Hello() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/easysub.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/easysub.go deleted file mode 100644 index 07040daee57991188df9d044c1e4502542555bda..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/easysub.go +++ /dev/null @@ -1,7 +0,0 @@ -package easysub - -import "fmt" - -func Hello() { - fmt.Println("easysub.Hello") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/main.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/main.go deleted file mode 100644 index 6c30b52362e45ed4d01d567a7452f4c729766165..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/easysub/main.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build ignore - -package main - -import "." - -func main() { - easysub.Hello() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/hard.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/hard.go deleted file mode 100644 index 2ffac3fd73bc65874b0e8edc8141049685622edf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/hard.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "./sub" - -func main() { - sub.Hello() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub.go deleted file mode 100644 index d5dbf6d5fa5bbe0a79e1e3c1163cb7d5d5f25376..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub.go +++ /dev/null @@ -1,12 +0,0 @@ -package sub - -import ( - "fmt" - - subsub "./sub" -) - -func Hello() { - fmt.Println("sub.Hello") - subsub.Hello() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub/subsub.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub/subsub.go deleted file mode 100644 index 4cc72233e13ee42317ed013074331f1ccdadc10b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/local/sub/sub/subsub.go +++ /dev/null @@ -1,7 +0,0 @@ -package subsub - -import "fmt" - -func Hello() { - fmt.Println("subsub.Hello") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/example_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/example_test.go deleted file mode 100644 index e158305a6c8cd93adf036b2f6234d3b88f98021d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/example_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package pkg_test - -import "os" - -func init() { - os.Stdout.Write([]byte("File with non-runnable example was built.\n")) -} - -func Example_test() { - // This test will not be run, it has no "Output:" comment. -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/test_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/test_test.go deleted file mode 100644 index d2e919838fb571404999ae2c71ddeb5e6766bd6a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/norunexample/test_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package pkg - -import ( - "os" - "testing" -) - -func TestBuilt(t *testing.T) { - os.Stdout.Write([]byte("A normal test was executed.\n")) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/sub/sub.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/sub/sub.go deleted file mode 100644 index 06ab7d0f9a35a7d1070711496d6ca1cb892a258f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/sub/sub.go +++ /dev/null @@ -1 +0,0 @@ -package main diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/x.go deleted file mode 100644 index 06ab7d0f9a35a7d1070711496d6ca1cb892a258f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/rundir/x.go +++ /dev/null @@ -1 +0,0 @@ -package main diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/foo/foo.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/foo/foo.go deleted file mode 100644 index f52652b1ba78cfe439c9719d0d3dfb51ed9d44d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/foo/foo.go +++ /dev/null @@ -1 +0,0 @@ -package foo diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/math/math.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/math/math.go deleted file mode 100644 index c91c24e967cccde6aa7be55a6e77ed22991bf9e9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root1/src/math/math.go +++ /dev/null @@ -1 +0,0 @@ -package math diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root2/src/foo/foo.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root2/src/foo/foo.go deleted file mode 100644 index f52652b1ba78cfe439c9719d0d3dfb51ed9d44d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/shadow/root2/src/foo/foo.go +++ /dev/null @@ -1 +0,0 @@ -package foo diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badc/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badc/x.go deleted file mode 100644 index bfa1de28bde5178ac93b88b3153efaa6cc56b9cc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badc/x.go +++ /dev/null @@ -1 +0,0 @@ -package badc diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badpkg/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badpkg/x.go deleted file mode 100644 index dda35e8ed3db96f40fe93a0f5a6ba71cb13180d1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badpkg/x.go +++ /dev/null @@ -1 +0,0 @@ -pkg badpkg diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badexec/x_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badexec/x_test.go deleted file mode 100644 index 12f50517125a3d91b4977bab24f4d67834bb9a7c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badexec/x_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package badexec - -func init() { - panic("badexec") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x.go deleted file mode 100644 index c8a5407a5ace027072b0678d611f63e5b3449b85..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x.go +++ /dev/null @@ -1 +0,0 @@ -package badsyntax diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x_test.go deleted file mode 100644 index 5be10745d9b874c15f72e86e7b90eca66c9738e4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badsyntax/x_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package badsyntax - -func func func func func! diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x.go deleted file mode 100644 index fdd46c4c721cb6e4356f4dea562a851b718a9d50..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x.go +++ /dev/null @@ -1 +0,0 @@ -package badvar diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x_test.go deleted file mode 100644 index c67df01c5cac251e47f7a2ac957ca129cd9b67aa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/badtest/badvar/x_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package badvar_test - -func f() { - _ = notdefined -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/cgotest/m.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/cgotest/m.go deleted file mode 100644 index 4d68307cf0dbaee3064123c54e068da54146fa62..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/cgotest/m.go +++ /dev/null @@ -1,5 +0,0 @@ -package cgotest - -import "C" - -var _ C.int diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/go-cmd-test/helloworld.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/go-cmd-test/helloworld.go deleted file mode 100644 index 002a5c740c7d288d40d490a43aae9297488a2433..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/go-cmd-test/helloworld.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func main() { - println("hello world") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m.go deleted file mode 100644 index c682f030b4eb33e1dfe819ec320806076ff7131a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m.go +++ /dev/null @@ -1,4 +0,0 @@ -package main - -func F() {} -func main() {} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m_test.go deleted file mode 100644 index f865b7734f0e5d56fe6e62dd0f540efc00eb783a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/main_test/m_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package main_test - -import ( - . "main_test" - "testing" -) - -func Test1(t *testing.T) { - F() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/notest/hello.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/notest/hello.go deleted file mode 100644 index 7c42c32fb0abcae9ad478b2e9b324b4de4814526..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/notest/hello.go +++ /dev/null @@ -1,6 +0,0 @@ -package notest - -func hello() { - println("hello world") -} -Hello world diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x.go deleted file mode 100644 index c89cd18d0fe7d777c6008d0d9133c5bb808be6fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go deleted file mode 100644 index 2460743e50186d66712857889ed1506286f2b53f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/syntaxerror/x_test.go +++ /dev/null @@ -1,4 +0,0 @@ -package p - -func f() (x.y, z int) { -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go deleted file mode 100644 index 65ab76d4e1e8bafc5e3a1e10dd5be1200625228f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1.go +++ /dev/null @@ -1,7 +0,0 @@ -package p1 - -import _ "testcycle/p2" - -func init() { - println("p1 init") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go deleted file mode 100644 index 75abb13e6d0349938d6d1e1136e225e230ab19f4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p1/p1_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package p1 - -import "testing" - -func Test(t *testing.T) { -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go deleted file mode 100644 index 7e26cdf19c913f3c4638944540967e93a507caa5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p2/p2.go +++ /dev/null @@ -1,7 +0,0 @@ -package p2 - -import _ "testcycle/p3" - -func init() { - println("p2 init") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go deleted file mode 100644 index bb0a2f4f6569229b75b37b6636c5dede5d35fc62..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3.go +++ /dev/null @@ -1,5 +0,0 @@ -package p3 - -func init() { - println("p3 init") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go deleted file mode 100644 index 9b4b0757f82acca7121fbceb6223c0700e322bb1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/p3/p3_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package p3 - -import ( - "testing" - - _ "testcycle/p1" -) - -func Test(t *testing.T) { -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go deleted file mode 100644 index 7a471f0cc05a38b6c173ada43a7a68e82968456d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1.go +++ /dev/null @@ -1 +0,0 @@ -package q1 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go deleted file mode 100644 index ca81bd2bf80b18f01b6a8248a7999fe3d7d20b00..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testcycle/q1/q1_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package q1 - -import "testing" -import _ "testcycle/q1" - -func Test(t *testing.T) {} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go deleted file mode 100644 index a457035a4300f39249b3b263624b537909bd2951..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1.go +++ /dev/null @@ -1 +0,0 @@ -package p1 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go deleted file mode 100644 index 8be75334425d606a4070f7e7be41ee83f8d760cb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p1/p1_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package p1 - -import _ "testdep/p2" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go deleted file mode 100644 index 15ba2eacea5c6e4a26884238c7f98f0149132f71..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p2/p2.go +++ /dev/null @@ -1,3 +0,0 @@ -package p2 - -import _ "testdep/p3" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go deleted file mode 100644 index 0219e7fae507e173b49c71e668b8fd2811715178..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/testdep/p3/p3.go +++ /dev/null @@ -1,3 +0,0 @@ -// +build ignore - -package ignored diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/bad.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/bad.go deleted file mode 100644 index 57cc595220c50d5941a245734f0a2ed8a6592192..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/bad.go +++ /dev/null @@ -1,3 +0,0 @@ -package vend - -import _ "r" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/good.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/good.go deleted file mode 100644 index 952ada3108d34828f0ae101e11e93ef69260d587..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/good.go +++ /dev/null @@ -1,3 +0,0 @@ -package vend - -import _ "p" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello.go deleted file mode 100644 index 41dc03e0ce497d99597d06ddd15ff6f55635b874..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -import ( - "fmt" - "strings" // really ../vendor/strings -) - -func main() { - fmt.Printf("%s\n", strings.Msg) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello_test.go deleted file mode 100644 index 5e72ada9387a7a79d903d8557b214c0899c432d5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hello_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package main - -import ( - "strings" // really ../vendor/strings - "testing" -) - -func TestMsgInternal(t *testing.T) { - if strings.Msg != "hello, world" { - t.Fatal("unexpected msg: %v", strings.Msg) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hellox_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hellox_test.go deleted file mode 100644 index 96e6049dad0ae1642f9fbdcb3a91917675ecd52d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/hello/hellox_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package main_test - -import ( - "strings" // really ../vendor/strings - "testing" -) - -func TestMsgExternal(t *testing.T) { - if strings.Msg != "hello, world" { - t.Fatal("unexpected msg: %v", strings.Msg) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/bad.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/bad.go deleted file mode 100644 index d0ddaacfea5df6464c0f185d477c9ded6ee09150..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/bad.go +++ /dev/null @@ -1,3 +0,0 @@ -package subdir - -import _ "r" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/good.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/good.go deleted file mode 100644 index edd04543a2bad09f53b1f4fd50a2502f80d16e3b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/subdir/good.go +++ /dev/null @@ -1,3 +0,0 @@ -package subdir - -import _ "p" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/p/p.go deleted file mode 100644 index c89cd18d0fe7d777c6008d0d9133c5bb808be6fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/p/p.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/q/q.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/q/q.go deleted file mode 100644 index 946e6d99109580d53b402a34fd8b55226b9e564d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/q/q.go +++ /dev/null @@ -1 +0,0 @@ -package q diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/strings/msg.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/strings/msg.go deleted file mode 100644 index 438126ba2be59819a8e2710480eccd897f9cdf9b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/vendor/strings/msg.go +++ /dev/null @@ -1,3 +0,0 @@ -package strings - -var Msg = "hello, world" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/invalid/invalid.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/invalid/invalid.go deleted file mode 100644 index e250d5bb31b563a4fdbb958fb034d7fa388fe38a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/invalid/invalid.go +++ /dev/null @@ -1,3 +0,0 @@ -package invalid - -import "vend/x/invalid/vendor/foo" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p.go deleted file mode 100644 index c89cd18d0fe7d777c6008d0d9133c5bb808be6fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p/p.go deleted file mode 100644 index e12e12c2f4c9c738561a10ce54e8afcaa17fb9ef..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/p/p/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import _ "notfound" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/r/r.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/r/r.go deleted file mode 100644 index 838c177a570f958653822675e6dc4079e5c472af..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/vendor/r/r.go +++ /dev/null @@ -1 +0,0 @@ -package r diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/x.go deleted file mode 100644 index ae526ebdda252e8fb618fb5b6f90e5ab6902a432..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vend/x/x.go +++ /dev/null @@ -1,5 +0,0 @@ -package x - -import _ "p" -import _ "q" -import _ "r" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/a_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/a_test.go deleted file mode 100644 index 9b64e8e1a26912848f4e8069783f060c94be47c6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/a_test.go +++ /dev/null @@ -1 +0,0 @@ -package p_test diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/b.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/b.go deleted file mode 100644 index 99e18f63dc65aaf4bad40464f0c89cc3f8dc75bb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/b.go +++ /dev/null @@ -1,7 +0,0 @@ -package p - -import "fmt" - -func f() { - fmt.Printf("%d") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/c.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/c.go deleted file mode 100644 index ef5648f0590c42e9b6d7a3ee4049fca0feb3ae00..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/vetpkg/c.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build tagtest - -package p - -import "fmt" - -func g() { - fmt.Printf("%d", 3, 4) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f.go deleted file mode 100644 index dac039e1ad0ed1c0b00c4338abe5f5e46fc39a66..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f.go +++ /dev/null @@ -1,3 +0,0 @@ -package xtestonly - -func F() int { return 42 } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f_test.go deleted file mode 100644 index 01f6e83730c3911929f1d218739bb7c94810850f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/src/xtestonly/f_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package xtestonly_test - -import ( - "testing" - "xtestonly" -) - -func TestF(t *testing.T) { - if x := xtestonly.F(); x != 42 { - t.Errorf("f.F() = %d, want 42", x) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/standalone_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/standalone_test.go deleted file mode 100644 index 59cf918b9bc8dcb0a8a9cc8dca67ab3e520ad961..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/standalone_test.go +++ /dev/null @@ -1,6 +0,0 @@ -package standalone_test - -import "testing" - -func Test(t *testing.T) { -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p.go deleted file mode 100644 index f94d2cd0e66c2b19547f2a04039695a555140f1d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -func F() int { return 1 } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p1/p1.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p1/p1.go deleted file mode 100644 index fd315272ea21d544f0db689c99bce227ca20617c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p1/p1.go +++ /dev/null @@ -1,3 +0,0 @@ -package p1 - -func F() int { return 1 } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p2/p2.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p2/p2.go deleted file mode 100644 index d4888865ddb7a88b8abd553b67ce7bc78eedcbbc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p2/p2.go +++ /dev/null @@ -1,3 +0,0 @@ -package p2 - -func F() int { return 1 } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p_test.go deleted file mode 100644 index a3fb4a9e2780b84bec390a6c8d800bcd8e86f66c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/p_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package p - -import ( - "./p1" - - "testing" -) - -func TestF(t *testing.T) { - if F() != p1.F() { - t.Fatal(F()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/x_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/x_test.go deleted file mode 100644 index b253e3fd2dd9453d8c812acff968c21953bf98ad..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testimport/x_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package p_test - -import ( - . "../testimport" - - "./p2" - - "testing" -) - -func TestF1(t *testing.T) { - if F() != p2.F() { - t.Fatal(F()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal/p.go deleted file mode 100644 index e3558a53b244276b9ba1bf0867a04e5ad2057743..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import _ "net/http/internal" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/p.go deleted file mode 100644 index c594f5c5e9effc9e9ea56692b4c71c84d76f2c1b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import _ "./x/y/z/internal/w" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/x/y/z/internal/w/w.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/x/y/z/internal/w/w.go deleted file mode 100644 index a796c0b5f4b14f82d3cc4417a0d14c9a96fa1019..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal2/x/y/z/internal/w/w.go +++ /dev/null @@ -1 +0,0 @@ -package w diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal3/t.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal3/t.go deleted file mode 100644 index 8576a4b4d76d6220a56482e722a58712fb50ae14..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal3/t.go +++ /dev/null @@ -1,3 +0,0 @@ -package t - -import _ "internal/does-not-exist" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/p/p.go deleted file mode 100644 index 6bdee27be2f9577b633f5c889bd0ed60050aa366..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/p/p.go +++ /dev/null @@ -1,6 +0,0 @@ -package p - -import ( - _ "q/internal/x" - _ "q/j" -) diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/internal/x/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/internal/x/x.go deleted file mode 100644 index 823aafd0712b6c533df84b17d9b7ac6ae43e66fa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/internal/x/x.go +++ /dev/null @@ -1 +0,0 @@ -package x diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/j/j.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/j/j.go deleted file mode 100644 index 9f07543894098fa018424fb6fc0eff05b4682466..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testinternal4/src/q/j/j.go +++ /dev/null @@ -1,3 +0,0 @@ -package j - -import _ "q/internal/x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testonly/p_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testonly/p_test.go deleted file mode 100644 index c89cd18d0fe7d777c6008d0d9133c5bb808be6fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testonly/p_test.go +++ /dev/null @@ -1 +0,0 @@ -package p diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/p/p.go deleted file mode 100644 index e740715186ebf6695594700c00042ee8fc8fb468..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/p/p.go +++ /dev/null @@ -1,6 +0,0 @@ -package p - -import ( - _ "q/y" - _ "q/z" -) diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/vendor/x/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/vendor/x/x.go deleted file mode 100644 index 823aafd0712b6c533df84b17d9b7ac6ae43e66fa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/vendor/x/x.go +++ /dev/null @@ -1 +0,0 @@ -package x diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/y/y.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/y/y.go deleted file mode 100644 index 4f842237675a424ea2e20029ec4fd4c5cbfd0d1e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/y/y.go +++ /dev/null @@ -1,3 +0,0 @@ -package y - -import _ "x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/z/z.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/z/z.go deleted file mode 100644 index a8d4924936a7a5d7e4bc88b8ab9e5a9d20c26627..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor/src/q/z/z.go +++ /dev/null @@ -1,3 +0,0 @@ -package z - -import _ "q/vendor/x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/src/p/p.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/src/p/p.go deleted file mode 100644 index 220b2b2a0712eabd10461cb354842501785282d6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/src/p/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -import "x" diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/vendor/x/x.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/vendor/x/x.go deleted file mode 100644 index 823aafd0712b6c533df84b17d9b7ac6ae43e66fa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testdata/testvendor2/vendor/x/x.go +++ /dev/null @@ -1 +0,0 @@ -package x diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testflag.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testflag.go deleted file mode 100644 index 1f3e3d316af5a8794e8746e6617d9a943a5fc3a3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testflag.go +++ /dev/null @@ -1,281 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "flag" - "fmt" - "os" - "strconv" - "strings" -) - -// The flag handling part of go test is large and distracting. -// We can't use the flag package because some of the flags from -// our command line are for us, and some are for 6.out, and -// some are for both. - -// testFlagSpec defines a flag we know about. -type testFlagSpec struct { - name string - boolVar *bool - flagValue flag.Value - passToTest bool // pass to Test - multiOK bool // OK to have multiple instances - present bool // flag has been seen -} - -// testFlagDefn is the set of flags we process. -var testFlagDefn = []*testFlagSpec{ - // local. - {name: "c", boolVar: &testC}, - {name: "i", boolVar: &buildI}, - {name: "o"}, - {name: "cover", boolVar: &testCover}, - {name: "covermode"}, - {name: "coverpkg"}, - {name: "exec"}, - - // passed to 6.out, adding a "test." prefix to the name if necessary: -v becomes -test.v. - {name: "bench", passToTest: true}, - {name: "benchmem", boolVar: new(bool), passToTest: true}, - {name: "benchtime", passToTest: true}, - {name: "count", passToTest: true}, - {name: "coverprofile", passToTest: true}, - {name: "cpu", passToTest: true}, - {name: "cpuprofile", passToTest: true}, - {name: "memprofile", passToTest: true}, - {name: "memprofilerate", passToTest: true}, - {name: "blockprofile", passToTest: true}, - {name: "blockprofilerate", passToTest: true}, - {name: "outputdir", passToTest: true}, - {name: "parallel", passToTest: true}, - {name: "run", passToTest: true}, - {name: "short", boolVar: new(bool), passToTest: true}, - {name: "timeout", passToTest: true}, - {name: "trace", passToTest: true}, - {name: "v", boolVar: &testV, passToTest: true}, -} - -// add build flags to testFlagDefn -func init() { - var cmd Command - addBuildFlags(&cmd) - cmd.Flag.VisitAll(func(f *flag.Flag) { - if f.Name == "v" { - // test overrides the build -v flag - return - } - testFlagDefn = append(testFlagDefn, &testFlagSpec{ - name: f.Name, - flagValue: f.Value, - }) - }) -} - -// testFlags processes the command line, grabbing -x and -c, rewriting known flags -// to have "test" before them, and reading the command line for the 6.out. -// Unfortunately for us, we need to do our own flag processing because go test -// grabs some flags but otherwise its command line is just a holding place for -// pkg.test's arguments. -// We allow known flags both before and after the package name list, -// to allow both -// go test fmt -custom-flag-for-fmt-test -// go test -x math -func testFlags(args []string) (packageNames, passToTest []string) { - inPkg := false - outputDir := "" - for i := 0; i < len(args); i++ { - if !strings.HasPrefix(args[i], "-") { - if !inPkg && packageNames == nil { - // First package name we've seen. - inPkg = true - } - if inPkg { - packageNames = append(packageNames, args[i]) - continue - } - } - - if inPkg { - // Found an argument beginning with "-"; end of package list. - inPkg = false - } - - f, value, extraWord := testFlag(args, i) - if f == nil { - // This is a flag we do not know; we must assume - // that any args we see after this might be flag - // arguments, not package names. - inPkg = false - if packageNames == nil { - // make non-nil: we have seen the empty package list - packageNames = []string{} - } - passToTest = append(passToTest, args[i]) - continue - } - if f.flagValue != nil { - if err := f.flagValue.Set(value); err != nil { - fatalf("invalid flag argument for -%s: %v", f.name, err) - } - } else { - // Test-only flags. - // Arguably should be handled by f.flagValue, but aren't. - var err error - switch f.name { - // bool flags. - case "c", "i", "v", "cover": - setBoolFlag(f.boolVar, value) - case "o": - testO = value - testNeedBinary = true - case "exec": - execCmd, err = splitQuotedFields(value) - if err != nil { - fatalf("invalid flag argument for -%s: %v", f.name, err) - } - case "bench": - // record that we saw the flag; don't care about the value - testBench = true - case "timeout": - testTimeout = value - case "blockprofile", "cpuprofile", "memprofile", "trace": - testProfile = true - testNeedBinary = true - case "coverpkg": - testCover = true - if value == "" { - testCoverPaths = nil - } else { - testCoverPaths = strings.Split(value, ",") - } - case "coverprofile": - testCover = true - testProfile = true - case "covermode": - switch value { - case "set", "count", "atomic": - testCoverMode = value - default: - fatalf("invalid flag argument for -covermode: %q", value) - } - testCover = true - case "outputdir": - outputDir = value - } - } - if extraWord { - i++ - } - if f.passToTest { - passToTest = append(passToTest, "-test."+f.name+"="+value) - } - } - - if testCoverMode == "" { - testCoverMode = "set" - if buildRace { - // Default coverage mode is atomic when -race is set. - testCoverMode = "atomic" - } - } - - // Tell the test what directory we're running in, so it can write the profiles there. - if testProfile && outputDir == "" { - dir, err := os.Getwd() - if err != nil { - fatalf("error from os.Getwd: %s", err) - } - passToTest = append(passToTest, "-test.outputdir", dir) - } - return -} - -// testFlag sees if argument i is a known flag and returns its definition, value, and whether it consumed an extra word. -func testFlag(args []string, i int) (f *testFlagSpec, value string, extra bool) { - arg := args[i] - if strings.HasPrefix(arg, "--") { // reduce two minuses to one - arg = arg[1:] - } - switch arg { - case "-?", "-h", "-help": - usage() - } - if arg == "" || arg[0] != '-' { - return - } - name := arg[1:] - // If there's already "test.", drop it for now. - name = strings.TrimPrefix(name, "test.") - equals := strings.Index(name, "=") - if equals >= 0 { - value = name[equals+1:] - name = name[:equals] - } - for _, f = range testFlagDefn { - if name == f.name { - // Booleans are special because they have modes -x, -x=true, -x=false. - if f.boolVar != nil || isBoolFlag(f.flagValue) { - if equals < 0 { // otherwise, it's been set and will be verified in setBoolFlag - value = "true" - } else { - // verify it parses - setBoolFlag(new(bool), value) - } - } else { // Non-booleans must have a value. - extra = equals < 0 - if extra { - if i+1 >= len(args) { - testSyntaxError("missing argument for flag " + f.name) - } - value = args[i+1] - } - } - if f.present && !f.multiOK { - testSyntaxError(f.name + " flag may be set only once") - } - f.present = true - return - } - } - f = nil - return -} - -// isBoolFlag reports whether v is a bool flag. -func isBoolFlag(v flag.Value) bool { - vv, ok := v.(interface { - IsBoolFlag() bool - }) - if ok { - return vv.IsBoolFlag() - } - return false -} - -// setBoolFlag sets the addressed boolean to the value. -func setBoolFlag(flag *bool, value string) { - x, err := strconv.ParseBool(value) - if err != nil { - testSyntaxError("illegal bool flag value " + value) - } - *flag = x -} - -// setIntFlag sets the addressed integer to the value. -func setIntFlag(flag *int, value string) { - x, err := strconv.Atoi(value) - if err != nil { - testSyntaxError("illegal int flag value " + value) - } - *flag = x -} - -func testSyntaxError(msg string) { - fmt.Fprintf(os.Stderr, "go test: %s\n", msg) - fmt.Fprintf(os.Stderr, `run "go help test" or "go help testflag" for more information`+"\n") - os.Exit(2) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/testgo.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/testgo.go deleted file mode 100644 index 01923f74bdff7653e4de02d9b8f3ffad0b588695..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/testgo.go +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains extra hooks for testing the go command. -// It is compiled into the Go binary only when building the -// test copy; it does not get compiled into the standard go -// command, so these testing hooks are not present in the -// go command that everyone uses. - -// +build testgo - -package main - -import "os" - -func init() { - if v := os.Getenv("TESTGO_IS_GO_RELEASE"); v != "" { - isGoRelease = v == "1" - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/tool.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/tool.go deleted file mode 100644 index 4b9493937aa1a34bbf18a37f923219a5a9885015..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/tool.go +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "go/build" - "os" - "os/exec" - "path/filepath" - "runtime" - "sort" - "strings" -) - -var cmdTool = &Command{ - Run: runTool, - UsageLine: "tool [-n] command [args...]", - Short: "run specified go tool", - Long: ` -Tool runs the go tool command identified by the arguments. -With no arguments it prints the list of known tools. - -The -n flag causes tool to print the command that would be -executed but not execute it. - -For more about each tool command, see 'go tool command -h'. -`, -} - -var ( - toolGOOS = runtime.GOOS - toolGOARCH = runtime.GOARCH - toolIsWindows = toolGOOS == "windows" - toolDir = build.ToolDir - - toolN bool -) - -// List of go tools found in the gccgo tool directory. -// Other binaries could be in the same directory so don't -// show those with the 'go tool' command. - -var gccgoTools = []string{"cgo", "fix", "cover", "godoc", "vet"} - -func init() { - cmdTool.Flag.BoolVar(&toolN, "n", false, "") -} - -const toolWindowsExtension = ".exe" - -func tool(toolName string) string { - toolPath := filepath.Join(toolDir, toolName) - if toolIsWindows { - toolPath += toolWindowsExtension - } - if len(buildToolExec) > 0 { - return toolPath - } - // Give a nice message if there is no tool with that name. - if _, err := os.Stat(toolPath); err != nil { - if isInGoToolsRepo(toolName) { - fmt.Fprintf(os.Stderr, "go tool: no such tool %q; to install:\n\tgo get golang.org/x/tools/cmd/%s\n", toolName, toolName) - } else { - fmt.Fprintf(os.Stderr, "go tool: no such tool %q\n", toolName) - } - setExitStatus(3) - exit() - } - return toolPath -} - -func isInGoToolsRepo(toolName string) bool { - return false -} - -func runTool(cmd *Command, args []string) { - if len(args) == 0 { - listTools() - return - } - toolName := args[0] - // The tool name must be lower-case letters, numbers or underscores. - for _, c := range toolName { - switch { - case 'a' <= c && c <= 'z', '0' <= c && c <= '9', c == '_': - default: - fmt.Fprintf(os.Stderr, "go tool: bad tool name %q\n", toolName) - setExitStatus(2) - return - } - } - toolPath := tool(toolName) - if toolPath == "" { - return - } - if toolN { - cmd := toolPath - if len(args) > 1 { - cmd += " " + strings.Join(args[1:], " ") - } - fmt.Printf("%s\n", cmd) - return - } - toolCmd := &exec.Cmd{ - Path: toolPath, - Args: args, - Stdin: os.Stdin, - Stdout: os.Stdout, - Stderr: os.Stderr, - // Set $GOROOT, mainly for go tool dist. - Env: mergeEnvLists([]string{"GOROOT=" + goroot}, os.Environ()), - } - err := toolCmd.Run() - if err != nil { - // Only print about the exit status if the command - // didn't even run (not an ExitError) or it didn't exit cleanly - // or we're printing command lines too (-x mode). - // Assume if command exited cleanly (even with non-zero status) - // it printed any messages it wanted to print. - if e, ok := err.(*exec.ExitError); !ok || !e.Exited() || buildX { - fmt.Fprintf(os.Stderr, "go tool %s: %s\n", toolName, err) - } - setExitStatus(1) - return - } -} - -// listTools prints a list of the available tools in the tools directory. -func listTools() { - f, err := os.Open(toolDir) - if err != nil { - fmt.Fprintf(os.Stderr, "go tool: no tool directory: %s\n", err) - setExitStatus(2) - return - } - defer f.Close() - names, err := f.Readdirnames(-1) - if err != nil { - fmt.Fprintf(os.Stderr, "go tool: can't read directory: %s\n", err) - setExitStatus(2) - return - } - - sort.Strings(names) - for _, name := range names { - // Unify presentation by going to lower case. - name = strings.ToLower(name) - // If it's windows, don't show the .exe suffix. - if toolIsWindows && strings.HasSuffix(name, toolWindowsExtension) { - name = name[:len(name)-len(toolWindowsExtension)] - } - - // The tool directory used by gccgo will have other binaries - // in additions to go tools. Only display go tools for this list. - - if buildContext.Compiler == "gccgo" { - for _, tool := range gccgoTools { - if tool == name { - fmt.Println(name) - } - } - } else { - - // Not gccgo, list all the tools found in this dir - - fmt.Println(name) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs.go deleted file mode 100644 index 28a7540dfe43c0b14f929e94051a74eb6b1ae399..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs.go +++ /dev/null @@ -1,1037 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "internal/singleflight" - "log" - "net/url" - "os" - "os/exec" - "path/filepath" - "regexp" - "strings" - "sync" -) - -// A vcsCmd describes how to use a version control system -// like Mercurial, Git, or Subversion. -type vcsCmd struct { - name string - cmd string // name of binary to invoke command - - createCmd []string // commands to download a fresh copy of a repository - downloadCmd []string // commands to download updates into an existing repository - - tagCmd []tagCmd // commands to list tags - tagLookupCmd []tagCmd // commands to lookup tags before running tagSyncCmd - tagSyncCmd []string // commands to sync to specific tag - tagSyncDefault []string // commands to sync to default tag - - scheme []string - pingCmd string - - remoteRepo func(v *vcsCmd, rootDir string) (remoteRepo string, err error) - resolveRepo func(v *vcsCmd, rootDir, remoteRepo string) (realRepo string, err error) -} - -var isSecureScheme = map[string]bool{ - "https": true, - "git+ssh": true, - "bzr+ssh": true, - "svn+ssh": true, - "ssh": true, -} - -func (v *vcsCmd) isSecure(repo string) bool { - u, err := url.Parse(repo) - if err != nil { - // If repo is not a URL, it's not secure. - return false - } - return isSecureScheme[u.Scheme] -} - -// A tagCmd describes a command to list available tags -// that can be passed to tagSyncCmd. -type tagCmd struct { - cmd string // command to list tags - pattern string // regexp to extract tags from list -} - -// vcsList lists the known version control systems -var vcsList = []*vcsCmd{ - vcsHg, - vcsGit, - vcsSvn, - vcsBzr, -} - -// vcsByCmd returns the version control system for the given -// command name (hg, git, svn, bzr). -func vcsByCmd(cmd string) *vcsCmd { - for _, vcs := range vcsList { - if vcs.cmd == cmd { - return vcs - } - } - return nil -} - -// vcsHg describes how to use Mercurial. -var vcsHg = &vcsCmd{ - name: "Mercurial", - cmd: "hg", - - createCmd: []string{"clone -U {repo} {dir}"}, - downloadCmd: []string{"pull"}, - - // We allow both tag and branch names as 'tags' - // for selecting a version. This lets people have - // a go.release.r60 branch and a go1 branch - // and make changes in both, without constantly - // editing .hgtags. - tagCmd: []tagCmd{ - {"tags", `^(\S+)`}, - {"branches", `^(\S+)`}, - }, - tagSyncCmd: []string{"update -r {tag}"}, - tagSyncDefault: []string{"update default"}, - - scheme: []string{"https", "http", "ssh"}, - pingCmd: "identify {scheme}://{repo}", - remoteRepo: hgRemoteRepo, -} - -func hgRemoteRepo(vcsHg *vcsCmd, rootDir string) (remoteRepo string, err error) { - out, err := vcsHg.runOutput(rootDir, "paths default") - if err != nil { - return "", err - } - return strings.TrimSpace(string(out)), nil -} - -// vcsGit describes how to use Git. -var vcsGit = &vcsCmd{ - name: "Git", - cmd: "git", - - createCmd: []string{"clone {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"}, - downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"}, - - tagCmd: []tagCmd{ - // tags/xxx matches a git tag named xxx - // origin/xxx matches a git branch named xxx on the default remote repository - {"show-ref", `(?:tags|origin)/(\S+)$`}, - }, - tagLookupCmd: []tagCmd{ - {"show-ref tags/{tag} origin/{tag}", `((?:tags|origin)/\S+)$`}, - }, - tagSyncCmd: []string{"checkout {tag}", "submodule update --init --recursive"}, - // both createCmd and downloadCmd update the working dir. - // No need to do more here. We used to 'checkout master' - // but that doesn't work if the default branch is not named master. - // See golang.org/issue/9032. - tagSyncDefault: []string{"checkout master", "submodule update --init --recursive"}, - - scheme: []string{"git", "https", "http", "git+ssh", "ssh"}, - pingCmd: "ls-remote {scheme}://{repo}", - remoteRepo: gitRemoteRepo, -} - -// scpSyntaxRe matches the SCP-like addresses used by Git to access -// repositories by SSH. -var scpSyntaxRe = regexp.MustCompile(`^([a-zA-Z0-9_]+)@([a-zA-Z0-9._-]+):(.*)$`) - -func gitRemoteRepo(vcsGit *vcsCmd, rootDir string) (remoteRepo string, err error) { - cmd := "config remote.origin.url" - errParse := errors.New("unable to parse output of git " + cmd) - errRemoteOriginNotFound := errors.New("remote origin not found") - outb, err := vcsGit.run1(rootDir, cmd, nil, false) - if err != nil { - // if it doesn't output any message, it means the config argument is correct, - // but the config value itself doesn't exist - if outb != nil && len(outb) == 0 { - return "", errRemoteOriginNotFound - } - return "", err - } - out := strings.TrimSpace(string(outb)) - - var repoURL *url.URL - if m := scpSyntaxRe.FindStringSubmatch(out); m != nil { - // Match SCP-like syntax and convert it to a URL. - // Eg, "git@github.com:user/repo" becomes - // "ssh://git@github.com/user/repo". - repoURL = &url.URL{ - Scheme: "ssh", - User: url.User(m[1]), - Host: m[2], - RawPath: m[3], - } - } else { - repoURL, err = url.Parse(out) - if err != nil { - return "", err - } - } - - // Iterate over insecure schemes too, because this function simply - // reports the state of the repo. If we can't see insecure schemes then - // we can't report the actual repo URL. - for _, s := range vcsGit.scheme { - if repoURL.Scheme == s { - return repoURL.String(), nil - } - } - return "", errParse -} - -// vcsBzr describes how to use Bazaar. -var vcsBzr = &vcsCmd{ - name: "Bazaar", - cmd: "bzr", - - createCmd: []string{"branch {repo} {dir}"}, - - // Without --overwrite bzr will not pull tags that changed. - // Replace by --overwrite-tags after http://pad.lv/681792 goes in. - downloadCmd: []string{"pull --overwrite"}, - - tagCmd: []tagCmd{{"tags", `^(\S+)`}}, - tagSyncCmd: []string{"update -r {tag}"}, - tagSyncDefault: []string{"update -r revno:-1"}, - - scheme: []string{"https", "http", "bzr", "bzr+ssh"}, - pingCmd: "info {scheme}://{repo}", - remoteRepo: bzrRemoteRepo, - resolveRepo: bzrResolveRepo, -} - -func bzrRemoteRepo(vcsBzr *vcsCmd, rootDir string) (remoteRepo string, err error) { - outb, err := vcsBzr.runOutput(rootDir, "config parent_location") - if err != nil { - return "", err - } - return strings.TrimSpace(string(outb)), nil -} - -func bzrResolveRepo(vcsBzr *vcsCmd, rootDir, remoteRepo string) (realRepo string, err error) { - outb, err := vcsBzr.runOutput(rootDir, "info "+remoteRepo) - if err != nil { - return "", err - } - out := string(outb) - - // Expect: - // ... - // (branch root|repository branch): - // ... - - found := false - for _, prefix := range []string{"\n branch root: ", "\n repository branch: "} { - i := strings.Index(out, prefix) - if i >= 0 { - out = out[i+len(prefix):] - found = true - break - } - } - if !found { - return "", fmt.Errorf("unable to parse output of bzr info") - } - - i := strings.Index(out, "\n") - if i < 0 { - return "", fmt.Errorf("unable to parse output of bzr info") - } - out = out[:i] - return strings.TrimSpace(string(out)), nil -} - -// vcsSvn describes how to use Subversion. -var vcsSvn = &vcsCmd{ - name: "Subversion", - cmd: "svn", - - createCmd: []string{"checkout {repo} {dir}"}, - downloadCmd: []string{"update"}, - - // There is no tag command in subversion. - // The branch information is all in the path names. - - scheme: []string{"https", "http", "svn", "svn+ssh"}, - pingCmd: "info {scheme}://{repo}", - remoteRepo: svnRemoteRepo, -} - -func svnRemoteRepo(vcsSvn *vcsCmd, rootDir string) (remoteRepo string, err error) { - outb, err := vcsSvn.runOutput(rootDir, "info") - if err != nil { - return "", err - } - out := string(outb) - - // Expect: - // ... - // Repository Root: - // ... - - i := strings.Index(out, "\nRepository Root: ") - if i < 0 { - return "", fmt.Errorf("unable to parse output of svn info") - } - out = out[i+len("\nRepository Root: "):] - i = strings.Index(out, "\n") - if i < 0 { - return "", fmt.Errorf("unable to parse output of svn info") - } - out = out[:i] - return strings.TrimSpace(string(out)), nil -} - -func (v *vcsCmd) String() string { - return v.name -} - -// run runs the command line cmd in the given directory. -// keyval is a list of key, value pairs. run expands -// instances of {key} in cmd into value, but only after -// splitting cmd into individual arguments. -// If an error occurs, run prints the command line and the -// command's combined stdout+stderr to standard error. -// Otherwise run discards the command's output. -func (v *vcsCmd) run(dir string, cmd string, keyval ...string) error { - _, err := v.run1(dir, cmd, keyval, true) - return err -} - -// runVerboseOnly is like run but only generates error output to standard error in verbose mode. -func (v *vcsCmd) runVerboseOnly(dir string, cmd string, keyval ...string) error { - _, err := v.run1(dir, cmd, keyval, false) - return err -} - -// runOutput is like run but returns the output of the command. -func (v *vcsCmd) runOutput(dir string, cmd string, keyval ...string) ([]byte, error) { - return v.run1(dir, cmd, keyval, true) -} - -// run1 is the generalized implementation of run and runOutput. -func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) { - m := make(map[string]string) - for i := 0; i < len(keyval); i += 2 { - m[keyval[i]] = keyval[i+1] - } - args := strings.Fields(cmdline) - for i, arg := range args { - args[i] = expand(m, arg) - } - - _, err := exec.LookPath(v.cmd) - if err != nil { - fmt.Fprintf(os.Stderr, - "go: missing %s command. See https://golang.org/s/gogetcmd\n", - v.name) - return nil, err - } - - cmd := exec.Command(v.cmd, args...) - cmd.Dir = dir - cmd.Env = envForDir(cmd.Dir, os.Environ()) - if buildX { - fmt.Printf("cd %s\n", dir) - fmt.Printf("%s %s\n", v.cmd, strings.Join(args, " ")) - } - var buf bytes.Buffer - cmd.Stdout = &buf - cmd.Stderr = &buf - err = cmd.Run() - out := buf.Bytes() - if err != nil { - if verbose || buildV { - fmt.Fprintf(os.Stderr, "# cd %s; %s %s\n", dir, v.cmd, strings.Join(args, " ")) - os.Stderr.Write(out) - } - return out, err - } - return out, nil -} - -// ping pings to determine scheme to use. -func (v *vcsCmd) ping(scheme, repo string) error { - return v.runVerboseOnly(".", v.pingCmd, "scheme", scheme, "repo", repo) -} - -// create creates a new copy of repo in dir. -// The parent of dir must exist; dir must not. -func (v *vcsCmd) create(dir, repo string) error { - for _, cmd := range v.createCmd { - if !go15VendorExperiment && strings.Contains(cmd, "submodule") { - continue - } - if err := v.run(".", cmd, "dir", dir, "repo", repo); err != nil { - return err - } - } - return nil -} - -// download downloads any new changes for the repo in dir. -func (v *vcsCmd) download(dir string) error { - if err := v.fixDetachedHead(dir); err != nil { - return err - } - for _, cmd := range v.downloadCmd { - if !go15VendorExperiment && strings.Contains(cmd, "submodule") { - continue - } - if err := v.run(dir, cmd); err != nil { - return err - } - } - return nil -} - -// fixDetachedHead switches a Git repository in dir from a detached head to the master branch. -// Go versions before 1.2 downloaded Git repositories in an unfortunate way -// that resulted in the working tree state being on a detached head. -// That meant the repository was not usable for normal Git operations. -// Go 1.2 fixed that, but we can't pull into a detached head, so if this is -// a Git repository we check for being on a detached head and switch to the -// real branch, almost always called "master". -// TODO(dsymonds): Consider removing this for Go 1.3. -func (v *vcsCmd) fixDetachedHead(dir string) error { - if v != vcsGit { - return nil - } - - // "git symbolic-ref HEAD" succeeds iff we are not on a detached head. - if err := v.runVerboseOnly(dir, "symbolic-ref HEAD"); err == nil { - // not on a detached head - return nil - } - if buildV { - log.Printf("%s on detached head; repairing", dir) - } - return v.run(dir, "checkout master") -} - -// tags returns the list of available tags for the repo in dir. -func (v *vcsCmd) tags(dir string) ([]string, error) { - var tags []string - for _, tc := range v.tagCmd { - out, err := v.runOutput(dir, tc.cmd) - if err != nil { - return nil, err - } - re := regexp.MustCompile(`(?m-s)` + tc.pattern) - for _, m := range re.FindAllStringSubmatch(string(out), -1) { - tags = append(tags, m[1]) - } - } - return tags, nil -} - -// tagSync syncs the repo in dir to the named tag, -// which either is a tag returned by tags or is v.tagDefault. -func (v *vcsCmd) tagSync(dir, tag string) error { - if v.tagSyncCmd == nil { - return nil - } - if tag != "" { - for _, tc := range v.tagLookupCmd { - out, err := v.runOutput(dir, tc.cmd, "tag", tag) - if err != nil { - return err - } - re := regexp.MustCompile(`(?m-s)` + tc.pattern) - m := re.FindStringSubmatch(string(out)) - if len(m) > 1 { - tag = m[1] - break - } - } - } - - if tag == "" && v.tagSyncDefault != nil { - for _, cmd := range v.tagSyncDefault { - if !go15VendorExperiment && strings.Contains(cmd, "submodule") { - continue - } - if err := v.run(dir, cmd); err != nil { - return err - } - } - return nil - } - - for _, cmd := range v.tagSyncCmd { - if !go15VendorExperiment && strings.Contains(cmd, "submodule") { - continue - } - if err := v.run(dir, cmd, "tag", tag); err != nil { - return err - } - } - return nil -} - -// A vcsPath describes how to convert an import path into a -// version control system and repository name. -type vcsPath struct { - prefix string // prefix this description applies to - re string // pattern for import path - repo string // repository to use (expand with match of re) - vcs string // version control system to use (expand with match of re) - check func(match map[string]string) error // additional checks - ping bool // ping for scheme to use to download repo - - regexp *regexp.Regexp // cached compiled form of re -} - -// vcsForDir inspects dir and its parents to determine the -// version control system and code repository to use. -// On return, root is the import path -// corresponding to the root of the repository -// (thus root is a prefix of importPath). -func vcsForDir(p *Package) (vcs *vcsCmd, root string, err error) { - // Clean and double-check that dir is in (a subdirectory of) srcRoot. - dir := filepath.Clean(p.Dir) - srcRoot := filepath.Clean(p.build.SrcRoot) - if len(dir) <= len(srcRoot) || dir[len(srcRoot)] != filepath.Separator { - return nil, "", fmt.Errorf("directory %q is outside source root %q", dir, srcRoot) - } - - origDir := dir - for len(dir) > len(srcRoot) { - for _, vcs := range vcsList { - if fi, err := os.Stat(filepath.Join(dir, "."+vcs.cmd)); err == nil && fi.IsDir() { - return vcs, dir[len(srcRoot)+1:], nil - } - } - - // Move to parent. - ndir := filepath.Dir(dir) - if len(ndir) >= len(dir) { - // Shouldn't happen, but just in case, stop. - break - } - dir = ndir - } - - return nil, "", fmt.Errorf("directory %q is not using a known version control system", origDir) -} - -// repoRoot represents a version control system, a repo, and a root of -// where to put it on disk. -type repoRoot struct { - vcs *vcsCmd - - // repo is the repository URL, including scheme - repo string - - // root is the import path corresponding to the root of the - // repository - root string -} - -var httpPrefixRE = regexp.MustCompile(`^https?:`) - -// securityMode specifies whether a function should make network -// calls using insecure transports (eg, plain text HTTP). -// The zero value is "secure". -type securityMode int - -const ( - secure securityMode = iota - insecure -) - -// repoRootForImportPath analyzes importPath to determine the -// version control system, and code repository to use. -func repoRootForImportPath(importPath string, security securityMode) (*repoRoot, error) { - rr, err := repoRootFromVCSPaths(importPath, "", security, vcsPaths) - if err == errUnknownSite { - // If there are wildcards, look up the thing before the wildcard, - // hoping it applies to the wildcarded parts too. - // This makes 'go get rsc.io/pdf/...' work in a fresh GOPATH. - lookup := strings.TrimSuffix(importPath, "/...") - if i := strings.Index(lookup, "/.../"); i >= 0 { - lookup = lookup[:i] - } - rr, err = repoRootForImportDynamic(lookup, security) - - // repoRootForImportDynamic returns error detail - // that is irrelevant if the user didn't intend to use a - // dynamic import in the first place. - // Squelch it. - if err != nil { - if buildV { - log.Printf("import %q: %v", importPath, err) - } - err = fmt.Errorf("unrecognized import path %q", importPath) - } - } - if err != nil { - rr1, err1 := repoRootFromVCSPaths(importPath, "", security, vcsPathsAfterDynamic) - if err1 == nil { - rr = rr1 - err = nil - } - } - - if err == nil && strings.Contains(importPath, "...") && strings.Contains(rr.root, "...") { - // Do not allow wildcards in the repo root. - rr = nil - err = fmt.Errorf("cannot expand ... in %q", importPath) - } - return rr, err -} - -var errUnknownSite = errors.New("dynamic lookup required to find mapping") - -// repoRootFromVCSPaths attempts to map importPath to a repoRoot -// using the mappings defined in vcsPaths. -// If scheme is non-empty, that scheme is forced. -func repoRootFromVCSPaths(importPath, scheme string, security securityMode, vcsPaths []*vcsPath) (*repoRoot, error) { - // A common error is to use https://packagepath because that's what - // hg and git require. Diagnose this helpfully. - if loc := httpPrefixRE.FindStringIndex(importPath); loc != nil { - // The importPath has been cleaned, so has only one slash. The pattern - // ignores the slashes; the error message puts them back on the RHS at least. - return nil, fmt.Errorf("%q not allowed in import path", importPath[loc[0]:loc[1]]+"//") - } - for _, srv := range vcsPaths { - if !strings.HasPrefix(importPath, srv.prefix) { - continue - } - m := srv.regexp.FindStringSubmatch(importPath) - if m == nil { - if srv.prefix != "" { - return nil, fmt.Errorf("invalid %s import path %q", srv.prefix, importPath) - } - continue - } - - // Build map of named subexpression matches for expand. - match := map[string]string{ - "prefix": srv.prefix, - "import": importPath, - } - for i, name := range srv.regexp.SubexpNames() { - if name != "" && match[name] == "" { - match[name] = m[i] - } - } - if srv.vcs != "" { - match["vcs"] = expand(match, srv.vcs) - } - if srv.repo != "" { - match["repo"] = expand(match, srv.repo) - } - if srv.check != nil { - if err := srv.check(match); err != nil { - return nil, err - } - } - vcs := vcsByCmd(match["vcs"]) - if vcs == nil { - return nil, fmt.Errorf("unknown version control system %q", match["vcs"]) - } - if srv.ping { - if scheme != "" { - match["repo"] = scheme + "://" + match["repo"] - } else { - for _, scheme := range vcs.scheme { - if security == secure && !isSecureScheme[scheme] { - continue - } - if vcs.ping(scheme, match["repo"]) == nil { - match["repo"] = scheme + "://" + match["repo"] - break - } - } - } - } - rr := &repoRoot{ - vcs: vcs, - repo: match["repo"], - root: match["root"], - } - return rr, nil - } - return nil, errUnknownSite -} - -// repoRootForImportDynamic finds a *repoRoot for a custom domain that's not -// statically known by repoRootForImportPathStatic. -// -// This handles custom import paths like "name.tld/pkg/foo" or just "name.tld". -func repoRootForImportDynamic(importPath string, security securityMode) (*repoRoot, error) { - slash := strings.Index(importPath, "/") - if slash < 0 { - slash = len(importPath) - } - host := importPath[:slash] - if !strings.Contains(host, ".") { - return nil, errors.New("import path does not begin with hostname") - } - urlStr, body, err := httpsOrHTTP(importPath, security) - if err != nil { - msg := "https fetch: %v" - if security == insecure { - msg = "http/" + msg - } - return nil, fmt.Errorf(msg, err) - } - defer body.Close() - imports, err := parseMetaGoImports(body) - if err != nil { - return nil, fmt.Errorf("parsing %s: %v", importPath, err) - } - // Find the matched meta import. - mmi, err := matchGoImport(imports, importPath) - if err != nil { - if err != errNoMatch { - return nil, fmt.Errorf("parse %s: %v", urlStr, err) - } - return nil, fmt.Errorf("parse %s: no go-import meta tags", urlStr) - } - if buildV { - log.Printf("get %q: found meta tag %#v at %s", importPath, mmi, urlStr) - } - // If the import was "uni.edu/bob/project", which said the - // prefix was "uni.edu" and the RepoRoot was "evilroot.com", - // make sure we don't trust Bob and check out evilroot.com to - // "uni.edu" yet (possibly overwriting/preempting another - // non-evil student). Instead, first verify the root and see - // if it matches Bob's claim. - if mmi.Prefix != importPath { - if buildV { - log.Printf("get %q: verifying non-authoritative meta tag", importPath) - } - urlStr0 := urlStr - var imports []metaImport - urlStr, imports, err = metaImportsForPrefix(mmi.Prefix, security) - if err != nil { - return nil, err - } - metaImport2, err := matchGoImport(imports, importPath) - if err != nil || mmi != metaImport2 { - return nil, fmt.Errorf("%s and %s disagree about go-import for %s", urlStr0, urlStr, mmi.Prefix) - } - } - - if !strings.Contains(mmi.RepoRoot, "://") { - return nil, fmt.Errorf("%s: invalid repo root %q; no scheme", urlStr, mmi.RepoRoot) - } - rr := &repoRoot{ - vcs: vcsByCmd(mmi.VCS), - repo: mmi.RepoRoot, - root: mmi.Prefix, - } - if rr.vcs == nil { - return nil, fmt.Errorf("%s: unknown vcs %q", urlStr, mmi.VCS) - } - return rr, nil -} - -var fetchGroup singleflight.Group -var ( - fetchCacheMu sync.Mutex - fetchCache = map[string]fetchResult{} // key is metaImportsForPrefix's importPrefix -) - -// metaImportsForPrefix takes a package's root import path as declared in a tag -// and returns its HTML discovery URL and the parsed metaImport lines -// found on the page. -// -// The importPath is of the form "golang.org/x/tools". -// It is an error if no imports are found. -// urlStr will still be valid if err != nil. -// The returned urlStr will be of the form "https://golang.org/x/tools?go-get=1" -func metaImportsForPrefix(importPrefix string, security securityMode) (urlStr string, imports []metaImport, err error) { - setCache := func(res fetchResult) (fetchResult, error) { - fetchCacheMu.Lock() - defer fetchCacheMu.Unlock() - fetchCache[importPrefix] = res - return res, nil - } - - resi, _, _ := fetchGroup.Do(importPrefix, func() (resi interface{}, err error) { - fetchCacheMu.Lock() - if res, ok := fetchCache[importPrefix]; ok { - fetchCacheMu.Unlock() - return res, nil - } - fetchCacheMu.Unlock() - - urlStr, body, err := httpsOrHTTP(importPrefix, security) - if err != nil { - return setCache(fetchResult{urlStr: urlStr, err: fmt.Errorf("fetch %s: %v", urlStr, err)}) - } - imports, err := parseMetaGoImports(body) - if err != nil { - return setCache(fetchResult{urlStr: urlStr, err: fmt.Errorf("parsing %s: %v", urlStr, err)}) - } - if len(imports) == 0 { - err = fmt.Errorf("fetch %s: no go-import meta tag", urlStr) - } - return setCache(fetchResult{urlStr: urlStr, imports: imports, err: err}) - }) - res := resi.(fetchResult) - return res.urlStr, res.imports, res.err -} - -type fetchResult struct { - urlStr string // e.g. "https://foo.com/x/bar?go-get=1" - imports []metaImport - err error -} - -// metaImport represents the parsed tags from HTML files. -type metaImport struct { - Prefix, VCS, RepoRoot string -} - -// errNoMatch is returned from matchGoImport when there's no applicable match. -var errNoMatch = errors.New("no import match") - -// matchGoImport returns the metaImport from imports matching importPath. -// An error is returned if there are multiple matches. -// errNoMatch is returned if none match. -func matchGoImport(imports []metaImport, importPath string) (_ metaImport, err error) { - match := -1 - for i, im := range imports { - if !strings.HasPrefix(importPath, im.Prefix) { - continue - } - if match != -1 { - err = fmt.Errorf("multiple meta tags match import path %q", importPath) - return - } - match = i - } - if match == -1 { - err = errNoMatch - return - } - return imports[match], nil -} - -// expand rewrites s to replace {k} with match[k] for each key k in match. -func expand(match map[string]string, s string) string { - for k, v := range match { - s = strings.Replace(s, "{"+k+"}", v, -1) - } - return s -} - -// vcsPaths defines the meaning of import paths referring to -// commonly-used VCS hosting sites (github.com/user/dir) -// and import paths referring to a fully-qualified importPath -// containing a VCS type (foo.com/repo.git/dir) -var vcsPaths = []*vcsPath{ - // Google Code - new syntax - { - prefix: "code.google.com/", - re: `^(?Pcode\.google\.com/p/(?P[a-z0-9\-]+)(\.(?P[a-z0-9\-]+))?)(/[A-Za-z0-9_.\-]+)*$`, - repo: "https://{root}", - check: googleCodeVCS, - }, - - // Google Code - old syntax - { - re: `^(?P[a-z0-9_\-.]+)\.googlecode\.com/(git|hg|svn)(?P/.*)?$`, - check: oldGoogleCode, - }, - - // Github - { - prefix: "github.com/", - re: `^(?Pgithub\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`, - vcs: "git", - repo: "https://{root}", - check: noVCSSuffix, - }, - - // Bitbucket - { - prefix: "bitbucket.org/", - re: `^(?Pbitbucket\.org/(?P[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`, - repo: "https://{root}", - check: bitbucketVCS, - }, - - // IBM DevOps Services (JazzHub) - { - prefix: "hub.jazz.net/git", - re: `^(?Phub.jazz.net/git/[a-z0-9]+/[A-Za-z0-9_.\-]+)(/[A-Za-z0-9_.\-]+)*$`, - vcs: "git", - repo: "https://{root}", - check: noVCSSuffix, - }, - - // Git at Apache - { - prefix: "git.apache.org", - re: `^(?Pgit.apache.org/[a-z0-9_.\-]+\.git)(/[A-Za-z0-9_.\-]+)*$`, - vcs: "git", - repo: "https://{root}", - }, - - // General syntax for any server. - // Must be last. - { - re: `^(?P(?P([a-z0-9.\-]+\.)+[a-z0-9.\-]+(:[0-9]+)?/[A-Za-z0-9_.\-/]*?)\.(?Pbzr|git|hg|svn))(/[A-Za-z0-9_.\-]+)*$`, - ping: true, - }, -} - -// vcsPathsAfterDynamic gives additional vcsPaths entries -// to try after the dynamic HTML check. -// This gives those sites a chance to introduce tags -// as part of a graceful transition away from the hard-coded logic. -var vcsPathsAfterDynamic = []*vcsPath{ - // Launchpad. See golang.org/issue/11436. - { - prefix: "launchpad.net/", - re: `^(?Plaunchpad\.net/((?P[A-Za-z0-9_.\-]+)(?P/[A-Za-z0-9_.\-]+)?|~[A-Za-z0-9_.\-]+/(\+junk|[A-Za-z0-9_.\-]+)/[A-Za-z0-9_.\-]+))(/[A-Za-z0-9_.\-]+)*$`, - vcs: "bzr", - repo: "https://{root}", - check: launchpadVCS, - }, -} - -func init() { - // fill in cached regexps. - // Doing this eagerly discovers invalid regexp syntax - // without having to run a command that needs that regexp. - for _, srv := range vcsPaths { - srv.regexp = regexp.MustCompile(srv.re) - } - for _, srv := range vcsPathsAfterDynamic { - srv.regexp = regexp.MustCompile(srv.re) - } -} - -// noVCSSuffix checks that the repository name does not -// end in .foo for any version control system foo. -// The usual culprit is ".git". -func noVCSSuffix(match map[string]string) error { - repo := match["repo"] - for _, vcs := range vcsList { - if strings.HasSuffix(repo, "."+vcs.cmd) { - return fmt.Errorf("invalid version control suffix in %s path", match["prefix"]) - } - } - return nil -} - -var googleCheckout = regexp.MustCompile(`id="checkoutcmd">(hg|git|svn)`) - -// googleCodeVCS determines the version control system for -// a code.google.com repository, by scraping the project's -// /source/checkout page. -func googleCodeVCS(match map[string]string) error { - if err := noVCSSuffix(match); err != nil { - return err - } - data, err := httpGET(expand(match, "https://code.google.com/p/{project}/source/checkout?repo={subrepo}")) - if err != nil { - return err - } - - if m := googleCheckout.FindSubmatch(data); m != nil { - if vcs := vcsByCmd(string(m[1])); vcs != nil { - // Subversion requires the old URLs. - // TODO: Test. - if vcs == vcsSvn { - if match["subrepo"] != "" { - return fmt.Errorf("sub-repositories not supported in Google Code Subversion projects") - } - match["repo"] = expand(match, "https://{project}.googlecode.com/svn") - } - match["vcs"] = vcs.cmd - return nil - } - } - - return fmt.Errorf("unable to detect version control system for code.google.com/ path") -} - -// oldGoogleCode is invoked for old-style foo.googlecode.com paths. -// It prints an error giving the equivalent new path. -func oldGoogleCode(match map[string]string) error { - return fmt.Errorf("invalid Google Code import path: use %s instead", - expand(match, "code.google.com/p/{project}{path}")) -} - -// bitbucketVCS determines the version control system for a -// Bitbucket repository, by using the Bitbucket API. -func bitbucketVCS(match map[string]string) error { - if err := noVCSSuffix(match); err != nil { - return err - } - - var resp struct { - SCM string `json:"scm"` - } - url := expand(match, "https://api.bitbucket.org/1.0/repositories/{bitname}") - data, err := httpGET(url) - if err != nil { - if httpErr, ok := err.(*httpError); ok && httpErr.statusCode == 403 { - // this may be a private repository. If so, attempt to determine which - // VCS it uses. See issue 5375. - root := match["root"] - for _, vcs := range []string{"git", "hg"} { - if vcsByCmd(vcs).ping("https", root) == nil { - resp.SCM = vcs - break - } - } - } - - if resp.SCM == "" { - return err - } - } else { - if err := json.Unmarshal(data, &resp); err != nil { - return fmt.Errorf("decoding %s: %v", url, err) - } - } - - if vcsByCmd(resp.SCM) != nil { - match["vcs"] = resp.SCM - if resp.SCM == "git" { - match["repo"] += ".git" - } - return nil - } - - return fmt.Errorf("unable to detect version control system for bitbucket.org/ path") -} - -// launchpadVCS solves the ambiguity for "lp.net/project/foo". In this case, -// "foo" could be a series name registered in Launchpad with its own branch, -// and it could also be the name of a directory within the main project -// branch one level up. -func launchpadVCS(match map[string]string) error { - if match["project"] == "" || match["series"] == "" { - return nil - } - _, err := httpGET(expand(match, "https://code.launchpad.net/{project}{series}/.bzr/branch-format")) - if err != nil { - match["root"] = expand(match, "launchpad.net/{project}") - match["repo"] = expand(match, "https://{root}") - } - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs_test.go deleted file mode 100644 index f5d5e4f4f0b521a5ccbe99b5039a0ee95965fd7b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/vcs_test.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "internal/testenv" - "testing" -) - -// Test that RepoRootForImportPath creates the correct RepoRoot for a given importPath. -// TODO(cmang): Add tests for SVN and BZR. -func TestRepoRootForImportPath(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tests := []struct { - path string - want *repoRoot - }{ - { - "code.google.com/p/go", - &repoRoot{ - vcs: vcsHg, - repo: "https://code.google.com/p/go", - }, - }, - /*{ - "code.google.com/r/go", - &repoRoot{ - vcs: vcsHg, - repo: "https://code.google.com/r/go", - }, - },*/ - { - "github.com/golang/groupcache", - &repoRoot{ - vcs: vcsGit, - repo: "https://github.com/golang/groupcache", - }, - }, - // IBM DevOps Services tests - { - "hub.jazz.net/git/user1/pkgname", - &repoRoot{ - vcs: vcsGit, - repo: "https://hub.jazz.net/git/user1/pkgname", - }, - }, - { - "hub.jazz.net/git/user1/pkgname/submodule/submodule/submodule", - &repoRoot{ - vcs: vcsGit, - repo: "https://hub.jazz.net/git/user1/pkgname", - }, - }, - { - "hub.jazz.net", - nil, - }, - { - "hub2.jazz.net", - nil, - }, - { - "hub.jazz.net/someotherprefix", - nil, - }, - { - "hub.jazz.net/someotherprefix/user1/pkgname", - nil, - }, - // Spaces are not valid in user names or package names - { - "hub.jazz.net/git/User 1/pkgname", - nil, - }, - { - "hub.jazz.net/git/user1/pkg name", - nil, - }, - // Dots are not valid in user names - { - "hub.jazz.net/git/user.1/pkgname", - nil, - }, - { - "hub.jazz.net/git/user/pkg.name", - &repoRoot{ - vcs: vcsGit, - repo: "https://hub.jazz.net/git/user/pkg.name", - }, - }, - // User names cannot have uppercase letters - { - "hub.jazz.net/git/USER/pkgname", - nil, - }, - // Spaces are not valid in package name - { - "git.apache.org/package name/path/to/lib", - nil, - }, - // Should have ".git" suffix - { - "git.apache.org/package-name/path/to/lib", - nil, - }, - { - "git.apache.org/package-name.git", - &repoRoot{ - vcs: vcsGit, - repo: "https://git.apache.org/package-name.git", - }, - }, - { - "git.apache.org/package-name_2.x.git/path/to/lib", - &repoRoot{ - vcs: vcsGit, - repo: "https://git.apache.org/package-name_2.x.git", - }, - }, - } - - for _, test := range tests { - got, err := repoRootForImportPath(test.path, secure) - want := test.want - - if want == nil { - if err == nil { - t.Errorf("RepoRootForImport(%q): Error expected but not received", test.path) - } - continue - } - if err != nil { - t.Errorf("RepoRootForImport(%q): %v", test.path, err) - continue - } - if got.vcs.name != want.vcs.name || got.repo != want.repo { - t.Errorf("RepoRootForImport(%q) = VCS(%s) Repo(%s), want VCS(%s) Repo(%s)", test.path, got.vcs, got.repo, want.vcs, want.repo) - } - } -} - -func TestIsSecure(t *testing.T) { - tests := []struct { - vcs *vcsCmd - url string - secure bool - }{ - {vcsGit, "http://example.com/foo.git", false}, - {vcsGit, "https://example.com/foo.git", true}, - {vcsBzr, "http://example.com/foo.bzr", false}, - {vcsBzr, "https://example.com/foo.bzr", true}, - {vcsSvn, "http://example.com/svn", false}, - {vcsSvn, "https://example.com/svn", true}, - {vcsHg, "http://example.com/foo.hg", false}, - {vcsHg, "https://example.com/foo.hg", true}, - {vcsGit, "ssh://user@example.com/foo.git", true}, - {vcsGit, "user@server:path/to/repo.git", false}, - {vcsGit, "user@server:", false}, - {vcsGit, "server:repo.git", false}, - {vcsGit, "server:path/to/repo.git", false}, - {vcsGit, "example.com:path/to/repo.git", false}, - {vcsGit, "path/that/contains/a:colon/repo.git", false}, - {vcsHg, "ssh://user@example.com/path/to/repo.hg", true}, - } - - for _, test := range tests { - secure := test.vcs.isSecure(test.url) - if secure != test.secure { - t.Errorf("%s isSecure(%q) = %t; want %t", test.vcs, test.url, secure, test.secure) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/vendor_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/vendor_test.go deleted file mode 100644 index 1e8cf9c8d26d7531fbc5520f5819362c5b21e2a3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/vendor_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Tests for vendoring semantics. - -package main_test - -import ( - "bytes" - "fmt" - "internal/testenv" - "path/filepath" - "regexp" - "strings" - "testing" -) - -func TestVendorImports(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.run("list", "-f", "{{.ImportPath}} {{.Imports}}", "vend/...") - want := ` - vend [vend/vendor/p r] - vend/hello [fmt vend/vendor/strings] - vend/subdir [vend/vendor/p r] - vend/vendor/p [] - vend/vendor/q [] - vend/vendor/strings [] - vend/x [vend/x/vendor/p vend/vendor/q vend/x/vendor/r] - vend/x/invalid [vend/x/invalid/vendor/foo] - vend/x/vendor/p [] - vend/x/vendor/p/p [notfound] - vend/x/vendor/r [] - ` - want = strings.Replace(want+"\t", "\n\t\t", "\n", -1) - want = strings.TrimPrefix(want, "\n") - - have := tg.stdout.String() - - if have != want { - t.Errorf("incorrect go list output:\n%s", diffSortedOutputs(have, want)) - } -} - -func TestVendorRun(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.cd(filepath.Join(tg.pwd(), "testdata/src/vend/hello")) - tg.run("run", "hello.go") - tg.grepStdout("hello, world", "missing hello world output") -} - -func TestVendorGOPATH(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - changeVolume := func(s string, f func(s string) string) string { - vol := filepath.VolumeName(s) - return f(vol) + s[len(vol):] - } - gopath := changeVolume(filepath.Join(tg.pwd(), "testdata"), strings.ToLower) - tg.setenv("GOPATH", gopath) - tg.setenv("GO15VENDOREXPERIMENT", "1") - cd := changeVolume(filepath.Join(tg.pwd(), "testdata/src/vend/hello"), strings.ToUpper) - tg.cd(cd) - tg.run("run", "hello.go") - tg.grepStdout("hello, world", "missing hello world output") -} - -func TestVendorTest(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.cd(filepath.Join(tg.pwd(), "testdata/src/vend/hello")) - tg.run("test", "-v") - tg.grepStdout("TestMsgInternal", "missing use in internal test") - tg.grepStdout("TestMsgExternal", "missing use in external test") -} - -func TestVendorInvalid(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - - tg.runFail("build", "vend/x/invalid") - tg.grepStderr("must be imported as foo", "missing vendor import error") -} - -func TestVendorImportError(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - - tg.runFail("build", "vend/x/vendor/p/p") - - re := regexp.MustCompile(`cannot find package "notfound" in any of: - .*[\\/]testdata[\\/]src[\\/]vend[\\/]x[\\/]vendor[\\/]notfound \(vendor tree\) - .*[\\/]testdata[\\/]src[\\/]vend[\\/]vendor[\\/]notfound \(vendor tree\) - .*[\\/]src[\\/]notfound \(from \$GOROOT\) - .*[\\/]testdata[\\/]src[\\/]notfound \(from \$GOPATH\)`) - - if !re.MatchString(tg.stderr.String()) { - t.Errorf("did not find expected search list in error text") - } -} - -// diffSortedOutput prepares a diff of the already sorted outputs haveText and wantText. -// The diff shows common lines prefixed by a tab, lines present only in haveText -// prefixed by "unexpected: ", and lines present only in wantText prefixed by "missing: ". -func diffSortedOutputs(haveText, wantText string) string { - var diff bytes.Buffer - have := splitLines(haveText) - want := splitLines(wantText) - for len(have) > 0 || len(want) > 0 { - if len(want) == 0 || len(have) > 0 && have[0] < want[0] { - fmt.Fprintf(&diff, "unexpected: %s\n", have[0]) - have = have[1:] - continue - } - if len(have) == 0 || len(want) > 0 && want[0] < have[0] { - fmt.Fprintf(&diff, "missing: %s\n", want[0]) - want = want[1:] - continue - } - fmt.Fprintf(&diff, "\t%s\n", want[0]) - want = want[1:] - have = have[1:] - } - return diff.String() -} - -func splitLines(s string) []string { - x := strings.Split(s, "\n") - if x[len(x)-1] == "" { - x = x[:len(x)-1] - } - return x -} - -func TestVendorGet(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.tempFile("src/v/m.go", ` - package main - import ("fmt"; "vendor.org/p") - func main() { - fmt.Println(p.C) - }`) - tg.tempFile("src/v/m_test.go", ` - package main - import ("fmt"; "testing"; "vendor.org/p") - func TestNothing(t *testing.T) { - fmt.Println(p.C) - }`) - tg.tempFile("src/v/vendor/vendor.org/p/p.go", ` - package p - const C = 1`) - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.cd(tg.path("src/v")) - tg.run("run", "m.go") - tg.run("test") - tg.run("list", "-f", "{{.Imports}}") - tg.grepStdout("v/vendor/vendor.org/p", "import not in vendor directory") - tg.run("list", "-f", "{{.TestImports}}") - tg.grepStdout("v/vendor/vendor.org/p", "test import not in vendor directory") - tg.run("get") - tg.run("get", "-t") -} - -func TestVendorGetUpdate(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.run("get", "github.com/rsc/go-get-issue-11864") - tg.run("get", "-u", "github.com/rsc/go-get-issue-11864") -} - -func TestVendorCache(t *testing.T) { - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/testvendor")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.runFail("build", "p") - tg.grepStderr("must be imported as x", "did not fail to build p") -} - -func TestVendorTest2(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.run("get", "github.com/rsc/go-get-issue-11864") - - // build -i should work - tg.run("build", "-i", "github.com/rsc/go-get-issue-11864") - tg.run("build", "-i", "github.com/rsc/go-get-issue-11864/t") - - // test -i should work like build -i (golang.org/issue/11988) - tg.run("test", "-i", "github.com/rsc/go-get-issue-11864") - tg.run("test", "-i", "github.com/rsc/go-get-issue-11864/t") - - // test should work too - tg.run("test", "github.com/rsc/go-get-issue-11864") - tg.run("test", "github.com/rsc/go-get-issue-11864/t") - - // external tests should observe internal test exports (golang.org/issue/11977) - tg.run("test", "github.com/rsc/go-get-issue-11864/vendor/vendor.org/tx2") -} - -func TestVendorList(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - tg := testgo(t) - defer tg.cleanup() - tg.makeTempdir() - tg.setenv("GOPATH", tg.path(".")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.run("get", "github.com/rsc/go-get-issue-11864") - - tg.run("list", "-f", `{{join .TestImports "\n"}}`, "github.com/rsc/go-get-issue-11864/t") - tg.grepStdout("go-get-issue-11864/vendor/vendor.org/p", "did not find vendor-expanded p") - - tg.run("list", "-f", `{{join .XTestImports "\n"}}`, "github.com/rsc/go-get-issue-11864/tx") - tg.grepStdout("go-get-issue-11864/vendor/vendor.org/p", "did not find vendor-expanded p") - - tg.run("list", "-f", `{{join .XTestImports "\n"}}`, "github.com/rsc/go-get-issue-11864/vendor/vendor.org/tx2") - tg.grepStdout("go-get-issue-11864/vendor/vendor.org/tx2", "did not find vendor-expanded tx2") - - tg.run("list", "-f", `{{join .XTestImports "\n"}}`, "github.com/rsc/go-get-issue-11864/vendor/vendor.org/tx3") - tg.grepStdout("go-get-issue-11864/vendor/vendor.org/tx3", "did not find vendor-expanded tx3") -} - -func TestVendor12156(t *testing.T) { - // Former index out of range panic. - tg := testgo(t) - defer tg.cleanup() - tg.setenv("GOPATH", filepath.Join(tg.pwd(), "testdata/testvendor2")) - tg.setenv("GO15VENDOREXPERIMENT", "1") - tg.cd(filepath.Join(tg.pwd(), "testdata/testvendor2/src/p")) - tg.runFail("build", "p.go") - tg.grepStderrNot("panic", "panicked") - tg.grepStderr(`cannot find package "x"`, "wrong error") -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/version.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/version.go deleted file mode 100644 index a41f4a7361546d1067cf076697f82a68178b30e2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/version.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "runtime" -) - -var cmdVersion = &Command{ - Run: runVersion, - UsageLine: "version", - Short: "print Go version", - Long: `Version prints the Go version, as reported by runtime.Version.`, -} - -func runVersion(cmd *Command, args []string) { - if len(args) != 0 { - cmd.Usage() - } - - fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/go/vet.go b/llgo/third_party/gofrontend/libgo/go/cmd/go/vet.go deleted file mode 100644 index 81b978e8dab2b5213cbe64d79c89bd9f0cccea69..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/go/vet.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "path/filepath" - -func init() { - addBuildFlags(cmdVet) -} - -var cmdVet = &Command{ - Run: runVet, - UsageLine: "vet [-n] [-x] [build flags] [packages]", - Short: "run go tool vet on packages", - Long: ` -Vet runs the Go vet command on the packages named by the import paths. - -For more about vet, see 'go doc cmd/vet'. -For more about specifying packages, see 'go help packages'. - -To run the vet tool with specific options, run 'go tool vet'. - -The -n flag prints commands that would be executed. -The -x flag prints commands as they are executed. - -For more about build flags, see 'go help build'. - -See also: go fmt, go fix. - `, -} - -func runVet(cmd *Command, args []string) { - for _, p := range packages(args) { - // Vet expects to be given a set of files all from the same package. - // Run once for package p and once for package p_test. - if len(p.GoFiles)+len(p.CgoFiles)+len(p.TestGoFiles) > 0 { - runVetFiles(p, stringList(p.GoFiles, p.CgoFiles, p.TestGoFiles, p.SFiles)) - } - if len(p.XTestGoFiles) > 0 { - runVetFiles(p, stringList(p.XTestGoFiles)) - } - } -} - -func runVetFiles(p *Package, files []string) { - for i := range files { - files[i] = filepath.Join(p.Dir, files[i]) - } - run(buildToolExec, tool("vet"), relPaths(files)) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/doc.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/doc.go deleted file mode 100644 index 9d0cd328623cb406c470f10fdea230d5a6fa08f2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/doc.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Gofmt formats Go programs. -It uses tabs (width = 8) for indentation and blanks for alignment. - -Without an explicit path, it processes the standard input. Given a file, -it operates on that file; given a directory, it operates on all .go files in -that directory, recursively. (Files starting with a period are ignored.) -By default, gofmt prints the reformatted sources to standard output. - -Usage: - gofmt [flags] [path ...] - -The flags are: - -d - Do not print reformatted sources to standard output. - If a file's formatting is different than gofmt's, print diffs - to standard output. - -e - Print all (including spurious) errors. - -l - Do not print reformatted sources to standard output. - If a file's formatting is different from gofmt's, print its name - to standard output. - -r rule - Apply the rewrite rule to the source before reformatting. - -s - Try to simplify code (after applying the rewrite rule, if any). - -w - Do not print reformatted sources to standard output. - If a file's formatting is different from gofmt's, overwrite it - with gofmt's version. - -Debugging support: - -cpuprofile filename - Write cpu profile to the specified file. - - -The rewrite rule specified with the -r flag must be a string of the form: - - pattern -> replacement - -Both pattern and replacement must be valid Go expressions. -In the pattern, single-character lowercase identifiers serve as -wildcards matching arbitrary sub-expressions; those expressions -will be substituted for the same identifiers in the replacement. - -When gofmt reads from standard input, it accepts either a full Go program -or a program fragment. A program fragment must be a syntactically -valid declaration list, statement list, or expression. When formatting -such a fragment, gofmt preserves leading indentation as well as leading -and trailing spaces, so that individual sections of a Go program can be -formatted by piping them through gofmt. - -Examples - -To check files for unnecessary parentheses: - - gofmt -r '(a) -> a' -l *.go - -To remove the parentheses: - - gofmt -r '(a) -> a' -w *.go - -To convert the package tree from explicit slice upper bounds to implicit ones: - - gofmt -r 'α[β:len(α)] -> α[β:]' -w $GOROOT/src - -The simplify command - -When invoked with -s gofmt will make the following source transformations where possible. - - An array, slice, or map composite literal of the form: - []T{T{}, T{}} - will be simplified to: - []T{{}, {}} - - A slice expression of the form: - s[a:len(s)] - will be simplified to: - s[a:] - - A range of the form: - for x, _ = range v {...} - will be simplified to: - for x = range v {...} - - A range of the form: - for _ = range v {...} - will be simplified to: - for range v {...} - -This may result in changes that are incompatible with earlier versions of Go. -*/ -package main - -// BUG(rsc): The implementation of -r is a bit slow. diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt.go deleted file mode 100644 index b2805ac05fbcc936c92ccd74d4c79781090bb2b5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/ast" - "go/parser" - "go/printer" - "go/scanner" - "go/token" - "internal/format" - "io" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "runtime/pprof" - "strings" -) - -var ( - // main operation modes - list = flag.Bool("l", false, "list files whose formatting differs from gofmt's") - write = flag.Bool("w", false, "write result to (source) file instead of stdout") - rewriteRule = flag.String("r", "", "rewrite rule (e.g., 'a[b:len(a)] -> a[b:]')") - simplifyAST = flag.Bool("s", false, "simplify code") - doDiff = flag.Bool("d", false, "display diffs instead of rewriting files") - allErrors = flag.Bool("e", false, "report all errors (not just the first 10 on different lines)") - - // debugging - cpuprofile = flag.String("cpuprofile", "", "write cpu profile to this file") -) - -const ( - tabWidth = 8 - printerMode = printer.UseSpaces | printer.TabIndent -) - -var ( - fileSet = token.NewFileSet() // per process FileSet - exitCode = 0 - rewrite func(*ast.File) *ast.File - parserMode parser.Mode -) - -func report(err error) { - scanner.PrintError(os.Stderr, err) - exitCode = 2 -} - -func usage() { - fmt.Fprintf(os.Stderr, "usage: gofmt [flags] [path ...]\n") - flag.PrintDefaults() - os.Exit(2) -} - -func initParserMode() { - parserMode = parser.ParseComments - if *allErrors { - parserMode |= parser.AllErrors - } -} - -func isGoFile(f os.FileInfo) bool { - // ignore non-Go files - name := f.Name() - return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".go") -} - -// If in == nil, the source is the contents of the file with the given filename. -func processFile(filename string, in io.Reader, out io.Writer, stdin bool) error { - if in == nil { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - in = f - } - - src, err := ioutil.ReadAll(in) - if err != nil { - return err - } - - file, sourceAdj, indentAdj, err := format.Parse(fileSet, filename, src, stdin) - if err != nil { - return err - } - - if rewrite != nil { - if sourceAdj == nil { - file = rewrite(file) - } else { - fmt.Fprintf(os.Stderr, "warning: rewrite ignored for incomplete programs\n") - } - } - - ast.SortImports(fileSet, file) - - if *simplifyAST { - simplify(file) - } - - res, err := format.Format(fileSet, file, sourceAdj, indentAdj, src, printer.Config{Mode: printerMode, Tabwidth: tabWidth}) - if err != nil { - return err - } - - if !bytes.Equal(src, res) { - // formatting has changed - if *list { - fmt.Fprintln(out, filename) - } - if *write { - err = ioutil.WriteFile(filename, res, 0644) - if err != nil { - return err - } - } - if *doDiff { - data, err := diff(src, res) - if err != nil { - return fmt.Errorf("computing diff: %s", err) - } - fmt.Printf("diff %s gofmt/%s\n", filename, filename) - out.Write(data) - } - } - - if !*list && !*write && !*doDiff { - _, err = out.Write(res) - } - - return err -} - -func visitFile(path string, f os.FileInfo, err error) error { - if err == nil && isGoFile(f) { - err = processFile(path, nil, os.Stdout, false) - } - if err != nil { - report(err) - } - return nil -} - -func walkDir(path string) { - filepath.Walk(path, visitFile) -} - -func main() { - // call gofmtMain in a separate function - // so that it can use defer and have them - // run before the exit. - gofmtMain() - os.Exit(exitCode) -} - -func gofmtMain() { - flag.Usage = usage - flag.Parse() - - if *cpuprofile != "" { - f, err := os.Create(*cpuprofile) - if err != nil { - fmt.Fprintf(os.Stderr, "creating cpu profile: %s\n", err) - exitCode = 2 - return - } - defer f.Close() - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - } - - initParserMode() - initRewrite() - - if flag.NArg() == 0 { - if *write { - fmt.Fprintln(os.Stderr, "error: cannot use -w with standard input") - exitCode = 2 - return - } - if err := processFile("", os.Stdin, os.Stdout, true); err != nil { - report(err) - } - return - } - - for i := 0; i < flag.NArg(); i++ { - path := flag.Arg(i) - switch dir, err := os.Stat(path); { - case err != nil: - report(err) - case dir.IsDir(): - walkDir(path) - default: - if err := processFile(path, nil, os.Stdout, false); err != nil { - report(err) - } - } - } -} - -func diff(b1, b2 []byte) (data []byte, err error) { - f1, err := ioutil.TempFile("", "gofmt") - if err != nil { - return - } - defer os.Remove(f1.Name()) - defer f1.Close() - - f2, err := ioutil.TempFile("", "gofmt") - if err != nil { - return - } - defer os.Remove(f2.Name()) - defer f2.Close() - - f1.Write(b1) - f2.Write(b2) - - data, err = exec.Command("diff", "-u", f1.Name(), f2.Name()).CombinedOutput() - if len(data) > 0 { - // diff exits with a non-zero status when the files don't match. - // Ignore that failure as long as we get output. - err = nil - } - return - -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt_test.go deleted file mode 100644 index d1edb7bcc16c25fba5cdaa68b287838bd451cfac..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/gofmt_test.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "bytes" - "flag" - "io/ioutil" - "os" - "path/filepath" - "strings" - "testing" - "text/scanner" -) - -var update = flag.Bool("update", false, "update .golden files") - -// gofmtFlags looks for a comment of the form -// -// //gofmt flags -// -// within the first maxLines lines of the given file, -// and returns the flags string, if any. Otherwise it -// returns the empty string. -func gofmtFlags(filename string, maxLines int) string { - f, err := os.Open(filename) - if err != nil { - return "" // ignore errors - they will be found later - } - defer f.Close() - - // initialize scanner - var s scanner.Scanner - s.Init(f) - s.Error = func(*scanner.Scanner, string) {} // ignore errors - s.Mode = scanner.GoTokens &^ scanner.SkipComments // want comments - - // look for //gofmt comment - for s.Line <= maxLines { - switch s.Scan() { - case scanner.Comment: - const prefix = "//gofmt " - if t := s.TokenText(); strings.HasPrefix(t, prefix) { - return strings.TrimSpace(t[len(prefix):]) - } - case scanner.EOF: - return "" - } - - } - - return "" -} - -func runTest(t *testing.T, in, out string) { - // process flags - *simplifyAST = false - *rewriteRule = "" - stdin := false - for _, flag := range strings.Split(gofmtFlags(in, 20), " ") { - elts := strings.SplitN(flag, "=", 2) - name := elts[0] - value := "" - if len(elts) == 2 { - value = elts[1] - } - switch name { - case "": - // no flags - case "-r": - *rewriteRule = value - case "-s": - *simplifyAST = true - case "-stdin": - // fake flag - pretend input is from stdin - stdin = true - default: - t.Errorf("unrecognized flag name: %s", name) - } - } - - initParserMode() - initRewrite() - - var buf bytes.Buffer - err := processFile(in, nil, &buf, stdin) - if err != nil { - t.Error(err) - return - } - - expected, err := ioutil.ReadFile(out) - if err != nil { - t.Error(err) - return - } - - if got := buf.Bytes(); !bytes.Equal(got, expected) { - if *update { - if in != out { - if err := ioutil.WriteFile(out, got, 0666); err != nil { - t.Error(err) - } - return - } - // in == out: don't accidentally destroy input - t.Errorf("WARNING: -update did not rewrite input file %s", in) - } - - t.Errorf("(gofmt %s) != %s (see %s.gofmt)", in, out, in) - d, err := diff(expected, got) - if err == nil { - t.Errorf("%s", d) - } - if err := ioutil.WriteFile(in+".gofmt", got, 0666); err != nil { - t.Error(err) - } - } -} - -// TestRewrite processes testdata/*.input files and compares them to the -// corresponding testdata/*.golden files. The gofmt flags used to process -// a file must be provided via a comment of the form -// -// //gofmt flags -// -// in the processed file within the first 20 lines, if any. -func TestRewrite(t *testing.T) { - // determine input files - match, err := filepath.Glob("testdata/*.input") - if err != nil { - t.Fatal(err) - } - - // add larger examples - match = append(match, "gofmt.go", "gofmt_test.go") - - for _, in := range match { - out := in // for files where input and output are identical - if strings.HasSuffix(in, ".input") { - out = in[:len(in)-len(".input")] + ".golden" - } - runTest(t, in, out) - if in != out { - // Check idempotence. - runTest(t, out, out) - } - } -} - -// Test case for issue 3961. -func TestCRLF(t *testing.T) { - const input = "testdata/crlf.input" // must contain CR/LF's - const golden = "testdata/crlf.golden" // must not contain any CR's - - data, err := ioutil.ReadFile(input) - if err != nil { - t.Error(err) - } - if bytes.Index(data, []byte("\r\n")) < 0 { - t.Errorf("%s contains no CR/LF's", input) - } - - data, err = ioutil.ReadFile(golden) - if err != nil { - t.Error(err) - } - if bytes.Index(data, []byte("\r")) >= 0 { - t.Errorf("%s contains CR's", golden) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/long_test.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/long_test.go deleted file mode 100644 index df9a878df44db12eb844b82451f3afc5dbcd9174..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/long_test.go +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This test applies gofmt to all Go files under -root. -// To test specific files provide a list of comma-separated -// filenames via the -files flag: go test -files=gofmt.go . - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/ast" - "go/printer" - "go/token" - "internal/format" - "io" - "os" - "path/filepath" - "runtime" - "strings" - "testing" -) - -var ( - root = flag.String("root", runtime.GOROOT(), "test root directory") - files = flag.String("files", "", "comma-separated list of files to test") - ngo = flag.Int("n", runtime.NumCPU(), "number of goroutines used") - verbose = flag.Bool("verbose", false, "verbose mode") - nfiles int // number of files processed -) - -func gofmt(fset *token.FileSet, filename string, src *bytes.Buffer) error { - f, _, _, err := format.Parse(fset, filename, src.Bytes(), false) - if err != nil { - return err - } - ast.SortImports(fset, f) - src.Reset() - return (&printer.Config{Mode: printerMode, Tabwidth: tabWidth}).Fprint(src, fset, f) -} - -func testFile(t *testing.T, b1, b2 *bytes.Buffer, filename string) { - // open file - f, err := os.Open(filename) - if err != nil { - t.Error(err) - return - } - - // read file - b1.Reset() - _, err = io.Copy(b1, f) - f.Close() - if err != nil { - t.Error(err) - return - } - - // exclude files w/ syntax errors (typically test cases) - fset := token.NewFileSet() - if _, _, _, err = format.Parse(fset, filename, b1.Bytes(), false); err != nil { - if *verbose { - fmt.Fprintf(os.Stderr, "ignoring %s\n", err) - } - return - } - - // gofmt file - if err = gofmt(fset, filename, b1); err != nil { - t.Errorf("1st gofmt failed: %v", err) - return - } - - // make a copy of the result - b2.Reset() - b2.Write(b1.Bytes()) - - // gofmt result again - if err = gofmt(fset, filename, b2); err != nil { - t.Errorf("2nd gofmt failed: %v", err) - return - } - - // the first and 2nd result should be identical - if !bytes.Equal(b1.Bytes(), b2.Bytes()) { - t.Errorf("gofmt %s not idempotent", filename) - } -} - -func testFiles(t *testing.T, filenames <-chan string, done chan<- int) { - b1 := new(bytes.Buffer) - b2 := new(bytes.Buffer) - for filename := range filenames { - testFile(t, b1, b2, filename) - } - done <- 0 -} - -func genFilenames(t *testing.T, filenames chan<- string) { - defer close(filenames) - - handleFile := func(filename string, fi os.FileInfo, err error) error { - if err != nil { - t.Error(err) - return nil - } - if isGoFile(fi) { - filenames <- filename - nfiles++ - } - return nil - } - - // test Go files provided via -files, if any - if *files != "" { - for _, filename := range strings.Split(*files, ",") { - fi, err := os.Stat(filename) - handleFile(filename, fi, err) - } - return // ignore files under -root - } - - // otherwise, test all Go files under *root - filepath.Walk(*root, handleFile) -} - -func TestAll(t *testing.T) { - if testing.Short() { - return - } - - if *ngo < 1 { - *ngo = 1 // make sure test is run - } - if *verbose { - fmt.Printf("running test using %d goroutines\n", *ngo) - } - - // generate filenames - filenames := make(chan string, 32) - go genFilenames(t, filenames) - - // launch test goroutines - done := make(chan int) - for i := 0; i < *ngo; i++ { - go testFiles(t, filenames, done) - } - - // wait for all test goroutines to complete - for i := 0; i < *ngo; i++ { - <-done - } - - if *verbose { - fmt.Printf("processed %d files\n", nfiles) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/rewrite.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/rewrite.go deleted file mode 100644 index 069f96622caf712a58f9dd7f08d1b3c6e4c0e281..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/rewrite.go +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "go/ast" - "go/parser" - "go/token" - "os" - "reflect" - "strings" - "unicode" - "unicode/utf8" -) - -func initRewrite() { - if *rewriteRule == "" { - rewrite = nil // disable any previous rewrite - return - } - f := strings.Split(*rewriteRule, "->") - if len(f) != 2 { - fmt.Fprintf(os.Stderr, "rewrite rule must be of the form 'pattern -> replacement'\n") - os.Exit(2) - } - pattern := parseExpr(f[0], "pattern") - replace := parseExpr(f[1], "replacement") - rewrite = func(p *ast.File) *ast.File { return rewriteFile(pattern, replace, p) } -} - -// parseExpr parses s as an expression. -// It might make sense to expand this to allow statement patterns, -// but there are problems with preserving formatting and also -// with what a wildcard for a statement looks like. -func parseExpr(s, what string) ast.Expr { - x, err := parser.ParseExpr(s) - if err != nil { - fmt.Fprintf(os.Stderr, "parsing %s %s at %s\n", what, s, err) - os.Exit(2) - } - return x -} - -// Keep this function for debugging. -/* -func dump(msg string, val reflect.Value) { - fmt.Printf("%s:\n", msg) - ast.Print(fileSet, val.Interface()) - fmt.Println() -} -*/ - -// rewriteFile applies the rewrite rule 'pattern -> replace' to an entire file. -func rewriteFile(pattern, replace ast.Expr, p *ast.File) *ast.File { - cmap := ast.NewCommentMap(fileSet, p, p.Comments) - m := make(map[string]reflect.Value) - pat := reflect.ValueOf(pattern) - repl := reflect.ValueOf(replace) - - var rewriteVal func(val reflect.Value) reflect.Value - rewriteVal = func(val reflect.Value) reflect.Value { - // don't bother if val is invalid to start with - if !val.IsValid() { - return reflect.Value{} - } - for k := range m { - delete(m, k) - } - val = apply(rewriteVal, val) - if match(m, pat, val) { - val = subst(m, repl, reflect.ValueOf(val.Interface().(ast.Node).Pos())) - } - return val - } - - r := apply(rewriteVal, reflect.ValueOf(p)).Interface().(*ast.File) - r.Comments = cmap.Filter(r).Comments() // recreate comments list - return r -} - -// set is a wrapper for x.Set(y); it protects the caller from panics if x cannot be changed to y. -func set(x, y reflect.Value) { - // don't bother if x cannot be set or y is invalid - if !x.CanSet() || !y.IsValid() { - return - } - defer func() { - if x := recover(); x != nil { - if s, ok := x.(string); ok && - (strings.Contains(s, "type mismatch") || strings.Contains(s, "not assignable")) { - // x cannot be set to y - ignore this rewrite - return - } - panic(x) - } - }() - x.Set(y) -} - -// Values/types for special cases. -var ( - objectPtrNil = reflect.ValueOf((*ast.Object)(nil)) - scopePtrNil = reflect.ValueOf((*ast.Scope)(nil)) - - identType = reflect.TypeOf((*ast.Ident)(nil)) - objectPtrType = reflect.TypeOf((*ast.Object)(nil)) - positionType = reflect.TypeOf(token.NoPos) - callExprType = reflect.TypeOf((*ast.CallExpr)(nil)) - scopePtrType = reflect.TypeOf((*ast.Scope)(nil)) -) - -// apply replaces each AST field x in val with f(x), returning val. -// To avoid extra conversions, f operates on the reflect.Value form. -func apply(f func(reflect.Value) reflect.Value, val reflect.Value) reflect.Value { - if !val.IsValid() { - return reflect.Value{} - } - - // *ast.Objects introduce cycles and are likely incorrect after - // rewrite; don't follow them but replace with nil instead - if val.Type() == objectPtrType { - return objectPtrNil - } - - // similarly for scopes: they are likely incorrect after a rewrite; - // replace them with nil - if val.Type() == scopePtrType { - return scopePtrNil - } - - switch v := reflect.Indirect(val); v.Kind() { - case reflect.Slice: - for i := 0; i < v.Len(); i++ { - e := v.Index(i) - set(e, f(e)) - } - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - e := v.Field(i) - set(e, f(e)) - } - case reflect.Interface: - e := v.Elem() - set(v, f(e)) - } - return val -} - -func isWildcard(s string) bool { - rune, size := utf8.DecodeRuneInString(s) - return size == len(s) && unicode.IsLower(rune) -} - -// match reports whether pattern matches val, -// recording wildcard submatches in m. -// If m == nil, match checks whether pattern == val. -func match(m map[string]reflect.Value, pattern, val reflect.Value) bool { - // Wildcard matches any expression. If it appears multiple - // times in the pattern, it must match the same expression - // each time. - if m != nil && pattern.IsValid() && pattern.Type() == identType { - name := pattern.Interface().(*ast.Ident).Name - if isWildcard(name) && val.IsValid() { - // wildcards only match valid (non-nil) expressions. - if _, ok := val.Interface().(ast.Expr); ok && !val.IsNil() { - if old, ok := m[name]; ok { - return match(nil, old, val) - } - m[name] = val - return true - } - } - } - - // Otherwise, pattern and val must match recursively. - if !pattern.IsValid() || !val.IsValid() { - return !pattern.IsValid() && !val.IsValid() - } - if pattern.Type() != val.Type() { - return false - } - - // Special cases. - switch pattern.Type() { - case identType: - // For identifiers, only the names need to match - // (and none of the other *ast.Object information). - // This is a common case, handle it all here instead - // of recursing down any further via reflection. - p := pattern.Interface().(*ast.Ident) - v := val.Interface().(*ast.Ident) - return p == nil && v == nil || p != nil && v != nil && p.Name == v.Name - case objectPtrType, positionType: - // object pointers and token positions always match - return true - case callExprType: - // For calls, the Ellipsis fields (token.Position) must - // match since that is how f(x) and f(x...) are different. - // Check them here but fall through for the remaining fields. - p := pattern.Interface().(*ast.CallExpr) - v := val.Interface().(*ast.CallExpr) - if p.Ellipsis.IsValid() != v.Ellipsis.IsValid() { - return false - } - } - - p := reflect.Indirect(pattern) - v := reflect.Indirect(val) - if !p.IsValid() || !v.IsValid() { - return !p.IsValid() && !v.IsValid() - } - - switch p.Kind() { - case reflect.Slice: - if p.Len() != v.Len() { - return false - } - for i := 0; i < p.Len(); i++ { - if !match(m, p.Index(i), v.Index(i)) { - return false - } - } - return true - - case reflect.Struct: - for i := 0; i < p.NumField(); i++ { - if !match(m, p.Field(i), v.Field(i)) { - return false - } - } - return true - - case reflect.Interface: - return match(m, p.Elem(), v.Elem()) - } - - // Handle token integers, etc. - return p.Interface() == v.Interface() -} - -// subst returns a copy of pattern with values from m substituted in place -// of wildcards and pos used as the position of tokens from the pattern. -// if m == nil, subst returns a copy of pattern and doesn't change the line -// number information. -func subst(m map[string]reflect.Value, pattern reflect.Value, pos reflect.Value) reflect.Value { - if !pattern.IsValid() { - return reflect.Value{} - } - - // Wildcard gets replaced with map value. - if m != nil && pattern.Type() == identType { - name := pattern.Interface().(*ast.Ident).Name - if isWildcard(name) { - if old, ok := m[name]; ok { - return subst(nil, old, reflect.Value{}) - } - } - } - - if pos.IsValid() && pattern.Type() == positionType { - // use new position only if old position was valid in the first place - if old := pattern.Interface().(token.Pos); !old.IsValid() { - return pattern - } - return pos - } - - // Otherwise copy. - switch p := pattern; p.Kind() { - case reflect.Slice: - v := reflect.MakeSlice(p.Type(), p.Len(), p.Len()) - for i := 0; i < p.Len(); i++ { - v.Index(i).Set(subst(m, p.Index(i), pos)) - } - return v - - case reflect.Struct: - v := reflect.New(p.Type()).Elem() - for i := 0; i < p.NumField(); i++ { - v.Field(i).Set(subst(m, p.Field(i), pos)) - } - return v - - case reflect.Ptr: - v := reflect.New(p.Type()).Elem() - if elem := p.Elem(); elem.IsValid() { - v.Set(subst(m, elem, pos).Addr()) - } - return v - - case reflect.Interface: - v := reflect.New(p.Type()).Elem() - if elem := p.Elem(); elem.IsValid() { - v.Set(subst(m, elem, pos)) - } - return v - } - - return pattern -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/simplify.go b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/simplify.go deleted file mode 100644 index 69f7bf23c0b2de7b3e7f909ea65fd0fc9bd39b36..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/simplify.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "go/ast" - "go/token" - "reflect" -) - -type simplifier struct { - hasDotImport bool // package file contains: import . "some/import/path" -} - -func (s *simplifier) Visit(node ast.Node) ast.Visitor { - switch n := node.(type) { - case *ast.CompositeLit: - // array, slice, and map composite literals may be simplified - outer := n - var eltType ast.Expr - switch typ := outer.Type.(type) { - case *ast.ArrayType: - eltType = typ.Elt - case *ast.MapType: - eltType = typ.Value - } - - if eltType != nil { - typ := reflect.ValueOf(eltType) - for i, x := range outer.Elts { - px := &outer.Elts[i] - // look at value of indexed/named elements - if t, ok := x.(*ast.KeyValueExpr); ok { - x = t.Value - px = &t.Value - } - ast.Walk(s, x) // simplify x - // if the element is a composite literal and its literal type - // matches the outer literal's element type exactly, the inner - // literal type may be omitted - if inner, ok := x.(*ast.CompositeLit); ok { - if match(nil, typ, reflect.ValueOf(inner.Type)) { - inner.Type = nil - } - } - // if the outer literal's element type is a pointer type *T - // and the element is & of a composite literal of type T, - // the inner &T may be omitted. - if ptr, ok := eltType.(*ast.StarExpr); ok { - if addr, ok := x.(*ast.UnaryExpr); ok && addr.Op == token.AND { - if inner, ok := addr.X.(*ast.CompositeLit); ok { - if match(nil, reflect.ValueOf(ptr.X), reflect.ValueOf(inner.Type)) { - inner.Type = nil // drop T - *px = inner // drop & - } - } - } - } - } - - // node was simplified - stop walk (there are no subnodes to simplify) - return nil - } - - case *ast.SliceExpr: - // a slice expression of the form: s[a:len(s)] - // can be simplified to: s[a:] - // if s is "simple enough" (for now we only accept identifiers) - if n.Max != nil || s.hasDotImport { - // - 3-index slices always require the 2nd and 3rd index - // - if dot imports are present, we cannot be certain that an - // unresolved "len" identifier refers to the predefined len() - break - } - if s, _ := n.X.(*ast.Ident); s != nil && s.Obj != nil { - // the array/slice object is a single, resolved identifier - if call, _ := n.High.(*ast.CallExpr); call != nil && len(call.Args) == 1 && !call.Ellipsis.IsValid() { - // the high expression is a function call with a single argument - if fun, _ := call.Fun.(*ast.Ident); fun != nil && fun.Name == "len" && fun.Obj == nil { - // the function called is "len" and it is not locally defined; and - // because we don't have dot imports, it must be the predefined len() - if arg, _ := call.Args[0].(*ast.Ident); arg != nil && arg.Obj == s.Obj { - // the len argument is the array/slice object - n.High = nil - } - } - } - } - // Note: We could also simplify slice expressions of the form s[0:b] to s[:b] - // but we leave them as is since sometimes we want to be very explicit - // about the lower bound. - // An example where the 0 helps: - // x, y, z := b[0:2], b[2:4], b[4:6] - // An example where it does not: - // x, y := b[:n], b[n:] - - case *ast.RangeStmt: - // - a range of the form: for x, _ = range v {...} - // can be simplified to: for x = range v {...} - // - a range of the form: for _ = range v {...} - // can be simplified to: for range v {...} - if isBlank(n.Value) { - n.Value = nil - } - if isBlank(n.Key) && n.Value == nil { - n.Key = nil - } - } - - return s -} - -func isBlank(x ast.Expr) bool { - ident, ok := x.(*ast.Ident) - return ok && ident.Name == "_" -} - -func simplify(f *ast.File) { - var s simplifier - - // determine if f contains dot imports - for _, imp := range f.Imports { - if imp.Name != nil && imp.Name.Name == "." { - s.hasDotImport = true - break - } - } - - // remove empty declarations such as "const ()", etc - removeEmptyDeclGroups(f) - - ast.Walk(&s, f) -} - -func removeEmptyDeclGroups(f *ast.File) { - i := 0 - for _, d := range f.Decls { - if g, ok := d.(*ast.GenDecl); !ok || !isEmpty(f, g) { - f.Decls[i] = d - i++ - } - } - f.Decls = f.Decls[:i] -} - -func isEmpty(f *ast.File, g *ast.GenDecl) bool { - if g.Doc != nil || g.Specs != nil { - return false - } - - for _, c := range f.Comments { - // if there is a comment in the declaration, it is not considered empty - if g.Pos() <= c.Pos() && c.End() <= g.End() { - return false - } - } - - return true -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.golden deleted file mode 100644 index ad6bcafafa2382a02bd9c83fbc8c7ed61773f318..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.golden +++ /dev/null @@ -1,9 +0,0 @@ -package main - -func main() {} - -// comment here - -func f() {} - -//line foo.go:1 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.input deleted file mode 100644 index ad6bcafafa2382a02bd9c83fbc8c7ed61773f318..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/comments.input +++ /dev/null @@ -1,9 +0,0 @@ -package main - -func main() {} - -// comment here - -func f() {} - -//line foo.go:1 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.golden deleted file mode 100644 index fc9c98e625b4b869250a464fc5fd6b08fc42b613..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.golden +++ /dev/null @@ -1,204 +0,0 @@ -//gofmt -s - -package P - -type T struct { - x, y int -} - -var _ = [42]T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = [...]T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = []T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = []T{ - {}, - 10: {1, 2}, - 20: {3, 4}, -} - -var _ = []struct { - x, y int -}{ - {}, - 10: {1, 2}, - 20: {3, 4}, -} - -var _ = []interface{}{ - T{}, - 10: T{1, 2}, - 20: T{3, 4}, -} - -var _ = [][]int{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = [][]int{ - ([]int{}), - ([]int{1, 2}), - {3, 4}, -} - -var _ = [][][]int{ - {}, - { - {}, - {0, 1, 2, 3}, - {4, 5}, - }, -} - -var _ = map[string]T{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string]struct { - x, y int -}{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string]interface{}{ - "foo": T{}, - "bar": T{1, 2}, - "bal": T{3, 4}, -} - -var _ = map[string][]int{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string][]int{ - "foo": ([]int{}), - "bar": ([]int{1, 2}), - "bal": {3, 4}, -} - -// from exp/4s/data.go -var pieces4 = []Piece{ - {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, - {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, - {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, - {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, -} - -var _ = [42]*T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = [...]*T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = []*T{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = []*T{ - {}, - 10: {1, 2}, - 20: {3, 4}, -} - -var _ = []*struct { - x, y int -}{ - {}, - 10: {1, 2}, - 20: {3, 4}, -} - -var _ = []interface{}{ - &T{}, - 10: &T{1, 2}, - 20: &T{3, 4}, -} - -var _ = []*[]int{ - {}, - {1, 2}, - {3, 4}, -} - -var _ = []*[]int{ - (&[]int{}), - (&[]int{1, 2}), - {3, 4}, -} - -var _ = []*[]*[]int{ - {}, - { - {}, - {0, 1, 2, 3}, - {4, 5}, - }, -} - -var _ = map[string]*T{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string]*struct { - x, y int -}{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string]interface{}{ - "foo": &T{}, - "bar": &T{1, 2}, - "bal": &T{3, 4}, -} - -var _ = map[string]*[]int{ - "foo": {}, - "bar": {1, 2}, - "bal": {3, 4}, -} - -var _ = map[string]*[]int{ - "foo": (&[]int{}), - "bar": (&[]int{1, 2}), - "bal": {3, 4}, -} - -var pieces4 = []*Piece{ - {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, - {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, - {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, - {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.input deleted file mode 100644 index fc7598af99edf1fc729f0e51f459ceda11ca73c0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/composites.input +++ /dev/null @@ -1,204 +0,0 @@ -//gofmt -s - -package P - -type T struct { - x, y int -} - -var _ = [42]T{ - T{}, - T{1, 2}, - T{3, 4}, -} - -var _ = [...]T{ - T{}, - T{1, 2}, - T{3, 4}, -} - -var _ = []T{ - T{}, - T{1, 2}, - T{3, 4}, -} - -var _ = []T{ - T{}, - 10: T{1, 2}, - 20: T{3, 4}, -} - -var _ = []struct { - x, y int -}{ - struct{ x, y int }{}, - 10: struct{ x, y int }{1, 2}, - 20: struct{ x, y int }{3, 4}, -} - -var _ = []interface{}{ - T{}, - 10: T{1, 2}, - 20: T{3, 4}, -} - -var _ = [][]int{ - []int{}, - []int{1, 2}, - []int{3, 4}, -} - -var _ = [][]int{ - ([]int{}), - ([]int{1, 2}), - []int{3, 4}, -} - -var _ = [][][]int{ - [][]int{}, - [][]int{ - []int{}, - []int{0, 1, 2, 3}, - []int{4, 5}, - }, -} - -var _ = map[string]T{ - "foo": T{}, - "bar": T{1, 2}, - "bal": T{3, 4}, -} - -var _ = map[string]struct { - x, y int -}{ - "foo": struct{ x, y int }{}, - "bar": struct{ x, y int }{1, 2}, - "bal": struct{ x, y int }{3, 4}, -} - -var _ = map[string]interface{}{ - "foo": T{}, - "bar": T{1, 2}, - "bal": T{3, 4}, -} - -var _ = map[string][]int{ - "foo": []int{}, - "bar": []int{1, 2}, - "bal": []int{3, 4}, -} - -var _ = map[string][]int{ - "foo": ([]int{}), - "bar": ([]int{1, 2}), - "bal": []int{3, 4}, -} - -// from exp/4s/data.go -var pieces4 = []Piece{ - Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, - Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, - Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, - Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, -} - -var _ = [42]*T{ - &T{}, - &T{1, 2}, - &T{3, 4}, -} - -var _ = [...]*T{ - &T{}, - &T{1, 2}, - &T{3, 4}, -} - -var _ = []*T{ - &T{}, - &T{1, 2}, - &T{3, 4}, -} - -var _ = []*T{ - &T{}, - 10: &T{1, 2}, - 20: &T{3, 4}, -} - -var _ = []*struct { - x, y int -}{ - &struct{ x, y int }{}, - 10: &struct{ x, y int }{1, 2}, - 20: &struct{ x, y int }{3, 4}, -} - -var _ = []interface{}{ - &T{}, - 10: &T{1, 2}, - 20: &T{3, 4}, -} - -var _ = []*[]int{ - &[]int{}, - &[]int{1, 2}, - &[]int{3, 4}, -} - -var _ = []*[]int{ - (&[]int{}), - (&[]int{1, 2}), - &[]int{3, 4}, -} - -var _ = []*[]*[]int{ - &[]*[]int{}, - &[]*[]int{ - &[]int{}, - &[]int{0, 1, 2, 3}, - &[]int{4, 5}, - }, -} - -var _ = map[string]*T{ - "foo": &T{}, - "bar": &T{1, 2}, - "bal": &T{3, 4}, -} - -var _ = map[string]*struct { - x, y int -}{ - "foo": &struct{ x, y int }{}, - "bar": &struct{ x, y int }{1, 2}, - "bal": &struct{ x, y int }{3, 4}, -} - -var _ = map[string]interface{}{ - "foo": &T{}, - "bar": &T{1, 2}, - "bal": &T{3, 4}, -} - -var _ = map[string]*[]int{ - "foo": &[]int{}, - "bar": &[]int{1, 2}, - "bal": &[]int{3, 4}, -} - -var _ = map[string]*[]int{ - "foo": (&[]int{}), - "bar": (&[]int{1, 2}), - "bal": &[]int{3, 4}, -} - -var pieces4 = []*Piece{ - &Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, - &Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, - &Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, - &Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.golden deleted file mode 100644 index 193dbacc727dd786f3ac6604c8d1f0f55ab26376..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.golden +++ /dev/null @@ -1,13 +0,0 @@ -/* - Source containing CR/LF line endings. - The gofmt'ed output must only have LF - line endings. - Test case for issue 3961. -*/ -package main - -func main() { - // line comment - println("hello, world!") // another line comment - println() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.input deleted file mode 100644 index ae7e14dbf1386c7133cc0863acf425ad85f51f63..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/crlf.input +++ /dev/null @@ -1,13 +0,0 @@ -/* - Source containing CR/LF line endings. - The gofmt'ed output must only have LF - line endings. - Test case for issue 3961. -*/ -package main - -func main() { - // line comment - println("hello, world!") // another line comment - println() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.golden deleted file mode 100644 index 51d7be79dfab7aea7bec5c32fd02b6fdefebafec..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.golden +++ /dev/null @@ -1,126 +0,0 @@ -package main - -import ( - "errors" - "fmt" - "io" - "log" - "math" -) - -import ( - "fmt" - - "math" - - "log" - - "errors" - - "io" -) - -import ( - "errors" - "fmt" - "io" - "log" - "math" - - "fmt" - - "math" - - "log" - - "errors" - - "io" -) - -import ( - // a block with comments - "errors" - "fmt" // for Printf - "io" // for Reader - "log" // for Fatal - "math" -) - -import ( - "fmt" // for Printf - - "math" - - "log" // for Fatal - - "errors" - - "io" // for Reader -) - -import ( - // for Printf - "fmt" - - "math" - - // for Fatal - "log" - - "errors" - - // for Reader - "io" -) - -import ( - "errors" - "fmt" // for Printf - "io" // for Reader - "log" // for Fatal - "math" - - "fmt" // for Printf - - "math" - - "log" // for Fatal - - "errors" - - "io" // for Reader -) - -import ( - "fmt" // for Printf - - "errors" - "io" // for Reader - "log" // for Fatal - "math" - - "errors" - "fmt" // for Printf - "io" // for Reader - "log" // for Fatal - "math" -) - -// Test deduping and extended sorting -import ( - a "A" // aA - b "A" // bA1 - b "A" // bA2 - "B" // B - . "B" // .B - _ "B" // _b - "C" - a "D" // aD -) - -import ( - "dedup_by_group" - - "dedup_by_group" -) diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.input deleted file mode 100644 index 9a4b09dbf9108ca8cd642e122a340887dee79b46..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/import.input +++ /dev/null @@ -1,131 +0,0 @@ -package main - -import ( - "fmt" - "math" - "log" - "errors" - "io" -) - -import ( - "fmt" - - "math" - - "log" - - "errors" - - "io" -) - -import ( - "fmt" - "math" - "log" - "errors" - "io" - - "fmt" - - "math" - - "log" - - "errors" - - "io" -) - -import ( - // a block with comments - "fmt" // for Printf - "math" - "log" // for Fatal - "errors" - "io" // for Reader -) - -import ( - "fmt" // for Printf - - "math" - - "log" // for Fatal - - "errors" - - "io" // for Reader -) - -import ( - // for Printf - "fmt" - - "math" - - // for Fatal - "log" - - "errors" - - // for Reader - "io" -) - -import ( - "fmt" // for Printf - "math" - "log" // for Fatal - "errors" - "io" // for Reader - - "fmt" // for Printf - - "math" - - "log" // for Fatal - - "errors" - - "io" // for Reader -) - -import ( - "fmt" // for Printf - - "math" - "log" // for Fatal - "errors" - "io" // for Reader - - "fmt" // for Printf - "math" - "log" // for Fatal - "errors" - "io" // for Reader -) - -// Test deduping and extended sorting -import ( - "B" // B - a "A" // aA - b "A" // bA2 - b "A" // bA1 - . "B" // .B - . "B" - "C" - "C" - "C" - a "D" // aD - "B" - _ "B" // _b -) - -import ( - "dedup_by_group" - "dedup_by_group" - - "dedup_by_group" -) diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.golden deleted file mode 100644 index 95a0b72a0e09926bf1d29adef13eed603c3fca66..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.golden +++ /dev/null @@ -1,9 +0,0 @@ -package P - -func f() { - if x { - y - } else { - z - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.input deleted file mode 100644 index e24eed215d3b868fc8b7bdbb71c543ad69589fed..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/old.input +++ /dev/null @@ -1,8 +0,0 @@ -package P - -func f() { - if x { - y - } else - z -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.golden deleted file mode 100644 index 3ee5373a79094a6b05328b2114d75946cb4c4575..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.golden +++ /dev/null @@ -1,14 +0,0 @@ -//gofmt -r=Foo->Bar - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -type Bar int - -func main() { - var a Bar - println(a) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.input deleted file mode 100644 index a84c8f781659ba5ebd9ae62ac351d680167551cd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite1.input +++ /dev/null @@ -1,14 +0,0 @@ -//gofmt -r=Foo->Bar - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -type Foo int - -func main() { - var a Foo - println(a) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.golden deleted file mode 100644 index f980e035309e1a6958b6bb02458ee055dac98431..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.golden +++ /dev/null @@ -1,12 +0,0 @@ -//gofmt -r=int->bool - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package p - -// Slices have nil Len values in the corresponding ast.ArrayType -// node and reflect.NewValue(slice.Len) is an invalid reflect.Value. -// The rewriter must not crash in that case. Was issue 1696. -func f() []bool {} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.input deleted file mode 100644 index 489be4e07dc80facb5a7ee72a6b8f5c7ba2cf18e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite2.input +++ /dev/null @@ -1,12 +0,0 @@ -//gofmt -r=int->bool - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package p - -// Slices have nil Len values in the corresponding ast.ArrayType -// node and reflect.NewValue(slice.Len) is an invalid reflect.Value. -// The rewriter must not crash in that case. Was issue 1696. -func f() []int {} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.golden deleted file mode 100644 index 261a220c65d7f1988a2ae55fa31af59b32bb6dec..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.golden +++ /dev/null @@ -1,14 +0,0 @@ -//gofmt -r=x->x - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -// Field tags are *ast.BasicLit nodes that are nil when the tag is -// absent. These nil nodes must not be mistaken for expressions, -// the rewriter should not try to dereference them. Was issue 2410. -type Foo struct { - Field int -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.input deleted file mode 100644 index 261a220c65d7f1988a2ae55fa31af59b32bb6dec..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite3.input +++ /dev/null @@ -1,14 +0,0 @@ -//gofmt -r=x->x - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -// Field tags are *ast.BasicLit nodes that are nil when the tag is -// absent. These nil nodes must not be mistaken for expressions, -// the rewriter should not try to dereference them. Was issue 2410. -type Foo struct { - Field int -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.golden deleted file mode 100644 index b05547b4bf08216357c7f7bfc2622916aa976165..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.golden +++ /dev/null @@ -1,76 +0,0 @@ -//gofmt -r=(x)->x - -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of parenthesized expressions (x) -> x -// must not drop parentheses if that would lead to -// wrong association of the operands. -// Was issue 1847. - -package main - -// From example 1 of issue 1847. -func _() { - var t = (&T{1000}).Id() -} - -// From example 2 of issue 1847. -func _() { - fmt.Println((*xpp).a) -} - -// Some more test cases. -func _() { - _ = (-x).f - _ = (*x).f - _ = (&x).f - _ = (!x).f - _ = -x.f - _ = *x.f - _ = &x.f - _ = !x.f - (-x).f() - (*x).f() - (&x).f() - (!x).f() - _ = -x.f() - _ = *x.f() - _ = &x.f() - _ = !x.f() - - _ = (-x).f - _ = (*x).f - _ = (&x).f - _ = (!x).f - _ = -x.f - _ = *x.f - _ = &x.f - _ = !x.f - (-x).f() - (*x).f() - (&x).f() - (!x).f() - _ = -x.f() - _ = *x.f() - _ = &x.f() - _ = !x.f() - - _ = -x.f - _ = *x.f - _ = &x.f - _ = !x.f - _ = -x.f - _ = *x.f - _ = &x.f - _ = !x.f - _ = -x.f() - _ = *x.f() - _ = &x.f() - _ = !x.f() - _ = -x.f() - _ = *x.f() - _ = &x.f() - _ = !x.f() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.input deleted file mode 100644 index 0817099209c0e87ce5c422bd7750c0d01a38b839..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite4.input +++ /dev/null @@ -1,76 +0,0 @@ -//gofmt -r=(x)->x - -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of parenthesized expressions (x) -> x -// must not drop parentheses if that would lead to -// wrong association of the operands. -// Was issue 1847. - -package main - -// From example 1 of issue 1847. -func _() { - var t = (&T{1000}).Id() -} - -// From example 2 of issue 1847. -func _() { - fmt.Println((*xpp).a) -} - -// Some more test cases. -func _() { - _ = (-x).f - _ = (*x).f - _ = (&x).f - _ = (!x).f - _ = (-x.f) - _ = (*x.f) - _ = (&x.f) - _ = (!x.f) - (-x).f() - (*x).f() - (&x).f() - (!x).f() - _ = (-x.f()) - _ = (*x.f()) - _ = (&x.f()) - _ = (!x.f()) - - _ = ((-x)).f - _ = ((*x)).f - _ = ((&x)).f - _ = ((!x)).f - _ = ((-x.f)) - _ = ((*x.f)) - _ = ((&x.f)) - _ = ((!x.f)) - ((-x)).f() - ((*x)).f() - ((&x)).f() - ((!x)).f() - _ = ((-x.f())) - _ = ((*x.f())) - _ = ((&x.f())) - _ = ((!x.f())) - - _ = -(x).f - _ = *(x).f - _ = &(x).f - _ = !(x).f - _ = -x.f - _ = *x.f - _ = &x.f - _ = !x.f - _ = -(x).f() - _ = *(x).f() - _ = &(x).f() - _ = !(x).f() - _ = -x.f() - _ = *x.f() - _ = &x.f() - _ = !x.f() -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.golden deleted file mode 100644 index 9beb34aee76d13da7fafce9f32006f4c16b9092a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.golden +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=x+x->2*x - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of expressions containing nodes with associated comments to -// expressions without those nodes must also eliminate the associated -// comments. - -package p - -func f(x int) int { - _ = 2 * x // this comment remains in the rewrite - _ = 2 * x - return 2 * x -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.input deleted file mode 100644 index d7a6122d07a7a99c20e3ce7e0f57d27b054d2bcc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite5.input +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=x+x->2*x - -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of expressions containing nodes with associated comments to -// expressions without those nodes must also eliminate the associated -// comments. - -package p - -func f(x int) int { - _ = x + x // this comment remains in the rewrite - _ = x /* this comment must not be in the rewrite */ + x - return x /* this comment must not be in the rewrite */ + x -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.golden deleted file mode 100644 index 48ec9aa0df7780e1dea1567071240fee46d1b2f9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.golden +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=fun(x)->Fun(x) - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of calls must take the ... (ellipsis) -// attribute for the last argument into account. - -package p - -func fun(x []int) {} - -func g(x []int) { - Fun(x) // -r='fun(x)->Fun(x)' should rewrite this to Fun(x) - fun(x...) // -r='fun(x)->Fun(x)' should not rewrite this -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.input deleted file mode 100644 index b085a84fef4a878b41bdd90716dce23acb90ecb9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite6.input +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=fun(x)->Fun(x) - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of calls must take the ... (ellipsis) -// attribute for the last argument into account. - -package p - -func fun(x []int) {} - -func g(x []int) { - fun(x) // -r='fun(x)->Fun(x)' should rewrite this to Fun(x) - fun(x...) // -r='fun(x)->Fun(x)' should not rewrite this -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.golden deleted file mode 100644 index 8386a0b2a3eb791bd1bb5a68d4277ea75b660441..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.golden +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=fun(x...)->Fun(x) - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of calls must take the ... (ellipsis) -// attribute for the last argument into account. - -package p - -func fun(x []int) {} - -func g(x []int) { - fun(x) // -r='fun(x...)->Fun(x)' should not rewrite this - Fun(x) // -r='fun(x...)->Fun(x)' should rewrite this to Fun(x) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.input deleted file mode 100644 index c1984708e71b34b96a1e78292ba8cca8ce1280f5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite7.input +++ /dev/null @@ -1,17 +0,0 @@ -//gofmt -r=fun(x...)->Fun(x) - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Rewriting of calls must take the ... (ellipsis) -// attribute for the last argument into account. - -package p - -func fun(x []int) {} - -func g(x []int) { - fun(x) // -r='fun(x...)->Fun(x)' should not rewrite this - fun(x...) // -r='fun(x...)->Fun(x)' should rewrite this to Fun(x) -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.golden deleted file mode 100644 index 62f0419dfb460297d64aef8850d228c507f411f9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.golden +++ /dev/null @@ -1,12 +0,0 @@ -//gofmt -r=interface{}->int - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Check that literal type expression rewrites are accepted. -// Was issue 4406. - -package p - -type T int diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.input deleted file mode 100644 index 7964c5c75c78fb0551487b8ae637353081990851..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/rewrite8.input +++ /dev/null @@ -1,12 +0,0 @@ -//gofmt -r=interface{}->int - -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Check that literal type expression rewrites are accepted. -// Was issue 4406. - -package p - -type T interface{} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.golden deleted file mode 100644 index 04bc16f2160b62e330346aa424afc395b4be200a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.golden +++ /dev/null @@ -1,66 +0,0 @@ -//gofmt -s - -// Test cases for slice expression simplification. -package p - -var ( - a [10]byte - b [20]float32 - s []int - t struct { - s []byte - } - - _ = a[0:] - _ = a[1:10] - _ = a[2:] - _ = a[3:(len(a))] - _ = a[len(a) : len(a)-1] - _ = a[0:len(b)] - _ = a[2:len(a):len(a)] - - _ = a[:] - _ = a[:10] - _ = a[:] - _ = a[:(len(a))] - _ = a[:len(a)-1] - _ = a[:len(b)] - _ = a[:len(a):len(a)] - - _ = s[0:] - _ = s[1:10] - _ = s[2:] - _ = s[3:(len(s))] - _ = s[len(a) : len(s)-1] - _ = s[0:len(b)] - _ = s[2:len(s):len(s)] - - _ = s[:] - _ = s[:10] - _ = s[:] - _ = s[:(len(s))] - _ = s[:len(s)-1] - _ = s[:len(b)] - _ = s[:len(s):len(s)] - - _ = t.s[0:] - _ = t.s[1:10] - _ = t.s[2:len(t.s)] - _ = t.s[3:(len(t.s))] - _ = t.s[len(a) : len(t.s)-1] - _ = t.s[0:len(b)] - _ = t.s[2:len(t.s):len(t.s)] - - _ = t.s[:] - _ = t.s[:10] - _ = t.s[:len(t.s)] - _ = t.s[:(len(t.s))] - _ = t.s[:len(t.s)-1] - _ = t.s[:len(b)] - _ = t.s[:len(t.s):len(t.s)] -) - -func _() { - s := s[0:] - _ = s -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.input deleted file mode 100644 index 1f25c43ccbc825ba1a89cee7e0362c43c4eba257..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices1.input +++ /dev/null @@ -1,66 +0,0 @@ -//gofmt -s - -// Test cases for slice expression simplification. -package p - -var ( - a [10]byte - b [20]float32 - s []int - t struct { - s []byte - } - - _ = a[0:] - _ = a[1:10] - _ = a[2:len(a)] - _ = a[3:(len(a))] - _ = a[len(a) : len(a)-1] - _ = a[0:len(b)] - _ = a[2:len(a):len(a)] - - _ = a[:] - _ = a[:10] - _ = a[:len(a)] - _ = a[:(len(a))] - _ = a[:len(a)-1] - _ = a[:len(b)] - _ = a[:len(a):len(a)] - - _ = s[0:] - _ = s[1:10] - _ = s[2:len(s)] - _ = s[3:(len(s))] - _ = s[len(a) : len(s)-1] - _ = s[0:len(b)] - _ = s[2:len(s):len(s)] - - _ = s[:] - _ = s[:10] - _ = s[:len(s)] - _ = s[:(len(s))] - _ = s[:len(s)-1] - _ = s[:len(b)] - _ = s[:len(s):len(s)] - - _ = t.s[0:] - _ = t.s[1:10] - _ = t.s[2:len(t.s)] - _ = t.s[3:(len(t.s))] - _ = t.s[len(a) : len(t.s)-1] - _ = t.s[0:len(b)] - _ = t.s[2:len(t.s):len(t.s)] - - _ = t.s[:] - _ = t.s[:10] - _ = t.s[:len(t.s)] - _ = t.s[:(len(t.s))] - _ = t.s[:len(t.s)-1] - _ = t.s[:len(b)] - _ = t.s[:len(t.s):len(t.s)] -) - -func _() { - s := s[0:len(s)] - _ = s -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.golden deleted file mode 100644 index ab657004e64accaae1c2b1258e3b795fef78bcf0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.golden +++ /dev/null @@ -1,63 +0,0 @@ -//gofmt -s - -// Test cases for slice expression simplification. -// Because of a dot import, these slices must remain untouched. -package p - -import . "math" - -var ( - a [10]byte - b [20]float32 - s []int - t struct { - s []byte - } - - _ = a[0:] - _ = a[1:10] - _ = a[2:len(a)] - _ = a[3:(len(a))] - _ = a[len(a) : len(a)-1] - _ = a[0:len(b)] - - _ = a[:] - _ = a[:10] - _ = a[:len(a)] - _ = a[:(len(a))] - _ = a[:len(a)-1] - _ = a[:len(b)] - - _ = s[0:] - _ = s[1:10] - _ = s[2:len(s)] - _ = s[3:(len(s))] - _ = s[len(a) : len(s)-1] - _ = s[0:len(b)] - - _ = s[:] - _ = s[:10] - _ = s[:len(s)] - _ = s[:(len(s))] - _ = s[:len(s)-1] - _ = s[:len(b)] - - _ = t.s[0:] - _ = t.s[1:10] - _ = t.s[2:len(t.s)] - _ = t.s[3:(len(t.s))] - _ = t.s[len(a) : len(t.s)-1] - _ = t.s[0:len(b)] - - _ = t.s[:] - _ = t.s[:10] - _ = t.s[:len(t.s)] - _ = t.s[:(len(t.s))] - _ = t.s[:len(t.s)-1] - _ = t.s[:len(b)] -) - -func _() { - s := s[0:len(s)] - _ = s -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.input deleted file mode 100644 index ab657004e64accaae1c2b1258e3b795fef78bcf0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/slices2.input +++ /dev/null @@ -1,63 +0,0 @@ -//gofmt -s - -// Test cases for slice expression simplification. -// Because of a dot import, these slices must remain untouched. -package p - -import . "math" - -var ( - a [10]byte - b [20]float32 - s []int - t struct { - s []byte - } - - _ = a[0:] - _ = a[1:10] - _ = a[2:len(a)] - _ = a[3:(len(a))] - _ = a[len(a) : len(a)-1] - _ = a[0:len(b)] - - _ = a[:] - _ = a[:10] - _ = a[:len(a)] - _ = a[:(len(a))] - _ = a[:len(a)-1] - _ = a[:len(b)] - - _ = s[0:] - _ = s[1:10] - _ = s[2:len(s)] - _ = s[3:(len(s))] - _ = s[len(a) : len(s)-1] - _ = s[0:len(b)] - - _ = s[:] - _ = s[:10] - _ = s[:len(s)] - _ = s[:(len(s))] - _ = s[:len(s)-1] - _ = s[:len(b)] - - _ = t.s[0:] - _ = t.s[1:10] - _ = t.s[2:len(t.s)] - _ = t.s[3:(len(t.s))] - _ = t.s[len(a) : len(t.s)-1] - _ = t.s[0:len(b)] - - _ = t.s[:] - _ = t.s[:10] - _ = t.s[:len(t.s)] - _ = t.s[:(len(t.s))] - _ = t.s[:len(t.s)-1] - _ = t.s[:len(b)] -) - -func _() { - s := s[0:len(s)] - _ = s -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.golden deleted file mode 100644 index 9e4dcd20fe0d563ed51b2bac27567fbc7f5ee63c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.golden +++ /dev/null @@ -1,5 +0,0 @@ - //gofmt -stdin - - if x { - y - } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.input deleted file mode 100644 index 9e4dcd20fe0d563ed51b2bac27567fbc7f5ee63c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin1.input +++ /dev/null @@ -1,5 +0,0 @@ - //gofmt -stdin - - if x { - y - } diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.golden deleted file mode 100644 index 57df35540358c1c15f8cb3dfbdc292ae7d59c225..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.golden +++ /dev/null @@ -1,11 +0,0 @@ -//gofmt -stdin - -var x int - -func f() { - y := z - /* this is a comment */ - // this is a comment too -} - - diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.input deleted file mode 100644 index 69d6bdd682efe8f90e157ef1f93f549c7cc7b4a4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin2.input +++ /dev/null @@ -1,11 +0,0 @@ -//gofmt -stdin - -var x int - - -func f() { y := z - /* this is a comment */ - // this is a comment too -} - - diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.golden deleted file mode 100644 index d6da0e417a06ce11d31cab2bea97606987ee3288..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.golden +++ /dev/null @@ -1,7 +0,0 @@ - //gofmt -stdin - - /* note: no newline at end of file */ - for i := 0; i < 10; i++ { - s += i - } - \ No newline at end of file diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.input deleted file mode 100644 index ab46c1063beba078cd8a18c4fd2beb64186e9d0a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin3.input +++ /dev/null @@ -1,5 +0,0 @@ - //gofmt -stdin - - /* note: no newline at end of file */ - for i := 0; i < 10; i++ { s += i } - \ No newline at end of file diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.golden deleted file mode 100644 index 0c7acace5d0fa8c557e988699f92311ad74aa659..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.golden +++ /dev/null @@ -1,5 +0,0 @@ - //gofmt -stdin - - // comment - - i := 0 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.input deleted file mode 100644 index 1fc73f31e5e68aadf77ed9a334655e98754812bf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/stdin4.input +++ /dev/null @@ -1,5 +0,0 @@ - //gofmt -stdin - - // comment - - i := 0 diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.golden b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.golden deleted file mode 100644 index 2b1905edd3b4fc1c965cbe800ddc3db7a049772e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.golden +++ /dev/null @@ -1,60 +0,0 @@ -/* - Parenthesized type switch expressions originally - accepted by gofmt must continue to be rewritten - into the correct unparenthesized form. - - Only type-switches that didn't declare a variable - in the type switch type assertion and which - contained only "expression-like" (named) types in their - cases were permitted to have their type assertion parenthesized - by go/parser (due to a weak predicate in the parser). All others - were rejected always, either with a syntax error in the - type switch header or in the case. - - See also issue 4470. -*/ -package p - -func f() { - var x interface{} - switch x.(type) { // should remain the same - } - switch x.(type) { // should become: switch x.(type) { - } - - switch x.(type) { // should remain the same - case int: - } - switch x.(type) { // should become: switch x.(type) { - case int: - } - - switch x.(type) { // should remain the same - case []int: - } - - // Parenthesized (x.(type)) in type switches containing cases - // with unnamed (literal) types were never permitted by gofmt; - // thus there won't be any code in the wild using this style if - // the code was gofmt-ed. - /* - switch (x.(type)) { - case []int: - } - */ - - switch t := x.(type) { // should remain the same - default: - _ = t - } - - // Parenthesized (x.(type)) in type switches declaring a variable - // were never permitted by gofmt; thus there won't be any code in - // the wild using this style if the code was gofmt-ed. - /* - switch t := (x.(type)) { - default: - _ = t - } - */ -} diff --git a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.input b/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.input deleted file mode 100644 index 8f8cba9b855abd4f0893422de34a91d9183b2f6c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/cmd/gofmt/testdata/typeswitch.input +++ /dev/null @@ -1,60 +0,0 @@ -/* - Parenthesized type switch expressions originally - accepted by gofmt must continue to be rewritten - into the correct unparenthesized form. - - Only type-switches that didn't declare a variable - in the type switch type assertion and which - contained only "expression-like" (named) types in their - cases were permitted to have their type assertion parenthesized - by go/parser (due to a weak predicate in the parser). All others - were rejected always, either with a syntax error in the - type switch header or in the case. - - See also issue 4470. -*/ -package p - -func f() { - var x interface{} - switch x.(type) { // should remain the same - } - switch (x.(type)) { // should become: switch x.(type) { - } - - switch x.(type) { // should remain the same - case int: - } - switch (x.(type)) { // should become: switch x.(type) { - case int: - } - - switch x.(type) { // should remain the same - case []int: - } - - // Parenthesized (x.(type)) in type switches containing cases - // with unnamed (literal) types were never permitted by gofmt; - // thus there won't be any code in the wild using this style if - // the code was gofmt-ed. - /* - switch (x.(type)) { - case []int: - } - */ - - switch t := x.(type) { // should remain the same - default: - _ = t - } - - // Parenthesized (x.(type)) in type switches declaring a variable - // were never permitted by gofmt; thus there won't be any code in - // the wild using this style if the code was gofmt-ed. - /* - switch t := (x.(type)) { - default: - _ = t - } - */ -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bit_reader.go b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bit_reader.go deleted file mode 100644 index 32d1036ae1b759df5f4094e5641867e1b8555038..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bit_reader.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bzip2 - -import ( - "bufio" - "io" -) - -// bitReader wraps an io.Reader and provides the ability to read values, -// bit-by-bit, from it. Its Read* methods don't return the usual error -// because the error handling was verbose. Instead, any error is kept and can -// be checked afterwards. -type bitReader struct { - r io.ByteReader - n uint64 - bits uint - err error -} - -// newBitReader returns a new bitReader reading from r. If r is not -// already an io.ByteReader, it will be converted via a bufio.Reader. -func newBitReader(r io.Reader) bitReader { - byter, ok := r.(io.ByteReader) - if !ok { - byter = bufio.NewReader(r) - } - return bitReader{r: byter} -} - -// ReadBits64 reads the given number of bits and returns them in the -// least-significant part of a uint64. In the event of an error, it returns 0 -// and the error can be obtained by calling Err(). -func (br *bitReader) ReadBits64(bits uint) (n uint64) { - for bits > br.bits { - b, err := br.r.ReadByte() - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - if err != nil { - br.err = err - return 0 - } - br.n <<= 8 - br.n |= uint64(b) - br.bits += 8 - } - - // br.n looks like this (assuming that br.bits = 14 and bits = 6): - // Bit: 111111 - // 5432109876543210 - // - // (6 bits, the desired output) - // |-----| - // V V - // 0101101101001110 - // ^ ^ - // |------------| - // br.bits (num valid bits) - // - // This the next line right shifts the desired bits into the - // least-significant places and masks off anything above. - n = (br.n >> (br.bits - bits)) & ((1 << bits) - 1) - br.bits -= bits - return -} - -func (br *bitReader) ReadBits(bits uint) (n int) { - n64 := br.ReadBits64(bits) - return int(n64) -} - -func (br *bitReader) ReadBit() bool { - n := br.ReadBits(1) - return n != 0 -} - -func (br *bitReader) TryReadBit() (bit byte, ok bool) { - if br.bits > 0 { - br.bits-- - return byte(br.n>>br.bits) & 1, true - } - return 0, false -} - -func (br *bitReader) Err() error { - return br.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2.go b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2.go deleted file mode 100644 index 689795727089d9b16b1e740f9ef1b390a11cd1ac..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2.go +++ /dev/null @@ -1,503 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package bzip2 implements bzip2 decompression. -package bzip2 - -import "io" - -// There's no RFC for bzip2. I used the Wikipedia page for reference and a lot -// of guessing: http://en.wikipedia.org/wiki/Bzip2 -// The source code to pyflate was useful for debugging: -// http://www.paul.sladen.org/projects/pyflate - -// A StructuralError is returned when the bzip2 data is found to be -// syntactically invalid. -type StructuralError string - -func (s StructuralError) Error() string { - return "bzip2 data invalid: " + string(s) -} - -// A reader decompresses bzip2 compressed data. -type reader struct { - br bitReader - fileCRC uint32 - blockCRC uint32 - wantBlockCRC uint32 - setupDone bool // true if we have parsed the bzip2 header. - blockSize int // blockSize in bytes, i.e. 900 * 1024. - eof bool - buf []byte // stores Burrows-Wheeler transformed data. - c [256]uint // the `C' array for the inverse BWT. - tt []uint32 // mirrors the `tt' array in the bzip2 source and contains the P array in the upper 24 bits. - tPos uint32 // Index of the next output byte in tt. - - preRLE []uint32 // contains the RLE data still to be processed. - preRLEUsed int // number of entries of preRLE used. - lastByte int // the last byte value seen. - byteRepeats uint // the number of repeats of lastByte seen. - repeats uint // the number of copies of lastByte to output. -} - -// NewReader returns an io.Reader which decompresses bzip2 data from r. -// If r does not also implement io.ByteReader, -// the decompressor may read more data than necessary from r. -func NewReader(r io.Reader) io.Reader { - bz2 := new(reader) - bz2.br = newBitReader(r) - return bz2 -} - -const bzip2FileMagic = 0x425a // "BZ" -const bzip2BlockMagic = 0x314159265359 -const bzip2FinalMagic = 0x177245385090 - -// setup parses the bzip2 header. -func (bz2 *reader) setup(needMagic bool) error { - br := &bz2.br - - if needMagic { - magic := br.ReadBits(16) - if magic != bzip2FileMagic { - return StructuralError("bad magic value") - } - } - - t := br.ReadBits(8) - if t != 'h' { - return StructuralError("non-Huffman entropy encoding") - } - - level := br.ReadBits(8) - if level < '1' || level > '9' { - return StructuralError("invalid compression level") - } - - bz2.fileCRC = 0 - bz2.blockSize = 100 * 1024 * (int(level) - '0') - if bz2.blockSize > len(bz2.tt) { - bz2.tt = make([]uint32, bz2.blockSize) - } - return nil -} - -func (bz2 *reader) Read(buf []byte) (n int, err error) { - if bz2.eof { - return 0, io.EOF - } - - if !bz2.setupDone { - err = bz2.setup(true) - brErr := bz2.br.Err() - if brErr != nil { - err = brErr - } - if err != nil { - return 0, err - } - bz2.setupDone = true - } - - n, err = bz2.read(buf) - brErr := bz2.br.Err() - if brErr != nil { - err = brErr - } - return -} - -func (bz2 *reader) readFromBlock(buf []byte) int { - // bzip2 is a block based compressor, except that it has a run-length - // preprocessing step. The block based nature means that we can - // preallocate fixed-size buffers and reuse them. However, the RLE - // preprocessing would require allocating huge buffers to store the - // maximum expansion. Thus we process blocks all at once, except for - // the RLE which we decompress as required. - n := 0 - for (bz2.repeats > 0 || bz2.preRLEUsed < len(bz2.preRLE)) && n < len(buf) { - // We have RLE data pending. - - // The run-length encoding works like this: - // Any sequence of four equal bytes is followed by a length - // byte which contains the number of repeats of that byte to - // include. (The number of repeats can be zero.) Because we are - // decompressing on-demand our state is kept in the reader - // object. - - if bz2.repeats > 0 { - buf[n] = byte(bz2.lastByte) - n++ - bz2.repeats-- - if bz2.repeats == 0 { - bz2.lastByte = -1 - } - continue - } - - bz2.tPos = bz2.preRLE[bz2.tPos] - b := byte(bz2.tPos) - bz2.tPos >>= 8 - bz2.preRLEUsed++ - - if bz2.byteRepeats == 3 { - bz2.repeats = uint(b) - bz2.byteRepeats = 0 - continue - } - - if bz2.lastByte == int(b) { - bz2.byteRepeats++ - } else { - bz2.byteRepeats = 0 - } - bz2.lastByte = int(b) - - buf[n] = b - n++ - } - - return n -} - -func (bz2 *reader) read(buf []byte) (int, error) { - for { - n := bz2.readFromBlock(buf) - if n > 0 { - bz2.blockCRC = updateCRC(bz2.blockCRC, buf[:n]) - return n, nil - } - - // End of block. Check CRC. - if bz2.blockCRC != bz2.wantBlockCRC { - bz2.br.err = StructuralError("block checksum mismatch") - return 0, bz2.br.err - } - - // Find next block. - br := &bz2.br - switch br.ReadBits64(48) { - default: - return 0, StructuralError("bad magic value found") - - case bzip2BlockMagic: - // Start of block. - err := bz2.readBlock() - if err != nil { - return 0, err - } - - case bzip2FinalMagic: - // Check end-of-file CRC. - wantFileCRC := uint32(br.ReadBits64(32)) - if br.err != nil { - return 0, br.err - } - if bz2.fileCRC != wantFileCRC { - br.err = StructuralError("file checksum mismatch") - return 0, br.err - } - - // Skip ahead to byte boundary. - // Is there a file concatenated to this one? - // It would start with BZ. - if br.bits%8 != 0 { - br.ReadBits(br.bits % 8) - } - b, err := br.r.ReadByte() - if err == io.EOF { - br.err = io.EOF - bz2.eof = true - return 0, io.EOF - } - if err != nil { - br.err = err - return 0, err - } - z, err := br.r.ReadByte() - if err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - br.err = err - return 0, err - } - if b != 'B' || z != 'Z' { - return 0, StructuralError("bad magic value in continuation file") - } - if err := bz2.setup(false); err != nil { - return 0, err - } - } - } -} - -// readBlock reads a bzip2 block. The magic number should already have been consumed. -func (bz2 *reader) readBlock() (err error) { - br := &bz2.br - bz2.wantBlockCRC = uint32(br.ReadBits64(32)) // skip checksum. TODO: check it if we can figure out what it is. - bz2.blockCRC = 0 - bz2.fileCRC = (bz2.fileCRC<<1 | bz2.fileCRC>>31) ^ bz2.wantBlockCRC - randomized := br.ReadBits(1) - if randomized != 0 { - return StructuralError("deprecated randomized files") - } - origPtr := uint(br.ReadBits(24)) - - // If not every byte value is used in the block (i.e., it's text) then - // the symbol set is reduced. The symbols used are stored as a - // two-level, 16x16 bitmap. - symbolRangeUsedBitmap := br.ReadBits(16) - symbolPresent := make([]bool, 256) - numSymbols := 0 - for symRange := uint(0); symRange < 16; symRange++ { - if symbolRangeUsedBitmap&(1<<(15-symRange)) != 0 { - bits := br.ReadBits(16) - for symbol := uint(0); symbol < 16; symbol++ { - if bits&(1<<(15-symbol)) != 0 { - symbolPresent[16*symRange+symbol] = true - numSymbols++ - } - } - } - } - - if numSymbols == 0 { - // There must be an EOF symbol. - return StructuralError("no symbols in input") - } - - // A block uses between two and six different Huffman trees. - numHuffmanTrees := br.ReadBits(3) - if numHuffmanTrees < 2 || numHuffmanTrees > 6 { - return StructuralError("invalid number of Huffman trees") - } - - // The Huffman tree can switch every 50 symbols so there's a list of - // tree indexes telling us which tree to use for each 50 symbol block. - numSelectors := br.ReadBits(15) - treeIndexes := make([]uint8, numSelectors) - - // The tree indexes are move-to-front transformed and stored as unary - // numbers. - mtfTreeDecoder := newMTFDecoderWithRange(numHuffmanTrees) - for i := range treeIndexes { - c := 0 - for { - inc := br.ReadBits(1) - if inc == 0 { - break - } - c++ - } - if c >= numHuffmanTrees { - return StructuralError("tree index too large") - } - treeIndexes[i] = uint8(mtfTreeDecoder.Decode(c)) - } - - // The list of symbols for the move-to-front transform is taken from - // the previously decoded symbol bitmap. - symbols := make([]byte, numSymbols) - nextSymbol := 0 - for i := 0; i < 256; i++ { - if symbolPresent[i] { - symbols[nextSymbol] = byte(i) - nextSymbol++ - } - } - mtf := newMTFDecoder(symbols) - - numSymbols += 2 // to account for RUNA and RUNB symbols - huffmanTrees := make([]huffmanTree, numHuffmanTrees) - - // Now we decode the arrays of code-lengths for each tree. - lengths := make([]uint8, numSymbols) - for i := range huffmanTrees { - // The code lengths are delta encoded from a 5-bit base value. - length := br.ReadBits(5) - for j := range lengths { - for { - if !br.ReadBit() { - break - } - if br.ReadBit() { - length-- - } else { - length++ - } - } - if length < 0 || length > 20 { - return StructuralError("Huffman length out of range") - } - lengths[j] = uint8(length) - } - huffmanTrees[i], err = newHuffmanTree(lengths) - if err != nil { - return err - } - } - - selectorIndex := 1 // the next tree index to use - if len(treeIndexes) == 0 { - return StructuralError("no tree selectors given") - } - if int(treeIndexes[0]) >= len(huffmanTrees) { - return StructuralError("tree selector out of range") - } - currentHuffmanTree := huffmanTrees[treeIndexes[0]] - bufIndex := 0 // indexes bz2.buf, the output buffer. - // The output of the move-to-front transform is run-length encoded and - // we merge the decoding into the Huffman parsing loop. These two - // variables accumulate the repeat count. See the Wikipedia page for - // details. - repeat := 0 - repeatPower := 0 - - // The `C' array (used by the inverse BWT) needs to be zero initialized. - for i := range bz2.c { - bz2.c[i] = 0 - } - - decoded := 0 // counts the number of symbols decoded by the current tree. - for { - if decoded == 50 { - if selectorIndex >= numSelectors { - return StructuralError("insufficient selector indices for number of symbols") - } - if int(treeIndexes[selectorIndex]) >= len(huffmanTrees) { - return StructuralError("tree selector out of range") - } - currentHuffmanTree = huffmanTrees[treeIndexes[selectorIndex]] - selectorIndex++ - decoded = 0 - } - - v := currentHuffmanTree.Decode(br) - decoded++ - - if v < 2 { - // This is either the RUNA or RUNB symbol. - if repeat == 0 { - repeatPower = 1 - } - repeat += repeatPower << v - repeatPower <<= 1 - - // This limit of 2 million comes from the bzip2 source - // code. It prevents repeat from overflowing. - if repeat > 2*1024*1024 { - return StructuralError("repeat count too large") - } - continue - } - - if repeat > 0 { - // We have decoded a complete run-length so we need to - // replicate the last output symbol. - if repeat > bz2.blockSize-bufIndex { - return StructuralError("repeats past end of block") - } - for i := 0; i < repeat; i++ { - b := byte(mtf.First()) - bz2.tt[bufIndex] = uint32(b) - bz2.c[b]++ - bufIndex++ - } - repeat = 0 - } - - if int(v) == numSymbols-1 { - // This is the EOF symbol. Because it's always at the - // end of the move-to-front list, and never gets moved - // to the front, it has this unique value. - break - } - - // Since two metasymbols (RUNA and RUNB) have values 0 and 1, - // one would expect |v-2| to be passed to the MTF decoder. - // However, the front of the MTF list is never referenced as 0, - // it's always referenced with a run-length of 1. Thus 0 - // doesn't need to be encoded and we have |v-1| in the next - // line. - b := byte(mtf.Decode(int(v - 1))) - if bufIndex >= bz2.blockSize { - return StructuralError("data exceeds block size") - } - bz2.tt[bufIndex] = uint32(b) - bz2.c[b]++ - bufIndex++ - } - - if origPtr >= uint(bufIndex) { - return StructuralError("origPtr out of bounds") - } - - // We have completed the entropy decoding. Now we can perform the - // inverse BWT and setup the RLE buffer. - bz2.preRLE = bz2.tt[:bufIndex] - bz2.preRLEUsed = 0 - bz2.tPos = inverseBWT(bz2.preRLE, origPtr, bz2.c[:]) - bz2.lastByte = -1 - bz2.byteRepeats = 0 - bz2.repeats = 0 - - return nil -} - -// inverseBWT implements the inverse Burrows-Wheeler transform as described in -// http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-124.pdf, section 4.2. -// In that document, origPtr is called `I' and c is the `C' array after the -// first pass over the data. It's an argument here because we merge the first -// pass with the Huffman decoding. -// -// This also implements the `single array' method from the bzip2 source code -// which leaves the output, still shuffled, in the bottom 8 bits of tt with the -// index of the next byte in the top 24-bits. The index of the first byte is -// returned. -func inverseBWT(tt []uint32, origPtr uint, c []uint) uint32 { - sum := uint(0) - for i := 0; i < 256; i++ { - sum += c[i] - c[i] = sum - c[i] - } - - for i := range tt { - b := tt[i] & 0xff - tt[c[b]] |= uint32(i) << 8 - c[b]++ - } - - return tt[origPtr] >> 8 -} - -// This is a standard CRC32 like in hash/crc32 except that all the shifts are reversed, -// causing the bits in the input to be processed in the reverse of the usual order. - -var crctab [256]uint32 - -func init() { - const poly = 0x04C11DB7 - for i := range crctab { - crc := uint32(i) << 24 - for j := 0; j < 8; j++ { - if crc&0x80000000 != 0 { - crc = (crc << 1) ^ poly - } else { - crc <<= 1 - } - } - crctab[i] = crc - } -} - -// updateCRC updates the crc value to incorporate the data in b. -// The initial value is 0. -func updateCRC(val uint32, b []byte) uint32 { - crc := ^val - for _, v := range b { - crc = crctab[byte(crc>>24)^v] ^ (crc << 8) - } - return ^crc -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2_test.go b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2_test.go deleted file mode 100644 index 77c50dfe948b6dc9c52b0a693ba50228431bf2d2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/bzip2_test.go +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bzip2 - -import ( - "bytes" - "encoding/base64" - "encoding/hex" - "io" - "io/ioutil" - "testing" -) - -func TestBitReader(t *testing.T) { - buf := bytes.NewReader([]byte{0xaa}) - br := newBitReader(buf) - if n := br.ReadBits(1); n != 1 { - t.Errorf("read 1 wrong") - } - if n := br.ReadBits(1); n != 0 { - t.Errorf("read 2 wrong") - } - if n := br.ReadBits(1); n != 1 { - t.Errorf("read 3 wrong") - } - if n := br.ReadBits(1); n != 0 { - t.Errorf("read 4 wrong") - } -} - -func TestBitReaderLarge(t *testing.T) { - buf := bytes.NewReader([]byte{0x12, 0x34, 0x56, 0x78}) - br := newBitReader(buf) - if n := br.ReadBits(32); n != 0x12345678 { - t.Errorf("got: %x want: %x", n, 0x12345678) - } -} - -func readerFromHex(s string) io.Reader { - data, err := hex.DecodeString(s) - if err != nil { - panic("readerFromHex: bad input") - } - return bytes.NewReader(data) -} - -func decompressHex(s string) (out []byte, err error) { - r := NewReader(readerFromHex(s)) - return ioutil.ReadAll(r) -} - -func TestHelloWorldBZ2(t *testing.T) { - out, err := decompressHex(helloWorldBZ2Hex) - if err != nil { - t.Errorf("error from Read: %s", err) - return - } - - if !bytes.Equal(helloWorld, out) { - t.Errorf("got %x, want %x", out, helloWorld) - } -} - -func TestConcat(t *testing.T) { - out, err := decompressHex(helloWorldBZ2Hex + helloWorldBZ2Hex) - if err != nil { - t.Errorf("error from Read: %s", err) - return - } - - hello2 := bytes.Repeat(helloWorld, 2) - if !bytes.Equal(hello2, out) { - t.Errorf("got %x, want %x", out, hello2) - } -} - -func testZeros(t *testing.T, inHex string, n int) { - out, err := decompressHex(inHex) - if err != nil { - t.Errorf("error from Read: %s", err) - return - } - - expected := make([]byte, n) - - if !bytes.Equal(expected, out) { - allZeros := true - for _, b := range out { - if b != 0 { - allZeros = false - break - } - } - t.Errorf("incorrect result, got %d bytes (allZeros: %t)", len(out), allZeros) - } -} - -func Test32Zeros(t *testing.T) { - testZeros(t, thirtyTwoZerosBZ2Hex, 32) -} - -func Test1MBZeros(t *testing.T) { - testZeros(t, oneMBZerosBZ2Hex, 1024*1024) -} - -func testRandomData(t *testing.T, compressedHex, uncompressedHex string) { - out, err := decompressHex(compressedHex) - if err != nil { - t.Errorf("error from Read: %s", err) - return - } - - expected, _ := hex.DecodeString(uncompressedHex) - - if !bytes.Equal(out, expected) { - t.Errorf("incorrect result\ngot: %x\nwant: %x", out, expected) - } -} - -func TestRandomData1(t *testing.T) { - testRandomData(t, randBZ2Hex, randHex) -} - -func TestRandomData2(t *testing.T) { - // This test involves several repeated bytes in the output, but they - // should trigger RLE decoding. - testRandomData(t, rand2BZ2Hex, rand2Hex) -} - -func TestRandomData3(t *testing.T) { - // This test uses the full range of symbols. - testRandomData(t, rand3BZ2Hex, rand3Hex) -} - -func Test1MBSawtooth(t *testing.T) { - out, err := decompressHex(oneMBSawtoothBZ2Hex) - if err != nil { - t.Errorf("error from Read: %s", err) - return - } - - expected := make([]byte, 1024*1024) - - for i := range expected { - expected[i] = byte(i) - } - - if !bytes.Equal(out, expected) { - t.Error("incorrect result") - } -} - -const helloWorldBZ2Hex = "425a68393141592653594eece83600000251800010400006449080200031064c4101a7a9a580bb9431f8bb9229c28482776741b0" - -var helloWorld = []byte("hello world\n") - -const thirtyTwoZerosBZ2Hex = "425a6839314159265359b5aa5098000000600040000004200021008283177245385090b5aa5098" -const oneMBZerosBZ2Hex = "425a683931415926535938571ce50008084000c0040008200030cc0529a60806c4201e2ee48a70a12070ae39ca" - -const randBZ2Hex = "425a6839314159265359905d990d0001957fffffffffffafffffffffffffffffbfff6fffdfffffffffffffffffffffffffffffc002b6dd75676ed5b77720098320d11a64626981323d4da47a83131a13d09e8040f534cd4f4d27a464d193008cd09804601347a980026350c9886234d36864193d1351b44c136919e90340d26127a4cd264c32023009898981310c0344c340027a8303427a99a04c00003534c230d034f5006468d268cf54d36a3009a69a62626261311b40026013d34201a6934c9a604c98ca6c8460989fa9346234d30d3469a2604fd4131a7aa6d0046043d4c62098479269e89e835190d018d4c046001a11e801a0264792321932308c43a130688c260d46686804cd01a9e80981193684c6a68c00000004c4c20c04627a4c0000260003400d04c0681a01334026009a6f48041466132581ec5212b081d96b0effc16543e2228b052fcd30f2567ee8d970e0f10aabca68dd8270591c376cfc1baae0dba00aaff2d6caf6b211322c997cc18eaee5927f75185336bf907021324c71626c1dd20e22b9b0977f05d0f901eaa51db9fbaf7c603b4c87bc82890e6dd7e61d0079e27ec050dd788fd958152061cd01e222f9547cb9efc465d775b6fc98bac7d387bffd151ae09dadf19494f7a638e2eae58e550faba5fe6820ea520eb986096de4e527d80def3ba625e71fbefdcf7e7844e0a25d29b52dcd1344fca083737d42692aab38d230485f3c8ed54c2ed31f15cf0270c8143765b10b92157233fa1dfe0d7ce8ffe70b8b8f7250071701dfe9f1c94de362c9031455951c93eb098a6b50ee45c6131fefc3b6f9643e21f4adc59497138e246f5c57d834aa67c4f10d8bd8b3908d8130dd7388409c299a268eab3664fa4907c5c31574874bd8d388a4ab22b339660804e53e1b8d05867d40e3082560608d35d5d2c6054e8bab23da28f61f83efd41d25529ad6ea15fb50505cacfabb0902166427354ca3830a2c8415f21b19e592690fbe447020d685a4bcd16ecc4ff1a1c0e572627d0ef6265c008a43fc243240541061ed7840606be466d1c0dac2c53250ed567507d926c844154560d631960c65e15157829b2c7f16859f111a3a8cb72bf24ffa57a680c3be67b1be67c8dd8aea73ac2437a78df5b686d427080ebc01bd30b71a49f6ea31dc0f08e4849e38face96717690239538bc08b6cc5aa8d467cb9c36aa83d40ac7e58bddbfa185b22065e89a86c0145569d9e23726651aec49e31588d70f40fe9a4449dcf4f89eac220171e9c938e803dc195679651004b79ad33cc0c13aeeba5941b33ffeeb8fbe16e76c7811445c67b4269c90479433ddf9e8ed1d00c166b6c17217fb22c3ef1b0c1c7e28e185446a111c37f1ea6c07a59fbcc6546ecc6968d36ba58bc5489a5640647e426b0c39350cb6f07d5dc7a717648c4ec7f841467597ae1f65f408fd2d9940a4b1b860b3c9ae351dcae0b4425f7e8538710f2e40b7f70d13b51ac05ccc6ecda8264a88cad2d721d18132a9b9110a9e759c2483c77dcefc7e464ec88588174cb0c9abff93230ea0bed8decdd8ed8bfe2b5df0a253803678df04fab44c03b9ab7cc97d6e6d6fd0c4c840ce0efc498436f453bbb181603459471f2b588724592b222ec990614db530e10cadd84705621cfdd9261fa44a5f5806a2d74b575056b3c915255c65678f9c16e6dc00a99180fef1a840aff0e842ac02731080cc92782538360a60a727991013984da4fad95f79d5030677b7528d076b2483685fca4429edf804682fdc110dfc2f7c30e23e20a72e039108a0ad6fdee2f76985a4b4be4f5afc6101bf9d5042b657a05dc914e1424241766434" -const randHex = "c95138082bdf2b9bfa5b1072b23f729735d42c785eeb94320fb14c265b9c2ca421d01a3db986df1ac2acde5a0e6bf955d6f95e61261540905928e195f1a66644cc7f37281744fff4dc6df35566a494c41a8167151950eb74f5fc45f85ad0e5ed28b49adfe218aa7ec1707e8e1d55825f61f72beda3b4c006b8c9188d7336a5d875329b1b58c27cc4e89ecbae02c7712400c39dd131d2c6de82e2863da51d472bdfb21ecce62cc9cf769ed28aedc7583d755da45a0d90874bda269dd53283a9bdfd05f95fc8e9a304bb338ea1a2111894678c18134f17d31a15d9bfc1237894650f3e715e2548639ecbddb845cfe4a46a7b3a3c540f48629488e8c869f1e9f3f4c552243a8105b20eb8e264994214349dae83b165fd6c2a5b8e83fce09fc0a80d3281c8d53a9a08095bd19cbc1388df23975646ed259e003d39261ee68cbece8bcf32971f7fe7e588e8ba8f5e8597909abaea693836a79a1964050ed910a45a0f13a58cd2d3ae18992c5b23082407fd920d0bf01e33118a017bb5e39f44931346845af52128f7965206759433a346034ea481671f501280067567619f5ecef6cded077f92ed7f3b3ce8e308c80f34ba06939e9303f91b4318c8c1dd4cc223c1f057ac0c91211c629cd30e46ee9ec1d9fd493086b7bc2bc83e33f08749a5d430b0ed4f79d70f481940c9b0930b16321886a0df4fa5a1465d5208c7d3494a7987d9a5e42aa256f0c9523947f8318d0ef0af3d59a45cfc2418d0785c9a548b32b81e7de18be7d55a69a4c156bbb3d7579c0ac8e9c72b24646e54b0d0e8725f8f49fb44ae3c6b9d0287be118586255a90a4a83483ed0328518037e52aa959c5748ed83e13023e532306be98b8288da306bbb040bcf5d92176f84a9306dc6b274b040370b61d71fde58dd6d20e6fee348eae0c54bd0a5a487b2d005f329794f2a902c296af0a4c1f638f63292a1fa18e006c1b1838636f4de71c73635b25660d32e88a0917e1a5677f6a02ca65585b82cbd99fb4badbfa97a585da1e6cadf6737b4ec6ca33f245d66ee6a9fae6785d69b003c17b9fc6ec34fe5824ab8caae5e8e14dc6f9e116e7bf4a60c04388783c8ae929e1b46b3ef3bbe81b38f2fa6da771bf39dfba2374d3d2ed356b8e2c42081d885a91a3afb2f31986d2f9873354c48cf5448492c32e62385af423aa4f83db6d1b2669650379a1134b0a04cbca0862d6f9743c791cbb527d36cd5d1f0fc7f503831c8bd1b7a0ef8ae1a5ed1155dfdd9e32b6bb33138112d3d476b802179cb85a2a6c354ccfed2f31604fbd8d6ec4baf9f1c8454f72c6588c06a7df3178c43a6970bfa02dd6f74cb5ec3b63f9eddaa17db5cbf27fac6de8e57c384afd0954179f7b5690c3bee42abc4fa79b4b12101a9cf5f0b9aecdda945def0bd04163237247d3539850e123fe18139f316fa0256d5bd2faa8" - -const oneMBSawtoothBZ2Hex = "425a683931415926535971931ea00006ddffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe007de00000000000000024c00130001300000000000000000000000000000000000000000000000000000000126000980009800000000000000000000000000000000000000000000000000000000930004c0004c000000000000000000000000000000000000000000000000000000004980026000260000000000000000000000000000000000000000000000000000000009aaaaa0000000000000000000000000000000000000000000000000000000000000000498002600026000000000000000000000000000000000000000000000000000000007fc42271980d044c0a822607411304a08982d044c1a82260f411308a08984d044c2a82261741130ca08986d044c3a82261f411310a08988d044c4a822627411314a0898ad044c5a82262f411318a0898cd044c6a82263741131ca0898ed044c7a82263f411320a08990d044c8a822647411324a08992d044c9a82264f411328a08994d044caa82265741132ca08996d044cba82265f411330a08998d044cca822667411334a0899ad044cda82266f411338a0899cd044cea82267741133ca0899ed044cfa82267f411340a089a0d044d0a822687411344a089a2d044d1a82268f411348a089a4d044d2a82269741134ca089a6d044d3a82269f411350a089a8d044d4a8226a7411354a089aad044d5a8226af411358a089acd044d6a8226b741135ca089aed044d7a8226bf411360a089b0d044d8a8226c7411364a089b2d044d9a8226cf411368a089b4d044daa8226d741136ca089b6d044dba8226df411370a089b8d044dca8226e7411374a089bad044dda8226ef411378a089bcd044dea8226f741137ca089bed044dfa8226ff411380a089c0d044e0a822707411384a089c2d044e1a82270f411388a089c4d044e2a82271741138ca089c59089c69089c71089c79089c81089c89089c91089c99089ca1089ca9089cb1089cb9089cc1089cc9089cd1089cd9089ce1089ce9089cf1089cf9089d01089d09089d11089d19089d21089d29089d31089d39089d41089d49089d51089d59089d61089d69089d71089d79089d81089d89089d91089d99089da1089da9089db1089db9089dc1089dc9089dd1089dd9089de1089de9089df1089df9089e01089e09089e11089e19089e21089e29089e31089e39089e41089e49089e51089e59089e61089e69089e71089e79089e81089e89089e91089e99089ea1089ea9089eb1089eb9089ec1089ec9089ed1089ed9089ee1089ee9089ef1089ef9089f01089f09089f11089f19089f21089f29089f31089f39089f41089f49089f51089f59089f61089f69089f71089f79089f81089f89089f91089f99089fa1089fa9089fb1089fb9089fc1089fc9089fd1089fd9089fe1089fe9089ff1089ff98a0ac9329acf23ba884804fdd3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0034f800000000000024c00130001300000000000000000000000000000000000000000000000000000000126000980009800000000000000000000000000000000000000000000000000000000930004c0004c000000000000000000000000000000000000000000000000000000004980026000260000000000000000000000000000000000000000000000000000000024c0013000130000000000000000000000000000000000000000000000000000000002955540000000000000000000000000000000000000000000000000000000000000001ff108c00846024230221181908c108460a4230621183908c20846124230a21185908c308461a4230e21187908c40846224231221189908c508462a423162118b908c60846324231a2118d908c708463a4231e2118f908c80846424232221191908c908464a4232621193908ca0846524232a21195908cb08465a4232e21197908cc0846624233221199908cd08466a423362119b908ce0846724233a2119d908cf08467a4233e2119f908d008468242342211a1908d108468a42346211a3908d20846924234a211a5908d308469a4234e211a7908d40846a242352211a9908d50846aa42356211ab908d60846b24235a211ad908d70846ba4235e211af908d80846c242362211b1908d90846ca42366211b3908da0846d24236a211b5908db0846da4236e211b7908dc0846e242372211b9908dd0846ea42376211bb908de0846f24237a211bd908df0846fa4237e211bf908e008470242382211c1908e108470a42386211c3908e20847124238a211c5908e2f8c211c6c8471d211c7c84721211c8c84725211c9c84729211cac8472d211cbc84731211ccc84735211cdc84739211cec8473d211cfc84741211d0c84745211d1c84749211d2c8474d211d3c84751211d4c84755211d5c84759211d6c8475d211d7c84761211d8c84765211d9c84769211dac8476d211dbc84771211dcc84775211ddc84779211dec8477d211dfc84781211e0c84785211e1c84789211e2c8478d211e3c84791211e4c84795211e5c84799211e6c8479d211e7c847a1211e8c847a5211e9c847a9211eac847ad211ebc847b1211ecc847b5211edc847b9211eec847bd211efc847c1211f0c847c5211f1c847c9211f2c847cd211f3c847d1211f4c847d5211f5c847d9211f6c847dd211f7c847e1211f8c847e5211f9c847e9211fac847ed211fbc847f1211fcc847f5211fdc847f9211fec847fd211ff8bb9229c284803a8b6248" - -const rand2BZ2Hex = "425a6839314159265359d992d0f60000137dfe84020310091c1e280e100e042801099210094806c0110002e70806402000546034000034000000f2830000032000d3403264049270eb7a9280d308ca06ad28f6981bee1bf8160727c7364510d73a1e123083421b63f031f63993a0f40051fbf177245385090d992d0f60" -const rand2Hex = "92d5652616ac444a4a04af1a8a3964aca0450d43d6cf233bd03233f4ba92f8719e6c2a2bd4f5f88db07ecd0da3a33b263483db9b2c158786ad6363be35d17335ba" - -const rand3BZ2Hex = "425a68393141592653593be669d00000327ffffffffffffffffffffffffffffffffffff7ffffffffffffffffffffffffffffffc002b3b2b1b6e2bae400004c00132300004c0d268c004c08c0130026001a008683234c0684c34008c230261a04c0260064d07a8d00034000d27a1268c9931a8d327a3427a41faa69ea0da264c1a34219326869b51b49a6469a3268c689fa53269a62794687a9a68f5189994c9e487a8f534fd49a3d34043629e8c93d04da4f4648d30d4f44d3234c4d3023d0840680984d309934c234d3131a000640984f536a6132601300130130c8d00d04d1841ea7a8d31a02609b40023460010c01a34d4c1a0d04d3069306810034d0d0d4c0046130d034d0131a9a64d321804c68003400098344c13000991808c0001a00000000098004d3d4da4604c47a13012140aadf8d673c922c607ef6212a8c0403adea4b28aee578900e653b9cdeb8d11e6b838815f3ebaad5a01c5408d84a332170aff8734d4e06612d3c2889f31925fb89e33561f5100ae89b1f7047102e729373d3667e58d73aaa80fa7be368a1cc2dadd81d81ec8e1b504bd772ca31d03649269b01ceddaca07bf3d4eba24de141be3f86f93601e03714c0f64654671684f9f9528626fd4e1b76753dc0c54b842486b8d59d8ab314e86ca818e7a1f079463cbbd70d9b79b283c7edc419406311022e4be98c2c1374df9cdde2d008ce1d00e5f06ad1024baf555631f70831fc1023034e62be7c4bcb648caf276963ffa20e96bb50377fe1c113da0db4625b50741c35a058edb009c6ee5dbf93b8a6b060eec568180e8db791b82aab96cbf4326ca98361461379425ba8dcc347be670bdba7641883e5526ae3d833f6e9cb9bac9557747c79e206151072f7f0071dff3880411846f66bf4075c7462f302b53cb3400a74cf35652ad5641ed33572fd54e7ed7f85f58a0acba89327e7c6be5c58cb71528b99df2431f1d0358f8d28d81d95292da631fb06701decabb205fac59ff0fb1df536afc681eece6ea658c4d9eaa45f1342aa1ff70bdaff2ddaf25ec88c22f12829a0553db1ec2505554cb17d7b282e213a5a2aa30431ded2bce665bb199d023840832fedb2c0c350a27291407ff77440792872137df281592e82076a05c64c345ffb058c64f7f7c207ef78420b7010520610f17e302cc4dfcfaef72a0ed091aab4b541eb0531bbe941ca2f792bf7b31ca6162882b68054a8470115bc2c19f2df2023f7800432b39b04d3a304e8085ba3f1f0ca5b1ba4d38d339e6084de979cdea6d0e244c6c9fa0366bd890621e3d30846f5e8497e21597b8f29bbf52c961a485dfbea647600da0fc1f25ce4d203a8352ece310c39073525044e7ac46acf2ed9120bae1b4f6f02364abfe343f80b290983160c103557af1c68416480d024cc31b6c06cfec011456f1e95c420a12b48b1c3fe220c2879a982fb099948ac440db844b9a112a5188c7783fd3b19593290785f908d95c9db4b280bafe89c1313aeec24772046d9bc089645f0d182a21184e143823c5f52de50e5d7e98d3d7ab56f5413bbccd1415c9bcff707def475b643fb7f29842582104d4cc1dbaaca8f10a2f44273c339e0984f2b1e06ab2f0771db01fafa8142298345f3196f23e5847bda024034b6f59b11c29e981c881456e40d211929fd4f766200258aad8212016322bd5c605790dcfdf1bd2a93d99c9b8f498722d311d7eae7ff420496a31804c55f4759a7b13aaaf5f7ce006c3a8a998897d5e0a504398c2b627852545baf440798bcc5cc049357cf3f17d9771e4528a1af3d77dc794a11346e1bdf5efe37a405b127b4c43b616d61fbc5dc914e14240ef99a7400" -const rand3Hex = "1744b384d68c042371244e13500d4bfb98c6244e3d71a5b700224420b59c593553f33bd786e3d0ce31626f511bc985f59d1a88aa38ba8ad6218d306abee60dd9172540232b95be1af146c69e72e5fde667a090dc3f93bdc5c5af0ab80acdbaa7a505f628c59dc0247b31a439cacf5010a94376d71521df08c178b02fb96fdb1809144ea38c68536187c53201fea8631fb0a880b4451ccdca7cc61f6aafca21cc7449d920599db61789ac3b1e164b3390124f95022aeea39ccca3ec1053f4fa10de2978e2861ea58e477085c2220021a0927aa94c5d0006b5055abba340e4f9eba22e969978dfd18e278a8b89d877328ae34268bc0174cfe211954c0036f078025217d1269fac1932a03b05a0b616012271bbe1fb554171c7a59b196d8a4479f45a77931b5d97aaf6c0c673cbe597b79b96e2a0c1eae2e66e46ccc8c85798e23ffe972ebdaa3f6caea243c004e60321eb47cd79137d78fd0613be606feacc5b3637bdc96a89c13746db8cad886f3ccf912b2178c823bcac395f06d28080269bdca2debf3419c66c690fd1adcfbd53e32e79443d7a42511a84cb22ca94fffad9149275a075b2f8ae0b021dcde9bf62b102db920733b897560518b06e1ad7f4b03458493ddaa7f4fa2c1609f7a1735aeeb1b3e2cea3ab45fc376323cc91873b7e9c90d07c192e38d3f5dfc9bfab1fd821c854da9e607ea596c391c7ec4161c6c4493929a8176badaa5a5af7211c623f29643a937677d3df0da9266181b7c4da5dd40376db677fe8f4a1dc456adf6f33c1e37cec471dd318c2647644fe52f93707a77da7d1702380a80e14cc0fdce7bf2eed48a529090bae0388ee277ce6c7018c5fb00b88362554362205c641f0d0fab94fd5b8357b5ff08b207fee023709bc126ec90cfb17c006754638f8186aaeb1265e80be0c1189ec07d01d5f6f96cb9ce82744147d18490de7dc72862f42f024a16968891a356f5e7e0e695d8c933ba5b5e43ad4c4ade5399bc2cae9bb6189b7870d7f22956194d277f28b10e01c10c6ffe3e065f7e2d6d056aa790db5649ca84dc64c35566c0af1b68c32b5b7874aaa66467afa44f40e9a0846a07ae75360a641dd2acc69d93219b2891f190621511e62a27f5e4fbe641ece1fa234fc7e9a74f48d2a760d82160d9540f649256b169d1fed6fbefdc491126530f3cbad7913e19fbd7aa53b1e243fbf28d5f38c10ebd77c8b986775975cc1d619efb27cdcd733fa1ca36cffe9c0a33cc9f02463c91a886601fd349efee85ef1462065ef9bd2c8f533220ad93138b8382d5938103ab25b2d9af8ae106e1211eb9b18793fba033900c809c02cd6d17e2f3e6fc84dae873411f8e87c3f0a8f1765b7825d185ce3730f299c3028d4a62da9ee95c2b870fb70c79370d485f9d5d9acb78926d20444033d960524d2776dc31988ec7c0dbf23b9905d" - -const ( - digits = iota - twain -) - -var testfiles = []string{ - // Digits is the digits of the irrational number e. Its decimal representation - // does not repeat, but there are only 10 possible digits, so it should be - // reasonably compressible. - digits: "testdata/e.txt.bz2", - // Twain is Project Gutenberg's edition of Mark Twain's classic English novel. - twain: "testdata/Mark.Twain-Tom.Sawyer.txt.bz2", -} - -func benchmarkDecode(b *testing.B, testfile int) { - compressed, err := ioutil.ReadFile(testfiles[testfile]) - if err != nil { - b.Fatal(err) - } - b.SetBytes(int64(len(compressed))) - for i := 0; i < b.N; i++ { - r := bytes.NewReader(compressed) - io.Copy(ioutil.Discard, NewReader(r)) - } -} - -func BenchmarkDecodeDigits(b *testing.B) { benchmarkDecode(b, digits) } -func BenchmarkDecodeTwain(b *testing.B) { benchmarkDecode(b, twain) } - -func TestBufferOverrun(t *testing.T) { - // Tests https://golang.org/issue/5747. - buffer := bytes.NewReader([]byte(bufferOverrunBase64)) - decoder := base64.NewDecoder(base64.StdEncoding, buffer) - decompressor := NewReader(decoder) - // This shouldn't panic. - ioutil.ReadAll(decompressor) -} - -func TestOutOfRangeSelector(t *testing.T) { - // Tests https://golang.org/issue/8363. - buffer := bytes.NewReader(outOfRangeSelector) - decompressor := NewReader(buffer) - // This shouldn't panic. - ioutil.ReadAll(decompressor) -} - -func TestMTF(t *testing.T) { - mtf := newMTFDecoderWithRange(5) - - // 0 1 2 3 4 - expect := byte(1) - x := mtf.Decode(1) - if x != expect { - t.Errorf("expected %v, got %v", expect, x) - } - - // 1 0 2 3 4 - x = mtf.Decode(0) - if x != expect { - t.Errorf("expected %v, got %v", expect, x) - } - - // 1 0 2 3 4 - expect = byte(0) - x = mtf.Decode(1) - if x != expect { - t.Errorf("expected %v, got %v", expect, x) - } - - // 0 1 2 3 4 - expect = byte(4) - x = mtf.Decode(4) - if x != expect { - t.Errorf("expected %v, got %v", expect, x) - } - - // 4 0 1 2 3 - expect = byte(0) - x = mtf.Decode(1) - if x != expect { - t.Errorf("expected %v, got %v", expect, x) - } -} - -var bufferOverrunBase64 string = ` -QlpoNTFBWSZTWTzyiGcACMP/////////////////////////////////3/7f3/// -////4N/fCZODak2Xo44GIHZgkGzDRbFAuwAAKoFV7T6AO6qwA6APb6s2rOoAkAAD -oACUoDtndh0iQAPkAAAAaPWihQoCgr5t97Obju21ChQB0NBm3RbA7apXrRoBooAA -AhA+IAHWl2Us3O7t9yieb3udvd76+4+fd33nd3HO1bVvfcGRne6+3vfPvfc++995 -w7k973eJhasLVec970tzDNXdX28LoPXZ3H3K9z0s5ufWAfes49d5594c3dUYtI+2 -+h1dvtpRa+uvrVEAG9bl893RVEN7cWvroSqWjPMGgAQi7Gq8TJSgKKdjKFBIB9Ae -LqWxleu715eXe7ml9e5098Z6G1vr7t1QZ6ot76YzPd3j7333t2ql2Chm7XrA9ICQ -VF77z3rVBWqkSXtlfb099hyezAr6USbGpICTSCFAaqHrKo+tUnm32rpE4Ue+t2mj -bKUeipEqwc93EdhhTwmQpOhhesC9iqDSPNTWYNSnUtBdm1nsA0nqqNd7OWwDXtFL -ONmmA6Ubke26I9UblvWIPR5VOWOnctai443URunnDy77uVC59OfRvezlDu33Z7Ly -3NNuuHW63088xu3t3NHZhkZbG7tXRlj00qOtbaXTJUUdspTbABR9R6EUwQAEAAAA -EMEwRpoAAAABMmhoAAjBNNAaCMhponpoGpgJpk9TEyp6niGKZkAaAEfqMQ09U80p -+pMGSCKngIAAAAgAAg0AAJhGgABGCEaaTyTKeNI1PE0wkj01GajMSNPSZGnqbU9T -anlPUNAHqGQ0DQAMg9TamgAAYRU/IAAICAmjQJgjQBMEwp5DTSaaYmhTeqfplPID -U1T9TynoU82pT1NPU/VP0j1NHqRpk9TTR7SnqaNNGmmQAaAD1Aeo0PSAAAAaaBiK -eBAQBGgIABGQA0AmBNNBoaAgaJmpglPEyYap6npiTT0agGjJjUaaDTQAAAAAAM1A -9QAaAAAADU8iEAQAEyAJk0NNNJgIZTJ5E00YSemiaZNGm1MpGNJ+lPU9qm9U2RDM -oY0EzJB6h6nqDID1NMBDDRpo1AGNAjCMmhkMgaYSJIgAAAQyAAEyBoATECCNhTT0 -U/IZAmCM1DSTxkzUE8p6NDaGiZGJqntTFHvUyU9qPQp7Kn5GgKNPU9QAGg9QAAA3 -wz0Pk/g/m/m9P9H4vxv2+dH3gCS8nhbbbbbYxtgNsBsG0m2MbG0NNtsbYNsaY0wb -bBibGmm22mxptNpsaGNDTY02JsG0MY0xg2MaYNNDbGwG0L5vsK/F9DO+EAA447Kq -p7Wdf6Y+5c20T7DfHyMXIzRKrZexw72uiQI+y55vOe52xpqbCLC2uR20JdER7Zvr -7ufuKb6zhiBxLuj0eA27v8RpMLucw9Ohwcizi2wrpt+yU1FdpM7ZYPcwS3XTef+A -Wzjxwhdrgw3aH1LeC1eZW900x8V9Nv4hTPXp4l067P/4ANVZFF/imOe/d5bdueam -/DFFokQWnFaU+ZqLBCM+d0PialJQWnLqRQZk/KhfbbYc2pCUTgffcSYbrCM1N+8l -HU6gSz+h2GJXs+tbrNviL83M97X0vcTn/F82P8wen8/3/h3sHY+sf9CSej9ThYTV -3lQ+FUHpfpGD4kv7dYMV995dpDX/y3xR8FoXx1bjUxBTNxuutwQ/h/Eedn9wpn6w -E3+ND8YhN1HSriIxRE/6uFyMv6/oC6Elarw3aHMMqHJkGiiz6tejmvnYLQa+Qm6G -deZ7jXTZV6NlpocgDnRdimS06bTYSkvPAL/xoWNLkX6N6VljU0dfKSBmm2uZE/xu -sutQ1EdP7GdjhglIq4xlOFUFEQpmX+xx7R8y6c0GSAaqusOjNZwxZRudOvmXm1tZ -T+YnbeB2ir9eiHNrtJNSLD/J/WDyuQpwBUtLKo0krccY/wIILP7f86teb9Z/9oyz -OX05qEWbObfhpRw+9+rCvp/35ML8KX3aHaI0n+tudbFRsV5FLW+Oa8ruLN4peyVL -DWjTHrXNthq/s7zAJYMeFJZkZt5mT9rfpH+5g3nc+piOSZ+J5nHtOnKI7Ff8Xl+j -0t76XTNucCHQ6whav1OHdF53TY5wuv5OzvrdnxoId8fTyUvERr0ERINu/8XxZZ5f -B5/kTZ8bBO0wv54Jp+ED/GQI8lZHzIQCP3vfQhwnCTj9TvITic7P4mYLDbH3fyzR -i+6EajCcpXLWSGf+ZXkOrWspDWDhXtEKas0v3UqWksqgY1rTj45krX4KihN+daXs -pZl5WPlta5p06CX6Xm2SfzqkMw12/3ix1bpnnZ+kFeBNX7A+E9zzG6OZaN78GOpl -9Ht/eZn9PqWdav852zr0zqkDK2H5IjdvNah+b1YVGdQGzwR4Nw+f13yEKnV+y66W -djfq7zWp7m5w+hzfv+Ly8O7oet5Vvd8/wQvO7qzOZ2vjf9X8Tj8PnMb/nc/nKqRR -+ml4UEhOOwfCeJEEI109CMYSh91iAJqPjMyH6KjrPD7W25llZVcREYNCTg6htbQt -M38wYoquCWP6tdKYlVIv14xTNUeUf4El/FunCf6csZkmv+9tfWx7t59wuKIa3saU -tZs9M+3HFOZtz3OLg/Unoaj9BYazYqA78xBU9tZzrtmF/rQL9CGJt90o/oYnSfcS -SL3haaw351LXWQ1XOsv1SmH3v6ymuxEpPPnEDmBELaTYsvvMIWJsmPZFFww++Kd7 -s/Jo0JFeUU7uNtI+gVosAIpVVuWfI/9tOIycz7I5Z7zjV+NR2OuZbYtW5F08KX4o -2k/xuJIchcNFPtxPfw9dkDgscRbMckyFMrzuZ3IvrcGzk0J6iI5ytrv37bGpAXMz -WK9mMMPebepNevmLjjo/QWoM968Sjv7ldlPS5AinHcXwsFv6dmmh8lJt7UOJWoKu -lMD1cB2ksIGpMdv8iuqR42Rn/kn+17BhhUZcwDBaUXVdX6bKW7fxlUYbq+mlqIcf -a9v8HF87M9ANbi9bq9onf9TD7nQ6Xf6vZci8TBPX+/GI0He6j31fTVQYW+NsQxvO -J8xrx+e58CCLQNjxeIyPt+F+qk/QMiXw+LyxGVkV/XcGQT9X03jSDP6beJ5QG1JW -9Q3qLv/YixWI7gPV9Mrhf2oRYTc/9KLFRhkE3SjKOTKuSSBKQ24fI+hEznamH71D -66Hwez8/0et7AtTv9zvamv2OD5He6fMV4k+ePl6+qPfO5CdHtK+eCDZL5+4f5yrl -gTcRFiq8fXbc5IaI5fbbc1KMM/2T0Mr7+Hwaco6FtXm0fmhCgTZRqY4pKiEIfmaz -QwHNOOCrtMJ2VwsyMumt7xsOolGnizRev6lILH43qPcczQM7Gc5zRin80YvFt1Qm -h/57Z0auR2h0fuX50MBO4XQ+26y5l6v4j902R66c0j3z2KHstKQ04J/h6LbuNQE4 -D6cu/lyfK69DxxX8wb8XaQkMUcJdo1LzqUGDAb3Kfn/A3P/JYc99MO9qv67+SxWb -wYTyqKdWTd+1KbR/Rcn0Io5zI/QquX7FA1bxfMytjQ/X+l0fh0Pf+Hx97meH4fQL -7/T8/sdTm9Tn8nELvedyhydLlPPTScINdXyLIq9wgIJr4fWPbp9ZhFh/56fdSgOG -HDXg+gkXsN2Rddr4HQ5P3u+RhLzmSjhzoqY5EsPC4QvRlX9JXjB84rPV5USR66qa -/kjw4156GJnzoXtydKJE53t6PHfZWO+3ujsfI6iAdshc7OFzGXiZB9PtItKodhYq -nABkTKdcpu4+TOpf9h5piX5slsaBjkeTnj/Ba02ilboQfcDVigxrYn/iTH5ySWUW -/lHtg78s5UZM8sErwhNe3N3w+6ZOMnU+5i86/xFNtqZfDdXTGy1H3PzGbdtZXYT+ -Ixx2vpwBYzbPVYHxKosM5rPiVmcTllI9nuoSfeh9ib4foFWauOpvdmhBDqpTpKTX -u8EO2l2Z195G2RIV7TlKSxGWjR5sl/nALu1uzBeLd9zpSujzMTd1uTX9Qk/Q1S+r -vaW6bm8qqPO4jb6Wx6XIkm321nrIF6Ae25d1+Dpv/P5G4NoLd2j6/EtENC3FeR5z -oo7bA+tI8yEQRhiF0z1FlJXLD5ZbhNNWQm/j/IbzRfh8JtOFZU7ruShLvHXysW9S -9V909tr9jn8/E/Hb5N/1NVNHnZu2HIUvJvHJiHd2ucmeI9PWUMnppmE65GQ5E9xV -ZRlGEH0X85EvmHyEupkMrCC0oMv9RCq+/H8gcfpe00Hs/S+regT5p58cyYomh93v -qvuw/A06BE/wzJESuYbN9pqYpoXqXFemW1NksHEJ2w+PYMJ27WJyD5FpaXB85VaW -qMOhDfO8E3QdH8ybyKt/UgI8/tDGpFbyOlaVdIv1FXJhoLp8soAA4Djg6/KZ066N -ZFYuS8WdjpSZGP4/Lw+1yaXlzNznc/k2uHe2uXP3uFuPcHx+Dm44utxldoO1uBPy -+jzOs14+MIgOjOHMVNqAbMd8fUedLlhJMCfMtm4uz01enLNKcMrtLlPIR37Yukh1 -YEMXYpm7eU4XU+j+Jj3pDyaXtXs+p1fWfTN/cy9/Oxs4umUXQ4uHh1kObtayDJ56 -/QMxiHobjHNKuKfMxsrYEwN+QVIyVjAwMDYuMjQ1AAA9IwJniiBLRkZDAAAXt0Ja -aDQxQVkmU1lZtwytAACLf///////////////////+//////v//////////bv78// -/+AXO133uwO2xB2UxIvbKXrCqCoURUBL2ytFI82AFdcOwMhVTHtk5rD3szEVNYD4 -aIQINCaMRoTaSn7SbSMJiYmEwieTEp+psqbMCp+VNPaFNpqbBNR7UmanlPUeKfqm -j1PU0/VPU08o9Q9EeKHlPJtKbYqeTCYhN6U9T1NH6mp+lPyoGNTI/Knkyg1MggAg -CaMEyQnqZoaaRtRtJpppppoDaTR6hpphGh6mmgHpMQBpkGTTEAAaAAAA00AZDag0 -ADIBkGgABqemiRNTI0k8aU0PRGRoAZlP0UAAAGgAAAyAADQaAAAaAAAAAAAAAAAA -AaAAAAM0kgRBJ5MlPFP1Gj0jTTTUaekxNAbUGjTQMgaZANNAAAAaAADTQAAAAAAA -ANAA0AAANADQ0QAAAAAAAAAaGgAAAAAAABoA0AAA0AAAAAAAAAAAAANAAAAAkSEI -aTRpomp5DUxNNDTJPTKaep6T09Kemmo2JG0aTQ9ENogaaGhkABo0NHqaBoDTI0DC -Gj0gNAMhoDQ9QMQNAGQAaDDwyMPIMlbG1vhRBTFo6JksSupgpAjPbY0ec02IGXjb -eS+FBsh01+O4ZOaD+srUZCFaT4DRjVDLx7uKIsFtESIDUg1ZkhyCSYov05C00MtR -BdNNa/AYPGOQZWcs+VegXOPrkushFbZ3mBoRD6WamClkpBaHZrUhUl02bIfRXX4w -b3/9cW9nHDVxh2qFBxqgRKfmq7/Jc/tdJk05nVrGbckGVy2PnIy30CDhpWmqrSot -K2bOnX0NbP1iy2cd0Na0ZmbRstm4MzMzbbMySTd35F7f+zPP8DC+NJLYcakkkkRd -NZlupJt3OMFoDAD2g+N3FAMCydhIpoRHRQAdFI5nNg4ugEXHCYxkMyGCwtaJmial -y0IMlpSYYM/weXNJAhFqS0GNmvaPEtYGjbvaucMdklOTmBX1vfVAkTYB1uXCSK64 -UNIixOqRKLuRCFtqIQtgwqaFrCkIYbbewErWABa+VGADWsJXJjfx5SJViLuwiGXq -Ru6vCuwmU5CJiJz3UiBpmLv0r2wskxUhY4tzPVGQ9RMXJl65eLSNwZVwaSyGZ9Cm -A3jztQUUpFeUryBTskW95iVwRMFrhBCwZBAFJBZvhMEMNoDJJlUoIhQkAkjbExp2 -YZio+ZYeAZUwmH1qUbdQixmxf0+61+aVgJ1hwxsO1yG3hFx4pfjc09ITVht0pG8u -FtVFhPa1KE0gTRUSVXywkITucqk0Waz5Fs6qJpVHYdNrbYRFxnFsQGY1qmsTLjK6 -4QX5Rddo6krM/Bx9CqIAKq4CzVQYHrmIAd2EBhYmwVYwLvhzKIUrc2EirnGIvyuD -O4YZDSwsVTA0BpVvUOjDErkCraBoSutcKwUSSLGhVvNYHLz3klgZD++wWsa/swLw -gvNDY2De+sncOv8X2lq4HD95ZdwPuTIMXCwSbg4RrIqv+L0y6F17pqDecyQYPEj3 -iN/0BBeWZlJAyBMi5U3Q1zAlsK8IlDhaXGmvZrgISq5CfNjmUgxDeMggOKqxu4sI -OrilS49Lkl1J3u3GjXTuH+rX+4ccyFAQnizCpPClcY77F59j63S6fr5vr+y99tuO -7Ox7Wg/ljwhdyaK4xMmXczeJbx7x07htJNtC4xcQfAtvzeznLrN6MN/ILIBOI65I -qIA2D5fHHj1XN4aN6TvOjWDaSbSWqxCSCvXUpzkNJAkWXAuTwF8k5uSJvQj/rVo0 -hAhEMEIYkCRGx9AX+byIuXWlLMbbVeliHNUL5AQYmNwLFu4SkmGD+UWtBMyVHQOQ -ss0ggoVKSKOBUgnVS6ljt7WE1qXqJJ4QA1pEwYNLEaguEE1LtPNoVr5WzjbSbWPk -V9OW3y9IneUDLoIV5pAkEFTEFGFVjeTFxtpzBBfGgycBxVCdz8eESBIzsamRchAa -TQunQH8DHnpfod9QuAuRvc7JBlKUCYmCjMvynLcxIFohxCaYrDvGw4QbXZB7oWQ7 -hpoGlz23ayDfB8NrRRzdilsEQyQniu9ASLQg7RrGZnoTr1ai12IbCEUCGdFq03P5 -nBnRFAGmisQGcyykV9gKtcVMWLhCuVmXg86dndn7slUpRNSSEAU20oaWIm1maFTu -E0DT4gTbg0nuhjtz3kNOz+i7sBm0bkXjxQWuLqlZEmp60ZTyRZJDUqKSEKg6hqcy -ERxdU22CSNOO10RYUUiDVpKhPNdKTOIE1thp02sBNoNTFSht8WJtaBQ09qN3jd5r -dOLX4IA5fevRyCCzDgRXfV4wzik4KROjmxmTMglBySlIMEzcXehnDXCRiZSlvwA2 -0YsIOROcm4UrIRFxJHctJH7OdN5u1aHVHb5UaLHpv48NgmFRE56KTSoaWunqm2st -S0mrAdOiqcR12PWVbdVRJKcQ0DQuhwlAPcRtpxN3D4kbXJjToSYJIFw406G2CSaK -jQMIJPZGlQmgyFhoCSzeGS1VSq5SKKQQxs5RqKUcVUNY57YUETb4mXzV84SPngKi -nsce0mXByZq5BKUA9puHZWLNwQIYuDaJUNgG+E01E3pDYVNLKYQ0hsVesgV5gZY0 -htDsRdGtm0+iGnkN6+Ea9YJtUZNAkx2GgSoix12nTW0avTUfxR3oYcpvZ7IdtABE -UhBcjG4qZtDZsS1JQHys243vhLaDTSvvTeBiJA2tmokqECTBcSOCAGkAxMKlVAva -4IsLRaBBqhxDbcGtgdw03mFcLUaFuhtKuuEIEkUleJQwby/zwu9uvvZK4xTV+ECM -a8lmzxKmqkBggYK1+xPdbmJclm6tSZhE/OSJtCEjs+unJIQkT9hCWgBJqGMS07Eh -AJNmBiuVEVdTyjkIJkavuZmx2sJF13htgEZUCC23lZFOE6gWbM9WyYNJTM8yCQrb -0Sx3OQvBML5cRATAQkSQkAJOAhoxpQkNi4ZiEVDbdtJAME0RXNDXGHA3M3Q0mm1o -IEwbWpaM1DQCSMbGRCAu3iRIQiT6RlBpT1n3tfwvUXz3gIVlx3mEximY/kZW1kNG -sgEJIrBisaEoGYPJ+1CQUYFBw+eGEHJQBpNHjErXUJY2iWHQ30hXwFBuMSxQ2lB5 -bg+/LX3euG6HsHUB1lFvBvaiaBrITVwkCTa1d0s9CHZCiDZjbWReKyrpPE2oSa7o -LPrR4BJvys9ttjUpzETSSMxh8vsr9dXTwKBtK+1xCTGDQmNIaE29HmHdS5GSxpya -MismcAUSEgSxHBrKtgsZzduG7vHZn16l3kFkVITtENIzS2JsiBwFTDlhgexsjBHv -5HXOYxHBzoSDCcPZ0ctvkY9aS5XpoQuFYkGJgCsqjJZeUMNUEpDSbKcnUc1PifIA -CbR2UoXawBlspkEBr9HBfvUi/MUakZVOf1WKYrqSaIXce62JOyhJLq3qJBloTA0F -VbILEtM+heFmNRCFt70GJrExVJri0ArYbCRbADSGDBpBXxxb/6fo+s3C7uaL7RjM -LV2IQBNrAJrKFeJwTsPnxbAsemirUx2lk1kaxschzdK4TQNJN5wQnolIFg401OZ4 -2na11LnT3lR+1k1TMJhiAjXMk0F1ooHnYlt9LKfJ3ZIOmeY+2l9bUQHWFNGyEyfj -EAcu3kpGLq0Ez7XOS+EpAASRQTAYMATfVQibHLTT30zG732+pNe9za1JNt8sNJYn -RjWuJ6jL5ILV0rcd9vT7X9fObvcXitpvJ2XBJE+PhX2HaTkyWeF9pwnlQNrTe9hV -tzhA+ihZrDrHNmLcQjZbnv/IMubqq8egxY80t5n6vZ6U5TR6U9uZJvai1xtqAyCR -NWkW52m00rDTEuO6BA4q2RHDWwbETF55rRsWLIgNW9qJCyMHPbTM/dMBmWMQSMxz -4M2pRzt47SICxA327UqSCEERqMFybmYi3nUxePtLgHYplqRiw4ynMbXd/kiQ0LE0 -PKJSSCXA42ymziCpAxNWflzpzQdJZusahRFr6t6m+4p273/Taj7k+hZyNgBAgXAY -8F7pTts6orLb8IA6o4TOwkwQYmKvKu9VwMrE7+GUhVIAgY9a8DyQMiDBkEAwh7S1 -KgCBfao8DK1CwSS8Z3WjL5MEgt93z2koUQCD/YxMBppiCMp7SDVSmkkIHptfGpeh -t+M13Ccv1tavIASFiaQl6rBz3K4N3DSGwNkCibrvEAC0fQirOWnc4NVbcLKpFG1l -NQXF/eqdT79wq1Mvlap3QSCLhcD2D3fCkKVWid4aSjtp9FOX1Uaf7P9eT93zd9Sv -mj2yNLRUGzyI/0oONNSzmmkvJ5Cq2X2CdldIWMGZO57RJ8oyATAWTQmRmNkfh0Sx -uuR/J9oUsomVy1AEntc0dlPivkqBkBqrxU3j5PnWkaI3ZRGc0gg9spCQEISh4xEU -pMhVrnmDQLfLP8Ouqpx917MAw7hkjQk6BJFTAbXDsz3LSHIxo/gB8qrA1vbvdZZh -LtR0frJdfdppX8nAQX/TAxOQ8+H6yw8a9i7/zJEfSYIhop59N/fhcWW2F14cj2Xc -fyHaZ04lTO4uPnly91jwuFPaREuZVp8AxImIhlkxkAN61tWdWG7tEbaCgszh6VIz -ThFnHo2Vi8SQXPrXCN7J9Tc9ZYiAYqoThV/u6SYsea5aZL8deOvKBQCgZZuIxX1z -4EnfcqG176vY4VqMBIC4pMJz0WcHJYqN+j7BiwGoMBwExrIdTB7q4XIFLotcIpS0 -1MqyVsesvoQq7WObmGQXdMliMirSLcDuSx8Qy+4pIBgGDIyMp1qbonnGdcHYvU8S -O0A8s/iua5oFdNZTWvbVI4FUH9sKcLiB3/fIAF+sB4n8q6L+UCfmbPcAo/crQ6b3 -HqhDBMY9J0q/jdz9GNYZ/1fbXdkUqAQKFePhtzJDRBZba27+LPQNMCcrHMq06F1T -4QmLmkHt7LxB2pAczUO+T2O9bHEw/HWw+dYf2MoRDUw= -` - -var outOfRangeSelector = []byte{ - 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, - 0x53, 0x59, 0x4e, 0xec, 0xe8, 0x36, 0x00, 0x00, - 0x02, 0x51, 0x80, 0x00, 0x10, 0x40, 0x00, 0x06, - 0x44, 0x90, 0x80, 0x20, 0x00, 0x31, 0x06, 0x4c, - 0x41, 0x01, 0xa7, 0xa9, 0xa5, 0x80, 0xbb, 0x94, - 0x31, 0x17, 0x72, 0x45, 0x38, 0x50, 0x90, 0x00, - 0x00, 0x00, 0x00, -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/huffman.go b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/huffman.go deleted file mode 100644 index 75a6223d8134c42fb41ba9c95050a2bc2c45271e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/huffman.go +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bzip2 - -import "sort" - -// A huffmanTree is a binary tree which is navigated, bit-by-bit to reach a -// symbol. -type huffmanTree struct { - // nodes contains all the non-leaf nodes in the tree. nodes[0] is the - // root of the tree and nextNode contains the index of the next element - // of nodes to use when the tree is being constructed. - nodes []huffmanNode - nextNode int -} - -// A huffmanNode is a node in the tree. left and right contain indexes into the -// nodes slice of the tree. If left or right is invalidNodeValue then the child -// is a left node and its value is in leftValue/rightValue. -// -// The symbols are uint16s because bzip2 encodes not only MTF indexes in the -// tree, but also two magic values for run-length encoding and an EOF symbol. -// Thus there are more than 256 possible symbols. -type huffmanNode struct { - left, right uint16 - leftValue, rightValue uint16 -} - -// invalidNodeValue is an invalid index which marks a leaf node in the tree. -const invalidNodeValue = 0xffff - -// Decode reads bits from the given bitReader and navigates the tree until a -// symbol is found. -func (t *huffmanTree) Decode(br *bitReader) (v uint16) { - nodeIndex := uint16(0) // node 0 is the root of the tree. - - for { - node := &t.nodes[nodeIndex] - bit, ok := br.TryReadBit() - if !ok && br.ReadBit() { - bit = 1 - } - // bzip2 encodes left as a true bit. - if bit != 0 { - // left - if node.left == invalidNodeValue { - return node.leftValue - } - nodeIndex = node.left - } else { - // right - if node.right == invalidNodeValue { - return node.rightValue - } - nodeIndex = node.right - } - } -} - -// newHuffmanTree builds a Huffman tree from a slice containing the code -// lengths of each symbol. The maximum code length is 32 bits. -func newHuffmanTree(lengths []uint8) (huffmanTree, error) { - // There are many possible trees that assign the same code length to - // each symbol (consider reflecting a tree down the middle, for - // example). Since the code length assignments determine the - // efficiency of the tree, each of these trees is equally good. In - // order to minimize the amount of information needed to build a tree - // bzip2 uses a canonical tree so that it can be reconstructed given - // only the code length assignments. - - if len(lengths) < 2 { - panic("newHuffmanTree: too few symbols") - } - - var t huffmanTree - - // First we sort the code length assignments by ascending code length, - // using the symbol value to break ties. - pairs := huffmanSymbolLengthPairs(make([]huffmanSymbolLengthPair, len(lengths))) - for i, length := range lengths { - pairs[i].value = uint16(i) - pairs[i].length = length - } - - sort.Sort(pairs) - - // Now we assign codes to the symbols, starting with the longest code. - // We keep the codes packed into a uint32, at the most-significant end. - // So branches are taken from the MSB downwards. This makes it easy to - // sort them later. - code := uint32(0) - length := uint8(32) - - codes := huffmanCodes(make([]huffmanCode, len(lengths))) - for i := len(pairs) - 1; i >= 0; i-- { - if length > pairs[i].length { - // If the code length decreases we shift in order to - // zero any bits beyond the end of the code. - length >>= 32 - pairs[i].length - length <<= 32 - pairs[i].length - length = pairs[i].length - } - codes[i].code = code - codes[i].codeLen = length - codes[i].value = pairs[i].value - // We need to 'increment' the code, which means treating |code| - // like a |length| bit number. - code += 1 << (32 - length) - } - - // Now we can sort by the code so that the left half of each branch are - // grouped together, recursively. - sort.Sort(codes) - - t.nodes = make([]huffmanNode, len(codes)) - _, err := buildHuffmanNode(&t, codes, 0) - return t, err -} - -// huffmanSymbolLengthPair contains a symbol and its code length. -type huffmanSymbolLengthPair struct { - value uint16 - length uint8 -} - -// huffmanSymbolLengthPair is used to provide an interface for sorting. -type huffmanSymbolLengthPairs []huffmanSymbolLengthPair - -func (h huffmanSymbolLengthPairs) Len() int { - return len(h) -} - -func (h huffmanSymbolLengthPairs) Less(i, j int) bool { - if h[i].length < h[j].length { - return true - } - if h[i].length > h[j].length { - return false - } - if h[i].value < h[j].value { - return true - } - return false -} - -func (h huffmanSymbolLengthPairs) Swap(i, j int) { - h[i], h[j] = h[j], h[i] -} - -// huffmanCode contains a symbol, its code and code length. -type huffmanCode struct { - code uint32 - codeLen uint8 - value uint16 -} - -// huffmanCodes is used to provide an interface for sorting. -type huffmanCodes []huffmanCode - -func (n huffmanCodes) Len() int { - return len(n) -} - -func (n huffmanCodes) Less(i, j int) bool { - return n[i].code < n[j].code -} - -func (n huffmanCodes) Swap(i, j int) { - n[i], n[j] = n[j], n[i] -} - -// buildHuffmanNode takes a slice of sorted huffmanCodes and builds a node in -// the Huffman tree at the given level. It returns the index of the newly -// constructed node. -func buildHuffmanNode(t *huffmanTree, codes []huffmanCode, level uint32) (nodeIndex uint16, err error) { - test := uint32(1) << (31 - level) - - // We have to search the list of codes to find the divide between the left and right sides. - firstRightIndex := len(codes) - for i, code := range codes { - if code.code&test != 0 { - firstRightIndex = i - break - } - } - - left := codes[:firstRightIndex] - right := codes[firstRightIndex:] - - if len(left) == 0 || len(right) == 0 { - // There is a superfluous level in the Huffman tree indicating - // a bug in the encoder. However, this bug has been observed in - // the wild so we handle it. - - // If this function was called recursively then we know that - // len(codes) >= 2 because, otherwise, we would have hit the - // "leaf node" case, below, and not recursed. - // - // However, for the initial call it's possible that len(codes) - // is zero or one. Both cases are invalid because a zero length - // tree cannot encode anything and a length-1 tree can only - // encode EOF and so is superfluous. We reject both. - if len(codes) < 2 { - return 0, StructuralError("empty Huffman tree") - } - - // In this case the recursion doesn't always reduce the length - // of codes so we need to ensure termination via another - // mechanism. - if level == 31 { - // Since len(codes) >= 2 the only way that the values - // can match at all 32 bits is if they are equal, which - // is invalid. This ensures that we never enter - // infinite recursion. - return 0, StructuralError("equal symbols in Huffman tree") - } - - if len(left) == 0 { - return buildHuffmanNode(t, right, level+1) - } - return buildHuffmanNode(t, left, level+1) - } - - nodeIndex = uint16(t.nextNode) - node := &t.nodes[t.nextNode] - t.nextNode++ - - if len(left) == 1 { - // leaf node - node.left = invalidNodeValue - node.leftValue = left[0].value - } else { - node.left, err = buildHuffmanNode(t, left, level+1) - } - - if err != nil { - return - } - - if len(right) == 1 { - // leaf node - node.right = invalidNodeValue - node.rightValue = right[0].value - } else { - node.right, err = buildHuffmanNode(t, right, level+1) - } - - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/move_to_front.go b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/move_to_front.go deleted file mode 100644 index 526dfb34cc06db6dcc2a61cc35e82b3e3b9bf0af..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/move_to_front.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package bzip2 - -// moveToFrontDecoder implements a move-to-front list. Such a list is an -// efficient way to transform a string with repeating elements into one with -// many small valued numbers, which is suitable for entropy encoding. It works -// by starting with an initial list of symbols and references symbols by their -// index into that list. When a symbol is referenced, it's moved to the front -// of the list. Thus, a repeated symbol ends up being encoded with many zeros, -// as the symbol will be at the front of the list after the first access. -type moveToFrontDecoder []byte - -// newMTFDecoder creates a move-to-front decoder with an explicit initial list -// of symbols. -func newMTFDecoder(symbols []byte) moveToFrontDecoder { - if len(symbols) > 256 { - panic("too many symbols") - } - return moveToFrontDecoder(symbols) -} - -// newMTFDecoderWithRange creates a move-to-front decoder with an initial -// symbol list of 0...n-1. -func newMTFDecoderWithRange(n int) moveToFrontDecoder { - if n > 256 { - panic("newMTFDecoderWithRange: cannot have > 256 symbols") - } - - m := make([]byte, n) - for i := 0; i < n; i++ { - m[i] = byte(i) - } - return moveToFrontDecoder(m) -} - -func (m moveToFrontDecoder) Decode(n int) (b byte) { - // Implement move-to-front with a simple copy. This approach - // beats more sophisticated approaches in benchmarking, probably - // because it has high locality of reference inside of a - // single cache line (most move-to-front operations have n < 64). - b = m[n] - copy(m[1:], m[:n]) - m[0] = b - return -} - -// First returns the symbol at the front of the list. -func (m moveToFrontDecoder) First() byte { - return m[0] -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 deleted file mode 100644 index 0bd61a6d4e369a68f7e1cbf2943526814fde53a8..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2 and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/e.txt.bz2 b/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/e.txt.bz2 deleted file mode 100644 index 65bf3b4c32a4742140c57c59ed46a06f859f9ca1..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/compress/bzip2/testdata/e.txt.bz2 and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/copy.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/copy.go deleted file mode 100644 index a3200a8f49e8cf106cbc77b0c1029c69877f797a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/copy.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -// forwardCopy is like the built-in copy function except that it always goes -// forward from the start, even if the dst and src overlap. -// It is equivalent to: -// for i := 0; i < n; i++ { -// mem[dst+i] = mem[src+i] -// } -func forwardCopy(mem []byte, dst, src, n int) { - if dst <= src { - copy(mem[dst:dst+n], mem[src:src+n]) - return - } - for { - if dst >= src+n { - copy(mem[dst:dst+n], mem[src:src+n]) - return - } - // There is some forward overlap. The destination - // will be filled with a repeated pattern of mem[src:src+k]. - // We copy one instance of the pattern here, then repeat. - // Each time around this loop k will double. - k := dst - src - copy(mem[dst:dst+k], mem[src:src+k]) - n -= k - dst += k - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/copy_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/copy_test.go deleted file mode 100644 index 2011b1547c934cccae2540cd378b600ce789a0e8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/copy_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "testing" -) - -func TestForwardCopy(t *testing.T) { - testCases := []struct { - dst0, dst1 int - src0, src1 int - want string - }{ - {0, 9, 0, 9, "012345678"}, - {0, 5, 4, 9, "45678"}, - {4, 9, 0, 5, "01230"}, - {1, 6, 3, 8, "34567"}, - {3, 8, 1, 6, "12121"}, - {0, 9, 3, 6, "345"}, - {3, 6, 0, 9, "012"}, - {1, 6, 0, 9, "00000"}, - {0, 4, 7, 8, "7"}, - {0, 1, 6, 8, "6"}, - {4, 4, 6, 9, ""}, - {2, 8, 6, 6, ""}, - {0, 0, 0, 0, ""}, - } - for _, tc := range testCases { - b := []byte("0123456789") - n := tc.dst1 - tc.dst0 - if tc.src1-tc.src0 < n { - n = tc.src1 - tc.src0 - } - forwardCopy(b, tc.dst0, tc.src0, n) - got := string(b[tc.dst0 : tc.dst0+n]) - if got != tc.want { - t.Errorf("dst=b[%d:%d], src=b[%d:%d]: got %q, want %q", - tc.dst0, tc.dst1, tc.src0, tc.src1, got, tc.want) - } - // Check that the bytes outside of dst[:n] were not modified. - for i, x := range b { - if i >= tc.dst0 && i < tc.dst0+n { - continue - } - if int(x) != '0'+i { - t.Errorf("dst=b[%d:%d], src=b[%d:%d]: copy overrun at b[%d]: got '%c', want '%c'", - tc.dst0, tc.dst1, tc.src0, tc.src1, i, x, '0'+i) - } - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate.go deleted file mode 100644 index 169a0c7b2ebe4b169212e73ddc7a6539ee8f7ac6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate.go +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "fmt" - "io" - "math" -) - -const ( - NoCompression = 0 - BestSpeed = 1 - fastCompression = 3 - BestCompression = 9 - DefaultCompression = -1 - logWindowSize = 15 - windowSize = 1 << logWindowSize - windowMask = windowSize - 1 - logMaxOffsetSize = 15 // Standard DEFLATE - minMatchLength = 3 // The smallest match that the compressor looks for - maxMatchLength = 258 // The longest match for the compressor - minOffsetSize = 1 // The shortest offset that makes any sense - - // The maximum number of tokens we put into a single flat block, just to - // stop things from getting too large. - maxFlateBlockTokens = 1 << 14 - maxStoreBlockSize = 65535 - hashBits = 17 - hashSize = 1 << hashBits - hashMask = (1 << hashBits) - 1 - hashShift = (hashBits + minMatchLength - 1) / minMatchLength - maxHashOffset = 1 << 24 - - skipNever = math.MaxInt32 -) - -type compressionLevel struct { - good, lazy, nice, chain, fastSkipHashing int -} - -var levels = []compressionLevel{ - {}, // 0 - // For levels 1-3 we don't bother trying with lazy matches - {3, 0, 8, 4, 4}, - {3, 0, 16, 8, 5}, - {3, 0, 32, 32, 6}, - // Levels 4-9 use increasingly more lazy matching - // and increasingly stringent conditions for "good enough". - {4, 4, 16, 16, skipNever}, - {8, 16, 32, 32, skipNever}, - {8, 16, 128, 128, skipNever}, - {8, 32, 128, 256, skipNever}, - {32, 128, 258, 1024, skipNever}, - {32, 258, 258, 4096, skipNever}, -} - -type compressor struct { - compressionLevel - - w *huffmanBitWriter - - // compression algorithm - fill func(*compressor, []byte) int // copy data to window - step func(*compressor) // process window - sync bool // requesting flush - - // Input hash chains - // hashHead[hashValue] contains the largest inputIndex with the specified hash value - // If hashHead[hashValue] is within the current window, then - // hashPrev[hashHead[hashValue] & windowMask] contains the previous index - // with the same hash value. - chainHead int - hashHead []int - hashPrev []int - hashOffset int - - // input window: unprocessed data is window[index:windowEnd] - index int - window []byte - windowEnd int - blockStart int // window index where current tokens start - byteAvailable bool // if true, still need to process window[index-1]. - - // queued output tokens - tokens []token - - // deflate state - length int - offset int - hash int - maxInsertIndex int - err error -} - -func (d *compressor) fillDeflate(b []byte) int { - if d.index >= 2*windowSize-(minMatchLength+maxMatchLength) { - // shift the window by windowSize - copy(d.window, d.window[windowSize:2*windowSize]) - d.index -= windowSize - d.windowEnd -= windowSize - if d.blockStart >= windowSize { - d.blockStart -= windowSize - } else { - d.blockStart = math.MaxInt32 - } - d.hashOffset += windowSize - if d.hashOffset > maxHashOffset { - delta := d.hashOffset - 1 - d.hashOffset -= delta - d.chainHead -= delta - for i, v := range d.hashPrev { - if v > delta { - d.hashPrev[i] -= delta - } else { - d.hashPrev[i] = 0 - } - } - for i, v := range d.hashHead { - if v > delta { - d.hashHead[i] -= delta - } else { - d.hashHead[i] = 0 - } - } - } - } - n := copy(d.window[d.windowEnd:], b) - d.windowEnd += n - return n -} - -func (d *compressor) writeBlock(tokens []token, index int, eof bool) error { - if index > 0 || eof { - var window []byte - if d.blockStart <= index { - window = d.window[d.blockStart:index] - } - d.blockStart = index - d.w.writeBlock(tokens, eof, window) - return d.w.err - } - return nil -} - -// Try to find a match starting at index whose length is greater than prevSize. -// We only look at chainCount possibilities before giving up. -func (d *compressor) findMatch(pos int, prevHead int, prevLength int, lookahead int) (length, offset int, ok bool) { - minMatchLook := maxMatchLength - if lookahead < minMatchLook { - minMatchLook = lookahead - } - - win := d.window[0 : pos+minMatchLook] - - // We quit when we get a match that's at least nice long - nice := len(win) - pos - if d.nice < nice { - nice = d.nice - } - - // If we've got a match that's good enough, only look in 1/4 the chain. - tries := d.chain - length = prevLength - if length >= d.good { - tries >>= 2 - } - - w0 := win[pos] - w1 := win[pos+1] - wEnd := win[pos+length] - minIndex := pos - windowSize - - for i := prevHead; tries > 0; tries-- { - if w0 == win[i] && w1 == win[i+1] && wEnd == win[i+length] { - // The hash function ensures that if win[i] and win[i+1] match, win[i+2] matches - - n := 3 - for pos+n < len(win) && win[i+n] == win[pos+n] { - n++ - } - if n > length && (n > 3 || pos-i <= 4096) { - length = n - offset = pos - i - ok = true - if n >= nice { - // The match is good enough that we don't try to find a better one. - break - } - wEnd = win[pos+n] - } - } - if i == minIndex { - // hashPrev[i & windowMask] has already been overwritten, so stop now. - break - } - if i = d.hashPrev[i&windowMask] - d.hashOffset; i < minIndex || i < 0 { - break - } - } - return -} - -func (d *compressor) writeStoredBlock(buf []byte) error { - if d.w.writeStoredHeader(len(buf), false); d.w.err != nil { - return d.w.err - } - d.w.writeBytes(buf) - return d.w.err -} - -func (d *compressor) initDeflate() { - d.hashHead = make([]int, hashSize) - d.hashPrev = make([]int, windowSize) - d.window = make([]byte, 2*windowSize) - d.hashOffset = 1 - d.tokens = make([]token, 0, maxFlateBlockTokens+1) - d.length = minMatchLength - 1 - d.offset = 0 - d.byteAvailable = false - d.index = 0 - d.hash = 0 - d.chainHead = -1 -} - -func (d *compressor) deflate() { - if d.windowEnd-d.index < minMatchLength+maxMatchLength && !d.sync { - return - } - - d.maxInsertIndex = d.windowEnd - (minMatchLength - 1) - if d.index < d.maxInsertIndex { - d.hash = int(d.window[d.index])< d.windowEnd { - panic("index > windowEnd") - } - lookahead := d.windowEnd - d.index - if lookahead < minMatchLength+maxMatchLength { - if !d.sync { - break Loop - } - if d.index > d.windowEnd { - panic("index > windowEnd") - } - if lookahead == 0 { - // Flush current output block if any. - if d.byteAvailable { - // There is still one pending token that needs to be flushed - d.tokens = append(d.tokens, literalToken(uint32(d.window[d.index-1]))) - d.byteAvailable = false - } - if len(d.tokens) > 0 { - if d.err = d.writeBlock(d.tokens, d.index, false); d.err != nil { - return - } - d.tokens = d.tokens[:0] - } - break Loop - } - } - if d.index < d.maxInsertIndex { - // Update the hash - d.hash = (d.hash<= minIndex && - (d.fastSkipHashing != skipNever && lookahead > minMatchLength-1 || - d.fastSkipHashing == skipNever && lookahead > prevLength && prevLength < d.lazy) { - if newLength, newOffset, ok := d.findMatch(d.index, d.chainHead-d.hashOffset, minMatchLength-1, lookahead); ok { - d.length = newLength - d.offset = newOffset - } - } - if d.fastSkipHashing != skipNever && d.length >= minMatchLength || - d.fastSkipHashing == skipNever && prevLength >= minMatchLength && d.length <= prevLength { - // There was a match at the previous step, and the current match is - // not better. Output the previous match. - if d.fastSkipHashing != skipNever { - d.tokens = append(d.tokens, matchToken(uint32(d.length-minMatchLength), uint32(d.offset-minOffsetSize))) - } else { - d.tokens = append(d.tokens, matchToken(uint32(prevLength-minMatchLength), uint32(prevOffset-minOffsetSize))) - } - // Insert in the hash table all strings up to the end of the match. - // index and index-1 are already inserted. If there is not enough - // lookahead, the last two strings are not inserted into the hash - // table. - if d.length <= d.fastSkipHashing { - var newIndex int - if d.fastSkipHashing != skipNever { - newIndex = d.index + d.length - } else { - newIndex = d.index + prevLength - 1 - } - for d.index++; d.index < newIndex; d.index++ { - if d.index < d.maxInsertIndex { - d.hash = (d.hash< 0 { - d.err = d.writeStoredBlock(d.window[:d.windowEnd]) - } - d.windowEnd = 0 -} - -func (d *compressor) write(b []byte) (n int, err error) { - n = len(b) - b = b[d.fill(d, b):] - for len(b) > 0 { - d.step(d) - b = b[d.fill(d, b):] - } - return n, d.err -} - -func (d *compressor) syncFlush() error { - d.sync = true - d.step(d) - if d.err == nil { - d.w.writeStoredHeader(0, false) - d.w.flush() - d.err = d.w.err - } - d.sync = false - return d.err -} - -func (d *compressor) init(w io.Writer, level int) (err error) { - d.w = newHuffmanBitWriter(w) - - switch { - case level == NoCompression: - d.window = make([]byte, maxStoreBlockSize) - d.fill = (*compressor).fillStore - d.step = (*compressor).store - case level == DefaultCompression: - level = 6 - fallthrough - case 1 <= level && level <= 9: - d.compressionLevel = levels[level] - d.initDeflate() - d.fill = (*compressor).fillDeflate - d.step = (*compressor).deflate - default: - return fmt.Errorf("flate: invalid compression level %d: want value in range [-1, 9]", level) - } - return nil -} - -var zeroes [32]int -var bzeroes [256]byte - -func (d *compressor) reset(w io.Writer) { - d.w.reset(w) - d.sync = false - d.err = nil - switch d.compressionLevel.chain { - case 0: - // level was NoCompression. - for i := range d.window { - d.window[i] = 0 - } - d.windowEnd = 0 - default: - d.chainHead = -1 - for s := d.hashHead; len(s) > 0; { - n := copy(s, zeroes[:]) - s = s[n:] - } - for s := d.hashPrev; len(s) > 0; s = s[len(zeroes):] { - copy(s, zeroes[:]) - } - d.hashOffset = 1 - - d.index, d.windowEnd = 0, 0 - for s := d.window; len(s) > 0; { - n := copy(s, bzeroes[:]) - s = s[n:] - } - d.blockStart, d.byteAvailable = 0, false - - d.tokens = d.tokens[:maxFlateBlockTokens+1] - for i := 0; i <= maxFlateBlockTokens; i++ { - d.tokens[i] = 0 - } - d.tokens = d.tokens[:0] - d.length = minMatchLength - 1 - d.offset = 0 - d.hash = 0 - d.maxInsertIndex = 0 - } -} - -func (d *compressor) close() error { - d.sync = true - d.step(d) - if d.err != nil { - return d.err - } - if d.w.writeStoredHeader(0, true); d.w.err != nil { - return d.w.err - } - d.w.flush() - return d.w.err -} - -// NewWriter returns a new Writer compressing data at the given level. -// Following zlib, levels range from 1 (BestSpeed) to 9 (BestCompression); -// higher levels typically run slower but compress more. Level 0 -// (NoCompression) does not attempt any compression; it only adds the -// necessary DEFLATE framing. Level -1 (DefaultCompression) uses the default -// compression level. -// -// If level is in the range [-1, 9] then the error returned will be nil. -// Otherwise the error returned will be non-nil. -func NewWriter(w io.Writer, level int) (*Writer, error) { - var dw Writer - if err := dw.d.init(w, level); err != nil { - return nil, err - } - return &dw, nil -} - -// NewWriterDict is like NewWriter but initializes the new -// Writer with a preset dictionary. The returned Writer behaves -// as if the dictionary had been written to it without producing -// any compressed output. The compressed data written to w -// can only be decompressed by a Reader initialized with the -// same dictionary. -func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) { - dw := &dictWriter{w, false} - zw, err := NewWriter(dw, level) - if err != nil { - return nil, err - } - zw.Write(dict) - zw.Flush() - dw.enabled = true - zw.dict = append(zw.dict, dict...) // duplicate dictionary for Reset method. - return zw, err -} - -type dictWriter struct { - w io.Writer - enabled bool -} - -func (w *dictWriter) Write(b []byte) (n int, err error) { - if w.enabled { - return w.w.Write(b) - } - return len(b), nil -} - -// A Writer takes data written to it and writes the compressed -// form of that data to an underlying writer (see NewWriter). -type Writer struct { - d compressor - dict []byte -} - -// Write writes data to w, which will eventually write the -// compressed form of data to its underlying writer. -func (w *Writer) Write(data []byte) (n int, err error) { - return w.d.write(data) -} - -// Flush flushes any pending compressed data to the underlying writer. -// It is useful mainly in compressed network protocols, to ensure that -// a remote reader has enough data to reconstruct a packet. -// Flush does not return until the data has been written. -// If the underlying writer returns an error, Flush returns that error. -// -// In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH. -func (w *Writer) Flush() error { - // For more about flushing: - // http://www.bolet.org/~pornin/deflate-flush.html - return w.d.syncFlush() -} - -// Close flushes and closes the writer. -func (w *Writer) Close() error { - return w.d.close() -} - -// Reset discards the writer's state and makes it equivalent to -// the result of NewWriter or NewWriterDict called with dst -// and w's level and dictionary. -func (w *Writer) Reset(dst io.Writer) { - if dw, ok := w.d.w.w.(*dictWriter); ok { - // w was created with NewWriterDict - dw.w = dst - w.d.reset(dw) - dw.enabled = false - w.Write(w.dict) - w.Flush() - dw.enabled = true - } else { - // w was created with NewWriter - w.d.reset(dst) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate_test.go deleted file mode 100644 index d5d6e732cf1192305a874a79e45f0ee35eb7a3d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/deflate_test.go +++ /dev/null @@ -1,490 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "reflect" - "sync" - "testing" -) - -type deflateTest struct { - in []byte - level int - out []byte -} - -type deflateInflateTest struct { - in []byte -} - -type reverseBitsTest struct { - in uint16 - bitCount uint8 - out uint16 -} - -var deflateTests = []*deflateTest{ - {[]byte{}, 0, []byte{1, 0, 0, 255, 255}}, - {[]byte{0x11}, -1, []byte{18, 4, 4, 0, 0, 255, 255}}, - {[]byte{0x11}, DefaultCompression, []byte{18, 4, 4, 0, 0, 255, 255}}, - {[]byte{0x11}, 4, []byte{18, 4, 4, 0, 0, 255, 255}}, - - {[]byte{0x11}, 0, []byte{0, 1, 0, 254, 255, 17, 1, 0, 0, 255, 255}}, - {[]byte{0x11, 0x12}, 0, []byte{0, 2, 0, 253, 255, 17, 18, 1, 0, 0, 255, 255}}, - {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 0, - []byte{0, 8, 0, 247, 255, 17, 17, 17, 17, 17, 17, 17, 17, 1, 0, 0, 255, 255}, - }, - {[]byte{}, 1, []byte{1, 0, 0, 255, 255}}, - {[]byte{0x11}, 1, []byte{18, 4, 4, 0, 0, 255, 255}}, - {[]byte{0x11, 0x12}, 1, []byte{18, 20, 2, 4, 0, 0, 255, 255}}, - {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 1, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}}, - {[]byte{}, 9, []byte{1, 0, 0, 255, 255}}, - {[]byte{0x11}, 9, []byte{18, 4, 4, 0, 0, 255, 255}}, - {[]byte{0x11, 0x12}, 9, []byte{18, 20, 2, 4, 0, 0, 255, 255}}, - {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, 9, []byte{18, 132, 2, 64, 0, 0, 0, 255, 255}}, -} - -var deflateInflateTests = []*deflateInflateTest{ - {[]byte{}}, - {[]byte{0x11}}, - {[]byte{0x11, 0x12}}, - {[]byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}}, - {[]byte{0x11, 0x10, 0x13, 0x41, 0x21, 0x21, 0x41, 0x13, 0x87, 0x78, 0x13}}, - {largeDataChunk()}, -} - -var reverseBitsTests = []*reverseBitsTest{ - {1, 1, 1}, - {1, 2, 2}, - {1, 3, 4}, - {1, 4, 8}, - {1, 5, 16}, - {17, 5, 17}, - {257, 9, 257}, - {29, 5, 23}, -} - -func largeDataChunk() []byte { - result := make([]byte, 100000) - for i := range result { - result[i] = byte(i * i & 0xFF) - } - return result -} - -func TestDeflate(t *testing.T) { - for _, h := range deflateTests { - var buf bytes.Buffer - w, err := NewWriter(&buf, h.level) - if err != nil { - t.Errorf("NewWriter: %v", err) - continue - } - w.Write(h.in) - w.Close() - if !bytes.Equal(buf.Bytes(), h.out) { - t.Errorf("Deflate(%d, %x) = %x, want %x", h.level, h.in, buf.Bytes(), h.out) - } - } -} - -// A sparseReader returns a stream consisting of 0s followed by 1<<16 1s. -// This tests missing hash references in a very large input. -type sparseReader struct { - l int64 - cur int64 -} - -func (r *sparseReader) Read(b []byte) (n int, err error) { - if r.cur >= r.l { - return 0, io.EOF - } - n = len(b) - cur := r.cur + int64(n) - if cur > r.l { - n -= int(cur - r.l) - cur = r.l - } - for i := range b[0:n] { - if r.cur+int64(i) >= r.l-1<<16 { - b[i] = 1 - } else { - b[i] = 0 - } - } - r.cur = cur - return -} - -func TestVeryLongSparseChunk(t *testing.T) { - if testing.Short() { - t.Skip("skipping sparse chunk during short test") - } - w, err := NewWriter(ioutil.Discard, 1) - if err != nil { - t.Errorf("NewWriter: %v", err) - return - } - if _, err = io.Copy(w, &sparseReader{l: 23E8}); err != nil { - t.Errorf("Compress failed: %v", err) - return - } -} - -type syncBuffer struct { - buf bytes.Buffer - mu sync.RWMutex - closed bool - ready chan bool -} - -func newSyncBuffer() *syncBuffer { - return &syncBuffer{ready: make(chan bool, 1)} -} - -func (b *syncBuffer) Read(p []byte) (n int, err error) { - for { - b.mu.RLock() - n, err = b.buf.Read(p) - b.mu.RUnlock() - if n > 0 || b.closed { - return - } - <-b.ready - } -} - -func (b *syncBuffer) signal() { - select { - case b.ready <- true: - default: - } -} - -func (b *syncBuffer) Write(p []byte) (n int, err error) { - n, err = b.buf.Write(p) - b.signal() - return -} - -func (b *syncBuffer) WriteMode() { - b.mu.Lock() -} - -func (b *syncBuffer) ReadMode() { - b.mu.Unlock() - b.signal() -} - -func (b *syncBuffer) Close() error { - b.closed = true - b.signal() - return nil -} - -func testSync(t *testing.T, level int, input []byte, name string) { - if len(input) == 0 { - return - } - - t.Logf("--testSync %d, %d, %s", level, len(input), name) - buf := newSyncBuffer() - buf1 := new(bytes.Buffer) - buf.WriteMode() - w, err := NewWriter(io.MultiWriter(buf, buf1), level) - if err != nil { - t.Errorf("NewWriter: %v", err) - return - } - r := NewReader(buf) - - // Write half the input and read back. - for i := 0; i < 2; i++ { - var lo, hi int - if i == 0 { - lo, hi = 0, (len(input)+1)/2 - } else { - lo, hi = (len(input)+1)/2, len(input) - } - t.Logf("#%d: write %d-%d", i, lo, hi) - if _, err := w.Write(input[lo:hi]); err != nil { - t.Errorf("testSync: write: %v", err) - return - } - if i == 0 { - if err := w.Flush(); err != nil { - t.Errorf("testSync: flush: %v", err) - return - } - } else { - if err := w.Close(); err != nil { - t.Errorf("testSync: close: %v", err) - } - } - buf.ReadMode() - out := make([]byte, hi-lo+1) - m, err := io.ReadAtLeast(r, out, hi-lo) - t.Logf("#%d: read %d", i, m) - if m != hi-lo || err != nil { - t.Errorf("testSync/%d (%d, %d, %s): read %d: %d, %v (%d left)", i, level, len(input), name, hi-lo, m, err, buf.buf.Len()) - return - } - if !bytes.Equal(input[lo:hi], out[:hi-lo]) { - t.Errorf("testSync/%d: read wrong bytes: %x vs %x", i, input[lo:hi], out[:hi-lo]) - return - } - // This test originally checked that after reading - // the first half of the input, there was nothing left - // in the read buffer (buf.buf.Len() != 0) but that is - // not necessarily the case: the write Flush may emit - // some extra framing bits that are not necessary - // to process to obtain the first half of the uncompressed - // data. The test ran correctly most of the time, because - // the background goroutine had usually read even - // those extra bits by now, but it's not a useful thing to - // check. - buf.WriteMode() - } - buf.ReadMode() - out := make([]byte, 10) - if n, err := r.Read(out); n > 0 || err != io.EOF { - t.Errorf("testSync (%d, %d, %s): final Read: %d, %v (hex: %x)", level, len(input), name, n, err, out[0:n]) - } - if buf.buf.Len() != 0 { - t.Errorf("testSync (%d, %d, %s): extra data at end", level, len(input), name) - } - r.Close() - - // stream should work for ordinary reader too - r = NewReader(buf1) - out, err = ioutil.ReadAll(r) - if err != nil { - t.Errorf("testSync: read: %s", err) - return - } - r.Close() - if !bytes.Equal(input, out) { - t.Errorf("testSync: decompress(compress(data)) != data: level=%d input=%s", level, name) - } -} - -func testToFromWithLevelAndLimit(t *testing.T, level int, input []byte, name string, limit int) { - var buffer bytes.Buffer - w, err := NewWriter(&buffer, level) - if err != nil { - t.Errorf("NewWriter: %v", err) - return - } - w.Write(input) - w.Close() - if limit > 0 && buffer.Len() > limit { - t.Errorf("level: %d, len(compress(data)) = %d > limit = %d", level, buffer.Len(), limit) - return - } - r := NewReader(&buffer) - out, err := ioutil.ReadAll(r) - if err != nil { - t.Errorf("read: %s", err) - return - } - r.Close() - if !bytes.Equal(input, out) { - t.Errorf("decompress(compress(data)) != data: level=%d input=%s", level, name) - return - } - testSync(t, level, input, name) -} - -func testToFromWithLimit(t *testing.T, input []byte, name string, limit [10]int) { - for i := 0; i < 10; i++ { - testToFromWithLevelAndLimit(t, i, input, name, limit[i]) - } -} - -func TestDeflateInflate(t *testing.T) { - for i, h := range deflateInflateTests { - testToFromWithLimit(t, h.in, fmt.Sprintf("#%d", i), [10]int{}) - } -} - -func TestReverseBits(t *testing.T) { - for _, h := range reverseBitsTests { - if v := reverseBits(h.in, h.bitCount); v != h.out { - t.Errorf("reverseBits(%v,%v) = %v, want %v", - h.in, h.bitCount, v, h.out) - } - } -} - -type deflateInflateStringTest struct { - filename string - label string - limit [10]int -} - -var deflateInflateStringTests = []deflateInflateStringTest{ - { - "../testdata/e.txt", - "2.718281828...", - [...]int{100018, 50650, 50960, 51150, 50930, 50790, 50790, 50790, 50790, 50790}, - }, - { - "../testdata/Mark.Twain-Tom.Sawyer.txt", - "Mark.Twain-Tom.Sawyer", - [...]int{407330, 187598, 180361, 172974, 169160, 163476, 160936, 160506, 160295, 160295}, - }, -} - -func TestDeflateInflateString(t *testing.T) { - for _, test := range deflateInflateStringTests { - gold, err := ioutil.ReadFile(test.filename) - if err != nil { - t.Error(err) - } - testToFromWithLimit(t, gold, test.label, test.limit) - if testing.Short() { - break - } - } -} - -func TestReaderDict(t *testing.T) { - const ( - dict = "hello world" - text = "hello again world" - ) - var b bytes.Buffer - w, err := NewWriter(&b, 5) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - w.Write([]byte(dict)) - w.Flush() - b.Reset() - w.Write([]byte(text)) - w.Close() - - r := NewReaderDict(&b, []byte(dict)) - data, err := ioutil.ReadAll(r) - if err != nil { - t.Fatal(err) - } - if string(data) != "hello again world" { - t.Fatalf("read returned %q want %q", string(data), text) - } -} - -func TestWriterDict(t *testing.T) { - const ( - dict = "hello world" - text = "hello again world" - ) - var b bytes.Buffer - w, err := NewWriter(&b, 5) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - w.Write([]byte(dict)) - w.Flush() - b.Reset() - w.Write([]byte(text)) - w.Close() - - var b1 bytes.Buffer - w, _ = NewWriterDict(&b1, 5, []byte(dict)) - w.Write([]byte(text)) - w.Close() - - if !bytes.Equal(b1.Bytes(), b.Bytes()) { - t.Fatalf("writer wrote %q want %q", b1.Bytes(), b.Bytes()) - } -} - -// See https://golang.org/issue/2508 -func TestRegression2508(t *testing.T) { - if testing.Short() { - t.Logf("test disabled with -short") - return - } - w, err := NewWriter(ioutil.Discard, 1) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - buf := make([]byte, 1024) - for i := 0; i < 131072; i++ { - if _, err := w.Write(buf); err != nil { - t.Fatalf("writer failed: %v", err) - } - } - w.Close() -} - -func TestWriterReset(t *testing.T) { - for level := 0; level <= 9; level++ { - if testing.Short() && level > 1 { - break - } - w, err := NewWriter(ioutil.Discard, level) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - buf := []byte("hello world") - for i := 0; i < 1024; i++ { - w.Write(buf) - } - w.Reset(ioutil.Discard) - - wref, err := NewWriter(ioutil.Discard, level) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - - // DeepEqual doesn't compare functions. - w.d.fill, wref.d.fill = nil, nil - w.d.step, wref.d.step = nil, nil - if !reflect.DeepEqual(w, wref) { - t.Errorf("level %d Writer not reset after Reset", level) - } - } - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriter(w, NoCompression) }) - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriter(w, DefaultCompression) }) - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriter(w, BestCompression) }) - dict := []byte("we are the world") - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriterDict(w, NoCompression, dict) }) - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriterDict(w, DefaultCompression, dict) }) - testResetOutput(t, func(w io.Writer) (*Writer, error) { return NewWriterDict(w, BestCompression, dict) }) -} - -func testResetOutput(t *testing.T, newWriter func(w io.Writer) (*Writer, error)) { - buf := new(bytes.Buffer) - w, err := newWriter(buf) - if err != nil { - t.Fatalf("NewWriter: %v", err) - } - b := []byte("hello world") - for i := 0; i < 1024; i++ { - w.Write(b) - } - w.Close() - out1 := buf.String() - - buf2 := new(bytes.Buffer) - w.Reset(buf2) - for i := 0; i < 1024; i++ { - w.Write(b) - } - w.Close() - out2 := buf2.String() - - if out1 != out2 { - t.Errorf("got %q, expected %q", out2, out1) - } - t.Logf("got %d bytes", len(out1)) -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/fixedhuff.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/fixedhuff.go deleted file mode 100644 index 7df8b9a293f796637caa09df0678ea43bb2be702..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/fixedhuff.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -// autogenerated by go run gen.go -output fixedhuff.go, DO NOT EDIT - -var fixedHuffmanDecoder = huffmanDecoder{ - 7, - [huffmanNumChunks]uint32{ - 0x1007, 0x0508, 0x0108, 0x1188, 0x1107, 0x0708, 0x0308, 0x0c09, - 0x1087, 0x0608, 0x0208, 0x0a09, 0x0008, 0x0808, 0x0408, 0x0e09, - 0x1047, 0x0588, 0x0188, 0x0909, 0x1147, 0x0788, 0x0388, 0x0d09, - 0x10c7, 0x0688, 0x0288, 0x0b09, 0x0088, 0x0888, 0x0488, 0x0f09, - 0x1027, 0x0548, 0x0148, 0x11c8, 0x1127, 0x0748, 0x0348, 0x0c89, - 0x10a7, 0x0648, 0x0248, 0x0a89, 0x0048, 0x0848, 0x0448, 0x0e89, - 0x1067, 0x05c8, 0x01c8, 0x0989, 0x1167, 0x07c8, 0x03c8, 0x0d89, - 0x10e7, 0x06c8, 0x02c8, 0x0b89, 0x00c8, 0x08c8, 0x04c8, 0x0f89, - 0x1017, 0x0528, 0x0128, 0x11a8, 0x1117, 0x0728, 0x0328, 0x0c49, - 0x1097, 0x0628, 0x0228, 0x0a49, 0x0028, 0x0828, 0x0428, 0x0e49, - 0x1057, 0x05a8, 0x01a8, 0x0949, 0x1157, 0x07a8, 0x03a8, 0x0d49, - 0x10d7, 0x06a8, 0x02a8, 0x0b49, 0x00a8, 0x08a8, 0x04a8, 0x0f49, - 0x1037, 0x0568, 0x0168, 0x11e8, 0x1137, 0x0768, 0x0368, 0x0cc9, - 0x10b7, 0x0668, 0x0268, 0x0ac9, 0x0068, 0x0868, 0x0468, 0x0ec9, - 0x1077, 0x05e8, 0x01e8, 0x09c9, 0x1177, 0x07e8, 0x03e8, 0x0dc9, - 0x10f7, 0x06e8, 0x02e8, 0x0bc9, 0x00e8, 0x08e8, 0x04e8, 0x0fc9, - 0x1007, 0x0518, 0x0118, 0x1198, 0x1107, 0x0718, 0x0318, 0x0c29, - 0x1087, 0x0618, 0x0218, 0x0a29, 0x0018, 0x0818, 0x0418, 0x0e29, - 0x1047, 0x0598, 0x0198, 0x0929, 0x1147, 0x0798, 0x0398, 0x0d29, - 0x10c7, 0x0698, 0x0298, 0x0b29, 0x0098, 0x0898, 0x0498, 0x0f29, - 0x1027, 0x0558, 0x0158, 0x11d8, 0x1127, 0x0758, 0x0358, 0x0ca9, - 0x10a7, 0x0658, 0x0258, 0x0aa9, 0x0058, 0x0858, 0x0458, 0x0ea9, - 0x1067, 0x05d8, 0x01d8, 0x09a9, 0x1167, 0x07d8, 0x03d8, 0x0da9, - 0x10e7, 0x06d8, 0x02d8, 0x0ba9, 0x00d8, 0x08d8, 0x04d8, 0x0fa9, - 0x1017, 0x0538, 0x0138, 0x11b8, 0x1117, 0x0738, 0x0338, 0x0c69, - 0x1097, 0x0638, 0x0238, 0x0a69, 0x0038, 0x0838, 0x0438, 0x0e69, - 0x1057, 0x05b8, 0x01b8, 0x0969, 0x1157, 0x07b8, 0x03b8, 0x0d69, - 0x10d7, 0x06b8, 0x02b8, 0x0b69, 0x00b8, 0x08b8, 0x04b8, 0x0f69, - 0x1037, 0x0578, 0x0178, 0x11f8, 0x1137, 0x0778, 0x0378, 0x0ce9, - 0x10b7, 0x0678, 0x0278, 0x0ae9, 0x0078, 0x0878, 0x0478, 0x0ee9, - 0x1077, 0x05f8, 0x01f8, 0x09e9, 0x1177, 0x07f8, 0x03f8, 0x0de9, - 0x10f7, 0x06f8, 0x02f8, 0x0be9, 0x00f8, 0x08f8, 0x04f8, 0x0fe9, - 0x1007, 0x0508, 0x0108, 0x1188, 0x1107, 0x0708, 0x0308, 0x0c19, - 0x1087, 0x0608, 0x0208, 0x0a19, 0x0008, 0x0808, 0x0408, 0x0e19, - 0x1047, 0x0588, 0x0188, 0x0919, 0x1147, 0x0788, 0x0388, 0x0d19, - 0x10c7, 0x0688, 0x0288, 0x0b19, 0x0088, 0x0888, 0x0488, 0x0f19, - 0x1027, 0x0548, 0x0148, 0x11c8, 0x1127, 0x0748, 0x0348, 0x0c99, - 0x10a7, 0x0648, 0x0248, 0x0a99, 0x0048, 0x0848, 0x0448, 0x0e99, - 0x1067, 0x05c8, 0x01c8, 0x0999, 0x1167, 0x07c8, 0x03c8, 0x0d99, - 0x10e7, 0x06c8, 0x02c8, 0x0b99, 0x00c8, 0x08c8, 0x04c8, 0x0f99, - 0x1017, 0x0528, 0x0128, 0x11a8, 0x1117, 0x0728, 0x0328, 0x0c59, - 0x1097, 0x0628, 0x0228, 0x0a59, 0x0028, 0x0828, 0x0428, 0x0e59, - 0x1057, 0x05a8, 0x01a8, 0x0959, 0x1157, 0x07a8, 0x03a8, 0x0d59, - 0x10d7, 0x06a8, 0x02a8, 0x0b59, 0x00a8, 0x08a8, 0x04a8, 0x0f59, - 0x1037, 0x0568, 0x0168, 0x11e8, 0x1137, 0x0768, 0x0368, 0x0cd9, - 0x10b7, 0x0668, 0x0268, 0x0ad9, 0x0068, 0x0868, 0x0468, 0x0ed9, - 0x1077, 0x05e8, 0x01e8, 0x09d9, 0x1177, 0x07e8, 0x03e8, 0x0dd9, - 0x10f7, 0x06e8, 0x02e8, 0x0bd9, 0x00e8, 0x08e8, 0x04e8, 0x0fd9, - 0x1007, 0x0518, 0x0118, 0x1198, 0x1107, 0x0718, 0x0318, 0x0c39, - 0x1087, 0x0618, 0x0218, 0x0a39, 0x0018, 0x0818, 0x0418, 0x0e39, - 0x1047, 0x0598, 0x0198, 0x0939, 0x1147, 0x0798, 0x0398, 0x0d39, - 0x10c7, 0x0698, 0x0298, 0x0b39, 0x0098, 0x0898, 0x0498, 0x0f39, - 0x1027, 0x0558, 0x0158, 0x11d8, 0x1127, 0x0758, 0x0358, 0x0cb9, - 0x10a7, 0x0658, 0x0258, 0x0ab9, 0x0058, 0x0858, 0x0458, 0x0eb9, - 0x1067, 0x05d8, 0x01d8, 0x09b9, 0x1167, 0x07d8, 0x03d8, 0x0db9, - 0x10e7, 0x06d8, 0x02d8, 0x0bb9, 0x00d8, 0x08d8, 0x04d8, 0x0fb9, - 0x1017, 0x0538, 0x0138, 0x11b8, 0x1117, 0x0738, 0x0338, 0x0c79, - 0x1097, 0x0638, 0x0238, 0x0a79, 0x0038, 0x0838, 0x0438, 0x0e79, - 0x1057, 0x05b8, 0x01b8, 0x0979, 0x1157, 0x07b8, 0x03b8, 0x0d79, - 0x10d7, 0x06b8, 0x02b8, 0x0b79, 0x00b8, 0x08b8, 0x04b8, 0x0f79, - 0x1037, 0x0578, 0x0178, 0x11f8, 0x1137, 0x0778, 0x0378, 0x0cf9, - 0x10b7, 0x0678, 0x0278, 0x0af9, 0x0078, 0x0878, 0x0478, 0x0ef9, - 0x1077, 0x05f8, 0x01f8, 0x09f9, 0x1177, 0x07f8, 0x03f8, 0x0df9, - 0x10f7, 0x06f8, 0x02f8, 0x0bf9, 0x00f8, 0x08f8, 0x04f8, 0x0ff9, - }, - nil, 0, -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/flate_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/flate_test.go deleted file mode 100644 index 3f67025cd76b5f98ba26bc615dd87a80d28bd583..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/flate_test.go +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This test tests some internals of the flate package. -// The tests in package compress/gzip serve as the -// end-to-end test of the decompressor. - -package flate - -import ( - "bytes" - "encoding/hex" - "io/ioutil" - "testing" -) - -// The following test should not panic. -func TestIssue5915(t *testing.T) { - bits := []int{4, 0, 0, 6, 4, 3, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0, 5, 5, 6, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 6, 0, 11, 0, 8, 0, 6, 6, 10, 8} - var h huffmanDecoder - if h.init(bits) { - t.Fatalf("Given sequence of bits is bad, and should not succeed.") - } -} - -// The following test should not panic. -func TestIssue5962(t *testing.T) { - bits := []int{4, 0, 0, 6, 4, 3, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0, - 5, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11} - var h huffmanDecoder - if h.init(bits) { - t.Fatalf("Given sequence of bits is bad, and should not succeed.") - } -} - -// The following test should not panic. -func TestIssue6255(t *testing.T) { - bits1 := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11} - bits2 := []int{11, 13} - var h huffmanDecoder - if !h.init(bits1) { - t.Fatalf("Given sequence of bits is good and should succeed.") - } - if h.init(bits2) { - t.Fatalf("Given sequence of bits is bad and should not succeed.") - } -} - -func TestInvalidEncoding(t *testing.T) { - // Initialize Huffman decoder to recognize "0". - var h huffmanDecoder - if !h.init([]int{1}) { - t.Fatal("Failed to initialize Huffman decoder") - } - - // Initialize decompressor with invalid Huffman coding. - var f decompressor - f.r = bytes.NewReader([]byte{0xff}) - - _, err := f.huffSym(&h) - if err == nil { - t.Fatal("Should have rejected invalid bit sequence") - } -} - -func TestInvalidBits(t *testing.T) { - oversubscribed := []int{1, 2, 3, 4, 4, 5} - incomplete := []int{1, 2, 4, 4} - var h huffmanDecoder - if h.init(oversubscribed) { - t.Fatal("Should reject oversubscribed bit-length set") - } - if h.init(incomplete) { - t.Fatal("Should reject incomplete bit-length set") - } -} - -func TestStreams(t *testing.T) { - // To verify any of these hexstrings as valid or invalid flate streams - // according to the C zlib library, you can use the Python wrapper library: - // >>> hex_string = "010100feff11" - // >>> import zlib - // >>> zlib.decompress(hex_string.decode("hex"), -15) # Negative means raw DEFLATE - // '\x11' - - testCases := []struct { - desc string // Description of the stream - stream string // Hexstring of the input DEFLATE stream - want string // Expected result. Use "fail" to expect failure - }{{ - "degenerate HCLenTree", - "05e0010000000000100000000000000000000000000000000000000000000000" + - "00000000000000000004", - "fail", - }, { - "complete HCLenTree, empty HLitTree, empty HDistTree", - "05e0010400000000000000000000000000000000000000000000000000000000" + - "00000000000000000010", - "fail", - }, { - "empty HCLenTree", - "05e0010000000000000000000000000000000000000000000000000000000000" + - "00000000000000000010", - "fail", - }, { - "complete HCLenTree, complete HLitTree, empty HDistTree, use missing HDist symbol", - "000100feff000de0010400000000100000000000000000000000000000000000" + - "0000000000000000000000000000002c", - "fail", - }, { - "complete HCLenTree, complete HLitTree, degenerate HDistTree, use missing HDist symbol", - "000100feff000de0010000000000000000000000000000000000000000000000" + - "00000000000000000610000000004070", - "fail", - }, { - "complete HCLenTree, empty HLitTree, empty HDistTree", - "05e0010400000000100400000000000000000000000000000000000000000000" + - "0000000000000000000000000008", - "fail", - }, { - "complete HCLenTree, empty HLitTree, degenerate HDistTree", - "05e0010400000000100400000000000000000000000000000000000000000000" + - "0000000000000000000800000008", - "fail", - }, { - "complete HCLenTree, degenerate HLitTree, degenerate HDistTree, use missing HLit symbol", - "05e0010400000000100000000000000000000000000000000000000000000000" + - "0000000000000000001c", - "fail", - }, { - "complete HCLenTree, complete HLitTree, too large HDistTree", - "edff870500000000200400000000000000000000000000000000000000000000" + - "000000000000000000080000000000000004", - "fail", - }, { - "complete HCLenTree, complete HLitTree, empty HDistTree, excessive repeater code", - "edfd870500000000200400000000000000000000000000000000000000000000" + - "000000000000000000e8b100", - "fail", - }, { - "complete HCLenTree, complete HLitTree, empty HDistTree of normal length 30", - "05fd01240000000000f8ffffffffffffffffffffffffffffffffffffffffffff" + - "ffffffffffffffffff07000000fe01", - "", - }, { - "complete HCLenTree, complete HLitTree, empty HDistTree of excessive length 31", - "05fe01240000000000f8ffffffffffffffffffffffffffffffffffffffffffff" + - "ffffffffffffffffff07000000fc03", - "fail", - }, { - "complete HCLenTree, over-subscribed HLitTree, empty HDistTree", - "05e001240000000000fcffffffffffffffffffffffffffffffffffffffffffff" + - "ffffffffffffffffff07f00f", - "fail", - }, { - "complete HCLenTree, under-subscribed HLitTree, empty HDistTree", - "05e001240000000000fcffffffffffffffffffffffffffffffffffffffffffff" + - "fffffffffcffffffff07f00f", - "fail", - }, { - "complete HCLenTree, complete HLitTree with single code, empty HDistTree", - "05e001240000000000f8ffffffffffffffffffffffffffffffffffffffffffff" + - "ffffffffffffffffff07f00f", - "01", - }, { - "complete HCLenTree, complete HLitTree with multiple codes, empty HDistTree", - "05e301240000000000f8ffffffffffffffffffffffffffffffffffffffffffff" + - "ffffffffffffffffff07807f", - "01", - }, { - "complete HCLenTree, complete HLitTree, degenerate HDistTree, use valid HDist symbol", - "000100feff000de0010400000000100000000000000000000000000000000000" + - "0000000000000000000000000000003c", - "00000000", - }, { - "complete HCLenTree, degenerate HLitTree, degenerate HDistTree", - "05e0010400000000100000000000000000000000000000000000000000000000" + - "0000000000000000000c", - "", - }, { - "complete HCLenTree, degenerate HLitTree, empty HDistTree", - "05e0010400000000100000000000000000000000000000000000000000000000" + - "00000000000000000004", - "", - }, { - "complete HCLenTree, complete HLitTree, empty HDistTree, spanning repeater code", - "edfd870500000000200400000000000000000000000000000000000000000000" + - "000000000000000000e8b000", - "", - }, { - "complete HCLenTree with length codes, complete HLitTree, empty HDistTree", - "ede0010400000000100000000000000000000000000000000000000000000000" + - "0000000000000000000400004000", - "", - }, { - "complete HCLenTree, complete HLitTree, degenerate HDistTree, use valid HLit symbol 284 with count 31", - "000100feff00ede0010400000000100000000000000000000000000000000000" + - "000000000000000000000000000000040000407f00", - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "0000000000000000000000000000000000000000000000000000000000000000" + - "000000", - }, { - "complete HCLenTree, complete HLitTree, degenerate HDistTree, use valid HLit and HDist symbols", - "0cc2010d00000082b0ac4aff0eb07d27060000ffff", - "616263616263", - }, { - "fixed block, use reserved symbol 287", - "33180700", - "fail", - }, { - "raw block", - "010100feff11", - "11", - }, { - "issue 10426 - over-subscribed HCLenTree causes a hang", - "344c4a4e494d4b070000ff2e2eff2e2e2e2e2eff", - "fail", - }, { - "issue 11030 - empty HDistTree unexpectedly leads to error", - "05c0070600000080400fff37a0ca", - "", - }, { - "issue 11033 - empty HDistTree unexpectedly leads to error", - "050fb109c020cca5d017dcbca044881ee1034ec149c8980bbc413c2ab35be9dc" + - "b1473449922449922411202306ee97b0383a521b4ffdcf3217f9f7d3adb701", - "3130303634342068652e706870005d05355f7ed957ff084a90925d19e3ebc6d0" + - "c6d7", - }} - - for i, tc := range testCases { - data, err := hex.DecodeString(tc.stream) - if err != nil { - t.Fatal(err) - } - data, err = ioutil.ReadAll(NewReader(bytes.NewReader(data))) - if tc.want == "fail" { - if err == nil { - t.Errorf("#%d (%s): got nil error, want non-nil", i, tc.desc) - } - } else { - if err != nil { - t.Errorf("#%d (%s): %v", i, tc.desc, err) - continue - } - if got := hex.EncodeToString(data); got != tc.want { - t.Errorf("#%d (%s):\ngot %q\nwant %q", i, tc.desc, got, tc.want) - } - - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/gen.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/gen.go deleted file mode 100644 index 154c89a488e08c2ed8d321e6034d88124a7e0b8e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/gen.go +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// This program generates fixedhuff.go -// Invoke as -// -// go run gen.go -output fixedhuff.go - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/format" - "io/ioutil" - "log" -) - -var filename = flag.String("output", "fixedhuff.go", "output file name") - -const maxCodeLen = 16 - -// Note: the definition of the huffmanDecoder struct is copied from -// inflate.go, as it is private to the implementation. - -// chunk & 15 is number of bits -// chunk >> 4 is value, including table link - -const ( - huffmanChunkBits = 9 - huffmanNumChunks = 1 << huffmanChunkBits - huffmanCountMask = 15 - huffmanValueShift = 4 -) - -type huffmanDecoder struct { - min int // the minimum code length - chunks [huffmanNumChunks]uint32 // chunks as described above - links [][]uint32 // overflow links - linkMask uint32 // mask the width of the link table -} - -// Initialize Huffman decoding tables from array of code lengths. -// Following this function, h is guaranteed to be initialized into a complete -// tree (i.e., neither over-subscribed nor under-subscribed). The exception is a -// degenerate case where the tree has only a single symbol with length 1. Empty -// trees are permitted. -func (h *huffmanDecoder) init(bits []int) bool { - // Sanity enables additional runtime tests during Huffman - // table construction. It's intended to be used during - // development to supplement the currently ad-hoc unit tests. - const sanity = false - - if h.min != 0 { - *h = huffmanDecoder{} - } - - // Count number of codes of each length, - // compute min and max length. - var count [maxCodeLen]int - var min, max int - for _, n := range bits { - if n == 0 { - continue - } - if min == 0 || n < min { - min = n - } - if n > max { - max = n - } - count[n]++ - } - - // Empty tree. The decompressor.huffSym function will fail later if the tree - // is used. Technically, an empty tree is only valid for the HDIST tree and - // not the HCLEN and HLIT tree. However, a stream with an empty HCLEN tree - // is guaranteed to fail since it will attempt to use the tree to decode the - // codes for the HLIT and HDIST trees. Similarly, an empty HLIT tree is - // guaranteed to fail later since the compressed data section must be - // composed of at least one symbol (the end-of-block marker). - if max == 0 { - return true - } - - code := 0 - var nextcode [maxCodeLen]int - for i := min; i <= max; i++ { - code <<= 1 - nextcode[i] = code - code += count[i] - } - - // Check that the coding is complete (i.e., that we've - // assigned all 2-to-the-max possible bit sequences). - // Exception: To be compatible with zlib, we also need to - // accept degenerate single-code codings. See also - // TestDegenerateHuffmanCoding. - if code != 1< huffmanChunkBits { - numLinks := 1 << (uint(max) - huffmanChunkBits) - h.linkMask = uint32(numLinks - 1) - - // create link tables - link := nextcode[huffmanChunkBits+1] >> 1 - h.links = make([][]uint32, huffmanNumChunks-link) - for j := uint(link); j < huffmanNumChunks; j++ { - reverse := int(reverseByte[j>>8]) | int(reverseByte[j&0xff])<<8 - reverse >>= uint(16 - huffmanChunkBits) - off := j - uint(link) - if sanity && h.chunks[reverse] != 0 { - panic("impossible: overwriting existing chunk") - } - h.chunks[reverse] = uint32(off<>8]) | int(reverseByte[code&0xff])<<8 - reverse >>= uint(16 - n) - if n <= huffmanChunkBits { - for off := reverse; off < len(h.chunks); off += 1 << uint(n) { - // We should never need to overwrite - // an existing chunk. Also, 0 is - // never a valid chunk, because the - // lower 4 "count" bits should be - // between 1 and 15. - if sanity && h.chunks[off] != 0 { - panic("impossible: overwriting existing chunk") - } - h.chunks[off] = chunk - } - } else { - j := reverse & (huffmanNumChunks - 1) - if sanity && h.chunks[j]&huffmanCountMask != huffmanChunkBits+1 { - // Longer codes should have been - // associated with a link table above. - panic("impossible: not an indirect chunk") - } - value := h.chunks[j] >> huffmanValueShift - linktab := h.links[value] - reverse >>= huffmanChunkBits - for off := reverse; off < len(linktab); off += 1 << uint(n-huffmanChunkBits) { - if sanity && linktab[off] != 0 { - panic("impossible: overwriting existing chunk") - } - linktab[off] = chunk - } - } - } - - if sanity { - // Above we've sanity checked that we never overwrote - // an existing entry. Here we additionally check that - // we filled the tables completely. - for i, chunk := range h.chunks { - if chunk == 0 { - // As an exception, in the degenerate - // single-code case, we allow odd - // chunks to be missing. - if code == 1 && i%2 == 1 { - continue - } - panic("impossible: missing chunk") - } - } - for _, linktab := range h.links { - for _, chunk := range linktab { - if chunk == 0 { - panic("impossible: missing chunk") - } - } - } - } - - return true -} - -func main() { - flag.Parse() - - var h huffmanDecoder - var bits [288]int - initReverseByte() - for i := 0; i < 144; i++ { - bits[i] = 8 - } - for i := 144; i < 256; i++ { - bits[i] = 9 - } - for i := 256; i < 280; i++ { - bits[i] = 7 - } - for i := 280; i < 288; i++ { - bits[i] = 8 - } - h.init(bits[:]) - if h.links != nil { - log.Fatal("Unexpected links table in fixed Huffman decoder") - } - - var buf bytes.Buffer - - fmt.Fprintf(&buf, `// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file.`+"\n\n") - - fmt.Fprintln(&buf, "package flate") - fmt.Fprintln(&buf) - fmt.Fprintln(&buf, "// autogenerated by go run gen.go -output fixedhuff.go, DO NOT EDIT") - fmt.Fprintln(&buf) - fmt.Fprintln(&buf, "var fixedHuffmanDecoder = huffmanDecoder{") - fmt.Fprintf(&buf, "\t%d,\n", h.min) - fmt.Fprintln(&buf, "\t[huffmanNumChunks]uint32{") - for i := 0; i < huffmanNumChunks; i++ { - if i&7 == 0 { - fmt.Fprintf(&buf, "\t\t") - } else { - fmt.Fprintf(&buf, " ") - } - fmt.Fprintf(&buf, "0x%04x,", h.chunks[i]) - if i&7 == 7 { - fmt.Fprintln(&buf) - } - } - fmt.Fprintln(&buf, "\t},") - fmt.Fprintln(&buf, "\tnil, 0,") - fmt.Fprintln(&buf, "}") - - data, err := format.Source(buf.Bytes()) - if err != nil { - log.Fatal(err) - } - err = ioutil.WriteFile(*filename, data, 0644) - if err != nil { - log.Fatal(err) - } -} - -var reverseByte [256]byte - -func initReverseByte() { - for x := 0; x < 256; x++ { - var result byte - for i := uint(0); i < 8; i++ { - result |= byte(((x >> i) & 1) << (7 - i)) - } - reverseByte[x] = result - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_bit_writer.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_bit_writer.go deleted file mode 100644 index 616440412e4b2b869d22859bd873ea43a8145286..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_bit_writer.go +++ /dev/null @@ -1,517 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "io" - "math" -) - -const ( - // The largest offset code. - offsetCodeCount = 30 - - // The special code used to mark the end of a block. - endBlockMarker = 256 - - // The first length code. - lengthCodesStart = 257 - - // The number of codegen codes. - codegenCodeCount = 19 - badCode = 255 -) - -// The number of extra bits needed by length code X - LENGTH_CODES_START. -var lengthExtraBits = []int8{ - /* 257 */ 0, 0, 0, - /* 260 */ 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, - /* 270 */ 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, - /* 280 */ 4, 5, 5, 5, 5, 0, -} - -// The length indicated by length code X - LENGTH_CODES_START. -var lengthBase = []uint32{ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, - 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, - 64, 80, 96, 112, 128, 160, 192, 224, 255, -} - -// offset code word extra bits. -var offsetExtraBits = []int8{ - 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, - 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, - /* extended window */ - 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, -} - -var offsetBase = []uint32{ - /* normal deflate */ - 0x000000, 0x000001, 0x000002, 0x000003, 0x000004, - 0x000006, 0x000008, 0x00000c, 0x000010, 0x000018, - 0x000020, 0x000030, 0x000040, 0x000060, 0x000080, - 0x0000c0, 0x000100, 0x000180, 0x000200, 0x000300, - 0x000400, 0x000600, 0x000800, 0x000c00, 0x001000, - 0x001800, 0x002000, 0x003000, 0x004000, 0x006000, - - /* extended window */ - 0x008000, 0x00c000, 0x010000, 0x018000, 0x020000, - 0x030000, 0x040000, 0x060000, 0x080000, 0x0c0000, - 0x100000, 0x180000, 0x200000, 0x300000, -} - -// The odd order in which the codegen code sizes are written. -var codegenOrder = []uint32{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} - -type huffmanBitWriter struct { - w io.Writer - // Data waiting to be written is bytes[0:nbytes] - // and then the low nbits of bits. - bits uint32 - nbits uint32 - bytes [64]byte - nbytes int - literalFreq []int32 - offsetFreq []int32 - codegen []uint8 - codegenFreq []int32 - literalEncoding *huffmanEncoder - offsetEncoding *huffmanEncoder - codegenEncoding *huffmanEncoder - err error -} - -func newHuffmanBitWriter(w io.Writer) *huffmanBitWriter { - return &huffmanBitWriter{ - w: w, - literalFreq: make([]int32, maxNumLit), - offsetFreq: make([]int32, offsetCodeCount), - codegen: make([]uint8, maxNumLit+offsetCodeCount+1), - codegenFreq: make([]int32, codegenCodeCount), - literalEncoding: newHuffmanEncoder(maxNumLit), - offsetEncoding: newHuffmanEncoder(offsetCodeCount), - codegenEncoding: newHuffmanEncoder(codegenCodeCount), - } -} - -func (w *huffmanBitWriter) reset(writer io.Writer) { - w.w = writer - w.bits, w.nbits, w.nbytes, w.err = 0, 0, 0, nil - w.bytes = [64]byte{} - for i := range w.codegen { - w.codegen[i] = 0 - } - for _, s := range [...][]int32{w.literalFreq, w.offsetFreq, w.codegenFreq} { - for i := range s { - s[i] = 0 - } - } - for _, enc := range [...]*huffmanEncoder{ - w.literalEncoding, - w.offsetEncoding, - w.codegenEncoding} { - for i := range enc.code { - enc.code[i] = 0 - } - for i := range enc.codeBits { - enc.codeBits[i] = 0 - } - } -} - -func (w *huffmanBitWriter) flushBits() { - if w.err != nil { - w.nbits = 0 - return - } - bits := w.bits - w.bits >>= 16 - w.nbits -= 16 - n := w.nbytes - w.bytes[n] = byte(bits) - w.bytes[n+1] = byte(bits >> 8) - if n += 2; n >= len(w.bytes) { - _, w.err = w.w.Write(w.bytes[0:]) - n = 0 - } - w.nbytes = n -} - -func (w *huffmanBitWriter) flush() { - if w.err != nil { - w.nbits = 0 - return - } - n := w.nbytes - if w.nbits > 8 { - w.bytes[n] = byte(w.bits) - w.bits >>= 8 - w.nbits -= 8 - n++ - } - if w.nbits > 0 { - w.bytes[n] = byte(w.bits) - w.nbits = 0 - n++ - } - w.bits = 0 - _, w.err = w.w.Write(w.bytes[0:n]) - w.nbytes = 0 -} - -func (w *huffmanBitWriter) writeBits(b, nb int32) { - w.bits |= uint32(b) << w.nbits - if w.nbits += uint32(nb); w.nbits >= 16 { - w.flushBits() - } -} - -func (w *huffmanBitWriter) writeBytes(bytes []byte) { - if w.err != nil { - return - } - n := w.nbytes - if w.nbits == 8 { - w.bytes[n] = byte(w.bits) - w.nbits = 0 - n++ - } - if w.nbits != 0 { - w.err = InternalError("writeBytes with unfinished bits") - return - } - if n != 0 { - _, w.err = w.w.Write(w.bytes[0:n]) - if w.err != nil { - return - } - } - w.nbytes = 0 - _, w.err = w.w.Write(bytes) -} - -// RFC 1951 3.2.7 specifies a special run-length encoding for specifying -// the literal and offset lengths arrays (which are concatenated into a single -// array). This method generates that run-length encoding. -// -// The result is written into the codegen array, and the frequencies -// of each code is written into the codegenFreq array. -// Codes 0-15 are single byte codes. Codes 16-18 are followed by additional -// information. Code badCode is an end marker -// -// numLiterals The number of literals in literalEncoding -// numOffsets The number of offsets in offsetEncoding -func (w *huffmanBitWriter) generateCodegen(numLiterals int, numOffsets int) { - for i := range w.codegenFreq { - w.codegenFreq[i] = 0 - } - // Note that we are using codegen both as a temporary variable for holding - // a copy of the frequencies, and as the place where we put the result. - // This is fine because the output is always shorter than the input used - // so far. - codegen := w.codegen // cache - // Copy the concatenated code sizes to codegen. Put a marker at the end. - copy(codegen[0:numLiterals], w.literalEncoding.codeBits) - copy(codegen[numLiterals:numLiterals+numOffsets], w.offsetEncoding.codeBits) - codegen[numLiterals+numOffsets] = badCode - - size := codegen[0] - count := 1 - outIndex := 0 - for inIndex := 1; size != badCode; inIndex++ { - // INVARIANT: We have seen "count" copies of size that have not yet - // had output generated for them. - nextSize := codegen[inIndex] - if nextSize == size { - count++ - continue - } - // We need to generate codegen indicating "count" of size. - if size != 0 { - codegen[outIndex] = size - outIndex++ - w.codegenFreq[size]++ - count-- - for count >= 3 { - n := 6 - if n > count { - n = count - } - codegen[outIndex] = 16 - outIndex++ - codegen[outIndex] = uint8(n - 3) - outIndex++ - w.codegenFreq[16]++ - count -= n - } - } else { - for count >= 11 { - n := 138 - if n > count { - n = count - } - codegen[outIndex] = 18 - outIndex++ - codegen[outIndex] = uint8(n - 11) - outIndex++ - w.codegenFreq[18]++ - count -= n - } - if count >= 3 { - // count >= 3 && count <= 10 - codegen[outIndex] = 17 - outIndex++ - codegen[outIndex] = uint8(count - 3) - outIndex++ - w.codegenFreq[17]++ - count = 0 - } - } - count-- - for ; count >= 0; count-- { - codegen[outIndex] = size - outIndex++ - w.codegenFreq[size]++ - } - // Set up invariant for next time through the loop. - size = nextSize - count = 1 - } - // Marker indicating the end of the codegen. - codegen[outIndex] = badCode -} - -func (w *huffmanBitWriter) writeCode(code *huffmanEncoder, literal uint32) { - if w.err != nil { - return - } - w.writeBits(int32(code.code[literal]), int32(code.codeBits[literal])) -} - -// Write the header of a dynamic Huffman block to the output stream. -// -// numLiterals The number of literals specified in codegen -// numOffsets The number of offsets specified in codegen -// numCodegens The number of codegens used in codegen -func (w *huffmanBitWriter) writeDynamicHeader(numLiterals int, numOffsets int, numCodegens int, isEof bool) { - if w.err != nil { - return - } - var firstBits int32 = 4 - if isEof { - firstBits = 5 - } - w.writeBits(firstBits, 3) - w.writeBits(int32(numLiterals-257), 5) - w.writeBits(int32(numOffsets-1), 5) - w.writeBits(int32(numCodegens-4), 4) - - for i := 0; i < numCodegens; i++ { - value := w.codegenEncoding.codeBits[codegenOrder[i]] - w.writeBits(int32(value), 3) - } - - i := 0 - for { - var codeWord int = int(w.codegen[i]) - i++ - if codeWord == badCode { - break - } - // The low byte contains the actual code to generate. - w.writeCode(w.codegenEncoding, uint32(codeWord)) - - switch codeWord { - case 16: - w.writeBits(int32(w.codegen[i]), 2) - i++ - break - case 17: - w.writeBits(int32(w.codegen[i]), 3) - i++ - break - case 18: - w.writeBits(int32(w.codegen[i]), 7) - i++ - break - } - } -} - -func (w *huffmanBitWriter) writeStoredHeader(length int, isEof bool) { - if w.err != nil { - return - } - var flag int32 - if isEof { - flag = 1 - } - w.writeBits(flag, 3) - w.flush() - w.writeBits(int32(length), 16) - w.writeBits(int32(^uint16(length)), 16) -} - -func (w *huffmanBitWriter) writeFixedHeader(isEof bool) { - if w.err != nil { - return - } - // Indicate that we are a fixed Huffman block - var value int32 = 2 - if isEof { - value = 3 - } - w.writeBits(value, 3) -} - -func (w *huffmanBitWriter) writeBlock(tokens []token, eof bool, input []byte) { - if w.err != nil { - return - } - for i := range w.literalFreq { - w.literalFreq[i] = 0 - } - for i := range w.offsetFreq { - w.offsetFreq[i] = 0 - } - - n := len(tokens) - tokens = tokens[0 : n+1] - tokens[n] = endBlockMarker - - for _, t := range tokens { - switch t.typ() { - case literalType: - w.literalFreq[t.literal()]++ - case matchType: - length := t.length() - offset := t.offset() - w.literalFreq[lengthCodesStart+lengthCode(length)]++ - w.offsetFreq[offsetCode(offset)]++ - } - } - - // get the number of literals - numLiterals := len(w.literalFreq) - for w.literalFreq[numLiterals-1] == 0 { - numLiterals-- - } - // get the number of offsets - numOffsets := len(w.offsetFreq) - for numOffsets > 0 && w.offsetFreq[numOffsets-1] == 0 { - numOffsets-- - } - if numOffsets == 0 { - // We haven't found a single match. If we want to go with the dynamic encoding, - // we should count at least one offset to be sure that the offset huffman tree could be encoded. - w.offsetFreq[0] = 1 - numOffsets = 1 - } - - w.literalEncoding.generate(w.literalFreq, 15) - w.offsetEncoding.generate(w.offsetFreq, 15) - - storedBytes := 0 - if input != nil { - storedBytes = len(input) - } - var extraBits int64 - var storedSize int64 = math.MaxInt64 - if storedBytes <= maxStoreBlockSize && input != nil { - storedSize = int64((storedBytes + 5) * 8) - // We only bother calculating the costs of the extra bits required by - // the length of offset fields (which will be the same for both fixed - // and dynamic encoding), if we need to compare those two encodings - // against stored encoding. - for lengthCode := lengthCodesStart + 8; lengthCode < numLiterals; lengthCode++ { - // First eight length codes have extra size = 0. - extraBits += int64(w.literalFreq[lengthCode]) * int64(lengthExtraBits[lengthCode-lengthCodesStart]) - } - for offsetCode := 4; offsetCode < numOffsets; offsetCode++ { - // First four offset codes have extra size = 0. - extraBits += int64(w.offsetFreq[offsetCode]) * int64(offsetExtraBits[offsetCode]) - } - } - - // Figure out smallest code. - // Fixed Huffman baseline. - var size = int64(3) + - fixedLiteralEncoding.bitLength(w.literalFreq) + - fixedOffsetEncoding.bitLength(w.offsetFreq) + - extraBits - var literalEncoding = fixedLiteralEncoding - var offsetEncoding = fixedOffsetEncoding - - // Dynamic Huffman? - var numCodegens int - - // Generate codegen and codegenFrequencies, which indicates how to encode - // the literalEncoding and the offsetEncoding. - w.generateCodegen(numLiterals, numOffsets) - w.codegenEncoding.generate(w.codegenFreq, 7) - numCodegens = len(w.codegenFreq) - for numCodegens > 4 && w.codegenFreq[codegenOrder[numCodegens-1]] == 0 { - numCodegens-- - } - dynamicHeader := int64(3+5+5+4+(3*numCodegens)) + - w.codegenEncoding.bitLength(w.codegenFreq) + - int64(extraBits) + - int64(w.codegenFreq[16]*2) + - int64(w.codegenFreq[17]*3) + - int64(w.codegenFreq[18]*7) - dynamicSize := dynamicHeader + - w.literalEncoding.bitLength(w.literalFreq) + - w.offsetEncoding.bitLength(w.offsetFreq) - - if dynamicSize < size { - size = dynamicSize - literalEncoding = w.literalEncoding - offsetEncoding = w.offsetEncoding - } - - // Stored bytes? - if storedSize < size { - w.writeStoredHeader(storedBytes, eof) - w.writeBytes(input[0:storedBytes]) - return - } - - // Huffman. - if literalEncoding == fixedLiteralEncoding { - w.writeFixedHeader(eof) - } else { - w.writeDynamicHeader(numLiterals, numOffsets, numCodegens, eof) - } - for _, t := range tokens { - switch t.typ() { - case literalType: - w.writeCode(literalEncoding, t.literal()) - break - case matchType: - // Write the length - length := t.length() - lengthCode := lengthCode(length) - w.writeCode(literalEncoding, lengthCode+lengthCodesStart) - extraLengthBits := int32(lengthExtraBits[lengthCode]) - if extraLengthBits > 0 { - extraLength := int32(length - lengthBase[lengthCode]) - w.writeBits(extraLength, extraLengthBits) - } - // Write the offset - offset := t.offset() - offsetCode := offsetCode(offset) - w.writeCode(offsetEncoding, offsetCode) - extraOffsetBits := int32(offsetExtraBits[offsetCode]) - if extraOffsetBits > 0 { - extraOffset := int32(offset - offsetBase[offsetCode]) - w.writeBits(extraOffset, extraOffsetBits) - } - break - default: - panic("unknown token type: " + string(t)) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_code.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_code.go deleted file mode 100644 index 50ec79c94051e1ba610e5926c77633514ffb83ab..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/huffman_code.go +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "math" - "sort" -) - -type huffmanEncoder struct { - codeBits []uint8 - code []uint16 -} - -type literalNode struct { - literal uint16 - freq int32 -} - -// A levelInfo describes the state of the constructed tree for a given depth. -type levelInfo struct { - // Our level. for better printing - level int32 - - // The frequency of the last node at this level - lastFreq int32 - - // The frequency of the next character to add to this level - nextCharFreq int32 - - // The frequency of the next pair (from level below) to add to this level. - // Only valid if the "needed" value of the next lower level is 0. - nextPairFreq int32 - - // The number of chains remaining to generate for this level before moving - // up to the next level - needed int32 -} - -func maxNode() literalNode { return literalNode{math.MaxUint16, math.MaxInt32} } - -func newHuffmanEncoder(size int) *huffmanEncoder { - return &huffmanEncoder{make([]uint8, size), make([]uint16, size)} -} - -// Generates a HuffmanCode corresponding to the fixed literal table -func generateFixedLiteralEncoding() *huffmanEncoder { - h := newHuffmanEncoder(maxNumLit) - codeBits := h.codeBits - code := h.code - var ch uint16 - for ch = 0; ch < maxNumLit; ch++ { - var bits uint16 - var size uint8 - switch { - case ch < 144: - // size 8, 000110000 .. 10111111 - bits = ch + 48 - size = 8 - break - case ch < 256: - // size 9, 110010000 .. 111111111 - bits = ch + 400 - 144 - size = 9 - break - case ch < 280: - // size 7, 0000000 .. 0010111 - bits = ch - 256 - size = 7 - break - default: - // size 8, 11000000 .. 11000111 - bits = ch + 192 - 280 - size = 8 - } - codeBits[ch] = size - code[ch] = reverseBits(bits, size) - } - return h -} - -func generateFixedOffsetEncoding() *huffmanEncoder { - h := newHuffmanEncoder(30) - codeBits := h.codeBits - code := h.code - for ch := uint16(0); ch < 30; ch++ { - codeBits[ch] = 5 - code[ch] = reverseBits(ch, 5) - } - return h -} - -var fixedLiteralEncoding *huffmanEncoder = generateFixedLiteralEncoding() -var fixedOffsetEncoding *huffmanEncoder = generateFixedOffsetEncoding() - -func (h *huffmanEncoder) bitLength(freq []int32) int64 { - var total int64 - for i, f := range freq { - if f != 0 { - total += int64(f) * int64(h.codeBits[i]) - } - } - return total -} - -const maxBitsLimit = 16 - -// Return the number of literals assigned to each bit size in the Huffman encoding -// -// This method is only called when list.length >= 3 -// The cases of 0, 1, and 2 literals are handled by special case code. -// -// list An array of the literals with non-zero frequencies -// and their associated frequencies. The array is in order of increasing -// frequency, and has as its last element a special element with frequency -// MaxInt32 -// maxBits The maximum number of bits that should be used to encode any literal. -// Must be less than 16. -// return An integer array in which array[i] indicates the number of literals -// that should be encoded in i bits. -func (h *huffmanEncoder) bitCounts(list []literalNode, maxBits int32) []int32 { - if maxBits >= maxBitsLimit { - panic("flate: maxBits too large") - } - n := int32(len(list)) - list = list[0 : n+1] - list[n] = maxNode() - - // The tree can't have greater depth than n - 1, no matter what. This - // saves a little bit of work in some small cases - if maxBits > n-1 { - maxBits = n - 1 - } - - // Create information about each of the levels. - // A bogus "Level 0" whose sole purpose is so that - // level1.prev.needed==0. This makes level1.nextPairFreq - // be a legitimate value that never gets chosen. - var levels [maxBitsLimit]levelInfo - // leafCounts[i] counts the number of literals at the left - // of ancestors of the rightmost node at level i. - // leafCounts[i][j] is the number of literals at the left - // of the level j ancestor. - var leafCounts [maxBitsLimit][maxBitsLimit]int32 - - for level := int32(1); level <= maxBits; level++ { - // For every level, the first two items are the first two characters. - // We initialize the levels as if we had already figured this out. - levels[level] = levelInfo{ - level: level, - lastFreq: list[1].freq, - nextCharFreq: list[2].freq, - nextPairFreq: list[0].freq + list[1].freq, - } - leafCounts[level][level] = 2 - if level == 1 { - levels[level].nextPairFreq = math.MaxInt32 - } - } - - // We need a total of 2*n - 2 items at top level and have already generated 2. - levels[maxBits].needed = 2*n - 4 - - level := maxBits - for { - l := &levels[level] - if l.nextPairFreq == math.MaxInt32 && l.nextCharFreq == math.MaxInt32 { - // We've run out of both leafs and pairs. - // End all calculations for this level. - // To make sure we never come back to this level or any lower level, - // set nextPairFreq impossibly large. - l.needed = 0 - levels[level+1].nextPairFreq = math.MaxInt32 - level++ - continue - } - - prevFreq := l.lastFreq - if l.nextCharFreq < l.nextPairFreq { - // The next item on this row is a leaf node. - n := leafCounts[level][level] + 1 - l.lastFreq = l.nextCharFreq - // Lower leafCounts are the same of the previous node. - leafCounts[level][level] = n - l.nextCharFreq = list[n].freq - } else { - // The next item on this row is a pair from the previous row. - // nextPairFreq isn't valid until we generate two - // more values in the level below - l.lastFreq = l.nextPairFreq - // Take leaf counts from the lower level, except counts[level] remains the same. - copy(leafCounts[level][:level], leafCounts[level-1][:level]) - levels[l.level-1].needed = 2 - } - - if l.needed--; l.needed == 0 { - // We've done everything we need to do for this level. - // Continue calculating one level up. Fill in nextPairFreq - // of that level with the sum of the two nodes we've just calculated on - // this level. - if l.level == maxBits { - // All done! - break - } - levels[l.level+1].nextPairFreq = prevFreq + l.lastFreq - level++ - } else { - // If we stole from below, move down temporarily to replenish it. - for levels[level-1].needed > 0 { - level-- - } - } - } - - // Somethings is wrong if at the end, the top level is null or hasn't used - // all of the leaves. - if leafCounts[maxBits][maxBits] != n { - panic("leafCounts[maxBits][maxBits] != n") - } - - bitCount := make([]int32, maxBits+1) - bits := 1 - counts := &leafCounts[maxBits] - for level := maxBits; level > 0; level-- { - // chain.leafCount gives the number of literals requiring at least "bits" - // bits to encode. - bitCount[bits] = counts[level] - counts[level-1] - bits++ - } - return bitCount -} - -// Look at the leaves and assign them a bit count and an encoding as specified -// in RFC 1951 3.2.2 -func (h *huffmanEncoder) assignEncodingAndSize(bitCount []int32, list []literalNode) { - code := uint16(0) - for n, bits := range bitCount { - code <<= 1 - if n == 0 || bits == 0 { - continue - } - // The literals list[len(list)-bits] .. list[len(list)-bits] - // are encoded using "bits" bits, and get the values - // code, code + 1, .... The code values are - // assigned in literal order (not frequency order). - chunk := list[len(list)-int(bits):] - sortByLiteral(chunk) - for _, node := range chunk { - h.codeBits[node.literal] = uint8(n) - h.code[node.literal] = reverseBits(code, uint8(n)) - code++ - } - list = list[0 : len(list)-int(bits)] - } -} - -// Update this Huffman Code object to be the minimum code for the specified frequency count. -// -// freq An array of frequencies, in which frequency[i] gives the frequency of literal i. -// maxBits The maximum number of bits to use for any literal. -func (h *huffmanEncoder) generate(freq []int32, maxBits int32) { - list := make([]literalNode, len(freq)+1) - // Number of non-zero literals - count := 0 - // Set list to be the set of all non-zero literals and their frequencies - for i, f := range freq { - if f != 0 { - list[count] = literalNode{uint16(i), f} - count++ - } else { - h.codeBits[i] = 0 - } - } - // If freq[] is shorter than codeBits[], fill rest of codeBits[] with zeros - h.codeBits = h.codeBits[0:len(freq)] - list = list[0:count] - if count <= 2 { - // Handle the small cases here, because they are awkward for the general case code. With - // two or fewer literals, everything has bit length 1. - for i, node := range list { - // "list" is in order of increasing literal value. - h.codeBits[node.literal] = 1 - h.code[node.literal] = uint16(i) - } - return - } - sortByFreq(list) - - // Get the number of literals for each bit count - bitCount := h.bitCounts(list, maxBits) - // And do the assignment - h.assignEncodingAndSize(bitCount, list) -} - -type literalNodeSorter struct { - a []literalNode - less func(i, j int) bool -} - -func (s literalNodeSorter) Len() int { return len(s.a) } - -func (s literalNodeSorter) Less(i, j int) bool { - return s.less(i, j) -} - -func (s literalNodeSorter) Swap(i, j int) { s.a[i], s.a[j] = s.a[j], s.a[i] } - -func sortByFreq(a []literalNode) { - s := &literalNodeSorter{a, func(i, j int) bool { - if a[i].freq == a[j].freq { - return a[i].literal < a[j].literal - } - return a[i].freq < a[j].freq - }} - sort.Sort(s) -} - -func sortByLiteral(a []literalNode) { - s := &literalNodeSorter{a, func(i, j int) bool { return a[i].literal < a[j].literal }} - sort.Sort(s) -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate.go deleted file mode 100644 index 04372dec2419c86a7f66b9965cfc0d16fffdaa38..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate.go +++ /dev/null @@ -1,811 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go -output fixedhuff.go - -// Package flate implements the DEFLATE compressed data format, described in -// RFC 1951. The gzip and zlib packages implement access to DEFLATE-based file -// formats. -package flate - -import ( - "bufio" - "io" - "strconv" -) - -const ( - maxCodeLen = 16 // max length of Huffman code - maxHist = 32768 // max history required - // The next three numbers come from the RFC section 3.2.7, with the - // additional proviso in section 3.2.5 which implies that distance codes - // 30 and 31 should never occur in compressed data. - maxNumLit = 286 - maxNumDist = 30 - numCodes = 19 // number of codes in Huffman meta-code -) - -// A CorruptInputError reports the presence of corrupt input at a given offset. -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "flate: corrupt input before offset " + strconv.FormatInt(int64(e), 10) -} - -// An InternalError reports an error in the flate code itself. -type InternalError string - -func (e InternalError) Error() string { return "flate: internal error: " + string(e) } - -// A ReadError reports an error encountered while reading input. -type ReadError struct { - Offset int64 // byte offset where error occurred - Err error // error returned by underlying Read -} - -func (e *ReadError) Error() string { - return "flate: read error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error() -} - -// A WriteError reports an error encountered while writing output. -type WriteError struct { - Offset int64 // byte offset where error occurred - Err error // error returned by underlying Write -} - -func (e *WriteError) Error() string { - return "flate: write error at offset " + strconv.FormatInt(e.Offset, 10) + ": " + e.Err.Error() -} - -// Resetter resets a ReadCloser returned by NewReader or NewReaderDict to -// to switch to a new underlying Reader. This permits reusing a ReadCloser -// instead of allocating a new one. -type Resetter interface { - // Reset discards any buffered data and resets the Resetter as if it was - // newly initialized with the given reader. - Reset(r io.Reader, dict []byte) error -} - -// Note that much of the implementation of huffmanDecoder is also copied -// into gen.go (in package main) for the purpose of precomputing the -// fixed huffman tables so they can be included statically. - -// The data structure for decoding Huffman tables is based on that of -// zlib. There is a lookup table of a fixed bit width (huffmanChunkBits), -// For codes smaller than the table width, there are multiple entries -// (each combination of trailing bits has the same value). For codes -// larger than the table width, the table contains a link to an overflow -// table. The width of each entry in the link table is the maximum code -// size minus the chunk width. - -// Note that you can do a lookup in the table even without all bits -// filled. Since the extra bits are zero, and the DEFLATE Huffman codes -// have the property that shorter codes come before longer ones, the -// bit length estimate in the result is a lower bound on the actual -// number of bits. - -// chunk & 15 is number of bits -// chunk >> 4 is value, including table link - -const ( - huffmanChunkBits = 9 - huffmanNumChunks = 1 << huffmanChunkBits - huffmanCountMask = 15 - huffmanValueShift = 4 -) - -type huffmanDecoder struct { - min int // the minimum code length - chunks [huffmanNumChunks]uint32 // chunks as described above - links [][]uint32 // overflow links - linkMask uint32 // mask the width of the link table -} - -// Initialize Huffman decoding tables from array of code lengths. -// Following this function, h is guaranteed to be initialized into a complete -// tree (i.e., neither over-subscribed nor under-subscribed). The exception is a -// degenerate case where the tree has only a single symbol with length 1. Empty -// trees are permitted. -func (h *huffmanDecoder) init(bits []int) bool { - // Sanity enables additional runtime tests during Huffman - // table construction. It's intended to be used during - // development to supplement the currently ad-hoc unit tests. - const sanity = false - - if h.min != 0 { - *h = huffmanDecoder{} - } - - // Count number of codes of each length, - // compute min and max length. - var count [maxCodeLen]int - var min, max int - for _, n := range bits { - if n == 0 { - continue - } - if min == 0 || n < min { - min = n - } - if n > max { - max = n - } - count[n]++ - } - - // Empty tree. The decompressor.huffSym function will fail later if the tree - // is used. Technically, an empty tree is only valid for the HDIST tree and - // not the HCLEN and HLIT tree. However, a stream with an empty HCLEN tree - // is guaranteed to fail since it will attempt to use the tree to decode the - // codes for the HLIT and HDIST trees. Similarly, an empty HLIT tree is - // guaranteed to fail later since the compressed data section must be - // composed of at least one symbol (the end-of-block marker). - if max == 0 { - return true - } - - code := 0 - var nextcode [maxCodeLen]int - for i := min; i <= max; i++ { - code <<= 1 - nextcode[i] = code - code += count[i] - } - - // Check that the coding is complete (i.e., that we've - // assigned all 2-to-the-max possible bit sequences). - // Exception: To be compatible with zlib, we also need to - // accept degenerate single-code codings. See also - // TestDegenerateHuffmanCoding. - if code != 1< huffmanChunkBits { - numLinks := 1 << (uint(max) - huffmanChunkBits) - h.linkMask = uint32(numLinks - 1) - - // create link tables - link := nextcode[huffmanChunkBits+1] >> 1 - h.links = make([][]uint32, huffmanNumChunks-link) - for j := uint(link); j < huffmanNumChunks; j++ { - reverse := int(reverseByte[j>>8]) | int(reverseByte[j&0xff])<<8 - reverse >>= uint(16 - huffmanChunkBits) - off := j - uint(link) - if sanity && h.chunks[reverse] != 0 { - panic("impossible: overwriting existing chunk") - } - h.chunks[reverse] = uint32(off<>8]) | int(reverseByte[code&0xff])<<8 - reverse >>= uint(16 - n) - if n <= huffmanChunkBits { - for off := reverse; off < len(h.chunks); off += 1 << uint(n) { - // We should never need to overwrite - // an existing chunk. Also, 0 is - // never a valid chunk, because the - // lower 4 "count" bits should be - // between 1 and 15. - if sanity && h.chunks[off] != 0 { - panic("impossible: overwriting existing chunk") - } - h.chunks[off] = chunk - } - } else { - j := reverse & (huffmanNumChunks - 1) - if sanity && h.chunks[j]&huffmanCountMask != huffmanChunkBits+1 { - // Longer codes should have been - // associated with a link table above. - panic("impossible: not an indirect chunk") - } - value := h.chunks[j] >> huffmanValueShift - linktab := h.links[value] - reverse >>= huffmanChunkBits - for off := reverse; off < len(linktab); off += 1 << uint(n-huffmanChunkBits) { - if sanity && linktab[off] != 0 { - panic("impossible: overwriting existing chunk") - } - linktab[off] = chunk - } - } - } - - if sanity { - // Above we've sanity checked that we never overwrote - // an existing entry. Here we additionally check that - // we filled the tables completely. - for i, chunk := range h.chunks { - if chunk == 0 { - // As an exception, in the degenerate - // single-code case, we allow odd - // chunks to be missing. - if code == 1 && i%2 == 1 { - continue - } - panic("impossible: missing chunk") - } - } - for _, linktab := range h.links { - for _, chunk := range linktab { - if chunk == 0 { - panic("impossible: missing chunk") - } - } - } - } - - return true -} - -// The actual read interface needed by NewReader. -// If the passed in io.Reader does not also have ReadByte, -// the NewReader will introduce its own buffering. -type Reader interface { - io.Reader - io.ByteReader -} - -// Decompress state. -type decompressor struct { - // Input source. - r Reader - roffset int64 - woffset int64 - - // Input bits, in top of b. - b uint32 - nb uint - - // Huffman decoders for literal/length, distance. - h1, h2 huffmanDecoder - - // Length arrays used to define Huffman codes. - bits *[maxNumLit + maxNumDist]int - codebits *[numCodes]int - - // Output history, buffer. - hist *[maxHist]byte - hp int // current output position in buffer - hw int // have written hist[0:hw] already - hfull bool // buffer has filled at least once - - // Temporary buffer (avoids repeated allocation). - buf [4]byte - - // Next step in the decompression, - // and decompression state. - step func(*decompressor) - final bool - err error - toRead []byte - hl, hd *huffmanDecoder - copyLen int - copyDist int -} - -func (f *decompressor) nextBlock() { - if f.final { - if f.hw != f.hp { - f.flush((*decompressor).nextBlock) - return - } - f.err = io.EOF - return - } - for f.nb < 1+2 { - if f.err = f.moreBits(); f.err != nil { - return - } - } - f.final = f.b&1 == 1 - f.b >>= 1 - typ := f.b & 3 - f.b >>= 2 - f.nb -= 1 + 2 - switch typ { - case 0: - f.dataBlock() - case 1: - // compressed, fixed Huffman tables - f.hl = &fixedHuffmanDecoder - f.hd = nil - f.huffmanBlock() - case 2: - // compressed, dynamic Huffman tables - if f.err = f.readHuffman(); f.err != nil { - break - } - f.hl = &f.h1 - f.hd = &f.h2 - f.huffmanBlock() - default: - // 3 is reserved. - f.err = CorruptInputError(f.roffset) - } -} - -func (f *decompressor) Read(b []byte) (int, error) { - for { - if len(f.toRead) > 0 { - n := copy(b, f.toRead) - f.toRead = f.toRead[n:] - return n, nil - } - if f.err != nil { - return 0, f.err - } - f.step(f) - } -} - -func (f *decompressor) Close() error { - if f.err == io.EOF { - return nil - } - return f.err -} - -// RFC 1951 section 3.2.7. -// Compression with dynamic Huffman codes - -var codeOrder = [...]int{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} - -func (f *decompressor) readHuffman() error { - // HLIT[5], HDIST[5], HCLEN[4]. - for f.nb < 5+5+4 { - if err := f.moreBits(); err != nil { - return err - } - } - nlit := int(f.b&0x1F) + 257 - if nlit > maxNumLit { - return CorruptInputError(f.roffset) - } - f.b >>= 5 - ndist := int(f.b&0x1F) + 1 - if ndist > maxNumDist { - return CorruptInputError(f.roffset) - } - f.b >>= 5 - nclen := int(f.b&0xF) + 4 - // numCodes is 19, so nclen is always valid. - f.b >>= 4 - f.nb -= 5 + 5 + 4 - - // (HCLEN+4)*3 bits: code lengths in the magic codeOrder order. - for i := 0; i < nclen; i++ { - for f.nb < 3 { - if err := f.moreBits(); err != nil { - return err - } - } - f.codebits[codeOrder[i]] = int(f.b & 0x7) - f.b >>= 3 - f.nb -= 3 - } - for i := nclen; i < len(codeOrder); i++ { - f.codebits[codeOrder[i]] = 0 - } - if !f.h1.init(f.codebits[0:]) { - return CorruptInputError(f.roffset) - } - - // HLIT + 257 code lengths, HDIST + 1 code lengths, - // using the code length Huffman code. - for i, n := 0, nlit+ndist; i < n; { - x, err := f.huffSym(&f.h1) - if err != nil { - return err - } - if x < 16 { - // Actual length. - f.bits[i] = x - i++ - continue - } - // Repeat previous length or zero. - var rep int - var nb uint - var b int - switch x { - default: - return InternalError("unexpected length code") - case 16: - rep = 3 - nb = 2 - if i == 0 { - return CorruptInputError(f.roffset) - } - b = f.bits[i-1] - case 17: - rep = 3 - nb = 3 - b = 0 - case 18: - rep = 11 - nb = 7 - b = 0 - } - for f.nb < nb { - if err := f.moreBits(); err != nil { - return err - } - } - rep += int(f.b & uint32(1<>= nb - f.nb -= nb - if i+rep > n { - return CorruptInputError(f.roffset) - } - for j := 0; j < rep; j++ { - f.bits[i] = b - i++ - } - } - - if !f.h1.init(f.bits[0:nlit]) || !f.h2.init(f.bits[nlit:nlit+ndist]) { - return CorruptInputError(f.roffset) - } - - return nil -} - -// Decode a single Huffman block from f. -// hl and hd are the Huffman states for the lit/length values -// and the distance values, respectively. If hd == nil, using the -// fixed distance encoding associated with fixed Huffman blocks. -func (f *decompressor) huffmanBlock() { - for { - v, err := f.huffSym(f.hl) - if err != nil { - f.err = err - return - } - var n uint // number of bits extra - var length int - switch { - case v < 256: - f.hist[f.hp] = byte(v) - f.hp++ - if f.hp == len(f.hist) { - // After the flush, continue this loop. - f.flush((*decompressor).huffmanBlock) - return - } - continue - case v == 256: - // Done with huffman block; read next block. - f.step = (*decompressor).nextBlock - return - // otherwise, reference to older data - case v < 265: - length = v - (257 - 3) - n = 0 - case v < 269: - length = v*2 - (265*2 - 11) - n = 1 - case v < 273: - length = v*4 - (269*4 - 19) - n = 2 - case v < 277: - length = v*8 - (273*8 - 35) - n = 3 - case v < 281: - length = v*16 - (277*16 - 67) - n = 4 - case v < 285: - length = v*32 - (281*32 - 131) - n = 5 - case v < maxNumLit: - length = 258 - n = 0 - default: - f.err = CorruptInputError(f.roffset) - return - } - if n > 0 { - for f.nb < n { - if err = f.moreBits(); err != nil { - f.err = err - return - } - } - length += int(f.b & uint32(1<>= n - f.nb -= n - } - - var dist int - if f.hd == nil { - for f.nb < 5 { - if err = f.moreBits(); err != nil { - f.err = err - return - } - } - dist = int(reverseByte[(f.b&0x1F)<<3]) - f.b >>= 5 - f.nb -= 5 - } else { - if dist, err = f.huffSym(f.hd); err != nil { - f.err = err - return - } - } - - switch { - case dist < 4: - dist++ - case dist < maxNumDist: - nb := uint(dist-2) >> 1 - // have 1 bit in bottom of dist, need nb more. - extra := (dist & 1) << nb - for f.nb < nb { - if err = f.moreBits(); err != nil { - f.err = err - return - } - } - extra |= int(f.b & uint32(1<>= nb - f.nb -= nb - dist = 1<<(nb+1) + 1 + extra - default: - f.err = CorruptInputError(f.roffset) - return - } - - // Copy history[-dist:-dist+length] into output. - if dist > len(f.hist) { - f.err = InternalError("bad history distance") - return - } - - // No check on length; encoding can be prescient. - if !f.hfull && dist > f.hp { - f.err = CorruptInputError(f.roffset) - return - } - - f.copyLen, f.copyDist = length, dist - if f.copyHist() { - return - } - } -} - -// copyHist copies f.copyLen bytes from f.hist (f.copyDist bytes ago) to itself. -// It reports whether the f.hist buffer is full. -func (f *decompressor) copyHist() bool { - p := f.hp - f.copyDist - if p < 0 { - p += len(f.hist) - } - for f.copyLen > 0 { - n := f.copyLen - if x := len(f.hist) - f.hp; n > x { - n = x - } - if x := len(f.hist) - p; n > x { - n = x - } - forwardCopy(f.hist[:], f.hp, p, n) - p += n - f.hp += n - f.copyLen -= n - if f.hp == len(f.hist) { - // After flush continue copying out of history. - f.flush((*decompressor).copyHuff) - return true - } - if p == len(f.hist) { - p = 0 - } - } - return false -} - -func (f *decompressor) copyHuff() { - if f.copyHist() { - return - } - f.huffmanBlock() -} - -// Copy a single uncompressed data block from input to output. -func (f *decompressor) dataBlock() { - // Uncompressed. - // Discard current half-byte. - f.nb = 0 - f.b = 0 - - // Length then ones-complement of length. - nr, err := io.ReadFull(f.r, f.buf[0:4]) - f.roffset += int64(nr) - if err != nil { - f.err = &ReadError{f.roffset, err} - return - } - n := int(f.buf[0]) | int(f.buf[1])<<8 - nn := int(f.buf[2]) | int(f.buf[3])<<8 - if uint16(nn) != uint16(^n) { - f.err = CorruptInputError(f.roffset) - return - } - - if n == 0 { - // 0-length block means sync - f.flush((*decompressor).nextBlock) - return - } - - f.copyLen = n - f.copyData() -} - -// copyData copies f.copyLen bytes from the underlying reader into f.hist. -// It pauses for reads when f.hist is full. -func (f *decompressor) copyData() { - n := f.copyLen - for n > 0 { - m := len(f.hist) - f.hp - if m > n { - m = n - } - m, err := io.ReadFull(f.r, f.hist[f.hp:f.hp+m]) - f.roffset += int64(m) - if err != nil { - f.err = &ReadError{f.roffset, err} - return - } - n -= m - f.hp += m - if f.hp == len(f.hist) { - f.copyLen = n - f.flush((*decompressor).copyData) - return - } - } - f.step = (*decompressor).nextBlock -} - -func (f *decompressor) setDict(dict []byte) { - if len(dict) > len(f.hist) { - // Will only remember the tail. - dict = dict[len(dict)-len(f.hist):] - } - - f.hp = copy(f.hist[:], dict) - if f.hp == len(f.hist) { - f.hp = 0 - f.hfull = true - } - f.hw = f.hp -} - -func (f *decompressor) moreBits() error { - c, err := f.r.ReadByte() - if err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - return err - } - f.roffset++ - f.b |= uint32(c) << f.nb - f.nb += 8 - return nil -} - -// Read the next Huffman-encoded symbol from f according to h. -func (f *decompressor) huffSym(h *huffmanDecoder) (int, error) { - // Since a huffmanDecoder can be empty or be composed of a degenerate tree - // with single element, huffSym must error on these two edge cases. In both - // cases, the chunks slice will be 0 for the invalid sequence, leading it - // satisfy the n == 0 check below. - n := uint(h.min) - for { - for f.nb < n { - if err := f.moreBits(); err != nil { - return 0, err - } - } - chunk := h.chunks[f.b&(huffmanNumChunks-1)] - n = uint(chunk & huffmanCountMask) - if n > huffmanChunkBits { - chunk = h.links[chunk>>huffmanValueShift][(f.b>>huffmanChunkBits)&h.linkMask] - n = uint(chunk & huffmanCountMask) - } - if n <= f.nb { - if n == 0 { - f.err = CorruptInputError(f.roffset) - return 0, f.err - } - f.b >>= n - f.nb -= n - return int(chunk >> huffmanValueShift), nil - } - } -} - -// Flush any buffered output to the underlying writer. -func (f *decompressor) flush(step func(*decompressor)) { - f.toRead = f.hist[f.hw:f.hp] - f.woffset += int64(f.hp - f.hw) - f.hw = f.hp - if f.hp == len(f.hist) { - f.hp = 0 - f.hw = 0 - f.hfull = true - } - f.step = step -} - -func makeReader(r io.Reader) Reader { - if rr, ok := r.(Reader); ok { - return rr - } - return bufio.NewReader(r) -} - -func (f *decompressor) Reset(r io.Reader, dict []byte) error { - *f = decompressor{ - r: makeReader(r), - bits: f.bits, - codebits: f.codebits, - hist: f.hist, - step: (*decompressor).nextBlock, - } - if dict != nil { - f.setDict(dict) - } - return nil -} - -// NewReader returns a new ReadCloser that can be used -// to read the uncompressed version of r. -// If r does not also implement io.ByteReader, -// the decompressor may read more data than necessary from r. -// It is the caller's responsibility to call Close on the ReadCloser -// when finished reading. -// -// The ReadCloser returned by NewReader also implements Resetter. -func NewReader(r io.Reader) io.ReadCloser { - var f decompressor - f.bits = new([maxNumLit + maxNumDist]int) - f.codebits = new([numCodes]int) - f.r = makeReader(r) - f.hist = new([maxHist]byte) - f.step = (*decompressor).nextBlock - return &f -} - -// NewReaderDict is like NewReader but initializes the reader -// with a preset dictionary. The returned Reader behaves as if -// the uncompressed data stream started with the given dictionary, -// which has already been read. NewReaderDict is typically used -// to read data compressed by NewWriterDict. -// -// The ReadCloser returned by NewReader also implements Resetter. -func NewReaderDict(r io.Reader, dict []byte) io.ReadCloser { - var f decompressor - f.r = makeReader(r) - f.hist = new([maxHist]byte) - f.bits = new([maxNumLit + maxNumDist]int) - f.codebits = new([numCodes]int) - f.step = (*decompressor).nextBlock - f.setDict(dict) - return &f -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate_test.go deleted file mode 100644 index 9f25d30b35cd0684608371e9044a3ff1fd198263..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/inflate_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "bytes" - "io" - "testing" -) - -func TestReset(t *testing.T) { - ss := []string{ - "lorem ipsum izzle fo rizzle", - "the quick brown fox jumped over", - } - - deflated := make([]bytes.Buffer, 2) - for i, s := range ss { - w, _ := NewWriter(&deflated[i], 1) - w.Write([]byte(s)) - w.Close() - } - - inflated := make([]bytes.Buffer, 2) - - f := NewReader(&deflated[0]) - io.Copy(&inflated[0], f) - f.(Resetter).Reset(&deflated[1], nil) - io.Copy(&inflated[1], f) - f.Close() - - for i, s := range ss { - if s != inflated[i].String() { - t.Errorf("inflated[%d]:\ngot %q\nwant %q", i, inflated[i], s) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/reader_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/reader_test.go deleted file mode 100644 index a62ef741df336161397cc132cc4bec2ca656cfc1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/reader_test.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "bytes" - "io" - "io/ioutil" - "runtime" - "strings" - "testing" -) - -func TestNlitOutOfRange(t *testing.T) { - // Trying to decode this bogus flate data, which has a Huffman table - // with nlit=288, should not panic. - io.Copy(ioutil.Discard, NewReader(strings.NewReader( - "\xfc\xfe\x36\xe7\x5e\x1c\xef\xb3\x55\x58\x77\xb6\x56\xb5\x43\xf4"+ - "\x6f\xf2\xd2\xe6\x3d\x99\xa0\x85\x8c\x48\xeb\xf8\xda\x83\x04\x2a"+ - "\x75\xc4\xf8\x0f\x12\x11\xb9\xb4\x4b\x09\xa0\xbe\x8b\x91\x4c"))) -} - -const ( - digits = iota - twain -) - -var testfiles = []string{ - // Digits is the digits of the irrational number e. Its decimal representation - // does not repeat, but there are only 10 possible digits, so it should be - // reasonably compressible. - digits: "../testdata/e.txt", - // Twain is Project Gutenberg's edition of Mark Twain's classic English novel. - twain: "../testdata/Mark.Twain-Tom.Sawyer.txt", -} - -func benchmarkDecode(b *testing.B, testfile, level, n int) { - b.ReportAllocs() - b.StopTimer() - b.SetBytes(int64(n)) - buf0, err := ioutil.ReadFile(testfiles[testfile]) - if err != nil { - b.Fatal(err) - } - if len(buf0) == 0 { - b.Fatalf("test file %q has no data", testfiles[testfile]) - } - compressed := new(bytes.Buffer) - w, err := NewWriter(compressed, level) - if err != nil { - b.Fatal(err) - } - for i := 0; i < n; i += len(buf0) { - if len(buf0) > n-i { - buf0 = buf0[:n-i] - } - io.Copy(w, bytes.NewReader(buf0)) - } - w.Close() - buf1 := compressed.Bytes() - buf0, compressed, w = nil, nil, nil - runtime.GC() - b.StartTimer() - for i := 0; i < b.N; i++ { - io.Copy(ioutil.Discard, NewReader(bytes.NewReader(buf1))) - } -} - -// These short names are so that gofmt doesn't break the BenchmarkXxx function -// bodies below over multiple lines. -const ( - speed = BestSpeed - default_ = DefaultCompression - compress = BestCompression -) - -func BenchmarkDecodeDigitsSpeed1e4(b *testing.B) { benchmarkDecode(b, digits, speed, 1e4) } -func BenchmarkDecodeDigitsSpeed1e5(b *testing.B) { benchmarkDecode(b, digits, speed, 1e5) } -func BenchmarkDecodeDigitsSpeed1e6(b *testing.B) { benchmarkDecode(b, digits, speed, 1e6) } -func BenchmarkDecodeDigitsDefault1e4(b *testing.B) { benchmarkDecode(b, digits, default_, 1e4) } -func BenchmarkDecodeDigitsDefault1e5(b *testing.B) { benchmarkDecode(b, digits, default_, 1e5) } -func BenchmarkDecodeDigitsDefault1e6(b *testing.B) { benchmarkDecode(b, digits, default_, 1e6) } -func BenchmarkDecodeDigitsCompress1e4(b *testing.B) { benchmarkDecode(b, digits, compress, 1e4) } -func BenchmarkDecodeDigitsCompress1e5(b *testing.B) { benchmarkDecode(b, digits, compress, 1e5) } -func BenchmarkDecodeDigitsCompress1e6(b *testing.B) { benchmarkDecode(b, digits, compress, 1e6) } -func BenchmarkDecodeTwainSpeed1e4(b *testing.B) { benchmarkDecode(b, twain, speed, 1e4) } -func BenchmarkDecodeTwainSpeed1e5(b *testing.B) { benchmarkDecode(b, twain, speed, 1e5) } -func BenchmarkDecodeTwainSpeed1e6(b *testing.B) { benchmarkDecode(b, twain, speed, 1e6) } -func BenchmarkDecodeTwainDefault1e4(b *testing.B) { benchmarkDecode(b, twain, default_, 1e4) } -func BenchmarkDecodeTwainDefault1e5(b *testing.B) { benchmarkDecode(b, twain, default_, 1e5) } -func BenchmarkDecodeTwainDefault1e6(b *testing.B) { benchmarkDecode(b, twain, default_, 1e6) } -func BenchmarkDecodeTwainCompress1e4(b *testing.B) { benchmarkDecode(b, twain, compress, 1e4) } -func BenchmarkDecodeTwainCompress1e5(b *testing.B) { benchmarkDecode(b, twain, compress, 1e5) } -func BenchmarkDecodeTwainCompress1e6(b *testing.B) { benchmarkDecode(b, twain, compress, 1e6) } diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/reverse_bits.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/reverse_bits.go deleted file mode 100644 index c1a02720d1a9bcb2500c4156b2fc35a31e71b3bf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/reverse_bits.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -var reverseByte = [256]byte{ - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -} - -func reverseUint16(v uint16) uint16 { - return uint16(reverseByte[v>>8]) | uint16(reverseByte[v&0xFF])<<8 -} - -func reverseBits(number uint16, bitLength byte) uint16 { - return reverseUint16(number << uint8(16-bitLength)) -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/token.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/token.go deleted file mode 100644 index 4d491768717f8ccd945130ad8ff49618db3d8fa9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/token.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -const ( - // 2 bits: type 0 = literal 1=EOF 2=Match 3=Unused - // 8 bits: xlength = length - MIN_MATCH_LENGTH - // 22 bits xoffset = offset - MIN_OFFSET_SIZE, or literal - lengthShift = 22 - offsetMask = 1< pair into a match token. -func matchToken(xlength uint32, xoffset uint32) token { - return token(matchType + xlength<> lengthShift) } - -func lengthCode(len uint32) uint32 { return lengthCodes[len] } - -// Returns the offset code corresponding to a specific offset -func offsetCode(off uint32) uint32 { - const n = uint32(len(offsetCodes)) - switch { - case off < n: - return offsetCodes[off] - case off>>7 < n: - return offsetCodes[off>>7] + 14 - default: - return offsetCodes[off>>14] + 28 - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/flate/writer_test.go b/llgo/third_party/gofrontend/libgo/go/compress/flate/writer_test.go deleted file mode 100644 index 58431774e0e3c2e77dc536704fe81519c986c8c3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/flate/writer_test.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package flate - -import ( - "io/ioutil" - "runtime" - "testing" -) - -func benchmarkEncoder(b *testing.B, testfile, level, n int) { - b.StopTimer() - b.SetBytes(int64(n)) - buf0, err := ioutil.ReadFile(testfiles[testfile]) - if err != nil { - b.Fatal(err) - } - if len(buf0) == 0 { - b.Fatalf("test file %q has no data", testfiles[testfile]) - } - buf1 := make([]byte, n) - for i := 0; i < n; i += len(buf0) { - if len(buf0) > n-i { - buf0 = buf0[:n-i] - } - copy(buf1[i:], buf0) - } - buf0 = nil - runtime.GC() - b.StartTimer() - for i := 0; i < b.N; i++ { - w, err := NewWriter(ioutil.Discard, level) - if err != nil { - b.Fatal(err) - } - w.Write(buf1) - w.Close() - } -} - -func BenchmarkEncodeDigitsSpeed1e4(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e4) } -func BenchmarkEncodeDigitsSpeed1e5(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e5) } -func BenchmarkEncodeDigitsSpeed1e6(b *testing.B) { benchmarkEncoder(b, digits, speed, 1e6) } -func BenchmarkEncodeDigitsDefault1e4(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e4) } -func BenchmarkEncodeDigitsDefault1e5(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e5) } -func BenchmarkEncodeDigitsDefault1e6(b *testing.B) { benchmarkEncoder(b, digits, default_, 1e6) } -func BenchmarkEncodeDigitsCompress1e4(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e4) } -func BenchmarkEncodeDigitsCompress1e5(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e5) } -func BenchmarkEncodeDigitsCompress1e6(b *testing.B) { benchmarkEncoder(b, digits, compress, 1e6) } -func BenchmarkEncodeTwainSpeed1e4(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e4) } -func BenchmarkEncodeTwainSpeed1e5(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e5) } -func BenchmarkEncodeTwainSpeed1e6(b *testing.B) { benchmarkEncoder(b, twain, speed, 1e6) } -func BenchmarkEncodeTwainDefault1e4(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e4) } -func BenchmarkEncodeTwainDefault1e5(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e5) } -func BenchmarkEncodeTwainDefault1e6(b *testing.B) { benchmarkEncoder(b, twain, default_, 1e6) } -func BenchmarkEncodeTwainCompress1e4(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e4) } -func BenchmarkEncodeTwainCompress1e5(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e5) } -func BenchmarkEncodeTwainCompress1e6(b *testing.B) { benchmarkEncoder(b, twain, compress, 1e6) } diff --git a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip.go b/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip.go deleted file mode 100644 index 72ee55c4fabdf5a310688bd7fda031c389510e1c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip.go +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gzip implements reading and writing of gzip format compressed files, -// as specified in RFC 1952. -package gzip - -import ( - "bufio" - "compress/flate" - "errors" - "hash" - "hash/crc32" - "io" - "time" -) - -const ( - gzipID1 = 0x1f - gzipID2 = 0x8b - gzipDeflate = 8 - flagText = 1 << 0 - flagHdrCrc = 1 << 1 - flagExtra = 1 << 2 - flagName = 1 << 3 - flagComment = 1 << 4 -) - -func makeReader(r io.Reader) flate.Reader { - if rr, ok := r.(flate.Reader); ok { - return rr - } - return bufio.NewReader(r) -} - -var ( - // ErrChecksum is returned when reading GZIP data that has an invalid checksum. - ErrChecksum = errors.New("gzip: invalid checksum") - // ErrHeader is returned when reading GZIP data that has an invalid header. - ErrHeader = errors.New("gzip: invalid header") -) - -// The gzip file stores a header giving metadata about the compressed file. -// That header is exposed as the fields of the Writer and Reader structs. -type Header struct { - Comment string // comment - Extra []byte // "extra data" - ModTime time.Time // modification time - Name string // file name - OS byte // operating system type -} - -// A Reader is an io.Reader that can be read to retrieve -// uncompressed data from a gzip-format compressed file. -// -// In general, a gzip file can be a concatenation of gzip files, -// each with its own header. Reads from the Reader -// return the concatenation of the uncompressed data of each. -// Only the first header is recorded in the Reader fields. -// -// Gzip files store a length and checksum of the uncompressed data. -// The Reader will return a ErrChecksum when Read -// reaches the end of the uncompressed data if it does not -// have the expected length or checksum. Clients should treat data -// returned by Read as tentative until they receive the io.EOF -// marking the end of the data. -type Reader struct { - Header - r flate.Reader - decompressor io.ReadCloser - digest hash.Hash32 - size uint32 - flg byte - buf [512]byte - err error - multistream bool -} - -// NewReader creates a new Reader reading the given reader. -// If r does not also implement io.ByteReader, -// the decompressor may read more data than necessary from r. -// It is the caller's responsibility to call Close on the Reader when done. -func NewReader(r io.Reader) (*Reader, error) { - z := new(Reader) - z.r = makeReader(r) - z.multistream = true - z.digest = crc32.NewIEEE() - if err := z.readHeader(true); err != nil { - return nil, err - } - return z, nil -} - -// Reset discards the Reader z's state and makes it equivalent to the -// result of its original state from NewReader, but reading from r instead. -// This permits reusing a Reader rather than allocating a new one. -func (z *Reader) Reset(r io.Reader) error { - z.r = makeReader(r) - if z.digest == nil { - z.digest = crc32.NewIEEE() - } else { - z.digest.Reset() - } - z.size = 0 - z.err = nil - z.multistream = true - return z.readHeader(true) -} - -// Multistream controls whether the reader supports multistream files. -// -// If enabled (the default), the Reader expects the input to be a sequence -// of individually gzipped data streams, each with its own header and -// trailer, ending at EOF. The effect is that the concatenation of a sequence -// of gzipped files is treated as equivalent to the gzip of the concatenation -// of the sequence. This is standard behavior for gzip readers. -// -// Calling Multistream(false) disables this behavior; disabling the behavior -// can be useful when reading file formats that distinguish individual gzip -// data streams or mix gzip data streams with other data streams. -// In this mode, when the Reader reaches the end of the data stream, -// Read returns io.EOF. If the underlying reader implements io.ByteReader, -// it will be left positioned just after the gzip stream. -// To start the next stream, call z.Reset(r) followed by z.Multistream(false). -// If there is no next stream, z.Reset(r) will return io.EOF. -func (z *Reader) Multistream(ok bool) { - z.multistream = ok -} - -// GZIP (RFC 1952) is little-endian, unlike ZLIB (RFC 1950). -func get4(p []byte) uint32 { - return uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 | uint32(p[3])<<24 -} - -func (z *Reader) readString() (string, error) { - var err error - needconv := false - for i := 0; ; i++ { - if i >= len(z.buf) { - return "", ErrHeader - } - z.buf[i], err = z.r.ReadByte() - if err != nil { - return "", err - } - if z.buf[i] > 0x7f { - needconv = true - } - if z.buf[i] == 0 { - // GZIP (RFC 1952) specifies that strings are NUL-terminated ISO 8859-1 (Latin-1). - if needconv { - s := make([]rune, 0, i) - for _, v := range z.buf[0:i] { - s = append(s, rune(v)) - } - return string(s), nil - } - return string(z.buf[0:i]), nil - } - } -} - -func (z *Reader) read2() (uint32, error) { - _, err := io.ReadFull(z.r, z.buf[0:2]) - if err != nil { - return 0, err - } - return uint32(z.buf[0]) | uint32(z.buf[1])<<8, nil -} - -func (z *Reader) readHeader(save bool) error { - _, err := io.ReadFull(z.r, z.buf[0:10]) - if err != nil { - return err - } - if z.buf[0] != gzipID1 || z.buf[1] != gzipID2 || z.buf[2] != gzipDeflate { - return ErrHeader - } - z.flg = z.buf[3] - if save { - z.ModTime = time.Unix(int64(get4(z.buf[4:8])), 0) - // z.buf[8] is xfl, ignored - z.OS = z.buf[9] - } - z.digest.Reset() - z.digest.Write(z.buf[0:10]) - - if z.flg&flagExtra != 0 { - n, err := z.read2() - if err != nil { - return err - } - data := make([]byte, n) - if _, err = io.ReadFull(z.r, data); err != nil { - return err - } - if save { - z.Extra = data - } - } - - var s string - if z.flg&flagName != 0 { - if s, err = z.readString(); err != nil { - return err - } - if save { - z.Name = s - } - } - - if z.flg&flagComment != 0 { - if s, err = z.readString(); err != nil { - return err - } - if save { - z.Comment = s - } - } - - if z.flg&flagHdrCrc != 0 { - n, err := z.read2() - if err != nil { - return err - } - sum := z.digest.Sum32() & 0xFFFF - if n != sum { - return ErrHeader - } - } - - z.digest.Reset() - if z.decompressor == nil { - z.decompressor = flate.NewReader(z.r) - } else { - z.decompressor.(flate.Resetter).Reset(z.r, nil) - } - return nil -} - -func (z *Reader) Read(p []byte) (n int, err error) { - if z.err != nil { - return 0, z.err - } - if len(p) == 0 { - return 0, nil - } - - n, err = z.decompressor.Read(p) - z.digest.Write(p[0:n]) - z.size += uint32(n) - if n != 0 || err != io.EOF { - z.err = err - return - } - - // Finished file; check checksum + size. - if _, err := io.ReadFull(z.r, z.buf[0:8]); err != nil { - z.err = err - return 0, err - } - crc32, isize := get4(z.buf[0:4]), get4(z.buf[4:8]) - sum := z.digest.Sum32() - if sum != crc32 || isize != z.size { - z.err = ErrChecksum - return 0, z.err - } - - // File is ok; is there another? - if !z.multistream { - return 0, io.EOF - } - - if err = z.readHeader(false); err != nil { - z.err = err - return - } - - // Yes. Reset and read from it. - z.digest.Reset() - z.size = 0 - return z.Read(p) -} - -// Close closes the Reader. It does not close the underlying io.Reader. -func (z *Reader) Close() error { return z.decompressor.Close() } diff --git a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip_test.go b/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip_test.go deleted file mode 100644 index 0636dec9ab01d208857673d7f8e566444eda9627..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gunzip_test.go +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gzip - -import ( - "bytes" - "io" - "io/ioutil" - "os" - "strings" - "testing" - "time" -) - -type gunzipTest struct { - name string - desc string - raw string - gzip []byte - err error -} - -var gunzipTests = []gunzipTest{ - { // has 1 empty fixed-huffman block - "empty.txt", - "empty.txt", - "", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xf7, 0x5e, 0x14, 0x4a, - 0x00, 0x03, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - }, - nil, - }, - { // has 1 non-empty fixed huffman block - "hello.txt", - "hello.txt", - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, - 0x00, 0x00, - }, - nil, - }, - { // concatenation - "hello.txt", - "hello.txt x2", - "hello world\n" + - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, - 0x00, 0x00, - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, - 0x00, 0x00, - }, - nil, - }, - { // has a fixed huffman block with some length-distance pairs - "shesells.txt", - "shesells.txt", - "she sells seashells by the seashore\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0x72, 0x66, 0x8b, 0x4a, - 0x00, 0x03, 0x73, 0x68, 0x65, 0x73, 0x65, 0x6c, - 0x6c, 0x73, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x2b, - 0xce, 0x48, 0x55, 0x28, 0x4e, 0xcd, 0xc9, 0x29, - 0x06, 0x92, 0x89, 0xc5, 0x19, 0x60, 0x56, 0x52, - 0xa5, 0x42, 0x09, 0x58, 0x18, 0x28, 0x90, 0x5f, - 0x94, 0xca, 0x05, 0x00, 0x76, 0xb0, 0x3b, 0xeb, - 0x24, 0x00, 0x00, 0x00, - }, - nil, - }, - { // has dynamic huffman blocks - "gettysburg", - "gettysburg", - " Four score and seven years ago our fathers brought forth on\n" + - "this continent, a new nation, conceived in Liberty, and dedicated\n" + - "to the proposition that all men are created equal.\n" + - " Now we are engaged in a great Civil War, testing whether that\n" + - "nation, or any nation so conceived and so dedicated, can long\n" + - "endure.\n" + - " We are met on a great battle-field of that war.\n" + - " We have come to dedicate a portion of that field, as a final\n" + - "resting place for those who here gave their lives that that\n" + - "nation might live. It is altogether fitting and proper that\n" + - "we should do this.\n" + - " But, in a larger sense, we can not dedicate — we can not\n" + - "consecrate — we can not hallow — this ground.\n" + - " The brave men, living and dead, who struggled here, have\n" + - "consecrated it, far above our poor power to add or detract.\n" + - "The world will little note, nor long remember what we say here,\n" + - "but it can never forget what they did here.\n" + - " It is for us the living, rather, to be dedicated here to the\n" + - "unfinished work which they who fought here have thus far so\n" + - "nobly advanced. It is rather for us to be here dedicated to\n" + - "the great task remaining before us — that from these honored\n" + - "dead we take increased devotion to that cause for which they\n" + - "gave the last full measure of devotion —\n" + - " that we here highly resolve that these dead shall not have\n" + - "died in vain — that this nation, under God, shall have a new\n" + - "birth of freedom — and that government of the people, by the\n" + - "people, for the people, shall not perish from this earth.\n" + - "\n" + - "Abraham Lincoln, November 19, 1863, Gettysburg, Pennsylvania\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xd1, 0x12, 0x2b, 0x4a, - 0x00, 0x03, 0x67, 0x65, 0x74, 0x74, 0x79, 0x73, - 0x62, 0x75, 0x72, 0x67, 0x00, 0x65, 0x54, 0xcd, - 0x6e, 0xd4, 0x30, 0x10, 0xbe, 0xfb, 0x29, 0xe6, - 0x01, 0x42, 0xa5, 0x0a, 0x09, 0xc1, 0x11, 0x90, - 0x40, 0x48, 0xa8, 0xe2, 0x80, 0xd4, 0xf3, 0x24, - 0x9e, 0x24, 0x56, 0xbd, 0x9e, 0xc5, 0x76, 0x76, - 0x95, 0x1b, 0x0f, 0xc1, 0x13, 0xf2, 0x24, 0x7c, - 0x63, 0x77, 0x9b, 0x4a, 0x5c, 0xaa, 0x6e, 0x6c, - 0xcf, 0x7c, 0x7f, 0x33, 0x44, 0x5f, 0x74, 0xcb, - 0x54, 0x26, 0xcd, 0x42, 0x9c, 0x3c, 0x15, 0xb9, - 0x48, 0xa2, 0x5d, 0x38, 0x17, 0xe2, 0x45, 0xc9, - 0x4e, 0x67, 0xae, 0xab, 0xe0, 0xf7, 0x98, 0x75, - 0x5b, 0xd6, 0x4a, 0xb3, 0xe6, 0xba, 0x92, 0x26, - 0x57, 0xd7, 0x50, 0x68, 0xd2, 0x54, 0x43, 0x92, - 0x54, 0x07, 0x62, 0x4a, 0x72, 0xa5, 0xc4, 0x35, - 0x68, 0x1a, 0xec, 0x60, 0x92, 0x70, 0x11, 0x4f, - 0x21, 0xd1, 0xf7, 0x30, 0x4a, 0xae, 0xfb, 0xd0, - 0x9a, 0x78, 0xf1, 0x61, 0xe2, 0x2a, 0xde, 0x55, - 0x25, 0xd4, 0xa6, 0x73, 0xd6, 0xb3, 0x96, 0x60, - 0xef, 0xf0, 0x9b, 0x2b, 0x71, 0x8c, 0x74, 0x02, - 0x10, 0x06, 0xac, 0x29, 0x8b, 0xdd, 0x25, 0xf9, - 0xb5, 0x71, 0xbc, 0x73, 0x44, 0x0f, 0x7a, 0xa5, - 0xab, 0xb4, 0x33, 0x49, 0x0b, 0x2f, 0xbd, 0x03, - 0xd3, 0x62, 0x17, 0xe9, 0x73, 0xb8, 0x84, 0x48, - 0x8f, 0x9c, 0x07, 0xaa, 0x52, 0x00, 0x6d, 0xa1, - 0xeb, 0x2a, 0xc6, 0xa0, 0x95, 0x76, 0x37, 0x78, - 0x9a, 0x81, 0x65, 0x7f, 0x46, 0x4b, 0x45, 0x5f, - 0xe1, 0x6d, 0x42, 0xe8, 0x01, 0x13, 0x5c, 0x38, - 0x51, 0xd4, 0xb4, 0x38, 0x49, 0x7e, 0xcb, 0x62, - 0x28, 0x1e, 0x3b, 0x82, 0x93, 0x54, 0x48, 0xf1, - 0xd2, 0x7d, 0xe4, 0x5a, 0xa3, 0xbc, 0x99, 0x83, - 0x44, 0x4f, 0x3a, 0x77, 0x36, 0x57, 0xce, 0xcf, - 0x2f, 0x56, 0xbe, 0x80, 0x90, 0x9e, 0x84, 0xea, - 0x51, 0x1f, 0x8f, 0xcf, 0x90, 0xd4, 0x60, 0xdc, - 0x5e, 0xb4, 0xf7, 0x10, 0x0b, 0x26, 0xe0, 0xff, - 0xc4, 0xd1, 0xe5, 0x67, 0x2e, 0xe7, 0xc8, 0x93, - 0x98, 0x05, 0xb8, 0xa8, 0x45, 0xc0, 0x4d, 0x09, - 0xdc, 0x84, 0x16, 0x2b, 0x0d, 0x9a, 0x21, 0x53, - 0x04, 0x8b, 0xd2, 0x0b, 0xbd, 0xa2, 0x4c, 0xa7, - 0x60, 0xee, 0xd9, 0xe1, 0x1d, 0xd1, 0xb7, 0x4a, - 0x30, 0x8f, 0x63, 0xd5, 0xa5, 0x8b, 0x33, 0x87, - 0xda, 0x1a, 0x18, 0x79, 0xf3, 0xe3, 0xa6, 0x17, - 0x94, 0x2e, 0xab, 0x6e, 0xa0, 0xe3, 0xcd, 0xac, - 0x50, 0x8c, 0xca, 0xa7, 0x0d, 0x76, 0x37, 0xd1, - 0x23, 0xe7, 0x05, 0x57, 0x8b, 0xa4, 0x22, 0x83, - 0xd9, 0x62, 0x52, 0x25, 0xad, 0x07, 0xbb, 0xbf, - 0xbf, 0xff, 0xbc, 0xfa, 0xee, 0x20, 0x73, 0x91, - 0x29, 0xff, 0x7f, 0x02, 0x71, 0x62, 0x84, 0xb5, - 0xf6, 0xb5, 0x25, 0x6b, 0x41, 0xde, 0x92, 0xb7, - 0x76, 0x3f, 0x91, 0x91, 0x31, 0x1b, 0x41, 0x84, - 0x62, 0x30, 0x0a, 0x37, 0xa4, 0x5e, 0x18, 0x3a, - 0x99, 0x08, 0xa5, 0xe6, 0x6d, 0x59, 0x22, 0xec, - 0x33, 0x39, 0x86, 0x26, 0xf5, 0xab, 0x66, 0xc8, - 0x08, 0x20, 0xcf, 0x0c, 0xd7, 0x47, 0x45, 0x21, - 0x0b, 0xf6, 0x59, 0xd5, 0xfe, 0x5c, 0x8d, 0xaa, - 0x12, 0x7b, 0x6f, 0xa1, 0xf0, 0x52, 0x33, 0x4f, - 0xf5, 0xce, 0x59, 0xd3, 0xab, 0x66, 0x10, 0xbf, - 0x06, 0xc4, 0x31, 0x06, 0x73, 0xd6, 0x80, 0xa2, - 0x78, 0xc2, 0x45, 0xcb, 0x03, 0x65, 0x39, 0xc9, - 0x09, 0xd1, 0x06, 0x04, 0x33, 0x1a, 0x5a, 0xf1, - 0xde, 0x01, 0xb8, 0x71, 0x83, 0xc4, 0xb5, 0xb3, - 0xc3, 0x54, 0x65, 0x33, 0x0d, 0x5a, 0xf7, 0x9b, - 0x90, 0x7c, 0x27, 0x1f, 0x3a, 0x58, 0xa3, 0xd8, - 0xfd, 0x30, 0x5f, 0xb7, 0xd2, 0x66, 0xa2, 0x93, - 0x1c, 0x28, 0xb7, 0xe9, 0x1b, 0x0c, 0xe1, 0x28, - 0x47, 0x26, 0xbb, 0xe9, 0x7d, 0x7e, 0xdc, 0x96, - 0x10, 0x92, 0x50, 0x56, 0x7c, 0x06, 0xe2, 0x27, - 0xb4, 0x08, 0xd3, 0xda, 0x7b, 0x98, 0x34, 0x73, - 0x9f, 0xdb, 0xf6, 0x62, 0xed, 0x31, 0x41, 0x13, - 0xd3, 0xa2, 0xa8, 0x4b, 0x3a, 0xc6, 0x1d, 0xe4, - 0x2f, 0x8c, 0xf8, 0xfb, 0x97, 0x64, 0xf4, 0xb6, - 0x2f, 0x80, 0x5a, 0xf3, 0x56, 0xe0, 0x40, 0x50, - 0xd5, 0x19, 0xd0, 0x1e, 0xfc, 0xca, 0xe5, 0xc9, - 0xd4, 0x60, 0x00, 0x81, 0x2e, 0xa3, 0xcc, 0xb6, - 0x52, 0xf0, 0xb4, 0xdb, 0x69, 0x99, 0xce, 0x7a, - 0x32, 0x4c, 0x08, 0xed, 0xaa, 0x10, 0x10, 0xe3, - 0x6f, 0xee, 0x99, 0x68, 0x95, 0x9f, 0x04, 0x71, - 0xb2, 0x49, 0x2f, 0x62, 0xa6, 0x5e, 0xb4, 0xef, - 0x02, 0xed, 0x4f, 0x27, 0xde, 0x4a, 0x0f, 0xfd, - 0xc1, 0xcc, 0xdd, 0x02, 0x8f, 0x08, 0x16, 0x54, - 0xdf, 0xda, 0xca, 0xe0, 0x82, 0xf1, 0xb4, 0x31, - 0x7a, 0xa9, 0x81, 0xfe, 0x90, 0xb7, 0x3e, 0xdb, - 0xd3, 0x35, 0xc0, 0x20, 0x80, 0x33, 0x46, 0x4a, - 0x63, 0xab, 0xd1, 0x0d, 0x29, 0xd2, 0xe2, 0x84, - 0xb8, 0xdb, 0xfa, 0xe9, 0x89, 0x44, 0x86, 0x7c, - 0xe8, 0x0b, 0xe6, 0x02, 0x6a, 0x07, 0x9b, 0x96, - 0xd0, 0xdb, 0x2e, 0x41, 0x4c, 0xa1, 0xd5, 0x57, - 0x45, 0x14, 0xfb, 0xe3, 0xa6, 0x72, 0x5b, 0x87, - 0x6e, 0x0c, 0x6d, 0x5b, 0xce, 0xe0, 0x2f, 0xe2, - 0x21, 0x81, 0x95, 0xb0, 0xe8, 0xb6, 0x32, 0x0b, - 0xb2, 0x98, 0x13, 0x52, 0x5d, 0xfb, 0xec, 0x63, - 0x17, 0x8a, 0x9e, 0x23, 0x22, 0x36, 0xee, 0xcd, - 0xda, 0xdb, 0xcf, 0x3e, 0xf1, 0xc7, 0xf1, 0x01, - 0x12, 0x93, 0x0a, 0xeb, 0x6f, 0xf2, 0x02, 0x15, - 0x96, 0x77, 0x5d, 0xef, 0x9c, 0xfb, 0x88, 0x91, - 0x59, 0xf9, 0x84, 0xdd, 0x9b, 0x26, 0x8d, 0x80, - 0xf9, 0x80, 0x66, 0x2d, 0xac, 0xf7, 0x1f, 0x06, - 0xba, 0x7f, 0xff, 0xee, 0xed, 0x40, 0x5f, 0xa5, - 0xd6, 0xbd, 0x8c, 0x5b, 0x46, 0xd2, 0x7e, 0x48, - 0x4a, 0x65, 0x8f, 0x08, 0x42, 0x60, 0xf7, 0x0f, - 0xb9, 0x16, 0x0b, 0x0c, 0x1a, 0x06, 0x00, 0x00, - }, - nil, - }, - { // has 1 non-empty fixed huffman block then garbage - "hello.txt", - "hello.txt + garbage", - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, - 0x00, 0x00, 'g', 'a', 'r', 'b', 'a', 'g', 'e', '!', '!', '!', - }, - ErrHeader, - }, - { // has 1 non-empty fixed huffman block not enough header - "hello.txt", - "hello.txt + garbage", - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0x0c, 0x00, - 0x00, 0x00, gzipID1, - }, - io.ErrUnexpectedEOF, - }, - { // has 1 non-empty fixed huffman block but corrupt checksum - "hello.txt", - "hello.txt + corrupt checksum", - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x00, - 0x00, 0x00, - }, - ErrChecksum, - }, - { // has 1 non-empty fixed huffman block but corrupt size - "hello.txt", - "hello.txt + corrupt size", - "hello world\n", - []byte{ - 0x1f, 0x8b, 0x08, 0x08, 0xc8, 0x58, 0x13, 0x4a, - 0x00, 0x03, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2e, - 0x74, 0x78, 0x74, 0x00, 0xcb, 0x48, 0xcd, 0xc9, - 0xc9, 0x57, 0x28, 0xcf, 0x2f, 0xca, 0x49, 0xe1, - 0x02, 0x00, 0x2d, 0x3b, 0x08, 0xaf, 0xff, 0x00, - 0x00, 0x00, - }, - ErrChecksum, - }, -} - -func TestDecompressor(t *testing.T) { - b := new(bytes.Buffer) - for _, tt := range gunzipTests { - in := bytes.NewReader(tt.gzip) - gzip, err := NewReader(in) - if err != nil { - t.Errorf("%s: NewReader: %s", tt.name, err) - continue - } - defer gzip.Close() - if tt.name != gzip.Name { - t.Errorf("%s: got name %s", tt.name, gzip.Name) - } - b.Reset() - n, err := io.Copy(b, gzip) - if err != tt.err { - t.Errorf("%s: io.Copy: %v want %v", tt.name, err, tt.err) - } - s := b.String() - if s != tt.raw { - t.Errorf("%s: got %d-byte %q want %d-byte %q", tt.name, n, s, len(tt.raw), tt.raw) - } - - // Test Reader Reset. - in = bytes.NewReader(tt.gzip) - err = gzip.Reset(in) - if err != nil { - t.Errorf("%s: Reset: %s", tt.name, err) - continue - } - if tt.name != gzip.Name { - t.Errorf("%s: got name %s", tt.name, gzip.Name) - } - b.Reset() - n, err = io.Copy(b, gzip) - if err != tt.err { - t.Errorf("%s: io.Copy: %v want %v", tt.name, err, tt.err) - } - s = b.String() - if s != tt.raw { - t.Errorf("%s: got %d-byte %q want %d-byte %q", tt.name, n, s, len(tt.raw), tt.raw) - } - } -} - -func TestIssue6550(t *testing.T) { - f, err := os.Open("testdata/issue6550.gz") - if err != nil { - t.Fatal(err) - } - gzip, err := NewReader(f) - if err != nil { - t.Fatalf("NewReader(testdata/issue6550.gz): %v", err) - } - defer gzip.Close() - done := make(chan bool, 1) - go func() { - _, err := io.Copy(ioutil.Discard, gzip) - if err == nil { - t.Errorf("Copy succeeded") - } else { - t.Logf("Copy failed (correctly): %v", err) - } - done <- true - }() - select { - case <-time.After(1 * time.Second): - t.Errorf("Copy hung") - case <-done: - // ok - } -} - -func TestInitialReset(t *testing.T) { - var r Reader - if err := r.Reset(bytes.NewReader(gunzipTests[1].gzip)); err != nil { - t.Error(err) - } - var buf bytes.Buffer - if _, err := io.Copy(&buf, &r); err != nil { - t.Error(err) - } - if s := buf.String(); s != gunzipTests[1].raw { - t.Errorf("got %q want %q", s, gunzipTests[1].raw) - } -} - -func TestMultistreamFalse(t *testing.T) { - // Find concatenation test. - var tt gunzipTest - for _, tt = range gunzipTests { - if strings.HasSuffix(tt.desc, " x2") { - goto Found - } - } - t.Fatal("cannot find hello.txt x2 in gunzip tests") - -Found: - br := bytes.NewReader(tt.gzip) - var r Reader - if err := r.Reset(br); err != nil { - t.Fatalf("first reset: %v", err) - } - - // Expect two streams with "hello world\n", then real EOF. - const hello = "hello world\n" - - r.Multistream(false) - data, err := ioutil.ReadAll(&r) - if string(data) != hello || err != nil { - t.Fatalf("first stream = %q, %v, want %q, %v", string(data), err, hello, nil) - } - - if err := r.Reset(br); err != nil { - t.Fatalf("second reset: %v", err) - } - r.Multistream(false) - data, err = ioutil.ReadAll(&r) - if string(data) != hello || err != nil { - t.Fatalf("second stream = %q, %v, want %q, %v", string(data), err, hello, nil) - } - - if err := r.Reset(br); err != io.EOF { - t.Fatalf("third reset: err=%v, want io.EOF", err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip.go b/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip.go deleted file mode 100644 index 5131d128e4e21e348e975d4180b0207878a164dc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip.go +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gzip - -import ( - "compress/flate" - "errors" - "fmt" - "hash" - "hash/crc32" - "io" -) - -// These constants are copied from the flate package, so that code that imports -// "compress/gzip" does not also have to import "compress/flate". -const ( - NoCompression = flate.NoCompression - BestSpeed = flate.BestSpeed - BestCompression = flate.BestCompression - DefaultCompression = flate.DefaultCompression -) - -// A Writer is an io.WriteCloser. -// Writes to a Writer are compressed and written to w. -type Writer struct { - Header - w io.Writer - level int - wroteHeader bool - compressor *flate.Writer - digest hash.Hash32 - size uint32 - closed bool - buf [10]byte - err error -} - -// NewWriter returns a new Writer. -// Writes to the returned writer are compressed and written to w. -// -// It is the caller's responsibility to call Close on the WriteCloser when done. -// Writes may be buffered and not flushed until Close. -// -// Callers that wish to set the fields in Writer.Header must do so before -// the first call to Write or Close. The Comment and Name header fields are -// UTF-8 strings in Go, but the underlying format requires NUL-terminated ISO -// 8859-1 (Latin-1). NUL or non-Latin-1 runes in those strings will lead to an -// error on Write. -func NewWriter(w io.Writer) *Writer { - z, _ := NewWriterLevel(w, DefaultCompression) - return z -} - -// NewWriterLevel is like NewWriter but specifies the compression level instead -// of assuming DefaultCompression. -// -// The compression level can be DefaultCompression, NoCompression, or any -// integer value between BestSpeed and BestCompression inclusive. The error -// returned will be nil if the level is valid. -func NewWriterLevel(w io.Writer, level int) (*Writer, error) { - if level < DefaultCompression || level > BestCompression { - return nil, fmt.Errorf("gzip: invalid compression level: %d", level) - } - z := new(Writer) - z.init(w, level) - return z, nil -} - -func (z *Writer) init(w io.Writer, level int) { - digest := z.digest - if digest != nil { - digest.Reset() - } else { - digest = crc32.NewIEEE() - } - compressor := z.compressor - if compressor != nil { - compressor.Reset(w) - } - *z = Writer{ - Header: Header{ - OS: 255, // unknown - }, - w: w, - level: level, - digest: digest, - compressor: compressor, - } -} - -// Reset discards the Writer z's state and makes it equivalent to the -// result of its original state from NewWriter or NewWriterLevel, but -// writing to w instead. This permits reusing a Writer rather than -// allocating a new one. -func (z *Writer) Reset(w io.Writer) { - z.init(w, z.level) -} - -// GZIP (RFC 1952) is little-endian, unlike ZLIB (RFC 1950). -func put2(p []byte, v uint16) { - p[0] = uint8(v >> 0) - p[1] = uint8(v >> 8) -} - -func put4(p []byte, v uint32) { - p[0] = uint8(v >> 0) - p[1] = uint8(v >> 8) - p[2] = uint8(v >> 16) - p[3] = uint8(v >> 24) -} - -// writeBytes writes a length-prefixed byte slice to z.w. -func (z *Writer) writeBytes(b []byte) error { - if len(b) > 0xffff { - return errors.New("gzip.Write: Extra data is too large") - } - put2(z.buf[0:2], uint16(len(b))) - _, err := z.w.Write(z.buf[0:2]) - if err != nil { - return err - } - _, err = z.w.Write(b) - return err -} - -// writeString writes a UTF-8 string s in GZIP's format to z.w. -// GZIP (RFC 1952) specifies that strings are NUL-terminated ISO 8859-1 (Latin-1). -func (z *Writer) writeString(s string) (err error) { - // GZIP stores Latin-1 strings; error if non-Latin-1; convert if non-ASCII. - needconv := false - for _, v := range s { - if v == 0 || v > 0xff { - return errors.New("gzip.Write: non-Latin-1 header string") - } - if v > 0x7f { - needconv = true - } - } - if needconv { - b := make([]byte, 0, len(s)) - for _, v := range s { - b = append(b, byte(v)) - } - _, err = z.w.Write(b) - } else { - _, err = io.WriteString(z.w, s) - } - if err != nil { - return err - } - // GZIP strings are NUL-terminated. - z.buf[0] = 0 - _, err = z.w.Write(z.buf[0:1]) - return err -} - -// Write writes a compressed form of p to the underlying io.Writer. The -// compressed bytes are not necessarily flushed until the Writer is closed. -func (z *Writer) Write(p []byte) (int, error) { - if z.err != nil { - return 0, z.err - } - var n int - // Write the GZIP header lazily. - if !z.wroteHeader { - z.wroteHeader = true - z.buf[0] = gzipID1 - z.buf[1] = gzipID2 - z.buf[2] = gzipDeflate - z.buf[3] = 0 - if z.Extra != nil { - z.buf[3] |= 0x04 - } - if z.Name != "" { - z.buf[3] |= 0x08 - } - if z.Comment != "" { - z.buf[3] |= 0x10 - } - put4(z.buf[4:8], uint32(z.ModTime.Unix())) - if z.level == BestCompression { - z.buf[8] = 2 - } else if z.level == BestSpeed { - z.buf[8] = 4 - } else { - z.buf[8] = 0 - } - z.buf[9] = z.OS - n, z.err = z.w.Write(z.buf[0:10]) - if z.err != nil { - return n, z.err - } - if z.Extra != nil { - z.err = z.writeBytes(z.Extra) - if z.err != nil { - return n, z.err - } - } - if z.Name != "" { - z.err = z.writeString(z.Name) - if z.err != nil { - return n, z.err - } - } - if z.Comment != "" { - z.err = z.writeString(z.Comment) - if z.err != nil { - return n, z.err - } - } - if z.compressor == nil { - z.compressor, _ = flate.NewWriter(z.w, z.level) - } - } - z.size += uint32(len(p)) - z.digest.Write(p) - n, z.err = z.compressor.Write(p) - return n, z.err -} - -// Flush flushes any pending compressed data to the underlying writer. -// -// It is useful mainly in compressed network protocols, to ensure that -// a remote reader has enough data to reconstruct a packet. Flush does -// not return until the data has been written. If the underlying -// writer returns an error, Flush returns that error. -// -// In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH. -func (z *Writer) Flush() error { - if z.err != nil { - return z.err - } - if z.closed { - return nil - } - if !z.wroteHeader { - z.Write(nil) - if z.err != nil { - return z.err - } - } - z.err = z.compressor.Flush() - return z.err -} - -// Close closes the Writer, flushing any unwritten data to the underlying -// io.Writer, but does not close the underlying io.Writer. -func (z *Writer) Close() error { - if z.err != nil { - return z.err - } - if z.closed { - return nil - } - z.closed = true - if !z.wroteHeader { - z.Write(nil) - if z.err != nil { - return z.err - } - } - z.err = z.compressor.Close() - if z.err != nil { - return z.err - } - put4(z.buf[0:4], z.digest.Sum32()) - put4(z.buf[4:8], z.size) - _, z.err = z.w.Write(z.buf[0:8]) - return z.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip_test.go b/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip_test.go deleted file mode 100644 index 09271b24e92037492a7e9e753ec58f96a88d8ace..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/gzip/gzip_test.go +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gzip - -import ( - "bufio" - "bytes" - "io/ioutil" - "testing" - "time" -) - -// TestEmpty tests that an empty payload still forms a valid GZIP stream. -func TestEmpty(t *testing.T) { - buf := new(bytes.Buffer) - - if err := NewWriter(buf).Close(); err != nil { - t.Fatalf("Writer.Close: %v", err) - } - - r, err := NewReader(buf) - if err != nil { - t.Fatalf("NewReader: %v", err) - } - b, err := ioutil.ReadAll(r) - if err != nil { - t.Fatalf("ReadAll: %v", err) - } - if len(b) != 0 { - t.Fatalf("got %d bytes, want 0", len(b)) - } - if err := r.Close(); err != nil { - t.Fatalf("Reader.Close: %v", err) - } -} - -// TestRoundTrip tests that gzipping and then gunzipping is the identity -// function. -func TestRoundTrip(t *testing.T) { - buf := new(bytes.Buffer) - - w := NewWriter(buf) - w.Comment = "comment" - w.Extra = []byte("extra") - w.ModTime = time.Unix(1e8, 0) - w.Name = "name" - if _, err := w.Write([]byte("payload")); err != nil { - t.Fatalf("Write: %v", err) - } - if err := w.Close(); err != nil { - t.Fatalf("Writer.Close: %v", err) - } - - r, err := NewReader(buf) - if err != nil { - t.Fatalf("NewReader: %v", err) - } - b, err := ioutil.ReadAll(r) - if err != nil { - t.Fatalf("ReadAll: %v", err) - } - if string(b) != "payload" { - t.Fatalf("payload is %q, want %q", string(b), "payload") - } - if r.Comment != "comment" { - t.Fatalf("comment is %q, want %q", r.Comment, "comment") - } - if string(r.Extra) != "extra" { - t.Fatalf("extra is %q, want %q", r.Extra, "extra") - } - if r.ModTime.Unix() != 1e8 { - t.Fatalf("mtime is %d, want %d", r.ModTime.Unix(), uint32(1e8)) - } - if r.Name != "name" { - t.Fatalf("name is %q, want %q", r.Name, "name") - } - if err := r.Close(); err != nil { - t.Fatalf("Reader.Close: %v", err) - } -} - -// TestLatin1 tests the internal functions for converting to and from Latin-1. -func TestLatin1(t *testing.T) { - latin1 := []byte{0xc4, 'u', 0xdf, 'e', 'r', 'u', 'n', 'g', 0} - utf8 := "Äußerung" - z := Reader{r: bufio.NewReader(bytes.NewReader(latin1))} - s, err := z.readString() - if err != nil { - t.Fatalf("readString: %v", err) - } - if s != utf8 { - t.Fatalf("read latin-1: got %q, want %q", s, utf8) - } - - buf := bytes.NewBuffer(make([]byte, 0, len(latin1))) - c := Writer{w: buf} - if err = c.writeString(utf8); err != nil { - t.Fatalf("writeString: %v", err) - } - s = buf.String() - if s != string(latin1) { - t.Fatalf("write utf-8: got %q, want %q", s, string(latin1)) - } -} - -// TestLatin1RoundTrip tests that metadata that is representable in Latin-1 -// survives a round trip. -func TestLatin1RoundTrip(t *testing.T) { - testCases := []struct { - name string - ok bool - }{ - {"", true}, - {"ASCII is OK", true}, - {"unless it contains a NUL\x00", false}, - {"no matter where \x00 occurs", false}, - {"\x00\x00\x00", false}, - {"Látin-1 also passes (U+00E1)", true}, - {"but LĀtin Extended-A (U+0100) does not", false}, - {"neither does 日本語", false}, - {"invalid UTF-8 also \xffails", false}, - {"\x00 as does Látin-1 with NUL", false}, - } - for _, tc := range testCases { - buf := new(bytes.Buffer) - - w := NewWriter(buf) - w.Name = tc.name - err := w.Close() - if (err == nil) != tc.ok { - t.Errorf("Writer.Close: name = %q, err = %v", tc.name, err) - continue - } - if !tc.ok { - continue - } - - r, err := NewReader(buf) - if err != nil { - t.Errorf("NewReader: %v", err) - continue - } - _, err = ioutil.ReadAll(r) - if err != nil { - t.Errorf("ReadAll: %v", err) - continue - } - if r.Name != tc.name { - t.Errorf("name is %q, want %q", r.Name, tc.name) - continue - } - if err := r.Close(); err != nil { - t.Errorf("Reader.Close: %v", err) - continue - } - } -} - -func TestWriterFlush(t *testing.T) { - buf := new(bytes.Buffer) - - w := NewWriter(buf) - w.Comment = "comment" - w.Extra = []byte("extra") - w.ModTime = time.Unix(1e8, 0) - w.Name = "name" - - n0 := buf.Len() - if n0 != 0 { - t.Fatalf("buffer size = %d before writes; want 0", n0) - } - - if err := w.Flush(); err != nil { - t.Fatal(err) - } - - n1 := buf.Len() - if n1 == 0 { - t.Fatal("no data after first flush") - } - - w.Write([]byte("x")) - - n2 := buf.Len() - if n1 != n2 { - t.Fatalf("after writing a single byte, size changed from %d to %d; want no change", n1, n2) - } - - if err := w.Flush(); err != nil { - t.Fatal(err) - } - - n3 := buf.Len() - if n2 == n3 { - t.Fatal("Flush didn't flush any data") - } -} - -// Multiple gzip files concatenated form a valid gzip file. -func TestConcat(t *testing.T) { - var buf bytes.Buffer - w := NewWriter(&buf) - w.Write([]byte("hello ")) - w.Close() - w = NewWriter(&buf) - w.Write([]byte("world\n")) - w.Close() - - r, err := NewReader(&buf) - data, err := ioutil.ReadAll(r) - if string(data) != "hello world\n" || err != nil { - t.Fatalf("ReadAll = %q, %v, want %q, nil", data, err, "hello world") - } -} - -func TestWriterReset(t *testing.T) { - buf := new(bytes.Buffer) - buf2 := new(bytes.Buffer) - z := NewWriter(buf) - msg := []byte("hello world") - z.Write(msg) - z.Close() - z.Reset(buf2) - z.Write(msg) - z.Close() - if buf.String() != buf2.String() { - t.Errorf("buf2 %q != original buf of %q", buf2.String(), buf.String()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/gzip/testdata/issue6550.gz b/llgo/third_party/gofrontend/libgo/go/compress/gzip/testdata/issue6550.gz deleted file mode 100644 index 57972b636680170bbe26d3876481b24f54d4ab55..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/compress/gzip/testdata/issue6550.gz and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader.go b/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader.go deleted file mode 100644 index 1353831eca9d8ad4d9a243da5f8cfc6cef1ae31c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader.go +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package lzw implements the Lempel-Ziv-Welch compressed data format, -// described in T. A. Welch, ``A Technique for High-Performance Data -// Compression'', Computer, 17(6) (June 1984), pp 8-19. -// -// In particular, it implements LZW as used by the GIF and PDF file -// formats, which means variable-width codes up to 12 bits and the first -// two non-literal codes are a clear code and an EOF code. -// -// The TIFF file format uses a similar but incompatible version of the LZW -// algorithm. See the golang.org/x/image/tiff/lzw package for an -// implementation. -package lzw - -// TODO(nigeltao): check that PDF uses LZW in the same way as GIF, -// modulo LSB/MSB packing order. - -import ( - "bufio" - "errors" - "fmt" - "io" -) - -// Order specifies the bit ordering in an LZW data stream. -type Order int - -const ( - // LSB means Least Significant Bits first, as used in the GIF file format. - LSB Order = iota - // MSB means Most Significant Bits first, as used in the TIFF and PDF - // file formats. - MSB -) - -const ( - maxWidth = 12 - decoderInvalidCode = 0xffff - flushBuffer = 1 << maxWidth -) - -// decoder is the state from which the readXxx method converts a byte -// stream into a code stream. -type decoder struct { - r io.ByteReader - bits uint32 - nBits uint - width uint - read func(*decoder) (uint16, error) // readLSB or readMSB - litWidth int // width in bits of literal codes - err error - - // The first 1<= 1<>= d.width - d.nBits -= d.width - return code, nil -} - -// readMSB returns the next code for "Most Significant Bits first" data. -func (d *decoder) readMSB() (uint16, error) { - for d.nBits < d.width { - x, err := d.r.ReadByte() - if err != nil { - return 0, err - } - d.bits |= uint32(x) << (24 - d.nBits) - d.nBits += 8 - } - code := uint16(d.bits >> (32 - d.width)) - d.bits <<= d.width - d.nBits -= d.width - return code, nil -} - -func (d *decoder) Read(b []byte) (int, error) { - for { - if len(d.toRead) > 0 { - n := copy(b, d.toRead) - d.toRead = d.toRead[n:] - return n, nil - } - if d.err != nil { - return 0, d.err - } - d.decode() - } -} - -// decode decompresses bytes from r and leaves them in d.toRead. -// read specifies how to decode bytes into codes. -// litWidth is the width in bits of literal codes. -func (d *decoder) decode() { - // Loop over the code stream, converting codes into decompressed bytes. - for { - code, err := d.read(d) - if err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - d.err = err - d.flush() - return - } - switch { - case code < d.clear: - // We have a literal code. - d.output[d.o] = uint8(code) - d.o++ - if d.last != decoderInvalidCode { - // Save what the hi code expands to. - d.suffix[d.hi] = uint8(code) - d.prefix[d.hi] = d.last - } - case code == d.clear: - d.width = 1 + uint(d.litWidth) - d.hi = d.eof - d.overflow = 1 << d.width - d.last = decoderInvalidCode - continue - case code == d.eof: - d.flush() - d.err = io.EOF - return - case code <= d.hi: - c, i := code, len(d.output)-1 - if code == d.hi { - // code == hi is a special case which expands to the last expansion - // followed by the head of the last expansion. To find the head, we walk - // the prefix chain until we find a literal code. - c = d.last - for c >= d.clear { - c = d.prefix[c] - } - d.output[i] = uint8(c) - i-- - c = d.last - } - // Copy the suffix chain into output and then write that to w. - for c >= d.clear { - d.output[i] = d.suffix[c] - i-- - c = d.prefix[c] - } - d.output[i] = uint8(c) - d.o += copy(d.output[d.o:], d.output[i:]) - if d.last != decoderInvalidCode { - // Save what the hi code expands to. - d.suffix[d.hi] = uint8(c) - d.prefix[d.hi] = d.last - } - default: - d.err = errors.New("lzw: invalid code") - d.flush() - return - } - d.last, d.hi = code, d.hi+1 - if d.hi >= d.overflow { - if d.width == maxWidth { - d.last = decoderInvalidCode - } else { - d.width++ - d.overflow <<= 1 - } - } - if d.o >= flushBuffer { - d.flush() - return - } - } -} - -func (d *decoder) flush() { - d.toRead = d.output[:d.o] - d.o = 0 -} - -var errClosed = errors.New("lzw: reader/writer is closed") - -func (d *decoder) Close() error { - d.err = errClosed // in case any Reads come along - return nil -} - -// NewReader creates a new io.ReadCloser. -// Reads from the returned io.ReadCloser read and decompress data from r. -// If r does not also implement io.ByteReader, -// the decompressor may read more data than necessary from r. -// It is the caller's responsibility to call Close on the ReadCloser when -// finished reading. -// The number of bits to use for literal codes, litWidth, must be in the -// range [2,8] and is typically 8. It must equal the litWidth -// used during compression. -func NewReader(r io.Reader, order Order, litWidth int) io.ReadCloser { - d := new(decoder) - switch order { - case LSB: - d.read = (*decoder).readLSB - case MSB: - d.read = (*decoder).readMSB - default: - d.err = errors.New("lzw: unknown order") - return d - } - if litWidth < 2 || 8 < litWidth { - d.err = fmt.Errorf("lzw: litWidth %d out of range", litWidth) - return d - } - if br, ok := r.(io.ByteReader); ok { - d.r = br - } else { - d.r = bufio.NewReader(r) - } - d.litWidth = litWidth - d.width = 1 + uint(litWidth) - d.clear = uint16(1) << uint(litWidth) - d.eof, d.hi = d.clear+1, d.clear+1 - d.overflow = uint16(1) << d.width - d.last = decoderInvalidCode - - return d -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader_test.go b/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader_test.go deleted file mode 100644 index c3a5c3a0aaacdf3bfce7fbbf111786cb9310e98a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/lzw/reader_test.go +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package lzw - -import ( - "bytes" - "io" - "io/ioutil" - "runtime" - "strconv" - "strings" - "testing" -) - -type lzwTest struct { - desc string - raw string - compressed string - err error -} - -var lzwTests = []lzwTest{ - { - "empty;LSB;8", - "", - "\x01\x01", - nil, - }, - { - "empty;MSB;8", - "", - "\x80\x80", - nil, - }, - { - "tobe;LSB;7", - "TOBEORNOTTOBEORTOBEORNOT", - "\x54\x4f\x42\x45\x4f\x52\x4e\x4f\x54\x82\x84\x86\x8b\x85\x87\x89\x81", - nil, - }, - { - "tobe;LSB;8", - "TOBEORNOTTOBEORTOBEORNOT", - "\x54\x9e\x08\x29\xf2\x44\x8a\x93\x27\x54\x04\x12\x34\xb8\xb0\xe0\xc1\x84\x01\x01", - nil, - }, - { - "tobe;MSB;7", - "TOBEORNOTTOBEORTOBEORNOT", - "\x54\x4f\x42\x45\x4f\x52\x4e\x4f\x54\x82\x84\x86\x8b\x85\x87\x89\x81", - nil, - }, - { - "tobe;MSB;8", - "TOBEORNOTTOBEORTOBEORNOT", - "\x2a\x13\xc8\x44\x52\x79\x48\x9c\x4f\x2a\x40\xa0\x90\x68\x5c\x16\x0f\x09\x80\x80", - nil, - }, - { - "tobe-truncated;LSB;8", - "TOBEORNOTTOBEORTOBEORNOT", - "\x54\x9e\x08\x29\xf2\x44\x8a\x93\x27\x54\x04", - io.ErrUnexpectedEOF, - }, - // This example comes from http://en.wikipedia.org/wiki/Graphics_Interchange_Format. - { - "gif;LSB;8", - "\x28\xff\xff\xff\x28\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", - "\x00\x51\xfc\x1b\x28\x70\xa0\xc1\x83\x01\x01", - nil, - }, - // This example comes from http://compgroups.net/comp.lang.ruby/Decompressing-LZW-compression-from-PDF-file - { - "pdf;MSB;8", - "-----A---B", - "\x80\x0b\x60\x50\x22\x0c\x0c\x85\x01", - nil, - }, -} - -func TestReader(t *testing.T) { - var b bytes.Buffer - for _, tt := range lzwTests { - d := strings.Split(tt.desc, ";") - var order Order - switch d[1] { - case "LSB": - order = LSB - case "MSB": - order = MSB - default: - t.Errorf("%s: bad order %q", tt.desc, d[1]) - } - litWidth, _ := strconv.Atoi(d[2]) - rc := NewReader(strings.NewReader(tt.compressed), order, litWidth) - defer rc.Close() - b.Reset() - n, err := io.Copy(&b, rc) - s := b.String() - if err != nil { - if err != tt.err { - t.Errorf("%s: io.Copy: %v want %v", tt.desc, err, tt.err) - } - if err == io.ErrUnexpectedEOF { - // Even if the input is truncated, we should still return the - // partial decoded result. - if n == 0 || !strings.HasPrefix(tt.raw, s) { - t.Errorf("got %d bytes (%q), want a non-empty prefix of %q", n, s, tt.raw) - } - } - continue - } - if s != tt.raw { - t.Errorf("%s: got %d-byte %q want %d-byte %q", tt.desc, n, s, len(tt.raw), tt.raw) - } - } -} - -func benchmarkDecoder(b *testing.B, n int) { - b.StopTimer() - b.SetBytes(int64(n)) - buf0, err := ioutil.ReadFile("../testdata/e.txt") - if err != nil { - b.Fatal(err) - } - if len(buf0) == 0 { - b.Fatalf("test file has no data") - } - compressed := new(bytes.Buffer) - w := NewWriter(compressed, LSB, 8) - for i := 0; i < n; i += len(buf0) { - if len(buf0) > n-i { - buf0 = buf0[:n-i] - } - w.Write(buf0) - } - w.Close() - buf1 := compressed.Bytes() - buf0, compressed, w = nil, nil, nil - runtime.GC() - b.StartTimer() - for i := 0; i < b.N; i++ { - io.Copy(ioutil.Discard, NewReader(bytes.NewReader(buf1), LSB, 8)) - } -} - -func BenchmarkDecoder1e4(b *testing.B) { - benchmarkDecoder(b, 1e4) -} - -func BenchmarkDecoder1e5(b *testing.B) { - benchmarkDecoder(b, 1e5) -} - -func BenchmarkDecoder1e6(b *testing.B) { - benchmarkDecoder(b, 1e6) -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/lzw/writer.go b/llgo/third_party/gofrontend/libgo/go/compress/lzw/writer.go deleted file mode 100644 index 7367c29651d772b6a6f5eeba0ba0af5ac1959d57..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/lzw/writer.go +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package lzw - -import ( - "bufio" - "errors" - "fmt" - "io" -) - -// A writer is a buffered, flushable writer. -type writer interface { - io.ByteWriter - Flush() error -} - -// An errWriteCloser is an io.WriteCloser that always returns a given error. -type errWriteCloser struct { - err error -} - -func (e *errWriteCloser) Write([]byte) (int, error) { - return 0, e.err -} - -func (e *errWriteCloser) Close() error { - return e.err -} - -const ( - // A code is a 12 bit value, stored as a uint32 when encoding to avoid - // type conversions when shifting bits. - maxCode = 1<<12 - 1 - invalidCode = 1<<32 - 1 - // There are 1<<12 possible codes, which is an upper bound on the number of - // valid hash table entries at any given point in time. tableSize is 4x that. - tableSize = 4 * 1 << 12 - tableMask = tableSize - 1 - // A hash table entry is a uint32. Zero is an invalid entry since the - // lower 12 bits of a valid entry must be a non-literal code. - invalidEntry = 0 -) - -// encoder is LZW compressor. -type encoder struct { - // w is the writer that compressed bytes are written to. - w writer - // order, write, bits, nBits and width are the state for - // converting a code stream into a byte stream. - order Order - write func(*encoder, uint32) error - bits uint32 - nBits uint - width uint - // litWidth is the width in bits of literal codes. - litWidth uint - // hi is the code implied by the next code emission. - // overflow is the code at which hi overflows the code width. - hi, overflow uint32 - // savedCode is the accumulated code at the end of the most recent Write - // call. It is equal to invalidCode if there was no such call. - savedCode uint32 - // err is the first error encountered during writing. Closing the encoder - // will make any future Write calls return errClosed - err error - // table is the hash table from 20-bit keys to 12-bit values. Each table - // entry contains key<<12|val and collisions resolve by linear probing. - // The keys consist of a 12-bit code prefix and an 8-bit byte suffix. - // The values are a 12-bit code. - table [tableSize]uint32 -} - -// writeLSB writes the code c for "Least Significant Bits first" data. -func (e *encoder) writeLSB(c uint32) error { - e.bits |= c << e.nBits - e.nBits += e.width - for e.nBits >= 8 { - if err := e.w.WriteByte(uint8(e.bits)); err != nil { - return err - } - e.bits >>= 8 - e.nBits -= 8 - } - return nil -} - -// writeMSB writes the code c for "Most Significant Bits first" data. -func (e *encoder) writeMSB(c uint32) error { - e.bits |= c << (32 - e.width - e.nBits) - e.nBits += e.width - for e.nBits >= 8 { - if err := e.w.WriteByte(uint8(e.bits >> 24)); err != nil { - return err - } - e.bits <<= 8 - e.nBits -= 8 - } - return nil -} - -// errOutOfCodes is an internal error that means that the encoder has run out -// of unused codes and a clear code needs to be sent next. -var errOutOfCodes = errors.New("lzw: out of codes") - -// incHi increments e.hi and checks for both overflow and running out of -// unused codes. In the latter case, incHi sends a clear code, resets the -// encoder state and returns errOutOfCodes. -func (e *encoder) incHi() error { - e.hi++ - if e.hi == e.overflow { - e.width++ - e.overflow <<= 1 - } - if e.hi == maxCode { - clear := uint32(1) << e.litWidth - if err := e.write(e, clear); err != nil { - return err - } - e.width = uint(e.litWidth) + 1 - e.hi = clear + 1 - e.overflow = clear << 1 - for i := range e.table { - e.table[i] = invalidEntry - } - return errOutOfCodes - } - return nil -} - -// Write writes a compressed representation of p to e's underlying writer. -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - if len(p) == 0 { - return 0, nil - } - if maxLit := uint8(1< maxLit { - e.err = errors.New("lzw: input byte too large for the litWidth") - return 0, e.err - } - } - } - n = len(p) - code := e.savedCode - if code == invalidCode { - // The first code sent is always a literal code. - code, p = uint32(p[0]), p[1:] - } -loop: - for _, x := range p { - literal := uint32(x) - key := code<<8 | literal - // If there is a hash table hit for this key then we continue the loop - // and do not emit a code yet. - hash := (key>>12 ^ key) & tableMask - for h, t := hash, e.table[hash]; t != invalidEntry; { - if key == t>>12 { - code = t & maxCode - continue loop - } - h = (h + 1) & tableMask - t = e.table[h] - } - // Otherwise, write the current code, and literal becomes the start of - // the next emitted code. - if e.err = e.write(e, code); e.err != nil { - return 0, e.err - } - code = literal - // Increment e.hi, the next implied code. If we run out of codes, reset - // the encoder state (including clearing the hash table) and continue. - if err1 := e.incHi(); err1 != nil { - if err1 == errOutOfCodes { - continue - } - e.err = err1 - return 0, e.err - } - // Otherwise, insert key -> e.hi into the map that e.table represents. - for { - if e.table[hash] == invalidEntry { - e.table[hash] = (key << 12) | e.hi - break - } - hash = (hash + 1) & tableMask - } - } - e.savedCode = code - return n, nil -} - -// Close closes the encoder, flushing any pending output. It does not close or -// flush e's underlying writer. -func (e *encoder) Close() error { - if e.err != nil { - if e.err == errClosed { - return nil - } - return e.err - } - // Make any future calls to Write return errClosed. - e.err = errClosed - // Write the savedCode if valid. - if e.savedCode != invalidCode { - if err := e.write(e, e.savedCode); err != nil { - return err - } - if err := e.incHi(); err != nil && err != errOutOfCodes { - return err - } - } - // Write the eof code. - eof := uint32(1)< 0 { - if e.order == MSB { - e.bits >>= 24 - } - if err := e.w.WriteByte(uint8(e.bits)); err != nil { - return err - } - } - return e.w.Flush() -} - -// NewWriter creates a new io.WriteCloser. -// Writes to the returned io.WriteCloser are compressed and written to w. -// It is the caller's responsibility to call Close on the WriteCloser when -// finished writing. -// The number of bits to use for literal codes, litWidth, must be in the -// range [2,8] and is typically 8. Input bytes must be less than 1<= 1<<2: got nil error, want non-nil") - } -} - -func benchmarkEncoder(b *testing.B, n int) { - b.StopTimer() - b.SetBytes(int64(n)) - buf0, err := ioutil.ReadFile("../testdata/e.txt") - if err != nil { - b.Fatal(err) - } - if len(buf0) == 0 { - b.Fatalf("test file has no data") - } - buf1 := make([]byte, n) - for i := 0; i < n; i += len(buf0) { - if len(buf0) > n-i { - buf0 = buf0[:n-i] - } - copy(buf1[i:], buf0) - } - buf0 = nil - runtime.GC() - b.StartTimer() - for i := 0; i < b.N; i++ { - w := NewWriter(ioutil.Discard, LSB, 8) - w.Write(buf1) - w.Close() - } -} - -func BenchmarkEncoder1e4(b *testing.B) { - benchmarkEncoder(b, 1e4) -} - -func BenchmarkEncoder1e5(b *testing.B) { - benchmarkEncoder(b, 1e5) -} - -func BenchmarkEncoder1e6(b *testing.B) { - benchmarkEncoder(b, 1e6) -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/testdata/Mark.Twain-Tom.Sawyer.txt b/llgo/third_party/gofrontend/libgo/go/compress/testdata/Mark.Twain-Tom.Sawyer.txt deleted file mode 100644 index c97da7eccf34b333e95a02fa256ba2f4413e03ba..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/testdata/Mark.Twain-Tom.Sawyer.txt +++ /dev/null @@ -1,8858 +0,0 @@ -The Project Gutenberg EBook of The Adventures of Tom Sawyer, Complete -by Mark Twain (Samuel Clemens) - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - - -Title: The Adventures of Tom Sawyer, Complete - -Author: Mark Twain (Samuel Clemens) - -Release Date: August 20, 2006 [EBook #74] -[Last updated: May 3, 2011] - -Language: English - - -*** START OF THIS PROJECT GUTENBERG EBOOK TOM SAWYER *** - - - - -Produced by David Widger. The previous edition was updated by Jose -Menendez. - - - - - - THE ADVENTURES OF TOM SAWYER - BY - MARK TWAIN - (Samuel Langhorne Clemens) - - - - - P R E F A C E - -MOST of the adventures recorded in this book really occurred; one or -two were experiences of my own, the rest those of boys who were -schoolmates of mine. Huck Finn is drawn from life; Tom Sawyer also, but -not from an individual--he is a combination of the characteristics of -three boys whom I knew, and therefore belongs to the composite order of -architecture. - -The odd superstitions touched upon were all prevalent among children -and slaves in the West at the period of this story--that is to say, -thirty or forty years ago. - -Although my book is intended mainly for the entertainment of boys and -girls, I hope it will not be shunned by men and women on that account, -for part of my plan has been to try to pleasantly remind adults of what -they once were themselves, and of how they felt and thought and talked, -and what queer enterprises they sometimes engaged in. - - THE AUTHOR. - -HARTFORD, 1876. - - - - T O M S A W Y E R - - - -CHAPTER I - -"TOM!" - -No answer. - -"TOM!" - -No answer. - -"What's gone with that boy, I wonder? You TOM!" - -No answer. - -The old lady pulled her spectacles down and looked over them about the -room; then she put them up and looked out under them. She seldom or -never looked THROUGH them for so small a thing as a boy; they were her -state pair, the pride of her heart, and were built for "style," not -service--she could have seen through a pair of stove-lids just as well. -She looked perplexed for a moment, and then said, not fiercely, but -still loud enough for the furniture to hear: - -"Well, I lay if I get hold of you I'll--" - -She did not finish, for by this time she was bending down and punching -under the bed with the broom, and so she needed breath to punctuate the -punches with. She resurrected nothing but the cat. - -"I never did see the beat of that boy!" - -She went to the open door and stood in it and looked out among the -tomato vines and "jimpson" weeds that constituted the garden. No Tom. -So she lifted up her voice at an angle calculated for distance and -shouted: - -"Y-o-u-u TOM!" - -There was a slight noise behind her and she turned just in time to -seize a small boy by the slack of his roundabout and arrest his flight. - -"There! I might 'a' thought of that closet. What you been doing in -there?" - -"Nothing." - -"Nothing! Look at your hands. And look at your mouth. What IS that -truck?" - -"I don't know, aunt." - -"Well, I know. It's jam--that's what it is. Forty times I've said if -you didn't let that jam alone I'd skin you. Hand me that switch." - -The switch hovered in the air--the peril was desperate-- - -"My! Look behind you, aunt!" - -The old lady whirled round, and snatched her skirts out of danger. The -lad fled on the instant, scrambled up the high board-fence, and -disappeared over it. - -His aunt Polly stood surprised a moment, and then broke into a gentle -laugh. - -"Hang the boy, can't I never learn anything? Ain't he played me tricks -enough like that for me to be looking out for him by this time? But old -fools is the biggest fools there is. Can't learn an old dog new tricks, -as the saying is. But my goodness, he never plays them alike, two days, -and how is a body to know what's coming? He 'pears to know just how -long he can torment me before I get my dander up, and he knows if he -can make out to put me off for a minute or make me laugh, it's all down -again and I can't hit him a lick. I ain't doing my duty by that boy, -and that's the Lord's truth, goodness knows. Spare the rod and spile -the child, as the Good Book says. I'm a laying up sin and suffering for -us both, I know. He's full of the Old Scratch, but laws-a-me! he's my -own dead sister's boy, poor thing, and I ain't got the heart to lash -him, somehow. Every time I let him off, my conscience does hurt me so, -and every time I hit him my old heart most breaks. Well-a-well, man -that is born of woman is of few days and full of trouble, as the -Scripture says, and I reckon it's so. He'll play hookey this evening, * -and [* Southwestern for "afternoon"] I'll just be obleeged to make him -work, to-morrow, to punish him. It's mighty hard to make him work -Saturdays, when all the boys is having holiday, but he hates work more -than he hates anything else, and I've GOT to do some of my duty by him, -or I'll be the ruination of the child." - -Tom did play hookey, and he had a very good time. He got back home -barely in season to help Jim, the small colored boy, saw next-day's -wood and split the kindlings before supper--at least he was there in -time to tell his adventures to Jim while Jim did three-fourths of the -work. Tom's younger brother (or rather half-brother) Sid was already -through with his part of the work (picking up chips), for he was a -quiet boy, and had no adventurous, troublesome ways. - -While Tom was eating his supper, and stealing sugar as opportunity -offered, Aunt Polly asked him questions that were full of guile, and -very deep--for she wanted to trap him into damaging revealments. Like -many other simple-hearted souls, it was her pet vanity to believe she -was endowed with a talent for dark and mysterious diplomacy, and she -loved to contemplate her most transparent devices as marvels of low -cunning. Said she: - -"Tom, it was middling warm in school, warn't it?" - -"Yes'm." - -"Powerful warm, warn't it?" - -"Yes'm." - -"Didn't you want to go in a-swimming, Tom?" - -A bit of a scare shot through Tom--a touch of uncomfortable suspicion. -He searched Aunt Polly's face, but it told him nothing. So he said: - -"No'm--well, not very much." - -The old lady reached out her hand and felt Tom's shirt, and said: - -"But you ain't too warm now, though." And it flattered her to reflect -that she had discovered that the shirt was dry without anybody knowing -that that was what she had in her mind. But in spite of her, Tom knew -where the wind lay, now. So he forestalled what might be the next move: - -"Some of us pumped on our heads--mine's damp yet. See?" - -Aunt Polly was vexed to think she had overlooked that bit of -circumstantial evidence, and missed a trick. Then she had a new -inspiration: - -"Tom, you didn't have to undo your shirt collar where I sewed it, to -pump on your head, did you? Unbutton your jacket!" - -The trouble vanished out of Tom's face. He opened his jacket. His -shirt collar was securely sewed. - -"Bother! Well, go 'long with you. I'd made sure you'd played hookey -and been a-swimming. But I forgive ye, Tom. I reckon you're a kind of a -singed cat, as the saying is--better'n you look. THIS time." - -She was half sorry her sagacity had miscarried, and half glad that Tom -had stumbled into obedient conduct for once. - -But Sidney said: - -"Well, now, if I didn't think you sewed his collar with white thread, -but it's black." - -"Why, I did sew it with white! Tom!" - -But Tom did not wait for the rest. As he went out at the door he said: - -"Siddy, I'll lick you for that." - -In a safe place Tom examined two large needles which were thrust into -the lapels of his jacket, and had thread bound about them--one needle -carried white thread and the other black. He said: - -"She'd never noticed if it hadn't been for Sid. Confound it! sometimes -she sews it with white, and sometimes she sews it with black. I wish to -geeminy she'd stick to one or t'other--I can't keep the run of 'em. But -I bet you I'll lam Sid for that. I'll learn him!" - -He was not the Model Boy of the village. He knew the model boy very -well though--and loathed him. - -Within two minutes, or even less, he had forgotten all his troubles. -Not because his troubles were one whit less heavy and bitter to him -than a man's are to a man, but because a new and powerful interest bore -them down and drove them out of his mind for the time--just as men's -misfortunes are forgotten in the excitement of new enterprises. This -new interest was a valued novelty in whistling, which he had just -acquired from a negro, and he was suffering to practise it undisturbed. -It consisted in a peculiar bird-like turn, a sort of liquid warble, -produced by touching the tongue to the roof of the mouth at short -intervals in the midst of the music--the reader probably remembers how -to do it, if he has ever been a boy. Diligence and attention soon gave -him the knack of it, and he strode down the street with his mouth full -of harmony and his soul full of gratitude. He felt much as an -astronomer feels who has discovered a new planet--no doubt, as far as -strong, deep, unalloyed pleasure is concerned, the advantage was with -the boy, not the astronomer. - -The summer evenings were long. It was not dark, yet. Presently Tom -checked his whistle. A stranger was before him--a boy a shade larger -than himself. A new-comer of any age or either sex was an impressive -curiosity in the poor little shabby village of St. Petersburg. This boy -was well dressed, too--well dressed on a week-day. This was simply -astounding. His cap was a dainty thing, his close-buttoned blue cloth -roundabout was new and natty, and so were his pantaloons. He had shoes -on--and it was only Friday. He even wore a necktie, a bright bit of -ribbon. He had a citified air about him that ate into Tom's vitals. The -more Tom stared at the splendid marvel, the higher he turned up his -nose at his finery and the shabbier and shabbier his own outfit seemed -to him to grow. Neither boy spoke. If one moved, the other moved--but -only sidewise, in a circle; they kept face to face and eye to eye all -the time. Finally Tom said: - -"I can lick you!" - -"I'd like to see you try it." - -"Well, I can do it." - -"No you can't, either." - -"Yes I can." - -"No you can't." - -"I can." - -"You can't." - -"Can!" - -"Can't!" - -An uncomfortable pause. Then Tom said: - -"What's your name?" - -"'Tisn't any of your business, maybe." - -"Well I 'low I'll MAKE it my business." - -"Well why don't you?" - -"If you say much, I will." - -"Much--much--MUCH. There now." - -"Oh, you think you're mighty smart, DON'T you? I could lick you with -one hand tied behind me, if I wanted to." - -"Well why don't you DO it? You SAY you can do it." - -"Well I WILL, if you fool with me." - -"Oh yes--I've seen whole families in the same fix." - -"Smarty! You think you're SOME, now, DON'T you? Oh, what a hat!" - -"You can lump that hat if you don't like it. I dare you to knock it -off--and anybody that'll take a dare will suck eggs." - -"You're a liar!" - -"You're another." - -"You're a fighting liar and dasn't take it up." - -"Aw--take a walk!" - -"Say--if you give me much more of your sass I'll take and bounce a -rock off'n your head." - -"Oh, of COURSE you will." - -"Well I WILL." - -"Well why don't you DO it then? What do you keep SAYING you will for? -Why don't you DO it? It's because you're afraid." - -"I AIN'T afraid." - -"You are." - -"I ain't." - -"You are." - -Another pause, and more eying and sidling around each other. Presently -they were shoulder to shoulder. Tom said: - -"Get away from here!" - -"Go away yourself!" - -"I won't." - -"I won't either." - -So they stood, each with a foot placed at an angle as a brace, and -both shoving with might and main, and glowering at each other with -hate. But neither could get an advantage. After struggling till both -were hot and flushed, each relaxed his strain with watchful caution, -and Tom said: - -"You're a coward and a pup. I'll tell my big brother on you, and he -can thrash you with his little finger, and I'll make him do it, too." - -"What do I care for your big brother? I've got a brother that's bigger -than he is--and what's more, he can throw him over that fence, too." -[Both brothers were imaginary.] - -"That's a lie." - -"YOUR saying so don't make it so." - -Tom drew a line in the dust with his big toe, and said: - -"I dare you to step over that, and I'll lick you till you can't stand -up. Anybody that'll take a dare will steal sheep." - -The new boy stepped over promptly, and said: - -"Now you said you'd do it, now let's see you do it." - -"Don't you crowd me now; you better look out." - -"Well, you SAID you'd do it--why don't you do it?" - -"By jingo! for two cents I WILL do it." - -The new boy took two broad coppers out of his pocket and held them out -with derision. Tom struck them to the ground. In an instant both boys -were rolling and tumbling in the dirt, gripped together like cats; and -for the space of a minute they tugged and tore at each other's hair and -clothes, punched and scratched each other's nose, and covered -themselves with dust and glory. Presently the confusion took form, and -through the fog of battle Tom appeared, seated astride the new boy, and -pounding him with his fists. "Holler 'nuff!" said he. - -The boy only struggled to free himself. He was crying--mainly from rage. - -"Holler 'nuff!"--and the pounding went on. - -At last the stranger got out a smothered "'Nuff!" and Tom let him up -and said: - -"Now that'll learn you. Better look out who you're fooling with next -time." - -The new boy went off brushing the dust from his clothes, sobbing, -snuffling, and occasionally looking back and shaking his head and -threatening what he would do to Tom the "next time he caught him out." -To which Tom responded with jeers, and started off in high feather, and -as soon as his back was turned the new boy snatched up a stone, threw -it and hit him between the shoulders and then turned tail and ran like -an antelope. Tom chased the traitor home, and thus found out where he -lived. He then held a position at the gate for some time, daring the -enemy to come outside, but the enemy only made faces at him through the -window and declined. At last the enemy's mother appeared, and called -Tom a bad, vicious, vulgar child, and ordered him away. So he went -away; but he said he "'lowed" to "lay" for that boy. - -He got home pretty late that night, and when he climbed cautiously in -at the window, he uncovered an ambuscade, in the person of his aunt; -and when she saw the state his clothes were in her resolution to turn -his Saturday holiday into captivity at hard labor became adamantine in -its firmness. - - - -CHAPTER II - -SATURDAY morning was come, and all the summer world was bright and -fresh, and brimming with life. There was a song in every heart; and if -the heart was young the music issued at the lips. There was cheer in -every face and a spring in every step. The locust-trees were in bloom -and the fragrance of the blossoms filled the air. Cardiff Hill, beyond -the village and above it, was green with vegetation and it lay just far -enough away to seem a Delectable Land, dreamy, reposeful, and inviting. - -Tom appeared on the sidewalk with a bucket of whitewash and a -long-handled brush. He surveyed the fence, and all gladness left him and -a deep melancholy settled down upon his spirit. Thirty yards of board -fence nine feet high. Life to him seemed hollow, and existence but a -burden. Sighing, he dipped his brush and passed it along the topmost -plank; repeated the operation; did it again; compared the insignificant -whitewashed streak with the far-reaching continent of unwhitewashed -fence, and sat down on a tree-box discouraged. Jim came skipping out at -the gate with a tin pail, and singing Buffalo Gals. Bringing water from -the town pump had always been hateful work in Tom's eyes, before, but -now it did not strike him so. He remembered that there was company at -the pump. White, mulatto, and negro boys and girls were always there -waiting their turns, resting, trading playthings, quarrelling, -fighting, skylarking. And he remembered that although the pump was only -a hundred and fifty yards off, Jim never got back with a bucket of -water under an hour--and even then somebody generally had to go after -him. Tom said: - -"Say, Jim, I'll fetch the water if you'll whitewash some." - -Jim shook his head and said: - -"Can't, Mars Tom. Ole missis, she tole me I got to go an' git dis -water an' not stop foolin' roun' wid anybody. She say she spec' Mars -Tom gwine to ax me to whitewash, an' so she tole me go 'long an' 'tend -to my own business--she 'lowed SHE'D 'tend to de whitewashin'." - -"Oh, never you mind what she said, Jim. That's the way she always -talks. Gimme the bucket--I won't be gone only a a minute. SHE won't -ever know." - -"Oh, I dasn't, Mars Tom. Ole missis she'd take an' tar de head off'n -me. 'Deed she would." - -"SHE! She never licks anybody--whacks 'em over the head with her -thimble--and who cares for that, I'd like to know. She talks awful, but -talk don't hurt--anyways it don't if she don't cry. Jim, I'll give you -a marvel. I'll give you a white alley!" - -Jim began to waver. - -"White alley, Jim! And it's a bully taw." - -"My! Dat's a mighty gay marvel, I tell you! But Mars Tom I's powerful -'fraid ole missis--" - -"And besides, if you will I'll show you my sore toe." - -Jim was only human--this attraction was too much for him. He put down -his pail, took the white alley, and bent over the toe with absorbing -interest while the bandage was being unwound. In another moment he was -flying down the street with his pail and a tingling rear, Tom was -whitewashing with vigor, and Aunt Polly was retiring from the field -with a slipper in her hand and triumph in her eye. - -But Tom's energy did not last. He began to think of the fun he had -planned for this day, and his sorrows multiplied. Soon the free boys -would come tripping along on all sorts of delicious expeditions, and -they would make a world of fun of him for having to work--the very -thought of it burnt him like fire. He got out his worldly wealth and -examined it--bits of toys, marbles, and trash; enough to buy an -exchange of WORK, maybe, but not half enough to buy so much as half an -hour of pure freedom. So he returned his straitened means to his -pocket, and gave up the idea of trying to buy the boys. At this dark -and hopeless moment an inspiration burst upon him! Nothing less than a -great, magnificent inspiration. - -He took up his brush and went tranquilly to work. Ben Rogers hove in -sight presently--the very boy, of all boys, whose ridicule he had been -dreading. Ben's gait was the hop-skip-and-jump--proof enough that his -heart was light and his anticipations high. He was eating an apple, and -giving a long, melodious whoop, at intervals, followed by a deep-toned -ding-dong-dong, ding-dong-dong, for he was personating a steamboat. As -he drew near, he slackened speed, took the middle of the street, leaned -far over to starboard and rounded to ponderously and with laborious -pomp and circumstance--for he was personating the Big Missouri, and -considered himself to be drawing nine feet of water. He was boat and -captain and engine-bells combined, so he had to imagine himself -standing on his own hurricane-deck giving the orders and executing them: - -"Stop her, sir! Ting-a-ling-ling!" The headway ran almost out, and he -drew up slowly toward the sidewalk. - -"Ship up to back! Ting-a-ling-ling!" His arms straightened and -stiffened down his sides. - -"Set her back on the stabboard! Ting-a-ling-ling! Chow! ch-chow-wow! -Chow!" His right hand, meantime, describing stately circles--for it was -representing a forty-foot wheel. - -"Let her go back on the labboard! Ting-a-lingling! Chow-ch-chow-chow!" -The left hand began to describe circles. - -"Stop the stabboard! Ting-a-ling-ling! Stop the labboard! Come ahead -on the stabboard! Stop her! Let your outside turn over slow! -Ting-a-ling-ling! Chow-ow-ow! Get out that head-line! LIVELY now! -Come--out with your spring-line--what're you about there! Take a turn -round that stump with the bight of it! Stand by that stage, now--let her -go! Done with the engines, sir! Ting-a-ling-ling! SH'T! S'H'T! SH'T!" -(trying the gauge-cocks). - -Tom went on whitewashing--paid no attention to the steamboat. Ben -stared a moment and then said: "Hi-YI! YOU'RE up a stump, ain't you!" - -No answer. Tom surveyed his last touch with the eye of an artist, then -he gave his brush another gentle sweep and surveyed the result, as -before. Ben ranged up alongside of him. Tom's mouth watered for the -apple, but he stuck to his work. Ben said: - -"Hello, old chap, you got to work, hey?" - -Tom wheeled suddenly and said: - -"Why, it's you, Ben! I warn't noticing." - -"Say--I'm going in a-swimming, I am. Don't you wish you could? But of -course you'd druther WORK--wouldn't you? Course you would!" - -Tom contemplated the boy a bit, and said: - -"What do you call work?" - -"Why, ain't THAT work?" - -Tom resumed his whitewashing, and answered carelessly: - -"Well, maybe it is, and maybe it ain't. All I know, is, it suits Tom -Sawyer." - -"Oh come, now, you don't mean to let on that you LIKE it?" - -The brush continued to move. - -"Like it? Well, I don't see why I oughtn't to like it. Does a boy get -a chance to whitewash a fence every day?" - -That put the thing in a new light. Ben stopped nibbling his apple. Tom -swept his brush daintily back and forth--stepped back to note the -effect--added a touch here and there--criticised the effect again--Ben -watching every move and getting more and more interested, more and more -absorbed. Presently he said: - -"Say, Tom, let ME whitewash a little." - -Tom considered, was about to consent; but he altered his mind: - -"No--no--I reckon it wouldn't hardly do, Ben. You see, Aunt Polly's -awful particular about this fence--right here on the street, you know ---but if it was the back fence I wouldn't mind and SHE wouldn't. Yes, -she's awful particular about this fence; it's got to be done very -careful; I reckon there ain't one boy in a thousand, maybe two -thousand, that can do it the way it's got to be done." - -"No--is that so? Oh come, now--lemme just try. Only just a little--I'd -let YOU, if you was me, Tom." - -"Ben, I'd like to, honest injun; but Aunt Polly--well, Jim wanted to -do it, but she wouldn't let him; Sid wanted to do it, and she wouldn't -let Sid. Now don't you see how I'm fixed? If you was to tackle this -fence and anything was to happen to it--" - -"Oh, shucks, I'll be just as careful. Now lemme try. Say--I'll give -you the core of my apple." - -"Well, here--No, Ben, now don't. I'm afeard--" - -"I'll give you ALL of it!" - -Tom gave up the brush with reluctance in his face, but alacrity in his -heart. And while the late steamer Big Missouri worked and sweated in -the sun, the retired artist sat on a barrel in the shade close by, -dangled his legs, munched his apple, and planned the slaughter of more -innocents. There was no lack of material; boys happened along every -little while; they came to jeer, but remained to whitewash. By the time -Ben was fagged out, Tom had traded the next chance to Billy Fisher for -a kite, in good repair; and when he played out, Johnny Miller bought in -for a dead rat and a string to swing it with--and so on, and so on, -hour after hour. And when the middle of the afternoon came, from being -a poor poverty-stricken boy in the morning, Tom was literally rolling -in wealth. He had besides the things before mentioned, twelve marbles, -part of a jews-harp, a piece of blue bottle-glass to look through, a -spool cannon, a key that wouldn't unlock anything, a fragment of chalk, -a glass stopper of a decanter, a tin soldier, a couple of tadpoles, six -fire-crackers, a kitten with only one eye, a brass doorknob, a -dog-collar--but no dog--the handle of a knife, four pieces of -orange-peel, and a dilapidated old window sash. - -He had had a nice, good, idle time all the while--plenty of company ---and the fence had three coats of whitewash on it! If he hadn't run out -of whitewash he would have bankrupted every boy in the village. - -Tom said to himself that it was not such a hollow world, after all. He -had discovered a great law of human action, without knowing it--namely, -that in order to make a man or a boy covet a thing, it is only -necessary to make the thing difficult to attain. If he had been a great -and wise philosopher, like the writer of this book, he would now have -comprehended that Work consists of whatever a body is OBLIGED to do, -and that Play consists of whatever a body is not obliged to do. And -this would help him to understand why constructing artificial flowers -or performing on a tread-mill is work, while rolling ten-pins or -climbing Mont Blanc is only amusement. There are wealthy gentlemen in -England who drive four-horse passenger-coaches twenty or thirty miles -on a daily line, in the summer, because the privilege costs them -considerable money; but if they were offered wages for the service, -that would turn it into work and then they would resign. - -The boy mused awhile over the substantial change which had taken place -in his worldly circumstances, and then wended toward headquarters to -report. - - - -CHAPTER III - -TOM presented himself before Aunt Polly, who was sitting by an open -window in a pleasant rearward apartment, which was bedroom, -breakfast-room, dining-room, and library, combined. The balmy summer -air, the restful quiet, the odor of the flowers, and the drowsing murmur -of the bees had had their effect, and she was nodding over her knitting ---for she had no company but the cat, and it was asleep in her lap. Her -spectacles were propped up on her gray head for safety. She had thought -that of course Tom had deserted long ago, and she wondered at seeing him -place himself in her power again in this intrepid way. He said: "Mayn't -I go and play now, aunt?" - -"What, a'ready? How much have you done?" - -"It's all done, aunt." - -"Tom, don't lie to me--I can't bear it." - -"I ain't, aunt; it IS all done." - -Aunt Polly placed small trust in such evidence. She went out to see -for herself; and she would have been content to find twenty per cent. -of Tom's statement true. When she found the entire fence whitewashed, -and not only whitewashed but elaborately coated and recoated, and even -a streak added to the ground, her astonishment was almost unspeakable. -She said: - -"Well, I never! There's no getting round it, you can work when you're -a mind to, Tom." And then she diluted the compliment by adding, "But -it's powerful seldom you're a mind to, I'm bound to say. Well, go 'long -and play; but mind you get back some time in a week, or I'll tan you." - -She was so overcome by the splendor of his achievement that she took -him into the closet and selected a choice apple and delivered it to -him, along with an improving lecture upon the added value and flavor a -treat took to itself when it came without sin through virtuous effort. -And while she closed with a happy Scriptural flourish, he "hooked" a -doughnut. - -Then he skipped out, and saw Sid just starting up the outside stairway -that led to the back rooms on the second floor. Clods were handy and -the air was full of them in a twinkling. They raged around Sid like a -hail-storm; and before Aunt Polly could collect her surprised faculties -and sally to the rescue, six or seven clods had taken personal effect, -and Tom was over the fence and gone. There was a gate, but as a general -thing he was too crowded for time to make use of it. His soul was at -peace, now that he had settled with Sid for calling attention to his -black thread and getting him into trouble. - -Tom skirted the block, and came round into a muddy alley that led by -the back of his aunt's cow-stable. He presently got safely beyond the -reach of capture and punishment, and hastened toward the public square -of the village, where two "military" companies of boys had met for -conflict, according to previous appointment. Tom was General of one of -these armies, Joe Harper (a bosom friend) General of the other. These -two great commanders did not condescend to fight in person--that being -better suited to the still smaller fry--but sat together on an eminence -and conducted the field operations by orders delivered through -aides-de-camp. Tom's army won a great victory, after a long and -hard-fought battle. Then the dead were counted, prisoners exchanged, -the terms of the next disagreement agreed upon, and the day for the -necessary battle appointed; after which the armies fell into line and -marched away, and Tom turned homeward alone. - -As he was passing by the house where Jeff Thatcher lived, he saw a new -girl in the garden--a lovely little blue-eyed creature with yellow hair -plaited into two long-tails, white summer frock and embroidered -pantalettes. The fresh-crowned hero fell without firing a shot. A -certain Amy Lawrence vanished out of his heart and left not even a -memory of herself behind. He had thought he loved her to distraction; -he had regarded his passion as adoration; and behold it was only a poor -little evanescent partiality. He had been months winning her; she had -confessed hardly a week ago; he had been the happiest and the proudest -boy in the world only seven short days, and here in one instant of time -she had gone out of his heart like a casual stranger whose visit is -done. - -He worshipped this new angel with furtive eye, till he saw that she -had discovered him; then he pretended he did not know she was present, -and began to "show off" in all sorts of absurd boyish ways, in order to -win her admiration. He kept up this grotesque foolishness for some -time; but by-and-by, while he was in the midst of some dangerous -gymnastic performances, he glanced aside and saw that the little girl -was wending her way toward the house. Tom came up to the fence and -leaned on it, grieving, and hoping she would tarry yet awhile longer. -She halted a moment on the steps and then moved toward the door. Tom -heaved a great sigh as she put her foot on the threshold. But his face -lit up, right away, for she tossed a pansy over the fence a moment -before she disappeared. - -The boy ran around and stopped within a foot or two of the flower, and -then shaded his eyes with his hand and began to look down street as if -he had discovered something of interest going on in that direction. -Presently he picked up a straw and began trying to balance it on his -nose, with his head tilted far back; and as he moved from side to side, -in his efforts, he edged nearer and nearer toward the pansy; finally -his bare foot rested upon it, his pliant toes closed upon it, and he -hopped away with the treasure and disappeared round the corner. But -only for a minute--only while he could button the flower inside his -jacket, next his heart--or next his stomach, possibly, for he was not -much posted in anatomy, and not hypercritical, anyway. - -He returned, now, and hung about the fence till nightfall, "showing -off," as before; but the girl never exhibited herself again, though Tom -comforted himself a little with the hope that she had been near some -window, meantime, and been aware of his attentions. Finally he strode -home reluctantly, with his poor head full of visions. - -All through supper his spirits were so high that his aunt wondered -"what had got into the child." He took a good scolding about clodding -Sid, and did not seem to mind it in the least. He tried to steal sugar -under his aunt's very nose, and got his knuckles rapped for it. He said: - -"Aunt, you don't whack Sid when he takes it." - -"Well, Sid don't torment a body the way you do. You'd be always into -that sugar if I warn't watching you." - -Presently she stepped into the kitchen, and Sid, happy in his -immunity, reached for the sugar-bowl--a sort of glorying over Tom which -was wellnigh unbearable. But Sid's fingers slipped and the bowl dropped -and broke. Tom was in ecstasies. In such ecstasies that he even -controlled his tongue and was silent. He said to himself that he would -not speak a word, even when his aunt came in, but would sit perfectly -still till she asked who did the mischief; and then he would tell, and -there would be nothing so good in the world as to see that pet model -"catch it." He was so brimful of exultation that he could hardly hold -himself when the old lady came back and stood above the wreck -discharging lightnings of wrath from over her spectacles. He said to -himself, "Now it's coming!" And the next instant he was sprawling on -the floor! The potent palm was uplifted to strike again when Tom cried -out: - -"Hold on, now, what 'er you belting ME for?--Sid broke it!" - -Aunt Polly paused, perplexed, and Tom looked for healing pity. But -when she got her tongue again, she only said: - -"Umf! Well, you didn't get a lick amiss, I reckon. You been into some -other audacious mischief when I wasn't around, like enough." - -Then her conscience reproached her, and she yearned to say something -kind and loving; but she judged that this would be construed into a -confession that she had been in the wrong, and discipline forbade that. -So she kept silence, and went about her affairs with a troubled heart. -Tom sulked in a corner and exalted his woes. He knew that in her heart -his aunt was on her knees to him, and he was morosely gratified by the -consciousness of it. He would hang out no signals, he would take notice -of none. He knew that a yearning glance fell upon him, now and then, -through a film of tears, but he refused recognition of it. He pictured -himself lying sick unto death and his aunt bending over him beseeching -one little forgiving word, but he would turn his face to the wall, and -die with that word unsaid. Ah, how would she feel then? And he pictured -himself brought home from the river, dead, with his curls all wet, and -his sore heart at rest. How she would throw herself upon him, and how -her tears would fall like rain, and her lips pray God to give her back -her boy and she would never, never abuse him any more! But he would lie -there cold and white and make no sign--a poor little sufferer, whose -griefs were at an end. He so worked upon his feelings with the pathos -of these dreams, that he had to keep swallowing, he was so like to -choke; and his eyes swam in a blur of water, which overflowed when he -winked, and ran down and trickled from the end of his nose. And such a -luxury to him was this petting of his sorrows, that he could not bear -to have any worldly cheeriness or any grating delight intrude upon it; -it was too sacred for such contact; and so, presently, when his cousin -Mary danced in, all alive with the joy of seeing home again after an -age-long visit of one week to the country, he got up and moved in -clouds and darkness out at one door as she brought song and sunshine in -at the other. - -He wandered far from the accustomed haunts of boys, and sought -desolate places that were in harmony with his spirit. A log raft in the -river invited him, and he seated himself on its outer edge and -contemplated the dreary vastness of the stream, wishing, the while, -that he could only be drowned, all at once and unconsciously, without -undergoing the uncomfortable routine devised by nature. Then he thought -of his flower. He got it out, rumpled and wilted, and it mightily -increased his dismal felicity. He wondered if she would pity him if she -knew? Would she cry, and wish that she had a right to put her arms -around his neck and comfort him? Or would she turn coldly away like all -the hollow world? This picture brought such an agony of pleasurable -suffering that he worked it over and over again in his mind and set it -up in new and varied lights, till he wore it threadbare. At last he -rose up sighing and departed in the darkness. - -About half-past nine or ten o'clock he came along the deserted street -to where the Adored Unknown lived; he paused a moment; no sound fell -upon his listening ear; a candle was casting a dull glow upon the -curtain of a second-story window. Was the sacred presence there? He -climbed the fence, threaded his stealthy way through the plants, till -he stood under that window; he looked up at it long, and with emotion; -then he laid him down on the ground under it, disposing himself upon -his back, with his hands clasped upon his breast and holding his poor -wilted flower. And thus he would die--out in the cold world, with no -shelter over his homeless head, no friendly hand to wipe the -death-damps from his brow, no loving face to bend pityingly over him -when the great agony came. And thus SHE would see him when she looked -out upon the glad morning, and oh! would she drop one little tear upon -his poor, lifeless form, would she heave one little sigh to see a bright -young life so rudely blighted, so untimely cut down? - -The window went up, a maid-servant's discordant voice profaned the -holy calm, and a deluge of water drenched the prone martyr's remains! - -The strangling hero sprang up with a relieving snort. There was a whiz -as of a missile in the air, mingled with the murmur of a curse, a sound -as of shivering glass followed, and a small, vague form went over the -fence and shot away in the gloom. - -Not long after, as Tom, all undressed for bed, was surveying his -drenched garments by the light of a tallow dip, Sid woke up; but if he -had any dim idea of making any "references to allusions," he thought -better of it and held his peace, for there was danger in Tom's eye. - -Tom turned in without the added vexation of prayers, and Sid made -mental note of the omission. - - - -CHAPTER IV - -THE sun rose upon a tranquil world, and beamed down upon the peaceful -village like a benediction. Breakfast over, Aunt Polly had family -worship: it began with a prayer built from the ground up of solid -courses of Scriptural quotations, welded together with a thin mortar of -originality; and from the summit of this she delivered a grim chapter -of the Mosaic Law, as from Sinai. - -Then Tom girded up his loins, so to speak, and went to work to "get -his verses." Sid had learned his lesson days before. Tom bent all his -energies to the memorizing of five verses, and he chose part of the -Sermon on the Mount, because he could find no verses that were shorter. -At the end of half an hour Tom had a vague general idea of his lesson, -but no more, for his mind was traversing the whole field of human -thought, and his hands were busy with distracting recreations. Mary -took his book to hear him recite, and he tried to find his way through -the fog: - -"Blessed are the--a--a--" - -"Poor"-- - -"Yes--poor; blessed are the poor--a--a--" - -"In spirit--" - -"In spirit; blessed are the poor in spirit, for they--they--" - -"THEIRS--" - -"For THEIRS. Blessed are the poor in spirit, for theirs is the kingdom -of heaven. Blessed are they that mourn, for they--they--" - -"Sh--" - -"For they--a--" - -"S, H, A--" - -"For they S, H--Oh, I don't know what it is!" - -"SHALL!" - -"Oh, SHALL! for they shall--for they shall--a--a--shall mourn--a--a-- -blessed are they that shall--they that--a--they that shall mourn, for -they shall--a--shall WHAT? Why don't you tell me, Mary?--what do you -want to be so mean for?" - -"Oh, Tom, you poor thick-headed thing, I'm not teasing you. I wouldn't -do that. You must go and learn it again. Don't you be discouraged, Tom, -you'll manage it--and if you do, I'll give you something ever so nice. -There, now, that's a good boy." - -"All right! What is it, Mary, tell me what it is." - -"Never you mind, Tom. You know if I say it's nice, it is nice." - -"You bet you that's so, Mary. All right, I'll tackle it again." - -And he did "tackle it again"--and under the double pressure of -curiosity and prospective gain he did it with such spirit that he -accomplished a shining success. Mary gave him a brand-new "Barlow" -knife worth twelve and a half cents; and the convulsion of delight that -swept his system shook him to his foundations. True, the knife would -not cut anything, but it was a "sure-enough" Barlow, and there was -inconceivable grandeur in that--though where the Western boys ever got -the idea that such a weapon could possibly be counterfeited to its -injury is an imposing mystery and will always remain so, perhaps. Tom -contrived to scarify the cupboard with it, and was arranging to begin -on the bureau, when he was called off to dress for Sunday-school. - -Mary gave him a tin basin of water and a piece of soap, and he went -outside the door and set the basin on a little bench there; then he -dipped the soap in the water and laid it down; turned up his sleeves; -poured out the water on the ground, gently, and then entered the -kitchen and began to wipe his face diligently on the towel behind the -door. But Mary removed the towel and said: - -"Now ain't you ashamed, Tom. You mustn't be so bad. Water won't hurt -you." - -Tom was a trifle disconcerted. The basin was refilled, and this time -he stood over it a little while, gathering resolution; took in a big -breath and began. When he entered the kitchen presently, with both eyes -shut and groping for the towel with his hands, an honorable testimony -of suds and water was dripping from his face. But when he emerged from -the towel, he was not yet satisfactory, for the clean territory stopped -short at his chin and his jaws, like a mask; below and beyond this line -there was a dark expanse of unirrigated soil that spread downward in -front and backward around his neck. Mary took him in hand, and when she -was done with him he was a man and a brother, without distinction of -color, and his saturated hair was neatly brushed, and its short curls -wrought into a dainty and symmetrical general effect. [He privately -smoothed out the curls, with labor and difficulty, and plastered his -hair close down to his head; for he held curls to be effeminate, and -his own filled his life with bitterness.] Then Mary got out a suit of -his clothing that had been used only on Sundays during two years--they -were simply called his "other clothes"--and so by that we know the -size of his wardrobe. The girl "put him to rights" after he had dressed -himself; she buttoned his neat roundabout up to his chin, turned his -vast shirt collar down over his shoulders, brushed him off and crowned -him with his speckled straw hat. He now looked exceedingly improved and -uncomfortable. He was fully as uncomfortable as he looked; for there -was a restraint about whole clothes and cleanliness that galled him. He -hoped that Mary would forget his shoes, but the hope was blighted; she -coated them thoroughly with tallow, as was the custom, and brought them -out. He lost his temper and said he was always being made to do -everything he didn't want to do. But Mary said, persuasively: - -"Please, Tom--that's a good boy." - -So he got into the shoes snarling. Mary was soon ready, and the three -children set out for Sunday-school--a place that Tom hated with his -whole heart; but Sid and Mary were fond of it. - -Sabbath-school hours were from nine to half-past ten; and then church -service. Two of the children always remained for the sermon -voluntarily, and the other always remained too--for stronger reasons. -The church's high-backed, uncushioned pews would seat about three -hundred persons; the edifice was but a small, plain affair, with a sort -of pine board tree-box on top of it for a steeple. At the door Tom -dropped back a step and accosted a Sunday-dressed comrade: - -"Say, Billy, got a yaller ticket?" - -"Yes." - -"What'll you take for her?" - -"What'll you give?" - -"Piece of lickrish and a fish-hook." - -"Less see 'em." - -Tom exhibited. They were satisfactory, and the property changed hands. -Then Tom traded a couple of white alleys for three red tickets, and -some small trifle or other for a couple of blue ones. He waylaid other -boys as they came, and went on buying tickets of various colors ten or -fifteen minutes longer. He entered the church, now, with a swarm of -clean and noisy boys and girls, proceeded to his seat and started a -quarrel with the first boy that came handy. The teacher, a grave, -elderly man, interfered; then turned his back a moment and Tom pulled a -boy's hair in the next bench, and was absorbed in his book when the boy -turned around; stuck a pin in another boy, presently, in order to hear -him say "Ouch!" and got a new reprimand from his teacher. Tom's whole -class were of a pattern--restless, noisy, and troublesome. When they -came to recite their lessons, not one of them knew his verses -perfectly, but had to be prompted all along. However, they worried -through, and each got his reward--in small blue tickets, each with a -passage of Scripture on it; each blue ticket was pay for two verses of -the recitation. Ten blue tickets equalled a red one, and could be -exchanged for it; ten red tickets equalled a yellow one; for ten yellow -tickets the superintendent gave a very plainly bound Bible (worth forty -cents in those easy times) to the pupil. How many of my readers would -have the industry and application to memorize two thousand verses, even -for a Dore Bible? And yet Mary had acquired two Bibles in this way--it -was the patient work of two years--and a boy of German parentage had -won four or five. He once recited three thousand verses without -stopping; but the strain upon his mental faculties was too great, and -he was little better than an idiot from that day forth--a grievous -misfortune for the school, for on great occasions, before company, the -superintendent (as Tom expressed it) had always made this boy come out -and "spread himself." Only the older pupils managed to keep their -tickets and stick to their tedious work long enough to get a Bible, and -so the delivery of one of these prizes was a rare and noteworthy -circumstance; the successful pupil was so great and conspicuous for -that day that on the spot every scholar's heart was fired with a fresh -ambition that often lasted a couple of weeks. It is possible that Tom's -mental stomach had never really hungered for one of those prizes, but -unquestionably his entire being had for many a day longed for the glory -and the eclat that came with it. - -In due course the superintendent stood up in front of the pulpit, with -a closed hymn-book in his hand and his forefinger inserted between its -leaves, and commanded attention. When a Sunday-school superintendent -makes his customary little speech, a hymn-book in the hand is as -necessary as is the inevitable sheet of music in the hand of a singer -who stands forward on the platform and sings a solo at a concert ---though why, is a mystery: for neither the hymn-book nor the sheet of -music is ever referred to by the sufferer. This superintendent was a -slim creature of thirty-five, with a sandy goatee and short sandy hair; -he wore a stiff standing-collar whose upper edge almost reached his -ears and whose sharp points curved forward abreast the corners of his -mouth--a fence that compelled a straight lookout ahead, and a turning -of the whole body when a side view was required; his chin was propped -on a spreading cravat which was as broad and as long as a bank-note, -and had fringed ends; his boot toes were turned sharply up, in the -fashion of the day, like sleigh-runners--an effect patiently and -laboriously produced by the young men by sitting with their toes -pressed against a wall for hours together. Mr. Walters was very earnest -of mien, and very sincere and honest at heart; and he held sacred -things and places in such reverence, and so separated them from worldly -matters, that unconsciously to himself his Sunday-school voice had -acquired a peculiar intonation which was wholly absent on week-days. He -began after this fashion: - -"Now, children, I want you all to sit up just as straight and pretty -as you can and give me all your attention for a minute or two. There ---that is it. That is the way good little boys and girls should do. I see -one little girl who is looking out of the window--I am afraid she -thinks I am out there somewhere--perhaps up in one of the trees making -a speech to the little birds. [Applausive titter.] I want to tell you -how good it makes me feel to see so many bright, clean little faces -assembled in a place like this, learning to do right and be good." And -so forth and so on. It is not necessary to set down the rest of the -oration. It was of a pattern which does not vary, and so it is familiar -to us all. - -The latter third of the speech was marred by the resumption of fights -and other recreations among certain of the bad boys, and by fidgetings -and whisperings that extended far and wide, washing even to the bases -of isolated and incorruptible rocks like Sid and Mary. But now every -sound ceased suddenly, with the subsidence of Mr. Walters' voice, and -the conclusion of the speech was received with a burst of silent -gratitude. - -A good part of the whispering had been occasioned by an event which -was more or less rare--the entrance of visitors: lawyer Thatcher, -accompanied by a very feeble and aged man; a fine, portly, middle-aged -gentleman with iron-gray hair; and a dignified lady who was doubtless -the latter's wife. The lady was leading a child. Tom had been restless -and full of chafings and repinings; conscience-smitten, too--he could -not meet Amy Lawrence's eye, he could not brook her loving gaze. But -when he saw this small new-comer his soul was all ablaze with bliss in -a moment. The next moment he was "showing off" with all his might ---cuffing boys, pulling hair, making faces--in a word, using every art -that seemed likely to fascinate a girl and win her applause. His -exaltation had but one alloy--the memory of his humiliation in this -angel's garden--and that record in sand was fast washing out, under -the waves of happiness that were sweeping over it now. - -The visitors were given the highest seat of honor, and as soon as Mr. -Walters' speech was finished, he introduced them to the school. The -middle-aged man turned out to be a prodigious personage--no less a one -than the county judge--altogether the most august creation these -children had ever looked upon--and they wondered what kind of material -he was made of--and they half wanted to hear him roar, and were half -afraid he might, too. He was from Constantinople, twelve miles away--so -he had travelled, and seen the world--these very eyes had looked upon -the county court-house--which was said to have a tin roof. The awe -which these reflections inspired was attested by the impressive silence -and the ranks of staring eyes. This was the great Judge Thatcher, -brother of their own lawyer. Jeff Thatcher immediately went forward, to -be familiar with the great man and be envied by the school. It would -have been music to his soul to hear the whisperings: - -"Look at him, Jim! He's a going up there. Say--look! he's a going to -shake hands with him--he IS shaking hands with him! By jings, don't you -wish you was Jeff?" - -Mr. Walters fell to "showing off," with all sorts of official -bustlings and activities, giving orders, delivering judgments, -discharging directions here, there, everywhere that he could find a -target. The librarian "showed off"--running hither and thither with his -arms full of books and making a deal of the splutter and fuss that -insect authority delights in. The young lady teachers "showed off" ---bending sweetly over pupils that were lately being boxed, lifting -pretty warning fingers at bad little boys and patting good ones -lovingly. The young gentlemen teachers "showed off" with small -scoldings and other little displays of authority and fine attention to -discipline--and most of the teachers, of both sexes, found business up -at the library, by the pulpit; and it was business that frequently had -to be done over again two or three times (with much seeming vexation). -The little girls "showed off" in various ways, and the little boys -"showed off" with such diligence that the air was thick with paper wads -and the murmur of scufflings. And above it all the great man sat and -beamed a majestic judicial smile upon all the house, and warmed himself -in the sun of his own grandeur--for he was "showing off," too. - -There was only one thing wanting to make Mr. Walters' ecstasy -complete, and that was a chance to deliver a Bible-prize and exhibit a -prodigy. Several pupils had a few yellow tickets, but none had enough ---he had been around among the star pupils inquiring. He would have given -worlds, now, to have that German lad back again with a sound mind. - -And now at this moment, when hope was dead, Tom Sawyer came forward -with nine yellow tickets, nine red tickets, and ten blue ones, and -demanded a Bible. This was a thunderbolt out of a clear sky. Walters -was not expecting an application from this source for the next ten -years. But there was no getting around it--here were the certified -checks, and they were good for their face. Tom was therefore elevated -to a place with the Judge and the other elect, and the great news was -announced from headquarters. It was the most stunning surprise of the -decade, and so profound was the sensation that it lifted the new hero -up to the judicial one's altitude, and the school had two marvels to -gaze upon in place of one. The boys were all eaten up with envy--but -those that suffered the bitterest pangs were those who perceived too -late that they themselves had contributed to this hated splendor by -trading tickets to Tom for the wealth he had amassed in selling -whitewashing privileges. These despised themselves, as being the dupes -of a wily fraud, a guileful snake in the grass. - -The prize was delivered to Tom with as much effusion as the -superintendent could pump up under the circumstances; but it lacked -somewhat of the true gush, for the poor fellow's instinct taught him -that there was a mystery here that could not well bear the light, -perhaps; it was simply preposterous that this boy had warehoused two -thousand sheaves of Scriptural wisdom on his premises--a dozen would -strain his capacity, without a doubt. - -Amy Lawrence was proud and glad, and she tried to make Tom see it in -her face--but he wouldn't look. She wondered; then she was just a grain -troubled; next a dim suspicion came and went--came again; she watched; -a furtive glance told her worlds--and then her heart broke, and she was -jealous, and angry, and the tears came and she hated everybody. Tom -most of all (she thought). - -Tom was introduced to the Judge; but his tongue was tied, his breath -would hardly come, his heart quaked--partly because of the awful -greatness of the man, but mainly because he was her parent. He would -have liked to fall down and worship him, if it were in the dark. The -Judge put his hand on Tom's head and called him a fine little man, and -asked him what his name was. The boy stammered, gasped, and got it out: - -"Tom." - -"Oh, no, not Tom--it is--" - -"Thomas." - -"Ah, that's it. I thought there was more to it, maybe. That's very -well. But you've another one I daresay, and you'll tell it to me, won't -you?" - -"Tell the gentleman your other name, Thomas," said Walters, "and say -sir. You mustn't forget your manners." - -"Thomas Sawyer--sir." - -"That's it! That's a good boy. Fine boy. Fine, manly little fellow. -Two thousand verses is a great many--very, very great many. And you -never can be sorry for the trouble you took to learn them; for -knowledge is worth more than anything there is in the world; it's what -makes great men and good men; you'll be a great man and a good man -yourself, some day, Thomas, and then you'll look back and say, It's all -owing to the precious Sunday-school privileges of my boyhood--it's all -owing to my dear teachers that taught me to learn--it's all owing to -the good superintendent, who encouraged me, and watched over me, and -gave me a beautiful Bible--a splendid elegant Bible--to keep and have -it all for my own, always--it's all owing to right bringing up! That is -what you will say, Thomas--and you wouldn't take any money for those -two thousand verses--no indeed you wouldn't. And now you wouldn't mind -telling me and this lady some of the things you've learned--no, I know -you wouldn't--for we are proud of little boys that learn. Now, no -doubt you know the names of all the twelve disciples. Won't you tell us -the names of the first two that were appointed?" - -Tom was tugging at a button-hole and looking sheepish. He blushed, -now, and his eyes fell. Mr. Walters' heart sank within him. He said to -himself, it is not possible that the boy can answer the simplest -question--why DID the Judge ask him? Yet he felt obliged to speak up -and say: - -"Answer the gentleman, Thomas--don't be afraid." - -Tom still hung fire. - -"Now I know you'll tell me," said the lady. "The names of the first -two disciples were--" - -"DAVID AND GOLIAH!" - -Let us draw the curtain of charity over the rest of the scene. - - - -CHAPTER V - -ABOUT half-past ten the cracked bell of the small church began to -ring, and presently the people began to gather for the morning sermon. -The Sunday-school children distributed themselves about the house and -occupied pews with their parents, so as to be under supervision. Aunt -Polly came, and Tom and Sid and Mary sat with her--Tom being placed -next the aisle, in order that he might be as far away from the open -window and the seductive outside summer scenes as possible. The crowd -filed up the aisles: the aged and needy postmaster, who had seen better -days; the mayor and his wife--for they had a mayor there, among other -unnecessaries; the justice of the peace; the widow Douglass, fair, -smart, and forty, a generous, good-hearted soul and well-to-do, her -hill mansion the only palace in the town, and the most hospitable and -much the most lavish in the matter of festivities that St. Petersburg -could boast; the bent and venerable Major and Mrs. Ward; lawyer -Riverson, the new notable from a distance; next the belle of the -village, followed by a troop of lawn-clad and ribbon-decked young -heart-breakers; then all the young clerks in town in a body--for they -had stood in the vestibule sucking their cane-heads, a circling wall of -oiled and simpering admirers, till the last girl had run their gantlet; -and last of all came the Model Boy, Willie Mufferson, taking as heedful -care of his mother as if she were cut glass. He always brought his -mother to church, and was the pride of all the matrons. The boys all -hated him, he was so good. And besides, he had been "thrown up to them" -so much. His white handkerchief was hanging out of his pocket behind, as -usual on Sundays--accidentally. Tom had no handkerchief, and he looked -upon boys who had as snobs. - -The congregation being fully assembled, now, the bell rang once more, -to warn laggards and stragglers, and then a solemn hush fell upon the -church which was only broken by the tittering and whispering of the -choir in the gallery. The choir always tittered and whispered all -through service. There was once a church choir that was not ill-bred, -but I have forgotten where it was, now. It was a great many years ago, -and I can scarcely remember anything about it, but I think it was in -some foreign country. - -The minister gave out the hymn, and read it through with a relish, in -a peculiar style which was much admired in that part of the country. -His voice began on a medium key and climbed steadily up till it reached -a certain point, where it bore with strong emphasis upon the topmost -word and then plunged down as if from a spring-board: - - Shall I be car-ri-ed toe the skies, on flow'ry BEDS of ease, - - Whilst others fight to win the prize, and sail thro' BLOODY seas? - -He was regarded as a wonderful reader. At church "sociables" he was -always called upon to read poetry; and when he was through, the ladies -would lift up their hands and let them fall helplessly in their laps, -and "wall" their eyes, and shake their heads, as much as to say, "Words -cannot express it; it is too beautiful, TOO beautiful for this mortal -earth." - -After the hymn had been sung, the Rev. Mr. Sprague turned himself into -a bulletin-board, and read off "notices" of meetings and societies and -things till it seemed that the list would stretch out to the crack of -doom--a queer custom which is still kept up in America, even in cities, -away here in this age of abundant newspapers. Often, the less there is -to justify a traditional custom, the harder it is to get rid of it. - -And now the minister prayed. A good, generous prayer it was, and went -into details: it pleaded for the church, and the little children of the -church; for the other churches of the village; for the village itself; -for the county; for the State; for the State officers; for the United -States; for the churches of the United States; for Congress; for the -President; for the officers of the Government; for poor sailors, tossed -by stormy seas; for the oppressed millions groaning under the heel of -European monarchies and Oriental despotisms; for such as have the light -and the good tidings, and yet have not eyes to see nor ears to hear -withal; for the heathen in the far islands of the sea; and closed with -a supplication that the words he was about to speak might find grace -and favor, and be as seed sown in fertile ground, yielding in time a -grateful harvest of good. Amen. - -There was a rustling of dresses, and the standing congregation sat -down. The boy whose history this book relates did not enjoy the prayer, -he only endured it--if he even did that much. He was restive all -through it; he kept tally of the details of the prayer, unconsciously ---for he was not listening, but he knew the ground of old, and the -clergyman's regular route over it--and when a little trifle of new -matter was interlarded, his ear detected it and his whole nature -resented it; he considered additions unfair, and scoundrelly. In the -midst of the prayer a fly had lit on the back of the pew in front of -him and tortured his spirit by calmly rubbing its hands together, -embracing its head with its arms, and polishing it so vigorously that -it seemed to almost part company with the body, and the slender thread -of a neck was exposed to view; scraping its wings with its hind legs -and smoothing them to its body as if they had been coat-tails; going -through its whole toilet as tranquilly as if it knew it was perfectly -safe. As indeed it was; for as sorely as Tom's hands itched to grab for -it they did not dare--he believed his soul would be instantly destroyed -if he did such a thing while the prayer was going on. But with the -closing sentence his hand began to curve and steal forward; and the -instant the "Amen" was out the fly was a prisoner of war. His aunt -detected the act and made him let it go. - -The minister gave out his text and droned along monotonously through -an argument that was so prosy that many a head by and by began to nod ---and yet it was an argument that dealt in limitless fire and brimstone -and thinned the predestined elect down to a company so small as to be -hardly worth the saving. Tom counted the pages of the sermon; after -church he always knew how many pages there had been, but he seldom knew -anything else about the discourse. However, this time he was really -interested for a little while. The minister made a grand and moving -picture of the assembling together of the world's hosts at the -millennium when the lion and the lamb should lie down together and a -little child should lead them. But the pathos, the lesson, the moral of -the great spectacle were lost upon the boy; he only thought of the -conspicuousness of the principal character before the on-looking -nations; his face lit with the thought, and he said to himself that he -wished he could be that child, if it was a tame lion. - -Now he lapsed into suffering again, as the dry argument was resumed. -Presently he bethought him of a treasure he had and got it out. It was -a large black beetle with formidable jaws--a "pinchbug," he called it. -It was in a percussion-cap box. The first thing the beetle did was to -take him by the finger. A natural fillip followed, the beetle went -floundering into the aisle and lit on its back, and the hurt finger -went into the boy's mouth. The beetle lay there working its helpless -legs, unable to turn over. Tom eyed it, and longed for it; but it was -safe out of his reach. Other people uninterested in the sermon found -relief in the beetle, and they eyed it too. Presently a vagrant poodle -dog came idling along, sad at heart, lazy with the summer softness and -the quiet, weary of captivity, sighing for change. He spied the beetle; -the drooping tail lifted and wagged. He surveyed the prize; walked -around it; smelt at it from a safe distance; walked around it again; -grew bolder, and took a closer smell; then lifted his lip and made a -gingerly snatch at it, just missing it; made another, and another; -began to enjoy the diversion; subsided to his stomach with the beetle -between his paws, and continued his experiments; grew weary at last, -and then indifferent and absent-minded. His head nodded, and little by -little his chin descended and touched the enemy, who seized it. There -was a sharp yelp, a flirt of the poodle's head, and the beetle fell a -couple of yards away, and lit on its back once more. The neighboring -spectators shook with a gentle inward joy, several faces went behind -fans and handkerchiefs, and Tom was entirely happy. The dog looked -foolish, and probably felt so; but there was resentment in his heart, -too, and a craving for revenge. So he went to the beetle and began a -wary attack on it again; jumping at it from every point of a circle, -lighting with his fore-paws within an inch of the creature, making even -closer snatches at it with his teeth, and jerking his head till his -ears flapped again. But he grew tired once more, after a while; tried -to amuse himself with a fly but found no relief; followed an ant -around, with his nose close to the floor, and quickly wearied of that; -yawned, sighed, forgot the beetle entirely, and sat down on it. Then -there was a wild yelp of agony and the poodle went sailing up the -aisle; the yelps continued, and so did the dog; he crossed the house in -front of the altar; he flew down the other aisle; he crossed before the -doors; he clamored up the home-stretch; his anguish grew with his -progress, till presently he was but a woolly comet moving in its orbit -with the gleam and the speed of light. At last the frantic sufferer -sheered from its course, and sprang into its master's lap; he flung it -out of the window, and the voice of distress quickly thinned away and -died in the distance. - -By this time the whole church was red-faced and suffocating with -suppressed laughter, and the sermon had come to a dead standstill. The -discourse was resumed presently, but it went lame and halting, all -possibility of impressiveness being at an end; for even the gravest -sentiments were constantly being received with a smothered burst of -unholy mirth, under cover of some remote pew-back, as if the poor -parson had said a rarely facetious thing. It was a genuine relief to -the whole congregation when the ordeal was over and the benediction -pronounced. - -Tom Sawyer went home quite cheerful, thinking to himself that there -was some satisfaction about divine service when there was a bit of -variety in it. He had but one marring thought; he was willing that the -dog should play with his pinchbug, but he did not think it was upright -in him to carry it off. - - - -CHAPTER VI - -MONDAY morning found Tom Sawyer miserable. Monday morning always found -him so--because it began another week's slow suffering in school. He -generally began that day with wishing he had had no intervening -holiday, it made the going into captivity and fetters again so much -more odious. - -Tom lay thinking. Presently it occurred to him that he wished he was -sick; then he could stay home from school. Here was a vague -possibility. He canvassed his system. No ailment was found, and he -investigated again. This time he thought he could detect colicky -symptoms, and he began to encourage them with considerable hope. But -they soon grew feeble, and presently died wholly away. He reflected -further. Suddenly he discovered something. One of his upper front teeth -was loose. This was lucky; he was about to begin to groan, as a -"starter," as he called it, when it occurred to him that if he came -into court with that argument, his aunt would pull it out, and that -would hurt. So he thought he would hold the tooth in reserve for the -present, and seek further. Nothing offered for some little time, and -then he remembered hearing the doctor tell about a certain thing that -laid up a patient for two or three weeks and threatened to make him -lose a finger. So the boy eagerly drew his sore toe from under the -sheet and held it up for inspection. But now he did not know the -necessary symptoms. However, it seemed well worth while to chance it, -so he fell to groaning with considerable spirit. - -But Sid slept on unconscious. - -Tom groaned louder, and fancied that he began to feel pain in the toe. - -No result from Sid. - -Tom was panting with his exertions by this time. He took a rest and -then swelled himself up and fetched a succession of admirable groans. - -Sid snored on. - -Tom was aggravated. He said, "Sid, Sid!" and shook him. This course -worked well, and Tom began to groan again. Sid yawned, stretched, then -brought himself up on his elbow with a snort, and began to stare at -Tom. Tom went on groaning. Sid said: - -"Tom! Say, Tom!" [No response.] "Here, Tom! TOM! What is the matter, -Tom?" And he shook him and looked in his face anxiously. - -Tom moaned out: - -"Oh, don't, Sid. Don't joggle me." - -"Why, what's the matter, Tom? I must call auntie." - -"No--never mind. It'll be over by and by, maybe. Don't call anybody." - -"But I must! DON'T groan so, Tom, it's awful. How long you been this -way?" - -"Hours. Ouch! Oh, don't stir so, Sid, you'll kill me." - -"Tom, why didn't you wake me sooner? Oh, Tom, DON'T! It makes my -flesh crawl to hear you. Tom, what is the matter?" - -"I forgive you everything, Sid. [Groan.] Everything you've ever done -to me. When I'm gone--" - -"Oh, Tom, you ain't dying, are you? Don't, Tom--oh, don't. Maybe--" - -"I forgive everybody, Sid. [Groan.] Tell 'em so, Sid. And Sid, you -give my window-sash and my cat with one eye to that new girl that's -come to town, and tell her--" - -But Sid had snatched his clothes and gone. Tom was suffering in -reality, now, so handsomely was his imagination working, and so his -groans had gathered quite a genuine tone. - -Sid flew down-stairs and said: - -"Oh, Aunt Polly, come! Tom's dying!" - -"Dying!" - -"Yes'm. Don't wait--come quick!" - -"Rubbage! I don't believe it!" - -But she fled up-stairs, nevertheless, with Sid and Mary at her heels. -And her face grew white, too, and her lip trembled. When she reached -the bedside she gasped out: - -"You, Tom! Tom, what's the matter with you?" - -"Oh, auntie, I'm--" - -"What's the matter with you--what is the matter with you, child?" - -"Oh, auntie, my sore toe's mortified!" - -The old lady sank down into a chair and laughed a little, then cried a -little, then did both together. This restored her and she said: - -"Tom, what a turn you did give me. Now you shut up that nonsense and -climb out of this." - -The groans ceased and the pain vanished from the toe. The boy felt a -little foolish, and he said: - -"Aunt Polly, it SEEMED mortified, and it hurt so I never minded my -tooth at all." - -"Your tooth, indeed! What's the matter with your tooth?" - -"One of them's loose, and it aches perfectly awful." - -"There, there, now, don't begin that groaning again. Open your mouth. -Well--your tooth IS loose, but you're not going to die about that. -Mary, get me a silk thread, and a chunk of fire out of the kitchen." - -Tom said: - -"Oh, please, auntie, don't pull it out. It don't hurt any more. I wish -I may never stir if it does. Please don't, auntie. I don't want to stay -home from school." - -"Oh, you don't, don't you? So all this row was because you thought -you'd get to stay home from school and go a-fishing? Tom, Tom, I love -you so, and you seem to try every way you can to break my old heart -with your outrageousness." By this time the dental instruments were -ready. The old lady made one end of the silk thread fast to Tom's tooth -with a loop and tied the other to the bedpost. Then she seized the -chunk of fire and suddenly thrust it almost into the boy's face. The -tooth hung dangling by the bedpost, now. - -But all trials bring their compensations. As Tom wended to school -after breakfast, he was the envy of every boy he met because the gap in -his upper row of teeth enabled him to expectorate in a new and -admirable way. He gathered quite a following of lads interested in the -exhibition; and one that had cut his finger and had been a centre of -fascination and homage up to this time, now found himself suddenly -without an adherent, and shorn of his glory. His heart was heavy, and -he said with a disdain which he did not feel that it wasn't anything to -spit like Tom Sawyer; but another boy said, "Sour grapes!" and he -wandered away a dismantled hero. - -Shortly Tom came upon the juvenile pariah of the village, Huckleberry -Finn, son of the town drunkard. Huckleberry was cordially hated and -dreaded by all the mothers of the town, because he was idle and lawless -and vulgar and bad--and because all their children admired him so, and -delighted in his forbidden society, and wished they dared to be like -him. Tom was like the rest of the respectable boys, in that he envied -Huckleberry his gaudy outcast condition, and was under strict orders -not to play with him. So he played with him every time he got a chance. -Huckleberry was always dressed in the cast-off clothes of full-grown -men, and they were in perennial bloom and fluttering with rags. His hat -was a vast ruin with a wide crescent lopped out of its brim; his coat, -when he wore one, hung nearly to his heels and had the rearward buttons -far down the back; but one suspender supported his trousers; the seat -of the trousers bagged low and contained nothing, the fringed legs -dragged in the dirt when not rolled up. - -Huckleberry came and went, at his own free will. He slept on doorsteps -in fine weather and in empty hogsheads in wet; he did not have to go to -school or to church, or call any being master or obey anybody; he could -go fishing or swimming when and where he chose, and stay as long as it -suited him; nobody forbade him to fight; he could sit up as late as he -pleased; he was always the first boy that went barefoot in the spring -and the last to resume leather in the fall; he never had to wash, nor -put on clean clothes; he could swear wonderfully. In a word, everything -that goes to make life precious that boy had. So thought every -harassed, hampered, respectable boy in St. Petersburg. - -Tom hailed the romantic outcast: - -"Hello, Huckleberry!" - -"Hello yourself, and see how you like it." - -"What's that you got?" - -"Dead cat." - -"Lemme see him, Huck. My, he's pretty stiff. Where'd you get him?" - -"Bought him off'n a boy." - -"What did you give?" - -"I give a blue ticket and a bladder that I got at the slaughter-house." - -"Where'd you get the blue ticket?" - -"Bought it off'n Ben Rogers two weeks ago for a hoop-stick." - -"Say--what is dead cats good for, Huck?" - -"Good for? Cure warts with." - -"No! Is that so? I know something that's better." - -"I bet you don't. What is it?" - -"Why, spunk-water." - -"Spunk-water! I wouldn't give a dern for spunk-water." - -"You wouldn't, wouldn't you? D'you ever try it?" - -"No, I hain't. But Bob Tanner did." - -"Who told you so!" - -"Why, he told Jeff Thatcher, and Jeff told Johnny Baker, and Johnny -told Jim Hollis, and Jim told Ben Rogers, and Ben told a nigger, and -the nigger told me. There now!" - -"Well, what of it? They'll all lie. Leastways all but the nigger. I -don't know HIM. But I never see a nigger that WOULDN'T lie. Shucks! Now -you tell me how Bob Tanner done it, Huck." - -"Why, he took and dipped his hand in a rotten stump where the -rain-water was." - -"In the daytime?" - -"Certainly." - -"With his face to the stump?" - -"Yes. Least I reckon so." - -"Did he say anything?" - -"I don't reckon he did. I don't know." - -"Aha! Talk about trying to cure warts with spunk-water such a blame -fool way as that! Why, that ain't a-going to do any good. You got to go -all by yourself, to the middle of the woods, where you know there's a -spunk-water stump, and just as it's midnight you back up against the -stump and jam your hand in and say: - - 'Barley-corn, barley-corn, injun-meal shorts, - Spunk-water, spunk-water, swaller these warts,' - -and then walk away quick, eleven steps, with your eyes shut, and then -turn around three times and walk home without speaking to anybody. -Because if you speak the charm's busted." - -"Well, that sounds like a good way; but that ain't the way Bob Tanner -done." - -"No, sir, you can bet he didn't, becuz he's the wartiest boy in this -town; and he wouldn't have a wart on him if he'd knowed how to work -spunk-water. I've took off thousands of warts off of my hands that way, -Huck. I play with frogs so much that I've always got considerable many -warts. Sometimes I take 'em off with a bean." - -"Yes, bean's good. I've done that." - -"Have you? What's your way?" - -"You take and split the bean, and cut the wart so as to get some -blood, and then you put the blood on one piece of the bean and take and -dig a hole and bury it 'bout midnight at the crossroads in the dark of -the moon, and then you burn up the rest of the bean. You see that piece -that's got the blood on it will keep drawing and drawing, trying to -fetch the other piece to it, and so that helps the blood to draw the -wart, and pretty soon off she comes." - -"Yes, that's it, Huck--that's it; though when you're burying it if you -say 'Down bean; off wart; come no more to bother me!' it's better. -That's the way Joe Harper does, and he's been nearly to Coonville and -most everywheres. But say--how do you cure 'em with dead cats?" - -"Why, you take your cat and go and get in the graveyard 'long about -midnight when somebody that was wicked has been buried; and when it's -midnight a devil will come, or maybe two or three, but you can't see -'em, you can only hear something like the wind, or maybe hear 'em talk; -and when they're taking that feller away, you heave your cat after 'em -and say, 'Devil follow corpse, cat follow devil, warts follow cat, I'm -done with ye!' That'll fetch ANY wart." - -"Sounds right. D'you ever try it, Huck?" - -"No, but old Mother Hopkins told me." - -"Well, I reckon it's so, then. Becuz they say she's a witch." - -"Say! Why, Tom, I KNOW she is. She witched pap. Pap says so his own -self. He come along one day, and he see she was a-witching him, so he -took up a rock, and if she hadn't dodged, he'd a got her. Well, that -very night he rolled off'n a shed wher' he was a layin drunk, and broke -his arm." - -"Why, that's awful. How did he know she was a-witching him?" - -"Lord, pap can tell, easy. Pap says when they keep looking at you -right stiddy, they're a-witching you. Specially if they mumble. Becuz -when they mumble they're saying the Lord's Prayer backards." - -"Say, Hucky, when you going to try the cat?" - -"To-night. I reckon they'll come after old Hoss Williams to-night." - -"But they buried him Saturday. Didn't they get him Saturday night?" - -"Why, how you talk! How could their charms work till midnight?--and -THEN it's Sunday. Devils don't slosh around much of a Sunday, I don't -reckon." - -"I never thought of that. That's so. Lemme go with you?" - -"Of course--if you ain't afeard." - -"Afeard! 'Tain't likely. Will you meow?" - -"Yes--and you meow back, if you get a chance. Last time, you kep' me -a-meowing around till old Hays went to throwing rocks at me and says -'Dern that cat!' and so I hove a brick through his window--but don't -you tell." - -"I won't. I couldn't meow that night, becuz auntie was watching me, -but I'll meow this time. Say--what's that?" - -"Nothing but a tick." - -"Where'd you get him?" - -"Out in the woods." - -"What'll you take for him?" - -"I don't know. I don't want to sell him." - -"All right. It's a mighty small tick, anyway." - -"Oh, anybody can run a tick down that don't belong to them. I'm -satisfied with it. It's a good enough tick for me." - -"Sho, there's ticks a plenty. I could have a thousand of 'em if I -wanted to." - -"Well, why don't you? Becuz you know mighty well you can't. This is a -pretty early tick, I reckon. It's the first one I've seen this year." - -"Say, Huck--I'll give you my tooth for him." - -"Less see it." - -Tom got out a bit of paper and carefully unrolled it. Huckleberry -viewed it wistfully. The temptation was very strong. At last he said: - -"Is it genuwyne?" - -Tom lifted his lip and showed the vacancy. - -"Well, all right," said Huckleberry, "it's a trade." - -Tom enclosed the tick in the percussion-cap box that had lately been -the pinchbug's prison, and the boys separated, each feeling wealthier -than before. - -When Tom reached the little isolated frame schoolhouse, he strode in -briskly, with the manner of one who had come with all honest speed. -He hung his hat on a peg and flung himself into his seat with -business-like alacrity. The master, throned on high in his great -splint-bottom arm-chair, was dozing, lulled by the drowsy hum of study. -The interruption roused him. - -"Thomas Sawyer!" - -Tom knew that when his name was pronounced in full, it meant trouble. - -"Sir!" - -"Come up here. Now, sir, why are you late again, as usual?" - -Tom was about to take refuge in a lie, when he saw two long tails of -yellow hair hanging down a back that he recognized by the electric -sympathy of love; and by that form was THE ONLY VACANT PLACE on the -girls' side of the schoolhouse. He instantly said: - -"I STOPPED TO TALK WITH HUCKLEBERRY FINN!" - -The master's pulse stood still, and he stared helplessly. The buzz of -study ceased. The pupils wondered if this foolhardy boy had lost his -mind. The master said: - -"You--you did what?" - -"Stopped to talk with Huckleberry Finn." - -There was no mistaking the words. - -"Thomas Sawyer, this is the most astounding confession I have ever -listened to. No mere ferule will answer for this offence. Take off your -jacket." - -The master's arm performed until it was tired and the stock of -switches notably diminished. Then the order followed: - -"Now, sir, go and sit with the girls! And let this be a warning to you." - -The titter that rippled around the room appeared to abash the boy, but -in reality that result was caused rather more by his worshipful awe of -his unknown idol and the dread pleasure that lay in his high good -fortune. He sat down upon the end of the pine bench and the girl -hitched herself away from him with a toss of her head. Nudges and winks -and whispers traversed the room, but Tom sat still, with his arms upon -the long, low desk before him, and seemed to study his book. - -By and by attention ceased from him, and the accustomed school murmur -rose upon the dull air once more. Presently the boy began to steal -furtive glances at the girl. She observed it, "made a mouth" at him and -gave him the back of her head for the space of a minute. When she -cautiously faced around again, a peach lay before her. She thrust it -away. Tom gently put it back. She thrust it away again, but with less -animosity. Tom patiently returned it to its place. Then she let it -remain. Tom scrawled on his slate, "Please take it--I got more." The -girl glanced at the words, but made no sign. Now the boy began to draw -something on the slate, hiding his work with his left hand. For a time -the girl refused to notice; but her human curiosity presently began to -manifest itself by hardly perceptible signs. The boy worked on, -apparently unconscious. The girl made a sort of noncommittal attempt to -see, but the boy did not betray that he was aware of it. At last she -gave in and hesitatingly whispered: - -"Let me see it." - -Tom partly uncovered a dismal caricature of a house with two gable -ends to it and a corkscrew of smoke issuing from the chimney. Then the -girl's interest began to fasten itself upon the work and she forgot -everything else. When it was finished, she gazed a moment, then -whispered: - -"It's nice--make a man." - -The artist erected a man in the front yard, that resembled a derrick. -He could have stepped over the house; but the girl was not -hypercritical; she was satisfied with the monster, and whispered: - -"It's a beautiful man--now make me coming along." - -Tom drew an hour-glass with a full moon and straw limbs to it and -armed the spreading fingers with a portentous fan. The girl said: - -"It's ever so nice--I wish I could draw." - -"It's easy," whispered Tom, "I'll learn you." - -"Oh, will you? When?" - -"At noon. Do you go home to dinner?" - -"I'll stay if you will." - -"Good--that's a whack. What's your name?" - -"Becky Thatcher. What's yours? Oh, I know. It's Thomas Sawyer." - -"That's the name they lick me by. I'm Tom when I'm good. You call me -Tom, will you?" - -"Yes." - -Now Tom began to scrawl something on the slate, hiding the words from -the girl. But she was not backward this time. She begged to see. Tom -said: - -"Oh, it ain't anything." - -"Yes it is." - -"No it ain't. You don't want to see." - -"Yes I do, indeed I do. Please let me." - -"You'll tell." - -"No I won't--deed and deed and double deed won't." - -"You won't tell anybody at all? Ever, as long as you live?" - -"No, I won't ever tell ANYbody. Now let me." - -"Oh, YOU don't want to see!" - -"Now that you treat me so, I WILL see." And she put her small hand -upon his and a little scuffle ensued, Tom pretending to resist in -earnest but letting his hand slip by degrees till these words were -revealed: "I LOVE YOU." - -"Oh, you bad thing!" And she hit his hand a smart rap, but reddened -and looked pleased, nevertheless. - -Just at this juncture the boy felt a slow, fateful grip closing on his -ear, and a steady lifting impulse. In that wise he was borne across the -house and deposited in his own seat, under a peppering fire of giggles -from the whole school. Then the master stood over him during a few -awful moments, and finally moved away to his throne without saying a -word. But although Tom's ear tingled, his heart was jubilant. - -As the school quieted down Tom made an honest effort to study, but the -turmoil within him was too great. In turn he took his place in the -reading class and made a botch of it; then in the geography class and -turned lakes into mountains, mountains into rivers, and rivers into -continents, till chaos was come again; then in the spelling class, and -got "turned down," by a succession of mere baby words, till he brought -up at the foot and yielded up the pewter medal which he had worn with -ostentation for months. - - - -CHAPTER VII - -THE harder Tom tried to fasten his mind on his book, the more his -ideas wandered. So at last, with a sigh and a yawn, he gave it up. It -seemed to him that the noon recess would never come. The air was -utterly dead. There was not a breath stirring. It was the sleepiest of -sleepy days. The drowsing murmur of the five and twenty studying -scholars soothed the soul like the spell that is in the murmur of bees. -Away off in the flaming sunshine, Cardiff Hill lifted its soft green -sides through a shimmering veil of heat, tinted with the purple of -distance; a few birds floated on lazy wing high in the air; no other -living thing was visible but some cows, and they were asleep. Tom's -heart ached to be free, or else to have something of interest to do to -pass the dreary time. His hand wandered into his pocket and his face -lit up with a glow of gratitude that was prayer, though he did not know -it. Then furtively the percussion-cap box came out. He released the -tick and put him on the long flat desk. The creature probably glowed -with a gratitude that amounted to prayer, too, at this moment, but it -was premature: for when he started thankfully to travel off, Tom turned -him aside with a pin and made him take a new direction. - -Tom's bosom friend sat next him, suffering just as Tom had been, and -now he was deeply and gratefully interested in this entertainment in an -instant. This bosom friend was Joe Harper. The two boys were sworn -friends all the week, and embattled enemies on Saturdays. Joe took a -pin out of his lapel and began to assist in exercising the prisoner. -The sport grew in interest momently. Soon Tom said that they were -interfering with each other, and neither getting the fullest benefit of -the tick. So he put Joe's slate on the desk and drew a line down the -middle of it from top to bottom. - -"Now," said he, "as long as he is on your side you can stir him up and -I'll let him alone; but if you let him get away and get on my side, -you're to leave him alone as long as I can keep him from crossing over." - -"All right, go ahead; start him up." - -The tick escaped from Tom, presently, and crossed the equator. Joe -harassed him awhile, and then he got away and crossed back again. This -change of base occurred often. While one boy was worrying the tick with -absorbing interest, the other would look on with interest as strong, -the two heads bowed together over the slate, and the two souls dead to -all things else. At last luck seemed to settle and abide with Joe. The -tick tried this, that, and the other course, and got as excited and as -anxious as the boys themselves, but time and again just as he would -have victory in his very grasp, so to speak, and Tom's fingers would be -twitching to begin, Joe's pin would deftly head him off, and keep -possession. At last Tom could stand it no longer. The temptation was -too strong. So he reached out and lent a hand with his pin. Joe was -angry in a moment. Said he: - -"Tom, you let him alone." - -"I only just want to stir him up a little, Joe." - -"No, sir, it ain't fair; you just let him alone." - -"Blame it, I ain't going to stir him much." - -"Let him alone, I tell you." - -"I won't!" - -"You shall--he's on my side of the line." - -"Look here, Joe Harper, whose is that tick?" - -"I don't care whose tick he is--he's on my side of the line, and you -sha'n't touch him." - -"Well, I'll just bet I will, though. He's my tick and I'll do what I -blame please with him, or die!" - -A tremendous whack came down on Tom's shoulders, and its duplicate on -Joe's; and for the space of two minutes the dust continued to fly from -the two jackets and the whole school to enjoy it. The boys had been too -absorbed to notice the hush that had stolen upon the school awhile -before when the master came tiptoeing down the room and stood over -them. He had contemplated a good part of the performance before he -contributed his bit of variety to it. - -When school broke up at noon, Tom flew to Becky Thatcher, and -whispered in her ear: - -"Put on your bonnet and let on you're going home; and when you get to -the corner, give the rest of 'em the slip, and turn down through the -lane and come back. I'll go the other way and come it over 'em the same -way." - -So the one went off with one group of scholars, and the other with -another. In a little while the two met at the bottom of the lane, and -when they reached the school they had it all to themselves. Then they -sat together, with a slate before them, and Tom gave Becky the pencil -and held her hand in his, guiding it, and so created another surprising -house. When the interest in art began to wane, the two fell to talking. -Tom was swimming in bliss. He said: - -"Do you love rats?" - -"No! I hate them!" - -"Well, I do, too--LIVE ones. But I mean dead ones, to swing round your -head with a string." - -"No, I don't care for rats much, anyway. What I like is chewing-gum." - -"Oh, I should say so! I wish I had some now." - -"Do you? I've got some. I'll let you chew it awhile, but you must give -it back to me." - -That was agreeable, so they chewed it turn about, and dangled their -legs against the bench in excess of contentment. - -"Was you ever at a circus?" said Tom. - -"Yes, and my pa's going to take me again some time, if I'm good." - -"I been to the circus three or four times--lots of times. Church ain't -shucks to a circus. There's things going on at a circus all the time. -I'm going to be a clown in a circus when I grow up." - -"Oh, are you! That will be nice. They're so lovely, all spotted up." - -"Yes, that's so. And they get slathers of money--most a dollar a day, -Ben Rogers says. Say, Becky, was you ever engaged?" - -"What's that?" - -"Why, engaged to be married." - -"No." - -"Would you like to?" - -"I reckon so. I don't know. What is it like?" - -"Like? Why it ain't like anything. You only just tell a boy you won't -ever have anybody but him, ever ever ever, and then you kiss and that's -all. Anybody can do it." - -"Kiss? What do you kiss for?" - -"Why, that, you know, is to--well, they always do that." - -"Everybody?" - -"Why, yes, everybody that's in love with each other. Do you remember -what I wrote on the slate?" - -"Ye--yes." - -"What was it?" - -"I sha'n't tell you." - -"Shall I tell YOU?" - -"Ye--yes--but some other time." - -"No, now." - -"No, not now--to-morrow." - -"Oh, no, NOW. Please, Becky--I'll whisper it, I'll whisper it ever so -easy." - -Becky hesitating, Tom took silence for consent, and passed his arm -about her waist and whispered the tale ever so softly, with his mouth -close to her ear. And then he added: - -"Now you whisper it to me--just the same." - -She resisted, for a while, and then said: - -"You turn your face away so you can't see, and then I will. But you -mustn't ever tell anybody--WILL you, Tom? Now you won't, WILL you?" - -"No, indeed, indeed I won't. Now, Becky." - -He turned his face away. She bent timidly around till her breath -stirred his curls and whispered, "I--love--you!" - -Then she sprang away and ran around and around the desks and benches, -with Tom after her, and took refuge in a corner at last, with her -little white apron to her face. Tom clasped her about her neck and -pleaded: - -"Now, Becky, it's all done--all over but the kiss. Don't you be afraid -of that--it ain't anything at all. Please, Becky." And he tugged at her -apron and the hands. - -By and by she gave up, and let her hands drop; her face, all glowing -with the struggle, came up and submitted. Tom kissed the red lips and -said: - -"Now it's all done, Becky. And always after this, you know, you ain't -ever to love anybody but me, and you ain't ever to marry anybody but -me, ever never and forever. Will you?" - -"No, I'll never love anybody but you, Tom, and I'll never marry -anybody but you--and you ain't to ever marry anybody but me, either." - -"Certainly. Of course. That's PART of it. And always coming to school -or when we're going home, you're to walk with me, when there ain't -anybody looking--and you choose me and I choose you at parties, because -that's the way you do when you're engaged." - -"It's so nice. I never heard of it before." - -"Oh, it's ever so gay! Why, me and Amy Lawrence--" - -The big eyes told Tom his blunder and he stopped, confused. - -"Oh, Tom! Then I ain't the first you've ever been engaged to!" - -The child began to cry. Tom said: - -"Oh, don't cry, Becky, I don't care for her any more." - -"Yes, you do, Tom--you know you do." - -Tom tried to put his arm about her neck, but she pushed him away and -turned her face to the wall, and went on crying. Tom tried again, with -soothing words in his mouth, and was repulsed again. Then his pride was -up, and he strode away and went outside. He stood about, restless and -uneasy, for a while, glancing at the door, every now and then, hoping -she would repent and come to find him. But she did not. Then he began -to feel badly and fear that he was in the wrong. It was a hard struggle -with him to make new advances, now, but he nerved himself to it and -entered. She was still standing back there in the corner, sobbing, with -her face to the wall. Tom's heart smote him. He went to her and stood a -moment, not knowing exactly how to proceed. Then he said hesitatingly: - -"Becky, I--I don't care for anybody but you." - -No reply--but sobs. - -"Becky"--pleadingly. "Becky, won't you say something?" - -More sobs. - -Tom got out his chiefest jewel, a brass knob from the top of an -andiron, and passed it around her so that she could see it, and said: - -"Please, Becky, won't you take it?" - -She struck it to the floor. Then Tom marched out of the house and over -the hills and far away, to return to school no more that day. Presently -Becky began to suspect. She ran to the door; he was not in sight; she -flew around to the play-yard; he was not there. Then she called: - -"Tom! Come back, Tom!" - -She listened intently, but there was no answer. She had no companions -but silence and loneliness. So she sat down to cry again and upbraid -herself; and by this time the scholars began to gather again, and she -had to hide her griefs and still her broken heart and take up the cross -of a long, dreary, aching afternoon, with none among the strangers -about her to exchange sorrows with. - - - -CHAPTER VIII - -TOM dodged hither and thither through lanes until he was well out of -the track of returning scholars, and then fell into a moody jog. He -crossed a small "branch" two or three times, because of a prevailing -juvenile superstition that to cross water baffled pursuit. Half an hour -later he was disappearing behind the Douglas mansion on the summit of -Cardiff Hill, and the schoolhouse was hardly distinguishable away off -in the valley behind him. He entered a dense wood, picked his pathless -way to the centre of it, and sat down on a mossy spot under a spreading -oak. There was not even a zephyr stirring; the dead noonday heat had -even stilled the songs of the birds; nature lay in a trance that was -broken by no sound but the occasional far-off hammering of a -woodpecker, and this seemed to render the pervading silence and sense -of loneliness the more profound. The boy's soul was steeped in -melancholy; his feelings were in happy accord with his surroundings. He -sat long with his elbows on his knees and his chin in his hands, -meditating. It seemed to him that life was but a trouble, at best, and -he more than half envied Jimmy Hodges, so lately released; it must be -very peaceful, he thought, to lie and slumber and dream forever and -ever, with the wind whispering through the trees and caressing the -grass and the flowers over the grave, and nothing to bother and grieve -about, ever any more. If he only had a clean Sunday-school record he -could be willing to go, and be done with it all. Now as to this girl. -What had he done? Nothing. He had meant the best in the world, and been -treated like a dog--like a very dog. She would be sorry some day--maybe -when it was too late. Ah, if he could only die TEMPORARILY! - -But the elastic heart of youth cannot be compressed into one -constrained shape long at a time. Tom presently began to drift -insensibly back into the concerns of this life again. What if he turned -his back, now, and disappeared mysteriously? What if he went away--ever -so far away, into unknown countries beyond the seas--and never came -back any more! How would she feel then! The idea of being a clown -recurred to him now, only to fill him with disgust. For frivolity and -jokes and spotted tights were an offense, when they intruded themselves -upon a spirit that was exalted into the vague august realm of the -romantic. No, he would be a soldier, and return after long years, all -war-worn and illustrious. No--better still, he would join the Indians, -and hunt buffaloes and go on the warpath in the mountain ranges and the -trackless great plains of the Far West, and away in the future come -back a great chief, bristling with feathers, hideous with paint, and -prance into Sunday-school, some drowsy summer morning, with a -bloodcurdling war-whoop, and sear the eyeballs of all his companions -with unappeasable envy. But no, there was something gaudier even than -this. He would be a pirate! That was it! NOW his future lay plain -before him, and glowing with unimaginable splendor. How his name would -fill the world, and make people shudder! How gloriously he would go -plowing the dancing seas, in his long, low, black-hulled racer, the -Spirit of the Storm, with his grisly flag flying at the fore! And at -the zenith of his fame, how he would suddenly appear at the old village -and stalk into church, brown and weather-beaten, in his black velvet -doublet and trunks, his great jack-boots, his crimson sash, his belt -bristling with horse-pistols, his crime-rusted cutlass at his side, his -slouch hat with waving plumes, his black flag unfurled, with the skull -and crossbones on it, and hear with swelling ecstasy the whisperings, -"It's Tom Sawyer the Pirate!--the Black Avenger of the Spanish Main!" - -Yes, it was settled; his career was determined. He would run away from -home and enter upon it. He would start the very next morning. Therefore -he must now begin to get ready. He would collect his resources -together. He went to a rotten log near at hand and began to dig under -one end of it with his Barlow knife. He soon struck wood that sounded -hollow. He put his hand there and uttered this incantation impressively: - -"What hasn't come here, come! What's here, stay here!" - -Then he scraped away the dirt, and exposed a pine shingle. He took it -up and disclosed a shapely little treasure-house whose bottom and sides -were of shingles. In it lay a marble. Tom's astonishment was boundless! -He scratched his head with a perplexed air, and said: - -"Well, that beats anything!" - -Then he tossed the marble away pettishly, and stood cogitating. The -truth was, that a superstition of his had failed, here, which he and -all his comrades had always looked upon as infallible. If you buried a -marble with certain necessary incantations, and left it alone a -fortnight, and then opened the place with the incantation he had just -used, you would find that all the marbles you had ever lost had -gathered themselves together there, meantime, no matter how widely they -had been separated. But now, this thing had actually and unquestionably -failed. Tom's whole structure of faith was shaken to its foundations. -He had many a time heard of this thing succeeding but never of its -failing before. It did not occur to him that he had tried it several -times before, himself, but could never find the hiding-places -afterward. He puzzled over the matter some time, and finally decided -that some witch had interfered and broken the charm. He thought he -would satisfy himself on that point; so he searched around till he -found a small sandy spot with a little funnel-shaped depression in it. -He laid himself down and put his mouth close to this depression and -called-- - -"Doodle-bug, doodle-bug, tell me what I want to know! Doodle-bug, -doodle-bug, tell me what I want to know!" - -The sand began to work, and presently a small black bug appeared for a -second and then darted under again in a fright. - -"He dasn't tell! So it WAS a witch that done it. I just knowed it." - -He well knew the futility of trying to contend against witches, so he -gave up discouraged. But it occurred to him that he might as well have -the marble he had just thrown away, and therefore he went and made a -patient search for it. But he could not find it. Now he went back to -his treasure-house and carefully placed himself just as he had been -standing when he tossed the marble away; then he took another marble -from his pocket and tossed it in the same way, saying: - -"Brother, go find your brother!" - -He watched where it stopped, and went there and looked. But it must -have fallen short or gone too far; so he tried twice more. The last -repetition was successful. The two marbles lay within a foot of each -other. - -Just here the blast of a toy tin trumpet came faintly down the green -aisles of the forest. Tom flung off his jacket and trousers, turned a -suspender into a belt, raked away some brush behind the rotten log, -disclosing a rude bow and arrow, a lath sword and a tin trumpet, and in -a moment had seized these things and bounded away, barelegged, with -fluttering shirt. He presently halted under a great elm, blew an -answering blast, and then began to tiptoe and look warily out, this way -and that. He said cautiously--to an imaginary company: - -"Hold, my merry men! Keep hid till I blow." - -Now appeared Joe Harper, as airily clad and elaborately armed as Tom. -Tom called: - -"Hold! Who comes here into Sherwood Forest without my pass?" - -"Guy of Guisborne wants no man's pass. Who art thou that--that--" - -"Dares to hold such language," said Tom, prompting--for they talked -"by the book," from memory. - -"Who art thou that dares to hold such language?" - -"I, indeed! I am Robin Hood, as thy caitiff carcase soon shall know." - -"Then art thou indeed that famous outlaw? Right gladly will I dispute -with thee the passes of the merry wood. Have at thee!" - -They took their lath swords, dumped their other traps on the ground, -struck a fencing attitude, foot to foot, and began a grave, careful -combat, "two up and two down." Presently Tom said: - -"Now, if you've got the hang, go it lively!" - -So they "went it lively," panting and perspiring with the work. By and -by Tom shouted: - -"Fall! fall! Why don't you fall?" - -"I sha'n't! Why don't you fall yourself? You're getting the worst of -it." - -"Why, that ain't anything. I can't fall; that ain't the way it is in -the book. The book says, 'Then with one back-handed stroke he slew poor -Guy of Guisborne.' You're to turn around and let me hit you in the -back." - -There was no getting around the authorities, so Joe turned, received -the whack and fell. - -"Now," said Joe, getting up, "you got to let me kill YOU. That's fair." - -"Why, I can't do that, it ain't in the book." - -"Well, it's blamed mean--that's all." - -"Well, say, Joe, you can be Friar Tuck or Much the miller's son, and -lam me with a quarter-staff; or I'll be the Sheriff of Nottingham and -you be Robin Hood a little while and kill me." - -This was satisfactory, and so these adventures were carried out. Then -Tom became Robin Hood again, and was allowed by the treacherous nun to -bleed his strength away through his neglected wound. And at last Joe, -representing a whole tribe of weeping outlaws, dragged him sadly forth, -gave his bow into his feeble hands, and Tom said, "Where this arrow -falls, there bury poor Robin Hood under the greenwood tree." Then he -shot the arrow and fell back and would have died, but he lit on a -nettle and sprang up too gaily for a corpse. - -The boys dressed themselves, hid their accoutrements, and went off -grieving that there were no outlaws any more, and wondering what modern -civilization could claim to have done to compensate for their loss. -They said they would rather be outlaws a year in Sherwood Forest than -President of the United States forever. - - - -CHAPTER IX - -AT half-past nine, that night, Tom and Sid were sent to bed, as usual. -They said their prayers, and Sid was soon asleep. Tom lay awake and -waited, in restless impatience. When it seemed to him that it must be -nearly daylight, he heard the clock strike ten! This was despair. He -would have tossed and fidgeted, as his nerves demanded, but he was -afraid he might wake Sid. So he lay still, and stared up into the dark. -Everything was dismally still. By and by, out of the stillness, little, -scarcely perceptible noises began to emphasize themselves. The ticking -of the clock began to bring itself into notice. Old beams began to -crack mysteriously. The stairs creaked faintly. Evidently spirits were -abroad. A measured, muffled snore issued from Aunt Polly's chamber. And -now the tiresome chirping of a cricket that no human ingenuity could -locate, began. Next the ghastly ticking of a deathwatch in the wall at -the bed's head made Tom shudder--it meant that somebody's days were -numbered. Then the howl of a far-off dog rose on the night air, and was -answered by a fainter howl from a remoter distance. Tom was in an -agony. At last he was satisfied that time had ceased and eternity -begun; he began to doze, in spite of himself; the clock chimed eleven, -but he did not hear it. And then there came, mingling with his -half-formed dreams, a most melancholy caterwauling. The raising of a -neighboring window disturbed him. A cry of "Scat! you devil!" and the -crash of an empty bottle against the back of his aunt's woodshed -brought him wide awake, and a single minute later he was dressed and -out of the window and creeping along the roof of the "ell" on all -fours. He "meow'd" with caution once or twice, as he went; then jumped -to the roof of the woodshed and thence to the ground. Huckleberry Finn -was there, with his dead cat. The boys moved off and disappeared in the -gloom. At the end of half an hour they were wading through the tall -grass of the graveyard. - -It was a graveyard of the old-fashioned Western kind. It was on a -hill, about a mile and a half from the village. It had a crazy board -fence around it, which leaned inward in places, and outward the rest of -the time, but stood upright nowhere. Grass and weeds grew rank over the -whole cemetery. All the old graves were sunken in, there was not a -tombstone on the place; round-topped, worm-eaten boards staggered over -the graves, leaning for support and finding none. "Sacred to the memory -of" So-and-So had been painted on them once, but it could no longer -have been read, on the most of them, now, even if there had been light. - -A faint wind moaned through the trees, and Tom feared it might be the -spirits of the dead, complaining at being disturbed. The boys talked -little, and only under their breath, for the time and the place and the -pervading solemnity and silence oppressed their spirits. They found the -sharp new heap they were seeking, and ensconced themselves within the -protection of three great elms that grew in a bunch within a few feet -of the grave. - -Then they waited in silence for what seemed a long time. The hooting -of a distant owl was all the sound that troubled the dead stillness. -Tom's reflections grew oppressive. He must force some talk. So he said -in a whisper: - -"Hucky, do you believe the dead people like it for us to be here?" - -Huckleberry whispered: - -"I wisht I knowed. It's awful solemn like, AIN'T it?" - -"I bet it is." - -There was a considerable pause, while the boys canvassed this matter -inwardly. Then Tom whispered: - -"Say, Hucky--do you reckon Hoss Williams hears us talking?" - -"O' course he does. Least his sperrit does." - -Tom, after a pause: - -"I wish I'd said Mister Williams. But I never meant any harm. -Everybody calls him Hoss." - -"A body can't be too partic'lar how they talk 'bout these-yer dead -people, Tom." - -This was a damper, and conversation died again. - -Presently Tom seized his comrade's arm and said: - -"Sh!" - -"What is it, Tom?" And the two clung together with beating hearts. - -"Sh! There 'tis again! Didn't you hear it?" - -"I--" - -"There! Now you hear it." - -"Lord, Tom, they're coming! They're coming, sure. What'll we do?" - -"I dono. Think they'll see us?" - -"Oh, Tom, they can see in the dark, same as cats. I wisht I hadn't -come." - -"Oh, don't be afeard. I don't believe they'll bother us. We ain't -doing any harm. If we keep perfectly still, maybe they won't notice us -at all." - -"I'll try to, Tom, but, Lord, I'm all of a shiver." - -"Listen!" - -The boys bent their heads together and scarcely breathed. A muffled -sound of voices floated up from the far end of the graveyard. - -"Look! See there!" whispered Tom. "What is it?" - -"It's devil-fire. Oh, Tom, this is awful." - -Some vague figures approached through the gloom, swinging an -old-fashioned tin lantern that freckled the ground with innumerable -little spangles of light. Presently Huckleberry whispered with a -shudder: - -"It's the devils sure enough. Three of 'em! Lordy, Tom, we're goners! -Can you pray?" - -"I'll try, but don't you be afeard. They ain't going to hurt us. 'Now -I lay me down to sleep, I--'" - -"Sh!" - -"What is it, Huck?" - -"They're HUMANS! One of 'em is, anyway. One of 'em's old Muff Potter's -voice." - -"No--'tain't so, is it?" - -"I bet I know it. Don't you stir nor budge. He ain't sharp enough to -notice us. Drunk, the same as usual, likely--blamed old rip!" - -"All right, I'll keep still. Now they're stuck. Can't find it. Here -they come again. Now they're hot. Cold again. Hot again. Red hot! -They're p'inted right, this time. Say, Huck, I know another o' them -voices; it's Injun Joe." - -"That's so--that murderin' half-breed! I'd druther they was devils a -dern sight. What kin they be up to?" - -The whisper died wholly out, now, for the three men had reached the -grave and stood within a few feet of the boys' hiding-place. - -"Here it is," said the third voice; and the owner of it held the -lantern up and revealed the face of young Doctor Robinson. - -Potter and Injun Joe were carrying a handbarrow with a rope and a -couple of shovels on it. They cast down their load and began to open -the grave. The doctor put the lantern at the head of the grave and came -and sat down with his back against one of the elm trees. He was so -close the boys could have touched him. - -"Hurry, men!" he said, in a low voice; "the moon might come out at any -moment." - -They growled a response and went on digging. For some time there was -no noise but the grating sound of the spades discharging their freight -of mould and gravel. It was very monotonous. Finally a spade struck -upon the coffin with a dull woody accent, and within another minute or -two the men had hoisted it out on the ground. They pried off the lid -with their shovels, got out the body and dumped it rudely on the -ground. The moon drifted from behind the clouds and exposed the pallid -face. The barrow was got ready and the corpse placed on it, covered -with a blanket, and bound to its place with the rope. Potter took out a -large spring-knife and cut off the dangling end of the rope and then -said: - -"Now the cussed thing's ready, Sawbones, and you'll just out with -another five, or here she stays." - -"That's the talk!" said Injun Joe. - -"Look here, what does this mean?" said the doctor. "You required your -pay in advance, and I've paid you." - -"Yes, and you done more than that," said Injun Joe, approaching the -doctor, who was now standing. "Five years ago you drove me away from -your father's kitchen one night, when I come to ask for something to -eat, and you said I warn't there for any good; and when I swore I'd get -even with you if it took a hundred years, your father had me jailed for -a vagrant. Did you think I'd forget? The Injun blood ain't in me for -nothing. And now I've GOT you, and you got to SETTLE, you know!" - -He was threatening the doctor, with his fist in his face, by this -time. The doctor struck out suddenly and stretched the ruffian on the -ground. Potter dropped his knife, and exclaimed: - -"Here, now, don't you hit my pard!" and the next moment he had -grappled with the doctor and the two were struggling with might and -main, trampling the grass and tearing the ground with their heels. -Injun Joe sprang to his feet, his eyes flaming with passion, snatched -up Potter's knife, and went creeping, catlike and stooping, round and -round about the combatants, seeking an opportunity. All at once the -doctor flung himself free, seized the heavy headboard of Williams' -grave and felled Potter to the earth with it--and in the same instant -the half-breed saw his chance and drove the knife to the hilt in the -young man's breast. He reeled and fell partly upon Potter, flooding him -with his blood, and in the same moment the clouds blotted out the -dreadful spectacle and the two frightened boys went speeding away in -the dark. - -Presently, when the moon emerged again, Injun Joe was standing over -the two forms, contemplating them. The doctor murmured inarticulately, -gave a long gasp or two and was still. The half-breed muttered: - -"THAT score is settled--damn you." - -Then he robbed the body. After which he put the fatal knife in -Potter's open right hand, and sat down on the dismantled coffin. Three ---four--five minutes passed, and then Potter began to stir and moan. His -hand closed upon the knife; he raised it, glanced at it, and let it -fall, with a shudder. Then he sat up, pushing the body from him, and -gazed at it, and then around him, confusedly. His eyes met Joe's. - -"Lord, how is this, Joe?" he said. - -"It's a dirty business," said Joe, without moving. - -"What did you do it for?" - -"I! I never done it!" - -"Look here! That kind of talk won't wash." - -Potter trembled and grew white. - -"I thought I'd got sober. I'd no business to drink to-night. But it's -in my head yet--worse'n when we started here. I'm all in a muddle; -can't recollect anything of it, hardly. Tell me, Joe--HONEST, now, old -feller--did I do it? Joe, I never meant to--'pon my soul and honor, I -never meant to, Joe. Tell me how it was, Joe. Oh, it's awful--and him -so young and promising." - -"Why, you two was scuffling, and he fetched you one with the headboard -and you fell flat; and then up you come, all reeling and staggering -like, and snatched the knife and jammed it into him, just as he fetched -you another awful clip--and here you've laid, as dead as a wedge til -now." - -"Oh, I didn't know what I was a-doing. I wish I may die this minute if -I did. It was all on account of the whiskey and the excitement, I -reckon. I never used a weepon in my life before, Joe. I've fought, but -never with weepons. They'll all say that. Joe, don't tell! Say you -won't tell, Joe--that's a good feller. I always liked you, Joe, and -stood up for you, too. Don't you remember? You WON'T tell, WILL you, -Joe?" And the poor creature dropped on his knees before the stolid -murderer, and clasped his appealing hands. - -"No, you've always been fair and square with me, Muff Potter, and I -won't go back on you. There, now, that's as fair as a man can say." - -"Oh, Joe, you're an angel. I'll bless you for this the longest day I -live." And Potter began to cry. - -"Come, now, that's enough of that. This ain't any time for blubbering. -You be off yonder way and I'll go this. Move, now, and don't leave any -tracks behind you." - -Potter started on a trot that quickly increased to a run. The -half-breed stood looking after him. He muttered: - -"If he's as much stunned with the lick and fuddled with the rum as he -had the look of being, he won't think of the knife till he's gone so -far he'll be afraid to come back after it to such a place by himself ---chicken-heart!" - -Two or three minutes later the murdered man, the blanketed corpse, the -lidless coffin, and the open grave were under no inspection but the -moon's. The stillness was complete again, too. - - - -CHAPTER X - -THE two boys flew on and on, toward the village, speechless with -horror. They glanced backward over their shoulders from time to time, -apprehensively, as if they feared they might be followed. Every stump -that started up in their path seemed a man and an enemy, and made them -catch their breath; and as they sped by some outlying cottages that lay -near the village, the barking of the aroused watch-dogs seemed to give -wings to their feet. - -"If we can only get to the old tannery before we break down!" -whispered Tom, in short catches between breaths. "I can't stand it much -longer." - -Huckleberry's hard pantings were his only reply, and the boys fixed -their eyes on the goal of their hopes and bent to their work to win it. -They gained steadily on it, and at last, breast to breast, they burst -through the open door and fell grateful and exhausted in the sheltering -shadows beyond. By and by their pulses slowed down, and Tom whispered: - -"Huckleberry, what do you reckon'll come of this?" - -"If Doctor Robinson dies, I reckon hanging'll come of it." - -"Do you though?" - -"Why, I KNOW it, Tom." - -Tom thought a while, then he said: - -"Who'll tell? We?" - -"What are you talking about? S'pose something happened and Injun Joe -DIDN'T hang? Why, he'd kill us some time or other, just as dead sure as -we're a laying here." - -"That's just what I was thinking to myself, Huck." - -"If anybody tells, let Muff Potter do it, if he's fool enough. He's -generally drunk enough." - -Tom said nothing--went on thinking. Presently he whispered: - -"Huck, Muff Potter don't know it. How can he tell?" - -"What's the reason he don't know it?" - -"Because he'd just got that whack when Injun Joe done it. D'you reckon -he could see anything? D'you reckon he knowed anything?" - -"By hokey, that's so, Tom!" - -"And besides, look-a-here--maybe that whack done for HIM!" - -"No, 'taint likely, Tom. He had liquor in him; I could see that; and -besides, he always has. Well, when pap's full, you might take and belt -him over the head with a church and you couldn't phase him. He says so, -his own self. So it's the same with Muff Potter, of course. But if a -man was dead sober, I reckon maybe that whack might fetch him; I dono." - -After another reflective silence, Tom said: - -"Hucky, you sure you can keep mum?" - -"Tom, we GOT to keep mum. You know that. That Injun devil wouldn't -make any more of drownding us than a couple of cats, if we was to -squeak 'bout this and they didn't hang him. Now, look-a-here, Tom, less -take and swear to one another--that's what we got to do--swear to keep -mum." - -"I'm agreed. It's the best thing. Would you just hold hands and swear -that we--" - -"Oh no, that wouldn't do for this. That's good enough for little -rubbishy common things--specially with gals, cuz THEY go back on you -anyway, and blab if they get in a huff--but there orter be writing -'bout a big thing like this. And blood." - -Tom's whole being applauded this idea. It was deep, and dark, and -awful; the hour, the circumstances, the surroundings, were in keeping -with it. He picked up a clean pine shingle that lay in the moonlight, -took a little fragment of "red keel" out of his pocket, got the moon on -his work, and painfully scrawled these lines, emphasizing each slow -down-stroke by clamping his tongue between his teeth, and letting up -the pressure on the up-strokes. [See next page.] - - "Huck Finn and - Tom Sawyer swears - they will keep mum - about This and They - wish They may Drop - down dead in Their - Tracks if They ever - Tell and Rot." - -Huckleberry was filled with admiration of Tom's facility in writing, -and the sublimity of his language. He at once took a pin from his lapel -and was going to prick his flesh, but Tom said: - -"Hold on! Don't do that. A pin's brass. It might have verdigrease on -it." - -"What's verdigrease?" - -"It's p'ison. That's what it is. You just swaller some of it once ---you'll see." - -So Tom unwound the thread from one of his needles, and each boy -pricked the ball of his thumb and squeezed out a drop of blood. In -time, after many squeezes, Tom managed to sign his initials, using the -ball of his little finger for a pen. Then he showed Huckleberry how to -make an H and an F, and the oath was complete. They buried the shingle -close to the wall, with some dismal ceremonies and incantations, and -the fetters that bound their tongues were considered to be locked and -the key thrown away. - -A figure crept stealthily through a break in the other end of the -ruined building, now, but they did not notice it. - -"Tom," whispered Huckleberry, "does this keep us from EVER telling ---ALWAYS?" - -"Of course it does. It don't make any difference WHAT happens, we got -to keep mum. We'd drop down dead--don't YOU know that?" - -"Yes, I reckon that's so." - -They continued to whisper for some little time. Presently a dog set up -a long, lugubrious howl just outside--within ten feet of them. The boys -clasped each other suddenly, in an agony of fright. - -"Which of us does he mean?" gasped Huckleberry. - -"I dono--peep through the crack. Quick!" - -"No, YOU, Tom!" - -"I can't--I can't DO it, Huck!" - -"Please, Tom. There 'tis again!" - -"Oh, lordy, I'm thankful!" whispered Tom. "I know his voice. It's Bull -Harbison." * - -[* If Mr. Harbison owned a slave named Bull, Tom would have spoken of -him as "Harbison's Bull," but a son or a dog of that name was "Bull -Harbison."] - -"Oh, that's good--I tell you, Tom, I was most scared to death; I'd a -bet anything it was a STRAY dog." - -The dog howled again. The boys' hearts sank once more. - -"Oh, my! that ain't no Bull Harbison!" whispered Huckleberry. "DO, Tom!" - -Tom, quaking with fear, yielded, and put his eye to the crack. His -whisper was hardly audible when he said: - -"Oh, Huck, IT S A STRAY DOG!" - -"Quick, Tom, quick! Who does he mean?" - -"Huck, he must mean us both--we're right together." - -"Oh, Tom, I reckon we're goners. I reckon there ain't no mistake 'bout -where I'LL go to. I been so wicked." - -"Dad fetch it! This comes of playing hookey and doing everything a -feller's told NOT to do. I might a been good, like Sid, if I'd a tried ---but no, I wouldn't, of course. But if ever I get off this time, I lay -I'll just WALLER in Sunday-schools!" And Tom began to snuffle a little. - -"YOU bad!" and Huckleberry began to snuffle too. "Consound it, Tom -Sawyer, you're just old pie, 'longside o' what I am. Oh, LORDY, lordy, -lordy, I wisht I only had half your chance." - -Tom choked off and whispered: - -"Look, Hucky, look! He's got his BACK to us!" - -Hucky looked, with joy in his heart. - -"Well, he has, by jingoes! Did he before?" - -"Yes, he did. But I, like a fool, never thought. Oh, this is bully, -you know. NOW who can he mean?" - -The howling stopped. Tom pricked up his ears. - -"Sh! What's that?" he whispered. - -"Sounds like--like hogs grunting. No--it's somebody snoring, Tom." - -"That IS it! Where 'bouts is it, Huck?" - -"I bleeve it's down at 'tother end. Sounds so, anyway. Pap used to -sleep there, sometimes, 'long with the hogs, but laws bless you, he -just lifts things when HE snores. Besides, I reckon he ain't ever -coming back to this town any more." - -The spirit of adventure rose in the boys' souls once more. - -"Hucky, do you das't to go if I lead?" - -"I don't like to, much. Tom, s'pose it's Injun Joe!" - -Tom quailed. But presently the temptation rose up strong again and the -boys agreed to try, with the understanding that they would take to -their heels if the snoring stopped. So they went tiptoeing stealthily -down, the one behind the other. When they had got to within five steps -of the snorer, Tom stepped on a stick, and it broke with a sharp snap. -The man moaned, writhed a little, and his face came into the moonlight. -It was Muff Potter. The boys' hearts had stood still, and their hopes -too, when the man moved, but their fears passed away now. They tiptoed -out, through the broken weather-boarding, and stopped at a little -distance to exchange a parting word. That long, lugubrious howl rose on -the night air again! They turned and saw the strange dog standing -within a few feet of where Potter was lying, and FACING Potter, with -his nose pointing heavenward. - -"Oh, geeminy, it's HIM!" exclaimed both boys, in a breath. - -"Say, Tom--they say a stray dog come howling around Johnny Miller's -house, 'bout midnight, as much as two weeks ago; and a whippoorwill -come in and lit on the banisters and sung, the very same evening; and -there ain't anybody dead there yet." - -"Well, I know that. And suppose there ain't. Didn't Gracie Miller fall -in the kitchen fire and burn herself terrible the very next Saturday?" - -"Yes, but she ain't DEAD. And what's more, she's getting better, too." - -"All right, you wait and see. She's a goner, just as dead sure as Muff -Potter's a goner. That's what the niggers say, and they know all about -these kind of things, Huck." - -Then they separated, cogitating. When Tom crept in at his bedroom -window the night was almost spent. He undressed with excessive caution, -and fell asleep congratulating himself that nobody knew of his -escapade. He was not aware that the gently-snoring Sid was awake, and -had been so for an hour. - -When Tom awoke, Sid was dressed and gone. There was a late look in the -light, a late sense in the atmosphere. He was startled. Why had he not -been called--persecuted till he was up, as usual? The thought filled -him with bodings. Within five minutes he was dressed and down-stairs, -feeling sore and drowsy. The family were still at table, but they had -finished breakfast. There was no voice of rebuke; but there were -averted eyes; there was a silence and an air of solemnity that struck a -chill to the culprit's heart. He sat down and tried to seem gay, but it -was up-hill work; it roused no smile, no response, and he lapsed into -silence and let his heart sink down to the depths. - -After breakfast his aunt took him aside, and Tom almost brightened in -the hope that he was going to be flogged; but it was not so. His aunt -wept over him and asked him how he could go and break her old heart so; -and finally told him to go on, and ruin himself and bring her gray -hairs with sorrow to the grave, for it was no use for her to try any -more. This was worse than a thousand whippings, and Tom's heart was -sorer now than his body. He cried, he pleaded for forgiveness, promised -to reform over and over again, and then received his dismissal, feeling -that he had won but an imperfect forgiveness and established but a -feeble confidence. - -He left the presence too miserable to even feel revengeful toward Sid; -and so the latter's prompt retreat through the back gate was -unnecessary. He moped to school gloomy and sad, and took his flogging, -along with Joe Harper, for playing hookey the day before, with the air -of one whose heart was busy with heavier woes and wholly dead to -trifles. Then he betook himself to his seat, rested his elbows on his -desk and his jaws in his hands, and stared at the wall with the stony -stare of suffering that has reached the limit and can no further go. -His elbow was pressing against some hard substance. After a long time -he slowly and sadly changed his position, and took up this object with -a sigh. It was in a paper. He unrolled it. A long, lingering, colossal -sigh followed, and his heart broke. It was his brass andiron knob! - -This final feather broke the camel's back. - - - -CHAPTER XI - -CLOSE upon the hour of noon the whole village was suddenly electrified -with the ghastly news. No need of the as yet undreamed-of telegraph; -the tale flew from man to man, from group to group, from house to -house, with little less than telegraphic speed. Of course the -schoolmaster gave holiday for that afternoon; the town would have -thought strangely of him if he had not. - -A gory knife had been found close to the murdered man, and it had been -recognized by somebody as belonging to Muff Potter--so the story ran. -And it was said that a belated citizen had come upon Potter washing -himself in the "branch" about one or two o'clock in the morning, and -that Potter had at once sneaked off--suspicious circumstances, -especially the washing which was not a habit with Potter. It was also -said that the town had been ransacked for this "murderer" (the public -are not slow in the matter of sifting evidence and arriving at a -verdict), but that he could not be found. Horsemen had departed down -all the roads in every direction, and the Sheriff "was confident" that -he would be captured before night. - -All the town was drifting toward the graveyard. Tom's heartbreak -vanished and he joined the procession, not because he would not a -thousand times rather go anywhere else, but because an awful, -unaccountable fascination drew him on. Arrived at the dreadful place, -he wormed his small body through the crowd and saw the dismal -spectacle. It seemed to him an age since he was there before. Somebody -pinched his arm. He turned, and his eyes met Huckleberry's. Then both -looked elsewhere at once, and wondered if anybody had noticed anything -in their mutual glance. But everybody was talking, and intent upon the -grisly spectacle before them. - -"Poor fellow!" "Poor young fellow!" "This ought to be a lesson to -grave robbers!" "Muff Potter'll hang for this if they catch him!" This -was the drift of remark; and the minister said, "It was a judgment; His -hand is here." - -Now Tom shivered from head to heel; for his eye fell upon the stolid -face of Injun Joe. At this moment the crowd began to sway and struggle, -and voices shouted, "It's him! it's him! he's coming himself!" - -"Who? Who?" from twenty voices. - -"Muff Potter!" - -"Hallo, he's stopped!--Look out, he's turning! Don't let him get away!" - -People in the branches of the trees over Tom's head said he wasn't -trying to get away--he only looked doubtful and perplexed. - -"Infernal impudence!" said a bystander; "wanted to come and take a -quiet look at his work, I reckon--didn't expect any company." - -The crowd fell apart, now, and the Sheriff came through, -ostentatiously leading Potter by the arm. The poor fellow's face was -haggard, and his eyes showed the fear that was upon him. When he stood -before the murdered man, he shook as with a palsy, and he put his face -in his hands and burst into tears. - -"I didn't do it, friends," he sobbed; "'pon my word and honor I never -done it." - -"Who's accused you?" shouted a voice. - -This shot seemed to carry home. Potter lifted his face and looked -around him with a pathetic hopelessness in his eyes. He saw Injun Joe, -and exclaimed: - -"Oh, Injun Joe, you promised me you'd never--" - -"Is that your knife?" and it was thrust before him by the Sheriff. - -Potter would have fallen if they had not caught him and eased him to -the ground. Then he said: - -"Something told me 't if I didn't come back and get--" He shuddered; -then waved his nerveless hand with a vanquished gesture and said, "Tell -'em, Joe, tell 'em--it ain't any use any more." - -Then Huckleberry and Tom stood dumb and staring, and heard the -stony-hearted liar reel off his serene statement, they expecting every -moment that the clear sky would deliver God's lightnings upon his head, -and wondering to see how long the stroke was delayed. And when he had -finished and still stood alive and whole, their wavering impulse to -break their oath and save the poor betrayed prisoner's life faded and -vanished away, for plainly this miscreant had sold himself to Satan and -it would be fatal to meddle with the property of such a power as that. - -"Why didn't you leave? What did you want to come here for?" somebody -said. - -"I couldn't help it--I couldn't help it," Potter moaned. "I wanted to -run away, but I couldn't seem to come anywhere but here." And he fell -to sobbing again. - -Injun Joe repeated his statement, just as calmly, a few minutes -afterward on the inquest, under oath; and the boys, seeing that the -lightnings were still withheld, were confirmed in their belief that Joe -had sold himself to the devil. He was now become, to them, the most -balefully interesting object they had ever looked upon, and they could -not take their fascinated eyes from his face. - -They inwardly resolved to watch him nights, when opportunity should -offer, in the hope of getting a glimpse of his dread master. - -Injun Joe helped to raise the body of the murdered man and put it in a -wagon for removal; and it was whispered through the shuddering crowd -that the wound bled a little! The boys thought that this happy -circumstance would turn suspicion in the right direction; but they were -disappointed, for more than one villager remarked: - -"It was within three feet of Muff Potter when it done it." - -Tom's fearful secret and gnawing conscience disturbed his sleep for as -much as a week after this; and at breakfast one morning Sid said: - -"Tom, you pitch around and talk in your sleep so much that you keep me -awake half the time." - -Tom blanched and dropped his eyes. - -"It's a bad sign," said Aunt Polly, gravely. "What you got on your -mind, Tom?" - -"Nothing. Nothing 't I know of." But the boy's hand shook so that he -spilled his coffee. - -"And you do talk such stuff," Sid said. "Last night you said, 'It's -blood, it's blood, that's what it is!' You said that over and over. And -you said, 'Don't torment me so--I'll tell!' Tell WHAT? What is it -you'll tell?" - -Everything was swimming before Tom. There is no telling what might -have happened, now, but luckily the concern passed out of Aunt Polly's -face and she came to Tom's relief without knowing it. She said: - -"Sho! It's that dreadful murder. I dream about it most every night -myself. Sometimes I dream it's me that done it." - -Mary said she had been affected much the same way. Sid seemed -satisfied. Tom got out of the presence as quick as he plausibly could, -and after that he complained of toothache for a week, and tied up his -jaws every night. He never knew that Sid lay nightly watching, and -frequently slipped the bandage free and then leaned on his elbow -listening a good while at a time, and afterward slipped the bandage -back to its place again. Tom's distress of mind wore off gradually and -the toothache grew irksome and was discarded. If Sid really managed to -make anything out of Tom's disjointed mutterings, he kept it to himself. - -It seemed to Tom that his schoolmates never would get done holding -inquests on dead cats, and thus keeping his trouble present to his -mind. Sid noticed that Tom never was coroner at one of these inquiries, -though it had been his habit to take the lead in all new enterprises; -he noticed, too, that Tom never acted as a witness--and that was -strange; and Sid did not overlook the fact that Tom even showed a -marked aversion to these inquests, and always avoided them when he -could. Sid marvelled, but said nothing. However, even inquests went out -of vogue at last, and ceased to torture Tom's conscience. - -Every day or two, during this time of sorrow, Tom watched his -opportunity and went to the little grated jail-window and smuggled such -small comforts through to the "murderer" as he could get hold of. The -jail was a trifling little brick den that stood in a marsh at the edge -of the village, and no guards were afforded for it; indeed, it was -seldom occupied. These offerings greatly helped to ease Tom's -conscience. - -The villagers had a strong desire to tar-and-feather Injun Joe and -ride him on a rail, for body-snatching, but so formidable was his -character that nobody could be found who was willing to take the lead -in the matter, so it was dropped. He had been careful to begin both of -his inquest-statements with the fight, without confessing the -grave-robbery that preceded it; therefore it was deemed wisest not -to try the case in the courts at present. - - - -CHAPTER XII - -ONE of the reasons why Tom's mind had drifted away from its secret -troubles was, that it had found a new and weighty matter to interest -itself about. Becky Thatcher had stopped coming to school. Tom had -struggled with his pride a few days, and tried to "whistle her down the -wind," but failed. He began to find himself hanging around her father's -house, nights, and feeling very miserable. She was ill. What if she -should die! There was distraction in the thought. He no longer took an -interest in war, nor even in piracy. The charm of life was gone; there -was nothing but dreariness left. He put his hoop away, and his bat; -there was no joy in them any more. His aunt was concerned. She began to -try all manner of remedies on him. She was one of those people who are -infatuated with patent medicines and all new-fangled methods of -producing health or mending it. She was an inveterate experimenter in -these things. When something fresh in this line came out she was in a -fever, right away, to try it; not on herself, for she was never ailing, -but on anybody else that came handy. She was a subscriber for all the -"Health" periodicals and phrenological frauds; and the solemn ignorance -they were inflated with was breath to her nostrils. All the "rot" they -contained about ventilation, and how to go to bed, and how to get up, -and what to eat, and what to drink, and how much exercise to take, and -what frame of mind to keep one's self in, and what sort of clothing to -wear, was all gospel to her, and she never observed that her -health-journals of the current month customarily upset everything they -had recommended the month before. She was as simple-hearted and honest -as the day was long, and so she was an easy victim. She gathered -together her quack periodicals and her quack medicines, and thus armed -with death, went about on her pale horse, metaphorically speaking, with -"hell following after." But she never suspected that she was not an -angel of healing and the balm of Gilead in disguise, to the suffering -neighbors. - -The water treatment was new, now, and Tom's low condition was a -windfall to her. She had him out at daylight every morning, stood him -up in the woodshed and drowned him with a deluge of cold water; then -she scrubbed him down with a towel like a file, and so brought him to; -then she rolled him up in a wet sheet and put him away under blankets -till she sweated his soul clean and "the yellow stains of it came -through his pores"--as Tom said. - -Yet notwithstanding all this, the boy grew more and more melancholy -and pale and dejected. She added hot baths, sitz baths, shower baths, -and plunges. The boy remained as dismal as a hearse. She began to -assist the water with a slim oatmeal diet and blister-plasters. She -calculated his capacity as she would a jug's, and filled him up every -day with quack cure-alls. - -Tom had become indifferent to persecution by this time. This phase -filled the old lady's heart with consternation. This indifference must -be broken up at any cost. Now she heard of Pain-killer for the first -time. She ordered a lot at once. She tasted it and was filled with -gratitude. It was simply fire in a liquid form. She dropped the water -treatment and everything else, and pinned her faith to Pain-killer. She -gave Tom a teaspoonful and watched with the deepest anxiety for the -result. Her troubles were instantly at rest, her soul at peace again; -for the "indifference" was broken up. The boy could not have shown a -wilder, heartier interest, if she had built a fire under him. - -Tom felt that it was time to wake up; this sort of life might be -romantic enough, in his blighted condition, but it was getting to have -too little sentiment and too much distracting variety about it. So he -thought over various plans for relief, and finally hit pon that of -professing to be fond of Pain-killer. He asked for it so often that he -became a nuisance, and his aunt ended by telling him to help himself -and quit bothering her. If it had been Sid, she would have had no -misgivings to alloy her delight; but since it was Tom, she watched the -bottle clandestinely. She found that the medicine did really diminish, -but it did not occur to her that the boy was mending the health of a -crack in the sitting-room floor with it. - -One day Tom was in the act of dosing the crack when his aunt's yellow -cat came along, purring, eying the teaspoon avariciously, and begging -for a taste. Tom said: - -"Don't ask for it unless you want it, Peter." - -But Peter signified that he did want it. - -"You better make sure." - -Peter was sure. - -"Now you've asked for it, and I'll give it to you, because there ain't -anything mean about me; but if you find you don't like it, you mustn't -blame anybody but your own self." - -Peter was agreeable. So Tom pried his mouth open and poured down the -Pain-killer. Peter sprang a couple of yards in the air, and then -delivered a war-whoop and set off round and round the room, banging -against furniture, upsetting flower-pots, and making general havoc. -Next he rose on his hind feet and pranced around, in a frenzy of -enjoyment, with his head over his shoulder and his voice proclaiming -his unappeasable happiness. Then he went tearing around the house again -spreading chaos and destruction in his path. Aunt Polly entered in time -to see him throw a few double summersets, deliver a final mighty -hurrah, and sail through the open window, carrying the rest of the -flower-pots with him. The old lady stood petrified with astonishment, -peering over her glasses; Tom lay on the floor expiring with laughter. - -"Tom, what on earth ails that cat?" - -"I don't know, aunt," gasped the boy. - -"Why, I never see anything like it. What did make him act so?" - -"Deed I don't know, Aunt Polly; cats always act so when they're having -a good time." - -"They do, do they?" There was something in the tone that made Tom -apprehensive. - -"Yes'm. That is, I believe they do." - -"You DO?" - -"Yes'm." - -The old lady was bending down, Tom watching, with interest emphasized -by anxiety. Too late he divined her "drift." The handle of the telltale -teaspoon was visible under the bed-valance. Aunt Polly took it, held it -up. Tom winced, and dropped his eyes. Aunt Polly raised him by the -usual handle--his ear--and cracked his head soundly with her thimble. - -"Now, sir, what did you want to treat that poor dumb beast so, for?" - -"I done it out of pity for him--because he hadn't any aunt." - -"Hadn't any aunt!--you numskull. What has that got to do with it?" - -"Heaps. Because if he'd had one she'd a burnt him out herself! She'd a -roasted his bowels out of him 'thout any more feeling than if he was a -human!" - -Aunt Polly felt a sudden pang of remorse. This was putting the thing -in a new light; what was cruelty to a cat MIGHT be cruelty to a boy, -too. She began to soften; she felt sorry. Her eyes watered a little, -and she put her hand on Tom's head and said gently: - -"I was meaning for the best, Tom. And, Tom, it DID do you good." - -Tom looked up in her face with just a perceptible twinkle peeping -through his gravity. - -"I know you was meaning for the best, aunty, and so was I with Peter. -It done HIM good, too. I never see him get around so since--" - -"Oh, go 'long with you, Tom, before you aggravate me again. And you -try and see if you can't be a good boy, for once, and you needn't take -any more medicine." - -Tom reached school ahead of time. It was noticed that this strange -thing had been occurring every day latterly. And now, as usual of late, -he hung about the gate of the schoolyard instead of playing with his -comrades. He was sick, he said, and he looked it. He tried to seem to -be looking everywhere but whither he really was looking--down the road. -Presently Jeff Thatcher hove in sight, and Tom's face lighted; he gazed -a moment, and then turned sorrowfully away. When Jeff arrived, Tom -accosted him; and "led up" warily to opportunities for remark about -Becky, but the giddy lad never could see the bait. Tom watched and -watched, hoping whenever a frisking frock came in sight, and hating the -owner of it as soon as he saw she was not the right one. At last frocks -ceased to appear, and he dropped hopelessly into the dumps; he entered -the empty schoolhouse and sat down to suffer. Then one more frock -passed in at the gate, and Tom's heart gave a great bound. The next -instant he was out, and "going on" like an Indian; yelling, laughing, -chasing boys, jumping over the fence at risk of life and limb, throwing -handsprings, standing on his head--doing all the heroic things he could -conceive of, and keeping a furtive eye out, all the while, to see if -Becky Thatcher was noticing. But she seemed to be unconscious of it -all; she never looked. Could it be possible that she was not aware that -he was there? He carried his exploits to her immediate vicinity; came -war-whooping around, snatched a boy's cap, hurled it to the roof of the -schoolhouse, broke through a group of boys, tumbling them in every -direction, and fell sprawling, himself, under Becky's nose, almost -upsetting her--and she turned, with her nose in the air, and he heard -her say: "Mf! some people think they're mighty smart--always showing -off!" - -Tom's cheeks burned. He gathered himself up and sneaked off, crushed -and crestfallen. - - - -CHAPTER XIII - -TOM'S mind was made up now. He was gloomy and desperate. He was a -forsaken, friendless boy, he said; nobody loved him; when they found -out what they had driven him to, perhaps they would be sorry; he had -tried to do right and get along, but they would not let him; since -nothing would do them but to be rid of him, let it be so; and let them -blame HIM for the consequences--why shouldn't they? What right had the -friendless to complain? Yes, they had forced him to it at last: he -would lead a life of crime. There was no choice. - -By this time he was far down Meadow Lane, and the bell for school to -"take up" tinkled faintly upon his ear. He sobbed, now, to think he -should never, never hear that old familiar sound any more--it was very -hard, but it was forced on him; since he was driven out into the cold -world, he must submit--but he forgave them. Then the sobs came thick -and fast. - -Just at this point he met his soul's sworn comrade, Joe Harper ---hard-eyed, and with evidently a great and dismal purpose in his heart. -Plainly here were "two souls with but a single thought." Tom, wiping -his eyes with his sleeve, began to blubber out something about a -resolution to escape from hard usage and lack of sympathy at home by -roaming abroad into the great world never to return; and ended by -hoping that Joe would not forget him. - -But it transpired that this was a request which Joe had just been -going to make of Tom, and had come to hunt him up for that purpose. His -mother had whipped him for drinking some cream which he had never -tasted and knew nothing about; it was plain that she was tired of him -and wished him to go; if she felt that way, there was nothing for him -to do but succumb; he hoped she would be happy, and never regret having -driven her poor boy out into the unfeeling world to suffer and die. - -As the two boys walked sorrowing along, they made a new compact to -stand by each other and be brothers and never separate till death -relieved them of their troubles. Then they began to lay their plans. -Joe was for being a hermit, and living on crusts in a remote cave, and -dying, some time, of cold and want and grief; but after listening to -Tom, he conceded that there were some conspicuous advantages about a -life of crime, and so he consented to be a pirate. - -Three miles below St. Petersburg, at a point where the Mississippi -River was a trifle over a mile wide, there was a long, narrow, wooded -island, with a shallow bar at the head of it, and this offered well as -a rendezvous. It was not inhabited; it lay far over toward the further -shore, abreast a dense and almost wholly unpeopled forest. So Jackson's -Island was chosen. Who were to be the subjects of their piracies was a -matter that did not occur to them. Then they hunted up Huckleberry -Finn, and he joined them promptly, for all careers were one to him; he -was indifferent. They presently separated to meet at a lonely spot on -the river-bank two miles above the village at the favorite hour--which -was midnight. There was a small log raft there which they meant to -capture. Each would bring hooks and lines, and such provision as he -could steal in the most dark and mysterious way--as became outlaws. And -before the afternoon was done, they had all managed to enjoy the sweet -glory of spreading the fact that pretty soon the town would "hear -something." All who got this vague hint were cautioned to "be mum and -wait." - -About midnight Tom arrived with a boiled ham and a few trifles, -and stopped in a dense undergrowth on a small bluff overlooking the -meeting-place. It was starlight, and very still. The mighty river lay -like an ocean at rest. Tom listened a moment, but no sound disturbed the -quiet. Then he gave a low, distinct whistle. It was answered from under -the bluff. Tom whistled twice more; these signals were answered in the -same way. Then a guarded voice said: - -"Who goes there?" - -"Tom Sawyer, the Black Avenger of the Spanish Main. Name your names." - -"Huck Finn the Red-Handed, and Joe Harper the Terror of the Seas." Tom -had furnished these titles, from his favorite literature. - -"'Tis well. Give the countersign." - -Two hoarse whispers delivered the same awful word simultaneously to -the brooding night: - -"BLOOD!" - -Then Tom tumbled his ham over the bluff and let himself down after it, -tearing both skin and clothes to some extent in the effort. There was -an easy, comfortable path along the shore under the bluff, but it -lacked the advantages of difficulty and danger so valued by a pirate. - -The Terror of the Seas had brought a side of bacon, and had about worn -himself out with getting it there. Finn the Red-Handed had stolen a -skillet and a quantity of half-cured leaf tobacco, and had also brought -a few corn-cobs to make pipes with. But none of the pirates smoked or -"chewed" but himself. The Black Avenger of the Spanish Main said it -would never do to start without some fire. That was a wise thought; -matches were hardly known there in that day. They saw a fire -smouldering upon a great raft a hundred yards above, and they went -stealthily thither and helped themselves to a chunk. They made an -imposing adventure of it, saying, "Hist!" every now and then, and -suddenly halting with finger on lip; moving with hands on imaginary -dagger-hilts; and giving orders in dismal whispers that if "the foe" -stirred, to "let him have it to the hilt," because "dead men tell no -tales." They knew well enough that the raftsmen were all down at the -village laying in stores or having a spree, but still that was no -excuse for their conducting this thing in an unpiratical way. - -They shoved off, presently, Tom in command, Huck at the after oar and -Joe at the forward. Tom stood amidships, gloomy-browed, and with folded -arms, and gave his orders in a low, stern whisper: - -"Luff, and bring her to the wind!" - -"Aye-aye, sir!" - -"Steady, steady-y-y-y!" - -"Steady it is, sir!" - -"Let her go off a point!" - -"Point it is, sir!" - -As the boys steadily and monotonously drove the raft toward mid-stream -it was no doubt understood that these orders were given only for -"style," and were not intended to mean anything in particular. - -"What sail's she carrying?" - -"Courses, tops'ls, and flying-jib, sir." - -"Send the r'yals up! Lay out aloft, there, half a dozen of ye ---foretopmaststuns'l! Lively, now!" - -"Aye-aye, sir!" - -"Shake out that maintogalans'l! Sheets and braces! NOW my hearties!" - -"Aye-aye, sir!" - -"Hellum-a-lee--hard a port! Stand by to meet her when she comes! Port, -port! NOW, men! With a will! Stead-y-y-y!" - -"Steady it is, sir!" - -The raft drew beyond the middle of the river; the boys pointed her -head right, and then lay on their oars. The river was not high, so -there was not more than a two or three mile current. Hardly a word was -said during the next three-quarters of an hour. Now the raft was -passing before the distant town. Two or three glimmering lights showed -where it lay, peacefully sleeping, beyond the vague vast sweep of -star-gemmed water, unconscious of the tremendous event that was happening. -The Black Avenger stood still with folded arms, "looking his last" upon -the scene of his former joys and his later sufferings, and wishing -"she" could see him now, abroad on the wild sea, facing peril and death -with dauntless heart, going to his doom with a grim smile on his lips. -It was but a small strain on his imagination to remove Jackson's Island -beyond eyeshot of the village, and so he "looked his last" with a -broken and satisfied heart. The other pirates were looking their last, -too; and they all looked so long that they came near letting the -current drift them out of the range of the island. But they discovered -the danger in time, and made shift to avert it. About two o'clock in -the morning the raft grounded on the bar two hundred yards above the -head of the island, and they waded back and forth until they had landed -their freight. Part of the little raft's belongings consisted of an old -sail, and this they spread over a nook in the bushes for a tent to -shelter their provisions; but they themselves would sleep in the open -air in good weather, as became outlaws. - -They built a fire against the side of a great log twenty or thirty -steps within the sombre depths of the forest, and then cooked some -bacon in the frying-pan for supper, and used up half of the corn "pone" -stock they had brought. It seemed glorious sport to be feasting in that -wild, free way in the virgin forest of an unexplored and uninhabited -island, far from the haunts of men, and they said they never would -return to civilization. The climbing fire lit up their faces and threw -its ruddy glare upon the pillared tree-trunks of their forest temple, -and upon the varnished foliage and festooning vines. - -When the last crisp slice of bacon was gone, and the last allowance of -corn pone devoured, the boys stretched themselves out on the grass, -filled with contentment. They could have found a cooler place, but they -would not deny themselves such a romantic feature as the roasting -camp-fire. - -"AIN'T it gay?" said Joe. - -"It's NUTS!" said Tom. "What would the boys say if they could see us?" - -"Say? Well, they'd just die to be here--hey, Hucky!" - -"I reckon so," said Huckleberry; "anyways, I'm suited. I don't want -nothing better'n this. I don't ever get enough to eat, gen'ally--and -here they can't come and pick at a feller and bullyrag him so." - -"It's just the life for me," said Tom. "You don't have to get up, -mornings, and you don't have to go to school, and wash, and all that -blame foolishness. You see a pirate don't have to do ANYTHING, Joe, -when he's ashore, but a hermit HE has to be praying considerable, and -then he don't have any fun, anyway, all by himself that way." - -"Oh yes, that's so," said Joe, "but I hadn't thought much about it, -you know. I'd a good deal rather be a pirate, now that I've tried it." - -"You see," said Tom, "people don't go much on hermits, nowadays, like -they used to in old times, but a pirate's always respected. And a -hermit's got to sleep on the hardest place he can find, and put -sackcloth and ashes on his head, and stand out in the rain, and--" - -"What does he put sackcloth and ashes on his head for?" inquired Huck. - -"I dono. But they've GOT to do it. Hermits always do. You'd have to do -that if you was a hermit." - -"Dern'd if I would," said Huck. - -"Well, what would you do?" - -"I dono. But I wouldn't do that." - -"Why, Huck, you'd HAVE to. How'd you get around it?" - -"Why, I just wouldn't stand it. I'd run away." - -"Run away! Well, you WOULD be a nice old slouch of a hermit. You'd be -a disgrace." - -The Red-Handed made no response, being better employed. He had -finished gouging out a cob, and now he fitted a weed stem to it, loaded -it with tobacco, and was pressing a coal to the charge and blowing a -cloud of fragrant smoke--he was in the full bloom of luxurious -contentment. The other pirates envied him this majestic vice, and -secretly resolved to acquire it shortly. Presently Huck said: - -"What does pirates have to do?" - -Tom said: - -"Oh, they have just a bully time--take ships and burn them, and get -the money and bury it in awful places in their island where there's -ghosts and things to watch it, and kill everybody in the ships--make -'em walk a plank." - -"And they carry the women to the island," said Joe; "they don't kill -the women." - -"No," assented Tom, "they don't kill the women--they're too noble. And -the women's always beautiful, too. - -"And don't they wear the bulliest clothes! Oh no! All gold and silver -and di'monds," said Joe, with enthusiasm. - -"Who?" said Huck. - -"Why, the pirates." - -Huck scanned his own clothing forlornly. - -"I reckon I ain't dressed fitten for a pirate," said he, with a -regretful pathos in his voice; "but I ain't got none but these." - -But the other boys told him the fine clothes would come fast enough, -after they should have begun their adventures. They made him understand -that his poor rags would do to begin with, though it was customary for -wealthy pirates to start with a proper wardrobe. - -Gradually their talk died out and drowsiness began to steal upon the -eyelids of the little waifs. The pipe dropped from the fingers of the -Red-Handed, and he slept the sleep of the conscience-free and the -weary. The Terror of the Seas and the Black Avenger of the Spanish Main -had more difficulty in getting to sleep. They said their prayers -inwardly, and lying down, since there was nobody there with authority -to make them kneel and recite aloud; in truth, they had a mind not to -say them at all, but they were afraid to proceed to such lengths as -that, lest they might call down a sudden and special thunderbolt from -heaven. Then at once they reached and hovered upon the imminent verge -of sleep--but an intruder came, now, that would not "down." It was -conscience. They began to feel a vague fear that they had been doing -wrong to run away; and next they thought of the stolen meat, and then -the real torture came. They tried to argue it away by reminding -conscience that they had purloined sweetmeats and apples scores of -times; but conscience was not to be appeased by such thin -plausibilities; it seemed to them, in the end, that there was no -getting around the stubborn fact that taking sweetmeats was only -"hooking," while taking bacon and hams and such valuables was plain -simple stealing--and there was a command against that in the Bible. So -they inwardly resolved that so long as they remained in the business, -their piracies should not again be sullied with the crime of stealing. -Then conscience granted a truce, and these curiously inconsistent -pirates fell peacefully to sleep. - - - -CHAPTER XIV - -WHEN Tom awoke in the morning, he wondered where he was. He sat up and -rubbed his eyes and looked around. Then he comprehended. It was the -cool gray dawn, and there was a delicious sense of repose and peace in -the deep pervading calm and silence of the woods. Not a leaf stirred; -not a sound obtruded upon great Nature's meditation. Beaded dewdrops -stood upon the leaves and grasses. A white layer of ashes covered the -fire, and a thin blue breath of smoke rose straight into the air. Joe -and Huck still slept. - -Now, far away in the woods a bird called; another answered; presently -the hammering of a woodpecker was heard. Gradually the cool dim gray of -the morning whitened, and as gradually sounds multiplied and life -manifested itself. The marvel of Nature shaking off sleep and going to -work unfolded itself to the musing boy. A little green worm came -crawling over a dewy leaf, lifting two-thirds of his body into the air -from time to time and "sniffing around," then proceeding again--for he -was measuring, Tom said; and when the worm approached him, of its own -accord, he sat as still as a stone, with his hopes rising and falling, -by turns, as the creature still came toward him or seemed inclined to -go elsewhere; and when at last it considered a painful moment with its -curved body in the air and then came decisively down upon Tom's leg and -began a journey over him, his whole heart was glad--for that meant that -he was going to have a new suit of clothes--without the shadow of a -doubt a gaudy piratical uniform. Now a procession of ants appeared, -from nowhere in particular, and went about their labors; one struggled -manfully by with a dead spider five times as big as itself in its arms, -and lugged it straight up a tree-trunk. A brown spotted lady-bug -climbed the dizzy height of a grass blade, and Tom bent down close to -it and said, "Lady-bug, lady-bug, fly away home, your house is on fire, -your children's alone," and she took wing and went off to see about it ---which did not surprise the boy, for he knew of old that this insect was -credulous about conflagrations, and he had practised upon its -simplicity more than once. A tumblebug came next, heaving sturdily at -its ball, and Tom touched the creature, to see it shut its legs against -its body and pretend to be dead. The birds were fairly rioting by this -time. A catbird, the Northern mocker, lit in a tree over Tom's head, -and trilled out her imitations of her neighbors in a rapture of -enjoyment; then a shrill jay swept down, a flash of blue flame, and -stopped on a twig almost within the boy's reach, cocked his head to one -side and eyed the strangers with a consuming curiosity; a gray squirrel -and a big fellow of the "fox" kind came skurrying along, sitting up at -intervals to inspect and chatter at the boys, for the wild things had -probably never seen a human being before and scarcely knew whether to -be afraid or not. All Nature was wide awake and stirring, now; long -lances of sunlight pierced down through the dense foliage far and near, -and a few butterflies came fluttering upon the scene. - -Tom stirred up the other pirates and they all clattered away with a -shout, and in a minute or two were stripped and chasing after and -tumbling over each other in the shallow limpid water of the white -sandbar. They felt no longing for the little village sleeping in the -distance beyond the majestic waste of water. A vagrant current or a -slight rise in the river had carried off their raft, but this only -gratified them, since its going was something like burning the bridge -between them and civilization. - -They came back to camp wonderfully refreshed, glad-hearted, and -ravenous; and they soon had the camp-fire blazing up again. Huck found -a spring of clear cold water close by, and the boys made cups of broad -oak or hickory leaves, and felt that water, sweetened with such a -wildwood charm as that, would be a good enough substitute for coffee. -While Joe was slicing bacon for breakfast, Tom and Huck asked him to -hold on a minute; they stepped to a promising nook in the river-bank -and threw in their lines; almost immediately they had reward. Joe had -not had time to get impatient before they were back again with some -handsome bass, a couple of sun-perch and a small catfish--provisions -enough for quite a family. They fried the fish with the bacon, and were -astonished; for no fish had ever seemed so delicious before. They did -not know that the quicker a fresh-water fish is on the fire after he is -caught the better he is; and they reflected little upon what a sauce -open-air sleeping, open-air exercise, bathing, and a large ingredient -of hunger make, too. - -They lay around in the shade, after breakfast, while Huck had a smoke, -and then went off through the woods on an exploring expedition. They -tramped gayly along, over decaying logs, through tangled underbrush, -among solemn monarchs of the forest, hung from their crowns to the -ground with a drooping regalia of grape-vines. Now and then they came -upon snug nooks carpeted with grass and jeweled with flowers. - -They found plenty of things to be delighted with, but nothing to be -astonished at. They discovered that the island was about three miles -long and a quarter of a mile wide, and that the shore it lay closest to -was only separated from it by a narrow channel hardly two hundred yards -wide. They took a swim about every hour, so it was close upon the -middle of the afternoon when they got back to camp. They were too -hungry to stop to fish, but they fared sumptuously upon cold ham, and -then threw themselves down in the shade to talk. But the talk soon -began to drag, and then died. The stillness, the solemnity that brooded -in the woods, and the sense of loneliness, began to tell upon the -spirits of the boys. They fell to thinking. A sort of undefined longing -crept upon them. This took dim shape, presently--it was budding -homesickness. Even Finn the Red-Handed was dreaming of his doorsteps -and empty hogsheads. But they were all ashamed of their weakness, and -none was brave enough to speak his thought. - -For some time, now, the boys had been dully conscious of a peculiar -sound in the distance, just as one sometimes is of the ticking of a -clock which he takes no distinct note of. But now this mysterious sound -became more pronounced, and forced a recognition. The boys started, -glanced at each other, and then each assumed a listening attitude. -There was a long silence, profound and unbroken; then a deep, sullen -boom came floating down out of the distance. - -"What is it!" exclaimed Joe, under his breath. - -"I wonder," said Tom in a whisper. - -"'Tain't thunder," said Huckleberry, in an awed tone, "becuz thunder--" - -"Hark!" said Tom. "Listen--don't talk." - -They waited a time that seemed an age, and then the same muffled boom -troubled the solemn hush. - -"Let's go and see." - -They sprang to their feet and hurried to the shore toward the town. -They parted the bushes on the bank and peered out over the water. The -little steam ferryboat was about a mile below the village, drifting -with the current. Her broad deck seemed crowded with people. There were -a great many skiffs rowing about or floating with the stream in the -neighborhood of the ferryboat, but the boys could not determine what -the men in them were doing. Presently a great jet of white smoke burst -from the ferryboat's side, and as it expanded and rose in a lazy cloud, -that same dull throb of sound was borne to the listeners again. - -"I know now!" exclaimed Tom; "somebody's drownded!" - -"That's it!" said Huck; "they done that last summer, when Bill Turner -got drownded; they shoot a cannon over the water, and that makes him -come up to the top. Yes, and they take loaves of bread and put -quicksilver in 'em and set 'em afloat, and wherever there's anybody -that's drownded, they'll float right there and stop." - -"Yes, I've heard about that," said Joe. "I wonder what makes the bread -do that." - -"Oh, it ain't the bread, so much," said Tom; "I reckon it's mostly -what they SAY over it before they start it out." - -"But they don't say anything over it," said Huck. "I've seen 'em and -they don't." - -"Well, that's funny," said Tom. "But maybe they say it to themselves. -Of COURSE they do. Anybody might know that." - -The other boys agreed that there was reason in what Tom said, because -an ignorant lump of bread, uninstructed by an incantation, could not be -expected to act very intelligently when set upon an errand of such -gravity. - -"By jings, I wish I was over there, now," said Joe. - -"I do too" said Huck "I'd give heaps to know who it is." - -The boys still listened and watched. Presently a revealing thought -flashed through Tom's mind, and he exclaimed: - -"Boys, I know who's drownded--it's us!" - -They felt like heroes in an instant. Here was a gorgeous triumph; they -were missed; they were mourned; hearts were breaking on their account; -tears were being shed; accusing memories of unkindness to these poor -lost lads were rising up, and unavailing regrets and remorse were being -indulged; and best of all, the departed were the talk of the whole -town, and the envy of all the boys, as far as this dazzling notoriety -was concerned. This was fine. It was worth while to be a pirate, after -all. - -As twilight drew on, the ferryboat went back to her accustomed -business and the skiffs disappeared. The pirates returned to camp. They -were jubilant with vanity over their new grandeur and the illustrious -trouble they were making. They caught fish, cooked supper and ate it, -and then fell to guessing at what the village was thinking and saying -about them; and the pictures they drew of the public distress on their -account were gratifying to look upon--from their point of view. But -when the shadows of night closed them in, they gradually ceased to -talk, and sat gazing into the fire, with their minds evidently -wandering elsewhere. The excitement was gone, now, and Tom and Joe -could not keep back thoughts of certain persons at home who were not -enjoying this fine frolic as much as they were. Misgivings came; they -grew troubled and unhappy; a sigh or two escaped, unawares. By and by -Joe timidly ventured upon a roundabout "feeler" as to how the others -might look upon a return to civilization--not right now, but-- - -Tom withered him with derision! Huck, being uncommitted as yet, joined -in with Tom, and the waverer quickly "explained," and was glad to get -out of the scrape with as little taint of chicken-hearted homesickness -clinging to his garments as he could. Mutiny was effectually laid to -rest for the moment. - -As the night deepened, Huck began to nod, and presently to snore. Joe -followed next. Tom lay upon his elbow motionless, for some time, -watching the two intently. At last he got up cautiously, on his knees, -and went searching among the grass and the flickering reflections flung -by the camp-fire. He picked up and inspected several large -semi-cylinders of the thin white bark of a sycamore, and finally chose -two which seemed to suit him. Then he knelt by the fire and painfully -wrote something upon each of these with his "red keel"; one he rolled up -and put in his jacket pocket, and the other he put in Joe's hat and -removed it to a little distance from the owner. And he also put into the -hat certain schoolboy treasures of almost inestimable value--among them -a lump of chalk, an India-rubber ball, three fishhooks, and one of that -kind of marbles known as a "sure 'nough crystal." Then he tiptoed his -way cautiously among the trees till he felt that he was out of hearing, -and straightway broke into a keen run in the direction of the sandbar. - - - -CHAPTER XV - -A FEW minutes later Tom was in the shoal water of the bar, wading -toward the Illinois shore. Before the depth reached his middle he was -half-way over; the current would permit no more wading, now, so he -struck out confidently to swim the remaining hundred yards. He swam -quartering upstream, but still was swept downward rather faster than he -had expected. However, he reached the shore finally, and drifted along -till he found a low place and drew himself out. He put his hand on his -jacket pocket, found his piece of bark safe, and then struck through -the woods, following the shore, with streaming garments. Shortly before -ten o'clock he came out into an open place opposite the village, and -saw the ferryboat lying in the shadow of the trees and the high bank. -Everything was quiet under the blinking stars. He crept down the bank, -watching with all his eyes, slipped into the water, swam three or four -strokes and climbed into the skiff that did "yawl" duty at the boat's -stern. He laid himself down under the thwarts and waited, panting. - -Presently the cracked bell tapped and a voice gave the order to "cast -off." A minute or two later the skiff's head was standing high up, -against the boat's swell, and the voyage was begun. Tom felt happy in -his success, for he knew it was the boat's last trip for the night. At -the end of a long twelve or fifteen minutes the wheels stopped, and Tom -slipped overboard and swam ashore in the dusk, landing fifty yards -downstream, out of danger of possible stragglers. - -He flew along unfrequented alleys, and shortly found himself at his -aunt's back fence. He climbed over, approached the "ell," and looked in -at the sitting-room window, for a light was burning there. There sat -Aunt Polly, Sid, Mary, and Joe Harper's mother, grouped together, -talking. They were by the bed, and the bed was between them and the -door. Tom went to the door and began to softly lift the latch; then he -pressed gently and the door yielded a crack; he continued pushing -cautiously, and quaking every time it creaked, till he judged he might -squeeze through on his knees; so he put his head through and began, -warily. - -"What makes the candle blow so?" said Aunt Polly. Tom hurried up. -"Why, that door's open, I believe. Why, of course it is. No end of -strange things now. Go 'long and shut it, Sid." - -Tom disappeared under the bed just in time. He lay and "breathed" -himself for a time, and then crept to where he could almost touch his -aunt's foot. - -"But as I was saying," said Aunt Polly, "he warn't BAD, so to say ---only mischEEvous. Only just giddy, and harum-scarum, you know. He -warn't any more responsible than a colt. HE never meant any harm, and -he was the best-hearted boy that ever was"--and she began to cry. - -"It was just so with my Joe--always full of his devilment, and up to -every kind of mischief, but he was just as unselfish and kind as he -could be--and laws bless me, to think I went and whipped him for taking -that cream, never once recollecting that I throwed it out myself -because it was sour, and I never to see him again in this world, never, -never, never, poor abused boy!" And Mrs. Harper sobbed as if her heart -would break. - -"I hope Tom's better off where he is," said Sid, "but if he'd been -better in some ways--" - -"SID!" Tom felt the glare of the old lady's eye, though he could not -see it. "Not a word against my Tom, now that he's gone! God'll take -care of HIM--never you trouble YOURself, sir! Oh, Mrs. Harper, I don't -know how to give him up! I don't know how to give him up! He was such a -comfort to me, although he tormented my old heart out of me, 'most." - -"The Lord giveth and the Lord hath taken away--Blessed be the name of -the Lord! But it's so hard--Oh, it's so hard! Only last Saturday my -Joe busted a firecracker right under my nose and I knocked him -sprawling. Little did I know then, how soon--Oh, if it was to do over -again I'd hug him and bless him for it." - -"Yes, yes, yes, I know just how you feel, Mrs. Harper, I know just -exactly how you feel. No longer ago than yesterday noon, my Tom took -and filled the cat full of Pain-killer, and I did think the cretur -would tear the house down. And God forgive me, I cracked Tom's head -with my thimble, poor boy, poor dead boy. But he's out of all his -troubles now. And the last words I ever heard him say was to reproach--" - -But this memory was too much for the old lady, and she broke entirely -down. Tom was snuffling, now, himself--and more in pity of himself than -anybody else. He could hear Mary crying, and putting in a kindly word -for him from time to time. He began to have a nobler opinion of himself -than ever before. Still, he was sufficiently touched by his aunt's -grief to long to rush out from under the bed and overwhelm her with -joy--and the theatrical gorgeousness of the thing appealed strongly to -his nature, too, but he resisted and lay still. - -He went on listening, and gathered by odds and ends that it was -conjectured at first that the boys had got drowned while taking a swim; -then the small raft had been missed; next, certain boys said the -missing lads had promised that the village should "hear something" -soon; the wise-heads had "put this and that together" and decided that -the lads had gone off on that raft and would turn up at the next town -below, presently; but toward noon the raft had been found, lodged -against the Missouri shore some five or six miles below the village ---and then hope perished; they must be drowned, else hunger would have -driven them home by nightfall if not sooner. It was believed that the -search for the bodies had been a fruitless effort merely because the -drowning must have occurred in mid-channel, since the boys, being good -swimmers, would otherwise have escaped to shore. This was Wednesday -night. If the bodies continued missing until Sunday, all hope would be -given over, and the funerals would be preached on that morning. Tom -shuddered. - -Mrs. Harper gave a sobbing good-night and turned to go. Then with a -mutual impulse the two bereaved women flung themselves into each -other's arms and had a good, consoling cry, and then parted. Aunt Polly -was tender far beyond her wont, in her good-night to Sid and Mary. Sid -snuffled a bit and Mary went off crying with all her heart. - -Aunt Polly knelt down and prayed for Tom so touchingly, so -appealingly, and with such measureless love in her words and her old -trembling voice, that he was weltering in tears again, long before she -was through. - -He had to keep still long after she went to bed, for she kept making -broken-hearted ejaculations from time to time, tossing unrestfully, and -turning over. But at last she was still, only moaning a little in her -sleep. Now the boy stole out, rose gradually by the bedside, shaded the -candle-light with his hand, and stood regarding her. His heart was full -of pity for her. He took out his sycamore scroll and placed it by the -candle. But something occurred to him, and he lingered considering. His -face lighted with a happy solution of his thought; he put the bark -hastily in his pocket. Then he bent over and kissed the faded lips, and -straightway made his stealthy exit, latching the door behind him. - -He threaded his way back to the ferry landing, found nobody at large -there, and walked boldly on board the boat, for he knew she was -tenantless except that there was a watchman, who always turned in and -slept like a graven image. He untied the skiff at the stern, slipped -into it, and was soon rowing cautiously upstream. When he had pulled a -mile above the village, he started quartering across and bent himself -stoutly to his work. He hit the landing on the other side neatly, for -this was a familiar bit of work to him. He was moved to capture the -skiff, arguing that it might be considered a ship and therefore -legitimate prey for a pirate, but he knew a thorough search would be -made for it and that might end in revelations. So he stepped ashore and -entered the woods. - -He sat down and took a long rest, torturing himself meanwhile to keep -awake, and then started warily down the home-stretch. The night was far -spent. It was broad daylight before he found himself fairly abreast the -island bar. He rested again until the sun was well up and gilding the -great river with its splendor, and then he plunged into the stream. A -little later he paused, dripping, upon the threshold of the camp, and -heard Joe say: - -"No, Tom's true-blue, Huck, and he'll come back. He won't desert. He -knows that would be a disgrace to a pirate, and Tom's too proud for -that sort of thing. He's up to something or other. Now I wonder what?" - -"Well, the things is ours, anyway, ain't they?" - -"Pretty near, but not yet, Huck. The writing says they are if he ain't -back here to breakfast." - -"Which he is!" exclaimed Tom, with fine dramatic effect, stepping -grandly into camp. - -A sumptuous breakfast of bacon and fish was shortly provided, and as -the boys set to work upon it, Tom recounted (and adorned) his -adventures. They were a vain and boastful company of heroes when the -tale was done. Then Tom hid himself away in a shady nook to sleep till -noon, and the other pirates got ready to fish and explore. - - - -CHAPTER XVI - -AFTER dinner all the gang turned out to hunt for turtle eggs on the -bar. They went about poking sticks into the sand, and when they found a -soft place they went down on their knees and dug with their hands. -Sometimes they would take fifty or sixty eggs out of one hole. They -were perfectly round white things a trifle smaller than an English -walnut. They had a famous fried-egg feast that night, and another on -Friday morning. - -After breakfast they went whooping and prancing out on the bar, and -chased each other round and round, shedding clothes as they went, until -they were naked, and then continued the frolic far away up the shoal -water of the bar, against the stiff current, which latter tripped their -legs from under them from time to time and greatly increased the fun. -And now and then they stooped in a group and splashed water in each -other's faces with their palms, gradually approaching each other, with -averted faces to avoid the strangling sprays, and finally gripping and -struggling till the best man ducked his neighbor, and then they all -went under in a tangle of white legs and arms and came up blowing, -sputtering, laughing, and gasping for breath at one and the same time. - -When they were well exhausted, they would run out and sprawl on the -dry, hot sand, and lie there and cover themselves up with it, and by -and by break for the water again and go through the original -performance once more. Finally it occurred to them that their naked -skin represented flesh-colored "tights" very fairly; so they drew a -ring in the sand and had a circus--with three clowns in it, for none -would yield this proudest post to his neighbor. - -Next they got their marbles and played "knucks" and "ring-taw" and -"keeps" till that amusement grew stale. Then Joe and Huck had another -swim, but Tom would not venture, because he found that in kicking off -his trousers he had kicked his string of rattlesnake rattles off his -ankle, and he wondered how he had escaped cramp so long without the -protection of this mysterious charm. He did not venture again until he -had found it, and by that time the other boys were tired and ready to -rest. They gradually wandered apart, dropped into the "dumps," and fell -to gazing longingly across the wide river to where the village lay -drowsing in the sun. Tom found himself writing "BECKY" in the sand with -his big toe; he scratched it out, and was angry with himself for his -weakness. But he wrote it again, nevertheless; he could not help it. He -erased it once more and then took himself out of temptation by driving -the other boys together and joining them. - -But Joe's spirits had gone down almost beyond resurrection. He was so -homesick that he could hardly endure the misery of it. The tears lay -very near the surface. Huck was melancholy, too. Tom was downhearted, -but tried hard not to show it. He had a secret which he was not ready -to tell, yet, but if this mutinous depression was not broken up soon, -he would have to bring it out. He said, with a great show of -cheerfulness: - -"I bet there's been pirates on this island before, boys. We'll explore -it again. They've hid treasures here somewhere. How'd you feel to light -on a rotten chest full of gold and silver--hey?" - -But it roused only faint enthusiasm, which faded out, with no reply. -Tom tried one or two other seductions; but they failed, too. It was -discouraging work. Joe sat poking up the sand with a stick and looking -very gloomy. Finally he said: - -"Oh, boys, let's give it up. I want to go home. It's so lonesome." - -"Oh no, Joe, you'll feel better by and by," said Tom. "Just think of -the fishing that's here." - -"I don't care for fishing. I want to go home." - -"But, Joe, there ain't such another swimming-place anywhere." - -"Swimming's no good. I don't seem to care for it, somehow, when there -ain't anybody to say I sha'n't go in. I mean to go home." - -"Oh, shucks! Baby! You want to see your mother, I reckon." - -"Yes, I DO want to see my mother--and you would, too, if you had one. -I ain't any more baby than you are." And Joe snuffled a little. - -"Well, we'll let the cry-baby go home to his mother, won't we, Huck? -Poor thing--does it want to see its mother? And so it shall. You like -it here, don't you, Huck? We'll stay, won't we?" - -Huck said, "Y-e-s"--without any heart in it. - -"I'll never speak to you again as long as I live," said Joe, rising. -"There now!" And he moved moodily away and began to dress himself. - -"Who cares!" said Tom. "Nobody wants you to. Go 'long home and get -laughed at. Oh, you're a nice pirate. Huck and me ain't cry-babies. -We'll stay, won't we, Huck? Let him go if he wants to. I reckon we can -get along without him, per'aps." - -But Tom was uneasy, nevertheless, and was alarmed to see Joe go -sullenly on with his dressing. And then it was discomforting to see -Huck eying Joe's preparations so wistfully, and keeping up such an -ominous silence. Presently, without a parting word, Joe began to wade -off toward the Illinois shore. Tom's heart began to sink. He glanced at -Huck. Huck could not bear the look, and dropped his eyes. Then he said: - -"I want to go, too, Tom. It was getting so lonesome anyway, and now -it'll be worse. Let's us go, too, Tom." - -"I won't! You can all go, if you want to. I mean to stay." - -"Tom, I better go." - -"Well, go 'long--who's hendering you." - -Huck began to pick up his scattered clothes. He said: - -"Tom, I wisht you'd come, too. Now you think it over. We'll wait for -you when we get to shore." - -"Well, you'll wait a blame long time, that's all." - -Huck started sorrowfully away, and Tom stood looking after him, with a -strong desire tugging at his heart to yield his pride and go along too. -He hoped the boys would stop, but they still waded slowly on. It -suddenly dawned on Tom that it was become very lonely and still. He -made one final struggle with his pride, and then darted after his -comrades, yelling: - -"Wait! Wait! I want to tell you something!" - -They presently stopped and turned around. When he got to where they -were, he began unfolding his secret, and they listened moodily till at -last they saw the "point" he was driving at, and then they set up a -war-whoop of applause and said it was "splendid!" and said if he had -told them at first, they wouldn't have started away. He made a plausible -excuse; but his real reason had been the fear that not even the secret -would keep them with him any very great length of time, and so he had -meant to hold it in reserve as a last seduction. - -The lads came gayly back and went at their sports again with a will, -chattering all the time about Tom's stupendous plan and admiring the -genius of it. After a dainty egg and fish dinner, Tom said he wanted to -learn to smoke, now. Joe caught at the idea and said he would like to -try, too. So Huck made pipes and filled them. These novices had never -smoked anything before but cigars made of grape-vine, and they "bit" -the tongue, and were not considered manly anyway. - -Now they stretched themselves out on their elbows and began to puff, -charily, and with slender confidence. The smoke had an unpleasant -taste, and they gagged a little, but Tom said: - -"Why, it's just as easy! If I'd a knowed this was all, I'd a learnt -long ago." - -"So would I," said Joe. "It's just nothing." - -"Why, many a time I've looked at people smoking, and thought well I -wish I could do that; but I never thought I could," said Tom. - -"That's just the way with me, hain't it, Huck? You've heard me talk -just that way--haven't you, Huck? I'll leave it to Huck if I haven't." - -"Yes--heaps of times," said Huck. - -"Well, I have too," said Tom; "oh, hundreds of times. Once down by the -slaughter-house. Don't you remember, Huck? Bob Tanner was there, and -Johnny Miller, and Jeff Thatcher, when I said it. Don't you remember, -Huck, 'bout me saying that?" - -"Yes, that's so," said Huck. "That was the day after I lost a white -alley. No, 'twas the day before." - -"There--I told you so," said Tom. "Huck recollects it." - -"I bleeve I could smoke this pipe all day," said Joe. "I don't feel -sick." - -"Neither do I," said Tom. "I could smoke it all day. But I bet you -Jeff Thatcher couldn't." - -"Jeff Thatcher! Why, he'd keel over just with two draws. Just let him -try it once. HE'D see!" - -"I bet he would. And Johnny Miller--I wish could see Johnny Miller -tackle it once." - -"Oh, don't I!" said Joe. "Why, I bet you Johnny Miller couldn't any -more do this than nothing. Just one little snifter would fetch HIM." - -"'Deed it would, Joe. Say--I wish the boys could see us now." - -"So do I." - -"Say--boys, don't say anything about it, and some time when they're -around, I'll come up to you and say, 'Joe, got a pipe? I want a smoke.' -And you'll say, kind of careless like, as if it warn't anything, you'll -say, 'Yes, I got my OLD pipe, and another one, but my tobacker ain't -very good.' And I'll say, 'Oh, that's all right, if it's STRONG -enough.' And then you'll out with the pipes, and we'll light up just as -ca'm, and then just see 'em look!" - -"By jings, that'll be gay, Tom! I wish it was NOW!" - -"So do I! And when we tell 'em we learned when we was off pirating, -won't they wish they'd been along?" - -"Oh, I reckon not! I'll just BET they will!" - -So the talk ran on. But presently it began to flag a trifle, and grow -disjointed. The silences widened; the expectoration marvellously -increased. Every pore inside the boys' cheeks became a spouting -fountain; they could scarcely bail out the cellars under their tongues -fast enough to prevent an inundation; little overflowings down their -throats occurred in spite of all they could do, and sudden retchings -followed every time. Both boys were looking very pale and miserable, -now. Joe's pipe dropped from his nerveless fingers. Tom's followed. -Both fountains were going furiously and both pumps bailing with might -and main. Joe said feebly: - -"I've lost my knife. I reckon I better go and find it." - -Tom said, with quivering lips and halting utterance: - -"I'll help you. You go over that way and I'll hunt around by the -spring. No, you needn't come, Huck--we can find it." - -So Huck sat down again, and waited an hour. Then he found it lonesome, -and went to find his comrades. They were wide apart in the woods, both -very pale, both fast asleep. But something informed him that if they -had had any trouble they had got rid of it. - -They were not talkative at supper that night. They had a humble look, -and when Huck prepared his pipe after the meal and was going to prepare -theirs, they said no, they were not feeling very well--something they -ate at dinner had disagreed with them. - -About midnight Joe awoke, and called the boys. There was a brooding -oppressiveness in the air that seemed to bode something. The boys -huddled themselves together and sought the friendly companionship of -the fire, though the dull dead heat of the breathless atmosphere was -stifling. They sat still, intent and waiting. The solemn hush -continued. Beyond the light of the fire everything was swallowed up in -the blackness of darkness. Presently there came a quivering glow that -vaguely revealed the foliage for a moment and then vanished. By and by -another came, a little stronger. Then another. Then a faint moan came -sighing through the branches of the forest and the boys felt a fleeting -breath upon their cheeks, and shuddered with the fancy that the Spirit -of the Night had gone by. There was a pause. Now a weird flash turned -night into day and showed every little grass-blade, separate and -distinct, that grew about their feet. And it showed three white, -startled faces, too. A deep peal of thunder went rolling and tumbling -down the heavens and lost itself in sullen rumblings in the distance. A -sweep of chilly air passed by, rustling all the leaves and snowing the -flaky ashes broadcast about the fire. Another fierce glare lit up the -forest and an instant crash followed that seemed to rend the tree-tops -right over the boys' heads. They clung together in terror, in the thick -gloom that followed. A few big rain-drops fell pattering upon the -leaves. - -"Quick! boys, go for the tent!" exclaimed Tom. - -They sprang away, stumbling over roots and among vines in the dark, no -two plunging in the same direction. A furious blast roared through the -trees, making everything sing as it went. One blinding flash after -another came, and peal on peal of deafening thunder. And now a -drenching rain poured down and the rising hurricane drove it in sheets -along the ground. The boys cried out to each other, but the roaring -wind and the booming thunder-blasts drowned their voices utterly. -However, one by one they straggled in at last and took shelter under -the tent, cold, scared, and streaming with water; but to have company -in misery seemed something to be grateful for. They could not talk, the -old sail flapped so furiously, even if the other noises would have -allowed them. The tempest rose higher and higher, and presently the -sail tore loose from its fastenings and went winging away on the blast. -The boys seized each others' hands and fled, with many tumblings and -bruises, to the shelter of a great oak that stood upon the river-bank. -Now the battle was at its highest. Under the ceaseless conflagration of -lightning that flamed in the skies, everything below stood out in -clean-cut and shadowless distinctness: the bending trees, the billowy -river, white with foam, the driving spray of spume-flakes, the dim -outlines of the high bluffs on the other side, glimpsed through the -drifting cloud-rack and the slanting veil of rain. Every little while -some giant tree yielded the fight and fell crashing through the younger -growth; and the unflagging thunder-peals came now in ear-splitting -explosive bursts, keen and sharp, and unspeakably appalling. The storm -culminated in one matchless effort that seemed likely to tear the island -to pieces, burn it up, drown it to the tree-tops, blow it away, and -deafen every creature in it, all at one and the same moment. It was a -wild night for homeless young heads to be out in. - -But at last the battle was done, and the forces retired with weaker -and weaker threatenings and grumblings, and peace resumed her sway. The -boys went back to camp, a good deal awed; but they found there was -still something to be thankful for, because the great sycamore, the -shelter of their beds, was a ruin, now, blasted by the lightnings, and -they were not under it when the catastrophe happened. - -Everything in camp was drenched, the camp-fire as well; for they were -but heedless lads, like their generation, and had made no provision -against rain. Here was matter for dismay, for they were soaked through -and chilled. They were eloquent in their distress; but they presently -discovered that the fire had eaten so far up under the great log it had -been built against (where it curved upward and separated itself from -the ground), that a handbreadth or so of it had escaped wetting; so -they patiently wrought until, with shreds and bark gathered from the -under sides of sheltered logs, they coaxed the fire to burn again. Then -they piled on great dead boughs till they had a roaring furnace, and -were glad-hearted once more. They dried their boiled ham and had a -feast, and after that they sat by the fire and expanded and glorified -their midnight adventure until morning, for there was not a dry spot to -sleep on, anywhere around. - -As the sun began to steal in upon the boys, drowsiness came over them, -and they went out on the sandbar and lay down to sleep. They got -scorched out by and by, and drearily set about getting breakfast. After -the meal they felt rusty, and stiff-jointed, and a little homesick once -more. Tom saw the signs, and fell to cheering up the pirates as well as -he could. But they cared nothing for marbles, or circus, or swimming, -or anything. He reminded them of the imposing secret, and raised a ray -of cheer. While it lasted, he got them interested in a new device. This -was to knock off being pirates, for a while, and be Indians for a -change. They were attracted by this idea; so it was not long before -they were stripped, and striped from head to heel with black mud, like -so many zebras--all of them chiefs, of course--and then they went -tearing through the woods to attack an English settlement. - -By and by they separated into three hostile tribes, and darted upon -each other from ambush with dreadful war-whoops, and killed and scalped -each other by thousands. It was a gory day. Consequently it was an -extremely satisfactory one. - -They assembled in camp toward supper-time, hungry and happy; but now a -difficulty arose--hostile Indians could not break the bread of -hospitality together without first making peace, and this was a simple -impossibility without smoking a pipe of peace. There was no other -process that ever they had heard of. Two of the savages almost wished -they had remained pirates. However, there was no other way; so with -such show of cheerfulness as they could muster they called for the pipe -and took their whiff as it passed, in due form. - -And behold, they were glad they had gone into savagery, for they had -gained something; they found that they could now smoke a little without -having to go and hunt for a lost knife; they did not get sick enough to -be seriously uncomfortable. They were not likely to fool away this high -promise for lack of effort. No, they practised cautiously, after -supper, with right fair success, and so they spent a jubilant evening. -They were prouder and happier in their new acquirement than they would -have been in the scalping and skinning of the Six Nations. We will -leave them to smoke and chatter and brag, since we have no further use -for them at present. - - - -CHAPTER XVII - -BUT there was no hilarity in the little town that same tranquil -Saturday afternoon. The Harpers, and Aunt Polly's family, were being -put into mourning, with great grief and many tears. An unusual quiet -possessed the village, although it was ordinarily quiet enough, in all -conscience. The villagers conducted their concerns with an absent air, -and talked little; but they sighed often. The Saturday holiday seemed a -burden to the children. They had no heart in their sports, and -gradually gave them up. - -In the afternoon Becky Thatcher found herself moping about the -deserted schoolhouse yard, and feeling very melancholy. But she found -nothing there to comfort her. She soliloquized: - -"Oh, if I only had a brass andiron-knob again! But I haven't got -anything now to remember him by." And she choked back a little sob. - -Presently she stopped, and said to herself: - -"It was right here. Oh, if it was to do over again, I wouldn't say -that--I wouldn't say it for the whole world. But he's gone now; I'll -never, never, never see him any more." - -This thought broke her down, and she wandered away, with tears rolling -down her cheeks. Then quite a group of boys and girls--playmates of -Tom's and Joe's--came by, and stood looking over the paling fence and -talking in reverent tones of how Tom did so-and-so the last time they -saw him, and how Joe said this and that small trifle (pregnant with -awful prophecy, as they could easily see now!)--and each speaker -pointed out the exact spot where the lost lads stood at the time, and -then added something like "and I was a-standing just so--just as I am -now, and as if you was him--I was as close as that--and he smiled, just -this way--and then something seemed to go all over me, like--awful, you -know--and I never thought what it meant, of course, but I can see now!" - -Then there was a dispute about who saw the dead boys last in life, and -many claimed that dismal distinction, and offered evidences, more or -less tampered with by the witness; and when it was ultimately decided -who DID see the departed last, and exchanged the last words with them, -the lucky parties took upon themselves a sort of sacred importance, and -were gaped at and envied by all the rest. One poor chap, who had no -other grandeur to offer, said with tolerably manifest pride in the -remembrance: - -"Well, Tom Sawyer he licked me once." - -But that bid for glory was a failure. Most of the boys could say that, -and so that cheapened the distinction too much. The group loitered -away, still recalling memories of the lost heroes, in awed voices. - -When the Sunday-school hour was finished, the next morning, the bell -began to toll, instead of ringing in the usual way. It was a very still -Sabbath, and the mournful sound seemed in keeping with the musing hush -that lay upon nature. The villagers began to gather, loitering a moment -in the vestibule to converse in whispers about the sad event. But there -was no whispering in the house; only the funereal rustling of dresses -as the women gathered to their seats disturbed the silence there. None -could remember when the little church had been so full before. There -was finally a waiting pause, an expectant dumbness, and then Aunt Polly -entered, followed by Sid and Mary, and they by the Harper family, all -in deep black, and the whole congregation, the old minister as well, -rose reverently and stood until the mourners were seated in the front -pew. There was another communing silence, broken at intervals by -muffled sobs, and then the minister spread his hands abroad and prayed. -A moving hymn was sung, and the text followed: "I am the Resurrection -and the Life." - -As the service proceeded, the clergyman drew such pictures of the -graces, the winning ways, and the rare promise of the lost lads that -every soul there, thinking he recognized these pictures, felt a pang in -remembering that he had persistently blinded himself to them always -before, and had as persistently seen only faults and flaws in the poor -boys. The minister related many a touching incident in the lives of the -departed, too, which illustrated their sweet, generous natures, and the -people could easily see, now, how noble and beautiful those episodes -were, and remembered with grief that at the time they occurred they had -seemed rank rascalities, well deserving of the cowhide. The -congregation became more and more moved, as the pathetic tale went on, -till at last the whole company broke down and joined the weeping -mourners in a chorus of anguished sobs, the preacher himself giving way -to his feelings, and crying in the pulpit. - -There was a rustle in the gallery, which nobody noticed; a moment -later the church door creaked; the minister raised his streaming eyes -above his handkerchief, and stood transfixed! First one and then -another pair of eyes followed the minister's, and then almost with one -impulse the congregation rose and stared while the three dead boys came -marching up the aisle, Tom in the lead, Joe next, and Huck, a ruin of -drooping rags, sneaking sheepishly in the rear! They had been hid in -the unused gallery listening to their own funeral sermon! - -Aunt Polly, Mary, and the Harpers threw themselves upon their restored -ones, smothered them with kisses and poured out thanksgivings, while -poor Huck stood abashed and uncomfortable, not knowing exactly what to -do or where to hide from so many unwelcoming eyes. He wavered, and -started to slink away, but Tom seized him and said: - -"Aunt Polly, it ain't fair. Somebody's got to be glad to see Huck." - -"And so they shall. I'm glad to see him, poor motherless thing!" And -the loving attentions Aunt Polly lavished upon him were the one thing -capable of making him more uncomfortable than he was before. - -Suddenly the minister shouted at the top of his voice: "Praise God -from whom all blessings flow--SING!--and put your hearts in it!" - -And they did. Old Hundred swelled up with a triumphant burst, and -while it shook the rafters Tom Sawyer the Pirate looked around upon the -envying juveniles about him and confessed in his heart that this was -the proudest moment of his life. - -As the "sold" congregation trooped out they said they would almost be -willing to be made ridiculous again to hear Old Hundred sung like that -once more. - -Tom got more cuffs and kisses that day--according to Aunt Polly's -varying moods--than he had earned before in a year; and he hardly knew -which expressed the most gratefulness to God and affection for himself. - - - -CHAPTER XVIII - -THAT was Tom's great secret--the scheme to return home with his -brother pirates and attend their own funerals. They had paddled over to -the Missouri shore on a log, at dusk on Saturday, landing five or six -miles below the village; they had slept in the woods at the edge of the -town till nearly daylight, and had then crept through back lanes and -alleys and finished their sleep in the gallery of the church among a -chaos of invalided benches. - -At breakfast, Monday morning, Aunt Polly and Mary were very loving to -Tom, and very attentive to his wants. There was an unusual amount of -talk. In the course of it Aunt Polly said: - -"Well, I don't say it wasn't a fine joke, Tom, to keep everybody -suffering 'most a week so you boys had a good time, but it is a pity -you could be so hard-hearted as to let me suffer so. If you could come -over on a log to go to your funeral, you could have come over and give -me a hint some way that you warn't dead, but only run off." - -"Yes, you could have done that, Tom," said Mary; "and I believe you -would if you had thought of it." - -"Would you, Tom?" said Aunt Polly, her face lighting wistfully. "Say, -now, would you, if you'd thought of it?" - -"I--well, I don't know. 'Twould 'a' spoiled everything." - -"Tom, I hoped you loved me that much," said Aunt Polly, with a grieved -tone that discomforted the boy. "It would have been something if you'd -cared enough to THINK of it, even if you didn't DO it." - -"Now, auntie, that ain't any harm," pleaded Mary; "it's only Tom's -giddy way--he is always in such a rush that he never thinks of -anything." - -"More's the pity. Sid would have thought. And Sid would have come and -DONE it, too. Tom, you'll look back, some day, when it's too late, and -wish you'd cared a little more for me when it would have cost you so -little." - -"Now, auntie, you know I do care for you," said Tom. - -"I'd know it better if you acted more like it." - -"I wish now I'd thought," said Tom, with a repentant tone; "but I -dreamt about you, anyway. That's something, ain't it?" - -"It ain't much--a cat does that much--but it's better than nothing. -What did you dream?" - -"Why, Wednesday night I dreamt that you was sitting over there by the -bed, and Sid was sitting by the woodbox, and Mary next to him." - -"Well, so we did. So we always do. I'm glad your dreams could take -even that much trouble about us." - -"And I dreamt that Joe Harper's mother was here." - -"Why, she was here! Did you dream any more?" - -"Oh, lots. But it's so dim, now." - -"Well, try to recollect--can't you?" - -"Somehow it seems to me that the wind--the wind blowed the--the--" - -"Try harder, Tom! The wind did blow something. Come!" - -Tom pressed his fingers on his forehead an anxious minute, and then -said: - -"I've got it now! I've got it now! It blowed the candle!" - -"Mercy on us! Go on, Tom--go on!" - -"And it seems to me that you said, 'Why, I believe that that door--'" - -"Go ON, Tom!" - -"Just let me study a moment--just a moment. Oh, yes--you said you -believed the door was open." - -"As I'm sitting here, I did! Didn't I, Mary! Go on!" - -"And then--and then--well I won't be certain, but it seems like as if -you made Sid go and--and--" - -"Well? Well? What did I make him do, Tom? What did I make him do?" - -"You made him--you--Oh, you made him shut it." - -"Well, for the land's sake! I never heard the beat of that in all my -days! Don't tell ME there ain't anything in dreams, any more. Sereny -Harper shall know of this before I'm an hour older. I'd like to see her -get around THIS with her rubbage 'bout superstition. Go on, Tom!" - -"Oh, it's all getting just as bright as day, now. Next you said I -warn't BAD, only mischeevous and harum-scarum, and not any more -responsible than--than--I think it was a colt, or something." - -"And so it was! Well, goodness gracious! Go on, Tom!" - -"And then you began to cry." - -"So I did. So I did. Not the first time, neither. And then--" - -"Then Mrs. Harper she began to cry, and said Joe was just the same, -and she wished she hadn't whipped him for taking cream when she'd -throwed it out her own self--" - -"Tom! The sperrit was upon you! You was a prophesying--that's what you -was doing! Land alive, go on, Tom!" - -"Then Sid he said--he said--" - -"I don't think I said anything," said Sid. - -"Yes you did, Sid," said Mary. - -"Shut your heads and let Tom go on! What did he say, Tom?" - -"He said--I THINK he said he hoped I was better off where I was gone -to, but if I'd been better sometimes--" - -"THERE, d'you hear that! It was his very words!" - -"And you shut him up sharp." - -"I lay I did! There must 'a' been an angel there. There WAS an angel -there, somewheres!" - -"And Mrs. Harper told about Joe scaring her with a firecracker, and -you told about Peter and the Painkiller--" - -"Just as true as I live!" - -"And then there was a whole lot of talk 'bout dragging the river for -us, and 'bout having the funeral Sunday, and then you and old Miss -Harper hugged and cried, and she went." - -"It happened just so! It happened just so, as sure as I'm a-sitting in -these very tracks. Tom, you couldn't told it more like if you'd 'a' -seen it! And then what? Go on, Tom!" - -"Then I thought you prayed for me--and I could see you and hear every -word you said. And you went to bed, and I was so sorry that I took and -wrote on a piece of sycamore bark, 'We ain't dead--we are only off -being pirates,' and put it on the table by the candle; and then you -looked so good, laying there asleep, that I thought I went and leaned -over and kissed you on the lips." - -"Did you, Tom, DID you! I just forgive you everything for that!" And -she seized the boy in a crushing embrace that made him feel like the -guiltiest of villains. - -"It was very kind, even though it was only a--dream," Sid soliloquized -just audibly. - -"Shut up, Sid! A body does just the same in a dream as he'd do if he -was awake. Here's a big Milum apple I've been saving for you, Tom, if -you was ever found again--now go 'long to school. I'm thankful to the -good God and Father of us all I've got you back, that's long-suffering -and merciful to them that believe on Him and keep His word, though -goodness knows I'm unworthy of it, but if only the worthy ones got His -blessings and had His hand to help them over the rough places, there's -few enough would smile here or ever enter into His rest when the long -night comes. Go 'long Sid, Mary, Tom--take yourselves off--you've -hendered me long enough." - -The children left for school, and the old lady to call on Mrs. Harper -and vanquish her realism with Tom's marvellous dream. Sid had better -judgment than to utter the thought that was in his mind as he left the -house. It was this: "Pretty thin--as long a dream as that, without any -mistakes in it!" - -What a hero Tom was become, now! He did not go skipping and prancing, -but moved with a dignified swagger as became a pirate who felt that the -public eye was on him. And indeed it was; he tried not to seem to see -the looks or hear the remarks as he passed along, but they were food -and drink to him. Smaller boys than himself flocked at his heels, as -proud to be seen with him, and tolerated by him, as if he had been the -drummer at the head of a procession or the elephant leading a menagerie -into town. Boys of his own size pretended not to know he had been away -at all; but they were consuming with envy, nevertheless. They would -have given anything to have that swarthy suntanned skin of his, and his -glittering notoriety; and Tom would not have parted with either for a -circus. - -At school the children made so much of him and of Joe, and delivered -such eloquent admiration from their eyes, that the two heroes were not -long in becoming insufferably "stuck-up." They began to tell their -adventures to hungry listeners--but they only began; it was not a thing -likely to have an end, with imaginations like theirs to furnish -material. And finally, when they got out their pipes and went serenely -puffing around, the very summit of glory was reached. - -Tom decided that he could be independent of Becky Thatcher now. Glory -was sufficient. He would live for glory. Now that he was distinguished, -maybe she would be wanting to "make up." Well, let her--she should see -that he could be as indifferent as some other people. Presently she -arrived. Tom pretended not to see her. He moved away and joined a group -of boys and girls and began to talk. Soon he observed that she was -tripping gayly back and forth with flushed face and dancing eyes, -pretending to be busy chasing schoolmates, and screaming with laughter -when she made a capture; but he noticed that she always made her -captures in his vicinity, and that she seemed to cast a conscious eye -in his direction at such times, too. It gratified all the vicious -vanity that was in him; and so, instead of winning him, it only "set -him up" the more and made him the more diligent to avoid betraying that -he knew she was about. Presently she gave over skylarking, and moved -irresolutely about, sighing once or twice and glancing furtively and -wistfully toward Tom. Then she observed that now Tom was talking more -particularly to Amy Lawrence than to any one else. She felt a sharp -pang and grew disturbed and uneasy at once. She tried to go away, but -her feet were treacherous, and carried her to the group instead. She -said to a girl almost at Tom's elbow--with sham vivacity: - -"Why, Mary Austin! you bad girl, why didn't you come to Sunday-school?" - -"I did come--didn't you see me?" - -"Why, no! Did you? Where did you sit?" - -"I was in Miss Peters' class, where I always go. I saw YOU." - -"Did you? Why, it's funny I didn't see you. I wanted to tell you about -the picnic." - -"Oh, that's jolly. Who's going to give it?" - -"My ma's going to let me have one." - -"Oh, goody; I hope she'll let ME come." - -"Well, she will. The picnic's for me. She'll let anybody come that I -want, and I want you." - -"That's ever so nice. When is it going to be?" - -"By and by. Maybe about vacation." - -"Oh, won't it be fun! You going to have all the girls and boys?" - -"Yes, every one that's friends to me--or wants to be"; and she glanced -ever so furtively at Tom, but he talked right along to Amy Lawrence -about the terrible storm on the island, and how the lightning tore the -great sycamore tree "all to flinders" while he was "standing within -three feet of it." - -"Oh, may I come?" said Grace Miller. - -"Yes." - -"And me?" said Sally Rogers. - -"Yes." - -"And me, too?" said Susy Harper. "And Joe?" - -"Yes." - -And so on, with clapping of joyful hands till all the group had begged -for invitations but Tom and Amy. Then Tom turned coolly away, still -talking, and took Amy with him. Becky's lips trembled and the tears -came to her eyes; she hid these signs with a forced gayety and went on -chattering, but the life had gone out of the picnic, now, and out of -everything else; she got away as soon as she could and hid herself and -had what her sex call "a good cry." Then she sat moody, with wounded -pride, till the bell rang. She roused up, now, with a vindictive cast -in her eye, and gave her plaited tails a shake and said she knew what -SHE'D do. - -At recess Tom continued his flirtation with Amy with jubilant -self-satisfaction. And he kept drifting about to find Becky and lacerate -her with the performance. At last he spied her, but there was a sudden -falling of his mercury. She was sitting cosily on a little bench behind -the schoolhouse looking at a picture-book with Alfred Temple--and so -absorbed were they, and their heads so close together over the book, -that they did not seem to be conscious of anything in the world besides. -Jealousy ran red-hot through Tom's veins. He began to hate himself for -throwing away the chance Becky had offered for a reconciliation. He -called himself a fool, and all the hard names he could think of. He -wanted to cry with vexation. Amy chatted happily along, as they walked, -for her heart was singing, but Tom's tongue had lost its function. He -did not hear what Amy was saying, and whenever she paused expectantly he -could only stammer an awkward assent, which was as often misplaced as -otherwise. He kept drifting to the rear of the schoolhouse, again and -again, to sear his eyeballs with the hateful spectacle there. He could -not help it. And it maddened him to see, as he thought he saw, that -Becky Thatcher never once suspected that he was even in the land of the -living. But she did see, nevertheless; and she knew she was winning her -fight, too, and was glad to see him suffer as she had suffered. - -Amy's happy prattle became intolerable. Tom hinted at things he had to -attend to; things that must be done; and time was fleeting. But in -vain--the girl chirped on. Tom thought, "Oh, hang her, ain't I ever -going to get rid of her?" At last he must be attending to those -things--and she said artlessly that she would be "around" when school -let out. And he hastened away, hating her for it. - -"Any other boy!" Tom thought, grating his teeth. "Any boy in the whole -town but that Saint Louis smarty that thinks he dresses so fine and is -aristocracy! Oh, all right, I licked you the first day you ever saw -this town, mister, and I'll lick you again! You just wait till I catch -you out! I'll just take and--" - -And he went through the motions of thrashing an imaginary boy ---pummelling the air, and kicking and gouging. "Oh, you do, do you? You -holler 'nough, do you? Now, then, let that learn you!" And so the -imaginary flogging was finished to his satisfaction. - -Tom fled home at noon. His conscience could not endure any more of -Amy's grateful happiness, and his jealousy could bear no more of the -other distress. Becky resumed her picture inspections with Alfred, but -as the minutes dragged along and no Tom came to suffer, her triumph -began to cloud and she lost interest; gravity and absent-mindedness -followed, and then melancholy; two or three times she pricked up her -ear at a footstep, but it was a false hope; no Tom came. At last she -grew entirely miserable and wished she hadn't carried it so far. When -poor Alfred, seeing that he was losing her, he did not know how, kept -exclaiming: "Oh, here's a jolly one! look at this!" she lost patience -at last, and said, "Oh, don't bother me! I don't care for them!" and -burst into tears, and got up and walked away. - -Alfred dropped alongside and was going to try to comfort her, but she -said: - -"Go away and leave me alone, can't you! I hate you!" - -So the boy halted, wondering what he could have done--for she had said -she would look at pictures all through the nooning--and she walked on, -crying. Then Alfred went musing into the deserted schoolhouse. He was -humiliated and angry. He easily guessed his way to the truth--the girl -had simply made a convenience of him to vent her spite upon Tom Sawyer. -He was far from hating Tom the less when this thought occurred to him. -He wished there was some way to get that boy into trouble without much -risk to himself. Tom's spelling-book fell under his eye. Here was his -opportunity. He gratefully opened to the lesson for the afternoon and -poured ink upon the page. - -Becky, glancing in at a window behind him at the moment, saw the act, -and moved on, without discovering herself. She started homeward, now, -intending to find Tom and tell him; Tom would be thankful and their -troubles would be healed. Before she was half way home, however, she -had changed her mind. The thought of Tom's treatment of her when she -was talking about her picnic came scorching back and filled her with -shame. She resolved to let him get whipped on the damaged -spelling-book's account, and to hate him forever, into the bargain. - - - -CHAPTER XIX - -TOM arrived at home in a dreary mood, and the first thing his aunt -said to him showed him that he had brought his sorrows to an -unpromising market: - -"Tom, I've a notion to skin you alive!" - -"Auntie, what have I done?" - -"Well, you've done enough. Here I go over to Sereny Harper, like an -old softy, expecting I'm going to make her believe all that rubbage -about that dream, when lo and behold you she'd found out from Joe that -you was over here and heard all the talk we had that night. Tom, I -don't know what is to become of a boy that will act like that. It makes -me feel so bad to think you could let me go to Sereny Harper and make -such a fool of myself and never say a word." - -This was a new aspect of the thing. His smartness of the morning had -seemed to Tom a good joke before, and very ingenious. It merely looked -mean and shabby now. He hung his head and could not think of anything -to say for a moment. Then he said: - -"Auntie, I wish I hadn't done it--but I didn't think." - -"Oh, child, you never think. You never think of anything but your own -selfishness. You could think to come all the way over here from -Jackson's Island in the night to laugh at our troubles, and you could -think to fool me with a lie about a dream; but you couldn't ever think -to pity us and save us from sorrow." - -"Auntie, I know now it was mean, but I didn't mean to be mean. I -didn't, honest. And besides, I didn't come over here to laugh at you -that night." - -"What did you come for, then?" - -"It was to tell you not to be uneasy about us, because we hadn't got -drownded." - -"Tom, Tom, I would be the thankfullest soul in this world if I could -believe you ever had as good a thought as that, but you know you never -did--and I know it, Tom." - -"Indeed and 'deed I did, auntie--I wish I may never stir if I didn't." - -"Oh, Tom, don't lie--don't do it. It only makes things a hundred times -worse." - -"It ain't a lie, auntie; it's the truth. I wanted to keep you from -grieving--that was all that made me come." - -"I'd give the whole world to believe that--it would cover up a power -of sins, Tom. I'd 'most be glad you'd run off and acted so bad. But it -ain't reasonable; because, why didn't you tell me, child?" - -"Why, you see, when you got to talking about the funeral, I just got -all full of the idea of our coming and hiding in the church, and I -couldn't somehow bear to spoil it. So I just put the bark back in my -pocket and kept mum." - -"What bark?" - -"The bark I had wrote on to tell you we'd gone pirating. I wish, now, -you'd waked up when I kissed you--I do, honest." - -The hard lines in his aunt's face relaxed and a sudden tenderness -dawned in her eyes. - -"DID you kiss me, Tom?" - -"Why, yes, I did." - -"Are you sure you did, Tom?" - -"Why, yes, I did, auntie--certain sure." - -"What did you kiss me for, Tom?" - -"Because I loved you so, and you laid there moaning and I was so sorry." - -The words sounded like truth. The old lady could not hide a tremor in -her voice when she said: - -"Kiss me again, Tom!--and be off with you to school, now, and don't -bother me any more." - -The moment he was gone, she ran to a closet and got out the ruin of a -jacket which Tom had gone pirating in. Then she stopped, with it in her -hand, and said to herself: - -"No, I don't dare. Poor boy, I reckon he's lied about it--but it's a -blessed, blessed lie, there's such a comfort come from it. I hope the -Lord--I KNOW the Lord will forgive him, because it was such -goodheartedness in him to tell it. But I don't want to find out it's a -lie. I won't look." - -She put the jacket away, and stood by musing a minute. Twice she put -out her hand to take the garment again, and twice she refrained. Once -more she ventured, and this time she fortified herself with the -thought: "It's a good lie--it's a good lie--I won't let it grieve me." -So she sought the jacket pocket. A moment later she was reading Tom's -piece of bark through flowing tears and saying: "I could forgive the -boy, now, if he'd committed a million sins!" - - - -CHAPTER XX - -THERE was something about Aunt Polly's manner, when she kissed Tom, -that swept away his low spirits and made him lighthearted and happy -again. He started to school and had the luck of coming upon Becky -Thatcher at the head of Meadow Lane. His mood always determined his -manner. Without a moment's hesitation he ran to her and said: - -"I acted mighty mean to-day, Becky, and I'm so sorry. I won't ever, -ever do that way again, as long as ever I live--please make up, won't -you?" - -The girl stopped and looked him scornfully in the face: - -"I'll thank you to keep yourself TO yourself, Mr. Thomas Sawyer. I'll -never speak to you again." - -She tossed her head and passed on. Tom was so stunned that he had not -even presence of mind enough to say "Who cares, Miss Smarty?" until the -right time to say it had gone by. So he said nothing. But he was in a -fine rage, nevertheless. He moped into the schoolyard wishing she were -a boy, and imagining how he would trounce her if she were. He presently -encountered her and delivered a stinging remark as he passed. She -hurled one in return, and the angry breach was complete. It seemed to -Becky, in her hot resentment, that she could hardly wait for school to -"take in," she was so impatient to see Tom flogged for the injured -spelling-book. If she had had any lingering notion of exposing Alfred -Temple, Tom's offensive fling had driven it entirely away. - -Poor girl, she did not know how fast she was nearing trouble herself. -The master, Mr. Dobbins, had reached middle age with an unsatisfied -ambition. The darling of his desires was, to be a doctor, but poverty -had decreed that he should be nothing higher than a village -schoolmaster. Every day he took a mysterious book out of his desk and -absorbed himself in it at times when no classes were reciting. He kept -that book under lock and key. There was not an urchin in school but was -perishing to have a glimpse of it, but the chance never came. Every boy -and girl had a theory about the nature of that book; but no two -theories were alike, and there was no way of getting at the facts in -the case. Now, as Becky was passing by the desk, which stood near the -door, she noticed that the key was in the lock! It was a precious -moment. She glanced around; found herself alone, and the next instant -she had the book in her hands. The title-page--Professor Somebody's -ANATOMY--carried no information to her mind; so she began to turn the -leaves. She came at once upon a handsomely engraved and colored -frontispiece--a human figure, stark naked. At that moment a shadow fell -on the page and Tom Sawyer stepped in at the door and caught a glimpse -of the picture. Becky snatched at the book to close it, and had the -hard luck to tear the pictured page half down the middle. She thrust -the volume into the desk, turned the key, and burst out crying with -shame and vexation. - -"Tom Sawyer, you are just as mean as you can be, to sneak up on a -person and look at what they're looking at." - -"How could I know you was looking at anything?" - -"You ought to be ashamed of yourself, Tom Sawyer; you know you're -going to tell on me, and oh, what shall I do, what shall I do! I'll be -whipped, and I never was whipped in school." - -Then she stamped her little foot and said: - -"BE so mean if you want to! I know something that's going to happen. -You just wait and you'll see! Hateful, hateful, hateful!"--and she -flung out of the house with a new explosion of crying. - -Tom stood still, rather flustered by this onslaught. Presently he said -to himself: - -"What a curious kind of a fool a girl is! Never been licked in school! -Shucks! What's a licking! That's just like a girl--they're so -thin-skinned and chicken-hearted. Well, of course I ain't going to tell -old Dobbins on this little fool, because there's other ways of getting -even on her, that ain't so mean; but what of it? Old Dobbins will ask -who it was tore his book. Nobody'll answer. Then he'll do just the way -he always does--ask first one and then t'other, and when he comes to the -right girl he'll know it, without any telling. Girls' faces always tell -on them. They ain't got any backbone. She'll get licked. Well, it's a -kind of a tight place for Becky Thatcher, because there ain't any way -out of it." Tom conned the thing a moment longer, and then added: "All -right, though; she'd like to see me in just such a fix--let her sweat it -out!" - -Tom joined the mob of skylarking scholars outside. In a few moments -the master arrived and school "took in." Tom did not feel a strong -interest in his studies. Every time he stole a glance at the girls' -side of the room Becky's face troubled him. Considering all things, he -did not want to pity her, and yet it was all he could do to help it. He -could get up no exultation that was really worthy the name. Presently -the spelling-book discovery was made, and Tom's mind was entirely full -of his own matters for a while after that. Becky roused up from her -lethargy of distress and showed good interest in the proceedings. She -did not expect that Tom could get out of his trouble by denying that he -spilt the ink on the book himself; and she was right. The denial only -seemed to make the thing worse for Tom. Becky supposed she would be -glad of that, and she tried to believe she was glad of it, but she -found she was not certain. When the worst came to the worst, she had an -impulse to get up and tell on Alfred Temple, but she made an effort and -forced herself to keep still--because, said she to herself, "he'll tell -about me tearing the picture sure. I wouldn't say a word, not to save -his life!" - -Tom took his whipping and went back to his seat not at all -broken-hearted, for he thought it was possible that he had unknowingly -upset the ink on the spelling-book himself, in some skylarking bout--he -had denied it for form's sake and because it was custom, and had stuck -to the denial from principle. - -A whole hour drifted by, the master sat nodding in his throne, the air -was drowsy with the hum of study. By and by, Mr. Dobbins straightened -himself up, yawned, then unlocked his desk, and reached for his book, -but seemed undecided whether to take it out or leave it. Most of the -pupils glanced up languidly, but there were two among them that watched -his movements with intent eyes. Mr. Dobbins fingered his book absently -for a while, then took it out and settled himself in his chair to read! -Tom shot a glance at Becky. He had seen a hunted and helpless rabbit -look as she did, with a gun levelled at its head. Instantly he forgot -his quarrel with her. Quick--something must be done! done in a flash, -too! But the very imminence of the emergency paralyzed his invention. -Good!--he had an inspiration! He would run and snatch the book, spring -through the door and fly. But his resolution shook for one little -instant, and the chance was lost--the master opened the volume. If Tom -only had the wasted opportunity back again! Too late. There was no help -for Becky now, he said. The next moment the master faced the school. -Every eye sank under his gaze. There was that in it which smote even -the innocent with fear. There was silence while one might count ten ---the master was gathering his wrath. Then he spoke: "Who tore this book?" - -There was not a sound. One could have heard a pin drop. The stillness -continued; the master searched face after face for signs of guilt. - -"Benjamin Rogers, did you tear this book?" - -A denial. Another pause. - -"Joseph Harper, did you?" - -Another denial. Tom's uneasiness grew more and more intense under the -slow torture of these proceedings. The master scanned the ranks of -boys--considered a while, then turned to the girls: - -"Amy Lawrence?" - -A shake of the head. - -"Gracie Miller?" - -The same sign. - -"Susan Harper, did you do this?" - -Another negative. The next girl was Becky Thatcher. Tom was trembling -from head to foot with excitement and a sense of the hopelessness of -the situation. - -"Rebecca Thatcher" [Tom glanced at her face--it was white with terror] ---"did you tear--no, look me in the face" [her hands rose in appeal] ---"did you tear this book?" - -A thought shot like lightning through Tom's brain. He sprang to his -feet and shouted--"I done it!" - -The school stared in perplexity at this incredible folly. Tom stood a -moment, to gather his dismembered faculties; and when he stepped -forward to go to his punishment the surprise, the gratitude, the -adoration that shone upon him out of poor Becky's eyes seemed pay -enough for a hundred floggings. Inspired by the splendor of his own -act, he took without an outcry the most merciless flaying that even Mr. -Dobbins had ever administered; and also received with indifference the -added cruelty of a command to remain two hours after school should be -dismissed--for he knew who would wait for him outside till his -captivity was done, and not count the tedious time as loss, either. - -Tom went to bed that night planning vengeance against Alfred Temple; -for with shame and repentance Becky had told him all, not forgetting -her own treachery; but even the longing for vengeance had to give way, -soon, to pleasanter musings, and he fell asleep at last with Becky's -latest words lingering dreamily in his ear-- - -"Tom, how COULD you be so noble!" - - - -CHAPTER XXI - -VACATION was approaching. The schoolmaster, always severe, grew -severer and more exacting than ever, for he wanted the school to make a -good showing on "Examination" day. His rod and his ferule were seldom -idle now--at least among the smaller pupils. Only the biggest boys, and -young ladies of eighteen and twenty, escaped lashing. Mr. Dobbins' -lashings were very vigorous ones, too; for although he carried, under -his wig, a perfectly bald and shiny head, he had only reached middle -age, and there was no sign of feebleness in his muscle. As the great -day approached, all the tyranny that was in him came to the surface; he -seemed to take a vindictive pleasure in punishing the least -shortcomings. The consequence was, that the smaller boys spent their -days in terror and suffering and their nights in plotting revenge. They -threw away no opportunity to do the master a mischief. But he kept -ahead all the time. The retribution that followed every vengeful -success was so sweeping and majestic that the boys always retired from -the field badly worsted. At last they conspired together and hit upon a -plan that promised a dazzling victory. They swore in the sign-painter's -boy, told him the scheme, and asked his help. He had his own reasons -for being delighted, for the master boarded in his father's family and -had given the boy ample cause to hate him. The master's wife would go -on a visit to the country in a few days, and there would be nothing to -interfere with the plan; the master always prepared himself for great -occasions by getting pretty well fuddled, and the sign-painter's boy -said that when the dominie had reached the proper condition on -Examination Evening he would "manage the thing" while he napped in his -chair; then he would have him awakened at the right time and hurried -away to school. - -In the fulness of time the interesting occasion arrived. At eight in -the evening the schoolhouse was brilliantly lighted, and adorned with -wreaths and festoons of foliage and flowers. The master sat throned in -his great chair upon a raised platform, with his blackboard behind him. -He was looking tolerably mellow. Three rows of benches on each side and -six rows in front of him were occupied by the dignitaries of the town -and by the parents of the pupils. To his left, back of the rows of -citizens, was a spacious temporary platform upon which were seated the -scholars who were to take part in the exercises of the evening; rows of -small boys, washed and dressed to an intolerable state of discomfort; -rows of gawky big boys; snowbanks of girls and young ladies clad in -lawn and muslin and conspicuously conscious of their bare arms, their -grandmothers' ancient trinkets, their bits of pink and blue ribbon and -the flowers in their hair. All the rest of the house was filled with -non-participating scholars. - -The exercises began. A very little boy stood up and sheepishly -recited, "You'd scarce expect one of my age to speak in public on the -stage," etc.--accompanying himself with the painfully exact and -spasmodic gestures which a machine might have used--supposing the -machine to be a trifle out of order. But he got through safely, though -cruelly scared, and got a fine round of applause when he made his -manufactured bow and retired. - -A little shamefaced girl lisped, "Mary had a little lamb," etc., -performed a compassion-inspiring curtsy, got her meed of applause, and -sat down flushed and happy. - -Tom Sawyer stepped forward with conceited confidence and soared into -the unquenchable and indestructible "Give me liberty or give me death" -speech, with fine fury and frantic gesticulation, and broke down in the -middle of it. A ghastly stage-fright seized him, his legs quaked under -him and he was like to choke. True, he had the manifest sympathy of the -house but he had the house's silence, too, which was even worse than -its sympathy. The master frowned, and this completed the disaster. Tom -struggled awhile and then retired, utterly defeated. There was a weak -attempt at applause, but it died early. - -"The Boy Stood on the Burning Deck" followed; also "The Assyrian Came -Down," and other declamatory gems. Then there were reading exercises, -and a spelling fight. The meagre Latin class recited with honor. The -prime feature of the evening was in order, now--original "compositions" -by the young ladies. Each in her turn stepped forward to the edge of -the platform, cleared her throat, held up her manuscript (tied with -dainty ribbon), and proceeded to read, with labored attention to -"expression" and punctuation. The themes were the same that had been -illuminated upon similar occasions by their mothers before them, their -grandmothers, and doubtless all their ancestors in the female line -clear back to the Crusades. "Friendship" was one; "Memories of Other -Days"; "Religion in History"; "Dream Land"; "The Advantages of -Culture"; "Forms of Political Government Compared and Contrasted"; -"Melancholy"; "Filial Love"; "Heart Longings," etc., etc. - -A prevalent feature in these compositions was a nursed and petted -melancholy; another was a wasteful and opulent gush of "fine language"; -another was a tendency to lug in by the ears particularly prized words -and phrases until they were worn entirely out; and a peculiarity that -conspicuously marked and marred them was the inveterate and intolerable -sermon that wagged its crippled tail at the end of each and every one -of them. No matter what the subject might be, a brain-racking effort -was made to squirm it into some aspect or other that the moral and -religious mind could contemplate with edification. The glaring -insincerity of these sermons was not sufficient to compass the -banishment of the fashion from the schools, and it is not sufficient -to-day; it never will be sufficient while the world stands, perhaps. -There is no school in all our land where the young ladies do not feel -obliged to close their compositions with a sermon; and you will find -that the sermon of the most frivolous and the least religious girl in -the school is always the longest and the most relentlessly pious. But -enough of this. Homely truth is unpalatable. - -Let us return to the "Examination." The first composition that was -read was one entitled "Is this, then, Life?" Perhaps the reader can -endure an extract from it: - - "In the common walks of life, with what delightful - emotions does the youthful mind look forward to some - anticipated scene of festivity! Imagination is busy - sketching rose-tinted pictures of joy. In fancy, the - voluptuous votary of fashion sees herself amid the - festive throng, 'the observed of all observers.' Her - graceful form, arrayed in snowy robes, is whirling - through the mazes of the joyous dance; her eye is - brightest, her step is lightest in the gay assembly. - - "In such delicious fancies time quickly glides by, - and the welcome hour arrives for her entrance into - the Elysian world, of which she has had such bright - dreams. How fairy-like does everything appear to - her enchanted vision! Each new scene is more charming - than the last. But after a while she finds that - beneath this goodly exterior, all is vanity, the - flattery which once charmed her soul, now grates - harshly upon her ear; the ball-room has lost its - charms; and with wasted health and imbittered heart, - she turns away with the conviction that earthly - pleasures cannot satisfy the longings of the soul!" - -And so forth and so on. There was a buzz of gratification from time to -time during the reading, accompanied by whispered ejaculations of "How -sweet!" "How eloquent!" "So true!" etc., and after the thing had closed -with a peculiarly afflicting sermon the applause was enthusiastic. - -Then arose a slim, melancholy girl, whose face had the "interesting" -paleness that comes of pills and indigestion, and read a "poem." Two -stanzas of it will do: - - "A MISSOURI MAIDEN'S FAREWELL TO ALABAMA - - "Alabama, good-bye! I love thee well! - But yet for a while do I leave thee now! - Sad, yes, sad thoughts of thee my heart doth swell, - And burning recollections throng my brow! - For I have wandered through thy flowery woods; - Have roamed and read near Tallapoosa's stream; - Have listened to Tallassee's warring floods, - And wooed on Coosa's side Aurora's beam. - - "Yet shame I not to bear an o'er-full heart, - Nor blush to turn behind my tearful eyes; - 'Tis from no stranger land I now must part, - 'Tis to no strangers left I yield these sighs. - Welcome and home were mine within this State, - Whose vales I leave--whose spires fade fast from me - And cold must be mine eyes, and heart, and tete, - When, dear Alabama! they turn cold on thee!" - -There were very few there who knew what "tete" meant, but the poem was -very satisfactory, nevertheless. - -Next appeared a dark-complexioned, black-eyed, black-haired young -lady, who paused an impressive moment, assumed a tragic expression, and -began to read in a measured, solemn tone: - - "A VISION - - "Dark and tempestuous was night. Around the - throne on high not a single star quivered; but - the deep intonations of the heavy thunder - constantly vibrated upon the ear; whilst the - terrific lightning revelled in angry mood - through the cloudy chambers of heaven, seeming - to scorn the power exerted over its terror by - the illustrious Franklin! Even the boisterous - winds unanimously came forth from their mystic - homes, and blustered about as if to enhance by - their aid the wildness of the scene. - - "At such a time, so dark, so dreary, for human - sympathy my very spirit sighed; but instead thereof, - - "'My dearest friend, my counsellor, my comforter - and guide--My joy in grief, my second bliss - in joy,' came to my side. She moved like one of - those bright beings pictured in the sunny walks - of fancy's Eden by the romantic and young, a - queen of beauty unadorned save by her own - transcendent loveliness. So soft was her step, it - failed to make even a sound, and but for the - magical thrill imparted by her genial touch, as - other unobtrusive beauties, she would have glided - away un-perceived--unsought. A strange sadness - rested upon her features, like icy tears upon - the robe of December, as she pointed to the - contending elements without, and bade me contemplate - the two beings presented." - -This nightmare occupied some ten pages of manuscript and wound up with -a sermon so destructive of all hope to non-Presbyterians that it took -the first prize. This composition was considered to be the very finest -effort of the evening. The mayor of the village, in delivering the -prize to the author of it, made a warm speech in which he said that it -was by far the most "eloquent" thing he had ever listened to, and that -Daniel Webster himself might well be proud of it. - -It may be remarked, in passing, that the number of compositions in -which the word "beauteous" was over-fondled, and human experience -referred to as "life's page," was up to the usual average. - -Now the master, mellow almost to the verge of geniality, put his chair -aside, turned his back to the audience, and began to draw a map of -America on the blackboard, to exercise the geography class upon. But he -made a sad business of it with his unsteady hand, and a smothered -titter rippled over the house. He knew what the matter was, and set -himself to right it. He sponged out lines and remade them; but he only -distorted them more than ever, and the tittering was more pronounced. -He threw his entire attention upon his work, now, as if determined not -to be put down by the mirth. He felt that all eyes were fastened upon -him; he imagined he was succeeding, and yet the tittering continued; it -even manifestly increased. And well it might. There was a garret above, -pierced with a scuttle over his head; and down through this scuttle -came a cat, suspended around the haunches by a string; she had a rag -tied about her head and jaws to keep her from mewing; as she slowly -descended she curved upward and clawed at the string, she swung -downward and clawed at the intangible air. The tittering rose higher -and higher--the cat was within six inches of the absorbed teacher's -head--down, down, a little lower, and she grabbed his wig with her -desperate claws, clung to it, and was snatched up into the garret in an -instant with her trophy still in her possession! And how the light did -blaze abroad from the master's bald pate--for the sign-painter's boy -had GILDED it! - -That broke up the meeting. The boys were avenged. Vacation had come. - - NOTE:--The pretended "compositions" quoted in - this chapter are taken without alteration from a - volume entitled "Prose and Poetry, by a Western - Lady"--but they are exactly and precisely after - the schoolgirl pattern, and hence are much - happier than any mere imitations could be. - - - -CHAPTER XXII - -TOM joined the new order of Cadets of Temperance, being attracted by -the showy character of their "regalia." He promised to abstain from -smoking, chewing, and profanity as long as he remained a member. Now he -found out a new thing--namely, that to promise not to do a thing is the -surest way in the world to make a body want to go and do that very -thing. Tom soon found himself tormented with a desire to drink and -swear; the desire grew to be so intense that nothing but the hope of a -chance to display himself in his red sash kept him from withdrawing -from the order. Fourth of July was coming; but he soon gave that up ---gave it up before he had worn his shackles over forty-eight hours--and -fixed his hopes upon old Judge Frazer, justice of the peace, who was -apparently on his deathbed and would have a big public funeral, since -he was so high an official. During three days Tom was deeply concerned -about the Judge's condition and hungry for news of it. Sometimes his -hopes ran high--so high that he would venture to get out his regalia -and practise before the looking-glass. But the Judge had a most -discouraging way of fluctuating. At last he was pronounced upon the -mend--and then convalescent. Tom was disgusted; and felt a sense of -injury, too. He handed in his resignation at once--and that night the -Judge suffered a relapse and died. Tom resolved that he would never -trust a man like that again. - -The funeral was a fine thing. The Cadets paraded in a style calculated -to kill the late member with envy. Tom was a free boy again, however ---there was something in that. He could drink and swear, now--but found -to his surprise that he did not want to. The simple fact that he could, -took the desire away, and the charm of it. - -Tom presently wondered to find that his coveted vacation was beginning -to hang a little heavily on his hands. - -He attempted a diary--but nothing happened during three days, and so -he abandoned it. - -The first of all the negro minstrel shows came to town, and made a -sensation. Tom and Joe Harper got up a band of performers and were -happy for two days. - -Even the Glorious Fourth was in some sense a failure, for it rained -hard, there was no procession in consequence, and the greatest man in -the world (as Tom supposed), Mr. Benton, an actual United States -Senator, proved an overwhelming disappointment--for he was not -twenty-five feet high, nor even anywhere in the neighborhood of it. - -A circus came. The boys played circus for three days afterward in -tents made of rag carpeting--admission, three pins for boys, two for -girls--and then circusing was abandoned. - -A phrenologist and a mesmerizer came--and went again and left the -village duller and drearier than ever. - -There were some boys-and-girls' parties, but they were so few and so -delightful that they only made the aching voids between ache the harder. - -Becky Thatcher was gone to her Constantinople home to stay with her -parents during vacation--so there was no bright side to life anywhere. - -The dreadful secret of the murder was a chronic misery. It was a very -cancer for permanency and pain. - -Then came the measles. - -During two long weeks Tom lay a prisoner, dead to the world and its -happenings. He was very ill, he was interested in nothing. When he got -upon his feet at last and moved feebly down-town, a melancholy change -had come over everything and every creature. There had been a -"revival," and everybody had "got religion," not only the adults, but -even the boys and girls. Tom went about, hoping against hope for the -sight of one blessed sinful face, but disappointment crossed him -everywhere. He found Joe Harper studying a Testament, and turned sadly -away from the depressing spectacle. He sought Ben Rogers, and found him -visiting the poor with a basket of tracts. He hunted up Jim Hollis, who -called his attention to the precious blessing of his late measles as a -warning. Every boy he encountered added another ton to his depression; -and when, in desperation, he flew for refuge at last to the bosom of -Huckleberry Finn and was received with a Scriptural quotation, his -heart broke and he crept home and to bed realizing that he alone of all -the town was lost, forever and forever. - -And that night there came on a terrific storm, with driving rain, -awful claps of thunder and blinding sheets of lightning. He covered his -head with the bedclothes and waited in a horror of suspense for his -doom; for he had not the shadow of a doubt that all this hubbub was -about him. He believed he had taxed the forbearance of the powers above -to the extremity of endurance and that this was the result. It might -have seemed to him a waste of pomp and ammunition to kill a bug with a -battery of artillery, but there seemed nothing incongruous about the -getting up such an expensive thunderstorm as this to knock the turf -from under an insect like himself. - -By and by the tempest spent itself and died without accomplishing its -object. The boy's first impulse was to be grateful, and reform. His -second was to wait--for there might not be any more storms. - -The next day the doctors were back; Tom had relapsed. The three weeks -he spent on his back this time seemed an entire age. When he got abroad -at last he was hardly grateful that he had been spared, remembering how -lonely was his estate, how companionless and forlorn he was. He drifted -listlessly down the street and found Jim Hollis acting as judge in a -juvenile court that was trying a cat for murder, in the presence of her -victim, a bird. He found Joe Harper and Huck Finn up an alley eating a -stolen melon. Poor lads! they--like Tom--had suffered a relapse. - - - -CHAPTER XXIII - -AT last the sleepy atmosphere was stirred--and vigorously: the murder -trial came on in the court. It became the absorbing topic of village -talk immediately. Tom could not get away from it. Every reference to -the murder sent a shudder to his heart, for his troubled conscience and -fears almost persuaded him that these remarks were put forth in his -hearing as "feelers"; he did not see how he could be suspected of -knowing anything about the murder, but still he could not be -comfortable in the midst of this gossip. It kept him in a cold shiver -all the time. He took Huck to a lonely place to have a talk with him. -It would be some relief to unseal his tongue for a little while; to -divide his burden of distress with another sufferer. Moreover, he -wanted to assure himself that Huck had remained discreet. - -"Huck, have you ever told anybody about--that?" - -"'Bout what?" - -"You know what." - -"Oh--'course I haven't." - -"Never a word?" - -"Never a solitary word, so help me. What makes you ask?" - -"Well, I was afeard." - -"Why, Tom Sawyer, we wouldn't be alive two days if that got found out. -YOU know that." - -Tom felt more comfortable. After a pause: - -"Huck, they couldn't anybody get you to tell, could they?" - -"Get me to tell? Why, if I wanted that half-breed devil to drownd me -they could get me to tell. They ain't no different way." - -"Well, that's all right, then. I reckon we're safe as long as we keep -mum. But let's swear again, anyway. It's more surer." - -"I'm agreed." - -So they swore again with dread solemnities. - -"What is the talk around, Huck? I've heard a power of it." - -"Talk? Well, it's just Muff Potter, Muff Potter, Muff Potter all the -time. It keeps me in a sweat, constant, so's I want to hide som'ers." - -"That's just the same way they go on round me. I reckon he's a goner. -Don't you feel sorry for him, sometimes?" - -"Most always--most always. He ain't no account; but then he hain't -ever done anything to hurt anybody. Just fishes a little, to get money -to get drunk on--and loafs around considerable; but lord, we all do -that--leastways most of us--preachers and such like. But he's kind of -good--he give me half a fish, once, when there warn't enough for two; -and lots of times he's kind of stood by me when I was out of luck." - -"Well, he's mended kites for me, Huck, and knitted hooks on to my -line. I wish we could get him out of there." - -"My! we couldn't get him out, Tom. And besides, 'twouldn't do any -good; they'd ketch him again." - -"Yes--so they would. But I hate to hear 'em abuse him so like the -dickens when he never done--that." - -"I do too, Tom. Lord, I hear 'em say he's the bloodiest looking -villain in this country, and they wonder he wasn't ever hung before." - -"Yes, they talk like that, all the time. I've heard 'em say that if he -was to get free they'd lynch him." - -"And they'd do it, too." - -The boys had a long talk, but it brought them little comfort. As the -twilight drew on, they found themselves hanging about the neighborhood -of the little isolated jail, perhaps with an undefined hope that -something would happen that might clear away their difficulties. But -nothing happened; there seemed to be no angels or fairies interested in -this luckless captive. - -The boys did as they had often done before--went to the cell grating -and gave Potter some tobacco and matches. He was on the ground floor -and there were no guards. - -His gratitude for their gifts had always smote their consciences -before--it cut deeper than ever, this time. They felt cowardly and -treacherous to the last degree when Potter said: - -"You've been mighty good to me, boys--better'n anybody else in this -town. And I don't forget it, I don't. Often I says to myself, says I, -'I used to mend all the boys' kites and things, and show 'em where the -good fishin' places was, and befriend 'em what I could, and now they've -all forgot old Muff when he's in trouble; but Tom don't, and Huck -don't--THEY don't forget him, says I, 'and I don't forget them.' Well, -boys, I done an awful thing--drunk and crazy at the time--that's the -only way I account for it--and now I got to swing for it, and it's -right. Right, and BEST, too, I reckon--hope so, anyway. Well, we won't -talk about that. I don't want to make YOU feel bad; you've befriended -me. But what I want to say, is, don't YOU ever get drunk--then you won't -ever get here. Stand a litter furder west--so--that's it; it's a prime -comfort to see faces that's friendly when a body's in such a muck of -trouble, and there don't none come here but yourn. Good friendly -faces--good friendly faces. Git up on one another's backs and let me -touch 'em. That's it. Shake hands--yourn'll come through the bars, but -mine's too big. Little hands, and weak--but they've helped Muff Potter -a power, and they'd help him more if they could." - -Tom went home miserable, and his dreams that night were full of -horrors. The next day and the day after, he hung about the court-room, -drawn by an almost irresistible impulse to go in, but forcing himself -to stay out. Huck was having the same experience. They studiously -avoided each other. Each wandered away, from time to time, but the same -dismal fascination always brought them back presently. Tom kept his -ears open when idlers sauntered out of the court-room, but invariably -heard distressing news--the toils were closing more and more -relentlessly around poor Potter. At the end of the second day the -village talk was to the effect that Injun Joe's evidence stood firm and -unshaken, and that there was not the slightest question as to what the -jury's verdict would be. - -Tom was out late, that night, and came to bed through the window. He -was in a tremendous state of excitement. It was hours before he got to -sleep. All the village flocked to the court-house the next morning, for -this was to be the great day. Both sexes were about equally represented -in the packed audience. After a long wait the jury filed in and took -their places; shortly afterward, Potter, pale and haggard, timid and -hopeless, was brought in, with chains upon him, and seated where all -the curious eyes could stare at him; no less conspicuous was Injun Joe, -stolid as ever. There was another pause, and then the judge arrived and -the sheriff proclaimed the opening of the court. The usual whisperings -among the lawyers and gathering together of papers followed. These -details and accompanying delays worked up an atmosphere of preparation -that was as impressive as it was fascinating. - -Now a witness was called who testified that he found Muff Potter -washing in the brook, at an early hour of the morning that the murder -was discovered, and that he immediately sneaked away. After some -further questioning, counsel for the prosecution said: - -"Take the witness." - -The prisoner raised his eyes for a moment, but dropped them again when -his own counsel said: - -"I have no questions to ask him." - -The next witness proved the finding of the knife near the corpse. -Counsel for the prosecution said: - -"Take the witness." - -"I have no questions to ask him," Potter's lawyer replied. - -A third witness swore he had often seen the knife in Potter's -possession. - -"Take the witness." - -Counsel for Potter declined to question him. The faces of the audience -began to betray annoyance. Did this attorney mean to throw away his -client's life without an effort? - -Several witnesses deposed concerning Potter's guilty behavior when -brought to the scene of the murder. They were allowed to leave the -stand without being cross-questioned. - -Every detail of the damaging circumstances that occurred in the -graveyard upon that morning which all present remembered so well was -brought out by credible witnesses, but none of them were cross-examined -by Potter's lawyer. The perplexity and dissatisfaction of the house -expressed itself in murmurs and provoked a reproof from the bench. -Counsel for the prosecution now said: - -"By the oaths of citizens whose simple word is above suspicion, we -have fastened this awful crime, beyond all possibility of question, -upon the unhappy prisoner at the bar. We rest our case here." - -A groan escaped from poor Potter, and he put his face in his hands and -rocked his body softly to and fro, while a painful silence reigned in -the court-room. Many men were moved, and many women's compassion -testified itself in tears. Counsel for the defence rose and said: - -"Your honor, in our remarks at the opening of this trial, we -foreshadowed our purpose to prove that our client did this fearful deed -while under the influence of a blind and irresponsible delirium -produced by drink. We have changed our mind. We shall not offer that -plea." [Then to the clerk:] "Call Thomas Sawyer!" - -A puzzled amazement awoke in every face in the house, not even -excepting Potter's. Every eye fastened itself with wondering interest -upon Tom as he rose and took his place upon the stand. The boy looked -wild enough, for he was badly scared. The oath was administered. - -"Thomas Sawyer, where were you on the seventeenth of June, about the -hour of midnight?" - -Tom glanced at Injun Joe's iron face and his tongue failed him. The -audience listened breathless, but the words refused to come. After a -few moments, however, the boy got a little of his strength back, and -managed to put enough of it into his voice to make part of the house -hear: - -"In the graveyard!" - -"A little bit louder, please. Don't be afraid. You were--" - -"In the graveyard." - -A contemptuous smile flitted across Injun Joe's face. - -"Were you anywhere near Horse Williams' grave?" - -"Yes, sir." - -"Speak up--just a trifle louder. How near were you?" - -"Near as I am to you." - -"Were you hidden, or not?" - -"I was hid." - -"Where?" - -"Behind the elms that's on the edge of the grave." - -Injun Joe gave a barely perceptible start. - -"Any one with you?" - -"Yes, sir. I went there with--" - -"Wait--wait a moment. Never mind mentioning your companion's name. We -will produce him at the proper time. Did you carry anything there with -you." - -Tom hesitated and looked confused. - -"Speak out, my boy--don't be diffident. The truth is always -respectable. What did you take there?" - -"Only a--a--dead cat." - -There was a ripple of mirth, which the court checked. - -"We will produce the skeleton of that cat. Now, my boy, tell us -everything that occurred--tell it in your own way--don't skip anything, -and don't be afraid." - -Tom began--hesitatingly at first, but as he warmed to his subject his -words flowed more and more easily; in a little while every sound ceased -but his own voice; every eye fixed itself upon him; with parted lips -and bated breath the audience hung upon his words, taking no note of -time, rapt in the ghastly fascinations of the tale. The strain upon -pent emotion reached its climax when the boy said: - -"--and as the doctor fetched the board around and Muff Potter fell, -Injun Joe jumped with the knife and--" - -Crash! Quick as lightning the half-breed sprang for a window, tore his -way through all opposers, and was gone! - - - -CHAPTER XXIV - -TOM was a glittering hero once more--the pet of the old, the envy of -the young. His name even went into immortal print, for the village -paper magnified him. There were some that believed he would be -President, yet, if he escaped hanging. - -As usual, the fickle, unreasoning world took Muff Potter to its bosom -and fondled him as lavishly as it had abused him before. But that sort -of conduct is to the world's credit; therefore it is not well to find -fault with it. - -Tom's days were days of splendor and exultation to him, but his nights -were seasons of horror. Injun Joe infested all his dreams, and always -with doom in his eye. Hardly any temptation could persuade the boy to -stir abroad after nightfall. Poor Huck was in the same state of -wretchedness and terror, for Tom had told the whole story to the lawyer -the night before the great day of the trial, and Huck was sore afraid -that his share in the business might leak out, yet, notwithstanding -Injun Joe's flight had saved him the suffering of testifying in court. -The poor fellow had got the attorney to promise secrecy, but what of -that? Since Tom's harassed conscience had managed to drive him to the -lawyer's house by night and wring a dread tale from lips that had been -sealed with the dismalest and most formidable of oaths, Huck's -confidence in the human race was well-nigh obliterated. - -Daily Muff Potter's gratitude made Tom glad he had spoken; but nightly -he wished he had sealed up his tongue. - -Half the time Tom was afraid Injun Joe would never be captured; the -other half he was afraid he would be. He felt sure he never could draw -a safe breath again until that man was dead and he had seen the corpse. - -Rewards had been offered, the country had been scoured, but no Injun -Joe was found. One of those omniscient and awe-inspiring marvels, a -detective, came up from St. Louis, moused around, shook his head, -looked wise, and made that sort of astounding success which members of -that craft usually achieve. That is to say, he "found a clew." But you -can't hang a "clew" for murder, and so after that detective had got -through and gone home, Tom felt just as insecure as he was before. - -The slow days drifted on, and each left behind it a slightly lightened -weight of apprehension. - - - -CHAPTER XXV - -THERE comes a time in every rightly-constructed boy's life when he has -a raging desire to go somewhere and dig for hidden treasure. This -desire suddenly came upon Tom one day. He sallied out to find Joe -Harper, but failed of success. Next he sought Ben Rogers; he had gone -fishing. Presently he stumbled upon Huck Finn the Red-Handed. Huck -would answer. Tom took him to a private place and opened the matter to -him confidentially. Huck was willing. Huck was always willing to take a -hand in any enterprise that offered entertainment and required no -capital, for he had a troublesome superabundance of that sort of time -which is not money. "Where'll we dig?" said Huck. - -"Oh, most anywhere." - -"Why, is it hid all around?" - -"No, indeed it ain't. It's hid in mighty particular places, Huck ---sometimes on islands, sometimes in rotten chests under the end of a -limb of an old dead tree, just where the shadow falls at midnight; but -mostly under the floor in ha'nted houses." - -"Who hides it?" - -"Why, robbers, of course--who'd you reckon? Sunday-school -sup'rintendents?" - -"I don't know. If 'twas mine I wouldn't hide it; I'd spend it and have -a good time." - -"So would I. But robbers don't do that way. They always hide it and -leave it there." - -"Don't they come after it any more?" - -"No, they think they will, but they generally forget the marks, or -else they die. Anyway, it lays there a long time and gets rusty; and by -and by somebody finds an old yellow paper that tells how to find the -marks--a paper that's got to be ciphered over about a week because it's -mostly signs and hy'roglyphics." - -"Hyro--which?" - -"Hy'roglyphics--pictures and things, you know, that don't seem to mean -anything." - -"Have you got one of them papers, Tom?" - -"No." - -"Well then, how you going to find the marks?" - -"I don't want any marks. They always bury it under a ha'nted house or -on an island, or under a dead tree that's got one limb sticking out. -Well, we've tried Jackson's Island a little, and we can try it again -some time; and there's the old ha'nted house up the Still-House branch, -and there's lots of dead-limb trees--dead loads of 'em." - -"Is it under all of them?" - -"How you talk! No!" - -"Then how you going to know which one to go for?" - -"Go for all of 'em!" - -"Why, Tom, it'll take all summer." - -"Well, what of that? Suppose you find a brass pot with a hundred -dollars in it, all rusty and gray, or rotten chest full of di'monds. -How's that?" - -Huck's eyes glowed. - -"That's bully. Plenty bully enough for me. Just you gimme the hundred -dollars and I don't want no di'monds." - -"All right. But I bet you I ain't going to throw off on di'monds. Some -of 'em's worth twenty dollars apiece--there ain't any, hardly, but's -worth six bits or a dollar." - -"No! Is that so?" - -"Cert'nly--anybody'll tell you so. Hain't you ever seen one, Huck?" - -"Not as I remember." - -"Oh, kings have slathers of them." - -"Well, I don' know no kings, Tom." - -"I reckon you don't. But if you was to go to Europe you'd see a raft -of 'em hopping around." - -"Do they hop?" - -"Hop?--your granny! No!" - -"Well, what did you say they did, for?" - -"Shucks, I only meant you'd SEE 'em--not hopping, of course--what do -they want to hop for?--but I mean you'd just see 'em--scattered around, -you know, in a kind of a general way. Like that old humpbacked Richard." - -"Richard? What's his other name?" - -"He didn't have any other name. Kings don't have any but a given name." - -"No?" - -"But they don't." - -"Well, if they like it, Tom, all right; but I don't want to be a king -and have only just a given name, like a nigger. But say--where you -going to dig first?" - -"Well, I don't know. S'pose we tackle that old dead-limb tree on the -hill t'other side of Still-House branch?" - -"I'm agreed." - -So they got a crippled pick and a shovel, and set out on their -three-mile tramp. They arrived hot and panting, and threw themselves -down in the shade of a neighboring elm to rest and have a smoke. - -"I like this," said Tom. - -"So do I." - -"Say, Huck, if we find a treasure here, what you going to do with your -share?" - -"Well, I'll have pie and a glass of soda every day, and I'll go to -every circus that comes along. I bet I'll have a gay time." - -"Well, ain't you going to save any of it?" - -"Save it? What for?" - -"Why, so as to have something to live on, by and by." - -"Oh, that ain't any use. Pap would come back to thish-yer town some -day and get his claws on it if I didn't hurry up, and I tell you he'd -clean it out pretty quick. What you going to do with yourn, Tom?" - -"I'm going to buy a new drum, and a sure-'nough sword, and a red -necktie and a bull pup, and get married." - -"Married!" - -"That's it." - -"Tom, you--why, you ain't in your right mind." - -"Wait--you'll see." - -"Well, that's the foolishest thing you could do. Look at pap and my -mother. Fight! Why, they used to fight all the time. I remember, mighty -well." - -"That ain't anything. The girl I'm going to marry won't fight." - -"Tom, I reckon they're all alike. They'll all comb a body. Now you -better think 'bout this awhile. I tell you you better. What's the name -of the gal?" - -"It ain't a gal at all--it's a girl." - -"It's all the same, I reckon; some says gal, some says girl--both's -right, like enough. Anyway, what's her name, Tom?" - -"I'll tell you some time--not now." - -"All right--that'll do. Only if you get married I'll be more lonesomer -than ever." - -"No you won't. You'll come and live with me. Now stir out of this and -we'll go to digging." - -They worked and sweated for half an hour. No result. They toiled -another half-hour. Still no result. Huck said: - -"Do they always bury it as deep as this?" - -"Sometimes--not always. Not generally. I reckon we haven't got the -right place." - -So they chose a new spot and began again. The labor dragged a little, -but still they made progress. They pegged away in silence for some -time. Finally Huck leaned on his shovel, swabbed the beaded drops from -his brow with his sleeve, and said: - -"Where you going to dig next, after we get this one?" - -"I reckon maybe we'll tackle the old tree that's over yonder on -Cardiff Hill back of the widow's." - -"I reckon that'll be a good one. But won't the widow take it away from -us, Tom? It's on her land." - -"SHE take it away! Maybe she'd like to try it once. Whoever finds one -of these hid treasures, it belongs to him. It don't make any difference -whose land it's on." - -That was satisfactory. The work went on. By and by Huck said: - -"Blame it, we must be in the wrong place again. What do you think?" - -"It is mighty curious, Huck. I don't understand it. Sometimes witches -interfere. I reckon maybe that's what's the trouble now." - -"Shucks! Witches ain't got no power in the daytime." - -"Well, that's so. I didn't think of that. Oh, I know what the matter -is! What a blamed lot of fools we are! You got to find out where the -shadow of the limb falls at midnight, and that's where you dig!" - -"Then consound it, we've fooled away all this work for nothing. Now -hang it all, we got to come back in the night. It's an awful long way. -Can you get out?" - -"I bet I will. We've got to do it to-night, too, because if somebody -sees these holes they'll know in a minute what's here and they'll go -for it." - -"Well, I'll come around and maow to-night." - -"All right. Let's hide the tools in the bushes." - -The boys were there that night, about the appointed time. They sat in -the shadow waiting. It was a lonely place, and an hour made solemn by -old traditions. Spirits whispered in the rustling leaves, ghosts lurked -in the murky nooks, the deep baying of a hound floated up out of the -distance, an owl answered with his sepulchral note. The boys were -subdued by these solemnities, and talked little. By and by they judged -that twelve had come; they marked where the shadow fell, and began to -dig. Their hopes commenced to rise. Their interest grew stronger, and -their industry kept pace with it. The hole deepened and still deepened, -but every time their hearts jumped to hear the pick strike upon -something, they only suffered a new disappointment. It was only a stone -or a chunk. At last Tom said: - -"It ain't any use, Huck, we're wrong again." - -"Well, but we CAN'T be wrong. We spotted the shadder to a dot." - -"I know it, but then there's another thing." - -"What's that?". - -"Why, we only guessed at the time. Like enough it was too late or too -early." - -Huck dropped his shovel. - -"That's it," said he. "That's the very trouble. We got to give this -one up. We can't ever tell the right time, and besides this kind of -thing's too awful, here this time of night with witches and ghosts -a-fluttering around so. I feel as if something's behind me all the time; -and I'm afeard to turn around, becuz maybe there's others in front -a-waiting for a chance. I been creeping all over, ever since I got here." - -"Well, I've been pretty much so, too, Huck. They most always put in a -dead man when they bury a treasure under a tree, to look out for it." - -"Lordy!" - -"Yes, they do. I've always heard that." - -"Tom, I don't like to fool around much where there's dead people. A -body's bound to get into trouble with 'em, sure." - -"I don't like to stir 'em up, either. S'pose this one here was to -stick his skull out and say something!" - -"Don't Tom! It's awful." - -"Well, it just is. Huck, I don't feel comfortable a bit." - -"Say, Tom, let's give this place up, and try somewheres else." - -"All right, I reckon we better." - -"What'll it be?" - -Tom considered awhile; and then said: - -"The ha'nted house. That's it!" - -"Blame it, I don't like ha'nted houses, Tom. Why, they're a dern sight -worse'n dead people. Dead people might talk, maybe, but they don't come -sliding around in a shroud, when you ain't noticing, and peep over your -shoulder all of a sudden and grit their teeth, the way a ghost does. I -couldn't stand such a thing as that, Tom--nobody could." - -"Yes, but, Huck, ghosts don't travel around only at night. They won't -hender us from digging there in the daytime." - -"Well, that's so. But you know mighty well people don't go about that -ha'nted house in the day nor the night." - -"Well, that's mostly because they don't like to go where a man's been -murdered, anyway--but nothing's ever been seen around that house except -in the night--just some blue lights slipping by the windows--no regular -ghosts." - -"Well, where you see one of them blue lights flickering around, Tom, -you can bet there's a ghost mighty close behind it. It stands to -reason. Becuz you know that they don't anybody but ghosts use 'em." - -"Yes, that's so. But anyway they don't come around in the daytime, so -what's the use of our being afeard?" - -"Well, all right. We'll tackle the ha'nted house if you say so--but I -reckon it's taking chances." - -They had started down the hill by this time. There in the middle of -the moonlit valley below them stood the "ha'nted" house, utterly -isolated, its fences gone long ago, rank weeds smothering the very -doorsteps, the chimney crumbled to ruin, the window-sashes vacant, a -corner of the roof caved in. The boys gazed awhile, half expecting to -see a blue light flit past a window; then talking in a low tone, as -befitted the time and the circumstances, they struck far off to the -right, to give the haunted house a wide berth, and took their way -homeward through the woods that adorned the rearward side of Cardiff -Hill. - - - -CHAPTER XXVI - -ABOUT noon the next day the boys arrived at the dead tree; they had -come for their tools. Tom was impatient to go to the haunted house; -Huck was measurably so, also--but suddenly said: - -"Lookyhere, Tom, do you know what day it is?" - -Tom mentally ran over the days of the week, and then quickly lifted -his eyes with a startled look in them-- - -"My! I never once thought of it, Huck!" - -"Well, I didn't neither, but all at once it popped onto me that it was -Friday." - -"Blame it, a body can't be too careful, Huck. We might 'a' got into an -awful scrape, tackling such a thing on a Friday." - -"MIGHT! Better say we WOULD! There's some lucky days, maybe, but -Friday ain't." - -"Any fool knows that. I don't reckon YOU was the first that found it -out, Huck." - -"Well, I never said I was, did I? And Friday ain't all, neither. I had -a rotten bad dream last night--dreampt about rats." - -"No! Sure sign of trouble. Did they fight?" - -"No." - -"Well, that's good, Huck. When they don't fight it's only a sign that -there's trouble around, you know. All we got to do is to look mighty -sharp and keep out of it. We'll drop this thing for to-day, and play. -Do you know Robin Hood, Huck?" - -"No. Who's Robin Hood?" - -"Why, he was one of the greatest men that was ever in England--and the -best. He was a robber." - -"Cracky, I wisht I was. Who did he rob?" - -"Only sheriffs and bishops and rich people and kings, and such like. -But he never bothered the poor. He loved 'em. He always divided up with -'em perfectly square." - -"Well, he must 'a' been a brick." - -"I bet you he was, Huck. Oh, he was the noblest man that ever was. -They ain't any such men now, I can tell you. He could lick any man in -England, with one hand tied behind him; and he could take his yew bow -and plug a ten-cent piece every time, a mile and a half." - -"What's a YEW bow?" - -"I don't know. It's some kind of a bow, of course. And if he hit that -dime only on the edge he would set down and cry--and curse. But we'll -play Robin Hood--it's nobby fun. I'll learn you." - -"I'm agreed." - -So they played Robin Hood all the afternoon, now and then casting a -yearning eye down upon the haunted house and passing a remark about the -morrow's prospects and possibilities there. As the sun began to sink -into the west they took their way homeward athwart the long shadows of -the trees and soon were buried from sight in the forests of Cardiff -Hill. - -On Saturday, shortly after noon, the boys were at the dead tree again. -They had a smoke and a chat in the shade, and then dug a little in -their last hole, not with great hope, but merely because Tom said there -were so many cases where people had given up a treasure after getting -down within six inches of it, and then somebody else had come along and -turned it up with a single thrust of a shovel. The thing failed this -time, however, so the boys shouldered their tools and went away feeling -that they had not trifled with fortune, but had fulfilled all the -requirements that belong to the business of treasure-hunting. - -When they reached the haunted house there was something so weird and -grisly about the dead silence that reigned there under the baking sun, -and something so depressing about the loneliness and desolation of the -place, that they were afraid, for a moment, to venture in. Then they -crept to the door and took a trembling peep. They saw a weed-grown, -floorless room, unplastered, an ancient fireplace, vacant windows, a -ruinous staircase; and here, there, and everywhere hung ragged and -abandoned cobwebs. They presently entered, softly, with quickened -pulses, talking in whispers, ears alert to catch the slightest sound, -and muscles tense and ready for instant retreat. - -In a little while familiarity modified their fears and they gave the -place a critical and interested examination, rather admiring their own -boldness, and wondering at it, too. Next they wanted to look up-stairs. -This was something like cutting off retreat, but they got to daring -each other, and of course there could be but one result--they threw -their tools into a corner and made the ascent. Up there were the same -signs of decay. In one corner they found a closet that promised -mystery, but the promise was a fraud--there was nothing in it. Their -courage was up now and well in hand. They were about to go down and -begin work when-- - -"Sh!" said Tom. - -"What is it?" whispered Huck, blanching with fright. - -"Sh!... There!... Hear it?" - -"Yes!... Oh, my! Let's run!" - -"Keep still! Don't you budge! They're coming right toward the door." - -The boys stretched themselves upon the floor with their eyes to -knot-holes in the planking, and lay waiting, in a misery of fear. - -"They've stopped.... No--coming.... Here they are. Don't whisper -another word, Huck. My goodness, I wish I was out of this!" - -Two men entered. Each boy said to himself: "There's the old deaf and -dumb Spaniard that's been about town once or twice lately--never saw -t'other man before." - -"T'other" was a ragged, unkempt creature, with nothing very pleasant -in his face. The Spaniard was wrapped in a serape; he had bushy white -whiskers; long white hair flowed from under his sombrero, and he wore -green goggles. When they came in, "t'other" was talking in a low voice; -they sat down on the ground, facing the door, with their backs to the -wall, and the speaker continued his remarks. His manner became less -guarded and his words more distinct as he proceeded: - -"No," said he, "I've thought it all over, and I don't like it. It's -dangerous." - -"Dangerous!" grunted the "deaf and dumb" Spaniard--to the vast -surprise of the boys. "Milksop!" - -This voice made the boys gasp and quake. It was Injun Joe's! There was -silence for some time. Then Joe said: - -"What's any more dangerous than that job up yonder--but nothing's come -of it." - -"That's different. Away up the river so, and not another house about. -'Twon't ever be known that we tried, anyway, long as we didn't succeed." - -"Well, what's more dangerous than coming here in the daytime!--anybody -would suspicion us that saw us." - -"I know that. But there warn't any other place as handy after that -fool of a job. I want to quit this shanty. I wanted to yesterday, only -it warn't any use trying to stir out of here, with those infernal boys -playing over there on the hill right in full view." - -"Those infernal boys" quaked again under the inspiration of this -remark, and thought how lucky it was that they had remembered it was -Friday and concluded to wait a day. They wished in their hearts they -had waited a year. - -The two men got out some food and made a luncheon. After a long and -thoughtful silence, Injun Joe said: - -"Look here, lad--you go back up the river where you belong. Wait there -till you hear from me. I'll take the chances on dropping into this town -just once more, for a look. We'll do that 'dangerous' job after I've -spied around a little and think things look well for it. Then for -Texas! We'll leg it together!" - -This was satisfactory. Both men presently fell to yawning, and Injun -Joe said: - -"I'm dead for sleep! It's your turn to watch." - -He curled down in the weeds and soon began to snore. His comrade -stirred him once or twice and he became quiet. Presently the watcher -began to nod; his head drooped lower and lower, both men began to snore -now. - -The boys drew a long, grateful breath. Tom whispered: - -"Now's our chance--come!" - -Huck said: - -"I can't--I'd die if they was to wake." - -Tom urged--Huck held back. At last Tom rose slowly and softly, and -started alone. But the first step he made wrung such a hideous creak -from the crazy floor that he sank down almost dead with fright. He -never made a second attempt. The boys lay there counting the dragging -moments till it seemed to them that time must be done and eternity -growing gray; and then they were grateful to note that at last the sun -was setting. - -Now one snore ceased. Injun Joe sat up, stared around--smiled grimly -upon his comrade, whose head was drooping upon his knees--stirred him -up with his foot and said: - -"Here! YOU'RE a watchman, ain't you! All right, though--nothing's -happened." - -"My! have I been asleep?" - -"Oh, partly, partly. Nearly time for us to be moving, pard. What'll we -do with what little swag we've got left?" - -"I don't know--leave it here as we've always done, I reckon. No use to -take it away till we start south. Six hundred and fifty in silver's -something to carry." - -"Well--all right--it won't matter to come here once more." - -"No--but I'd say come in the night as we used to do--it's better." - -"Yes: but look here; it may be a good while before I get the right -chance at that job; accidents might happen; 'tain't in such a very good -place; we'll just regularly bury it--and bury it deep." - -"Good idea," said the comrade, who walked across the room, knelt down, -raised one of the rearward hearth-stones and took out a bag that -jingled pleasantly. He subtracted from it twenty or thirty dollars for -himself and as much for Injun Joe, and passed the bag to the latter, -who was on his knees in the corner, now, digging with his bowie-knife. - -The boys forgot all their fears, all their miseries in an instant. -With gloating eyes they watched every movement. Luck!--the splendor of -it was beyond all imagination! Six hundred dollars was money enough to -make half a dozen boys rich! Here was treasure-hunting under the -happiest auspices--there would not be any bothersome uncertainty as to -where to dig. They nudged each other every moment--eloquent nudges and -easily understood, for they simply meant--"Oh, but ain't you glad NOW -we're here!" - -Joe's knife struck upon something. - -"Hello!" said he. - -"What is it?" said his comrade. - -"Half-rotten plank--no, it's a box, I believe. Here--bear a hand and -we'll see what it's here for. Never mind, I've broke a hole." - -He reached his hand in and drew it out-- - -"Man, it's money!" - -The two men examined the handful of coins. They were gold. The boys -above were as excited as themselves, and as delighted. - -Joe's comrade said: - -"We'll make quick work of this. There's an old rusty pick over amongst -the weeds in the corner the other side of the fireplace--I saw it a -minute ago." - -He ran and brought the boys' pick and shovel. Injun Joe took the pick, -looked it over critically, shook his head, muttered something to -himself, and then began to use it. The box was soon unearthed. It was -not very large; it was iron bound and had been very strong before the -slow years had injured it. The men contemplated the treasure awhile in -blissful silence. - -"Pard, there's thousands of dollars here," said Injun Joe. - -"'Twas always said that Murrel's gang used to be around here one -summer," the stranger observed. - -"I know it," said Injun Joe; "and this looks like it, I should say." - -"Now you won't need to do that job." - -The half-breed frowned. Said he: - -"You don't know me. Least you don't know all about that thing. 'Tain't -robbery altogether--it's REVENGE!" and a wicked light flamed in his -eyes. "I'll need your help in it. When it's finished--then Texas. Go -home to your Nance and your kids, and stand by till you hear from me." - -"Well--if you say so; what'll we do with this--bury it again?" - -"Yes. [Ravishing delight overhead.] NO! by the great Sachem, no! -[Profound distress overhead.] I'd nearly forgot. That pick had fresh -earth on it! [The boys were sick with terror in a moment.] What -business has a pick and a shovel here? What business with fresh earth -on them? Who brought them here--and where are they gone? Have you heard -anybody?--seen anybody? What! bury it again and leave them to come and -see the ground disturbed? Not exactly--not exactly. We'll take it to my -den." - -"Why, of course! Might have thought of that before. You mean Number -One?" - -"No--Number Two--under the cross. The other place is bad--too common." - -"All right. It's nearly dark enough to start." - -Injun Joe got up and went about from window to window cautiously -peeping out. Presently he said: - -"Who could have brought those tools here? Do you reckon they can be -up-stairs?" - -The boys' breath forsook them. Injun Joe put his hand on his knife, -halted a moment, undecided, and then turned toward the stairway. The -boys thought of the closet, but their strength was gone. The steps came -creaking up the stairs--the intolerable distress of the situation woke -the stricken resolution of the lads--they were about to spring for the -closet, when there was a crash of rotten timbers and Injun Joe landed -on the ground amid the debris of the ruined stairway. He gathered -himself up cursing, and his comrade said: - -"Now what's the use of all that? If it's anybody, and they're up -there, let them STAY there--who cares? If they want to jump down, now, -and get into trouble, who objects? It will be dark in fifteen minutes ---and then let them follow us if they want to. I'm willing. In my -opinion, whoever hove those things in here caught a sight of us and -took us for ghosts or devils or something. I'll bet they're running -yet." - -Joe grumbled awhile; then he agreed with his friend that what daylight -was left ought to be economized in getting things ready for leaving. -Shortly afterward they slipped out of the house in the deepening -twilight, and moved toward the river with their precious box. - -Tom and Huck rose up, weak but vastly relieved, and stared after them -through the chinks between the logs of the house. Follow? Not they. -They were content to reach ground again without broken necks, and take -the townward track over the hill. They did not talk much. They were too -much absorbed in hating themselves--hating the ill luck that made them -take the spade and the pick there. But for that, Injun Joe never would -have suspected. He would have hidden the silver with the gold to wait -there till his "revenge" was satisfied, and then he would have had the -misfortune to find that money turn up missing. Bitter, bitter luck that -the tools were ever brought there! - -They resolved to keep a lookout for that Spaniard when he should come -to town spying out for chances to do his revengeful job, and follow him -to "Number Two," wherever that might be. Then a ghastly thought -occurred to Tom. - -"Revenge? What if he means US, Huck!" - -"Oh, don't!" said Huck, nearly fainting. - -They talked it all over, and as they entered town they agreed to -believe that he might possibly mean somebody else--at least that he -might at least mean nobody but Tom, since only Tom had testified. - -Very, very small comfort it was to Tom to be alone in danger! Company -would be a palpable improvement, he thought. - - - -CHAPTER XXVII - -THE adventure of the day mightily tormented Tom's dreams that night. -Four times he had his hands on that rich treasure and four times it -wasted to nothingness in his fingers as sleep forsook him and -wakefulness brought back the hard reality of his misfortune. As he lay -in the early morning recalling the incidents of his great adventure, he -noticed that they seemed curiously subdued and far away--somewhat as if -they had happened in another world, or in a time long gone by. Then it -occurred to him that the great adventure itself must be a dream! There -was one very strong argument in favor of this idea--namely, that the -quantity of coin he had seen was too vast to be real. He had never seen -as much as fifty dollars in one mass before, and he was like all boys -of his age and station in life, in that he imagined that all references -to "hundreds" and "thousands" were mere fanciful forms of speech, and -that no such sums really existed in the world. He never had supposed -for a moment that so large a sum as a hundred dollars was to be found -in actual money in any one's possession. If his notions of hidden -treasure had been analyzed, they would have been found to consist of a -handful of real dimes and a bushel of vague, splendid, ungraspable -dollars. - -But the incidents of his adventure grew sensibly sharper and clearer -under the attrition of thinking them over, and so he presently found -himself leaning to the impression that the thing might not have been a -dream, after all. This uncertainty must be swept away. He would snatch -a hurried breakfast and go and find Huck. Huck was sitting on the -gunwale of a flatboat, listlessly dangling his feet in the water and -looking very melancholy. Tom concluded to let Huck lead up to the -subject. If he did not do it, then the adventure would be proved to -have been only a dream. - -"Hello, Huck!" - -"Hello, yourself." - -Silence, for a minute. - -"Tom, if we'd 'a' left the blame tools at the dead tree, we'd 'a' got -the money. Oh, ain't it awful!" - -"'Tain't a dream, then, 'tain't a dream! Somehow I most wish it was. -Dog'd if I don't, Huck." - -"What ain't a dream?" - -"Oh, that thing yesterday. I been half thinking it was." - -"Dream! If them stairs hadn't broke down you'd 'a' seen how much dream -it was! I've had dreams enough all night--with that patch-eyed Spanish -devil going for me all through 'em--rot him!" - -"No, not rot him. FIND him! Track the money!" - -"Tom, we'll never find him. A feller don't have only one chance for -such a pile--and that one's lost. I'd feel mighty shaky if I was to see -him, anyway." - -"Well, so'd I; but I'd like to see him, anyway--and track him out--to -his Number Two." - -"Number Two--yes, that's it. I been thinking 'bout that. But I can't -make nothing out of it. What do you reckon it is?" - -"I dono. It's too deep. Say, Huck--maybe it's the number of a house!" - -"Goody!... No, Tom, that ain't it. If it is, it ain't in this -one-horse town. They ain't no numbers here." - -"Well, that's so. Lemme think a minute. Here--it's the number of a -room--in a tavern, you know!" - -"Oh, that's the trick! They ain't only two taverns. We can find out -quick." - -"You stay here, Huck, till I come." - -Tom was off at once. He did not care to have Huck's company in public -places. He was gone half an hour. He found that in the best tavern, No. -2 had long been occupied by a young lawyer, and was still so occupied. -In the less ostentatious house, No. 2 was a mystery. The -tavern-keeper's young son said it was kept locked all the time, and he -never saw anybody go into it or come out of it except at night; he did -not know any particular reason for this state of things; had had some -little curiosity, but it was rather feeble; had made the most of the -mystery by entertaining himself with the idea that that room was -"ha'nted"; had noticed that there was a light in there the night before. - -"That's what I've found out, Huck. I reckon that's the very No. 2 -we're after." - -"I reckon it is, Tom. Now what you going to do?" - -"Lemme think." - -Tom thought a long time. Then he said: - -"I'll tell you. The back door of that No. 2 is the door that comes out -into that little close alley between the tavern and the old rattle trap -of a brick store. Now you get hold of all the door-keys you can find, -and I'll nip all of auntie's, and the first dark night we'll go there -and try 'em. And mind you, keep a lookout for Injun Joe, because he -said he was going to drop into town and spy around once more for a -chance to get his revenge. If you see him, you just follow him; and if -he don't go to that No. 2, that ain't the place." - -"Lordy, I don't want to foller him by myself!" - -"Why, it'll be night, sure. He mightn't ever see you--and if he did, -maybe he'd never think anything." - -"Well, if it's pretty dark I reckon I'll track him. I dono--I dono. -I'll try." - -"You bet I'll follow him, if it's dark, Huck. Why, he might 'a' found -out he couldn't get his revenge, and be going right after that money." - -"It's so, Tom, it's so. I'll foller him; I will, by jingoes!" - -"Now you're TALKING! Don't you ever weaken, Huck, and I won't." - - - -CHAPTER XXVIII - -THAT night Tom and Huck were ready for their adventure. They hung -about the neighborhood of the tavern until after nine, one watching the -alley at a distance and the other the tavern door. Nobody entered the -alley or left it; nobody resembling the Spaniard entered or left the -tavern door. The night promised to be a fair one; so Tom went home with -the understanding that if a considerable degree of darkness came on, -Huck was to come and "maow," whereupon he would slip out and try the -keys. But the night remained clear, and Huck closed his watch and -retired to bed in an empty sugar hogshead about twelve. - -Tuesday the boys had the same ill luck. Also Wednesday. But Thursday -night promised better. Tom slipped out in good season with his aunt's -old tin lantern, and a large towel to blindfold it with. He hid the -lantern in Huck's sugar hogshead and the watch began. An hour before -midnight the tavern closed up and its lights (the only ones -thereabouts) were put out. No Spaniard had been seen. Nobody had -entered or left the alley. Everything was auspicious. The blackness of -darkness reigned, the perfect stillness was interrupted only by -occasional mutterings of distant thunder. - -Tom got his lantern, lit it in the hogshead, wrapped it closely in the -towel, and the two adventurers crept in the gloom toward the tavern. -Huck stood sentry and Tom felt his way into the alley. Then there was a -season of waiting anxiety that weighed upon Huck's spirits like a -mountain. He began to wish he could see a flash from the lantern--it -would frighten him, but it would at least tell him that Tom was alive -yet. It seemed hours since Tom had disappeared. Surely he must have -fainted; maybe he was dead; maybe his heart had burst under terror and -excitement. In his uneasiness Huck found himself drawing closer and -closer to the alley; fearing all sorts of dreadful things, and -momentarily expecting some catastrophe to happen that would take away -his breath. There was not much to take away, for he seemed only able to -inhale it by thimblefuls, and his heart would soon wear itself out, the -way it was beating. Suddenly there was a flash of light and Tom came -tearing by him: "Run!" said he; "run, for your life!" - -He needn't have repeated it; once was enough; Huck was making thirty -or forty miles an hour before the repetition was uttered. The boys -never stopped till they reached the shed of a deserted slaughter-house -at the lower end of the village. Just as they got within its shelter -the storm burst and the rain poured down. As soon as Tom got his breath -he said: - -"Huck, it was awful! I tried two of the keys, just as soft as I could; -but they seemed to make such a power of racket that I couldn't hardly -get my breath I was so scared. They wouldn't turn in the lock, either. -Well, without noticing what I was doing, I took hold of the knob, and -open comes the door! It warn't locked! I hopped in, and shook off the -towel, and, GREAT CAESAR'S GHOST!" - -"What!--what'd you see, Tom?" - -"Huck, I most stepped onto Injun Joe's hand!" - -"No!" - -"Yes! He was lying there, sound asleep on the floor, with his old -patch on his eye and his arms spread out." - -"Lordy, what did you do? Did he wake up?" - -"No, never budged. Drunk, I reckon. I just grabbed that towel and -started!" - -"I'd never 'a' thought of the towel, I bet!" - -"Well, I would. My aunt would make me mighty sick if I lost it." - -"Say, Tom, did you see that box?" - -"Huck, I didn't wait to look around. I didn't see the box, I didn't -see the cross. I didn't see anything but a bottle and a tin cup on the -floor by Injun Joe; yes, I saw two barrels and lots more bottles in the -room. Don't you see, now, what's the matter with that ha'nted room?" - -"How?" - -"Why, it's ha'nted with whiskey! Maybe ALL the Temperance Taverns have -got a ha'nted room, hey, Huck?" - -"Well, I reckon maybe that's so. Who'd 'a' thought such a thing? But -say, Tom, now's a mighty good time to get that box, if Injun Joe's -drunk." - -"It is, that! You try it!" - -Huck shuddered. - -"Well, no--I reckon not." - -"And I reckon not, Huck. Only one bottle alongside of Injun Joe ain't -enough. If there'd been three, he'd be drunk enough and I'd do it." - -There was a long pause for reflection, and then Tom said: - -"Lookyhere, Huck, less not try that thing any more till we know Injun -Joe's not in there. It's too scary. Now, if we watch every night, we'll -be dead sure to see him go out, some time or other, and then we'll -snatch that box quicker'n lightning." - -"Well, I'm agreed. I'll watch the whole night long, and I'll do it -every night, too, if you'll do the other part of the job." - -"All right, I will. All you got to do is to trot up Hooper Street a -block and maow--and if I'm asleep, you throw some gravel at the window -and that'll fetch me." - -"Agreed, and good as wheat!" - -"Now, Huck, the storm's over, and I'll go home. It'll begin to be -daylight in a couple of hours. You go back and watch that long, will -you?" - -"I said I would, Tom, and I will. I'll ha'nt that tavern every night -for a year! I'll sleep all day and I'll stand watch all night." - -"That's all right. Now, where you going to sleep?" - -"In Ben Rogers' hayloft. He lets me, and so does his pap's nigger man, -Uncle Jake. I tote water for Uncle Jake whenever he wants me to, and -any time I ask him he gives me a little something to eat if he can -spare it. That's a mighty good nigger, Tom. He likes me, becuz I don't -ever act as if I was above him. Sometime I've set right down and eat -WITH him. But you needn't tell that. A body's got to do things when -he's awful hungry he wouldn't want to do as a steady thing." - -"Well, if I don't want you in the daytime, I'll let you sleep. I won't -come bothering around. Any time you see something's up, in the night, -just skip right around and maow." - - - -CHAPTER XXIX - -THE first thing Tom heard on Friday morning was a glad piece of news ---Judge Thatcher's family had come back to town the night before. Both -Injun Joe and the treasure sunk into secondary importance for a moment, -and Becky took the chief place in the boy's interest. He saw her and -they had an exhausting good time playing "hi-spy" and "gully-keeper" -with a crowd of their school-mates. The day was completed and crowned -in a peculiarly satisfactory way: Becky teased her mother to appoint -the next day for the long-promised and long-delayed picnic, and she -consented. The child's delight was boundless; and Tom's not more -moderate. The invitations were sent out before sunset, and straightway -the young folks of the village were thrown into a fever of preparation -and pleasurable anticipation. Tom's excitement enabled him to keep -awake until a pretty late hour, and he had good hopes of hearing Huck's -"maow," and of having his treasure to astonish Becky and the picnickers -with, next day; but he was disappointed. No signal came that night. - -Morning came, eventually, and by ten or eleven o'clock a giddy and -rollicking company were gathered at Judge Thatcher's, and everything -was ready for a start. It was not the custom for elderly people to mar -the picnics with their presence. The children were considered safe -enough under the wings of a few young ladies of eighteen and a few -young gentlemen of twenty-three or thereabouts. The old steam ferryboat -was chartered for the occasion; presently the gay throng filed up the -main street laden with provision-baskets. Sid was sick and had to miss -the fun; Mary remained at home to entertain him. The last thing Mrs. -Thatcher said to Becky, was: - -"You'll not get back till late. Perhaps you'd better stay all night -with some of the girls that live near the ferry-landing, child." - -"Then I'll stay with Susy Harper, mamma." - -"Very well. And mind and behave yourself and don't be any trouble." - -Presently, as they tripped along, Tom said to Becky: - -"Say--I'll tell you what we'll do. 'Stead of going to Joe Harper's -we'll climb right up the hill and stop at the Widow Douglas'. She'll -have ice-cream! She has it most every day--dead loads of it. And she'll -be awful glad to have us." - -"Oh, that will be fun!" - -Then Becky reflected a moment and said: - -"But what will mamma say?" - -"How'll she ever know?" - -The girl turned the idea over in her mind, and said reluctantly: - -"I reckon it's wrong--but--" - -"But shucks! Your mother won't know, and so what's the harm? All she -wants is that you'll be safe; and I bet you she'd 'a' said go there if -she'd 'a' thought of it. I know she would!" - -The Widow Douglas' splendid hospitality was a tempting bait. It and -Tom's persuasions presently carried the day. So it was decided to say -nothing anybody about the night's programme. Presently it occurred to -Tom that maybe Huck might come this very night and give the signal. The -thought took a deal of the spirit out of his anticipations. Still he -could not bear to give up the fun at Widow Douglas'. And why should he -give it up, he reasoned--the signal did not come the night before, so -why should it be any more likely to come to-night? The sure fun of the -evening outweighed the uncertain treasure; and, boy-like, he determined -to yield to the stronger inclination and not allow himself to think of -the box of money another time that day. - -Three miles below town the ferryboat stopped at the mouth of a woody -hollow and tied up. The crowd swarmed ashore and soon the forest -distances and craggy heights echoed far and near with shoutings and -laughter. All the different ways of getting hot and tired were gone -through with, and by-and-by the rovers straggled back to camp fortified -with responsible appetites, and then the destruction of the good things -began. After the feast there was a refreshing season of rest and chat -in the shade of spreading oaks. By-and-by somebody shouted: - -"Who's ready for the cave?" - -Everybody was. Bundles of candles were procured, and straightway there -was a general scamper up the hill. The mouth of the cave was up the -hillside--an opening shaped like a letter A. Its massive oaken door -stood unbarred. Within was a small chamber, chilly as an ice-house, and -walled by Nature with solid limestone that was dewy with a cold sweat. -It was romantic and mysterious to stand here in the deep gloom and look -out upon the green valley shining in the sun. But the impressiveness of -the situation quickly wore off, and the romping began again. The moment -a candle was lighted there was a general rush upon the owner of it; a -struggle and a gallant defence followed, but the candle was soon -knocked down or blown out, and then there was a glad clamor of laughter -and a new chase. But all things have an end. By-and-by the procession -went filing down the steep descent of the main avenue, the flickering -rank of lights dimly revealing the lofty walls of rock almost to their -point of junction sixty feet overhead. This main avenue was not more -than eight or ten feet wide. Every few steps other lofty and still -narrower crevices branched from it on either hand--for McDougal's cave -was but a vast labyrinth of crooked aisles that ran into each other and -out again and led nowhere. It was said that one might wander days and -nights together through its intricate tangle of rifts and chasms, and -never find the end of the cave; and that he might go down, and down, -and still down, into the earth, and it was just the same--labyrinth -under labyrinth, and no end to any of them. No man "knew" the cave. -That was an impossible thing. Most of the young men knew a portion of -it, and it was not customary to venture much beyond this known portion. -Tom Sawyer knew as much of the cave as any one. - -The procession moved along the main avenue some three-quarters of a -mile, and then groups and couples began to slip aside into branch -avenues, fly along the dismal corridors, and take each other by -surprise at points where the corridors joined again. Parties were able -to elude each other for the space of half an hour without going beyond -the "known" ground. - -By-and-by, one group after another came straggling back to the mouth -of the cave, panting, hilarious, smeared from head to foot with tallow -drippings, daubed with clay, and entirely delighted with the success of -the day. Then they were astonished to find that they had been taking no -note of time and that night was about at hand. The clanging bell had -been calling for half an hour. However, this sort of close to the day's -adventures was romantic and therefore satisfactory. When the ferryboat -with her wild freight pushed into the stream, nobody cared sixpence for -the wasted time but the captain of the craft. - -Huck was already upon his watch when the ferryboat's lights went -glinting past the wharf. He heard no noise on board, for the young -people were as subdued and still as people usually are who are nearly -tired to death. He wondered what boat it was, and why she did not stop -at the wharf--and then he dropped her out of his mind and put his -attention upon his business. The night was growing cloudy and dark. Ten -o'clock came, and the noise of vehicles ceased, scattered lights began -to wink out, all straggling foot-passengers disappeared, the village -betook itself to its slumbers and left the small watcher alone with the -silence and the ghosts. Eleven o'clock came, and the tavern lights were -put out; darkness everywhere, now. Huck waited what seemed a weary long -time, but nothing happened. His faith was weakening. Was there any use? -Was there really any use? Why not give it up and turn in? - -A noise fell upon his ear. He was all attention in an instant. The -alley door closed softly. He sprang to the corner of the brick store. -The next moment two men brushed by him, and one seemed to have -something under his arm. It must be that box! So they were going to -remove the treasure. Why call Tom now? It would be absurd--the men -would get away with the box and never be found again. No, he would -stick to their wake and follow them; he would trust to the darkness for -security from discovery. So communing with himself, Huck stepped out -and glided along behind the men, cat-like, with bare feet, allowing -them to keep just far enough ahead not to be invisible. - -They moved up the river street three blocks, then turned to the left -up a cross-street. They went straight ahead, then, until they came to -the path that led up Cardiff Hill; this they took. They passed by the -old Welshman's house, half-way up the hill, without hesitating, and -still climbed upward. Good, thought Huck, they will bury it in the old -quarry. But they never stopped at the quarry. They passed on, up the -summit. They plunged into the narrow path between the tall sumach -bushes, and were at once hidden in the gloom. Huck closed up and -shortened his distance, now, for they would never be able to see him. -He trotted along awhile; then slackened his pace, fearing he was -gaining too fast; moved on a piece, then stopped altogether; listened; -no sound; none, save that he seemed to hear the beating of his own -heart. The hooting of an owl came over the hill--ominous sound! But no -footsteps. Heavens, was everything lost! He was about to spring with -winged feet, when a man cleared his throat not four feet from him! -Huck's heart shot into his throat, but he swallowed it again; and then -he stood there shaking as if a dozen agues had taken charge of him at -once, and so weak that he thought he must surely fall to the ground. He -knew where he was. He knew he was within five steps of the stile -leading into Widow Douglas' grounds. Very well, he thought, let them -bury it there; it won't be hard to find. - -Now there was a voice--a very low voice--Injun Joe's: - -"Damn her, maybe she's got company--there's lights, late as it is." - -"I can't see any." - -This was that stranger's voice--the stranger of the haunted house. A -deadly chill went to Huck's heart--this, then, was the "revenge" job! -His thought was, to fly. Then he remembered that the Widow Douglas had -been kind to him more than once, and maybe these men were going to -murder her. He wished he dared venture to warn her; but he knew he -didn't dare--they might come and catch him. He thought all this and -more in the moment that elapsed between the stranger's remark and Injun -Joe's next--which was-- - -"Because the bush is in your way. Now--this way--now you see, don't -you?" - -"Yes. Well, there IS company there, I reckon. Better give it up." - -"Give it up, and I just leaving this country forever! Give it up and -maybe never have another chance. I tell you again, as I've told you -before, I don't care for her swag--you may have it. But her husband was -rough on me--many times he was rough on me--and mainly he was the -justice of the peace that jugged me for a vagrant. And that ain't all. -It ain't a millionth part of it! He had me HORSEWHIPPED!--horsewhipped -in front of the jail, like a nigger!--with all the town looking on! -HORSEWHIPPED!--do you understand? He took advantage of me and died. But -I'll take it out of HER." - -"Oh, don't kill her! Don't do that!" - -"Kill? Who said anything about killing? I would kill HIM if he was -here; but not her. When you want to get revenge on a woman you don't -kill her--bosh! you go for her looks. You slit her nostrils--you notch -her ears like a sow!" - -"By God, that's--" - -"Keep your opinion to yourself! It will be safest for you. I'll tie -her to the bed. If she bleeds to death, is that my fault? I'll not cry, -if she does. My friend, you'll help me in this thing--for MY sake ---that's why you're here--I mightn't be able alone. If you flinch, I'll -kill you. Do you understand that? And if I have to kill you, I'll kill -her--and then I reckon nobody'll ever know much about who done this -business." - -"Well, if it's got to be done, let's get at it. The quicker the -better--I'm all in a shiver." - -"Do it NOW? And company there? Look here--I'll get suspicious of you, -first thing you know. No--we'll wait till the lights are out--there's -no hurry." - -Huck felt that a silence was going to ensue--a thing still more awful -than any amount of murderous talk; so he held his breath and stepped -gingerly back; planted his foot carefully and firmly, after balancing, -one-legged, in a precarious way and almost toppling over, first on one -side and then on the other. He took another step back, with the same -elaboration and the same risks; then another and another, and--a twig -snapped under his foot! His breath stopped and he listened. There was -no sound--the stillness was perfect. His gratitude was measureless. Now -he turned in his tracks, between the walls of sumach bushes--turned -himself as carefully as if he were a ship--and then stepped quickly but -cautiously along. When he emerged at the quarry he felt secure, and so -he picked up his nimble heels and flew. Down, down he sped, till he -reached the Welshman's. He banged at the door, and presently the heads -of the old man and his two stalwart sons were thrust from windows. - -"What's the row there? Who's banging? What do you want?" - -"Let me in--quick! I'll tell everything." - -"Why, who are you?" - -"Huckleberry Finn--quick, let me in!" - -"Huckleberry Finn, indeed! It ain't a name to open many doors, I -judge! But let him in, lads, and let's see what's the trouble." - -"Please don't ever tell I told you," were Huck's first words when he -got in. "Please don't--I'd be killed, sure--but the widow's been good -friends to me sometimes, and I want to tell--I WILL tell if you'll -promise you won't ever say it was me." - -"By George, he HAS got something to tell, or he wouldn't act so!" -exclaimed the old man; "out with it and nobody here'll ever tell, lad." - -Three minutes later the old man and his sons, well armed, were up the -hill, and just entering the sumach path on tiptoe, their weapons in -their hands. Huck accompanied them no further. He hid behind a great -bowlder and fell to listening. There was a lagging, anxious silence, -and then all of a sudden there was an explosion of firearms and a cry. - -Huck waited for no particulars. He sprang away and sped down the hill -as fast as his legs could carry him. - - - -CHAPTER XXX - -AS the earliest suspicion of dawn appeared on Sunday morning, Huck -came groping up the hill and rapped gently at the old Welshman's door. -The inmates were asleep, but it was a sleep that was set on a -hair-trigger, on account of the exciting episode of the night. A call -came from a window: - -"Who's there!" - -Huck's scared voice answered in a low tone: - -"Please let me in! It's only Huck Finn!" - -"It's a name that can open this door night or day, lad!--and welcome!" - -These were strange words to the vagabond boy's ears, and the -pleasantest he had ever heard. He could not recollect that the closing -word had ever been applied in his case before. The door was quickly -unlocked, and he entered. Huck was given a seat and the old man and his -brace of tall sons speedily dressed themselves. - -"Now, my boy, I hope you're good and hungry, because breakfast will be -ready as soon as the sun's up, and we'll have a piping hot one, too ---make yourself easy about that! I and the boys hoped you'd turn up and -stop here last night." - -"I was awful scared," said Huck, "and I run. I took out when the -pistols went off, and I didn't stop for three mile. I've come now becuz -I wanted to know about it, you know; and I come before daylight becuz I -didn't want to run across them devils, even if they was dead." - -"Well, poor chap, you do look as if you'd had a hard night of it--but -there's a bed here for you when you've had your breakfast. No, they -ain't dead, lad--we are sorry enough for that. You see we knew right -where to put our hands on them, by your description; so we crept along -on tiptoe till we got within fifteen feet of them--dark as a cellar -that sumach path was--and just then I found I was going to sneeze. It -was the meanest kind of luck! I tried to keep it back, but no use ---'twas bound to come, and it did come! I was in the lead with my pistol -raised, and when the sneeze started those scoundrels a-rustling to get -out of the path, I sung out, 'Fire boys!' and blazed away at the place -where the rustling was. So did the boys. But they were off in a jiffy, -those villains, and we after them, down through the woods. I judge we -never touched them. They fired a shot apiece as they started, but their -bullets whizzed by and didn't do us any harm. As soon as we lost the -sound of their feet we quit chasing, and went down and stirred up the -constables. They got a posse together, and went off to guard the river -bank, and as soon as it is light the sheriff and a gang are going to -beat up the woods. My boys will be with them presently. I wish we had -some sort of description of those rascals--'twould help a good deal. -But you couldn't see what they were like, in the dark, lad, I suppose?" - -"Oh yes; I saw them down-town and follered them." - -"Splendid! Describe them--describe them, my boy!" - -"One's the old deaf and dumb Spaniard that's ben around here once or -twice, and t'other's a mean-looking, ragged--" - -"That's enough, lad, we know the men! Happened on them in the woods -back of the widow's one day, and they slunk away. Off with you, boys, -and tell the sheriff--get your breakfast to-morrow morning!" - -The Welshman's sons departed at once. As they were leaving the room -Huck sprang up and exclaimed: - -"Oh, please don't tell ANYbody it was me that blowed on them! Oh, -please!" - -"All right if you say it, Huck, but you ought to have the credit of -what you did." - -"Oh no, no! Please don't tell!" - -When the young men were gone, the old Welshman said: - -"They won't tell--and I won't. But why don't you want it known?" - -Huck would not explain, further than to say that he already knew too -much about one of those men and would not have the man know that he -knew anything against him for the whole world--he would be killed for -knowing it, sure. - -The old man promised secrecy once more, and said: - -"How did you come to follow these fellows, lad? Were they looking -suspicious?" - -Huck was silent while he framed a duly cautious reply. Then he said: - -"Well, you see, I'm a kind of a hard lot,--least everybody says so, -and I don't see nothing agin it--and sometimes I can't sleep much, on -account of thinking about it and sort of trying to strike out a new way -of doing. That was the way of it last night. I couldn't sleep, and so I -come along up-street 'bout midnight, a-turning it all over, and when I -got to that old shackly brick store by the Temperance Tavern, I backed -up agin the wall to have another think. Well, just then along comes -these two chaps slipping along close by me, with something under their -arm, and I reckoned they'd stole it. One was a-smoking, and t'other one -wanted a light; so they stopped right before me and the cigars lit up -their faces and I see that the big one was the deaf and dumb Spaniard, -by his white whiskers and the patch on his eye, and t'other one was a -rusty, ragged-looking devil." - -"Could you see the rags by the light of the cigars?" - -This staggered Huck for a moment. Then he said: - -"Well, I don't know--but somehow it seems as if I did." - -"Then they went on, and you--" - -"Follered 'em--yes. That was it. I wanted to see what was up--they -sneaked along so. I dogged 'em to the widder's stile, and stood in the -dark and heard the ragged one beg for the widder, and the Spaniard -swear he'd spile her looks just as I told you and your two--" - -"What! The DEAF AND DUMB man said all that!" - -Huck had made another terrible mistake! He was trying his best to keep -the old man from getting the faintest hint of who the Spaniard might -be, and yet his tongue seemed determined to get him into trouble in -spite of all he could do. He made several efforts to creep out of his -scrape, but the old man's eye was upon him and he made blunder after -blunder. Presently the Welshman said: - -"My boy, don't be afraid of me. I wouldn't hurt a hair of your head -for all the world. No--I'd protect you--I'd protect you. This Spaniard -is not deaf and dumb; you've let that slip without intending it; you -can't cover that up now. You know something about that Spaniard that -you want to keep dark. Now trust me--tell me what it is, and trust me ---I won't betray you." - -Huck looked into the old man's honest eyes a moment, then bent over -and whispered in his ear: - -"'Tain't a Spaniard--it's Injun Joe!" - -The Welshman almost jumped out of his chair. In a moment he said: - -"It's all plain enough, now. When you talked about notching ears and -slitting noses I judged that that was your own embellishment, because -white men don't take that sort of revenge. But an Injun! That's a -different matter altogether." - -During breakfast the talk went on, and in the course of it the old man -said that the last thing which he and his sons had done, before going -to bed, was to get a lantern and examine the stile and its vicinity for -marks of blood. They found none, but captured a bulky bundle of-- - -"Of WHAT?" - -If the words had been lightning they could not have leaped with a more -stunning suddenness from Huck's blanched lips. His eyes were staring -wide, now, and his breath suspended--waiting for the answer. The -Welshman started--stared in return--three seconds--five seconds--ten ---then replied: - -"Of burglar's tools. Why, what's the MATTER with you?" - -Huck sank back, panting gently, but deeply, unutterably grateful. The -Welshman eyed him gravely, curiously--and presently said: - -"Yes, burglar's tools. That appears to relieve you a good deal. But -what did give you that turn? What were YOU expecting we'd found?" - -Huck was in a close place--the inquiring eye was upon him--he would -have given anything for material for a plausible answer--nothing -suggested itself--the inquiring eye was boring deeper and deeper--a -senseless reply offered--there was no time to weigh it, so at a venture -he uttered it--feebly: - -"Sunday-school books, maybe." - -Poor Huck was too distressed to smile, but the old man laughed loud -and joyously, shook up the details of his anatomy from head to foot, -and ended by saying that such a laugh was money in a-man's pocket, -because it cut down the doctor's bill like everything. Then he added: - -"Poor old chap, you're white and jaded--you ain't well a bit--no -wonder you're a little flighty and off your balance. But you'll come -out of it. Rest and sleep will fetch you out all right, I hope." - -Huck was irritated to think he had been such a goose and betrayed such -a suspicious excitement, for he had dropped the idea that the parcel -brought from the tavern was the treasure, as soon as he had heard the -talk at the widow's stile. He had only thought it was not the treasure, -however--he had not known that it wasn't--and so the suggestion of a -captured bundle was too much for his self-possession. But on the whole -he felt glad the little episode had happened, for now he knew beyond -all question that that bundle was not THE bundle, and so his mind was -at rest and exceedingly comfortable. In fact, everything seemed to be -drifting just in the right direction, now; the treasure must be still -in No. 2, the men would be captured and jailed that day, and he and Tom -could seize the gold that night without any trouble or any fear of -interruption. - -Just as breakfast was completed there was a knock at the door. Huck -jumped for a hiding-place, for he had no mind to be connected even -remotely with the late event. The Welshman admitted several ladies and -gentlemen, among them the Widow Douglas, and noticed that groups of -citizens were climbing up the hill--to stare at the stile. So the news -had spread. The Welshman had to tell the story of the night to the -visitors. The widow's gratitude for her preservation was outspoken. - -"Don't say a word about it, madam. There's another that you're more -beholden to than you are to me and my boys, maybe, but he don't allow -me to tell his name. We wouldn't have been there but for him." - -Of course this excited a curiosity so vast that it almost belittled -the main matter--but the Welshman allowed it to eat into the vitals of -his visitors, and through them be transmitted to the whole town, for he -refused to part with his secret. When all else had been learned, the -widow said: - -"I went to sleep reading in bed and slept straight through all that -noise. Why didn't you come and wake me?" - -"We judged it warn't worth while. Those fellows warn't likely to come -again--they hadn't any tools left to work with, and what was the use of -waking you up and scaring you to death? My three negro men stood guard -at your house all the rest of the night. They've just come back." - -More visitors came, and the story had to be told and retold for a -couple of hours more. - -There was no Sabbath-school during day-school vacation, but everybody -was early at church. The stirring event was well canvassed. News came -that not a sign of the two villains had been yet discovered. When the -sermon was finished, Judge Thatcher's wife dropped alongside of Mrs. -Harper as she moved down the aisle with the crowd and said: - -"Is my Becky going to sleep all day? I just expected she would be -tired to death." - -"Your Becky?" - -"Yes," with a startled look--"didn't she stay with you last night?" - -"Why, no." - -Mrs. Thatcher turned pale, and sank into a pew, just as Aunt Polly, -talking briskly with a friend, passed by. Aunt Polly said: - -"Good-morning, Mrs. Thatcher. Good-morning, Mrs. Harper. I've got a -boy that's turned up missing. I reckon my Tom stayed at your house last -night--one of you. And now he's afraid to come to church. I've got to -settle with him." - -Mrs. Thatcher shook her head feebly and turned paler than ever. - -"He didn't stay with us," said Mrs. Harper, beginning to look uneasy. -A marked anxiety came into Aunt Polly's face. - -"Joe Harper, have you seen my Tom this morning?" - -"No'm." - -"When did you see him last?" - -Joe tried to remember, but was not sure he could say. The people had -stopped moving out of church. Whispers passed along, and a boding -uneasiness took possession of every countenance. Children were -anxiously questioned, and young teachers. They all said they had not -noticed whether Tom and Becky were on board the ferryboat on the -homeward trip; it was dark; no one thought of inquiring if any one was -missing. One young man finally blurted out his fear that they were -still in the cave! Mrs. Thatcher swooned away. Aunt Polly fell to -crying and wringing her hands. - -The alarm swept from lip to lip, from group to group, from street to -street, and within five minutes the bells were wildly clanging and the -whole town was up! The Cardiff Hill episode sank into instant -insignificance, the burglars were forgotten, horses were saddled, -skiffs were manned, the ferryboat ordered out, and before the horror -was half an hour old, two hundred men were pouring down highroad and -river toward the cave. - -All the long afternoon the village seemed empty and dead. Many women -visited Aunt Polly and Mrs. Thatcher and tried to comfort them. They -cried with them, too, and that was still better than words. All the -tedious night the town waited for news; but when the morning dawned at -last, all the word that came was, "Send more candles--and send food." -Mrs. Thatcher was almost crazed; and Aunt Polly, also. Judge Thatcher -sent messages of hope and encouragement from the cave, but they -conveyed no real cheer. - -The old Welshman came home toward daylight, spattered with -candle-grease, smeared with clay, and almost worn out. He found Huck -still in the bed that had been provided for him, and delirious with -fever. The physicians were all at the cave, so the Widow Douglas came -and took charge of the patient. She said she would do her best by him, -because, whether he was good, bad, or indifferent, he was the Lord's, -and nothing that was the Lord's was a thing to be neglected. The -Welshman said Huck had good spots in him, and the widow said: - -"You can depend on it. That's the Lord's mark. He don't leave it off. -He never does. Puts it somewhere on every creature that comes from his -hands." - -Early in the forenoon parties of jaded men began to straggle into the -village, but the strongest of the citizens continued searching. All the -news that could be gained was that remotenesses of the cavern were -being ransacked that had never been visited before; that every corner -and crevice was going to be thoroughly searched; that wherever one -wandered through the maze of passages, lights were to be seen flitting -hither and thither in the distance, and shoutings and pistol-shots sent -their hollow reverberations to the ear down the sombre aisles. In one -place, far from the section usually traversed by tourists, the names -"BECKY & TOM" had been found traced upon the rocky wall with -candle-smoke, and near at hand a grease-soiled bit of ribbon. Mrs. -Thatcher recognized the ribbon and cried over it. She said it was the -last relic she should ever have of her child; and that no other memorial -of her could ever be so precious, because this one parted latest from -the living body before the awful death came. Some said that now and -then, in the cave, a far-away speck of light would glimmer, and then a -glorious shout would burst forth and a score of men go trooping down the -echoing aisle--and then a sickening disappointment always followed; the -children were not there; it was only a searcher's light. - -Three dreadful days and nights dragged their tedious hours along, and -the village sank into a hopeless stupor. No one had heart for anything. -The accidental discovery, just made, that the proprietor of the -Temperance Tavern kept liquor on his premises, scarcely fluttered the -public pulse, tremendous as the fact was. In a lucid interval, Huck -feebly led up to the subject of taverns, and finally asked--dimly -dreading the worst--if anything had been discovered at the Temperance -Tavern since he had been ill. - -"Yes," said the widow. - -Huck started up in bed, wild-eyed: - -"What? What was it?" - -"Liquor!--and the place has been shut up. Lie down, child--what a turn -you did give me!" - -"Only tell me just one thing--only just one--please! Was it Tom Sawyer -that found it?" - -The widow burst into tears. "Hush, hush, child, hush! I've told you -before, you must NOT talk. You are very, very sick!" - -Then nothing but liquor had been found; there would have been a great -powwow if it had been the gold. So the treasure was gone forever--gone -forever! But what could she be crying about? Curious that she should -cry. - -These thoughts worked their dim way through Huck's mind, and under the -weariness they gave him he fell asleep. The widow said to herself: - -"There--he's asleep, poor wreck. Tom Sawyer find it! Pity but somebody -could find Tom Sawyer! Ah, there ain't many left, now, that's got hope -enough, or strength enough, either, to go on searching." - - - -CHAPTER XXXI - -NOW to return to Tom and Becky's share in the picnic. They tripped -along the murky aisles with the rest of the company, visiting the -familiar wonders of the cave--wonders dubbed with rather -over-descriptive names, such as "The Drawing-Room," "The Cathedral," -"Aladdin's Palace," and so on. Presently the hide-and-seek frolicking -began, and Tom and Becky engaged in it with zeal until the exertion -began to grow a trifle wearisome; then they wandered down a sinuous -avenue holding their candles aloft and reading the tangled web-work of -names, dates, post-office addresses, and mottoes with which the rocky -walls had been frescoed (in candle-smoke). Still drifting along and -talking, they scarcely noticed that they were now in a part of the cave -whose walls were not frescoed. They smoked their own names under an -overhanging shelf and moved on. Presently they came to a place where a -little stream of water, trickling over a ledge and carrying a limestone -sediment with it, had, in the slow-dragging ages, formed a laced and -ruffled Niagara in gleaming and imperishable stone. Tom squeezed his -small body behind it in order to illuminate it for Becky's -gratification. He found that it curtained a sort of steep natural -stairway which was enclosed between narrow walls, and at once the -ambition to be a discoverer seized him. Becky responded to his call, -and they made a smoke-mark for future guidance, and started upon their -quest. They wound this way and that, far down into the secret depths of -the cave, made another mark, and branched off in search of novelties to -tell the upper world about. In one place they found a spacious cavern, -from whose ceiling depended a multitude of shining stalactites of the -length and circumference of a man's leg; they walked all about it, -wondering and admiring, and presently left it by one of the numerous -passages that opened into it. This shortly brought them to a bewitching -spring, whose basin was incrusted with a frostwork of glittering -crystals; it was in the midst of a cavern whose walls were supported by -many fantastic pillars which had been formed by the joining of great -stalactites and stalagmites together, the result of the ceaseless -water-drip of centuries. Under the roof vast knots of bats had packed -themselves together, thousands in a bunch; the lights disturbed the -creatures and they came flocking down by hundreds, squeaking and -darting furiously at the candles. Tom knew their ways and the danger of -this sort of conduct. He seized Becky's hand and hurried her into the -first corridor that offered; and none too soon, for a bat struck -Becky's light out with its wing while she was passing out of the -cavern. The bats chased the children a good distance; but the fugitives -plunged into every new passage that offered, and at last got rid of the -perilous things. Tom found a subterranean lake, shortly, which -stretched its dim length away until its shape was lost in the shadows. -He wanted to explore its borders, but concluded that it would be best -to sit down and rest awhile, first. Now, for the first time, the deep -stillness of the place laid a clammy hand upon the spirits of the -children. Becky said: - -"Why, I didn't notice, but it seems ever so long since I heard any of -the others." - -"Come to think, Becky, we are away down below them--and I don't know -how far away north, or south, or east, or whichever it is. We couldn't -hear them here." - -Becky grew apprehensive. - -"I wonder how long we've been down here, Tom? We better start back." - -"Yes, I reckon we better. P'raps we better." - -"Can you find the way, Tom? It's all a mixed-up crookedness to me." - -"I reckon I could find it--but then the bats. If they put our candles -out it will be an awful fix. Let's try some other way, so as not to go -through there." - -"Well. But I hope we won't get lost. It would be so awful!" and the -girl shuddered at the thought of the dreadful possibilities. - -They started through a corridor, and traversed it in silence a long -way, glancing at each new opening, to see if there was anything -familiar about the look of it; but they were all strange. Every time -Tom made an examination, Becky would watch his face for an encouraging -sign, and he would say cheerily: - -"Oh, it's all right. This ain't the one, but we'll come to it right -away!" - -But he felt less and less hopeful with each failure, and presently -began to turn off into diverging avenues at sheer random, in desperate -hope of finding the one that was wanted. He still said it was "all -right," but there was such a leaden dread at his heart that the words -had lost their ring and sounded just as if he had said, "All is lost!" -Becky clung to his side in an anguish of fear, and tried hard to keep -back the tears, but they would come. At last she said: - -"Oh, Tom, never mind the bats, let's go back that way! We seem to get -worse and worse off all the time." - -"Listen!" said he. - -Profound silence; silence so deep that even their breathings were -conspicuous in the hush. Tom shouted. The call went echoing down the -empty aisles and died out in the distance in a faint sound that -resembled a ripple of mocking laughter. - -"Oh, don't do it again, Tom, it is too horrid," said Becky. - -"It is horrid, but I better, Becky; they might hear us, you know," and -he shouted again. - -The "might" was even a chillier horror than the ghostly laughter, it -so confessed a perishing hope. The children stood still and listened; -but there was no result. Tom turned upon the back track at once, and -hurried his steps. It was but a little while before a certain -indecision in his manner revealed another fearful fact to Becky--he -could not find his way back! - -"Oh, Tom, you didn't make any marks!" - -"Becky, I was such a fool! Such a fool! I never thought we might want -to come back! No--I can't find the way. It's all mixed up." - -"Tom, Tom, we're lost! we're lost! We never can get out of this awful -place! Oh, why DID we ever leave the others!" - -She sank to the ground and burst into such a frenzy of crying that Tom -was appalled with the idea that she might die, or lose her reason. He -sat down by her and put his arms around her; she buried her face in his -bosom, she clung to him, she poured out her terrors, her unavailing -regrets, and the far echoes turned them all to jeering laughter. Tom -begged her to pluck up hope again, and she said she could not. He fell -to blaming and abusing himself for getting her into this miserable -situation; this had a better effect. She said she would try to hope -again, she would get up and follow wherever he might lead if only he -would not talk like that any more. For he was no more to blame than -she, she said. - -So they moved on again--aimlessly--simply at random--all they could do -was to move, keep moving. For a little while, hope made a show of -reviving--not with any reason to back it, but only because it is its -nature to revive when the spring has not been taken out of it by age -and familiarity with failure. - -By-and-by Tom took Becky's candle and blew it out. This economy meant -so much! Words were not needed. Becky understood, and her hope died -again. She knew that Tom had a whole candle and three or four pieces in -his pockets--yet he must economize. - -By-and-by, fatigue began to assert its claims; the children tried to -pay attention, for it was dreadful to think of sitting down when time -was grown to be so precious, moving, in some direction, in any -direction, was at least progress and might bear fruit; but to sit down -was to invite death and shorten its pursuit. - -At last Becky's frail limbs refused to carry her farther. She sat -down. Tom rested with her, and they talked of home, and the friends -there, and the comfortable beds and, above all, the light! Becky cried, -and Tom tried to think of some way of comforting her, but all his -encouragements were grown threadbare with use, and sounded like -sarcasms. Fatigue bore so heavily upon Becky that she drowsed off to -sleep. Tom was grateful. He sat looking into her drawn face and saw it -grow smooth and natural under the influence of pleasant dreams; and -by-and-by a smile dawned and rested there. The peaceful face reflected -somewhat of peace and healing into his own spirit, and his thoughts -wandered away to bygone times and dreamy memories. While he was deep in -his musings, Becky woke up with a breezy little laugh--but it was -stricken dead upon her lips, and a groan followed it. - -"Oh, how COULD I sleep! I wish I never, never had waked! No! No, I -don't, Tom! Don't look so! I won't say it again." - -"I'm glad you've slept, Becky; you'll feel rested, now, and we'll find -the way out." - -"We can try, Tom; but I've seen such a beautiful country in my dream. -I reckon we are going there." - -"Maybe not, maybe not. Cheer up, Becky, and let's go on trying." - -They rose up and wandered along, hand in hand and hopeless. They tried -to estimate how long they had been in the cave, but all they knew was -that it seemed days and weeks, and yet it was plain that this could not -be, for their candles were not gone yet. A long time after this--they -could not tell how long--Tom said they must go softly and listen for -dripping water--they must find a spring. They found one presently, and -Tom said it was time to rest again. Both were cruelly tired, yet Becky -said she thought she could go a little farther. She was surprised to -hear Tom dissent. She could not understand it. They sat down, and Tom -fastened his candle to the wall in front of them with some clay. -Thought was soon busy; nothing was said for some time. Then Becky broke -the silence: - -"Tom, I am so hungry!" - -Tom took something out of his pocket. - -"Do you remember this?" said he. - -Becky almost smiled. - -"It's our wedding-cake, Tom." - -"Yes--I wish it was as big as a barrel, for it's all we've got." - -"I saved it from the picnic for us to dream on, Tom, the way grown-up -people do with wedding-cake--but it'll be our--" - -She dropped the sentence where it was. Tom divided the cake and Becky -ate with good appetite, while Tom nibbled at his moiety. There was -abundance of cold water to finish the feast with. By-and-by Becky -suggested that they move on again. Tom was silent a moment. Then he -said: - -"Becky, can you bear it if I tell you something?" - -Becky's face paled, but she thought she could. - -"Well, then, Becky, we must stay here, where there's water to drink. -That little piece is our last candle!" - -Becky gave loose to tears and wailings. Tom did what he could to -comfort her, but with little effect. At length Becky said: - -"Tom!" - -"Well, Becky?" - -"They'll miss us and hunt for us!" - -"Yes, they will! Certainly they will!" - -"Maybe they're hunting for us now, Tom." - -"Why, I reckon maybe they are. I hope they are." - -"When would they miss us, Tom?" - -"When they get back to the boat, I reckon." - -"Tom, it might be dark then--would they notice we hadn't come?" - -"I don't know. But anyway, your mother would miss you as soon as they -got home." - -A frightened look in Becky's face brought Tom to his senses and he saw -that he had made a blunder. Becky was not to have gone home that night! -The children became silent and thoughtful. In a moment a new burst of -grief from Becky showed Tom that the thing in his mind had struck hers -also--that the Sabbath morning might be half spent before Mrs. Thatcher -discovered that Becky was not at Mrs. Harper's. - -The children fastened their eyes upon their bit of candle and watched -it melt slowly and pitilessly away; saw the half inch of wick stand -alone at last; saw the feeble flame rise and fall, climb the thin -column of smoke, linger at its top a moment, and then--the horror of -utter darkness reigned! - -How long afterward it was that Becky came to a slow consciousness that -she was crying in Tom's arms, neither could tell. All that they knew -was, that after what seemed a mighty stretch of time, both awoke out of -a dead stupor of sleep and resumed their miseries once more. Tom said -it might be Sunday, now--maybe Monday. He tried to get Becky to talk, -but her sorrows were too oppressive, all her hopes were gone. Tom said -that they must have been missed long ago, and no doubt the search was -going on. He would shout and maybe some one would come. He tried it; -but in the darkness the distant echoes sounded so hideously that he -tried it no more. - -The hours wasted away, and hunger came to torment the captives again. -A portion of Tom's half of the cake was left; they divided and ate it. -But they seemed hungrier than before. The poor morsel of food only -whetted desire. - -By-and-by Tom said: - -"SH! Did you hear that?" - -Both held their breath and listened. There was a sound like the -faintest, far-off shout. Instantly Tom answered it, and leading Becky -by the hand, started groping down the corridor in its direction. -Presently he listened again; again the sound was heard, and apparently -a little nearer. - -"It's them!" said Tom; "they're coming! Come along, Becky--we're all -right now!" - -The joy of the prisoners was almost overwhelming. Their speed was -slow, however, because pitfalls were somewhat common, and had to be -guarded against. They shortly came to one and had to stop. It might be -three feet deep, it might be a hundred--there was no passing it at any -rate. Tom got down on his breast and reached as far down as he could. -No bottom. They must stay there and wait until the searchers came. They -listened; evidently the distant shoutings were growing more distant! a -moment or two more and they had gone altogether. The heart-sinking -misery of it! Tom whooped until he was hoarse, but it was of no use. He -talked hopefully to Becky; but an age of anxious waiting passed and no -sounds came again. - -The children groped their way back to the spring. The weary time -dragged on; they slept again, and awoke famished and woe-stricken. Tom -believed it must be Tuesday by this time. - -Now an idea struck him. There were some side passages near at hand. It -would be better to explore some of these than bear the weight of the -heavy time in idleness. He took a kite-line from his pocket, tied it to -a projection, and he and Becky started, Tom in the lead, unwinding the -line as he groped along. At the end of twenty steps the corridor ended -in a "jumping-off place." Tom got down on his knees and felt below, and -then as far around the corner as he could reach with his hands -conveniently; he made an effort to stretch yet a little farther to the -right, and at that moment, not twenty yards away, a human hand, holding -a candle, appeared from behind a rock! Tom lifted up a glorious shout, -and instantly that hand was followed by the body it belonged to--Injun -Joe's! Tom was paralyzed; he could not move. He was vastly gratified -the next moment, to see the "Spaniard" take to his heels and get -himself out of sight. Tom wondered that Joe had not recognized his -voice and come over and killed him for testifying in court. But the -echoes must have disguised the voice. Without doubt, that was it, he -reasoned. Tom's fright weakened every muscle in his body. He said to -himself that if he had strength enough to get back to the spring he -would stay there, and nothing should tempt him to run the risk of -meeting Injun Joe again. He was careful to keep from Becky what it was -he had seen. He told her he had only shouted "for luck." - -But hunger and wretchedness rise superior to fears in the long run. -Another tedious wait at the spring and another long sleep brought -changes. The children awoke tortured with a raging hunger. Tom believed -that it must be Wednesday or Thursday or even Friday or Saturday, now, -and that the search had been given over. He proposed to explore another -passage. He felt willing to risk Injun Joe and all other terrors. But -Becky was very weak. She had sunk into a dreary apathy and would not be -roused. She said she would wait, now, where she was, and die--it would -not be long. She told Tom to go with the kite-line and explore if he -chose; but she implored him to come back every little while and speak -to her; and she made him promise that when the awful time came, he -would stay by her and hold her hand until all was over. - -Tom kissed her, with a choking sensation in his throat, and made a -show of being confident of finding the searchers or an escape from the -cave; then he took the kite-line in his hand and went groping down one -of the passages on his hands and knees, distressed with hunger and sick -with bodings of coming doom. - - - -CHAPTER XXXII - -TUESDAY afternoon came, and waned to the twilight. The village of St. -Petersburg still mourned. The lost children had not been found. Public -prayers had been offered up for them, and many and many a private -prayer that had the petitioner's whole heart in it; but still no good -news came from the cave. The majority of the searchers had given up the -quest and gone back to their daily avocations, saying that it was plain -the children could never be found. Mrs. Thatcher was very ill, and a -great part of the time delirious. People said it was heartbreaking to -hear her call her child, and raise her head and listen a whole minute -at a time, then lay it wearily down again with a moan. Aunt Polly had -drooped into a settled melancholy, and her gray hair had grown almost -white. The village went to its rest on Tuesday night, sad and forlorn. - -Away in the middle of the night a wild peal burst from the village -bells, and in a moment the streets were swarming with frantic half-clad -people, who shouted, "Turn out! turn out! they're found! they're -found!" Tin pans and horns were added to the din, the population massed -itself and moved toward the river, met the children coming in an open -carriage drawn by shouting citizens, thronged around it, joined its -homeward march, and swept magnificently up the main street roaring -huzzah after huzzah! - -The village was illuminated; nobody went to bed again; it was the -greatest night the little town had ever seen. During the first half-hour -a procession of villagers filed through Judge Thatcher's house, seized -the saved ones and kissed them, squeezed Mrs. Thatcher's hand, tried to -speak but couldn't--and drifted out raining tears all over the place. - -Aunt Polly's happiness was complete, and Mrs. Thatcher's nearly so. It -would be complete, however, as soon as the messenger dispatched with -the great news to the cave should get the word to her husband. Tom lay -upon a sofa with an eager auditory about him and told the history of -the wonderful adventure, putting in many striking additions to adorn it -withal; and closed with a description of how he left Becky and went on -an exploring expedition; how he followed two avenues as far as his -kite-line would reach; how he followed a third to the fullest stretch of -the kite-line, and was about to turn back when he glimpsed a far-off -speck that looked like daylight; dropped the line and groped toward it, -pushed his head and shoulders through a small hole, and saw the broad -Mississippi rolling by! And if it had only happened to be night he would -not have seen that speck of daylight and would not have explored that -passage any more! He told how he went back for Becky and broke the good -news and she told him not to fret her with such stuff, for she was -tired, and knew she was going to die, and wanted to. He described how he -labored with her and convinced her; and how she almost died for joy when -she had groped to where she actually saw the blue speck of daylight; how -he pushed his way out at the hole and then helped her out; how they sat -there and cried for gladness; how some men came along in a skiff and Tom -hailed them and told them their situation and their famished condition; -how the men didn't believe the wild tale at first, "because," said they, -"you are five miles down the river below the valley the cave is in" ---then took them aboard, rowed to a house, gave them supper, made them -rest till two or three hours after dark and then brought them home. - -Before day-dawn, Judge Thatcher and the handful of searchers with him -were tracked out, in the cave, by the twine clews they had strung -behind them, and informed of the great news. - -Three days and nights of toil and hunger in the cave were not to be -shaken off at once, as Tom and Becky soon discovered. They were -bedridden all of Wednesday and Thursday, and seemed to grow more and -more tired and worn, all the time. Tom got about, a little, on -Thursday, was down-town Friday, and nearly as whole as ever Saturday; -but Becky did not leave her room until Sunday, and then she looked as -if she had passed through a wasting illness. - -Tom learned of Huck's sickness and went to see him on Friday, but -could not be admitted to the bedroom; neither could he on Saturday or -Sunday. He was admitted daily after that, but was warned to keep still -about his adventure and introduce no exciting topic. The Widow Douglas -stayed by to see that he obeyed. At home Tom learned of the Cardiff -Hill event; also that the "ragged man's" body had eventually been found -in the river near the ferry-landing; he had been drowned while trying -to escape, perhaps. - -About a fortnight after Tom's rescue from the cave, he started off to -visit Huck, who had grown plenty strong enough, now, to hear exciting -talk, and Tom had some that would interest him, he thought. Judge -Thatcher's house was on Tom's way, and he stopped to see Becky. The -Judge and some friends set Tom to talking, and some one asked him -ironically if he wouldn't like to go to the cave again. Tom said he -thought he wouldn't mind it. The Judge said: - -"Well, there are others just like you, Tom, I've not the least doubt. -But we have taken care of that. Nobody will get lost in that cave any -more." - -"Why?" - -"Because I had its big door sheathed with boiler iron two weeks ago, -and triple-locked--and I've got the keys." - -Tom turned as white as a sheet. - -"What's the matter, boy! Here, run, somebody! Fetch a glass of water!" - -The water was brought and thrown into Tom's face. - -"Ah, now you're all right. What was the matter with you, Tom?" - -"Oh, Judge, Injun Joe's in the cave!" - - - -CHAPTER XXXIII - -WITHIN a few minutes the news had spread, and a dozen skiff-loads of -men were on their way to McDougal's cave, and the ferryboat, well -filled with passengers, soon followed. Tom Sawyer was in the skiff that -bore Judge Thatcher. - -When the cave door was unlocked, a sorrowful sight presented itself in -the dim twilight of the place. Injun Joe lay stretched upon the ground, -dead, with his face close to the crack of the door, as if his longing -eyes had been fixed, to the latest moment, upon the light and the cheer -of the free world outside. Tom was touched, for he knew by his own -experience how this wretch had suffered. His pity was moved, but -nevertheless he felt an abounding sense of relief and security, now, -which revealed to him in a degree which he had not fully appreciated -before how vast a weight of dread had been lying upon him since the day -he lifted his voice against this bloody-minded outcast. - -Injun Joe's bowie-knife lay close by, its blade broken in two. The -great foundation-beam of the door had been chipped and hacked through, -with tedious labor; useless labor, too, it was, for the native rock -formed a sill outside it, and upon that stubborn material the knife had -wrought no effect; the only damage done was to the knife itself. But if -there had been no stony obstruction there the labor would have been -useless still, for if the beam had been wholly cut away Injun Joe could -not have squeezed his body under the door, and he knew it. So he had -only hacked that place in order to be doing something--in order to pass -the weary time--in order to employ his tortured faculties. Ordinarily -one could find half a dozen bits of candle stuck around in the crevices -of this vestibule, left there by tourists; but there were none now. The -prisoner had searched them out and eaten them. He had also contrived to -catch a few bats, and these, also, he had eaten, leaving only their -claws. The poor unfortunate had starved to death. In one place, near at -hand, a stalagmite had been slowly growing up from the ground for ages, -builded by the water-drip from a stalactite overhead. The captive had -broken off the stalagmite, and upon the stump had placed a stone, -wherein he had scooped a shallow hollow to catch the precious drop -that fell once in every three minutes with the dreary regularity of a -clock-tick--a dessertspoonful once in four and twenty hours. That drop -was falling when the Pyramids were new; when Troy fell; when the -foundations of Rome were laid; when Christ was crucified; when the -Conqueror created the British empire; when Columbus sailed; when the -massacre at Lexington was "news." It is falling now; it will still be -falling when all these things shall have sunk down the afternoon of -history, and the twilight of tradition, and been swallowed up in the -thick night of oblivion. Has everything a purpose and a mission? Did -this drop fall patiently during five thousand years to be ready for -this flitting human insect's need? and has it another important object -to accomplish ten thousand years to come? No matter. It is many and -many a year since the hapless half-breed scooped out the stone to catch -the priceless drops, but to this day the tourist stares longest at that -pathetic stone and that slow-dropping water when he comes to see the -wonders of McDougal's cave. Injun Joe's cup stands first in the list of -the cavern's marvels; even "Aladdin's Palace" cannot rival it. - -Injun Joe was buried near the mouth of the cave; and people flocked -there in boats and wagons from the towns and from all the farms and -hamlets for seven miles around; they brought their children, and all -sorts of provisions, and confessed that they had had almost as -satisfactory a time at the funeral as they could have had at the -hanging. - -This funeral stopped the further growth of one thing--the petition to -the governor for Injun Joe's pardon. The petition had been largely -signed; many tearful and eloquent meetings had been held, and a -committee of sappy women been appointed to go in deep mourning and wail -around the governor, and implore him to be a merciful ass and trample -his duty under foot. Injun Joe was believed to have killed five -citizens of the village, but what of that? If he had been Satan himself -there would have been plenty of weaklings ready to scribble their names -to a pardon-petition, and drip a tear on it from their permanently -impaired and leaky water-works. - -The morning after the funeral Tom took Huck to a private place to have -an important talk. Huck had learned all about Tom's adventure from the -Welshman and the Widow Douglas, by this time, but Tom said he reckoned -there was one thing they had not told him; that thing was what he -wanted to talk about now. Huck's face saddened. He said: - -"I know what it is. You got into No. 2 and never found anything but -whiskey. Nobody told me it was you; but I just knowed it must 'a' ben -you, soon as I heard 'bout that whiskey business; and I knowed you -hadn't got the money becuz you'd 'a' got at me some way or other and -told me even if you was mum to everybody else. Tom, something's always -told me we'd never get holt of that swag." - -"Why, Huck, I never told on that tavern-keeper. YOU know his tavern -was all right the Saturday I went to the picnic. Don't you remember you -was to watch there that night?" - -"Oh yes! Why, it seems 'bout a year ago. It was that very night that I -follered Injun Joe to the widder's." - -"YOU followed him?" - -"Yes--but you keep mum. I reckon Injun Joe's left friends behind him, -and I don't want 'em souring on me and doing me mean tricks. If it -hadn't ben for me he'd be down in Texas now, all right." - -Then Huck told his entire adventure in confidence to Tom, who had only -heard of the Welshman's part of it before. - -"Well," said Huck, presently, coming back to the main question, -"whoever nipped the whiskey in No. 2, nipped the money, too, I reckon ---anyways it's a goner for us, Tom." - -"Huck, that money wasn't ever in No. 2!" - -"What!" Huck searched his comrade's face keenly. "Tom, have you got on -the track of that money again?" - -"Huck, it's in the cave!" - -Huck's eyes blazed. - -"Say it again, Tom." - -"The money's in the cave!" - -"Tom--honest injun, now--is it fun, or earnest?" - -"Earnest, Huck--just as earnest as ever I was in my life. Will you go -in there with me and help get it out?" - -"I bet I will! I will if it's where we can blaze our way to it and not -get lost." - -"Huck, we can do that without the least little bit of trouble in the -world." - -"Good as wheat! What makes you think the money's--" - -"Huck, you just wait till we get in there. If we don't find it I'll -agree to give you my drum and every thing I've got in the world. I -will, by jings." - -"All right--it's a whiz. When do you say?" - -"Right now, if you say it. Are you strong enough?" - -"Is it far in the cave? I ben on my pins a little, three or four days, -now, but I can't walk more'n a mile, Tom--least I don't think I could." - -"It's about five mile into there the way anybody but me would go, -Huck, but there's a mighty short cut that they don't anybody but me -know about. Huck, I'll take you right to it in a skiff. I'll float the -skiff down there, and I'll pull it back again all by myself. You -needn't ever turn your hand over." - -"Less start right off, Tom." - -"All right. We want some bread and meat, and our pipes, and a little -bag or two, and two or three kite-strings, and some of these -new-fangled things they call lucifer matches. I tell you, many's -the time I wished I had some when I was in there before." - -A trifle after noon the boys borrowed a small skiff from a citizen who -was absent, and got under way at once. When they were several miles -below "Cave Hollow," Tom said: - -"Now you see this bluff here looks all alike all the way down from the -cave hollow--no houses, no wood-yards, bushes all alike. But do you see -that white place up yonder where there's been a landslide? Well, that's -one of my marks. We'll get ashore, now." - -They landed. - -"Now, Huck, where we're a-standing you could touch that hole I got out -of with a fishing-pole. See if you can find it." - -Huck searched all the place about, and found nothing. Tom proudly -marched into a thick clump of sumach bushes and said: - -"Here you are! Look at it, Huck; it's the snuggest hole in this -country. You just keep mum about it. All along I've been wanting to be -a robber, but I knew I'd got to have a thing like this, and where to -run across it was the bother. We've got it now, and we'll keep it -quiet, only we'll let Joe Harper and Ben Rogers in--because of course -there's got to be a Gang, or else there wouldn't be any style about it. -Tom Sawyer's Gang--it sounds splendid, don't it, Huck?" - -"Well, it just does, Tom. And who'll we rob?" - -"Oh, most anybody. Waylay people--that's mostly the way." - -"And kill them?" - -"No, not always. Hive them in the cave till they raise a ransom." - -"What's a ransom?" - -"Money. You make them raise all they can, off'n their friends; and -after you've kept them a year, if it ain't raised then you kill them. -That's the general way. Only you don't kill the women. You shut up the -women, but you don't kill them. They're always beautiful and rich, and -awfully scared. You take their watches and things, but you always take -your hat off and talk polite. They ain't anybody as polite as robbers ---you'll see that in any book. Well, the women get to loving you, and -after they've been in the cave a week or two weeks they stop crying and -after that you couldn't get them to leave. If you drove them out they'd -turn right around and come back. It's so in all the books." - -"Why, it's real bully, Tom. I believe it's better'n to be a pirate." - -"Yes, it's better in some ways, because it's close to home and -circuses and all that." - -By this time everything was ready and the boys entered the hole, Tom -in the lead. They toiled their way to the farther end of the tunnel, -then made their spliced kite-strings fast and moved on. A few steps -brought them to the spring, and Tom felt a shudder quiver all through -him. He showed Huck the fragment of candle-wick perched on a lump of -clay against the wall, and described how he and Becky had watched the -flame struggle and expire. - -The boys began to quiet down to whispers, now, for the stillness and -gloom of the place oppressed their spirits. They went on, and presently -entered and followed Tom's other corridor until they reached the -"jumping-off place." The candles revealed the fact that it was not -really a precipice, but only a steep clay hill twenty or thirty feet -high. Tom whispered: - -"Now I'll show you something, Huck." - -He held his candle aloft and said: - -"Look as far around the corner as you can. Do you see that? There--on -the big rock over yonder--done with candle-smoke." - -"Tom, it's a CROSS!" - -"NOW where's your Number Two? 'UNDER THE CROSS,' hey? Right yonder's -where I saw Injun Joe poke up his candle, Huck!" - -Huck stared at the mystic sign awhile, and then said with a shaky voice: - -"Tom, less git out of here!" - -"What! and leave the treasure?" - -"Yes--leave it. Injun Joe's ghost is round about there, certain." - -"No it ain't, Huck, no it ain't. It would ha'nt the place where he -died--away out at the mouth of the cave--five mile from here." - -"No, Tom, it wouldn't. It would hang round the money. I know the ways -of ghosts, and so do you." - -Tom began to fear that Huck was right. Misgivings gathered in his -mind. But presently an idea occurred to him-- - -"Lookyhere, Huck, what fools we're making of ourselves! Injun Joe's -ghost ain't a going to come around where there's a cross!" - -The point was well taken. It had its effect. - -"Tom, I didn't think of that. But that's so. It's luck for us, that -cross is. I reckon we'll climb down there and have a hunt for that box." - -Tom went first, cutting rude steps in the clay hill as he descended. -Huck followed. Four avenues opened out of the small cavern which the -great rock stood in. The boys examined three of them with no result. -They found a small recess in the one nearest the base of the rock, with -a pallet of blankets spread down in it; also an old suspender, some -bacon rind, and the well-gnawed bones of two or three fowls. But there -was no money-box. The lads searched and researched this place, but in -vain. Tom said: - -"He said UNDER the cross. Well, this comes nearest to being under the -cross. It can't be under the rock itself, because that sets solid on -the ground." - -They searched everywhere once more, and then sat down discouraged. -Huck could suggest nothing. By-and-by Tom said: - -"Lookyhere, Huck, there's footprints and some candle-grease on the -clay about one side of this rock, but not on the other sides. Now, -what's that for? I bet you the money IS under the rock. I'm going to -dig in the clay." - -"That ain't no bad notion, Tom!" said Huck with animation. - -Tom's "real Barlow" was out at once, and he had not dug four inches -before he struck wood. - -"Hey, Huck!--you hear that?" - -Huck began to dig and scratch now. Some boards were soon uncovered and -removed. They had concealed a natural chasm which led under the rock. -Tom got into this and held his candle as far under the rock as he -could, but said he could not see to the end of the rift. He proposed to -explore. He stooped and passed under; the narrow way descended -gradually. He followed its winding course, first to the right, then to -the left, Huck at his heels. Tom turned a short curve, by-and-by, and -exclaimed: - -"My goodness, Huck, lookyhere!" - -It was the treasure-box, sure enough, occupying a snug little cavern, -along with an empty powder-keg, a couple of guns in leather cases, two -or three pairs of old moccasins, a leather belt, and some other rubbish -well soaked with the water-drip. - -"Got it at last!" said Huck, ploughing among the tarnished coins with -his hand. "My, but we're rich, Tom!" - -"Huck, I always reckoned we'd get it. It's just too good to believe, -but we HAVE got it, sure! Say--let's not fool around here. Let's snake -it out. Lemme see if I can lift the box." - -It weighed about fifty pounds. Tom could lift it, after an awkward -fashion, but could not carry it conveniently. - -"I thought so," he said; "THEY carried it like it was heavy, that day -at the ha'nted house. I noticed that. I reckon I was right to think of -fetching the little bags along." - -The money was soon in the bags and the boys took it up to the cross -rock. - -"Now less fetch the guns and things," said Huck. - -"No, Huck--leave them there. They're just the tricks to have when we -go to robbing. We'll keep them there all the time, and we'll hold our -orgies there, too. It's an awful snug place for orgies." - -"What orgies?" - -"I dono. But robbers always have orgies, and of course we've got to -have them, too. Come along, Huck, we've been in here a long time. It's -getting late, I reckon. I'm hungry, too. We'll eat and smoke when we -get to the skiff." - -They presently emerged into the clump of sumach bushes, looked warily -out, found the coast clear, and were soon lunching and smoking in the -skiff. As the sun dipped toward the horizon they pushed out and got -under way. Tom skimmed up the shore through the long twilight, chatting -cheerily with Huck, and landed shortly after dark. - -"Now, Huck," said Tom, "we'll hide the money in the loft of the -widow's woodshed, and I'll come up in the morning and we'll count it -and divide, and then we'll hunt up a place out in the woods for it -where it will be safe. Just you lay quiet here and watch the stuff till -I run and hook Benny Taylor's little wagon; I won't be gone a minute." - -He disappeared, and presently returned with the wagon, put the two -small sacks into it, threw some old rags on top of them, and started -off, dragging his cargo behind him. When the boys reached the -Welshman's house, they stopped to rest. Just as they were about to move -on, the Welshman stepped out and said: - -"Hallo, who's that?" - -"Huck and Tom Sawyer." - -"Good! Come along with me, boys, you are keeping everybody waiting. -Here--hurry up, trot ahead--I'll haul the wagon for you. Why, it's not -as light as it might be. Got bricks in it?--or old metal?" - -"Old metal," said Tom. - -"I judged so; the boys in this town will take more trouble and fool -away more time hunting up six bits' worth of old iron to sell to the -foundry than they would to make twice the money at regular work. But -that's human nature--hurry along, hurry along!" - -The boys wanted to know what the hurry was about. - -"Never mind; you'll see, when we get to the Widow Douglas'." - -Huck said with some apprehension--for he was long used to being -falsely accused: - -"Mr. Jones, we haven't been doing nothing." - -The Welshman laughed. - -"Well, I don't know, Huck, my boy. I don't know about that. Ain't you -and the widow good friends?" - -"Yes. Well, she's ben good friends to me, anyway." - -"All right, then. What do you want to be afraid for?" - -This question was not entirely answered in Huck's slow mind before he -found himself pushed, along with Tom, into Mrs. Douglas' drawing-room. -Mr. Jones left the wagon near the door and followed. - -The place was grandly lighted, and everybody that was of any -consequence in the village was there. The Thatchers were there, the -Harpers, the Rogerses, Aunt Polly, Sid, Mary, the minister, the editor, -and a great many more, and all dressed in their best. The widow -received the boys as heartily as any one could well receive two such -looking beings. They were covered with clay and candle-grease. Aunt -Polly blushed crimson with humiliation, and frowned and shook her head -at Tom. Nobody suffered half as much as the two boys did, however. Mr. -Jones said: - -"Tom wasn't at home, yet, so I gave him up; but I stumbled on him and -Huck right at my door, and so I just brought them along in a hurry." - -"And you did just right," said the widow. "Come with me, boys." - -She took them to a bedchamber and said: - -"Now wash and dress yourselves. Here are two new suits of clothes ---shirts, socks, everything complete. They're Huck's--no, no thanks, -Huck--Mr. Jones bought one and I the other. But they'll fit both of you. -Get into them. We'll wait--come down when you are slicked up enough." - -Then she left. - - - -CHAPTER XXXIV - -HUCK said: "Tom, we can slope, if we can find a rope. The window ain't -high from the ground." - -"Shucks! what do you want to slope for?" - -"Well, I ain't used to that kind of a crowd. I can't stand it. I ain't -going down there, Tom." - -"Oh, bother! It ain't anything. I don't mind it a bit. I'll take care -of you." - -Sid appeared. - -"Tom," said he, "auntie has been waiting for you all the afternoon. -Mary got your Sunday clothes ready, and everybody's been fretting about -you. Say--ain't this grease and clay, on your clothes?" - -"Now, Mr. Siddy, you jist 'tend to your own business. What's all this -blow-out about, anyway?" - -"It's one of the widow's parties that she's always having. This time -it's for the Welshman and his sons, on account of that scrape they -helped her out of the other night. And say--I can tell you something, -if you want to know." - -"Well, what?" - -"Why, old Mr. Jones is going to try to spring something on the people -here to-night, but I overheard him tell auntie to-day about it, as a -secret, but I reckon it's not much of a secret now. Everybody knows ---the widow, too, for all she tries to let on she don't. Mr. Jones was -bound Huck should be here--couldn't get along with his grand secret -without Huck, you know!" - -"Secret about what, Sid?" - -"About Huck tracking the robbers to the widow's. I reckon Mr. Jones -was going to make a grand time over his surprise, but I bet you it will -drop pretty flat." - -Sid chuckled in a very contented and satisfied way. - -"Sid, was it you that told?" - -"Oh, never mind who it was. SOMEBODY told--that's enough." - -"Sid, there's only one person in this town mean enough to do that, and -that's you. If you had been in Huck's place you'd 'a' sneaked down the -hill and never told anybody on the robbers. You can't do any but mean -things, and you can't bear to see anybody praised for doing good ones. -There--no thanks, as the widow says"--and Tom cuffed Sid's ears and -helped him to the door with several kicks. "Now go and tell auntie if -you dare--and to-morrow you'll catch it!" - -Some minutes later the widow's guests were at the supper-table, and a -dozen children were propped up at little side-tables in the same room, -after the fashion of that country and that day. At the proper time Mr. -Jones made his little speech, in which he thanked the widow for the -honor she was doing himself and his sons, but said that there was -another person whose modesty-- - -And so forth and so on. He sprung his secret about Huck's share in the -adventure in the finest dramatic manner he was master of, but the -surprise it occasioned was largely counterfeit and not as clamorous and -effusive as it might have been under happier circumstances. However, -the widow made a pretty fair show of astonishment, and heaped so many -compliments and so much gratitude upon Huck that he almost forgot the -nearly intolerable discomfort of his new clothes in the entirely -intolerable discomfort of being set up as a target for everybody's gaze -and everybody's laudations. - -The widow said she meant to give Huck a home under her roof and have -him educated; and that when she could spare the money she would start -him in business in a modest way. Tom's chance was come. He said: - -"Huck don't need it. Huck's rich." - -Nothing but a heavy strain upon the good manners of the company kept -back the due and proper complimentary laugh at this pleasant joke. But -the silence was a little awkward. Tom broke it: - -"Huck's got money. Maybe you don't believe it, but he's got lots of -it. Oh, you needn't smile--I reckon I can show you. You just wait a -minute." - -Tom ran out of doors. The company looked at each other with a -perplexed interest--and inquiringly at Huck, who was tongue-tied. - -"Sid, what ails Tom?" said Aunt Polly. "He--well, there ain't ever any -making of that boy out. I never--" - -Tom entered, struggling with the weight of his sacks, and Aunt Polly -did not finish her sentence. Tom poured the mass of yellow coin upon -the table and said: - -"There--what did I tell you? Half of it's Huck's and half of it's mine!" - -The spectacle took the general breath away. All gazed, nobody spoke -for a moment. Then there was a unanimous call for an explanation. Tom -said he could furnish it, and he did. The tale was long, but brimful of -interest. There was scarcely an interruption from any one to break the -charm of its flow. When he had finished, Mr. Jones said: - -"I thought I had fixed up a little surprise for this occasion, but it -don't amount to anything now. This one makes it sing mighty small, I'm -willing to allow." - -The money was counted. The sum amounted to a little over twelve -thousand dollars. It was more than any one present had ever seen at one -time before, though several persons were there who were worth -considerably more than that in property. - - - -CHAPTER XXXV - -THE reader may rest satisfied that Tom's and Huck's windfall made a -mighty stir in the poor little village of St. Petersburg. So vast a -sum, all in actual cash, seemed next to incredible. It was talked -about, gloated over, glorified, until the reason of many of the -citizens tottered under the strain of the unhealthy excitement. Every -"haunted" house in St. Petersburg and the neighboring villages was -dissected, plank by plank, and its foundations dug up and ransacked for -hidden treasure--and not by boys, but men--pretty grave, unromantic -men, too, some of them. Wherever Tom and Huck appeared they were -courted, admired, stared at. The boys were not able to remember that -their remarks had possessed weight before; but now their sayings were -treasured and repeated; everything they did seemed somehow to be -regarded as remarkable; they had evidently lost the power of doing and -saying commonplace things; moreover, their past history was raked up -and discovered to bear marks of conspicuous originality. The village -paper published biographical sketches of the boys. - -The Widow Douglas put Huck's money out at six per cent., and Judge -Thatcher did the same with Tom's at Aunt Polly's request. Each lad had -an income, now, that was simply prodigious--a dollar for every week-day -in the year and half of the Sundays. It was just what the minister got ---no, it was what he was promised--he generally couldn't collect it. A -dollar and a quarter a week would board, lodge, and school a boy in -those old simple days--and clothe him and wash him, too, for that -matter. - -Judge Thatcher had conceived a great opinion of Tom. He said that no -commonplace boy would ever have got his daughter out of the cave. When -Becky told her father, in strict confidence, how Tom had taken her -whipping at school, the Judge was visibly moved; and when she pleaded -grace for the mighty lie which Tom had told in order to shift that -whipping from her shoulders to his own, the Judge said with a fine -outburst that it was a noble, a generous, a magnanimous lie--a lie that -was worthy to hold up its head and march down through history breast to -breast with George Washington's lauded Truth about the hatchet! Becky -thought her father had never looked so tall and so superb as when he -walked the floor and stamped his foot and said that. She went straight -off and told Tom about it. - -Judge Thatcher hoped to see Tom a great lawyer or a great soldier some -day. He said he meant to look to it that Tom should be admitted to the -National Military Academy and afterward trained in the best law school -in the country, in order that he might be ready for either career or -both. - -Huck Finn's wealth and the fact that he was now under the Widow -Douglas' protection introduced him into society--no, dragged him into -it, hurled him into it--and his sufferings were almost more than he -could bear. The widow's servants kept him clean and neat, combed and -brushed, and they bedded him nightly in unsympathetic sheets that had -not one little spot or stain which he could press to his heart and know -for a friend. He had to eat with a knife and fork; he had to use -napkin, cup, and plate; he had to learn his book, he had to go to -church; he had to talk so properly that speech was become insipid in -his mouth; whithersoever he turned, the bars and shackles of -civilization shut him in and bound him hand and foot. - -He bravely bore his miseries three weeks, and then one day turned up -missing. For forty-eight hours the widow hunted for him everywhere in -great distress. The public were profoundly concerned; they searched -high and low, they dragged the river for his body. Early the third -morning Tom Sawyer wisely went poking among some old empty hogsheads -down behind the abandoned slaughter-house, and in one of them he found -the refugee. Huck had slept there; he had just breakfasted upon some -stolen odds and ends of food, and was lying off, now, in comfort, with -his pipe. He was unkempt, uncombed, and clad in the same old ruin of -rags that had made him picturesque in the days when he was free and -happy. Tom routed him out, told him the trouble he had been causing, -and urged him to go home. Huck's face lost its tranquil content, and -took a melancholy cast. He said: - -"Don't talk about it, Tom. I've tried it, and it don't work; it don't -work, Tom. It ain't for me; I ain't used to it. The widder's good to -me, and friendly; but I can't stand them ways. She makes me get up just -at the same time every morning; she makes me wash, they comb me all to -thunder; she won't let me sleep in the woodshed; I got to wear them -blamed clothes that just smothers me, Tom; they don't seem to any air -git through 'em, somehow; and they're so rotten nice that I can't set -down, nor lay down, nor roll around anywher's; I hain't slid on a -cellar-door for--well, it 'pears to be years; I got to go to church and -sweat and sweat--I hate them ornery sermons! I can't ketch a fly in -there, I can't chaw. I got to wear shoes all Sunday. The widder eats by -a bell; she goes to bed by a bell; she gits up by a bell--everything's -so awful reg'lar a body can't stand it." - -"Well, everybody does that way, Huck." - -"Tom, it don't make no difference. I ain't everybody, and I can't -STAND it. It's awful to be tied up so. And grub comes too easy--I don't -take no interest in vittles, that way. I got to ask to go a-fishing; I -got to ask to go in a-swimming--dern'd if I hain't got to ask to do -everything. Well, I'd got to talk so nice it wasn't no comfort--I'd got -to go up in the attic and rip out awhile, every day, to git a taste in -my mouth, or I'd a died, Tom. The widder wouldn't let me smoke; she -wouldn't let me yell, she wouldn't let me gape, nor stretch, nor -scratch, before folks--" [Then with a spasm of special irritation and -injury]--"And dad fetch it, she prayed all the time! I never see such a -woman! I HAD to shove, Tom--I just had to. And besides, that school's -going to open, and I'd a had to go to it--well, I wouldn't stand THAT, -Tom. Looky here, Tom, being rich ain't what it's cracked up to be. It's -just worry and worry, and sweat and sweat, and a-wishing you was dead -all the time. Now these clothes suits me, and this bar'l suits me, and -I ain't ever going to shake 'em any more. Tom, I wouldn't ever got into -all this trouble if it hadn't 'a' ben for that money; now you just take -my sheer of it along with your'n, and gimme a ten-center sometimes--not -many times, becuz I don't give a dern for a thing 'thout it's tollable -hard to git--and you go and beg off for me with the widder." - -"Oh, Huck, you know I can't do that. 'Tain't fair; and besides if -you'll try this thing just a while longer you'll come to like it." - -"Like it! Yes--the way I'd like a hot stove if I was to set on it long -enough. No, Tom, I won't be rich, and I won't live in them cussed -smothery houses. I like the woods, and the river, and hogsheads, and -I'll stick to 'em, too. Blame it all! just as we'd got guns, and a -cave, and all just fixed to rob, here this dern foolishness has got to -come up and spile it all!" - -Tom saw his opportunity-- - -"Lookyhere, Huck, being rich ain't going to keep me back from turning -robber." - -"No! Oh, good-licks; are you in real dead-wood earnest, Tom?" - -"Just as dead earnest as I'm sitting here. But Huck, we can't let you -into the gang if you ain't respectable, you know." - -Huck's joy was quenched. - -"Can't let me in, Tom? Didn't you let me go for a pirate?" - -"Yes, but that's different. A robber is more high-toned than what a -pirate is--as a general thing. In most countries they're awful high up -in the nobility--dukes and such." - -"Now, Tom, hain't you always ben friendly to me? You wouldn't shet me -out, would you, Tom? You wouldn't do that, now, WOULD you, Tom?" - -"Huck, I wouldn't want to, and I DON'T want to--but what would people -say? Why, they'd say, 'Mph! Tom Sawyer's Gang! pretty low characters in -it!' They'd mean you, Huck. You wouldn't like that, and I wouldn't." - -Huck was silent for some time, engaged in a mental struggle. Finally -he said: - -"Well, I'll go back to the widder for a month and tackle it and see if -I can come to stand it, if you'll let me b'long to the gang, Tom." - -"All right, Huck, it's a whiz! Come along, old chap, and I'll ask the -widow to let up on you a little, Huck." - -"Will you, Tom--now will you? That's good. If she'll let up on some of -the roughest things, I'll smoke private and cuss private, and crowd -through or bust. When you going to start the gang and turn robbers?" - -"Oh, right off. We'll get the boys together and have the initiation -to-night, maybe." - -"Have the which?" - -"Have the initiation." - -"What's that?" - -"It's to swear to stand by one another, and never tell the gang's -secrets, even if you're chopped all to flinders, and kill anybody and -all his family that hurts one of the gang." - -"That's gay--that's mighty gay, Tom, I tell you." - -"Well, I bet it is. And all that swearing's got to be done at -midnight, in the lonesomest, awfulest place you can find--a ha'nted -house is the best, but they're all ripped up now." - -"Well, midnight's good, anyway, Tom." - -"Yes, so it is. And you've got to swear on a coffin, and sign it with -blood." - -"Now, that's something LIKE! Why, it's a million times bullier than -pirating. I'll stick to the widder till I rot, Tom; and if I git to be -a reg'lar ripper of a robber, and everybody talking 'bout it, I reckon -she'll be proud she snaked me in out of the wet." - - - -CONCLUSION - -SO endeth this chronicle. It being strictly a history of a BOY, it -must stop here; the story could not go much further without becoming -the history of a MAN. When one writes a novel about grown people, he -knows exactly where to stop--that is, with a marriage; but when he -writes of juveniles, he must stop where he best can. - -Most of the characters that perform in this book still live, and are -prosperous and happy. Some day it may seem worth while to take up the -story of the younger ones again and see what sort of men and women they -turned out to be; therefore it will be wisest not to reveal any of that -part of their lives at present. - - - - - -End of the Project Gutenberg EBook of The Adventures of Tom Sawyer, Complete -by Mark Twain (Samuel Clemens) - -*** END OF THIS PROJECT GUTENBERG EBOOK TOM SAWYER *** - -***** This file should be named 74.txt or 74.zip ***** -This and all associated files of various formats will be found in: - http://www.gutenberg.net/7/74/ - -Produced by David Widger. The previous edition was update by Jose -Menendez. - - -Updated editions will replace the previous one--the old editions -will be renamed. - -Creating the works from public domain print editions means that no -one owns a United States copyright in these works, so the Foundation -(and you!) can copy and distribute it in the United States without -permission and without paying copyright royalties. Special rules, -set forth in the General Terms of Use part of this license, apply to -copying and distributing Project Gutenberg-tm electronic works to -protect the PROJECT GUTENBERG-tm concept and trademark. Project -Gutenberg is a registered trademark, and may not be used if you -charge for the eBooks, unless you receive specific permission. If you -do not charge anything for copies of this eBook, complying with the -rules is very easy. You may use this eBook for nearly any purpose -such as creation of derivative works, reports, performances and -research. They may be modified and printed and given away--you may do -practically ANYTHING with public domain eBooks. Redistribution is -subject to the trademark license, especially commercial -redistribution. - - - -*** START: FULL LICENSE *** - -THE FULL PROJECT GUTENBERG LICENSE -PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK - -To protect the Project Gutenberg-tm mission of promoting the free -distribution of electronic works, by using or distributing this work -(or any other work associated in any way with the phrase "Project -Gutenberg"), you agree to comply with all the terms of the Full Project -Gutenberg-tm License (available with this file or online at -http://gutenberg.net/license). - - -Section 1. General Terms of Use and Redistributing Project Gutenberg-tm -electronic works - -1.A. By reading or using any part of this Project Gutenberg-tm -electronic work, you indicate that you have read, understand, agree to -and accept all the terms of this license and intellectual property -(trademark/copyright) agreement. If you do not agree to abide by all -the terms of this agreement, you must cease using and return or destroy -all copies of Project Gutenberg-tm electronic works in your possession. -If you paid a fee for obtaining a copy of or access to a Project -Gutenberg-tm electronic work and you do not agree to be bound by the -terms of this agreement, you may obtain a refund from the person or -entity to whom you paid the fee as set forth in paragraph 1.E.8. - -1.B. "Project Gutenberg" is a registered trademark. It may only be -used on or associated in any way with an electronic work by people who -agree to be bound by the terms of this agreement. There are a few -things that you can do with most Project Gutenberg-tm electronic works -even without complying with the full terms of this agreement. See -paragraph 1.C below. There are a lot of things you can do with Project -Gutenberg-tm electronic works if you follow the terms of this agreement -and help preserve free future access to Project Gutenberg-tm electronic -works. See paragraph 1.E below. - -1.C. The Project Gutenberg Literary Archive Foundation ("the Foundation" -or PGLAF), owns a compilation copyright in the collection of Project -Gutenberg-tm electronic works. Nearly all the individual works in the -collection are in the public domain in the United States. If an -individual work is in the public domain in the United States and you are -located in the United States, we do not claim a right to prevent you from -copying, distributing, performing, displaying or creating derivative -works based on the work as long as all references to Project Gutenberg -are removed. Of course, we hope that you will support the Project -Gutenberg-tm mission of promoting free access to electronic works by -freely sharing Project Gutenberg-tm works in compliance with the terms of -this agreement for keeping the Project Gutenberg-tm name associated with -the work. You can easily comply with the terms of this agreement by -keeping this work in the same format with its attached full Project -Gutenberg-tm License when you share it without charge with others. - -1.D. The copyright laws of the place where you are located also govern -what you can do with this work. Copyright laws in most countries are in -a constant state of change. If you are outside the United States, check -the laws of your country in addition to the terms of this agreement -before downloading, copying, displaying, performing, distributing or -creating derivative works based on this work or any other Project -Gutenberg-tm work. The Foundation makes no representations concerning -the copyright status of any work in any country outside the United -States. - -1.E. Unless you have removed all references to Project Gutenberg: - -1.E.1. The following sentence, with active links to, or other immediate -access to, the full Project Gutenberg-tm License must appear prominently -whenever any copy of a Project Gutenberg-tm work (any work on which the -phrase "Project Gutenberg" appears, or with which the phrase "Project -Gutenberg" is associated) is accessed, displayed, performed, viewed, -copied or distributed: - -This eBook is for the use of anyone anywhere at no cost and with -almost no restrictions whatsoever. You may copy it, give it away or -re-use it under the terms of the Project Gutenberg License included -with this eBook or online at www.gutenberg.net - -1.E.2. If an individual Project Gutenberg-tm electronic work is derived -from the public domain (does not contain a notice indicating that it is -posted with permission of the copyright holder), the work can be copied -and distributed to anyone in the United States without paying any fees -or charges. If you are redistributing or providing access to a work -with the phrase "Project Gutenberg" associated with or appearing on the -work, you must comply either with the requirements of paragraphs 1.E.1 -through 1.E.7 or obtain permission for the use of the work and the -Project Gutenberg-tm trademark as set forth in paragraphs 1.E.8 or -1.E.9. - -1.E.3. If an individual Project Gutenberg-tm electronic work is posted -with the permission of the copyright holder, your use and distribution -must comply with both paragraphs 1.E.1 through 1.E.7 and any additional -terms imposed by the copyright holder. Additional terms will be linked -to the Project Gutenberg-tm License for all works posted with the -permission of the copyright holder found at the beginning of this work. - -1.E.4. Do not unlink or detach or remove the full Project Gutenberg-tm -License terms from this work, or any files containing a part of this -work or any other work associated with Project Gutenberg-tm. - -1.E.5. Do not copy, display, perform, distribute or redistribute this -electronic work, or any part of this electronic work, without -prominently displaying the sentence set forth in paragraph 1.E.1 with -active links or immediate access to the full terms of the Project -Gutenberg-tm License. - -1.E.6. You may convert to and distribute this work in any binary, -compressed, marked up, nonproprietary or proprietary form, including any -word processing or hypertext form. However, if you provide access to or -distribute copies of a Project Gutenberg-tm work in a format other than -"Plain Vanilla ASCII" or other format used in the official version -posted on the official Project Gutenberg-tm web site (www.gutenberg.net), -you must, at no additional cost, fee or expense to the user, provide a -copy, a means of exporting a copy, or a means of obtaining a copy upon -request, of the work in its original "Plain Vanilla ASCII" or other -form. Any alternate format must include the full Project Gutenberg-tm -License as specified in paragraph 1.E.1. - -1.E.7. Do not charge a fee for access to, viewing, displaying, -performing, copying or distributing any Project Gutenberg-tm works -unless you comply with paragraph 1.E.8 or 1.E.9. - -1.E.8. You may charge a reasonable fee for copies of or providing -access to or distributing Project Gutenberg-tm electronic works provided -that - -- You pay a royalty fee of 20% of the gross profits you derive from - the use of Project Gutenberg-tm works calculated using the method - you already use to calculate your applicable taxes. The fee is - owed to the owner of the Project Gutenberg-tm trademark, but he - has agreed to donate royalties under this paragraph to the - Project Gutenberg Literary Archive Foundation. Royalty payments - must be paid within 60 days following each date on which you - prepare (or are legally required to prepare) your periodic tax - returns. Royalty payments should be clearly marked as such and - sent to the Project Gutenberg Literary Archive Foundation at the - address specified in Section 4, "Information about donations to - the Project Gutenberg Literary Archive Foundation." - -- You provide a full refund of any money paid by a user who notifies - you in writing (or by e-mail) within 30 days of receipt that s/he - does not agree to the terms of the full Project Gutenberg-tm - License. You must require such a user to return or - destroy all copies of the works possessed in a physical medium - and discontinue all use of and all access to other copies of - Project Gutenberg-tm works. - -- You provide, in accordance with paragraph 1.F.3, a full refund of any - money paid for a work or a replacement copy, if a defect in the - electronic work is discovered and reported to you within 90 days - of receipt of the work. - -- You comply with all other terms of this agreement for free - distribution of Project Gutenberg-tm works. - -1.E.9. If you wish to charge a fee or distribute a Project Gutenberg-tm -electronic work or group of works on different terms than are set -forth in this agreement, you must obtain permission in writing from -both the Project Gutenberg Literary Archive Foundation and Michael -Hart, the owner of the Project Gutenberg-tm trademark. Contact the -Foundation as set forth in Section 3 below. - -1.F. - -1.F.1. Project Gutenberg volunteers and employees expend considerable -effort to identify, do copyright research on, transcribe and proofread -public domain works in creating the Project Gutenberg-tm -collection. Despite these efforts, Project Gutenberg-tm electronic -works, and the medium on which they may be stored, may contain -"Defects," such as, but not limited to, incomplete, inaccurate or -corrupt data, transcription errors, a copyright or other intellectual -property infringement, a defective or damaged disk or other medium, a -computer virus, or computer codes that damage or cannot be read by -your equipment. - -1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for the "Right -of Replacement or Refund" described in paragraph 1.F.3, the Project -Gutenberg Literary Archive Foundation, the owner of the Project -Gutenberg-tm trademark, and any other party distributing a Project -Gutenberg-tm electronic work under this agreement, disclaim all -liability to you for damages, costs and expenses, including legal -fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT -LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE -PROVIDED IN PARAGRAPH F3. YOU AGREE THAT THE FOUNDATION, THE -TRADEMARK OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE -LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE OR -INCIDENTAL DAMAGES EVEN IF YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH -DAMAGE. - -1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you discover a -defect in this electronic work within 90 days of receiving it, you can -receive a refund of the money (if any) you paid for it by sending a -written explanation to the person you received the work from. If you -received the work on a physical medium, you must return the medium with -your written explanation. The person or entity that provided you with -the defective work may elect to provide a replacement copy in lieu of a -refund. If you received the work electronically, the person or entity -providing it to you may choose to give you a second opportunity to -receive the work electronically in lieu of a refund. If the second copy -is also defective, you may demand a refund in writing without further -opportunities to fix the problem. - -1.F.4. Except for the limited right of replacement or refund set forth -in paragraph 1.F.3, this work is provided to you 'AS-IS' WITH NO OTHER -WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR ANY PURPOSE. - -1.F.5. Some states do not allow disclaimers of certain implied -warranties or the exclusion or limitation of certain types of damages. -If any disclaimer or limitation set forth in this agreement violates the -law of the state applicable to this agreement, the agreement shall be -interpreted to make the maximum disclaimer or limitation permitted by -the applicable state law. The invalidity or unenforceability of any -provision of this agreement shall not void the remaining provisions. - -1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation, the -trademark owner, any agent or employee of the Foundation, anyone -providing copies of Project Gutenberg-tm electronic works in accordance -with this agreement, and any volunteers associated with the production, -promotion and distribution of Project Gutenberg-tm electronic works, -harmless from all liability, costs and expenses, including legal fees, -that arise directly or indirectly from any of the following which you do -or cause to occur: (a) distribution of this or any Project Gutenberg-tm -work, (b) alteration, modification, or additions or deletions to any -Project Gutenberg-tm work, and (c) any Defect you cause. - - -Section 2. Information about the Mission of Project Gutenberg-tm - -Project Gutenberg-tm is synonymous with the free distribution of -electronic works in formats readable by the widest variety of computers -including obsolete, old, middle-aged and new computers. It exists -because of the efforts of hundreds of volunteers and donations from -people in all walks of life. - -Volunteers and financial support to provide volunteers with the -assistance they need, is critical to reaching Project Gutenberg-tm's -goals and ensuring that the Project Gutenberg-tm collection will -remain freely available for generations to come. In 2001, the Project -Gutenberg Literary Archive Foundation was created to provide a secure -and permanent future for Project Gutenberg-tm and future generations. -To learn more about the Project Gutenberg Literary Archive Foundation -and how your efforts and donations can help, see Sections 3 and 4 -and the Foundation web page at http://www.pglaf.org. - - -Section 3. Information about the Project Gutenberg Literary Archive -Foundation - -The Project Gutenberg Literary Archive Foundation is a non profit -501(c)(3) educational corporation organized under the laws of the -state of Mississippi and granted tax exempt status by the Internal -Revenue Service. The Foundation's EIN or federal tax identification -number is 64-6221541. Its 501(c)(3) letter is posted at -http://pglaf.org/fundraising. Contributions to the Project Gutenberg -Literary Archive Foundation are tax deductible to the full extent -permitted by U.S. federal laws and your state's laws. - -The Foundation's principal office is located at 4557 Melan Dr. S. -Fairbanks, AK, 99712., but its volunteers and employees are scattered -throughout numerous locations. Its business office is located at -809 North 1500 West, Salt Lake City, UT 84116, (801) 596-1887, email -business@pglaf.org. Email contact links and up to date contact -information can be found at the Foundation's web site and official -page at http://pglaf.org - -For additional contact information: - Dr. Gregory B. Newby - Chief Executive and Director - gbnewby@pglaf.org - - -Section 4. Information about Donations to the Project Gutenberg -Literary Archive Foundation - -Project Gutenberg-tm depends upon and cannot survive without wide -spread public support and donations to carry out its mission of -increasing the number of public domain and licensed works that can be -freely distributed in machine readable form accessible by the widest -array of equipment including outdated equipment. Many small donations -($1 to $5,000) are particularly important to maintaining tax exempt -status with the IRS. - -The Foundation is committed to complying with the laws regulating -charities and charitable donations in all 50 states of the United -States. Compliance requirements are not uniform and it takes a -considerable effort, much paperwork and many fees to meet and keep up -with these requirements. We do not solicit donations in locations -where we have not received written confirmation of compliance. To -SEND DONATIONS or determine the status of compliance for any -particular state visit http://pglaf.org - -While we cannot and do not solicit contributions from states where we -have not met the solicitation requirements, we know of no prohibition -against accepting unsolicited donations from donors in such states who -approach us with offers to donate. - -International donations are gratefully accepted, but we cannot make -any statements concerning tax treatment of donations received from -outside the United States. U.S. laws alone swamp our small staff. - -Please check the Project Gutenberg Web pages for current donation -methods and addresses. Donations are accepted in a number of other -ways including including checks, online payments and credit card -donations. To donate, please visit: http://pglaf.org/donate - - -Section 5. General Information About Project Gutenberg-tm electronic -works. - -Professor Michael S. Hart is the originator of the Project Gutenberg-tm -concept of a library of electronic works that could be freely shared -with anyone. For thirty years, he produced and distributed Project -Gutenberg-tm eBooks with only a loose network of volunteer support. - - -Project Gutenberg-tm eBooks are often created from several printed -editions, all of which are confirmed as Public Domain in the U.S. -unless a copyright notice is included. Thus, we do not necessarily -keep eBooks in compliance with any particular paper edition. - - -Most people start at our Web site which has the main PG search facility: - - http://www.gutenberg.net - -This Web site includes information about Project Gutenberg-tm, -including how to make donations to the Project Gutenberg Literary -Archive Foundation, how to help produce our new eBooks, and how to -subscribe to our email newsletter to hear about new eBooks. diff --git a/llgo/third_party/gofrontend/libgo/go/compress/testdata/e.txt b/llgo/third_party/gofrontend/libgo/go/compress/testdata/e.txt deleted file mode 100644 index 5ca186f14c1591c83e5348389ae018235af354e8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/testdata/e.txt +++ /dev/null @@ -1 +0,0 @@ -2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161403970198376793206832823764648042953118023287825098194558153017567173613320698112509961818815930416903515988885193458072738667385894228792284998920868058257492796104841984443634632449684875602336248270419786232090021609902353043699418491463140934317381436405462531520961836908887070167683964243781405927145635490613031072085103837505101157477041718986106873969655212671546889570350354021234078498193343210681701210056278802351930332247450158539047304199577770935036604169973297250886876966403555707162268447162560798826517871341951246652010305921236677194325278675398558944896970964097545918569563802363701621120477427228364896134225164450781824423529486363721417402388934412479635743702637552944483379980161254922785092577825620926226483262779333865664816277251640191059004916449982893150566047258027786318641551956532442586982946959308019152987211725563475463964479101459040905862984967912874068705048958586717479854667757573205681288459205413340539220001137863009455606881667400169842055804033637953764520304024322566135278369511778838638744396625322498506549958862342818997077332761717839280349465014345588970719425863987727547109629537415211151368350627526023264847287039207643100595841166120545297030236472549296669381151373227536450988890313602057248176585118063036442812314965507047510254465011727211555194866850800368532281831521960037356252794495158284188294787610852639813955990067376482922443752871846245780361929819713991475644882626039033814418232625150974827987779964373089970388867782271383605772978824125611907176639465070633045279546618550966661856647097113444740160704626215680717481877844371436988218559670959102596862002353718588748569652200050311734392073211390803293634479727355955277349071783793421637012050054513263835440001863239914907054797780566978533580489669062951194324730995876552368128590413832411607226029983305353708761389396391779574540161372236187893652605381558415871869255386061647798340254351284396129460352913325942794904337299085731580290958631382683291477116396337092400316894586360606458459251269946557248391865642097526850823075442545993769170419777800853627309417101634349076964237222943523661255725088147792231519747780605696725380171807763603462459278778465850656050780844211529697521890874019660906651803516501792504619501366585436632712549639908549144200014574760819302212066024330096412704894390397177195180699086998606636583232278709376502260149291011517177635944602023249300280401867723910288097866605651183260043688508817157238669842242201024950551881694803221002515426494639812873677658927688163598312477886520141174110913601164995076629077943646005851941998560162647907615321038727557126992518275687989302761761146162549356495903798045838182323368612016243736569846703785853305275833337939907521660692380533698879565137285593883499894707416181550125397064648171946708348197214488898790676503795903669672494992545279033729636162658976039498576741397359441023744329709355477982629614591442936451428617158587339746791897571211956187385783644758448423555581050025611492391518893099463428413936080383091662818811503715284967059741625628236092168075150177725387402564253470879089137291722828611515915683725241630772254406337875931059826760944203261924285317018781772960235413060672136046000389661093647095141417185777014180606443636815464440053316087783143174440811949422975599314011888683314832802706553833004693290115744147563139997221703804617092894579096271662260740718749975359212756084414737823303270330168237193648002173285734935947564334129943024850235732214597843282641421684878721673367010615094243456984401873312810107945127223737886126058165668053714396127888732527373890392890506865324138062796025930387727697783792868409325365880733988457218746021005311483351323850047827169376218004904795597959290591655470505777514308175112698985188408718564026035305583737832422924185625644255022672155980274012617971928047139600689163828665277009752767069777036439260224372841840883251848770472638440379530166905465937461619323840363893131364327137688841026811219891275223056256756254701725086349765367288605966752740868627407912856576996313789753034660616669804218267724560530660773899624218340859882071864682623215080288286359746839654358856685503773131296587975810501214916207656769950659715344763470320853215603674828608378656803073062657633469774295634643716709397193060876963495328846833613038829431040800296873869117066666146800015121143442256023874474325250769387077775193299942137277211258843608715834835626961661980572526612206797540621062080649882918454395301529982092503005498257043390553570168653120526495614857249257386206917403695213533732531666345466588597286659451136441370331393672118569553952108458407244323835586063106806964924851232632699514603596037297253198368423363904632136710116192821711150282801604488058802382031981493096369596735832742024988245684941273860566491352526706046234450549227581151709314921879592718001940968866986837037302200475314338181092708030017205935530520700706072233999463990571311587099635777359027196285061146514837526209565346713290025994397663114545902685898979115837093419370441155121920117164880566945938131183843765620627846310490346293950029458341164824114969758326011800731699437393506966295712410273239138741754923071862454543222039552735295240245903805744502892246886285336542213815722131163288112052146489805180092024719391710555390113943316681515828843687606961102505171007392762385553386272553538830960671644662370922646809671254061869502143176211668140097595281493907222601112681153108387317617323235263605838173151034595736538223534992935822836851007810884634349983518404451704270189381994243410090575376257767571118090088164183319201962623416288166521374717325477727783488774366518828752156685719506371936565390389449366421764003121527870222366463635755503565576948886549500270853923617105502131147413744106134445544192101336172996285694899193369184729478580729156088510396781959429833186480756083679551496636448965592948187851784038773326247051945050419847742014183947731202815886845707290544057510601285258056594703046836344592652552137008068752009593453607316226118728173928074623094685367823106097921599360019946237993434210687813497346959246469752506246958616909178573976595199392993995567542714654910456860702099012606818704984178079173924071945996323060254707901774527513186809982284730860766536866855516467702911336827563107223346726113705490795365834538637196235856312618387156774118738527722922594743373785695538456246801013905727871016512966636764451872465653730402443684140814488732957847348490003019477888020460324660842875351848364959195082888323206522128104190448047247949291342284951970022601310430062410717971502793433263407995960531446053230488528972917659876016667811937932372453857209607582277178483361613582612896226118129455927462767137794487586753657544861407611931125958512655759734573015333642630767985443385761715333462325270572005303988289499034259566232975782488735029259166825894456894655992658454762694528780516501720674785417887982276806536650641910973434528878338621726156269582654478205672987756426325321594294418039943217000090542650763095588465895171709147607437136893319469090981904501290307099566226620303182649365733698419555776963787624918852865686607600566025605445711337286840205574416030837052312242587223438854123179481388550075689381124935386318635287083799845692619981794523364087429591180747453419551420351726184200845509170845682368200897739455842679214273477560879644279202708312150156406341341617166448069815483764491573900121217041547872591998943825364950514771379399147205219529079396137621107238494290616357604596231253506068537651423115349665683715116604220796394466621163255157729070978473156278277598788136491951257483328793771571459091064841642678309949723674420175862269402159407924480541255360431317992696739157542419296607312393763542139230617876753958711436104089409966089471418340698362993675362621545247298464213752891079884381306095552622720837518629837066787224430195793793786072107254277289071732854874374355781966511716618330881129120245204048682200072344035025448202834254187884653602591506445271657700044521097735585897622655484941621714989532383421600114062950718490427789258552743035221396835679018076406042138307308774460170842688272261177180842664333651780002171903449234264266292261456004337383868335555343453004264818473989215627086095650629340405264943244261445665921291225648893569655009154306426134252668472594914314239398845432486327461842846655985332312210466259890141712103446084271616619001257195870793217569698544013397622096749454185407118446433946990162698351607848924514058940946395267807354579700307051163682519487701189764002827648414160587206184185297189154019688253289309149665345753571427318482016384644832499037886069008072709327673127581966563941148961716832980455139729506687604740915420428429993541025829113502241690769431668574242522509026939034814856451303069925199590436384028429267412573422447765584177886171737265462085498294498946787350929581652632072258992368768457017823038096567883112289305809140572610865884845873101658151167533327674887014829167419701512559782572707406431808601428149024146780472327597684269633935773542930186739439716388611764209004068663398856841681003872389214483176070116684503887212364367043314091155733280182977988736590916659612402021778558854876176161989370794380056663364884365089144805571039765214696027662583599051987042300179465536788567430285974600143785483237068701190078499404930918919181649327259774030074879681484882342932023012128032327460392219687528340516906974194257614673978110715464186273369091584973185011183960482533518748438923177292613543024932562896371361977285456622924461644497284597867711574125670307871885109336344480149675240618536569532074170533486782754827815415561966911055101472799040386897220465550833170782394808785990501947563108984124144672821865459971596639015641941751820935932616316888380132758752601460507676098392625726411120135288591317848299475682472564885533357279772205543568126302535748216585414000805314820697137262149755576051890481622376790414926742600071045922695314835188137463887104273544767623577933993970632396604969145303273887874557905934937772320142954803345000695256980935282887783710670585567749481373858630385762823040694005665340584887527005308832459182183494318049834199639981458773435863115940570443683515285383609442955964360676090221741896883548131643997437764158365242234642619597390455450680695232850751868719449064767791886720306418630751053512149851051207313846648717547518382979990189317751550639981016466414592102406838294603208535554058147159273220677567669213664081505900806952540610628536408293276621931939933861623836069111767785448236129326858199965239275488427435414402884536455595124735546139403154952097397051896240157976832639450633230452192645049651735466775699295718989690470902730288544945416699791992948038254980285946029052763145580316514066229171223429375806143993484914362107993576737317948964252488813720435579287511385856973381976083524423240466778020948399639946684833774706725483618848273000648319163826022110555221246733323184463005504481849916996622087746140216157021029603318588727333298779352570182393861244026868339555870607758169954398469568540671174444932479519572159419645863736126915526457574786985964242176592896862383506370433939811671397544736228625506803682664135541448048997721373174119199970017293907303350869020922519124447393278376156321810842898207706974138707053266117683698647741787180202729412982310888796831880854367327806879771659111654224453806625861711729498038248879986504061563975629936962809358189761491017145343556659542757064194408833816841111166200759787244137082333917886114708228657531078536674695018462140736493917366254937783014074302668422150335117736471853872324040421037907750266020114814935482228916663640782450166815341213505278578539332606110249802273093636740213515386431693015267460536064351732154701091440650878823636764236831187390937464232609021646365627553976834019482932795750624399645272578624400375983422050808935129023122475970644105678361870877172333555465482598906861201410107222465904008553798235253885171623518256518482203125214950700378300411216212126052726059944320443056274522916128891766814160639131235975350390320077529587392412476451850809163911459296071156344204347133544720981178461451077872399140606290228276664309264900592249810291068759434533858330391178747575977065953570979640012224092199031158229259667913153991561438070129260780197022589662923368154312499412259460023399472228171056603931877226800493833148980338548909468685130789292064242819174795866199944411196208730498064385006852620258432842085582338566936649849720817046135376163584015342840674118587581546514598270228676671855309311923340191286170613364873183197560812569460089402953094429119590295968563923037689976327462283900735457144596414108229285922239332836210192822937243590283003884445701383771632056518351970100115722010956997890484964453434612129224964732356126321951155701565824427661599326463155806672053127596948538057364208384918887095176052287817339462747644656858900936266123311152910816041524100214195937349786431661556732702792109593543055579732660554677963552005378304619540636971842916168582734122217145885870814274090248185446421774876925093328785670674677381226752831653559245204578070541352576903253522738963847495646255940378924925007624386893776475310102323746733771474581625530698032499033676455430305274561512961214585944432150749051491453950981001388737926379964873728396416897555132275962011838248650746985492038097691932606437608743209385602815642849756549307909733854185583515789409814007691892389063090542534883896831762904120212949167195811935791203162514344096503132835216728021372415947344095498316138322505486708172221475138425166790445416617303200820330902895488808516797258495813407132180533988828139346049850532340472595097214331492586604248511405819579711564191458842833000525684776874305916390494306871343118796189637475503362820939949343690321031976898112055595369465424704173323895394046035325396758354395350516720261647961347790912327995264929045151148307923369382166010702872651938143844844532639517394110131152502750465749343063766541866128915264446926222884366299462732467958736383501937142786471398054038215513463223702071533134887083174146591492406359493020921122052610312390682941345696785958518393491382340884274312419099152870804332809132993078936867127413922890033069995875921815297612482409116951587789964090352577345938248232053055567238095022266790439614231852991989181065554412477204508510210071522352342792531266930108270633942321762570076323139159349709946933241013908779161651226804414809765618979735043151396066913258379033748620836695475083280318786707751177525663963479259219733577949555498655214193398170268639987388347010255262052312317215254062571636771270010760912281528326508984359568975961038372157726831170734552250194121701541318793651818502020877326906133592182000762327269503283827391243828198170871168108951187896746707073377869592565542713340052326706040004348843432902760360498027862160749469654989210474443927871934536701798673920803845633723311983855862638008516345597194441994344624761123844617615736242015935078520825600604101556889899501732554337298073561699861101908472096600708320280569917042590103876928658336557728758684250492690370934262028022399861803400211320742198642917383679176232826444645756330336556777374808644109969141827774253417010988435853189339175934511574023847292909015468559163792696196841000676598399744972047287881831200233383298030567865480871476464512824264478216644266616732096012564794514827125671326697067367144617795643752391742928503987022583734069852309190464967260243411270345611114149835783901793499713790913696706497637127248466613279908254305449295528594932793818341607827091326680865655921102733746700132583428715240835661522165574998431236278287106649401564670141943713823863454729606978693335973109537126499416282656463708490580151538205338326511289504938566468752921135932220265681856418260827538790002407915892646028490894922299966167437731347776134150965262448332709343898412056926145108857812249139616912534202918139898683901335795857624435194008943955180554746554000051766240202825944828833811886381749594284892013520090951007864941868256009273977667585642598378587497776669563350170748579027248701370264203283965756348010818356182372177082236423186591595883669487322411726504487268392328453010991677518376831599821263237123854357312681202445175401852132663740538802901249728180895021553100673598184430429105288459323064725590442355960551978839325930339572934663055160430923785677229293537208416693134575284011873746854691620648991164726909428982971065606801805807843600461866223562874591385185904416250663222249561448724413813849763797102676020845531824111963927941069619465426480006761727618115630063644321116224837379105623611358836334550102286170517890440570419577859833348463317921904494652923021469259756566389965893747728751393377105569802455757436190501772466214587592374418657530064998056688376964229825501195065837843125232135309371235243969149662310110328243570065781487677299160941153954063362752423712935549926713485031578238899567545287915578420483105749330060197958207739558522807307048950936235550769837881926357141779338750216344391014187576711938914416277109602859415809719913429313295145924373636456473035037374538503489286113141638094752301745088784885645741275003353303416138096560043105860548355773946625033230034341587814634602169235079216111013148948281895391028916816328709309713184139815427678818067628650978085718262117003140003377301581536334149093237034703637513354537634521050370995452942055232078817449370937677056009306353645510913481627378204985657055608784211964039972344556458607689515569686899384896439195225232309703301037277227710870564912966121061494072782442033414057441446459968236966118878411656290355117839944070961772567164919790168195234523807446299877664824873753313018142763910519234685081979001796519907050490865237442841652776611425351538665162781316090964802801234493372427866930894827913465443931965254154829494577875758599482099181824522449312077768250830768282335001597040419199560509705364696473142448453825888112602753909548852639708652339052941829691802357120545328231809270356491743371932080628731303589640570873779967845174740515317401384878082881006046388936711640477755985481263907504747295012609419990373721246201677030517790352952793168766305099837441859803498821239340919805055103821539827677291373138006715339240126954586376422065097810852907639079727841301764553247527073788764069366420012194745702358295481365781809867944020220280822637957006755393575808086318932075864444206644691649334467698180811716568665213389686173592450920801465312529777966137198695916451869432324246404401672381978020728394418264502183131483366019384891972317817154372192103946638473715630226701801343515930442853848941825678870721238520597263859224934763623122188113706307506918260109689069251417142514218153491532129077723748506635489170892850760234351768218355008829647410655814882049239533702270536705630750317499788187009989251020178015601042277836283644323729779929935160925884515772055232896978333126427671291093993103773425910592303277652667641874842441076564447767097790392324958416348527735171981064673837142742974468992320406932506062834468937543016787815320616009057693404906146176607094380110915443261929000745209895959201159412324102274845482605404361871836330268992858623582145643879695210235266673372434423091577183277565800211928270391042391966426911155333594569685782817020325495552528875464466074620294766116004435551604735044292127916358748473501590215522120388281168021413865865168464569964810015633741255098479730138656275460161279246359783661480163871602794405482710196290774543628092612567507181773641749763254436773503632580004042919906963117397787875081560227368824967077635559869284901628768699628053790181848148810833946900016380791075960745504688912686792812391148880036720729730801354431325347713094186717178607522981373539126772812593958220524289991371690685650421575056729991274177149279608831502358697816190894908487717722503860872618384947939757440664912760518878124233683125467278331513186758915668300679210215947336858591201395360301678110413444411030903388761520488296909104689167671555373346622545575975202624771242796225983278405833585897671474205724047439720232895903726148688388003174146490203843590358527993123871042845981608996101945691646983837718267264685264869172948414153004604004299585035164101899027529366867431834955447458124140190754681607770977920579383895378192128847409929537040546962226547278807248685508046571043123854873351653070570784584243335550958221912862797205455466267099131902370311779690892786623112661337671178512943059323281605826535623848164192144732543731002062738466812351691016359252588256806438946389880872735284406462208149513862275239938938734905082625472417781702582044129853760499827899020083498387362992498125742354568439023012261733665820546785671147973065077035475620567428300187473019197310881157516777005071432012726354601912460800451608108641835539669946936947322271670748972850464195392966434725254724357659192969949061670189061433616907056148280980363243454128229968275980226694045642181328624517549652147221620839824594576613342710564957193564431561774500828376935700995419541839029151033187933907614207467028867968594985439789457300768939890070073924697461812855764662265412913204052279071212820653775058280040897163467163709024906774736309136904002615646432159560910851092445162454420141442641660181385990017417408244245378610158433361777292580611159192008414091888191208858207627011483671760749046980914443057262211104583300789331698191603917150622792986282709446275915009683226345073725451366858172483498470080840163868209726371345205439802277866337293290829914010645589761697455978409211409167684020269370229231743334499986901841510888993165125090001163719114994852024821586396216294981753094623047604832399379391002142532996476235163569009445086058091202459904612118623318278614464727795523218635916551883057930657703331498510068357135624341881884405780028844018129031378653794869614630467726914552953690154167025838032477842272417994513653582260971652588356712133519546838335349801503269359798167463231847628306340588324731228951257944267639877946713121042763380872695738609314631539148548792514028885025189788076023838995615684850391995855029256054176767663145354058496296796781349420116003325874431438746248313850214980401681940795687219268462617287403480967931949965604299190281810597603263251746405016454606266765529010639868703668263299050577706266397868453584384057673298268163448646707439990917504018892319267557518354054956017732907127219134577524905771512773358423314008356080926962298894163047287780054743798498545562870729968407382937218623831766524716090967192007237658894226186550487552614557855898773008703234726418384831040394818743616224455286163287628541175946460497027724490799275146445792982549802258601001772437840167723166802004162547244179415547810554178036773553354467030326469619447560812831933095679685582771932031205941616693902049665352189672822671972640029493307384717544753761937017882976382487233361813499414541694736549254840633793674361541081593464960431603544354737728802361047743115330785159902977771499610274627769759612488879448609863349422852847651310277926279743981957617505591300993377368240510902583759345170015340522266144077237050890044496613295859536020556034009492820943862994618834790932894161098856594954213114335608810239423706087108026465913203560121875933791639666437282836752328391688865373751335794859860107569374889645657187292540448508624449947816273842517229343960137212406286783636675845331904743954740664015260871940915743955282773904303868772728262065663129387459875317749973799293043294371763801856280061141619563942414312254397099163565102848315765427037906837175764870230052388197498746636856292655058222887713221781440489538099681072143012394693530931524054081215705402274414521876541901428386744260011889041724570537470755550581632831687247110220353727166112304857340460879272501694701067831178927095527253222125224361673343366384756590949728221809418684074238351567868893421148203905824224324264643630201441787982022116248471657468291146315407563770222740135841109076078464780070182766336227978104546331131294044833570134869585165267459515187680033395522410548181767867772152798270250117195816577603549732923724732067853690257536233971216884390878879262188202305529937132397194333083536231248870386416194361506529551267334207198502259771408638122015980894363561808597010080081622557455039101321981979045520049618583777721048046635533806616517023595097133203631578945644487800945620369784973459902004606886572701865867757842758530645706617127194967371083950603267501532435909029491516973738110897934782297684100117657987098185725131372267749706609250481876835516003714638685918913011736805218743265426063700710595364425062760458252336880552521181566417553430681181548267844169315284408461087588214317641649835663127518728182948655658524206852221830755306118393326934164459415342651778653397980580828158806300749952897558204686612590853678738603318442905510689778698417735603118111677563872589911516803236547002987989628986181014596471307916144369564690909518788574398821730583884980809523077569358851616027719521488998358632323127308909861560777386006984035267826785387215920936255817889813416247486456433211043194821421299793188104636399541496539441501383868748384870224681829391860319598667962363489309283087840712400431022706137591368056518861313458307990705003607588327248867879324093380071864152853317943535073401891193638546730000660453783784472469288830546979000131248952100446949032058838294923613919284305249167833012980192255157050378521810552961623637523647962685751660066539364142273063001648652613891842243501797455993616794063303522111829071597538821839777552812981538570168702202620274678647916644030729018445497956399844836807851997088201407769199261674991148329821854382718946282165387064858588646221611410343570342878862979083418871606214430014533275029715104673156021000043869510583773779766003460887624861640938645252177935289947578496255243925598620521409052346250847830487046492688313289470553891357290706967599556298586669559721686506052072801342104355762779184021797626656484580261591407173477009039475168017709900129391137881248534255949312866653465033728846390649968460644741907524313323903404908195233044389559060547854954620263256676813262435925020249516275607080900436460421497025691488555265022810327762115842282433269528629137662675481993546118143913367579700141255870143319434764035725376914388899683088262844616425575034001428982557620386364384137906519612917777354183694676232982904981261717676191554292570438432239918482261744350470199171258214687683172646078959690569981353264435973965173473319484798758064137926885413552523275720457329477215706850016950046959758389373527538622664943456437071610511521617176237598050900553232154896062817794302268640579555845730600598376482703339859420098582351400179507104569019191359062304102336798080907240196312675268916362136351032648077232914950859151265812143823371072949148088472355286394195993455684156344577951727033374238129903260198160571971183950662758220321837136059718025940870615534713104482272716848395524105913605919812444978458110854511231668173534838253724825347636777581712867205865148285317273569069839935110763432091319780314031658897379628301178409806410175016511072932907832177487566289310650383806093372841399226733384778203302020700517188941706465146238366720632742644336612174011766914919235570905644803016342294301837655263108450172510307540942604409687066288066265900569082451407632599158164499361455172452057020443093722305550217222299706209749268609762787409626448772056043078634808885709143464793241536214303199965695610753570417207285334250171325558818113295504095217830139465216436594262960768570585698507157151317262928960072587601564840556088613165411835958628710665496282599535127193244635791046554389165150954187306071015034430609582302257455974944275067630926322529966338219395202927917973247094559691016402983683080426309910481567503623509654924302589575273521412445149542462972258510120707802110188106722347972579330653187713438466713807546383471635428854957610942841898601794658721444495198801550804042506452191484989920400007310672369944655246020908767882300064337725657385010969899058191290957079866699453765080407917852438222041070599278889267745752084287526377986730360561230710723922581504781379172731261234878334034473833573601973235946604273704635201327182592410906040097638585857716958419563109577748529579836844756803121874818202833941887076311731615289811756429711334181497218078040465077657204457082859417475114926179367379999220181789399433337731146911970737861041963986422166045588965683206701337505745038872111332436739840284188639147633491695114032583475841514170325690161784931455706904169858050217798497637014758914810543205854914100662201721719726878930012101267481270235940855162601689425111458499658315589660460091525797881670384625905383256920520425791378948827579603278877535466861441826827797651258953563761485994485049706638406266121957141911063246061774180577212381659872472432252969098533628440799030007594546281549235506086481557928961969617060715201589825299772803520002610888814176506636216905928021516429198484077446143617891415191517976537848282687018750030264867608433204658525470555882410254654806040437372771834769014720664234434374255514129178503032471263418076525187802925534774001104853996960549926508093910691337614841834884596365621526610332239417467064368340504749943339802285610313083038484571294767389856293937641914407036507544622061186499127249643799875806537850203753189972618014404667793050140301580709266213229273649718653952866567538572115133606114457222800851183757899219543063413692302293139751143702404830227357629039911794499248480915071002444078482866598579406525539141041497342780203520135419925977628178182825372022920108186449448349255421793982723279357095828748597126780783134286180750497175747373730296280477376908932558914598141724852658299510882230055223242218586191394795184220131553319634363922684259164168669438122537135960710031743651959027712571604588486044820674410935215327906816032054215967959066411120187618531256710150212239401285668608469435937408158536481912528004920724042172170913983123118054043277015835629513656274610248827706488865037765175678806872498861657094846665770674577000207144332525555736557083150320019082992096545498737419756608619533492312940263904930982014700371161829485939931199955070455381196711289367735249958182011774799788636393286405807810818657337668157893827656450642917396685579555053188715314552353070355994740186225988149854660737787698781542360397080977412361518245964026869979609564523828584235953564615185448165799966460648261396618720304839119560250381111550938420209894591555760083897989949964566262540514195610780090298667014635238532066032574466820259430618801773091109212741138269148784355679352572808875543164693077235363768226036080174040660997151176880434927489197133087822951123746632635635328517394189466510943745768270782209928468034684157443127739811044186762032954475468077511126663685479944460934809992951875666499902261686019672053749149951226823637895865245462813439289338365156536992413109638102559114643923805213907862893561660998836479175633176725856523591069520326895990054884753424160586689820067483163174286329119633399132709086065074595260357157323069712106423424081597068328707624437165532750228797802598690981111226558888151520837482450034463046505984569690276166958278982913613535306291331427881888249342136442417833519319786543940201465328083410341785272489879050919932369270996567133507711905899945951923990615156165480300145359212550696405345263823452155999210578191371030188979206408883974767667144727314254467923500524618849237455307575734902707342496298879996942094595961008702501329453325358045689285707241207965919809225550560061971283541270202072583994171175520920820151096509526685113897577150810849443508285458749912943857563115668324566827992991861539009255871716840495663991959154034218364537212023678608655364745175654879318925644085274489190918193411667583563439758886046349413111875241038425467937999203546910411935443113219136068129657568583611774564654674861061988591414805799318725367531243470335482637527081353105570818049642498584646147973467599315946514787025065271083508782350656532331797738656666181652390017664988485456054961300215776115255813396184027067814900350252876823607822107397102339146870159735868589015297010347780503292154014359595298683404657471756232196640515401477953167461726208727304820634652469109953327375561090578378455945469160223687689641425960164689647106348074109928546482353083540132332924864037318003195202317476206537726163717445360549726690601711176761047774971666890152163838974311714180622222345718567941507299526201086205084783127474791909996889937275229053674785020500038630036526218800670926674104806027341997756660029427941090400064654281074454007616429525362460261476180471744322889953285828397762184600967669267581270302806519535452053173536808954589902180783145775891280203970053633193821100095443241244197949192916205234421346395653840781209416214835001155883618421164283992454027590719621537570187067083731012246141362048926555668109467076386536083015847614512581588569610030337081197058344452874666198891534664244887911940711423940115986970795745946337170243268484864632018986352827092313047089215684758207753034387689978702323438584381125011714013265769320554911860153519551654627941175593967947958810333935413289702528893533748106257875620364294270257512121137330213811951395756419122685155962476203282038726342066227347868223036522019655729325905068134849292299647248229359787842720945578267329975853818536442370617353517653060396801087899490506654491544577952166038552398013798104340564182403396162494910454712104839439200945914647542424785991096900046541371091630096785951563947332190934511838669964622788855817353221326876634958059123761251203010983867841195725887799206041260049865895027247133146763722204388398558347770112599424691208308595666787531942465131444389971195968105937957532155524204659410081418351120174196853432672343271868099625045432475688702055341969199545300952644398446384346598830418262932239295612610045884644244285011551557765935780379565026806130721758672048541797157896401554276881090475899564605488362989140226580026134158039480357971019004151547655018391755772677897148793477372747525743898158705040701968215101218826088040084551332795162841280679678965570163917067779841529149397403158167896865448841319046368332179115059107813898261026271979696826411179918656038993895418928488851750122504754778999508544083983800725431468842988412616042682248823097788556495765424017114510393927980290997604904428832198976751320535115230545666467143795931915272680278210241540629795828828466355623580986725638200565215519951793551069127710538552661926903526081367717666435071213453983711357500975854405939558661737828297120544693182260401670308530911657973113259516101749193468250063285777004686987177255226525708428745733039859744230639751837209975339055095883623642814493247460522424051972825153787541962759327436278819283740253185668545040893929401040561666867664402868211607294830305236465560955351079987185041352121321534713770667681396211443891632403235741573773787908838267618458756361026435182951815392455211729022985278518025598478407179607904114472041476091765804302984501746867981277584971731733287305281134969591668387877072315968334322509070204019030503595891994666652037530271923764252552910347950343816357721698115464329245608951158732012675424975710520894362639501382962152214033621065422821876739580121286442788547491928976959315766891987305176388698461503354594898541849550251690616888419122873385522699976822609645007504500096116866129171093180282355042553653997166054753907348915189650027442328981181709248273610863801576007240601649547082331349361582435128299050405405333992577071321011503713898695076713447940748097845416328110406350804863393555238405735580863718763530261867971725608155328716436111474875107033512913923595452951407437943144900950809932872153235195999616750297532475931909938012968640379783553559071355708369947311923538531051736669154087312467233440702525006918026747725078958903448856673081487299464807786497709361969389290891718228134002845552513917355978456150353144603409441211512001738697261466786933733154341007587514908295822756919350542184106448264951943804240543255345965248373785310657979037977505031436474651422484768831323479762673689855474944277949916560108528257618964374464656819789319422077536824661110427671936481836360534108748971066866318805026555929568123959680449295166615409802610781691689418764353363449482900125929366840591370059526914934421861891742142561071896846626335874414976973921566392767687720145153302241853125308442727245771161505550519076276250016522166274796257424425420546785767478190959486500575711016264847833741198041625940813327229905891486422127968042984725356237202887830051788539737909455265135144073130049869453403245984236934627060242579432563660640597549471239092372458126154582526667304702319359866523378856244229188278436440434628094888288712101968642736370461639297485616780079779959696843367730352483047478240669928277140069031660709951473154191919911453182543906294573298686613524886500574780251977607442660798300291573030523199052185718628543687577860915726925232573171665625274275808460620177046433101212443409281314659760221360416223031167750085960128475289259463348312408766740128170543067985261868949895004918275008304998926472034986965363326210919830621495095877228260815566702155693484634079776879525038204442326697479264829899016938511552124688935873289878336267819361764023681714606495185508780596635354698788205094762016350757090024201498400967867845405354130050482404996646978558002628931826518708714613909521454987992300431779500489569529280112698632533646737179519363094399609176354568799002814515169743717518330632232942199132137614506411391269837128970829395360832883050256072727563548374205497856659895469089938558918441085605111510354367477810778500572718180809661542709143010161515013086522842238721618109043183163796046431523184434669799904865336375319295967726080853457652274714047941973192220960296582500937408249714373040087376988068797038047223488825819819025644086847749767508999164153502160223967816357097637814023962825054332801828798160046910336602415904504637333597488119998663995617171089911809851197616486499233594328274275983382931099806461605360243604040848379619072542165869409486682092396143083817303621520642297839982533698027039931804024928814430649614747600087654305571672697259114631990688823893005380061568007730984416061355843701277573463708822073792921409548717956947854414951731561828176343929570234710460088230637509877521391223419548471196982303169544468045517922669260631327498272520906329003279972932906827204647650366969765227673645419031639887433042226322021325368176044169612053532174352764937901877252263626883107879345194133825996368795020985033021472307603375442346871647223795507794130304865403488955400210765171630884759704098331306109510294140865574071074640401937347718815339902047036749084359309086354777210564861918603858715882024476138160390378532660185842568914109194464566162667753712365992832481865739251429498555141512136758288423285957759412684479036912662015308418041737698963759002546999454131659341985624780714434977201991702665380714107259910648709897259362243300706760476097690456341576573395549588448948093604077155688747288451838106069038026528318275560395905381507241627615047252487759578650784894547389096573312763852962664517004459626327934637721151028545472312880039058405918498833810711366073657536918428084655898982349219315205257478363855266205400703561310260405145079325925798227406012199249391735122145336707913500607486561657301854049217477162051678486507913573336334257685988361252720250944019430674728667983441293018131344299088234006652915385763779110955708000600143579956351811596764725075668367726052352939773016348235753572874236648294604770429166438403558846422370760111774821079625901180265548868995181239470625954254584491340203400196442965370643088660925268811549596291166168612036195319253262662271108142149856132646467211954801142455133946382385908540917878668826947602781853283155445565265933912487885639504644196022475186011405239187543742526581685003052301877096152411653980646785444273124462179491306502631062903402737260479940181929954454297256377507172705659271779285537195547433852182309492703218343678206382655341157162788603990157495208065443409462446634653253581574814022471260618973060860559065082163068709634119751925774318683671722139063093061019303182326666420628155129647685313861018672921889347039342072245556791239578260248978371473556820782675452142687314252252601795889759116238720807580527221031327444754083319215135934526961397220564699247718289310588394769170851420631557192703636345039529604362885088555160008371973526383838996789184600327073682083234847108471706160879195227388252347506380811606090840124222431476103563328940609282430125462013806032608121942876847907192546246309055749298781661271916548229644317263587524548607563020667656942355342774617635549231817456159185668061686428714964129290560130053913469569829490891003991259088290348791943368696942620662946948514931472688923571615032405542263391673583102728579723061998175868700492227418629077079508809336215346303842967525604369606110193842723883107587771653594778681499030978765900869583480043137176832954871752604714113064847270887246697164585218774442100900090916189819413456305028950484575822161887397443918833085509908566008543102796375247476265353031558684515120283396640547496946343986288291957510384781539068343717740714095628337554413567955424664601335663617305811711646062717854078898495334329100315985673932305693426085376230981047171826940937686754301837015557540822371538037838383342702379535934403549452173960327095407712107332936507766465603712364707109272580867897181182493799540477008369348889220963814281561595610931815183701135104790176383595168144627670903450457460997444500166918675661035889313483800512736411157304599205955471122443903196476642761038164285918037488354360663299436899730090925177601162043761411616688128178292382311221745850238080733727204908880095181889576314103157447684338100457385008523652069340710078955916549813037292944462306371284357984809871964143085146878525033128989319500645722582281175483887671061073178169281242483613796475692482076321356427357261609825142445262515952514875273805633150964052552659776922077806644338105562443538136258941809788015677378951310313157361136026047890761945591820289365770116416881703644242694283057457471567494391573593353763114830246668754727566653059819746822346578699972291792416156043557665183382167059157867799311835820189855730344883681934418305987021880502259192818047775223884407167894780414701414651073580452021499197980812095692195622632313741870979731320870864552236740416185590793816745658234353037283309503729022429802768451559528656923189798000383061378732434546500582722712325031420712488100290697226311129067629080951145758060270806092801504406139446350643069742785469477459876821004441453438033759717384777232052065301037861326418823586036569054773343070911759152582503029410738914441818378779490613137536794654893375260322906277631983337976816641721083140551864133302224787118511817036598365960493964571491686005656771360533192423185262166760222073368844844409234470948568027905894191829969467724456269443308241243846160408284006424867072583661011433404214473683453638496544701067827313169538435919120440283949541956874453676459875488726170687163109591315801609722382049772577307454562979127906177531663252857205858766376754282917933549923678212008601904369428956102301731743150352204665675088491593025926618816581008701658499456495586855628208747248318351516339189292646558880593601275151838235485893426165223086697314511412035659916934103076974774451947043836739600076578628245472064617380804602903639144493859012422380173377038154675297645596518492676039300171943042511794045679862114630138402371099347243455794730048929825402680821621522346560274258486595687074510352794291633405915025075992398611224340312056999780516223878772230396359709132856830486160362127579561601328561866388146004722200580017580282279272167842720649966956840905752590774886105493806116954293569077377792821084159737469613143291808510446953973485067590503662391722108732333169909603363771705474725026941732982890400239372879549386540463828596742216318201530139629734398479588628632934746650690284066719018081265539973675916799759010867483920062877888531102781695087545740384607594616919584610655963327283485609570305572502494416337066573150237126843581984154103154401008430380631442183776750349813408169325201240813452285974626715177152223063741359255747513535160669108359443999692315898156732033027129284241219651936303734407981204656795322986357374589031654007016472204989445629050395873788912680565516464274460174738175296313458739390484560414203426465560422112239134631023161290836446988901247285192778589195228773637440432659264672239982186452797664826673070168802722052338600372842903155828454593854349099449420750911108532138744823216151007808922516285123275724355101999038195993350032641446053470357293073912578481757987468353429629749652545426864234949270336399427519354240001973125098882419600095766257217621860474573769577649582201796258392376391717855799468922496750179251915218219624653575570564228220399546682648329822996167217080156801080799777126517156274295763666959661983507435667132218383358509536665806605597148376773866922551603463644386269977295750658468929599809168949981898588529537874489519527097766262684177088590284321676352132630838812766335363319004134332844347630067982023716933653652880580156390360562722752187272454764258840995216482554453662083811789117725225682611478014242896970967121967502094421226279437073328703410646312100557376727450271638975234111426287828736758358819056742163061523416789476056879277154789714326222041069587947186435439940738639948986836168919377836648327137363654676901173760246643082285362494712605173293777247276797635865806019396287718060679122426813922872134061694882029506831654589707623668302556167559477498715183426989208952182644710514911419441192277010977616645850068963849426165593473112961064282379048216056210094265076173838082479030510998790719611852832556787472942907151041468948104916751035295897242381802288151276582257190705537652455285511598636421244284176256230139538669970308943645907600684938040875210854159851278070333207779865635907968462191534944587677170063778573171211036517486371634098385626541555573292664616402279791195975248525300376741774056125700303625811704838385391207273191845064713669122576415213769896260940351804147432053600369234179035440735703058314741623452840188940808983125191307741823338981880316339159565954543405777784331681162551898060409183018907512170192983622897099598983405484962284289398469847938668614293324543983592637036699355184231661615244505980576745765335552338715678211466689996845227042954589710922163652573965950289645637766038988037941517917867910675199009966139206238732318786758420544279396366759104126821843375015743069045967947046685602358283919759975285865384338189120042853787549302768972168199113340697282255535300044743958830079799736518459131437946494086272149669719100359399974735262764126125995350902609540048669398955899487421379590802893196914845826873123710180229775301190684280440780938156598081694611679374425663244656799606363751546304833112722231812338371779800439731087402647536582575657351059978314264831879619843765495877803685261751835391844920488198629786329743136948511780579298636452193232481339393090754566368038513630619718033957979522539508697432546502659123585049283028832934489284591373621624852528877442891851104093746333590660233239711922814450735588373324057814862662207486215513375036775585494138678352928273109003823116855374520901095101174796663003330352534143230024288248051396631446632656081582045216883922312025671065388459503224002320453633895521539919011035217362720909565500846486605368975498478995875596103167696587161281951919668893326641203784750417081752273735270989343717167642329956935697166213782736138899530515711822960896394055380431939398453970864418654291655853168697537052760701061488025700785387150835779480952313152747735711713643356413242974208137266896149109564214803567792270566625834289773407718710649866150447478726164249976671481383053947984958938064202886667951943482750168192023591633247099185942520392818083953020434979919361853380201407072481627304313418985942503858404365993281651941497377286729589582881907490040331593436076189609669494800067194371424058105327517721952474344983414191979918179909864631583246021516575531754156198940698289315745851842783390581029411600498699307751428513021286202539508732388779357409781288187000829944831476678183644656510024467827445695591845768068704978044824105799710771577579093525803824227377612436908709875189149049904225568041463131309240101049368241449253427992201346380538342369643767428862595140146178201810734100565466708236854312816339049676558789901487477972479202502227218169405159042170892104287552188658308608452708423928652597536146290037780167001654671681605343292907573031466562485809639550080023347676187068086526878722783177420214068980703410506200235273632267291964034093571225623659496432076928058165514428643204955256838543079254299909353199329432966018220787933122323225928276556048763399988478426451731890365879756498207607478270258861409976050788036706732268192473513646356758611212953074644777149423343867876705824452296605797007134458987594126654609414211447540007211790607458330686866231309155780005966522736183536340439991445294960728379007338249976020630448806064574892740547730693971337007962746135534442514745423654662752252624869916077111131569725392943756732215758704952417232428206555322808868670153681482911738542735797154157943689491063759749151524510096986573825654899585216747260540468342338610760823605782941948009334370046866568258579827323875158302566720152604684361412652956519894291184887986819088277339147282063794512260294515707367105637720023427811802621502691790400488001808901847311751199425460594416773315777951735444490965752131026306836047140331442314298077895617051256930051804287472368435536402764392777908638966566390166776625678575354239947427919442544664643315554138265543388487778859972063679660692327601733858843763144148113561693030468420017434061395220072403658812798249143261731617813894970955038369479594617979829257740992171922783223006387384996138434398468502234780438733784470928703890536420557474836284616809363650973790900204118525835525201575239280826462555785658190226958376345342663420946214426672453987171047721482128157607275305173330963455909323664528978019175132987747952929099598069790148515839540444283988381797511245355548426126784217797728268989735007954505834273726937288386902125284843370917479603207479554080911491866208687184899550445210616155437083299502854903659617362726552868081324793106686855857401668022408227992433394360936223390321499357262507480617409173636062365464458476384647869520547719533384203403990244761056010612777546471464177412625548519830144627405538601855708359981544891286863480720710061787059669365218674805943569985859699554089329219507269337550235821561424994538234781138316591662683103065194730233419384164076823699357668723462219641322516076261161976034708844046473083172682611277723613381938490606534404043904909864126903479263503943531836741051762565704797064478004684323069430241749029731181951132935746854550484711078742905499870600373983113761544808189067620753424526993443755719446665453524088287267537759197074526286322840219629557247932987132852479994638938924943286917770190128914220188747760484939855471168524810559991574441551507431214406120333762869533792439547155394213121021954430556748370425907553004950664994802614794524739012802842646689229455664958621308118913500279654910344806150170407268010067948926855360944990373928383520627992820181576427054962997401900837493444950600754365525758905546552402103412862124809003162941975876195941956592556732874237856112669741771367104424821916671499611728903944393665340294226514575682907490402153401026923964977275904729573320027982816062130523130658731513076913832317193626664465502290735017347656293033318520949298475227462534564256702254695786484819977513326393221579478212493307051107367474918016345667888810782101151826314878755138027101379868751299375133303843885631415175908928986956197561123025310875057188962535763225834275763348421016668109884514141469311719314272028007223449941999003964948245457520704922091620614222912795322688239046498239081592961111003756999529251250673688233852648213896986384052437049402152187547825163347082430303521036927849762517317825860862215614519165573478940019558704784741658847364803865995119651409542615026615147651220820245816010801218275982577477652393859159165067449846149161165153821266726927461290533753163055654440793427876550267301214578324885948736899073512166118397877342715872870912311383472485146035661382188014840560716074652441118841800734067898587159273982452147328317214621907330492060817440914125388918087968538960627860118193099489240811702350413554126823863744341209267781729790694714759018264824761112414556423937732224538665992861551475342773370683344173073150805440138894084087253197595538897613986400165639906934600670780501058567196636796167140097031535132386972899001749862948883362389858632127176571330142071330179992326381982094042993377790345261665892577931395405145369730429462079488033141099249907113241694504241391265397274078984953073730364134893688060340009640631540701820289244667315059736321311926231179142794944897281477264038321021720718017561601025111179022163703476297572233435788863537030535008357679180120653016668316780269873860755423748298548246360981608957670421903145684942967286646362305101773132268579232832164818921732941553151386988781837232271364011755881332524294135348699384658137175857614330952147617551708342432434174779579226338663454959438736807839569911987059388085500837507984051126658973018149321061950769007587519836861526164087252594820126991923916722273718430385263107266000047367872474915828601694439920041571102706081507270147619679971490141639274282889578424398001497985658130305740620028554097382687819891158955487586486645709231721825870342960508203415938806006561845735081804032347750084214100574577342802985404049555529215986404933246481040773076611691605586804857302606467764258503301836174306413323887707999698641372275526317649662882467901094531117120243890323410259937511584651917675138077575448307953064925086002835629697045016137935696266759775923436166369375035368699454550392874449940328328128905560530091416446608691247256021455381248285307613556149618444364923014290938289373215312818797541139219415606631622784836152140668972661027123715779503062132916001988806369127647416567067485490795342762338253943990022498972883660263920518704790601584084302914787302246651371144395418253441269003331181914268070735159284180415100555199146564934872796969351992963117195821262627236458009708099166752820365818699111948365866102758375863322993225541477479210421324166848264953111826527351008031659958888814809945737293785681411438021523876706455063233067233939551964260397443829874822322662036352861302543796600943104500158604854027036789711934695579989189112302233381602302236277726084846296189550730850698061500281436425336666311433321645213882557346329366870956708432252564333895997812402164189946978348320376011613913855499933990786652305860332060641949298931012423081105800169745975038516887112037747631577311831360002742502722451570906304496369230938382329175076469684003556425503797106891999812319602533733677437970687713814747552190142928586781724044248049323750330957002929126630316970587409214456472022710796484778657310660832173093768033821742156446602190335203981531618935787083561603302255162155107179460621892674335641960083663483835896703409115513087820138723494714321400450513941428998350576038799343355677628023346565854351219361896876831439866735726040869511136649881229957801618882834124004126142251475184552502502640896823664946401177803776799157180146386554733265278569418005501363433953502870836220605121839418516239153709790768084909674194289061134979961034672077354959593868862427986411437928435620575955500144308051267664432183688321434583708549082240014585748228606859593502657405750939203135881722442164955416889785558265198046245527898343289578416968890756237467281044803018524217706136533236073856228166664597654076844715963930782091017090763377917711485205493367936868430832404126789220929930411890501756484917499452393770674524578019171841679541825554377930299249277892416277257788147974770446005423669346157135208417428211847353652367573702352791459837645712257646122605628127852169580892808988394594406165340521932514843306105322700231133680378433377389724881307874325614952744243584753011150345103737688223837573804282007358586938044331529253129961025096113761670187568525921208929131354473196308440066835155160913925692912175784379179004808848023029304392630921342768601226558630456913133560978156776098711809238440656353136182676923761613389237802972720736243967239854144480757286813436768000573823963610796223140429490728058551444771338682314499547929338131259971996894072233847404542592316639781608209399269744676323921370773991899853301483814622364299493902073285072098040905300059160091641710175605409814301906444379905831277826625762288108104414704097708248077905168225857235732665234414956169007985520848841886027352780861218049418060017941147110410688703738674378147161236141950474056521041002268987858525470689031657094677131822113205505046579701869337769278257145248837213394613987859786320048011792814546859096532616616068403160077901584946840224344163938313618742275417712170336151163782359059685168880561304838542087505126933144171705880517278127917564053282929427357971823360842784676292324980318169828654166132873909074116734612367109059236155113860447246378721244612580406931724769152219217409096880209008801535633471775664392125733993165330324425899852598966724744126503608416484160724482125980550754851232313331300621490042708542735985913041306918279258584509440150719217604794274047740253314305451367710311947544521321732225875550489799267468541529538871443696399406391099267018219539890685186755868574434469213792094590683677929528246795437302263472495359466300235998990248299853826140395410812427393530207575128774273992824866921285637240069184859771126480352376025469714309316636539718514623865421671429236191647402172547787238964043145364190541101514371773797752463632741619269990461595895793940622986041489302535678633503526382069821487003578061101552210224486633247184367035502326672749787730470216165019711937442505629639916559369593557640005236360445141148916155147776301876302136068825296274460238077523189646894043033182148655637014692476427395401909403584437251915352134557610698046469739424511797999048754951422010043090235713636892619493763602673645872492900162675597083797995647487354531686531900176427222751039446099641439322672532108666047912598938351926694497553568096931962642014042788365702610390456105151611792018698900673027082384103280213487456720062839744828713298223957579105420819286308176631987048287388639069922461848323992902685392499812367091421613488781501234093387999776097433615750910992585468475923085725368613605356762146929424264323906626708602846163376051573599050869800314239735368928435294958099434465414316189806451480849292695749412903363373410480943579407321266012450796613789442208485840536446021616517885568969302685188950832476793300404851688934411125834396590422211152736276278672366665845757559585409486248261694480201791748223085835007862255216359325125768382924978090431102048708975715033330963651576804501966025215527080352103848176167004443740572131294252820989545456276344353575741673638980108310579931697917916718271145837435222026387771805250290791645414791173616253155840768495583288190293564201219633684854080865928095131505012602919562576032932512847250469881908146475324342363863860247943921015193235101390117789997483527186469346024554247028375300033725403910085997650987642832802908445662021678362267272292737780213652404028817217012490974899454430826861772239385250883760749742195942655217301733355851389407457348144161511380845358039740277795072051893487170722955427683655826706766313911972211811528466502223383490906676554168336907959409404576472940901354356409277969379842065738891481990225399022315913388145851487225126560927576795873759207013915029216513720851137197522734365458411622066281660256333632074449918511469174455062297146086578736313585389023662557285424516018080487167823688885575325066254262367702604215835160174851981885460860036597606743233346410471991027562358645341748631726556391320606407754779439671383653877377610828300019937359760370467245737880967939894493795829602910746901609451288456550071458091887879542641820145369659962842686882363495879277007025298960996798975941955735253914237782443302746708282008722602053415292735847582937522487377937899136764642153727843553986244015856488692101644781661602962113570056638347990334049623875941092886778920270077504951511405782565295015024484968204744379710872943108541684540513016310902267112951959140520827546866418137305837933236150599142045255880213558474751516267815309465541240524091663857551298894834797423322854504140527354235070335984964593699534959698554244978249586929179182415068053002553370412778703476446244329205906832901886692400222391918714603175399666877477960121790688623311002908668305431787009355066944389131913333586368037447530664502418437136030852288582121720231274167009740351431532131803978033680228154223490183737494117973254478594157962104378787072154814091725163615415163381388912588517924237727229603497305533840942889918919161186249580560073570527227874940321250645426206304469470804277945973817146810395192821550688079136701210109944220737024613687196031491162370967939354636396448139025711768057799751751298979667073292674886430097398814873780767363792886767781170520534367705731566895899181530825761606591843760505051704242093231358724816618683821026679970982966436224723644898648976857100173643547336955619347638598187756855912376232580849341570570863450733443976604780386678461711520325115528237161469200634713570383377229877321365028868868859434051205798386937002783312365427450532283462669786446920780944052138528653384627970748017872477988461146015077617116261800781557915472305214759943058006652042710117125674185860274188801377931279938153727692612114066810156521441903567333926116697140453812010040811760123270513163743154487571768761575554916236601762880220601068655524141619314312671535587154866747899398685510873576261006923021359580838145290642217792987748784161516349497309700794368305080955621264592795333690631936594413261117944256602433064619312002953123619348034504503004315096798588111896950537335671086336886944665564112662287921812114121425167348136472449021275252555647623248505638391391630760976364990288930588053406631352470996993362568102360392264043588787550723319888417590521211390376609272658409023873553418516426444865247805763826160023858280693148922231457758783791564902227590699346481624734399733206013058796068136378152964615963260698744961105368384203105364183675373594176373955988088591188920114871545460924735613515979992999722298041707112256996310945945097765566409972722824015293663094891067963296735505830412258608050740410916678539569261234499102819759563955711753011823480304181029089719655278245770283085321733741593938595853203645590564229716679900322284081259569032886928291260139267587858284765599075828016611120063145411315144108875767081854894287737618991537664505164279985451077400771946398046265077776614053524831090497899859510873112620613018757108643735744708366215377470972660188656210681516328000908086198554303597948479869789466434027029290899143432223920333487108261968698934611177160561910681226015874410833093070377506876977485840324132474643763087889666151972556180371472590029550718424245405129246729039791532535999005557334600111693557020225722442772950263840538309433999383388018839553821540371447394465152512354603526742382254148328248990134023054550811390236768038649723899924257800315803725555410178461863478690646045865826036072306952576113184134225274786464852363324759102670562466350802553058142201552282050989197818420425028259521880098846231828512448393059455162005455907776121981297954040150653985341579053629101777939776957892084510979265382905626736402636703151957650493344879513766262192237185642999150828898080904189181015450813145034385734032579549707819385285699926238835221520814478940626889936085239827537174490903769904145555260249190126341431327373827075950390882531223536876389814182564965563294518709637484074360669912550026080424160562533591856230955376566866124027875883101021495284600804805028045254063691285010599912421270508133194975917146762267305044225075915290251742774636494555052325186322411388406191257012917881384181566918237215400893603475101448554254698937834239606460813666829750019379115061709452680984785152862123171377897417492087541064556959508967969794980679770961683057941674310519254486327358885118436597143583348756027405400165571178309126113117314169066606067613797690123141099672013123730329707678988740099317309687380126740538923612230370779727025191340850390101739924877352408881040807749924412635346413181858792480760553268122881584307471326768283097203149049868884456187976015468233715478415429742230166504759393312132256510189175368566338139736836336126010908419590215582111816677413843969205870515074254852744810154541079359513596653630049188769523677579147319184225806802539818418929888943038224766186405856591859943091324575886587044653095332668532261321209825839180538360814144791320319699276037194760191286674308615217243049852806380129834255379486287824758850820609389214668693729881191560115633701248675404205911464930888219050248857645752083363921499441937170268576222251074166230901665867067714568862793343153513505688216165112807318529333124070912343832502302341169501745502360505475824093175657701604884577017762183184615567978427541088499501610912720817913532406784267161792013428902861583277304794830971705537485109380418091491750245433432217445924133037928381694330975012918544596923388733288616144238100112755828623259628572648121538348900698511503485369544461542161283241700533583180520082915722904696365553178152398468725451306350506984981006205514844020769539324155096762680887603572463913955278222246439122592651921288446961107463586148252820017348957533954255019475442643148903233373926763409115527189768429887783617346613535388507656327107814312435018965109238453660236940276060642119384227665755210663671879603217527184404651560427289869560206997012906367847161654793068868305846508082886614111979138822898112498261434559408961813509226857611474609406147937240008842153535862052780125014270055274468359151840373309373580494342483940467505708347927948338133276237937844629209323999417593374917899786484958148818865149169302451512835579818112344900827168644548306546633975256079615935830821400021951611342337058359111545217293721664061708131602078213341260356852013161345136871600980378712556766143923146458085652084039744217352744813741215277475202259244561520365608268890193913957991844109971588312780020898275935898106482117936157951837937026741451400902833064466209280549839169261068975151083963132117128513257434964510681479694782619701483204392206140109523453209269311762298139422044308117317394338867965739135764377642819353621467837436136161591167926578700137748127848510041447845416464568496606699139509524527949914769441031612575776863713634644477006787131066832417871556281779122339077841275184193161188155887229676749605752053192594847679397486414128879475647133049543555044790277128690095643357913405127375570391806822344718167939329121448449553897728696601037841520390662890781218240141299368590465146519209198605347788576842696538459445700169758422531241268031418456268722581132040056433413524302102739213788415250475704533878002467378571470021087314693254557923134757243640544448132093266582986850659125571745568328831440322798049274104403921761438405750750288608423536966715191668510428001748971774811216784160854454400190449242294333666338347684438072624307319019363571067447363413698467328522605570126450123348367412135721830146848071241856625742852208909104583727386227300781566668914250733456373259567253354316171586533339843321723688126003809020585719930855573100508771533737446465211874481748868710652311198691114058503492239156755462142467550498676710264926176510110766876596258810039163948397811986615585196216487695936398904500383258041054420595482859955239065758108017936807080830518996468540836412752905182813744878769639548306385089756146421874889271294890398025623046812175145502330254086076115859321603465240763923593699949180470780496764486889980902123735780457040380820770357387588525976042434608851075199334470112741787878845674656640471901619633546770714090590826954225196409446319547658653032104723804625249971910690110456227579220926904132753699634145768795242244563973018311291451151322757841320376225862458224784696669785947914981610522628786944136373683125108310682898766123782697506343047263278453719024447970975017396831214493357290791648779915089163278018852504558488782722376705263811803792477835540018117452957747339714012352011459901984753358434861297092928529424139865507522507808919352104173963493428604871342370429572757862549365917805401652536330410692033704691093097588782938291296447890613200063096560747882082122140978472301680600835812336957051454650181292694364578357815608503303392466039553797630836137289498678842851139853615593352782103740733076818433040893624460576706096188294529171362940967592507631348636606011346115980434147450705511490716640635688739020690279453438236930531133440901381392849163507484449076828386687476663619303412376248380175840467851210698290605196112357188811150723607303158506622574566366740720668999061320627793994112805759798332878792144188725498543014546662945079670707688135022230580562225942983096887732856788971494623888272184647618153045844390967248232348259587963698908456664795754200195991919240707615823002328977439748112690476546256873684352229063217889227643289360535947903046811114130586348244566489159211382258867880972564351646404364328416076247766114349880319792230537889671148058968061594279189647401954989466232962162567264739015818692956765601444248501821713300527995551312539849919933907083138030214072556753022600033565715934283182650908979350869698950542635843046765145668997627989606295925119763672907762567862769469947280606094290314917493590511523235698715397127866718077578671910380368991445381484562682604003456798248689847811138328054940490519768008320299631757043011485087384048591850157264392187414592464617404735275250506783992273121600117160338604710710015235631159734711153198198710616109850375758965576728904060387168114313084172893710817412764581206119054145955378853200366615264923610030157044627231777788649806700723598889528747481372190175074700005571108178930354895017924552067329003818814068686247959272205591627902292600592107710510448103392878991286820705448979977319695574374529708195463942431669050083984398993036790655541596099324867822475424361758944371791403787168166189093900243862038610001362193667280872414291108080291896093127526202667881902085595708111853836166128848729527875143202956393295910508349687029060692838441522579419764824996318479414814660898281725690484184326061946254276693688953540732363428302189694947766126078346328490315128061501009539164530614554234923393806214007779256337619373052025699319099789404390847443596972052065999017828537676265683558625452697455260991024576619614037537859594506363227095122489241931813728141668427013096050734578659047904243852086508154491350136491698639048125666610843702294730266721499164849610746803261583352580352858275799038584091667618877199539888680431991650866887781701439663176815592262016991396613153738021294160006906947533431677802632207226265881842757216055461439677336258462997385077307751473833315101468395296411397329672457933540390136107395245686243008096720460995545708974893048753897955544443791303790422346037768729236001386569593952300768091377768847789746299699489949016141866131552200856673695770822720338936659590666350594330040363762591189195691561626122704788696510356062748423100605472091437069471661080277379848576543481249822444235828329813543645124092220896643987201997945619030397327254617823136363375927622656301565813545578319730419339269008282952718252138855126583037630477490625995514925943105307478901043009876580816508144862607975129633326675259272351611791836777128931053144471668835182920514343609292493191180249366051791485330421043899773019267686085347768149502299280938065840007311767895491286098112311307002535600347898600653805084532572431553654422067661352337408211307834360326940015926958459588297845649462271300855594293344520727007718206398887404742186697709349647758173683580193168322111365547392288184271373843690526638607662451284299368435082612881367358536293873792369928837047900484722240370919885912556341130849457067599032002751632513926694249485692320904596897775676762684224768120033279577059394613185252356456291805905295974791266162882381429824622654141067246487216174351317397697122228010100668178786776119825961537643641828573481088089988571570279722274734750248439022607880448075724807701621064670166965100202654371260046641935546165838945950143502160890185703558173661823437491622669077311800121188299737319891006060966841193266075165452741829459541189277264192546108246351931647783837078295218389645376236304858042774417907169146356546201215125418664885396161542055152375000426794253417764590821513675258479774465114750438460596325820468809667795709044645884673847481638045635188183210386594798204376334738389017759714236223057776395541011294523488098341476645559342209402059733452337956309441446698222457026367119493286653989491344225517746402732596722993581333110831711807234044326813737231209669052411856734897392234152750707954137453460386506786693396236535556479102508529284294227710593056660625152290924148057080971159783458351173168204129645967070633303569271821496292272073250126955216172649821895790908865085382490848904421755530946832055636316431893917626269931034289485184392539670922412565933079102365485294162132200251193795272480340133135247014182195618419055761030190199521647459734401211601239235679307823190770288415814605647291481745105388060109787505925537152356112290181284710137917215124667428500061818271276125025241876177485994084521492727902567005925854431027704636911098800554312457229683836980470864041706010966962231877065395275783874454229129966623016408054769705821417128636329650130416501278156397799631957412627634011130135082721772287129164002237230234809031485343677016544959380750634285293053131127965945266651960426350406454862543383772209428482543536823186182982713182489884498260285705690699045790998144649193654563259496570044689011049923939218088155626191834404362264965506449848521612498442375928443642612004256628602157801140467879662339228190804577624109076487087406157070486658398144845855803277997327929143195789110373530019873110486895656281917362036703039179710646309906285483702836118486672219457621775034511770110458001291255925462680537427727378863726783016568351092332280649908459179620305691566806180826586923920561895421631986004793961133953226395999749526798801074576466538377400437463695133685671362553184054638475191646737948743270916620098057717103475575333102702706317395612448413745782734376330101853438497450236265733191742446567787499665000938706441886733491099877926005340862442833450486907338279348425305698737469497333364267191968992849534561045719338665222471536681145666596959735075972188416698767321649331898967182978657974612216573922404856900225324160367805329990925438960169901664189038843548375648056012628830409421321300206164540821986138099462721214327234457806819925823202851398237118926541234460723597174777907172041523181575194793527456442984630888846385381068621715274531612303165705848974316209831401326306699896632888532682145204083110738032052784669279984003137878996525635126885368435559620598057278951754498694219326972133205286374577983487319388899574634252048213337552584571056619586932031563299451502519194559691231437579991138301656117185508816658756751184338145761060365142858427872190232598107834593970738225147111878311540875777560020664124562293239116606733386480367086953749244898068000217666674827426925968686433731916548717750106343608307376281613984107392410037196754833838054369880310983922140260514297591221159148505938770679068701351029862207502287721123345624421024715163941251258954337788492834236361124473822814504596821452253550035968325337489186278678359443979041598043992124889848660795045011701169092519383155609441705397900600291315024253848282782826223304151370929502192196508374714697845805550615914539506437316401173317807741497557116733034632008408954066541694665746735785483133770133628948904397670025863002540635264006601631712883920305576358989492412827022489373848906764385339931878608019223108328847459816417701264089078551777830131616162049792779670521847212730327970738223860581986744668610994383049960437407323195784473254857416239738852016202384784256163512597161783106850156299135559874758848151014815490937380933394074455700842090155903853444962128368313687375166780513082594599771257467939781491953642874321122421579851584491669362551569370916855252644720786527971466476760328471332985501945689772758983450586004316822658631176606237201721007922216410188299330808409384014213759697185976897042759041500946595252763487628135867117352364964121058854934496645898651826545634382851159137631569519895230262881794959971545221250667461174394884433312659432286710965281109501693028351496524082850120190831078678067061851145740970787563117610746428835593915985421673115153096948758378955979586132649569817205284291038172721213138681565524428109871168862743968021885581515367531218374119972919471325465199144188500672036481975944167950887487934416759598361960010994838744709079104099785974656112459851972157558134628546189728615020774374529539536929655449012953097288963767713353842429715394179547179095580120134210175150931491664699052366350233024087218654727629639065723341455005903913890253699317155917179823065162679744711857951506573868504088229934804445549850597823297898617029498418376255258757455303112991914341109413088238114443068843062655305601658801408561023324210300218460588586954418502977463085858496130037238190325162225570729975710727306066072916922978033647048840958711228045188511908718588299514331534128549297173849768523136276076868494780364948299904475715771141080958058141208956059471668626290036145602625334863284986816039463372436667112964460292915746181117789169695839947080954788863503281129626899231110099889317815313946681882028368363373822281414974006917942192888817139116283910295684918233358930813360131488748366464224381776081007739183393749346933644748150564933649323157235306109385796839902153381449126925350768211098738352197507736653475499431740580563099143218212547336281359488317681489194306530426029773885492974570569448783077945878865062970895499843760181694031056909587141386804846359853684034105948341788438963179956468815791937174656705047441528027712541569401365862097760735632832966564135817028088013546326104892768731829917950379944446328158595181380144716817284996793061814177131912099236282922612543236071226270324572637946863533391758737446552006008819975294017572421299723542069630427857950608911113416534893431149175314953530067419744979017235181671568754163484949491289001739377451431928382431183263265079530371177806185851153508809998200482761808307209649636476943066172549186143700971387567940218696710148540307471561091358933165600167252126542502898612259306484105898847129649230941215144563947889999327145875969555737090855150648002321476443037232466147111552578583071024936898814562568786834745518893385181791667579054210421036349316257870476543126790661216644142285017446278477132740595579600648343288827864837043456066966456899746910373987712891593313271266247505582258634928427718355831641593667712218537642376222104779338956378722902509543014182257180331300148113377736941508488867501893156994849838936052666818012783912005801431596441910546663236810148207799356523056490420711364192200177189107935243234322761787712568251126481332974354926568682748715986654943041648468220593921673359485057849622807932422649812705271398407720995707236227009245067665680069149966555737866411877079767754867028786431817941521796178310655030287157272282250812017060713380339641841211253856248920130010782462165136989511064611133562443838185366273563783436921279354709230119655914915800561707258518503167289370411936374780625824298250726464801821523430268081486978164824349353456855843696378384153838051184406043696871666416514036129729992912630842812149152469877429332305214999981829046119471676727503742221367186614654042534463141660649871499001000660041544868437352208483059495953182872280520828676300361091734508632133033647289584176588755345227938480297724485711815574893561311524926772006362198369980664159549388683836411891430443767715498026544959061738265591178545999378510861446014967645550103653971251138583505085112442517772923814396233043724036032603181442991365750246012787514117944901305803452199992701148071712847770301254994886841867572975189214295652512486943983729047410363121899124217339550688778643130750024823361832738729697376598820053895902935486054979802320400472236873557411858132734337978931582039412878989728973298812553514507641535360519462112217000676321611195841029252568536561813138784086477147099724553013170761712163186600291464501378587854802096244703771373587720086738054108140042311418525803293267396324596914044834665722042880679280616029884043400536534009706581694636096660911110968789751801325224478246957913251892122653056085866541115373584912790254654369020869419871125588453729063224423222287139122012248769976837147645598526739225904997885514250047585260297929306159913444898341973583316070107516452301310796620382579278533125161760789984630103493496981494261055367836366022561213767081421091373531780682420175737470287189310207606953355721704357535177461573524838432101571399813798596607129664438314791296359275429627129436142685922138993054980645399144588692472767598544271527788443836760149912897358259961869729756588978741082189422337344547375227693199222635973520722998387368484349176841191020246627479579564349615012657433845758638834735832242535328142047826934473129971189346354502994681747128179298167439644524956655532311649920677163664580318205849626132234652606175413532444702007661807418914040158148560001030119994109595492321434406067634769713089513389171050503856336503545166431774489640061738861761193622676890576955693918707703942304940038440622614449572516631017080642923345170422426679607075404028551182398361531383751432493056398381877995594942545196756559181968690885283434886050828529642437578712929439366177362830136595872723080969468398938676366226456791132977469812675226595621009318322081754694778878755356188335083870248295346078597023609865656376722755704495258739871812593441903785275571333409842450127258596692434317689018966145404453679047136294238156127656824247864736176671770647002431119711090007474065945650315375044177982192306323700872039212085499569681061379189029961178936752146022386905665481382858280449537530160921422195940638787074787991194920898374091788534417523064715030278397979864517336625329511775105559014160459873338186887977858817291976604516353353556047648420520888811722831990044504284486852338334530105533929637308039738230604714104525470094899407601215247602819963846343554852932377161410869591950786873276075400085220065031871239272857835807010762542769655355964789450166013816295177908531139811092831583216931563867459747449584385282701658246192092219529134323496779345585613140207765996142546463288677356891785576835169608392864188830094883324700447958316931533832382377876344426323456301679513671047510469669001217777128065522453689371871451567394733440447280450959433090683667110655953338602938000999949010642769859623260401863733572846679531229683156358145420890540651226419162015504500430562136991850941034609601030543816694795964585804425194905110733387679946734471718615647723811737035654917628707589456035519195603962301157866323750234725054461073979402475184415558178087962822231972692984516683306919505079993357259165675557294585962182052650473353712351623662770479333289322136141858785972771685682725303734836891911847197133753088446777943274857148827821608844765700041403499921376794209627560883081509438030705666022764678117533361028187800710219794428777313146387857817205661409023041499923248268982477222109852189758140879763486146763606368674611966620347304608917277240045953051376938375381543486981101990651706961774052218247422657652138152740612699012706880875386408669901461740890540981877671880076124151967064152117653084325544261017536348281196837493395825742541244634247233586360777980960199745187758845459645895956779558869098404768259253477849930457883128541747079059795909431627722327844578918694214929451540174214623240300841907975296782445969183509474202123617940309048634960534054931299919496087957952586977170236680033862505764938088740994009589948109397983231108838769236490221499111120870639202892490698435333152727991330986335454324971441378059132240814960156485679843966464780280409057580889190254236606774500413415794312112501275232250148067232979652230488493751166084976116412777395311302041566848265531411348993243747890268935173904043294851610659785832253168204202834993641595980197343889883020994152152288611175126686173051956249367180053845637855129171848417841594797435580617856680758491080185805695567990185198397660693358224779136504562705766735170961550493338390452612404395517449136885115987454340932040102218982707539212403241042424451570052968378815749468441508011138612561164102477190903050040240662278945607061512108266146098662040425010583978098192019726759010749924884966139441184159734610382401178556739080566483321039073867083298691078093495828888707110651559651222542929154212923108071159723275797510859911398076844732639426419452063138217862260999160086752446265457028969067192282283045169111363652774517975842147102219099906257373383472726498678244401048998507631630668050267115944636293525120269424810854530602810627264236538250773340575475701704367039596467715959261029438313074897245505729085688496091346323165819468660587092144653716755655531962091865952628448253731353698162517351930115341581171353292035873164168839107994000677266031617527582917398395852606454113318985505747847121053505795649095931672167565624818782002769963734155880000867852567422461511406015760115910256449002264980039498403358091309140197877843650167960167465370287466062584346329708303725980494653589318912163976013193079476972058034710553111117215859219066231028099212084069283091906017370764654655683413207556315315006453462321007133584907633048328153458698497332599801187479664273140279381289961720524540674695271948079930396730194274036466594154400092799908634806622334906695224044652158992864203435098858422692019340575496840904812955522654754650713532842543496616084954788090727649930252702815067862810825243222979985391759845188868387004477101866772159439708514664612871148749531862180941719676843144666435175837688436786081446319641912566574047718699160915550910878919431253671945651261878486910876729910565595155159739659034383628124629118117760949411880105946336671039049777312004243578115790429823045072038322781246413671297959415082918378213212876890545963586369344879749784841123274921331663162812456388238288715648447883142417650147980187858215768793063001153788998014623690135803753306246148576074932567807682651045738059018831237617271889933790487113395588485234240255002352200613574914318259142479829367775490496399350755839668967578364316618369307625603528602940662803255416535431518013714821941772672244005268401996533334184004345525296592918502940131600651124395297874364222806977720437363717873457948420238745151249157913139411148608416429347958793681868609689684640858334131017858142710955416293375915178392341303110543328703526599993904966822112768158316511246866451167351378214345336650598328347443536290312393672084593164394941881138607974670134709640378534907149089842317891739783650654751982883367395714360000003439863363212091718954899055748693397700245632475954504411422582410783866837655467400137324322809113692670682805397549111166171102397437749479335174036135005397581475520834285772800986189401984375446435081498218360112577632447389452051636938585136484259964518361856989088721789764694721246807900330925083496645841656554261294195108847197209106605105540933731954888406444080280579549008076040034154662137669606444293774985897353625591959618552448187940317374508256072895120945456562159540405425814886929842786582357673195799285293120866275922366115137445767916063621675267440451221051052090834707443986137829082352772895849625656881972792768694795806100573787084121444815034797422312103295359297822377134077549545477791813823542607184617108389097825964406170543546968567030745411634244134486308676327949177682923093183221341455482591367202823284396549001805653203960795517074496039006696990334199278212696767771835209083959545341866777944872740383733381985235884202840150981579594685874537989503257362809837592216229258598599123843993575573285028613155970362934249814178056461615863415338635077223269996508860870999964899373049307170967888740149746147542880387421250689212155876692242387434701120990859082164073576380817386959755176083877600277517253037133445654852635661720197563001580049790223419586738061442401502436288957503206533690825756785507020555105572381878574650371086308158185862815883054564662297694803970618265491385181326737485227188267917919091354407852685476254126683398240534022469989966652573155637645862251862823092085424412805997628505488913098331761884983352975136073772030571342739638126588567405013841074788943393996603591853934198416322617654857376671943132840050626295140357877264680649549355746326408186979718630218760025813995719923601345374229758918285167511358171472625828596940798518571870075823122317068134867930884899275181661399609753105295773584618525865211893339375771859916335112163441037910451845019023066893064178977808158101360449495409665363660370075881004450265734935127707426742578608784898185628869980851665713320835842613381142623855420315774246613108873106318111989880289722849790551075148403702290580483052731884959994156606537314021296702220821915862905952604040620011815269664910068587592655660567562963361434230232810747488395040380984981860056164646099819257616235478710913832967563761506732550860683433720438748186791668975746563456020002562889601191100980453350423842063824039434163502977688802779835087481178298349417211674919425601608685332435385951152061809031241698182079314615062073826097180458265687043623935757495737332781578904386011378078508110273049446611821957450170106059384336519458628360682108585130499820420578458577175933849015564447305834515291412561679970569657426139901681932056241927977282026714297258700193234337873153939403115411184101414292741703537542003698760608765500109345299007034032401334806388514095769557147190364152027721127070187421548123931953220997506553022646844227700020589045922742423904937051507367764629844971682121994198274794049092601715727439368569721862936007387077810797440975556627807371228030350048829843919546433753355787895064018998685060281902452191177018634505171087023903398550540704454189088472042376499749035038518949505897971286631644699407490959473411581934618336692169573605081585080837952036335619947691937965065016808710250735070825260046821242820434367245824478859256555487861614478717581068572356895150707602217433511627331709472765932413249132702425519391509083601346239612335001086614623850633127072987745618984384288764099836164964775714638573247333226653894523588365972955159905187411779288608760239306160016168434070611663449248395156319152882728822831375458678269830696691220130954815935450754923554167766876455212545681242936427474153815692219503331560151614492247512488957534835926226263545406704767033866410025277276800886383266629488582740369655329362236090572479794734434077704284318507901973469071141230364111729224929307731939309795452877412451183953480382210373644697046967493042810911797232448615413264031578430955396671061468083815548947146733652483679138566431084747848676243012018489329109615281108087617422779131629345494425395422727309645057976122885347393189600810965202090151104579377602529543130188938184010247010134929317443562883578609861545691161669857388024973756940558138630581099823372565164920155443216861690537054630176154809626620800633059320775897175589925862195462096455464624399535391743228225433267174308492508396461328929584567927365409119947616225155964704061297047759818551878441419948614013153859322060745185909608884280218943358691959604936409651570327527570641500776261323783648149005245481413195989296398441371781402764122087644989688629798910870164270169014007825748311598976330612951195680427485317886333041169767175063822135213839779138443325644288490872919067009802496281560626258636942322658490628628035057282983101266919109637258378149363774960594515216932644945188292639525772348420077356021656909077097264985642831778694777804964343991762549216500608626285329471055602670413384500507827390640287529864161287496473708235188892189612641279553536442286955430551308700009878557534223100547153412810957024870812654319123261956462149376527526356402127388765103883255007364899937167183280028398832319373301564123277185395654932422977953016534830128490677845037490891749347389015649588574802194996722621185874361039774946338633057887487405540005440439344888192044102134790034598411927024921557026873700970995205391930979319495883265922171508324621942300185974396706491149559411733728199869021311629886680267446443489233020607003821262841723679627307191405008084085703978151998148822390059948911946474438682533745889962375133378280532928272016815977970066488394482446332210928320504045983008943565954267256879714918703447338237767914829203283196838105907715727191903042365315650957464549643425328069510396558733549803850995143463506175361480050195045201350200180281506933241918267855737764414097080945745624854867704904368368717590918057269794010465019484853146726642978667687697789291431128505043098192949736165944259471754765135205245072597538577958372797702972231435199958499522344049394502115428867244188717409524554771867484911475031801773304689909317974472957035192387686405544278134169807249382219749124257510162187439772902147704638010731470653154201300583810458905006764557332998149945854655105526374914354195867992595981412218735238407957416123372264063860431988936249867649693592569592128495906254446474331759999685163660305216426770428154681777589339252115538590526823311608302751194384823861552852465010329467297198112105314125898165100120742688143577590825227466863206188376830450921784582526239594189673003640808624233657620979111641766331328852352062487922978959456450333733139422384778582717195412347860434376165241568717943562570215636666680088531006728947033079540804583324192188488870712275670333173939262509073556164513677064199539111948881240659821685787131385056850623094155206877987539740658484250135205615103489821873770245063583314243624807432542464195984647411575625441010389671576677263196442524931941806472423789334668561083789808830313571333157729435664956078125304917594015895146954965223118559669048559467607968190167266634650186182955669893965019614544401768162810604465068448139561667220729261210164692339016793399632833013163850830967942792934551268435760356901970523138364640961311774904600772840862214747547653221505518116489887879087780918009050706040061220010051271575991225725282523378026809030528461581739558198122397010092017202251606352922464781615533532275453264543087093320924631855976580561717446840450048285353396546862678852330044967795580761661801833668792312510460809773895565488962815089519622093675058841609752282328250433712970186608193748968699961301486924694482420723632912367052542145464162968910442981633373266871675946715392611950649224725627254543274193495995569590243279097174392258098103601486364409101491734183079646345064833303404765711827040276868271418084574998493392039317445402616663674646668754385093967129918067471909885312710726724428584870694307099756567949198418996425748884764622030325637751112534060087936904565779272035205921345924272965206683338510673615276261016026647772485083344719891986802656197236420847504962661607797092906844757798251795569758235084371746103310387911789239441630112634077535773520558040066982523191225570519133631407211349723226549151062961739050617857127509403623146700931176133132018631158730886798239298009805089491510788371194099750375473674305745187265414016446924576792185753680363289139664155342066705623272936001177781498886100830877849571709880858667023104043242526785955562077310543072298032125941107957349146684680220501816192150766649106862033378713826058987655210423668198670177861672671972374156917880001690656659046965316154923604061891820982414006103779407166342002735828911994182647812782659666207030384795881442790246669264032799404016800137293477301530941805070587421153284642203006550763966756168318897005152026656649929417382840327305940740147117478464839241225676523593418554066440983706083636457657081801664285044258224551650808864421212113914352453935225522162483791737330329812349528984098613273709957407786789349311975204237925022851375880436791854547836416773151821457226504640800104202100410766027807729152555503218182387221708112766208665317651926458452495269685376314437998340336947124447247796973890514941120010934140073794061859447165516612674930799374705772930521750426383798367668159183589049652163726492960837147204067428996276720315410211504333742057182854090136325721437592054640471894328548696883599785122262130812989581571391597464534806099601555877223193450760315411663112963843719400333736013305526352571490454327925190794007111504785378036370897340146753465517470747096935814912797188187854376797751675927822300312945518595042883902735494672667647506072643698761394806879080593531793001711000214417701504495496412454361656210150919997862972495905809191825255486358703529320142005857057855419217730505342687533799076038746689684283402648733290888881745453047194740939258407362058242849349024756883352446212456101562729065130618520732925434179252299417447855189995098959999877410951464170076989305620163502192692653166599093238118295411937545448509428621839424186218067457128099385258842631930670182098008050900019819621758458932516877698594110522845465835679362969619219080897536813210484518784516230623911878024604050824909336069998094776253792973597037759066145994638578378211017122446355845171941670344732162722443265914858595797823752976323442911242311368603724514438765801271594060878788638511089680883165505046309006148832545452819908256238805872042843941834687865142541377686054291079721004271658 diff --git a/llgo/third_party/gofrontend/libgo/go/compress/testdata/pi.txt b/llgo/third_party/gofrontend/libgo/go/compress/testdata/pi.txt deleted file mode 100644 index ca99bbc2a2553d83b4a34d062294b9043bbbb46b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/testdata/pi.txt +++ /dev/null @@ -1 +0,0 @@ -3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157959847035622262934860034158722980534989650226291748788202734209222245339856264766914905562842503912757710284027998066365825488926488025456610172967026640765590429099456815065265305371829412703369313785178609040708667114965583434347693385781711386455873678123014587687126603489139095620099393610310291616152881384379099042317473363948045759314931405297634757481193567091101377517210080315590248530906692037671922033229094334676851422144773793937517034436619910403375111735471918550464490263655128162288244625759163330391072253837421821408835086573917715096828874782656995995744906617583441375223970968340800535598491754173818839994469748676265516582765848358845314277568790029095170283529716344562129640435231176006651012412006597558512761785838292041974844236080071930457618932349229279650198751872127267507981255470958904556357921221033346697499235630254947802490114195212382815309114079073860251522742995818072471625916685451333123948049470791191532673430282441860414263639548000448002670496248201792896476697583183271314251702969234889627668440323260927524960357996469256504936818360900323809293459588970695365349406034021665443755890045632882250545255640564482465151875471196218443965825337543885690941130315095261793780029741207665147939425902989695946995565761218656196733786236256125216320862869222103274889218654364802296780705765615144632046927906821207388377814233562823608963208068222468012248261177185896381409183903673672220888321513755600372798394004152970028783076670944474560134556417254370906979396122571429894671543578468788614445812314593571984922528471605049221242470141214780573455105008019086996033027634787081081754501193071412233908663938339529425786905076431006383519834389341596131854347546495569781038293097164651438407007073604112373599843452251610507027056235266012764848308407611830130527932054274628654036036745328651057065874882256981579367897669742205750596834408697350201410206723585020072452256326513410559240190274216248439140359989535394590944070469120914093870012645600162374288021092764579310657922955249887275846101264836999892256959688159205600101655256375678566722796619885782794848855834397518744545512965634434803966420557982936804352202770984294232533022576341807039476994159791594530069752148293366555661567873640053666564165473217043903521329543529169414599041608753201868379370234888689479151071637852902345292440773659495630510074210871426134974595615138498713757047101787957310422969066670214498637464595280824369445789772330048764765241339075920434019634039114732023380715095222010682563427471646024335440051521266932493419673977041595683753555166730273900749729736354964533288869844061196496162773449518273695588220757355176651589855190986665393549481068873206859907540792342402300925900701731960362254756478940647548346647760411463233905651343306844953979070903023460461470961696886885014083470405460742958699138296682468185710318879065287036650832431974404771855678934823089431068287027228097362480939962706074726455399253994428081137369433887294063079261595995462624629707062594845569034711972996409089418059534393251236235508134949004364278527138315912568989295196427287573946914272534366941532361004537304881985517065941217352462589548730167600298865925786628561249665523533829428785425340483083307016537228563559152534784459818313411290019992059813522051173365856407826484942764411376393866924803118364453698589175442647399882284621844900877769776312795722672655562596282542765318300134070922334365779160128093179401718598599933849235495640057099558561134980252499066984233017350358044081168552653117099570899427328709258487894436460050410892266917835258707859512983441729535195378855345737426085902908176515578039059464087350612322611200937310804854852635722825768203416050484662775045003126200800799804925485346941469775164932709504934639382432227188515974054702148289711177792376122578873477188196825462981268685817050740272550263329044976277894423621674119186269439650671515779586756482399391760426017633870454990176143641204692182370764887834196896861181558158736062938603810171215855272668300823834046564758804051380801633638874216371406435495561868964112282140753302655100424104896783528588290243670904887118190909494533144218287661810310073547705498159680772009474696134360928614849417850171807793068108546900094458995279424398139213505586422196483491512639012803832001097738680662877923971801461343244572640097374257007359210031541508936793008169980536520276007277496745840028362405346037263416554259027601834840306811381855105979705664007509426087885735796037324514146786703688098806097164258497595138069309449401515422221943291302173912538355915031003330325111749156969174502714943315155885403922164097229101129035521815762823283182342548326111912800928252561902052630163911477247331485739107775874425387611746578671169414776421441111263583553871361011023267987756410246824032264834641766369806637857681349204530224081972785647198396308781543221166912246415911776732253264335686146186545222681268872684459684424161078540167681420808850280054143613146230821025941737562389942075713627516745731891894562835257044133543758575342698699472547031656613991999682628247270641336222178923903176085428943733935618891651250424404008952719837873864805847268954624388234375178852014395600571048119498842390606136957342315590796703461491434478863604103182350736502778590897578272731305048893989009923913503373250855982655867089242612429473670193907727130706869170926462548423240748550366080136046689511840093668609546325002145852930950000907151058236267293264537382104938724996699339424685516483261134146110680267446637334375340764294026682973865220935701626384648528514903629320199199688285171839536691345222444708045923966028171565515656661113598231122506289058549145097157553900243931535190902107119457300243880176615035270862602537881797519478061013715004489917210022201335013106016391541589578037117792775225978742891917915522417189585361680594741234193398420218745649256443462392531953135103311476394911995072858430658361935369329699289837914941939406085724863968836903265564364216644257607914710869984315733749648835292769328220762947282381537409961545598798259891093717126218283025848112389011968221429457667580718653806506487026133892822994972574530332838963818439447707794022843598834100358385423897354243956475556840952248445541392394100016207693636846776413017819659379971557468541946334893748439129742391433659360410035234377706588867781139498616478747140793263858738624732889645643598774667638479466504074111825658378878454858148962961273998413442726086061872455452360643153710112746809778704464094758280348769758948328241239292960582948619196670918958089833201210318430340128495116203534280144127617285830243559830032042024512072872535581195840149180969253395075778400067465526031446167050827682772223534191102634163157147406123850425845988419907611287258059113935689601431668283176323567325417073420817332230462987992804908514094790368878687894930546955703072619009502076433493359106024545086453628935456862958531315337183868265617862273637169757741830239860065914816164049449650117321313895747062088474802365371031150898427992754426853277974311395143574172219759799359685252285745263796289612691572357986620573408375766873884266405990993505000813375432454635967504844235284874701443545419576258473564216198134073468541117668831186544893776979566517279662326714810338643913751865946730024434500544995399742372328712494834706044063471606325830649829795510109541836235030309453097335834462839476304775645015008507578949548931393944899216125525597701436858943585877526379625597081677643800125436502371412783467926101995585224717220177723700417808419423948725406801556035998390548985723546745642390585850216719031395262944554391316631345308939062046784387785054239390524731362012947691874975191011472315289326772533918146607300089027768963114810902209724520759167297007850580717186381054967973100167870850694207092232908070383263453452038027860990556900134137182368370991949516489600755049341267876436746384902063964019766685592335654639138363185745698147196210841080961884605456039038455343729141446513474940784884423772175154334260306698831768331001133108690421939031080143784334151370924353013677631084913516156422698475074303297167469640666531527035325467112667522460551199581831963763707617991919203579582007595605302346267757943936307463056901080114942714100939136913810725813781357894005599500183542511841721360557275221035268037357265279224173736057511278872181908449006178013889710770822931002797665935838758909395688148560263224393726562472776037890814458837855019702843779362407825052704875816470324581290878395232453237896029841669225489649715606981192186584926770403956481278102179913217416305810554598801300484562997651121241536374515005635070127815926714241342103301566165356024733807843028655257222753049998837015348793008062601809623815161366903341111386538510919367393835229345888322550887064507539473952043968079067086806445096986548801682874343786126453815834280753061845485903798217994599681154419742536344399602902510015888272164745006820704193761584547123183460072629339550548239557137256840232268213012476794522644820910235647752723082081063518899152692889108455571126603965034397896278250016110153235160519655904211844949907789992007329476905868577878720982901352956613978884860509786085957017731298155314951681467176959760994210036183559138777817698458758104466283998806006162298486169353373865787735983361613384133853684211978938900185295691967804554482858483701170967212535338758621582310133103877668272115726949518179589754693992642197915523385766231676275475703546994148929041301863861194391962838870543677743224276809132365449485366768000001065262485473055861598999140170769838548318875014293890899506854530765116803337322265175662207526951791442252808165171667766727930354851542040238174608923283917032754257508676551178593950027933895920576682789677644531840404185540104351348389531201326378369283580827193783126549617459970567450718332065034556644034490453627560011250184335607361222765949278393706478426456763388188075656121689605041611390390639601620221536849410926053876887148379895599991120991646464411918568277004574243434021672276445589330127781586869525069499364610175685060167145354315814801054588605645501332037586454858403240298717093480910556211671546848477803944756979804263180991756422809873998766973237695737015808068229045992123661689025962730430679316531149401764737693873514093361833216142802149763399189835484875625298752423873077559555955465196394401821840998412489826236737714672260616336432964063357281070788758164043814850188411431885988276944901193212968271588841338694346828590066640806314077757725705630729400492940302420498416565479736705485580445865720227637840466823379852827105784319753541795011347273625774080213476826045022851579795797647467022840999561601569108903845824502679265942055503958792298185264800706837650418365620945554346135134152570065974881916341359556719649654032187271602648593049039787489589066127250794828276938953521753621850796297785146188432719223223810158744450528665238022532843891375273845892384422535472653098171578447834215822327020690287232330053862163479885094695472004795231120150432932266282727632177908840087861480221475376578105819702226309717495072127248479478169572961423658595782090830733233560348465318730293026659645013718375428897557971449924654038681799213893469244741985097334626793321072686870768062639919361965044099542167627840914669856925715074315740793805323925239477557441591845821562518192155233709607483329234921034514626437449805596103307994145347784574699992128599999399612281615219314888769388022281083001986016549416542616968586788372609587745676182507275992950893180521872924610867639958916145855058397274209809097817293239301067663868240401113040247007350857828724627134946368531815469690466968693925472519413992914652423857762550047485295476814795467007050347999588867695016124972282040303995463278830695976249361510102436555352230690612949388599015734661023712235478911292547696176005047974928060721268039226911027772261025441492215765045081206771735712027180242968106203776578837166909109418074487814049075517820385653909910477594141321543284406250301802757169650820964273484146957263978842560084531214065935809041271135920041975985136254796160632288736181367373244506079244117639975974619383584574915988097667447093006546342423460634237474666080431701260052055928493695941434081468529815053947178900451835755154125223590590687264878635752541911288877371766374860276606349603536794702692322971868327717393236192007774522126247518698334951510198642698878471719396649769070825217423365662725928440620430214113719922785269984698847702323823840055655517889087661360130477098438611687052310553149162517283732728676007248172987637569816335415074608838663640693470437206688651275688266149730788657015685016918647488541679154596507234287730699853713904300266530783987763850323818215535597323530686043010675760838908627049841888595138091030423595782495143988590113185835840667472370297149785084145853085781339156270760356390763947311455495832266945702494139831634332378975955680856836297253867913275055542524491943589128405045226953812179131914513500993846311774017971512283785460116035955402864405902496466930707769055481028850208085800878115773817191741776017330738554758006056014337743299012728677253043182519757916792969965041460706645712588834697979642931622965520168797300035646304579308840327480771811555330909887025505207680463034608658165394876951960044084820659673794731680864156456505300498816164905788311543454850526600698230931577765003780704661264706021457505793270962047825615247145918965223608396645624105195510522357239739512881816405978591427914816542632892004281609136937773722299983327082082969955737727375667615527113922588055201898876201141680054687365580633471603734291703907986396522961312801782679717289822936070288069087768660593252746378405397691848082041021944719713869256084162451123980620113184541244782050110798760717155683154078865439041210873032402010685341947230476666721749869868547076781205124736792479193150856444775379853799732234456122785843296846647513336573692387201464723679427870042503255589926884349592876124007558756946413705625140011797133166207153715436006876477318675587148783989081074295309410605969443158477539700943988394914432353668539209946879645066533985738887866147629443414010498889931600512076781035886116602029611936396821349607501116498327856353161451684576956871090029997698412632665023477167286573785790857466460772283415403114415294188047825438761770790430001566986776795760909966936075594965152736349811896413043311662774712338817406037317439705406703109676765748695358789670031925866259410510533584384656023391796749267844763708474978333655579007384191473198862713525954625181604342253729962863267496824058060296421146386436864224724887283434170441573482481833301640566959668866769563491416328426414974533349999480002669987588815935073578151958899005395120853510357261373640343675347141048360175464883004078464167452167371904831096767113443494819262681110739948250607394950735031690197318521195526356325843390998224986240670310768318446607291248747540316179699411397387765899868554170318847788675929026070043212666179192235209382278788809886335991160819235355570464634911320859189796132791319756490976000139962344455350143464268604644958624769094347048293294140411146540923988344435159133201077394411184074107684981066347241048239358274019449356651610884631256785297769734684303061462418035852933159734583038455410337010916767763742762102137013548544509263071901147318485749233181672072137279355679528443925481560913728128406333039373562420016045664557414588166052166608738748047243391212955877763906969037078828527753894052460758496231574369171131761347838827194168606625721036851321566478001476752310393578606896111259960281839309548709059073861351914591819510297327875571049729011487171897180046961697770017913919613791417162707018958469214343696762927459109940060084983568425201915593703701011049747339493877885989417433031785348707603221982970579751191440510994235883034546353492349826883624043327267415540301619505680654180939409982020609994140216890900708213307230896621197755306659188141191577836272927461561857103721724710095214236964830864102592887457999322374955191221951903424452307535133806856807354464995127203174487195403976107308060269906258076020292731455252078079914184290638844373499681458273372072663917670201183004648190002413083508846584152148991276106513741539435657211390328574918769094413702090517031487773461652879848235338297260136110984514841823808120540996125274580881099486972216128524897425555516076371675054896173016809613803811914361143992106380050832140987604599309324851025168294467260666138151745712559754953580239983146982203613380828499356705575524712902745397762140493182014658008021566536067765508783804304134310591804606800834591136640834887408005741272586704792258319127415739080914383138456424150940849133918096840251163991936853225557338966953749026620923261318855891580832455571948453875628786128859004106006073746501402627824027346962528217174941582331749239683530136178653673760642166778137739951006589528877427662636841830680190804609849809469763667335662282915132352788806157768278159588669180238940333076441912403412022316368577860357276941541778826435238131905028087018575047046312933353757285386605888904583111450773942935201994321971171642235005644042979892081594307167019857469273848653833436145794634175922573898588001698014757420542995801242958105456510831046297282937584161162532562516572498078492099897990620035936509934721582965174135798491047111660791587436986541222348341887722929446335178653856731962559852026072947674072616767145573649812105677716893484917660771705277187601199908144113058645577910525684304811440261938402322470939249802933550731845890355397133088446174107959162511714864874468611247605428673436709046678468670274091881014249711149657817724279347070216688295610877794405048437528443375108828264771978540006509704033021862556147332117771174413350281608840351781452541964320309576018694649088681545285621346988355444560249556668436602922195124830910605377201980218310103270417838665447181260397190688462370857518080035327047185659499476124248110999288679158969049563947624608424065930948621507690314987020673533848349550836366017848771060809804269247132410009464014373603265645184566792456669551001502298330798496079949882497061723674493612262229617908143114146609412341593593095854079139087208322733549572080757165171876599449856937956238755516175754380917805280294642004472153962807463602113294255916002570735628126387331060058910652457080244749375431841494014821199962764531068006631183823761639663180931444671298615527598201451410275600689297502463040173514891945763607893528555053173314164570504996443890936308438744847839616840518452732884032345202470568516465716477139323775517294795126132398229602394548579754586517458787713318138752959809412174227300352296508089177705068259248822322154938048371454781647213976820963320508305647920482085920475499857320388876391601995240918938945576768749730856955958010659526503036266159750662225084067428898265907510637563569968211510949669744580547288693631020367823250182323708459790111548472087618212477813266330412076216587312970811230758159821248639807212407868878114501655825136178903070860870198975889807456643955157415363193191981070575336633738038272152798849350397480015890519420879711308051233933221903466249917169150948541401871060354603794643379005890957721180804465743962806186717861017156740967662080295766577051291209907944304632892947306159510430902221439371849560634056189342513057268291465783293340524635028929175470872564842600349629611654138230077313327298305001602567240141851520418907011542885799208121984493156999059182011819733500126187728036812481995877070207532406361259313438595542547781961142935163561223496661522614735399674051584998603552953329245752388810136202347624669055816438967863097627365504724348643071218494373485300606387644566272186661701238127715621379746149861328744117714552444708997144522885662942440230184791205478498574521634696448973892062401943518310088283480249249085403077863875165911302873958787098100772718271874529013972836614842142871705531796543076504534324600536361472618180969976933486264077435199928686323835088756683595097265574815431940195576850437248001020413749831872259677387154958399718444907279141965845930083942637020875635398216962055324803212267498911402678528599673405242031091797899905718821949391320753431707980023736590985375520238911643467185582906853711897952626234492483392496342449714656846591248918556629589329909035239233333647435203707701010843880032907598342170185542283861617210417603011645918780539367447472059985023582891833692922337323999480437108419659473162654825748099482509991833006976569367159689364493348864744213500840700660883597235039532340179582557036016936990988671132109798897070517280755855191269930673099250704070245568507786790694766126298082251633136399521170984528092630375922426742575599892892783704744452189363203489415521044597261883800300677617931381399162058062701651024458869247649246891924612125310275731390840470007143561362316992371694848132554200914530410371354532966206392105479824392125172540132314902740585892063217589494345489068463993137570910346332714153162232805522972979538018801628590735729554162788676498274186164218789885741071649069191851162815285486794173638906653885764229158342500673612453849160674137340173572779956341043326883569507814931378007362354180070619180267328551191942676091221035987469241172837493126163395001239599240508454375698507957046222664619000103500490183034153545842833764378111988556318777792537201166718539541835984438305203762819440761594106820716970302285152250573126093046898423433152732131361216582808075212631547730604423774753505952287174402666389148817173086436111389069420279088143119448799417154042103412190847094080254023932942945493878640230512927119097513536000921971105412096683111516328705423028470073120658032626417116165957613272351566662536672718998534199895236884830999302757419916463841427077988708874229277053891227172486322028898425125287217826030500994510824783572905691988555467886079462805371227042466543192145281760741482403827835829719301017888345674167811398954750448339314689630763396657226727043393216745421824557062524797219978668542798977992339579057581890622525473582205236424850783407110144980478726691990186438822932305382318559732869780922253529591017341407334884761005564018242392192695062083183814546983923664613639891012102177095976704908305081854704194664371312299692358895384930136356576186106062228705599423371631021278457446463989738188566746260879482018647487672727222062676465338099801966883680994159075776852639865146253336312450536402610569605513183813174261184420189088853196356986962795036738424313011331753305329802016688817481342988681585577810343231753064784983210629718425184385534427620128234570716988530518326179641178579608888150329602290705614476220915094739035946646916235396809201394578175891088931992112260073928149169481615273842736264298098234063200244024495894456129167049508235812487391799648641133480324757775219708932772262349486015046652681439877051615317026696929704928316285504212898146706195331970269507214378230476875280287354126166391708245925170010714180854800636923259462019002278087409859771921805158532147392653251559035410209284665925299914353791825314545290598415817637058927906909896911164381187809435371521332261443625314490127454772695739393481546916311624928873574718824071503995009446731954316193855485207665738825139639163576723151005556037263394867208207808653734942440115799667507360711159351331959197120948964717553024531364770942094635696982226673775209945168450643623824211853534887989395673187806606107885440005508276570305587448541805778891719207881423351138662929667179643468760077047999537883387870348718021842437342112273940255717690819603092018240188427057046092622564178375265263358324240661253311529423457965569502506810018310900411245379015332966156970522379210325706937051090830789479999004999395322153622748476603613677697978567386584670936679588583788795625946464891376652199588286933801836011932368578558558195556042156250883650203322024513762158204618106705195330653060606501054887167245377942831338871631395596905832083416898476065607118347136218123246227258841990286142087284956879639325464285343075301105285713829643709990356948885285190402956047346131138263878897551788560424998748316382804046848618938189590542039889872650697620201995548412650005394428203930127481638158530396439925470201672759328574366661644110962566337305409219519675148328734808957477775278344221091073111351828046036347198185655572957144747682552857863349342858423118749440003229690697758315903858039353521358860079600342097547392296733310649395601812237812854584317605561733861126734780745850676063048229409653041118306671081893031108871728167519579675347188537229309616143204006381322465841111157758358581135018569047815368938137718472814751998350504781297718599084707621974605887423256995828892535041937958260616211842368768511418316068315867994601652057740529423053601780313357263267054790338401257305912339601880137825421927094767337191987287385248057421248921183470876629667207272325650565129333126059505777727542471241648312832982072361750574673870128209575544305968395555686861188397135522084452852640081252027665557677495969626612604565245684086139238265768583384698499778726706555191854468698469478495734622606294219624557085371272776523098955450193037732166649182578154677292005212667143463209637891852323215018976126034373684067194193037746880999296877582441047878123266253181845960453853543839114496775312864260925211537673258866722604042523491087026958099647595805794663973419064010036361904042033113579336542426303561457009011244800890020801478056603710154122328891465722393145076071670643556827437743965789067972687438473076346451677562103098604092717090951280863090297385044527182892749689212106670081648583395537735919136950153162018908887484210798706899114804669270650940762046502772528650728905328548561433160812693005693785417861096969202538865034577183176686885923681488475276498468821949739729707737187188400414323127636504814531122850990020742409255859252926103021067368154347015252348786351643976235860419194129697690405264832347009911154242601273438022089331096686367898694977994001260164227609260823493041180643829138347354679725399262338791582998486459271734059225620749105308531537182911681637219395188700957788181586850464507699343940987433514431626330317247747486897918209239480833143970840673084079589358108966564775859905563769525232653614424780230826811831037735887089240613031336477371011628214614661679404090518615260360092521947218890918107335871964142144478654899528582343947050079830388538860831035719306002771194558021911942899922722353458707566246926177663178855144350218287026685610665003531050216318206017609217984684936863161293727951873078972637353717150256378733579771808184878458866504335824377004147710414934927438457587107159731559439426412570270965125108115548247939403597681188117282472158250109496096625393395380922195591918188552678062149923172763163218339896938075616855911752998450132067129392404144593862398809381240452191484831646210147389182510109096773869066404158973610476436500068077105656718486281496371118832192445663945814491486165500495676982690308911185687986929470513524816091743243015383684707292898982846022237301452655679898627767968091469798378268764311598832109043715611299766521539635464420869197567370005738764978437686287681792497469438427465256316323005551304174227341646455127812784577772457520386543754282825671412885834544435132562054464241011037955464190581168623059644769587054072141985212106734332410756767575818456990693046047522770167005684543969234041711089888993416350585157887353430815520811772071880379104046983069578685473937656433631979786803671873079693924236321448450354776315670255390065423117920153464977929066241508328858395290542637687668968805033317227800185885069736232403894700471897619347344308437443759925034178807972235859134245813144049847701732361694719765715353197754997162785663119046912609182591249890367654176979903623755286526375733763526969344354400473067198868901968147428767790866979688522501636949856730217523132529265375896415171479559538784278499866456302878831962099830494519874396369070682762657485810439112232618794059941554063270131989895703761105323606298674803779153767511583043208498720920280929752649812569163425000522908872646925284666104665392171482080130502298052637836426959733707053922789153510568883938113249757071331029504430346715989448786847116438328050692507766274500122003526203709466023414648998390252588830148678162196775194583167718762757200505439794412459900771152051546199305098386982542846407255540927403132571632640792934183342147090412542533523248021932277075355546795871638358750181593387174236061551171013123525633485820365146141870049205704372018261733194715700867578539336078622739558185797587258744102542077105475361294047460100094095444959662881486915903899071865980563617137692227290764197755177720104276496949611056220592502420217704269622154958726453989227697660310524980855759471631075870133208861463266412591148633881220284440694169488261529577625325019870359870674380469821942056381255833436421949232275937221289056420943082352544084110864545369404969271494003319782861318186188811118408257865928757426384450059944229568586460481033015388911499486935436030221810943466764000022362550573631294626296096198760564259963946138692330837196265954739234624134597795748524647837980795693198650815977675350553918991151335252298736112779182748542008689539658359421963331502869561192012298889887006079992795411188269023078913107603617634779489432032102773359416908650071932804017163840644987871753756781185321328408216571107549528294974936214608215583205687232185574065161096274874375098092230211609982633033915469494644491004515280925089745074896760324090768983652940657920198315265410658136823791984090645712468948470209357761193139980246813405200394781949866202624008902150166163813538381515037735022966074627952910384068685569070157516624192987244482719429331004854824454580718897633003232525821581280327467962002814762431828622171054352898348208273451680186131719593324711074662228508710666117703465352839577625997744672185715816126411143271794347885990892808486694914139097716736900277758502686646540565950394867841110790116104008572744562938425494167594605487117235946429105850909950214958793112196135908315882620682332156153086833730838173279328196983875087083483880463884784418840031847126974543709373298362402875197920802321878744882872843727378017827008058782410749357514889978911739746129320351081432703251409030487462262942344327571260086642508333187688650756429271605525289544921537651751492196367181049435317858383453865255656640657251363575064353236508936790431702597878177190314867963840828810209461490079715137717099061954969640070867667102330048672631475510537231757114322317411411680622864206388906210192355223546711662137499693269321737043105987225039456574924616978260970253359475020913836673772894438696400028110344026084712899000746807764844088711341352503367877316797709372778682166117865344231732264637847697875144332095340001650692130546476890985050203015044880834261845208730530973189492916425322933612431514306578264070283898409841602950309241897120971601649265613413433422298827909921786042679812457285345801338260995877178113102167340256562744007296834066198480676615805021691833723680399027931606420436812079900316264449146190219458229690992122788553948783538305646864881655562294315673128274390826450611628942803501661336697824051770155219626522725455850738640585299830379180350432876703809252167907571204061237596327685674845079151147313440001832570344920909712435809447900462494313455028900680648704293534037436032625820535790118395649089354345101342969617545249573960621490288728932792520696535386396443225388327522499605986974759882329916263545973324445163755334377492928990581175786355555626937426910947117002165411718219750519831787137106051063795558588905568852887989084750915764639074693619881507814685262133252473837651192990156109189777922008705793396463827490680698769168197492365624226087154176100430608904377976678519661891404144925270480881971498801542057787006521594009289777601330756847966992955433656139847738060394368895887646054983871478968482805384701730871117761159663505039979343869339119789887109156541709133082607647406305711411098839388095481437828474528838368079418884342666222070438722887413947801017721392281911992365405516395893474263953824829609036900288359327745855060801317988407162446563997948275783650195514221551339281978226984278638391679715091262410548725700924070045488485692950448110738087996547481568913935380943474556972128919827177020766613602489581468119133614121258783895577357194986317210844398901423948496659251731388171602663261931065366535041473070804414939169363262373767777095850313255990095762731957308648042467701212327020533742667053142448208168130306397378736642483672539837487690980602182785786216512738563513290148903509883270617258932575363993979055729175160097615459044771692265806315111028038436017374742152476085152099016158582312571590733421736576267142390478279587281505095633092802668458937649649770232973641319060982740633531089792464242134583740901169391964250459128813403498810635400887596820054408364386516617880557608956896727531538081942077332597917278437625661184319891025007491829086475149794003160703845549465385946027452447466812314687943441610993338908992638411847425257044572517459325738989565185716575961481266020310797628254165590506042479114016957900338356574869252800743025623419498286467914476322774005529460903940177536335655471931000175430047504719144899841040015867946179241610016454716551337074073950260442769538553834397550548871099785205401175169747581344926079433689543783221172450687344231989878844128542064742809735625807066983106979935260693392135685881391214807354728463227784908087002467776303605551232386656295178853719673034634701222939581606792509153217489030840886516061119011498443412350124646928028805996134283511884715449771278473361766285062169778717743824362565711779450064477718370221999106695021656757644044997940765037999954845002710665987813603802314126836905783190460792765297277694043613023051787080546511542469395265127101052927070306673024447125973939950514628404767431363739978259184541176413327906460636584152927019030276017339474866960348694976541752429306040727005059039503148522921392575594845078867977925253931765156416197168443524369794447355964260633391055126826061595726217036698506473281266724521989060549880280782881429796336696744124805982192146339565745722102298677599746738126069367069134081559412016115960190237753525556300606247983261249881288192937343476862689219239777833910733106588256813777172328315329082525092733047850724977139448333892552081175608452966590553940965568541706001179857293813998258319293679100391844099286575605993598910002969864460974714718470101531283762631146774209145574041815908800064943237855839308530828305476076799524357391631221886057549673832243195650655460852881201902363644712703748634421727257879503428486312944916318475347531435041392096108796057730987201352484075057637199253650470908582513936863463863368042891767107602111159828875539940120076013947033661793715396306139863655492213741597905119083588290097656647300733879314678913181465109316761575821351424860442292445304113160652700974330088499034675405518640677342603583409608605533747362760935658853109760994238347382222087292464497684560579562516765574088410321731345627735856052358236389532038534024842273371639123973215995440828421666636023296545694703577184873442034227706653837387506169212768015766181095420097708363604361110592409117889540338021426523948929686439808926114635414571535194342850721353453018315875628275733898268898523557799295727645229391567477566676051087887648453493636068278050564622813598885879259940946446041705204470046315137975431737187756039815962647501410906658866162180038266989961965580587208639721176995219466789857011798332440601811575658074284182910615193917630059194314434605154047710570054339000182453117733718955857603607182860506356479979004139761808955363669603162193113250223851791672055180659263518036251214575926238369348222665895576994660491938112486609099798128571823494006615552196112207203092277646200999315244273589488710576623894693889446495093960330454340842102462401048723328750081749179875543879387381439894238011762700837196053094383940063756116458560943129517597713935396074322792489221267045808183313764165818269562105872892447740035947009268662659651422050630078592002488291860839743732353849083964326147000532423540647042089499210250404726781059083644007466380020870126664209457181702946752278540074508552377720890581683918446592829417018288233014971554235235911774818628592967605048203864343108779562892925405638946621948268711042828163893975711757786915430165058602965217459581988878680408110328432739867198621306205559855266036405046282152306154594474489908839081999738747452969810776201487134000122535522246695409315213115337915798026979555710508507473874750758068765376445782524432638046143042889235934852961058269382103498000405248407084403561167817170512813378805705643450616119330424440798260377951198548694559152051960093041271007277849301555038895360338261929343797081874320949914159593396368110627557295278004254863060054523839151068998913578820019411786535682149118528207852130125518518493711503422159542244511900207393539627400208110465530207932867254740543652717595893500716336076321614725815407642053020045340183572338292661915308354095120226329165054426123619197051613839357326693760156914429944943744856809775696303129588719161129294681884936338647392747601226964158848900965717086160598147204467428664208765334799858222090619802173211614230419477754990738738567941189824660913091691772274207233367635032678340586301930193242996397204445179288122854478211953530898910125342975524727635730226281382091807439748671453590778633530160821559911314144205091447293535022230817193663509346865858656314855575862447818620108711889760652969899269328178705576435143382060141077329261063431525337182243385263520217735440715281898137698755157574546939727150488469793619500477720970561793913828989845327426227288647108883270173723258818244658436249580592560338105215606206155713299156084892064340303395262263451454283678698288074251422567451806184149564686111635404971897682154227722479474033571527436819409892050113653400123846714296551867344153741615042563256713430247655125219218035780169240326699541746087592409207004669340396510178134857835694440760470232540755557764728450751826890418293966113310160131119077398632462778219023650660374041606724962490137433217246454097412995570529142438208076098364823465973886691349919784013108015581343979194852830436739012482082444814128095443773898320059864909159505322857914576884962578665885999179867520554558099004556461178755249370124553217170194282884617402736649978475508294228020232901221630102309772151569446427909802190826689868834263071609207914085197695235553488657743425277531197247430873043619511396119080030255878387644206085044730631299277888942729189727169890575925244679660189707482960949190648764693702750773866432391919042254290235318923377293166736086996228032557185308919284403805071030064776847863243191000223929785255372375566213644740096760539439838235764606992465260089090624105904215453927904411529580345334500256244101006359530039598864466169595626351878060688513723462707997327233134693971456285542615467650632465676620279245208581347717608521691340946520307673391841147504140168924121319826881568664561485380287539331160232292555618941042995335640095786495340935115266454024418775949316930560448686420862757201172319526405023099774567647838488973464317215980626787671838005247696884084989185086149003432403476742686245952395890358582135006450998178244636087317754378859677672919526111213859194725451400301180503437875277664402762618941017576872680428176623860680477885242887430259145247073950546525135339459598789619778911041890292943818567205070964606263541732944649576612651953495701860015412623962286413897796733329070567376962156498184506842263690367849555970026079867996261019039331263768556968767029295371162528005543100786408728939225714512481135778627664902425161990277471090335933309304948380597856628844787441469841499067123764789582263294904679812089984857163571087831191848630254501620929805829208334813638405421720056121989353669371336733392464416125223196943471206417375491216357008573694397305979709719726666642267431117762176403068681310351899112271339724036887000996862922546465006385288620393800504778276912835603372548255793912985251506829969107754257647488325341412132800626717094009098223529657957997803018282428490221470748111124018607613415150387569830918652780658896682362523937845272634530420418802508442363190383318384550522367992357752929106925043261446950109861088899914658551881873582528164302520939285258077969737620845637482114433988162710031703151334402309526351929588680690821355853680161000213740851154484912685841268695899174149133820578492800698255195740201818105641297250836070356851055331787840829000041552511865779453963317538532092149720526607831260281961164858098684587525129997404092797683176639914655386108937587952214971731728131517932904431121815871023518740757222100123768721944747209349312324107065080618562372526732540733324875754482967573450019321902199119960797989373383673242576103938985349278777473980508080015544764061053522202325409443567718794565430406735896491017610775948364540823486130254718476485189575836674399791508512858020607820554462991723202028222914886959399729974297471155371858924238493855858595407438104882624648788053304271463011941589896328792678327322456103852197011130466587100500083285177311776489735230926661234588873102883515626446023671996644554727608310118788389151149340939344750073025855814756190881398752357812331342279866503522725367171230756861045004548970360079569827626392344107146584895780241408158405229536937499710665594894459246286619963556350652623405339439142111271810691052290024657423604130093691889255865784668461215679554256605416005071276641766056874274200329577160643448606201239821698271723197826816628249938714995449137302051843669076723577400053932662622760323659751718925901801104290384274185507894887438832703063283279963007200698012244365116394086922220745320244624121155804354542064215121585056896157356414313068883443185280853975927734433655384188340303517822946253702015782157373265523185763554098954033236382319219892171177449469403678296185920803403867575834111518824177439145077366384071880489358256868542011645031357633355509440319236720348651010561049872726472131986543435450409131859513145181276437310438972507004981987052176272494065214619959232142314439776546708351714749367986186552791715824080651063799500184295938799158350171580759883784962257398512129810326379376218322456594236685376799113140108043139732335449090824910499143325843298821033984698141715756010829706583065211347076803680695322971990599904451209087275776225351040902392888779424630483280319132710495478599180196967835321464441189260631526618167443193550817081875477050802654025294109218264858213857526688155584113198560022135158887210365696087515063187533002942118682221893775546027227291290504292259787710667873840000616772154638441292371193521828499824350920891801685572798156421858191197490985730570332667646460728757430565372602768982373259745084479649545648030771598153955827779139373601717422996027353102768719449444917939785144631597314435351850491413941557329382048542123508173912549749819308714396615132942045919380106231421774199184060180347949887691051557905554806953878540066453375981862846419905220452803306263695626490910827627115903856995051246529996062855443838330327638599800792922846659503551211245284087516229060262011857775313747949362055496401073001348853150735487353905602908933526400713274732621960311773433943673385759124508149335736911664541281788171454023054750667136518258284898099512139193995633241336556777098003081910272040997148687418134667006094051021462690280449159646545330107754695413088714165312544813061192407821188690056027781824235022696189344352547633573536485619363254417756613981703930632872166905722259745209192917262199844409646158269456380239502837121686446561785235565164127712826918688615572716201474934052276946595712198314943381622114006936307430444173284786101777743837977037231795255434107223445512555589998646183876764903972461167959018100035098928641204195163551108763204267612979826529425882951141275841262732790798807559751851576841264742209479721843309352972665210015662514552994745127631550917636730259462132930190402837954246323258550301096706922720227074863419005438302650681214142135057154175057508639907673946335146209082888934938376439399256900604067311422093312195936202982972351163259386772241477911629572780752395056251581603133359382311500518626890530658368129988108663263271980611271548858798093487912913707498230575929091862939195014721197586067270092547718025750337730799397134539532646195269996596385654917590458333585799102012713204583903200853878881633637685182083727885131175227769609787962142372162545214591281831798216044111311671406914827170981015457781939202311563871950805024679725792497605772625913328559726371211201905720771409148645074094926718035815157571514050397610963846755569298970383547314100223802583468767350129775413279532060971154506484212185936490997917766874774481882870632315515865032898164228288232746866106592732197907162384642153489852476216789050260998045266483929542357287343977680495774091449538391575565485459058976495198513801007958010783759945775299196700547602252552034453988712538780171960718164078124847847257912407824544361682345239570689514272269750431873633263011103053423335821609333191218806608268341428910415173247216053355849993224548730778822905252324234861531520976938461042582849714963475341837562003014915703279685301868631572488401526639835689563634657435321783493199825542117308467745297085839507616458229630324424328237737450517028560698067889521768198156710781633405266759539424926280756968326107495323390536223090807081455919837355377748742029039018142937311529334644468151212945097596534306284215319445727118614900017650558177095302468875263250119705209476159416768727784472000192789137251841622857783792284439084301181121496366424659033634194540657183544771912446621259392656620306888520055599121235363718226922531781458792593750441448933981608657900876165024635197045828895481793756681046474614105142498870252139936870509372305447734112641354892806841059107716677821238332810262185587751312721179344448201440425745083063944738363793906283008973306241380614589414227694747931665717623182472168350678076487573420491557628217583972975134478990696589532548940335615613167403276472469212505759116251529654568544633498114317670257295661844775487469378464233737238981920662048511894378868224807279352022501796545343757274163910791972952950812942922205347717304184477915673991738418311710362524395716152714669005814700002633010452643547865903290733205468338872078735444762647925297690170912007874183736735087713376977683496344252419949951388315074877537433849458259765560996555954318040920178497184685497370696212088524377013853757681416632722412634423982152941645378000492507262765150789085071265997036708726692764308377229685985169122305037462744310852934305273078865283977335246017463527703205938179125396915621063637625882937571373840754406468964783100704580613446731271591194608435935825987782835266531151065041623295329047772174083559349723758552138048305090009646676088301540612824308740645594431853413755220166305812111033453120745086824339432159043594430312431227471385842030390106070940315235556172767994160020393975099897629335325855575624808996691829864222677502360193257974726742578211119734709402357457222271212526852384295874273501563660093188045493338989741571490544182559738080871565281430102670460284316819230392535297795765862414392701549740879273131051636119137577008929564823323648298263024607975875767745377160102490804624301856524161756655600160859121534556267602192689982855377872583145144082654583484409478463178777374794653580169960779405568701192328608041130904629350871827125934668712766694873899824598527786499569165464029458935064964335809824765965165142090986755203808309203230487342703468288751604071546653834619611223013759451579252696743642531927390036038608236450762698827497618723575476762889950752114804852527950845033958570838130476937881321123674281319487950228066320170022460331989671970649163741175854851878484012054844672588851401562725019821719066960812627785485964818369621410721714214986361918774754509650308957099470934337856981674465828267911940611956037845397855839240761276344105766751024307559814552786167815949657062559755074306521085301597908073343736079432866757890533483669555486803913433720156498834220893399971641479746938696905480089193067138057171505857307148815649920714086758259602876056459782423770242469805328056632787041926768467116266879463486950464507420219373945259262668613552940624781361206202636498199999498405143868285258956342264328707663299304891723400725471764188685351372332667877921738347541480022803392997357936152412755829569276837231234798989446274330454566790062032420516396282588443085438307201495672106460533238537203143242112607424485845094580494081820927639140008540422023556260218564348994145439950410980591817948882628052066441086319001688568155169229486203010738897181007709290590480749092427141018933542818429995988169660993836961644381528877214085268088757488293258735809905670755817017949161906114001908553744882726200936685604475596557476485674008177381703307380305476973609786543859382187220583902344443508867499866506040645874346005331827436296177862518081893144363251205107094690813586440519229512932450078833398788429339342435126343365204385812912834345297308652909783300671261798130316794385535726296998740359570458452230856390098913179475948752126397078375944861139451960286751210561638976008880092746115860800207803341591451797073036835196977766076373785333012024120112046988609209339085365773222392412449051532780950955866459477634482269986074813297302630975028812103517723124465095349653693090018637764094094349837313251321862080214809922685502948454661814715557444709669530177690434272031892770604717784527939160472281534379803539679861424370956683221491465438014593829277393396032754048009552231816667380357183932757077142046723838624617803976292377131209580789363841447929802588065522129262093623930637313496640186619510811583471173312025805866727639992763579078063818813069156366274125431259589936119647626101405563503399523140323113819656236327198961837254845333702062563464223952766943568376761368711962921818754576081617053031590728828700712313666308722754918661395773730546065997437810987649802414011242142773668082751390959313404155826266789510846776118665957660165998178089414985754976284387856100263796543178313634025135814161151902096499133548733131115022700681930135929595971640197196053625033558479980963488718039111612813595968565478868325856437896173159762002419621552896297904819822199462269487137462444729093456470028537694958859591606789282491054412515996300781368367490209374915732896270028656829344431342347351239298259166739503425995868970697267332582735903121288746660451461487850346142827765991608090398652575717263081833494441820193533385071292345774375579344062178711330063106003324053991693682603746176638565758877580201229366353270267100681261825172914608202541892885935244491070138206211553827793565296914576502048643282865557934707209634807372692141186895467322767751335690190153723669036865389161291688887876407525493494249733427181178892759931596719354758988097924525262363659036320070854440784544797348291802082044926670634420437555325050527522833778887040804033531923407685630109347772125639088640413101073817853338316038135280828119040832564401842053746792992622037698718018061122624490909242641985820861751177113789051609140381575003366424156095216328197122335023167422600567941281406217219641842705784328959802882335059828208196666249035857789940333152274817776952843681630088531769694783690580671064828083598046698841098135158654906933319522394363287923990534810987830274500172065433699066117784554364687723631844464768069142828004551074686645392805399409108754939166095731619715033166968309929466349142798780842257220697148875580637480308862995118473187124777291910070227588893486939456289515802965372150409603107761289831263589964893410247036036645058687287589051406841238124247386385427908282733827973326885504935874303160274749063129572349742611221517417153133618622410913869500688835898962349276317316478340077460886655598733382113829928776911495492184192087771606068472874673681886167507221017261103830671787856694812948785048943063086169948798703160515884108282351274153538513365895332948629494495061868514779105804696039069372662670386512905201137810858616188886947957607413585534585151768051973334433495230120395770739623771316030242887200537320998253008977618973129817881944671731160647231476248457551928732782825127182446807824215216469567819294098238926284943760248852279003620219386696482215628093605373178040863727268426696421929946819214908701707533361094791381804063287387593848269535583077395761447997270003472880182785281389503217986345216111066608839314053226944905455527867894417579202440021450780192099804461382547805858048442416404775031536054906591430078158372430123137511562284015838644270890718284816757527123846782459534334449622010096071051370608461801187543120725491334994247617115633321408934609156561550600317384218701570226103101916603887064661438897736318780940711527528174689576401581047016965247557740891644568677717158500583269943401677202156767724068128366565264122982439465133197359199709403275938502669557470231813203243716420586141033606524536939160050644953060161267822648942437397166717661231048975031885732165554988342121802846912529086101485527815277625623750456375769497734336846015607727035509629049392487088406281067943622418704747008368842671022558302403599841645951122485272633632645114017395248086194635840783753556885622317115520947223065437092606797351000565549381224575483728545711797393615756167641692895805257297522338558611388322171107362265816218842443178857488798109026653793426664216990914056536432249301334867988154886628665052346997235574738424830590423677143278792316422403877764330192600192284778313837632536121025336935812624086866699738275977365682227907215832478888642369346396164363308730139814211430306008730666164803678984091335926293402304324974926887831643602681011309570716141912830686577323532639653677390317661361315965553584999398600565155921936759977717933019744688148371103206503693192894521402650915465184309936553493337183425298433679915939417466223900389527673813330617747629574943868716978453767219493506590875711917720875477107189937960894774512654757501871194870738736785890200617373321075693302216320628432065671192096950585761173961632326217708945426214609858410237813215817727602222738133495410481003073275107799948991977963883530734443457532975914263768405442264784216063122769646967156473999043715903323906560726644116438605404838847161912109008701019130726071044114143241976796828547885524779476481802959736049439700479596040292746299203572099761950140348315380947714601056333446998820822120587281510729182971211917876424880354672316916541852256729234429187128163232596965413548589577133208339911288775917226115273379010341362085614577992398778325083550730199818459025958355989260553299673770491722454935329683300002230181517226575787524058832249085821280089747909326100762578770428656006996176212176845478996440705066241710213327486796237430229155358200780141165348065647488230615003392068983794766255036549822805329662862117930628430170492402301985719978948836897183043805182174419147660429752437251683435411217038631379411422095295885798060152938752753799030938871683572095760715221900279379292786303637268765822681241993384808166021603722154710143007377537792699069587121289288019052031601285861825494413353820784883465311632650407642428390870121015194231961652268422003711230464300673442064747718021353070124098860353399152667923871101706221865883573781210935179775604425634694999787251125440854522274810914874307259869602040275941178942581281882159952359658979181144077653354321757595255536158128001163846720319346507296807990793963714961774312119402021297573125165253768017359101557338153772001952444543620071848475663415407442328621060997613243487548847434539665981338717466093020535070271952983943271425371155766600025784423031073429551533945060486222764966687624079324353192992639253731076892135352572321080889819339168668278948281170472624501948409700975760920983724090074717973340788141825195842598096241747610138252643955135259311885045636264188300338539652435997416931322894719878308427600401368074703904097238473945834896186539790594118599310356168436869219485382055780395773881360679549900085123259442529724486666766834641402189915944565309423440650667851948417766779470472041958822043295380326310537494883122180391279678446100139726753892195119117836587662528083690053249004597410947068772912328214304635337283519953648274325833119144459017809607782883583730111857543659958982724531925310588115026307542571493943024453931870179923608166611305426253995833897942971602070338767815033010280120095997252222280801423571094760351925544434929986767817891045559063015953809761875920358937341978962358931125983902598310267193304189215109689156225069659119828323455503059081730735195503721665870288053992138576037035377105178021280129566841984140362872725623214428754302210909472721073474134975514190737043318276626177275996888826027225247133683353452816692779591328861381766349857728936900965749562287103024362590772412219094300871755692625758065709912016659622436080242870024547362036394841255954881727272473653467783647201918303998717627037515724649922289467932322693619177641614618795613956699567783068290316589699430767333508234990790624100202506134057344300695745474682175690441651540636584680463692621274211075399042188716127617787014258864825775223889184599523376292377915585744549477361295525952226578636462118377598473700347971408206994145580719080213590732269233100831759510659019121294795408603640757358750205890208704579670007055262505811420663907459215273309406823649441590891009220296680523325266198911311842016291631076894084723564366808182168657219688268358402785500782804043453710183651096951782335743030504852653738073531074185917705610397395062640355442275156101107261779370634723804990666922161971194259120445084641746383589938239946517395509000859479990136026674261494290066467115067175422177038774507673563742154782905911012619157555870238957001405117822646989944917908301795475876760168094100135837613578591356924455647764464178667115391951357696104864922490083446715486383054477914330097680486878348184672733758436892724310447406807685278625585165092088263813233623148733336714764520450876627614950389949504809560460989604329123358348859990294526400284994280878624039811814884767301216754161106629995553668193123287425702063738352020086863691311733469731741219153633246745325630871347302792174956227014687325867891734558379964351358800959350877556356248810493852999007675135513527792412429277488565888566513247302514710210575352516511814850902750476845518252096331899068527614435138213662152368890578786699432288816028377482035506016029894009119713850179871683633744139275973644017007014763706655703504338121113576415018451821413619823495159601064752712575935185304332875537783057509567425442684712219618709178560783936144511383335649103256405733898667178123972237519316430617013859539474367843392670986712452211189690840236327411496601243483098929941738030588417166613073040067588380432111555379440605497721705942821514886165672771240903387727745629097110134885184374118695655449745736845218066982911045058004299887953899027804383596282409421860556287788428802127553884803728640019441614257499904272009595204654170598104989967504511936471172772220436102614079750809686975176600237187748348016120310234680567112644766123747627852190241202569943534716226660893675219833111813511146503854895025120655772636145473604426859498074396932331297127377157347099713952291182653485155587137336629120242714302503763269501350911612952993785864681307226486008270881333538193703682598867893321238327053297625857382790097826460545598555131836688844628265133798491667839409761353766251798258249663458771950124384040359140849209733754642474488176184070023569580177410177696925077814893386672557898564589851056891960924398841569280696983352240225634570497312245269354193837004843183357196516626721575524193401933099018319309196582920969656247667683659647019595754739345514337413708761517323677204227385674279170698204549953095918872434939524094441678998846319845504852393662972079777452814399418256789457795712552426826089940863317371538896262889629402112108884427376568624527612130371017300785135715404533041507959447776143597437803742436646973247138410492124314138903579092416036406314038149831481905251720937103964026808994832572297954564042701757722904173234796073618787889913318305843069394825961318713816423467218730845133877219086975104942843769325024981656673816260615941768252509993741672883951744066932549653403101452225316189009235376486378482881344209870048096227171226407489571939002918573307460104360729190945767994614929290427981687729426487729952858434647775386906950148984133924540394144680263625402118614317031251117577642829914644533408920976961699098372652361768745605894704968170136974909523072082682887890730190018253425805343421705928713931737993142410852647390948284596418093614138475831136130576108462366837237695913492615824516221552134879244145041756848064120636520170386330129532777699023118648020067556905682295016354931992305914246396217025329747573114094220180199368035026495636955866425906762685687372110339156793839895765565193177883000241613539562437777840801748819373095020699900890899328088397430367736595524891300156633294077907139615464534088791510300651321934486673248275907946807879819425019582622320395131252014109960531260696555404248670549986786923021746989009547850725672978794769888831093487464426400718183160331655511534276155622405474473378049246214952133258527698847336269182649174338987824789278468918828054669982303689939783413747587025805716349413568433929396068192061773331791738208562436433635359863494496890781064019674074436583667071586924521182997893804077137501290858646578905771426833582768978554717687184427726120509266486102051535642840632368481807287940717127966820060727559555904040233178749447346454760628189541512139162918444297651066947969354016866010055196077687335396511614930937570968554559381513789569039251014953265628147011998326992200066392875374713135236421589265126204072887716578358405219646054105435443642166562244565042999010256586927279142752931172082793937751326106052881235373451068372939893580871243869385934389175713376300720319760816604464683937725806909237297523486702916910426369262090199605204121024077648190316014085863558427609537086558164273995349346546314504040199528537252004957805254656251154109252437991326262713609099402902262062836752132305065183934057450112099341464918433323646569371725914489324159006242020612885732926133596808726500045628284557574596592120530341310111827501306961509835515632004310784601906565493806542525229161991819959602752327702249855738824899882707465936355768582560518068964285376850772012220347920993936179268206590142165615925306737944568949070853263568196831861772268249911472615732035807646298116244013316737892788689229032593349861797021994981925739617673075834417098559222170171825712777534491508205278430904619460835217402005838672849709411023266953921445461066215006410674740207009189911951376466904481267253691537162290791385403937560077835153374167747942100384002308951850994548779039346122220865060160500351776264831611153325587705073541279249909859373473787081194253055121436979749914951860535920403830235716352727630874693219622190064260886183676103346002255477477813641012691906569686495012688376296907233961276287223041141813610060264044030035996988919945827397624114613744804059697062576764723766065541618574690527229238228275186799156983390747671146103022776606020061246876477728819096791613354019881402757992174167678799231603963569492851513633647219540611171767387372555728522940054361785176502307544693869307873499110352182532929726044553210797887711449898870911511237250604238753734841257086064069052058452122754533848008205302450456517669518576913200042816758054924811780519832646032445792829730129105318385636821206215531288668564956512613892261367064093953334570526986959692350353094224543865278677673027540402702246384483553239914751363441044050092330361271496081355490531539021002299595756583705381261965683144286057956696622154721695620870013727768536960840704833325132793112232507148630206951245395003735723346807094656483089209801534878705633491092366057554050864111521441481434630437273271045027768661953107858323334857840297160925215326092558932655600672124359464255065996771770388445396181632879614460817789272171836908880126778207430106422524634807454300476492885553409062185153654355474125476152769772667769772777058315801412185688011705028365275543214803488004442979998062157904564161957212784508928489806426497427090579129069217807298769477975112447305991406050629946894280931034216416629935614828130998870745292716048433630818404126469637925843094185442216359084576146078558562473814931427078266215185541603870206876980461747400808324343665382354555109449498431093494759944672673665352517662706772194183191977196378015702169933675083760057163454643671776723387588643405644871566964321041282595645349841388412890420682047007615596916843038999348366793542549210328113363184722592305554383058206941675629992013373175489122037230349072681068534454035993561823576312837767640631013125335212141994611869350833176587852047112364331226765129964171325217513553261867681942338790365468908001827135283584888444111761234101179918709236507184857856221021104009776994453121795022479578069506532965940383987369907240797679040826794007618729547835963492793904576973661643405359792219285870574957481696694062334272619733518136626063735982575552496509807260123668283605928341855848026958413772558970883789942910549800331113884603401939166122186696058491571485733568286149500019097591125218800396419762163559375743718011480559442298730418196808085647265713547612831629200449880315402105530597076666362749328308916880932359290081787411985738317192616728834918402429721290434965526942726402559641463525914348400675867690350382320572934132981593533044446496829441367323442158380761694831219333119819061096142952201536170298575105594326461468505452684975764807808009221335811378197749271768545075538328768874474591593731162470601091244609829424841287520224462594477638749491997840446829257360968534549843266536862844489365704111817793806441616531223600214918768769467398407517176307516849856359201486892943105940202457969622924566644881967576294349535326382171613395757790766370764569570259738800438415805894336137106551859987600754924187211714889295221737721146081154344982665479872580056674724051122007383459271575727715218589946948117940644466399432370044291140747218180224825837736017346685300744985564715420036123593397312914458591522887408719508708632218837288262822884631843717261903305777147651564143822306791847386039147683108141358275755853643597721650028277803713422869688787349795096031108899196143386664068450697420787700280509367203387232629637856038653216432348815557557018469089074647879122436375556668678067610544955017260791142930831285761254481944449473244819093795369008206384631678225064809531810406570254327604385703505922818919878065865412184299217273720955103242251079718077833042609086794273428955735559252723805511440438001239041687716445180226491681641927401106451622431101700056691121733189423400547959684669804298017362570406733282129962153684881404102194463424646220745575643960452985313071409084608499653767803793201899140865814662175319337665970114330608625009829566917638846056762972931464911493704624469351984039534449135141193667933301936617663652555149174982307987072280860859626112660504289296966535652516688885572112276802772743708917389639772257564890533401038855931125679991516589025016486961427207005916056166159702451989051832969278935550303934681219761582183980483960562523091462638447386296039848924386187298507775928792722068554807210497817653286210187476766897248841139560349480376727036316921007350834073865261684507482496448597428134936480372426116704266870831925040997615319076855770327421785010006441984124207396400139603601583810565928413684574119102736420274163723488214524101347716529603128408658419787951116511529827814620379139855006399960326591248525308493690313130100799977191362230866011099929142871249388541612038020411340188887219693477904497527454288072803509305828754420755134816660927879353566521255620139988249628478726214432362853676502591450468377635282587652139156480972141929675549384375582600253168536356731379262475878049445944183429172756988376226261846365452743497662411138451305481449836311789784489732076719508784158618879692955819733250699951402601511675529750575437810242238957925786562128432731202200716730574069286869363930186765958251326499145950260917069347519408975357464016830811798846452473618956056479426358070562563281189269663026479535951097127659136233180866921535788607812759910537171402204506186075374866306350591483916467656723205714516886170790984695932236724946737583099607042589220481550799132752088583781117685214269334786921895240622657921043620348852926267984013953216458791151579050460579710838983371864038024417511347226472547010794793996953554669619726763255229914654933499663234185951450360980344092212206712567698723427940708857070474293173329188523896721971353924492426178641188637790962814486917869468177591717150669111480020759432012061969637795103227089029566085562225452602610460736131368869009281721068198618553780982018471154163630326265699283424155023600978046417108525537612728905335045506135684143775854429677977014660294387687225115363801191758154028120818255606485410787933598921064427244898618961629413418001295130683638609294100083136673372153008352696235737175330738653338204842190308186449184093723944033405244909554558016406460761581010301767488475017661908692946098769201691202181688291040870709560951470416921147027413390052253340834812870353031023919699978597413908593605433599697075604460134242453682496098772581311024732798562072126572499003468293886872304895562253204463602639854225258416464324271611419817802482595563544907219226583863662663750835944314877635156145710745528016159677048442714194435183275698407552677926411261765250615965235457187956673170913319358761628255920783080185206890151504713340386100310055914817852110384754542933389188444120517943969970194112695119526564919594189975418393234647424290702718875223534393673633663200307232747037407123982562024662651974090199762452056198557625760008708173083288344381831070054514493545885422678578551915372292379555494333410174420169600090696415612732297770221217951868376359082255128816470021992348864043959153018464004714321186360622527011541122283802778538911098490201342741014121559769965438877197485376431158229838533123071751132961904559007938064276695819014842627991221792947987348901868471676503827328552059082984529806259250352128451925927986593506132961946796252373972565584157853744567558998032405492186962888490332560851455344391660226257775512916200772796852629387937530454181080729285891989715381797343496187232927614747850192611450413274873242970583408471112333746274617274626582415324271059322506255302314738759251724787322881491455915605036334575424233779160374952502493022351481961381162563911415610326844958072508273431765944054098269765269344579863479709743124498271933113863873159636361218623497261409556079920628316999420072054811525353393946076850019909886553861433495781650089961649079678142901148387645682174914075623767618453775144031475411206760160726460556859257799322070337333398916369504346690694828436629980037414527627716547623825546170883189810868806847853705536480469350958818025360529740793538676511195079373282083146268960071075175520614433784114549950136432446328193346389050936545714506900864483440180428363390513578157273973334537284263372174065775771079830517555721036795976901889958494130195999573017901240193908681356585539661941371794487632079868800371607303220547423572266896801882123424391885984168972277652194032493227314793669234004848976059037958094696041754279613782553781223947646147832926976545162290281701100437846038756544151739433960048915318817576650500951697402415644771293656614253949368884230517400129920556854289853897942669956777027089146513736892206104415481662156804219838476730871787590279209175900695273456682026513373111518000181434120962601658629821076663523361774007837783423709152644063054071807843358061072961105550020415131696373046849213356837265400307509829089364612047891114753037049893952833457824082817386441322710002968311940203323456420826473276233830294639378998375836554559919340866235090967961134004867027123176526663710778725111860354037554487418693519733656621772359229396776463251562023487570113795712096237723431370212031004965152111976013176419408203437348512852602913334915125083119802850177855710725373149139215709105130965059885999931560863655477403551898166733535880048214665099741433761182777723351910741217572841592580872591315074606025634903777263373914461377038021318347447301113032670296917335047701632106616227830027269283365584011791419447808748253360714403296252285775009808599609040936312635621328162071453406104224112083010008587264252112262480142647519426184325853386753874054743491072710049754281159466017136122590440158991600229827801796035194080046513534752698777609527839984368086908989197839693532179980139135442552717910225397010810632143048511378291498511381969143043497500189980681644412123273328307192824362406733196554692677851193152775113446468905504248113361434984604849051258345683266441528489713972376040328212660253516693914082049947320486021627759791771234751097502403078935759937715095021751693555827072533911892334070223832077585802137174778378778391015234132098489423459613692340497998279304144463162707214796117456975719681239291913740982925805561955207434243295982898980529233366415419256367380689494201471241340525072204061794355252555225008748790086568314542835167750542294803274783044056438581591952666758282929705226127628711040134801787224801789684052407924360582742467443076721645270313451354167649668901274786801010295133862698649748212118629040337691568576240699296372493097201628707200189835423690364149270236961938547372480329855045112089192879829874467864129159417531675602533435310626745254507114181483239880607297140234725520713490798398982355268723950909365667878992383712578976248755990443228895388377317348941122757071410959790047919301046740750411435381782464630795989555638991884773781341347070246747362112048986226991888517456251732519341352038115863350123913054441910073628447567514161050410973505852762044489190978901984315485280533985777844313933883994310444465669244550885946314081751220331390681596592510546858013133838152176418210433429788826119630443111388796258746090226130900849975430395771243230616906262919403921439740270894777663702488155499322458825979020631257436910946393252806241642476868495455324938017639371615636847859823715902385421265840615367228607131702674740131145261063765383390315921943469817605358380310612887852051546933639241088467632009567089718367490578163085158138161966882222047570437590614338040725853862083565176998426774523195824182683698270160237414938363496629351576854061397342746470899685618170160551104880971554859118617189668025973541705423985135560018720335079060946421271143993196046527424050882225359773481519135438571253258540493946010865793798058620143366078825219717809025817370870916460452727977153509910340736425020386386718220522879694458387652947951048660717390229327455426785669776865939923416834122274663015062155320502655341460995249356050854921756549134830958906536175693817637473644183378974229700703545206663170929607591989627732423090252397443861014263098687733913882518684316501027964911497737582888913450341148865948670215492101084328080783428089417298008983297536940644969903125399863919581601468995220880662285408414864274786281975546629278814621607171381880180840572084715868906836919393381864278454537956719272397972364651667592011057995663962598535512763558768140213409829016296873429850792471846056874828331381259161962476156902875901072733103299140623864608333378638257926302391590003557609032477281338887339178096966601469615031754226751125993315529674213336300222964906480934582008181061802100227664580400278213336758573019011371754672763059044353131319036092489097246427928455549913490005180295707082919052556781889913899625138662319380053611346224294610248954072404857123256628888931722116432947816190554868054943441034090680716088028227959686950133643814268252170472870863010137301155236861416908375675747637239763185757038109443390564564468524183028148107998376918512127201935044041804604721626939445788377090105974693219720558114078775989772072009689382249303236830515862657281114637996983137517937623215111252349734305240622105244234353732905655163406669506165892878218707756794176080712973781335187117931650033155523822487730653444179453415395202424449703410120874072188109388268167512042299404948179449472732894770111574139441228455521828424922240658752689172272780607116754046973008037039618787796694882555614674384392570115829546661358678671897661297311267200072971553613027503556167817765442287442114729881614802705243806817653573275578602505847084013208837932816008769081300492491473682517035382219619039014999523495387105997351143478292339499187936608692301375596368532373806703591144243268561512109404259582639301678017128669239283231057658851714020211196957064799814031505633045141564414623163763809904402816256917576489142569714163598439317433270237812336938043012892626375382667795034169334323607500248175741808750388475094939454896209740485442635637164995949920980884294790363666297526003243856352945844728944547166209297495496616877414120882130477022816116456044007236351581149729739218966737382647204722642221242016560150284971306332795814302516013694825567014780935790889657134926158161346901806965089556310121218491805847922720691871696316330044858020102860657858591269974637661741463934159569539554203314628026518951167938074573315759846086173702687867602943677780500244673391332431669880354073232388281847501051641331189537036488422690270478052742490603492082954755054003457160184072574536938145531175354210726557835615499874447480427323457880061873149341566046352979779455075359304795687209316724536547208381685855606043801977030764246083489876101345709394877002946175792061952549255757109038525171488525265671045349813419803390641529876343695420256080277614421914318921393908834543131769685101840103844472348948869520981943531906506555354617335814045544837884752526253949665869992058417652780125341033896469818642430034146791380619028059607854888010789705516946215228773090104467462497979992627120951684779568482583341402266477210843362437593741610536734041954738964197895425335036301861400951534766961476255651873823292468547356935802896011536791787303553159378363082248615177770541577576561759358512016692943111138863582159667618830326104164651714846979385422621687161400122378213779774131268977266712992025922017408770076956283473932201088159356286281928563571893384958850603853158179760679479840878360975960149733420572704603521790605647603285569276273495182203236144112584182426247712012035776388895974318232827871314608053533574494297621796789034568169889553518504478325616380709476951699086247100019748809205009521943632378719764870339223811540363475488626845956159755193765410115014067001226927474393888589943859730245414801061235908036274585288493563251585384383242493252666087588908318700709100237377106576985056433928854337658342596750653715005333514489908293887737352051459333049626531415141386124437935885070944688045486975358170212908490787347806814366323322819415827345671356443171537967818058195852464840084032909981943781718177302317003989733050495387356116261023999433259780126893432605584710278764901070923443884634011735556865903585244919370181041626208504299258697435817098133894045934471937493877624232409852832762266604942385129709453245586252103600829286649724174919141988966129558076770979594795306013119159011773943104209049079424448868513086844493705909026006120649425744710353547657859242708130410618546219881830090634588187038755856274911587375421064667951346487586771543838018521348281915812462599335160198935595167968932852205824799421034512715877163345222995418839680448835529753361286837225935390079201666941339091168758803988828869216002373257361588207163516271332810518187602104852180675526648673908900907195138058626735124312215691637902277328705410842037841525683288718046987952513073266340278519059417338920358540395677035611329354482585628287610610698229721420961993509331312171187891078766872044548876089410174798647137882462153955933333275562009439580434537919782280590395959927436913793778664940964048777841748336432684026282932406260081908081804390914556351936856063045089142289645219987798849347477729132797266027658401667890136490508741142126861969862044126965282981087045479861559545338021201155646979976785738920186243599326777689454060508218838227909833627167124490026761178498264377033002081844590009717235204331994708242098771514449751017055643029542821819670009202515615844174205933658148134902693111517093872260026458630561325605792560927332265579346280805683443921373688405650434307396574061017779370141424615493070741360805442100295600095663588977899267630517718781943706761498217564186590116160865408635391513039201316805769034172596453692350806417446562351523929050409479953184074862151210561833854566176652606393713658802521666223576132201941701372664966073252010771947931265282763302413805164907174565964853748354669194523580315301969160480994606814904037819829732360930087135760798621425422096419004367905479049930078372421581954535418371129368658430553842717628035279128821129308351575656599944741788438381565148434229858704245592434693295232821803508333726283791830216591836181554217157448465778420134329982594566884558266171979012180849480332448787258183774805522268151011371745368417870280274452442905474518234674919564188551244421337783521423865979925988203287085109338386829906571994614906290257427686038850511032638544540419184958866538545040571323629681069146814847869659166861842756798460041868762298055562963045953227923051616721591968675849523635298935788507746081537321454642984792310511676357749494622952569497660359473962430995343310404994209677883827002714478494069037073249106444151696053256560586778757417472110827435774315194060757983563629143326397812218946287447798119807225646714664054850131009656786314880090303749338875364183165134982546694673316118123364854397649325026179549357204305402182974871251107404011611405899911093062492312813116340549262571356721818628932786138833718028535056503591952741400869510926167541476792668032109237467087213606278332922386413619594121339278036118276324106004740971111048140003623342714514483334641675466354699731494756643423659493496845884551524150756376605086632827424794136062876041290644913828519456402643153225858624043141838669590633245063000392213192647625962691510904457695301444054618037857503036686212462278639752746667870121003392984873375014475600322100622358029343774955032037012738468163061026570300872275462966796880890587127676361066225722352229739206443093524327228100859973095132528630601105497915644791845004618046762408928925680912930592960642357021061524646205023248966593987324933967376952023991760898474571843531936646529125848064480196520162838795189499336759241485626136995945307287254532463291529110128763770605570609531377527751867923292134955245133089867969165129073841302167573238637575820080363575728002754490327953079900799442541108725693188014667935595834676432868876966610097395749967836593397846346959948950610490383647409504695226063858046758073069912290474089879166872117147527644711604401952718169508289733537148530928937046384420893299771125856840846608339934045689026787516008775461267988015465856522061210953490796707365539702576199431376639960606061106406959330828171876426043573425361756943784848495250108266488395159700490598380812105221111091943323951136051446459834210799058082093716464523127704023160072138543723461267260997870385657091998507595634613248460188409850194287687902268734556500519121546544063829253851276317663922050938345204300773017029940362615434001322763910912988327863920412300445551684054889809080779174636092439334912641164240093880746356607262336695842764583698268734815881961058571835767462009650526065929263548291499045768307210893245857073701660717398194485028842603963660746031184786225831056580870870305567595861341700745402965687634774176431051751036732869245558582082372038601781739405175130437994868822320044378043103170921034261674998000073016094814586374488778522273076330495383944345382770608760763542098445008306247630253572781032783461766970544287155315340016497076657195985041748199087201490875686037783591994719343352772947285537925787684832301101859365800717291186967617655053775030293033830706448912811412025506150896411007623824574488655182581058140345320124754723269087547507078577659732542844459353044992070014538748948226556442223696365544194225441338212225477497535494624827680533336983284156138692363443358553868471111430498248398991803165458638289353799130535222833430137953372954016257623228081138499491876144141322933767106563492528814528239506209022357876684650116660097382753660405446941653422239052108314585847035529352219928272760574821266065291385530345549744551470344939486863429459658431024190785923680224560763936784166270518555178702904073557304620639692453307795782245949710420188043000183881429008173039450507342787013124466860092778581811040911511729374873627887874907465285565434748886831064110051023020875107768918781525622735251550379532444857787277617001964853703555167655209119339343762866284619844026295252183678522367475108809781507098978413086245881522660963551401874495836926917799047120726494905737264286005211403581231076006699518536124862746756375896225299116496066876508261734178484789337295056739007878617925351440621045366250640463728815698232317500596261080921955211150859302955654967538862612972339914628358476048627627027309739202001432248707582337354915246085608210328882974183906478869923273691360048837436615223517058437705545210815513361262142911815615301758882573594892507108879262128641392443309383797333867806131795237315266773820858024701433527009243803266951742119507670884326346442749127558907746863582162166042741315170212458586056233631493164646913946562497471741958354218607748711057338458433689939645913740603382159352243594751626239188685307822821763983237306180204246560477527943104796189724299533029792497481684052893791044947004590864991872727345413508101983881864673609392571930511968645601855782450218231065889437986522432050677379966196955472440585922417953006820451795370043472451762893566770508490213107736625751697335527462302943031203596260953423574397249659211010657817826108745318874803187430823573699195156340957162700992444929749105489851519658664740148225106335367949737142510229341882585117371994499115097583746130105505064197721531929354875371191630262030328588658528480193509225875775597425276584011721342323648084027143356367542046375182552524944329657043861387865901965738802868401894087672816714137033661732650120578653915780703088714261519075001492576112927675193096728453971160213606303090542243966320674323582797889332324405779199278484633339777737655901870574806828678347965624146102899508487399692970750432753029972872297327934442988646412725348160603779707298299173029296308695801996312413304939350493325412355071054461182591141116454534710329881047844067780138077131465400099386306481266614330858206811395838319169545558259426895769841428893743467084107946318932539106963955780706021245974898293564613560788983472419979478564362042094613412387613198865352358312996862268948608408456655606876954501274486631405054735351746873009806322780468912246821460806727627708402402266155485024008952891657117617439020337584877842911289623247059191874691042005848326140677333751027195653994697162517248312230633919328707983800748485726516123434933273356664473358556430235280883924348278760886164943289399166399210488307847777048045728491456303353265070029588906265915498509407972767567129795010098229476228961891591441520032283878773485130979081019129267227103778898053964156362364169154985768408398468861684375407065121039062506128107663799047908879674778069738473170475253442156390387201238806323688037017949308954900776331523063548374256816653361606641980030188287123767481898330246836371488309259283375902278942588060087286038859168849730693948020511221766359138251524278670094406942355120201568377778851824670025651708509249623747726813694284350062938814429987905301056217375459182679973217735029368928065210025396268807498092643458011655715886700443503976505323478287327368840863540002740676783821963522226539290939807367391364082898722017776747168118195856133721583119054682936083236976113450281757830202934845982925000895682630271263295866292147653142233351793093387951357095346377183684092444422096319331295620305575517340067973740614162107923633423805646850092037167152642556371853889571416419772387422610596667396997173168169415435095283193556417705668622215217991151355639707143312893657553844648326201206424338016955862698561022460646069330793847858814367407000599769703649019273328826135329363112403650698652160638987250267238087403396744397830258296894256896741864336134979475245526291426522842419243083388103580053787023999542172113686550275341362211693140694669513186928102574795985605145005021715913317751609957865551981886193211282110709442287240442481153406055895958355815232012184605820563592699303478851132068626627588771446035996656108430725696500563064489187599466596772847171539573612108180841547273142661748933134174632662354222072600146012701206934639520564445543291662986660783089068118790090815295063626782075614388815781351134695366303878412092346942868730839320432333872775496805210302821544324723388845215343727250128589747691460808314404125868181540049187772287869801853454537006526655649170915429522756709222217474112062720656622989806032891672068743654948246108697367225547404812889242471854323605753411672850757552057131156697954584887398742228135887985840783135060548290551482785294891121905383195624228719484759407859398047901094194070671764439032730712135887385049993638838205501683402777496070276844880281912220636888636811043569529300652195528261526991271637277388418993287130563464688227398288763198645709836308917786487086676185485680047672552675414742851028145807403152992197814557756843681110185317498167016426647884090262682824448258027532094549915104518517716546311804904567985713257528117913656278158111288816562285876030875974963849435275676612168959261485030785362045274507752950631012480341804584059432926079854435620093708091821523920371790678121992280496069738238743312626730306795943960954957189577217915597300588693646845576676092450906088202212235719254536715191834872587423919410890444115959932760044506556206461164655665487594247369252336955993030355095817626176231849561906494839673002037763874369343999829430209147073618947932692762445186560239559053705128978163455423320114975994896278424327483788032701418676952621180975006405149755889650293004867605208010491537885413909424531691719987628941277221129464568294860281493181560249677887949813777216229359437811004448060797672429276249510784153446429150842764520002042769470698041775832209097020291657347251582904630910359037842977572651720877244740952267166306005469716387943171196873484688738186656751279298575016363411314627530499019135646823804329970695770150789337728658035712790913767420805655493624646 diff --git a/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader.go b/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader.go deleted file mode 100644 index 816f1bf6bd06e73dd24b781a2af8839fb08e25b9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package zlib implements reading and writing of zlib format compressed data, -as specified in RFC 1950. - -The implementation provides filters that uncompress during reading -and compress during writing. For example, to write compressed data -to a buffer: - - var b bytes.Buffer - w := zlib.NewWriter(&b) - w.Write([]byte("hello, world\n")) - w.Close() - -and to read that data back: - - r, err := zlib.NewReader(&b) - io.Copy(os.Stdout, r) - r.Close() -*/ -package zlib - -import ( - "bufio" - "compress/flate" - "errors" - "hash" - "hash/adler32" - "io" -) - -const zlibDeflate = 8 - -var ( - // ErrChecksum is returned when reading ZLIB data that has an invalid checksum. - ErrChecksum = errors.New("zlib: invalid checksum") - // ErrDictionary is returned when reading ZLIB data that has an invalid dictionary. - ErrDictionary = errors.New("zlib: invalid dictionary") - // ErrHeader is returned when reading ZLIB data that has an invalid header. - ErrHeader = errors.New("zlib: invalid header") -) - -type reader struct { - r flate.Reader - decompressor io.ReadCloser - digest hash.Hash32 - err error - scratch [4]byte -} - -// Resetter resets a ReadCloser returned by NewReader or NewReaderDict to -// to switch to a new underlying Reader. This permits reusing a ReadCloser -// instead of allocating a new one. -type Resetter interface { - // Reset discards any buffered data and resets the Resetter as if it was - // newly initialized with the given reader. - Reset(r io.Reader, dict []byte) error -} - -// NewReader creates a new ReadCloser. -// Reads from the returned ReadCloser read and decompress data from r. -// The implementation buffers input and may read more data than necessary from r. -// It is the caller's responsibility to call Close on the ReadCloser when done. -// -// The ReadCloser returned by NewReader also implements Resetter. -func NewReader(r io.Reader) (io.ReadCloser, error) { - return NewReaderDict(r, nil) -} - -// NewReaderDict is like NewReader but uses a preset dictionary. -// NewReaderDict ignores the dictionary if the compressed data does not refer to it. -// If the compressed data refers to a different dictionary, NewReaderDict returns ErrDictionary. -// -// The ReadCloser returned by NewReaderDict also implements Resetter. -func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, error) { - z := new(reader) - err := z.Reset(r, dict) - if err != nil { - return nil, err - } - return z, nil -} - -func (z *reader) Read(p []byte) (n int, err error) { - if z.err != nil { - return 0, z.err - } - if len(p) == 0 { - return 0, nil - } - - n, err = z.decompressor.Read(p) - z.digest.Write(p[0:n]) - if n != 0 || err != io.EOF { - z.err = err - return - } - - // Finished file; check checksum. - if _, err := io.ReadFull(z.r, z.scratch[0:4]); err != nil { - z.err = err - return 0, err - } - // ZLIB (RFC 1950) is big-endian, unlike GZIP (RFC 1952). - checksum := uint32(z.scratch[0])<<24 | uint32(z.scratch[1])<<16 | uint32(z.scratch[2])<<8 | uint32(z.scratch[3]) - if checksum != z.digest.Sum32() { - z.err = ErrChecksum - return 0, z.err - } - return -} - -// Calling Close does not close the wrapped io.Reader originally passed to NewReader. -func (z *reader) Close() error { - if z.err != nil { - return z.err - } - z.err = z.decompressor.Close() - return z.err -} - -func (z *reader) Reset(r io.Reader, dict []byte) error { - if fr, ok := r.(flate.Reader); ok { - z.r = fr - } else { - z.r = bufio.NewReader(r) - } - _, err := io.ReadFull(z.r, z.scratch[0:2]) - if err != nil { - return err - } - h := uint(z.scratch[0])<<8 | uint(z.scratch[1]) - if (z.scratch[0]&0x0f != zlibDeflate) || (h%31 != 0) { - return ErrHeader - } - haveDict := z.scratch[1]&0x20 != 0 - if haveDict { - _, err = io.ReadFull(z.r, z.scratch[0:4]) - if err != nil { - return err - } - checksum := uint32(z.scratch[0])<<24 | uint32(z.scratch[1])<<16 | uint32(z.scratch[2])<<8 | uint32(z.scratch[3]) - if checksum != adler32.Checksum(dict) { - return ErrDictionary - } - } - if z.decompressor == nil { - if haveDict { - z.decompressor = flate.NewReaderDict(z.r, dict) - } else { - z.decompressor = flate.NewReader(z.r) - } - } else { - z.decompressor.(flate.Resetter).Reset(z.r, dict) - } - z.digest = adler32.New() - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader_test.go b/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader_test.go deleted file mode 100644 index 218ccba14110fcdcd0a64a778891c377d454284b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/zlib/reader_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zlib - -import ( - "bytes" - "io" - "testing" -) - -type zlibTest struct { - desc string - raw string - compressed []byte - dict []byte - err error -} - -// Compare-to-golden test data was generated by the ZLIB example program at -// http://www.zlib.net/zpipe.c - -var zlibTests = []zlibTest{ - { - "empty", - "", - []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01}, - nil, - nil, - }, - { - "goodbye", - "goodbye, world", - []byte{ - 0x78, 0x9c, 0x4b, 0xcf, 0xcf, 0x4f, 0x49, 0xaa, - 0x4c, 0xd5, 0x51, 0x28, 0xcf, 0x2f, 0xca, 0x49, - 0x01, 0x00, 0x28, 0xa5, 0x05, 0x5e, - }, - nil, - nil, - }, - { - "bad header", - "", - []byte{0x78, 0x9f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01}, - nil, - ErrHeader, - }, - { - "bad checksum", - "", - []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0xff}, - nil, - ErrChecksum, - }, - { - "not enough data", - "", - []byte{0x78, 0x9c, 0x03, 0x00, 0x00, 0x00}, - nil, - io.ErrUnexpectedEOF, - }, - { - "excess data is silently ignored", - "", - []byte{ - 0x78, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x78, 0x9c, 0xff, - }, - nil, - nil, - }, - { - "dictionary", - "Hello, World!\n", - []byte{ - 0x78, 0xbb, 0x1c, 0x32, 0x04, 0x27, 0xf3, 0x00, - 0xb1, 0x75, 0x20, 0x1c, 0x45, 0x2e, 0x00, 0x24, - 0x12, 0x04, 0x74, - }, - []byte{ - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x0a, - }, - nil, - }, - { - "wrong dictionary", - "", - []byte{ - 0x78, 0xbb, 0x1c, 0x32, 0x04, 0x27, 0xf3, 0x00, - 0xb1, 0x75, 0x20, 0x1c, 0x45, 0x2e, 0x00, 0x24, - 0x12, 0x04, 0x74, - }, - []byte{ - 0x48, 0x65, 0x6c, 0x6c, - }, - ErrDictionary, - }, -} - -func TestDecompressor(t *testing.T) { - b := new(bytes.Buffer) - for _, tt := range zlibTests { - in := bytes.NewReader(tt.compressed) - zlib, err := NewReaderDict(in, tt.dict) - if err != nil { - if err != tt.err { - t.Errorf("%s: NewReader: %s", tt.desc, err) - } - continue - } - defer zlib.Close() - b.Reset() - n, err := io.Copy(b, zlib) - if err != nil { - if err != tt.err { - t.Errorf("%s: io.Copy: %v want %v", tt.desc, err, tt.err) - } - continue - } - s := b.String() - if s != tt.raw { - t.Errorf("%s: got %d-byte %q want %d-byte %q", tt.desc, n, s, len(tt.raw), tt.raw) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer.go b/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer.go deleted file mode 100644 index 3b4313a8beaf56268629dc09664c4a3d3bcc3208..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer.go +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zlib - -import ( - "compress/flate" - "fmt" - "hash" - "hash/adler32" - "io" -) - -// These constants are copied from the flate package, so that code that imports -// "compress/zlib" does not also have to import "compress/flate". -const ( - NoCompression = flate.NoCompression - BestSpeed = flate.BestSpeed - BestCompression = flate.BestCompression - DefaultCompression = flate.DefaultCompression -) - -// A Writer takes data written to it and writes the compressed -// form of that data to an underlying writer (see NewWriter). -type Writer struct { - w io.Writer - level int - dict []byte - compressor *flate.Writer - digest hash.Hash32 - err error - scratch [4]byte - wroteHeader bool -} - -// NewWriter creates a new Writer. -// Writes to the returned Writer are compressed and written to w. -// -// It is the caller's responsibility to call Close on the WriteCloser when done. -// Writes may be buffered and not flushed until Close. -func NewWriter(w io.Writer) *Writer { - z, _ := NewWriterLevelDict(w, DefaultCompression, nil) - return z -} - -// NewWriterLevel is like NewWriter but specifies the compression level instead -// of assuming DefaultCompression. -// -// The compression level can be DefaultCompression, NoCompression, or any -// integer value between BestSpeed and BestCompression inclusive. The error -// returned will be nil if the level is valid. -func NewWriterLevel(w io.Writer, level int) (*Writer, error) { - return NewWriterLevelDict(w, level, nil) -} - -// NewWriterLevelDict is like NewWriterLevel but specifies a dictionary to -// compress with. -// -// The dictionary may be nil. If not, its contents should not be modified until -// the Writer is closed. -func NewWriterLevelDict(w io.Writer, level int, dict []byte) (*Writer, error) { - if level < DefaultCompression || level > BestCompression { - return nil, fmt.Errorf("zlib: invalid compression level: %d", level) - } - return &Writer{ - w: w, - level: level, - dict: dict, - }, nil -} - -// Reset clears the state of the Writer z such that it is equivalent to its -// initial state from NewWriterLevel or NewWriterLevelDict, but instead writing -// to w. -func (z *Writer) Reset(w io.Writer) { - z.w = w - // z.level and z.dict left unchanged. - if z.compressor != nil { - z.compressor.Reset(w) - } - if z.digest != nil { - z.digest.Reset() - } - z.err = nil - z.scratch = [4]byte{} - z.wroteHeader = false -} - -// writeHeader writes the ZLIB header. -func (z *Writer) writeHeader() (err error) { - z.wroteHeader = true - // ZLIB has a two-byte header (as documented in RFC 1950). - // The first four bits is the CINFO (compression info), which is 7 for the default deflate window size. - // The next four bits is the CM (compression method), which is 8 for deflate. - z.scratch[0] = 0x78 - // The next two bits is the FLEVEL (compression level). The four values are: - // 0=fastest, 1=fast, 2=default, 3=best. - // The next bit, FDICT, is set if a dictionary is given. - // The final five FCHECK bits form a mod-31 checksum. - switch z.level { - case 0, 1: - z.scratch[1] = 0 << 6 - case 2, 3, 4, 5: - z.scratch[1] = 1 << 6 - case 6, -1: - z.scratch[1] = 2 << 6 - case 7, 8, 9: - z.scratch[1] = 3 << 6 - default: - panic("unreachable") - } - if z.dict != nil { - z.scratch[1] |= 1 << 5 - } - z.scratch[1] += uint8(31 - (uint16(z.scratch[0])<<8+uint16(z.scratch[1]))%31) - if _, err = z.w.Write(z.scratch[0:2]); err != nil { - return err - } - if z.dict != nil { - // The next four bytes are the Adler-32 checksum of the dictionary. - checksum := adler32.Checksum(z.dict) - z.scratch[0] = uint8(checksum >> 24) - z.scratch[1] = uint8(checksum >> 16) - z.scratch[2] = uint8(checksum >> 8) - z.scratch[3] = uint8(checksum >> 0) - if _, err = z.w.Write(z.scratch[0:4]); err != nil { - return err - } - } - if z.compressor == nil { - // Initialize deflater unless the Writer is being reused - // after a Reset call. - z.compressor, err = flate.NewWriterDict(z.w, z.level, z.dict) - if err != nil { - return err - } - z.digest = adler32.New() - } - return nil -} - -// Write writes a compressed form of p to the underlying io.Writer. The -// compressed bytes are not necessarily flushed until the Writer is closed or -// explicitly flushed. -func (z *Writer) Write(p []byte) (n int, err error) { - if !z.wroteHeader { - z.err = z.writeHeader() - } - if z.err != nil { - return 0, z.err - } - if len(p) == 0 { - return 0, nil - } - n, err = z.compressor.Write(p) - if err != nil { - z.err = err - return - } - z.digest.Write(p) - return -} - -// Flush flushes the Writer to its underlying io.Writer. -func (z *Writer) Flush() error { - if !z.wroteHeader { - z.err = z.writeHeader() - } - if z.err != nil { - return z.err - } - z.err = z.compressor.Flush() - return z.err -} - -// Close closes the Writer, flushing any unwritten data to the underlying -// io.Writer, but does not close the underlying io.Writer. -func (z *Writer) Close() error { - if !z.wroteHeader { - z.err = z.writeHeader() - } - if z.err != nil { - return z.err - } - z.err = z.compressor.Close() - if z.err != nil { - return z.err - } - checksum := z.digest.Sum32() - // ZLIB (RFC 1950) is big-endian, unlike GZIP (RFC 1952). - z.scratch[0] = uint8(checksum >> 24) - z.scratch[1] = uint8(checksum >> 16) - z.scratch[2] = uint8(checksum >> 8) - z.scratch[3] = uint8(checksum >> 0) - _, z.err = z.w.Write(z.scratch[0:4]) - return z.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer_test.go b/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer_test.go deleted file mode 100644 index 71ba81aaa764b5a471ae06a9b903692b4f3c1a1f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/compress/zlib/writer_test.go +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package zlib - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "testing" -) - -var filenames = []string{ - "../testdata/e.txt", - "../testdata/pi.txt", -} - -var data = []string{ - "test a reasonable sized string that can be compressed", -} - -// Tests that compressing and then decompressing the given file at the given compression level and dictionary -// yields equivalent bytes to the original file. -func testFileLevelDict(t *testing.T, fn string, level int, d string) { - // Read the file, as golden output. - golden, err := os.Open(fn) - if err != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err) - return - } - defer golden.Close() - b0, err0 := ioutil.ReadAll(golden) - if err0 != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err0) - return - } - testLevelDict(t, fn, b0, level, d) -} - -func testLevelDict(t *testing.T, fn string, b0 []byte, level int, d string) { - // Make dictionary, if given. - var dict []byte - if d != "" { - dict = []byte(d) - } - - // Push data through a pipe that compresses at the write end, and decompresses at the read end. - piper, pipew := io.Pipe() - defer piper.Close() - go func() { - defer pipew.Close() - zlibw, err := NewWriterLevelDict(pipew, level, dict) - if err != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err) - return - } - defer zlibw.Close() - _, err = zlibw.Write(b0) - if err != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err) - return - } - }() - zlibr, err := NewReaderDict(piper, dict) - if err != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err) - return - } - defer zlibr.Close() - - // Compare the decompressed data. - b1, err1 := ioutil.ReadAll(zlibr) - if err1 != nil { - t.Errorf("%s (level=%d, dict=%q): %v", fn, level, d, err1) - return - } - if len(b0) != len(b1) { - t.Errorf("%s (level=%d, dict=%q): length mismatch %d versus %d", fn, level, d, len(b0), len(b1)) - return - } - for i := 0; i < len(b0); i++ { - if b0[i] != b1[i] { - t.Errorf("%s (level=%d, dict=%q): mismatch at %d, 0x%02x versus 0x%02x\n", fn, level, d, i, b0[i], b1[i]) - return - } - } -} - -func testFileLevelDictReset(t *testing.T, fn string, level int, dict []byte) { - var b0 []byte - var err error - if fn != "" { - b0, err = ioutil.ReadFile(fn) - if err != nil { - t.Errorf("%s (level=%d): %v", fn, level, err) - return - } - } - - // Compress once. - buf := new(bytes.Buffer) - var zlibw *Writer - if dict == nil { - zlibw, err = NewWriterLevel(buf, level) - } else { - zlibw, err = NewWriterLevelDict(buf, level, dict) - } - if err == nil { - _, err = zlibw.Write(b0) - } - if err == nil { - err = zlibw.Close() - } - if err != nil { - t.Errorf("%s (level=%d): %v", fn, level, err) - return - } - out := buf.String() - - // Reset and compress again. - buf2 := new(bytes.Buffer) - zlibw.Reset(buf2) - _, err = zlibw.Write(b0) - if err == nil { - err = zlibw.Close() - } - if err != nil { - t.Errorf("%s (level=%d): %v", fn, level, err) - return - } - out2 := buf2.String() - - if out2 != out { - t.Errorf("%s (level=%d): different output after reset (got %d bytes, expected %d", - fn, level, len(out2), len(out)) - } -} - -func TestWriter(t *testing.T) { - for i, s := range data { - b := []byte(s) - tag := fmt.Sprintf("#%d", i) - testLevelDict(t, tag, b, DefaultCompression, "") - testLevelDict(t, tag, b, NoCompression, "") - for level := BestSpeed; level <= BestCompression; level++ { - testLevelDict(t, tag, b, level, "") - } - } -} - -func TestWriterBig(t *testing.T) { - for _, fn := range filenames { - testFileLevelDict(t, fn, DefaultCompression, "") - testFileLevelDict(t, fn, NoCompression, "") - for level := BestSpeed; level <= BestCompression; level++ { - testFileLevelDict(t, fn, level, "") - } - } -} - -func TestWriterDict(t *testing.T) { - const dictionary = "0123456789." - for _, fn := range filenames { - testFileLevelDict(t, fn, DefaultCompression, dictionary) - testFileLevelDict(t, fn, NoCompression, dictionary) - for level := BestSpeed; level <= BestCompression; level++ { - testFileLevelDict(t, fn, level, dictionary) - } - } -} - -func TestWriterReset(t *testing.T) { - const dictionary = "0123456789." - for _, fn := range filenames { - testFileLevelDictReset(t, fn, NoCompression, nil) - testFileLevelDictReset(t, fn, DefaultCompression, nil) - testFileLevelDictReset(t, fn, NoCompression, []byte(dictionary)) - testFileLevelDictReset(t, fn, DefaultCompression, []byte(dictionary)) - if !testing.Short() { - for level := BestSpeed; level <= BestCompression; level++ { - testFileLevelDictReset(t, fn, level, nil) - } - } - } -} - -func TestWriterDictIsUsed(t *testing.T) { - var input = []byte("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.") - var buf bytes.Buffer - compressor, err := NewWriterLevelDict(&buf, BestCompression, input) - if err != nil { - t.Errorf("error in NewWriterLevelDict: %s", err) - return - } - compressor.Write(input) - compressor.Close() - const expectedMaxSize = 25 - output := buf.Bytes() - if len(output) > expectedMaxSize { - t.Errorf("result too large (got %d, want <= %d bytes). Is the dictionary being used?", len(output), expectedMaxSize) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/heap/heap.go b/llgo/third_party/gofrontend/libgo/go/container/heap/heap.go deleted file mode 100644 index c467a11910c9f5e395d30c75c7078fbdcf53c574..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/heap/heap.go +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package heap provides heap operations for any type that implements -// heap.Interface. A heap is a tree with the property that each node is the -// minimum-valued node in its subtree. -// -// The minimum element in the tree is the root, at index 0. -// -// A heap is a common way to implement a priority queue. To build a priority -// queue, implement the Heap interface with the (negative) priority as the -// ordering for the Less method, so Push adds items while Pop removes the -// highest-priority item from the queue. The Examples include such an -// implementation; the file example_pq_test.go has the complete source. -// -package heap - -import "sort" - -// Any type that implements heap.Interface may be used as a -// min-heap with the following invariants (established after -// Init has been called or if the data is empty or sorted): -// -// !h.Less(j, i) for 0 <= i < h.Len() and 2*i+1 <= j <= 2*i+2 and j < h.Len() -// -// Note that Push and Pop in this interface are for package heap's -// implementation to call. To add and remove things from the heap, -// use heap.Push and heap.Pop. -type Interface interface { - sort.Interface - Push(x interface{}) // add x as element Len() - Pop() interface{} // remove and return element Len() - 1. -} - -// A heap must be initialized before any of the heap operations -// can be used. Init is idempotent with respect to the heap invariants -// and may be called whenever the heap invariants may have been invalidated. -// Its complexity is O(n) where n = h.Len(). -// -func Init(h Interface) { - // heapify - n := h.Len() - for i := n/2 - 1; i >= 0; i-- { - down(h, i, n) - } -} - -// Push pushes the element x onto the heap. The complexity is -// O(log(n)) where n = h.Len(). -// -func Push(h Interface, x interface{}) { - h.Push(x) - up(h, h.Len()-1) -} - -// Pop removes the minimum element (according to Less) from the heap -// and returns it. The complexity is O(log(n)) where n = h.Len(). -// It is equivalent to Remove(h, 0). -// -func Pop(h Interface) interface{} { - n := h.Len() - 1 - h.Swap(0, n) - down(h, 0, n) - return h.Pop() -} - -// Remove removes the element at index i from the heap. -// The complexity is O(log(n)) where n = h.Len(). -// -func Remove(h Interface, i int) interface{} { - n := h.Len() - 1 - if n != i { - h.Swap(i, n) - down(h, i, n) - up(h, i) - } - return h.Pop() -} - -// Fix re-establishes the heap ordering after the element at index i has changed its value. -// Changing the value of the element at index i and then calling Fix is equivalent to, -// but less expensive than, calling Remove(h, i) followed by a Push of the new value. -// The complexity is O(log(n)) where n = h.Len(). -func Fix(h Interface, i int) { - down(h, i, h.Len()) - up(h, i) -} - -func up(h Interface, j int) { - for { - i := (j - 1) / 2 // parent - if i == j || !h.Less(j, i) { - break - } - h.Swap(i, j) - j = i - } -} - -func down(h Interface, i, n int) { - for { - j1 := 2*i + 1 - if j1 >= n || j1 < 0 { // j1 < 0 after int overflow - break - } - j := j1 // left child - if j2 := j1 + 1; j2 < n && !h.Less(j1, j2) { - j = j2 // = 2*i + 2 // right child - } - if !h.Less(j, i) { - break - } - h.Swap(i, j) - i = j - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/heap/heap_test.go b/llgo/third_party/gofrontend/libgo/go/container/heap/heap_test.go deleted file mode 100644 index b3d054c5f39783e3832ec3d68d15431caa9651a0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/heap/heap_test.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package heap - -import ( - "math/rand" - "testing" -) - -type myHeap []int - -func (h *myHeap) Less(i, j int) bool { - return (*h)[i] < (*h)[j] -} - -func (h *myHeap) Swap(i, j int) { - (*h)[i], (*h)[j] = (*h)[j], (*h)[i] -} - -func (h *myHeap) Len() int { - return len(*h) -} - -func (h *myHeap) Pop() (v interface{}) { - *h, v = (*h)[:h.Len()-1], (*h)[h.Len()-1] - return -} - -func (h *myHeap) Push(v interface{}) { - *h = append(*h, v.(int)) -} - -func (h myHeap) verify(t *testing.T, i int) { - n := h.Len() - j1 := 2*i + 1 - j2 := 2*i + 2 - if j1 < n { - if h.Less(j1, i) { - t.Errorf("heap invariant invalidated [%d] = %d > [%d] = %d", i, h[i], j1, h[j1]) - return - } - h.verify(t, j1) - } - if j2 < n { - if h.Less(j2, i) { - t.Errorf("heap invariant invalidated [%d] = %d > [%d] = %d", i, h[i], j1, h[j2]) - return - } - h.verify(t, j2) - } -} - -func TestInit0(t *testing.T) { - h := new(myHeap) - for i := 20; i > 0; i-- { - h.Push(0) // all elements are the same - } - Init(h) - h.verify(t, 0) - - for i := 1; h.Len() > 0; i++ { - x := Pop(h).(int) - h.verify(t, 0) - if x != 0 { - t.Errorf("%d.th pop got %d; want %d", i, x, 0) - } - } -} - -func TestInit1(t *testing.T) { - h := new(myHeap) - for i := 20; i > 0; i-- { - h.Push(i) // all elements are different - } - Init(h) - h.verify(t, 0) - - for i := 1; h.Len() > 0; i++ { - x := Pop(h).(int) - h.verify(t, 0) - if x != i { - t.Errorf("%d.th pop got %d; want %d", i, x, i) - } - } -} - -func Test(t *testing.T) { - h := new(myHeap) - h.verify(t, 0) - - for i := 20; i > 10; i-- { - h.Push(i) - } - Init(h) - h.verify(t, 0) - - for i := 10; i > 0; i-- { - Push(h, i) - h.verify(t, 0) - } - - for i := 1; h.Len() > 0; i++ { - x := Pop(h).(int) - if i < 20 { - Push(h, 20+i) - } - h.verify(t, 0) - if x != i { - t.Errorf("%d.th pop got %d; want %d", i, x, i) - } - } -} - -func TestRemove0(t *testing.T) { - h := new(myHeap) - for i := 0; i < 10; i++ { - h.Push(i) - } - h.verify(t, 0) - - for h.Len() > 0 { - i := h.Len() - 1 - x := Remove(h, i).(int) - if x != i { - t.Errorf("Remove(%d) got %d; want %d", i, x, i) - } - h.verify(t, 0) - } -} - -func TestRemove1(t *testing.T) { - h := new(myHeap) - for i := 0; i < 10; i++ { - h.Push(i) - } - h.verify(t, 0) - - for i := 0; h.Len() > 0; i++ { - x := Remove(h, 0).(int) - if x != i { - t.Errorf("Remove(0) got %d; want %d", x, i) - } - h.verify(t, 0) - } -} - -func TestRemove2(t *testing.T) { - N := 10 - - h := new(myHeap) - for i := 0; i < N; i++ { - h.Push(i) - } - h.verify(t, 0) - - m := make(map[int]bool) - for h.Len() > 0 { - m[Remove(h, (h.Len()-1)/2).(int)] = true - h.verify(t, 0) - } - - if len(m) != N { - t.Errorf("len(m) = %d; want %d", len(m), N) - } - for i := 0; i < len(m); i++ { - if !m[i] { - t.Errorf("m[%d] doesn't exist", i) - } - } -} - -func BenchmarkDup(b *testing.B) { - const n = 10000 - h := make(myHeap, n) - for i := 0; i < b.N; i++ { - for j := 0; j < n; j++ { - Push(&h, 0) // all elements are the same - } - for h.Len() > 0 { - Pop(&h) - } - } -} - -func TestFix(t *testing.T) { - h := new(myHeap) - h.verify(t, 0) - - for i := 200; i > 0; i -= 10 { - Push(h, i) - } - h.verify(t, 0) - - if (*h)[0] != 10 { - t.Fatalf("Expected head to be 10, was %d", (*h)[0]) - } - (*h)[0] = 210 - Fix(h, 0) - h.verify(t, 0) - - for i := 100; i > 0; i-- { - elem := rand.Intn(h.Len()) - if i&1 == 0 { - (*h)[elem] *= 2 - } else { - (*h)[elem] /= 2 - } - Fix(h, elem) - h.verify(t, 0) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/list/list.go b/llgo/third_party/gofrontend/libgo/go/container/list/list.go deleted file mode 100644 index 0256768efe58adab88c3a89a60946b606e6336a0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/list/list.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package list implements a doubly linked list. -// -// To iterate over a list (where l is a *List): -// for e := l.Front(); e != nil; e = e.Next() { -// // do something with e.Value -// } -// -package list - -// Element is an element of a linked list. -type Element struct { - // Next and previous pointers in the doubly-linked list of elements. - // To simplify the implementation, internally a list l is implemented - // as a ring, such that &l.root is both the next element of the last - // list element (l.Back()) and the previous element of the first list - // element (l.Front()). - next, prev *Element - - // The list to which this element belongs. - list *List - - // The value stored with this element. - Value interface{} -} - -// Next returns the next list element or nil. -func (e *Element) Next() *Element { - if p := e.next; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// Prev returns the previous list element or nil. -func (e *Element) Prev() *Element { - if p := e.prev; e.list != nil && p != &e.list.root { - return p - } - return nil -} - -// List represents a doubly linked list. -// The zero value for List is an empty list ready to use. -type List struct { - root Element // sentinel list element, only &root, root.prev, and root.next are used - len int // current list length excluding (this) sentinel element -} - -// Init initializes or clears list l. -func (l *List) Init() *List { - l.root.next = &l.root - l.root.prev = &l.root - l.len = 0 - return l -} - -// New returns an initialized list. -func New() *List { return new(List).Init() } - -// Len returns the number of elements of list l. -// The complexity is O(1). -func (l *List) Len() int { return l.len } - -// Front returns the first element of list l or nil. -func (l *List) Front() *Element { - if l.len == 0 { - return nil - } - return l.root.next -} - -// Back returns the last element of list l or nil. -func (l *List) Back() *Element { - if l.len == 0 { - return nil - } - return l.root.prev -} - -// lazyInit lazily initializes a zero List value. -func (l *List) lazyInit() { - if l.root.next == nil { - l.Init() - } -} - -// insert inserts e after at, increments l.len, and returns e. -func (l *List) insert(e, at *Element) *Element { - n := at.next - at.next = e - e.prev = at - e.next = n - n.prev = e - e.list = l - l.len++ - return e -} - -// insertValue is a convenience wrapper for insert(&Element{Value: v}, at). -func (l *List) insertValue(v interface{}, at *Element) *Element { - return l.insert(&Element{Value: v}, at) -} - -// remove removes e from its list, decrements l.len, and returns e. -func (l *List) remove(e *Element) *Element { - e.prev.next = e.next - e.next.prev = e.prev - e.next = nil // avoid memory leaks - e.prev = nil // avoid memory leaks - e.list = nil - l.len-- - return e -} - -// Remove removes e from l if e is an element of list l. -// It returns the element value e.Value. -func (l *List) Remove(e *Element) interface{} { - if e.list == l { - // if e.list == l, l must have been initialized when e was inserted - // in l or l == nil (e is a zero Element) and l.remove will crash - l.remove(e) - } - return e.Value -} - -// PushFront inserts a new element e with value v at the front of list l and returns e. -func (l *List) PushFront(v interface{}) *Element { - l.lazyInit() - return l.insertValue(v, &l.root) -} - -// PushBack inserts a new element e with value v at the back of list l and returns e. -func (l *List) PushBack(v interface{}) *Element { - l.lazyInit() - return l.insertValue(v, l.root.prev) -} - -// InsertBefore inserts a new element e with value v immediately before mark and returns e. -// If mark is not an element of l, the list is not modified. -func (l *List) InsertBefore(v interface{}, mark *Element) *Element { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark.prev) -} - -// InsertAfter inserts a new element e with value v immediately after mark and returns e. -// If mark is not an element of l, the list is not modified. -func (l *List) InsertAfter(v interface{}, mark *Element) *Element { - if mark.list != l { - return nil - } - // see comment in List.Remove about initialization of l - return l.insertValue(v, mark) -} - -// MoveToFront moves element e to the front of list l. -// If e is not an element of l, the list is not modified. -func (l *List) MoveToFront(e *Element) { - if e.list != l || l.root.next == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), &l.root) -} - -// MoveToBack moves element e to the back of list l. -// If e is not an element of l, the list is not modified. -func (l *List) MoveToBack(e *Element) { - if e.list != l || l.root.prev == e { - return - } - // see comment in List.Remove about initialization of l - l.insert(l.remove(e), l.root.prev) -} - -// MoveBefore moves element e to its new position before mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -func (l *List) MoveBefore(e, mark *Element) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark.prev) -} - -// MoveAfter moves element e to its new position after mark. -// If e or mark is not an element of l, or e == mark, the list is not modified. -func (l *List) MoveAfter(e, mark *Element) { - if e.list != l || e == mark || mark.list != l { - return - } - l.insert(l.remove(e), mark) -} - -// PushBackList inserts a copy of an other list at the back of list l. -// The lists l and other may be the same. -func (l *List) PushBackList(other *List) { - l.lazyInit() - for i, e := other.Len(), other.Front(); i > 0; i, e = i-1, e.Next() { - l.insertValue(e.Value, l.root.prev) - } -} - -// PushFrontList inserts a copy of an other list at the front of list l. -// The lists l and other may be the same. -func (l *List) PushFrontList(other *List) { - l.lazyInit() - for i, e := other.Len(), other.Back(); i > 0; i, e = i-1, e.Prev() { - l.insertValue(e.Value, &l.root) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/list/list_test.go b/llgo/third_party/gofrontend/libgo/go/container/list/list_test.go deleted file mode 100644 index 4d8bfc2bf0791bd6148420e374e306e1a0dd3beb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/list/list_test.go +++ /dev/null @@ -1,343 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package list - -import "testing" - -func checkListLen(t *testing.T, l *List, len int) bool { - if n := l.Len(); n != len { - t.Errorf("l.Len() = %d, want %d", n, len) - return false - } - return true -} - -func checkListPointers(t *testing.T, l *List, es []*Element) { - root := &l.root - - if !checkListLen(t, l, len(es)) { - return - } - - // zero length lists must be the zero value or properly initialized (sentinel circle) - if len(es) == 0 { - if l.root.next != nil && l.root.next != root || l.root.prev != nil && l.root.prev != root { - t.Errorf("l.root.next = %p, l.root.prev = %p; both should both be nil or %p", l.root.next, l.root.prev, root) - } - return - } - // len(es) > 0 - - // check internal and external prev/next connections - for i, e := range es { - prev := root - Prev := (*Element)(nil) - if i > 0 { - prev = es[i-1] - Prev = prev - } - if p := e.prev; p != prev { - t.Errorf("elt[%d](%p).prev = %p, want %p", i, e, p, prev) - } - if p := e.Prev(); p != Prev { - t.Errorf("elt[%d](%p).Prev() = %p, want %p", i, e, p, Prev) - } - - next := root - Next := (*Element)(nil) - if i < len(es)-1 { - next = es[i+1] - Next = next - } - if n := e.next; n != next { - t.Errorf("elt[%d](%p).next = %p, want %p", i, e, n, next) - } - if n := e.Next(); n != Next { - t.Errorf("elt[%d](%p).Next() = %p, want %p", i, e, n, Next) - } - } -} - -func TestList(t *testing.T) { - l := New() - checkListPointers(t, l, []*Element{}) - - // Single element list - e := l.PushFront("a") - checkListPointers(t, l, []*Element{e}) - l.MoveToFront(e) - checkListPointers(t, l, []*Element{e}) - l.MoveToBack(e) - checkListPointers(t, l, []*Element{e}) - l.Remove(e) - checkListPointers(t, l, []*Element{}) - - // Bigger list - e2 := l.PushFront(2) - e1 := l.PushFront(1) - e3 := l.PushBack(3) - e4 := l.PushBack("banana") - checkListPointers(t, l, []*Element{e1, e2, e3, e4}) - - l.Remove(e2) - checkListPointers(t, l, []*Element{e1, e3, e4}) - - l.MoveToFront(e3) // move from middle - checkListPointers(t, l, []*Element{e3, e1, e4}) - - l.MoveToFront(e1) - l.MoveToBack(e3) // move from middle - checkListPointers(t, l, []*Element{e1, e4, e3}) - - l.MoveToFront(e3) // move from back - checkListPointers(t, l, []*Element{e3, e1, e4}) - l.MoveToFront(e3) // should be no-op - checkListPointers(t, l, []*Element{e3, e1, e4}) - - l.MoveToBack(e3) // move from front - checkListPointers(t, l, []*Element{e1, e4, e3}) - l.MoveToBack(e3) // should be no-op - checkListPointers(t, l, []*Element{e1, e4, e3}) - - e2 = l.InsertBefore(2, e1) // insert before front - checkListPointers(t, l, []*Element{e2, e1, e4, e3}) - l.Remove(e2) - e2 = l.InsertBefore(2, e4) // insert before middle - checkListPointers(t, l, []*Element{e1, e2, e4, e3}) - l.Remove(e2) - e2 = l.InsertBefore(2, e3) // insert before back - checkListPointers(t, l, []*Element{e1, e4, e2, e3}) - l.Remove(e2) - - e2 = l.InsertAfter(2, e1) // insert after front - checkListPointers(t, l, []*Element{e1, e2, e4, e3}) - l.Remove(e2) - e2 = l.InsertAfter(2, e4) // insert after middle - checkListPointers(t, l, []*Element{e1, e4, e2, e3}) - l.Remove(e2) - e2 = l.InsertAfter(2, e3) // insert after back - checkListPointers(t, l, []*Element{e1, e4, e3, e2}) - l.Remove(e2) - - // Check standard iteration. - sum := 0 - for e := l.Front(); e != nil; e = e.Next() { - if i, ok := e.Value.(int); ok { - sum += i - } - } - if sum != 4 { - t.Errorf("sum over l = %d, want 4", sum) - } - - // Clear all elements by iterating - var next *Element - for e := l.Front(); e != nil; e = next { - next = e.Next() - l.Remove(e) - } - checkListPointers(t, l, []*Element{}) -} - -func checkList(t *testing.T, l *List, es []interface{}) { - if !checkListLen(t, l, len(es)) { - return - } - - i := 0 - for e := l.Front(); e != nil; e = e.Next() { - le := e.Value.(int) - if le != es[i] { - t.Errorf("elt[%d].Value = %v, want %v", i, le, es[i]) - } - i++ - } -} - -func TestExtending(t *testing.T) { - l1 := New() - l2 := New() - - l1.PushBack(1) - l1.PushBack(2) - l1.PushBack(3) - - l2.PushBack(4) - l2.PushBack(5) - - l3 := New() - l3.PushBackList(l1) - checkList(t, l3, []interface{}{1, 2, 3}) - l3.PushBackList(l2) - checkList(t, l3, []interface{}{1, 2, 3, 4, 5}) - - l3 = New() - l3.PushFrontList(l2) - checkList(t, l3, []interface{}{4, 5}) - l3.PushFrontList(l1) - checkList(t, l3, []interface{}{1, 2, 3, 4, 5}) - - checkList(t, l1, []interface{}{1, 2, 3}) - checkList(t, l2, []interface{}{4, 5}) - - l3 = New() - l3.PushBackList(l1) - checkList(t, l3, []interface{}{1, 2, 3}) - l3.PushBackList(l3) - checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3}) - - l3 = New() - l3.PushFrontList(l1) - checkList(t, l3, []interface{}{1, 2, 3}) - l3.PushFrontList(l3) - checkList(t, l3, []interface{}{1, 2, 3, 1, 2, 3}) - - l3 = New() - l1.PushBackList(l3) - checkList(t, l1, []interface{}{1, 2, 3}) - l1.PushFrontList(l3) - checkList(t, l1, []interface{}{1, 2, 3}) -} - -func TestRemove(t *testing.T) { - l := New() - e1 := l.PushBack(1) - e2 := l.PushBack(2) - checkListPointers(t, l, []*Element{e1, e2}) - e := l.Front() - l.Remove(e) - checkListPointers(t, l, []*Element{e2}) - l.Remove(e) - checkListPointers(t, l, []*Element{e2}) -} - -func TestIssue4103(t *testing.T) { - l1 := New() - l1.PushBack(1) - l1.PushBack(2) - - l2 := New() - l2.PushBack(3) - l2.PushBack(4) - - e := l1.Front() - l2.Remove(e) // l2 should not change because e is not an element of l2 - if n := l2.Len(); n != 2 { - t.Errorf("l2.Len() = %d, want 2", n) - } - - l1.InsertBefore(8, e) - if n := l1.Len(); n != 3 { - t.Errorf("l1.Len() = %d, want 3", n) - } -} - -func TestIssue6349(t *testing.T) { - l := New() - l.PushBack(1) - l.PushBack(2) - - e := l.Front() - l.Remove(e) - if e.Value != 1 { - t.Errorf("e.value = %d, want 1", e.Value) - } - if e.Next() != nil { - t.Errorf("e.Next() != nil") - } - if e.Prev() != nil { - t.Errorf("e.Prev() != nil") - } -} - -func TestMove(t *testing.T) { - l := New() - e1 := l.PushBack(1) - e2 := l.PushBack(2) - e3 := l.PushBack(3) - e4 := l.PushBack(4) - - l.MoveAfter(e3, e3) - checkListPointers(t, l, []*Element{e1, e2, e3, e4}) - l.MoveBefore(e2, e2) - checkListPointers(t, l, []*Element{e1, e2, e3, e4}) - - l.MoveAfter(e3, e2) - checkListPointers(t, l, []*Element{e1, e2, e3, e4}) - l.MoveBefore(e2, e3) - checkListPointers(t, l, []*Element{e1, e2, e3, e4}) - - l.MoveBefore(e2, e4) - checkListPointers(t, l, []*Element{e1, e3, e2, e4}) - e1, e2, e3, e4 = e1, e3, e2, e4 - - l.MoveBefore(e4, e1) - checkListPointers(t, l, []*Element{e4, e1, e2, e3}) - e1, e2, e3, e4 = e4, e1, e2, e3 - - l.MoveAfter(e4, e1) - checkListPointers(t, l, []*Element{e1, e4, e2, e3}) - e1, e2, e3, e4 = e1, e4, e2, e3 - - l.MoveAfter(e2, e3) - checkListPointers(t, l, []*Element{e1, e3, e2, e4}) - e1, e2, e3, e4 = e1, e3, e2, e4 -} - -// Test PushFront, PushBack, PushFrontList, PushBackList with uninitialized List -func TestZeroList(t *testing.T) { - var l1 = new(List) - l1.PushFront(1) - checkList(t, l1, []interface{}{1}) - - var l2 = new(List) - l2.PushBack(1) - checkList(t, l2, []interface{}{1}) - - var l3 = new(List) - l3.PushFrontList(l1) - checkList(t, l3, []interface{}{1}) - - var l4 = new(List) - l4.PushBackList(l2) - checkList(t, l4, []interface{}{1}) -} - -// Test that a list l is not modified when calling InsertBefore with a mark that is not an element of l. -func TestInsertBeforeUnknownMark(t *testing.T) { - var l List - l.PushBack(1) - l.PushBack(2) - l.PushBack(3) - l.InsertBefore(1, new(Element)) - checkList(t, &l, []interface{}{1, 2, 3}) -} - -// Test that a list l is not modified when calling InsertAfter with a mark that is not an element of l. -func TestInsertAfterUnknownMark(t *testing.T) { - var l List - l.PushBack(1) - l.PushBack(2) - l.PushBack(3) - l.InsertAfter(1, new(Element)) - checkList(t, &l, []interface{}{1, 2, 3}) -} - -// Test that a list l is not modified when calling MoveAfter or MoveBefore with a mark that is not an element of l. -func TestMoveUnkownMark(t *testing.T) { - var l1 List - e1 := l1.PushBack(1) - - var l2 List - e2 := l2.PushBack(2) - - l1.MoveAfter(e1, e2) - checkList(t, &l1, []interface{}{1}) - checkList(t, &l2, []interface{}{2}) - - l1.MoveBefore(e1, e2) - checkList(t, &l1, []interface{}{1}) - checkList(t, &l2, []interface{}{2}) -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/ring/ring.go b/llgo/third_party/gofrontend/libgo/go/container/ring/ring.go deleted file mode 100644 index 6d3b3e5b322266bd5bebc90f949c564947ff9fa8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/ring/ring.go +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ring implements operations on circular lists. -package ring - -// A Ring is an element of a circular list, or ring. -// Rings do not have a beginning or end; a pointer to any ring element -// serves as reference to the entire ring. Empty rings are represented -// as nil Ring pointers. The zero value for a Ring is a one-element -// ring with a nil Value. -// -type Ring struct { - next, prev *Ring - Value interface{} // for use by client; untouched by this library -} - -func (r *Ring) init() *Ring { - r.next = r - r.prev = r - return r -} - -// Next returns the next ring element. r must not be empty. -func (r *Ring) Next() *Ring { - if r.next == nil { - return r.init() - } - return r.next -} - -// Prev returns the previous ring element. r must not be empty. -func (r *Ring) Prev() *Ring { - if r.next == nil { - return r.init() - } - return r.prev -} - -// Move moves n % r.Len() elements backward (n < 0) or forward (n >= 0) -// in the ring and returns that ring element. r must not be empty. -// -func (r *Ring) Move(n int) *Ring { - if r.next == nil { - return r.init() - } - switch { - case n < 0: - for ; n < 0; n++ { - r = r.prev - } - case n > 0: - for ; n > 0; n-- { - r = r.next - } - } - return r -} - -// New creates a ring of n elements. -func New(n int) *Ring { - if n <= 0 { - return nil - } - r := new(Ring) - p := r - for i := 1; i < n; i++ { - p.next = &Ring{prev: p} - p = p.next - } - p.next = r - r.prev = p - return r -} - -// Link connects ring r with ring s such that r.Next() -// becomes s and returns the original value for r.Next(). -// r must not be empty. -// -// If r and s point to the same ring, linking -// them removes the elements between r and s from the ring. -// The removed elements form a subring and the result is a -// reference to that subring (if no elements were removed, -// the result is still the original value for r.Next(), -// and not nil). -// -// If r and s point to different rings, linking -// them creates a single ring with the elements of s inserted -// after r. The result points to the element following the -// last element of s after insertion. -// -func (r *Ring) Link(s *Ring) *Ring { - n := r.Next() - if s != nil { - p := s.Prev() - // Note: Cannot use multiple assignment because - // evaluation order of LHS is not specified. - r.next = s - s.prev = r - n.prev = p - p.next = n - } - return n -} - -// Unlink removes n % r.Len() elements from the ring r, starting -// at r.Next(). If n % r.Len() == 0, r remains unchanged. -// The result is the removed subring. r must not be empty. -// -func (r *Ring) Unlink(n int) *Ring { - if n <= 0 { - return nil - } - return r.Link(r.Move(n + 1)) -} - -// Len computes the number of elements in ring r. -// It executes in time proportional to the number of elements. -// -func (r *Ring) Len() int { - n := 0 - if r != nil { - n = 1 - for p := r.Next(); p != r; p = p.next { - n++ - } - } - return n -} - -// Do calls function f on each element of the ring, in forward order. -// The behavior of Do is undefined if f changes *r. -func (r *Ring) Do(f func(interface{})) { - if r != nil { - f(r.Value) - for p := r.Next(); p != r; p = p.next { - f(p.Value) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/container/ring/ring_test.go b/llgo/third_party/gofrontend/libgo/go/container/ring/ring_test.go deleted file mode 100644 index 552f0e24b55b964635c24a147c40c59d4b1d5522..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/container/ring/ring_test.go +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ring - -import ( - "fmt" - "testing" -) - -// For debugging - keep around. -func dump(r *Ring) { - if r == nil { - fmt.Println("empty") - return - } - i, n := 0, r.Len() - for p := r; i < n; p = p.next { - fmt.Printf("%4d: %p = {<- %p | %p ->}\n", i, p, p.prev, p.next) - i++ - } - fmt.Println() -} - -func verify(t *testing.T, r *Ring, N int, sum int) { - // Len - n := r.Len() - if n != N { - t.Errorf("r.Len() == %d; expected %d", n, N) - } - - // iteration - n = 0 - s := 0 - r.Do(func(p interface{}) { - n++ - if p != nil { - s += p.(int) - } - }) - if n != N { - t.Errorf("number of forward iterations == %d; expected %d", n, N) - } - if sum >= 0 && s != sum { - t.Errorf("forward ring sum = %d; expected %d", s, sum) - } - - if r == nil { - return - } - - // connections - if r.next != nil { - var p *Ring // previous element - for q := r; p == nil || q != r; q = q.next { - if p != nil && p != q.prev { - t.Errorf("prev = %p, expected q.prev = %p\n", p, q.prev) - } - p = q - } - if p != r.prev { - t.Errorf("prev = %p, expected r.prev = %p\n", p, r.prev) - } - } - - // Next, Prev - if r.Next() != r.next { - t.Errorf("r.Next() != r.next") - } - if r.Prev() != r.prev { - t.Errorf("r.Prev() != r.prev") - } - - // Move - if r.Move(0) != r { - t.Errorf("r.Move(0) != r") - } - if r.Move(N) != r { - t.Errorf("r.Move(%d) != r", N) - } - if r.Move(-N) != r { - t.Errorf("r.Move(%d) != r", -N) - } - for i := 0; i < 10; i++ { - ni := N + i - mi := ni % N - if r.Move(ni) != r.Move(mi) { - t.Errorf("r.Move(%d) != r.Move(%d)", ni, mi) - } - if r.Move(-ni) != r.Move(-mi) { - t.Errorf("r.Move(%d) != r.Move(%d)", -ni, -mi) - } - } -} - -func TestCornerCases(t *testing.T) { - var ( - r0 *Ring - r1 Ring - ) - // Basics - verify(t, r0, 0, 0) - verify(t, &r1, 1, 0) - // Insert - r1.Link(r0) - verify(t, r0, 0, 0) - verify(t, &r1, 1, 0) - // Insert - r1.Link(r0) - verify(t, r0, 0, 0) - verify(t, &r1, 1, 0) - // Unlink - r1.Unlink(0) - verify(t, &r1, 1, 0) -} - -func makeN(n int) *Ring { - r := New(n) - for i := 1; i <= n; i++ { - r.Value = i - r = r.Next() - } - return r -} - -func sumN(n int) int { return (n*n + n) / 2 } - -func TestNew(t *testing.T) { - for i := 0; i < 10; i++ { - r := New(i) - verify(t, r, i, -1) - } - for i := 0; i < 10; i++ { - r := makeN(i) - verify(t, r, i, sumN(i)) - } -} - -func TestLink1(t *testing.T) { - r1a := makeN(1) - var r1b Ring - r2a := r1a.Link(&r1b) - verify(t, r2a, 2, 1) - if r2a != r1a { - t.Errorf("a) 2-element link failed") - } - - r2b := r2a.Link(r2a.Next()) - verify(t, r2b, 2, 1) - if r2b != r2a.Next() { - t.Errorf("b) 2-element link failed") - } - - r1c := r2b.Link(r2b) - verify(t, r1c, 1, 1) - verify(t, r2b, 1, 0) -} - -func TestLink2(t *testing.T) { - var r0 *Ring - r1a := &Ring{Value: 42} - r1b := &Ring{Value: 77} - r10 := makeN(10) - - r1a.Link(r0) - verify(t, r1a, 1, 42) - - r1a.Link(r1b) - verify(t, r1a, 2, 42+77) - - r10.Link(r0) - verify(t, r10, 10, sumN(10)) - - r10.Link(r1a) - verify(t, r10, 12, sumN(10)+42+77) -} - -func TestLink3(t *testing.T) { - var r Ring - n := 1 - for i := 1; i < 100; i++ { - n += i - verify(t, r.Link(New(i)), n, -1) - } -} - -func TestUnlink(t *testing.T) { - r10 := makeN(10) - s10 := r10.Move(6) - - sum10 := sumN(10) - - verify(t, r10, 10, sum10) - verify(t, s10, 10, sum10) - - r0 := r10.Unlink(0) - verify(t, r0, 0, 0) - - r1 := r10.Unlink(1) - verify(t, r1, 1, 2) - verify(t, r10, 9, sum10-2) - - r9 := r10.Unlink(9) - verify(t, r9, 9, sum10-2) - verify(t, r10, 9, sum10-2) -} - -func TestLinkUnlink(t *testing.T) { - for i := 1; i < 4; i++ { - ri := New(i) - for j := 0; j < i; j++ { - rj := ri.Unlink(j) - verify(t, rj, j, -1) - verify(t, ri, i-j, -1) - ri.Link(rj) - verify(t, ri, i, -1) - } - } -} - -// Test that calling Move() on an empty Ring initializes it. -func TestMoveEmptyRing(t *testing.T) { - var r Ring - - r.Move(1) - verify(t, &r, 1, 0) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/aes_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/aes_test.go deleted file mode 100644 index 363180931c77182c73e620bcc51557d3881066d8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/aes_test.go +++ /dev/null @@ -1,421 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package aes - -import ( - "testing" -) - -// See const.go for overview of math here. - -// Test that powx is initialized correctly. -// (Can adapt this code to generate it too.) -func TestPowx(t *testing.T) { - p := 1 - for i := 0; i < len(powx); i++ { - if powx[i] != byte(p) { - t.Errorf("powx[%d] = %#x, want %#x", i, powx[i], p) - } - p <<= 1 - if p&0x100 != 0 { - p ^= poly - } - } -} - -// Multiply b and c as GF(2) polynomials modulo poly -func mul(b, c uint32) uint32 { - i := b - j := c - s := uint32(0) - for k := uint32(1); k < 0x100 && j != 0; k <<= 1 { - // Invariant: k == 1<>8 - } - } -} - -// Test that decryption tables are correct. -// (Can adapt this code to generate them too.) -func TestTd(t *testing.T) { - for i := 0; i < 256; i++ { - s := uint32(sbox1[i]) - s9 := mul(s, 0x9) - sb := mul(s, 0xb) - sd := mul(s, 0xd) - se := mul(s, 0xe) - w := se<<24 | s9<<16 | sd<<8 | sb - td := [][256]uint32{td0, td1, td2, td3} - for j := 0; j < 4; j++ { - if x := td[j][i]; x != w { - t.Fatalf("td[%d][%d] = %#x, want %#x", j, i, x, w) - } - w = w<<24 | w>>8 - } - } -} - -// Test vectors are from FIPS 197: -// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf - -// Appendix A of FIPS 197: Key expansion examples -type KeyTest struct { - key []byte - enc []uint32 - dec []uint32 // decryption expansion; not in FIPS 197, computed from C implementation. -} - -var keyTests = []KeyTest{ - { - // A.1. Expansion of a 128-bit Cipher Key - []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, - []uint32{ - 0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x09cf4f3c, - 0xa0fafe17, 0x88542cb1, 0x23a33939, 0x2a6c7605, - 0xf2c295f2, 0x7a96b943, 0x5935807a, 0x7359f67f, - 0x3d80477d, 0x4716fe3e, 0x1e237e44, 0x6d7a883b, - 0xef44a541, 0xa8525b7f, 0xb671253b, 0xdb0bad00, - 0xd4d1c6f8, 0x7c839d87, 0xcaf2b8bc, 0x11f915bc, - 0x6d88a37a, 0x110b3efd, 0xdbf98641, 0xca0093fd, - 0x4e54f70e, 0x5f5fc9f3, 0x84a64fb2, 0x4ea6dc4f, - 0xead27321, 0xb58dbad2, 0x312bf560, 0x7f8d292f, - 0xac7766f3, 0x19fadc21, 0x28d12941, 0x575c006e, - 0xd014f9a8, 0xc9ee2589, 0xe13f0cc8, 0xb6630ca6, - }, - []uint32{ - 0xd014f9a8, 0xc9ee2589, 0xe13f0cc8, 0xb6630ca6, - 0xc7b5a63, 0x1319eafe, 0xb0398890, 0x664cfbb4, - 0xdf7d925a, 0x1f62b09d, 0xa320626e, 0xd6757324, - 0x12c07647, 0xc01f22c7, 0xbc42d2f3, 0x7555114a, - 0x6efcd876, 0xd2df5480, 0x7c5df034, 0xc917c3b9, - 0x6ea30afc, 0xbc238cf6, 0xae82a4b4, 0xb54a338d, - 0x90884413, 0xd280860a, 0x12a12842, 0x1bc89739, - 0x7c1f13f7, 0x4208c219, 0xc021ae48, 0x969bf7b, - 0xcc7505eb, 0x3e17d1ee, 0x82296c51, 0xc9481133, - 0x2b3708a7, 0xf262d405, 0xbc3ebdbf, 0x4b617d62, - 0x2b7e1516, 0x28aed2a6, 0xabf71588, 0x9cf4f3c, - }, - }, - { - // A.2. Expansion of a 192-bit Cipher Key - []byte{ - 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b, - }, - []uint32{ - 0x8e73b0f7, 0xda0e6452, 0xc810f32b, 0x809079e5, - 0x62f8ead2, 0x522c6b7b, 0xfe0c91f7, 0x2402f5a5, - 0xec12068e, 0x6c827f6b, 0x0e7a95b9, 0x5c56fec2, - 0x4db7b4bd, 0x69b54118, 0x85a74796, 0xe92538fd, - 0xe75fad44, 0xbb095386, 0x485af057, 0x21efb14f, - 0xa448f6d9, 0x4d6dce24, 0xaa326360, 0x113b30e6, - 0xa25e7ed5, 0x83b1cf9a, 0x27f93943, 0x6a94f767, - 0xc0a69407, 0xd19da4e1, 0xec1786eb, 0x6fa64971, - 0x485f7032, 0x22cb8755, 0xe26d1352, 0x33f0b7b3, - 0x40beeb28, 0x2f18a259, 0x6747d26b, 0x458c553e, - 0xa7e1466c, 0x9411f1df, 0x821f750a, 0xad07d753, - 0xca400538, 0x8fcc5006, 0x282d166a, 0xbc3ce7b5, - 0xe98ba06f, 0x448c773c, 0x8ecc7204, 0x01002202, - }, - nil, - }, - { - // A.3. Expansion of a 256-bit Cipher Key - []byte{ - 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4, - }, - []uint32{ - 0x603deb10, 0x15ca71be, 0x2b73aef0, 0x857d7781, - 0x1f352c07, 0x3b6108d7, 0x2d9810a3, 0x0914dff4, - 0x9ba35411, 0x8e6925af, 0xa51a8b5f, 0x2067fcde, - 0xa8b09c1a, 0x93d194cd, 0xbe49846e, 0xb75d5b9a, - 0xd59aecb8, 0x5bf3c917, 0xfee94248, 0xde8ebe96, - 0xb5a9328a, 0x2678a647, 0x98312229, 0x2f6c79b3, - 0x812c81ad, 0xdadf48ba, 0x24360af2, 0xfab8b464, - 0x98c5bfc9, 0xbebd198e, 0x268c3ba7, 0x09e04214, - 0x68007bac, 0xb2df3316, 0x96e939e4, 0x6c518d80, - 0xc814e204, 0x76a9fb8a, 0x5025c02d, 0x59c58239, - 0xde136967, 0x6ccc5a71, 0xfa256395, 0x9674ee15, - 0x5886ca5d, 0x2e2f31d7, 0x7e0af1fa, 0x27cf73c3, - 0x749c47ab, 0x18501dda, 0xe2757e4f, 0x7401905a, - 0xcafaaae3, 0xe4d59b34, 0x9adf6ace, 0xbd10190d, - 0xfe4890d1, 0xe6188d0b, 0x046df344, 0x706c631e, - }, - nil, - }, -} - -// Test key expansion against FIPS 197 examples. -func TestExpandKey(t *testing.T) { -L: - for i, tt := range keyTests { - enc := make([]uint32, len(tt.enc)) - var dec []uint32 - if tt.dec != nil { - dec = make([]uint32, len(tt.dec)) - } - // This test could only test Go version of expandKey because asm - // version might use different memory layout for expanded keys - // This is OK because we don't expose expanded keys to the outside - expandKeyGo(tt.key, enc, dec) - for j, v := range enc { - if v != tt.enc[j] { - t.Errorf("key %d: enc[%d] = %#x, want %#x", i, j, v, tt.enc[j]) - continue L - } - } - if dec != nil { - for j, v := range dec { - if v != tt.dec[j] { - t.Errorf("key %d: dec[%d] = %#x, want %#x", i, j, v, tt.dec[j]) - continue L - } - } - } - } -} - -// Appendix B, C of FIPS 197: Cipher examples, Example vectors. -type CryptTest struct { - key []byte - in []byte - out []byte -} - -var encryptTests = []CryptTest{ - { - // Appendix B. - []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c}, - []byte{0x32, 0x43, 0xf6, 0xa8, 0x88, 0x5a, 0x30, 0x8d, 0x31, 0x31, 0x98, 0xa2, 0xe0, 0x37, 0x07, 0x34}, - []byte{0x39, 0x25, 0x84, 0x1d, 0x02, 0xdc, 0x09, 0xfb, 0xdc, 0x11, 0x85, 0x97, 0x19, 0x6a, 0x0b, 0x32}, - }, - { - // Appendix C.1. AES-128 - []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}, - []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, - []byte{0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a}, - }, - { - // Appendix C.2. AES-192 - []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - }, - []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, - []byte{0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91}, - }, - { - // Appendix C.3. AES-256 - []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - }, - []byte{0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, - []byte{0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89}, - }, -} - -// Test encryptBlock against FIPS 197 examples. -func TestEncryptBlock(t *testing.T) { - for i, tt := range encryptTests { - n := len(tt.key) + 28 - enc := make([]uint32, n) - dec := make([]uint32, n) - expandKey(tt.key, enc, dec) - out := make([]byte, len(tt.in)) - encryptBlock(enc, out, tt.in) - for j, v := range out { - if v != tt.out[j] { - t.Errorf("encryptBlock %d: out[%d] = %#x, want %#x", i, j, v, tt.out[j]) - break - } - } - } -} - -// Test decryptBlock against FIPS 197 examples. -func TestDecryptBlock(t *testing.T) { - for i, tt := range encryptTests { - n := len(tt.key) + 28 - enc := make([]uint32, n) - dec := make([]uint32, n) - expandKey(tt.key, enc, dec) - plain := make([]byte, len(tt.in)) - decryptBlock(dec, plain, tt.out) - for j, v := range plain { - if v != tt.in[j] { - t.Errorf("decryptBlock %d: plain[%d] = %#x, want %#x", i, j, v, tt.in[j]) - break - } - } - } -} - -// Test Cipher Encrypt method against FIPS 197 examples. -func TestCipherEncrypt(t *testing.T) { - for i, tt := range encryptTests { - c, err := NewCipher(tt.key) - if err != nil { - t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) - continue - } - out := make([]byte, len(tt.in)) - c.Encrypt(out, tt.in) - for j, v := range out { - if v != tt.out[j] { - t.Errorf("Cipher.Encrypt %d: out[%d] = %#x, want %#x", i, j, v, tt.out[j]) - break - } - } - } -} - -// Test Cipher Decrypt against FIPS 197 examples. -func TestCipherDecrypt(t *testing.T) { - for i, tt := range encryptTests { - c, err := NewCipher(tt.key) - if err != nil { - t.Errorf("NewCipher(%d bytes) = %s", len(tt.key), err) - continue - } - plain := make([]byte, len(tt.in)) - c.Decrypt(plain, tt.out) - for j, v := range plain { - if v != tt.in[j] { - t.Errorf("decryptBlock %d: plain[%d] = %#x, want %#x", i, j, v, tt.in[j]) - break - } - } - } -} - -// Test short input/output. -// Assembly used to not notice. -// See issue 7928. -func TestShortBlocks(t *testing.T) { - bytes := func(n int) []byte { return make([]byte, n) } - - c, _ := NewCipher(bytes(16)) - - mustPanic(t, "crypto/aes: input not full block", func() { c.Encrypt(bytes(1), bytes(1)) }) - mustPanic(t, "crypto/aes: input not full block", func() { c.Decrypt(bytes(1), bytes(1)) }) - mustPanic(t, "crypto/aes: input not full block", func() { c.Encrypt(bytes(100), bytes(1)) }) - mustPanic(t, "crypto/aes: input not full block", func() { c.Decrypt(bytes(100), bytes(1)) }) - mustPanic(t, "crypto/aes: output not full block", func() { c.Encrypt(bytes(1), bytes(100)) }) - mustPanic(t, "crypto/aes: output not full block", func() { c.Decrypt(bytes(1), bytes(100)) }) -} - -func mustPanic(t *testing.T, msg string, f func()) { - defer func() { - err := recover() - if err == nil { - t.Errorf("function did not panic, wanted %q", msg) - } else if err != msg { - t.Errorf("got panic %v, wanted %q", err, msg) - } - }() - f() -} - -func BenchmarkEncrypt(b *testing.B) { - tt := encryptTests[0] - c, err := NewCipher(tt.key) - if err != nil { - b.Fatal("NewCipher:", err) - } - out := make([]byte, len(tt.in)) - b.SetBytes(int64(len(out))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - c.Encrypt(out, tt.in) - } -} - -func BenchmarkDecrypt(b *testing.B) { - tt := encryptTests[0] - c, err := NewCipher(tt.key) - if err != nil { - b.Fatal("NewCipher:", err) - } - out := make([]byte, len(tt.out)) - b.SetBytes(int64(len(out))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - c.Decrypt(out, tt.out) - } -} - -func BenchmarkExpand(b *testing.B) { - tt := encryptTests[0] - n := len(tt.key) + 28 - c := &aesCipher{make([]uint32, n), make([]uint32, n)} - b.ResetTimer() - for i := 0; i < b.N; i++ { - expandKey(tt.key, c.enc, c.dec) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/block.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/block.go deleted file mode 100644 index 57a7e9e25f2f36abdba68c03f6fd5f011e5fd2e9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/block.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This Go implementation is derived in part from the reference -// ANSI C implementation, which carries the following notice: -// -// rijndael-alg-fst.c -// -// @version 3.0 (December 2000) -// -// Optimised ANSI C code for the Rijndael cipher (now AES) -// -// @author Vincent Rijmen -// @author Antoon Bosselaers -// @author Paulo Barreto -// -// This code is hereby placed in the public domain. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''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 AUTHORS 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. -// -// See FIPS 197 for specification, and see Daemen and Rijmen's Rijndael submission -// for implementation details. -// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf -// http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf - -package aes - -// Encrypt one block from src into dst, using the expanded key xk. -func encryptBlockGo(xk []uint32, dst, src []byte) { - var s0, s1, s2, s3, t0, t1, t2, t3 uint32 - - s0 = uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - s1 = uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - s2 = uint32(src[8])<<24 | uint32(src[9])<<16 | uint32(src[10])<<8 | uint32(src[11]) - s3 = uint32(src[12])<<24 | uint32(src[13])<<16 | uint32(src[14])<<8 | uint32(src[15]) - - // First round just XORs input with key. - s0 ^= xk[0] - s1 ^= xk[1] - s2 ^= xk[2] - s3 ^= xk[3] - - // Middle rounds shuffle using tables. - // Number of rounds is set by length of expanded key. - nr := len(xk)/4 - 2 // - 2: one above, one more below - k := 4 - for r := 0; r < nr; r++ { - t0 = xk[k+0] ^ te0[uint8(s0>>24)] ^ te1[uint8(s1>>16)] ^ te2[uint8(s2>>8)] ^ te3[uint8(s3)] - t1 = xk[k+1] ^ te0[uint8(s1>>24)] ^ te1[uint8(s2>>16)] ^ te2[uint8(s3>>8)] ^ te3[uint8(s0)] - t2 = xk[k+2] ^ te0[uint8(s2>>24)] ^ te1[uint8(s3>>16)] ^ te2[uint8(s0>>8)] ^ te3[uint8(s1)] - t3 = xk[k+3] ^ te0[uint8(s3>>24)] ^ te1[uint8(s0>>16)] ^ te2[uint8(s1>>8)] ^ te3[uint8(s2)] - k += 4 - s0, s1, s2, s3 = t0, t1, t2, t3 - } - - // Last round uses s-box directly and XORs to produce output. - s0 = uint32(sbox0[t0>>24])<<24 | uint32(sbox0[t1>>16&0xff])<<16 | uint32(sbox0[t2>>8&0xff])<<8 | uint32(sbox0[t3&0xff]) - s1 = uint32(sbox0[t1>>24])<<24 | uint32(sbox0[t2>>16&0xff])<<16 | uint32(sbox0[t3>>8&0xff])<<8 | uint32(sbox0[t0&0xff]) - s2 = uint32(sbox0[t2>>24])<<24 | uint32(sbox0[t3>>16&0xff])<<16 | uint32(sbox0[t0>>8&0xff])<<8 | uint32(sbox0[t1&0xff]) - s3 = uint32(sbox0[t3>>24])<<24 | uint32(sbox0[t0>>16&0xff])<<16 | uint32(sbox0[t1>>8&0xff])<<8 | uint32(sbox0[t2&0xff]) - - s0 ^= xk[k+0] - s1 ^= xk[k+1] - s2 ^= xk[k+2] - s3 ^= xk[k+3] - - dst[0], dst[1], dst[2], dst[3] = byte(s0>>24), byte(s0>>16), byte(s0>>8), byte(s0) - dst[4], dst[5], dst[6], dst[7] = byte(s1>>24), byte(s1>>16), byte(s1>>8), byte(s1) - dst[8], dst[9], dst[10], dst[11] = byte(s2>>24), byte(s2>>16), byte(s2>>8), byte(s2) - dst[12], dst[13], dst[14], dst[15] = byte(s3>>24), byte(s3>>16), byte(s3>>8), byte(s3) -} - -// Decrypt one block from src into dst, using the expanded key xk. -func decryptBlockGo(xk []uint32, dst, src []byte) { - var s0, s1, s2, s3, t0, t1, t2, t3 uint32 - - s0 = uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3]) - s1 = uint32(src[4])<<24 | uint32(src[5])<<16 | uint32(src[6])<<8 | uint32(src[7]) - s2 = uint32(src[8])<<24 | uint32(src[9])<<16 | uint32(src[10])<<8 | uint32(src[11]) - s3 = uint32(src[12])<<24 | uint32(src[13])<<16 | uint32(src[14])<<8 | uint32(src[15]) - - // First round just XORs input with key. - s0 ^= xk[0] - s1 ^= xk[1] - s2 ^= xk[2] - s3 ^= xk[3] - - // Middle rounds shuffle using tables. - // Number of rounds is set by length of expanded key. - nr := len(xk)/4 - 2 // - 2: one above, one more below - k := 4 - for r := 0; r < nr; r++ { - t0 = xk[k+0] ^ td0[uint8(s0>>24)] ^ td1[uint8(s3>>16)] ^ td2[uint8(s2>>8)] ^ td3[uint8(s1)] - t1 = xk[k+1] ^ td0[uint8(s1>>24)] ^ td1[uint8(s0>>16)] ^ td2[uint8(s3>>8)] ^ td3[uint8(s2)] - t2 = xk[k+2] ^ td0[uint8(s2>>24)] ^ td1[uint8(s1>>16)] ^ td2[uint8(s0>>8)] ^ td3[uint8(s3)] - t3 = xk[k+3] ^ td0[uint8(s3>>24)] ^ td1[uint8(s2>>16)] ^ td2[uint8(s1>>8)] ^ td3[uint8(s0)] - k += 4 - s0, s1, s2, s3 = t0, t1, t2, t3 - } - - // Last round uses s-box directly and XORs to produce output. - s0 = uint32(sbox1[t0>>24])<<24 | uint32(sbox1[t3>>16&0xff])<<16 | uint32(sbox1[t2>>8&0xff])<<8 | uint32(sbox1[t1&0xff]) - s1 = uint32(sbox1[t1>>24])<<24 | uint32(sbox1[t0>>16&0xff])<<16 | uint32(sbox1[t3>>8&0xff])<<8 | uint32(sbox1[t2&0xff]) - s2 = uint32(sbox1[t2>>24])<<24 | uint32(sbox1[t1>>16&0xff])<<16 | uint32(sbox1[t0>>8&0xff])<<8 | uint32(sbox1[t3&0xff]) - s3 = uint32(sbox1[t3>>24])<<24 | uint32(sbox1[t2>>16&0xff])<<16 | uint32(sbox1[t1>>8&0xff])<<8 | uint32(sbox1[t0&0xff]) - - s0 ^= xk[k+0] - s1 ^= xk[k+1] - s2 ^= xk[k+2] - s3 ^= xk[k+3] - - dst[0], dst[1], dst[2], dst[3] = byte(s0>>24), byte(s0>>16), byte(s0>>8), byte(s0) - dst[4], dst[5], dst[6], dst[7] = byte(s1>>24), byte(s1>>16), byte(s1>>8), byte(s1) - dst[8], dst[9], dst[10], dst[11] = byte(s2>>24), byte(s2>>16), byte(s2>>8), byte(s2) - dst[12], dst[13], dst[14], dst[15] = byte(s3>>24), byte(s3>>16), byte(s3>>8), byte(s3) -} - -// Apply sbox0 to each byte in w. -func subw(w uint32) uint32 { - return uint32(sbox0[w>>24])<<24 | - uint32(sbox0[w>>16&0xff])<<16 | - uint32(sbox0[w>>8&0xff])<<8 | - uint32(sbox0[w&0xff]) -} - -// Rotate -func rotw(w uint32) uint32 { return w<<8 | w>>24 } - -// Key expansion algorithm. See FIPS-197, Figure 11. -// Their rcon[i] is our powx[i-1] << 24. -func expandKeyGo(key []byte, enc, dec []uint32) { - // Encryption key setup. - var i int - nk := len(key) / 4 - for i = 0; i < nk; i++ { - enc[i] = uint32(key[4*i])<<24 | uint32(key[4*i+1])<<16 | uint32(key[4*i+2])<<8 | uint32(key[4*i+3]) - } - for ; i < len(enc); i++ { - t := enc[i-1] - if i%nk == 0 { - t = subw(rotw(t)) ^ (uint32(powx[i/nk-1]) << 24) - } else if nk > 6 && i%nk == 4 { - t = subw(t) - } - enc[i] = enc[i-nk] ^ t - } - - // Derive decryption key from encryption key. - // Reverse the 4-word round key sets from enc to produce dec. - // All sets but the first and last get the MixColumn transform applied. - if dec == nil { - return - } - n := len(enc) - for i := 0; i < n; i += 4 { - ei := n - i - 4 - for j := 0; j < 4; j++ { - x := enc[ei+j] - if i > 0 && i+4 < n { - x = td0[sbox0[x>>24]] ^ td1[sbox0[x>>16&0xff]] ^ td2[sbox0[x>>8&0xff]] ^ td3[sbox0[x&0xff]] - } - dec[i+j] = x - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher.go deleted file mode 100644 index 2c6bb0a89c7b753359f862081c0f858879b7c99b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package aes - -import ( - "crypto/cipher" - "strconv" -) - -// The AES block size in bytes. -const BlockSize = 16 - -// A cipher is an instance of AES encryption using a particular key. -type aesCipher struct { - enc []uint32 - dec []uint32 -} - -type KeySizeError int - -func (k KeySizeError) Error() string { - return "crypto/aes: invalid key size " + strconv.Itoa(int(k)) -} - -// NewCipher creates and returns a new cipher.Block. -// The key argument should be the AES key, -// either 16, 24, or 32 bytes to select -// AES-128, AES-192, or AES-256. -func NewCipher(key []byte) (cipher.Block, error) { - k := len(key) - switch k { - default: - return nil, KeySizeError(k) - case 16, 24, 32: - break - } - - n := k + 28 - c := &aesCipher{make([]uint32, n), make([]uint32, n)} - expandKey(key, c.enc, c.dec) - return c, nil -} - -func (c *aesCipher) BlockSize() int { return BlockSize } - -func (c *aesCipher) Encrypt(dst, src []byte) { - if len(src) < BlockSize { - panic("crypto/aes: input not full block") - } - if len(dst) < BlockSize { - panic("crypto/aes: output not full block") - } - encryptBlock(c.enc, dst, src) -} - -func (c *aesCipher) Decrypt(dst, src []byte) { - if len(src) < BlockSize { - panic("crypto/aes: input not full block") - } - if len(dst) < BlockSize { - panic("crypto/aes: output not full block") - } - decryptBlock(c.dec, dst, src) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_asm.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_asm.go deleted file mode 100644 index 964eaaa6f886f9f474be72e1832fa5a7c95d7e1f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_asm.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 - -package aes - -// defined in asm_$GOARCH.s -func hasAsm() bool -func encryptBlockAsm(nr int, xk *uint32, dst, src *byte) -func decryptBlockAsm(nr int, xk *uint32, dst, src *byte) -func expandKeyAsm(nr int, key *byte, enc *uint32, dec *uint32) - -var useAsm = hasAsm() - -func encryptBlock(xk []uint32, dst, src []byte) { - if useAsm { - encryptBlockAsm(len(xk)/4-1, &xk[0], &dst[0], &src[0]) - } else { - encryptBlockGo(xk, dst, src) - } -} - -func decryptBlock(xk []uint32, dst, src []byte) { - if useAsm { - decryptBlockAsm(len(xk)/4-1, &xk[0], &dst[0], &src[0]) - } else { - decryptBlockGo(xk, dst, src) - } -} - -func expandKey(key []byte, enc, dec []uint32) { - if useAsm { - rounds := 10 - switch len(key) { - case 128 / 8: - rounds = 10 - case 192 / 8: - rounds = 12 - case 256 / 8: - rounds = 14 - } - expandKeyAsm(rounds, &key[0], &enc[0], &dec[0]) - } else { - expandKeyGo(key, enc, dec) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_generic.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_generic.go deleted file mode 100644 index 1714e0f1e5cbdba4d890998e9f0f6bc9388ac5fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/cipher_generic.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64 - -package aes - -func encryptBlock(xk []uint32, dst, src []byte) { - encryptBlockGo(xk, dst, src) -} - -func decryptBlock(xk []uint32, dst, src []byte) { - decryptBlockGo(xk, dst, src) -} - -func expandKey(key []byte, enc, dec []uint32) { - expandKeyGo(key, enc, dec) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/aes/const.go b/llgo/third_party/gofrontend/libgo/go/crypto/aes/const.go deleted file mode 100644 index aee73a7c52c75eb2f6d2c1e451c3905949debfd1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/aes/const.go +++ /dev/null @@ -1,358 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package aes implements AES encryption (formerly Rijndael), as defined in -// U.S. Federal Information Processing Standards Publication 197. -package aes - -// This file contains AES constants - 8720 bytes of initialized data. - -// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf - -// AES is based on the mathematical behavior of binary polynomials -// (polynomials over GF(2)) modulo the irreducible polynomial x⁸ + x⁴ + x³ + x + 1. -// Addition of these binary polynomials corresponds to binary xor. -// Reducing mod poly corresponds to binary xor with poly every -// time a 0x100 bit appears. -const poly = 1<<8 | 1<<4 | 1<<3 | 1<<1 | 1<<0 // x⁸ + x⁴ + x³ + x + 1 - -// Powers of x mod poly in GF(2). -var powx = [16]byte{ - 0x01, - 0x02, - 0x04, - 0x08, - 0x10, - 0x20, - 0x40, - 0x80, - 0x1b, - 0x36, - 0x6c, - 0xd8, - 0xab, - 0x4d, - 0x9a, - 0x2f, -} - -// FIPS-197 Figure 7. S-box substitution values in hexadecimal format. -var sbox0 = [256]byte{ - 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, - 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, - 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, - 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, - 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, - 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, - 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, - 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, - 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, - 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, - 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, - 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, - 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, - 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, - 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, - 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, -} - -// FIPS-197 Figure 14. Inverse S-box substitution values in hexadecimal format. -var sbox1 = [256]byte{ - 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, - 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, - 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, - 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, - 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, - 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, - 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, - 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, - 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, - 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, - 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, - 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, - 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, - 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, - 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, - 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d, -} - -// Lookup tables for encryption. -// These can be recomputed by adapting the tests in aes_test.go. - -var te0 = [256]uint32{ - 0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, - 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, - 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, - 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, - 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, - 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, - 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, - 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, - 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, - 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, - 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, - 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, - 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, - 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, - 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, - 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, - 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, - 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, - 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, - 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, - 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, - 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, - 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, - 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, - 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, - 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, - 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, - 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, - 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, - 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, - 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, - 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a, -} -var te1 = [256]uint32{ - 0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, - 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, - 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, - 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, - 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, - 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, - 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, - 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, - 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, - 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, - 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, - 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, - 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, - 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, - 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, - 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, - 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, - 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, - 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, - 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, - 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, - 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, - 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, - 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, - 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, - 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, - 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, - 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, - 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, - 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, - 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, - 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616, -} -var te2 = [256]uint32{ - 0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, - 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, - 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, - 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, - 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, - 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, - 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, - 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, - 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, - 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, - 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, - 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, - 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, - 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, - 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, - 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, - 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, - 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, - 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, - 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, - 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, - 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, - 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, - 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, - 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, - 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, - 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, - 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, - 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, - 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, - 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, - 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16, -} -var te3 = [256]uint32{ - 0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, - 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, - 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, - 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, - 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, - 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, - 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, - 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, - 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, - 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, - 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, - 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, - 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, - 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, - 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, - 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, - 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, - 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, - 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, - 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, - 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, - 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, - 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, - 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, - 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, - 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, - 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, - 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, - 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, - 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, - 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, - 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c, -} - -// Lookup tables for decryption. -// These can be recomputed by adapting the tests in aes_test.go. - -var td0 = [256]uint32{ - 0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, - 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, - 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, - 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, - 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, - 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, - 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, - 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, - 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, - 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, - 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, - 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, - 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, - 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, - 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, - 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, - 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, - 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, - 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, - 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, - 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, - 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, - 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, - 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, - 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, - 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, - 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, - 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, - 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, - 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, - 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, - 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742, -} -var td1 = [256]uint32{ - 0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, - 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, - 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, - 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, - 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, - 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, - 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, - 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, - 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, - 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, - 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, - 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, - 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, - 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, - 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, - 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, - 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, - 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, - 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, - 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, - 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, - 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, - 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, - 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, - 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, - 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, - 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, - 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, - 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, - 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, - 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, - 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857, -} -var td2 = [256]uint32{ - 0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, - 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, - 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, - 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, - 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, - 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, - 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, - 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, - 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, - 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, - 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, - 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, - 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, - 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, - 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, - 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, - 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, - 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, - 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, - 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, - 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, - 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, - 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, - 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, - 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, - 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, - 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, - 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, - 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, - 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, - 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, - 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8, -} -var td3 = [256]uint32{ - 0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, - 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, - 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, - 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, - 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, - 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, - 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, - 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, - 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, - 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, - 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, - 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, - 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, - 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, - 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, - 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, - 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, - 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, - 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, - 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, - 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, - 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, - 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, - 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, - 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, - 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, - 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, - 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, - 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, - 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, - 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, - 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0, -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/benchmark_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/benchmark_test.go deleted file mode 100644 index 027b24851055080af962b010609e510d7c7c8b36..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/benchmark_test.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -import ( - "crypto/aes" - "crypto/cipher" - "testing" -) - -func BenchmarkAESGCMSeal1K(b *testing.B) { - buf := make([]byte, 1024) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var nonce [12]byte - aes, _ := aes.NewCipher(key[:]) - aesgcm, _ := cipher.NewGCM(aes) - var out []byte - - b.ResetTimer() - for i := 0; i < b.N; i++ { - out = aesgcm.Seal(out[:0], nonce[:], buf, nonce[:]) - } -} - -func BenchmarkAESGCMOpen1K(b *testing.B) { - buf := make([]byte, 1024) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var nonce [12]byte - aes, _ := aes.NewCipher(key[:]) - aesgcm, _ := cipher.NewGCM(aes) - var out []byte - out = aesgcm.Seal(out[:0], nonce[:], buf, nonce[:]) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - _, err := aesgcm.Open(buf[:0], nonce[:], out, nonce[:]) - if err != nil { - b.Errorf("Open: %v", err) - } - } -} - -// If we test exactly 1K blocks, we would generate exact multiples of -// the cipher's block size, and the cipher stream fragments would -// always be wordsize aligned, whereas non-aligned is a more typical -// use-case. -const almost1K = 1024 - 5 - -func BenchmarkAESCFBEncrypt1K(b *testing.B) { - buf := make([]byte, almost1K) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - ctr := cipher.NewCFBEncrypter(aes, iv[:]) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - ctr.XORKeyStream(buf, buf) - } -} - -func BenchmarkAESCFBDecrypt1K(b *testing.B) { - buf := make([]byte, almost1K) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - ctr := cipher.NewCFBDecrypter(aes, iv[:]) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - ctr.XORKeyStream(buf, buf) - } -} - -func BenchmarkAESOFB1K(b *testing.B) { - buf := make([]byte, almost1K) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - ctr := cipher.NewOFB(aes, iv[:]) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - ctr.XORKeyStream(buf, buf) - } -} - -func BenchmarkAESCTR1K(b *testing.B) { - buf := make([]byte, almost1K) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - ctr := cipher.NewCTR(aes, iv[:]) - - b.ResetTimer() - for i := 0; i < b.N; i++ { - ctr.XORKeyStream(buf, buf) - } -} - -func BenchmarkAESCBCEncrypt1K(b *testing.B) { - buf := make([]byte, 1024) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - cbc := cipher.NewCBCEncrypter(aes, iv[:]) - for i := 0; i < b.N; i++ { - cbc.CryptBlocks(buf, buf) - } -} - -func BenchmarkAESCBCDecrypt1K(b *testing.B) { - buf := make([]byte, 1024) - b.SetBytes(int64(len(buf))) - - var key [16]byte - var iv [16]byte - aes, _ := aes.NewCipher(key[:]) - cbc := cipher.NewCBCDecrypter(aes, iv[:]) - for i := 0; i < b.N; i++ { - cbc.CryptBlocks(buf, buf) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc.go deleted file mode 100644 index 241e122ee80079e31e36d6b545ba9b00a4893fd6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Cipher block chaining (CBC) mode. - -// CBC provides confidentiality by xoring (chaining) each plaintext block -// with the previous ciphertext block before applying the block cipher. - -// See NIST SP 800-38A, pp 10-11 - -package cipher - -type cbc struct { - b Block - blockSize int - iv []byte - tmp []byte -} - -func newCBC(b Block, iv []byte) *cbc { - return &cbc{ - b: b, - blockSize: b.BlockSize(), - iv: dup(iv), - tmp: make([]byte, b.BlockSize()), - } -} - -type cbcEncrypter cbc - -// NewCBCEncrypter returns a BlockMode which encrypts in cipher block chaining -// mode, using the given Block. The length of iv must be the same as the -// Block's block size. -func NewCBCEncrypter(b Block, iv []byte) BlockMode { - if len(iv) != b.BlockSize() { - panic("cipher.NewCBCEncrypter: IV length must equal block size") - } - return (*cbcEncrypter)(newCBC(b, iv)) -} - -func (x *cbcEncrypter) BlockSize() int { return x.blockSize } - -func (x *cbcEncrypter) CryptBlocks(dst, src []byte) { - if len(src)%x.blockSize != 0 { - panic("crypto/cipher: input not full blocks") - } - if len(dst) < len(src) { - panic("crypto/cipher: output smaller than input") - } - - iv := x.iv - - for len(src) > 0 { - // Write the xor to dst, then encrypt in place. - xorBytes(dst[:x.blockSize], src[:x.blockSize], iv) - x.b.Encrypt(dst[:x.blockSize], dst[:x.blockSize]) - - // Move to the next block with this block as the next iv. - iv = dst[:x.blockSize] - src = src[x.blockSize:] - dst = dst[x.blockSize:] - } - - // Save the iv for the next CryptBlocks call. - copy(x.iv, iv) -} - -func (x *cbcEncrypter) SetIV(iv []byte) { - if len(iv) != len(x.iv) { - panic("cipher: incorrect length IV") - } - copy(x.iv, iv) -} - -type cbcDecrypter cbc - -// NewCBCDecrypter returns a BlockMode which decrypts in cipher block chaining -// mode, using the given Block. The length of iv must be the same as the -// Block's block size and must match the iv used to encrypt the data. -func NewCBCDecrypter(b Block, iv []byte) BlockMode { - if len(iv) != b.BlockSize() { - panic("cipher.NewCBCDecrypter: IV length must equal block size") - } - return (*cbcDecrypter)(newCBC(b, iv)) -} - -func (x *cbcDecrypter) BlockSize() int { return x.blockSize } - -func (x *cbcDecrypter) CryptBlocks(dst, src []byte) { - if len(src)%x.blockSize != 0 { - panic("crypto/cipher: input not full blocks") - } - if len(dst) < len(src) { - panic("crypto/cipher: output smaller than input") - } - if len(src) == 0 { - return - } - - // For each block, we need to xor the decrypted data with the previous block's ciphertext (the iv). - // To avoid making a copy each time, we loop over the blocks BACKWARDS. - end := len(src) - start := end - x.blockSize - prev := start - x.blockSize - - // Copy the last block of ciphertext in preparation as the new iv. - copy(x.tmp, src[start:end]) - - // Loop over all but the first block. - for start > 0 { - x.b.Decrypt(dst[start:end], src[start:end]) - xorBytes(dst[start:end], dst[start:end], src[prev:start]) - - end = start - start = prev - prev -= x.blockSize - } - - // The first block is special because it uses the saved iv. - x.b.Decrypt(dst[start:end], src[start:end]) - xorBytes(dst[start:end], dst[start:end], x.iv) - - // Set the new iv to the first block we copied earlier. - x.iv, x.tmp = x.tmp, x.iv -} - -func (x *cbcDecrypter) SetIV(iv []byte) { - if len(iv) != len(x.iv) { - panic("cipher: incorrect length IV") - } - copy(x.iv, iv) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc_aes_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc_aes_test.go deleted file mode 100644 index bf9e7ad7018a290cbd199cd50ebd49e12cae3068..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cbc_aes_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// CBC AES test vectors. - -// See U.S. National Institute of Standards and Technology (NIST) -// Special Publication 800-38A, ``Recommendation for Block Cipher -// Modes of Operation,'' 2001 Edition, pp. 24-29. - -package cipher_test - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "testing" -) - -var cbcAESTests = []struct { - name string - key []byte - iv []byte - in []byte - out []byte -}{ - // NIST SP 800-38A pp 27-29 - { - "CBC-AES128", - commonKey128, - commonIV, - commonInput, - []byte{ - 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, - 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2, - 0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16, - 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7, - }, - }, - { - "CBC-AES192", - commonKey192, - commonIV, - commonInput, - []byte{ - 0x4f, 0x02, 0x1d, 0xb2, 0x43, 0xbc, 0x63, 0x3d, 0x71, 0x78, 0x18, 0x3a, 0x9f, 0xa0, 0x71, 0xe8, - 0xb4, 0xd9, 0xad, 0xa9, 0xad, 0x7d, 0xed, 0xf4, 0xe5, 0xe7, 0x38, 0x76, 0x3f, 0x69, 0x14, 0x5a, - 0x57, 0x1b, 0x24, 0x20, 0x12, 0xfb, 0x7a, 0xe0, 0x7f, 0xa9, 0xba, 0xac, 0x3d, 0xf1, 0x02, 0xe0, - 0x08, 0xb0, 0xe2, 0x79, 0x88, 0x59, 0x88, 0x81, 0xd9, 0x20, 0xa9, 0xe6, 0x4f, 0x56, 0x15, 0xcd, - }, - }, - { - "CBC-AES256", - commonKey256, - commonIV, - commonInput, - []byte{ - 0xf5, 0x8c, 0x4c, 0x04, 0xd6, 0xe5, 0xf1, 0xba, 0x77, 0x9e, 0xab, 0xfb, 0x5f, 0x7b, 0xfb, 0xd6, - 0x9c, 0xfc, 0x4e, 0x96, 0x7e, 0xdb, 0x80, 0x8d, 0x67, 0x9f, 0x77, 0x7b, 0xc6, 0x70, 0x2c, 0x7d, - 0x39, 0xf2, 0x33, 0x69, 0xa9, 0xd9, 0xba, 0xcf, 0xa5, 0x30, 0xe2, 0x63, 0x04, 0x23, 0x14, 0x61, - 0xb2, 0xeb, 0x05, 0xe2, 0xc3, 0x9b, 0xe9, 0xfc, 0xda, 0x6c, 0x19, 0x07, 0x8c, 0x6a, 0x9d, 0x1b, - }, - }, -} - -func TestCBCEncrypterAES(t *testing.T) { - for _, test := range cbcAESTests { - c, err := aes.NewCipher(test.key) - if err != nil { - t.Errorf("%s: NewCipher(%d bytes) = %s", test.name, len(test.key), err) - continue - } - - encrypter := cipher.NewCBCEncrypter(c, test.iv) - - data := make([]byte, len(test.in)) - copy(data, test.in) - - encrypter.CryptBlocks(data, data) - if !bytes.Equal(test.out, data) { - t.Errorf("%s: CBCEncrypter\nhave %x\nwant %x", test.name, data, test.out) - } - } -} - -func TestCBCDecrypterAES(t *testing.T) { - for _, test := range cbcAESTests { - c, err := aes.NewCipher(test.key) - if err != nil { - t.Errorf("%s: NewCipher(%d bytes) = %s", test.name, len(test.key), err) - continue - } - - decrypter := cipher.NewCBCDecrypter(c, test.iv) - - data := make([]byte, len(test.out)) - copy(data, test.out) - - decrypter.CryptBlocks(data, data) - if !bytes.Equal(test.in, data) { - t.Errorf("%s: CBCDecrypter\nhave %x\nwant %x", test.name, data, test.in) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb.go deleted file mode 100644 index 9b4eebf5b454164c794e6e166f1e2769a1c3adbd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// CFB (Cipher Feedback) Mode. - -package cipher - -type cfb struct { - b Block - next []byte - out []byte - outUsed int - - decrypt bool -} - -func (x *cfb) XORKeyStream(dst, src []byte) { - for len(src) > 0 { - if x.outUsed == len(x.out) { - x.b.Encrypt(x.out, x.next) - x.outUsed = 0 - } - - if x.decrypt { - // We can precompute a larger segment of the - // keystream on decryption. This will allow - // larger batches for xor, and we should be - // able to match CTR/OFB performance. - copy(x.next[x.outUsed:], src) - } - n := xorBytes(dst, src, x.out[x.outUsed:]) - if !x.decrypt { - copy(x.next[x.outUsed:], dst) - } - dst = dst[n:] - src = src[n:] - x.outUsed += n - } -} - -// NewCFBEncrypter returns a Stream which encrypts with cipher feedback mode, -// using the given Block. The iv must be the same length as the Block's block -// size. -func NewCFBEncrypter(block Block, iv []byte) Stream { - return newCFB(block, iv, false) -} - -// NewCFBDecrypter returns a Stream which decrypts with cipher feedback mode, -// using the given Block. The iv must be the same length as the Block's block -// size. -func NewCFBDecrypter(block Block, iv []byte) Stream { - return newCFB(block, iv, true) -} - -func newCFB(block Block, iv []byte, decrypt bool) Stream { - blockSize := block.BlockSize() - if len(iv) != blockSize { - // stack trace will indicate whether it was de or encryption - panic("cipher.newCFB: IV length must equal block size") - } - x := &cfb{ - b: block, - out: make([]byte, blockSize), - next: make([]byte, blockSize), - outUsed: blockSize, - decrypt: decrypt, - } - copy(x.next, iv) - - return x -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb_test.go deleted file mode 100644 index 9b544bb2118b70226c1e6d143f8d5aea971ec989..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cfb_test.go +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/hex" - "testing" -) - -// cfbTests contains the test vectors from -// http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, section -// F.3.13. -var cfbTests = []struct { - key, iv, plaintext, ciphertext string -}{ - { - "2b7e151628aed2a6abf7158809cf4f3c", - "000102030405060708090a0b0c0d0e0f", - "6bc1bee22e409f96e93d7e117393172a", - "3b3fd92eb72dad20333449f8e83cfb4a", - }, - { - "2b7e151628aed2a6abf7158809cf4f3c", - "3B3FD92EB72DAD20333449F8E83CFB4A", - "ae2d8a571e03ac9c9eb76fac45af8e51", - "c8a64537a0b3a93fcde3cdad9f1ce58b", - }, - { - "2b7e151628aed2a6abf7158809cf4f3c", - "C8A64537A0B3A93FCDE3CDAD9F1CE58B", - "30c81c46a35ce411e5fbc1191a0a52ef", - "26751f67a3cbb140b1808cf187a4f4df", - }, - { - "2b7e151628aed2a6abf7158809cf4f3c", - "26751F67A3CBB140B1808CF187A4F4DF", - "f69f2445df4f9b17ad2b417be66c3710", - "c04b05357c5d1c0eeac4c66f9ff7f2e6", - }, -} - -func TestCFBVectors(t *testing.T) { - for i, test := range cfbTests { - key, err := hex.DecodeString(test.key) - if err != nil { - t.Fatal(err) - } - iv, err := hex.DecodeString(test.iv) - if err != nil { - t.Fatal(err) - } - plaintext, err := hex.DecodeString(test.plaintext) - if err != nil { - t.Fatal(err) - } - expected, err := hex.DecodeString(test.ciphertext) - if err != nil { - t.Fatal(err) - } - - block, err := aes.NewCipher(key) - if err != nil { - t.Fatal(err) - } - - ciphertext := make([]byte, len(plaintext)) - cfb := cipher.NewCFBEncrypter(block, iv) - cfb.XORKeyStream(ciphertext, plaintext) - - if !bytes.Equal(ciphertext, expected) { - t.Errorf("#%d: wrong output: got %x, expected %x", i, ciphertext, expected) - } - - cfbdec := cipher.NewCFBDecrypter(block, iv) - plaintextCopy := make([]byte, len(ciphertext)) - cfbdec.XORKeyStream(plaintextCopy, ciphertext) - - if !bytes.Equal(plaintextCopy, plaintextCopy) { - t.Errorf("#%d: wrong plaintext: got %x, expected %x", i, plaintextCopy, plaintext) - } - } -} - -func TestCFBInverse(t *testing.T) { - block, err := aes.NewCipher(commonKey128) - if err != nil { - t.Error(err) - return - } - - plaintext := []byte("this is the plaintext. this is the plaintext.") - iv := make([]byte, block.BlockSize()) - rand.Reader.Read(iv) - cfb := cipher.NewCFBEncrypter(block, iv) - ciphertext := make([]byte, len(plaintext)) - copy(ciphertext, plaintext) - cfb.XORKeyStream(ciphertext, ciphertext) - - cfbdec := cipher.NewCFBDecrypter(block, iv) - plaintextCopy := make([]byte, len(plaintext)) - copy(plaintextCopy, ciphertext) - cfbdec.XORKeyStream(plaintextCopy, plaintextCopy) - - if !bytes.Equal(plaintextCopy, plaintext) { - t.Errorf("got: %x, want: %x", plaintextCopy, plaintext) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher.go deleted file mode 100644 index 7d27fde61d8fac2a0fd63548d35d0b8bf02a7493..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package cipher implements standard block cipher modes that can be wrapped -// around low-level block cipher implementations. -// See http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html -// and NIST Special Publication 800-38A. -package cipher - -// A Block represents an implementation of block cipher -// using a given key. It provides the capability to encrypt -// or decrypt individual blocks. The mode implementations -// extend that capability to streams of blocks. -type Block interface { - // BlockSize returns the cipher's block size. - BlockSize() int - - // Encrypt encrypts the first block in src into dst. - // Dst and src may point at the same memory. - Encrypt(dst, src []byte) - - // Decrypt decrypts the first block in src into dst. - // Dst and src may point at the same memory. - Decrypt(dst, src []byte) -} - -// A Stream represents a stream cipher. -type Stream interface { - // XORKeyStream XORs each byte in the given slice with a byte from the - // cipher's key stream. Dst and src may point to the same memory. - // If len(dst) < len(src), XORKeyStream should panic. It is acceptable - // to pass a dst bigger than src, and in that case, XORKeyStream will - // only update dst[:len(src)] and will not touch the rest of dst. - XORKeyStream(dst, src []byte) -} - -// A BlockMode represents a block cipher running in a block-based mode (CBC, -// ECB etc). -type BlockMode interface { - // BlockSize returns the mode's block size. - BlockSize() int - - // CryptBlocks encrypts or decrypts a number of blocks. The length of - // src must be a multiple of the block size. Dst and src may point to - // the same memory. - CryptBlocks(dst, src []byte) -} - -// Utility routines - -func dup(p []byte) []byte { - q := make([]byte, len(p)) - copy(q, p) - return q -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher_test.go deleted file mode 100644 index 8da5bce93ff01261e581900c8e9b668a72efe418..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/cipher_test.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -import ( - "crypto/aes" - "crypto/cipher" - "testing" -) - -func TestCryptBlocks(t *testing.T) { - buf := make([]byte, 16) - block, _ := aes.NewCipher(buf) - - mode := cipher.NewCBCDecrypter(block, buf) - mustPanic(t, "crypto/cipher: input not full blocks", func() { mode.CryptBlocks(buf, buf[:3]) }) - mustPanic(t, "crypto/cipher: output smaller than input", func() { mode.CryptBlocks(buf[:3], buf) }) - - mode = cipher.NewCBCEncrypter(block, buf) - mustPanic(t, "crypto/cipher: input not full blocks", func() { mode.CryptBlocks(buf, buf[:3]) }) - mustPanic(t, "crypto/cipher: output smaller than input", func() { mode.CryptBlocks(buf[:3], buf) }) -} - -func mustPanic(t *testing.T, msg string, f func()) { - defer func() { - err := recover() - if err == nil { - t.Errorf("function did not panic, wanted %q", msg) - } else if err != msg { - t.Errorf("got panic %v, wanted %q", err, msg) - } - }() - f() -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/common_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/common_test.go deleted file mode 100644 index c75c919d1758078aa280e712b205dd66b40db614..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/common_test.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -// Common values for tests. - -var commonInput = []byte{ - 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, - 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, - 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, - 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10, -} - -var commonKey128 = []byte{0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c} - -var commonKey192 = []byte{ - 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52, 0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5, - 0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b, -} - -var commonKey256 = []byte{ - 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe, 0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81, - 0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7, 0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4, -} - -var commonIV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr.go deleted file mode 100644 index 70ac40f6a7afbd32d58658bd57120c3bc685c899..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Counter (CTR) mode. - -// CTR converts a block cipher into a stream cipher by -// repeatedly encrypting an incrementing counter and -// xoring the resulting stream of data with the input. - -// See NIST SP 800-38A, pp 13-15 - -package cipher - -type ctr struct { - b Block - ctr []byte - out []byte - outUsed int -} - -const streamBufferSize = 512 - -// NewCTR returns a Stream which encrypts/decrypts using the given Block in -// counter mode. The length of iv must be the same as the Block's block size. -func NewCTR(block Block, iv []byte) Stream { - if len(iv) != block.BlockSize() { - panic("cipher.NewCTR: IV length must equal block size") - } - bufSize := streamBufferSize - if bufSize < block.BlockSize() { - bufSize = block.BlockSize() - } - return &ctr{ - b: block, - ctr: dup(iv), - out: make([]byte, 0, bufSize), - outUsed: 0, - } -} - -func (x *ctr) refill() { - remain := len(x.out) - x.outUsed - if remain > x.outUsed { - return - } - copy(x.out, x.out[x.outUsed:]) - x.out = x.out[:cap(x.out)] - bs := x.b.BlockSize() - for remain < len(x.out)-bs { - x.b.Encrypt(x.out[remain:], x.ctr) - remain += bs - - // Increment counter - for i := len(x.ctr) - 1; i >= 0; i-- { - x.ctr[i]++ - if x.ctr[i] != 0 { - break - } - } - } - x.out = x.out[:remain] - x.outUsed = 0 -} - -func (x *ctr) XORKeyStream(dst, src []byte) { - for len(src) > 0 { - if x.outUsed >= len(x.out)-x.b.BlockSize() { - x.refill() - } - n := xorBytes(dst, src, x.out[x.outUsed:]) - dst = dst[n:] - src = src[n:] - x.outUsed += n - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr_aes_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr_aes_test.go deleted file mode 100644 index d019ae0d022eb803e6a00ca74e23bad5b973ea58..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ctr_aes_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// CTR AES test vectors. - -// See U.S. National Institute of Standards and Technology (NIST) -// Special Publication 800-38A, ``Recommendation for Block Cipher -// Modes of Operation,'' 2001 Edition, pp. 55-58. - -package cipher_test - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "testing" -) - -var commonCounter = []byte{0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff} - -var ctrAESTests = []struct { - name string - key []byte - iv []byte - in []byte - out []byte -}{ - // NIST SP 800-38A pp 55-58 - { - "CTR-AES128", - commonKey128, - commonCounter, - commonInput, - []byte{ - 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26, 0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, - 0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff, 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff, - 0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e, 0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab, - 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1, 0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee, - }, - }, - { - "CTR-AES192", - commonKey192, - commonCounter, - commonInput, - []byte{ - 0x1a, 0xbc, 0x93, 0x24, 0x17, 0x52, 0x1c, 0xa2, 0x4f, 0x2b, 0x04, 0x59, 0xfe, 0x7e, 0x6e, 0x0b, - 0x09, 0x03, 0x39, 0xec, 0x0a, 0xa6, 0xfa, 0xef, 0xd5, 0xcc, 0xc2, 0xc6, 0xf4, 0xce, 0x8e, 0x94, - 0x1e, 0x36, 0xb2, 0x6b, 0xd1, 0xeb, 0xc6, 0x70, 0xd1, 0xbd, 0x1d, 0x66, 0x56, 0x20, 0xab, 0xf7, - 0x4f, 0x78, 0xa7, 0xf6, 0xd2, 0x98, 0x09, 0x58, 0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50, - }, - }, - { - "CTR-AES256", - commonKey256, - commonCounter, - commonInput, - []byte{ - 0x60, 0x1e, 0xc3, 0x13, 0x77, 0x57, 0x89, 0xa5, 0xb7, 0xa7, 0xf5, 0x04, 0xbb, 0xf3, 0xd2, 0x28, - 0xf4, 0x43, 0xe3, 0xca, 0x4d, 0x62, 0xb5, 0x9a, 0xca, 0x84, 0xe9, 0x90, 0xca, 0xca, 0xf5, 0xc5, - 0x2b, 0x09, 0x30, 0xda, 0xa2, 0x3d, 0xe9, 0x4c, 0xe8, 0x70, 0x17, 0xba, 0x2d, 0x84, 0x98, 0x8d, - 0xdf, 0xc9, 0xc5, 0x8d, 0xb6, 0x7a, 0xad, 0xa6, 0x13, 0xc2, 0xdd, 0x08, 0x45, 0x79, 0x41, 0xa6, - }, - }, -} - -func TestCTR_AES(t *testing.T) { - for _, tt := range ctrAESTests { - test := tt.name - - c, err := aes.NewCipher(tt.key) - if err != nil { - t.Errorf("%s: NewCipher(%d bytes) = %s", test, len(tt.key), err) - continue - } - - for j := 0; j <= 5; j += 5 { - in := tt.in[0 : len(tt.in)-j] - ctr := cipher.NewCTR(c, tt.iv) - encrypted := make([]byte, len(in)) - ctr.XORKeyStream(encrypted, in) - if out := tt.out[0:len(in)]; !bytes.Equal(out, encrypted) { - t.Errorf("%s/%d: CTR\ninpt %x\nhave %x\nwant %x", test, len(in), in, encrypted, out) - } - } - - for j := 0; j <= 7; j += 7 { - in := tt.out[0 : len(tt.out)-j] - ctr := cipher.NewCTR(c, tt.iv) - plain := make([]byte, len(in)) - ctr.XORKeyStream(plain, in) - if out := tt.in[0:len(in)]; !bytes.Equal(out, plain) { - t.Errorf("%s/%d: CTRReader\nhave %x\nwant %x", test, len(out), plain, out) - } - } - - if t.Failed() { - break - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/example_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/example_test.go deleted file mode 100644 index 1cfa982df4ba4d7de1fa2db172078002ed64a6dc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/example_test.go +++ /dev/null @@ -1,283 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/rand" - "encoding/hex" - "fmt" - "io" - "os" -) - -func ExampleNewCBCDecrypter() { - key := []byte("example key 1234") - ciphertext, _ := hex.DecodeString("f363f3ccdcb12bb883abf484ba77d9cd7d32b5baecb3d4b1b3e0e4beffdb3ded") - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - if len(ciphertext) < aes.BlockSize { - panic("ciphertext too short") - } - iv := ciphertext[:aes.BlockSize] - ciphertext = ciphertext[aes.BlockSize:] - - // CBC mode always works in whole blocks. - if len(ciphertext)%aes.BlockSize != 0 { - panic("ciphertext is not a multiple of the block size") - } - - mode := cipher.NewCBCDecrypter(block, iv) - - // CryptBlocks can work in-place if the two arguments are the same. - mode.CryptBlocks(ciphertext, ciphertext) - - // If the original plaintext lengths are not a multiple of the block - // size, padding would have to be added when encrypting, which would be - // removed at this point. For an example, see - // https://tools.ietf.org/html/rfc5246#section-6.2.3.2. However, it's - // critical to note that ciphertexts must be authenticated (i.e. by - // using crypto/hmac) before being decrypted in order to avoid creating - // a padding oracle. - - fmt.Printf("%s\n", ciphertext) - // Output: exampleplaintext -} - -func ExampleNewCBCEncrypter() { - key := []byte("example key 1234") - plaintext := []byte("exampleplaintext") - - // CBC mode works on blocks so plaintexts may need to be padded to the - // next whole block. For an example of such padding, see - // https://tools.ietf.org/html/rfc5246#section-6.2.3.2. Here we'll - // assume that the plaintext is already of the correct length. - if len(plaintext)%aes.BlockSize != 0 { - panic("plaintext is not a multiple of the block size") - } - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - ciphertext := make([]byte, aes.BlockSize+len(plaintext)) - iv := ciphertext[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - panic(err) - } - - mode := cipher.NewCBCEncrypter(block, iv) - mode.CryptBlocks(ciphertext[aes.BlockSize:], plaintext) - - // It's important to remember that ciphertexts must be authenticated - // (i.e. by using crypto/hmac) as well as being encrypted in order to - // be secure. - - fmt.Printf("%x\n", ciphertext) -} - -func ExampleNewCFBDecrypter() { - key := []byte("example key 1234") - ciphertext, _ := hex.DecodeString("22277966616d9bc47177bd02603d08c9a67d5380d0fe8cf3b44438dff7b9") - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - if len(ciphertext) < aes.BlockSize { - panic("ciphertext too short") - } - iv := ciphertext[:aes.BlockSize] - ciphertext = ciphertext[aes.BlockSize:] - - stream := cipher.NewCFBDecrypter(block, iv) - - // XORKeyStream can work in-place if the two arguments are the same. - stream.XORKeyStream(ciphertext, ciphertext) - fmt.Printf("%s", ciphertext) - // Output: some plaintext -} - -func ExampleNewCFBEncrypter() { - key := []byte("example key 1234") - plaintext := []byte("some plaintext") - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - ciphertext := make([]byte, aes.BlockSize+len(plaintext)) - iv := ciphertext[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - panic(err) - } - - stream := cipher.NewCFBEncrypter(block, iv) - stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) - - // It's important to remember that ciphertexts must be authenticated - // (i.e. by using crypto/hmac) as well as being encrypted in order to - // be secure. -} - -func ExampleNewCTR() { - key := []byte("example key 1234") - plaintext := []byte("some plaintext") - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - ciphertext := make([]byte, aes.BlockSize+len(plaintext)) - iv := ciphertext[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - panic(err) - } - - stream := cipher.NewCTR(block, iv) - stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) - - // It's important to remember that ciphertexts must be authenticated - // (i.e. by using crypto/hmac) as well as being encrypted in order to - // be secure. - - // CTR mode is the same for both encryption and decryption, so we can - // also decrypt that ciphertext with NewCTR. - - plaintext2 := make([]byte, len(plaintext)) - stream = cipher.NewCTR(block, iv) - stream.XORKeyStream(plaintext2, ciphertext[aes.BlockSize:]) - - fmt.Printf("%s\n", plaintext2) - // Output: some plaintext -} - -func ExampleNewOFB() { - key := []byte("example key 1234") - plaintext := []byte("some plaintext") - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // The IV needs to be unique, but not secure. Therefore it's common to - // include it at the beginning of the ciphertext. - ciphertext := make([]byte, aes.BlockSize+len(plaintext)) - iv := ciphertext[:aes.BlockSize] - if _, err := io.ReadFull(rand.Reader, iv); err != nil { - panic(err) - } - - stream := cipher.NewOFB(block, iv) - stream.XORKeyStream(ciphertext[aes.BlockSize:], plaintext) - - // It's important to remember that ciphertexts must be authenticated - // (i.e. by using crypto/hmac) as well as being encrypted in order to - // be secure. - - // OFB mode is the same for both encryption and decryption, so we can - // also decrypt that ciphertext with NewOFB. - - plaintext2 := make([]byte, len(plaintext)) - stream = cipher.NewOFB(block, iv) - stream.XORKeyStream(plaintext2, ciphertext[aes.BlockSize:]) - - fmt.Printf("%s\n", plaintext2) - // Output: some plaintext -} - -func ExampleStreamReader() { - key := []byte("example key 1234") - - inFile, err := os.Open("encrypted-file") - if err != nil { - panic(err) - } - defer inFile.Close() - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // If the key is unique for each ciphertext, then it's ok to use a zero - // IV. - var iv [aes.BlockSize]byte - stream := cipher.NewOFB(block, iv[:]) - - outFile, err := os.OpenFile("decrypted-file", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - panic(err) - } - defer outFile.Close() - - reader := &cipher.StreamReader{S: stream, R: inFile} - // Copy the input file to the output file, decrypting as we go. - if _, err := io.Copy(outFile, reader); err != nil { - panic(err) - } - - // Note that this example is simplistic in that it omits any - // authentication of the encrypted data. If you were actually to use - // StreamReader in this manner, an attacker could flip arbitrary bits in - // the output. -} - -func ExampleStreamWriter() { - key := []byte("example key 1234") - - inFile, err := os.Open("plaintext-file") - if err != nil { - panic(err) - } - defer inFile.Close() - - block, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - - // If the key is unique for each ciphertext, then it's ok to use a zero - // IV. - var iv [aes.BlockSize]byte - stream := cipher.NewOFB(block, iv[:]) - - outFile, err := os.OpenFile("encrypted-file", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - panic(err) - } - defer outFile.Close() - - writer := &cipher.StreamWriter{S: stream, W: outFile} - // Copy the input file to the output file, encrypting as we go. - if _, err := io.Copy(writer, inFile); err != nil { - panic(err) - } - - // Note that this example is simplistic in that it omits any - // authentication of the encrypted data. If you were actually to use - // StreamReader in this manner, an attacker could flip arbitrary bits in - // the decrypted result. -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm.go deleted file mode 100644 index bbdf9f5d3df7eb9da5a97c0330f55b2486de8c1e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm.go +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher - -import ( - "crypto/subtle" - "errors" -) - -// AEAD is a cipher mode providing authenticated encryption with associated -// data. -type AEAD interface { - // NonceSize returns the size of the nonce that must be passed to Seal - // and Open. - NonceSize() int - - // Overhead returns the maximum difference between the lengths of a - // plaintext and ciphertext. - Overhead() int - - // Seal encrypts and authenticates plaintext, authenticates the - // additional data and appends the result to dst, returning the updated - // slice. The nonce must be NonceSize() bytes long and unique for all - // time, for a given key. - // - // The plaintext and dst may alias exactly or not at all. - Seal(dst, nonce, plaintext, data []byte) []byte - - // Open decrypts and authenticates ciphertext, authenticates the - // additional data and, if successful, appends the resulting plaintext - // to dst, returning the updated slice. The nonce must be NonceSize() - // bytes long and both it and the additional data must match the - // value passed to Seal. - // - // The ciphertext and dst may alias exactly or not at all. - Open(dst, nonce, ciphertext, data []byte) ([]byte, error) -} - -// gcmFieldElement represents a value in GF(2¹²⁸). In order to reflect the GCM -// standard and make getUint64 suitable for marshaling these values, the bits -// are stored backwards. For example: -// the coefficient of x⁰ can be obtained by v.low >> 63. -// the coefficient of x⁶³ can be obtained by v.low & 1. -// the coefficient of x⁶⁴ can be obtained by v.high >> 63. -// the coefficient of x¹²⁷ can be obtained by v.high & 1. -type gcmFieldElement struct { - low, high uint64 -} - -// gcm represents a Galois Counter Mode with a specific key. See -// http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf -type gcm struct { - cipher Block - nonceSize int - // productTable contains the first sixteen powers of the key, H. - // However, they are in bit reversed order. See NewGCMWithNonceSize. - productTable [16]gcmFieldElement -} - -// NewGCM returns the given 128-bit, block cipher wrapped in Galois Counter Mode -// with the standard nonce length. -func NewGCM(cipher Block) (AEAD, error) { - return NewGCMWithNonceSize(cipher, gcmStandardNonceSize) -} - -// NewGCMWithNonceSize returns the given 128-bit, block cipher wrapped in Galois -// Counter Mode, which accepts nonces of the given length. -// -// Only use this function if you require compatibility with an existing -// cryptosystem that uses non-standard nonce lengths. All other users should use -// NewGCM, which is faster and more resistant to misuse. -func NewGCMWithNonceSize(cipher Block, size int) (AEAD, error) { - if cipher.BlockSize() != gcmBlockSize { - return nil, errors.New("cipher: NewGCM requires 128-bit block cipher") - } - - var key [gcmBlockSize]byte - cipher.Encrypt(key[:], key[:]) - - g := &gcm{cipher: cipher, nonceSize: size} - - // We precompute 16 multiples of |key|. However, when we do lookups - // into this table we'll be using bits from a field element and - // therefore the bits will be in the reverse order. So normally one - // would expect, say, 4*key to be in index 4 of the table but due to - // this bit ordering it will actually be in index 0010 (base 2) = 2. - x := gcmFieldElement{ - getUint64(key[:8]), - getUint64(key[8:]), - } - g.productTable[reverseBits(1)] = x - - for i := 2; i < 16; i += 2 { - g.productTable[reverseBits(i)] = gcmDouble(&g.productTable[reverseBits(i/2)]) - g.productTable[reverseBits(i+1)] = gcmAdd(&g.productTable[reverseBits(i)], &x) - } - - return g, nil -} - -const ( - gcmBlockSize = 16 - gcmTagSize = 16 - gcmStandardNonceSize = 12 -) - -func (g *gcm) NonceSize() int { - return g.nonceSize -} - -func (*gcm) Overhead() int { - return gcmTagSize -} - -func (g *gcm) Seal(dst, nonce, plaintext, data []byte) []byte { - if len(nonce) != g.nonceSize { - panic("cipher: incorrect nonce length given to GCM") - } - ret, out := sliceForAppend(dst, len(plaintext)+gcmTagSize) - - var counter, tagMask [gcmBlockSize]byte - g.deriveCounter(&counter, nonce) - - g.cipher.Encrypt(tagMask[:], counter[:]) - gcmInc32(&counter) - - g.counterCrypt(out, plaintext, &counter) - g.auth(out[len(plaintext):], out[:len(plaintext)], data, &tagMask) - - return ret -} - -var errOpen = errors.New("cipher: message authentication failed") - -func (g *gcm) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) { - if len(nonce) != g.nonceSize { - panic("cipher: incorrect nonce length given to GCM") - } - - if len(ciphertext) < gcmTagSize { - return nil, errOpen - } - tag := ciphertext[len(ciphertext)-gcmTagSize:] - ciphertext = ciphertext[:len(ciphertext)-gcmTagSize] - - var counter, tagMask [gcmBlockSize]byte - g.deriveCounter(&counter, nonce) - - g.cipher.Encrypt(tagMask[:], counter[:]) - gcmInc32(&counter) - - var expectedTag [gcmTagSize]byte - g.auth(expectedTag[:], ciphertext, data, &tagMask) - - if subtle.ConstantTimeCompare(expectedTag[:], tag) != 1 { - return nil, errOpen - } - - ret, out := sliceForAppend(dst, len(ciphertext)) - g.counterCrypt(out, ciphertext, &counter) - - return ret, nil -} - -// reverseBits reverses the order of the bits of 4-bit number in i. -func reverseBits(i int) int { - i = ((i << 2) & 0xc) | ((i >> 2) & 0x3) - i = ((i << 1) & 0xa) | ((i >> 1) & 0x5) - return i -} - -// gcmAdd adds two elements of GF(2¹²⁸) and returns the sum. -func gcmAdd(x, y *gcmFieldElement) gcmFieldElement { - // Addition in a characteristic 2 field is just XOR. - return gcmFieldElement{x.low ^ y.low, x.high ^ y.high} -} - -// gcmDouble returns the result of doubling an element of GF(2¹²⁸). -func gcmDouble(x *gcmFieldElement) (double gcmFieldElement) { - msbSet := x.high&1 == 1 - - // Because of the bit-ordering, doubling is actually a right shift. - double.high = x.high >> 1 - double.high |= x.low << 63 - double.low = x.low >> 1 - - // If the most-significant bit was set before shifting then it, - // conceptually, becomes a term of x^128. This is greater than the - // irreducible polynomial so the result has to be reduced. The - // irreducible polynomial is 1+x+x^2+x^7+x^128. We can subtract that to - // eliminate the term at x^128 which also means subtracting the other - // four terms. In characteristic 2 fields, subtraction == addition == - // XOR. - if msbSet { - double.low ^= 0xe100000000000000 - } - - return -} - -var gcmReductionTable = []uint16{ - 0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0, - 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0, -} - -// mul sets y to y*H, where H is the GCM key, fixed during NewGCMWithNonceSize. -func (g *gcm) mul(y *gcmFieldElement) { - var z gcmFieldElement - - for i := 0; i < 2; i++ { - word := y.high - if i == 1 { - word = y.low - } - - // Multiplication works by multiplying z by 16 and adding in - // one of the precomputed multiples of H. - for j := 0; j < 64; j += 4 { - msw := z.high & 0xf - z.high >>= 4 - z.high |= z.low << 60 - z.low >>= 4 - z.low ^= uint64(gcmReductionTable[msw]) << 48 - - // the values in |table| are ordered for - // little-endian bit positions. See the comment - // in NewGCMWithNonceSize. - t := &g.productTable[word&0xf] - - z.low ^= t.low - z.high ^= t.high - word >>= 4 - } - } - - *y = z -} - -// updateBlocks extends y with more polynomial terms from blocks, based on -// Horner's rule. There must be a multiple of gcmBlockSize bytes in blocks. -func (g *gcm) updateBlocks(y *gcmFieldElement, blocks []byte) { - for len(blocks) > 0 { - y.low ^= getUint64(blocks) - y.high ^= getUint64(blocks[8:]) - g.mul(y) - blocks = blocks[gcmBlockSize:] - } -} - -// update extends y with more polynomial terms from data. If data is not a -// multiple of gcmBlockSize bytes long then the remainder is zero padded. -func (g *gcm) update(y *gcmFieldElement, data []byte) { - fullBlocks := (len(data) >> 4) << 4 - g.updateBlocks(y, data[:fullBlocks]) - - if len(data) != fullBlocks { - var partialBlock [gcmBlockSize]byte - copy(partialBlock[:], data[fullBlocks:]) - g.updateBlocks(y, partialBlock[:]) - } -} - -// gcmInc32 treats the final four bytes of counterBlock as a big-endian value -// and increments it. -func gcmInc32(counterBlock *[16]byte) { - for i := gcmBlockSize - 1; i >= gcmBlockSize-4; i-- { - counterBlock[i]++ - if counterBlock[i] != 0 { - break - } - } -} - -// sliceForAppend takes a slice and a requested number of bytes. It returns a -// slice with the contents of the given slice followed by that many bytes and a -// second slice that aliases into it and contains only the extra bytes. If the -// original slice has sufficient capacity then no allocation is performed. -func sliceForAppend(in []byte, n int) (head, tail []byte) { - if total := len(in) + n; cap(in) >= total { - head = in[:total] - } else { - head = make([]byte, total) - copy(head, in) - } - tail = head[len(in):] - return -} - -// counterCrypt crypts in to out using g.cipher in counter mode. -func (g *gcm) counterCrypt(out, in []byte, counter *[gcmBlockSize]byte) { - var mask [gcmBlockSize]byte - - for len(in) >= gcmBlockSize { - g.cipher.Encrypt(mask[:], counter[:]) - gcmInc32(counter) - - xorWords(out, in, mask[:]) - out = out[gcmBlockSize:] - in = in[gcmBlockSize:] - } - - if len(in) > 0 { - g.cipher.Encrypt(mask[:], counter[:]) - gcmInc32(counter) - xorBytes(out, in, mask[:]) - } -} - -// deriveCounter computes the initial GCM counter state from the given nonce. -// See NIST SP 800-38D, section 7.1. This assumes that counter is filled with -// zeros on entry. -func (g *gcm) deriveCounter(counter *[gcmBlockSize]byte, nonce []byte) { - // GCM has two modes of operation with respect to the initial counter - // state: a "fast path" for 96-bit (12-byte) nonces, and a "slow path" - // for nonces of other lengths. For a 96-bit nonce, the nonce, along - // with a four-byte big-endian counter starting at one, is used - // directly as the starting counter. For other nonce sizes, the counter - // is computed by passing it through the GHASH function. - if len(nonce) == gcmStandardNonceSize { - copy(counter[:], nonce) - counter[gcmBlockSize-1] = 1 - } else { - var y gcmFieldElement - g.update(&y, nonce) - y.high ^= uint64(len(nonce)) * 8 - g.mul(&y) - putUint64(counter[:8], y.low) - putUint64(counter[8:], y.high) - } -} - -// auth calculates GHASH(ciphertext, additionalData), masks the result with -// tagMask and writes the result to out. -func (g *gcm) auth(out, ciphertext, additionalData []byte, tagMask *[gcmTagSize]byte) { - var y gcmFieldElement - g.update(&y, additionalData) - g.update(&y, ciphertext) - - y.low ^= uint64(len(additionalData)) * 8 - y.high ^= uint64(len(ciphertext)) * 8 - - g.mul(&y) - - putUint64(out, y.low) - putUint64(out[8:], y.high) - - xorWords(out, out, tagMask[:]) -} - -func getUint64(data []byte) uint64 { - r := uint64(data[0])<<56 | - uint64(data[1])<<48 | - uint64(data[2])<<40 | - uint64(data[3])<<32 | - uint64(data[4])<<24 | - uint64(data[5])<<16 | - uint64(data[6])<<8 | - uint64(data[7]) - return r -} - -func putUint64(out []byte, v uint64) { - out[0] = byte(v >> 56) - out[1] = byte(v >> 48) - out[2] = byte(v >> 40) - out[3] = byte(v >> 32) - out[4] = byte(v >> 24) - out[5] = byte(v >> 16) - out[6] = byte(v >> 8) - out[7] = byte(v) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm_test.go deleted file mode 100644 index 81b9aa241912f76fc93d7d9194f5466c4acadfb2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/gcm_test.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher_test - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "encoding/hex" - "testing" -) - -// AES-GCM test vectors taken from gcmEncryptExtIV128.rsp from -// http://csrc.nist.gov/groups/STM/cavp/index.html. -var aesGCMTests = []struct { - key, nonce, plaintext, ad, result string -}{ - { - "11754cd72aec309bf52f7687212e8957", - "3c819d9a9bed087615030b65", - "", - "", - "250327c674aaf477aef2675748cf6971", - }, - { - "ca47248ac0b6f8372a97ac43508308ed", - "ffd2b598feabc9019262d2be", - "", - "", - "60d20404af527d248d893ae495707d1a", - }, - { - "77be63708971c4e240d1cb79e8d77feb", - "e0e00f19fed7ba0136a797f3", - "", - "7a43ec1d9c0a5a78a0b16533a6213cab", - "209fcc8d3675ed938e9c7166709dd946", - }, - { - "7680c5d3ca6154758e510f4d25b98820", - "f8f105f9c3df4965780321f8", - "", - "c94c410194c765e3dcc7964379758ed3", - "94dca8edfcf90bb74b153c8d48a17930", - }, - { - "7fddb57453c241d03efbed3ac44e371c", - "ee283a3fc75575e33efd4887", - "d5de42b461646c255c87bd2962d3b9a2", - "", - "2ccda4a5415cb91e135c2a0f78c9b2fdb36d1df9b9d5e596f83e8b7f52971cb3", - }, - { - "ab72c77b97cb5fe9a382d9fe81ffdbed", - "54cc7dc2c37ec006bcc6d1da", - "007c5e5b3e59df24a7c355584fc1518d", - "", - "0e1bde206a07a9c2c1b65300f8c649972b4401346697138c7a4891ee59867d0c", - }, - { - "fe47fcce5fc32665d2ae399e4eec72ba", - "5adb9609dbaeb58cbd6e7275", - "7c0e88c88899a779228465074797cd4c2e1498d259b54390b85e3eef1c02df60e743f1b840382c4bccaf3bafb4ca8429bea063", - "88319d6e1d3ffa5f987199166c8a9b56c2aeba5a", - "98f4826f05a265e6dd2be82db241c0fbbbf9ffb1c173aa83964b7cf5393043736365253ddbc5db8778371495da76d269e5db3e291ef1982e4defedaa2249f898556b47", - }, - { - "ec0c2ba17aa95cd6afffe949da9cc3a8", - "296bce5b50b7d66096d627ef", - "b85b3753535b825cbe5f632c0b843c741351f18aa484281aebec2f45bb9eea2d79d987b764b9611f6c0f8641843d5d58f3a242", - "f8d00f05d22bf68599bcdeb131292ad6e2df5d14", - "a7443d31c26bdf2a1c945e29ee4bd344a99cfaf3aa71f8b3f191f83c2adfc7a07162995506fde6309ffc19e716eddf1a828c5a890147971946b627c40016da1ecf3e77", - }, - { - "2c1f21cf0f6fb3661943155c3e3d8492", - "23cb5ff362e22426984d1907", - "42f758836986954db44bf37c6ef5e4ac0adaf38f27252a1b82d02ea949c8a1a2dbc0d68b5615ba7c1220ff6510e259f06655d8", - "5d3624879d35e46849953e45a32a624d6a6c536ed9857c613b572b0333e701557a713e3f010ecdf9a6bd6c9e3e44b065208645aff4aabee611b391528514170084ccf587177f4488f33cfb5e979e42b6e1cfc0a60238982a7aec", - "81824f0e0d523db30d3da369fdc0d60894c7a0a20646dd015073ad2732bd989b14a222b6ad57af43e1895df9dca2a5344a62cc57a3ee28136e94c74838997ae9823f3a", - }, - { - "d9f7d2411091f947b4d6f1e2d1f0fb2e", - "e1934f5db57cc983e6b180e7", - "73ed042327f70fe9c572a61545eda8b2a0c6e1d6c291ef19248e973aee6c312012f490c2c6f6166f4a59431e182663fcaea05a", - "0a8a18a7150e940c3d87b38e73baee9a5c049ee21795663e264b694a949822b639092d0e67015e86363583fcf0ca645af9f43375f05fdb4ce84f411dcbca73c2220dea03a20115d2e51398344b16bee1ed7c499b353d6c597af8", - "aaadbd5c92e9151ce3db7210b8714126b73e43436d242677afa50384f2149b831f1d573c7891c2a91fbc48db29967ec9542b2321b51ca862cb637cdd03b99a0f93b134", - }, - { - "fe9bb47deb3a61e423c2231841cfd1fb", - "4d328eb776f500a2f7fb47aa", - "f1cc3818e421876bb6b8bbd6c9", - "", - "b88c5c1977b35b517b0aeae96743fd4727fe5cdb4b5b42818dea7ef8c9", - }, - { - "6703df3701a7f54911ca72e24dca046a", - "12823ab601c350ea4bc2488c", - "793cd125b0b84a043e3ac67717", - "", - "b2051c80014f42f08735a7b0cd38e6bcd29962e5f2c13626b85a877101", - }, - // These cases test non-standard nonce sizes. - { - "1672c3537afa82004c6b8a46f6f0d026", - "05", - "", - "", - "8e2ad721f9455f74d8b53d3141f27e8e", - }, - { - "9a4fea86a621a91ab371e492457796c0", - "75", - "ca6131faf0ff210e4e693d6c31c109fc5b6f54224eb120f37de31dc59ec669b6", - "4f6e2585c161f05a9ae1f2f894e9f0ab52b45d0f", - "5698c0a384241d30004290aac56bb3ece6fe8eacc5c4be98954deb9c3ff6aebf5d50e1af100509e1fba2a5e8a0af9670", - }, - { - "d0f1f4defa1e8c08b4b26d576392027c", - "42b4f01eb9f5a1ea5b1eb73b0fb0baed54f387ecaa0393c7d7dffc6af50146ecc021abf7eb9038d4303d91f8d741a11743166c0860208bcc02c6258fd9511a2fa626f96d60b72fcff773af4e88e7a923506e4916ecbd814651e9f445adef4ad6a6b6c7290cc13b956130eef5b837c939fcac0cbbcc9656cd75b13823ee5acdac", - "", - "", - "7ab49b57ddf5f62c427950111c5c4f0d", - }, - { - "4a0c00a3d284dea9d4bf8b8dde86685e", - "f8cbe82588e784bcacbe092cd9089b51e01527297f635bf294b3aa787d91057ef23869789698ac960707857f163ecb242135a228ad93964f5dc4a4d7f88fd7b3b07dd0a5b37f9768fb05a523639f108c34c661498a56879e501a2321c8a4a94d7e1b89db255ac1f685e185263368e99735ebe62a7f2931b47282be8eb165e4d7", - "6d4bf87640a6a48a50d28797b7", - "8d8c7ffc55086d539b5a8f0d1232654c", - "0d803ec309482f35b8e6226f2b56303239298e06b281c2d51aaba3c125", - }, -} - -func TestAESGCM(t *testing.T) { - for i, test := range aesGCMTests { - key, _ := hex.DecodeString(test.key) - aes, err := aes.NewCipher(key) - if err != nil { - t.Fatal(err) - } - - nonce, _ := hex.DecodeString(test.nonce) - plaintext, _ := hex.DecodeString(test.plaintext) - ad, _ := hex.DecodeString(test.ad) - aesgcm, err := cipher.NewGCMWithNonceSize(aes, len(nonce)) - if err != nil { - t.Fatal(err) - } - - ct := aesgcm.Seal(nil, nonce, plaintext, ad) - if ctHex := hex.EncodeToString(ct); ctHex != test.result { - t.Errorf("#%d: got %s, want %s", i, ctHex, test.result) - continue - } - - plaintext2, err := aesgcm.Open(nil, nonce, ct, ad) - if err != nil { - t.Errorf("#%d: Open failed", i) - continue - } - - if !bytes.Equal(plaintext, plaintext2) { - t.Errorf("#%d: plaintext's don't match: got %x vs %x", i, plaintext2, plaintext) - continue - } - - if len(ad) > 0 { - ad[0] ^= 0x80 - if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { - t.Errorf("#%d: Open was successful after altering additional data", i) - } - ad[0] ^= 0x80 - } - - nonce[0] ^= 0x80 - if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { - t.Errorf("#%d: Open was successful after altering nonce", i) - } - nonce[0] ^= 0x80 - - ct[0] ^= 0x80 - if _, err := aesgcm.Open(nil, nonce, ct, ad); err == nil { - t.Errorf("#%d: Open was successful after altering ciphertext", i) - } - ct[0] ^= 0x80 - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/io.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/io.go deleted file mode 100644 index 3938c0a4c8883e20a0d8989a9786bc09845d5d71..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/io.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher - -import "io" - -// The Stream* objects are so simple that all their members are public. Users -// can create them themselves. - -// StreamReader wraps a Stream into an io.Reader. It calls XORKeyStream -// to process each slice of data which passes through. -type StreamReader struct { - S Stream - R io.Reader -} - -func (r StreamReader) Read(dst []byte) (n int, err error) { - n, err = r.R.Read(dst) - r.S.XORKeyStream(dst[:n], dst[:n]) - return -} - -// StreamWriter wraps a Stream into an io.Writer. It calls XORKeyStream -// to process each slice of data which passes through. If any Write call -// returns short then the StreamWriter is out of sync and must be discarded. -// A StreamWriter has no internal buffering; Close does not need -// to be called to flush write data. -type StreamWriter struct { - S Stream - W io.Writer - Err error // unused -} - -func (w StreamWriter) Write(src []byte) (n int, err error) { - c := make([]byte, len(src)) - w.S.XORKeyStream(c, src) - n, err = w.W.Write(c) - if n != len(src) { - if err == nil { // should never happen - err = io.ErrShortWrite - } - } - return -} - -// Close closes the underlying Writer and returns its Close return value, if the Writer -// is also an io.Closer. Otherwise it returns nil. -func (w StreamWriter) Close() error { - if c, ok := w.W.(io.Closer); ok { - return c.Close() - } - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb.go deleted file mode 100644 index e86ebcb237ee3ce2ef203c92adaaa94042d94d46..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// OFB (Output Feedback) Mode. - -package cipher - -type ofb struct { - b Block - cipher []byte - out []byte - outUsed int -} - -// NewOFB returns a Stream that encrypts or decrypts using the block cipher b -// in output feedback mode. The initialization vector iv's length must be equal -// to b's block size. -func NewOFB(b Block, iv []byte) Stream { - blockSize := b.BlockSize() - if len(iv) != blockSize { - return nil - } - bufSize := streamBufferSize - if bufSize < blockSize { - bufSize = blockSize - } - x := &ofb{ - b: b, - cipher: make([]byte, blockSize), - out: make([]byte, 0, bufSize), - outUsed: 0, - } - - copy(x.cipher, iv) - return x -} - -func (x *ofb) refill() { - bs := x.b.BlockSize() - remain := len(x.out) - x.outUsed - if remain > x.outUsed { - return - } - copy(x.out, x.out[x.outUsed:]) - x.out = x.out[:cap(x.out)] - for remain < len(x.out)-bs { - x.b.Encrypt(x.cipher, x.cipher) - copy(x.out[remain:], x.cipher) - remain += bs - } - x.out = x.out[:remain] - x.outUsed = 0 -} - -func (x *ofb) XORKeyStream(dst, src []byte) { - for len(src) > 0 { - if x.outUsed >= len(x.out)-x.b.BlockSize() { - x.refill() - } - n := xorBytes(dst, src, x.out[x.outUsed:]) - dst = dst[n:] - src = src[n:] - x.outUsed += n - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb_test.go deleted file mode 100644 index 8d3c5d3a3899bdb0510deb5147fda2fd2c48c439..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/ofb_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// OFB AES test vectors. - -// See U.S. National Institute of Standards and Technology (NIST) -// Special Publication 800-38A, ``Recommendation for Block Cipher -// Modes of Operation,'' 2001 Edition, pp. 52-55. - -package cipher_test - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "testing" -) - -type ofbTest struct { - name string - key []byte - iv []byte - in []byte - out []byte -} - -var ofbTests = []ofbTest{ - // NIST SP 800-38A pp 52-55 - { - "OFB-AES128", - commonKey128, - commonIV, - commonInput, - []byte{ - 0x3b, 0x3f, 0xd9, 0x2e, 0xb7, 0x2d, 0xad, 0x20, 0x33, 0x34, 0x49, 0xf8, 0xe8, 0x3c, 0xfb, 0x4a, - 0x77, 0x89, 0x50, 0x8d, 0x16, 0x91, 0x8f, 0x03, 0xf5, 0x3c, 0x52, 0xda, 0xc5, 0x4e, 0xd8, 0x25, - 0x97, 0x40, 0x05, 0x1e, 0x9c, 0x5f, 0xec, 0xf6, 0x43, 0x44, 0xf7, 0xa8, 0x22, 0x60, 0xed, 0xcc, - 0x30, 0x4c, 0x65, 0x28, 0xf6, 0x59, 0xc7, 0x78, 0x66, 0xa5, 0x10, 0xd9, 0xc1, 0xd6, 0xae, 0x5e, - }, - }, - { - "OFB-AES192", - commonKey192, - commonIV, - commonInput, - []byte{ - 0xcd, 0xc8, 0x0d, 0x6f, 0xdd, 0xf1, 0x8c, 0xab, 0x34, 0xc2, 0x59, 0x09, 0xc9, 0x9a, 0x41, 0x74, - 0xfc, 0xc2, 0x8b, 0x8d, 0x4c, 0x63, 0x83, 0x7c, 0x09, 0xe8, 0x17, 0x00, 0xc1, 0x10, 0x04, 0x01, - 0x8d, 0x9a, 0x9a, 0xea, 0xc0, 0xf6, 0x59, 0x6f, 0x55, 0x9c, 0x6d, 0x4d, 0xaf, 0x59, 0xa5, 0xf2, - 0x6d, 0x9f, 0x20, 0x08, 0x57, 0xca, 0x6c, 0x3e, 0x9c, 0xac, 0x52, 0x4b, 0xd9, 0xac, 0xc9, 0x2a, - }, - }, - { - "OFB-AES256", - commonKey256, - commonIV, - commonInput, - []byte{ - 0xdc, 0x7e, 0x84, 0xbf, 0xda, 0x79, 0x16, 0x4b, 0x7e, 0xcd, 0x84, 0x86, 0x98, 0x5d, 0x38, 0x60, - 0x4f, 0xeb, 0xdc, 0x67, 0x40, 0xd2, 0x0b, 0x3a, 0xc8, 0x8f, 0x6a, 0xd8, 0x2a, 0x4f, 0xb0, 0x8d, - 0x71, 0xab, 0x47, 0xa0, 0x86, 0xe8, 0x6e, 0xed, 0xf3, 0x9d, 0x1c, 0x5b, 0xba, 0x97, 0xc4, 0x08, - 0x01, 0x26, 0x14, 0x1d, 0x67, 0xf3, 0x7b, 0xe8, 0x53, 0x8f, 0x5a, 0x8b, 0xe7, 0x40, 0xe4, 0x84, - }, - }, -} - -func TestOFB(t *testing.T) { - for _, tt := range ofbTests { - test := tt.name - - c, err := aes.NewCipher(tt.key) - if err != nil { - t.Errorf("%s: NewCipher(%d bytes) = %s", test, len(tt.key), err) - continue - } - - for j := 0; j <= 5; j += 5 { - plaintext := tt.in[0 : len(tt.in)-j] - ofb := cipher.NewOFB(c, tt.iv) - ciphertext := make([]byte, len(plaintext)) - ofb.XORKeyStream(ciphertext, plaintext) - if !bytes.Equal(ciphertext, tt.out[:len(plaintext)]) { - t.Errorf("%s/%d: encrypting\ninput % x\nhave % x\nwant % x", test, len(plaintext), plaintext, ciphertext, tt.out) - } - } - - for j := 0; j <= 5; j += 5 { - ciphertext := tt.out[0 : len(tt.in)-j] - ofb := cipher.NewOFB(c, tt.iv) - plaintext := make([]byte, len(ciphertext)) - ofb.XORKeyStream(plaintext, ciphertext) - if !bytes.Equal(plaintext, tt.in[:len(ciphertext)]) { - t.Errorf("%s/%d: decrypting\nhave % x\nwant % x", test, len(ciphertext), plaintext, tt.in) - } - } - - if t.Failed() { - break - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor.go deleted file mode 100644 index f88dc8914ac8c98fa8691947ee4721326930e292..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor.go +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher - -import ( - "runtime" - "unsafe" -) - -const wordSize = int(unsafe.Sizeof(uintptr(0))) -const supportsUnaligned = runtime.GOARCH == "386" || runtime.GOARCH == "amd64" - -// fastXORBytes xors in bulk. It only works on architectures that -// support unaligned read/writes. -func fastXORBytes(dst, a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - - w := n / wordSize - if w > 0 { - dw := *(*[]uintptr)(unsafe.Pointer(&dst)) - aw := *(*[]uintptr)(unsafe.Pointer(&a)) - bw := *(*[]uintptr)(unsafe.Pointer(&b)) - for i := 0; i < w; i++ { - dw[i] = aw[i] ^ bw[i] - } - } - - for i := (n - n%wordSize); i < n; i++ { - dst[i] = a[i] ^ b[i] - } - - return n -} - -func safeXORBytes(dst, a, b []byte) int { - n := len(a) - if len(b) < n { - n = len(b) - } - for i := 0; i < n; i++ { - dst[i] = a[i] ^ b[i] - } - return n -} - -// xorBytes xors the bytes in a and b. The destination is assumed to have enough -// space. Returns the number of bytes xor'd. -func xorBytes(dst, a, b []byte) int { - if supportsUnaligned { - return fastXORBytes(dst, a, b) - } else { - // TODO(hanwen): if (dst, a, b) have common alignment - // we could still try fastXORBytes. It is not clear - // how often this happens, and it's only worth it if - // the block encryption itself is hardware - // accelerated. - return safeXORBytes(dst, a, b) - } -} - -// fastXORWords XORs multiples of 4 or 8 bytes (depending on architecture.) -// The arguments are assumed to be of equal length. -func fastXORWords(dst, a, b []byte) { - dw := *(*[]uintptr)(unsafe.Pointer(&dst)) - aw := *(*[]uintptr)(unsafe.Pointer(&a)) - bw := *(*[]uintptr)(unsafe.Pointer(&b)) - n := len(b) / wordSize - for i := 0; i < n; i++ { - dw[i] = aw[i] ^ bw[i] - } -} - -func xorWords(dst, a, b []byte) { - if supportsUnaligned { - fastXORWords(dst, a, b) - } else { - safeXORBytes(dst, a, b) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor_test.go deleted file mode 100644 index cc1c9d72d5591d8130920f34bd6b29f14bb83020..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/cipher/xor_test.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cipher - -import ( - "bytes" - "testing" -) - -func TestXOR(t *testing.T) { - for alignP := 0; alignP < 2; alignP++ { - for alignQ := 0; alignQ < 2; alignQ++ { - for alignD := 0; alignD < 2; alignD++ { - p := make([]byte, 1024)[alignP:] - q := make([]byte, 1024)[alignQ:] - d1 := make([]byte, 1024+alignD)[alignD:] - d2 := make([]byte, 1024+alignD)[alignD:] - xorBytes(d1, p, q) - safeXORBytes(d2, p, q) - if bytes.Compare(d1, d2) != 0 { - t.Error("not equal") - } - } - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/crypto.go b/llgo/third_party/gofrontend/libgo/go/crypto/crypto.go deleted file mode 100644 index 184ea9d4d62c74ae04419ca5cf8edb1f7f883d17..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/crypto.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package crypto collects common cryptographic constants. -package crypto - -import ( - "hash" - "io" - "strconv" -) - -// Hash identifies a cryptographic hash function that is implemented in another -// package. -type Hash uint - -// HashFunc simply returns the value of h so that Hash implements SignerOpts. -func (h Hash) HashFunc() Hash { - return h -} - -const ( - MD4 Hash = 1 + iota // import golang.org/x/crypto/md4 - MD5 // import crypto/md5 - SHA1 // import crypto/sha1 - SHA224 // import crypto/sha256 - SHA256 // import crypto/sha256 - SHA384 // import crypto/sha512 - SHA512 // import crypto/sha512 - MD5SHA1 // no implementation; MD5+SHA1 used for TLS RSA - RIPEMD160 // import golang.org/x/crypto/ripemd160 - SHA3_224 // import golang.org/x/crypto/sha3 - SHA3_256 // import golang.org/x/crypto/sha3 - SHA3_384 // import golang.org/x/crypto/sha3 - SHA3_512 // import golang.org/x/crypto/sha3 - SHA512_224 // import crypto/sha512 - SHA512_256 // import crypto/sha512 - maxHash -) - -var digestSizes = []uint8{ - MD4: 16, - MD5: 16, - SHA1: 20, - SHA224: 28, - SHA256: 32, - SHA384: 48, - SHA512: 64, - SHA512_224: 28, - SHA512_256: 32, - SHA3_224: 28, - SHA3_256: 32, - SHA3_384: 48, - SHA3_512: 64, - MD5SHA1: 36, - RIPEMD160: 20, -} - -// Size returns the length, in bytes, of a digest resulting from the given hash -// function. It doesn't require that the hash function in question be linked -// into the program. -func (h Hash) Size() int { - if h > 0 && h < maxHash { - return int(digestSizes[h]) - } - panic("crypto: Size of unknown hash function") -} - -var hashes = make([]func() hash.Hash, maxHash) - -// New returns a new hash.Hash calculating the given hash function. New panics -// if the hash function is not linked into the binary. -func (h Hash) New() hash.Hash { - if h > 0 && h < maxHash { - f := hashes[h] - if f != nil { - return f() - } - } - panic("crypto: requested hash function #" + strconv.Itoa(int(h)) + " is unavailable") -} - -// Available reports whether the given hash function is linked into the binary. -func (h Hash) Available() bool { - return h < maxHash && hashes[h] != nil -} - -// RegisterHash registers a function that returns a new instance of the given -// hash function. This is intended to be called from the init function in -// packages that implement hash functions. -func RegisterHash(h Hash, f func() hash.Hash) { - if h >= maxHash { - panic("crypto: RegisterHash of unknown hash function") - } - hashes[h] = f -} - -// PublicKey represents a public key using an unspecified algorithm. -type PublicKey interface{} - -// PrivateKey represents a private key using an unspecified algorithm. -type PrivateKey interface{} - -// Signer is an interface for an opaque private key that can be used for -// signing operations. For example, an RSA key kept in a hardware module. -type Signer interface { - // Public returns the public key corresponding to the opaque, - // private key. - Public() PublicKey - - // Sign signs msg with the private key, possibly using entropy from - // rand. For an RSA key, the resulting signature should be either a - // PKCS#1 v1.5 or PSS signature (as indicated by opts). For an (EC)DSA - // key, it should be a DER-serialised, ASN.1 signature structure. - // - // Hash implements the SignerOpts interface and, in most cases, one can - // simply pass in the hash function used as opts. Sign may also attempt - // to type assert opts to other types in order to obtain algorithm - // specific values. See the documentation in each package for details. - Sign(rand io.Reader, msg []byte, opts SignerOpts) (signature []byte, err error) -} - -// SignerOpts contains options for signing with a Signer. -type SignerOpts interface { - // HashFunc returns an identifier for the hash function used to produce - // the message passed to Signer.Sign, or else zero to indicate that no - // hashing was done. - HashFunc() Hash -} - -// Decrypter is an interface for an opaque private key that can be used for -// asymmetric decryption operations. An example would be an RSA key -// kept in a hardware module. -type Decrypter interface { - // Public returns the public key corresponding to the opaque, - // private key. - Public() PublicKey - - // Decrypt decrypts msg. The opts argument should be appropriate for - // the primitive used. See the documentation in each implementation for - // details. - Decrypt(rand io.Reader, msg []byte, opts DecrypterOpts) (plaintext []byte, err error) -} - -type DecrypterOpts interface{} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/des/block.go b/llgo/third_party/gofrontend/libgo/go/crypto/des/block.go deleted file mode 100644 index 26355a22e714bebecc0a9c6243a1954e0dbf82d3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/des/block.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package des - -import ( - "encoding/binary" -) - -func cryptBlock(subkeys []uint64, dst, src []byte, decrypt bool) { - b := binary.BigEndian.Uint64(src) - b = permuteInitialBlock(b) - left, right := uint32(b>>32), uint32(b) - - var subkey uint64 - for i := 0; i < 16; i++ { - if decrypt { - subkey = subkeys[15-i] - } else { - subkey = subkeys[i] - } - - left, right = right, left^feistel(right, subkey) - } - // switch left & right and perform final permutation - preOutput := (uint64(right) << 32) | uint64(left) - binary.BigEndian.PutUint64(dst, permuteFinalBlock(preOutput)) -} - -// Encrypt one block from src into dst, using the subkeys. -func encryptBlock(subkeys []uint64, dst, src []byte) { - cryptBlock(subkeys, dst, src, false) -} - -// Decrypt one block from src into dst, using the subkeys. -func decryptBlock(subkeys []uint64, dst, src []byte) { - cryptBlock(subkeys, dst, src, true) -} - -// DES Feistel function -func feistel(right uint32, key uint64) (result uint32) { - sBoxLocations := key ^ expandBlock(right) - var sBoxResult uint32 - for i := uint8(0); i < 8; i++ { - sBoxLocation := uint8(sBoxLocations>>42) & 0x3f - sBoxLocations <<= 6 - // row determined by 1st and 6th bit - // column is middle four bits - row := (sBoxLocation & 0x1) | ((sBoxLocation & 0x20) >> 4) - column := (sBoxLocation >> 1) & 0xf - sBoxResult ^= feistelBox[i][16*row+column] - } - return sBoxResult -} - -// feistelBox[s][16*i+j] contains the output of permutationFunction -// for sBoxes[s][i][j] << 4*(7-s) -var feistelBox [8][64]uint32 - -// general purpose function to perform DES block permutations -func permuteBlock(src uint64, permutation []uint8) (block uint64) { - for position, n := range permutation { - bit := (src >> n) & 1 - block |= bit << uint((len(permutation)-1)-position) - } - return -} - -func init() { - for s := range sBoxes { - for i := 0; i < 4; i++ { - for j := 0; j < 16; j++ { - f := uint64(sBoxes[s][i][j]) << (4 * (7 - uint(s))) - f = permuteBlock(uint64(f), permutationFunction[:]) - feistelBox[s][16*i+j] = uint32(f) - } - } - } -} - -// expandBlock expands an input block of 32 bits, -// producing an output block of 48 bits. -func expandBlock(src uint32) (block uint64) { - // rotate the 5 highest bits to the right. - src = (src << 5) | (src >> 27) - for i := 0; i < 8; i++ { - block <<= 6 - // take the 6 bits on the right - block |= uint64(src) & (1<<6 - 1) - // advance by 4 bits. - src = (src << 4) | (src >> 28) - } - return -} - -// permuteInitialBlock is equivalent to the permutation defined -// by initialPermutation. -func permuteInitialBlock(block uint64) uint64 { - // block = b7 b6 b5 b4 b3 b2 b1 b0 (8 bytes) - b1 := block >> 48 - b2 := block << 48 - block ^= b1 ^ b2 ^ b1<<48 ^ b2>>48 - - // block = b1 b0 b5 b4 b3 b2 b7 b6 - b1 = block >> 32 & 0xff00ff - b2 = (block & 0xff00ff00) - block ^= b1<<32 ^ b2 ^ b1<<8 ^ b2<<24 // exchange b0 b4 with b3 b7 - - // block is now b1 b3 b5 b7 b0 b2 b4 b7, the permutation: - // ... 8 - // ... 24 - // ... 40 - // ... 56 - // 7 6 5 4 3 2 1 0 - // 23 22 21 20 19 18 17 16 - // ... 32 - // ... 48 - - // exchange 4,5,6,7 with 32,33,34,35 etc. - b1 = block & 0x0f0f00000f0f0000 - b2 = block & 0x0000f0f00000f0f0 - block ^= b1 ^ b2 ^ b1>>12 ^ b2<<12 - - // block is the permutation: - // - // [+8] [+40] - // - // 7 6 5 4 - // 23 22 21 20 - // 3 2 1 0 - // 19 18 17 16 [+32] - - // exchange 0,1,4,5 with 18,19,22,23 - b1 = block & 0x3300330033003300 - b2 = block & 0x00cc00cc00cc00cc - block ^= b1 ^ b2 ^ b1>>6 ^ b2<<6 - - // block is the permutation: - // 15 14 - // 13 12 - // 11 10 - // 9 8 - // 7 6 - // 5 4 - // 3 2 - // 1 0 [+16] [+32] [+64] - - // exchange 0,2,4,6 with 9,11,13,15: - b1 = block & 0xaaaaaaaa55555555 - block ^= b1 ^ b1>>33 ^ b1<<33 - - // block is the permutation: - // 6 14 22 30 38 46 54 62 - // 4 12 20 28 36 44 52 60 - // 2 10 18 26 34 42 50 58 - // 0 8 16 24 32 40 48 56 - // 7 15 23 31 39 47 55 63 - // 5 13 21 29 37 45 53 61 - // 3 11 19 27 35 43 51 59 - // 1 9 17 25 33 41 49 57 - return block -} - -// permuteInitialBlock is equivalent to the permutation defined -// by finalPermutation. -func permuteFinalBlock(block uint64) uint64 { - // Perform the same bit exchanges as permuteInitialBlock - // but in reverse order. - b1 := block & 0xaaaaaaaa55555555 - block ^= b1 ^ b1>>33 ^ b1<<33 - - b1 = block & 0x3300330033003300 - b2 := block & 0x00cc00cc00cc00cc - block ^= b1 ^ b2 ^ b1>>6 ^ b2<<6 - - b1 = block & 0x0f0f00000f0f0000 - b2 = block & 0x0000f0f00000f0f0 - block ^= b1 ^ b2 ^ b1>>12 ^ b2<<12 - - b1 = block >> 32 & 0xff00ff - b2 = (block & 0xff00ff00) - block ^= b1<<32 ^ b2 ^ b1<<8 ^ b2<<24 - - b1 = block >> 48 - b2 = block << 48 - block ^= b1 ^ b2 ^ b1<<48 ^ b2>>48 - return block -} - -// creates 16 28-bit blocks rotated according -// to the rotation schedule -func ksRotate(in uint32) (out []uint32) { - out = make([]uint32, 16) - last := in - for i := 0; i < 16; i++ { - // 28-bit circular left shift - left := (last << (4 + ksRotations[i])) >> 4 - right := (last << 4) >> (32 - ksRotations[i]) - out[i] = left | right - last = out[i] - } - return -} - -// creates 16 56-bit subkeys from the original key -func (c *desCipher) generateSubkeys(keyBytes []byte) { - // apply PC1 permutation to key - key := binary.BigEndian.Uint64(keyBytes) - permutedKey := permuteBlock(key, permutedChoice1[:]) - - // rotate halves of permuted key according to the rotation schedule - leftRotations := ksRotate(uint32(permutedKey >> 28)) - rightRotations := ksRotate(uint32(permutedKey<<4) >> 4) - - // generate subkeys - for i := 0; i < 16; i++ { - // combine halves to form 56-bit input to PC2 - pc2Input := uint64(leftRotations[i])<<28 | uint64(rightRotations[i]) - // apply PC2 permutation to 7 byte input - c.subkeys[i] = permuteBlock(pc2Input, permutedChoice2[:]) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/des/cipher.go b/llgo/third_party/gofrontend/libgo/go/crypto/des/cipher.go deleted file mode 100644 index 2f929ca7bed0356e337c85699ebb1d153ef6f4d7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/des/cipher.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package des - -import ( - "crypto/cipher" - "strconv" -) - -// The DES block size in bytes. -const BlockSize = 8 - -type KeySizeError int - -func (k KeySizeError) Error() string { - return "crypto/des: invalid key size " + strconv.Itoa(int(k)) -} - -// desCipher is an instance of DES encryption. -type desCipher struct { - subkeys [16]uint64 -} - -// NewCipher creates and returns a new cipher.Block. -func NewCipher(key []byte) (cipher.Block, error) { - if len(key) != 8 { - return nil, KeySizeError(len(key)) - } - - c := new(desCipher) - c.generateSubkeys(key) - return c, nil -} - -func (c *desCipher) BlockSize() int { return BlockSize } - -func (c *desCipher) Encrypt(dst, src []byte) { encryptBlock(c.subkeys[:], dst, src) } - -func (c *desCipher) Decrypt(dst, src []byte) { decryptBlock(c.subkeys[:], dst, src) } - -// A tripleDESCipher is an instance of TripleDES encryption. -type tripleDESCipher struct { - cipher1, cipher2, cipher3 desCipher -} - -// NewTripleDESCipher creates and returns a new cipher.Block. -func NewTripleDESCipher(key []byte) (cipher.Block, error) { - if len(key) != 24 { - return nil, KeySizeError(len(key)) - } - - c := new(tripleDESCipher) - c.cipher1.generateSubkeys(key[:8]) - c.cipher2.generateSubkeys(key[8:16]) - c.cipher3.generateSubkeys(key[16:]) - return c, nil -} - -func (c *tripleDESCipher) BlockSize() int { return BlockSize } - -func (c *tripleDESCipher) Encrypt(dst, src []byte) { - c.cipher1.Encrypt(dst, src) - c.cipher2.Decrypt(dst, dst) - c.cipher3.Encrypt(dst, dst) -} - -func (c *tripleDESCipher) Decrypt(dst, src []byte) { - c.cipher3.Decrypt(dst, src) - c.cipher2.Encrypt(dst, dst) - c.cipher1.Decrypt(dst, dst) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/des/const.go b/llgo/third_party/gofrontend/libgo/go/crypto/des/const.go deleted file mode 100644 index 2bd485ee80e00022abd145944fc1eaa959d6469d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/des/const.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package des implements the Data Encryption Standard (DES) and the -// Triple Data Encryption Algorithm (TDEA) as defined -// in U.S. Federal Information Processing Standards Publication 46-3. -package des - -// Used to perform an initial permutation of a 64-bit input block. -var initialPermutation = [64]byte{ - 6, 14, 22, 30, 38, 46, 54, 62, - 4, 12, 20, 28, 36, 44, 52, 60, - 2, 10, 18, 26, 34, 42, 50, 58, - 0, 8, 16, 24, 32, 40, 48, 56, - 7, 15, 23, 31, 39, 47, 55, 63, - 5, 13, 21, 29, 37, 45, 53, 61, - 3, 11, 19, 27, 35, 43, 51, 59, - 1, 9, 17, 25, 33, 41, 49, 57, -} - -// Used to perform a final permutation of a 4-bit preoutput block. This is the -// inverse of initialPermutation -var finalPermutation = [64]byte{ - 24, 56, 16, 48, 8, 40, 0, 32, - 25, 57, 17, 49, 9, 41, 1, 33, - 26, 58, 18, 50, 10, 42, 2, 34, - 27, 59, 19, 51, 11, 43, 3, 35, - 28, 60, 20, 52, 12, 44, 4, 36, - 29, 61, 21, 53, 13, 45, 5, 37, - 30, 62, 22, 54, 14, 46, 6, 38, - 31, 63, 23, 55, 15, 47, 7, 39, -} - -// Used to expand an input block of 32 bits, producing an output block of 48 -// bits. -var expansionFunction = [48]byte{ - 0, 31, 30, 29, 28, 27, 28, 27, - 26, 25, 24, 23, 24, 23, 22, 21, - 20, 19, 20, 19, 18, 17, 16, 15, - 16, 15, 14, 13, 12, 11, 12, 11, - 10, 9, 8, 7, 8, 7, 6, 5, - 4, 3, 4, 3, 2, 1, 0, 31, -} - -// Yields a 32-bit output from a 32-bit input -var permutationFunction = [32]byte{ - 16, 25, 12, 11, 3, 20, 4, 15, - 31, 17, 9, 6, 27, 14, 1, 22, - 30, 24, 8, 18, 0, 5, 29, 23, - 13, 19, 2, 26, 10, 21, 28, 7, -} - -// Used in the key schedule to select 56 bits -// from a 64-bit input. -var permutedChoice1 = [56]byte{ - 7, 15, 23, 31, 39, 47, 55, 63, - 6, 14, 22, 30, 38, 46, 54, 62, - 5, 13, 21, 29, 37, 45, 53, 61, - 4, 12, 20, 28, 1, 9, 17, 25, - 33, 41, 49, 57, 2, 10, 18, 26, - 34, 42, 50, 58, 3, 11, 19, 27, - 35, 43, 51, 59, 36, 44, 52, 60, -} - -// Used in the key schedule to produce each subkey by selecting 48 bits from -// the 56-bit input -var permutedChoice2 = [48]byte{ - 42, 39, 45, 32, 55, 51, 53, 28, - 41, 50, 35, 46, 33, 37, 44, 52, - 30, 48, 40, 49, 29, 36, 43, 54, - 15, 4, 25, 19, 9, 1, 26, 16, - 5, 11, 23, 8, 12, 7, 17, 0, - 22, 3, 10, 14, 6, 20, 27, 24, -} - -// 8 S-boxes composed of 4 rows and 16 columns -// Used in the DES cipher function -var sBoxes = [8][4][16]uint8{ - // S-box 1 - { - {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, - {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, - {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, - {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}, - }, - // S-box 2 - { - {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, - {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, - {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, - {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}, - }, - // S-box 3 - { - {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, - {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, - {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, - {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}, - }, - // S-box 4 - { - {7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, - {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, - {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, - {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}, - }, - // S-box 5 - { - {2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, - {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, - {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, - {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}, - }, - // S-box 6 - { - {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, - {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, - {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, - {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}, - }, - // S-box 7 - { - {4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, - {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, - {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, - {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}, - }, - // S-box 8 - { - {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, - {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, - {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, - {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}, - }, -} - -// Size of left rotation per round in each half of the key schedule -var ksRotations = [16]uint8{1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/des/des_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/des/des_test.go deleted file mode 100644 index 2bd525afecce9503b36672031ab8d50f386636e5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/des/des_test.go +++ /dev/null @@ -1,1566 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package des - -import ( - "bytes" - "testing" -) - -type CryptTest struct { - key []byte - in []byte - out []byte -} - -// some custom tests for DES -var encryptDESTests = []CryptTest{ - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x8c, 0xa6, 0x4d, 0xe9, 0xc1, 0xb1, 0x23, 0xa7}}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x35, 0x55, 0x50, 0xb2, 0x15, 0x0e, 0x24, 0x51}}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x61, 0x7b, 0x3a, 0x0c, 0xe8, 0xf0, 0x71, 0x00}}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x92, 0x31, 0xf2, 0x36, 0xff, 0x9a, 0xa9, 0x5c}}, - { - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xca, 0xaa, 0xaf, 0x4d, 0xea, 0xf1, 0xdb, 0xae}}, - { - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x73, 0x59, 0xb2, 0x16, 0x3e, 0x4e, 0xdc, 0x58}}, - { - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x6d, 0xce, 0x0d, 0xc9, 0x00, 0x65, 0x56, 0xa3}}, - { - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x9e, 0x84, 0xc5, 0xf3, 0x17, 0x0f, 0x8e, 0xff}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xd5, 0xd4, 0x4f, 0xf7, 0x20, 0x68, 0x3d, 0x0d}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x59, 0x73, 0x23, 0x56, 0xf3, 0x6f, 0xde, 0x06}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x56, 0xcc, 0x09, 0xe7, 0xcf, 0xdc, 0x4c, 0xef}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x12, 0xc6, 0x26, 0xaf, 0x05, 0x8b, 0x43, 0x3b}}, - { - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xa6, 0x8c, 0xdc, 0xa9, 0x0c, 0x90, 0x21, 0xf9}}, - { - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x2a, 0x2b, 0xb0, 0x08, 0xdf, 0x97, 0xc2, 0xf2}}, - { - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0xed, 0x39, 0xd9, 0x50, 0xfa, 0x74, 0xbc, 0xc4}}, - { - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, - []byte{0xa9, 0x33, 0xf6, 0x18, 0x30, 0x23, 0xb3, 0x10}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, - []byte{0x17, 0x66, 0x8d, 0xfc, 0x72, 0x92, 0x53, 0x2d}}, - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - []byte{0xb4, 0xfd, 0x23, 0x16, 0x47, 0xa5, 0xbe, 0xc0}}, - { - []byte{0x0e, 0x32, 0x92, 0x32, 0xea, 0x6d, 0x0d, 0x73}, - []byte{0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, - { - []byte{0x73, 0x65, 0x63, 0x52, 0x33, 0x74, 0x24, 0x3b}, // "secR3t$;" - []byte{0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x31, 0x32}, // "a test12" - []byte{0x37, 0x0d, 0xee, 0x2c, 0x1f, 0xb4, 0xf7, 0xa5}}, - { - []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" - []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" - []byte{0x2a, 0x8d, 0x69, 0xde, 0x9d, 0x5f, 0xdf, 0xf9}}, - { - []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" - []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" - []byte{0x21, 0xc6, 0x0d, 0xa5, 0x34, 0x24, 0x8b, 0xce}}, - { - []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" - []byte{0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68}, // "abcdefgh" - []byte{0x94, 0xd4, 0x43, 0x6b, 0xc3, 0xb5, 0xb6, 0x93}}, - { - []byte{0x1f, 0x79, 0x90, 0x5f, 0x88, 0x01, 0xc8, 0x88}, // random - []byte{0xc7, 0x46, 0x18, 0x73, 0xaf, 0x48, 0x5f, 0xb3}, // random - []byte{0xb0, 0x93, 0x50, 0x88, 0xf9, 0x92, 0x44, 0x6a}}, - { - []byte{0xe6, 0xf4, 0xf2, 0xdb, 0x31, 0x42, 0x53, 0x01}, // random - []byte{0xff, 0x3d, 0x25, 0x50, 0x12, 0xe3, 0x4a, 0xc5}, // random - []byte{0x86, 0x08, 0xd3, 0xd1, 0x6c, 0x2f, 0xd2, 0x55}}, - { - []byte{0x69, 0xc1, 0x9d, 0xc1, 0x15, 0xc5, 0xfb, 0x2b}, // random - []byte{0x1a, 0x22, 0x5c, 0xaf, 0x1f, 0x1d, 0xa3, 0xf9}, // random - []byte{0x64, 0xba, 0x31, 0x67, 0x56, 0x91, 0x1e, 0xa7}}, - { - []byte{0x6e, 0x5e, 0xe2, 0x47, 0xc4, 0xbf, 0xf6, 0x51}, // random - []byte{0x11, 0xc9, 0x57, 0xff, 0x66, 0x89, 0x0e, 0xf0}, // random - []byte{0x94, 0xc5, 0x35, 0xb2, 0xc5, 0x8b, 0x39, 0x72}}, -} - -var weakKeyTests = []CryptTest{ - { - []byte{0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - []byte{0x55, 0x74, 0xc0, 0xbd, 0x7c, 0xdf, 0xf7, 0x39}, // random - nil}, - { - []byte{0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}, - []byte{0xe8, 0xe1, 0xa7, 0xc1, 0xde, 0x11, 0x89, 0xaa}, // random - nil}, - { - []byte{0xe0, 0xe0, 0xe0, 0xe0, 0xf1, 0xf1, 0xf1, 0xf1}, - []byte{0x50, 0x6a, 0x4b, 0x94, 0x3b, 0xed, 0x7d, 0xdc}, // random - nil}, - { - []byte{0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e}, - []byte{0x88, 0x81, 0x56, 0x38, 0xec, 0x3b, 0x1c, 0x97}, // random - nil}, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x17, 0xa0, 0x83, 0x62, 0x32, 0xfe, 0x9a, 0x0b}, // random - nil}, - { - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0xca, 0x8f, 0xca, 0x1f, 0x50, 0xc5, 0x7b, 0x49}, // random - nil}, - { - []byte{0xe1, 0xe1, 0xe1, 0xe1, 0xf0, 0xf0, 0xf0, 0xf0}, - []byte{0xb1, 0xea, 0xad, 0x7d, 0xe7, 0xc3, 0x7a, 0x43}, // random - nil}, - { - []byte{0x1e, 0x1e, 0x1e, 0x1e, 0x0f, 0x0f, 0x0f, 0x0f}, - []byte{0xae, 0x74, 0x7d, 0x6f, 0xef, 0x16, 0xbb, 0x81}, // random - nil}, -} - -var semiWeakKeyTests = []CryptTest{ - // key and out contain the semi-weak key pair - { - []byte{0x01, 0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e}, - []byte{0x12, 0xfa, 0x31, 0x16, 0xf9, 0xc5, 0x0a, 0xe4}, // random - []byte{0x1f, 0x01, 0x1f, 0x01, 0x0e, 0x01, 0x0e, 0x01}}, - { - []byte{0x01, 0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1}, - []byte{0xb0, 0x4c, 0x7a, 0xee, 0xd2, 0xe5, 0x4d, 0xb7}, // random - []byte{0xe0, 0x01, 0xe0, 0x01, 0xf1, 0x01, 0xf1, 0x01}}, - { - []byte{0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe}, - []byte{0xa4, 0x81, 0xcd, 0xb1, 0x64, 0x6f, 0xd3, 0xbc}, // random - []byte{0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01, 0xfe, 0x01}}, - { - []byte{0x1f, 0xe0, 0x1f, 0xe0, 0x0e, 0xf1, 0x0e, 0xf1}, - []byte{0xee, 0x27, 0xdd, 0x88, 0x4c, 0x22, 0xcd, 0xce}, // random - []byte{0xe0, 0x1f, 0xe0, 0x1f, 0xf1, 0x0e, 0xf1, 0x0e}}, - { - []byte{0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e, 0xfe}, - []byte{0x19, 0x3d, 0xcf, 0x97, 0x70, 0xfb, 0xab, 0xe1}, // random - []byte{0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x0e, 0xfe, 0x0e}}, - { - []byte{0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1, 0xfe}, - []byte{0x7c, 0x82, 0x69, 0xe4, 0x1e, 0x86, 0x99, 0xd7}, // random - []byte{0xfe, 0xe0, 0xfe, 0xe0, 0xfe, 0xf1, 0xfe, 0xf1}}, -} - -// some custom tests for TripleDES -var encryptTripleDESTests = []CryptTest{ - { - []byte{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x92, 0x95, 0xb5, 0x9b, 0xb3, 0x84, 0x73, 0x6e}}, - { - []byte{ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0xc1, 0x97, 0xf5, 0x58, 0x74, 0x8a, 0x20, 0xe7}}, - { - []byte{ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x3e, 0x68, 0x0a, 0xa7, 0x8b, 0x75, 0xdf, 0x18}}, - { - []byte{ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, - []byte{0x6d, 0x6a, 0x4a, 0x64, 0x4c, 0x7b, 0x8c, 0x91}}, - { - []byte{ // "abcdefgh12345678ABCDEFGH" - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, - []byte{0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30}, // "00000000" - []byte{0xe4, 0x61, 0xb7, 0x59, 0x68, 0x8b, 0xff, 0x66}}, - { - []byte{ // "abcdefgh12345678ABCDEFGH" - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, - []byte{0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38}, // "12345678" - []byte{0xdb, 0xd0, 0x92, 0xde, 0xf8, 0x34, 0xff, 0x58}}, - { - []byte{ // "abcdefgh12345678ABCDEFGH" - 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, - 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}, - []byte{0xf0, 0xc5, 0x82, 0x22, 0xd3, 0xe6, 0x12, 0xd2}, // random - []byte{0xba, 0xe4, 0x41, 0xb1, 0x3c, 0x37, 0x4d, 0xf4}}, - { - []byte{ // random - 0xd3, 0x7d, 0x45, 0xee, 0x22, 0xe9, 0xcf, 0x52, - 0xf4, 0x65, 0xa2, 0x4f, 0x70, 0xd1, 0x81, 0x8a, - 0x3d, 0xbe, 0x2f, 0x39, 0xc7, 0x71, 0xd2, 0xe9}, - []byte{0x49, 0x53, 0xc3, 0xe9, 0x78, 0xdf, 0x9f, 0xaf}, // random - []byte{0x53, 0x40, 0x51, 0x24, 0xd8, 0x3c, 0xf9, 0x88}}, - { - []byte{ // random - 0xcb, 0x10, 0x7d, 0xda, 0x7e, 0x96, 0x57, 0x0a, - 0xe8, 0xeb, 0xe8, 0x07, 0x8e, 0x87, 0xd3, 0x57, - 0xb2, 0x61, 0x12, 0xb8, 0x2a, 0x90, 0xb7, 0x2f}, - []byte{0xa3, 0xc2, 0x60, 0xb1, 0x0b, 0xb7, 0x28, 0x6e}, // random - []byte{0x56, 0x73, 0x7d, 0xfb, 0xb5, 0xa1, 0xc3, 0xde}}, -} - -// NIST Special Publication 800-20, Appendix A -// Key for use with Table A.1 tests -var tableA1Key = []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -} - -// Table A.1 Resulting Ciphertext from the Variable Plaintext Known Answer Test -var tableA1Tests = []CryptTest{ - {nil, // 0 - []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x95, 0xf8, 0xa5, 0xe5, 0xdd, 0x31, 0xd9, 0x00}}, - {nil, // 1 - []byte{0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xdd, 0x7f, 0x12, 0x1c, 0xa5, 0x01, 0x56, 0x19}}, - {nil, // 2 - []byte{0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x2e, 0x86, 0x53, 0x10, 0x4f, 0x38, 0x34, 0xea}}, - {nil, // 3 - []byte{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x4b, 0xd3, 0x88, 0xff, 0x6c, 0xd8, 0x1d, 0x4f}}, - {nil, // 4 - []byte{0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x20, 0xb9, 0xe7, 0x67, 0xb2, 0xfb, 0x14, 0x56}}, - {nil, // 5 - []byte{0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x55, 0x57, 0x93, 0x80, 0xd7, 0x71, 0x38, 0xef}}, - {nil, // 6 - []byte{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x6c, 0xc5, 0xde, 0xfa, 0xaf, 0x04, 0x51, 0x2f}}, - {nil, // 7 - []byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x0d, 0x9f, 0x27, 0x9b, 0xa5, 0xd8, 0x72, 0x60}}, - {nil, // 8 - []byte{0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xd9, 0x03, 0x1b, 0x02, 0x71, 0xbd, 0x5a, 0x0a}}, - {nil, // 9 - []byte{0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x42, 0x42, 0x50, 0xb3, 0x7c, 0x3d, 0xd9, 0x51}}, - {nil, // 10 - []byte{0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xb8, 0x06, 0x1b, 0x7e, 0xcd, 0x9a, 0x21, 0xe5}}, - {nil, // 11 - []byte{0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xf1, 0x5d, 0x0f, 0x28, 0x6b, 0x65, 0xbd, 0x28}}, - {nil, // 12 - []byte{0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xad, 0xd0, 0xcc, 0x8d, 0x6e, 0x5d, 0xeb, 0xa1}}, - {nil, // 13 - []byte{0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xe6, 0xd5, 0xf8, 0x27, 0x52, 0xad, 0x63, 0xd1}}, - {nil, // 14 - []byte{0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xec, 0xbf, 0xe3, 0xbd, 0x3f, 0x59, 0x1a, 0x5e}}, - {nil, // 15 - []byte{0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xf3, 0x56, 0x83, 0x43, 0x79, 0xd1, 0x65, 0xcd}}, - {nil, // 16 - []byte{0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x2b, 0x9f, 0x98, 0x2f, 0x20, 0x03, 0x7f, 0xa9}}, - {nil, // 17 - []byte{0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x88, 0x9d, 0xe0, 0x68, 0xa1, 0x6f, 0x0b, 0xe6}}, - {nil, // 18 - []byte{0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xe1, 0x9e, 0x27, 0x5d, 0x84, 0x6a, 0x12, 0x98}}, - {nil, // 19 - []byte{0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x32, 0x9a, 0x8e, 0xd5, 0x23, 0xd7, 0x1a, 0xec}}, - {nil, // 20 - []byte{0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xe7, 0xfc, 0xe2, 0x25, 0x57, 0xd2, 0x3c, 0x97}}, - {nil, // 21 - []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0x12, 0xa9, 0xf5, 0x81, 0x7f, 0xf2, 0xd6, 0x5d}}, - {nil, // 22 - []byte{0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xa4, 0x84, 0xc3, 0xad, 0x38, 0xdc, 0x9c, 0x19}}, - {nil, // 23 - []byte{0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xfb, 0xe0, 0x0a, 0x8a, 0x1e, 0xf8, 0xad, 0x72}}, - {nil, // 24 - []byte{0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00}, - []byte{0x75, 0x0d, 0x07, 0x94, 0x07, 0x52, 0x13, 0x63}}, - {nil, // 25 - []byte{0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00}, - []byte{0x64, 0xfe, 0xed, 0x9c, 0x72, 0x4c, 0x2f, 0xaf}}, - {nil, // 26 - []byte{0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00}, - []byte{0xf0, 0x2b, 0x26, 0x3b, 0x32, 0x8e, 0x2b, 0x60}}, - {nil, // 27 - []byte{0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00}, - []byte{0x9d, 0x64, 0x55, 0x5a, 0x9a, 0x10, 0xb8, 0x52}}, - {nil, // 28 - []byte{0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}, - []byte{0xd1, 0x06, 0xff, 0x0b, 0xed, 0x52, 0x55, 0xd7}}, - {nil, // 29 - []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, - []byte{0xe1, 0x65, 0x2c, 0x6b, 0x13, 0x8c, 0x64, 0xa5}}, - {nil, // 30 - []byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00}, - []byte{0xe4, 0x28, 0x58, 0x11, 0x86, 0xec, 0x8f, 0x46}}, - {nil, // 31 - []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, - []byte{0xae, 0xb5, 0xf5, 0xed, 0xe2, 0x2d, 0x1a, 0x36}}, - {nil, // 32 - []byte{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}, - []byte{0xe9, 0x43, 0xd7, 0x56, 0x8a, 0xec, 0x0c, 0x5c}}, - {nil, // 33 - []byte{0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00}, - []byte{0xdf, 0x98, 0xc8, 0x27, 0x6f, 0x54, 0xb0, 0x4b}}, - {nil, // 34 - []byte{0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00}, - []byte{0xb1, 0x60, 0xe4, 0x68, 0x0f, 0x6c, 0x69, 0x6f}}, - {nil, // 35 - []byte{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}, - []byte{0xfa, 0x07, 0x52, 0xb0, 0x7d, 0x9c, 0x4a, 0xb8}}, - {nil, // 36 - []byte{0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00}, - []byte{0xca, 0x3a, 0x2b, 0x03, 0x6d, 0xbc, 0x85, 0x02}}, - {nil, // 37 - []byte{0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00}, - []byte{0x5e, 0x09, 0x05, 0x51, 0x7b, 0xb5, 0x9b, 0xcf}}, - {nil, // 38 - []byte{0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00}, - []byte{0x81, 0x4e, 0xeb, 0x3b, 0x91, 0xd9, 0x07, 0x26}}, - {nil, // 39 - []byte{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}, - []byte{0x4d, 0x49, 0xdb, 0x15, 0x32, 0x91, 0x9c, 0x9f}}, - {nil, // 40 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00}, - []byte{0x25, 0xeb, 0x5f, 0xc3, 0xf8, 0xcf, 0x06, 0x21}}, - {nil, // 41 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00}, - []byte{0xab, 0x6a, 0x20, 0xc0, 0x62, 0x0d, 0x1c, 0x6f}}, - {nil, // 42 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00}, - []byte{0x79, 0xe9, 0x0d, 0xbc, 0x98, 0xf9, 0x2c, 0xca}}, - {nil, // 43 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00}, - []byte{0x86, 0x6e, 0xce, 0xdd, 0x80, 0x72, 0xbb, 0x0e}}, - {nil, // 44 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00}, - []byte{0x8b, 0x54, 0x53, 0x6f, 0x2f, 0x3e, 0x64, 0xa8}}, - {nil, // 45 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00}, - []byte{0xea, 0x51, 0xd3, 0x97, 0x55, 0x95, 0xb8, 0x6b}}, - {nil, // 46 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00}, - []byte{0xca, 0xff, 0xc6, 0xac, 0x45, 0x42, 0xde, 0x31}}, - {nil, // 47 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00}, - []byte{0x8d, 0xd4, 0x5a, 0x2d, 0xdf, 0x90, 0x79, 0x6c}}, - {nil, // 48 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00}, - []byte{0x10, 0x29, 0xd5, 0x5e, 0x88, 0x0e, 0xc2, 0xd0}}, - {nil, // 49 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00}, - []byte{0x5d, 0x86, 0xcb, 0x23, 0x63, 0x9d, 0xbe, 0xa9}}, - {nil, // 50 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00}, - []byte{0x1d, 0x1c, 0xa8, 0x53, 0xae, 0x7c, 0x0c, 0x5f}}, - {nil, // 51 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00}, - []byte{0xce, 0x33, 0x23, 0x29, 0x24, 0x8f, 0x32, 0x28}}, - {nil, // 52 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00}, - []byte{0x84, 0x05, 0xd1, 0xab, 0xe2, 0x4f, 0xb9, 0x42}}, - {nil, // 53 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00}, - []byte{0xe6, 0x43, 0xd7, 0x80, 0x90, 0xca, 0x42, 0x07}}, - {nil, // 54 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00}, - []byte{0x48, 0x22, 0x1b, 0x99, 0x37, 0x74, 0x8a, 0x23}}, - {nil, // 55 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00}, - []byte{0xdd, 0x7c, 0x0b, 0xbd, 0x61, 0xfa, 0xfd, 0x54}}, - {nil, // 56 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}, - []byte{0x2f, 0xbc, 0x29, 0x1a, 0x57, 0x0d, 0xb5, 0xc4}}, - {nil, // 57 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40}, - []byte{0xe0, 0x7c, 0x30, 0xd7, 0xe4, 0xe2, 0x6e, 0x12}}, - {nil, // 58 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}, - []byte{0x09, 0x53, 0xe2, 0x25, 0x8e, 0x8e, 0x90, 0xa1}}, - {nil, // 59 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}, - []byte{0x5b, 0x71, 0x1b, 0xc4, 0xce, 0xeb, 0xf2, 0xee}}, - {nil, // 60 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08}, - []byte{0xcc, 0x08, 0x3f, 0x1e, 0x6d, 0x9e, 0x85, 0xf6}}, - {nil, // 61 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04}, - []byte{0xd2, 0xfd, 0x88, 0x67, 0xd5, 0x0d, 0x2d, 0xfe}}, - {nil, // 62 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, - []byte{0x06, 0xe7, 0xea, 0x22, 0xce, 0x92, 0x70, 0x8f}}, - {nil, // 63 - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, - []byte{0x16, 0x6b, 0x40, 0xb4, 0x4a, 0xba, 0x4b, 0xd6}}, -} - -// Plaintext for use with Table A.2 tests -var tableA2Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - -// Table A.2 Resulting Ciphertext from the Variable Key Known Answer Test -var tableA2Tests = []CryptTest{ - { // 0 - []byte{ - 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x95, 0xa8, 0xd7, 0x28, 0x13, 0xda, 0xa9, 0x4d}}, - { // 1 - []byte{ - 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x0e, 0xec, 0x14, 0x87, 0xdd, 0x8c, 0x26, 0xd5}}, - { // 2 - []byte{ - 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x7a, 0xd1, 0x6f, 0xfb, 0x79, 0xc4, 0x59, 0x26}}, - { // 3 - []byte{ - 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xd3, 0x74, 0x62, 0x94, 0xca, 0x6a, 0x6c, 0xf3}}, - { // 4 - []byte{ - 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x80, 0x9f, 0x5f, 0x87, 0x3c, 0x1f, 0xd7, 0x61}}, - { // 5 - []byte{ - 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xc0, 0x2f, 0xaf, 0xfe, 0xc9, 0x89, 0xd1, 0xfc}}, - { // 6 - []byte{ - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x46, 0x15, 0xaa, 0x1d, 0x33, 0xe7, 0x2f, 0x10}}, - { // 7 - []byte{ - 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x20, 0x55, 0x12, 0x33, 0x50, 0xc0, 0x08, 0x58}}, - { // 8 - []byte{ - 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xdf, 0x3b, 0x99, 0xd6, 0x57, 0x73, 0x97, 0xc8}}, - { // 9 - []byte{ - 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x31, 0xfe, 0x17, 0x36, 0x9b, 0x52, 0x88, 0xc9}}, - { // 10 - []byte{ - 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xdf, 0xdd, 0x3c, 0xc6, 0x4d, 0xae, 0x16, 0x42}}, - { // 11 - []byte{ - 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x17, 0x8c, 0x83, 0xce, 0x2b, 0x39, 0x9d, 0x94}}, - { // 12 - []byte{ - 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x50, 0xf6, 0x36, 0x32, 0x4a, 0x9b, 0x7f, 0x80}}, - { // 13 - []byte{ - 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xa8, 0x46, 0x8e, 0xe3, 0xbc, 0x18, 0xf0, 0x6d}}, - { // 14 - []byte{ - 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xa2, 0xdc, 0x9e, 0x92, 0xfd, 0x3c, 0xde, 0x92}}, - { // 15 - []byte{ - 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xca, 0xc0, 0x9f, 0x79, 0x7d, 0x03, 0x12, 0x87}}, - { // 16 - []byte{ - 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x90, 0xba, 0x68, 0x0b, 0x22, 0xae, 0xb5, 0x25}}, - { // 17 - []byte{ - 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xce, 0x7a, 0x24, 0xf3, 0x50, 0xe2, 0x80, 0xb6}}, - { // 18 - []byte{ - 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x88, 0x2b, 0xff, 0x0a, 0xa0, 0x1a, 0x0b, 0x87}}, - { // 19 - []byte{ - 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x25, 0x61, 0x02, 0x88, 0x92, 0x45, 0x11, 0xc2}}, - { // 20 - []byte{ - 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xc7, 0x15, 0x16, 0xc2, 0x9c, 0x75, 0xd1, 0x70}}, - { // 21 - []byte{ - 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x51, 0x99, 0xc2, 0x9a, 0x52, 0xc9, 0xf0, 0x59}}, - { // 22 - []byte{ - 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xc2, 0x2f, 0x0a, 0x29, 0x4a, 0x71, 0xf2, 0x9f}}, - { // 23 - []byte{ - 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xee, 0x37, 0x14, 0x83, 0x71, 0x4c, 0x02, 0xea}}, - { // 24 - []byte{ - 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xa8, 0x1f, 0xbd, 0x44, 0x8f, 0x9e, 0x52, 0x2f}}, - { // 25 - []byte{ - 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x4f, 0x64, 0x4c, 0x92, 0xe1, 0x92, 0xdf, 0xed}}, - { // 26 - []byte{ - 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0x1a, 0xfa, 0x9a, 0x66, 0xa6, 0xdf, 0x92, 0xae}}, - { // 27 - []byte{ - 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01}, - nil, - []byte{0xb3, 0xc1, 0xcc, 0x71, 0x5c, 0xb8, 0x79, 0xd8}}, - { // 28 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, 0x01}, - nil, - []byte{0x19, 0xd0, 0x32, 0xe6, 0x4a, 0xb0, 0xbd, 0x8b}}, - { // 29 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, 0x01}, - nil, - []byte{0x3c, 0xfa, 0xa7, 0xa7, 0xdc, 0x87, 0x20, 0xdc}}, - { // 30 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, 0x01}, - nil, - []byte{0xb7, 0x26, 0x5f, 0x7f, 0x44, 0x7a, 0xc6, 0xf3}}, - { // 31 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, 0x01}, - nil, - []byte{0x9d, 0xb7, 0x3b, 0x3c, 0x0d, 0x16, 0x3f, 0x54}}, - { // 32 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, 0x01}, - nil, - []byte{0x81, 0x81, 0xb6, 0x5b, 0xab, 0xf4, 0xa9, 0x75}}, - { // 33 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, 0x01}, - nil, - []byte{0x93, 0xc9, 0xb6, 0x40, 0x42, 0xea, 0xa2, 0x40}}, - { // 34 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01}, - nil, - []byte{0x55, 0x70, 0x53, 0x08, 0x29, 0x70, 0x55, 0x92}}, - { // 35 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, 0x01}, - nil, - []byte{0x86, 0x38, 0x80, 0x9e, 0x87, 0x87, 0x87, 0xa0}}, - { // 36 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, 0x01}, - nil, - []byte{0x41, 0xb9, 0xa7, 0x9a, 0xf7, 0x9a, 0xc2, 0x08}}, - { // 37 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, 0x01}, - nil, - []byte{0x7a, 0x9b, 0xe4, 0x2f, 0x20, 0x09, 0xa8, 0x92}}, - { // 38 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, 0x01}, - nil, - []byte{0x29, 0x03, 0x8d, 0x56, 0xba, 0x6d, 0x27, 0x45}}, - { // 39 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, 0x01}, - nil, - []byte{0x54, 0x95, 0xc6, 0xab, 0xf1, 0xe5, 0xdf, 0x51}}, - { // 40 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, 0x01}, - nil, - []byte{0xae, 0x13, 0xdb, 0xd5, 0x61, 0x48, 0x89, 0x33}}, - { // 41 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, 0x01}, - nil, - []byte{0x02, 0x4d, 0x1f, 0xfa, 0x89, 0x04, 0xe3, 0x89}}, - { // 42 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, 0x01}, - nil, - []byte{0xd1, 0x39, 0x97, 0x12, 0xf9, 0x9b, 0xf0, 0x2e}}, - { // 43 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, 0x01}, - nil, - []byte{0x14, 0xc1, 0xd7, 0xc1, 0xcf, 0xfe, 0xc7, 0x9e}}, - { // 44 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, 0x01}, - nil, - []byte{0x1d, 0xe5, 0x27, 0x9d, 0xae, 0x3b, 0xed, 0x6f}}, - { // 45 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, 0x01}, - nil, - []byte{0xe9, 0x41, 0xa3, 0x3f, 0x85, 0x50, 0x13, 0x03}}, - { // 46 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, 0x01}, - nil, - []byte{0xda, 0x99, 0xdb, 0xbc, 0x9a, 0x03, 0xf3, 0x79}}, - { // 47 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, 0x01}, - nil, - []byte{0xb7, 0xfc, 0x92, 0xf9, 0x1d, 0x8e, 0x92, 0xe9}}, - { // 48 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x01}, - nil, - []byte{0xae, 0x8e, 0x5c, 0xaa, 0x3c, 0xa0, 0x4e, 0x85}}, - { // 49 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x80}, - nil, - []byte{0x9c, 0xc6, 0x2d, 0xf4, 0x3b, 0x6e, 0xed, 0x74}}, - { // 50 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x40}, - nil, - []byte{0xd8, 0x63, 0xdb, 0xb5, 0xc5, 0x9a, 0x91, 0xa0}}, - { // 50 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x20}, - nil, - []byte{0xa1, 0xab, 0x21, 0x90, 0x54, 0x5b, 0x91, 0xd7}}, - { // 52 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x10}, - nil, - []byte{0x08, 0x75, 0x04, 0x1e, 0x64, 0xc5, 0x70, 0xf7}}, - { // 53 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x08}, - nil, - []byte{0x5a, 0x59, 0x45, 0x28, 0xbe, 0xbe, 0xf1, 0xcc}}, - { // 54 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x04}, - nil, - []byte{0xfc, 0xdb, 0x32, 0x91, 0xde, 0x21, 0xf0, 0xc0}}, - { // 55 - []byte{ - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02}, - nil, - []byte{0x86, 0x9e, 0xfd, 0x7f, 0x9f, 0x26, 0x5a, 0x09}}, -} - -// Plaintext for use with Table A.3 tests -var tableA3Plaintext = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - -// Table A.3 Values To Be Used for the Permutation Operation Known Answer Test -var tableA3Tests = []CryptTest{ - { // 0 - []byte{ - 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, - 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, - 0x10, 0x46, 0x91, 0x34, 0x89, 0x98, 0x01, 0x31, - }, - nil, - []byte{0x88, 0xd5, 0x5e, 0x54, 0xf5, 0x4c, 0x97, 0xb4}}, - { // 1 - []byte{ - 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - 0x10, 0x07, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - }, - nil, - []byte{0x0c, 0x0c, 0xc0, 0x0c, 0x83, 0xea, 0x48, 0xfd}}, - { // 2 - []byte{ - 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, - 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, - 0x10, 0x07, 0x10, 0x34, 0xc8, 0x98, 0x01, 0x20, - }, - nil, - []byte{0x83, 0xbc, 0x8e, 0xf3, 0xa6, 0x57, 0x01, 0x83}}, - { // 3 - []byte{ - 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20, - }, - nil, - []byte{0xdf, 0x72, 0x5d, 0xca, 0xd9, 0x4e, 0xa2, 0xe9}}, - { // 4 - []byte{ - 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, - 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, - 0x10, 0x86, 0x91, 0x15, 0x19, 0x19, 0x01, 0x01, - }, - nil, - []byte{0xe6, 0x52, 0xb5, 0x3b, 0x55, 0x0b, 0xe8, 0xb0}}, - { // 5 - []byte{ - 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, - 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, - 0x10, 0x86, 0x91, 0x15, 0x19, 0x58, 0x01, 0x01, - }, - nil, - []byte{0xaf, 0x52, 0x71, 0x20, 0xc4, 0x85, 0xcb, 0xb0}}, - { // 6 - []byte{ - 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, - 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, - 0x51, 0x07, 0xb0, 0x15, 0x19, 0x58, 0x01, 0x01, - }, - nil, - []byte{0x0f, 0x04, 0xce, 0x39, 0x3d, 0xb9, 0x26, 0xd5}}, - { // 7 - []byte{ - 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, - 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, - 0x10, 0x07, 0xb0, 0x15, 0x19, 0x19, 0x01, 0x01, - }, - nil, - []byte{0xc9, 0xf0, 0x0f, 0xfc, 0x74, 0x07, 0x90, 0x67}}, - { // 8 - []byte{ - 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, - 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, - 0x31, 0x07, 0x91, 0x54, 0x98, 0x08, 0x01, 0x01, - }, - nil, - []byte{0x7c, 0xfd, 0x82, 0xa5, 0x93, 0x25, 0x2b, 0x4e}}, - { // 9 - []byte{ - 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, - 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, - 0x31, 0x07, 0x91, 0x94, 0x98, 0x08, 0x01, 0x01, - }, - nil, - []byte{0xcb, 0x49, 0xa2, 0xf9, 0xe9, 0x13, 0x63, 0xe3}}, - { // 10 - []byte{ - 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, - 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, - 0x10, 0x07, 0x91, 0x15, 0xb9, 0x08, 0x01, 0x40, - }, - nil, - []byte{0x00, 0xb5, 0x88, 0xbe, 0x70, 0xd2, 0x3f, 0x56}}, - { // 11 - []byte{ - 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, - 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, - 0x31, 0x07, 0x91, 0x15, 0x98, 0x08, 0x01, 0x40, - }, - nil, - []byte{0x40, 0x6a, 0x9a, 0x6a, 0xb4, 0x33, 0x99, 0xae}}, - { // 12 - []byte{ - 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, - 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, - 0x10, 0x07, 0xd0, 0x15, 0x89, 0x98, 0x01, 0x01, - }, - nil, - []byte{0x6c, 0xb7, 0x73, 0x61, 0x1d, 0xca, 0x9a, 0xda}}, - { // 13 - []byte{ - 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, - 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, - 0x91, 0x07, 0x91, 0x15, 0x89, 0x98, 0x01, 0x01, - }, - nil, - []byte{0x67, 0xfd, 0x21, 0xc1, 0x7d, 0xbb, 0x5d, 0x70}}, - { // 14 - []byte{ - 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, - 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, - 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01, - }, - nil, - []byte{0x95, 0x92, 0xcb, 0x41, 0x10, 0x43, 0x07, 0x87}}, - { // 15 - []byte{ - 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, - 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, - 0x10, 0x07, 0xd0, 0x15, 0x98, 0x98, 0x01, 0x20, - }, - nil, - []byte{0xa6, 0xb7, 0xff, 0x68, 0xa3, 0x18, 0xdd, 0xd3}}, - { // 16 - []byte{ - 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x07, 0x94, 0x04, 0x98, 0x19, 0x01, 0x01, - }, - nil, - []byte{0x4d, 0x10, 0x21, 0x96, 0xc9, 0x14, 0xca, 0x16}}, - { // 17 - []byte{ - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x04, 0x01, - }, - nil, - []byte{0x2d, 0xfa, 0x9f, 0x45, 0x73, 0x59, 0x49, 0x65}}, - { // 18 - []byte{ - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, - 0x01, 0x07, 0x91, 0x04, 0x91, 0x19, 0x01, 0x01, - }, - nil, - []byte{0xb4, 0x66, 0x04, 0x81, 0x6c, 0x0e, 0x07, 0x74}}, - { // 19 - []byte{ - 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, - 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, - 0x01, 0x07, 0x94, 0x04, 0x91, 0x19, 0x04, 0x01, - }, - nil, - []byte{0x6e, 0x7e, 0x62, 0x21, 0xa4, 0xf3, 0x4e, 0x87}}, - { // 20 - []byte{ - 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, - 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, - 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01, - }, - nil, - []byte{0xaa, 0x85, 0xe7, 0x46, 0x43, 0x23, 0x31, 0x99}}, - { // 21 - []byte{ - 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, - 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, - 0x10, 0x07, 0x91, 0x19, 0x98, 0x19, 0x08, 0x01, - }, - nil, - []byte{0x2e, 0x5a, 0x19, 0xdb, 0x4d, 0x19, 0x62, 0xd6}}, - { // 22 - []byte{ - 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, - 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, - 0x10, 0x07, 0x91, 0x19, 0x98, 0x1a, 0x08, 0x01, - }, - nil, - []byte{0x23, 0xa8, 0x66, 0xa8, 0x09, 0xd3, 0x08, 0x94}}, - { // 23 - []byte{ - 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x07, 0x92, 0x10, 0x98, 0x19, 0x01, 0x01, - }, - nil, - []byte{0xd8, 0x12, 0xd9, 0x61, 0xf0, 0x17, 0xd3, 0x20}}, - { // 24 - []byte{ - 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, - 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, - 0x10, 0x07, 0x91, 0x15, 0x98, 0x19, 0x01, 0x0b, - }, - nil, - []byte{0x05, 0x56, 0x05, 0x81, 0x6e, 0x58, 0x60, 0x8f}}, - { // 25 - []byte{ - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x01, - }, - nil, - []byte{0xab, 0xd8, 0x8e, 0x8b, 0x1b, 0x77, 0x16, 0xf1}}, - { // 26 - []byte{ - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x02, - }, - nil, - []byte{0x53, 0x7a, 0xc9, 0x5b, 0xe6, 0x9d, 0xa1, 0xe1}}, - { // 27 - []byte{ - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, - 0x10, 0x04, 0x80, 0x15, 0x98, 0x19, 0x01, 0x08, - }, - nil, - []byte{0xae, 0xd0, 0xf6, 0xae, 0x3c, 0x25, 0xcd, 0xd8}}, - { // 28 - []byte{ - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x01, 0x04, - }, - nil, - []byte{0xb3, 0xe3, 0x5a, 0x5e, 0xe5, 0x3e, 0x7b, 0x8d}}, - { // 29 - []byte{ - 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x19, 0x01, 0x04, - }, - nil, - []byte{0x61, 0xc7, 0x9c, 0x71, 0x92, 0x1a, 0x2e, 0xf8}}, - { // 30 - []byte{ - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, - 0x10, 0x02, 0x91, 0x15, 0x98, 0x10, 0x02, 0x01, - }, - nil, - []byte{0xe2, 0xf5, 0x72, 0x8f, 0x09, 0x95, 0x01, 0x3c}}, - { // 31 - []byte{ - 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, - 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, - 0x10, 0x02, 0x91, 0x16, 0x98, 0x10, 0x01, 0x01, - }, - nil, - []byte{0x1a, 0xea, 0xc3, 0x9a, 0x61, 0xf0, 0xa4, 0x64}}, -} - -// Table A.4 Values To Be Used for the Substitution Table Known Answer Test -var tableA4Tests = []CryptTest{ - { // 0 - []byte{ - 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57, - 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57, - 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57}, - []byte{0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42}, - []byte{0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b}}, - { // 1 - []byte{ - 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e, - 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e, - 0x01, 0x31, 0xd9, 0x61, 0x9d, 0xc1, 0x37, 0x6e}, - []byte{0x5c, 0xd5, 0x4c, 0xa8, 0x3d, 0xef, 0x57, 0xda}, - []byte{0x7a, 0x38, 0x9d, 0x10, 0x35, 0x4b, 0xd2, 0x71}}, - { // 2 - []byte{ - 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86, - 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86, - 0x07, 0xa1, 0x13, 0x3e, 0x4a, 0x0b, 0x26, 0x86}, - []byte{0x02, 0x48, 0xd4, 0x38, 0x06, 0xf6, 0x71, 0x72}, - []byte{0x86, 0x8e, 0xbb, 0x51, 0xca, 0xb4, 0x59, 0x9a}}, - { // 3 - []byte{ - 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e, - 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e, - 0x38, 0x49, 0x67, 0x4c, 0x26, 0x02, 0x31, 0x9e}, - []byte{0x51, 0x45, 0x4b, 0x58, 0x2d, 0xdf, 0x44, 0x0a}, - []byte{0x71, 0x78, 0x87, 0x6e, 0x01, 0xf1, 0x9b, 0x2a}}, - { // 4 - []byte{ - 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6, - 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6, - 0x04, 0xb9, 0x15, 0xba, 0x43, 0xfe, 0xb5, 0xb6}, - []byte{0x42, 0xfd, 0x44, 0x30, 0x59, 0x57, 0x7f, 0xa2}, - []byte{0xaf, 0x37, 0xfb, 0x42, 0x1f, 0x8c, 0x40, 0x95}}, - { // 5 - []byte{ - 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce, - 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce, - 0x01, 0x13, 0xb9, 0x70, 0xfd, 0x34, 0xf2, 0xce}, - []byte{0x05, 0x9b, 0x5e, 0x08, 0x51, 0xcf, 0x14, 0x3a}, - []byte{0x86, 0xa5, 0x60, 0xf1, 0x0e, 0xc6, 0xd8, 0x5b}}, - { // 6 - []byte{ - 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6, - 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6, - 0x01, 0x70, 0xf1, 0x75, 0x46, 0x8f, 0xb5, 0xe6}, - []byte{0x07, 0x56, 0xd8, 0xe0, 0x77, 0x47, 0x61, 0xd2}, - []byte{0x0c, 0xd3, 0xda, 0x02, 0x00, 0x21, 0xdc, 0x09}}, - { // 7 - []byte{ - 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe, - 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe, - 0x43, 0x29, 0x7f, 0xad, 0x38, 0xe3, 0x73, 0xfe}, - []byte{0x76, 0x25, 0x14, 0xb8, 0x29, 0xbf, 0x48, 0x6a}, - []byte{0xea, 0x67, 0x6b, 0x2c, 0xb7, 0xdb, 0x2b, 0x7a}}, - { // 8 - []byte{ - 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16, - 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16, - 0x07, 0xa7, 0x13, 0x70, 0x45, 0xda, 0x2a, 0x16}, - []byte{0x3b, 0xdd, 0x11, 0x90, 0x49, 0x37, 0x28, 0x02}, - []byte{0xdf, 0xd6, 0x4a, 0x81, 0x5c, 0xaf, 0x1a, 0x0f}}, - { // 9 - []byte{ - 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, - 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, - 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f}, - []byte{0x26, 0x95, 0x5f, 0x68, 0x35, 0xaf, 0x60, 0x9a}, - []byte{0x5c, 0x51, 0x3c, 0x9c, 0x48, 0x86, 0xc0, 0x88}}, - { // 10 - []byte{ - 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46, - 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46, - 0x37, 0xd0, 0x6b, 0xb5, 0x16, 0xcb, 0x75, 0x46}, - []byte{0x16, 0x4d, 0x5e, 0x40, 0x4f, 0x27, 0x52, 0x32}, - []byte{0x0a, 0x2a, 0xee, 0xae, 0x3f, 0xf4, 0xab, 0x77}}, - { // 11 - []byte{ - 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e, - 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e, - 0x1f, 0x08, 0x26, 0x0d, 0x1a, 0xc2, 0x46, 0x5e}, - []byte{0x6b, 0x05, 0x6e, 0x18, 0x75, 0x9f, 0x5c, 0xca}, - []byte{0xef, 0x1b, 0xf0, 0x3e, 0x5d, 0xfa, 0x57, 0x5a}}, - { // 12 - []byte{ - 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, - 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, - 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76}, - []byte{0x00, 0x4b, 0xd6, 0xef, 0x09, 0x17, 0x60, 0x62}, - []byte{0x88, 0xbf, 0x0d, 0xb6, 0xd7, 0x0d, 0xee, 0x56}}, - { // 13 - []byte{ - 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07, - 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07, - 0x02, 0x58, 0x16, 0x16, 0x46, 0x29, 0xb0, 0x07}, - []byte{0x48, 0x0d, 0x39, 0x00, 0x6e, 0xe7, 0x62, 0xf2}, - []byte{0xa1, 0xf9, 0x91, 0x55, 0x41, 0x02, 0x0b, 0x56}}, - { // 14 - []byte{ - 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f, - 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f, - 0x49, 0x79, 0x3e, 0xbc, 0x79, 0xb3, 0x25, 0x8f}, - []byte{0x43, 0x75, 0x40, 0xc8, 0x69, 0x8f, 0x3c, 0xfa}, - []byte{0x6f, 0xbf, 0x1c, 0xaf, 0xcf, 0xfd, 0x05, 0x56}}, - { // 15 - []byte{ - 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7, - 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7, - 0x4f, 0xb0, 0x5e, 0x15, 0x15, 0xab, 0x73, 0xa7}, - []byte{0x07, 0x2d, 0x43, 0xa0, 0x77, 0x07, 0x52, 0x92}, - []byte{0x2f, 0x22, 0xe4, 0x9b, 0xab, 0x7c, 0xa1, 0xac}}, - { // 16 - []byte{ - 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf, - 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf, - 0x49, 0xe9, 0x5d, 0x6d, 0x4c, 0xa2, 0x29, 0xbf}, - []byte{0x02, 0xfe, 0x55, 0x77, 0x81, 0x17, 0xf1, 0x2a}, - []byte{0x5a, 0x6b, 0x61, 0x2c, 0xc2, 0x6c, 0xce, 0x4a}}, - { // 17 - []byte{ - 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6, - 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6, - 0x01, 0x83, 0x10, 0xdc, 0x40, 0x9b, 0x26, 0xd6}, - []byte{0x1d, 0x9d, 0x5c, 0x50, 0x18, 0xf7, 0x28, 0xc2}, - []byte{0x5f, 0x4c, 0x03, 0x8e, 0xd1, 0x2b, 0x2e, 0x41}}, - { // 18 - []byte{ - 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef, - 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef, - 0x1c, 0x58, 0x7f, 0x1c, 0x13, 0x92, 0x4f, 0xef}, - []byte{0x30, 0x55, 0x32, 0x28, 0x6d, 0x6f, 0x29, 0x5a}, - []byte{0x63, 0xfa, 0xc0, 0xd0, 0x34, 0xd9, 0xf7, 0x93}}, -} - -func newCipher(key []byte) *desCipher { - c, err := NewCipher(key) - if err != nil { - panic("NewCipher failed: " + err.Error()) - } - return c.(*desCipher) -} - -// Use the known weak keys to test DES implementation -func TestWeakKeys(t *testing.T) { - for i, tt := range weakKeyTests { - var encrypt = func(in []byte) (out []byte) { - c := newCipher(tt.key) - out = make([]byte, len(in)) - encryptBlock(c.subkeys[:], out, in) - return - } - - // Encrypting twice with a DES weak - // key should reproduce the original input - result := encrypt(tt.in) - result = encrypt(result) - - if !bytes.Equal(result, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, result, tt.in) - } - } -} - -// Use the known semi-weak key pairs to test DES implementation -func TestSemiWeakKeyPairs(t *testing.T) { - for i, tt := range semiWeakKeyTests { - var encrypt = func(key, in []byte) (out []byte) { - c := newCipher(key) - out = make([]byte, len(in)) - encryptBlock(c.subkeys[:], out, in) - return - } - - // Encrypting with one member of the semi-weak pair - // and then encrypting the result with the other member - // should reproduce the original input. - result := encrypt(tt.key, tt.in) - result = encrypt(tt.out, result) - - if !bytes.Equal(result, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, result, tt.in) - } - } -} - -func TestDESEncryptBlock(t *testing.T) { - for i, tt := range encryptDESTests { - c := newCipher(tt.key) - out := make([]byte, len(tt.in)) - encryptBlock(c.subkeys[:], out, tt.in) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -func TestDESDecryptBlock(t *testing.T) { - for i, tt := range encryptDESTests { - c := newCipher(tt.key) - plain := make([]byte, len(tt.in)) - decryptBlock(c.subkeys[:], plain, tt.out) - - if !bytes.Equal(plain, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) - } - } -} - -func TestEncryptTripleDES(t *testing.T) { - for i, tt := range encryptTripleDESTests { - c, _ := NewTripleDESCipher(tt.key) - out := make([]byte, len(tt.in)) - c.Encrypt(out, tt.in) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -func TestDecryptTripleDES(t *testing.T) { - for i, tt := range encryptTripleDESTests { - c, _ := NewTripleDESCipher(tt.key) - - plain := make([]byte, len(tt.in)) - c.Decrypt(plain, tt.out) - - if !bytes.Equal(plain, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) - } - } -} - -// Defined in Pub 800-20 -func TestVariablePlaintextKnownAnswer(t *testing.T) { - for i, tt := range tableA1Tests { - c, _ := NewTripleDESCipher(tableA1Key) - - out := make([]byte, len(tt.in)) - c.Encrypt(out, tt.in) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -// Defined in Pub 800-20 -func TestVariableCiphertextKnownAnswer(t *testing.T) { - for i, tt := range tableA1Tests { - c, _ := NewTripleDESCipher(tableA1Key) - - plain := make([]byte, len(tt.out)) - c.Decrypt(plain, tt.out) - - if !bytes.Equal(plain, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) - } - } -} - -// Defined in Pub 800-20 -// Encrypting the Table A.1 ciphertext with the -// 0x01... key produces the original plaintext -func TestInversePermutationKnownAnswer(t *testing.T) { - for i, tt := range tableA1Tests { - c, _ := NewTripleDESCipher(tableA1Key) - - plain := make([]byte, len(tt.in)) - c.Encrypt(plain, tt.out) - - if !bytes.Equal(plain, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, plain, tt.in) - } - } -} - -// Defined in Pub 800-20 -// Decrypting the Table A.1 plaintext with the -// 0x01... key produces the corresponding ciphertext -func TestInitialPermutationKnownAnswer(t *testing.T) { - for i, tt := range tableA1Tests { - c, _ := NewTripleDESCipher(tableA1Key) - - out := make([]byte, len(tt.in)) - c.Decrypt(out, tt.in) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -// Defined in Pub 800-20 -func TestVariableKeyKnownAnswerEncrypt(t *testing.T) { - for i, tt := range tableA2Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tableA2Plaintext)) - c.Encrypt(out, tableA2Plaintext) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -// Defined in Pub 800-20 -func TestVariableKeyKnownAnswerDecrypt(t *testing.T) { - for i, tt := range tableA2Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tt.out)) - c.Decrypt(out, tt.out) - - if !bytes.Equal(out, tableA2Plaintext) { - t.Errorf("#%d: result: %x want: %x", i, out, tableA2Plaintext) - } - } -} - -// Defined in Pub 800-20 -func TestPermutationOperationKnownAnswerEncrypt(t *testing.T) { - for i, tt := range tableA3Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tableA3Plaintext)) - c.Encrypt(out, tableA3Plaintext) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -// Defined in Pub 800-20 -func TestPermutationOperationKnownAnswerDecrypt(t *testing.T) { - for i, tt := range tableA3Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tt.out)) - c.Decrypt(out, tt.out) - - if !bytes.Equal(out, tableA3Plaintext) { - t.Errorf("#%d: result: %x want: %x", i, out, tableA3Plaintext) - } - } -} - -// Defined in Pub 800-20 -func TestSubstitutionTableKnownAnswerEncrypt(t *testing.T) { - for i, tt := range tableA4Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tt.in)) - c.Encrypt(out, tt.in) - - if !bytes.Equal(out, tt.out) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.out) - } - } -} - -// Defined in Pub 800-20 -func TestSubstitutionTableKnownAnswerDecrypt(t *testing.T) { - for i, tt := range tableA4Tests { - c, _ := NewTripleDESCipher(tt.key) - - out := make([]byte, len(tt.out)) - c.Decrypt(out, tt.out) - - if !bytes.Equal(out, tt.in) { - t.Errorf("#%d: result: %x want: %x", i, out, tt.in) - } - } -} - -func TestInitialPermute(t *testing.T) { - for i := uint(0); i < 64; i++ { - bit := uint64(1) << i - got := permuteInitialBlock(bit) - want := uint64(1) << finalPermutation[63-i] - if got != want { - t.Errorf("permute(%x) = %x, want %x", bit, got, want) - } - } -} - -func TestFinalPermute(t *testing.T) { - for i := uint(0); i < 64; i++ { - bit := uint64(1) << i - got := permuteFinalBlock(bit) - want := uint64(1) << initialPermutation[63-i] - if got != want { - t.Errorf("permute(%x) = %x, want %x", bit, got, want) - } - } -} - -func TestExpandBlock(t *testing.T) { - for i := uint(0); i < 32; i++ { - bit := uint32(1) << i - got := expandBlock(bit) - want := permuteBlock(uint64(bit), expansionFunction[:]) - if got != want { - t.Errorf("expand(%x) = %x, want %x", bit, got, want) - } - } -} - -func BenchmarkEncrypt(b *testing.B) { - tt := encryptDESTests[0] - c, err := NewCipher(tt.key) - if err != nil { - b.Fatal("NewCipher:", err) - } - out := make([]byte, len(tt.in)) - b.SetBytes(int64(len(out))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - c.Encrypt(out, tt.in) - } -} - -func BenchmarkDecrypt(b *testing.B) { - tt := encryptDESTests[0] - c, err := NewCipher(tt.key) - if err != nil { - b.Fatal("NewCipher:", err) - } - out := make([]byte, len(tt.out)) - b.SetBytes(int64(len(out))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - c.Decrypt(out, tt.out) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa.go b/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa.go deleted file mode 100644 index b7565a61b0293899a9fd8e722f6d66fafb3471eb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa.go +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package dsa implements the Digital Signature Algorithm, as defined in FIPS 186-3. -package dsa - -import ( - "errors" - "io" - "math/big" -) - -// Parameters represents the domain parameters for a key. These parameters can -// be shared across many keys. The bit length of Q must be a multiple of 8. -type Parameters struct { - P, Q, G *big.Int -} - -// PublicKey represents a DSA public key. -type PublicKey struct { - Parameters - Y *big.Int -} - -// PrivateKey represents a DSA private key. -type PrivateKey struct { - PublicKey - X *big.Int -} - -// ErrInvalidPublicKey results when a public key is not usable by this code. -// FIPS is quite strict about the format of DSA keys, but other code may be -// less so. Thus, when using keys which may have been generated by other code, -// this error must be handled. -var ErrInvalidPublicKey = errors.New("crypto/dsa: invalid public key") - -// ParameterSizes is a enumeration of the acceptable bit lengths of the primes -// in a set of DSA parameters. See FIPS 186-3, section 4.2. -type ParameterSizes int - -const ( - L1024N160 ParameterSizes = iota - L2048N224 - L2048N256 - L3072N256 -) - -// numMRTests is the number of Miller-Rabin primality tests that we perform. We -// pick the largest recommended number from table C.1 of FIPS 186-3. -const numMRTests = 64 - -// GenerateParameters puts a random, valid set of DSA parameters into params. -// This function takes many seconds, even on fast machines. -func GenerateParameters(params *Parameters, rand io.Reader, sizes ParameterSizes) (err error) { - // This function doesn't follow FIPS 186-3 exactly in that it doesn't - // use a verification seed to generate the primes. The verification - // seed doesn't appear to be exported or used by other code and - // omitting it makes the code cleaner. - - var L, N int - switch sizes { - case L1024N160: - L = 1024 - N = 160 - case L2048N224: - L = 2048 - N = 224 - case L2048N256: - L = 2048 - N = 256 - case L3072N256: - L = 3072 - N = 256 - default: - return errors.New("crypto/dsa: invalid ParameterSizes") - } - - qBytes := make([]byte, N/8) - pBytes := make([]byte, L/8) - - q := new(big.Int) - p := new(big.Int) - rem := new(big.Int) - one := new(big.Int) - one.SetInt64(1) - -GeneratePrimes: - for { - _, err = io.ReadFull(rand, qBytes) - if err != nil { - return - } - - qBytes[len(qBytes)-1] |= 1 - qBytes[0] |= 0x80 - q.SetBytes(qBytes) - - if !q.ProbablyPrime(numMRTests) { - continue - } - - for i := 0; i < 4*L; i++ { - _, err = io.ReadFull(rand, pBytes) - if err != nil { - return - } - - pBytes[len(pBytes)-1] |= 1 - pBytes[0] |= 0x80 - - p.SetBytes(pBytes) - rem.Mod(p, q) - rem.Sub(rem, one) - p.Sub(p, rem) - if p.BitLen() < L { - continue - } - - if !p.ProbablyPrime(numMRTests) { - continue - } - - params.P = p - params.Q = q - break GeneratePrimes - } - } - - h := new(big.Int) - h.SetInt64(2) - g := new(big.Int) - - pm1 := new(big.Int).Sub(p, one) - e := new(big.Int).Div(pm1, q) - - for { - g.Exp(h, e, p) - if g.Cmp(one) == 0 { - h.Add(h, one) - continue - } - - params.G = g - return - } -} - -// GenerateKey generates a public&private key pair. The Parameters of the -// PrivateKey must already be valid (see GenerateParameters). -func GenerateKey(priv *PrivateKey, rand io.Reader) error { - if priv.P == nil || priv.Q == nil || priv.G == nil { - return errors.New("crypto/dsa: parameters not set up before generating key") - } - - x := new(big.Int) - xBytes := make([]byte, priv.Q.BitLen()/8) - - for { - _, err := io.ReadFull(rand, xBytes) - if err != nil { - return err - } - x.SetBytes(xBytes) - if x.Sign() != 0 && x.Cmp(priv.Q) < 0 { - break - } - } - - priv.X = x - priv.Y = new(big.Int) - priv.Y.Exp(priv.G, x, priv.P) - return nil -} - -// fermatInverse calculates the inverse of k in GF(P) using Fermat's method. -// This has better constant-time properties than Euclid's method (implemented -// in math/big.Int.ModInverse) although math/big itself isn't strictly -// constant-time so it's not perfect. -func fermatInverse(k, P *big.Int) *big.Int { - two := big.NewInt(2) - pMinus2 := new(big.Int).Sub(P, two) - return new(big.Int).Exp(k, pMinus2, P) -} - -// Sign signs an arbitrary length hash (which should be the result of hashing a -// larger message) using the private key, priv. It returns the signature as a -// pair of integers. The security of the private key depends on the entropy of -// rand. -// -// Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated -// to the byte-length of the subgroup. This function does not perform that -// truncation itself. -func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { - // FIPS 186-3, section 4.6 - - n := priv.Q.BitLen() - if n&7 != 0 { - err = ErrInvalidPublicKey - return - } - n >>= 3 - - for { - k := new(big.Int) - buf := make([]byte, n) - for { - _, err = io.ReadFull(rand, buf) - if err != nil { - return - } - k.SetBytes(buf) - if k.Sign() > 0 && k.Cmp(priv.Q) < 0 { - break - } - } - - kInv := fermatInverse(k, priv.Q) - - r = new(big.Int).Exp(priv.G, k, priv.P) - r.Mod(r, priv.Q) - - if r.Sign() == 0 { - continue - } - - z := k.SetBytes(hash) - - s = new(big.Int).Mul(priv.X, r) - s.Add(s, z) - s.Mod(s, priv.Q) - s.Mul(s, kInv) - s.Mod(s, priv.Q) - - if s.Sign() != 0 { - break - } - } - - return -} - -// Verify verifies the signature in r, s of hash using the public key, pub. It -// reports whether the signature is valid. -// -// Note that FIPS 186-3 section 4.6 specifies that the hash should be truncated -// to the byte-length of the subgroup. This function does not perform that -// truncation itself. -func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { - // FIPS 186-3, section 4.7 - - if r.Sign() < 1 || r.Cmp(pub.Q) >= 0 { - return false - } - if s.Sign() < 1 || s.Cmp(pub.Q) >= 0 { - return false - } - - w := new(big.Int).ModInverse(s, pub.Q) - - n := pub.Q.BitLen() - if n&7 != 0 { - return false - } - z := new(big.Int).SetBytes(hash) - - u1 := new(big.Int).Mul(z, w) - u1.Mod(u1, pub.Q) - u2 := w.Mul(r, w) - u2.Mod(u2, pub.Q) - v := u1.Exp(pub.G, u1, pub.P) - u2.Exp(pub.Y, u2, pub.P) - v.Mul(v, u2) - v.Mod(v, pub.P) - v.Mod(v, pub.Q) - - return v.Cmp(r) == 0 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa_test.go deleted file mode 100644 index 568416d0dfb23377129b7db9d5081a4cb762e4ae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/dsa/dsa_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dsa - -import ( - "crypto/rand" - "math/big" - "testing" -) - -func testSignAndVerify(t *testing.T, i int, priv *PrivateKey) { - hashed := []byte("testing") - r, s, err := Sign(rand.Reader, priv, hashed) - if err != nil { - t.Errorf("%d: error signing: %s", i, err) - return - } - - if !Verify(&priv.PublicKey, hashed, r, s) { - t.Errorf("%d: Verify failed", i) - } -} - -func testParameterGeneration(t *testing.T, sizes ParameterSizes, L, N int) { - var priv PrivateKey - params := &priv.Parameters - - err := GenerateParameters(params, rand.Reader, sizes) - if err != nil { - t.Errorf("%d: %s", int(sizes), err) - return - } - - if params.P.BitLen() != L { - t.Errorf("%d: params.BitLen got:%d want:%d", int(sizes), params.P.BitLen(), L) - } - - if params.Q.BitLen() != N { - t.Errorf("%d: q.BitLen got:%d want:%d", int(sizes), params.Q.BitLen(), L) - } - - one := new(big.Int) - one.SetInt64(1) - pm1 := new(big.Int).Sub(params.P, one) - quo, rem := new(big.Int).DivMod(pm1, params.Q, new(big.Int)) - if rem.Sign() != 0 { - t.Errorf("%d: p-1 mod q != 0", int(sizes)) - } - x := new(big.Int).Exp(params.G, quo, params.P) - if x.Cmp(one) == 0 { - t.Errorf("%d: invalid generator", int(sizes)) - } - - err = GenerateKey(&priv, rand.Reader) - if err != nil { - t.Errorf("error generating key: %s", err) - return - } - - testSignAndVerify(t, int(sizes), &priv) -} - -func TestParameterGeneration(t *testing.T) { - if testing.Short() { - t.Skip("skipping parameter generation test in short mode") - } - - testParameterGeneration(t, L1024N160, 1024, 160) - testParameterGeneration(t, L2048N224, 2048, 224) - testParameterGeneration(t, L2048N256, 2048, 256) - testParameterGeneration(t, L3072N256, 3072, 256) -} - -func TestSignAndVerify(t *testing.T) { - var priv PrivateKey - priv.P, _ = new(big.Int).SetString("A9B5B793FB4785793D246BAE77E8FF63CA52F442DA763C440259919FE1BC1D6065A9350637A04F75A2F039401D49F08E066C4D275A5A65DA5684BC563C14289D7AB8A67163BFBF79D85972619AD2CFF55AB0EE77A9002B0EF96293BDD0F42685EBB2C66C327079F6C98000FBCB79AACDE1BC6F9D5C7B1A97E3D9D54ED7951FEF", 16) - priv.Q, _ = new(big.Int).SetString("E1D3391245933D68A0714ED34BBCB7A1F422B9C1", 16) - priv.G, _ = new(big.Int).SetString("634364FC25248933D01D1993ECABD0657CC0CB2CEED7ED2E3E8AECDFCDC4A25C3B15E9E3B163ACA2984B5539181F3EFF1A5E8903D71D5B95DA4F27202B77D2C44B430BB53741A8D59A8F86887525C9F2A6A5980A195EAA7F2FF910064301DEF89D3AA213E1FAC7768D89365318E370AF54A112EFBA9246D9158386BA1B4EEFDA", 16) - priv.Y, _ = new(big.Int).SetString("32969E5780CFE1C849A1C276D7AEB4F38A23B591739AA2FE197349AEEBD31366AEE5EB7E6C6DDB7C57D02432B30DB5AA66D9884299FAA72568944E4EEDC92EA3FBC6F39F53412FBCC563208F7C15B737AC8910DBC2D9C9B8C001E72FDC40EB694AB1F06A5A2DBD18D9E36C66F31F566742F11EC0A52E9F7B89355C02FB5D32D2", 16) - priv.X, _ = new(big.Int).SetString("5078D4D29795CBE76D3AACFE48C9AF0BCDBEE91A", 16) - - testSignAndVerify(t, 0, &priv) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa.go b/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa.go deleted file mode 100644 index 8d66477fd10d2871e0b4bc571383a683058db4fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa.go +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ecdsa implements the Elliptic Curve Digital Signature Algorithm, as -// defined in FIPS 186-3. -// -// This implementation derives the nonce from an AES-CTR CSPRNG keyed by -// ChopMD(256, SHA2-512(priv.D || entropy || hash)). The CSPRNG key is IRO by -// a result of Coron; the AES-CTR stream is IRO under standard assumptions. -package ecdsa - -// References: -// [NSA]: Suite B implementer's guide to FIPS 186-3, -// http://www.nsa.gov/ia/_files/ecdsa.pdf -// [SECG]: SECG, SEC1 -// http://www.secg.org/sec1-v2.pdf - -import ( - "crypto" - "crypto/aes" - "crypto/cipher" - "crypto/elliptic" - "crypto/sha512" - "encoding/asn1" - "io" - "math/big" -) - -const ( - aesIV = "IV for ECDSA CTR" -) - -// PublicKey represents an ECDSA public key. -type PublicKey struct { - elliptic.Curve - X, Y *big.Int -} - -// PrivateKey represents a ECDSA private key. -type PrivateKey struct { - PublicKey - D *big.Int -} - -type ecdsaSignature struct { - R, S *big.Int -} - -// Public returns the public key corresponding to priv. -func (priv *PrivateKey) Public() crypto.PublicKey { - return &priv.PublicKey -} - -// Sign signs msg with priv, reading randomness from rand. This method is -// intended to support keys where the private part is kept in, for example, a -// hardware module. Common uses should use the Sign function in this package -// directly. -func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) { - r, s, err := Sign(rand, priv, msg) - if err != nil { - return nil, err - } - - return asn1.Marshal(ecdsaSignature{r, s}) -} - -var one = new(big.Int).SetInt64(1) - -// randFieldElement returns a random element of the field underlying the given -// curve using the procedure given in [NSA] A.2.1. -func randFieldElement(c elliptic.Curve, rand io.Reader) (k *big.Int, err error) { - params := c.Params() - b := make([]byte, params.BitSize/8+8) - _, err = io.ReadFull(rand, b) - if err != nil { - return - } - - k = new(big.Int).SetBytes(b) - n := new(big.Int).Sub(params.N, one) - k.Mod(k, n) - k.Add(k, one) - return -} - -// GenerateKey generates a public and private key pair. -func GenerateKey(c elliptic.Curve, rand io.Reader) (priv *PrivateKey, err error) { - k, err := randFieldElement(c, rand) - if err != nil { - return - } - - priv = new(PrivateKey) - priv.PublicKey.Curve = c - priv.D = k - priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes()) - return -} - -// hashToInt converts a hash value to an integer. There is some disagreement -// about how this is done. [NSA] suggests that this is done in the obvious -// manner, but [SECG] truncates the hash to the bit-length of the curve order -// first. We follow [SECG] because that's what OpenSSL does. Additionally, -// OpenSSL right shifts excess bits from the number if the hash is too large -// and we mirror that too. -func hashToInt(hash []byte, c elliptic.Curve) *big.Int { - orderBits := c.Params().N.BitLen() - orderBytes := (orderBits + 7) / 8 - if len(hash) > orderBytes { - hash = hash[:orderBytes] - } - - ret := new(big.Int).SetBytes(hash) - excess := len(hash)*8 - orderBits - if excess > 0 { - ret.Rsh(ret, uint(excess)) - } - return ret -} - -// fermatInverse calculates the inverse of k in GF(P) using Fermat's method. -// This has better constant-time properties than Euclid's method (implemented -// in math/big.Int.ModInverse) although math/big itself isn't strictly -// constant-time so it's not perfect. -func fermatInverse(k, N *big.Int) *big.Int { - two := big.NewInt(2) - nMinus2 := new(big.Int).Sub(N, two) - return new(big.Int).Exp(k, nMinus2, N) -} - -// Sign signs an arbitrary length hash (which should be the result of hashing a -// larger message) using the private key, priv. It returns the signature as a -// pair of integers. The security of the private key depends on the entropy of -// rand. -func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { - // Get max(log2(q) / 2, 256) bits of entropy from rand. - entropylen := (priv.Curve.Params().BitSize + 7) / 16 - if entropylen > 32 { - entropylen = 32 - } - entropy := make([]byte, entropylen) - _, err = io.ReadFull(rand, entropy) - if err != nil { - return - } - - // Initialize an SHA-512 hash context; digest ... - md := sha512.New() - md.Write(priv.D.Bytes()) // the private key, - md.Write(entropy) // the entropy, - md.Write(hash) // and the input hash; - key := md.Sum(nil)[:32] // and compute ChopMD-256(SHA-512), - // which is an indifferentiable MAC. - - // Create an AES-CTR instance to use as a CSPRNG. - block, err := aes.NewCipher(key) - if err != nil { - return nil, nil, err - } - - // Create a CSPRNG that xors a stream of zeros with - // the output of the AES-CTR instance. - csprng := cipher.StreamReader{ - R: zeroReader, - S: cipher.NewCTR(block, []byte(aesIV)), - } - - // See [NSA] 3.4.1 - c := priv.PublicKey.Curve - N := c.Params().N - - var k, kInv *big.Int - for { - for { - k, err = randFieldElement(c, csprng) - if err != nil { - r = nil - return - } - - kInv = fermatInverse(k, N) - r, _ = priv.Curve.ScalarBaseMult(k.Bytes()) - r.Mod(r, N) - if r.Sign() != 0 { - break - } - } - - e := hashToInt(hash, c) - s = new(big.Int).Mul(priv.D, r) - s.Add(s, e) - s.Mul(s, kInv) - s.Mod(s, N) - if s.Sign() != 0 { - break - } - } - - return -} - -// Verify verifies the signature in r, s of hash using the public key, pub. Its -// return value records whether the signature is valid. -func Verify(pub *PublicKey, hash []byte, r, s *big.Int) bool { - // See [NSA] 3.4.2 - c := pub.Curve - N := c.Params().N - - if r.Sign() == 0 || s.Sign() == 0 { - return false - } - if r.Cmp(N) >= 0 || s.Cmp(N) >= 0 { - return false - } - e := hashToInt(hash, c) - w := new(big.Int).ModInverse(s, N) - - u1 := e.Mul(e, w) - u1.Mod(u1, N) - u2 := w.Mul(r, w) - u2.Mod(u2, N) - - x1, y1 := c.ScalarBaseMult(u1.Bytes()) - x2, y2 := c.ScalarMult(pub.X, pub.Y, u2.Bytes()) - x, y := c.Add(x1, y1, x2, y2) - if x.Sign() == 0 && y.Sign() == 0 { - return false - } - x.Mod(x, N) - return x.Cmp(r) == 0 -} - -type zr struct { - io.Reader -} - -// Read replaces the contents of dst with zeros. -func (z *zr) Read(dst []byte) (n int, err error) { - for i := range dst { - dst[i] = 0 - } - return len(dst), nil -} - -var zeroReader = &zr{} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa_test.go deleted file mode 100644 index 169944dfb27b2207cd1076aed95dc2a037a21328..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/ecdsa/ecdsa_test.go +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ecdsa - -import ( - "bufio" - "compress/bzip2" - "crypto/elliptic" - "crypto/rand" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "encoding/hex" - "hash" - "io" - "math/big" - "os" - "strings" - "testing" -) - -func testKeyGeneration(t *testing.T, c elliptic.Curve, tag string) { - priv, err := GenerateKey(c, rand.Reader) - if err != nil { - t.Errorf("%s: error: %s", tag, err) - return - } - if !c.IsOnCurve(priv.PublicKey.X, priv.PublicKey.Y) { - t.Errorf("%s: public key invalid: %s", tag, err) - } -} - -func TestKeyGeneration(t *testing.T) { - testKeyGeneration(t, elliptic.P224(), "p224") - if testing.Short() { - return - } - testKeyGeneration(t, elliptic.P256(), "p256") - testKeyGeneration(t, elliptic.P384(), "p384") - testKeyGeneration(t, elliptic.P521(), "p521") -} - -func testSignAndVerify(t *testing.T, c elliptic.Curve, tag string) { - priv, _ := GenerateKey(c, rand.Reader) - - hashed := []byte("testing") - r, s, err := Sign(rand.Reader, priv, hashed) - if err != nil { - t.Errorf("%s: error signing: %s", tag, err) - return - } - - if !Verify(&priv.PublicKey, hashed, r, s) { - t.Errorf("%s: Verify failed", tag) - } - - hashed[0] ^= 0xff - if Verify(&priv.PublicKey, hashed, r, s) { - t.Errorf("%s: Verify always works!", tag) - } -} - -func TestSignAndVerify(t *testing.T) { - testSignAndVerify(t, elliptic.P224(), "p224") - if testing.Short() { - return - } - testSignAndVerify(t, elliptic.P256(), "p256") - testSignAndVerify(t, elliptic.P384(), "p384") - testSignAndVerify(t, elliptic.P521(), "p521") -} - -func testNonceSafety(t *testing.T, c elliptic.Curve, tag string) { - priv, _ := GenerateKey(c, rand.Reader) - - hashed := []byte("testing") - r0, s0, err := Sign(zeroReader, priv, hashed) - if err != nil { - t.Errorf("%s: error signing: %s", tag, err) - return - } - - hashed = []byte("testing...") - r1, s1, err := Sign(zeroReader, priv, hashed) - if err != nil { - t.Errorf("%s: error signing: %s", tag, err) - return - } - - if s0.Cmp(s1) == 0 { - // This should never happen. - t.Errorf("%s: the signatures on two different messages were the same") - } - - if r0.Cmp(r1) == 0 { - t.Errorf("%s: the nonce used for two diferent messages was the same") - } -} - -func TestNonceSafety(t *testing.T) { - testNonceSafety(t, elliptic.P224(), "p224") - if testing.Short() { - return - } - testNonceSafety(t, elliptic.P256(), "p256") - testNonceSafety(t, elliptic.P384(), "p384") - testNonceSafety(t, elliptic.P521(), "p521") -} - -func testINDCCA(t *testing.T, c elliptic.Curve, tag string) { - priv, _ := GenerateKey(c, rand.Reader) - - hashed := []byte("testing") - r0, s0, err := Sign(rand.Reader, priv, hashed) - if err != nil { - t.Errorf("%s: error signing: %s", tag, err) - return - } - - r1, s1, err := Sign(rand.Reader, priv, hashed) - if err != nil { - t.Errorf("%s: error signing: %s", tag, err) - return - } - - if s0.Cmp(s1) == 0 { - t.Errorf("%s: two signatures of the same message produced the same result") - } - - if r0.Cmp(r1) == 0 { - t.Errorf("%s: two signatures of the same message produced the same nonce") - } -} - -func TestINDCCA(t *testing.T) { - testINDCCA(t, elliptic.P224(), "p224") - if testing.Short() { - return - } - testINDCCA(t, elliptic.P256(), "p256") - testINDCCA(t, elliptic.P384(), "p384") - testINDCCA(t, elliptic.P521(), "p521") -} - -func fromHex(s string) *big.Int { - r, ok := new(big.Int).SetString(s, 16) - if !ok { - panic("bad hex") - } - return r -} - -func TestVectors(t *testing.T) { - // This test runs the full set of NIST test vectors from - // http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvectors.zip - // - // The SigVer.rsp file has been edited to remove test vectors for - // unsupported algorithms and has been compressed. - - if testing.Short() { - return - } - - f, err := os.Open("testdata/SigVer.rsp.bz2") - if err != nil { - t.Fatal(err) - } - - buf := bufio.NewReader(bzip2.NewReader(f)) - - lineNo := 1 - var h hash.Hash - var msg []byte - var hashed []byte - var r, s *big.Int - pub := new(PublicKey) - - for { - line, err := buf.ReadString('\n') - if len(line) == 0 { - if err == io.EOF { - break - } - t.Fatalf("error reading from input: %s", err) - } - lineNo++ - // Need to remove \r\n from the end of the line. - if !strings.HasSuffix(line, "\r\n") { - t.Fatalf("bad line ending (expected \\r\\n) on line %d", lineNo) - } - line = line[:len(line)-2] - - if len(line) == 0 || line[0] == '#' { - continue - } - - if line[0] == '[' { - line = line[1 : len(line)-1] - parts := strings.SplitN(line, ",", 2) - - switch parts[0] { - case "P-224": - pub.Curve = elliptic.P224() - case "P-256": - pub.Curve = elliptic.P256() - case "P-384": - pub.Curve = elliptic.P384() - case "P-521": - pub.Curve = elliptic.P521() - default: - pub.Curve = nil - } - - switch parts[1] { - case "SHA-1": - h = sha1.New() - case "SHA-224": - h = sha256.New224() - case "SHA-256": - h = sha256.New() - case "SHA-384": - h = sha512.New384() - case "SHA-512": - h = sha512.New() - default: - h = nil - } - - continue - } - - if h == nil || pub.Curve == nil { - continue - } - - switch { - case strings.HasPrefix(line, "Msg = "): - if msg, err = hex.DecodeString(line[6:]); err != nil { - t.Fatalf("failed to decode message on line %d: %s", lineNo, err) - } - case strings.HasPrefix(line, "Qx = "): - pub.X = fromHex(line[5:]) - case strings.HasPrefix(line, "Qy = "): - pub.Y = fromHex(line[5:]) - case strings.HasPrefix(line, "R = "): - r = fromHex(line[4:]) - case strings.HasPrefix(line, "S = "): - s = fromHex(line[4:]) - case strings.HasPrefix(line, "Result = "): - expected := line[9] == 'P' - h.Reset() - h.Write(msg) - hashed := h.Sum(hashed[:0]) - if Verify(pub, hashed, r, s) != expected { - t.Fatalf("incorrect result on line %d", lineNo) - } - default: - t.Fatalf("unknown variable on line %d: %s", lineNo, line) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic.go b/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic.go deleted file mode 100644 index e6b59c5f436b9d24a8a61e093bd2adcc079e72ba..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic.go +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package elliptic implements several standard elliptic curves over prime -// fields. -package elliptic - -// This package operates, internally, on Jacobian coordinates. For a given -// (x, y) position on the curve, the Jacobian coordinates are (x1, y1, z1) -// where x = x1/z1² and y = y1/z1³. The greatest speedups come when the whole -// calculation can be performed within the transform (as in ScalarMult and -// ScalarBaseMult). But even for Add and Double, it's faster to apply and -// reverse the transform than to operate in affine coordinates. - -import ( - "io" - "math/big" - "sync" -) - -// A Curve represents a short-form Weierstrass curve with a=-3. -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html -type Curve interface { - // Params returns the parameters for the curve. - Params() *CurveParams - // IsOnCurve reports whether the given (x,y) lies on the curve. - IsOnCurve(x, y *big.Int) bool - // Add returns the sum of (x1,y1) and (x2,y2) - Add(x1, y1, x2, y2 *big.Int) (x, y *big.Int) - // Double returns 2*(x,y) - Double(x1, y1 *big.Int) (x, y *big.Int) - // ScalarMult returns k*(Bx,By) where k is a number in big-endian form. - ScalarMult(x1, y1 *big.Int, k []byte) (x, y *big.Int) - // ScalarBaseMult returns k*G, where G is the base point of the group - // and k is an integer in big-endian form. - ScalarBaseMult(k []byte) (x, y *big.Int) -} - -// CurveParams contains the parameters of an elliptic curve and also provides -// a generic, non-constant time implementation of Curve. -type CurveParams struct { - P *big.Int // the order of the underlying field - N *big.Int // the order of the base point - B *big.Int // the constant of the curve equation - Gx, Gy *big.Int // (x,y) of the base point - BitSize int // the size of the underlying field - Name string // the canonical name of the curve -} - -func (curve *CurveParams) Params() *CurveParams { - return curve -} - -func (curve *CurveParams) IsOnCurve(x, y *big.Int) bool { - // y² = x³ - 3x + b - y2 := new(big.Int).Mul(y, y) - y2.Mod(y2, curve.P) - - x3 := new(big.Int).Mul(x, x) - x3.Mul(x3, x) - - threeX := new(big.Int).Lsh(x, 1) - threeX.Add(threeX, x) - - x3.Sub(x3, threeX) - x3.Add(x3, curve.B) - x3.Mod(x3, curve.P) - - return x3.Cmp(y2) == 0 -} - -// zForAffine returns a Jacobian Z value for the affine point (x, y). If x and -// y are zero, it assumes that they represent the point at infinity because (0, -// 0) is not on the any of the curves handled here. -func zForAffine(x, y *big.Int) *big.Int { - z := new(big.Int) - if x.Sign() != 0 || y.Sign() != 0 { - z.SetInt64(1) - } - return z -} - -// affineFromJacobian reverses the Jacobian transform. See the comment at the -// top of the file. If the point is ∞ it returns 0, 0. -func (curve *CurveParams) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) { - if z.Sign() == 0 { - return new(big.Int), new(big.Int) - } - - zinv := new(big.Int).ModInverse(z, curve.P) - zinvsq := new(big.Int).Mul(zinv, zinv) - - xOut = new(big.Int).Mul(x, zinvsq) - xOut.Mod(xOut, curve.P) - zinvsq.Mul(zinvsq, zinv) - yOut = new(big.Int).Mul(y, zinvsq) - yOut.Mod(yOut, curve.P) - return -} - -func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) { - z1 := zForAffine(x1, y1) - z2 := zForAffine(x2, y2) - return curve.affineFromJacobian(curve.addJacobian(x1, y1, z1, x2, y2, z2)) -} - -// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and -// (x2, y2, z2) and returns their sum, also in Jacobian form. -func (curve *CurveParams) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl - x3, y3, z3 := new(big.Int), new(big.Int), new(big.Int) - if z1.Sign() == 0 { - x3.Set(x2) - y3.Set(y2) - z3.Set(z2) - return x3, y3, z3 - } - if z2.Sign() == 0 { - x3.Set(x1) - y3.Set(y1) - z3.Set(z1) - return x3, y3, z3 - } - - z1z1 := new(big.Int).Mul(z1, z1) - z1z1.Mod(z1z1, curve.P) - z2z2 := new(big.Int).Mul(z2, z2) - z2z2.Mod(z2z2, curve.P) - - u1 := new(big.Int).Mul(x1, z2z2) - u1.Mod(u1, curve.P) - u2 := new(big.Int).Mul(x2, z1z1) - u2.Mod(u2, curve.P) - h := new(big.Int).Sub(u2, u1) - xEqual := h.Sign() == 0 - if h.Sign() == -1 { - h.Add(h, curve.P) - } - i := new(big.Int).Lsh(h, 1) - i.Mul(i, i) - j := new(big.Int).Mul(h, i) - - s1 := new(big.Int).Mul(y1, z2) - s1.Mul(s1, z2z2) - s1.Mod(s1, curve.P) - s2 := new(big.Int).Mul(y2, z1) - s2.Mul(s2, z1z1) - s2.Mod(s2, curve.P) - r := new(big.Int).Sub(s2, s1) - if r.Sign() == -1 { - r.Add(r, curve.P) - } - yEqual := r.Sign() == 0 - if xEqual && yEqual { - return curve.doubleJacobian(x1, y1, z1) - } - r.Lsh(r, 1) - v := new(big.Int).Mul(u1, i) - - x3.Set(r) - x3.Mul(x3, x3) - x3.Sub(x3, j) - x3.Sub(x3, v) - x3.Sub(x3, v) - x3.Mod(x3, curve.P) - - y3.Set(r) - v.Sub(v, x3) - y3.Mul(y3, v) - s1.Mul(s1, j) - s1.Lsh(s1, 1) - y3.Sub(y3, s1) - y3.Mod(y3, curve.P) - - z3.Add(z1, z2) - z3.Mul(z3, z3) - z3.Sub(z3, z1z1) - z3.Sub(z3, z2z2) - z3.Mul(z3, h) - z3.Mod(z3, curve.P) - - return x3, y3, z3 -} - -func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int) { - z1 := zForAffine(x1, y1) - return curve.affineFromJacobian(curve.doubleJacobian(x1, y1, z1)) -} - -// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and -// returns its double, also in Jacobian form. -func (curve *CurveParams) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b - delta := new(big.Int).Mul(z, z) - delta.Mod(delta, curve.P) - gamma := new(big.Int).Mul(y, y) - gamma.Mod(gamma, curve.P) - alpha := new(big.Int).Sub(x, delta) - if alpha.Sign() == -1 { - alpha.Add(alpha, curve.P) - } - alpha2 := new(big.Int).Add(x, delta) - alpha.Mul(alpha, alpha2) - alpha2.Set(alpha) - alpha.Lsh(alpha, 1) - alpha.Add(alpha, alpha2) - - beta := alpha2.Mul(x, gamma) - - x3 := new(big.Int).Mul(alpha, alpha) - beta8 := new(big.Int).Lsh(beta, 3) - x3.Sub(x3, beta8) - for x3.Sign() == -1 { - x3.Add(x3, curve.P) - } - x3.Mod(x3, curve.P) - - z3 := new(big.Int).Add(y, z) - z3.Mul(z3, z3) - z3.Sub(z3, gamma) - if z3.Sign() == -1 { - z3.Add(z3, curve.P) - } - z3.Sub(z3, delta) - if z3.Sign() == -1 { - z3.Add(z3, curve.P) - } - z3.Mod(z3, curve.P) - - beta.Lsh(beta, 2) - beta.Sub(beta, x3) - if beta.Sign() == -1 { - beta.Add(beta, curve.P) - } - y3 := alpha.Mul(alpha, beta) - - gamma.Mul(gamma, gamma) - gamma.Lsh(gamma, 3) - gamma.Mod(gamma, curve.P) - - y3.Sub(y3, gamma) - if y3.Sign() == -1 { - y3.Add(y3, curve.P) - } - y3.Mod(y3, curve.P) - - return x3, y3, z3 -} - -func (curve *CurveParams) ScalarMult(Bx, By *big.Int, k []byte) (*big.Int, *big.Int) { - Bz := new(big.Int).SetInt64(1) - x, y, z := new(big.Int), new(big.Int), new(big.Int) - - for _, byte := range k { - for bitNum := 0; bitNum < 8; bitNum++ { - x, y, z = curve.doubleJacobian(x, y, z) - if byte&0x80 == 0x80 { - x, y, z = curve.addJacobian(Bx, By, Bz, x, y, z) - } - byte <<= 1 - } - } - - return curve.affineFromJacobian(x, y, z) -} - -func (curve *CurveParams) ScalarBaseMult(k []byte) (*big.Int, *big.Int) { - return curve.ScalarMult(curve.Gx, curve.Gy, k) -} - -var mask = []byte{0xff, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f} - -// GenerateKey returns a public/private key pair. The private key is -// generated using the given reader, which must return random data. -func GenerateKey(curve Curve, rand io.Reader) (priv []byte, x, y *big.Int, err error) { - bitSize := curve.Params().BitSize - byteLen := (bitSize + 7) >> 3 - priv = make([]byte, byteLen) - - for x == nil { - _, err = io.ReadFull(rand, priv) - if err != nil { - return - } - // We have to mask off any excess bits in the case that the size of the - // underlying field is not a whole number of bytes. - priv[0] &= mask[bitSize%8] - // This is because, in tests, rand will return all zeros and we don't - // want to get the point at infinity and loop forever. - priv[1] ^= 0x42 - x, y = curve.ScalarBaseMult(priv) - } - return -} - -// Marshal converts a point into the form specified in section 4.3.6 of ANSI X9.62. -func Marshal(curve Curve, x, y *big.Int) []byte { - byteLen := (curve.Params().BitSize + 7) >> 3 - - ret := make([]byte, 1+2*byteLen) - ret[0] = 4 // uncompressed point - - xBytes := x.Bytes() - copy(ret[1+byteLen-len(xBytes):], xBytes) - yBytes := y.Bytes() - copy(ret[1+2*byteLen-len(yBytes):], yBytes) - return ret -} - -// Unmarshal converts a point, serialized by Marshal, into an x, y pair. -// It is an error if the point is not on the curve. On error, x = nil. -func Unmarshal(curve Curve, data []byte) (x, y *big.Int) { - byteLen := (curve.Params().BitSize + 7) >> 3 - if len(data) != 1+2*byteLen { - return - } - if data[0] != 4 { // uncompressed form - return - } - x = new(big.Int).SetBytes(data[1 : 1+byteLen]) - y = new(big.Int).SetBytes(data[1+byteLen:]) - if !curve.IsOnCurve(x, y) { - x, y = nil, nil - } - return -} - -var initonce sync.Once -var p384 *CurveParams -var p521 *CurveParams - -func initAll() { - initP224() - initP256() - initP384() - initP521() -} - -func initP384() { - // See FIPS 186-3, section D.2.4 - p384 = &CurveParams{Name: "P-384"} - p384.P, _ = new(big.Int).SetString("39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319", 10) - p384.N, _ = new(big.Int).SetString("39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643", 10) - p384.B, _ = new(big.Int).SetString("b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef", 16) - p384.Gx, _ = new(big.Int).SetString("aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7", 16) - p384.Gy, _ = new(big.Int).SetString("3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f", 16) - p384.BitSize = 384 -} - -func initP521() { - // See FIPS 186-3, section D.2.5 - p521 = &CurveParams{Name: "P-521"} - p521.P, _ = new(big.Int).SetString("6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151", 10) - p521.N, _ = new(big.Int).SetString("6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449", 10) - p521.B, _ = new(big.Int).SetString("051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00", 16) - p521.Gx, _ = new(big.Int).SetString("c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66", 16) - p521.Gy, _ = new(big.Int).SetString("11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650", 16) - p521.BitSize = 521 -} - -// P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3) -func P256() Curve { - initonce.Do(initAll) - return p256 -} - -// P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4) -func P384() Curve { - initonce.Do(initAll) - return p384 -} - -// P521 returns a Curve which implements P-521 (see FIPS 186-3, section D.2.5) -func P521() Curve { - initonce.Do(initAll) - return p521 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic_test.go deleted file mode 100644 index 7e27913dcd0505001411377f2f4fab3ebfb21d65..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/elliptic_test.go +++ /dev/null @@ -1,471 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elliptic - -import ( - "crypto/rand" - "encoding/hex" - "fmt" - "math/big" - "testing" -) - -func TestOnCurve(t *testing.T) { - p224 := P224() - if !p224.IsOnCurve(p224.Params().Gx, p224.Params().Gy) { - t.Errorf("FAIL") - } -} - -func TestOffCurve(t *testing.T) { - p224 := P224() - x, y := new(big.Int).SetInt64(1), new(big.Int).SetInt64(1) - if p224.IsOnCurve(x, y) { - t.Errorf("FAIL: point off curve is claimed to be on the curve") - } - b := Marshal(p224, x, y) - x1, y1 := Unmarshal(p224, b) - if x1 != nil || y1 != nil { - t.Errorf("FAIL: unmarshalling a point not on the curve succeeded") - } -} - -type baseMultTest struct { - k string - x, y string -} - -var p224BaseMultTests = []baseMultTest{ - { - "1", - "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", - "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", - }, - { - "2", - "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6", - "1c2b76a7bc25e7702a704fa986892849fca629487acf3709d2e4e8bb", - }, - { - "3", - "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04", - "a3f7f03cadd0be444c0aa56830130ddf77d317344e1af3591981a925", - }, - { - "4", - "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301", - "482580a0ec5bc47e88bc8c378632cd196cb3fa058a7114eb03054c9", - }, - { - "5", - "31c49ae75bce7807cdff22055d94ee9021fedbb5ab51c57526f011aa", - "27e8bff1745635ec5ba0c9f1c2ede15414c6507d29ffe37e790a079b", - }, - { - "6", - "1f2483f82572251fca975fea40db821df8ad82a3c002ee6c57112408", - "89faf0ccb750d99b553c574fad7ecfb0438586eb3952af5b4b153c7e", - }, - { - "7", - "db2f6be630e246a5cf7d99b85194b123d487e2d466b94b24a03c3e28", - "f3a30085497f2f611ee2517b163ef8c53b715d18bb4e4808d02b963", - }, - { - "8", - "858e6f9cc6c12c31f5df124aa77767b05c8bc021bd683d2b55571550", - "46dcd3ea5c43898c5c5fc4fdac7db39c2f02ebee4e3541d1e78047a", - }, - { - "9", - "2fdcccfee720a77ef6cb3bfbb447f9383117e3daa4a07e36ed15f78d", - "371732e4f41bf4f7883035e6a79fcedc0e196eb07b48171697517463", - }, - { - "10", - "aea9e17a306517eb89152aa7096d2c381ec813c51aa880e7bee2c0fd", - "39bb30eab337e0a521b6cba1abe4b2b3a3e524c14a3fe3eb116b655f", - }, - { - "11", - "ef53b6294aca431f0f3c22dc82eb9050324f1d88d377e716448e507c", - "20b510004092e96636cfb7e32efded8265c266dfb754fa6d6491a6da", - }, - { - "12", - "6e31ee1dc137f81b056752e4deab1443a481033e9b4c93a3044f4f7a", - "207dddf0385bfdeab6e9acda8da06b3bbef224a93ab1e9e036109d13", - }, - { - "13", - "34e8e17a430e43289793c383fac9774247b40e9ebd3366981fcfaeca", - "252819f71c7fb7fbcb159be337d37d3336d7feb963724fdfb0ecb767", - }, - { - "14", - "a53640c83dc208603ded83e4ecf758f24c357d7cf48088b2ce01e9fa", - "d5814cd724199c4a5b974a43685fbf5b8bac69459c9469bc8f23ccaf", - }, - { - "15", - "baa4d8635511a7d288aebeedd12ce529ff102c91f97f867e21916bf9", - "979a5f4759f80f4fb4ec2e34f5566d595680a11735e7b61046127989", - }, - { - "16", - "b6ec4fe1777382404ef679997ba8d1cc5cd8e85349259f590c4c66d", - "3399d464345906b11b00e363ef429221f2ec720d2f665d7dead5b482", - }, - { - "17", - "b8357c3a6ceef288310e17b8bfeff9200846ca8c1942497c484403bc", - "ff149efa6606a6bd20ef7d1b06bd92f6904639dce5174db6cc554a26", - }, - { - "18", - "c9ff61b040874c0568479216824a15eab1a838a797d189746226e4cc", - "ea98d60e5ffc9b8fcf999fab1df7e7ef7084f20ddb61bb045a6ce002", - }, - { - "19", - "a1e81c04f30ce201c7c9ace785ed44cc33b455a022f2acdbc6cae83c", - "dcf1f6c3db09c70acc25391d492fe25b4a180babd6cea356c04719cd", - }, - { - "20", - "fcc7f2b45df1cd5a3c0c0731ca47a8af75cfb0347e8354eefe782455", - "d5d7110274cba7cdee90e1a8b0d394c376a5573db6be0bf2747f530", - }, - { - "112233445566778899", - "61f077c6f62ed802dad7c2f38f5c67f2cc453601e61bd076bb46179e", - "2272f9e9f5933e70388ee652513443b5e289dd135dcc0d0299b225e4", - }, - { - "112233445566778899112233445566778899", - "29895f0af496bfc62b6ef8d8a65c88c613949b03668aab4f0429e35", - "3ea6e53f9a841f2019ec24bde1a75677aa9b5902e61081c01064de93", - }, - { - "6950511619965839450988900688150712778015737983940691968051900319680", - "ab689930bcae4a4aa5f5cb085e823e8ae30fd365eb1da4aba9cf0379", - "3345a121bbd233548af0d210654eb40bab788a03666419be6fbd34e7", - }, - { - "13479972933410060327035789020509431695094902435494295338570602119423", - "bdb6a8817c1f89da1c2f3dd8e97feb4494f2ed302a4ce2bc7f5f4025", - "4c7020d57c00411889462d77a5438bb4e97d177700bf7243a07f1680", - }, - { - "13479971751745682581351455311314208093898607229429740618390390702079", - "d58b61aa41c32dd5eba462647dba75c5d67c83606c0af2bd928446a9", - "d24ba6a837be0460dd107ae77725696d211446c5609b4595976b16bd", - }, - { - "13479972931865328106486971546324465392952975980343228160962702868479", - "dc9fa77978a005510980e929a1485f63716df695d7a0c18bb518df03", - "ede2b016f2ddffc2a8c015b134928275ce09e5661b7ab14ce0d1d403", - }, - { - "11795773708834916026404142434151065506931607341523388140225443265536", - "499d8b2829cfb879c901f7d85d357045edab55028824d0f05ba279ba", - "bf929537b06e4015919639d94f57838fa33fc3d952598dcdbb44d638", - }, - { - "784254593043826236572847595991346435467177662189391577090", - "8246c999137186632c5f9eddf3b1b0e1764c5e8bd0e0d8a554b9cb77", - "e80ed8660bc1cb17ac7d845be40a7a022d3306f116ae9f81fea65947", - }, - { - "13479767645505654746623887797783387853576174193480695826442858012671", - "6670c20afcceaea672c97f75e2e9dd5c8460e54bb38538ebb4bd30eb", - "f280d8008d07a4caf54271f993527d46ff3ff46fd1190a3f1faa4f74", - }, - { - "205688069665150753842126177372015544874550518966168735589597183", - "eca934247425cfd949b795cb5ce1eff401550386e28d1a4c5a8eb", - "d4c01040dba19628931bc8855370317c722cbd9ca6156985f1c2e9ce", - }, - { - "13479966930919337728895168462090683249159702977113823384618282123295", - "ef353bf5c73cd551b96d596fbc9a67f16d61dd9fe56af19de1fba9cd", - "21771b9cdce3e8430c09b3838be70b48c21e15bc09ee1f2d7945b91f", - }, - { - "50210731791415612487756441341851895584393717453129007497216", - "4036052a3091eb481046ad3289c95d3ac905ca0023de2c03ecd451cf", - "d768165a38a2b96f812586a9d59d4136035d9c853a5bf2e1c86a4993", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368041", - "fcc7f2b45df1cd5a3c0c0731ca47a8af75cfb0347e8354eefe782455", - "f2a28eefd8b345832116f1e574f2c6b2c895aa8c24941f40d8b80ad1", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368042", - "a1e81c04f30ce201c7c9ace785ed44cc33b455a022f2acdbc6cae83c", - "230e093c24f638f533dac6e2b6d01da3b5e7f45429315ca93fb8e634", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368043", - "c9ff61b040874c0568479216824a15eab1a838a797d189746226e4cc", - "156729f1a003647030666054e208180f8f7b0df2249e44fba5931fff", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368044", - "b8357c3a6ceef288310e17b8bfeff9200846ca8c1942497c484403bc", - "eb610599f95942df1082e4f9426d086fb9c6231ae8b24933aab5db", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368045", - "b6ec4fe1777382404ef679997ba8d1cc5cd8e85349259f590c4c66d", - "cc662b9bcba6f94ee4ff1c9c10bd6ddd0d138df2d099a282152a4b7f", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368046", - "baa4d8635511a7d288aebeedd12ce529ff102c91f97f867e21916bf9", - "6865a0b8a607f0b04b13d1cb0aa992a5a97f5ee8ca1849efb9ed8678", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368047", - "a53640c83dc208603ded83e4ecf758f24c357d7cf48088b2ce01e9fa", - "2a7eb328dbe663b5a468b5bc97a040a3745396ba636b964370dc3352", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368048", - "34e8e17a430e43289793c383fac9774247b40e9ebd3366981fcfaeca", - "dad7e608e380480434ea641cc82c82cbc92801469c8db0204f13489a", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368049", - "6e31ee1dc137f81b056752e4deab1443a481033e9b4c93a3044f4f7a", - "df82220fc7a4021549165325725f94c3410ddb56c54e161fc9ef62ee", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368050", - "ef53b6294aca431f0f3c22dc82eb9050324f1d88d377e716448e507c", - "df4aefffbf6d1699c930481cd102127c9a3d992048ab05929b6e5927", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368051", - "aea9e17a306517eb89152aa7096d2c381ec813c51aa880e7bee2c0fd", - "c644cf154cc81f5ade49345e541b4d4b5c1adb3eb5c01c14ee949aa2", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368052", - "2fdcccfee720a77ef6cb3bfbb447f9383117e3daa4a07e36ed15f78d", - "c8e8cd1b0be40b0877cfca1958603122f1e6914f84b7e8e968ae8b9e", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368053", - "858e6f9cc6c12c31f5df124aa77767b05c8bc021bd683d2b55571550", - "fb9232c15a3bc7673a3a03b0253824c53d0fd1411b1cabe2e187fb87", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368054", - "db2f6be630e246a5cf7d99b85194b123d487e2d466b94b24a03c3e28", - "f0c5cff7ab680d09ee11dae84e9c1072ac48ea2e744b1b7f72fd469e", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368055", - "1f2483f82572251fca975fea40db821df8ad82a3c002ee6c57112408", - "76050f3348af2664aac3a8b05281304ebc7a7914c6ad50a4b4eac383", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368056", - "31c49ae75bce7807cdff22055d94ee9021fedbb5ab51c57526f011aa", - "d817400e8ba9ca13a45f360e3d121eaaeb39af82d6001c8186f5f866", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368057", - "ae99feebb5d26945b54892092a8aee02912930fa41cd114e40447301", - "fb7da7f5f13a43b81774373c879cd32d6934c05fa758eeb14fcfab38", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368058", - "df1b1d66a551d0d31eff822558b9d2cc75c2180279fe0d08fd896d04", - "5c080fc3522f41bbb3f55a97cfecf21f882ce8cbb1e50ca6e67e56dc", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368059", - "706a46dc76dcb76798e60e6d89474788d16dc18032d268fd1a704fa6", - "e3d4895843da188fd58fb0567976d7b50359d6b78530c8f62d1b1746", - }, - { - "26959946667150639794667015087019625940457807714424391721682722368060", - "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", - "42c89c774a08dc04b3dd201932bc8a5ea5f8b89bbb2a7e667aff81cd", - }, -} - -func TestBaseMult(t *testing.T) { - p224 := P224() - for i, e := range p224BaseMultTests { - k, ok := new(big.Int).SetString(e.k, 10) - if !ok { - t.Errorf("%d: bad value for k: %s", i, e.k) - } - x, y := p224.ScalarBaseMult(k.Bytes()) - if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { - t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) - } - if testing.Short() && i > 5 { - break - } - } -} - -func TestGenericBaseMult(t *testing.T) { - // We use the P224 CurveParams directly in order to test the generic implementation. - p224 := P224().Params() - for i, e := range p224BaseMultTests { - k, ok := new(big.Int).SetString(e.k, 10) - if !ok { - t.Errorf("%d: bad value for k: %s", i, e.k) - } - x, y := p224.ScalarBaseMult(k.Bytes()) - if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y { - t.Errorf("%d: bad output for k=%s: got (%x, %x), want (%s, %s)", i, e.k, x, y, e.x, e.y) - } - if testing.Short() && i > 5 { - break - } - } -} - -func TestP256BaseMult(t *testing.T) { - p256 := P256() - p256Generic := p256.Params() - - scalars := make([]*big.Int, 0, len(p224BaseMultTests)+1) - for _, e := range p224BaseMultTests { - k, _ := new(big.Int).SetString(e.k, 10) - scalars = append(scalars, k) - } - k := new(big.Int).SetInt64(1) - k.Lsh(k, 500) - scalars = append(scalars, k) - - for i, k := range scalars { - x, y := p256.ScalarBaseMult(k.Bytes()) - x2, y2 := p256Generic.ScalarBaseMult(k.Bytes()) - if x.Cmp(x2) != 0 || y.Cmp(y2) != 0 { - t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, x, y, x2, y2) - } - - if testing.Short() && i > 5 { - break - } - } -} - -func TestP256Mult(t *testing.T) { - p256 := P256() - p256Generic := p256.Params() - - for i, e := range p224BaseMultTests { - x, _ := new(big.Int).SetString(e.x, 16) - y, _ := new(big.Int).SetString(e.y, 16) - k, _ := new(big.Int).SetString(e.k, 10) - - xx, yy := p256.ScalarMult(x, y, k.Bytes()) - xx2, yy2 := p256Generic.ScalarMult(x, y, k.Bytes()) - if xx.Cmp(xx2) != 0 || yy.Cmp(yy2) != 0 { - t.Errorf("#%d: got (%x, %x), want (%x, %x)", i, xx, yy, xx2, yy2) - } - if testing.Short() && i > 5 { - break - } - } -} - -func TestInfinity(t *testing.T) { - tests := []struct { - name string - curve Curve - }{ - {"p224", P224()}, - {"p256", P256()}, - } - - for _, test := range tests { - curve := test.curve - x, y := curve.ScalarBaseMult(nil) - if x.Sign() != 0 || y.Sign() != 0 { - t.Errorf("%s: x^0 != ∞", test.name) - } - x.SetInt64(0) - y.SetInt64(0) - - x2, y2 := curve.Double(x, y) - if x2.Sign() != 0 || y2.Sign() != 0 { - t.Errorf("%s: 2∞ != ∞", test.name) - } - - baseX := curve.Params().Gx - baseY := curve.Params().Gy - - x3, y3 := curve.Add(baseX, baseY, x, y) - if x3.Cmp(baseX) != 0 || y3.Cmp(baseY) != 0 { - t.Errorf("%s: x+∞ != x", test.name) - } - - x4, y4 := curve.Add(x, y, baseX, baseY) - if x4.Cmp(baseX) != 0 || y4.Cmp(baseY) != 0 { - t.Errorf("%s: ∞+x != x", test.name) - } - } -} - -func BenchmarkBaseMult(b *testing.B) { - b.ResetTimer() - p224 := P224() - e := p224BaseMultTests[25] - k, _ := new(big.Int).SetString(e.k, 10) - b.StartTimer() - for i := 0; i < b.N; i++ { - p224.ScalarBaseMult(k.Bytes()) - } -} - -func BenchmarkBaseMultP256(b *testing.B) { - b.ResetTimer() - p256 := P256() - e := p224BaseMultTests[25] - k, _ := new(big.Int).SetString(e.k, 10) - b.StartTimer() - for i := 0; i < b.N; i++ { - p256.ScalarBaseMult(k.Bytes()) - } -} - -func TestMarshal(t *testing.T) { - p224 := P224() - _, x, y, err := GenerateKey(p224, rand.Reader) - if err != nil { - t.Error(err) - return - } - serialized := Marshal(p224, x, y) - xx, yy := Unmarshal(p224, serialized) - if xx == nil { - t.Error("failed to unmarshal") - return - } - if xx.Cmp(x) != 0 || yy.Cmp(y) != 0 { - t.Error("unmarshal returned different values") - return - } -} - -func TestP224Overflow(t *testing.T) { - // This tests for a specific bug in the P224 implementation. - p224 := P224() - pointData, _ := hex.DecodeString("049B535B45FB0A2072398A6831834624C7E32CCFD5A4B933BCEAF77F1DD945E08BBE5178F5EDF5E733388F196D2A631D2E075BB16CBFEEA15B") - x, y := Unmarshal(p224, pointData) - if !p224.IsOnCurve(x, y) { - t.Error("P224 failed to validate a correct point") - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224.go b/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224.go deleted file mode 100644 index 2d3fac74fbfa4bd019ae6a0997ad79354037aa17..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224.go +++ /dev/null @@ -1,765 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elliptic - -// This is a constant-time, 32-bit implementation of P224. See FIPS 186-3, -// section D.2.2. -// -// See http://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background. - -import ( - "math/big" -) - -var p224 p224Curve - -type p224Curve struct { - *CurveParams - gx, gy, b p224FieldElement -} - -func initP224() { - // See FIPS 186-3, section D.2.2 - p224.CurveParams = &CurveParams{Name: "P-224"} - p224.P, _ = new(big.Int).SetString("26959946667150639794667015087019630673557916260026308143510066298881", 10) - p224.N, _ = new(big.Int).SetString("26959946667150639794667015087019625940457807714424391721682722368061", 10) - p224.B, _ = new(big.Int).SetString("b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4", 16) - p224.Gx, _ = new(big.Int).SetString("b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21", 16) - p224.Gy, _ = new(big.Int).SetString("bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34", 16) - p224.BitSize = 224 - - p224FromBig(&p224.gx, p224.Gx) - p224FromBig(&p224.gy, p224.Gy) - p224FromBig(&p224.b, p224.B) -} - -// P224 returns a Curve which implements P-224 (see FIPS 186-3, section D.2.2) -func P224() Curve { - initonce.Do(initAll) - return p224 -} - -func (curve p224Curve) Params() *CurveParams { - return curve.CurveParams -} - -func (curve p224Curve) IsOnCurve(bigX, bigY *big.Int) bool { - var x, y p224FieldElement - p224FromBig(&x, bigX) - p224FromBig(&y, bigY) - - // y² = x³ - 3x + b - var tmp p224LargeFieldElement - var x3 p224FieldElement - p224Square(&x3, &x, &tmp) - p224Mul(&x3, &x3, &x, &tmp) - - for i := 0; i < 8; i++ { - x[i] *= 3 - } - p224Sub(&x3, &x3, &x) - p224Reduce(&x3) - p224Add(&x3, &x3, &curve.b) - p224Contract(&x3, &x3) - - p224Square(&y, &y, &tmp) - p224Contract(&y, &y) - - for i := 0; i < 8; i++ { - if y[i] != x3[i] { - return false - } - } - return true -} - -func (p224Curve) Add(bigX1, bigY1, bigX2, bigY2 *big.Int) (x, y *big.Int) { - var x1, y1, z1, x2, y2, z2, x3, y3, z3 p224FieldElement - - p224FromBig(&x1, bigX1) - p224FromBig(&y1, bigY1) - if bigX1.Sign() != 0 || bigY1.Sign() != 0 { - z1[0] = 1 - } - p224FromBig(&x2, bigX2) - p224FromBig(&y2, bigY2) - if bigX2.Sign() != 0 || bigY2.Sign() != 0 { - z2[0] = 1 - } - - p224AddJacobian(&x3, &y3, &z3, &x1, &y1, &z1, &x2, &y2, &z2) - return p224ToAffine(&x3, &y3, &z3) -} - -func (p224Curve) Double(bigX1, bigY1 *big.Int) (x, y *big.Int) { - var x1, y1, z1, x2, y2, z2 p224FieldElement - - p224FromBig(&x1, bigX1) - p224FromBig(&y1, bigY1) - z1[0] = 1 - - p224DoubleJacobian(&x2, &y2, &z2, &x1, &y1, &z1) - return p224ToAffine(&x2, &y2, &z2) -} - -func (p224Curve) ScalarMult(bigX1, bigY1 *big.Int, scalar []byte) (x, y *big.Int) { - var x1, y1, z1, x2, y2, z2 p224FieldElement - - p224FromBig(&x1, bigX1) - p224FromBig(&y1, bigY1) - z1[0] = 1 - - p224ScalarMult(&x2, &y2, &z2, &x1, &y1, &z1, scalar) - return p224ToAffine(&x2, &y2, &z2) -} - -func (curve p224Curve) ScalarBaseMult(scalar []byte) (x, y *big.Int) { - var z1, x2, y2, z2 p224FieldElement - - z1[0] = 1 - p224ScalarMult(&x2, &y2, &z2, &curve.gx, &curve.gy, &z1, scalar) - return p224ToAffine(&x2, &y2, &z2) -} - -// Field element functions. -// -// The field that we're dealing with is ℤ/pℤ where p = 2**224 - 2**96 + 1. -// -// Field elements are represented by a FieldElement, which is a typedef to an -// array of 8 uint32's. The value of a FieldElement, a, is: -// a[0] + 2**28·a[1] + 2**56·a[1] + ... + 2**196·a[7] -// -// Using 28-bit limbs means that there's only 4 bits of headroom, which is less -// than we would really like. But it has the useful feature that we hit 2**224 -// exactly, making the reflections during a reduce much nicer. -type p224FieldElement [8]uint32 - -// p224P is the order of the field, represented as a p224FieldElement. -var p224P = [8]uint32{1, 0, 0, 0xffff000, 0xfffffff, 0xfffffff, 0xfffffff, 0xfffffff} - -// p224IsZero returns 1 if a == 0 mod p and 0 otherwise. -// -// a[i] < 2**29 -func p224IsZero(a *p224FieldElement) uint32 { - // Since a p224FieldElement contains 224 bits there are two possible - // representations of 0: 0 and p. - var minimal p224FieldElement - p224Contract(&minimal, a) - - var isZero, isP uint32 - for i, v := range minimal { - isZero |= v - isP |= v - p224P[i] - } - - // If either isZero or isP is 0, then we should return 1. - isZero |= isZero >> 16 - isZero |= isZero >> 8 - isZero |= isZero >> 4 - isZero |= isZero >> 2 - isZero |= isZero >> 1 - - isP |= isP >> 16 - isP |= isP >> 8 - isP |= isP >> 4 - isP |= isP >> 2 - isP |= isP >> 1 - - // For isZero and isP, the LSB is 0 iff all the bits are zero. - result := isZero & isP - result = (^result) & 1 - - return result -} - -// p224Add computes *out = a+b -// -// a[i] + b[i] < 2**32 -func p224Add(out, a, b *p224FieldElement) { - for i := 0; i < 8; i++ { - out[i] = a[i] + b[i] - } -} - -const two31p3 = 1<<31 + 1<<3 -const two31m3 = 1<<31 - 1<<3 -const two31m15m3 = 1<<31 - 1<<15 - 1<<3 - -// p224ZeroModP31 is 0 mod p where bit 31 is set in all limbs so that we can -// subtract smaller amounts without underflow. See the section "Subtraction" in -// [1] for reasoning. -var p224ZeroModP31 = []uint32{two31p3, two31m3, two31m3, two31m15m3, two31m3, two31m3, two31m3, two31m3} - -// p224Sub computes *out = a-b -// -// a[i], b[i] < 2**30 -// out[i] < 2**32 -func p224Sub(out, a, b *p224FieldElement) { - for i := 0; i < 8; i++ { - out[i] = a[i] + p224ZeroModP31[i] - b[i] - } -} - -// LargeFieldElement also represents an element of the field. The limbs are -// still spaced 28-bits apart and in little-endian order. So the limbs are at -// 0, 28, 56, ..., 392 bits, each 64-bits wide. -type p224LargeFieldElement [15]uint64 - -const two63p35 = 1<<63 + 1<<35 -const two63m35 = 1<<63 - 1<<35 -const two63m35m19 = 1<<63 - 1<<35 - 1<<19 - -// p224ZeroModP63 is 0 mod p where bit 63 is set in all limbs. See the section -// "Subtraction" in [1] for why. -var p224ZeroModP63 = [8]uint64{two63p35, two63m35, two63m35, two63m35, two63m35m19, two63m35, two63m35, two63m35} - -const bottom12Bits = 0xfff -const bottom28Bits = 0xfffffff - -// p224Mul computes *out = a*b -// -// a[i] < 2**29, b[i] < 2**30 (or vice versa) -// out[i] < 2**29 -func p224Mul(out, a, b *p224FieldElement, tmp *p224LargeFieldElement) { - for i := 0; i < 15; i++ { - tmp[i] = 0 - } - - for i := 0; i < 8; i++ { - for j := 0; j < 8; j++ { - tmp[i+j] += uint64(a[i]) * uint64(b[j]) - } - } - - p224ReduceLarge(out, tmp) -} - -// Square computes *out = a*a -// -// a[i] < 2**29 -// out[i] < 2**29 -func p224Square(out, a *p224FieldElement, tmp *p224LargeFieldElement) { - for i := 0; i < 15; i++ { - tmp[i] = 0 - } - - for i := 0; i < 8; i++ { - for j := 0; j <= i; j++ { - r := uint64(a[i]) * uint64(a[j]) - if i == j { - tmp[i+j] += r - } else { - tmp[i+j] += r << 1 - } - } - } - - p224ReduceLarge(out, tmp) -} - -// ReduceLarge converts a p224LargeFieldElement to a p224FieldElement. -// -// in[i] < 2**62 -func p224ReduceLarge(out *p224FieldElement, in *p224LargeFieldElement) { - for i := 0; i < 8; i++ { - in[i] += p224ZeroModP63[i] - } - - // Eliminate the coefficients at 2**224 and greater. - for i := 14; i >= 8; i-- { - in[i-8] -= in[i] - in[i-5] += (in[i] & 0xffff) << 12 - in[i-4] += in[i] >> 16 - } - in[8] = 0 - // in[0..8] < 2**64 - - // As the values become small enough, we start to store them in |out| - // and use 32-bit operations. - for i := 1; i < 8; i++ { - in[i+1] += in[i] >> 28 - out[i] = uint32(in[i] & bottom28Bits) - } - in[0] -= in[8] - out[3] += uint32(in[8]&0xffff) << 12 - out[4] += uint32(in[8] >> 16) - // in[0] < 2**64 - // out[3] < 2**29 - // out[4] < 2**29 - // out[1,2,5..7] < 2**28 - - out[0] = uint32(in[0] & bottom28Bits) - out[1] += uint32((in[0] >> 28) & bottom28Bits) - out[2] += uint32(in[0] >> 56) - // out[0] < 2**28 - // out[1..4] < 2**29 - // out[5..7] < 2**28 -} - -// Reduce reduces the coefficients of a to smaller bounds. -// -// On entry: a[i] < 2**31 + 2**30 -// On exit: a[i] < 2**29 -func p224Reduce(a *p224FieldElement) { - for i := 0; i < 7; i++ { - a[i+1] += a[i] >> 28 - a[i] &= bottom28Bits - } - top := a[7] >> 28 - a[7] &= bottom28Bits - - // top < 2**4 - mask := top - mask |= mask >> 2 - mask |= mask >> 1 - mask <<= 31 - mask = uint32(int32(mask) >> 31) - // Mask is all ones if top != 0, all zero otherwise - - a[0] -= top - a[3] += top << 12 - - // We may have just made a[0] negative but, if we did, then we must - // have added something to a[3], this it's > 2**12. Therefore we can - // carry down to a[0]. - a[3] -= 1 & mask - a[2] += mask & (1<<28 - 1) - a[1] += mask & (1<<28 - 1) - a[0] += mask & (1 << 28) -} - -// p224Invert calculates *out = in**-1 by computing in**(2**224 - 2**96 - 1), -// i.e. Fermat's little theorem. -func p224Invert(out, in *p224FieldElement) { - var f1, f2, f3, f4 p224FieldElement - var c p224LargeFieldElement - - p224Square(&f1, in, &c) // 2 - p224Mul(&f1, &f1, in, &c) // 2**2 - 1 - p224Square(&f1, &f1, &c) // 2**3 - 2 - p224Mul(&f1, &f1, in, &c) // 2**3 - 1 - p224Square(&f2, &f1, &c) // 2**4 - 2 - p224Square(&f2, &f2, &c) // 2**5 - 4 - p224Square(&f2, &f2, &c) // 2**6 - 8 - p224Mul(&f1, &f1, &f2, &c) // 2**6 - 1 - p224Square(&f2, &f1, &c) // 2**7 - 2 - for i := 0; i < 5; i++ { // 2**12 - 2**6 - p224Square(&f2, &f2, &c) - } - p224Mul(&f2, &f2, &f1, &c) // 2**12 - 1 - p224Square(&f3, &f2, &c) // 2**13 - 2 - for i := 0; i < 11; i++ { // 2**24 - 2**12 - p224Square(&f3, &f3, &c) - } - p224Mul(&f2, &f3, &f2, &c) // 2**24 - 1 - p224Square(&f3, &f2, &c) // 2**25 - 2 - for i := 0; i < 23; i++ { // 2**48 - 2**24 - p224Square(&f3, &f3, &c) - } - p224Mul(&f3, &f3, &f2, &c) // 2**48 - 1 - p224Square(&f4, &f3, &c) // 2**49 - 2 - for i := 0; i < 47; i++ { // 2**96 - 2**48 - p224Square(&f4, &f4, &c) - } - p224Mul(&f3, &f3, &f4, &c) // 2**96 - 1 - p224Square(&f4, &f3, &c) // 2**97 - 2 - for i := 0; i < 23; i++ { // 2**120 - 2**24 - p224Square(&f4, &f4, &c) - } - p224Mul(&f2, &f4, &f2, &c) // 2**120 - 1 - for i := 0; i < 6; i++ { // 2**126 - 2**6 - p224Square(&f2, &f2, &c) - } - p224Mul(&f1, &f1, &f2, &c) // 2**126 - 1 - p224Square(&f1, &f1, &c) // 2**127 - 2 - p224Mul(&f1, &f1, in, &c) // 2**127 - 1 - for i := 0; i < 97; i++ { // 2**224 - 2**97 - p224Square(&f1, &f1, &c) - } - p224Mul(out, &f1, &f3, &c) // 2**224 - 2**96 - 1 -} - -// p224Contract converts a FieldElement to its unique, minimal form. -// -// On entry, in[i] < 2**29 -// On exit, in[i] < 2**28 -func p224Contract(out, in *p224FieldElement) { - copy(out[:], in[:]) - - for i := 0; i < 7; i++ { - out[i+1] += out[i] >> 28 - out[i] &= bottom28Bits - } - top := out[7] >> 28 - out[7] &= bottom28Bits - - out[0] -= top - out[3] += top << 12 - - // We may just have made out[i] negative. So we carry down. If we made - // out[0] negative then we know that out[3] is sufficiently positive - // because we just added to it. - for i := 0; i < 3; i++ { - mask := uint32(int32(out[i]) >> 31) - out[i] += (1 << 28) & mask - out[i+1] -= 1 & mask - } - - // We might have pushed out[3] over 2**28 so we perform another, partial, - // carry chain. - for i := 3; i < 7; i++ { - out[i+1] += out[i] >> 28 - out[i] &= bottom28Bits - } - top = out[7] >> 28 - out[7] &= bottom28Bits - - // Eliminate top while maintaining the same value mod p. - out[0] -= top - out[3] += top << 12 - - // There are two cases to consider for out[3]: - // 1) The first time that we eliminated top, we didn't push out[3] over - // 2**28. In this case, the partial carry chain didn't change any values - // and top is zero. - // 2) We did push out[3] over 2**28 the first time that we eliminated top. - // The first value of top was in [0..16), therefore, prior to eliminating - // the first top, 0xfff1000 <= out[3] <= 0xfffffff. Therefore, after - // overflowing and being reduced by the second carry chain, out[3] <= - // 0xf000. Thus it cannot have overflowed when we eliminated top for the - // second time. - - // Again, we may just have made out[0] negative, so do the same carry down. - // As before, if we made out[0] negative then we know that out[3] is - // sufficiently positive. - for i := 0; i < 3; i++ { - mask := uint32(int32(out[i]) >> 31) - out[i] += (1 << 28) & mask - out[i+1] -= 1 & mask - } - - // Now we see if the value is >= p and, if so, subtract p. - - // First we build a mask from the top four limbs, which must all be - // equal to bottom28Bits if the whole value is >= p. If top4AllOnes - // ends up with any zero bits in the bottom 28 bits, then this wasn't - // true. - top4AllOnes := uint32(0xffffffff) - for i := 4; i < 8; i++ { - top4AllOnes &= out[i] - } - top4AllOnes |= 0xf0000000 - // Now we replicate any zero bits to all the bits in top4AllOnes. - top4AllOnes &= top4AllOnes >> 16 - top4AllOnes &= top4AllOnes >> 8 - top4AllOnes &= top4AllOnes >> 4 - top4AllOnes &= top4AllOnes >> 2 - top4AllOnes &= top4AllOnes >> 1 - top4AllOnes = uint32(int32(top4AllOnes<<31) >> 31) - - // Now we test whether the bottom three limbs are non-zero. - bottom3NonZero := out[0] | out[1] | out[2] - bottom3NonZero |= bottom3NonZero >> 16 - bottom3NonZero |= bottom3NonZero >> 8 - bottom3NonZero |= bottom3NonZero >> 4 - bottom3NonZero |= bottom3NonZero >> 2 - bottom3NonZero |= bottom3NonZero >> 1 - bottom3NonZero = uint32(int32(bottom3NonZero<<31) >> 31) - - // Everything depends on the value of out[3]. - // If it's > 0xffff000 and top4AllOnes != 0 then the whole value is >= p - // If it's = 0xffff000 and top4AllOnes != 0 and bottom3NonZero != 0, - // then the whole value is >= p - // If it's < 0xffff000, then the whole value is < p - n := out[3] - 0xffff000 - out3Equal := n - out3Equal |= out3Equal >> 16 - out3Equal |= out3Equal >> 8 - out3Equal |= out3Equal >> 4 - out3Equal |= out3Equal >> 2 - out3Equal |= out3Equal >> 1 - out3Equal = ^uint32(int32(out3Equal<<31) >> 31) - - // If out[3] > 0xffff000 then n's MSB will be zero. - out3GT := ^uint32(int32(n) >> 31) - - mask := top4AllOnes & ((out3Equal & bottom3NonZero) | out3GT) - out[0] -= 1 & mask - out[3] -= 0xffff000 & mask - out[4] -= 0xfffffff & mask - out[5] -= 0xfffffff & mask - out[6] -= 0xfffffff & mask - out[7] -= 0xfffffff & mask -} - -// Group element functions. -// -// These functions deal with group elements. The group is an elliptic curve -// group with a = -3 defined in FIPS 186-3, section D.2.2. - -// p224AddJacobian computes *out = a+b where a != b. -func p224AddJacobian(x3, y3, z3, x1, y1, z1, x2, y2, z2 *p224FieldElement) { - // See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-p224Add-2007-bl - var z1z1, z2z2, u1, u2, s1, s2, h, i, j, r, v p224FieldElement - var c p224LargeFieldElement - - z1IsZero := p224IsZero(z1) - z2IsZero := p224IsZero(z2) - - // Z1Z1 = Z1² - p224Square(&z1z1, z1, &c) - // Z2Z2 = Z2² - p224Square(&z2z2, z2, &c) - // U1 = X1*Z2Z2 - p224Mul(&u1, x1, &z2z2, &c) - // U2 = X2*Z1Z1 - p224Mul(&u2, x2, &z1z1, &c) - // S1 = Y1*Z2*Z2Z2 - p224Mul(&s1, z2, &z2z2, &c) - p224Mul(&s1, y1, &s1, &c) - // S2 = Y2*Z1*Z1Z1 - p224Mul(&s2, z1, &z1z1, &c) - p224Mul(&s2, y2, &s2, &c) - // H = U2-U1 - p224Sub(&h, &u2, &u1) - p224Reduce(&h) - xEqual := p224IsZero(&h) - // I = (2*H)² - for j := 0; j < 8; j++ { - i[j] = h[j] << 1 - } - p224Reduce(&i) - p224Square(&i, &i, &c) - // J = H*I - p224Mul(&j, &h, &i, &c) - // r = 2*(S2-S1) - p224Sub(&r, &s2, &s1) - p224Reduce(&r) - yEqual := p224IsZero(&r) - if xEqual == 1 && yEqual == 1 && z1IsZero == 0 && z2IsZero == 0 { - p224DoubleJacobian(x3, y3, z3, x1, y1, z1) - return - } - for i := 0; i < 8; i++ { - r[i] <<= 1 - } - p224Reduce(&r) - // V = U1*I - p224Mul(&v, &u1, &i, &c) - // Z3 = ((Z1+Z2)²-Z1Z1-Z2Z2)*H - p224Add(&z1z1, &z1z1, &z2z2) - p224Add(&z2z2, z1, z2) - p224Reduce(&z2z2) - p224Square(&z2z2, &z2z2, &c) - p224Sub(z3, &z2z2, &z1z1) - p224Reduce(z3) - p224Mul(z3, z3, &h, &c) - // X3 = r²-J-2*V - for i := 0; i < 8; i++ { - z1z1[i] = v[i] << 1 - } - p224Add(&z1z1, &j, &z1z1) - p224Reduce(&z1z1) - p224Square(x3, &r, &c) - p224Sub(x3, x3, &z1z1) - p224Reduce(x3) - // Y3 = r*(V-X3)-2*S1*J - for i := 0; i < 8; i++ { - s1[i] <<= 1 - } - p224Mul(&s1, &s1, &j, &c) - p224Sub(&z1z1, &v, x3) - p224Reduce(&z1z1) - p224Mul(&z1z1, &z1z1, &r, &c) - p224Sub(y3, &z1z1, &s1) - p224Reduce(y3) - - p224CopyConditional(x3, x2, z1IsZero) - p224CopyConditional(x3, x1, z2IsZero) - p224CopyConditional(y3, y2, z1IsZero) - p224CopyConditional(y3, y1, z2IsZero) - p224CopyConditional(z3, z2, z1IsZero) - p224CopyConditional(z3, z1, z2IsZero) -} - -// p224DoubleJacobian computes *out = a+a. -func p224DoubleJacobian(x3, y3, z3, x1, y1, z1 *p224FieldElement) { - var delta, gamma, beta, alpha, t p224FieldElement - var c p224LargeFieldElement - - p224Square(&delta, z1, &c) - p224Square(&gamma, y1, &c) - p224Mul(&beta, x1, &gamma, &c) - - // alpha = 3*(X1-delta)*(X1+delta) - p224Add(&t, x1, &delta) - for i := 0; i < 8; i++ { - t[i] += t[i] << 1 - } - p224Reduce(&t) - p224Sub(&alpha, x1, &delta) - p224Reduce(&alpha) - p224Mul(&alpha, &alpha, &t, &c) - - // Z3 = (Y1+Z1)²-gamma-delta - p224Add(z3, y1, z1) - p224Reduce(z3) - p224Square(z3, z3, &c) - p224Sub(z3, z3, &gamma) - p224Reduce(z3) - p224Sub(z3, z3, &delta) - p224Reduce(z3) - - // X3 = alpha²-8*beta - for i := 0; i < 8; i++ { - delta[i] = beta[i] << 3 - } - p224Reduce(&delta) - p224Square(x3, &alpha, &c) - p224Sub(x3, x3, &delta) - p224Reduce(x3) - - // Y3 = alpha*(4*beta-X3)-8*gamma² - for i := 0; i < 8; i++ { - beta[i] <<= 2 - } - p224Sub(&beta, &beta, x3) - p224Reduce(&beta) - p224Square(&gamma, &gamma, &c) - for i := 0; i < 8; i++ { - gamma[i] <<= 3 - } - p224Reduce(&gamma) - p224Mul(y3, &alpha, &beta, &c) - p224Sub(y3, y3, &gamma) - p224Reduce(y3) -} - -// p224CopyConditional sets *out = *in iff the least-significant-bit of control -// is true, and it runs in constant time. -func p224CopyConditional(out, in *p224FieldElement, control uint32) { - control <<= 31 - control = uint32(int32(control) >> 31) - - for i := 0; i < 8; i++ { - out[i] ^= (out[i] ^ in[i]) & control - } -} - -func p224ScalarMult(outX, outY, outZ, inX, inY, inZ *p224FieldElement, scalar []byte) { - var xx, yy, zz p224FieldElement - for i := 0; i < 8; i++ { - outX[i] = 0 - outY[i] = 0 - outZ[i] = 0 - } - - for _, byte := range scalar { - for bitNum := uint(0); bitNum < 8; bitNum++ { - p224DoubleJacobian(outX, outY, outZ, outX, outY, outZ) - bit := uint32((byte >> (7 - bitNum)) & 1) - p224AddJacobian(&xx, &yy, &zz, inX, inY, inZ, outX, outY, outZ) - p224CopyConditional(outX, &xx, bit) - p224CopyConditional(outY, &yy, bit) - p224CopyConditional(outZ, &zz, bit) - } - } -} - -// p224ToAffine converts from Jacobian to affine form. -func p224ToAffine(x, y, z *p224FieldElement) (*big.Int, *big.Int) { - var zinv, zinvsq, outx, outy p224FieldElement - var tmp p224LargeFieldElement - - if isPointAtInfinity := p224IsZero(z); isPointAtInfinity == 1 { - return new(big.Int), new(big.Int) - } - - p224Invert(&zinv, z) - p224Square(&zinvsq, &zinv, &tmp) - p224Mul(x, x, &zinvsq, &tmp) - p224Mul(&zinvsq, &zinvsq, &zinv, &tmp) - p224Mul(y, y, &zinvsq, &tmp) - - p224Contract(&outx, x) - p224Contract(&outy, y) - return p224ToBig(&outx), p224ToBig(&outy) -} - -// get28BitsFromEnd returns the least-significant 28 bits from buf>>shift, -// where buf is interpreted as a big-endian number. -func get28BitsFromEnd(buf []byte, shift uint) (uint32, []byte) { - var ret uint32 - - for i := uint(0); i < 4; i++ { - var b byte - if l := len(buf); l > 0 { - b = buf[l-1] - // We don't remove the byte if we're about to return and we're not - // reading all of it. - if i != 3 || shift == 4 { - buf = buf[:l-1] - } - } - ret |= uint32(b) << (8 * i) >> shift - } - ret &= bottom28Bits - return ret, buf -} - -// p224FromBig sets *out = *in. -func p224FromBig(out *p224FieldElement, in *big.Int) { - bytes := in.Bytes() - out[0], bytes = get28BitsFromEnd(bytes, 0) - out[1], bytes = get28BitsFromEnd(bytes, 4) - out[2], bytes = get28BitsFromEnd(bytes, 0) - out[3], bytes = get28BitsFromEnd(bytes, 4) - out[4], bytes = get28BitsFromEnd(bytes, 0) - out[5], bytes = get28BitsFromEnd(bytes, 4) - out[6], bytes = get28BitsFromEnd(bytes, 0) - out[7], bytes = get28BitsFromEnd(bytes, 4) -} - -// p224ToBig returns in as a big.Int. -func p224ToBig(in *p224FieldElement) *big.Int { - var buf [28]byte - buf[27] = byte(in[0]) - buf[26] = byte(in[0] >> 8) - buf[25] = byte(in[0] >> 16) - buf[24] = byte(((in[0] >> 24) & 0x0f) | (in[1]<<4)&0xf0) - - buf[23] = byte(in[1] >> 4) - buf[22] = byte(in[1] >> 12) - buf[21] = byte(in[1] >> 20) - - buf[20] = byte(in[2]) - buf[19] = byte(in[2] >> 8) - buf[18] = byte(in[2] >> 16) - buf[17] = byte(((in[2] >> 24) & 0x0f) | (in[3]<<4)&0xf0) - - buf[16] = byte(in[3] >> 4) - buf[15] = byte(in[3] >> 12) - buf[14] = byte(in[3] >> 20) - - buf[13] = byte(in[4]) - buf[12] = byte(in[4] >> 8) - buf[11] = byte(in[4] >> 16) - buf[10] = byte(((in[4] >> 24) & 0x0f) | (in[5]<<4)&0xf0) - - buf[9] = byte(in[5] >> 4) - buf[8] = byte(in[5] >> 12) - buf[7] = byte(in[5] >> 20) - - buf[6] = byte(in[6]) - buf[5] = byte(in[6] >> 8) - buf[4] = byte(in[6] >> 16) - buf[3] = byte(((in[6] >> 24) & 0x0f) | (in[7]<<4)&0xf0) - - buf[2] = byte(in[7] >> 4) - buf[1] = byte(in[7] >> 12) - buf[0] = byte(in[7] >> 20) - - return new(big.Int).SetBytes(buf[:]) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224_test.go deleted file mode 100644 index 4b26d1610ed80d8ceb0c9dde2a8ecc4ba5afda46..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p224_test.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elliptic - -import ( - "math/big" - "testing" -) - -var toFromBigTests = []string{ - "0", - "1", - "23", - "b70e0cb46bb4bf7f321390b94a03c1d356c01122343280d6105c1d21", - "706a46d476dcb76798e6046d89474788d164c18032d268fd10704fa6", -} - -func p224AlternativeToBig(in *p224FieldElement) *big.Int { - ret := new(big.Int) - tmp := new(big.Int) - - for i := uint(0); i < 8; i++ { - tmp.SetInt64(int64(in[i])) - tmp.Lsh(tmp, 28*i) - ret.Add(ret, tmp) - } - ret.Mod(ret, p224.P) - return ret -} - -func TestToFromBig(t *testing.T) { - for i, test := range toFromBigTests { - n, _ := new(big.Int).SetString(test, 16) - var x p224FieldElement - p224FromBig(&x, n) - m := p224ToBig(&x) - if n.Cmp(m) != 0 { - t.Errorf("#%d: %x != %x", i, n, m) - } - q := p224AlternativeToBig(&x) - if n.Cmp(q) != 0 { - t.Errorf("#%d: %x != %x (alternative)", i, n, m) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p256.go b/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p256.go deleted file mode 100644 index 82bc7b3019e62c6d7fd468bb2b59b88c43c3201e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/elliptic/p256.go +++ /dev/null @@ -1,1186 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elliptic - -// This file contains a constant-time, 32-bit implementation of P256. - -import ( - "math/big" -) - -type p256Curve struct { - *CurveParams -} - -var ( - p256 p256Curve - // RInverse contains 1/R mod p - the inverse of the Montgomery constant - // (2**257). - p256RInverse *big.Int -) - -func initP256() { - // See FIPS 186-3, section D.2.3 - p256.CurveParams = &CurveParams{Name: "P-256"} - p256.P, _ = new(big.Int).SetString("115792089210356248762697446949407573530086143415290314195533631308867097853951", 10) - p256.N, _ = new(big.Int).SetString("115792089210356248762697446949407573529996955224135760342422259061068512044369", 10) - p256.B, _ = new(big.Int).SetString("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b", 16) - p256.Gx, _ = new(big.Int).SetString("6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296", 16) - p256.Gy, _ = new(big.Int).SetString("4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5", 16) - p256.BitSize = 256 - - p256RInverse, _ = new(big.Int).SetString("7fffffff00000001fffffffe8000000100000000ffffffff0000000180000000", 16) -} - -func (curve p256Curve) Params() *CurveParams { - return curve.CurveParams -} - -// p256GetScalar endian-swaps the big-endian scalar value from in and writes it -// to out. If the scalar is equal or greater than the order of the group, it's -// reduced modulo that order. -func p256GetScalar(out *[32]byte, in []byte) { - n := new(big.Int).SetBytes(in) - var scalarBytes []byte - - if n.Cmp(p256.N) >= 0 { - n.Mod(n, p256.N) - scalarBytes = n.Bytes() - } else { - scalarBytes = in - } - - for i, v := range scalarBytes { - out[len(scalarBytes)-(1+i)] = v - } -} - -func (p256Curve) ScalarBaseMult(scalar []byte) (x, y *big.Int) { - var scalarReversed [32]byte - p256GetScalar(&scalarReversed, scalar) - - var x1, y1, z1 [p256Limbs]uint32 - p256ScalarBaseMult(&x1, &y1, &z1, &scalarReversed) - return p256ToAffine(&x1, &y1, &z1) -} - -func (p256Curve) ScalarMult(bigX, bigY *big.Int, scalar []byte) (x, y *big.Int) { - var scalarReversed [32]byte - p256GetScalar(&scalarReversed, scalar) - - var px, py, x1, y1, z1 [p256Limbs]uint32 - p256FromBig(&px, bigX) - p256FromBig(&py, bigY) - p256ScalarMult(&x1, &y1, &z1, &px, &py, &scalarReversed) - return p256ToAffine(&x1, &y1, &z1) -} - -// Field elements are represented as nine, unsigned 32-bit words. -// -// The value of an field element is: -// x[0] + (x[1] * 2**29) + (x[2] * 2**57) + ... + (x[8] * 2**228) -// -// That is, each limb is alternately 29 or 28-bits wide in little-endian -// order. -// -// This means that a field element hits 2**257, rather than 2**256 as we would -// like. A 28, 29, ... pattern would cause us to hit 2**256, but that causes -// problems when multiplying as terms end up one bit short of a limb which -// would require much bit-shifting to correct. -// -// Finally, the values stored in a field element are in Montgomery form. So the -// value |y| is stored as (y*R) mod p, where p is the P-256 prime and R is -// 2**257. - -const ( - p256Limbs = 9 - bottom29Bits = 0x1fffffff -) - -var ( - // p256One is the number 1 as a field element. - p256One = [p256Limbs]uint32{2, 0, 0, 0xffff800, 0x1fffffff, 0xfffffff, 0x1fbfffff, 0x1ffffff, 0} - p256Zero = [p256Limbs]uint32{0, 0, 0, 0, 0, 0, 0, 0, 0} - // p256P is the prime modulus as a field element. - p256P = [p256Limbs]uint32{0x1fffffff, 0xfffffff, 0x1fffffff, 0x3ff, 0, 0, 0x200000, 0xf000000, 0xfffffff} - // p2562P is the twice prime modulus as a field element. - p2562P = [p256Limbs]uint32{0x1ffffffe, 0xfffffff, 0x1fffffff, 0x7ff, 0, 0, 0x400000, 0xe000000, 0x1fffffff} -) - -// p256Precomputed contains precomputed values to aid the calculation of scalar -// multiples of the base point, G. It's actually two, equal length, tables -// concatenated. -// -// The first table contains (x,y) field element pairs for 16 multiples of the -// base point, G. -// -// Index | Index (binary) | Value -// 0 | 0000 | 0G (all zeros, omitted) -// 1 | 0001 | G -// 2 | 0010 | 2**64G -// 3 | 0011 | 2**64G + G -// 4 | 0100 | 2**128G -// 5 | 0101 | 2**128G + G -// 6 | 0110 | 2**128G + 2**64G -// 7 | 0111 | 2**128G + 2**64G + G -// 8 | 1000 | 2**192G -// 9 | 1001 | 2**192G + G -// 10 | 1010 | 2**192G + 2**64G -// 11 | 1011 | 2**192G + 2**64G + G -// 12 | 1100 | 2**192G + 2**128G -// 13 | 1101 | 2**192G + 2**128G + G -// 14 | 1110 | 2**192G + 2**128G + 2**64G -// 15 | 1111 | 2**192G + 2**128G + 2**64G + G -// -// The second table follows the same style, but the terms are 2**32G, -// 2**96G, 2**160G, 2**224G. -// -// This is ~2KB of data. -var p256Precomputed = [p256Limbs * 2 * 15 * 2]uint32{ - 0x11522878, 0xe730d41, 0xdb60179, 0x4afe2ff, 0x12883add, 0xcaddd88, 0x119e7edc, 0xd4a6eab, 0x3120bee, - 0x1d2aac15, 0xf25357c, 0x19e45cdd, 0x5c721d0, 0x1992c5a5, 0xa237487, 0x154ba21, 0x14b10bb, 0xae3fe3, - 0xd41a576, 0x922fc51, 0x234994f, 0x60b60d3, 0x164586ae, 0xce95f18, 0x1fe49073, 0x3fa36cc, 0x5ebcd2c, - 0xb402f2f, 0x15c70bf, 0x1561925c, 0x5a26704, 0xda91e90, 0xcdc1c7f, 0x1ea12446, 0xe1ade1e, 0xec91f22, - 0x26f7778, 0x566847e, 0xa0bec9e, 0x234f453, 0x1a31f21a, 0xd85e75c, 0x56c7109, 0xa267a00, 0xb57c050, - 0x98fb57, 0xaa837cc, 0x60c0792, 0xcfa5e19, 0x61bab9e, 0x589e39b, 0xa324c5, 0x7d6dee7, 0x2976e4b, - 0x1fc4124a, 0xa8c244b, 0x1ce86762, 0xcd61c7e, 0x1831c8e0, 0x75774e1, 0x1d96a5a9, 0x843a649, 0xc3ab0fa, - 0x6e2e7d5, 0x7673a2a, 0x178b65e8, 0x4003e9b, 0x1a1f11c2, 0x7816ea, 0xf643e11, 0x58c43df, 0xf423fc2, - 0x19633ffa, 0x891f2b2, 0x123c231c, 0x46add8c, 0x54700dd, 0x59e2b17, 0x172db40f, 0x83e277d, 0xb0dd609, - 0xfd1da12, 0x35c6e52, 0x19ede20c, 0xd19e0c0, 0x97d0f40, 0xb015b19, 0x449e3f5, 0xe10c9e, 0x33ab581, - 0x56a67ab, 0x577734d, 0x1dddc062, 0xc57b10d, 0x149b39d, 0x26a9e7b, 0xc35df9f, 0x48764cd, 0x76dbcca, - 0xca4b366, 0xe9303ab, 0x1a7480e7, 0x57e9e81, 0x1e13eb50, 0xf466cf3, 0x6f16b20, 0x4ba3173, 0xc168c33, - 0x15cb5439, 0x6a38e11, 0x73658bd, 0xb29564f, 0x3f6dc5b, 0x53b97e, 0x1322c4c0, 0x65dd7ff, 0x3a1e4f6, - 0x14e614aa, 0x9246317, 0x1bc83aca, 0xad97eed, 0xd38ce4a, 0xf82b006, 0x341f077, 0xa6add89, 0x4894acd, - 0x9f162d5, 0xf8410ef, 0x1b266a56, 0xd7f223, 0x3e0cb92, 0xe39b672, 0x6a2901a, 0x69a8556, 0x7e7c0, - 0x9b7d8d3, 0x309a80, 0x1ad05f7f, 0xc2fb5dd, 0xcbfd41d, 0x9ceb638, 0x1051825c, 0xda0cf5b, 0x812e881, - 0x6f35669, 0x6a56f2c, 0x1df8d184, 0x345820, 0x1477d477, 0x1645db1, 0xbe80c51, 0xc22be3e, 0xe35e65a, - 0x1aeb7aa0, 0xc375315, 0xf67bc99, 0x7fdd7b9, 0x191fc1be, 0x61235d, 0x2c184e9, 0x1c5a839, 0x47a1e26, - 0xb7cb456, 0x93e225d, 0x14f3c6ed, 0xccc1ac9, 0x17fe37f3, 0x4988989, 0x1a90c502, 0x2f32042, 0xa17769b, - 0xafd8c7c, 0x8191c6e, 0x1dcdb237, 0x16200c0, 0x107b32a1, 0x66c08db, 0x10d06a02, 0x3fc93, 0x5620023, - 0x16722b27, 0x68b5c59, 0x270fcfc, 0xfad0ecc, 0xe5de1c2, 0xeab466b, 0x2fc513c, 0x407f75c, 0xbaab133, - 0x9705fe9, 0xb88b8e7, 0x734c993, 0x1e1ff8f, 0x19156970, 0xabd0f00, 0x10469ea7, 0x3293ac0, 0xcdc98aa, - 0x1d843fd, 0xe14bfe8, 0x15be825f, 0x8b5212, 0xeb3fb67, 0x81cbd29, 0xbc62f16, 0x2b6fcc7, 0xf5a4e29, - 0x13560b66, 0xc0b6ac2, 0x51ae690, 0xd41e271, 0xf3e9bd4, 0x1d70aab, 0x1029f72, 0x73e1c35, 0xee70fbc, - 0xad81baf, 0x9ecc49a, 0x86c741e, 0xfe6be30, 0x176752e7, 0x23d416, 0x1f83de85, 0x27de188, 0x66f70b8, - 0x181cd51f, 0x96b6e4c, 0x188f2335, 0xa5df759, 0x17a77eb6, 0xfeb0e73, 0x154ae914, 0x2f3ec51, 0x3826b59, - 0xb91f17d, 0x1c72949, 0x1362bf0a, 0xe23fddf, 0xa5614b0, 0xf7d8f, 0x79061, 0x823d9d2, 0x8213f39, - 0x1128ae0b, 0xd095d05, 0xb85c0c2, 0x1ecb2ef, 0x24ddc84, 0xe35e901, 0x18411a4a, 0xf5ddc3d, 0x3786689, - 0x52260e8, 0x5ae3564, 0x542b10d, 0x8d93a45, 0x19952aa4, 0x996cc41, 0x1051a729, 0x4be3499, 0x52b23aa, - 0x109f307e, 0x6f5b6bb, 0x1f84e1e7, 0x77a0cfa, 0x10c4df3f, 0x25a02ea, 0xb048035, 0xe31de66, 0xc6ecaa3, - 0x28ea335, 0x2886024, 0x1372f020, 0xf55d35, 0x15e4684c, 0xf2a9e17, 0x1a4a7529, 0xcb7beb1, 0xb2a78a1, - 0x1ab21f1f, 0x6361ccf, 0x6c9179d, 0xb135627, 0x1267b974, 0x4408bad, 0x1cbff658, 0xe3d6511, 0xc7d76f, - 0x1cc7a69, 0xe7ee31b, 0x54fab4f, 0x2b914f, 0x1ad27a30, 0xcd3579e, 0xc50124c, 0x50daa90, 0xb13f72, - 0xb06aa75, 0x70f5cc6, 0x1649e5aa, 0x84a5312, 0x329043c, 0x41c4011, 0x13d32411, 0xb04a838, 0xd760d2d, - 0x1713b532, 0xbaa0c03, 0x84022ab, 0x6bcf5c1, 0x2f45379, 0x18ae070, 0x18c9e11e, 0x20bca9a, 0x66f496b, - 0x3eef294, 0x67500d2, 0xd7f613c, 0x2dbbeb, 0xb741038, 0xe04133f, 0x1582968d, 0xbe985f7, 0x1acbc1a, - 0x1a6a939f, 0x33e50f6, 0xd665ed4, 0xb4b7bd6, 0x1e5a3799, 0x6b33847, 0x17fa56ff, 0x65ef930, 0x21dc4a, - 0x2b37659, 0x450fe17, 0xb357b65, 0xdf5efac, 0x15397bef, 0x9d35a7f, 0x112ac15f, 0x624e62e, 0xa90ae2f, - 0x107eecd2, 0x1f69bbe, 0x77d6bce, 0x5741394, 0x13c684fc, 0x950c910, 0x725522b, 0xdc78583, 0x40eeabb, - 0x1fde328a, 0xbd61d96, 0xd28c387, 0x9e77d89, 0x12550c40, 0x759cb7d, 0x367ef34, 0xae2a960, 0x91b8bdc, - 0x93462a9, 0xf469ef, 0xb2e9aef, 0xd2ca771, 0x54e1f42, 0x7aaa49, 0x6316abb, 0x2413c8e, 0x5425bf9, - 0x1bed3e3a, 0xf272274, 0x1f5e7326, 0x6416517, 0xea27072, 0x9cedea7, 0x6e7633, 0x7c91952, 0xd806dce, - 0x8e2a7e1, 0xe421e1a, 0x418c9e1, 0x1dbc890, 0x1b395c36, 0xa1dc175, 0x1dc4ef73, 0x8956f34, 0xe4b5cf2, - 0x1b0d3a18, 0x3194a36, 0x6c2641f, 0xe44124c, 0xa2f4eaa, 0xa8c25ba, 0xf927ed7, 0x627b614, 0x7371cca, - 0xba16694, 0x417bc03, 0x7c0a7e3, 0x9c35c19, 0x1168a205, 0x8b6b00d, 0x10e3edc9, 0x9c19bf2, 0x5882229, - 0x1b2b4162, 0xa5cef1a, 0x1543622b, 0x9bd433e, 0x364e04d, 0x7480792, 0x5c9b5b3, 0xe85ff25, 0x408ef57, - 0x1814cfa4, 0x121b41b, 0xd248a0f, 0x3b05222, 0x39bb16a, 0xc75966d, 0xa038113, 0xa4a1769, 0x11fbc6c, - 0x917e50e, 0xeec3da8, 0x169d6eac, 0x10c1699, 0xa416153, 0xf724912, 0x15cd60b7, 0x4acbad9, 0x5efc5fa, - 0xf150ed7, 0x122b51, 0x1104b40a, 0xcb7f442, 0xfbb28ff, 0x6ac53ca, 0x196142cc, 0x7bf0fa9, 0x957651, - 0x4e0f215, 0xed439f8, 0x3f46bd5, 0x5ace82f, 0x110916b6, 0x6db078, 0xffd7d57, 0xf2ecaac, 0xca86dec, - 0x15d6b2da, 0x965ecc9, 0x1c92b4c2, 0x1f3811, 0x1cb080f5, 0x2d8b804, 0x19d1c12d, 0xf20bd46, 0x1951fa7, - 0xa3656c3, 0x523a425, 0xfcd0692, 0xd44ddc8, 0x131f0f5b, 0xaf80e4a, 0xcd9fc74, 0x99bb618, 0x2db944c, - 0xa673090, 0x1c210e1, 0x178c8d23, 0x1474383, 0x10b8743d, 0x985a55b, 0x2e74779, 0x576138, 0x9587927, - 0x133130fa, 0xbe05516, 0x9f4d619, 0xbb62570, 0x99ec591, 0xd9468fe, 0x1d07782d, 0xfc72e0b, 0x701b298, - 0x1863863b, 0x85954b8, 0x121a0c36, 0x9e7fedf, 0xf64b429, 0x9b9d71e, 0x14e2f5d8, 0xf858d3a, 0x942eea8, - 0xda5b765, 0x6edafff, 0xa9d18cc, 0xc65e4ba, 0x1c747e86, 0xe4ea915, 0x1981d7a1, 0x8395659, 0x52ed4e2, - 0x87d43b7, 0x37ab11b, 0x19d292ce, 0xf8d4692, 0x18c3053f, 0x8863e13, 0x4c146c0, 0x6bdf55a, 0x4e4457d, - 0x16152289, 0xac78ec2, 0x1a59c5a2, 0x2028b97, 0x71c2d01, 0x295851f, 0x404747b, 0x878558d, 0x7d29aa4, - 0x13d8341f, 0x8daefd7, 0x139c972d, 0x6b7ea75, 0xd4a9dde, 0xff163d8, 0x81d55d7, 0xa5bef68, 0xb7b30d8, - 0xbe73d6f, 0xaa88141, 0xd976c81, 0x7e7a9cc, 0x18beb771, 0xd773cbd, 0x13f51951, 0x9d0c177, 0x1c49a78, -} - -// Field element operations: - -// nonZeroToAllOnes returns: -// 0xffffffff for 0 < x <= 2**31 -// 0 for x == 0 or x > 2**31. -func nonZeroToAllOnes(x uint32) uint32 { - return ((x - 1) >> 31) - 1 -} - -// p256ReduceCarry adds a multiple of p in order to cancel |carry|, -// which is a term at 2**257. -// -// On entry: carry < 2**3, inout[0,2,...] < 2**29, inout[1,3,...] < 2**28. -// On exit: inout[0,2,..] < 2**30, inout[1,3,...] < 2**29. -func p256ReduceCarry(inout *[p256Limbs]uint32, carry uint32) { - carry_mask := nonZeroToAllOnes(carry) - - inout[0] += carry << 1 - inout[3] += 0x10000000 & carry_mask - // carry < 2**3 thus (carry << 11) < 2**14 and we added 2**28 in the - // previous line therefore this doesn't underflow. - inout[3] -= carry << 11 - inout[4] += (0x20000000 - 1) & carry_mask - inout[5] += (0x10000000 - 1) & carry_mask - inout[6] += (0x20000000 - 1) & carry_mask - inout[6] -= carry << 22 - // This may underflow if carry is non-zero but, if so, we'll fix it in the - // next line. - inout[7] -= 1 & carry_mask - inout[7] += carry << 25 -} - -// p256Sum sets out = in+in2. -// -// On entry, in[i]+in2[i] must not overflow a 32-bit word. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29 -func p256Sum(out, in, in2 *[p256Limbs]uint32) { - carry := uint32(0) - for i := 0; ; i++ { - out[i] = in[i] + in2[i] - out[i] += carry - carry = out[i] >> 29 - out[i] &= bottom29Bits - - i++ - if i == p256Limbs { - break - } - - out[i] = in[i] + in2[i] - out[i] += carry - carry = out[i] >> 28 - out[i] &= bottom28Bits - } - - p256ReduceCarry(out, carry) -} - -const ( - two30m2 = 1<<30 - 1<<2 - two30p13m2 = 1<<30 + 1<<13 - 1<<2 - two31m2 = 1<<31 - 1<<2 - two31p24m2 = 1<<31 + 1<<24 - 1<<2 - two30m27m2 = 1<<30 - 1<<27 - 1<<2 -) - -// p256Zero31 is 0 mod p. -var p256Zero31 = [p256Limbs]uint32{two31m3, two30m2, two31m2, two30p13m2, two31m2, two30m2, two31p24m2, two30m27m2, two31m2} - -// p256Diff sets out = in-in2. -// -// On entry: in[0,2,...] < 2**30, in[1,3,...] < 2**29 and -// in2[0,2,...] < 2**30, in2[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Diff(out, in, in2 *[p256Limbs]uint32) { - var carry uint32 - - for i := 0; ; i++ { - out[i] = in[i] - in2[i] - out[i] += p256Zero31[i] - out[i] += carry - carry = out[i] >> 29 - out[i] &= bottom29Bits - - i++ - if i == p256Limbs { - break - } - - out[i] = in[i] - in2[i] - out[i] += p256Zero31[i] - out[i] += carry - carry = out[i] >> 28 - out[i] &= bottom28Bits - } - - p256ReduceCarry(out, carry) -} - -// p256ReduceDegree sets out = tmp/R mod p where tmp contains 64-bit words with -// the same 29,28,... bit positions as an field element. -// -// The values in field elements are in Montgomery form: x*R mod p where R = -// 2**257. Since we just multiplied two Montgomery values together, the result -// is x*y*R*R mod p. We wish to divide by R in order for the result also to be -// in Montgomery form. -// -// On entry: tmp[i] < 2**64 -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29 -func p256ReduceDegree(out *[p256Limbs]uint32, tmp [17]uint64) { - // The following table may be helpful when reading this code: - // - // Limb number: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10... - // Width (bits): 29| 28| 29| 28| 29| 28| 29| 28| 29| 28| 29 - // Start bit: 0 | 29| 57| 86|114|143|171|200|228|257|285 - // (odd phase): 0 | 28| 57| 85|114|142|171|199|228|256|285 - var tmp2 [18]uint32 - var carry, x, xMask uint32 - - // tmp contains 64-bit words with the same 29,28,29-bit positions as an - // field element. So the top of an element of tmp might overlap with - // another element two positions down. The following loop eliminates - // this overlap. - tmp2[0] = uint32(tmp[0]) & bottom29Bits - - tmp2[1] = uint32(tmp[0]) >> 29 - tmp2[1] |= (uint32(tmp[0]>>32) << 3) & bottom28Bits - tmp2[1] += uint32(tmp[1]) & bottom28Bits - carry = tmp2[1] >> 28 - tmp2[1] &= bottom28Bits - - for i := 2; i < 17; i++ { - tmp2[i] = (uint32(tmp[i-2] >> 32)) >> 25 - tmp2[i] += (uint32(tmp[i-1])) >> 28 - tmp2[i] += (uint32(tmp[i-1]>>32) << 4) & bottom29Bits - tmp2[i] += uint32(tmp[i]) & bottom29Bits - tmp2[i] += carry - carry = tmp2[i] >> 29 - tmp2[i] &= bottom29Bits - - i++ - if i == 17 { - break - } - tmp2[i] = uint32(tmp[i-2]>>32) >> 25 - tmp2[i] += uint32(tmp[i-1]) >> 29 - tmp2[i] += ((uint32(tmp[i-1] >> 32)) << 3) & bottom28Bits - tmp2[i] += uint32(tmp[i]) & bottom28Bits - tmp2[i] += carry - carry = tmp2[i] >> 28 - tmp2[i] &= bottom28Bits - } - - tmp2[17] = uint32(tmp[15]>>32) >> 25 - tmp2[17] += uint32(tmp[16]) >> 29 - tmp2[17] += uint32(tmp[16]>>32) << 3 - tmp2[17] += carry - - // Montgomery elimination of terms: - // - // Since R is 2**257, we can divide by R with a bitwise shift if we can - // ensure that the right-most 257 bits are all zero. We can make that true - // by adding multiplies of p without affecting the value. - // - // So we eliminate limbs from right to left. Since the bottom 29 bits of p - // are all ones, then by adding tmp2[0]*p to tmp2 we'll make tmp2[0] == 0. - // We can do that for 8 further limbs and then right shift to eliminate the - // extra factor of R. - for i := 0; ; i += 2 { - tmp2[i+1] += tmp2[i] >> 29 - x = tmp2[i] & bottom29Bits - xMask = nonZeroToAllOnes(x) - tmp2[i] = 0 - - // The bounds calculations for this loop are tricky. Each iteration of - // the loop eliminates two words by adding values to words to their - // right. - // - // The following table contains the amounts added to each word (as an - // offset from the value of i at the top of the loop). The amounts are - // accounted for from the first and second half of the loop separately - // and are written as, for example, 28 to mean a value <2**28. - // - // Word: 3 4 5 6 7 8 9 10 - // Added in top half: 28 11 29 21 29 28 - // 28 29 - // 29 - // Added in bottom half: 29 10 28 21 28 28 - // 29 - // - // The value that is currently offset 7 will be offset 5 for the next - // iteration and then offset 3 for the iteration after that. Therefore - // the total value added will be the values added at 7, 5 and 3. - // - // The following table accumulates these values. The sums at the bottom - // are written as, for example, 29+28, to mean a value < 2**29+2**28. - // - // Word: 3 4 5 6 7 8 9 10 11 12 13 - // 28 11 10 29 21 29 28 28 28 28 28 - // 29 28 11 28 29 28 29 28 29 28 - // 29 28 21 21 29 21 29 21 - // 10 29 28 21 28 21 28 - // 28 29 28 29 28 29 28 - // 11 10 29 10 29 10 - // 29 28 11 28 11 - // 29 29 - // -------------------------------------------- - // 30+ 31+ 30+ 31+ 30+ - // 28+ 29+ 28+ 29+ 21+ - // 21+ 28+ 21+ 28+ 10 - // 10 21+ 10 21+ - // 11 11 - // - // So the greatest amount is added to tmp2[10] and tmp2[12]. If - // tmp2[10/12] has an initial value of <2**29, then the maximum value - // will be < 2**31 + 2**30 + 2**28 + 2**21 + 2**11, which is < 2**32, - // as required. - tmp2[i+3] += (x << 10) & bottom28Bits - tmp2[i+4] += (x >> 18) - - tmp2[i+6] += (x << 21) & bottom29Bits - tmp2[i+7] += x >> 8 - - // At position 200, which is the starting bit position for word 7, we - // have a factor of 0xf000000 = 2**28 - 2**24. - tmp2[i+7] += 0x10000000 & xMask - tmp2[i+8] += (x - 1) & xMask - tmp2[i+7] -= (x << 24) & bottom28Bits - tmp2[i+8] -= x >> 4 - - tmp2[i+8] += 0x20000000 & xMask - tmp2[i+8] -= x - tmp2[i+8] += (x << 28) & bottom29Bits - tmp2[i+9] += ((x >> 1) - 1) & xMask - - if i+1 == p256Limbs { - break - } - tmp2[i+2] += tmp2[i+1] >> 28 - x = tmp2[i+1] & bottom28Bits - xMask = nonZeroToAllOnes(x) - tmp2[i+1] = 0 - - tmp2[i+4] += (x << 11) & bottom29Bits - tmp2[i+5] += (x >> 18) - - tmp2[i+7] += (x << 21) & bottom28Bits - tmp2[i+8] += x >> 7 - - // At position 199, which is the starting bit of the 8th word when - // dealing with a context starting on an odd word, we have a factor of - // 0x1e000000 = 2**29 - 2**25. Since we have not updated i, the 8th - // word from i+1 is i+8. - tmp2[i+8] += 0x20000000 & xMask - tmp2[i+9] += (x - 1) & xMask - tmp2[i+8] -= (x << 25) & bottom29Bits - tmp2[i+9] -= x >> 4 - - tmp2[i+9] += 0x10000000 & xMask - tmp2[i+9] -= x - tmp2[i+10] += (x - 1) & xMask - } - - // We merge the right shift with a carry chain. The words above 2**257 have - // widths of 28,29,... which we need to correct when copying them down. - carry = 0 - for i := 0; i < 8; i++ { - // The maximum value of tmp2[i + 9] occurs on the first iteration and - // is < 2**30+2**29+2**28. Adding 2**29 (from tmp2[i + 10]) is - // therefore safe. - out[i] = tmp2[i+9] - out[i] += carry - out[i] += (tmp2[i+10] << 28) & bottom29Bits - carry = out[i] >> 29 - out[i] &= bottom29Bits - - i++ - out[i] = tmp2[i+9] >> 1 - out[i] += carry - carry = out[i] >> 28 - out[i] &= bottom28Bits - } - - out[8] = tmp2[17] - out[8] += carry - carry = out[8] >> 29 - out[8] &= bottom29Bits - - p256ReduceCarry(out, carry) -} - -// p256Square sets out=in*in. -// -// On entry: in[0,2,...] < 2**30, in[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Square(out, in *[p256Limbs]uint32) { - var tmp [17]uint64 - - tmp[0] = uint64(in[0]) * uint64(in[0]) - tmp[1] = uint64(in[0]) * (uint64(in[1]) << 1) - tmp[2] = uint64(in[0])*(uint64(in[2])<<1) + - uint64(in[1])*(uint64(in[1])<<1) - tmp[3] = uint64(in[0])*(uint64(in[3])<<1) + - uint64(in[1])*(uint64(in[2])<<1) - tmp[4] = uint64(in[0])*(uint64(in[4])<<1) + - uint64(in[1])*(uint64(in[3])<<2) + - uint64(in[2])*uint64(in[2]) - tmp[5] = uint64(in[0])*(uint64(in[5])<<1) + - uint64(in[1])*(uint64(in[4])<<1) + - uint64(in[2])*(uint64(in[3])<<1) - tmp[6] = uint64(in[0])*(uint64(in[6])<<1) + - uint64(in[1])*(uint64(in[5])<<2) + - uint64(in[2])*(uint64(in[4])<<1) + - uint64(in[3])*(uint64(in[3])<<1) - tmp[7] = uint64(in[0])*(uint64(in[7])<<1) + - uint64(in[1])*(uint64(in[6])<<1) + - uint64(in[2])*(uint64(in[5])<<1) + - uint64(in[3])*(uint64(in[4])<<1) - // tmp[8] has the greatest value of 2**61 + 2**60 + 2**61 + 2**60 + 2**60, - // which is < 2**64 as required. - tmp[8] = uint64(in[0])*(uint64(in[8])<<1) + - uint64(in[1])*(uint64(in[7])<<2) + - uint64(in[2])*(uint64(in[6])<<1) + - uint64(in[3])*(uint64(in[5])<<2) + - uint64(in[4])*uint64(in[4]) - tmp[9] = uint64(in[1])*(uint64(in[8])<<1) + - uint64(in[2])*(uint64(in[7])<<1) + - uint64(in[3])*(uint64(in[6])<<1) + - uint64(in[4])*(uint64(in[5])<<1) - tmp[10] = uint64(in[2])*(uint64(in[8])<<1) + - uint64(in[3])*(uint64(in[7])<<2) + - uint64(in[4])*(uint64(in[6])<<1) + - uint64(in[5])*(uint64(in[5])<<1) - tmp[11] = uint64(in[3])*(uint64(in[8])<<1) + - uint64(in[4])*(uint64(in[7])<<1) + - uint64(in[5])*(uint64(in[6])<<1) - tmp[12] = uint64(in[4])*(uint64(in[8])<<1) + - uint64(in[5])*(uint64(in[7])<<2) + - uint64(in[6])*uint64(in[6]) - tmp[13] = uint64(in[5])*(uint64(in[8])<<1) + - uint64(in[6])*(uint64(in[7])<<1) - tmp[14] = uint64(in[6])*(uint64(in[8])<<1) + - uint64(in[7])*(uint64(in[7])<<1) - tmp[15] = uint64(in[7]) * (uint64(in[8]) << 1) - tmp[16] = uint64(in[8]) * uint64(in[8]) - - p256ReduceDegree(out, tmp) -} - -// p256Mul sets out=in*in2. -// -// On entry: in[0,2,...] < 2**30, in[1,3,...] < 2**29 and -// in2[0,2,...] < 2**30, in2[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Mul(out, in, in2 *[p256Limbs]uint32) { - var tmp [17]uint64 - - tmp[0] = uint64(in[0]) * uint64(in2[0]) - tmp[1] = uint64(in[0])*(uint64(in2[1])<<0) + - uint64(in[1])*(uint64(in2[0])<<0) - tmp[2] = uint64(in[0])*(uint64(in2[2])<<0) + - uint64(in[1])*(uint64(in2[1])<<1) + - uint64(in[2])*(uint64(in2[0])<<0) - tmp[3] = uint64(in[0])*(uint64(in2[3])<<0) + - uint64(in[1])*(uint64(in2[2])<<0) + - uint64(in[2])*(uint64(in2[1])<<0) + - uint64(in[3])*(uint64(in2[0])<<0) - tmp[4] = uint64(in[0])*(uint64(in2[4])<<0) + - uint64(in[1])*(uint64(in2[3])<<1) + - uint64(in[2])*(uint64(in2[2])<<0) + - uint64(in[3])*(uint64(in2[1])<<1) + - uint64(in[4])*(uint64(in2[0])<<0) - tmp[5] = uint64(in[0])*(uint64(in2[5])<<0) + - uint64(in[1])*(uint64(in2[4])<<0) + - uint64(in[2])*(uint64(in2[3])<<0) + - uint64(in[3])*(uint64(in2[2])<<0) + - uint64(in[4])*(uint64(in2[1])<<0) + - uint64(in[5])*(uint64(in2[0])<<0) - tmp[6] = uint64(in[0])*(uint64(in2[6])<<0) + - uint64(in[1])*(uint64(in2[5])<<1) + - uint64(in[2])*(uint64(in2[4])<<0) + - uint64(in[3])*(uint64(in2[3])<<1) + - uint64(in[4])*(uint64(in2[2])<<0) + - uint64(in[5])*(uint64(in2[1])<<1) + - uint64(in[6])*(uint64(in2[0])<<0) - tmp[7] = uint64(in[0])*(uint64(in2[7])<<0) + - uint64(in[1])*(uint64(in2[6])<<0) + - uint64(in[2])*(uint64(in2[5])<<0) + - uint64(in[3])*(uint64(in2[4])<<0) + - uint64(in[4])*(uint64(in2[3])<<0) + - uint64(in[5])*(uint64(in2[2])<<0) + - uint64(in[6])*(uint64(in2[1])<<0) + - uint64(in[7])*(uint64(in2[0])<<0) - // tmp[8] has the greatest value but doesn't overflow. See logic in - // p256Square. - tmp[8] = uint64(in[0])*(uint64(in2[8])<<0) + - uint64(in[1])*(uint64(in2[7])<<1) + - uint64(in[2])*(uint64(in2[6])<<0) + - uint64(in[3])*(uint64(in2[5])<<1) + - uint64(in[4])*(uint64(in2[4])<<0) + - uint64(in[5])*(uint64(in2[3])<<1) + - uint64(in[6])*(uint64(in2[2])<<0) + - uint64(in[7])*(uint64(in2[1])<<1) + - uint64(in[8])*(uint64(in2[0])<<0) - tmp[9] = uint64(in[1])*(uint64(in2[8])<<0) + - uint64(in[2])*(uint64(in2[7])<<0) + - uint64(in[3])*(uint64(in2[6])<<0) + - uint64(in[4])*(uint64(in2[5])<<0) + - uint64(in[5])*(uint64(in2[4])<<0) + - uint64(in[6])*(uint64(in2[3])<<0) + - uint64(in[7])*(uint64(in2[2])<<0) + - uint64(in[8])*(uint64(in2[1])<<0) - tmp[10] = uint64(in[2])*(uint64(in2[8])<<0) + - uint64(in[3])*(uint64(in2[7])<<1) + - uint64(in[4])*(uint64(in2[6])<<0) + - uint64(in[5])*(uint64(in2[5])<<1) + - uint64(in[6])*(uint64(in2[4])<<0) + - uint64(in[7])*(uint64(in2[3])<<1) + - uint64(in[8])*(uint64(in2[2])<<0) - tmp[11] = uint64(in[3])*(uint64(in2[8])<<0) + - uint64(in[4])*(uint64(in2[7])<<0) + - uint64(in[5])*(uint64(in2[6])<<0) + - uint64(in[6])*(uint64(in2[5])<<0) + - uint64(in[7])*(uint64(in2[4])<<0) + - uint64(in[8])*(uint64(in2[3])<<0) - tmp[12] = uint64(in[4])*(uint64(in2[8])<<0) + - uint64(in[5])*(uint64(in2[7])<<1) + - uint64(in[6])*(uint64(in2[6])<<0) + - uint64(in[7])*(uint64(in2[5])<<1) + - uint64(in[8])*(uint64(in2[4])<<0) - tmp[13] = uint64(in[5])*(uint64(in2[8])<<0) + - uint64(in[6])*(uint64(in2[7])<<0) + - uint64(in[7])*(uint64(in2[6])<<0) + - uint64(in[8])*(uint64(in2[5])<<0) - tmp[14] = uint64(in[6])*(uint64(in2[8])<<0) + - uint64(in[7])*(uint64(in2[7])<<1) + - uint64(in[8])*(uint64(in2[6])<<0) - tmp[15] = uint64(in[7])*(uint64(in2[8])<<0) + - uint64(in[8])*(uint64(in2[7])<<0) - tmp[16] = uint64(in[8]) * (uint64(in2[8]) << 0) - - p256ReduceDegree(out, tmp) -} - -func p256Assign(out, in *[p256Limbs]uint32) { - *out = *in -} - -// p256Invert calculates |out| = |in|^{-1} -// -// Based on Fermat's Little Theorem: -// a^p = a (mod p) -// a^{p-1} = 1 (mod p) -// a^{p-2} = a^{-1} (mod p) -func p256Invert(out, in *[p256Limbs]uint32) { - var ftmp, ftmp2 [p256Limbs]uint32 - - // each e_I will hold |in|^{2^I - 1} - var e2, e4, e8, e16, e32, e64 [p256Limbs]uint32 - - p256Square(&ftmp, in) // 2^1 - p256Mul(&ftmp, in, &ftmp) // 2^2 - 2^0 - p256Assign(&e2, &ftmp) - p256Square(&ftmp, &ftmp) // 2^3 - 2^1 - p256Square(&ftmp, &ftmp) // 2^4 - 2^2 - p256Mul(&ftmp, &ftmp, &e2) // 2^4 - 2^0 - p256Assign(&e4, &ftmp) - p256Square(&ftmp, &ftmp) // 2^5 - 2^1 - p256Square(&ftmp, &ftmp) // 2^6 - 2^2 - p256Square(&ftmp, &ftmp) // 2^7 - 2^3 - p256Square(&ftmp, &ftmp) // 2^8 - 2^4 - p256Mul(&ftmp, &ftmp, &e4) // 2^8 - 2^0 - p256Assign(&e8, &ftmp) - for i := 0; i < 8; i++ { - p256Square(&ftmp, &ftmp) - } // 2^16 - 2^8 - p256Mul(&ftmp, &ftmp, &e8) // 2^16 - 2^0 - p256Assign(&e16, &ftmp) - for i := 0; i < 16; i++ { - p256Square(&ftmp, &ftmp) - } // 2^32 - 2^16 - p256Mul(&ftmp, &ftmp, &e16) // 2^32 - 2^0 - p256Assign(&e32, &ftmp) - for i := 0; i < 32; i++ { - p256Square(&ftmp, &ftmp) - } // 2^64 - 2^32 - p256Assign(&e64, &ftmp) - p256Mul(&ftmp, &ftmp, in) // 2^64 - 2^32 + 2^0 - for i := 0; i < 192; i++ { - p256Square(&ftmp, &ftmp) - } // 2^256 - 2^224 + 2^192 - - p256Mul(&ftmp2, &e64, &e32) // 2^64 - 2^0 - for i := 0; i < 16; i++ { - p256Square(&ftmp2, &ftmp2) - } // 2^80 - 2^16 - p256Mul(&ftmp2, &ftmp2, &e16) // 2^80 - 2^0 - for i := 0; i < 8; i++ { - p256Square(&ftmp2, &ftmp2) - } // 2^88 - 2^8 - p256Mul(&ftmp2, &ftmp2, &e8) // 2^88 - 2^0 - for i := 0; i < 4; i++ { - p256Square(&ftmp2, &ftmp2) - } // 2^92 - 2^4 - p256Mul(&ftmp2, &ftmp2, &e4) // 2^92 - 2^0 - p256Square(&ftmp2, &ftmp2) // 2^93 - 2^1 - p256Square(&ftmp2, &ftmp2) // 2^94 - 2^2 - p256Mul(&ftmp2, &ftmp2, &e2) // 2^94 - 2^0 - p256Square(&ftmp2, &ftmp2) // 2^95 - 2^1 - p256Square(&ftmp2, &ftmp2) // 2^96 - 2^2 - p256Mul(&ftmp2, &ftmp2, in) // 2^96 - 3 - - p256Mul(out, &ftmp2, &ftmp) // 2^256 - 2^224 + 2^192 + 2^96 - 3 -} - -// p256Scalar3 sets out=3*out. -// -// On entry: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Scalar3(out *[p256Limbs]uint32) { - var carry uint32 - - for i := 0; ; i++ { - out[i] *= 3 - out[i] += carry - carry = out[i] >> 29 - out[i] &= bottom29Bits - - i++ - if i == p256Limbs { - break - } - - out[i] *= 3 - out[i] += carry - carry = out[i] >> 28 - out[i] &= bottom28Bits - } - - p256ReduceCarry(out, carry) -} - -// p256Scalar4 sets out=4*out. -// -// On entry: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Scalar4(out *[p256Limbs]uint32) { - var carry, nextCarry uint32 - - for i := 0; ; i++ { - nextCarry = out[i] >> 27 - out[i] <<= 2 - out[i] &= bottom29Bits - out[i] += carry - carry = nextCarry + (out[i] >> 29) - out[i] &= bottom29Bits - - i++ - if i == p256Limbs { - break - } - nextCarry = out[i] >> 26 - out[i] <<= 2 - out[i] &= bottom28Bits - out[i] += carry - carry = nextCarry + (out[i] >> 28) - out[i] &= bottom28Bits - } - - p256ReduceCarry(out, carry) -} - -// p256Scalar8 sets out=8*out. -// -// On entry: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -// On exit: out[0,2,...] < 2**30, out[1,3,...] < 2**29. -func p256Scalar8(out *[p256Limbs]uint32) { - var carry, nextCarry uint32 - - for i := 0; ; i++ { - nextCarry = out[i] >> 26 - out[i] <<= 3 - out[i] &= bottom29Bits - out[i] += carry - carry = nextCarry + (out[i] >> 29) - out[i] &= bottom29Bits - - i++ - if i == p256Limbs { - break - } - nextCarry = out[i] >> 25 - out[i] <<= 3 - out[i] &= bottom28Bits - out[i] += carry - carry = nextCarry + (out[i] >> 28) - out[i] &= bottom28Bits - } - - p256ReduceCarry(out, carry) -} - -// Group operations: -// -// Elements of the elliptic curve group are represented in Jacobian -// coordinates: (x, y, z). An affine point (x', y') is x'=x/z**2, y'=y/z**3 in -// Jacobian form. - -// p256PointDouble sets {xOut,yOut,zOut} = 2*{x,y,z}. -// -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l -func p256PointDouble(xOut, yOut, zOut, x, y, z *[p256Limbs]uint32) { - var delta, gamma, alpha, beta, tmp, tmp2 [p256Limbs]uint32 - - p256Square(&delta, z) - p256Square(&gamma, y) - p256Mul(&beta, x, &gamma) - - p256Sum(&tmp, x, &delta) - p256Diff(&tmp2, x, &delta) - p256Mul(&alpha, &tmp, &tmp2) - p256Scalar3(&alpha) - - p256Sum(&tmp, y, z) - p256Square(&tmp, &tmp) - p256Diff(&tmp, &tmp, &gamma) - p256Diff(zOut, &tmp, &delta) - - p256Scalar4(&beta) - p256Square(xOut, &alpha) - p256Diff(xOut, xOut, &beta) - p256Diff(xOut, xOut, &beta) - - p256Diff(&tmp, &beta, xOut) - p256Mul(&tmp, &alpha, &tmp) - p256Square(&tmp2, &gamma) - p256Scalar8(&tmp2) - p256Diff(yOut, &tmp, &tmp2) -} - -// p256PointAddMixed sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,1}. -// (i.e. the second point is affine.) -// -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl -// -// Note that this function does not handle P+P, infinity+P nor P+infinity -// correctly. -func p256PointAddMixed(xOut, yOut, zOut, x1, y1, z1, x2, y2 *[p256Limbs]uint32) { - var z1z1, z1z1z1, s2, u2, h, i, j, r, rr, v, tmp [p256Limbs]uint32 - - p256Square(&z1z1, z1) - p256Sum(&tmp, z1, z1) - - p256Mul(&u2, x2, &z1z1) - p256Mul(&z1z1z1, z1, &z1z1) - p256Mul(&s2, y2, &z1z1z1) - p256Diff(&h, &u2, x1) - p256Sum(&i, &h, &h) - p256Square(&i, &i) - p256Mul(&j, &h, &i) - p256Diff(&r, &s2, y1) - p256Sum(&r, &r, &r) - p256Mul(&v, x1, &i) - - p256Mul(zOut, &tmp, &h) - p256Square(&rr, &r) - p256Diff(xOut, &rr, &j) - p256Diff(xOut, xOut, &v) - p256Diff(xOut, xOut, &v) - - p256Diff(&tmp, &v, xOut) - p256Mul(yOut, &tmp, &r) - p256Mul(&tmp, y1, &j) - p256Diff(yOut, yOut, &tmp) - p256Diff(yOut, yOut, &tmp) -} - -// p256PointAdd sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,z2}. -// -// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl -// -// Note that this function does not handle P+P, infinity+P nor P+infinity -// correctly. -func p256PointAdd(xOut, yOut, zOut, x1, y1, z1, x2, y2, z2 *[p256Limbs]uint32) { - var z1z1, z1z1z1, z2z2, z2z2z2, s1, s2, u1, u2, h, i, j, r, rr, v, tmp [p256Limbs]uint32 - - p256Square(&z1z1, z1) - p256Square(&z2z2, z2) - p256Mul(&u1, x1, &z2z2) - - p256Sum(&tmp, z1, z2) - p256Square(&tmp, &tmp) - p256Diff(&tmp, &tmp, &z1z1) - p256Diff(&tmp, &tmp, &z2z2) - - p256Mul(&z2z2z2, z2, &z2z2) - p256Mul(&s1, y1, &z2z2z2) - - p256Mul(&u2, x2, &z1z1) - p256Mul(&z1z1z1, z1, &z1z1) - p256Mul(&s2, y2, &z1z1z1) - p256Diff(&h, &u2, &u1) - p256Sum(&i, &h, &h) - p256Square(&i, &i) - p256Mul(&j, &h, &i) - p256Diff(&r, &s2, &s1) - p256Sum(&r, &r, &r) - p256Mul(&v, &u1, &i) - - p256Mul(zOut, &tmp, &h) - p256Square(&rr, &r) - p256Diff(xOut, &rr, &j) - p256Diff(xOut, xOut, &v) - p256Diff(xOut, xOut, &v) - - p256Diff(&tmp, &v, xOut) - p256Mul(yOut, &tmp, &r) - p256Mul(&tmp, &s1, &j) - p256Diff(yOut, yOut, &tmp) - p256Diff(yOut, yOut, &tmp) -} - -// p256CopyConditional sets out=in if mask = 0xffffffff in constant time. -// -// On entry: mask is either 0 or 0xffffffff. -func p256CopyConditional(out, in *[p256Limbs]uint32, mask uint32) { - for i := 0; i < p256Limbs; i++ { - tmp := mask & (in[i] ^ out[i]) - out[i] ^= tmp - } -} - -// p256SelectAffinePoint sets {out_x,out_y} to the index'th entry of table. -// On entry: index < 16, table[0] must be zero. -func p256SelectAffinePoint(xOut, yOut *[p256Limbs]uint32, table []uint32, index uint32) { - for i := range xOut { - xOut[i] = 0 - } - for i := range yOut { - yOut[i] = 0 - } - - for i := uint32(1); i < 16; i++ { - mask := i ^ index - mask |= mask >> 2 - mask |= mask >> 1 - mask &= 1 - mask-- - for j := range xOut { - xOut[j] |= table[0] & mask - table = table[1:] - } - for j := range yOut { - yOut[j] |= table[0] & mask - table = table[1:] - } - } -} - -// p256SelectJacobianPoint sets {out_x,out_y,out_z} to the index'th entry of -// table. -// On entry: index < 16, table[0] must be zero. -func p256SelectJacobianPoint(xOut, yOut, zOut *[p256Limbs]uint32, table *[16][3][p256Limbs]uint32, index uint32) { - for i := range xOut { - xOut[i] = 0 - } - for i := range yOut { - yOut[i] = 0 - } - for i := range zOut { - zOut[i] = 0 - } - - // The implicit value at index 0 is all zero. We don't need to perform that - // iteration of the loop because we already set out_* to zero. - for i := uint32(1); i < 16; i++ { - mask := i ^ index - mask |= mask >> 2 - mask |= mask >> 1 - mask &= 1 - mask-- - for j := range xOut { - xOut[j] |= table[i][0][j] & mask - } - for j := range yOut { - yOut[j] |= table[i][1][j] & mask - } - for j := range zOut { - zOut[j] |= table[i][2][j] & mask - } - } -} - -// p256GetBit returns the bit'th bit of scalar. -func p256GetBit(scalar *[32]uint8, bit uint) uint32 { - return uint32(((scalar[bit>>3]) >> (bit & 7)) & 1) -} - -// p256ScalarBaseMult sets {xOut,yOut,zOut} = scalar*G where scalar is a -// little-endian number. Note that the value of scalar must be less than the -// order of the group. -func p256ScalarBaseMult(xOut, yOut, zOut *[p256Limbs]uint32, scalar *[32]uint8) { - nIsInfinityMask := ^uint32(0) - var pIsNoninfiniteMask, mask, tableOffset uint32 - var px, py, tx, ty, tz [p256Limbs]uint32 - - for i := range xOut { - xOut[i] = 0 - } - for i := range yOut { - yOut[i] = 0 - } - for i := range zOut { - zOut[i] = 0 - } - - // The loop adds bits at positions 0, 64, 128 and 192, followed by - // positions 32,96,160 and 224 and does this 32 times. - for i := uint(0); i < 32; i++ { - if i != 0 { - p256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut) - } - tableOffset = 0 - for j := uint(0); j <= 32; j += 32 { - bit0 := p256GetBit(scalar, 31-i+j) - bit1 := p256GetBit(scalar, 95-i+j) - bit2 := p256GetBit(scalar, 159-i+j) - bit3 := p256GetBit(scalar, 223-i+j) - index := bit0 | (bit1 << 1) | (bit2 << 2) | (bit3 << 3) - - p256SelectAffinePoint(&px, &py, p256Precomputed[tableOffset:], index) - tableOffset += 30 * p256Limbs - - // Since scalar is less than the order of the group, we know that - // {xOut,yOut,zOut} != {px,py,1}, unless both are zero, which we handle - // below. - p256PointAddMixed(&tx, &ty, &tz, xOut, yOut, zOut, &px, &py) - // The result of pointAddMixed is incorrect if {xOut,yOut,zOut} is zero - // (a.k.a. the point at infinity). We handle that situation by - // copying the point from the table. - p256CopyConditional(xOut, &px, nIsInfinityMask) - p256CopyConditional(yOut, &py, nIsInfinityMask) - p256CopyConditional(zOut, &p256One, nIsInfinityMask) - - // Equally, the result is also wrong if the point from the table is - // zero, which happens when the index is zero. We handle that by - // only copying from {tx,ty,tz} to {xOut,yOut,zOut} if index != 0. - pIsNoninfiniteMask = nonZeroToAllOnes(index) - mask = pIsNoninfiniteMask & ^nIsInfinityMask - p256CopyConditional(xOut, &tx, mask) - p256CopyConditional(yOut, &ty, mask) - p256CopyConditional(zOut, &tz, mask) - // If p was not zero, then n is now non-zero. - nIsInfinityMask &= ^pIsNoninfiniteMask - } - } -} - -// p256PointToAffine converts a Jacobian point to an affine point. If the input -// is the point at infinity then it returns (0, 0) in constant time. -func p256PointToAffine(xOut, yOut, x, y, z *[p256Limbs]uint32) { - var zInv, zInvSq [p256Limbs]uint32 - - p256Invert(&zInv, z) - p256Square(&zInvSq, &zInv) - p256Mul(xOut, x, &zInvSq) - p256Mul(&zInv, &zInv, &zInvSq) - p256Mul(yOut, y, &zInv) -} - -// p256ToAffine returns a pair of *big.Int containing the affine representation -// of {x,y,z}. -func p256ToAffine(x, y, z *[p256Limbs]uint32) (xOut, yOut *big.Int) { - var xx, yy [p256Limbs]uint32 - p256PointToAffine(&xx, &yy, x, y, z) - return p256ToBig(&xx), p256ToBig(&yy) -} - -// p256ScalarMult sets {xOut,yOut,zOut} = scalar*{x,y}. -func p256ScalarMult(xOut, yOut, zOut, x, y *[p256Limbs]uint32, scalar *[32]uint8) { - var px, py, pz, tx, ty, tz [p256Limbs]uint32 - var precomp [16][3][p256Limbs]uint32 - var nIsInfinityMask, index, pIsNoninfiniteMask, mask uint32 - - // We precompute 0,1,2,... times {x,y}. - precomp[1][0] = *x - precomp[1][1] = *y - precomp[1][2] = p256One - - for i := 2; i < 16; i += 2 { - p256PointDouble(&precomp[i][0], &precomp[i][1], &precomp[i][2], &precomp[i/2][0], &precomp[i/2][1], &precomp[i/2][2]) - p256PointAddMixed(&precomp[i+1][0], &precomp[i+1][1], &precomp[i+1][2], &precomp[i][0], &precomp[i][1], &precomp[i][2], x, y) - } - - for i := range xOut { - xOut[i] = 0 - } - for i := range yOut { - yOut[i] = 0 - } - for i := range zOut { - zOut[i] = 0 - } - nIsInfinityMask = ^uint32(0) - - // We add in a window of four bits each iteration and do this 64 times. - for i := 0; i < 64; i++ { - if i != 0 { - p256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut) - p256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut) - p256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut) - p256PointDouble(xOut, yOut, zOut, xOut, yOut, zOut) - } - - index = uint32(scalar[31-i/2]) - if (i & 1) == 1 { - index &= 15 - } else { - index >>= 4 - } - - // See the comments in scalarBaseMult about handling infinities. - p256SelectJacobianPoint(&px, &py, &pz, &precomp, index) - p256PointAdd(&tx, &ty, &tz, xOut, yOut, zOut, &px, &py, &pz) - p256CopyConditional(xOut, &px, nIsInfinityMask) - p256CopyConditional(yOut, &py, nIsInfinityMask) - p256CopyConditional(zOut, &pz, nIsInfinityMask) - - pIsNoninfiniteMask = nonZeroToAllOnes(index) - mask = pIsNoninfiniteMask & ^nIsInfinityMask - p256CopyConditional(xOut, &tx, mask) - p256CopyConditional(yOut, &ty, mask) - p256CopyConditional(zOut, &tz, mask) - nIsInfinityMask &= ^pIsNoninfiniteMask - } -} - -// p256FromBig sets out = R*in. -func p256FromBig(out *[p256Limbs]uint32, in *big.Int) { - tmp := new(big.Int).Lsh(in, 257) - tmp.Mod(tmp, p256.P) - - for i := 0; i < p256Limbs; i++ { - if bits := tmp.Bits(); len(bits) > 0 { - out[i] = uint32(bits[0]) & bottom29Bits - } else { - out[i] = 0 - } - tmp.Rsh(tmp, 29) - - i++ - if i == p256Limbs { - break - } - - if bits := tmp.Bits(); len(bits) > 0 { - out[i] = uint32(bits[0]) & bottom28Bits - } else { - out[i] = 0 - } - tmp.Rsh(tmp, 28) - } -} - -// p256ToBig returns a *big.Int containing the value of in. -func p256ToBig(in *[p256Limbs]uint32) *big.Int { - result, tmp := new(big.Int), new(big.Int) - - result.SetInt64(int64(in[p256Limbs-1])) - for i := p256Limbs - 2; i >= 0; i-- { - if (i & 1) == 0 { - result.Lsh(result, 29) - } else { - result.Lsh(result, 28) - } - tmp.SetInt64(int64(in[i])) - result.Add(result, tmp) - } - - result.Mul(result, p256RInverse) - result.Mod(result, p256.P) - return result -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac.go b/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac.go deleted file mode 100644 index e0cc1d6d2241331c02f2fd489e4c5efff5fb2c52..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac.go +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package hmac implements the Keyed-Hash Message Authentication Code (HMAC) as -defined in U.S. Federal Information Processing Standards Publication 198. -An HMAC is a cryptographic hash that uses a key to sign a message. -The receiver verifies the hash by recomputing it using the same key. - -Receivers should be careful to use Equal to compare MACs in order to avoid -timing side-channels: - - // CheckMAC reports whether messageMAC is a valid HMAC tag for message. - func CheckMAC(message, messageMAC, key []byte) bool { - mac := hmac.New(sha256.New, key) - mac.Write(message) - expectedMAC := mac.Sum(nil) - return hmac.Equal(messageMAC, expectedMAC) - } -*/ -package hmac - -import ( - "crypto/subtle" - "hash" -) - -// FIPS 198: -// http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf - -// key is zero padded to the block size of the hash function -// ipad = 0x36 byte repeated for key length -// opad = 0x5c byte repeated for key length -// hmac = H([key ^ opad] H([key ^ ipad] text)) - -type hmac struct { - size int - blocksize int - key, tmp []byte - outer, inner hash.Hash -} - -func (h *hmac) tmpPad(xor byte) { - for i, k := range h.key { - h.tmp[i] = xor ^ k - } - for i := len(h.key); i < h.blocksize; i++ { - h.tmp[i] = xor - } -} - -func (h *hmac) Sum(in []byte) []byte { - origLen := len(in) - in = h.inner.Sum(in) - h.tmpPad(0x5c) - copy(h.tmp[h.blocksize:], in[origLen:]) - h.outer.Reset() - h.outer.Write(h.tmp) - return h.outer.Sum(in[:origLen]) -} - -func (h *hmac) Write(p []byte) (n int, err error) { - return h.inner.Write(p) -} - -func (h *hmac) Size() int { return h.size } - -func (h *hmac) BlockSize() int { return h.blocksize } - -func (h *hmac) Reset() { - h.inner.Reset() - h.tmpPad(0x36) - h.inner.Write(h.tmp[:h.blocksize]) -} - -// New returns a new HMAC hash using the given hash.Hash type and key. -func New(h func() hash.Hash, key []byte) hash.Hash { - hm := new(hmac) - hm.outer = h() - hm.inner = h() - hm.size = hm.inner.Size() - hm.blocksize = hm.inner.BlockSize() - hm.tmp = make([]byte, hm.blocksize+hm.size) - if len(key) > hm.blocksize { - // If key is too big, hash it. - hm.outer.Write(key) - key = hm.outer.Sum(nil) - } - hm.key = make([]byte, len(key)) - copy(hm.key, key) - hm.Reset() - return hm -} - -// Equal compares two MACs for equality without leaking timing information. -func Equal(mac1, mac2 []byte) bool { - // We don't have to be constant time if the lengths of the MACs are - // different as that suggests that a completely different hash function - // was used. - return len(mac1) == len(mac2) && subtle.ConstantTimeCompare(mac1, mac2) == 1 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac_test.go deleted file mode 100644 index e80b7e0baa0d01faf99ac4c24ccba306f4ab7666..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/hmac/hmac_test.go +++ /dev/null @@ -1,570 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hmac - -import ( - "crypto/md5" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "fmt" - "hash" - "testing" -) - -type hmacTest struct { - hash func() hash.Hash - key []byte - in []byte - out string - size int - blocksize int -} - -var hmacTests = []hmacTest{ - // Tests from US FIPS 198 - // http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf - { - sha1.New, - []byte{ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - }, - []byte("Sample #1"), - "4f4ca3d5d68ba7cc0a1208c9c61e9c5da0403c0a", - sha1.Size, - sha1.BlockSize, - }, - { - sha1.New, - []byte{ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x41, 0x42, 0x43, - }, - []byte("Sample #2"), - "0922d3405faa3d194f82a45830737d5cc6c75d24", - sha1.Size, - sha1.BlockSize, - }, - { - sha1.New, - []byte{ - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, - }, - []byte("Sample #3"), - "bcf41eab8bb2d802f3d05caf7cb092ecf8d1a3aa", - sha1.Size, - sha1.BlockSize, - }, - - // Test from Plan 9. - { - md5.New, - []byte("Jefe"), - []byte("what do ya want for nothing?"), - "750c783e6ab0b503eaa86e310a5db738", - md5.Size, - md5.BlockSize, - }, - - // Tests from RFC 4231 - { - sha256.New, - []byte{ - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, - }, - []byte("Hi There"), - "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7", - sha256.Size, - sha256.BlockSize, - }, - { - sha256.New, - []byte("Jefe"), - []byte("what do ya want for nothing?"), - "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843", - sha256.Size, - sha256.BlockSize, - }, - { - sha256.New, - []byte{ - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, - }, - []byte{ - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, - }, - "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe", - sha256.Size, - sha256.BlockSize, - }, - { - sha256.New, - []byte{ - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19, - }, - []byte{ - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, - }, - "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b", - sha256.Size, - sha256.BlockSize, - }, - { - sha256.New, - []byte{ - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, - }, - []byte("Test Using Larger Than Block-Size Key - Hash Key First"), - "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54", - sha256.Size, - sha256.BlockSize, - }, - { - sha256.New, - []byte{ - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, - }, - []byte("This is a test using a larger than block-size key " + - "and a larger than block-size data. The key needs to " + - "be hashed before being used by the HMAC algorithm."), - "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2", - sha256.Size, - sha256.BlockSize, - }, - - // Tests from http://csrc.nist.gov/groups/ST/toolkit/examples.html - // (truncated tag tests are left out) - { - sha1.New, - []byte{ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - }, - []byte("Sample message for keylen=blocklen"), - "5fd596ee78d5553c8ff4e72d266dfd192366da29", - sha1.Size, - sha1.BlockSize, - }, - { - sha1.New, - []byte{ - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, - }, - []byte("Sample message for keylen= chunk { - aa, bb, cc, dd := a, b, c, d - - // This is a constant condition - it is not evaluated on each iteration. - if x86 { - // MD5 was designed so that x86 processors can just iterate - // over the block data directly as uint32s, and we generate - // less code and run 1.3x faster if we take advantage of that. - // My apologies. - X = (*[16]uint32)(unsafe.Pointer(&p[0])) - } else if littleEndian && uintptr(unsafe.Pointer(&p[0]))&(unsafe.Alignof(uint32(0))-1) == 0 { - X = (*[16]uint32)(unsafe.Pointer(&p[0])) - } else { - X = &xbuf - j := 0 - for i := 0; i < 16; i++ { - X[i&15] = uint32(p[j]) | uint32(p[j+1])<<8 | uint32(p[j+2])<<16 | uint32(p[j+3])<<24 - j += 4 - } - } - - {{if .Full}} - // Round 1. - {{range $i, $s := dup 4 .Shift1}} - {{index $.Table1 $i | printf "a += (((c^d)&b)^d) + X[%d] + %d" $i | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - {{rotate}} - {{end}} - - // Round 2. - {{range $i, $s := dup 4 .Shift2}} - {{index $.Table2 $i | printf "a += (((b^c)&d)^c) + X[(1+5*%d)&15] + %d" $i | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - {{rotate}} - {{end}} - - // Round 3. - {{range $i, $s := dup 4 .Shift3}} - {{index $.Table3 $i | printf "a += (b^c^d) + X[(5+3*%d)&15] + %d" $i | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - {{rotate}} - {{end}} - - // Round 4. - {{range $i, $s := dup 4 .Shift4}} - {{index $.Table4 $i | printf "a += (c^(b|^d)) + X[(7*%d)&15] + %d" $i | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - {{rotate}} - {{end}} - {{else}} - // Round 1. - for i := uint(0); i < 16; { - {{range $s := .Shift1}} - {{printf "a += (((c^d)&b)^d) + X[i&15] + t1[i&15]" | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - i++ - {{rotate}} - {{end}} - } - - // Round 2. - for i := uint(0); i < 16; { - {{range $s := .Shift2}} - {{printf "a += (((b^c)&d)^c) + X[(1+5*i)&15] + t2[i&15]" | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - i++ - {{rotate}} - {{end}} - } - - // Round 3. - for i := uint(0); i < 16; { - {{range $s := .Shift3}} - {{printf "a += (b^c^d) + X[(5+3*i)&15] + t3[i&15]" | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - i++ - {{rotate}} - {{end}} - } - - // Round 4. - for i := uint(0); i < 16; { - {{range $s := .Shift4}} - {{printf "a += (c^(b|^d)) + X[(7*i)&15] + t4[i&15]" | relabel}} - {{printf "a = a<<%d | a>>(32-%d) + b" $s $s | relabel}} - i++ - {{rotate}} - {{end}} - } - {{end}} - - a += aa - b += bb - c += cc - d += dd - - p = p[chunk:] - } - - dig.s[0] = a - dig.s[1] = b - dig.s[2] = c - dig.s[3] = d -} -` diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5.go b/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5.go deleted file mode 100644 index 8c50c6d0bfaa7db920a48988ae5af5ecff7dd411..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go -full -output md5block.go - -// Package md5 implements the MD5 hash algorithm as defined in RFC 1321. -package md5 - -import ( - "crypto" - "hash" -) - -func init() { - crypto.RegisterHash(crypto.MD5, New) -} - -// The size of an MD5 checksum in bytes. -const Size = 16 - -// The blocksize of MD5 in bytes. -const BlockSize = 64 - -const ( - chunk = 64 - init0 = 0x67452301 - init1 = 0xEFCDAB89 - init2 = 0x98BADCFE - init3 = 0x10325476 -) - -// digest represents the partial evaluation of a checksum. -type digest struct { - s [4]uint32 - x [chunk]byte - nx int - len uint64 -} - -func (d *digest) Reset() { - d.s[0] = init0 - d.s[1] = init1 - d.s[2] = init2 - d.s[3] = init3 - d.nx = 0 - d.len = 0 -} - -// New returns a new hash.Hash computing the MD5 checksum. -func New() hash.Hash { - d := new(digest) - d.Reset() - return d -} - -func (d *digest) Size() int { return Size } - -func (d *digest) BlockSize() int { return BlockSize } - -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := len(p) - if n > chunk-d.nx { - n = chunk - d.nx - } - for i := 0; i < n; i++ { - d.x[d.nx+i] = p[i] - } - d.nx += n - if d.nx == chunk { - block(d, d.x[0:chunk]) - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - block(d, p[:n]) - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -func (d0 *digest) Sum(in []byte) []byte { - // Make a copy of d0 so that caller can keep writing and summing. - d := *d0 - hash := d.checkSum() - return append(in, hash[:]...) -} - -func (d *digest) checkSum() [Size]byte { - // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. - len := d.len - var tmp [64]byte - tmp[0] = 0x80 - if len%64 < 56 { - d.Write(tmp[0 : 56-len%64]) - } else { - d.Write(tmp[0 : 64+56-len%64]) - } - - // Length in bits. - len <<= 3 - for i := uint(0); i < 8; i++ { - tmp[i] = byte(len >> (8 * i)) - } - d.Write(tmp[0:8]) - - if d.nx != 0 { - panic("d.nx != 0") - } - - var digest [Size]byte - for i, s := range d.s { - digest[i*4] = byte(s) - digest[i*4+1] = byte(s >> 8) - digest[i*4+2] = byte(s >> 16) - digest[i*4+3] = byte(s >> 24) - } - - return digest -} - -// Sum returns the MD5 checksum of the data. -func Sum(data []byte) [Size]byte { - var d digest - d.Reset() - d.Write(data) - return d.checkSum() -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5_test.go deleted file mode 100644 index e7faf4961e43cce6c96c515bd38b39c0a874719d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5_test.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package md5 - -import ( - "crypto/rand" - "fmt" - "io" - "testing" - "unsafe" -) - -type md5Test struct { - out string - in string -} - -var golden = []md5Test{ - {"d41d8cd98f00b204e9800998ecf8427e", ""}, - {"0cc175b9c0f1b6a831c399e269772661", "a"}, - {"187ef4436122d1cc2f40dc2b92f0eba0", "ab"}, - {"900150983cd24fb0d6963f7d28e17f72", "abc"}, - {"e2fc714c4727ee9395f324cd2e7f331f", "abcd"}, - {"ab56b4d92b40713acc5af89985d4b786", "abcde"}, - {"e80b5017098950fc58aad83c8c14978e", "abcdef"}, - {"7ac66c0f148de9519b8bd264312c4d64", "abcdefg"}, - {"e8dc4081b13434b45189a720b77b6818", "abcdefgh"}, - {"8aa99b1f439ff71293e95357bac6fd94", "abcdefghi"}, - {"a925576942e94b2ef57a066101b48876", "abcdefghij"}, - {"d747fc1719c7eacb84058196cfe56d57", "Discard medicine more than two years old."}, - {"bff2dcb37ef3a44ba43ab144768ca837", "He who has a shady past knows that nice guys finish last."}, - {"0441015ecb54a7342d017ed1bcfdbea5", "I wouldn't marry him with a ten foot pole."}, - {"9e3cac8e9e9757a60c3ea391130d3689", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, - {"a0f04459b031f916a59a35cc482dc039", "The days of the digital watch are numbered. -Tom Stoppard"}, - {"e7a48e0fe884faf31475d2a04b1362cc", "Nepal premier won't resign."}, - {"637d2fe925c07c113800509964fb0e06", "For every action there is an equal and opposite government program."}, - {"834a8d18d5c6562119cf4c7f5086cb71", "His money is twice tainted: 'taint yours and 'taint mine."}, - {"de3a4d2fd6c73ec2db2abad23b444281", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, - {"acf203f997e2cf74ea3aff86985aefaf", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, - {"e1c1384cb4d2221dfdd7c795a4222c9a", "size: a.out: bad magic"}, - {"c90f3ddecc54f34228c063d7525bf644", "The major problem is with sendmail. -Mark Horton"}, - {"cdf7ab6c1fd49bd9933c43f3ea5af185", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, - {"83bc85234942fc883c063cbd7f0ad5d0", "If the enemy is within range, then so are you."}, - {"277cbe255686b48dd7e8f389394d9299", "It's well we cannot hear the screams/That we create in others' dreams."}, - {"fd3fb0a7ffb8af16603f3d3af98f8e1f", "You remind me of a TV show, but that's all right: I watch it anyway."}, - {"469b13a78ebf297ecda64d4723655154", "C is as portable as Stonehedge!!"}, - {"63eb3a2f466410104731c4b037600110", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, - {"72c2ed7592debca1c90fc0100f931a2f", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, - {"132f7619d33b523b1d9e5bd8e0928355", "How can you write a big system without C++? -Paul Glick"}, -} - -func TestGolden(t *testing.T) { - for i := 0; i < len(golden); i++ { - g := golden[i] - s := fmt.Sprintf("%x", Sum([]byte(g.in))) - if s != g.out { - t.Fatalf("Sum function: md5(%s) = %s want %s", g.in, s, g.out) - } - c := New() - buf := make([]byte, len(g.in)+4) - for j := 0; j < 3+4; j++ { - if j < 2 { - io.WriteString(c, g.in) - } else if j == 2 { - io.WriteString(c, g.in[0:len(g.in)/2]) - c.Sum(nil) - io.WriteString(c, g.in[len(g.in)/2:]) - } else if j > 2 { - // test unaligned write - buf = buf[1:] - copy(buf, g.in) - c.Write(buf[:len(g.in)]) - } - s := fmt.Sprintf("%x", c.Sum(nil)) - if s != g.out { - t.Fatalf("md5[%d](%s) = %s want %s", j, g.in, s, g.out) - } - c.Reset() - } - } -} - -func TestLarge(t *testing.T) { - const N = 10000 - ok := "2bb571599a4180e1d542f76904adc3df" // md5sum of "0123456789" * 1000 - block := make([]byte, 10004) - c := New() - for offset := 0; offset < 4; offset++ { - for i := 0; i < N; i++ { - block[offset+i] = '0' + byte(i%10) - } - for blockSize := 10; blockSize <= N; blockSize *= 10 { - blocks := N / blockSize - b := block[offset : offset+blockSize] - c.Reset() - for i := 0; i < blocks; i++ { - c.Write(b) - } - s := fmt.Sprintf("%x", c.Sum(nil)) - if s != ok { - t.Fatalf("md5 TestLarge offset=%d, blockSize=%d = %s want %s", offset, blockSize, s, ok) - } - } - } -} - -// Tests that blockGeneric (pure Go) and block (in assembly for amd64, 386, arm) match. -func TestBlockGeneric(t *testing.T) { - gen, asm := New().(*digest), New().(*digest) - buf := make([]byte, BlockSize*20) // arbitrary factor - rand.Read(buf) - blockGeneric(gen, buf) - block(asm, buf) - if *gen != *asm { - t.Error("block and blockGeneric resulted in different states") - } -} - -var bench = New() -var buf = make([]byte, 8192+1) -var sum = make([]byte, bench.Size()) - -func benchmarkSize(b *testing.B, size int, unaligned bool) { - b.SetBytes(int64(size)) - buf := buf - if unaligned { - if uintptr(unsafe.Pointer(&buf[0]))&(unsafe.Alignof(uint32(0))-1) == 0 { - buf = buf[1:] - } - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - bench.Reset() - bench.Write(buf[:size]) - bench.Sum(sum[:0]) - } -} - -func BenchmarkHash8Bytes(b *testing.B) { - benchmarkSize(b, 8, false) -} - -func BenchmarkHash1K(b *testing.B) { - benchmarkSize(b, 1024, false) -} - -func BenchmarkHash8K(b *testing.B) { - benchmarkSize(b, 8192, false) -} - -func BenchmarkHash8BytesUnaligned(b *testing.B) { - benchmarkSize(b, 8, true) -} - -func BenchmarkHash1KUnaligned(b *testing.B) { - benchmarkSize(b, 1024, true) -} - -func BenchmarkHash8KUnaligned(b *testing.B) { - benchmarkSize(b, 8192, true) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block.go b/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block.go deleted file mode 100644 index 64e1e7c1efdb15e8c06dce73f87f1cedaccea99e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block.go +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// DO NOT EDIT. -// Generate with: go run gen.go -full -output md5block.go - -package md5 - -import ( - "runtime" - "unsafe" -) - -const x86 = runtime.GOARCH == "amd64" || runtime.GOARCH == "386" - -var littleEndian bool - -func init() { - x := uint32(0x04030201) - y := [4]byte{0x1, 0x2, 0x3, 0x4} - littleEndian = *(*[4]byte)(unsafe.Pointer(&x)) == y -} - -func blockGeneric(dig *digest, p []byte) { - a := dig.s[0] - b := dig.s[1] - c := dig.s[2] - d := dig.s[3] - var X *[16]uint32 - var xbuf [16]uint32 - for len(p) >= chunk { - aa, bb, cc, dd := a, b, c, d - - // This is a constant condition - it is not evaluated on each iteration. - if x86 { - // MD5 was designed so that x86 processors can just iterate - // over the block data directly as uint32s, and we generate - // less code and run 1.3x faster if we take advantage of that. - // My apologies. - X = (*[16]uint32)(unsafe.Pointer(&p[0])) - } else if littleEndian && uintptr(unsafe.Pointer(&p[0]))&(unsafe.Alignof(uint32(0))-1) == 0 { - X = (*[16]uint32)(unsafe.Pointer(&p[0])) - } else { - X = &xbuf - j := 0 - for i := 0; i < 16; i++ { - X[i&15] = uint32(p[j]) | uint32(p[j+1])<<8 | uint32(p[j+2])<<16 | uint32(p[j+3])<<24 - j += 4 - } - } - - // Round 1. - - a += (((c ^ d) & b) ^ d) + X[0] + 3614090360 - a = a<<7 | a>>(32-7) + b - - d += (((b ^ c) & a) ^ c) + X[1] + 3905402710 - d = d<<12 | d>>(32-12) + a - - c += (((a ^ b) & d) ^ b) + X[2] + 606105819 - c = c<<17 | c>>(32-17) + d - - b += (((d ^ a) & c) ^ a) + X[3] + 3250441966 - b = b<<22 | b>>(32-22) + c - - a += (((c ^ d) & b) ^ d) + X[4] + 4118548399 - a = a<<7 | a>>(32-7) + b - - d += (((b ^ c) & a) ^ c) + X[5] + 1200080426 - d = d<<12 | d>>(32-12) + a - - c += (((a ^ b) & d) ^ b) + X[6] + 2821735955 - c = c<<17 | c>>(32-17) + d - - b += (((d ^ a) & c) ^ a) + X[7] + 4249261313 - b = b<<22 | b>>(32-22) + c - - a += (((c ^ d) & b) ^ d) + X[8] + 1770035416 - a = a<<7 | a>>(32-7) + b - - d += (((b ^ c) & a) ^ c) + X[9] + 2336552879 - d = d<<12 | d>>(32-12) + a - - c += (((a ^ b) & d) ^ b) + X[10] + 4294925233 - c = c<<17 | c>>(32-17) + d - - b += (((d ^ a) & c) ^ a) + X[11] + 2304563134 - b = b<<22 | b>>(32-22) + c - - a += (((c ^ d) & b) ^ d) + X[12] + 1804603682 - a = a<<7 | a>>(32-7) + b - - d += (((b ^ c) & a) ^ c) + X[13] + 4254626195 - d = d<<12 | d>>(32-12) + a - - c += (((a ^ b) & d) ^ b) + X[14] + 2792965006 - c = c<<17 | c>>(32-17) + d - - b += (((d ^ a) & c) ^ a) + X[15] + 1236535329 - b = b<<22 | b>>(32-22) + c - - // Round 2. - - a += (((b ^ c) & d) ^ c) + X[(1+5*0)&15] + 4129170786 - a = a<<5 | a>>(32-5) + b - - d += (((a ^ b) & c) ^ b) + X[(1+5*1)&15] + 3225465664 - d = d<<9 | d>>(32-9) + a - - c += (((d ^ a) & b) ^ a) + X[(1+5*2)&15] + 643717713 - c = c<<14 | c>>(32-14) + d - - b += (((c ^ d) & a) ^ d) + X[(1+5*3)&15] + 3921069994 - b = b<<20 | b>>(32-20) + c - - a += (((b ^ c) & d) ^ c) + X[(1+5*4)&15] + 3593408605 - a = a<<5 | a>>(32-5) + b - - d += (((a ^ b) & c) ^ b) + X[(1+5*5)&15] + 38016083 - d = d<<9 | d>>(32-9) + a - - c += (((d ^ a) & b) ^ a) + X[(1+5*6)&15] + 3634488961 - c = c<<14 | c>>(32-14) + d - - b += (((c ^ d) & a) ^ d) + X[(1+5*7)&15] + 3889429448 - b = b<<20 | b>>(32-20) + c - - a += (((b ^ c) & d) ^ c) + X[(1+5*8)&15] + 568446438 - a = a<<5 | a>>(32-5) + b - - d += (((a ^ b) & c) ^ b) + X[(1+5*9)&15] + 3275163606 - d = d<<9 | d>>(32-9) + a - - c += (((d ^ a) & b) ^ a) + X[(1+5*10)&15] + 4107603335 - c = c<<14 | c>>(32-14) + d - - b += (((c ^ d) & a) ^ d) + X[(1+5*11)&15] + 1163531501 - b = b<<20 | b>>(32-20) + c - - a += (((b ^ c) & d) ^ c) + X[(1+5*12)&15] + 2850285829 - a = a<<5 | a>>(32-5) + b - - d += (((a ^ b) & c) ^ b) + X[(1+5*13)&15] + 4243563512 - d = d<<9 | d>>(32-9) + a - - c += (((d ^ a) & b) ^ a) + X[(1+5*14)&15] + 1735328473 - c = c<<14 | c>>(32-14) + d - - b += (((c ^ d) & a) ^ d) + X[(1+5*15)&15] + 2368359562 - b = b<<20 | b>>(32-20) + c - - // Round 3. - - a += (b ^ c ^ d) + X[(5+3*0)&15] + 4294588738 - a = a<<4 | a>>(32-4) + b - - d += (a ^ b ^ c) + X[(5+3*1)&15] + 2272392833 - d = d<<11 | d>>(32-11) + a - - c += (d ^ a ^ b) + X[(5+3*2)&15] + 1839030562 - c = c<<16 | c>>(32-16) + d - - b += (c ^ d ^ a) + X[(5+3*3)&15] + 4259657740 - b = b<<23 | b>>(32-23) + c - - a += (b ^ c ^ d) + X[(5+3*4)&15] + 2763975236 - a = a<<4 | a>>(32-4) + b - - d += (a ^ b ^ c) + X[(5+3*5)&15] + 1272893353 - d = d<<11 | d>>(32-11) + a - - c += (d ^ a ^ b) + X[(5+3*6)&15] + 4139469664 - c = c<<16 | c>>(32-16) + d - - b += (c ^ d ^ a) + X[(5+3*7)&15] + 3200236656 - b = b<<23 | b>>(32-23) + c - - a += (b ^ c ^ d) + X[(5+3*8)&15] + 681279174 - a = a<<4 | a>>(32-4) + b - - d += (a ^ b ^ c) + X[(5+3*9)&15] + 3936430074 - d = d<<11 | d>>(32-11) + a - - c += (d ^ a ^ b) + X[(5+3*10)&15] + 3572445317 - c = c<<16 | c>>(32-16) + d - - b += (c ^ d ^ a) + X[(5+3*11)&15] + 76029189 - b = b<<23 | b>>(32-23) + c - - a += (b ^ c ^ d) + X[(5+3*12)&15] + 3654602809 - a = a<<4 | a>>(32-4) + b - - d += (a ^ b ^ c) + X[(5+3*13)&15] + 3873151461 - d = d<<11 | d>>(32-11) + a - - c += (d ^ a ^ b) + X[(5+3*14)&15] + 530742520 - c = c<<16 | c>>(32-16) + d - - b += (c ^ d ^ a) + X[(5+3*15)&15] + 3299628645 - b = b<<23 | b>>(32-23) + c - - // Round 4. - - a += (c ^ (b | ^d)) + X[(7*0)&15] + 4096336452 - a = a<<6 | a>>(32-6) + b - - d += (b ^ (a | ^c)) + X[(7*1)&15] + 1126891415 - d = d<<10 | d>>(32-10) + a - - c += (a ^ (d | ^b)) + X[(7*2)&15] + 2878612391 - c = c<<15 | c>>(32-15) + d - - b += (d ^ (c | ^a)) + X[(7*3)&15] + 4237533241 - b = b<<21 | b>>(32-21) + c - - a += (c ^ (b | ^d)) + X[(7*4)&15] + 1700485571 - a = a<<6 | a>>(32-6) + b - - d += (b ^ (a | ^c)) + X[(7*5)&15] + 2399980690 - d = d<<10 | d>>(32-10) + a - - c += (a ^ (d | ^b)) + X[(7*6)&15] + 4293915773 - c = c<<15 | c>>(32-15) + d - - b += (d ^ (c | ^a)) + X[(7*7)&15] + 2240044497 - b = b<<21 | b>>(32-21) + c - - a += (c ^ (b | ^d)) + X[(7*8)&15] + 1873313359 - a = a<<6 | a>>(32-6) + b - - d += (b ^ (a | ^c)) + X[(7*9)&15] + 4264355552 - d = d<<10 | d>>(32-10) + a - - c += (a ^ (d | ^b)) + X[(7*10)&15] + 2734768916 - c = c<<15 | c>>(32-15) + d - - b += (d ^ (c | ^a)) + X[(7*11)&15] + 1309151649 - b = b<<21 | b>>(32-21) + c - - a += (c ^ (b | ^d)) + X[(7*12)&15] + 4149444226 - a = a<<6 | a>>(32-6) + b - - d += (b ^ (a | ^c)) + X[(7*13)&15] + 3174756917 - d = d<<10 | d>>(32-10) + a - - c += (a ^ (d | ^b)) + X[(7*14)&15] + 718787259 - c = c<<15 | c>>(32-15) + d - - b += (d ^ (c | ^a)) + X[(7*15)&15] + 3951481745 - b = b<<21 | b>>(32-21) + c - - a += aa - b += bb - c += cc - d += dd - - p = p[chunk:] - } - - dig.s[0] = a - dig.s[1] = b - dig.s[2] = c - dig.s[3] = d -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_decl.go b/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_decl.go deleted file mode 100644 index d7956a6d203ee753bd3197650cc6a1aab9b0bde7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_decl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 amd64p32 386 arm - -package md5 - -//go:noescape - -func block(dig *digest, p []byte) diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_generic.go b/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_generic.go deleted file mode 100644 index 263463e51cdc9cc538287e94e07474da5867ac82..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/md5/md5block_generic.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64,!amd64p32,!386,!arm - -package md5 - -var block = blockGeneric diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/eagain.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/eagain.go deleted file mode 100644 index 2c853d0a13455ed70e497f92a2de09a7e45b3d14..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/eagain.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris - -package rand - -import ( - "os" - "syscall" -) - -func init() { - isEAGAIN = unixIsEAGAIN -} - -// unixIsEAGAIN reports whether err is a syscall.EAGAIN wrapped in a PathError. -// See golang.org/issue/9205 -func unixIsEAGAIN(err error) bool { - if pe, ok := err.(*os.PathError); ok { - if errno, ok := pe.Err.(syscall.Errno); ok && errno == syscall.EAGAIN { - return true - } - } - return false -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand.go deleted file mode 100644 index ee32fa0bd67e52cffea909e36d7ba0eeeb1d2056..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package rand implements a cryptographically secure -// pseudorandom number generator. -package rand - -import "io" - -// Reader is a global, shared instance of a cryptographically -// strong pseudo-random generator. -// -// On Unix-like systems, Reader reads from /dev/urandom. -// On Linux, Reader uses getrandom(2) if available, /dev/urandom otherwise. -// On Windows systems, Reader uses the CryptGenRandom API. -var Reader io.Reader - -// Read is a helper function that calls Reader.Read using io.ReadFull. -// On return, n == len(b) if and only if err == nil. -func Read(b []byte) (n int, err error) { - return io.ReadFull(Reader, b) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_linux.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_linux.go deleted file mode 100644 index 7d6d9e8a09405860f33bc9d3d207b6489252d238..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_linux.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rand - -import ( - "internal/syscall/unix" - "sync" -) - -func init() { - altGetRandom = getRandomLinux -} - -var ( - once sync.Once - useSyscall bool -) - -func pickStrategy() { - // Test whether we should use the system call or /dev/urandom. - // We'll fall back to urandom if: - // - the kernel is too old (before 3.17) - // - the machine has no entropy available (early boot + no hardware - // entropy source?) and we want to avoid blocking later. - var buf [1]byte - n, err := unix.GetRandom(buf[:], unix.GRND_NONBLOCK) - useSyscall = n == 1 && err == nil -} - -func getRandomLinux(p []byte) (ok bool) { - once.Do(pickStrategy) - if !useSyscall { - return false - } - n, err := unix.GetRandom(p, 0) - return n == len(p) && err == nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_test.go deleted file mode 100644 index e46e61d374acb0ca2a4fdb79367752aa205ca900..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_test.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rand - -import ( - "bytes" - "compress/flate" - "io" - "testing" -) - -func TestRead(t *testing.T) { - var n int = 4e6 - if testing.Short() { - n = 1e5 - } - b := make([]byte, n) - n, err := io.ReadFull(Reader, b) - if n != len(b) || err != nil { - t.Fatalf("ReadFull(buf) = %d, %s", n, err) - } - - var z bytes.Buffer - f, _ := flate.NewWriter(&z, 5) - f.Write(b) - f.Close() - if z.Len() < len(b)*99/100 { - t.Fatalf("Compressed %d -> %d", len(b), z.Len()) - } -} - -func TestReadEmpty(t *testing.T) { - n, err := Reader.Read(make([]byte, 0)) - if n != 0 || err != nil { - t.Fatalf("Read(make([]byte, 0)) = %d, %v", n, err) - } - n, err = Reader.Read(nil) - if n != 0 || err != nil { - t.Fatalf("Read(nil) = %d, %v", n, err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_unix.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_unix.go deleted file mode 100644 index 75c36e05b34020f92e057fd2966f073cf0e40c74..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_unix.go +++ /dev/null @@ -1,163 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris - -// Unix cryptographically secure pseudorandom number -// generator. - -package rand - -import ( - "bufio" - "crypto/aes" - "crypto/cipher" - "io" - "os" - "runtime" - "sync" - "time" -) - -const urandomDevice = "/dev/urandom" - -// Easy implementation: read from /dev/urandom. -// This is sufficient on Linux, OS X, and FreeBSD. - -func init() { - if runtime.GOOS == "plan9" { - Reader = newReader(nil) - } else { - Reader = &devReader{name: urandomDevice} - } -} - -// A devReader satisfies reads by reading the file named name. -type devReader struct { - name string - f io.Reader - mu sync.Mutex -} - -// altGetRandom if non-nil specifies an OS-specific function to get -// urandom-style randomness. -var altGetRandom func([]byte) (ok bool) - -func (r *devReader) Read(b []byte) (n int, err error) { - if altGetRandom != nil && r.name == urandomDevice && altGetRandom(b) { - return len(b), nil - } - r.mu.Lock() - defer r.mu.Unlock() - if r.f == nil { - f, err := os.Open(r.name) - if f == nil { - return 0, err - } - if runtime.GOOS == "plan9" { - r.f = f - } else { - r.f = bufio.NewReader(hideAgainReader{f}) - } - } - return r.f.Read(b) -} - -var isEAGAIN func(error) bool // set by eagain.go on unix systems - -// hideAgainReader masks EAGAIN reads from /dev/urandom. -// See golang.org/issue/9205 -type hideAgainReader struct { - r io.Reader -} - -func (hr hideAgainReader) Read(p []byte) (n int, err error) { - n, err = hr.r.Read(p) - if err != nil && isEAGAIN != nil && isEAGAIN(err) { - err = nil - } - return -} - -// Alternate pseudo-random implementation for use on -// systems without a reliable /dev/urandom. - -// newReader returns a new pseudorandom generator that -// seeds itself by reading from entropy. If entropy == nil, -// the generator seeds itself by reading from the system's -// random number generator, typically /dev/random. -// The Read method on the returned reader always returns -// the full amount asked for, or else it returns an error. -// -// The generator uses the X9.31 algorithm with AES-128, -// reseeding after every 1 MB of generated data. -func newReader(entropy io.Reader) io.Reader { - if entropy == nil { - entropy = &devReader{name: "/dev/random"} - } - return &reader{entropy: entropy} -} - -type reader struct { - mu sync.Mutex - budget int // number of bytes that can be generated - cipher cipher.Block - entropy io.Reader - time, seed, dst, key [aes.BlockSize]byte -} - -func (r *reader) Read(b []byte) (n int, err error) { - r.mu.Lock() - defer r.mu.Unlock() - n = len(b) - - for len(b) > 0 { - if r.budget == 0 { - _, err := io.ReadFull(r.entropy, r.seed[0:]) - if err != nil { - return n - len(b), err - } - _, err = io.ReadFull(r.entropy, r.key[0:]) - if err != nil { - return n - len(b), err - } - r.cipher, err = aes.NewCipher(r.key[0:]) - if err != nil { - return n - len(b), err - } - r.budget = 1 << 20 // reseed after generating 1MB - } - r.budget -= aes.BlockSize - - // ANSI X9.31 (== X9.17) algorithm, but using AES in place of 3DES. - // - // single block: - // t = encrypt(time) - // dst = encrypt(t^seed) - // seed = encrypt(t^dst) - ns := time.Now().UnixNano() - r.time[0] = byte(ns >> 56) - r.time[1] = byte(ns >> 48) - r.time[2] = byte(ns >> 40) - r.time[3] = byte(ns >> 32) - r.time[4] = byte(ns >> 24) - r.time[5] = byte(ns >> 16) - r.time[6] = byte(ns >> 8) - r.time[7] = byte(ns) - r.cipher.Encrypt(r.time[0:], r.time[0:]) - for i := 0; i < aes.BlockSize; i++ { - r.dst[i] = r.time[i] ^ r.seed[i] - } - r.cipher.Encrypt(r.dst[0:], r.dst[0:]) - for i := 0; i < aes.BlockSize; i++ { - r.seed[i] = r.time[i] ^ r.dst[i] - } - r.cipher.Encrypt(r.seed[0:], r.seed[0:]) - - m := copy(b, r.dst[0:]) - b = b[m:] - } - - return n, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_windows.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_windows.go deleted file mode 100644 index 82b39b64a3c352e5f26e4d2bdc6e034a7b823a16..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/rand_windows.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Windows cryptographically secure pseudorandom number -// generator. - -package rand - -import ( - "os" - "sync" - "syscall" -) - -// Implemented by using Windows CryptoAPI 2.0. - -func init() { Reader = &rngReader{} } - -// A rngReader satisfies reads by reading from the Windows CryptGenRandom API. -type rngReader struct { - prov syscall.Handle - mu sync.Mutex -} - -func (r *rngReader) Read(b []byte) (n int, err error) { - r.mu.Lock() - if r.prov == 0 { - const provType = syscall.PROV_RSA_FULL - const flags = syscall.CRYPT_VERIFYCONTEXT | syscall.CRYPT_SILENT - err := syscall.CryptAcquireContext(&r.prov, nil, nil, provType, flags) - if err != nil { - r.mu.Unlock() - return 0, os.NewSyscallError("CryptAcquireContext", err) - } - } - r.mu.Unlock() - - if len(b) == 0 { - return 0, nil - } - err = syscall.CryptGenRandom(r.prov, uint32(len(b)), &b[0]) - if err != nil { - return 0, os.NewSyscallError("CryptGenRandom", err) - } - return len(b), nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rand/util.go b/llgo/third_party/gofrontend/libgo/go/crypto/rand/util.go deleted file mode 100644 index 5f74407850c55f161493c2f6f311090e5761d7e2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rand/util.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rand - -import ( - "errors" - "io" - "math/big" -) - -// smallPrimes is a list of small, prime numbers that allows us to rapidly -// exclude some fraction of composite candidates when searching for a random -// prime. This list is truncated at the point where smallPrimesProduct exceeds -// a uint64. It does not include two because we ensure that the candidates are -// odd by construction. -var smallPrimes = []uint8{ - 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, -} - -// smallPrimesProduct is the product of the values in smallPrimes and allows us -// to reduce a candidate prime by this number and then determine whether it's -// coprime to all the elements of smallPrimes without further big.Int -// operations. -var smallPrimesProduct = new(big.Int).SetUint64(16294579238595022365) - -// Prime returns a number, p, of the given size, such that p is prime -// with high probability. -// Prime will return error for any error returned by rand.Read or if bits < 2. -func Prime(rand io.Reader, bits int) (p *big.Int, err error) { - if bits < 2 { - err = errors.New("crypto/rand: prime size must be at least 2-bit") - return - } - - b := uint(bits % 8) - if b == 0 { - b = 8 - } - - bytes := make([]byte, (bits+7)/8) - p = new(big.Int) - - bigMod := new(big.Int) - - for { - _, err = io.ReadFull(rand, bytes) - if err != nil { - return nil, err - } - - // Clear bits in the first byte to make sure the candidate has a size <= bits. - bytes[0] &= uint8(int(1<= 2 { - bytes[0] |= 3 << (b - 2) - } else { - // Here b==1, because b cannot be zero. - bytes[0] |= 1 - if len(bytes) > 1 { - bytes[1] |= 0x80 - } - } - // Make the value odd since an even number this large certainly isn't prime. - bytes[len(bytes)-1] |= 1 - - p.SetBytes(bytes) - - // Calculate the value mod the product of smallPrimes. If it's - // a multiple of any of these primes we add two until it isn't. - // The probability of overflowing is minimal and can be ignored - // because we still perform Miller-Rabin tests on the result. - bigMod.Mod(p, smallPrimesProduct) - mod := bigMod.Uint64() - - NextDelta: - for delta := uint64(0); delta < 1<<20; delta += 2 { - m := mod + delta - for _, prime := range smallPrimes { - if m%uint64(prime) == 0 && (bits > 6 || m != uint64(prime)) { - continue NextDelta - } - } - - if delta > 0 { - bigMod.SetUint64(delta) - p.Add(p, bigMod) - } - break - } - - // There is a tiny possibility that, by adding delta, we caused - // the number to be one bit too long. Thus we check BitLen - // here. - if p.ProbablyPrime(20) && p.BitLen() == bits { - return - } - } -} - -// Int returns a uniform random value in [0, max). It panics if max <= 0. -func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) { - if max.Sign() <= 0 { - panic("crypto/rand: argument to Int is <= 0") - } - k := (max.BitLen() + 7) / 8 - - // b is the number of bits in the most significant byte of max. - b := uint(max.BitLen() % 8) - if b == 0 { - b = 8 - } - - bytes := make([]byte, k) - n = new(big.Int) - - for { - _, err = io.ReadFull(rand, bytes) - if err != nil { - return nil, err - } - - // Clear bits in the first byte to increase the probability - // that the candidate is < max. - bytes[0] &= uint8(int(1< 256 { - return nil, KeySizeError(k) - } - var c Cipher - for i := 0; i < 256; i++ { - c.s[i] = uint32(i) - } - var j uint8 = 0 - for i := 0; i < 256; i++ { - j += uint8(c.s[i]) + key[i%k] - c.s[i], c.s[j] = c.s[j], c.s[i] - } - return &c, nil -} - -// Reset zeros the key data so that it will no longer appear in the -// process's memory. -func (c *Cipher) Reset() { - for i := range c.s { - c.s[i] = 0 - } - c.i, c.j = 0, 0 -} - -// xorKeyStreamGeneric sets dst to the result of XORing src with the -// key stream. Dst and src may be the same slice but otherwise should -// not overlap. -// -// This is the pure Go version. rc4_{amd64,386,arm}* contain assembly -// implementations. This is here for tests and to prevent bitrot. -func (c *Cipher) xorKeyStreamGeneric(dst, src []byte) { - i, j := c.i, c.j - for k, v := range src { - i += 1 - j += uint8(c.s[i]) - c.s[i], c.s[j] = c.s[j], c.s[i] - dst[k] = v ^ uint8(c.s[uint8(c.s[i]+c.s[j])]) - } - c.i, c.j = i, j -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_asm.go b/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_asm.go deleted file mode 100644 index 02e5b67d55385f604a26711d206ed1e105a818ae..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_asm.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 amd64p32 arm,!nacl 386 - -package rc4 - -func xorKeyStream(dst, src *byte, n int, state *[256]uint32, i, j *uint8) - -// XORKeyStream sets dst to the result of XORing src with the key stream. -// Dst and src may be the same slice but otherwise should not overlap. -func (c *Cipher) XORKeyStream(dst, src []byte) { - if len(src) == 0 { - return - } - xorKeyStream(&dst[0], &src[0], len(src), &c.s, &c.i, &c.j) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_ref.go b/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_ref.go deleted file mode 100644 index e34bd34cf1df90d7719b20ded5ab87da1a92d3bc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_ref.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64,!amd64p32,!arm,!386 arm,nacl - -package rc4 - -// XORKeyStream sets dst to the result of XORing src with the key stream. -// Dst and src may be the same slice but otherwise should not overlap. -func (c *Cipher) XORKeyStream(dst, src []byte) { - c.xorKeyStreamGeneric(dst, src) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_test.go deleted file mode 100644 index af7988246329d5c4018db2506ebcfcb19427e071..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rc4/rc4_test.go +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rc4 - -import ( - "bytes" - "fmt" - "testing" -) - -type rc4Test struct { - key, keystream []byte -} - -var golden = []rc4Test{ - // Test vectors from the original cypherpunk posting of ARC4: - // http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1 - { - []byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, - []byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79}, - }, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a}, - }, - { - []byte{0xef, 0x01, 0x23, 0x45}, - []byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61}, - }, - - // Test vectors from the Wikipedia page: http://en.wikipedia.org/wiki/RC4 - { - []byte{0x4b, 0x65, 0x79}, - []byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19}, - }, - { - []byte{0x57, 0x69, 0x6b, 0x69}, - []byte{0x60, 0x44, 0xdb, 0x6d, 0x41, 0xb7}, - }, - { - []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - []byte{ - 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a, - 0x8a, 0x06, 0x1e, 0x67, 0x57, 0x6e, 0x92, 0x6d, - 0xc7, 0x1a, 0x7f, 0xa3, 0xf0, 0xcc, 0xeb, 0x97, - 0x45, 0x2b, 0x4d, 0x32, 0x27, 0x96, 0x5f, 0x9e, - 0xa8, 0xcc, 0x75, 0x07, 0x6d, 0x9f, 0xb9, 0xc5, - 0x41, 0x7a, 0xa5, 0xcb, 0x30, 0xfc, 0x22, 0x19, - 0x8b, 0x34, 0x98, 0x2d, 0xbb, 0x62, 0x9e, 0xc0, - 0x4b, 0x4f, 0x8b, 0x05, 0xa0, 0x71, 0x08, 0x50, - 0x92, 0xa0, 0xc3, 0x58, 0x4a, 0x48, 0xe4, 0xa3, - 0x0a, 0x39, 0x7b, 0x8a, 0xcd, 0x1d, 0x00, 0x9e, - 0xc8, 0x7d, 0x68, 0x11, 0xf2, 0x2c, 0xf4, 0x9c, - 0xa3, 0xe5, 0x93, 0x54, 0xb9, 0x45, 0x15, 0x35, - 0xa2, 0x18, 0x7a, 0x86, 0x42, 0x6c, 0xca, 0x7d, - 0x5e, 0x82, 0x3e, 0xba, 0x00, 0x44, 0x12, 0x67, - 0x12, 0x57, 0xb8, 0xd8, 0x60, 0xae, 0x4c, 0xbd, - 0x4c, 0x49, 0x06, 0xbb, 0xc5, 0x35, 0xef, 0xe1, - 0x58, 0x7f, 0x08, 0xdb, 0x33, 0x95, 0x5c, 0xdb, - 0xcb, 0xad, 0x9b, 0x10, 0xf5, 0x3f, 0xc4, 0xe5, - 0x2c, 0x59, 0x15, 0x65, 0x51, 0x84, 0x87, 0xfe, - 0x08, 0x4d, 0x0e, 0x3f, 0x03, 0xde, 0xbc, 0xc9, - 0xda, 0x1c, 0xe9, 0x0d, 0x08, 0x5c, 0x2d, 0x8a, - 0x19, 0xd8, 0x37, 0x30, 0x86, 0x16, 0x36, 0x92, - 0x14, 0x2b, 0xd8, 0xfc, 0x5d, 0x7a, 0x73, 0x49, - 0x6a, 0x8e, 0x59, 0xee, 0x7e, 0xcf, 0x6b, 0x94, - 0x06, 0x63, 0xf4, 0xa6, 0xbe, 0xe6, 0x5b, 0xd2, - 0xc8, 0x5c, 0x46, 0x98, 0x6c, 0x1b, 0xef, 0x34, - 0x90, 0xd3, 0x7b, 0x38, 0xda, 0x85, 0xd3, 0x2e, - 0x97, 0x39, 0xcb, 0x23, 0x4a, 0x2b, 0xe7, 0x40, - }, - }, -} - -func testEncrypt(t *testing.T, desc string, c *Cipher, src, expect []byte) { - dst := make([]byte, len(src)) - c.XORKeyStream(dst, src) - for i, v := range dst { - if v != expect[i] { - t.Fatalf("%s: mismatch at byte %d:\nhave %x\nwant %x", desc, i, dst, expect) - } - } -} - -func TestGolden(t *testing.T) { - for gi, g := range golden { - data := make([]byte, len(g.keystream)) - for i := range data { - data[i] = byte(i) - } - - expect := make([]byte, len(g.keystream)) - for i := range expect { - expect[i] = byte(i) ^ g.keystream[i] - } - - for size := 1; size <= len(g.keystream); size++ { - c, err := NewCipher(g.key) - if err != nil { - t.Fatalf("#%d: NewCipher: %v", gi, err) - } - - off := 0 - for off < len(g.keystream) { - n := len(g.keystream) - off - if n > size { - n = size - } - desc := fmt.Sprintf("#%d@[%d:%d]", gi, off, off+n) - testEncrypt(t, desc, c, data[off:off+n], expect[off:off+n]) - off += n - } - } - } -} - -func TestBlock(t *testing.T) { - testBlock(t, (*Cipher).XORKeyStream) -} - -// Test the pure Go version. -// Because we have assembly for amd64, 386, and arm, this prevents -// bitrot of the reference implementations. -func TestBlockGeneric(t *testing.T) { - testBlock(t, (*Cipher).xorKeyStreamGeneric) -} - -func testBlock(t *testing.T, xor func(c *Cipher, dst, src []byte)) { - c1a, _ := NewCipher(golden[0].key) - c1b, _ := NewCipher(golden[1].key) - data1 := make([]byte, 1<<20) - for i := range data1 { - xor(c1a, data1[i:i+1], data1[i:i+1]) - xor(c1b, data1[i:i+1], data1[i:i+1]) - } - - c2a, _ := NewCipher(golden[0].key) - c2b, _ := NewCipher(golden[1].key) - data2 := make([]byte, 1<<20) - xor(c2a, data2, data2) - xor(c2b, data2, data2) - - if !bytes.Equal(data1, data2) { - t.Fatalf("bad block") - } -} - -func benchmark(b *testing.B, size int64) { - buf := make([]byte, size) - c, err := NewCipher(golden[0].key) - if err != nil { - panic(err) - } - b.SetBytes(size) - - for i := 0; i < b.N; i++ { - c.XORKeyStream(buf, buf) - } -} - -func BenchmarkRC4_128(b *testing.B) { - benchmark(b, 128) -} - -func BenchmarkRC4_1K(b *testing.B) { - benchmark(b, 1024) -} - -func BenchmarkRC4_8K(b *testing.B) { - benchmark(b, 8096) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15.go deleted file mode 100644 index 34037b0d674f72a8d3ec89bba1aa1a3d6c2594e7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15.go +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rsa - -import ( - "crypto" - "crypto/subtle" - "errors" - "io" - "math/big" -) - -// This file implements encryption and decryption using PKCS#1 v1.5 padding. - -// PKCS1v15DecrypterOpts is for passing options to PKCS#1 v1.5 decryption using -// the crypto.Decrypter interface. -type PKCS1v15DecryptOptions struct { - // SessionKeyLen is the length of the session key that is being - // decrypted. If not zero, then a padding error during decryption will - // cause a random plaintext of this length to be returned rather than - // an error. These alternatives happen in constant time. - SessionKeyLen int -} - -// EncryptPKCS1v15 encrypts the given message with RSA and the padding scheme from PKCS#1 v1.5. -// The message must be no longer than the length of the public modulus minus 11 bytes. -// WARNING: use of this function to encrypt plaintexts other than session keys -// is dangerous. Use RSA OAEP in new protocols. -func EncryptPKCS1v15(rand io.Reader, pub *PublicKey, msg []byte) (out []byte, err error) { - if err := checkPub(pub); err != nil { - return nil, err - } - k := (pub.N.BitLen() + 7) / 8 - if len(msg) > k-11 { - err = ErrMessageTooLong - return - } - - // EM = 0x00 || 0x02 || PS || 0x00 || M - em := make([]byte, k) - em[1] = 2 - ps, mm := em[2:len(em)-len(msg)-1], em[len(em)-len(msg):] - err = nonZeroRandomBytes(ps, rand) - if err != nil { - return - } - em[len(em)-len(msg)-1] = 0 - copy(mm, msg) - - m := new(big.Int).SetBytes(em) - c := encrypt(new(big.Int), pub, m) - - copyWithLeftPad(em, c.Bytes()) - out = em - return -} - -// DecryptPKCS1v15 decrypts a plaintext using RSA and the padding scheme from PKCS#1 v1.5. -// If rand != nil, it uses RSA blinding to avoid timing side-channel attacks. -func DecryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (out []byte, err error) { - if err := checkPub(&priv.PublicKey); err != nil { - return nil, err - } - valid, out, index, err := decryptPKCS1v15(rand, priv, ciphertext) - if err != nil { - return - } - if valid == 0 { - return nil, ErrDecryption - } - out = out[index:] - return -} - -// DecryptPKCS1v15SessionKey decrypts a session key using RSA and the padding scheme from PKCS#1 v1.5. -// If rand != nil, it uses RSA blinding to avoid timing side-channel attacks. -// It returns an error if the ciphertext is the wrong length or if the -// ciphertext is greater than the public modulus. Otherwise, no error is -// returned. If the padding is valid, the resulting plaintext message is copied -// into key. Otherwise, key is unchanged. These alternatives occur in constant -// time. It is intended that the user of this function generate a random -// session key beforehand and continue the protocol with the resulting value. -// This will remove any possibility that an attacker can learn any information -// about the plaintext. -// See ``Chosen Ciphertext Attacks Against Protocols Based on the RSA -// Encryption Standard PKCS #1'', Daniel Bleichenbacher, Advances in Cryptology -// (Crypto '98). -func DecryptPKCS1v15SessionKey(rand io.Reader, priv *PrivateKey, ciphertext []byte, key []byte) (err error) { - if err := checkPub(&priv.PublicKey); err != nil { - return err - } - k := (priv.N.BitLen() + 7) / 8 - if k-(len(key)+3+8) < 0 { - return ErrDecryption - } - - valid, em, index, err := decryptPKCS1v15(rand, priv, ciphertext) - if err != nil { - return - } - - if len(em) != k { - // This should be impossible because decryptPKCS1v15 always - // returns the full slice. - return ErrDecryption - } - - valid &= subtle.ConstantTimeEq(int32(len(em)-index), int32(len(key))) - subtle.ConstantTimeCopy(valid, key, em[len(em)-len(key):]) - return -} - -// decryptPKCS1v15 decrypts ciphertext using priv and blinds the operation if -// rand is not nil. It returns one or zero in valid that indicates whether the -// plaintext was correctly structured. In either case, the plaintext is -// returned in em so that it may be read independently of whether it was valid -// in order to maintain constant memory access patterns. If the plaintext was -// valid then index contains the index of the original message in em. -func decryptPKCS1v15(rand io.Reader, priv *PrivateKey, ciphertext []byte) (valid int, em []byte, index int, err error) { - k := (priv.N.BitLen() + 7) / 8 - if k < 11 { - err = ErrDecryption - return - } - - c := new(big.Int).SetBytes(ciphertext) - m, err := decrypt(rand, priv, c) - if err != nil { - return - } - - em = leftPad(m.Bytes(), k) - firstByteIsZero := subtle.ConstantTimeByteEq(em[0], 0) - secondByteIsTwo := subtle.ConstantTimeByteEq(em[1], 2) - - // The remainder of the plaintext must be a string of non-zero random - // octets, followed by a 0, followed by the message. - // lookingForIndex: 1 iff we are still looking for the zero. - // index: the offset of the first zero byte. - lookingForIndex := 1 - - for i := 2; i < len(em); i++ { - equals0 := subtle.ConstantTimeByteEq(em[i], 0) - index = subtle.ConstantTimeSelect(lookingForIndex&equals0, i, index) - lookingForIndex = subtle.ConstantTimeSelect(equals0, 0, lookingForIndex) - } - - // The PS padding must be at least 8 bytes long, and it starts two - // bytes into em. - validPS := subtle.ConstantTimeLessOrEq(2+8, index) - - valid = firstByteIsZero & secondByteIsTwo & (^lookingForIndex & 1) & validPS - index = subtle.ConstantTimeSelect(valid, index+1, 0) - return valid, em, index, nil -} - -// nonZeroRandomBytes fills the given slice with non-zero random octets. -func nonZeroRandomBytes(s []byte, rand io.Reader) (err error) { - _, err = io.ReadFull(rand, s) - if err != nil { - return - } - - for i := 0; i < len(s); i++ { - for s[i] == 0 { - _, err = io.ReadFull(rand, s[i:i+1]) - if err != nil { - return - } - // In tests, the PRNG may return all zeros so we do - // this to break the loop. - s[i] ^= 0x42 - } - } - - return -} - -// These are ASN1 DER structures: -// DigestInfo ::= SEQUENCE { -// digestAlgorithm AlgorithmIdentifier, -// digest OCTET STRING -// } -// For performance, we don't use the generic ASN1 encoder. Rather, we -// precompute a prefix of the digest value that makes a valid ASN1 DER string -// with the correct contents. -var hashPrefixes = map[crypto.Hash][]byte{ - crypto.MD5: {0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10}, - crypto.SHA1: {0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14}, - crypto.SHA224: {0x30, 0x2d, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x04, 0x05, 0x00, 0x04, 0x1c}, - crypto.SHA256: {0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20}, - crypto.SHA384: {0x30, 0x41, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x02, 0x05, 0x00, 0x04, 0x30}, - crypto.SHA512: {0x30, 0x51, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x03, 0x05, 0x00, 0x04, 0x40}, - crypto.MD5SHA1: {}, // A special TLS case which doesn't use an ASN1 prefix. - crypto.RIPEMD160: {0x30, 0x20, 0x30, 0x08, 0x06, 0x06, 0x28, 0xcf, 0x06, 0x03, 0x00, 0x31, 0x04, 0x14}, -} - -// SignPKCS1v15 calculates the signature of hashed using RSASSA-PKCS1-V1_5-SIGN from RSA PKCS#1 v1.5. -// Note that hashed must be the result of hashing the input message using the -// given hash function. If hash is zero, hashed is signed directly. This isn't -// advisable except for interoperability. -func SignPKCS1v15(rand io.Reader, priv *PrivateKey, hash crypto.Hash, hashed []byte) (s []byte, err error) { - hashLen, prefix, err := pkcs1v15HashInfo(hash, len(hashed)) - if err != nil { - return - } - - tLen := len(prefix) + hashLen - k := (priv.N.BitLen() + 7) / 8 - if k < tLen+11 { - return nil, ErrMessageTooLong - } - - // EM = 0x00 || 0x01 || PS || 0x00 || T - em := make([]byte, k) - em[1] = 1 - for i := 2; i < k-tLen-1; i++ { - em[i] = 0xff - } - copy(em[k-tLen:k-hashLen], prefix) - copy(em[k-hashLen:k], hashed) - - m := new(big.Int).SetBytes(em) - c, err := decrypt(rand, priv, m) - if err != nil { - return - } - - copyWithLeftPad(em, c.Bytes()) - s = em - return -} - -// VerifyPKCS1v15 verifies an RSA PKCS#1 v1.5 signature. -// hashed is the result of hashing the input message using the given hash -// function and sig is the signature. A valid signature is indicated by -// returning a nil error. If hash is zero then hashed is used directly. This -// isn't advisable except for interoperability. -func VerifyPKCS1v15(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte) (err error) { - hashLen, prefix, err := pkcs1v15HashInfo(hash, len(hashed)) - if err != nil { - return - } - - tLen := len(prefix) + hashLen - k := (pub.N.BitLen() + 7) / 8 - if k < tLen+11 { - err = ErrVerification - return - } - - c := new(big.Int).SetBytes(sig) - m := encrypt(new(big.Int), pub, c) - em := leftPad(m.Bytes(), k) - // EM = 0x00 || 0x01 || PS || 0x00 || T - - ok := subtle.ConstantTimeByteEq(em[0], 0) - ok &= subtle.ConstantTimeByteEq(em[1], 1) - ok &= subtle.ConstantTimeCompare(em[k-hashLen:k], hashed) - ok &= subtle.ConstantTimeCompare(em[k-tLen:k-hashLen], prefix) - ok &= subtle.ConstantTimeByteEq(em[k-tLen-1], 0) - - for i := 2; i < k-tLen-1; i++ { - ok &= subtle.ConstantTimeByteEq(em[i], 0xff) - } - - if ok != 1 { - return ErrVerification - } - - return nil -} - -func pkcs1v15HashInfo(hash crypto.Hash, inLen int) (hashLen int, prefix []byte, err error) { - // Special case: crypto.Hash(0) is used to indicate that the data is - // signed directly. - if hash == 0 { - return inLen, nil, nil - } - - hashLen = hash.Size() - if inLen != hashLen { - return 0, nil, errors.New("crypto/rsa: input must be hashed message") - } - prefix, ok := hashPrefixes[hash] - if !ok { - return 0, nil, errors.New("crypto/rsa: unsupported hash function") - } - return -} - -// copyWithLeftPad copies src to the end of dest, padding with zero bytes as -// needed. -func copyWithLeftPad(dest, src []byte) { - numPaddingBytes := len(dest) - len(src) - for i := 0; i < numPaddingBytes; i++ { - dest[i] = 0 - } - copy(dest[numPaddingBytes:], src) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15_test.go deleted file mode 100644 index 89253751ec2696784ed4bf42d654a090a05d360f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pkcs1v15_test.go +++ /dev/null @@ -1,298 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rsa - -import ( - "bytes" - "crypto" - "crypto/rand" - "crypto/sha1" - "encoding/base64" - "encoding/hex" - "io" - "math/big" - "testing" - "testing/quick" -) - -func decodeBase64(in string) []byte { - out := make([]byte, base64.StdEncoding.DecodedLen(len(in))) - n, err := base64.StdEncoding.Decode(out, []byte(in)) - if err != nil { - return nil - } - return out[0:n] -} - -type DecryptPKCS1v15Test struct { - in, out string -} - -// These test vectors were generated with `openssl rsautl -pkcs -encrypt` -var decryptPKCS1v15Tests = []DecryptPKCS1v15Test{ - { - "gIcUIoVkD6ATMBk/u/nlCZCCWRKdkfjCgFdo35VpRXLduiKXhNz1XupLLzTXAybEq15juc+EgY5o0DHv/nt3yg==", - "x", - }, - { - "Y7TOCSqofGhkRb+jaVRLzK8xw2cSo1IVES19utzv6hwvx+M8kFsoWQm5DzBeJCZTCVDPkTpavUuEbgp8hnUGDw==", - "testing.", - }, - { - "arReP9DJtEVyV2Dg3dDp4c/PSk1O6lxkoJ8HcFupoRorBZG+7+1fDAwT1olNddFnQMjmkb8vxwmNMoTAT/BFjQ==", - "testing.\n", - }, - { - "WtaBXIoGC54+vH0NH0CHHE+dRDOsMc/6BrfFu2lEqcKL9+uDuWaf+Xj9mrbQCjjZcpQuX733zyok/jsnqe/Ftw==", - "01234567890123456789012345678901234567890123456789012", - }, -} - -func TestDecryptPKCS1v15(t *testing.T) { - decryptionFuncs := []func([]byte) ([]byte, error){ - func(ciphertext []byte) (plaintext []byte, err error) { - return DecryptPKCS1v15(nil, rsaPrivateKey, ciphertext) - }, - func(ciphertext []byte) (plaintext []byte, err error) { - return rsaPrivateKey.Decrypt(nil, ciphertext, nil) - }, - } - - for _, decryptFunc := range decryptionFuncs { - for i, test := range decryptPKCS1v15Tests { - out, err := decryptFunc(decodeBase64(test.in)) - if err != nil { - t.Errorf("#%d error decrypting", i) - } - want := []byte(test.out) - if !bytes.Equal(out, want) { - t.Errorf("#%d got:%#v want:%#v", i, out, want) - } - } - } -} - -func TestEncryptPKCS1v15(t *testing.T) { - random := rand.Reader - k := (rsaPrivateKey.N.BitLen() + 7) / 8 - - tryEncryptDecrypt := func(in []byte, blind bool) bool { - if len(in) > k-11 { - in = in[0 : k-11] - } - - ciphertext, err := EncryptPKCS1v15(random, &rsaPrivateKey.PublicKey, in) - if err != nil { - t.Errorf("error encrypting: %s", err) - return false - } - - var rand io.Reader - if !blind { - rand = nil - } else { - rand = random - } - plaintext, err := DecryptPKCS1v15(rand, rsaPrivateKey, ciphertext) - if err != nil { - t.Errorf("error decrypting: %s", err) - return false - } - - if !bytes.Equal(plaintext, in) { - t.Errorf("output mismatch: %#v %#v", plaintext, in) - return false - } - return true - } - - config := new(quick.Config) - if testing.Short() { - config.MaxCount = 10 - } - quick.Check(tryEncryptDecrypt, config) -} - -// These test vectors were generated with `openssl rsautl -pkcs -encrypt` -var decryptPKCS1v15SessionKeyTests = []DecryptPKCS1v15Test{ - { - "e6ukkae6Gykq0fKzYwULpZehX+UPXYzMoB5mHQUDEiclRbOTqas4Y0E6nwns1BBpdvEJcilhl5zsox/6DtGsYg==", - "1234", - }, - { - "Dtis4uk/q/LQGGqGk97P59K03hkCIVFMEFZRgVWOAAhxgYpCRG0MX2adptt92l67IqMki6iVQyyt0TtX3IdtEw==", - "FAIL", - }, - { - "LIyFyCYCptPxrvTxpol8F3M7ZivlMsf53zs0vHRAv+rDIh2YsHS69ePMoPMe3TkOMZ3NupiL3takPxIs1sK+dw==", - "abcd", - }, - { - "bafnobel46bKy76JzqU/RIVOH0uAYvzUtauKmIidKgM0sMlvobYVAVQPeUQ/oTGjbIZ1v/6Gyi5AO4DtHruGdw==", - "FAIL", - }, -} - -func TestEncryptPKCS1v15SessionKey(t *testing.T) { - for i, test := range decryptPKCS1v15SessionKeyTests { - key := []byte("FAIL") - err := DecryptPKCS1v15SessionKey(nil, rsaPrivateKey, decodeBase64(test.in), key) - if err != nil { - t.Errorf("#%d error decrypting", i) - } - want := []byte(test.out) - if !bytes.Equal(key, want) { - t.Errorf("#%d got:%#v want:%#v", i, key, want) - } - } -} - -func TestEncryptPKCS1v15DecrypterSessionKey(t *testing.T) { - for i, test := range decryptPKCS1v15SessionKeyTests { - plaintext, err := rsaPrivateKey.Decrypt(rand.Reader, decodeBase64(test.in), &PKCS1v15DecryptOptions{SessionKeyLen: 4}) - if err != nil { - t.Fatalf("#%d: error decrypting: %s", i, err) - } - if len(plaintext) != 4 { - t.Fatalf("#%d: incorrect length plaintext: got %d, want 4", i, len(plaintext)) - } - - if test.out != "FAIL" && !bytes.Equal(plaintext, []byte(test.out)) { - t.Errorf("#%d: incorrect plaintext: got %x, want %x", plaintext, test.out) - } - } -} - -func TestNonZeroRandomBytes(t *testing.T) { - random := rand.Reader - - b := make([]byte, 512) - err := nonZeroRandomBytes(b, random) - if err != nil { - t.Errorf("returned error: %s", err) - } - for _, b := range b { - if b == 0 { - t.Errorf("Zero octet found") - return - } - } -} - -type signPKCS1v15Test struct { - in, out string -} - -// These vectors have been tested with -// `openssl rsautl -verify -inkey pk -in signature | hexdump -C` -var signPKCS1v15Tests = []signPKCS1v15Test{ - {"Test.\n", "a4f3fa6ea93bcdd0c57be020c1193ecbfd6f200a3d95c409769b029578fa0e336ad9a347600e40d3ae823b8c7e6bad88cc07c1d54c3a1523cbbb6d58efc362ae"}, -} - -func TestSignPKCS1v15(t *testing.T) { - for i, test := range signPKCS1v15Tests { - h := sha1.New() - h.Write([]byte(test.in)) - digest := h.Sum(nil) - - s, err := SignPKCS1v15(nil, rsaPrivateKey, crypto.SHA1, digest) - if err != nil { - t.Errorf("#%d %s", i, err) - } - - expected, _ := hex.DecodeString(test.out) - if !bytes.Equal(s, expected) { - t.Errorf("#%d got: %x want: %x", i, s, expected) - } - } -} - -func TestVerifyPKCS1v15(t *testing.T) { - for i, test := range signPKCS1v15Tests { - h := sha1.New() - h.Write([]byte(test.in)) - digest := h.Sum(nil) - - sig, _ := hex.DecodeString(test.out) - - err := VerifyPKCS1v15(&rsaPrivateKey.PublicKey, crypto.SHA1, digest, sig) - if err != nil { - t.Errorf("#%d %s", i, err) - } - } -} - -func TestOverlongMessagePKCS1v15(t *testing.T) { - ciphertext := decodeBase64("fjOVdirUzFoLlukv80dBllMLjXythIf22feqPrNo0YoIjzyzyoMFiLjAc/Y4krkeZ11XFThIrEvw\nkRiZcCq5ng==") - _, err := DecryptPKCS1v15(nil, rsaPrivateKey, ciphertext) - if err == nil { - t.Error("RSA decrypted a message that was too long.") - } -} - -func TestUnpaddedSignature(t *testing.T) { - msg := []byte("Thu Dec 19 18:06:16 EST 2013\n") - // This base64 value was generated with: - // % echo Thu Dec 19 18:06:16 EST 2013 > /tmp/msg - // % openssl rsautl -sign -inkey key -out /tmp/sig -in /tmp/msg - // - // Where "key" contains the RSA private key given at the bottom of this - // file. - expectedSig := decodeBase64("pX4DR8azytjdQ1rtUiC040FjkepuQut5q2ZFX1pTjBrOVKNjgsCDyiJDGZTCNoh9qpXYbhl7iEym30BWWwuiZg==") - - sig, err := SignPKCS1v15(nil, rsaPrivateKey, crypto.Hash(0), msg) - if err != nil { - t.Fatalf("SignPKCS1v15 failed: %s", err) - } - if !bytes.Equal(sig, expectedSig) { - t.Fatalf("signature is not expected value: got %x, want %x", sig, expectedSig) - } - if err := VerifyPKCS1v15(&rsaPrivateKey.PublicKey, crypto.Hash(0), msg, sig); err != nil { - t.Fatalf("signature failed to verify: %s", err) - } -} - -func TestShortSessionKey(t *testing.T) { - // This tests that attempting to decrypt a session key where the - // ciphertext is too small doesn't run outside the array bounds. - ciphertext, err := EncryptPKCS1v15(rand.Reader, &rsaPrivateKey.PublicKey, []byte{1}) - if err != nil { - t.Fatalf("Failed to encrypt short message: %s", err) - } - - var key [32]byte - if err := DecryptPKCS1v15SessionKey(nil, rsaPrivateKey, ciphertext, key[:]); err != nil { - t.Fatalf("Failed to decrypt short message: %s", err) - } - - for _, v := range key { - if v != 0 { - t.Fatal("key was modified when ciphertext was invalid") - } - } -} - -// In order to generate new test vectors you'll need the PEM form of this key: -// -----BEGIN RSA PRIVATE KEY----- -// MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 -// fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu -// /ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu -// RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/ -// EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A -// IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS -// tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V -// -----END RSA PRIVATE KEY----- - -var rsaPrivateKey = &PrivateKey{ - PublicKey: PublicKey{ - N: fromBase10("9353930466774385905609975137998169297361893554149986716853295022578535724979677252958524466350471210367835187480748268864277464700638583474144061408845077"), - E: 65537, - }, - D: fromBase10("7266398431328116344057699379749222532279343923819063639497049039389899328538543087657733766554155839834519529439851673014800261285757759040931985506583861"), - Primes: []*big.Int{ - fromBase10("98920366548084643601728869055592650835572950932266967461790948584315647051443"), - fromBase10("94560208308847015747498523884063394671606671904944666360068158221458669711639"), - }, -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss.go deleted file mode 100644 index 0a41814a4b1e7c7a772f5ba3850068cefe88fbe9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss.go +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rsa - -// This file implements the PSS signature scheme [1]. -// -// [1] http://www.rsa.com/rsalabs/pkcs/files/h11300-wp-pkcs-1v2-2-rsa-cryptography-standard.pdf - -import ( - "bytes" - "crypto" - "errors" - "hash" - "io" - "math/big" -) - -func emsaPSSEncode(mHash []byte, emBits int, salt []byte, hash hash.Hash) ([]byte, error) { - // See [1], section 9.1.1 - hLen := hash.Size() - sLen := len(salt) - emLen := (emBits + 7) / 8 - - // 1. If the length of M is greater than the input limitation for the - // hash function (2^61 - 1 octets for SHA-1), output "message too - // long" and stop. - // - // 2. Let mHash = Hash(M), an octet string of length hLen. - - if len(mHash) != hLen { - return nil, errors.New("crypto/rsa: input must be hashed message") - } - - // 3. If emLen < hLen + sLen + 2, output "encoding error" and stop. - - if emLen < hLen+sLen+2 { - return nil, errors.New("crypto/rsa: encoding error") - } - - em := make([]byte, emLen) - db := em[:emLen-sLen-hLen-2+1+sLen] - h := em[emLen-sLen-hLen-2+1+sLen : emLen-1] - - // 4. Generate a random octet string salt of length sLen; if sLen = 0, - // then salt is the empty string. - // - // 5. Let - // M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt; - // - // M' is an octet string of length 8 + hLen + sLen with eight - // initial zero octets. - // - // 6. Let H = Hash(M'), an octet string of length hLen. - - var prefix [8]byte - - hash.Write(prefix[:]) - hash.Write(mHash) - hash.Write(salt) - - h = hash.Sum(h[:0]) - hash.Reset() - - // 7. Generate an octet string PS consisting of emLen - sLen - hLen - 2 - // zero octets. The length of PS may be 0. - // - // 8. Let DB = PS || 0x01 || salt; DB is an octet string of length - // emLen - hLen - 1. - - db[emLen-sLen-hLen-2] = 0x01 - copy(db[emLen-sLen-hLen-1:], salt) - - // 9. Let dbMask = MGF(H, emLen - hLen - 1). - // - // 10. Let maskedDB = DB \xor dbMask. - - mgf1XOR(db, hash, h) - - // 11. Set the leftmost 8 * emLen - emBits bits of the leftmost octet in - // maskedDB to zero. - - db[0] &= (0xFF >> uint(8*emLen-emBits)) - - // 12. Let EM = maskedDB || H || 0xbc. - em[emLen-1] = 0xBC - - // 13. Output EM. - return em, nil -} - -func emsaPSSVerify(mHash, em []byte, emBits, sLen int, hash hash.Hash) error { - // 1. If the length of M is greater than the input limitation for the - // hash function (2^61 - 1 octets for SHA-1), output "inconsistent" - // and stop. - // - // 2. Let mHash = Hash(M), an octet string of length hLen. - hLen := hash.Size() - if hLen != len(mHash) { - return ErrVerification - } - - // 3. If emLen < hLen + sLen + 2, output "inconsistent" and stop. - emLen := (emBits + 7) / 8 - if emLen < hLen+sLen+2 { - return ErrVerification - } - - // 4. If the rightmost octet of EM does not have hexadecimal value - // 0xbc, output "inconsistent" and stop. - if em[len(em)-1] != 0xBC { - return ErrVerification - } - - // 5. Let maskedDB be the leftmost emLen - hLen - 1 octets of EM, and - // let H be the next hLen octets. - db := em[:emLen-hLen-1] - h := em[emLen-hLen-1 : len(em)-1] - - // 6. If the leftmost 8 * emLen - emBits bits of the leftmost octet in - // maskedDB are not all equal to zero, output "inconsistent" and - // stop. - if em[0]&(0xFF<> uint(8*emLen-emBits)) - - if sLen == PSSSaltLengthAuto { - FindSaltLength: - for sLen = emLen - (hLen + 2); sLen >= 0; sLen-- { - switch db[emLen-hLen-sLen-2] { - case 1: - break FindSaltLength - case 0: - continue - default: - return ErrVerification - } - } - if sLen < 0 { - return ErrVerification - } - } else { - // 10. If the emLen - hLen - sLen - 2 leftmost octets of DB are not zero - // or if the octet at position emLen - hLen - sLen - 1 (the leftmost - // position is "position 1") does not have hexadecimal value 0x01, - // output "inconsistent" and stop. - for _, e := range db[:emLen-hLen-sLen-2] { - if e != 0x00 { - return ErrVerification - } - } - if db[emLen-hLen-sLen-2] != 0x01 { - return ErrVerification - } - } - - // 11. Let salt be the last sLen octets of DB. - salt := db[len(db)-sLen:] - - // 12. Let - // M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt ; - // M' is an octet string of length 8 + hLen + sLen with eight - // initial zero octets. - // - // 13. Let H' = Hash(M'), an octet string of length hLen. - var prefix [8]byte - hash.Write(prefix[:]) - hash.Write(mHash) - hash.Write(salt) - - h0 := hash.Sum(nil) - - // 14. If H = H', output "consistent." Otherwise, output "inconsistent." - if !bytes.Equal(h0, h) { - return ErrVerification - } - return nil -} - -// signPSSWithSalt calculates the signature of hashed using PSS [1] with specified salt. -// Note that hashed must be the result of hashing the input message using the -// given hash function. salt is a random sequence of bytes whose length will be -// later used to verify the signature. -func signPSSWithSalt(rand io.Reader, priv *PrivateKey, hash crypto.Hash, hashed, salt []byte) (s []byte, err error) { - nBits := priv.N.BitLen() - em, err := emsaPSSEncode(hashed, nBits-1, salt, hash.New()) - if err != nil { - return - } - m := new(big.Int).SetBytes(em) - c, err := decrypt(rand, priv, m) - if err != nil { - return - } - s = make([]byte, (nBits+7)/8) - copyWithLeftPad(s, c.Bytes()) - return -} - -const ( - // PSSSaltLengthAuto causes the salt in a PSS signature to be as large - // as possible when signing, and to be auto-detected when verifying. - PSSSaltLengthAuto = 0 - // PSSSaltLengthEqualsHash causes the salt length to equal the length - // of the hash used in the signature. - PSSSaltLengthEqualsHash = -1 -) - -// PSSOptions contains options for creating and verifying PSS signatures. -type PSSOptions struct { - // SaltLength controls the length of the salt used in the PSS - // signature. It can either be a number of bytes, or one of the special - // PSSSaltLength constants. - SaltLength int - - // Hash, if not zero, overrides the hash function passed to SignPSS. - // This is the only way to specify the hash function when using the - // crypto.Signer interface. - Hash crypto.Hash -} - -// HashFunc returns pssOpts.Hash so that PSSOptions implements -// crypto.SignerOpts. -func (pssOpts *PSSOptions) HashFunc() crypto.Hash { - return pssOpts.Hash -} - -func (opts *PSSOptions) saltLength() int { - if opts == nil { - return PSSSaltLengthAuto - } - return opts.SaltLength -} - -// SignPSS calculates the signature of hashed using RSASSA-PSS [1]. -// Note that hashed must be the result of hashing the input message using the -// given hash function. The opts argument may be nil, in which case sensible -// defaults are used. -func SignPSS(rand io.Reader, priv *PrivateKey, hash crypto.Hash, hashed []byte, opts *PSSOptions) (s []byte, err error) { - saltLength := opts.saltLength() - switch saltLength { - case PSSSaltLengthAuto: - saltLength = (priv.N.BitLen()+7)/8 - 2 - hash.Size() - case PSSSaltLengthEqualsHash: - saltLength = hash.Size() - } - - if opts != nil && opts.Hash != 0 { - hash = opts.Hash - } - - salt := make([]byte, saltLength) - if _, err = io.ReadFull(rand, salt); err != nil { - return - } - return signPSSWithSalt(rand, priv, hash, hashed, salt) -} - -// VerifyPSS verifies a PSS signature. -// hashed is the result of hashing the input message using the given hash -// function and sig is the signature. A valid signature is indicated by -// returning a nil error. The opts argument may be nil, in which case sensible -// defaults are used. -func VerifyPSS(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte, opts *PSSOptions) error { - return verifyPSS(pub, hash, hashed, sig, opts.saltLength()) -} - -// verifyPSS verifies a PSS signature with the given salt length. -func verifyPSS(pub *PublicKey, hash crypto.Hash, hashed []byte, sig []byte, saltLen int) error { - nBits := pub.N.BitLen() - if len(sig) != (nBits+7)/8 { - return ErrVerification - } - s := new(big.Int).SetBytes(sig) - m := encrypt(new(big.Int), pub, s) - emBits := nBits - 1 - emLen := (emBits + 7) / 8 - if emLen < len(m.Bytes()) { - return ErrVerification - } - em := make([]byte, emLen) - copyWithLeftPad(em, m.Bytes()) - if saltLen == PSSSaltLengthEqualsHash { - saltLen = hash.Size() - } - return emsaPSSVerify(hashed, em, emBits, saltLen, hash.New()) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss_test.go deleted file mode 100644 index cae24e58c6794ce5db502932f6504934bf4115cc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/pss_test.go +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rsa - -import ( - "bufio" - "bytes" - "compress/bzip2" - "crypto" - _ "crypto/md5" - "crypto/rand" - "crypto/sha1" - _ "crypto/sha256" - "encoding/hex" - "math/big" - "os" - "strconv" - "strings" - "testing" -) - -func TestEMSAPSS(t *testing.T) { - // Test vector in file pss-int.txt from: ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip - msg := []byte{ - 0x85, 0x9e, 0xef, 0x2f, 0xd7, 0x8a, 0xca, 0x00, 0x30, 0x8b, - 0xdc, 0x47, 0x11, 0x93, 0xbf, 0x55, 0xbf, 0x9d, 0x78, 0xdb, - 0x8f, 0x8a, 0x67, 0x2b, 0x48, 0x46, 0x34, 0xf3, 0xc9, 0xc2, - 0x6e, 0x64, 0x78, 0xae, 0x10, 0x26, 0x0f, 0xe0, 0xdd, 0x8c, - 0x08, 0x2e, 0x53, 0xa5, 0x29, 0x3a, 0xf2, 0x17, 0x3c, 0xd5, - 0x0c, 0x6d, 0x5d, 0x35, 0x4f, 0xeb, 0xf7, 0x8b, 0x26, 0x02, - 0x1c, 0x25, 0xc0, 0x27, 0x12, 0xe7, 0x8c, 0xd4, 0x69, 0x4c, - 0x9f, 0x46, 0x97, 0x77, 0xe4, 0x51, 0xe7, 0xf8, 0xe9, 0xe0, - 0x4c, 0xd3, 0x73, 0x9c, 0x6b, 0xbf, 0xed, 0xae, 0x48, 0x7f, - 0xb5, 0x56, 0x44, 0xe9, 0xca, 0x74, 0xff, 0x77, 0xa5, 0x3c, - 0xb7, 0x29, 0x80, 0x2f, 0x6e, 0xd4, 0xa5, 0xff, 0xa8, 0xba, - 0x15, 0x98, 0x90, 0xfc, - } - salt := []byte{ - 0xe3, 0xb5, 0xd5, 0xd0, 0x02, 0xc1, 0xbc, 0xe5, 0x0c, 0x2b, - 0x65, 0xef, 0x88, 0xa1, 0x88, 0xd8, 0x3b, 0xce, 0x7e, 0x61, - } - expected := []byte{ - 0x66, 0xe4, 0x67, 0x2e, 0x83, 0x6a, 0xd1, 0x21, 0xba, 0x24, - 0x4b, 0xed, 0x65, 0x76, 0xb8, 0x67, 0xd9, 0xa4, 0x47, 0xc2, - 0x8a, 0x6e, 0x66, 0xa5, 0xb8, 0x7d, 0xee, 0x7f, 0xbc, 0x7e, - 0x65, 0xaf, 0x50, 0x57, 0xf8, 0x6f, 0xae, 0x89, 0x84, 0xd9, - 0xba, 0x7f, 0x96, 0x9a, 0xd6, 0xfe, 0x02, 0xa4, 0xd7, 0x5f, - 0x74, 0x45, 0xfe, 0xfd, 0xd8, 0x5b, 0x6d, 0x3a, 0x47, 0x7c, - 0x28, 0xd2, 0x4b, 0xa1, 0xe3, 0x75, 0x6f, 0x79, 0x2d, 0xd1, - 0xdc, 0xe8, 0xca, 0x94, 0x44, 0x0e, 0xcb, 0x52, 0x79, 0xec, - 0xd3, 0x18, 0x3a, 0x31, 0x1f, 0xc8, 0x96, 0xda, 0x1c, 0xb3, - 0x93, 0x11, 0xaf, 0x37, 0xea, 0x4a, 0x75, 0xe2, 0x4b, 0xdb, - 0xfd, 0x5c, 0x1d, 0xa0, 0xde, 0x7c, 0xec, 0xdf, 0x1a, 0x89, - 0x6f, 0x9d, 0x8b, 0xc8, 0x16, 0xd9, 0x7c, 0xd7, 0xa2, 0xc4, - 0x3b, 0xad, 0x54, 0x6f, 0xbe, 0x8c, 0xfe, 0xbc, - } - - hash := sha1.New() - hash.Write(msg) - hashed := hash.Sum(nil) - - encoded, err := emsaPSSEncode(hashed, 1023, salt, sha1.New()) - if err != nil { - t.Errorf("Error from emsaPSSEncode: %s\n", err) - } - if !bytes.Equal(encoded, expected) { - t.Errorf("Bad encoding. got %x, want %x", encoded, expected) - } - - if err = emsaPSSVerify(hashed, encoded, 1023, len(salt), sha1.New()); err != nil { - t.Errorf("Bad verification: %s", err) - } -} - -// TestPSSGolden tests all the test vectors in pss-vect.txt from -// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip -func TestPSSGolden(t *testing.T) { - inFile, err := os.Open("testdata/pss-vect.txt.bz2") - if err != nil { - t.Fatalf("Failed to open input file: %s", err) - } - defer inFile.Close() - - // The pss-vect.txt file contains RSA keys and then a series of - // signatures. A goroutine is used to preprocess the input by merging - // lines, removing spaces in hex values and identifying the start of - // new keys and signature blocks. - const newKeyMarker = "START NEW KEY" - const newSignatureMarker = "START NEW SIGNATURE" - - values := make(chan string) - - go func() { - defer close(values) - scanner := bufio.NewScanner(bzip2.NewReader(inFile)) - var partialValue string - lastWasValue := true - - for scanner.Scan() { - line := scanner.Text() - switch { - case len(line) == 0: - if len(partialValue) > 0 { - values <- strings.Replace(partialValue, " ", "", -1) - partialValue = "" - lastWasValue = true - } - continue - case strings.HasPrefix(line, "# ======") && lastWasValue: - values <- newKeyMarker - lastWasValue = false - case strings.HasPrefix(line, "# ------") && lastWasValue: - values <- newSignatureMarker - lastWasValue = false - case strings.HasPrefix(line, "#"): - continue - default: - partialValue += line - } - } - if err := scanner.Err(); err != nil { - panic(err) - } - }() - - var key *PublicKey - var hashed []byte - hash := crypto.SHA1 - h := hash.New() - opts := &PSSOptions{ - SaltLength: PSSSaltLengthEqualsHash, - } - - for marker := range values { - switch marker { - case newKeyMarker: - key = new(PublicKey) - nHex, ok := <-values - if !ok { - continue - } - key.N = bigFromHex(nHex) - key.E = intFromHex(<-values) - // We don't care for d, p, q, dP, dQ or qInv. - for i := 0; i < 6; i++ { - <-values - } - case newSignatureMarker: - msg := fromHex(<-values) - <-values // skip salt - sig := fromHex(<-values) - - h.Reset() - h.Write(msg) - hashed = h.Sum(hashed[:0]) - - if err := VerifyPSS(key, hash, hashed, sig, opts); err != nil { - t.Error(err) - } - default: - t.Fatalf("unknown marker: " + marker) - } - } -} - -// TestPSSOpenSSL ensures that we can verify a PSS signature from OpenSSL with -// the default options. OpenSSL sets the salt length to be maximal. -func TestPSSOpenSSL(t *testing.T) { - hash := crypto.SHA256 - h := hash.New() - h.Write([]byte("testing")) - hashed := h.Sum(nil) - - // Generated with `echo -n testing | openssl dgst -sign key.pem -sigopt rsa_padding_mode:pss -sha256 > sig` - sig := []byte{ - 0x95, 0x59, 0x6f, 0xd3, 0x10, 0xa2, 0xe7, 0xa2, 0x92, 0x9d, - 0x4a, 0x07, 0x2e, 0x2b, 0x27, 0xcc, 0x06, 0xc2, 0x87, 0x2c, - 0x52, 0xf0, 0x4a, 0xcc, 0x05, 0x94, 0xf2, 0xc3, 0x2e, 0x20, - 0xd7, 0x3e, 0x66, 0x62, 0xb5, 0x95, 0x2b, 0xa3, 0x93, 0x9a, - 0x66, 0x64, 0x25, 0xe0, 0x74, 0x66, 0x8c, 0x3e, 0x92, 0xeb, - 0xc6, 0xe6, 0xc0, 0x44, 0xf3, 0xb4, 0xb4, 0x2e, 0x8c, 0x66, - 0x0a, 0x37, 0x9c, 0x69, - } - - if err := VerifyPSS(&rsaPrivateKey.PublicKey, hash, hashed, sig, nil); err != nil { - t.Error(err) - } -} - -func TestPSSNilOpts(t *testing.T) { - hash := crypto.SHA256 - h := hash.New() - h.Write([]byte("testing")) - hashed := h.Sum(nil) - - SignPSS(rand.Reader, rsaPrivateKey, hash, hashed, nil) -} - -func TestPSSSigning(t *testing.T) { - var saltLengthCombinations = []struct { - signSaltLength, verifySaltLength int - good bool - }{ - {PSSSaltLengthAuto, PSSSaltLengthAuto, true}, - {PSSSaltLengthEqualsHash, PSSSaltLengthAuto, true}, - {PSSSaltLengthEqualsHash, PSSSaltLengthEqualsHash, true}, - {PSSSaltLengthEqualsHash, 8, false}, - {PSSSaltLengthAuto, PSSSaltLengthEqualsHash, false}, - {8, 8, true}, - } - - hash := crypto.MD5 - h := hash.New() - h.Write([]byte("testing")) - hashed := h.Sum(nil) - var opts PSSOptions - - for i, test := range saltLengthCombinations { - opts.SaltLength = test.signSaltLength - sig, err := SignPSS(rand.Reader, rsaPrivateKey, hash, hashed, &opts) - if err != nil { - t.Errorf("#%d: error while signing: %s", i, err) - continue - } - - opts.SaltLength = test.verifySaltLength - err = VerifyPSS(&rsaPrivateKey.PublicKey, hash, hashed, sig, &opts) - if (err == nil) != test.good { - t.Errorf("#%d: bad result, wanted: %t, got: %s", i, test.good, err) - } - } -} - -func bigFromHex(hex string) *big.Int { - n, ok := new(big.Int).SetString(hex, 16) - if !ok { - panic("bad hex: " + hex) - } - return n -} - -func intFromHex(hex string) int { - i, err := strconv.ParseInt(hex, 16, 32) - if err != nil { - panic(err) - } - return int(i) -} - -func fromHex(hexStr string) []byte { - s, err := hex.DecodeString(hexStr) - if err != nil { - panic(err) - } - return s -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa.go deleted file mode 100644 index 1293b783679b143440aabb2d5a9e04a391273f46..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa.go +++ /dev/null @@ -1,592 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package rsa implements RSA encryption as specified in PKCS#1. -package rsa - -import ( - "crypto" - "crypto/rand" - "crypto/subtle" - "errors" - "hash" - "io" - "math/big" -) - -var bigZero = big.NewInt(0) -var bigOne = big.NewInt(1) - -// A PublicKey represents the public part of an RSA key. -type PublicKey struct { - N *big.Int // modulus - E int // public exponent -} - -// OAEPOptions is an interface for passing options to OAEP decryption using the -// crypto.Decrypter interface. -type OAEPOptions struct { - // Hash is the hash function that will be used when generating the mask. - Hash crypto.Hash - // Label is an arbitrary byte string that must be equal to the value - // used when encrypting. - Label []byte -} - -var ( - errPublicModulus = errors.New("crypto/rsa: missing public modulus") - errPublicExponentSmall = errors.New("crypto/rsa: public exponent too small") - errPublicExponentLarge = errors.New("crypto/rsa: public exponent too large") -) - -// checkPub sanity checks the public key before we use it. -// We require pub.E to fit into a 32-bit integer so that we -// do not have different behavior depending on whether -// int is 32 or 64 bits. See also -// http://www.imperialviolet.org/2012/03/16/rsae.html. -func checkPub(pub *PublicKey) error { - if pub.N == nil { - return errPublicModulus - } - if pub.E < 2 { - return errPublicExponentSmall - } - if pub.E > 1<<31-1 { - return errPublicExponentLarge - } - return nil -} - -// A PrivateKey represents an RSA key -type PrivateKey struct { - PublicKey // public part. - D *big.Int // private exponent - Primes []*big.Int // prime factors of N, has >= 2 elements. - - // Precomputed contains precomputed values that speed up private - // operations, if available. - Precomputed PrecomputedValues -} - -// Public returns the public key corresponding to priv. -func (priv *PrivateKey) Public() crypto.PublicKey { - return &priv.PublicKey -} - -// Sign signs msg with priv, reading randomness from rand. If opts is a -// *PSSOptions then the PSS algorithm will be used, otherwise PKCS#1 v1.5 will -// be used. This method is intended to support keys where the private part is -// kept in, for example, a hardware module. Common uses should use the Sign* -// functions in this package. -func (priv *PrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) { - if pssOpts, ok := opts.(*PSSOptions); ok { - return SignPSS(rand, priv, pssOpts.Hash, msg, pssOpts) - } - - return SignPKCS1v15(rand, priv, opts.HashFunc(), msg) -} - -// Decrypt decrypts ciphertext with priv. If opts is nil or of type -// *PKCS1v15DecryptOptions then PKCS#1 v1.5 decryption is performed. Otherwise -// opts must have type *OAEPOptions and OAEP decryption is done. -func (priv *PrivateKey) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.DecrypterOpts) (plaintext []byte, err error) { - if opts == nil { - return DecryptPKCS1v15(rand, priv, ciphertext) - } - - switch opts := opts.(type) { - case *OAEPOptions: - return DecryptOAEP(opts.Hash.New(), rand, priv, ciphertext, opts.Label) - - case *PKCS1v15DecryptOptions: - if l := opts.SessionKeyLen; l > 0 { - plaintext = make([]byte, l) - if _, err := io.ReadFull(rand, plaintext); err != nil { - return nil, err - } - if err := DecryptPKCS1v15SessionKey(rand, priv, ciphertext, plaintext); err != nil { - return nil, err - } - return plaintext, nil - } else { - return DecryptPKCS1v15(rand, priv, ciphertext) - } - - default: - return nil, errors.New("crypto/rsa: invalid options for Decrypt") - } -} - -type PrecomputedValues struct { - Dp, Dq *big.Int // D mod (P-1) (or mod Q-1) - Qinv *big.Int // Q^-1 mod P - - // CRTValues is used for the 3rd and subsequent primes. Due to a - // historical accident, the CRT for the first two primes is handled - // differently in PKCS#1 and interoperability is sufficiently - // important that we mirror this. - CRTValues []CRTValue -} - -// CRTValue contains the precomputed Chinese remainder theorem values. -type CRTValue struct { - Exp *big.Int // D mod (prime-1). - Coeff *big.Int // R·Coeff ≡ 1 mod Prime. - R *big.Int // product of primes prior to this (inc p and q). -} - -// Validate performs basic sanity checks on the key. -// It returns nil if the key is valid, or else an error describing a problem. -func (priv *PrivateKey) Validate() error { - if err := checkPub(&priv.PublicKey); err != nil { - return err - } - - // Check that Πprimes == n. - modulus := new(big.Int).Set(bigOne) - for _, prime := range priv.Primes { - // Any primes ≤ 1 will cause divide-by-zero panics later. - if prime.Cmp(bigOne) <= 0 { - return errors.New("crypto/rsa: invalid prime value") - } - modulus.Mul(modulus, prime) - } - if modulus.Cmp(priv.N) != 0 { - return errors.New("crypto/rsa: invalid modulus") - } - - // Check that de ≡ 1 mod p-1, for each prime. - // This implies that e is coprime to each p-1 as e has a multiplicative - // inverse. Therefore e is coprime to lcm(p-1,q-1,r-1,...) = - // exponent(ℤ/nℤ). It also implies that a^de ≡ a mod p as a^(p-1) ≡ 1 - // mod p. Thus a^de ≡ a mod n for all a coprime to n, as required. - congruence := new(big.Int) - de := new(big.Int).SetInt64(int64(priv.E)) - de.Mul(de, priv.D) - for _, prime := range priv.Primes { - pminus1 := new(big.Int).Sub(prime, bigOne) - congruence.Mod(de, pminus1) - if congruence.Cmp(bigOne) != 0 { - return errors.New("crypto/rsa: invalid exponents") - } - } - return nil -} - -// GenerateKey generates an RSA keypair of the given bit size using the -// random source random (for example, crypto/rand.Reader). -func GenerateKey(random io.Reader, bits int) (priv *PrivateKey, err error) { - return GenerateMultiPrimeKey(random, 2, bits) -} - -// GenerateMultiPrimeKey generates a multi-prime RSA keypair of the given bit -// size and the given random source, as suggested in [1]. Although the public -// keys are compatible (actually, indistinguishable) from the 2-prime case, -// the private keys are not. Thus it may not be possible to export multi-prime -// private keys in certain formats or to subsequently import them into other -// code. -// -// Table 1 in [2] suggests maximum numbers of primes for a given size. -// -// [1] US patent 4405829 (1972, expired) -// [2] http://www.cacr.math.uwaterloo.ca/techreports/2006/cacr2006-16.pdf -func GenerateMultiPrimeKey(random io.Reader, nprimes int, bits int) (priv *PrivateKey, err error) { - priv = new(PrivateKey) - priv.E = 65537 - - if nprimes < 2 { - return nil, errors.New("crypto/rsa: GenerateMultiPrimeKey: nprimes must be >= 2") - } - - primes := make([]*big.Int, nprimes) - -NextSetOfPrimes: - for { - todo := bits - // crypto/rand should set the top two bits in each prime. - // Thus each prime has the form - // p_i = 2^bitlen(p_i) × 0.11... (in base 2). - // And the product is: - // P = 2^todo × α - // where α is the product of nprimes numbers of the form 0.11... - // - // If α < 1/2 (which can happen for nprimes > 2), we need to - // shift todo to compensate for lost bits: the mean value of 0.11... - // is 7/8, so todo + shift - nprimes * log2(7/8) ~= bits - 1/2 - // will give good results. - if nprimes >= 7 { - todo += (nprimes - 2) / 5 - } - for i := 0; i < nprimes; i++ { - primes[i], err = rand.Prime(random, todo/(nprimes-i)) - if err != nil { - return nil, err - } - todo -= primes[i].BitLen() - } - - // Make sure that primes is pairwise unequal. - for i, prime := range primes { - for j := 0; j < i; j++ { - if prime.Cmp(primes[j]) == 0 { - continue NextSetOfPrimes - } - } - } - - n := new(big.Int).Set(bigOne) - totient := new(big.Int).Set(bigOne) - pminus1 := new(big.Int) - for _, prime := range primes { - n.Mul(n, prime) - pminus1.Sub(prime, bigOne) - totient.Mul(totient, pminus1) - } - if n.BitLen() != bits { - // This should never happen for nprimes == 2 because - // crypto/rand should set the top two bits in each prime. - // For nprimes > 2 we hope it does not happen often. - continue NextSetOfPrimes - } - - g := new(big.Int) - priv.D = new(big.Int) - y := new(big.Int) - e := big.NewInt(int64(priv.E)) - g.GCD(priv.D, y, e, totient) - - if g.Cmp(bigOne) == 0 { - if priv.D.Sign() < 0 { - priv.D.Add(priv.D, totient) - } - priv.Primes = primes - priv.N = n - - break - } - } - - priv.Precompute() - return -} - -// incCounter increments a four byte, big-endian counter. -func incCounter(c *[4]byte) { - if c[3]++; c[3] != 0 { - return - } - if c[2]++; c[2] != 0 { - return - } - if c[1]++; c[1] != 0 { - return - } - c[0]++ -} - -// mgf1XOR XORs the bytes in out with a mask generated using the MGF1 function -// specified in PKCS#1 v2.1. -func mgf1XOR(out []byte, hash hash.Hash, seed []byte) { - var counter [4]byte - var digest []byte - - done := 0 - for done < len(out) { - hash.Write(seed) - hash.Write(counter[0:4]) - digest = hash.Sum(digest[:0]) - hash.Reset() - - for i := 0; i < len(digest) && done < len(out); i++ { - out[done] ^= digest[i] - done++ - } - incCounter(&counter) - } -} - -// ErrMessageTooLong is returned when attempting to encrypt a message which is -// too large for the size of the public key. -var ErrMessageTooLong = errors.New("crypto/rsa: message too long for RSA public key size") - -func encrypt(c *big.Int, pub *PublicKey, m *big.Int) *big.Int { - e := big.NewInt(int64(pub.E)) - c.Exp(m, e, pub.N) - return c -} - -// EncryptOAEP encrypts the given message with RSA-OAEP. -// The message must be no longer than the length of the public modulus less -// twice the hash length plus 2. -func EncryptOAEP(hash hash.Hash, random io.Reader, pub *PublicKey, msg []byte, label []byte) (out []byte, err error) { - if err := checkPub(pub); err != nil { - return nil, err - } - hash.Reset() - k := (pub.N.BitLen() + 7) / 8 - if len(msg) > k-2*hash.Size()-2 { - err = ErrMessageTooLong - return - } - - hash.Write(label) - lHash := hash.Sum(nil) - hash.Reset() - - em := make([]byte, k) - seed := em[1 : 1+hash.Size()] - db := em[1+hash.Size():] - - copy(db[0:hash.Size()], lHash) - db[len(db)-len(msg)-1] = 1 - copy(db[len(db)-len(msg):], msg) - - _, err = io.ReadFull(random, seed) - if err != nil { - return - } - - mgf1XOR(db, hash, seed) - mgf1XOR(seed, hash, db) - - m := new(big.Int) - m.SetBytes(em) - c := encrypt(new(big.Int), pub, m) - out = c.Bytes() - - if len(out) < k { - // If the output is too small, we need to left-pad with zeros. - t := make([]byte, k) - copy(t[k-len(out):], out) - out = t - } - - return -} - -// ErrDecryption represents a failure to decrypt a message. -// It is deliberately vague to avoid adaptive attacks. -var ErrDecryption = errors.New("crypto/rsa: decryption error") - -// ErrVerification represents a failure to verify a signature. -// It is deliberately vague to avoid adaptive attacks. -var ErrVerification = errors.New("crypto/rsa: verification error") - -// modInverse returns ia, the inverse of a in the multiplicative group of prime -// order n. It requires that a be a member of the group (i.e. less than n). -func modInverse(a, n *big.Int) (ia *big.Int, ok bool) { - g := new(big.Int) - x := new(big.Int) - y := new(big.Int) - g.GCD(x, y, a, n) - if g.Cmp(bigOne) != 0 { - // In this case, a and n aren't coprime and we cannot calculate - // the inverse. This happens because the values of n are nearly - // prime (being the product of two primes) rather than truly - // prime. - return - } - - if x.Cmp(bigOne) < 0 { - // 0 is not the multiplicative inverse of any element so, if x - // < 1, then x is negative. - x.Add(x, n) - } - - return x, true -} - -// Precompute performs some calculations that speed up private key operations -// in the future. -func (priv *PrivateKey) Precompute() { - if priv.Precomputed.Dp != nil { - return - } - - priv.Precomputed.Dp = new(big.Int).Sub(priv.Primes[0], bigOne) - priv.Precomputed.Dp.Mod(priv.D, priv.Precomputed.Dp) - - priv.Precomputed.Dq = new(big.Int).Sub(priv.Primes[1], bigOne) - priv.Precomputed.Dq.Mod(priv.D, priv.Precomputed.Dq) - - priv.Precomputed.Qinv = new(big.Int).ModInverse(priv.Primes[1], priv.Primes[0]) - - r := new(big.Int).Mul(priv.Primes[0], priv.Primes[1]) - priv.Precomputed.CRTValues = make([]CRTValue, len(priv.Primes)-2) - for i := 2; i < len(priv.Primes); i++ { - prime := priv.Primes[i] - values := &priv.Precomputed.CRTValues[i-2] - - values.Exp = new(big.Int).Sub(prime, bigOne) - values.Exp.Mod(priv.D, values.Exp) - - values.R = new(big.Int).Set(r) - values.Coeff = new(big.Int).ModInverse(r, prime) - - r.Mul(r, prime) - } -} - -// decrypt performs an RSA decryption, resulting in a plaintext integer. If a -// random source is given, RSA blinding is used. -func decrypt(random io.Reader, priv *PrivateKey, c *big.Int) (m *big.Int, err error) { - // TODO(agl): can we get away with reusing blinds? - if c.Cmp(priv.N) > 0 { - err = ErrDecryption - return - } - - var ir *big.Int - if random != nil { - // Blinding enabled. Blinding involves multiplying c by r^e. - // Then the decryption operation performs (m^e * r^e)^d mod n - // which equals mr mod n. The factor of r can then be removed - // by multiplying by the multiplicative inverse of r. - - var r *big.Int - - for { - r, err = rand.Int(random, priv.N) - if err != nil { - return - } - if r.Cmp(bigZero) == 0 { - r = bigOne - } - var ok bool - ir, ok = modInverse(r, priv.N) - if ok { - break - } - } - bigE := big.NewInt(int64(priv.E)) - rpowe := new(big.Int).Exp(r, bigE, priv.N) - cCopy := new(big.Int).Set(c) - cCopy.Mul(cCopy, rpowe) - cCopy.Mod(cCopy, priv.N) - c = cCopy - } - - if priv.Precomputed.Dp == nil { - m = new(big.Int).Exp(c, priv.D, priv.N) - } else { - // We have the precalculated values needed for the CRT. - m = new(big.Int).Exp(c, priv.Precomputed.Dp, priv.Primes[0]) - m2 := new(big.Int).Exp(c, priv.Precomputed.Dq, priv.Primes[1]) - m.Sub(m, m2) - if m.Sign() < 0 { - m.Add(m, priv.Primes[0]) - } - m.Mul(m, priv.Precomputed.Qinv) - m.Mod(m, priv.Primes[0]) - m.Mul(m, priv.Primes[1]) - m.Add(m, m2) - - for i, values := range priv.Precomputed.CRTValues { - prime := priv.Primes[2+i] - m2.Exp(c, values.Exp, prime) - m2.Sub(m2, m) - m2.Mul(m2, values.Coeff) - m2.Mod(m2, prime) - if m2.Sign() < 0 { - m2.Add(m2, prime) - } - m2.Mul(m2, values.R) - m.Add(m, m2) - } - } - - if ir != nil { - // Unblind. - m.Mul(m, ir) - m.Mod(m, priv.N) - } - - return -} - -// DecryptOAEP decrypts ciphertext using RSA-OAEP. -// If random != nil, DecryptOAEP uses RSA blinding to avoid timing side-channel attacks. -func DecryptOAEP(hash hash.Hash, random io.Reader, priv *PrivateKey, ciphertext []byte, label []byte) (msg []byte, err error) { - if err := checkPub(&priv.PublicKey); err != nil { - return nil, err - } - k := (priv.N.BitLen() + 7) / 8 - if len(ciphertext) > k || - k < hash.Size()*2+2 { - err = ErrDecryption - return - } - - c := new(big.Int).SetBytes(ciphertext) - - m, err := decrypt(random, priv, c) - if err != nil { - return - } - - hash.Write(label) - lHash := hash.Sum(nil) - hash.Reset() - - // Converting the plaintext number to bytes will strip any - // leading zeros so we may have to left pad. We do this unconditionally - // to avoid leaking timing information. (Although we still probably - // leak the number of leading zeros. It's not clear that we can do - // anything about this.) - em := leftPad(m.Bytes(), k) - - firstByteIsZero := subtle.ConstantTimeByteEq(em[0], 0) - - seed := em[1 : hash.Size()+1] - db := em[hash.Size()+1:] - - mgf1XOR(seed, hash, db) - mgf1XOR(db, hash, seed) - - lHash2 := db[0:hash.Size()] - - // We have to validate the plaintext in constant time in order to avoid - // attacks like: J. Manger. A Chosen Ciphertext Attack on RSA Optimal - // Asymmetric Encryption Padding (OAEP) as Standardized in PKCS #1 - // v2.0. In J. Kilian, editor, Advances in Cryptology. - lHash2Good := subtle.ConstantTimeCompare(lHash, lHash2) - - // The remainder of the plaintext must be zero or more 0x00, followed - // by 0x01, followed by the message. - // lookingForIndex: 1 iff we are still looking for the 0x01 - // index: the offset of the first 0x01 byte - // invalid: 1 iff we saw a non-zero byte before the 0x01. - var lookingForIndex, index, invalid int - lookingForIndex = 1 - rest := db[hash.Size():] - - for i := 0; i < len(rest); i++ { - equals0 := subtle.ConstantTimeByteEq(rest[i], 0) - equals1 := subtle.ConstantTimeByteEq(rest[i], 1) - index = subtle.ConstantTimeSelect(lookingForIndex&equals1, i, index) - lookingForIndex = subtle.ConstantTimeSelect(equals1, 0, lookingForIndex) - invalid = subtle.ConstantTimeSelect(lookingForIndex&^equals0, 1, invalid) - } - - if firstByteIsZero&lHash2Good&^invalid&^lookingForIndex != 1 { - err = ErrDecryption - return - } - - msg = rest[index+1:] - return -} - -// leftPad returns a new slice of length size. The contents of input are right -// aligned in the new slice. -func leftPad(input []byte, size int) (out []byte) { - n := len(input) - if n > size { - n = size - } - out = make([]byte, size) - copy(out[len(out)-n:], input) - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa_test.go deleted file mode 100644 index 4ee1c3a8b2afc6e4be23c041f7b40629a61c1e1b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/rsa_test.go +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package rsa - -import ( - "bytes" - "crypto/rand" - "crypto/sha1" - "math/big" - "testing" -) - -func TestKeyGeneration(t *testing.T) { - size := 1024 - if testing.Short() { - size = 128 - } - priv, err := GenerateKey(rand.Reader, size) - if err != nil { - t.Errorf("failed to generate key") - } - if bits := priv.N.BitLen(); bits != size { - t.Errorf("key too short (%d vs %d)", bits, size) - } - testKeyBasics(t, priv) -} - -func Test3PrimeKeyGeneration(t *testing.T) { - size := 768 - if testing.Short() { - size = 256 - } - - priv, err := GenerateMultiPrimeKey(rand.Reader, 3, size) - if err != nil { - t.Errorf("failed to generate key") - } - testKeyBasics(t, priv) -} - -func Test4PrimeKeyGeneration(t *testing.T) { - size := 768 - if testing.Short() { - size = 256 - } - - priv, err := GenerateMultiPrimeKey(rand.Reader, 4, size) - if err != nil { - t.Errorf("failed to generate key") - } - testKeyBasics(t, priv) -} - -func TestNPrimeKeyGeneration(t *testing.T) { - primeSize := 64 - maxN := 24 - if testing.Short() { - primeSize = 16 - maxN = 16 - } - // Test that generation of N-prime keys works for N > 4. - for n := 5; n < maxN; n++ { - priv, err := GenerateMultiPrimeKey(rand.Reader, n, 64+n*primeSize) - if err == nil { - testKeyBasics(t, priv) - } else { - t.Errorf("failed to generate %d-prime key", n) - } - } -} - -func TestGnuTLSKey(t *testing.T) { - // This is a key generated by `certtool --generate-privkey --bits 128`. - // It's such that de ≢ 1 mod φ(n), but is congruent mod the order of - // the group. - priv := &PrivateKey{ - PublicKey: PublicKey{ - N: fromBase10("290684273230919398108010081414538931343"), - E: 65537, - }, - D: fromBase10("31877380284581499213530787347443987241"), - Primes: []*big.Int{ - fromBase10("16775196964030542637"), - fromBase10("17328218193455850539"), - }, - } - testKeyBasics(t, priv) -} - -func testKeyBasics(t *testing.T, priv *PrivateKey) { - if err := priv.Validate(); err != nil { - t.Errorf("Validate() failed: %s", err) - } - if priv.D.Cmp(priv.N) > 0 { - t.Errorf("private exponent too large") - } - - pub := &priv.PublicKey - m := big.NewInt(42) - c := encrypt(new(big.Int), pub, m) - - m2, err := decrypt(nil, priv, c) - if err != nil { - t.Errorf("error while decrypting: %s", err) - return - } - if m.Cmp(m2) != 0 { - t.Errorf("got:%v, want:%v (%+v)", m2, m, priv) - } - - m3, err := decrypt(rand.Reader, priv, c) - if err != nil { - t.Errorf("error while decrypting (blind): %s", err) - } - if m.Cmp(m3) != 0 { - t.Errorf("(blind) got:%v, want:%v (%#v)", m3, m, priv) - } -} - -func fromBase10(base10 string) *big.Int { - i, ok := new(big.Int).SetString(base10, 10) - if !ok { - panic("bad number: " + base10) - } - return i -} - -func BenchmarkRSA2048Decrypt(b *testing.B) { - b.StopTimer() - priv := &PrivateKey{ - PublicKey: PublicKey{ - N: fromBase10("14314132931241006650998084889274020608918049032671858325988396851334124245188214251956198731333464217832226406088020736932173064754214329009979944037640912127943488972644697423190955557435910767690712778463524983667852819010259499695177313115447116110358524558307947613422897787329221478860907963827160223559690523660574329011927531289655711860504630573766609239332569210831325633840174683944553667352219670930408593321661375473885147973879086994006440025257225431977751512374815915392249179976902953721486040787792801849818254465486633791826766873076617116727073077821584676715609985777563958286637185868165868520557"), - E: 3, - }, - D: fromBase10("9542755287494004433998723259516013739278699355114572217325597900889416163458809501304132487555642811888150937392013824621448709836142886006653296025093941418628992648429798282127303704957273845127141852309016655778568546006839666463451542076964744073572349705538631742281931858219480985907271975884773482372966847639853897890615456605598071088189838676728836833012254065983259638538107719766738032720239892094196108713378822882383694456030043492571063441943847195939549773271694647657549658603365629458610273821292232646334717612674519997533901052790334279661754176490593041941863932308687197618671528035670452762731"), - Primes: []*big.Int{ - fromBase10("130903255182996722426771613606077755295583329135067340152947172868415809027537376306193179624298874215608270802054347609836776473930072411958753044562214537013874103802006369634761074377213995983876788718033850153719421695468704276694983032644416930879093914927146648402139231293035971427838068945045019075433"), - fromBase10("109348945610485453577574767652527472924289229538286649661240938988020367005475727988253438647560958573506159449538793540472829815903949343191091817779240101054552748665267574271163617694640513549693841337820602726596756351006149518830932261246698766355347898158548465400674856021497190430791824869615170301029"), - }, - } - priv.Precompute() - - c := fromBase10("8472002792838218989464636159316973636630013835787202418124758118372358261975764365740026024610403138425986214991379012696600761514742817632790916315594342398720903716529235119816755589383377471752116975374952783629225022962092351886861518911824745188989071172097120352727368980275252089141512321893536744324822590480751098257559766328893767334861211872318961900897793874075248286439689249972315699410830094164386544311554704755110361048571142336148077772023880664786019636334369759624917224888206329520528064315309519262325023881707530002540634660750469137117568199824615333883758410040459705787022909848740188613313") - - b.StartTimer() - - for i := 0; i < b.N; i++ { - decrypt(nil, priv, c) - } -} - -func Benchmark3PrimeRSA2048Decrypt(b *testing.B) { - b.StopTimer() - priv := &PrivateKey{ - PublicKey: PublicKey{ - N: fromBase10("16346378922382193400538269749936049106320265317511766357599732575277382844051791096569333808598921852351577762718529818072849191122419410612033592401403764925096136759934497687765453905884149505175426053037420486697072448609022753683683718057795566811401938833367954642951433473337066311978821180526439641496973296037000052546108507805269279414789035461158073156772151892452251106173507240488993608650881929629163465099476849643165682709047462010581308719577053905787496296934240246311806555924593059995202856826239801816771116902778517096212527979497399966526283516447337775509777558018145573127308919204297111496233"), - E: 3, - }, - D: fromBase10("10897585948254795600358846499957366070880176878341177571733155050184921896034527397712889205732614568234385175145686545381899460748279607074689061600935843283397424506622998458510302603922766336783617368686090042765718290914099334449154829375179958369993407724946186243249568928237086215759259909861748642124071874879861299389874230489928271621259294894142840428407196932444474088857746123104978617098858619445675532587787023228852383149557470077802718705420275739737958953794088728369933811184572620857678792001136676902250566845618813972833750098806496641114644760255910789397593428910198080271317419213080834885003"), - Primes: []*big.Int{ - fromBase10("1025363189502892836833747188838978207017355117492483312747347695538428729137306368764177201532277413433182799108299960196606011786562992097313508180436744488171474690412562218914213688661311117337381958560443"), - fromBase10("3467903426626310123395340254094941045497208049900750380025518552334536945536837294961497712862519984786362199788654739924501424784631315081391467293694361474867825728031147665777546570788493758372218019373"), - fromBase10("4597024781409332673052708605078359346966325141767460991205742124888960305710298765592730135879076084498363772408626791576005136245060321874472727132746643162385746062759369754202494417496879741537284589047"), - }, - } - priv.Precompute() - - c := fromBase10("8472002792838218989464636159316973636630013835787202418124758118372358261975764365740026024610403138425986214991379012696600761514742817632790916315594342398720903716529235119816755589383377471752116975374952783629225022962092351886861518911824745188989071172097120352727368980275252089141512321893536744324822590480751098257559766328893767334861211872318961900897793874075248286439689249972315699410830094164386544311554704755110361048571142336148077772023880664786019636334369759624917224888206329520528064315309519262325023881707530002540634660750469137117568199824615333883758410040459705787022909848740188613313") - - b.StartTimer() - - for i := 0; i < b.N; i++ { - decrypt(nil, priv, c) - } -} - -type testEncryptOAEPMessage struct { - in []byte - seed []byte - out []byte -} - -type testEncryptOAEPStruct struct { - modulus string - e int - d string - msgs []testEncryptOAEPMessage -} - -func TestEncryptOAEP(t *testing.T) { - sha1 := sha1.New() - n := new(big.Int) - for i, test := range testEncryptOAEPData { - n.SetString(test.modulus, 16) - public := PublicKey{n, test.e} - - for j, message := range test.msgs { - randomSource := bytes.NewReader(message.seed) - out, err := EncryptOAEP(sha1, randomSource, &public, message.in, nil) - if err != nil { - t.Errorf("#%d,%d error: %s", i, j, err) - } - if !bytes.Equal(out, message.out) { - t.Errorf("#%d,%d bad result: %x (want %x)", i, j, out, message.out) - } - } - } -} - -func TestDecryptOAEP(t *testing.T) { - random := rand.Reader - - sha1 := sha1.New() - n := new(big.Int) - d := new(big.Int) - for i, test := range testEncryptOAEPData { - n.SetString(test.modulus, 16) - d.SetString(test.d, 16) - private := new(PrivateKey) - private.PublicKey = PublicKey{n, test.e} - private.D = d - - for j, message := range test.msgs { - out, err := DecryptOAEP(sha1, nil, private, message.out, nil) - if err != nil { - t.Errorf("#%d,%d error: %s", i, j, err) - } else if !bytes.Equal(out, message.in) { - t.Errorf("#%d,%d bad result: %#v (want %#v)", i, j, out, message.in) - } - - // Decrypt with blinding. - out, err = DecryptOAEP(sha1, random, private, message.out, nil) - if err != nil { - t.Errorf("#%d,%d (blind) error: %s", i, j, err) - } else if !bytes.Equal(out, message.in) { - t.Errorf("#%d,%d (blind) bad result: %#v (want %#v)", i, j, out, message.in) - } - } - if testing.Short() { - break - } - } -} - -// testEncryptOAEPData contains a subset of the vectors from RSA's "Test vectors for RSA-OAEP". -var testEncryptOAEPData = []testEncryptOAEPStruct{ - // Key 1 - {"a8b3b284af8eb50b387034a860f146c4919f318763cd6c5598c8ae4811a1e0abc4c7e0b082d693a5e7fced675cf4668512772c0cbc64a742c6c630f533c8cc72f62ae833c40bf25842e984bb78bdbf97c0107d55bdb662f5c4e0fab9845cb5148ef7392dd3aaff93ae1e6b667bb3d4247616d4f5ba10d4cfd226de88d39f16fb", - 65537, - "53339cfdb79fc8466a655c7316aca85c55fd8f6dd898fdaf119517ef4f52e8fd8e258df93fee180fa0e4ab29693cd83b152a553d4ac4d1812b8b9fa5af0e7f55fe7304df41570926f3311f15c4d65a732c483116ee3d3d2d0af3549ad9bf7cbfb78ad884f84d5beb04724dc7369b31def37d0cf539e9cfcdd3de653729ead5d1", - []testEncryptOAEPMessage{ - // Example 1.1 - { - []byte{0x66, 0x28, 0x19, 0x4e, 0x12, 0x07, 0x3d, 0xb0, - 0x3b, 0xa9, 0x4c, 0xda, 0x9e, 0xf9, 0x53, 0x23, 0x97, - 0xd5, 0x0d, 0xba, 0x79, 0xb9, 0x87, 0x00, 0x4a, 0xfe, - 0xfe, 0x34, - }, - []byte{0x18, 0xb7, 0x76, 0xea, 0x21, 0x06, 0x9d, 0x69, - 0x77, 0x6a, 0x33, 0xe9, 0x6b, 0xad, 0x48, 0xe1, 0xdd, - 0xa0, 0xa5, 0xef, - }, - []byte{0x35, 0x4f, 0xe6, 0x7b, 0x4a, 0x12, 0x6d, 0x5d, - 0x35, 0xfe, 0x36, 0xc7, 0x77, 0x79, 0x1a, 0x3f, 0x7b, - 0xa1, 0x3d, 0xef, 0x48, 0x4e, 0x2d, 0x39, 0x08, 0xaf, - 0xf7, 0x22, 0xfa, 0xd4, 0x68, 0xfb, 0x21, 0x69, 0x6d, - 0xe9, 0x5d, 0x0b, 0xe9, 0x11, 0xc2, 0xd3, 0x17, 0x4f, - 0x8a, 0xfc, 0xc2, 0x01, 0x03, 0x5f, 0x7b, 0x6d, 0x8e, - 0x69, 0x40, 0x2d, 0xe5, 0x45, 0x16, 0x18, 0xc2, 0x1a, - 0x53, 0x5f, 0xa9, 0xd7, 0xbf, 0xc5, 0xb8, 0xdd, 0x9f, - 0xc2, 0x43, 0xf8, 0xcf, 0x92, 0x7d, 0xb3, 0x13, 0x22, - 0xd6, 0xe8, 0x81, 0xea, 0xa9, 0x1a, 0x99, 0x61, 0x70, - 0xe6, 0x57, 0xa0, 0x5a, 0x26, 0x64, 0x26, 0xd9, 0x8c, - 0x88, 0x00, 0x3f, 0x84, 0x77, 0xc1, 0x22, 0x70, 0x94, - 0xa0, 0xd9, 0xfa, 0x1e, 0x8c, 0x40, 0x24, 0x30, 0x9c, - 0xe1, 0xec, 0xcc, 0xb5, 0x21, 0x00, 0x35, 0xd4, 0x7a, - 0xc7, 0x2e, 0x8a, - }, - }, - // Example 1.2 - { - []byte{0x75, 0x0c, 0x40, 0x47, 0xf5, 0x47, 0xe8, 0xe4, - 0x14, 0x11, 0x85, 0x65, 0x23, 0x29, 0x8a, 0xc9, 0xba, - 0xe2, 0x45, 0xef, 0xaf, 0x13, 0x97, 0xfb, 0xe5, 0x6f, - 0x9d, 0xd5, - }, - []byte{0x0c, 0xc7, 0x42, 0xce, 0x4a, 0x9b, 0x7f, 0x32, - 0xf9, 0x51, 0xbc, 0xb2, 0x51, 0xef, 0xd9, 0x25, 0xfe, - 0x4f, 0xe3, 0x5f, - }, - []byte{0x64, 0x0d, 0xb1, 0xac, 0xc5, 0x8e, 0x05, 0x68, - 0xfe, 0x54, 0x07, 0xe5, 0xf9, 0xb7, 0x01, 0xdf, 0xf8, - 0xc3, 0xc9, 0x1e, 0x71, 0x6c, 0x53, 0x6f, 0xc7, 0xfc, - 0xec, 0x6c, 0xb5, 0xb7, 0x1c, 0x11, 0x65, 0x98, 0x8d, - 0x4a, 0x27, 0x9e, 0x15, 0x77, 0xd7, 0x30, 0xfc, 0x7a, - 0x29, 0x93, 0x2e, 0x3f, 0x00, 0xc8, 0x15, 0x15, 0x23, - 0x6d, 0x8d, 0x8e, 0x31, 0x01, 0x7a, 0x7a, 0x09, 0xdf, - 0x43, 0x52, 0xd9, 0x04, 0xcd, 0xeb, 0x79, 0xaa, 0x58, - 0x3a, 0xdc, 0xc3, 0x1e, 0xa6, 0x98, 0xa4, 0xc0, 0x52, - 0x83, 0xda, 0xba, 0x90, 0x89, 0xbe, 0x54, 0x91, 0xf6, - 0x7c, 0x1a, 0x4e, 0xe4, 0x8d, 0xc7, 0x4b, 0xbb, 0xe6, - 0x64, 0x3a, 0xef, 0x84, 0x66, 0x79, 0xb4, 0xcb, 0x39, - 0x5a, 0x35, 0x2d, 0x5e, 0xd1, 0x15, 0x91, 0x2d, 0xf6, - 0x96, 0xff, 0xe0, 0x70, 0x29, 0x32, 0x94, 0x6d, 0x71, - 0x49, 0x2b, 0x44, - }, - }, - // Example 1.3 - { - []byte{0xd9, 0x4a, 0xe0, 0x83, 0x2e, 0x64, 0x45, 0xce, - 0x42, 0x33, 0x1c, 0xb0, 0x6d, 0x53, 0x1a, 0x82, 0xb1, - 0xdb, 0x4b, 0xaa, 0xd3, 0x0f, 0x74, 0x6d, 0xc9, 0x16, - 0xdf, 0x24, 0xd4, 0xe3, 0xc2, 0x45, 0x1f, 0xff, 0x59, - 0xa6, 0x42, 0x3e, 0xb0, 0xe1, 0xd0, 0x2d, 0x4f, 0xe6, - 0x46, 0xcf, 0x69, 0x9d, 0xfd, 0x81, 0x8c, 0x6e, 0x97, - 0xb0, 0x51, - }, - []byte{0x25, 0x14, 0xdf, 0x46, 0x95, 0x75, 0x5a, 0x67, - 0xb2, 0x88, 0xea, 0xf4, 0x90, 0x5c, 0x36, 0xee, 0xc6, - 0x6f, 0xd2, 0xfd, - }, - []byte{0x42, 0x37, 0x36, 0xed, 0x03, 0x5f, 0x60, 0x26, - 0xaf, 0x27, 0x6c, 0x35, 0xc0, 0xb3, 0x74, 0x1b, 0x36, - 0x5e, 0x5f, 0x76, 0xca, 0x09, 0x1b, 0x4e, 0x8c, 0x29, - 0xe2, 0xf0, 0xbe, 0xfe, 0xe6, 0x03, 0x59, 0x5a, 0xa8, - 0x32, 0x2d, 0x60, 0x2d, 0x2e, 0x62, 0x5e, 0x95, 0xeb, - 0x81, 0xb2, 0xf1, 0xc9, 0x72, 0x4e, 0x82, 0x2e, 0xca, - 0x76, 0xdb, 0x86, 0x18, 0xcf, 0x09, 0xc5, 0x34, 0x35, - 0x03, 0xa4, 0x36, 0x08, 0x35, 0xb5, 0x90, 0x3b, 0xc6, - 0x37, 0xe3, 0x87, 0x9f, 0xb0, 0x5e, 0x0e, 0xf3, 0x26, - 0x85, 0xd5, 0xae, 0xc5, 0x06, 0x7c, 0xd7, 0xcc, 0x96, - 0xfe, 0x4b, 0x26, 0x70, 0xb6, 0xea, 0xc3, 0x06, 0x6b, - 0x1f, 0xcf, 0x56, 0x86, 0xb6, 0x85, 0x89, 0xaa, 0xfb, - 0x7d, 0x62, 0x9b, 0x02, 0xd8, 0xf8, 0x62, 0x5c, 0xa3, - 0x83, 0x36, 0x24, 0xd4, 0x80, 0x0f, 0xb0, 0x81, 0xb1, - 0xcf, 0x94, 0xeb, - }, - }, - }, - }, - // Key 10 - {"ae45ed5601cec6b8cc05f803935c674ddbe0d75c4c09fd7951fc6b0caec313a8df39970c518bffba5ed68f3f0d7f22a4029d413f1ae07e4ebe9e4177ce23e7f5404b569e4ee1bdcf3c1fb03ef113802d4f855eb9b5134b5a7c8085adcae6fa2fa1417ec3763be171b0c62b760ede23c12ad92b980884c641f5a8fac26bdad4a03381a22fe1b754885094c82506d4019a535a286afeb271bb9ba592de18dcf600c2aeeae56e02f7cf79fc14cf3bdc7cd84febbbf950ca90304b2219a7aa063aefa2c3c1980e560cd64afe779585b6107657b957857efde6010988ab7de417fc88d8f384c4e6e72c3f943e0c31c0c4a5cc36f879d8a3ac9d7d59860eaada6b83bb", - 65537, - "056b04216fe5f354ac77250a4b6b0c8525a85c59b0bd80c56450a22d5f438e596a333aa875e291dd43f48cb88b9d5fc0d499f9fcd1c397f9afc070cd9e398c8d19e61db7c7410a6b2675dfbf5d345b804d201add502d5ce2dfcb091ce9997bbebe57306f383e4d588103f036f7e85d1934d152a323e4a8db451d6f4a5b1b0f102cc150e02feee2b88dea4ad4c1baccb24d84072d14e1d24a6771f7408ee30564fb86d4393a34bcf0b788501d193303f13a2284b001f0f649eaf79328d4ac5c430ab4414920a9460ed1b7bc40ec653e876d09abc509ae45b525190116a0c26101848298509c1c3bf3a483e7274054e15e97075036e989f60932807b5257751e79", - []testEncryptOAEPMessage{ - // Example 10.1 - { - []byte{0x8b, 0xba, 0x6b, 0xf8, 0x2a, 0x6c, 0x0f, 0x86, - 0xd5, 0xf1, 0x75, 0x6e, 0x97, 0x95, 0x68, 0x70, 0xb0, - 0x89, 0x53, 0xb0, 0x6b, 0x4e, 0xb2, 0x05, 0xbc, 0x16, - 0x94, 0xee, - }, - []byte{0x47, 0xe1, 0xab, 0x71, 0x19, 0xfe, 0xe5, 0x6c, - 0x95, 0xee, 0x5e, 0xaa, 0xd8, 0x6f, 0x40, 0xd0, 0xaa, - 0x63, 0xbd, 0x33, - }, - []byte{0x53, 0xea, 0x5d, 0xc0, 0x8c, 0xd2, 0x60, 0xfb, - 0x3b, 0x85, 0x85, 0x67, 0x28, 0x7f, 0xa9, 0x15, 0x52, - 0xc3, 0x0b, 0x2f, 0xeb, 0xfb, 0xa2, 0x13, 0xf0, 0xae, - 0x87, 0x70, 0x2d, 0x06, 0x8d, 0x19, 0xba, 0xb0, 0x7f, - 0xe5, 0x74, 0x52, 0x3d, 0xfb, 0x42, 0x13, 0x9d, 0x68, - 0xc3, 0xc5, 0xaf, 0xee, 0xe0, 0xbf, 0xe4, 0xcb, 0x79, - 0x69, 0xcb, 0xf3, 0x82, 0xb8, 0x04, 0xd6, 0xe6, 0x13, - 0x96, 0x14, 0x4e, 0x2d, 0x0e, 0x60, 0x74, 0x1f, 0x89, - 0x93, 0xc3, 0x01, 0x4b, 0x58, 0xb9, 0xb1, 0x95, 0x7a, - 0x8b, 0xab, 0xcd, 0x23, 0xaf, 0x85, 0x4f, 0x4c, 0x35, - 0x6f, 0xb1, 0x66, 0x2a, 0xa7, 0x2b, 0xfc, 0xc7, 0xe5, - 0x86, 0x55, 0x9d, 0xc4, 0x28, 0x0d, 0x16, 0x0c, 0x12, - 0x67, 0x85, 0xa7, 0x23, 0xeb, 0xee, 0xbe, 0xff, 0x71, - 0xf1, 0x15, 0x94, 0x44, 0x0a, 0xae, 0xf8, 0x7d, 0x10, - 0x79, 0x3a, 0x87, 0x74, 0xa2, 0x39, 0xd4, 0xa0, 0x4c, - 0x87, 0xfe, 0x14, 0x67, 0xb9, 0xda, 0xf8, 0x52, 0x08, - 0xec, 0x6c, 0x72, 0x55, 0x79, 0x4a, 0x96, 0xcc, 0x29, - 0x14, 0x2f, 0x9a, 0x8b, 0xd4, 0x18, 0xe3, 0xc1, 0xfd, - 0x67, 0x34, 0x4b, 0x0c, 0xd0, 0x82, 0x9d, 0xf3, 0xb2, - 0xbe, 0xc6, 0x02, 0x53, 0x19, 0x62, 0x93, 0xc6, 0xb3, - 0x4d, 0x3f, 0x75, 0xd3, 0x2f, 0x21, 0x3d, 0xd4, 0x5c, - 0x62, 0x73, 0xd5, 0x05, 0xad, 0xf4, 0xcc, 0xed, 0x10, - 0x57, 0xcb, 0x75, 0x8f, 0xc2, 0x6a, 0xee, 0xfa, 0x44, - 0x12, 0x55, 0xed, 0x4e, 0x64, 0xc1, 0x99, 0xee, 0x07, - 0x5e, 0x7f, 0x16, 0x64, 0x61, 0x82, 0xfd, 0xb4, 0x64, - 0x73, 0x9b, 0x68, 0xab, 0x5d, 0xaf, 0xf0, 0xe6, 0x3e, - 0x95, 0x52, 0x01, 0x68, 0x24, 0xf0, 0x54, 0xbf, 0x4d, - 0x3c, 0x8c, 0x90, 0xa9, 0x7b, 0xb6, 0xb6, 0x55, 0x32, - 0x84, 0xeb, 0x42, 0x9f, 0xcc, - }, - }, - }, - }, -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/testdata/pss-vect.txt.bz2 b/llgo/third_party/gofrontend/libgo/go/crypto/rsa/testdata/pss-vect.txt.bz2 deleted file mode 100644 index ad3da1ac4ee62b68c166ea4e1fc1c540030e7e54..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/crypto/rsa/testdata/pss-vect.txt.bz2 and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1.go deleted file mode 100644 index 9f1a96e36492ab131ecb403b76318238c667c79e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package sha1 implements the SHA1 hash algorithm as defined in RFC 3174. -package sha1 - -import ( - "crypto" - "hash" -) - -func init() { - crypto.RegisterHash(crypto.SHA1, New) -} - -// The size of a SHA1 checksum in bytes. -const Size = 20 - -// The blocksize of SHA1 in bytes. -const BlockSize = 64 - -const ( - chunk = 64 - init0 = 0x67452301 - init1 = 0xEFCDAB89 - init2 = 0x98BADCFE - init3 = 0x10325476 - init4 = 0xC3D2E1F0 -) - -// digest represents the partial evaluation of a checksum. -type digest struct { - h [5]uint32 - x [chunk]byte - nx int - len uint64 -} - -func (d *digest) Reset() { - d.h[0] = init0 - d.h[1] = init1 - d.h[2] = init2 - d.h[3] = init3 - d.h[4] = init4 - d.nx = 0 - d.len = 0 -} - -// New returns a new hash.Hash computing the SHA1 checksum. -func New() hash.Hash { - d := new(digest) - d.Reset() - return d -} - -func (d *digest) Size() int { return Size } - -func (d *digest) BlockSize() int { return BlockSize } - -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := copy(d.x[d.nx:], p) - d.nx += n - if d.nx == chunk { - block(d, d.x[:]) - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - block(d, p[:n]) - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -func (d0 *digest) Sum(in []byte) []byte { - // Make a copy of d0 so that caller can keep writing and summing. - d := *d0 - hash := d.checkSum() - return append(in, hash[:]...) -} - -func (d *digest) checkSum() [Size]byte { - len := d.len - // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. - var tmp [64]byte - tmp[0] = 0x80 - if len%64 < 56 { - d.Write(tmp[0 : 56-len%64]) - } else { - d.Write(tmp[0 : 64+56-len%64]) - } - - // Length in bits. - len <<= 3 - for i := uint(0); i < 8; i++ { - tmp[i] = byte(len >> (56 - 8*i)) - } - d.Write(tmp[0:8]) - - if d.nx != 0 { - panic("d.nx != 0") - } - - var digest [Size]byte - for i, s := range d.h { - digest[i*4] = byte(s >> 24) - digest[i*4+1] = byte(s >> 16) - digest[i*4+2] = byte(s >> 8) - digest[i*4+3] = byte(s) - } - - return digest -} - -// Sum returns the SHA1 checksum of the data. -func Sum(data []byte) [Size]byte { - var d digest - d.Reset() - d.Write(data) - return d.checkSum() -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1_test.go deleted file mode 100644 index 4a629518b761eb3c64813c35c0305a6f227fcbe2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1_test.go +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// SHA1 hash algorithm. See RFC 3174. - -package sha1 - -import ( - "crypto/rand" - "fmt" - "io" - "testing" -) - -type sha1Test struct { - out string - in string -} - -var golden = []sha1Test{ - {"da39a3ee5e6b4b0d3255bfef95601890afd80709", ""}, - {"86f7e437faa5a7fce15d1ddcb9eaeaea377667b8", "a"}, - {"da23614e02469a0d7c7bd1bdab5c9c474b1904dc", "ab"}, - {"a9993e364706816aba3e25717850c26c9cd0d89d", "abc"}, - {"81fe8bfe87576c3ecb22426f8e57847382917acf", "abcd"}, - {"03de6c570bfe24bfc328ccd7ca46b76eadaf4334", "abcde"}, - {"1f8ac10f23c5b5bc1167bda84b833e5c057a77d2", "abcdef"}, - {"2fb5e13419fc89246865e7a324f476ec624e8740", "abcdefg"}, - {"425af12a0743502b322e93a015bcf868e324d56a", "abcdefgh"}, - {"c63b19f1e4c8b5f76b25c49b8b87f57d8e4872a1", "abcdefghi"}, - {"d68c19a0a345b7eab78d5e11e991c026ec60db63", "abcdefghij"}, - {"ebf81ddcbe5bf13aaabdc4d65354fdf2044f38a7", "Discard medicine more than two years old."}, - {"e5dea09392dd886ca63531aaa00571dc07554bb6", "He who has a shady past knows that nice guys finish last."}, - {"45988f7234467b94e3e9494434c96ee3609d8f8f", "I wouldn't marry him with a ten foot pole."}, - {"55dee037eb7460d5a692d1ce11330b260e40c988", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, - {"b7bc5fb91080c7de6b582ea281f8a396d7c0aee8", "The days of the digital watch are numbered. -Tom Stoppard"}, - {"c3aed9358f7c77f523afe86135f06b95b3999797", "Nepal premier won't resign."}, - {"6e29d302bf6e3a5e4305ff318d983197d6906bb9", "For every action there is an equal and opposite government program."}, - {"597f6a540010f94c15d71806a99a2c8710e747bd", "His money is twice tainted: 'taint yours and 'taint mine."}, - {"6859733b2590a8a091cecf50086febc5ceef1e80", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, - {"514b2630ec089b8aee18795fc0cf1f4860cdacad", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, - {"c5ca0d4a7b6676fc7aa72caa41cc3d5df567ed69", "size: a.out: bad magic"}, - {"74c51fa9a04eadc8c1bbeaa7fc442f834b90a00a", "The major problem is with sendmail. -Mark Horton"}, - {"0b4c4ce5f52c3ad2821852a8dc00217fa18b8b66", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, - {"3ae7937dd790315beb0f48330e8642237c61550a", "If the enemy is within range, then so are you."}, - {"410a2b296df92b9a47412b13281df8f830a9f44b", "It's well we cannot hear the screams/That we create in others' dreams."}, - {"841e7c85ca1adcddbdd0187f1289acb5c642f7f5", "You remind me of a TV show, but that's all right: I watch it anyway."}, - {"163173b825d03b952601376b25212df66763e1db", "C is as portable as Stonehedge!!"}, - {"32b0377f2687eb88e22106f133c586ab314d5279", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, - {"0885aaf99b569542fd165fa44e322718f4a984e0", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, - {"6627d6904d71420b0bf3886ab629623538689f45", "How can you write a big system without C++? -Paul Glick"}, -} - -func TestGolden(t *testing.T) { - for i := 0; i < len(golden); i++ { - g := golden[i] - s := fmt.Sprintf("%x", Sum([]byte(g.in))) - if s != g.out { - t.Fatalf("Sum function: sha1(%s) = %s want %s", g.in, s, g.out) - } - c := New() - for j := 0; j < 3; j++ { - if j < 2 { - io.WriteString(c, g.in) - } else { - io.WriteString(c, g.in[0:len(g.in)/2]) - c.Sum(nil) - io.WriteString(c, g.in[len(g.in)/2:]) - } - s := fmt.Sprintf("%x", c.Sum(nil)) - if s != g.out { - t.Fatalf("sha1[%d](%s) = %s want %s", j, g.in, s, g.out) - } - c.Reset() - } - } -} - -func TestSize(t *testing.T) { - c := New() - if got := c.Size(); got != Size { - t.Errorf("Size = %d; want %d", got, Size) - } -} - -func TestBlockSize(t *testing.T) { - c := New() - if got := c.BlockSize(); got != BlockSize { - t.Errorf("BlockSize = %d; want %d", got, BlockSize) - } -} - -// Tests that blockGeneric (pure Go) and block (in assembly for amd64, 386, arm) match. -func TestBlockGeneric(t *testing.T) { - gen, asm := New().(*digest), New().(*digest) - buf := make([]byte, BlockSize*20) // arbitrary factor - rand.Read(buf) - blockGeneric(gen, buf) - block(asm, buf) - if *gen != *asm { - t.Error("block and blockGeneric resulted in different states") - } -} - -var bench = New() -var buf = make([]byte, 8192) - -func benchmarkSize(b *testing.B, size int) { - b.SetBytes(int64(size)) - sum := make([]byte, bench.Size()) - for i := 0; i < b.N; i++ { - bench.Reset() - bench.Write(buf[:size]) - bench.Sum(sum[:0]) - } -} - -func BenchmarkHash8Bytes(b *testing.B) { - benchmarkSize(b, 8) -} - -func BenchmarkHash1K(b *testing.B) { - benchmarkSize(b, 1024) -} - -func BenchmarkHash8K(b *testing.B) { - benchmarkSize(b, 8192) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block.go deleted file mode 100644 index fde3c981c083f46c24b620c63758200df8c238b0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sha1 - -const ( - _K0 = 0x5A827999 - _K1 = 0x6ED9EBA1 - _K2 = 0x8F1BBCDC - _K3 = 0xCA62C1D6 -) - -// blockGeneric is a portable, pure Go version of the SHA1 block step. -// It's used by sha1block_generic.go and tests. -func blockGeneric(dig *digest, p []byte) { - var w [16]uint32 - - h0, h1, h2, h3, h4 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] - for len(p) >= chunk { - // Can interlace the computation of w with the - // rounds below if needed for speed. - for i := 0; i < 16; i++ { - j := i * 4 - w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3]) - } - - a, b, c, d, e := h0, h1, h2, h3, h4 - - // Each of the four 20-iteration rounds - // differs only in the computation of f and - // the choice of K (_K0, _K1, etc). - i := 0 - for ; i < 16; i++ { - f := b&c | (^b)&d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K0 - a, b, c, d, e = t, a, b30, c, d - } - for ; i < 20; i++ { - tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | tmp>>(32-1) - - f := b&c | (^b)&d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K0 - a, b, c, d, e = t, a, b30, c, d - } - for ; i < 40; i++ { - tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | tmp>>(32-1) - f := b ^ c ^ d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K1 - a, b, c, d, e = t, a, b30, c, d - } - for ; i < 60; i++ { - tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | tmp>>(32-1) - f := ((b | c) & d) | (b & c) - - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K2 - a, b, c, d, e = t, a, b30, c, d - } - for ; i < 80; i++ { - tmp := w[(i-3)&0xf] ^ w[(i-8)&0xf] ^ w[(i-14)&0xf] ^ w[(i)&0xf] - w[i&0xf] = tmp<<1 | tmp>>(32-1) - f := b ^ c ^ d - a5 := a<<5 | a>>(32-5) - b30 := b<<30 | b>>(32-30) - t := a5 + f + e + w[i&0xf] + _K3 - a, b, c, d, e = t, a, b30, c, d - } - - h0 += a - h1 += b - h2 += c - h3 += d - h4 += e - - p = p[chunk:] - } - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4] = h0, h1, h2, h3, h4 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_decl.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_decl.go deleted file mode 100644 index 24e521af1fcbcf0278be93a0226cd10a90dbf16f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_decl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 amd64p32 arm 386 - -package sha1 - -//go:noescape - -func block(dig *digest, p []byte) diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_generic.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_generic.go deleted file mode 100644 index 696e26b6257fdfa411f7bc7fc8dd50cc1f10f604..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha1/sha1block_generic.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64,!amd64p32,!386,!arm - -package sha1 - -var block = blockGeneric diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256.go deleted file mode 100644 index d84cebf2ff2c1734ee143ee0ac3bd50ede3e2932..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256.go +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package sha256 implements the SHA224 and SHA256 hash algorithms as defined -// in FIPS 180-4. -package sha256 - -import ( - "crypto" - "hash" -) - -func init() { - crypto.RegisterHash(crypto.SHA224, New224) - crypto.RegisterHash(crypto.SHA256, New) -} - -// The size of a SHA256 checksum in bytes. -const Size = 32 - -// The size of a SHA224 checksum in bytes. -const Size224 = 28 - -// The blocksize of SHA256 and SHA224 in bytes. -const BlockSize = 64 - -const ( - chunk = 64 - init0 = 0x6A09E667 - init1 = 0xBB67AE85 - init2 = 0x3C6EF372 - init3 = 0xA54FF53A - init4 = 0x510E527F - init5 = 0x9B05688C - init6 = 0x1F83D9AB - init7 = 0x5BE0CD19 - init0_224 = 0xC1059ED8 - init1_224 = 0x367CD507 - init2_224 = 0x3070DD17 - init3_224 = 0xF70E5939 - init4_224 = 0xFFC00B31 - init5_224 = 0x68581511 - init6_224 = 0x64F98FA7 - init7_224 = 0xBEFA4FA4 -) - -// digest represents the partial evaluation of a checksum. -type digest struct { - h [8]uint32 - x [chunk]byte - nx int - len uint64 - is224 bool // mark if this digest is SHA-224 -} - -func (d *digest) Reset() { - if !d.is224 { - d.h[0] = init0 - d.h[1] = init1 - d.h[2] = init2 - d.h[3] = init3 - d.h[4] = init4 - d.h[5] = init5 - d.h[6] = init6 - d.h[7] = init7 - } else { - d.h[0] = init0_224 - d.h[1] = init1_224 - d.h[2] = init2_224 - d.h[3] = init3_224 - d.h[4] = init4_224 - d.h[5] = init5_224 - d.h[6] = init6_224 - d.h[7] = init7_224 - } - d.nx = 0 - d.len = 0 -} - -// New returns a new hash.Hash computing the SHA256 checksum. -func New() hash.Hash { - d := new(digest) - d.Reset() - return d -} - -// New224 returns a new hash.Hash computing the SHA224 checksum. -func New224() hash.Hash { - d := new(digest) - d.is224 = true - d.Reset() - return d -} - -func (d *digest) Size() int { - if !d.is224 { - return Size - } - return Size224 -} - -func (d *digest) BlockSize() int { return BlockSize } - -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := copy(d.x[d.nx:], p) - d.nx += n - if d.nx == chunk { - block(d, d.x[:]) - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - block(d, p[:n]) - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -func (d0 *digest) Sum(in []byte) []byte { - // Make a copy of d0 so that caller can keep writing and summing. - d := *d0 - hash := d.checkSum() - if d.is224 { - return append(in, hash[:Size224]...) - } - return append(in, hash[:]...) -} - -func (d *digest) checkSum() [Size]byte { - len := d.len - // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. - var tmp [64]byte - tmp[0] = 0x80 - if len%64 < 56 { - d.Write(tmp[0 : 56-len%64]) - } else { - d.Write(tmp[0 : 64+56-len%64]) - } - - // Length in bits. - len <<= 3 - for i := uint(0); i < 8; i++ { - tmp[i] = byte(len >> (56 - 8*i)) - } - d.Write(tmp[0:8]) - - if d.nx != 0 { - panic("d.nx != 0") - } - - h := d.h[:] - if d.is224 { - h = d.h[:7] - } - - var digest [Size]byte - for i, s := range h { - digest[i*4] = byte(s >> 24) - digest[i*4+1] = byte(s >> 16) - digest[i*4+2] = byte(s >> 8) - digest[i*4+3] = byte(s) - } - - return digest -} - -// Sum256 returns the SHA256 checksum of the data. -func Sum256(data []byte) [Size]byte { - var d digest - d.Reset() - d.Write(data) - return d.checkSum() -} - -// Sum224 returns the SHA224 checksum of the data. -func Sum224(data []byte) (sum224 [Size224]byte) { - var d digest - d.is224 = true - d.Reset() - d.Write(data) - sum := d.checkSum() - copy(sum224[:], sum[:Size224]) - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256_test.go deleted file mode 100644 index 1d883d39059577224fd98faa37c1f80c0f353221..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256_test.go +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// SHA256 hash algorithm. See FIPS 180-2. - -package sha256 - -import ( - "fmt" - "io" - "testing" -) - -type sha256Test struct { - out string - in string -} - -var golden = []sha256Test{ - {"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ""}, - {"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb", "a"}, - {"fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603", "ab"}, - {"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad", "abc"}, - {"88d4266fd4e6338d13b845fcf289579d209c897823b9217da3e161936f031589", "abcd"}, - {"36bbe50ed96841d10443bcb670d6554f0a34b761be67ec9c4a8ad2c0c44ca42c", "abcde"}, - {"bef57ec7f53a6d40beb640a780a639c83bc29ac8a9816f1fc6c5c6dcd93c4721", "abcdef"}, - {"7d1a54127b222502f5b79b5fb0803061152a44f92b37e23c6527baf665d4da9a", "abcdefg"}, - {"9c56cc51b374c3ba189210d5b6d4bf57790d351c96c47c02190ecf1e430635ab", "abcdefgh"}, - {"19cc02f26df43cc571bc9ed7b0c4d29224a3ec229529221725ef76d021c8326f", "abcdefghi"}, - {"72399361da6a7754fec986dca5b7cbaf1c810a28ded4abaf56b2106d06cb78b0", "abcdefghij"}, - {"a144061c271f152da4d151034508fed1c138b8c976339de229c3bb6d4bbb4fce", "Discard medicine more than two years old."}, - {"6dae5caa713a10ad04b46028bf6dad68837c581616a1589a265a11288d4bb5c4", "He who has a shady past knows that nice guys finish last."}, - {"ae7a702a9509039ddbf29f0765e70d0001177914b86459284dab8b348c2dce3f", "I wouldn't marry him with a ten foot pole."}, - {"6748450b01c568586715291dfa3ee018da07d36bb7ea6f180c1af6270215c64f", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, - {"14b82014ad2b11f661b5ae6a99b75105c2ffac278cd071cd6c05832793635774", "The days of the digital watch are numbered. -Tom Stoppard"}, - {"7102cfd76e2e324889eece5d6c41921b1e142a4ac5a2692be78803097f6a48d8", "Nepal premier won't resign."}, - {"23b1018cd81db1d67983c5f7417c44da9deb582459e378d7a068552ea649dc9f", "For every action there is an equal and opposite government program."}, - {"8001f190dfb527261c4cfcab70c98e8097a7a1922129bc4096950e57c7999a5a", "His money is twice tainted: 'taint yours and 'taint mine."}, - {"8c87deb65505c3993eb24b7a150c4155e82eee6960cf0c3a8114ff736d69cad5", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, - {"bfb0a67a19cdec3646498b2e0f751bddc41bba4b7f30081b0b932aad214d16d7", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, - {"7f9a0b9bf56332e19f5a0ec1ad9c1425a153da1c624868fda44561d6b74daf36", "size: a.out: bad magic"}, - {"b13f81b8aad9e3666879af19886140904f7f429ef083286195982a7588858cfc", "The major problem is with sendmail. -Mark Horton"}, - {"b26c38d61519e894480c70c8374ea35aa0ad05b2ae3d6674eec5f52a69305ed4", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, - {"049d5e26d4f10222cd841a119e38bd8d2e0d1129728688449575d4ff42b842c1", "If the enemy is within range, then so are you."}, - {"0e116838e3cc1c1a14cd045397e29b4d087aa11b0853fc69ec82e90330d60949", "It's well we cannot hear the screams/That we create in others' dreams."}, - {"4f7d8eb5bcf11de2a56b971021a444aa4eafd6ecd0f307b5109e4e776cd0fe46", "You remind me of a TV show, but that's all right: I watch it anyway."}, - {"61c0cc4c4bd8406d5120b3fb4ebc31ce87667c162f29468b3c779675a85aebce", "C is as portable as Stonehedge!!"}, - {"1fb2eb3688093c4a3f80cd87a5547e2ce940a4f923243a79a2a1e242220693ac", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, - {"395585ce30617b62c80b93e8208ce866d4edc811a177fdb4b82d3911d8696423", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, - {"4f9b189a13d030838269dce846b16a1ce9ce81fe63e65de2f636863336a98fe6", "How can you write a big system without C++? -Paul Glick"}, -} - -var golden224 = []sha256Test{ - {"d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", ""}, - {"abd37534c7d9a2efb9465de931cd7055ffdb8879563ae98078d6d6d5", "a"}, - {"db3cda86d4429a1d39c148989566b38f7bda0156296bd364ba2f878b", "ab"}, - {"23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7", "abc"}, - {"a76654d8e3550e9a2d67a0eeb6c67b220e5885eddd3fde135806e601", "abcd"}, - {"bdd03d560993e675516ba5a50638b6531ac2ac3d5847c61916cfced6", "abcde"}, - {"7043631cb415556a275a4ebecb802c74ee9f6153908e1792a90b6a98", "abcdef"}, - {"d1884e711701ad81abe0c77a3b0ea12e19ba9af64077286c72fc602d", "abcdefg"}, - {"17eb7d40f0356f8598e89eafad5f6c759b1f822975d9c9b737c8a517", "abcdefgh"}, - {"aeb35915346c584db820d2de7af3929ffafef9222a9bcb26516c7334", "abcdefghi"}, - {"d35e1e5af29ddb0d7e154357df4ad9842afee527c689ee547f753188", "abcdefghij"}, - {"19297f1cef7ddc8a7e947f5c5a341e10f7245045e425db67043988d7", "Discard medicine more than two years old."}, - {"0f10c2eb436251f777fbbd125e260d36aecf180411726c7c885f599a", "He who has a shady past knows that nice guys finish last."}, - {"4d1842104919f314cad8a3cd20b3cba7e8ed3e7abed62b57441358f6", "I wouldn't marry him with a ten foot pole."}, - {"a8ba85c6fe0c48fbffc72bbb2f03fcdbc87ae2dc7a56804d1590fb3b", "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave"}, - {"5543fbab26e67e8885b1a852d567d1cb8b9bfe42e0899584c50449a9", "The days of the digital watch are numbered. -Tom Stoppard"}, - {"65ca107390f5da9efa05d28e57b221657edc7e43a9a18fb15b053ddb", "Nepal premier won't resign."}, - {"84953962be366305a9cc9b5cd16ed019edc37ac96c0deb3e12cca116", "For every action there is an equal and opposite government program."}, - {"35a189ce987151dfd00b3577583cc6a74b9869eecf894459cb52038d", "His money is twice tainted: 'taint yours and 'taint mine."}, - {"2fc333713983edfd4ef2c0da6fb6d6415afb94987c91e4069eb063e6", "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977"}, - {"cbe32d38d577a1b355960a4bc3c659c2dc4670859a19777a875842c4", "It's a tiny change to the code and not completely disgusting. - Bob Manchek"}, - {"a2dc118ce959e027576413a7b440c875cdc8d40df9141d6ef78a57e1", "size: a.out: bad magic"}, - {"d10787e24052bcff26dc484787a54ed819e4e4511c54890ee977bf81", "The major problem is with sendmail. -Mark Horton"}, - {"62efcf16ab8a893acdf2f348aaf06b63039ff1bf55508c830532c9fb", "Give me a rock, paper and scissors and I will move the world. CCFestoon"}, - {"3e9b7e4613c59f58665104c5fa86c272db5d3a2ff30df5bb194a5c99", "If the enemy is within range, then so are you."}, - {"5999c208b8bdf6d471bb7c359ac5b829e73a8211dff686143a4e7f18", "It's well we cannot hear the screams/That we create in others' dreams."}, - {"3b2d67ff54eabc4ef737b14edf87c64280ef582bcdf2a6d56908b405", "You remind me of a TV show, but that's all right: I watch it anyway."}, - {"d0733595d20e4d3d6b5c565a445814d1bbb2fd08b9a3b8ffb97930c6", "C is as portable as Stonehedge!!"}, - {"43fb8aeed8a833175c9295c1165415f98c866ef08a4922959d673507", "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley"}, - {"ec18e66e93afc4fb1604bc2baedbfd20b44c43d76e65c0996d7851c6", "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule"}, - {"86ed2eaa9c75ba98396e5c9fb2f679ecf0ea2ed1e0ee9ceecb4a9332", "How can you write a big system without C++? -Paul Glick"}, -} - -func TestGolden(t *testing.T) { - for i := 0; i < len(golden); i++ { - g := golden[i] - s := fmt.Sprintf("%x", Sum256([]byte(g.in))) - if s != g.out { - t.Fatalf("Sum256 function: sha256(%s) = %s want %s", g.in, s, g.out) - } - c := New() - for j := 0; j < 3; j++ { - if j < 2 { - io.WriteString(c, g.in) - } else { - io.WriteString(c, g.in[0:len(g.in)/2]) - c.Sum(nil) - io.WriteString(c, g.in[len(g.in)/2:]) - } - s := fmt.Sprintf("%x", c.Sum(nil)) - if s != g.out { - t.Fatalf("sha256[%d](%s) = %s want %s", j, g.in, s, g.out) - } - c.Reset() - } - } - for i := 0; i < len(golden224); i++ { - g := golden224[i] - s := fmt.Sprintf("%x", Sum224([]byte(g.in))) - if s != g.out { - t.Fatalf("Sum224 function: sha224(%s) = %s want %s", g.in, s, g.out) - } - c := New224() - for j := 0; j < 3; j++ { - if j < 2 { - io.WriteString(c, g.in) - } else { - io.WriteString(c, g.in[0:len(g.in)/2]) - c.Sum(nil) - io.WriteString(c, g.in[len(g.in)/2:]) - } - s := fmt.Sprintf("%x", c.Sum(nil)) - if s != g.out { - t.Fatalf("sha224[%d](%s) = %s want %s", j, g.in, s, g.out) - } - c.Reset() - } - } -} - -func TestSize(t *testing.T) { - c := New() - if got := c.Size(); got != Size { - t.Errorf("Size = %d; want %d", got, Size) - } - c = New224() - if got := c.Size(); got != Size224 { - t.Errorf("New224.Size = %d; want %d", got, Size224) - } -} - -func TestBlockSize(t *testing.T) { - c := New() - if got := c.BlockSize(); got != BlockSize { - t.Errorf("BlockSize = %d want %d", got, BlockSize) - } -} - -var bench = New() -var buf = make([]byte, 8192) - -func benchmarkSize(b *testing.B, size int) { - b.SetBytes(int64(size)) - sum := make([]byte, bench.Size()) - for i := 0; i < b.N; i++ { - bench.Reset() - bench.Write(buf[:size]) - bench.Sum(sum[:0]) - } -} - -func BenchmarkHash8Bytes(b *testing.B) { - benchmarkSize(b, 8) -} - -func BenchmarkHash1K(b *testing.B) { - benchmarkSize(b, 1024) -} - -func BenchmarkHash8K(b *testing.B) { - benchmarkSize(b, 8192) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block.go deleted file mode 100644 index ca5efd156a9d99d2433b77246acf807647666fc2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !386,!amd64 - -// SHA256 block step. -// In its own file so that a faster assembly or C version -// can be substituted easily. - -package sha256 - -var _K = []uint32{ - 0x428a2f98, - 0x71374491, - 0xb5c0fbcf, - 0xe9b5dba5, - 0x3956c25b, - 0x59f111f1, - 0x923f82a4, - 0xab1c5ed5, - 0xd807aa98, - 0x12835b01, - 0x243185be, - 0x550c7dc3, - 0x72be5d74, - 0x80deb1fe, - 0x9bdc06a7, - 0xc19bf174, - 0xe49b69c1, - 0xefbe4786, - 0x0fc19dc6, - 0x240ca1cc, - 0x2de92c6f, - 0x4a7484aa, - 0x5cb0a9dc, - 0x76f988da, - 0x983e5152, - 0xa831c66d, - 0xb00327c8, - 0xbf597fc7, - 0xc6e00bf3, - 0xd5a79147, - 0x06ca6351, - 0x14292967, - 0x27b70a85, - 0x2e1b2138, - 0x4d2c6dfc, - 0x53380d13, - 0x650a7354, - 0x766a0abb, - 0x81c2c92e, - 0x92722c85, - 0xa2bfe8a1, - 0xa81a664b, - 0xc24b8b70, - 0xc76c51a3, - 0xd192e819, - 0xd6990624, - 0xf40e3585, - 0x106aa070, - 0x19a4c116, - 0x1e376c08, - 0x2748774c, - 0x34b0bcb5, - 0x391c0cb3, - 0x4ed8aa4a, - 0x5b9cca4f, - 0x682e6ff3, - 0x748f82ee, - 0x78a5636f, - 0x84c87814, - 0x8cc70208, - 0x90befffa, - 0xa4506ceb, - 0xbef9a3f7, - 0xc67178f2, -} - -func block(dig *digest, p []byte) { - var w [64]uint32 - h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] - for len(p) >= chunk { - // Can interlace the computation of w with the - // rounds below if needed for speed. - for i := 0; i < 16; i++ { - j := i * 4 - w[i] = uint32(p[j])<<24 | uint32(p[j+1])<<16 | uint32(p[j+2])<<8 | uint32(p[j+3]) - } - for i := 16; i < 64; i++ { - v1 := w[i-2] - t1 := (v1>>17 | v1<<(32-17)) ^ (v1>>19 | v1<<(32-19)) ^ (v1 >> 10) - v2 := w[i-15] - t2 := (v2>>7 | v2<<(32-7)) ^ (v2>>18 | v2<<(32-18)) ^ (v2 >> 3) - w[i] = t1 + w[i-7] + t2 + w[i-16] - } - - a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7 - - for i := 0; i < 64; i++ { - t1 := h + ((e>>6 | e<<(32-6)) ^ (e>>11 | e<<(32-11)) ^ (e>>25 | e<<(32-25))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] - - t2 := ((a>>2 | a<<(32-2)) ^ (a>>13 | a<<(32-13)) ^ (a>>22 | a<<(32-22))) + ((a & b) ^ (a & c) ^ (b & c)) - - h = g - g = f - f = e - e = d + t1 - d = c - c = b - b = a - a = t1 + t2 - } - - h0 += a - h1 += b - h2 += c - h3 += d - h4 += e - h5 += f - h6 += g - h7 += h - - p = p[chunk:] - } - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h0, h1, h2, h3, h4, h5, h6, h7 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block_decl.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block_decl.go deleted file mode 100644 index a50c9787108d3e0a2263a956ae46a9e392944eda..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha256/sha256block_decl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build 386 amd64 - -package sha256 - -//go:noescape - -func block(dig *digest, p []byte) diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512.go deleted file mode 100644 index e7781fd2f41159ba8d03f770a6fe78653acf2cd0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512.go +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 -// hash algorithms as defined in FIPS 180-4. -package sha512 - -import ( - "crypto" - "hash" -) - -func init() { - crypto.RegisterHash(crypto.SHA384, New384) - crypto.RegisterHash(crypto.SHA512, New) - crypto.RegisterHash(crypto.SHA512_224, New512_224) - crypto.RegisterHash(crypto.SHA512_256, New512_256) -} - -const ( - // Size is the size, in bytes, of a SHA-512 checksum. - Size = 64 - - // Size224 is the size, in bytes, of a SHA-512/224 checksum. - Size224 = 28 - - // Size256 is the size, in bytes, of a SHA-512/256 checksum. - Size256 = 32 - - // Size384 is the size, in bytes, of a SHA-384 checksum. - Size384 = 48 - - // BlockSize is the block size, in bytes, of the SHA-512/224, - // SHA-512/256, SHA-384 and SHA-512 hash functions. - BlockSize = 128 -) - -const ( - chunk = 128 - init0 = 0x6a09e667f3bcc908 - init1 = 0xbb67ae8584caa73b - init2 = 0x3c6ef372fe94f82b - init3 = 0xa54ff53a5f1d36f1 - init4 = 0x510e527fade682d1 - init5 = 0x9b05688c2b3e6c1f - init6 = 0x1f83d9abfb41bd6b - init7 = 0x5be0cd19137e2179 - init0_224 = 0x8c3d37c819544da2 - init1_224 = 0x73e1996689dcd4d6 - init2_224 = 0x1dfab7ae32ff9c82 - init3_224 = 0x679dd514582f9fcf - init4_224 = 0x0f6d2b697bd44da8 - init5_224 = 0x77e36f7304c48942 - init6_224 = 0x3f9d85a86a1d36c8 - init7_224 = 0x1112e6ad91d692a1 - init0_256 = 0x22312194fc2bf72c - init1_256 = 0x9f555fa3c84c64c2 - init2_256 = 0x2393b86b6f53b151 - init3_256 = 0x963877195940eabd - init4_256 = 0x96283ee2a88effe3 - init5_256 = 0xbe5e1e2553863992 - init6_256 = 0x2b0199fc2c85b8aa - init7_256 = 0x0eb72ddc81c52ca2 - init0_384 = 0xcbbb9d5dc1059ed8 - init1_384 = 0x629a292a367cd507 - init2_384 = 0x9159015a3070dd17 - init3_384 = 0x152fecd8f70e5939 - init4_384 = 0x67332667ffc00b31 - init5_384 = 0x8eb44a8768581511 - init6_384 = 0xdb0c2e0d64f98fa7 - init7_384 = 0x47b5481dbefa4fa4 -) - -// digest represents the partial evaluation of a checksum. -type digest struct { - h [8]uint64 - x [chunk]byte - nx int - len uint64 - function crypto.Hash -} - -func (d *digest) Reset() { - switch d.function { - case crypto.SHA384: - d.h[0] = init0_384 - d.h[1] = init1_384 - d.h[2] = init2_384 - d.h[3] = init3_384 - d.h[4] = init4_384 - d.h[5] = init5_384 - d.h[6] = init6_384 - d.h[7] = init7_384 - case crypto.SHA512_224: - d.h[0] = init0_224 - d.h[1] = init1_224 - d.h[2] = init2_224 - d.h[3] = init3_224 - d.h[4] = init4_224 - d.h[5] = init5_224 - d.h[6] = init6_224 - d.h[7] = init7_224 - case crypto.SHA512_256: - d.h[0] = init0_256 - d.h[1] = init1_256 - d.h[2] = init2_256 - d.h[3] = init3_256 - d.h[4] = init4_256 - d.h[5] = init5_256 - d.h[6] = init6_256 - d.h[7] = init7_256 - default: - d.h[0] = init0 - d.h[1] = init1 - d.h[2] = init2 - d.h[3] = init3 - d.h[4] = init4 - d.h[5] = init5 - d.h[6] = init6 - d.h[7] = init7 - } - d.nx = 0 - d.len = 0 -} - -// New returns a new hash.Hash computing the SHA-512 checksum. -func New() hash.Hash { - d := &digest{function: crypto.SHA512} - d.Reset() - return d -} - -// New512_224 returns a new hash.Hash computing the SHA-512/224 checksum. -func New512_224() hash.Hash { - d := &digest{function: crypto.SHA512_224} - d.Reset() - return d -} - -// New512_256 returns a new hash.Hash computing the SHA-512/256 checksum. -func New512_256() hash.Hash { - d := &digest{function: crypto.SHA512_256} - d.Reset() - return d -} - -// New384 returns a new hash.Hash computing the SHA-384 checksum. -func New384() hash.Hash { - d := &digest{function: crypto.SHA384} - d.Reset() - return d -} - -func (d *digest) Size() int { - switch d.function { - case crypto.SHA512_224: - return Size224 - case crypto.SHA512_256: - return Size256 - case crypto.SHA384: - return Size384 - default: - return Size - } -} - -func (d *digest) BlockSize() int { return BlockSize } - -func (d *digest) Write(p []byte) (nn int, err error) { - nn = len(p) - d.len += uint64(nn) - if d.nx > 0 { - n := copy(d.x[d.nx:], p) - d.nx += n - if d.nx == chunk { - block(d, d.x[:]) - d.nx = 0 - } - p = p[n:] - } - if len(p) >= chunk { - n := len(p) &^ (chunk - 1) - block(d, p[:n]) - p = p[n:] - } - if len(p) > 0 { - d.nx = copy(d.x[:], p) - } - return -} - -func (d0 *digest) Sum(in []byte) []byte { - // Make a copy of d0 so that caller can keep writing and summing. - d := new(digest) - *d = *d0 - hash := d.checkSum() - switch d.function { - case crypto.SHA384: - return append(in, hash[:Size384]...) - case crypto.SHA512_224: - return append(in, hash[:Size224]...) - case crypto.SHA512_256: - return append(in, hash[:Size256]...) - default: - return append(in, hash[:]...) - } -} - -func (d *digest) checkSum() [Size]byte { - // Padding. Add a 1 bit and 0 bits until 112 bytes mod 128. - len := d.len - var tmp [128]byte - tmp[0] = 0x80 - if len%128 < 112 { - d.Write(tmp[0 : 112-len%128]) - } else { - d.Write(tmp[0 : 128+112-len%128]) - } - - // Length in bits. - len <<= 3 - for i := uint(0); i < 16; i++ { - tmp[i] = byte(len >> (120 - 8*i)) - } - d.Write(tmp[0:16]) - - if d.nx != 0 { - panic("d.nx != 0") - } - - h := d.h[:] - if d.function == crypto.SHA384 { - h = d.h[:6] - } - - var digest [Size]byte - for i, s := range h { - digest[i*8] = byte(s >> 56) - digest[i*8+1] = byte(s >> 48) - digest[i*8+2] = byte(s >> 40) - digest[i*8+3] = byte(s >> 32) - digest[i*8+4] = byte(s >> 24) - digest[i*8+5] = byte(s >> 16) - digest[i*8+6] = byte(s >> 8) - digest[i*8+7] = byte(s) - } - - return digest -} - -// Sum512 returns the SHA512 checksum of the data. -func Sum512(data []byte) [Size]byte { - d := digest{function: crypto.SHA512} - d.Reset() - d.Write(data) - return d.checkSum() -} - -// Sum384 returns the SHA384 checksum of the data. -func Sum384(data []byte) (sum384 [Size384]byte) { - d := digest{function: crypto.SHA384} - d.Reset() - d.Write(data) - sum := d.checkSum() - copy(sum384[:], sum[:Size384]) - return -} - -// Sum512_224 returns the Sum512/224 checksum of the data. -func Sum512_224(data []byte) (sum224 [Size224]byte) { - d := digest{function: crypto.SHA512_224} - d.Reset() - d.Write(data) - sum := d.checkSum() - copy(sum224[:], sum[:Size224]) - return -} - -// Sum512_256 returns the Sum512/256 checksum of the data. -func Sum512_256(data []byte) (sum256 [Size256]byte) { - d := digest{function: crypto.SHA512_256} - d.Reset() - d.Write(data) - sum := d.checkSum() - copy(sum256[:], sum[:Size256]) - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512_test.go deleted file mode 100644 index 04b3d4a3cc0ab12c0ac85a1a5ecdb05addbbb534..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512_test.go +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// SHA512 hash algorithm. See FIPS 180-4. - -package sha512 - -import ( - "encoding/hex" - "hash" - "io" - "testing" -) - -type sha512Test struct { - in string - out224 string - out256 string - out384 string - out512 string -} - -var golden = []sha512Test{ - { - "", - "6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4", - "c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a", - "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", - "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", - }, - { - "a", - "d5cdb9ccc769a5121d4175f2bfdd13d6310e0d3d361ea75d82108327", - "455e518824bc0601f9fb858ff5c37d417d67c2f8e0df2babe4808858aea830f8", - "54a59b9f22b0b80880d8427e548b7c23abd873486e1f035dce9cd697e85175033caa88e6d57bc35efae0b5afd3145f31", - "1f40fc92da241694750979ee6cf582f2d5d7d28e18335de05abc54d0560e0f5302860c652bf08d560252aa5e74210546f369fbbbce8c12cfc7957b2652fe9a75", - }, - { - "ab", - "b35878d07bfedf39fc638af08547eb5d1072d8546319f247b442fbf5", - "22d4d37ec6370571af7109fb12eae79673d5f7c83e6e677083faa3cfac3b2c14", - "c7be03ba5bcaa384727076db0018e99248e1a6e8bd1b9ef58a9ec9dd4eeebb3f48b836201221175befa74ddc3d35afdd", - "2d408a0717ec188158278a796c689044361dc6fdde28d6f04973b80896e1823975cdbf12eb63f9e0591328ee235d80e9b5bf1aa6a44f4617ff3caf6400eb172d", - }, - { - "abc", - "4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa", - "53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23", - "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", - "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", - }, - { - "abcd", - "0c9f157ab030fb06e957c14e3938dc5908962e5dd7b66f04a36fc534", - "d2891c7978be0e24948f37caa415b87cb5cbe2b26b7bad9dc6391b8a6f6ddcc9", - "1165b3406ff0b52a3d24721f785462ca2276c9f454a116c2b2ba20171a7905ea5a026682eb659c4d5f115c363aa3c79b", - "d8022f2060ad6efd297ab73dcc5355c9b214054b0d1776a136a669d26a7d3b14f73aa0d0ebff19ee333368f0164b6419a96da49e3e481753e7e96b716bdccb6f", - }, - { - "abcde", - "880e79bb0a1d2c9b7528d851edb6b8342c58c831de98123b432a4515", - "de8322b46e78b67d4431997070703e9764e03a1237b896fd8b379ed4576e8363", - "4c525cbeac729eaf4b4665815bc5db0c84fe6300068a727cf74e2813521565abc0ec57a37ee4d8be89d097c0d2ad52f0", - "878ae65a92e86cac011a570d4c30a7eaec442b85ce8eca0c2952b5e3cc0628c2e79d889ad4d5c7c626986d452dd86374b6ffaa7cd8b67665bef2289a5c70b0a1", - }, - { - "abcdef", - "236c829cfea4fd6d4de61ad15fcf34dca62342adaf9f2001c16f29b8", - "e4fdcb11d1ac14e698743acd8805174cea5ddc0d312e3e47f6372032571bad84", - "c6a4c65b227e7387b9c3e839d44869c4cfca3ef583dea64117859b808c1e3d8ae689e1e314eeef52a6ffe22681aa11f5", - "e32ef19623e8ed9d267f657a81944b3d07adbb768518068e88435745564e8d4150a0a703be2a7d88b61e3d390c2bb97e2d4c311fdc69d6b1267f05f59aa920e7", - }, - { - "abcdefg", - "4767af672b3ed107f25018dc22d6fa4b07d156e13b720971e2c4f6bf", - "a8117f680bdceb5d1443617cbdae9255f6900075422326a972fdd2f65ba9bee3", - "9f11fc131123f844c1226f429b6a0a6af0525d9f40f056c7fc16cdf1b06bda08e302554417a59fa7dcf6247421959d22", - "d716a4188569b68ab1b6dfac178e570114cdf0ea3a1cc0e31486c3e41241bc6a76424e8c37ab26f096fc85ef9886c8cb634187f4fddff645fb099f1ff54c6b8c", - }, - { - "abcdefgh", - "792e25e0ae286d123a38950007e037d3122e76c4ee201668c385edab", - "a29b9645d2a02a8b582888d044199787220e316bf2e89d1422d3df26bf545bbe", - "9000cd7cada59d1d2eb82912f7f24e5e69cc5517f68283b005fa27c285b61e05edf1ad1a8a9bded6fd29eb87d75ad806", - "a3a8c81bc97c2560010d7389bc88aac974a104e0e2381220c6e084c4dccd1d2d17d4f86db31c2a851dc80e6681d74733c55dcd03dd96f6062cdda12a291ae6ce", - }, - { - "abcdefghi", - "56b275d36127dc070cda4019baf2ce2579a25d8c67fa2bc9be61b539", - "b955095330f9c8188d11884ec1679dc44c9c5b25ff9bda700416df9cdd39188f", - "ef54915b60cf062b8dd0c29ae3cad69abe6310de63ac081f46ef019c5c90897caefd79b796cfa81139788a260ded52df", - "f22d51d25292ca1d0f68f69aedc7897019308cc9db46efb75a03dd494fc7f126c010e8ade6a00a0c1a5f1b75d81e0ed5a93ce98dc9b833db7839247b1d9c24fe", - }, - { - "abcdefghij", - "f809423cbb25e81a2a64aecee2cd5fdc7d91d5db583901fbf1db3116", - "550762913d51eefbcd1a55068fcfc9b154fd11c1078b996df0d926ea59d2a68d", - "a12070030a02d86b0ddacd0d3a5b598344513d0a051e7355053e556a0055489c1555399b03342845c4adde2dc44ff66c", - "ef6b97321f34b1fea2169a7db9e1960b471aa13302a988087357c520be957ca119c3ba68e6b4982c019ec89de3865ccf6a3cda1fe11e59f98d99f1502c8b9745", - }, - { - "Discard medicine more than two years old.", - "4c46e10b5b72204e509c3c06072cea970bc020cd45a61a0acdfa97ac", - "690c8ad3916cefd3ad29226d9875965e3ee9ec0d4482eacc248f2ff4aa0d8e5b", - "86f58ec2d74d1b7f8eb0c2ff0967316699639e8d4eb129de54bdf34c96cdbabe200d052149f2dd787f43571ba74670d4", - "2210d99af9c8bdecda1b4beff822136753d8342505ddce37f1314e2cdbb488c6016bdaa9bd2ffa513dd5de2e4b50f031393d8ab61f773b0e0130d7381e0f8a1d", - }, - { - "He who has a shady past knows that nice guys finish last.", - "cb0cef13c1848d91a6d02637c7c520de1914ad4a7aea824671cc328e", - "25938ca49f7ef1178ce81620842b65e576245fcaed86026a36b516b80bb86b3b", - "ae4a2b639ca9bfa04b1855d5a05fe7f230994f790891c6979103e2605f660c4c1262a48142dcbeb57a1914ba5f7c3fa7", - "a687a8985b4d8d0a24f115fe272255c6afaf3909225838546159c1ed685c211a203796ae8ecc4c81a5b6315919b3a64f10713da07e341fcdbb08541bf03066ce", - }, - { - "I wouldn't marry him with a ten foot pole.", - "6c7bd0f3a6544ea698006c2ea583a85f80ea2913590a186db8bb2f1b", - "698e420c3a7038e53d8e73f4be2b02e03b93464ac1a61ebe69f557079921ef65", - "40ae213df6436eca952aa6841886fcdb82908ef1576a99c8f49bb9dd5023169f7c53035abdda0b54c302f4974e2105e7", - "8ddb0392e818b7d585ab22769a50df660d9f6d559cca3afc5691b8ca91b8451374e42bcdabd64589ed7c91d85f626596228a5c8572677eb98bc6b624befb7af8", - }, - { - "Free! Free!/A trip/to Mars/for 900/empty jars/Burma Shave", - "981323be3eca6ccfa598e58dd74ed8cb05d5f7f6653b7604b684f904", - "839b414d7e3900ee243aa3d1f9b6955720e64041f5ab9bedd3eb0a08da5a2ca8", - "e7cf8b873c9bc950f06259aa54309f349cefa72c00d597aebf903e6519a50011dfe355afff064a10701c705693848df9", - "26ed8f6ca7f8d44b6a8a54ae39640fa8ad5c673f70ee9ce074ba4ef0d483eea00bab2f61d8695d6b34df9c6c48ae36246362200ed820448bdc03a720366a87c6", - }, - { - "The days of the digital watch are numbered. -Tom Stoppard", - "e6fbf82df5138bf361e826903cadf0612cb2986649ba47a57e1bca99", - "5625ecb9d284e54c00b257b67a8cacb25a78db2845c60ef2d29e43c84f236e8e", - "c3d4f0f4047181c7d39d34703365f7bf70207183caf2c2f6145f04da895ef69124d9cdeb635da636c3a474e61024e29b", - "e5a14bf044be69615aade89afcf1ab0389d5fc302a884d403579d1386a2400c089b0dbb387ed0f463f9ee342f8244d5a38cfbc0e819da9529fbff78368c9a982", - }, - { - "Nepal premier won't resign.", - "6ec2cb2ecafc1a9bddaf4caf57344d853e6ded398927d5694fd7714f", - "9b81d06bca2f985e6ad3249096ff3c0f2a9ec5bb16ef530d738d19d81e7806f2", - "a097aab567e167d5cf93676ed73252a69f9687cb3179bb2d27c9878119e94bf7b7c4b58dc90582edfaf66e11388ed714", - "420a1faa48919e14651bed45725abe0f7a58e0f099424c4e5a49194946e38b46c1f8034b18ef169b2e31050d1648e0b982386595f7df47da4b6fd18e55333015", - }, - { - "For every action there is an equal and opposite government program.", - "7f62f36e716e0badaf4a4658da9d09bea26357a1bc6aeb8cf7c3ae35", - "08241df8d91edfcd68bb1a1dada6e0ae1475a5c6e7b8f12d8e24ca43a38240a9", - "5026ca45c41fc64712eb65065da92f6467541c78f8966d3fe2c8e3fb769a3ec14215f819654b47bd64f7f0eac17184f3", - "d926a863beadb20134db07683535c72007b0e695045876254f341ddcccde132a908c5af57baa6a6a9c63e6649bba0c213dc05fadcf9abccea09f23dcfb637fbe", - }, - { - "His money is twice tainted: 'taint yours and 'taint mine.", - "45adffcb86a05ee4d91263a6115dda011b805d442c60836963cb8378", - "4ff74d9213a8117745f5d37b5353a774ec81c5dfe65c4c8986a56fc01f2c551e", - "ac1cc0f5ac8d5f5514a7b738ac322b7fb52a161b449c3672e9b6a6ad1a5e4b26b001cf3bad24c56598676ca17d4b445a", - "9a98dd9bb67d0da7bf83da5313dff4fd60a4bac0094f1b05633690ffa7f6d61de9a1d4f8617937d560833a9aaa9ccafe3fd24db418d0e728833545cadd3ad92d", - }, - { - "There is no reason for any individual to have a computer in their home. -Ken Olsen, 1977", - "51cb518f1f68daa901a3075a0a5e1acc755b4e5c82cb47687537f880", - "b5baf747c307f98849ec881cf0d48605ae4edd386372aea9b26e71db517e650b", - "722d10c5de371ec0c8c4b5247ac8a5f1d240d68c73f8da13d8b25f0166d6f309bf9561979a111a0049405771d201941a", - "d7fde2d2351efade52f4211d3746a0780a26eec3df9b2ed575368a8a1c09ec452402293a8ea4eceb5a4f60064ea29b13cdd86918cd7a4faf366160b009804107", - }, - { - "It's a tiny change to the code and not completely disgusting. - Bob Manchek", - "3b59c5e64b0da7bfc18d7017bf458d90f2c83601ff1afc6263ac0993", - "7eef0538ebd7ecf18611d23b0e1cd26a74d65b929a2e374197dc66e755ca4944", - "dc2d3ea18bfa10549c63bf2b75b39b5167a80c12aff0e05443168ea87ff149fb0eda5e0bd234eb5d48c7d02ffc5807f1", - "b0f35ffa2697359c33a56f5c0cf715c7aeed96da9905ca2698acadb08fbc9e669bf566b6bd5d61a3e86dc22999bcc9f2224e33d1d4f32a228cf9d0349e2db518", - }, - { - "size: a.out: bad magic", - "6a9525c0fac0f91b489bc4f0f539b9ec4a156a4e98bc15b655c2c881", - "d05600964f83f55323104aadab434f32391c029718a7690d08ddb2d7e8708443", - "1d67c969e2a945ae5346d2139760261504d4ba164c522443afe19ef3e29b152a4c52445489cfc9d7215e5a450e8e1e4e", - "3d2e5f91778c9e66f7e061293aaa8a8fc742dd3b2e4f483772464b1144189b49273e610e5cccd7a81a19ca1fa70f16b10f1a100a4d8c1372336be8484c64b311", - }, - { - "The major problem is with sendmail. -Mark Horton", - "a1b2b2905b1527d682049c6a76e35c7d8c72551abfe7833ac1be595f", - "53ed5f9b5c0b674ac0f3425d9f9a5d462655b07cc90f5d0f692eec093884a607", - "5ff8e075e465646e7b73ef36d812c6e9f7d60fa6ea0e533e5569b4f73cde53cdd2cc787f33540af57cca3fe467d32fe0", - "b2f68ff58ac015efb1c94c908b0d8c2bf06f491e4de8e6302c49016f7f8a33eac3e959856c7fddbc464de618701338a4b46f76dbfaf9a1e5262b5f40639771c7", - }, - { - "Give me a rock, paper and scissors and I will move the world. CCFestoon", - "76cf045c76a5f2e3d64d56c3cdba6a25479334611bc375460526f8c1", - "5a0147685a44eea2435dbd582724efca7637acd9c428e5e1a05115bc3bc2a0e0", - "5bd0a997a67c9ae1979a894eb0cde403dde003c9b6f2c03cf21925c42ff4e1176e6df1ca005381612ef18457b9b7ec3b", - "d8c92db5fdf52cf8215e4df3b4909d29203ff4d00e9ad0b64a6a4e04dec5e74f62e7c35c7fb881bd5de95442123df8f57a489b0ae616bd326f84d10021121c57", - }, - { - "If the enemy is within range, then so are you.", - "4473671daeecfdb6f6c5bc06b26374aa5e497cc37119fe14144c430c", - "1152c9b27a99dbf4057d21438f4e63dd0cd0977d5ff12317c64d3b97fcac875a", - "1eee6da33e7e54fc5be52ae23b94b16ba4d2a947ae4505c6a3edfc7401151ea5205ac01b669b56f27d8ef7f175ed7762", - "19a9f8dc0a233e464e8566ad3ca9b91e459a7b8c4780985b015776e1bf239a19bc233d0556343e2b0a9bc220900b4ebf4f8bdf89ff8efeaf79602d6849e6f72e", - }, - { - "It's well we cannot hear the screams/That we create in others' dreams.", - "6accb6394758523fcd453d47d37ebd10868957a0a9e81c796736abf8", - "105e890f5d5cf1748d9a7b4cdaf58b69855779deebc2097747c2210a17b2cb51", - "76b06e9dea66bfbb1a96029426dc0dfd7830bd297eb447ff5358d94a87cd00c88b59df2493fef56ecbb5231073892ea9", - "00b4c41f307bde87301cdc5b5ab1ae9a592e8ecbb2021dd7bc4b34e2ace60741cc362560bec566ba35178595a91932b8d5357e2c9cec92d393b0fa7831852476", - }, - { - "You remind me of a TV show, but that's all right: I watch it anyway.", - "6f173f4b6eac7f2a73eaa0833c4563752df2c869dc00b7d30219e12e", - "74644ead770da1434365cd912656fe1aca2056d3039d39f10eb1151bddb32cf3", - "12acaf21452cff586143e3f5db0bfdf7802c057e1adf2a619031c4e1b0ccc4208cf6cef8fe722bbaa2fb46a30d9135d8", - "91eccc3d5375fd026e4d6787874b1dce201cecd8a27dbded5065728cb2d09c58a3d467bb1faf353bf7ba567e005245d5321b55bc344f7c07b91cb6f26c959be7", - }, - { - "C is as portable as Stonehedge!!", - "db05bf4d0f73325208755f4af96cfac6cb3db5dbfc323d675d68f938", - "50a234625de5587581883dad9ef399460928032a5ea6bd005d7dc7b68d8cc3d6", - "0fc23d7f4183efd186f0bc4fc5db867e026e2146b06cb3d52f4bdbd57d1740122caa853b41868b197b2ac759db39df88", - "fabbbe22180f1f137cfdc9556d2570e775d1ae02a597ded43a72a40f9b485d500043b7be128fb9fcd982b83159a0d99aa855a9e7cc4240c00dc01a9bdf8218d7", - }, - { - "Even if I could be Shakespeare, I think I should still choose to be Faraday. - A. Huxley", - "05ffa71bb02e855de1aaee1777b3bdbaf7507646f19c4c6aa29933d0", - "a7a3846005f8a9935a0a2d43e7fd56d95132a9a3609bf3296ef80b8218acffa0", - "bc805578a7f85d34a86a32976e1c34fe65cf815186fbef76f46ef99cda10723f971f3f1464d488243f5e29db7488598d", - "2ecdec235c1fa4fc2a154d8fba1dddb8a72a1ad73838b51d792331d143f8b96a9f6fcb0f34d7caa351fe6d88771c4f105040e0392f06e0621689d33b2f3ba92e", - }, - { - "The fugacity of a constituent in a mixture of gases at a given temperature is proportional to its mole fraction. Lewis-Randall Rule", - "3ad3c89e15b91e6273534c5d18adadbb528e7b840b288f64e81b8c6d", - "688ff03e367680757aa9906cb1e2ad218c51f4526dc0426ea229a5ba9d002c69", - "b23918399a12ebf4431559eec3813eaf7412e875fd7464f16d581e473330842d2e96c6be49a7ce3f9bb0b8bc0fcbe0fe", - "7ad681f6f96f82f7abfa7ecc0334e8fa16d3dc1cdc45b60b7af43fe4075d2357c0c1d60e98350f1afb1f2fe7a4d7cd2ad55b88e458e06b73c40b437331f5dab4", - }, - { - "How can you write a big system without C++? -Paul Glick", - "e3763669d1b760c1be7bfcb6625f92300a8430419d1dbad57ec9f53c", - "3fa46d52094b01021cff5af9a438982b887a5793f624c0a6644149b6b7c3f485", - "1764b700eb1ead52a2fc33cc28975c2180f1b8faa5038d94cffa8d78154aab16e91dd787e7b0303948ebed62561542c8", - "833f9248ab4a3b9e5131f745fda1ffd2dd435b30e965957e78291c7ab73605fd1912b0794e5c233ab0a12d205a39778d19b83515d6a47003f19cdee51d98c7e0", - }, -} - -func testHash(t *testing.T, name, in, outHex string, oneShotResult []byte, digestFunc hash.Hash) { - if calculated := hex.EncodeToString(oneShotResult); calculated != outHex { - t.Errorf("one-shot result for %s(%q) = %q, but expected %q", name, in, calculated, outHex) - return - } - - for pass := 0; pass < 3; pass++ { - if pass < 2 { - io.WriteString(digestFunc, in) - } else { - io.WriteString(digestFunc, in[:len(in)/2]) - digestFunc.Sum(nil) - io.WriteString(digestFunc, in[len(in)/2:]) - } - - if calculated := hex.EncodeToString(digestFunc.Sum(nil)); calculated != outHex { - t.Errorf("%s(%q) = %q (in pass #%d), but expected %q", name, in, calculated, pass, outHex) - } - digestFunc.Reset() - } -} - -func TestGolden(t *testing.T) { - for _, test := range golden { - in := []byte(test.in) - - sum224 := Sum512_224(in) - sum256 := Sum512_256(in) - sum384 := Sum384(in) - sum512 := Sum512(in) - testHash(t, "SHA512/224", test.in, test.out224, sum224[:], New512_224()) - testHash(t, "SHA512/256", test.in, test.out256, sum256[:], New512_256()) - testHash(t, "SHA384", test.in, test.out384, sum384[:], New384()) - testHash(t, "SHA512", test.in, test.out512, sum512[:], New()) - } -} - -func TestSize(t *testing.T) { - c := New() - if got := c.Size(); got != Size { - t.Errorf("Size = %d; want %d", got, Size) - } - c = New384() - if got := c.Size(); got != Size384 { - t.Errorf("New384.Size = %d; want %d", got, Size384) - } - c = New512_224() - if got := c.Size(); got != Size224 { - t.Errorf("New512224.Size = %d; want %d", got, Size224) - } - c = New512_256() - if got := c.Size(); got != Size256 { - t.Errorf("New512256.Size = %d; want %d", got, Size256) - } -} - -func TestBlockSize(t *testing.T) { - c := New() - if got := c.BlockSize(); got != BlockSize { - t.Errorf("BlockSize = %d; want %d", got, BlockSize) - } -} - -var bench = New() -var buf = make([]byte, 8192) - -func benchmarkSize(b *testing.B, size int) { - b.SetBytes(int64(size)) - sum := make([]byte, bench.Size()) - for i := 0; i < b.N; i++ { - bench.Reset() - bench.Write(buf[:size]) - bench.Sum(sum[:0]) - } -} - -func BenchmarkHash8Bytes(b *testing.B) { - benchmarkSize(b, 8) -} - -func BenchmarkHash1K(b *testing.B) { - benchmarkSize(b, 1024) -} - -func BenchmarkHash8K(b *testing.B) { - benchmarkSize(b, 8192) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block.go deleted file mode 100644 index 648ae8f7e1f436de807b348f3a23e9ff3b86534d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !amd64 - -// SHA512 block step. -// In its own file so that a faster assembly or C version -// can be substituted easily. - -package sha512 - -var _K = []uint64{ - 0x428a2f98d728ae22, - 0x7137449123ef65cd, - 0xb5c0fbcfec4d3b2f, - 0xe9b5dba58189dbbc, - 0x3956c25bf348b538, - 0x59f111f1b605d019, - 0x923f82a4af194f9b, - 0xab1c5ed5da6d8118, - 0xd807aa98a3030242, - 0x12835b0145706fbe, - 0x243185be4ee4b28c, - 0x550c7dc3d5ffb4e2, - 0x72be5d74f27b896f, - 0x80deb1fe3b1696b1, - 0x9bdc06a725c71235, - 0xc19bf174cf692694, - 0xe49b69c19ef14ad2, - 0xefbe4786384f25e3, - 0x0fc19dc68b8cd5b5, - 0x240ca1cc77ac9c65, - 0x2de92c6f592b0275, - 0x4a7484aa6ea6e483, - 0x5cb0a9dcbd41fbd4, - 0x76f988da831153b5, - 0x983e5152ee66dfab, - 0xa831c66d2db43210, - 0xb00327c898fb213f, - 0xbf597fc7beef0ee4, - 0xc6e00bf33da88fc2, - 0xd5a79147930aa725, - 0x06ca6351e003826f, - 0x142929670a0e6e70, - 0x27b70a8546d22ffc, - 0x2e1b21385c26c926, - 0x4d2c6dfc5ac42aed, - 0x53380d139d95b3df, - 0x650a73548baf63de, - 0x766a0abb3c77b2a8, - 0x81c2c92e47edaee6, - 0x92722c851482353b, - 0xa2bfe8a14cf10364, - 0xa81a664bbc423001, - 0xc24b8b70d0f89791, - 0xc76c51a30654be30, - 0xd192e819d6ef5218, - 0xd69906245565a910, - 0xf40e35855771202a, - 0x106aa07032bbd1b8, - 0x19a4c116b8d2d0c8, - 0x1e376c085141ab53, - 0x2748774cdf8eeb99, - 0x34b0bcb5e19b48a8, - 0x391c0cb3c5c95a63, - 0x4ed8aa4ae3418acb, - 0x5b9cca4f7763e373, - 0x682e6ff3d6b2b8a3, - 0x748f82ee5defb2fc, - 0x78a5636f43172f60, - 0x84c87814a1f0ab72, - 0x8cc702081a6439ec, - 0x90befffa23631e28, - 0xa4506cebde82bde9, - 0xbef9a3f7b2c67915, - 0xc67178f2e372532b, - 0xca273eceea26619c, - 0xd186b8c721c0c207, - 0xeada7dd6cde0eb1e, - 0xf57d4f7fee6ed178, - 0x06f067aa72176fba, - 0x0a637dc5a2c898a6, - 0x113f9804bef90dae, - 0x1b710b35131c471b, - 0x28db77f523047d84, - 0x32caab7b40c72493, - 0x3c9ebe0a15c9bebc, - 0x431d67c49c100d4c, - 0x4cc5d4becb3e42b6, - 0x597f299cfc657e2a, - 0x5fcb6fab3ad6faec, - 0x6c44198c4a475817, -} - -func block(dig *digest, p []byte) { - var w [80]uint64 - h0, h1, h2, h3, h4, h5, h6, h7 := dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] - for len(p) >= chunk { - for i := 0; i < 16; i++ { - j := i * 8 - w[i] = uint64(p[j])<<56 | uint64(p[j+1])<<48 | uint64(p[j+2])<<40 | uint64(p[j+3])<<32 | - uint64(p[j+4])<<24 | uint64(p[j+5])<<16 | uint64(p[j+6])<<8 | uint64(p[j+7]) - } - for i := 16; i < 80; i++ { - v1 := w[i-2] - t1 := (v1>>19 | v1<<(64-19)) ^ (v1>>61 | v1<<(64-61)) ^ (v1 >> 6) - v2 := w[i-15] - t2 := (v2>>1 | v2<<(64-1)) ^ (v2>>8 | v2<<(64-8)) ^ (v2 >> 7) - - w[i] = t1 + w[i-7] + t2 + w[i-16] - } - - a, b, c, d, e, f, g, h := h0, h1, h2, h3, h4, h5, h6, h7 - - for i := 0; i < 80; i++ { - t1 := h + ((e>>14 | e<<(64-14)) ^ (e>>18 | e<<(64-18)) ^ (e>>41 | e<<(64-41))) + ((e & f) ^ (^e & g)) + _K[i] + w[i] - - t2 := ((a>>28 | a<<(64-28)) ^ (a>>34 | a<<(64-34)) ^ (a>>39 | a<<(64-39))) + ((a & b) ^ (a & c) ^ (b & c)) - - h = g - g = f - f = e - e = d + t1 - d = c - c = b - b = a - a = t1 + t2 - } - - h0 += a - h1 += b - h2 += c - h3 += d - h4 += e - h5 += f - h6 += g - h7 += h - - p = p[chunk:] - } - - dig.h[0], dig.h[1], dig.h[2], dig.h[3], dig.h[4], dig.h[5], dig.h[6], dig.h[7] = h0, h1, h2, h3, h4, h5, h6, h7 -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block_decl.go b/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block_decl.go deleted file mode 100644 index bef99de2e46148f85ce7f3b24c74a7f91ee72666..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/sha512/sha512block_decl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build amd64 - -package sha512 - -//go:noescape - -func block(dig *digest, p []byte) diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time.go b/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time.go deleted file mode 100644 index 6f80e7c58dc3c8d551b05c8a171b3da9fed6b006..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time.go +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package subtle implements functions that are often useful in cryptographic -// code but require careful thought to use correctly. -package subtle - -// ConstantTimeCompare returns 1 iff the two slices, x -// and y, have equal contents. The time taken is a function of the length of -// the slices and is independent of the contents. -func ConstantTimeCompare(x, y []byte) int { - if len(x) != len(y) { - return 0 - } - - var v byte - - for i := 0; i < len(x); i++ { - v |= x[i] ^ y[i] - } - - return ConstantTimeByteEq(v, 0) -} - -// ConstantTimeSelect returns x if v is 1 and y if v is 0. -// Its behavior is undefined if v takes any other value. -func ConstantTimeSelect(v, x, y int) int { return ^(v-1)&x | (v-1)&y } - -// ConstantTimeByteEq returns 1 if x == y and 0 otherwise. -func ConstantTimeByteEq(x, y uint8) int { - z := ^(x ^ y) - z &= z >> 4 - z &= z >> 2 - z &= z >> 1 - - return int(z) -} - -// ConstantTimeEq returns 1 if x == y and 0 otherwise. -func ConstantTimeEq(x, y int32) int { - z := ^(x ^ y) - z &= z >> 16 - z &= z >> 8 - z &= z >> 4 - z &= z >> 2 - z &= z >> 1 - - return int(z & 1) -} - -// ConstantTimeCopy copies the contents of y into x (a slice of equal length) -// if v == 1. If v == 0, x is left unchanged. Its behavior is undefined if v -// takes any other value. -func ConstantTimeCopy(v int, x, y []byte) { - if len(x) != len(y) { - panic("subtle: slices have different lengths") - } - - xmask := byte(v - 1) - ymask := byte(^(v - 1)) - for i := 0; i < len(x); i++ { - x[i] = x[i]&xmask | y[i]&ymask - } -} - -// ConstantTimeLessOrEq returns 1 if x <= y and 0 otherwise. -// Its behavior is undefined if x or y are negative or > 2**31 - 1. -func ConstantTimeLessOrEq(x, y int) int { - x32 := int32(x) - y32 := int32(y) - return int(((x32 - y32 - 1) >> 31) & 1) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time_test.go deleted file mode 100644 index 619a454441d9570d3e10a1a930dbbdb95c657676..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/subtle/constant_time_test.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package subtle - -import ( - "testing" - "testing/quick" -) - -type TestConstantTimeCompareStruct struct { - a, b []byte - out int -} - -var testConstantTimeCompareData = []TestConstantTimeCompareStruct{ - {[]byte{}, []byte{}, 1}, - {[]byte{0x11}, []byte{0x11}, 1}, - {[]byte{0x12}, []byte{0x11}, 0}, - {[]byte{0x11}, []byte{0x11, 0x12}, 0}, - {[]byte{0x11, 0x12}, []byte{0x11}, 0}, -} - -func TestConstantTimeCompare(t *testing.T) { - for i, test := range testConstantTimeCompareData { - if r := ConstantTimeCompare(test.a, test.b); r != test.out { - t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) - } - } -} - -type TestConstantTimeByteEqStruct struct { - a, b uint8 - out int -} - -var testConstandTimeByteEqData = []TestConstantTimeByteEqStruct{ - {0, 0, 1}, - {0, 1, 0}, - {1, 0, 0}, - {0xff, 0xff, 1}, - {0xff, 0xfe, 0}, -} - -func byteEq(a, b uint8) int { - if a == b { - return 1 - } - return 0 -} - -func TestConstantTimeByteEq(t *testing.T) { - for i, test := range testConstandTimeByteEqData { - if r := ConstantTimeByteEq(test.a, test.b); r != test.out { - t.Errorf("#%d bad result (got %x, want %x)", i, r, test.out) - } - } - err := quick.CheckEqual(ConstantTimeByteEq, byteEq, nil) - if err != nil { - t.Error(err) - } -} - -func eq(a, b int32) int { - if a == b { - return 1 - } - return 0 -} - -func TestConstantTimeEq(t *testing.T) { - err := quick.CheckEqual(ConstantTimeEq, eq, nil) - if err != nil { - t.Error(err) - } -} - -func makeCopy(v int, x, y []byte) []byte { - if len(x) > len(y) { - x = x[0:len(y)] - } else { - y = y[0:len(x)] - } - if v == 1 { - copy(x, y) - } - return x -} - -func constantTimeCopyWrapper(v int, x, y []byte) []byte { - if len(x) > len(y) { - x = x[0:len(y)] - } else { - y = y[0:len(x)] - } - v &= 1 - ConstantTimeCopy(v, x, y) - return x -} - -func TestConstantTimeCopy(t *testing.T) { - err := quick.CheckEqual(constantTimeCopyWrapper, makeCopy, nil) - if err != nil { - t.Error(err) - } -} - -var lessOrEqTests = []struct { - x, y, result int -}{ - {0, 0, 1}, - {1, 0, 0}, - {0, 1, 1}, - {10, 20, 1}, - {20, 10, 0}, - {10, 10, 1}, -} - -func TestConstantTimeLessOrEq(t *testing.T) { - for i, test := range lessOrEqTests { - result := ConstantTimeLessOrEq(test.x, test.y) - if result != test.result { - t.Errorf("#%d: %d <= %d gave %d, expected %d", i, test.x, test.y, result, test.result) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/alert.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/alert.go deleted file mode 100644 index 3de4834d3f5b83ec3165396788345bd6fe612c0b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/alert.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import "strconv" - -type alert uint8 - -const ( - // alert level - alertLevelWarning = 1 - alertLevelError = 2 -) - -const ( - alertCloseNotify alert = 0 - alertUnexpectedMessage alert = 10 - alertBadRecordMAC alert = 20 - alertDecryptionFailed alert = 21 - alertRecordOverflow alert = 22 - alertDecompressionFailure alert = 30 - alertHandshakeFailure alert = 40 - alertBadCertificate alert = 42 - alertUnsupportedCertificate alert = 43 - alertCertificateRevoked alert = 44 - alertCertificateExpired alert = 45 - alertCertificateUnknown alert = 46 - alertIllegalParameter alert = 47 - alertUnknownCA alert = 48 - alertAccessDenied alert = 49 - alertDecodeError alert = 50 - alertDecryptError alert = 51 - alertProtocolVersion alert = 70 - alertInsufficientSecurity alert = 71 - alertInternalError alert = 80 - alertInappropriateFallback alert = 86 - alertUserCanceled alert = 90 - alertNoRenegotiation alert = 100 -) - -var alertText = map[alert]string{ - alertCloseNotify: "close notify", - alertUnexpectedMessage: "unexpected message", - alertBadRecordMAC: "bad record MAC", - alertDecryptionFailed: "decryption failed", - alertRecordOverflow: "record overflow", - alertDecompressionFailure: "decompression failure", - alertHandshakeFailure: "handshake failure", - alertBadCertificate: "bad certificate", - alertUnsupportedCertificate: "unsupported certificate", - alertCertificateRevoked: "revoked certificate", - alertCertificateExpired: "expired certificate", - alertCertificateUnknown: "unknown certificate", - alertIllegalParameter: "illegal parameter", - alertUnknownCA: "unknown certificate authority", - alertAccessDenied: "access denied", - alertDecodeError: "error decoding message", - alertDecryptError: "error decrypting message", - alertProtocolVersion: "protocol version not supported", - alertInsufficientSecurity: "insufficient security level", - alertInternalError: "internal error", - alertInappropriateFallback: "inappropriate fallback", - alertUserCanceled: "user canceled", - alertNoRenegotiation: "no renegotiation", -} - -func (e alert) String() string { - s, ok := alertText[e] - if ok { - return s - } - return "alert(" + strconv.Itoa(int(e)) + ")" -} - -func (e alert) Error() string { - return e.String() -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/cipher_suites.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/cipher_suites.go deleted file mode 100644 index a5fed29375243eda07383e11dbb503328faf0bc5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/cipher_suites.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/des" - "crypto/hmac" - "crypto/rc4" - "crypto/sha1" - "crypto/x509" - "hash" -) - -// a keyAgreement implements the client and server side of a TLS key agreement -// protocol by generating and processing key exchange messages. -type keyAgreement interface { - // On the server side, the first two methods are called in order. - - // In the case that the key agreement protocol doesn't use a - // ServerKeyExchange message, generateServerKeyExchange can return nil, - // nil. - generateServerKeyExchange(*Config, *Certificate, *clientHelloMsg, *serverHelloMsg) (*serverKeyExchangeMsg, error) - processClientKeyExchange(*Config, *Certificate, *clientKeyExchangeMsg, uint16) ([]byte, error) - - // On the client side, the next two methods are called in order. - - // This method may not be called if the server doesn't send a - // ServerKeyExchange message. - processServerKeyExchange(*Config, *clientHelloMsg, *serverHelloMsg, *x509.Certificate, *serverKeyExchangeMsg) error - generateClientKeyExchange(*Config, *clientHelloMsg, *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) -} - -const ( - // suiteECDH indicates that the cipher suite involves elliptic curve - // Diffie-Hellman. This means that it should only be selected when the - // client indicates that it supports ECC with a curve and point format - // that we're happy with. - suiteECDHE = 1 << iota - // suiteECDSA indicates that the cipher suite involves an ECDSA - // signature and therefore may only be selected when the server's - // certificate is ECDSA. If this is not set then the cipher suite is - // RSA based. - suiteECDSA - // suiteTLS12 indicates that the cipher suite should only be advertised - // and accepted when using TLS 1.2. - suiteTLS12 - // suiteSHA384 indicates that the cipher suite uses SHA384 as the - // handshake hash. - suiteSHA384 - // suiteDefaultOff indicates that this cipher suite is not included by - // default. - suiteDefaultOff -) - -// A cipherSuite is a specific combination of key agreement, cipher and MAC -// function. All cipher suites currently assume RSA key agreement. -type cipherSuite struct { - id uint16 - // the lengths, in bytes, of the key material needed for each component. - keyLen int - macLen int - ivLen int - ka func(version uint16) keyAgreement - // flags is a bitmask of the suite* values, above. - flags int - cipher func(key, iv []byte, isRead bool) interface{} - mac func(version uint16, macKey []byte) macFunction - aead func(key, fixedNonce []byte) cipher.AEAD -} - -var cipherSuites = []*cipherSuite{ - // Ciphersuite order is chosen so that ECDHE comes before plain RSA - // and RC4 comes before AES (because of the Lucky13 attack). - {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 16, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12, nil, nil, aeadAESGCM}, - {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheRSAKA, suiteECDHE | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, 32, 0, 4, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteTLS12 | suiteSHA384, nil, nil, aeadAESGCM}, - {TLS_ECDHE_RSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheRSAKA, suiteECDHE | suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, 16, 20, 0, ecdheECDSAKA, suiteECDHE | suiteECDSA | suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, 16, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheRSAKA, suiteECDHE, cipherAES, macSHA1, nil}, - {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, 32, 20, 16, ecdheECDSAKA, suiteECDHE | suiteECDSA, cipherAES, macSHA1, nil}, - {TLS_RSA_WITH_RC4_128_SHA, 16, 20, 0, rsaKA, suiteDefaultOff, cipherRC4, macSHA1, nil}, - {TLS_RSA_WITH_AES_128_CBC_SHA, 16, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, - {TLS_RSA_WITH_AES_256_CBC_SHA, 32, 20, 16, rsaKA, 0, cipherAES, macSHA1, nil}, - {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, ecdheRSAKA, suiteECDHE, cipher3DES, macSHA1, nil}, - {TLS_RSA_WITH_3DES_EDE_CBC_SHA, 24, 20, 8, rsaKA, 0, cipher3DES, macSHA1, nil}, -} - -func cipherRC4(key, iv []byte, isRead bool) interface{} { - cipher, _ := rc4.NewCipher(key) - return cipher -} - -func cipher3DES(key, iv []byte, isRead bool) interface{} { - block, _ := des.NewTripleDESCipher(key) - if isRead { - return cipher.NewCBCDecrypter(block, iv) - } - return cipher.NewCBCEncrypter(block, iv) -} - -func cipherAES(key, iv []byte, isRead bool) interface{} { - block, _ := aes.NewCipher(key) - if isRead { - return cipher.NewCBCDecrypter(block, iv) - } - return cipher.NewCBCEncrypter(block, iv) -} - -// macSHA1 returns a macFunction for the given protocol version. -func macSHA1(version uint16, key []byte) macFunction { - if version == VersionSSL30 { - mac := ssl30MAC{ - h: sha1.New(), - key: make([]byte, len(key)), - } - copy(mac.key, key) - return mac - } - return tls10MAC{hmac.New(sha1.New, key)} -} - -type macFunction interface { - Size() int - MAC(digestBuf, seq, header, data []byte) []byte -} - -// fixedNonceAEAD wraps an AEAD and prefixes a fixed portion of the nonce to -// each call. -type fixedNonceAEAD struct { - // sealNonce and openNonce are buffers where the larger nonce will be - // constructed. Since a seal and open operation may be running - // concurrently, there is a separate buffer for each. - sealNonce, openNonce []byte - aead cipher.AEAD -} - -func (f *fixedNonceAEAD) NonceSize() int { return 8 } -func (f *fixedNonceAEAD) Overhead() int { return f.aead.Overhead() } - -func (f *fixedNonceAEAD) Seal(out, nonce, plaintext, additionalData []byte) []byte { - copy(f.sealNonce[len(f.sealNonce)-8:], nonce) - return f.aead.Seal(out, f.sealNonce, plaintext, additionalData) -} - -func (f *fixedNonceAEAD) Open(out, nonce, plaintext, additionalData []byte) ([]byte, error) { - copy(f.openNonce[len(f.openNonce)-8:], nonce) - return f.aead.Open(out, f.openNonce, plaintext, additionalData) -} - -func aeadAESGCM(key, fixedNonce []byte) cipher.AEAD { - aes, err := aes.NewCipher(key) - if err != nil { - panic(err) - } - aead, err := cipher.NewGCM(aes) - if err != nil { - panic(err) - } - - nonce1, nonce2 := make([]byte, 12), make([]byte, 12) - copy(nonce1, fixedNonce) - copy(nonce2, fixedNonce) - - return &fixedNonceAEAD{nonce1, nonce2, aead} -} - -// ssl30MAC implements the SSLv3 MAC function, as defined in -// www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt section 5.2.3.1 -type ssl30MAC struct { - h hash.Hash - key []byte -} - -func (s ssl30MAC) Size() int { - return s.h.Size() -} - -var ssl30Pad1 = [48]byte{0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36} - -var ssl30Pad2 = [48]byte{0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c} - -func (s ssl30MAC) MAC(digestBuf, seq, header, data []byte) []byte { - padLength := 48 - if s.h.Size() == 20 { - padLength = 40 - } - - s.h.Reset() - s.h.Write(s.key) - s.h.Write(ssl30Pad1[:padLength]) - s.h.Write(seq) - s.h.Write(header[:1]) - s.h.Write(header[3:5]) - s.h.Write(data) - digestBuf = s.h.Sum(digestBuf[:0]) - - s.h.Reset() - s.h.Write(s.key) - s.h.Write(ssl30Pad2[:padLength]) - s.h.Write(digestBuf) - return s.h.Sum(digestBuf[:0]) -} - -// tls10MAC implements the TLS 1.0 MAC function. RFC 2246, section 6.2.3. -type tls10MAC struct { - h hash.Hash -} - -func (s tls10MAC) Size() int { - return s.h.Size() -} - -func (s tls10MAC) MAC(digestBuf, seq, header, data []byte) []byte { - s.h.Reset() - s.h.Write(seq) - s.h.Write(header) - s.h.Write(data) - return s.h.Sum(digestBuf[:0]) -} - -func rsaKA(version uint16) keyAgreement { - return rsaKeyAgreement{} -} - -func ecdheECDSAKA(version uint16) keyAgreement { - return &ecdheKeyAgreement{ - sigType: signatureECDSA, - version: version, - } -} - -func ecdheRSAKA(version uint16) keyAgreement { - return &ecdheKeyAgreement{ - sigType: signatureRSA, - version: version, - } -} - -// mutualCipherSuite returns a cipherSuite given a list of supported -// ciphersuites and the id requested by the peer. -func mutualCipherSuite(have []uint16, want uint16) *cipherSuite { - for _, id := range have { - if id == want { - for _, suite := range cipherSuites { - if suite.id == want { - return suite - } - } - return nil - } - } - return nil -} - -// A list of the possible cipher suite ids. Taken from -// http://www.iana.org/assignments/tls-parameters/tls-parameters.xml -const ( - TLS_RSA_WITH_RC4_128_SHA uint16 = 0x0005 - TLS_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0x000a - TLS_RSA_WITH_AES_128_CBC_SHA uint16 = 0x002f - TLS_RSA_WITH_AES_256_CBC_SHA uint16 = 0x0035 - TLS_ECDHE_ECDSA_WITH_RC4_128_SHA uint16 = 0xc007 - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA uint16 = 0xc009 - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA uint16 = 0xc00a - TLS_ECDHE_RSA_WITH_RC4_128_SHA uint16 = 0xc011 - TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA uint16 = 0xc012 - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA uint16 = 0xc013 - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16 = 0xc014 - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02f - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 uint16 = 0xc02b - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc030 - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 uint16 = 0xc02c - - // TLS_FALLBACK_SCSV isn't a standard cipher suite but an indicator - // that the client is doing version fallback. See - // https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00. - TLS_FALLBACK_SCSV uint16 = 0x5600 -) diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/common.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/common.go deleted file mode 100644 index a3d75d69cbfadf33acc4a6726cd0f340c799f32f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/common.go +++ /dev/null @@ -1,712 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "container/list" - "crypto" - "crypto/rand" - "crypto/sha512" - "crypto/x509" - "errors" - "fmt" - "io" - "math/big" - "strings" - "sync" - "time" -) - -const ( - VersionSSL30 = 0x0300 - VersionTLS10 = 0x0301 - VersionTLS11 = 0x0302 - VersionTLS12 = 0x0303 -) - -const ( - maxPlaintext = 16384 // maximum plaintext payload length - maxCiphertext = 16384 + 2048 // maximum ciphertext payload length - recordHeaderLen = 5 // record header length - maxHandshake = 65536 // maximum handshake we support (protocol max is 16 MB) - - minVersion = VersionTLS10 - maxVersion = VersionTLS12 -) - -// TLS record types. -type recordType uint8 - -const ( - recordTypeChangeCipherSpec recordType = 20 - recordTypeAlert recordType = 21 - recordTypeHandshake recordType = 22 - recordTypeApplicationData recordType = 23 -) - -// TLS handshake message types. -const ( - typeClientHello uint8 = 1 - typeServerHello uint8 = 2 - typeNewSessionTicket uint8 = 4 - typeCertificate uint8 = 11 - typeServerKeyExchange uint8 = 12 - typeCertificateRequest uint8 = 13 - typeServerHelloDone uint8 = 14 - typeCertificateVerify uint8 = 15 - typeClientKeyExchange uint8 = 16 - typeFinished uint8 = 20 - typeCertificateStatus uint8 = 22 - typeNextProtocol uint8 = 67 // Not IANA assigned -) - -// TLS compression types. -const ( - compressionNone uint8 = 0 -) - -// TLS extension numbers -const ( - extensionServerName uint16 = 0 - extensionStatusRequest uint16 = 5 - extensionSupportedCurves uint16 = 10 - extensionSupportedPoints uint16 = 11 - extensionSignatureAlgorithms uint16 = 13 - extensionALPN uint16 = 16 - extensionSCT uint16 = 18 // https://tools.ietf.org/html/rfc6962#section-6 - extensionSessionTicket uint16 = 35 - extensionNextProtoNeg uint16 = 13172 // not IANA assigned - extensionRenegotiationInfo uint16 = 0xff01 -) - -// TLS signaling cipher suite values -const ( - scsvRenegotiation uint16 = 0x00ff -) - -// CurveID is the type of a TLS identifier for an elliptic curve. See -// http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-8 -type CurveID uint16 - -const ( - CurveP256 CurveID = 23 - CurveP384 CurveID = 24 - CurveP521 CurveID = 25 -) - -// TLS Elliptic Curve Point Formats -// http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-9 -const ( - pointFormatUncompressed uint8 = 0 -) - -// TLS CertificateStatusType (RFC 3546) -const ( - statusTypeOCSP uint8 = 1 -) - -// Certificate types (for certificateRequestMsg) -const ( - certTypeRSASign = 1 // A certificate containing an RSA key - certTypeDSSSign = 2 // A certificate containing a DSA key - certTypeRSAFixedDH = 3 // A certificate containing a static DH key - certTypeDSSFixedDH = 4 // A certificate containing a static DH key - - // See RFC4492 sections 3 and 5.5. - certTypeECDSASign = 64 // A certificate containing an ECDSA-capable public key, signed with ECDSA. - certTypeRSAFixedECDH = 65 // A certificate containing an ECDH-capable public key, signed with RSA. - certTypeECDSAFixedECDH = 66 // A certificate containing an ECDH-capable public key, signed with ECDSA. - - // Rest of these are reserved by the TLS spec -) - -// Hash functions for TLS 1.2 (See RFC 5246, section A.4.1) -const ( - hashSHA1 uint8 = 2 - hashSHA256 uint8 = 4 - hashSHA384 uint8 = 5 -) - -// Signature algorithms for TLS 1.2 (See RFC 5246, section A.4.1) -const ( - signatureRSA uint8 = 1 - signatureECDSA uint8 = 3 -) - -// signatureAndHash mirrors the TLS 1.2, SignatureAndHashAlgorithm struct. See -// RFC 5246, section A.4.1. -type signatureAndHash struct { - hash, signature uint8 -} - -// supportedSignatureAlgorithms contains the signature and hash algorithms that -// the code advertises as supported in a TLS 1.2 ClientHello and in a TLS 1.2 -// CertificateRequest. -var supportedSignatureAlgorithms = []signatureAndHash{ - {hashSHA256, signatureRSA}, - {hashSHA256, signatureECDSA}, - {hashSHA384, signatureRSA}, - {hashSHA384, signatureECDSA}, - {hashSHA1, signatureRSA}, - {hashSHA1, signatureECDSA}, -} - -// ConnectionState records basic TLS details about the connection. -type ConnectionState struct { - Version uint16 // TLS version used by the connection (e.g. VersionTLS12) - HandshakeComplete bool // TLS handshake is complete - DidResume bool // connection resumes a previous TLS connection - CipherSuite uint16 // cipher suite in use (TLS_RSA_WITH_RC4_128_SHA, ...) - NegotiatedProtocol string // negotiated next protocol (from Config.NextProtos) - NegotiatedProtocolIsMutual bool // negotiated protocol was advertised by server - ServerName string // server name requested by client, if any (server side only) - PeerCertificates []*x509.Certificate // certificate chain presented by remote peer - VerifiedChains [][]*x509.Certificate // verified chains built from PeerCertificates - SignedCertificateTimestamps [][]byte // SCTs from the server, if any - OCSPResponse []byte // stapled OCSP response from server, if any - - // TLSUnique contains the "tls-unique" channel binding value (see RFC - // 5929, section 3). For resumed sessions this value will be nil - // because resumption does not include enough context (see - // https://secure-resumption.com/#channelbindings). This will change in - // future versions of Go once the TLS master-secret fix has been - // standardized and implemented. - TLSUnique []byte -} - -// ClientAuthType declares the policy the server will follow for -// TLS Client Authentication. -type ClientAuthType int - -const ( - NoClientCert ClientAuthType = iota - RequestClientCert - RequireAnyClientCert - VerifyClientCertIfGiven - RequireAndVerifyClientCert -) - -// ClientSessionState contains the state needed by clients to resume TLS -// sessions. -type ClientSessionState struct { - sessionTicket []uint8 // Encrypted ticket used for session resumption with server - vers uint16 // SSL/TLS version negotiated for the session - cipherSuite uint16 // Ciphersuite negotiated for the session - masterSecret []byte // MasterSecret generated by client on a full handshake - serverCertificates []*x509.Certificate // Certificate chain presented by the server - verifiedChains [][]*x509.Certificate // Certificate chains we built for verification -} - -// ClientSessionCache is a cache of ClientSessionState objects that can be used -// by a client to resume a TLS session with a given server. ClientSessionCache -// implementations should expect to be called concurrently from different -// goroutines. -type ClientSessionCache interface { - // Get searches for a ClientSessionState associated with the given key. - // On return, ok is true if one was found. - Get(sessionKey string) (session *ClientSessionState, ok bool) - - // Put adds the ClientSessionState to the cache with the given key. - Put(sessionKey string, cs *ClientSessionState) -} - -// ClientHelloInfo contains information from a ClientHello message in order to -// guide certificate selection in the GetCertificate callback. -type ClientHelloInfo struct { - // CipherSuites lists the CipherSuites supported by the client (e.g. - // TLS_RSA_WITH_RC4_128_SHA). - CipherSuites []uint16 - - // ServerName indicates the name of the server requested by the client - // in order to support virtual hosting. ServerName is only set if the - // client is using SNI (see - // http://tools.ietf.org/html/rfc4366#section-3.1). - ServerName string - - // SupportedCurves lists the elliptic curves supported by the client. - // SupportedCurves is set only if the Supported Elliptic Curves - // Extension is being used (see - // http://tools.ietf.org/html/rfc4492#section-5.1.1). - SupportedCurves []CurveID - - // SupportedPoints lists the point formats supported by the client. - // SupportedPoints is set only if the Supported Point Formats Extension - // is being used (see - // http://tools.ietf.org/html/rfc4492#section-5.1.2). - SupportedPoints []uint8 -} - -// A Config structure is used to configure a TLS client or server. -// After one has been passed to a TLS function it must not be -// modified. A Config may be reused; the tls package will also not -// modify it. -type Config struct { - // Rand provides the source of entropy for nonces and RSA blinding. - // If Rand is nil, TLS uses the cryptographic random reader in package - // crypto/rand. - // The Reader must be safe for use by multiple goroutines. - Rand io.Reader - - // Time returns the current time as the number of seconds since the epoch. - // If Time is nil, TLS uses time.Now. - Time func() time.Time - - // Certificates contains one or more certificate chains - // to present to the other side of the connection. - // Server configurations must include at least one certificate. - Certificates []Certificate - - // NameToCertificate maps from a certificate name to an element of - // Certificates. Note that a certificate name can be of the form - // '*.example.com' and so doesn't have to be a domain name as such. - // See Config.BuildNameToCertificate - // The nil value causes the first element of Certificates to be used - // for all connections. - NameToCertificate map[string]*Certificate - - // GetCertificate returns a Certificate based on the given - // ClientHelloInfo. It will only be called if the client supplies SNI - // information or if Certificates is empty. - // - // If GetCertificate is nil or returns nil, then the certificate is - // retrieved from NameToCertificate. If NameToCertificate is nil, the - // first element of Certificates will be used. - GetCertificate func(clientHello *ClientHelloInfo) (*Certificate, error) - - // RootCAs defines the set of root certificate authorities - // that clients use when verifying server certificates. - // If RootCAs is nil, TLS uses the host's root CA set. - RootCAs *x509.CertPool - - // NextProtos is a list of supported, application level protocols. - NextProtos []string - - // ServerName is used to verify the hostname on the returned - // certificates unless InsecureSkipVerify is given. It is also included - // in the client's handshake to support virtual hosting. - ServerName string - - // ClientAuth determines the server's policy for - // TLS Client Authentication. The default is NoClientCert. - ClientAuth ClientAuthType - - // ClientCAs defines the set of root certificate authorities - // that servers use if required to verify a client certificate - // by the policy in ClientAuth. - ClientCAs *x509.CertPool - - // InsecureSkipVerify controls whether a client verifies the - // server's certificate chain and host name. - // If InsecureSkipVerify is true, TLS accepts any certificate - // presented by the server and any host name in that certificate. - // In this mode, TLS is susceptible to man-in-the-middle attacks. - // This should be used only for testing. - InsecureSkipVerify bool - - // CipherSuites is a list of supported cipher suites. If CipherSuites - // is nil, TLS uses a list of suites supported by the implementation. - CipherSuites []uint16 - - // PreferServerCipherSuites controls whether the server selects the - // client's most preferred ciphersuite, or the server's most preferred - // ciphersuite. If true then the server's preference, as expressed in - // the order of elements in CipherSuites, is used. - PreferServerCipherSuites bool - - // SessionTicketsDisabled may be set to true to disable session ticket - // (resumption) support. - SessionTicketsDisabled bool - - // SessionTicketKey is used by TLS servers to provide session - // resumption. See RFC 5077. If zero, it will be filled with - // random data before the first server handshake. - // - // If multiple servers are terminating connections for the same host - // they should all have the same SessionTicketKey. If the - // SessionTicketKey leaks, previously recorded and future TLS - // connections using that key are compromised. - SessionTicketKey [32]byte - - // SessionCache is a cache of ClientSessionState entries for TLS session - // resumption. - ClientSessionCache ClientSessionCache - - // MinVersion contains the minimum SSL/TLS version that is acceptable. - // If zero, then TLS 1.0 is taken as the minimum. - MinVersion uint16 - - // MaxVersion contains the maximum SSL/TLS version that is acceptable. - // If zero, then the maximum version supported by this package is used, - // which is currently TLS 1.2. - MaxVersion uint16 - - // CurvePreferences contains the elliptic curves that will be used in - // an ECDHE handshake, in preference order. If empty, the default will - // be used. - CurvePreferences []CurveID - - serverInitOnce sync.Once // guards calling (*Config).serverInit - - // mutex protects sessionTicketKeys - mutex sync.RWMutex - // sessionTicketKeys contains zero or more ticket keys. If the length - // is zero, SessionTicketsDisabled must be true. The first key is used - // for new tickets and any subsequent keys can be used to decrypt old - // tickets. - sessionTicketKeys []ticketKey -} - -// ticketKeyNameLen is the number of bytes of identifier that is prepended to -// an encrypted session ticket in order to identify the key used to encrypt it. -const ticketKeyNameLen = 16 - -// ticketKey is the internal representation of a session ticket key. -type ticketKey struct { - // keyName is an opaque byte string that serves to identify the session - // ticket key. It's exposed as plaintext in every session ticket. - keyName [ticketKeyNameLen]byte - aesKey [16]byte - hmacKey [16]byte -} - -// ticketKeyFromBytes converts from the external representation of a session -// ticket key to a ticketKey. Externally, session ticket keys are 32 random -// bytes and this function expands that into sufficient name and key material. -func ticketKeyFromBytes(b [32]byte) (key ticketKey) { - hashed := sha512.Sum512(b[:]) - copy(key.keyName[:], hashed[:ticketKeyNameLen]) - copy(key.aesKey[:], hashed[ticketKeyNameLen:ticketKeyNameLen+16]) - copy(key.hmacKey[:], hashed[ticketKeyNameLen+16:ticketKeyNameLen+32]) - return key -} - -func (c *Config) serverInit() { - if c.SessionTicketsDisabled { - return - } - - alreadySet := false - for _, b := range c.SessionTicketKey { - if b != 0 { - alreadySet = true - break - } - } - - if !alreadySet { - if _, err := io.ReadFull(c.rand(), c.SessionTicketKey[:]); err != nil { - c.SessionTicketsDisabled = true - return - } - } - - c.sessionTicketKeys = []ticketKey{ticketKeyFromBytes(c.SessionTicketKey)} -} - -func (c *Config) ticketKeys() []ticketKey { - c.mutex.RLock() - // c.sessionTicketKeys is constant once created. SetSessionTicketKeys - // will only update it by replacing it with a new value. - ret := c.sessionTicketKeys - c.mutex.RUnlock() - return ret -} - -// SetSessionTicketKeys updates the session ticket keys for a server. The first -// key will be used when creating new tickets, while all keys can be used for -// decrypting tickets. It is safe to call this function while the server is -// running in order to rotate the session ticket keys. The function will panic -// if keys is empty. -func (c *Config) SetSessionTicketKeys(keys [][32]byte) { - if len(keys) == 0 { - panic("tls: keys must have at least one key") - } - - newKeys := make([]ticketKey, len(keys)) - for i, bytes := range keys { - newKeys[i] = ticketKeyFromBytes(bytes) - } - - c.mutex.Lock() - c.sessionTicketKeys = newKeys - c.mutex.Unlock() -} - -func (c *Config) rand() io.Reader { - r := c.Rand - if r == nil { - return rand.Reader - } - return r -} - -func (c *Config) time() time.Time { - t := c.Time - if t == nil { - t = time.Now - } - return t() -} - -func (c *Config) cipherSuites() []uint16 { - s := c.CipherSuites - if s == nil { - s = defaultCipherSuites() - } - return s -} - -func (c *Config) minVersion() uint16 { - if c == nil || c.MinVersion == 0 { - return minVersion - } - return c.MinVersion -} - -func (c *Config) maxVersion() uint16 { - if c == nil || c.MaxVersion == 0 { - return maxVersion - } - return c.MaxVersion -} - -var defaultCurvePreferences = []CurveID{CurveP256, CurveP384, CurveP521} - -func (c *Config) curvePreferences() []CurveID { - if c == nil || len(c.CurvePreferences) == 0 { - return defaultCurvePreferences - } - return c.CurvePreferences -} - -// mutualVersion returns the protocol version to use given the advertised -// version of the peer. -func (c *Config) mutualVersion(vers uint16) (uint16, bool) { - minVersion := c.minVersion() - maxVersion := c.maxVersion() - - if vers < minVersion { - return 0, false - } - if vers > maxVersion { - vers = maxVersion - } - return vers, true -} - -// getCertificate returns the best certificate for the given ClientHelloInfo, -// defaulting to the first element of c.Certificates. -func (c *Config) getCertificate(clientHello *ClientHelloInfo) (*Certificate, error) { - if c.GetCertificate != nil && - (len(c.Certificates) == 0 || len(clientHello.ServerName) > 0) { - cert, err := c.GetCertificate(clientHello) - if cert != nil || err != nil { - return cert, err - } - } - - if len(c.Certificates) == 0 { - return nil, errors.New("crypto/tls: no certificates configured") - } - - if len(c.Certificates) == 1 || c.NameToCertificate == nil { - // There's only one choice, so no point doing any work. - return &c.Certificates[0], nil - } - - name := strings.ToLower(clientHello.ServerName) - for len(name) > 0 && name[len(name)-1] == '.' { - name = name[:len(name)-1] - } - - if cert, ok := c.NameToCertificate[name]; ok { - return cert, nil - } - - // try replacing labels in the name with wildcards until we get a - // match. - labels := strings.Split(name, ".") - for i := range labels { - labels[i] = "*" - candidate := strings.Join(labels, ".") - if cert, ok := c.NameToCertificate[candidate]; ok { - return cert, nil - } - } - - // If nothing matches, return the first certificate. - return &c.Certificates[0], nil -} - -// BuildNameToCertificate parses c.Certificates and builds c.NameToCertificate -// from the CommonName and SubjectAlternateName fields of each of the leaf -// certificates. -func (c *Config) BuildNameToCertificate() { - c.NameToCertificate = make(map[string]*Certificate) - for i := range c.Certificates { - cert := &c.Certificates[i] - x509Cert, err := x509.ParseCertificate(cert.Certificate[0]) - if err != nil { - continue - } - if len(x509Cert.Subject.CommonName) > 0 { - c.NameToCertificate[x509Cert.Subject.CommonName] = cert - } - for _, san := range x509Cert.DNSNames { - c.NameToCertificate[san] = cert - } - } -} - -// A Certificate is a chain of one or more certificates, leaf first. -type Certificate struct { - Certificate [][]byte - // PrivateKey contains the private key corresponding to the public key - // in Leaf. For a server, this must implement crypto.Signer and/or - // crypto.Decrypter, with an RSA or ECDSA PublicKey. For a client - // (performing client authentication), this must be a crypto.Signer - // with an RSA or ECDSA PublicKey. - PrivateKey crypto.PrivateKey - // OCSPStaple contains an optional OCSP response which will be served - // to clients that request it. - OCSPStaple []byte - // SignedCertificateTimestamps contains an optional list of Signed - // Certificate Timestamps which will be served to clients that request it. - SignedCertificateTimestamps [][]byte - // Leaf is the parsed form of the leaf certificate, which may be - // initialized using x509.ParseCertificate to reduce per-handshake - // processing for TLS clients doing client authentication. If nil, the - // leaf certificate will be parsed as needed. - Leaf *x509.Certificate -} - -// A TLS record. -type record struct { - contentType recordType - major, minor uint8 - payload []byte -} - -type handshakeMessage interface { - marshal() []byte - unmarshal([]byte) bool -} - -// lruSessionCache is a ClientSessionCache implementation that uses an LRU -// caching strategy. -type lruSessionCache struct { - sync.Mutex - - m map[string]*list.Element - q *list.List - capacity int -} - -type lruSessionCacheEntry struct { - sessionKey string - state *ClientSessionState -} - -// NewLRUClientSessionCache returns a ClientSessionCache with the given -// capacity that uses an LRU strategy. If capacity is < 1, a default capacity -// is used instead. -func NewLRUClientSessionCache(capacity int) ClientSessionCache { - const defaultSessionCacheCapacity = 64 - - if capacity < 1 { - capacity = defaultSessionCacheCapacity - } - return &lruSessionCache{ - m: make(map[string]*list.Element), - q: list.New(), - capacity: capacity, - } -} - -// Put adds the provided (sessionKey, cs) pair to the cache. -func (c *lruSessionCache) Put(sessionKey string, cs *ClientSessionState) { - c.Lock() - defer c.Unlock() - - if elem, ok := c.m[sessionKey]; ok { - entry := elem.Value.(*lruSessionCacheEntry) - entry.state = cs - c.q.MoveToFront(elem) - return - } - - if c.q.Len() < c.capacity { - entry := &lruSessionCacheEntry{sessionKey, cs} - c.m[sessionKey] = c.q.PushFront(entry) - return - } - - elem := c.q.Back() - entry := elem.Value.(*lruSessionCacheEntry) - delete(c.m, entry.sessionKey) - entry.sessionKey = sessionKey - entry.state = cs - c.q.MoveToFront(elem) - c.m[sessionKey] = elem -} - -// Get returns the ClientSessionState value associated with a given key. It -// returns (nil, false) if no value is found. -func (c *lruSessionCache) Get(sessionKey string) (*ClientSessionState, bool) { - c.Lock() - defer c.Unlock() - - if elem, ok := c.m[sessionKey]; ok { - c.q.MoveToFront(elem) - return elem.Value.(*lruSessionCacheEntry).state, true - } - return nil, false -} - -// TODO(jsing): Make these available to both crypto/x509 and crypto/tls. -type dsaSignature struct { - R, S *big.Int -} - -type ecdsaSignature dsaSignature - -var emptyConfig Config - -func defaultConfig() *Config { - return &emptyConfig -} - -var ( - once sync.Once - varDefaultCipherSuites []uint16 -) - -func defaultCipherSuites() []uint16 { - once.Do(initDefaultCipherSuites) - return varDefaultCipherSuites -} - -func initDefaultCipherSuites() { - varDefaultCipherSuites = make([]uint16, 0, len(cipherSuites)) - for _, suite := range cipherSuites { - if suite.flags&suiteDefaultOff != 0 { - continue - } - varDefaultCipherSuites = append(varDefaultCipherSuites, suite.id) - } -} - -func unexpectedMessageError(wanted, got interface{}) error { - return fmt.Errorf("tls: received unexpected handshake message of type %T when waiting for %T", got, wanted) -} - -func isSupportedSignatureAndHash(sigHash signatureAndHash, sigHashes []signatureAndHash) bool { - for _, s := range sigHashes { - if s == sigHash { - return true - } - } - return false -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn.go deleted file mode 100644 index e3dcf15400ce18a6c3985ba02239fb013910e78e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn.go +++ /dev/null @@ -1,1032 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// TLS low level connection and record layer - -package tls - -import ( - "bytes" - "crypto/cipher" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - "net" - "sync" - "time" -) - -// A Conn represents a secured connection. -// It implements the net.Conn interface. -type Conn struct { - // constant - conn net.Conn - isClient bool - - // constant after handshake; protected by handshakeMutex - handshakeMutex sync.Mutex // handshakeMutex < in.Mutex, out.Mutex, errMutex - handshakeErr error // error resulting from handshake - vers uint16 // TLS version - haveVers bool // version has been negotiated - config *Config // configuration passed to constructor - handshakeComplete bool - didResume bool // whether this connection was a session resumption - cipherSuite uint16 - ocspResponse []byte // stapled OCSP response - scts [][]byte // signed certificate timestamps from server - peerCertificates []*x509.Certificate - // verifiedChains contains the certificate chains that we built, as - // opposed to the ones presented by the server. - verifiedChains [][]*x509.Certificate - // serverName contains the server name indicated by the client, if any. - serverName string - // firstFinished contains the first Finished hash sent during the - // handshake. This is the "tls-unique" channel binding value. - firstFinished [12]byte - - clientProtocol string - clientProtocolFallback bool - - // input/output - in, out halfConn // in.Mutex < out.Mutex - rawInput *block // raw input, right off the wire - input *block // application data waiting to be read - hand bytes.Buffer // handshake data waiting to be read - - tmp [16]byte -} - -// Access to net.Conn methods. -// Cannot just embed net.Conn because that would -// export the struct field too. - -// LocalAddr returns the local network address. -func (c *Conn) LocalAddr() net.Addr { - return c.conn.LocalAddr() -} - -// RemoteAddr returns the remote network address. -func (c *Conn) RemoteAddr() net.Addr { - return c.conn.RemoteAddr() -} - -// SetDeadline sets the read and write deadlines associated with the connection. -// A zero value for t means Read and Write will not time out. -// After a Write has timed out, the TLS state is corrupt and all future writes will return the same error. -func (c *Conn) SetDeadline(t time.Time) error { - return c.conn.SetDeadline(t) -} - -// SetReadDeadline sets the read deadline on the underlying connection. -// A zero value for t means Read will not time out. -func (c *Conn) SetReadDeadline(t time.Time) error { - return c.conn.SetReadDeadline(t) -} - -// SetWriteDeadline sets the write deadline on the underlying connection. -// A zero value for t means Write will not time out. -// After a Write has timed out, the TLS state is corrupt and all future writes will return the same error. -func (c *Conn) SetWriteDeadline(t time.Time) error { - return c.conn.SetWriteDeadline(t) -} - -// A halfConn represents one direction of the record layer -// connection, either sending or receiving. -type halfConn struct { - sync.Mutex - - err error // first permanent error - version uint16 // protocol version - cipher interface{} // cipher algorithm - mac macFunction - seq [8]byte // 64-bit sequence number - bfree *block // list of free blocks - - nextCipher interface{} // next encryption state - nextMac macFunction // next MAC algorithm - - // used to save allocating a new buffer for each MAC. - inDigestBuf, outDigestBuf []byte -} - -func (hc *halfConn) setErrorLocked(err error) error { - hc.err = err - return err -} - -func (hc *halfConn) error() error { - hc.Lock() - err := hc.err - hc.Unlock() - return err -} - -// prepareCipherSpec sets the encryption and MAC states -// that a subsequent changeCipherSpec will use. -func (hc *halfConn) prepareCipherSpec(version uint16, cipher interface{}, mac macFunction) { - hc.version = version - hc.nextCipher = cipher - hc.nextMac = mac -} - -// changeCipherSpec changes the encryption and MAC states -// to the ones previously passed to prepareCipherSpec. -func (hc *halfConn) changeCipherSpec() error { - if hc.nextCipher == nil { - return alertInternalError - } - hc.cipher = hc.nextCipher - hc.mac = hc.nextMac - hc.nextCipher = nil - hc.nextMac = nil - for i := range hc.seq { - hc.seq[i] = 0 - } - return nil -} - -// incSeq increments the sequence number. -func (hc *halfConn) incSeq() { - for i := 7; i >= 0; i-- { - hc.seq[i]++ - if hc.seq[i] != 0 { - return - } - } - - // Not allowed to let sequence number wrap. - // Instead, must renegotiate before it does. - // Not likely enough to bother. - panic("TLS: sequence number wraparound") -} - -// resetSeq resets the sequence number to zero. -func (hc *halfConn) resetSeq() { - for i := range hc.seq { - hc.seq[i] = 0 - } -} - -// removePadding returns an unpadded slice, in constant time, which is a prefix -// of the input. It also returns a byte which is equal to 255 if the padding -// was valid and 0 otherwise. See RFC 2246, section 6.2.3.2 -func removePadding(payload []byte) ([]byte, byte) { - if len(payload) < 1 { - return payload, 0 - } - - paddingLen := payload[len(payload)-1] - t := uint(len(payload)-1) - uint(paddingLen) - // if len(payload) >= (paddingLen - 1) then the MSB of t is zero - good := byte(int32(^t) >> 31) - - toCheck := 255 // the maximum possible padding length - // The length of the padded data is public, so we can use an if here - if toCheck+1 > len(payload) { - toCheck = len(payload) - 1 - } - - for i := 0; i < toCheck; i++ { - t := uint(paddingLen) - uint(i) - // if i <= paddingLen then the MSB of t is zero - mask := byte(int32(^t) >> 31) - b := payload[len(payload)-1-i] - good &^= mask&paddingLen ^ mask&b - } - - // We AND together the bits of good and replicate the result across - // all the bits. - good &= good << 4 - good &= good << 2 - good &= good << 1 - good = uint8(int8(good) >> 7) - - toRemove := good&paddingLen + 1 - return payload[:len(payload)-int(toRemove)], good -} - -// removePaddingSSL30 is a replacement for removePadding in the case that the -// protocol version is SSLv3. In this version, the contents of the padding -// are random and cannot be checked. -func removePaddingSSL30(payload []byte) ([]byte, byte) { - if len(payload) < 1 { - return payload, 0 - } - - paddingLen := int(payload[len(payload)-1]) + 1 - if paddingLen > len(payload) { - return payload, 0 - } - - return payload[:len(payload)-paddingLen], 255 -} - -func roundUp(a, b int) int { - return a + (b-a%b)%b -} - -// cbcMode is an interface for block ciphers using cipher block chaining. -type cbcMode interface { - cipher.BlockMode - SetIV([]byte) -} - -// decrypt checks and strips the mac and decrypts the data in b. Returns a -// success boolean, the number of bytes to skip from the start of the record in -// order to get the application payload, and an optional alert value. -func (hc *halfConn) decrypt(b *block) (ok bool, prefixLen int, alertValue alert) { - // pull out payload - payload := b.data[recordHeaderLen:] - - macSize := 0 - if hc.mac != nil { - macSize = hc.mac.Size() - } - - paddingGood := byte(255) - explicitIVLen := 0 - - // decrypt - if hc.cipher != nil { - switch c := hc.cipher.(type) { - case cipher.Stream: - c.XORKeyStream(payload, payload) - case cipher.AEAD: - explicitIVLen = 8 - if len(payload) < explicitIVLen { - return false, 0, alertBadRecordMAC - } - nonce := payload[:8] - payload = payload[8:] - - var additionalData [13]byte - copy(additionalData[:], hc.seq[:]) - copy(additionalData[8:], b.data[:3]) - n := len(payload) - c.Overhead() - additionalData[11] = byte(n >> 8) - additionalData[12] = byte(n) - var err error - payload, err = c.Open(payload[:0], nonce, payload, additionalData[:]) - if err != nil { - return false, 0, alertBadRecordMAC - } - b.resize(recordHeaderLen + explicitIVLen + len(payload)) - case cbcMode: - blockSize := c.BlockSize() - if hc.version >= VersionTLS11 { - explicitIVLen = blockSize - } - - if len(payload)%blockSize != 0 || len(payload) < roundUp(explicitIVLen+macSize+1, blockSize) { - return false, 0, alertBadRecordMAC - } - - if explicitIVLen > 0 { - c.SetIV(payload[:explicitIVLen]) - payload = payload[explicitIVLen:] - } - c.CryptBlocks(payload, payload) - if hc.version == VersionSSL30 { - payload, paddingGood = removePaddingSSL30(payload) - } else { - payload, paddingGood = removePadding(payload) - } - b.resize(recordHeaderLen + explicitIVLen + len(payload)) - - // note that we still have a timing side-channel in the - // MAC check, below. An attacker can align the record - // so that a correct padding will cause one less hash - // block to be calculated. Then they can iteratively - // decrypt a record by breaking each byte. See - // "Password Interception in a SSL/TLS Channel", Brice - // Canvel et al. - // - // However, our behavior matches OpenSSL, so we leak - // only as much as they do. - default: - panic("unknown cipher type") - } - } - - // check, strip mac - if hc.mac != nil { - if len(payload) < macSize { - return false, 0, alertBadRecordMAC - } - - // strip mac off payload, b.data - n := len(payload) - macSize - b.data[3] = byte(n >> 8) - b.data[4] = byte(n) - b.resize(recordHeaderLen + explicitIVLen + n) - remoteMAC := payload[n:] - localMAC := hc.mac.MAC(hc.inDigestBuf, hc.seq[0:], b.data[:recordHeaderLen], payload[:n]) - - if subtle.ConstantTimeCompare(localMAC, remoteMAC) != 1 || paddingGood != 255 { - return false, 0, alertBadRecordMAC - } - hc.inDigestBuf = localMAC - } - hc.incSeq() - - return true, recordHeaderLen + explicitIVLen, 0 -} - -// padToBlockSize calculates the needed padding block, if any, for a payload. -// On exit, prefix aliases payload and extends to the end of the last full -// block of payload. finalBlock is a fresh slice which contains the contents of -// any suffix of payload as well as the needed padding to make finalBlock a -// full block. -func padToBlockSize(payload []byte, blockSize int) (prefix, finalBlock []byte) { - overrun := len(payload) % blockSize - paddingLen := blockSize - overrun - prefix = payload[:len(payload)-overrun] - finalBlock = make([]byte, blockSize) - copy(finalBlock, payload[len(payload)-overrun:]) - for i := overrun; i < blockSize; i++ { - finalBlock[i] = byte(paddingLen - 1) - } - return -} - -// encrypt encrypts and macs the data in b. -func (hc *halfConn) encrypt(b *block, explicitIVLen int) (bool, alert) { - // mac - if hc.mac != nil { - mac := hc.mac.MAC(hc.outDigestBuf, hc.seq[0:], b.data[:recordHeaderLen], b.data[recordHeaderLen+explicitIVLen:]) - - n := len(b.data) - b.resize(n + len(mac)) - copy(b.data[n:], mac) - hc.outDigestBuf = mac - } - - payload := b.data[recordHeaderLen:] - - // encrypt - if hc.cipher != nil { - switch c := hc.cipher.(type) { - case cipher.Stream: - c.XORKeyStream(payload, payload) - case cipher.AEAD: - payloadLen := len(b.data) - recordHeaderLen - explicitIVLen - b.resize(len(b.data) + c.Overhead()) - nonce := b.data[recordHeaderLen : recordHeaderLen+explicitIVLen] - payload := b.data[recordHeaderLen+explicitIVLen:] - payload = payload[:payloadLen] - - var additionalData [13]byte - copy(additionalData[:], hc.seq[:]) - copy(additionalData[8:], b.data[:3]) - additionalData[11] = byte(payloadLen >> 8) - additionalData[12] = byte(payloadLen) - - c.Seal(payload[:0], nonce, payload, additionalData[:]) - case cbcMode: - blockSize := c.BlockSize() - if explicitIVLen > 0 { - c.SetIV(payload[:explicitIVLen]) - payload = payload[explicitIVLen:] - } - prefix, finalBlock := padToBlockSize(payload, blockSize) - b.resize(recordHeaderLen + explicitIVLen + len(prefix) + len(finalBlock)) - c.CryptBlocks(b.data[recordHeaderLen+explicitIVLen:], prefix) - c.CryptBlocks(b.data[recordHeaderLen+explicitIVLen+len(prefix):], finalBlock) - default: - panic("unknown cipher type") - } - } - - // update length to include MAC and any block padding needed. - n := len(b.data) - recordHeaderLen - b.data[3] = byte(n >> 8) - b.data[4] = byte(n) - hc.incSeq() - - return true, 0 -} - -// A block is a simple data buffer. -type block struct { - data []byte - off int // index for Read - link *block -} - -// resize resizes block to be n bytes, growing if necessary. -func (b *block) resize(n int) { - if n > cap(b.data) { - b.reserve(n) - } - b.data = b.data[0:n] -} - -// reserve makes sure that block contains a capacity of at least n bytes. -func (b *block) reserve(n int) { - if cap(b.data) >= n { - return - } - m := cap(b.data) - if m == 0 { - m = 1024 - } - for m < n { - m *= 2 - } - data := make([]byte, len(b.data), m) - copy(data, b.data) - b.data = data -} - -// readFromUntil reads from r into b until b contains at least n bytes -// or else returns an error. -func (b *block) readFromUntil(r io.Reader, n int) error { - // quick case - if len(b.data) >= n { - return nil - } - - // read until have enough. - b.reserve(n) - for { - m, err := r.Read(b.data[len(b.data):cap(b.data)]) - b.data = b.data[0 : len(b.data)+m] - if len(b.data) >= n { - // TODO(bradfitz,agl): slightly suspicious - // that we're throwing away r.Read's err here. - break - } - if err != nil { - return err - } - } - return nil -} - -func (b *block) Read(p []byte) (n int, err error) { - n = copy(p, b.data[b.off:]) - b.off += n - return -} - -// newBlock allocates a new block, from hc's free list if possible. -func (hc *halfConn) newBlock() *block { - b := hc.bfree - if b == nil { - return new(block) - } - hc.bfree = b.link - b.link = nil - b.resize(0) - return b -} - -// freeBlock returns a block to hc's free list. -// The protocol is such that each side only has a block or two on -// its free list at a time, so there's no need to worry about -// trimming the list, etc. -func (hc *halfConn) freeBlock(b *block) { - b.link = hc.bfree - hc.bfree = b -} - -// splitBlock splits a block after the first n bytes, -// returning a block with those n bytes and a -// block with the remainder. the latter may be nil. -func (hc *halfConn) splitBlock(b *block, n int) (*block, *block) { - if len(b.data) <= n { - return b, nil - } - bb := hc.newBlock() - bb.resize(len(b.data) - n) - copy(bb.data, b.data[n:]) - b.data = b.data[0:n] - return b, bb -} - -// readRecord reads the next TLS record from the connection -// and updates the record layer state. -// c.in.Mutex <= L; c.input == nil. -func (c *Conn) readRecord(want recordType) error { - // Caller must be in sync with connection: - // handshake data if handshake not yet completed, - // else application data. (We don't support renegotiation.) - switch want { - default: - c.sendAlert(alertInternalError) - return c.in.setErrorLocked(errors.New("tls: unknown record type requested")) - case recordTypeHandshake, recordTypeChangeCipherSpec: - if c.handshakeComplete { - c.sendAlert(alertInternalError) - return c.in.setErrorLocked(errors.New("tls: handshake or ChangeCipherSpec requested after handshake complete")) - } - case recordTypeApplicationData: - if !c.handshakeComplete { - c.sendAlert(alertInternalError) - return c.in.setErrorLocked(errors.New("tls: application data record requested before handshake complete")) - } - } - -Again: - if c.rawInput == nil { - c.rawInput = c.in.newBlock() - } - b := c.rawInput - - // Read header, payload. - if err := b.readFromUntil(c.conn, recordHeaderLen); err != nil { - // RFC suggests that EOF without an alertCloseNotify is - // an error, but popular web sites seem to do this, - // so we can't make it an error. - // if err == io.EOF { - // err = io.ErrUnexpectedEOF - // } - if e, ok := err.(net.Error); !ok || !e.Temporary() { - c.in.setErrorLocked(err) - } - return err - } - typ := recordType(b.data[0]) - - // No valid TLS record has a type of 0x80, however SSLv2 handshakes - // start with a uint16 length where the MSB is set and the first record - // is always < 256 bytes long. Therefore typ == 0x80 strongly suggests - // an SSLv2 client. - if want == recordTypeHandshake && typ == 0x80 { - c.sendAlert(alertProtocolVersion) - return c.in.setErrorLocked(errors.New("tls: unsupported SSLv2 handshake received")) - } - - vers := uint16(b.data[1])<<8 | uint16(b.data[2]) - n := int(b.data[3])<<8 | int(b.data[4]) - if c.haveVers && vers != c.vers { - c.sendAlert(alertProtocolVersion) - return c.in.setErrorLocked(fmt.Errorf("tls: received record with version %x when expecting version %x", vers, c.vers)) - } - if n > maxCiphertext { - c.sendAlert(alertRecordOverflow) - return c.in.setErrorLocked(fmt.Errorf("tls: oversized record received with length %d", n)) - } - if !c.haveVers { - // First message, be extra suspicious: this might not be a TLS - // client. Bail out before reading a full 'body', if possible. - // The current max version is 3.3 so if the version is >= 16.0, - // it's probably not real. - if (typ != recordTypeAlert && typ != want) || vers >= 0x1000 { - c.sendAlert(alertUnexpectedMessage) - return c.in.setErrorLocked(fmt.Errorf("tls: first record does not look like a TLS handshake")) - } - } - if err := b.readFromUntil(c.conn, recordHeaderLen+n); err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - if e, ok := err.(net.Error); !ok || !e.Temporary() { - c.in.setErrorLocked(err) - } - return err - } - - // Process message. - b, c.rawInput = c.in.splitBlock(b, recordHeaderLen+n) - ok, off, err := c.in.decrypt(b) - if !ok { - c.in.setErrorLocked(c.sendAlert(err)) - } - b.off = off - data := b.data[b.off:] - if len(data) > maxPlaintext { - err := c.sendAlert(alertRecordOverflow) - c.in.freeBlock(b) - return c.in.setErrorLocked(err) - } - - switch typ { - default: - c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - - case recordTypeAlert: - if len(data) != 2 { - c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - break - } - if alert(data[1]) == alertCloseNotify { - c.in.setErrorLocked(io.EOF) - break - } - switch data[0] { - case alertLevelWarning: - // drop on the floor - c.in.freeBlock(b) - goto Again - case alertLevelError: - c.in.setErrorLocked(&net.OpError{Op: "remote error", Err: alert(data[1])}) - default: - c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - case recordTypeChangeCipherSpec: - if typ != want || len(data) != 1 || data[0] != 1 { - c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - break - } - err := c.in.changeCipherSpec() - if err != nil { - c.in.setErrorLocked(c.sendAlert(err.(alert))) - } - - case recordTypeApplicationData: - if typ != want { - c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - break - } - c.input = b - b = nil - - case recordTypeHandshake: - // TODO(rsc): Should at least pick off connection close. - if typ != want { - return c.in.setErrorLocked(c.sendAlert(alertNoRenegotiation)) - } - c.hand.Write(data) - } - - if b != nil { - c.in.freeBlock(b) - } - return c.in.err -} - -// sendAlert sends a TLS alert message. -// c.out.Mutex <= L. -func (c *Conn) sendAlertLocked(err alert) error { - switch err { - case alertNoRenegotiation, alertCloseNotify: - c.tmp[0] = alertLevelWarning - default: - c.tmp[0] = alertLevelError - } - c.tmp[1] = byte(err) - c.writeRecord(recordTypeAlert, c.tmp[0:2]) - // closeNotify is a special case in that it isn't an error: - if err != alertCloseNotify { - return c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err}) - } - return nil -} - -// sendAlert sends a TLS alert message. -// L < c.out.Mutex. -func (c *Conn) sendAlert(err alert) error { - c.out.Lock() - defer c.out.Unlock() - return c.sendAlertLocked(err) -} - -// writeRecord writes a TLS record with the given type and payload -// to the connection and updates the record layer state. -// c.out.Mutex <= L. -func (c *Conn) writeRecord(typ recordType, data []byte) (n int, err error) { - b := c.out.newBlock() - for len(data) > 0 { - m := len(data) - if m > maxPlaintext { - m = maxPlaintext - } - explicitIVLen := 0 - explicitIVIsSeq := false - - var cbc cbcMode - if c.out.version >= VersionTLS11 { - var ok bool - if cbc, ok = c.out.cipher.(cbcMode); ok { - explicitIVLen = cbc.BlockSize() - } - } - if explicitIVLen == 0 { - if _, ok := c.out.cipher.(cipher.AEAD); ok { - explicitIVLen = 8 - // The AES-GCM construction in TLS has an - // explicit nonce so that the nonce can be - // random. However, the nonce is only 8 bytes - // which is too small for a secure, random - // nonce. Therefore we use the sequence number - // as the nonce. - explicitIVIsSeq = true - } - } - b.resize(recordHeaderLen + explicitIVLen + m) - b.data[0] = byte(typ) - vers := c.vers - if vers == 0 { - // Some TLS servers fail if the record version is - // greater than TLS 1.0 for the initial ClientHello. - vers = VersionTLS10 - } - b.data[1] = byte(vers >> 8) - b.data[2] = byte(vers) - b.data[3] = byte(m >> 8) - b.data[4] = byte(m) - if explicitIVLen > 0 { - explicitIV := b.data[recordHeaderLen : recordHeaderLen+explicitIVLen] - if explicitIVIsSeq { - copy(explicitIV, c.out.seq[:]) - } else { - if _, err = io.ReadFull(c.config.rand(), explicitIV); err != nil { - break - } - } - } - copy(b.data[recordHeaderLen+explicitIVLen:], data) - c.out.encrypt(b, explicitIVLen) - _, err = c.conn.Write(b.data) - if err != nil { - break - } - n += m - data = data[m:] - } - c.out.freeBlock(b) - - if typ == recordTypeChangeCipherSpec { - err = c.out.changeCipherSpec() - if err != nil { - // Cannot call sendAlert directly, - // because we already hold c.out.Mutex. - c.tmp[0] = alertLevelError - c.tmp[1] = byte(err.(alert)) - c.writeRecord(recordTypeAlert, c.tmp[0:2]) - return n, c.out.setErrorLocked(&net.OpError{Op: "local error", Err: err}) - } - } - return -} - -// readHandshake reads the next handshake message from -// the record layer. -// c.in.Mutex < L; c.out.Mutex < L. -func (c *Conn) readHandshake() (interface{}, error) { - for c.hand.Len() < 4 { - if err := c.in.err; err != nil { - return nil, err - } - if err := c.readRecord(recordTypeHandshake); err != nil { - return nil, err - } - } - - data := c.hand.Bytes() - n := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - if n > maxHandshake { - return nil, c.in.setErrorLocked(c.sendAlert(alertInternalError)) - } - for c.hand.Len() < 4+n { - if err := c.in.err; err != nil { - return nil, err - } - if err := c.readRecord(recordTypeHandshake); err != nil { - return nil, err - } - } - data = c.hand.Next(4 + n) - var m handshakeMessage - switch data[0] { - case typeClientHello: - m = new(clientHelloMsg) - case typeServerHello: - m = new(serverHelloMsg) - case typeNewSessionTicket: - m = new(newSessionTicketMsg) - case typeCertificate: - m = new(certificateMsg) - case typeCertificateRequest: - m = &certificateRequestMsg{ - hasSignatureAndHash: c.vers >= VersionTLS12, - } - case typeCertificateStatus: - m = new(certificateStatusMsg) - case typeServerKeyExchange: - m = new(serverKeyExchangeMsg) - case typeServerHelloDone: - m = new(serverHelloDoneMsg) - case typeClientKeyExchange: - m = new(clientKeyExchangeMsg) - case typeCertificateVerify: - m = &certificateVerifyMsg{ - hasSignatureAndHash: c.vers >= VersionTLS12, - } - case typeNextProtocol: - m = new(nextProtoMsg) - case typeFinished: - m = new(finishedMsg) - default: - return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - - // The handshake message unmarshallers - // expect to be able to keep references to data, - // so pass in a fresh copy that won't be overwritten. - data = append([]byte(nil), data...) - - if !m.unmarshal(data) { - return nil, c.in.setErrorLocked(c.sendAlert(alertUnexpectedMessage)) - } - return m, nil -} - -// Write writes data to the connection. -func (c *Conn) Write(b []byte) (int, error) { - if err := c.Handshake(); err != nil { - return 0, err - } - - c.out.Lock() - defer c.out.Unlock() - - if err := c.out.err; err != nil { - return 0, err - } - - if !c.handshakeComplete { - return 0, alertInternalError - } - - // SSL 3.0 and TLS 1.0 are susceptible to a chosen-plaintext - // attack when using block mode ciphers due to predictable IVs. - // This can be prevented by splitting each Application Data - // record into two records, effectively randomizing the IV. - // - // http://www.openssl.org/~bodo/tls-cbc.txt - // https://bugzilla.mozilla.org/show_bug.cgi?id=665814 - // http://www.imperialviolet.org/2012/01/15/beastfollowup.html - - var m int - if len(b) > 1 && c.vers <= VersionTLS10 { - if _, ok := c.out.cipher.(cipher.BlockMode); ok { - n, err := c.writeRecord(recordTypeApplicationData, b[:1]) - if err != nil { - return n, c.out.setErrorLocked(err) - } - m, b = 1, b[1:] - } - } - - n, err := c.writeRecord(recordTypeApplicationData, b) - return n + m, c.out.setErrorLocked(err) -} - -// Read can be made to time out and return a net.Error with Timeout() == true -// after a fixed time limit; see SetDeadline and SetReadDeadline. -func (c *Conn) Read(b []byte) (n int, err error) { - if err = c.Handshake(); err != nil { - return - } - if len(b) == 0 { - // Put this after Handshake, in case people were calling - // Read(nil) for the side effect of the Handshake. - return - } - - c.in.Lock() - defer c.in.Unlock() - - // Some OpenSSL servers send empty records in order to randomize the - // CBC IV. So this loop ignores a limited number of empty records. - const maxConsecutiveEmptyRecords = 100 - for emptyRecordCount := 0; emptyRecordCount <= maxConsecutiveEmptyRecords; emptyRecordCount++ { - for c.input == nil && c.in.err == nil { - if err := c.readRecord(recordTypeApplicationData); err != nil { - // Soft error, like EAGAIN - return 0, err - } - } - if err := c.in.err; err != nil { - return 0, err - } - - n, err = c.input.Read(b) - if c.input.off >= len(c.input.data) { - c.in.freeBlock(c.input) - c.input = nil - } - - // If a close-notify alert is waiting, read it so that - // we can return (n, EOF) instead of (n, nil), to signal - // to the HTTP response reading goroutine that the - // connection is now closed. This eliminates a race - // where the HTTP response reading goroutine would - // otherwise not observe the EOF until its next read, - // by which time a client goroutine might have already - // tried to reuse the HTTP connection for a new - // request. - // See https://codereview.appspot.com/76400046 - // and https://golang.org/issue/3514 - if ri := c.rawInput; ri != nil && - n != 0 && err == nil && - c.input == nil && len(ri.data) > 0 && recordType(ri.data[0]) == recordTypeAlert { - if recErr := c.readRecord(recordTypeApplicationData); recErr != nil { - err = recErr // will be io.EOF on closeNotify - } - } - - if n != 0 || err != nil { - return n, err - } - } - - return 0, io.ErrNoProgress -} - -// Close closes the connection. -func (c *Conn) Close() error { - var alertErr error - - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - if c.handshakeComplete { - alertErr = c.sendAlert(alertCloseNotify) - } - - if err := c.conn.Close(); err != nil { - return err - } - return alertErr -} - -// Handshake runs the client or server handshake -// protocol if it has not yet been run. -// Most uses of this package need not call Handshake -// explicitly: the first Read or Write will call it automatically. -func (c *Conn) Handshake() error { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - if err := c.handshakeErr; err != nil { - return err - } - if c.handshakeComplete { - return nil - } - - if c.isClient { - c.handshakeErr = c.clientHandshake() - } else { - c.handshakeErr = c.serverHandshake() - } - return c.handshakeErr -} - -// ConnectionState returns basic TLS details about the connection. -func (c *Conn) ConnectionState() ConnectionState { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - var state ConnectionState - state.HandshakeComplete = c.handshakeComplete - if c.handshakeComplete { - state.Version = c.vers - state.NegotiatedProtocol = c.clientProtocol - state.DidResume = c.didResume - state.NegotiatedProtocolIsMutual = !c.clientProtocolFallback - state.CipherSuite = c.cipherSuite - state.PeerCertificates = c.peerCertificates - state.VerifiedChains = c.verifiedChains - state.ServerName = c.serverName - state.SignedCertificateTimestamps = c.scts - state.OCSPResponse = c.ocspResponse - if !c.didResume { - state.TLSUnique = c.firstFinished[:] - } - } - - return state -} - -// OCSPResponse returns the stapled OCSP response from the TLS server, if -// any. (Only valid for client connections.) -func (c *Conn) OCSPResponse() []byte { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - - return c.ocspResponse -} - -// VerifyHostname checks that the peer certificate chain is valid for -// connecting to host. If so, it returns nil; if not, it returns an error -// describing the problem. -func (c *Conn) VerifyHostname(host string) error { - c.handshakeMutex.Lock() - defer c.handshakeMutex.Unlock() - if !c.isClient { - return errors.New("tls: VerifyHostname called on TLS server connection") - } - if !c.handshakeComplete { - return errors.New("tls: handshake has not yet been performed") - } - if len(c.verifiedChains) == 0 { - return errors.New("tls: handshake did not verify certificate chain") - } - return c.peerCertificates[0].VerifyHostname(host) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn_test.go deleted file mode 100644 index ec802cad70fc74d599dbe0ad48a7eb8dbaaf116a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/conn_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "testing" -) - -func TestRoundUp(t *testing.T) { - if roundUp(0, 16) != 0 || - roundUp(1, 16) != 16 || - roundUp(15, 16) != 16 || - roundUp(16, 16) != 16 || - roundUp(17, 16) != 32 { - t.Error("roundUp broken") - } -} - -var paddingTests = []struct { - in []byte - good bool - expectedLen int -}{ - {[]byte{1, 2, 3, 4, 0}, true, 4}, - {[]byte{1, 2, 3, 4, 0, 1}, false, 0}, - {[]byte{1, 2, 3, 4, 99, 99}, false, 0}, - {[]byte{1, 2, 3, 4, 1, 1}, true, 4}, - {[]byte{1, 2, 3, 2, 2, 2}, true, 3}, - {[]byte{1, 2, 3, 3, 3, 3}, true, 2}, - {[]byte{1, 2, 3, 4, 3, 3}, false, 0}, - {[]byte{1, 4, 4, 4, 4, 4}, true, 1}, - {[]byte{5, 5, 5, 5, 5, 5}, true, 0}, - {[]byte{6, 6, 6, 6, 6, 6}, false, 0}, -} - -func TestRemovePadding(t *testing.T) { - for i, test := range paddingTests { - payload, good := removePadding(test.in) - expectedGood := byte(255) - if !test.good { - expectedGood = 0 - } - if good != expectedGood { - t.Errorf("#%d: wrong validity, want:%d got:%d", i, expectedGood, good) - } - if good == 255 && len(payload) != test.expectedLen { - t.Errorf("#%d: got %d, want %d", i, len(payload), test.expectedLen) - } - } -} - -var certExampleCom = `308201403081eda003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313138353835325a170d3132303933303138353835325a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31a301830160603551d11040f300d820b6578616d706c652e636f6d300b06092a864886f70d0101050341001a0b419d2c74474c6450654e5f10b32bf426ffdf55cad1c52602e7a9151513a3424c70f5960dcd682db0c33769cc1daa3fcdd3db10809d2392ed4a1bf50ced18` - -var certWildcardExampleCom = `308201423081efa003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303034365a170d3132303933303139303034365a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31c301a30180603551d110411300f820d2a2e6578616d706c652e636f6d300b06092a864886f70d0101050341001676f0c9e7c33c1b656ed5a6476c4e2ee9ec8e62df7407accb1875272b2edd0a22096cb2c22598d11604104d604f810eb4b5987ca6bb319c7e6ce48725c54059` - -var certFooExampleCom = `308201443081f1a003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303131345a170d3132303933303139303131345a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31e301c301a0603551d1104133011820f666f6f2e6578616d706c652e636f6d300b06092a864886f70d010105034100646a2a51f2aa2477add854b462cf5207ba16d3213ffb5d3d0eed473fbf09935019192d1d5b8ca6a2407b424cf04d97c4cd9197c83ecf81f0eab9464a1109d09f` - -var certDoubleWildcardExampleCom = `308201443081f1a003020102020101300b06092a864886f70d010105301e311c301a060355040a131354657374696e67204365727469666963617465301e170d3131313030313139303134315a170d3132303933303139303134315a301e311c301a060355040a131354657374696e67204365727469666963617465305a300b06092a864886f70d010101034b003048024100bced6e32368599eeddf18796bfd03958a154f87e5b084f96e85136a56b886733592f493f0fc68b0d6b3551781cb95e13c5de458b28d6fb60d20a9129313261410203010001a31e301c301a0603551d1104133011820f2a2e2a2e6578616d706c652e636f6d300b06092a864886f70d0101050341001c3de267975f56ef57771c6218ef95ecc65102e57bd1defe6f7efea90d9b26cf40de5bd7ad75e46201c7f2a92aaa3e907451e9409f65e28ddb6db80d726290f6` - -func TestCertificateSelection(t *testing.T) { - config := Config{ - Certificates: []Certificate{ - { - Certificate: [][]byte{fromHex(certExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certWildcardExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certFooExampleCom)}, - }, - { - Certificate: [][]byte{fromHex(certDoubleWildcardExampleCom)}, - }, - }, - } - - config.BuildNameToCertificate() - - pointerToIndex := func(c *Certificate) int { - for i := range config.Certificates { - if c == &config.Certificates[i] { - return i - } - } - return -1 - } - - certificateForName := func(name string) *Certificate { - clientHello := &ClientHelloInfo{ - ServerName: name, - } - if cert, err := config.getCertificate(clientHello); err != nil { - t.Errorf("unable to get certificate for name '%s': %s", name, err) - return nil - } else { - return cert - } - } - - if n := pointerToIndex(certificateForName("example.com")); n != 0 { - t.Errorf("example.com returned certificate %d, not 0", n) - } - if n := pointerToIndex(certificateForName("bar.example.com")); n != 1 { - t.Errorf("bar.example.com returned certificate %d, not 1", n) - } - if n := pointerToIndex(certificateForName("foo.example.com")); n != 2 { - t.Errorf("foo.example.com returned certificate %d, not 2", n) - } - if n := pointerToIndex(certificateForName("foo.bar.example.com")); n != 3 { - t.Errorf("foo.bar.example.com returned certificate %d, not 3", n) - } - if n := pointerToIndex(certificateForName("foo.bar.baz.example.com")); n != 0 { - t.Errorf("foo.bar.baz.example.com returned certificate %d, not 0", n) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/generate_cert.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/generate_cert.go deleted file mode 100644 index 83f9916ff9d937e1eefcd30e0de6d95a3d5a8c42..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/generate_cert.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// Generate a self-signed X.509 certificate for a TLS server. Outputs to -// 'cert.pem' and 'key.pem' and will overwrite existing files. - -package main - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "flag" - "fmt" - "log" - "math/big" - "net" - "os" - "strings" - "time" -) - -var ( - host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for") - validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011") - validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for") - isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority") - rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set") - ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521") -) - -func publicKey(priv interface{}) interface{} { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &k.PublicKey - case *ecdsa.PrivateKey: - return &k.PublicKey - default: - return nil - } -} - -func pemBlockForKey(priv interface{}) *pem.Block { - switch k := priv.(type) { - case *rsa.PrivateKey: - return &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(k)} - case *ecdsa.PrivateKey: - b, err := x509.MarshalECPrivateKey(k) - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to marshal ECDSA private key: %v", err) - os.Exit(2) - } - return &pem.Block{Type: "EC PRIVATE KEY", Bytes: b} - default: - return nil - } -} - -func main() { - flag.Parse() - - if len(*host) == 0 { - log.Fatalf("Missing required --host parameter") - } - - var priv interface{} - var err error - switch *ecdsaCurve { - case "": - priv, err = rsa.GenerateKey(rand.Reader, *rsaBits) - case "P224": - priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader) - case "P256": - priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - case "P384": - priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader) - case "P521": - priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - default: - fmt.Fprintf(os.Stderr, "Unrecognized elliptic curve: %q", *ecdsaCurve) - os.Exit(1) - } - if err != nil { - log.Fatalf("failed to generate private key: %s", err) - } - - var notBefore time.Time - if len(*validFrom) == 0 { - notBefore = time.Now() - } else { - notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom) - if err != nil { - fmt.Fprintf(os.Stderr, "Failed to parse creation date: %s\n", err) - os.Exit(1) - } - } - - notAfter := notBefore.Add(*validFor) - - serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128) - serialNumber, err := rand.Int(rand.Reader, serialNumberLimit) - if err != nil { - log.Fatalf("failed to generate serial number: %s", err) - } - - template := x509.Certificate{ - SerialNumber: serialNumber, - Subject: pkix.Name{ - Organization: []string{"Acme Co"}, - }, - NotBefore: notBefore, - NotAfter: notAfter, - - KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature, - ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, - BasicConstraintsValid: true, - } - - hosts := strings.Split(*host, ",") - for _, h := range hosts { - if ip := net.ParseIP(h); ip != nil { - template.IPAddresses = append(template.IPAddresses, ip) - } else { - template.DNSNames = append(template.DNSNames, h) - } - } - - if *isCA { - template.IsCA = true - template.KeyUsage |= x509.KeyUsageCertSign - } - - derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv) - if err != nil { - log.Fatalf("Failed to create certificate: %s", err) - } - - certOut, err := os.Create("cert.pem") - if err != nil { - log.Fatalf("failed to open cert.pem for writing: %s", err) - } - pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}) - certOut.Close() - log.Print("written cert.pem\n") - - keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - if err != nil { - log.Print("failed to open key.pem for writing:", err) - return - } - pem.Encode(keyOut, pemBlockForKey(priv)) - keyOut.Close() - log.Print("written key.pem\n") -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client.go deleted file mode 100644 index 0b591d7309c2592b9067b8ba796519806260e1fd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client.go +++ /dev/null @@ -1,660 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/subtle" - "crypto/x509" - "errors" - "fmt" - "io" - "net" - "strconv" -) - -type clientHandshakeState struct { - c *Conn - serverHello *serverHelloMsg - hello *clientHelloMsg - suite *cipherSuite - finishedHash finishedHash - masterSecret []byte - session *ClientSessionState -} - -func (c *Conn) clientHandshake() error { - if c.config == nil { - c.config = defaultConfig() - } - - if len(c.config.ServerName) == 0 && !c.config.InsecureSkipVerify { - return errors.New("tls: either ServerName or InsecureSkipVerify must be specified in the tls.Config") - } - - nextProtosLength := 0 - for _, proto := range c.config.NextProtos { - if l := len(proto); l == 0 || l > 255 { - return errors.New("tls: invalid NextProtos value") - } else { - nextProtosLength += 1 + l - } - } - if nextProtosLength > 0xffff { - return errors.New("tls: NextProtos values too large") - } - - hello := &clientHelloMsg{ - vers: c.config.maxVersion(), - compressionMethods: []uint8{compressionNone}, - random: make([]byte, 32), - ocspStapling: true, - scts: true, - serverName: c.config.ServerName, - supportedCurves: c.config.curvePreferences(), - supportedPoints: []uint8{pointFormatUncompressed}, - nextProtoNeg: len(c.config.NextProtos) > 0, - secureRenegotiation: true, - alpnProtocols: c.config.NextProtos, - } - - possibleCipherSuites := c.config.cipherSuites() - hello.cipherSuites = make([]uint16, 0, len(possibleCipherSuites)) - -NextCipherSuite: - for _, suiteId := range possibleCipherSuites { - for _, suite := range cipherSuites { - if suite.id != suiteId { - continue - } - // Don't advertise TLS 1.2-only cipher suites unless - // we're attempting TLS 1.2. - if hello.vers < VersionTLS12 && suite.flags&suiteTLS12 != 0 { - continue - } - hello.cipherSuites = append(hello.cipherSuites, suiteId) - continue NextCipherSuite - } - } - - _, err := io.ReadFull(c.config.rand(), hello.random) - if err != nil { - c.sendAlert(alertInternalError) - return errors.New("tls: short read from Rand: " + err.Error()) - } - - if hello.vers >= VersionTLS12 { - hello.signatureAndHashes = supportedSignatureAlgorithms - } - - var session *ClientSessionState - var cacheKey string - sessionCache := c.config.ClientSessionCache - if c.config.SessionTicketsDisabled { - sessionCache = nil - } - - if sessionCache != nil { - hello.ticketSupported = true - - // Try to resume a previously negotiated TLS session, if - // available. - cacheKey = clientSessionCacheKey(c.conn.RemoteAddr(), c.config) - candidateSession, ok := sessionCache.Get(cacheKey) - if ok { - // Check that the ciphersuite/version used for the - // previous session are still valid. - cipherSuiteOk := false - for _, id := range hello.cipherSuites { - if id == candidateSession.cipherSuite { - cipherSuiteOk = true - break - } - } - - versOk := candidateSession.vers >= c.config.minVersion() && - candidateSession.vers <= c.config.maxVersion() - if versOk && cipherSuiteOk { - session = candidateSession - } - } - } - - if session != nil { - hello.sessionTicket = session.sessionTicket - // A random session ID is used to detect when the - // server accepted the ticket and is resuming a session - // (see RFC 5077). - hello.sessionId = make([]byte, 16) - if _, err := io.ReadFull(c.config.rand(), hello.sessionId); err != nil { - c.sendAlert(alertInternalError) - return errors.New("tls: short read from Rand: " + err.Error()) - } - } - - c.writeRecord(recordTypeHandshake, hello.marshal()) - - msg, err := c.readHandshake() - if err != nil { - return err - } - serverHello, ok := msg.(*serverHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(serverHello, msg) - } - - vers, ok := c.config.mutualVersion(serverHello.vers) - if !ok || vers < VersionTLS10 { - // TLS 1.0 is the minimum version supported as a client. - c.sendAlert(alertProtocolVersion) - return fmt.Errorf("tls: server selected unsupported protocol version %x", serverHello.vers) - } - c.vers = vers - c.haveVers = true - - suite := mutualCipherSuite(c.config.cipherSuites(), serverHello.cipherSuite) - if suite == nil { - c.sendAlert(alertHandshakeFailure) - return fmt.Errorf("tls: server selected an unsupported cipher suite") - } - - hs := &clientHandshakeState{ - c: c, - serverHello: serverHello, - hello: hello, - suite: suite, - finishedHash: newFinishedHash(c.vers, suite), - session: session, - } - - isResume, err := hs.processServerHello() - if err != nil { - return err - } - - // No signatures of the handshake are needed in a resumption. - // Otherwise, in a full handshake, if we don't have any certificates - // configured then we will never send a CertificateVerify message and - // thus no signatures are needed in that case either. - if isResume || len(c.config.Certificates) == 0 { - hs.finishedHash.discardHandshakeBuffer() - } - - hs.finishedHash.Write(hs.hello.marshal()) - hs.finishedHash.Write(hs.serverHello.marshal()) - - if isResume { - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.readSessionTicket(); err != nil { - return err - } - if err := hs.readFinished(c.firstFinished[:]); err != nil { - return err - } - if err := hs.sendFinished(nil); err != nil { - return err - } - } else { - if err := hs.doFullHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.sendFinished(c.firstFinished[:]); err != nil { - return err - } - if err := hs.readSessionTicket(); err != nil { - return err - } - if err := hs.readFinished(nil); err != nil { - return err - } - } - - if sessionCache != nil && hs.session != nil && session != hs.session { - sessionCache.Put(cacheKey, hs.session) - } - - c.didResume = isResume - c.handshakeComplete = true - c.cipherSuite = suite.id - return nil -} - -func (hs *clientHandshakeState) doFullHandshake() error { - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return err - } - certMsg, ok := msg.(*certificateMsg) - if !ok || len(certMsg.certificates) == 0 { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - hs.finishedHash.Write(certMsg.marshal()) - - certs := make([]*x509.Certificate, len(certMsg.certificates)) - for i, asn1Data := range certMsg.certificates { - cert, err := x509.ParseCertificate(asn1Data) - if err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: failed to parse certificate from server: " + err.Error()) - } - certs[i] = cert - } - - if !c.config.InsecureSkipVerify { - opts := x509.VerifyOptions{ - Roots: c.config.RootCAs, - CurrentTime: c.config.time(), - DNSName: c.config.ServerName, - Intermediates: x509.NewCertPool(), - } - - for i, cert := range certs { - if i == 0 { - continue - } - opts.Intermediates.AddCert(cert) - } - c.verifiedChains, err = certs[0].Verify(opts) - if err != nil { - c.sendAlert(alertBadCertificate) - return err - } - } - - switch certs[0].PublicKey.(type) { - case *rsa.PublicKey, *ecdsa.PublicKey: - break - default: - c.sendAlert(alertUnsupportedCertificate) - return fmt.Errorf("tls: server's certificate contains an unsupported type of public key: %T", certs[0].PublicKey) - } - - c.peerCertificates = certs - - if hs.serverHello.ocspStapling { - msg, err = c.readHandshake() - if err != nil { - return err - } - cs, ok := msg.(*certificateStatusMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(cs, msg) - } - hs.finishedHash.Write(cs.marshal()) - - if cs.statusType == statusTypeOCSP { - c.ocspResponse = cs.response - } - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - - keyAgreement := hs.suite.ka(c.vers) - - skx, ok := msg.(*serverKeyExchangeMsg) - if ok { - hs.finishedHash.Write(skx.marshal()) - err = keyAgreement.processServerKeyExchange(c.config, hs.hello, hs.serverHello, certs[0], skx) - if err != nil { - c.sendAlert(alertUnexpectedMessage) - return err - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - var chainToSend *Certificate - var certRequested bool - certReq, ok := msg.(*certificateRequestMsg) - if ok { - certRequested = true - - // RFC 4346 on the certificateAuthorities field: - // A list of the distinguished names of acceptable certificate - // authorities. These distinguished names may specify a desired - // distinguished name for a root CA or for a subordinate CA; - // thus, this message can be used to describe both known roots - // and a desired authorization space. If the - // certificate_authorities list is empty then the client MAY - // send any certificate of the appropriate - // ClientCertificateType, unless there is some external - // arrangement to the contrary. - - hs.finishedHash.Write(certReq.marshal()) - - var rsaAvail, ecdsaAvail bool - for _, certType := range certReq.certificateTypes { - switch certType { - case certTypeRSASign: - rsaAvail = true - case certTypeECDSASign: - ecdsaAvail = true - } - } - - // We need to search our list of client certs for one - // where SignatureAlgorithm is acceptable to the server and the - // Issuer is in certReq.certificateAuthorities - findCert: - for i, chain := range c.config.Certificates { - if !rsaAvail && !ecdsaAvail { - continue - } - - for j, cert := range chain.Certificate { - x509Cert := chain.Leaf - // parse the certificate if this isn't the leaf - // node, or if chain.Leaf was nil - if j != 0 || x509Cert == nil { - if x509Cert, err = x509.ParseCertificate(cert); err != nil { - c.sendAlert(alertInternalError) - return errors.New("tls: failed to parse client certificate #" + strconv.Itoa(i) + ": " + err.Error()) - } - } - - switch { - case rsaAvail && x509Cert.PublicKeyAlgorithm == x509.RSA: - case ecdsaAvail && x509Cert.PublicKeyAlgorithm == x509.ECDSA: - default: - continue findCert - } - - if len(certReq.certificateAuthorities) == 0 { - // they gave us an empty list, so just take the - // first cert from c.config.Certificates - chainToSend = &chain - break findCert - } - - for _, ca := range certReq.certificateAuthorities { - if bytes.Equal(x509Cert.RawIssuer, ca) { - chainToSend = &chain - break findCert - } - } - } - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - shd, ok := msg.(*serverHelloDoneMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(shd, msg) - } - hs.finishedHash.Write(shd.marshal()) - - // If the server requested a certificate then we have to send a - // Certificate message, even if it's empty because we don't have a - // certificate to send. - if certRequested { - certMsg = new(certificateMsg) - if chainToSend != nil { - certMsg.certificates = chainToSend.Certificate - } - hs.finishedHash.Write(certMsg.marshal()) - c.writeRecord(recordTypeHandshake, certMsg.marshal()) - } - - preMasterSecret, ckx, err := keyAgreement.generateClientKeyExchange(c.config, hs.hello, certs[0]) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - if ckx != nil { - hs.finishedHash.Write(ckx.marshal()) - c.writeRecord(recordTypeHandshake, ckx.marshal()) - } - - if chainToSend != nil { - certVerify := &certificateVerifyMsg{ - hasSignatureAndHash: c.vers >= VersionTLS12, - } - - key, ok := chainToSend.PrivateKey.(crypto.Signer) - if !ok { - c.sendAlert(alertInternalError) - return fmt.Errorf("tls: client certificate private key of type %T does not implement crypto.Signer", chainToSend.PrivateKey) - } - - var signatureType uint8 - switch key.Public().(type) { - case *ecdsa.PublicKey: - signatureType = signatureECDSA - case *rsa.PublicKey: - signatureType = signatureRSA - default: - c.sendAlert(alertInternalError) - return fmt.Errorf("tls: failed to sign handshake with client certificate: unknown client certificate key type: %T", key) - } - - certVerify.signatureAndHash, err = hs.finishedHash.selectClientCertSignatureAlgorithm(certReq.signatureAndHashes, signatureType) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - digest, hashFunc, err := hs.finishedHash.hashForClientCertificate(certVerify.signatureAndHash, hs.masterSecret) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - certVerify.signature, err = key.Sign(c.config.rand(), digest, hashFunc) - if err != nil { - c.sendAlert(alertInternalError) - return err - } - - hs.finishedHash.Write(certVerify.marshal()) - c.writeRecord(recordTypeHandshake, certVerify.marshal()) - } - - hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.hello.random, hs.serverHello.random) - - hs.finishedHash.discardHandshakeBuffer() - - return nil -} - -func (hs *clientHandshakeState) establishKeys() error { - c := hs.c - - clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := - keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.hello.random, hs.serverHello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) - var clientCipher, serverCipher interface{} - var clientHash, serverHash macFunction - if hs.suite.cipher != nil { - clientCipher = hs.suite.cipher(clientKey, clientIV, false /* not for reading */) - clientHash = hs.suite.mac(c.vers, clientMAC) - serverCipher = hs.suite.cipher(serverKey, serverIV, true /* for reading */) - serverHash = hs.suite.mac(c.vers, serverMAC) - } else { - clientCipher = hs.suite.aead(clientKey, clientIV) - serverCipher = hs.suite.aead(serverKey, serverIV) - } - - c.in.prepareCipherSpec(c.vers, serverCipher, serverHash) - c.out.prepareCipherSpec(c.vers, clientCipher, clientHash) - return nil -} - -func (hs *clientHandshakeState) serverResumedSession() bool { - // If the server responded with the same sessionId then it means the - // sessionTicket is being used to resume a TLS session. - return hs.session != nil && hs.hello.sessionId != nil && - bytes.Equal(hs.serverHello.sessionId, hs.hello.sessionId) -} - -func (hs *clientHandshakeState) processServerHello() (bool, error) { - c := hs.c - - if hs.serverHello.compressionMethod != compressionNone { - c.sendAlert(alertUnexpectedMessage) - return false, errors.New("tls: server selected unsupported compression format") - } - - clientDidNPN := hs.hello.nextProtoNeg - clientDidALPN := len(hs.hello.alpnProtocols) > 0 - serverHasNPN := hs.serverHello.nextProtoNeg - serverHasALPN := len(hs.serverHello.alpnProtocol) > 0 - - if !clientDidNPN && serverHasNPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("server advertised unrequested NPN extension") - } - - if !clientDidALPN && serverHasALPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("server advertised unrequested ALPN extension") - } - - if serverHasNPN && serverHasALPN { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("server advertised both NPN and ALPN extensions") - } - - if serverHasALPN { - c.clientProtocol = hs.serverHello.alpnProtocol - c.clientProtocolFallback = false - } - c.scts = hs.serverHello.scts - - if hs.serverResumedSession() { - // Restore masterSecret and peerCerts from previous state - hs.masterSecret = hs.session.masterSecret - c.peerCertificates = hs.session.serverCertificates - c.verifiedChains = hs.session.verifiedChains - return true, nil - } - return false, nil -} - -func (hs *clientHandshakeState) readFinished(out []byte) error { - c := hs.c - - c.readRecord(recordTypeChangeCipherSpec) - if err := c.in.error(); err != nil { - return err - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - serverFinished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(serverFinished, msg) - } - - verify := hs.finishedHash.serverSum(hs.masterSecret) - if len(verify) != len(serverFinished.verifyData) || - subtle.ConstantTimeCompare(verify, serverFinished.verifyData) != 1 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: server's Finished message was incorrect") - } - hs.finishedHash.Write(serverFinished.marshal()) - copy(out, verify) - return nil -} - -func (hs *clientHandshakeState) readSessionTicket() error { - if !hs.serverHello.ticketSupported { - return nil - } - - c := hs.c - msg, err := c.readHandshake() - if err != nil { - return err - } - sessionTicketMsg, ok := msg.(*newSessionTicketMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(sessionTicketMsg, msg) - } - hs.finishedHash.Write(sessionTicketMsg.marshal()) - - hs.session = &ClientSessionState{ - sessionTicket: sessionTicketMsg.ticket, - vers: c.vers, - cipherSuite: hs.suite.id, - masterSecret: hs.masterSecret, - serverCertificates: c.peerCertificates, - verifiedChains: c.verifiedChains, - } - - return nil -} - -func (hs *clientHandshakeState) sendFinished(out []byte) error { - c := hs.c - - c.writeRecord(recordTypeChangeCipherSpec, []byte{1}) - if hs.serverHello.nextProtoNeg { - nextProto := new(nextProtoMsg) - proto, fallback := mutualProtocol(c.config.NextProtos, hs.serverHello.nextProtos) - nextProto.proto = proto - c.clientProtocol = proto - c.clientProtocolFallback = fallback - - hs.finishedHash.Write(nextProto.marshal()) - c.writeRecord(recordTypeHandshake, nextProto.marshal()) - } - - finished := new(finishedMsg) - finished.verifyData = hs.finishedHash.clientSum(hs.masterSecret) - hs.finishedHash.Write(finished.marshal()) - c.writeRecord(recordTypeHandshake, finished.marshal()) - copy(out, finished.verifyData) - return nil -} - -// clientSessionCacheKey returns a key used to cache sessionTickets that could -// be used to resume previously negotiated TLS sessions with a server. -func clientSessionCacheKey(serverAddr net.Addr, config *Config) string { - if len(config.ServerName) > 0 { - return config.ServerName - } - return serverAddr.String() -} - -// mutualProtocol finds the mutual Next Protocol Negotiation or ALPN protocol -// given list of possible protocols and a list of the preference order. The -// first list must not be empty. It returns the resulting protocol and flag -// indicating if the fallback case was reached. -func mutualProtocol(protos, preferenceProtos []string) (string, bool) { - for _, s := range preferenceProtos { - for _, c := range protos { - if s == c { - return s, false - } - } - } - - return protos[0], true -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client_test.go deleted file mode 100644 index 664fe8de6a0c73b0439cffcc5621955f49c955fd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_client_test.go +++ /dev/null @@ -1,602 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "crypto/ecdsa" - "crypto/rsa" - "crypto/x509" - "encoding/base64" - "encoding/binary" - "encoding/pem" - "fmt" - "io" - "net" - "os" - "os/exec" - "path/filepath" - "strconv" - "testing" - "time" -) - -// Note: see comment in handshake_test.go for details of how the reference -// tests work. - -// blockingSource is an io.Reader that blocks a Read call until it's closed. -type blockingSource chan bool - -func (b blockingSource) Read([]byte) (n int, err error) { - <-b - return 0, io.EOF -} - -// clientTest represents a test of the TLS client handshake against a reference -// implementation. -type clientTest struct { - // name is a freeform string identifying the test and the file in which - // the expected results will be stored. - name string - // command, if not empty, contains a series of arguments for the - // command to run for the reference server. - command []string - // config, if not nil, contains a custom Config to use for this test. - config *Config - // cert, if not empty, contains a DER-encoded certificate for the - // reference server. - cert []byte - // key, if not nil, contains either a *rsa.PrivateKey or - // *ecdsa.PrivateKey which is the private key for the reference server. - key interface{} - // extensions, if not nil, contains a list of extension data to be returned - // from the ServerHello. The data should be in standard TLS format with - // a 2-byte uint16 type, 2-byte data length, followed by the extension data. - extensions [][]byte - // validate, if not nil, is a function that will be called with the - // ConnectionState of the resulting connection. It returns a non-nil - // error if the ConnectionState is unacceptable. - validate func(ConnectionState) error -} - -var defaultServerCommand = []string{"openssl", "s_server"} - -// connFromCommand starts the reference server process, connects to it and -// returns a recordingConn for the connection. The stdin return value is a -// blockingSource for the stdin of the child process. It must be closed before -// Waiting for child. -func (test *clientTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, stdin blockingSource, err error) { - cert := testRSACertificate - if len(test.cert) > 0 { - cert = test.cert - } - certPath := tempFile(string(cert)) - defer os.Remove(certPath) - - var key interface{} = testRSAPrivateKey - if test.key != nil { - key = test.key - } - var pemType string - var derBytes []byte - switch key := key.(type) { - case *rsa.PrivateKey: - pemType = "RSA" - derBytes = x509.MarshalPKCS1PrivateKey(key) - case *ecdsa.PrivateKey: - pemType = "EC" - var err error - derBytes, err = x509.MarshalECPrivateKey(key) - if err != nil { - panic(err) - } - default: - panic("unknown key type") - } - - var pemOut bytes.Buffer - pem.Encode(&pemOut, &pem.Block{Type: pemType + " PRIVATE KEY", Bytes: derBytes}) - - keyPath := tempFile(string(pemOut.Bytes())) - defer os.Remove(keyPath) - - var command []string - if len(test.command) > 0 { - command = append(command, test.command...) - } else { - command = append(command, defaultServerCommand...) - } - command = append(command, "-cert", certPath, "-certform", "DER", "-key", keyPath) - // serverPort contains the port that OpenSSL will listen on. OpenSSL - // can't take "0" as an argument here so we have to pick a number and - // hope that it's not in use on the machine. Since this only occurs - // when -update is given and thus when there's a human watching the - // test, this isn't too bad. - const serverPort = 24323 - command = append(command, "-accept", strconv.Itoa(serverPort)) - - if len(test.extensions) > 0 { - var serverInfo bytes.Buffer - for _, ext := range test.extensions { - pem.Encode(&serverInfo, &pem.Block{ - Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", binary.BigEndian.Uint16(ext)), - Bytes: ext, - }) - } - serverInfoPath := tempFile(serverInfo.String()) - defer os.Remove(serverInfoPath) - command = append(command, "-serverinfo", serverInfoPath) - } - - cmd := exec.Command(command[0], command[1:]...) - stdin = blockingSource(make(chan bool)) - cmd.Stdin = stdin - var out bytes.Buffer - cmd.Stdout = &out - cmd.Stderr = &out - if err := cmd.Start(); err != nil { - return nil, nil, nil, err - } - - // OpenSSL does print an "ACCEPT" banner, but it does so *before* - // opening the listening socket, so we can't use that to wait until it - // has started listening. Thus we are forced to poll until we get a - // connection. - var tcpConn net.Conn - for i := uint(0); i < 5; i++ { - tcpConn, err = net.DialTCP("tcp", nil, &net.TCPAddr{ - IP: net.IPv4(127, 0, 0, 1), - Port: serverPort, - }) - if err == nil { - break - } - time.Sleep((1 << i) * 5 * time.Millisecond) - } - if err != nil { - close(stdin) - out.WriteTo(os.Stdout) - cmd.Process.Kill() - return nil, nil, nil, cmd.Wait() - } - - record := &recordingConn{ - Conn: tcpConn, - } - - return record, cmd, stdin, nil -} - -func (test *clientTest) dataPath() string { - return filepath.Join("testdata", "Client-"+test.name) -} - -func (test *clientTest) loadData() (flows [][]byte, err error) { - in, err := os.Open(test.dataPath()) - if err != nil { - return nil, err - } - defer in.Close() - return parseTestData(in) -} - -func (test *clientTest) run(t *testing.T, write bool) { - var clientConn, serverConn net.Conn - var recordingConn *recordingConn - var childProcess *exec.Cmd - var stdin blockingSource - - if write { - var err error - recordingConn, childProcess, stdin, err = test.connFromCommand() - if err != nil { - t.Fatalf("Failed to start subcommand: %s", err) - } - clientConn = recordingConn - } else { - clientConn, serverConn = net.Pipe() - } - - config := test.config - if config == nil { - config = testConfig - } - client := Client(clientConn, config) - - doneChan := make(chan bool) - go func() { - if _, err := client.Write([]byte("hello\n")); err != nil { - t.Errorf("Client.Write failed: %s", err) - } - if test.validate != nil { - if err := test.validate(client.ConnectionState()); err != nil { - t.Errorf("validate callback returned error: %s", err) - } - } - client.Close() - clientConn.Close() - doneChan <- true - }() - - if !write { - flows, err := test.loadData() - if err != nil { - t.Fatalf("%s: failed to load data from %s: %v", test.name, test.dataPath(), err) - } - for i, b := range flows { - if i%2 == 1 { - serverConn.Write(b) - continue - } - bb := make([]byte, len(b)) - _, err := io.ReadFull(serverConn, bb) - if err != nil { - t.Fatalf("%s #%d: %s", test.name, i, err) - } - if !bytes.Equal(b, bb) { - t.Fatalf("%s #%d: mismatch on read: got:%x want:%x", test.name, i, bb, b) - } - } - serverConn.Close() - } - - <-doneChan - - if write { - path := test.dataPath() - out, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - t.Fatalf("Failed to create output file: %s", err) - } - defer out.Close() - recordingConn.Close() - close(stdin) - childProcess.Process.Kill() - childProcess.Wait() - if len(recordingConn.flows) < 3 { - childProcess.Stdout.(*bytes.Buffer).WriteTo(os.Stdout) - t.Fatalf("Client connection didn't work") - } - recordingConn.WriteTo(out) - fmt.Printf("Wrote %s\n", path) - } -} - -func runClientTestForVersion(t *testing.T, template *clientTest, prefix, option string) { - test := *template - test.name = prefix + test.name - if len(test.command) == 0 { - test.command = defaultClientCommand - } - test.command = append([]string(nil), test.command...) - test.command = append(test.command, option) - test.run(t, *update) -} - -func runClientTestTLS10(t *testing.T, template *clientTest) { - runClientTestForVersion(t, template, "TLSv10-", "-tls1") -} - -func runClientTestTLS11(t *testing.T, template *clientTest) { - runClientTestForVersion(t, template, "TLSv11-", "-tls1_1") -} - -func runClientTestTLS12(t *testing.T, template *clientTest) { - runClientTestForVersion(t, template, "TLSv12-", "-tls1_2") -} - -func TestHandshakeClientRSARC4(t *testing.T) { - test := &clientTest{ - name: "RSA-RC4", - command: []string{"openssl", "s_server", "-cipher", "RC4-SHA"}, - } - runClientTestTLS10(t, test) - runClientTestTLS11(t, test) - runClientTestTLS12(t, test) -} - -func TestHandshakeClientECDHERSAAES(t *testing.T) { - test := &clientTest{ - name: "ECDHE-RSA-AES", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-RSA-AES128-SHA"}, - } - runClientTestTLS10(t, test) - runClientTestTLS11(t, test) - runClientTestTLS12(t, test) -} - -func TestHandshakeClientECDHEECDSAAES(t *testing.T) { - test := &clientTest{ - name: "ECDHE-ECDSA-AES", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-ECDSA-AES128-SHA"}, - cert: testECDSACertificate, - key: testECDSAPrivateKey, - } - runClientTestTLS10(t, test) - runClientTestTLS11(t, test) - runClientTestTLS12(t, test) -} - -func TestHandshakeClientECDHEECDSAAESGCM(t *testing.T) { - test := &clientTest{ - name: "ECDHE-ECDSA-AES-GCM", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-ECDSA-AES128-GCM-SHA256"}, - cert: testECDSACertificate, - key: testECDSAPrivateKey, - } - runClientTestTLS12(t, test) -} - -func TestHandshakeClientAES256GCMSHA384(t *testing.T) { - test := &clientTest{ - name: "ECDHE-ECDSA-AES256-GCM-SHA384", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-ECDSA-AES256-GCM-SHA384"}, - cert: testECDSACertificate, - key: testECDSAPrivateKey, - } - runClientTestTLS12(t, test) -} - -func TestHandshakeClientCertRSA(t *testing.T) { - config := *testConfig - cert, _ := X509KeyPair([]byte(clientCertificatePEM), []byte(clientKeyPEM)) - config.Certificates = []Certificate{cert} - - test := &clientTest{ - name: "ClientCert-RSA-RSA", - command: []string{"openssl", "s_server", "-cipher", "RC4-SHA", "-verify", "1"}, - config: &config, - } - - runClientTestTLS10(t, test) - runClientTestTLS12(t, test) - - test = &clientTest{ - name: "ClientCert-RSA-ECDSA", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-ECDSA-AES128-SHA", "-verify", "1"}, - config: &config, - cert: testECDSACertificate, - key: testECDSAPrivateKey, - } - - runClientTestTLS10(t, test) - runClientTestTLS12(t, test) - - test = &clientTest{ - name: "ClientCert-RSA-AES256-GCM-SHA384", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-RSA-AES256-GCM-SHA384", "-verify", "1"}, - config: &config, - cert: testRSACertificate, - key: testRSAPrivateKey, - } - - runClientTestTLS12(t, test) -} - -func TestHandshakeClientCertECDSA(t *testing.T) { - config := *testConfig - cert, _ := X509KeyPair([]byte(clientECDSACertificatePEM), []byte(clientECDSAKeyPEM)) - config.Certificates = []Certificate{cert} - - test := &clientTest{ - name: "ClientCert-ECDSA-RSA", - command: []string{"openssl", "s_server", "-cipher", "RC4-SHA", "-verify", "1"}, - config: &config, - } - - runClientTestTLS10(t, test) - runClientTestTLS12(t, test) - - test = &clientTest{ - name: "ClientCert-ECDSA-ECDSA", - command: []string{"openssl", "s_server", "-cipher", "ECDHE-ECDSA-AES128-SHA", "-verify", "1"}, - config: &config, - cert: testECDSACertificate, - key: testECDSAPrivateKey, - } - - runClientTestTLS10(t, test) - runClientTestTLS12(t, test) -} - -func TestClientResumption(t *testing.T) { - serverConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA}, - Certificates: testConfig.Certificates, - } - - issuer, err := x509.ParseCertificate(testRSACertificateIssuer) - if err != nil { - panic(err) - } - - rootCAs := x509.NewCertPool() - rootCAs.AddCert(issuer) - - clientConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - ClientSessionCache: NewLRUClientSessionCache(32), - RootCAs: rootCAs, - ServerName: "example.golang", - } - - testResumeState := func(test string, didResume bool) { - _, hs, err := testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("%s: handshake failed: %s", test, err) - } - if hs.DidResume != didResume { - t.Fatalf("%s resumed: %v, expected: %v", test, hs.DidResume, didResume) - } - if didResume && (hs.PeerCertificates == nil || hs.VerifiedChains == nil) { - t.Fatalf("expected non-nil certificates after resumption. Got peerCertificates: %#v, verifedCertificates: %#v", hs.PeerCertificates, hs.VerifiedChains) - } - } - - getTicket := func() []byte { - return clientConfig.ClientSessionCache.(*lruSessionCache).q.Front().Value.(*lruSessionCacheEntry).state.sessionTicket - } - randomKey := func() [32]byte { - var k [32]byte - if _, err := io.ReadFull(serverConfig.rand(), k[:]); err != nil { - t.Fatalf("Failed to read new SessionTicketKey: %s", err) - } - return k - } - - testResumeState("Handshake", false) - ticket := getTicket() - testResumeState("Resume", true) - if !bytes.Equal(ticket, getTicket()) { - t.Fatal("first ticket doesn't match ticket after resumption") - } - - key2 := randomKey() - serverConfig.SetSessionTicketKeys([][32]byte{key2}) - - testResumeState("InvalidSessionTicketKey", false) - testResumeState("ResumeAfterInvalidSessionTicketKey", true) - - serverConfig.SetSessionTicketKeys([][32]byte{randomKey(), key2}) - ticket = getTicket() - testResumeState("KeyChange", true) - if bytes.Equal(ticket, getTicket()) { - t.Fatal("new ticket wasn't included while resuming") - } - testResumeState("KeyChangeFinish", true) - - clientConfig.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_RC4_128_SHA} - testResumeState("DifferentCipherSuite", false) - testResumeState("DifferentCipherSuiteRecovers", true) - - clientConfig.ClientSessionCache = nil - testResumeState("WithoutSessionCache", false) -} - -func TestLRUClientSessionCache(t *testing.T) { - // Initialize cache of capacity 4. - cache := NewLRUClientSessionCache(4) - cs := make([]ClientSessionState, 6) - keys := []string{"0", "1", "2", "3", "4", "5", "6"} - - // Add 4 entries to the cache and look them up. - for i := 0; i < 4; i++ { - cache.Put(keys[i], &cs[i]) - } - for i := 0; i < 4; i++ { - if s, ok := cache.Get(keys[i]); !ok || s != &cs[i] { - t.Fatalf("session cache failed lookup for added key: %s", keys[i]) - } - } - - // Add 2 more entries to the cache. First 2 should be evicted. - for i := 4; i < 6; i++ { - cache.Put(keys[i], &cs[i]) - } - for i := 0; i < 2; i++ { - if s, ok := cache.Get(keys[i]); ok || s != nil { - t.Fatalf("session cache should have evicted key: %s", keys[i]) - } - } - - // Touch entry 2. LRU should evict 3 next. - cache.Get(keys[2]) - cache.Put(keys[0], &cs[0]) - if s, ok := cache.Get(keys[3]); ok || s != nil { - t.Fatalf("session cache should have evicted key 3") - } - - // Update entry 0 in place. - cache.Put(keys[0], &cs[3]) - if s, ok := cache.Get(keys[0]); !ok || s != &cs[3] { - t.Fatalf("session cache failed update for key 0") - } - - // Adding a nil entry is valid. - cache.Put(keys[0], nil) - if s, ok := cache.Get(keys[0]); !ok || s != nil { - t.Fatalf("failed to add nil entry to cache") - } -} - -func TestHandshakeClientALPNMatch(t *testing.T) { - config := *testConfig - config.NextProtos = []string{"proto2", "proto1"} - - test := &clientTest{ - name: "ALPN", - // Note that this needs OpenSSL 1.0.2 because that is the first - // version that supports the -alpn flag. - command: []string{"openssl", "s_server", "-alpn", "proto1,proto2"}, - config: &config, - validate: func(state ConnectionState) error { - // The server's preferences should override the client. - if state.NegotiatedProtocol != "proto1" { - return fmt.Errorf("Got protocol %q, wanted proto1", state.NegotiatedProtocol) - } - return nil - }, - } - runClientTestTLS12(t, test) -} - -func TestHandshakeClientALPNNoMatch(t *testing.T) { - config := *testConfig - config.NextProtos = []string{"proto3"} - - test := &clientTest{ - name: "ALPN-NoMatch", - // Note that this needs OpenSSL 1.0.2 because that is the first - // version that supports the -alpn flag. - command: []string{"openssl", "s_server", "-alpn", "proto1,proto2"}, - config: &config, - validate: func(state ConnectionState) error { - // There's no overlap so OpenSSL will not select a protocol. - if state.NegotiatedProtocol != "" { - return fmt.Errorf("Got protocol %q, wanted ''", state.NegotiatedProtocol) - } - return nil - }, - } - runClientTestTLS12(t, test) -} - -// sctsBase64 contains data from `openssl s_client -serverinfo 18 -connect ritter.vg:443` -const sctsBase64 = "ABIBaQFnAHUApLkJkLQYWBSHuxOizGdwCjw1mAT5G9+443fNDsgN3BAAAAFHl5nuFgAABAMARjBEAiAcS4JdlW5nW9sElUv2zvQyPoZ6ejKrGGB03gjaBZFMLwIgc1Qbbn+hsH0RvObzhS+XZhr3iuQQJY8S9G85D9KeGPAAdgBo9pj4H2SCvjqM7rkoHUz8cVFdZ5PURNEKZ6y7T0/7xAAAAUeX4bVwAAAEAwBHMEUCIDIhFDgG2HIuADBkGuLobU5a4dlCHoJLliWJ1SYT05z6AiEAjxIoZFFPRNWMGGIjskOTMwXzQ1Wh2e7NxXE1kd1J0QsAdgDuS723dc5guuFCaR+r4Z5mow9+X7By2IMAxHuJeqj9ywAAAUhcZIqHAAAEAwBHMEUCICmJ1rBT09LpkbzxtUC+Hi7nXLR0J+2PmwLp+sJMuqK+AiEAr0NkUnEVKVhAkccIFpYDqHOlZaBsuEhWWrYpg2RtKp0=" - -func TestHandshakClientSCTs(t *testing.T) { - config := *testConfig - - scts, err := base64.StdEncoding.DecodeString(sctsBase64) - if err != nil { - t.Fatal(err) - } - - test := &clientTest{ - name: "SCT", - // Note that this needs OpenSSL 1.0.2 because that is the first - // version that supports the -serverinfo flag. - command: []string{"openssl", "s_server"}, - config: &config, - extensions: [][]byte{scts}, - validate: func(state ConnectionState) error { - expectedSCTs := [][]byte{ - scts[8:125], - scts[127:245], - scts[247:], - } - if n := len(state.SignedCertificateTimestamps); n != len(expectedSCTs) { - return fmt.Errorf("Got %d scts, wanted %d", n, len(expectedSCTs)) - } - for i, expected := range expectedSCTs { - if sct := state.SignedCertificateTimestamps[i]; !bytes.Equal(sct, expected) { - return fmt.Errorf("SCT #%d contained %x, expected %x", i, sct, expected) - } - } - return nil - }, - } - runClientTestTLS12(t, test) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages.go deleted file mode 100644 index 799a776799aa1c158562f7e68a5712d0d68a6641..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages.go +++ /dev/null @@ -1,1524 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import "bytes" - -type clientHelloMsg struct { - raw []byte - vers uint16 - random []byte - sessionId []byte - cipherSuites []uint16 - compressionMethods []uint8 - nextProtoNeg bool - serverName string - ocspStapling bool - scts bool - supportedCurves []CurveID - supportedPoints []uint8 - ticketSupported bool - sessionTicket []uint8 - signatureAndHashes []signatureAndHash - secureRenegotiation bool - alpnProtocols []string -} - -func (m *clientHelloMsg) equal(i interface{}) bool { - m1, ok := i.(*clientHelloMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - m.vers == m1.vers && - bytes.Equal(m.random, m1.random) && - bytes.Equal(m.sessionId, m1.sessionId) && - eqUint16s(m.cipherSuites, m1.cipherSuites) && - bytes.Equal(m.compressionMethods, m1.compressionMethods) && - m.nextProtoNeg == m1.nextProtoNeg && - m.serverName == m1.serverName && - m.ocspStapling == m1.ocspStapling && - m.scts == m1.scts && - eqCurveIDs(m.supportedCurves, m1.supportedCurves) && - bytes.Equal(m.supportedPoints, m1.supportedPoints) && - m.ticketSupported == m1.ticketSupported && - bytes.Equal(m.sessionTicket, m1.sessionTicket) && - eqSignatureAndHashes(m.signatureAndHashes, m1.signatureAndHashes) && - m.secureRenegotiation == m1.secureRenegotiation && - eqStrings(m.alpnProtocols, m1.alpnProtocols) -} - -func (m *clientHelloMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - length := 2 + 32 + 1 + len(m.sessionId) + 2 + len(m.cipherSuites)*2 + 1 + len(m.compressionMethods) - numExtensions := 0 - extensionsLength := 0 - if m.nextProtoNeg { - numExtensions++ - } - if m.ocspStapling { - extensionsLength += 1 + 2 + 2 - numExtensions++ - } - if len(m.serverName) > 0 { - extensionsLength += 5 + len(m.serverName) - numExtensions++ - } - if len(m.supportedCurves) > 0 { - extensionsLength += 2 + 2*len(m.supportedCurves) - numExtensions++ - } - if len(m.supportedPoints) > 0 { - extensionsLength += 1 + len(m.supportedPoints) - numExtensions++ - } - if m.ticketSupported { - extensionsLength += len(m.sessionTicket) - numExtensions++ - } - if len(m.signatureAndHashes) > 0 { - extensionsLength += 2 + 2*len(m.signatureAndHashes) - numExtensions++ - } - if m.secureRenegotiation { - extensionsLength += 1 - numExtensions++ - } - if len(m.alpnProtocols) > 0 { - extensionsLength += 2 - for _, s := range m.alpnProtocols { - if l := len(s); l == 0 || l > 255 { - panic("invalid ALPN protocol") - } - extensionsLength++ - extensionsLength += len(s) - } - numExtensions++ - } - if m.scts { - numExtensions++ - } - if numExtensions > 0 { - extensionsLength += 4 * numExtensions - length += 2 + extensionsLength - } - - x := make([]byte, 4+length) - x[0] = typeClientHello - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - x[4] = uint8(m.vers >> 8) - x[5] = uint8(m.vers) - copy(x[6:38], m.random) - x[38] = uint8(len(m.sessionId)) - copy(x[39:39+len(m.sessionId)], m.sessionId) - y := x[39+len(m.sessionId):] - y[0] = uint8(len(m.cipherSuites) >> 7) - y[1] = uint8(len(m.cipherSuites) << 1) - for i, suite := range m.cipherSuites { - y[2+i*2] = uint8(suite >> 8) - y[3+i*2] = uint8(suite) - } - z := y[2+len(m.cipherSuites)*2:] - z[0] = uint8(len(m.compressionMethods)) - copy(z[1:], m.compressionMethods) - - z = z[1+len(m.compressionMethods):] - if numExtensions > 0 { - z[0] = byte(extensionsLength >> 8) - z[1] = byte(extensionsLength) - z = z[2:] - } - if m.nextProtoNeg { - z[0] = byte(extensionNextProtoNeg >> 8) - z[1] = byte(extensionNextProtoNeg & 0xff) - // The length is always 0 - z = z[4:] - } - if len(m.serverName) > 0 { - z[0] = byte(extensionServerName >> 8) - z[1] = byte(extensionServerName & 0xff) - l := len(m.serverName) + 5 - z[2] = byte(l >> 8) - z[3] = byte(l) - z = z[4:] - - // RFC 3546, section 3.1 - // - // struct { - // NameType name_type; - // select (name_type) { - // case host_name: HostName; - // } name; - // } ServerName; - // - // enum { - // host_name(0), (255) - // } NameType; - // - // opaque HostName<1..2^16-1>; - // - // struct { - // ServerName server_name_list<1..2^16-1> - // } ServerNameList; - - z[0] = byte((len(m.serverName) + 3) >> 8) - z[1] = byte(len(m.serverName) + 3) - z[3] = byte(len(m.serverName) >> 8) - z[4] = byte(len(m.serverName)) - copy(z[5:], []byte(m.serverName)) - z = z[l:] - } - if m.ocspStapling { - // RFC 4366, section 3.6 - z[0] = byte(extensionStatusRequest >> 8) - z[1] = byte(extensionStatusRequest) - z[2] = 0 - z[3] = 5 - z[4] = 1 // OCSP type - // Two zero valued uint16s for the two lengths. - z = z[9:] - } - if len(m.supportedCurves) > 0 { - // http://tools.ietf.org/html/rfc4492#section-5.5.1 - z[0] = byte(extensionSupportedCurves >> 8) - z[1] = byte(extensionSupportedCurves) - l := 2 + 2*len(m.supportedCurves) - z[2] = byte(l >> 8) - z[3] = byte(l) - l -= 2 - z[4] = byte(l >> 8) - z[5] = byte(l) - z = z[6:] - for _, curve := range m.supportedCurves { - z[0] = byte(curve >> 8) - z[1] = byte(curve) - z = z[2:] - } - } - if len(m.supportedPoints) > 0 { - // http://tools.ietf.org/html/rfc4492#section-5.5.2 - z[0] = byte(extensionSupportedPoints >> 8) - z[1] = byte(extensionSupportedPoints) - l := 1 + len(m.supportedPoints) - z[2] = byte(l >> 8) - z[3] = byte(l) - l-- - z[4] = byte(l) - z = z[5:] - for _, pointFormat := range m.supportedPoints { - z[0] = byte(pointFormat) - z = z[1:] - } - } - if m.ticketSupported { - // http://tools.ietf.org/html/rfc5077#section-3.2 - z[0] = byte(extensionSessionTicket >> 8) - z[1] = byte(extensionSessionTicket) - l := len(m.sessionTicket) - z[2] = byte(l >> 8) - z[3] = byte(l) - z = z[4:] - copy(z, m.sessionTicket) - z = z[len(m.sessionTicket):] - } - if len(m.signatureAndHashes) > 0 { - // https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 - z[0] = byte(extensionSignatureAlgorithms >> 8) - z[1] = byte(extensionSignatureAlgorithms) - l := 2 + 2*len(m.signatureAndHashes) - z[2] = byte(l >> 8) - z[3] = byte(l) - z = z[4:] - - l -= 2 - z[0] = byte(l >> 8) - z[1] = byte(l) - z = z[2:] - for _, sigAndHash := range m.signatureAndHashes { - z[0] = sigAndHash.hash - z[1] = sigAndHash.signature - z = z[2:] - } - } - if m.secureRenegotiation { - z[0] = byte(extensionRenegotiationInfo >> 8) - z[1] = byte(extensionRenegotiationInfo & 0xff) - z[2] = 0 - z[3] = 1 - z = z[5:] - } - if len(m.alpnProtocols) > 0 { - z[0] = byte(extensionALPN >> 8) - z[1] = byte(extensionALPN & 0xff) - lengths := z[2:] - z = z[6:] - - stringsLength := 0 - for _, s := range m.alpnProtocols { - l := len(s) - z[0] = byte(l) - copy(z[1:], s) - z = z[1+l:] - stringsLength += 1 + l - } - - lengths[2] = byte(stringsLength >> 8) - lengths[3] = byte(stringsLength) - stringsLength += 2 - lengths[0] = byte(stringsLength >> 8) - lengths[1] = byte(stringsLength) - } - if m.scts { - // https://tools.ietf.org/html/rfc6962#section-3.3.1 - z[0] = byte(extensionSCT >> 8) - z[1] = byte(extensionSCT) - // zero uint16 for the zero-length extension_data - z = z[4:] - } - - m.raw = x - - return x -} - -func (m *clientHelloMsg) unmarshal(data []byte) bool { - if len(data) < 42 { - return false - } - m.raw = data - m.vers = uint16(data[4])<<8 | uint16(data[5]) - m.random = data[6:38] - sessionIdLen := int(data[38]) - if sessionIdLen > 32 || len(data) < 39+sessionIdLen { - return false - } - m.sessionId = data[39 : 39+sessionIdLen] - data = data[39+sessionIdLen:] - if len(data) < 2 { - return false - } - // cipherSuiteLen is the number of bytes of cipher suite numbers. Since - // they are uint16s, the number must be even. - cipherSuiteLen := int(data[0])<<8 | int(data[1]) - if cipherSuiteLen%2 == 1 || len(data) < 2+cipherSuiteLen { - return false - } - numCipherSuites := cipherSuiteLen / 2 - m.cipherSuites = make([]uint16, numCipherSuites) - for i := 0; i < numCipherSuites; i++ { - m.cipherSuites[i] = uint16(data[2+2*i])<<8 | uint16(data[3+2*i]) - if m.cipherSuites[i] == scsvRenegotiation { - m.secureRenegotiation = true - } - } - data = data[2+cipherSuiteLen:] - if len(data) < 1 { - return false - } - compressionMethodsLen := int(data[0]) - if len(data) < 1+compressionMethodsLen { - return false - } - m.compressionMethods = data[1 : 1+compressionMethodsLen] - - data = data[1+compressionMethodsLen:] - - m.nextProtoNeg = false - m.serverName = "" - m.ocspStapling = false - m.ticketSupported = false - m.sessionTicket = nil - m.signatureAndHashes = nil - m.alpnProtocols = nil - m.scts = false - - if len(data) == 0 { - // ClientHello is optionally followed by extension data - return true - } - if len(data) < 2 { - return false - } - - extensionsLength := int(data[0])<<8 | int(data[1]) - data = data[2:] - if extensionsLength != len(data) { - return false - } - - for len(data) != 0 { - if len(data) < 4 { - return false - } - extension := uint16(data[0])<<8 | uint16(data[1]) - length := int(data[2])<<8 | int(data[3]) - data = data[4:] - if len(data) < length { - return false - } - - switch extension { - case extensionServerName: - d := data[:length] - if len(d) < 2 { - return false - } - namesLen := int(d[0])<<8 | int(d[1]) - d = d[2:] - if len(d) != namesLen { - return false - } - for len(d) > 0 { - if len(d) < 3 { - return false - } - nameType := d[0] - nameLen := int(d[1])<<8 | int(d[2]) - d = d[3:] - if len(d) < nameLen { - return false - } - if nameType == 0 { - m.serverName = string(d[:nameLen]) - break - } - d = d[nameLen:] - } - case extensionNextProtoNeg: - if length > 0 { - return false - } - m.nextProtoNeg = true - case extensionStatusRequest: - m.ocspStapling = length > 0 && data[0] == statusTypeOCSP - case extensionSupportedCurves: - // http://tools.ietf.org/html/rfc4492#section-5.5.1 - if length < 2 { - return false - } - l := int(data[0])<<8 | int(data[1]) - if l%2 == 1 || length != l+2 { - return false - } - numCurves := l / 2 - m.supportedCurves = make([]CurveID, numCurves) - d := data[2:] - for i := 0; i < numCurves; i++ { - m.supportedCurves[i] = CurveID(d[0])<<8 | CurveID(d[1]) - d = d[2:] - } - case extensionSupportedPoints: - // http://tools.ietf.org/html/rfc4492#section-5.5.2 - if length < 1 { - return false - } - l := int(data[0]) - if length != l+1 { - return false - } - m.supportedPoints = make([]uint8, l) - copy(m.supportedPoints, data[1:]) - case extensionSessionTicket: - // http://tools.ietf.org/html/rfc5077#section-3.2 - m.ticketSupported = true - m.sessionTicket = data[:length] - case extensionSignatureAlgorithms: - // https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 - if length < 2 || length&1 != 0 { - return false - } - l := int(data[0])<<8 | int(data[1]) - if l != length-2 { - return false - } - n := l / 2 - d := data[2:] - m.signatureAndHashes = make([]signatureAndHash, n) - for i := range m.signatureAndHashes { - m.signatureAndHashes[i].hash = d[0] - m.signatureAndHashes[i].signature = d[1] - d = d[2:] - } - case extensionRenegotiationInfo: - if length != 1 || data[0] != 0 { - return false - } - m.secureRenegotiation = true - case extensionALPN: - if length < 2 { - return false - } - l := int(data[0])<<8 | int(data[1]) - if l != length-2 { - return false - } - d := data[2:length] - for len(d) != 0 { - stringLen := int(d[0]) - d = d[1:] - if stringLen == 0 || stringLen > len(d) { - return false - } - m.alpnProtocols = append(m.alpnProtocols, string(d[:stringLen])) - d = d[stringLen:] - } - case extensionSCT: - m.scts = true - if length != 0 { - return false - } - } - data = data[length:] - } - - return true -} - -type serverHelloMsg struct { - raw []byte - vers uint16 - random []byte - sessionId []byte - cipherSuite uint16 - compressionMethod uint8 - nextProtoNeg bool - nextProtos []string - ocspStapling bool - scts [][]byte - ticketSupported bool - secureRenegotiation bool - alpnProtocol string -} - -func (m *serverHelloMsg) equal(i interface{}) bool { - m1, ok := i.(*serverHelloMsg) - if !ok { - return false - } - - if len(m.scts) != len(m1.scts) { - return false - } - for i, sct := range m.scts { - if !bytes.Equal(sct, m1.scts[i]) { - return false - } - } - - return bytes.Equal(m.raw, m1.raw) && - m.vers == m1.vers && - bytes.Equal(m.random, m1.random) && - bytes.Equal(m.sessionId, m1.sessionId) && - m.cipherSuite == m1.cipherSuite && - m.compressionMethod == m1.compressionMethod && - m.nextProtoNeg == m1.nextProtoNeg && - eqStrings(m.nextProtos, m1.nextProtos) && - m.ocspStapling == m1.ocspStapling && - m.ticketSupported == m1.ticketSupported && - m.secureRenegotiation == m1.secureRenegotiation && - m.alpnProtocol == m1.alpnProtocol -} - -func (m *serverHelloMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - length := 38 + len(m.sessionId) - numExtensions := 0 - extensionsLength := 0 - - nextProtoLen := 0 - if m.nextProtoNeg { - numExtensions++ - for _, v := range m.nextProtos { - nextProtoLen += len(v) - } - nextProtoLen += len(m.nextProtos) - extensionsLength += nextProtoLen - } - if m.ocspStapling { - numExtensions++ - } - if m.ticketSupported { - numExtensions++ - } - if m.secureRenegotiation { - extensionsLength += 1 - numExtensions++ - } - if alpnLen := len(m.alpnProtocol); alpnLen > 0 { - if alpnLen >= 256 { - panic("invalid ALPN protocol") - } - extensionsLength += 2 + 1 + alpnLen - numExtensions++ - } - sctLen := 0 - if len(m.scts) > 0 { - for _, sct := range m.scts { - sctLen += len(sct) + 2 - } - extensionsLength += 2 + sctLen - numExtensions++ - } - - if numExtensions > 0 { - extensionsLength += 4 * numExtensions - length += 2 + extensionsLength - } - - x := make([]byte, 4+length) - x[0] = typeServerHello - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - x[4] = uint8(m.vers >> 8) - x[5] = uint8(m.vers) - copy(x[6:38], m.random) - x[38] = uint8(len(m.sessionId)) - copy(x[39:39+len(m.sessionId)], m.sessionId) - z := x[39+len(m.sessionId):] - z[0] = uint8(m.cipherSuite >> 8) - z[1] = uint8(m.cipherSuite) - z[2] = uint8(m.compressionMethod) - - z = z[3:] - if numExtensions > 0 { - z[0] = byte(extensionsLength >> 8) - z[1] = byte(extensionsLength) - z = z[2:] - } - if m.nextProtoNeg { - z[0] = byte(extensionNextProtoNeg >> 8) - z[1] = byte(extensionNextProtoNeg & 0xff) - z[2] = byte(nextProtoLen >> 8) - z[3] = byte(nextProtoLen) - z = z[4:] - - for _, v := range m.nextProtos { - l := len(v) - if l > 255 { - l = 255 - } - z[0] = byte(l) - copy(z[1:], []byte(v[0:l])) - z = z[1+l:] - } - } - if m.ocspStapling { - z[0] = byte(extensionStatusRequest >> 8) - z[1] = byte(extensionStatusRequest) - z = z[4:] - } - if m.ticketSupported { - z[0] = byte(extensionSessionTicket >> 8) - z[1] = byte(extensionSessionTicket) - z = z[4:] - } - if m.secureRenegotiation { - z[0] = byte(extensionRenegotiationInfo >> 8) - z[1] = byte(extensionRenegotiationInfo & 0xff) - z[2] = 0 - z[3] = 1 - z = z[5:] - } - if alpnLen := len(m.alpnProtocol); alpnLen > 0 { - z[0] = byte(extensionALPN >> 8) - z[1] = byte(extensionALPN & 0xff) - l := 2 + 1 + alpnLen - z[2] = byte(l >> 8) - z[3] = byte(l) - l -= 2 - z[4] = byte(l >> 8) - z[5] = byte(l) - l -= 1 - z[6] = byte(l) - copy(z[7:], []byte(m.alpnProtocol)) - z = z[7+alpnLen:] - } - if sctLen > 0 { - z[0] = byte(extensionSCT >> 8) - z[1] = byte(extensionSCT) - l := sctLen + 2 - z[2] = byte(l >> 8) - z[3] = byte(l) - z[4] = byte(sctLen >> 8) - z[5] = byte(sctLen) - - z = z[6:] - for _, sct := range m.scts { - z[0] = byte(len(sct) >> 8) - z[1] = byte(len(sct)) - copy(z[2:], sct) - z = z[len(sct)+2:] - } - } - - m.raw = x - - return x -} - -func (m *serverHelloMsg) unmarshal(data []byte) bool { - if len(data) < 42 { - return false - } - m.raw = data - m.vers = uint16(data[4])<<8 | uint16(data[5]) - m.random = data[6:38] - sessionIdLen := int(data[38]) - if sessionIdLen > 32 || len(data) < 39+sessionIdLen { - return false - } - m.sessionId = data[39 : 39+sessionIdLen] - data = data[39+sessionIdLen:] - if len(data) < 3 { - return false - } - m.cipherSuite = uint16(data[0])<<8 | uint16(data[1]) - m.compressionMethod = data[2] - data = data[3:] - - m.nextProtoNeg = false - m.nextProtos = nil - m.ocspStapling = false - m.scts = nil - m.ticketSupported = false - m.alpnProtocol = "" - - if len(data) == 0 { - // ServerHello is optionally followed by extension data - return true - } - if len(data) < 2 { - return false - } - - extensionsLength := int(data[0])<<8 | int(data[1]) - data = data[2:] - if len(data) != extensionsLength { - return false - } - - for len(data) != 0 { - if len(data) < 4 { - return false - } - extension := uint16(data[0])<<8 | uint16(data[1]) - length := int(data[2])<<8 | int(data[3]) - data = data[4:] - if len(data) < length { - return false - } - - switch extension { - case extensionNextProtoNeg: - m.nextProtoNeg = true - d := data[:length] - for len(d) > 0 { - l := int(d[0]) - d = d[1:] - if l == 0 || l > len(d) { - return false - } - m.nextProtos = append(m.nextProtos, string(d[:l])) - d = d[l:] - } - case extensionStatusRequest: - if length > 0 { - return false - } - m.ocspStapling = true - case extensionSessionTicket: - if length > 0 { - return false - } - m.ticketSupported = true - case extensionRenegotiationInfo: - if length != 1 || data[0] != 0 { - return false - } - m.secureRenegotiation = true - case extensionALPN: - d := data[:length] - if len(d) < 3 { - return false - } - l := int(d[0])<<8 | int(d[1]) - if l != len(d)-2 { - return false - } - d = d[2:] - l = int(d[0]) - if l != len(d)-1 { - return false - } - d = d[1:] - m.alpnProtocol = string(d) - case extensionSCT: - d := data[:length] - - if len(d) < 2 { - return false - } - l := int(d[0])<<8 | int(d[1]) - d = d[2:] - if len(d) != l { - return false - } - if l == 0 { - continue - } - - m.scts = make([][]byte, 0, 3) - for len(d) != 0 { - if len(d) < 2 { - return false - } - sctLen := int(d[0])<<8 | int(d[1]) - d = d[2:] - if len(d) < sctLen { - return false - } - m.scts = append(m.scts, d[:sctLen]) - d = d[sctLen:] - } - } - data = data[length:] - } - - return true -} - -type certificateMsg struct { - raw []byte - certificates [][]byte -} - -func (m *certificateMsg) equal(i interface{}) bool { - m1, ok := i.(*certificateMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - eqByteSlices(m.certificates, m1.certificates) -} - -func (m *certificateMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - var i int - for _, slice := range m.certificates { - i += len(slice) - } - - length := 3 + 3*len(m.certificates) + i - x = make([]byte, 4+length) - x[0] = typeCertificate - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - certificateOctets := length - 3 - x[4] = uint8(certificateOctets >> 16) - x[5] = uint8(certificateOctets >> 8) - x[6] = uint8(certificateOctets) - - y := x[7:] - for _, slice := range m.certificates { - y[0] = uint8(len(slice) >> 16) - y[1] = uint8(len(slice) >> 8) - y[2] = uint8(len(slice)) - copy(y[3:], slice) - y = y[3+len(slice):] - } - - m.raw = x - return -} - -func (m *certificateMsg) unmarshal(data []byte) bool { - if len(data) < 7 { - return false - } - - m.raw = data - certsLen := uint32(data[4])<<16 | uint32(data[5])<<8 | uint32(data[6]) - if uint32(len(data)) != certsLen+7 { - return false - } - - numCerts := 0 - d := data[7:] - for certsLen > 0 { - if len(d) < 4 { - return false - } - certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) - if uint32(len(d)) < 3+certLen { - return false - } - d = d[3+certLen:] - certsLen -= 3 + certLen - numCerts++ - } - - m.certificates = make([][]byte, numCerts) - d = data[7:] - for i := 0; i < numCerts; i++ { - certLen := uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2]) - m.certificates[i] = d[3 : 3+certLen] - d = d[3+certLen:] - } - - return true -} - -type serverKeyExchangeMsg struct { - raw []byte - key []byte -} - -func (m *serverKeyExchangeMsg) equal(i interface{}) bool { - m1, ok := i.(*serverKeyExchangeMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - bytes.Equal(m.key, m1.key) -} - -func (m *serverKeyExchangeMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - length := len(m.key) - x := make([]byte, length+4) - x[0] = typeServerKeyExchange - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - copy(x[4:], m.key) - - m.raw = x - return x -} - -func (m *serverKeyExchangeMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 4 { - return false - } - m.key = data[4:] - return true -} - -type certificateStatusMsg struct { - raw []byte - statusType uint8 - response []byte -} - -func (m *certificateStatusMsg) equal(i interface{}) bool { - m1, ok := i.(*certificateStatusMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - m.statusType == m1.statusType && - bytes.Equal(m.response, m1.response) -} - -func (m *certificateStatusMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - - var x []byte - if m.statusType == statusTypeOCSP { - x = make([]byte, 4+4+len(m.response)) - x[0] = typeCertificateStatus - l := len(m.response) + 4 - x[1] = byte(l >> 16) - x[2] = byte(l >> 8) - x[3] = byte(l) - x[4] = statusTypeOCSP - - l -= 4 - x[5] = byte(l >> 16) - x[6] = byte(l >> 8) - x[7] = byte(l) - copy(x[8:], m.response) - } else { - x = []byte{typeCertificateStatus, 0, 0, 1, m.statusType} - } - - m.raw = x - return x -} - -func (m *certificateStatusMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 5 { - return false - } - m.statusType = data[4] - - m.response = nil - if m.statusType == statusTypeOCSP { - if len(data) < 8 { - return false - } - respLen := uint32(data[5])<<16 | uint32(data[6])<<8 | uint32(data[7]) - if uint32(len(data)) != 4+4+respLen { - return false - } - m.response = data[8:] - } - return true -} - -type serverHelloDoneMsg struct{} - -func (m *serverHelloDoneMsg) equal(i interface{}) bool { - _, ok := i.(*serverHelloDoneMsg) - return ok -} - -func (m *serverHelloDoneMsg) marshal() []byte { - x := make([]byte, 4) - x[0] = typeServerHelloDone - return x -} - -func (m *serverHelloDoneMsg) unmarshal(data []byte) bool { - return len(data) == 4 -} - -type clientKeyExchangeMsg struct { - raw []byte - ciphertext []byte -} - -func (m *clientKeyExchangeMsg) equal(i interface{}) bool { - m1, ok := i.(*clientKeyExchangeMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - bytes.Equal(m.ciphertext, m1.ciphertext) -} - -func (m *clientKeyExchangeMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - length := len(m.ciphertext) - x := make([]byte, length+4) - x[0] = typeClientKeyExchange - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - copy(x[4:], m.ciphertext) - - m.raw = x - return x -} - -func (m *clientKeyExchangeMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 4 { - return false - } - l := int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - if l != len(data)-4 { - return false - } - m.ciphertext = data[4:] - return true -} - -type finishedMsg struct { - raw []byte - verifyData []byte -} - -func (m *finishedMsg) equal(i interface{}) bool { - m1, ok := i.(*finishedMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - bytes.Equal(m.verifyData, m1.verifyData) -} - -func (m *finishedMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - x = make([]byte, 4+len(m.verifyData)) - x[0] = typeFinished - x[3] = byte(len(m.verifyData)) - copy(x[4:], m.verifyData) - m.raw = x - return -} - -func (m *finishedMsg) unmarshal(data []byte) bool { - m.raw = data - if len(data) < 4 { - return false - } - m.verifyData = data[4:] - return true -} - -type nextProtoMsg struct { - raw []byte - proto string -} - -func (m *nextProtoMsg) equal(i interface{}) bool { - m1, ok := i.(*nextProtoMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - m.proto == m1.proto -} - -func (m *nextProtoMsg) marshal() []byte { - if m.raw != nil { - return m.raw - } - l := len(m.proto) - if l > 255 { - l = 255 - } - - padding := 32 - (l+2)%32 - length := l + padding + 2 - x := make([]byte, length+4) - x[0] = typeNextProtocol - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - y := x[4:] - y[0] = byte(l) - copy(y[1:], []byte(m.proto[0:l])) - y = y[1+l:] - y[0] = byte(padding) - - m.raw = x - - return x -} - -func (m *nextProtoMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 5 { - return false - } - data = data[4:] - protoLen := int(data[0]) - data = data[1:] - if len(data) < protoLen { - return false - } - m.proto = string(data[0:protoLen]) - data = data[protoLen:] - - if len(data) < 1 { - return false - } - paddingLen := int(data[0]) - data = data[1:] - if len(data) != paddingLen { - return false - } - - return true -} - -type certificateRequestMsg struct { - raw []byte - // hasSignatureAndHash indicates whether this message includes a list - // of signature and hash functions. This change was introduced with TLS - // 1.2. - hasSignatureAndHash bool - - certificateTypes []byte - signatureAndHashes []signatureAndHash - certificateAuthorities [][]byte -} - -func (m *certificateRequestMsg) equal(i interface{}) bool { - m1, ok := i.(*certificateRequestMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - bytes.Equal(m.certificateTypes, m1.certificateTypes) && - eqByteSlices(m.certificateAuthorities, m1.certificateAuthorities) && - eqSignatureAndHashes(m.signatureAndHashes, m1.signatureAndHashes) -} - -func (m *certificateRequestMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - // See http://tools.ietf.org/html/rfc4346#section-7.4.4 - length := 1 + len(m.certificateTypes) + 2 - casLength := 0 - for _, ca := range m.certificateAuthorities { - casLength += 2 + len(ca) - } - length += casLength - - if m.hasSignatureAndHash { - length += 2 + 2*len(m.signatureAndHashes) - } - - x = make([]byte, 4+length) - x[0] = typeCertificateRequest - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - - x[4] = uint8(len(m.certificateTypes)) - - copy(x[5:], m.certificateTypes) - y := x[5+len(m.certificateTypes):] - - if m.hasSignatureAndHash { - n := len(m.signatureAndHashes) * 2 - y[0] = uint8(n >> 8) - y[1] = uint8(n) - y = y[2:] - for _, sigAndHash := range m.signatureAndHashes { - y[0] = sigAndHash.hash - y[1] = sigAndHash.signature - y = y[2:] - } - } - - y[0] = uint8(casLength >> 8) - y[1] = uint8(casLength) - y = y[2:] - for _, ca := range m.certificateAuthorities { - y[0] = uint8(len(ca) >> 8) - y[1] = uint8(len(ca)) - y = y[2:] - copy(y, ca) - y = y[len(ca):] - } - - m.raw = x - return -} - -func (m *certificateRequestMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 5 { - return false - } - - length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) - if uint32(len(data))-4 != length { - return false - } - - numCertTypes := int(data[4]) - data = data[5:] - if numCertTypes == 0 || len(data) <= numCertTypes { - return false - } - - m.certificateTypes = make([]byte, numCertTypes) - if copy(m.certificateTypes, data) != numCertTypes { - return false - } - - data = data[numCertTypes:] - - if m.hasSignatureAndHash { - if len(data) < 2 { - return false - } - sigAndHashLen := uint16(data[0])<<8 | uint16(data[1]) - data = data[2:] - if sigAndHashLen&1 != 0 { - return false - } - if len(data) < int(sigAndHashLen) { - return false - } - numSigAndHash := sigAndHashLen / 2 - m.signatureAndHashes = make([]signatureAndHash, numSigAndHash) - for i := range m.signatureAndHashes { - m.signatureAndHashes[i].hash = data[0] - m.signatureAndHashes[i].signature = data[1] - data = data[2:] - } - } - - if len(data) < 2 { - return false - } - casLength := uint16(data[0])<<8 | uint16(data[1]) - data = data[2:] - if len(data) < int(casLength) { - return false - } - cas := make([]byte, casLength) - copy(cas, data) - data = data[casLength:] - - m.certificateAuthorities = nil - for len(cas) > 0 { - if len(cas) < 2 { - return false - } - caLen := uint16(cas[0])<<8 | uint16(cas[1]) - cas = cas[2:] - - if len(cas) < int(caLen) { - return false - } - - m.certificateAuthorities = append(m.certificateAuthorities, cas[:caLen]) - cas = cas[caLen:] - } - if len(data) > 0 { - return false - } - - return true -} - -type certificateVerifyMsg struct { - raw []byte - hasSignatureAndHash bool - signatureAndHash signatureAndHash - signature []byte -} - -func (m *certificateVerifyMsg) equal(i interface{}) bool { - m1, ok := i.(*certificateVerifyMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - m.hasSignatureAndHash == m1.hasSignatureAndHash && - m.signatureAndHash.hash == m1.signatureAndHash.hash && - m.signatureAndHash.signature == m1.signatureAndHash.signature && - bytes.Equal(m.signature, m1.signature) -} - -func (m *certificateVerifyMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - // See http://tools.ietf.org/html/rfc4346#section-7.4.8 - siglength := len(m.signature) - length := 2 + siglength - if m.hasSignatureAndHash { - length += 2 - } - x = make([]byte, 4+length) - x[0] = typeCertificateVerify - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - y := x[4:] - if m.hasSignatureAndHash { - y[0] = m.signatureAndHash.hash - y[1] = m.signatureAndHash.signature - y = y[2:] - } - y[0] = uint8(siglength >> 8) - y[1] = uint8(siglength) - copy(y[2:], m.signature) - - m.raw = x - - return -} - -func (m *certificateVerifyMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 6 { - return false - } - - length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) - if uint32(len(data))-4 != length { - return false - } - - data = data[4:] - if m.hasSignatureAndHash { - m.signatureAndHash.hash = data[0] - m.signatureAndHash.signature = data[1] - data = data[2:] - } - - if len(data) < 2 { - return false - } - siglength := int(data[0])<<8 + int(data[1]) - data = data[2:] - if len(data) != siglength { - return false - } - - m.signature = data - - return true -} - -type newSessionTicketMsg struct { - raw []byte - ticket []byte -} - -func (m *newSessionTicketMsg) equal(i interface{}) bool { - m1, ok := i.(*newSessionTicketMsg) - if !ok { - return false - } - - return bytes.Equal(m.raw, m1.raw) && - bytes.Equal(m.ticket, m1.ticket) -} - -func (m *newSessionTicketMsg) marshal() (x []byte) { - if m.raw != nil { - return m.raw - } - - // See http://tools.ietf.org/html/rfc5077#section-3.3 - ticketLen := len(m.ticket) - length := 2 + 4 + ticketLen - x = make([]byte, 4+length) - x[0] = typeNewSessionTicket - x[1] = uint8(length >> 16) - x[2] = uint8(length >> 8) - x[3] = uint8(length) - x[8] = uint8(ticketLen >> 8) - x[9] = uint8(ticketLen) - copy(x[10:], m.ticket) - - m.raw = x - - return -} - -func (m *newSessionTicketMsg) unmarshal(data []byte) bool { - m.raw = data - - if len(data) < 10 { - return false - } - - length := uint32(data[1])<<16 | uint32(data[2])<<8 | uint32(data[3]) - if uint32(len(data))-4 != length { - return false - } - - ticketLen := int(data[8])<<8 + int(data[9]) - if len(data)-10 != ticketLen { - return false - } - - m.ticket = data[10:] - - return true -} - -func eqUint16s(x, y []uint16) bool { - if len(x) != len(y) { - return false - } - for i, v := range x { - if y[i] != v { - return false - } - } - return true -} - -func eqCurveIDs(x, y []CurveID) bool { - if len(x) != len(y) { - return false - } - for i, v := range x { - if y[i] != v { - return false - } - } - return true -} - -func eqStrings(x, y []string) bool { - if len(x) != len(y) { - return false - } - for i, v := range x { - if y[i] != v { - return false - } - } - return true -} - -func eqByteSlices(x, y [][]byte) bool { - if len(x) != len(y) { - return false - } - for i, v := range x { - if !bytes.Equal(v, y[i]) { - return false - } - } - return true -} - -func eqSignatureAndHashes(x, y []signatureAndHash) bool { - if len(x) != len(y) { - return false - } - for i, v := range x { - v2 := y[i] - if v.hash != v2.hash || v.signature != v2.signature { - return false - } - } - return true -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages_test.go deleted file mode 100644 index 95d825bd17522a427ca8c1e16933828d8ca45526..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_messages_test.go +++ /dev/null @@ -1,262 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "math/rand" - "reflect" - "testing" - "testing/quick" -) - -var tests = []interface{}{ - &clientHelloMsg{}, - &serverHelloMsg{}, - &finishedMsg{}, - - &certificateMsg{}, - &certificateRequestMsg{}, - &certificateVerifyMsg{}, - &certificateStatusMsg{}, - &clientKeyExchangeMsg{}, - &nextProtoMsg{}, - &newSessionTicketMsg{}, - &sessionState{}, -} - -type testMessage interface { - marshal() []byte - unmarshal([]byte) bool - equal(interface{}) bool -} - -func TestMarshalUnmarshal(t *testing.T) { - rand := rand.New(rand.NewSource(0)) - - for i, iface := range tests { - ty := reflect.ValueOf(iface).Type() - - n := 100 - if testing.Short() { - n = 5 - } - for j := 0; j < n; j++ { - v, ok := quick.Value(ty, rand) - if !ok { - t.Errorf("#%d: failed to create value", i) - break - } - - m1 := v.Interface().(testMessage) - marshaled := m1.marshal() - m2 := iface.(testMessage) - if !m2.unmarshal(marshaled) { - t.Errorf("#%d failed to unmarshal %#v %x", i, m1, marshaled) - break - } - m2.marshal() // to fill any marshal cache in the message - - if !m1.equal(m2) { - t.Errorf("#%d got:%#v want:%#v %x", i, m2, m1, marshaled) - break - } - - if i >= 3 { - // The first three message types (ClientHello, - // ServerHello and Finished) are allowed to - // have parsable prefixes because the extension - // data is optional and the length of the - // Finished varies across versions. - for j := 0; j < len(marshaled); j++ { - if m2.unmarshal(marshaled[0:j]) { - t.Errorf("#%d unmarshaled a prefix of length %d of %#v", i, j, m1) - break - } - } - } - } - } -} - -func TestFuzz(t *testing.T) { - rand := rand.New(rand.NewSource(0)) - for _, iface := range tests { - m := iface.(testMessage) - - for j := 0; j < 1000; j++ { - len := rand.Intn(100) - bytes := randomBytes(len, rand) - // This just looks for crashes due to bounds errors etc. - m.unmarshal(bytes) - } - } -} - -func randomBytes(n int, rand *rand.Rand) []byte { - r := make([]byte, n) - for i := 0; i < n; i++ { - r[i] = byte(rand.Int31()) - } - return r -} - -func randomString(n int, rand *rand.Rand) string { - b := randomBytes(n, rand) - return string(b) -} - -func (*clientHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &clientHelloMsg{} - m.vers = uint16(rand.Intn(65536)) - m.random = randomBytes(32, rand) - m.sessionId = randomBytes(rand.Intn(32), rand) - m.cipherSuites = make([]uint16, rand.Intn(63)+1) - for i := 0; i < len(m.cipherSuites); i++ { - m.cipherSuites[i] = uint16(rand.Int31()) - } - m.compressionMethods = randomBytes(rand.Intn(63)+1, rand) - if rand.Intn(10) > 5 { - m.nextProtoNeg = true - } - if rand.Intn(10) > 5 { - m.serverName = randomString(rand.Intn(255), rand) - } - m.ocspStapling = rand.Intn(10) > 5 - m.supportedPoints = randomBytes(rand.Intn(5)+1, rand) - m.supportedCurves = make([]CurveID, rand.Intn(5)+1) - for i := range m.supportedCurves { - m.supportedCurves[i] = CurveID(rand.Intn(30000)) - } - if rand.Intn(10) > 5 { - m.ticketSupported = true - if rand.Intn(10) > 5 { - m.sessionTicket = randomBytes(rand.Intn(300), rand) - } - } - if rand.Intn(10) > 5 { - m.signatureAndHashes = supportedSignatureAlgorithms - } - m.alpnProtocols = make([]string, rand.Intn(5)) - for i := range m.alpnProtocols { - m.alpnProtocols[i] = randomString(rand.Intn(20)+1, rand) - } - if rand.Intn(10) > 5 { - m.scts = true - } - - return reflect.ValueOf(m) -} - -func (*serverHelloMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &serverHelloMsg{} - m.vers = uint16(rand.Intn(65536)) - m.random = randomBytes(32, rand) - m.sessionId = randomBytes(rand.Intn(32), rand) - m.cipherSuite = uint16(rand.Int31()) - m.compressionMethod = uint8(rand.Intn(256)) - - if rand.Intn(10) > 5 { - m.nextProtoNeg = true - - n := rand.Intn(10) - m.nextProtos = make([]string, n) - for i := 0; i < n; i++ { - m.nextProtos[i] = randomString(20, rand) - } - } - - if rand.Intn(10) > 5 { - m.ocspStapling = true - } - if rand.Intn(10) > 5 { - m.ticketSupported = true - } - m.alpnProtocol = randomString(rand.Intn(32)+1, rand) - - if rand.Intn(10) > 5 { - numSCTs := rand.Intn(4) - m.scts = make([][]byte, numSCTs) - for i := range m.scts { - m.scts[i] = randomBytes(rand.Intn(500), rand) - } - } - - return reflect.ValueOf(m) -} - -func (*certificateMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateMsg{} - numCerts := rand.Intn(20) - m.certificates = make([][]byte, numCerts) - for i := 0; i < numCerts; i++ { - m.certificates[i] = randomBytes(rand.Intn(10)+1, rand) - } - return reflect.ValueOf(m) -} - -func (*certificateRequestMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateRequestMsg{} - m.certificateTypes = randomBytes(rand.Intn(5)+1, rand) - numCAs := rand.Intn(100) - m.certificateAuthorities = make([][]byte, numCAs) - for i := 0; i < numCAs; i++ { - m.certificateAuthorities[i] = randomBytes(rand.Intn(15)+1, rand) - } - return reflect.ValueOf(m) -} - -func (*certificateVerifyMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateVerifyMsg{} - m.signature = randomBytes(rand.Intn(15)+1, rand) - return reflect.ValueOf(m) -} - -func (*certificateStatusMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &certificateStatusMsg{} - if rand.Intn(10) > 5 { - m.statusType = statusTypeOCSP - m.response = randomBytes(rand.Intn(10)+1, rand) - } else { - m.statusType = 42 - } - return reflect.ValueOf(m) -} - -func (*clientKeyExchangeMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &clientKeyExchangeMsg{} - m.ciphertext = randomBytes(rand.Intn(1000)+1, rand) - return reflect.ValueOf(m) -} - -func (*finishedMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &finishedMsg{} - m.verifyData = randomBytes(12, rand) - return reflect.ValueOf(m) -} - -func (*nextProtoMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &nextProtoMsg{} - m.proto = randomString(rand.Intn(255), rand) - return reflect.ValueOf(m) -} - -func (*newSessionTicketMsg) Generate(rand *rand.Rand, size int) reflect.Value { - m := &newSessionTicketMsg{} - m.ticket = randomBytes(rand.Intn(4), rand) - return reflect.ValueOf(m) -} - -func (*sessionState) Generate(rand *rand.Rand, size int) reflect.Value { - s := &sessionState{} - s.vers = uint16(rand.Intn(10000)) - s.cipherSuite = uint16(rand.Intn(10000)) - s.masterSecret = randomBytes(rand.Intn(100), rand) - numCerts := rand.Intn(20) - s.certificates = make([][]byte, numCerts) - for i := 0; i < numCerts; i++ { - s.certificates[i] = randomBytes(rand.Intn(10)+1, rand) - } - return reflect.ValueOf(s) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server.go deleted file mode 100644 index e16cddcbd81db53051c63f155e0a2a3efef7d8af..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server.go +++ /dev/null @@ -1,750 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/subtle" - "crypto/x509" - "encoding/asn1" - "errors" - "fmt" - "io" -) - -// serverHandshakeState contains details of a server handshake in progress. -// It's discarded once the handshake has completed. -type serverHandshakeState struct { - c *Conn - clientHello *clientHelloMsg - hello *serverHelloMsg - suite *cipherSuite - ellipticOk bool - ecdsaOk bool - rsaDecryptOk bool - rsaSignOk bool - sessionState *sessionState - finishedHash finishedHash - masterSecret []byte - certsFromClient [][]byte - cert *Certificate -} - -// serverHandshake performs a TLS handshake as a server. -func (c *Conn) serverHandshake() error { - config := c.config - - // If this is the first server handshake, we generate a random key to - // encrypt the tickets with. - config.serverInitOnce.Do(config.serverInit) - - hs := serverHandshakeState{ - c: c, - } - isResume, err := hs.readClientHello() - if err != nil { - return err - } - - // For an overview of TLS handshaking, see https://tools.ietf.org/html/rfc5246#section-7.3 - if isResume { - // The client has included a session ticket and so we do an abbreviated handshake. - if err := hs.doResumeHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - // ticketSupported is set in a resumption handshake if the - // ticket from the client was encrypted with an old session - // ticket key and thus a refreshed ticket should be sent. - if hs.hello.ticketSupported { - if err := hs.sendSessionTicket(); err != nil { - return err - } - } - if err := hs.sendFinished(c.firstFinished[:]); err != nil { - return err - } - if err := hs.readFinished(nil); err != nil { - return err - } - c.didResume = true - } else { - // The client didn't include a session ticket, or it wasn't - // valid so we do a full handshake. - if err := hs.doFullHandshake(); err != nil { - return err - } - if err := hs.establishKeys(); err != nil { - return err - } - if err := hs.readFinished(c.firstFinished[:]); err != nil { - return err - } - if err := hs.sendSessionTicket(); err != nil { - return err - } - if err := hs.sendFinished(nil); err != nil { - return err - } - } - c.handshakeComplete = true - - return nil -} - -// readClientHello reads a ClientHello message from the client and decides -// whether we will perform session resumption. -func (hs *serverHandshakeState) readClientHello() (isResume bool, err error) { - config := hs.c.config - c := hs.c - - msg, err := c.readHandshake() - if err != nil { - return false, err - } - var ok bool - hs.clientHello, ok = msg.(*clientHelloMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return false, unexpectedMessageError(hs.clientHello, msg) - } - c.vers, ok = config.mutualVersion(hs.clientHello.vers) - if !ok { - c.sendAlert(alertProtocolVersion) - return false, fmt.Errorf("tls: client offered an unsupported, maximum protocol version of %x", hs.clientHello.vers) - } - c.haveVers = true - - hs.hello = new(serverHelloMsg) - - supportedCurve := false - preferredCurves := config.curvePreferences() -Curves: - for _, curve := range hs.clientHello.supportedCurves { - for _, supported := range preferredCurves { - if supported == curve { - supportedCurve = true - break Curves - } - } - } - - supportedPointFormat := false - for _, pointFormat := range hs.clientHello.supportedPoints { - if pointFormat == pointFormatUncompressed { - supportedPointFormat = true - break - } - } - hs.ellipticOk = supportedCurve && supportedPointFormat - - foundCompression := false - // We only support null compression, so check that the client offered it. - for _, compression := range hs.clientHello.compressionMethods { - if compression == compressionNone { - foundCompression = true - break - } - } - - if !foundCompression { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: client does not support uncompressed connections") - } - - hs.hello.vers = c.vers - hs.hello.random = make([]byte, 32) - _, err = io.ReadFull(config.rand(), hs.hello.random) - if err != nil { - c.sendAlert(alertInternalError) - return false, err - } - hs.hello.secureRenegotiation = hs.clientHello.secureRenegotiation - hs.hello.compressionMethod = compressionNone - if len(hs.clientHello.serverName) > 0 { - c.serverName = hs.clientHello.serverName - } - - if len(hs.clientHello.alpnProtocols) > 0 { - if selectedProto, fallback := mutualProtocol(hs.clientHello.alpnProtocols, c.config.NextProtos); !fallback { - hs.hello.alpnProtocol = selectedProto - c.clientProtocol = selectedProto - } - } else { - // Although sending an empty NPN extension is reasonable, Firefox has - // had a bug around this. Best to send nothing at all if - // config.NextProtos is empty. See - // https://golang.org/issue/5445. - if hs.clientHello.nextProtoNeg && len(config.NextProtos) > 0 { - hs.hello.nextProtoNeg = true - hs.hello.nextProtos = config.NextProtos - } - } - - if hs.cert, err = config.getCertificate(&ClientHelloInfo{ - CipherSuites: hs.clientHello.cipherSuites, - ServerName: hs.clientHello.serverName, - SupportedCurves: hs.clientHello.supportedCurves, - SupportedPoints: hs.clientHello.supportedPoints, - }); err != nil { - c.sendAlert(alertInternalError) - return false, err - } - if hs.clientHello.scts { - hs.hello.scts = hs.cert.SignedCertificateTimestamps - } - - if priv, ok := hs.cert.PrivateKey.(crypto.Signer); ok { - switch priv.Public().(type) { - case *ecdsa.PublicKey: - hs.ecdsaOk = true - case *rsa.PublicKey: - hs.rsaSignOk = true - default: - c.sendAlert(alertInternalError) - return false, fmt.Errorf("crypto/tls: unsupported signing key type (%T)", priv.Public()) - } - } - if priv, ok := hs.cert.PrivateKey.(crypto.Decrypter); ok { - switch priv.Public().(type) { - case *rsa.PublicKey: - hs.rsaDecryptOk = true - default: - c.sendAlert(alertInternalError) - return false, fmt.Errorf("crypto/tls: unsupported decryption key type (%T)", priv.Public()) - } - } - - if hs.checkForResumption() { - return true, nil - } - - var preferenceList, supportedList []uint16 - if c.config.PreferServerCipherSuites { - preferenceList = c.config.cipherSuites() - supportedList = hs.clientHello.cipherSuites - } else { - preferenceList = hs.clientHello.cipherSuites - supportedList = c.config.cipherSuites() - } - - for _, id := range preferenceList { - if hs.setCipherSuite(id, supportedList, c.vers) { - break - } - } - - if hs.suite == nil { - c.sendAlert(alertHandshakeFailure) - return false, errors.New("tls: no cipher suite supported by both client and server") - } - - // See https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00. - for _, id := range hs.clientHello.cipherSuites { - if id == TLS_FALLBACK_SCSV { - // The client is doing a fallback connection. - if hs.clientHello.vers < c.config.maxVersion() { - c.sendAlert(alertInappropriateFallback) - return false, errors.New("tls: client using inappropriate protocol fallback") - } - break - } - } - - return false, nil -} - -// checkForResumption reports whether we should perform resumption on this connection. -func (hs *serverHandshakeState) checkForResumption() bool { - c := hs.c - - if c.config.SessionTicketsDisabled { - return false - } - - var ok bool - var sessionTicket = append([]uint8{}, hs.clientHello.sessionTicket...) - if hs.sessionState, ok = c.decryptTicket(sessionTicket); !ok { - return false - } - - if hs.sessionState.vers > hs.clientHello.vers { - return false - } - if vers, ok := c.config.mutualVersion(hs.sessionState.vers); !ok || vers != hs.sessionState.vers { - return false - } - - cipherSuiteOk := false - // Check that the client is still offering the ciphersuite in the session. - for _, id := range hs.clientHello.cipherSuites { - if id == hs.sessionState.cipherSuite { - cipherSuiteOk = true - break - } - } - if !cipherSuiteOk { - return false - } - - // Check that we also support the ciphersuite from the session. - if !hs.setCipherSuite(hs.sessionState.cipherSuite, c.config.cipherSuites(), hs.sessionState.vers) { - return false - } - - sessionHasClientCerts := len(hs.sessionState.certificates) != 0 - needClientCerts := c.config.ClientAuth == RequireAnyClientCert || c.config.ClientAuth == RequireAndVerifyClientCert - if needClientCerts && !sessionHasClientCerts { - return false - } - if sessionHasClientCerts && c.config.ClientAuth == NoClientCert { - return false - } - - return true -} - -func (hs *serverHandshakeState) doResumeHandshake() error { - c := hs.c - - hs.hello.cipherSuite = hs.suite.id - // We echo the client's session ID in the ServerHello to let it know - // that we're doing a resumption. - hs.hello.sessionId = hs.clientHello.sessionId - hs.hello.ticketSupported = hs.sessionState.usedOldKey - hs.finishedHash = newFinishedHash(c.vers, hs.suite) - hs.finishedHash.discardHandshakeBuffer() - hs.finishedHash.Write(hs.clientHello.marshal()) - hs.finishedHash.Write(hs.hello.marshal()) - c.writeRecord(recordTypeHandshake, hs.hello.marshal()) - - if len(hs.sessionState.certificates) > 0 { - if _, err := hs.processCertsFromClient(hs.sessionState.certificates); err != nil { - return err - } - } - - hs.masterSecret = hs.sessionState.masterSecret - - return nil -} - -func (hs *serverHandshakeState) doFullHandshake() error { - config := hs.c.config - c := hs.c - - if hs.clientHello.ocspStapling && len(hs.cert.OCSPStaple) > 0 { - hs.hello.ocspStapling = true - } - - hs.hello.ticketSupported = hs.clientHello.ticketSupported && !config.SessionTicketsDisabled - hs.hello.cipherSuite = hs.suite.id - - hs.finishedHash = newFinishedHash(hs.c.vers, hs.suite) - if config.ClientAuth == NoClientCert { - // No need to keep a full record of the handshake if client - // certificates won't be used. - hs.finishedHash.discardHandshakeBuffer() - } - hs.finishedHash.Write(hs.clientHello.marshal()) - hs.finishedHash.Write(hs.hello.marshal()) - c.writeRecord(recordTypeHandshake, hs.hello.marshal()) - - certMsg := new(certificateMsg) - certMsg.certificates = hs.cert.Certificate - hs.finishedHash.Write(certMsg.marshal()) - c.writeRecord(recordTypeHandshake, certMsg.marshal()) - - if hs.hello.ocspStapling { - certStatus := new(certificateStatusMsg) - certStatus.statusType = statusTypeOCSP - certStatus.response = hs.cert.OCSPStaple - hs.finishedHash.Write(certStatus.marshal()) - c.writeRecord(recordTypeHandshake, certStatus.marshal()) - } - - keyAgreement := hs.suite.ka(c.vers) - skx, err := keyAgreement.generateServerKeyExchange(config, hs.cert, hs.clientHello, hs.hello) - if err != nil { - c.sendAlert(alertHandshakeFailure) - return err - } - if skx != nil { - hs.finishedHash.Write(skx.marshal()) - c.writeRecord(recordTypeHandshake, skx.marshal()) - } - - if config.ClientAuth >= RequestClientCert { - // Request a client certificate - certReq := new(certificateRequestMsg) - certReq.certificateTypes = []byte{ - byte(certTypeRSASign), - byte(certTypeECDSASign), - } - if c.vers >= VersionTLS12 { - certReq.hasSignatureAndHash = true - certReq.signatureAndHashes = supportedSignatureAlgorithms - } - - // An empty list of certificateAuthorities signals to - // the client that it may send any certificate in response - // to our request. When we know the CAs we trust, then - // we can send them down, so that the client can choose - // an appropriate certificate to give to us. - if config.ClientCAs != nil { - certReq.certificateAuthorities = config.ClientCAs.Subjects() - } - hs.finishedHash.Write(certReq.marshal()) - c.writeRecord(recordTypeHandshake, certReq.marshal()) - } - - helloDone := new(serverHelloDoneMsg) - hs.finishedHash.Write(helloDone.marshal()) - c.writeRecord(recordTypeHandshake, helloDone.marshal()) - - var pub crypto.PublicKey // public key for client auth, if any - - msg, err := c.readHandshake() - if err != nil { - return err - } - - var ok bool - // If we requested a client certificate, then the client must send a - // certificate message, even if it's empty. - if config.ClientAuth >= RequestClientCert { - if certMsg, ok = msg.(*certificateMsg); !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certMsg, msg) - } - hs.finishedHash.Write(certMsg.marshal()) - - if len(certMsg.certificates) == 0 { - // The client didn't actually send a certificate - switch config.ClientAuth { - case RequireAnyClientCert, RequireAndVerifyClientCert: - c.sendAlert(alertBadCertificate) - return errors.New("tls: client didn't provide a certificate") - } - } - - pub, err = hs.processCertsFromClient(certMsg.certificates) - if err != nil { - return err - } - - msg, err = c.readHandshake() - if err != nil { - return err - } - } - - // Get client key exchange - ckx, ok := msg.(*clientKeyExchangeMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(ckx, msg) - } - hs.finishedHash.Write(ckx.marshal()) - - preMasterSecret, err := keyAgreement.processClientKeyExchange(config, hs.cert, ckx, c.vers) - if err != nil { - c.sendAlert(alertHandshakeFailure) - return err - } - hs.masterSecret = masterFromPreMasterSecret(c.vers, hs.suite, preMasterSecret, hs.clientHello.random, hs.hello.random) - - // If we received a client cert in response to our certificate request message, - // the client will send us a certificateVerifyMsg immediately after the - // clientKeyExchangeMsg. This message is a digest of all preceding - // handshake-layer messages that is signed using the private key corresponding - // to the client's certificate. This allows us to verify that the client is in - // possession of the private key of the certificate. - if len(c.peerCertificates) > 0 { - msg, err = c.readHandshake() - if err != nil { - return err - } - certVerify, ok := msg.(*certificateVerifyMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(certVerify, msg) - } - - // Determine the signature type. - var signatureAndHash signatureAndHash - if certVerify.hasSignatureAndHash { - signatureAndHash = certVerify.signatureAndHash - if !isSupportedSignatureAndHash(signatureAndHash, supportedSignatureAlgorithms) { - return errors.New("tls: unsupported hash function for client certificate") - } - } else { - // Before TLS 1.2 the signature algorithm was implicit - // from the key type, and only one hash per signature - // algorithm was possible. Leave the hash as zero. - switch pub.(type) { - case *ecdsa.PublicKey: - signatureAndHash.signature = signatureECDSA - case *rsa.PublicKey: - signatureAndHash.signature = signatureRSA - } - } - - switch key := pub.(type) { - case *ecdsa.PublicKey: - if signatureAndHash.signature != signatureECDSA { - err = errors.New("bad signature type for client's ECDSA certificate") - break - } - ecdsaSig := new(ecdsaSignature) - if _, err = asn1.Unmarshal(certVerify.signature, ecdsaSig); err != nil { - break - } - if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { - err = errors.New("ECDSA signature contained zero or negative values") - break - } - var digest []byte - if digest, _, err = hs.finishedHash.hashForClientCertificate(signatureAndHash, hs.masterSecret); err != nil { - break - } - if !ecdsa.Verify(key, digest, ecdsaSig.R, ecdsaSig.S) { - err = errors.New("ECDSA verification failure") - } - case *rsa.PublicKey: - if signatureAndHash.signature != signatureRSA { - err = errors.New("bad signature type for client's RSA certificate") - break - } - var digest []byte - var hashFunc crypto.Hash - if digest, hashFunc, err = hs.finishedHash.hashForClientCertificate(signatureAndHash, hs.masterSecret); err != nil { - break - } - err = rsa.VerifyPKCS1v15(key, hashFunc, digest, certVerify.signature) - } - if err != nil { - c.sendAlert(alertBadCertificate) - return errors.New("tls: could not validate signature of connection nonces: " + err.Error()) - } - - hs.finishedHash.Write(certVerify.marshal()) - } - - hs.finishedHash.discardHandshakeBuffer() - - return nil -} - -func (hs *serverHandshakeState) establishKeys() error { - c := hs.c - - clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV := - keysFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random, hs.suite.macLen, hs.suite.keyLen, hs.suite.ivLen) - - var clientCipher, serverCipher interface{} - var clientHash, serverHash macFunction - - if hs.suite.aead == nil { - clientCipher = hs.suite.cipher(clientKey, clientIV, true /* for reading */) - clientHash = hs.suite.mac(c.vers, clientMAC) - serverCipher = hs.suite.cipher(serverKey, serverIV, false /* not for reading */) - serverHash = hs.suite.mac(c.vers, serverMAC) - } else { - clientCipher = hs.suite.aead(clientKey, clientIV) - serverCipher = hs.suite.aead(serverKey, serverIV) - } - - c.in.prepareCipherSpec(c.vers, clientCipher, clientHash) - c.out.prepareCipherSpec(c.vers, serverCipher, serverHash) - - return nil -} - -func (hs *serverHandshakeState) readFinished(out []byte) error { - c := hs.c - - c.readRecord(recordTypeChangeCipherSpec) - if err := c.in.error(); err != nil { - return err - } - - if hs.hello.nextProtoNeg { - msg, err := c.readHandshake() - if err != nil { - return err - } - nextProto, ok := msg.(*nextProtoMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(nextProto, msg) - } - hs.finishedHash.Write(nextProto.marshal()) - c.clientProtocol = nextProto.proto - } - - msg, err := c.readHandshake() - if err != nil { - return err - } - clientFinished, ok := msg.(*finishedMsg) - if !ok { - c.sendAlert(alertUnexpectedMessage) - return unexpectedMessageError(clientFinished, msg) - } - - verify := hs.finishedHash.clientSum(hs.masterSecret) - if len(verify) != len(clientFinished.verifyData) || - subtle.ConstantTimeCompare(verify, clientFinished.verifyData) != 1 { - c.sendAlert(alertHandshakeFailure) - return errors.New("tls: client's Finished message is incorrect") - } - - hs.finishedHash.Write(clientFinished.marshal()) - copy(out, verify) - return nil -} - -func (hs *serverHandshakeState) sendSessionTicket() error { - if !hs.hello.ticketSupported { - return nil - } - - c := hs.c - m := new(newSessionTicketMsg) - - var err error - state := sessionState{ - vers: c.vers, - cipherSuite: hs.suite.id, - masterSecret: hs.masterSecret, - certificates: hs.certsFromClient, - } - m.ticket, err = c.encryptTicket(&state) - if err != nil { - return err - } - - hs.finishedHash.Write(m.marshal()) - c.writeRecord(recordTypeHandshake, m.marshal()) - - return nil -} - -func (hs *serverHandshakeState) sendFinished(out []byte) error { - c := hs.c - - c.writeRecord(recordTypeChangeCipherSpec, []byte{1}) - - finished := new(finishedMsg) - finished.verifyData = hs.finishedHash.serverSum(hs.masterSecret) - hs.finishedHash.Write(finished.marshal()) - c.writeRecord(recordTypeHandshake, finished.marshal()) - - c.cipherSuite = hs.suite.id - copy(out, finished.verifyData) - - return nil -} - -// processCertsFromClient takes a chain of client certificates either from a -// Certificates message or from a sessionState and verifies them. It returns -// the public key of the leaf certificate. -func (hs *serverHandshakeState) processCertsFromClient(certificates [][]byte) (crypto.PublicKey, error) { - c := hs.c - - hs.certsFromClient = certificates - certs := make([]*x509.Certificate, len(certificates)) - var err error - for i, asn1Data := range certificates { - if certs[i], err = x509.ParseCertificate(asn1Data); err != nil { - c.sendAlert(alertBadCertificate) - return nil, errors.New("tls: failed to parse client certificate: " + err.Error()) - } - } - - if c.config.ClientAuth >= VerifyClientCertIfGiven && len(certs) > 0 { - opts := x509.VerifyOptions{ - Roots: c.config.ClientCAs, - CurrentTime: c.config.time(), - Intermediates: x509.NewCertPool(), - KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, - } - - for _, cert := range certs[1:] { - opts.Intermediates.AddCert(cert) - } - - chains, err := certs[0].Verify(opts) - if err != nil { - c.sendAlert(alertBadCertificate) - return nil, errors.New("tls: failed to verify client's certificate: " + err.Error()) - } - - c.verifiedChains = chains - } - - if len(certs) > 0 { - var pub crypto.PublicKey - switch key := certs[0].PublicKey.(type) { - case *ecdsa.PublicKey, *rsa.PublicKey: - pub = key - default: - c.sendAlert(alertUnsupportedCertificate) - return nil, fmt.Errorf("tls: client's certificate contains an unsupported public key of type %T", certs[0].PublicKey) - } - c.peerCertificates = certs - return pub, nil - } - - return nil, nil -} - -// setCipherSuite sets a cipherSuite with the given id as the serverHandshakeState -// suite if that cipher suite is acceptable to use. -// It returns a bool indicating if the suite was set. -func (hs *serverHandshakeState) setCipherSuite(id uint16, supportedCipherSuites []uint16, version uint16) bool { - for _, supported := range supportedCipherSuites { - if id == supported { - var candidate *cipherSuite - - for _, s := range cipherSuites { - if s.id == id { - candidate = s - break - } - } - if candidate == nil { - continue - } - // Don't select a ciphersuite which we can't - // support for this client. - if candidate.flags&suiteECDHE != 0 { - if !hs.ellipticOk { - continue - } - if candidate.flags&suiteECDSA != 0 { - if !hs.ecdsaOk { - continue - } - } else if !hs.rsaSignOk { - continue - } - } else if !hs.rsaDecryptOk { - continue - } - if version < VersionTLS12 && candidate.flags&suiteTLS12 != 0 { - continue - } - hs.suite = candidate - return true - } - } - return false -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server_test.go deleted file mode 100644 index 20c2bd6d4d4fbbc9ae1f6bb27b28299805072821..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_server_test.go +++ /dev/null @@ -1,1059 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rsa" - "encoding/hex" - "encoding/pem" - "errors" - "fmt" - "io" - "math/big" - "net" - "os" - "os/exec" - "path/filepath" - "strings" - "testing" - "time" -) - -// zeroSource is an io.Reader that returns an unlimited number of zero bytes. -type zeroSource struct{} - -func (zeroSource) Read(b []byte) (n int, err error) { - for i := range b { - b[i] = 0 - } - - return len(b), nil -} - -var testConfig *Config - -func allCipherSuites() []uint16 { - ids := make([]uint16, len(cipherSuites)) - for i, suite := range cipherSuites { - ids[i] = suite.id - } - - return ids -} - -func init() { - testConfig = &Config{ - Time: func() time.Time { return time.Unix(0, 0) }, - Rand: zeroSource{}, - Certificates: make([]Certificate, 2), - InsecureSkipVerify: true, - MinVersion: VersionSSL30, - MaxVersion: VersionTLS12, - CipherSuites: allCipherSuites(), - } - testConfig.Certificates[0].Certificate = [][]byte{testRSACertificate} - testConfig.Certificates[0].PrivateKey = testRSAPrivateKey - testConfig.Certificates[1].Certificate = [][]byte{testSNICertificate} - testConfig.Certificates[1].PrivateKey = testRSAPrivateKey - testConfig.BuildNameToCertificate() -} - -func testClientHello(t *testing.T, serverConfig *Config, m handshakeMessage) { - testClientHelloFailure(t, serverConfig, m, "") -} - -func testClientHelloFailure(t *testing.T, serverConfig *Config, m handshakeMessage, expectedSubStr string) { - // Create in-memory network connection, - // send message to server. Should return - // expected error. - c, s := net.Pipe() - go func() { - cli := Client(c, testConfig) - if ch, ok := m.(*clientHelloMsg); ok { - cli.vers = ch.vers - } - cli.writeRecord(recordTypeHandshake, m.marshal()) - c.Close() - }() - err := Server(s, serverConfig).Handshake() - s.Close() - if len(expectedSubStr) == 0 { - if err != nil && err != io.EOF { - t.Errorf("Got error: %s; expected to succeed", err, expectedSubStr) - } - } else if err == nil || !strings.Contains(err.Error(), expectedSubStr) { - t.Errorf("Got error: %s; expected to match substring '%s'", err, expectedSubStr) - } -} - -func TestSimpleError(t *testing.T) { - testClientHelloFailure(t, testConfig, &serverHelloDoneMsg{}, "unexpected handshake message") -} - -var badProtocolVersions = []uint16{0x0000, 0x0005, 0x0100, 0x0105, 0x0200, 0x0205} - -func TestRejectBadProtocolVersion(t *testing.T) { - for _, v := range badProtocolVersions { - testClientHelloFailure(t, testConfig, &clientHelloMsg{vers: v}, "unsupported, maximum protocol version") - } -} - -func TestNoSuiteOverlap(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{0xff00}, - compressionMethods: []uint8{0}, - } - testClientHelloFailure(t, testConfig, clientHello, "no cipher suite supported by both client and server") -} - -func TestNoCompressionOverlap(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0xff}, - } - testClientHelloFailure(t, testConfig, clientHello, "client does not support uncompressed connections") -} - -func TestNoRC4ByDefault(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0}, - } - serverConfig := *testConfig - // Reset the enabled cipher suites to nil in order to test the - // defaults. - serverConfig.CipherSuites = nil - testClientHelloFailure(t, &serverConfig, clientHello, "no cipher suite supported by both client and server") -} - -func TestDontSelectECDSAWithRSAKey(t *testing.T) { - // Test that, even when both sides support an ECDSA cipher suite, it - // won't be selected if the server's private key doesn't support it. - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA}, - compressionMethods: []uint8{0}, - supportedCurves: []CurveID{CurveP256}, - supportedPoints: []uint8{pointFormatUncompressed}, - } - serverConfig := *testConfig - serverConfig.CipherSuites = clientHello.cipherSuites - serverConfig.Certificates = make([]Certificate, 1) - serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} - serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey - serverConfig.BuildNameToCertificate() - // First test that it *does* work when the server's key is ECDSA. - testClientHello(t, &serverConfig, clientHello) - - // Now test that switching to an RSA key causes the expected error (and - // not an internal error about a signing failure). - serverConfig.Certificates = testConfig.Certificates - testClientHelloFailure(t, &serverConfig, clientHello, "no cipher suite supported by both client and server") -} - -func TestDontSelectRSAWithECDSAKey(t *testing.T) { - // Test that, even when both sides support an RSA cipher suite, it - // won't be selected if the server's private key doesn't support it. - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA}, - compressionMethods: []uint8{0}, - supportedCurves: []CurveID{CurveP256}, - supportedPoints: []uint8{pointFormatUncompressed}, - } - serverConfig := *testConfig - serverConfig.CipherSuites = clientHello.cipherSuites - // First test that it *does* work when the server's key is RSA. - testClientHello(t, &serverConfig, clientHello) - - // Now test that switching to an ECDSA key causes the expected error - // (and not an internal error about a signing failure). - serverConfig.Certificates = make([]Certificate, 1) - serverConfig.Certificates[0].Certificate = [][]byte{testECDSACertificate} - serverConfig.Certificates[0].PrivateKey = testECDSAPrivateKey - serverConfig.BuildNameToCertificate() - testClientHelloFailure(t, &serverConfig, clientHello, "no cipher suite supported by both client and server") -} - -func TestRenegotiationExtension(t *testing.T) { - clientHello := &clientHelloMsg{ - vers: VersionTLS12, - compressionMethods: []uint8{compressionNone}, - random: make([]byte, 32), - secureRenegotiation: true, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - } - - var buf []byte - c, s := net.Pipe() - - go func() { - cli := Client(c, testConfig) - cli.vers = clientHello.vers - cli.writeRecord(recordTypeHandshake, clientHello.marshal()) - - buf = make([]byte, 1024) - n, err := c.Read(buf) - if err != nil { - t.Fatalf("Server read returned error: %s", err) - } - buf = buf[:n] - c.Close() - }() - - Server(s, testConfig).Handshake() - - if len(buf) < 5+4 { - t.Fatalf("Server returned short message of length %d", len(buf)) - } - // buf contains a TLS record, with a 5 byte record header and a 4 byte - // handshake header. The length of the ServerHello is taken from the - // handshake header. - serverHelloLen := int(buf[6])<<16 | int(buf[7])<<8 | int(buf[8]) - - var serverHello serverHelloMsg - // unmarshal expects to be given the handshake header, but - // serverHelloLen doesn't include it. - if !serverHello.unmarshal(buf[5 : 9+serverHelloLen]) { - t.Fatalf("Failed to parse ServerHello") - } - - if !serverHello.secureRenegotiation { - t.Errorf("Secure renegotiation extension was not echoed.") - } -} - -func TestTLS12OnlyCipherSuites(t *testing.T) { - // Test that a Server doesn't select a TLS 1.2-only cipher suite when - // the client negotiates TLS 1.1. - var zeros [32]byte - - clientHello := &clientHelloMsg{ - vers: VersionTLS11, - random: zeros[:], - cipherSuites: []uint16{ - // The Server, by default, will use the client's - // preference order. So the GCM cipher suite - // will be selected unless it's excluded because - // of the version in this ClientHello. - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, - TLS_RSA_WITH_RC4_128_SHA, - }, - compressionMethods: []uint8{compressionNone}, - supportedCurves: []CurveID{CurveP256, CurveP384, CurveP521}, - supportedPoints: []uint8{pointFormatUncompressed}, - } - - c, s := net.Pipe() - var reply interface{} - var clientErr error - go func() { - cli := Client(c, testConfig) - cli.vers = clientHello.vers - cli.writeRecord(recordTypeHandshake, clientHello.marshal()) - reply, clientErr = cli.readHandshake() - c.Close() - }() - config := *testConfig - config.CipherSuites = clientHello.cipherSuites - Server(s, &config).Handshake() - s.Close() - if clientErr != nil { - t.Fatal(clientErr) - } - serverHello, ok := reply.(*serverHelloMsg) - if !ok { - t.Fatalf("didn't get ServerHello message in reply. Got %v\n", reply) - } - if s := serverHello.cipherSuite; s != TLS_RSA_WITH_RC4_128_SHA { - t.Fatalf("bad cipher suite from server: %x", s) - } -} - -func TestAlertForwarding(t *testing.T) { - c, s := net.Pipe() - go func() { - Client(c, testConfig).sendAlert(alertUnknownCA) - c.Close() - }() - - err := Server(s, testConfig).Handshake() - s.Close() - if e, ok := err.(*net.OpError); !ok || e.Err != error(alertUnknownCA) { - t.Errorf("Got error: %s; expected: %s", err, error(alertUnknownCA)) - } -} - -func TestClose(t *testing.T) { - c, s := net.Pipe() - go c.Close() - - err := Server(s, testConfig).Handshake() - s.Close() - if err != io.EOF { - t.Errorf("Got error: %s; expected: %s", err, io.EOF) - } -} - -func testHandshake(clientConfig, serverConfig *Config) (serverState, clientState ConnectionState, err error) { - c, s := net.Pipe() - done := make(chan bool) - go func() { - cli := Client(c, clientConfig) - cli.Handshake() - clientState = cli.ConnectionState() - c.Close() - done <- true - }() - server := Server(s, serverConfig) - err = server.Handshake() - if err == nil { - serverState = server.ConnectionState() - } - s.Close() - <-done - return -} - -func TestVersion(t *testing.T) { - serverConfig := &Config{ - Certificates: testConfig.Certificates, - MaxVersion: VersionTLS11, - } - clientConfig := &Config{ - InsecureSkipVerify: true, - } - state, _, err := testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - if state.Version != VersionTLS11 { - t.Fatalf("Incorrect version %x, should be %x", state.Version, VersionTLS11) - } -} - -func TestCipherSuitePreference(t *testing.T) { - serverConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_RC4_128_SHA}, - Certificates: testConfig.Certificates, - MaxVersion: VersionTLS11, - } - clientConfig := &Config{ - CipherSuites: []uint16{TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_RC4_128_SHA}, - InsecureSkipVerify: true, - } - state, _, err := testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - if state.CipherSuite != TLS_RSA_WITH_AES_128_CBC_SHA { - // By default the server should use the client's preference. - t.Fatalf("Client's preference was not used, got %x", state.CipherSuite) - } - - serverConfig.PreferServerCipherSuites = true - state, _, err = testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - if state.CipherSuite != TLS_RSA_WITH_RC4_128_SHA { - t.Fatalf("Server's preference was not used, got %x", state.CipherSuite) - } -} - -func TestSCTHandshake(t *testing.T) { - expected := [][]byte{[]byte("certificate"), []byte("transparency")} - serverConfig := &Config{ - Certificates: []Certificate{{ - Certificate: [][]byte{testRSACertificate}, - PrivateKey: testRSAPrivateKey, - SignedCertificateTimestamps: expected, - }}, - } - clientConfig := &Config{ - InsecureSkipVerify: true, - } - _, state, err := testHandshake(clientConfig, serverConfig) - if err != nil { - t.Fatalf("handshake failed: %s", err) - } - actual := state.SignedCertificateTimestamps - if len(actual) != len(expected) { - t.Fatalf("got %d scts, want %d", len(actual), len(expected)) - } - for i, sct := range expected { - if !bytes.Equal(sct, actual[i]) { - t.Fatalf("SCT #%d was %x, but expected %x", i, actual[i], sct) - } - } -} - -// Note: see comment in handshake_test.go for details of how the reference -// tests work. - -// serverTest represents a test of the TLS server handshake against a reference -// implementation. -type serverTest struct { - // name is a freeform string identifying the test and the file in which - // the expected results will be stored. - name string - // command, if not empty, contains a series of arguments for the - // command to run for the reference server. - command []string - // expectedPeerCerts contains a list of PEM blocks of expected - // certificates from the client. - expectedPeerCerts []string - // config, if not nil, contains a custom Config to use for this test. - config *Config - // expectHandshakeErrorIncluding, when not empty, contains a string - // that must be a substring of the error resulting from the handshake. - expectHandshakeErrorIncluding string - // validate, if not nil, is a function that will be called with the - // ConnectionState of the resulting connection. It returns false if the - // ConnectionState is unacceptable. - validate func(ConnectionState) error -} - -var defaultClientCommand = []string{"openssl", "s_client", "-no_ticket"} - -// connFromCommand starts opens a listening socket and starts the reference -// client to connect to it. It returns a recordingConn that wraps the resulting -// connection. -func (test *serverTest) connFromCommand() (conn *recordingConn, child *exec.Cmd, err error) { - l, err := net.ListenTCP("tcp", &net.TCPAddr{ - IP: net.IPv4(127, 0, 0, 1), - Port: 0, - }) - if err != nil { - return nil, nil, err - } - defer l.Close() - - port := l.Addr().(*net.TCPAddr).Port - - var command []string - command = append(command, test.command...) - if len(command) == 0 { - command = defaultClientCommand - } - command = append(command, "-connect") - command = append(command, fmt.Sprintf("127.0.0.1:%d", port)) - cmd := exec.Command(command[0], command[1:]...) - cmd.Stdin = nil - var output bytes.Buffer - cmd.Stdout = &output - cmd.Stderr = &output - if err := cmd.Start(); err != nil { - return nil, nil, err - } - - connChan := make(chan interface{}) - go func() { - tcpConn, err := l.Accept() - if err != nil { - connChan <- err - } - connChan <- tcpConn - }() - - var tcpConn net.Conn - select { - case connOrError := <-connChan: - if err, ok := connOrError.(error); ok { - return nil, nil, err - } - tcpConn = connOrError.(net.Conn) - case <-time.After(2 * time.Second): - output.WriteTo(os.Stdout) - return nil, nil, errors.New("timed out waiting for connection from child process") - } - - record := &recordingConn{ - Conn: tcpConn, - } - - return record, cmd, nil -} - -func (test *serverTest) dataPath() string { - return filepath.Join("testdata", "Server-"+test.name) -} - -func (test *serverTest) loadData() (flows [][]byte, err error) { - in, err := os.Open(test.dataPath()) - if err != nil { - return nil, err - } - defer in.Close() - return parseTestData(in) -} - -func (test *serverTest) run(t *testing.T, write bool) { - var clientConn, serverConn net.Conn - var recordingConn *recordingConn - var childProcess *exec.Cmd - - if write { - var err error - recordingConn, childProcess, err = test.connFromCommand() - if err != nil { - t.Fatalf("Failed to start subcommand: %s", err) - } - serverConn = recordingConn - } else { - clientConn, serverConn = net.Pipe() - } - config := test.config - if config == nil { - config = testConfig - } - server := Server(serverConn, config) - connStateChan := make(chan ConnectionState, 1) - go func() { - var err error - if _, err = server.Write([]byte("hello, world\n")); err != nil { - t.Logf("Error from Server.Write: %s", err) - } - if len(test.expectHandshakeErrorIncluding) > 0 { - if err == nil { - t.Errorf("Error expected, but no error returned") - } else if s := err.Error(); !strings.Contains(s, test.expectHandshakeErrorIncluding) { - t.Errorf("Error expected containing '%s' but got '%s'", test.expectHandshakeErrorIncluding, s) - } - } - server.Close() - serverConn.Close() - connStateChan <- server.ConnectionState() - }() - - if !write { - flows, err := test.loadData() - if err != nil { - t.Fatalf("%s: failed to load data from %s", test.name, test.dataPath()) - } - for i, b := range flows { - if i%2 == 0 { - clientConn.Write(b) - continue - } - bb := make([]byte, len(b)) - n, err := io.ReadFull(clientConn, bb) - if err != nil { - t.Fatalf("%s #%d: %s\nRead %d, wanted %d, got %x, wanted %x\n", test.name, i+1, err, n, len(bb), bb[:n], b) - } - if !bytes.Equal(b, bb) { - t.Fatalf("%s #%d: mismatch on read: got:%x want:%x", test.name, i+1, bb, b) - } - } - clientConn.Close() - } - - connState := <-connStateChan - peerCerts := connState.PeerCertificates - if len(peerCerts) == len(test.expectedPeerCerts) { - for i, peerCert := range peerCerts { - block, _ := pem.Decode([]byte(test.expectedPeerCerts[i])) - if !bytes.Equal(block.Bytes, peerCert.Raw) { - t.Fatalf("%s: mismatch on peer cert %d", test.name, i+1) - } - } - } else { - t.Fatalf("%s: mismatch on peer list length: %d (wanted) != %d (got)", test.name, len(test.expectedPeerCerts), len(peerCerts)) - } - - if test.validate != nil { - if err := test.validate(connState); err != nil { - t.Fatalf("validate callback returned error: %s", err) - } - } - - if write { - path := test.dataPath() - out, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - t.Fatalf("Failed to create output file: %s", err) - } - defer out.Close() - recordingConn.Close() - if len(recordingConn.flows) < 3 { - childProcess.Stdout.(*bytes.Buffer).WriteTo(os.Stdout) - if len(test.expectHandshakeErrorIncluding) == 0 { - t.Fatalf("Handshake failed") - } - } - recordingConn.WriteTo(out) - fmt.Printf("Wrote %s\n", path) - childProcess.Wait() - } -} - -func runServerTestForVersion(t *testing.T, template *serverTest, prefix, option string) { - test := *template - test.name = prefix + test.name - if len(test.command) == 0 { - test.command = defaultClientCommand - } - test.command = append([]string(nil), test.command...) - test.command = append(test.command, option) - test.run(t, *update) -} - -func runServerTestSSLv3(t *testing.T, template *serverTest) { - runServerTestForVersion(t, template, "SSLv3-", "-ssl3") -} - -func runServerTestTLS10(t *testing.T, template *serverTest) { - runServerTestForVersion(t, template, "TLSv10-", "-tls1") -} - -func runServerTestTLS11(t *testing.T, template *serverTest) { - runServerTestForVersion(t, template, "TLSv11-", "-tls1_1") -} - -func runServerTestTLS12(t *testing.T, template *serverTest) { - runServerTestForVersion(t, template, "TLSv12-", "-tls1_2") -} - -func TestHandshakeServerRSARC4(t *testing.T) { - test := &serverTest{ - name: "RSA-RC4", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "RC4-SHA"}, - } - runServerTestSSLv3(t, test) - runServerTestTLS10(t, test) - runServerTestTLS11(t, test) - runServerTestTLS12(t, test) -} - -func TestHandshakeServerRSA3DES(t *testing.T) { - test := &serverTest{ - name: "RSA-3DES", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "DES-CBC3-SHA"}, - } - runServerTestSSLv3(t, test) - runServerTestTLS10(t, test) - runServerTestTLS12(t, test) -} - -func TestHandshakeServerRSAAES(t *testing.T) { - test := &serverTest{ - name: "RSA-AES", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA"}, - } - runServerTestSSLv3(t, test) - runServerTestTLS10(t, test) - runServerTestTLS12(t, test) -} - -func TestHandshakeServerAESGCM(t *testing.T) { - test := &serverTest{ - name: "RSA-AES-GCM", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-AES128-GCM-SHA256"}, - } - runServerTestTLS12(t, test) -} - -func TestHandshakeServerAES256GCMSHA384(t *testing.T) { - test := &serverTest{ - name: "RSA-AES256-GCM-SHA384", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-RSA-AES256-GCM-SHA384"}, - } - runServerTestTLS12(t, test) -} - -func TestHandshakeServerECDHEECDSAAES(t *testing.T) { - config := *testConfig - config.Certificates = make([]Certificate, 1) - config.Certificates[0].Certificate = [][]byte{testECDSACertificate} - config.Certificates[0].PrivateKey = testECDSAPrivateKey - config.BuildNameToCertificate() - - test := &serverTest{ - name: "ECDHE-ECDSA-AES", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "ECDHE-ECDSA-AES256-SHA"}, - config: &config, - } - runServerTestTLS10(t, test) - runServerTestTLS12(t, test) -} - -func TestHandshakeServerALPN(t *testing.T) { - config := *testConfig - config.NextProtos = []string{"proto1", "proto2"} - - test := &serverTest{ - name: "ALPN", - // Note that this needs OpenSSL 1.0.2 because that is the first - // version that supports the -alpn flag. - command: []string{"openssl", "s_client", "-alpn", "proto2,proto1"}, - config: &config, - validate: func(state ConnectionState) error { - // The server's preferences should override the client. - if state.NegotiatedProtocol != "proto1" { - return fmt.Errorf("Got protocol %q, wanted proto1", state.NegotiatedProtocol) - } - return nil - }, - } - runServerTestTLS12(t, test) -} - -func TestHandshakeServerALPNNoMatch(t *testing.T) { - config := *testConfig - config.NextProtos = []string{"proto3"} - - test := &serverTest{ - name: "ALPN-NoMatch", - // Note that this needs OpenSSL 1.0.2 because that is the first - // version that supports the -alpn flag. - command: []string{"openssl", "s_client", "-alpn", "proto2,proto1"}, - config: &config, - validate: func(state ConnectionState) error { - // Rather than reject the connection, Go doesn't select - // a protocol when there is no overlap. - if state.NegotiatedProtocol != "" { - return fmt.Errorf("Got protocol %q, wanted ''", state.NegotiatedProtocol) - } - return nil - }, - } - runServerTestTLS12(t, test) -} - -// TestHandshakeServerSNI involves a client sending an SNI extension of -// "snitest.com", which happens to match the CN of testSNICertificate. The test -// verifies that the server correctly selects that certificate. -func TestHandshakeServerSNI(t *testing.T) { - test := &serverTest{ - name: "SNI", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, - } - runServerTestTLS12(t, test) -} - -// TestHandshakeServerSNICertForName is similar to TestHandshakeServerSNI, but -// tests the dynamic GetCertificate method -func TestHandshakeServerSNIGetCertificate(t *testing.T) { - config := *testConfig - - // Replace the NameToCertificate map with a GetCertificate function - nameToCert := config.NameToCertificate - config.NameToCertificate = nil - config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { - cert, _ := nameToCert[clientHello.ServerName] - return cert, nil - } - test := &serverTest{ - name: "SNI-GetCertificate", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, - config: &config, - } - runServerTestTLS12(t, test) -} - -// TestHandshakeServerSNICertForNameNotFound is similar to -// TestHandshakeServerSNICertForName, but tests to make sure that when the -// GetCertificate method doesn't return a cert, we fall back to what's in -// the NameToCertificate map. -func TestHandshakeServerSNIGetCertificateNotFound(t *testing.T) { - config := *testConfig - - config.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { - return nil, nil - } - test := &serverTest{ - name: "SNI-GetCertificateNotFound", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "AES128-SHA", "-servername", "snitest.com"}, - config: &config, - } - runServerTestTLS12(t, test) -} - -// TestHandshakeServerSNICertForNameError tests to make sure that errors in -// GetCertificate result in a tls alert. -func TestHandshakeServerSNIGetCertificateError(t *testing.T) { - const errMsg = "TestHandshakeServerSNIGetCertificateError error" - - serverConfig := *testConfig - serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { - return nil, errors.New(errMsg) - } - - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0}, - serverName: "test", - } - testClientHelloFailure(t, &serverConfig, clientHello, errMsg) -} - -// TestHandshakeServerEmptyCertificates tests that GetCertificates is called in -// the case that Certificates is empty, even without SNI. -func TestHandshakeServerEmptyCertificates(t *testing.T) { - const errMsg = "TestHandshakeServerEmptyCertificates error" - - serverConfig := *testConfig - serverConfig.GetCertificate = func(clientHello *ClientHelloInfo) (*Certificate, error) { - return nil, errors.New(errMsg) - } - serverConfig.Certificates = nil - - clientHello := &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0}, - } - testClientHelloFailure(t, &serverConfig, clientHello, errMsg) - - // With an empty Certificates and a nil GetCertificate, the server - // should always return a “no certificates” error. - serverConfig.GetCertificate = nil - - clientHello = &clientHelloMsg{ - vers: 0x0301, - cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, - compressionMethods: []uint8{0}, - } - testClientHelloFailure(t, &serverConfig, clientHello, "no certificates") -} - -// TestCipherSuiteCertPreferance ensures that we select an RSA ciphersuite with -// an RSA certificate and an ECDSA ciphersuite with an ECDSA certificate. -func TestCipherSuiteCertPreferenceECDSA(t *testing.T) { - config := *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA} - config.PreferServerCipherSuites = true - - test := &serverTest{ - name: "CipherSuiteCertPreferenceRSA", - config: &config, - } - runServerTestTLS12(t, test) - - config = *testConfig - config.CipherSuites = []uint16{TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA} - config.Certificates = []Certificate{ - { - Certificate: [][]byte{testECDSACertificate}, - PrivateKey: testECDSAPrivateKey, - }, - } - config.BuildNameToCertificate() - config.PreferServerCipherSuites = true - - test = &serverTest{ - name: "CipherSuiteCertPreferenceECDSA", - config: &config, - } - runServerTestTLS12(t, test) -} - -func TestResumption(t *testing.T) { - sessionFilePath := tempFile("") - defer os.Remove(sessionFilePath) - - test := &serverTest{ - name: "IssueTicket", - command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_out", sessionFilePath}, - } - runServerTestTLS12(t, test) - - test = &serverTest{ - name: "Resume", - command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_in", sessionFilePath}, - } - runServerTestTLS12(t, test) -} - -func TestResumptionDisabled(t *testing.T) { - sessionFilePath := tempFile("") - defer os.Remove(sessionFilePath) - - config := *testConfig - - test := &serverTest{ - name: "IssueTicketPreDisable", - command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_out", sessionFilePath}, - config: &config, - } - runServerTestTLS12(t, test) - - config.SessionTicketsDisabled = true - - test = &serverTest{ - name: "ResumeDisabled", - command: []string{"openssl", "s_client", "-cipher", "RC4-SHA", "-sess_in", sessionFilePath}, - config: &config, - } - runServerTestTLS12(t, test) - - // One needs to manually confirm that the handshake in the golden data - // file for ResumeDisabled does not include a resumption handshake. -} - -func TestFallbackSCSV(t *testing.T) { - serverConfig := &Config{ - Certificates: testConfig.Certificates, - } - test := &serverTest{ - name: "FallbackSCSV", - config: serverConfig, - // OpenSSL 1.0.1j is needed for the -fallback_scsv option. - command: []string{"openssl", "s_client", "-fallback_scsv"}, - expectHandshakeErrorIncluding: "inappropriate protocol fallback", - } - runServerTestTLS11(t, test) -} - -// cert.pem and key.pem were generated with generate_cert.go -// Thus, they have no ExtKeyUsage fields and trigger an error -// when verification is turned on. - -const clientCertificatePEM = ` ------BEGIN CERTIFICATE----- -MIIB7TCCAVigAwIBAgIBADALBgkqhkiG9w0BAQUwJjEQMA4GA1UEChMHQWNtZSBD -bzESMBAGA1UEAxMJMTI3LjAuMC4xMB4XDTExMTIwODA3NTUxMloXDTEyMTIwNzA4 -MDAxMlowJjEQMA4GA1UEChMHQWNtZSBDbzESMBAGA1UEAxMJMTI3LjAuMC4xMIGc -MAsGCSqGSIb3DQEBAQOBjAAwgYgCgYBO0Hsx44Jk2VnAwoekXh6LczPHY1PfZpIG -hPZk1Y/kNqcdK+izIDZFI7Xjla7t4PUgnI2V339aEu+H5Fto5OkOdOwEin/ekyfE -ARl6vfLcPRSr0FTKIQzQTW6HLlzF0rtNS0/Otiz3fojsfNcCkXSmHgwa2uNKWi7e -E5xMQIhZkwIDAQABozIwMDAOBgNVHQ8BAf8EBAMCAKAwDQYDVR0OBAYEBAECAwQw -DwYDVR0jBAgwBoAEAQIDBDALBgkqhkiG9w0BAQUDgYEANh+zegx1yW43RmEr1b3A -p0vMRpqBWHyFeSnIyMZn3TJWRSt1tukkqVCavh9a+hoV2cxVlXIWg7nCto/9iIw4 -hB2rXZIxE0/9gzvGnfERYraL7KtnvshksBFQRlgXa5kc0x38BvEO5ZaoDPl4ILdE -GFGNEH5PlGffo05wc46QkYU= ------END CERTIFICATE-----` - -const clientKeyPEM = ` ------BEGIN RSA PRIVATE KEY----- -MIICWgIBAAKBgE7QezHjgmTZWcDCh6ReHotzM8djU99mkgaE9mTVj+Q2px0r6LMg -NkUjteOVru3g9SCcjZXff1oS74fkW2jk6Q507ASKf96TJ8QBGXq98tw9FKvQVMoh -DNBNbocuXMXSu01LT862LPd+iOx81wKRdKYeDBra40paLt4TnExAiFmTAgMBAAEC -gYBxvXd8yNteFTns8A/2yomEMC4yeosJJSpp1CsN3BJ7g8/qTnrVPxBy+RU+qr63 -t2WquaOu/cr5P8iEsa6lk20tf8pjKLNXeX0b1RTzK8rJLbS7nGzP3tvOhL096VtQ -dAo4ROEaro0TzYpHmpciSvxVIeEIAAdFDObDJPKqcJAxyQJBAJizfYgK8Gzx9fsx -hxp+VteCbVPg2euASH5Yv3K5LukRdKoSzHE2grUVQgN/LafC0eZibRanxHegYSr7 -7qaswKUCQQCEIWor/X4XTMdVj3Oj+vpiw75y/S9gh682+myZL+d/02IEkwnB098P -RkKVpenBHyrGg0oeN5La7URILWKj7CPXAkBKo6F+d+phNjwIFoN1Xb/RA32w/D1I -saG9sF+UEhRt9AxUfW/U/tIQ9V0ZHHcSg1XaCM5Nvp934brdKdvTOKnJAkBD5h/3 -Rybatlvg/fzBEaJFyq09zhngkxlZOUtBVTqzl17RVvY2orgH02U4HbCHy4phxOn7 -qTdQRYlHRftgnWK1AkANibn9PRYJ7mJyJ9Dyj2QeNcSkSTzrt0tPvUMf4+meJymN -1Ntu5+S1DLLzfxlaljWG6ylW6DNxujCyuXIV2rvA ------END RSA PRIVATE KEY-----` - -const clientECDSACertificatePEM = ` ------BEGIN CERTIFICATE----- -MIIB/DCCAV4CCQCaMIRsJjXZFzAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -eSBMdGQwHhcNMTIxMTE0MTMyNTUzWhcNMjIxMTEyMTMyNTUzWjBBMQswCQYDVQQG -EwJBVTEMMAoGA1UECBMDTlNXMRAwDgYDVQQHEwdQeXJtb250MRIwEAYDVQQDEwlK -b2VsIFNpbmcwgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACVjJF1FMBexFe01MNv -ja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd3kfDdq0Z9kUs -jLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx+U56jb0JuK7q -ixgnTy5w/hOWusPTQBbNZU6sER7m8TAJBgcqhkjOPQQBA4GMADCBiAJCAOAUxGBg -C3JosDJdYUoCdFzCgbkWqD8pyDbHgf9stlvZcPE4O1BIKJTLCRpS8V3ujfK58PDa -2RU6+b0DeoeiIzXsAkIBo9SKeDUcSpoj0gq+KxAxnZxfvuiRs9oa9V2jI/Umi0Vw -jWVim34BmT0Y9hCaOGGbLlfk+syxis7iI6CH8OFnUes= ------END CERTIFICATE-----` - -const clientECDSAKeyPEM = ` ------BEGIN EC PARAMETERS----- -BgUrgQQAIw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBkJN9X4IqZIguiEVKMqeBUP5xtRsEv4HJEtOpOGLELwO53SD78Ew8 -k+wLWoqizS3NpQyMtrU8JFdWfj+C57UNkOugBwYFK4EEACOhgYkDgYYABACVjJF1 -FMBexFe01MNvja5oHt1vzobhfm6ySD6B5U7ixohLZNz1MLvT/2XMW/TdtWo+PtAd -3kfDdq0Z9kUsjLzYHQFMH3CQRnZIi4+DzEpcj0B22uCJ7B0rxE4wdihBsmKo+1vx -+U56jb0JuK7qixgnTy5w/hOWusPTQBbNZU6sER7m8Q== ------END EC PRIVATE KEY-----` - -func TestClientAuth(t *testing.T) { - var certPath, keyPath, ecdsaCertPath, ecdsaKeyPath string - - if *update { - certPath = tempFile(clientCertificatePEM) - defer os.Remove(certPath) - keyPath = tempFile(clientKeyPEM) - defer os.Remove(keyPath) - ecdsaCertPath = tempFile(clientECDSACertificatePEM) - defer os.Remove(ecdsaCertPath) - ecdsaKeyPath = tempFile(clientECDSAKeyPEM) - defer os.Remove(ecdsaKeyPath) - } - - config := *testConfig - config.ClientAuth = RequestClientCert - - test := &serverTest{ - name: "ClientAuthRequestedNotGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "RC4-SHA"}, - config: &config, - } - runServerTestTLS12(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "RC4-SHA", "-cert", certPath, "-key", keyPath}, - config: &config, - expectedPeerCerts: []string{clientCertificatePEM}, - } - runServerTestTLS12(t, test) - - test = &serverTest{ - name: "ClientAuthRequestedAndECDSAGiven", - command: []string{"openssl", "s_client", "-no_ticket", "-cipher", "RC4-SHA", "-cert", ecdsaCertPath, "-key", ecdsaKeyPath}, - config: &config, - expectedPeerCerts: []string{clientECDSACertificatePEM}, - } - runServerTestTLS12(t, test) -} - -func bigFromString(s string) *big.Int { - ret := new(big.Int) - ret.SetString(s, 10) - return ret -} - -func fromHex(s string) []byte { - b, _ := hex.DecodeString(s) - return b -} - -var testRSACertificate = fromHex("30820263308201cca003020102020900a273000c8100cbf3300d06092a864886f70d01010b0500302b31173015060355040a130e476f6f676c652054455354494e473110300e06035504031307476f20526f6f74301e170d3135303130313030303030305a170d3235303130313030303030305a302631173015060355040a130e476f6f676c652054455354494e47310b300906035504031302476f30819f300d06092a864886f70d010101050003818d0030818902818100af8788f6201b95656c14ab4405af3b4514e3b76dfd00634d957ffe6a623586c04af9187cf6aa255e7a64316600baf48e92afc76bd876d4f35f41cb6e5615971b97c13c123921663d2b16d1bcdb1cc0a7dab7caadbadacbd52150ecde8dabd16b814b8902f3c4bec16c89b14484bd21d1047d9d164df98215f6effad60947f2fb0203010001a38193308190300e0603551d0f0101ff0404030205a0301d0603551d250416301406082b0601050507030106082b06010505070302300c0603551d130101ff0402300030190603551d0e0412041012508d896f1bd1dc544d6ecb695e06f4301b0603551d23041430128010bf3db6a966f2b840cfeab40378481a4130190603551d1104123010820e6578616d706c652e676f6c616e67300d06092a864886f70d01010b050003818100927caf91551218965931a64840d52dd5eebb02a0f5c21e7c9bb3307d3cdc76da4f3dc0faae2d33246b037b1b67591121b511bc77b9d9e06ea82d2e35fa645f223e63106bbeff14866d0df01531a814381e3b84872ccb98ed5176b9b14fdddb9b84048640fa51ddbab48debe346de46b94f86c7f9a4c24134acccf6eab0ab3918") - -var testRSACertificateIssuer = fromHex("3082024d308201b6a003020102020827326bd913b7c43d300d06092a864886f70d01010b0500302b31173015060355040a130e476f6f676c652054455354494e473110300e06035504031307476f20526f6f74301e170d3135303130313030303030305a170d3235303130313030303030305a302b31173015060355040a130e476f6f676c652054455354494e473110300e06035504031307476f20526f6f7430819f300d06092a864886f70d010101050003818d0030818902818100f0429a7b9f66a222c8453800452db355b34c4409fee09af2510a6589bfa35bdb4d453200d1de24338d6d5e5a91cc8301628445d6eb4e675927b9c1ea5c0f676acfb0f708ce4f19827e321c1898bf86df9823d5f0b05df2b6779888eff8abbc7f41c6e7d2667386a579b8cbaad3f6fd597cd7c4b187911a425aed1b555c1965190203010001a37a3078300e0603551d0f0101ff040403020204301d0603551d250416301406082b0601050507030106082b06010505070302300f0603551d130101ff040530030101ff30190603551d0e04120410bf3db6a966f2b840cfeab40378481a41301b0603551d23041430128010bf3db6a966f2b840cfeab40378481a41300d06092a864886f70d01010b050003818100586e68c1219ed4f5782b7cfd53cf1a55750a98781b2023f8694bb831fff6d7d4aad1f0ac782b1ec787f00a8956bdd06b4a1063444fcafe955c07d679163a730802c568886a2cf8a3c2ab41176957131c4b9e077ebd7ffbb91fdad8b08b932e9aeefac04923ffdc0aa145563f7f061995317400203578f350e3e566deb29dec5e") - -var testECDSACertificate = fromHex("3082020030820162020900b8bf2d47a0d2ebf4300906072a8648ce3d04013045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c7464301e170d3132313132323135303633325a170d3232313132303135303633325a3045310b3009060355040613024155311330110603550408130a536f6d652d53746174653121301f060355040a1318496e7465726e6574205769646769747320507479204c746430819b301006072a8648ce3d020106052b81040023038186000400c4a1edbe98f90b4873367ec316561122f23d53c33b4d213dcd6b75e6f6b0dc9adf26c1bcb287f072327cb3642f1c90bcea6823107efee325c0483a69e0286dd33700ef0462dd0da09c706283d881d36431aa9e9731bd96b068c09b23de76643f1a5c7fe9120e5858b65f70dd9bd8ead5d7f5d5ccb9b69f30665b669a20e227e5bffe3b300906072a8648ce3d040103818c0030818802420188a24febe245c5487d1bacf5ed989dae4770c05e1bb62fbdf1b64db76140d311a2ceee0b7e927eff769dc33b7ea53fcefa10e259ec472d7cacda4e970e15a06fd00242014dfcbe67139c2d050ebd3fa38c25c13313830d9406bbd4377af6ec7ac9862eddd711697f857c56defb31782be4c7780daecbbe9e4e3624317b6a0f399512078f2a") - -var testSNICertificate = fromHex("308201f23082015da003020102020100300b06092a864886f70d01010530283110300e060355040a130741636d6520436f311430120603550403130b736e69746573742e636f6d301e170d3132303431313137343033355a170d3133303431313137343533355a30283110300e060355040a130741636d6520436f311430120603550403130b736e69746573742e636f6d30819d300b06092a864886f70d01010103818d0030818902818100bb79d6f517b5e5bf4610d0dc69bee62b07435ad0032d8a7a4385b71452e7a5654c2c78b8238cb5b482e5de1f953b7e62a52ca533d6fe125c7a56fcf506bffa587b263fb5cd04d3d0c921964ac7f4549f5abfef427100fe1899077f7e887d7df10439c4a22edb51c97ce3c04c3b326601cfafb11db8719a1ddbdb896baeda2d790203010001a3323030300e0603551d0f0101ff0404030200a0300d0603551d0e0406040401020304300f0603551d2304083006800401020304300b06092a864886f70d0101050381810089c6455f1c1f5ef8eb1ab174ee2439059f5c4259bb1a8d86cdb1d056f56a717da40e95ab90f59e8deaf627c157995094db0802266eb34fc6842dea8a4b68d9c1389103ab84fb9e1f85d9b5d23ff2312c8670fbb540148245a4ebafe264d90c8a4cf4f85b0fac12ac2fc4a3154bad52462868af96c62c6525d652b6e31845bdcc") - -var testRSAPrivateKey = &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: bigFromString("123260960069105588390096594560395120585636206567569540256061833976822892593755073841963170165000086278069699238754008398039246547214989242849418349143232951701395321381739566687846006911427966669790845430647688107009232778985142860108863460556510585049041936029324503323373417214453307648498561956908810892027L"), - E: 65537, - }, - D: bigFromString("73196363031103823625826315929954946106043759818067219550565550066527203472294428548476778865091068522665312037075674791871635825938217363523103946045078950060973913307430314113074463630778799389010335923241901501086246276485964417618981733827707048660375428006201525399194575538037883519254056917253456403553L"), - Primes: []*big.Int{ - bigFromString("11157426355495284553529769521954035649776033703833034489026848970480272318436419662860715175517581249375929775774910501512841707465207184924996975125010787L"), - bigFromString("11047436580963564307160117670964629323534448585520694947919342920137706075617545637058809770319843170934495909554506529982972972247390145716507031692656521L"), - }, -} - -var testECDSAPrivateKey = &ecdsa.PrivateKey{ - PublicKey: ecdsa.PublicKey{ - Curve: elliptic.P521(), - X: bigFromString("2636411247892461147287360222306590634450676461695221912739908880441342231985950069527906976759812296359387337367668045707086543273113073382714101597903639351"), - Y: bigFromString("3204695818431246682253994090650952614555094516658732116404513121125038617915183037601737180082382202488628239201196033284060130040574800684774115478859677243"), - }, - D: bigFromString("5477294338614160138026852784385529180817726002953041720191098180813046231640184669647735805135001309477695746518160084669446643325196003346204701381388769751"), -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_test.go deleted file mode 100644 index f95f274ab415909f4ce3f838eb779f1856b136a9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/handshake_test.go +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bufio" - "encoding/hex" - "errors" - "flag" - "fmt" - "io" - "io/ioutil" - "net" - "strconv" - "strings" - "sync" -) - -// TLS reference tests run a connection against a reference implementation -// (OpenSSL) of TLS and record the bytes of the resulting connection. The Go -// code, during a test, is configured with deterministic randomness and so the -// reference test can be reproduced exactly in the future. -// -// In order to save everyone who wishes to run the tests from needing the -// reference implementation installed, the reference connections are saved in -// files in the testdata directory. Thus running the tests involves nothing -// external, but creating and updating them requires the reference -// implementation. -// -// Tests can be updated by running them with the -update flag. This will cause -// the test files. Generally one should combine the -update flag with -test.run -// to updated a specific test. Since the reference implementation will always -// generate fresh random numbers, large parts of the reference connection will -// always change. - -var update = flag.Bool("update", false, "update golden files on disk") - -// recordingConn is a net.Conn that records the traffic that passes through it. -// WriteTo can be used to produce output that can be later be loaded with -// ParseTestData. -type recordingConn struct { - net.Conn - sync.Mutex - flows [][]byte - reading bool -} - -func (r *recordingConn) Read(b []byte) (n int, err error) { - if n, err = r.Conn.Read(b); n == 0 { - return - } - b = b[:n] - - r.Lock() - defer r.Unlock() - - if l := len(r.flows); l == 0 || !r.reading { - buf := make([]byte, len(b)) - copy(buf, b) - r.flows = append(r.flows, buf) - } else { - r.flows[l-1] = append(r.flows[l-1], b[:n]...) - } - r.reading = true - return -} - -func (r *recordingConn) Write(b []byte) (n int, err error) { - if n, err = r.Conn.Write(b); n == 0 { - return - } - b = b[:n] - - r.Lock() - defer r.Unlock() - - if l := len(r.flows); l == 0 || r.reading { - buf := make([]byte, len(b)) - copy(buf, b) - r.flows = append(r.flows, buf) - } else { - r.flows[l-1] = append(r.flows[l-1], b[:n]...) - } - r.reading = false - return -} - -// WriteTo writes Go source code to w that contains the recorded traffic. -func (r *recordingConn) WriteTo(w io.Writer) { - // TLS always starts with a client to server flow. - clientToServer := true - - for i, flow := range r.flows { - source, dest := "client", "server" - if !clientToServer { - source, dest = dest, source - } - fmt.Fprintf(w, ">>> Flow %d (%s to %s)\n", i+1, source, dest) - dumper := hex.Dumper(w) - dumper.Write(flow) - dumper.Close() - clientToServer = !clientToServer - } -} - -func parseTestData(r io.Reader) (flows [][]byte, err error) { - var currentFlow []byte - - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - // If the line starts with ">>> " then it marks the beginning - // of a new flow. - if strings.HasPrefix(line, ">>> ") { - if len(currentFlow) > 0 || len(flows) > 0 { - flows = append(flows, currentFlow) - currentFlow = nil - } - continue - } - - // Otherwise the line is a line of hex dump that looks like: - // 00000170 fc f5 06 bf (...) |.....X{&?......!| - // (Some bytes have been omitted from the middle section.) - - if i := strings.IndexByte(line, ' '); i >= 0 { - line = line[i:] - } else { - return nil, errors.New("invalid test data") - } - - if i := strings.IndexByte(line, '|'); i >= 0 { - line = line[:i] - } else { - return nil, errors.New("invalid test data") - } - - hexBytes := strings.Fields(line) - for _, hexByte := range hexBytes { - val, err := strconv.ParseUint(hexByte, 16, 8) - if err != nil { - return nil, errors.New("invalid hex byte in test data: " + err.Error()) - } - currentFlow = append(currentFlow, byte(val)) - } - } - - if len(currentFlow) > 0 { - flows = append(flows, currentFlow) - } - - return flows, nil -} - -// tempFile creates a temp file containing contents and returns its path. -func tempFile(contents string) string { - file, err := ioutil.TempFile("", "go-tls-test") - if err != nil { - panic("failed to create temp file: " + err.Error()) - } - path := file.Name() - file.WriteString(contents) - file.Close() - return path -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/key_agreement.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/key_agreement.go deleted file mode 100644 index 0e6a7c2262404ae6bf499a914855b48bda897535..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/key_agreement.go +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "crypto" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/md5" - "crypto/rsa" - "crypto/sha1" - "crypto/x509" - "encoding/asn1" - "errors" - "io" - "math/big" -) - -var errClientKeyExchange = errors.New("tls: invalid ClientKeyExchange message") -var errServerKeyExchange = errors.New("tls: invalid ServerKeyExchange message") - -// rsaKeyAgreement implements the standard TLS key agreement where the client -// encrypts the pre-master secret to the server's public key. -type rsaKeyAgreement struct{} - -func (ka rsaKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { - return nil, nil -} - -func (ka rsaKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { - if len(ckx.ciphertext) < 2 { - return nil, errClientKeyExchange - } - - ciphertext := ckx.ciphertext - if version != VersionSSL30 { - ciphertextLen := int(ckx.ciphertext[0])<<8 | int(ckx.ciphertext[1]) - if ciphertextLen != len(ckx.ciphertext)-2 { - return nil, errClientKeyExchange - } - ciphertext = ckx.ciphertext[2:] - } - priv, ok := cert.PrivateKey.(crypto.Decrypter) - if !ok { - return nil, errors.New("tls: certificate private key does not implement crypto.Decrypter") - } - // Perform constant time RSA PKCS#1 v1.5 decryption - preMasterSecret, err := priv.Decrypt(config.rand(), ciphertext, &rsa.PKCS1v15DecryptOptions{SessionKeyLen: 48}) - if err != nil { - return nil, err - } - // We don't check the version number in the premaster secret. For one, - // by checking it, we would leak information about the validity of the - // encrypted pre-master secret. Secondly, it provides only a small - // benefit against a downgrade attack and some implementations send the - // wrong version anyway. See the discussion at the end of section - // 7.4.7.1 of RFC 4346. - return preMasterSecret, nil -} - -func (ka rsaKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { - return errors.New("tls: unexpected ServerKeyExchange") -} - -func (ka rsaKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { - preMasterSecret := make([]byte, 48) - preMasterSecret[0] = byte(clientHello.vers >> 8) - preMasterSecret[1] = byte(clientHello.vers) - _, err := io.ReadFull(config.rand(), preMasterSecret[2:]) - if err != nil { - return nil, nil, err - } - - encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), preMasterSecret) - if err != nil { - return nil, nil, err - } - ckx := new(clientKeyExchangeMsg) - ckx.ciphertext = make([]byte, len(encrypted)+2) - ckx.ciphertext[0] = byte(len(encrypted) >> 8) - ckx.ciphertext[1] = byte(len(encrypted)) - copy(ckx.ciphertext[2:], encrypted) - return preMasterSecret, ckx, nil -} - -// sha1Hash calculates a SHA1 hash over the given byte slices. -func sha1Hash(slices [][]byte) []byte { - hsha1 := sha1.New() - for _, slice := range slices { - hsha1.Write(slice) - } - return hsha1.Sum(nil) -} - -// md5SHA1Hash implements TLS 1.0's hybrid hash function which consists of the -// concatenation of an MD5 and SHA1 hash. -func md5SHA1Hash(slices [][]byte) []byte { - md5sha1 := make([]byte, md5.Size+sha1.Size) - hmd5 := md5.New() - for _, slice := range slices { - hmd5.Write(slice) - } - copy(md5sha1, hmd5.Sum(nil)) - copy(md5sha1[md5.Size:], sha1Hash(slices)) - return md5sha1 -} - -// hashForServerKeyExchange hashes the given slices and returns their digest -// and the identifier of the hash function used. The sigAndHash argument is -// only used for >= TLS 1.2 and precisely identifies the hash function to use. -func hashForServerKeyExchange(sigAndHash signatureAndHash, version uint16, slices ...[]byte) ([]byte, crypto.Hash, error) { - if version >= VersionTLS12 { - if !isSupportedSignatureAndHash(sigAndHash, supportedSignatureAlgorithms) { - return nil, crypto.Hash(0), errors.New("tls: unsupported hash function used by peer") - } - hashFunc, err := lookupTLSHash(sigAndHash.hash) - if err != nil { - return nil, crypto.Hash(0), err - } - h := hashFunc.New() - for _, slice := range slices { - h.Write(slice) - } - digest := h.Sum(nil) - return digest, hashFunc, nil - } - if sigAndHash.signature == signatureECDSA { - return sha1Hash(slices), crypto.SHA1, nil - } - return md5SHA1Hash(slices), crypto.MD5SHA1, nil -} - -// pickTLS12HashForSignature returns a TLS 1.2 hash identifier for signing a -// ServerKeyExchange given the signature type being used and the client's -// advertised list of supported signature and hash combinations. -func pickTLS12HashForSignature(sigType uint8, clientList []signatureAndHash) (uint8, error) { - if len(clientList) == 0 { - // If the client didn't specify any signature_algorithms - // extension then we can assume that it supports SHA1. See - // http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 - return hashSHA1, nil - } - - for _, sigAndHash := range clientList { - if sigAndHash.signature != sigType { - continue - } - if isSupportedSignatureAndHash(sigAndHash, supportedSignatureAlgorithms) { - return sigAndHash.hash, nil - } - } - - return 0, errors.New("tls: client doesn't support any common hash functions") -} - -func curveForCurveID(id CurveID) (elliptic.Curve, bool) { - switch id { - case CurveP256: - return elliptic.P256(), true - case CurveP384: - return elliptic.P384(), true - case CurveP521: - return elliptic.P521(), true - default: - return nil, false - } - -} - -// ecdheRSAKeyAgreement implements a TLS key agreement where the server -// generates a ephemeral EC public/private key pair and signs it. The -// pre-master secret is then calculated using ECDH. The signature may -// either be ECDSA or RSA. -type ecdheKeyAgreement struct { - version uint16 - sigType uint8 - privateKey []byte - curve elliptic.Curve - x, y *big.Int -} - -func (ka *ecdheKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) { - var curveid CurveID - preferredCurves := config.curvePreferences() - -NextCandidate: - for _, candidate := range preferredCurves { - for _, c := range clientHello.supportedCurves { - if candidate == c { - curveid = c - break NextCandidate - } - } - } - - if curveid == 0 { - return nil, errors.New("tls: no supported elliptic curves offered") - } - - var ok bool - if ka.curve, ok = curveForCurveID(curveid); !ok { - return nil, errors.New("tls: preferredCurves includes unsupported curve") - } - - var x, y *big.Int - var err error - ka.privateKey, x, y, err = elliptic.GenerateKey(ka.curve, config.rand()) - if err != nil { - return nil, err - } - ecdhePublic := elliptic.Marshal(ka.curve, x, y) - - // http://tools.ietf.org/html/rfc4492#section-5.4 - serverECDHParams := make([]byte, 1+2+1+len(ecdhePublic)) - serverECDHParams[0] = 3 // named curve - serverECDHParams[1] = byte(curveid >> 8) - serverECDHParams[2] = byte(curveid) - serverECDHParams[3] = byte(len(ecdhePublic)) - copy(serverECDHParams[4:], ecdhePublic) - - sigAndHash := signatureAndHash{signature: ka.sigType} - - if ka.version >= VersionTLS12 { - if sigAndHash.hash, err = pickTLS12HashForSignature(ka.sigType, clientHello.signatureAndHashes); err != nil { - return nil, err - } - } - - digest, hashFunc, err := hashForServerKeyExchange(sigAndHash, ka.version, clientHello.random, hello.random, serverECDHParams) - if err != nil { - return nil, err - } - - priv, ok := cert.PrivateKey.(crypto.Signer) - if !ok { - return nil, errors.New("tls: certificate private key does not implement crypto.Signer") - } - var sig []byte - switch ka.sigType { - case signatureECDSA: - _, ok := priv.Public().(*ecdsa.PublicKey) - if !ok { - return nil, errors.New("ECDHE ECDSA requires an ECDSA server key") - } - case signatureRSA: - _, ok := priv.Public().(*rsa.PublicKey) - if !ok { - return nil, errors.New("ECDHE RSA requires a RSA server key") - } - default: - return nil, errors.New("unknown ECDHE signature algorithm") - } - sig, err = priv.Sign(config.rand(), digest, hashFunc) - if err != nil { - return nil, errors.New("failed to sign ECDHE parameters: " + err.Error()) - } - - skx := new(serverKeyExchangeMsg) - sigAndHashLen := 0 - if ka.version >= VersionTLS12 { - sigAndHashLen = 2 - } - skx.key = make([]byte, len(serverECDHParams)+sigAndHashLen+2+len(sig)) - copy(skx.key, serverECDHParams) - k := skx.key[len(serverECDHParams):] - if ka.version >= VersionTLS12 { - k[0] = sigAndHash.hash - k[1] = sigAndHash.signature - k = k[2:] - } - k[0] = byte(len(sig) >> 8) - k[1] = byte(len(sig)) - copy(k[2:], sig) - - return skx, nil -} - -func (ka *ecdheKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) { - if len(ckx.ciphertext) == 0 || int(ckx.ciphertext[0]) != len(ckx.ciphertext)-1 { - return nil, errClientKeyExchange - } - x, y := elliptic.Unmarshal(ka.curve, ckx.ciphertext[1:]) - if x == nil { - return nil, errClientKeyExchange - } - if !ka.curve.IsOnCurve(x, y) { - return nil, errClientKeyExchange - } - x, _ = ka.curve.ScalarMult(x, y, ka.privateKey) - preMasterSecret := make([]byte, (ka.curve.Params().BitSize+7)>>3) - xBytes := x.Bytes() - copy(preMasterSecret[len(preMasterSecret)-len(xBytes):], xBytes) - - return preMasterSecret, nil -} - -func (ka *ecdheKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error { - if len(skx.key) < 4 { - return errServerKeyExchange - } - if skx.key[0] != 3 { // named curve - return errors.New("tls: server selected unsupported curve") - } - curveid := CurveID(skx.key[1])<<8 | CurveID(skx.key[2]) - - var ok bool - if ka.curve, ok = curveForCurveID(curveid); !ok { - return errors.New("tls: server selected unsupported curve") - } - - publicLen := int(skx.key[3]) - if publicLen+4 > len(skx.key) { - return errServerKeyExchange - } - ka.x, ka.y = elliptic.Unmarshal(ka.curve, skx.key[4:4+publicLen]) - if ka.x == nil { - return errServerKeyExchange - } - if !ka.curve.IsOnCurve(ka.x, ka.y) { - return errServerKeyExchange - } - serverECDHParams := skx.key[:4+publicLen] - - sig := skx.key[4+publicLen:] - if len(sig) < 2 { - return errServerKeyExchange - } - - sigAndHash := signatureAndHash{signature: ka.sigType} - if ka.version >= VersionTLS12 { - // handle SignatureAndHashAlgorithm - sigAndHash = signatureAndHash{hash: sig[0], signature: sig[1]} - if sigAndHash.signature != ka.sigType { - return errServerKeyExchange - } - sig = sig[2:] - if len(sig) < 2 { - return errServerKeyExchange - } - } - sigLen := int(sig[0])<<8 | int(sig[1]) - if sigLen+2 != len(sig) { - return errServerKeyExchange - } - sig = sig[2:] - - digest, hashFunc, err := hashForServerKeyExchange(sigAndHash, ka.version, clientHello.random, serverHello.random, serverECDHParams) - if err != nil { - return err - } - switch ka.sigType { - case signatureECDSA: - pubKey, ok := cert.PublicKey.(*ecdsa.PublicKey) - if !ok { - return errors.New("ECDHE ECDSA requires a ECDSA server public key") - } - ecdsaSig := new(ecdsaSignature) - if _, err := asn1.Unmarshal(sig, ecdsaSig); err != nil { - return err - } - if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { - return errors.New("ECDSA signature contained zero or negative values") - } - if !ecdsa.Verify(pubKey, digest, ecdsaSig.R, ecdsaSig.S) { - return errors.New("ECDSA verification failure") - } - case signatureRSA: - pubKey, ok := cert.PublicKey.(*rsa.PublicKey) - if !ok { - return errors.New("ECDHE RSA requires a RSA server public key") - } - if err := rsa.VerifyPKCS1v15(pubKey, hashFunc, digest, sig); err != nil { - return err - } - default: - return errors.New("unknown ECDHE signature algorithm") - } - - return nil -} - -func (ka *ecdheKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) { - if ka.curve == nil { - return nil, nil, errors.New("missing ServerKeyExchange message") - } - priv, mx, my, err := elliptic.GenerateKey(ka.curve, config.rand()) - if err != nil { - return nil, nil, err - } - x, _ := ka.curve.ScalarMult(ka.x, ka.y, priv) - preMasterSecret := make([]byte, (ka.curve.Params().BitSize+7)>>3) - xBytes := x.Bytes() - copy(preMasterSecret[len(preMasterSecret)-len(xBytes):], xBytes) - - serialized := elliptic.Marshal(ka.curve, mx, my) - - ckx := new(clientKeyExchangeMsg) - ckx.ciphertext = make([]byte, 1+len(serialized)) - ckx.ciphertext[0] = byte(len(serialized)) - copy(ckx.ciphertext[1:], serialized) - - return preMasterSecret, ckx, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf.go deleted file mode 100644 index 6127c1ccfe79facc2484f70977d926377bff993c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf.go +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "crypto" - "crypto/hmac" - "crypto/md5" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "errors" - "hash" -) - -// Split a premaster secret in two as specified in RFC 4346, section 5. -func splitPreMasterSecret(secret []byte) (s1, s2 []byte) { - s1 = secret[0 : (len(secret)+1)/2] - s2 = secret[len(secret)/2:] - return -} - -// pHash implements the P_hash function, as defined in RFC 4346, section 5. -func pHash(result, secret, seed []byte, hash func() hash.Hash) { - h := hmac.New(hash, secret) - h.Write(seed) - a := h.Sum(nil) - - j := 0 - for j < len(result) { - h.Reset() - h.Write(a) - h.Write(seed) - b := h.Sum(nil) - todo := len(b) - if j+todo > len(result) { - todo = len(result) - j - } - copy(result[j:j+todo], b) - j += todo - - h.Reset() - h.Write(a) - a = h.Sum(nil) - } -} - -// prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, section 5. -func prf10(result, secret, label, seed []byte) { - hashSHA1 := sha1.New - hashMD5 := md5.New - - labelAndSeed := make([]byte, len(label)+len(seed)) - copy(labelAndSeed, label) - copy(labelAndSeed[len(label):], seed) - - s1, s2 := splitPreMasterSecret(secret) - pHash(result, s1, labelAndSeed, hashMD5) - result2 := make([]byte, len(result)) - pHash(result2, s2, labelAndSeed, hashSHA1) - - for i, b := range result2 { - result[i] ^= b - } -} - -// prf12 implements the TLS 1.2 pseudo-random function, as defined in RFC 5246, section 5. -func prf12(hashFunc func() hash.Hash) func(result, secret, label, seed []byte) { - return func(result, secret, label, seed []byte) { - labelAndSeed := make([]byte, len(label)+len(seed)) - copy(labelAndSeed, label) - copy(labelAndSeed[len(label):], seed) - - pHash(result, secret, labelAndSeed, hashFunc) - } -} - -// prf30 implements the SSL 3.0 pseudo-random function, as defined in -// www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt section 6. -func prf30(result, secret, label, seed []byte) { - hashSHA1 := sha1.New() - hashMD5 := md5.New() - - done := 0 - i := 0 - // RFC5246 section 6.3 says that the largest PRF output needed is 128 - // bytes. Since no more ciphersuites will be added to SSLv3, this will - // remain true. Each iteration gives us 16 bytes so 10 iterations will - // be sufficient. - var b [11]byte - for done < len(result) { - for j := 0; j <= i; j++ { - b[j] = 'A' + byte(i) - } - - hashSHA1.Reset() - hashSHA1.Write(b[:i+1]) - hashSHA1.Write(secret) - hashSHA1.Write(seed) - digest := hashSHA1.Sum(nil) - - hashMD5.Reset() - hashMD5.Write(secret) - hashMD5.Write(digest) - - done += copy(result[done:], hashMD5.Sum(nil)) - i++ - } -} - -const ( - tlsRandomLength = 32 // Length of a random nonce in TLS 1.1. - masterSecretLength = 48 // Length of a master secret in TLS 1.1. - finishedVerifyLength = 12 // Length of verify_data in a Finished message. -) - -var masterSecretLabel = []byte("master secret") -var keyExpansionLabel = []byte("key expansion") -var clientFinishedLabel = []byte("client finished") -var serverFinishedLabel = []byte("server finished") - -func prfAndHashForVersion(version uint16, suite *cipherSuite) (func(result, secret, label, seed []byte), crypto.Hash) { - switch version { - case VersionSSL30: - return prf30, crypto.Hash(0) - case VersionTLS10, VersionTLS11: - return prf10, crypto.Hash(0) - case VersionTLS12: - if suite.flags&suiteSHA384 != 0 { - return prf12(sha512.New384), crypto.SHA384 - } - return prf12(sha256.New), crypto.SHA256 - default: - panic("unknown version") - } -} - -func prfForVersion(version uint16, suite *cipherSuite) func(result, secret, label, seed []byte) { - prf, _ := prfAndHashForVersion(version, suite) - return prf -} - -// masterFromPreMasterSecret generates the master secret from the pre-master -// secret. See http://tools.ietf.org/html/rfc5246#section-8.1 -func masterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, clientRandom, serverRandom []byte) []byte { - var seed [tlsRandomLength * 2]byte - copy(seed[0:len(clientRandom)], clientRandom) - copy(seed[len(clientRandom):], serverRandom) - masterSecret := make([]byte, masterSecretLength) - prfForVersion(version, suite)(masterSecret, preMasterSecret, masterSecretLabel, seed[0:]) - return masterSecret -} - -// keysFromMasterSecret generates the connection keys from the master -// secret, given the lengths of the MAC key, cipher key and IV, as defined in -// RFC 2246, section 6.3. -func keysFromMasterSecret(version uint16, suite *cipherSuite, masterSecret, clientRandom, serverRandom []byte, macLen, keyLen, ivLen int) (clientMAC, serverMAC, clientKey, serverKey, clientIV, serverIV []byte) { - var seed [tlsRandomLength * 2]byte - copy(seed[0:len(clientRandom)], serverRandom) - copy(seed[len(serverRandom):], clientRandom) - - n := 2*macLen + 2*keyLen + 2*ivLen - keyMaterial := make([]byte, n) - prfForVersion(version, suite)(keyMaterial, masterSecret, keyExpansionLabel, seed[0:]) - clientMAC = keyMaterial[:macLen] - keyMaterial = keyMaterial[macLen:] - serverMAC = keyMaterial[:macLen] - keyMaterial = keyMaterial[macLen:] - clientKey = keyMaterial[:keyLen] - keyMaterial = keyMaterial[keyLen:] - serverKey = keyMaterial[:keyLen] - keyMaterial = keyMaterial[keyLen:] - clientIV = keyMaterial[:ivLen] - keyMaterial = keyMaterial[ivLen:] - serverIV = keyMaterial[:ivLen] - return -} - -// lookupTLSHash looks up the corresponding crypto.Hash for a given -// TLS hash identifier. -func lookupTLSHash(hash uint8) (crypto.Hash, error) { - switch hash { - case hashSHA1: - return crypto.SHA1, nil - case hashSHA256: - return crypto.SHA256, nil - case hashSHA384: - return crypto.SHA384, nil - default: - return 0, errors.New("tls: unsupported hash algorithm") - } -} - -func newFinishedHash(version uint16, cipherSuite *cipherSuite) finishedHash { - var buffer []byte - if version == VersionSSL30 || version >= VersionTLS12 { - buffer = []byte{} - } - - prf, hash := prfAndHashForVersion(version, cipherSuite) - if hash != 0 { - return finishedHash{hash.New(), hash.New(), nil, nil, buffer, version, prf} - } - - return finishedHash{sha1.New(), sha1.New(), md5.New(), md5.New(), buffer, version, prf} -} - -// A finishedHash calculates the hash of a set of handshake messages suitable -// for including in a Finished message. -type finishedHash struct { - client hash.Hash - server hash.Hash - - // Prior to TLS 1.2, an additional MD5 hash is required. - clientMD5 hash.Hash - serverMD5 hash.Hash - - // In TLS 1.2, a full buffer is sadly required. - buffer []byte - - version uint16 - prf func(result, secret, label, seed []byte) -} - -func (h *finishedHash) Write(msg []byte) (n int, err error) { - h.client.Write(msg) - h.server.Write(msg) - - if h.version < VersionTLS12 { - h.clientMD5.Write(msg) - h.serverMD5.Write(msg) - } - - if h.buffer != nil { - h.buffer = append(h.buffer, msg...) - } - - return len(msg), nil -} - -func (h finishedHash) Sum() []byte { - if h.version >= VersionTLS12 { - return h.client.Sum(nil) - } - - out := make([]byte, 0, md5.Size+sha1.Size) - out = h.clientMD5.Sum(out) - return h.client.Sum(out) -} - -// finishedSum30 calculates the contents of the verify_data member of a SSLv3 -// Finished message given the MD5 and SHA1 hashes of a set of handshake -// messages. -func finishedSum30(md5, sha1 hash.Hash, masterSecret []byte, magic []byte) []byte { - md5.Write(magic) - md5.Write(masterSecret) - md5.Write(ssl30Pad1[:]) - md5Digest := md5.Sum(nil) - - md5.Reset() - md5.Write(masterSecret) - md5.Write(ssl30Pad2[:]) - md5.Write(md5Digest) - md5Digest = md5.Sum(nil) - - sha1.Write(magic) - sha1.Write(masterSecret) - sha1.Write(ssl30Pad1[:40]) - sha1Digest := sha1.Sum(nil) - - sha1.Reset() - sha1.Write(masterSecret) - sha1.Write(ssl30Pad2[:40]) - sha1.Write(sha1Digest) - sha1Digest = sha1.Sum(nil) - - ret := make([]byte, len(md5Digest)+len(sha1Digest)) - copy(ret, md5Digest) - copy(ret[len(md5Digest):], sha1Digest) - return ret -} - -var ssl3ClientFinishedMagic = [4]byte{0x43, 0x4c, 0x4e, 0x54} -var ssl3ServerFinishedMagic = [4]byte{0x53, 0x52, 0x56, 0x52} - -// clientSum returns the contents of the verify_data member of a client's -// Finished message. -func (h finishedHash) clientSum(masterSecret []byte) []byte { - if h.version == VersionSSL30 { - return finishedSum30(h.clientMD5, h.client, masterSecret, ssl3ClientFinishedMagic[:]) - } - - out := make([]byte, finishedVerifyLength) - h.prf(out, masterSecret, clientFinishedLabel, h.Sum()) - return out -} - -// serverSum returns the contents of the verify_data member of a server's -// Finished message. -func (h finishedHash) serverSum(masterSecret []byte) []byte { - if h.version == VersionSSL30 { - return finishedSum30(h.serverMD5, h.server, masterSecret, ssl3ServerFinishedMagic[:]) - } - - out := make([]byte, finishedVerifyLength) - h.prf(out, masterSecret, serverFinishedLabel, h.Sum()) - return out -} - -// selectClientCertSignatureAlgorithm returns a signatureAndHash to sign a -// client's CertificateVerify with, or an error if none can be found. -func (h finishedHash) selectClientCertSignatureAlgorithm(serverList []signatureAndHash, sigType uint8) (signatureAndHash, error) { - if h.version < VersionTLS12 { - // Nothing to negotiate before TLS 1.2. - return signatureAndHash{signature: sigType}, nil - } - - for _, v := range serverList { - if v.signature == sigType && isSupportedSignatureAndHash(v, supportedSignatureAlgorithms) { - return v, nil - } - } - return signatureAndHash{}, errors.New("tls: no supported signature algorithm found for signing client certificate") -} - -// hashForClientCertificate returns a digest, hash function, and TLS 1.2 hash -// id suitable for signing by a TLS client certificate. -func (h finishedHash) hashForClientCertificate(signatureAndHash signatureAndHash, masterSecret []byte) ([]byte, crypto.Hash, error) { - if (h.version == VersionSSL30 || h.version >= VersionTLS12) && h.buffer == nil { - panic("a handshake hash for a client-certificate was requested after discarding the handshake buffer") - } - - if h.version == VersionSSL30 { - if signatureAndHash.signature != signatureRSA { - return nil, 0, errors.New("tls: unsupported signature type for client certificate") - } - - md5Hash := md5.New() - md5Hash.Write(h.buffer) - sha1Hash := sha1.New() - sha1Hash.Write(h.buffer) - return finishedSum30(md5Hash, sha1Hash, masterSecret, nil), crypto.MD5SHA1, nil - } - if h.version >= VersionTLS12 { - hashAlg, err := lookupTLSHash(signatureAndHash.hash) - if err != nil { - return nil, 0, err - } - hash := hashAlg.New() - hash.Write(h.buffer) - return hash.Sum(nil), hashAlg, nil - } - - if signatureAndHash.signature == signatureECDSA { - return h.server.Sum(nil), crypto.SHA1, nil - } - - return h.Sum(), crypto.MD5SHA1, nil -} - -// discardHandshakeBuffer is called when there is no more need to -// buffer the entirety of the handshake messages. -func (h *finishedHash) discardHandshakeBuffer() { - h.buffer = nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf_test.go deleted file mode 100644 index 0a1b1bcbd1b90c77bc2979dd371a187f2b950087..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/prf_test.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "encoding/hex" - "testing" -) - -type testSplitPreMasterSecretTest struct { - in, out1, out2 string -} - -var testSplitPreMasterSecretTests = []testSplitPreMasterSecretTest{ - {"", "", ""}, - {"00", "00", "00"}, - {"0011", "00", "11"}, - {"001122", "0011", "1122"}, - {"00112233", "0011", "2233"}, -} - -func TestSplitPreMasterSecret(t *testing.T) { - for i, test := range testSplitPreMasterSecretTests { - in, _ := hex.DecodeString(test.in) - out1, out2 := splitPreMasterSecret(in) - s1 := hex.EncodeToString(out1) - s2 := hex.EncodeToString(out2) - if s1 != test.out1 || s2 != test.out2 { - t.Errorf("#%d: got: (%s, %s) want: (%s, %s)", i, s1, s2, test.out1, test.out2) - } - } -} - -type testKeysFromTest struct { - version uint16 - suite *cipherSuite - preMasterSecret string - clientRandom, serverRandom string - masterSecret string - clientMAC, serverMAC string - clientKey, serverKey string - macLen, keyLen int -} - -func TestKeysFromPreMasterSecret(t *testing.T) { - for i, test := range testKeysFromTests { - in, _ := hex.DecodeString(test.preMasterSecret) - clientRandom, _ := hex.DecodeString(test.clientRandom) - serverRandom, _ := hex.DecodeString(test.serverRandom) - - masterSecret := masterFromPreMasterSecret(test.version, test.suite, in, clientRandom, serverRandom) - if s := hex.EncodeToString(masterSecret); s != test.masterSecret { - t.Errorf("#%d: bad master secret %s, want %s", i, s, test.masterSecret) - continue - } - - clientMAC, serverMAC, clientKey, serverKey, _, _ := keysFromMasterSecret(test.version, test.suite, masterSecret, clientRandom, serverRandom, test.macLen, test.keyLen, 0) - clientMACString := hex.EncodeToString(clientMAC) - serverMACString := hex.EncodeToString(serverMAC) - clientKeyString := hex.EncodeToString(clientKey) - serverKeyString := hex.EncodeToString(serverKey) - if clientMACString != test.clientMAC || - serverMACString != test.serverMAC || - clientKeyString != test.clientKey || - serverKeyString != test.serverKey { - t.Errorf("#%d: got: (%s, %s, %s, %s) want: (%s, %s, %s, %s)", i, clientMACString, serverMACString, clientKeyString, serverKeyString, test.clientMAC, test.serverMAC, test.clientKey, test.serverKey) - } - } -} - -func cipherSuiteById(id uint16) *cipherSuite { - for _, cipherSuite := range cipherSuites { - if cipherSuite.id == id { - return cipherSuite - } - } - panic("ciphersuite not found") -} - -// These test vectors were generated from GnuTLS using `gnutls-cli --insecure -d 9 ` -var testKeysFromTests = []testKeysFromTest{ - { - VersionTLS10, - cipherSuiteById(TLS_RSA_WITH_RC4_128_SHA), - "0302cac83ad4b1db3b9ab49ad05957de2a504a634a386fc600889321e1a971f57479466830ac3e6f468e87f5385fa0c5", - "4ae66303755184a3917fcb44880605fcc53baa01912b22ed94473fc69cebd558", - "4ae663020ec16e6bb5130be918cfcafd4d765979a3136a5d50c593446e4e44db", - "3d851bab6e5556e959a16bc36d66cfae32f672bfa9ecdef6096cbb1b23472df1da63dbbd9827606413221d149ed08ceb", - "805aaa19b3d2c0a0759a4b6c9959890e08480119", - "2d22f9fe519c075c16448305ceee209fc24ad109", - "d50b5771244f850cd8117a9ccafe2cf1", - "e076e33206b30507a85c32855acd0919", - 20, - 16, - }, - { - VersionTLS10, - cipherSuiteById(TLS_RSA_WITH_RC4_128_SHA), - "03023f7527316bc12cbcd69e4b9e8275d62c028f27e65c745cfcddc7ce01bd3570a111378b63848127f1c36e5f9e4890", - "4ae66364b5ea56b20ce4e25555aed2d7e67f42788dd03f3fee4adae0459ab106", - "4ae66363ab815cbf6a248b87d6b556184e945e9b97fbdf247858b0bdafacfa1c", - "7d64be7c80c59b740200b4b9c26d0baaa1c5ae56705acbcf2307fe62beb4728c19392c83f20483801cce022c77645460", - "97742ed60a0554ca13f04f97ee193177b971e3b0", - "37068751700400e03a8477a5c7eec0813ab9e0dc", - "207cddbc600d2a200abac6502053ee5c", - "df3f94f6e1eacc753b815fe16055cd43", - 20, - 16, - }, - { - VersionTLS10, - cipherSuiteById(TLS_RSA_WITH_RC4_128_SHA), - "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", - "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", - "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", - "1aff2e7a2c4279d0126f57a65a77a8d9d0087cf2733366699bec27eb53d5740705a8574bb1acc2abbe90e44f0dd28d6c", - "3c7647c93c1379a31a609542aa44e7f117a70085", - "0d73102994be74a575a3ead8532590ca32a526d4", - "ac7581b0b6c10d85bbd905ffbf36c65e", - "ff07edde49682b45466bd2e39464b306", - 20, - 16, - }, - { - VersionSSL30, - cipherSuiteById(TLS_RSA_WITH_RC4_128_SHA), - "832d515f1d61eebb2be56ba0ef79879efb9b527504abb386fb4310ed5d0e3b1f220d3bb6b455033a2773e6d8bdf951d278a187482b400d45deb88a5d5a6bb7d6a7a1decc04eb9ef0642876cd4a82d374d3b6ff35f0351dc5d411104de431375355addc39bfb1f6329fb163b0bc298d658338930d07d313cd980a7e3d9196cac1", - "4ae663b2ee389c0de147c509d8f18f5052afc4aaf9699efe8cb05ece883d3a5e", - "4ae664d503fd4cff50cfc1fb8fc606580f87b0fcdac9554ba0e01d785bdf278e", - "a614863e56299dcffeea2938f22c2ba023768dbe4b3f6877bc9c346c6ae529b51d9cb87ff9695ea4d01f2205584405b2", - "2c450d5b6f6e2013ac6bea6a0b32200d4e1ffb94", - "7a7a7438769536f2fb1ae49a61f0703b79b2dc53", - "f8f6b26c10f12855c9aafb1e0e839ccf", - "2b9d4b4a60cb7f396780ebff50650419", - 20, - 16, - }, -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA deleted file mode 100644 index 4bad7865df3f7bc411a17a54c9c02452e814c9ef..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-ECDSA +++ /dev/null @@ -1,130 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 c0 e1 5c 5b 45 |....Y...U....\[E| -00000010 70 fc a1 73 44 e7 69 b6 83 a1 71 bc 03 21 2e cc |p..sD.i...q..!..| -00000020 21 7a 28 20 82 6b 2f 77 7d 40 c7 20 0d e4 19 db |!z( .k/w}@. ....| -00000030 35 cd 75 a4 e7 e5 6c 3e c9 d5 fe 9d c5 88 78 7b |5.u...l>......x{| -00000040 c4 fc 04 9a c1 10 7a 15 d9 e9 4a 95 c0 09 00 00 |......z...J.....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 d6 0c 00 00 d2 03 00 17 41 04 01 |*............A..| -00000280 74 83 af 3a 65 7a ad 1a 63 1f 13 82 9d f4 de 06 |t..:ez..c.......| -00000290 4e 3a 03 81 61 72 ff f8 58 da 7b f5 81 6d 81 57 |N:..ar..X.{..m.W| -000002a0 d9 d1 b1 6d e3 97 db 86 72 17 15 18 16 d4 ec 04 |...m....r.......| -000002b0 32 7c 38 90 6b a4 3c e9 35 79 2d 4c 39 5e 2d 00 |2|8.k.<.5y-L9^-.| -000002c0 8b 30 81 88 02 42 01 44 78 e1 2a bb 95 f7 45 58 |.0...B.Dx.*...EX| -000002d0 d4 0d b6 e4 4e ff 48 b3 11 14 ee d5 6c bb 5f 0c |....N.H.....l._.| -000002e0 90 b6 ef bc 05 77 f6 05 42 b4 d8 a6 70 e6 8c 90 |.....w..B...p...| -000002f0 f0 4b 3b c9 d3 4e 0c 85 65 b4 e0 fe b5 10 09 9b |.K;..N..e.......| -00000300 e1 08 84 ea 93 96 8e a4 02 42 01 c7 15 ee 9d 98 |.........B......| -00000310 b7 25 eb 07 ff f6 94 7e e7 9d a5 17 9e 37 93 40 |.%.....~.....7.@| -00000320 4c 9f eb 6b a3 7a 57 d8 81 c6 d9 09 34 aa 96 8c |L..k.zW.....4...| -00000330 4d 28 2e 9f f7 0b 1c 09 e1 d1 d8 48 6e 8a 8e 9c |M(.........Hn...| -00000340 01 4c e7 2d 53 8f 8e 71 61 82 ff ff 16 03 01 00 |.L.-S..qa.......| -00000350 0e 0d 00 00 06 03 01 02 40 00 00 0e 00 00 00 |........@......| ->>> Flow 3 (client to server) -00000000 16 03 01 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| -00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| -00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| -00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| -00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| -00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| -00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| -00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| -00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| -00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| -000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| -000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| -000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| -000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| -000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| -000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| -00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| -00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| -00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| -00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| -00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| -00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| -00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| -00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| -00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| -00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| -000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| -000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| -000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| -000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| -000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| -000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| -00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 01 00 46 10 00 00 42 41 04 1e 18 37 ef 0d 19 |...F...BA...7...| -00000220 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| -00000230 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| -00000240 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| -00000250 b5 68 1a 41 03 56 6b dc 5a 89 16 03 01 00 91 0f |.h.A.Vk.Z.......| -00000260 00 00 8d 00 8b 30 81 88 02 42 01 91 2d e9 99 a4 |.....0...B..-...| -00000270 88 5c 03 9c ea 8b 64 07 f2 c9 e7 ad 5b a3 fb 27 |.\....d.....[..'| -00000280 fd 19 9b 78 bd 7b 9d 0a cc 8a 61 c5 83 33 02 29 |...x.{....a..3.)| -00000290 c3 66 24 9d 5f bc 03 d9 2a 49 aa 59 51 83 49 72 |.f$._...*I.YQ.Ir| -000002a0 13 be ea 82 5a 5c 09 2f da 23 bc 18 02 42 01 0d |....Z\./.#...B..| -000002b0 a1 15 4d fe 18 ec 90 d5 4e 9a 75 60 05 67 10 5e |..M.....N.u`.g.^| -000002c0 3c 34 00 e8 18 33 8f 90 26 2e d3 a9 81 6c 43 17 |<4...3..&....lC.| -000002d0 80 9e c5 bd 23 c9 24 96 a1 29 23 a4 13 3f ad d2 |....#.$..)#..?..| -000002e0 45 19 0b 56 56 4b c1 f1 cc 70 c8 af 44 ff 34 96 |E..VVK...p..D.4.| -000002f0 14 03 01 00 01 01 16 03 01 00 30 c4 0c 67 53 06 |..........0..gS.| -00000300 49 b3 c9 5c 2e 72 f6 54 ba ad ac a8 80 55 17 01 |I..\.r.T.....U..| -00000310 5c 44 71 7d ad 15 34 95 9a 7f 7b 95 0e 08 70 ce |\Dq}..4...{...p.| -00000320 5a 33 f4 3b 4e 80 06 43 70 93 17 |Z3.;N..Cp..| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 3b ba 6c 73 ec |..........0;.ls.| -00000010 11 5b 44 46 1d bb 31 1b 1b e8 d8 51 4f 95 b0 40 |.[DF..1....QO..@| -00000020 87 49 33 73 40 98 61 1c 94 02 48 9b 80 d3 6c af |.I3s@.a...H...l.| -00000030 e2 31 63 11 a7 c8 db ed 7a a4 4d |.1c.....z.M| ->>> Flow 5 (client to server) -00000000 17 03 01 00 20 2e f7 66 f0 ce 50 d7 38 7a d4 fd |.... ..f..P.8z..| -00000010 e3 66 b1 76 76 59 ad bc b0 0a 75 1d f0 92 6e e3 |.f.vvY....u...n.| -00000020 21 1d 13 dc ad 17 03 01 00 20 f1 b2 0f 3b 26 91 |!........ ...;&.| -00000030 ed ff 9f fc 41 04 7e 47 17 02 af 0c 2b e8 b7 31 |....A.~G....+..1| -00000040 ae 29 71 f9 a8 89 84 f3 e8 da 15 03 01 00 20 1f |.)q........... .| -00000050 26 64 cf 34 c1 48 6b 79 61 e2 77 57 9d 27 14 45 |&d.4.Hkya.wW.'.E| -00000060 46 24 ad 2d 35 57 db 2b 32 03 e2 68 b0 1a 5a |F$.-5W.+2..h..Z| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA deleted file mode 100644 index 0e420a64804d14bf9c24683919ae981eeb4b1eb2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-ECDSA-RSA +++ /dev/null @@ -1,126 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 51 02 00 00 4d 03 01 b7 de 52 5a 07 |....Q...M....RZ.| -00000010 43 b8 72 1d d9 6f 5c a5 70 da ee 27 b7 a9 50 9d |C.r..o\.p..'..P.| -00000020 e7 75 ad 61 a5 2f 69 47 2a d8 2e 20 a8 b0 64 6b |.u.a./iG*.. ..dk| -00000030 4d 25 ec 50 2b 8e a7 9b 0c f9 f5 3c 62 96 a3 53 |M%.P+......>> Flow 3 (client to server) -00000000 16 03 01 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| -00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| -00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| -00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| -00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| -00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| -00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| -00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| -00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| -00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| -000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| -000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| -000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| -000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| -000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| -000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| -00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| -00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| -00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| -00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| -00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| -00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| -00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| -00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| -00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| -00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| -000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| -000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| -000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| -000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| -000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| -000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| -00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 01 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 3e |..........mQ...>| -00000220 fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c 8e |.u.A6..j.*.%.gL.| -00000230 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 1d |b/0......+.#....| -00000240 f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 0d |.;...'..$...[.f.| -00000250 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be c8 |j.....C.........| -00000260 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce e6 |.9L.....K.../...| -00000270 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 f1 |.w.o#......:..V.| -00000280 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 35 |.T^F..;3..(....5| -00000290 d4 1c 43 d1 30 6f 55 4e 0a 70 16 03 01 00 91 0f |..C.0oUN.p......| -000002a0 00 00 8d 00 8b 30 81 88 02 42 00 b5 1a 9d 48 90 |.....0...B....H.| -000002b0 2f d9 1a 04 66 f7 3b 4d d7 ae d9 1e dd 3c fa 24 |/...f.;M.....<.$| -000002c0 0f 24 97 b2 61 46 16 d9 a0 35 f9 f7 54 45 92 fd |.$..aF...5..TE..| -000002d0 10 56 ab 26 d7 b5 10 80 8b 88 95 ef c6 73 1c d2 |.V.&.........s..| -000002e0 ff e9 20 cd 18 a8 40 c4 4d 83 c2 e2 02 42 01 8c |.. ...@.M....B..| -000002f0 d2 13 4c cc e5 38 37 17 6c 83 d6 ad c1 dc af ec |..L..87.l.......| -00000300 8d 06 75 b8 08 ad 56 4a 8f b9 03 59 80 f8 81 d4 |..u...VJ...Y....| -00000310 f3 91 89 eb 9c 27 5d e1 dc 6d ef d6 20 da e7 9c |.....']..m.. ...| -00000320 71 75 cb 2a f9 e4 05 46 c8 85 ca 7b 9c 97 e8 6d |qu.*...F...{...m| -00000330 14 03 01 00 01 01 16 03 01 00 24 9f 67 4e 22 04 |..........$.gN".| -00000340 10 f4 28 55 3e 50 88 90 61 07 42 29 f5 9b f5 32 |..(U>P..a.B)...2| -00000350 16 3d ea c1 8f aa a1 4c b5 72 26 d8 32 cd 50 |.=.....L.r&.2.P| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 24 df 8d f1 07 6d |..........$....m| -00000010 63 39 fc ba b1 67 3b 68 85 b9 37 7d d3 67 19 76 |c9...g;h..7}.g.v| -00000020 34 a4 1b 86 31 bd fe 06 72 00 d8 2b f2 65 3d |4...1...r..+.e=| ->>> Flow 5 (client to server) -00000000 17 03 01 00 1a 60 cc 81 4f 8b 73 b3 7f 34 bf f1 |.....`..O.s..4..| -00000010 7c d8 32 0a ef 2a 26 f9 b8 69 84 83 48 21 ee 15 ||.2..*&..i..H!..| -00000020 03 01 00 16 23 7a 0c 65 3a 66 1a 75 03 e4 85 3f |....#z.e:f.u...?| -00000030 83 cd 55 70 99 f4 44 dc 67 ba |..Up..D.g.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA deleted file mode 100644 index 7e33edc18975e95cc699dc6d98156181d6c255a4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-ECDSA +++ /dev/null @@ -1,129 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 dc a9 22 c2 a2 |....Y...U...."..| -00000010 05 ba c4 66 9a 71 aa 0f 92 6a fc df b0 29 4d 36 |...f.q...j...)M6| -00000020 39 2e f8 39 ed 8e f6 7f 8f 17 13 20 f8 9c f3 3d |9..9....... ...=| -00000030 0a 41 8f 30 c7 5d cd 17 c5 ad 1c 52 45 a3 47 8c |.A.0.].....RE.G.| -00000040 07 4c 48 e1 00 2b 32 38 01 c8 79 b7 c0 09 00 00 |.LH..+28..y.....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 d5 0c 00 00 d1 03 00 17 41 04 89 |*............A..| -00000280 95 9a 90 82 59 ab 29 bf 10 06 8c 6c 0d 67 cf b1 |....Y.)....l.g..| -00000290 66 8b 5e 43 b8 46 56 3a 8d 30 92 35 28 82 f2 38 |f.^C.FV:.0.5(..8| -000002a0 6e 19 5d 37 f0 ab fc 78 15 6a 6a 73 ca dc a6 f2 |n.]7...x.jjs....| -000002b0 68 5d b3 ab 6d 68 44 3b 80 d2 d9 cd 78 0a ed 00 |h]..mhD;....x...| -000002c0 8a 30 81 87 02 42 01 80 63 4a 22 4c 8e 66 4e 25 |.0...B..cJ"L.fN%| -000002d0 e1 86 27 81 de eb b3 a0 c4 dc dc e2 a0 94 2a b6 |..'...........*.| -000002e0 b3 e9 e7 42 e1 1d 1a c0 43 8d a1 d6 8d 77 84 06 |...B....C....w..| -000002f0 ba 95 99 e3 54 80 59 4e 3c fb 0c f3 b7 d3 a8 d2 |....T.YN<.......| -00000300 ce 49 97 fb e2 79 91 93 02 41 2b 2c b7 9f 81 ea |.I...y...A+,....| -00000310 de 17 12 af 4d 20 bc a1 43 1d 60 a0 37 52 a2 7b |....M ..C.`.7R.{| -00000320 a8 4c de fd 1d fe 37 3b 00 23 61 ce d2 80 47 43 |.L....7;.#a...GC| -00000330 b0 3a f3 1f aa c7 07 b1 68 5b d8 f3 03 a9 56 5c |.:......h[....V\| -00000340 63 ef 83 1d 9c 9c 8d 29 81 e9 3b 16 03 01 00 0e |c......)..;.....| -00000350 0d 00 00 06 03 01 02 40 00 00 0e 00 00 00 |.......@......| ->>> Flow 3 (client to server) -00000000 16 03 01 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 01 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000210 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000220 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000230 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000240 a6 b5 68 1a 41 03 56 6b dc 5a 89 16 03 01 00 86 |..h.A.Vk.Z......| -00000250 0f 00 00 82 00 80 0e 80 9c 3a 6e 40 51 09 39 d4 |.........:n@Q.9.| -00000260 40 58 10 da 7f 32 12 08 9e f0 4d 9a d7 20 a2 9c |@X...2....M.. ..| -00000270 b0 95 3a 33 4e f8 b1 a3 74 62 ab 51 7d 23 d4 32 |..:3N...tb.Q}#.2| -00000280 a2 af b8 5a 3b b0 23 e4 7a f1 eb 4d b7 bb 23 d5 |...Z;.#.z..M..#.| -00000290 a9 0d b4 81 d2 b4 45 bd 15 52 ad 58 da 92 a2 c4 |......E..R.X....| -000002a0 30 66 87 f2 ae c5 e4 8c fa ba a0 40 76 b8 3f 72 |0f.........@v.?r| -000002b0 2a d9 95 2a 2d c6 05 3c 1e 2f 11 ef c5 3c 11 e4 |*..*-..<./...<..| -000002c0 be 5a de 37 43 7f 74 52 6e ee 3c 39 cc f1 14 05 |.Z.7C.tRn.<9....| -000002d0 2d 91 c2 3d c4 7c 14 03 01 00 01 01 16 03 01 00 |-..=.|..........| -000002e0 30 cd 3c 92 f8 b9 36 7a e7 8a fb 0f 2f b8 2c 7b |0.<...6z..../.,{| -000002f0 10 59 45 14 0a b0 6a 8c 31 b2 89 5b ac 19 dc 12 |.YE...j.1..[....| -00000300 73 8c 8c 10 49 5a bf 9f bc 58 82 32 11 ba c5 38 |s...IZ...X.2...8| -00000310 ff |.| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 da 45 99 fe 52 |..........0.E..R| -00000010 4f cd d0 e6 30 19 f4 bd 80 6d 5c 8a 72 03 d3 88 |O...0....m\.r...| -00000020 38 63 e9 c9 39 ee ab 3f 52 26 84 b0 4d cb 5c a4 |8c..9..?R&..M.\.| -00000030 0d 51 c7 47 48 43 3a bf 89 c7 13 |.Q.GHC:....| ->>> Flow 5 (client to server) -00000000 17 03 01 00 20 4d d9 1d 0d 3d 8b 73 91 b9 4e 5e |.... M...=.s..N^| -00000010 35 71 4f 67 79 d2 f7 39 35 ea 23 d0 6d 64 de a5 |5qOgy..95.#.md..| -00000020 59 fb 75 1f c9 17 03 01 00 20 ba bd 3c b4 d7 be |Y.u...... ..<...| -00000030 24 64 68 1e 8c b2 bf 6f 78 9f ad 7f fa dd 89 a6 |$dh....ox.......| -00000040 f9 e7 5e 70 db e9 db 3a 62 b2 15 03 01 00 20 2a |..^p...:b..... *| -00000050 82 f4 8b 45 fc 76 35 6c 54 48 62 2f 52 55 f2 d9 |...E.v5lTHb/RU..| -00000060 99 b2 b5 2d 5f a0 05 ab f1 93 58 75 4a 87 35 |...-_.....XuJ.5| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA deleted file mode 100644 index 9b1a5533acf093c6147fb7ff08a8432e62d3e5a0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ClientCert-RSA-RSA +++ /dev/null @@ -1,125 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 51 02 00 00 4d 03 01 90 e6 e1 c6 bd |....Q...M.......| -00000010 86 08 db 33 94 f3 bd 0b 2d fc e0 ba 89 a7 c5 66 |...3....-......f| -00000020 a5 19 78 33 2b b9 c4 22 d8 e0 63 20 2e 85 53 25 |..x3+.."..c ..S%| -00000030 f2 22 e3 ca 79 94 9e 50 00 13 da 9d 21 33 49 27 |."..y..P....!3I'| -00000040 9b 44 c5 10 bc e8 44 01 04 31 02 81 00 05 00 00 |.D....D..1......| -00000050 05 ff 01 00 01 00 16 03 01 02 be 0b 00 02 ba 00 |................| -00000060 02 b7 00 02 b4 30 82 02 b0 30 82 02 19 a0 03 02 |.....0...0......| -00000070 01 02 02 09 00 85 b0 bb a4 8a 7f b8 ca 30 0d 06 |.............0..| -00000080 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 45 31 0b |.*.H........0E1.| -00000090 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 |0...U....AU1.0..| -000000a0 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 |.U....Some-State| -000000b0 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 |1!0...U....Inter| -000000c0 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 |net Widgits Pty | -000000d0 4c 74 64 30 1e 17 0d 31 30 30 34 32 34 30 39 30 |Ltd0...100424090| -000000e0 39 33 38 5a 17 0d 31 31 30 34 32 34 30 39 30 39 |938Z..1104240909| -000000f0 33 38 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 |38Z0E1.0...U....| -00000100 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000110 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000120 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -00000130 74 73 20 50 74 79 20 4c 74 64 30 81 9f 30 0d 06 |ts Pty Ltd0..0..| -00000140 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| -00000150 30 81 89 02 81 81 00 bb 79 d6 f5 17 b5 e5 bf 46 |0.......y......F| -00000160 10 d0 dc 69 be e6 2b 07 43 5a d0 03 2d 8a 7a 43 |...i..+.CZ..-.zC| -00000170 85 b7 14 52 e7 a5 65 4c 2c 78 b8 23 8c b5 b4 82 |...R..eL,x.#....| -00000180 e5 de 1f 95 3b 7e 62 a5 2c a5 33 d6 fe 12 5c 7a |....;~b.,.3...\z| -00000190 56 fc f5 06 bf fa 58 7b 26 3f b5 cd 04 d3 d0 c9 |V.....X{&?......| -000001a0 21 96 4a c7 f4 54 9f 5a bf ef 42 71 00 fe 18 99 |!.J..T.Z..Bq....| -000001b0 07 7f 7e 88 7d 7d f1 04 39 c4 a2 2e db 51 c9 7c |..~.}}..9....Q.|| -000001c0 e3 c0 4c 3b 32 66 01 cf af b1 1d b8 71 9a 1d db |..L;2f......q...| -000001d0 db 89 6b ae da 2d 79 02 03 01 00 01 a3 81 a7 30 |..k..-y........0| -000001e0 81 a4 30 1d 06 03 55 1d 0e 04 16 04 14 b1 ad e2 |..0...U.........| -000001f0 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 88 |.Z..(.i.#i..&...| -00000200 39 30 75 06 03 55 1d 23 04 6e 30 6c 80 14 b1 ad |90u..U.#.n0l....| -00000210 e2 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 |..Z..(.i.#i..&..| -00000220 88 39 a1 49 a4 47 30 45 31 0b 30 09 06 03 55 04 |.9.I.G0E1.0...U.| -00000230 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| -00000240 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| -00000250 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| -00000260 64 67 69 74 73 20 50 74 79 20 4c 74 64 82 09 00 |dgits Pty Ltd...| -00000270 85 b0 bb a4 8a 7f b8 ca 30 0c 06 03 55 1d 13 04 |........0...U...| -00000280 05 30 03 01 01 ff 30 0d 06 09 2a 86 48 86 f7 0d |.0....0...*.H...| -00000290 01 01 05 05 00 03 81 81 00 08 6c 45 24 c7 6b b1 |..........lE$.k.| -000002a0 59 ab 0c 52 cc f2 b0 14 d7 87 9d 7a 64 75 b5 5a |Y..R.......zdu.Z| -000002b0 95 66 e4 c5 2b 8e ae 12 66 1f eb 4f 38 b3 6e 60 |.f..+...f..O8.n`| -000002c0 d3 92 fd f7 41 08 b5 25 13 b1 18 7a 24 fb 30 1d |....A..%...z$.0.| -000002d0 ba ed 98 b9 17 ec e7 d7 31 59 db 95 d3 1d 78 ea |........1Y....x.| -000002e0 50 56 5c d5 82 5a 2d 5a 5f 33 c4 b6 d8 c9 75 90 |PV\..Z-Z_3....u.| -000002f0 96 8c 0f 52 98 b5 cd 98 1f 89 20 5f f2 a0 1c a3 |...R...... _....| -00000300 1b 96 94 dd a9 fd 57 e9 70 e8 26 6d 71 99 9b 26 |......W.p.&mq..&| -00000310 6e 38 50 29 6c 90 a7 bd d9 16 03 01 00 0e 0d 00 |n8P)l...........| -00000320 00 06 03 01 02 40 00 00 0e 00 00 00 |.....@......| ->>> Flow 3 (client to server) -00000000 16 03 01 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 01 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 |...........mQ...| -00000210 3e fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c |>.u.A6..j.*.%.gL| -00000220 8e 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 |.b/0......+.#...| -00000230 1d f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 |..;...'..$...[.f| -00000240 0d 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be |.j.....C........| -00000250 c8 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce |..9L.....K.../..| -00000260 e6 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 |..w.o#......:..V| -00000270 f1 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 |..T^F..;3..(....| -00000280 35 d4 1c 43 d1 30 6f 55 4e 0a 70 16 03 01 00 86 |5..C.0oUN.p.....| -00000290 0f 00 00 82 00 80 10 19 57 14 c3 ee 2d da cb de |........W...-...| -000002a0 f3 70 c5 62 91 2f ad 62 dd 10 f1 65 20 a2 cf d5 |.p.b./.b...e ...| -000002b0 cd 6d 5f e4 b3 3e 38 e8 d0 1a f7 f0 e7 7e b6 5d |.m_..>8......~.]| -000002c0 c3 6c ad f6 0d 05 1e 41 35 2d 04 15 3c 36 96 00 |.l.....A5-..<6..| -000002d0 e8 02 b2 01 b8 9f 21 4b 34 85 ef 5e 4c 87 ef 49 |......!K4..^L..I| -000002e0 df d1 9a b6 b2 bd b8 90 fd 3f 31 93 0c dc c7 18 |.........?1.....| -000002f0 ff f6 76 bd 5b 74 76 b3 62 87 6a df ff 63 15 d5 |..v.[tv.b.j..c..| -00000300 94 d5 fe fd 4c 12 df f1 35 07 f1 8a f1 77 7a 35 |....L...5....wz5| -00000310 cd 99 1d 2a d7 9a 14 03 01 00 01 01 16 03 01 00 |...*............| -00000320 24 8d db 0c 87 b5 df fd 68 de fe 46 3e e4 41 b5 |$.......h..F>.A.| -00000330 19 64 68 3c c4 e2 2b 43 50 e4 ee 52 75 34 d3 c1 |.dh<..+CP..Ru4..| -00000340 51 18 c0 b2 5f |Q..._| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 24 0b a4 04 46 60 |..........$...F`| -00000010 15 fb 9a 9f 47 51 6d b4 4b c6 e7 2a 1b 98 b4 8a |....GQm.K..*....| -00000020 8a 1a 03 cf f4 16 7d 80 70 27 e5 e8 d5 9f ad |......}.p'.....| ->>> Flow 5 (client to server) -00000000 17 03 01 00 1a 6f 84 50 27 c7 f1 aa b0 04 7d 80 |.....o.P'.....}.| -00000010 6d a7 20 8a 73 cf d9 de 9a d6 f5 e9 36 13 7c 15 |m. .s.......6.|.| -00000020 03 01 00 16 e8 0b e0 a6 3b 1e 21 24 65 4e 49 b2 |........;.!$eNI.| -00000030 2d a3 41 2b 98 23 4e d5 4b fd |-.A+.#N.K.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES deleted file mode 100644 index 937c2909f904ab50f75b26fd24ec37905db769fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-ECDSA-AES +++ /dev/null @@ -1,88 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 f5 8f 8d 8e ca |....Y...U.......| -00000010 30 6b fe 63 c9 84 57 c0 f1 c8 a5 d8 10 56 14 62 |0k.c..W......V.b| -00000020 c8 02 b2 89 21 5c 09 67 86 d8 9b 20 dc 3f 55 54 |....!\.g... .?UT| -00000030 33 29 47 45 d3 e0 87 1a 4b 1b 75 30 89 e0 4d 01 |3)GE....K.u0..M.| -00000040 a1 6a 46 f7 8f 23 d6 74 fd 90 2f 53 c0 09 00 00 |.jF..#.t../S....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 01 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 01 00 d5 0c 00 00 d1 03 00 17 41 04 22 |*............A."| -00000280 8a 47 c6 d3 7a c4 30 a4 8e 41 11 ac b3 2d 2f 45 |.G..z.0..A...-/E| -00000290 61 54 9b 1f 2e 03 5d 50 eb fc 5b 44 a0 a7 48 78 |aT....]P..[D..Hx| -000002a0 ce 14 d5 39 a7 c4 ed f5 4d 8f da 9d 71 52 69 70 |...9....M...qRip| -000002b0 7e 52 29 ad 80 8a 19 ad 4c 5d 1c f1 22 7e 1a 00 |~R).....L].."~..| -000002c0 8a 30 81 87 02 42 00 97 8b 6d f7 87 c1 a9 a6 55 |.0...B...m.....U| -000002d0 0f 61 c2 f2 e1 05 26 a8 83 16 1c 0b 69 3b 95 57 |.a....&.....i;.W| -000002e0 76 5b eb 45 7a bd 6a f1 3e a0 93 49 fa 74 32 fd |v[.Ez.j.>..I.t2.| -000002f0 dc 20 3a bb e3 ee 6d b8 56 aa e9 d2 7d 6a ec b7 |. :...m.V...}j..| -00000300 0a bd aa dc d7 b0 69 65 02 41 4d 19 61 16 d8 5f |......ie.AM.a.._| -00000310 1d c1 32 25 15 26 eb 88 5b c1 dd 9a 12 40 fa f1 |..2%.&..[....@..| -00000320 81 5e 7d b8 2b 6e 60 63 1a 9e 86 cb d5 64 96 d4 |.^}.+n`c.....d..| -00000330 75 fc 02 33 e0 66 60 b2 40 47 cf e6 6d 25 9c 83 |u..3.f`.@G..m%..| -00000340 23 d3 4b e2 eb ac f1 56 44 f8 3f 16 03 01 00 04 |#.K....VD.?.....| -00000350 0e 00 00 00 |....| ->>> Flow 3 (client to server) -00000000 16 03 01 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 01 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 01 00 30 cc 86 f1 7e 6e a8 c9 b5 02 5f |.....0...~n...._| -00000060 fb b2 3b ea 74 bf a8 da e4 6a 69 50 a2 5a 78 4f |..;.t....jiP.ZxO| -00000070 35 e1 cc 87 c3 fb 1f 5e f6 a4 5c 63 cc 59 12 3e |5......^..\c.Y.>| -00000080 07 c3 a8 d7 87 ba |......| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 e8 b6 20 b9 c1 |..........0.. ..| -00000010 07 38 38 bb 42 b2 b2 a1 c5 8d 92 62 db 67 ab fc |.88.B......b.g..| -00000020 f6 64 3f 71 83 1d a0 86 bb 2d e3 4f 65 d5 44 52 |.d?q.....-.Oe.DR| -00000030 4d f5 62 80 3c af 95 87 19 7c 20 |M.b.<....| | ->>> Flow 5 (client to server) -00000000 17 03 01 00 20 bd 65 61 28 e5 ea 1b 81 db 75 92 |.... .ea(.....u.| -00000010 ad a7 3b 01 a3 23 0e 3b 60 10 8a 1e 04 91 fb 9e |..;..#.;`.......| -00000020 7a cf 1f cf 9c 17 03 01 00 20 87 9c dc ed 0d 08 |z........ ......| -00000030 56 40 23 8b c5 2c d8 7e 42 82 3c 0a c9 f3 77 6d |V@#..,.~B.<...wm| -00000040 8d 9a 30 d1 9c c4 ae 04 fb b7 15 03 01 00 20 f7 |..0........... .| -00000050 f0 12 0d e5 03 c1 80 4e 7e 21 d7 75 55 1c 91 89 |.......N~!.uU...| -00000060 e7 e1 45 fc 7d d8 fc b1 d0 e7 dc e2 4c ba f4 |..E.}.......L..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES deleted file mode 100644 index f8183f103539129755173db2aaa0eb1e4869bb62..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-ECDHE-RSA-AES +++ /dev/null @@ -1,98 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 59 02 00 00 55 03 01 5c 69 d0 60 d6 |....Y...U..\i.`.| -00000010 b3 f4 23 19 5e 3e 26 d8 29 ea c3 94 e4 ed 51 f6 |..#.^>&.).....Q.| -00000020 58 a2 e3 9c 79 a1 0b 6d 29 90 32 20 23 5b 47 b1 |X...y..m).2 #[G.| -00000030 8f 22 bc 06 aa ee f7 c3 97 ca 93 df b1 90 7d b4 |."............}.| -00000040 8c c0 d9 54 35 ca 5b 11 98 37 84 ea c0 13 00 00 |...T5.[..7......| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 01 02 be 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 |.............0..| -00000070 b0 30 82 02 19 a0 03 02 01 02 02 09 00 85 b0 bb |.0..............| -00000080 a4 8a 7f b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000090 01 05 05 00 30 45 31 0b 30 09 06 03 55 04 06 13 |....0E1.0...U...| -000000a0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| -000000b0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| -000000c0 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| -000000d0 69 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 |its Pty Ltd0...1| -000000e0 30 30 34 32 34 30 39 30 39 33 38 5a 17 0d 31 31 |00424090938Z..11| -000000f0 30 34 32 34 30 39 30 39 33 38 5a 30 45 31 0b 30 |0424090938Z0E1.0| -00000100 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000110 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000120 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000130 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000140 74 64 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |td0..0...*.H....| -00000150 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 bb |........0.......| -00000160 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 |y......F...i..+.| -00000170 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c |CZ..-.zC...R..eL| -00000180 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 |,x.#........;~b.| -00000190 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b |,.3...\zV.....X{| -000001a0 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a |&?......!.J..T.Z| -000001b0 bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 |..Bq......~.}}..| -000001c0 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf |9....Q.|..L;2f..| -000001d0 af b1 1d b8 71 9a 1d db db 89 6b ae da 2d 79 02 |....q.....k..-y.| -000001e0 03 01 00 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d |.......0..0...U.| -000001f0 0e 04 16 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce |.........Z..(.i.| -00000200 23 69 de d3 26 8e 18 88 39 30 75 06 03 55 1d 23 |#i..&...90u..U.#| -00000210 04 6e 30 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 |.n0l......Z..(.i| -00000220 ce 23 69 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 |.#i..&...9.I.G0E| -00000230 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 |1.0...U....AU1.0| -00000240 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 |...U....Some-Sta| -00000250 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 |te1!0...U....Int| -00000260 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 |ernet Widgits Pt| -00000270 79 20 4c 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca |y Ltd...........| -00000280 30 0c 06 03 55 1d 13 04 05 30 03 01 01 ff 30 0d |0...U....0....0.| -00000290 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 81 |..*.H...........| -000002a0 00 08 6c 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 |..lE$.k.Y..R....| -000002b0 d7 87 9d 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 |...zdu.Z.f..+...| -000002c0 66 1f eb 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 |f..O8.n`....A..%| -000002d0 13 b1 18 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 |...z$.0.........| -000002e0 31 59 db 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a |1Y....x.PV\..Z-Z| -000002f0 5f 33 c4 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 |_3....u....R....| -00000300 1f 89 20 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 |.. _..........W.| -00000310 70 e8 26 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd |p.&mq..&n8P)l...| -00000320 d9 16 03 01 00 cb 0c 00 00 c7 03 00 17 41 04 a6 |.............A..| -00000330 57 60 8d 63 4e 4d 3f 48 e0 5d ad 9a 9c f7 e6 8c |W`.cNM?H.]......| -00000340 00 18 9c eb 34 ea f0 5c d5 77 3f af 81 a9 50 d9 |....4..\.w?...P.| -00000350 05 cf b9 bf 88 5c 70 29 24 61 6f d8 77 11 21 57 |.....\p)$ao.w.!W| -00000360 a0 4d e1 4b 8e 55 06 50 7f a2 30 c1 c2 b9 c6 00 |.M.K.U.P..0.....| -00000370 80 68 7c e4 1a bc a4 1e 16 b9 3e 4a 59 39 a9 54 |.h|.......>JY9.T| -00000380 6f c7 17 b2 f5 af b5 73 5b db cc 71 f2 1b aa dc |o......s[..q....| -00000390 9d 64 3c 0f 82 e6 da 1a 6b 96 19 e2 f0 15 b0 df |.d<.....k.......| -000003a0 8a 2d 96 09 63 52 f6 53 ef 12 d4 3b 35 b7 0b 43 |.-..cR.S...;5..C| -000003b0 2c 6e 58 4c c8 2f b8 55 84 89 c9 39 81 7a 7a 7d |,nXL./.U...9.zz}| -000003c0 88 68 db eb d7 81 aa 2e b2 25 ba 98 6c 46 b7 85 |.h.......%..lF..| -000003d0 8a 21 17 b9 36 23 c0 84 94 af 3b 9b 04 5d ec 31 |.!..6#....;..].1| -000003e0 f5 75 84 d8 77 d7 80 37 ae c3 5c 26 41 f6 72 af |.u..w..7..\&A.r.| -000003f0 88 16 03 01 00 04 0e 00 00 00 |..........| ->>> Flow 3 (client to server) -00000000 16 03 01 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 01 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 01 00 30 d2 5b 27 5a f5 64 49 31 d5 aa |.....0.['Z.dI1..| -00000060 a3 72 ae c9 af 0b aa 75 af ac f3 45 f4 e3 03 fa |.r.....u...E....| -00000070 e8 97 88 7b 51 a9 ae 61 40 c8 11 74 3e d8 9a b6 |...{Q..a@..t>...| -00000080 e7 6a 5e 71 84 7e |.j^q.~| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 8d 63 fc 58 2e |..........0.c.X.| -00000010 50 f7 60 2c 9f 5a 8e 58 29 6c a6 3a 8d 2b a7 2b |P.`,.Z.X)l.:.+.+| -00000020 1c 12 8a 53 3f d5 60 79 12 c3 78 e3 aa 50 15 45 |...S?.`y..x..P.E| -00000030 07 da 2d c7 a9 c3 45 07 48 00 78 |..-...E.H.x| ->>> Flow 5 (client to server) -00000000 17 03 01 00 20 40 91 8d e6 95 2f 97 c8 0c 94 5c |.... @..../....\| -00000010 46 a7 d3 31 82 3d dc 7e 86 5b dd df 3f 3b 5b 9c |F..1.=.~.[..?;[.| -00000020 d5 0d 52 5a 53 17 03 01 00 20 1d 18 da 6b e8 66 |..RZS.... ...k.f| -00000030 ce 58 18 81 4b 69 8c f6 db 1a ee d0 78 fb f5 68 |.X..Ki......x..h| -00000040 2c 99 48 47 65 15 2a ae ff 4e 15 03 01 00 20 68 |,.HGe.*..N.... h| -00000050 aa 7f 75 33 45 7a 1a 33 18 35 5a 5b 14 b0 f6 83 |..u3Ez.3.5Z[....| -00000060 97 85 3f b2 dc 78 68 eb 43 ef 92 7f 38 bd f8 |..?..xh.C...8..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 deleted file mode 100644 index b5deaeb011a460f331fbfbb18430174577977a24..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv10-RSA-RC4 +++ /dev/null @@ -1,84 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 01 00 51 02 00 00 4d 03 01 a9 b0 bf 24 3f |....Q...M.....$?| -00000010 98 c6 0f 83 23 2b b6 e4 3f d5 5b 10 9a 6f b8 63 |....#+..?.[..o.c| -00000020 4c 3c d6 4d 05 c0 08 85 f7 72 72 20 ab 85 8c ff |L<.M.....rr ....| -00000030 f7 bb 95 ab 69 37 3d b6 79 cb 46 ad 4e 22 e7 c6 |....i7=.y.F.N"..| -00000040 a5 9b 72 92 32 ff a5 f7 ed dc 30 41 00 05 00 00 |..r.2.....0A....| -00000050 05 ff 01 00 01 00 16 03 01 02 be 0b 00 02 ba 00 |................| -00000060 02 b7 00 02 b4 30 82 02 b0 30 82 02 19 a0 03 02 |.....0...0......| -00000070 01 02 02 09 00 85 b0 bb a4 8a 7f b8 ca 30 0d 06 |.............0..| -00000080 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 45 31 0b |.*.H........0E1.| -00000090 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 |0...U....AU1.0..| -000000a0 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 |.U....Some-State| -000000b0 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 |1!0...U....Inter| -000000c0 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 |net Widgits Pty | -000000d0 4c 74 64 30 1e 17 0d 31 30 30 34 32 34 30 39 30 |Ltd0...100424090| -000000e0 39 33 38 5a 17 0d 31 31 30 34 32 34 30 39 30 39 |938Z..1104240909| -000000f0 33 38 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 |38Z0E1.0...U....| -00000100 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000110 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000120 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -00000130 74 73 20 50 74 79 20 4c 74 64 30 81 9f 30 0d 06 |ts Pty Ltd0..0..| -00000140 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| -00000150 30 81 89 02 81 81 00 bb 79 d6 f5 17 b5 e5 bf 46 |0.......y......F| -00000160 10 d0 dc 69 be e6 2b 07 43 5a d0 03 2d 8a 7a 43 |...i..+.CZ..-.zC| -00000170 85 b7 14 52 e7 a5 65 4c 2c 78 b8 23 8c b5 b4 82 |...R..eL,x.#....| -00000180 e5 de 1f 95 3b 7e 62 a5 2c a5 33 d6 fe 12 5c 7a |....;~b.,.3...\z| -00000190 56 fc f5 06 bf fa 58 7b 26 3f b5 cd 04 d3 d0 c9 |V.....X{&?......| -000001a0 21 96 4a c7 f4 54 9f 5a bf ef 42 71 00 fe 18 99 |!.J..T.Z..Bq....| -000001b0 07 7f 7e 88 7d 7d f1 04 39 c4 a2 2e db 51 c9 7c |..~.}}..9....Q.|| -000001c0 e3 c0 4c 3b 32 66 01 cf af b1 1d b8 71 9a 1d db |..L;2f......q...| -000001d0 db 89 6b ae da 2d 79 02 03 01 00 01 a3 81 a7 30 |..k..-y........0| -000001e0 81 a4 30 1d 06 03 55 1d 0e 04 16 04 14 b1 ad e2 |..0...U.........| -000001f0 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 88 |.Z..(.i.#i..&...| -00000200 39 30 75 06 03 55 1d 23 04 6e 30 6c 80 14 b1 ad |90u..U.#.n0l....| -00000210 e2 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 |..Z..(.i.#i..&..| -00000220 88 39 a1 49 a4 47 30 45 31 0b 30 09 06 03 55 04 |.9.I.G0E1.0...U.| -00000230 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| -00000240 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| -00000250 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| -00000260 64 67 69 74 73 20 50 74 79 20 4c 74 64 82 09 00 |dgits Pty Ltd...| -00000270 85 b0 bb a4 8a 7f b8 ca 30 0c 06 03 55 1d 13 04 |........0...U...| -00000280 05 30 03 01 01 ff 30 0d 06 09 2a 86 48 86 f7 0d |.0....0...*.H...| -00000290 01 01 05 05 00 03 81 81 00 08 6c 45 24 c7 6b b1 |..........lE$.k.| -000002a0 59 ab 0c 52 cc f2 b0 14 d7 87 9d 7a 64 75 b5 5a |Y..R.......zdu.Z| -000002b0 95 66 e4 c5 2b 8e ae 12 66 1f eb 4f 38 b3 6e 60 |.f..+...f..O8.n`| -000002c0 d3 92 fd f7 41 08 b5 25 13 b1 18 7a 24 fb 30 1d |....A..%...z$.0.| -000002d0 ba ed 98 b9 17 ec e7 d7 31 59 db 95 d3 1d 78 ea |........1Y....x.| -000002e0 50 56 5c d5 82 5a 2d 5a 5f 33 c4 b6 d8 c9 75 90 |PV\..Z-Z_3....u.| -000002f0 96 8c 0f 52 98 b5 cd 98 1f 89 20 5f f2 a0 1c a3 |...R...... _....| -00000300 1b 96 94 dd a9 fd 57 e9 70 e8 26 6d 71 99 9b 26 |......W.p.&mq..&| -00000310 6e 38 50 29 6c 90 a7 bd d9 16 03 01 00 04 0e 00 |n8P)l...........| -00000320 00 00 |..| ->>> Flow 3 (client to server) -00000000 16 03 01 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 |...........mQ...| -00000010 3e fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c |>.u.A6..j.*.%.gL| -00000020 8e 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 |.b/0......+.#...| -00000030 1d f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 |..;...'..$...[.f| -00000040 0d 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be |.j.....C........| -00000050 c8 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce |..9L.....K.../..| -00000060 e6 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 |..w.o#......:..V| -00000070 f1 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 |..T^F..;3..(....| -00000080 35 d4 1c 43 d1 30 6f 55 4e 0a 70 14 03 01 00 01 |5..C.0oUN.p.....| -00000090 01 16 03 01 00 24 4d 1d d7 8c d6 c7 65 a6 ce af |.....$M.....e...| -000000a0 e7 59 0d 7e dc d9 96 1c ed 9c 57 94 84 b8 3f b5 |.Y.~......W...?.| -000000b0 34 e1 61 a5 61 f3 5d 09 bc ff |4.a.a.]...| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 24 13 81 89 61 5c |..........$...a\| -00000010 fb 0a 9c a1 4b db 94 6b 8b 41 6e 63 d6 aa db 88 |....K..k.Anc....| -00000020 03 b7 b5 19 b8 12 cf 5e 17 54 79 2f 03 91 7e |.......^.Ty/..~| ->>> Flow 5 (client to server) -00000000 17 03 01 00 1a b3 2b da ce 45 ec b2 9d 3b 18 d9 |......+..E...;..| -00000010 7a cb 99 ea ff 4d 91 b5 48 df 6f 8b 2f 85 c7 15 |z....M..H.o./...| -00000020 03 01 00 16 19 1c 72 74 36 cf 22 0f a0 a7 18 96 |......rt6.".....| -00000030 3a 67 cb 22 16 f1 a8 7b 57 37 |:g."...{W7| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES deleted file mode 100644 index a4a29306cb7ccd3281f87b758ccbf1829fb2a5c1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-ECDSA-AES +++ /dev/null @@ -1,90 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 02 00 59 02 00 00 55 03 02 5a 52 92 23 05 |....Y...U..ZR.#.| -00000010 58 68 b2 1e 77 a2 a8 16 e9 88 85 ea 38 b3 63 c2 |Xh..w.......8.c.| -00000020 40 f8 de 37 3c d4 b9 51 11 2d d1 20 12 fd 95 b3 |@..7<..Q.-. ....| -00000030 2a 54 40 c0 23 3a 4e 4e f6 7b f8 77 04 6e e7 d7 |*T@.#:NN.{.w.n..| -00000040 3b 9a 45 32 e0 af df aa ff bf 78 8b c0 09 00 00 |;.E2......x.....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 02 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 02 00 d5 0c 00 00 d1 03 00 17 41 04 c3 |*............A..| -00000280 55 86 65 95 83 02 4b 69 6e 95 f4 52 46 83 21 86 |U.e...Kin..RF.!.| -00000290 9e 99 cf 81 d9 b8 20 7a 87 b3 07 48 14 04 20 d9 |...... z...H.. .| -000002a0 6c 2e 22 5a b5 b4 ef de 15 b3 08 ef 1e 18 ea 67 |l."Z...........g| -000002b0 eb 45 fd e1 27 43 ed 41 ea 05 7e f3 f9 ee 23 00 |.E..'C.A..~...#.| -000002c0 8a 30 81 87 02 42 00 b0 9c 06 85 83 b2 bf 42 22 |.0...B........B"| -000002d0 6e 57 7a 31 fe a9 d9 28 be 0a a9 80 49 a2 14 c1 |nWz1...(....I...| -000002e0 a9 99 76 b7 f9 76 d0 3c d3 0c c7 42 34 d7 94 a9 |..v..v.<...B4...| -000002f0 15 66 7e 6b 83 6e b2 b4 5b 22 c9 4e a0 96 db 2b |.f~k.n..[".N...+| -00000300 ad 77 33 1e 4a 5c 2f 2e 02 41 26 0c 1a 5a b4 07 |.w3.J\/..A&..Z..| -00000310 95 99 ec 0b 5b 2e bb db 0e d5 26 c4 b3 eb c2 30 |....[.....&....0| -00000320 b0 7b c1 07 97 a0 99 3f db 4e b0 c4 b8 bb 5e be |.{.....?.N....^.| -00000330 2a e4 b3 a4 5c ad d1 d7 7a 2d fb ae 73 ee 0c 1e |*...\...z-..s...| -00000340 3b 64 e1 74 14 bc c0 1e 8b f3 26 16 03 02 00 04 |;d.t......&.....| -00000350 0e 00 00 00 |....| ->>> Flow 3 (client to server) -00000000 16 03 02 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 02 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 |.....@..........| -00000060 00 00 00 00 00 00 33 07 8a af e1 94 ef f9 08 3a |......3........:| -00000070 33 5f b3 e6 42 07 85 af 40 e2 8b 34 53 62 1a 10 |3_..B...@..4Sb..| -00000080 bb 08 7e 75 d4 21 12 2d 54 87 33 1c 4e 13 27 72 |..~u.!.-T.3.N.'r| -00000090 3f 9e 9f cc de 47 |?....G| ->>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 40 4f 47 0d 43 54 |..........@OG.CT| -00000010 50 69 3a c8 21 a6 6e 28 78 cc 01 b4 5d eb f7 2b |Pi:.!.n(x...]..+| -00000020 8b 7e 26 6e cf 56 98 65 ad bf 0f a0 b4 67 13 70 |.~&n.V.e.....g.p| -00000030 de b5 b5 91 df d6 df 8c 53 c6 54 3d 5d 98 e4 25 |........S.T=]..%| -00000040 47 a0 0f 91 c7 08 96 17 48 bd 0f |G.......H..| ->>> Flow 5 (client to server) -00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 4e fe 12 d7 4b d7 3f 86 5a 2c f6 |.....N...K.?.Z,.| -00000020 86 03 2a bd 1a 98 d7 bb 9f 59 6c 6d 4d 57 b0 50 |..*......YlmMW.P| -00000030 d6 97 7e d4 b6 15 03 02 00 30 00 00 00 00 00 00 |..~......0......| -00000040 00 00 00 00 00 00 00 00 00 00 65 8b b5 ae 86 90 |..........e.....| -00000050 00 4e 1e 3f bc ac ed 49 f4 5e 73 49 e6 d8 37 83 |.N.?...I.^sI..7.| -00000060 cf 4f e5 7b 5e c9 1d c8 c9 dc |.O.{^.....| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES deleted file mode 100644 index 103f1d8a11d1d3a3d8c42b3630d8caf3563e3ccf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-ECDHE-RSA-AES +++ /dev/null @@ -1,100 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 02 00 59 02 00 00 55 03 02 e3 ed 49 27 a3 |....Y...U....I'.| -00000010 28 c5 8c 30 27 c2 ed 57 9b f7 37 a1 6d 2b 88 c2 |(..0'..W..7.m+..| -00000020 df a7 2d 01 01 00 9a 09 da c2 1f 20 ee 33 87 03 |..-........ .3..| -00000030 28 93 1c 16 99 5b b1 e0 bf 87 e8 77 4a 72 c9 92 |(....[.....wJr..| -00000040 8a bc b2 3e 24 e1 f6 e8 f4 3f a2 24 c0 13 00 00 |...>$....?.$....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 02 02 be 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 |.............0..| -00000070 b0 30 82 02 19 a0 03 02 01 02 02 09 00 85 b0 bb |.0..............| -00000080 a4 8a 7f b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000090 01 05 05 00 30 45 31 0b 30 09 06 03 55 04 06 13 |....0E1.0...U...| -000000a0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| -000000b0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| -000000c0 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| -000000d0 69 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 |its Pty Ltd0...1| -000000e0 30 30 34 32 34 30 39 30 39 33 38 5a 17 0d 31 31 |00424090938Z..11| -000000f0 30 34 32 34 30 39 30 39 33 38 5a 30 45 31 0b 30 |0424090938Z0E1.0| -00000100 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000110 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000120 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000130 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000140 74 64 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |td0..0...*.H....| -00000150 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 bb |........0.......| -00000160 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 |y......F...i..+.| -00000170 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c |CZ..-.zC...R..eL| -00000180 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 |,x.#........;~b.| -00000190 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b |,.3...\zV.....X{| -000001a0 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a |&?......!.J..T.Z| -000001b0 bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 |..Bq......~.}}..| -000001c0 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf |9....Q.|..L;2f..| -000001d0 af b1 1d b8 71 9a 1d db db 89 6b ae da 2d 79 02 |....q.....k..-y.| -000001e0 03 01 00 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d |.......0..0...U.| -000001f0 0e 04 16 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce |.........Z..(.i.| -00000200 23 69 de d3 26 8e 18 88 39 30 75 06 03 55 1d 23 |#i..&...90u..U.#| -00000210 04 6e 30 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 |.n0l......Z..(.i| -00000220 ce 23 69 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 |.#i..&...9.I.G0E| -00000230 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 |1.0...U....AU1.0| -00000240 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 |...U....Some-Sta| -00000250 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 |te1!0...U....Int| -00000260 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 |ernet Widgits Pt| -00000270 79 20 4c 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca |y Ltd...........| -00000280 30 0c 06 03 55 1d 13 04 05 30 03 01 01 ff 30 0d |0...U....0....0.| -00000290 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 81 |..*.H...........| -000002a0 00 08 6c 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 |..lE$.k.Y..R....| -000002b0 d7 87 9d 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 |...zdu.Z.f..+...| -000002c0 66 1f eb 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 |f..O8.n`....A..%| -000002d0 13 b1 18 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 |...z$.0.........| -000002e0 31 59 db 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a |1Y....x.PV\..Z-Z| -000002f0 5f 33 c4 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 |_3....u....R....| -00000300 1f 89 20 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 |.. _..........W.| -00000310 70 e8 26 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd |p.&mq..&n8P)l...| -00000320 d9 16 03 02 00 cb 0c 00 00 c7 03 00 17 41 04 f7 |.............A..| -00000330 75 c1 b9 58 a0 7d 50 48 e9 85 79 db 89 76 4c d7 |u..X.}PH..y..vL.| -00000340 84 5b 94 9a 15 d8 92 32 74 d2 3e ce 76 5a bd 0e |.[.....2t.>.vZ..| -00000350 24 e7 a6 d0 77 5d 8e 3d 9f 94 7a ea 15 46 3c 5c |$...w].=..z..F<\| -00000360 61 28 76 4a ff 81 97 2b 3a 0c b7 aa b4 0e cb 00 |a(vJ...+:.......| -00000370 80 19 00 a8 fe 0a ea 35 30 51 a3 77 37 08 68 10 |.......50Q.w7.h.| -00000380 5a e9 07 2d 83 67 77 4c 3a 25 14 1c 5b c1 2e 80 |Z..-.gwL:%..[...| -00000390 30 6d ba 26 c1 f9 c6 3e fc 55 34 8c d2 9f 2b a6 |0m.&...>.U4...+.| -000003a0 46 0c 9d 58 2c 9c 2b ce 6f 03 d7 49 4e df 21 ce |F..X,.+.o..IN.!.| -000003b0 3f 8b 19 fe 3e 71 23 51 c3 ec 30 c8 3e 3c 3c 50 |?...>q#Q..0.><>> Flow 3 (client to server) -00000000 16 03 02 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 02 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 02 00 40 00 00 00 00 00 00 00 00 00 00 |.....@..........| -00000060 00 00 00 00 00 00 1e 0b cd 40 fa 0f ed fa 55 74 |.........@....Ut| -00000070 4e ad 10 d1 b5 e1 41 8c c0 93 81 38 f3 83 f1 37 |N.....A....8...7| -00000080 6a d4 6c ea ba 5b 9e 38 d3 c1 bb 41 45 fb f0 48 |j.l..[.8...AE..H| -00000090 c1 06 31 64 e0 65 |..1d.e| ->>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 40 17 d1 79 f8 e0 |..........@..y..| -00000010 d4 40 15 85 df 4d a6 d5 60 90 1f d6 52 58 e7 ae |.@...M..`...RX..| -00000020 05 eb a2 ea ed c9 be ae b5 54 39 de 05 66 27 67 |.........T9..f'g| -00000030 59 07 03 e7 10 f9 3f da d8 85 8b 2f 7b 33 9f f5 |Y.....?..../{3..| -00000040 43 50 b9 9c 6e dd 01 ae d8 c9 1d |CP..n......| ->>> Flow 5 (client to server) -00000000 17 03 02 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 65 81 63 71 55 1c 46 8a 60 46 d9 |.....e.cqU.F.`F.| -00000020 7d 71 a2 62 b8 a8 3b 06 3d a2 f4 53 a4 46 a8 9e |}q.b..;.=..S.F..| -00000030 b7 89 8a 42 ce 15 03 02 00 30 00 00 00 00 00 00 |...B.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 7a 78 a4 e7 2f 40 |..........zx../@| -00000050 df 42 9b 76 7a 45 0a 86 40 af 3c 40 c6 69 ba e1 |.B.vzE..@.<@.i..| -00000060 23 82 fa 44 fd 73 fc 5b f7 b9 |#..D.s.[..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 deleted file mode 100644 index 729391f68ca4945720fa9e49d84b6ff4972ec85a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv11-RSA-RC4 +++ /dev/null @@ -1,84 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 02 00 51 02 00 00 4d 03 02 7e 38 ae 3c 50 |....Q...M..~8.>> Flow 3 (client to server) -00000000 16 03 02 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 |...........mQ...| -00000010 3e fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c |>.u.A6..j.*.%.gL| -00000020 8e 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 |.b/0......+.#...| -00000030 1d f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 |..;...'..$...[.f| -00000040 0d 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be |.j.....C........| -00000050 c8 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce |..9L.....K.../..| -00000060 e6 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 |..w.o#......:..V| -00000070 f1 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 |..T^F..;3..(....| -00000080 35 d4 1c 43 d1 30 6f 55 4e 0a 70 14 03 02 00 01 |5..C.0oUN.p.....| -00000090 01 16 03 02 00 24 b9 df 85 a1 6d a7 14 b5 bc f5 |.....$....m.....| -000000a0 c2 1d 40 fc 1e 19 f2 36 2d ec 6b 59 c5 6d ae c7 |..@....6-.kY.m..| -000000b0 1c ad 7e a3 5b 4d 12 e5 58 5a |..~.[M..XZ| ->>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 24 a3 f3 22 a8 32 |..........$..".2| -00000010 63 c3 88 5c 0f fb 2d 47 21 0d 62 e2 db aa ed ae |c..\..-G!.b.....| -00000020 b6 5f e3 c8 98 fc 91 5e 04 83 cf c3 21 17 ce |._.....^....!..| ->>> Flow 5 (client to server) -00000000 17 03 02 00 1a f1 e4 46 c7 14 91 4b c6 25 fd aa |.......F...K.%..| -00000010 5d dd 3f 61 ac 9c 79 68 bc e6 0f a1 e4 f3 73 15 |].?a..yh......s.| -00000020 03 02 00 16 6b 8d 23 3c 99 b4 c2 23 3c 27 fd 41 |....k.#<...#<'.A| -00000030 cc 04 e5 fc e7 f9 d9 81 0a b8 |..........| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN deleted file mode 100644 index 9ecb065f09218b7d53f832181b4a78954712e016..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN +++ /dev/null @@ -1,97 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 99 01 00 00 95 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 4e |...../.5.......N| -00000050 33 74 00 00 00 05 00 05 01 00 00 00 00 00 0a 00 |3t..............| -00000060 08 00 06 00 17 00 18 00 19 00 0b 00 02 01 00 00 |................| -00000070 0d 00 0e 00 0c 04 01 04 03 05 01 05 03 02 01 02 |................| -00000080 03 ff 01 00 01 00 00 10 00 10 00 0e 06 70 72 6f |.............pro| -00000090 74 6f 32 06 70 72 6f 74 6f 31 00 12 00 00 |to2.proto1....| ->>> Flow 2 (server to client) -00000000 16 03 03 00 66 02 00 00 62 03 03 56 83 34 0f 9e |....f...b..V.4..| -00000010 dd 02 1c 4f 4f 09 d0 2c df e6 c1 d2 4a c0 6a e7 |...OO..,....J.j.| -00000020 1e 65 51 c2 42 01 05 70 4a 6c 97 20 0f a8 fb d8 |.eQ.B..pJl. ....| -00000030 2f 0f 75 21 17 f8 dd 63 28 4a 18 f6 b1 e5 6f 7c |/.u!...c(J....o|| -00000040 1d 09 d4 13 bf 66 3a bd c5 48 14 fc c0 2f 00 00 |.....f:..H.../..| -00000050 1a ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 10 |................| -00000060 00 09 00 07 06 70 72 6f 74 6f 31 16 03 03 02 be |.....proto1.....| -00000070 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 b0 30 82 |..........0...0.| -00000080 02 19 a0 03 02 01 02 02 09 00 85 b0 bb a4 8a 7f |................| -00000090 b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 |..0...*.H.......| -000000a0 00 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 |.0E1.0...U....AU| -000000b0 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d |1.0...U....Some-| -000000c0 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 |State1!0...U....| -000000d0 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 |Internet Widgits| -000000e0 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 30 30 34 | Pty Ltd0...1004| -000000f0 32 34 30 39 30 39 33 38 5a 17 0d 31 31 30 34 32 |24090938Z..11042| -00000100 34 30 39 30 39 33 38 5a 30 45 31 0b 30 09 06 03 |4090938Z0E1.0...| -00000110 55 04 06 13 02 41 55 31 13 30 11 06 03 55 04 08 |U....AU1.0...U..| -00000120 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f |..Some-State1!0.| -00000130 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 |..U....Internet | -00000140 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 |Widgits Pty Ltd0| -00000150 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| -00000160 00 03 81 8d 00 30 81 89 02 81 81 00 bb 79 d6 f5 |.....0.......y..| -00000170 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 43 5a d0 |....F...i..+.CZ.| -00000180 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c 2c 78 b8 |.-.zC...R..eL,x.| -00000190 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 2c a5 33 |#........;~b.,.3| -000001a0 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b 26 3f b5 |...\zV.....X{&?.| -000001b0 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a bf ef 42 |.....!.J..T.Z..B| -000001c0 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 39 c4 a2 |q......~.}}..9..| -000001d0 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf af b1 1d |..Q.|..L;2f.....| -000001e0 b8 71 9a 1d db db 89 6b ae da 2d 79 02 03 01 00 |.q.....k..-y....| -000001f0 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d 0e 04 16 |....0..0...U....| -00000200 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce 23 69 de |......Z..(.i.#i.| -00000210 d3 26 8e 18 88 39 30 75 06 03 55 1d 23 04 6e 30 |.&...90u..U.#.n0| -00000220 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 ce 23 69 |l......Z..(.i.#i| -00000230 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 31 0b 30 |..&...9.I.G0E1.0| -00000240 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000250 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000260 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000270 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000280 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca 30 0c 06 |td...........0..| -00000290 03 55 1d 13 04 05 30 03 01 01 ff 30 0d 06 09 2a |.U....0....0...*| -000002a0 86 48 86 f7 0d 01 01 05 05 00 03 81 81 00 08 6c |.H.............l| -000002b0 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 d7 87 9d |E$.k.Y..R.......| -000002c0 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 66 1f eb |zdu.Z.f..+...f..| -000002d0 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 13 b1 18 |O8.n`....A..%...| -000002e0 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 31 59 db |z$.0.........1Y.| -000002f0 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a 5f 33 c4 |...x.PV\..Z-Z_3.| -00000300 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 1f 89 20 |...u....R...... | -00000310 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 70 e8 26 |_..........W.p.&| -00000320 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd d9 16 03 |mq..&n8P)l......| -00000330 03 00 cd 0c 00 00 c9 03 00 17 41 04 85 b7 f7 7c |..........A....|| -00000340 49 4e 97 14 07 51 bc 56 2d 3f cf 1d 29 08 ac 6a |IN...Q.V-?..)..j| -00000350 b4 e7 0d 62 d8 fd 4d 03 29 0d f8 6c 36 6f 4d 5f |...b..M.)..l6oM_| -00000360 b7 5a 8e 37 3e c2 d9 dc f4 15 52 e9 87 71 0f e5 |.Z.7>.....R..q..| -00000370 4e a6 88 0e 54 35 e0 8b 50 91 e1 c4 04 01 00 80 |N...T5..P.......| -00000380 51 eb f8 d6 52 ba f5 b5 0a 22 5f 91 fe f7 ee 43 |Q...R...."_....C| -00000390 f8 af 52 b6 27 2c fc 14 e2 fb 41 61 ff 7c b9 be |..R.',....Aa.|..| -000003a0 f9 78 be dc 18 32 8c 4d ef 46 c0 5a a7 91 6a 1b |.x...2.M.F.Z..j.| -000003b0 47 78 46 39 47 81 8a 2d b4 cb fd bb 44 3e a7 b7 |GxF9G..-....D>..| -000003c0 cc 4e df 17 7b 2b 38 49 fa 9d 9f 4e cd ed f2 16 |.N..{+8I...N....| -000003d0 03 d9 68 cf c9 5a 08 32 f8 ed 02 30 54 61 f6 c0 |..h..Z.2...0Ta..| -000003e0 f6 78 bc ad 04 9c 8e 90 7d 3d f5 35 86 aa 6e e9 |.x......}=.5..n.| -000003f0 a2 9a d3 86 27 9f 2d 6e ea 6e ad 82 0e aa ef 97 |....'.-n.n......| -00000400 16 03 03 00 04 0e 00 00 00 |.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 47 18 |.....(........G.| -00000060 39 03 93 d9 5b 27 29 70 52 68 15 79 f2 60 e6 58 |9...[')pRh.y.`.X| -00000070 d9 98 cd ce a1 8f 4d ee 2c f0 34 9f fa 73 |......M.,.4..s| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 39 76 15 70 f1 |..........(9v.p.| -00000010 73 c9 9a 1e 76 40 bc de de 49 be 3e 10 4d 6a 42 |s...v@...I.>.MjB| -00000020 1b 9b bd 07 6b 19 ff f9 2c 19 3c c8 e7 06 fa c8 |....k...,.<.....| -00000030 3d 52 b4 |=R.| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 14 96 ec |................| -00000010 f4 bb ae 45 81 0c 39 10 e2 3a 91 51 04 2c 01 a8 |...E..9..:.Q.,..| -00000020 8b a3 25 15 03 03 00 1a 00 00 00 00 00 00 00 02 |..%.............| -00000030 fe 1a 53 01 17 ad a1 30 0a 73 17 9f 39 b4 30 ac |..S....0.s..9.0.| -00000040 91 ee |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch deleted file mode 100644 index a22ffaeb499ab6c9d2774ac19420947c35f1d851..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ALPN-NoMatch +++ /dev/null @@ -1,96 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 92 01 00 00 8e 03 03 00 00 00 00 00 |................| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 47 |...../.5.......G| -00000050 33 74 00 00 00 05 00 05 01 00 00 00 00 00 0a 00 |3t..............| -00000060 08 00 06 00 17 00 18 00 19 00 0b 00 02 01 00 00 |................| -00000070 0d 00 0e 00 0c 04 01 04 03 05 01 05 03 02 01 02 |................| -00000080 03 ff 01 00 01 00 00 10 00 09 00 07 06 70 72 6f |.............pro| -00000090 74 6f 33 00 12 00 00 |to3....| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 94 d7 79 73 82 |....Y...U....ys.| -00000010 87 7c 85 6e 8a 1b 7d bf 69 c9 98 0c 44 bd f6 78 |.|.n..}.i...D..x| -00000020 d2 80 dc d8 7d 80 bb 91 4b d4 ed 20 fe 9f 2f 7b |....}...K.. ../{| -00000030 f2 1a 44 36 cd ce af f1 b5 01 8a ac 18 e4 2b 23 |..D6..........+#| -00000040 a8 ab 1a 32 23 8b 0b e2 81 a8 0a 40 c0 2f 00 00 |...2#......@./..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 be 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 |.............0..| -00000070 b0 30 82 02 19 a0 03 02 01 02 02 09 00 85 b0 bb |.0..............| -00000080 a4 8a 7f b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000090 01 05 05 00 30 45 31 0b 30 09 06 03 55 04 06 13 |....0E1.0...U...| -000000a0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| -000000b0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| -000000c0 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| -000000d0 69 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 |its Pty Ltd0...1| -000000e0 30 30 34 32 34 30 39 30 39 33 38 5a 17 0d 31 31 |00424090938Z..11| -000000f0 30 34 32 34 30 39 30 39 33 38 5a 30 45 31 0b 30 |0424090938Z0E1.0| -00000100 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000110 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000120 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000130 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000140 74 64 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |td0..0...*.H....| -00000150 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 bb |........0.......| -00000160 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 |y......F...i..+.| -00000170 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c |CZ..-.zC...R..eL| -00000180 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 |,x.#........;~b.| -00000190 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b |,.3...\zV.....X{| -000001a0 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a |&?......!.J..T.Z| -000001b0 bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 |..Bq......~.}}..| -000001c0 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf |9....Q.|..L;2f..| -000001d0 af b1 1d b8 71 9a 1d db db 89 6b ae da 2d 79 02 |....q.....k..-y.| -000001e0 03 01 00 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d |.......0..0...U.| -000001f0 0e 04 16 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce |.........Z..(.i.| -00000200 23 69 de d3 26 8e 18 88 39 30 75 06 03 55 1d 23 |#i..&...90u..U.#| -00000210 04 6e 30 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 |.n0l......Z..(.i| -00000220 ce 23 69 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 |.#i..&...9.I.G0E| -00000230 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 |1.0...U....AU1.0| -00000240 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 |...U....Some-Sta| -00000250 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 |te1!0...U....Int| -00000260 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 |ernet Widgits Pt| -00000270 79 20 4c 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca |y Ltd...........| -00000280 30 0c 06 03 55 1d 13 04 05 30 03 01 01 ff 30 0d |0...U....0....0.| -00000290 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 81 |..*.H...........| -000002a0 00 08 6c 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 |..lE$.k.Y..R....| -000002b0 d7 87 9d 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 |...zdu.Z.f..+...| -000002c0 66 1f eb 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 |f..O8.n`....A..%| -000002d0 13 b1 18 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 |...z$.0.........| -000002e0 31 59 db 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a |1Y....x.PV\..Z-Z| -000002f0 5f 33 c4 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 |_3....u....R....| -00000300 1f 89 20 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 |.. _..........W.| -00000310 70 e8 26 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd |p.&mq..&n8P)l...| -00000320 d9 16 03 03 00 cd 0c 00 00 c9 03 00 17 41 04 7d |.............A.}| -00000330 75 a5 53 0b a5 4d a6 81 e0 df c4 11 c9 b5 31 ba |u.S..M........1.| -00000340 9f 7b 51 04 57 c6 e0 b9 b0 bc 4f bc 71 74 8a 2e |.{Q.W.....O.qt..| -00000350 d1 f6 39 36 94 4e c7 d3 a7 1b 2c b5 55 04 71 01 |..96.N....,.U.q.| -00000360 9e 2b 42 1e 8b a4 40 b2 13 4f 03 1f 51 9e 5c 04 |.+B...@..O..Q.\.| -00000370 01 00 80 68 05 c7 4a ca df 00 85 2b 53 f7 4f c3 |...h..J....+S.O.| -00000380 b4 0f e8 f7 b8 30 b7 36 56 65 7b 03 6a 72 f1 aa |.....0.6Ve{.jr..| -00000390 54 30 90 9e c7 dc fc 03 96 15 70 67 13 12 a4 f4 |T0........pg....| -000003a0 42 f0 f9 a1 48 c0 44 44 77 0e ea fd cb b5 6e 19 |B...H.DDw.....n.| -000003b0 89 94 a7 12 67 87 47 19 c3 00 2d c4 9b d4 dc 66 |....g.G...-....f| -000003c0 fa ca d7 97 79 9b 28 7f 74 d4 37 c0 06 63 d4 9e |....y.(.t.7..c..| -000003d0 a1 53 16 5a 8e d7 a5 cc 90 4d 63 f9 0c 18 85 7f |.S.Z.....Mc.....| -000003e0 0e 35 3a 49 73 88 82 51 41 e5 2d 58 aa 38 3e bd |.5:Is..QA.-X.8>.| -000003f0 3d d8 da 16 03 03 00 04 0e 00 00 00 |=...........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 a8 da |.....(..........| -00000060 74 a6 d0 a5 26 86 f3 5f 89 a4 af ac 9c 1a 01 1f |t...&.._........| -00000070 89 8a 1c fc cf 68 3e a5 a3 20 1a b3 78 af |.....h>.. ..x.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 1a f2 a9 e8 71 |..........(....q| -00000010 b2 a6 ca 36 4a ea 55 f6 20 03 fd f7 90 c3 af 30 |...6J.U. ......0| -00000020 d3 29 c3 d7 1b d6 4d 3e 61 55 94 0d 4e 3e 83 1a |.)....M>aU..N>..| -00000030 97 dd 19 |...| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 94 5b 5e |..............[^| -00000010 51 a1 52 ee 19 78 78 ef 12 0d 9c 66 bf e2 48 cb |Q.R..xx....f..H.| -00000020 f6 00 1e 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| -00000030 cd 5d 31 58 d9 5a 12 65 5b c6 7e 4e e2 04 e7 1d |.]1X.Z.e[.~N....| -00000040 b1 4c |.L| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA deleted file mode 100644 index 1470ba7a2500e189c64522c4a244b8ec96663434..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-ECDSA +++ /dev/null @@ -1,134 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 a5 28 60 99 bf |....Y...U...(`..| -00000010 c7 54 04 87 60 ad c5 32 f6 bf ed 11 47 de 4d ff |.T..`..2....G.M.| -00000020 99 e1 8f 88 f6 af 10 6e 29 74 0a 20 1d 39 cb e0 |.......n)t. .9..| -00000030 a5 11 fe 8e 23 11 83 c7 a6 53 fc 97 03 9d ff 7c |....#....S.....|| -00000040 cf 51 ba 41 64 61 38 22 5c c6 4a 04 c0 09 00 00 |.Q.Ada8"\.J.....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 d7 0c 00 00 d3 03 00 17 41 04 c4 |*............A..| -00000280 0a 40 05 84 eb 90 3c 13 d0 90 af 69 fa 5c 20 75 |.@....<....i.\ u| -00000290 e1 9b f2 30 f7 df cc 75 2c 35 7e 38 16 99 7d 57 |...0...u,5~8..}W| -000002a0 6d d7 f0 93 2d 1d c8 03 89 6e 52 3b 20 e5 8a 5f |m...-....nR; .._| -000002b0 6d ca 6e 6a ca 51 f8 a4 dc 1d ec 3e 73 c9 72 04 |m.nj.Q.....>s.r.| -000002c0 03 00 8a 30 81 87 02 41 37 bf 0d 1d c1 9a 37 39 |...0...A7.....79| -000002d0 4d 4a f8 17 50 5d 4c 78 d4 25 99 9d 81 48 98 a8 |MJ..P]Lx.%...H..| -000002e0 ff 2d 3f 98 4b 9f d8 96 2b fa 37 cc e8 66 25 0e |.-?.K...+.7..f%.| -000002f0 d3 5e 53 c5 3b ad 17 3f 21 ce d2 45 d8 93 95 6c |.^S.;..?!..E...l| -00000300 25 f9 5a 10 9f 37 c8 14 a6 02 42 00 e6 bd 9a 89 |%.Z..7....B.....| -00000310 8e 73 40 f4 90 e6 d8 e2 98 51 10 23 fb 98 e5 47 |.s@......Q.#...G| -00000320 0c 2a 7a 2f 02 66 a8 20 e4 cb 4f ba 14 1d 9e 3a |.*z/.f. ..O....:| -00000330 2f 09 47 44 02 e0 9f 30 21 71 f0 99 09 de 23 d2 |/.GD...0!q....#.| -00000340 f5 f0 b2 93 70 a3 8f 79 b9 4f 88 0b 35 16 03 03 |....p..y.O..5...| -00000350 00 2e 0d 00 00 26 03 01 02 40 00 1e 06 01 06 02 |.....&...@......| -00000360 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000370 03 02 03 03 02 01 02 02 02 03 00 00 0e 00 00 00 |................| ->>> Flow 3 (client to server) -00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| -00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| -00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| -00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| -00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| -00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| -00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| -00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| -00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| -00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| -000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| -000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| -000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| -000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| -000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| -000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| -00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| -00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| -00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| -00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| -00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| -00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| -00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| -00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| -00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| -00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| -000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| -000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| -000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| -000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| -000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| -000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| -00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d 19 |...F...BA...7...| -00000220 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| -00000230 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| -00000240 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| -00000250 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 92 0f |.h.A.Vk.Z.......| -00000260 00 00 8e 05 03 00 8a 30 81 87 02 42 00 cc a4 ad |.......0...B....| -00000270 0b ff 09 40 8f 2c a6 37 72 1d f7 d2 19 74 85 ad |...@.,.7r....t..| -00000280 ac 33 b0 b8 5b 56 39 cf b0 ef 46 68 94 39 4c d0 |.3..[V9...Fh.9L.| -00000290 f4 97 32 10 99 36 c5 95 c8 14 23 37 78 46 5c a9 |..2..6....#7xF\.| -000002a0 20 95 65 47 ff 54 02 f1 aa 1d d7 bc 39 2d 02 41 | .eG.T......9-.A| -000002b0 2e f9 d6 8c e8 c5 a9 6f 10 4f d6 5f 4e 88 e9 71 |.......o.O._N..q| -000002c0 23 5b 6f b8 ab 19 d3 dd ec f3 32 e3 3b fa 41 a2 |#[o.......2.;.A.| -000002d0 e8 ae dc 27 8d 4e 79 f4 47 ef c9 8f bf 0b 41 3b |...'.Ny.G.....A;| -000002e0 94 16 cb 8f 1e b5 f3 4e 6e 42 46 35 1a 0c ca 79 |.......NnBF5...y| -000002f0 4b 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 |K..........@....| -00000300 00 00 00 00 00 00 00 00 00 00 00 00 64 1c d9 9f |............d...| -00000310 34 ec c2 74 76 7a 9f cf 95 19 be 8d 6a 2f 25 96 |4..tvz......j/%.| -00000320 df de 18 ca 0e c9 d4 2f e4 b0 34 10 5b 72 7a 18 |......./..4.[rz.| -00000330 5c 64 d7 fc 2e 1b 28 10 ae a6 31 e9 |\d....(...1.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 27 6f 24 a3 0c |..........@'o$..| -00000010 6d d7 68 4a fb 43 b0 97 02 6c 22 7e 2f a1 f1 7a |m.hJ.C...l"~/..z| -00000020 37 bf 38 82 dc a0 83 24 01 4b c0 4f 15 e1 7c 4c |7.8....$.K.O..|L| -00000030 d4 cd b8 e2 71 af f5 20 7d f9 4a 48 4b f0 a1 f3 |....q.. }.JHK...| -00000040 7b 02 29 18 c0 87 a5 dd c4 73 8e |{.)......s.| ->>> Flow 5 (client to server) -00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 bf 7a e1 23 0d d0 13 6e 96 81 6d |......z.#...n..m| -00000020 32 56 0f 75 7e 01 88 5f 6d e6 d6 ca ec 3c 17 e9 |2V.u~.._m....<..| -00000030 44 a9 c0 1c a4 15 03 03 00 30 00 00 00 00 00 00 |D........0......| -00000040 00 00 00 00 00 00 00 00 00 00 76 be 7a 77 29 01 |..........v.zw).| -00000050 8e 13 02 66 81 43 a0 55 03 35 22 09 de ea 52 bb |...f.C.U.5"...R.| -00000060 51 cc c1 09 0e 9b 4d bd 94 85 |Q.....M...| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA deleted file mode 100644 index 95c5782ab0d88deda7c7bd5380c5665d021e75d3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-ECDSA-RSA +++ /dev/null @@ -1,128 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 79 e8 35 e3 d2 |....Q...M..y.5..| -00000010 c0 5e 39 d1 46 da 9c 94 56 20 e2 06 d6 9b f6 dd |.^9.F...V ......| -00000020 4f 7a c1 e8 34 a1 9f 8b c2 e1 fb 20 66 9c 5a 9a |Oz..4...... f.Z.| -00000030 3d 22 ab 8e d8 81 03 94 68 a0 6c 72 d8 23 0b 4b |="......h.lr.#.K| -00000040 fe 9d c7 49 a7 7c bd fa b5 7a 5e 5b 00 05 00 00 |...I.|...z^[....| -00000050 05 ff 01 00 01 00 16 03 03 02 be 0b 00 02 ba 00 |................| -00000060 02 b7 00 02 b4 30 82 02 b0 30 82 02 19 a0 03 02 |.....0...0......| -00000070 01 02 02 09 00 85 b0 bb a4 8a 7f b8 ca 30 0d 06 |.............0..| -00000080 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 45 31 0b |.*.H........0E1.| -00000090 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 |0...U....AU1.0..| -000000a0 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 |.U....Some-State| -000000b0 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 |1!0...U....Inter| -000000c0 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 |net Widgits Pty | -000000d0 4c 74 64 30 1e 17 0d 31 30 30 34 32 34 30 39 30 |Ltd0...100424090| -000000e0 39 33 38 5a 17 0d 31 31 30 34 32 34 30 39 30 39 |938Z..1104240909| -000000f0 33 38 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 |38Z0E1.0...U....| -00000100 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000110 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000120 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -00000130 74 73 20 50 74 79 20 4c 74 64 30 81 9f 30 0d 06 |ts Pty Ltd0..0..| -00000140 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| -00000150 30 81 89 02 81 81 00 bb 79 d6 f5 17 b5 e5 bf 46 |0.......y......F| -00000160 10 d0 dc 69 be e6 2b 07 43 5a d0 03 2d 8a 7a 43 |...i..+.CZ..-.zC| -00000170 85 b7 14 52 e7 a5 65 4c 2c 78 b8 23 8c b5 b4 82 |...R..eL,x.#....| -00000180 e5 de 1f 95 3b 7e 62 a5 2c a5 33 d6 fe 12 5c 7a |....;~b.,.3...\z| -00000190 56 fc f5 06 bf fa 58 7b 26 3f b5 cd 04 d3 d0 c9 |V.....X{&?......| -000001a0 21 96 4a c7 f4 54 9f 5a bf ef 42 71 00 fe 18 99 |!.J..T.Z..Bq....| -000001b0 07 7f 7e 88 7d 7d f1 04 39 c4 a2 2e db 51 c9 7c |..~.}}..9....Q.|| -000001c0 e3 c0 4c 3b 32 66 01 cf af b1 1d b8 71 9a 1d db |..L;2f......q...| -000001d0 db 89 6b ae da 2d 79 02 03 01 00 01 a3 81 a7 30 |..k..-y........0| -000001e0 81 a4 30 1d 06 03 55 1d 0e 04 16 04 14 b1 ad e2 |..0...U.........| -000001f0 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 88 |.Z..(.i.#i..&...| -00000200 39 30 75 06 03 55 1d 23 04 6e 30 6c 80 14 b1 ad |90u..U.#.n0l....| -00000210 e2 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 |..Z..(.i.#i..&..| -00000220 88 39 a1 49 a4 47 30 45 31 0b 30 09 06 03 55 04 |.9.I.G0E1.0...U.| -00000230 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| -00000240 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| -00000250 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| -00000260 64 67 69 74 73 20 50 74 79 20 4c 74 64 82 09 00 |dgits Pty Ltd...| -00000270 85 b0 bb a4 8a 7f b8 ca 30 0c 06 03 55 1d 13 04 |........0...U...| -00000280 05 30 03 01 01 ff 30 0d 06 09 2a 86 48 86 f7 0d |.0....0...*.H...| -00000290 01 01 05 05 00 03 81 81 00 08 6c 45 24 c7 6b b1 |..........lE$.k.| -000002a0 59 ab 0c 52 cc f2 b0 14 d7 87 9d 7a 64 75 b5 5a |Y..R.......zdu.Z| -000002b0 95 66 e4 c5 2b 8e ae 12 66 1f eb 4f 38 b3 6e 60 |.f..+...f..O8.n`| -000002c0 d3 92 fd f7 41 08 b5 25 13 b1 18 7a 24 fb 30 1d |....A..%...z$.0.| -000002d0 ba ed 98 b9 17 ec e7 d7 31 59 db 95 d3 1d 78 ea |........1Y....x.| -000002e0 50 56 5c d5 82 5a 2d 5a 5f 33 c4 b6 d8 c9 75 90 |PV\..Z-Z_3....u.| -000002f0 96 8c 0f 52 98 b5 cd 98 1f 89 20 5f f2 a0 1c a3 |...R...... _....| -00000300 1b 96 94 dd a9 fd 57 e9 70 e8 26 6d 71 99 9b 26 |......W.p.&mq..&| -00000310 6e 38 50 29 6c 90 a7 bd d9 16 03 03 00 2e 0d 00 |n8P)l...........| -00000320 00 26 03 01 02 40 00 1e 06 01 06 02 06 03 05 01 |.&...@..........| -00000330 05 02 05 03 04 01 04 02 04 03 03 01 03 02 03 03 |................| -00000340 02 01 02 02 02 03 00 00 0e 00 00 00 |............| ->>> Flow 3 (client to server) -00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| -00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| -00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| -00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| -00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| -00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| -00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| -00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| -00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| -00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| -000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| -000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| -000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| -000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| -000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| -000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| -00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| -00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| -00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| -00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| -00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| -00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| -00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| -00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| -00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| -00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| -000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| -000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| -000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| -000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| -000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| -000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| -00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 03 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 3e |..........mQ...>| -00000220 fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c 8e |.u.A6..j.*.%.gL.| -00000230 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 1d |b/0......+.#....| -00000240 f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 0d |.;...'..$...[.f.| -00000250 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be c8 |j.....C.........| -00000260 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce e6 |.9L.....K.../...| -00000270 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 f1 |.w.o#......:..V.| -00000280 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 35 |.T^F..;3..(....5| -00000290 d4 1c 43 d1 30 6f 55 4e 0a 70 16 03 03 00 92 0f |..C.0oUN.p......| -000002a0 00 00 8e 05 03 00 8a 30 81 87 02 41 19 c7 50 06 |.......0...A..P.| -000002b0 42 82 f9 e5 ec 0b f7 65 7e b1 19 53 5f 23 ab 19 |B......e~..S_#..| -000002c0 54 08 ec d2 a7 22 dd 83 7c 97 76 59 a5 6b f4 1d |T...."..|.vY.k..| -000002d0 92 86 34 2d ce 71 bb 01 d2 8a 67 0e a8 fb 51 e4 |..4-.q....g...Q.| -000002e0 69 9c 27 23 74 b9 fd 6f b6 5e 48 a0 cc 02 42 01 |i.'#t..o.^H...B.| -000002f0 50 97 b7 95 14 f4 a6 f2 95 63 17 38 59 a1 51 95 |P........c.8Y.Q.| -00000300 1e bc 99 fb fd 82 8b ab cb 4d 8e 17 a9 f8 e9 c2 |.........M......| -00000310 9b 93 15 02 50 e6 c2 05 54 e7 8a ec 6f 93 1f 79 |....P...T...o..y| -00000320 8d 67 e7 2d d6 65 ab 97 fd be 20 97 bd 6b c4 fc |.g.-.e.... ..k..| -00000330 02 14 03 03 00 01 01 16 03 03 00 24 24 df 52 6e |...........$$.Rn| -00000340 c1 35 48 fe 60 77 28 69 36 fe 96 a1 72 db a2 f5 |.5H.`w(i6...r...| -00000350 d0 b7 c3 d9 67 e5 ee f2 d9 18 bf f0 35 80 06 c2 |....g.......5...| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 40 5b dc 01 59 |..........$@[..Y| -00000010 33 6e 61 5a 6d fc c8 a5 f5 00 9b 55 77 c5 e6 f2 |3naZm......Uw...| -00000020 c6 5c b6 2f 94 3c 72 5b b5 0c 3e 78 88 e6 44 |.\./.x..D| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1a cd 2f 11 b1 3a e4 1c 31 95 9b c4 |....../..:..1...| -00000010 37 20 9f 03 d3 45 a4 15 e1 09 1e 0c f6 5d d3 15 |7 ...E.......]..| -00000020 03 03 00 16 d7 f6 a1 d0 ad 41 69 73 c0 40 22 f2 |.........Ais.@".| -00000030 5f e8 c3 50 f9 35 fc 59 e0 3a |_..P.5.Y.:| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 deleted file mode 100644 index 52e3befe615cd2c972848b84276ace73c97b5514..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-AES256-GCM-SHA384 +++ /dev/null @@ -1,139 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 74 fe 19 af 4b |....Y...U..t...K| -00000010 f3 d8 92 62 5a df 90 2c cc 09 fd 79 45 26 cd 52 |...bZ..,...yE&.R| -00000020 9a e6 da 16 99 fe 1d 91 79 a7 a0 20 b3 13 e9 03 |........y.. ....| -00000030 52 23 5f f0 55 59 f1 9e 00 a7 77 97 90 ed 2b fb |R#_.UY....w...+.| -00000040 9c ab fe b1 db ea 16 95 95 68 b0 e9 c0 30 00 00 |.........h...0..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 be 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 |.............0..| -00000070 b0 30 82 02 19 a0 03 02 01 02 02 09 00 85 b0 bb |.0..............| -00000080 a4 8a 7f b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000090 01 05 05 00 30 45 31 0b 30 09 06 03 55 04 06 13 |....0E1.0...U...| -000000a0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| -000000b0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| -000000c0 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| -000000d0 69 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 |its Pty Ltd0...1| -000000e0 30 30 34 32 34 30 39 30 39 33 38 5a 17 0d 31 31 |00424090938Z..11| -000000f0 30 34 32 34 30 39 30 39 33 38 5a 30 45 31 0b 30 |0424090938Z0E1.0| -00000100 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000110 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000120 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000130 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000140 74 64 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |td0..0...*.H....| -00000150 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 bb |........0.......| -00000160 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 |y......F...i..+.| -00000170 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c |CZ..-.zC...R..eL| -00000180 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 |,x.#........;~b.| -00000190 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b |,.3...\zV.....X{| -000001a0 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a |&?......!.J..T.Z| -000001b0 bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 |..Bq......~.}}..| -000001c0 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf |9....Q.|..L;2f..| -000001d0 af b1 1d b8 71 9a 1d db db 89 6b ae da 2d 79 02 |....q.....k..-y.| -000001e0 03 01 00 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d |.......0..0...U.| -000001f0 0e 04 16 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce |.........Z..(.i.| -00000200 23 69 de d3 26 8e 18 88 39 30 75 06 03 55 1d 23 |#i..&...90u..U.#| -00000210 04 6e 30 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 |.n0l......Z..(.i| -00000220 ce 23 69 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 |.#i..&...9.I.G0E| -00000230 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 |1.0...U....AU1.0| -00000240 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 |...U....Some-Sta| -00000250 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 |te1!0...U....Int| -00000260 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 |ernet Widgits Pt| -00000270 79 20 4c 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca |y Ltd...........| -00000280 30 0c 06 03 55 1d 13 04 05 30 03 01 01 ff 30 0d |0...U....0....0.| -00000290 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 81 |..*.H...........| -000002a0 00 08 6c 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 |..lE$.k.Y..R....| -000002b0 d7 87 9d 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 |...zdu.Z.f..+...| -000002c0 66 1f eb 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 |f..O8.n`....A..%| -000002d0 13 b1 18 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 |...z$.0.........| -000002e0 31 59 db 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a |1Y....x.PV\..Z-Z| -000002f0 5f 33 c4 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 |_3....u....R....| -00000300 1f 89 20 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 |.. _..........W.| -00000310 70 e8 26 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd |p.&mq..&n8P)l...| -00000320 d9 16 03 03 00 cd 0c 00 00 c9 03 00 17 41 04 22 |.............A."| -00000330 84 e9 5e 6e 35 92 a3 83 73 0a d6 0d 1a c1 4d ab |..^n5...s.....M.| -00000340 1f ab c2 dc 3f 53 a5 7d 38 c0 92 a4 82 e1 3c c5 |....?S.}8.....<.| -00000350 24 60 20 a5 3b c5 65 ba 9c f1 b9 a5 b9 c2 70 73 |$` .;.e.......ps| -00000360 19 74 a6 d1 0f 75 b4 75 e0 e8 60 20 e9 23 fe 04 |.t...u.u..` .#..| -00000370 01 00 80 92 e0 56 3f 48 0d 10 23 48 b5 95 b6 91 |.....V?H..#H....| -00000380 3e 8a 2e c7 02 e2 85 0e 59 c8 03 24 d9 1a 1a 25 |>.......Y..$...%| -00000390 8e 12 bb 0b 83 ac 51 36 81 3f bc 0e be b9 3b 1d |......Q6.?....;.| -000003a0 67 56 21 4d 24 36 84 05 61 e7 70 60 d5 8e ae 97 |gV!M$6..a.p`....| -000003b0 b8 3a d3 b1 94 72 52 cd b0 0d dd 46 b1 15 3b 58 |.:...rR....F..;X| -000003c0 c1 a4 63 2c 4c 31 f9 c7 4f 27 c1 0f f0 24 36 72 |..c,L1..O'...$6r| -000003d0 e0 f8 51 12 86 c2 13 ed 6b 84 a8 15 c3 d0 39 55 |..Q.....k.....9U| -000003e0 a4 60 50 88 c9 1e 60 60 aa 8d a5 31 3e 35 c3 f8 |.`P...``...1>5..| -000003f0 2c 90 1c 16 03 03 00 2e 0d 00 00 26 03 01 02 40 |,..........&...@| -00000400 00 1e 06 01 06 02 06 03 05 01 05 02 05 03 04 01 |................| -00000410 04 02 04 03 03 01 03 02 03 03 02 01 02 02 02 03 |................| -00000420 00 00 0e 00 00 00 |......| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000210 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000220 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000230 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000240 a6 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 88 |..h.A.Vk.Z......| -00000250 0f 00 00 84 05 01 00 80 33 bb 8e 67 64 03 e7 7e |........3..gd..~| -00000260 be a5 b1 bc cf 7a 07 24 01 17 c3 3d 4b 72 dd c3 |.....z.$...=Kr..| -00000270 64 a7 36 e8 49 ab b6 87 ce d6 af 9e 07 22 76 e8 |d.6.I........"v.| -00000280 0d 44 a3 36 c9 eb a4 49 85 cf 72 67 e8 2a a7 5b |.D.6...I..rg.*.[| -00000290 d3 f2 46 af 53 48 c6 13 f7 0b 5b 9c c7 4d 3e 05 |..F.SH....[..M>.| -000002a0 3c 0f 69 a7 40 3a e8 70 04 01 1c 29 b2 42 0f 5f |<.i.@:.p...).B._| -000002b0 1c d5 b7 5c c2 17 07 7f bd a2 b3 9a 95 81 51 24 |...\..........Q$| -000002c0 54 5c 42 d6 a4 76 c0 d7 54 d2 11 54 bf fd dc a0 |T\B..v..T..T....| -000002d0 ee 95 26 64 59 a0 fc 51 14 03 03 00 01 01 16 03 |..&dY..Q........| -000002e0 03 00 28 00 00 00 00 00 00 00 00 af f4 8a be d9 |..(.............| -000002f0 ff f1 44 e4 41 ab 9b b3 d8 b0 3d 3f 6b c5 1d b6 |..D.A.....=?k...| -00000300 1d 9e 35 f5 20 f4 2a af e8 35 77 |..5. .*..5w| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 ff 0d 47 63 2b |..........(..Gc+| -00000010 bd 00 3a ad 82 e3 a7 b3 b0 84 4a 26 f4 30 78 20 |..:.......J&.0x | -00000020 80 f2 2b 15 98 61 1c cb 8b 17 67 8a 11 96 aa 93 |..+..a....g.....| -00000030 68 f7 fb |h..| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 a6 8d 7b |...............{| -00000010 99 5e a2 e1 95 bb 5f e4 01 f4 0e 20 52 b4 64 4e |.^...._.... R.dN| -00000020 86 b1 3f 15 03 03 00 1a 00 00 00 00 00 00 00 02 |..?.............| -00000030 61 98 eb d0 7c ac bd 00 ac 7a e1 32 20 3e 81 b6 |a...|....z.2 >..| -00000040 9d d5 |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA deleted file mode 100644 index 23bf29d776e1b441673c6e30c982dc627b94d4e3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-ECDSA +++ /dev/null @@ -1,133 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 b3 7f 4e e7 11 |....Y...U....N..| -00000010 6d bc 56 ec 9c a8 61 08 d6 5a 2a 42 7b f1 94 0a |m.V...a..Z*B{...| -00000020 29 35 8b 7e 23 a0 6c 59 23 cf 39 20 84 09 b6 5b |)5.~#.lY#.9 ...[| -00000030 2f 46 80 3b 26 92 fd 81 e9 24 8c e2 b8 64 a2 03 |/F.;&....$...d..| -00000040 3a 68 c3 7b 44 f8 28 41 e2 d3 6c 7c c0 09 00 00 |:h.{D.(A..l|....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 d7 0c 00 00 d3 03 00 17 41 04 0f |*............A..| -00000280 4d b0 41 d4 dc 6b 8a 85 52 eb eb 18 4a 8f a7 e6 |M.A..k..R...J...| -00000290 24 52 e5 86 be 57 d7 0a e7 23 84 a8 a9 6c 96 08 |$R...W...#...l..| -000002a0 4b f7 47 32 79 d9 df 81 f6 05 40 63 3b 14 67 3b |K.G2y.....@c;.g;| -000002b0 ea 01 a0 0d 43 1a 36 29 b3 51 7a e4 af 1b 67 04 |....C.6).Qz...g.| -000002c0 03 00 8a 30 81 87 02 42 01 8e 57 8a b8 b7 5b 2f |...0...B..W...[/| -000002d0 9c 31 74 d8 7d 68 d7 6e 83 73 5f fb d0 cd de 66 |.1t.}h.n.s_....f| -000002e0 60 fa 0a 0a 15 0b 30 3b 08 b6 f1 3e 4f 20 13 62 |`.....0;...>O .b| -000002f0 b5 ff 86 81 dc 42 a1 4c af c8 ff b3 24 81 d8 e1 |.....B.L....$...| -00000300 d1 09 0c 32 11 92 5e dd 3f 87 02 41 76 a7 29 48 |...2..^.?..Av.)H| -00000310 52 68 1c 72 4d d5 39 bf fa 61 ec b2 27 ce 10 4e |Rh.rM.9..a..'..N| -00000320 86 12 3d 1e 04 9c 11 b7 b4 0c cf 98 9d 01 c3 93 |..=.............| -00000330 cf 83 9e 92 9a ca fd 8f b1 9f 1b 20 c4 fb a4 46 |........... ...F| -00000340 60 fc fd d5 33 b0 8f b5 b5 c8 a4 70 c5 16 03 03 |`...3......p....| -00000350 00 2e 0d 00 00 26 03 01 02 40 00 1e 06 01 06 02 |.....&...@......| -00000360 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000370 03 02 03 03 02 01 02 02 02 03 00 00 0e 00 00 00 |................| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000210 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000220 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000230 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000240 a6 b5 68 1a 41 03 56 6b dc 5a 89 16 03 03 00 88 |..h.A.Vk.Z......| -00000250 0f 00 00 84 05 01 00 80 02 19 16 cc 97 ad 70 20 |..............p | -00000260 bd 64 63 dd b6 81 a0 16 b3 46 4b 42 ff 21 58 2c |.dc......FKB.!X,| -00000270 bb 2b 4c e1 4e d7 49 4d 5c 7c 63 32 3e ef e6 ad |.+L.N.IM\|c2>...| -00000280 85 3f ab b4 5c 2a 37 76 8b 28 56 08 4f 08 b9 51 |.?..\*7v.(V.O..Q| -00000290 71 14 07 27 47 45 11 a0 03 cf 72 7d 67 ef 31 8d |q..'GE....r}g.1.| -000002a0 e7 db 36 76 b1 b3 f4 bf aa 6c c4 56 94 35 71 e1 |..6v.....l.V.5q.| -000002b0 dd 88 6d 15 90 c8 70 ad d8 95 55 42 9b c1 45 19 |..m...p...UB..E.| -000002c0 36 ce 87 c6 fd 94 8a d4 98 6e ec 18 d5 da 59 54 |6........n....YT| -000002d0 80 a7 8c 90 ae 55 20 1c 14 03 03 00 01 01 16 03 |.....U .........| -000002e0 03 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 |..@.............| -000002f0 00 00 00 58 fe bc 5c ba b2 a9 96 77 2f 95 c9 10 |...X..\....w/...| -00000300 fd 6d fc 6a 88 8c df 82 c3 a4 3d cc 28 f4 bf 7d |.m.j......=.(..}| -00000310 4a f8 3d 97 36 e5 a0 76 92 94 da dd cc f5 e4 0e |J.=.6..v........| -00000320 7a c4 2c |z.,| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 81 ab 5a 66 a8 |..........@..Zf.| -00000010 0f a5 d3 07 00 66 45 1f 31 a9 ef f7 a0 d9 23 46 |.....fE.1.....#F| -00000020 f0 3e 50 18 99 e3 5a bd eb b7 1d 81 d5 95 d5 ee |.>P...Z.........| -00000030 21 31 41 4b 19 92 b5 95 36 da 21 c0 4a 2a a0 1c |!1AK....6.!.J*..| -00000040 a3 9f 8e a0 6f 9d 37 5e 12 11 03 |....o.7^...| ->>> Flow 5 (client to server) -00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 a9 51 94 19 72 ab 9f 3e 97 5e 99 |......Q..r..>.^.| -00000020 2c ec 13 48 3e 10 54 5f 8a 85 88 4d 1a a8 f5 ed |,..H>.T_...M....| -00000030 c3 4f a9 59 a3 15 03 03 00 30 00 00 00 00 00 00 |.O.Y.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 25 00 6d 2f a0 f6 |..........%.m/..| -00000050 ce 8a 30 ba 53 da 97 c6 11 f3 d2 f3 9e 66 d6 dd |..0.S........f..| -00000060 19 f3 ee 07 03 d3 e6 f1 30 32 |........02| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA deleted file mode 100644 index ff79aa236c569cce02ef8a9fe8489f310211b449..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ClientCert-RSA-RSA +++ /dev/null @@ -1,127 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 b3 b2 22 69 e4 |....Q...M...."i.| -00000010 1a a1 56 94 26 0c 43 b7 89 0c 34 ce dc 5a c8 ca |..V.&.C...4..Z..| -00000020 e2 42 92 5c 75 9a b3 22 22 64 38 20 6d 2c 26 0b |.B.\u..""d8 m,&.| -00000030 34 b6 b8 20 36 e2 58 e5 ee 1f e2 9f a0 75 f6 d9 |4.. 6.X......u..| -00000040 0c e4 39 ce 3c 8e 2e f8 e8 d1 a2 16 00 05 00 00 |..9.<...........| -00000050 05 ff 01 00 01 00 16 03 03 02 be 0b 00 02 ba 00 |................| -00000060 02 b7 00 02 b4 30 82 02 b0 30 82 02 19 a0 03 02 |.....0...0......| -00000070 01 02 02 09 00 85 b0 bb a4 8a 7f b8 ca 30 0d 06 |.............0..| -00000080 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 45 31 0b |.*.H........0E1.| -00000090 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 |0...U....AU1.0..| -000000a0 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 |.U....Some-State| -000000b0 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 |1!0...U....Inter| -000000c0 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 |net Widgits Pty | -000000d0 4c 74 64 30 1e 17 0d 31 30 30 34 32 34 30 39 30 |Ltd0...100424090| -000000e0 39 33 38 5a 17 0d 31 31 30 34 32 34 30 39 30 39 |938Z..1104240909| -000000f0 33 38 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 |38Z0E1.0...U....| -00000100 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000110 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000120 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -00000130 74 73 20 50 74 79 20 4c 74 64 30 81 9f 30 0d 06 |ts Pty Ltd0..0..| -00000140 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| -00000150 30 81 89 02 81 81 00 bb 79 d6 f5 17 b5 e5 bf 46 |0.......y......F| -00000160 10 d0 dc 69 be e6 2b 07 43 5a d0 03 2d 8a 7a 43 |...i..+.CZ..-.zC| -00000170 85 b7 14 52 e7 a5 65 4c 2c 78 b8 23 8c b5 b4 82 |...R..eL,x.#....| -00000180 e5 de 1f 95 3b 7e 62 a5 2c a5 33 d6 fe 12 5c 7a |....;~b.,.3...\z| -00000190 56 fc f5 06 bf fa 58 7b 26 3f b5 cd 04 d3 d0 c9 |V.....X{&?......| -000001a0 21 96 4a c7 f4 54 9f 5a bf ef 42 71 00 fe 18 99 |!.J..T.Z..Bq....| -000001b0 07 7f 7e 88 7d 7d f1 04 39 c4 a2 2e db 51 c9 7c |..~.}}..9....Q.|| -000001c0 e3 c0 4c 3b 32 66 01 cf af b1 1d b8 71 9a 1d db |..L;2f......q...| -000001d0 db 89 6b ae da 2d 79 02 03 01 00 01 a3 81 a7 30 |..k..-y........0| -000001e0 81 a4 30 1d 06 03 55 1d 0e 04 16 04 14 b1 ad e2 |..0...U.........| -000001f0 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 88 |.Z..(.i.#i..&...| -00000200 39 30 75 06 03 55 1d 23 04 6e 30 6c 80 14 b1 ad |90u..U.#.n0l....| -00000210 e2 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 |..Z..(.i.#i..&..| -00000220 88 39 a1 49 a4 47 30 45 31 0b 30 09 06 03 55 04 |.9.I.G0E1.0...U.| -00000230 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| -00000240 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| -00000250 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| -00000260 64 67 69 74 73 20 50 74 79 20 4c 74 64 82 09 00 |dgits Pty Ltd...| -00000270 85 b0 bb a4 8a 7f b8 ca 30 0c 06 03 55 1d 13 04 |........0...U...| -00000280 05 30 03 01 01 ff 30 0d 06 09 2a 86 48 86 f7 0d |.0....0...*.H...| -00000290 01 01 05 05 00 03 81 81 00 08 6c 45 24 c7 6b b1 |..........lE$.k.| -000002a0 59 ab 0c 52 cc f2 b0 14 d7 87 9d 7a 64 75 b5 5a |Y..R.......zdu.Z| -000002b0 95 66 e4 c5 2b 8e ae 12 66 1f eb 4f 38 b3 6e 60 |.f..+...f..O8.n`| -000002c0 d3 92 fd f7 41 08 b5 25 13 b1 18 7a 24 fb 30 1d |....A..%...z$.0.| -000002d0 ba ed 98 b9 17 ec e7 d7 31 59 db 95 d3 1d 78 ea |........1Y....x.| -000002e0 50 56 5c d5 82 5a 2d 5a 5f 33 c4 b6 d8 c9 75 90 |PV\..Z-Z_3....u.| -000002f0 96 8c 0f 52 98 b5 cd 98 1f 89 20 5f f2 a0 1c a3 |...R...... _....| -00000300 1b 96 94 dd a9 fd 57 e9 70 e8 26 6d 71 99 9b 26 |......W.p.&mq..&| -00000310 6e 38 50 29 6c 90 a7 bd d9 16 03 03 00 2e 0d 00 |n8P)l...........| -00000320 00 26 03 01 02 40 00 1e 06 01 06 02 06 03 05 01 |.&...@..........| -00000330 05 02 05 03 04 01 04 02 04 03 03 01 03 02 03 03 |................| -00000340 02 01 02 02 02 03 00 00 0e 00 00 00 |............| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 03 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 |...........mQ...| -00000210 3e fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c |>.u.A6..j.*.%.gL| -00000220 8e 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 |.b/0......+.#...| -00000230 1d f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 |..;...'..$...[.f| -00000240 0d 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be |.j.....C........| -00000250 c8 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce |..9L.....K.../..| -00000260 e6 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 |..w.o#......:..V| -00000270 f1 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 |..T^F..;3..(....| -00000280 35 d4 1c 43 d1 30 6f 55 4e 0a 70 16 03 03 00 88 |5..C.0oUN.p.....| -00000290 0f 00 00 84 05 01 00 80 01 24 8d bb 05 61 2d 29 |.........$...a-)| -000002a0 12 11 90 f5 57 21 be b7 29 76 55 63 94 8e 7b 4d |....W!..)vUc..{M| -000002b0 3b 3d 89 5b 1f b9 e1 8c 36 68 6f 31 21 50 af e4 |;=.[....6ho1!P..| -000002c0 9f ca a5 68 55 b9 eb 36 75 3a 0c be 11 30 28 c8 |...hU..6u:...0(.| -000002d0 8b 82 93 9a 71 37 4d 4e 4f d2 0c 2f 13 36 ad c3 |....q7MNO../.6..| -000002e0 df 8a 1b 59 b2 f9 8b a7 74 63 75 4a f4 9d e0 6b |...Y....tcuJ...k| -000002f0 42 02 5a a9 6e a4 a8 24 d3 23 f7 09 ee b0 dc c4 |B.Z.n..$.#......| -00000300 6f 87 58 72 e7 e3 87 b3 6b 15 ba 7f dd 9b 93 91 |o.Xr....k.......| -00000310 5b 21 a0 31 31 bd 15 b5 14 03 03 00 01 01 16 03 |[!.11...........| -00000320 03 00 24 fc 0e 7c e8 3e 8b b5 dc c9 3d 38 61 a1 |..$..|.>....=8a.| -00000330 24 d6 77 1f 06 1f 30 32 ba dd 05 68 45 f1 4f 0d |$.w...02...hE.O.| -00000340 2e 24 09 ad c1 e5 b7 |.$.....| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 d7 b6 b3 0a e6 |..........$.....| -00000010 86 9a 25 e4 38 de d0 57 ff 93 0b f4 de 76 3d 00 |..%.8..W.....v=.| -00000020 64 35 cf 70 f6 ea 74 2d b0 71 2d 92 e2 df eb |d5.p..t-.q-....| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1a db bd 43 12 7c b5 83 b5 18 9d 6a |.......C.|.....j| -00000010 70 3f 5a eb cb d0 ba d4 03 3e a0 7b 25 f0 41 15 |p?Z......>.{%.A.| -00000020 03 03 00 16 f8 f2 a3 27 a5 c7 25 d9 6c 08 b1 96 |.......'..%.l...| -00000030 38 22 38 df 16 fb e2 9f 61 a3 |8"8.....a.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES deleted file mode 100644 index e700e16352a692cca48ce48dc141b5d317fecde7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES +++ /dev/null @@ -1,90 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 21 9b eb 15 24 |....Y...U..!...$| -00000010 46 b6 c1 85 f5 be c5 0d e2 6b 60 bc ee 73 b1 fb |F........k`..s..| -00000020 34 6f f0 b8 f0 9e 1c 26 a4 4b 0f 20 cb 2b 84 a2 |4o.....&.K. .+..| -00000030 cb a5 48 70 fe 84 25 b0 16 20 14 a1 83 21 fc f9 |..Hp..%.. ...!..| -00000040 82 fc 9e 1a d1 3b 56 69 ab c5 0e 2c c0 09 00 00 |.....;Vi...,....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 d8 0c 00 00 d4 03 00 17 41 04 b6 |*............A..| -00000280 3f 37 33 68 cb 79 c0 86 f4 9d 12 ac c4 9d 8c 9b |?73h.y..........| -00000290 59 1c d4 a9 01 9f 2d cb 80 24 02 ec e0 ff d1 8c |Y.....-..$......| -000002a0 bd 82 67 3f 47 58 1a 2e 6b 61 f6 8e 4e 27 7f 49 |..g?GX..ka..N'.I| -000002b0 b5 45 f1 0b 9a 33 ff 53 ac 65 e2 82 7a 18 5c 04 |.E...3.S.e..z.\.| -000002c0 03 00 8b 30 81 88 02 42 00 e1 2d ff 5d e7 77 f1 |...0...B..-.].w.| -000002d0 12 d9 e4 c2 4d cd 9c b5 ee e4 fd 21 b2 d8 53 a9 |....M......!..S.| -000002e0 42 e7 c5 9b 51 c3 59 37 a5 08 d4 e6 29 12 c5 56 |B...Q.Y7....)..V| -000002f0 b8 fe f0 bb 77 87 a3 ee 09 b0 8c cd 1c 39 9e b5 |....w........9..| -00000300 d9 15 63 53 cb d7 f1 55 5b 48 02 42 01 19 10 8a |..cS...U[H.B....| -00000310 7a ee 95 b1 77 44 d4 a3 bf d1 f3 f1 b0 d8 c7 7e |z...wD.........~| -00000320 42 c0 83 04 f5 f7 9c c0 ce 6a 98 47 9d 21 29 84 |B........j.G.!).| -00000330 c8 be 6b 67 4e fc c6 26 ec 63 df 00 33 e6 d2 f7 |..kgN..&.c..3...| -00000340 34 93 85 9b 1b 0f e0 89 42 b6 0b 94 1b 80 16 03 |4.......B.......| -00000350 03 00 04 0e 00 00 00 |.......| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 |.....@..........| -00000060 00 00 00 00 00 00 50 73 9c 9f a8 d7 78 ac 06 14 |......Ps....x...| -00000070 8f ae fc fb ef 7d 99 db b7 c9 91 dd f2 fe da 1b |.....}..........| -00000080 aa 9e 7d e4 5c 2f 5f dd 74 aa fe 03 51 e7 cd 98 |..}.\/_.t...Q...| -00000090 e9 21 19 c9 6f 59 |.!..oY| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 47 18 b5 1b 75 |..........@G...u| -00000010 b8 a3 63 ab 77 d3 47 cb 14 26 b4 88 fe 15 db 22 |..c.w.G..&....."| -00000020 76 3b 25 d3 68 8e f2 a7 d5 03 2b 82 7b b1 0f 10 |v;%.h.....+.{...| -00000030 49 6a 3d 95 d0 4b 55 0e 14 eb bb a7 34 bb 57 b3 |Ij=..KU.....4.W.| -00000040 5d fb 7e 15 80 5a fa f3 3a df 90 |].~..Z..:..| ->>> Flow 5 (client to server) -00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 70 74 e2 60 fc 3a 7a b7 5e 16 07 |.....pt.`.:z.^..| -00000020 22 92 07 fe 92 53 c4 43 1b 8f 94 07 84 48 2b 50 |"....S.C.....H+P| -00000030 ab 1d 6d 49 ed 15 03 03 00 30 00 00 00 00 00 00 |..mI.....0......| -00000040 00 00 00 00 00 00 00 00 00 00 ce a8 ba 91 0b e4 |................| -00000050 8c 38 23 9b 8b 2c 0a 0c 63 79 61 f4 b6 25 f7 41 |.8#..,..cya..%.A| -00000060 04 9f b0 8f e0 e5 24 44 2f e9 |......$D/.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM deleted file mode 100644 index 607ecdcb2407fac950a092a79597d79e9769445e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES-GCM +++ /dev/null @@ -1,85 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 91 8a 4f 94 29 |....Y...U....O.)| -00000010 32 fa 66 7a 7f b8 a7 04 5c 34 b9 7e 12 83 35 1f |2.fz....\4.~..5.| -00000020 93 b0 af e0 9f 71 07 5e 2f d7 ca 20 52 dc 0d e7 |.....q.^/.. R...| -00000030 f8 16 db 90 9a 78 2f 03 0b f0 ae a7 2f c6 b4 4c |.....x/...../..L| -00000040 62 e7 de 32 d5 68 61 f3 07 e4 60 d2 c0 2b 00 00 |b..2.ha...`..+..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 d8 0c 00 00 d4 03 00 17 41 04 26 |*............A.&| -00000280 c1 67 14 4b 9e b0 45 8c 27 bf a3 a2 78 5b 56 ad |.g.K..E.'...x[V.| -00000290 d1 21 56 53 df 86 e9 91 de e3 f9 5d e6 f6 5d 79 |.!VS.......]..]y| -000002a0 11 8b 60 f9 c2 9a c6 3f 6b 72 cd 7c d7 0e 13 64 |..`....?kr.|...d| -000002b0 af e8 9f 40 35 e6 fb 04 0c 60 aa 19 61 dd 24 04 |...@5....`..a.$.| -000002c0 03 00 8b 30 81 88 02 42 00 9d e1 02 5d 8b b1 45 |...0...B....]..E| -000002d0 e5 c7 b6 94 27 df 36 31 fd 5e 47 fe c8 0f 5f 17 |....'.61.^G..._.| -000002e0 b1 92 56 76 29 45 3d 90 be 91 6e 2c a7 b2 e1 33 |..Vv)E=...n,...3| -000002f0 3b f9 3c bb 80 58 c2 d8 a8 59 82 16 dc 9e dd 60 |;.<..X...Y.....`| -00000300 ff 82 b9 0c 5a ca ff f3 02 2c 02 42 00 a4 c0 d3 |....Z....,.B....| -00000310 aa 1d 69 52 c0 06 fa 93 e8 50 da a4 2f 72 c9 4a |..iR.....P../r.J| -00000320 2c 43 7f 95 05 f7 7a f3 4a 2e 2d ce 13 be 80 40 |,C....z.J.-....@| -00000330 a4 3b b2 f0 73 8d f1 d4 7b a3 ff 01 e1 58 71 31 |.;..s...{....Xq1| -00000340 fc d8 2f b3 ef 62 2e b7 ac f5 c4 bc b8 68 16 03 |../..b.......h..| -00000350 03 00 04 0e 00 00 00 |.......| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 83 cf |.....(..........| -00000060 ef 50 c2 e7 da b9 74 7f 1c e0 b8 fb dc 39 c9 98 |.P....t......9..| -00000070 0c a3 7d 8c c6 fa 6f f2 ee 44 a0 a0 03 18 |..}...o..D....| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 73 c4 48 24 3d |..........(s.H$=| -00000010 8f 5f f3 8c fc fd 63 be 64 39 d5 56 67 bd d7 c4 |._....c.d9.Vg...| -00000020 0d 57 88 1a 45 a6 f3 ad 11 b2 5a 41 58 33 f3 d3 |.W..E.....ZAX3..| -00000030 58 fa 21 |X.!| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 65 5e 55 |.............e^U| -00000010 32 be 00 77 6e 1d 8e 8f 95 33 24 3d 7a c2 b0 3f |2..wn....3$=z..?| -00000020 ca aa 97 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| -00000030 b2 71 6e 42 6a 0d cf c9 ac 14 a4 b5 9c c9 71 60 |.qnBj.........q`| -00000040 d7 c2 |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 deleted file mode 100644 index df2f7376de8b8cdb6f9983367971960f041fe10a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-ECDSA-AES256-GCM-SHA384 +++ /dev/null @@ -1,85 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 11 50 81 a7 ef |....Y...U...P...| -00000010 3f bd a5 a9 41 11 e6 86 b2 a3 d8 bf 29 c3 d4 f4 |?...A.......)...| -00000020 b6 20 2d cb 94 1b 0e dd 99 d1 0b 20 78 92 23 31 |. -........ x.#1| -00000030 e3 fc 99 67 1f fd f3 2a fc 9c 4c 74 6e 32 e4 f8 |...g...*..Ltn2..| -00000040 ed 6d 2e 6d ad a9 a9 bf 63 27 7e 44 c0 2c 00 00 |.m.m....c'~D.,..| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 0e 0b 00 02 0a 00 02 07 00 02 04 30 82 02 |.............0..| -00000070 00 30 82 01 62 02 09 00 b8 bf 2d 47 a0 d2 eb f4 |.0..b.....-G....| -00000080 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 0b 30 |0...*.H.=..0E1.0| -00000090 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000000a0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000000b0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000000c0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000000d0 74 64 30 1e 17 0d 31 32 31 31 32 32 31 35 30 36 |td0...1211221506| -000000e0 33 32 5a 17 0d 32 32 31 31 32 30 31 35 30 36 33 |32Z..22112015063| -000000f0 32 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 |2Z0E1.0...U....A| -00000100 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 |U1.0...U....Some| -00000110 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 |-State1!0...U...| -00000120 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 |.Internet Widgit| -00000130 73 20 50 74 79 20 4c 74 64 30 81 9b 30 10 06 07 |s Pty Ltd0..0...| -00000140 2a 86 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 |*.H.=....+...#..| -00000150 86 00 04 00 c4 a1 ed be 98 f9 0b 48 73 36 7e c3 |...........Hs6~.| -00000160 16 56 11 22 f2 3d 53 c3 3b 4d 21 3d cd 6b 75 e6 |.V.".=S.;M!=.ku.| -00000170 f6 b0 dc 9a df 26 c1 bc b2 87 f0 72 32 7c b3 64 |.....&.....r2|.d| -00000180 2f 1c 90 bc ea 68 23 10 7e fe e3 25 c0 48 3a 69 |/....h#.~..%.H:i| -00000190 e0 28 6d d3 37 00 ef 04 62 dd 0d a0 9c 70 62 83 |.(m.7...b....pb.| -000001a0 d8 81 d3 64 31 aa 9e 97 31 bd 96 b0 68 c0 9b 23 |...d1...1...h..#| -000001b0 de 76 64 3f 1a 5c 7f e9 12 0e 58 58 b6 5f 70 dd |.vd?.\....XX._p.| -000001c0 9b d8 ea d5 d7 f5 d5 cc b9 b6 9f 30 66 5b 66 9a |...........0f[f.| -000001d0 20 e2 27 e5 bf fe 3b 30 09 06 07 2a 86 48 ce 3d | .'...;0...*.H.=| -000001e0 04 01 03 81 8c 00 30 81 88 02 42 01 88 a2 4f eb |......0...B...O.| -000001f0 e2 45 c5 48 7d 1b ac f5 ed 98 9d ae 47 70 c0 5e |.E.H}.......Gp.^| -00000200 1b b6 2f bd f1 b6 4d b7 61 40 d3 11 a2 ce ee 0b |../...M.a@......| -00000210 7e 92 7e ff 76 9d c3 3b 7e a5 3f ce fa 10 e2 59 |~.~.v..;~.?....Y| -00000220 ec 47 2d 7c ac da 4e 97 0e 15 a0 6f d0 02 42 01 |.G-|..N....o..B.| -00000230 4d fc be 67 13 9c 2d 05 0e bd 3f a3 8c 25 c1 33 |M..g..-...?..%.3| -00000240 13 83 0d 94 06 bb d4 37 7a f6 ec 7a c9 86 2e dd |.......7z..z....| -00000250 d7 11 69 7f 85 7c 56 de fb 31 78 2b e4 c7 78 0d |..i..|V..1x+..x.| -00000260 ae cb be 9e 4e 36 24 31 7b 6a 0f 39 95 12 07 8f |....N6$1{j.9....| -00000270 2a 16 03 03 00 d7 0c 00 00 d3 03 00 17 41 04 fc |*............A..| -00000280 e6 25 27 3c 76 10 a8 9e d3 a4 a8 68 31 06 85 fc |.%'>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 a3 3f |.....(.........?| -00000060 be 65 91 cd fe 37 43 e0 ea 6f 15 9d c2 aa 6a 02 |.e...7C..o....j.| -00000070 20 b8 bc b5 c8 9a 1c d4 c4 e5 9b 2e 39 e7 | ...........9.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 7c b7 1f 13 9e |..........(|....| -00000010 21 d2 eb db 32 fc 36 d0 53 e1 11 04 ce d0 61 33 |!...2.6.S.....a3| -00000020 1e 30 3d 91 c3 6a 0d 98 55 f5 e0 5c ca 77 fa 72 |.0=..j..U..\.w.r| -00000030 63 6a be |cj.| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 d9 db db |................| -00000010 4b 3a ae 5c a4 dc 96 33 ed b5 a0 70 64 1f 96 2f |K:.\...3...pd../| -00000020 b6 cd 1e 15 03 03 00 1a 00 00 00 00 00 00 00 02 |................| -00000030 18 a0 d1 98 a6 71 c9 56 36 bd 1a 46 4b 5b 45 29 |.....q.V6..FK[E)| -00000040 1f dd |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES deleted file mode 100644 index 994ebb1e37f94b4eb4b5c06f77dedfbf1cf823a6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-ECDHE-RSA-AES +++ /dev/null @@ -1,100 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 59 02 00 00 55 03 03 e6 ae 89 0d 22 |....Y...U......"| -00000010 e5 e0 cd 57 a3 ca 71 4f 17 2f 64 77 f8 30 89 ef |...W..qO./dw.0..| -00000020 e8 19 70 ac dd 2c c5 9f 84 7d 1d 20 1c 59 3c fe |..p..,...}. .Y<.| -00000030 a9 ec 10 dd 38 3b 43 fe 6b 09 e5 e4 83 d9 7a 78 |....8;C.k.....zx| -00000040 86 08 33 da 9b e1 09 d8 c9 07 34 19 c0 13 00 00 |..3.......4.....| -00000050 0d ff 01 00 01 00 00 0b 00 04 03 00 01 02 16 03 |................| -00000060 03 02 be 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 |.............0..| -00000070 b0 30 82 02 19 a0 03 02 01 02 02 09 00 85 b0 bb |.0..............| -00000080 a4 8a 7f b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000090 01 05 05 00 30 45 31 0b 30 09 06 03 55 04 06 13 |....0E1.0...U...| -000000a0 02 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f |.AU1.0...U....So| -000000b0 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 |me-State1!0...U.| -000000c0 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 |...Internet Widg| -000000d0 69 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 |its Pty Ltd0...1| -000000e0 30 30 34 32 34 30 39 30 39 33 38 5a 17 0d 31 31 |00424090938Z..11| -000000f0 30 34 32 34 30 39 30 39 33 38 5a 30 45 31 0b 30 |0424090938Z0E1.0| -00000100 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -00000110 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -00000120 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -00000130 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -00000140 74 64 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |td0..0...*.H....| -00000150 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 bb |........0.......| -00000160 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 |y......F...i..+.| -00000170 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c |CZ..-.zC...R..eL| -00000180 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 |,x.#........;~b.| -00000190 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b |,.3...\zV.....X{| -000001a0 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a |&?......!.J..T.Z| -000001b0 bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 |..Bq......~.}}..| -000001c0 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf |9....Q.|..L;2f..| -000001d0 af b1 1d b8 71 9a 1d db db 89 6b ae da 2d 79 02 |....q.....k..-y.| -000001e0 03 01 00 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d |.......0..0...U.| -000001f0 0e 04 16 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce |.........Z..(.i.| -00000200 23 69 de d3 26 8e 18 88 39 30 75 06 03 55 1d 23 |#i..&...90u..U.#| -00000210 04 6e 30 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 |.n0l......Z..(.i| -00000220 ce 23 69 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 |.#i..&...9.I.G0E| -00000230 31 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 |1.0...U....AU1.0| -00000240 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 |...U....Some-Sta| -00000250 74 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 |te1!0...U....Int| -00000260 65 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 |ernet Widgits Pt| -00000270 79 20 4c 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca |y Ltd...........| -00000280 30 0c 06 03 55 1d 13 04 05 30 03 01 01 ff 30 0d |0...U....0....0.| -00000290 06 09 2a 86 48 86 f7 0d 01 01 05 05 00 03 81 81 |..*.H...........| -000002a0 00 08 6c 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 |..lE$.k.Y..R....| -000002b0 d7 87 9d 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 |...zdu.Z.f..+...| -000002c0 66 1f eb 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 |f..O8.n`....A..%| -000002d0 13 b1 18 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 |...z$.0.........| -000002e0 31 59 db 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a |1Y....x.PV\..Z-Z| -000002f0 5f 33 c4 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 |_3....u....R....| -00000300 1f 89 20 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 |.. _..........W.| -00000310 70 e8 26 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd |p.&mq..&n8P)l...| -00000320 d9 16 03 03 00 cd 0c 00 00 c9 03 00 17 41 04 77 |.............A.w| -00000330 87 a7 ad f6 f8 34 82 05 ef bb 14 6d c7 8b 7b 2a |.....4.....m..{*| -00000340 4d ca 41 65 58 3c 83 fa 4d ce 0c 74 46 85 fe 38 |M.AeX<..M..tF..8| -00000350 95 80 ee 7c c2 bf f2 be a3 c6 bf f3 aa 07 23 40 |...|..........#@| -00000360 7e cc 74 4a 4e 2e 69 af 6b e0 42 8a fc 41 be 04 |~.tJN.i.k.B..A..| -00000370 01 00 80 99 ed a8 3a ef 93 1b 4c 17 80 9e cc eb |......:...L.....| -00000380 da 39 fb c8 9a 73 e1 96 20 3e 41 fa 8b 1a b1 68 |.9...s.. >A....h| -00000390 cd 47 bc 4b 7b 0c 14 da 87 d3 36 09 5e 37 33 88 |.G.K{.....6.^73.| -000003a0 7f 88 07 87 46 ec e5 72 a8 59 92 07 fa 4d 02 dc |....F..r.Y...M..| -000003b0 bf 3a f5 e4 77 0b a6 85 ce 43 ee 1b 90 30 7f ec |.:..w....C...0..| -000003c0 88 79 f8 88 59 af 6b 7f 2d 88 de 92 cd c8 36 cf |.y..Y.k.-.....6.| -000003d0 ba b9 08 6a c4 3d d7 9a 48 50 e1 67 d0 62 a5 b3 |...j.=..HP.g.b..| -000003e0 b0 5f 2e 16 ee 4d 7d a2 cf d9 93 19 89 b7 64 0f |._...M}.......d.| -000003f0 0f 8e 3d 16 03 03 00 04 0e 00 00 00 |..=.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 40 00 00 00 00 00 00 00 00 00 00 |.....@..........| -00000060 00 00 00 00 00 00 f2 20 58 ec f1 88 a6 26 79 9d |....... X....&y.| -00000070 2e 9b 02 b5 5e da e2 c1 c5 8d c8 93 6f 6d 07 4e |....^.......om.N| -00000080 fa dd ee cb b1 ae c7 3b 09 b2 cc 64 7a cd 98 91 |.......;...dz...| -00000090 cb f8 3c 34 3b ed |..<4;.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 4c a1 8d bd 49 |..........@L...I| -00000010 33 d3 72 fb 2f 23 7e 11 29 fc d2 ff 9b 67 30 c8 |3.r./#~.)....g0.| -00000020 be c1 bc 51 6e 92 a5 f4 9d e3 b3 f9 d2 d4 c4 a5 |...Qn...........| -00000030 83 23 90 b3 17 00 35 18 c5 ef 8b 18 a3 cf ed 9d |.#....5.........| -00000040 a9 52 c9 11 0a c9 55 c2 76 df 78 |.R....U.v.x| ->>> Flow 5 (client to server) -00000000 17 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -00000010 00 00 00 00 00 60 40 d0 bf 8f ef 05 2b 89 d7 bb |.....`@.....+...| -00000020 27 d0 1f b2 cf c3 ff 8e be 69 16 a9 b3 03 e8 3c |'........i.....<| -00000030 30 1d 58 39 4a 15 03 03 00 30 00 00 00 00 00 00 |0.X9J....0......| -00000040 00 00 00 00 00 00 00 00 00 00 de 61 51 a1 3c fc |...........aQ.<.| -00000050 1c 7b e6 f2 7d e0 aa 80 2d 9c e9 22 09 5c dd 8a |.{..}...-..".\..| -00000060 55 cc c4 77 34 97 05 88 98 d3 |U..w4.....| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 deleted file mode 100644 index 73e34c0ce354b4006b36c3251adbfa07a688694d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-RSA-RC4 +++ /dev/null @@ -1,84 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 e8 ae 4c 97 41 |....Q...M....L.A| -00000010 78 0f 08 84 d4 4a 80 6d a2 e1 d0 67 40 8f 01 8b |x....J.m...g@...| -00000020 20 54 cb 28 16 52 04 fd 3c c2 84 20 30 96 f0 51 | T.(.R..<.. 0..Q| -00000030 72 86 6a d8 47 b9 47 e3 a4 ad 97 77 a9 77 1a f9 |r.j.G.G....w.w..| -00000040 ba 63 33 32 4f 43 09 1c e1 bd 1b 3b 00 05 00 00 |.c32OC.....;....| -00000050 05 ff 01 00 01 00 16 03 03 02 be 0b 00 02 ba 00 |................| -00000060 02 b7 00 02 b4 30 82 02 b0 30 82 02 19 a0 03 02 |.....0...0......| -00000070 01 02 02 09 00 85 b0 bb a4 8a 7f b8 ca 30 0d 06 |.............0..| -00000080 09 2a 86 48 86 f7 0d 01 01 05 05 00 30 45 31 0b |.*.H........0E1.| -00000090 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 |0...U....AU1.0..| -000000a0 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 |.U....Some-State| -000000b0 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 |1!0...U....Inter| -000000c0 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 |net Widgits Pty | -000000d0 4c 74 64 30 1e 17 0d 31 30 30 34 32 34 30 39 30 |Ltd0...100424090| -000000e0 39 33 38 5a 17 0d 31 31 30 34 32 34 30 39 30 39 |938Z..1104240909| -000000f0 33 38 5a 30 45 31 0b 30 09 06 03 55 04 06 13 02 |38Z0E1.0...U....| -00000100 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000110 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000120 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -00000130 74 73 20 50 74 79 20 4c 74 64 30 81 9f 30 0d 06 |ts Pty Ltd0..0..| -00000140 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 |.*.H............| -00000150 30 81 89 02 81 81 00 bb 79 d6 f5 17 b5 e5 bf 46 |0.......y......F| -00000160 10 d0 dc 69 be e6 2b 07 43 5a d0 03 2d 8a 7a 43 |...i..+.CZ..-.zC| -00000170 85 b7 14 52 e7 a5 65 4c 2c 78 b8 23 8c b5 b4 82 |...R..eL,x.#....| -00000180 e5 de 1f 95 3b 7e 62 a5 2c a5 33 d6 fe 12 5c 7a |....;~b.,.3...\z| -00000190 56 fc f5 06 bf fa 58 7b 26 3f b5 cd 04 d3 d0 c9 |V.....X{&?......| -000001a0 21 96 4a c7 f4 54 9f 5a bf ef 42 71 00 fe 18 99 |!.J..T.Z..Bq....| -000001b0 07 7f 7e 88 7d 7d f1 04 39 c4 a2 2e db 51 c9 7c |..~.}}..9....Q.|| -000001c0 e3 c0 4c 3b 32 66 01 cf af b1 1d b8 71 9a 1d db |..L;2f......q...| -000001d0 db 89 6b ae da 2d 79 02 03 01 00 01 a3 81 a7 30 |..k..-y........0| -000001e0 81 a4 30 1d 06 03 55 1d 0e 04 16 04 14 b1 ad e2 |..0...U.........| -000001f0 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 88 |.Z..(.i.#i..&...| -00000200 39 30 75 06 03 55 1d 23 04 6e 30 6c 80 14 b1 ad |90u..U.#.n0l....| -00000210 e2 85 5a cf cb 28 db 69 ce 23 69 de d3 26 8e 18 |..Z..(.i.#i..&..| -00000220 88 39 a1 49 a4 47 30 45 31 0b 30 09 06 03 55 04 |.9.I.G0E1.0...U.| -00000230 06 13 02 41 55 31 13 30 11 06 03 55 04 08 13 0a |...AU1.0...U....| -00000240 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f 06 03 |Some-State1!0...| -00000250 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 57 69 |U....Internet Wi| -00000260 64 67 69 74 73 20 50 74 79 20 4c 74 64 82 09 00 |dgits Pty Ltd...| -00000270 85 b0 bb a4 8a 7f b8 ca 30 0c 06 03 55 1d 13 04 |........0...U...| -00000280 05 30 03 01 01 ff 30 0d 06 09 2a 86 48 86 f7 0d |.0....0...*.H...| -00000290 01 01 05 05 00 03 81 81 00 08 6c 45 24 c7 6b b1 |..........lE$.k.| -000002a0 59 ab 0c 52 cc f2 b0 14 d7 87 9d 7a 64 75 b5 5a |Y..R.......zdu.Z| -000002b0 95 66 e4 c5 2b 8e ae 12 66 1f eb 4f 38 b3 6e 60 |.f..+...f..O8.n`| -000002c0 d3 92 fd f7 41 08 b5 25 13 b1 18 7a 24 fb 30 1d |....A..%...z$.0.| -000002d0 ba ed 98 b9 17 ec e7 d7 31 59 db 95 d3 1d 78 ea |........1Y....x.| -000002e0 50 56 5c d5 82 5a 2d 5a 5f 33 c4 b6 d8 c9 75 90 |PV\..Z-Z_3....u.| -000002f0 96 8c 0f 52 98 b5 cd 98 1f 89 20 5f f2 a0 1c a3 |...R...... _....| -00000300 1b 96 94 dd a9 fd 57 e9 70 e8 26 6d 71 99 9b 26 |......W.p.&mq..&| -00000310 6e 38 50 29 6c 90 a7 bd d9 16 03 03 00 04 0e 00 |n8P)l...........| -00000320 00 00 |..| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 6d 51 f3 7f f9 |...........mQ...| -00000010 3e fb 75 82 41 36 83 e8 6a ee 2a 2e 25 90 67 4c |>.u.A6..j.*.%.gL| -00000020 8e 62 2f 30 81 17 e0 85 09 0c 2b b7 23 d7 b0 e2 |.b/0......+.#...| -00000030 1d f7 3b d7 f5 a1 27 b6 ee 24 b6 1b cc 5b ea 66 |..;...'..$...[.f| -00000040 0d 6a f4 e5 85 f9 da 43 b4 0e 86 85 e1 f5 aa be |.j.....C........| -00000050 c8 ce 39 4c 9c 86 00 08 c2 4b e2 c6 ec 2f f7 ce |..9L.....K.../..| -00000060 e6 bd 77 82 6f 23 b6 e0 bd a2 92 b7 3a ac e8 56 |..w.o#......:..V| -00000070 f1 af 54 5e 46 87 e9 3b 33 e7 b8 28 b7 d6 c8 90 |..T^F..;3..(....| -00000080 35 d4 1c 43 d1 30 6f 55 4e 0a 70 14 03 03 00 01 |5..C.0oUN.p.....| -00000090 01 16 03 03 00 24 54 8c 7f 71 03 7c 98 e5 97 65 |.....$T..q.|...e| -000000a0 51 13 b2 9d 4a b8 c9 c1 e6 11 1b 50 c8 1b c0 46 |Q...J......P...F| -000000b0 a7 cb 13 97 92 a0 51 d4 a9 e5 |......Q...| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 37 ca ae 55 79 |..........$7..Uy| -00000010 e7 0a 70 55 1e d1 76 61 57 46 d2 c0 d0 ed 3d 70 |..pU..vaWF....=p| -00000020 1f 02 f2 06 5b 3e 50 ec 13 4b 67 e2 7c bd 45 |....[>P..Kg.|.E| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1a c4 13 68 ec e0 38 a1 07 35 da d7 |.......h..8..5..| -00000010 c4 6b f9 5c ed a7 8a cb 96 7a 22 7c ca a5 30 15 |.k.\.....z"|..0.| -00000020 03 03 00 16 f7 a7 8d 41 b0 c1 4b 61 60 b0 b2 ed |.......A..Ka`...| -00000030 4a ab c3 54 d5 20 eb 67 b7 8f |J..T. .g..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT deleted file mode 100644 index 826c9f0a579cdacfc83b3923bba61b4fb658dd02..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Client-TLSv12-SCT +++ /dev/null @@ -1,118 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 81 01 00 00 7d 03 03 00 00 00 00 00 |........}.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 1e c0 2f |.............../| -00000030 c0 2b c0 30 c0 2c c0 11 c0 07 c0 13 c0 09 c0 14 |.+.0.,..........| -00000040 c0 0a 00 05 00 2f 00 35 c0 12 00 0a 01 00 00 36 |...../.5.......6| -00000050 00 05 00 05 01 00 00 00 00 00 0a 00 08 00 06 00 |................| -00000060 17 00 18 00 19 00 0b 00 02 01 00 00 0d 00 0e 00 |................| -00000070 0c 04 01 04 03 05 01 05 03 02 01 02 03 ff 01 00 |................| -00000080 01 00 00 12 00 00 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 01 c6 02 00 01 c2 03 03 1b f6 69 c1 c2 |.............i..| -00000010 36 77 72 32 69 95 c9 e7 db 9b 5d bd 59 ba 08 02 |6wr2i.....].Y...| -00000020 1e 76 11 c4 8e 49 08 22 8e 8a 5a 20 44 ec d9 13 |.v...I."..Z D...| -00000030 23 ad 05 45 48 29 00 c6 11 3d 5a 5c a1 ee 34 2b |#..EH)...=Z\..4+| -00000040 58 ef 34 5b 7e 42 08 84 23 66 56 ee c0 2f 00 01 |X.4[~B..#fV../..| -00000050 7a ff 01 00 01 00 00 0b 00 04 03 00 01 02 00 12 |z...............| -00000060 01 69 01 67 00 75 00 a4 b9 09 90 b4 18 58 14 87 |.i.g.u.......X..| -00000070 bb 13 a2 cc 67 70 0a 3c 35 98 04 f9 1b df b8 e3 |....gp.<5.......| -00000080 77 cd 0e c8 0d dc 10 00 00 01 47 97 99 ee 16 00 |w.........G.....| -00000090 00 04 03 00 46 30 44 02 20 1c 4b 82 5d 95 6e 67 |....F0D. .K.].ng| -000000a0 5b db 04 95 4b f6 ce f4 32 3e 86 7a 7a 32 ab 18 |[...K...2>.zz2..| -000000b0 60 74 de 08 da 05 91 4c 2f 02 20 73 54 1b 6e 7f |`t.....L/. sT.n.| -000000c0 a1 b0 7d 11 bc e6 f3 85 2f 97 66 1a f7 8a e4 10 |..}...../.f.....| -000000d0 25 8f 12 f4 6f 39 0f d2 9e 18 f0 00 76 00 68 f6 |%...o9......v.h.| -000000e0 98 f8 1f 64 82 be 3a 8c ee b9 28 1d 4c fc 71 51 |...d..:...(.L.qQ| -000000f0 5d 67 93 d4 44 d1 0a 67 ac bb 4f 4f fb c4 00 00 |]g..D..g..OO....| -00000100 01 47 97 e1 b5 70 00 00 04 03 00 47 30 45 02 20 |.G...p.....G0E. | -00000110 32 21 14 38 06 d8 72 2e 00 30 64 1a e2 e8 6d 4e |2!.8..r..0d...mN| -00000120 5a e1 d9 42 1e 82 4b 96 25 89 d5 26 13 d3 9c fa |Z..B..K.%..&....| -00000130 02 21 00 8f 12 28 64 51 4f 44 d5 8c 18 62 23 b2 |.!...(dQOD...b#.| -00000140 43 93 33 05 f3 43 55 a1 d9 ee cd c5 71 35 91 dd |C.3..CU.....q5..| -00000150 49 d1 0b 00 76 00 ee 4b bd b7 75 ce 60 ba e1 42 |I...v..K..u.`..B| -00000160 69 1f ab e1 9e 66 a3 0f 7e 5f b0 72 d8 83 00 c4 |i....f..~_.r....| -00000170 7b 89 7a a8 fd cb 00 00 01 48 5c 64 8a 87 00 00 |{.z......H\d....| -00000180 04 03 00 47 30 45 02 20 29 89 d6 b0 53 d3 d2 e9 |...G0E. )...S...| -00000190 91 bc f1 b5 40 be 1e 2e e7 5c b4 74 27 ed 8f 9b |....@....\.t'...| -000001a0 02 e9 fa c2 4c ba a2 be 02 21 00 af 43 64 52 71 |....L....!..CdRq| -000001b0 15 29 58 40 91 c7 08 16 96 03 a8 73 a5 65 a0 6c |.)X@.......s.e.l| -000001c0 b8 48 56 5a b6 29 83 64 6d 2a 9d 16 03 03 02 be |.HVZ.).dm*......| -000001d0 0b 00 02 ba 00 02 b7 00 02 b4 30 82 02 b0 30 82 |..........0...0.| -000001e0 02 19 a0 03 02 01 02 02 09 00 85 b0 bb a4 8a 7f |................| -000001f0 b8 ca 30 0d 06 09 2a 86 48 86 f7 0d 01 01 05 05 |..0...*.H.......| -00000200 00 30 45 31 0b 30 09 06 03 55 04 06 13 02 41 55 |.0E1.0...U....AU| -00000210 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d 65 2d |1.0...U....Some-| -00000220 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a 13 18 |State1!0...U....| -00000230 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 74 73 |Internet Widgits| -00000240 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 30 30 34 | Pty Ltd0...1004| -00000250 32 34 30 39 30 39 33 38 5a 17 0d 31 31 30 34 32 |24090938Z..11042| -00000260 34 30 39 30 39 33 38 5a 30 45 31 0b 30 09 06 03 |4090938Z0E1.0...| -00000270 55 04 06 13 02 41 55 31 13 30 11 06 03 55 04 08 |U....AU1.0...U..| -00000280 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 30 1f |..Some-State1!0.| -00000290 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 74 20 |..U....Internet | -000002a0 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 64 30 |Widgits Pty Ltd0| -000002b0 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 |..0...*.H.......| -000002c0 00 03 81 8d 00 30 81 89 02 81 81 00 bb 79 d6 f5 |.....0.......y..| -000002d0 17 b5 e5 bf 46 10 d0 dc 69 be e6 2b 07 43 5a d0 |....F...i..+.CZ.| -000002e0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 65 4c 2c 78 b8 |.-.zC...R..eL,x.| -000002f0 23 8c b5 b4 82 e5 de 1f 95 3b 7e 62 a5 2c a5 33 |#........;~b.,.3| -00000300 d6 fe 12 5c 7a 56 fc f5 06 bf fa 58 7b 26 3f b5 |...\zV.....X{&?.| -00000310 cd 04 d3 d0 c9 21 96 4a c7 f4 54 9f 5a bf ef 42 |.....!.J..T.Z..B| -00000320 71 00 fe 18 99 07 7f 7e 88 7d 7d f1 04 39 c4 a2 |q......~.}}..9..| -00000330 2e db 51 c9 7c e3 c0 4c 3b 32 66 01 cf af b1 1d |..Q.|..L;2f.....| -00000340 b8 71 9a 1d db db 89 6b ae da 2d 79 02 03 01 00 |.q.....k..-y....| -00000350 01 a3 81 a7 30 81 a4 30 1d 06 03 55 1d 0e 04 16 |....0..0...U....| -00000360 04 14 b1 ad e2 85 5a cf cb 28 db 69 ce 23 69 de |......Z..(.i.#i.| -00000370 d3 26 8e 18 88 39 30 75 06 03 55 1d 23 04 6e 30 |.&...90u..U.#.n0| -00000380 6c 80 14 b1 ad e2 85 5a cf cb 28 db 69 ce 23 69 |l......Z..(.i.#i| -00000390 de d3 26 8e 18 88 39 a1 49 a4 47 30 45 31 0b 30 |..&...9.I.G0E1.0| -000003a0 09 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 |...U....AU1.0...| -000003b0 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 |U....Some-State1| -000003c0 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e |!0...U....Intern| -000003d0 65 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c |et Widgits Pty L| -000003e0 74 64 82 09 00 85 b0 bb a4 8a 7f b8 ca 30 0c 06 |td...........0..| -000003f0 03 55 1d 13 04 05 30 03 01 01 ff 30 0d 06 09 2a |.U....0....0...*| -00000400 86 48 86 f7 0d 01 01 05 05 00 03 81 81 00 08 6c |.H.............l| -00000410 45 24 c7 6b b1 59 ab 0c 52 cc f2 b0 14 d7 87 9d |E$.k.Y..R.......| -00000420 7a 64 75 b5 5a 95 66 e4 c5 2b 8e ae 12 66 1f eb |zdu.Z.f..+...f..| -00000430 4f 38 b3 6e 60 d3 92 fd f7 41 08 b5 25 13 b1 18 |O8.n`....A..%...| -00000440 7a 24 fb 30 1d ba ed 98 b9 17 ec e7 d7 31 59 db |z$.0.........1Y.| -00000450 95 d3 1d 78 ea 50 56 5c d5 82 5a 2d 5a 5f 33 c4 |...x.PV\..Z-Z_3.| -00000460 b6 d8 c9 75 90 96 8c 0f 52 98 b5 cd 98 1f 89 20 |...u....R...... | -00000470 5f f2 a0 1c a3 1b 96 94 dd a9 fd 57 e9 70 e8 26 |_..........W.p.&| -00000480 6d 71 99 9b 26 6e 38 50 29 6c 90 a7 bd d9 16 03 |mq..&n8P)l......| -00000490 03 00 cd 0c 00 00 c9 03 00 17 41 04 d7 61 5b 05 |..........A..a[.| -000004a0 de 22 d3 3d 00 72 a5 be 0a c1 76 94 a1 34 41 6e |.".=.r....v..4An| -000004b0 55 f2 74 91 d2 6f 5c 47 87 c8 4b eb ab ab 10 b9 |U.t..o\G..K.....| -000004c0 f9 0a bc 63 03 5f 90 5b e3 6f e1 44 97 cc bf d2 |...c._.[.o.D....| -000004d0 e8 0d f5 9c 2e 9d 07 2c b2 00 90 0b 04 01 00 80 |.......,........| -000004e0 67 3d c7 73 42 b9 b2 fd 4b dd 02 57 87 95 20 75 |g=.sB...K..W.. u| -000004f0 da c1 e7 d3 33 09 01 5d e9 32 d7 20 7f 92 a9 dd |....3..].2. ....| -00000500 bb 17 c5 ee f2 07 b2 04 1d 5e 1f c2 41 66 3f 14 |.........^..Af?.| -00000510 90 cd 84 ac 49 46 04 3e ce 89 7d 79 42 2a 8c 56 |....IF.>..}yB*.V| -00000520 93 d3 9c 3b 57 38 9e 91 af 62 ad 86 40 29 3d 46 |...;W8...b..@)=F| -00000530 c7 cc f4 3f a1 7d ee 53 3d 94 1c 85 b9 1d a9 5f |...?.}.S=......_| -00000540 10 8e ee 38 5e 98 5d 39 31 79 83 cd f9 02 a8 a9 |...8^.]91y......| -00000550 b8 82 21 33 40 ed 27 54 a3 6e 64 cb e9 ce dd e1 |..!3@.'T.nd.....| -00000560 16 03 03 00 04 0e 00 00 00 |.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 1e 18 37 ef 0d |....F...BA...7..| -00000010 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -00000020 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -00000030 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000040 a6 b5 68 1a 41 03 56 6b dc 5a 89 14 03 03 00 01 |..h.A.Vk.Z......| -00000050 01 16 03 03 00 28 00 00 00 00 00 00 00 00 60 0e |.....(........`.| -00000060 49 99 7a 9f 28 6e 46 03 a8 fd 0e b7 ed bb 9c ba |I.z.(nF.........| -00000070 07 9c 4d cc 26 2b c2 70 a0 26 38 a0 f2 a0 |..M.&+.p.&8...| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 d2 ef 8f f4 7b |..........(....{| -00000010 7a 9b c8 98 a4 36 f2 be 61 46 0e af f4 6f 63 71 |z....6..aF...ocq| -00000020 6e bd 87 ea 1b f2 95 ad 36 7d a3 52 7f b2 b6 45 |n.......6}.R...E| -00000030 3f 0b 62 |?.b| ->>> Flow 5 (client to server) -00000000 17 03 03 00 1e 00 00 00 00 00 00 00 01 53 a1 85 |.............S..| -00000010 ce 3c c1 64 39 80 fb db 67 ec 48 20 7f e9 82 f4 |.<.d9...g.H ....| -00000020 2d 69 0a 15 03 03 00 1a 00 00 00 00 00 00 00 02 |-i..............| -00000030 ab 78 11 1b 80 55 23 db 07 c5 7f c3 5e 19 d8 b3 |.x...U#.....^...| -00000040 f8 c6 |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-3DES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-3DES deleted file mode 100644 index 20520f542d4923ecafe64f137fc53def751dbea0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-3DES +++ /dev/null @@ -1,78 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 00 00 2f 01 00 00 2b 03 00 10 71 68 59 99 |..../...+...qhY.| -00000010 9c a6 e7 36 8b 0d 03 be f5 42 ab 7c d0 3b 76 3e |...6.....B.|.;v>| -00000020 46 7c 6c a3 94 09 b7 1b 0e 42 27 00 00 04 00 0a |F|l......B'.....| -00000030 00 ff 01 00 |....| ->>> Flow 2 (server to client) -00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 00 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 00 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 00 00 84 10 00 00 80 1b 62 18 c8 60 0b f7 |..........b..`..| -00000010 4a b8 ec 98 56 eb aa 4b d9 05 c0 f1 be b9 a5 28 |J...V..K.......(| -00000020 62 e8 3e 25 08 9f 28 dd 08 1f 04 80 5f 10 81 cf |b.>%..(....._...| -00000030 aa 2f 55 cd f1 0f ec 5b 90 0a 1f 49 bc a3 96 38 |./U....[...I...8| -00000040 c7 32 b6 0a da b3 a5 7a 76 28 82 19 30 f4 6b ae |.2.....zv(..0.k.| -00000050 fb 81 cc b4 ad 92 f8 c6 20 da 27 89 45 f4 43 c2 |........ .'.E.C.| -00000060 16 7e de 29 03 dc 90 dd 3a 23 58 4c 35 be 11 a5 |.~.)....:#XL5...| -00000070 52 18 79 13 e6 b3 2d e6 8e f5 76 60 0c c1 92 bb |R.y...-...v`....| -00000080 07 67 c5 24 12 1b aa d6 53 14 03 00 00 01 01 16 |.g.$....S.......| -00000090 03 00 00 40 5f 64 da b6 24 19 07 44 32 85 f3 c0 |...@_d..$..D2...| -000000a0 9b c6 2c ad b1 d1 0f 4b 52 20 2f ea 6f 15 80 44 |..,....KR /.o..D| -000000b0 78 34 44 02 67 e0 2e b4 b8 df 7b 3f 21 dd 66 9b |x4D.g.....{?!.f.| -000000c0 e7 5f 71 ff 5f 30 fb 5b 5a 19 f0 24 f8 21 bc 7c |._q._0.[Z..$.!.|| -000000d0 00 e1 1f e8 |....| ->>> Flow 4 (server to client) -00000000 14 03 00 00 01 01 16 03 00 00 40 48 01 fc 08 a0 |..........@H....| -00000010 fa 0e 63 58 25 18 06 3c 54 5c 60 ce 35 f6 ec b8 |..cX%...| -000000b0 b3 fa |..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-AES deleted file mode 100644 index e0fe95658dac3653b0a02707289e1b05436cb507..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-AES +++ /dev/null @@ -1,79 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 00 00 2f 01 00 00 2b 03 00 37 cd 49 a6 9f |..../...+..7.I..| -00000010 e9 19 6a 39 cd 75 ce 6c f1 1b 96 d3 d4 f0 33 0c |..j9.u.l......3.| -00000020 8f 53 b2 06 c4 0e 39 86 e3 98 7e 00 00 04 00 2f |.S....9...~..../| -00000030 00 ff 01 00 |....| ->>> Flow 2 (server to client) -00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 00 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 00 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 00 00 84 10 00 00 80 4d 3f 93 aa 84 d8 ad |.........M?.....| -00000010 93 2c 63 02 66 2f 96 88 b8 5c 09 1e 63 e2 e5 96 |.,c.f/...\..c...| -00000020 26 d8 07 14 86 26 62 f4 0c 04 68 1c bf bb b1 53 |&....&b...h....S| -00000030 97 96 43 59 4a 57 65 12 88 45 34 2b 86 2b 05 aa |..CYJWe..E4+.+..| -00000040 9b 2b b9 aa 13 30 5c 91 c0 9f 03 8a 96 61 dd 87 |.+...0\......a..| -00000050 ae e3 ad 6a 7b 8a 18 23 67 c9 df ad f2 47 eb 8b |...j{..#g....G..| -00000060 7d 24 95 47 f1 4e b5 c6 15 b4 12 2a 42 df b3 99 |}$.G.N.....*B...| -00000070 d1 b8 60 ce 6a cf 98 c1 13 a1 68 e6 92 ee 92 a2 |..`.j.....h.....| -00000080 1d 2f 63 66 f3 b9 1b fc 33 14 03 00 00 01 01 16 |./cf....3.......| -00000090 03 00 00 40 75 48 68 7d 8f f5 5a c0 cb 90 a5 9e |...@uHh}..Z.....| -000000a0 94 bb eb 61 b5 36 aa ce 09 7a 11 ba 22 56 2a d7 |...a.6...z.."V*.| -000000b0 91 a3 99 73 5b c5 b2 b7 b9 92 56 c6 cb fe 13 73 |...s[.....V....s| -000000c0 28 30 03 26 62 63 7e 8a d2 58 c8 e7 52 03 26 67 |(0.&bc~..X..R.&g| -000000d0 48 21 4f 21 |H!O!| ->>> Flow 4 (server to client) -00000000 14 03 00 00 01 01 16 03 00 00 40 84 8f 6e 80 35 |..........@..n.5| -00000010 57 73 64 ef 29 bb 25 ff 5d 9d c7 55 38 b7 18 b3 |Wsd.).%.]..U8...| -00000020 13 d1 ac 20 e0 1e f8 48 47 7a 40 2d bc a7 f2 af |... ...HGz@-....| -00000030 ed a6 26 48 f4 51 b4 b6 56 60 9b c3 d9 43 00 95 |..&H.Q..V`...C..| -00000040 86 be 6c 4e 49 6b f9 10 99 51 22 17 03 00 00 20 |..lNIk...Q".... | -00000050 d4 7e dc 50 7b c2 26 ee 79 09 84 9f d7 e0 52 b1 |.~.P{.&.y.....R.| -00000060 e8 9c 92 30 b7 34 06 c6 e5 86 57 a1 fb 8d 06 d6 |...0.4....W.....| -00000070 17 03 00 00 30 93 0a 3d 64 26 3d a2 74 bc 8f d1 |....0..=d&=.t...| -00000080 16 38 d0 6b 62 eb 82 b0 9a 50 68 aa 7e f7 45 32 |.8.kb....Ph.~.E2| -00000090 43 cb 84 2d 95 39 6c bc c8 a0 2d aa ea fe f5 84 |C..-.9l...-.....| -000000a0 c8 e4 8b 93 a1 15 03 00 00 20 03 7b 3e 43 1d 0a |......... .{>C..| -000000b0 9b 9b e3 17 0f de be 75 e5 6e 2f 5b e8 8d a8 68 |.......u.n/[...h| -000000c0 4e f0 82 49 00 dd b6 95 b4 22 |N..I....."| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-RC4 deleted file mode 100644 index 39124c67ef17599532481192643d242c9fd89a5e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-SSLv3-RSA-RC4 +++ /dev/null @@ -1,74 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 00 00 2f 01 00 00 2b 03 00 a7 1d 3d ed 0f |..../...+....=..| -00000010 2c 7b 1f f1 c8 1c a9 17 ce 69 e2 73 a2 07 d2 91 |,{.......i.s....| -00000020 e9 27 fa 70 11 6f 18 6d 2a 25 f1 00 00 04 00 05 |.'.p.o.m*%......| -00000030 00 ff 01 00 |....| ->>> Flow 2 (server to client) -00000000 16 03 00 00 31 02 00 00 2d 03 00 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 00 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 00 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 00 00 84 10 00 00 80 25 85 a3 22 29 e4 fb |.........%..")..| -00000010 53 b9 a3 6b ed 70 2b 35 7f db 08 35 b8 4c 95 cd |S..k.p+5...5.L..| -00000020 00 ec 5e a1 2e ba e9 ac a6 d4 ef ca 74 a0 12 1b |..^.........t...| -00000030 a7 ec 76 22 2c 63 71 1a 3a 50 94 ce 96 c4 d7 76 |..v",cq.:P.....v| -00000040 1f 47 58 c7 57 98 af ea 7e 57 05 68 d3 f9 87 02 |.GX.W...~W.h....| -00000050 35 72 35 66 08 b4 cf 48 24 15 92 d5 ba 46 8d 60 |5r5f...H$....F.`| -00000060 5a 53 0b e4 9b 53 44 55 dc 77 d1 e4 e0 25 51 f6 |ZS...SDU.w...%Q.| -00000070 f1 7c 96 0b 32 d4 8c 04 d3 3d e6 70 c7 d6 60 a7 |.|..2....=.p..`.| -00000080 ae 69 22 69 41 1a 8d 12 67 14 03 00 00 01 01 16 |.i"iA...g.......| -00000090 03 00 00 3c 32 dd 86 fd 5b 53 74 ea 01 45 5b 9e |...<2...[St..E[.| -000000a0 32 d0 9d 27 e8 ce 4c d5 a1 c2 d3 2e 0a e9 e5 d2 |2..'..L.........| -000000b0 04 8c 77 a3 ff e9 8b 02 14 16 af 54 db ec c4 98 |..w........T....| -000000c0 72 50 f7 65 fa eb ac 11 07 81 d7 fa 4e 18 34 bc |rP.e........N.4.| ->>> Flow 4 (server to client) -00000000 14 03 00 00 01 01 16 03 00 00 3c 29 af 2c 96 3a |..........<).,.:| -00000010 be a0 91 a8 e4 66 6b 30 ba e2 80 fc a2 8a 09 b4 |.....fk0........| -00000020 28 14 3b 36 c2 3b 3e 88 e2 10 da 93 af 71 9a 06 |(.;6.;>......q..| -00000030 1c 8d 97 04 05 ec e2 69 cf 28 20 0f ec 4c a7 f3 |.......i.( ..L..| -00000040 18 4e 6b 5b 88 9c a9 17 03 00 00 21 5e 0b b4 2d |.Nk[.......!^..-| -00000050 a6 b5 0b 3a 86 de 8a e7 87 f3 4c f6 74 7e 0d 16 |...:......L.t~..| -00000060 9b fc 0c 42 6b f4 9e 15 8b 6a c5 97 88 15 03 00 |...Bk....j......| -00000070 00 16 f0 a4 e2 16 bf 81 05 ad 1d f5 1c 89 d9 ab |................| -00000080 48 23 ab 96 ea 92 aa cd |H#......| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES deleted file mode 100644 index f81ffc28c0e585f3c3e4882139ac4f2c079ee4ce..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-ECDHE-ECDSA-AES +++ /dev/null @@ -1,85 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 7d 01 00 00 79 03 01 65 14 3f 40 e4 |....}...y..e.?@.| -00000010 2f 74 65 7e d0 c8 87 03 59 61 9d c3 84 5e c9 62 |/te~....Ya...^.b| -00000020 e6 46 b8 0c 4a 5e 3f 33 43 a5 dd 00 00 04 c0 0a |.F..J^?3C.......| -00000030 00 ff 02 01 00 00 4b 00 0b 00 04 03 00 01 02 00 |......K.........| -00000040 0a 00 3a 00 38 00 0e 00 0d 00 19 00 1c 00 0b 00 |..:.8...........| -00000050 0c 00 1b 00 18 00 09 00 0a 00 1a 00 16 00 17 00 |................| -00000060 08 00 06 00 07 00 14 00 15 00 04 00 05 00 12 00 |................| -00000070 13 00 01 00 02 00 03 00 0f 00 10 00 11 00 0f 00 |................| -00000080 01 01 |..| ->>> Flow 2 (server to client) -00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 01 02 0e 0b 00 02 0a 00 |................| -00000040 02 07 00 02 04 30 82 02 00 30 82 01 62 02 09 00 |.....0...0..b...| -00000050 b8 bf 2d 47 a0 d2 eb f4 30 09 06 07 2a 86 48 ce |..-G....0...*.H.| -00000060 3d 04 01 30 45 31 0b 30 09 06 03 55 04 06 13 02 |=..0E1.0...U....| -00000070 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000080 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000090 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -000000a0 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 32 |ts Pty Ltd0...12| -000000b0 31 31 32 32 31 35 30 36 33 32 5a 17 0d 32 32 31 |1122150632Z..221| -000000c0 31 32 30 31 35 30 36 33 32 5a 30 45 31 0b 30 09 |120150632Z0E1.0.| -000000d0 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 55 |..U....AU1.0...U| -000000e0 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 |....Some-State1!| -000000f0 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 |0...U....Interne| -00000100 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 |t Widgits Pty Lt| -00000110 64 30 81 9b 30 10 06 07 2a 86 48 ce 3d 02 01 06 |d0..0...*.H.=...| -00000120 05 2b 81 04 00 23 03 81 86 00 04 00 c4 a1 ed be |.+...#..........| -00000130 98 f9 0b 48 73 36 7e c3 16 56 11 22 f2 3d 53 c3 |...Hs6~..V.".=S.| -00000140 3b 4d 21 3d cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc |;M!=.ku......&..| -00000150 b2 87 f0 72 32 7c b3 64 2f 1c 90 bc ea 68 23 10 |...r2|.d/....h#.| -00000160 7e fe e3 25 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 |~..%.H:i.(m.7...| -00000170 62 dd 0d a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 |b....pb....d1...| -00000180 31 bd 96 b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 |1...h..#.vd?.\..| -00000190 12 0e 58 58 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc |..XX._p.........| -000001a0 b9 b6 9f 30 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 |...0f[f. .'...;0| -000001b0 09 06 07 2a 86 48 ce 3d 04 01 03 81 8c 00 30 81 |...*.H.=......0.| -000001c0 88 02 42 01 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 |..B...O..E.H}...| -000001d0 ed 98 9d ae 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 |....Gp.^../...M.| -000001e0 61 40 d3 11 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b |a@......~.~.v..;| -000001f0 7e a5 3f ce fa 10 e2 59 ec 47 2d 7c ac da 4e 97 |~.?....Y.G-|..N.| -00000200 0e 15 a0 6f d0 02 42 01 4d fc be 67 13 9c 2d 05 |...o..B.M..g..-.| -00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7| -00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.| -00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1| -00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 01 00 d6 0c 00 |{j.9....*.......| -00000250 00 d2 03 00 17 41 04 1e 18 37 ef 0d 19 51 88 35 |.....A...7...Q.5| -00000260 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 3e |uq..T[....g..$ >| -00000270 b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f 6c |.V...(^.+-O....l| -00000280 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 1a |K[.V.2B.X..I..h.| -00000290 41 03 56 6b dc 5a 89 00 8b 30 81 88 02 42 01 3e |A.Vk.Z...0...B.>| -000002a0 79 81 6e 89 cd 3e 3f ec e4 b5 75 17 28 ee fb 09 |y.n..>?...u.(...| -000002b0 21 19 6f 3c e6 ca 1e f2 18 b6 47 f8 37 05 1c 85 |!.o<......G.7...| -000002c0 0f a4 b8 6b 40 04 50 77 e3 05 9b 24 b8 93 e8 4d |...k@.Pw...$...M| -000002d0 ef 30 cd 51 90 58 a2 49 71 b3 3f b9 46 ab a9 72 |.0.Q.X.Iq.?.F..r| -000002e0 02 42 01 58 ef 20 c1 0a 33 f8 fd 50 9e 65 f5 ef |.B.X. ..3..P.e..| -000002f0 f4 91 49 2d d2 de 66 2b 97 69 7d b1 d0 ef d6 91 |..I-..f+.i}.....| -00000300 0f fc 57 2b 73 b9 49 01 33 d2 1b 5b 9a 2c 51 35 |..W+s.I.3..[.,Q5| -00000310 0e eb 38 53 fa 20 07 84 52 b3 43 24 09 5a 32 c0 |..8S. ..R.C$.Z2.| -00000320 32 17 34 6c 16 03 01 00 04 0e 00 00 00 |2.4l.........| ->>> Flow 3 (client to server) -00000000 16 03 01 00 46 10 00 00 42 41 04 31 74 f8 f6 18 |....F...BA.1t...| -00000010 55 6a 9b 3b 78 0a 0e f0 c9 91 aa 8e 77 39 0a 88 |Uj.;x.......w9..| -00000020 a4 d4 f6 04 9d de 89 18 b6 50 12 72 26 9c 8f e1 |.........P.r&...| -00000030 f0 b2 e6 df ce 3b 46 be e9 2a 9a e3 7f d1 d5 92 |.....;F..*......| -00000040 ff e3 ae 0a 2d a1 3b 07 f6 04 59 14 03 01 00 01 |....-.;...Y.....| -00000050 01 16 03 01 00 30 02 4f df 41 30 97 6f f7 18 ca |.....0.O.A0.o...| -00000060 05 35 17 a1 a2 a5 71 61 b1 d8 dd 9a c6 f3 54 53 |.5....qa......TS| -00000070 84 f6 fb 93 1e 0e 9d e7 fe 35 85 9e 73 d0 2e a1 |.........5..s...| -00000080 a7 63 d9 40 c6 ac |.c.@..| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 07 7e 4e 9c 19 |..........0.~N..| -00000010 f0 35 cd 02 b7 a6 0a 1a b1 a8 11 a3 f9 b1 35 7b |.5............5{| -00000020 96 7f e6 e1 00 c6 6d 9e e6 8a bb a2 b8 bd a3 9d |......m.........| -00000030 05 22 1b f1 f5 28 4a 00 6e f1 71 17 03 01 00 20 |."...(J.n.q.... | -00000040 ad c7 4c dc f4 81 1a 39 3d 86 5e 8e f5 0d a3 33 |..L....9=.^....3| -00000050 88 32 e7 be 8b 6a 8d 44 29 7b 47 fd e5 33 01 1e |.2...j.D){G..3..| -00000060 17 03 01 00 30 61 47 ee ae 89 25 ac 85 3b 8a 84 |....0aG...%..;..| -00000070 47 61 ea 3e 4c 70 57 07 d6 f1 1c 21 cb 44 7e de |Ga.>LpW....!.D~.| -00000080 b5 01 9e fb fe ad bc be 74 c0 65 a0 6b c1 0c 8c |........t.e.k...| -00000090 2b 00 24 c6 b7 15 03 01 00 20 b7 8b 6b e5 77 ab |+.$...... ..k.w.| -000000a0 f6 50 9e 88 4d 56 a8 25 8d 02 db cb 68 8b 3f 62 |.P..MV.%....h.?b| -000000b0 be aa 02 24 75 b1 e5 4b 18 c9 |...$u..K..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-3DES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-3DES deleted file mode 100644 index 55cb487d12a9835b91c8b76eb9d05d2118b36847..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-3DES +++ /dev/null @@ -1,74 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 36 01 00 00 32 03 01 35 4a e8 32 84 |....6...2..5J.2.| -00000010 51 68 04 7e d0 0f 43 94 c7 5d 44 d2 95 a3 12 63 |Qh.~..C..]D....c| -00000020 77 c5 ce 78 5a 25 a3 81 df c4 6b 00 00 04 00 0a |w..xZ%....k.....| -00000030 00 ff 01 00 00 05 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 01 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 01 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 01 00 86 10 00 00 82 00 80 1f 4d 12 64 f2 |............M.d.| -00000010 72 22 86 4a 16 05 3f d2 1b e5 ed a7 f1 19 c4 6d |r".J..?........m| -00000020 1d 3a 5c f6 46 8f b9 4d 9e c4 d4 19 95 0a 63 9f |.:\.F..M......c.| -00000030 8a 41 1f fc d5 98 45 ca 69 33 37 64 d5 c8 0e 5a |.A....E.i37d...Z| -00000040 12 9f 06 54 8a 61 8b 13 f0 d8 fb b9 97 fb cd 1d |...T.a..........| -00000050 bd 6c 88 cc 98 57 c3 66 3a 86 04 c9 b9 21 c6 f2 |.l...W.f:....!..| -00000060 f3 43 7d 4e bf 28 d5 a2 d7 39 e0 78 cb eb b4 af |.C}N.(...9.x....| -00000070 21 0e ae 4c 16 9b b3 49 5f 81 02 55 59 97 d9 d2 |!..L...I_..UY...| -00000080 c4 e2 4c be 0a a6 41 62 48 1d 66 14 03 01 00 01 |..L...AbH.f.....| -00000090 01 16 03 01 00 28 9d e0 c3 31 82 c2 48 5d fb 47 |.....(...1..H].G| -000000a0 85 60 d4 17 d2 4f 4d 3c 64 db e4 49 1f a9 66 93 |.`...OM>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 28 94 66 8f ad 8f |..........(.f...| -00000010 9f 00 72 f6 af 51 47 67 63 df 3f dd 17 09 0a c5 |..r..QGgc.?.....| -00000020 bf f8 4d 66 39 f9 b5 47 01 f8 e8 6d ed b4 17 39 |..Mf9..G...m...9| -00000030 ff 0a ca 17 03 01 00 18 68 93 94 51 12 b9 17 0b |........h..Q....| -00000040 d1 a0 22 fc cc c4 76 1a 1e 02 c6 20 5e 74 83 4c |.."...v.... ^t.L| -00000050 17 03 01 00 28 08 bd 86 07 84 90 78 bd 1d 90 ce |....(......x....| -00000060 09 80 bb d8 de fd 39 82 4b c4 0d 06 f3 65 f5 5b |......9.K....e.[| -00000070 3d c3 fd 69 80 1f 51 ce 1d 98 f1 05 fa 15 03 01 |=..i..Q.........| -00000080 00 18 ed 48 04 21 85 77 d7 b6 29 e3 25 af ea ec |...H.!.w..).%...| -00000090 3e 41 82 a0 ca 7d 44 79 8a 0b |>A...}Dy..| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-AES deleted file mode 100644 index 46713022890f527cb1031bddcc51d97376a6d7c4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv10-RSA-AES +++ /dev/null @@ -1,77 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 36 01 00 00 32 03 01 8c 5a 87 31 6a |....6...2...Z.1j| -00000010 8c 7a d5 26 4b 94 17 27 fc a2 c0 5f b5 bc 3f 10 |.z.&K..'..._..?.| -00000020 80 0e e0 1e 36 80 4b 91 61 77 d4 00 00 04 00 2f |....6.K.aw...../| -00000030 00 ff 01 00 00 05 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 01 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 01 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 01 00 86 10 00 00 82 00 80 31 f5 2e e4 c7 |...........1....| -00000010 f5 76 d6 f7 2d 1b 8d 4d a9 2a 43 84 b2 0b 08 d6 |.v..-..M.*C.....| -00000020 4d d9 9a eb 4b 01 49 6e 11 45 43 0d 31 a7 c3 66 |M...K.In.EC.1..f| -00000030 da 1c 92 68 fb 3d 36 27 94 2f 67 ae 3d 31 a3 8f |...h.=6'./g.=1..| -00000040 01 5a d9 17 92 bc 20 7c cb ae b4 ca 4c ce d4 a9 |.Z.... |....L...| -00000050 2c 1d fe fc 3c a9 14 31 1d 65 08 d8 6e 8d ac 9d |,...<..1.e..n...| -00000060 21 ee 63 4a e2 da 3c 0e b1 34 8f 6e 20 dd d4 d4 |!.cJ..<..4.n ...| -00000070 d8 16 27 5d 02 54 e6 ec 5f 43 84 5b 21 24 ef 5d |..'].T.._C.[!$.]| -00000080 45 c4 2b 2c 98 7d 50 dc 0b fc 76 14 03 01 00 01 |E.+,.}P...v.....| -00000090 01 16 03 01 00 30 ef 50 ea 3c e3 b7 a8 5b 9a d2 |.....0.P.<...[..| -000000a0 11 69 0f d0 5e 79 c8 cb 68 4a ac 16 ef b4 de 1f |.i..^y..hJ......| -000000b0 21 0b 8e 91 cb 70 3f 02 bd 45 c1 34 02 e0 66 8a |!....p?..E.4..f.| -000000c0 00 ea 6c 5a 96 41 |..lZ.A| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 30 99 2c 65 32 5f |..........0.,e2_| -00000010 53 37 d8 c2 98 87 f4 68 b6 d7 52 6a 14 c7 df 6e |S7.....h..Rj...n| -00000020 bb ce ae 31 d4 04 24 4d e9 c2 39 7b 68 a7 fa 90 |...1..$M..9{h...| -00000030 c1 30 14 a2 20 c0 8d e1 2a dc 22 17 03 01 00 20 |.0.. ...*.".... | -00000040 41 c5 03 05 20 53 e9 fa 0a 26 38 ab 84 6a 5e 36 |A... S...&8..j^6| -00000050 1b 03 80 2f c3 5c 0b 2c bd 7f 79 68 bb ab 4d 70 |.../.\.,..yh..Mp| -00000060 17 03 01 00 30 a1 04 3e f4 a2 54 7a e7 09 0f 20 |....0..>..Tz... | -00000070 38 f8 9e bb 1b 61 28 bf 46 e8 75 56 b4 c3 93 b9 |8....a(.F.uV....| -00000080 8c 18 3e 8e af 9f 59 1a 96 be db 61 80 56 c6 09 |..>...Y....a.V..| -00000090 3c 21 02 37 d2 15 03 01 00 20 13 d1 81 7d ca 04 |>> Flow 1 (client to server) -00000000 16 03 01 00 36 01 00 00 32 03 01 c5 fc 32 c0 09 |....6...2....2..| -00000010 47 0b a9 f3 72 c9 6c 3a e0 94 33 48 35 ac b9 3b |G...r.l:..3H5..;| -00000020 da 5f 8b 6e 0c 54 c3 16 f0 39 bd 00 00 04 00 05 |._.n.T...9......| -00000030 00 ff 01 00 00 05 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 01 00 31 02 00 00 2d 03 01 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 01 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 01 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 01 00 86 10 00 00 82 00 80 6a ad 7f e3 26 |...........j...&| -00000010 71 da 48 af 11 63 de 2e e8 50 f9 6a be 04 3d 17 |q.H..c...P.j..=.| -00000020 d1 29 fe 2c 7f b6 26 c1 7e 0b 18 1c 41 62 5c 91 |.).,..&.~...Ab\.| -00000030 ee 26 9c 92 f5 d1 e9 29 e1 ca a7 01 6a 41 b9 00 |.&.....)....jA..| -00000040 34 1d 5b c6 28 0e 1a 8f 32 c5 03 e7 a1 8f 89 1b |4.[.(...2.......| -00000050 af 13 22 2b 5b e8 76 2d 00 ac da 27 75 95 75 e7 |.."+[.v-...'u.u.| -00000060 00 00 39 2c bf f2 01 57 e6 29 e3 26 b1 6b ae c5 |..9,...W.).&.k..| -00000070 8d ce d2 36 b2 94 1f 9c 30 5e b2 16 3d 20 cf 4d |...6....0^..= .M| -00000080 88 f5 ac 4c 27 e3 f5 86 ef 9e dc 14 03 01 00 01 |...L'...........| -00000090 01 16 03 01 00 24 48 d8 80 c4 37 22 31 99 53 30 |.....$H...7"1.S0| -000000a0 5b 00 07 7e 87 2e 59 9a d9 0c 42 9e dd ed da 89 |[..~..Y...B.....| -000000b0 1a 1f cb ab 55 0c ba d9 a9 c0 |....U.....| ->>> Flow 4 (server to client) -00000000 14 03 01 00 01 01 16 03 01 00 24 ae 00 c8 14 67 |..........$....g| -00000010 4b b5 21 96 98 91 d6 27 40 9b 5e a5 86 53 56 f3 |K.!....'@.^..SV.| -00000020 f6 dc 7e b2 49 78 4b 4d 57 7c 62 a5 f2 16 8f 17 |..~.IxKMW|b.....| -00000030 03 01 00 21 34 e3 48 58 1c 67 fb 3a 46 28 5d a1 |...!4.HX.g.:F(].| -00000040 19 66 58 b1 bb fb e7 17 71 07 3f 0a d0 7c c9 24 |.fX.....q.?..|.$| -00000050 c7 ef 41 af 62 15 03 01 00 16 dd dc 16 dc 16 cc |..A.b...........| -00000060 0d f3 2c 29 00 c0 4f 01 68 05 92 a0 f7 ad e2 63 |..,)..O.h......c| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-FallbackSCSV b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-FallbackSCSV deleted file mode 100644 index 2d8dfbc3b491e1bdbfd4f1c5ec332679dfa7a010..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-FallbackSCSV +++ /dev/null @@ -1,17 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 d4 01 00 00 d0 03 02 74 2d da 6d 98 |...........t-.m.| -00000010 ad 3e a5 ec 90 ea d1 5b f0 e0 a7 45 33 d9 5e 8d |.>.....[...E3.^.| -00000020 0f 1d 01 16 6d 00 31 65 ed 50 88 00 00 5e c0 14 |....m.1e.P...^..| -00000030 c0 0a 00 39 00 38 00 88 00 87 c0 0f c0 05 00 35 |...9.8.........5| -00000040 00 84 c0 13 c0 09 00 33 00 32 00 9a 00 99 00 45 |.......3.2.....E| -00000050 00 44 c0 0e c0 04 00 2f 00 96 00 41 00 07 c0 11 |.D...../...A....| -00000060 c0 07 c0 0c c0 02 00 05 00 04 c0 12 c0 08 00 16 |................| -00000070 00 13 c0 0d c0 03 00 0a 00 15 00 12 00 09 00 14 |................| -00000080 00 11 00 08 00 06 00 03 00 ff 56 00 01 00 00 49 |..........V....I| -00000090 00 0b 00 04 03 00 01 02 00 0a 00 34 00 32 00 0e |...........4.2..| -000000a0 00 0d 00 19 00 0b 00 0c 00 18 00 09 00 0a 00 16 |................| -000000b0 00 17 00 08 00 06 00 07 00 14 00 15 00 04 00 05 |................| -000000c0 00 12 00 13 00 01 00 02 00 03 00 0f 00 10 00 11 |................| -000000d0 00 23 00 00 00 0f 00 01 01 |.#.......| ->>> Flow 2 (server to client) -00000000 15 03 02 00 02 02 56 |......V| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-RSA-RC4 deleted file mode 100644 index dc5e765e5438ae0f1823d8098811be05f93c9eaa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv11-RSA-RC4 +++ /dev/null @@ -1,71 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 36 01 00 00 32 03 02 ff e1 a1 04 0b |....6...2.......| -00000010 c2 dc fb 7d 07 61 44 9b 00 67 fe 38 73 f5 fc 4e |...}.aD..g.8s..N| -00000020 35 94 0a d5 c1 d0 e7 54 dc 44 1f 00 00 04 00 05 |5......T.D......| -00000030 00 ff 01 00 00 05 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 02 00 31 02 00 00 2d 03 02 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 02 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 02 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 02 00 86 10 00 00 82 00 80 4c e0 4d 6a 19 |...........L.Mj.| -00000010 a2 72 2a 3d 41 14 a7 b3 0a 25 11 bf c9 9f cf 8c |.r*=A....%......| -00000020 3c 0b 01 49 aa f1 59 4b 60 ac e5 72 9b ec 20 41 |<..I..YK`..r.. A| -00000030 2f 7e ef bf e0 fe 13 c0 1d fd 51 c5 08 c6 9a 9e |/~........Q.....| -00000040 74 88 c7 e3 36 99 73 fd 00 2d a2 6a bd 25 f2 d7 |t...6.s..-.j.%..| -00000050 24 fd fd ab 0c e0 18 38 ba 7b f0 c9 c0 58 a6 d0 |$......8.{...X..| -00000060 4e e2 59 70 aa f4 52 34 12 a0 ec a4 53 1e 8b ee |N.Yp..R4....S...| -00000070 3e bf a4 87 da 02 4c 95 bd 10 af e8 88 c9 ce 87 |>.....L.........| -00000080 3c 9e 91 70 91 a0 85 18 84 e4 e0 14 03 02 00 01 |<..p............| -00000090 01 16 03 02 00 24 c5 c0 27 71 49 ad ed 37 e6 5d |.....$..'qI..7.]| -000000a0 1b 78 3e 74 15 b7 61 e5 f3 af 1e d0 a2 85 b3 13 |.x>t..a.........| -000000b0 6e 5e 9a c7 3d 47 32 4d 1b 8d |n^..=G2M..| ->>> Flow 4 (server to client) -00000000 14 03 02 00 01 01 16 03 02 00 24 31 22 76 4d 43 |..........$1"vMC| -00000010 7a 8a 58 2c 7d 1c 41 39 bf 08 7e 82 17 55 52 b3 |z.X,}.A9..~..UR.| -00000020 81 bd 7a f8 3c bf 9c 2b f0 9b 3f 65 f5 42 15 17 |..z.<..+..?e.B..| -00000030 03 02 00 21 b1 cc e5 56 16 70 58 0b 91 3c 8c 46 |...!...V.pX..<.F| -00000040 0e 3b b6 fe 32 5d 2e b0 8c 6a 1c a0 82 c9 43 81 |.;..2]...j....C.| -00000050 cf 07 25 47 c9 15 03 02 00 16 53 91 04 70 ba 03 |..%G......S..p..| -00000060 53 69 57 86 3b 2f 8b 97 37 7c b8 85 46 b6 72 42 |SiW.;/..7|..F.rB| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN deleted file mode 100644 index cbfeb42eb06deaf96867e6c378fa4be379e267f8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN +++ /dev/null @@ -1,109 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 01 4c 01 00 01 48 03 03 44 3b 24 ee 2f |....L...H..D;$./| -00000010 63 3d ca bd 3e c5 bf a2 24 f1 59 c3 54 dc f0 43 |c=..>...$.Y.T..C| -00000020 15 c4 51 f2 29 ea 1b ce 2c fe af 00 00 b6 c0 30 |..Q.)...,......0| -00000030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a5 00 a3 00 a1 |.,.(.$..........| -00000040 00 9f 00 6b 00 6a 00 69 00 68 00 39 00 38 00 37 |...k.j.i.h.9.8.7| -00000050 00 36 00 88 00 87 00 86 00 85 c0 32 c0 2e c0 2a |.6.........2...*| -00000060 c0 26 c0 0f c0 05 00 9d 00 3d 00 35 00 84 c0 2f |.&.......=.5.../| -00000070 c0 2b c0 27 c0 23 c0 13 c0 09 00 a4 00 a2 00 a0 |.+.'.#..........| -00000080 00 9e 00 67 00 40 00 3f 00 3e 00 33 00 32 00 31 |...g.@.?.>.3.2.1| -00000090 00 30 00 9a 00 99 00 98 00 97 00 45 00 44 00 43 |.0.........E.D.C| -000000a0 00 42 c0 31 c0 2d c0 29 c0 25 c0 0e c0 04 00 9c |.B.1.-.).%......| -000000b0 00 3c 00 2f 00 96 00 41 00 07 c0 11 c0 07 c0 0c |.<./...A........| -000000c0 c0 02 00 05 00 04 c0 12 c0 08 00 16 00 13 00 10 |................| -000000d0 00 0d c0 0d c0 03 00 0a 00 15 00 12 00 0f 00 0c |................| -000000e0 00 09 00 ff 01 00 00 69 00 0b 00 04 03 00 01 02 |.......i........| -000000f0 00 0a 00 1c 00 1a 00 17 00 19 00 1c 00 1b 00 18 |................| -00000100 00 1a 00 16 00 0e 00 0d 00 0b 00 0c 00 09 00 0a |................| -00000110 00 23 00 00 00 0d 00 20 00 1e 06 01 06 02 06 03 |.#..... ........| -00000120 05 01 05 02 05 03 04 01 04 02 04 03 03 01 03 02 |................| -00000130 03 03 02 01 02 02 02 03 00 0f 00 01 01 00 10 00 |................| -00000140 10 00 0e 06 70 72 6f 74 6f 32 06 70 72 6f 74 6f |....proto2.proto| -00000150 31 |1| ->>> Flow 2 (server to client) -00000000 16 03 03 00 42 02 00 00 3e 03 03 00 00 00 00 00 |....B...>.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 30 00 00 |.............0..| -00000030 16 00 23 00 00 ff 01 00 01 00 00 10 00 09 00 07 |..#.............| -00000040 06 70 72 6f 74 6f 31 16 03 03 02 71 0b 00 02 6d |.proto1....q...m| -00000050 00 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 |..j..g0..c0.....| -00000060 02 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d |.......s......0.| -00000070 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 |..*.H........0+1| -00000080 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 |.0...U....Google| -00000090 20 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 | TESTING1.0...U.| -000000a0 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 |...Go Root0...15| -000000b0 30 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 |0101000000Z..250| -000000c0 31 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 |101000000Z0&1.0.| -000000d0 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 |..U....Google TE| -000000e0 53 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 |STING1.0...U....| -000000f0 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 |Go0..0...*.H....| -00000100 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af |........0.......| -00000110 87 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 |... ..el..D..;E.| -00000120 e3 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a |..m..cM...jb5..J| -00000130 f9 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 |..|..%^zd1f.....| -00000140 af c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 |..k.v.._A.nV....| -00000150 c1 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da |.<.9!f=+........| -00000160 b7 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 |.......!P.....k.| -00000170 4b 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 |K......l..D..!..| -00000180 7d 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 |}..M........G...| -00000190 03 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d |.......0..0...U.| -000001a0 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d |..........0...U.| -000001b0 25 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 |%..0...+........| -000001c0 08 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 |.+.......0...U..| -000001d0 01 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 |.....0.0...U....| -000001e0 04 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e |...P..o...TMn.i^| -000001f0 06 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf |..0...U.#..0....| -00000200 3d b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 |=..f..@....xH.A0| -00000210 19 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d |...U....0...exam| -00000220 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 |ple.golang0...*.| -00000230 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af |H.............|.| -00000240 91 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 |.U...Y1.H@.-....| -00000250 a0 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 |....|..0}<.v.O=.| -00000260 fa ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc |..-3$k.{.gY.!...| -00000270 77 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 |w...n.-.5.d_">c.| -00000280 6b be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 |k....m...1..8.;.| -00000290 87 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 |.,...Qv..O......| -000002a0 40 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 |@.Q......F.F.O..| -000002b0 f9 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 |...A4......9....| -000002c0 00 cd 0c 00 00 c9 03 00 17 41 04 1e 18 37 ef 0d |.........A...7..| -000002d0 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd |.Q.5uq..T[....g.| -000002e0 a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e |.$ >.V...(^.+-O.| -000002f0 f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 |...lK[.V.2B.X..I| -00000300 a6 b5 68 1a 41 03 56 6b dc 5a 89 05 01 00 80 40 |..h.A.Vk.Z.....@| -00000310 93 b2 1f 79 3d 56 c0 ae 94 87 c0 a7 28 ef 1d 15 |...y=V......(...| -00000320 be 4b fb 66 e0 60 2c a3 57 ee 56 7d d6 89 b8 8e |.K.f.`,.W.V}....| -00000330 8f 0f 3f 1b c6 9f a4 1d 34 60 b6 9c e9 9b a9 27 |..?.....4`.....'| -00000340 d0 45 7b 04 71 2d db 9c 67 1b d5 d4 fe 19 69 59 |.E{.q-..g.....iY| -00000350 71 8a 35 75 33 a8 c9 f2 4d c4 8f 40 17 a7 25 53 |q.5u3...M..@..%S| -00000360 57 c5 cd ee df a9 3b a3 61 ab e2 a2 ca de 5c 08 |W.....;.a.....\.| -00000370 3d 5b a2 ef cd c8 bc 16 1f 1d 0f 83 9e b7 20 f5 |=[............ .| -00000380 89 3f 09 ba 2e da 12 34 81 e5 2f 8d 3c 90 89 16 |.?.....4../.<...| -00000390 03 03 00 04 0e 00 00 00 |........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 8b a2 de a6 1e |....F...BA......| -00000010 d9 22 3c 03 4a be 49 2f 40 e3 1e e0 b4 76 7f 78 |."<.J.I/@....v.x| -00000020 96 22 8d 8d c9 45 3b d8 7a ce e3 16 3d 37 ec 80 |."...E;.z...=7..| -00000030 aa 3f d5 19 de c1 2c 7b 7f eb 3c fc 5d c3 52 3b |.?....,{..<.].R;| -00000040 d4 22 25 1c c7 1f 39 c5 23 bd 73 14 03 03 00 01 |."%...9.#.s.....| -00000050 01 16 03 03 00 28 c8 53 0a ad c2 f6 7e 18 08 a3 |.....(.S....~...| -00000060 29 27 20 1c 6c 1d 6c d8 8f 05 31 de e6 ab 7f 22 |)' .l.l...1...."| -00000070 93 6a fb ef b0 f8 43 a9 d3 4f 9d 04 b5 9a |.j....C..O....| ->>> Flow 4 (server to client) -00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| -00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f ec 80 83 61 8e d9 64 ac a2 ee 3b 69 31 79 e1 |o...a..d...;i1y.| -00000040 53 0a 92 1d aa 23 09 c2 49 02 2d 0d 1d c1 63 d6 |S....#..I.-...c.| -00000050 21 56 c7 24 02 28 d5 f1 11 b0 e7 1b 4a 7c 55 af |!V.$.(......J|U.| -00000060 1b c8 32 4c 5b 33 94 b0 ed b0 2f 52 c4 52 81 ee |..2L[3..../R.R..| -00000070 60 6f 66 fb f5 db dd f9 1e 30 11 d4 ca 75 0e 2b |`of......0...u.+| -00000080 ff d0 e5 f2 68 a4 e7 14 03 03 00 01 01 16 03 03 |....h...........| -00000090 00 28 00 00 00 00 00 00 00 00 67 3b 4a ba f3 27 |.(........g;J..'| -000000a0 c8 45 94 68 36 5a 40 e1 dc 67 9b d4 45 58 e9 24 |.E.h6Z@..g..EX.$| -000000b0 31 85 3a f8 5d cb 84 8e 64 05 17 03 03 00 25 00 |1.:.]...d.....%.| -000000c0 00 00 00 00 00 00 01 35 d9 ba 0a e2 3e fd a2 80 |.......5....>...| -000000d0 10 0e 38 7b ad 85 85 48 6a 2a ab 2a 46 c3 59 96 |..8{...Hj*.*F.Y.| -000000e0 fd 75 11 5d 15 03 03 00 1a 00 00 00 00 00 00 00 |.u.]............| -000000f0 02 0b 4d a5 89 4d 86 47 14 60 27 f8 09 bc c9 4d |..M..M.G.`'....M| -00000100 00 31 cb |.1.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch deleted file mode 100644 index af75445dc5559e9d32b5dc74acb9b5c2583a55be..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ALPN-NoMatch +++ /dev/null @@ -1,108 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 01 4c 01 00 01 48 03 03 1d 1a f7 e5 ad |....L...H.......| -00000010 a4 5c fd 61 b4 c2 25 33 c7 b9 fc fb 2b a5 4b fe |.\.a..%3....+.K.| -00000020 16 84 55 4b 9f 68 73 61 b8 92 4d 00 00 b6 c0 30 |..UK.hsa..M....0| -00000030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a5 00 a3 00 a1 |.,.(.$..........| -00000040 00 9f 00 6b 00 6a 00 69 00 68 00 39 00 38 00 37 |...k.j.i.h.9.8.7| -00000050 00 36 00 88 00 87 00 86 00 85 c0 32 c0 2e c0 2a |.6.........2...*| -00000060 c0 26 c0 0f c0 05 00 9d 00 3d 00 35 00 84 c0 2f |.&.......=.5.../| -00000070 c0 2b c0 27 c0 23 c0 13 c0 09 00 a4 00 a2 00 a0 |.+.'.#..........| -00000080 00 9e 00 67 00 40 00 3f 00 3e 00 33 00 32 00 31 |...g.@.?.>.3.2.1| -00000090 00 30 00 9a 00 99 00 98 00 97 00 45 00 44 00 43 |.0.........E.D.C| -000000a0 00 42 c0 31 c0 2d c0 29 c0 25 c0 0e c0 04 00 9c |.B.1.-.).%......| -000000b0 00 3c 00 2f 00 96 00 41 00 07 c0 11 c0 07 c0 0c |.<./...A........| -000000c0 c0 02 00 05 00 04 c0 12 c0 08 00 16 00 13 00 10 |................| -000000d0 00 0d c0 0d c0 03 00 0a 00 15 00 12 00 0f 00 0c |................| -000000e0 00 09 00 ff 01 00 00 69 00 0b 00 04 03 00 01 02 |.......i........| -000000f0 00 0a 00 1c 00 1a 00 17 00 19 00 1c 00 1b 00 18 |................| -00000100 00 1a 00 16 00 0e 00 0d 00 0b 00 0c 00 09 00 0a |................| -00000110 00 23 00 00 00 0d 00 20 00 1e 06 01 06 02 06 03 |.#..... ........| -00000120 05 01 05 02 05 03 04 01 04 02 04 03 03 01 03 02 |................| -00000130 03 03 02 01 02 02 02 03 00 0f 00 01 01 00 10 00 |................| -00000140 10 00 0e 06 70 72 6f 74 6f 32 06 70 72 6f 74 6f |....proto2.proto| -00000150 31 |1| ->>> Flow 2 (server to client) -00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 30 00 00 |.............0..| -00000030 09 00 23 00 00 ff 01 00 01 00 16 03 03 02 71 0b |..#...........q.| -00000040 00 02 6d 00 02 6a 00 02 67 30 82 02 63 30 82 01 |..m..j..g0..c0..| -00000050 cc a0 03 02 01 02 02 09 00 a2 73 00 0c 81 00 cb |..........s.....| -00000060 f3 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| -00000070 30 2b 31 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f |0+1.0...U....Goo| -00000080 67 6c 65 20 54 45 53 54 49 4e 47 31 10 30 0e 06 |gle TESTING1.0..| -00000090 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -000000a0 0d 31 35 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.150101000000Z..| -000000b0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 26 31 |250101000000Z0&1| -000000c0 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 |.0...U....Google| -000000d0 20 54 45 53 54 49 4e 47 31 0b 30 09 06 03 55 04 | TESTING1.0...U.| -000000e0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| -000000f0 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -00000100 81 00 af 87 88 f6 20 1b 95 65 6c 14 ab 44 05 af |...... ..el..D..| -00000110 3b 45 14 e3 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 |;E...m..cM...jb5| -00000120 86 c0 4a f9 18 7c f6 aa 25 5e 7a 64 31 66 00 ba |..J..|..%^zd1f..| -00000130 f4 8e 92 af c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 |.....k.v.._A.nV.| -00000140 97 1b 97 c1 3c 12 39 21 66 3d 2b 16 d1 bc db 1c |....<.9!f=+.....| -00000150 c0 a7 da b7 ca ad ba da cb d5 21 50 ec de 8d ab |..........!P....| -00000160 d1 6b 81 4b 89 02 f3 c4 be c1 6c 89 b1 44 84 bd |.k.K......l..D..| -00000170 21 d1 04 7d 9d 16 4d f9 82 15 f6 ef fa d6 09 47 |!..}..M........G| -00000180 f2 fb 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |..........0..0..| -00000190 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| -000001a0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| -000001b0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| -000001c0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| -000001d0 0e 04 12 04 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e |......P..o...TMn| -000001e0 cb 69 5e 06 f4 30 1b 06 03 55 1d 23 04 14 30 12 |.i^..0...U.#..0.| -000001f0 80 10 bf 3d b6 a9 66 f2 b8 40 cf ea b4 03 78 48 |...=..f..@....xH| -00000200 1a 41 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |.A0...U....0...e| -00000210 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| -00000220 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| -00000230 92 7c af 91 55 12 18 96 59 31 a6 48 40 d5 2d d5 |.|..U...Y1.H@.-.| -00000240 ee bb 02 a0 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da |.......|..0}<.v.| -00000250 4f 3d c0 fa ae 2d 33 24 6b 03 7b 1b 67 59 11 21 |O=...-3$k.{.gY.!| -00000260 b5 11 bc 77 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 |...w...n.-.5.d_"| -00000270 3e 63 10 6b be ff 14 86 6d 0d f0 15 31 a8 14 38 |>c.k....m...1..8| -00000280 1e 3b 84 87 2c cb 98 ed 51 76 b9 b1 4f dd db 9b |.;..,...Qv..O...| -00000290 84 04 86 40 fa 51 dd ba b4 8d eb e3 46 de 46 b9 |...@.Q......F.F.| -000002a0 4f 86 c7 f9 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 |O.....A4......9.| -000002b0 16 03 03 00 cd 0c 00 00 c9 03 00 17 41 04 1e 18 |............A...| -000002c0 37 ef 0d 19 51 88 35 75 71 b5 e5 54 5b 12 2e 8f |7...Q.5uq..T[...| -000002d0 09 67 fd a7 24 20 3e b2 56 1c ce 97 28 5e f8 2b |.g..$ >.V...(^.+| -000002e0 2d 4f 9e f1 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 |-O....lK[.V.2B.X| -000002f0 b6 d7 49 a6 b5 68 1a 41 03 56 6b dc 5a 89 05 01 |..I..h.A.Vk.Z...| -00000300 00 80 36 d2 96 c8 27 66 d8 bd 6c 28 29 30 b3 be |..6...'f..l()0..| -00000310 0a bb b2 fe 9d c3 59 47 34 cf de fe f4 ab 5d 79 |......YG4.....]y| -00000320 24 a9 9d c9 b5 e9 50 6a 3b 96 e3 29 cb d7 37 06 |$.....Pj;..)..7.| -00000330 19 08 88 15 29 c2 55 03 62 75 1d 35 c2 8e 25 a2 |....).U.bu.5..%.| -00000340 86 20 bf 18 46 15 81 f2 74 4b bb dd 3d e3 a5 f6 |. ..F...tK..=...| -00000350 28 18 41 89 c8 39 13 f9 c0 88 fd cc f0 6e 9e 3d |(.A..9.......n.=| -00000360 cb 29 ad 26 5b d1 e6 11 5c 64 7d b6 df d7 39 87 |.).&[...\d}...9.| -00000370 24 df 9f 62 17 ef f2 b3 3a b3 88 a4 f0 91 ea f2 |$..b....:.......| -00000380 5d c9 16 03 03 00 04 0e 00 00 00 |]..........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 b0 22 15 73 fc |....F...BA..".s.| -00000010 1c fd 24 4a 36 69 8a be ac bd 72 30 bb 6b e1 9b |..$J6i....r0.k..| -00000020 42 e8 56 7a 86 b1 8d cb 9c 3e 2d 63 13 57 a8 13 |B.Vz.....>-c.W..| -00000030 71 3b a2 01 86 af f8 76 40 0b 44 4f 0a 0f 5a da |q;.....v@.DO..Z.| -00000040 31 36 3b 13 c0 10 6c 96 64 a7 24 14 03 03 00 01 |16;...l.d.$.....| -00000050 01 16 03 03 00 28 10 2d 45 93 5c 37 34 d9 2a a0 |.....(.-E.\74.*.| -00000060 b6 37 13 bc a6 1f 0c ce 2e 55 c1 ad 36 b8 60 72 |.7.......U..6.`r| -00000070 81 cb 1a 7a 5b 26 49 ad 77 ef 62 e8 fc 00 |...z[&I.w.b...| ->>> Flow 4 (server to client) -00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| -00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f ec 80 83 61 05 33 d2 9d 95 89 7b 28 54 50 50 |o...a.3....{(TPP| -00000040 b3 3c 99 5c 82 ab cf 88 24 e8 48 81 db 4a 22 79 |.<.\....$.H..J"y| -00000050 0b fa 33 50 ed 82 a1 7c 33 0e f2 ff 6d a7 d6 88 |..3P...|3...m...| -00000060 29 65 74 e3 27 33 94 97 66 0c 86 ce fc ca 0e 2a |)et.'3..f......*| -00000070 96 fa fe 19 a3 01 64 d9 4d 8e 58 95 5b 74 a6 aa |......d.M.X.[t..| -00000080 f4 9f c1 34 97 2d e5 14 03 03 00 01 01 16 03 03 |...4.-..........| -00000090 00 28 00 00 00 00 00 00 00 00 4d 56 6d d5 6f cc |.(........MVm.o.| -000000a0 3d d4 85 32 3c 07 ea 3c 52 61 88 8e dd d5 d3 d0 |=..2<..D.{n6| -00000100 ae 66 87 |.f.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA deleted file mode 100644 index 344d9737b253cc83cbc7800b76799f843f9f26f6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceECDSA +++ /dev/null @@ -1,98 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 01 34 01 00 01 30 03 03 78 08 b2 d4 18 |....4...0..x....| -00000010 8e b1 6b a2 d2 e0 c6 41 02 c5 93 f1 b9 60 94 e8 |..k....A.....`..| -00000020 f2 64 6c 97 50 2d 24 a3 cd c0 36 00 00 b6 c0 30 |.dl.P-$...6....0| -00000030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a5 00 a3 00 a1 |.,.(.$..........| -00000040 00 9f 00 6b 00 6a 00 69 00 68 00 39 00 38 00 37 |...k.j.i.h.9.8.7| -00000050 00 36 00 88 00 87 00 86 00 85 c0 32 c0 2e c0 2a |.6.........2...*| -00000060 c0 26 c0 0f c0 05 00 9d 00 3d 00 35 00 84 c0 2f |.&.......=.5.../| -00000070 c0 2b c0 27 c0 23 c0 13 c0 09 00 a4 00 a2 00 a0 |.+.'.#..........| -00000080 00 9e 00 67 00 40 00 3f 00 3e 00 33 00 32 00 31 |...g.@.?.>.3.2.1| -00000090 00 30 00 9a 00 99 00 98 00 97 00 45 00 44 00 43 |.0.........E.D.C| -000000a0 00 42 c0 31 c0 2d c0 29 c0 25 c0 0e c0 04 00 9c |.B.1.-.).%......| -000000b0 00 3c 00 2f 00 96 00 41 00 07 c0 11 c0 07 c0 0c |.<./...A........| -000000c0 c0 02 00 05 00 04 c0 12 c0 08 00 16 00 13 00 10 |................| -000000d0 00 0d c0 0d c0 03 00 0a 00 15 00 12 00 0f 00 0c |................| -000000e0 00 09 00 ff 01 00 00 51 00 0b 00 04 03 00 01 02 |.......Q........| -000000f0 00 0a 00 1c 00 1a 00 17 00 19 00 1c 00 1b 00 18 |................| -00000100 00 1a 00 16 00 0e 00 0d 00 0b 00 0c 00 09 00 0a |................| -00000110 00 0d 00 20 00 1e 06 01 06 02 06 03 05 01 05 02 |... ............| -00000120 05 03 04 01 04 02 04 03 03 01 03 02 03 03 02 01 |................| -00000130 02 02 02 03 00 0f 00 01 01 |.........| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 0e 0b 00 02 0a 00 |................| -00000040 02 07 00 02 04 30 82 02 00 30 82 01 62 02 09 00 |.....0...0..b...| -00000050 b8 bf 2d 47 a0 d2 eb f4 30 09 06 07 2a 86 48 ce |..-G....0...*.H.| -00000060 3d 04 01 30 45 31 0b 30 09 06 03 55 04 06 13 02 |=..0E1.0...U....| -00000070 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000080 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000090 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -000000a0 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 32 |ts Pty Ltd0...12| -000000b0 31 31 32 32 31 35 30 36 33 32 5a 17 0d 32 32 31 |1122150632Z..221| -000000c0 31 32 30 31 35 30 36 33 32 5a 30 45 31 0b 30 09 |120150632Z0E1.0.| -000000d0 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 55 |..U....AU1.0...U| -000000e0 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 |....Some-State1!| -000000f0 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 |0...U....Interne| -00000100 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 |t Widgits Pty Lt| -00000110 64 30 81 9b 30 10 06 07 2a 86 48 ce 3d 02 01 06 |d0..0...*.H.=...| -00000120 05 2b 81 04 00 23 03 81 86 00 04 00 c4 a1 ed be |.+...#..........| -00000130 98 f9 0b 48 73 36 7e c3 16 56 11 22 f2 3d 53 c3 |...Hs6~..V.".=S.| -00000140 3b 4d 21 3d cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc |;M!=.ku......&..| -00000150 b2 87 f0 72 32 7c b3 64 2f 1c 90 bc ea 68 23 10 |...r2|.d/....h#.| -00000160 7e fe e3 25 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 |~..%.H:i.(m.7...| -00000170 62 dd 0d a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 |b....pb....d1...| -00000180 31 bd 96 b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 |1...h..#.vd?.\..| -00000190 12 0e 58 58 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc |..XX._p.........| -000001a0 b9 b6 9f 30 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 |...0f[f. .'...;0| -000001b0 09 06 07 2a 86 48 ce 3d 04 01 03 81 8c 00 30 81 |...*.H.=......0.| -000001c0 88 02 42 01 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 |..B...O..E.H}...| -000001d0 ed 98 9d ae 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 |....Gp.^../...M.| -000001e0 61 40 d3 11 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b |a@......~.~.v..;| -000001f0 7e a5 3f ce fa 10 e2 59 ec 47 2d 7c ac da 4e 97 |~.?....Y.G-|..N.| -00000200 0e 15 a0 6f d0 02 42 01 4d fc be 67 13 9c 2d 05 |...o..B.M..g..-.| -00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7| -00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.| -00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1| -00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 d8 0c 00 |{j.9....*.......| -00000250 00 d4 03 00 17 41 04 1e 18 37 ef 0d 19 51 88 35 |.....A...7...Q.5| -00000260 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 3e |uq..T[....g..$ >| -00000270 b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f 6c |.V...(^.+-O....l| -00000280 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 1a |K[.V.2B.X..I..h.| -00000290 41 03 56 6b dc 5a 89 05 03 00 8b 30 81 88 02 42 |A.Vk.Z.....0...B| -000002a0 00 91 b4 4a f2 9d 13 a1 6d 3b ee 46 2f 3b 97 50 |...J....m;.F/;.P| -000002b0 b9 3e 28 7a 51 7a 8b 3b a6 16 03 d6 1f 92 0a ec |.>(zQz.;........| -000002c0 5b 9b b5 48 98 ce d8 22 bd 7d eb cb 14 7b 14 73 |[..H...".}...{.s| -000002d0 2d 5f 01 8c dc 5a 63 34 92 4e 59 4a 90 f9 b1 c9 |-_...Zc4.NYJ....| -000002e0 d8 18 02 42 01 89 e4 e4 39 d0 52 d1 70 19 fe d7 |...B....9.R.p...| -000002f0 c6 70 10 36 94 1e 45 fd b4 03 37 79 c7 db cf 6d |.p.6..E...7y...m| -00000300 33 5d 80 fe 04 de d1 78 bf c4 dd cf 91 82 57 14 |3].....x......W.| -00000310 14 09 e3 2d dd d2 78 9c 53 cc 1f f7 40 6c 4a 59 |...-..x.S...@lJY| -00000320 49 a8 a1 06 24 18 16 03 03 00 04 0e 00 00 00 |I...$..........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 66 37 3a ce 68 |....F...BA.f7:.h| -00000010 23 0f b2 d0 cb 20 24 26 37 d5 84 46 4a 2e 59 80 |#.... $&7..FJ.Y.| -00000020 87 b3 10 7e 36 fd af 7c 99 07 99 dd 18 af 6d 7c |...~6..|......m|| -00000030 b5 b2 b7 93 45 95 d9 98 1a 13 5b a2 12 e8 b7 95 |....E.....[.....| -00000040 ed a1 3a 6d aa 8f fc b6 b5 b4 41 14 03 03 00 01 |..:m......A.....| -00000050 01 16 03 03 00 40 b0 12 69 00 a4 3a 6d bd 56 40 |.....@..i..:m.V@| -00000060 6e 9d 5e a8 1b 0f 59 c5 09 48 b2 07 d8 bc 7b 02 |n.^...Y..H....{.| -00000070 70 61 f6 1b a9 27 55 8c 16 4d 69 4c ca 31 30 9f |pa...'U..MiL.10.| -00000080 d3 62 ba d4 1b 11 ee 0a a0 f3 61 be c6 64 c3 dc |.b........a..d..| -00000090 97 50 47 27 ed 09 |.PG'..| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 09 34 9a eb 7c |............4..|| -00000020 6a 6d 6a 02 7b 50 14 b8 f7 b0 93 30 ea 0b 61 4a |jmj.{P.....0..aJ| -00000030 0b 75 10 39 41 78 46 9d ba 8e d3 e9 e4 ab dc 1f |.u.9AxF.........| -00000040 c9 43 95 e8 f9 d6 3a d3 5d 7d 09 17 03 03 00 40 |.C....:.]}.....@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 b4 64 88 d5 53 f9 1e 47 d4 d8 c4 fa 0e c2 76 a6 |.d..S..G......v.| -00000070 ed 5c 17 ba ea 76 72 cb c5 73 a3 c5 44 21 3c 40 |.\...vr..s..D!<@| -00000080 33 27 09 37 73 3b 0e a3 7b 95 72 10 8d 74 85 19 |3'.7s;..{.r..t..| -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 b3 c0 05 e9 ec 05 06 52 ef 09 b7 |............R...| -000000b0 52 29 04 88 ed 11 bb bd 36 a3 0f ce 2c 55 a2 87 |R)......6...,U..| -000000c0 7e 2b 0c aa 83 |~+...| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA deleted file mode 100644 index 10624c02591a528cb9b81757a098ad1b9c0bc6bf..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-CipherSuiteCertPreferenceRSA +++ /dev/null @@ -1,104 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 01 34 01 00 01 30 03 03 10 5e c8 3f c6 |....4...0...^.?.| -00000010 fe 44 c4 f0 13 c5 bd ad 06 21 65 e5 a8 40 b5 1d |.D.......!e..@..| -00000020 21 07 99 34 5b ef 70 85 29 92 7d 00 00 b6 c0 30 |!..4[.p.).}....0| -00000030 c0 2c c0 28 c0 24 c0 14 c0 0a 00 a5 00 a3 00 a1 |.,.(.$..........| -00000040 00 9f 00 6b 00 6a 00 69 00 68 00 39 00 38 00 37 |...k.j.i.h.9.8.7| -00000050 00 36 00 88 00 87 00 86 00 85 c0 32 c0 2e c0 2a |.6.........2...*| -00000060 c0 26 c0 0f c0 05 00 9d 00 3d 00 35 00 84 c0 2f |.&.......=.5.../| -00000070 c0 2b c0 27 c0 23 c0 13 c0 09 00 a4 00 a2 00 a0 |.+.'.#..........| -00000080 00 9e 00 67 00 40 00 3f 00 3e 00 33 00 32 00 31 |...g.@.?.>.3.2.1| -00000090 00 30 00 9a 00 99 00 98 00 97 00 45 00 44 00 43 |.0.........E.D.C| -000000a0 00 42 c0 31 c0 2d c0 29 c0 25 c0 0e c0 04 00 9c |.B.1.-.).%......| -000000b0 00 3c 00 2f 00 96 00 41 00 07 c0 11 c0 07 c0 0c |.<./...A........| -000000c0 c0 02 00 05 00 04 c0 12 c0 08 00 16 00 13 00 10 |................| -000000d0 00 0d c0 0d c0 03 00 0a 00 15 00 12 00 0f 00 0c |................| -000000e0 00 09 00 ff 01 00 00 51 00 0b 00 04 03 00 01 02 |.......Q........| -000000f0 00 0a 00 1c 00 1a 00 17 00 19 00 1c 00 1b 00 18 |................| -00000100 00 1a 00 16 00 0e 00 0d 00 0b 00 0c 00 09 00 0a |................| -00000110 00 0d 00 20 00 1e 06 01 06 02 06 03 05 01 05 02 |... ............| -00000120 05 03 04 01 04 02 04 03 03 01 03 02 03 03 02 01 |................| -00000130 02 02 02 03 00 0f 00 01 01 |.........| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 14 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 cd 0c 00 00 c9 03 00 17 41 04 1e 18 37 ef 0d 19 |........A...7...| -000002c0 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| -000002d0 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| -000002e0 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| -000002f0 b5 68 1a 41 03 56 6b dc 5a 89 05 01 00 80 6a 4b |.h.A.Vk.Z.....jK| -00000300 b1 7d 23 cd 0e cb 26 02 d4 ee 90 f2 e0 4a 47 3d |.}#...&......JG=| -00000310 b3 36 90 8d 01 42 98 92 ad 75 87 71 02 70 02 a8 |.6...B...u.q.p..| -00000320 0c b0 06 ee bd 6a 1f 3f 6c 4b 4b 6b 75 41 23 b4 |.....j.?lKKkuA#.| -00000330 f9 c2 a6 60 e2 de 55 b6 d4 85 62 e9 8f 20 70 ed |...`..U...b.. p.| -00000340 9a b8 bb dd 1f 19 87 e9 ad b3 30 3f 7c 63 51 f1 |..........0?|cQ.| -00000350 59 ab d1 a0 a1 80 22 56 ca 68 52 f8 0f 80 c6 a6 |Y....."V.hR.....| -00000360 9e 12 51 ed 29 d0 6d c2 1a e5 37 dc 76 e3 f3 53 |..Q.).m...7.v..S| -00000370 1b 07 0b ea a6 11 af dc 54 d3 ee 25 cc 27 16 03 |........T..%.'..| -00000380 03 00 04 0e 00 00 00 |.......| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 2d 4b 0c 6b 65 |....F...BA.-K.ke| -00000010 82 32 95 8b 77 ec f0 f2 b2 ba d1 38 74 ed 82 49 |.2..w......8t..I| -00000020 fb ce 8f 66 97 9d b6 97 d8 ae f5 19 af ad 47 b9 |...f..........G.| -00000030 db 7b d2 c9 4e 10 68 14 ed 23 a5 98 94 f9 2a 00 |.{..N.h..#....*.| -00000040 b6 44 b3 44 01 29 6c 56 da bb a8 14 03 03 00 01 |.D.D.)lV........| -00000050 01 16 03 03 00 40 f4 fd de d6 20 2e 18 80 4e 73 |.....@.... ...Ns| -00000060 af dd 97 42 08 3b 51 80 e9 26 00 48 6b 8b 21 99 |...B.;Q..&.Hk.!.| -00000070 a8 60 1f 64 51 d0 5a 90 8b b0 69 b8 6b 29 59 21 |.`.dQ.Z...i.k)Y!| -00000080 b1 13 19 13 07 01 e1 2c c3 6b 17 2d 01 a5 be d6 |.......,.k.-....| -00000090 b0 0d 3d 6a 8c fe |..=j..| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 84 e2 7f e3 b4 |................| -00000020 53 d7 d0 30 c4 e5 ea 09 df ba 33 b0 02 34 eb 2e |S..0......3..4..| -00000030 b2 ec 47 0d e7 20 76 12 fa 53 3b 44 86 e1 e1 63 |..G.. v..S;D...c| -00000040 06 29 57 98 ce 87 18 ad 02 17 01 17 03 03 00 40 |.)W............@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 b0 3a f5 90 90 30 9c b3 39 5b b4 56 f6 b9 30 7e |.:...0..9[.V..0~| -00000070 8e a8 2d 60 47 b6 57 8a 20 61 02 f2 8e 43 c2 01 |..-`G.W. a...C..| -00000080 ee f0 be 5a 93 52 2f ea 03 2a 4f 01 ea 9e 1c a2 |...Z.R/..*O.....| -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 c0 7e 61 51 a1 76 15 8a 7e 20 5f |......~aQ.v..~ _| -000000b0 d4 a4 c6 3e 6c 50 18 c6 63 88 d0 ac 4c fa 31 b3 |...>lP..c...L.1.| -000000c0 e7 c9 77 11 7a |..w.z| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven deleted file mode 100644 index 56c3c822e352124fafd8a0f47e53f75d6e01ab3d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndECDSAGiven +++ /dev/null @@ -1,117 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 80 13 c8 83 43 |....Z...V......C| -00000010 94 79 15 01 6e 0a 9f c5 0f e7 f6 d8 b1 94 de b4 |.y..n...........| -00000020 57 8c 4f a8 08 48 ee 9b b4 d2 43 00 00 04 00 05 |W.O..H....C.....| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 17 0d 00 00 13 02 01 40 00 0c 04 01 04 03 05 01 |.......@........| -000002c0 05 03 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 |................| -000002d0 00 |.| ->>> Flow 3 (client to server) -00000000 16 03 03 02 0a 0b 00 02 06 00 02 03 00 02 00 30 |...............0| -00000010 82 01 fc 30 82 01 5e 02 09 00 9a 30 84 6c 26 35 |...0..^....0.l&5| -00000020 d9 17 30 09 06 07 2a 86 48 ce 3d 04 01 30 45 31 |..0...*.H.=..0E1| -00000030 0b 30 09 06 03 55 04 06 13 02 41 55 31 13 30 11 |.0...U....AU1.0.| -00000040 06 03 55 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 |..U....Some-Stat| -00000050 65 31 21 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 |e1!0...U....Inte| -00000060 72 6e 65 74 20 57 69 64 67 69 74 73 20 50 74 79 |rnet Widgits Pty| -00000070 20 4c 74 64 30 1e 17 0d 31 32 31 31 31 34 31 33 | Ltd0...12111413| -00000080 32 35 35 33 5a 17 0d 32 32 31 31 31 32 31 33 32 |2553Z..221112132| -00000090 35 35 33 5a 30 41 31 0b 30 09 06 03 55 04 06 13 |553Z0A1.0...U...| -000000a0 02 41 55 31 0c 30 0a 06 03 55 04 08 13 03 4e 53 |.AU1.0...U....NS| -000000b0 57 31 10 30 0e 06 03 55 04 07 13 07 50 79 72 6d |W1.0...U....Pyrm| -000000c0 6f 6e 74 31 12 30 10 06 03 55 04 03 13 09 4a 6f |ont1.0...U....Jo| -000000d0 65 6c 20 53 69 6e 67 30 81 9b 30 10 06 07 2a 86 |el Sing0..0...*.| -000000e0 48 ce 3d 02 01 06 05 2b 81 04 00 23 03 81 86 00 |H.=....+...#....| -000000f0 04 00 95 8c 91 75 14 c0 5e c4 57 b4 d4 c3 6f 8d |.....u..^.W...o.| -00000100 ae 68 1e dd 6f ce 86 e1 7e 6e b2 48 3e 81 e5 4e |.h..o...~n.H>..N| -00000110 e2 c6 88 4b 64 dc f5 30 bb d3 ff 65 cc 5b f4 dd |...Kd..0...e.[..| -00000120 b5 6a 3e 3e d0 1d de 47 c3 76 ad 19 f6 45 2c 8c |.j>>...G.v...E,.| -00000130 bc d8 1d 01 4c 1f 70 90 46 76 48 8b 8f 83 cc 4a |....L.p.FvH....J| -00000140 5c 8f 40 76 da e0 89 ec 1d 2b c4 4e 30 76 28 41 |\.@v.....+.N0v(A| -00000150 b2 62 a8 fb 5b f1 f9 4e 7a 8d bd 09 b8 ae ea 8b |.b..[..Nz.......| -00000160 18 27 4f 2e 70 fe 13 96 ba c3 d3 40 16 cd 65 4e |.'O.p......@..eN| -00000170 ac 11 1e e6 f1 30 09 06 07 2a 86 48 ce 3d 04 01 |.....0...*.H.=..| -00000180 03 81 8c 00 30 81 88 02 42 00 e0 14 c4 60 60 0b |....0...B....``.| -00000190 72 68 b0 32 5d 61 4a 02 74 5c c2 81 b9 16 a8 3f |rh.2]aJ.t\.....?| -000001a0 29 c8 36 c7 81 ff 6c b6 5b d9 70 f1 38 3b 50 48 |).6...l.[.p.8;PH| -000001b0 28 94 cb 09 1a 52 f1 5d ee 8d f2 b9 f0 f0 da d9 |(....R.]........| -000001c0 15 3a f9 bd 03 7a 87 a2 23 35 ec 02 42 01 a3 d4 |.:...z..#5..B...| -000001d0 8a 78 35 1c 4a 9a 23 d2 0a be 2b 10 31 9d 9c 5f |.x5.J.#...+.1.._| -000001e0 be e8 91 b3 da 1a f5 5d a3 23 f5 26 8b 45 70 8d |.......].#.&.Ep.| -000001f0 65 62 9b 7e 01 99 3d 18 f6 10 9a 38 61 9b 2e 57 |eb.~..=....8a..W| -00000200 e4 fa cc b1 8a ce e2 23 a0 87 f0 e1 67 51 eb 16 |.......#....gQ..| -00000210 03 03 00 86 10 00 00 82 00 80 88 00 24 23 a5 c7 |............$#..| -00000220 03 2d 86 37 91 f1 71 a9 5f fb 97 49 88 04 9b 0e |.-.7..q._..I....| -00000230 89 da 65 d0 56 71 e7 76 22 ef 8e 11 0e 6b 50 3d |..e.Vq.v"....kP=| -00000240 64 3f f7 9b e4 45 01 d9 12 cb da fe 10 da 4e b5 |d?...E........N.| -00000250 b8 6a b5 bc 74 19 d3 4f a9 bb ee 54 37 e4 70 d0 |.j..t..O...T7.p.| -00000260 b6 e7 35 96 70 fe a5 2b 14 ac fb c6 1a fa 7d 12 |..5.p..+......}.| -00000270 87 1b 63 9d 72 30 4d 2c 1a c9 29 32 72 b6 13 53 |..c.r0M,..)2r..S| -00000280 96 05 de 78 bc f0 1a 74 e2 31 b9 ea db 62 62 6e |...x...t.1...bbn| -00000290 a0 a6 b2 c0 3e 2a 94 0d 6a f7 16 03 03 00 92 0f |....>*..j.......| -000002a0 00 00 8e 04 03 00 8a 30 81 87 02 42 01 71 5b 3b |.......0...B.q[;| -000002b0 a3 35 58 c0 b6 08 09 4f ac af 89 e0 b3 d5 3d 45 |.5X....O......=E| -000002c0 1f 49 7f 4a c9 bc 9d 0e 50 3a f5 79 bc 54 5d a9 |.I.J....P:.y.T].| -000002d0 62 ed 85 c5 f3 47 36 03 cc f1 cd 33 c3 70 2a a6 |b....G6....3.p*.| -000002e0 7c d9 6e 0c db 0d 1b 4f 6a 39 ba 77 bd ea 02 41 ||.n....Oj9.w...A| -000002f0 00 f2 b7 06 df 2f 81 7e 98 24 46 06 59 4e 86 6a |...../.~.$F.YN.j| -00000300 b7 4f b6 4b 95 40 88 f0 8f f8 bd 16 f5 d5 82 7e |.O.K.@.........~| -00000310 82 51 6f 05 49 43 59 cd 1d 40 69 67 ff 65 a8 68 |.Qo.ICY..@ig.e.h| -00000320 39 2f a1 ad a7 6a ef 5c d5 69 5e 16 50 bb 2a b2 |9/...j.\.i^.P.*.| -00000330 2f 14 03 03 00 01 01 16 03 03 00 24 55 f6 74 21 |/..........$U.t!| -00000340 b4 08 a0 7f a2 dc 86 44 e3 f8 e3 0d e1 d6 5c 1c |.......D......\.| -00000350 22 1e 41 2b 30 cc 34 0f a4 a1 7c a0 27 21 01 e0 |".A+0.4...|.'!..| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 6f 6b e7 fb f7 |..........$ok...| -00000010 52 83 b3 6f ba 1b d7 e8 cb 0a 05 ee 90 04 2b c7 |R..o..........+.| -00000020 c2 bd 0d 8e ee 42 88 40 ae 01 4a d0 07 4b f4 17 |.....B.@..J..K..| -00000030 03 03 00 21 e0 8b bd 80 04 18 9c be 12 07 d4 4d |...!...........M| -00000040 58 d9 ec c3 f0 67 b5 b3 d1 78 25 e7 2e dd a0 0a |X....g...x%.....| -00000050 ac 0f a1 90 59 15 03 03 00 16 76 30 22 0b 00 83 |....Y.....v0"...| -00000060 c4 31 29 1c ca 44 cb 9f 0e 48 17 21 43 f6 af 47 |.1)..D...H.!C..G| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven deleted file mode 100644 index 862e0be09eef947abc0d13095bd128d71bce7a30..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedAndGiven +++ /dev/null @@ -1,116 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 b0 80 f6 7c 13 |....Z...V.....|.| -00000010 30 5d 57 f0 11 3b 30 4b 0e 01 50 9a 44 0b 89 6f |0]W..;0K..P.D..o| -00000020 b6 f1 a3 34 b4 f1 b9 bf fe 66 a5 00 00 04 00 05 |...4.....f......| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 17 0d 00 00 13 02 01 40 00 0c 04 01 04 03 05 01 |.......@........| -000002c0 05 03 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 |................| -000002d0 00 |.| ->>> Flow 3 (client to server) -00000000 16 03 03 01 fb 0b 00 01 f7 00 01 f4 00 01 f1 30 |...............0| -00000010 82 01 ed 30 82 01 58 a0 03 02 01 02 02 01 00 30 |...0..X........0| -00000020 0b 06 09 2a 86 48 86 f7 0d 01 01 05 30 26 31 10 |...*.H......0&1.| -00000030 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -00000040 31 12 30 10 06 03 55 04 03 13 09 31 32 37 2e 30 |1.0...U....127.0| -00000050 2e 30 2e 31 30 1e 17 0d 31 31 31 32 30 38 30 37 |.0.10...11120807| -00000060 35 35 31 32 5a 17 0d 31 32 31 32 30 37 30 38 30 |5512Z..121207080| -00000070 30 31 32 5a 30 26 31 10 30 0e 06 03 55 04 0a 13 |012Z0&1.0...U...| -00000080 07 41 63 6d 65 20 43 6f 31 12 30 10 06 03 55 04 |.Acme Co1.0...U.| -00000090 03 13 09 31 32 37 2e 30 2e 30 2e 31 30 81 9c 30 |...127.0.0.10..0| -000000a0 0b 06 09 2a 86 48 86 f7 0d 01 01 01 03 81 8c 00 |...*.H..........| -000000b0 30 81 88 02 81 80 4e d0 7b 31 e3 82 64 d9 59 c0 |0.....N.{1..d.Y.| -000000c0 c2 87 a4 5e 1e 8b 73 33 c7 63 53 df 66 92 06 84 |...^..s3.cS.f...| -000000d0 f6 64 d5 8f e4 36 a7 1d 2b e8 b3 20 36 45 23 b5 |.d...6..+.. 6E#.| -000000e0 e3 95 ae ed e0 f5 20 9c 8d 95 df 7f 5a 12 ef 87 |...... .....Z...| -000000f0 e4 5b 68 e4 e9 0e 74 ec 04 8a 7f de 93 27 c4 01 |.[h...t......'..| -00000100 19 7a bd f2 dc 3d 14 ab d0 54 ca 21 0c d0 4d 6e |.z...=...T.!..Mn| -00000110 87 2e 5c c5 d2 bb 4d 4b 4f ce b6 2c f7 7e 88 ec |..\...MKO..,.~..| -00000120 7c d7 02 91 74 a6 1e 0c 1a da e3 4a 5a 2e de 13 ||...t......JZ...| -00000130 9c 4c 40 88 59 93 02 03 01 00 01 a3 32 30 30 30 |.L@.Y.......2000| -00000140 0e 06 03 55 1d 0f 01 01 ff 04 04 03 02 00 a0 30 |...U...........0| -00000150 0d 06 03 55 1d 0e 04 06 04 04 01 02 03 04 30 0f |...U..........0.| -00000160 06 03 55 1d 23 04 08 30 06 80 04 01 02 03 04 30 |..U.#..0.......0| -00000170 0b 06 09 2a 86 48 86 f7 0d 01 01 05 03 81 81 00 |...*.H..........| -00000180 36 1f b3 7a 0c 75 c9 6e 37 46 61 2b d5 bd c0 a7 |6..z.u.n7Fa+....| -00000190 4b cc 46 9a 81 58 7c 85 79 29 c8 c8 c6 67 dd 32 |K.F..X|.y)...g.2| -000001a0 56 45 2b 75 b6 e9 24 a9 50 9a be 1f 5a fa 1a 15 |VE+u..$.P...Z...| -000001b0 d9 cc 55 95 72 16 83 b9 c2 b6 8f fd 88 8c 38 84 |..U.r.........8.| -000001c0 1d ab 5d 92 31 13 4f fd 83 3b c6 9d f1 11 62 b6 |..].1.O..;....b.| -000001d0 8b ec ab 67 be c8 64 b0 11 50 46 58 17 6b 99 1c |...g..d..PFX.k..| -000001e0 d3 1d fc 06 f1 0e e5 96 a8 0c f9 78 20 b7 44 18 |...........x .D.| -000001f0 51 8d 10 7e 4f 94 67 df a3 4e 70 73 8e 90 91 85 |Q..~O.g..Nps....| -00000200 16 03 03 00 86 10 00 00 82 00 80 98 61 16 34 c4 |............a.4.| -00000210 c6 0a 47 c1 de 87 b1 b7 70 1b 24 8d 7e 35 90 35 |..G.....p.$.~5.5| -00000220 f7 a5 6f c7 c9 91 ad 46 4c 50 e5 7e 61 7c 49 66 |..o....FLP.~a|If| -00000230 e9 fe 1e 2c 30 fa 22 03 36 8f 44 27 a7 d2 14 84 |...,0.".6.D'....| -00000240 d0 1f 21 ca 40 35 d1 7d 31 3f e1 73 de 69 bc da |..!.@5.}1?.s.i..| -00000250 a5 96 8a b5 50 2b 4b 87 5a b3 fb e1 11 0a 29 59 |....P+K.Z.....)Y| -00000260 13 2e e3 c2 05 d3 23 e8 09 0c 42 f6 8e 26 67 89 |......#...B..&g.| -00000270 24 0f 08 2f 3d 24 2b 0c a2 98 38 02 5c 95 9f ce |$../=$+...8.\...| -00000280 e3 75 ba 05 b5 f8 f0 07 e9 a1 44 16 03 03 00 88 |.u........D.....| -00000290 0f 00 00 84 04 01 00 80 04 c0 bc 4b 23 59 ed 26 |...........K#Y.&| -000002a0 8d 90 35 da 5b 55 88 e7 12 10 7b d7 1c 27 d1 c4 |..5.[U....{..'..| -000002b0 d8 1b e2 e7 54 ad a4 be 00 6b 5b 61 2d ec 97 0c |....T....k[a-...| -000002c0 a5 9b ae ab 13 fa 94 53 1c 65 28 21 7d b5 c5 be |.......S.e(!}...| -000002d0 22 62 91 78 fc e3 de 84 5c 4e 0d f5 73 5e 20 49 |"b.x....\N..s^ I| -000002e0 5a e2 f9 d3 2f 36 23 91 31 5b ee c7 0b 6f b3 35 |Z.../6#.1[...o.5| -000002f0 2f 8a 51 84 3c fe 78 34 1f 8c 68 d3 fc 4f c6 5e |/.Q.<.x4..h..O.^| -00000300 7b fe b2 81 79 91 37 ee 7f f1 9b a4 88 5f 1b 44 |{...y.7......_.D| -00000310 dc e9 36 bb d1 45 bb 1f 14 03 03 00 01 01 16 03 |..6..E..........| -00000320 03 00 24 12 e7 8a 31 36 26 9f fe 45 95 cf 41 56 |..$...16&..E..AV| -00000330 b4 69 ef e4 22 14 5a 4d c8 79 a7 18 7b 68 a8 02 |.i..".ZM.y..{h..| -00000340 75 ea 42 fe c4 a1 32 |u.B...2| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 ae 6d 7b ac b6 |..........$.m{..| -00000010 62 5c 40 65 6b 0e 5c 12 68 61 14 90 54 3e 24 78 |b\@ek.\.ha..T>$x| -00000020 be 85 17 a0 9b de a0 00 e9 80 1b a9 0f e4 d7 17 |................| -00000030 03 03 00 21 86 06 17 6b 62 02 a7 a0 71 fe c0 e4 |...!...kb...q...| -00000040 44 00 54 dd cc a9 70 cf bc 92 0d 40 07 62 f5 39 |D.T...p....@.b.9| -00000050 2a 30 ab 7f cd 15 03 03 00 16 6f 8d c9 d4 62 02 |*0........o...b.| -00000060 da 64 4c 89 32 86 9f 29 24 05 ed cc 77 9d e5 55 |.dL.2..)$...w..U| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven deleted file mode 100644 index 5de6dd82ec0b27325f879dfcb8c0e4b34056e765..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ClientAuthRequestedNotGiven +++ /dev/null @@ -1,76 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 52 b6 c5 b4 e3 |....Z...V..R....| -00000010 35 ce 4e b2 9c e0 38 09 e7 fe 00 a2 1a 0a 43 eb |5.N...8.......C.| -00000020 df 98 6a 34 71 f9 d0 f8 5d e7 5e 00 00 04 00 05 |..j4q...].^.....| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 17 0d 00 00 13 02 01 40 00 0c 04 01 04 03 05 01 |.......@........| -000002c0 05 03 02 01 02 03 00 00 16 03 03 00 04 0e 00 00 |................| -000002d0 00 |.| ->>> Flow 3 (client to server) -00000000 16 03 03 00 07 0b 00 00 03 00 00 00 16 03 03 00 |................| -00000010 86 10 00 00 82 00 80 2e 8e cb 6c f5 db 45 5b f0 |..........l..E[.| -00000020 67 7d b1 ac 87 c2 d6 e9 ea 37 40 15 2a ea a1 af |g}.......7@.*...| -00000030 ed 71 68 18 9c 6c 84 20 52 3e 38 94 8e d9 cd b3 |.qh..l. R>8.....| -00000040 15 73 8b db d7 ff 1d 8a ed a6 f4 00 7d d0 0a 1e |.s..........}...| -00000050 9a 1b 5c 59 f6 a0 29 62 03 a1 c6 bf 8a 57 14 06 |..\Y..)b.....W..| -00000060 9a e8 03 72 bc cd cd 6f 6d e2 ce a8 41 7a f0 65 |...r...om...Az.e| -00000070 42 0c 7b dd 93 d7 ab 37 f8 2a b3 c4 72 95 61 e1 |B.{....7.*..r.a.| -00000080 75 98 f5 99 69 ef 0a d0 00 41 0f 05 87 13 d3 7d |u...i....A.....}| -00000090 ba 74 34 43 9a 6c d0 14 03 03 00 01 01 16 03 03 |.t4C.l..........| -000000a0 00 24 87 7e 7d 48 ca 17 9c ad 30 b8 6a 05 2f d3 |.$.~}H....0.j./.| -000000b0 fc 18 2e df fd f5 0e 38 c3 06 57 4c 27 66 02 af |.......8..WL'f..| -000000c0 6d 78 4d 2e b6 dc |mxM...| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 cf ee f6 28 ea |..........$...(.| -00000010 df e2 7e 9a 75 e0 f9 b4 c4 c2 57 3a 54 26 db 7f |..~.u.....W:T&..| -00000020 c4 19 6d b6 d6 c7 b1 05 7f 92 21 9e 51 1a 0a 17 |..m.......!.Q...| -00000030 03 03 00 21 87 48 77 c4 eb 7c 5d 13 3b f4 8d 08 |...!.Hw..|].;...| -00000040 f9 35 c3 d2 e5 c0 8c ea 15 c9 2d c5 e0 70 fd 7c |.5........-..p.|| -00000050 de 93 4f 8c 8d 15 03 03 00 16 d4 8a d5 6a fc db |..O..........j..| -00000060 c7 1d 1f 76 64 b9 31 68 72 cc 58 de 9f 2a a6 45 |...vd.1hr.X..*.E| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES deleted file mode 100644 index 3b7238ad29970af507f86fe6c2b0d0ce0c63f5bb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ECDHE-ECDSA-AES +++ /dev/null @@ -1,89 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 a1 01 00 00 9d 03 03 0f b7 07 5f c7 |.............._.| -00000010 18 b8 39 6d 92 b3 90 ed bf 5c 48 7c 6a 56 ee e9 |..9m.....\H|jV..| -00000020 7a 5b 5f 71 a4 f0 7f 47 57 73 78 00 00 04 c0 0a |z[_q...GWsx.....| -00000030 00 ff 02 01 00 00 6f 00 0b 00 04 03 00 01 02 00 |......o.........| -00000040 0a 00 3a 00 38 00 0e 00 0d 00 19 00 1c 00 0b 00 |..:.8...........| -00000050 0c 00 1b 00 18 00 09 00 0a 00 1a 00 16 00 17 00 |................| -00000060 08 00 06 00 07 00 14 00 15 00 04 00 05 00 12 00 |................| -00000070 13 00 01 00 02 00 03 00 0f 00 10 00 11 00 0d 00 |................| -00000080 20 00 1e 06 01 06 02 06 03 05 01 05 02 05 03 04 | ...............| -00000090 01 04 02 04 03 03 01 03 02 03 03 02 01 02 02 02 |................| -000000a0 03 00 0f 00 01 01 |......| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 0e 0b 00 02 0a 00 |................| -00000040 02 07 00 02 04 30 82 02 00 30 82 01 62 02 09 00 |.....0...0..b...| -00000050 b8 bf 2d 47 a0 d2 eb f4 30 09 06 07 2a 86 48 ce |..-G....0...*.H.| -00000060 3d 04 01 30 45 31 0b 30 09 06 03 55 04 06 13 02 |=..0E1.0...U....| -00000070 41 55 31 13 30 11 06 03 55 04 08 13 0a 53 6f 6d |AU1.0...U....Som| -00000080 65 2d 53 74 61 74 65 31 21 30 1f 06 03 55 04 0a |e-State1!0...U..| -00000090 13 18 49 6e 74 65 72 6e 65 74 20 57 69 64 67 69 |..Internet Widgi| -000000a0 74 73 20 50 74 79 20 4c 74 64 30 1e 17 0d 31 32 |ts Pty Ltd0...12| -000000b0 31 31 32 32 31 35 30 36 33 32 5a 17 0d 32 32 31 |1122150632Z..221| -000000c0 31 32 30 31 35 30 36 33 32 5a 30 45 31 0b 30 09 |120150632Z0E1.0.| -000000d0 06 03 55 04 06 13 02 41 55 31 13 30 11 06 03 55 |..U....AU1.0...U| -000000e0 04 08 13 0a 53 6f 6d 65 2d 53 74 61 74 65 31 21 |....Some-State1!| -000000f0 30 1f 06 03 55 04 0a 13 18 49 6e 74 65 72 6e 65 |0...U....Interne| -00000100 74 20 57 69 64 67 69 74 73 20 50 74 79 20 4c 74 |t Widgits Pty Lt| -00000110 64 30 81 9b 30 10 06 07 2a 86 48 ce 3d 02 01 06 |d0..0...*.H.=...| -00000120 05 2b 81 04 00 23 03 81 86 00 04 00 c4 a1 ed be |.+...#..........| -00000130 98 f9 0b 48 73 36 7e c3 16 56 11 22 f2 3d 53 c3 |...Hs6~..V.".=S.| -00000140 3b 4d 21 3d cd 6b 75 e6 f6 b0 dc 9a df 26 c1 bc |;M!=.ku......&..| -00000150 b2 87 f0 72 32 7c b3 64 2f 1c 90 bc ea 68 23 10 |...r2|.d/....h#.| -00000160 7e fe e3 25 c0 48 3a 69 e0 28 6d d3 37 00 ef 04 |~..%.H:i.(m.7...| -00000170 62 dd 0d a0 9c 70 62 83 d8 81 d3 64 31 aa 9e 97 |b....pb....d1...| -00000180 31 bd 96 b0 68 c0 9b 23 de 76 64 3f 1a 5c 7f e9 |1...h..#.vd?.\..| -00000190 12 0e 58 58 b6 5f 70 dd 9b d8 ea d5 d7 f5 d5 cc |..XX._p.........| -000001a0 b9 b6 9f 30 66 5b 66 9a 20 e2 27 e5 bf fe 3b 30 |...0f[f. .'...;0| -000001b0 09 06 07 2a 86 48 ce 3d 04 01 03 81 8c 00 30 81 |...*.H.=......0.| -000001c0 88 02 42 01 88 a2 4f eb e2 45 c5 48 7d 1b ac f5 |..B...O..E.H}...| -000001d0 ed 98 9d ae 47 70 c0 5e 1b b6 2f bd f1 b6 4d b7 |....Gp.^../...M.| -000001e0 61 40 d3 11 a2 ce ee 0b 7e 92 7e ff 76 9d c3 3b |a@......~.~.v..;| -000001f0 7e a5 3f ce fa 10 e2 59 ec 47 2d 7c ac da 4e 97 |~.?....Y.G-|..N.| -00000200 0e 15 a0 6f d0 02 42 01 4d fc be 67 13 9c 2d 05 |...o..B.M..g..-.| -00000210 0e bd 3f a3 8c 25 c1 33 13 83 0d 94 06 bb d4 37 |..?..%.3.......7| -00000220 7a f6 ec 7a c9 86 2e dd d7 11 69 7f 85 7c 56 de |z..z......i..|V.| -00000230 fb 31 78 2b e4 c7 78 0d ae cb be 9e 4e 36 24 31 |.1x+..x.....N6$1| -00000240 7b 6a 0f 39 95 12 07 8f 2a 16 03 03 00 d8 0c 00 |{j.9....*.......| -00000250 00 d4 03 00 17 41 04 1e 18 37 ef 0d 19 51 88 35 |.....A...7...Q.5| -00000260 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 24 20 3e |uq..T[....g..$ >| -00000270 b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 07 9f 6c |.V...(^.+-O....l| -00000280 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 b5 68 1a |K[.V.2B.X..I..h.| -00000290 41 03 56 6b dc 5a 89 05 03 00 8b 30 81 88 02 42 |A.Vk.Z.....0...B| -000002a0 00 d3 cf 21 cd 3c 2e 11 f5 f8 1d c8 c1 57 4b f8 |...!.<.......WK.| -000002b0 1a c0 2b 1d 47 0f 2d a5 ac a1 c8 83 5d 76 87 05 |..+.G.-.....]v..| -000002c0 2b 0d 36 d5 57 9f b9 8a a0 a2 94 67 6a cd 29 db |+.6.W......gj.).| -000002d0 04 b0 6b 06 d9 f7 17 9f 1c 60 92 e7 4e 50 48 7f |..k......`..NPH.| -000002e0 dc d0 02 42 01 56 fd 38 bd 05 a5 16 6d 91 d1 ce |...B.V.8....m...| -000002f0 bb 8c 45 b2 76 2f 92 9c 8b 94 57 7d de 53 8b 7b |..E.v/....W}.S.{| -00000300 80 26 6c 4a 43 4b a6 c9 46 49 08 ab c7 57 f3 d9 |.&lJCK..FI...W..| -00000310 fa 1d 55 fe 91 de 8a 0d 8b d1 44 96 87 85 cb 02 |..U.......D.....| -00000320 76 9c 00 ad 5f b8 16 03 03 00 04 0e 00 00 00 |v..._..........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 0b dc ea 22 05 |....F...BA....".| -00000010 44 c2 09 47 65 31 3b 0b e1 05 1a 87 8c 2d 3b 56 |D..Ge1;......-;V| -00000020 49 34 27 3e d6 3b 93 e2 12 7f 5d 7b dc 85 c8 96 |I4'>.;....]{....| -00000030 4c 8c f9 18 6f 15 cf db 6e 2c 14 6a c9 dd 1c 70 |L...o...n,.j...p| -00000040 7e 05 c4 17 71 76 df 10 ee 8c b1 14 03 03 00 01 |~...qv..........| -00000050 01 16 03 03 00 40 ff 12 88 36 3c 00 17 d1 b9 41 |.....@...6<....A| -00000060 7a 12 25 94 4c 90 65 62 d8 09 ab f9 b4 ee c3 de |z.%.L.eb........| -00000070 46 2f cb ee 18 76 4f 76 8e dd 89 fc 7a 21 3b 5f |F/...vOv....z!;_| -00000080 ff ac 1c 03 aa be 96 82 82 ea 2e 22 2a 80 b3 86 |..........."*...| -00000090 38 e4 4d 90 91 46 |8.M..F| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 e5 c1 f0 6a db |..............j.| -00000020 05 98 ed 33 94 73 7f 13 7f 78 17 7f d1 9e c5 a7 |...3.s...x......| -00000030 62 7f 85 14 2c 7d b2 8e ef 75 a9 df 92 cc 22 20 |b...,}...u...." | -00000040 66 08 85 22 d3 ea 5c 4c 4c c8 d7 17 03 03 00 40 |f.."..\LL......@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 f2 20 07 d2 13 ca ed 01 c9 7b 91 14 01 2c 08 f5 |. .......{...,..| -00000070 8a 69 94 bc 19 9a d9 65 6b 15 04 b4 45 17 ec 6f |.i.....ek...E..o| -00000080 85 de 31 dc a2 de 8b 4d 53 57 66 4a 29 21 5a 20 |..1....MSWfJ)!Z | -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 55 15 f7 89 8d 75 57 7e 92 db ec |.....U....uW~...| -000000b0 32 ec 07 5c 83 32 36 59 61 f1 9d a6 7a eb 76 c1 |2..\.26Ya...z.v.| -000000c0 c7 96 3f 4d 0a |..?M.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicket b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicket deleted file mode 100644 index 20a0731091a6b0b679cacf92de0602b5f92917c9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicket +++ /dev/null @@ -1,83 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5e 01 00 00 5a 03 03 f0 0a 06 d0 65 |....^...Z......e| -00000010 1c c3 90 ac dc 61 42 e5 b8 a9 17 fb e7 c3 1e bd |.....aB.........| -00000020 d9 09 5a 63 71 e2 f9 58 db 26 6e 00 00 04 00 05 |..Zcq..X.&n.....| -00000030 00 ff 01 00 00 2d 00 23 00 00 00 0d 00 20 00 1e |.....-.#..... ..| -00000040 06 01 06 02 06 03 05 01 05 02 05 03 04 01 04 02 |................| -00000050 04 03 03 01 03 02 03 03 02 01 02 02 02 03 00 0f |................| -00000060 00 01 01 |...| ->>> Flow 2 (server to client) -00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 09 00 23 00 00 ff 01 00 01 00 16 03 03 02 71 0b |..#...........q.| -00000040 00 02 6d 00 02 6a 00 02 67 30 82 02 63 30 82 01 |..m..j..g0..c0..| -00000050 cc a0 03 02 01 02 02 09 00 a2 73 00 0c 81 00 cb |..........s.....| -00000060 f3 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| -00000070 30 2b 31 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f |0+1.0...U....Goo| -00000080 67 6c 65 20 54 45 53 54 49 4e 47 31 10 30 0e 06 |gle TESTING1.0..| -00000090 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -000000a0 0d 31 35 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.150101000000Z..| -000000b0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 26 31 |250101000000Z0&1| -000000c0 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 |.0...U....Google| -000000d0 20 54 45 53 54 49 4e 47 31 0b 30 09 06 03 55 04 | TESTING1.0...U.| -000000e0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| -000000f0 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -00000100 81 00 af 87 88 f6 20 1b 95 65 6c 14 ab 44 05 af |...... ..el..D..| -00000110 3b 45 14 e3 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 |;E...m..cM...jb5| -00000120 86 c0 4a f9 18 7c f6 aa 25 5e 7a 64 31 66 00 ba |..J..|..%^zd1f..| -00000130 f4 8e 92 af c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 |.....k.v.._A.nV.| -00000140 97 1b 97 c1 3c 12 39 21 66 3d 2b 16 d1 bc db 1c |....<.9!f=+.....| -00000150 c0 a7 da b7 ca ad ba da cb d5 21 50 ec de 8d ab |..........!P....| -00000160 d1 6b 81 4b 89 02 f3 c4 be c1 6c 89 b1 44 84 bd |.k.K......l..D..| -00000170 21 d1 04 7d 9d 16 4d f9 82 15 f6 ef fa d6 09 47 |!..}..M........G| -00000180 f2 fb 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |..........0..0..| -00000190 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| -000001a0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| -000001b0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| -000001c0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| -000001d0 0e 04 12 04 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e |......P..o...TMn| -000001e0 cb 69 5e 06 f4 30 1b 06 03 55 1d 23 04 14 30 12 |.i^..0...U.#..0.| -000001f0 80 10 bf 3d b6 a9 66 f2 b8 40 cf ea b4 03 78 48 |...=..f..@....xH| -00000200 1a 41 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |.A0...U....0...e| -00000210 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| -00000220 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| -00000230 92 7c af 91 55 12 18 96 59 31 a6 48 40 d5 2d d5 |.|..U...Y1.H@.-.| -00000240 ee bb 02 a0 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da |.......|..0}<.v.| -00000250 4f 3d c0 fa ae 2d 33 24 6b 03 7b 1b 67 59 11 21 |O=...-3$k.{.gY.!| -00000260 b5 11 bc 77 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 |...w...n.-.5.d_"| -00000270 3e 63 10 6b be ff 14 86 6d 0d f0 15 31 a8 14 38 |>c.k....m...1..8| -00000280 1e 3b 84 87 2c cb 98 ed 51 76 b9 b1 4f dd db 9b |.;..,...Qv..O...| -00000290 84 04 86 40 fa 51 dd ba b4 8d eb e3 46 de 46 b9 |...@.Q......F.F.| -000002a0 4f 86 c7 f9 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 |O.....A4......9.| -000002b0 16 03 03 00 04 0e 00 00 00 |.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 87 06 ba d7 1f |................| -00000010 68 0c f2 a6 51 b4 ae af 8c c5 5d d4 bd f1 82 6d |h...Q.....]....m| -00000020 1d dd ce 69 be 07 62 13 af 06 71 3a 47 a9 bd f7 |...i..b...q:G...| -00000030 bb 27 f0 38 df 88 01 40 29 c9 bb 7b 5d 6d 28 bd |.'.8...@)..{]m(.| -00000040 c8 28 e6 6d ff 5c c9 d3 c6 f5 06 17 e5 e5 1c 5b |.(.m.\.........[| -00000050 a1 18 7a 34 92 0a 39 20 5a 22 44 6c cc 5c 8c 83 |..z4..9 Z"Dl.\..| -00000060 d0 19 4c bb 4e dc e2 64 ec b2 b8 3f 18 3f 9d 65 |..L.N..d...?.?.e| -00000070 5b 89 26 ae f6 fd 54 71 c4 45 e9 56 6a 28 42 a9 |[.&...Tq.E.Vj(B.| -00000080 5b 9f 12 69 a4 08 83 53 95 04 18 14 03 03 00 01 |[..i...S........| -00000090 01 16 03 03 00 24 55 80 0f 43 c3 08 45 99 c9 1b |.....$U..C..E...| -000000a0 fd fe dd e8 48 f2 89 99 86 ef f7 fd 5f 2a 4b 0b |....H......._*K.| -000000b0 33 0e 5f 17 bb b7 a2 3c 9d 30 |3._....<.0| ->>> Flow 4 (server to client) -00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| -00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f 2c b5 83 61 c4 74 90 94 e5 6c fd 70 64 57 3a |o,..a.t...l.pdW:| -00000040 25 78 bf 9f a0 7c 51 bc 2a 69 1e b3 fd 71 34 b7 |%x...|Q.*i...q4.| -00000050 9a ef cb 49 37 f8 5d 5e 7c cf 6d fc 13 c1 52 79 |...I7.]^|.m...Ry| -00000060 8e ed c3 84 01 33 94 10 65 34 64 5e b4 9c 07 46 |.....3..e4d^...F| -00000070 5b 9e d7 5e 55 df fd c0 e9 d2 e8 d3 c6 42 18 ef |[..^U........B..| -00000080 a5 6c be e8 d2 49 c6 14 03 03 00 01 01 16 03 03 |.l...I..........| -00000090 00 24 66 94 4b b5 3f 5d 59 db 36 c1 dd 55 8c ee |.$f.K.?]Y.6..U..| -000000a0 de a4 bc d0 12 44 31 3e e4 e7 4a 51 e3 62 69 ab |.....D1>..JQ.bi.| -000000b0 14 78 85 49 a3 97 17 03 03 00 21 dd 96 5d 21 e0 |.x.I......!..]!.| -000000c0 2e 3d 33 dd 6c df bb 41 d7 bd 50 c7 1c 6f 97 34 |.=3.l..A..P..o.4| -000000d0 6a 6e d6 1d 27 81 2d f7 fb 32 85 02 15 03 03 00 |jn..'.-..2......| -000000e0 16 5e 4e 62 15 97 a7 a3 9b 1b 50 44 85 fb 28 66 |.^Nb......PD..(f| -000000f0 aa 66 54 45 c9 dc 61 |.fTE..a| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable deleted file mode 100644 index a8f7edfa2c011a6cafc4aa631128980832118014..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable +++ /dev/null @@ -1,83 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5e 01 00 00 5a 03 03 62 f6 20 66 23 |....^...Z..b. f#| -00000010 d5 71 0a c0 57 92 2e 80 b6 06 0c 54 5b 1c 77 a0 |.q..W......T[.w.| -00000020 ce 0b b2 52 4a b9 f2 c6 97 33 42 00 00 04 00 05 |...RJ....3B.....| -00000030 00 ff 01 00 00 2d 00 23 00 00 00 0d 00 20 00 1e |.....-.#..... ..| -00000040 06 01 06 02 06 03 05 01 05 02 05 03 04 01 04 02 |................| -00000050 04 03 03 01 03 02 03 03 02 01 02 02 02 03 00 0f |................| -00000060 00 01 01 |...| ->>> Flow 2 (server to client) -00000000 16 03 03 00 35 02 00 00 31 03 03 00 00 00 00 00 |....5...1.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 09 00 23 00 00 ff 01 00 01 00 16 03 03 02 71 0b |..#...........q.| -00000040 00 02 6d 00 02 6a 00 02 67 30 82 02 63 30 82 01 |..m..j..g0..c0..| -00000050 cc a0 03 02 01 02 02 09 00 a2 73 00 0c 81 00 cb |..........s.....| -00000060 f3 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 |.0...*.H........| -00000070 30 2b 31 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f |0+1.0...U....Goo| -00000080 67 6c 65 20 54 45 53 54 49 4e 47 31 10 30 0e 06 |gle TESTING1.0..| -00000090 03 55 04 03 13 07 47 6f 20 52 6f 6f 74 30 1e 17 |.U....Go Root0..| -000000a0 0d 31 35 30 31 30 31 30 30 30 30 30 30 5a 17 0d |.150101000000Z..| -000000b0 32 35 30 31 30 31 30 30 30 30 30 30 5a 30 26 31 |250101000000Z0&1| -000000c0 17 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 |.0...U....Google| -000000d0 20 54 45 53 54 49 4e 47 31 0b 30 09 06 03 55 04 | TESTING1.0...U.| -000000e0 03 13 02 47 6f 30 81 9f 30 0d 06 09 2a 86 48 86 |...Go0..0...*.H.| -000000f0 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 |...........0....| -00000100 81 00 af 87 88 f6 20 1b 95 65 6c 14 ab 44 05 af |...... ..el..D..| -00000110 3b 45 14 e3 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 |;E...m..cM...jb5| -00000120 86 c0 4a f9 18 7c f6 aa 25 5e 7a 64 31 66 00 ba |..J..|..%^zd1f..| -00000130 f4 8e 92 af c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 |.....k.v.._A.nV.| -00000140 97 1b 97 c1 3c 12 39 21 66 3d 2b 16 d1 bc db 1c |....<.9!f=+.....| -00000150 c0 a7 da b7 ca ad ba da cb d5 21 50 ec de 8d ab |..........!P....| -00000160 d1 6b 81 4b 89 02 f3 c4 be c1 6c 89 b1 44 84 bd |.k.K......l..D..| -00000170 21 d1 04 7d 9d 16 4d f9 82 15 f6 ef fa d6 09 47 |!..}..M........G| -00000180 f2 fb 02 03 01 00 01 a3 81 93 30 81 90 30 0e 06 |..........0..0..| -00000190 03 55 1d 0f 01 01 ff 04 04 03 02 05 a0 30 1d 06 |.U...........0..| -000001a0 03 55 1d 25 04 16 30 14 06 08 2b 06 01 05 05 07 |.U.%..0...+.....| -000001b0 03 01 06 08 2b 06 01 05 05 07 03 02 30 0c 06 03 |....+.......0...| -000001c0 55 1d 13 01 01 ff 04 02 30 00 30 19 06 03 55 1d |U.......0.0...U.| -000001d0 0e 04 12 04 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e |......P..o...TMn| -000001e0 cb 69 5e 06 f4 30 1b 06 03 55 1d 23 04 14 30 12 |.i^..0...U.#..0.| -000001f0 80 10 bf 3d b6 a9 66 f2 b8 40 cf ea b4 03 78 48 |...=..f..@....xH| -00000200 1a 41 30 19 06 03 55 1d 11 04 12 30 10 82 0e 65 |.A0...U....0...e| -00000210 78 61 6d 70 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 |xample.golang0..| -00000220 09 2a 86 48 86 f7 0d 01 01 0b 05 00 03 81 81 00 |.*.H............| -00000230 92 7c af 91 55 12 18 96 59 31 a6 48 40 d5 2d d5 |.|..U...Y1.H@.-.| -00000240 ee bb 02 a0 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da |.......|..0}<.v.| -00000250 4f 3d c0 fa ae 2d 33 24 6b 03 7b 1b 67 59 11 21 |O=...-3$k.{.gY.!| -00000260 b5 11 bc 77 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 |...w...n.-.5.d_"| -00000270 3e 63 10 6b be ff 14 86 6d 0d f0 15 31 a8 14 38 |>c.k....m...1..8| -00000280 1e 3b 84 87 2c cb 98 ed 51 76 b9 b1 4f dd db 9b |.;..,...Qv..O...| -00000290 84 04 86 40 fa 51 dd ba b4 8d eb e3 46 de 46 b9 |...@.Q......F.F.| -000002a0 4f 86 c7 f9 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 |O.....A4......9.| -000002b0 16 03 03 00 04 0e 00 00 00 |.........| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 5b 43 6f db 52 |...........[Co.R| -00000010 56 e3 d9 4b 1e c8 95 8b 78 a6 19 00 44 9c 44 b4 |V..K....x...D.D.| -00000020 f7 fe d4 3f 69 ea 9c 67 d3 48 b8 c5 93 bc 22 f1 |...?i..g.H....".| -00000030 a9 0e 81 82 d0 cf dc 0b ea f0 02 67 92 8d 72 40 |...........g..r@| -00000040 25 bb f3 88 53 c0 2f ba 38 ef da d1 7c 73 84 ec |%...S./.8...|s..| -00000050 61 96 b9 d4 93 06 4a 06 7b 6d 40 e7 bb 15 59 6e |a.....J.{m@...Yn| -00000060 ad 31 71 eb cf 84 57 3b 0c ad aa 70 02 63 24 a9 |.1q...W;...p.c$.| -00000070 7c a1 9a 6d b7 e0 4c d5 67 4c ce 53 9d b6 31 de ||..m..L.gL.S..1.| -00000080 69 b9 f5 ca a8 e3 ea d6 f5 a3 f3 14 03 03 00 01 |i...............| -00000090 01 16 03 03 00 24 66 ae 13 67 70 20 f5 f5 76 03 |.....$f..gp ..v.| -000000a0 11 6e 32 a6 73 a2 70 42 ab 4f 16 93 d2 fa a1 ac |.n2.s.pB.O......| -000000b0 4e b2 08 4a a9 b5 20 aa 80 b6 |N..J.. ...| ->>> Flow 4 (server to client) -00000000 16 03 03 00 82 04 00 00 7e 00 00 00 00 00 78 50 |........~.....xP| -00000010 46 ad c1 db a8 38 86 7b 2b bb fd d0 c3 42 3e 00 |F....8.{+....B>.| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 94 |................| -00000030 6f 2c b5 83 61 bd 50 da 49 7f 8b 8f 58 57 00 a1 |o,..a.P.I...XW..| -00000040 11 0d 4a 9d 8a 39 dd 85 23 c0 eb 9d 1a 45 93 92 |..J..9..#....E..| -00000050 e7 af 15 a3 a4 48 da f9 a4 d8 8e cb 6c 3d 44 77 |.....H......l=Dw| -00000060 f9 c4 83 89 85 33 94 c1 c6 20 9a 73 44 83 89 5e |.....3... .sD..^| -00000070 59 ee 05 c6 7e 8d e9 7d 7b f8 84 46 b6 7d 43 ec |Y...~..}{..F.}C.| -00000080 f1 af 1f 0f 35 b4 1c 14 03 03 00 01 01 16 03 03 |....5...........| -00000090 00 24 8c 0d bd bc 34 93 ed ad 80 21 6d 08 e4 0e |.$....4....!m...| -000000a0 67 4f 99 8d df 2a 2d 4f 13 39 82 be a1 d2 1f 75 |gO...*-O.9.....u| -000000b0 73 c8 b2 ce 41 0c 17 03 03 00 21 d8 c2 50 d6 11 |s...A.....!..P..| -000000c0 bc 86 58 68 0e 60 4a 47 a5 d0 12 7e a3 b5 be 64 |..Xh.`JG...~...d| -000000d0 e6 b1 bc 62 70 85 d4 7c cd fe 67 cf 15 03 03 00 |...bp..|..g.....| -000000e0 16 e4 1c d5 f4 f7 d0 f5 b2 b3 2b 3d b0 7d c0 23 |..........+=.}.#| -000000f0 e2 5c a5 c7 a4 23 fa |.\...#.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-3DES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-3DES deleted file mode 100644 index 74576264d856b786f17f7ff09a0d86cec6365197..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-3DES +++ /dev/null @@ -1,77 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 ac 1d 0b 6e f3 |....Z...V.....n.| -00000010 25 04 00 97 a0 79 39 c5 ef 95 8b e3 c1 87 0d 1c |%....y9.........| -00000020 0b c3 39 3e ff 23 0e 3c 28 8f 75 00 00 04 00 0a |..9>.#.<(.u.....| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 0a 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 15 75 c5 63 e0 |............u.c.| -00000010 c3 a5 89 dd b3 bf 03 1d bd 62 86 2e 10 98 79 cb |.........b....y.| -00000020 40 3d 9b 36 7e 55 65 d7 80 0a c5 24 ff ad 98 d5 |@=.6~Ue....$....| -00000030 d4 d9 4e 1b ed 50 0a fa 8a 3e f3 01 c4 e3 47 f7 |..N..P...>....G.| -00000040 bd 81 fc 33 0b 61 6b b5 3f 38 9b 24 cd 7d 46 66 |...3.ak.?8.$.}Ff| -00000050 18 87 ea 67 04 b7 ad 23 ac 64 4e 21 cd 29 9f 60 |...g...#.dN!.).`| -00000060 0e c1 ca 3d 25 d6 d5 2b e2 60 dc b5 57 be c0 b8 |...=%..+.`..W...| -00000070 b6 35 25 96 5b 36 55 53 86 b7 90 ef 6c bf 45 2a |.5%.[6US....l.E*| -00000080 3d a0 af 08 f0 8a 9c d0 d8 6b 88 14 03 03 00 01 |=........k......| -00000090 01 16 03 03 00 30 c5 0f b8 12 c6 5a 42 6a d8 3f |.....0.....ZBj.?| -000000a0 f5 49 e4 9a 5d b7 93 90 e7 09 1f 68 40 9d 33 a9 |.I..]......h@.3.| -000000b0 21 fa 9c 12 c7 7c d4 bf 91 c2 f8 ac 27 b9 8b b6 |!....|......'...| -000000c0 34 6e f3 c0 fb 83 |4n....| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 30 00 00 00 00 00 |..........0.....| -00000010 00 00 00 c1 a2 65 c1 36 63 85 cd ca 5a eb 50 ab |.....e.6c...Z.P.| -00000020 bb ec 43 30 37 8f 71 b9 b7 2d 1b bb a2 88 fa d5 |..C07.q..-......| -00000030 b4 a5 c5 4b 19 71 53 46 7d bb d0 17 03 03 00 30 |...K.qSF}......0| -00000040 00 00 00 00 00 00 00 00 6a a1 3d c6 35 a0 58 c4 |........j.=.5.X.| -00000050 ef 12 f2 59 1e 02 42 33 42 5f fe 87 a2 1a ce b7 |...Y..B3B_......| -00000060 0d d2 36 7c 7f 1a 4c 79 1f 38 34 58 b3 05 fb 96 |..6|..Ly.84X....| -00000070 15 03 03 00 20 00 00 00 00 00 00 00 00 a1 89 42 |.... ..........B| -00000080 bc 58 1f 2f 9b c4 d7 e2 d1 ce 1c c9 e0 a5 47 be |.X./..........G.| -00000090 63 0c a4 bf 26 |c...&| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES deleted file mode 100644 index 4ca860d2c262724979c330d23f05088258611fa2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES +++ /dev/null @@ -1,81 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 be 9a 2f 46 66 |....Z...V..../Ff| -00000010 a3 b3 10 62 63 b6 32 cb de 1e eb 76 13 50 60 d0 |...bc.2....v.P`.| -00000020 ee 40 a9 cd 50 ae d8 86 10 37 8b 00 00 04 00 2f |.@..P....7...../| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 61 b4 31 93 2b |...........a.1.+| -00000010 d5 e8 06 74 b1 f6 d6 5f a3 92 78 b6 cf bf 7f ea |...t..._..x.....| -00000020 a2 07 1e 90 94 68 5b 19 ae d4 e3 11 78 96 58 fd |.....h[.....x.X.| -00000030 96 18 f2 09 58 dc 39 a1 d9 9e 83 f0 24 45 6e 6b |....X.9.....$Enk| -00000040 e6 5e e7 cb 94 42 00 10 64 d5 d2 bc 80 23 bd fe |.^...B..d....#..| -00000050 5c 3e 3a 80 ff 38 b8 dc ff 25 ba b0 0a cc ef 94 |\>:..8...%......| -00000060 a1 31 bd 04 93 91 86 6e 8b fd a1 9d 01 ee 91 a6 |.1.....n........| -00000070 44 8b 21 55 52 67 3e b1 e4 6e bd 1f 07 85 e1 97 |D.!URg>..n......| -00000080 7f 55 70 00 5f f4 4b e6 50 45 f7 14 03 03 00 01 |.Up._.K.PE......| -00000090 01 16 03 03 00 40 71 ff ab 6d 79 3c da dc 5b 34 |.....@q..my<..[4| -000000a0 48 39 48 08 e3 29 cb 53 21 fd 67 93 0b f8 81 47 |H9H..).S!.g....G| -000000b0 40 7f 23 50 5f 94 db 2b 7b 7e 9f 0b bf 38 59 d9 |@.#P_..+{~...8Y.| -000000c0 6b 57 8f 1e 83 eb 93 2c 62 12 31 c6 f5 21 f2 22 |kW.....,b.1..!."| -000000d0 7a 82 e9 e6 ec 38 |z....8| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 40 00 00 00 00 00 |..........@.....| -00000010 00 00 00 00 00 00 00 00 00 00 00 45 87 33 41 c1 |...........E.3A.| -00000020 b8 e7 4c 11 1c 1b 7b 55 51 85 06 01 c1 b6 87 6b |..L...{UQ......k| -00000030 01 b3 56 c4 5a 37 ea b6 3a c4 b0 da 1b 5c 15 d4 |..V.Z7..:....\..| -00000040 03 5a 57 e9 9a 56 16 a5 fa 77 1c 17 03 03 00 40 |.ZW..V...w.....@| -00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000060 6f 2e 7c ba 3d 85 4c 7b 1f 13 a5 d6 97 e6 67 f4 |o.|.=.L{......g.| -00000070 24 d5 a8 d4 26 41 64 0a fd b3 2e a0 a2 7a 2b 54 |$...&Ad......z+T| -00000080 a4 1d 6e fe 4c c4 73 e3 76 d0 3a 60 52 df b0 53 |..n.L.s.v.:`R..S| -00000090 15 03 03 00 30 00 00 00 00 00 00 00 00 00 00 00 |....0...........| -000000a0 00 00 00 00 00 8b 0a 6d 14 3b 84 bc 7d c6 8d 9d |.......m.;..}...| -000000b0 d5 27 32 84 4b 14 75 42 0f aa 5e 88 ba fa a2 c7 |.'2.K.uB..^.....| -000000c0 16 93 8a c4 fd |.....| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM deleted file mode 100644 index 7a26ebd82a76a932e791f5080e03528826d5595e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES-GCM +++ /dev/null @@ -1,87 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 9a 01 00 00 96 03 03 16 dc f8 f5 3a |...............:| -00000010 13 32 e6 1f bd f6 3c 66 b7 4c 67 17 ee b2 2a ba |.2....>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 cd 0c 00 00 c9 03 00 17 41 04 1e 18 37 ef 0d 19 |........A...7...| -000002c0 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| -000002d0 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| -000002e0 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| -000002f0 b5 68 1a 41 03 56 6b dc 5a 89 05 01 00 80 40 b3 |.h.A.Vk.Z.....@.| -00000300 66 ee 53 3c 80 f4 da d1 de e6 fe 50 c8 89 60 d5 |f.S<.......P..`.| -00000310 e4 80 73 39 91 79 6c cf 89 bb a5 da e4 c7 e5 0d |..s9.yl.........| -00000320 13 a6 76 24 65 1a a2 b8 cb 95 c2 c6 9d 66 74 57 |..v$e........ftW| -00000330 9e 90 4f 48 77 88 3a b4 f3 fa 88 ab 61 22 d3 40 |..OHw.:.....a".@| -00000340 08 c4 0a 69 19 ed c3 ea d8 15 79 12 d5 ac 8d af |...i......y.....| -00000350 41 7d 87 4b a9 ff f8 cb 24 55 88 38 34 11 a5 bd |A}.K....$U.84...| -00000360 c1 d6 e5 86 d5 64 b5 f2 df c8 03 f2 a2 6b ff f4 |.....d.......k..| -00000370 a8 38 e0 18 04 d4 cd bd e0 cc 63 fc 3f 8b 16 03 |.8........c.?...| -00000380 03 00 04 0e 00 00 00 |.......| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 de de ff 8c df |....F...BA......| -00000010 d8 4c 72 af 29 3c 4d e0 ed 0f 34 cc fd 2d 52 63 |.Lr.)>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 92 90 01 f0 70 fa 57 2e 40 d3 4c ef 6a |.......p.W.@.L.j| -00000020 03 0c 56 65 f7 c0 3b d0 8a db 48 c9 ae 58 3e 7c |..Ve..;...H..X>|| -00000030 d1 48 67 17 03 03 00 25 00 00 00 00 00 00 00 01 |.Hg....%........| -00000040 9e 35 a0 13 73 da 3f 26 ff 1d 90 08 e9 cc 40 7e |.5..s.?&......@~| -00000050 82 f3 5e 6e b4 8e 5a 39 7f a4 09 60 b2 15 03 03 |..^n..Z9...`....| -00000060 00 1a 00 00 00 00 00 00 00 02 04 95 9b 2d 17 1c |.............-..| -00000070 6a bc 26 f7 6c 8e f1 c0 0e 82 4a 44 |j.&.l.....JD| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 deleted file mode 100644 index d59645c52dbab83daf276ca6a8937e3d725bb814..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-AES256-GCM-SHA384 +++ /dev/null @@ -1,87 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 9a 01 00 00 96 03 03 5d 6b 2a ff 74 |...........]k*.t| -00000010 88 f1 68 8d 1b eb c3 84 34 b5 19 0a 7d f1 9a 0f |..h.....4...}...| -00000020 4d c3 0a d7 98 b8 72 e0 73 e4 38 00 00 04 c0 30 |M.....r.s.8....0| -00000030 00 ff 01 00 00 69 00 0b 00 04 03 00 01 02 00 0a |.....i..........| -00000040 00 34 00 32 00 0e 00 0d 00 19 00 0b 00 0c 00 18 |.4.2............| -00000050 00 09 00 0a 00 16 00 17 00 08 00 06 00 07 00 14 |................| -00000060 00 15 00 04 00 05 00 12 00 13 00 01 00 02 00 03 |................| -00000070 00 0f 00 10 00 11 00 0d 00 20 00 1e 06 01 06 02 |......... ......| -00000080 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000090 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 c0 30 00 00 |.............0..| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 cd 0c 00 00 c9 03 00 17 41 04 1e 18 37 ef 0d 19 |........A...7...| -000002c0 51 88 35 75 71 b5 e5 54 5b 12 2e 8f 09 67 fd a7 |Q.5uq..T[....g..| -000002d0 24 20 3e b2 56 1c ce 97 28 5e f8 2b 2d 4f 9e f1 |$ >.V...(^.+-O..| -000002e0 07 9f 6c 4b 5b 83 56 e2 32 42 e9 58 b6 d7 49 a6 |..lK[.V.2B.X..I.| -000002f0 b5 68 1a 41 03 56 6b dc 5a 89 05 01 00 80 22 6b |.h.A.Vk.Z....."k| -00000300 87 4b f8 ba f2 09 91 ee ce 81 67 d4 fd d8 b5 07 |.K........g.....| -00000310 fe c3 88 96 ca e3 3a f0 87 cc ae 44 94 8e 8f 70 |......:....D...p| -00000320 79 cd de a2 26 4e 17 45 d7 ea 0f 95 a6 c9 7b 17 |y...&N.E......{.| -00000330 68 7c f5 e8 6c d5 87 6d 5a 7e 53 af 95 0c 42 91 |h|..l..mZ~S...B.| -00000340 c0 07 18 75 fd 74 1c ad ef df f8 41 b1 ad fc 36 |...u.t.....A...6| -00000350 19 31 cf c8 3f 36 55 dd 54 ac 44 a9 3a d1 ae 23 |.1..?6U.T.D.:..#| -00000360 0a 18 bf b7 6f c7 bc a6 70 50 5e 50 dd da ff 5b |....o...pP^P...[| -00000370 67 7d 0a f5 70 a0 8c 88 d9 38 d4 bf a9 c3 16 03 |g}..p....8......| -00000380 03 00 04 0e 00 00 00 |.......| ->>> Flow 3 (client to server) -00000000 16 03 03 00 46 10 00 00 42 41 04 d0 f7 11 ae 9f |....F...BA......| -00000010 ec 2e ac 8e 97 6c 58 0e 57 32 8e ac fa 3e af 36 |.....lX.W2...>.6| -00000020 22 e1 41 2b d3 d1 9c c2 1d 51 c0 e4 20 b3 4c 85 |".A+.....Q.. .L.| -00000030 b8 bd f2 d1 c6 2f 7d 83 c7 43 d9 31 36 1a 83 ca |...../}..C.16...| -00000040 c6 89 f8 ba 8c d1 7e 99 04 6e 92 14 03 03 00 01 |......~..n......| -00000050 01 16 03 03 00 28 32 67 c1 6e 5e 1e 4b 51 1b 70 |.....(2g.n^.KQ.p| -00000060 54 b9 1d 69 79 38 bd fa 7c 6b 58 71 af 72 08 2d |T..iy8..|kXq.r.-| -00000070 55 df 24 be 5b 41 0a ef 0e 90 cf d9 62 81 |U.$.[A......b.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 28 00 00 00 00 00 |..........(.....| -00000010 00 00 00 87 2a 3e 09 54 54 c3 58 c0 5b 7b 91 00 |....*>.TT.X.[{..| -00000020 c4 07 98 9e de 1f f8 04 bb d7 42 04 55 7d 18 a4 |..........B.U}..| -00000030 41 7c a6 17 03 03 00 25 00 00 00 00 00 00 00 01 |A|.....%........| -00000040 ab 23 05 51 b4 60 a2 77 01 58 be a6 9f 89 2b b5 |.#.Q.`.w.X....+.| -00000050 77 6b 19 23 67 f7 89 f1 ef d6 1b f5 e7 15 03 03 |wk.#g...........| -00000060 00 1a 00 00 00 00 00 00 00 02 8a bf f0 fb 9f 56 |...............V| -00000070 36 f1 92 49 a9 e5 40 87 f9 87 9e 4d |6..I..@....M| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 deleted file mode 100644 index 13163d68f6876ec0e7d6a36c53b684c58c192094..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-RSA-RC4 +++ /dev/null @@ -1,73 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 5a 01 00 00 56 03 03 8a fe f5 09 70 |....Z...V......p| -00000010 8e 6b e3 2b 12 ff d1 b2 ae 15 bf 47 0e ca 5c b5 |.k.+.......G..\.| -00000020 bb 0e ad af e5 a6 7e 36 c5 a4 c3 00 00 04 00 05 |......~6........| -00000030 00 ff 01 00 00 29 00 0d 00 20 00 1e 06 01 06 02 |.....)... ......| -00000040 06 03 05 01 05 02 05 03 04 01 04 02 04 03 03 01 |................| -00000050 03 02 03 03 02 01 02 02 02 03 00 0f 00 01 01 |...............| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 1c f7 2c 18 38 |.............,.8| -00000010 d9 41 b5 ab b7 35 2b 75 2d 66 ba c8 70 c2 19 1c |.A...5+u-f..p...| -00000020 f2 6d d9 a9 a8 40 8e b5 2c 75 99 06 a5 25 be 0d |.m...@..,u...%..| -00000030 b4 b0 9b aa fc 6b 12 a5 b3 e7 02 60 aa 25 e9 7f |.....k.....`.%..| -00000040 6b f5 c4 7a 1d 16 a5 d1 76 cc d5 a1 18 68 91 c3 |k..z....v....h..| -00000050 57 b8 10 f2 b8 81 f3 1b 74 ef 6c 37 3e 81 41 09 |W.......t.l7>.A.| -00000060 2a c5 15 e6 cc bb 74 4c 01 7a b9 82 5c e2 7f b7 |*.....tL.z..\...| -00000070 ac 2d 76 30 18 30 c2 19 8c 5f f2 80 41 89 bb 47 |.-v0.0..._..A..G| -00000080 28 3d 61 cc 3c 06 a8 76 93 57 71 14 03 03 00 01 |(=a.<..v.Wq.....| -00000090 01 16 03 03 00 24 46 34 1f cc eb 53 c7 d2 04 28 |.....$F4...S...(| -000000a0 b6 3d 3f 39 06 70 56 b7 db eb 53 9c 66 c3 45 9f |.=?9.pV...S.f.E.| -000000b0 69 ca 58 8f e7 ba a7 e6 5a 97 |i.X.....Z.| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 78 c3 02 89 60 |..........$x...`| -00000010 e7 72 9f 51 87 14 ca 2e 0d 79 98 eb 1e 39 62 f9 |.r.Q.....y...9b.| -00000020 fc a5 c9 2c f8 0c 04 16 60 70 90 b7 31 f8 30 17 |...,....`p..1.0.| -00000030 03 03 00 21 6a b7 24 73 a7 0d 17 04 d7 54 a8 ea |...!j.$s.....T..| -00000040 28 4e f2 0a ef 87 d5 a9 b8 84 81 46 8e 97 d1 ae |(N.........F....| -00000050 3c cc b1 6b 72 15 03 03 00 16 1a bb 2f df ae 3e |<..kr......./..>| -00000060 a7 89 69 3e 35 f2 f6 cd 35 60 29 3a 6f be 32 0d |..i>5...5`):o.2.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-Resume b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-Resume deleted file mode 100644 index 8cacd2184087fed16428c58035e8fc5cf1f0d871..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-Resume +++ /dev/null @@ -1,37 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f6 01 00 00 f2 03 03 53 1e 13 2e bd |...........S....| -00000010 ad 66 fd 77 1a ad 5f 4d cb bd 2e ca b5 c2 45 1d |.f.w.._M......E.| -00000020 7c 83 9d 62 3e 39 9c ce 78 99 e7 20 b4 06 b0 ec ||..b>9..x.. ....| -00000030 cf b7 52 6e 38 10 31 37 b2 e6 58 0f fa e3 b0 cb |..Rn8.17..X.....| -00000040 20 a4 d2 4b f3 7d 92 e6 7e 13 37 08 00 04 00 05 | ..K.}..~.7.....| -00000050 00 ff 01 00 00 a5 00 23 00 78 50 46 ad c1 db a8 |.......#.xPF....| -00000060 38 86 7b 2b bb fd d0 c3 42 3e 00 00 00 00 00 00 |8.{+....B>......| -00000070 00 00 00 00 00 00 00 00 00 00 94 6f 2c b5 83 61 |...........o,..a| -00000080 c4 74 90 94 e5 6c fd 70 64 57 3a 25 78 bf 9f a0 |.t...l.pdW:%x...| -00000090 7c 51 bc 2a 69 1e b3 fd 71 34 b7 9a ef cb 49 37 ||Q.*i...q4....I7| -000000a0 f8 5d 5e 7c cf 6d fc 13 c1 52 79 8e ed c3 84 01 |.]^|.m...Ry.....| -000000b0 33 94 10 65 34 64 5e b4 9c 07 46 5b 9e d7 5e 55 |3..e4d^...F[..^U| -000000c0 df fd c0 e9 d2 e8 d3 c6 42 18 ef a5 6c be e8 d2 |........B...l...| -000000d0 49 c6 00 0d 00 20 00 1e 06 01 06 02 06 03 05 01 |I.... ..........| -000000e0 05 02 05 03 04 01 04 02 04 03 03 01 03 02 03 03 |................| -000000f0 02 01 02 02 02 03 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 03 00 51 02 00 00 4d 03 03 00 00 00 00 00 |....Q...M.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 20 b4 06 b0 ec |........... ....| -00000030 cf b7 52 6e 38 10 31 37 b2 e6 58 0f fa e3 b0 cb |..Rn8.17..X.....| -00000040 20 a4 d2 4b f3 7d 92 e6 7e 13 37 08 00 05 00 00 | ..K.}..~.7.....| -00000050 05 ff 01 00 01 00 14 03 03 00 01 01 16 03 03 00 |................| -00000060 24 24 31 13 8c 45 4f 8a fc 71 50 94 b0 6f 02 5e |$$1..EO..qP..o.^| -00000070 da d3 a3 13 8b c8 53 fb 54 8d ef 90 f7 55 b1 be |......S.T....U..| -00000080 37 30 05 e5 5d |70..]| ->>> Flow 3 (client to server) -00000000 14 03 03 00 01 01 16 03 03 00 24 ed dd e4 a5 09 |..........$.....| -00000010 0d 7c cb e4 90 9c a1 1c 21 f4 13 bd 45 8f f4 d8 |.|......!...E...| -00000020 7e e2 89 7a 0d f4 75 99 66 8c 05 a3 1a e2 2b |~..z..u.f.....+| ->>> Flow 4 (server to client) -00000000 17 03 03 00 21 69 fa 9e 98 fb 7a 95 b1 8e e5 74 |....!i....z....t| -00000010 03 02 d7 3d 69 c4 b8 c9 5b 49 e3 30 32 e3 c5 6a |...=i...[I.02..j| -00000020 fa 20 98 bd 01 ed 15 03 03 00 16 c9 b1 20 1f 30 |. ........... .0| -00000030 c1 2f 15 75 cd 82 45 de 1a 81 cd dc 10 05 1c 45 |./.u..E........E| -00000040 dc |.| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ResumeDisabled b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ResumeDisabled deleted file mode 100644 index 912c1787a1e1c96cb8e898ef6a928501f378645a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-ResumeDisabled +++ /dev/null @@ -1,83 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 f6 01 00 00 f2 03 03 aa 0c c2 75 42 |..............uB| -00000010 62 2a 1d 14 a0 cc a1 e4 a7 19 77 50 80 2b f8 05 |b*........wP.+..| -00000020 0b fa 60 3a a7 a7 84 d3 e1 68 26 20 68 97 0c ae |..`:.....h& h...| -00000030 7b 1d bc 13 14 a8 f6 c1 e1 96 1f 54 18 2c cb 99 |{..........T.,..| -00000040 17 7d be 45 6a 39 53 c6 50 c7 8c 75 00 04 00 05 |.}.Ej9S.P..u....| -00000050 00 ff 01 00 00 a5 00 23 00 78 50 46 ad c1 db a8 |.......#.xPF....| -00000060 38 86 7b 2b bb fd d0 c3 42 3e 00 00 00 00 00 00 |8.{+....B>......| -00000070 00 00 00 00 00 00 00 00 00 00 94 6f 2c b5 83 61 |...........o,..a| -00000080 bd 50 da 49 7f 8b 8f 58 57 00 a1 11 0d 4a 9d 8a |.P.I...XW....J..| -00000090 39 dd 85 23 c0 eb 9d 1a 45 93 92 e7 af 15 a3 a4 |9..#....E.......| -000000a0 48 da f9 a4 d8 8e cb 6c 3d 44 77 f9 c4 83 89 85 |H......l=Dw.....| -000000b0 33 94 c1 c6 20 9a 73 44 83 89 5e 59 ee 05 c6 7e |3... .sD..^Y...~| -000000c0 8d e9 7d 7b f8 84 46 b6 7d 43 ec f1 af 1f 0f 35 |..}{..F.}C.....5| -000000d0 b4 1c 00 0d 00 20 00 1e 06 01 06 02 06 03 05 01 |..... ..........| -000000e0 05 02 05 03 04 01 04 02 04 03 03 01 03 02 03 03 |................| -000000f0 02 01 02 02 02 03 00 0f 00 01 01 |...........| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 05 00 00 |................| -00000030 05 ff 01 00 01 00 16 03 03 02 71 0b 00 02 6d 00 |..........q...m.| -00000040 02 6a 00 02 67 30 82 02 63 30 82 01 cc a0 03 02 |.j..g0..c0......| -00000050 01 02 02 09 00 a2 73 00 0c 81 00 cb f3 30 0d 06 |......s......0..| -00000060 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 2b 31 17 |.*.H........0+1.| -00000070 30 15 06 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 |0...U....Google | -00000080 54 45 53 54 49 4e 47 31 10 30 0e 06 03 55 04 03 |TESTING1.0...U..| -00000090 13 07 47 6f 20 52 6f 6f 74 30 1e 17 0d 31 35 30 |..Go Root0...150| -000000a0 31 30 31 30 30 30 30 30 30 5a 17 0d 32 35 30 31 |101000000Z..2501| -000000b0 30 31 30 30 30 30 30 30 5a 30 26 31 17 30 15 06 |01000000Z0&1.0..| -000000c0 03 55 04 0a 13 0e 47 6f 6f 67 6c 65 20 54 45 53 |.U....Google TES| -000000d0 54 49 4e 47 31 0b 30 09 06 03 55 04 03 13 02 47 |TING1.0...U....G| -000000e0 6f 30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 |o0..0...*.H.....| -000000f0 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 af 87 |.......0........| -00000100 88 f6 20 1b 95 65 6c 14 ab 44 05 af 3b 45 14 e3 |.. ..el..D..;E..| -00000110 b7 6d fd 00 63 4d 95 7f fe 6a 62 35 86 c0 4a f9 |.m..cM...jb5..J.| -00000120 18 7c f6 aa 25 5e 7a 64 31 66 00 ba f4 8e 92 af |.|..%^zd1f......| -00000130 c7 6b d8 76 d4 f3 5f 41 cb 6e 56 15 97 1b 97 c1 |.k.v.._A.nV.....| -00000140 3c 12 39 21 66 3d 2b 16 d1 bc db 1c c0 a7 da b7 |<.9!f=+.........| -00000150 ca ad ba da cb d5 21 50 ec de 8d ab d1 6b 81 4b |......!P.....k.K| -00000160 89 02 f3 c4 be c1 6c 89 b1 44 84 bd 21 d1 04 7d |......l..D..!..}| -00000170 9d 16 4d f9 82 15 f6 ef fa d6 09 47 f2 fb 02 03 |..M........G....| -00000180 01 00 01 a3 81 93 30 81 90 30 0e 06 03 55 1d 0f |......0..0...U..| -00000190 01 01 ff 04 04 03 02 05 a0 30 1d 06 03 55 1d 25 |.........0...U.%| -000001a0 04 16 30 14 06 08 2b 06 01 05 05 07 03 01 06 08 |..0...+.........| -000001b0 2b 06 01 05 05 07 03 02 30 0c 06 03 55 1d 13 01 |+.......0...U...| -000001c0 01 ff 04 02 30 00 30 19 06 03 55 1d 0e 04 12 04 |....0.0...U.....| -000001d0 10 12 50 8d 89 6f 1b d1 dc 54 4d 6e cb 69 5e 06 |..P..o...TMn.i^.| -000001e0 f4 30 1b 06 03 55 1d 23 04 14 30 12 80 10 bf 3d |.0...U.#..0....=| -000001f0 b6 a9 66 f2 b8 40 cf ea b4 03 78 48 1a 41 30 19 |..f..@....xH.A0.| -00000200 06 03 55 1d 11 04 12 30 10 82 0e 65 78 61 6d 70 |..U....0...examp| -00000210 6c 65 2e 67 6f 6c 61 6e 67 30 0d 06 09 2a 86 48 |le.golang0...*.H| -00000220 86 f7 0d 01 01 0b 05 00 03 81 81 00 92 7c af 91 |.............|..| -00000230 55 12 18 96 59 31 a6 48 40 d5 2d d5 ee bb 02 a0 |U...Y1.H@.-.....| -00000240 f5 c2 1e 7c 9b b3 30 7d 3c dc 76 da 4f 3d c0 fa |...|..0}<.v.O=..| -00000250 ae 2d 33 24 6b 03 7b 1b 67 59 11 21 b5 11 bc 77 |.-3$k.{.gY.!...w| -00000260 b9 d9 e0 6e a8 2d 2e 35 fa 64 5f 22 3e 63 10 6b |...n.-.5.d_">c.k| -00000270 be ff 14 86 6d 0d f0 15 31 a8 14 38 1e 3b 84 87 |....m...1..8.;..| -00000280 2c cb 98 ed 51 76 b9 b1 4f dd db 9b 84 04 86 40 |,...Qv..O......@| -00000290 fa 51 dd ba b4 8d eb e3 46 de 46 b9 4f 86 c7 f9 |.Q......F.F.O...| -000002a0 a4 c2 41 34 ac cc f6 ea b0 ab 39 18 16 03 03 00 |..A4......9.....| -000002b0 04 0e 00 00 00 |.....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 ac 10 32 61 b0 |.............2a.| -00000010 03 e3 1e 2f 89 91 5f d6 4c e0 82 a7 82 41 67 d3 |.../.._.L....Ag.| -00000020 5f b3 68 2d c0 d1 6f 03 7b 79 94 cc bb 35 6c 8a |_.h-..o.{y...5l.| -00000030 bf 1c 83 ff 88 91 5c 04 64 cc a0 df 0b 08 8c 0f |......\.d.......| -00000040 72 13 17 9f 27 14 8d 9a af 17 70 41 44 9f 89 8c |r...'.....pAD...| -00000050 fa e4 66 33 4d bd 2f 93 2a 1e 85 a1 af 9e 27 12 |..f3M./.*.....'.| -00000060 59 a4 13 67 56 85 c2 86 47 f8 c5 49 8f a4 c2 6e |Y..gV...G..I...n| -00000070 04 78 0f 11 2b fb 7e 34 b8 eb 25 93 71 ab 9f f5 |.x..+.~4..%.q...| -00000080 93 df 2b c3 1e 9e 6a 9e e3 57 aa 14 03 03 00 01 |..+...j..W......| -00000090 01 16 03 03 00 24 e0 13 15 10 4c db f3 b6 de d2 |.....$....L.....| -000000a0 68 02 f5 ea 1f 8e 58 70 4a 5a 78 d9 66 c5 74 77 |h.....XpJZx.f.tw| -000000b0 a0 3a ec d8 b7 42 e3 a5 d4 62 |.:...B...b| ->>> Flow 4 (server to client) -00000000 14 03 03 00 01 01 16 03 03 00 24 e9 c1 1f 5b e6 |..........$...[.| -00000010 c1 d5 8a 14 eb c6 41 c1 77 6d 59 83 b6 95 34 f9 |......A.wmY...4.| -00000020 7b a1 c9 9d 58 a5 b2 1b 33 6e 04 ab e0 03 61 17 |{...X...3n....a.| -00000030 03 03 00 21 67 8b 55 43 d7 a7 05 c9 1f a0 d3 65 |...!g.UC.......e| -00000040 30 36 07 8f d8 52 7e 40 79 31 2e 1c 1a c2 a6 fe |06...R~@y1......| -00000050 e0 39 4d a0 5d 15 03 03 00 16 b8 94 fb 17 e5 1d |.9M.]...........| -00000060 2e 28 95 cf 02 85 8e 11 2e 16 b1 53 72 aa a4 94 |.(.........Sr...| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI deleted file mode 100644 index aee57421a23447cf85db50dfd831001e06028f68..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI +++ /dev/null @@ -1,64 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 6e 01 00 00 6a 03 03 be 99 22 5c d2 |....n...j...."\.| -00000010 02 c7 a6 be f3 33 7a d4 76 1f cf 1e 39 0b 25 7c |.....3z.v...9.%|| -00000020 32 70 e4 8c 49 a6 87 b9 c1 2f 6d 00 00 04 00 2f |2p..I..../m..../| -00000030 00 ff 01 00 00 3d 00 00 00 10 00 0e 00 00 0b 73 |.....=.........s| -00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0d 00 20 00 1e |nitest.com... ..| -00000050 06 01 06 02 06 03 05 01 05 02 05 03 04 01 04 02 |................| -00000060 04 03 03 01 03 02 03 03 02 01 02 02 02 03 00 0f |................| -00000070 00 01 01 |...| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 03 02 00 0b 00 01 fc 00 |................| -00000040 01 f9 00 01 f6 30 82 01 f2 30 82 01 5d a0 03 02 |.....0...0..]...| -00000050 01 02 02 01 00 30 0b 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000060 01 05 30 28 31 10 30 0e 06 03 55 04 0a 13 07 41 |..0(1.0...U....A| -00000070 63 6d 65 20 43 6f 31 14 30 12 06 03 55 04 03 13 |cme Co1.0...U...| -00000080 0b 73 6e 69 74 65 73 74 2e 63 6f 6d 30 1e 17 0d |.snitest.com0...| -00000090 31 32 30 34 31 31 31 37 34 30 33 35 5a 17 0d 31 |120411174035Z..1| -000000a0 33 30 34 31 31 31 37 34 35 33 35 5a 30 28 31 10 |30411174535Z0(1.| -000000b0 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -000000c0 31 14 30 12 06 03 55 04 03 13 0b 73 6e 69 74 65 |1.0...U....snite| -000000d0 73 74 2e 63 6f 6d 30 81 9d 30 0b 06 09 2a 86 48 |st.com0..0...*.H| -000000e0 86 f7 0d 01 01 01 03 81 8d 00 30 81 89 02 81 81 |..........0.....| -000000f0 00 bb 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 |..y......F...i..| -00000100 2b 07 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 |+.CZ..-.zC...R..| -00000110 65 4c 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e |eL,x.#........;~| -00000120 62 a5 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa |b.,.3...\zV.....| -00000130 58 7b 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 |X{&?......!.J..T| -00000140 9f 5a bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d |.Z..Bq......~.}}| -00000150 f1 04 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 |..9....Q.|..L;2f| -00000160 01 cf af b1 1d b8 71 9a 1d db db 89 6b ae da 2d |......q.....k..-| -00000170 79 02 03 01 00 01 a3 32 30 30 30 0e 06 03 55 1d |y......2000...U.| -00000180 0f 01 01 ff 04 04 03 02 00 a0 30 0d 06 03 55 1d |..........0...U.| -00000190 0e 04 06 04 04 01 02 03 04 30 0f 06 03 55 1d 23 |.........0...U.#| -000001a0 04 08 30 06 80 04 01 02 03 04 30 0b 06 09 2a 86 |..0.......0...*.| -000001b0 48 86 f7 0d 01 01 05 03 81 81 00 89 c6 45 5f 1c |H............E_.| -000001c0 1f 5e f8 eb 1a b1 74 ee 24 39 05 9f 5c 42 59 bb |.^....t.$9..\BY.| -000001d0 1a 8d 86 cd b1 d0 56 f5 6a 71 7d a4 0e 95 ab 90 |......V.jq}.....| -000001e0 f5 9e 8d ea f6 27 c1 57 99 50 94 db 08 02 26 6e |.....'.W.P....&n| -000001f0 b3 4f c6 84 2d ea 8a 4b 68 d9 c1 38 91 03 ab 84 |.O..-..Kh..8....| -00000200 fb 9e 1f 85 d9 b5 d2 3f f2 31 2c 86 70 fb b5 40 |.......?.1,.p..@| -00000210 14 82 45 a4 eb af e2 64 d9 0c 8a 4c f4 f8 5b 0f |..E....d...L..[.| -00000220 ac 12 ac 2f c4 a3 15 4b ad 52 46 28 68 af 96 c6 |.../...K.RF(h...| -00000230 2c 65 25 d6 52 b6 e3 18 45 bd cc 16 03 03 00 04 |,e%.R...E.......| -00000240 0e 00 00 00 |....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 6b 03 31 ca a0 |...........k.1..| -00000010 62 a2 53 11 ce 13 d9 f6 e7 d4 ec 2e c3 0a 38 56 |b.S...........8V| -00000020 23 22 67 23 c8 8d 16 b4 3c 0b 26 9f 1c 2d 65 13 |#"g#....<.&..-e.| -00000030 c3 cb 65 69 b0 47 ff 87 e8 02 56 c4 77 8a 40 29 |..ei.G....V.w.@)| -00000040 82 62 8b 06 61 0a 1c b3 c7 29 b6 aa c9 96 37 18 |.b..a....)....7.| -00000050 d0 60 66 63 9b 62 4b 30 cc 03 9c 37 05 c6 32 98 |.`fc.bK0...7..2.| -00000060 cb a0 e2 e4 38 60 d4 93 99 9a fc 03 66 fb b6 ef |....8`......f...| -00000070 8a 1e bb ca 13 c5 d9 7a 7c 3b 50 dc d0 ad 00 b5 |.......z|;P.....| -00000080 2c dc 1a ef c4 5c af d3 4e cd e6 14 03 03 00 01 |,....\..N.......| -00000090 01 16 03 03 00 40 42 31 83 8a 2c 86 22 c5 df e5 |.....@B1..,."...| -000000a0 f2 0b f8 0c 2f 1e 82 f4 69 fe 1d bd 4c db f1 80 |..../...i...L...| -000000b0 68 30 b7 e3 60 76 b3 f1 52 ae d6 e7 b3 cb 4a e0 |h0..`v..R.....J.| -000000c0 27 0a c1 1a 72 ed 71 ab 0a fc 10 d9 5e 4d fd 10 |'...r.q.....^M..| -000000d0 04 92 39 78 be 23 |..9x.#| ->>> Flow 4 (server to client) -00000000 15 03 03 00 02 02 14 |.......| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate deleted file mode 100644 index 40d3714a86db625f08b51f63c4f9116674f67c7e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificate +++ /dev/null @@ -1,64 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 6e 01 00 00 6a 03 03 23 de 75 da 8e |....n...j..#.u..| -00000010 0a 4b 7b e4 cb 34 14 83 be d1 6a 95 25 86 f8 91 |.K{..4....j.%...| -00000020 d8 bb ac 82 9e 19 d6 9f 52 26 f6 00 00 04 00 2f |........R&...../| -00000030 00 ff 01 00 00 3d 00 00 00 10 00 0e 00 00 0b 73 |.....=.........s| -00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0d 00 20 00 1e |nitest.com... ..| -00000050 06 01 06 02 06 03 05 01 05 02 05 03 04 01 04 02 |................| -00000060 04 03 03 01 03 02 03 03 02 01 02 02 02 03 00 0f |................| -00000070 00 01 01 |...| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 03 02 00 0b 00 01 fc 00 |................| -00000040 01 f9 00 01 f6 30 82 01 f2 30 82 01 5d a0 03 02 |.....0...0..]...| -00000050 01 02 02 01 00 30 0b 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000060 01 05 30 28 31 10 30 0e 06 03 55 04 0a 13 07 41 |..0(1.0...U....A| -00000070 63 6d 65 20 43 6f 31 14 30 12 06 03 55 04 03 13 |cme Co1.0...U...| -00000080 0b 73 6e 69 74 65 73 74 2e 63 6f 6d 30 1e 17 0d |.snitest.com0...| -00000090 31 32 30 34 31 31 31 37 34 30 33 35 5a 17 0d 31 |120411174035Z..1| -000000a0 33 30 34 31 31 31 37 34 35 33 35 5a 30 28 31 10 |30411174535Z0(1.| -000000b0 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -000000c0 31 14 30 12 06 03 55 04 03 13 0b 73 6e 69 74 65 |1.0...U....snite| -000000d0 73 74 2e 63 6f 6d 30 81 9d 30 0b 06 09 2a 86 48 |st.com0..0...*.H| -000000e0 86 f7 0d 01 01 01 03 81 8d 00 30 81 89 02 81 81 |..........0.....| -000000f0 00 bb 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 |..y......F...i..| -00000100 2b 07 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 |+.CZ..-.zC...R..| -00000110 65 4c 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e |eL,x.#........;~| -00000120 62 a5 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa |b.,.3...\zV.....| -00000130 58 7b 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 |X{&?......!.J..T| -00000140 9f 5a bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d |.Z..Bq......~.}}| -00000150 f1 04 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 |..9....Q.|..L;2f| -00000160 01 cf af b1 1d b8 71 9a 1d db db 89 6b ae da 2d |......q.....k..-| -00000170 79 02 03 01 00 01 a3 32 30 30 30 0e 06 03 55 1d |y......2000...U.| -00000180 0f 01 01 ff 04 04 03 02 00 a0 30 0d 06 03 55 1d |..........0...U.| -00000190 0e 04 06 04 04 01 02 03 04 30 0f 06 03 55 1d 23 |.........0...U.#| -000001a0 04 08 30 06 80 04 01 02 03 04 30 0b 06 09 2a 86 |..0.......0...*.| -000001b0 48 86 f7 0d 01 01 05 03 81 81 00 89 c6 45 5f 1c |H............E_.| -000001c0 1f 5e f8 eb 1a b1 74 ee 24 39 05 9f 5c 42 59 bb |.^....t.$9..\BY.| -000001d0 1a 8d 86 cd b1 d0 56 f5 6a 71 7d a4 0e 95 ab 90 |......V.jq}.....| -000001e0 f5 9e 8d ea f6 27 c1 57 99 50 94 db 08 02 26 6e |.....'.W.P....&n| -000001f0 b3 4f c6 84 2d ea 8a 4b 68 d9 c1 38 91 03 ab 84 |.O..-..Kh..8....| -00000200 fb 9e 1f 85 d9 b5 d2 3f f2 31 2c 86 70 fb b5 40 |.......?.1,.p..@| -00000210 14 82 45 a4 eb af e2 64 d9 0c 8a 4c f4 f8 5b 0f |..E....d...L..[.| -00000220 ac 12 ac 2f c4 a3 15 4b ad 52 46 28 68 af 96 c6 |.../...K.RF(h...| -00000230 2c 65 25 d6 52 b6 e3 18 45 bd cc 16 03 03 00 04 |,e%.R...E.......| -00000240 0e 00 00 00 |....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 a2 99 61 c5 90 |.............a..| -00000010 47 1a e7 47 56 51 59 e4 6e ab 82 01 18 78 ee 95 |G..GVQY.n....x..| -00000020 b8 e2 c7 c7 f9 64 98 dd 84 8d 96 d9 2d 08 62 1e |.....d......-.b.| -00000030 4f 29 83 b6 93 68 77 7a 14 1b f0 b3 1a 67 7b 7a |O)...hwz.....g{z| -00000040 f9 54 f3 7e 6d eb b6 7a c9 37 70 6a 83 68 f2 15 |.T.~m..z.7pj.h..| -00000050 81 07 30 6e b8 fa 19 0e 46 dc d6 9a 4a 8e 8d f1 |..0n....F...J...| -00000060 05 78 60 75 d4 00 d9 1e 11 5f 16 f7 bc 9f e8 8a |.x`u....._......| -00000070 c4 3e bd d9 1a b8 67 50 00 be 5f 43 ee 07 ad be |.>....gP.._C....| -00000080 f5 85 67 fc 8f c6 87 47 6d 6e b2 14 03 03 00 01 |..g....Gmn......| -00000090 01 16 03 03 00 40 91 7d 7b 05 99 48 05 70 a9 67 |.....@.}{..H.p.g| -000000a0 e9 7a 0a c3 6b bf b0 ad 68 65 17 fb 18 bf 8d bd |.z..k...he......| -000000b0 e1 4b 12 bf ea 82 9d a6 1e 3a c8 77 65 32 bd 5e |.K.......:.we2.^| -000000c0 c4 46 da e7 e1 ac 09 fe 4a ac bc 57 6a 17 7d dc |.F......J..Wj.}.| -000000d0 fe 9c d0 d0 6e fc |....n.| ->>> Flow 4 (server to client) -00000000 15 03 03 00 02 02 14 |.......| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound b/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound deleted file mode 100644 index 904f69ecacb5f43ce5c61e29a26b8c5a161c64e4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/testdata/Server-TLSv12-SNI-GetCertificateNotFound +++ /dev/null @@ -1,64 +0,0 @@ ->>> Flow 1 (client to server) -00000000 16 03 01 00 6e 01 00 00 6a 03 03 27 db e3 e8 f4 |....n...j..'....| -00000010 48 1d 45 d5 20 64 97 b2 20 a6 67 94 7a 1e 87 12 |H.E. d.. .g.z...| -00000020 25 b1 53 94 27 78 ed ae 58 2f 1b 00 00 04 00 2f |%.S.'x..X/...../| -00000030 00 ff 01 00 00 3d 00 00 00 10 00 0e 00 00 0b 73 |.....=.........s| -00000040 6e 69 74 65 73 74 2e 63 6f 6d 00 0d 00 20 00 1e |nitest.com... ..| -00000050 06 01 06 02 06 03 05 01 05 02 05 03 04 01 04 02 |................| -00000060 04 03 03 01 03 02 03 03 02 01 02 02 02 03 00 0f |................| -00000070 00 01 01 |...| ->>> Flow 2 (server to client) -00000000 16 03 03 00 31 02 00 00 2d 03 03 00 00 00 00 00 |....1...-.......| -00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| -00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 2f 00 00 |............./..| -00000030 05 ff 01 00 01 00 16 03 03 02 00 0b 00 01 fc 00 |................| -00000040 01 f9 00 01 f6 30 82 01 f2 30 82 01 5d a0 03 02 |.....0...0..]...| -00000050 01 02 02 01 00 30 0b 06 09 2a 86 48 86 f7 0d 01 |.....0...*.H....| -00000060 01 05 30 28 31 10 30 0e 06 03 55 04 0a 13 07 41 |..0(1.0...U....A| -00000070 63 6d 65 20 43 6f 31 14 30 12 06 03 55 04 03 13 |cme Co1.0...U...| -00000080 0b 73 6e 69 74 65 73 74 2e 63 6f 6d 30 1e 17 0d |.snitest.com0...| -00000090 31 32 30 34 31 31 31 37 34 30 33 35 5a 17 0d 31 |120411174035Z..1| -000000a0 33 30 34 31 31 31 37 34 35 33 35 5a 30 28 31 10 |30411174535Z0(1.| -000000b0 30 0e 06 03 55 04 0a 13 07 41 63 6d 65 20 43 6f |0...U....Acme Co| -000000c0 31 14 30 12 06 03 55 04 03 13 0b 73 6e 69 74 65 |1.0...U....snite| -000000d0 73 74 2e 63 6f 6d 30 81 9d 30 0b 06 09 2a 86 48 |st.com0..0...*.H| -000000e0 86 f7 0d 01 01 01 03 81 8d 00 30 81 89 02 81 81 |..........0.....| -000000f0 00 bb 79 d6 f5 17 b5 e5 bf 46 10 d0 dc 69 be e6 |..y......F...i..| -00000100 2b 07 43 5a d0 03 2d 8a 7a 43 85 b7 14 52 e7 a5 |+.CZ..-.zC...R..| -00000110 65 4c 2c 78 b8 23 8c b5 b4 82 e5 de 1f 95 3b 7e |eL,x.#........;~| -00000120 62 a5 2c a5 33 d6 fe 12 5c 7a 56 fc f5 06 bf fa |b.,.3...\zV.....| -00000130 58 7b 26 3f b5 cd 04 d3 d0 c9 21 96 4a c7 f4 54 |X{&?......!.J..T| -00000140 9f 5a bf ef 42 71 00 fe 18 99 07 7f 7e 88 7d 7d |.Z..Bq......~.}}| -00000150 f1 04 39 c4 a2 2e db 51 c9 7c e3 c0 4c 3b 32 66 |..9....Q.|..L;2f| -00000160 01 cf af b1 1d b8 71 9a 1d db db 89 6b ae da 2d |......q.....k..-| -00000170 79 02 03 01 00 01 a3 32 30 30 30 0e 06 03 55 1d |y......2000...U.| -00000180 0f 01 01 ff 04 04 03 02 00 a0 30 0d 06 03 55 1d |..........0...U.| -00000190 0e 04 06 04 04 01 02 03 04 30 0f 06 03 55 1d 23 |.........0...U.#| -000001a0 04 08 30 06 80 04 01 02 03 04 30 0b 06 09 2a 86 |..0.......0...*.| -000001b0 48 86 f7 0d 01 01 05 03 81 81 00 89 c6 45 5f 1c |H............E_.| -000001c0 1f 5e f8 eb 1a b1 74 ee 24 39 05 9f 5c 42 59 bb |.^....t.$9..\BY.| -000001d0 1a 8d 86 cd b1 d0 56 f5 6a 71 7d a4 0e 95 ab 90 |......V.jq}.....| -000001e0 f5 9e 8d ea f6 27 c1 57 99 50 94 db 08 02 26 6e |.....'.W.P....&n| -000001f0 b3 4f c6 84 2d ea 8a 4b 68 d9 c1 38 91 03 ab 84 |.O..-..Kh..8....| -00000200 fb 9e 1f 85 d9 b5 d2 3f f2 31 2c 86 70 fb b5 40 |.......?.1,.p..@| -00000210 14 82 45 a4 eb af e2 64 d9 0c 8a 4c f4 f8 5b 0f |..E....d...L..[.| -00000220 ac 12 ac 2f c4 a3 15 4b ad 52 46 28 68 af 96 c6 |.../...K.RF(h...| -00000230 2c 65 25 d6 52 b6 e3 18 45 bd cc 16 03 03 00 04 |,e%.R...E.......| -00000240 0e 00 00 00 |....| ->>> Flow 3 (client to server) -00000000 16 03 03 00 86 10 00 00 82 00 80 72 23 e9 89 70 |...........r#..p| -00000010 97 02 08 58 0d 28 96 5b 19 73 dd 4f 6e 4c 11 dd |...X.(.[.s.OnL..| -00000020 cb 56 14 f4 8f c8 e5 84 03 f5 7e f0 a4 08 44 8c |.V........~...D.| -00000030 22 74 01 5c e4 9d e0 38 53 90 66 e3 df bb 09 a8 |"t.\...8S.f.....| -00000040 11 97 0a 44 01 d2 70 85 14 a1 9a 2f 02 34 40 6d |...D..p..../.4@m| -00000050 66 80 72 9a 97 98 5c 91 0e dc 42 ac c2 90 2f 30 |f.r...\...B.../0| -00000060 ca 39 25 94 da 6e b6 5f 94 a9 94 66 7f 32 6a bb |.9%..n._...f.2j.| -00000070 5d 43 20 c3 74 f7 52 29 1f d5 62 6b a4 a1 8c 25 |]C .t.R)..bk...%| -00000080 46 69 22 a5 68 54 f4 68 30 e2 52 14 03 03 00 01 |Fi".hT.h0.R.....| -00000090 01 16 03 03 00 40 51 d2 78 64 e3 59 ee b7 5f 95 |.....@Q.xd.Y.._.| -000000a0 4c 49 7f 0d 49 3f 55 71 8c 3b 24 e3 81 22 4a d1 |LI..I?Uq.;$.."J.| -000000b0 ab 84 4e df 02 9d 56 ea 2a 14 71 e1 dc 1d 5c 1d |..N...V.*.q...\.| -000000c0 54 ce cb 58 f6 4d e7 73 44 0d 99 95 a5 2d 7c 2f |T..X.M.sD....-|/| -000000d0 15 f5 8f fd 97 40 |.....@| ->>> Flow 4 (server to client) -00000000 15 03 03 00 02 02 14 |.......| diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/ticket.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/ticket.go deleted file mode 100644 index 7be50ce68c959f07554e10eb6b92cb7b1b530aac..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/ticket.go +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "crypto/aes" - "crypto/cipher" - "crypto/hmac" - "crypto/sha256" - "crypto/subtle" - "errors" - "io" -) - -// sessionState contains the information that is serialized into a session -// ticket in order to later resume a connection. -type sessionState struct { - vers uint16 - cipherSuite uint16 - masterSecret []byte - certificates [][]byte - // usedOldKey is true if the ticket from which this session came from - // was encrypted with an older key and thus should be refreshed. - usedOldKey bool -} - -func (s *sessionState) equal(i interface{}) bool { - s1, ok := i.(*sessionState) - if !ok { - return false - } - - if s.vers != s1.vers || - s.cipherSuite != s1.cipherSuite || - !bytes.Equal(s.masterSecret, s1.masterSecret) { - return false - } - - if len(s.certificates) != len(s1.certificates) { - return false - } - - for i := range s.certificates { - if !bytes.Equal(s.certificates[i], s1.certificates[i]) { - return false - } - } - - return true -} - -func (s *sessionState) marshal() []byte { - length := 2 + 2 + 2 + len(s.masterSecret) + 2 - for _, cert := range s.certificates { - length += 4 + len(cert) - } - - ret := make([]byte, length) - x := ret - x[0] = byte(s.vers >> 8) - x[1] = byte(s.vers) - x[2] = byte(s.cipherSuite >> 8) - x[3] = byte(s.cipherSuite) - x[4] = byte(len(s.masterSecret) >> 8) - x[5] = byte(len(s.masterSecret)) - x = x[6:] - copy(x, s.masterSecret) - x = x[len(s.masterSecret):] - - x[0] = byte(len(s.certificates) >> 8) - x[1] = byte(len(s.certificates)) - x = x[2:] - - for _, cert := range s.certificates { - x[0] = byte(len(cert) >> 24) - x[1] = byte(len(cert) >> 16) - x[2] = byte(len(cert) >> 8) - x[3] = byte(len(cert)) - copy(x[4:], cert) - x = x[4+len(cert):] - } - - return ret -} - -func (s *sessionState) unmarshal(data []byte) bool { - if len(data) < 8 { - return false - } - - s.vers = uint16(data[0])<<8 | uint16(data[1]) - s.cipherSuite = uint16(data[2])<<8 | uint16(data[3]) - masterSecretLen := int(data[4])<<8 | int(data[5]) - data = data[6:] - if len(data) < masterSecretLen { - return false - } - - s.masterSecret = data[:masterSecretLen] - data = data[masterSecretLen:] - - if len(data) < 2 { - return false - } - - numCerts := int(data[0])<<8 | int(data[1]) - data = data[2:] - - s.certificates = make([][]byte, numCerts) - for i := range s.certificates { - if len(data) < 4 { - return false - } - certLen := int(data[0])<<24 | int(data[1])<<16 | int(data[2])<<8 | int(data[3]) - data = data[4:] - if certLen < 0 { - return false - } - if len(data) < certLen { - return false - } - s.certificates[i] = data[:certLen] - data = data[certLen:] - } - - if len(data) > 0 { - return false - } - - return true -} - -func (c *Conn) encryptTicket(state *sessionState) ([]byte, error) { - serialized := state.marshal() - encrypted := make([]byte, ticketKeyNameLen+aes.BlockSize+len(serialized)+sha256.Size) - keyName := encrypted[:ticketKeyNameLen] - iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] - macBytes := encrypted[len(encrypted)-sha256.Size:] - - if _, err := io.ReadFull(c.config.rand(), iv); err != nil { - return nil, err - } - key := c.config.ticketKeys()[0] - copy(keyName, key.keyName[:]) - block, err := aes.NewCipher(key.aesKey[:]) - if err != nil { - return nil, errors.New("tls: failed to create cipher while encrypting ticket: " + err.Error()) - } - cipher.NewCTR(block, iv).XORKeyStream(encrypted[ticketKeyNameLen+aes.BlockSize:], serialized) - - mac := hmac.New(sha256.New, key.hmacKey[:]) - mac.Write(encrypted[:len(encrypted)-sha256.Size]) - mac.Sum(macBytes[:0]) - - return encrypted, nil -} - -func (c *Conn) decryptTicket(encrypted []byte) (*sessionState, bool) { - if c.config.SessionTicketsDisabled || - len(encrypted) < ticketKeyNameLen+aes.BlockSize+sha256.Size { - return nil, false - } - - keyName := encrypted[:ticketKeyNameLen] - iv := encrypted[ticketKeyNameLen : ticketKeyNameLen+aes.BlockSize] - macBytes := encrypted[len(encrypted)-sha256.Size:] - - keys := c.config.ticketKeys() - keyIndex := -1 - for i, candidateKey := range keys { - if bytes.Equal(keyName, candidateKey.keyName[:]) { - keyIndex = i - break - } - } - - if keyIndex == -1 { - return nil, false - } - key := &keys[keyIndex] - - mac := hmac.New(sha256.New, key.hmacKey[:]) - mac.Write(encrypted[:len(encrypted)-sha256.Size]) - expected := mac.Sum(nil) - - if subtle.ConstantTimeCompare(macBytes, expected) != 1 { - return nil, false - } - - block, err := aes.NewCipher(key.aesKey[:]) - if err != nil { - return nil, false - } - ciphertext := encrypted[ticketKeyNameLen+aes.BlockSize : len(encrypted)-sha256.Size] - plaintext := ciphertext - cipher.NewCTR(block, iv).XORKeyStream(plaintext, ciphertext) - - state := &sessionState{usedOldKey: keyIndex > 0} - ok := state.unmarshal(plaintext) - return state, ok -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls.go deleted file mode 100644 index 0b1c3778ad41ec4950b708f6005cfd6dd568b9c5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package tls partially implements TLS 1.2, as specified in RFC 5246. -package tls - -import ( - "crypto" - "crypto/ecdsa" - "crypto/rsa" - "crypto/x509" - "encoding/pem" - "errors" - "io/ioutil" - "net" - "strings" - "time" -) - -// Server returns a new TLS server side connection -// using conn as the underlying transport. -// The configuration config must be non-nil and must have -// at least one certificate. -func Server(conn net.Conn, config *Config) *Conn { - return &Conn{conn: conn, config: config} -} - -// Client returns a new TLS client side connection -// using conn as the underlying transport. -// The config cannot be nil: users must set either ServerName or -// InsecureSkipVerify in the config. -func Client(conn net.Conn, config *Config) *Conn { - return &Conn{conn: conn, config: config, isClient: true} -} - -// A listener implements a network listener (net.Listener) for TLS connections. -type listener struct { - net.Listener - config *Config -} - -// Accept waits for and returns the next incoming TLS connection. -// The returned connection c is a *tls.Conn. -func (l *listener) Accept() (c net.Conn, err error) { - c, err = l.Listener.Accept() - if err != nil { - return - } - c = Server(c, l.config) - return -} - -// NewListener creates a Listener which accepts connections from an inner -// Listener and wraps each connection with Server. -// The configuration config must be non-nil and must have -// at least one certificate. -func NewListener(inner net.Listener, config *Config) net.Listener { - l := new(listener) - l.Listener = inner - l.config = config - return l -} - -// Listen creates a TLS listener accepting connections on the -// given network address using net.Listen. -// The configuration config must be non-nil and must have -// at least one certificate. -func Listen(network, laddr string, config *Config) (net.Listener, error) { - if config == nil || len(config.Certificates) == 0 { - return nil, errors.New("tls.Listen: no certificates in configuration") - } - l, err := net.Listen(network, laddr) - if err != nil { - return nil, err - } - return NewListener(l, config), nil -} - -type timeoutError struct{} - -func (timeoutError) Error() string { return "tls: DialWithDialer timed out" } -func (timeoutError) Timeout() bool { return true } -func (timeoutError) Temporary() bool { return true } - -// DialWithDialer connects to the given network address using dialer.Dial and -// then initiates a TLS handshake, returning the resulting TLS connection. Any -// timeout or deadline given in the dialer apply to connection and TLS -// handshake as a whole. -// -// DialWithDialer interprets a nil configuration as equivalent to the zero -// configuration; see the documentation of Config for the defaults. -func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*Conn, error) { - // We want the Timeout and Deadline values from dialer to cover the - // whole process: TCP connection and TLS handshake. This means that we - // also need to start our own timers now. - timeout := dialer.Timeout - - if !dialer.Deadline.IsZero() { - deadlineTimeout := dialer.Deadline.Sub(time.Now()) - if timeout == 0 || deadlineTimeout < timeout { - timeout = deadlineTimeout - } - } - - var errChannel chan error - - if timeout != 0 { - errChannel = make(chan error, 2) - time.AfterFunc(timeout, func() { - errChannel <- timeoutError{} - }) - } - - rawConn, err := dialer.Dial(network, addr) - if err != nil { - return nil, err - } - - colonPos := strings.LastIndex(addr, ":") - if colonPos == -1 { - colonPos = len(addr) - } - hostname := addr[:colonPos] - - if config == nil { - config = defaultConfig() - } - // If no ServerName is set, infer the ServerName - // from the hostname we're connecting to. - if config.ServerName == "" { - // Make a copy to avoid polluting argument or default. - c := *config - c.ServerName = hostname - config = &c - } - - conn := Client(rawConn, config) - - if timeout == 0 { - err = conn.Handshake() - } else { - go func() { - errChannel <- conn.Handshake() - }() - - err = <-errChannel - } - - if err != nil { - rawConn.Close() - return nil, err - } - - return conn, nil -} - -// Dial connects to the given network address using net.Dial -// and then initiates a TLS handshake, returning the resulting -// TLS connection. -// Dial interprets a nil configuration as equivalent to -// the zero configuration; see the documentation of Config -// for the defaults. -func Dial(network, addr string, config *Config) (*Conn, error) { - return DialWithDialer(new(net.Dialer), network, addr, config) -} - -// LoadX509KeyPair reads and parses a public/private key pair from a pair of -// files. The files must contain PEM encoded data. -func LoadX509KeyPair(certFile, keyFile string) (Certificate, error) { - certPEMBlock, err := ioutil.ReadFile(certFile) - if err != nil { - return Certificate{}, err - } - keyPEMBlock, err := ioutil.ReadFile(keyFile) - if err != nil { - return Certificate{}, err - } - return X509KeyPair(certPEMBlock, keyPEMBlock) -} - -// X509KeyPair parses a public/private key pair from a pair of -// PEM encoded data. -func X509KeyPair(certPEMBlock, keyPEMBlock []byte) (Certificate, error) { - var cert Certificate - var certDERBlock *pem.Block - fail := func(err error) (Certificate, error) { return Certificate{}, err } - for { - certDERBlock, certPEMBlock = pem.Decode(certPEMBlock) - if certDERBlock == nil { - break - } - if certDERBlock.Type == "CERTIFICATE" { - cert.Certificate = append(cert.Certificate, certDERBlock.Bytes) - } - } - - if len(cert.Certificate) == 0 { - return fail(errors.New("crypto/tls: failed to parse certificate PEM data")) - } - - var keyDERBlock *pem.Block - for { - keyDERBlock, keyPEMBlock = pem.Decode(keyPEMBlock) - if keyDERBlock == nil { - return fail(errors.New("crypto/tls: failed to parse key PEM data")) - } - if keyDERBlock.Type == "PRIVATE KEY" || strings.HasSuffix(keyDERBlock.Type, " PRIVATE KEY") { - break - } - } - - var err error - cert.PrivateKey, err = parsePrivateKey(keyDERBlock.Bytes) - if err != nil { - return fail(err) - } - - // We don't need to parse the public key for TLS, but we so do anyway - // to check that it looks sane and matches the private key. - x509Cert, err := x509.ParseCertificate(cert.Certificate[0]) - if err != nil { - return fail(err) - } - - switch pub := x509Cert.PublicKey.(type) { - case *rsa.PublicKey: - priv, ok := cert.PrivateKey.(*rsa.PrivateKey) - if !ok { - return fail(errors.New("crypto/tls: private key type does not match public key type")) - } - if pub.N.Cmp(priv.N) != 0 { - return fail(errors.New("crypto/tls: private key does not match public key")) - } - case *ecdsa.PublicKey: - priv, ok := cert.PrivateKey.(*ecdsa.PrivateKey) - if !ok { - return fail(errors.New("crypto/tls: private key type does not match public key type")) - - } - if pub.X.Cmp(priv.X) != 0 || pub.Y.Cmp(priv.Y) != 0 { - return fail(errors.New("crypto/tls: private key does not match public key")) - } - default: - return fail(errors.New("crypto/tls: unknown public key algorithm")) - } - - return cert, nil -} - -// Attempt to parse the given private key DER block. OpenSSL 0.9.8 generates -// PKCS#1 private keys by default, while OpenSSL 1.0.0 generates PKCS#8 keys. -// OpenSSL ecparam generates SEC1 EC private keys for ECDSA. We try all three. -func parsePrivateKey(der []byte) (crypto.PrivateKey, error) { - if key, err := x509.ParsePKCS1PrivateKey(der); err == nil { - return key, nil - } - if key, err := x509.ParsePKCS8PrivateKey(der); err == nil { - switch key := key.(type) { - case *rsa.PrivateKey, *ecdsa.PrivateKey: - return key, nil - default: - return nil, errors.New("crypto/tls: found unknown private key type in PKCS#8 wrapping") - } - } - if key, err := x509.ParseECPrivateKey(der); err == nil { - return key, nil - } - - return nil, errors.New("crypto/tls: failed to parse private key") -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls_test.go deleted file mode 100644 index c45c10378d76344ed34e1795fbec10391a628ebe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/tls/tls_test.go +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package tls - -import ( - "bytes" - "fmt" - "internal/testenv" - "io" - "net" - "strings" - "testing" - "time" -) - -var rsaCertPEM = `-----BEGIN CERTIFICATE----- -MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTIwOTEyMjE1MjAyWhcNMTUwOTEyMjE1MjAyWjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLJ -hPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wok/4xIA+ui35/MmNa -rtNuC+BdZ1tMuVCPFZcCAwEAAaNQME4wHQYDVR0OBBYEFJvKs8RfJaXTH08W+SGv -zQyKn0H8MB8GA1UdIwQYMBaAFJvKs8RfJaXTH08W+SGvzQyKn0H8MAwGA1UdEwQF -MAMBAf8wDQYJKoZIhvcNAQEFBQADQQBJlffJHybjDGxRMqaRmDhX0+6v02TUKZsW -r5QuVbpQhH6u+0UgcW0jp9QwpxoPTLTWGXEWBBBurxFwiCBhkQ+V ------END CERTIFICATE----- -` - -var rsaKeyPEM = `-----BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo -k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G -6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N -MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW -SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T -xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi -D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END RSA PRIVATE KEY----- -` - -// keyPEM is the same as rsaKeyPEM, but declares itself as just -// "PRIVATE KEY", not "RSA PRIVATE KEY". https://golang.org/issue/4477 -var keyPEM = `-----BEGIN PRIVATE KEY----- -MIIBOwIBAAJBANLJhPHhITqQbPklG3ibCVxwGMRfp/v4XqhfdQHdcVfHap6NQ5Wo -k/4xIA+ui35/MmNartNuC+BdZ1tMuVCPFZcCAwEAAQJAEJ2N+zsR0Xn8/Q6twa4G -6OB1M1WO+k+ztnX/1SvNeWu8D6GImtupLTYgjZcHufykj09jiHmjHx8u8ZZB/o1N -MQIhAPW+eyZo7ay3lMz1V01WVjNKK9QSn1MJlb06h/LuYv9FAiEA25WPedKgVyCW -SmUwbPw8fnTcpqDWE3yTO3vKcebqMSsCIBF3UmVue8YU3jybC3NxuXq3wNm34R8T -xVLHwDXh/6NJAiEAl2oHGGLz64BuAfjKrqwz7qMYr9HCLIe/YsoWq/olzScCIQDi -D2lWusoe2/nEqfDVVWGWlyJ7yOmqaVm/iNUN9B2N2g== ------END PRIVATE KEY----- -` - -var ecdsaCertPEM = `-----BEGIN CERTIFICATE----- -MIIB/jCCAWICCQDscdUxw16XFDAJBgcqhkjOPQQBMEUxCzAJBgNVBAYTAkFVMRMw -EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 -eSBMdGQwHhcNMTIxMTE0MTI0MDQ4WhcNMTUxMTE0MTI0MDQ4WjBFMQswCQYDVQQG -EwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lk -Z2l0cyBQdHkgTHRkMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQBY9+my9OoeSUR -lDQdV/x8LsOuLilthhiS1Tz4aGDHIPwC1mlvnf7fg5lecYpMCrLLhauAc1UJXcgl -01xoLuzgtAEAgv2P/jgytzRSpUYvgLBt1UA0leLYBy6mQQbrNEuqT3INapKIcUv8 -XxYP0xMEUksLPq6Ca+CRSqTtrd/23uTnapkwCQYHKoZIzj0EAQOBigAwgYYCQXJo -A7Sl2nLVf+4Iu/tAX/IF4MavARKC4PPHK3zfuGfPR3oCCcsAoz3kAzOeijvd0iXb -H5jBImIxPL4WxQNiBTexAkF8D1EtpYuWdlVQ80/h/f4pBcGiXPqX5h2PQSQY7hP1 -+jwM1FGS4fREIOvlBYr/SzzQRtwrvrzGYxDEDbsC0ZGRnA== ------END CERTIFICATE----- -` - -var ecdsaKeyPEM = `-----BEGIN EC PARAMETERS----- -BgUrgQQAIw== ------END EC PARAMETERS----- ------BEGIN EC PRIVATE KEY----- -MIHcAgEBBEIBrsoKp0oqcv6/JovJJDoDVSGWdirrkgCWxrprGlzB9o0X8fV675X0 -NwuBenXFfeZvVcwluO7/Q9wkYoPd/t3jGImgBwYFK4EEACOhgYkDgYYABAFj36bL -06h5JRGUNB1X/Hwuw64uKW2GGJLVPPhoYMcg/ALWaW+d/t+DmV5xikwKssuFq4Bz -VQldyCXTXGgu7OC0AQCC/Y/+ODK3NFKlRi+AsG3VQDSV4tgHLqZBBus0S6pPcg1q -kohxS/xfFg/TEwRSSws+roJr4JFKpO2t3/be5OdqmQ== ------END EC PRIVATE KEY----- -` - -var keyPairTests = []struct { - algo string - cert string - key string -}{ - {"ECDSA", ecdsaCertPEM, ecdsaKeyPEM}, - {"RSA", rsaCertPEM, rsaKeyPEM}, - {"RSA-untyped", rsaCertPEM, keyPEM}, // golang.org/issue/4477 -} - -func TestX509KeyPair(t *testing.T) { - var pem []byte - for _, test := range keyPairTests { - pem = []byte(test.cert + test.key) - if _, err := X509KeyPair(pem, pem); err != nil { - t.Errorf("Failed to load %s cert followed by %s key: %s", test.algo, test.algo, err) - } - pem = []byte(test.key + test.cert) - if _, err := X509KeyPair(pem, pem); err != nil { - t.Errorf("Failed to load %s key followed by %s cert: %s", test.algo, test.algo, err) - } - } -} - -func TestX509MixedKeyPair(t *testing.T) { - if _, err := X509KeyPair([]byte(rsaCertPEM), []byte(ecdsaKeyPEM)); err == nil { - t.Error("Load of RSA certificate succeeded with ECDSA private key") - } - if _, err := X509KeyPair([]byte(ecdsaCertPEM), []byte(rsaKeyPEM)); err == nil { - t.Error("Load of ECDSA certificate succeeded with RSA private key") - } -} - -func newLocalListener(t *testing.T) net.Listener { - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - ln, err = net.Listen("tcp6", "[::1]:0") - } - if err != nil { - t.Fatal(err) - } - return ln -} - -func TestDialTimeout(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - listener := newLocalListener(t) - - addr := listener.Addr().String() - defer listener.Close() - - complete := make(chan bool) - defer close(complete) - - go func() { - conn, err := listener.Accept() - if err != nil { - t.Error(err) - return - } - <-complete - conn.Close() - }() - - dialer := &net.Dialer{ - Timeout: 10 * time.Millisecond, - } - - var err error - if _, err = DialWithDialer(dialer, "tcp", addr, nil); err == nil { - t.Fatal("DialWithTimeout completed successfully") - } - - if !strings.Contains(err.Error(), "timed out") { - t.Errorf("resulting error not a timeout: %s", err) - } -} - -// tests that Conn.Read returns (non-zero, io.EOF) instead of -// (non-zero, nil) when a Close (alertCloseNotify) is sitting right -// behind the application data in the buffer. -func TestConnReadNonzeroAndEOF(t *testing.T) { - // This test is racy: it assumes that after a write to a - // localhost TCP connection, the peer TCP connection can - // immediately read it. Because it's racy, we skip this test - // in short mode, and then retry it several times with an - // increasing sleep in between our final write (via srv.Close - // below) and the following read. - if testing.Short() { - t.Skip("skipping in short mode") - } - var err error - for delay := time.Millisecond; delay <= 64*time.Millisecond; delay *= 2 { - if err = testConnReadNonzeroAndEOF(t, delay); err == nil { - return - } - } - t.Error(err) -} - -func testConnReadNonzeroAndEOF(t *testing.T, delay time.Duration) error { - ln := newLocalListener(t) - defer ln.Close() - - srvCh := make(chan *Conn, 1) - var serr error - go func() { - sconn, err := ln.Accept() - if err != nil { - serr = err - srvCh <- nil - return - } - serverConfig := *testConfig - srv := Server(sconn, &serverConfig) - if err := srv.Handshake(); err != nil { - serr = fmt.Errorf("handshake: %v", err) - srvCh <- nil - return - } - srvCh <- srv - }() - - clientConfig := *testConfig - conn, err := Dial("tcp", ln.Addr().String(), &clientConfig) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - - srv := <-srvCh - if srv == nil { - return serr - } - - buf := make([]byte, 6) - - srv.Write([]byte("foobar")) - n, err := conn.Read(buf) - if n != 6 || err != nil || string(buf) != "foobar" { - return fmt.Errorf("Read = %d, %v, data %q; want 6, nil, foobar", n, err, buf) - } - - srv.Write([]byte("abcdef")) - srv.Close() - time.Sleep(delay) - n, err = conn.Read(buf) - if n != 6 || string(buf) != "abcdef" { - return fmt.Errorf("Read = %d, buf= %q; want 6, abcdef", n, buf) - } - if err != io.EOF { - return fmt.Errorf("Second Read error = %v; want io.EOF", err) - } - return nil -} - -func TestTLSUniqueMatches(t *testing.T) { - ln := newLocalListener(t) - defer ln.Close() - - serverTLSUniques := make(chan []byte) - go func() { - for i := 0; i < 2; i++ { - sconn, err := ln.Accept() - if err != nil { - t.Fatal(err) - } - serverConfig := *testConfig - srv := Server(sconn, &serverConfig) - if err := srv.Handshake(); err != nil { - t.Fatal(err) - } - serverTLSUniques <- srv.ConnectionState().TLSUnique - } - }() - - clientConfig := *testConfig - clientConfig.ClientSessionCache = NewLRUClientSessionCache(1) - conn, err := Dial("tcp", ln.Addr().String(), &clientConfig) - if err != nil { - t.Fatal(err) - } - if !bytes.Equal(conn.ConnectionState().TLSUnique, <-serverTLSUniques) { - t.Error("client and server channel bindings differ") - } - conn.Close() - - conn, err = Dial("tcp", ln.Addr().String(), &clientConfig) - if err != nil { - t.Fatal(err) - } - defer conn.Close() - if !conn.ConnectionState().DidResume { - t.Error("second session did not use resumption") - } - if !bytes.Equal(conn.ConnectionState().TLSUnique, <-serverTLSUniques) { - t.Error("client and server channel bindings differ when session resumption is used") - } -} - -func TestVerifyHostname(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - c, err := Dial("tcp", "www.google.com:https", nil) - if err != nil { - t.Fatal(err) - } - if err := c.VerifyHostname("www.google.com"); err != nil { - t.Fatalf("verify www.google.com: %v", err) - } - if err := c.VerifyHostname("www.yahoo.com"); err == nil { - t.Fatalf("verify www.yahoo.com succeeded") - } - - c, err = Dial("tcp", "www.google.com:https", &Config{InsecureSkipVerify: true}) - if err != nil { - t.Fatal(err) - } - if err := c.VerifyHostname("www.google.com"); err == nil { - t.Fatalf("verify www.google.com succeeded with InsecureSkipVerify=true") - } - if err := c.VerifyHostname("www.yahoo.com"); err == nil { - t.Fatalf("verify www.google.com succeeded with InsecureSkipVerify=true") - } -} - -func TestVerifyHostnameResumed(t *testing.T) { - testenv.MustHaveExternalNetwork(t) - - config := &Config{ - ClientSessionCache: NewLRUClientSessionCache(32), - } - for i := 0; i < 2; i++ { - c, err := Dial("tcp", "www.google.com:https", config) - if err != nil { - t.Fatalf("Dial #%d: %v", i, err) - } - cs := c.ConnectionState() - if i > 0 && !cs.DidResume { - t.Fatalf("Subsequent connection unexpectedly didn't resume") - } - if cs.VerifiedChains == nil { - t.Fatalf("Dial #%d: cs.VerifiedChains == nil", i) - } - if err := c.VerifyHostname("www.google.com"); err != nil { - t.Fatalf("verify www.google.com #%d: %v", i, err) - } - c.Close() - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/cert_pool.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/cert_pool.go deleted file mode 100644 index 2362e84688d140179f5e77a0ef111056a13dc328..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/cert_pool.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "encoding/pem" -) - -// CertPool is a set of certificates. -type CertPool struct { - bySubjectKeyId map[string][]int - byName map[string][]int - certs []*Certificate -} - -// NewCertPool returns a new, empty CertPool. -func NewCertPool() *CertPool { - return &CertPool{ - make(map[string][]int), - make(map[string][]int), - nil, - } -} - -// findVerifiedParents attempts to find certificates in s which have signed the -// given certificate. If any candidates were rejected then errCert will be set -// to one of them, arbitrarily, and err will contain the reason that it was -// rejected. -func (s *CertPool) findVerifiedParents(cert *Certificate) (parents []int, errCert *Certificate, err error) { - if s == nil { - return - } - var candidates []int - - if len(cert.AuthorityKeyId) > 0 { - candidates = s.bySubjectKeyId[string(cert.AuthorityKeyId)] - } - if len(candidates) == 0 { - candidates = s.byName[string(cert.RawIssuer)] - } - - for _, c := range candidates { - if err = cert.CheckSignatureFrom(s.certs[c]); err == nil { - parents = append(parents, c) - } else { - errCert = s.certs[c] - } - } - - return -} - -// AddCert adds a certificate to a pool. -func (s *CertPool) AddCert(cert *Certificate) { - if cert == nil { - panic("adding nil Certificate to CertPool") - } - - // Check that the certificate isn't being added twice. - for _, c := range s.certs { - if c.Equal(cert) { - return - } - } - - n := len(s.certs) - s.certs = append(s.certs, cert) - - if len(cert.SubjectKeyId) > 0 { - keyId := string(cert.SubjectKeyId) - s.bySubjectKeyId[keyId] = append(s.bySubjectKeyId[keyId], n) - } - name := string(cert.RawSubject) - s.byName[name] = append(s.byName[name], n) -} - -// AppendCertsFromPEM attempts to parse a series of PEM encoded certificates. -// It appends any certificates found to s and reports whether any certificates -// were successfully parsed. -// -// On many Linux systems, /etc/ssl/cert.pem will contain the system wide set -// of root CAs in a format suitable for this function. -func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool) { - for len(pemCerts) > 0 { - var block *pem.Block - block, pemCerts = pem.Decode(pemCerts) - if block == nil { - break - } - if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { - continue - } - - cert, err := ParseCertificate(block.Bytes) - if err != nil { - continue - } - - s.AddCert(cert) - ok = true - } - - return -} - -// Subjects returns a list of the DER-encoded subjects of -// all of the certificates in the pool. -func (s *CertPool) Subjects() (res [][]byte) { - res = make([][]byte, len(s.certs)) - for i, c := range s.certs { - res[i] = c.RawSubject - } - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt.go deleted file mode 100644 index 49ceadb4366fc6666b406d8bbd64deb7ccfce4e5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -// RFC 1423 describes the encryption of PEM blocks. The algorithm used to -// generate a key from the password was derived by looking at the OpenSSL -// implementation. - -import ( - "crypto/aes" - "crypto/cipher" - "crypto/des" - "crypto/md5" - "encoding/hex" - "encoding/pem" - "errors" - "io" - "strings" -) - -type PEMCipher int - -// Possible values for the EncryptPEMBlock encryption algorithm. -const ( - _ PEMCipher = iota - PEMCipherDES - PEMCipher3DES - PEMCipherAES128 - PEMCipherAES192 - PEMCipherAES256 -) - -// rfc1423Algo holds a method for enciphering a PEM block. -type rfc1423Algo struct { - cipher PEMCipher - name string - cipherFunc func(key []byte) (cipher.Block, error) - keySize int - blockSize int -} - -// rfc1423Algos holds a slice of the possible ways to encrypt a PEM -// block. The ivSize numbers were taken from the OpenSSL source. -var rfc1423Algos = []rfc1423Algo{{ - cipher: PEMCipherDES, - name: "DES-CBC", - cipherFunc: des.NewCipher, - keySize: 8, - blockSize: des.BlockSize, -}, { - cipher: PEMCipher3DES, - name: "DES-EDE3-CBC", - cipherFunc: des.NewTripleDESCipher, - keySize: 24, - blockSize: des.BlockSize, -}, { - cipher: PEMCipherAES128, - name: "AES-128-CBC", - cipherFunc: aes.NewCipher, - keySize: 16, - blockSize: aes.BlockSize, -}, { - cipher: PEMCipherAES192, - name: "AES-192-CBC", - cipherFunc: aes.NewCipher, - keySize: 24, - blockSize: aes.BlockSize, -}, { - cipher: PEMCipherAES256, - name: "AES-256-CBC", - cipherFunc: aes.NewCipher, - keySize: 32, - blockSize: aes.BlockSize, -}, -} - -// deriveKey uses a key derivation function to stretch the password into a key -// with the number of bits our cipher requires. This algorithm was derived from -// the OpenSSL source. -func (c rfc1423Algo) deriveKey(password, salt []byte) []byte { - hash := md5.New() - out := make([]byte, c.keySize) - var digest []byte - - for i := 0; i < len(out); i += len(digest) { - hash.Reset() - hash.Write(digest) - hash.Write(password) - hash.Write(salt) - digest = hash.Sum(digest[:0]) - copy(out[i:], digest) - } - return out -} - -// IsEncryptedPEMBlock returns if the PEM block is password encrypted. -func IsEncryptedPEMBlock(b *pem.Block) bool { - _, ok := b.Headers["DEK-Info"] - return ok -} - -// IncorrectPasswordError is returned when an incorrect password is detected. -var IncorrectPasswordError = errors.New("x509: decryption password incorrect") - -// DecryptPEMBlock takes a password encrypted PEM block and the password used to -// encrypt it and returns a slice of decrypted DER encoded bytes. It inspects -// the DEK-Info header to determine the algorithm used for decryption. If no -// DEK-Info header is present, an error is returned. If an incorrect password -// is detected an IncorrectPasswordError is returned. Because of deficiencies -// in the encrypted-PEM format, it's not always possible to detect an incorrect -// password. In these cases no error will be returned but the decrypted DER -// bytes will be random noise. -func DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error) { - dek, ok := b.Headers["DEK-Info"] - if !ok { - return nil, errors.New("x509: no DEK-Info header in block") - } - - idx := strings.Index(dek, ",") - if idx == -1 { - return nil, errors.New("x509: malformed DEK-Info header") - } - - mode, hexIV := dek[:idx], dek[idx+1:] - ciph := cipherByName(mode) - if ciph == nil { - return nil, errors.New("x509: unknown encryption mode") - } - iv, err := hex.DecodeString(hexIV) - if err != nil { - return nil, err - } - if len(iv) != ciph.blockSize { - return nil, errors.New("x509: incorrect IV size") - } - - // Based on the OpenSSL implementation. The salt is the first 8 bytes - // of the initialization vector. - key := ciph.deriveKey(password, iv[:8]) - block, err := ciph.cipherFunc(key) - if err != nil { - return nil, err - } - - if len(b.Bytes)%block.BlockSize() != 0 { - return nil, errors.New("x509: encrypted PEM data is not a multiple of the block size") - } - - data := make([]byte, len(b.Bytes)) - dec := cipher.NewCBCDecrypter(block, iv) - dec.CryptBlocks(data, b.Bytes) - - // Blocks are padded using a scheme where the last n bytes of padding are all - // equal to n. It can pad from 1 to blocksize bytes inclusive. See RFC 1423. - // For example: - // [x y z 2 2] - // [x y 7 7 7 7 7 7 7] - // If we detect a bad padding, we assume it is an invalid password. - dlen := len(data) - if dlen == 0 || dlen%ciph.blockSize != 0 { - return nil, errors.New("x509: invalid padding") - } - last := int(data[dlen-1]) - if dlen < last { - return nil, IncorrectPasswordError - } - if last == 0 || last > ciph.blockSize { - return nil, IncorrectPasswordError - } - for _, val := range data[dlen-last:] { - if int(val) != last { - return nil, IncorrectPasswordError - } - } - return data[:dlen-last], nil -} - -// EncryptPEMBlock returns a PEM block of the specified type holding the -// given DER-encoded data encrypted with the specified algorithm and -// password. -func EncryptPEMBlock(rand io.Reader, blockType string, data, password []byte, alg PEMCipher) (*pem.Block, error) { - ciph := cipherByKey(alg) - if ciph == nil { - return nil, errors.New("x509: unknown encryption mode") - } - iv := make([]byte, ciph.blockSize) - if _, err := io.ReadFull(rand, iv); err != nil { - return nil, errors.New("x509: cannot generate IV: " + err.Error()) - } - // The salt is the first 8 bytes of the initialization vector, - // matching the key derivation in DecryptPEMBlock. - key := ciph.deriveKey(password, iv[:8]) - block, err := ciph.cipherFunc(key) - if err != nil { - return nil, err - } - enc := cipher.NewCBCEncrypter(block, iv) - pad := ciph.blockSize - len(data)%ciph.blockSize - encrypted := make([]byte, len(data), len(data)+pad) - // We could save this copy by encrypting all the whole blocks in - // the data separately, but it doesn't seem worth the additional - // code. - copy(encrypted, data) - // See RFC 1423, section 1.1 - for i := 0; i < pad; i++ { - encrypted = append(encrypted, byte(pad)) - } - enc.CryptBlocks(encrypted, encrypted) - - return &pem.Block{ - Type: blockType, - Headers: map[string]string{ - "Proc-Type": "4,ENCRYPTED", - "DEK-Info": ciph.name + "," + hex.EncodeToString(iv), - }, - Bytes: encrypted, - }, nil -} - -func cipherByName(name string) *rfc1423Algo { - for i := range rfc1423Algos { - alg := &rfc1423Algos[i] - if alg.name == name { - return alg - } - } - return nil -} - -func cipherByKey(key PEMCipher) *rfc1423Algo { - for i := range rfc1423Algos { - alg := &rfc1423Algos[i] - if alg.cipher == key { - return alg - } - } - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt_test.go deleted file mode 100644 index 685d5ee15697cb00d4efdb7b60a2d39cdda754a2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pem_decrypt_test.go +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "bytes" - "crypto/rand" - "encoding/base64" - "encoding/pem" - "strings" - "testing" -) - -func TestDecrypt(t *testing.T) { - for i, data := range testData { - t.Logf("test %v. %v", i, data.kind) - block, rest := pem.Decode(data.pemData) - if len(rest) > 0 { - t.Error("extra data") - } - der, err := DecryptPEMBlock(block, data.password) - if err != nil { - t.Error("decrypt failed: ", err) - continue - } - if _, err := ParsePKCS1PrivateKey(der); err != nil { - t.Error("invalid private key: ", err) - } - plainDER, err := base64.StdEncoding.DecodeString(data.plainDER) - if err != nil { - t.Fatal("cannot decode test DER data: ", err) - } - if !bytes.Equal(der, plainDER) { - t.Error("data mismatch") - } - } -} - -func TestEncrypt(t *testing.T) { - for i, data := range testData { - t.Logf("test %v. %v", i, data.kind) - plainDER, err := base64.StdEncoding.DecodeString(data.plainDER) - if err != nil { - t.Fatal("cannot decode test DER data: ", err) - } - password := []byte("kremvax1") - block, err := EncryptPEMBlock(rand.Reader, "RSA PRIVATE KEY", plainDER, password, data.kind) - if err != nil { - t.Error("encrypt: ", err) - continue - } - if !IsEncryptedPEMBlock(block) { - t.Error("PEM block does not appear to be encrypted") - } - if block.Type != "RSA PRIVATE KEY" { - t.Errorf("unexpected block type; got %q want %q", block.Type, "RSA PRIVATE KEY") - } - if block.Headers["Proc-Type"] != "4,ENCRYPTED" { - t.Errorf("block does not have correct Proc-Type header") - } - der, err := DecryptPEMBlock(block, password) - if err != nil { - t.Error("decrypt: ", err) - continue - } - if !bytes.Equal(der, plainDER) { - t.Errorf("data mismatch") - } - } -} - -var testData = []struct { - kind PEMCipher - password []byte - pemData []byte - plainDER string -}{ - { - kind: PEMCipherDES, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-CBC,34F09A4FC8DE22B5 - -WXxy8kbZdiZvANtKvhmPBLV7eVFj2A5z6oAxvI9KGyhG0ZK0skfnt00C24vfU7m5 -ICXeoqP67lzJ18xCzQfHjDaBNs53DSDT+Iz4e8QUep1xQ30+8QKX2NA2coee3nwc -6oM1cuvhNUDemBH2i3dKgMVkfaga0zQiiOq6HJyGSncCMSruQ7F9iWEfRbFcxFCx -qtHb1kirfGKEtgWTF+ynyco6+2gMXNu70L7nJcnxnV/RLFkHt7AUU1yrclxz7eZz -XOH9VfTjb52q/I8Suozq9coVQwg4tXfIoYUdT//O+mB7zJb9HI9Ps77b9TxDE6Gm -4C9brwZ3zg2vqXcwwV6QRZMtyll9rOpxkbw6NPlpfBqkc3xS51bbxivbO/Nve4KD -r12ymjFNF4stXCfJnNqKoZ50BHmEEUDu5Wb0fpVn82XrGw7CYc4iug== ------END RSA PRIVATE KEY-----`), - plainDER: ` -MIIBPAIBAAJBAPASZe+tCPU6p80AjHhDkVsLYa51D35e/YGa8QcZyooeZM8EHozo -KD0fNiKI+53bHdy07N+81VQ8/ejPcRoXPlsCAwEAAQJBAMTxIuSq27VpR+zZ7WJf -c6fvv1OBvpMZ0/d1pxL/KnOAgq2rD5hDtk9b0LGhTPgQAmrrMTKuSeGoIuYE+gKQ -QvkCIQD+GC1m+/do+QRurr0uo46Kx1LzLeSCrjBk34wiOp2+dwIhAPHfTLRXS2fv -7rljm0bYa4+eDZpz+E8RcXEgzhhvcQQ9AiAI5eHZJGOyml3MXnQjiPi55WcDOw0w -glcRgT6QCEtz2wIhANSyqaFtosIkHKqrDUGfz/bb5tqMYTAnBruVPaf/WEOBAiEA -9xORWeRG1tRpso4+dYy4KdDkuLPIO01KY6neYGm3BCM=`, - }, - { - kind: PEMCipher3DES, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C1F4A6A03682C2C7 - -0JqVdBEH6iqM7drTkj+e2W/bE3LqakaiWhb9WUVonFkhyu8ca/QzebY3b5gCvAZQ -YwBvDcT/GHospKqPx+cxDHJNsUASDZws6bz8ZXWJGwZGExKzr0+Qx5fgXn44Ms3x -8g1ENFuTXtxo+KoNK0zuAMAqp66Llcds3Fjl4XR18QaD0CrVNAfOdgATWZm5GJxk -Fgx5f84nT+/ovvreG+xeOzWgvtKo0UUZVrhGOgfKLpa57adumcJ6SkUuBtEFpZFB -ldw5w7WC7d13x2LsRkwo8ZrDKgIV+Y9GNvhuCCkTzNP0V3gNeJpd201HZHR+9n3w -3z0VjR/MGqsfcy1ziEWMNOO53At3zlG6zP05aHMnMcZoVXadEK6L1gz++inSSDCq -gI0UJP4e3JVB7AkgYymYAwiYALAkoEIuanxoc50njJk= ------END RSA PRIVATE KEY-----`), - plainDER: ` -MIIBOwIBAAJBANOCXKdoNS/iP/MAbl9cf1/SF3P+Ns7ZeNL27CfmDh0O6Zduaax5 -NBiumd2PmjkaCu7lQ5JOibHfWn+xJsc3kw0CAwEAAQJANX/W8d1Q/sCqzkuAn4xl -B5a7qfJWaLHndu1QRLNTRJPn0Ee7OKJ4H0QKOhQM6vpjRrz+P2u9thn6wUxoPsef -QQIhAP/jCkfejFcy4v15beqKzwz08/tslVjF+Yq41eJGejmxAiEA05pMoqfkyjcx -fyvGhpoOyoCp71vSGUfR2I9CR65oKh0CIC1Msjs66LlfJtQctRq6bCEtFCxEcsP+ -eEjYo/Sk6WphAiEAxpgWPMJeU/shFT28gS+tmhjPZLpEoT1qkVlC14u0b3ECIQDX -tZZZxCtPAm7shftEib0VU77Lk8MsXJcx2C4voRsjEw==`, - }, - { - kind: PEMCipherAES128, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,D4492E793FC835CC038A728ED174F78A - -EyfQSzXSjv6BaNH+NHdXRlkHdimpF9izWlugVJAPApgXrq5YldPe2aGIOFXyJ+QE -ZIG20DYqaPzJRjTEbPNZ6Es0S2JJ5yCpKxwJuDkgJZKtF39Q2i36JeGbSZQIuWJE -GZbBpf1jDH/pr0iGonuAdl2PCCZUiy+8eLsD2tyviHUkFLOB+ykYoJ5t8ngZ/B6D -33U43LLb7+9zD4y3Q9OVHqBFGyHcxCY9+9Qh4ZnFp7DTf6RY5TNEvE3s4g6aDpBs -3NbvRVvYTgs8K9EPk4K+5R+P2kD8J8KvEIGxVa1vz8QoCJ/jr7Ka2rvNgPCex5/E -080LzLHPCrXKdlr/f50yhNWq08ZxMWQFkui+FDHPDUaEELKAXV8/5PDxw80Rtybo -AVYoCVIbZXZCuCO81op8UcOgEpTtyU5Lgh3Mw5scQL0= ------END RSA PRIVATE KEY-----`), - plainDER: ` -MIIBOgIBAAJBAMBlj5FxYtqbcy8wY89d/S7n0+r5MzD9F63BA/Lpl78vQKtdJ5dT -cDGh/rBt1ufRrNp0WihcmZi7Mpl/3jHjiWECAwEAAQJABNOHYnKhtDIqFYj1OAJ3 -k3GlU0OlERmIOoeY/cL2V4lgwllPBEs7r134AY4wMmZSBUj8UR/O4SNO668ElKPE -cQIhAOuqY7/115x5KCdGDMWi+jNaMxIvI4ETGwV40ykGzqlzAiEA0P9oEC3m9tHB -kbpjSTxaNkrXxDgdEOZz8X0uOUUwHNsCIAwzcSCiGLyYJTULUmP1ESERfW1mlV78 -XzzESaJpIM/zAiBQkSTcl9VhcJreQqvjn5BnPZLP4ZHS4gPwJAGdsj5J4QIhAOVR -B3WlRNTXR2WsJ5JdByezg9xzdXzULqmga0OE339a`, - }, - { - kind: PEMCipherAES192, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-192-CBC,E2C9FB02BCA23ADE1829F8D8BC5F5369 - -cqVslvHqDDM6qwU6YjezCRifXmKsrgEev7ng6Qs7UmDJOpHDgJQZI9fwMFUhIyn5 -FbCu1SHkLMW52Ld3CuEqMnzWMlhPrW8tFvUOrMWPYSisv7nNq88HobZEJcUNL2MM -Y15XmHW6IJwPqhKyLHpWXyOCVEh4ODND2nV15PCoi18oTa475baxSk7+1qH7GuIs -Rb7tshNTMqHbCpyo9Rn3UxeFIf9efdl8YLiMoIqc7J8E5e9VlbeQSdLMQOgDAQJG -ReUtTw8exmKsY4gsSjhkg5uiw7/ZB1Ihto0qnfQJgjGc680qGkT1d6JfvOfeYAk6 -xn5RqS/h8rYAYm64KnepfC9vIujo4NqpaREDmaLdX5MJPQ+SlytITQvgUsUq3q/t -Ss85xjQEZH3hzwjQqdJvmA4hYP6SUjxYpBM+02xZ1Xw= ------END RSA PRIVATE KEY-----`), - plainDER: ` -MIIBOwIBAAJBAMGcRrZiNNmtF20zyS6MQ7pdGx17aFDl+lTl+qnLuJRUCMUG05xs -OmxmL/O1Qlf+bnqR8Bgg65SfKg21SYuLhiMCAwEAAQJBAL94uuHyO4wux2VC+qpj -IzPykjdU7XRcDHbbvksf4xokSeUFjjD3PB0Qa83M94y89ZfdILIqS9x5EgSB4/lX -qNkCIQD6cCIqLfzq/lYbZbQgAAjpBXeQVYsbvVtJrPrXJAlVVQIhAMXpDKMeFPMn -J0g2rbx1gngx0qOa5r5iMU5w/noN4W2XAiBjf+WzCG5yFvazD+dOx3TC0A8+4x3P -uZ3pWbaXf5PNuQIgAcdXarvhelH2w2piY1g3BPeFqhzBSCK/yLGxR82KIh8CIQDD -+qGKsd09NhQ/G27y/DARzOYtml1NvdmCQAgsDIIOLA==`, - }, - { - kind: PEMCipherAES256, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-256-CBC,8E7ED5CD731902CE938957A886A5FFBD - -4Mxr+KIzRVwoOP0wwq6caSkvW0iS+GE2h2Ov/u+n9ZTMwL83PRnmjfjzBgfRZLVf -JFPXxUK26kMNpIdssNnqGOds+DhB+oSrsNKoxgxSl5OBoYv9eJTVYm7qOyAFIsjr -DRKAcjYCmzfesr7PVTowwy0RtHmYwyXMGDlAzzZrEvaiySFFmMyKKvtoavwaFoc7 -Pz3RZScwIuubzTGJ1x8EzdffYOsdCa9Mtgpp3L136+23dOd6L/qK2EG2fzrJSHs/ -2XugkleBFSMKzEp9mxXKRfa++uidQvMZTFLDK9w5YjrRvMBo/l2BoZIsq0jAIE1N -sv5Z/KwlX+3MDEpPQpUwGPlGGdLnjI3UZ+cjgqBcoMiNc6HfgbBgYJSU6aDSHuCk -clCwByxWkBNgJ2GrkwNrF26v+bGJJJNR4SKouY1jQf0= ------END RSA PRIVATE KEY-----`), - plainDER: ` -MIIBOgIBAAJBAKy3GFkstoCHIEeUU/qO8207m8WSrjksR+p9B4tf1w5k+2O1V/GY -AQ5WFCApItcOkQe/I0yZZJk/PmCqMzSxrc8CAwEAAQJAOCAz0F7AW9oNelVQSP8F -Sfzx7O1yom+qWyAQQJF/gFR11gpf9xpVnnyu1WxIRnDUh1LZwUsjwlDYb7MB74id -oQIhANPcOiLwOPT4sIUpRM5HG6BF1BI7L77VpyGVk8xNP7X/AiEA0LMHZtk4I+lJ -nClgYp4Yh2JZ1Znbu7IoQMCEJCjwKDECIGd8Dzm5tViTkUW6Hs3Tlf73nNs65duF -aRnSglss8I3pAiEAonEnKruawgD8RavDFR+fUgmQiPz4FnGGeVgfwpGG1JECIBYq -PXHYtPqxQIbD2pScR5qum7iGUh11lEUPkmt+2uqS`, - }, - { - // generated with: - // openssl genrsa -aes128 -passout pass:asdf -out server.orig.key 128 - kind: PEMCipherAES128, - password: []byte("asdf"), - pemData: []byte(` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 - -6ei/MlytjE0FFgZOGQ+jrwomKfpl8kdefeE0NSt/DMRrw8OacHAzBNi3pPEa0eX3 -eND9l7C9meCirWovjj9QWVHrXyugFuDIqgdhQ8iHTgCfF3lrmcttVrbIfMDw+smD -hTP8O1mS/MHl92NE0nhv0w== ------END RSA PRIVATE KEY-----`), - plainDER: ` -MGMCAQACEQC6ssxmYuauuHGOCDAI54RdAgMBAAECEQCWIn6Yv2O+kBcDF7STctKB -AgkA8SEfu/2i3g0CCQDGNlXbBHX7kQIIK3Ww5o0cYbECCQDCimPb0dYGsQIIeQ7A -jryIst8=`, - }, -} - -const incompleteBlockPEM = ` ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,74611ABC2571AF11B1BF9B69E62C89E7 - -6L8yXK2MTQUWBk4ZD6OvCiYp+mXyR1594TQ1K38MxGvDw5pwcDME2Lek8RrR5fd40P2XsL2Z4KKt -ai+OP1BZUetfK6AW4MiqB2FDyIdOAJ8XeWuZy21Wtsh8wPD6yYOFM/w7WZL8weX3Y0TSeG/T ------END RSA PRIVATE KEY-----` - -func TestIncompleteBlock(t *testing.T) { - // incompleteBlockPEM contains ciphertext that is not a multiple of the - // block size. This previously panicked. See #11215. - block, _ := pem.Decode([]byte(incompleteBlockPEM)) - _, err := DecryptPEMBlock(block, []byte("foo")) - if err == nil { - t.Fatal("Bad PEM data decrypted successfully") - } - const expectedSubstr = "block size" - if e := err.Error(); !strings.Contains(e, expectedSubstr) { - t.Fatalf("Expected error containing %q but got: %q", expectedSubstr, e) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs1.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs1.go deleted file mode 100644 index acebe3513981aaad060a1d8816c8f2ad93262f03..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs1.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "crypto/rsa" - "encoding/asn1" - "errors" - "math/big" -) - -// pkcs1PrivateKey is a structure which mirrors the PKCS#1 ASN.1 for an RSA private key. -type pkcs1PrivateKey struct { - Version int - N *big.Int - E int - D *big.Int - P *big.Int - Q *big.Int - // We ignore these values, if present, because rsa will calculate them. - Dp *big.Int `asn1:"optional"` - Dq *big.Int `asn1:"optional"` - Qinv *big.Int `asn1:"optional"` - - AdditionalPrimes []pkcs1AdditionalRSAPrime `asn1:"optional,omitempty"` -} - -type pkcs1AdditionalRSAPrime struct { - Prime *big.Int - - // We ignore these values because rsa will calculate them. - Exp *big.Int - Coeff *big.Int -} - -// ParsePKCS1PrivateKey returns an RSA private key from its ASN.1 PKCS#1 DER encoded form. -func ParsePKCS1PrivateKey(der []byte) (key *rsa.PrivateKey, err error) { - var priv pkcs1PrivateKey - rest, err := asn1.Unmarshal(der, &priv) - if len(rest) > 0 { - err = asn1.SyntaxError{Msg: "trailing data"} - return - } - if err != nil { - return - } - - if priv.Version > 1 { - return nil, errors.New("x509: unsupported private key version") - } - - if priv.N.Sign() <= 0 || priv.D.Sign() <= 0 || priv.P.Sign() <= 0 || priv.Q.Sign() <= 0 { - return nil, errors.New("x509: private key contains zero or negative value") - } - - key = new(rsa.PrivateKey) - key.PublicKey = rsa.PublicKey{ - E: priv.E, - N: priv.N, - } - - key.D = priv.D - key.Primes = make([]*big.Int, 2+len(priv.AdditionalPrimes)) - key.Primes[0] = priv.P - key.Primes[1] = priv.Q - for i, a := range priv.AdditionalPrimes { - if a.Prime.Sign() <= 0 { - return nil, errors.New("x509: private key contains zero or negative prime") - } - key.Primes[i+2] = a.Prime - // We ignore the other two values because rsa will calculate - // them as needed. - } - - err = key.Validate() - if err != nil { - return nil, err - } - key.Precompute() - - return -} - -// MarshalPKCS1PrivateKey converts a private key to ASN.1 DER encoded form. -func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte { - key.Precompute() - - version := 0 - if len(key.Primes) > 2 { - version = 1 - } - - priv := pkcs1PrivateKey{ - Version: version, - N: key.N, - E: key.PublicKey.E, - D: key.D, - P: key.Primes[0], - Q: key.Primes[1], - Dp: key.Precomputed.Dp, - Dq: key.Precomputed.Dq, - Qinv: key.Precomputed.Qinv, - } - - priv.AdditionalPrimes = make([]pkcs1AdditionalRSAPrime, len(key.Precomputed.CRTValues)) - for i, values := range key.Precomputed.CRTValues { - priv.AdditionalPrimes[i].Prime = key.Primes[2+i] - priv.AdditionalPrimes[i].Exp = values.Exp - priv.AdditionalPrimes[i].Coeff = values.Coeff - } - - b, _ := asn1.Marshal(priv) - return b -} - -// rsaPublicKey reflects the ASN.1 structure of a PKCS#1 public key. -type rsaPublicKey struct { - N *big.Int - E int -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8.go deleted file mode 100644 index ba19989cba1311bf9efac6b6f259efcf41181d04..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "crypto/x509/pkix" - "encoding/asn1" - "errors" - "fmt" -) - -// pkcs8 reflects an ASN.1, PKCS#8 PrivateKey. See -// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-8/pkcs-8v1_2.asn -// and RFC5208. -type pkcs8 struct { - Version int - Algo pkix.AlgorithmIdentifier - PrivateKey []byte - // optional attributes omitted. -} - -// ParsePKCS8PrivateKey parses an unencrypted, PKCS#8 private key. See -// http://www.rsa.com/rsalabs/node.asp?id=2130 and RFC5208. -func ParsePKCS8PrivateKey(der []byte) (key interface{}, err error) { - var privKey pkcs8 - if _, err := asn1.Unmarshal(der, &privKey); err != nil { - return nil, err - } - switch { - case privKey.Algo.Algorithm.Equal(oidPublicKeyRSA): - key, err = ParsePKCS1PrivateKey(privKey.PrivateKey) - if err != nil { - return nil, errors.New("x509: failed to parse RSA private key embedded in PKCS#8: " + err.Error()) - } - return key, nil - - case privKey.Algo.Algorithm.Equal(oidPublicKeyECDSA): - bytes := privKey.Algo.Parameters.FullBytes - namedCurveOID := new(asn1.ObjectIdentifier) - if _, err := asn1.Unmarshal(bytes, namedCurveOID); err != nil { - namedCurveOID = nil - } - key, err = parseECPrivateKey(namedCurveOID, privKey.PrivateKey) - if err != nil { - return nil, errors.New("x509: failed to parse EC private key embedded in PKCS#8: " + err.Error()) - } - return key, nil - - default: - return nil, fmt.Errorf("x509: PKCS#8 wrapping contained private key with unknown algorithm: %v", privKey.Algo.Algorithm) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8_test.go deleted file mode 100644 index 4114efd0e0d1ad24c5d3aa736a37b92c3009d18c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkcs8_test.go +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "encoding/hex" - "testing" -) - -var pkcs8RSAPrivateKeyHex = `30820278020100300d06092a864886f70d0101010500048202623082025e02010002818100cfb1b5bf9685ffa97b4f99df4ff122b70e59ac9b992f3bc2b3dde17d53c1a34928719b02e8fd17839499bfbd515bd6ef99c7a1c47a239718fe36bfd824c0d96060084b5f67f0273443007a24dfaf5634f7772c9346e10eb294c2306671a5a5e719ae24b4de467291bc571014b0e02dec04534d66a9bb171d644b66b091780e8d020301000102818100b595778383c4afdbab95d2bfed12b3f93bb0a73a7ad952f44d7185fd9ec6c34de8f03a48770f2009c8580bcd275e9632714e9a5e3f32f29dc55474b2329ff0ebc08b3ffcb35bc96e6516b483df80a4a59cceb71918cbabf91564e64a39d7e35dce21cb3031824fdbc845dba6458852ec16af5dddf51a8397a8797ae0337b1439024100ea0eb1b914158c70db39031dd8904d6f18f408c85fbbc592d7d20dee7986969efbda081fdf8bc40e1b1336d6b638110c836bfdc3f314560d2e49cd4fbde1e20b024100e32a4e793b574c9c4a94c8803db5152141e72d03de64e54ef2c8ed104988ca780cd11397bc359630d01b97ebd87067c5451ba777cf045ca23f5912f1031308c702406dfcdbbd5a57c9f85abc4edf9e9e29153507b07ce0a7ef6f52e60dcfebe1b8341babd8b789a837485da6c8d55b29bbb142ace3c24a1f5b54b454d01b51e2ad03024100bd6a2b60dee01e1b3bfcef6a2f09ed027c273cdbbaf6ba55a80f6dcc64e4509ee560f84b4f3e076bd03b11e42fe71a3fdd2dffe7e0902c8584f8cad877cdc945024100aa512fa4ada69881f1d8bb8ad6614f192b83200aef5edf4811313d5ef30a86cbd0a90f7b025c71ea06ec6b34db6306c86b1040670fd8654ad7291d066d06d031` - -// Generated using: -// openssl ecparam -genkey -name secp521r1 | openssl pkcs8 -topk8 -nocrypt -var pkcs8ECPrivateKeyHex = `3081ed020100301006072a8648ce3d020106052b810400230481d53081d20201010441850d81618c5da1aec74c2eed608ba816038506975e6427237c2def150c96a3b13efbfa1f89f1be15cdf4d0ac26422e680e65a0ddd4ad3541ad76165fbf54d6e34ba18189038186000400da97bcedba1eb6d30aeb93c9f9a1454598fa47278df27d6f60ea73eb672d8dc528a9b67885b5b5dcef93c9824f7449ab512ee6a27e76142f56b94b474cfd697e810046c8ca70419365245c1d7d44d0db82c334073835d002232714548abbae6e5700f5ef315ee08b929d8581383dcf2d1c98c2f8a9fccbf79c9579f7b2fd8a90115ac2` - -func TestPKCS8(t *testing.T) { - derBytes, _ := hex.DecodeString(pkcs8RSAPrivateKeyHex) - if _, err := ParsePKCS8PrivateKey(derBytes); err != nil { - t.Errorf("failed to decode PKCS8 with RSA private key: %s", err) - } - - derBytes, _ = hex.DecodeString(pkcs8ECPrivateKeyHex) - if _, err := ParsePKCS8PrivateKey(derBytes); err != nil { - t.Errorf("failed to decode PKCS8 with EC private key: %s", err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkix/pkix.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkix/pkix.go deleted file mode 100644 index 5add4e5d3e0d0d5aab1a6be905fd2f6a68383bf6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/pkix/pkix.go +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package pkix contains shared, low level structures used for ASN.1 parsing -// and serialization of X.509 certificates, CRL and OCSP. -package pkix - -import ( - "encoding/asn1" - "math/big" - "time" -) - -// AlgorithmIdentifier represents the ASN.1 structure of the same name. See RFC -// 5280, section 4.1.1.2. -type AlgorithmIdentifier struct { - Algorithm asn1.ObjectIdentifier - Parameters asn1.RawValue `asn1:"optional"` -} - -type RDNSequence []RelativeDistinguishedNameSET - -type RelativeDistinguishedNameSET []AttributeTypeAndValue - -// AttributeTypeAndValue mirrors the ASN.1 structure of the same name in -// http://tools.ietf.org/html/rfc5280#section-4.1.2.4 -type AttributeTypeAndValue struct { - Type asn1.ObjectIdentifier - Value interface{} -} - -// AttributeTypeAndValueSET represents a set of ASN.1 sequences of -// AttributeTypeAndValue sequences from RFC 2986 (PKCS #10). -type AttributeTypeAndValueSET struct { - Type asn1.ObjectIdentifier - Value [][]AttributeTypeAndValue `asn1:"set"` -} - -// Extension represents the ASN.1 structure of the same name. See RFC -// 5280, section 4.2. -type Extension struct { - Id asn1.ObjectIdentifier - Critical bool `asn1:"optional"` - Value []byte -} - -// Name represents an X.509 distinguished name. This only includes the common -// elements of a DN. When parsing, all elements are stored in Names and -// non-standard elements can be extracted from there. When marshaling, elements -// in ExtraNames are appended and override other values with the same OID. -type Name struct { - Country, Organization, OrganizationalUnit []string - Locality, Province []string - StreetAddress, PostalCode []string - SerialNumber, CommonName string - - Names []AttributeTypeAndValue - ExtraNames []AttributeTypeAndValue -} - -func (n *Name) FillFromRDNSequence(rdns *RDNSequence) { - for _, rdn := range *rdns { - if len(rdn) == 0 { - continue - } - atv := rdn[0] - n.Names = append(n.Names, atv) - value, ok := atv.Value.(string) - if !ok { - continue - } - - t := atv.Type - if len(t) == 4 && t[0] == 2 && t[1] == 5 && t[2] == 4 { - switch t[3] { - case 3: - n.CommonName = value - case 5: - n.SerialNumber = value - case 6: - n.Country = append(n.Country, value) - case 7: - n.Locality = append(n.Locality, value) - case 8: - n.Province = append(n.Province, value) - case 9: - n.StreetAddress = append(n.StreetAddress, value) - case 10: - n.Organization = append(n.Organization, value) - case 11: - n.OrganizationalUnit = append(n.OrganizationalUnit, value) - case 17: - n.PostalCode = append(n.PostalCode, value) - } - } - } -} - -var ( - oidCountry = []int{2, 5, 4, 6} - oidOrganization = []int{2, 5, 4, 10} - oidOrganizationalUnit = []int{2, 5, 4, 11} - oidCommonName = []int{2, 5, 4, 3} - oidSerialNumber = []int{2, 5, 4, 5} - oidLocality = []int{2, 5, 4, 7} - oidProvince = []int{2, 5, 4, 8} - oidStreetAddress = []int{2, 5, 4, 9} - oidPostalCode = []int{2, 5, 4, 17} -) - -// appendRDNs appends a relativeDistinguishedNameSET to the given RDNSequence -// and returns the new value. The relativeDistinguishedNameSET contains an -// attributeTypeAndValue for each of the given values. See RFC 5280, A.1, and -// search for AttributeTypeAndValue. -func (n Name) appendRDNs(in RDNSequence, values []string, oid asn1.ObjectIdentifier) RDNSequence { - if len(values) == 0 || oidInAttributeTypeAndValue(oid, n.ExtraNames) { - return in - } - - s := make([]AttributeTypeAndValue, len(values)) - for i, value := range values { - s[i].Type = oid - s[i].Value = value - } - - return append(in, s) -} - -func (n Name) ToRDNSequence() (ret RDNSequence) { - ret = n.appendRDNs(ret, n.Country, oidCountry) - ret = n.appendRDNs(ret, n.Organization, oidOrganization) - ret = n.appendRDNs(ret, n.OrganizationalUnit, oidOrganizationalUnit) - ret = n.appendRDNs(ret, n.Locality, oidLocality) - ret = n.appendRDNs(ret, n.Province, oidProvince) - ret = n.appendRDNs(ret, n.StreetAddress, oidStreetAddress) - ret = n.appendRDNs(ret, n.PostalCode, oidPostalCode) - if len(n.CommonName) > 0 { - ret = n.appendRDNs(ret, []string{n.CommonName}, oidCommonName) - } - if len(n.SerialNumber) > 0 { - ret = n.appendRDNs(ret, []string{n.SerialNumber}, oidSerialNumber) - } - for _, atv := range n.ExtraNames { - ret = append(ret, []AttributeTypeAndValue{atv}) - } - - return ret -} - -// oidInAttributeTypeAndValue returns whether a type with the given OID exists -// in atv. -func oidInAttributeTypeAndValue(oid asn1.ObjectIdentifier, atv []AttributeTypeAndValue) bool { - for _, a := range atv { - if a.Type.Equal(oid) { - return true - } - } - return false -} - -// CertificateList represents the ASN.1 structure of the same name. See RFC -// 5280, section 5.1. Use Certificate.CheckCRLSignature to verify the -// signature. -type CertificateList struct { - TBSCertList TBSCertificateList - SignatureAlgorithm AlgorithmIdentifier - SignatureValue asn1.BitString -} - -// HasExpired reports whether now is past the expiry time of certList. -func (certList *CertificateList) HasExpired(now time.Time) bool { - return now.After(certList.TBSCertList.NextUpdate) -} - -// TBSCertificateList represents the ASN.1 structure of the same name. See RFC -// 5280, section 5.1. -type TBSCertificateList struct { - Raw asn1.RawContent - Version int `asn1:"optional,default:1"` - Signature AlgorithmIdentifier - Issuer RDNSequence - ThisUpdate time.Time - NextUpdate time.Time `asn1:"optional"` - RevokedCertificates []RevokedCertificate `asn1:"optional"` - Extensions []Extension `asn1:"tag:0,optional,explicit"` -} - -// RevokedCertificate represents the ASN.1 structure of the same name. See RFC -// 5280, section 5.1. -type RevokedCertificate struct { - SerialNumber *big.Int - RevocationTime time.Time - Extensions []Extension `asn1:"optional"` -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root.go deleted file mode 100644 index 8aae14e09ee72626b64895c8ffd282938c62faeb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import "sync" - -var ( - once sync.Once - systemRoots *CertPool -) - -func systemRootsPool() *CertPool { - once.Do(initSystemRoots) - return systemRoots -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_bsd.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_bsd.go deleted file mode 100644 index 93172837368935ef444f7e9765e3ded5abaebe69..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_bsd.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build dragonfly freebsd netbsd openbsd - -package x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{ - "/usr/local/share/certs/ca-root-nss.crt", // FreeBSD/DragonFly - "/etc/ssl/cert.pem", // OpenBSD - "/etc/openssl/certs/ca-certificates.crt", // NetBSD -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_cgo_darwin.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_cgo_darwin.go deleted file mode 100644 index bf4a5cdfeeef2fcf15475e300fa332c74ba9bb8c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_cgo_darwin.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build cgo,!arm,!arm64,!ios - -package x509 - -/* -#cgo CFLAGS: -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1060 -#cgo LDFLAGS: -framework CoreFoundation -framework Security - -#include -#include - -// FetchPEMRoots fetches the system's list of trusted X.509 root certificates. -// -// On success it returns 0 and fills pemRoots with a CFDataRef that contains the extracted root -// certificates of the system. On failure, the function returns -1. -// -// Note: The CFDataRef returned in pemRoots must be released (using CFRelease) after -// we've consumed its content. -int FetchPEMRoots(CFDataRef *pemRoots) { - if (pemRoots == NULL) { - return -1; - } - - CFArrayRef certs = NULL; - OSStatus err = SecTrustCopyAnchorCertificates(&certs); - if (err != noErr) { - return -1; - } - - CFMutableDataRef combinedData = CFDataCreateMutable(kCFAllocatorDefault, 0); - int i, ncerts = CFArrayGetCount(certs); - for (i = 0; i < ncerts; i++) { - CFDataRef data = NULL; - SecCertificateRef cert = (SecCertificateRef)CFArrayGetValueAtIndex(certs, i); - if (cert == NULL) { - continue; - } - - // Note: SecKeychainItemExport is deprecated as of 10.7 in favor of SecItemExport. - // Once we support weak imports via cgo we should prefer that, and fall back to this - // for older systems. - err = SecKeychainItemExport(cert, kSecFormatX509Cert, kSecItemPemArmour, NULL, &data); - if (err != noErr) { - continue; - } - - if (data != NULL) { - CFDataAppendBytes(combinedData, CFDataGetBytePtr(data), CFDataGetLength(data)); - CFRelease(data); - } - } - - CFRelease(certs); - - *pemRoots = combinedData; - return 0; -} -*/ -import "C" -import "unsafe" - -func initSystemRoots() { - roots := NewCertPool() - - var data C.CFDataRef = nil - err := C.FetchPEMRoots(&data) - if err == -1 { - return - } - - defer C.CFRelease(C.CFTypeRef(data)) - buf := C.GoBytes(unsafe.Pointer(C.CFDataGetBytePtr(data)), C.int(C.CFDataGetLength(data))) - roots.AppendCertsFromPEM(buf) - systemRoots = roots -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin.go deleted file mode 100644 index 78de56c221531491f117f034757809df70af23b5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run root_darwin_arm_gen.go -output root_darwin_armx.go - -package x509 - -import "os/exec" - -func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { - return nil, nil -} - -func execSecurityRoots() (*CertPool, error) { - cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", "/System/Library/Keychains/SystemRootCertificates.keychain") - data, err := cmd.Output() - if err != nil { - return nil, err - } - - roots := NewCertPool() - roots.AppendCertsFromPEM(data) - return roots, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_arm_gen.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_arm_gen.go deleted file mode 100644 index 5817158c33b6e90b9c040cddb6d4542d7f76ccb4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_arm_gen.go +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// Generates root_darwin_armx.go. -// -// As of iOS 8, there is no API for querying the system trusted X.509 root -// certificates. We could use SecTrustEvaluate to verify that a trust chain -// exists for a certificate, but the x509 API requires returning the entire -// chain. -// -// Apple publishes the list of trusted root certificates for iOS on -// support.apple.com. So we parse the list and extract the certificates from -// an OS X machine and embed them into the x509 package. -package main - -import ( - "bytes" - "crypto/x509" - "encoding/pem" - "flag" - "fmt" - "go/format" - "io/ioutil" - "log" - "math/big" - "net/http" - "os/exec" - "strings" -) - -var output = flag.String("output", "root_darwin_armx.go", "file name to write") - -func main() { - certs, err := selectCerts() - if err != nil { - log.Fatal(err) - } - - buf := new(bytes.Buffer) - - fmt.Fprintf(buf, "// Created by root_darwin_arm_gen --output %s; DO NOT EDIT\n", *output) - fmt.Fprintf(buf, "%s", header) - - fmt.Fprintf(buf, "const systemRootsPEM = `\n") - for _, cert := range certs { - b := &pem.Block{ - Type: "CERTIFICATE", - Bytes: cert.Raw, - } - if err := pem.Encode(buf, b); err != nil { - log.Fatal(err) - } - } - fmt.Fprintf(buf, "`") - - source, err := format.Source(buf.Bytes()) - if err != nil { - log.Fatal("source format error:", err) - } - if err := ioutil.WriteFile(*output, source, 0644); err != nil { - log.Fatal(err) - } -} - -func selectCerts() ([]*x509.Certificate, error) { - ids, err := fetchCertIDs() - if err != nil { - return nil, err - } - - scerts, err := sysCerts() - if err != nil { - return nil, err - } - - var certs []*x509.Certificate - for _, id := range ids { - sn, ok := big.NewInt(0).SetString(id.serialNumber, 0) // 0x prefix selects hex - if !ok { - return nil, fmt.Errorf("invalid serial number: %q", id.serialNumber) - } - ski, ok := big.NewInt(0).SetString(id.subjectKeyID, 0) - if !ok { - return nil, fmt.Errorf("invalid Subject Key ID: %q", id.subjectKeyID) - } - - for _, cert := range scerts { - if sn.Cmp(cert.SerialNumber) != 0 { - continue - } - cski := big.NewInt(0).SetBytes(cert.SubjectKeyId) - if ski.Cmp(cski) != 0 { - continue - } - certs = append(certs, cert) - break - } - } - return certs, nil -} - -func sysCerts() (certs []*x509.Certificate, err error) { - cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", "/System/Library/Keychains/SystemRootCertificates.keychain") - data, err := cmd.Output() - if err != nil { - return nil, err - } - for len(data) > 0 { - var block *pem.Block - block, data = pem.Decode(data) - if block == nil { - break - } - if block.Type != "CERTIFICATE" || len(block.Headers) != 0 { - continue - } - - cert, err := x509.ParseCertificate(block.Bytes) - if err != nil { - continue - } - certs = append(certs, cert) - } - return certs, nil -} - -type certID struct { - serialNumber string - subjectKeyID string -} - -// fetchCertIDs fetches IDs of iOS X509 certificates from apple.com. -func fetchCertIDs() ([]certID, error) { - resp, err := http.Get("https://support.apple.com/en-us/HT204132") - if err != nil { - return nil, err - } - defer resp.Body.Close() - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - text := string(body) - text = text[strings.Index(text, "
")] - - lines := strings.Split(text, "\n") - var ids []certID - var id certID - for i, ln := range lines { - if i == len(lines)-1 { - break - } - const sn = "Serial Number:" - if ln == sn { - id.serialNumber = "0x" + strings.Replace(strings.TrimSpace(lines[i+1]), ":", "", -1) - continue - } - if strings.HasPrefix(ln, sn) { - // extract hex value from parentheses. - id.serialNumber = ln[strings.Index(ln, "(")+1 : len(ln)-1] - continue - } - if strings.TrimSpace(ln) == "X509v3 Subject Key Identifier:" { - id.subjectKeyID = "0x" + strings.Replace(strings.TrimSpace(lines[i+1]), ":", "", -1) - ids = append(ids, id) - id = certID{} - } - } - return ids, nil -} - -const header = ` -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build cgo -// +build darwin -// +build arm arm64 - -package x509 - -func initSystemRoots() { - systemRoots = NewCertPool() - systemRoots.AppendCertsFromPEM([]byte(systemRootsPEM)) -} -` diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_armx.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_armx.go deleted file mode 100644 index 37675b48a39035ac2e2036a2fe4f9d7b9171bb53..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_darwin_armx.go +++ /dev/null @@ -1,4907 +0,0 @@ -// Created by root_darwin_arm_gen --output root_darwin_armx.go; DO NOT EDIT - -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build cgo -// +build darwin -// +build arm arm64 ios - -package x509 - -func initSystemRoots() { - systemRoots = NewCertPool() - systemRoots.AppendCertsFromPEM([]byte(systemRootsPEM)) -} - -const systemRootsPEM = ` ------BEGIN CERTIFICATE----- -MIIF8DCCA9igAwIBAgIPBuhGJy8fCo/RhFzjafbVMA0GCSqGSIb3DQEBBQUAMDgx -CzAJBgNVBAYTAkVTMRQwEgYDVQQKDAtJWkVOUEUgUy5BLjETMBEGA1UEAwwKSXpl -bnBlLmNvbTAeFw0wNzEyMTMxMzA4MjdaFw0zNzEyMTMwODI3MjVaMDgxCzAJBgNV -BAYTAkVTMRQwEgYDVQQKDAtJWkVOUEUgUy5BLjETMBEGA1UEAwwKSXplbnBlLmNv -bTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMnTesoPHqynhugWZWqx -whtFMnGV2f4QW8yv56V5AY+Jw8ryVXH3d753lPNypCxE2J6SmxQ6oeckkAoKVo7F -2CaU4dlI4S0+2gpy3aOZFdqBoof0e24md4lYrdbrDLJBenNubdt6eEHpCIgSfocu -ZhFjbFT7PJ1ywLwu/8K33Q124zrX97RovqL144FuwUZvXY3gTcZUVYkaMzEKsVe5 -o4qYw+w7NMWVQWl+dcI8IMVhulFHoCCQk6GQS/NOfIVFVJrRBSZBsLVNHTO+xAPI -JXzBcNs79AktVCdIrC/hxKw+yMuSTFM5NyPs0wH54AlETU1kwOENWocivK0bo/4m -tRXzp/yEGensoYi0RGmEg/OJ0XQGqcwL1sLeJ4VQJsoXuMl6h1YsGgEebL4TrRCs -tST1OJGh1kva8bvS3ke18byB9llrzxlT6Y0Vy0rLqW9E5RtBz+GGp8rQap+8TI0G -M1qiheWQNaBiXBZO8OOi+gMatCxxs1gs3nsL2xoP694hHwZ3BgOwye+Z/MC5TwuG -KP7Suerj2qXDR2kS4Nvw9hmL7Xtw1wLW7YcYKCwEJEx35EiKGsY7mtQPyvp10gFA -Wo15v4vPS8+qFsGV5K1Mij4XkdSxYuWC5YAEpAN+jb/af6IPl08M0w3719Hlcn4c -yHf/W5oPt64FRuXxqBbsR6QXAgMBAAGjgfYwgfMwgbAGA1UdEQSBqDCBpYEPaW5m -b0BpemVucGUuY29tpIGRMIGOMUcwRQYDVQQKDD5JWkVOUEUgUy5BLiAtIENJRiBB -MDEzMzcyNjAtUk1lcmMuVml0b3JpYS1HYXN0ZWl6IFQxMDU1IEY2MiBTODFDMEEG -A1UECQw6QXZkYSBkZWwgTWVkaXRlcnJhbmVvIEV0b3JiaWRlYSAxNCAtIDAxMDEw -IFZpdG9yaWEtR2FzdGVpejAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUHRxlDqjyJXu0kc/ksbHmvVV0bAUwDQYJKoZIhvcNAQEFBQAD -ggIBAMeBRm8hGE+gBe/n1bqXUKJg7aWSFBpSm/nxiEqg3Hh10dUflU7F57dp5iL0 -+CmoKom+z892j+Mxc50m0xwbRxYpB2iEitL7sRskPtKYGCwkjq/2e+pEFhsqxPqg -l+nqbFik73WrAGLRne0TNtsiC7bw0fRue0aHwp28vb5CO7dz0JoqPLRbEhYArxk5 -ja2DUBzIgU+9Ag89njWW7u/kwgN8KRwCfr00J16vU9adF79XbOnQgxCvv11N75B7 -XSus7Op9ACYXzAJcY9cZGKfsK8eKPlgOiofmg59OsjQerFQJTx0CCzl+gQgVuaBp -E8gyK+OtbBPWg50jLbJtooiGfqgNASYJQNntKE6MkyQP2/EeTXp6WuKlWPHcj1+Z -ggwuz7LdmMySlD/5CbOlliVbN/UShUHiGUzGigjB3Bh6Dx4/glmimj4/+eAJn/3B -kUtdyXvWton83x18hqrNA/ILUpLxYm9/h+qrdslsUMIZgq+qHfUgKGgu1fxkN0/P -pUTEvnK0jHS0bKf68r10OEMr3q/53NjgnZ/cPcqlY0S/kqJPTIAcuxrDmkoEVU3K -7iYLHL8CxWTTnn7S05EcS6L1HOUXHA0MUqORH5zwIe0ClG+poEnK6EOMxPQ02nwi -o8ZmPrgbBYhdurz3vOXcFD2nhqi2WVIhA16L4wTtSyoeo09Q ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML -RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp -bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 -IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 -MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 -LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp -YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG -A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq -K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe -sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX -MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT -XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ -HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH -4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV -HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub -j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo -U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf -zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b -u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ -bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er -fF6adulZkMV8gzURZVE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFwTCCA6mgAwIBAgIITrIAZwwDXU8wDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE -BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEjMCEGA1UEAxMaU3dpc3NTaWdu -IFBsYXRpbnVtIENBIC0gRzIwHhcNMDYxMDI1MDgzNjAwWhcNMzYxMDI1MDgzNjAw -WjBJMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMSMwIQYDVQQD -ExpTd2lzc1NpZ24gUGxhdGludW0gQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQAD -ggIPADCCAgoCggIBAMrfogLi2vj8Bxax3mCq3pZcZB/HL37PZ/pEQtZ2Y5Wu669y -IIpFR4ZieIbWIDkm9K6j/SPnpZy1IiEZtzeTIsBQnIJ71NUERFzLtMKfkr4k2Htn -IuJpX+UFeNSH2XFwMyVTtIc7KZAoNppVRDBopIOXfw0enHb/FZ1glwCNioUD7IC+ -6ixuEFGSzH7VozPY1kneWCqv9hbrS3uQMpe5up1Y8fhXSQQeol0GcN1x2/ndi5ob -jM89o03Oy3z2u5yg+gnOI2Ky6Q0f4nIoj5+saCB9bzuohTEJfwvH6GXp43gOCWcw -izSC+13gzJ2BbWLuCB4ELE6b7P6pT1/9aXjvCR+htL/68++QHkwFix7qepF6w9fl -+zC8bBsQWJj3Gl/QKTIDE0ZNYWqFTFJ0LwYfexHihJfGmfNtf9dng34TaNhxKFrY -zt3oEBSa/m0jh26OWnA81Y0JAKeqvLAxN23IhBQeW71FYyBrS3SMvds6DsHPWhaP -pZjydomyExI7C3d3rLvlPClKknLKYRorXkzig3R3+jVIeoVNjZpTxN94ypeRSCtF -KwH3HBqi7Ri6Cr2D+m+8jVeTO9TUps4e8aCxzqv9KyiaTxvXw3LbpMS/XUz13XuW -ae5ogObnmLo2t/5u7Su9IPhlGdpVCX4l3P5hYnL5fhgC72O00Puv5TtjjGePAgMB -AAGjgawwgakwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFFCvzAeHFUdvOMW0ZdHelarp35zMMB8GA1UdIwQYMBaAFFCvzAeHFUdvOMW0 -ZdHelarp35zMMEYGA1UdIAQ/MD0wOwYJYIV0AVkBAQEBMC4wLAYIKwYBBQUHAgEW -IGh0dHA6Ly9yZXBvc2l0b3J5LnN3aXNzc2lnbi5jb20vMA0GCSqGSIb3DQEBBQUA -A4ICAQAIhab1Fgz8RBrBY+D5VUYI/HAcQiiWjrfFwUF1TglxeeVtlspLpYhg0DB0 -uMoI3LQwnkAHFmtllXcBrqS3NQuB2nEVqXQXOHtYyvkv+8Bldo1bAbl93oI9ZLi+ -FHSjClTTLJUYFzX1UWs/j6KWYTl4a0vlpqD4U99REJNi54Av4tHgvI42Rncz7Lj7 -jposiU0xEQ8mngS7twSNC/K5/FqdOxa3L8iYq/6KUFkuozv8KV2LwUvJ4ooTHbG/ -u0IdUt1O2BReEMYxB+9xJ/cbOQncguqLs5WGXv312l0xpuAxtpTmREl0xRbl9x8D -YSjFyMsSoEJL+WuICI20MhjzdZ/EfwBPBZWcoxcCw7NTm6ogOSkrZvqdr16zktK1 -puEa+S1BaYEUtLS17Yk9zvupnTVCRLEcFHOBzyoBNZox1S2PbYTfgE1X4z/FhHXa -icYwu+uPyyIIoK6q8QNsOktNCaUOcsZWayFCTiMlFGiudgp8DAdwZPmaL/YFOSbG -DI8Zf0NebvRbFS/bYV3mZy8/CJT5YLSYMdp08YSTcU1f+2BY0fvEwW2JorsgH51x -kcsymxM9Pn2SUjWskpSi0xjCfMfqr3YFFt1nJ8J+HAciIfNAChs0B0QTwoRqjt8Z -Wr9/6x3iGjjRXK9HkmuAtTClyY3YqzGBH9/CZjfTk6mFhnll0g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UE -BhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8w -MzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290 -IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDkyMjExMjIwMlowazELMAkGA1UEBhMC -SVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1 -ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENB -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNv -UTufClrJwkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX -4ay8IMKx4INRimlNAJZaby/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9 -KK3giq0itFZljoZUj5NDKd45RnijMCO6zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/ -gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1fYVEiVRvjRuPjPdA1Yprb -rxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2oxgkg4YQ -51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2F -be8lEfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxe -KF+w6D9Fz8+vm2/7hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4F -v6MGn8i1zeQf1xcGDXqVdFUNaBr8EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbn -fpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5jF66CyCU3nuDuP/jVo23Eek7 -jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLYiDrIn3hm7Ynz -ezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt -ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAL -e3KHwGCmSUyIWOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70 -jsNjLiNmsGe+b7bAEzlgqqI0JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDz -WochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKxK3JCaKygvU5a2hi/a5iB0P2avl4V -SM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+Xlff1ANATIGk0k9j -pwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC4yyX -X04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+Ok -fcvHlXHo2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7R -K4X9p2jIugErsWx0Hbhzlefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btU -ZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXemOR/qnuOf0GZvBeyqdn6/axag67XH/JJU -LysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9vwGYT7JZVEc+NHt4bVaT -LnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBOZXR3b3JraW5nMB4XDTEwMDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SEHi3y -YJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbua -kCNrmreIdIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRL -QESxG9fhwoXA3hA/Pe24/PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp -6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gbh+0t+nvujArjqWaJGctB+d1ENmHP4ndG -yH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNVHQ4EFgQUBx/S55zawm6i -QLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfO -tDIuUFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzu -QY0x2+c06lkh1QF612S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZ -Lgo/bNjR9eUJtGxUAArgFU2HdW23WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4u -olu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9/ZFvgrG+CJPbFEfxojfHRZ48 -x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg -b2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAxNjEzNDNaFw0zNzA5MzAxNjEzNDRa -MH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZpcm1hIFNBIENJRiBB -ODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3JnMSIw -IAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0B -AQEFAAOCAQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtb -unXF/KGIJPov7coISjlUxFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0d -BmpAPrMMhe5cG3nCYsS4No41XQEMIwRHNaqbYE6gZj3LJgqcQKH0XZi/caulAGgq -7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jWDA+wWFjbw2Y3npuRVDM3 -0pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFVd9oKDMyX -roDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIG -A1UdEwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5j -aGFtYmVyc2lnbi5vcmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p -26EpW1eLTXYGduHRooowDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIA -BzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24ub3JnMCcGA1Ud -EgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYDVR0gBFEwTzBN -BgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz -aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEB -AAxBl8IahsAifJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZd -p0AJPaxJRUXcLo0waLIJuvvDL8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi -1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wNUPf6s+xCX6ndbcj0dc97wXImsQEc -XCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/nADydb47kMgkdTXg0 -eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1erfu -tGWaIZDgqtCYvDi1czyL+Nw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj -YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL -MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE -BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM -GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua -BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe -3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4 -YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR -rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm -ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU -oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF -MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v -QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t -b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF -AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q -GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz -Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2 -G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi -l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3 -smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl -YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P -RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 -UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI -2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 -Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp -+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ -DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O -nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW -/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g -PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u -QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY -SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv -IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 -zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd -BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB -ZQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDcDCCAligAwIBAgIBBTANBgkqhkiG9w0BAQUFADBbMQswCQYDVQQGEwJVUzEY -MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsT -A1BLSTEWMBQGA1UEAxMNRG9EIFJvb3QgQ0EgMjAeFw0wNDEyMTMxNTAwMTBaFw0y -OTEyMDUxNTAwMTBaMFsxCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9VLlMuIEdvdmVy -bm1lbnQxDDAKBgNVBAsTA0RvRDEMMAoGA1UECxMDUEtJMRYwFAYDVQQDEw1Eb0Qg -Um9vdCBDQSAyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwCzB9o07 -rP8/PNZxvrh0IgfscEEV/KtA4weqwcPYn/7aTDq/P8jYKHtLNgHArEUlw9IOCo+F -GGQQPRoTcCpvjtfcjZOzQQ84Ic2tq8I9KgXTVxE3Dc2MUfmT48xGSSGOFLTNyxQ+ -OM1yMe6rEvJl6jQuVl3/7mN1y226kTT8nvP0LRy+UMRC31mI/2qz+qhsPctWcXEF -lrufgOWARVlnQbDrw61gpIB1BhecDvRD4JkOG/t/9bPMsoGCsf0ywbi+QaRktWA6 -WlEwjM7eQSwZR1xJEGS5dKmHQa99brrBuKG/ZTE6BGf5tbuOkooAY7ix5ow4X4P/ -UNU7ol1rshDMYwIDAQABoz8wPTAdBgNVHQ4EFgQUSXS7DF66ev4CVO97oMaVxgmA -cJYwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBAJiRjT+JyLv1wGlzKTs1rLqzCHY9cAmS6YREIQF9FHYb7lFsHY0VNy17MWn0 -mkS4r0bMNPojywMnGdKDIXUr5+AbmSbchECV6KjSzPZYXGbvP0qXEIIdugqi3VsG -K52nZE7rLgE1pLQ/E61V5NVzqGmbEfGY8jEeb0DU+HifjpGgb3AEkGaqBivO4XqS -tX3h4NGW56E6LcyxnR8FRO2HmdNNGnA5wQQM5X7Z8a/XIA7xInolpHOZzD+kByeW -qKKV7YK5FtOeC4fCwfKI9WLfaN/HvGlR7bFc3FRUKQ8JOZqsA8HbDE2ubwp6Fknx -v5HSOJTT9pUst2zJQraNypCNhdk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAw -PTELMAkGA1UEBhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFz -cyAyIFByaW1hcnkgQ0EwHhcNOTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9 -MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2VydHBsdXMxGzAZBgNVBAMTEkNsYXNz -IDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANxQ -ltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR5aiR -VhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyL -kcAbmXuZVg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCd -EgETjdyAYveVqUSISnFOYFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yas -H7WLO7dDWWuwJKZtkIvEcupdM5i3y95ee++U8Rs+yskhwcWYAqqi9lt3m/V+llU0 -HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRMECDAGAQH/AgEKMAsGA1Ud -DwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJYIZIAYb4 -QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMu -Y29tL0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/ -AN9WM2K191EBkOvDP9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8 -yfFC82x/xXp8HVGIutIKPidd3i1RTtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMR -FcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+7UCmnYR0ObncHoUW2ikbhiMA -ybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW//1IMwrh3KWB -kJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7 -l7+ijrRU ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 -cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs -IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz -dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy -NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu -dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt -dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 -aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T -RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN -cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW -wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 -U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 -jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN -BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ -jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ -Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v -1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R -nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH -VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID9jCCAt6gAwIBAgIQZIKe/DcedF38l/+XyLH/QTANBgkqhkiG9w0BAQsFADCB -lDELMAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8w -HQYDVQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRl -YyBDbGFzcyAyIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -IC0gRzYwHhcNMTExMDE4MDAwMDAwWhcNMzcxMjAxMjM1OTU5WjCBlDELMAkGA1UE -BhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZT -eW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAy -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzYwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNzOkFyGOFyz9AYxe9GPo15gRn -V2WYKaRPyVyPDzTS+NqoE2KquB5QZ3iwFkygOakVeq7t0qLA8JA3KRgmXOgNPLZs -ST/B4NzZS7YUGQum05bh1gnjGSYc+R9lS/kaQxwAg9bQqkmi1NvmYji6UBRDbfkx -+FYW2TgCkc/rbN27OU6Z4TBnRfHU8I3D3/7yOAchfQBeVkSz5GC9kSucq1sEcg+y -KNlyqwUgQiWpWwNqIBDMMfAr2jUs0Pual07wgksr2F82owstr2MNHSV/oW5cYqGN -KD6h/Bwg+AEvulWaEbAZ0shQeWsOagXXqgQ2sqPy4V93p3ec5R7c6d9qwWVdAgMB -AAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBSHjCCVyJhK0daABkqQNETfHE2/sDANBgkqhkiG9w0BAQsFAAOCAQEAgY6ypWaW -tyGltu9vI1pf24HFQqV4wWn99DzX+VxrcHIa/FqXTQCAiIiCisNxDY7FiZss7Y0L -0nJU9X3UXENX6fOupQIR9nYrgVfdfdp0MP1UR/bgFm6mtApI5ud1Bw8pGTnOefS2 -bMVfmdUfS/rfbSw8DVSAcPCIC4DPxmiiuB1w2XaM/O6lyc+tHc+ZJVdaYkXLFmu9 -Sc2lo4xpeSWuuExsi0BmSxY/zwIa3eFsawdhanYVKZl/G92IgMG/tY9zxaaWI4Sm -KIYkM2oBLldzJbZev4/mHWGoQClnHYebHX+bn5nNMdZUvmK7OaxoEkiRIKXLsd3+ -b/xa5IJVWa8xqQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEdDCCA1ygAwIBAgIQRL4Mi1AAJLQR0zYq/mUK/TANBgkqhkiG9w0BAQUFADCB -lzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3Qt -SGFyZHdhcmUwHhcNOTkwNzA5MTgxMDQyWhcNMTkwNzA5MTgxOTIyWjCBlzELMAkG -A1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2UgQ2l0eTEe -MBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExhodHRwOi8v -d3d3LnVzZXJ0cnVzdC5jb20xHzAdBgNVBAMTFlVUTi1VU0VSRmlyc3QtSGFyZHdh -cmUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx98M4P7Sof885glFn -0G2f0v9Y8+efK+wNiVSZuTiZFvfgIXlIwrthdBKWHTxqctU8EGc6Oe0rE81m65UJ -M6Rsl7HoxuzBdXmcRl6Nq9Bq/bkqVRcQVLMZ8Jr28bFdtqdt++BxF2uiiPsA3/4a -MXcMmgF6sTLjKwEHOG7DpV4jvEWbe1DByTCP2+UretNb+zNAHqDVmBe8i4fDidNd -oI6yqqr2jmmIBsX6iSHzCJ1pLgkzmykNRg+MzEk0sGlRvfkGzWitZky8PqxhvQqI -DsjfPe58BEydCl5rkdbux+0ojatNh4lz0G6k0B4WixThdkQDf2Os5M1JnMWS9Ksy -oUhbAgMBAAGjgbkwgbYwCwYDVR0PBAQDAgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYD -VR0OBBYEFKFyXyYbKJhDlV0HN9WFlp1L0sNFMEQGA1UdHwQ9MDswOaA3oDWGM2h0 -dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9VVE4tVVNFUkZpcnN0LUhhcmR3YXJlLmNy -bDAxBgNVHSUEKjAoBggrBgEFBQcDAQYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEF -BQcDBzANBgkqhkiG9w0BAQUFAAOCAQEARxkP3nTGmZev/K0oXnWO6y1n7k57K9cM -//bey1WiCuFMVGWTYGufEpytXoMs61quwOQt9ABjHbjAbPLPSbtNk28Gpgoiskli -CE7/yMgUsogWXecB5BKV5UU0s4tpvc+0hY91UZ59Ojg6FEgSxvunOxqNDYJAB+gE -CJChicsZUN/KHAG8HQQZexB2lzvukJDKxA4fFm517zP4029bHpbj4HR3dHuKom4t -3XbWOTCC8KucUvIqx69JXn7HaOWCgchqJ/kniCrVWFCVH/A7HFe7fRQ5YiuayZSS -KqMiDP+JJn1fIytH1xUdqWqeUQ0qUZ6B+dQ7XnASfxAynB67nfhmqA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDojCCAoqgAwIBAgIQE4Y1TR0/BvLB+WUF1ZAcYjANBgkqhkiG9w0BAQUFADBr -MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl -cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNv -bW1lcmNlIFJvb3QwHhcNMDIwNjI2MDIxODM2WhcNMjIwNjI0MDAxNjEyWjBrMQsw -CQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRlcm5h -dGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xHDAaBgNVBAMTE1Zpc2EgZUNvbW1l -cmNlIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvV95WHm6h -2mCxlCfLF9sHP4CFT8icttD0b0/Pmdjh28JIXDqsOTPHH2qLJj0rNfVIsZHBAk4E -lpF7sDPwsRROEW+1QK8bRaVK7362rPKgH1g/EkZgPI2h4H3PVz4zHvtH8aoVlwdV -ZqW1LS7YgFmypw23RuwhY/81q6UCzyr0TP579ZRdhE2o8mCP2w4lPJ9zcc+U30rq -299yOIzzlr3xF7zSujtFWsan9sYXiwGd/BmoKoMWuDpI/k4+oKsGGelT84ATB+0t -vz8KPFUgOSwsAGl0lUq8ILKpeeUYiZGo3BxN77t+Nwtd/jmliFKMAGzsGHxBvfaL -dXe6YJ2E5/4tAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQD -AgEGMB0GA1UdDgQWBBQVOIMPPyw/cDMezUb+B4wg4NfDtzANBgkqhkiG9w0BAQUF -AAOCAQEAX/FBfXxcCLkr4NWSR/pnXKUTwwMhmytMiUbPWU3J/qVAtmPN3XEolWcR -zCSs00Rsca4BIGsDoo8Ytyk6feUWYFN4PMCvFYP3j1IzJL1kk5fui/fbGKhtcbP3 -LBfQdCVp9/5rPJS+TUtBjE7ic9DjkCJzQ83z7+pzzkWKsKZJ/0x9nXGIxHYdkFsd -7v3M9+79YKWxehZx0RbQfBI8bGmX265fOZpwLwU8GUYEmSA20GBuYQa7FkKMcPcw -++DbZqMAAb3mLNqRX6BGi01qnD093QVG/na/oAo85ADmJ7f/hC3euiInlhBx6yLt -398znM/jra6O1I7mT1GvFpLgXPYHDw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFpDCCA4ygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP -bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAyMB4XDTAyMDUyODA2 -MDAwMFoXDTM3MDkyOTE0MDgwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft -ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg -Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAMxBRR3pPU0Q9oyxQcngXssNt79Hc9PwVU3dxgz6sWYFas14tNwC -206B89enfHG8dWOgXeMHDEjsJcQDIPT/DjsS/5uN4cbVG7RtIuOx238hZK+GvFci -KtZHgVdEglZTvYYUAQv8f3SkWq7xuhG1m1hagLQ3eAkzfDJHA1zEpYNI9FdWboE2 -JxhP7JsowtS013wMPgwr38oE18aO6lhOqKSlGBxsRZijQdEt0sdtjRnxrXm3gT+9 -BoInLRBYBbV4Bbkv2wxrkJB+FFk4u5QkE+XRnRTf04JNRvCAOVIyD+OEsnpD8l7e -Xz8d3eOyG6ChKiMDbi4BFYdcpnV1x5dhvt6G3NRI270qv0pV2uh9UPu0gBe4lL8B -PeraunzgWGcXuVjgiIZGZ2ydEEdYMtA1fHkqkKJaEBEjNa0vzORKW6fIJ/KD3l67 -Xnfn6KVuY8INXWHQjNJsWiEOyiijzirplcdIz5ZvHZIlyMbGwcEMBawmxNJ10uEq -Z8A9W6Wa6897GqidFEXlD6CaZd4vKL3Ob5Rmg0gp2OpljK+T2WSfVVcmv2/LNzGZ -o2C7HK2JNDJiuEMhBnIMoVxtRsX6Kc8w3onccVvdtjc+31D1uAclJuW8tf48ArO3 -+L5DwYcRlJ4jbBeKuIonDFRH8KmzwICMoCfrHRnjB453cMor9H124HhnAgMBAAGj -YzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFE1FwWg4u3OpaaEg5+31IqEj -FNeeMB8GA1UdIwQYMBaAFE1FwWg4u3OpaaEg5+31IqEjFNeeMA4GA1UdDwEB/wQE -AwIBhjANBgkqhkiG9w0BAQUFAAOCAgEAZ2sGuV9FOypLM7PmG2tZTiLMubekJcmn -xPBUlgtk87FYT15R/LKXeydlwuXK5w0MJXti4/qftIe3RUavg6WXSIylvfEWK5t2 -LHo1YGwRgJfMqZJS5ivmae2p+DYtLHe/YUjRYwu5W1LtGLBDQiKmsXeu3mnFzccc -obGlHBD7GL4acN3Bkku+KVqdPzW+5X1R+FXgJXUjhx5c3LqdsKyzadsXg8n33gy8 -CNyRnqjQ1xU3c6U1uPx+xURABsPr+CKAXEfOAuMRn0T//ZoyzH1kUQ7rVyZ2OuMe -IjzCpjbdGe+n/BLzJsBZMYVMnNjP36TMzCmT/5RtdlwTCJfy7aULTd3oyWgOZtMA -DjMSW7yV5TKQqLPGbIOtd+6Lfn6xqavT4fG2wLHqiMDn05DpKJKUe2h7lyoKZy2F -AjgQ5ANh1NolNscIWC2hp1GvMApJ9aZphwctREZ2jirlmjvXGKL8nDgQzMY70rUX -Om/9riW99XJZZLF0KjhfGEzfz3EEWjbUvy+ZnOjZurGV5gJLIaFb1cFPj65pbVPb -AZO1XB4Y3WRayhgoPmMEEf0cjQAPuDffZ4qdZqkCapH/E8ovXYO8h5Ns3CRRFgQl -Zvqz2cK6Kb6aSDiCmfS/O0oxGfm/jiEzFMpPVF/7zvuPcX/9XhmgD0uRuMRUvAaw -RY8mkaKO/qk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD -VQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0 -ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0G -CSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTAeFw0wOTA2MTYxMTMwMThaFw0y -OTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UEBwwIQnVkYXBlc3Qx -FjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUtU3pp -Z25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o -dTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvP -kd6mJviZpWNwrZuuyjNAfW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tc -cbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG0IMZfcChEhyVbUr02MelTTMuhTlAdX4U -fIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKApxn1ntxVUwOXewdI/5n7 -N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm1HxdrtbC -xkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1 -+rUCAwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G -A1UdDgQWBBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPM -Pcu1SCOhGnqmKrs0aDAbBgNVHREEFDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqG -SIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0olZMEyL/azXm4Q5DwpL7v8u8h -mLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfXI/OMn74dseGk -ddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775 -tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c -2Pm2G2JwCz02yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5t -HMN1Rq41Bab2XD0h7lbwyYIiLXpUq3DDfSJlgnCW ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHqTCCBZGgAwIBAgIQYwaGp8U3ZaVDkKhqWMzUMjANBgkqhkiG9w0BAQUFADCB -jzELMAkGA1UEBhMCTFYxNTAzBgNVBAoTLFZBUyBMYXR2aWphcyBQYXN0cyAtIFZp -ZW4ucmVnLk5yLjQwMDAzMDUyNzkwMSMwIQYDVQQLExpTZXJ0aWZpa2FjaWphcyBw -YWthbHBvanVtaTEkMCIGA1UEAxMbVkFTIExhdHZpamFzIFBhc3RzIFNTSShSQ0Ep -MB4XDTA2MDkxMzA5MjIxMFoXDTI0MDkxMzA5Mjc1N1owgY8xCzAJBgNVBAYTAkxW -MTUwMwYDVQQKEyxWQVMgTGF0dmlqYXMgUGFzdHMgLSBWaWVuLnJlZy5Oci40MDAw -MzA1Mjc5MDEjMCEGA1UECxMaU2VydGlmaWthY2lqYXMgcGFrYWxwb2p1bWkxJDAi -BgNVBAMTG1ZBUyBMYXR2aWphcyBQYXN0cyBTU0koUkNBKTCCAiIwDQYJKoZIhvcN -AQEBBQADggIPADCCAgoCggIBAJu4+f1hVS9PpKUUtS6OuSSPrPuxVD9A/0/F5YZo -e1OT+zWCNahQLpRSoNuDPnXaFXCsCc/ugkmtNkm5tHGLtAChQgbKCApjl7YI/O60 -3Jh4GYLJ+H9kPqrJ/rGN67Bk9bzzxD46kOpOjj8bGbxqg8ORPGxV+wpSwOjhXXeF -M8VJ3+xqv79sN/6OSaIVGM6LjmseOKMwb4iBfnJWRBrEejkP9sSPltSy6wBOXN67 -5zu35iQFk2tN5pFEv+6YG8eFGxFBeyI2p74+6Ho33BjekJ2PzbLXmj/iF39bDOHv -P2Y9biTksM7DDIhslNo4JXxSOeNzFLMARWOaDEJAXgTG93JkzsluM7Pk020klTeT -fvIAXRmLH/NDc6ifRdIGqey0Qrv67gzHTz9RH9Gv0KwYf4eBIv6p3QeWbXz4TtlN -OlBp1UF+xdp02I5z5X6D4cMZgbe9v0COvi6aogyqTgIuuyrhCF0xA8msJ7Cv3NXI -FH1AnVWJIfmQzNTJYEFzq+jN2DpVOQqCmf6b9fU8HJHLwPpGVK4h/CqsXHveepdx -/WxrzUiapNuBfBg3L5B9YZS9F8lctlQWd8oJSqrpvE+UdQFaVryS0o+515feVnQB -9xZxSbH1GEaZQe5i4bMsZXVpKXJDA/ibH/o49J7sQBCOrJfVsDO+nxjcLfdBeFRK -YkTnAgMBAAGjggH9MIIB+TAOBgNVHQ8BAf8EBAMCAQYwGAYIKwYBBQUHAQMEDDAK -MAgGBgQAjkYBATAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTMw/Vm/3OsOFqW -GyGJuIFMH8teJTAQBgkrBgEEAYI3FQEEAwIBADCCAYkGA1UdIASCAYAwggF8MIIB -eAYLKwYBBAGBxFkBAQIwggFnMIIBOAYIKwYBBQUHAgIwggEqHoIBJgBTAGkAcwAg -AGkAcgAgAHMAZQByAHQAaQBmAGkAawBhAHQAcwAsACAAawBvACAAaQB6AGQAZQB2 -AGkAcwAgAFYAQQBTACAATABhAHQAdgBpAGoAYQBzACAAUABhAHMAdABzACwAIABu -AG8AZAByAG8AcwBpAG4AbwB0ACAAYQB0AGIAaQBsAHMAdABpAGIAdQAgAEUAbABl -AGsAdAByAG8AbgBpAHMAawBvACAAZABvAGsAdQBtAGUAbgB0AHUAIABsAGkAawB1 -AG0AYQBtACAAdQBuACAARQBpAHIAbwBwAGEAcwAgAFAAYQByAGwAYQBtAGUAbgB0 -AGEAIABkAGkAcgBlAGsAdABpAHYAYQBpACAAMQA5ADkAOQAvADkAMwAvAEUASzAp -BggrBgEFBQcCARYdaHR0cDovL3d3dy5lLW1lLmx2L3JlcG9zaXRvcnkwDQYJKoZI -hvcNAQEFBQADggIBAB8oSjWQIWNoCi94r6MegiaXoz8nGdJLo0J6BhNlW8EEy+t9 -fO+U8vGJ9bffUgIhadLqljTloM+XuJxVDhCFoxReLAX4tTp28/l6uN62DCdp8suU -kQsdudWOb5kvzfIZVjk6SFbwAf+Cdbay/dHU9fJjV0xNoX7MELoEae/0FPyzlx9F -7m9KKH/Rxie8x6Opa3vtghNvq94P+3HrXBEaqSzQMJ/8NjdW75XpurcTtq6fAmGt -nuxrBG82nw+Z98LJyEwouSjUIdeeVNXAzvSO5FWUe48kxjj8q3qkVnc9qEXvZJKk -0Ep+u3OL9A1Sc7g6SF5DgNOpcHdi/8coHHMeQ+YnJFtJueY2pI79xS0veqV5EnrX -IbIlbcgPosNhS+VI4le6n/KKId3bZPDaGd/OwJuAOcJ3d2MVU3KE+qSPBzeGIX1Q -+j1qN9uRDjez/c4Lynth0Jx0nH04aG3pex3W8Sq07ztgUncF5gLCX4xbvPB9t3PH -kWuyKrNjozTVq60lcUf/Gj56to2VdsPups0DCWzuRWeYz5lIdsHOinSaaFIBNCLI -7eIUC4S9bhCMsXKbvugI11fVf+q0AT1O5OLoZ+eMfunnQhHvlUbIkda+JxeAGTSY -58bfHvwhX56GPbx+8Jy9cp70R4JbcWfz+txUTKhc2FnH0AcOEzMnvPRp8Gsh ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBATANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQGEwJTSzET -MBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcgYS5zLjERMA8GA1UE -AxMIQ0EgRGlzaWcwHhcNMDYwMzIyMDEzOTM0WhcNMTYwMzIyMDEzOTM0WjBKMQsw -CQYDVQQGEwJTSzETMBEGA1UEBxMKQnJhdGlzbGF2YTETMBEGA1UEChMKRGlzaWcg -YS5zLjERMA8GA1UEAxMIQ0EgRGlzaWcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQCS9jHBfYj9mQGp2HvycXXxMcbzdWb6UShGhJd4NLxs/LxFWYgmGErE -Nx+hSkS943EE9UQX4j/8SFhvXJ56CbpRNyIjZkMhsDxkovhqFQ4/61HhVKndBpnX -mjxUizkDPw/Fzsbrg3ICqB9x8y34dQjbYkzo+s7552oftms1grrijxaSfQUMbEYD -XcDtab86wYqg6I7ZuUUohwjstMoVvoLdtUSLLa2GDGhibYVW8qwUYzrG0ZmsNHhW -S8+2rT+MitcE5eN4TPWGqvWP+j1scaMtymfraHtuM6kMgiioTGohQBUgDCZbg8Kp -FhXAJIJdKxatymP2dACw30PEEGBWZ2NFAgMBAAGjgf8wgfwwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUjbJJaJ1yCCW5wCf1UJNWSEZx+Y8wDgYDVR0PAQH/BAQD -AgEGMDYGA1UdEQQvMC2BE2Nhb3BlcmF0b3JAZGlzaWcuc2uGFmh0dHA6Ly93d3cu -ZGlzaWcuc2svY2EwZgYDVR0fBF8wXTAtoCugKYYnaHR0cDovL3d3dy5kaXNpZy5z -ay9jYS9jcmwvY2FfZGlzaWcuY3JsMCygKqAohiZodHRwOi8vY2EuZGlzaWcuc2sv -Y2EvY3JsL2NhX2Rpc2lnLmNybDAaBgNVHSAEEzARMA8GDSuBHpGT5goAAAABAQEw -DQYJKoZIhvcNAQEFBQADggEBAF00dGFMrzvY/59tWDYcPQuBDRIrRhCA/ec8J9B6 -yKm2fnQwM6M6int0wHl5QpNt/7EpFIKrIYwvF/k/Ji/1WcbvgAa3mkkp7M5+cTxq -EEHA9tOasnxakZzArFvITV734VP/Q3f8nktnbNfzg9Gg4H8l37iYC5oyOGwwoPP/ -CBUz91BKez6jPiCp3C9WgArtQVCwyfTssuMmRAAOb54GvCKWU3BlxFAKRmukLyeB -EicTXxChds6KezfqwzlhA5WYOudsiCUI/HloDYd9Yvi0X/vF2Ey9WLw/Q1vUHgFN -PGO+I++MzVpQuGhU+QqZMxEA4Z7CRneC9VkGjCFMhwnN5ag= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDXTCCAkWgAwIBAgIDAOJCMA0GCSqGSIb3DQEBBQUAMFUxCzAJBgNVBAYTAkFU -MRAwDgYDVQQKEwdBLVRydXN0MRkwFwYDVQQLExBBLVRydXN0LW5RdWFsLTAxMRkw -FwYDVQQDExBBLVRydXN0LW5RdWFsLTAxMB4XDTA0MTEzMDIzMDAwMFoXDTE0MTEz -MDIzMDAwMFowVTELMAkGA1UEBhMCQVQxEDAOBgNVBAoTB0EtVHJ1c3QxGTAXBgNV -BAsTEEEtVHJ1c3QtblF1YWwtMDExGTAXBgNVBAMTEEEtVHJ1c3QtblF1YWwtMDEw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD/9RyAEZ6eHmhYzNJ328f0 -jmdSUFi6EqRqOxb3jHNPTIpK82CR6z5lmSnZQNUuCPD+htbNZffd2DKVB06NOyZ1 -2zcOMCgj4GtkZoqE0zPpPT3bpoE55nkZZe/qWEX/64wz/L/4EdkvKDSKG/UsP75M -tmCVY5m2Eg73RVFRz4ccBIMpHel4lzEqSkdDtZOY5fnkrE333hx67nxq21vY8Eyf -8O4fPQ5RtN8eohQCcPQ1z6ypU1R7N9jPRpnI+yzMOiwd3+QcKhHi1miCzo0pkOaB -1CwmfsTyNl8qU0NJUL9Ta6cea7WThwTiWol2yD88cd2cy388xpbNkfrCPmZNGLoV -AgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECE5ZzscCMocwMA4G -A1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEA69I9R1hU9Gbl9vV7W7AH -QpUJAlFAvv2It/eY8p2ouQUPVaSZikaKtAYrCD/arzfXB43Qet+dM6CpHsn8ikYR -vQKePjXv3Evf+C1bxwJAimcnZV6W+bNOTpdo8lXljxkmfN+Z5S+XzvK2ttUtP4Et -YOVaxHw2mPMNbvDeY+foJkiBn3KYjGabMaR8moZqof5ofj4iS/WyamTZti6v/fKx -n1vII+/uWkcxV5DT5+r9HLon0NYF0Vg317Wh+gWDV59VZo+dcwJDb+keYqMFYoqp -77SGkZGu41S8NGYkQY3X9rNHRkDbLfpKYDmy6NanpOE1EHW1/sNSFAs43qZZKJEQ -xg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEojCCA4qgAwIBAgIQRL4Mi1AAJLQR0zYlJWfJiTANBgkqhkiG9w0BAQUFADCB -rjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xNjA0BgNVBAMTLVVUTi1VU0VSRmlyc3Qt -Q2xpZW50IEF1dGhlbnRpY2F0aW9uIGFuZCBFbWFpbDAeFw05OTA3MDkxNzI4NTBa -Fw0xOTA3MDkxNzM2NThaMIGuMQswCQYDVQQGEwJVUzELMAkGA1UECBMCVVQxFzAV -BgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5l -dHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cudXNlcnRydXN0LmNvbTE2MDQGA1UE -AxMtVVROLVVTRVJGaXJzdC1DbGllbnQgQXV0aGVudGljYXRpb24gYW5kIEVtYWls -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsjmFpPJ9q0E7YkY3rs3B -YHW8OWX5ShpHornMSMxqmNVNNRm5pELlzkniii8efNIxB8dOtINknS4p1aJkxIW9 -hVE1eaROaJB7HHqkkqgX8pgV8pPMyaQylbsMTzC9mKALi+VuG6JG+ni8om+rWV6l -L8/K2m2qL+usobNqqrcuZzWLeeEeaYji5kbNoKXqvgvOdjp6Dpvq/NonWz1zHyLm -SGHGTPNpsaguG7bUMSAsvIKKjqQOpdeJQ/wWWq8dcdcRWdq6hw2v+vPhwvCkxWeM -1tZUOt4KpLoDd7NlyP0e03RiqhjKaJMeoYV+9Udly/hNVyh00jT/MLbu9mIwFIws -6wIDAQABo4G5MIG2MAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud -DgQWBBSJgmd9xJ0mcABLtFBIfN49rgRufTBYBgNVHR8EUTBPME2gS6BJhkdodHRw -Oi8vY3JsLnVzZXJ0cnVzdC5jb20vVVROLVVTRVJGaXJzdC1DbGllbnRBdXRoZW50 -aWNhdGlvbmFuZEVtYWlsLmNybDAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUH -AwQwDQYJKoZIhvcNAQEFBQADggEBALFtYV2mGn98q0rkMPxTbyUkxsrt4jFcKw7u -7mFVbwQ+zznexRtJlOTrIEy05p5QLnLZjfWqo7NK2lYcYJeA3IKirUq9iiv/Cwm0 -xtcgBEXkzYABurorbs6q15L+5K/r9CYdFip/bDCVNy8zEqx/3cfREYxRmLLQo5HQ -rfafnoOTHh1CuEava2bwm3/q4wMC5QJRwarVNZ1yQAOJujEdxRBoUp7fooXFXAim -eOZTT7Hot9MUnpOmw2TjrH5xzbyf6QMbzPvprDHBr3wVdAKZw7JHpsIyYdfHb0gk -USeh1YdV8nuPmD0Wnu51tvjQjvLzxq4oW6fw8zYX/MMF08oDSlQ= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVz -dCBQcmVtaXVtMB4XDTEwMDEyOTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkG -A1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1U -cnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxBLf -qV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtnBKAQ -JG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ -+jjeRFcV5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrS -s8PhaJyJ+HoAVt70VZVs+7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5 -HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmdGPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d7 -70O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5Rp9EixAqnOEhss/n/fauG -V+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NIS+LI+H+S -qHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S -5u046uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4Ia -C1nEWTJ3s7xgaVY5/bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TX -OwF0lkLgAOIua+rF7nKsu7/+6qqo+Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYE -FJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByvMiPIs0laUZx2 -KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg -Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B -8OWycvpEgjNC6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQ -MKSOyARiqcTtNd56l+0OOF6SL5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc -0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK+4w1IX2COPKpVJEZNZOUbWo6xbLQ -u4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmVBtWVyuEklut89pMF -u+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFgIxpH -YoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8 -GKa1qF60g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaO -RtGdFNrHF+QFlozEJLUbzxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6e -KeC2uAloGRwYQw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSAwHgYDVQQDExdBZGRUcnVzdCBQdWJsaWMgQ0EgUm9vdDAeFw0wMDA1MzAx -MDQxNTBaFw0yMDA1MzAxMDQxNTBaMGQxCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtB -ZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIDAeBgNV -BAMTF0FkZFRydXN0IFB1YmxpYyBDQSBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEA6Rowj4OIFMEg2Dybjxt+A3S72mnTRqX4jsIMEZBRpS9mVEBV -6tsfSlbunyNu9DnLoblv8n75XYcmYZ4c+OLspoH4IcUkzBEMP9smcnrHAZcHF/nX -GCwwfQ56HmIexkvA/X1id9NEHif2P0tEs7c42TkfYNVRknMDtABp4/MUTu7R3AnP -dzRGULD4EfL+OHn3Bzn+UZKXC1sIXzSGAa2Il+tmzV7R/9x98oTaunet3IAIx6eH -1lWfl2royBFkuucZKT8Rs3iQhCBSWxHveNCD9tVIkNAwHM+A+WD+eeSI8t0A65RF -62WUaUC6wNW0uLp9BBGo6zEFlpROWCGOn9Bg/QIDAQABo4HRMIHOMB0GA1UdDgQW -BBSBPjfYkrAfd59ctKtzquf2NGAv+jALBgNVHQ8EBAMCAQYwDwYDVR0TAQH/BAUw -AwEB/zCBjgYDVR0jBIGGMIGDgBSBPjfYkrAfd59ctKtzquf2NGAv+qFopGYwZDEL -MAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQLExRBZGRU -cnVzdCBUVFAgTmV0d29yazEgMB4GA1UEAxMXQWRkVHJ1c3QgUHVibGljIENBIFJv -b3SCAQEwDQYJKoZIhvcNAQEFBQADggEBAAP3FUr4JNojVhaTdt02KLmuG7jD8WS6 -IBh4lSknVwW8fCr0uVFV2ocC3g8WFzH4qnkuCRO7r7IgGRLlk/lL+YPoRNWyQSW/ -iHVv/xD8SlTQX/D67zZzfRs2RcYhbbQVuE7PnFylPVoAjgbjPGsye/Kf8Lb93/Ao -GEjwxrzQvzSAlsJKsW2Ox5BF3i9nrEUEo3rcVZLJR2bYGozH7ZxOmuASu7VqTITh -4SINhwBk/ox9Yjllpu9CtoAlEmEBqCQTcAARJl/6NVDFSMwGR+gn2HCNX2TmoUQm -XiLsks3/QppEIW1cxeMiHV9HEufOX1362KqxMy3ZdvJOOjMMK7MtkAY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEajCCA1KgAwIBAgIBATANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJKUDEN -MAsGA1UECgwESlBLSTEpMCcGA1UECwwgUHJlZmVjdHVyYWwgQXNzb2NpYXRpb24g -Rm9yIEpQS0kxETAPBgNVBAsMCEJyaWRnZUNBMB4XDTAzMTIyNzA1MDgxNVoXDTEz -MTIyNjE0NTk1OVowWjELMAkGA1UEBhMCSlAxDTALBgNVBAoMBEpQS0kxKTAnBgNV -BAsMIFByZWZlY3R1cmFsIEFzc29jaWF0aW9uIEZvciBKUEtJMREwDwYDVQQLDAhC -cmlkZ2VDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANTnUmg7K3m8 -52vd77kwkq156euwoWm5no8E8kmaTSc7x2RABPpqNTlMKdZ6ttsyYrqREeDkcvPL -yF7yf/I8+innasNtsytcTAy8xY8Avsbd4JkCGW9dyPjk9pzzc3yLQ64Rx2fujRn2 -agcEVdPCr/XpJygX8FD5bbhkZ0CVoiASBmlHOcC3YpFlfbT1QcpOSOb7o+VdKVEi -MMfbBuU2IlYIaSr/R1nO7RPNtkqkFWJ1/nKjKHyzZje7j70qSxb+BTGcNgTHa1YA -UrogKB+UpBftmb4ds+XlkEJ1dvwokiSbCDaWFKD+YD4B2s0bvjCbw8xuZFYGhNyR -/2D5XfN1s2MCAwEAAaOCATkwggE1MA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MG0GA1UdHwRmMGQwYqBgoF6kXDBaMQswCQYDVQQGEwJKUDENMAsGA1UE -CgwESlBLSTEpMCcGA1UECwwgUHJlZmVjdHVyYWwgQXNzb2NpYXRpb24gRm9yIEpQ -S0kxETAPBgNVBAsMCEJyaWRnZUNBMIGDBgNVHREEfDB6pHgwdjELMAkGA1UEBhMC -SlAxJzAlBgNVBAoMHuWFrOeahOWAi+S6uuiqjeiovOOCteODvOODk+OCuTEeMBwG -A1UECwwV6YO96YGT5bqc55yM5Y2U6K2w5LyaMR4wHAYDVQQLDBXjg5bjg6rjg4Pj -grjoqo3oqLzlsYAwHQYDVR0OBBYEFNQXMiCqQNkR2OaZmQgLtf8mR8p8MA0GCSqG -SIb3DQEBBQUAA4IBAQATjJo4reTNPC5CsvAKu1RYT8PyXFVYHbKsEpGt4GR8pDCg -HEGAiAhHSNrGh9CagZMXADvlG0gmMOnXowriQQixrtpkmx0TB8tNAlZptZWkZC+R -8TnjOkHrk2nFAEC3ezbdK0R7MR4tJLDQCnhEWbg50rf0wZ/aF8uAaVeEtHXa6W0M -Xq3dSe0XAcrLbX4zZHQTaWvdpLAIjl6DZ3SCieRMyoWUL+LXaLFdTP5WBCd+No58 -IounD9X4xxze2aeRVaiV/WnQ0OSPNS7n7YXy6xQdnaOU4KRW/Lne1EDf5IfWC/ih -bVAmhZMbcrkWWcsR6aCPG+2mV3zTD6AUzuKPal8Y ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw -MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT -aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ -jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp -xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp -1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG -snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ -U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 -9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B -AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz -yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE -38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP -AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad -DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME -HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILAgAAAAAA1ni3lAUwDQYJKoZIhvcNAQEEBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw -MDBaFw0xNDAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT -aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ -jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp -xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp -1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG -snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ -U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 -9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIABjAdBgNVHQ4EFgQU -YHtmGkUNl8qJUC99BM00qP/8/UswDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B -AQQFAAOCAQEArqqf/LfSyx9fOSkoGJ40yWxPbxrwZKJwSk8ThptgKJ7ogUmYfQq7 -5bCdPTbbjwVR/wkxKh/diXeeDy5slQTthsu0AD+EAk2AaioteAuubyuig0SDH81Q -gkwkr733pbTIWg/050deSY43lv6aiAU62cDbKYfmGZZHpzqmjIs8d/5GY6dT2iHR -rH5Jokvmw2dZL7OKDrssvamqQnw1wdh/1acxOk5jQzmvCLBhNIzTmKlDNPYPhyk7 -ncJWWJh3w/cbrPad+D6qp1RF8PX51TFl/mtYnHGzHtdS6jIX/EBgHcl5JLL2bP2o -Zg6C3ZjL2sJETy6ge/L3ayx2EYRGinij4w== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEKzCCAxOgAwIBAgIEOsylTDANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJE -SzEVMBMGA1UEChMMVERDIEludGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQg -Um9vdCBDQTAeFw0wMTA0MDUxNjMzMTdaFw0yMTA0MDUxNzAzMTdaMEMxCzAJBgNV -BAYTAkRLMRUwEwYDVQQKEwxUREMgSW50ZXJuZXQxHTAbBgNVBAsTFFREQyBJbnRl -cm5ldCBSb290IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxLhA -vJHVYx/XmaCLDEAedLdInUaMArLgJF/wGROnN4NrXceO+YQwzho7+vvOi20jxsNu -Zp+Jpd/gQlBn+h9sHvTQBda/ytZO5GhgbEaqHF1j4QeGDmUApy6mcca8uYGoOn0a -0vnRrEvLznWv3Hv6gXPU/Lq9QYjUdLP5Xjg6PEOo0pVOd20TDJ2PeAG3WiAfAzc1 -4izbSysseLlJ28TQx5yc5IogCSEWVmb/Bexb4/DPqyQkXsN/cHoSxNK1EKC2IeGN -eGlVRGn1ypYcNIUXJXfi9i8nmHj9eQY6otZaQ8H/7AQ77hPv01ha/5Lr7K7a8jcD -R0G2l8ktCkEiu7vmpwIDAQABo4IBJTCCASEwEQYJYIZIAYb4QgEBBAQDAgAHMGUG -A1UdHwReMFwwWqBYoFakVDBSMQswCQYDVQQGEwJESzEVMBMGA1UEChMMVERDIElu -dGVybmV0MR0wGwYDVQQLExRUREMgSW50ZXJuZXQgUm9vdCBDQTENMAsGA1UEAxME -Q1JMMTArBgNVHRAEJDAigA8yMDAxMDQwNTE2MzMxN1qBDzIwMjEwNDA1MTcwMzE3 -WjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUbGQBx/2FbazI2p5QCIUItTxWqFAw -HQYDVR0OBBYEFGxkAcf9hW2syNqeUAiFCLU8VqhQMAwGA1UdEwQFMAMBAf8wHQYJ -KoZIhvZ9B0EABBAwDhsIVjUuMDo0LjADAgSQMA0GCSqGSIb3DQEBBQUAA4IBAQBO -Q8zR3R0QGwZ/t6T609lN+yOfI1Rb5osvBCiLtSdtiaHsmGnc540mgwV5dOy0uaOX -wTUA/RXaOYE6lTGQ3pfphqiZdwzlWqCE/xIWrG64jcN7ksKsLtB9KOy282A4aW8+ -2ARVPp7MVdK6/rtHBNcK2RYKNCn1WBPVT8+PVkuzHu7TmHnaCB4Mb7j4Fifvwm89 -9qNLPg7kbWzbO0ESm70NRyN/PErQr8Cv9u8btRXE64PECV90i9kR+8JWsTz4cMo0 -jUNAE4z9mQNUecYu6oah9jrUCbz0vGbMPVjQV0kK7iXiQe4T+Zs4NNEA9X7nlB38 -aQNiuJkFBT1reBK9sG9l ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprlOQcJ -FspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61F -uOJAf/sKbvu+M8k8o4TVMAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGX -kPoUVy0D7O48027KqGx2vKLeuwIgJ6iFJzWbVsaj8kfSt24bAgAXqmemFZHe+pTs -ewv4n4Q= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAzMTkxODMzMzNaFw0yMTAzMTcxODMz -MzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUw -IwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQDEyVR -dW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Yp -li4kVEAkOPcahdxYTMukJ0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2D -rOpm2RgbaIr1VxqYuvXtdj182d6UajtLF8HVj71lODqV0D1VNk7feVcxKh7YWWVJ -WCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeLYzcS19Dsw3sgQUSj7cug -F+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWenAScOospU -xbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCC -Ak4wPQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVv -dmFkaXNvZmZzaG9yZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREw -ggENMIIBCQYJKwYBBAG+WAABMIH7MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNl -IG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBh -c3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJsZSBzdGFuZGFy -ZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh -Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYI -KwYBBQUHAgEWFmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3T -KbkGGew5Oanwl4Rqy+/fMIGuBgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rq -y+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1p -dGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYD -VQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6tlCL -MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSk -fnIYj9lofFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf8 -7C9TqnN7Az10buYWnuulLsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1R -cHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2xgI4JVrmcGmD+XcHXetwReNDWXcG31a0y -mQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi5upZIof4l/UO/erMkqQW -xFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi5nrQNiOK -SnQ2+Q== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgxMDAxMTA0MDE0WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUd -AqSzm1nzHoqvNK38DcLZSBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiC -FoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/FvudocP05l03Sx5iRUKrERLMjfTlH6VJi -1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx9702cu+fjOlbpSD8DT6Iavq -jnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGVWOHAD3bZ -wI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/ -WSA2AHmgoCJrjNXyYdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhy -NsZt+U2e+iKo4YFWz827n+qrkRk4r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPAC -uvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNfvNoBYimipidx5joifsFvHZVw -IEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR3p1m0IvVVGb6 -g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN -9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP -BSeOE6Fuwg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAw -NzEUMBIGA1UECgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJv -b3QgQ0EgdjEwHhcNMDcxMDE4MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYD -VQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwWVGVsaWFTb25lcmEgUm9vdCBDQSB2 -MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+6yfwIaPzaSZVfp3F -VRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA3GV1 -7CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+X -Z75Ljo1kB1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+ -/jXh7VB7qTCNGdMJjmhnXb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs -81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxHoLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkm -dtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3F0fUTPHSiXk+TT2YqGHe -Oh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJoWjiUIMu -sDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4 -pgd7gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fs -slESl1MpWtTwEhDcTwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQ -arMCpgKIv7NHfirZ1fpoeDVNAgMBAAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYD -VR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qWDNXr+nuqF+gTEjANBgkqhkiG -9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNmzqjMDfz1mgbl -dxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx -0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1Tj -TQpgcmLNkQfWpb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBed -Y2gea+zDTYa4EzAvXUYNR0PVG6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7 -Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpcc41teyWRyu5FrgZLAMzTsVlQ2jqI -OylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOTJsjrDNYmiLbAJM+7 -vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2qReW -t88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcn -HL/EVlP6Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVx -SK236thZiNSQvxaz2emsWWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB -qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf -Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw -MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV -BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw -NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j -LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG -A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl -IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs -W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta -3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk -6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 -Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J -NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP -r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU -DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz -YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX -xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 -/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ -LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 -jVaMaA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDhDCCAmygAwIBAgIBCTANBgkqhkiG9w0BAQUFADAzMQswCQYDVQQGEwJDTjER -MA8GA1UEChMIVW5pVHJ1c3QxETAPBgNVBAMTCFVDQSBSb290MB4XDTA0MDEwMTAw -MDAwMFoXDTI5MTIzMTAwMDAwMFowMzELMAkGA1UEBhMCQ04xETAPBgNVBAoTCFVu -aVRydXN0MREwDwYDVQQDEwhVQ0EgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBALNdB8qGJn1r4vs4CQ7MgsJqGgCiFV/W6dQBt1YDAVmP9ThpJHbC -XivF9iu/r/tB/Q9a/KvXg3BNMJjRnrJ2u5LWu+kQKGkoNkTo8SzXWHwk1n8COvCB -a2FgP/Qz3m3l6ihST/ypHWN8C7rqrsRoRuTej8GnsrZYWm0dLNmMOreIy4XU9+gD -Xv2yTVDo1h//rgI/i0+WITyb1yXJHT/7mLFZ5PCpO6+zzYUs4mBGzG+OoOvwNMXx -QhhgrhLtRnUc5dipllq+3lrWeGeWW5N3UPJuG96WUUqm1ktDdSFmjXfsAoR2XEQQ -th1hbOSjIH23jboPkXXHjd+8AmCoKai9PUMCAwEAAaOBojCBnzALBgNVHQ8EBAMC -AQYwDAYDVR0TBAUwAwEB/zBjBgNVHSUEXDBaBggrBgEFBQcDAQYIKwYBBQUHAwIG -CCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEFBQcD -BwYIKwYBBQUHAwgGCCsGAQUFBwMJMB0GA1UdDgQWBBTbHzXza0z/QjFkm827Wh4d -SBC37jANBgkqhkiG9w0BAQUFAAOCAQEAOGy3iPGt+lg3dNHocN6cJ1nL5BXXoMNg -14iABMUwTD3UGusGXllH5rxmy+AI/Og17GJ9ysDawXiv5UZv+4mCI4/211NmVaDe -JRI7cTYWVRJ2+z34VFsxugAG+H1V5ad2g6pcSpemKijfvcZsCyOVjjN/Hl5AHxNU -LJzltQ7dFyiuawHTUin1Ih+QOfTcYmjwPIZH7LgFRbu3DJaUxmfLI3HQjnQi1kHr -A6i26r7EARK1s11AdgYg1GS4KUYGis4fk5oQ7vuqWrTcL9Ury/bXBYSYBZELhPc9 -+tb5evosFeo2gkO3t7jj83EB7UNDogVFwygFBzXjAaU4HoDU18PZ3g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCB -ijELMAkGA1UEBhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHly -aWdodCAoYykgMjAwNTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl -ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQSBDQTAeFw0w -NTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYDVQQGEwJDSDEQMA4G -A1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIwIAYD -VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBX -SVNlS2V5IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAy0+zAJs9Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxR -VVuuk+g3/ytr6dTqvirdqFEr12bDYVxgAsj1znJ7O7jyTmUIms2kahnBAbtzptf2 -w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbDd50kc3vkDIzh2TbhmYsF -mQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ/yxViJGg -4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t9 -4B3RLoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQw -EAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOx -SPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vImMMkQyh2I+3QZH4VFvbBsUfk2 -ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4+vg1YFkCExh8 -vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa -hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZi -Fj4A4xylNoEYokxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ -/L7fCg0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDlDCCAnygAwIBAgIQWAsFbFMk27JQVxhf+eWmUDANBgkqhkiG9w0BAQUFADAn -MQswCQYDVQQGEwJCRTEYMBYGA1UEAxMPQmVsZ2l1bSBSb290IENBMB4XDTAzMDEy -NjIzMDAwMFoXDTE0MDEyNjIzMDAwMFowJzELMAkGA1UEBhMCQkUxGDAWBgNVBAMT -D0JlbGdpdW0gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AMihcekcRkJ5eHFvna6pqKsot03HIOswkVp19eLSz8hMFJhCWK3HEcVAQGpa+XQS -J4fpnOVxTiIs0RIYqjBeoiG52bv/9nTrMQHnO35YD5EWTXaJqAFPrSJmcPpLHZXB -MFjqvNll2Jq0iOtJRlLf0lMVdssUXRlJsW9q09P9vMIt7EU/CT9YvvzU7wCMgTVy -v/cY6pZifSsofxVsY9LKyn0FrMhtB20yvmi4BUCuVJhWPmbxMOjvxKuTXgfeMo8S -dKpbNCNUwOpszv42kqgJF+qhLc9s44Qd3ocuMws8dOIhUDiVLlzg5cYx+dtA+mqh -pIqTm6chBocdJ9PEoclMsG8CAwEAAaOBuzCBuDAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zBCBgNVHSAEOzA5MDcGBWA4AQEBMC4wLAYIKwYBBQUHAgEW -IGh0dHA6Ly9yZXBvc2l0b3J5LmVpZC5iZWxnaXVtLmJlMB0GA1UdDgQWBBQQ8AxW -m2HqVzq2NZdtn925FI7b5jARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAU -EPAMVpth6lc6tjWXbZ/duRSO2+YwDQYJKoZIhvcNAQEFBQADggEBAMhtIlGKYfgP -lm7VILKB+MbcoxYA2s1q52sq+llIp0xJN9dzoWoBZV4yveeX09AuPHPTjHuD79ZC -wT+oqV0PN7p20kC9zC0/00RBSZz9Wyn0AiMiW3Ebv1jZKE4tRfTa57VjRUQRDSp/ -M382SbTObqkCMa5c/ciJv0J71/Fg8teH9lcuen5qE4Ad3OPQYx49cTGxYNSeCMqr -8JTHSHVUgfMbrXec6LKP24OsjzRr6L/D2fVDw2RV6xq9NoY2uiGMlxoh1OotO6y6 -7Kcdq765Sps1LxxcHVGnH1TtEpf/8m6HfUbJdNbv6z195lluBpQE5KJVhzgoaiJe -4r50ErAEQyo= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UE -BhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVz -dCBDb21tZXJjaWFsMB4XDTEwMDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDEL -MAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZp -cm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6EqdbDuKP -Hx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yr -ba0F8PrVC8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPAL -MeIrJmqbTFeurCA+ukV6BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1 -yHp52UKqK39c/s4mT6NmgTWvRLpUHhwwMmWd5jyTXlBOeuM61G7MGvv50jeuJCqr -VwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNVHQ4EFgQUnZPGU4teyq8/ -nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwDQYJ -KoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYG -XUPGhi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNj -vbz4YYCanrHOQnDiqX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivt -Z8SOyUOyXGsViQK8YvxO8rUzqrJv0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9g -N53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0khsUlHRUe072o0EclNmsxZt9YC -nlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgRVYgMjAwOTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUw -NDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxKjAoBgNV -BAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAwOTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfSegpn -ljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM0 -3TP1YtHhzRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6Z -qQTMFexgaDbtCHu39b+T7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lR -p75mpoo6Kr3HGrHhFPC+Oh25z1uxav60sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8 -HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure3511H3a6UCAwEAAaOCASQw -ggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyvcop9Ntea -HNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFw -Oi8vZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xh -c3MlMjAzJTIwQ0ElMjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1E -RT9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0MEagRKBChkBodHRwOi8vd3d3LmQt -dHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xhc3NfM19jYV8yX2V2XzIwMDku -Y3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+PPoeUSbrh/Yp -3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05 -nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNF -CSuGdXzfX2lXANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7na -xpeG0ILD5EJt/rDiZE4OJudANCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqX -KVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVvw9y4AyHqnxbxLFS1 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQHp4o6Ejy5e/DfEoeWhhntjANBgkqhkiG9w0BAQsFADBk -MQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0 -YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3Qg -Q0EgMjAeFw0xMTA2MjQwODM4MTRaFw0zMTA2MjUwNzM4MTRaMGQxCzAJBgNVBAYT -AmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZp -Y2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAyMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAlUJOhJ1R5tMJ6HJaI2nbeHCOFvEr -jw0DzpPMLgAIe6szjPTpQOYXTKueuEcUMncy3SgM3hhLX3af+Dk7/E6J2HzFZ++r -0rk0X2s682Q2zsKwzxNoysjL67XiPS4h3+os1OD5cJZM/2pYmLcX5BtS5X4HAB1f -2uY+lQS3aYg5oUFgJWFLlTloYhyxCwWJwDaCFCE/rtuh/bxvHGCGtlOUSbkrRsVP -ACu/obvLP+DHVxxX6NZp+MEkUp2IVd3Chy50I9AU/SpHWrumnf2U5NGKpV+GY3aF -y6//SSj8gO1MedK75MDvAe5QQQg1I3ArqRa0jG6F6bYRzzHdUyYb3y1aSgJA/MTA -tukxGggo5WDDH8SQjhBiYEQN7Aq+VRhxLKX0srwVYv8c474d2h5Xszx+zYIdkeNL -6yxSNLCK/RJOlrDrcH+eOfdmQrGrrFLadkBXeyq96G4DsguAhYidDMfCd7Camlf0 -uPoTXGiTOmekl9AbmbeGMktg2M7v0Ax/lZ9vh0+Hio5fCHyqW/xavqGRn1V9TrAL -acywlKinh/LTSlDcX3KwFnUey7QYYpqwpzmqm59m2I2mbJYV4+by+PGDYmy7Velh -k6M99bFXi08jsJvllGov34zflVEpYKELKeRcVVi3qPyZ7iVNTA6z00yPhOgpD/0Q -VAKFyPnlw4vP5w8CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0hBBYw -FDASBgdghXQBUwIBBgdghXQBUwIBMBIGA1UdEwEB/wQIMAYBAf8CAQcwHQYDVR0O -BBYEFE0mICKJS9PVpAqhb97iEoHF8TwuMB8GA1UdIwQYMBaAFE0mICKJS9PVpAqh -b97iEoHF8TwuMA0GCSqGSIb3DQEBCwUAA4ICAQAyCrKkG8t9voJXiblqf/P0wS4R -fbgZPnm3qKhyN2abGu2sEzsOv2LwnN+ee6FTSA5BesogpxcbtnjsQJHzQq0Qw1zv -/2BZf82Fo4s9SBwlAjxnffUy6S8w5X2lejjQ82YqZh6NM4OKb3xuqFp1mrjX2lhI -REeoTPpMSQpKwhI3qEAMw8jh0FcNlzKVxzqfl9NX+Ave5XLzo9v/tdhZsnPdTSpx -srpJ9csc1fV5yJmz/MFMdOO0vSk3FQQoHt5FRnDsr7p4DooqzgB53MBfGWcsa0vv -aGgLQ+OswWIJ76bdZWGgr4RVSJFSHMYlkSrQwSIjYVmvRRGFHQEkNI/Ps/8XciAT -woCqISxxOQ7Qj1zB09GOInJGTB2Wrk9xseEFKZZZ9LuedT3PDTcNYtsmjGOpI99n -Bjx8Oto0QuFmtEYE3saWmA9LSHokMnWRn6z3aOkquVVlzl1h0ydw2Df+n7mvoC5W -t6NlUe07qxS/TFED6F+KBZvuim6c779o+sjaC+NCydAXFJy3SuCvkychVSa1ZC+N -8f+mQAWFBVzKBxlcCxMoTFh/wqXvRdpg065lYZ1Tg3TCrvJcwhbtkj6EPnNgiLx2 -9CzP0H1907he0ZESEOnN3col49XtmS++dYFLJPlFRpTJKSFTnCZFqhMX5OfNeOI5 -wSsSnqaeG8XmDtkx2Q== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEZjCCA06gAwIBAgIQRL4Mi1AAJLQR0zYt4LNfGzANBgkqhkiG9w0BAQUFADCB -lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHTAbBgNVBAMTFFVUTi1VU0VSRmlyc3Qt -T2JqZWN0MB4XDTk5MDcwOTE4MzEyMFoXDTE5MDcwOTE4NDAzNlowgZUxCzAJBgNV -BAYTAlVTMQswCQYDVQQIEwJVVDEXMBUGA1UEBxMOU2FsdCBMYWtlIENpdHkxHjAc -BgNVBAoTFVRoZSBVU0VSVFJVU1QgTmV0d29yazEhMB8GA1UECxMYaHR0cDovL3d3 -dy51c2VydHJ1c3QuY29tMR0wGwYDVQQDExRVVE4tVVNFUkZpcnN0LU9iamVjdDCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAM6qgT+jo2F4qjEAVZURnicP -HxzfOpuCaDDASmEd8S8O+r5596Uj71VRloTN2+O5bj4x2AogZ8f02b+U60cEPgLO -KqJdhwQJ9jCdGIqXsqoc/EHSoTbL+z2RuufZcDX65OeQw5ujm9M89RKZd7G3CeBo -5hy485RjiGpq/gt2yb70IuRnuasaXnfBhQfdDWy/7gbHd2pBnqcP1/vulBe3/IW+ -pKvEHDHd17bR5PDv3xaPslKT16HUiaEHLr/hARJCHhrh2JU022R5KP+6LhHC5ehb -kkj7RwvCbNqtMoNB86XlQXD9ZZBt+vpRxPm9lisZBCzTbafc8H9vg2XiaquHhnUC -AwEAAaOBrzCBrDALBgNVHQ8EBAMCAcYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E -FgQU2u1kdBScFDyr3ZmpvVsoTYs8ydgwQgYDVR0fBDswOTA3oDWgM4YxaHR0cDov -L2NybC51c2VydHJ1c3QuY29tL1VUTi1VU0VSRmlyc3QtT2JqZWN0LmNybDApBgNV -HSUEIjAgBggrBgEFBQcDAwYIKwYBBQUHAwgGCisGAQQBgjcKAwQwDQYJKoZIhvcN -AQEFBQADggEBAAgfUrE3RHjb/c652pWWmKpVZIC1WkDdIaXFwfNfLEzIR1pp6ujw -NTX00CXzyKakh0q9G7FzCL3Uw8q2NbtZhncxzaeAFK4T7/yxSPlrJSUtUbYsbUXB -mMiKVl0+7kNOPmsnjtA6S4ULX9Ptaqd1y9Fahy85dRNacrACgZ++8A+EVCBibGnU -4U3GDZlDAQ0Slox4nb9QorFEqmrPF3rPbw/U+CRVX/A0FklmPlBGyWNxODFiuGK5 -81OtbLUrohKqGU8J2l7nk8aOFAj+8DCAGKCGhU3IfdeLA/5u1fedFqySLKAj5ZyR -Uh+U3xeUc8OzwcFxBSAAeL0TUh2oPs0AH8g= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIIKv++n6Lw6YcwDQYJKoZIhvcNAQEFBQAwKDELMAkGA1UE -BhMCQkUxGTAXBgNVBAMTEEJlbGdpdW0gUm9vdCBDQTIwHhcNMDcxMDA0MTAwMDAw -WhcNMjExMjE1MDgwMDAwWjAoMQswCQYDVQQGEwJCRTEZMBcGA1UEAxMQQmVsZ2l1 -bSBSb290IENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZzQh6S -/3UPi790hqc/7bIYLS2X+an7mEoj39WN4IzGMhwWLQdC1i22bi+n9fzGhYJdld61 -IgDMqFNAn68KNaJ6x+HK92AQZw6nUHMXU5WfIp8MXW+2QbyM69odRr2nlL/zGsvU -+40OHjPIltfsjFPekx40HopQcSZYtF3CiInaYNKJIT/e1wEYNm7hLHADBGXvmAYr -XR5i3FVr/mZkIV/4L+HXmymvb82fqgxG0YjFnaKVn6w/Fa7yYd/vw2uaItgscf1Y -HewApDgglVrH1Tdjuk+bqv5WRi5j2Qsj1Yr6tSPwiRuhFA0m2kHwOI8w7QUmecFL -TqG4flVSOmlGhHUCAwEAAaOBuzCBuDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zBCBgNVHSAEOzA5MDcGBWA4CQEBMC4wLAYIKwYBBQUHAgEWIGh0dHA6 -Ly9yZXBvc2l0b3J5LmVpZC5iZWxnaXVtLmJlMB0GA1UdDgQWBBSFiuv0xbu+DlkD -lN7WgAEV4xCcOTARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAUhYrr9MW7 -vg5ZA5Te1oABFeMQnDkwDQYJKoZIhvcNAQEFBQADggEBAFHYhd27V2/MoGy1oyCc -UwnzSgEMdL8rs5qauhjyC4isHLMzr87lEwEnkoRYmhC598wUkmt0FoqW6FHvv/pK -JaeJtmMrXZRY0c8RcrYeuTlBFk0pvDVTC9rejg7NqZV3JcqUWumyaa7YwBO+mPyW -nIR/VRPmPIfjvCCkpDZoa01gZhz5v6yAlGYuuUGK02XThIAC71AdXkbc98m6tTR8 -KvPG2F9fVJ3bTc0R5/0UAoNmXsimABKgX77OFP67H6dh96tK8QYUn8pJQsKpvO2F -sauBQeYNxUJpU4c5nUwfAA4+Bw11V0SoU7Q2dmSZ3G7rPUZuFF1eR1ONeE3gJ7uO -hXY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJO -TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFh -dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oX -DTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRl -ciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5lZGVybGFuZGVuIFJv -b3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ5291 -qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8Sp -uOUfiUtnvWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPU -Z5uW6M7XxgpT0GtJlvOjCwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvE -pMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiile7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp -5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCROME4HYYEhLoaJXhena/M -UGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpICT0ugpTN -GmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy -5V6548r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv -6q012iDTiIJh8BIitrzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEK -eN5KzlW/HdXZt1bv8Hb/C3m1r737qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6 -B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMBAAGjgZcwgZQwDwYDVR0TAQH/ -BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcCARYxaHR0cDov -L3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV -HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqG -SIb3DQEBCwUAA4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLyS -CZa59sCrI2AGeYwRTlHSeYAz+51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen -5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwjf/ST7ZwaUb7dRUG/kSS0H4zpX897 -IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaNkqbG9AclVMwWVxJK -gnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfkCpYL -+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxL -vJxxcypFURmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkm -bEgeqmiSBeGCc1qb3AdbCG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvk -N1trSt8sV4pAWja63XVECDdCcAz+3F4hoKOKwJCcaNpQ5kUQR3i2TtJlycM33+FC -Y7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoVIPVVYpbtbZNQvOSqeK3Z -ywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm66+KAQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEk -MCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpH -bG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoX -DTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMbR2xvYmFsU2lnbiBFQ0MgUm9vdCBD -QSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQDEwpHbG9iYWxTaWdu -MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6SFkc -8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8ke -hOvRnkmSh5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYI -KoZIzj0EAwMDaAAwZQIxAOVpEslu28YxuglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg -515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7yFz9SO8NdCKoCOJuxUnO -xwy8p2Fp8fc74SrL+SvzZpA3 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYD -VQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0 -IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3 -MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD -aGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMxNDBaFw0zODA3MzEx -MjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy -cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG -A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl -BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZI -hvcNAQEBBQADggIPADCCAgoCggIBAMDfVtPkOpt2RbQT2//BthmLN0EYlVJH6xed -KYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXfXjaOcNFccUMd2drvXNL7 -G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0ZJJ0YPP2 -zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4 -ddPB/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyG -HoiMvvKRhI9lNNgATH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2 -Id3UwD2ln58fQ1DJu7xsepeY7s2MH/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3V -yJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfeOx2YItaswTXbo6Al/3K1dh3e -beksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSFHTynyQbehP9r -6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh -wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsog -zCtLkykPAgMBAAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQW -BBS5CcqcHtvTbDprru1U8VuTBjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDpr -ru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UEBhMCRVUxQzBBBgNVBAcTOk1hZHJp -ZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJmaXJtYS5jb20vYWRk -cmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJmaXJt -YSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiC -CQDJzdPp1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCow -KAYIKwYBBQUHAgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZI -hvcNAQEFBQADggIBAICIf3DekijZBZRG/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZ -UohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6ReAJ3spED8IXDneRRXoz -X1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/sdZ7LoR/x -fxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVz -a2Mg9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yyd -Yhz2rXzdpjEetrHHfoUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMd -SqlapskD7+3056huirRXhOukP9DuqqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9O -AP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETrP3iZ8ntxPjzxmKfFGBI/5rso -M0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVqc5iJWzouE4ge -v8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z -09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF3zCCA8egAwIBAgIOGTMAAQACKBqaBLzyVUUwDQYJKoZIhvcNAQEFBQAwejEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNV -BAsTG1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQTEnMCUGA1UEAxMeVEMgVHJ1 -c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJMB4XDTA2MDMyMjE1NTgzNFoXDTMwMTIz -MTIyNTk1OVowejELMAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVy -IEdtYkgxJDAiBgNVBAsTG1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQTEnMCUG -A1UEAxMeVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJMIICIjANBgkqhkiG -9w0BAQEFAAOCAg8AMIICCgKCAgEAi9R3azRs5TbYalxeOO781R15Azt7g2JEgk6I -7d6D/+7MUGIFBZWZdpj2ufJf2AaRksL2LWYXH/1TA+iojWOpbuHWG4y8mLOLO9Tk -Lsp9hUkmW3m4GotAnn+7yT9jLM/RWny6KCJBElpN+Rd3/IX9wkngKhh/6aAsnPlE -/AxoOUL1JwW+jhV6YJ3wO8c85j4WvK923mq3ouGrRkXrjGV90ZfzlxElq1nroCLZ -gt2Y7X7i+qBhCkoy3iwX921E6oFHWZdXNwM53V6CItQzuPomCba8OYgvURVOm8M7 -3xOCiN1LNPIz1pDp81PcNXzAw9l8eLPNcD+NauCjgUjkKa1juPD8KGQ7mbN9/pqd -iPaZIgiRRxaJNXhdd6HPv0nh/SSUK2k2e+gc5iqQilvVOzRZQtxtz7sPQRxVzfUN -Wy4WIibvYR6X/OJTyM9bo8ep8boOhhLLE8oVx+zkNo3aXBM9ZdIOXXB03L+PemrB -Lg/Txl4PK1lszGFs/sBhTtnmT0ayWuIZFHCE+CAA7QGnl37DvRJckiMXoKUdRRcV -I5qSCLUiiI3cKyTr4LEXaNOvYb3ZhXj2jbp4yjeNY77nrB/fpUcJucglMVRGURFV -DYlcjdrSGC1z8rjVJ/VIIjfRYvd7Dcg4i6FKsPzQ8eu3hmPn4A5zf/1yUbXpfeJV -BWR4Z38CAwEAAaNjMGEwHwYDVR0jBBgwFoAUzdeQoW6jv9sw1toyJZAM5jkegGUw -DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFM3XkKFu -o7/bMNbaMiWQDOY5HoBlMA0GCSqGSIb3DQEBBQUAA4ICAQB+FojoEw42zG4qhQc4 -xlaJeuNHIWZMUAgxWlHQ/KZeFHXeTDvs8e3MfhEHSmHu6rOOOqQzxu2KQmZP8Tx7 -yaUFQZmx7Cxb7tyW0ohTS3g0uW7muw/FeqZ8Dhjfbw90TNGp8aHp2FRkzF6WeKJW -GsFzshXGVwXf2vdIJIqOf2qp+U3pPmrOYCx9LZAI9mOPFdAtnIz/8f38DBZQVhT7 -upeG7rRJA1TuG1l/MDoCgoYhrv7wFfLfToPmmcW6NfcgkIw47XXP4S73BDD7Ua2O -giRAyn0pXdXZ92Vk/KqfdLh9kl3ShCngE+qK99CrxK7vFcXCifJ7tjtJmGHzTnKR -N4xJkunI7Cqg90lufA0kxmts8jgvynAF5X/fxisrgIDV2m/LQLvYG/AkyRDIRAJ+ -LtOYqqIN8SvQ2vqOHP9U6OFKbt2o1ni1N6WsZNUUI8cOpevhCTjXwHxgpV2Yj4wC -1dxWqPNNWKkL1HxkdAEy8t8PSoqpAqKiHYR3wvHMl700GXRd4nQ+dSf3r7/ufA5t -VIimVuImrTESPB5BeW0X6hNeH/Vcn0lZo7Ivo0LD+qh+v6WfSMlgYmIK371F3uNC -tVGW/cT1Gpm4UqJEzS1hjBWPgdVdotSQPYxuQGHDWV3Y2eH2dEcieXR92sqjbzcV -NvAsGnE8EXbfXRo+VGN4a2V+Hw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF2TCCA8GgAwIBAgIQXAuFXAvnWUHfV8w/f52oNjANBgkqhkiG9w0BAQUFADBk -MQswCQYDVQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0 -YWwgQ2VydGlmaWNhdGUgU2VydmljZXMxGzAZBgNVBAMTElN3aXNzY29tIFJvb3Qg -Q0EgMTAeFw0wNTA4MTgxMjA2MjBaFw0yNTA4MTgyMjA2MjBaMGQxCzAJBgNVBAYT -AmNoMREwDwYDVQQKEwhTd2lzc2NvbTElMCMGA1UECxMcRGlnaXRhbCBDZXJ0aWZp -Y2F0ZSBTZXJ2aWNlczEbMBkGA1UEAxMSU3dpc3Njb20gUm9vdCBDQSAxMIICIjAN -BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0LmwqAzZuz8h+BvVM5OAFmUgdbI9 -m2BtRsiMMW8Xw/qabFbtPMWRV8PNq5ZJkCoZSx6jbVfd8StiKHVFXqrWW/oLJdih -FvkcxC7mlSpnzNApbjyFNDhhSbEAn9Y6cV9Nbc5fuankiX9qUvrKm/LcqfmdmUc/ -TilftKaNXXsLmREDA/7n29uj/x2lzZAeAR81sH8A25Bvxn570e56eqeqDFdvpG3F -EzuwpdntMhy0XmeLVNxzh+XTF3xmUHJd1BpYwdnP2IkCb6dJtDZd0KTeByy2dbco -kdaXvij1mB7qWybJvbCXc9qukSbraMH5ORXWZ0sKbU/Lz7DkQnGMU3nn7uHbHaBu -HYwadzVcFh4rUx80i9Fs/PJnB3r1re3WmquhsUvhzDdf/X/NTa64H5xD+SpYVUNF -vJbNcA78yeNmuk6NO4HLFWR7uZToXTNShXEuT46iBhFRyePLoW4xCGQMwtI89Tbo -19AOeCMgkckkKmUpWyL3Ic6DXqTz3kvTaI9GdVyDCW4pa8RwjPWd1yAv/0bSKzjC -L3UcPX7ape8eYIVpQtPM+GP+HkM5haa2Y0EQs3MevNP6yn0WR+Kn1dCjigoIlmJW -bjTb2QK5MHXjBNLnj8KwEUAKrNVxAmKLMb7dxiNYMUJDLXT5xp6mig/p/r+D5kNX -JLrvRjSq1xIBOO0CAwEAAaOBhjCBgzAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0hBBYw -FDASBgdghXQBUwABBgdghXQBUwABMBIGA1UdEwEB/wQIMAYBAf8CAQcwHwYDVR0j -BBgwFoAUAyUv3m+CATpcLNwroWm1Z9SM0/0wHQYDVR0OBBYEFAMlL95vggE6XCzc -K6FptWfUjNP9MA0GCSqGSIb3DQEBBQUAA4ICAQA1EMvspgQNDQ/NwNurqPKIlwzf -ky9NfEBWMXrrpA9gzXrzvsMnjgM+pN0S734edAY8PzHyHHuRMSG08NBsl9Tpl7Ik -Vh5WwzW9iAUPWxAaZOHHgjD5Mq2eUCzneAXQMbFamIp1TpBcahQq4FJHgmDmHtqB -sfsUC1rxn9KVuj7QG9YVHaO+htXbD8BJZLsuUBlL0iT43R4HVtA4oJVwIHaM190e -3p9xxCPvgxNcoyQVTSlAPGrEqdi3pkSlDfTgnXceQHAm/NrZNuR55LU/vJtlvrsR -ls/bxig5OgjOR1tTWsWZ/l2p3e9M1MalrQLmjAcSHm8D0W+go/MpvRLHUKKwf4ip -mXeascClOS5cfGniLLDqN2qk4Vrh9VDlg++luyqI54zb/W1elxmofmZ1a3Hqv7HH -b6D0jqTsNFFbjCYDcKF31QESVwA12yPeDooomf2xEG9L/zgtYE4snOtnta1J7ksf -rK/7DZBaZmBwXarNeNQk7shBoJMBkpxqnvy5JMWzFYJ+vq6VK+uxwNrjAWALXmms -hFZhvnEX/h0TD/7Gh0Xp/jKgGg0TpJRVcaUWi7rKibCyx/yP2FS1k2Kdzs9Z+z0Y -zirLNRWCXf9UIltxUvu3yf5gmwBBZPCqKuy2QkPOiWaByIufOVQDJdMWNY6E0F/6 -MBr1mmz0DlP5OlvRHA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEXjCCA0agAwIBAgIQRL4Mi1AAIbQR0ypoBqmtaTANBgkqhkiG9w0BAQUFADCB -kzELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xGzAZBgNVBAMTElVUTiAtIERBVEFDb3Jw -IFNHQzAeFw05OTA2MjQxODU3MjFaFw0xOTA2MjQxOTA2MzBaMIGTMQswCQYDVQQG -EwJVUzELMAkGA1UECBMCVVQxFzAVBgNVBAcTDlNhbHQgTGFrZSBDaXR5MR4wHAYD -VQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxITAfBgNVBAsTGGh0dHA6Ly93d3cu -dXNlcnRydXN0LmNvbTEbMBkGA1UEAxMSVVROIC0gREFUQUNvcnAgU0dDMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3+5YEKIrblXEjr8uRgnn4AgPLit6 -E5Qbvfa2gI5lBZMAHryv4g+OGQ0SR+ysraP6LnD43m77VkIVni5c7yPeIbkFdicZ -D0/Ww5y0vpQZY/KmEQrrU0icvvIpOxboGqBMpsn0GFlowHDyUwDAXlCCpVZvNvlK -4ESGoE1O1kduSUrLZ9emxAW5jh70/P/N5zbgnAVssjMiFdC04MwXwLLA9P4yPykq -lXvY8qdOD1R8oQ2AswkDwf9c3V6aPryuvEeKaq5xyh+xKrhfQgUL7EYw0XILyulW -bfXv33i+Ybqypa4ETLyorGkVl73v67SMvzX41MPRKA5cOp9wGDMgd8SirwIDAQAB -o4GrMIGoMAsGA1UdDwQEAwIBxjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRT -MtGzz3/64PGgXYVOktKeRR20TzA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vY3Js -LnVzZXJ0cnVzdC5jb20vVVROLURBVEFDb3JwU0dDLmNybDAqBgNVHSUEIzAhBggr -BgEFBQcDAQYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMA0GCSqGSIb3DQEBBQUAA4IB -AQAnNZcAiosovcYzMB4p/OL31ZjUQLtgyr+rFywJNn9Q+kHcrpY6CiM+iVnJowft -Gzet/Hy+UUla3joKVAgWRcKZsYfNjGjgaQPpxE6YsjuMFrMOoAyYUJuTqXAJyCyj -j98C5OBxOvG0I3KgqgHf35g+FFCgMSa9KOlaMCZ1+XtgHI3zzVAmbQQnmt/VDUVH -KWss5nbZqSl9Mt3JNjy9rjXxEZ4du5A/EkdOjtd+D2JzHVImOBwYSf0wdJrE5SIv -2MCN7ZF6TACPcn9d2t0bi0Vr591pl6jFVkwPDPafepE39peC4N1xaf92P2BNPM/3 -mfnGV/TJVTl4uix5yaaIK/QI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEBDCCAuygAwIBAgIIGHqpqMKWIQwwDQYJKoZIhvcNAQELBQAwYjELMAkGA1UE -BhMCVVMxEzARBgNVBAoTCkFwcGxlIEluYy4xJjAkBgNVBAsTHUFwcGxlIENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MRYwFAYDVQQDEw1BcHBsZSBSb290IENBMB4XDTEy -MDIwMTIyMTIxNVoXDTI3MDIwMTIyMTIxNVoweTEtMCsGA1UEAwwkRGV2ZWxvcGVy -IElEIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSYwJAYDVQQLDB1BcHBsZSBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UE -BhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCJdk8GW5pB7qUj -KwKjX9dzP8A1sIuECj8GJH+nlT/rTw6Tr7QO0Mg+5W0Ysx/oiUe/1wkI5P9WmCkV -55SduTWjCs20wOHiYPTK7Cl4RWlpYGtfipL8niPmOsIiszFPHLrytjRZQu6wqQID -GJEEtrN4LjMfgEUNRW+7Dlpbfzrn2AjXCw4ybfuGNuRsq8QRinCEJqqfRNHxuMZ7 -lBebSPcLWBa6I8WfFTl+yl3DMl8P4FJ/QOq+rAhklVvJGpzlgMofakQcbD7EsCYf -Hex7r16gaj1HqVgSMT8gdihtHRywwk4RaSaLy9bQEYLJTg/xVnTQ2QhLZniiq6yn -4tJMh1nJAgMBAAGjgaYwgaMwHQYDVR0OBBYEFFcX7aLP3HyYoRDg/L6HLSzy4xdU -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUK9BpR5R2Cf70a40uQKb3R01/ -CF4wLgYDVR0fBCcwJTAjoCGgH4YdaHR0cDovL2NybC5hcHBsZS5jb20vcm9vdC5j -cmwwDgYDVR0PAQH/BAQDAgGGMBAGCiqGSIb3Y2QGAgYEAgUAMA0GCSqGSIb3DQEB -CwUAA4IBAQBCOXRrodzGpI83KoyzHQpEvJUsf7xZuKxh+weQkjK51L87wVA5akR0 -ouxbH3Dlqt1LbBwjcS1f0cWTvu6binBlgp0W4xoQF4ktqM39DHhYSQwofzPuAHob -tHastrW7T9+oG53IGZdKC1ZnL8I+trPEgzrwd210xC4jUe6apQNvYPSlSKcGwrta -4h8fRkV+5Jf1JxC3ICJyb3LaxlB1xT0lj12jAOmfNoxIOY+zO+qQgC6VmmD0eM70 -DgpTPqL6T9geroSVjTK8Vk2J6XgY4KyaQrp6RhuEoonOFOiI0ViL9q5WxCwFKkWv -C9lLqQIPNKyIx2FViUTJJ3MH7oLlTvVw ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhTELMAkGA1UEBhMCVVMx -IDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxs -cyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9v -dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDcxMjEzMTcwNzU0WhcNMjIxMjE0 -MDAwNzU0WjCBhTELMAkGA1UEBhMCVVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdl -bGxzU2VjdXJlMRwwGgYDVQQLDBNXZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQD -DC1XZWxsc1NlY3VyZSBQdWJsaWMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDub7S9eeKPCCGeOARBJe+r -WxxTkqxtnt3CxC5FlAM1iGd0V+PfjLindo8796jE2yljDpFoNoqXjopxaAkH5OjU -Dk/41itMpBb570OYj7OeUt9tkTmPOL13i0Nj67eT/DBMHAGTthP796EfvyXhdDcs -HqRePGj4S78NuR4uNuip5Kf4D8uCdXw1LSLWwr8L87T8bJVhHlfXBIEyg1J55oNj -z7fLY4sR4r1e6/aN7ZVyKLSsEmLpSjPmgzKuBXWVvYSV2ypcm44uDLiBK0HmOFaf -SZtsdvqKXfcBeYF8wYNABf5x/Qw/zE5gCQ5lRxAvAcAFP4/4s0HvWkJ+We/Slwxl -AgMBAAGjggE0MIIBMDAPBgNVHRMBAf8EBTADAQH/MDkGA1UdHwQyMDAwLqAsoCqG -KGh0dHA6Ly9jcmwucGtpLndlbGxzZmFyZ28uY29tL3dzcHJjYS5jcmwwDgYDVR0P -AQH/BAQDAgHGMB0GA1UdDgQWBBQmlRkQ2eihl5H/3BnZtQQ+0nMKajCBsgYDVR0j -BIGqMIGngBQmlRkQ2eihl5H/3BnZtQQ+0nMKaqGBi6SBiDCBhTELMAkGA1UEBhMC -VVMxIDAeBgNVBAoMF1dlbGxzIEZhcmdvIFdlbGxzU2VjdXJlMRwwGgYDVQQLDBNX -ZWxscyBGYXJnbyBCYW5rIE5BMTYwNAYDVQQDDC1XZWxsc1NlY3VyZSBQdWJsaWMg -Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHmCAQEwDQYJKoZIhvcNAQEFBQADggEB -ALkVsUSRzCPIK0134/iaeycNzXK7mQDKfGYZUMbVmO2rvwNa5U3lHshPcZeG1eMd -/ZDJPHV3V3p9+N701NX3leZ0bh08rnyd2wIDBSxxSyU+B+NemvVmFymIGjifz6pB -A4SXa5M4esowRBskRDPQ5NHcKDj0E0M1NSljqHyita04pO2t/caaH/+Xc/77szWn -k4bGdpEA5qxRFsQnMlzbc9qlk1eOPm01JghZ1edE13YgY+esE2fDbbFwRnzVlhE9 -iW9dqKHrjQrawx0zbKPqZxmamX9LPYNRKh3KL4YMon4QLSvUFpULB6ouFJJJtylv -2G0xffX8oRAHh84vWdw+WNs= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICqDCCAi2gAwIBAgIQIW4zpcvTiKRvKQe0JzzE2DAKBggqhkjOPQQDAzCBlDEL -MAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYD -VQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBD -bGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0g -RzQwHhcNMTExMDA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBlDELMAkGA1UEBhMC -VVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZTeW1h -bnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAxIFB1 -YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAATXZrUb266zYO5G6ohjdTsqlG3zXxL24w+etgoUU0hS -yNw6s8tIICYSTvqJhNTfkeQpfSgB2dsYQ2mhH7XThhbcx39nI9/fMTGDAzVwsUu3 -yBe7UcvclBfb6gk7dhLeqrWjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBRlwI0l9Qy6l3eQP54u4Fr1ztXh5DAKBggqhkjOPQQD -AwNpADBmAjEApa7jRlP4mDbjIvouKEkN7jB+M/PsP3FezFWJeJmssv3cHFwzjim5 -axfIEWi13IMHAjEAnMhE2mnCNsNUGRCFAtqdR+9B52wmnQk9922Q0QVEL7C8g5No -8gxFSTm/mQQc0xCg ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIOHaIAAQAC7LdggHiNtgYwDQYJKoZIhvcNAQEFBQAweTEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNV -BAsTG1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQTEmMCQGA1UEAxMdVEMgVHJ1 -c3RDZW50ZXIgVW5pdmVyc2FsIENBIEkwHhcNMDYwMzIyMTU1NDI4WhcNMjUxMjMx -MjI1OTU5WjB5MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1c3RDZW50ZXIg -R21iSDEkMCIGA1UECxMbVEMgVHJ1c3RDZW50ZXIgVW5pdmVyc2FsIENBMSYwJAYD -VQQDEx1UQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0EgSTCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAKR3I5ZEr5D0MacQ9CaHnPM42Q9e3s9B6DGtxnSR -JJZ4Hgmgm5qVSkr1YnwCqMqs+1oEdjneX/H5s7/zA1hV0qq34wQi0fiU2iIIAI3T -fCZdzHd55yx4Oagmcw6iXSVphU9VDprvxrlE4Vc93x9UIuVvZaozhDrzznq+VZeu -jRIPFDPiUHDDSYcTvFHe15gSWu86gzOSBnWLknwSaHtwag+1m7Z3W0hZneTvWq3z -wZ7U10VOylY0Ibw+F1tvdwxIAUMpsN0/lm7mlaoMwCC2/T42J5zjXM9OgdwZu5GQ -fezmlwQek8wiSdeXhrYTCjxDI3d+8NzmzSQfO4ObNDqDNOMCAwEAAaNjMGEwHwYD -VR0jBBgwFoAUkqR1LKSevoFE63n8isWVpesQdXMwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFJKkdSyknr6BROt5/IrFlaXrEHVzMA0G -CSqGSIb3DQEBBQUAA4IBAQAo0uCG1eb4e/CX3CJrO5UUVg8RMKWaTzqwOuAGy2X1 -7caXJ/4l8lfmXpWMPmRgFVp/Lw0BxbFg/UU1z/CyvwbZ71q+s2IhtNerNXxTPqYn -8aEt2hojnczd7Dwtnic0XQ/CNnm8yUpiLe1r2X1BQ3y2qsrtYbE3ghUJGooWMNjs -ydZHcnhLEEYUjl8Or+zHL6sQ17bxbuyGssLoDZJz3KL0Dzq/YSMQiZxIQG5wALPT -ujdEWBF6AmqI8Dc08BnprNRlc/ZpjGSUOnmFKbAWKwyCPwacx/0QK54PLLae4xW/ -2TYcuiUaUj0a7CIMHOCkoj3w6DnPgcB77V0fb8XQC9eY ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDtjCCAp6gAwIBAgIOBcAAAQACQdAGCk3OdRAwDQYJKoZIhvcNAQEFBQAwdjEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNV -BAsTGVRDIFRydXN0Q2VudGVyIENsYXNzIDQgQ0ExJTAjBgNVBAMTHFRDIFRydXN0 -Q2VudGVyIENsYXNzIDQgQ0EgSUkwHhcNMDYwMzIzMTQxMDIzWhcNMjUxMjMxMjI1 -OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1c3RDZW50ZXIgR21i -SDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgNCBDQTElMCMGA1UEAxMc -VEMgVHJ1c3RDZW50ZXIgQ2xhc3MgNCBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBALXNTJytrlG7fEjFDSmGehSt2VA9CXIgDRS2Y8b+WJ7gIV7z -jyIZ3E6RIM1viCmis8GsKnK6i1S4QF/yqvhDhsIwXMynXX/GCEnkDjkvjhjWkd0j -FnmA22xIHbzB3ygQY9GB493fL3l1oht48pQB5hBiecugfQLANIJ7x8CtHUzXapZ2 -W78mhEj9h/aECqqSB5lIPGG8ToVYx5ct/YFKocabEvVCUNFkPologiJw3fX64yhC -L04y87OjNopq1mJcrPoBbbTgci6VaLTxkwzGioLSHVPqfOA/QrcSWrjN2qUGZ8uh -d32llvCSHmcOHUJG5vnt+0dTf1cERh9GX8eu4I8CAwEAAaNCMEAwDwYDVR0TAQH/ -BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFB/quz4lGwa9pd1iBX7G -TFq/6A9DMA0GCSqGSIb3DQEBBQUAA4IBAQBYpCubTPfkpJKknGWYGWIi/HIy6QRd -xMRwLVpG3kxHiiW5ot3u6hKvSI3vK2fbO8w0mCr3CEf/Iq978fTr4jgCMxh1KBue -dmWsiANy8jhHHYz1nwqIUxAUu4DlDLNdjRfuHhkcho0UZ3iMksseIUn3f9MYv5x5 -+F0IebWqak2SNmy8eesOPXmK2PajVnBd3ttPedJ60pVchidlvqDTB4FAVd0Qy+BL -iILAkH0457+W4Ze6mqtCD9Of2J4VMxHL94J59bXAQVaS4d9VA61Iz9PyLrHHLVZM -ZHQqMc7cdalUR6SnQnIJ5+ECpkeyBM1CE+FhDOB4OiIgohxgQoaH96Xm ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMw -MTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML -QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYD -VQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ul -CDtbKRY654eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6n -tGO0/7Gcrjyvd7ZWxbWroulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyl -dI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1Zmne3yzxbrww2ywkEtvrNTVokMsAsJch -PXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJuiGMx1I4S+6+JNM3GOGvDC -+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8wHQYDVR0O -BBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBl -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFk -ZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENB -IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxtZBsfzQ3duQH6lmM0MkhHma6X -7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0PhiVYrqW9yTkkz -43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY -eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJl -pz/+0WatC7xrmYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOA -WiFeIc9TVPC6b4nbqKqVz4vjccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDpDCCAoygAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTQW1lcmljYSBPbmxpbmUgSW5jLjE2MDQGA1UEAxMtQW1lcmljYSBP -bmxpbmUgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAxMB4XDTAyMDUyODA2 -MDAwMFoXDTM3MTExOTIwNDMwMFowYzELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0Ft -ZXJpY2EgT25saW5lIEluYy4xNjA0BgNVBAMTLUFtZXJpY2EgT25saW5lIFJvb3Qg -Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAKgv6KRpBgNHw+kqmP8ZonCaxlCyfqXfaE0bfA+2l2h9LaaLl+lk -hsmj76CGv2BlnEtUiMJIxUo5vxTjWVXlGbR0yLQFOVwWpeKVBeASrlmLojNoWBym -1BW32J/X3HGrfpq/m44zDyL9Hy7nBzbvYjnF3cu6JRQj3gzGPTzOggjmZj7aUTsW -OqMFf6Dch9Wc/HKpoH145LcxVR5lu9RhsCFg7RAycsWSJR74kEoYeEfffjA3PlAb -2xzTa5qGUwew76wGePiEmf4hjUyAtgyC9mZweRrTT6PP8c9GsEsPPt2IYriMqQko -O3rHl+Ee5fSfwMCuJKDIodkP1nsmgmkyPacCAwEAAaNjMGEwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUAK3Zo/Z59m50qX8zPYEX10zPM94wHwYDVR0jBBgwFoAU -AK3Zo/Z59m50qX8zPYEX10zPM94wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB -BQUAA4IBAQB8itEfGDeC4Liwo+1WlchiYZwFos3CYiZhzRAW18y0ZTTQEYqtqKkF -Zu90821fnZmv9ov761KyBZiibyrFVL0lvV+uyIbqRizBs73B6UlwGBaXCBOMIOAb -LjpHyx7kADCVW/RFo8AasAFOq73AI25jP4BKxQft3OJvx8Fi8eNy1gTIdGcL+oir -oQHIb/AUr9KZzVGTfu0uOMe9zkZQPXLjeSWdm4grECDdpbgyn43gKd8hdIaC2y+C -MMbHNYaz+ZZfRtsMRf3zUMNvxsNIrUam4SdHCh0Om7bCd39j8uB9Gr784N/Xx6ds -sPmuujz9dLQR6FgNgLzTqIA6me11zEZ7 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBi -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3Qg -RzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBiMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3y -ithZwuEppz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1If -xp4VpX6+n6lXFllVcq9ok3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDV -ySAdYyktzuxeTsiT+CFhmzTrBcZe7FsavOvJz82sNEBfsXpm7nfISKhmV1efVFiO -DCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGYQJB5w3jHtrHEtWoYOAMQ -jdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6MUSaM0C/ -CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCi -EhtmmnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADM -fRyVw4/3IbKyEbe7f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QY -uKZ3AeEPlAwhHbJUKSWJbOUOUlFHdL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXK -chYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8oR7FwI+isX4KJpn15GkvmB0t -9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -hjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD -ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2 -SV1EY+CtnJYYZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd -+SeuMIW59mdNOj6PWTkiU0TryF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWc -fFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy7zBZLq7gcfJW5GqXb5JQbZaNaHqa -sjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iahixTXTBmyUEFxPT9N -cCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN5r5N -0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie -4u1Ki7wb/UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mI -r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1 -/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm -gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEuzCCA6OgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQGEwJVUzET -MBEGA1UEChMKQXBwbGUgSW5jLjEmMCQGA1UECxMdQXBwbGUgQ2VydGlmaWNhdGlv -biBBdXRob3JpdHkxFjAUBgNVBAMTDUFwcGxlIFJvb3QgQ0EwHhcNMDYwNDI1MjE0 -MDM2WhcNMzUwMjA5MjE0MDM2WjBiMQswCQYDVQQGEwJVUzETMBEGA1UEChMKQXBw -bGUgSW5jLjEmMCQGA1UECxMdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx -FjAUBgNVBAMTDUFwcGxlIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw -ggEKAoIBAQDkkakJH5HbHkdQ6wXtXnmELes2oldMVeyLGYne+Uts9QerIjAC6Bg+ -+FAJ039BqJj50cpmnCRrEdCju+QbKsMflZ56DKRHi1vUFjczy8QPTc4UadHJGXL1 -XQ7Vf1+b8iUDulWPTV0N8WQ1IxVLFVkds5T39pyez1C6wVhQZ48ItCD3y6wsIG9w -tj8BMIy3Q88PnT3zK0koGsj+zrW5DtleHNbLPbU6rfQPDgCSC7EhFi501TwN22IW -q6NxkkdTVcGvL0Gz+PvjcM3mo0xFfh9Ma1CWQYnEdGILEINBhzOKgbEwWOxaBDKM -aLOPHd5lc/9nXmW8Sdh2nzMUZaF3lMktAgMBAAGjggF6MIIBdjAOBgNVHQ8BAf8E -BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUK9BpR5R2Cf70a40uQKb3 -R01/CF4wHwYDVR0jBBgwFoAUK9BpR5R2Cf70a40uQKb3R01/CF4wggERBgNVHSAE -ggEIMIIBBDCCAQAGCSqGSIb3Y2QFATCB8jAqBggrBgEFBQcCARYeaHR0cHM6Ly93 -d3cuYXBwbGUuY29tL2FwcGxlY2EvMIHDBggrBgEFBQcCAjCBthqBs1JlbGlhbmNl -IG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0 -YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJkIHRlcm1zIGFuZCBj -b25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNhdGUgcG9saWN5IGFuZCBjZXJ0aWZp -Y2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMuMA0GCSqGSIb3DQEBBQUAA4IBAQBc -NplMLXi37Yyb3PN3m/J20ncwT8EfhYOFG5k9RzfyqZtAjizUsZAS2L70c5vu0mQP -y3lPNNiiPvl4/2vIB+x9OYOLUyDTOMSxv5pPCmv/K/xZpwUJfBdAVhEedNO3iyM7 -R6PVbyTi69G3cN8PReEnyvFteO3ntRcXqNx+IjXKJdXZD9Zr1KIkIxH3oayPc4Fg -xhtbCS+SsvhESPBgOJ4V9T0mZyCKM2r3DYLP3uujL/lTaltkwGMzd/c6ByxW69oP -IQ7aunMZT7XZNn/Bh1XZp5m5MkL72NVxnn6hUrcbvZNCJBIqxw8dtk2cXmPIS4AX -UKqK1drk/NAJBzewdXUh ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID9zCCAt+gAwIBAgIESJ8AATANBgkqhkiG9w0BAQUFADCBijELMAkGA1UEBhMC -Q04xMjAwBgNVBAoMKUNoaW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24g -Q2VudGVyMUcwRQYDVQQDDD5DaGluYSBJbnRlcm5ldCBOZXR3b3JrIEluZm9ybWF0 -aW9uIENlbnRlciBFViBDZXJ0aWZpY2F0ZXMgUm9vdDAeFw0xMDA4MzEwNzExMjVa -Fw0zMDA4MzEwNzExMjVaMIGKMQswCQYDVQQGEwJDTjEyMDAGA1UECgwpQ2hpbmEg -SW50ZXJuZXQgTmV0d29yayBJbmZvcm1hdGlvbiBDZW50ZXIxRzBFBgNVBAMMPkNo -aW5hIEludGVybmV0IE5ldHdvcmsgSW5mb3JtYXRpb24gQ2VudGVyIEVWIENlcnRp -ZmljYXRlcyBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm35z -7r07eKpkQ0H1UN+U8i6yjUqORlTSIRLIOTJCBumD1Z9S7eVnAztUwYyZmczpwA// -DdmEEbK40ctb3B75aDFk4Zv6dOtouSCV98YPjUesWgbdYavi7NifFy2cyjw1l1Vx -zUOFsUcW9SxTgHbP0wBkvUCZ3czY28Sf1hNfQYOL+Q2HklY0bBoQCxfVWhyXWIQ8 -hBouXJE0bhlffxdpxWXvayHG1VA6v2G5BY3vbzQ6sm8UY78WO5upKv23KzhmBsUs -4qpnHkWnjQRmQvaPK++IIGmPMowUc9orhpFjIpryp9vOiYurXccUwVswah+xt54u -gQEC7c+WXmPbqOY4twIDAQABo2MwYTAfBgNVHSMEGDAWgBR8cks5x8DbYqVPm6oY -NJKiyoOCWTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4E -FgQUfHJLOcfA22KlT5uqGDSSosqDglkwDQYJKoZIhvcNAQEFBQADggEBACrDx0M3 -j92tpLIM7twUbY8opJhJywyA6vPtI2Z1fcXTIWd50XPFtQO3WKwMVC/GVhMPMdoG -52U7HW8228gd+f2ABsqjPWYWqJ1MFn3AlUa1UeTiH9fqBk1jjZaM7+czV0I664zB -echNdn3e9rG3geCg+aF4RhcaVpjwTj2rHO3sOdwHSPdj/gauwqRcalsyiMXHM4Ws -ZkJHwlgkmeHlPuV1LI5D1l08eB6olYIpUNHRFrrvwb562bTYzB5MRuF3sTGrvSrI -zo9uoV1/A3U05K2JRVRevq4opbs/eHnrc7MKDf2+yfdWrPa37S+bISnHOLaVxATy -wy39FCqQmbkHzJ8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMjAeFw0wNjExMjQxODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCa -GMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6XJxg -Fyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55J -WpzmM+Yklvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bB -rrcCaoF6qUWD4gXmuVbBlDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp -+ARz8un+XJiM9XOva7R+zdRcAitMOeGylZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1 -ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt66/3FsvbzSUr5R/7mp/i -Ucw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1JdxnwQ5hYIiz -PtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og -/zOhD7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UH -oycR7hYQe7xFSkyyBNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuI -yV77zGHcizN300QyNQliBJIWENieJ0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1Ud -EwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBQahGK8SEwzJQTU7tD2 -A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGUa6FJpEcwRTEL -MAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT -ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2f -BluornFdLwUvZ+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzn -g/iN/Ae42l9NLmeyhP3ZRPx3UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2Bl -fF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodmVjB3pjd4M1IQWK4/YY7yarHvGH5K -WWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK+JDSV6IZUaUtl0Ha -B0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrWIozc -hLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPR -TUIZ3Ph1WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWD -mbA4CD/pXvk1B+TJYm5Xf6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0Z -ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y -4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza -8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIE5jCCA86gAwIBAgIEO45L/DANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN -AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp -dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTAxMDgzMDE0MjMw -MVoXDTE2MDgyNjE0MjMwMVowXTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMQsw -CQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEQ -MA4GA1UEAxMHSnV1ci1TSzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AIFxNj4zB9bjMI0TfncyRsvPGbJgMUaXhvSYRqTCZUXP00B841oiqBB4M8yIsdOB -SvZiF3tfTQou0M+LI+5PAk676w7KvRhj6IAcjeEcjT3g/1tf6mTll+g/mX8MCgkz -ABpTpyHhOEvWgxutr2TC+Rx6jGZITWYfGAriPrsfB2WThbkasLnE+w0R9vXW+RvH -LCu3GFH+4Hv2qEivbDtPL+/40UceJlfwUR0zlv/vWT3aTdEVNMfqPxZIe5EcgEMP -PbgFPtGzlc3Yyg/CQ2fbt5PgIoIuvvVoKIO5wTtpeyDaTpxt4brNj3pssAki14sL -2xzVWiZbDcDq5WDQn/413z8CAwEAAaOCAawwggGoMA8GA1UdEwEB/wQFMAMBAf8w -ggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUFBwIC -MIHDHoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAAdgDk -AGwAagBhAHMAdABhAHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYAaQB0 -AHMAZQBlAHIAaQBtAGkAcwBrAGUAcwBrAHUAcwAgAGEAbABhAG0ALQBTAEsAIABz -AGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABrAGkAbgBuAGkAdABhAG0AaQBz -AGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nwcy8wKwYDVR0f -BCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2NybC8wHQYDVR0OBBYE -FASqekej5ImvGs8KQKcYP2/v6X2+MB8GA1UdIwQYMBaAFASqekej5ImvGs8KQKcY -P2/v6X2+MA4GA1UdDwEB/wQEAwIB5jANBgkqhkiG9w0BAQUFAAOCAQEAe8EYlFOi -CfP+JmeaUOTDBS8rNXiRTHyoERF5TElZrMj3hWVcRrs7EKACr81Ptcw2Kuxd/u+g -kcm2k298gFTsxwhwDY77guwqYHhpNjbRxZyLabVAyJRld/JXIWY7zoVAtjNjGr95 -HvxcHdMdkxuLDF2FvZkwMhgJkVLpfKG6/2SSmuz+Ne6ML678IIbsSt4beDI3poHS -na9aEhbKmVv8b20OxaAehsmR0FyYgl9jDIpaq9iVpszLita/ZEuOyoqysOkhMp6q -qIWYNIE5ITuoOlIyPfZrN4YGWhWY3PARZv40ILcD9EEQfTmEeZZyY7aWAuVrua0Z -TbvGRNs2yyqcjg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICQzCCAcmgAwIBAgIILcX8iNLFS5UwCgYIKoZIzj0EAwMwZzEbMBkGA1UEAwwS -QXBwbGUgUm9vdCBDQSAtIEczMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9u -IEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwHhcN -MTQwNDMwMTgxOTA2WhcNMzkwNDMwMTgxOTA2WjBnMRswGQYDVQQDDBJBcHBsZSBS -b290IENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9y -aXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUzB2MBAGByqGSM49 -AgEGBSuBBAAiA2IABJjpLz1AcqTtkyJygRMc3RCV8cWjTnHcFBbZDuWmBSp3ZHtf -TjjTuxxEtX/1H7YyYl3J6YRbTzBPEVoA/VhYDKX1DyxNB0cTddqXl5dvMVztK517 -IDvYuVTZXpmkOlEKMaNCMEAwHQYDVR0OBBYEFLuw3qFYM4iapIqZ3r6966/ayySr -MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gA -MGUCMQCD6cHEFl4aXTQY2e3v9GwOAEZLuN+yRhHFD/3meoyhpmvOwgPUnPWTxnS4 -at+qIxUCMG1mihDK1A3UT82NQz60imOlM27jbdoXt2QfyFMm+YhidDkLF1vLUagM -6BgD56KyKA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIExTCCA62gAwIBAgIBADANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4GA1UEAxMXR2xvYmFsIENo -YW1iZXJzaWduIFJvb3QwHhcNMDMwOTMwMTYxNDE4WhcNMzcwOTMwMTYxNDE4WjB9 -MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgy -NzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEgMB4G -A1UEAxMXR2xvYmFsIENoYW1iZXJzaWduIFJvb3QwggEgMA0GCSqGSIb3DQEBAQUA -A4IBDQAwggEIAoIBAQCicKLQn0KuWxfH2H3PFIP8T8mhtxOviteePgQKkotgVvq0 -Mi+ITaFgCPS3CU6gSS9J1tPfnZdan5QEcOw/Wdm3zGaLmFIoCQLfxS+EjXqXd7/s -QJ0lcqu1PzKY+7e3/HKE5TWH+VX6ox8Oby4o3Wmg2UIQxvi1RMLQQ3/bvOSiPGpV -eAp3qdjqGTK3L/5cPxvusZjsyq16aUXjlg9V9ubtdepl6DJWk0aJqCWKZQbua795 -B9Dxt6/tLE2Su8CoX6dnfQTyFQhwrJLWfQTSM/tMtgsL+xrJxI0DqX5c8lCrEqWh -z0hQpe/SyBoT+rB/sYIcd2oPX9wLlY/vQ37mRQklAgEDo4IBUDCCAUwwEgYDVR0T -AQH/BAgwBgEB/wIBDDA/BgNVHR8EODA2MDSgMqAwhi5odHRwOi8vY3JsLmNoYW1i -ZXJzaWduLm9yZy9jaGFtYmVyc2lnbnJvb3QuY3JsMB0GA1UdDgQWBBRDnDafsJ4w -TcbOX60Qq+UDpfqpFDAOBgNVHQ8BAf8EBAMCAQYwEQYJYIZIAYb4QgEBBAQDAgAH -MCoGA1UdEQQjMCGBH2NoYW1iZXJzaWducm9vdEBjaGFtYmVyc2lnbi5vcmcwKgYD -VR0SBCMwIYEfY2hhbWJlcnNpZ25yb290QGNoYW1iZXJzaWduLm9yZzBbBgNVHSAE -VDBSMFAGCysGAQQBgYcuCgEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly9jcHMuY2hh -bWJlcnNpZ24ub3JnL2Nwcy9jaGFtYmVyc2lnbnJvb3QuaHRtbDANBgkqhkiG9w0B -AQUFAAOCAQEAPDtwkfkEVCeR4e3t/mh/YV3lQWVPMvEYBZRqHN4fcNs+ezICNLUM -bKGKfKX0j//U2K0X1S0E0T9YgOKBWYi+wONGkyT+kL0mojAt6JcmVzWJdJYY9hXi -ryQZVgICsroPFOrGimbBhkVVi76SvpykBMdJPJ7oKXqJ1/6v/2j1pReQvayZzKWG -VwlnRtvWFsJG8eSpUPWP0ZIV018+xgBJOm5YstHRJw0lyDL4IBHNfTIzSJRUTN3c -ecQwn+uOuFW114hcxWokPbLTBQNRxgfvzBRydD1ucs4YKIxKoHflCStFREest2d/ -AYoFWpO+ocH/+OcOZ6RHSXZddZAa9SaP8A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRF -MRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBD -bGFzcyAzIENBIDIgMjAwOTAeFw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NTha -ME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxELVRydXN0IEdtYkgxJzAlBgNVBAMM -HkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOADER03 -UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42 -tSHKXzlABF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9R -ySPocq60vFYJfxLLHLGvKZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsM -lFqVlNpQmvH/pStmMaTJOKDfHR+4CS7zp+hnUquVH+BGPtikw8paxTGA6Eian5Rp -/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUCAwEAAaOCARowggEWMA8G -A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ4PGEMA4G -A1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVj -dG9yeS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUy -MENBJTIwMiUyMDIwMDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRl -cmV2b2NhdGlvbmxpc3QwQ6BBoD+GPWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3Js -L2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAwOS5jcmwwDQYJKoZIhvcNAQEL -BQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm2H6NMLVwMeni -acfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0 -o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4K -zCUqNQT4YJEVdT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8 -PIWmawomDeCTmGCufsYkl4phX5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3Y -Johw1+qRzT65ysCQblrGXnRl11z+o+I= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz -MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv -cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN -AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz -Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO -0gMdA+9tDWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIao -wW8xQmxSPmjL8xk037uHGFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj -7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b01k/unK8RCSc43Oz969XL0Imnal0ugBS -8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmHursCAwEAAaOBnTCBmjAT -BgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB -/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCeg -JYYjaHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGC -NxUBBAMCAQAwDQYJKoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt3 -6Z3q059c4EVlew3KW+JwULKUBRSuSceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/ -3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHfmbx8IVQr5Fiiu1cprp6poxkm -D5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZnMUFdAvnZyPS -CPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR -3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgIBBDANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJLUjEN -MAsGA1UECgwES0lTQTEuMCwGA1UECwwlS29yZWEgQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHkgQ2VudHJhbDEWMBQGA1UEAwwNS0lTQSBSb290Q0EgMTAeFw0wNTA4MjQw -ODA1NDZaFw0yNTA4MjQwODA1NDZaMGQxCzAJBgNVBAYTAktSMQ0wCwYDVQQKDARL -SVNBMS4wLAYDVQQLDCVLb3JlYSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBDZW50 -cmFsMRYwFAYDVQQDDA1LSVNBIFJvb3RDQSAxMIIBIDANBgkqhkiG9w0BAQEFAAOC -AQ0AMIIBCAKCAQEAvATk+hM58DSWIGtsaLv623f/J/es7C/n/fB/bW+MKs0lCVsk -9KFo/CjsySXirO3eyDOE9bClCTqnsUdIxcxPjHmc+QZXfd3uOPbPFLKc6tPAXXdi -8EcNuRpAU1xkcK8IWsD3z3X5bI1kKB4g/rcbGdNaZoNy4rCbvdMlFQ0yb2Q3lIVG -yHK+d9VuHygvx2nt54OJM1jT3qC/QOhDUO7cTWu8peqmyGGO9cNkrwYV3CmLP3WM -vHFE2/yttRcdbYmDz8Yzvb9Fov4Kn6MRXw+5H5wawkbMnChmn3AmPC7fqoD+jMUE -CSVPzZNHPDfqAmeS/vwiJFys0izgXAEzisEZ2wIBA6MyMDAwHQYDVR0OBBYEFL+2 -J9gDWnZlTGEBQVYx5Yt7OtnMMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEF -BQADggEBABOvUQveimpb5poKyLGQSk6hAp3MiNKrZr097LuxQpVqslxa/6FjZJap -aBV/JV6K+KRzwYCKhQoOUugy50X4TmWAkZl0Q+VFnUkq8JSV3enhMNITbslOsXfl -BM+tWh6UCVrXPAgcrnrpFDLBRa3SJkhyrKhB2vAhhzle3/xk/2F0KpzZm4tfwjeT -2KM3LzuTa7IbB6d/CVDv0zq+IWuKkDsnSlFOa56ch534eJAx7REnxqhZvvwYC/uO -fi5C4e3nCSG9uRPFVmf0JqZCQ5BEVLRxm3bkGhKsGigA35vB1fjbXKP4krG9tNT5 -UNkAAk/bg9ART6RCVmE6fhMy04Qfybo= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1Ix -RDBCBgNVBAoTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1 -dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1p -YyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIFJvb3RDQSAyMDExMB4XDTExMTIw -NjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYTAkdSMUQwQgYDVQQK -EztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIENl -cnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl -c2VhcmNoIEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPz -dYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJ -fel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa71HFK9+WXesyHgLacEns -bgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u8yBRQlqD -75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSP -FEDH3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNV -HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp -5dgTBCPuQSUwRwYDVR0eBEAwPqA8MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQu -b3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQub3JnMA0GCSqGSIb3DQEBBQUA -A4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVtXdMiKahsog2p -6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8 -TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7 -dIsXRSZMFpGD/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8Acys -Nnq/onN694/BtZqhFLKPM58N7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXI -l7WdmplNsDz4SgCbZN2fOUvRJ9e4 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQG -EwJIVTERMA8GA1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3 -MDUGA1UECwwuVGFuw7pzw610dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBBcmFueSAoQ2xhc3MgR29sZCkgRsWR -dGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgxMjA2MTUwODIxWjCB -pzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxOZXRM -b2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlm -aWNhdGlvbiBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNz -IEdvbGQpIEbFkXRhbsO6c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAxCRec75LbRTDofTjl5Bu0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrT -lF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw/HpYzY6b7cNGbIRwXdrz -AZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAkH3B5r9s5 -VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRG -ILdwfzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2 -BJtr+UBdADTHLpl1neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAG -AQH/AgEEMA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2M -U9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwWqZw8UQCgwBEIBaeZ5m8BiFRh -bvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTtaYtOUZcTh5m2C -+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC -bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2F -uLjbvrW5KfnaNwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2 -XjG4Kvte9nHfRCaexOYNkbQudZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPzCCAyegAwIBAgIBATANBgkqhkiG9w0BAQUFADB+MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEkMCIGA1UEAwwbU2VjdXJlIENlcnRp -ZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVow -fjELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxJDAiBgNV -BAMMG1NlY3VyZSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBAMBxM4KK0HDrc4eCQNUd5MvJDkKQ+d40uaG6EfQlhfPM -cm3ye5drswfxdySRXyWP9nQ95IDC+DwN879A6vfIUtFyb+/Iq0G4bi4XKpVpDM3S -HpR7LZQdqnXXs5jLrLxkU0C8j6ysNstcrbvd4JQX7NFc0L/vpZXJkMWwrPsbQ996 -CF23uPJAGysnnlDOXmWCiIxe004MeuoIkbY2qitC++rCoznl2yY4rYsK7hljxxwk -3wN42ubqwUcaCwtGCd0C/N7Lh1/XMGNooa7cMqG6vv5Eq2i2pRcV/b3Vp6ea5EQz -6YiO/O1R65NxTq0B50SOqy3LqP4BSUjwwN3HaNiS/j0CAwEAAaOBxzCBxDAdBgNV -HQ4EFgQUPNiTiMLAggnMAZkGkyDpnnAJY08wDgYDVR0PAQH/BAQDAgEGMA8GA1Ud -EwEB/wQFMAMBAf8wgYEGA1UdHwR6MHgwO6A5oDeGNWh0dHA6Ly9jcmwuY29tb2Rv -Y2EuY29tL1NlY3VyZUNlcnRpZmljYXRlU2VydmljZXMuY3JsMDmgN6A1hjNodHRw -Oi8vY3JsLmNvbW9kby5uZXQvU2VjdXJlQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmww -DQYJKoZIhvcNAQEFBQADggEBAIcBbSMdflsXfcFhMs+P5/OKlFlm4J4oqF7Tt/Q0 -5qo5spcWxYJvMqTpjOev/e/C6LlLqqP05tqNZSH7uoDrJiiFGv45jN5bBAS0VPmj -Z55B+glSzAVIqMk/IQQezkhr/IXownuvf7fM+F86/TXGDe+X3EyrEeFryzHRbPtI -gKvcnDe4IRRLDXE97IMzbtFuMhbsmMcWi1mmNKsFVy2T96oTy9IT4rcuO81rUBcJ -aD61JlfutuC23bkpgHl9j6PwpCikFcSF9CfUa7/lXORlAnZUtOM3ZiTTGWHIUhDl -izeauan5Hb/qmZJhlv8BzaFfDbxxvA6sCx1HRR3B7Hzs/Sk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF0zCCA7ugAwIBAgIVALhZFHE/V9+PMcAzPdLWGXojF7TrMA0GCSqGSIb3DQEB -DQUAMIGAMQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dp -ZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBIDIwHhcNMTExMDA2 -MDgzOTU2WhcNNDYxMDA2MDgzOTU2WjCBgDELMAkGA1UEBhMCUEwxIjAgBgNVBAoT -GVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1bSBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0 -d29yayBDQSAyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvfl4+ObV -gAxknYYblmRnPyI6HnUBfe/7XGeMycxca6mR5rlC5SBLm9qbe7mZXdmbgEvXhEAr -J9PoujC7Pgkap0mV7ytAJMKXx6fumyXvqAoAl4Vaqp3cKcniNQfrcE1K1sGzVrih -QTib0fsxf4/gX+GxPw+OFklg1waNGPmqJhCrKtPQ0WeNG0a+RzDVLnLRxWPa52N5 -RH5LYySJhi40PylMUosqp8DikSiJucBb+R3Z5yet/5oCl8HGUJKbAiy9qbk0WQq/ -hEr/3/6zn+vZnuCYI+yma3cWKtvMrTscpIfcRnNeGWJoRVfkkIJCu0LW8GHgwaM9 -ZqNd9BjuiMmNF0UpmTJ1AjHuKSbIawLmtWJFfzcVWiNoidQ+3k4nsPBADLxNF8tN -orMe0AZa3faTz1d1mfX6hhpneLO/lv403L3nUlbls+V1e9dBkQXcXWnjlQ1DufyD -ljmVe2yAWk8TcsbXfSl6RLpSpCrVQUYJIP4ioLZbMI28iQzV13D4h1L92u+sUS4H -s07+0AnacO+Y+lbmbdu1V0vc5SwlFcieLnhO+NqcnoYsylfzGuXIkosagpZ6w7xQ -EmnYDlpGizrrJvojybawgb5CAKT41v4wLsfSRvbljnX98sy50IdbzAYQYLuDNbde -Z95H7JlI8aShFf6tjGKOOVVPORa5sWOd/7cCAwEAAaNCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUtqFUOQLDoD+Oirz61PgcptE6Dv0wDgYDVR0PAQH/BAQD -AgEGMA0GCSqGSIb3DQEBDQUAA4ICAQCdU8KBJdw1LK4K3VqbRjBWu9S0bEuG5gql -0pKKmo3cj7TudvQDy+ubAXirKmu1uiNOMXy1LN0taWczbmNdORgS+KAoU0SHq2rE -kpYfKqIcup3dJ/tSTbCPWujtjcNo45KgJgyHkLAD6mplKAjERnjgW7oO8DPcJ7Z+ -iD29kqSWfkGogAh71jYSvBAVmyS8q619EYkvMe340s9Tjuu0U6fnBMovpiLEEdzr -mMkiXUFq3ApSBFu8LqB9x7aSuySg8zfRK0OozPFoeBp+b2OQe590yGvZC1X2eQM9 -g8dBQJL7dgs3JRc8rz76PFwbhvlKDD+KxF4OmPGt7s/g/SE1xzNhzKI3GEN8M+mu -doKCB0VIO8lnbq2jheiWVs+8u/qry7dXJ40aL5nzIzM0jspTY9NXNFBPz0nBBbrF -qId744aP+0OiEumsUewEdkzw+o+5MRPpCLckCfmgtwc2WFfPxLt+SWaVNQS2dzW4 -qVMpX5KF+FLEWk79BmE5+33QdkeSzOwrvYRu5ptFwX1isVMtnnWg58koUNflvKiq -B3hquXS0YPOEjQPcrpHadEQNe0Kpd9YrfKHGbBNTIqkSmqX5TyhFNbCXT0ZlhcX0 -/WKiomr8NDAGft8M4HOBlslEKt4fguxscletKWSk8cYpjjVgU85r2QK+OTB14Pdc -Y2rwQMEsjQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDQzCCAiugAwIBAgIQX/h7KCtU3I1CoxW1aMmt/zANBgkqhkiG9w0BAQUFADA1 -MRYwFAYDVQQKEw1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENB -IDIwNDgwHhcNMDQwNTE0MjAxNzEyWhcNMjkwNTE0MjAyNTQyWjA1MRYwFAYDVQQK -Ew1DaXNjbyBTeXN0ZW1zMRswGQYDVQQDExJDaXNjbyBSb290IENBIDIwNDgwggEg -MA0GCSqGSIb3DQEBAQUAA4IBDQAwggEIAoIBAQCwmrmrp68Kd6ficba0ZmKUeIhH -xmJVhEAyv8CrLqUccda8bnuoqrpu0hWISEWdovyD0My5jOAmaHBKeN8hF570YQXJ -FcjPFto1YYmUQ6iEqDGYeJu5Tm8sUxJszR2tKyS7McQr/4NEb7Y9JHcJ6r8qqB9q -VvYgDxFUl4F1pyXOWWqCZe+36ufijXWLbvLdT6ZeYpzPEApk0E5tzivMW/VgpSdH -jWn0f84bcN5wGyDWbs2mAag8EtKpP6BrXruOIIt6keO1aO6g58QBdKhTCytKmg9l -Eg6CTY5j/e/rmxrbU6YTYK/CfdfHbBcl1HP7R2RQgYCUTOG/rksc35LtLgXfAgED -o1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUJ/PI -FR5umgIJFq0roIlgX9p7L6owEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZIhvcNAQEF -BQADggEBAJ2dhISjQal8dwy3U8pORFBi71R803UXHOjgxkhLtv5MOhmBVrBW7hmW -Yqpao2TB9k5UM8Z3/sUcuuVdJcr18JOagxEu5sv4dEX+5wW4q+ffy0vhN4TauYuX -cB7w4ovXsNgOnbFp1iqRe6lJT37mjpXYgyc81WhJDtSd9i7rp77rMKSsH0T8lasz -Bvt9YAretIpjsJyp8qS5UwGH0GikJ3+r/+n6yUA4iGe0OcaEb1fJU9u6ju7AQ7L4 -CYNu/2bPPu8Xs1gYJQk0XuPL1hS27PKSb3TkL4Eq1ZKR4OCXPDJoBYVL0fdX4lId -kxpUnwVwwEpxYB5DC2Ae/qPOgRnhCzU= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVs -ZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAw -MFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6 -b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQgVGVj -aG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZp -Y2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAL3twQP89o/8ArFvW59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMg -nLRJdzIpVv257IzdIvpy3Cdhl+72WoTsbhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1 -HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNkN3mSwOxGXn/hbVNMYq/N -Hwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7NfZTD4p7dN -dloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0 -HZbUJtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0G -CSqGSIb3DQEBCwUAA4IBAQARWfolTwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjU -sHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx4mcujJUDJi5DnUox9g61DLu3 -4jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUwF5okxBDgBPfg -8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K -pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1 -mMpYjn0q7pBZc2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDzzCCAregAwIBAgIDAWweMA0GCSqGSIb3DQEBBQUAMIGNMQswCQYDVQQGEwJB -VDFIMEYGA1UECgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBp -bSBlbGVrdHIuIERhdGVudmVya2VociBHbWJIMRkwFwYDVQQLDBBBLVRydXN0LW5R -dWFsLTAzMRkwFwYDVQQDDBBBLVRydXN0LW5RdWFsLTAzMB4XDTA1MDgxNzIyMDAw -MFoXDTE1MDgxNzIyMDAwMFowgY0xCzAJBgNVBAYTAkFUMUgwRgYDVQQKDD9BLVRy -dXN0IEdlcy4gZi4gU2ljaGVyaGVpdHNzeXN0ZW1lIGltIGVsZWt0ci4gRGF0ZW52 -ZXJrZWhyIEdtYkgxGTAXBgNVBAsMEEEtVHJ1c3QtblF1YWwtMDMxGTAXBgNVBAMM -EEEtVHJ1c3QtblF1YWwtMDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCtPWFuA/OQO8BBC4SAzewqo51ru27CQoT3URThoKgtUaNR8t4j8DRE/5TrzAUj -lUC5B3ilJfYKvUWG6Nm9wASOhURh73+nyfrBJcyFLGM/BWBzSQXgYHiVEEvc+RFZ -znF/QJuKqiTfC0Li21a8StKlDJu3Qz7dg9MmEALP6iPESU7l0+m0iKsMrmKS1GWH -2WrX9IWf5DMiJaXlyDO6w8dB3F/GaswADm0yqLaHNgBid5seHzTLkDx4iHQF63n1 -k3Flyp3HaxgtPVxO59X4PzF9j4fsCiIvI+n+u33J4PTs63zEsMMtYrWacdaxaujs -2e3Vcuy+VwHOBVWf3tFgiBCzAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYD -VR0OBAoECERqlWdVeRFPMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC -AQEAVdRU0VlIXLOThaq/Yy/kgM40ozRiPvbY7meIMQQDbwvUB/tOdQ/TLtPAF8fG -KOwGDREkDg6lXb+MshOWcdzUzg4NCmgybLlBMRmrsQd7TZjTXLDR8KdCoLXEjq/+ -8T/0709GAHbrAvv5ndJAlseIOrifEXnzgGWovR/TeIGgUUw3tKZdJXDRZslo+S4R -FGjxVJgIrCaSD96JntT6s3kr0qN51OyLrIdTaEJMUVF0HhsnLuP1Hyl0Te2v9+GS -mYHovjrHF1D2t8b8m7CKa9aIA5GPBnc6hQLdmNVDeD/GMBWsm2vLV7eJUYs66MmE -DNuxUCAKGkq6ahq97BvIxYSazQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB -rjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf -Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw -MDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNV -BAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0wODA0MDIwMDAwMDBa -Fw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl -LCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9u -MTgwNgYDVQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXpl -ZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEcz -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr8nLPvb2FvdeHsbnndm -gcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2AtP0LMqmsywCPLLEHd5N/8 -YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC+BsUa0Lf -b1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS9 -9irY7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2S -zhkGcuYMXDhpxwTWvGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUk -OQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV -HQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJKoZIhvcNAQELBQADggEBABpA -2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweKA3rD6z8KLFIW -oCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu -t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7c -KUGRIjxpp7sC8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fM -m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu -MdRAGmI0Nj81Aa6sY6A= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFHjCCBAagAwIBAgIEAKA3oDANBgkqhkiG9w0BAQsFADCBtzELMAkGA1UEBhMC -Q1oxOjA4BgNVBAMMMUkuQ0EgLSBRdWFsaWZpZWQgQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHksIDA5LzIwMDkxLTArBgNVBAoMJFBydm7DrSBjZXJ0aWZpa2HEjW7DrSBh -dXRvcml0YSwgYS5zLjE9MDsGA1UECww0SS5DQSAtIEFjY3JlZGl0ZWQgUHJvdmlk -ZXIgb2YgQ2VydGlmaWNhdGlvbiBTZXJ2aWNlczAeFw0wOTA5MDEwMDAwMDBaFw0x -OTA5MDEwMDAwMDBaMIG3MQswCQYDVQQGEwJDWjE6MDgGA1UEAwwxSS5DQSAtIFF1 -YWxpZmllZCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSwgMDkvMjAwOTEtMCsGA1UE -CgwkUHJ2bsOtIGNlcnRpZmlrYcSNbsOtIGF1dG9yaXRhLCBhLnMuMT0wOwYDVQQL -DDRJLkNBIC0gQWNjcmVkaXRlZCBQcm92aWRlciBvZiBDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtTaEy0KC8M9l -4lSaWHMs4+sVV1LwzyJYiIQNeCrv1HHm/YpGIdY/Z640ceankjQvIX7m23BK4OSC -6KO8kZYA3zopOz6GFCOKV2PvLukbc+c2imF6kLHEv6qNA8WxhPbR3xKwlHDwB2yh -Wzo7V3QVgDRG83sugqQntKYC3LnlTGbJpNP+Az72gpO9AHUn/IBhFk4ksc8lYS2L -9GCy9CsmdKSBP78p9w8Lx7vDLqkDgt1/zBrcUWmSSb7AE/BPEeMryQV1IdI6nlGn -BhWkXOYf6GSdayJw86btuxC7viDKNrbp44HjQRaSxnp6O3eto1x4DfiYdw/YbJFe -7EjkxSQBywIDAQABo4IBLjCCASowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E -BAMCAQYwgecGA1UdIASB3zCB3DCB2QYEVR0gADCB0DCBzQYIKwYBBQUHAgIwgcAa -gb1UZW50byBjZXJ0aWZpa2F0IGplIHZ5ZGFuIGpha28ga3ZhbGlmaWtvdmFueSBz -eXN0ZW1vdnkgY2VydGlmaWthdCBwb2RsZSB6YWtvbmEgYy4gMjI3LzIwMDAgU2Iu -IHYgcGxhdG5lbSB6bmVuaS9UaGlzIGlzIHF1YWxpZmllZCBzeXN0ZW0gY2VydGlm -aWNhdGUgYWNjb3JkaW5nIHRvIEN6ZWNoIEFjdCBOby4gMjI3LzIwMDAgQ29sbC4w -HQYDVR0OBBYEFHnL0CPpOmdwkXRP01Hi4CD94Sj7MA0GCSqGSIb3DQEBCwUAA4IB -AQB9laU214hYaBHPZftbDS/2dIGLWdmdSbj1OZbJ8LIPBMxYjPoEMqzAR74tw96T -i6aWRa5WdOWaS6I/qibEKFZhJAVXX5mkx2ewGFLJ+0Go+eTxnjLOnhVF2V2s+57b -m8c8j6/bS6Ij6DspcHEYpfjjh64hE2r0aSpZDjGzKFM6YpqsCJN8qYe2X1qmGMLQ -wvNdjG+nPzCJOOuUEypIWt555ZDLXqS5F7ZjBjlfyDZjEfS2Es9Idok8alf563Mi -9/o+Ba46wMYOkk3P1IlU0RqCajdbliioACKDztAqubONU1guZVzV8tuMASVzbJeL -/GAB7ECTwe1RuKrLYtglMKI9 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE -FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j -ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js -LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM -BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0 -Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy -dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh -cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh -YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg -dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp -bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ -YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT -TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ -9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8 -jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW -FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz -ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1 -ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L -EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu -L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC -O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V -um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh -NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM3WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFul -F2mHMMo0aEPQQa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCC -ATgwLgYIKwYBBQUHAgEWImh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5w -ZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL2ludGVybWVk -aWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENvbW1lcmNpYWwgKFN0 -YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0aGUg -c2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93 -d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgG -CWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5fPGFf59Jb2vKXfuM/gTF -wWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWmN3PH/UvS -Ta0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst -0OcNOrg+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNc -pRJvkrKTlMeIFw6Ttn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKl -CcWw0bdT82AUuoVpaiF8H3VhFyAXe2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVF -P0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA2MFrLH9ZXF2RsXAiV+uKa0hK -1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBsHvUwyKMQ5bLm -KhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE -JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ -8dCAWZvLMdibD4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnm -fyWl8kgAwKQB2j8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD -QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB -CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 -nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt -43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P -T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 -gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO -BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR -TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw -DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr -hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg -06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF -PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls -YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk -CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDkzCCAnugAwIBAgIQFBOWgxRVjOp7Y+X8NId3RDANBgkqhkiG9w0BAQUFADA0 -MRMwEQYDVQQDEwpDb21TaWduIENBMRAwDgYDVQQKEwdDb21TaWduMQswCQYDVQQG -EwJJTDAeFw0wNDAzMjQxMTMyMThaFw0yOTAzMTkxNTAyMThaMDQxEzARBgNVBAMT -CkNvbVNpZ24gQ0ExEDAOBgNVBAoTB0NvbVNpZ24xCzAJBgNVBAYTAklMMIIBIjAN -BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8ORUaSvTx49qROR+WCf4C9DklBKK -8Rs4OC8fMZwG1Cyn3gsqrhqg455qv588x26i+YtkbDqthVVRVKU4VbirgwTyP2Q2 -98CNQ0NqZtH3FyrV7zb6MBBC11PN+fozc0yz6YQgitZBJzXkOPqUm7h65HkfM/sb -2CEJKHxNGGleZIp6GZPKfuzzcuc3B1hZKKxC+cX/zT/npfo4sdAMx9lSGlPWgcxC -ejVb7Us6eva1jsz/D3zkYDaHL63woSV9/9JLEYhwVKZBqGdTUkJe5DSe5L6j7Kpi -Xd3DTKaCQeQzC6zJMw9kglcq/QytNuEMrkvF7zuZ2SOzW120V+x0cAwqTwIDAQAB -o4GgMIGdMAwGA1UdEwQFMAMBAf8wPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2Zl -ZGlyLmNvbXNpZ24uY28uaWwvY3JsL0NvbVNpZ25DQS5jcmwwDgYDVR0PAQH/BAQD -AgGGMB8GA1UdIwQYMBaAFEsBmz5WGmU2dst7l6qSBe4y5ygxMB0GA1UdDgQWBBRL -AZs+VhplNnbLe5eqkgXuMucoMTANBgkqhkiG9w0BAQUFAAOCAQEA0Nmlfv4pYEWd -foPPbrxHbvUanlR2QnG0PFg/LUAlQvaBnPGJEMgOqnhPOAlXsDzACPw1jvFIUY0M -cXS6hMTXcpuEfDhOZAYnKuGntewImbQKDdSFc8gS4TXt8QUxHXOZDOuWyt3T5oWq -8Ir7dcHyCTxlZWTzTNity4hp8+SDtwy9F1qWF8pb/627HOkthIDYIb6FUtnUdLlp -hbpN7Sgy6/lhSuTENh4Z3G+EER+V9YMoGKgzkkMn3V0TBEVPh9VGzT2ouvDzuFYk -Res3x+F2T3I5GN9+dHLHcy056mDmrRGiVod7w2ia/viMcKjfZTL0pECMocJEAw6U -AGegcQCCSA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEZDCCA0ygAwIBAgIQRL4Mi1AAJLQR0zYwS8AzdzANBgkqhkiG9w0BAQUFADCB -ozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug -Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho -dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VSRmlyc3Qt -TmV0d29yayBBcHBsaWNhdGlvbnMwHhcNOTkwNzA5MTg0ODM5WhcNMTkwNzA5MTg1 -NzQ5WjCBozELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0 -IExha2UgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYD -VQQLExhodHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xKzApBgNVBAMTIlVUTi1VU0VS -Rmlyc3QtTmV0d29yayBBcHBsaWNhdGlvbnMwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQCz+5Gh5DZVhawGNFugmliy+LUPBXeDrjKxdpJo7CNKyXY/45y2 -N3kDuatpjQclthln5LAbGHNhSuh+zdMvZOOmfAz6F4CjDUeJT1FxL+78P/m4FoCH -iZMlIJpDgmkkdihZNaEdwH+DBmQWICzTSaSFtMBhf1EI+GgVkYDLpdXuOzr0hARe -YFmnjDRy7rh4xdE7EkpvfmUnuaRVxblvQ6TFHSyZwFKkeEwVs0CYCGtDxgGwenv1 -axwiP8vv/6jQOkt2FZ7S0cYu49tXGzKiuG/ohqY/cKvlcJKrRB5AUPuco2LkbG6g -yN7igEL66S/ozjIEj3yNtxyjNTwV3Z7DrpelAgMBAAGjgZEwgY4wCwYDVR0PBAQD -AgHGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFPqGydvguul49Uuo1hXf8NPh -ahQ8ME8GA1UdHwRIMEYwRKBCoECGPmh0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9V -VE4tVVNFUkZpcnN0LU5ldHdvcmtBcHBsaWNhdGlvbnMuY3JsMA0GCSqGSIb3DQEB -BQUAA4IBAQCk8yXM0dSRgyLQzDKrm5ZONJFUICU0YV8qAhXhi6r/fWRRzwr/vH3Y -IWp4yy9Rb/hCHTO967V7lMPDqaAt39EpHx3+jz+7qEUqf9FuVSTiuwL7MT++6Lzs -QCv4AdRWOOTKRIK1YSAhZ2X28AvnNPilwpyjXEAfhZOVBt5P1CeptqX8Fs1zMT+4 -ZSfP1FMa8Kxun08FDAOBp4QpxFq9ZFdyrTvPNximmMatBrTcCKME1SmklpoSZ0qM -YEWd8SOasACcaLWYUNPvji6SZbFIPiG+FTAqDbUMo2s/rn9X9R+WfN9v3YIwLGUb -QErNaLly7HF27FSOH4UMAWr6pjisH8SE ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c -JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP -mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ -wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 -VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ -AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB -AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun -pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC -dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf -fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm -NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx -H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe -+o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp -IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi -BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw -MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh -d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig -YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v -dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/ -BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6 -papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E -BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K -DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3 -KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox -XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIETTCCAzWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBtMQswCQYDVQQGEwJDSDEO -MAwGA1UEChMFYWRtaW4xETAPBgNVBAsTCFNlcnZpY2VzMSIwIAYDVQQLExlDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0aWVzMRcwFQYDVQQDEw5BZG1pbkNBLUNELVQwMTAe -Fw0wNjAxMjUxMzM2MTlaFw0xNjAxMjUxMjM2MTlaMG0xCzAJBgNVBAYTAkNIMQ4w -DAYDVQQKEwVhZG1pbjERMA8GA1UECxMIU2VydmljZXMxIjAgBgNVBAsTGUNlcnRp -ZmljYXRpb24gQXV0aG9yaXRpZXMxFzAVBgNVBAMTDkFkbWluQ0EtQ0QtVDAxMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0jQlMZmpLDhV+GNR9TAoSNle -JgQB4xAXJELQf5/ySMfoFA4MmjKqYXQkB6MGPuQKwR9XRRSPf61vqb8YPsdjRmgp -byHBcUd5t0N8RX6wRZUnPMW+bCCo2VqAU4XFbnlc2gHKaam0wdTtbBTXEkv0ieIH -fxCfFxXqSsSr60IkF/2/xbrAgV/QD5yHk6Ie8feAVWwi5UtaFqtu4LiFEh2QMyxs -Oyz1OcvKzkM2g873tyiE7jzMgZP+Ww3tibk2F9+e6ZeiB37TLOmVtvgpmrws4fiI -rFNXEYSWBVrUTbn81U47yWzOgf5fEHP07bRV5QOCzCm99qNimsbL6CG7nT78CQID -AQABo4H3MIH0MBIGA1UdEwEB/wQIMAYBAf8CAQAwga4GA1UdIASBpjCBozCBoAYI -YIV0AREDFQEwgZMwSAYIKwYBBQUHAgIwPBo6VGhpcyBpcyB0aGUgQWRtaW5DQS1D -RC1UMDEgQ2VydGlmaWNhdGUgUHJhY3RpY2UgU3RhdGVtZW50LjBHBggrBgEFBQcC -ARY7aHR0cDovL3d3dy5wa2kuYWRtaW4uY2gvcG9saWN5L0NQU18yXzE2Xzc1Nl8x -XzE3XzNfMjFfMS5wZGYwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQqxGkKocZV -xgNucM6GgbOkD6oZ2zANBgkqhkiG9w0BAQUFAAOCAQEAn356bbusjI5glGXRQ1DR -v21qQf0S4s3GHyZm7cqdOkFleM70ArBT+kOP5Nm7rlSAFyVgEkmBdOg7s9tlXClU -yeZFnp6UEYRUcijPN8D1VaNRK6PIUObpDBQT0C+kAfxG9z4v29T0SxT4sgAdC/xQ -Fyv58Fp9bPn7owuKwKcyCH1XSyi/Bp4XFELlLOaigBZO/w+dPBz4FcJSdZjU+BaJ -0E3nKAjHlShO5ouBSZnaJz3p+nkw2Wyo36s6GxCK0XbkSP45iniIG4FmwwZkonYF -ypQntHbx2oL7tUQQY0PDo8bGBMcPy/G2j+dciqZRlsnfgMy10SCzQ9MUx92xUG2V -eg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFVTCCBD2gAwIBAgIEO/OB0DANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQGEwJj -aDEOMAwGA1UEChMFYWRtaW4xETAPBgNVBAsTCFNlcnZpY2VzMSIwIAYDVQQLExlD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0aWVzMRYwFAYDVQQDEw1BZG1pbi1Sb290LUNB -MB4XDTAxMTExNTA4NTEwN1oXDTIxMTExMDA3NTEwN1owbDELMAkGA1UEBhMCY2gx -DjAMBgNVBAoTBWFkbWluMREwDwYDVQQLEwhTZXJ2aWNlczEiMCAGA1UECxMZQ2Vy -dGlmaWNhdGlvbiBBdXRob3JpdGllczEWMBQGA1UEAxMNQWRtaW4tUm9vdC1DQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMvgr0QUIv5qF0nyXZ3PXAJi -C4C5Wr+oVTN7oxIkXkxvO0GJToM9n7OVJjSmzBL0zJ2HXj0MDRcvhSY+KiZZc6Go -vDvr5Ua481l7ILFeQAFtumeza+vvxeL5Nd0Maga2miiacLNAKXbAcUYRa0Ov5VZB -++YcOYNNt/aisWbJqA2y8He+NsEgJzK5zNdayvYXQTZN+7tVgWOck16Da3+4FXdy -fH1NCWtZlebtMKtERtkVAaVbiWW24CjZKAiVfggjsiLo3yVMPGj3budLx5D9hEEm -vlyDOtcjebca+AcZglppWMX/iHIrx7740y0zd6cWEqiLIcZCrnpkr/KzwO135GkC -AwEAAaOCAf0wggH5MA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIASBkTCBjjCBiwYI -YIV0AREDAQAwfzArBggrBgEFBQcCAjAfGh1UaGlzIGlzIHRoZSBBZG1pbi1Sb290 -LUNBIENQUzBQBggrBgEFBQcCARZEaHR0cDovL3d3dy5pbmZvcm1hdGlrLmFkbWlu -LmNoL1BLSS9saW5rcy9DUFNfMl8xNl83NTZfMV8xN18zXzFfMC5wZGYwfwYDVR0f -BHgwdjB0oHKgcKRuMGwxFjAUBgNVBAMTDUFkbWluLVJvb3QtQ0ExIjAgBgNVBAsT -GUNlcnRpZmljYXRpb24gQXV0aG9yaXRpZXMxETAPBgNVBAsTCFNlcnZpY2VzMQ4w -DAYDVQQKEwVhZG1pbjELMAkGA1UEBhMCY2gwHQYDVR0OBBYEFIKf+iNzIPGXi7JM -Tb5CxX9mzWToMIGZBgNVHSMEgZEwgY6AFIKf+iNzIPGXi7JMTb5CxX9mzWTooXCk -bjBsMQswCQYDVQQGEwJjaDEOMAwGA1UEChMFYWRtaW4xETAPBgNVBAsTCFNlcnZp -Y2VzMSIwIAYDVQQLExlDZXJ0aWZpY2F0aW9uIEF1dGhvcml0aWVzMRYwFAYDVQQD -Ew1BZG1pbi1Sb290LUNBggQ784HQMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0B -AQUFAAOCAQEAeE96XCYRpy6umkPKXDWCRn7INo96ZrWpMggcDORuofHIwdTkgOeM -vWOxDN/yuT7CC3FAaUajbPRbDw0hRMcqKz0aC8CgwcyIyhw/rFK29mfNTG3EviP9 -QSsEbnelFnjpm1wjz4EaBiFjatwpUbI6+Zv3XbEt9QQXBn+c6DeFLe4xvC4B+MTr -a440xTk59pSYux8OHhEvqIwHCkiijGqZhTS3KmGFeBopaR+dJVBRBMoXwzk4B3Hn -0Zib1dEYFZa84vPJZyvxCbLOnPRDJgH6V2uQqbG+6DXVaf/wORVOvF/wzzv0viM/ -RWbEtJZdvo8N3sdtCULzifnxP/V0T9+4ZQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIG0TCCBbmgAwIBAgIBezANBgkqhkiG9w0BAQUFADCByTELMAkGA1UEBhMCSFUx -ETAPBgNVBAcTCEJ1ZGFwZXN0MScwJQYDVQQKEx5OZXRMb2NrIEhhbG96YXRiaXp0 -b25zYWdpIEtmdC4xGjAYBgNVBAsTEVRhbnVzaXR2YW55a2lhZG9rMUIwQAYDVQQD -EzlOZXRMb2NrIE1pbm9zaXRldHQgS296amVneXpvaSAoQ2xhc3MgUUEpIFRhbnVz -aXR2YW55a2lhZG8xHjAcBgkqhkiG9w0BCQEWD2luZm9AbmV0bG9jay5odTAeFw0w -MzAzMzAwMTQ3MTFaFw0yMjEyMTUwMTQ3MTFaMIHJMQswCQYDVQQGEwJIVTERMA8G -A1UEBxMIQnVkYXBlc3QxJzAlBgNVBAoTHk5ldExvY2sgSGFsb3phdGJpenRvbnNh -Z2kgS2Z0LjEaMBgGA1UECxMRVGFudXNpdHZhbnlraWFkb2sxQjBABgNVBAMTOU5l -dExvY2sgTWlub3NpdGV0dCBLb3pqZWd5em9pIChDbGFzcyBRQSkgVGFudXNpdHZh -bnlraWFkbzEeMBwGCSqGSIb3DQEJARYPaW5mb0BuZXRsb2NrLmh1MIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx1Ilstg91IRVCacbvWy5FPSKAtt2/Goq -eKvld/Bu4IwjZ9ulZJm53QE+b+8tmjwi8F3JV6BVQX/yQ15YglMxZc4e8ia6AFQe -r7C8HORSjKAyr7c3sVNnaHRnUPYtLmTeriZ539+Zhqurf4XsoPuAzPS4DB6TRWO5 -3Lhbm+1bOdRfYrCnjnxmOCyqsQhjF2d9zL2z8cM/z1A57dEZgxXbhxInlrfa6uWd -vLrqOU+L73Sa58XQ0uqGURzk/mQIKAR5BevKxXEOC++r6uwSEaEYBTJp0QwsGj0l -mT+1fMptsK6ZmfoIYOcZwvK9UdPM0wKswREMgM6r3JSda6M5UzrWhQIDAMV9o4IC -wDCCArwwEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8EBAMCAQYwggJ1Bglg -hkgBhvhCAQ0EggJmFoICYkZJR1lFTEVNISBFemVuIHRhbnVzaXR2YW55IGEgTmV0 -TG9jayBLZnQuIE1pbm9zaXRldHQgU3pvbGdhbHRhdGFzaSBTemFiYWx5emF0YWJh -biBsZWlydCBlbGphcmFzb2sgYWxhcGphbiBrZXN6dWx0LiBBIG1pbm9zaXRldHQg -ZWxla3Ryb25pa3VzIGFsYWlyYXMgam9naGF0YXMgZXJ2ZW55ZXN1bGVzZW5laywg -dmFsYW1pbnQgZWxmb2dhZGFzYW5hayBmZWx0ZXRlbGUgYSBNaW5vc2l0ZXR0IFN6 -b2xnYWx0YXRhc2kgU3phYmFseXphdGJhbiwgYXogQWx0YWxhbm9zIFN6ZXJ6b2Rl -c2kgRmVsdGV0ZWxla2JlbiBlbG9pcnQgZWxsZW5vcnplc2kgZWxqYXJhcyBtZWd0 -ZXRlbGUuIEEgZG9rdW1lbnR1bW9rIG1lZ3RhbGFsaGF0b2sgYSBodHRwczovL3d3 -dy5uZXRsb2NrLmh1L2RvY3MvIGNpbWVuIHZhZ3kga2VyaGV0b2sgYXogaW5mb0Bu -ZXRsb2NrLm5ldCBlLW1haWwgY2ltZW4uIFdBUk5JTkchIFRoZSBpc3N1YW5jZSBh -bmQgdGhlIHVzZSBvZiB0aGlzIGNlcnRpZmljYXRlIGFyZSBzdWJqZWN0IHRvIHRo -ZSBOZXRMb2NrIFF1YWxpZmllZCBDUFMgYXZhaWxhYmxlIGF0IGh0dHBzOi8vd3d3 -Lm5ldGxvY2suaHUvZG9jcy8gb3IgYnkgZS1tYWlsIGF0IGluZm9AbmV0bG9jay5u -ZXQwHQYDVR0OBBYEFAlqYhaSsFq7VQ7LdTI6MuWyIckoMA0GCSqGSIb3DQEBBQUA -A4IBAQCRalCc23iBmz+LQuM7/KbD7kPgz/PigDVJRXYC4uMvBcXxKufAQTPGtpvQ -MznNwNuhrWw3AkxYQTvyl5LGSKjN5Yo5iWH5Upfpvfb5lHTocQ68d4bDBsxafEp+ -NFAwLvt/MpqNPfMgW/hqyobzMUwsWYACff44yTB1HLdV47yfuqhthCgFdbOLDcCR -VCHnpgu0mfVRQdzNo0ci2ccBgcTcR08m6h/t280NmPSjnLRzMkqWmf68f8glWPhY -83ZmiVSkpj7EUFy6iRiCdUgh0k8T6GB+B3bbELVR5qq5aKrN9p2QdRLqOBrKROi3 -macqaJVmlaut74nLYKkGEsaUR+ko ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAe -Fw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVTMRUw -EwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20x -IDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0CAQYF -K4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FG -fp4tn+6OYwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPO -Z9wj/wMco+I+o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAd -BgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNpYim8S8YwCgYIKoZIzj0EAwMDaAAwZQIx -AK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y3maTD/HMsQmP3Wyr+mt/ -oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34VOKa5Vt8 -sycX ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIBCDANBgkqhkiG9w0BAQUFADA6MQswCQYDVQQGEwJDTjER -MA8GA1UEChMIVW5pVHJ1c3QxGDAWBgNVBAMTD1VDQSBHbG9iYWwgUm9vdDAeFw0w -ODAxMDEwMDAwMDBaFw0zNzEyMzEwMDAwMDBaMDoxCzAJBgNVBAYTAkNOMREwDwYD -VQQKEwhVbmlUcnVzdDEYMBYGA1UEAxMPVUNBIEdsb2JhbCBSb290MIICIjANBgkq -hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2rPlBlA/9nP3xDK/RqUlYjOHsGj+p9+I -A2N9Apb964fJ7uIIu527u+RBj8cwiQ9tJMAEbBSUgU2gDXRm8/CFr/hkGd656YGT -0CiFmUdCSiw8OCdKzP/5bBnXtfPvm65bNAbXj6ITBpyKhELVs6OQaG2BkO5NhOxM -cE4t3iQ5zhkAQ5N4+QiGHUPR9HK8BcBn+sBR0smFBySuOR56zUHSNqth6iur8CBV -mTxtLRwuLnWW2HKX4AzKaXPudSsVCeCObbvaE/9GqOgADKwHLx25urnRoPeZnnRc -GQVmMc8+KlL+b5/zub35wYH1N9ouTIElXfbZlJrTNYsgKDdfUet9Ysepk9H50DTL -qScmLCiQkjtVY7cXDlRzq6987DqrcDOsIfsiJrOGrCOp139tywgg8q9A9f9ER3Hd -J90TKKHqdjn5EKCgTUCkJ7JZFStsLSS3JGN490MYeg9NEePorIdCjedYcaSrbqLA -l3y74xNLytu7awj5abQEctXDRrl36v+6++nwOgw19o8PrgaEFt2UVdTvyie3AzzF -HCYq9TyopZWbhvGKiWf4xwxmse1Bv4KmAGg6IjTuHuvlb4l0T2qqaqhXZ1LUIGHB -zlPL/SR/XybfoQhplqCe/klD4tPq2sTxiDEhbhzhzfN1DiBEFsx9c3Q1RSw7gdQg -7LYJjD5IskkCAwEAAaOBojCBnzALBgNVHQ8EBAMCAQYwDAYDVR0TBAUwAwEB/zBj -BgNVHSUEXDBaBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwMDBggrBgEFBQcD -BAYIKwYBBQUHAwUGCCsGAQUFBwMGBggrBgEFBQcDBwYIKwYBBQUHAwgGCCsGAQUF -BwMJMB0GA1UdDgQWBBTZw9P4gJJnzF3SOqLXcaK0xDiALTANBgkqhkiG9w0BAQUF -AAOCAgEA0Ih5ygiq9ws0oE4Jwul+NUiJcIQjL1HDKy9e21NrW3UIKlS6Mg7VxnGF -sZdJgPaE0PC6t3GUyHlrpsVE6EKirSUtVy/m1jEp+hmJVCl+t35HNmktbjK81HXa -QnO4TuWDQHOyXd/URHOmYgvbqm4FjMh/Rk85hZCdvBtUKayl1/7lWFZXbSyZoUkh -1WHGjGHhdSTBAd0tGzbDLxLMC9Z4i3WA6UG5iLHKPKkWxk4V43I29tSgQYWvimVw -TbVEEFDs7d9t5tnGwBLxSzovc+k8qe4bqi81pZufTcU0hF8mFGmzI7GJchT46U1R -IgP/SobEHOh7eQrbRyWBfvw0hKxZuFhD5D1DCVR0wtD92e9uWfdyYJl2b/Unp7uD -pEqB7CmB9HdL4UISVdSGKhK28FWbAS7d9qjjGcPORy/AeGEYWsdl/J1GW1fcfA67 -loMQfFUYCQSu0feLKj6g5lDWMDbX54s4U+xJRODPpN/xU3uLWrb2EZBL1nXz/gLz -Ka/wI3J9FO2pXd96gZ6bkiL8HvgBRUGXx2sBYb4zaPKgZYRmvOAqpGjTcezHCN6j -w8k2SjTxF+KAryAhk5Qe5hXTVGLxtTgv48y5ZwSpuuXu+RBuyy5+E6+SFP7zJ3N7 -OPxzbbm5iPZujAv1/P8JDrMtXnt145Ik4ubhWD5LKAN1axibRww= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdjCCAl6gAwIBAgIEOhsEBTANBgkqhkiG9w0BAQUFADBRMQswCQYDVQQGEwJE -SzEMMAoGA1UEChMDS01EMQ8wDQYDVQQLEwZLTUQtQ0ExIzAhBgNVBAMTGktNRC1D -QSBLdmFsaWZpY2VyZXQgUGVyc29uMB4XDTAwMTEyMTIzMjQ1OVoXDTE1MTEyMjIz -MjQ1OVowUTELMAkGA1UEBhMCREsxDDAKBgNVBAoTA0tNRDEPMA0GA1UECxMGS01E -LUNBMSMwIQYDVQQDExpLTUQtQ0EgS3ZhbGlmaWNlcmV0IFBlcnNvbjCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBANriF4Xd6yD7ZlBE317UBDObn+vRMVc6 -p3wNQODdEDJe2z1ncCz9NJvhoLGdOJhyg7VVPh0P2c+KZ9WI9mWOKZI2bp2WkLju -jCcxbhTrurY3Wfc6gwLBqqFV8wWgaZKmvVWizjw9Kyi25f3yX4fOho6Qq2lvVbub -tvVFXAd51GJ+/2Yed+a4Or2bz2RcqHS81B3pywsD4mgJR5xREv5jqPfwNP+V7bkc -X+pfO4kVhZ/V+8MSPdQHgcV/iB3wP2mwgWyIBNc1reBidGTiz8unnWu55hcNfsvt -LJbTs9OHhsR7naRuy+S402nDnD5vnONOFEsiHn46w+T0rtu7h6j4OvkCAwEAAaNW -MFQwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUeWLqmhI42Jxj7DifDsW+ -DlQhKD0wHwYDVR0jBBgwFoAUeWLqmhI42Jxj7DifDsW+DlQhKD0wDQYJKoZIhvcN -AQEFBQADggEBANML/P42OuJ9aUV/0fItuIyc1JhqWvSqn5bXj+9eyEegcp8bHLHY -42D1O+z0lNipdjYPSdMJ0wZOEUhr+150SdDQ1P/zQL8AUaLEBkRt7ZdzXPVH3PER -qnf9IrpYBknZKfCAoVchA6Rr9WU3Sd8bMoRfMLKg8c0M8G6EPwCTcOFriSkbtvNG -zd8r8I+WfUYIN/p8DI9JT9qfjVODnYPRMUm6KPvq27TsrGruKrqyaV94kWc8co8A -v3zFLeCtghvUiRBdx+8Q7m5t4CkuSr0WINrqjIPFW2QrM1r82y09Fd16RkqL4LOg -Lh6vB5KnTApv62rWdw7zWwYnjY6/vXYY1Aw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF4DCCA8igAwIBAgIRAPL6ZOJ0Y9ON/RAdBB92ylgwDQYJKoZIhvcNAQELBQAw -ZzELMAkGA1UEBhMCY2gxETAPBgNVBAoTCFN3aXNzY29tMSUwIwYDVQQLExxEaWdp -dGFsIENlcnRpZmljYXRlIFNlcnZpY2VzMR4wHAYDVQQDExVTd2lzc2NvbSBSb290 -IEVWIENBIDIwHhcNMTEwNjI0MDk0NTA4WhcNMzEwNjI1MDg0NTA4WjBnMQswCQYD -VQQGEwJjaDERMA8GA1UEChMIU3dpc3Njb20xJTAjBgNVBAsTHERpZ2l0YWwgQ2Vy -dGlmaWNhdGUgU2VydmljZXMxHjAcBgNVBAMTFVN3aXNzY29tIFJvb3QgRVYgQ0Eg -MjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMT3HS9X6lds93BdY7Bx -UglgRCgzo3pOCvrY6myLURYaVa5UJsTMRQdBTxB5f3HSek4/OE6zAMaVylvNwSqD -1ycfMQ4jFrclyxy0uYAyXhqdk/HoPGAsp15XGVhRXrwsVgu42O+LgrQ8uMIkqBPH -oCE2G3pXKSinLr9xJZDzRINpUKTk4RtiGZQJo/PDvO/0vezbE53PnUgJUmfANykR -HvvSEaeFGHR55E+FFOtSN+KxRdjMDUN/rhPSays/p8LiqG12W0OfvrSdsyaGOx9/ -5fLoZigWJdBLlzin5M8J0TbDC77aO0RYjb7xnglrPvMyxyuHxuxenPaHZa0zKcQv -idm5y8kDnftslFGXEBuGCxobP/YCfnvUxVFkKJ3106yDgYjTdLRZncHrYTNaRdHL -OdAGalNgHa/2+2m8atwBz735j9m9W8E6X47aD0upm50qKGsaCnw8qyIL5XctcfaC -NYGu+HuB5ur+rPQam3Rc6I8k9l2dRsQs0h4rIWqDJ2dVSqTjyDKXZpBy2uPUZC5f -46Fq9mDU5zXNysRojddxyNMkM3OxbPlq4SjbX8Y96L5V5jcb7STZDxmPX2MYWFCB -UWVv8p9+agTnNCRxunZLWB4ZvRVgRaoMEkABnRDixzgHcgplwLa7JSnaFp6LNYth -7eVxV4O1PHGf40+/fh6Bn0GXAgMBAAGjgYYwgYMwDgYDVR0PAQH/BAQDAgGGMB0G -A1UdIQQWMBQwEgYHYIV0AVMCAgYHYIV0AVMCAjASBgNVHRMBAf8ECDAGAQH/AgED -MB0GA1UdDgQWBBRF2aWBbj2ITY1x0kbBbkUe88SAnTAfBgNVHSMEGDAWgBRF2aWB -bj2ITY1x0kbBbkUe88SAnTANBgkqhkiG9w0BAQsFAAOCAgEAlDpzBp9SSzBc1P6x -XCX5145v9Ydkn+0UjrgEjihLj6p7jjm02Vj2e6E1CqGdivdj5eu9OYLU43otb98T -PLr+flaYC/NUn81ETm484T4VvwYmneTwkLbUwp4wLh/vx3rEUMfqe9pQy3omywC0 -Wqu1kx+AiYQElY2NfwmTv9SoqORjbdlk5LgpWgi/UOGED1V7XwgiG/W9mR4U9s70 -WBCCswo9GcG/W6uqmdjyMb3lOGbcWAXH7WMaLgqXfIeTK7KK4/HsGOV1timH59yL -Gn602MnTihdsfSlEvoqq9X46Lmgxk7lq2prg2+kupYTNHAq4Sgj5nPFhJpiTt3tm -7JFe3VE/23MPrQRYCd0EApUKPtN236YQHoA96M2kZNEzx5LH4k5E4wnJTsJdhw4S -nr8PyQUQ3nqjsTzyP6WqJ3mtMX0f/fwZacXduT98zca0wjAefm6S139hdlqP65VN -vBFuIXxZN5nQBrz5Bm0yFqXZaajh3DyAHmBR3NdUIR7KYndP+tiPsys6DXhyyWhB -WkdKwqPrGtcKqzwyVcgKEZzfdNbwQBUdyLmPtTbFr/giuMod89a2GQ+fYWVq6nTI -fI/DT11lgh/ZDYnadXL77/FHZxOzyNEZiCcmmpl5fx7kLD977vHeTYuWl8PVP3wb -I+2ksx0WckNLIOFZfsLorSa/ovc= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4 -MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6 -ZW5wZS5jb20wHhcNMDcxMjEzMTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYD -VQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5j -b20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ03rKDx6sp4boFmVq -scIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAKClaO -xdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6H -LmYRY2xU+zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFX -uaOKmMPsOzTFlUFpfnXCPCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQD -yCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxTOTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+ -JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbKF7jJeodWLBoBHmy+E60Q -rLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK0GqfvEyN -BjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8L -hij+0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIB -QFqNeb+Lz0vPqhbBleStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+ -HMh3/1uaD7euBUbl8agW7EekFwIDAQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2lu -Zm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+SVpFTlBFIFMuQS4gLSBDSUYg -QTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBGNjIgUzgxQzBB -BgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx -MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUA -A4ICAQB4pgwWSp9MiDrAyw6lFn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWb -laQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbgakEyrkgPH7UIBzg/YsfqikuFgba56 -awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8qhT/AQKM6WfxZSzwo -JNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Csg1lw -LDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCT -VyvehQP5aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGk -LhObNA5me0mrZJfQRsN5nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJb -UjWumDqtujWTI6cfSN01RpiyEGjkpTHCClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/ -QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZoQ0iy2+tzJOeRf1SktoA+ -naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1ZWrOZyGls -QyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDczCCAlugAwIBAgIQMDAwMDk3Mzc1NzM4NjAwMDANBgkqhkiG9w0BAQUFADBV -MQswCQYDVQQGEwJGUjETMBEGA1UEChMKQ2VydGlOb21pczEcMBoGA1UECxMTQUMg -UmFjaW5lIC0gUm9vdCBDQTETMBEGA1UEAxMKQ2VydGlOb21pczAeFw0wMDExMDkw -MDAwMDBaFw0xMjExMDkwMDAwMDBaMFUxCzAJBgNVBAYTAkZSMRMwEQYDVQQKEwpD -ZXJ0aU5vbWlzMRwwGgYDVQQLExNBQyBSYWNpbmUgLSBSb290IENBMRMwEQYDVQQD -EwpDZXJ0aU5vbWlzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8SWb -4mS5RXB3ENSIcfrEzCj/TRUQuT1tMCU0YUfXFSgcPdWglIzCv3kvh07QoB+8xMl+ -fQHvSSduAxnNewz0GBY9rApCPKlP6CcnJr74OSVZIiWt9wLfl4wwhNhZOiikIpZp -EdOXWqRc84P5cUlN3Lwmr1sjCWmHfTSS4cAKxfDbFLfE61etosyoFZUTQbIhb1Bf -JL5xRXAUZudQiU42n/yAoSUrN4FLUfPQNlOe1AB81pIgX8g2ojwxDjfgqSs1JmBF -uLKJ45uVLEenQBPmQCGjL3maV86IRmR3a9UGlgvKAk0NBdh8mrQyQvcUlLBIQBCm -l7wppt6maQHUNEPQSwIDAQABoz8wPTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQU+F4ho6ijFeb4tRG7/kIEXU2OgnowDQYJKoZIhvcNAQEF -BQADggEBACe9FJayK6bXkJQrilBFMh75QPdFOks9PJuo86OMUlBDZGYFTCh9Arex -N3KYCnAEzazYIALwr7eASJJDIQMu1Q+pkx/7ACde4kP47F27M2rm+v5HnGooCLz2 -s7Fe/WUycTQqgwF5lNp03m1ce/TvovgkEZeVN5wM/7+SsZLJGDigXGeq48j2g2hn -8OckX9Ciyo0U3/1IVeigNBisiaOlsHSZOEPBZQRiZULob+NVbXVPo8nM1OyP3aHI -LQex1yYcCr9m93nOiZyKkur3Uedf1yMTBe+fflnPFKGYnVqvTGXCKVdHzQBfpILA -AuaC+5ykZhSiSMf8nmL2oPMcLO7YQw4= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUx -KzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAd -BgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNl -YyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgxMDAxMTAyOTU2WhcNMzMxMDAxMjM1 -OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lzdGVtcyBFbnRlcnBy -aXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBDZW50 -ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN -8ELg63iIVl6bmlQdTQyK9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/ -RLyTPWGrTs0NvvAgJ1gORH8EGoel15YUNpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4 -hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZFiP0Zf3WHHx+xGwpzJFu5 -ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W0eDrXltM -EnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGj -QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1 -A/d2O2GCahKqGFPrAyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOy -WL6ukK2YJ5f+AbGwUgC4TeQbIXQbfsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ -1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzTucpH9sry9uetuUg/vBa3wW30 -6gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7hP0HHRwA11fXT -91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml -e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4p -TpPDpFQUWw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1 -MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL -v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8 -eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq -tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd -C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa -zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB -mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH -V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n -bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG -3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs -J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO -291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS -ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd -AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7 -TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDoTCCAomgAwIBAgIQKTZHquOKrIZKI1byyrdhrzANBgkqhkiG9w0BAQUFADBO -MQswCQYDVQQGEwJ1czEYMBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQ0wCwYDVQQL -EwRGQkNBMRYwFAYDVQQDEw1Db21tb24gUG9saWN5MB4XDTA3MTAxNTE1NTgwMFoX -DTI3MTAxNTE2MDgwMFowTjELMAkGA1UEBhMCdXMxGDAWBgNVBAoTD1UuUy4gR292 -ZXJubWVudDENMAsGA1UECxMERkJDQTEWMBQGA1UEAxMNQ29tbW9uIFBvbGljeTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJeNvTMn5K1b+3i9L0dHbsd4 -6ZOcpN7JHP0vGzk4rEcXwH53KQA7Ax9oD81Npe53uCxiazH2+nIJfTApBnznfKM9 -hBiKHa4skqgf6F5PjY7rPxr4nApnnbBnTfAu0DDew5SwoM8uCjR/VAnTNr2kSVdS -c+md/uRIeUYbW40y5KVIZPMiDZKdCBW/YDyD90ciJSKtKXG3d+8XyaK2lF7IMJCk -FEhcVlcLQUwF1CpMP64Sm1kRdXAHImktLNMxzJJ+zM2kfpRHqpwJCPZLr1LoakCR -xVW9QLHIbVeGlRfmH3O+Ry4+i0wXubklHKVSFzYIWcBCvgortFZRPBtVyYyQd+sC -AwEAAaN7MHkwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFC9Yl9ipBZilVh/72at17wI8NjTHMBIGCSsGAQQBgjcVAQQFAgMBAAEwIwYJ -KwYBBAGCNxUCBBYEFHa3YJbdFFYprHWF03BjwbxHhhyLMA0GCSqGSIb3DQEBBQUA -A4IBAQBgrvNIFkBypgiIybxHLCRLXaCRc+1leJDwZ5B6pb8KrbYq+Zln34PFdx80 -CTj5fp5B4Ehg/uKqXYeI6oj9XEWyyWrafaStsU+/HA2fHprA1RRzOCuKeEBuMPdi -4c2Z/FFpZ2wR3bgQo2jeJqVW/TZsN5hs++58PGxrcD/3SDcJjwtCga1GRrgLgwb0 -Gzigf0/NC++DiYeXHIowZ9z9VKEDfgHLhUyxCynDvux84T8PCVI8L6eaSP436REG -WOE2QYrEtr+O3c5Ks7wawM36GpnScZv6z7zyxFSjiDV2zBssRm8MtNHDYXaSdBHq -S4CNHIkRi+xb/xfJSPzn4AYR4oRe ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFYzCCA0ugAwIBAgIBOzANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoGA1UEAxMjU3RhcnRDb20gQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkgRzIwHhcNMTAwMTAxMDEwMDAxWhcNMzkxMjMxMjM1 -OTAxWjBTMQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjEsMCoG -A1UEAxMjU3RhcnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgRzIwggIiMA0G -CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2iTZbB7cgNr2Cu+EWIAOVeq8Oo1XJ -JZlKxdBWQYeQTSFgpBSHO839sj60ZwNq7eEPS8CRhXBF4EKe3ikj1AENoBB5uNsD -vfOpL9HG4A/LnooUCri99lZi8cVytjIl2bLzvWXFDSxu1ZJvGIsAQRSCb0AgJnoo -D/Uefyf3lLE3PbfHkffiAez9lInhzG7TNtYKGXmu1zSCZf98Qru23QumNK9LYP5/ -Q0kGi4xDuFby2X8hQxfqp0iVAXV16iulQ5XqFYSdCI0mblWbq9zSOdIxHWDirMxW -RST1HFSr7obdljKF+ExP6JV2tgXdNiNnvP8V4so75qbsO+wmETRIjfaAKxojAuuK -HDp2KntWFhxyKrOq42ClAJ8Em+JvHhRYW6Vsi1g8w7pOOlz34ZYrPu8HvKTlXcxN -nw3h3Kq74W4a7I/htkxNeXJdFzULHdfBR9qWJODQcqhaX2YtENwvKhOuJv4KHBnM -0D4LnMgJLvlblnpHnOl68wVQdJVznjAJ85eCXuaPOQgeWeU1FEIT/wCc976qUM/i -UUjXuG+v+E5+M5iSFGI6dWPPe/regjupuznixL0sAA7IF6wT700ljtizkC+p2il9 -Ha90OrInwMEePnWjFqmveiJdnxMaz6eg6+OGCtP95paV1yPIN93EfKo2rJgaErHg -TuixO/XWb/Ew1wIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjAdBgNVHQ4EFgQUS8W0QGutHLOlHGVuRjaJhwUMDrYwDQYJKoZIhvcNAQEL -BQADggIBAHNXPyzVlTJ+N9uWkusZXn5T50HsEbZH77Xe7XRcxfGOSeD8bpkTzZ+K -2s06Ctg6Wgk/XzTQLwPSZh0avZyQN8gMjgdalEVGKua+etqhqaRpEpKwfTbURIfX -UfEpY9Z1zRbkJ4kd+MIySP3bmdCPX1R0zKxnNBFi2QwKN4fRoxdIjtIXHfbX/dtl -6/2o1PXWT6RbdejF0mCy2wl+JYt7ulKSnj7oxXehPOBKc2thz4bcQ///If4jXSRK -9dNtD2IEBVeC2m6kMyV5Sy5UGYvMLD0w6dEG/+gyRr61M3Z3qAFdlsHB1b6uJcDJ -HgoJIIihDsnzb02CVAAgp9KP5DlUFy6NHrgbuxu9mk47EDTcnIhT76IxW1hPkWLI -wpqazRVdOKnWvvgTtZ8SafJQYqz7Fzf07rh1Z2AQ+4NQ+US1dZxAF7L+/XldblhY -XzD8AK6vM8EOTmy6p6ahfzLbOOCxchcKK5HsamMm7YnUeMx0HgX4a/6ManY5Ka5l -IxKVCCIcl85bBu4M4ru8H0ST9tg4RQUh7eStqxK2A6RCLi3ECToDZ2mEmuFZkIoo -hdVddLHRDiBYmxOlsGOm7XtH/UVVMKTumtTm4ofvmMkyghEpIrwACjFeLQ/Ajulr -so8uBtjRkcfGEvRM/TAXw8HaOFvjqermobp573PYtlNXLfbQ4ddI ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP -MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAx -MDQwNjA3Mjk0MFoXDTIxMDQwNjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNV -BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMiBDQTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3/Ei9vX+ALTU74W+o -Z6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybTdXnt -5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s -3TmVToMGf+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2Ej -vOr7nQKV0ba5cTppCD8PtOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu -8nYybieDwnPz3BjotJPqdURrBGAgcVeHnfO+oJAjPYok4doh28MCAwEAAaMzMDEw -DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITTXjwwCwYDVR0PBAQDAgEG -MA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt0jSv9zil -zqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/ -3DEIcbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvD -FNr450kkkdAdavphOe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6 -Tk6ezAyNlNzZRZxe7EJQY670XcSxEtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2 -ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLHllpwrN9M ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJKUDEO -MAwGA1UEChMFTEdQS0kxGjAYBgNVBAsTEUFwcGxpY2F0aW9uIENBIEcyMB4XDTA2 -MDMzMTE1MDAwMFoXDTE2MDMzMTE0NTk1OVowOTELMAkGA1UEBhMCSlAxDjAMBgNV -BAoTBUxHUEtJMRowGAYDVQQLExFBcHBsaWNhdGlvbiBDQSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBALk1xhD422jbB8RATLAdHjbcw0H2z1UVbQh/ -XMZoVeXnV/GWUebhTXgPbkAVcDtl/hHf59PWWDU74Z8C/JRSRi6znmCbAp7JgtL2 -464JT4REtmKbAFFouDqt7GTRMkvplESDtA7OIYlrsDbAmMZLnMI+W2AqCTErLatM -3rGg/VhWwoMdILzEhAmHe6iVl8YljoPgPpMN0cd9c6mo/BkAQC4iuHozQfV4/Vpx -54LZSIhc7KiFhy1tgIlnGmm+EMBaju2IfT5vLDhrN85H2KIxMN5+U2Vsi4ZTQSBs -vUilfq8AWlYSWIHR3IlZ+bXu+E2a2EQpi3mn9yKq6nxctBaIIA0CAwEAAaOBsjCB -rzAdBgNVHQ4EFgQUf7hdjsQYa8Z9zC7prs405xdd4KEwDgYDVR0PAQH/BAQDAgEG -MEwGA1UdHwRFMEMwQaA/oD2kOzA5MQswCQYDVQQGEwJKUDEOMAwGA1UEChMFTEdQ -S0kxGjAYBgNVBAsTEUFwcGxpY2F0aW9uIENBIEcyMA8GA1UdEwEB/wQFMAMBAf8w -HwYDVR0jBBgwFoAUf7hdjsQYa8Z9zC7prs405xdd4KEwDQYJKoZIhvcNAQEFBQAD -ggEBADzYczZABkhKVBn1J0g5JaVuQue2zRvLOTS3m+xPKr535MqE/B3rmyJA1fT7 -aIdy/Eddag5SSuO1XUjGIpbmM21tq/bN18skWoyoRZ4+YYJ9lNUF8Bo1X3EvLlS1 -QQXvhg1S75yYG/EsTDrR84bTjD56L4ZFjoMyJlu/U8oOUVbcmsJaMBkNp57Vqpsg -OWl4IfSXbdEOEUwu0xtasPmXeFwqj1Jl7kxCJcI3MA5tKzWUgwbor0U7BGanMLv5 -4CE7Y259RF06alPvERck/VSyWmxzViHJbC2XpEKzJ2EFIWNt6ii8TxpvQtyYq1XT -HhvAkj+bweY7F1bixJhDJe62ywA= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICZzCCAdCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQGEwJVUzEY -MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNEb0QxDDAKBgNVBAsT -A1BLSTEcMBoGA1UEAxMTRG9EIENMQVNTIDMgUm9vdCBDQTAeFw0wMDA1MTkxMzEz -MDBaFw0yMDA1MTQxMzEzMDBaMGExCzAJBgNVBAYTAlVTMRgwFgYDVQQKEw9VLlMu -IEdvdmVybm1lbnQxDDAKBgNVBAsTA0RvRDEMMAoGA1UECxMDUEtJMRwwGgYDVQQD -ExNEb0QgQ0xBU1MgMyBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB -gQC1MP5kvurMbe2BLPd/6Rm6DmlqKOGpqcuVWB/x5pppU+CIP5HFUbljl6jmIYwT -XjY8qFf6+HAsTGrLvzCnTBbkMlz4ErBR+BZXjS+0TfouqJToKmHUVw1Hzm4sL36Y -Z8wACKu2lhY1woWR5VugCsdmUmLzYXWVF668KlYppeArUwIDAQABoy8wLTAdBgNV -HQ4EFgQUbJyl8FyPbUGNxBc7kFfCD6PNbf4wDAYDVR0TBAUwAwEB/zANBgkqhkiG -9w0BAQUFAAOBgQCvcUT5lyPMaGmMQwdBuoggsyIAQciYoFUczT9usZNcrfoYmrsc -c2/9JEKPh59Rz76Gn+nXikhPCNlplKw/5g8tlw8ok3ZPYt//oM1h+KaGDDE0INx/ -L6j7Ob6V7jhZAmLB3mwVT+DfnbvkeXMk/WNklfdKqJkfSGWVx3u/eDLneg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFUjCCBDqgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJLUjEN -MAsGA1UEChMES0lTQTEuMCwGA1UECxMlS29yZWEgQ2VydGlmaWNhdGlvbiBBdXRo -b3JpdHkgQ2VudHJhbDEWMBQGA1UEAxMNS0lTQSBSb290Q0EgMzAeFw0wNDExMTkw -NjM5NTFaFw0xNDExMTkwNjM5NTFaMGQxCzAJBgNVBAYTAktSMQ0wCwYDVQQKEwRL -SVNBMS4wLAYDVQQLEyVLb3JlYSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBDZW50 -cmFsMRYwFAYDVQQDEw1LSVNBIFJvb3RDQSAzMIIBIDANBgkqhkiG9w0BAQEFAAOC -AQ0AMIIBCAKCAQEA3rrtF2Wu0b1KPazbgHLMWOHn4ZPazDB6z+8Lri2nQ6u/p0LP -CFYIpEcdffqG79gwlyY0YTyADvjU65/8IjAboW0+40zSVU4WQDfC9gdu2we1pYyW -geKbXH6UYcjOhDyx+gDmctMJhXfp3F4hT7TkTvTiF6tQrxz/oTlYdVsSspa5jfBw -YkhbVigqpYeRNrkeJPW5unu2UlFbF1pgBWycwubGjD756t08jP+J3kNwrB248XXN -OMpTDUdoasY8GMq94bS+DvTQ49IT+rBRERHUQavo9DmO4TSETwuTqmo4/OXGeEeu -dhf6oYA3BgAVCP1rI476cg2V1ktisWjC3TSbXQIBA6OCAg8wggILMB8GA1UdIwQY -MBaAFI+B8NqmzXQ8vmb0FWtGpP4GKMyqMB0GA1UdDgQWBBSPgfDaps10PL5m9BVr -RqT+BijMqjAOBgNVHQ8BAf8EBAMCAQYwggEuBgNVHSAEggElMIIBITCCAR0GBFUd -IAAwggETMDAGCCsGAQUFBwIBFiRodHRwOi8vd3d3LnJvb3RjYS5vci5rci9yY2Ev -Y3BzLmh0bWwwgd4GCCsGAQUFBwICMIHRHoHOx3QAIMd4yZ3BHLKUACCs9cd4x3jJ -ncEcx4WyyLLkACgAVABoAGkAcwAgAGMAZQByAHQAaQBmAGkAYwBhAHQAZQAgAGkA -cwAgAGEAYwBjAHIAZQBkAGkAdABlAGQAIAB1AG4AZABlAHIAIABFAGwAZQBjAHQA -cgBvAG4AaQBjACAAUwBpAGcAbgBhAHQAdQByAGUAIABBAGMAdAAgAG8AZgAgAHQA -aABlACAAUgBlAHAAdQBiAGwAaQBjACAAbwBmACAASwBvAHIAZQBhACkwMwYDVR0R -BCwwKqQoMCYxJDAiBgNVBAMMG+2VnOq1reygleuztOuztO2YuOynhO2dpeybkDAz -BgNVHRIELDAqpCgwJjEkMCIGA1UEAwwb7ZWc6rWt7KCV67O067O07Zi47KeE7Z2l -7JuQMA8GA1UdEwEB/wQFMAMBAf8wDAYDVR0kBAUwA4ABADANBgkqhkiG9w0BAQUF -AAOCAQEAz9b3Dv2wjG4FFY6oXCuyWtEeV6ZeGKqCEQj8mbdbp+PI0qLT+SQ09+Pk -rolUR9NpScmAwRHr4inH9gaLX7riXs+rw87P7pIl3J85Hg4D9N6QW6FwmVzHc07J -pHVJeyWhn4KSjU3sYcUMMqfHODiAVToqgx2cZHm5Dac1Smjvj/8F2LpOVmHY+Epw -mAiWk9hgxzrsX58dKzVPSBShmrtv7tIDhlPxEMcHVGJeNo7iHCsdF03m9VrvirqC -6HfZKBF+N4dKlArJQOk1pTr7ZD7yXxZ683bXzu4/RB1Fql8RqlMcOh9SUWJUD6OQ -Nc9Nb7rHviwJ8TX4Absk3TC8SA/u2Q== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4G -A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNp -Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4 -MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEG -A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWtiHL8 -RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT -gHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm -KPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd -QQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ -XriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o -LkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU -RUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp -jjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK -6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX -mcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs -Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH -WD9f ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG -A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 -d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu -dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq -RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy -MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD -VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 -L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g -Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD -ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi -A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt -ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH -Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O -BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC -R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX -hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYD -VQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0 -IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3 -MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xKTAnBgNVBAMTIENoYW1iZXJz -IG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEyMjk1MFoXDTM4MDcz -MTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBj -dXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIw -EAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEp -MCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0G -CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW9 -28sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKAXuFixrYp4YFs8r/lfTJq -VKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorjh40G072Q -DuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR -5gN/ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfL -ZEFHcpOrUMPrCXZkNNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05a -Sd+pZgvMPMZ4fKecHePOjlO+Bd5gD2vlGts/4+EhySnB8esHnFIbAURRPHsl18Tl -UlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331lubKgdaX8ZSD6e2wsWsSaR6s -+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ0wlf2eOKNcx5 -Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj -ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAx -hduub+84Mxh2EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNV -HQ4EFgQU+SSsD7K1+HnA+mCIG8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1 -+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpN -YWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29t -L2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVy -ZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAt -IDIwMDiCCQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRV -HSAAMCowKAYIKwYBBQUHAgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20w -DQYJKoZIhvcNAQEFBQADggIBAJASryI1wqM58C7e6bXpeHxIvj99RZJe6dqxGfwW -PJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH3qLPaYRgM+gQDROpI9CF -5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbURWpGqOt1 -glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaH -FoI6M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2 -pSB7+R5KBWIBpih1YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MD -xvbxrN8y8NmBGuScvfaAFPDRLLmF9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QG -tjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcKzBIKinmwPQN/aUv0NCB9szTq -jktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvGnrDQWzilm1De -fhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg -OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZ -d0jQ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV -BAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2ln -biBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBF -MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMR8wHQYDVQQDExZT -d2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC -CgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUqt2/8 -76LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+ -bbqBHH5CjCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c -6bM8K8vzARO/Ws/BtQpgvd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqE -emA8atufK+ze3gE/bk3lUIbLtK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJd -MmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdt -MDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02y -MszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69y -FGkOpeUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPi -aG59je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM -gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCB -qTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUWyV7 -lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn -8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov -L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe6 -45R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczO -UYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5 -O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCC -bwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yv -GPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a -77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCC -hdiDyyJkvC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid3 -92qgQmwLOM7XdVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEpp -Ld6leNcG2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+w -ZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt -Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNV -BAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4X -DTA3MDYyOTE1MTMwNVoXDTI3MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQ -BgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwIQ2VydGlnbmEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7qXOEm7RFHYeGifBZ4 -QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyHGxny -gQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbw -zBfsV1/pogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q -130yGLMLLGq/jj8UEYkgDncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2 -JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKfIrjxwo1p3Po6WAbfAgMBAAGjgbwwgbkw -DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQtCRZvgHyUtVF9lo53BEw -ZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJBgNVBAYT -AkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzj -AQ/JSP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG -9w0BAQUFAAOCAQEAhQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8h -bV6lUmPOEvjvKtpv6zf+EwLHyzs+ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFnc -fca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1kluPBS1xp81HlDQwY9qcEQCYsuu -HWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY1gkIl2PlwS6w -t0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw -WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBAjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3Mg -Q2xhc3MgMyBDQSAxMB4XDTA1MDUwOTE0MTMwM1oXDTE1MDUwOTE0MTMwM1owSzEL -MAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MR0wGwYD -VQQDDBRCdXlwYXNzIENsYXNzIDMgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAKSO13TZKWTeXx+HgJHqTjnmGcZEC4DVC69TB4sSveZn8AKxifZg -isRbsELRwCGoy+Gb72RRtqfPFfV0gGgEkKBYouZ0plNTVUhjP5JW3SROjvi6K//z -NIqeKNc0n6wv1g/xpC+9UrJJhW05NfBEMJNGJPO251P7vGGvqaMU+8IXF4Rs4HyI -+MkcVyzwPX6UvCWThOiaAJpFBUJXgPROztmuOfbIUxAMZTpHe2DC1vqRycZxbL2R -hzyRhkmr8w+gbCZ2Xhysm3HljbybIR6c1jh+JIAVMYKWsUnTYjdbiAwKYjT+p0h+ -mbEwi5A3lRyoH6UsjfRVyNvdWQrCrXig9IsCAwEAAaNCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUOBTmyPCppAP0Tj4io1vy1uCtQHQwDgYDVR0PAQH/BAQD -AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQABZ6OMySU9E2NdFm/soT4JXJEVKirZgCFP -Bdy7pYmrEzMqnji3jG8CcmPHc3ceCQa6Oyh7pEfJYWsICCD8igWKH7y6xsL+z27s -EzNxZy5p+qksP2bAEllNC1QCkoS72xLvg3BweMhT+t/Gxv/ciC8HwEmdMldg0/L2 -mSlf56oBzKwzqBwKu5HEA6BvtjT5htOzdlSY9EqBs1OdTUDs5XcTRa9bqh/YL0yC -e/4qxFi7T/ye/QNlGioOw6UgFpRreaaiErS7GqQjel/wroQk5PMr+4okoyeYZdow -dXb8GZHo2+ubPzK/QJcHJrrM85SFSnonk8+QQtS4Wxam58tAA915 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDqzCCApOgAwIBAgIRAMcoRwmzuGxFjB36JPU2TukwDQYJKoZIhvcNAQEFBQAw -PDEbMBkGA1UEAxMSQ29tU2lnbiBTZWN1cmVkIENBMRAwDgYDVQQKEwdDb21TaWdu -MQswCQYDVQQGEwJJTDAeFw0wNDAzMjQxMTM3MjBaFw0yOTAzMTYxNTA0NTZaMDwx -GzAZBgNVBAMTEkNvbVNpZ24gU2VjdXJlZCBDQTEQMA4GA1UEChMHQ29tU2lnbjEL -MAkGA1UEBhMCSUwwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGtWhf -HZQVw6QIVS3joFd67+l0Kru5fFdJGhFeTymHDEjWaueP1H5XJLkGieQcPOqs49oh -gHMhCu95mGwfCP+hUH3ymBvJVG8+pSjsIQQPRbsHPaHA+iqYHU4Gk/v1iDurX8sW -v+bznkqH7Rnqwp9D5PGBpX8QTz7RSmKtUxvLg/8HZaWSLWapW7ha9B20IZFKF3ue -Mv5WJDmyVIRD9YTC2LxBkMyd1mja6YJQqTtoz7VdApRgFrFD2UNd3V2Hbuq7s8lr -9gOUCXDeFhF6K+h2j0kQmHe5Y1yLM5d19guMsqtb3nQgJT/j8xH5h2iGNXHDHYwt -6+UarA9z1YJZQIDTAgMBAAGjgacwgaQwDAYDVR0TBAUwAwEB/zBEBgNVHR8EPTA7 -MDmgN6A1hjNodHRwOi8vZmVkaXIuY29tc2lnbi5jby5pbC9jcmwvQ29tU2lnblNl -Y3VyZWRDQS5jcmwwDgYDVR0PAQH/BAQDAgGGMB8GA1UdIwQYMBaAFMFL7XC29z58 -ADsAj8c+DkWfHl3sMB0GA1UdDgQWBBTBS+1wtvc+fAA7AI/HPg5Fnx5d7DANBgkq -hkiG9w0BAQUFAAOCAQEAFs/ukhNQq3sUnjO2QiBq1BW9Cav8cujvR3qQrFHBZE7p -iL1DRYHjZiM/EoZNGeQFsOY3wo3aBijJD4mkU6l1P7CW+6tMM1X5eCZGbxs2mPtC -dsGCuY7e+0X5YxtiOzkGynd6qDwJz2w2PQ8KRUtpFhpFfTMDZflScZAmlaxMDPWL -kz/MdXSFmLr/YnpNH4n+rr2UAJm/EaXc4HnFFgt9AmEd6oX5AhVP51qJThRv4zdL -hfXBPGHg/QVBspJ/wx2g0K5SZGBrGMYmnNj1ZOQ2GmKfig8+/21OGVZOIJFsnzQz -OjRXUDpvgV4GxvU+fE6OK85lBi5d0ipTdF7Tbieejw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB -mDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsT -MChjKSAyMDA4IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s -eTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhv -cml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIzNTk1OVowgZgxCzAJ -BgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg -MjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0 -BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg -LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz -+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5jK/BGvESyiaHAKAxJcCGVn2TAppMSAmUm -hsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdEc5IiaacDiGydY8hS2pgn -5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3CIShwiP/W -JmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exAL -DmKudlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZC -huOl1UcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw -HQYDVR0OBBYEFMR5yo6hTgMdHNxr2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IB -AQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9cr5HqQ6XErhK8WTTOd8lNNTB -zU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbEAp7aDHdlDkQN -kv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD -AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUH -SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G -spki4cErx5z481+oghLrGREt ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBe -MQswCQYDVQQGEwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0 -ZC4xKjAoBgNVBAsMIWVQS0kgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMxMjdaMF4xCzAJBgNVBAYTAlRXMSMw -IQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEqMCgGA1UECwwhZVBL -SSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEF -AAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAH -SyZbCUNsIZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAh -ijHyl3SJCRImHJ7K2RKilTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3X -DZoTM1PRYfl61dd4s5oz9wCGzh1NlDivqOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1 -TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX12ruOzjjK9SXDrkb5wdJ -fzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0OWQqraffA -sgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uU -WH1+ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLS -nT0IFaUQAS2zMnaolQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pH -dmX2Os+PYhcZewoozRrSgx4hxyy/vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJip -NiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXiZo1jDiVN1Rmy5nk3pyKdVDEC -AwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/QkqiMAwGA1UdEwQF -MAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH -ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGB -uvl2ICO1J2B01GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6Yl -PwZpVnPDimZI+ymBV3QGypzqKOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkP -JXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdVxrsStZf0X4OFunHB2WyBEXYKCrC/ -gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEPNXubrjlpC2JgQCA2 -j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+rGNm6 -5ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUB -o2M3IUxExJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS -/jQ6fbjpKdx2qcgw+BRxgMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2z -Gp1iro2C6pSe3VkQw63d4k3jMdXH7OjysP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTE -W9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmODBCEIZ43ygknQW/2xzQ+D -hNQ+IIX3Sj0rnP0qCglN6oH4EZw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEXzCCA0egAwIBAgIBATANBgkqhkiG9w0BAQUFADCB0DELMAkGA1UEBhMCRVMx -SDBGBgNVBAoTP0laRU5QRSBTLkEuIC0gQ0lGIEEtMDEzMzcyNjAtUk1lcmMuVml0 -b3JpYS1HYXN0ZWl6IFQxMDU1IEY2MiBTODFCMEAGA1UEBxM5QXZkYSBkZWwgTWVk -aXRlcnJhbmVvIEV0b3JiaWRlYSAzIC0gMDEwMTAgVml0b3JpYS1HYXN0ZWl6MRMw -EQYDVQQDEwpJemVucGUuY29tMR4wHAYJKoZIhvcNAQkBFg9JbmZvQGl6ZW5wZS5j -b20wHhcNMDMwMTMwMjMwMDAwWhcNMTgwMTMwMjMwMDAwWjCB0DELMAkGA1UEBhMC -RVMxSDBGBgNVBAoTP0laRU5QRSBTLkEuIC0gQ0lGIEEtMDEzMzcyNjAtUk1lcmMu -Vml0b3JpYS1HYXN0ZWl6IFQxMDU1IEY2MiBTODFCMEAGA1UEBxM5QXZkYSBkZWwg -TWVkaXRlcnJhbmVvIEV0b3JiaWRlYSAzIC0gMDEwMTAgVml0b3JpYS1HYXN0ZWl6 -MRMwEQYDVQQDEwpJemVucGUuY29tMR4wHAYJKoZIhvcNAQkBFg9JbmZvQGl6ZW5w -ZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1btoCXXhp3xIW -D+Bxl8nUCxkyiazWfpt0e68t+Qt9+lZjKZSdEw2Omj4qvr+ovRmDXO3iWpWVOWDl -3JHJjAzFCe8ZEBNDH+QNYwZHmPBaMYFOYFdbAFVHWvys152C308hcFJ6xWWGmjvl -2eMiEl9P2nR2LWue368DCu+ak7j3gjAXaCOdP1a7Bfr+RW3X2SC5R4Xyp8iHlL5J -PHJD/WBkLrezwzQPdACw8m9EG7q9kUwlNpL32mROujS3ZkT6mQTzJieLiE3X04s0 -uIUqVkk5MhjcHFf7al0N5CzjtTcnXYJKN2Z9EDVskk4olAdGi46eSoZXbjUOP5gk -Ej6wVZAXAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEG -MB0GA1UdDgQWBBTqVk/sPIOhFIh4gbIrBSLAB0FbQjANBgkqhkiG9w0BAQUFAAOC -AQEAYp7mEzzhw6o5Hf5+T5kcI+t4BJyiIWy7vHlLs/G8dLYXO81aN/Mzg928eMTR -TxxYZL8dd9uwsJ50TVfX6L0R4Dyw6wikh3fHRrat9ufXi63j5K91Ysr7aXqnF38d -iAgHYkrwC3kuxHBb9C0KBz6h8Q45/KCyN7d37wWAq38yyhPDlaOvyoE6bdUuK5hT -m5EYA5JmPyrhQ1moDOyueWBAjxzMEMj+OAY1H90cLv6wszsqerxRrdTOHBdv7MjB -EIpvEEQkXUxVXAzFuuT6m2t91Lfnwfl/IvljHaVC7DlyyhRYHD6D4Rx+4QKp4tWL -vpw6LkI+gKNJ/YdMCsRZQzEEFA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBi -MQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu -MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3Jp -dHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMxMjM1OTU5WjBiMQswCQYDVQQGEwJV -UzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydO -ZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwz -c7MEL7xxjOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPP -OCwGJgl6cvf6UDL4wpPTaaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rl -mGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXTcrA/vGp97Eh/jcOrqnErU2lBUzS1sLnF -BgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc/Qzpf14Dl847ABSHJ3A4 -qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMBAAGjgZcw -gZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwu -bmV0c29sc3NsLmNvbS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3Jp -dHkuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc8 -6fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q4LqILPxFzBiwmZVRDuwduIj/ -h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/GGUsyfJj4akH -/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv -wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHN -pGxlaKFJdlxDydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCB -vTELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL -ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJp -U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MTgwNgYDVQQDEy9W -ZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAe -Fw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJVUzEX -MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0 -IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9y -IGF1dGhvcml6ZWQgdXNlIG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNh -bCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj1mCOkdeQmIN65lgZOIzF -9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGPMiJhgsWH -H26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+H -LL729fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN -/BMReYTtXlT2NJ8IAfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPT -rJ9VAMf2CGqUuV/c4DPxhGD5WycRtPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1Ud -EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0GCCsGAQUFBwEMBGEwX6FdoFsw -WTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2Oa8PPgGrUSBgs -exkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud -DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4 -sAPmLGd75JR3Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+ -seQxIcaBlVZaDrHC1LGmWazxY8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz -4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTxP/jgdFcrGJ2BtMQo2pSXpXDrrB2+ -BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+PwGZsY6rp2aQW9IHR -lRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4mJO3 -7M2CYfE45k+XmCpajQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIECTCCAvGgAwIBAgIQDV6ZCtadt3js2AdWO4YV2TANBgkqhkiG9w0BAQUFADBb -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3Qx -ETAPBgNVBAsTCERTVCBBQ0VTMRcwFQYDVQQDEw5EU1QgQUNFUyBDQSBYNjAeFw0w -MzExMjAyMTE5NThaFw0xNzExMjAyMTE5NThaMFsxCzAJBgNVBAYTAlVTMSAwHgYD -VQQKExdEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdDERMA8GA1UECxMIRFNUIEFDRVMx -FzAVBgNVBAMTDkRTVCBBQ0VTIENBIFg2MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEAuT31LMmU3HWKlV1j6IR3dma5WZFcRt2SPp/5DgO0PWGSvSMmtWPu -ktKe1jzIDZBfZIGxqAgNTNj50wUoUrQBJcWVHAx+PhCEdc/BGZFjz+iokYi5Q1K7 -gLFViYsx+tC3dr5BPTCapCIlF3PoHuLTrCq9Wzgh1SpL11V94zpVvddtawJXa+ZH -fAjIgrrep4c9oW24MFbCswKBXy314powGCi4ZtPLAZZv6opFVdbgnf9nKxcCpk4a -ahELfrd755jWjHZvwTvbUJN+5dCOHze4vbrGn2zpfDPyMjwmR/onJALJfh1biEIT -ajV8fTXpLmaRcpPVMibEdPVTo7NdmvYJywIDAQABo4HIMIHFMA8GA1UdEwEB/wQF -MAMBAf8wDgYDVR0PAQH/BAQDAgHGMB8GA1UdEQQYMBaBFHBraS1vcHNAdHJ1c3Rk -c3QuY29tMGIGA1UdIARbMFkwVwYKYIZIAWUDAgEBATBJMEcGCCsGAQUFBwIBFjto -dHRwOi8vd3d3LnRydXN0ZHN0LmNvbS9jZXJ0aWZpY2F0ZXMvcG9saWN5L0FDRVMt -aW5kZXguaHRtbDAdBgNVHQ4EFgQUCXIGThhDD+XWzMNqizF7eI+og7gwDQYJKoZI -hvcNAQEFBQADggEBAKPYjtay284F5zLNAdMEA+V25FYrnJmQ6AgwbN99Pe7lv7Uk -QIRJ4dEorsTCOlMwiPH1d25Ryvr/ma8kXxug/fKshMrfqfBfBC6tFr8hlxCBPeP/ -h40y3JTlR4peahPJlJU90u7INJXQgNStMgiAVDzgvVJT11J8smk/f3rPanTK+gQq -nExaBqXpIK1FZg9p8d2/6eMyi/rgwYZNcjwu2JN4Cir42NInPRmJX1p7ijvMDNpR -rscL9yuwNwXsvFcj4jjSm2jzVhKIT0J8uDHEtdvkyCE06UgRNe76x5JXxZ805Mf2 -9w4LTJxoeHtxMcfrHuBnQfO3oKfN5XozNmr6mis= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBl -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv -b3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQG -EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl -cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSA -n61UQbVH35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4Htecc -biJVMWWXvdMX0h5i89vqbFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9Hp -EgjAALAcKxHad3A2m67OeYfcgnDmCXRwVWmvo2ifv922ebPynXApVfSr/5Vh88lA -bx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OPYLfykqGxvYmJHzDNw6Yu -YjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+RnlTGNAgMB -AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQW -BBTOw0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPI -QW5pJ6d1Ee88hjZv0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I -0jJmwYrA8y8678Dj1JGG0VDjA9tzd29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4Gni -lmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAWhsI6yLETcDbYz+70CjTVW0z9 -B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0MjomZmWzwPDCv -ON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo -IhNzbM8m9Yop5w== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzES -MBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFU -V0NBIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMz -WhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJVEFJV0FO -LUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFE -AcK0HMMxQhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HH -K3XLfJ+utdGdIzdjp9xCoi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeX -RfwZVzsrb+RH9JlF/h3x+JejiB03HFyP4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/z -rX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1ry+UPizgN7gr8/g+YnzAx -3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkq -hkiG9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeC -MErJk/9q56YAf4lCmtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdls -XebQ79NqZp4VKIV66IIArB6nCWlWQtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62D -lhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVYT0bf+215WfKEIlKuD8z7fDvn -aspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocnyYh0igzyXxfkZ -YiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIE5zCCA8+gAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjTELMAkGA1UEBhMCQ0Ex -EDAOBgNVBAgTB09udGFyaW8xEDAOBgNVBAcTB1Rvcm9udG8xHTAbBgNVBAoTFEVj -aG93b3J4IENvcnBvcmF0aW9uMR8wHQYDVQQLExZDZXJ0aWZpY2F0aW9uIFNlcnZp -Y2VzMRowGAYDVQQDExFFY2hvd29yeCBSb290IENBMjAeFw0wNTEwMDYxMDQ5MTNa -Fw0zMDEwMDcxMDQ5MTNaMIGNMQswCQYDVQQGEwJDQTEQMA4GA1UECBMHT250YXJp -bzEQMA4GA1UEBxMHVG9yb250bzEdMBsGA1UEChMURWNob3dvcnggQ29ycG9yYXRp -b24xHzAdBgNVBAsTFkNlcnRpZmljYXRpb24gU2VydmljZXMxGjAYBgNVBAMTEUVj -aG93b3J4IFJvb3QgQ0EyMIIBIDANBgkqhkiG9w0BAQEFAAOCAQ0AMIIBCAKCAQEA -utU/5BkV15UBf+s+JQruKQxr77s3rjp/RpOtmhHILIiO5gsEWP8MMrfrVEiidjI6 -Qh6ans0KAWc2Dw0/j4qKAQzOSyAZgjcdypNTBZ7muv212DA2Pu41rXqwMrlBrVi/ -KTghfdLlNRu6JrC5y8HarrnRFSKF1Thbzz921kLDRoCi+FVs5eVuK5LvIfkhNAqA -byrTgO3T9zfZgk8upmEkANPDL1+8y7dGPB/d6lk0I5mv8PESKX02TlvwgRSIiTHR -k8++iOPLBWlGp7ZfqTEXkPUZhgrQQvxcrwCUo6mk8TqgxCDP5FgPoHFiPLef5szP -ZLBJDWp7GLyE1PmkQI6WiwIBA6OCAVAwggFMMA8GA1UdEwEB/wQFMAMBAf8wCwYD -VR0PBAQDAgEGMB0GA1UdDgQWBBQ74YEboKs/OyGC1eISrq5QqxSlEzCBugYDVR0j -BIGyMIGvgBQ74YEboKs/OyGC1eISrq5QqxSlE6GBk6SBkDCBjTELMAkGA1UEBhMC -Q0ExEDAOBgNVBAgTB09udGFyaW8xEDAOBgNVBAcTB1Rvcm9udG8xHTAbBgNVBAoT -FEVjaG93b3J4IENvcnBvcmF0aW9uMR8wHQYDVQQLExZDZXJ0aWZpY2F0aW9uIFNl -cnZpY2VzMRowGAYDVQQDExFFY2hvd29yeCBSb290IENBMoIBADBQBgNVHSAESTBH -MEUGCysGAQQB+REKAQMBMDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cuZWNob3dv -cnguY29tL2NhL3Jvb3QyL2Nwcy5wZGYwDQYJKoZIhvcNAQEFBQADggEBAG+nrPi/ -0RpfEzrj02C6JGPUar4nbjIhcY6N7DWNeqBoUulBSIH/PYGNHYx7/lnJefiixPGE -7TQ5xPgElxb9bK8zoAApO7U33OubqZ7M7DlHnFeCoOoIAZnG1kuwKwD5CXKB2a74 -HzcqNnFW0IsBFCYqrVh/rQgJOzDA8POGbH0DeD0xjwBBooAolkKT+7ZItJF1Pb56 -QpDL9G+16F7GkmnKlAIYT3QTS3yFGYChnJcd+6txUPhKi9sSOOmAIaKHnkH9Scz+ -A2cSi4A3wUYXVatuVNHpRb2lygfH3SuCX9MU8Ure3zBlSU1LALtMqI4JmcQmQpIq -zIzvO2jHyu9PQqo= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOLmoAAQACH9dSISwRXDswDQYJKoZIhvcNAQEFBQAwdjEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNV -BAsTGVRDIFRydXN0Q2VudGVyIENsYXNzIDIgQ0ExJTAjBgNVBAMTHFRDIFRydXN0 -Q2VudGVyIENsYXNzIDIgQ0EgSUkwHhcNMDYwMTEyMTQzODQzWhcNMjUxMjMxMjI1 -OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1c3RDZW50ZXIgR21i -SDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQTElMCMGA1UEAxMc -VEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMiBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAKuAh5uO8MN8h9foJIIRszzdQ2Lu+MNF2ujhoF/RKrLqk2jf -tMjWQ+nEdVl//OEd+DFwIxuInie5e/060smp6RQvkL4DUsFJzfb95AhmC1eKokKg -uNV/aVyQMrKXDcpK3EY+AlWJU+MaWss2xgdW94zPEfRMuzBwBJWl9jmM/XOBCH2J -XjIeIqkiRUuwZi4wzJ9l/fzLganx4Duvo4bRierERXlQXa7pIXSSTYtZgo+U4+lK -8edJsBTj9WLL1XK9H7nSn6DNqPoByNkN39r8R52zyFTfSUrxIan+GE7uSNQZu+99 -5OKdy1u2bv/jzVrndIIFuoAlOMvkaZ6vQaoahPUCAwEAAaOCATQwggEwMA8GA1Ud -EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTjq1RMgKHbVkO3 -kUrL84J6E1wIqzCB7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRy -dXN0Y2VudGVyLmRlL2NybC92Mi90Y19jbGFzc18yX2NhX0lJLmNybIaBn2xkYXA6 -Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBUcnVzdENlbnRlciUyMENsYXNz -JTIwMiUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21iSCxPVT1yb290 -Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEAjNfffu4bgBCzg/XbEeprS6iS -GNn3Bzn1LL4GdXpoUxUc6krtXvwjshOg0wn/9vYua0Fxec3ibf2uWWuFHbhOIprt -ZjluS5TmVfwLG4t3wVMTZonZKNaL80VKY7f9ewthXbhtvsPcW3nS7Yblok2+XnR8 -au0WOB9/WIFaGusyiC2y8zl3gK9etmF1KdsjTYjKUCjLhdLTEKJZbtOTVAB6okaV -hgWcqRmY5TFyDADiZ9lA4CQze28suVyrZZ0srHbqNZn1l7kPJOzHdiEoZa5X6AeI -dUpWoNIFOqTmjZKILPPy4cHGYdtBxceb9w4aUUXCYWvcZCcXjFq32nQozZfkvQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB -gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk -MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY -UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx -NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3 -dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy -dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB -dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6 -38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP -KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q -DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4 -qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa -JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi -PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P -BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs -jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0 -eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD -ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR -vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt -qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa -IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy -i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ -O+7ETPTsJ3xCwnR8gooJybQDJbw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDOzCCAiOgAwIBAgIRANAeRlAAACmMAAAAAgAAAAIwDQYJKoZIhvcNAQEFBQAw -PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD -Ew5EU1QgUm9vdCBDQSBYNDAeFw0wMDA5MTMwNjIyNTBaFw0yMDA5MTMwNjIyNTBa -MD8xJDAiBgNVBAoTG0RpZ2l0YWwgU2lnbmF0dXJlIFRydXN0IENvLjEXMBUGA1UE -AxMORFNUIFJvb3QgQ0EgWDQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCthX3OFEYY8gSeIYur0O4ypOT68HnDrjLfIutL5PZHRwQGjzCPb9PFo/ihboJ8 -RvfGhBAqpQCo47zwYEhpWm1jB+L/OE/dBBiyn98krfU2NiBKSom2J58RBeAwHGEy -cO+lewyjVvbDDLUy4CheY059vfMjPAftCRXjqSZIolQb9FdPcAoa90mFwB7rKniE -J7vppdrUScSS0+eBrHSUPLdvwyn4RGp+lSwbWYcbg5EpSpE0GRJdchic0YDjvIoC -YHpe7Rkj93PYRTQyU4bhC88ck8tMqbvRYqMRqR+vobbkrj5LLCOQCHV5WEoxWh+0 -E2SpIFe7RkV++MmpIAc0h1tZAgMBAAGjMjAwMA8GA1UdEwEB/wQFMAMBAf8wHQYD -VR0OBBYEFPCD6nPIP1ubWzdf9UyPWvf0hki9MA0GCSqGSIb3DQEBBQUAA4IBAQCE -G85wl5eEWd7adH6XW/ikGN5salvpq/Fix6yVTzE6CrhlP5LBdkf6kx1bSPL18M45 -g0rw2zA/MWOhJ3+S6U+BE0zPGCuu8YQaZibR7snm3HiHUaZNMu5c8D0x0bcMxDjY -AVVcHCoNiL53Q4PLW27nbY6wwG0ffFKmgV3blxrYWfuUDgGpyPwHwkfVFvz9qjaV -mf12VJffL6W8omBPtgteb6UaT/k1oJ7YI0ldGf+ngpVbRhD+LC3cUtT6GO/BEPZu -8YTV/hbiDH5v3khVqMIeKT6o8IuXGG7F6a6vKwP1F1FwTXf4UC/ivhme7vdUH7B/ -Vv4AEbT8dNfEeFxrkDbh ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEQzCCAyugAwIBAgIBATANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJHQjEb -MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow -GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDElMCMGA1UEAwwcVHJ1c3RlZCBDZXJ0 -aWZpY2F0ZSBTZXJ2aWNlczAeFw0wNDAxMDEwMDAwMDBaFw0yODEyMzEyMzU5NTla -MH8xCzAJBgNVBAYTAkdCMRswGQYDVQQIDBJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO -BgNVBAcMB1NhbGZvcmQxGjAYBgNVBAoMEUNvbW9kbyBDQSBMaW1pdGVkMSUwIwYD -VQQDDBxUcnVzdGVkIENlcnRpZmljYXRlIFNlcnZpY2VzMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA33FvNlhTWvI2VFeAxHQIIO0Yfyod5jWaHiWsnOWW -fnJSoBVC21ndZHoa0Lh73TkVvFVIxO06AOoxEbrycXQaZ7jPM8yoMa+j49d/vzMt -TGo87IvDktJTdyR0nAducPy9C1t2ul/y/9c3S0pgePfw+spwtOpZqqPOSC+pw7IL -fhdyFgymBwwbOM/JYrc/oJOlh0Hyt3BAd9i+FHzjqMB6juljatEPmsbS9Is6FARW -1O24zG71++IsWL1/T2sr92AkWCTOJu80kTrV44HQsvAEAtdbtz6SrGsSivnkBbA7 -kUlcsutT6vifR4buv5XAwAaf0lteERv0xwQ1KdJVXOTt6wIDAQABo4HJMIHGMB0G -A1UdDgQWBBTFe1i97doladL3WRaoszLAeydb9DAOBgNVHQ8BAf8EBAMCAQYwDwYD -VR0TAQH/BAUwAwEB/zCBgwYDVR0fBHwwejA8oDqgOIY2aHR0cDovL2NybC5jb21v -ZG9jYS5jb20vVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMuY3JsMDqgOKA2hjRo -dHRwOi8vY3JsLmNvbW9kby5uZXQvVHJ1c3RlZENlcnRpZmljYXRlU2VydmljZXMu -Y3JsMA0GCSqGSIb3DQEBBQUAA4IBAQDIk4E7ibSvuIQSTI3S8NtwuleGFTQQuS9/ -HrCoiWChisJ3DFBKmwCL2Iv0QeLQg4pKHBQGsKNoBXAxMKdTmw7pSqBYaWcOrp32 -pSxBvzwGa+RZzG0Q8ZZvH9/0BAKkn0U+yNj6NkZEUD+Cl5EfKNsYEYwq5GWDVxIS -jBc/lDb+XbDABHcTuPQV1T84zJQ6VdCsmPW6AF/ghhmBeC8owH7TzEIK9a5QoNE+ -xqFx7D+gIIxmOom0jtTYsU0lR+4viMi14QVFwL4Ucd56/Y57fU0IlqUSc/Atyjcn -dBInTMu2l+nZrghtWjlA3QVHdWpaIbOjGM9O9y5Xt5hwXsjEeLBi ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBK -MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x -GTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkx -MjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3Qg -Q29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jxYDiJ -iQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa -/FHtaMbQbqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJ -jnIFHovdRIWCQtBJwB1g8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnI -HmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYVHDGA76oYa8J719rO+TMg1fW9ajMtgQT7 -sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi0XPnj3pDAgMBAAGjgZ0w -gZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCsw -KaAnoCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsG -AQQBgjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0L -URYD7xh8yOOvaliTFGCRsoTciE6+OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXO -H0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cnCDpOGR86p1hcF895P4vkp9Mm -I50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/53CYNv6ZHdAbY -iNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc -f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID+TCCAuGgAwIBAgIQW1fXqEywr9nTb0ugMbTW4jANBgkqhkiG9w0BAQUFADB5 -MQswCQYDVQQGEwJVUzENMAsGA1UEChMEVklTQTEvMC0GA1UECxMmVmlzYSBJbnRl -cm5hdGlvbmFsIFNlcnZpY2UgQXNzb2NpYXRpb24xKjAoBgNVBAMTIVZpc2EgSW5m -b3JtYXRpb24gRGVsaXZlcnkgUm9vdCBDQTAeFw0wNTA2MjcxNzQyNDJaFw0yNTA2 -MjkxNzQyNDJaMHkxCzAJBgNVBAYTAlVTMQ0wCwYDVQQKEwRWSVNBMS8wLQYDVQQL -EyZWaXNhIEludGVybmF0aW9uYWwgU2VydmljZSBBc3NvY2lhdGlvbjEqMCgGA1UE -AxMhVmlzYSBJbmZvcm1hdGlvbiBEZWxpdmVyeSBSb290IENBMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyREA4R/QkkfpLx0cYjga/EhIPZpchH0MZsRZ -FfP6C2ITtf/Wc+MtgD4yTK0yoiXvni3d+aCtEgK3GDvkdgYrgF76ROJFZwUQjQ9l -x42gRT05DbXvWFoy7dTglCZ9z/Tt2Cnktv9oxKgmkeHY/CyfpCBg1S8xth2JlGMR -0ug/GMO5zANuegZOv438p5Lt5So+du2Gl+RMFQqEPwqN5uJSqAe0VtmB4gWdQ8on -Bj2ZAM2R73QW7UW0Igt2vA4JaSiNtaAG/Y/58VXWHGgbq7rDtNK1R30X0kJV0rGA -ib3RSwB3LpG7bOjbIucV5mQgJoVjoA1e05w6g1x/KmNTmOGRVwIDAQABo30wezAP -BgNVHRMBAf8EBTADAQH/MDkGA1UdIAQyMDAwLgYFZ4EDAgEwJTAVBggrBgEFBQcC -ARYJMS4yLjMuNC41MAwGCCsGAQUFBwICMAAwDgYDVR0PAQH/BAQDAgEGMB0GA1Ud -DgQWBBRPitp2/2d3I5qmgH1924h1hfeBejANBgkqhkiG9w0BAQUFAAOCAQEACUW1 -QdUHdDJydgDPmYt+telnG/Su+DPaf1cregzlN43bJaJosMP7NwjoJY/H2He4XLWb -5rXEkl+xH1UyUwF7mtaUoxbGxEvt8hPZSTB4da2mzXgwKvXuHyzF5Qjy1hOB0/pS -WaF9ARpVKJJ7TOJQdGKBsF2Ty4fSCLqZLgfxbqwMsd9sysXI3rDXjIhekqvbgeLz -PqZr+pfgFhwCCLSMQWl5Ll3u7Qk9wR094DZ6jj6+JCVCRUS3HyabH4OlM0Vc2K+j -INsF/64Or7GNtRf9HYEJvrPxHINxl3JVwhYj4ASeaO4KwhVbwtw94Tc/XrGcexDo -c5lC3rAi4/UZqweYCw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoT -HFN0YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVs -ZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5 -MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNVBAYTAlVTMRAwDgYD -VQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFy -ZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2Vy -dmljZXMgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20p -OsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm2 -8xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4PahHQUw2eeBGg6345AWh1K -Ts9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLPLJGmpufe -hRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk -6mFBrMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAw -DwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+q -AdcwKziIorhtSpzyEZGDMA0GCSqGSIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMI -bw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPPE95Dz+I0swSdHynVv/heyNXB -ve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTyxQGjhdByPq1z -qwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd -iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn -0q23KXB56jzaYyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCN -sSi6 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzEl -MCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMp -U3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQw -NjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBoMQswCQYDVQQGEwJVUzElMCMGA1UE -ChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZp -ZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqGSIb3 -DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf -8MOh2tTYbitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN -+lq2cwQlZut3f+dZxkqZJRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0 -X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVmepsZGD3/cVE8MC5fvj13c7JdBmzDI1aa -K4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSNF4Azbl5KXZnJHoe0nRrA -1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HFMIHCMB0G -A1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fR -zt0fhvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0 -YXJmaWVsZCBUZWNobm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBD -bGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGsafPzWdqbAYcaT1epoXkJKtv3 -L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLMPUxA2IGvd56D -eruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl -xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp -VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY -WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEqjCCA5KgAwIBAgIOSkcAAQAC5aBd1j8AUb8wDQYJKoZIhvcNAQEFBQAwdjEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxIjAgBgNV -BAsTGVRDIFRydXN0Q2VudGVyIENsYXNzIDMgQ0ExJTAjBgNVBAMTHFRDIFRydXN0 -Q2VudGVyIENsYXNzIDMgQ0EgSUkwHhcNMDYwMTEyMTQ0MTU3WhcNMjUxMjMxMjI1 -OTU5WjB2MQswCQYDVQQGEwJERTEcMBoGA1UEChMTVEMgVHJ1c3RDZW50ZXIgR21i -SDEiMCAGA1UECxMZVEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQTElMCMGA1UEAxMc -VEMgVHJ1c3RDZW50ZXIgQ2xhc3MgMyBDQSBJSTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBALTgu1G7OVyLBMVMeRwjhjEQY0NVJz/GRcekPewJDRoeIMJW -Ht4bNwcwIi9v8Qbxq63WyKthoy9DxLCyLfzDlml7forkzMA5EpBCYMnMNWju2l+Q -Vl/NHE1bWEnrDgFPZPosPIlY2C8u4rBo6SI7dYnWRBpl8huXJh0obazovVkdKyT2 -1oQDZogkAHhg8fir/gKya/si+zXmFtGt9i4S5Po1auUZuV3bOx4a+9P/FRQI2Alq -ukWdFHlgfa9Aigdzs5OW03Q0jTo3Kd5c7PXuLjHCINy+8U9/I1LZW+Jk2ZyqBwi1 -Rb3R0DHBq1SfqdLDYmAD8bs5SpJKPQq5ncWg/jcCAwEAAaOCATQwggEwMA8GA1Ud -EwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTUovyfs8PYA9NX -XAek0CSnwPIA1DCB7QYDVR0fBIHlMIHiMIHfoIHcoIHZhjVodHRwOi8vd3d3LnRy -dXN0Y2VudGVyLmRlL2NybC92Mi90Y19jbGFzc18zX2NhX0lJLmNybIaBn2xkYXA6 -Ly93d3cudHJ1c3RjZW50ZXIuZGUvQ049VEMlMjBUcnVzdENlbnRlciUyMENsYXNz -JTIwMyUyMENBJTIwSUksTz1UQyUyMFRydXN0Q2VudGVyJTIwR21iSCxPVT1yb290 -Y2VydHMsREM9dHJ1c3RjZW50ZXIsREM9ZGU/Y2VydGlmaWNhdGVSZXZvY2F0aW9u -TGlzdD9iYXNlPzANBgkqhkiG9w0BAQUFAAOCAQEANmDkcPcGIEPZIxpC8vijsrlN -irTzwppVMXzEO2eatN9NDoqTSheLG43KieHPOh6sHfGcMrSOWXaiQYUlN6AT0PV8 -TtXqluJucsG7Kv5sbviRmEb8yRtXW+rIGjs/sFGYPAfaLFkB2otE6OF0/ado3VS6 -g0bsyEa1+K+XwDsJHI/OcpY9M1ZwvJbL2NV9IJqDnxrcOfHFcqMRA/07QlIp2+gB -95tejNaNhk4Z+rwcvsUhpYeeeC422wlxo3I0+GzjBgnyXlal092Y+tTmBvTwtiBj -S+opvaqCZh77gaqnN60TGOaSw4HBM7uIHqHn4rS9MWwOUT1v+5ZWgOI2F9Hc5A== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY -MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo -R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx -MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK -Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9 -AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA -ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0 -7e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W -kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI -mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ -KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1 -6CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl -4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K -oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj -UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU -AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UE -BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWdu -IFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0Nlow -RzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMY -U3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -MIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644N0Mv -Fz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7br -YT7QbNHm+/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieF -nbAVlDLaYQ1HTWBCrpJH6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH -6ATK72oxh9TAtvmUcXtnZLi2kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZt -eJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/ -c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJ -MoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRH -HTBsROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTf -jNFusB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6 -5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOB -rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU -F6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRBtjpbO8tFnb0c -wpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0 -cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIB -AHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShp -WJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9 -xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ -2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZ -IseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8 -aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2X -em1ZqSqPe97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQR -dAtq/gsD/KNVV4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/ -OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+ -hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy -tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1 -MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -CSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIwMTAxMDMwMTAxMDMwWhgPMjAzMDEy -MTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNl -ZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBS -b290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUy -euuOF0+W2Ap7kaJjbMeMTC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvO -bntl8jixwKIy72KyaOBhU8E2lf/slLo2rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIw -WFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw93X2PaRka9ZP585ArQ/d -MtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtNP2MbRMNE -1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYD -VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/ -zQas8fElyalL1BSZMEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYB -BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEF -BQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+RjxY6hUFaTlrg4wCQiZrxTFGGV -v9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqMlIpPnTX/dqQG -E5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u -uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIW -iAYLtqZLICjU3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/v -GVCJYMzpJJUPwssd8m92kMfMdcGWxZ0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCB -yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQL -ExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJp -U2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxW -ZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCByjEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW -ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp -U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y -aXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvJAgIKXo1 -nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKzj/i5Vbex -t0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIz -SdhDY2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQG -BO+QueQA5N06tRn/Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+ -rCpSx4/VBEnkjWNHiDxpg8v+R70rfk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/ -NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8E -BAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEwHzAH -BgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy -aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKv -MzEzMA0GCSqGSIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzE -p6B4Eq1iDkVwZMXnl2YtmAl+X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y -5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKEKQsTb47bDN0lAtukixlE0kF6BWlK -WE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiCKm0oHw0LxOXnGiYZ -4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vEZV8N -hnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDoDCCAoigAwIBAgIBMTANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJKUDEc -MBoGA1UEChMTSmFwYW5lc2UgR292ZXJubWVudDEWMBQGA1UECxMNQXBwbGljYXRp -b25DQTAeFw0wNzEyMTIxNTAwMDBaFw0xNzEyMTIxNTAwMDBaMEMxCzAJBgNVBAYT -AkpQMRwwGgYDVQQKExNKYXBhbmVzZSBHb3Zlcm5tZW50MRYwFAYDVQQLEw1BcHBs -aWNhdGlvbkNBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp23gdE6H -j6UG3mii24aZS2QNcfAKBZuOquHMLtJqO8F6tJdhjYq+xpqcBrSGUeQ3DnR4fl+K -f5Sk10cI/VBaVuRorChzoHvpfxiSQE8tnfWuREhzNgaeZCw7NCPbXCbkcXmP1G55 -IrmTwcrNwVbtiGrXoDkhBFcsovW8R0FPXjQilbUfKW1eSvNNcr5BViCH/OlQR9cw -FO5cjFW6WY2H/CPek9AEjP3vbb3QesmlOmpyM8ZKDQUXKi17safY1vC+9D/qDiht -QWEjdnjDuGWk81quzMKq2edY3rZ+nYVunyoKb58DKTCXKB28t89UKU5RMfkntigm -/qJj5kEW8DOYRwIDAQABo4GeMIGbMB0GA1UdDgQWBBRUWssmP3HMlEYNllPqa0jQ -k/5CdTAOBgNVHQ8BAf8EBAMCAQYwWQYDVR0RBFIwUKROMEwxCzAJBgNVBAYTAkpQ -MRgwFgYDVQQKDA/ml6XmnKzlm73mlL/lupwxIzAhBgNVBAsMGuOCouODl+ODquOC -seODvOOCt+ODp+ODs0NBMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADlqRHZ3ODrso2dGD/mLBqj7apAxzn7s2tGJfHrrLgy9mTLnsCTWw//1sogJ -hyzjVOGjprIIC8CFqMjSnHH2HZ9g/DgzE+Ge3Atf2hZQKXsvcJEPmbo0NI2VdMV+ -eKlmXb3KIXdCEKxmJj3ekav9FfBv7WxfEPjzFvYDio+nEhEMy/0/ecGc/WLuo89U -DNErXxc+4z6/wCs+CZv+iKZ+tJIX/COUgb1up8WMwusRRdv4QcmWdupwX3kSa+Sj -B1oF7ydJzyGfikwJcGapJsErEU4z0g781mzSDjJkaP+tBXhfAx2o45CsJOAPQKdL -rosot4LKGAfmt1t06SAZf7IbiVQ= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDIDCCAgigAwIBAgIBJDANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP -MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MxIENBMB4XDTAx -MDQwNjEwNDkxM1oXDTIxMDQwNjEwNDkxM1owOTELMAkGA1UEBhMCRkkxDzANBgNV -BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMSBDQTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBALWJHytPZwp5/8Ue+H887dF+2rDNbS82rDTG -29lkFwhjMDMiikzujrsPDUJVyZ0upe/3p4zDq7mXy47vPxVnqIJyY1MPQYx9EJUk -oVqlBvqSV536pQHydekfvFYmUk54GWVYVQNYwBSujHxVX3BbdyMGNpfzJLWaRpXk -3w0LBUXl0fIdgrvGE+D+qnr9aTCU89JFhfzyMlsy3uhsXR/LpCJ0sICOXZT3BgBL -qdReLjVQCfOAl/QMF6452F/NM8EcyonCIvdFEu1eEpOdY6uCLrnrQkFEy0oaAIIN -nvmLVz5MxxftLItyM19yejhW1ebZrgUaHXVFsculJRwSVzb9IjcCAwEAAaMzMDEw -DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQIR+IMi/ZTiFIwCwYDVR0PBAQDAgEG -MA0GCSqGSIb3DQEBBQUAA4IBAQCLGrLJXWG04bkruVPRsoWdd44W7hE928Jj2VuX -ZfsSZ9gqXLar5V7DtxYvyOirHYr9qxp81V9jz9yw3Xe5qObSIjiHBxTZ/75Wtf0H -DjxVyhbMp6Z3N/vbXB9OWQaHowND9Rart4S9Tu+fMTfwRvFAttEMpWT4Y14h21VO -TzF2nBBhjrZTOqMRvq9tfB69ri3iDGnHhVNoomG6xT60eVR4ngrHAr5i0RGCS2Uv -kVrCqIexVmiUefkl98HVrhq4uz2PqYo4Ffdz0Fpg0YCw8NzVUM1O7pJIae2yIx4w -zMiUyLb1O4Z/P6Yun/Y+LLWSlj7fLJOK/4GMDw9ZIRlXvVWa ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/ -MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT -DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow -PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD -Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O -rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq -OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b -xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw -7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD -aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV -HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQMA0GCSqG -SIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69 -ikugdB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXr -AvHRAosZy5Q6XkjEGB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZz -R8srzJmwN0jP41ZL9c8PDHIyh8bwRLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5 -JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubSfZGL+T0yjWW06XyxV3bqxbYo -Ob8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFGTCCBAGgAwIBAgIEPki9xDANBgkqhkiG9w0BAQUFADAxMQswCQYDVQQGEwJE -SzEMMAoGA1UEChMDVERDMRQwEgYDVQQDEwtUREMgT0NFUyBDQTAeFw0wMzAyMTEw -ODM5MzBaFw0zNzAyMTEwOTA5MzBaMDExCzAJBgNVBAYTAkRLMQwwCgYDVQQKEwNU -REMxFDASBgNVBAMTC1REQyBPQ0VTIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A -MIIBCgKCAQEArGL2YSCyz8DGhdfjeebM7fI5kqSXLmSjhFuHnEz9pPPEXyG9VhDr -2y5h7JNp46PMvZnDBfwGuMo2HP6QjklMxFaaL1a8z3sM8W9Hpg1DTeLpHTk0zY0s -2RKY+ePhwUp8hjjEqcRhiNJerxomTdXkoCJHhNlktxmW/OwZ5LKXJk5KTMuPJItU -GBxIYXvViGjaXbXqzRowwYCDdlCqT9HU3Tjw7xb04QxQBr/q+3pJoSgrHPb8FTKj -dGqPqcNiKXEx5TukYBdedObaE+3pHx8b0bJoc8YQNHVGEBDjkAB2QMuLt0MJIf+r -TpPGWOmlgtt3xDqZsXKVSQTwtyv6e1mO3QIDAQABo4ICNzCCAjMwDwYDVR0TAQH/ -BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgewGA1UdIASB5DCB4TCB3gYIKoFQgSkB -AQEwgdEwLwYIKwYBBQUHAgEWI2h0dHA6Ly93d3cuY2VydGlmaWthdC5kay9yZXBv -c2l0b3J5MIGdBggrBgEFBQcCAjCBkDAKFgNUREMwAwIBARqBgUNlcnRpZmlrYXRl -ciBmcmEgZGVubmUgQ0EgdWRzdGVkZXMgdW5kZXIgT0lEIDEuMi4yMDguMTY5LjEu -MS4xLiBDZXJ0aWZpY2F0ZXMgZnJvbSB0aGlzIENBIGFyZSBpc3N1ZWQgdW5kZXIg -T0lEIDEuMi4yMDguMTY5LjEuMS4xLjARBglghkgBhvhCAQEEBAMCAAcwgYEGA1Ud -HwR6MHgwSKBGoESkQjBAMQswCQYDVQQGEwJESzEMMAoGA1UEChMDVERDMRQwEgYD -VQQDEwtUREMgT0NFUyBDQTENMAsGA1UEAxMEQ1JMMTAsoCqgKIYmaHR0cDovL2Ny -bC5vY2VzLmNlcnRpZmlrYXQuZGsvb2Nlcy5jcmwwKwYDVR0QBCQwIoAPMjAwMzAy -MTEwODM5MzBagQ8yMDM3MDIxMTA5MDkzMFowHwYDVR0jBBgwFoAUYLWF7FZkfhIZ -J2cdUBVLc647+RIwHQYDVR0OBBYEFGC1hexWZH4SGSdnHVAVS3OuO/kSMB0GCSqG -SIb2fQdBAAQQMA4bCFY2LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEACrom -JkbTc6gJ82sLMJn9iuFXehHTuJTXCRBuo7E4A9G28kNBKWKnctj7fAXmMXAnVBhO -inxO5dHKjHiIzxvTkIvmI/gLDjNDfZziChmPyQE+dF10yYscA+UYyAFMP8uXBV2Y -caaYb7Z8vTd/vuGTJW1v8AqtFxjhA7wHKcitJuj4YfD9IQl+mo6paH1IYnK9AOoB -mbgGglGBTvH1tJFUuSN6AJqfXY3gPGS5GhKSKseCRHI53OI8xthV9RVOyAUO28bQ -YqbsFbS1AoLbrIyigfCbmTH1ICCoiGEKB5+U/NDXG8wuF/MEJ3Zn61SD/aSQfgY9 -BKNDLdr8C2LqL19iUw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDYTCCAkmgAwIBAgIQCgEBAQAAAnwAAAAKAAAAAjANBgkqhkiG9w0BAQUFADA6 -MRkwFwYDVQQKExBSU0EgU2VjdXJpdHkgSW5jMR0wGwYDVQQLExRSU0EgU2VjdXJp -dHkgMjA0OCBWMzAeFw0wMTAyMjIyMDM5MjNaFw0yNjAyMjIyMDM5MjNaMDoxGTAX -BgNVBAoTEFJTQSBTZWN1cml0eSBJbmMxHTAbBgNVBAsTFFJTQSBTZWN1cml0eSAy -MDQ4IFYzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt49VcdKA3Xtp -eafwGFAyPGJn9gqVB93mG/Oe2dJBVGutn3y+Gc37RqtBaB4Y6lXIL5F4iSj7Jylg -/9+PjDvJSZu1pJTOAeo+tWN7fyb9Gd3AIb2E0S1PRsNO3Ng3OTsor8udGuorryGl -wSMiuLgbWhOHV4PR8CDn6E8jQrAApX2J6elhc5SYcSa8LWrg903w8bYqODGBDSnh -AMFRD0xS+ARaqn1y07iHKrtjEAMqs6FPDVpeRrc9DvV07Jmf+T0kgYim3WBU6JU2 -PcYJk5qjEoAAVZkZR73QpXzDuvsf9/UP+Ky5tfQ3mBMY3oVbtwyCO4dvlTlYMNpu -AWgXIszACwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIB -BjAfBgNVHSMEGDAWgBQHw1EwpKrpRa41JPr/JCwz0LGdjDAdBgNVHQ4EFgQUB8NR -MKSq6UWuNST6/yQsM9CxnYwwDQYJKoZIhvcNAQEFBQADggEBAF8+hnZuuDU8TjYc -HnmYv/3VEhF5Ug7uMYm83X/50cYVIeiKAVQNOvtUudZj1LGqlk2iQk3UUx+LEN5/ -Zb5gEydxiKRz44Rj0aRV4VCT5hsOedBnvEbIvz8XDZXmxpBp3ue0L96VfdASPz0+ -f00/FGj1EVDVwfSQpQgdMWD/YIwjVAqv/qFuxdF6Kmh4zx6CCiC0H63lhbJqaHVO -rSU3lIW+vaHU6rcMSzyd6BIA8F+sDeGscGNz9395nzIlQnQFgCi/vcEkllgVsRch -6YlL2weIZ/QVrXA+L02FO8K32/6YaCOJ4XQP3vTFhGMpG8zLB8kApKnXwiJPZ9d3 -7CAFYd4= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UE -BhMCRVMxQjBABgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1h -cHJvZmVzaW9uYWwgQ0lGIEE2MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEy -MzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIwQAYDVQQDDDlBdXRvcmlkYWQgZGUg -Q2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBBNjI2MzQwNjgwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDDUtd9 -thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQM -cas9UX4PB99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefG -L9ItWY16Ck6WaVICqjaY7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15i -NA9wBj4gGFrO93IbJWyTdBSTo3OxDqqHECNZXyAFGUftaI6SEspd/NYrspI8IM/h -X68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyIplD9amML9ZMWGxmPsu2b -m8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctXMbScyJCy -Z/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirja -EbsXLZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/T -KI8xWVvTyQKmtFLKbpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF -6NkBiDkal4ZkQdU7hwxu+g/GvUgUvzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVh -OSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD -VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNHDhpkLzCBpgYD -VR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp -cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBv -ACAAZABlACAAbABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBl -AGwAbwBuAGEAIAAwADgAMAAxADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF -661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx51tkljYyGOylMnfX40S2wBEqgLk9 -am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qkR71kMrv2JYSiJ0L1 -ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaPT481 -PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS -3a/DTg4fJl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5k -SeTy36LssUzAKh3ntLFlosS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF -3dvd6qJ2gHN99ZwExEWN57kci57q13XRcrHedUTnQn3iV2t93Jm8PYMo6oCTjcVM -ZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoRsaS8I8nkvof/uZS2+F0g -StRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTDKCOM/icz -Q0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQB -jLMi6Et8Vcad+qMUu2WFbm5PEn4KPJ2V ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs -IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 -MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux -FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h -bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v -dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt -H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 -uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX -mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX -a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN -E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 -WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD -VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 -Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU -cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx -IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN -AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH -YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 -6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC -Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX -c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a -mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICgjCCAeugAwIBAgIBBDANBgkqhkiG9w0BAQQFADBTMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEmMCQGA1UEAxMdRXF1aWZheCBT -ZWN1cmUgZUJ1c2luZXNzIENBLTEwHhcNOTkwNjIxMDQwMDAwWhcNMjAwNjIxMDQw -MDAwWjBTMQswCQYDVQQGEwJVUzEcMBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5j -LjEmMCQGA1UEAxMdRXF1aWZheCBTZWN1cmUgZUJ1c2luZXNzIENBLTEwgZ8wDQYJ -KoZIhvcNAQEBBQADgY0AMIGJAoGBAM4vGbwXt3fek6lfWg0XTzQaDJj0ItlZ1MRo -RvC0NcWFAyDGr0WlIVFFQesWWDYyb+JQYmT5/VGcqiTZ9J2DKocKIdMSODRsjQBu -WqDZQu4aIZX5UkxVWsUPOE9G+m34LjXWHXzr4vCwdYDIqROsvojvOm6rXyo4YgKw -Env+j6YDAgMBAAGjZjBkMBEGCWCGSAGG+EIBAQQEAwIABzAPBgNVHRMBAf8EBTAD -AQH/MB8GA1UdIwQYMBaAFEp4MlIR21kWNl7fwRQ2QGpHfEyhMB0GA1UdDgQWBBRK -eDJSEdtZFjZe38EUNkBqR3xMoTANBgkqhkiG9w0BAQQFAAOBgQB1W6ibAxHm6VZM -zfmpTMANmvPMZWnmJXbMWbfWVMMdzZmsGd20hdXgPfxiIKeES1hl8eL5lSE/9dR+ -WB5Hh1Q+WKG1tfgq73HnvMP2sUlG4tega+VWeponmHxGYhTnyfxuAxJ5gDgdSIKN -/Bf+KpYrtWKmpj29f5JZzVoqgrI3eQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBM -MSIwIAYDVQQKExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5D -ZXJ0dW0gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBU -cnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIyMTIwNzM3WhcNMjkxMjMxMTIwNzM3 -WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMg -Uy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSIw -IAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rH -UV+rpDKmYYe2bg+G0jACl/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LM -TXPb865Px1bVWqeWifrzq2jUI4ZZJ88JJ7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVU -BBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4fOQtf/WsX+sWn7Et0brM -kUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0cvW0QM8x -AcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNV -HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15y -sHhE49wcrwn9I0j6vSrEuVUEtRCjjSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfL -I9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1mS1FhIrlQgnXdAIv94nYmem8 -J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5ajZt3hrvJBW8qY -VoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI -03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx -EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT -EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp -ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz -NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH -EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE -AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw -DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD -E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH -/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy -DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh -GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR -tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA -AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE -FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX -WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu -9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr -gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo -2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO -LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI -4uJEvlz36hz1 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIBATANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJGUjET -MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxHTAb -BgNVBAMTFENlcnRpbm9taXMgLSBSb290IENBMB4XDTEzMTAyMTA5MTcxOFoXDTMz -MTAyMTA5MTcxOFowWjELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNlcnRpbm9taXMx -FzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMR0wGwYDVQQDExRDZXJ0aW5vbWlzIC0g -Um9vdCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANTMCQosP5L2 -fxSeC5yaah1AMGT9qt8OHgZbn1CF6s2Nq0Nn3rD6foCWnoR4kkjW4znuzuRZWJfl -LieY6pOod5tK8O90gC3rMB+12ceAnGInkYjwSond3IjmFPnVAy//ldu9n+ws+hQV -WZUKxkd8aRi5pwP5ynapz8dvtF4F/u7BUrJ1Mofs7SlmO/NKFoL21prbcpjp3vDF -TKWrteoB4owuZH9kb/2jJZOLyKIOSY008B/sWEUuNKqEUL3nskoTuLAPrjhdsKkb -5nPJWqHZZkCqqU2mNAKthH6yI8H7KsZn9DS2sJVqM09xRLWtwHkziOC/7aOgFLSc -CbAK42C++PhmiM1b8XcF4LVzbsF9Ri6OSyemzTUK/eVNfaoqoynHWmgE6OXWk6Ri -wsXm9E/G+Z8ajYJJGYrKWUM66A0ywfRMEwNvbqY/kXPLynNvEiCL7sCCeN5LLsJJ -wx3tFvYk9CcbXFcx3FXuqB5vbKziRcxXV4p1VxngtViZSTYxPDMBbRZKzbgqg4SG -m/lg0h9tkQPTYKbVPZrdd5A9NaSfD171UkRpucC63M9933zZxKyGIjK8e2uR73r4 -F2iw4lNVYC2vPsKD2NkJK/DAZNuHi5HMkesE/Xa0lZrmFAYb1TQdvtj/dBxThZng -WVJKYe2InmtJiUZ+IFrZ50rlau7SZRFDAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIB -BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTvkUz1pcMw6C8I6tNxIqSSaHh0 -2TAfBgNVHSMEGDAWgBTvkUz1pcMw6C8I6tNxIqSSaHh02TANBgkqhkiG9w0BAQsF -AAOCAgEAfj1U2iJdGlg+O1QnurrMyOMaauo++RLrVl89UM7g6kgmJs95Vn6RHJk/ -0KGRHCwPT5iVWVO90CLYiF2cN/z7ZMF4jIuaYAnq1fohX9B0ZedQxb8uuQsLrbWw -F6YSjNRieOpWauwK0kDDPAUwPk2Ut59KA9N9J0u2/kTO+hkzGm2kQtHdzMjI1xZS -g081lLMSVX3l4kLr5JyTCcBMWwerx20RoFAXlCOotQqSD7J6wWAsOMwaplv/8gzj -qh8c3LigkyfeY+N/IZ865Z764BNqdeuWXGKRlI5nU7aJ+BIJy29SWwNyhlCVCNSN -h4YVH5Uk2KRvms6knZtt0rJ2BobGVgjF6wnaNsIbW0G+YSrjcOa4pvi2WsS9Iff/ -ql+hbHY5ZtbqTFXhADObE5hjyW/QASAJN1LnDE8+zbz1X5YnpyACleAu6AdBBR8V -btaw5BngDwKTACdyxYvRVB9dSsNAl35VpnzBMwQUAR1JIGkLGZOdblgi90AMRgwj -Y/M50n92Uaf0yKHxDHYiI0ZSKS3io0EHVmmY0gUJvGnHWmHNj4FgFU2A3ZDifcRQ -8ow7bkrHxuaAKzyBvBGAFhAn1/DNP3nMcyrDflOR1m749fPH0FFNjkulW+YZFzvW -gQncItzujrnEj1PhZ7szuIgVRs/taTX/dQ1G885x4cVrhkIGuUE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFujCCBKKgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBhjELMAkGA1UEBhMCVVMx -HTAbBgNVBAoTFEFwcGxlIENvbXB1dGVyLCBJbmMuMS0wKwYDVQQLEyRBcHBsZSBD -b21wdXRlciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxKTAnBgNVBAMTIEFwcGxlIFJv -b3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MB4XDTA1MDIxMDAwMTgxNFoXDTI1MDIx -MDAwMTgxNFowgYYxCzAJBgNVBAYTAlVTMR0wGwYDVQQKExRBcHBsZSBDb21wdXRl -ciwgSW5jLjEtMCsGA1UECxMkQXBwbGUgQ29tcHV0ZXIgQ2VydGlmaWNhdGUgQXV0 -aG9yaXR5MSkwJwYDVQQDEyBBcHBsZSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0 -eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOSRqQkfkdseR1DrBe1e -eYQt6zaiV0xV7IsZid75S2z1B6siMALoGD74UAnTf0GomPnRymacJGsR0KO75Bsq -wx+VnnoMpEeLW9QWNzPLxA9NzhRp0ckZcvVdDtV/X5vyJQO6VY9NXQ3xZDUjFUsV -WR2zlPf2nJ7PULrBWFBnjwi0IPfLrCwgb3C2PwEwjLdDzw+dPfMrSSgayP7OtbkO -2V4c1ss9tTqt9A8OAJILsSEWLnTVPA3bYharo3GSR1NVwa8vQbP4++NwzeajTEV+ -H0xrUJZBicR0YgsQg0GHM4qBsTBY7FoEMoxos48d3mVz/2deZbxJ2HafMxRloXeU -yS0CAwEAAaOCAi8wggIrMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/ -MB0GA1UdDgQWBBQr0GlHlHYJ/vRrjS5ApvdHTX8IXjAfBgNVHSMEGDAWgBQr0GlH -lHYJ/vRrjS5ApvdHTX8IXjCCASkGA1UdIASCASAwggEcMIIBGAYJKoZIhvdjZAUB -MIIBCTBBBggrBgEFBQcCARY1aHR0cHM6Ly93d3cuYXBwbGUuY29tL2NlcnRpZmlj -YXRlYXV0aG9yaXR5L3Rlcm1zLmh0bWwwgcMGCCsGAQUFBwICMIG2GoGzUmVsaWFu -Y2Ugb24gdGhpcyBjZXJ0aWZpY2F0ZSBieSBhbnkgcGFydHkgYXNzdW1lcyBhY2Nl -cHRhbmNlIG9mIHRoZSB0aGVuIGFwcGxpY2FibGUgc3RhbmRhcmQgdGVybXMgYW5k -IGNvbmRpdGlvbnMgb2YgdXNlLCBjZXJ0aWZpY2F0ZSBwb2xpY3kgYW5kIGNlcnRp -ZmljYXRpb24gcHJhY3RpY2Ugc3RhdGVtZW50cy4wRAYDVR0fBD0wOzA5oDegNYYz -aHR0cHM6Ly93d3cuYXBwbGUuY29tL2NlcnRpZmljYXRlYXV0aG9yaXR5L3Jvb3Qu -Y3JsMFUGCCsGAQUFBwEBBEkwRzBFBggrBgEFBQcwAoY5aHR0cHM6Ly93d3cuYXBw -bGUuY29tL2NlcnRpZmljYXRlYXV0aG9yaXR5L2Nhc2lnbmVycy5odG1sMA0GCSqG -SIb3DQEBBQUAA4IBAQCd2i0oWC99dgS5BNM+zrdmY06PL9T+S61yvaM5xlJNBZhS -9YlRASR5vhoy9+VEi0tEBzmC1lrKtCBe2a4VXR2MHTK/ODFiSF3H4ZCx+CRA+F9Y -m1FdV53B5f88zHIhbsTp6aF31ywXJsM/65roCwO66bNKcuszCVut5mIxauivL9Wv -Hld2j383LS4CXN1jyfJxuCZA3xWNdUQ/eb3mHZnhQyw+rW++uaT+DjUZUWOxw961 -kj5ReAFziqQjyqSI8R5cH0EWLX6VCqrpiUGYGxrdyyC/R14MJsVVNU3GMIuZZxTH -CR+6R8faAQmHJEKVvRNgGQrv6n8Obs3BREM6StXj ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGZjCCBE6gAwIBAgIPB35Sk3vgFeNX8GmMy+wMMA0GCSqGSIb3DQEBBQUAMHsx -CzAJBgNVBAYTAkNPMUcwRQYDVQQKDD5Tb2NpZWRhZCBDYW1lcmFsIGRlIENlcnRp -ZmljYWNpw7NuIERpZ2l0YWwgLSBDZXJ0aWPDoW1hcmEgUy5BLjEjMCEGA1UEAwwa -QUMgUmHDrXogQ2VydGljw6FtYXJhIFMuQS4wHhcNMDYxMTI3MjA0NjI5WhcNMzAw -NDAyMjE0MjAyWjB7MQswCQYDVQQGEwJDTzFHMEUGA1UECgw+U29jaWVkYWQgQ2Ft -ZXJhbCBkZSBDZXJ0aWZpY2FjacOzbiBEaWdpdGFsIC0gQ2VydGljw6FtYXJhIFMu -QS4xIzAhBgNVBAMMGkFDIFJhw616IENlcnRpY8OhbWFyYSBTLkEuMIICIjANBgkq -hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq2uJo1PMSCMI+8PPUZYILrgIem08kBeG -qentLhM0R7LQcNzJPNCNyu5LF6vQhbCnIwTLqKL85XXbQMpiiY9QngE9JlsYhBzL -fDe3fezTf3MZsGqy2IiKLUV0qPezuMDU2s0iiXRNWhU5cxh0T7XrmafBHoi0wpOQ -Y5fzp6cSsgkiBzPZkc0OnB8OIMfuuzONj8LSWKdf/WU34ojC2I+GdV75LaeHM/J4 -Ny+LvB2GNzmxlPLYvEqcgxhaBvzz1NS6jBUJJfD5to0EfhcSM2tXSExP2yYe68yQ -54v5aHxwD6Mq0Do43zeX4lvegGHTgNiRg0JaTASJaBE8rF9ogEHMYELODVoqDA+b -MMCm8Ibbq0nXl21Ii/kDwFJnmxL3wvIumGVC2daa49AZMQyth9VXAnow6IYm+48j -ilSH5L887uvDdUhfHjlvgWJsxS3EF1QZtzeNnDeRyPYL1epjb4OsOMLzP96a++Ej -YfDIJss2yKHzMI+ko6Kh3VOz3vCaMh+DkXkwwakfU5tTohVTP92dsxA7SH2JD/zt -A/X7JWR1DhcZDY8AFmd5ekD8LVkH2ZD6mq093ICK5lw1omdMEWux+IBkAC1vImHF -rEsm5VoQgpukg3s0956JkSCXjrdCx2bD0Omk1vUgjcTDlaxECp1bczwmPS9KvqfJ -pxAe+59QafMCAwEAAaOB5jCB4zAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQE -AwIBBjAdBgNVHQ4EFgQU0QnQ6dfOeXRU+Tows/RtLAMDG2gwgaAGA1UdIASBmDCB -lTCBkgYEVR0gADCBiTArBggrBgEFBQcCARYfaHR0cDovL3d3dy5jZXJ0aWNhbWFy -YS5jb20vZHBjLzBaBggrBgEFBQcCAjBOGkxMaW1pdGFjaW9uZXMgZGUgZ2FyYW50 -7WFzIGRlIGVzdGUgY2VydGlmaWNhZG8gc2UgcHVlZGVuIGVuY29udHJhciBlbiBs -YSBEUEMuMA0GCSqGSIb3DQEBBQUAA4ICAQBclLW4RZFNjmEfAygPU3zmpFmps4p6 -xbD/CHwso3EcIRNnoZUSQDWDg4902zNc8El2CoFS3UnUmjIz75uny3XlesuXEpBc -unvFm9+7OSPI/5jOCk0iAUgHforA1SBClETvv3eiiWdIG0ADBaGJ7M9i4z0ldma/ -Jre7Ir5v/zlXdLp6yQGVwZVR6Kss+LGGIOk/yzVb0hfpKv6DExdA7ohiZVvVO2Dp -ezy4ydV/NgIlqmjCMRW3MGXrfx1IebHPOeJCgBbT9ZMj/EyXyVo3bHwi2ErN0o42 -gzmRkBDI8ck1fj+404HGIGQatlDCIaR43NAvO2STdPCWkPHv+wlaNECW8DYSwaN0 -jJN+Qd53i+yG2dIPPy3RzECiiWZIHiCznCNZc6lEc7wkeZBWN7PGKX6jD/EpOe9+ -XCgycDWs2rjIdWb8m0w5R44bb5tNAlQiM+9hup4phO9OSzNHdpdqy35f/RWmnkJD -W2ZaiogN9xa5P1FlK2Zqi9E4UqLWRhH6/JocdJ6PlwsCT2TG9WjTSy3/pDceiz+/ -RL5hRqGEPQgnTIEgd4kI6mdAXmwIUV80WoyWaM3X94nCHNMyAK9Sy9NgWyo6R35r -MDOhYil/SrnhLecUIw4OGEfhefwVVdCx/CVxY3UzHCMrr1zZ7Ud3YA47Dx7SwNxk -BYn8eNZcLCZDqQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDUzCCAjugAwIBAgIBATANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxHTAbBgNVBAMMFEJ1eXBhc3Mg -Q2xhc3MgMiBDQSAxMB4XDTA2MTAxMzEwMjUwOVoXDTE2MTAxMzEwMjUwOVowSzEL -MAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MR0wGwYD -VQQDDBRCdXlwYXNzIENsYXNzIDIgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAIs8B0XY9t/mx8q6jUPFR42wWsE425KEHK8T1A9vNkYgxC7McXA0 -ojTTNy7Y3Tp3L8DrKehc0rWpkTSHIln+zNvnma+WwajHQN2lFYxuyHyXA8vmIPLX -l18xoS830r7uvqmtqEyeIWZDO6i88wmjONVZJMHCR3axiFyCO7srpgTXjAePzdVB -HfCuuCkslFJgNJQ72uA40Z0zPhX0kzLFANq1KWYOOngPIVJfAuWSeyXTkh4vFZ2B -5J2O6O+JzhRMVB0cgRJNcKi+EAUXfh/RuFdV7c27UsKwHnjCTTZoy1YmwVLBvXb3 -WNVyfh9EdrsAiR0WnVE1703CVu9r4Iw7DekCAwEAAaNCMEAwDwYDVR0TAQH/BAUw -AwEB/zAdBgNVHQ4EFgQUP42aWYv8e3uco684sDntkHGA1sgwDgYDVR0PAQH/BAQD -AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAVGn4TirnoB6NLJzKyQJHyIdFkhb5jatLP -gcIV1Xp+DCmsNx4cfHZSldq1fyOhKXdlyTKdqC5Wq2B2zha0jX94wNWZUYN/Xtm+ -DKhQ7SLHrQVMdvvt7h5HZPb3J31cKA9FxVxiXqaakZG3Uxcu3K1gnZZkOb1naLKu -BctN518fV4bVIJwo+28TOPX2EZL2fZleHwzoq0QkKXJAPTZSr4xYkHPB7GEseaHs -h7U/2k3ZIQAw3pDaDtMaSKk+hQsUi4y8QZ5q9w5wwDX3OaJdZtB7WZ+oRxKaJyOk -LY4ng5IgodcVf/EuGO70SH8vf/GhGLWhC5SgYiAynB321O+/TIho ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFnDCCA4SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJGUjET -MBEGA1UEChMKQ2VydGlub21pczEXMBUGA1UECxMOMDAwMiA0MzM5OTg5MDMxJjAk -BgNVBAMMHUNlcnRpbm9taXMgLSBBdXRvcml0w6kgUmFjaW5lMB4XDTA4MDkxNzA4 -Mjg1OVoXDTI4MDkxNzA4Mjg1OVowYzELMAkGA1UEBhMCRlIxEzARBgNVBAoTCkNl -cnRpbm9taXMxFzAVBgNVBAsTDjAwMDIgNDMzOTk4OTAzMSYwJAYDVQQDDB1DZXJ0 -aW5vbWlzIC0gQXV0b3JpdMOpIFJhY2luZTCCAiIwDQYJKoZIhvcNAQEBBQADggIP -ADCCAgoCggIBAJ2Fn4bT46/HsmtuM+Cet0I0VZ35gb5j2CN2DpdUzZlMGvE5x4jY -F1AMnmHawE5V3udauHpOd4cN5bjr+p5eex7Ezyh0x5P1FMYiKAT5kcOrJ3NqDi5N -8y4oH3DfVS9O7cdxbwlyLu3VMpfQ8Vh30WC8Tl7bmoT2R2FFK/ZQpn9qcSdIhDWe -rP5pqZ56XjUl+rSnSTV3lqc2W+HN3yNw2F1MpQiD8aYkOBOo7C+ooWfHpi2GR+6K -/OybDnT0K0kCe5B1jPyZOQE51kqJ5Z52qz6WKDgmi92NjMD2AR5vpTESOH2VwnHu -7XSu5DaiQ3XV8QCb4uTXzEIDS3h65X27uK4uIJPT5GHfceF2Z5c/tt9qc1pkIuVC -28+BA5PY9OMQ4HL2AHCs8MF6DwV/zzRpRbWT5BnbUhYjBYkOjUjkJW+zeL9i9Qf6 -lSTClrLooyPCXQP8w9PlfMl1I9f09bze5N/NgL+RiH2nE7Q5uiy6vdFrzPOlKO1E -nn1So2+WLhl+HPNbxxaOu2B9d2ZHVIIAEWBsMsGoOBvrbpgT1u449fCfDu/+MYHB -0iSVL1N6aaLwD4ZFjliCK0wi1F6g530mJ0jfJUaNSih8hp75mxpZuWW/Bd22Ql09 -5gBIgl4g9xGC3srYn+Y3RyYe63j3YcNBZFgCQfna4NH4+ej9Uji29YnfAgMBAAGj -WzBZMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBQN -jLZh2kS40RR9w759XkjwzspqsDAXBgNVHSAEEDAOMAwGCiqBegFWAgIAAQEwDQYJ -KoZIhvcNAQEFBQADggIBACQ+YAZ+He86PtvqrxyaLAEL9MW12Ukx9F1BjYkMTv9s -ov3/4gbIOZ/xWqndIlgVqIrTseYyCYIDbNc/CMf4uboAbbnW/FIyXaR/pDGUu7ZM -OH8oMDX/nyNTt7buFHAAQCvaR6s0fl6nVjBhK4tDrP22iCj1a7Y+YEq6QpA0Z43q -619FVDsXrIvkxmUP7tCMXWY5zjKn2BCXwH40nJ+U8/aGH88bc62UeYdocMMzpXDn -2NU4lG9jeeu/Cg4I58UvD0KgKxRA/yHgBcUn4YQRE7rWhh1BCxMjidPJC+iKunqj -o3M3NYB9Ergzd0A4wPpeMNLytqOx1qKVl4GbUu1pTP+A5FPbVFsDbVRfsbjvJL1v -nxHDx2TCDyhihWZeGnuyt++uNckZM6i4J9szVb9o4XVIRFb7zdNIu0eJOqxp9YDG -5ERQL1TEqkPFMTFYvZbF6nVsmnWxTfj3l/+WFvKXTej28xH5On2KOG4Ey+HTRRWq -pdEdnV1j6CTmNhTih60bWfVEm/vXd3wfAXBioSAaosUaKPQhA+4u2cGA6rnZgtZb -dsLLO7XSAPCjDuGtbkD326C00EauFddEwk01+dIL8hf2rGbVJLJP0RyZwG71fet0 -BLj5TXcJ17TPBzAJ8bgAVtkXFhYKK4bfjwEZGuW7gmP/vgt2Fl43N+bYdJeimUV5 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYT -AlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBD -QTAeFw0wNjA3MDQxNzIwMDRaFw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJP -MREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTCC -ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7IJUqOtdu0KBuqV5Do -0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHHrfAQ -UySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5d -RdY4zTW2ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQ -OA7+j0xbm0bqQfWwCHTD0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwv -JoIQ4uNllAoEwF73XVv4EOLQunpL+943AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08C -AwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAcYwHQYDVR0O -BBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IBAQA+0hyJ -LjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecY -MnQ8SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ -44gx+FkagQnIl6Z0x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6I -Jd1hJyMctTEHBDa0GpC9oHRxUIltvBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNw -i/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7NzTogVZ96edhBiIL5VaZVDADlN -9u6wWk5JRFRYX0KD ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0x -GTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJv -b3QgQ0EgMzAeFw0wNjExMjQxOTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNV -BAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMRswGQYDVQQDExJRdW9W -YWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDM -V0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNggDhoB -4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUr -H556VOijKTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd -8lyyBTNvijbO0BNO/79KDDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9Cabwv -vWhDFlaJKjdhkf2mrk7AyxRllDdLkgbvBNDInIjbC3uBr7E9KsRlOni27tyAsdLT -mZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwpp5ijJUMv7/FfJuGITfhe -btfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8nT8KKdjc -T5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDt -WAEXMJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZ -c6tsgLjoC2SToJyMGf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A -4iLItLRkT9a6fUg+qGkM17uGcclzuD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYD -VR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHTBgkrBgEEAb5YAAMwgcUwgZMG -CCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmljYXRlIGNvbnN0 -aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0 -aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVu -dC4wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2Nw -czALBgNVHQ8EBAMCAQYwHQYDVR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4G -A1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4ywLQoUmkRzBFMQswCQYDVQQGEwJC -TTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UEAxMSUXVvVmFkaXMg -Um9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZVqyM0 -7ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSem -d1o417+shvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd -+LJ2w/w4E6oM3kJpK27zPOuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B -4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadN -t54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp8kokUvd0/bpO5qgdAm6x -DYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBCbjPsMZ57 -k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6s -zHXug/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0j -Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT -mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK -4SVhM7JZG+Ju1zdXtg2pEto= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVTCCAj2gAwIBAgIESTMAATANBgkqhkiG9w0BAQUFADAyMQswCQYDVQQGEwJD -TjEOMAwGA1UEChMFQ05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwHhcNMDcwNDE2 -MDcwOTE0WhcNMjcwNDE2MDcwOTE0WjAyMQswCQYDVQQGEwJDTjEOMAwGA1UEChMF -Q05OSUMxEzARBgNVBAMTCkNOTklDIFJPT1QwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQDTNfc/c3et6FtzF8LRb+1VvG7q6KR5smzDo+/hn7E7SIX1mlwh -IhAsxYLO2uOabjfhhyzcuQxauohV3/2q2x8x6gHx3zkBwRP9SFIhxFXf2tizVHa6 -dLG3fdfA6PZZxU3Iva0fFNrfWEQlMhkqx35+jq44sDB7R3IJMfAw28Mbdim7aXZO -V/kbZKKTVrdvmW7bCgScEeOAH8tjlBAKqeFkgjH5jCftppkA9nCTGPihNIaj3XrC -GHn2emU1z5DrvTOTn1OrczvmmzQgLx3vqR1jGqCA2wMv+SYahtKNu6m+UjqHZ0gN -v7Sg2Ca+I19zN38m5pIEo3/PIKe38zrKy5nLAgMBAAGjczBxMBEGCWCGSAGG+EIB -AQQEAwIABzAfBgNVHSMEGDAWgBRl8jGtKvf33VKWCscCwQ7vptU7ETAPBgNVHRMB -Af8EBTADAQH/MAsGA1UdDwQEAwIB/jAdBgNVHQ4EFgQUZfIxrSr3991SlgrHAsEO -76bVOxEwDQYJKoZIhvcNAQEFBQADggEBAEs17szkrr/Dbq2flTtLP1se31cpolnK -OOK5Gv+e5m4y3R6u6jW39ZORTtpC4cMXYFDy0VwmuYK36m3knITnA3kXr5g9lNvH -ugDnuL8BV8F3RTIMO/G0HAiw/VGgod2aHRM2mm23xzy54cXZF/qD1T0VoDy7Hgvi -yJA/qIYM/PmLXoXLT1tLYhFHxUV8BS9BsZ4QaRuZluBVeftOhpm4lNqGOGqTo+fL -buXf6iFViZx9fX+Y9QCJ7uOEwFyWtcVG6kbghVW2G8kS1sHNzYDzAgE8yGnLRUhj -2JTQ7IUOO04RZfSCjKY9ri4ilAnIXOo8gV0WKgOXFlUJ24pBgp5mmxE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i -YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG -EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg -R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 -9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq -fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv -iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU -1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ -bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW -MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA -ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l -uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn -Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS -tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF -PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un -hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV -5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDyzCCArOgAwIBAgIDAOJIMA0GCSqGSIb3DQEBBQUAMIGLMQswCQYDVQQGEwJB -VDFIMEYGA1UECgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBp -bSBlbGVrdHIuIERhdGVudmVya2VociBHbWJIMRgwFgYDVQQLDA9BLVRydXN0LVF1 -YWwtMDIxGDAWBgNVBAMMD0EtVHJ1c3QtUXVhbC0wMjAeFw0wNDEyMDIyMzAwMDBa -Fw0xNDEyMDIyMzAwMDBaMIGLMQswCQYDVQQGEwJBVDFIMEYGA1UECgw/QS1UcnVz -dCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBpbSBlbGVrdHIuIERhdGVudmVy -a2VociBHbWJIMRgwFgYDVQQLDA9BLVRydXN0LVF1YWwtMDIxGDAWBgNVBAMMD0Et -VHJ1c3QtUXVhbC0wMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJaR -q9eOsFm4Ab20Hq2Z/aH86gyWa48uSUjY6eQkguHYuszr3gdcSMYZggFHQgnhfLmf -ro/27l5rqKhWiDhWs+b+yZ1PNDhRPJy+86ycHMg9XJqErveULBSyZDdgjhSwOyrN -ibUir/fkf+4sKzP5jjytTKJXD/uCxY4fAd9TjMEVpN3umpIS0ijpYhclYDHvzzGU -833z5Dwhq5D8bc9jp8YSAHFJ1xzIoO1jmn3jjyjdYPnY5harJtHQL73nDQnfbtTs -5ThT9GQLulrMgLU4WeyAWWWEMWpfVZFMJOUkmoOEer6A8e5fIAeqdxdsC+JVqpZ4 -CAKel/Arrlj1gFA//jsCAwEAAaM2MDQwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4E -CgQIQj0rJKbBRc4wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBG -yxFjUA2bPkXUSC2SfJ29tmrbiLKal+g6a9M8Xwd+Ejo+oYkNP6F4GfeDtAXpm7xb -9Ly8lhdbHcpRhzCUQHJ1tBCiGdLgmhSx7TXjhhanKOdDgkdsC1T+++piuuYL72TD -gUy2Sb1GHlJ1Nc6rvB4fpxSDAOHqGpUq9LWsc3tFkXqRqmQVtqtR77npKIFBioc6 -2jTBwDMPX3hDJDR1DSPc6BnZliaNw2IHdiMQ0mBoYeRnFdq+TyDKsjmJOOQPLzzL -/saaw6F891+gBjLFEFquDyR73lAPJS279R3csi8WWk4ZYUC/1V8H3Ktip/J6ac8e -qhLCbmJ81Lo92JGHz/ot ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ -RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD -VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX -DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y -ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy -VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr -mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr -IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK -mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu -XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy -dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye -jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 -BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 -DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 -9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx -jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 -Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz -ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS -R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC -VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 -Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW -KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl -cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw -NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw -NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy -ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV -BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ -KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo -Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 -4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 -KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI -rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi -94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB -sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi -gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo -kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE -vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA -A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t -O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua -AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP -9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ -eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m -0vdXcDazv/wor3ElhVsT/h5/WrQ8 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICpzCCAi2gAwIBAgIQTHm1miicdjFk9YlE0JEC3jAKBggqhkjOPQQDAzCBlDEL -MAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYD -VQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBD -bGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0g -RzQwHhcNMTIxMDE4MDAwMDAwWhcNMzcxMjAxMjM1OTU5WjCBlDELMAkGA1UEBhMC -VVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZTeW1h -bnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAzIFB1 -YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAARXz+qzOU0/oSHgbi84csaHl/OFC0fnD1HI0fSZm8pZ -Zf9M+eoLtyXV0vbsMS0yYhLXdoan+jjJZdT+c+KEOfhMSWIT3brViKBfPchPsD+P -oVAR5JNGrcNfy/GkapVW6MCjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBQknbzScfcdwiW+IvGJpSwVOzQeXjAKBggqhkjOPQQD -AwNoADBlAjEAuWZoZdsF0Dh9DvPIdWG40CjEsUozUVj78jwQyK5HeHbKZiQXhj5Q -Vm6lLZmIuL0kAjAD6qfnqDzqnWLGX1TamPR3vU+PGJyRXEdrQE0QHbPhicoLIsga -xcX+i93B3294n5E= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j -ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL -MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 -LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug -RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm -+9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW -PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM -xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB -Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 -hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg -EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF -MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA -FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec -nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z -eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF -hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 -Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe -vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep -+OkuE6N36B9K ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGHDCCBASgAwIBAgIES45gAzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJE -SzESMBAGA1UEChMJVFJVU1QyNDA4MSIwIAYDVQQDExlUUlVTVDI0MDggT0NFUyBQ -cmltYXJ5IENBMB4XDTEwMDMwMzEyNDEzNFoXDTM3MTIwMzEzMTEzNFowRTELMAkG -A1UEBhMCREsxEjAQBgNVBAoTCVRSVVNUMjQwODEiMCAGA1UEAxMZVFJVU1QyNDA4 -IE9DRVMgUHJpbWFyeSBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -AJlJodr3U1Fa+v8HnyACHV81/wLevLS0KUk58VIABl6Wfs3LLNoj5soVAZv4LBi5 -gs7E8CZ9w0F2CopW8vzM8i5HLKE4eedPdnaFqHiBZ0q5aaaQArW+qKJx1rT/AaXt -alMB63/yvJcYlXS2lpexk5H/zDBUXeEQyvfmK+slAySWT6wKxIPDwVapauFY9QaG -+VBhCa5jBstWS7A5gQfEvYqn6csZ3jW472kW6OFNz6ftBcTwufomGJBMkonf4ZLr -6t0AdRi9jflBPz3MNNRGxyjIuAmFqGocYFA/OODBRjvSHB2DygqQ8k+9tlpvzMRr -kU7jq3RKL+83G1dJ3/LTjCLz4ryEMIC/OJ/gNZfE0qXddpPtzflIPtUFVffXdbFV -1t6XZFhJ+wBHQCpJobq/BjqLWUA86upsDbfwnePtmIPRCemeXkY0qabC+2Qmd2Fe -xyZphwTyMnbqy6FG1tB65dYf3mOqStmLa3RcHn9+2dwNfUkh0tjO2FXD7drWcU0O -I9DW8oAypiPhm/QCjMU6j6t+0pzqJ/S0tdAo+BeiXK5hwk6aR+sRb608QfBbRAs3 -U/q8jSPByenggac2BtTN6cl+AA1Mfcgl8iXWNFVGegzd/VS9vINClJCe3FNVoUnR -YCKkj+x0fqxvBLopOkJkmuZw/yhgMxljUi2qYYGn90OzAgMBAAGjggESMIIBDjAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjARBgNVHSAECjAIMAYGBFUd -IAAwgZcGA1UdHwSBjzCBjDAsoCqgKIYmaHR0cDovL2NybC5vY2VzLnRydXN0MjQw -OC5jb20vb2Nlcy5jcmwwXKBaoFikVjBUMQswCQYDVQQGEwJESzESMBAGA1UEChMJ -VFJVU1QyNDA4MSIwIAYDVQQDExlUUlVTVDI0MDggT0NFUyBQcmltYXJ5IENBMQ0w -CwYDVQQDEwRDUkwxMB8GA1UdIwQYMBaAFPZt+LFIs0FDAduGROUYBbdezAY3MB0G -A1UdDgQWBBT2bfixSLNBQwHbhkTlGAW3XswGNzANBgkqhkiG9w0BAQsFAAOCAgEA -VPAQGrT7dIjD3/sIbQW86f9CBPu0c7JKN6oUoRUtKqgJ2KCdcB5ANhCoyznHpu3m -/dUfVUI5hc31CaPgZyY37hch1q4/c9INcELGZVE/FWfehkH+acpdNr7j8UoRZlkN -15b/0UUBfGeiiJG/ugo4llfoPrp8bUmXEGggK3wyqIPcJatPtHwlb6ympfC2b/Ld -v/0IdIOzIOm+A89Q0utx+1cOBq72OHy8gpGb6MfncVFMoL2fjP652Ypgtr8qN9Ka -/XOazktiIf+2Pzp7hLi92hRc9QMYexrV/nnFSQoWdU8TqULFUoZ3zTEC3F/g2yj+ -FhbrgXHGo5/A4O74X+lpbY2XV47aSuw+DzcPt/EhMj2of7SA55WSgbjPMbmNX0rb -oenSIte2HRFW5Tr2W+qqkc/StixgkKdyzGLoFx/xeTWdJkZKwyjqge2wJqws2upY -EiThhC497+/mTiSuXd69eVUwKyqYp9SD2rTtNmF6TCghRM/dNsJOl+osxDVGcwvt -WIVFF/Onlu5fu1NHXdqNEfzldKDUvCfii3L2iATTZyHwU9CALE+2eIA+PIaLgnM1 -1oCfUnYBkQurTrihvzz9PryCVkLxiqRmBVvUz+D4N5G/wvvKDS6t6cPCS+hqM482 -cbBsn0R9fFLO4El62S9eH1tqOzO20OAOK65yJIsOpSE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY -MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t -dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5 -WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD -VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8 -9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ -DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9 -Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N -QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ -xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G -A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG -kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr -Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5 -Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU -JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot -RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICkDCCAfmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBaMQswCQYDVQQGEwJVUzEc -MBoGA1UEChMTRXF1aWZheCBTZWN1cmUgSW5jLjEtMCsGA1UEAxMkRXF1aWZheCBT -ZWN1cmUgR2xvYmFsIGVCdXNpbmVzcyBDQS0xMB4XDTk5MDYyMTA0MDAwMFoXDTIw -MDYyMTA0MDAwMFowWjELMAkGA1UEBhMCVVMxHDAaBgNVBAoTE0VxdWlmYXggU2Vj -dXJlIEluYy4xLTArBgNVBAMTJEVxdWlmYXggU2VjdXJlIEdsb2JhbCBlQnVzaW5l -c3MgQ0EtMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAuucXkAJlsTRVPEnC -UdXfp9E3j9HngXNBUmCbnaEXJnitx7HoJpQytd4zjTov2/KaelpzmKNc6fuKcxtc -58O/gGzNqfTWK8D3+ZmqY6KxRwIP1ORROhI8bIpaVIRw28HFkM9yRcuoWcDNM50/ -o5brhTMhHD4ePmBudpxnhcXIw2ECAwEAAaNmMGQwEQYJYIZIAYb4QgEBBAQDAgAH -MA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUvqigdHJQa0S3ySPY+6j/s1dr -aGwwHQYDVR0OBBYEFL6ooHRyUGtEt8kj2Puo/7NXa2hsMA0GCSqGSIb3DQEBBAUA -A4GBADDiAVGqx+pf2rnQZQ8w1j7aDRRJbpGTJxQx78T3LUX47Me/okENI7SS+RkA -Z70Br83gcfxaz2TE4JaY0KNA4gGK7ycH8WUBikQtBmV1UsCGECAhX2xrD2yuCRyv -8qIYNMR1pHMc8Y3c7635s3a0kr/clRAevsvIO1qEYBlWlKlV ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF5zCCA8+gAwIBAgIITK9zQhyOdAIwDQYJKoZIhvcNAQEFBQAwgYAxODA2BgNV -BAMML0VCRyBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMTcwNQYDVQQKDC5FQkcgQmlsacWfaW0gVGVrbm9sb2ppbGVyaSB2ZSBIaXpt -ZXRsZXJpIEEuxZ4uMQswCQYDVQQGEwJUUjAeFw0wNjA4MTcwMDIxMDlaFw0xNjA4 -MTQwMDMxMDlaMIGAMTgwNgYDVQQDDC9FQkcgRWxla3Ryb25payBTZXJ0aWZpa2Eg -SGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTE3MDUGA1UECgwuRUJHIEJpbGnFn2ltIFRl -a25vbG9qaWxlcmkgdmUgSGl6bWV0bGVyaSBBLsWeLjELMAkGA1UEBhMCVFIwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDuoIRh0DpqZhAy2DE4f6en5f2h -4fuXd7hxlugTlkaDT7byX3JWbhNgpQGR4lvFzVcfd2NR/y8927k/qqk153nQ9dAk -tiHq6yOU/im/+4mRDGSaBUorzAzu8T2bgmmkTPiab+ci2hC6X5L8GCcKqKpE+i4s -tPtGmggDg3KriORqcsnlZR9uKg+ds+g75AxuetpX/dfreYteIAbTdgtsApWjluTL -dlHRKJ2hGvxEok3MenaoDT2/F08iiFD9rrbskFBKW5+VQarKD7JK/oCZTqNGFav4 -c0JqwmZ2sQomFd2TkuzbqV9UIlKRcF0T6kjsbgNs2d1s/OsNA/+mgxKb8amTD8Um -TDGyY5lhcucqZJnSuOl14nypqZoaqsNW2xCaPINStnuWt6yHd6i58mcLlEOzrz5z -+kI2sSXFCjEmN1ZnuqMLfdb3ic1nobc6HmZP9qBVFCVMLDMNpkGMvQQxahByCp0O -Lna9XvNRiYuoP1Vzv9s6xiQFlpJIqkuNKgPlV5EQ9GooFW5Hd4RcUXSfGenmHmMW -OeMRFeNYGkS9y8RsZteEBt8w9DeiQyJ50hBs37vmExH8nYQKE3vwO9D8owrXieqW -fo1IhR5kX9tUoqzVegJ5a9KK8GfaZXINFHDk6Y54jzJ0fFfy1tb0Nokb+Clsi7n2 -l9GkLqq+CxnCRelwXQIDAJ3Zo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB -/wQEAwIBBjAdBgNVHQ4EFgQU587GT/wWZ5b6SqMHwQSny2re2kcwHwYDVR0jBBgw -FoAU587GT/wWZ5b6SqMHwQSny2re2kcwDQYJKoZIhvcNAQEFBQADggIBAJuYml2+ -8ygjdsZs93/mQJ7ANtyVDR2tFcU22NU57/IeIl6zgrRdu0waypIN30ckHrMk2pGI -6YNw3ZPX6bqz3xZaPt7gyPvT/Wwp+BVGoGgmzJNSroIBk5DKd8pNSe/iWtkqvTDO -TLKBtjDOWU/aWR1qeqRFsIImgYZ29fUQALjuswnoT4cCB64kXPBfrAowzIpAoHME -wfuJJPaaHFy3PApnNgUIMbOv2AFoKuB4j3TeuFGkjGwgPaL7s9QJ/XvCgKqTbCmY -Iai7FvOpEl90tYeY8pUm3zTvilORiF0alKM/fCL414i6poyWqD1SNGKfAB5UVUJn -xk1Gj7sURT0KlhaOEKGXmdXTMIXM3rRyt7yKPBgpaP3ccQfuJDlq+u2lrDgv+R4Q -DgZxGhBM/nV+/x5XOULK1+EVoVZVWRvRo68R2E7DpSvvkL/A7IITW43WciyTTo9q -Kd+FPNMN4KIYEsxVL0e3p5sC/kH2iExt2qkBR4NkJ2IQgtYSe14DHzSpyZH+r11t -hie3I6p1GMog57AP14kOpmciY/SDQSsGS7tY1dHXt7kQY9iJSrSq3RZj9W6+YKH4 -7ejWkE8axsWgKdOnIaj1Wjz3x0miIZpKlVIglnKaZsv30oZDfCK+lvm9AahH3eU7 -QPl1K5srRmSGjR70j/sHd9DqSaIcjVIUpgqT ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFFzCCA/+gAwIBAgIBETANBgkqhkiG9w0BAQUFADCCASsxCzAJBgNVBAYTAlRS -MRgwFgYDVQQHDA9HZWJ6ZSAtIEtvY2FlbGkxRzBFBgNVBAoMPlTDvHJraXllIEJp -bGltc2VsIHZlIFRla25vbG9qaWsgQXJhxZ90xLFybWEgS3VydW11IC0gVMOcQsSw -VEFLMUgwRgYDVQQLDD9VbHVzYWwgRWxla3Ryb25payB2ZSBLcmlwdG9sb2ppIEFy -YcWfdMSxcm1hIEVuc3RpdMO8c8O8IC0gVUVLQUUxIzAhBgNVBAsMGkthbXUgU2Vy -dGlmaWthc3lvbiBNZXJrZXppMUowSAYDVQQDDEFUw5xCxLBUQUsgVUVLQUUgS8O2 -ayBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsSAtIFPDvHLDvG0gMzAe -Fw0wNzA4MjQxMTM3MDdaFw0xNzA4MjExMTM3MDdaMIIBKzELMAkGA1UEBhMCVFIx -GDAWBgNVBAcMD0dlYnplIC0gS29jYWVsaTFHMEUGA1UECgw+VMO8cmtpeWUgQmls -aW1zZWwgdmUgVGVrbm9sb2ppayBBcmHFn3TEsXJtYSBLdXJ1bXUgLSBUw5xCxLBU -QUsxSDBGBgNVBAsMP1VsdXNhbCBFbGVrdHJvbmlrIHZlIEtyaXB0b2xvamkgQXJh -xZ90xLFybWEgRW5zdGl0w7xzw7wgLSBVRUtBRTEjMCEGA1UECwwaS2FtdSBTZXJ0 -aWZpa2FzeW9uIE1lcmtlemkxSjBIBgNVBAMMQVTDnELEsFRBSyBVRUtBRSBLw7Zr -IFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxIC0gU8O8csO8bSAzMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAim1L/xCIOsP2fpTo6iBkcK4h -gb46ezzb8R1Sf1n68yJMlaCQvEhOEav7t7WNeoMojCZG2E6VQIdhn8WebYGHV2yK -O7Rm6sxA/OOqbLLLAdsyv9Lrhc+hDVXDWzhXcLh1xnnRFDDtG1hba+818qEhTsXO -fJlfbLm4IpNQp81McGq+agV/E5wrHur+R84EpW+sky58K5+eeROR6Oqeyjh1jmKw -lZMq5d/pXpduIF9fhHpEORlAHLpVK/swsoHvhOPc7Jg4OQOFCKlUAwUp8MmPi+oL -hmUZEdPpCSPeaJMDyTYcIW7OjGbxmTDY17PDHfiBLqi9ggtm/oLL4eAagsNAgQID -AQABo0IwQDAdBgNVHQ4EFgQUvYiHyY/2pAoLquvF/pEjnatKijIwDgYDVR0PAQH/ -BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAB18+kmP -NOm3JpIWmgV050vQbTlswyb2zrgxvMTfvCr4N5EY3ATIZJkrGG2AA1nJrvhY0D7t -wyOfaTyGOBye79oneNGEN3GKPEs5z35FBtYt2IpNeBLWrcLTy9LQQfMmNkqblWwM -7uXRQydmwYj3erMgbOqwaSvHIOgMA8RBBZniP+Rr+KCGgceExh/VS4ESshYhLBOh -gLJeDEoTniDYYkCrkOpkSi+sDQESeUWoL4cZaMjihccwsnX5OD+ywJO0a+IDRM5n -oN+J1q2MdqMTw5RhK2vZbMEHCiIHhWyFJEapvj+LeISCfiQMnf2BN+MlqO02TpUs -yZyQ2uypQjyttgI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPTCCAyWgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvzE/MD0GA1UEAww2VMOc -UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMV4wXAYDVQQKDFVUw5xS -S1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kg -SGl6bWV0bGVyaSBBLsWeLiAoYykgQXJhbMSxayAyMDA3MB4XDTA3MTIyNTE4Mzcx -OVoXDTE3MTIyMjE4MzcxOVowgb8xPzA9BgNVBAMMNlTDnFJLVFJVU1QgRWxla3Ry -b25payBTZXJ0aWZpa2EgSGl6bWV0IFNhxJ9sYXnEsWPEsXPEsTELMAkGA1UEBhMC -VFIxDzANBgNVBAcMBkFua2FyYTFeMFwGA1UECgxVVMOcUktUUlVTVCBCaWxnaSDE -sGxldGnFn2ltIHZlIEJpbGnFn2ltIEfDvHZlbmxpxJ9pIEhpem1ldGxlcmkgQS7F -ni4gKGMpIEFyYWzEsWsgMjAwNzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKu3PgqMyKVYFeaK7yc9SrToJdPNM8Ig3BnuiD9NYvDdE3ePYakqtdTyuTFY -KTsvP2qcb3N2Je40IIDu6rfwxArNK4aUyeNgsURSsloptJGXg9i3phQvKUmi8wUG -+7RP2qFsmmaf8EMJyupyj+sA1zU511YXRxcw9L6/P8JorzZAwan0qafoEGsIiveG -HtyaKhUG9qPw9ODHFNRRf8+0222vR5YXm3dx2KdxnSQM9pQ/hTEST7ruToK4uT6P -IzdezKKqdfcYbwnTrqdUKDT74eA7YH2gvnmJhsifLfkKS8RQouf9eRbHegsYz85M -733WB2+Y8a+xwXrXgTW4qhe04MsCAwEAAaNCMEAwHQYDVR0OBBYEFCnFkKslrxHk -Yb+j/4hhkeYO/pyBMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0G -CSqGSIb3DQEBBQUAA4IBAQAQDdr4Ouwo0RSVgrESLFF6QSU2TJ/sPx+EnWVUXKgW -AkD6bho3hO9ynYYKVZ1WKKxmLNA6VpM0ByWtCLCPyA8JWcqdmBzlVPi5RX9ql2+I -aE1KBiY3iAIOtsbWcpnOa3faYjGkVh+uX4132l32iPwa2Z61gfAyuOOI0JzzaqC5 -mxRZNTZPz/OOXl0XrRWV2N2y1RVuAE6zS89mlOTgzbUF2mNXi+WzqtvALhyQRNsa -XRik7r4EW5nVcV9VZWRi1aKbBFmGyGJ353yCRWo9F7/snXUMrqNvWtMvmDb08PUZ -qxFdyKbjKlhqQgnDvZImZjINXQhVdP+MmNAKpoRq0Tl9 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEYDCCA0igAwIBAgICATAwDQYJKoZIhvcNAQELBQAwWTELMAkGA1UEBhMCVVMx -GDAWBgNVBAoTD1UuUy4gR292ZXJubWVudDENMAsGA1UECxMERlBLSTEhMB8GA1UE -AxMYRmVkZXJhbCBDb21tb24gUG9saWN5IENBMB4XDTEwMTIwMTE2NDUyN1oXDTMw -MTIwMTE2NDUyN1owWTELMAkGA1UEBhMCVVMxGDAWBgNVBAoTD1UuUy4gR292ZXJu -bWVudDENMAsGA1UECxMERlBLSTEhMB8GA1UEAxMYRmVkZXJhbCBDb21tb24gUG9s -aWN5IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2HX7NRY0WkG/ -Wq9cMAQUHK14RLXqJup1YcfNNnn4fNi9KVFmWSHjeavUeL6wLbCh1bI1FiPQzB6+ -Duir3MPJ1hLXp3JoGDG4FyKyPn66CG3G/dFYLGmgA/Aqo/Y/ISU937cyxY4nsyOl -4FKzXZbpsLjFxZ+7xaBugkC7xScFNknWJidpDDSPzyd6KgqjQV+NHQOGgxXgVcHF -mCye7Bpy3EjBPvmE0oSCwRvDdDa3ucc2Mnr4MrbQNq4iGDGMUHMhnv6DOzCIJOPp -wX7e7ZjHH5IQip9bYi+dpLzVhW86/clTpyBLqtsgqyFOHQ1O5piF5asRR12dP8Qj -wOMUBm7+nQIDAQABo4IBMDCCASwwDwYDVR0TAQH/BAUwAwEB/zCB6QYIKwYBBQUH -AQsEgdwwgdkwPwYIKwYBBQUHMAWGM2h0dHA6Ly9odHRwLmZwa2kuZ292L2ZjcGNh -L2NhQ2VydHNJc3N1ZWRCeWZjcGNhLnA3YzCBlQYIKwYBBQUHMAWGgYhsZGFwOi8v -bGRhcC5mcGtpLmdvdi9jbj1GZWRlcmFsJTIwQ29tbW9uJTIwUG9saWN5JTIwQ0Es -b3U9RlBLSSxvPVUuUy4lMjBHb3Zlcm5tZW50LGM9VVM/Y0FDZXJ0aWZpY2F0ZTti -aW5hcnksY3Jvc3NDZXJ0aWZpY2F0ZVBhaXI7YmluYXJ5MA4GA1UdDwEB/wQEAwIB -BjAdBgNVHQ4EFgQUrQx6dVzl85jEeZgOrCj9l/TnAvwwDQYJKoZIhvcNAQELBQAD -ggEBAI9z2uF/gLGH9uwsz9GEYx728Yi3mvIRte9UrYpuGDco71wb5O9Qt2wmGCMi -TR0mRyDpCZzicGJxqxHPkYnos/UqoEfAFMtOQsHdDA4b8Idb7OV316rgVNdF9IU+ -7LQd3nyKf1tNnJaK0KIyn9psMQz4pO9+c+iR3Ah6cFqgr2KBWfgAdKLI3VTKQVZH -venAT+0g3eOlCd+uKML80cgX2BLHb94u6b2akfI8WpQukSKAiaGMWMyDeiYZdQKl -Dn0KJnNR6obLB6jI/WNaNZvSr79PMUjBhHDbNXuaGQ/lj/RqDG8z2esccKIN47lQ -A2EC/0rskqTcLe4qNJMHtyznGI8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjEL -MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZW -ZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2ln -biwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJp -U2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9y -aXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJp -U2lnbiBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwg -SW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2ln -biBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8Utpkmw4tXNherJI9/gHm -GUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGzrl0Bp3ve -fLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUw -AwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJ -aW1hZ2UvZ2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYj -aHR0cDovL2xvZ28udmVyaXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMW -kf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMDA2gAMGUCMGYhDBgmYFo4e1ZC -4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIxAJw9SDkjOVga -FRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID4TCCAsmgAwIBAgIOYyUAAQACFI0zFQLkbPQwDQYJKoZIhvcNAQEFBQAwezEL -MAkGA1UEBhMCREUxHDAaBgNVBAoTE1RDIFRydXN0Q2VudGVyIEdtYkgxJDAiBgNV -BAsTG1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQTEoMCYGA1UEAxMfVEMgVHJ1 -c3RDZW50ZXIgVW5pdmVyc2FsIENBIElJSTAeFw0wOTA5MDkwODE1MjdaFw0yOTEy -MzEyMzU5NTlaMHsxCzAJBgNVBAYTAkRFMRwwGgYDVQQKExNUQyBUcnVzdENlbnRl -ciBHbWJIMSQwIgYDVQQLExtUQyBUcnVzdENlbnRlciBVbml2ZXJzYWwgQ0ExKDAm -BgNVBAMTH1RDIFRydXN0Q2VudGVyIFVuaXZlcnNhbCBDQSBJSUkwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDC2pxisLlxErALyBpXsq6DFJmzNEubkKLF -5+cvAqBNLaT6hdqbJYUtQCggbergvbFIgyIpRJ9Og+41URNzdNW88jBmlFPAQDYv -DIRlzg9uwliT6CwLOunBjvvya8o84pxOjuT5fdMnnxvVZ3iHLX8LR7PH6MlIfK8v -zArZQe+f/prhsq75U7Xl6UafYOPfjdN/+5Z+s7Vy+EutCHnNaYlAJ/Uqwa1D7KRT -yGG299J5KmcYdkhtWyUB0SbFt1dpIxVbYYqt8Bst2a9c8SaQaanVDED1M4BDj5yj -dipFtK+/fz6HP3bFzSreIMUWWMv5G/UPyw0RUmS40nZid4PxWJ//AgMBAAGjYzBh -MB8GA1UdIwQYMBaAFFbn4VslQ4Dg9ozhcbyO5YAvxEjiMA8GA1UdEwEB/wQFMAMB -Af8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRW5+FbJUOA4PaM4XG8juWAL8RI -4jANBgkqhkiG9w0BAQUFAAOCAQEAg8ev6n9NCjw5sWi+e22JLumzCecYV42Fmhfz -dkJQEw/HkG8zrcVJYCtsSVgZ1OK+t7+rSbyUyKu+KGwWaODIl0YgoGhnYIg5IFHY -aAERzqf2EQf27OysGh+yZm5WZ2B6dF7AbZc2rrUNXWZzwCUyRdhKBgePxLcHsU0G -DeGl6/R1yrqc0L2z0zIkTO5+4nYES0lT2PLpVDP85XEfPRRclkvxOvIAu2y0+pZV -CIgJwcyRGSmwIC3/yzikQOEXvnlhgP8HA4ZMTnsGnxGGjYnuJ8Tb4rwZjgvDwxPH -LQNjO9Po5KIqwoIIlBZU8O8fJ5AluA0OKBtHd0e9HKgl8ZS0Zg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDcTCCAlmgAwIBAgIVAOYJ/nrqAGiM4CS07SAbH+9StETRMA0GCSqGSIb3DQEB -BQUAMFAxCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGlj -emVuaW93YSBTLkEuMRcwFQYDVQQDDA5TWkFGSVIgUk9PVCBDQTAeFw0xMTEyMDYx -MTEwNTdaFw0zMTEyMDYxMTEwNTdaMFAxCzAJBgNVBAYTAlBMMSgwJgYDVQQKDB9L -cmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRcwFQYDVQQDDA5TWkFGSVIg -Uk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKxHL49ZMTml -6g3wpYwrvQKkvc0Kc6oJ5sxfgmp1qZfluwbv88BdocHSiXlY8NzrVYzuWBp7J/9K -ULMAoWoTIzOQ6C9TNm4YbA9A1jdX1wYNL5Akylf8W5L/I4BXhT9KnlI6x+a7BVAm -nr/Ttl+utT/Asms2fRfEsF2vZPMxH4UFqOAhFjxTkmJWf2Cu4nvRQJHcttB+cEAo -ag/hERt/+tzo4URz6x6r19toYmxx4FjjBkUhWQw1X21re//Hof2+0YgiwYT84zLb -eqDqCOMOXxvH480yGDkh/QoazWX3U75HQExT/iJlwnu7I1V6HXztKIwCBjsxffbH -3jOshCJtywcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC -AQYwHQYDVR0OBBYEFFOSo33/gnbwM9TrkmdHYTMbaDsqMA0GCSqGSIb3DQEBBQUA -A4IBAQA5UFWd5EL/pBviIMm1zD2JLUCpp0mJG7JkwznIOzawhGmFFaxGoxAhQBEg -haP+E0KR66oAwVC6xe32QUVSHfWqWndzbODzLB8yj7WAR0cDM45ZngSBPBuFE3Wu -GLJX9g100ETfIX+4YBR/4NR/uvTnpnd9ete7Whl0ZfY94yuu4xQqB5QFv+P7IXXV -lTOjkjuGXEcyQAjQzbFaT9vIABSbeCXWBbjvOXukJy6WgAiclzGNSYprre8Ryydd -fmjW9HIGwsIO03EldivvqEYL1Hv1w/Pur+6FUEOaL68PEIUovfgwIB2BAw+vZDuw -cH0mX548PojGyg434cDjkSXa3mHF ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEPDCCAySgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBvjE/MD0GA1UEAww2VMOc -UktUUlVTVCBFbGVrdHJvbmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sx -c8SxMQswCQYDVQQGEwJUUjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xS -S1RSVVNUIEJpbGdpIMSwbGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kg -SGl6bWV0bGVyaSBBLsWeLiAoYykgS2FzxLFtIDIwMDUwHhcNMDUxMTA3MTAwNzU3 -WhcNMTUwOTE2MTAwNzU3WjCBvjE/MD0GA1UEAww2VMOcUktUUlVTVCBFbGVrdHJv -bmlrIFNlcnRpZmlrYSBIaXptZXQgU2HEn2xhecSxY8Sxc8SxMQswCQYDVQQGEwJU -UjEPMA0GA1UEBwwGQW5rYXJhMV0wWwYDVQQKDFRUw5xSS1RSVVNUIEJpbGdpIMSw -bGV0acWfaW0gdmUgQmlsacWfaW0gR8O8dmVubGnEn2kgSGl6bWV0bGVyaSBBLsWe -LiAoYykgS2FzxLFtIDIwMDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQCpNn7DkUNMwxmYCMjHWHtPFoylzkkBH3MOrHUTpvqeLCDe2JAOCtFp0if7qnef -J1Il4std2NiDUBd9irWCPwSOtNXwSadktx4uXyCcUHVPr+G1QRT0mJKIx+XlZEdh -R3n9wFHxwZnn3M5q+6+1ATDcRhzviuyV79z/rxAc653YsKpqhRgNF8k+v/Gb0AmJ -Qv2gQrSdiVFVKc8bcLyEVK3BEx+Y9C52YItdP5qtygy/p1Zbj3e41Z55SZI/4PGX -JHpsmxcPbe9TmJEr5A++WXkHeLuXlfSfadRYhwqp48y2WBmfJiGxxFmNskF1wK1p -zpwACPI2/z7woQ8arBT9pmAPAgMBAAGjQzBBMB0GA1UdDgQWBBTZN7NOBf3Zz58S -Fq62iS/rJTqIHDAPBgNVHQ8BAf8EBQMDBwYAMA8GA1UdEwEB/wQFMAMBAf8wDQYJ -KoZIhvcNAQEFBQADggEBAHJglrfJ3NgpXiOFX7KzLXb7iNcX/nttRbj2hWyfIvwq -ECLsqrkw9qtY1jkQMZkpAL2JZkH7dN6RwRgLn7Vhy506vvWolKMiVW4XSf/SKfE4 -Jl3vpao6+XF75tpYHdN0wgH6PmlYX63LaL4ULptswLbcoCb6dxriJNoaN+BnrdFz -gw2lGh1uEpJ+hGIAF728JRhX8tepb1mIvDS3LoV4nZbcFMMsilKbloxSZj2GFotH -uFEJjOp9zYhys2AzsfAKRO8P9Qk3iCQOLGsgOqL6EfJANZxEaGM7rDNvY7wsu/LS -y3Z9fYjYHcgFHW68lKlmjHdxx/qR+i9Rnuk5UrbnBEI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDfTCCAmWgAwIBAgIBADANBgkqhkiG9w0BAQUFADBgMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEqMCgGA1UECxMh -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBFViBSb290Q0ExMB4XDTA3MDYwNjAyMTIz -MloXDTM3MDYwNjAyMTIzMlowYDELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09N -IFRydXN0IFN5c3RlbXMgQ08uLExURC4xKjAoBgNVBAsTIVNlY3VyaXR5IENvbW11 -bmljYXRpb24gRVYgUm9vdENBMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBALx/7FebJOD+nLpCeamIivqA4PUHKUPqjgo0No0c+qe1OXj/l3X3L+SqawSE -RMqm4miO/VVQYg+kcQ7OBzgtQoVQrTyWb4vVog7P3kmJPdZkLjjlHmy1V4qe70gO -zXppFodEtZDkBp2uoQSXWHnvIEqCa4wiv+wfD+mEce3xDuS4GBPMVjZd0ZoeUWs5 -bmB2iDQL87PRsJ3KYeJkHcFGB7hj3R4zZbOOCVVSPbW9/wfrrWFVGCypaZhKqkDF -MxRldAD5kd6vA0jFQFTcD4SQaCDFkpbcLuUCRarAX1T4bepJz11sS6/vmsJWXMY1 -VkJqMF/Cq/biPT+zyRGPMUzXn0kCAwEAAaNCMEAwHQYDVR0OBBYEFDVK9U2vP9eC -OKyrcWUXdYydVZPmMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0G -CSqGSIb3DQEBBQUAA4IBAQCoh+ns+EBnXcPBZsdAS5f8hxOQWsTvoMpfi7ent/HW -tWS3irO4G8za+6xmiEHO6Pzk2x6Ipu0nUBsCMCRGef4Eh3CXQHPRwMFXGZpppSeZ -q51ihPZRwSzJIxXYKLerJRO1RuGGAv8mjMSIkh1W/hln8lXkgKNrnKt34VFxDSDb -EJrbvXZ5B3eZKK2aXtqxT0QsNY6llsf9g/BYxnnWmHyojf6GPgcWkuF75x3sM3Z+ -Qi5KhfmRiWiEA4Glm5q+4zfFVKtWOxgtQaQM+ELbmaDgcm+7XeEWT1MKZPlO9L9O -VL14bIjqv5wTJMJwaaJ/D8g8rQjJsJhAoyrniIPtd490 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICqDCCAi2gAwIBAgIQNBdlEkA7t1aALYDLeVWmHjAKBggqhkjOPQQDAzCBlDEL -MAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYD -VQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBD -bGFzcyAyIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0g -RzQwHhcNMTExMDA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBlDELMAkGA1UEBhMC -VVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZTeW1h -bnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAyIFB1 -YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAATR2UqOTA2ESlG6fO/TzPo6mrWnYxM9AeBJPvrBR8mS -szrX/m+c95o6D/UOCgrDP8jnEhSO1dVtmCyzcTIK6yq99tdqIAtnRZzSsr9TImYJ -XdsR8/EFM1ij4rjPfM2Cm72jQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBQ9MvM6qQyQhPmijGkGYVQvh3L+BTAKBggqhkjOPQQD -AwNpADBmAjEAyKapr0F/tckRQhZoaUxcuCcYtpjxwH+QbYfTjEYX8D5P/OqwCMR6 -S7wIL8fip29lAjEA1lnehs5fDspU1cbQFQ78i5Ry1I4AWFPPfrFLDeVQhuuea9// -KabYR9mglhjb8kWz ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMyBSb290IENBMB4XDTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRHsJ8Y -ZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3E -N3coTRiR5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9 -tznDDgFHmV0ST9tD+leh7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX -0DJq1l1sDPGzbjniazEuOQAnFN44wOwZZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c -/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH2xc519woe2v1n/MuwU8X -KhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV/afmiSTY -zIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvS -O1UQRwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D -34xFMFbG02SrZvPAXpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgP -K9Dx2hzLabjKSWJtyNBjYt1gD1iqj6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3 -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFEe4zf/lb+74suwv -Tg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAACAj -QTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV -cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXS -IGrs/CIBKM+GuIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2 -HJLw5QY33KbmkJs4j1xrG0aGQ0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsa -O5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8ZORK15FTAaggiG6cX0S5y2CBNOxv -033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2KSb12tjE8nVhz36u -dmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz6MkE -kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41 -3OEMXbugUZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvD -u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq -4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIF9jCCA96gAwIBAgIQZWNxhdNvRcaPfzH5CYeSgjANBgkqhkiG9w0BAQwFADCB -lDELMAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8w -HQYDVQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRl -YyBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -IC0gRzYwHhcNMTIxMDE4MDAwMDAwWhcNMzcxMjAxMjM1OTU5WjCBlDELMAkGA1UE -BhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZT -eW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAz -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzYwggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC3DrL6TbyachX7d1vb/UMPywv3 -YC6zK34Mu1PyzE5l8xm7/zUd99Opu0Attd141Kb5N+qFBXttt+YTSwZ8+3ZjjyAd -LTgrBIXy6LDRX01KIclq2JTqHgJQpqqQB6BHIepm+QSg5oPwxPVeluInTWHDs8GM -IrZmoQDRVin77cF/JMo9+lqUsITDx7pDHP1kDvEo+0dZ8ibhMblE+avd+76+LDfj -rAsY0/wBovGkCjWCR0yrvYpe3xOF/CDMSFmvr0FvyyPNypOn3dVfyGQ7/wEDoApP -LW49hL6vyDKyUymQFfewBZoKPPa5BpDJpeFdoDuw/qi2v/WJKFckOiGGceTciotB -VeweMCRZ0cBZuHivqlp03iWAMJjtMERvIXAc2xJTDtamKGaTLB/MTzwbgcW59nhv -0DI6CHLbaw5GF4WU87zvvPekXo7p6bVk5bdLRRIsTDe3YEMKTXEGAJQmNXQfu3o5 -XE475rgD4seTi4QsJUlF3X8jlGAfy+nN9quX92Hn+39igcjcCjBcGHzmzu/Hbh6H -fLPpysh7avRo/IOlDFa0urKNSgrHl5fFiDAVPRAIVBVycmczM/R8t84AJ1NlziTx -WmTnNi/yLgLCl99y6AIeoPc9tftoYAP6M6nmEm0G4amoXU48/tnnAGWsthlNe4N/ -NEfq4RhtsYsceavnnQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/ -BAUwAwEB/zAdBgNVHQ4EFgQUOXEIAD7eyIbnkP/k/SEPziQZFvYwDQYJKoZIhvcN -AQEMBQADggIBAFBriE1gSM5a4yLOZ3yEp80c/ekMA4w2rwqHDmquV64B0Da78v25 -c8FftaiuTKL6ScsHRhY2vePIVzh+OOS/JTNgxtw3nGO7XpgeGrKC8K6mdxGAREeh -KcXwszrOmPC47NMOgAZ3IzBM/3lkYyJbd5NDS3Wz2ztuO0rd8ciutTeKlYg6EGhw -OLlbcH7VQ8n8X0/l5ns27vAg7UdXEyYQXhQGDXt2B8LGLRb0rqdsD7yID08sAraj -1yLmmUc12I2lT4ESOhF9s8wLdfMecKMbA+r6mujmLjY5zJnOOj8Mt674Q5mwk25v -qtkPajGRu5zTtCj7g0x6c4JQZ9IOrO1gxbJdNZjPh34eWR0kvFa62qRa2MzmvB4Q -jxuMjvPB27e+1LBbZY8WaPNWxSoZFk0PuGWHbSSDuGLc4EdhGoh7zk5//dzGDVqa -pPO1TPbdMaboHREhMzAEYX0c4D5PjT+1ixIAWn2poQDUg+twuxj4pNIcgS23CBHI -Jnu21OUPA0Zy1CVAHr5JXW2T8VyyO3VUaTqg7kwiuqya4gitRWMFSlI1dsQ09V4H -Mq3cfCbRW4+t5OaqG3Wf61206MCpFXxOSgdy30bJ1JGSdVaw4e43NmUoxRXIK3bM -bW8Zg/T92hXiQeczeUaDV/nxpbZt07zXU+fucW14qZen7iCcGRVyFT0E ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQsw -CQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cu -ZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3Qg -RzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1MTIwMDAwWjBlMQswCQYDVQQGEwJV -UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQu -Y29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQBgcq -hkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJf -Zn4f5dwbRXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17Q -RSAPWXYQ1qAk8C3eNvJsKTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/ -BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgFUaFNN6KDec6NHSrkhDAKBggqhkjOPQQD -AwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5FyYZ5eEJJZVrmDxxDnOOlY -JjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy1vUhZscv -6pZjamVFkpUBtA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEUzCCAzugAwIBAgIDAOJDMA0GCSqGSIb3DQEBBQUAMIHPMQswCQYDVQQGEwJB -VDGBizCBiAYDVQQKHoGAAEEALQBUAHIAdQBzAHQAIABHAGUAcwAuACAAZgD8AHIA -IABTAGkAYwBoAGUAcgBoAGUAaQB0AHMAcwB5AHMAdABlAG0AZQAgAGkAbQAgAGUA -bABlAGsAdAByAC4AIABEAGEAdABlAG4AdgBlAHIAawBlAGgAcgAgAEcAbQBiAEgx -GDAWBgNVBAsTD0EtVHJ1c3QtUXVhbC0wMTEYMBYGA1UEAxMPQS1UcnVzdC1RdWFs -LTAxMB4XDTA0MTEzMDIzMDAwMFoXDTE0MTEzMDIzMDAwMFowgc8xCzAJBgNVBAYT -AkFUMYGLMIGIBgNVBAoegYAAQQAtAFQAcgB1AHMAdAAgAEcAZQBzAC4AIABmAPwA -cgAgAFMAaQBjAGgAZQByAGgAZQBpAHQAcwBzAHkAcwB0AGUAbQBlACAAaQBtACAA -ZQBsAGUAawB0AHIALgAgAEQAYQB0AGUAbgB2AGUAcgBrAGUAaAByACAARwBtAGIA -SDEYMBYGA1UECxMPQS1UcnVzdC1RdWFsLTAxMRgwFgYDVQQDEw9BLVRydXN0LVF1 -YWwtMDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmhgdxIbxTGEOH -fXGiewI3NFldAWKFWfLofO+5I1UbvA5avt7IgsGXz/tI/f5HGUbascI0i7xG0tqV -lA5ctQgLRqxgxHtgTkMcqsAEYdsz3LZsCdXO1QrvEBGLTSABdxiL/gSWJ6z77CSw -x7Xg02HwxPV82cjGkSF3ENGJntuIAAnRDWn/ORHjFatNRymoMbHaOEZXSGhf7Y5F -rrHEqGyi9E6sv784De/T1aTvskn8cWeUmDzv//omiG/a/V9KQex/61XN8OthUQVn -X+u/liL2NKx74I2C/GgHX5B0WkPNqsSOgmlvJ/cKuT0PveUgVFDAA0oYBgcE1KDM -lBbN0kmPAgMBAAGjNjA0MA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0OBAoECEs8jB2F -6W+tMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAIUusmJzMJRiQ -8TAHrJAOelfuWoTGcqdIv7Tys/fNl2yF2fjvHT8J01aKialFVpbVeQ2XKb1O2bHO -QYAKgsdZ2jZ/sdL2UVFRTHmidLu6PdgWCBRhJYQELQophO9QVvfhAA0TwbESYqTz -+nlI5Gr7CZe8f6HEmhJmCtUQsdQCufGglRh4T+tIGiNGcnyVEHZ93mSVepFr1VA2 -9CTRPteuGjA81jeAz9peYiFE1CXvxK9cJiv0BcALFLWmADCoRLzIRZhA+sAwYUmw -M1rqVCPA3kBQvIC95tyQvNy2dG0Vs+O6PwLaNX/suSlElQ06X2l1VwMaYb4vZKFq -N0bOhBXEVg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIJmzCCB4OgAwIBAgIBATANBgkqhkiG9w0BAQwFADCCAR4xPjA8BgNVBAMTNUF1 -dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIFJhaXogZGVsIEVzdGFkbyBWZW5lem9s -YW5vMQswCQYDVQQGEwJWRTEQMA4GA1UEBxMHQ2FyYWNhczEZMBcGA1UECBMQRGlz -dHJpdG8gQ2FwaXRhbDE2MDQGA1UEChMtU2lzdGVtYSBOYWNpb25hbCBkZSBDZXJ0 -aWZpY2FjaW9uIEVsZWN0cm9uaWNhMUMwQQYDVQQLEzpTdXBlcmludGVuZGVuY2lh -IGRlIFNlcnZpY2lvcyBkZSBDZXJ0aWZpY2FjaW9uIEVsZWN0cm9uaWNhMSUwIwYJ -KoZIhvcNAQkBFhZhY3JhaXpAc3VzY2VydGUuZ29iLnZlMB4XDTEwMTIyMjE4MDgy -MVoXDTMwMTIxNzIzNTk1OVowggEeMT4wPAYDVQQDEzVBdXRvcmlkYWQgZGUgQ2Vy -dGlmaWNhY2lvbiBSYWl6IGRlbCBFc3RhZG8gVmVuZXpvbGFubzELMAkGA1UEBhMC -VkUxEDAOBgNVBAcTB0NhcmFjYXMxGTAXBgNVBAgTEERpc3RyaXRvIENhcGl0YWwx -NjA0BgNVBAoTLVNpc3RlbWEgTmFjaW9uYWwgZGUgQ2VydGlmaWNhY2lvbiBFbGVj -dHJvbmljYTFDMEEGA1UECxM6U3VwZXJpbnRlbmRlbmNpYSBkZSBTZXJ2aWNpb3Mg -ZGUgQ2VydGlmaWNhY2lvbiBFbGVjdHJvbmljYTElMCMGCSqGSIb3DQEJARYWYWNy -YWl6QHN1c2NlcnRlLmdvYi52ZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -ggIBAME77xNS8ZlW47RsBeEaaRZhJoZ4rw785UAFCuPZOAVMqNS1wMYqzy95q6Gk -UO81ER/ugiQX/KMcq/4HBn83fwdYWxPZfwBfK7BP2p/JsFgzYeFP0BXOLmvoJIzl -Jb6FW+1MPwGBjuaZGFImWZsSmGUclb51mRYMZETh9/J5CLThR1exStxHQptwSzra -zNFpkQY/zmj7+YZNA9yDoroVFv6sybYOZ7OxNDo7zkSLo45I7gMwtxqWZ8VkJZkC -8+p0dX6mkhUT0QAV64Zc9HsZiH/oLhEkXjhrgZ28cF73MXIqLx1fyM4kPH1yOJi/ -R72nMwL7D+Sd6mZgI035TxuHXc2/uOwXfKrrTjaJDz8Jp6DdessOkxIgkKXRjP+F -K3ze3n4NUIRGhGRtyvEjK95/2g02t6PeYiYVGur6ruS49n0RAaSS0/LJb6XzaAAe -0mmO2evnEqxIKwy2mZRNPfAVW1l3wCnWiUwryBU6OsbFcFFrQm+00wOicXvOTHBM -aiCVAVZTb9RSLyi+LJ1llzJZO3pq3IRiiBj38Nooo+2ZNbMEciSgmig7YXaUcmud -SVQvLSL+Yw+SqawyezwZuASbp7d/0rutQ59d81zlbMt3J7yB567rT2IqIydQ8qBW -k+fmXzghX+/FidYsh/aK+zZ7Wy68kKHuzEw1Vqkat5DGs+VzAgMBAAGjggLeMIIC -2jASBgNVHRMBAf8ECDAGAQH/AgECMDcGA1UdEgQwMC6CD3N1c2NlcnRlLmdvYi52 -ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAzNi0wMB0GA1UdDgQWBBStuyIdxuDS -Aaj9dlBSk+2YwU2u0zCCAVAGA1UdIwSCAUcwggFDgBStuyIdxuDSAaj9dlBSk+2Y -wU2u06GCASakggEiMIIBHjE+MDwGA1UEAxM1QXV0b3JpZGFkIGRlIENlcnRpZmlj -YWNpb24gUmFpeiBkZWwgRXN0YWRvIFZlbmV6b2xhbm8xCzAJBgNVBAYTAlZFMRAw -DgYDVQQHEwdDYXJhY2FzMRkwFwYDVQQIExBEaXN0cml0byBDYXBpdGFsMTYwNAYD -VQQKEy1TaXN0ZW1hIE5hY2lvbmFsIGRlIENlcnRpZmljYWNpb24gRWxlY3Ryb25p -Y2ExQzBBBgNVBAsTOlN1cGVyaW50ZW5kZW5jaWEgZGUgU2VydmljaW9zIGRlIENl -cnRpZmljYWNpb24gRWxlY3Ryb25pY2ExJTAjBgkqhkiG9w0BCQEWFmFjcmFpekBz -dXNjZXJ0ZS5nb2IudmWCAQEwDgYDVR0PAQH/BAQDAgEGMDcGA1UdEQQwMC6CD3N1 -c2NlcnRlLmdvYi52ZaAbBgVghl4CAqASDBBSSUYtRy0yMDAwNDAzNi0wMFQGA1Ud -HwRNMEswJKAioCCGHmhodHA6Ly93d3cuc3VzY2VydGUuZ29iLnZlL2xjcjAjoCGg -H4YdbGRhcDovL2FjcmFpei5zdXNjZXJ0ZS5nb2IudmUwNwYIKwYBBQUHAQEEKzAp -MCcGCCsGAQUFBzABhhtoaHRwOi8vb2NzcC5zdXNjZXJ0ZS5nb2IudmUwQAYDVR0g -BDkwNzA1BgVghl4BAjAsMCoGCCsGAQUFBwIBFh5odHRwOi8vd3d3LnN1c2NlcnRl -LmdvYi52ZS9kcGMwDQYJKoZIhvcNAQEMBQADggIBAK4qy/zmZ9zBwfW3yOYtLcBT -Oy4szJyPz7/RhNH3bPVH7HbDTGpi6JZ4YXdXMBeJE5qBF4a590Kgj8Rlnltt+Rbo -OFQOU1UDqKuTdBsA//Zry5899fmn8jBUkg4nh09jhHHbLlaUScdz704Zz2+UVg7i -s/r3Legxap60KzmdrmTAE9VKte1TQRgavQwVX5/2mO/J+SCas//UngI+h8SyOucq -mjudYEgBrZaodUsagUfn/+AzFNrGLy+al+5nZeHb8JnCfLHWS0M9ZyhgoeO/czyn -99+5G93VWNv4zfc4KiavHZKrkn8F9pg0ycIZh+OwPT/RE2zq4gTazBMlP3ACIe/p -olkNaOEa8KvgzW96sjBZpMW49zFmyINYkcj+uaNCJrVGsXgdBmkuRGJNWFZ9r0cG -woIaxViFBypsz045r1ESfYPlfDOavBhZ/giR/Xocm9CHkPRY2BApMMR0DUCyGETg -Ql+L3kfdTKzuDjUp2DM9FqysQmaM81YDZufWkMhlZPfHwC7KbNougoLroa5Umeos -bqAXWmk46SwIdWRPLLqbUpDTKooynZKpSYIkkotdgJoVZUUCY+RCO8jsVPEU6ece -SxztNUm5UOta1OJPMwSAKRHOo3ilVb9c6lAixDdvV8MeNbqe6asM1mpCHWbJ/0rg -5Ls9Cxx8hracyp0ev7b0 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGATCCA+mgAwIBAgIRAI9hcRW6eVgXjH0ROqzW264wDQYJKoZIhvcNAQELBQAw -RTEfMB0GA1UEAxMWQ29tU2lnbiBHbG9iYWwgUm9vdCBDQTEVMBMGA1UEChMMQ29t -U2lnbiBMdGQuMQswCQYDVQQGEwJJTDAeFw0xMTA3MTgxMDI0NTRaFw0zNjA3MTYx -MDI0NTVaMEUxHzAdBgNVBAMTFkNvbVNpZ24gR2xvYmFsIFJvb3QgQ0ExFTATBgNV -BAoTDENvbVNpZ24gTHRkLjELMAkGA1UEBhMCSUwwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQCyKClzKh3rm6n1nvigmV/VU1D4hSwYW2ro3VqpzpPo0Ph3 -3LguqjXd5juDwN4mpxTpD99d7Xu5X6KGTlMVtfN+bTbA4t3x7DU0Zqn0BE5XuOgs -3GLH41Vmr5wox1bShVpM+IsjcN4E/hMnDtt/Bkb5s33xCG+ohz5dlq0gA9qfr/g4 -O9lkHZXTCeYrmVzd/il4x79CqNvGkdL3um+OKYl8rg1dPtD8UsytMaDgBAopKR+W -igc16QJzCbvcinlETlrzP/Ny76BWPnAQgaYBULax/Q5thVU+N3sEOKp6uviTdD+X -O6i96gARU4H0xxPFI75PK/YdHrHjfjQevXl4J37FJfPMSHAbgPBhHC+qn/014DOx -46fEGXcdw2BFeIIIwbj2GH70VyJWmuk/xLMCHHpJ/nIF8w25BQtkPpkwESL6esaU -b1CyB4Vgjyf16/0nRiCAKAyC/DY/Yh+rDWtXK8c6QkXD2XamrVJo43DVNFqGZzbf -5bsUXqiVDOz71AxqqK+p4ek9374xPNMJ2rB5MLPAPycwI0bUuLHhLy6nAIFHLhut -TNI+6Y/soYpi5JSaEjcY7pxI8WIkUAzr2r+6UoT0vAdyOt7nt1y8844a7szo/aKf -woziHl2O1w6ZXUC30K+ptXVaOiW79pBDcbLZ9ZdbONhS7Ea3iH4HJNwktrBJLQID -AQABo4HrMIHoMA8GA1UdEwEB/wQFMAMBAf8wgYQGA1UdHwR9MHswPKA6oDiGNmh0 -dHA6Ly9mZWRpci5jb21zaWduLmNvLmlsL2NybC9jb21zaWduZ2xvYmFscm9vdGNh -LmNybDA7oDmgN4Y1aHR0cDovL2NybDEuY29tc2lnbi5jby5pbC9jcmwvY29tc2ln -bmdsb2JhbHJvb3RjYS5jcmwwDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBQCRZPY -DUhirGm6rgZbPvuqJpFQsTAfBgNVHSMEGDAWgBQCRZPYDUhirGm6rgZbPvuqJpFQ -sTANBgkqhkiG9w0BAQsFAAOCAgEAk1V5V9701xsfy4mfX+tP9Ln5e9h3N+QMwUfj -kr+k3e8iXOqADjTpUHeBkEee5tJq09ZLp/43F5tZ2eHdYq2ZEX7iWHCnOQet6Yw9 -SU1TahsrGDA6JJD9sdPFnNZooGsU1520e0zNB0dNWwxrWAmu4RsBxvEpWCJbvzQL -dOfyX85RWwli81OiVMBc5XvJ1mxsIIqli45oRynKtsWP7E+b0ISJ1n+XFLdQo/Nm -WA/5sDfT0F5YPzWdZymudMbXitimxC+n4oQE4mbQ4Zm718Iwg3pP9gMMcSc7Qc1J -kJHPH9O7gVubkKHuSYj9T3Ym6c6egL1pb4pz/uT7cT26Fiopc/jdqbe2EAfoJZkv -hlp/zdzOoXTWjiKNA5zmgWnZn943FuE9KMRyKtyi/ezJXCh8ypnqLIKxeFfZl69C -BwJsPXUTuqj8Fic0s3aZmmr7C4jXycP+Q8V+akMEIoHAxcd960b4wVWKqOcI/kZS -Q0cYqWOY1LNjznRt9lweWEfwDBL3FhrHOmD4++1N3FkkM4W+Q1b2WOL24clDMj+i -2n9Iw0lc1llHMSMvA5D0vpsXZpOgcCVahfXczQKi9wQ3oZyonJeWx4/rXdMtagAB -VBYGFuMEUEQtybI+eIbnp5peO2WAAblQI4eTy/jMVowe5tfMEXovV3sz9ULgmGb3 -DscLP1I= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICmDCCAgGgAwIBAgIBDjANBgkqhkiG9w0BAQUFADBLMQswCQYDVQQGEwJVUzEY -MBYGA1UEChMPVS5TLiBHb3Zlcm5tZW50MQwwCgYDVQQLEwNFQ0ExFDASBgNVBAMT -C0VDQSBSb290IENBMB4XDTA0MDYxNDEwMjAwOVoXDTQwMDYxNDEwMjAwOVowSzEL -MAkGA1UEBhMCVVMxGDAWBgNVBAoTD1UuUy4gR292ZXJubWVudDEMMAoGA1UECxMD -RUNBMRQwEgYDVQQDEwtFQ0EgUm9vdCBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw -gYkCgYEArkr2eXIS6oAKIpDkOlcQZdMGdncoygCEIU+ktqY3of5SVVXU7/it7kJ1 -EUzR4ii2vthQtbww9aAnpQxcEmXZk8eEyiGEPy+cCQMllBY+efOtKgjbQNDZ3lB9 -19qzUJwBl2BMxslU1XsJQw9SK10lPbQm4asa8E8e5zTUknZBWnECAwEAAaOBizCB -iDAfBgNVHSMEGDAWgBT2uAQnDlYW2blj2f2hVGVBoAhILzAdBgNVHQ4EFgQU9rgE -Jw5WFtm5Y9n9oVRlQaAISC8wDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB -Af8wJQYDVR0gBB4wHDAMBgpghkgBZQMCAQwBMAwGCmCGSAFlAwIBDAIwDQYJKoZI -hvcNAQEFBQADgYEAHh0EQY2cZ209aBb5q0wW1ER0dc4OGzsLyqjHfaQ4TEaMmUwL -AJRta/c4KVWLiwbODsvgJk+CaWmSL03gRW/ciVb/qDV7qh9Pyd1cOlanZTAnPog2 -i82yL3i2fK9DCC84uoxEQbgqK2jx9bIjFTwlAqITk9fGAm5mdT84IEwq1Gw= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH -MjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAwMDBaMGExCzAJBgNVBAYTAlVT -MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j -b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI -2/Ou8jqJkTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx -1x7e/dfgy5SDN67sH0NO3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQ -q2EGnI/yuum06ZIya7XzV+hdG82MHauVBJVJ8zUtluNJbd134/tJS7SsVQepj5Wz -tCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyMUNGPHgm+F6HmIcr9g+UQ -vIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQABo0IwQDAP -BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV -5uNu5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY -1Yl9PMWLSn/pvtsrF9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4 -NeF22d+mQrvHRAiGfzZ0JFrabA0UWTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NG -Fdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBHQRFXGU7Aj64GxJUTFy8bJZ91 -8rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/iyK5S9kJRaTe -pLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl -MrY= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFSzCCAzOgAwIBAgIRALZLiAfiI+7IXBKtpg4GofIwDQYJKoZIhvcNAQELBQAw -PzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dvdmVybm1lbnQgUm9vdCBDZXJ0aWZp -Y2F0aW9uIEF1dGhvcml0eTAeFw0xMjA5MjgwODU4NTFaFw0zNzEyMzExNTU5NTla -MD8xCzAJBgNVBAYTAlRXMTAwLgYDVQQKDCdHb3Zlcm5tZW50IFJvb3QgQ2VydGlm -aWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQC2/5c8gb4BWCQnr44BK9ZykjAyG1+bfNTUf+ihYHMwVxAA+lCWJP5Q5ow6ldFX -eYTVZ1MMKoI+GFy4MCYa1l7GLbIEUQ7v3wxjR+vEEghRK5lxXtVpe+FdyXcdIOxW -juVhYC386RyA3/pqg7sFtR4jEpyCygrzFB0g5AaPQySZn7YKk1pzGxY5vgW28Yyl -ZJKPBeRcdvc5w88tvQ7Yy6gOMZvJRg9nU0MEj8iyyIOAX7ryD6uBNaIgIZfOD4k0 -eA/PH07p+4woPN405+2f0mb1xcoxeNLOUNFggmOd4Ez3B66DNJ1JSUPUfr0t4urH -cWWACOQ2nnlwCjyHKenkkpTqBpIpJ3jmrdc96QoLXvTg1oadLXLLi2RW5vSueKWg -OTNYPNyoj420ai39iHPplVBzBN8RiD5C1gJ0+yzEb7xs1uCAb9GGpTJXA9ZN9E4K -mSJ2fkpAgvjJ5E7LUy3Hsbbi08J1J265DnGyNPy/HE7CPfg26QrMWJqhGIZO4uGq -s3NZbl6dtMIIr69c/aQCb/+4DbvVq9dunxpPkUDwH0ZVbaCSw4nNt7H/HLPLo5wK -4/7NqrwB7N1UypHdTxOHpPaY7/1J1lcqPKZc9mA3v9g+fk5oKiMyOr5u5CI9ByTP -isubXVGzMNJxbc5Gim18SjNE2hIvNkvy6fFRCW3bapcOFwIDAQABo0IwQDAPBgNV -HRMBAf8EBTADAQH/MB0GA1UdDgQWBBTVZx3gnHosnMvFmOcdByYqhux0zTAOBgNV -HQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQELBQADggIBAJA75cJTQijq9TFOjj2Rnk0J -89ixUuZPrAwxIbvx6pnMg/y2KOTshAcOD06Xu29oRo8OURWV+Do7H1+CDgxxDryR -T64zLiNB9CZrTxOH+nj2LsIPkQWXqmrBap+8hJ4IKifd2ocXhuGzyl3tOKkpboTe -Rmv8JxlQpRJ6jH1i/NrnzLyfSa8GuCcn8on3Fj0Y5r3e9YwSkZ/jBI3+BxQaWqw5 -ghvxOBnhY+OvbLamURfr+kvriyL2l/4QOl+UoEtTcT9a4RD4co+WgN2NApgAYT2N -vC2xR8zaXeEgp4wxXPHj2rkKhkfIoT0Hozymc26Uke1uJDr5yTDRB6iBfSZ9fYTf -hsmL5a4NHr6JSFEVg5iWL0rrczTXdM3Jb9DCuiv2mv6Z3WAUjhv5nDk8f0OJU+jl -wqu+Iq0nOJt3KLejY2OngeepaUXrjnhWzAWEx/uttjB8YwWfLYwkf0uLkvw4Hp+g -pVezbp3YZLhwmmBScMip0P/GnO0QYV7Ngw5u6E0CQUridgR51lQ/ipgyFKDdLZzn -uoJxo4ZVKZnSKdt1OvfbQ/+2W/u3fjWAjg1srnm3Ni2XUqGwB5wH5Ss2zQOXlL0t -DjQG/MAWifw3VOTWzz0TBPKR2ck2Lj7FWtClTILD/y58Jnb38/1FoqVuVa4uzM8s -iTTa9g3nkagQ6hed8vbs ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMC -VVMxFDASBgNVBAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQ -cmVtaXVtIEVDQzAeFw0xMDAxMjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJ -BgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1UcnVzdDEgMB4GA1UEAwwXQWZmaXJt -VHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQNMF4bFZ0D -0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQN8O9 -ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0G -A1UdDgQWBBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4G -A1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/Vs -aobgxCd05DhT1wV/GzTjxi+zygk8N53X57hG8f2h4nECMEJZh0PUUd+60wkyWs6I -flc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKMeQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd -MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg -Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow -TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw -HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB -BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr -6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV -L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91 -1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx -MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ -QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB -arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr -Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi -FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS -P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN -9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP -AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz -uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h -9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s -A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t -OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo -+fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7 -KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2 -DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us -H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ -I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7 -5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h -3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz -Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAMMDmu5QkG4oMA0GCSqGSIb3DQEBBQUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIxMB4XDTEyMDcxOTA5MDY1NloXDTQy -MDcxOTA5MDY1NlowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjEw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCqw3j33Jijp1pedxiy3QRk -D2P9m5YJgNXoqqXinCaUOuiZc4yd39ffg/N4T0Dhf9Kn0uXKE5Pn7cZ3Xza1lK/o -OI7bm+V8u8yN63Vz4STN5qctGS7Y1oprFOsIYgrY3LMATcMjfF9DCCMyEtztDK3A -fQ+lekLZWnDZv6fXARz2m6uOt0qGeKAeVjGu74IKgEH3G8muqzIm1Cxr7X1r5OJe -IgpFy4QxTaz+29FHuvlglzmxZcfe+5nkCiKxLU3lSCZpq+Kq8/v8kiky6bM+TR8n -oc2OuRf7JT7JbvN32g0S9l3HuzYQ1VTW8+DiR0jm3hTaYVKvJrT1cU/J19IG32PK -/yHoWQbgCNWEFVP3Q+V8xaCJmGtzxmjOZd69fwX3se72V6FglcXM6pM6vpmumwKj -rckWtc7dXpl4fho5frLABaTAgqWjR56M6ly2vGfb5ipN0gTco65F97yLnByn1tUD -3AjLLhbKXEAz6GfDLuemROoRRRw1ZS0eRWEkG4IupZ0zXWX4Qfkuy5Q/H6MMMSRE -7cderVC6xkGbrPAXZcD4XW9boAo0PO7X6oifmPmvTiT6l7Jkdtqr9O3jw2Dv1fkC -yC2fg69naQanMVXVz0tv/wQFx1isXxYb5dKj6zHbHzMVTdDypVP1y+E9Tmgt2BLd -qvLmTZtJ5cUoobqwWsagtQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUiQq0OJMa5qvum5EY+fU8PjXQ04IwDQYJKoZI -hvcNAQEFBQADggIBADKL9p1Kyb4U5YysOMo6CdQbzoaz3evUuii+Eq5FLAR0rBNR -xVgYZk2C2tXck8An4b58n1KeElb21Zyp9HWc+jcSjxyT7Ff+Bw+r1RL3D65hXlaA -SfX8MPWbTx9BLxyE04nH4toCdu0Jz2zBuByDHBb6lM19oMgY0sidbvW9adRtPTXo -HqJPYNcHKfyyo6SdbhWSVhlMCrDpfNIZTUJG7L399ldb3Zh+pE3McgODWF3vkzpB -emOqfDqo9ayk0d2iLbYq/J8BjuIQscTK5GfbVSUZP/3oNn6z4eGBrxEWi1CXYBmC -AMBrTXO40RMHPuq2MU/wQppt4hF05ZSsjYSVPCGvxdpHyN85YmLLW1AL14FABZyb -7bq2ix4Eb5YgOe2kfSnbSM6C3NQCjR0EMVrHS/BsYVLXtFHCgWzN4funodKSds+x -DzdYpPJScWc/DIh4gInByLUfkmO+p3qKViwaqKactV2zY9ATIKHrkWzQjX2v3wvk -F7mGnjixlAxYjOBVqjtjbZqJYLhkKpLGN/R+Q0O3c+gB53+XD9fyexn9GtePyfqF -a3qdnom2piiZk4hA9z7NUaPK6u95RyG1/jLix8NRb76AdPCkwzryT+lf3xkK8jsT -Q6wxpLPn6/wY1gGp8yqPNg7rtLG8t0zJa7+h89n07eLw4+1knj0vllJPgFOL ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID9jCCAt6gAwIBAgIQJDJ18h0v0gkz97RqytDzmDANBgkqhkiG9w0BAQsFADCB -lDELMAkGA1UEBhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8w -HQYDVQQLExZTeW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRl -YyBDbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -IC0gRzYwHhcNMTExMDE4MDAwMDAwWhcNMzcxMjAxMjM1OTU5WjCBlDELMAkGA1UE -BhMCVVMxHTAbBgNVBAoTFFN5bWFudGVjIENvcnBvcmF0aW9uMR8wHQYDVQQLExZT -eW1hbnRlYyBUcnVzdCBOZXR3b3JrMUUwQwYDVQQDEzxTeW1hbnRlYyBDbGFzcyAx -IFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzYwggEi -MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDHOddJZKmZgiJM6kXZBxbje/SD -6Jlz+muxNuCad6BAwoGNAcfMjL2Pffd543pMA03Z+/2HOCgs3ZqLVAjbZ/sbjP4o -ki++t7JIp4Gh2F6Iw8w5QEFa0dzl2hCfL9oBTf0uRnz5LicKaTfukaMbasxEvxvH -w9QRslBglwm9LiL1QYRmn81ApqkAgMEflZKf3vNI79sdd2H8f9/ulqRy0LY+/3gn -r8uSFWkI22MQ4uaXrG7crPaizh5HmbmJtxLmodTNWRFnw2+F2EJOKL5ZVVkElauP -N4C/DfD8HzpkMViBeNfiNfYgPym4jxZuPkjctUwH4fIa6n4KedaovetdhitNAgMB -AAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW -BBQzQejIORIVk0jyljIuWvXalF9TYDANBgkqhkiG9w0BAQsFAAOCAQEAFeNzV7EX -tl9JaUSm9l56Z6zS3nVJq/4lVcc6yUQVEG6/MWvL2QeTfxyFYwDjMhLgzMv7OWyP -4lPiPEAz2aSMR+atWPuJr+PehilWNCxFuBL6RIluLRQlKCQBZdbqUqwFblYSCT3Q -dPTXvQbKqDqNVkL6jXI+dPEDct+HG14OelWWLDi3mIXNTTNEyZSPWjEwN0ujOhKz -5zbRIWhLLTjmU64cJVYIVgNnhJ3Gw84kYsdMNs+wBkS39V8C3dlU6S+QTnrIToNA -DJqXPDe/v+z28LSFdyjBC8hnghAXOKK3Buqbvzr46SMHv3TgmDgVVXjucgBcGaP0 -0jPg/73RVDkpDw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNV -BAYTAlNLMRMwEQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMu -MRkwFwYDVQQDExBDQSBEaXNpZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQy -MDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sxEzARBgNVBAcTCkJyYXRpc2xhdmEx -EzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERpc2lnIFJvb3QgUjIw -ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbCw3Oe -NcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNH -PWSb6WiaxswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3I -x2ymrdMxp7zo5eFm1tL7A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbe -QTg06ov80egEFGEtQX6sx3dOy1FU+16SGBsEWmjGycT6txOgmLcRK7fWV8x8nhfR -yyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqVg8NTEQxzHQuyRpDRQjrO -QG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa5Beny912 -H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJ -QfYEkoopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUD -i/ZnWejBBhG93c+AAk9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORs -nLMOPReisjQS1n6yqEm70XooQL6iFh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1 -rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud -DwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5uQu0wDQYJKoZI -hvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM -tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqf -GopTpti72TVVsRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkb -lvdhuDvEK7Z4bLQjb/D907JedR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka -+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W81k/BfDxujRNt+3vrMNDcTa/F1bal -TFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjxmHHEt38OFdAlab0i -nSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01utI3 -gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18Dr -G5gPcFw0sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3Os -zMOl6W8KjptlwlCFtaOgUxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8x -L4ysEr3vQCj8KWefshNPZiTEUxnpHikV7+ZtsH8tZ/3zbBt1RqPlShfppNcL ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh -MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE -YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 -MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo -ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg -MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN -ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA -PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w -wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi -EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY -avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ -YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE -sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h -/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 -IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj -YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD -ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy -OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P -TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ -HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER -dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf -ReYNnyicsbkqWletNw+vHX/bvZ8= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEGjCCAwKgAwIBAgIDAYagMA0GCSqGSIb3DQEBBQUAMIGjMQswCQYDVQQGEwJG -STEQMA4GA1UECBMHRmlubGFuZDEhMB8GA1UEChMYVmFlc3RvcmVraXN0ZXJpa2Vz -a3VzIENBMSkwJwYDVQQLEyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBTZXJ2aWNl -czEZMBcGA1UECxMQVmFybWVubmVwYWx2ZWx1dDEZMBcGA1UEAxMQVlJLIEdvdi4g -Um9vdCBDQTAeFw0wMjEyMTgxMzUzMDBaFw0yMzEyMTgxMzUxMDhaMIGjMQswCQYD -VQQGEwJGSTEQMA4GA1UECBMHRmlubGFuZDEhMB8GA1UEChMYVmFlc3RvcmVraXN0 -ZXJpa2Vza3VzIENBMSkwJwYDVQQLEyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBT -ZXJ2aWNlczEZMBcGA1UECxMQVmFybWVubmVwYWx2ZWx1dDEZMBcGA1UEAxMQVlJL -IEdvdi4gUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALCF -FdrIAzfQo0Y3bBseljDCWoUSZyPyu5/nioFgJ/gTqTy894aqqvTzJSm0/nWuHoGG -igWyHWWyOOi0zCia+xc28ZPVec7Bg4shT8MNrUHfeJ1I4x9CRPw8bSEga60ihCRC -jxdNwlAfZM0tOSJWiP2yY51U2kJpwMhP1xjiPshphJQ9LIDGfM6911Mf64i5psu7 -hVfvV3ZdDIvTXhJBnyHAOfQmbQj6OLOhd7HuFtjQaNq0mKWgZUZKa41+qk1guPjI -DfxxPu45h4G02fhukO4/DmHXHSto5i7hQkQmeCxY8n0Wf2HASSQqiYe2XS8pGfim -545SnkFLWg6quMJmQlMCAwEAAaNVMFMwDwYDVR0TAQH/BAUwAwEB/zARBglghkgB -hvhCAQEEBAMCAAcwDgYDVR0PAQH/BAQDAgHGMB0GA1UdDgQWBBTb6eGb0tEkC/yr -46Bn6q6cS3f0sDANBgkqhkiG9w0BAQUFAAOCAQEArX1ID1QRnljurw2bEi8hpM2b -uoRH5sklVSPj3xhYKizbXvfNVPVRJHtiZ+GxH0mvNNDrsczZog1Sf0JLiGCXzyVy -t08pLWKfT6HAVVdWDsRol5EfnGTCKTIB6dTI2riBmCguGMcs/OubUpbf9MiQGS0j -8/G7cdqehSO9Gu8u5Hp5t8OdhkktY7ktdM9lDzJmid87Ie4pbzlj2RXBbvbfgD5Q -eBmK3QOjFKU3p7UsfLYRh+cF8ry23tT/l4EohP7+bEaFEEGfTXWMB9SZZ291im/k -UJL2mdUQuMSpe/cXjUu/15WfCdxEDx4yw8DP03kN5Mc7h/CQNIghYkmSBAQfvA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDujCCAqKgAwIBAgIEAJiWijANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJO -TDEeMBwGA1UEChMVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSYwJAYDVQQDEx1TdGFh -dCBkZXIgTmVkZXJsYW5kZW4gUm9vdCBDQTAeFw0wMjEyMTcwOTIzNDlaFw0xNTEy -MTYwOTE1MzhaMFUxCzAJBgNVBAYTAk5MMR4wHAYDVQQKExVTdGFhdCBkZXIgTmVk -ZXJsYW5kZW4xJjAkBgNVBAMTHVN0YWF0IGRlciBOZWRlcmxhbmRlbiBSb290IENB -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmNK1URF6gaYUmHFtvszn -ExvWJw56s2oYHLZhWtVhCb/ekBPHZ+7d89rFDBKeNVU+LCeIQGv33N0iYfXCxw71 -9tV2U02PjLwYdjeFnejKScfST5gTCaI+Ioicf9byEGW07l8Y1Rfj+MX94p2i71MO -hXeiD+EwR+4A5zN9RGcaC1Hoi6CeUJhoNFIfLm0B8mBF8jHrqTFoKbt6QZ7GGX+U -tFE5A3+y3qcym7RHjm+0Sq7lr7HcsBthvJly3uSJt3omXdozSVtSnA71iq3DuD3o -BmrC1SoLbHuEvVYFy4ZlkuxEK7COudxwC0barbxjiDn622r+I/q85Ej0ZytqERAh -SQIDAQABo4GRMIGOMAwGA1UdEwQFMAMBAf8wTwYDVR0gBEgwRjBEBgRVHSAAMDww -OgYIKwYBBQUHAgEWLmh0dHA6Ly93d3cucGtpb3ZlcmhlaWQubmwvcG9saWNpZXMv -cm9vdC1wb2xpY3kwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSofeu8Y6R0E3QA -7Jbg0zTBLL9s+DANBgkqhkiG9w0BAQUFAAOCAQEABYSHVXQ2YcG70dTGFagTtJ+k -/rvuFbQvBgwp8qiSpGEN/KtcCFtREytNwiphyPgJWPwtArI5fZlmgb9uXJVFIGzm -eafR2Bwp/MIgJ1HI8XxdNGdphREwxgDS1/PTfLbwMVcoEoJz6TMvplW0C5GUR5z6 -u3pCMuiufi3IvKwUv9kP2Vv8wfl6leF9fpb8cbDCTMjfRTTJzg3ynGQI0DvDKcWy -7ZAEwbEpkcUwb8GpcjPM/l0WFywRaed+/sWDCN+83CI6LiBpIzlWYGeQiy52OfsR -iJf2fL1LuCAWZwWN4jvBcj+UlTfHXbme2JOhF4//DGYVwSR8MnwDHTuhWEUykw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDEl -MCMGA1UEChMcU0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMe -U2VjdXJpdHkgQ29tbXVuaWNhdGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoX -DTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMCSlAxJTAjBgNVBAoTHFNFQ09NIFRy -dXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3VyaXR5IENvbW11bmlj -YXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANAV -OVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGr -zbl+dp+++T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVM -VAX3NuRFg3sUZdbcDE3R3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQ -hNBqyjoGADdH5H5XTz+L62e4iKrFvlNVspHEfbmwhRkGeC7bYRr6hfVKkaHnFtWO -ojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1KEOtOghY6rCcMU/Gt1SSw -awNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8QIH4D5cs -OPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3 -DQEBCwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpF -coJxDjrSzG+ntKEju/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXc -okgfGT+Ok+vx+hfuzU7jBBJV1uXk3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8 -t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6qtnRGEmyR7jTV7JqR50S+kDFy -1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29mvVXIwAHIRc/ -SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEHjCCAwagAwIBAgIBATANBgkqhkiG9w0BAQUFADBnMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3 -b3JrMSMwIQYDVQQDExpBZGRUcnVzdCBRdWFsaWZpZWQgQ0EgUm9vdDAeFw0wMDA1 -MzAxMDQ0NTBaFw0yMDA1MzAxMDQ0NTBaMGcxCzAJBgNVBAYTAlNFMRQwEgYDVQQK -EwtBZGRUcnVzdCBBQjEdMBsGA1UECxMUQWRkVHJ1c3QgVFRQIE5ldHdvcmsxIzAh -BgNVBAMTGkFkZFRydXN0IFF1YWxpZmllZCBDQSBSb290MIIBIjANBgkqhkiG9w0B -AQEFAAOCAQ8AMIIBCgKCAQEA5B6a/twJWoekn0e+EV+vhDTbYjx5eLfpMLXsDBwq -xBb/4Oxx64r1EW7tTw2R0hIYLUkVAcKkIhPHEWT/IhKauY5cLwjPcWqzZwFZ8V1G -87B4pfYOQnrjfxvM0PC3KP0q6p6zsLkEqv32x7SxuCqg+1jxGaBvcCV+PmlKfw8i -2O+tCBGaKZnhqkRFmhJePp1tUvznoD1oL/BLcHwTOK28FSXx1s6rosAx1i+f4P8U -WfyEk9mHfExUE+uf0S0R+Bg6Ot4l2ffTQO2kBhLEO+GRwVY18BTcZTYJbqukB8c1 -0cIDMzZbdSZtQvESa0NvS3GU+jQd7RNuyoB/mC9suWXY6QIDAQABo4HUMIHRMB0G -A1UdDgQWBBQ5lYtii1zJ1IC6WA+XPxUIQ8yYpzALBgNVHQ8EBAMCAQYwDwYDVR0T -AQH/BAUwAwEB/zCBkQYDVR0jBIGJMIGGgBQ5lYtii1zJ1IC6WA+XPxUIQ8yYp6Fr -pGkwZzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMR0wGwYDVQQL -ExRBZGRUcnVzdCBUVFAgTmV0d29yazEjMCEGA1UEAxMaQWRkVHJ1c3QgUXVhbGlm -aWVkIENBIFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBABmrder4i2VhlRO6aQTv -hsoToMeqT2QbPxj2qC0sVY8FtzDqQmodwCVRLae/DLPt7wh/bDxGGuoYQ992zPlm -hpwsaPXpF/gxsxjE1kh9I0xowX67ARRvxdlu3rsEQmr49lx95dr6h+sNNVJn0J6X -dgWTP5XHAeZpVTh/EGGZyeNfpso+gmNIquIISD6q8rKFYqa0p9m9N5xotS1WfbC3 -P6CxB9bpT9zeRXEwMn8bLgn5v1Kh7sKAPgZcLlVAwRv1cEWw3F369nJad9Jjzc9Y -iQBCYz95OdBEsIJuQRno3eDBiFrRHnGTHyQwdOUeqN48Jzd/g66ed8/wMLH/S5no -xqE= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIEXDCCA0SgAwIBAgIEOGO5ZjANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML -RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp -bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 -IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp -ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0xOTEy -MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 -LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp -YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG -A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq -K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe -sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX -MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT -XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ -HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH -4QIDAQABo3QwcjARBglghkgBhvhCAQEEBAMCAAcwHwYDVR0jBBgwFoAUVeSB0RGA -vtiJuQijMfmhJAkWuXAwHQYDVR0OBBYEFFXkgdERgL7YibkIozH5oSQJFrlwMB0G -CSqGSIb2fQdBAAQQMA4bCFY1LjA6NC4wAwIEkDANBgkqhkiG9w0BAQUFAAOCAQEA -WUesIYSKF8mciVMeuoCFGsY8Tj6xnLZ8xpJdGGQC49MGCBFhfGPjK50xA3B20qMo -oPS7mmNz7W3lKtvtFKkrxjYR0CvrB4ul2p5cGZ1WEvVUKcgF7bISKo30Axv/55IQ -h7A6tcOdBTcSo8f0FbnVpDkWm1M6I5HxqIKiaohowXkCIryqptau37AUX7iH0N18 -f3v/rxzP5tsHrV7bhZ3QKw0z2wTR5klAEyt2+z7pnIkPFc4YsIV4IU9rTw76NmfN -B/L/CNDi3tm/Kq+4h4YhPATKt5Rof8886ZjXOP/swNlQ8C5LWK5Gb9Auw2DaclVy -vUxFnmG6v4SBkgPR0ml8xQ== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFkjCCA3qgAwIBAgIIAeDltYNno+AwDQYJKoZIhvcNAQEMBQAwZzEbMBkGA1UE -AwwSQXBwbGUgUm9vdCBDQSAtIEcyMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0 -aW9uIEF1dGhvcml0eTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMw -HhcNMTQwNDMwMTgxMDA5WhcNMzkwNDMwMTgxMDA5WjBnMRswGQYDVQQDDBJBcHBs -ZSBSb290IENBIC0gRzIxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUzCCAiIwDQYJ -KoZIhvcNAQEBBQADggIPADCCAgoCggIBANgREkhI2imKScUcx+xuM23+TfvgHN6s -XuI2pyT5f1BrTM65MFQn5bPW7SXmMLYFN14UIhHF6Kob0vuy0gmVOKTvKkmMXT5x -ZgM4+xb1hYjkWpIMBDLyyED7Ul+f9sDx47pFoFDVEovy3d6RhiPw9bZyLgHaC/Yu -OQhfGaFjQQscp5TBhsRTL3b2CtcM0YM/GlMZ81fVJ3/8E7j4ko380yhDPLVoACVd -J2LT3VXdRCCQgzWTxb+4Gftr49wIQuavbfqeQMpOhYV4SbHXw8EwOTKrfl+q04tv -ny0aIWhwZ7Oj8ZhBbZF8+NfbqOdfIRqMM78xdLe40fTgIvS/cjTf94FNcX1RoeKz -8NMoFnNvzcytN31O661A4T+B/fc9Cj6i8b0xlilZ3MIZgIxbdMYs0xBTJh0UT8TU -gWY8h2czJxQI6bR3hDRSj4n4aJgXv8O7qhOTH11UL6jHfPsNFL4VPSQ08prcdUFm -IrQB1guvkJ4M6mL4m1k8COKWNORj3rw31OsMiANDC1CvoDTdUE0V+1ok2Az6DGOe -HwOx4e7hqkP0ZmUoNwIx7wHHHtHMn23KVDpA287PT0aLSmWaasZobNfMmRtHsHLD -d4/E92GcdB/O/WuhwpyUgquUoue9G7q5cDmVF8Up8zlYNPXEpMZ7YLlmQ1A/bmH8 -DvmGqmAMQ0uVAgMBAAGjQjBAMB0GA1UdDgQWBBTEmRNsGAPCe8CjoA1/coB6HHcm -jTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQwF -AAOCAgEAUabz4vS4PZO/Lc4Pu1vhVRROTtHlznldgX/+tvCHM/jvlOV+3Gp5pxy+ -8JS3ptEwnMgNCnWefZKVfhidfsJxaXwU6s+DDuQUQp50DhDNqxq6EWGBeNjxtUVA -eKuowM77fWM3aPbn+6/Gw0vsHzYmE1SGlHKy6gLti23kDKaQwFd1z4xCfVzmMX3z -ybKSaUYOiPjjLUKyOKimGY3xn83uamW8GrAlvacp/fQ+onVJv57byfenHmOZ4VxG -/5IFjPoeIPmGlFYl5bRXOJ3riGQUIUkhOb9iZqmxospvPyFgxYnURTbImHy99v6Z -SYA7LNKmp4gDBDEZt7Y6YUX6yfIjyGNzv1aJMbDZfGKnexWoiIqrOEDCzBL/FePw -N983csvMmOa/orz6JopxVtfnJBtIRD6e/J/JzBrsQzwBvDR4yGn1xuZW7AYJNpDr -FEobXsmII9oDMJELuDY++ee1KG++P+w8j2Ud5cAeh6Squpj9kuNsJnfdBrRkBof0 -Tta6SqoWqPQFZ2aWuuJVecMsXUmPgEkrihLHdoBR37q9ZV0+N0djMenl9MU/S60E -inpxLK8JQzcPqOMyT/RFtm2XNuyE9QoB6he7hY1Ck3DDUOUUi78/w0EP3SIEIwiK -um1xRKtzCTrJ+VKACd+66eYWyi4uTLLT3OUEVLLUNIAytbwPF+E= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDtDCCApygAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJKUDEc -MBoGA1UEChMTSmFwYW5lc2UgR292ZXJubWVudDEOMAwGA1UECxMFTVBIUFQxJjAk -BgNVBAsTHU1QSFBUIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTAyMDMxNDA3 -NTAyNloXDTEyMDMxMzE0NTk1OVowYzELMAkGA1UEBhMCSlAxHDAaBgNVBAoTE0ph -cGFuZXNlIEdvdmVybm1lbnQxDjAMBgNVBAsTBU1QSFBUMSYwJAYDVQQLEx1NUEhQ -VCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEP -ADCCAQoCggEBAI3GUWlK9G9FVm8DhpKu5t37oxZbj6lZcFvEZY07YrYojWO657ub -z56WE7q/PI/6Sm7i7qYE+Vp80r6thJvfmn7SS3BENrRqiapSenhooYD12jIe3iZQ -2SXqx7WgYwyBGdQwGaYTijzbRFpgc0K8o4a99fIoHhz9J8AKqXasddMCqfJRaH30 -YJ7HnOvRYGL6HBrGhJ7X4Rzijyk9a9+3VOBsYcnIlx9iODoiYhA6r0ojuIu8/JA1 -oTTZrS0MyU/SLdFdJze2O1wnqTULXQybzJz3ad6oC/F5a69c0m92akYd9nGBrPxj -EhucaQynC/QoCLs3aciLgioAnEJqy7i3EgUCAwEAAaNzMHEwHwYDVR0jBBgwFoAU -YML3pLoA0h93Yngl8Gb/UgAh73owHQYDVR0OBBYEFGDC96S6ANIfd2J4JfBm/1IA -Ie96MAwGA1UdEwQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQE -AwIABTANBgkqhkiG9w0BAQUFAAOCAQEANPR8DN66iWZBs/lSm1vOzhqRkXDLT6xL -LvJtjPLqmE469szGyFSKzsof6y+/8YgZlOoeX1inF4ox/SH1ATnwdIIsPbXuRLjt -axboXvBh5y2ffC3hmzJVvJ87tb6mVWQeL9VFUhNhAI0ib+9OIZVEYI/64MFkDk4e -iWG5ts6oqIJH1V7dVZg6pQ1Tc0Ckhn6N1m1hD30S0/zoPn/20Wq6OCF3he8VJrRG -dcW9BD/Bkesko1HKhMBDjHVrJ8cFwbnDSoo+Ki47eJWaz/cOzaSsaMVUsR5POava -/abhhgHn/eOJdXiVslyK0DYscjsdB3aBUfwZlomxYOzG6CgjQPhJdw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID9zCCAt+gAwIBAgILMTI1MzcyODI4MjgwDQYJKoZIhvcNAQELBQAwWDELMAkG -A1UEBhMCSlAxHDAaBgNVBAoTE0phcGFuZXNlIEdvdmVybm1lbnQxDTALBgNVBAsT -BEdQS0kxHDAaBgNVBAMTE0FwcGxpY2F0aW9uQ0EyIFJvb3QwHhcNMTMwMzEyMTUw -MDAwWhcNMzMwMzEyMTUwMDAwWjBYMQswCQYDVQQGEwJKUDEcMBoGA1UEChMTSmFw -YW5lc2UgR292ZXJubWVudDENMAsGA1UECxMER1BLSTEcMBoGA1UEAxMTQXBwbGlj -YXRpb25DQTIgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKaq -rSVl1gAR1uh6dqr05rRL88zDUrSNrKZPtZJxb0a11a2LEiIXJc5F6BR6hZrkIxCo -+rFnUOVtR+BqiRPjrq418fRCxQX3TZd+PCj8sCaRHoweOBqW3FhEl2LjMsjRFUFN -dZh4vqtoqV7tR76kuo6hApfek3SZbWe0BSXulMjtqqS6MmxCEeu+yxcGkOGThchk -KM4fR8fAXWDudjbcMztR63vPctgPeKgZggiQPhqYjY60zxU2pm7dt+JNQCBT2XYq -0HisifBPizJtROouurCp64ndt295D6uBbrjmiykLWa+2SQ1RLKn9nShjZrhwlXOa -2Po7M7xCQhsyrLEy+z0CAwEAAaOBwTCBvjAdBgNVHQ4EFgQUVqesqgIdsqw9kA6g -by5Bxnbne9owDgYDVR0PAQH/BAQDAgEGMHwGA1UdEQR1MHOkcTBvMQswCQYDVQQG -EwJKUDEYMBYGA1UECgwP5pel5pys5Zu95pS/5bqcMRswGQYDVQQLDBLmlL/lupzo -qo3oqLzln7rnm6QxKTAnBgNVBAMMIOOCouODl+ODquOCseODvOOCt+ODp+ODs0NB -MiBSb290MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAH+aCXWs -B9FydC53VzDCBJzUgKaD56WgG5/+q/OAvdVKo6GPtkxgEefK4WCB10jBIFmlYTKL -nZ6X02aD2mUuWD7b5S+lzYxzplG+WCigeVxpL0PfY7KJR8q73rk0EWOgDiUX5Yf0 -HbCwpc9BqHTG6FPVQvSCLVMJEWgmcZR1E02qdog8dLHW40xPYsNJTE5t8XB+w3+m -Bcx4m+mB26jIx1ye/JKSLaaX8ji1bnOVDMA/zqaUMLX6BbfeniCq/BNkyYq6ZO/i -Y+TYmK5rtT6mVbgzPixy+ywRAPtbFi+E0hOe+gXFwctyTiLdhMpLvNIthhoEdlkf -SUJiOxMfFui61/0= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJV -UzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2Vy -dGlmaWNhdGUgQXV0aG9yaXR5MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1 -MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoTB0VxdWlmYXgxLTArBgNVBAsTJEVx -dWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPRfM6f -BeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+A -cJkVV5MW8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kC -AwEAAaOCAQkwggEFMHAGA1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQ -MA4GA1UEChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlm -aWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoGA1UdEAQTMBGBDzIwMTgw -ODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvSspXXR9gj -IBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQF -MAMBAf8wGgYJKoZIhvZ9B0EABA0wCxsFVjMuMGMDAgbAMA0GCSqGSIb3DQEBBQUA -A4GBAFjOKer89961zgK5F7WF0bnj4JXMJTENAKaSbn+2kmOeUJXRmm/kEd5jhW6Y -7qj/WsjTVbJmcVfewCHrPSqnI0kBBIZCe/zuf6IWUrVnZ9NA2zsmWLIodz2uFHdh -1voqZiegDfqnc1zqcPGUIWVEX/r87yloqaKHee9570+sB3c4 ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL -MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj -KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2 -MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 -eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV -BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw -NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV -BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH -MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL -So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal -tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG -CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT -qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz -rD6ogRLQy7rQkgu2npaqBA+K ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJO -TDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFh -dCBkZXIgTmVkZXJsYW5kZW4gRVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0y -MjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5MMR4wHAYDVQQKDBVTdGFhdCBkZXIg -TmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRlcmxhbmRlbiBFViBS -b290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkkSzrS -M4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nC -UiY4iKTWO0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3d -Z//BYY1jTw+bbRcwJu+r0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46p -rfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13l -pJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gVXJrm0w912fxBmJc+qiXb -j5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr08C+eKxC -KFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS -/ZbV0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0X -cgOPvZuM5l5Tnrmd74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH -1vI4gnPah1vlPNOePqc7nvQDs/nxfRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrP -px9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB -/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwaivsnuL8wbqg7 -MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI -eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u -2dfOWBfoqSmuc0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHS -v4ilf0X8rLiltTMMgsT7B/Zq5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTC -wPTxGfARKbalGAKb12NMcIxHowNDXLldRqANb/9Zjr7dn3LDWyvfjFvO5QxGbJKy -CqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tNf1zuacpzEPuKqf2e -vTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi5Dp6 -Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIa -Gl6I6lD4WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeL -eG9QgkRQP2YGiqtDhFZKDyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8 -FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGyeUN51q1veieQA6TqJIc/2b3Z6fJfUEkc -7uzXLg== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEc -MBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2Vj -IFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENB -IDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5MjM1OTAwWjBxMQswCQYDVQQGEwJE -RTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxl -U2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290 -IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEU -ha88EOQ5bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhC -QN/Po7qCWWqSG6wcmtoIKyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1Mjwr -rFDa1sPeg5TKqAyZMg4ISFZbavva4VhYAUlfckE8FQYBjl2tqriTtM2e66foai1S -NNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aKSe5TBY8ZTNXeWHmb0moc -QqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTVjlsB9WoH -txa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAP -BgNVHRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOC -AQEAlGRZrTlk5ynrE/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756Abrsp -tJh6sTtU6zkXR34ajgv8HzFZMQSyzhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpa -IzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8rZ7/gFnkm0W09juwzTkZmDLl -6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4Gdyd1Lx+4ivn+ -xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU -Cm26OWMohpLzGITY+9HPBVZkVw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNV -BAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBC -aWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNV -BAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQDDB9FLVR1 -Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMwNTEyMDk0OFoXDTIz -MDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmExQDA+ -BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhp -em1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN -ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 -MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4vU/kwVRHoViVF56C/UY -B4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vdhQd2h8y/L5VMzH2nPbxH -D5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5KCKpbknSF -Q9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEo -q1+gElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3D -k14opz8n8Y4e0ypQBaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcH -fC425lAcP9tDJMW/hkd5s3kc91r0E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsut -dEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gzrt48Ue7LE3wBf4QOXVGUnhMM -ti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAqjqFGOjGY5RH8 -zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn -rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUX -U8u3Zg5mTPj5dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6 -Jyr+zE7S6E5UMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5 -XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQAF -Nzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAKkEh47U6YA5n+KGCR -HTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jOXKqY -GwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c -77NCR807VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3 -+GbHeJAAFS6LrVE1Uweoa2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WK -vJUawSg5TB9D0pH0clmKuVb8P7Sd2nCcdlqMQ1DujjByTd//SffGqWfZbawCEeI6 -FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEVKV0jq9BgoRJP3vQXzTLl -yb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gTDx4JnW2P -AJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpD -y4Q08ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8d -NL/+I5c30jn6PQ0GC7TbO6Orb1wdtn7os4I07QZcJA== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDtTCCAp2gAwIBAgIIBhDCeat3PfIwDQYJKoZIhvcNAQEFBQAwdjELMAkGA1UE -BhMCQ0gxEjAQBgNVBAoTCVN3aXNzU2lnbjEyMDAGA1UEAxMpU3dpc3NTaWduIENB -IChSU0EgSUsgTWF5IDYgMTk5OSAxODowMDo1OCkxHzAdBgkqhkiG9w0BCQEWEGNh -QFN3aXNzU2lnbi5jb20wHhcNMDAxMTI2MjMyNzQxWhcNMzExMTI2MjMyNzQxWjB2 -MQswCQYDVQQGEwJDSDESMBAGA1UEChMJU3dpc3NTaWduMTIwMAYDVQQDEylTd2lz -c1NpZ24gQ0EgKFJTQSBJSyBNYXkgNiAxOTk5IDE4OjAwOjU4KTEfMB0GCSqGSIb3 -DQEJARYQY2FAU3dpc3NTaWduLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -AQoCggEBAKw5fjnmNneLQlUCQG8jQLwwfbrOZoUwNX8cbNqhxK03/xUloFVgAt+S -Te2RxNXaCAXLBPn5ZST35TLV57aLmbHCtifv3YZqaaQGvjedltIBMJihJhZ+h3LY -SKsUb+xEJ3x5ZUf8jP+Q1g57y1s8SnBFWN/ni5NkF1Y1y31VwOi9wiOf/VISL+uu -SC4i1CP1Kbz3BDs6Hht1GpRYCbJ/K0bc9oJSpWpT5PGONsGIawqMbJuyoDghsXQ1 -pbn2e8K64BSscGZVZTNooSGgNiHmACNJBYXiWVWrwXPF4l6SddmC3Rj0aKXjgECc -FkHLDQcsM5JsK2ZLryTDUsQFbxVP2ikCAwEAAaNHMEUwCwYDVR0PBAQDAgEGMAwG -A1UdEwQFMAMBAf8wHQYDVR0OBBYEFJbXcc05KtT8iLGKq1N4ae+PR34WMAkGA1Ud -IwQCMAAwDQYJKoZIhvcNAQEFBQADggEBAKMy6W8HvZdS1fBpEUzl6Lvw50bgE1Xc -HU1JypSBG9mhdcXZo5AlPB4sCvx9Dmfwhyrdsshc0TP2V3Vh6eQqnEF5qB4lVziT -Bko9mW6Ot+pPnwsy4SHpx3rw6jCYnOqfUcZjWqqqRrq/3P1waz+Mn4cLMVEg3Xaz -qYov/khvSqS0JniwjRlo2H6f/1oVUKZvP+dUhpQepfZrOqMAWZW4otp6FolyQyeU -NN6UCRNiUKl5vTijbKwUUwfER/1Vci3M1/O1QCfttQ4vRN4Buc0xqYtGL3cd5WiO -vWzyhlTzAI6VUdNkQhhHJSAyTpj6dmXDRzrryoFGa2PjgESxz7XBaSI= ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBF -MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQL -ExNUcnVzdGlzIEZQUyBSb290IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTEx -MzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNVBAoTD1RydXN0aXMgTGltaXRlZDEc -MBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQAD -ggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQRUN+ -AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihH -iTHcDnlkH5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjj -vSkCqPoc4Vu5g6hBSLwacY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA -0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zto3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlB -OrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEAAaNTMFEwDwYDVR0TAQH/ -BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAdBgNVHQ4E -FgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01 -GX2cGE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmW -zaD+vkAMXBJV+JOCyinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP4 -1BIy+Q7DsdwyhEQsb8tGD+pmQQ9P8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZE -f1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHVl/9D7S3B2l0pKoU/rGXuhg8F -jZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYliB6XzCGcKQEN -ZetX2fNXlrtIzYE= ------END CERTIFICATE----- -` diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_linux.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_linux.go deleted file mode 100644 index cfeca6958ca0c31865b70c36f6ee93f6d3898271..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_linux.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{ - "/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc. - "/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL - "/etc/ssl/ca-bundle.pem", // OpenSUSE - "/etc/pki/tls/cacert.pem", // OpenELEC -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nacl.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nacl.go deleted file mode 100644 index 4413f64738a7f6f6add0ff2888d710e74365a4f9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nacl.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nocgo_darwin.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nocgo_darwin.go deleted file mode 100644 index d00e2576624ad5c67cd325846e07171090579b0e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_nocgo_darwin.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !cgo - -package x509 - -func initSystemRoots() { - systemRoots, _ = execSecurityRoots() -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_plan9.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_plan9.go deleted file mode 100644 index 9965caadee3a887dd744f30051deacb51692cb57..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_plan9.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build plan9 - -package x509 - -import "io/ioutil" - -// Possible certificate files; stop after finding one. -var certFiles = []string{ - "/sys/lib/tls/ca.pem", -} - -func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { - return nil, nil -} - -func initSystemRoots() { - roots := NewCertPool() - for _, file := range certFiles { - data, err := ioutil.ReadFile(file) - if err == nil { - roots.AppendCertsFromPEM(data) - systemRoots = roots - return - } - } - - // All of the files failed to load. systemRoots will be nil which will - // trigger a specific error at verification time. -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_solaris.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_solaris.go deleted file mode 100644 index e6d4e613994754d2e7e303dcd09c22fde836f255..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_solaris.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{ - "/etc/certs/ca-certificates.crt", // Solaris 11.2+ - "/etc/ssl/certs/ca-certificates.crt", // Joyent SmartOS - "/etc/ssl/cacert.pem", // OmniOS -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_unix.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_unix.go deleted file mode 100644 index 8d3b2fbb23395dc7bbd455fa457a419f27aa830c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_unix.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build dragonfly freebsd linux nacl netbsd openbsd solaris - -package x509 - -import "io/ioutil" - -// Possible directories with certificate files; stop after successfully -// reading at least one file from a directory. -var certDirectories = []string{ - "/system/etc/security/cacerts", // Android -} - -func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { - return nil, nil -} - -func initSystemRoots() { - roots := NewCertPool() - for _, file := range certFiles { - data, err := ioutil.ReadFile(file) - if err == nil { - roots.AppendCertsFromPEM(data) - systemRoots = roots - return - } - } - - for _, directory := range certDirectories { - fis, err := ioutil.ReadDir(directory) - if err != nil { - continue - } - rootsAdded := false - for _, fi := range fis { - data, err := ioutil.ReadFile(directory + "/" + fi.Name()) - if err == nil && roots.AppendCertsFromPEM(data) { - rootsAdded = true - } - } - if rootsAdded { - systemRoots = roots - return - } - } - - // All of the files failed to load. systemRoots will be nil which will - // trigger a specific error at verification time. -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_windows.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_windows.go deleted file mode 100644 index 81018b78fe66fabda6475e07d5cc256cf79486ed..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/root_windows.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "errors" - "syscall" - "unsafe" -) - -// Creates a new *syscall.CertContext representing the leaf certificate in an in-memory -// certificate store containing itself and all of the intermediate certificates specified -// in the opts.Intermediates CertPool. -// -// A pointer to the in-memory store is available in the returned CertContext's Store field. -// The store is automatically freed when the CertContext is freed using -// syscall.CertFreeCertificateContext. -func createStoreContext(leaf *Certificate, opts *VerifyOptions) (*syscall.CertContext, error) { - var storeCtx *syscall.CertContext - - leafCtx, err := syscall.CertCreateCertificateContext(syscall.X509_ASN_ENCODING|syscall.PKCS_7_ASN_ENCODING, &leaf.Raw[0], uint32(len(leaf.Raw))) - if err != nil { - return nil, err - } - defer syscall.CertFreeCertificateContext(leafCtx) - - handle, err := syscall.CertOpenStore(syscall.CERT_STORE_PROV_MEMORY, 0, 0, syscall.CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, 0) - if err != nil { - return nil, err - } - defer syscall.CertCloseStore(handle, 0) - - err = syscall.CertAddCertificateContextToStore(handle, leafCtx, syscall.CERT_STORE_ADD_ALWAYS, &storeCtx) - if err != nil { - return nil, err - } - - if opts.Intermediates != nil { - for _, intermediate := range opts.Intermediates.certs { - ctx, err := syscall.CertCreateCertificateContext(syscall.X509_ASN_ENCODING|syscall.PKCS_7_ASN_ENCODING, &intermediate.Raw[0], uint32(len(intermediate.Raw))) - if err != nil { - return nil, err - } - - err = syscall.CertAddCertificateContextToStore(handle, ctx, syscall.CERT_STORE_ADD_ALWAYS, nil) - syscall.CertFreeCertificateContext(ctx) - if err != nil { - return nil, err - } - } - } - - return storeCtx, nil -} - -// extractSimpleChain extracts the final certificate chain from a CertSimpleChain. -func extractSimpleChain(simpleChain **syscall.CertSimpleChain, count int) (chain []*Certificate, err error) { - if simpleChain == nil || count == 0 { - return nil, errors.New("x509: invalid simple chain") - } - - simpleChains := (*[1 << 20]*syscall.CertSimpleChain)(unsafe.Pointer(simpleChain))[:] - lastChain := simpleChains[count-1] - elements := (*[1 << 20]*syscall.CertChainElement)(unsafe.Pointer(lastChain.Elements))[:] - for i := 0; i < int(lastChain.NumElements); i++ { - // Copy the buf, since ParseCertificate does not create its own copy. - cert := elements[i].CertContext - encodedCert := (*[1 << 20]byte)(unsafe.Pointer(cert.EncodedCert))[:] - buf := make([]byte, cert.Length) - copy(buf, encodedCert[:]) - parsedCert, err := ParseCertificate(buf) - if err != nil { - return nil, err - } - chain = append(chain, parsedCert) - } - - return chain, nil -} - -// checkChainTrustStatus checks the trust status of the certificate chain, translating -// any errors it finds into Go errors in the process. -func checkChainTrustStatus(c *Certificate, chainCtx *syscall.CertChainContext) error { - if chainCtx.TrustStatus.ErrorStatus != syscall.CERT_TRUST_NO_ERROR { - status := chainCtx.TrustStatus.ErrorStatus - switch status { - case syscall.CERT_TRUST_IS_NOT_TIME_VALID: - return CertificateInvalidError{c, Expired} - default: - return UnknownAuthorityError{c, nil, nil} - } - } - return nil -} - -// checkChainSSLServerPolicy checks that the certificate chain in chainCtx is valid for -// use as a certificate chain for a SSL/TLS server. -func checkChainSSLServerPolicy(c *Certificate, chainCtx *syscall.CertChainContext, opts *VerifyOptions) error { - servernamep, err := syscall.UTF16PtrFromString(opts.DNSName) - if err != nil { - return err - } - sslPara := &syscall.SSLExtraCertChainPolicyPara{ - AuthType: syscall.AUTHTYPE_SERVER, - ServerName: servernamep, - } - sslPara.Size = uint32(unsafe.Sizeof(*sslPara)) - - para := &syscall.CertChainPolicyPara{ - ExtraPolicyPara: uintptr(unsafe.Pointer(sslPara)), - } - para.Size = uint32(unsafe.Sizeof(*para)) - - status := syscall.CertChainPolicyStatus{} - err = syscall.CertVerifyCertificateChainPolicy(syscall.CERT_CHAIN_POLICY_SSL, chainCtx, para, &status) - if err != nil { - return err - } - - // TODO(mkrautz): use the lChainIndex and lElementIndex fields - // of the CertChainPolicyStatus to provide proper context, instead - // using c. - if status.Error != 0 { - switch status.Error { - case syscall.CERT_E_EXPIRED: - return CertificateInvalidError{c, Expired} - case syscall.CERT_E_CN_NO_MATCH: - return HostnameError{c, opts.DNSName} - case syscall.CERT_E_UNTRUSTEDROOT: - return UnknownAuthorityError{c, nil, nil} - default: - return UnknownAuthorityError{c, nil, nil} - } - } - - return nil -} - -// systemVerify is like Verify, except that it uses CryptoAPI calls -// to build certificate chains and verify them. -func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { - hasDNSName := opts != nil && len(opts.DNSName) > 0 - - storeCtx, err := createStoreContext(c, opts) - if err != nil { - return nil, err - } - defer syscall.CertFreeCertificateContext(storeCtx) - - para := new(syscall.CertChainPara) - para.Size = uint32(unsafe.Sizeof(*para)) - - // If there's a DNSName set in opts, assume we're verifying - // a certificate from a TLS server. - if hasDNSName { - oids := []*byte{ - &syscall.OID_PKIX_KP_SERVER_AUTH[0], - // Both IE and Chrome allow certificates with - // Server Gated Crypto as well. Some certificates - // in the wild require them. - &syscall.OID_SERVER_GATED_CRYPTO[0], - &syscall.OID_SGC_NETSCAPE[0], - } - para.RequestedUsage.Type = syscall.USAGE_MATCH_TYPE_OR - para.RequestedUsage.Usage.Length = uint32(len(oids)) - para.RequestedUsage.Usage.UsageIdentifiers = &oids[0] - } else { - para.RequestedUsage.Type = syscall.USAGE_MATCH_TYPE_AND - para.RequestedUsage.Usage.Length = 0 - para.RequestedUsage.Usage.UsageIdentifiers = nil - } - - var verifyTime *syscall.Filetime - if opts != nil && !opts.CurrentTime.IsZero() { - ft := syscall.NsecToFiletime(opts.CurrentTime.UnixNano()) - verifyTime = &ft - } - - // CertGetCertificateChain will traverse Windows's root stores - // in an attempt to build a verified certificate chain. Once - // it has found a verified chain, it stops. MSDN docs on - // CERT_CHAIN_CONTEXT: - // - // When a CERT_CHAIN_CONTEXT is built, the first simple chain - // begins with an end certificate and ends with a self-signed - // certificate. If that self-signed certificate is not a root - // or otherwise trusted certificate, an attempt is made to - // build a new chain. CTLs are used to create the new chain - // beginning with the self-signed certificate from the original - // chain as the end certificate of the new chain. This process - // continues building additional simple chains until the first - // self-signed certificate is a trusted certificate or until - // an additional simple chain cannot be built. - // - // The result is that we'll only get a single trusted chain to - // return to our caller. - var chainCtx *syscall.CertChainContext - err = syscall.CertGetCertificateChain(syscall.Handle(0), storeCtx, verifyTime, storeCtx.Store, para, 0, 0, &chainCtx) - if err != nil { - return nil, err - } - defer syscall.CertFreeCertificateChain(chainCtx) - - err = checkChainTrustStatus(c, chainCtx) - if err != nil { - return nil, err - } - - if hasDNSName { - err = checkChainSSLServerPolicy(c, chainCtx, opts) - if err != nil { - return nil, err - } - } - - chain, err := extractSimpleChain(chainCtx.Chains, int(chainCtx.ChainCount)) - if err != nil { - return nil, err - } - - chains = append(chains, chain) - - return chains, nil -} - -func initSystemRoots() { -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1.go deleted file mode 100644 index c4d7ab68f7dbbb9d7cb8d8f5217f74c3e34caf83..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "crypto/ecdsa" - "crypto/elliptic" - "encoding/asn1" - "errors" - "fmt" - "math/big" -) - -const ecPrivKeyVersion = 1 - -// ecPrivateKey reflects an ASN.1 Elliptic Curve Private Key Structure. -// References: -// RFC5915 -// SEC1 - http://www.secg.org/sec1-v2.pdf -// Per RFC5915 the NamedCurveOID is marked as ASN.1 OPTIONAL, however in -// most cases it is not. -type ecPrivateKey struct { - Version int - PrivateKey []byte - NamedCurveOID asn1.ObjectIdentifier `asn1:"optional,explicit,tag:0"` - PublicKey asn1.BitString `asn1:"optional,explicit,tag:1"` -} - -// ParseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure. -func ParseECPrivateKey(der []byte) (key *ecdsa.PrivateKey, err error) { - return parseECPrivateKey(nil, der) -} - -// MarshalECPrivateKey marshals an EC private key into ASN.1, DER format. -func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error) { - oid, ok := oidFromNamedCurve(key.Curve) - if !ok { - return nil, errors.New("x509: unknown elliptic curve") - } - return asn1.Marshal(ecPrivateKey{ - Version: 1, - PrivateKey: key.D.Bytes(), - NamedCurveOID: oid, - PublicKey: asn1.BitString{Bytes: elliptic.Marshal(key.Curve, key.X, key.Y)}, - }) -} - -// parseECPrivateKey parses an ASN.1 Elliptic Curve Private Key Structure. -// The OID for the named curve may be provided from another source (such as -// the PKCS8 container) - if it is provided then use this instead of the OID -// that may exist in the EC private key structure. -func parseECPrivateKey(namedCurveOID *asn1.ObjectIdentifier, der []byte) (key *ecdsa.PrivateKey, err error) { - var privKey ecPrivateKey - if _, err := asn1.Unmarshal(der, &privKey); err != nil { - return nil, errors.New("x509: failed to parse EC private key: " + err.Error()) - } - if privKey.Version != ecPrivKeyVersion { - return nil, fmt.Errorf("x509: unknown EC private key version %d", privKey.Version) - } - - var curve elliptic.Curve - if namedCurveOID != nil { - curve = namedCurveFromOID(*namedCurveOID) - } else { - curve = namedCurveFromOID(privKey.NamedCurveOID) - } - if curve == nil { - return nil, errors.New("x509: unknown elliptic curve") - } - - k := new(big.Int).SetBytes(privKey.PrivateKey) - if k.Cmp(curve.Params().N) >= 0 { - return nil, errors.New("x509: invalid elliptic curve private key value") - } - priv := new(ecdsa.PrivateKey) - priv.Curve = curve - priv.D = k - priv.X, priv.Y = curve.ScalarBaseMult(privKey.PrivateKey) - - return priv, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1_test.go deleted file mode 100644 index 95f18e77de0e4d58aaa10e98d42b8c3657029c28..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sec1_test.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "bytes" - "encoding/hex" - "testing" -) - -// Generated using: -// openssl ecparam -genkey -name secp384r1 -outform PEM -var ecPrivateKeyHex = `3081a40201010430bdb9839c08ee793d1157886a7a758a3c8b2a17a4df48f17ace57c72c56b4723cf21dcda21d4e1ad57ff034f19fcfd98ea00706052b81040022a16403620004feea808b5ee2429cfcce13c32160e1c960990bd050bb0fdf7222f3decd0a55008e32a6aa3c9062051c4cba92a7a3b178b24567412d43cdd2f882fa5addddd726fe3e208d2c26d733a773a597abb749714df7256ead5105fa6e7b3650de236b50` - -func TestParseECPrivateKey(t *testing.T) { - derBytes, _ := hex.DecodeString(ecPrivateKeyHex) - key, err := ParseECPrivateKey(derBytes) - if err != nil { - t.Errorf("failed to decode EC private key: %s", err) - } - serialized, err := MarshalECPrivateKey(key) - if err != nil { - t.Fatalf("failed to encode EC private key: %s", err) - } - if !bytes.Equal(serialized, derBytes) { - t.Fatalf("serialized key differs: got %x, want %x", serialized, derBytes) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sha2_windows_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/sha2_windows_test.go deleted file mode 100644 index 79dc685c5b55bec4404b303dc7c6b40c2f4975b3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/sha2_windows_test.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import "syscall" - -func init() { - v, err := syscall.GetVersion() - if err != nil { - return - } - if major := byte(v); major < 6 { - // Windows XP SP2 and Windows 2003 do not support SHA2. - // http://blogs.technet.com/b/pki/archive/2010/09/30/sha2-and-windows.aspx - supportSHA2 = false - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify.go deleted file mode 100644 index 21b870c1712cc712ed3c2dc89baa37af9ccce1c8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify.go +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "fmt" - "net" - "runtime" - "strings" - "time" - "unicode/utf8" -) - -type InvalidReason int - -const ( - // NotAuthorizedToSign results when a certificate is signed by another - // which isn't marked as a CA certificate. - NotAuthorizedToSign InvalidReason = iota - // Expired results when a certificate has expired, based on the time - // given in the VerifyOptions. - Expired - // CANotAuthorizedForThisName results when an intermediate or root - // certificate has a name constraint which doesn't include the name - // being checked. - CANotAuthorizedForThisName - // TooManyIntermediates results when a path length constraint is - // violated. - TooManyIntermediates - // IncompatibleUsage results when the certificate's key usage indicates - // that it may only be used for a different purpose. - IncompatibleUsage -) - -// CertificateInvalidError results when an odd error occurs. Users of this -// library probably want to handle all these errors uniformly. -type CertificateInvalidError struct { - Cert *Certificate - Reason InvalidReason -} - -func (e CertificateInvalidError) Error() string { - switch e.Reason { - case NotAuthorizedToSign: - return "x509: certificate is not authorized to sign other certificates" - case Expired: - return "x509: certificate has expired or is not yet valid" - case CANotAuthorizedForThisName: - return "x509: a root or intermediate certificate is not authorized to sign in this domain" - case TooManyIntermediates: - return "x509: too many intermediates for path length constraint" - case IncompatibleUsage: - return "x509: certificate specifies an incompatible key usage" - } - return "x509: unknown error" -} - -// HostnameError results when the set of authorized names doesn't match the -// requested name. -type HostnameError struct { - Certificate *Certificate - Host string -} - -func (h HostnameError) Error() string { - c := h.Certificate - - var valid string - if ip := net.ParseIP(h.Host); ip != nil { - // Trying to validate an IP - if len(c.IPAddresses) == 0 { - return "x509: cannot validate certificate for " + h.Host + " because it doesn't contain any IP SANs" - } - for _, san := range c.IPAddresses { - if len(valid) > 0 { - valid += ", " - } - valid += san.String() - } - } else { - if len(c.DNSNames) > 0 { - valid = strings.Join(c.DNSNames, ", ") - } else { - valid = c.Subject.CommonName - } - } - return "x509: certificate is valid for " + valid + ", not " + h.Host -} - -// UnknownAuthorityError results when the certificate issuer is unknown -type UnknownAuthorityError struct { - cert *Certificate - // hintErr contains an error that may be helpful in determining why an - // authority wasn't found. - hintErr error - // hintCert contains a possible authority certificate that was rejected - // because of the error in hintErr. - hintCert *Certificate -} - -func (e UnknownAuthorityError) Error() string { - s := "x509: certificate signed by unknown authority" - if e.hintErr != nil { - certName := e.hintCert.Subject.CommonName - if len(certName) == 0 { - if len(e.hintCert.Subject.Organization) > 0 { - certName = e.hintCert.Subject.Organization[0] - } - certName = "serial:" + e.hintCert.SerialNumber.String() - } - s += fmt.Sprintf(" (possibly because of %q while trying to verify candidate authority certificate %q)", e.hintErr, certName) - } - return s -} - -// SystemRootsError results when we fail to load the system root certificates. -type SystemRootsError struct{} - -func (SystemRootsError) Error() string { - return "x509: failed to load system roots and no roots provided" -} - -// VerifyOptions contains parameters for Certificate.Verify. It's a structure -// because other PKIX verification APIs have ended up needing many options. -type VerifyOptions struct { - DNSName string - Intermediates *CertPool - Roots *CertPool // if nil, the system roots are used - CurrentTime time.Time // if zero, the current time is used - // KeyUsage specifies which Extended Key Usage values are acceptable. - // An empty list means ExtKeyUsageServerAuth. Key usage is considered a - // constraint down the chain which mirrors Windows CryptoAPI behaviour, - // but not the spec. To accept any key usage, include ExtKeyUsageAny. - KeyUsages []ExtKeyUsage -} - -const ( - leafCertificate = iota - intermediateCertificate - rootCertificate -) - -// isValid performs validity checks on the c. -func (c *Certificate) isValid(certType int, currentChain []*Certificate, opts *VerifyOptions) error { - now := opts.CurrentTime - if now.IsZero() { - now = time.Now() - } - if now.Before(c.NotBefore) || now.After(c.NotAfter) { - return CertificateInvalidError{c, Expired} - } - - if len(c.PermittedDNSDomains) > 0 { - ok := false - for _, domain := range c.PermittedDNSDomains { - if opts.DNSName == domain || - (strings.HasSuffix(opts.DNSName, domain) && - len(opts.DNSName) >= 1+len(domain) && - opts.DNSName[len(opts.DNSName)-len(domain)-1] == '.') { - ok = true - break - } - } - - if !ok { - return CertificateInvalidError{c, CANotAuthorizedForThisName} - } - } - - // KeyUsage status flags are ignored. From Engineering Security, Peter - // Gutmann: A European government CA marked its signing certificates as - // being valid for encryption only, but no-one noticed. Another - // European CA marked its signature keys as not being valid for - // signatures. A different CA marked its own trusted root certificate - // as being invalid for certificate signing. Another national CA - // distributed a certificate to be used to encrypt data for the - // country’s tax authority that was marked as only being usable for - // digital signatures but not for encryption. Yet another CA reversed - // the order of the bit flags in the keyUsage due to confusion over - // encoding endianness, essentially setting a random keyUsage in - // certificates that it issued. Another CA created a self-invalidating - // certificate by adding a certificate policy statement stipulating - // that the certificate had to be used strictly as specified in the - // keyUsage, and a keyUsage containing a flag indicating that the RSA - // encryption key could only be used for Diffie-Hellman key agreement. - - if certType == intermediateCertificate && (!c.BasicConstraintsValid || !c.IsCA) { - return CertificateInvalidError{c, NotAuthorizedToSign} - } - - if c.BasicConstraintsValid && c.MaxPathLen >= 0 { - numIntermediates := len(currentChain) - 1 - if numIntermediates > c.MaxPathLen { - return CertificateInvalidError{c, TooManyIntermediates} - } - } - - return nil -} - -// Verify attempts to verify c by building one or more chains from c to a -// certificate in opts.Roots, using certificates in opts.Intermediates if -// needed. If successful, it returns one or more chains where the first -// element of the chain is c and the last element is from opts.Roots. -// -// If opts.Roots is nil and system roots are unavailable the returned error -// will be of type SystemRootsError. -// -// WARNING: this doesn't do any revocation checking. -func (c *Certificate) Verify(opts VerifyOptions) (chains [][]*Certificate, err error) { - // Use Windows's own verification and chain building. - if opts.Roots == nil && runtime.GOOS == "windows" { - return c.systemVerify(&opts) - } - - if len(c.UnhandledCriticalExtensions) > 0 { - return nil, UnhandledCriticalExtension{} - } - - if opts.Roots == nil { - opts.Roots = systemRootsPool() - if opts.Roots == nil { - return nil, SystemRootsError{} - } - } - - err = c.isValid(leafCertificate, nil, &opts) - if err != nil { - return - } - - if len(opts.DNSName) > 0 { - err = c.VerifyHostname(opts.DNSName) - if err != nil { - return - } - } - - candidateChains, err := c.buildChains(make(map[int][][]*Certificate), []*Certificate{c}, &opts) - if err != nil { - return - } - - keyUsages := opts.KeyUsages - if len(keyUsages) == 0 { - keyUsages = []ExtKeyUsage{ExtKeyUsageServerAuth} - } - - // If any key usage is acceptable then we're done. - for _, usage := range keyUsages { - if usage == ExtKeyUsageAny { - chains = candidateChains - return - } - } - - for _, candidate := range candidateChains { - if checkChainForKeyUsage(candidate, keyUsages) { - chains = append(chains, candidate) - } - } - - if len(chains) == 0 { - err = CertificateInvalidError{c, IncompatibleUsage} - } - - return -} - -func appendToFreshChain(chain []*Certificate, cert *Certificate) []*Certificate { - n := make([]*Certificate, len(chain)+1) - copy(n, chain) - n[len(chain)] = cert - return n -} - -func (c *Certificate) buildChains(cache map[int][][]*Certificate, currentChain []*Certificate, opts *VerifyOptions) (chains [][]*Certificate, err error) { - possibleRoots, failedRoot, rootErr := opts.Roots.findVerifiedParents(c) - for _, rootNum := range possibleRoots { - root := opts.Roots.certs[rootNum] - err = root.isValid(rootCertificate, currentChain, opts) - if err != nil { - continue - } - chains = append(chains, appendToFreshChain(currentChain, root)) - } - - possibleIntermediates, failedIntermediate, intermediateErr := opts.Intermediates.findVerifiedParents(c) -nextIntermediate: - for _, intermediateNum := range possibleIntermediates { - intermediate := opts.Intermediates.certs[intermediateNum] - for _, cert := range currentChain { - if cert == intermediate { - continue nextIntermediate - } - } - err = intermediate.isValid(intermediateCertificate, currentChain, opts) - if err != nil { - continue - } - var childChains [][]*Certificate - childChains, ok := cache[intermediateNum] - if !ok { - childChains, err = intermediate.buildChains(cache, appendToFreshChain(currentChain, intermediate), opts) - cache[intermediateNum] = childChains - } - chains = append(chains, childChains...) - } - - if len(chains) > 0 { - err = nil - } - - if len(chains) == 0 && err == nil { - hintErr := rootErr - hintCert := failedRoot - if hintErr == nil { - hintErr = intermediateErr - hintCert = failedIntermediate - } - err = UnknownAuthorityError{c, hintErr, hintCert} - } - - return -} - -func matchHostnames(pattern, host string) bool { - host = strings.TrimSuffix(host, ".") - pattern = strings.TrimSuffix(pattern, ".") - - if len(pattern) == 0 || len(host) == 0 { - return false - } - - patternParts := strings.Split(pattern, ".") - hostParts := strings.Split(host, ".") - - if len(patternParts) != len(hostParts) { - return false - } - - for i, patternPart := range patternParts { - if i == 0 && patternPart == "*" { - continue - } - if patternPart != hostParts[i] { - return false - } - } - - return true -} - -// toLowerCaseASCII returns a lower-case version of in. See RFC 6125 6.4.1. We use -// an explicitly ASCII function to avoid any sharp corners resulting from -// performing Unicode operations on DNS labels. -func toLowerCaseASCII(in string) string { - // If the string is already lower-case then there's nothing to do. - isAlreadyLowerCase := true - for _, c := range in { - if c == utf8.RuneError { - // If we get a UTF-8 error then there might be - // upper-case ASCII bytes in the invalid sequence. - isAlreadyLowerCase = false - break - } - if 'A' <= c && c <= 'Z' { - isAlreadyLowerCase = false - break - } - } - - if isAlreadyLowerCase { - return in - } - - out := []byte(in) - for i, c := range out { - if 'A' <= c && c <= 'Z' { - out[i] += 'a' - 'A' - } - } - return string(out) -} - -// VerifyHostname returns nil if c is a valid certificate for the named host. -// Otherwise it returns an error describing the mismatch. -func (c *Certificate) VerifyHostname(h string) error { - // IP addresses may be written in [ ]. - candidateIP := h - if len(h) >= 3 && h[0] == '[' && h[len(h)-1] == ']' { - candidateIP = h[1 : len(h)-1] - } - if ip := net.ParseIP(candidateIP); ip != nil { - // We only match IP addresses against IP SANs. - // https://tools.ietf.org/html/rfc6125#appendix-B.2 - for _, candidate := range c.IPAddresses { - if ip.Equal(candidate) { - return nil - } - } - return HostnameError{c, candidateIP} - } - - lowered := toLowerCaseASCII(h) - - if len(c.DNSNames) > 0 { - for _, match := range c.DNSNames { - if matchHostnames(toLowerCaseASCII(match), lowered) { - return nil - } - } - // If Subject Alt Name is given, we ignore the common name. - } else if matchHostnames(toLowerCaseASCII(c.Subject.CommonName), lowered) { - return nil - } - - return HostnameError{c, h} -} - -func checkChainForKeyUsage(chain []*Certificate, keyUsages []ExtKeyUsage) bool { - usages := make([]ExtKeyUsage, len(keyUsages)) - copy(usages, keyUsages) - - if len(chain) == 0 { - return false - } - - usagesRemaining := len(usages) - - // We walk down the list and cross out any usages that aren't supported - // by each certificate. If we cross out all the usages, then the chain - // is unacceptable. - -NextCert: - for i := len(chain) - 1; i >= 0; i-- { - cert := chain[i] - if len(cert.ExtKeyUsage) == 0 && len(cert.UnknownExtKeyUsage) == 0 { - // The certificate doesn't have any extended key usage specified. - continue - } - - for _, usage := range cert.ExtKeyUsage { - if usage == ExtKeyUsageAny { - // The certificate is explicitly good for any usage. - continue NextCert - } - } - - const invalidUsage ExtKeyUsage = -1 - - NextRequestedUsage: - for i, requestedUsage := range usages { - if requestedUsage == invalidUsage { - continue - } - - for _, usage := range cert.ExtKeyUsage { - if requestedUsage == usage { - continue NextRequestedUsage - } else if requestedUsage == ExtKeyUsageServerAuth && - (usage == ExtKeyUsageNetscapeServerGatedCrypto || - usage == ExtKeyUsageMicrosoftServerGatedCrypto) { - // In order to support COMODO - // certificate chains, we have to - // accept Netscape or Microsoft SGC - // usages as equal to ServerAuth. - continue NextRequestedUsage - } - } - - usages[i] = invalidUsage - usagesRemaining-- - if usagesRemaining == 0 { - return false - } - } - } - - return true -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify_test.go deleted file mode 100644 index 694c14023b8ab12f9685134ce11e576cb6e6b86d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/verify_test.go +++ /dev/null @@ -1,1134 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "crypto/x509/pkix" - "encoding/pem" - "errors" - "runtime" - "strings" - "testing" - "time" -) - -var supportSHA2 = true - -type verifyTest struct { - leaf string - intermediates []string - roots []string - currentTime int64 - dnsName string - systemSkip bool - keyUsages []ExtKeyUsage - testSystemRootsError bool - sha2 bool - - errorCallback func(*testing.T, int, error) bool - expectedChains [][]string -} - -var verifyTests = []verifyTest{ - { - leaf: googleLeaf, - intermediates: []string{giag2Intermediate}, - currentTime: 1395785200, - dnsName: "www.google.com", - testSystemRootsError: true, - - // Without any roots specified we should get a system roots - // error. - errorCallback: expectSystemRootsError, - }, - { - leaf: googleLeaf, - intermediates: []string{giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "www.google.com", - - expectedChains: [][]string{ - {"Google", "Google Internet Authority", "GeoTrust"}, - }, - }, - { - leaf: googleLeaf, - intermediates: []string{giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "WwW.GooGLE.coM", - - expectedChains: [][]string{ - {"Google", "Google Internet Authority", "GeoTrust"}, - }, - }, - { - leaf: googleLeaf, - intermediates: []string{giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "www.example.com", - - errorCallback: expectHostnameError, - }, - { - leaf: googleLeaf, - intermediates: []string{giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1, - dnsName: "www.example.com", - - errorCallback: expectExpired, - }, - { - leaf: googleLeaf, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "www.google.com", - - // Skip when using systemVerify, since Windows - // *will* find the missing intermediate cert. - systemSkip: true, - errorCallback: expectAuthorityUnknown, - }, - { - leaf: googleLeaf, - intermediates: []string{geoTrustRoot, giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "www.google.com", - - expectedChains: [][]string{ - {"Google", "Google Internet Authority", "GeoTrust"}, - // TODO(agl): this is ok, but it would be nice if the - // chain building didn't visit the same SPKI - // twice. - {"Google", "Google Internet Authority", "GeoTrust", "GeoTrust"}, - }, - // CAPI doesn't build the chain with the duplicated GeoTrust - // entry so the results don't match. Thus we skip this test - // until that's fixed. - systemSkip: true, - }, - { - leaf: dnssecExpLeaf, - intermediates: []string{startComIntermediate}, - roots: []string{startComRoot}, - currentTime: 1302726541, - - expectedChains: [][]string{ - {"dnssec-exp", "StartCom Class 1", "StartCom Certification Authority"}, - }, - }, - { - leaf: dnssecExpLeaf, - intermediates: []string{startComIntermediate, startComRoot}, - roots: []string{startComRoot}, - currentTime: 1302726541, - - // Skip when using systemVerify, since Windows - // can only return a single chain to us (for now). - systemSkip: true, - expectedChains: [][]string{ - {"dnssec-exp", "StartCom Class 1", "StartCom Certification Authority"}, - {"dnssec-exp", "StartCom Class 1", "StartCom Certification Authority", "StartCom Certification Authority"}, - }, - }, - { - leaf: googleLeafWithInvalidHash, - intermediates: []string{giag2Intermediate}, - roots: []string{geoTrustRoot}, - currentTime: 1395785200, - dnsName: "www.google.com", - - // The specific error message may not occur when using system - // verification. - systemSkip: true, - errorCallback: expectHashError, - }, - { - // The default configuration should reject an S/MIME chain. - leaf: smimeLeaf, - roots: []string{smimeIntermediate}, - currentTime: 1339436154, - - // Key usage not implemented for Windows yet. - systemSkip: true, - errorCallback: expectUsageError, - }, - { - leaf: smimeLeaf, - roots: []string{smimeIntermediate}, - currentTime: 1339436154, - keyUsages: []ExtKeyUsage{ExtKeyUsageServerAuth}, - - // Key usage not implemented for Windows yet. - systemSkip: true, - errorCallback: expectUsageError, - }, - { - leaf: smimeLeaf, - roots: []string{smimeIntermediate}, - currentTime: 1339436154, - keyUsages: []ExtKeyUsage{ExtKeyUsageEmailProtection}, - - // Key usage not implemented for Windows yet. - systemSkip: true, - expectedChains: [][]string{ - {"Ryan Hurst", "GlobalSign PersonalSign 2 CA - G2"}, - }, - }, - { - leaf: megaLeaf, - intermediates: []string{comodoIntermediate1}, - roots: []string{comodoRoot}, - currentTime: 1360431182, - - // CryptoAPI can find alternative validation paths so we don't - // perform this test with system validation. - systemSkip: true, - expectedChains: [][]string{ - {"mega.co.nz", "EssentialSSL CA", "COMODO Certification Authority"}, - }, - }, - { - // Check that a name constrained intermediate works even when - // it lists multiple constraints. - leaf: nameConstraintsLeaf, - intermediates: []string{nameConstraintsIntermediate1, nameConstraintsIntermediate2}, - roots: []string{globalSignRoot}, - currentTime: 1382387896, - dnsName: "secure.iddl.vt.edu", - - expectedChains: [][]string{ - { - "Technology-enhanced Learning and Online Strategies", - "Virginia Tech Global Qualified Server CA", - "Trusted Root CA G2", - "GlobalSign Root CA", - }, - }, - }, - { - // Check that SHA-384 intermediates (which are popping up) - // work. - leaf: moipLeafCert, - intermediates: []string{comodoIntermediateSHA384, comodoRSAAuthority}, - roots: []string{addTrustRoot}, - currentTime: 1397502195, - dnsName: "api.moip.com.br", - - // CryptoAPI can find alternative validation paths so we don't - // perform this test with system validation. - systemSkip: true, - - sha2: true, - expectedChains: [][]string{ - { - "api.moip.com.br", - "COMODO RSA Extended Validation Secure Server CA", - "COMODO RSA Certification Authority", - "AddTrust External CA Root", - }, - }, - }, -} - -func expectHostnameError(t *testing.T, i int, err error) (ok bool) { - if _, ok := err.(HostnameError); !ok { - t.Errorf("#%d: error was not a HostnameError: %s", i, err) - return false - } - return true -} - -func expectExpired(t *testing.T, i int, err error) (ok bool) { - if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != Expired { - t.Errorf("#%d: error was not Expired: %s", i, err) - return false - } - return true -} - -func expectUsageError(t *testing.T, i int, err error) (ok bool) { - if inval, ok := err.(CertificateInvalidError); !ok || inval.Reason != IncompatibleUsage { - t.Errorf("#%d: error was not IncompatibleUsage: %s", i, err) - return false - } - return true -} - -func expectAuthorityUnknown(t *testing.T, i int, err error) (ok bool) { - if _, ok := err.(UnknownAuthorityError); !ok { - t.Errorf("#%d: error was not UnknownAuthorityError: %s", i, err) - return false - } - return true -} - -func expectSystemRootsError(t *testing.T, i int, err error) bool { - if _, ok := err.(SystemRootsError); !ok { - t.Errorf("#%d: error was not SystemRootsError: %s", i, err) - return false - } - return true -} - -func expectHashError(t *testing.T, i int, err error) bool { - if err == nil { - t.Errorf("#%d: no error resulted from invalid hash", i) - return false - } - if expected := "algorithm unimplemented"; !strings.Contains(err.Error(), expected) { - t.Errorf("#%d: error resulting from invalid hash didn't contain '%s', rather it was: %s", i, expected, err) - return false - } - return true -} - -func certificateFromPEM(pemBytes string) (*Certificate, error) { - block, _ := pem.Decode([]byte(pemBytes)) - if block == nil { - return nil, errors.New("failed to decode PEM") - } - return ParseCertificate(block.Bytes) -} - -func testVerify(t *testing.T, useSystemRoots bool) { - for i, test := range verifyTests { - if useSystemRoots && test.systemSkip { - continue - } - if runtime.GOOS == "windows" && test.testSystemRootsError { - continue - } - if useSystemRoots && !supportSHA2 && test.sha2 { - continue - } - - opts := VerifyOptions{ - Intermediates: NewCertPool(), - DNSName: test.dnsName, - CurrentTime: time.Unix(test.currentTime, 0), - KeyUsages: test.keyUsages, - } - - if !useSystemRoots { - opts.Roots = NewCertPool() - for j, root := range test.roots { - ok := opts.Roots.AppendCertsFromPEM([]byte(root)) - if !ok { - t.Errorf("#%d: failed to parse root #%d", i, j) - return - } - } - } - - for j, intermediate := range test.intermediates { - ok := opts.Intermediates.AppendCertsFromPEM([]byte(intermediate)) - if !ok { - t.Errorf("#%d: failed to parse intermediate #%d", i, j) - return - } - } - - leaf, err := certificateFromPEM(test.leaf) - if err != nil { - t.Errorf("#%d: failed to parse leaf: %s", i, err) - return - } - - var oldSystemRoots *CertPool - if test.testSystemRootsError { - oldSystemRoots = systemRootsPool() - systemRoots = nil - opts.Roots = nil - } - - chains, err := leaf.Verify(opts) - - if test.testSystemRootsError { - systemRoots = oldSystemRoots - } - - if test.errorCallback == nil && err != nil { - t.Errorf("#%d: unexpected error: %s", i, err) - } - if test.errorCallback != nil { - if !test.errorCallback(t, i, err) { - return - } - } - - if len(chains) != len(test.expectedChains) { - t.Errorf("#%d: wanted %d chains, got %d", i, len(test.expectedChains), len(chains)) - } - - // We check that each returned chain matches a chain from - // expectedChains but an entry in expectedChains can't match - // two chains. - seenChains := make([]bool, len(chains)) - NextOutputChain: - for _, chain := range chains { - TryNextExpected: - for j, expectedChain := range test.expectedChains { - if seenChains[j] { - continue - } - if len(chain) != len(expectedChain) { - continue - } - for k, cert := range chain { - if strings.Index(nameToKey(&cert.Subject), expectedChain[k]) == -1 { - continue TryNextExpected - } - } - // we matched - seenChains[j] = true - continue NextOutputChain - } - t.Errorf("#%d: No expected chain matched %s", i, chainToDebugString(chain)) - } - } -} - -func TestGoVerify(t *testing.T) { - testVerify(t, false) -} - -func TestSystemVerify(t *testing.T) { - if runtime.GOOS != "windows" { - t.Skipf("skipping verify test using system APIs on %q", runtime.GOOS) - } - - testVerify(t, true) -} - -func chainToDebugString(chain []*Certificate) string { - var chainStr string - for _, cert := range chain { - if len(chainStr) > 0 { - chainStr += " -> " - } - chainStr += nameToKey(&cert.Subject) - } - return chainStr -} - -func nameToKey(name *pkix.Name) string { - return strings.Join(name.Country, ",") + "/" + strings.Join(name.Organization, ",") + "/" + strings.Join(name.OrganizationalUnit, ",") + "/" + name.CommonName -} - -const geoTrustRoot = `-----BEGIN CERTIFICATE----- -MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i -YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG -EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg -R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 -9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq -fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv -iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU -1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ -bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW -MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA -ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l -uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn -Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS -tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF -PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un -hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV -5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== ------END CERTIFICATE----- -` - -const giag2Intermediate = `-----BEGIN CERTIFICATE----- -MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT -MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i -YWwgQ0EwHhcNMTMwNDA1MTUxNTU1WhcNMTUwNDA0MTUxNTU1WjBJMQswCQYDVQQG -EwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzElMCMGA1UEAxMcR29vZ2xlIEludGVy -bmV0IEF1dGhvcml0eSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AJwqBHdc2FCROgajguDYUEi8iT/xGXAaiEZ+4I/F8YnOIe5a/mENtzJEiaB0C1NP -VaTOgmKV7utZX8bhBYASxF6UP7xbSDj0U/ck5vuR6RXEz/RTDfRK/J9U3n2+oGtv -h8DQUB8oMANA2ghzUWx//zo8pzcGjr1LEQTrfSTe5vn8MXH7lNVg8y5Kr0LSy+rE -ahqyzFPdFUuLH8gZYR/Nnag+YyuENWllhMgZxUYi+FOVvuOAShDGKuy6lyARxzmZ -EASg8GF6lSWMTlJ14rbtCMoU/M4iarNOz0YDl5cDfsCx3nuvRTPPuj5xt970JSXC -DTWJnZ37DhF5iR43xa+OcmkCAwEAAaOB+zCB+DAfBgNVHSMEGDAWgBTAephojYn7 -qwVkDBF9qn1luMrMTjAdBgNVHQ4EFgQUSt0GFhu89mi1dvWBtrtiGrpagS8wEgYD -VR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAQYwOgYDVR0fBDMwMTAvoC2g -K4YpaHR0cDovL2NybC5nZW90cnVzdC5jb20vY3Jscy9ndGdsb2JhbC5jcmwwPQYI -KwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwOi8vZ3RnbG9iYWwtb2NzcC5n -ZW90cnVzdC5jb20wFwYDVR0gBBAwDjAMBgorBgEEAdZ5AgUBMA0GCSqGSIb3DQEB -BQUAA4IBAQA21waAESetKhSbOHezI6B1WLuxfoNCunLaHtiONgaX4PCVOzf9G0JY -/iLIa704XtE7JW4S615ndkZAkNoUyHgN7ZVm2o6Gb4ChulYylYbc3GrKBIxbf/a/ -zG+FA1jDaFETzf3I93k9mTXwVqO94FntT0QJo544evZG0R0SnU++0ED8Vf4GXjza -HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto -WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6 -yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx ------END CERTIFICATE----- -` - -const googleLeaf = `-----BEGIN CERTIFICATE----- -MIIEdjCCA16gAwIBAgIIcR5k4dkoe04wDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE -BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl -cm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwMzEyMDkzODMwWhcNMTQwNjEwMDAwMDAw -WjBoMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN -TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEXMBUGA1UEAwwOd3d3 -Lmdvb2dsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4zYCe -m0oUBhwE0EwBr65eBOcgcQO2PaSIAB2dEP/c1EMX2tOy0ov8rk83ePhJ+MWdT1z6 -jge9X4zQQI8ZyA9qIiwrKBZOi8DNUvrqNZC7fJAVRrb9aX/99uYOJCypIbpmWG1q -fhbHjJewhwf8xYPj71eU4rLG80a+DapWmphtfq3h52lDQIBzLVf1yYbyrTaELaz4 -NXF7HXb5YkId/gxIsSzM0aFUVu2o8sJcLYAsJqwfFKBKOMxUcn545nlspf0mTcWZ -0APlbwsKznNs4/xCDwIxxWjjqgHrYAFl6y07i1gzbAOqdNEyR24p+3JWI8WZBlBI -dk2KGj0W1fIfsvyxAgMBAAGjggFBMIIBPTAdBgNVHSUEFjAUBggrBgEFBQcDAQYI -KwYBBQUHAwIwGQYDVR0RBBIwEIIOd3d3Lmdvb2dsZS5jb20waAYIKwYBBQUHAQEE -XDBaMCsGCCsGAQUFBzAChh9odHRwOi8vcGtpLmdvb2dsZS5jb20vR0lBRzIuY3J0 -MCsGCCsGAQUFBzABhh9odHRwOi8vY2xpZW50czEuZ29vZ2xlLmNvbS9vY3NwMB0G -A1UdDgQWBBTXD5Bx6iqT+dmEhbFL4OUoHyZn8zAMBgNVHRMBAf8EAjAAMB8GA1Ud -IwQYMBaAFErdBhYbvPZotXb1gba7Yhq6WoEvMBcGA1UdIAQQMA4wDAYKKwYBBAHW -eQIFATAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vcGtpLmdvb2dsZS5jb20vR0lB -RzIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCR3RJtHzgDh33b/MI1ugiki+nl8Ikj -5larbJRE/rcA5oite+QJyAr6SU1gJJ/rRrK3ItVEHr9L621BCM7GSdoNMjB9MMcf -tJAW0kYGJ+wqKm53wG/JaOADTnnq2Mt/j6F2uvjgN/ouns1nRHufIvd370N0LeH+ -orKqTuAPzXK7imQk6+OycYABbqCtC/9qmwRd8wwn7sF97DtYfK8WuNHtFalCAwyi -8LxJJYJCLWoMhZ+V8GZm+FOex5qkQAjnZrtNlbQJ8ro4r+rpKXtmMFFhfa+7L+PA -Kom08eUK8skxAzfDDijZPh10VtJ66uBoiDPdT+uCBehcBIcmSTrKjFGX ------END CERTIFICATE----- -` - -// googleLeafWithInvalidHash is the same as googleLeaf, but the signature -// algorithm in the certificate contains a nonsense OID. -const googleLeafWithInvalidHash = `-----BEGIN CERTIFICATE----- -MIIEdjCCA16gAwIBAgIIcR5k4dkoe04wDQYJKoZIhvcNAWAFBQAwSTELMAkGA1UE -BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl -cm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwMzEyMDkzODMwWhcNMTQwNjEwMDAwMDAw -WjBoMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN -TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEXMBUGA1UEAwwOd3d3 -Lmdvb2dsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4zYCe -m0oUBhwE0EwBr65eBOcgcQO2PaSIAB2dEP/c1EMX2tOy0ov8rk83ePhJ+MWdT1z6 -jge9X4zQQI8ZyA9qIiwrKBZOi8DNUvrqNZC7fJAVRrb9aX/99uYOJCypIbpmWG1q -fhbHjJewhwf8xYPj71eU4rLG80a+DapWmphtfq3h52lDQIBzLVf1yYbyrTaELaz4 -NXF7HXb5YkId/gxIsSzM0aFUVu2o8sJcLYAsJqwfFKBKOMxUcn545nlspf0mTcWZ -0APlbwsKznNs4/xCDwIxxWjjqgHrYAFl6y07i1gzbAOqdNEyR24p+3JWI8WZBlBI -dk2KGj0W1fIfsvyxAgMBAAGjggFBMIIBPTAdBgNVHSUEFjAUBggrBgEFBQcDAQYI -KwYBBQUHAwIwGQYDVR0RBBIwEIIOd3d3Lmdvb2dsZS5jb20waAYIKwYBBQUHAQEE -XDBaMCsGCCsGAQUFBzAChh9odHRwOi8vcGtpLmdvb2dsZS5jb20vR0lBRzIuY3J0 -MCsGCCsGAQUFBzABhh9odHRwOi8vY2xpZW50czEuZ29vZ2xlLmNvbS9vY3NwMB0G -A1UdDgQWBBTXD5Bx6iqT+dmEhbFL4OUoHyZn8zAMBgNVHRMBAf8EAjAAMB8GA1Ud -IwQYMBaAFErdBhYbvPZotXb1gba7Yhq6WoEvMBcGA1UdIAQQMA4wDAYKKwYBBAHW -eQIFATAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vcGtpLmdvb2dsZS5jb20vR0lB -RzIuY3JsMA0GCSqGSIb3DQFgBQUAA4IBAQCR3RJtHzgDh33b/MI1ugiki+nl8Ikj -5larbJRE/rcA5oite+QJyAr6SU1gJJ/rRrK3ItVEHr9L621BCM7GSdoNMjB9MMcf -tJAW0kYGJ+wqKm53wG/JaOADTnnq2Mt/j6F2uvjgN/ouns1nRHufIvd370N0LeH+ -orKqTuAPzXK7imQk6+OycYABbqCtC/9qmwRd8wwn7sF97DtYfK8WuNHtFalCAwyi -8LxJJYJCLWoMhZ+V8GZm+FOex5qkQAjnZrtNlbQJ8ro4r+rpKXtmMFFhfa+7L+PA -Kom08eUK8skxAzfDDijZPh10VtJ66uBoiDPdT+uCBehcBIcmSTrKjFGX ------END CERTIFICATE----- -` - -const dnssecExpLeaf = `-----BEGIN CERTIFICATE----- -MIIGzTCCBbWgAwIBAgIDAdD6MA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ -TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0 -YWwgQ2VydGlmaWNhdGUgU2lnbmluZzE4MDYGA1UEAxMvU3RhcnRDb20gQ2xhc3Mg -MSBQcmltYXJ5IEludGVybWVkaWF0ZSBTZXJ2ZXIgQ0EwHhcNMTAwNzA0MTQ1MjQ1 -WhcNMTEwNzA1MTA1NzA0WjCBwTEgMB4GA1UEDRMXMjIxMTM3LWxpOWE5dHhJRzZM -NnNyVFMxCzAJBgNVBAYTAlVTMR4wHAYDVQQKExVQZXJzb25hIE5vdCBWYWxpZGF0 -ZWQxKTAnBgNVBAsTIFN0YXJ0Q29tIEZyZWUgQ2VydGlmaWNhdGUgTWVtYmVyMRsw -GQYDVQQDExJ3d3cuZG5zc2VjLWV4cC5vcmcxKDAmBgkqhkiG9w0BCQEWGWhvc3Rt -YXN0ZXJAZG5zc2VjLWV4cC5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQDEdF/22vaxrPbqpgVYMWi+alfpzBctpbfLBdPGuqOazJdCT0NbWcK8/+B4 -X6OlSOURNIlwLzhkmwVsWdVv6dVSaN7d4yI/fJkvgfDB9+au+iBJb6Pcz8ULBfe6 -D8HVvqKdORp6INzHz71z0sghxrQ0EAEkoWAZLh+kcn2ZHdcmZaBNUfjmGbyU6PRt -RjdqoP+owIaC1aktBN7zl4uO7cRjlYFdusINrh2kPP02KAx2W84xjxX1uyj6oS6e -7eBfvcwe8czW/N1rbE0CoR7h9+HnIrjnVG9RhBiZEiw3mUmF++Up26+4KTdRKbu3 -+BL4yMpfd66z0+zzqu+HkvyLpFn5AgMBAAGjggL/MIIC+zAJBgNVHRMEAjAAMAsG -A1UdDwQEAwIDqDATBgNVHSUEDDAKBggrBgEFBQcDATAdBgNVHQ4EFgQUy04I5guM -drzfh2JQaXhgV86+4jUwHwYDVR0jBBgwFoAU60I00Jiwq5/0G2sI98xkLu8OLEUw -LQYDVR0RBCYwJIISd3d3LmRuc3NlYy1leHAub3Jngg5kbnNzZWMtZXhwLm9yZzCC -AUIGA1UdIASCATkwggE1MIIBMQYLKwYBBAGBtTcBAgIwggEgMC4GCCsGAQUFBwIB -FiJodHRwOi8vd3d3LnN0YXJ0c3NsLmNvbS9wb2xpY3kucGRmMDQGCCsGAQUFBwIB -FihodHRwOi8vd3d3LnN0YXJ0c3NsLmNvbS9pbnRlcm1lZGlhdGUucGRmMIG3Bggr -BgEFBQcCAjCBqjAUFg1TdGFydENvbSBMdGQuMAMCAQEagZFMaW1pdGVkIExpYWJp -bGl0eSwgc2VlIHNlY3Rpb24gKkxlZ2FsIExpbWl0YXRpb25zKiBvZiB0aGUgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUG9saWN5IGF2YWlsYWJsZSBh -dCBodHRwOi8vd3d3LnN0YXJ0c3NsLmNvbS9wb2xpY3kucGRmMGEGA1UdHwRaMFgw -KqAooCaGJGh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL2NydDEtY3JsLmNybDAqoCig -JoYkaHR0cDovL2NybC5zdGFydHNzbC5jb20vY3J0MS1jcmwuY3JsMIGOBggrBgEF -BQcBAQSBgTB/MDkGCCsGAQUFBzABhi1odHRwOi8vb2NzcC5zdGFydHNzbC5jb20v -c3ViL2NsYXNzMS9zZXJ2ZXIvY2EwQgYIKwYBBQUHMAKGNmh0dHA6Ly93d3cuc3Rh -cnRzc2wuY29tL2NlcnRzL3N1Yi5jbGFzczEuc2VydmVyLmNhLmNydDAjBgNVHRIE -HDAahhhodHRwOi8vd3d3LnN0YXJ0c3NsLmNvbS8wDQYJKoZIhvcNAQEFBQADggEB -ACXj6SB59KRJPenn6gUdGEqcta97U769SATyiQ87i9er64qLwvIGLMa3o2Rcgl2Y -kghUeyLdN/EXyFBYA8L8uvZREPoc7EZukpT/ZDLXy9i2S0jkOxvF2fD/XLbcjGjM -iEYG1/6ASw0ri9C0k4oDDoJLCoeH9++yqF7SFCCMcDkJqiAGXNb4euDpa8vCCtEQ -CSS+ObZbfkreRt3cNCf5LfCXe9OsTnCfc8Cuq81c0oLaG+SmaLUQNBuToq8e9/Zm -+b+/a3RVjxmkV5OCcGVBxsXNDn54Q6wsdw0TBMcjwoEndzpLS7yWgFbbkq5ZiGpw -Qibb2+CfKuQ+WFV1GkVQmVA= ------END CERTIFICATE-----` - -const startComIntermediate = `-----BEGIN CERTIFICATE----- -MIIGNDCCBBygAwIBAgIBGDANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDcxMDI0MjA1NDE3WhcNMTcxMDI0MjA1NDE3WjCB -jDELMAkGA1UEBhMCSUwxFjAUBgNVBAoTDVN0YXJ0Q29tIEx0ZC4xKzApBgNVBAsT -IlNlY3VyZSBEaWdpdGFsIENlcnRpZmljYXRlIFNpZ25pbmcxODA2BgNVBAMTL1N0 -YXJ0Q29tIENsYXNzIDEgUHJpbWFyeSBJbnRlcm1lZGlhdGUgU2VydmVyIENBMIIB -IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtonGrO8JUngHrJJj0PREGBiE -gFYfka7hh/oyULTTRwbw5gdfcA4Q9x3AzhA2NIVaD5Ksg8asWFI/ujjo/OenJOJA -pgh2wJJuniptTT9uYSAK21ne0n1jsz5G/vohURjXzTCm7QduO3CHtPn66+6CPAVv -kvek3AowHpNz/gfK11+AnSJYUq4G2ouHI2mw5CrY6oPSvfNx23BaKA+vWjhwRRI/ -ME3NO68X5Q/LoKldSKqxYVDLNM08XMML6BDAjJvwAwNi/rJsPnIO7hxDKslIDlc5 -xDEhyBDBLIf+VJVSH1I8MRKbf+fAoKVZ1eKPPvDVqOHXcDGpxLPPr21TLwb0pwID -AQABo4IBrTCCAakwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFOtCNNCYsKuf9BtrCPfMZC7vDixFMB8GA1UdIwQYMBaAFE4L7xqkQFul -F2mHMMo0aEPQQa7yMGYGCCsGAQUFBwEBBFowWDAnBggrBgEFBQcwAYYbaHR0cDov -L29jc3Auc3RhcnRzc2wuY29tL2NhMC0GCCsGAQUFBzAChiFodHRwOi8vd3d3LnN0 -YXJ0c3NsLmNvbS9zZnNjYS5jcnQwWwYDVR0fBFQwUjAnoCWgI4YhaHR0cDovL3d3 -dy5zdGFydHNzbC5jb20vc2ZzY2EuY3JsMCegJaAjhiFodHRwOi8vY3JsLnN0YXJ0 -c3NsLmNvbS9zZnNjYS5jcmwwgYAGA1UdIAR5MHcwdQYLKwYBBAGBtTcBAgEwZjAu -BggrBgEFBQcCARYiaHR0cDovL3d3dy5zdGFydHNzbC5jb20vcG9saWN5LnBkZjA0 -BggrBgEFBQcCARYoaHR0cDovL3d3dy5zdGFydHNzbC5jb20vaW50ZXJtZWRpYXRl -LnBkZjANBgkqhkiG9w0BAQUFAAOCAgEAIQlJPqWIbuALi0jaMU2P91ZXouHTYlfp -tVbzhUV1O+VQHwSL5qBaPucAroXQ+/8gA2TLrQLhxpFy+KNN1t7ozD+hiqLjfDen -xk+PNdb01m4Ge90h2c9W/8swIkn+iQTzheWq8ecf6HWQTd35RvdCNPdFWAwRDYSw -xtpdPvkBnufh2lWVvnQce/xNFE+sflVHfXv0pQ1JHpXo9xLBzP92piVH0PN1Nb6X -t1gW66pceG/sUzCv6gRNzKkC4/C2BBL2MLERPZBOVmTX3DxDX3M570uvh+v2/miI -RHLq0gfGabDBoYvvF0nXYbFFSF87ICHpW7LM9NfpMfULFWE7epTj69m8f5SuauNi -YpaoZHy4h/OZMn6SolK+u/hlz8nyMPyLwcKmltdfieFcNID1j0cHL7SRv7Gifl9L -WtBbnySGBVFaaQNlQ0lxxeBvlDRr9hvYqbBMflPrj0jfyjO1SPo2ShpTpjMM0InN -SRXNiTE8kMBy12VLUjWKRhFEuT2OKGWmPnmeXAhEKa2wNREuIU640ucQPl2Eg7PD -wuTSxv0JS3QJ3fGz0xk+gA2iCxnwOOfFwq/iI9th4p1cbiCJSS4jarJiwUW0n6+L -p/EiO/h94pDQehn7Skzj0n1fSoMD7SfWI55rjbRZotnvbIIp3XUZPD9MEI3vu3Un -0q6Dp6jOW6c= ------END CERTIFICATE-----` - -const startComRoot = `-----BEGIN CERTIFICATE----- -MIIHyTCCBbGgAwIBAgIBATANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM2WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICUjCCAk4wDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAa4wHQYDVR0OBBYE -FE4L7xqkQFulF2mHMMo0aEPQQa7yMGQGA1UdHwRdMFswLKAqoCiGJmh0dHA6Ly9j -ZXJ0LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMCugKaAnhiVodHRwOi8vY3Js -LnN0YXJ0Y29tLm9yZy9zZnNjYS1jcmwuY3JsMIIBXQYDVR0gBIIBVDCCAVAwggFM -BgsrBgEEAYG1NwEBATCCATswLwYIKwYBBQUHAgEWI2h0dHA6Ly9jZXJ0LnN0YXJ0 -Y29tLm9yZy9wb2xpY3kucGRmMDUGCCsGAQUFBwIBFilodHRwOi8vY2VydC5zdGFy -dGNvbS5vcmcvaW50ZXJtZWRpYXRlLnBkZjCB0AYIKwYBBQUHAgIwgcMwJxYgU3Rh -cnQgQ29tbWVyY2lhbCAoU3RhcnRDb20pIEx0ZC4wAwIBARqBl0xpbWl0ZWQgTGlh -YmlsaXR5LCByZWFkIHRoZSBzZWN0aW9uICpMZWdhbCBMaW1pdGF0aW9ucyogb2Yg -dGhlIFN0YXJ0Q29tIENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFBvbGljeSBhdmFp -bGFibGUgYXQgaHR0cDovL2NlcnQuc3RhcnRjb20ub3JnL3BvbGljeS5wZGYwEQYJ -YIZIAYb4QgEBBAQDAgAHMDgGCWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNT -TCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTANBgkqhkiG9w0BAQUFAAOCAgEAFmyZ -9GYMNPXQhV59CuzaEE44HF7fpiUFS5Eyweg78T3dRAlbB0mKKctmArexmvclmAk8 -jhvh3TaHK0u7aNM5Zj2gJsfyOZEdUauCe37Vzlrk4gNXcGmXCPleWKYK34wGmkUW -FjgKXlf2Ysd6AgXmvB618p70qSmD+LIU424oh0TDkBreOKk8rENNZEXO3SipXPJz -ewT4F+irsfMuXGRuczE6Eri8sxHkfY+BUZo7jYn0TZNmezwD7dOaHZrzZVD1oNB1 -ny+v8OqCQ5j4aZyJecRDjkZy42Q2Eq/3JR44iZB3fsNrarnDy0RLrHiQi+fHLB5L -EUTINFInzQpdn4XBidUaePKVEFMy3YCEZnXZtWgo+2EuvoSoOMCZEoalHmdkrQYu -L6lwhceWD3yJZfWOQ1QOq92lgDmUYMA0yZZwLKMS9R9Ie70cfmu3nZD0Ijuu+Pwq -yvqCUqDvr0tVk+vBtfAii6w0TiYiBKGHLHVKt+V9E9e4DGTANtLJL4YSjCMJwRuC -O3NJo2pXh5Tl1njFmUNj403gdy3hZZlyaQQaRwnmDwFWJPsfvw55qVguucQJAX6V -um0ABj6y6koQOdjQK/W/7HW/lwLFCRsI3FU34oH7N4RDYiDK51ZLZer+bMEkkySh -NOsF/5oirpt9P/FlUQqmMGqz9IgcgA38corog14= ------END CERTIFICATE-----` - -const startComRootSHA256 = `-----BEGIN CERTIFICATE----- -MIIHhzCCBW+gAwIBAgIBLTANBgkqhkiG9w0BAQsFADB9MQswCQYDVQQGEwJJTDEW -MBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0YWwg -Q2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3RhcnRDb20gQ2VydGlmaWNh -dGlvbiBBdXRob3JpdHkwHhcNMDYwOTE3MTk0NjM3WhcNMzYwOTE3MTk0NjM2WjB9 -MQswCQYDVQQGEwJJTDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMi -U2VjdXJlIERpZ2l0YWwgQ2VydGlmaWNhdGUgU2lnbmluZzEpMCcGA1UEAxMgU3Rh -cnRDb20gQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUA -A4ICDwAwggIKAoICAQDBiNsJvGxGfHiflXu1M5DycmLWwTYgIiRezul38kMKogZk -pMyONvg45iPwbm2xPN1yo4UcodM9tDMr0y+v/uqwQVlntsQGfQqedIXWeUyAN3rf -OQVSWff0G0ZDpNKFhdLDcfN1YjS6LIp/Ho/u7TTQEceWzVI9ujPW3U3eCztKS5/C -Ji/6tRYccjV3yjxd5srhJosaNnZcAdt0FCX+7bWgiA/deMotHweXMAEtcnn6RtYT -Kqi5pquDSR3l8u/d5AGOGAqPY1MWhWKpDhk6zLVmpsJrdAfkK+F2PrRt2PZE4XNi -HzvEvqBTViVsUQn3qqvKv3b9bZvzndu/PWa8DFaqr5hIlTpL36dYUNk4dalb6kMM -Av+Z6+hsTXBbKWWc3apdzK8BMewM69KN6Oqce+Zu9ydmDBpI125C4z/eIT574Q1w -+2OqqGwaVLRcJXrJosmLFqa7LH4XXgVNWG4SHQHuEhANxjJ/GP/89PrNbpHoNkm+ -Gkhpi8KWTRoSsmkXwQqQ1vp5Iki/untp+HDH+no32NgN0nZPV/+Qt+OR0t3vwmC3 -Zzrd/qqc8NSLf3Iizsafl7b4r4qgEKjZ+xjGtrVcUjyJthkqcwEKDwOzEmDyei+B -26Nu/yYwl/WL3YlXtq09s68rxbd2AvCl1iuahhQqcvbjM4xdCUsT37uMdBNSSwID -AQABo4ICEDCCAgwwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD -VR0OBBYEFE4L7xqkQFulF2mHMMo0aEPQQa7yMB8GA1UdIwQYMBaAFE4L7xqkQFul -F2mHMMo0aEPQQa7yMIIBWgYDVR0gBIIBUTCCAU0wggFJBgsrBgEEAYG1NwEBATCC -ATgwLgYIKwYBBQUHAgEWImh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL3BvbGljeS5w -ZGYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cuc3RhcnRzc2wuY29tL2ludGVybWVk -aWF0ZS5wZGYwgc8GCCsGAQUFBwICMIHCMCcWIFN0YXJ0IENvbW1lcmNpYWwgKFN0 -YXJ0Q29tKSBMdGQuMAMCAQEagZZMaW1pdGVkIExpYWJpbGl0eSwgcmVhZCB0aGUg -c2VjdGlvbiAqTGVnYWwgTGltaXRhdGlvbnMqIG9mIHRoZSBTdGFydENvbSBDZXJ0 -aWZpY2F0aW9uIEF1dGhvcml0eSBQb2xpY3kgYXZhaWxhYmxlIGF0IGh0dHA6Ly93 -d3cuc3RhcnRzc2wuY29tL3BvbGljeS5wZGYwEQYJYIZIAYb4QgEBBAQDAgAHMDgG -CWCGSAGG+EIBDQQrFilTdGFydENvbSBGcmVlIFNTTCBDZXJ0aWZpY2F0aW9uIEF1 -dGhvcml0eTANBgkqhkiG9w0BAQsFAAOCAgEAjo/n3JR5fPGFf59Jb2vKXfuM/gTF -wWLRfUKKvFO3lANmMD+x5wqnUCBVJX92ehQN6wQOQOY+2IirByeDqXWmN3PH/UvS -Ta0XQMhGvjt/UfzDtgUx3M2FIk5xt/JxXrAaxrqTi3iSSoX4eA+D/i+tLPfkpLst -0OcNOrg+zvZ49q5HJMqjNTbOx8aHmNrs++myziebiMMEofYLWWivydsQD032ZGNc -pRJvkrKTlMeIFw6Ttn5ii5B/q06f/ON1FE8qMt9bDeD1e5MNq6HPh+GlBEXoPBKl -CcWw0bdT82AUuoVpaiF8H3VhFyAXe2w7QSlc4axa0c2Mm+tgHRns9+Ww2vl5GKVF -P0lDV9LdJNUso/2RjSe15esUBppMeyG7Oq0wBhjA2MFrLH9ZXF2RsXAiV+uKa0hK -1Q8p7MZAwC+ITGgBF3f0JBlPvfrhsiAhS90a2Cl9qrjeVOwhVYBsHvUwyKMQ5bLm -KhQxw4UtjJixhlpPiVktucf3HMiKf8CdBUrmQk9io20ppB+Fq9vlgcitKj1MXVuE -JnHEhV5xJMqlG2zYYdMa4FTbzrqpMrUi9nNBCV24F10OD5mQ1kfabwo6YigUZ4LZ -8dCAWZvLMdibD4x3TrVoivJs9iQOLWxwxXPR3hTQcY+203sC9uO41Alua551hDnm -fyWl8kgAwKQB2j8= ------END CERTIFICATE-----` - -const smimeLeaf = `-----BEGIN CERTIFICATE----- -MIIFBjCCA+6gAwIBAgISESFvrjT8XcJTEe6rBlPptILlMA0GCSqGSIb3DQEBBQUA -MFQxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSowKAYD -VQQDEyFHbG9iYWxTaWduIFBlcnNvbmFsU2lnbiAyIENBIC0gRzIwHhcNMTIwMTIz -MTYzNjU5WhcNMTUwMTIzMTYzNjU5WjCBlDELMAkGA1UEBhMCVVMxFjAUBgNVBAgT -DU5ldyBIYW1zcGhpcmUxEzARBgNVBAcTClBvcnRzbW91dGgxGTAXBgNVBAoTEEds -b2JhbFNpZ24sIEluYy4xEzARBgNVBAMTClJ5YW4gSHVyc3QxKDAmBgkqhkiG9w0B -CQEWGXJ5YW4uaHVyc3RAZ2xvYmFsc2lnbi5jb20wggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQC4ASSTvavmsFQAob60ukSSwOAL9nT/s99ltNUCAf5fPH5j -NceMKxaQse2miOmRRIXaykcq1p/TbI70Ztce38r2mbOwqDHHPVi13GxJEyUXWgaR -BteDMu5OGyWNG1kchVsGWpbstT0Z4v0md5m1BYFnxB20ebJyOR2lXDxsFK28nnKV -+5eMj76U8BpPQ4SCH7yTMG6y0XXsB3cCrBKr2o3TOYgEKv+oNnbaoMt3UxMt9nSf -9jyIshjqfnT5Aew3CUNMatO55g5FXXdIukAweg1YSb1ls05qW3sW00T3d7dQs9/7 -NuxCg/A2elmVJSoy8+MLR8JSFEf/aMgjO/TyLg/jAgMBAAGjggGPMIIBizAOBgNV -HQ8BAf8EBAMCBaAwTQYDVR0gBEYwRDBCBgorBgEEAaAyASgKMDQwMgYIKwYBBQUH -AgEWJmh0dHBzOi8vd3d3Lmdsb2JhbHNpZ24uY29tL3JlcG9zaXRvcnkvMCQGA1Ud -EQQdMBuBGXJ5YW4uaHVyc3RAZ2xvYmFsc2lnbi5jb20wCQYDVR0TBAIwADAdBgNV -HSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwQwQwYDVR0fBDwwOjA4oDagNIYyaHR0 -cDovL2NybC5nbG9iYWxzaWduLmNvbS9ncy9nc3BlcnNvbmFsc2lnbjJnMi5jcmww -VQYIKwYBBQUHAQEESTBHMEUGCCsGAQUFBzAChjlodHRwOi8vc2VjdXJlLmdsb2Jh -bHNpZ24uY29tL2NhY2VydC9nc3BlcnNvbmFsc2lnbjJnMi5jcnQwHQYDVR0OBBYE -FFWiECe0/L72eVYqcWYnLV6SSjzhMB8GA1UdIwQYMBaAFD8V0m18L+cxnkMKBqiU -bCw7xe5lMA0GCSqGSIb3DQEBBQUAA4IBAQAhQi6hLPeudmf3IBF4IDzCvRI0FaYd -BKfprSk/H0PDea4vpsLbWpA0t0SaijiJYtxKjlM4bPd+2chb7ejatDdyrZIzmDVy -q4c30/xMninGKokpYA11/Ve+i2dvjulu65qasrtQRGybAuuZ67lrp/K3OMFgjV5N -C3AHYLzvNU4Dwc4QQ1BaMOg6KzYSrKbABRZajfrpC9uiePsv7mDIXLx/toBPxWNl -a5vJm5DrZdn7uHdvBCE6kMykbOLN5pmEK0UIlwKh6Qi5XD0pzlVkEZliFkBMJgub -d/eF7xeg7TKPWC5xyOFp9SdMolJM7LTC3wnSO3frBAev+q/nGs9Xxyvs ------END CERTIFICATE-----` - -const smimeIntermediate = `-----BEGIN CERTIFICATE----- -MIIEFjCCAv6gAwIBAgILBAAAAAABL07hL1IwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw0xMTA0MTMxMDAw -MDBaFw0xOTA0MTMxMDAwMDBaMFQxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMSowKAYDVQQDEyFHbG9iYWxTaWduIFBlcnNvbmFsU2lnbiAy -IENBIC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDBa0H5Nez4 -En3dIlFpX7e5E0YndxQ74xOBbz7kdBd+DLX0LOQMjVPU3DAgKL9ujhH+ZhHkURbH -3X/94TQSUL/z2JjsaQvS0NqyZXHhM5eeuquzOJRzEQ8+odETzHg2G0Erv7yjSeww -gkwDWDJnYUDlOjYTDUEG6+i+8Mn425reo4I0E277wD542kmVWeW7+oHv5dZo9e1Q -yWwiKTEP6BEQVVSBgThXMG4traSSDRUt3T1eQTZx5EObpiBEBO4OTqiBTJfg4vEI -YgkXzKLpnfszTB6YMDpR9/QS6p3ANB3kfAb+t6udSO3WCst0DGrwHDLBFGDR4UeY -T5KGGnI7cWL7AgMBAAGjgeUwgeIwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQI -MAYBAf8CAQAwHQYDVR0OBBYEFD8V0m18L+cxnkMKBqiUbCw7xe5lMEcGA1UdIARA -MD4wPAYEVR0gADA0MDIGCCsGAQUFBwIBFiZodHRwczovL3d3dy5nbG9iYWxzaWdu -LmNvbS9yZXBvc2l0b3J5LzAzBgNVHR8ELDAqMCigJqAkhiJodHRwOi8vY3JsLmds -b2JhbHNpZ24ubmV0L3Jvb3QuY3JsMB8GA1UdIwQYMBaAFGB7ZhpFDZfKiVAvfQTN -NKj//P1LMA0GCSqGSIb3DQEBBQUAA4IBAQBDc3nMpMxJMQMcYUCB3+C73UpvwDE8 -eCOr7t2F/uaQKKcyqqstqLZc6vPwI/rcE9oDHugY5QEjQzIBIEaTnN6P0vege2IX -eCOr7t2F/uaQKKcyqqstqLZc6vPwI/rcE9oDHugY5QEjQzIBIEaTnN6P0vege2IX -YEvTWbWwGdPytDFPYIl3/6OqNSXSnZ7DxPcdLJq2uyiga8PB/TTIIHYkdM2+1DE0 -7y3rH/7TjwDVD7SLu5/SdOfKskuMPTjOEvz3K161mymW06klVhubCIWOro/Gx1Q2 -2FQOZ7/2k4uYoOdBTSlb8kTAuzZNgIE0rB2BIYCTz/P6zZIKW0ogbRSH ------END CERTIFICATE-----` - -var megaLeaf = `-----BEGIN CERTIFICATE----- -MIIFOjCCBCKgAwIBAgIQWYE8Dup170kZ+k11Lg51OjANBgkqhkiG9w0BAQUFADBy -MQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD -VQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01PRE8gQ0EgTGltaXRlZDEYMBYGA1UE -AxMPRXNzZW50aWFsU1NMIENBMB4XDTEyMTIxNDAwMDAwMFoXDTE0MTIxNDIzNTk1 -OVowfzEhMB8GA1UECxMYRG9tYWluIENvbnRyb2wgVmFsaWRhdGVkMS4wLAYDVQQL -EyVIb3N0ZWQgYnkgSW5zdHJhIENvcnBvcmF0aW9uIFB0eS4gTFREMRUwEwYDVQQL -EwxFc3NlbnRpYWxTU0wxEzARBgNVBAMTCm1lZ2EuY28ubnowggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQDcxMCClae8BQIaJHBUIVttlLvhbK4XhXPk3RQ3 -G5XA6tLZMBQ33l3F9knYJ0YErXtr8IdfYoulRQFmKFMJl9GtWyg4cGQi2Rcr5VN5 -S5dA1vu4oyJBxE9fPELcK6Yz1vqaf+n6za+mYTiQYKggVdS8/s8hmNuXP9Zk1pIn -+q0pGsf8NAcSHMJgLqPQrTDw+zae4V03DvcYfNKjuno88d2226ld7MAmQZ7uRNsI -/CnkdelVs+akZsXf0szefSqMJlf08SY32t2jj4Ra7RApVYxOftD9nij/aLfuqOU6 -ow6IgIcIG2ZvXLZwK87c5fxL7UAsTTV+M1sVv8jA33V2oKLhAgMBAAGjggG9MIIB -uTAfBgNVHSMEGDAWgBTay+qtWwhdzP/8JlTOSeVVxjj0+DAdBgNVHQ4EFgQUmP9l -6zhyrZ06Qj4zogt+6LKFk4AwDgYDVR0PAQH/BAQDAgWgMAwGA1UdEwEB/wQCMAAw -NAYDVR0lBC0wKwYIKwYBBQUHAwEGCCsGAQUFBwMCBgorBgEEAYI3CgMDBglghkgB -hvhCBAEwTwYDVR0gBEgwRjA6BgsrBgEEAbIxAQICBzArMCkGCCsGAQUFBwIBFh1o -dHRwczovL3NlY3VyZS5jb21vZG8uY29tL0NQUzAIBgZngQwBAgEwOwYDVR0fBDQw -MjAwoC6gLIYqaHR0cDovL2NybC5jb21vZG9jYS5jb20vRXNzZW50aWFsU1NMQ0Eu -Y3JsMG4GCCsGAQUFBwEBBGIwYDA4BggrBgEFBQcwAoYsaHR0cDovL2NydC5jb21v -ZG9jYS5jb20vRXNzZW50aWFsU1NMQ0FfMi5jcnQwJAYIKwYBBQUHMAGGGGh0dHA6 -Ly9vY3NwLmNvbW9kb2NhLmNvbTAlBgNVHREEHjAcggptZWdhLmNvLm56gg53d3cu -bWVnYS5jby5uejANBgkqhkiG9w0BAQUFAAOCAQEAcYhrsPSvDuwihMOh0ZmRpbOE -Gw6LqKgLNTmaYUPQhzi2cyIjhUhNvugXQQlP5f0lp5j8cixmArafg1dTn4kQGgD3 -ivtuhBTgKO1VYB/VRoAt6Lmswg3YqyiS7JiLDZxjoV7KoS5xdiaINfHDUaBBY4ZH -j2BUlPniNBjCqXe/HndUTVUewlxbVps9FyCmH+C4o9DWzdGBzDpCkcmo5nM+cp7q -ZhTIFTvZfo3zGuBoyu8BzuopCJcFRm3cRiXkpI7iOMUIixO1szkJS6WpL1sKdT73 -UXp08U0LBqoqG130FbzEJBBV3ixbvY6BWMHoCWuaoF12KJnC5kHt2RoWAAgMXA== ------END CERTIFICATE-----` - -var comodoIntermediate1 = `-----BEGIN CERTIFICATE----- -MIIFAzCCA+ugAwIBAgIQGLLLuqME8aAPwfLzJkYqSjANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0xOTEyMzEyMzU5NTlaMHIxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVh -dGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9E -TyBDQSBMaW1pdGVkMRgwFgYDVQQDEw9Fc3NlbnRpYWxTU0wgQ0EwggEiMA0GCSqG -SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCt8AiwcsargxIxF3CJhakgEtSYau2A1NHf -5I5ZLdOWIY120j8YC0YZYwvHIPPlC92AGvFaoL0dds23Izp0XmEbdaqb1IX04XiR -0y3hr/yYLgbSeT1awB8hLRyuIVPGOqchfr7tZ291HRqfalsGs2rjsQuqag7nbWzD -ypWMN84hHzWQfdvaGlyoiBSyD8gSIF/F03/o4Tjg27z5H6Gq1huQByH6RSRQXScq -oChBRVt9vKCiL6qbfltTxfEFFld+Edc7tNkBdtzffRDPUanlOPJ7FAB1WfnwWdsX -Pvev5gItpHnBXaIcw5rIp6gLSApqLn8tl2X2xQScRMiZln5+pN0vAgMBAAGjggGD -MIIBfzAfBgNVHSMEGDAWgBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAdBgNVHQ4EFgQU -2svqrVsIXcz//CZUzknlVcY49PgwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQI -MAYBAf8CAQAwIAYDVR0lBBkwFwYKKwYBBAGCNwoDAwYJYIZIAYb4QgQBMD4GA1Ud -IAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21v -ZG8uY29tL0NQUzBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9kb2Nh -LmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDBsBggrBgEFBQcB -AQRgMF4wNgYIKwYBBQUHMAKGKmh0dHA6Ly9jcnQuY29tb2RvY2EuY29tL0NvbW9k -b1VUTlNHQ0NBLmNydDAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuY29tb2RvY2Eu -Y29tMA0GCSqGSIb3DQEBBQUAA4IBAQAtlzR6QDLqcJcvgTtLeRJ3rvuq1xqo2l/z -odueTZbLN3qo6u6bldudu+Ennv1F7Q5Slqz0J790qpL0pcRDAB8OtXj5isWMcL2a -ejGjKdBZa0wztSz4iw+SY1dWrCRnilsvKcKxudokxeRiDn55w/65g+onO7wdQ7Vu -F6r7yJiIatnyfKH2cboZT7g440LX8NqxwCPf3dfxp+0Jj1agq8MLy6SSgIGSH6lv -+Wwz3D5XxqfyH8wqfOQsTEZf6/Nh9yvENZ+NWPU6g0QO2JOsTGvMd/QDzczc4BxL -XSXaPV7Od4rhPsbXlM1wSTz/Dr0ISKvlUhQVnQ6cGodWaK2cCQBk ------END CERTIFICATE-----` - -var comodoRoot = `-----BEGIN CERTIFICATE----- -MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCB -gTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNV -BAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEyMDEwMDAw -MDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEbMBkGA1UECBMSR3Jl -YXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFDT01P -RE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0 -aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3 -UcEbVASY06m/weaKXTuH+7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI -2GqGd0S7WWaXUF601CxwRM/aN5VCaTwwxHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8 -Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV4EajcNxo2f8ESIl33rXp -+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA1KGzqSX+ -DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5O -nKVIrLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW -/zAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6g -PKA6hjhodHRwOi8vY3JsLmNvbW9kb2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9u -QXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOCAQEAPpiem/Yb6dc5t3iuHXIY -SdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CPOGEIqB6BCsAv -IC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/ -RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4 -zJVSk/BwJVmcIGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5dd -BA6+C4OmF4O5MBKgxTMVBbkN+8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IB -ZQ== ------END CERTIFICATE-----` - -var nameConstraintsLeaf = `-----BEGIN CERTIFICATE----- -MIIHMTCCBRmgAwIBAgIIIZaV/3ezOJkwDQYJKoZIhvcNAQEFBQAwgcsxCzAJBgNV -BAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTETMBEGA1UEBxMKQmxhY2tzYnVyZzEj -MCEGA1UECxMaR2xvYmFsIFF1YWxpZmllZCBTZXJ2ZXIgQ0ExPDA6BgNVBAoTM1Zp -cmdpbmlhIFBvbHl0ZWNobmljIEluc3RpdHV0ZSBhbmQgU3RhdGUgVW5pdmVyc2l0 -eTExMC8GA1UEAxMoVmlyZ2luaWEgVGVjaCBHbG9iYWwgUXVhbGlmaWVkIFNlcnZl -ciBDQTAeFw0xMzA5MTkxNDM2NTVaFw0xNTA5MTkxNDM2NTVaMIHNMQswCQYDVQQG -EwJVUzERMA8GA1UECAwIVmlyZ2luaWExEzARBgNVBAcMCkJsYWNrc2J1cmcxPDA6 -BgNVBAoMM1ZpcmdpbmlhIFBvbHl0ZWNobmljIEluc3RpdHV0ZSBhbmQgU3RhdGUg -VW5pdmVyc2l0eTE7MDkGA1UECwwyVGVjaG5vbG9neS1lbmhhbmNlZCBMZWFybmlu -ZyBhbmQgT25saW5lIFN0cmF0ZWdpZXMxGzAZBgNVBAMMEnNlY3VyZS5pZGRsLnZ0 -LmVkdTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKkOyPpsOK/6IuPG -WnIBlVwlHzeYf+cUlggqkLq0b0+vZbiTXgio9/VCuNQ8opSoss7J7o3ygV9to+9Y -YwJKVC5WDT/y5JWpQey0CWILymViJnpNSwnxBc8A+Q8w5NUGDd/UhtPx/U8/hqbd -WPDYj2hbOqyq8UlRhfS5pwtnv6BbCTaY11I6FhCLK7zttISyTuWCf9p9o/ggiipP -ii/5oh4dkl+r5SfuSp5GPNHlYO8lWqys5NAPoDD4fc/kuflcK7Exx7XJ+Oqu0W0/ -psjEY/tES1ZgDWU/ParcxxFpFmKHbD5DXsfPOObzkVWXIY6tGMutSlE1Froy/Nn0 -OZsAOrcCAwEAAaOCAhMwggIPMIG4BggrBgEFBQcBAQSBqzCBqDBYBggrBgEFBQcw -AoZMaHR0cDovL3d3dy5wa2kudnQuZWR1L2dsb2JhbHF1YWxpZmllZHNlcnZlci9j -YWNlcnQvZ2xvYmFscXVhbGlmaWVkc2VydmVyLmNydDBMBggrBgEFBQcwAYZAaHR0 -cDovL3Z0Y2EtcC5lcHJvdi5zZXRpLnZ0LmVkdTo4MDgwL2VqYmNhL3B1YmxpY3dl -Yi9zdGF0dXMvb2NzcDAdBgNVHQ4EFgQUp7xbO6iHkvtZbPE4jmndmnAbSEcwDAYD -VR0TAQH/BAIwADAfBgNVHSMEGDAWgBS8YmAn1eM1SBfpS6tFatDIqHdxjDBqBgNV -HSAEYzBhMA4GDCsGAQQBtGgFAgICATAOBgwrBgEEAbRoBQICAQEwPwYMKwYBBAG0 -aAUCAgMBMC8wLQYIKwYBBQUHAgEWIWh0dHA6Ly93d3cucGtpLnZ0LmVkdS9nbG9i -YWwvY3BzLzBKBgNVHR8EQzBBMD+gPaA7hjlodHRwOi8vd3d3LnBraS52dC5lZHUv -Z2xvYmFscXVhbGlmaWVkc2VydmVyL2NybC9jYWNybC5jcmwwDgYDVR0PAQH/BAQD -AgTwMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAdBgNVHREEFjAUghJz -ZWN1cmUuaWRkbC52dC5lZHUwDQYJKoZIhvcNAQEFBQADggIBAEgoYo4aUtatY3gI -OyyKp7QlIOaLbTJZywESHqy+L5EGDdJW2DJV+mcE0LDGvqa2/1Lo+AR1ntsZwfOi -Y718JwgVVaX/RCd5+QKP25c5/x72xI8hb/L1bgS0ED9b0YAhd7Qm1K1ot82+6mqX -DW6WiGeDr8Z07MQ3143qQe2rBlq+QI69DYzm2GOqAIAnUIWv7tCyLUm31b4DwmrJ -TeudVreTKUbBNB1TWRFHEPkWhjjXKZnNGRO11wHXcyBu6YekIvVZ+vmx8ePee4jJ -3GFOi7lMuWOeq57jTVL7KOKaKLVXBb6gqo5aq+Wwt8RUD5MakrCAEeQZj7DKaFmZ -oQCO0Pxrsl3InCGvxnGzT+bFVO9nJ/BAMj7hknFdm9Jr6Bg5q33Z+gnf909AD9QF -ESqUSykaHu2LVdJx2MaCH1CyKnRgMw5tEwE15EXpUjCm24m8FMOYC+rNtf18pgrz -5D8Jhh+oxK9PjcBYqXNtnioIxiMCYcV0q5d4w4BYFEh71tk7/bYB0R55CsBUVPmp -timWNOdRd57Tfpk3USaVsumWZAf9MP3wPiC7gb4d5tYEEAG5BuDT8ruFw838wU8G -1VvAVutSiYBg7k3NYO7AUqZ+Ax4klQX3aM9lgonmJ78Qt94UPtbptrfZ4/lSqEf8 -GBUwDrQNTb+gsXsDkjd5lcYxNx6l ------END CERTIFICATE-----` - -var nameConstraintsIntermediate1 = `-----BEGIN CERTIFICATE----- -MIINLjCCDBagAwIBAgIRIqpyf/YoGgvHc8HiDAxAI8owDQYJKoZIhvcNAQEFBQAw -XDELMAkGA1UEBhMCQkUxFTATBgNVBAsTDFRydXN0ZWQgUm9vdDEZMBcGA1UEChMQ -R2xvYmFsU2lnbiBudi1zYTEbMBkGA1UEAxMSVHJ1c3RlZCBSb290IENBIEcyMB4X -DTEyMTIxMzAwMDAwMFoXDTE3MTIxMzAwMDAwMFowgcsxCzAJBgNVBAYTAlVTMREw -DwYDVQQIEwhWaXJnaW5pYTETMBEGA1UEBxMKQmxhY2tzYnVyZzEjMCEGA1UECxMa -R2xvYmFsIFF1YWxpZmllZCBTZXJ2ZXIgQ0ExPDA6BgNVBAoTM1ZpcmdpbmlhIFBv -bHl0ZWNobmljIEluc3RpdHV0ZSBhbmQgU3RhdGUgVW5pdmVyc2l0eTExMC8GA1UE -AxMoVmlyZ2luaWEgVGVjaCBHbG9iYWwgUXVhbGlmaWVkIFNlcnZlciBDQTCCAiIw -DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBALgIZhEaptBWADBqdJ45ueFGzMXa -GHnzNxoxR1fQIaaRQNdCg4cw3A4dWKMeEgYLtsp65ai3Xfw62Qaus0+KJ3RhgV+r -ihqK81NUzkls78fJlADVDI4fCTlothsrE1CTOMiy97jKHai5mVTiWxmcxpmjv7fm -5Nhc+uHgh2hIz6npryq495mD51ZrUTIaqAQN6Pw/VHfAmR524vgriTOjtp1t4lA9 -pXGWjF/vkhAKFFheOQSQ00rngo2wHgCqMla64UTN0oz70AsCYNZ3jDLx0kOP0YmM -R3Ih91VA63kLqPXA0R6yxmmhhxLZ5bcyAy1SLjr1N302MIxLM/pSy6aquEnbELhz -qyp9yGgRyGJay96QH7c4RJY6gtcoPDbldDcHI9nXngdAL4DrZkJ9OkDkJLyqG66W -ZTF5q4EIs6yMdrywz0x7QP+OXPJrjYpbeFs6tGZCFnWPFfmHCRJF8/unofYrheq+ -9J7Jx3U55S/k57NXbAM1RAJOuMTlfn9Etf9Dpoac9poI4Liav6rBoUQk3N3JWqnV -HNx/NdCyJ1/6UbKMJUZsStAVglsi6lVPo289HHOE4f7iwl3SyekizVOp01wUin3y -cnbZB/rXmZbwapSxTTSBf0EIOr9i4EGfnnhCAVA9U5uLrI5OEB69IY8PNX0071s3 -Z2a2fio5c8m3JkdrAgMBAAGjggh5MIIIdTAOBgNVHQ8BAf8EBAMCAQYwTAYDVR0g -BEUwQzBBBgkrBgEEAaAyATwwNDAyBggrBgEFBQcCARYmaHR0cHM6Ly93d3cuZ2xv -YmFsc2lnbi5jb20vcmVwb3NpdG9yeS8wEgYDVR0TAQH/BAgwBgEB/wIBADCCBtAG -A1UdHgSCBscwggbDoIIGvzASghAzZGJsYWNrc2J1cmcub3JnMBiCFmFjY2VsZXJh -dGV2aXJnaW5pYS5jb20wGIIWYWNjZWxlcmF0ZXZpcmdpbmlhLm9yZzALgglhY3Zj -cC5vcmcwCYIHYmV2Lm5ldDAJggdiZXYub3JnMAuCCWNsaWdzLm9yZzAMggpjbWl3 -ZWIub3JnMBeCFWVhc3Rlcm5icm9va3Ryb3V0Lm5ldDAXghVlYXN0ZXJuYnJvb2t0 -cm91dC5vcmcwEYIPZWNvcnJpZG9ycy5pbmZvMBOCEWVkZ2FycmVzZWFyY2gub3Jn -MBKCEGdldC1lZHVjYXRlZC5jb20wE4IRZ2V0LWVkdWNhdGVkLmluZm8wEYIPZ2V0 -ZWR1Y2F0ZWQubmV0MBKCEGdldC1lZHVjYXRlZC5uZXQwEYIPZ2V0ZWR1Y2F0ZWQu -b3JnMBKCEGdldC1lZHVjYXRlZC5vcmcwD4INaG9raWVjbHViLmNvbTAQgg5ob2tp -ZXBob3RvLmNvbTAPgg1ob2tpZXNob3AuY29tMBGCD2hva2llc3BvcnRzLmNvbTAS -ghBob2tpZXRpY2tldHMuY29tMBKCEGhvdGVscm9hbm9rZS5jb20wE4IRaHVtYW53 -aWxkbGlmZS5vcmcwF4IVaW5uYXR2aXJnaW5pYXRlY2guY29tMA+CDWlzY2hwMjAx -MS5vcmcwD4INbGFuZHJlaGFiLm9yZzAggh5uYXRpb25hbHRpcmVyZXNlYXJjaGNl -bnRlci5jb20wFYITbmV0d29ya3ZpcmdpbmlhLm5ldDAMggpwZHJjdnQuY29tMBiC -FnBldGVkeWVyaXZlcmNvdXJzZS5jb20wDYILcmFkaW9pcS5vcmcwFYITcml2ZXJj -b3Vyc2Vnb2xmLmNvbTALgglzZGltaS5vcmcwEIIOc292YW1vdGlvbi5jb20wHoIc -c3VzdGFpbmFibGUtYmlvbWF0ZXJpYWxzLmNvbTAeghxzdXN0YWluYWJsZS1iaW9t -YXRlcmlhbHMub3JnMBWCE3RoaXNpc3RoZWZ1dHVyZS5jb20wGIIWdGhpcy1pcy10 -aGUtZnV0dXJlLmNvbTAVghN0aGlzaXN0aGVmdXR1cmUubmV0MBiCFnRoaXMtaXMt -dGhlLWZ1dHVyZS5uZXQwCoIIdmFkcy5vcmcwDIIKdmFsZWFmLm9yZzANggt2YXRl -Y2guaW5mbzANggt2YXRlY2gubW9iaTAcghp2YXRlY2hsaWZlbG9uZ2xlYXJuaW5n -LmNvbTAcghp2YXRlY2hsaWZlbG9uZ2xlYXJuaW5nLm5ldDAcghp2YXRlY2hsaWZl -bG9uZ2xlYXJuaW5nLm9yZzAKggh2Y29tLmVkdTASghB2aXJnaW5pYXZpZXcubmV0 -MDSCMnZpcmdpbmlhcG9seXRlY2huaWNpbnN0aXR1dGVhbmRzdGF0ZXVuaXZlcnNp -dHkuY29tMDWCM3ZpcmdpbmlhcG9seXRlY2huaWNpbnN0aXR1dGVhbmRzdGF0ZXVu -aXZlcnNpdHkuaW5mbzA0gjJ2aXJnaW5pYXBvbHl0ZWNobmljaW5zdGl0dXRlYW5k -c3RhdGV1bml2ZXJzaXR5Lm5ldDA0gjJ2aXJnaW5pYXBvbHl0ZWNobmljaW5zdGl0 -dXRlYW5kc3RhdGV1bml2ZXJzaXR5Lm9yZzAZghd2aXJnaW5pYXB1YmxpY3JhZGlv -Lm9yZzASghB2aXJnaW5pYXRlY2guZWR1MBOCEXZpcmdpbmlhdGVjaC5tb2JpMByC -GnZpcmdpbmlhdGVjaGZvdW5kYXRpb24ub3JnMAiCBnZ0LmVkdTALggl2dGFyYy5v -cmcwDIIKdnQtYXJjLm9yZzALggl2dGNyYy5jb20wCoIIdnRpcC5vcmcwDIIKdnRs -ZWFuLm9yZzAWghR2dGtub3dsZWRnZXdvcmtzLmNvbTAYghZ2dGxpZmVsb25nbGVh -cm5pbmcuY29tMBiCFnZ0bGlmZWxvbmdsZWFybmluZy5uZXQwGIIWdnRsaWZlbG9u -Z2xlYXJuaW5nLm9yZzATghF2dHNwb3J0c21lZGlhLmNvbTALggl2dHdlaS5jb20w -D4INd2l3YXR3ZXJjLmNvbTAKggh3dnRmLm9yZzAIgQZ2dC5lZHUwd6R1MHMxCzAJ -BgNVBAYTAlVTMREwDwYDVQQIEwhWaXJnaW5pYTETMBEGA1UEBxMKQmxhY2tzYnVy -ZzE8MDoGA1UEChMzVmlyZ2luaWEgUG9seXRlY2huaWMgSW5zdGl0dXRlIGFuZCBT -dGF0ZSBVbml2ZXJzaXR5MCcGA1UdJQQgMB4GCCsGAQUFBwMCBggrBgEFBQcDAQYI -KwYBBQUHAwkwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2NybC5nbG9iYWxzaWdu -LmNvbS9ncy90cnVzdHJvb3RnMi5jcmwwgYQGCCsGAQUFBwEBBHgwdjAzBggrBgEF -BQcwAYYnaHR0cDovL29jc3AyLmdsb2JhbHNpZ24uY29tL3RydXN0cm9vdGcyMD8G -CCsGAQUFBzAChjNodHRwOi8vc2VjdXJlLmdsb2JhbHNpZ24uY29tL2NhY2VydC90 -cnVzdHJvb3RnMi5jcnQwHQYDVR0OBBYEFLxiYCfV4zVIF+lLq0Vq0Miod3GMMB8G -A1UdIwQYMBaAFBT25YsxtkWASkxt/MKHico2w5BiMA0GCSqGSIb3DQEBBQUAA4IB -AQAyJm/lOB2Er4tHXhc/+fSufSzgjohJgYfMkvG4LknkvnZ1BjliefR8tTXX49d2 -SCDFWfGjqyJZwavavkl/4p3oXPG/nAMDMvxh4YAT+CfEK9HH+6ICV087kD4BLegi -+aFJMj8MMdReWCzn5sLnSR1rdse2mo2arX3Uod14SW+PGrbUmTuWNyvRbz3fVmxp -UdbGmj3laknO9YPsBGgHfv73pVVsTJkW4ZfY/7KdD/yaVv6ophpOB3coXfjl2+kd -Z4ypn2zK+cx9IL/LSewqd/7W9cD55PCUy4X9OTbEmAccwiz3LB66mQoUGfdHdkoB -jUY+v9vLQXmaVwI0AYL7g9LN ------END CERTIFICATE-----` - -var nameConstraintsIntermediate2 = `-----BEGIN CERTIFICATE----- -MIIEXTCCA0WgAwIBAgILBAAAAAABNuk6OrMwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw0xMjA0MjUxMTAw -MDBaFw0yNzA0MjUxMTAwMDBaMFwxCzAJBgNVBAYTAkJFMRUwEwYDVQQLEwxUcnVz -dGVkIFJvb3QxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExGzAZBgNVBAMTElRy -dXN0ZWQgUm9vdCBDQSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB -AKyuvqrtcMr7g7EuNbu4sKwxM127UsCmx1RxbxxgcArGS7rjiefpBH/w4LYrymjf -vcw1ueyMNoqLo9nJMz/ORXupb35NNfE667prQYHa+tTjl1IiKpB7QUwt3wXPuTMF -Ja1tXtjKzkqJyuJlNuPKT76HcjgNqgV1s9qG44MD5I2JvI12du8zI1bgdQ+l/KsX -kTfbGjUvhOLOlVNWVQDpL+YMIrGqgBYxy5TUNgrAcRtwpNdS2KkF5otSmMweVb5k -hoUVv3u8UxQH/WWbNhHq1RrIlg/0rBUfi/ziShYFSB7U+aLx5DxPphTFBiDquQGp -tB+FC4JvnukDStFihZCZ1R8CAwEAAaOCASMwggEfMA4GA1UdDwEB/wQEAwIBBjAP -BgNVHRMBAf8EBTADAQH/MEcGA1UdIARAMD4wPAYEVR0gADA0MDIGCCsGAQUFBwIB -FiZodHRwczovL3d3dy5nbG9iYWxzaWduLmNvbS9yZXBvc2l0b3J5LzAdBgNVHQ4E -FgQUFPblizG2RYBKTG38woeJyjbDkGIwMwYDVR0fBCwwKjAooCagJIYiaHR0cDov -L2NybC5nbG9iYWxzaWduLm5ldC9yb290LmNybDA+BggrBgEFBQcBAQQyMDAwLgYI -KwYBBQUHMAGGImh0dHA6Ly9vY3NwMi5nbG9iYWxzaWduLmNvbS9yb290cjEwHwYD -VR0jBBgwFoAUYHtmGkUNl8qJUC99BM00qP/8/UswDQYJKoZIhvcNAQEFBQADggEB -AL7IG0l+k4LkcpI+a/kvZsSRwSM4uA6zGX34e78A2oytr8RG8bJwVb8+AHMUD+Xe -2kYdh/Uj/waQXfqR0OgxQXL9Ct4ZM+JlR1avsNKXWL5AwYXAXCOB3J5PW2XOck7H -Zw0vRbGQhjWjQx+B4KOUFg1b3ov/z6Xkr3yaCfRQhXh7KC0Bc0RXPPG5Nv5lCW+z -tbbg0zMm3kyfQITRusMSg6IBsDJqOnjaiaKQRcXiD0Sk43ZXb2bUKMxC7+Td3QL4 -RyHcWJbQ7YylLTS/x+jxWIcOQ0oO5/54t5PTQ14neYhOz9x4gUk2AYAW6d1vePwb -hcC8roQwkHT7HvfYBoc74FM= ------END CERTIFICATE-----` - -var globalSignRoot = `-----BEGIN CERTIFICATE----- -MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG -A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv -b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw -MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i -YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT -aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ -jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp -xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp -1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG -snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ -U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8 -9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E -BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B -AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz -yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE -38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP -AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad -DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME -HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A== ------END CERTIFICATE-----` - -var moipLeafCert = `-----BEGIN CERTIFICATE----- -MIIGQDCCBSigAwIBAgIRAPe/cwh7CUWizo8mYSDavLIwDQYJKoZIhvcNAQELBQAw -gZIxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO -BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTgwNgYD -VQQDEy9DT01PRE8gUlNBIEV4dGVuZGVkIFZhbGlkYXRpb24gU2VjdXJlIFNlcnZl -ciBDQTAeFw0xMzA4MTUwMDAwMDBaFw0xNDA4MTUyMzU5NTlaMIIBQjEXMBUGA1UE -BRMOMDg3MTg0MzEwMDAxMDgxEzARBgsrBgEEAYI3PAIBAxMCQlIxGjAYBgsrBgEE -AYI3PAIBAhMJU2FvIFBhdWxvMR0wGwYDVQQPExRQcml2YXRlIE9yZ2FuaXphdGlv -bjELMAkGA1UEBhMCQlIxETAPBgNVBBETCDAxNDUyMDAwMRIwEAYDVQQIEwlTYW8g -UGF1bG8xEjAQBgNVBAcTCVNhbyBQYXVsbzEtMCsGA1UECRMkQXZlbmlkYSBCcmln -YWRlaXJvIEZhcmlhIExpbWEgLCAyOTI3MR0wGwYDVQQKExRNb2lwIFBhZ2FtZW50 -b3MgUy5BLjENMAsGA1UECxMETU9JUDEYMBYGA1UECxMPU1NMIEJsaW5kYWRvIEVW -MRgwFgYDVQQDEw9hcGkubW9pcC5jb20uYnIwggEiMA0GCSqGSIb3DQEBAQUAA4IB -DwAwggEKAoIBAQDN0b9x6TrXXA9hPCF8/NjqGJ++2D4LO4ZiMFTjs0VwpXy2Y1Oe -s74/HuiLGnAHxTmAtV7IpZMibiOcTxcnDYp9oEWkf+gR+hZvwFZwyOBC7wyb3SR3 -UvV0N1ZbEVRYpN9kuX/3vjDghjDmzzBwu8a/T+y5JTym5uiJlngVAWyh/RjtIvYi -+NVkQMbyVlPGkoCe6c30pH8DKYuUCZU6DHjUsPTX3jAskqbhDSAnclX9iX0p2bmw -KVBc+5Vh/2geyzDuquF0w+mNIYdU5h7uXvlmJnf3d2Cext5dxdL8/jezD3U0dAqI -pYSKERbyxSkJWxdvRlhdpM9YXMJcpc88xNp1AgMBAAGjggHcMIIB2DAfBgNVHSME -GDAWgBQ52v/KKBSKqHQTCLnkDqnS+n6daTAdBgNVHQ4EFgQU/lXuOa7DMExzZjRj -LQWcMWGZY7swDgYDVR0PAQH/BAQDAgWgMAwGA1UdEwEB/wQCMAAwHQYDVR0lBBYw -FAYIKwYBBQUHAwEGCCsGAQUFBwMCMEYGA1UdIAQ/MD0wOwYMKwYBBAGyMQECAQUB -MCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vc2VjdXJlLmNvbW9kby5jb20vQ1BTMFYG -A1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwuY29tb2RvY2EuY29tL0NPTU9ET1JT -QUV4dGVuZGVkVmFsaWRhdGlvblNlY3VyZVNlcnZlckNBLmNybDCBhwYIKwYBBQUH -AQEEezB5MFEGCCsGAQUFBzAChkVodHRwOi8vY3J0LmNvbW9kb2NhLmNvbS9DT01P -RE9SU0FFeHRlbmRlZFZhbGlkYXRpb25TZWN1cmVTZXJ2ZXJDQS5jcnQwJAYIKwYB -BQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTAvBgNVHREEKDAmgg9hcGku -bW9pcC5jb20uYnKCE3d3dy5hcGkubW9pcC5jb20uYnIwDQYJKoZIhvcNAQELBQAD -ggEBAFoTmPlaDcf+nudhjXHwud8g7/LRyA8ucb+3/vfmgbn7FUc1eprF5sJS1mA+ -pbiTyXw4IxcJq2KUj0Nw3IPOe9k84mzh+XMmdCKH+QK3NWkE9Udz+VpBOBc0dlqC -1RH5umStYDmuZg/8/r652eeQ5kUDcJyADfpKWBgDPYaGtwzKVT4h3Aok9SLXRHx6 -z/gOaMjEDMarMCMw4VUIG1pvNraZrG5oTaALPaIXXpd8VqbQYPudYJ6fR5eY3FeW -H/ofbYFdRcuD26MfBFWE9VGGral9Fgo8sEHffho+UWhgApuQV4/l5fMzxB5YBXyQ -jhuy8PqqZS9OuLilTeLu4a8z2JI= ------END CERTIFICATE-----` - -var comodoIntermediateSHA384 = `-----BEGIN CERTIFICATE----- -MIIGDjCCA/agAwIBAgIQBqdDgNTr/tQ1taP34Wq92DANBgkqhkiG9w0BAQwFADCB -hTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G -A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNV -BAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTIwMjEy -MDAwMDAwWhcNMjcwMjExMjM1OTU5WjCBkjELMAkGA1UEBhMCR0IxGzAZBgNVBAgT -EkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR -Q09NT0RPIENBIExpbWl0ZWQxODA2BgNVBAMTL0NPTU9ETyBSU0EgRXh0ZW5kZWQg -VmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC -AQ8AMIIBCgKCAQEAlVbeVLTf1QJJe9FbXKKyHo+cK2JMK40SKPMalaPGEP0p3uGf -CzhAk9HvbpUQ/OGQF3cs7nU+e2PsYZJuTzurgElr3wDqAwB/L3XVKC/sVmePgIOj -vdwDmZOLlJFWW6G4ajo/Br0OksxgnP214J9mMF/b5pTwlWqvyIqvgNnmiDkBfBzA -xSr3e5Wg8narbZtyOTDr0VdVAZ1YEZ18bYSPSeidCfw8/QpKdhQhXBZzQCMZdMO6 -WAqmli7eNuWf0MLw4eDBYuPCGEUZUaoXHugjddTI0JYT/8ck0YwLJ66eetw6YWNg -iJctXQUL5Tvrrs46R3N2qPos3cCHF+msMJn4HwIDAQABo4IBaTCCAWUwHwYDVR0j -BBgwFoAUu69+Aj36pvE8hI6t7jiY7NkyMtQwHQYDVR0OBBYEFDna/8ooFIqodBMI -ueQOqdL6fp1pMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgEAMD4G -A1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5j -b21vZG8uY29tL0NQUzBMBgNVHR8ERTBDMEGgP6A9hjtodHRwOi8vY3JsLmNvbW9k -b2NhLmNvbS9DT01PRE9SU0FDZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDBxBggr -BgEFBQcBAQRlMGMwOwYIKwYBBQUHMAKGL2h0dHA6Ly9jcnQuY29tb2RvY2EuY29t -L0NPTU9ET1JTQUFkZFRydXN0Q0EuY3J0MCQGCCsGAQUFBzABhhhodHRwOi8vb2Nz -cC5jb21vZG9jYS5jb20wDQYJKoZIhvcNAQEMBQADggIBAERCnUFRK0iIXZebeV4R -AUpSGXtBLMeJPNBy3IX6WK/VJeQT+FhlZ58N/1eLqYVeyqZLsKeyLeCMIs37/3mk -jCuN/gI9JN6pXV/kD0fQ22YlPodHDK4ixVAihNftSlka9pOlk7DgG4HyVsTIEFPk -1Hax0VtpS3ey4E/EhOfUoFDuPPpE/NBXueEoU/1Tzdy5H3pAvTA/2GzS8+cHnx8i -teoiccsq8FZ8/qyo0QYPFBRSTP5kKwxpKrgNUG4+BAe/eiCL+O5lCeHHSQgyPQ0o -fkkdt0rvAucNgBfIXOBhYsvss2B5JdoaZXOcOBCgJjqwyBZ9kzEi7nQLiMBciUEA -KKlHMd99SUWa9eanRRrSjhMQ34Ovmw2tfn6dNVA0BM7pINae253UqNpktNEvWS5e -ojZh1CSggjMziqHRbO9haKPl0latxf1eYusVqHQSTC8xjOnB3xBLAer2VBvNfzu9 -XJ/B288ByvK6YBIhMe2pZLiySVgXbVrXzYxtvp5/4gJYp9vDLVj2dAZqmvZh+fYA -tmnYOosxWd2R5nwnI4fdAw+PKowegwFOAWEMUnNt/AiiuSpm5HZNMaBWm9lTjaK2 -jwLI5jqmBNFI+8NKAnb9L9K8E7bobTQk+p0pisehKxTxlgBzuRPpwLk6R1YCcYAn -pLwltum95OmYdBbxN4SBB7SC ------END CERTIFICATE-----` - -const comodoRSAAuthority = `-----BEGIN CERTIFICATE----- -MIIFdDCCBFygAwIBAgIQJ2buVutJ846r13Ci/ITeIjANBgkqhkiG9w0BAQwFADBv -MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk -ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF -eHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFow -gYUxCzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAO -BgNVBAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMSswKQYD -VQQDEyJDT01PRE8gUlNBIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkq -hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAkehUktIKVrGsDSTdxc9EZ3SZKzejfSNw -AHG8U9/E+ioSj0t/EFa9n3Byt2F/yUsPF6c947AEYe7/EZfH9IY+Cvo+XPmT5jR6 -2RRr55yzhaCCenavcZDX7P0N+pxs+t+wgvQUfvm+xKYvT3+Zf7X8Z0NyvQwA1onr -ayzT7Y+YHBSrfuXjbvzYqOSSJNpDa2K4Vf3qwbxstovzDo2a5JtsaZn4eEgwRdWt -4Q08RWD8MpZRJ7xnw8outmvqRsfHIKCxH2XeSAi6pE6p8oNGN4Tr6MyBSENnTnIq -m1y9TBsoilwie7SrmNnu4FGDwwlGTm0+mfqVF9p8M1dBPI1R7Qu2XK8sYxrfV8g/ -vOldxJuvRZnio1oktLqpVj3Pb6r/SVi+8Kj/9Lit6Tf7urj0Czr56ENCHonYhMsT -8dm74YlguIwoVqwUHZwK53Hrzw7dPamWoUi9PPevtQ0iTMARgexWO/bTouJbt7IE -IlKVgJNp6I5MZfGRAy1wdALqi2cVKWlSArvX31BqVUa/oKMoYX9w0MOiqiwhqkfO -KJwGRXa/ghgntNWutMtQ5mv0TIZxMOmm3xaG4Nj/QN370EKIf6MzOi5cHkERgWPO -GHFrK+ymircxXDpqR+DDeVnWIBqv8mqYqnK8V0rSS527EPywTEHl7R09XiidnMy/ -s1Hap0flhFMCAwEAAaOB9DCB8TAfBgNVHSMEGDAWgBStvZh6NLQm9/rEJlTvA73g -JMtUGjAdBgNVHQ4EFgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQD -AgGGMA8GA1UdEwEB/wQFMAMBAf8wEQYDVR0gBAowCDAGBgRVHSAAMEQGA1UdHwQ9 -MDswOaA3oDWGM2h0dHA6Ly9jcmwudXNlcnRydXN0LmNvbS9BZGRUcnVzdEV4dGVy -bmFsQ0FSb290LmNybDA1BggrBgEFBQcBAQQpMCcwJQYIKwYBBQUHMAGGGWh0dHA6 -Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggEBAGS/g/FfmoXQ -zbihKVcN6Fr30ek+8nYEbvFScLsePP9NDXRqzIGCJdPDoCpdTPW6i6FtxFQJdcfj -Jw5dhHk3QBN39bSsHNA7qxcS1u80GH4r6XnTq1dFDK8o+tDb5VCViLvfhVdpfZLY -Uspzgb8c8+a4bmYRBbMelC1/kZWSWfFMzqORcUx8Rww7Cxn2obFshj5cqsQugsv5 -B5a6SE2Q8pTIqXOi6wZ7I53eovNNVZ96YUWYGGjHXkBrI/V5eu+MtWuLt29G9Hvx -PUsE2JOAWVrgQSQdso8VYFhH2+9uRv0V9dlfmrPb2LjkQLPNlzmuhbsdjrzch5vR -pu/xO28QOG8= ------END CERTIFICATE-----` - -const addTrustRoot = `-----BEGIN CERTIFICATE----- -MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEU -MBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFs -IFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290 -MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFowbzELMAkGA1UEBhMCU0Ux -FDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRUcnVzdCBFeHRlcm5h -bCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0EgUm9v -dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvt -H7xsD821+iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9 -uMq/NzgtHj6RQa1wVsfwTz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzX -mk6vBbOmcZSccbNQYArHE504B4YCqOmoaSYYkKtMsE8jqzpPhNjfzp/haW+710LX -a0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy2xSoRcRdKn23tNbE7qzN -E0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv77+ldU9U0 -WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYD -VR0PBAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0 -Jvf6xCZU7wO94CTLVBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRU -cnVzdCBBQjEmMCQGA1UECxMdQWRkVHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsx -IjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENBIFJvb3SCAQEwDQYJKoZIhvcN -AQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZlj7DYd7usQWxH -YINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5 -6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvC -Nr4TDea9Y355e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEX -c4g/VhsxOBi0cQ+azcgOno4uG+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5a -mnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ= ------END CERTIFICATE-----` diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509.go deleted file mode 100644 index be6c013464b40eae1a8e881b4aa51ccf7d71dd41..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509.go +++ /dev/null @@ -1,2028 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package x509 parses X.509-encoded keys and certificates. -package x509 - -import ( - "bytes" - "crypto" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rsa" - _ "crypto/sha1" - _ "crypto/sha256" - _ "crypto/sha512" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/pem" - "errors" - "io" - "math/big" - "net" - "strconv" - "time" -) - -// pkixPublicKey reflects a PKIX public key structure. See SubjectPublicKeyInfo -// in RFC 3280. -type pkixPublicKey struct { - Algo pkix.AlgorithmIdentifier - BitString asn1.BitString -} - -// ParsePKIXPublicKey parses a DER encoded public key. These values are -// typically found in PEM blocks with "BEGIN PUBLIC KEY". -func ParsePKIXPublicKey(derBytes []byte) (pub interface{}, err error) { - var pki publicKeyInfo - if rest, err := asn1.Unmarshal(derBytes, &pki); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after ASN.1 of public-key") - } - algo := getPublicKeyAlgorithmFromOID(pki.Algorithm.Algorithm) - if algo == UnknownPublicKeyAlgorithm { - return nil, errors.New("x509: unknown public key algorithm") - } - return parsePublicKey(algo, &pki) -} - -func marshalPublicKey(pub interface{}) (publicKeyBytes []byte, publicKeyAlgorithm pkix.AlgorithmIdentifier, err error) { - switch pub := pub.(type) { - case *rsa.PublicKey: - publicKeyBytes, err = asn1.Marshal(rsaPublicKey{ - N: pub.N, - E: pub.E, - }) - publicKeyAlgorithm.Algorithm = oidPublicKeyRSA - // This is a NULL parameters value which is technically - // superfluous, but most other code includes it and, by - // doing this, we match their public key hashes. - publicKeyAlgorithm.Parameters = asn1.RawValue{ - Tag: 5, - } - case *ecdsa.PublicKey: - publicKeyBytes = elliptic.Marshal(pub.Curve, pub.X, pub.Y) - oid, ok := oidFromNamedCurve(pub.Curve) - if !ok { - return nil, pkix.AlgorithmIdentifier{}, errors.New("x509: unsupported elliptic curve") - } - publicKeyAlgorithm.Algorithm = oidPublicKeyECDSA - var paramBytes []byte - paramBytes, err = asn1.Marshal(oid) - if err != nil { - return - } - publicKeyAlgorithm.Parameters.FullBytes = paramBytes - default: - return nil, pkix.AlgorithmIdentifier{}, errors.New("x509: only RSA and ECDSA public keys supported") - } - - return publicKeyBytes, publicKeyAlgorithm, nil -} - -// MarshalPKIXPublicKey serialises a public key to DER-encoded PKIX format. -func MarshalPKIXPublicKey(pub interface{}) ([]byte, error) { - var publicKeyBytes []byte - var publicKeyAlgorithm pkix.AlgorithmIdentifier - var err error - - if publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(pub); err != nil { - return nil, err - } - - pkix := pkixPublicKey{ - Algo: publicKeyAlgorithm, - BitString: asn1.BitString{ - Bytes: publicKeyBytes, - BitLength: 8 * len(publicKeyBytes), - }, - } - - ret, _ := asn1.Marshal(pkix) - return ret, nil -} - -// These structures reflect the ASN.1 structure of X.509 certificates.: - -type certificate struct { - Raw asn1.RawContent - TBSCertificate tbsCertificate - SignatureAlgorithm pkix.AlgorithmIdentifier - SignatureValue asn1.BitString -} - -type tbsCertificate struct { - Raw asn1.RawContent - Version int `asn1:"optional,explicit,default:1,tag:0"` - SerialNumber *big.Int - SignatureAlgorithm pkix.AlgorithmIdentifier - Issuer asn1.RawValue - Validity validity - Subject asn1.RawValue - PublicKey publicKeyInfo - UniqueId asn1.BitString `asn1:"optional,tag:1"` - SubjectUniqueId asn1.BitString `asn1:"optional,tag:2"` - Extensions []pkix.Extension `asn1:"optional,explicit,tag:3"` -} - -type dsaAlgorithmParameters struct { - P, Q, G *big.Int -} - -type dsaSignature struct { - R, S *big.Int -} - -type ecdsaSignature dsaSignature - -type validity struct { - NotBefore, NotAfter time.Time -} - -type publicKeyInfo struct { - Raw asn1.RawContent - Algorithm pkix.AlgorithmIdentifier - PublicKey asn1.BitString -} - -// RFC 5280, 4.2.1.1 -type authKeyId struct { - Id []byte `asn1:"optional,tag:0"` -} - -type SignatureAlgorithm int - -const ( - UnknownSignatureAlgorithm SignatureAlgorithm = iota - MD2WithRSA - MD5WithRSA - SHA1WithRSA - SHA256WithRSA - SHA384WithRSA - SHA512WithRSA - DSAWithSHA1 - DSAWithSHA256 - ECDSAWithSHA1 - ECDSAWithSHA256 - ECDSAWithSHA384 - ECDSAWithSHA512 -) - -type PublicKeyAlgorithm int - -const ( - UnknownPublicKeyAlgorithm PublicKeyAlgorithm = iota - RSA - DSA - ECDSA -) - -// OIDs for signature algorithms -// -// pkcs-1 OBJECT IDENTIFIER ::= { -// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 } -// -// -// RFC 3279 2.2.1 RSA Signature Algorithms -// -// md2WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 2 } -// -// md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 } -// -// sha-1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 } -// -// dsaWithSha1 OBJECT IDENTIFIER ::= { -// iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 3 } -// -// RFC 3279 2.2.3 ECDSA Signature Algorithm -// -// ecdsa-with-SHA1 OBJECT IDENTIFIER ::= { -// iso(1) member-body(2) us(840) ansi-x962(10045) -// signatures(4) ecdsa-with-SHA1(1)} -// -// -// RFC 4055 5 PKCS #1 Version 1.5 -// -// sha256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 11 } -// -// sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 } -// -// sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 } -// -// -// RFC 5758 3.1 DSA Signature Algorithms -// -// dsaWithSha256 OBJECT IDENTIFIER ::= { -// joint-iso-ccitt(2) country(16) us(840) organization(1) gov(101) -// csor(3) algorithms(4) id-dsa-with-sha2(3) 2} -// -// RFC 5758 3.2 ECDSA Signature Algorithm -// -// ecdsa-with-SHA256 OBJECT IDENTIFIER ::= { iso(1) member-body(2) -// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 2 } -// -// ecdsa-with-SHA384 OBJECT IDENTIFIER ::= { iso(1) member-body(2) -// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 3 } -// -// ecdsa-with-SHA512 OBJECT IDENTIFIER ::= { iso(1) member-body(2) -// us(840) ansi-X9-62(10045) signatures(4) ecdsa-with-SHA2(3) 4 } - -var ( - oidSignatureMD2WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 2} - oidSignatureMD5WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 4} - oidSignatureSHA1WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5} - oidSignatureSHA256WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11} - oidSignatureSHA384WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 12} - oidSignatureSHA512WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 13} - oidSignatureDSAWithSHA1 = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 3} - oidSignatureDSAWithSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 4, 3, 2} - oidSignatureECDSAWithSHA1 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 1} - oidSignatureECDSAWithSHA256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2} - oidSignatureECDSAWithSHA384 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 3} - oidSignatureECDSAWithSHA512 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 4} -) - -var signatureAlgorithmDetails = []struct { - algo SignatureAlgorithm - oid asn1.ObjectIdentifier - pubKeyAlgo PublicKeyAlgorithm - hash crypto.Hash -}{ - {MD2WithRSA, oidSignatureMD2WithRSA, RSA, crypto.Hash(0) /* no value for MD2 */}, - {MD5WithRSA, oidSignatureMD5WithRSA, RSA, crypto.MD5}, - {SHA1WithRSA, oidSignatureSHA1WithRSA, RSA, crypto.SHA1}, - {SHA256WithRSA, oidSignatureSHA256WithRSA, RSA, crypto.SHA256}, - {SHA384WithRSA, oidSignatureSHA384WithRSA, RSA, crypto.SHA384}, - {SHA512WithRSA, oidSignatureSHA512WithRSA, RSA, crypto.SHA512}, - {DSAWithSHA1, oidSignatureDSAWithSHA1, DSA, crypto.SHA1}, - {DSAWithSHA256, oidSignatureDSAWithSHA256, DSA, crypto.SHA256}, - {ECDSAWithSHA1, oidSignatureECDSAWithSHA1, ECDSA, crypto.SHA1}, - {ECDSAWithSHA256, oidSignatureECDSAWithSHA256, ECDSA, crypto.SHA256}, - {ECDSAWithSHA384, oidSignatureECDSAWithSHA384, ECDSA, crypto.SHA384}, - {ECDSAWithSHA512, oidSignatureECDSAWithSHA512, ECDSA, crypto.SHA512}, -} - -func getSignatureAlgorithmFromOID(oid asn1.ObjectIdentifier) SignatureAlgorithm { - for _, details := range signatureAlgorithmDetails { - if oid.Equal(details.oid) { - return details.algo - } - } - return UnknownSignatureAlgorithm -} - -// RFC 3279, 2.3 Public Key Algorithms -// -// pkcs-1 OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840) -// rsadsi(113549) pkcs(1) 1 } -// -// rsaEncryption OBJECT IDENTIFIER ::== { pkcs1-1 1 } -// -// id-dsa OBJECT IDENTIFIER ::== { iso(1) member-body(2) us(840) -// x9-57(10040) x9cm(4) 1 } -// -// RFC 5480, 2.1.1 Unrestricted Algorithm Identifier and Parameters -// -// id-ecPublicKey OBJECT IDENTIFIER ::= { -// iso(1) member-body(2) us(840) ansi-X9-62(10045) keyType(2) 1 } -var ( - oidPublicKeyRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} - oidPublicKeyDSA = asn1.ObjectIdentifier{1, 2, 840, 10040, 4, 1} - oidPublicKeyECDSA = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1} -) - -func getPublicKeyAlgorithmFromOID(oid asn1.ObjectIdentifier) PublicKeyAlgorithm { - switch { - case oid.Equal(oidPublicKeyRSA): - return RSA - case oid.Equal(oidPublicKeyDSA): - return DSA - case oid.Equal(oidPublicKeyECDSA): - return ECDSA - } - return UnknownPublicKeyAlgorithm -} - -// RFC 5480, 2.1.1.1. Named Curve -// -// secp224r1 OBJECT IDENTIFIER ::= { -// iso(1) identified-organization(3) certicom(132) curve(0) 33 } -// -// secp256r1 OBJECT IDENTIFIER ::= { -// iso(1) member-body(2) us(840) ansi-X9-62(10045) curves(3) -// prime(1) 7 } -// -// secp384r1 OBJECT IDENTIFIER ::= { -// iso(1) identified-organization(3) certicom(132) curve(0) 34 } -// -// secp521r1 OBJECT IDENTIFIER ::= { -// iso(1) identified-organization(3) certicom(132) curve(0) 35 } -// -// NB: secp256r1 is equivalent to prime256v1 -var ( - oidNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33} - oidNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7} - oidNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34} - oidNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35} -) - -func namedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve { - switch { - case oid.Equal(oidNamedCurveP224): - return elliptic.P224() - case oid.Equal(oidNamedCurveP256): - return elliptic.P256() - case oid.Equal(oidNamedCurveP384): - return elliptic.P384() - case oid.Equal(oidNamedCurveP521): - return elliptic.P521() - } - return nil -} - -func oidFromNamedCurve(curve elliptic.Curve) (asn1.ObjectIdentifier, bool) { - switch curve { - case elliptic.P224(): - return oidNamedCurveP224, true - case elliptic.P256(): - return oidNamedCurveP256, true - case elliptic.P384(): - return oidNamedCurveP384, true - case elliptic.P521(): - return oidNamedCurveP521, true - } - - return nil, false -} - -// KeyUsage represents the set of actions that are valid for a given key. It's -// a bitmap of the KeyUsage* constants. -type KeyUsage int - -const ( - KeyUsageDigitalSignature KeyUsage = 1 << iota - KeyUsageContentCommitment - KeyUsageKeyEncipherment - KeyUsageDataEncipherment - KeyUsageKeyAgreement - KeyUsageCertSign - KeyUsageCRLSign - KeyUsageEncipherOnly - KeyUsageDecipherOnly -) - -// RFC 5280, 4.2.1.12 Extended Key Usage -// -// anyExtendedKeyUsage OBJECT IDENTIFIER ::= { id-ce-extKeyUsage 0 } -// -// id-kp OBJECT IDENTIFIER ::= { id-pkix 3 } -// -// id-kp-serverAuth OBJECT IDENTIFIER ::= { id-kp 1 } -// id-kp-clientAuth OBJECT IDENTIFIER ::= { id-kp 2 } -// id-kp-codeSigning OBJECT IDENTIFIER ::= { id-kp 3 } -// id-kp-emailProtection OBJECT IDENTIFIER ::= { id-kp 4 } -// id-kp-timeStamping OBJECT IDENTIFIER ::= { id-kp 8 } -// id-kp-OCSPSigning OBJECT IDENTIFIER ::= { id-kp 9 } -var ( - oidExtKeyUsageAny = asn1.ObjectIdentifier{2, 5, 29, 37, 0} - oidExtKeyUsageServerAuth = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 1} - oidExtKeyUsageClientAuth = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 2} - oidExtKeyUsageCodeSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 3} - oidExtKeyUsageEmailProtection = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 4} - oidExtKeyUsageIPSECEndSystem = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 5} - oidExtKeyUsageIPSECTunnel = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 6} - oidExtKeyUsageIPSECUser = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 7} - oidExtKeyUsageTimeStamping = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 8} - oidExtKeyUsageOCSPSigning = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 3, 9} - oidExtKeyUsageMicrosoftServerGatedCrypto = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 10, 3, 3} - oidExtKeyUsageNetscapeServerGatedCrypto = asn1.ObjectIdentifier{2, 16, 840, 1, 113730, 4, 1} -) - -// ExtKeyUsage represents an extended set of actions that are valid for a given key. -// Each of the ExtKeyUsage* constants define a unique action. -type ExtKeyUsage int - -const ( - ExtKeyUsageAny ExtKeyUsage = iota - ExtKeyUsageServerAuth - ExtKeyUsageClientAuth - ExtKeyUsageCodeSigning - ExtKeyUsageEmailProtection - ExtKeyUsageIPSECEndSystem - ExtKeyUsageIPSECTunnel - ExtKeyUsageIPSECUser - ExtKeyUsageTimeStamping - ExtKeyUsageOCSPSigning - ExtKeyUsageMicrosoftServerGatedCrypto - ExtKeyUsageNetscapeServerGatedCrypto -) - -// extKeyUsageOIDs contains the mapping between an ExtKeyUsage and its OID. -var extKeyUsageOIDs = []struct { - extKeyUsage ExtKeyUsage - oid asn1.ObjectIdentifier -}{ - {ExtKeyUsageAny, oidExtKeyUsageAny}, - {ExtKeyUsageServerAuth, oidExtKeyUsageServerAuth}, - {ExtKeyUsageClientAuth, oidExtKeyUsageClientAuth}, - {ExtKeyUsageCodeSigning, oidExtKeyUsageCodeSigning}, - {ExtKeyUsageEmailProtection, oidExtKeyUsageEmailProtection}, - {ExtKeyUsageIPSECEndSystem, oidExtKeyUsageIPSECEndSystem}, - {ExtKeyUsageIPSECTunnel, oidExtKeyUsageIPSECTunnel}, - {ExtKeyUsageIPSECUser, oidExtKeyUsageIPSECUser}, - {ExtKeyUsageTimeStamping, oidExtKeyUsageTimeStamping}, - {ExtKeyUsageOCSPSigning, oidExtKeyUsageOCSPSigning}, - {ExtKeyUsageMicrosoftServerGatedCrypto, oidExtKeyUsageMicrosoftServerGatedCrypto}, - {ExtKeyUsageNetscapeServerGatedCrypto, oidExtKeyUsageNetscapeServerGatedCrypto}, -} - -func extKeyUsageFromOID(oid asn1.ObjectIdentifier) (eku ExtKeyUsage, ok bool) { - for _, pair := range extKeyUsageOIDs { - if oid.Equal(pair.oid) { - return pair.extKeyUsage, true - } - } - return -} - -func oidFromExtKeyUsage(eku ExtKeyUsage) (oid asn1.ObjectIdentifier, ok bool) { - for _, pair := range extKeyUsageOIDs { - if eku == pair.extKeyUsage { - return pair.oid, true - } - } - return -} - -// A Certificate represents an X.509 certificate. -type Certificate struct { - Raw []byte // Complete ASN.1 DER content (certificate, signature algorithm and signature). - RawTBSCertificate []byte // Certificate part of raw ASN.1 DER content. - RawSubjectPublicKeyInfo []byte // DER encoded SubjectPublicKeyInfo. - RawSubject []byte // DER encoded Subject - RawIssuer []byte // DER encoded Issuer - - Signature []byte - SignatureAlgorithm SignatureAlgorithm - - PublicKeyAlgorithm PublicKeyAlgorithm - PublicKey interface{} - - Version int - SerialNumber *big.Int - Issuer pkix.Name - Subject pkix.Name - NotBefore, NotAfter time.Time // Validity bounds. - KeyUsage KeyUsage - - // Extensions contains raw X.509 extensions. When parsing certificates, - // this can be used to extract non-critical extensions that are not - // parsed by this package. When marshaling certificates, the Extensions - // field is ignored, see ExtraExtensions. - Extensions []pkix.Extension - - // ExtraExtensions contains extensions to be copied, raw, into any - // marshaled certificates. Values override any extensions that would - // otherwise be produced based on the other fields. The ExtraExtensions - // field is not populated when parsing certificates, see Extensions. - ExtraExtensions []pkix.Extension - - // UnhandledCriticalExtensions contains a list of extension IDs that - // were not (fully) processed when parsing. Verify will fail if this - // slice is non-empty, unless verification is delegated to an OS - // library which understands all the critical extensions. - // - // Users can access these extensions using Extensions and can remove - // elements from this slice if they believe that they have been - // handled. - UnhandledCriticalExtensions []asn1.ObjectIdentifier - - ExtKeyUsage []ExtKeyUsage // Sequence of extended key usages. - UnknownExtKeyUsage []asn1.ObjectIdentifier // Encountered extended key usages unknown to this package. - - BasicConstraintsValid bool // if true then the next two fields are valid. - IsCA bool - MaxPathLen int - // MaxPathLenZero indicates that BasicConstraintsValid==true and - // MaxPathLen==0 should be interpreted as an actual maximum path length - // of zero. Otherwise, that combination is interpreted as MaxPathLen - // not being set. - MaxPathLenZero bool - - SubjectKeyId []byte - AuthorityKeyId []byte - - // RFC 5280, 4.2.2.1 (Authority Information Access) - OCSPServer []string - IssuingCertificateURL []string - - // Subject Alternate Name values - DNSNames []string - EmailAddresses []string - IPAddresses []net.IP - - // Name constraints - PermittedDNSDomainsCritical bool // if true then the name constraints are marked critical. - PermittedDNSDomains []string - - // CRL Distribution Points - CRLDistributionPoints []string - - PolicyIdentifiers []asn1.ObjectIdentifier -} - -// ErrUnsupportedAlgorithm results from attempting to perform an operation that -// involves algorithms that are not currently implemented. -var ErrUnsupportedAlgorithm = errors.New("x509: cannot verify signature: algorithm unimplemented") - -// ConstraintViolationError results when a requested usage is not permitted by -// a certificate. For example: checking a signature when the public key isn't a -// certificate signing key. -type ConstraintViolationError struct{} - -func (ConstraintViolationError) Error() string { - return "x509: invalid signature: parent certificate cannot sign this kind of certificate" -} - -func (c *Certificate) Equal(other *Certificate) bool { - return bytes.Equal(c.Raw, other.Raw) -} - -// Entrust have a broken root certificate (CN=Entrust.net Certification -// Authority (2048)) which isn't marked as a CA certificate and is thus invalid -// according to PKIX. -// We recognise this certificate by its SubjectPublicKeyInfo and exempt it -// from the Basic Constraints requirement. -// See http://www.entrust.net/knowledge-base/technote.cfm?tn=7869 -// -// TODO(agl): remove this hack once their reissued root is sufficiently -// widespread. -var entrustBrokenSPKI = []byte{ - 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, - 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, - 0x00, 0x97, 0xa3, 0x2d, 0x3c, 0x9e, 0xde, 0x05, - 0xda, 0x13, 0xc2, 0x11, 0x8d, 0x9d, 0x8e, 0xe3, - 0x7f, 0xc7, 0x4b, 0x7e, 0x5a, 0x9f, 0xb3, 0xff, - 0x62, 0xab, 0x73, 0xc8, 0x28, 0x6b, 0xba, 0x10, - 0x64, 0x82, 0x87, 0x13, 0xcd, 0x57, 0x18, 0xff, - 0x28, 0xce, 0xc0, 0xe6, 0x0e, 0x06, 0x91, 0x50, - 0x29, 0x83, 0xd1, 0xf2, 0xc3, 0x2a, 0xdb, 0xd8, - 0xdb, 0x4e, 0x04, 0xcc, 0x00, 0xeb, 0x8b, 0xb6, - 0x96, 0xdc, 0xbc, 0xaa, 0xfa, 0x52, 0x77, 0x04, - 0xc1, 0xdb, 0x19, 0xe4, 0xae, 0x9c, 0xfd, 0x3c, - 0x8b, 0x03, 0xef, 0x4d, 0xbc, 0x1a, 0x03, 0x65, - 0xf9, 0xc1, 0xb1, 0x3f, 0x72, 0x86, 0xf2, 0x38, - 0xaa, 0x19, 0xae, 0x10, 0x88, 0x78, 0x28, 0xda, - 0x75, 0xc3, 0x3d, 0x02, 0x82, 0x02, 0x9c, 0xb9, - 0xc1, 0x65, 0x77, 0x76, 0x24, 0x4c, 0x98, 0xf7, - 0x6d, 0x31, 0x38, 0xfb, 0xdb, 0xfe, 0xdb, 0x37, - 0x02, 0x76, 0xa1, 0x18, 0x97, 0xa6, 0xcc, 0xde, - 0x20, 0x09, 0x49, 0x36, 0x24, 0x69, 0x42, 0xf6, - 0xe4, 0x37, 0x62, 0xf1, 0x59, 0x6d, 0xa9, 0x3c, - 0xed, 0x34, 0x9c, 0xa3, 0x8e, 0xdb, 0xdc, 0x3a, - 0xd7, 0xf7, 0x0a, 0x6f, 0xef, 0x2e, 0xd8, 0xd5, - 0x93, 0x5a, 0x7a, 0xed, 0x08, 0x49, 0x68, 0xe2, - 0x41, 0xe3, 0x5a, 0x90, 0xc1, 0x86, 0x55, 0xfc, - 0x51, 0x43, 0x9d, 0xe0, 0xb2, 0xc4, 0x67, 0xb4, - 0xcb, 0x32, 0x31, 0x25, 0xf0, 0x54, 0x9f, 0x4b, - 0xd1, 0x6f, 0xdb, 0xd4, 0xdd, 0xfc, 0xaf, 0x5e, - 0x6c, 0x78, 0x90, 0x95, 0xde, 0xca, 0x3a, 0x48, - 0xb9, 0x79, 0x3c, 0x9b, 0x19, 0xd6, 0x75, 0x05, - 0xa0, 0xf9, 0x88, 0xd7, 0xc1, 0xe8, 0xa5, 0x09, - 0xe4, 0x1a, 0x15, 0xdc, 0x87, 0x23, 0xaa, 0xb2, - 0x75, 0x8c, 0x63, 0x25, 0x87, 0xd8, 0xf8, 0x3d, - 0xa6, 0xc2, 0xcc, 0x66, 0xff, 0xa5, 0x66, 0x68, - 0x55, 0x02, 0x03, 0x01, 0x00, 0x01, -} - -// CheckSignatureFrom verifies that the signature on c is a valid signature -// from parent. -func (c *Certificate) CheckSignatureFrom(parent *Certificate) (err error) { - // RFC 5280, 4.2.1.9: - // "If the basic constraints extension is not present in a version 3 - // certificate, or the extension is present but the cA boolean is not - // asserted, then the certified public key MUST NOT be used to verify - // certificate signatures." - // (except for Entrust, see comment above entrustBrokenSPKI) - if (parent.Version == 3 && !parent.BasicConstraintsValid || - parent.BasicConstraintsValid && !parent.IsCA) && - !bytes.Equal(c.RawSubjectPublicKeyInfo, entrustBrokenSPKI) { - return ConstraintViolationError{} - } - - if parent.KeyUsage != 0 && parent.KeyUsage&KeyUsageCertSign == 0 { - return ConstraintViolationError{} - } - - if parent.PublicKeyAlgorithm == UnknownPublicKeyAlgorithm { - return ErrUnsupportedAlgorithm - } - - // TODO(agl): don't ignore the path length constraint. - - return parent.CheckSignature(c.SignatureAlgorithm, c.RawTBSCertificate, c.Signature) -} - -// CheckSignature verifies that signature is a valid signature over signed from -// c's public key. -func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) (err error) { - return checkSignature(algo, signed, signature, c.PublicKey) -} - -// CheckSignature verifies that signature is a valid signature over signed from -// a crypto.PublicKey. -func checkSignature(algo SignatureAlgorithm, signed, signature []byte, publicKey crypto.PublicKey) (err error) { - var hashType crypto.Hash - - switch algo { - case SHA1WithRSA, DSAWithSHA1, ECDSAWithSHA1: - hashType = crypto.SHA1 - case SHA256WithRSA, DSAWithSHA256, ECDSAWithSHA256: - hashType = crypto.SHA256 - case SHA384WithRSA, ECDSAWithSHA384: - hashType = crypto.SHA384 - case SHA512WithRSA, ECDSAWithSHA512: - hashType = crypto.SHA512 - default: - return ErrUnsupportedAlgorithm - } - - if !hashType.Available() { - return ErrUnsupportedAlgorithm - } - h := hashType.New() - - h.Write(signed) - digest := h.Sum(nil) - - switch pub := publicKey.(type) { - case *rsa.PublicKey: - return rsa.VerifyPKCS1v15(pub, hashType, digest, signature) - case *dsa.PublicKey: - dsaSig := new(dsaSignature) - if rest, err := asn1.Unmarshal(signature, dsaSig); err != nil { - return err - } else if len(rest) != 0 { - return errors.New("x509: trailing data after DSA signature") - } - if dsaSig.R.Sign() <= 0 || dsaSig.S.Sign() <= 0 { - return errors.New("x509: DSA signature contained zero or negative values") - } - if !dsa.Verify(pub, digest, dsaSig.R, dsaSig.S) { - return errors.New("x509: DSA verification failure") - } - return - case *ecdsa.PublicKey: - ecdsaSig := new(ecdsaSignature) - if rest, err := asn1.Unmarshal(signature, ecdsaSig); err != nil { - return err - } else if len(rest) != 0 { - return errors.New("x509: trailing data after ECDSA signature") - } - if ecdsaSig.R.Sign() <= 0 || ecdsaSig.S.Sign() <= 0 { - return errors.New("x509: ECDSA signature contained zero or negative values") - } - if !ecdsa.Verify(pub, digest, ecdsaSig.R, ecdsaSig.S) { - return errors.New("x509: ECDSA verification failure") - } - return - } - return ErrUnsupportedAlgorithm -} - -// CheckCRLSignature checks that the signature in crl is from c. -func (c *Certificate) CheckCRLSignature(crl *pkix.CertificateList) (err error) { - algo := getSignatureAlgorithmFromOID(crl.SignatureAlgorithm.Algorithm) - return c.CheckSignature(algo, crl.TBSCertList.Raw, crl.SignatureValue.RightAlign()) -} - -type UnhandledCriticalExtension struct{} - -func (h UnhandledCriticalExtension) Error() string { - return "x509: unhandled critical extension" -} - -type basicConstraints struct { - IsCA bool `asn1:"optional"` - MaxPathLen int `asn1:"optional,default:-1"` -} - -// RFC 5280 4.2.1.4 -type policyInformation struct { - Policy asn1.ObjectIdentifier - // policyQualifiers omitted -} - -// RFC 5280, 4.2.1.10 -type nameConstraints struct { - Permitted []generalSubtree `asn1:"optional,tag:0"` - Excluded []generalSubtree `asn1:"optional,tag:1"` -} - -type generalSubtree struct { - Name string `asn1:"tag:2,optional,ia5"` -} - -// RFC 5280, 4.2.2.1 -type authorityInfoAccess struct { - Method asn1.ObjectIdentifier - Location asn1.RawValue -} - -// RFC 5280, 4.2.1.14 -type distributionPoint struct { - DistributionPoint distributionPointName `asn1:"optional,tag:0"` - Reason asn1.BitString `asn1:"optional,tag:1"` - CRLIssuer asn1.RawValue `asn1:"optional,tag:2"` -} - -type distributionPointName struct { - FullName asn1.RawValue `asn1:"optional,tag:0"` - RelativeName pkix.RDNSequence `asn1:"optional,tag:1"` -} - -func parsePublicKey(algo PublicKeyAlgorithm, keyData *publicKeyInfo) (interface{}, error) { - asn1Data := keyData.PublicKey.RightAlign() - switch algo { - case RSA: - p := new(rsaPublicKey) - rest, err := asn1.Unmarshal(asn1Data, p) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, errors.New("x509: trailing data after RSA public key") - } - - if p.N.Sign() <= 0 { - return nil, errors.New("x509: RSA modulus is not a positive number") - } - if p.E <= 0 { - return nil, errors.New("x509: RSA public exponent is not a positive number") - } - - pub := &rsa.PublicKey{ - E: p.E, - N: p.N, - } - return pub, nil - case DSA: - var p *big.Int - rest, err := asn1.Unmarshal(asn1Data, &p) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, errors.New("x509: trailing data after DSA public key") - } - paramsData := keyData.Algorithm.Parameters.FullBytes - params := new(dsaAlgorithmParameters) - rest, err = asn1.Unmarshal(paramsData, params) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, errors.New("x509: trailing data after DSA parameters") - } - if p.Sign() <= 0 || params.P.Sign() <= 0 || params.Q.Sign() <= 0 || params.G.Sign() <= 0 { - return nil, errors.New("x509: zero or negative DSA parameter") - } - pub := &dsa.PublicKey{ - Parameters: dsa.Parameters{ - P: params.P, - Q: params.Q, - G: params.G, - }, - Y: p, - } - return pub, nil - case ECDSA: - paramsData := keyData.Algorithm.Parameters.FullBytes - namedCurveOID := new(asn1.ObjectIdentifier) - rest, err := asn1.Unmarshal(paramsData, namedCurveOID) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, errors.New("x509: trailing data after ECDSA parameters") - } - namedCurve := namedCurveFromOID(*namedCurveOID) - if namedCurve == nil { - return nil, errors.New("x509: unsupported elliptic curve") - } - x, y := elliptic.Unmarshal(namedCurve, asn1Data) - if x == nil { - return nil, errors.New("x509: failed to unmarshal elliptic curve point") - } - pub := &ecdsa.PublicKey{ - Curve: namedCurve, - X: x, - Y: y, - } - return pub, nil - default: - return nil, nil - } -} - -func parseSANExtension(value []byte) (dnsNames, emailAddresses []string, ipAddresses []net.IP, err error) { - // RFC 5280, 4.2.1.6 - - // SubjectAltName ::= GeneralNames - // - // GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName - // - // GeneralName ::= CHOICE { - // otherName [0] OtherName, - // rfc822Name [1] IA5String, - // dNSName [2] IA5String, - // x400Address [3] ORAddress, - // directoryName [4] Name, - // ediPartyName [5] EDIPartyName, - // uniformResourceIdentifier [6] IA5String, - // iPAddress [7] OCTET STRING, - // registeredID [8] OBJECT IDENTIFIER } - var seq asn1.RawValue - var rest []byte - if rest, err = asn1.Unmarshal(value, &seq); err != nil { - return - } else if len(rest) != 0 { - err = errors.New("x509: trailing data after X.509 extension") - return - } - if !seq.IsCompound || seq.Tag != 16 || seq.Class != 0 { - err = asn1.StructuralError{Msg: "bad SAN sequence"} - return - } - - rest = seq.Bytes - for len(rest) > 0 { - var v asn1.RawValue - rest, err = asn1.Unmarshal(rest, &v) - if err != nil { - return - } - switch v.Tag { - case 1: - emailAddresses = append(emailAddresses, string(v.Bytes)) - case 2: - dnsNames = append(dnsNames, string(v.Bytes)) - case 7: - switch len(v.Bytes) { - case net.IPv4len, net.IPv6len: - ipAddresses = append(ipAddresses, v.Bytes) - default: - err = errors.New("x509: certificate contained IP address of length " + strconv.Itoa(len(v.Bytes))) - return - } - } - } - - return -} - -func parseCertificate(in *certificate) (*Certificate, error) { - out := new(Certificate) - out.Raw = in.Raw - out.RawTBSCertificate = in.TBSCertificate.Raw - out.RawSubjectPublicKeyInfo = in.TBSCertificate.PublicKey.Raw - out.RawSubject = in.TBSCertificate.Subject.FullBytes - out.RawIssuer = in.TBSCertificate.Issuer.FullBytes - - out.Signature = in.SignatureValue.RightAlign() - out.SignatureAlgorithm = - getSignatureAlgorithmFromOID(in.TBSCertificate.SignatureAlgorithm.Algorithm) - - out.PublicKeyAlgorithm = - getPublicKeyAlgorithmFromOID(in.TBSCertificate.PublicKey.Algorithm.Algorithm) - var err error - out.PublicKey, err = parsePublicKey(out.PublicKeyAlgorithm, &in.TBSCertificate.PublicKey) - if err != nil { - return nil, err - } - - if in.TBSCertificate.SerialNumber.Sign() < 0 { - return nil, errors.New("x509: negative serial number") - } - - out.Version = in.TBSCertificate.Version + 1 - out.SerialNumber = in.TBSCertificate.SerialNumber - - var issuer, subject pkix.RDNSequence - if rest, err := asn1.Unmarshal(in.TBSCertificate.Subject.FullBytes, &subject); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 subject") - } - if rest, err := asn1.Unmarshal(in.TBSCertificate.Issuer.FullBytes, &issuer); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 subject") - } - - out.Issuer.FillFromRDNSequence(&issuer) - out.Subject.FillFromRDNSequence(&subject) - - out.NotBefore = in.TBSCertificate.Validity.NotBefore - out.NotAfter = in.TBSCertificate.Validity.NotAfter - - for _, e := range in.TBSCertificate.Extensions { - out.Extensions = append(out.Extensions, e) - unhandled := false - - if len(e.Id) == 4 && e.Id[0] == 2 && e.Id[1] == 5 && e.Id[2] == 29 { - switch e.Id[3] { - case 15: - // RFC 5280, 4.2.1.3 - var usageBits asn1.BitString - if rest, err := asn1.Unmarshal(e.Value, &usageBits); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 KeyUsage") - } - - var usage int - for i := 0; i < 9; i++ { - if usageBits.At(i) != 0 { - usage |= 1 << uint(i) - } - } - out.KeyUsage = KeyUsage(usage) - - case 19: - // RFC 5280, 4.2.1.9 - var constraints basicConstraints - if rest, err := asn1.Unmarshal(e.Value, &constraints); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 BasicConstraints") - } - - out.BasicConstraintsValid = true - out.IsCA = constraints.IsCA - out.MaxPathLen = constraints.MaxPathLen - out.MaxPathLenZero = out.MaxPathLen == 0 - - case 17: - out.DNSNames, out.EmailAddresses, out.IPAddresses, err = parseSANExtension(e.Value) - if err != nil { - return nil, err - } - - if len(out.DNSNames) == 0 && len(out.EmailAddresses) == 0 && len(out.IPAddresses) == 0 { - // If we didn't parse anything then we do the critical check, below. - unhandled = true - } - - case 30: - // RFC 5280, 4.2.1.10 - - // NameConstraints ::= SEQUENCE { - // permittedSubtrees [0] GeneralSubtrees OPTIONAL, - // excludedSubtrees [1] GeneralSubtrees OPTIONAL } - // - // GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree - // - // GeneralSubtree ::= SEQUENCE { - // base GeneralName, - // minimum [0] BaseDistance DEFAULT 0, - // maximum [1] BaseDistance OPTIONAL } - // - // BaseDistance ::= INTEGER (0..MAX) - - var constraints nameConstraints - if rest, err := asn1.Unmarshal(e.Value, &constraints); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 NameConstraints") - } - - if len(constraints.Excluded) > 0 && e.Critical { - return out, UnhandledCriticalExtension{} - } - - for _, subtree := range constraints.Permitted { - if len(subtree.Name) == 0 { - if e.Critical { - return out, UnhandledCriticalExtension{} - } - continue - } - out.PermittedDNSDomains = append(out.PermittedDNSDomains, subtree.Name) - } - - case 31: - // RFC 5280, 4.2.1.14 - - // CRLDistributionPoints ::= SEQUENCE SIZE (1..MAX) OF DistributionPoint - // - // DistributionPoint ::= SEQUENCE { - // distributionPoint [0] DistributionPointName OPTIONAL, - // reasons [1] ReasonFlags OPTIONAL, - // cRLIssuer [2] GeneralNames OPTIONAL } - // - // DistributionPointName ::= CHOICE { - // fullName [0] GeneralNames, - // nameRelativeToCRLIssuer [1] RelativeDistinguishedName } - - var cdp []distributionPoint - if rest, err := asn1.Unmarshal(e.Value, &cdp); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 CRL distribution point") - } - - for _, dp := range cdp { - var n asn1.RawValue - if _, err := asn1.Unmarshal(dp.DistributionPoint.FullName.Bytes, &n); err != nil { - return nil, err - } - // Trailing data after the fullName is - // allowed because other elements of - // the SEQUENCE can appear. - - if n.Tag == 6 { - out.CRLDistributionPoints = append(out.CRLDistributionPoints, string(n.Bytes)) - } - } - - case 35: - // RFC 5280, 4.2.1.1 - var a authKeyId - if rest, err := asn1.Unmarshal(e.Value, &a); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 authority key-id") - } - out.AuthorityKeyId = a.Id - - case 37: - // RFC 5280, 4.2.1.12. Extended Key Usage - - // id-ce-extKeyUsage OBJECT IDENTIFIER ::= { id-ce 37 } - // - // ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId - // - // KeyPurposeId ::= OBJECT IDENTIFIER - - var keyUsage []asn1.ObjectIdentifier - if rest, err := asn1.Unmarshal(e.Value, &keyUsage); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 ExtendedKeyUsage") - } - - for _, u := range keyUsage { - if extKeyUsage, ok := extKeyUsageFromOID(u); ok { - out.ExtKeyUsage = append(out.ExtKeyUsage, extKeyUsage) - } else { - out.UnknownExtKeyUsage = append(out.UnknownExtKeyUsage, u) - } - } - - case 14: - // RFC 5280, 4.2.1.2 - var keyid []byte - if rest, err := asn1.Unmarshal(e.Value, &keyid); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 authority key-id") - } - out.SubjectKeyId = keyid - - case 32: - // RFC 5280 4.2.1.4: Certificate Policies - var policies []policyInformation - if rest, err := asn1.Unmarshal(e.Value, &policies); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 certificate policies") - } - out.PolicyIdentifiers = make([]asn1.ObjectIdentifier, len(policies)) - for i, policy := range policies { - out.PolicyIdentifiers[i] = policy.Policy - } - - default: - // Unknown extensions are recorded if critical. - unhandled = true - } - } else if e.Id.Equal(oidExtensionAuthorityInfoAccess) { - // RFC 5280 4.2.2.1: Authority Information Access - var aia []authorityInfoAccess - if rest, err := asn1.Unmarshal(e.Value, &aia); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 authority information") - } - - for _, v := range aia { - // GeneralName: uniformResourceIdentifier [6] IA5String - if v.Location.Tag != 6 { - continue - } - if v.Method.Equal(oidAuthorityInfoAccessOcsp) { - out.OCSPServer = append(out.OCSPServer, string(v.Location.Bytes)) - } else if v.Method.Equal(oidAuthorityInfoAccessIssuers) { - out.IssuingCertificateURL = append(out.IssuingCertificateURL, string(v.Location.Bytes)) - } - } - } else { - // Unknown extensions are recorded if critical. - unhandled = true - } - - if e.Critical && unhandled { - out.UnhandledCriticalExtensions = append(out.UnhandledCriticalExtensions, e.Id) - } - } - - return out, nil -} - -// ParseCertificate parses a single certificate from the given ASN.1 DER data. -func ParseCertificate(asn1Data []byte) (*Certificate, error) { - var cert certificate - rest, err := asn1.Unmarshal(asn1Data, &cert) - if err != nil { - return nil, err - } - if len(rest) > 0 { - return nil, asn1.SyntaxError{Msg: "trailing data"} - } - - return parseCertificate(&cert) -} - -// ParseCertificates parses one or more certificates from the given ASN.1 DER -// data. The certificates must be concatenated with no intermediate padding. -func ParseCertificates(asn1Data []byte) ([]*Certificate, error) { - var v []*certificate - - for len(asn1Data) > 0 { - cert := new(certificate) - var err error - asn1Data, err = asn1.Unmarshal(asn1Data, cert) - if err != nil { - return nil, err - } - v = append(v, cert) - } - - ret := make([]*Certificate, len(v)) - for i, ci := range v { - cert, err := parseCertificate(ci) - if err != nil { - return nil, err - } - ret[i] = cert - } - - return ret, nil -} - -func reverseBitsInAByte(in byte) byte { - b1 := in>>4 | in<<4 - b2 := b1>>2&0x33 | b1<<2&0xcc - b3 := b2>>1&0x55 | b2<<1&0xaa - return b3 -} - -// asn1BitLength returns the bit-length of bitString by considering the -// most-significant bit in a byte to be the "first" bit. This convention -// matches ASN.1, but differs from almost everything else. -func asn1BitLength(bitString []byte) int { - bitLen := len(bitString) * 8 - - for i := range bitString { - b := bitString[len(bitString)-i-1] - - for bit := uint(0); bit < 8; bit++ { - if (b>>bit)&1 == 1 { - return bitLen - } - bitLen-- - } - } - - return 0 -} - -var ( - oidExtensionSubjectKeyId = []int{2, 5, 29, 14} - oidExtensionKeyUsage = []int{2, 5, 29, 15} - oidExtensionExtendedKeyUsage = []int{2, 5, 29, 37} - oidExtensionAuthorityKeyId = []int{2, 5, 29, 35} - oidExtensionBasicConstraints = []int{2, 5, 29, 19} - oidExtensionSubjectAltName = []int{2, 5, 29, 17} - oidExtensionCertificatePolicies = []int{2, 5, 29, 32} - oidExtensionNameConstraints = []int{2, 5, 29, 30} - oidExtensionCRLDistributionPoints = []int{2, 5, 29, 31} - oidExtensionAuthorityInfoAccess = []int{1, 3, 6, 1, 5, 5, 7, 1, 1} -) - -var ( - oidAuthorityInfoAccessOcsp = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 1} - oidAuthorityInfoAccessIssuers = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 48, 2} -) - -// oidNotInExtensions returns whether an extension with the given oid exists in -// extensions. -func oidInExtensions(oid asn1.ObjectIdentifier, extensions []pkix.Extension) bool { - for _, e := range extensions { - if e.Id.Equal(oid) { - return true - } - } - return false -} - -// marshalSANs marshals a list of addresses into a the contents of an X.509 -// SubjectAlternativeName extension. -func marshalSANs(dnsNames, emailAddresses []string, ipAddresses []net.IP) (derBytes []byte, err error) { - var rawValues []asn1.RawValue - for _, name := range dnsNames { - rawValues = append(rawValues, asn1.RawValue{Tag: 2, Class: 2, Bytes: []byte(name)}) - } - for _, email := range emailAddresses { - rawValues = append(rawValues, asn1.RawValue{Tag: 1, Class: 2, Bytes: []byte(email)}) - } - for _, rawIP := range ipAddresses { - // If possible, we always want to encode IPv4 addresses in 4 bytes. - ip := rawIP.To4() - if ip == nil { - ip = rawIP - } - rawValues = append(rawValues, asn1.RawValue{Tag: 7, Class: 2, Bytes: ip}) - } - return asn1.Marshal(rawValues) -} - -func buildExtensions(template *Certificate) (ret []pkix.Extension, err error) { - ret = make([]pkix.Extension, 10 /* maximum number of elements. */) - n := 0 - - if template.KeyUsage != 0 && - !oidInExtensions(oidExtensionKeyUsage, template.ExtraExtensions) { - ret[n].Id = oidExtensionKeyUsage - ret[n].Critical = true - - var a [2]byte - a[0] = reverseBitsInAByte(byte(template.KeyUsage)) - a[1] = reverseBitsInAByte(byte(template.KeyUsage >> 8)) - - l := 1 - if a[1] != 0 { - l = 2 - } - - bitString := a[:l] - ret[n].Value, err = asn1.Marshal(asn1.BitString{Bytes: bitString, BitLength: asn1BitLength(bitString)}) - if err != nil { - return - } - n++ - } - - if (len(template.ExtKeyUsage) > 0 || len(template.UnknownExtKeyUsage) > 0) && - !oidInExtensions(oidExtensionExtendedKeyUsage, template.ExtraExtensions) { - ret[n].Id = oidExtensionExtendedKeyUsage - - var oids []asn1.ObjectIdentifier - for _, u := range template.ExtKeyUsage { - if oid, ok := oidFromExtKeyUsage(u); ok { - oids = append(oids, oid) - } else { - panic("internal error") - } - } - - oids = append(oids, template.UnknownExtKeyUsage...) - - ret[n].Value, err = asn1.Marshal(oids) - if err != nil { - return - } - n++ - } - - if template.BasicConstraintsValid && !oidInExtensions(oidExtensionBasicConstraints, template.ExtraExtensions) { - // Leaving MaxPathLen as zero indicates that no maximum path - // length is desired, unless MaxPathLenZero is set. A value of - // -1 causes encoding/asn1 to omit the value as desired. - maxPathLen := template.MaxPathLen - if maxPathLen == 0 && !template.MaxPathLenZero { - maxPathLen = -1 - } - ret[n].Id = oidExtensionBasicConstraints - ret[n].Value, err = asn1.Marshal(basicConstraints{template.IsCA, maxPathLen}) - ret[n].Critical = true - if err != nil { - return - } - n++ - } - - if len(template.SubjectKeyId) > 0 && !oidInExtensions(oidExtensionSubjectKeyId, template.ExtraExtensions) { - ret[n].Id = oidExtensionSubjectKeyId - ret[n].Value, err = asn1.Marshal(template.SubjectKeyId) - if err != nil { - return - } - n++ - } - - if len(template.AuthorityKeyId) > 0 && !oidInExtensions(oidExtensionAuthorityKeyId, template.ExtraExtensions) { - ret[n].Id = oidExtensionAuthorityKeyId - ret[n].Value, err = asn1.Marshal(authKeyId{template.AuthorityKeyId}) - if err != nil { - return - } - n++ - } - - if (len(template.OCSPServer) > 0 || len(template.IssuingCertificateURL) > 0) && - !oidInExtensions(oidExtensionAuthorityInfoAccess, template.ExtraExtensions) { - ret[n].Id = oidExtensionAuthorityInfoAccess - var aiaValues []authorityInfoAccess - for _, name := range template.OCSPServer { - aiaValues = append(aiaValues, authorityInfoAccess{ - Method: oidAuthorityInfoAccessOcsp, - Location: asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}, - }) - } - for _, name := range template.IssuingCertificateURL { - aiaValues = append(aiaValues, authorityInfoAccess{ - Method: oidAuthorityInfoAccessIssuers, - Location: asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}, - }) - } - ret[n].Value, err = asn1.Marshal(aiaValues) - if err != nil { - return - } - n++ - } - - if (len(template.DNSNames) > 0 || len(template.EmailAddresses) > 0 || len(template.IPAddresses) > 0) && - !oidInExtensions(oidExtensionSubjectAltName, template.ExtraExtensions) { - ret[n].Id = oidExtensionSubjectAltName - ret[n].Value, err = marshalSANs(template.DNSNames, template.EmailAddresses, template.IPAddresses) - if err != nil { - return - } - n++ - } - - if len(template.PolicyIdentifiers) > 0 && - !oidInExtensions(oidExtensionCertificatePolicies, template.ExtraExtensions) { - ret[n].Id = oidExtensionCertificatePolicies - policies := make([]policyInformation, len(template.PolicyIdentifiers)) - for i, policy := range template.PolicyIdentifiers { - policies[i].Policy = policy - } - ret[n].Value, err = asn1.Marshal(policies) - if err != nil { - return - } - n++ - } - - if len(template.PermittedDNSDomains) > 0 && - !oidInExtensions(oidExtensionNameConstraints, template.ExtraExtensions) { - ret[n].Id = oidExtensionNameConstraints - ret[n].Critical = template.PermittedDNSDomainsCritical - - var out nameConstraints - out.Permitted = make([]generalSubtree, len(template.PermittedDNSDomains)) - for i, permitted := range template.PermittedDNSDomains { - out.Permitted[i] = generalSubtree{Name: permitted} - } - ret[n].Value, err = asn1.Marshal(out) - if err != nil { - return - } - n++ - } - - if len(template.CRLDistributionPoints) > 0 && - !oidInExtensions(oidExtensionCRLDistributionPoints, template.ExtraExtensions) { - ret[n].Id = oidExtensionCRLDistributionPoints - - var crlDp []distributionPoint - for _, name := range template.CRLDistributionPoints { - rawFullName, _ := asn1.Marshal(asn1.RawValue{Tag: 6, Class: 2, Bytes: []byte(name)}) - - dp := distributionPoint{ - DistributionPoint: distributionPointName{ - FullName: asn1.RawValue{Tag: 0, Class: 2, IsCompound: true, Bytes: rawFullName}, - }, - } - crlDp = append(crlDp, dp) - } - - ret[n].Value, err = asn1.Marshal(crlDp) - if err != nil { - return - } - n++ - } - - // Adding another extension here? Remember to update the maximum number - // of elements in the make() at the top of the function. - - return append(ret[:n], template.ExtraExtensions...), nil -} - -func subjectBytes(cert *Certificate) ([]byte, error) { - if len(cert.RawSubject) > 0 { - return cert.RawSubject, nil - } - - return asn1.Marshal(cert.Subject.ToRDNSequence()) -} - -// signingParamsForPublicKey returns the parameters to use for signing with -// priv. If requestedSigAlgo is not zero then it overrides the default -// signature algorithm. -func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgorithm) (hashFunc crypto.Hash, sigAlgo pkix.AlgorithmIdentifier, err error) { - var pubType PublicKeyAlgorithm - - switch pub := pub.(type) { - case *rsa.PublicKey: - pubType = RSA - hashFunc = crypto.SHA256 - sigAlgo.Algorithm = oidSignatureSHA256WithRSA - sigAlgo.Parameters = asn1.RawValue{ - Tag: 5, - } - - case *ecdsa.PublicKey: - pubType = ECDSA - - switch pub.Curve { - case elliptic.P224(), elliptic.P256(): - hashFunc = crypto.SHA256 - sigAlgo.Algorithm = oidSignatureECDSAWithSHA256 - case elliptic.P384(): - hashFunc = crypto.SHA384 - sigAlgo.Algorithm = oidSignatureECDSAWithSHA384 - case elliptic.P521(): - hashFunc = crypto.SHA512 - sigAlgo.Algorithm = oidSignatureECDSAWithSHA512 - default: - err = errors.New("x509: unknown elliptic curve") - } - - default: - err = errors.New("x509: only RSA and ECDSA keys supported") - } - - if err != nil { - return - } - - if requestedSigAlgo == 0 { - return - } - - found := false - for _, details := range signatureAlgorithmDetails { - if details.algo == requestedSigAlgo { - if details.pubKeyAlgo != pubType { - err = errors.New("x509: requested SignatureAlgorithm does not match private key type") - return - } - sigAlgo.Algorithm, hashFunc = details.oid, details.hash - if hashFunc == 0 { - err = errors.New("x509: cannot sign with hash function requested") - return - } - found = true - break - } - } - - if !found { - err = errors.New("x509: unknown SignatureAlgorithm") - } - - return -} - -// CreateCertificate creates a new certificate based on a template. The -// following members of template are used: SerialNumber, Subject, NotBefore, -// NotAfter, KeyUsage, ExtKeyUsage, UnknownExtKeyUsage, BasicConstraintsValid, -// IsCA, MaxPathLen, SubjectKeyId, DNSNames, PermittedDNSDomainsCritical, -// PermittedDNSDomains, SignatureAlgorithm. -// -// The certificate is signed by parent. If parent is equal to template then the -// certificate is self-signed. The parameter pub is the public key of the -// signee and priv is the private key of the signer. -// -// The returned slice is the certificate in DER encoding. -// -// All keys types that are implemented via crypto.Signer are supported (This -// includes *rsa.PublicKey and *ecdsa.PublicKey.) -func CreateCertificate(rand io.Reader, template, parent *Certificate, pub, priv interface{}) (cert []byte, err error) { - key, ok := priv.(crypto.Signer) - if !ok { - return nil, errors.New("x509: certificate private key does not implement crypto.Signer") - } - - hashFunc, signatureAlgorithm, err := signingParamsForPublicKey(key.Public(), template.SignatureAlgorithm) - if err != nil { - return nil, err - } - - publicKeyBytes, publicKeyAlgorithm, err := marshalPublicKey(pub) - if err != nil { - return nil, err - } - - if len(parent.SubjectKeyId) > 0 { - template.AuthorityKeyId = parent.SubjectKeyId - } - - extensions, err := buildExtensions(template) - if err != nil { - return - } - - asn1Issuer, err := subjectBytes(parent) - if err != nil { - return - } - - asn1Subject, err := subjectBytes(template) - if err != nil { - return - } - - encodedPublicKey := asn1.BitString{BitLength: len(publicKeyBytes) * 8, Bytes: publicKeyBytes} - c := tbsCertificate{ - Version: 2, - SerialNumber: template.SerialNumber, - SignatureAlgorithm: signatureAlgorithm, - Issuer: asn1.RawValue{FullBytes: asn1Issuer}, - Validity: validity{template.NotBefore.UTC(), template.NotAfter.UTC()}, - Subject: asn1.RawValue{FullBytes: asn1Subject}, - PublicKey: publicKeyInfo{nil, publicKeyAlgorithm, encodedPublicKey}, - Extensions: extensions, - } - - tbsCertContents, err := asn1.Marshal(c) - if err != nil { - return - } - - c.Raw = tbsCertContents - - h := hashFunc.New() - h.Write(tbsCertContents) - digest := h.Sum(nil) - - var signature []byte - signature, err = key.Sign(rand, digest, hashFunc) - if err != nil { - return - } - - return asn1.Marshal(certificate{ - nil, - c, - signatureAlgorithm, - asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, - }) -} - -// pemCRLPrefix is the magic string that indicates that we have a PEM encoded -// CRL. -var pemCRLPrefix = []byte("-----BEGIN X509 CRL") - -// pemType is the type of a PEM encoded CRL. -var pemType = "X509 CRL" - -// ParseCRL parses a CRL from the given bytes. It's often the case that PEM -// encoded CRLs will appear where they should be DER encoded, so this function -// will transparently handle PEM encoding as long as there isn't any leading -// garbage. -func ParseCRL(crlBytes []byte) (certList *pkix.CertificateList, err error) { - if bytes.HasPrefix(crlBytes, pemCRLPrefix) { - block, _ := pem.Decode(crlBytes) - if block != nil && block.Type == pemType { - crlBytes = block.Bytes - } - } - return ParseDERCRL(crlBytes) -} - -// ParseDERCRL parses a DER encoded CRL from the given bytes. -func ParseDERCRL(derBytes []byte) (certList *pkix.CertificateList, err error) { - certList = new(pkix.CertificateList) - if rest, err := asn1.Unmarshal(derBytes, certList); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after CRL") - } - return certList, nil -} - -// CreateCRL returns a DER encoded CRL, signed by this Certificate, that -// contains the given list of revoked certificates. -func (c *Certificate) CreateCRL(rand io.Reader, priv interface{}, revokedCerts []pkix.RevokedCertificate, now, expiry time.Time) (crlBytes []byte, err error) { - key, ok := priv.(crypto.Signer) - if !ok { - return nil, errors.New("x509: certificate private key does not implement crypto.Signer") - } - - hashFunc, signatureAlgorithm, err := signingParamsForPublicKey(key.Public(), 0) - if err != nil { - return nil, err - } - - tbsCertList := pkix.TBSCertificateList{ - Version: 1, - Signature: signatureAlgorithm, - Issuer: c.Subject.ToRDNSequence(), - ThisUpdate: now.UTC(), - NextUpdate: expiry.UTC(), - RevokedCertificates: revokedCerts, - } - - // Authority Key Id - if len(c.SubjectKeyId) > 0 { - var aki pkix.Extension - aki.Id = oidExtensionAuthorityKeyId - aki.Value, err = asn1.Marshal(authKeyId{Id: c.SubjectKeyId}) - if err != nil { - return - } - tbsCertList.Extensions = append(tbsCertList.Extensions, aki) - } - - tbsCertListContents, err := asn1.Marshal(tbsCertList) - if err != nil { - return - } - - h := hashFunc.New() - h.Write(tbsCertListContents) - digest := h.Sum(nil) - - var signature []byte - signature, err = key.Sign(rand, digest, hashFunc) - if err != nil { - return - } - - return asn1.Marshal(pkix.CertificateList{ - TBSCertList: tbsCertList, - SignatureAlgorithm: signatureAlgorithm, - SignatureValue: asn1.BitString{Bytes: signature, BitLength: len(signature) * 8}, - }) -} - -// CertificateRequest represents a PKCS #10, certificate signature request. -type CertificateRequest struct { - Raw []byte // Complete ASN.1 DER content (CSR, signature algorithm and signature). - RawTBSCertificateRequest []byte // Certificate request info part of raw ASN.1 DER content. - RawSubjectPublicKeyInfo []byte // DER encoded SubjectPublicKeyInfo. - RawSubject []byte // DER encoded Subject. - - Version int - Signature []byte - SignatureAlgorithm SignatureAlgorithm - - PublicKeyAlgorithm PublicKeyAlgorithm - PublicKey interface{} - - Subject pkix.Name - - // Attributes is a collection of attributes providing - // additional information about the subject of the certificate. - // See RFC 2986 section 4.1. - Attributes []pkix.AttributeTypeAndValueSET - - // Extensions contains raw X.509 extensions. When parsing CSRs, this - // can be used to extract extensions that are not parsed by this - // package. - Extensions []pkix.Extension - - // ExtraExtensions contains extensions to be copied, raw, into any - // marshaled CSR. Values override any extensions that would otherwise - // be produced based on the other fields but are overridden by any - // extensions specified in Attributes. - // - // The ExtraExtensions field is not populated when parsing CSRs, see - // Extensions. - ExtraExtensions []pkix.Extension - - // Subject Alternate Name values. - DNSNames []string - EmailAddresses []string - IPAddresses []net.IP -} - -// These structures reflect the ASN.1 structure of X.509 certificate -// signature requests (see RFC 2986): - -type tbsCertificateRequest struct { - Raw asn1.RawContent - Version int - Subject asn1.RawValue - PublicKey publicKeyInfo - RawAttributes []asn1.RawValue `asn1:"tag:0"` -} - -type certificateRequest struct { - Raw asn1.RawContent - TBSCSR tbsCertificateRequest - SignatureAlgorithm pkix.AlgorithmIdentifier - SignatureValue asn1.BitString -} - -// oidExtensionRequest is a PKCS#9 OBJECT IDENTIFIER that indicates requested -// extensions in a CSR. -var oidExtensionRequest = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 14} - -// newRawAttributes converts AttributeTypeAndValueSETs from a template -// CertificateRequest's Attributes into tbsCertificateRequest RawAttributes. -func newRawAttributes(attributes []pkix.AttributeTypeAndValueSET) ([]asn1.RawValue, error) { - var rawAttributes []asn1.RawValue - b, err := asn1.Marshal(attributes) - rest, err := asn1.Unmarshal(b, &rawAttributes) - if err != nil { - return nil, err - } - if len(rest) != 0 { - return nil, errors.New("x509: failed to unmarshall raw CSR Attributes") - } - return rawAttributes, nil -} - -// parseRawAttributes Unmarshals RawAttributes intos AttributeTypeAndValueSETs. -func parseRawAttributes(rawAttributes []asn1.RawValue) []pkix.AttributeTypeAndValueSET { - var attributes []pkix.AttributeTypeAndValueSET - for _, rawAttr := range rawAttributes { - var attr pkix.AttributeTypeAndValueSET - rest, err := asn1.Unmarshal(rawAttr.FullBytes, &attr) - // Ignore attributes that don't parse into pkix.AttributeTypeAndValueSET - // (i.e.: challengePassword or unstructuredName). - if err == nil && len(rest) == 0 { - attributes = append(attributes, attr) - } - } - return attributes -} - -// CreateCertificateRequest creates a new certificate based on a template. The -// following members of template are used: Subject, Attributes, -// SignatureAlgorithm, Extensions, DNSNames, EmailAddresses, and IPAddresses. -// The private key is the private key of the signer. -// -// The returned slice is the certificate request in DER encoding. -// -// All keys types that are implemented via crypto.Signer are supported (This -// includes *rsa.PublicKey and *ecdsa.PublicKey.) -func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv interface{}) (csr []byte, err error) { - key, ok := priv.(crypto.Signer) - if !ok { - return nil, errors.New("x509: certificate private key does not implement crypto.Signer") - } - - var hashFunc crypto.Hash - var sigAlgo pkix.AlgorithmIdentifier - hashFunc, sigAlgo, err = signingParamsForPublicKey(key.Public(), template.SignatureAlgorithm) - if err != nil { - return nil, err - } - - var publicKeyBytes []byte - var publicKeyAlgorithm pkix.AlgorithmIdentifier - publicKeyBytes, publicKeyAlgorithm, err = marshalPublicKey(key.Public()) - if err != nil { - return nil, err - } - - var extensions []pkix.Extension - - if (len(template.DNSNames) > 0 || len(template.EmailAddresses) > 0 || len(template.IPAddresses) > 0) && - !oidInExtensions(oidExtensionSubjectAltName, template.ExtraExtensions) { - sanBytes, err := marshalSANs(template.DNSNames, template.EmailAddresses, template.IPAddresses) - if err != nil { - return nil, err - } - - extensions = append(extensions, pkix.Extension{ - Id: oidExtensionSubjectAltName, - Value: sanBytes, - }) - } - - extensions = append(extensions, template.ExtraExtensions...) - - var attributes []pkix.AttributeTypeAndValueSET - attributes = append(attributes, template.Attributes...) - - if len(extensions) > 0 { - // specifiedExtensions contains all the extensions that we - // found specified via template.Attributes. - specifiedExtensions := make(map[string]bool) - - for _, atvSet := range template.Attributes { - if !atvSet.Type.Equal(oidExtensionRequest) { - continue - } - - for _, atvs := range atvSet.Value { - for _, atv := range atvs { - specifiedExtensions[atv.Type.String()] = true - } - } - } - - atvs := make([]pkix.AttributeTypeAndValue, 0, len(extensions)) - for _, e := range extensions { - if specifiedExtensions[e.Id.String()] { - // Attributes already contained a value for - // this extension and it takes priority. - continue - } - - atvs = append(atvs, pkix.AttributeTypeAndValue{ - // There is no place for the critical flag in a CSR. - Type: e.Id, - Value: e.Value, - }) - } - - // Append the extensions to an existing attribute if possible. - appended := false - for _, atvSet := range attributes { - if !atvSet.Type.Equal(oidExtensionRequest) || len(atvSet.Value) == 0 { - continue - } - - atvSet.Value[0] = append(atvSet.Value[0], atvs...) - appended = true - break - } - - // Otherwise, add a new attribute for the extensions. - if !appended { - attributes = append(attributes, pkix.AttributeTypeAndValueSET{ - Type: oidExtensionRequest, - Value: [][]pkix.AttributeTypeAndValue{ - atvs, - }, - }) - } - } - - asn1Subject := template.RawSubject - if len(asn1Subject) == 0 { - asn1Subject, err = asn1.Marshal(template.Subject.ToRDNSequence()) - if err != nil { - return - } - } - - rawAttributes, err := newRawAttributes(attributes) - if err != nil { - return - } - - tbsCSR := tbsCertificateRequest{ - Version: 0, // PKCS #10, RFC 2986 - Subject: asn1.RawValue{FullBytes: asn1Subject}, - PublicKey: publicKeyInfo{ - Algorithm: publicKeyAlgorithm, - PublicKey: asn1.BitString{ - Bytes: publicKeyBytes, - BitLength: len(publicKeyBytes) * 8, - }, - }, - RawAttributes: rawAttributes, - } - - tbsCSRContents, err := asn1.Marshal(tbsCSR) - if err != nil { - return - } - tbsCSR.Raw = tbsCSRContents - - h := hashFunc.New() - h.Write(tbsCSRContents) - digest := h.Sum(nil) - - var signature []byte - signature, err = key.Sign(rand, digest, hashFunc) - if err != nil { - return - } - - return asn1.Marshal(certificateRequest{ - TBSCSR: tbsCSR, - SignatureAlgorithm: sigAlgo, - SignatureValue: asn1.BitString{ - Bytes: signature, - BitLength: len(signature) * 8, - }, - }) -} - -// ParseCertificateRequest parses a single certificate request from the -// given ASN.1 DER data. -func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error) { - var csr certificateRequest - - rest, err := asn1.Unmarshal(asn1Data, &csr) - if err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, asn1.SyntaxError{Msg: "trailing data"} - } - - return parseCertificateRequest(&csr) -} - -func parseCertificateRequest(in *certificateRequest) (*CertificateRequest, error) { - out := &CertificateRequest{ - Raw: in.Raw, - RawTBSCertificateRequest: in.TBSCSR.Raw, - RawSubjectPublicKeyInfo: in.TBSCSR.PublicKey.Raw, - RawSubject: in.TBSCSR.Subject.FullBytes, - - Signature: in.SignatureValue.RightAlign(), - SignatureAlgorithm: getSignatureAlgorithmFromOID(in.SignatureAlgorithm.Algorithm), - - PublicKeyAlgorithm: getPublicKeyAlgorithmFromOID(in.TBSCSR.PublicKey.Algorithm.Algorithm), - - Version: in.TBSCSR.Version, - Attributes: parseRawAttributes(in.TBSCSR.RawAttributes), - } - - var err error - out.PublicKey, err = parsePublicKey(out.PublicKeyAlgorithm, &in.TBSCSR.PublicKey) - if err != nil { - return nil, err - } - - var subject pkix.RDNSequence - if rest, err := asn1.Unmarshal(in.TBSCSR.Subject.FullBytes, &subject); err != nil { - return nil, err - } else if len(rest) != 0 { - return nil, errors.New("x509: trailing data after X.509 Subject") - } - - out.Subject.FillFromRDNSequence(&subject) - - var extensions []pkix.AttributeTypeAndValue - - for _, atvSet := range out.Attributes { - if !atvSet.Type.Equal(oidExtensionRequest) { - continue - } - - for _, atvs := range atvSet.Value { - extensions = append(extensions, atvs...) - } - } - - out.Extensions = make([]pkix.Extension, 0, len(extensions)) - - for _, e := range extensions { - value, ok := e.Value.([]byte) - if !ok { - return nil, errors.New("x509: extension attribute contained non-OCTET STRING data") - } - - out.Extensions = append(out.Extensions, pkix.Extension{ - Id: e.Type, - Value: value, - }) - - if len(e.Type) == 4 && e.Type[0] == 2 && e.Type[1] == 5 && e.Type[2] == 29 { - switch e.Type[3] { - case 17: - out.DNSNames, out.EmailAddresses, out.IPAddresses, err = parseSANExtension(value) - if err != nil { - return nil, err - } - } - } - } - - return out, nil -} - -// CheckSignature verifies that the signature on c is a valid signature -func (c *CertificateRequest) CheckSignature() (err error) { - return checkSignature(c.SignatureAlgorithm, c.RawTBSCertificateRequest, c.Signature, c.PublicKey) -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test.go deleted file mode 100644 index f4f9fa2f7f9e39e322281679a2687181d7459927..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test.go +++ /dev/null @@ -1,1178 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -import ( - "bytes" - "crypto/dsa" - "crypto/ecdsa" - "crypto/elliptic" - "crypto/rand" - "crypto/rsa" - _ "crypto/sha256" - _ "crypto/sha512" - "crypto/x509/pkix" - "encoding/asn1" - "encoding/base64" - "encoding/hex" - "encoding/pem" - "internal/testenv" - "math/big" - "net" - "os/exec" - "reflect" - "testing" - "time" -) - -func TestParsePKCS1PrivateKey(t *testing.T) { - block, _ := pem.Decode([]byte(pemPrivateKey)) - priv, err := ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - t.Errorf("Failed to parse private key: %s", err) - return - } - if priv.PublicKey.N.Cmp(rsaPrivateKey.PublicKey.N) != 0 || - priv.PublicKey.E != rsaPrivateKey.PublicKey.E || - priv.D.Cmp(rsaPrivateKey.D) != 0 || - priv.Primes[0].Cmp(rsaPrivateKey.Primes[0]) != 0 || - priv.Primes[1].Cmp(rsaPrivateKey.Primes[1]) != 0 { - t.Errorf("got:%+v want:%+v", priv, rsaPrivateKey) - } - - // This private key includes an invalid prime that - // rsa.PrivateKey.Validate should reject. - data := []byte("0\x16\x02\x00\x02\x02\u007f\x00\x02\x0200\x02\x0200\x02\x02\x00\x01\x02\x02\u007f\x00") - if _, err := ParsePKCS1PrivateKey(data); err == nil { - t.Errorf("parsing invalid private key did not result in an error") - } -} - -func TestParsePKIXPublicKey(t *testing.T) { - block, _ := pem.Decode([]byte(pemPublicKey)) - pub, err := ParsePKIXPublicKey(block.Bytes) - if err != nil { - t.Errorf("Failed to parse RSA public key: %s", err) - return - } - rsaPub, ok := pub.(*rsa.PublicKey) - if !ok { - t.Errorf("Value returned from ParsePKIXPublicKey was not an RSA public key") - return - } - - pubBytes2, err := MarshalPKIXPublicKey(rsaPub) - if err != nil { - t.Errorf("Failed to marshal RSA public key for the second time: %s", err) - return - } - if !bytes.Equal(pubBytes2, block.Bytes) { - t.Errorf("Reserialization of public key didn't match. got %x, want %x", pubBytes2, block.Bytes) - } -} - -var pemPublicKey = `-----BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3VoPN9PKUjKFLMwOge6+ -wnDi8sbETGIx2FKXGgqtAKpzmem53kRGEQg8WeqRmp12wgp74TGpkEXsGae7RS1k -enJCnma4fii+noGH7R0qKgHvPrI2Bwa9hzsH8tHxpyM3qrXslOmD45EH9SxIDUBJ -FehNdaPbLP1gFyahKMsdfxFJLUvbUycuZSJ2ZnIgeVxwm4qbSvZInL9Iu4FzuPtg -fINKcbbovy1qq4KvPIrXzhbY3PWDc6btxCf3SE0JdE1MCPThntB62/bLMSQ7xdDR -FF53oIpvxe/SCOymfWq/LW849Ytv3Xwod0+wzAP8STXG4HSELS4UedPYeHJJJYcZ -+QIDAQAB ------END PUBLIC KEY----- -` - -var pemPrivateKey = `-----BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 -fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu -/ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu -RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/ -EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A -IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS -tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V ------END RSA PRIVATE KEY----- -` - -func bigFromString(s string) *big.Int { - ret := new(big.Int) - ret.SetString(s, 10) - return ret -} - -func fromBase10(base10 string) *big.Int { - i := new(big.Int) - i.SetString(base10, 10) - return i -} - -func bigFromHexString(s string) *big.Int { - ret := new(big.Int) - ret.SetString(s, 16) - return ret -} - -var rsaPrivateKey = &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: bigFromString("9353930466774385905609975137998169297361893554149986716853295022578535724979677252958524466350471210367835187480748268864277464700638583474144061408845077"), - E: 65537, - }, - D: bigFromString("7266398431328116344057699379749222532279343923819063639497049039389899328538543087657733766554155839834519529439851673014800261285757759040931985506583861"), - Primes: []*big.Int{ - bigFromString("98920366548084643601728869055592650835572950932266967461790948584315647051443"), - bigFromString("94560208308847015747498523884063394671606671904944666360068158221458669711639"), - }, -} - -func TestMarshalRSAPrivateKey(t *testing.T) { - priv := &rsa.PrivateKey{ - PublicKey: rsa.PublicKey{ - N: fromBase10("16346378922382193400538269749936049106320265317511766357599732575277382844051791096569333808598921852351577762718529818072849191122419410612033592401403764925096136759934497687765453905884149505175426053037420486697072448609022753683683718057795566811401938833367954642951433473337066311978821180526439641496973296037000052546108507805269279414789035461158073156772151892452251106173507240488993608650881929629163465099476849643165682709047462010581308719577053905787496296934240246311806555924593059995202856826239801816771116902778517096212527979497399966526283516447337775509777558018145573127308919204297111496233"), - E: 3, - }, - D: fromBase10("10897585948254795600358846499957366070880176878341177571733155050184921896034527397712889205732614568234385175145686545381899460748279607074689061600935843283397424506622998458510302603922766336783617368686090042765718290914099334449154829375179958369993407724946186243249568928237086215759259909861748642124071874879861299389874230489928271621259294894142840428407196932444474088857746123104978617098858619445675532587787023228852383149557470077802718705420275739737958953794088728369933811184572620857678792001136676902250566845618813972833750098806496641114644760255910789397593428910198080271317419213080834885003"), - Primes: []*big.Int{ - fromBase10("1025363189502892836833747188838978207017355117492483312747347695538428729137306368764177201532277413433182799108299960196606011786562992097313508180436744488171474690412562218914213688661311117337381958560443"), - fromBase10("3467903426626310123395340254094941045497208049900750380025518552334536945536837294961497712862519984786362199788654739924501424784631315081391467293694361474867825728031147665777546570788493758372218019373"), - fromBase10("4597024781409332673052708605078359346966325141767460991205742124888960305710298765592730135879076084498363772408626791576005136245060321874472727132746643162385746062759369754202494417496879741537284589047"), - }, - } - - derBytes := MarshalPKCS1PrivateKey(priv) - - priv2, err := ParsePKCS1PrivateKey(derBytes) - if err != nil { - t.Errorf("error parsing serialized key: %s", err) - return - } - if priv.PublicKey.N.Cmp(priv2.PublicKey.N) != 0 || - priv.PublicKey.E != priv2.PublicKey.E || - priv.D.Cmp(priv2.D) != 0 || - len(priv2.Primes) != 3 || - priv.Primes[0].Cmp(priv2.Primes[0]) != 0 || - priv.Primes[1].Cmp(priv2.Primes[1]) != 0 || - priv.Primes[2].Cmp(priv2.Primes[2]) != 0 { - t.Errorf("got:%+v want:%+v", priv, priv2) - } -} - -type matchHostnamesTest struct { - pattern, host string - ok bool -} - -var matchHostnamesTests = []matchHostnamesTest{ - {"a.b.c", "a.b.c", true}, - {"a.b.c", "b.b.c", false}, - {"", "b.b.c", false}, - {"a.b.c", "", false}, - {"example.com", "example.com", true}, - {"example.com", "www.example.com", false}, - {"*.example.com", "example.com", false}, - {"*.example.com", "www.example.com", true}, - {"*.example.com", "www.example.com.", true}, - {"*.example.com", "xyz.www.example.com", false}, - {"*.*.example.com", "xyz.www.example.com", false}, - {"*.www.*.com", "xyz.www.example.com", false}, - {"*bar.example.com", "foobar.example.com", false}, - {"f*.example.com", "foobar.example.com", false}, - {"", ".", false}, - {".", "", false}, - {".", ".", false}, - {"example.com", "example.com.", true}, - {"example.com.", "example.com", true}, - {"example.com.", "example.com.", true}, - {"*.com.", "example.com.", true}, - {"*.com.", "example.com", true}, - {"*.com", "example.com", true}, - {"*.com", "example.com.", true}, -} - -func TestMatchHostnames(t *testing.T) { - for i, test := range matchHostnamesTests { - r := matchHostnames(test.pattern, test.host) - if r != test.ok { - t.Errorf("#%d mismatch got: %t want: %t when matching '%s' against '%s'", i, r, test.ok, test.host, test.pattern) - } - } -} - -func TestMatchIP(t *testing.T) { - // Check that pattern matching is working. - c := &Certificate{ - DNSNames: []string{"*.foo.bar.baz"}, - Subject: pkix.Name{ - CommonName: "*.foo.bar.baz", - }, - } - err := c.VerifyHostname("quux.foo.bar.baz") - if err != nil { - t.Fatalf("VerifyHostname(quux.foo.bar.baz): %v", err) - } - - // But check that if we change it to be matching against an IP address, - // it is rejected. - c = &Certificate{ - DNSNames: []string{"*.2.3.4"}, - Subject: pkix.Name{ - CommonName: "*.2.3.4", - }, - } - err = c.VerifyHostname("1.2.3.4") - if err == nil { - t.Fatalf("VerifyHostname(1.2.3.4) should have failed, did not") - } - - c = &Certificate{ - IPAddresses: []net.IP{net.ParseIP("127.0.0.1"), net.ParseIP("::1")}, - } - err = c.VerifyHostname("127.0.0.1") - if err != nil { - t.Fatalf("VerifyHostname(127.0.0.1): %v", err) - } - err = c.VerifyHostname("::1") - if err != nil { - t.Fatalf("VerifyHostname(::1): %v", err) - } - err = c.VerifyHostname("[::1]") - if err != nil { - t.Fatalf("VerifyHostname([::1]): %v", err) - } -} - -func TestCertificateParse(t *testing.T) { - s, _ := hex.DecodeString(certBytes) - certs, err := ParseCertificates(s) - if err != nil { - t.Error(err) - } - if len(certs) != 2 { - t.Errorf("Wrong number of certs: got %d want 2", len(certs)) - return - } - - err = certs[0].CheckSignatureFrom(certs[1]) - if err != nil { - t.Error(err) - } - - if err := certs[0].VerifyHostname("mail.google.com"); err != nil { - t.Error(err) - } - - const expectedExtensions = 4 - if n := len(certs[0].Extensions); n != expectedExtensions { - t.Errorf("want %d extensions, got %d", expectedExtensions, n) - } -} - -var certBytes = "308203223082028ba00302010202106edf0d9499fd4533dd1297fc42a93be1300d06092a864886" + - "f70d0101050500304c310b3009060355040613025a4131253023060355040a131c546861777465" + - "20436f6e73756c74696e67202850747929204c74642e311630140603550403130d546861777465" + - "20534743204341301e170d3039303332353136343932395a170d3130303332353136343932395a" + - "3069310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630" + - "140603550407130d4d6f756e7461696e205669657731133011060355040a130a476f6f676c6520" + - "496e63311830160603550403130f6d61696c2e676f6f676c652e636f6d30819f300d06092a8648" + - "86f70d010101050003818d0030818902818100c5d6f892fccaf5614b064149e80a2c9581a218ef" + - "41ec35bd7a58125ae76f9ea54ddc893abbeb029f6b73616bf0ffd868791fba7af9c4aebf3706ba" + - "3eeaeed27435b4ddcfb157c05f351d66aa87fee0de072d66d773affbd36ab78bef090e0cc861a9" + - "03ac90dd98b51c9c41566c017f0beec3bff391051ffba0f5cc6850ad2a590203010001a381e730" + - "81e430280603551d250421301f06082b0601050507030106082b06010505070302060960864801" + - "86f842040130360603551d1f042f302d302ba029a0278625687474703a2f2f63726c2e74686177" + - "74652e636f6d2f54686177746553474343412e63726c307206082b060105050701010466306430" + - "2206082b060105050730018616687474703a2f2f6f6373702e7468617774652e636f6d303e0608" + - "2b060105050730028632687474703a2f2f7777772e7468617774652e636f6d2f7265706f736974" + - "6f72792f5468617774655f5347435f43412e637274300c0603551d130101ff04023000300d0609" + - "2a864886f70d01010505000381810062f1f3050ebc105e497c7aedf87e24d2f4a986bb3b837bd1" + - "9b91ebcad98b065992f6bd2b49b7d6d3cb2e427a99d606c7b1d46352527fac39e6a8b6726de5bf" + - "70212a52cba07634a5e332011bd1868e78eb5e3c93cf03072276786f207494feaa0ed9d53b2110" + - "a76571f90209cdae884385c882587030ee15f33d761e2e45a6bc308203233082028ca003020102" + - "020430000002300d06092a864886f70d0101050500305f310b3009060355040613025553311730" + - "15060355040a130e566572695369676e2c20496e632e31373035060355040b132e436c61737320" + - "33205075626c6963205072696d6172792043657274696669636174696f6e20417574686f726974" + - "79301e170d3034303531333030303030305a170d3134303531323233353935395a304c310b3009" + - "060355040613025a4131253023060355040a131c54686177746520436f6e73756c74696e672028" + - "50747929204c74642e311630140603550403130d5468617774652053474320434130819f300d06" + - "092a864886f70d010101050003818d0030818902818100d4d367d08d157faecd31fe7d1d91a13f" + - "0b713cacccc864fb63fc324b0794bd6f80ba2fe10493c033fc093323e90b742b71c403c6d2cde2" + - "2ff50963cdff48a500bfe0e7f388b72d32de9836e60aad007bc4644a3b847503f270927d0e62f5" + - "21ab693684317590f8bfc76c881b06957cc9e5a8de75a12c7a68dfd5ca1c875860190203010001" + - "a381fe3081fb30120603551d130101ff040830060101ff020100300b0603551d0f040403020106" + - "301106096086480186f842010104040302010630280603551d110421301fa41d301b3119301706" + - "035504031310507269766174654c6162656c332d313530310603551d1f042a30283026a024a022" + - "8620687474703a2f2f63726c2e766572697369676e2e636f6d2f706361332e63726c303206082b" + - "0601050507010104263024302206082b060105050730018616687474703a2f2f6f6373702e7468" + - "617774652e636f6d30340603551d25042d302b06082b0601050507030106082b06010505070302" + - "06096086480186f8420401060a6086480186f845010801300d06092a864886f70d010105050003" + - "81810055ac63eadea1ddd2905f9f0bce76be13518f93d9052bc81b774bad6950a1eededcfddb07" + - "e9e83994dcab72792f06bfab8170c4a8edea5334edef1e53d906c7562bd15cf4d18a8eb42bb137" + - "9048084225c53e8acb7feb6f04d16dc574a2f7a27c7b603c77cd0ece48027f012fb69b37e02a2a" + - "36dcd585d6ace53f546f961e05af" - -func TestCreateSelfSignedCertificate(t *testing.T) { - random := rand.Reader - - block, _ := pem.Decode([]byte(pemPrivateKey)) - rsaPriv, err := ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - t.Fatalf("Failed to parse private key: %s", err) - } - - ecdsaPriv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("Failed to generate ECDSA key: %s", err) - } - - tests := []struct { - name string - pub, priv interface{} - checkSig bool - sigAlgo SignatureAlgorithm - }{ - {"RSA/RSA", &rsaPriv.PublicKey, rsaPriv, true, SHA1WithRSA}, - {"RSA/ECDSA", &rsaPriv.PublicKey, ecdsaPriv, false, ECDSAWithSHA384}, - {"ECDSA/RSA", &ecdsaPriv.PublicKey, rsaPriv, false, SHA256WithRSA}, - {"ECDSA/ECDSA", &ecdsaPriv.PublicKey, ecdsaPriv, true, ECDSAWithSHA1}, - } - - testExtKeyUsage := []ExtKeyUsage{ExtKeyUsageClientAuth, ExtKeyUsageServerAuth} - testUnknownExtKeyUsage := []asn1.ObjectIdentifier{[]int{1, 2, 3}, []int{2, 59, 1}} - extraExtensionData := []byte("extra extension") - - for _, test := range tests { - commonName := "test.example.com" - template := Certificate{ - SerialNumber: big.NewInt(1), - Subject: pkix.Name{ - CommonName: commonName, - Organization: []string{"Σ Acme Co"}, - Country: []string{"US"}, - ExtraNames: []pkix.AttributeTypeAndValue{ - { - Type: []int{2, 5, 4, 42}, - Value: "Gopher", - }, - // This should override the Country, above. - { - Type: []int{2, 5, 4, 6}, - Value: "NL", - }, - }, - }, - NotBefore: time.Unix(1000, 0), - NotAfter: time.Unix(100000, 0), - - SignatureAlgorithm: test.sigAlgo, - - SubjectKeyId: []byte{1, 2, 3, 4}, - KeyUsage: KeyUsageCertSign, - - ExtKeyUsage: testExtKeyUsage, - UnknownExtKeyUsage: testUnknownExtKeyUsage, - - BasicConstraintsValid: true, - IsCA: true, - - OCSPServer: []string{"http://ocsp.example.com"}, - IssuingCertificateURL: []string{"http://crt.example.com/ca1.crt"}, - - DNSNames: []string{"test.example.com"}, - EmailAddresses: []string{"gopher@golang.org"}, - IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.ParseIP("2001:4860:0:2001::68")}, - - PolicyIdentifiers: []asn1.ObjectIdentifier{[]int{1, 2, 3}}, - PermittedDNSDomains: []string{".example.com", "example.com"}, - - CRLDistributionPoints: []string{"http://crl1.example.com/ca1.crl", "http://crl2.example.com/ca1.crl"}, - - ExtraExtensions: []pkix.Extension{ - { - Id: []int{1, 2, 3, 4}, - Value: extraExtensionData, - }, - // This extension should override the SubjectKeyId, above. - { - Id: oidExtensionSubjectKeyId, - Critical: false, - Value: []byte{0x04, 0x04, 4, 3, 2, 1}, - }, - }, - } - - derBytes, err := CreateCertificate(random, &template, &template, test.pub, test.priv) - if err != nil { - t.Errorf("%s: failed to create certificate: %s", test.name, err) - continue - } - - cert, err := ParseCertificate(derBytes) - if err != nil { - t.Errorf("%s: failed to parse certificate: %s", test.name, err) - continue - } - - if len(cert.PolicyIdentifiers) != 1 || !cert.PolicyIdentifiers[0].Equal(template.PolicyIdentifiers[0]) { - t.Errorf("%s: failed to parse policy identifiers: got:%#v want:%#v", test.name, cert.PolicyIdentifiers, template.PolicyIdentifiers) - } - - if len(cert.PermittedDNSDomains) != 2 || cert.PermittedDNSDomains[0] != ".example.com" || cert.PermittedDNSDomains[1] != "example.com" { - t.Errorf("%s: failed to parse name constraints: %#v", test.name, cert.PermittedDNSDomains) - } - - if cert.Subject.CommonName != commonName { - t.Errorf("%s: subject wasn't correctly copied from the template. Got %s, want %s", test.name, cert.Subject.CommonName, commonName) - } - - if len(cert.Subject.Country) != 1 || cert.Subject.Country[0] != "NL" { - t.Errorf("%s: ExtraNames didn't override Country", test.name) - } - - found := false - for _, atv := range cert.Subject.Names { - if atv.Type.Equal([]int{2, 5, 4, 42}) { - found = true - break - } - } - if !found { - t.Errorf("%s: Names didn't contain oid 2.5.4.42 from ExtraNames", test.name) - } - - if cert.Issuer.CommonName != commonName { - t.Errorf("%s: issuer wasn't correctly copied from the template. Got %s, want %s", test.name, cert.Issuer.CommonName, commonName) - } - - if cert.SignatureAlgorithm != test.sigAlgo { - t.Errorf("%s: SignatureAlgorithm wasn't copied from template. Got %v, want %v", test.name, cert.SignatureAlgorithm, test.sigAlgo) - } - - if !reflect.DeepEqual(cert.ExtKeyUsage, testExtKeyUsage) { - t.Errorf("%s: extkeyusage wasn't correctly copied from the template. Got %v, want %v", test.name, cert.ExtKeyUsage, testExtKeyUsage) - } - - if !reflect.DeepEqual(cert.UnknownExtKeyUsage, testUnknownExtKeyUsage) { - t.Errorf("%s: unknown extkeyusage wasn't correctly copied from the template. Got %v, want %v", test.name, cert.UnknownExtKeyUsage, testUnknownExtKeyUsage) - } - - if !reflect.DeepEqual(cert.OCSPServer, template.OCSPServer) { - t.Errorf("%s: OCSP servers differ from template. Got %v, want %v", test.name, cert.OCSPServer, template.OCSPServer) - } - - if !reflect.DeepEqual(cert.IssuingCertificateURL, template.IssuingCertificateURL) { - t.Errorf("%s: Issuing certificate URLs differ from template. Got %v, want %v", test.name, cert.IssuingCertificateURL, template.IssuingCertificateURL) - } - - if !reflect.DeepEqual(cert.DNSNames, template.DNSNames) { - t.Errorf("%s: SAN DNS names differ from template. Got %v, want %v", test.name, cert.DNSNames, template.DNSNames) - } - - if !reflect.DeepEqual(cert.EmailAddresses, template.EmailAddresses) { - t.Errorf("%s: SAN emails differ from template. Got %v, want %v", test.name, cert.EmailAddresses, template.EmailAddresses) - } - - if !reflect.DeepEqual(cert.IPAddresses, template.IPAddresses) { - t.Errorf("%s: SAN IPs differ from template. Got %v, want %v", test.name, cert.IPAddresses, template.IPAddresses) - } - - if !reflect.DeepEqual(cert.CRLDistributionPoints, template.CRLDistributionPoints) { - t.Errorf("%s: CRL distribution points differ from template. Got %v, want %v", test.name, cert.CRLDistributionPoints, template.CRLDistributionPoints) - } - - if !bytes.Equal(cert.SubjectKeyId, []byte{4, 3, 2, 1}) { - t.Errorf("%s: ExtraExtensions didn't override SubjectKeyId", test.name) - } - - if bytes.Index(derBytes, extraExtensionData) == -1 { - t.Errorf("%s: didn't find extra extension in DER output", test.name) - } - - if test.checkSig { - err = cert.CheckSignatureFrom(cert) - if err != nil { - t.Errorf("%s: signature verification failed: %s", test.name, err) - } - } - } -} - -func TestUnknownCriticalExtension(t *testing.T) { - priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("Failed to generate ECDSA key: %s", err) - } - - oids := []asn1.ObjectIdentifier{ - // This OID is in the PKIX arc, but unknown. - asn1.ObjectIdentifier{2, 5, 29, 999999}, - // This is a nonsense, unassigned OID. - asn1.ObjectIdentifier{1, 2, 3, 4}, - } - - for _, oid := range oids { - template := Certificate{ - SerialNumber: big.NewInt(1), - Subject: pkix.Name{ - CommonName: "foo", - }, - NotBefore: time.Unix(1000, 0), - NotAfter: time.Now().AddDate(1, 0, 0), - - BasicConstraintsValid: true, - IsCA: true, - - KeyUsage: KeyUsageCertSign, - ExtKeyUsage: []ExtKeyUsage{ExtKeyUsageServerAuth}, - - ExtraExtensions: []pkix.Extension{ - { - Id: oid, - Critical: true, - Value: nil, - }, - }, - } - - derBytes, err := CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) - if err != nil { - t.Fatalf("failed to create certificate: %s", err) - } - - cert, err := ParseCertificate(derBytes) - if err != nil { - t.Fatalf("Certificate with unknown critical extension was not parsed: %s", err) - } - - roots := NewCertPool() - roots.AddCert(cert) - - // Setting Roots ensures that Verify won't delegate to the OS - // library and thus the correct error should always be - // returned. - _, err = cert.Verify(VerifyOptions{Roots: roots}) - if err == nil { - t.Fatal("Certificate with unknown critical extension was verified without error") - } - if _, ok := err.(UnhandledCriticalExtension); !ok { - t.Fatalf("Error was %#v, but wanted one of type UnhandledCriticalExtension", err) - } - - cert.UnhandledCriticalExtensions = nil - if _, err = cert.Verify(VerifyOptions{Roots: roots}); err != nil { - t.Errorf("Certificate failed to verify after unhandled critical extensions were cleared: %s", err) - } - } -} - -// Self-signed certificate using ECDSA with SHA1 & secp256r1 -var ecdsaSHA1CertPem = ` ------BEGIN CERTIFICATE----- -MIICDjCCAbUCCQDF6SfN0nsnrjAJBgcqhkjOPQQBMIGPMQswCQYDVQQGEwJVUzET -MBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEVMBMG -A1UECgwMR29vZ2xlLCBJbmMuMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG -CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIwMjAyMDUw -WhcNMjIwNTE4MjAyMDUwWjCBjzELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm -b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTATBgNVBAoMDEdvb2dsZSwg -SW5jLjEXMBUGA1UEAwwOd3d3Lmdvb2dsZS5jb20xIzAhBgkqhkiG9w0BCQEWFGdv -bGFuZy1kZXZAZ21haWwuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE/Wgn -WQDo5+bz71T0327ERgd5SDDXFbXLpzIZDXTkjpe8QTEbsF+ezsQfrekrpDPC4Cd3 -P9LY0tG+aI8IyVKdUjAJBgcqhkjOPQQBA0gAMEUCIGlsqMcRqWVIWTD6wXwe6Jk2 -DKxL46r/FLgJYnzBEH99AiEA3fBouObsvV1R3oVkb4BQYnD4/4LeId6lAT43YvyV -a/A= ------END CERTIFICATE----- -` - -// Self-signed certificate using ECDSA with SHA256 & secp256r1 -var ecdsaSHA256p256CertPem = ` ------BEGIN CERTIFICATE----- -MIICDzCCAbYCCQDlsuMWvgQzhTAKBggqhkjOPQQDAjCBjzELMAkGA1UEBhMCVVMx -EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFTAT -BgNVBAoMDEdvb2dsZSwgSW5jLjEXMBUGA1UEAwwOd3d3Lmdvb2dsZS5jb20xIzAh -BgkqhkiG9w0BCQEWFGdvbGFuZy1kZXZAZ21haWwuY29tMB4XDTEyMDUyMTAwMTkx -NloXDTIyMDUxOTAwMTkxNlowgY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxp -Zm9ybmlhMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MRUwEwYDVQQKDAxHb29nbGUs -IEluYy4xFzAVBgNVBAMMDnd3dy5nb29nbGUuY29tMSMwIQYJKoZIhvcNAQkBFhRn -b2xhbmctZGV2QGdtYWlsLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABPMt -2ErhxAty5EJRu9yM+MTy+hUXm3pdW1ensAv382KoGExSXAFWP7pjJnNtHO+XSwVm -YNtqjcAGFKpweoN//kQwCgYIKoZIzj0EAwIDRwAwRAIgIYSaUA/IB81gjbIw/hUV -70twxJr5EcgOo0hLp3Jm+EYCIFDO3NNcgmURbJ1kfoS3N/0O+irUtoPw38YoNkqJ -h5wi ------END CERTIFICATE----- -` - -// Self-signed certificate using ECDSA with SHA256 & secp384r1 -var ecdsaSHA256p384CertPem = ` ------BEGIN CERTIFICATE----- -MIICSjCCAdECCQDje/no7mXkVzAKBggqhkjOPQQDAjCBjjELMAkGA1UEBhMCVVMx -EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDAS -BgNVBAoMC0dvb2dsZSwgSW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG -CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIxMDYxMDM0 -WhcNMjIwNTE5MDYxMDM0WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm -b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDASBgNVBAoMC0dvb2dsZSwg -SW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEGCSqGSIb3DQEJARYUZ29s -YW5nLWRldkBnbWFpbC5jb20wdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARRuzRNIKRK -jIktEmXanNmrTR/q/FaHXLhWRZ6nHWe26Fw7Rsrbk+VjGy4vfWtNn7xSFKrOu5ze -qxKnmE0h5E480MNgrUiRkaGO2GMJJVmxx20aqkXOk59U8yGA4CghE6MwCgYIKoZI -zj0EAwIDZwAwZAIwBZEN8gvmRmfeP/9C1PRLzODIY4JqWub2PLRT4mv9GU+yw3Gr -PU9A3CHMdEcdw/MEAjBBO1lId8KOCh9UZunsSMfqXiVurpzmhWd6VYZ/32G+M+Mh -3yILeYQzllt/g0rKVRk= ------END CERTIFICATE----- -` - -// Self-signed certificate using ECDSA with SHA384 & secp521r1 -var ecdsaSHA384p521CertPem = ` ------BEGIN CERTIFICATE----- -MIICljCCAfcCCQDhp1AFD/ahKjAKBggqhkjOPQQDAzCBjjELMAkGA1UEBhMCVVMx -EzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDAS -BgNVBAoMC0dvb2dsZSwgSW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEG -CSqGSIb3DQEJARYUZ29sYW5nLWRldkBnbWFpbC5jb20wHhcNMTIwNTIxMTUwNDI5 -WhcNMjIwNTE5MTUwNDI5WjCBjjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlm -b3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxFDASBgNVBAoMC0dvb2dsZSwg -SW5jMRcwFQYDVQQDDA53d3cuZ29vZ2xlLmNvbTEjMCEGCSqGSIb3DQEJARYUZ29s -YW5nLWRldkBnbWFpbC5jb20wgZswEAYHKoZIzj0CAQYFK4EEACMDgYYABACqx9Rv -IssRs1LWYcNN+WffwlHw4Tv3y8/LIAA9MF1ZScIonU9nRMxt4a2uGJVCPDw6JHpz -PaYc0E9puLoE9AfKpwFr59Jkot7dBg55SKPEFkddoip/rvmN7NPAWjMBirOwjOkm -8FPthvPhGPqsu9AvgVuHu3PosWiHGNrhh379pva8MzAKBggqhkjOPQQDAwOBjAAw -gYgCQgEHNmswkUdPpHqrVxp9PvLVl+xxPuHBkT+75z9JizyxtqykHQo9Uh6SWCYH -BF9KLolo01wMt8DjoYP5Fb3j5MH7xwJCAbWZzTOp4l4DPkIvAh4LeC4VWbwPPyqh -kBg71w/iEcSY3wUKgHGcJJrObZw7wys91I5kENljqw/Samdr3ka+jBJa ------END CERTIFICATE----- -` - -var ecdsaTests = []struct { - sigAlgo SignatureAlgorithm - pemCert string -}{ - {ECDSAWithSHA1, ecdsaSHA1CertPem}, - {ECDSAWithSHA256, ecdsaSHA256p256CertPem}, - {ECDSAWithSHA256, ecdsaSHA256p384CertPem}, - {ECDSAWithSHA384, ecdsaSHA384p521CertPem}, -} - -func TestECDSA(t *testing.T) { - for i, test := range ecdsaTests { - pemBlock, _ := pem.Decode([]byte(test.pemCert)) - cert, err := ParseCertificate(pemBlock.Bytes) - if err != nil { - t.Errorf("%d: failed to parse certificate: %s", i, err) - continue - } - if sa := cert.SignatureAlgorithm; sa != test.sigAlgo { - t.Errorf("%d: signature algorithm is %v, want %v", i, sa, test.sigAlgo) - } - if parsedKey, ok := cert.PublicKey.(*ecdsa.PublicKey); !ok { - t.Errorf("%d: wanted an ECDSA public key but found: %#v", i, parsedKey) - } - if pka := cert.PublicKeyAlgorithm; pka != ECDSA { - t.Errorf("%d: public key algorithm is %v, want ECDSA", i, pka) - } - if err = cert.CheckSignatureFrom(cert); err != nil { - t.Errorf("%d: certificate verification failed: %s", i, err) - } - } -} - -// Self-signed certificate using DSA with SHA1 -var dsaCertPem = `-----BEGIN CERTIFICATE----- -MIIEDTCCA82gAwIBAgIJALHPghaoxeDhMAkGByqGSM44BAMweTELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAk5DMQ8wDQYDVQQHEwZOZXd0b24xFDASBgNVBAoTC0dvb2ds -ZSwgSW5jMRIwEAYDVQQDEwlKb24gQWxsaWUxIjAgBgkqhkiG9w0BCQEWE2pvbmFs -bGllQGdvb2dsZS5jb20wHhcNMTEwNTE0MDMwMTQ1WhcNMTEwNjEzMDMwMTQ1WjB5 -MQswCQYDVQQGEwJVUzELMAkGA1UECBMCTkMxDzANBgNVBAcTBk5ld3RvbjEUMBIG -A1UEChMLR29vZ2xlLCBJbmMxEjAQBgNVBAMTCUpvbiBBbGxpZTEiMCAGCSqGSIb3 -DQEJARYTam9uYWxsaWVAZ29vZ2xlLmNvbTCCAbcwggEsBgcqhkjOOAQBMIIBHwKB -gQC8hLUnQ7FpFYu4WXTj6DKvXvz8QrJkNJCVMTpKAT7uBpobk32S5RrPKXocd4gN -8lyGB9ggS03EVlEwXvSmO0DH2MQtke2jl9j1HLydClMf4sbx5V6TV9IFw505U1iW -jL7awRMgxge+FsudtJK254FjMFo03ZnOQ8ZJJ9E6AEDrlwIVAJpnBn9moyP11Ox5 -Asc/5dnjb6dPAoGBAJFHd4KVv1iTVCvEG6gGiYop5DJh28hUQcN9kul+2A0yPUSC -X93oN00P8Vh3eYgSaCWZsha7zDG53MrVJ0Zf6v/X/CoZNhLldeNOepivTRAzn+Rz -kKUYy5l1sxYLHQKF0UGNCXfFKZT0PCmgU+PWhYNBBMn6/cIh44vp85ideo5CA4GE -AAKBgFmifCafzeRaohYKXJgMGSEaggCVCRq5xdyDCat+wbOkjC4mfG01/um3G8u5 -LxasjlWRKTR/tcAL7t0QuokVyQaYdVypZXNaMtx1db7YBuHjj3aP+8JOQRI9xz8c -bp5NDJ5pISiFOv4p3GZfqZPcqckDt78AtkQrmnal2txhhjF6o4HeMIHbMB0GA1Ud -DgQWBBQVyyr7hO11ZFFpWX50298Sa3V+rzCBqwYDVR0jBIGjMIGggBQVyyr7hO11 -ZFFpWX50298Sa3V+r6F9pHsweTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAk5DMQ8w -DQYDVQQHEwZOZXd0b24xFDASBgNVBAoTC0dvb2dsZSwgSW5jMRIwEAYDVQQDEwlK -b24gQWxsaWUxIjAgBgkqhkiG9w0BCQEWE2pvbmFsbGllQGdvb2dsZS5jb22CCQCx -z4IWqMXg4TAMBgNVHRMEBTADAQH/MAkGByqGSM44BAMDLwAwLAIUPtn/5j8Q1jJI -7ggOIsgrhgUdjGQCFCsmDq1H11q9+9Wp9IMeGrTSKHIM ------END CERTIFICATE----- -` - -func TestParseCertificateWithDsaPublicKey(t *testing.T) { - expectedKey := &dsa.PublicKey{ - Parameters: dsa.Parameters{ - P: bigFromHexString("00BC84B52743B169158BB85974E3E832AF5EFCFC42B264349095313A4A013EEE069A1B937D92E51ACF297A1C77880DF25C8607D8204B4DC45651305EF4A63B40C7D8C42D91EDA397D8F51CBC9D0A531FE2C6F1E55E9357D205C39D395358968CBEDAC11320C607BE16CB9DB492B6E78163305A34DD99CE43C64927D13A0040EB97"), - Q: bigFromHexString("009A67067F66A323F5D4EC7902C73FE5D9E36FA74F"), - G: bigFromHexString("009147778295BF5893542BC41BA806898A29E43261DBC85441C37D92E97ED80D323D44825FDDE8374D0FF15877798812682599B216BBCC31B9DCCAD527465FEAFFD7FC2A193612E575E34E7A98AF4D10339FE47390A518CB9975B3160B1D0285D1418D0977C52994F43C29A053E3D685834104C9FAFDC221E38BE9F3989D7A8E42"), - }, - Y: bigFromHexString("59A27C269FCDE45AA2160A5C980C19211A820095091AB9C5DC8309AB7EC1B3A48C2E267C6D35FEE9B71BCBB92F16AC8E559129347FB5C00BEEDD10BA8915C90698755CA965735A32DC7575BED806E1E38F768FFBC24E41123DC73F1C6E9E4D0C9E692128853AFE29DC665FA993DCA9C903B7BF00B6442B9A76A5DADC6186317A"), - } - pemBlock, _ := pem.Decode([]byte(dsaCertPem)) - cert, err := ParseCertificate(pemBlock.Bytes) - if err != nil { - t.Fatalf("Failed to parse certificate: %s", err) - } - if cert.PublicKeyAlgorithm != DSA { - t.Errorf("Parsed key algorithm was not DSA") - } - parsedKey, ok := cert.PublicKey.(*dsa.PublicKey) - if !ok { - t.Fatalf("Parsed key was not a DSA key: %s", err) - } - if expectedKey.Y.Cmp(parsedKey.Y) != 0 || - expectedKey.P.Cmp(parsedKey.P) != 0 || - expectedKey.Q.Cmp(parsedKey.Q) != 0 || - expectedKey.G.Cmp(parsedKey.G) != 0 { - t.Fatal("Parsed key differs from expected key") - } -} - -func TestParseCertificateWithDSASignatureAlgorithm(t *testing.T) { - pemBlock, _ := pem.Decode([]byte(dsaCertPem)) - cert, err := ParseCertificate(pemBlock.Bytes) - if err != nil { - t.Fatalf("Failed to parse certificate: %s", err) - } - if cert.SignatureAlgorithm != DSAWithSHA1 { - t.Errorf("Parsed signature algorithm was not DSAWithSHA1") - } -} - -func TestVerifyCertificateWithDSASignature(t *testing.T) { - pemBlock, _ := pem.Decode([]byte(dsaCertPem)) - cert, err := ParseCertificate(pemBlock.Bytes) - if err != nil { - t.Fatalf("Failed to parse certificate: %s", err) - } - // test cert is self-signed - if err = cert.CheckSignatureFrom(cert); err != nil { - t.Fatalf("DSA Certificate verification failed: %s", err) - } -} - -const pemCertificate = `-----BEGIN CERTIFICATE----- -MIIB5DCCAZCgAwIBAgIBATALBgkqhkiG9w0BAQUwLTEQMA4GA1UEChMHQWNtZSBDbzEZMBcGA1UE -AxMQdGVzdC5leGFtcGxlLmNvbTAeFw03MDAxMDEwMDE2NDBaFw03MDAxMDIwMzQ2NDBaMC0xEDAO -BgNVBAoTB0FjbWUgQ28xGTAXBgNVBAMTEHRlc3QuZXhhbXBsZS5jb20wWjALBgkqhkiG9w0BAQED -SwAwSAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0fd7Ai2KW5ToIwzFo -fvJcS/STa6HA5gQenRUCAwEAAaOBnjCBmzAOBgNVHQ8BAf8EBAMCAAQwDwYDVR0TAQH/BAUwAwEB -/zANBgNVHQ4EBgQEAQIDBDAPBgNVHSMECDAGgAQBAgMEMBsGA1UdEQQUMBKCEHRlc3QuZXhhbXBs -ZS5jb20wDwYDVR0gBAgwBjAEBgIqAzAqBgNVHR4EIzAhoB8wDoIMLmV4YW1wbGUuY29tMA2CC2V4 -YW1wbGUuY29tMAsGCSqGSIb3DQEBBQNBAHKZKoS1wEQOGhgklx4+/yFYQlnqwKXvar/ZecQvJwui -0seMQnwBhwdBkHfVIU2Fu5VUMRyxlf0ZNaDXcpU581k= ------END CERTIFICATE-----` - -func TestCRLCreation(t *testing.T) { - block, _ := pem.Decode([]byte(pemPrivateKey)) - priv, _ := ParsePKCS1PrivateKey(block.Bytes) - block, _ = pem.Decode([]byte(pemCertificate)) - cert, _ := ParseCertificate(block.Bytes) - - now := time.Unix(1000, 0) - expiry := time.Unix(10000, 0) - - revokedCerts := []pkix.RevokedCertificate{ - { - SerialNumber: big.NewInt(1), - RevocationTime: now, - }, - { - SerialNumber: big.NewInt(42), - RevocationTime: now, - }, - } - - crlBytes, err := cert.CreateCRL(rand.Reader, priv, revokedCerts, now, expiry) - if err != nil { - t.Errorf("error creating CRL: %s", err) - } - - _, err = ParseDERCRL(crlBytes) - if err != nil { - t.Errorf("error reparsing CRL: %s", err) - } -} - -func fromBase64(in string) []byte { - out := make([]byte, base64.StdEncoding.DecodedLen(len(in))) - n, err := base64.StdEncoding.Decode(out, []byte(in)) - if err != nil { - panic("failed to base64 decode") - } - return out[:n] -} - -func TestParseDERCRL(t *testing.T) { - derBytes := fromBase64(derCRLBase64) - certList, err := ParseDERCRL(derBytes) - if err != nil { - t.Errorf("error parsing: %s", err) - return - } - numCerts := len(certList.TBSCertList.RevokedCertificates) - expected := 88 - if numCerts != expected { - t.Errorf("bad number of revoked certificates. got: %d want: %d", numCerts, expected) - } - - if certList.HasExpired(time.Unix(1302517272, 0)) { - t.Errorf("CRL has expired (but shouldn't have)") - } - - // Can't check the signature here without a package cycle. -} - -func TestCRLWithoutExpiry(t *testing.T) { - derBytes := fromBase64("MIHYMIGZMAkGByqGSM44BAMwEjEQMA4GA1UEAxMHQ2FybERTUxcNOTkwODI3MDcwMDAwWjBpMBMCAgDIFw05OTA4MjIwNzAwMDBaMBMCAgDJFw05OTA4MjIwNzAwMDBaMBMCAgDTFw05OTA4MjIwNzAwMDBaMBMCAgDSFw05OTA4MjIwNzAwMDBaMBMCAgDUFw05OTA4MjQwNzAwMDBaMAkGByqGSM44BAMDLwAwLAIUfmVSdjP+NHMX0feW+aDU2G1cfT0CFAJ6W7fVWxjBz4fvftok8yqDnDWh") - certList, err := ParseDERCRL(derBytes) - if err != nil { - t.Fatal(err) - } - if !certList.TBSCertList.NextUpdate.IsZero() { - t.Errorf("NextUpdate is not the zero value") - } -} - -func TestParsePEMCRL(t *testing.T) { - pemBytes := fromBase64(pemCRLBase64) - certList, err := ParseCRL(pemBytes) - if err != nil { - t.Errorf("error parsing: %s", err) - return - } - numCerts := len(certList.TBSCertList.RevokedCertificates) - expected := 2 - if numCerts != expected { - t.Errorf("bad number of revoked certificates. got: %d want: %d", numCerts, expected) - } - - if certList.HasExpired(time.Unix(1302517272, 0)) { - t.Errorf("CRL has expired (but shouldn't have)") - } - - // Can't check the signature here without a package cycle. -} - -func TestImports(t *testing.T) { - testenv.MustHaveGoRun(t) - - if err := exec.Command("go", "run", "x509_test_import.go").Run(); err != nil { - t.Errorf("failed to run x509_test_import.go: %s", err) - } -} - -const derCRLBase64 = "MIINqzCCDJMCAQEwDQYJKoZIhvcNAQEFBQAwVjEZMBcGA1UEAxMQUEtJIEZJTk1FQ0NBTklDQTEVMBMGA1UEChMMRklOTUVDQ0FOSUNBMRUwEwYDVQQLEwxGSU5NRUNDQU5JQ0ExCzAJBgNVBAYTAklUFw0xMTA1MDQxNjU3NDJaFw0xMTA1MDQyMDU3NDJaMIIMBzAhAg4Ze1od49Lt1qIXBydAzhcNMDkwNzE2MDg0MzIyWjAAMCECDl0HSL9bcZ1Ci/UHJ0DPFw0wOTA3MTYwODQzMTNaMAAwIQIOESB9tVAmX3cY7QcnQNAXDTA5MDcxNjA4NDUyMlowADAhAg4S1tGAQ3mHt8uVBydA1RcNMDkwODA0MTUyNTIyWjAAMCECDlQ249Y7vtC25ScHJ0DWFw0wOTA4MDQxNTI1MzdaMAAwIQIOISMop3NkA4PfYwcnQNkXDTA5MDgwNDExMDAzNFowADAhAg56/BMoS29KEShTBydA2hcNMDkwODA0MTEwMTAzWjAAMCECDnBp/22HPH5CSWoHJ0DbFw0wOTA4MDQxMDU0NDlaMAAwIQIOV9IP+8CD8bK+XAcnQNwXDTA5MDgwNDEwNTcxN1owADAhAg4v5aRz0IxWqYiXBydA3RcNMDkwODA0MTA1NzQ1WjAAMCECDlOU34VzvZAybQwHJ0DeFw0wOTA4MDQxMDU4MjFaMAAwIAINO4CD9lluIxcwBydBAxcNMDkwNzIyMTUzMTU5WjAAMCECDgOllfO8Y1QA7/wHJ0ExFw0wOTA3MjQxMTQxNDNaMAAwIQIOJBX7jbiCdRdyjgcnQUQXDTA5MDkxNjA5MzAwOFowADAhAg5iYSAgmDrlH/RZBydBRRcNMDkwOTE2MDkzMDE3WjAAMCECDmu6k6srP3jcMaQHJ0FRFw0wOTA4MDQxMDU2NDBaMAAwIQIOX8aHlO0V+WVH4QcnQVMXDTA5MDgwNDEwNTcyOVowADAhAg5flK2rg3NnsRgDBydBzhcNMTEwMjAxMTUzMzQ2WjAAMCECDg35yJDL1jOPTgoHJ0HPFw0xMTAyMDExNTM0MjZaMAAwIQIOMyFJ6+e9iiGVBQcnQdAXDTA5MDkxODEzMjAwNVowADAhAg5Emb/Oykucmn8fBydB1xcNMDkwOTIxMTAxMDQ3WjAAMCECDjQKCncV+MnUavMHJ0HaFw0wOTA5MjIwODE1MjZaMAAwIQIOaxiFUt3dpd+tPwcnQfQXDTEwMDYxODA4NDI1MVowADAhAg5G7P8nO0tkrMt7BydB9RcNMTAwNjE4MDg0MjMwWjAAMCECDmTCC3SXhmDRst4HJ0H2Fw0wOTA5MjgxMjA3MjBaMAAwIQIOHoGhUr/pRwzTKgcnQfcXDTA5MDkyODEyMDcyNFowADAhAg50wrcrCiw8mQmPBydCBBcNMTAwMjE2MTMwMTA2WjAAMCECDifWmkvwyhEqwEcHJ0IFFw0xMDAyMTYxMzAxMjBaMAAwIQIOfgPmlW9fg+osNgcnQhwXDTEwMDQxMzA5NTIwMFowADAhAg4YHAGuA6LgCk7tBydCHRcNMTAwNDEzMDk1MTM4WjAAMCECDi1zH1bxkNJhokAHJ0IsFw0xMDA0MTMwOTU5MzBaMAAwIQIOMipNccsb/wo2fwcnQi0XDTEwMDQxMzA5NTkwMFowADAhAg46lCmvPl4GpP6ABydCShcNMTAwMTE5MDk1MjE3WjAAMCECDjaTcaj+wBpcGAsHJ0JLFw0xMDAxMTkwOTUyMzRaMAAwIQIOOMC13EOrBuxIOQcnQloXDTEwMDIwMTA5NDcwNVowADAhAg5KmZl+krz4RsmrBydCWxcNMTAwMjAxMDk0NjQwWjAAMCECDmLG3zQJ/fzdSsUHJ0JiFw0xMDAzMDEwOTUxNDBaMAAwIQIOP39ksgHdojf4owcnQmMXDTEwMDMwMTA5NTExN1owADAhAg4LDQzvWNRlD6v9BydCZBcNMTAwMzAxMDk0NjIyWjAAMCECDkmNfeclaFhIaaUHJ0JlFw0xMDAzMDEwOTQ2MDVaMAAwIQIOT/qWWfpH/m8NTwcnQpQXDTEwMDUxMTA5MTgyMVowADAhAg5m/ksYxvCEgJSvBydClRcNMTAwNTExMDkxODAxWjAAMCECDgvf3Ohq6JOPU9AHJ0KWFw0xMDA1MTEwOTIxMjNaMAAwIQIOKSPas10z4jNVIQcnQpcXDTEwMDUxMTA5MjEwMlowADAhAg4mCWmhoZ3lyKCDBydCohcNMTEwNDI4MTEwMjI1WjAAMCECDkeiyRsBMK0Gvr4HJ0KjFw0xMTA0MjgxMTAyMDdaMAAwIQIOa09b/nH2+55SSwcnQq4XDTExMDQwMTA4Mjk0NlowADAhAg5O7M7iq7gGplr1BydCrxcNMTEwNDAxMDgzMDE3WjAAMCECDjlT6mJxUjTvyogHJ0K1Fw0xMTAxMjcxNTQ4NTJaMAAwIQIODS/l4UUFLe21NAcnQrYXDTExMDEyNzE1NDgyOFowADAhAg5lPRA0XdOUF6lSBydDHhcNMTEwMTI4MTQzNTA1WjAAMCECDixKX4fFGGpENwgHJ0MfFw0xMTAxMjgxNDM1MzBaMAAwIQIORNBkqsPnpKTtbAcnQ08XDTEwMDkwOTA4NDg0MlowADAhAg5QL+EMM3lohedEBydDUBcNMTAwOTA5MDg0ODE5WjAAMCECDlhDnHK+HiTRAXcHJ0NUFw0xMDEwMTkxNjIxNDBaMAAwIQIOdBFqAzq/INz53gcnQ1UXDTEwMTAxOTE2MjA0NFowADAhAg4OjR7s8MgKles1BydDWhcNMTEwMTI3MTY1MzM2WjAAMCECDmfR/elHee+d0SoHJ0NbFw0xMTAxMjcxNjUzNTZaMAAwIQIOBTKv2ui+KFMI+wcnQ5YXDTEwMDkxNTEwMjE1N1owADAhAg49F3c/GSah+oRUBydDmxcNMTEwMTI3MTczMjMzWjAAMCECDggv4I61WwpKFMMHJ0OcFw0xMTAxMjcxNzMyNTVaMAAwIQIOXx/Y8sEvwS10LAcnQ6UXDTExMDEyODExMjkzN1owADAhAg5LSLbnVrSKaw/9BydDphcNMTEwMTI4MTEyOTIwWjAAMCECDmFFoCuhKUeACQQHJ0PfFw0xMTAxMTExMDE3MzdaMAAwIQIOQTDdFh2fSPF6AAcnQ+AXDTExMDExMTEwMTcxMFowADAhAg5B8AOXX61FpvbbBydD5RcNMTAxMDA2MTAxNDM2WjAAMCECDh41P2Gmi7PkwI4HJ0PmFw0xMDEwMDYxMDE2MjVaMAAwIQIOWUHGLQCd+Ale9gcnQ/0XDTExMDUwMjA3NTYxMFowADAhAg5Z2c9AYkikmgWOBydD/hcNMTEwNTAyMDc1NjM0WjAAMCECDmf/UD+/h8nf+74HJ0QVFw0xMTA0MTUwNzI4MzNaMAAwIQIOICvj4epy3MrqfwcnRBYXDTExMDQxNTA3Mjg1NlowADAhAg4bouRMfOYqgv4xBydEHxcNMTEwMzA4MTYyNDI1WjAAMCECDhebWHGoKiTp7pEHJ0QgFw0xMTAzMDgxNjI0NDhaMAAwIQIOX+qnxxAqJ8LtawcnRDcXDTExMDEzMTE1MTIyOFowADAhAg4j0fICqZ+wkOdqBydEOBcNMTEwMTMxMTUxMTQxWjAAMCECDhmXjsV4SUpWtAMHJ0RLFw0xMTAxMjgxMTI0MTJaMAAwIQIODno/w+zG43kkTwcnREwXDTExMDEyODExMjM1MlowADAhAg4b1gc88767Fr+LBydETxcNMTEwMTI4MTEwMjA4WjAAMCECDn+M3Pa1w2nyFeUHJ0RQFw0xMTAxMjgxMDU4NDVaMAAwIQIOaduoyIH61tqybAcnRJUXDTEwMTIxNTA5NDMyMlowADAhAg4nLqQPkyi3ESAKBydElhcNMTAxMjE1MDk0MzM2WjAAMCECDi504NIMH8578gQHJ0SbFw0xMTAyMTQxNDA1NDFaMAAwIQIOGuaM8PDaC5u1egcnRJwXDTExMDIxNDE0MDYwNFowADAhAg4ehYq/BXGnB5PWBydEnxcNMTEwMjA0MDgwOTUxWjAAMCECDkSD4eS4FxW5H20HJ0SgFw0xMTAyMDQwODA5MjVaMAAwIQIOOCcb6ilYObt1egcnRKEXDTExMDEyNjEwNDEyOVowADAhAg58tISWCCwFnKGnBydEohcNMTEwMjA0MDgxMzQyWjAAMCECDn5rjtabY/L/WL0HJ0TJFw0xMTAyMDQxMTAzNDFaMAAwDQYJKoZIhvcNAQEFBQADggEBAGnF2Gs0+LNiYCW1Ipm83OXQYP/bd5tFFRzyz3iepFqNfYs4D68/QihjFoRHQoXEB0OEe1tvaVnnPGnEOpi6krwekquMxo4H88B5SlyiFIqemCOIss0SxlCFs69LmfRYvPPvPEhoXtQ3ZThe0UvKG83GOklhvGl6OaiRf4Mt+m8zOT4Wox/j6aOBK6cw6qKCdmD+Yj1rrNqFGg1CnSWMoD6S6mwNgkzwdBUJZ22BwrzAAo4RHa2Uy3ef1FjwD0XtU5N3uDSxGGBEDvOe5z82rps3E22FpAA8eYl8kaXtmWqyvYU0epp4brGuTxCuBMCAsxt/OjIjeNNQbBGkwxgfYA0=" - -const pemCRLBase64 = "LS0tLS1CRUdJTiBYNTA5IENSTC0tLS0tDQpNSUlCOWpDQ0FWOENBUUV3RFFZSktvWklodmNOQVFFRkJRQXdiREVhTUJnR0ExVUVDaE1SVWxOQklGTmxZM1Z5DQphWFI1SUVsdVl5NHhIakFjQmdOVkJBTVRGVkpUUVNCUWRXSnNhV01nVW05dmRDQkRRU0IyTVRFdU1Dd0dDU3FHDQpTSWIzRFFFSkFSWWZjbk5oYTJWdmJuSnZiM1J6YVdkdVFISnpZWE5sWTNWeWFYUjVMbU52YlJjTk1URXdNakl6DQpNVGt5T0RNd1doY05NVEV3T0RJeU1Ua3lPRE13V2pDQmpEQktBaEVBckRxb2g5RkhKSFhUN09QZ3V1bjQrQmNODQpNRGt4TVRBeU1UUXlOekE1V2pBbU1Bb0dBMVVkRlFRRENnRUpNQmdHQTFVZEdBUVJHQTh5TURBNU1URXdNakUwDQpNalExTlZvd1BnSVJBTEd6blowOTVQQjVhQU9MUGc1N2ZNTVhEVEF5TVRBeU16RTBOVEF4TkZvd0dqQVlCZ05WDQpIUmdFRVJnUE1qQXdNakV3TWpNeE5EVXdNVFJhb0RBd0xqQWZCZ05WSFNNRUdEQVdnQlQxVERGNlVRTS9MTmVMDQpsNWx2cUhHUXEzZzltekFMQmdOVkhSUUVCQUlDQUlRd0RRWUpLb1pJaHZjTkFRRUZCUUFEZ1lFQUZVNUFzNk16DQpxNVBSc2lmYW9iUVBHaDFhSkx5QytNczVBZ2MwYld5QTNHQWR4dXI1U3BQWmVSV0NCamlQL01FSEJXSkNsQkhQDQpHUmNxNXlJZDNFakRrYUV5eFJhK2k2N0x6dmhJNmMyOUVlNks5cFNZd2ppLzdSVWhtbW5Qclh0VHhsTDBsckxyDQptUVFKNnhoRFJhNUczUUE0Q21VZHNITnZicnpnbUNZcHZWRT0NCi0tLS0tRU5EIFg1MDkgQ1JMLS0tLS0NCg0K" - -func TestCreateCertificateRequest(t *testing.T) { - random := rand.Reader - - block, _ := pem.Decode([]byte(pemPrivateKey)) - rsaPriv, err := ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - t.Fatalf("Failed to parse private key: %s", err) - } - - ecdsa256Priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) - if err != nil { - t.Fatalf("Failed to generate ECDSA key: %s", err) - } - - ecdsa384Priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader) - if err != nil { - t.Fatalf("Failed to generate ECDSA key: %s", err) - } - - ecdsa521Priv, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) - if err != nil { - t.Fatalf("Failed to generate ECDSA key: %s", err) - } - - tests := []struct { - name string - priv interface{} - sigAlgo SignatureAlgorithm - }{ - {"RSA", rsaPriv, SHA1WithRSA}, - {"ECDSA-256", ecdsa256Priv, ECDSAWithSHA1}, - {"ECDSA-384", ecdsa384Priv, ECDSAWithSHA1}, - {"ECDSA-521", ecdsa521Priv, ECDSAWithSHA1}, - } - - for _, test := range tests { - template := CertificateRequest{ - Subject: pkix.Name{ - CommonName: "test.example.com", - Organization: []string{"Σ Acme Co"}, - }, - SignatureAlgorithm: test.sigAlgo, - DNSNames: []string{"test.example.com"}, - EmailAddresses: []string{"gopher@golang.org"}, - IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.ParseIP("2001:4860:0:2001::68")}, - } - - derBytes, err := CreateCertificateRequest(random, &template, test.priv) - if err != nil { - t.Errorf("%s: failed to create certificate request: %s", test.name, err) - continue - } - - out, err := ParseCertificateRequest(derBytes) - if err != nil { - t.Errorf("%s: failed to create certificate request: %s", test.name, err) - continue - } - - err = out.CheckSignature() - if err != nil { - t.Errorf("%s: failed to check certificate request signature: %s", test.name, err) - continue - } - - if out.Subject.CommonName != template.Subject.CommonName { - t.Errorf("%s: output subject common name and template subject common name don't match", test.name) - } else if len(out.Subject.Organization) != len(template.Subject.Organization) { - t.Errorf("%s: output subject organisation and template subject organisation don't match", test.name) - } else if len(out.DNSNames) != len(template.DNSNames) { - t.Errorf("%s: output DNS names and template DNS names don't match", test.name) - } else if len(out.EmailAddresses) != len(template.EmailAddresses) { - t.Errorf("%s: output email addresses and template email addresses don't match", test.name) - } else if len(out.IPAddresses) != len(template.IPAddresses) { - t.Errorf("%s: output IP addresses and template IP addresses names don't match", test.name) - } - } -} - -func marshalAndParseCSR(t *testing.T, template *CertificateRequest) *CertificateRequest { - block, _ := pem.Decode([]byte(pemPrivateKey)) - rsaPriv, err := ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - t.Fatal(err) - } - - derBytes, err := CreateCertificateRequest(rand.Reader, template, rsaPriv) - if err != nil { - t.Fatal(err) - } - - csr, err := ParseCertificateRequest(derBytes) - if err != nil { - t.Fatal(err) - } - - return csr -} - -func TestCertificateRequestOverrides(t *testing.T) { - sanContents, err := marshalSANs([]string{"foo.example.com"}, nil, nil) - if err != nil { - t.Fatal(err) - } - - template := CertificateRequest{ - Subject: pkix.Name{ - CommonName: "test.example.com", - Organization: []string{"Σ Acme Co"}, - }, - DNSNames: []string{"test.example.com"}, - - // An explicit extension should override the DNSNames from the - // template. - ExtraExtensions: []pkix.Extension{ - { - Id: oidExtensionSubjectAltName, - Value: sanContents, - }, - }, - } - - csr := marshalAndParseCSR(t, &template) - - if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "foo.example.com" { - t.Errorf("Extension did not override template. Got %v\n", csr.DNSNames) - } - - // If there is already an attribute with X.509 extensions then the - // extra extensions should be added to it rather than creating a CSR - // with two extension attributes. - - template.Attributes = []pkix.AttributeTypeAndValueSET{ - { - Type: oidExtensionRequest, - Value: [][]pkix.AttributeTypeAndValue{ - { - { - Type: oidExtensionAuthorityInfoAccess, - Value: []byte("foo"), - }, - }, - }, - }, - } - - csr = marshalAndParseCSR(t, &template) - if l := len(csr.Attributes); l != 1 { - t.Errorf("incorrect number of attributes: %d\n", l) - } - - if !csr.Attributes[0].Type.Equal(oidExtensionRequest) || - len(csr.Attributes[0].Value) != 1 || - len(csr.Attributes[0].Value[0]) != 2 { - t.Errorf("bad attributes: %#v\n", csr.Attributes) - } - - sanContents2, err := marshalSANs([]string{"foo2.example.com"}, nil, nil) - if err != nil { - t.Fatal(err) - } - - // Extensions in Attributes should override those in ExtraExtensions. - template.Attributes[0].Value[0] = append(template.Attributes[0].Value[0], pkix.AttributeTypeAndValue{ - Type: oidExtensionSubjectAltName, - Value: sanContents2, - }) - - csr = marshalAndParseCSR(t, &template) - - if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "foo2.example.com" { - t.Errorf("Attributes did not override ExtraExtensions. Got %v\n", csr.DNSNames) - } -} - -func TestParseCertificateRequest(t *testing.T) { - for _, csrBase64 := range csrBase64Array { - csrBytes := fromBase64(csrBase64) - csr, err := ParseCertificateRequest(csrBytes) - if err != nil { - t.Fatalf("failed to parse CSR: %s", err) - } - - if len(csr.EmailAddresses) != 1 || csr.EmailAddresses[0] != "gopher@golang.org" { - t.Errorf("incorrect email addresses found: %v", csr.EmailAddresses) - } - - if len(csr.DNSNames) != 1 || csr.DNSNames[0] != "test.example.com" { - t.Errorf("incorrect DNS names found: %v", csr.DNSNames) - } - - if len(csr.Subject.Country) != 1 || csr.Subject.Country[0] != "AU" { - t.Errorf("incorrect Subject name: %v", csr.Subject) - } - - found := false - for _, e := range csr.Extensions { - if e.Id.Equal(oidExtensionBasicConstraints) { - found = true - break - } - } - if !found { - t.Errorf("basic constraints extension not found in CSR") - } - } -} - -func TestMaxPathLen(t *testing.T) { - block, _ := pem.Decode([]byte(pemPrivateKey)) - rsaPriv, err := ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - t.Fatalf("Failed to parse private key: %s", err) - } - - template := &Certificate{ - SerialNumber: big.NewInt(1), - Subject: pkix.Name{ - CommonName: "Σ Acme Co", - }, - NotBefore: time.Unix(1000, 0), - NotAfter: time.Unix(100000, 0), - - BasicConstraintsValid: true, - IsCA: true, - } - - serialiseAndParse := func(template *Certificate) *Certificate { - derBytes, err := CreateCertificate(rand.Reader, template, template, &rsaPriv.PublicKey, rsaPriv) - if err != nil { - t.Fatalf("failed to create certificate: %s", err) - return nil - } - - cert, err := ParseCertificate(derBytes) - if err != nil { - t.Fatalf("failed to parse certificate: %s", err) - return nil - } - - return cert - } - - cert1 := serialiseAndParse(template) - if m := cert1.MaxPathLen; m != -1 { - t.Errorf("Omitting MaxPathLen didn't turn into -1, got %d", m) - } - if cert1.MaxPathLenZero { - t.Errorf("Omitting MaxPathLen resulted in MaxPathLenZero") - } - - template.MaxPathLen = 1 - cert2 := serialiseAndParse(template) - if m := cert2.MaxPathLen; m != 1 { - t.Errorf("Setting MaxPathLen didn't work. Got %d but set 1", m) - } - if cert2.MaxPathLenZero { - t.Errorf("Setting MaxPathLen resulted in MaxPathLenZero") - } - - template.MaxPathLen = 0 - template.MaxPathLenZero = true - cert3 := serialiseAndParse(template) - if m := cert3.MaxPathLen; m != 0 { - t.Errorf("Setting MaxPathLenZero didn't work, got %d", m) - } - if !cert3.MaxPathLenZero { - t.Errorf("Setting MaxPathLen to zero didn't result in MaxPathLenZero") - } -} - -func TestASN1BitLength(t *testing.T) { - tests := []struct { - bytes []byte - bitLen int - }{ - {nil, 0}, - {[]byte{0x00}, 0}, - {[]byte{0x00, 0x00}, 0}, - {[]byte{0xf0}, 4}, - {[]byte{0x88}, 5}, - {[]byte{0xff}, 8}, - {[]byte{0xff, 0x80}, 9}, - {[]byte{0xff, 0x81}, 16}, - } - - for i, test := range tests { - if got := asn1BitLength(test.bytes); got != test.bitLen { - t.Errorf("#%d: calculated bit-length of %d for %x, wanted %d", i, got, test.bytes, test.bitLen) - } - } -} - -// These CSR was generated with OpenSSL: -// openssl req -out CSR.csr -new -sha256 -nodes -keyout privateKey.key -config openssl.cnf -// -// With openssl.cnf containing the following sections: -// [ v3_req ] -// basicConstraints = CA:FALSE -// keyUsage = nonRepudiation, digitalSignature, keyEncipherment -// subjectAltName = email:gopher@golang.org,DNS:test.example.com -// [ req_attributes ] -// challengePassword = ignored challenge -// unstructuredName = ignored unstructured name -var csrBase64Array = [...]string{ - // Just [ v3_req ] - "MIIDHDCCAgQCAQAwfjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLQ29tbW9uIE5hbWUxITAfBgkqhkiG9w0BCQEWEnRlc3RAZW1haWwuYWRkcmVzczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK1GY4YFx2ujlZEOJxQVYmsjUnLsd5nFVnNpLE4cV+77sgv9NPNlB8uhn3MXt5leD34rm/2BisCHOifPucYlSrszo2beuKhvwn4+2FxDmWtBEMu/QA16L5IvoOfYZm/gJTsPwKDqvaR0tTU67a9OtxwNTBMI56YKtmwd/o8d3hYv9cg+9ZGAZ/gKONcg/OWYx/XRh6bd0g8DMbCikpWgXKDsvvK1Nk+VtkDO1JxuBaj4Lz/p/MifTfnHoqHxWOWl4EaTs4Ychxsv34/rSj1KD1tJqorIv5Xv2aqv4sjxfbrYzX4kvS5SC1goIovLnhj5UjmQ3Qy8u65eow/LLWw+YFcCAwEAAaBZMFcGCSqGSIb3DQEJDjFKMEgwCQYDVR0TBAIwADALBgNVHQ8EBAMCBeAwLgYDVR0RBCcwJYERZ29waGVyQGdvbGFuZy5vcmeCEHRlc3QuZXhhbXBsZS5jb20wDQYJKoZIhvcNAQELBQADggEBAB6VPMRrchvNW61Tokyq3ZvO6/NoGIbuwUn54q6l5VZW0Ep5Nq8juhegSSnaJ0jrovmUgKDN9vEo2KxuAtwG6udS6Ami3zP+hRd4k9Q8djJPb78nrjzWiindLK5Fps9U5mMoi1ER8ViveyAOTfnZt/jsKUaRsscY2FzE9t9/o5moE6LTcHUS4Ap1eheR+J72WOnQYn3cifYaemsA9MJuLko+kQ6xseqttbh9zjqd9fiCSh/LNkzos9c+mg2yMADitaZinAh+HZi50ooEbjaT3erNq9O6RqwJlgD00g6MQdoz9bTAryCUhCQfkIaepmQ7BxS0pqWNW3MMwfDwx/Snz6g=", - // Both [ v3_req ] and [ req_attributes ] - "MIIDaTCCAlECAQAwfjELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLQ29tbW9uIE5hbWUxITAfBgkqhkiG9w0BCQEWEnRlc3RAZW1haWwuYWRkcmVzczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK1GY4YFx2ujlZEOJxQVYmsjUnLsd5nFVnNpLE4cV+77sgv9NPNlB8uhn3MXt5leD34rm/2BisCHOifPucYlSrszo2beuKhvwn4+2FxDmWtBEMu/QA16L5IvoOfYZm/gJTsPwKDqvaR0tTU67a9OtxwNTBMI56YKtmwd/o8d3hYv9cg+9ZGAZ/gKONcg/OWYx/XRh6bd0g8DMbCikpWgXKDsvvK1Nk+VtkDO1JxuBaj4Lz/p/MifTfnHoqHxWOWl4EaTs4Ychxsv34/rSj1KD1tJqorIv5Xv2aqv4sjxfbrYzX4kvS5SC1goIovLnhj5UjmQ3Qy8u65eow/LLWw+YFcCAwEAAaCBpTAgBgkqhkiG9w0BCQcxEwwRaWdub3JlZCBjaGFsbGVuZ2UwKAYJKoZIhvcNAQkCMRsMGWlnbm9yZWQgdW5zdHJ1Y3R1cmVkIG5hbWUwVwYJKoZIhvcNAQkOMUowSDAJBgNVHRMEAjAAMAsGA1UdDwQEAwIF4DAuBgNVHREEJzAlgRFnb3BoZXJAZ29sYW5nLm9yZ4IQdGVzdC5leGFtcGxlLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEAgxe2N5O48EMsYE7o0rZBB0wi3Ov5/yYfnmmVI22Y3sP6VXbLDW0+UWIeSccOhzUCcZ/G4qcrfhhx6gTZTeA01nP7TdTJURvWAH5iFqj9sQ0qnLq6nEcVHij3sG6M5+BxAIVClQBk6lTCzgphc835Fjj6qSLuJ20XHdL5UfUbiJxx299CHgyBRL+hBUIPfz8p+ZgamyAuDLfnj54zzcRVyLlrmMLNPZNll1Q70RxoU6uWvLH8wB8vQe3Q/guSGubLyLRTUQVPh+dw1L4t8MKFWfX/48jwRM4gIRHFHPeAAE9D9YAoqdIvj/iFm/eQ++7DP8MDwOZWsXeB6jjwHuLmkQ==", -} diff --git a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test_import.go b/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test_import.go deleted file mode 100644 index 3fda7da188c0da0050f09f491fb260c0d9e7d128..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/crypto/x509/x509_test_import.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// This file is run by the x509 tests to ensure that a program with minimal -// imports can sign certificates without errors resulting from missing hash -// functions. -package main - -import ( - "crypto/rand" - "crypto/x509" - "crypto/x509/pkix" - "encoding/pem" - "math/big" - "time" -) - -func main() { - block, _ := pem.Decode([]byte(pemPrivateKey)) - rsaPriv, err := x509.ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - panic("Failed to parse private key: " + err.Error()) - } - - template := x509.Certificate{ - SerialNumber: big.NewInt(1), - Subject: pkix.Name{ - CommonName: "test", - Organization: []string{"Σ Acme Co"}, - }, - NotBefore: time.Unix(1000, 0), - NotAfter: time.Unix(100000, 0), - KeyUsage: x509.KeyUsageCertSign, - } - - if _, err = x509.CreateCertificate(rand.Reader, &template, &template, &rsaPriv.PublicKey, rsaPriv); err != nil { - panic("failed to create certificate with basic imports: " + err.Error()) - } -} - -var pemPrivateKey = `-----BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBALKZD0nEffqM1ACuak0bijtqE2QrI/KLADv7l3kK3ppMyCuLKoF0 -fd7Ai2KW5ToIwzFofvJcS/STa6HA5gQenRUCAwEAAQJBAIq9amn00aS0h/CrjXqu -/ThglAXJmZhOMPVn4eiu7/ROixi9sex436MaVeMqSNf7Ex9a8fRNfWss7Sqd9eWu -RTUCIQDasvGASLqmjeffBNLTXV2A5g4t+kLVCpsEIZAycV5GswIhANEPLmax0ME/ -EO+ZJ79TJKN5yiGBRsv5yvx5UiHxajEXAiAhAol5N4EUyq6I9w1rYdhPMGpLfk7A -IU2snfRJ6Nq2CQIgFrPsWRCkV+gOYcajD17rEqmuLrdIRexpg8N1DOSXoJ8CIGlS -tAboUGBxTDq3ZroNism3DaMIbKPyYrAqhKov1h5V ------END RSA PRIVATE KEY----- -` diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/convert.go b/llgo/third_party/gofrontend/libgo/go/database/sql/convert.go deleted file mode 100644 index c0b38a24940fcade4452df0b5cdae6369420d3df..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/convert.go +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Type conversions for Scan. - -package sql - -import ( - "database/sql/driver" - "errors" - "fmt" - "reflect" - "strconv" -) - -var errNilPtr = errors.New("destination pointer is nil") // embedded in descriptive error - -// driverArgs converts arguments from callers of Stmt.Exec and -// Stmt.Query into driver Values. -// -// The statement ds may be nil, if no statement is available. -func driverArgs(ds *driverStmt, args []interface{}) ([]driver.Value, error) { - dargs := make([]driver.Value, len(args)) - var si driver.Stmt - if ds != nil { - si = ds.si - } - cc, ok := si.(driver.ColumnConverter) - - // Normal path, for a driver.Stmt that is not a ColumnConverter. - if !ok { - for n, arg := range args { - var err error - dargs[n], err = driver.DefaultParameterConverter.ConvertValue(arg) - if err != nil { - return nil, fmt.Errorf("sql: converting Exec argument #%d's type: %v", n, err) - } - } - return dargs, nil - } - - // Let the Stmt convert its own arguments. - for n, arg := range args { - // First, see if the value itself knows how to convert - // itself to a driver type. For example, a NullString - // struct changing into a string or nil. - if svi, ok := arg.(driver.Valuer); ok { - sv, err := svi.Value() - if err != nil { - return nil, fmt.Errorf("sql: argument index %d from Value: %v", n, err) - } - if !driver.IsValue(sv) { - return nil, fmt.Errorf("sql: argument index %d: non-subset type %T returned from Value", n, sv) - } - arg = sv - } - - // Second, ask the column to sanity check itself. For - // example, drivers might use this to make sure that - // an int64 values being inserted into a 16-bit - // integer field is in range (before getting - // truncated), or that a nil can't go into a NOT NULL - // column before going across the network to get the - // same error. - var err error - ds.Lock() - dargs[n], err = cc.ColumnConverter(n).ConvertValue(arg) - ds.Unlock() - if err != nil { - return nil, fmt.Errorf("sql: converting argument #%d's type: %v", n, err) - } - if !driver.IsValue(dargs[n]) { - return nil, fmt.Errorf("sql: driver ColumnConverter error converted %T to unsupported type %T", - arg, dargs[n]) - } - } - - return dargs, nil -} - -// convertAssign copies to dest the value in src, converting it if possible. -// An error is returned if the copy would result in loss of information. -// dest should be a pointer type. -func convertAssign(dest, src interface{}) error { - // Common cases, without reflect. - switch s := src.(type) { - case string: - switch d := dest.(type) { - case *string: - if d == nil { - return errNilPtr - } - *d = s - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = []byte(s) - return nil - } - case []byte: - switch d := dest.(type) { - case *string: - if d == nil { - return errNilPtr - } - *d = string(s) - return nil - case *interface{}: - if d == nil { - return errNilPtr - } - *d = cloneBytes(s) - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = cloneBytes(s) - return nil - case *RawBytes: - if d == nil { - return errNilPtr - } - *d = s - return nil - } - case nil: - switch d := dest.(type) { - case *interface{}: - if d == nil { - return errNilPtr - } - *d = nil - return nil - case *[]byte: - if d == nil { - return errNilPtr - } - *d = nil - return nil - case *RawBytes: - if d == nil { - return errNilPtr - } - *d = nil - return nil - } - } - - var sv reflect.Value - - switch d := dest.(type) { - case *string: - sv = reflect.ValueOf(src) - switch sv.Kind() { - case reflect.Bool, - reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Float32, reflect.Float64: - *d = asString(src) - return nil - } - case *[]byte: - sv = reflect.ValueOf(src) - if b, ok := asBytes(nil, sv); ok { - *d = b - return nil - } - case *RawBytes: - sv = reflect.ValueOf(src) - if b, ok := asBytes([]byte(*d)[:0], sv); ok { - *d = RawBytes(b) - return nil - } - case *bool: - bv, err := driver.Bool.ConvertValue(src) - if err == nil { - *d = bv.(bool) - } - return err - case *interface{}: - *d = src - return nil - } - - if scanner, ok := dest.(Scanner); ok { - return scanner.Scan(src) - } - - dpv := reflect.ValueOf(dest) - if dpv.Kind() != reflect.Ptr { - return errors.New("destination not a pointer") - } - if dpv.IsNil() { - return errNilPtr - } - - if !sv.IsValid() { - sv = reflect.ValueOf(src) - } - - dv := reflect.Indirect(dpv) - if dv.Kind() == sv.Kind() { - dv.Set(sv) - return nil - } - - switch dv.Kind() { - case reflect.Ptr: - if src == nil { - dv.Set(reflect.Zero(dv.Type())) - return nil - } else { - dv.Set(reflect.New(dv.Type().Elem())) - return convertAssign(dv.Interface(), src) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s := asString(src) - i64, err := strconv.ParseInt(s, 10, dv.Type().Bits()) - if err != nil { - return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err) - } - dv.SetInt(i64) - return nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - s := asString(src) - u64, err := strconv.ParseUint(s, 10, dv.Type().Bits()) - if err != nil { - return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err) - } - dv.SetUint(u64) - return nil - case reflect.Float32, reflect.Float64: - s := asString(src) - f64, err := strconv.ParseFloat(s, dv.Type().Bits()) - if err != nil { - return fmt.Errorf("converting string %q to a %s: %v", s, dv.Kind(), err) - } - dv.SetFloat(f64) - return nil - } - - return fmt.Errorf("unsupported driver -> Scan pair: %T -> %T", src, dest) -} - -func cloneBytes(b []byte) []byte { - if b == nil { - return nil - } else { - c := make([]byte, len(b)) - copy(c, b) - return c - } -} - -func asString(src interface{}) string { - switch v := src.(type) { - case string: - return v - case []byte: - return string(v) - } - rv := reflect.ValueOf(src) - switch rv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.FormatInt(rv.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return strconv.FormatUint(rv.Uint(), 10) - case reflect.Float64: - return strconv.FormatFloat(rv.Float(), 'g', -1, 64) - case reflect.Float32: - return strconv.FormatFloat(rv.Float(), 'g', -1, 32) - case reflect.Bool: - return strconv.FormatBool(rv.Bool()) - } - return fmt.Sprintf("%v", src) -} - -func asBytes(buf []byte, rv reflect.Value) (b []byte, ok bool) { - switch rv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return strconv.AppendInt(buf, rv.Int(), 10), true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - return strconv.AppendUint(buf, rv.Uint(), 10), true - case reflect.Float32: - return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 32), true - case reflect.Float64: - return strconv.AppendFloat(buf, rv.Float(), 'g', -1, 64), true - case reflect.Bool: - return strconv.AppendBool(buf, rv.Bool()), true - case reflect.String: - s := rv.String() - return append(buf, s...), true - } - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/convert_test.go b/llgo/third_party/gofrontend/libgo/go/database/sql/convert_test.go deleted file mode 100644 index 98af9fb64c58ba39dcadfe9ae2b1e7e6eeb37ea1..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/convert_test.go +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sql - -import ( - "database/sql/driver" - "fmt" - "reflect" - "runtime" - "testing" - "time" -) - -var someTime = time.Unix(123, 0) -var answer int64 = 42 - -type conversionTest struct { - s, d interface{} // source and destination - - // following are used if they're non-zero - wantint int64 - wantuint uint64 - wantstr string - wantbytes []byte - wantraw RawBytes - wantf32 float32 - wantf64 float64 - wanttime time.Time - wantbool bool // used if d is of type *bool - wanterr string - wantiface interface{} - wantptr *int64 // if non-nil, *d's pointed value must be equal to *wantptr - wantnil bool // if true, *d must be *int64(nil) -} - -// Target variables for scanning into. -var ( - scanstr string - scanbytes []byte - scanraw RawBytes - scanint int - scanint8 int8 - scanint16 int16 - scanint32 int32 - scanuint8 uint8 - scanuint16 uint16 - scanbool bool - scanf32 float32 - scanf64 float64 - scantime time.Time - scanptr *int64 - scaniface interface{} -) - -var conversionTests = []conversionTest{ - // Exact conversions (destination pointer type matches source type) - {s: "foo", d: &scanstr, wantstr: "foo"}, - {s: 123, d: &scanint, wantint: 123}, - {s: someTime, d: &scantime, wanttime: someTime}, - - // To strings - {s: "string", d: &scanstr, wantstr: "string"}, - {s: []byte("byteslice"), d: &scanstr, wantstr: "byteslice"}, - {s: 123, d: &scanstr, wantstr: "123"}, - {s: int8(123), d: &scanstr, wantstr: "123"}, - {s: int64(123), d: &scanstr, wantstr: "123"}, - {s: uint8(123), d: &scanstr, wantstr: "123"}, - {s: uint16(123), d: &scanstr, wantstr: "123"}, - {s: uint32(123), d: &scanstr, wantstr: "123"}, - {s: uint64(123), d: &scanstr, wantstr: "123"}, - {s: 1.5, d: &scanstr, wantstr: "1.5"}, - - // To []byte - {s: nil, d: &scanbytes, wantbytes: nil}, - {s: "string", d: &scanbytes, wantbytes: []byte("string")}, - {s: []byte("byteslice"), d: &scanbytes, wantbytes: []byte("byteslice")}, - {s: 123, d: &scanbytes, wantbytes: []byte("123")}, - {s: int8(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: int64(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: uint8(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: uint16(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: uint32(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: uint64(123), d: &scanbytes, wantbytes: []byte("123")}, - {s: 1.5, d: &scanbytes, wantbytes: []byte("1.5")}, - - // To RawBytes - {s: nil, d: &scanraw, wantraw: nil}, - {s: []byte("byteslice"), d: &scanraw, wantraw: RawBytes("byteslice")}, - {s: 123, d: &scanraw, wantraw: RawBytes("123")}, - {s: int8(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: int64(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: uint8(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: uint16(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: uint32(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: uint64(123), d: &scanraw, wantraw: RawBytes("123")}, - {s: 1.5, d: &scanraw, wantraw: RawBytes("1.5")}, - - // Strings to integers - {s: "255", d: &scanuint8, wantuint: 255}, - {s: "256", d: &scanuint8, wanterr: `converting string "256" to a uint8: strconv.ParseUint: parsing "256": value out of range`}, - {s: "256", d: &scanuint16, wantuint: 256}, - {s: "-1", d: &scanint, wantint: -1}, - {s: "foo", d: &scanint, wanterr: `converting string "foo" to a int: strconv.ParseInt: parsing "foo": invalid syntax`}, - - // True bools - {s: true, d: &scanbool, wantbool: true}, - {s: "True", d: &scanbool, wantbool: true}, - {s: "TRUE", d: &scanbool, wantbool: true}, - {s: "1", d: &scanbool, wantbool: true}, - {s: 1, d: &scanbool, wantbool: true}, - {s: int64(1), d: &scanbool, wantbool: true}, - {s: uint16(1), d: &scanbool, wantbool: true}, - - // False bools - {s: false, d: &scanbool, wantbool: false}, - {s: "false", d: &scanbool, wantbool: false}, - {s: "FALSE", d: &scanbool, wantbool: false}, - {s: "0", d: &scanbool, wantbool: false}, - {s: 0, d: &scanbool, wantbool: false}, - {s: int64(0), d: &scanbool, wantbool: false}, - {s: uint16(0), d: &scanbool, wantbool: false}, - - // Not bools - {s: "yup", d: &scanbool, wanterr: `sql/driver: couldn't convert "yup" into type bool`}, - {s: 2, d: &scanbool, wanterr: `sql/driver: couldn't convert 2 into type bool`}, - - // Floats - {s: float64(1.5), d: &scanf64, wantf64: float64(1.5)}, - {s: int64(1), d: &scanf64, wantf64: float64(1)}, - {s: float64(1.5), d: &scanf32, wantf32: float32(1.5)}, - {s: "1.5", d: &scanf32, wantf32: float32(1.5)}, - {s: "1.5", d: &scanf64, wantf64: float64(1.5)}, - - // Pointers - {s: interface{}(nil), d: &scanptr, wantnil: true}, - {s: int64(42), d: &scanptr, wantptr: &answer}, - - // To interface{} - {s: float64(1.5), d: &scaniface, wantiface: float64(1.5)}, - {s: int64(1), d: &scaniface, wantiface: int64(1)}, - {s: "str", d: &scaniface, wantiface: "str"}, - {s: []byte("byteslice"), d: &scaniface, wantiface: []byte("byteslice")}, - {s: true, d: &scaniface, wantiface: true}, - {s: nil, d: &scaniface}, - {s: []byte(nil), d: &scaniface, wantiface: []byte(nil)}, -} - -func intPtrValue(intptr interface{}) interface{} { - return reflect.Indirect(reflect.Indirect(reflect.ValueOf(intptr))).Int() -} - -func intValue(intptr interface{}) int64 { - return reflect.Indirect(reflect.ValueOf(intptr)).Int() -} - -func uintValue(intptr interface{}) uint64 { - return reflect.Indirect(reflect.ValueOf(intptr)).Uint() -} - -func float64Value(ptr interface{}) float64 { - return *(ptr.(*float64)) -} - -func float32Value(ptr interface{}) float32 { - return *(ptr.(*float32)) -} - -func timeValue(ptr interface{}) time.Time { - return *(ptr.(*time.Time)) -} - -func TestConversions(t *testing.T) { - for n, ct := range conversionTests { - err := convertAssign(ct.d, ct.s) - errstr := "" - if err != nil { - errstr = err.Error() - } - errf := func(format string, args ...interface{}) { - base := fmt.Sprintf("convertAssign #%d: for %v (%T) -> %T, ", n, ct.s, ct.s, ct.d) - t.Errorf(base+format, args...) - } - if errstr != ct.wanterr { - errf("got error %q, want error %q", errstr, ct.wanterr) - } - if ct.wantstr != "" && ct.wantstr != scanstr { - errf("want string %q, got %q", ct.wantstr, scanstr) - } - if ct.wantint != 0 && ct.wantint != intValue(ct.d) { - errf("want int %d, got %d", ct.wantint, intValue(ct.d)) - } - if ct.wantuint != 0 && ct.wantuint != uintValue(ct.d) { - errf("want uint %d, got %d", ct.wantuint, uintValue(ct.d)) - } - if ct.wantf32 != 0 && ct.wantf32 != float32Value(ct.d) { - errf("want float32 %v, got %v", ct.wantf32, float32Value(ct.d)) - } - if ct.wantf64 != 0 && ct.wantf64 != float64Value(ct.d) { - errf("want float32 %v, got %v", ct.wantf64, float64Value(ct.d)) - } - if bp, boolTest := ct.d.(*bool); boolTest && *bp != ct.wantbool && ct.wanterr == "" { - errf("want bool %v, got %v", ct.wantbool, *bp) - } - if !ct.wanttime.IsZero() && !ct.wanttime.Equal(timeValue(ct.d)) { - errf("want time %v, got %v", ct.wanttime, timeValue(ct.d)) - } - if ct.wantnil && *ct.d.(**int64) != nil { - errf("want nil, got %v", intPtrValue(ct.d)) - } - if ct.wantptr != nil { - if *ct.d.(**int64) == nil { - errf("want pointer to %v, got nil", *ct.wantptr) - } else if *ct.wantptr != intPtrValue(ct.d) { - errf("want pointer to %v, got %v", *ct.wantptr, intPtrValue(ct.d)) - } - } - if ifptr, ok := ct.d.(*interface{}); ok { - if !reflect.DeepEqual(ct.wantiface, scaniface) { - errf("want interface %#v, got %#v", ct.wantiface, scaniface) - continue - } - if srcBytes, ok := ct.s.([]byte); ok { - dstBytes := (*ifptr).([]byte) - if len(srcBytes) > 0 && &dstBytes[0] == &srcBytes[0] { - errf("copy into interface{} didn't copy []byte data") - } - } - } - } -} - -func TestNullString(t *testing.T) { - var ns NullString - convertAssign(&ns, []byte("foo")) - if !ns.Valid { - t.Errorf("expecting not null") - } - if ns.String != "foo" { - t.Errorf("expecting foo; got %q", ns.String) - } - convertAssign(&ns, nil) - if ns.Valid { - t.Errorf("expecting null on nil") - } - if ns.String != "" { - t.Errorf("expecting blank on nil; got %q", ns.String) - } -} - -type valueConverterTest struct { - c driver.ValueConverter - in, out interface{} - err string -} - -var valueConverterTests = []valueConverterTest{ - {driver.DefaultParameterConverter, NullString{"hi", true}, "hi", ""}, - {driver.DefaultParameterConverter, NullString{"", false}, nil, ""}, -} - -func TestValueConverters(t *testing.T) { - for i, tt := range valueConverterTests { - out, err := tt.c.ConvertValue(tt.in) - goterr := "" - if err != nil { - goterr = err.Error() - } - if goterr != tt.err { - t.Errorf("test %d: %T(%T(%v)) error = %q; want error = %q", - i, tt.c, tt.in, tt.in, goterr, tt.err) - } - if tt.err != "" { - continue - } - if !reflect.DeepEqual(out, tt.out) { - t.Errorf("test %d: %T(%T(%v)) = %v (%T); want %v (%T)", - i, tt.c, tt.in, tt.in, out, out, tt.out, tt.out) - } - } -} - -// Tests that assigning to RawBytes doesn't allocate (and also works). -func TestRawBytesAllocs(t *testing.T) { - var tests = []struct { - name string - in interface{} - want string - }{ - {"uint64", uint64(12345678), "12345678"}, - {"uint32", uint32(1234), "1234"}, - {"uint16", uint16(12), "12"}, - {"uint8", uint8(1), "1"}, - {"uint", uint(123), "123"}, - {"int", int(123), "123"}, - {"int8", int8(1), "1"}, - {"int16", int16(12), "12"}, - {"int32", int32(1234), "1234"}, - {"int64", int64(12345678), "12345678"}, - {"float32", float32(1.5), "1.5"}, - {"float64", float64(64), "64"}, - {"bool", false, "false"}, - } - - buf := make(RawBytes, 10) - test := func(name string, in interface{}, want string) { - if err := convertAssign(&buf, in); err != nil { - t.Fatalf("%s: convertAssign = %v", name, err) - } - match := len(buf) == len(want) - if match { - for i, b := range buf { - if want[i] != b { - match = false - break - } - } - } - if !match { - t.Fatalf("%s: got %q (len %d); want %q (len %d)", name, buf, len(buf), want, len(want)) - } - } - - n := testing.AllocsPerRun(100, func() { - for _, tt := range tests { - test(tt.name, tt.in, tt.want) - } - }) - - // The numbers below are only valid for 64-bit interface word sizes, - // and gc. With 32-bit words there are more convT2E allocs, and - // with gccgo, only pointers currently go in interface data. - // So only care on amd64 gc for now. - measureAllocs := runtime.GOARCH == "amd64" && runtime.Compiler == "gc" - - if n > 0.5 && measureAllocs { - t.Fatalf("allocs = %v; want 0", n) - } - - // This one involves a convT2E allocation, string -> interface{} - n = testing.AllocsPerRun(100, func() { - test("string", "foo", "foo") - }) - if n > 1.5 && measureAllocs { - t.Fatalf("allocs = %v; want max 1", n) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/driver.go b/llgo/third_party/gofrontend/libgo/go/database/sql/driver/driver.go deleted file mode 100644 index eca25f29a0aa125dbdd5537b4d7708b0b16f6d63..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/driver.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package driver defines interfaces to be implemented by database -// drivers as used by package sql. -// -// Most code should use package sql. -package driver - -import "errors" - -// Value is a value that drivers must be able to handle. -// It is either nil or an instance of one of these types: -// -// int64 -// float64 -// bool -// []byte -// string [*] everywhere except from Rows.Next. -// time.Time -type Value interface{} - -// Driver is the interface that must be implemented by a database -// driver. -type Driver interface { - // Open returns a new connection to the database. - // The name is a string in a driver-specific format. - // - // Open may return a cached connection (one previously - // closed), but doing so is unnecessary; the sql package - // maintains a pool of idle connections for efficient re-use. - // - // The returned connection is only used by one goroutine at a - // time. - Open(name string) (Conn, error) -} - -// ErrSkip may be returned by some optional interfaces' methods to -// indicate at runtime that the fast path is unavailable and the sql -// package should continue as if the optional interface was not -// implemented. ErrSkip is only supported where explicitly -// documented. -var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented") - -// ErrBadConn should be returned by a driver to signal to the sql -// package that a driver.Conn is in a bad state (such as the server -// having earlier closed the connection) and the sql package should -// retry on a new connection. -// -// To prevent duplicate operations, ErrBadConn should NOT be returned -// if there's a possibility that the database server might have -// performed the operation. Even if the server sends back an error, -// you shouldn't return ErrBadConn. -var ErrBadConn = errors.New("driver: bad connection") - -// Execer is an optional interface that may be implemented by a Conn. -// -// If a Conn does not implement Execer, the sql package's DB.Exec will -// first prepare a query, execute the statement, and then close the -// statement. -// -// Exec may return ErrSkip. -type Execer interface { - Exec(query string, args []Value) (Result, error) -} - -// Queryer is an optional interface that may be implemented by a Conn. -// -// If a Conn does not implement Queryer, the sql package's DB.Query will -// first prepare a query, execute the statement, and then close the -// statement. -// -// Query may return ErrSkip. -type Queryer interface { - Query(query string, args []Value) (Rows, error) -} - -// Conn is a connection to a database. It is not used concurrently -// by multiple goroutines. -// -// Conn is assumed to be stateful. -type Conn interface { - // Prepare returns a prepared statement, bound to this connection. - Prepare(query string) (Stmt, error) - - // Close invalidates and potentially stops any current - // prepared statements and transactions, marking this - // connection as no longer in use. - // - // Because the sql package maintains a free pool of - // connections and only calls Close when there's a surplus of - // idle connections, it shouldn't be necessary for drivers to - // do their own connection caching. - Close() error - - // Begin starts and returns a new transaction. - Begin() (Tx, error) -} - -// Result is the result of a query execution. -type Result interface { - // LastInsertId returns the database's auto-generated ID - // after, for example, an INSERT into a table with primary - // key. - LastInsertId() (int64, error) - - // RowsAffected returns the number of rows affected by the - // query. - RowsAffected() (int64, error) -} - -// Stmt is a prepared statement. It is bound to a Conn and not -// used by multiple goroutines concurrently. -type Stmt interface { - // Close closes the statement. - // - // As of Go 1.1, a Stmt will not be closed if it's in use - // by any queries. - Close() error - - // NumInput returns the number of placeholder parameters. - // - // If NumInput returns >= 0, the sql package will sanity check - // argument counts from callers and return errors to the caller - // before the statement's Exec or Query methods are called. - // - // NumInput may also return -1, if the driver doesn't know - // its number of placeholders. In that case, the sql package - // will not sanity check Exec or Query argument counts. - NumInput() int - - // Exec executes a query that doesn't return rows, such - // as an INSERT or UPDATE. - Exec(args []Value) (Result, error) - - // Query executes a query that may return rows, such as a - // SELECT. - Query(args []Value) (Rows, error) -} - -// ColumnConverter may be optionally implemented by Stmt if the -// statement is aware of its own columns' types and can convert from -// any type to a driver Value. -type ColumnConverter interface { - // ColumnConverter returns a ValueConverter for the provided - // column index. If the type of a specific column isn't known - // or shouldn't be handled specially, DefaultValueConverter - // can be returned. - ColumnConverter(idx int) ValueConverter -} - -// Rows is an iterator over an executed query's results. -type Rows interface { - // Columns returns the names of the columns. The number of - // columns of the result is inferred from the length of the - // slice. If a particular column name isn't known, an empty - // string should be returned for that entry. - Columns() []string - - // Close closes the rows iterator. - Close() error - - // Next is called to populate the next row of data into - // the provided slice. The provided slice will be the same - // size as the Columns() are wide. - // - // The dest slice may be populated only with - // a driver Value type, but excluding string. - // All string values must be converted to []byte. - // - // Next should return io.EOF when there are no more rows. - Next(dest []Value) error -} - -// Tx is a transaction. -type Tx interface { - Commit() error - Rollback() error -} - -// RowsAffected implements Result for an INSERT or UPDATE operation -// which mutates a number of rows. -type RowsAffected int64 - -var _ Result = RowsAffected(0) - -func (RowsAffected) LastInsertId() (int64, error) { - return 0, errors.New("no LastInsertId available") -} - -func (v RowsAffected) RowsAffected() (int64, error) { - return int64(v), nil -} - -// ResultNoRows is a pre-defined Result for drivers to return when a DDL -// command (such as a CREATE TABLE) succeeds. It returns an error for both -// LastInsertId and RowsAffected. -var ResultNoRows noRows - -type noRows struct{} - -var _ Result = noRows{} - -func (noRows) LastInsertId() (int64, error) { - return 0, errors.New("no LastInsertId available after DDL statement") -} - -func (noRows) RowsAffected() (int64, error) { - return 0, errors.New("no RowsAffected available after DDL statement") -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types.go b/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types.go deleted file mode 100644 index 3305354dfd0d66183d96545bbae100d8c3d52450..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types.go +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package driver - -import ( - "fmt" - "reflect" - "strconv" - "time" -) - -// ValueConverter is the interface providing the ConvertValue method. -// -// Various implementations of ValueConverter are provided by the -// driver package to provide consistent implementations of conversions -// between drivers. The ValueConverters have several uses: -// -// * converting from the Value types as provided by the sql package -// into a database table's specific column type and making sure it -// fits, such as making sure a particular int64 fits in a -// table's uint16 column. -// -// * converting a value as given from the database into one of the -// driver Value types. -// -// * by the sql package, for converting from a driver's Value type -// to a user's type in a scan. -type ValueConverter interface { - // ConvertValue converts a value to a driver Value. - ConvertValue(v interface{}) (Value, error) -} - -// Valuer is the interface providing the Value method. -// -// Types implementing Valuer interface are able to convert -// themselves to a driver Value. -type Valuer interface { - // Value returns a driver Value. - Value() (Value, error) -} - -// Bool is a ValueConverter that converts input values to bools. -// -// The conversion rules are: -// - booleans are returned unchanged -// - for integer types, -// 1 is true -// 0 is false, -// other integers are an error -// - for strings and []byte, same rules as strconv.ParseBool -// - all other types are an error -var Bool boolType - -type boolType struct{} - -var _ ValueConverter = boolType{} - -func (boolType) String() string { return "Bool" } - -func (boolType) ConvertValue(src interface{}) (Value, error) { - switch s := src.(type) { - case bool: - return s, nil - case string: - b, err := strconv.ParseBool(s) - if err != nil { - return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s) - } - return b, nil - case []byte: - b, err := strconv.ParseBool(string(s)) - if err != nil { - return nil, fmt.Errorf("sql/driver: couldn't convert %q into type bool", s) - } - return b, nil - } - - sv := reflect.ValueOf(src) - switch sv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - iv := sv.Int() - if iv == 1 || iv == 0 { - return iv == 1, nil - } - return nil, fmt.Errorf("sql/driver: couldn't convert %d into type bool", iv) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - uv := sv.Uint() - if uv == 1 || uv == 0 { - return uv == 1, nil - } - return nil, fmt.Errorf("sql/driver: couldn't convert %d into type bool", uv) - } - - return nil, fmt.Errorf("sql/driver: couldn't convert %v (%T) into type bool", src, src) -} - -// Int32 is a ValueConverter that converts input values to int64, -// respecting the limits of an int32 value. -var Int32 int32Type - -type int32Type struct{} - -var _ ValueConverter = int32Type{} - -func (int32Type) ConvertValue(v interface{}) (Value, error) { - rv := reflect.ValueOf(v) - switch rv.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - i64 := rv.Int() - if i64 > (1<<31)-1 || i64 < -(1<<31) { - return nil, fmt.Errorf("sql/driver: value %d overflows int32", v) - } - return i64, nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - u64 := rv.Uint() - if u64 > (1<<31)-1 { - return nil, fmt.Errorf("sql/driver: value %d overflows int32", v) - } - return int64(u64), nil - case reflect.String: - i, err := strconv.Atoi(rv.String()) - if err != nil { - return nil, fmt.Errorf("sql/driver: value %q can't be converted to int32", v) - } - return int64(i), nil - } - return nil, fmt.Errorf("sql/driver: unsupported value %v (type %T) converting to int32", v, v) -} - -// String is a ValueConverter that converts its input to a string. -// If the value is already a string or []byte, it's unchanged. -// If the value is of another type, conversion to string is done -// with fmt.Sprintf("%v", v). -var String stringType - -type stringType struct{} - -func (stringType) ConvertValue(v interface{}) (Value, error) { - switch v.(type) { - case string, []byte: - return v, nil - } - return fmt.Sprintf("%v", v), nil -} - -// Null is a type that implements ValueConverter by allowing nil -// values but otherwise delegating to another ValueConverter. -type Null struct { - Converter ValueConverter -} - -func (n Null) ConvertValue(v interface{}) (Value, error) { - if v == nil { - return nil, nil - } - return n.Converter.ConvertValue(v) -} - -// NotNull is a type that implements ValueConverter by disallowing nil -// values but otherwise delegating to another ValueConverter. -type NotNull struct { - Converter ValueConverter -} - -func (n NotNull) ConvertValue(v interface{}) (Value, error) { - if v == nil { - return nil, fmt.Errorf("nil value not allowed") - } - return n.Converter.ConvertValue(v) -} - -// IsValue reports whether v is a valid Value parameter type. -// Unlike IsScanValue, IsValue permits the string type. -func IsValue(v interface{}) bool { - if IsScanValue(v) { - return true - } - if _, ok := v.(string); ok { - return true - } - return false -} - -// IsScanValue reports whether v is a valid Value scan type. -// Unlike IsValue, IsScanValue does not permit the string type. -func IsScanValue(v interface{}) bool { - if v == nil { - return true - } - switch v.(type) { - case int64, float64, []byte, bool, time.Time: - return true - } - return false -} - -// DefaultParameterConverter is the default implementation of -// ValueConverter that's used when a Stmt doesn't implement -// ColumnConverter. -// -// DefaultParameterConverter returns the given value directly if -// IsValue(value). Otherwise integer type are converted to -// int64, floats to float64, and strings to []byte. Other types are -// an error. -var DefaultParameterConverter defaultConverter - -type defaultConverter struct{} - -var _ ValueConverter = defaultConverter{} - -func (defaultConverter) ConvertValue(v interface{}) (Value, error) { - if IsValue(v) { - return v, nil - } - - if svi, ok := v.(Valuer); ok { - sv, err := svi.Value() - if err != nil { - return nil, err - } - if !IsValue(sv) { - return nil, fmt.Errorf("non-Value type %T returned from Value", sv) - } - return sv, nil - } - - rv := reflect.ValueOf(v) - switch rv.Kind() { - case reflect.Ptr: - // indirect pointers - if rv.IsNil() { - return nil, nil - } else { - return defaultConverter{}.ConvertValue(rv.Elem().Interface()) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return rv.Int(), nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32: - return int64(rv.Uint()), nil - case reflect.Uint64: - u64 := rv.Uint() - if u64 >= 1<<63 { - return nil, fmt.Errorf("uint64 values with high bit set are not supported") - } - return int64(u64), nil - case reflect.Float32, reflect.Float64: - return rv.Float(), nil - } - return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind()) -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types_test.go b/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types_test.go deleted file mode 100644 index 1ce0ff06541844a5d4155f6d9d779eb252674fe7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/driver/types_test.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package driver - -import ( - "reflect" - "testing" - "time" -) - -type valueConverterTest struct { - c ValueConverter - in interface{} - out interface{} - err string -} - -var now = time.Now() -var answer int64 = 42 - -var valueConverterTests = []valueConverterTest{ - {Bool, "true", true, ""}, - {Bool, "True", true, ""}, - {Bool, []byte("t"), true, ""}, - {Bool, true, true, ""}, - {Bool, "1", true, ""}, - {Bool, 1, true, ""}, - {Bool, int64(1), true, ""}, - {Bool, uint16(1), true, ""}, - {Bool, "false", false, ""}, - {Bool, false, false, ""}, - {Bool, "0", false, ""}, - {Bool, 0, false, ""}, - {Bool, int64(0), false, ""}, - {Bool, uint16(0), false, ""}, - {c: Bool, in: "foo", err: "sql/driver: couldn't convert \"foo\" into type bool"}, - {c: Bool, in: 2, err: "sql/driver: couldn't convert 2 into type bool"}, - {DefaultParameterConverter, now, now, ""}, - {DefaultParameterConverter, (*int64)(nil), nil, ""}, - {DefaultParameterConverter, &answer, answer, ""}, - {DefaultParameterConverter, &now, now, ""}, -} - -func TestValueConverters(t *testing.T) { - for i, tt := range valueConverterTests { - out, err := tt.c.ConvertValue(tt.in) - goterr := "" - if err != nil { - goterr = err.Error() - } - if goterr != tt.err { - t.Errorf("test %d: %T(%T(%v)) error = %q; want error = %q", - i, tt.c, tt.in, tt.in, goterr, tt.err) - } - if tt.err != "" { - continue - } - if !reflect.DeepEqual(out, tt.out) { - t.Errorf("test %d: %T(%T(%v)) = %v (%T); want %v (%T)", - i, tt.c, tt.in, tt.in, out, out, tt.out, tt.out) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/fakedb_test.go b/llgo/third_party/gofrontend/libgo/go/database/sql/fakedb_test.go deleted file mode 100644 index 8cbbb29a7c24e025019ec7e055f4ada0b0d12ac9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/fakedb_test.go +++ /dev/null @@ -1,834 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sql - -import ( - "database/sql/driver" - "errors" - "fmt" - "io" - "log" - "sort" - "strconv" - "strings" - "sync" - "testing" - "time" -) - -var _ = log.Printf - -// fakeDriver is a fake database that implements Go's driver.Driver -// interface, just for testing. -// -// It speaks a query language that's semantically similar to but -// syntactically different and simpler than SQL. The syntax is as -// follows: -// -// WIPE -// CREATE||=,=,... -// where types are: "string", [u]int{8,16,32,64}, "bool" -// INSERT||col=val,col2=val2,col3=? -// SELECT||projectcol1,projectcol2|filtercol=?,filtercol2=? -// -// When opening a fakeDriver's database, it starts empty with no -// tables. All tables and data are stored in memory only. -type fakeDriver struct { - mu sync.Mutex // guards 3 following fields - openCount int // conn opens - closeCount int // conn closes - waitCh chan struct{} - waitingCh chan struct{} - dbs map[string]*fakeDB -} - -type fakeDB struct { - name string - - mu sync.Mutex - free []*fakeConn - tables map[string]*table - badConn bool -} - -type table struct { - mu sync.Mutex - colname []string - coltype []string - rows []*row -} - -func (t *table) columnIndex(name string) int { - for n, nname := range t.colname { - if name == nname { - return n - } - } - return -1 -} - -type row struct { - cols []interface{} // must be same size as its table colname + coltype -} - -func (r *row) clone() *row { - nrow := &row{cols: make([]interface{}, len(r.cols))} - copy(nrow.cols, r.cols) - return nrow -} - -type fakeConn struct { - db *fakeDB // where to return ourselves to - - currTx *fakeTx - - // Stats for tests: - mu sync.Mutex - stmtsMade int - stmtsClosed int - numPrepare int - - // bad connection tests; see isBad() - bad bool - stickyBad bool -} - -func (c *fakeConn) incrStat(v *int) { - c.mu.Lock() - *v++ - c.mu.Unlock() -} - -type fakeTx struct { - c *fakeConn -} - -type fakeStmt struct { - c *fakeConn - q string // just for debugging - - cmd string - table string - - closed bool - - colName []string // used by CREATE, INSERT, SELECT (selected columns) - colType []string // used by CREATE - colValue []interface{} // used by INSERT (mix of strings and "?" for bound params) - placeholders int // used by INSERT/SELECT: number of ? params - - whereCol []string // used by SELECT (all placeholders) - - placeholderConverter []driver.ValueConverter // used by INSERT -} - -var fdriver driver.Driver = &fakeDriver{} - -func init() { - Register("test", fdriver) -} - -func contains(list []string, y string) bool { - for _, x := range list { - if x == y { - return true - } - } - return false -} - -type Dummy struct { - driver.Driver -} - -func TestDrivers(t *testing.T) { - unregisterAllDrivers() - Register("test", fdriver) - Register("invalid", Dummy{}) - all := Drivers() - if len(all) < 2 || !sort.StringsAreSorted(all) || !contains(all, "test") || !contains(all, "invalid") { - t.Fatalf("Drivers = %v, want sorted list with at least [invalid, test]", all) - } -} - -// Supports dsn forms: -// -// ; (only currently supported option is `badConn`, -// which causes driver.ErrBadConn to be returned on -// every other conn.Begin()) -func (d *fakeDriver) Open(dsn string) (driver.Conn, error) { - parts := strings.Split(dsn, ";") - if len(parts) < 1 { - return nil, errors.New("fakedb: no database name") - } - name := parts[0] - - db := d.getDB(name) - - d.mu.Lock() - d.openCount++ - d.mu.Unlock() - conn := &fakeConn{db: db} - - if len(parts) >= 2 && parts[1] == "badConn" { - conn.bad = true - } - if d.waitCh != nil { - d.waitingCh <- struct{}{} - <-d.waitCh - d.waitCh = nil - d.waitingCh = nil - } - return conn, nil -} - -func (d *fakeDriver) getDB(name string) *fakeDB { - d.mu.Lock() - defer d.mu.Unlock() - if d.dbs == nil { - d.dbs = make(map[string]*fakeDB) - } - db, ok := d.dbs[name] - if !ok { - db = &fakeDB{name: name} - d.dbs[name] = db - } - return db -} - -func (db *fakeDB) wipe() { - db.mu.Lock() - defer db.mu.Unlock() - db.tables = nil -} - -func (db *fakeDB) createTable(name string, columnNames, columnTypes []string) error { - db.mu.Lock() - defer db.mu.Unlock() - if db.tables == nil { - db.tables = make(map[string]*table) - } - if _, exist := db.tables[name]; exist { - return fmt.Errorf("table %q already exists", name) - } - if len(columnNames) != len(columnTypes) { - return fmt.Errorf("create table of %q len(names) != len(types): %d vs %d", - name, len(columnNames), len(columnTypes)) - } - db.tables[name] = &table{colname: columnNames, coltype: columnTypes} - return nil -} - -// must be called with db.mu lock held -func (db *fakeDB) table(table string) (*table, bool) { - if db.tables == nil { - return nil, false - } - t, ok := db.tables[table] - return t, ok -} - -func (db *fakeDB) columnType(table, column string) (typ string, ok bool) { - db.mu.Lock() - defer db.mu.Unlock() - t, ok := db.table(table) - if !ok { - return - } - for n, cname := range t.colname { - if cname == column { - return t.coltype[n], true - } - } - return "", false -} - -func (c *fakeConn) isBad() bool { - if c.stickyBad { - return true - } else if c.bad { - // alternate between bad conn and not bad conn - c.db.badConn = !c.db.badConn - return c.db.badConn - } else { - return false - } -} - -func (c *fakeConn) Begin() (driver.Tx, error) { - if c.isBad() { - return nil, driver.ErrBadConn - } - if c.currTx != nil { - return nil, errors.New("already in a transaction") - } - c.currTx = &fakeTx{c: c} - return c.currTx, nil -} - -var hookPostCloseConn struct { - sync.Mutex - fn func(*fakeConn, error) -} - -func setHookpostCloseConn(fn func(*fakeConn, error)) { - hookPostCloseConn.Lock() - defer hookPostCloseConn.Unlock() - hookPostCloseConn.fn = fn -} - -var testStrictClose *testing.T - -// setStrictFakeConnClose sets the t to Errorf on when fakeConn.Close -// fails to close. If nil, the check is disabled. -func setStrictFakeConnClose(t *testing.T) { - testStrictClose = t -} - -func (c *fakeConn) Close() (err error) { - drv := fdriver.(*fakeDriver) - defer func() { - if err != nil && testStrictClose != nil { - testStrictClose.Errorf("failed to close a test fakeConn: %v", err) - } - hookPostCloseConn.Lock() - fn := hookPostCloseConn.fn - hookPostCloseConn.Unlock() - if fn != nil { - fn(c, err) - } - if err == nil { - drv.mu.Lock() - drv.closeCount++ - drv.mu.Unlock() - } - }() - if c.currTx != nil { - return errors.New("can't close fakeConn; in a Transaction") - } - if c.db == nil { - return errors.New("can't close fakeConn; already closed") - } - if c.stmtsMade > c.stmtsClosed { - return errors.New("can't close; dangling statement(s)") - } - c.db = nil - return nil -} - -func checkSubsetTypes(args []driver.Value) error { - for n, arg := range args { - switch arg.(type) { - case int64, float64, bool, nil, []byte, string, time.Time: - default: - return fmt.Errorf("fakedb_test: invalid argument #%d: %v, type %T", n+1, arg, arg) - } - } - return nil -} - -func (c *fakeConn) Exec(query string, args []driver.Value) (driver.Result, error) { - // This is an optional interface, but it's implemented here - // just to check that all the args are of the proper types. - // ErrSkip is returned so the caller acts as if we didn't - // implement this at all. - err := checkSubsetTypes(args) - if err != nil { - return nil, err - } - return nil, driver.ErrSkip -} - -func (c *fakeConn) Query(query string, args []driver.Value) (driver.Rows, error) { - // This is an optional interface, but it's implemented here - // just to check that all the args are of the proper types. - // ErrSkip is returned so the caller acts as if we didn't - // implement this at all. - err := checkSubsetTypes(args) - if err != nil { - return nil, err - } - return nil, driver.ErrSkip -} - -func errf(msg string, args ...interface{}) error { - return errors.New("fakedb: " + fmt.Sprintf(msg, args...)) -} - -// parts are table|selectCol1,selectCol2|whereCol=?,whereCol2=? -// (note that where columns must always contain ? marks, -// just a limitation for fakedb) -func (c *fakeConn) prepareSelect(stmt *fakeStmt, parts []string) (driver.Stmt, error) { - if len(parts) != 3 { - stmt.Close() - return nil, errf("invalid SELECT syntax with %d parts; want 3", len(parts)) - } - stmt.table = parts[0] - stmt.colName = strings.Split(parts[1], ",") - for n, colspec := range strings.Split(parts[2], ",") { - if colspec == "" { - continue - } - nameVal := strings.Split(colspec, "=") - if len(nameVal) != 2 { - stmt.Close() - return nil, errf("SELECT on table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) - } - column, value := nameVal[0], nameVal[1] - _, ok := c.db.columnType(stmt.table, column) - if !ok { - stmt.Close() - return nil, errf("SELECT on table %q references non-existent column %q", stmt.table, column) - } - if value != "?" { - stmt.Close() - return nil, errf("SELECT on table %q has pre-bound value for where column %q; need a question mark", - stmt.table, column) - } - stmt.whereCol = append(stmt.whereCol, column) - stmt.placeholders++ - } - return stmt, nil -} - -// parts are table|col=type,col2=type2 -func (c *fakeConn) prepareCreate(stmt *fakeStmt, parts []string) (driver.Stmt, error) { - if len(parts) != 2 { - stmt.Close() - return nil, errf("invalid CREATE syntax with %d parts; want 2", len(parts)) - } - stmt.table = parts[0] - for n, colspec := range strings.Split(parts[1], ",") { - nameType := strings.Split(colspec, "=") - if len(nameType) != 2 { - stmt.Close() - return nil, errf("CREATE table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) - } - stmt.colName = append(stmt.colName, nameType[0]) - stmt.colType = append(stmt.colType, nameType[1]) - } - return stmt, nil -} - -// parts are table|col=?,col2=val -func (c *fakeConn) prepareInsert(stmt *fakeStmt, parts []string) (driver.Stmt, error) { - if len(parts) != 2 { - stmt.Close() - return nil, errf("invalid INSERT syntax with %d parts; want 2", len(parts)) - } - stmt.table = parts[0] - for n, colspec := range strings.Split(parts[1], ",") { - nameVal := strings.Split(colspec, "=") - if len(nameVal) != 2 { - stmt.Close() - return nil, errf("INSERT table %q has invalid column spec of %q (index %d)", stmt.table, colspec, n) - } - column, value := nameVal[0], nameVal[1] - ctype, ok := c.db.columnType(stmt.table, column) - if !ok { - stmt.Close() - return nil, errf("INSERT table %q references non-existent column %q", stmt.table, column) - } - stmt.colName = append(stmt.colName, column) - - if value != "?" { - var subsetVal interface{} - // Convert to driver subset type - switch ctype { - case "string": - subsetVal = []byte(value) - case "blob": - subsetVal = []byte(value) - case "int32": - i, err := strconv.Atoi(value) - if err != nil { - stmt.Close() - return nil, errf("invalid conversion to int32 from %q", value) - } - subsetVal = int64(i) // int64 is a subset type, but not int32 - default: - stmt.Close() - return nil, errf("unsupported conversion for pre-bound parameter %q to type %q", value, ctype) - } - stmt.colValue = append(stmt.colValue, subsetVal) - } else { - stmt.placeholders++ - stmt.placeholderConverter = append(stmt.placeholderConverter, converterForType(ctype)) - stmt.colValue = append(stmt.colValue, "?") - } - } - return stmt, nil -} - -// hook to simulate broken connections -var hookPrepareBadConn func() bool - -func (c *fakeConn) Prepare(query string) (driver.Stmt, error) { - c.numPrepare++ - if c.db == nil { - panic("nil c.db; conn = " + fmt.Sprintf("%#v", c)) - } - - if c.stickyBad || (hookPrepareBadConn != nil && hookPrepareBadConn()) { - return nil, driver.ErrBadConn - } - - parts := strings.Split(query, "|") - if len(parts) < 1 { - return nil, errf("empty query") - } - cmd := parts[0] - parts = parts[1:] - stmt := &fakeStmt{q: query, c: c, cmd: cmd} - c.incrStat(&c.stmtsMade) - switch cmd { - case "WIPE": - // Nothing - case "SELECT": - return c.prepareSelect(stmt, parts) - case "CREATE": - return c.prepareCreate(stmt, parts) - case "INSERT": - return c.prepareInsert(stmt, parts) - case "NOSERT": - // Do all the prep-work like for an INSERT but don't actually insert the row. - // Used for some of the concurrent tests. - return c.prepareInsert(stmt, parts) - default: - stmt.Close() - return nil, errf("unsupported command type %q", cmd) - } - return stmt, nil -} - -func (s *fakeStmt) ColumnConverter(idx int) driver.ValueConverter { - if len(s.placeholderConverter) == 0 { - return driver.DefaultParameterConverter - } - return s.placeholderConverter[idx] -} - -func (s *fakeStmt) Close() error { - if s.c == nil { - panic("nil conn in fakeStmt.Close") - } - if s.c.db == nil { - panic("in fakeStmt.Close, conn's db is nil (already closed)") - } - if !s.closed { - s.c.incrStat(&s.c.stmtsClosed) - s.closed = true - } - return nil -} - -var errClosed = errors.New("fakedb: statement has been closed") - -// hook to simulate broken connections -var hookExecBadConn func() bool - -func (s *fakeStmt) Exec(args []driver.Value) (driver.Result, error) { - if s.closed { - return nil, errClosed - } - - if s.c.stickyBad || (hookExecBadConn != nil && hookExecBadConn()) { - return nil, driver.ErrBadConn - } - - err := checkSubsetTypes(args) - if err != nil { - return nil, err - } - - db := s.c.db - switch s.cmd { - case "WIPE": - db.wipe() - return driver.ResultNoRows, nil - case "CREATE": - if err := db.createTable(s.table, s.colName, s.colType); err != nil { - return nil, err - } - return driver.ResultNoRows, nil - case "INSERT": - return s.execInsert(args, true) - case "NOSERT": - // Do all the prep-work like for an INSERT but don't actually insert the row. - // Used for some of the concurrent tests. - return s.execInsert(args, false) - } - fmt.Printf("EXEC statement, cmd=%q: %#v\n", s.cmd, s) - return nil, fmt.Errorf("unimplemented statement Exec command type of %q", s.cmd) -} - -// When doInsert is true, add the row to the table. -// When doInsert is false do prep-work and error checking, but don't -// actually add the row to the table. -func (s *fakeStmt) execInsert(args []driver.Value, doInsert bool) (driver.Result, error) { - db := s.c.db - if len(args) != s.placeholders { - panic("error in pkg db; should only get here if size is correct") - } - db.mu.Lock() - t, ok := db.table(s.table) - db.mu.Unlock() - if !ok { - return nil, fmt.Errorf("fakedb: table %q doesn't exist", s.table) - } - - t.mu.Lock() - defer t.mu.Unlock() - - var cols []interface{} - if doInsert { - cols = make([]interface{}, len(t.colname)) - } - argPos := 0 - for n, colname := range s.colName { - colidx := t.columnIndex(colname) - if colidx == -1 { - return nil, fmt.Errorf("fakedb: column %q doesn't exist or dropped since prepared statement was created", colname) - } - var val interface{} - if strvalue, ok := s.colValue[n].(string); ok && strvalue == "?" { - val = args[argPos] - argPos++ - } else { - val = s.colValue[n] - } - if doInsert { - cols[colidx] = val - } - } - - if doInsert { - t.rows = append(t.rows, &row{cols: cols}) - } - return driver.RowsAffected(1), nil -} - -// hook to simulate broken connections -var hookQueryBadConn func() bool - -func (s *fakeStmt) Query(args []driver.Value) (driver.Rows, error) { - if s.closed { - return nil, errClosed - } - - if s.c.stickyBad || (hookQueryBadConn != nil && hookQueryBadConn()) { - return nil, driver.ErrBadConn - } - - err := checkSubsetTypes(args) - if err != nil { - return nil, err - } - - db := s.c.db - if len(args) != s.placeholders { - panic("error in pkg db; should only get here if size is correct") - } - - db.mu.Lock() - t, ok := db.table(s.table) - db.mu.Unlock() - if !ok { - return nil, fmt.Errorf("fakedb: table %q doesn't exist", s.table) - } - - if s.table == "magicquery" { - if len(s.whereCol) == 2 && s.whereCol[0] == "op" && s.whereCol[1] == "millis" { - if args[0] == "sleep" { - time.Sleep(time.Duration(args[1].(int64)) * time.Millisecond) - } - } - } - - t.mu.Lock() - defer t.mu.Unlock() - - colIdx := make(map[string]int) // select column name -> column index in table - for _, name := range s.colName { - idx := t.columnIndex(name) - if idx == -1 { - return nil, fmt.Errorf("fakedb: unknown column name %q", name) - } - colIdx[name] = idx - } - - mrows := []*row{} -rows: - for _, trow := range t.rows { - // Process the where clause, skipping non-match rows. This is lazy - // and just uses fmt.Sprintf("%v") to test equality. Good enough - // for test code. - for widx, wcol := range s.whereCol { - idx := t.columnIndex(wcol) - if idx == -1 { - return nil, fmt.Errorf("db: invalid where clause column %q", wcol) - } - tcol := trow.cols[idx] - if bs, ok := tcol.([]byte); ok { - // lazy hack to avoid sprintf %v on a []byte - tcol = string(bs) - } - if fmt.Sprintf("%v", tcol) != fmt.Sprintf("%v", args[widx]) { - continue rows - } - } - mrow := &row{cols: make([]interface{}, len(s.colName))} - for seli, name := range s.colName { - mrow.cols[seli] = trow.cols[colIdx[name]] - } - mrows = append(mrows, mrow) - } - - cursor := &rowsCursor{ - pos: -1, - rows: mrows, - cols: s.colName, - errPos: -1, - } - return cursor, nil -} - -func (s *fakeStmt) NumInput() int { - return s.placeholders -} - -func (tx *fakeTx) Commit() error { - tx.c.currTx = nil - return nil -} - -func (tx *fakeTx) Rollback() error { - tx.c.currTx = nil - return nil -} - -type rowsCursor struct { - cols []string - pos int - rows []*row - closed bool - - // errPos and err are for making Next return early with error. - errPos int - err error - - // a clone of slices to give out to clients, indexed by the - // the original slice's first byte address. we clone them - // just so we're able to corrupt them on close. - bytesClone map[*byte][]byte -} - -func (rc *rowsCursor) Close() error { - if !rc.closed { - for _, bs := range rc.bytesClone { - bs[0] = 255 // first byte corrupted - } - } - rc.closed = true - return nil -} - -func (rc *rowsCursor) Columns() []string { - return rc.cols -} - -var rowsCursorNextHook func(dest []driver.Value) error - -func (rc *rowsCursor) Next(dest []driver.Value) error { - if rowsCursorNextHook != nil { - return rowsCursorNextHook(dest) - } - - if rc.closed { - return errors.New("fakedb: cursor is closed") - } - rc.pos++ - if rc.pos == rc.errPos { - return rc.err - } - if rc.pos >= len(rc.rows) { - return io.EOF // per interface spec - } - for i, v := range rc.rows[rc.pos].cols { - // TODO(bradfitz): convert to subset types? naah, I - // think the subset types should only be input to - // driver, but the sql package should be able to handle - // a wider range of types coming out of drivers. all - // for ease of drivers, and to prevent drivers from - // messing up conversions or doing them differently. - dest[i] = v - - if bs, ok := v.([]byte); ok { - if rc.bytesClone == nil { - rc.bytesClone = make(map[*byte][]byte) - } - clone, ok := rc.bytesClone[&bs[0]] - if !ok { - clone = make([]byte, len(bs)) - copy(clone, bs) - rc.bytesClone[&bs[0]] = clone - } - dest[i] = clone - } - } - return nil -} - -// fakeDriverString is like driver.String, but indirects pointers like -// DefaultValueConverter. -// -// This could be surprising behavior to retroactively apply to -// driver.String now that Go1 is out, but this is convenient for -// our TestPointerParamsAndScans. -// -type fakeDriverString struct{} - -func (fakeDriverString) ConvertValue(v interface{}) (driver.Value, error) { - switch c := v.(type) { - case string, []byte: - return v, nil - case *string: - if c == nil { - return nil, nil - } - return *c, nil - } - return fmt.Sprintf("%v", v), nil -} - -func converterForType(typ string) driver.ValueConverter { - switch typ { - case "bool": - return driver.Bool - case "nullbool": - return driver.Null{Converter: driver.Bool} - case "int32": - return driver.Int32 - case "string": - return driver.NotNull{Converter: fakeDriverString{}} - case "nullstring": - return driver.Null{Converter: fakeDriverString{}} - case "int64": - // TODO(coopernurse): add type-specific converter - return driver.NotNull{Converter: driver.DefaultParameterConverter} - case "nullint64": - // TODO(coopernurse): add type-specific converter - return driver.Null{Converter: driver.DefaultParameterConverter} - case "float64": - // TODO(coopernurse): add type-specific converter - return driver.NotNull{Converter: driver.DefaultParameterConverter} - case "nullfloat64": - // TODO(coopernurse): add type-specific converter - return driver.Null{Converter: driver.DefaultParameterConverter} - case "datetime": - return driver.DefaultParameterConverter - } - panic("invalid fakedb column type of " + typ) -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/sql.go b/llgo/third_party/gofrontend/libgo/go/database/sql/sql.go deleted file mode 100644 index aaa4ea28be4527d956e58c08a9d103c2ac7ac42a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/sql.go +++ /dev/null @@ -1,1817 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package sql provides a generic interface around SQL (or SQL-like) -// databases. -// -// The sql package must be used in conjunction with a database driver. -// See https://golang.org/s/sqldrivers for a list of drivers. -// -// For more usage examples, see the wiki page at -// https://golang.org/s/sqlwiki. -package sql - -import ( - "database/sql/driver" - "errors" - "fmt" - "io" - "runtime" - "sort" - "sync" - "sync/atomic" -) - -var ( - driversMu sync.Mutex - drivers = make(map[string]driver.Driver) -) - -// Register makes a database driver available by the provided name. -// If Register is called twice with the same name or if driver is nil, -// it panics. -func Register(name string, driver driver.Driver) { - driversMu.Lock() - defer driversMu.Unlock() - if driver == nil { - panic("sql: Register driver is nil") - } - if _, dup := drivers[name]; dup { - panic("sql: Register called twice for driver " + name) - } - drivers[name] = driver -} - -func unregisterAllDrivers() { - driversMu.Lock() - defer driversMu.Unlock() - // For tests. - drivers = make(map[string]driver.Driver) -} - -// Drivers returns a sorted list of the names of the registered drivers. -func Drivers() []string { - driversMu.Lock() - defer driversMu.Unlock() - var list []string - for name := range drivers { - list = append(list, name) - } - sort.Strings(list) - return list -} - -// RawBytes is a byte slice that holds a reference to memory owned by -// the database itself. After a Scan into a RawBytes, the slice is only -// valid until the next call to Next, Scan, or Close. -type RawBytes []byte - -// NullString represents a string that may be null. -// NullString implements the Scanner interface so -// it can be used as a scan destination: -// -// var s NullString -// err := db.QueryRow("SELECT name FROM foo WHERE id=?", id).Scan(&s) -// ... -// if s.Valid { -// // use s.String -// } else { -// // NULL value -// } -// -type NullString struct { - String string - Valid bool // Valid is true if String is not NULL -} - -// Scan implements the Scanner interface. -func (ns *NullString) Scan(value interface{}) error { - if value == nil { - ns.String, ns.Valid = "", false - return nil - } - ns.Valid = true - return convertAssign(&ns.String, value) -} - -// Value implements the driver Valuer interface. -func (ns NullString) Value() (driver.Value, error) { - if !ns.Valid { - return nil, nil - } - return ns.String, nil -} - -// NullInt64 represents an int64 that may be null. -// NullInt64 implements the Scanner interface so -// it can be used as a scan destination, similar to NullString. -type NullInt64 struct { - Int64 int64 - Valid bool // Valid is true if Int64 is not NULL -} - -// Scan implements the Scanner interface. -func (n *NullInt64) Scan(value interface{}) error { - if value == nil { - n.Int64, n.Valid = 0, false - return nil - } - n.Valid = true - return convertAssign(&n.Int64, value) -} - -// Value implements the driver Valuer interface. -func (n NullInt64) Value() (driver.Value, error) { - if !n.Valid { - return nil, nil - } - return n.Int64, nil -} - -// NullFloat64 represents a float64 that may be null. -// NullFloat64 implements the Scanner interface so -// it can be used as a scan destination, similar to NullString. -type NullFloat64 struct { - Float64 float64 - Valid bool // Valid is true if Float64 is not NULL -} - -// Scan implements the Scanner interface. -func (n *NullFloat64) Scan(value interface{}) error { - if value == nil { - n.Float64, n.Valid = 0, false - return nil - } - n.Valid = true - return convertAssign(&n.Float64, value) -} - -// Value implements the driver Valuer interface. -func (n NullFloat64) Value() (driver.Value, error) { - if !n.Valid { - return nil, nil - } - return n.Float64, nil -} - -// NullBool represents a bool that may be null. -// NullBool implements the Scanner interface so -// it can be used as a scan destination, similar to NullString. -type NullBool struct { - Bool bool - Valid bool // Valid is true if Bool is not NULL -} - -// Scan implements the Scanner interface. -func (n *NullBool) Scan(value interface{}) error { - if value == nil { - n.Bool, n.Valid = false, false - return nil - } - n.Valid = true - return convertAssign(&n.Bool, value) -} - -// Value implements the driver Valuer interface. -func (n NullBool) Value() (driver.Value, error) { - if !n.Valid { - return nil, nil - } - return n.Bool, nil -} - -// Scanner is an interface used by Scan. -type Scanner interface { - // Scan assigns a value from a database driver. - // - // The src value will be of one of the following restricted - // set of types: - // - // int64 - // float64 - // bool - // []byte - // string - // time.Time - // nil - for NULL values - // - // An error should be returned if the value can not be stored - // without loss of information. - Scan(src interface{}) error -} - -// ErrNoRows is returned by Scan when QueryRow doesn't return a -// row. In such a case, QueryRow returns a placeholder *Row value that -// defers this error until a Scan. -var ErrNoRows = errors.New("sql: no rows in result set") - -// DB is a database handle representing a pool of zero or more -// underlying connections. It's safe for concurrent use by multiple -// goroutines. -// -// The sql package creates and frees connections automatically; it -// also maintains a free pool of idle connections. If the database has -// a concept of per-connection state, such state can only be reliably -// observed within a transaction. Once DB.Begin is called, the -// returned Tx is bound to a single connection. Once Commit or -// Rollback is called on the transaction, that transaction's -// connection is returned to DB's idle connection pool. The pool size -// can be controlled with SetMaxIdleConns. -type DB struct { - driver driver.Driver - dsn string - // numClosed is an atomic counter which represents a total number of - // closed connections. Stmt.openStmt checks it before cleaning closed - // connections in Stmt.css. - numClosed uint64 - - mu sync.Mutex // protects following fields - freeConn []*driverConn - connRequests []chan connRequest - numOpen int - pendingOpens int - // Used to signal the need for new connections - // a goroutine running connectionOpener() reads on this chan and - // maybeOpenNewConnections sends on the chan (one send per needed connection) - // It is closed during db.Close(). The close tells the connectionOpener - // goroutine to exit. - openerCh chan struct{} - closed bool - dep map[finalCloser]depSet - lastPut map[*driverConn]string // stacktrace of last conn's put; debug only - maxIdle int // zero means defaultMaxIdleConns; negative means 0 - maxOpen int // <= 0 means unlimited -} - -// connReuseStrategy determines how (*DB).conn returns database connections. -type connReuseStrategy uint8 - -const ( - // alwaysNewConn forces a new connection to the database. - alwaysNewConn connReuseStrategy = iota - // cachedOrNewConn returns a cached connection, if available, else waits - // for one to become available (if MaxOpenConns has been reached) or - // creates a new database connection. - cachedOrNewConn -) - -// driverConn wraps a driver.Conn with a mutex, to -// be held during all calls into the Conn. (including any calls onto -// interfaces returned via that Conn, such as calls on Tx, Stmt, -// Result, Rows) -type driverConn struct { - db *DB - - sync.Mutex // guards following - ci driver.Conn - closed bool - finalClosed bool // ci.Close has been called - openStmt map[driver.Stmt]bool - - // guarded by db.mu - inUse bool - onPut []func() // code (with db.mu held) run when conn is next returned - dbmuClosed bool // same as closed, but guarded by db.mu, for removeClosedStmtLocked -} - -func (dc *driverConn) releaseConn(err error) { - dc.db.putConn(dc, err) -} - -func (dc *driverConn) removeOpenStmt(si driver.Stmt) { - dc.Lock() - defer dc.Unlock() - delete(dc.openStmt, si) -} - -func (dc *driverConn) prepareLocked(query string) (driver.Stmt, error) { - si, err := dc.ci.Prepare(query) - if err == nil { - // Track each driverConn's open statements, so we can close them - // before closing the conn. - // - // TODO(bradfitz): let drivers opt out of caring about - // stmt closes if the conn is about to close anyway? For now - // do the safe thing, in case stmts need to be closed. - // - // TODO(bradfitz): after Go 1.2, closing driver.Stmts - // should be moved to driverStmt, using unique - // *driverStmts everywhere (including from - // *Stmt.connStmt, instead of returning a - // driver.Stmt), using driverStmt as a pointer - // everywhere, and making it a finalCloser. - if dc.openStmt == nil { - dc.openStmt = make(map[driver.Stmt]bool) - } - dc.openStmt[si] = true - } - return si, err -} - -// the dc.db's Mutex is held. -func (dc *driverConn) closeDBLocked() func() error { - dc.Lock() - defer dc.Unlock() - if dc.closed { - return func() error { return errors.New("sql: duplicate driverConn close") } - } - dc.closed = true - return dc.db.removeDepLocked(dc, dc) -} - -func (dc *driverConn) Close() error { - dc.Lock() - if dc.closed { - dc.Unlock() - return errors.New("sql: duplicate driverConn close") - } - dc.closed = true - dc.Unlock() // not defer; removeDep finalClose calls may need to lock - - // And now updates that require holding dc.mu.Lock. - dc.db.mu.Lock() - dc.dbmuClosed = true - fn := dc.db.removeDepLocked(dc, dc) - dc.db.mu.Unlock() - return fn() -} - -func (dc *driverConn) finalClose() error { - dc.Lock() - - for si := range dc.openStmt { - si.Close() - } - dc.openStmt = nil - - err := dc.ci.Close() - dc.ci = nil - dc.finalClosed = true - dc.Unlock() - - dc.db.mu.Lock() - dc.db.numOpen-- - dc.db.maybeOpenNewConnections() - dc.db.mu.Unlock() - - atomic.AddUint64(&dc.db.numClosed, 1) - return err -} - -// driverStmt associates a driver.Stmt with the -// *driverConn from which it came, so the driverConn's lock can be -// held during calls. -type driverStmt struct { - sync.Locker // the *driverConn - si driver.Stmt -} - -func (ds *driverStmt) Close() error { - ds.Lock() - defer ds.Unlock() - return ds.si.Close() -} - -// depSet is a finalCloser's outstanding dependencies -type depSet map[interface{}]bool // set of true bools - -// The finalCloser interface is used by (*DB).addDep and related -// dependency reference counting. -type finalCloser interface { - // finalClose is called when the reference count of an object - // goes to zero. (*DB).mu is not held while calling it. - finalClose() error -} - -// addDep notes that x now depends on dep, and x's finalClose won't be -// called until all of x's dependencies are removed with removeDep. -func (db *DB) addDep(x finalCloser, dep interface{}) { - //println(fmt.Sprintf("addDep(%T %p, %T %p)", x, x, dep, dep)) - db.mu.Lock() - defer db.mu.Unlock() - db.addDepLocked(x, dep) -} - -func (db *DB) addDepLocked(x finalCloser, dep interface{}) { - if db.dep == nil { - db.dep = make(map[finalCloser]depSet) - } - xdep := db.dep[x] - if xdep == nil { - xdep = make(depSet) - db.dep[x] = xdep - } - xdep[dep] = true -} - -// removeDep notes that x no longer depends on dep. -// If x still has dependencies, nil is returned. -// If x no longer has any dependencies, its finalClose method will be -// called and its error value will be returned. -func (db *DB) removeDep(x finalCloser, dep interface{}) error { - db.mu.Lock() - fn := db.removeDepLocked(x, dep) - db.mu.Unlock() - return fn() -} - -func (db *DB) removeDepLocked(x finalCloser, dep interface{}) func() error { - //println(fmt.Sprintf("removeDep(%T %p, %T %p)", x, x, dep, dep)) - - xdep, ok := db.dep[x] - if !ok { - panic(fmt.Sprintf("unpaired removeDep: no deps for %T", x)) - } - - l0 := len(xdep) - delete(xdep, dep) - - switch len(xdep) { - case l0: - // Nothing removed. Shouldn't happen. - panic(fmt.Sprintf("unpaired removeDep: no %T dep on %T", dep, x)) - case 0: - // No more dependencies. - delete(db.dep, x) - return x.finalClose - default: - // Dependencies remain. - return func() error { return nil } - } -} - -// This is the size of the connectionOpener request chan (dn.openerCh). -// This value should be larger than the maximum typical value -// used for db.maxOpen. If maxOpen is significantly larger than -// connectionRequestQueueSize then it is possible for ALL calls into the *DB -// to block until the connectionOpener can satisfy the backlog of requests. -var connectionRequestQueueSize = 1000000 - -// Open opens a database specified by its database driver name and a -// driver-specific data source name, usually consisting of at least a -// database name and connection information. -// -// Most users will open a database via a driver-specific connection -// helper function that returns a *DB. No database drivers are included -// in the Go standard library. See https://golang.org/s/sqldrivers for -// a list of third-party drivers. -// -// Open may just validate its arguments without creating a connection -// to the database. To verify that the data source name is valid, call -// Ping. -// -// The returned DB is safe for concurrent use by multiple goroutines -// and maintains its own pool of idle connections. Thus, the Open -// function should be called just once. It is rarely necessary to -// close a DB. -func Open(driverName, dataSourceName string) (*DB, error) { - driversMu.Lock() - driveri, ok := drivers[driverName] - driversMu.Unlock() - if !ok { - return nil, fmt.Errorf("sql: unknown driver %q (forgotten import?)", driverName) - } - db := &DB{ - driver: driveri, - dsn: dataSourceName, - openerCh: make(chan struct{}, connectionRequestQueueSize), - lastPut: make(map[*driverConn]string), - } - go db.connectionOpener() - return db, nil -} - -// Ping verifies a connection to the database is still alive, -// establishing a connection if necessary. -func (db *DB) Ping() error { - // TODO(bradfitz): give drivers an optional hook to implement - // this in a more efficient or more reliable way, if they - // have one. - dc, err := db.conn(cachedOrNewConn) - if err != nil { - return err - } - db.putConn(dc, nil) - return nil -} - -// Close closes the database, releasing any open resources. -// -// It is rare to Close a DB, as the DB handle is meant to be -// long-lived and shared between many goroutines. -func (db *DB) Close() error { - db.mu.Lock() - if db.closed { // Make DB.Close idempotent - db.mu.Unlock() - return nil - } - close(db.openerCh) - var err error - fns := make([]func() error, 0, len(db.freeConn)) - for _, dc := range db.freeConn { - fns = append(fns, dc.closeDBLocked()) - } - db.freeConn = nil - db.closed = true - for _, req := range db.connRequests { - close(req) - } - db.mu.Unlock() - for _, fn := range fns { - err1 := fn() - if err1 != nil { - err = err1 - } - } - return err -} - -const defaultMaxIdleConns = 2 - -func (db *DB) maxIdleConnsLocked() int { - n := db.maxIdle - switch { - case n == 0: - // TODO(bradfitz): ask driver, if supported, for its default preference - return defaultMaxIdleConns - case n < 0: - return 0 - default: - return n - } -} - -// SetMaxIdleConns sets the maximum number of connections in the idle -// connection pool. -// -// If MaxOpenConns is greater than 0 but less than the new MaxIdleConns -// then the new MaxIdleConns will be reduced to match the MaxOpenConns limit -// -// If n <= 0, no idle connections are retained. -func (db *DB) SetMaxIdleConns(n int) { - db.mu.Lock() - if n > 0 { - db.maxIdle = n - } else { - // No idle connections. - db.maxIdle = -1 - } - // Make sure maxIdle doesn't exceed maxOpen - if db.maxOpen > 0 && db.maxIdleConnsLocked() > db.maxOpen { - db.maxIdle = db.maxOpen - } - var closing []*driverConn - idleCount := len(db.freeConn) - maxIdle := db.maxIdleConnsLocked() - if idleCount > maxIdle { - closing = db.freeConn[maxIdle:] - db.freeConn = db.freeConn[:maxIdle] - } - db.mu.Unlock() - for _, c := range closing { - c.Close() - } -} - -// SetMaxOpenConns sets the maximum number of open connections to the database. -// -// If MaxIdleConns is greater than 0 and the new MaxOpenConns is less than -// MaxIdleConns, then MaxIdleConns will be reduced to match the new -// MaxOpenConns limit -// -// If n <= 0, then there is no limit on the number of open connections. -// The default is 0 (unlimited). -func (db *DB) SetMaxOpenConns(n int) { - db.mu.Lock() - db.maxOpen = n - if n < 0 { - db.maxOpen = 0 - } - syncMaxIdle := db.maxOpen > 0 && db.maxIdleConnsLocked() > db.maxOpen - db.mu.Unlock() - if syncMaxIdle { - db.SetMaxIdleConns(n) - } -} - -// DBStats contains database statistics. -type DBStats struct { - // OpenConnections is the number of open connections to the database. - OpenConnections int -} - -// Stats returns database statistics. -func (db *DB) Stats() DBStats { - db.mu.Lock() - stats := DBStats{ - OpenConnections: db.numOpen, - } - db.mu.Unlock() - return stats -} - -// Assumes db.mu is locked. -// If there are connRequests and the connection limit hasn't been reached, -// then tell the connectionOpener to open new connections. -func (db *DB) maybeOpenNewConnections() { - numRequests := len(db.connRequests) - db.pendingOpens - if db.maxOpen > 0 { - numCanOpen := db.maxOpen - (db.numOpen + db.pendingOpens) - if numRequests > numCanOpen { - numRequests = numCanOpen - } - } - for numRequests > 0 { - db.pendingOpens++ - numRequests-- - db.openerCh <- struct{}{} - } -} - -// Runs in a separate goroutine, opens new connections when requested. -func (db *DB) connectionOpener() { - for range db.openerCh { - db.openNewConnection() - } -} - -// Open one new connection -func (db *DB) openNewConnection() { - ci, err := db.driver.Open(db.dsn) - db.mu.Lock() - defer db.mu.Unlock() - if db.closed { - if err == nil { - ci.Close() - } - return - } - db.pendingOpens-- - if err != nil { - db.putConnDBLocked(nil, err) - return - } - dc := &driverConn{ - db: db, - ci: ci, - } - if db.putConnDBLocked(dc, err) { - db.addDepLocked(dc, dc) - db.numOpen++ - } else { - ci.Close() - } -} - -// connRequest represents one request for a new connection -// When there are no idle connections available, DB.conn will create -// a new connRequest and put it on the db.connRequests list. -type connRequest struct { - conn *driverConn - err error -} - -var errDBClosed = errors.New("sql: database is closed") - -// conn returns a newly-opened or cached *driverConn. -func (db *DB) conn(strategy connReuseStrategy) (*driverConn, error) { - db.mu.Lock() - if db.closed { - db.mu.Unlock() - return nil, errDBClosed - } - - // Prefer a free connection, if possible. - numFree := len(db.freeConn) - if strategy == cachedOrNewConn && numFree > 0 { - conn := db.freeConn[0] - copy(db.freeConn, db.freeConn[1:]) - db.freeConn = db.freeConn[:numFree-1] - conn.inUse = true - db.mu.Unlock() - return conn, nil - } - - // Out of free connections or we were asked not to use one. If we're not - // allowed to open any more connections, make a request and wait. - if db.maxOpen > 0 && db.numOpen >= db.maxOpen { - // Make the connRequest channel. It's buffered so that the - // connectionOpener doesn't block while waiting for the req to be read. - req := make(chan connRequest, 1) - db.connRequests = append(db.connRequests, req) - db.mu.Unlock() - ret := <-req - return ret.conn, ret.err - } - - db.numOpen++ // optimistically - db.mu.Unlock() - ci, err := db.driver.Open(db.dsn) - if err != nil { - db.mu.Lock() - db.numOpen-- // correct for earlier optimism - db.mu.Unlock() - return nil, err - } - db.mu.Lock() - dc := &driverConn{ - db: db, - ci: ci, - } - db.addDepLocked(dc, dc) - dc.inUse = true - db.mu.Unlock() - return dc, nil -} - -var ( - errConnClosed = errors.New("database/sql: internal sentinel error: conn is closed") - errConnBusy = errors.New("database/sql: internal sentinel error: conn is busy") -) - -// putConnHook is a hook for testing. -var putConnHook func(*DB, *driverConn) - -// noteUnusedDriverStatement notes that si is no longer used and should -// be closed whenever possible (when c is next not in use), unless c is -// already closed. -func (db *DB) noteUnusedDriverStatement(c *driverConn, si driver.Stmt) { - db.mu.Lock() - defer db.mu.Unlock() - if c.inUse { - c.onPut = append(c.onPut, func() { - si.Close() - }) - } else { - c.Lock() - defer c.Unlock() - if !c.finalClosed { - si.Close() - } - } -} - -// debugGetPut determines whether getConn & putConn calls' stack traces -// are returned for more verbose crashes. -const debugGetPut = false - -// putConn adds a connection to the db's free pool. -// err is optionally the last error that occurred on this connection. -func (db *DB) putConn(dc *driverConn, err error) { - db.mu.Lock() - if !dc.inUse { - if debugGetPut { - fmt.Printf("putConn(%v) DUPLICATE was: %s\n\nPREVIOUS was: %s", dc, stack(), db.lastPut[dc]) - } - panic("sql: connection returned that was never out") - } - if debugGetPut { - db.lastPut[dc] = stack() - } - dc.inUse = false - - for _, fn := range dc.onPut { - fn() - } - dc.onPut = nil - - if err == driver.ErrBadConn { - // Don't reuse bad connections. - // Since the conn is considered bad and is being discarded, treat it - // as closed. Don't decrement the open count here, finalClose will - // take care of that. - db.maybeOpenNewConnections() - db.mu.Unlock() - dc.Close() - return - } - if putConnHook != nil { - putConnHook(db, dc) - } - added := db.putConnDBLocked(dc, nil) - db.mu.Unlock() - - if !added { - dc.Close() - } -} - -// Satisfy a connRequest or put the driverConn in the idle pool and return true -// or return false. -// putConnDBLocked will satisfy a connRequest if there is one, or it will -// return the *driverConn to the freeConn list if err == nil and the idle -// connection limit will not be exceeded. -// If err != nil, the value of dc is ignored. -// If err == nil, then dc must not equal nil. -// If a connRequest was fulfilled or the *driverConn was placed in the -// freeConn list, then true is returned, otherwise false is returned. -func (db *DB) putConnDBLocked(dc *driverConn, err error) bool { - if db.maxOpen > 0 && db.numOpen > db.maxOpen { - return false - } - if c := len(db.connRequests); c > 0 { - req := db.connRequests[0] - // This copy is O(n) but in practice faster than a linked list. - // TODO: consider compacting it down less often and - // moving the base instead? - copy(db.connRequests, db.connRequests[1:]) - db.connRequests = db.connRequests[:c-1] - if err == nil { - dc.inUse = true - } - req <- connRequest{ - conn: dc, - err: err, - } - return true - } else if err == nil && !db.closed && db.maxIdleConnsLocked() > len(db.freeConn) { - db.freeConn = append(db.freeConn, dc) - return true - } - return false -} - -// maxBadConnRetries is the number of maximum retries if the driver returns -// driver.ErrBadConn to signal a broken connection before forcing a new -// connection to be opened. -const maxBadConnRetries = 2 - -// Prepare creates a prepared statement for later queries or executions. -// Multiple queries or executions may be run concurrently from the -// returned statement. -// The caller must call the statement's Close method -// when the statement is no longer needed. -func (db *DB) Prepare(query string) (*Stmt, error) { - var stmt *Stmt - var err error - for i := 0; i < maxBadConnRetries; i++ { - stmt, err = db.prepare(query, cachedOrNewConn) - if err != driver.ErrBadConn { - break - } - } - if err == driver.ErrBadConn { - return db.prepare(query, alwaysNewConn) - } - return stmt, err -} - -func (db *DB) prepare(query string, strategy connReuseStrategy) (*Stmt, error) { - // TODO: check if db.driver supports an optional - // driver.Preparer interface and call that instead, if so, - // otherwise we make a prepared statement that's bound - // to a connection, and to execute this prepared statement - // we either need to use this connection (if it's free), else - // get a new connection + re-prepare + execute on that one. - dc, err := db.conn(strategy) - if err != nil { - return nil, err - } - dc.Lock() - si, err := dc.prepareLocked(query) - dc.Unlock() - if err != nil { - db.putConn(dc, err) - return nil, err - } - stmt := &Stmt{ - db: db, - query: query, - css: []connStmt{{dc, si}}, - lastNumClosed: atomic.LoadUint64(&db.numClosed), - } - db.addDep(stmt, stmt) - db.putConn(dc, nil) - return stmt, nil -} - -// Exec executes a query without returning any rows. -// The args are for any placeholder parameters in the query. -func (db *DB) Exec(query string, args ...interface{}) (Result, error) { - var res Result - var err error - for i := 0; i < maxBadConnRetries; i++ { - res, err = db.exec(query, args, cachedOrNewConn) - if err != driver.ErrBadConn { - break - } - } - if err == driver.ErrBadConn { - return db.exec(query, args, alwaysNewConn) - } - return res, err -} - -func (db *DB) exec(query string, args []interface{}, strategy connReuseStrategy) (res Result, err error) { - dc, err := db.conn(strategy) - if err != nil { - return nil, err - } - defer func() { - db.putConn(dc, err) - }() - - if execer, ok := dc.ci.(driver.Execer); ok { - dargs, err := driverArgs(nil, args) - if err != nil { - return nil, err - } - dc.Lock() - resi, err := execer.Exec(query, dargs) - dc.Unlock() - if err != driver.ErrSkip { - if err != nil { - return nil, err - } - return driverResult{dc, resi}, nil - } - } - - dc.Lock() - si, err := dc.ci.Prepare(query) - dc.Unlock() - if err != nil { - return nil, err - } - defer withLock(dc, func() { si.Close() }) - return resultFromStatement(driverStmt{dc, si}, args...) -} - -// Query executes a query that returns rows, typically a SELECT. -// The args are for any placeholder parameters in the query. -func (db *DB) Query(query string, args ...interface{}) (*Rows, error) { - var rows *Rows - var err error - for i := 0; i < maxBadConnRetries; i++ { - rows, err = db.query(query, args, cachedOrNewConn) - if err != driver.ErrBadConn { - break - } - } - if err == driver.ErrBadConn { - return db.query(query, args, alwaysNewConn) - } - return rows, err -} - -func (db *DB) query(query string, args []interface{}, strategy connReuseStrategy) (*Rows, error) { - ci, err := db.conn(strategy) - if err != nil { - return nil, err - } - - return db.queryConn(ci, ci.releaseConn, query, args) -} - -// queryConn executes a query on the given connection. -// The connection gets released by the releaseConn function. -func (db *DB) queryConn(dc *driverConn, releaseConn func(error), query string, args []interface{}) (*Rows, error) { - if queryer, ok := dc.ci.(driver.Queryer); ok { - dargs, err := driverArgs(nil, args) - if err != nil { - releaseConn(err) - return nil, err - } - dc.Lock() - rowsi, err := queryer.Query(query, dargs) - dc.Unlock() - if err != driver.ErrSkip { - if err != nil { - releaseConn(err) - return nil, err - } - // Note: ownership of dc passes to the *Rows, to be freed - // with releaseConn. - rows := &Rows{ - dc: dc, - releaseConn: releaseConn, - rowsi: rowsi, - } - return rows, nil - } - } - - dc.Lock() - si, err := dc.ci.Prepare(query) - dc.Unlock() - if err != nil { - releaseConn(err) - return nil, err - } - - ds := driverStmt{dc, si} - rowsi, err := rowsiFromStatement(ds, args...) - if err != nil { - dc.Lock() - si.Close() - dc.Unlock() - releaseConn(err) - return nil, err - } - - // Note: ownership of ci passes to the *Rows, to be freed - // with releaseConn. - rows := &Rows{ - dc: dc, - releaseConn: releaseConn, - rowsi: rowsi, - closeStmt: si, - } - return rows, nil -} - -// QueryRow executes a query that is expected to return at most one row. -// QueryRow always return a non-nil value. Errors are deferred until -// Row's Scan method is called. -func (db *DB) QueryRow(query string, args ...interface{}) *Row { - rows, err := db.Query(query, args...) - return &Row{rows: rows, err: err} -} - -// Begin starts a transaction. The isolation level is dependent on -// the driver. -func (db *DB) Begin() (*Tx, error) { - var tx *Tx - var err error - for i := 0; i < maxBadConnRetries; i++ { - tx, err = db.begin(cachedOrNewConn) - if err != driver.ErrBadConn { - break - } - } - if err == driver.ErrBadConn { - return db.begin(alwaysNewConn) - } - return tx, err -} - -func (db *DB) begin(strategy connReuseStrategy) (tx *Tx, err error) { - dc, err := db.conn(strategy) - if err != nil { - return nil, err - } - dc.Lock() - txi, err := dc.ci.Begin() - dc.Unlock() - if err != nil { - db.putConn(dc, err) - return nil, err - } - return &Tx{ - db: db, - dc: dc, - txi: txi, - }, nil -} - -// Driver returns the database's underlying driver. -func (db *DB) Driver() driver.Driver { - return db.driver -} - -// Tx is an in-progress database transaction. -// -// A transaction must end with a call to Commit or Rollback. -// -// After a call to Commit or Rollback, all operations on the -// transaction fail with ErrTxDone. -// -// The statements prepared for a transaction by calling -// the transaction's Prepare or Stmt methods are closed -// by the call to Commit or Rollback. -type Tx struct { - db *DB - - // dc is owned exclusively until Commit or Rollback, at which point - // it's returned with putConn. - dc *driverConn - txi driver.Tx - - // done transitions from false to true exactly once, on Commit - // or Rollback. once done, all operations fail with - // ErrTxDone. - done bool - - // All Stmts prepared for this transaction. These will be closed after the - // transaction has been committed or rolled back. - stmts struct { - sync.Mutex - v []*Stmt - } -} - -var ErrTxDone = errors.New("sql: Transaction has already been committed or rolled back") - -func (tx *Tx) close() { - if tx.done { - panic("double close") // internal error - } - tx.done = true - tx.db.putConn(tx.dc, nil) - tx.dc = nil - tx.txi = nil -} - -func (tx *Tx) grabConn() (*driverConn, error) { - if tx.done { - return nil, ErrTxDone - } - return tx.dc, nil -} - -// Closes all Stmts prepared for this transaction. -func (tx *Tx) closePrepared() { - tx.stmts.Lock() - for _, stmt := range tx.stmts.v { - stmt.Close() - } - tx.stmts.Unlock() -} - -// Commit commits the transaction. -func (tx *Tx) Commit() error { - if tx.done { - return ErrTxDone - } - defer tx.close() - tx.dc.Lock() - err := tx.txi.Commit() - tx.dc.Unlock() - if err != driver.ErrBadConn { - tx.closePrepared() - } - return err -} - -// Rollback aborts the transaction. -func (tx *Tx) Rollback() error { - if tx.done { - return ErrTxDone - } - defer tx.close() - tx.dc.Lock() - err := tx.txi.Rollback() - tx.dc.Unlock() - if err != driver.ErrBadConn { - tx.closePrepared() - } - return err -} - -// Prepare creates a prepared statement for use within a transaction. -// -// The returned statement operates within the transaction and can no longer -// be used once the transaction has been committed or rolled back. -// -// To use an existing prepared statement on this transaction, see Tx.Stmt. -func (tx *Tx) Prepare(query string) (*Stmt, error) { - // TODO(bradfitz): We could be more efficient here and either - // provide a method to take an existing Stmt (created on - // perhaps a different Conn), and re-create it on this Conn if - // necessary. Or, better: keep a map in DB of query string to - // Stmts, and have Stmt.Execute do the right thing and - // re-prepare if the Conn in use doesn't have that prepared - // statement. But we'll want to avoid caching the statement - // in the case where we only call conn.Prepare implicitly - // (such as in db.Exec or tx.Exec), but the caller package - // can't be holding a reference to the returned statement. - // Perhaps just looking at the reference count (by noting - // Stmt.Close) would be enough. We might also want a finalizer - // on Stmt to drop the reference count. - dc, err := tx.grabConn() - if err != nil { - return nil, err - } - - dc.Lock() - si, err := dc.ci.Prepare(query) - dc.Unlock() - if err != nil { - return nil, err - } - - stmt := &Stmt{ - db: tx.db, - tx: tx, - txsi: &driverStmt{ - Locker: dc, - si: si, - }, - query: query, - } - tx.stmts.Lock() - tx.stmts.v = append(tx.stmts.v, stmt) - tx.stmts.Unlock() - return stmt, nil -} - -// Stmt returns a transaction-specific prepared statement from -// an existing statement. -// -// Example: -// updateMoney, err := db.Prepare("UPDATE balance SET money=money+? WHERE id=?") -// ... -// tx, err := db.Begin() -// ... -// res, err := tx.Stmt(updateMoney).Exec(123.45, 98293203) -// -// The returned statement operates within the transaction and can no longer -// be used once the transaction has been committed or rolled back. -func (tx *Tx) Stmt(stmt *Stmt) *Stmt { - // TODO(bradfitz): optimize this. Currently this re-prepares - // each time. This is fine for now to illustrate the API but - // we should really cache already-prepared statements - // per-Conn. See also the big comment in Tx.Prepare. - - if tx.db != stmt.db { - return &Stmt{stickyErr: errors.New("sql: Tx.Stmt: statement from different database used")} - } - dc, err := tx.grabConn() - if err != nil { - return &Stmt{stickyErr: err} - } - dc.Lock() - si, err := dc.ci.Prepare(stmt.query) - dc.Unlock() - txs := &Stmt{ - db: tx.db, - tx: tx, - txsi: &driverStmt{ - Locker: dc, - si: si, - }, - query: stmt.query, - stickyErr: err, - } - tx.stmts.Lock() - tx.stmts.v = append(tx.stmts.v, txs) - tx.stmts.Unlock() - return txs -} - -// Exec executes a query that doesn't return rows. -// For example: an INSERT and UPDATE. -func (tx *Tx) Exec(query string, args ...interface{}) (Result, error) { - dc, err := tx.grabConn() - if err != nil { - return nil, err - } - - if execer, ok := dc.ci.(driver.Execer); ok { - dargs, err := driverArgs(nil, args) - if err != nil { - return nil, err - } - dc.Lock() - resi, err := execer.Exec(query, dargs) - dc.Unlock() - if err == nil { - return driverResult{dc, resi}, nil - } - if err != driver.ErrSkip { - return nil, err - } - } - - dc.Lock() - si, err := dc.ci.Prepare(query) - dc.Unlock() - if err != nil { - return nil, err - } - defer withLock(dc, func() { si.Close() }) - - return resultFromStatement(driverStmt{dc, si}, args...) -} - -// Query executes a query that returns rows, typically a SELECT. -func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error) { - dc, err := tx.grabConn() - if err != nil { - return nil, err - } - releaseConn := func(error) {} - return tx.db.queryConn(dc, releaseConn, query, args) -} - -// QueryRow executes a query that is expected to return at most one row. -// QueryRow always return a non-nil value. Errors are deferred until -// Row's Scan method is called. -func (tx *Tx) QueryRow(query string, args ...interface{}) *Row { - rows, err := tx.Query(query, args...) - return &Row{rows: rows, err: err} -} - -// connStmt is a prepared statement on a particular connection. -type connStmt struct { - dc *driverConn - si driver.Stmt -} - -// Stmt is a prepared statement. -// A Stmt is safe for concurrent use by multiple goroutines. -type Stmt struct { - // Immutable: - db *DB // where we came from - query string // that created the Stmt - stickyErr error // if non-nil, this error is returned for all operations - - closemu sync.RWMutex // held exclusively during close, for read otherwise. - - // If in a transaction, else both nil: - tx *Tx - txsi *driverStmt - - mu sync.Mutex // protects the rest of the fields - closed bool - - // css is a list of underlying driver statement interfaces - // that are valid on particular connections. This is only - // used if tx == nil and one is found that has idle - // connections. If tx != nil, txsi is always used. - css []connStmt - - // lastNumClosed is copied from db.numClosed when Stmt is created - // without tx and closed connections in css are removed. - lastNumClosed uint64 -} - -// Exec executes a prepared statement with the given arguments and -// returns a Result summarizing the effect of the statement. -func (s *Stmt) Exec(args ...interface{}) (Result, error) { - s.closemu.RLock() - defer s.closemu.RUnlock() - - var res Result - for i := 0; i < maxBadConnRetries; i++ { - dc, releaseConn, si, err := s.connStmt() - if err != nil { - if err == driver.ErrBadConn { - continue - } - return nil, err - } - - res, err = resultFromStatement(driverStmt{dc, si}, args...) - releaseConn(err) - if err != driver.ErrBadConn { - return res, err - } - } - return nil, driver.ErrBadConn -} - -func resultFromStatement(ds driverStmt, args ...interface{}) (Result, error) { - ds.Lock() - want := ds.si.NumInput() - ds.Unlock() - - // -1 means the driver doesn't know how to count the number of - // placeholders, so we won't sanity check input here and instead let the - // driver deal with errors. - if want != -1 && len(args) != want { - return nil, fmt.Errorf("sql: expected %d arguments, got %d", want, len(args)) - } - - dargs, err := driverArgs(&ds, args) - if err != nil { - return nil, err - } - - ds.Lock() - resi, err := ds.si.Exec(dargs) - ds.Unlock() - if err != nil { - return nil, err - } - return driverResult{ds.Locker, resi}, nil -} - -// removeClosedStmtLocked removes closed conns in s.css. -// -// To avoid lock contention on DB.mu, we do it only when -// s.db.numClosed - s.lastNum is large enough. -func (s *Stmt) removeClosedStmtLocked() { - t := len(s.css)/2 + 1 - if t > 10 { - t = 10 - } - dbClosed := atomic.LoadUint64(&s.db.numClosed) - if dbClosed-s.lastNumClosed < uint64(t) { - return - } - - s.db.mu.Lock() - for i := 0; i < len(s.css); i++ { - if s.css[i].dc.dbmuClosed { - s.css[i] = s.css[len(s.css)-1] - s.css = s.css[:len(s.css)-1] - i-- - } - } - s.db.mu.Unlock() - s.lastNumClosed = dbClosed -} - -// connStmt returns a free driver connection on which to execute the -// statement, a function to call to release the connection, and a -// statement bound to that connection. -func (s *Stmt) connStmt() (ci *driverConn, releaseConn func(error), si driver.Stmt, err error) { - if err = s.stickyErr; err != nil { - return - } - s.mu.Lock() - if s.closed { - s.mu.Unlock() - err = errors.New("sql: statement is closed") - return - } - - // In a transaction, we always use the connection that the - // transaction was created on. - if s.tx != nil { - s.mu.Unlock() - ci, err = s.tx.grabConn() // blocks, waiting for the connection. - if err != nil { - return - } - releaseConn = func(error) {} - return ci, releaseConn, s.txsi.si, nil - } - - s.removeClosedStmtLocked() - s.mu.Unlock() - - // TODO(bradfitz): or always wait for one? make configurable later? - dc, err := s.db.conn(cachedOrNewConn) - if err != nil { - return nil, nil, nil, err - } - - s.mu.Lock() - for _, v := range s.css { - if v.dc == dc { - s.mu.Unlock() - return dc, dc.releaseConn, v.si, nil - } - } - s.mu.Unlock() - - // No luck; we need to prepare the statement on this connection - dc.Lock() - si, err = dc.prepareLocked(s.query) - dc.Unlock() - if err != nil { - s.db.putConn(dc, err) - return nil, nil, nil, err - } - s.mu.Lock() - cs := connStmt{dc, si} - s.css = append(s.css, cs) - s.mu.Unlock() - - return dc, dc.releaseConn, si, nil -} - -// Query executes a prepared query statement with the given arguments -// and returns the query results as a *Rows. -func (s *Stmt) Query(args ...interface{}) (*Rows, error) { - s.closemu.RLock() - defer s.closemu.RUnlock() - - var rowsi driver.Rows - for i := 0; i < maxBadConnRetries; i++ { - dc, releaseConn, si, err := s.connStmt() - if err != nil { - if err == driver.ErrBadConn { - continue - } - return nil, err - } - - rowsi, err = rowsiFromStatement(driverStmt{dc, si}, args...) - if err == nil { - // Note: ownership of ci passes to the *Rows, to be freed - // with releaseConn. - rows := &Rows{ - dc: dc, - rowsi: rowsi, - // releaseConn set below - } - s.db.addDep(s, rows) - rows.releaseConn = func(err error) { - releaseConn(err) - s.db.removeDep(s, rows) - } - return rows, nil - } - - releaseConn(err) - if err != driver.ErrBadConn { - return nil, err - } - } - return nil, driver.ErrBadConn -} - -func rowsiFromStatement(ds driverStmt, args ...interface{}) (driver.Rows, error) { - ds.Lock() - want := ds.si.NumInput() - ds.Unlock() - - // -1 means the driver doesn't know how to count the number of - // placeholders, so we won't sanity check input here and instead let the - // driver deal with errors. - if want != -1 && len(args) != want { - return nil, fmt.Errorf("sql: statement expects %d inputs; got %d", want, len(args)) - } - - dargs, err := driverArgs(&ds, args) - if err != nil { - return nil, err - } - - ds.Lock() - rowsi, err := ds.si.Query(dargs) - ds.Unlock() - if err != nil { - return nil, err - } - return rowsi, nil -} - -// QueryRow executes a prepared query statement with the given arguments. -// If an error occurs during the execution of the statement, that error will -// be returned by a call to Scan on the returned *Row, which is always non-nil. -// If the query selects no rows, the *Row's Scan will return ErrNoRows. -// Otherwise, the *Row's Scan scans the first selected row and discards -// the rest. -// -// Example usage: -// -// var name string -// err := nameByUseridStmt.QueryRow(id).Scan(&name) -func (s *Stmt) QueryRow(args ...interface{}) *Row { - rows, err := s.Query(args...) - if err != nil { - return &Row{err: err} - } - return &Row{rows: rows} -} - -// Close closes the statement. -func (s *Stmt) Close() error { - s.closemu.Lock() - defer s.closemu.Unlock() - - if s.stickyErr != nil { - return s.stickyErr - } - s.mu.Lock() - if s.closed { - s.mu.Unlock() - return nil - } - s.closed = true - - if s.tx != nil { - s.txsi.Close() - s.mu.Unlock() - return nil - } - s.mu.Unlock() - - return s.db.removeDep(s, s) -} - -func (s *Stmt) finalClose() error { - s.mu.Lock() - defer s.mu.Unlock() - if s.css != nil { - for _, v := range s.css { - s.db.noteUnusedDriverStatement(v.dc, v.si) - v.dc.removeOpenStmt(v.si) - } - s.css = nil - } - return nil -} - -// Rows is the result of a query. Its cursor starts before the first row -// of the result set. Use Next to advance through the rows: -// -// rows, err := db.Query("SELECT ...") -// ... -// defer rows.Close() -// for rows.Next() { -// var id int -// var name string -// err = rows.Scan(&id, &name) -// ... -// } -// err = rows.Err() // get any error encountered during iteration -// ... -type Rows struct { - dc *driverConn // owned; must call releaseConn when closed to release - releaseConn func(error) - rowsi driver.Rows - - closed bool - lastcols []driver.Value - lasterr error // non-nil only if closed is true - closeStmt driver.Stmt // if non-nil, statement to Close on close -} - -// Next prepares the next result row for reading with the Scan method. It -// returns true on success, or false if there is no next result row or an error -// happened while preparing it. Err should be consulted to distinguish between -// the two cases. -// -// Every call to Scan, even the first one, must be preceded by a call to Next. -func (rs *Rows) Next() bool { - if rs.closed { - return false - } - if rs.lastcols == nil { - rs.lastcols = make([]driver.Value, len(rs.rowsi.Columns())) - } - rs.lasterr = rs.rowsi.Next(rs.lastcols) - if rs.lasterr != nil { - rs.Close() - return false - } - return true -} - -// Err returns the error, if any, that was encountered during iteration. -// Err may be called after an explicit or implicit Close. -func (rs *Rows) Err() error { - if rs.lasterr == io.EOF { - return nil - } - return rs.lasterr -} - -// Columns returns the column names. -// Columns returns an error if the rows are closed, or if the rows -// are from QueryRow and there was a deferred error. -func (rs *Rows) Columns() ([]string, error) { - if rs.closed { - return nil, errors.New("sql: Rows are closed") - } - if rs.rowsi == nil { - return nil, errors.New("sql: no Rows available") - } - return rs.rowsi.Columns(), nil -} - -// Scan copies the columns in the current row into the values pointed -// at by dest. -// -// If an argument has type *[]byte, Scan saves in that argument a copy -// of the corresponding data. The copy is owned by the caller and can -// be modified and held indefinitely. The copy can be avoided by using -// an argument of type *RawBytes instead; see the documentation for -// RawBytes for restrictions on its use. -// -// If an argument has type *interface{}, Scan copies the value -// provided by the underlying driver without conversion. If the value -// is of type []byte, a copy is made and the caller owns the result. -func (rs *Rows) Scan(dest ...interface{}) error { - if rs.closed { - return errors.New("sql: Rows are closed") - } - if rs.lastcols == nil { - return errors.New("sql: Scan called without calling Next") - } - if len(dest) != len(rs.lastcols) { - return fmt.Errorf("sql: expected %d destination arguments in Scan, not %d", len(rs.lastcols), len(dest)) - } - for i, sv := range rs.lastcols { - err := convertAssign(dest[i], sv) - if err != nil { - return fmt.Errorf("sql: Scan error on column index %d: %v", i, err) - } - } - return nil -} - -var rowsCloseHook func(*Rows, *error) - -// Close closes the Rows, preventing further enumeration. If Next returns -// false, the Rows are closed automatically and it will suffice to check the -// result of Err. Close is idempotent and does not affect the result of Err. -func (rs *Rows) Close() error { - if rs.closed { - return nil - } - rs.closed = true - err := rs.rowsi.Close() - if fn := rowsCloseHook; fn != nil { - fn(rs, &err) - } - if rs.closeStmt != nil { - rs.closeStmt.Close() - } - rs.releaseConn(err) - return err -} - -// Row is the result of calling QueryRow to select a single row. -type Row struct { - // One of these two will be non-nil: - err error // deferred error for easy chaining - rows *Rows -} - -// Scan copies the columns from the matched row into the values -// pointed at by dest. If more than one row matches the query, -// Scan uses the first row and discards the rest. If no row matches -// the query, Scan returns ErrNoRows. -func (r *Row) Scan(dest ...interface{}) error { - if r.err != nil { - return r.err - } - - // TODO(bradfitz): for now we need to defensively clone all - // []byte that the driver returned (not permitting - // *RawBytes in Rows.Scan), since we're about to close - // the Rows in our defer, when we return from this function. - // the contract with the driver.Next(...) interface is that it - // can return slices into read-only temporary memory that's - // only valid until the next Scan/Close. But the TODO is that - // for a lot of drivers, this copy will be unnecessary. We - // should provide an optional interface for drivers to - // implement to say, "don't worry, the []bytes that I return - // from Next will not be modified again." (for instance, if - // they were obtained from the network anyway) But for now we - // don't care. - defer r.rows.Close() - for _, dp := range dest { - if _, ok := dp.(*RawBytes); ok { - return errors.New("sql: RawBytes isn't allowed on Row.Scan") - } - } - - if !r.rows.Next() { - if err := r.rows.Err(); err != nil { - return err - } - return ErrNoRows - } - err := r.rows.Scan(dest...) - if err != nil { - return err - } - // Make sure the query can be processed to completion with no errors. - if err := r.rows.Close(); err != nil { - return err - } - - return nil -} - -// A Result summarizes an executed SQL command. -type Result interface { - // LastInsertId returns the integer generated by the database - // in response to a command. Typically this will be from an - // "auto increment" column when inserting a new row. Not all - // databases support this feature, and the syntax of such - // statements varies. - LastInsertId() (int64, error) - - // RowsAffected returns the number of rows affected by an - // update, insert, or delete. Not every database or database - // driver may support this. - RowsAffected() (int64, error) -} - -type driverResult struct { - sync.Locker // the *driverConn - resi driver.Result -} - -func (dr driverResult) LastInsertId() (int64, error) { - dr.Lock() - defer dr.Unlock() - return dr.resi.LastInsertId() -} - -func (dr driverResult) RowsAffected() (int64, error) { - dr.Lock() - defer dr.Unlock() - return dr.resi.RowsAffected() -} - -func stack() string { - var buf [2 << 10]byte - return string(buf[:runtime.Stack(buf[:], false)]) -} - -// withLock runs while holding lk. -func withLock(lk sync.Locker, fn func()) { - lk.Lock() - fn() - lk.Unlock() -} diff --git a/llgo/third_party/gofrontend/libgo/go/database/sql/sql_test.go b/llgo/third_party/gofrontend/libgo/go/database/sql/sql_test.go deleted file mode 100644 index 432a641b85549632dba855b4500a7bf32a209ae4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/database/sql/sql_test.go +++ /dev/null @@ -1,2109 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package sql - -import ( - "database/sql/driver" - "errors" - "fmt" - "math/rand" - "reflect" - "runtime" - "strings" - "sync" - "testing" - "time" -) - -func init() { - type dbConn struct { - db *DB - c *driverConn - } - freedFrom := make(map[dbConn]string) - putConnHook = func(db *DB, c *driverConn) { - idx := -1 - for i, v := range db.freeConn { - if v == c { - idx = i - break - } - } - if idx >= 0 { - // print before panic, as panic may get lost due to conflicting panic - // (all goroutines asleep) elsewhere, since we might not unlock - // the mutex in freeConn here. - println("double free of conn. conflicts are:\nA) " + freedFrom[dbConn{db, c}] + "\n\nand\nB) " + stack()) - panic("double free of conn.") - } - freedFrom[dbConn{db, c}] = stack() - } -} - -const fakeDBName = "foo" - -var chrisBirthday = time.Unix(123456789, 0) - -func newTestDB(t testing.TB, name string) *DB { - db, err := Open("test", fakeDBName) - if err != nil { - t.Fatalf("Open: %v", err) - } - if _, err := db.Exec("WIPE"); err != nil { - t.Fatalf("exec wipe: %v", err) - } - if name == "people" { - exec(t, db, "CREATE|people|name=string,age=int32,photo=blob,dead=bool,bdate=datetime") - exec(t, db, "INSERT|people|name=Alice,age=?,photo=APHOTO", 1) - exec(t, db, "INSERT|people|name=Bob,age=?,photo=BPHOTO", 2) - exec(t, db, "INSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) - } - if name == "magicquery" { - // Magic table name and column, known by fakedb_test.go. - exec(t, db, "CREATE|magicquery|op=string,millis=int32") - exec(t, db, "INSERT|magicquery|op=sleep,millis=10") - } - return db -} - -func exec(t testing.TB, db *DB, query string, args ...interface{}) { - _, err := db.Exec(query, args...) - if err != nil { - t.Fatalf("Exec of %q: %v", query, err) - } -} - -func closeDB(t testing.TB, db *DB) { - if e := recover(); e != nil { - fmt.Printf("Panic: %v\n", e) - panic(e) - } - defer setHookpostCloseConn(nil) - setHookpostCloseConn(func(_ *fakeConn, err error) { - if err != nil { - t.Errorf("Error closing fakeConn: %v", err) - } - }) - for i, dc := range db.freeConn { - if n := len(dc.openStmt); n > 0 { - // Just a sanity check. This is legal in - // general, but if we make the tests clean up - // their statements first, then we can safely - // verify this is always zero here, and any - // other value is a leak. - t.Errorf("while closing db, freeConn %d/%d had %d open stmts; want 0", i, len(db.freeConn), n) - } - } - err := db.Close() - if err != nil { - t.Fatalf("error closing DB: %v", err) - } - db.mu.Lock() - count := db.numOpen - db.mu.Unlock() - if count != 0 { - t.Fatalf("%d connections still open after closing DB", db.numOpen) - } -} - -// numPrepares assumes that db has exactly 1 idle conn and returns -// its count of calls to Prepare -func numPrepares(t *testing.T, db *DB) int { - if n := len(db.freeConn); n != 1 { - t.Fatalf("free conns = %d; want 1", n) - } - return db.freeConn[0].ci.(*fakeConn).numPrepare -} - -func (db *DB) numDeps() int { - db.mu.Lock() - defer db.mu.Unlock() - return len(db.dep) -} - -// Dependencies are closed via a goroutine, so this polls waiting for -// numDeps to fall to want, waiting up to d. -func (db *DB) numDepsPollUntil(want int, d time.Duration) int { - deadline := time.Now().Add(d) - for { - n := db.numDeps() - if n <= want || time.Now().After(deadline) { - return n - } - time.Sleep(50 * time.Millisecond) - } -} - -func (db *DB) numFreeConns() int { - db.mu.Lock() - defer db.mu.Unlock() - return len(db.freeConn) -} - -func (db *DB) dumpDeps(t *testing.T) { - for fc := range db.dep { - db.dumpDep(t, 0, fc, map[finalCloser]bool{}) - } -} - -func (db *DB) dumpDep(t *testing.T, depth int, dep finalCloser, seen map[finalCloser]bool) { - seen[dep] = true - indent := strings.Repeat(" ", depth) - ds := db.dep[dep] - for k := range ds { - t.Logf("%s%T (%p) waiting for -> %T (%p)", indent, dep, dep, k, k) - if fc, ok := k.(finalCloser); ok { - if !seen[fc] { - db.dumpDep(t, depth+1, fc, seen) - } - } - } -} - -func TestQuery(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - prepares0 := numPrepares(t, db) - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatalf("Query: %v", err) - } - type row struct { - age int - name string - } - got := []row{} - for rows.Next() { - var r row - err = rows.Scan(&r.age, &r.name) - if err != nil { - t.Fatalf("Scan: %v", err) - } - got = append(got, r) - } - err = rows.Err() - if err != nil { - t.Fatalf("Err: %v", err) - } - want := []row{ - {age: 1, name: "Alice"}, - {age: 2, name: "Bob"}, - {age: 3, name: "Chris"}, - } - if !reflect.DeepEqual(got, want) { - t.Errorf("mismatch.\n got: %#v\nwant: %#v", got, want) - } - - // And verify that the final rows.Next() call, which hit EOF, - // also closed the rows connection. - if n := db.numFreeConns(); n != 1 { - t.Fatalf("free conns after query hitting EOF = %d; want 1", n) - } - if prepares := numPrepares(t, db) - prepares0; prepares != 1 { - t.Errorf("executed %d Prepare statements; want 1", prepares) - } -} - -func TestByteOwnership(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - rows, err := db.Query("SELECT|people|name,photo|") - if err != nil { - t.Fatalf("Query: %v", err) - } - type row struct { - name []byte - photo RawBytes - } - got := []row{} - for rows.Next() { - var r row - err = rows.Scan(&r.name, &r.photo) - if err != nil { - t.Fatalf("Scan: %v", err) - } - got = append(got, r) - } - corruptMemory := []byte("\xffPHOTO") - want := []row{ - {name: []byte("Alice"), photo: corruptMemory}, - {name: []byte("Bob"), photo: corruptMemory}, - {name: []byte("Chris"), photo: corruptMemory}, - } - if !reflect.DeepEqual(got, want) { - t.Errorf("mismatch.\n got: %#v\nwant: %#v", got, want) - } - - var photo RawBytes - err = db.QueryRow("SELECT|people|photo|name=?", "Alice").Scan(&photo) - if err == nil { - t.Error("want error scanning into RawBytes from QueryRow") - } -} - -func TestRowsColumns(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatalf("Query: %v", err) - } - cols, err := rows.Columns() - if err != nil { - t.Fatalf("Columns: %v", err) - } - want := []string{"age", "name"} - if !reflect.DeepEqual(cols, want) { - t.Errorf("got %#v; want %#v", cols, want) - } - if err := rows.Close(); err != nil { - t.Errorf("error closing rows: %s", err) - } -} - -func TestQueryRow(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - var name string - var age int - var birthday time.Time - - err := db.QueryRow("SELECT|people|age,name|age=?", 3).Scan(&age) - if err == nil || !strings.Contains(err.Error(), "expected 2 destination arguments") { - t.Errorf("expected error from wrong number of arguments; actually got: %v", err) - } - - err = db.QueryRow("SELECT|people|bdate|age=?", 3).Scan(&birthday) - if err != nil || !birthday.Equal(chrisBirthday) { - t.Errorf("chris birthday = %v, err = %v; want %v", birthday, err, chrisBirthday) - } - - err = db.QueryRow("SELECT|people|age,name|age=?", 2).Scan(&age, &name) - if err != nil { - t.Fatalf("age QueryRow+Scan: %v", err) - } - if name != "Bob" { - t.Errorf("expected name Bob, got %q", name) - } - if age != 2 { - t.Errorf("expected age 2, got %d", age) - } - - err = db.QueryRow("SELECT|people|age,name|name=?", "Alice").Scan(&age, &name) - if err != nil { - t.Fatalf("name QueryRow+Scan: %v", err) - } - if name != "Alice" { - t.Errorf("expected name Alice, got %q", name) - } - if age != 1 { - t.Errorf("expected age 1, got %d", age) - } - - var photo []byte - err = db.QueryRow("SELECT|people|photo|name=?", "Alice").Scan(&photo) - if err != nil { - t.Fatalf("photo QueryRow+Scan: %v", err) - } - want := []byte("APHOTO") - if !reflect.DeepEqual(photo, want) { - t.Errorf("photo = %q; want %q", photo, want) - } -} - -func TestStatementErrorAfterClose(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - stmt, err := db.Prepare("SELECT|people|age|name=?") - if err != nil { - t.Fatalf("Prepare: %v", err) - } - err = stmt.Close() - if err != nil { - t.Fatalf("Close: %v", err) - } - var name string - err = stmt.QueryRow("foo").Scan(&name) - if err == nil { - t.Errorf("expected error from QueryRow.Scan after Stmt.Close") - } -} - -func TestStatementQueryRow(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - stmt, err := db.Prepare("SELECT|people|age|name=?") - if err != nil { - t.Fatalf("Prepare: %v", err) - } - defer stmt.Close() - var age int - for n, tt := range []struct { - name string - want int - }{ - {"Alice", 1}, - {"Bob", 2}, - {"Chris", 3}, - } { - if err := stmt.QueryRow(tt.name).Scan(&age); err != nil { - t.Errorf("%d: on %q, QueryRow/Scan: %v", n, tt.name, err) - } else if age != tt.want { - t.Errorf("%d: age=%d, want %d", n, age, tt.want) - } - } -} - -// golang.org/issue/3734 -func TestStatementQueryRowConcurrent(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - stmt, err := db.Prepare("SELECT|people|age|name=?") - if err != nil { - t.Fatalf("Prepare: %v", err) - } - defer stmt.Close() - - const n = 10 - ch := make(chan error, n) - for i := 0; i < n; i++ { - go func() { - var age int - err := stmt.QueryRow("Alice").Scan(&age) - if err == nil && age != 1 { - err = fmt.Errorf("unexpected age %d", age) - } - ch <- err - }() - } - for i := 0; i < n; i++ { - if err := <-ch; err != nil { - t.Error(err) - } - } -} - -// just a test of fakedb itself -func TestBogusPreboundParameters(t *testing.T) { - db := newTestDB(t, "foo") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - _, err := db.Prepare("INSERT|t1|name=?,age=bogusconversion") - if err == nil { - t.Fatalf("expected error") - } - if err.Error() != `fakedb: invalid conversion to int32 from "bogusconversion"` { - t.Errorf("unexpected error: %v", err) - } -} - -func TestExec(t *testing.T) { - db := newTestDB(t, "foo") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - stmt, err := db.Prepare("INSERT|t1|name=?,age=?") - if err != nil { - t.Errorf("Stmt, err = %v, %v", stmt, err) - } - defer stmt.Close() - - type execTest struct { - args []interface{} - wantErr string - } - execTests := []execTest{ - // Okay: - {[]interface{}{"Brad", 31}, ""}, - {[]interface{}{"Brad", int64(31)}, ""}, - {[]interface{}{"Bob", "32"}, ""}, - {[]interface{}{7, 9}, ""}, - - // Invalid conversions: - {[]interface{}{"Brad", int64(0xFFFFFFFF)}, "sql: converting argument #1's type: sql/driver: value 4294967295 overflows int32"}, - {[]interface{}{"Brad", "strconv fail"}, "sql: converting argument #1's type: sql/driver: value \"strconv fail\" can't be converted to int32"}, - - // Wrong number of args: - {[]interface{}{}, "sql: expected 2 arguments, got 0"}, - {[]interface{}{1, 2, 3}, "sql: expected 2 arguments, got 3"}, - } - for n, et := range execTests { - _, err := stmt.Exec(et.args...) - errStr := "" - if err != nil { - errStr = err.Error() - } - if errStr != et.wantErr { - t.Errorf("stmt.Execute #%d: for %v, got error %q, want error %q", - n, et.args, errStr, et.wantErr) - } - } -} - -func TestTxPrepare(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - tx, err := db.Begin() - if err != nil { - t.Fatalf("Begin = %v", err) - } - stmt, err := tx.Prepare("INSERT|t1|name=?,age=?") - if err != nil { - t.Fatalf("Stmt, err = %v, %v", stmt, err) - } - defer stmt.Close() - _, err = stmt.Exec("Bobby", 7) - if err != nil { - t.Fatalf("Exec = %v", err) - } - err = tx.Commit() - if err != nil { - t.Fatalf("Commit = %v", err) - } - // Commit() should have closed the statement - if !stmt.closed { - t.Fatal("Stmt not closed after Commit") - } -} - -func TestTxStmt(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - stmt, err := db.Prepare("INSERT|t1|name=?,age=?") - if err != nil { - t.Fatalf("Stmt, err = %v, %v", stmt, err) - } - defer stmt.Close() - tx, err := db.Begin() - if err != nil { - t.Fatalf("Begin = %v", err) - } - txs := tx.Stmt(stmt) - defer txs.Close() - _, err = txs.Exec("Bobby", 7) - if err != nil { - t.Fatalf("Exec = %v", err) - } - err = tx.Commit() - if err != nil { - t.Fatalf("Commit = %v", err) - } - // Commit() should have closed the statement - if !txs.closed { - t.Fatal("Stmt not closed after Commit") - } -} - -// Issue: https://golang.org/issue/2784 -// This test didn't fail before because we got lucky with the fakedb driver. -// It was failing, and now not, in github.com/bradfitz/go-sql-test -func TestTxQuery(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - exec(t, db, "INSERT|t1|name=Alice") - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer tx.Rollback() - - r, err := tx.Query("SELECT|t1|name|") - if err != nil { - t.Fatal(err) - } - defer r.Close() - - if !r.Next() { - if r.Err() != nil { - t.Fatal(r.Err()) - } - t.Fatal("expected one row") - } - - var x string - err = r.Scan(&x) - if err != nil { - t.Fatal(err) - } -} - -func TestTxQueryInvalid(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer tx.Rollback() - - _, err = tx.Query("SELECT|t1|name|") - if err == nil { - t.Fatal("Error expected") - } -} - -// Tests fix for issue 4433, that retries in Begin happen when -// conn.Begin() returns ErrBadConn -func TestTxErrBadConn(t *testing.T) { - db, err := Open("test", fakeDBName+";badConn") - if err != nil { - t.Fatalf("Open: %v", err) - } - if _, err := db.Exec("WIPE"); err != nil { - t.Fatalf("exec wipe: %v", err) - } - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - stmt, err := db.Prepare("INSERT|t1|name=?,age=?") - if err != nil { - t.Fatalf("Stmt, err = %v, %v", stmt, err) - } - defer stmt.Close() - tx, err := db.Begin() - if err != nil { - t.Fatalf("Begin = %v", err) - } - txs := tx.Stmt(stmt) - defer txs.Close() - _, err = txs.Exec("Bobby", 7) - if err != nil { - t.Fatalf("Exec = %v", err) - } - err = tx.Commit() - if err != nil { - t.Fatalf("Commit = %v", err) - } -} - -// Tests fix for issue 2542, that we release a lock when querying on -// a closed connection. -func TestIssue2542Deadlock(t *testing.T) { - db := newTestDB(t, "people") - closeDB(t, db) - for i := 0; i < 2; i++ { - _, err := db.Query("SELECT|people|age,name|") - if err == nil { - t.Fatalf("expected error") - } - } -} - -// From golang.org/issue/3865 -func TestCloseStmtBeforeRows(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - s, err := db.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - - r, err := s.Query() - if err != nil { - s.Close() - t.Fatal(err) - } - - err = s.Close() - if err != nil { - t.Fatal(err) - } - - r.Close() -} - -// Tests fix for issue 2788, that we bind nil to a []byte if the -// value in the column is sql null -func TestNullByteSlice(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, "CREATE|t|id=int32,name=nullstring") - exec(t, db, "INSERT|t|id=10,name=?", nil) - - var name []byte - - err := db.QueryRow("SELECT|t|name|id=?", 10).Scan(&name) - if err != nil { - t.Fatal(err) - } - if name != nil { - t.Fatalf("name []byte should be nil for null column value, got: %#v", name) - } - - exec(t, db, "INSERT|t|id=11,name=?", "bob") - err = db.QueryRow("SELECT|t|name|id=?", 11).Scan(&name) - if err != nil { - t.Fatal(err) - } - if string(name) != "bob" { - t.Fatalf("name []byte should be bob, got: %q", string(name)) - } -} - -func TestPointerParamsAndScans(t *testing.T) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, "CREATE|t|id=int32,name=nullstring") - - bob := "bob" - var name *string - - name = &bob - exec(t, db, "INSERT|t|id=10,name=?", name) - name = nil - exec(t, db, "INSERT|t|id=20,name=?", name) - - err := db.QueryRow("SELECT|t|name|id=?", 10).Scan(&name) - if err != nil { - t.Fatalf("querying id 10: %v", err) - } - if name == nil { - t.Errorf("id 10's name = nil; want bob") - } else if *name != "bob" { - t.Errorf("id 10's name = %q; want bob", *name) - } - - err = db.QueryRow("SELECT|t|name|id=?", 20).Scan(&name) - if err != nil { - t.Fatalf("querying id 20: %v", err) - } - if name != nil { - t.Errorf("id 20 = %q; want nil", *name) - } -} - -func TestQueryRowClosingStmt(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - var name string - var age int - err := db.QueryRow("SELECT|people|age,name|age=?", 3).Scan(&age, &name) - if err != nil { - t.Fatal(err) - } - if len(db.freeConn) != 1 { - t.Fatalf("expected 1 free conn") - } - fakeConn := db.freeConn[0].ci.(*fakeConn) - if made, closed := fakeConn.stmtsMade, fakeConn.stmtsClosed; made != closed { - t.Errorf("statement close mismatch: made %d, closed %d", made, closed) - } -} - -// Test issue 6651 -func TestIssue6651(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - var v string - - want := "error in rows.Next" - rowsCursorNextHook = func(dest []driver.Value) error { - return fmt.Errorf(want) - } - defer func() { rowsCursorNextHook = nil }() - err := db.QueryRow("SELECT|people|name|").Scan(&v) - if err == nil || err.Error() != want { - t.Errorf("error = %q; want %q", err, want) - } - rowsCursorNextHook = nil - - want = "error in rows.Close" - rowsCloseHook = func(rows *Rows, err *error) { - *err = fmt.Errorf(want) - } - defer func() { rowsCloseHook = nil }() - err = db.QueryRow("SELECT|people|name|").Scan(&v) - if err == nil || err.Error() != want { - t.Errorf("error = %q; want %q", err, want) - } -} - -type nullTestRow struct { - nullParam interface{} - notNullParam interface{} - scanNullVal interface{} -} - -type nullTestSpec struct { - nullType string - notNullType string - rows [6]nullTestRow -} - -func TestNullStringParam(t *testing.T) { - spec := nullTestSpec{"nullstring", "string", [6]nullTestRow{ - {NullString{"aqua", true}, "", NullString{"aqua", true}}, - {NullString{"brown", false}, "", NullString{"", false}}, - {"chartreuse", "", NullString{"chartreuse", true}}, - {NullString{"darkred", true}, "", NullString{"darkred", true}}, - {NullString{"eel", false}, "", NullString{"", false}}, - {"foo", NullString{"black", false}, nil}, - }} - nullTestRun(t, spec) -} - -func TestNullInt64Param(t *testing.T) { - spec := nullTestSpec{"nullint64", "int64", [6]nullTestRow{ - {NullInt64{31, true}, 1, NullInt64{31, true}}, - {NullInt64{-22, false}, 1, NullInt64{0, false}}, - {22, 1, NullInt64{22, true}}, - {NullInt64{33, true}, 1, NullInt64{33, true}}, - {NullInt64{222, false}, 1, NullInt64{0, false}}, - {0, NullInt64{31, false}, nil}, - }} - nullTestRun(t, spec) -} - -func TestNullFloat64Param(t *testing.T) { - spec := nullTestSpec{"nullfloat64", "float64", [6]nullTestRow{ - {NullFloat64{31.2, true}, 1, NullFloat64{31.2, true}}, - {NullFloat64{13.1, false}, 1, NullFloat64{0, false}}, - {-22.9, 1, NullFloat64{-22.9, true}}, - {NullFloat64{33.81, true}, 1, NullFloat64{33.81, true}}, - {NullFloat64{222, false}, 1, NullFloat64{0, false}}, - {10, NullFloat64{31.2, false}, nil}, - }} - nullTestRun(t, spec) -} - -func TestNullBoolParam(t *testing.T) { - spec := nullTestSpec{"nullbool", "bool", [6]nullTestRow{ - {NullBool{false, true}, true, NullBool{false, true}}, - {NullBool{true, false}, false, NullBool{false, false}}, - {true, true, NullBool{true, true}}, - {NullBool{true, true}, false, NullBool{true, true}}, - {NullBool{true, false}, true, NullBool{false, false}}, - {true, NullBool{true, false}, nil}, - }} - nullTestRun(t, spec) -} - -func nullTestRun(t *testing.T, spec nullTestSpec) { - db := newTestDB(t, "") - defer closeDB(t, db) - exec(t, db, fmt.Sprintf("CREATE|t|id=int32,name=string,nullf=%s,notnullf=%s", spec.nullType, spec.notNullType)) - - // Inserts with db.Exec: - exec(t, db, "INSERT|t|id=?,name=?,nullf=?,notnullf=?", 1, "alice", spec.rows[0].nullParam, spec.rows[0].notNullParam) - exec(t, db, "INSERT|t|id=?,name=?,nullf=?,notnullf=?", 2, "bob", spec.rows[1].nullParam, spec.rows[1].notNullParam) - - // Inserts with a prepared statement: - stmt, err := db.Prepare("INSERT|t|id=?,name=?,nullf=?,notnullf=?") - if err != nil { - t.Fatalf("prepare: %v", err) - } - defer stmt.Close() - if _, err := stmt.Exec(3, "chris", spec.rows[2].nullParam, spec.rows[2].notNullParam); err != nil { - t.Errorf("exec insert chris: %v", err) - } - if _, err := stmt.Exec(4, "dave", spec.rows[3].nullParam, spec.rows[3].notNullParam); err != nil { - t.Errorf("exec insert dave: %v", err) - } - if _, err := stmt.Exec(5, "eleanor", spec.rows[4].nullParam, spec.rows[4].notNullParam); err != nil { - t.Errorf("exec insert eleanor: %v", err) - } - - // Can't put null val into non-null col - if _, err := stmt.Exec(6, "bob", spec.rows[5].nullParam, spec.rows[5].notNullParam); err == nil { - t.Errorf("expected error inserting nil val with prepared statement Exec") - } - - _, err = db.Exec("INSERT|t|id=?,name=?,nullf=?", 999, nil, nil) - if err == nil { - // TODO: this test fails, but it's just because - // fakeConn implements the optional Execer interface, - // so arguably this is the correct behavior. But - // maybe I should flesh out the fakeConn.Exec - // implementation so this properly fails. - // t.Errorf("expected error inserting nil name with Exec") - } - - paramtype := reflect.TypeOf(spec.rows[0].nullParam) - bindVal := reflect.New(paramtype).Interface() - - for i := 0; i < 5; i++ { - id := i + 1 - if err := db.QueryRow("SELECT|t|nullf|id=?", id).Scan(bindVal); err != nil { - t.Errorf("id=%d Scan: %v", id, err) - } - bindValDeref := reflect.ValueOf(bindVal).Elem().Interface() - if !reflect.DeepEqual(bindValDeref, spec.rows[i].scanNullVal) { - t.Errorf("id=%d got %#v, want %#v", id, bindValDeref, spec.rows[i].scanNullVal) - } - } -} - -// golang.org/issue/4859 -func TestQueryRowNilScanDest(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - var name *string // nil pointer - err := db.QueryRow("SELECT|people|name|").Scan(name) - want := "sql: Scan error on column index 0: destination pointer is nil" - if err == nil || err.Error() != want { - t.Errorf("error = %q; want %q", err.Error(), want) - } -} - -func TestIssue4902(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - driver := db.driver.(*fakeDriver) - opens0 := driver.openCount - - var stmt *Stmt - var err error - for i := 0; i < 10; i++ { - stmt, err = db.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - err = stmt.Close() - if err != nil { - t.Fatal(err) - } - } - - opens := driver.openCount - opens0 - if opens > 1 { - t.Errorf("opens = %d; want <= 1", opens) - t.Logf("db = %#v", db) - t.Logf("driver = %#v", driver) - t.Logf("stmt = %#v", stmt) - } -} - -// Issue 3857 -// This used to deadlock. -func TestSimultaneousQueries(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - defer tx.Rollback() - - r1, err := tx.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - defer r1.Close() - - r2, err := tx.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - defer r2.Close() -} - -func TestMaxIdleConns(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - tx.Commit() - if got := len(db.freeConn); got != 1 { - t.Errorf("freeConns = %d; want 1", got) - } - - db.SetMaxIdleConns(0) - - if got := len(db.freeConn); got != 0 { - t.Errorf("freeConns after set to zero = %d; want 0", got) - } - - tx, err = db.Begin() - if err != nil { - t.Fatal(err) - } - tx.Commit() - if got := len(db.freeConn); got != 0 { - t.Errorf("freeConns = %d; want 0", got) - } -} - -func TestMaxOpenConns(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - defer setHookpostCloseConn(nil) - setHookpostCloseConn(func(_ *fakeConn, err error) { - if err != nil { - t.Errorf("Error closing fakeConn: %v", err) - } - }) - - db := newTestDB(t, "magicquery") - defer closeDB(t, db) - - driver := db.driver.(*fakeDriver) - - // Force the number of open connections to 0 so we can get an accurate - // count for the test - db.SetMaxIdleConns(0) - - if g, w := db.numFreeConns(), 0; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(0, time.Second); n > 0 { - t.Errorf("number of dependencies = %d; expected 0", n) - db.dumpDeps(t) - } - - driver.mu.Lock() - opens0 := driver.openCount - closes0 := driver.closeCount - driver.mu.Unlock() - - db.SetMaxIdleConns(10) - db.SetMaxOpenConns(10) - - stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") - if err != nil { - t.Fatal(err) - } - - // Start 50 parallel slow queries. - const ( - nquery = 50 - sleepMillis = 25 - nbatch = 2 - ) - var wg sync.WaitGroup - for batch := 0; batch < nbatch; batch++ { - for i := 0; i < nquery; i++ { - wg.Add(1) - go func() { - defer wg.Done() - var op string - if err := stmt.QueryRow("sleep", sleepMillis).Scan(&op); err != nil && err != ErrNoRows { - t.Error(err) - } - }() - } - // Sleep for twice the expected length of time for the - // batch of 50 queries above to finish before starting - // the next round. - time.Sleep(2 * sleepMillis * time.Millisecond) - } - wg.Wait() - - if g, w := db.numFreeConns(), 10; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(20, time.Second); n > 20 { - t.Errorf("number of dependencies = %d; expected <= 20", n) - db.dumpDeps(t) - } - - driver.mu.Lock() - opens := driver.openCount - opens0 - closes := driver.closeCount - closes0 - driver.mu.Unlock() - - if opens > 10 { - t.Logf("open calls = %d", opens) - t.Logf("close calls = %d", closes) - t.Errorf("db connections opened = %d; want <= 10", opens) - db.dumpDeps(t) - } - - if err := stmt.Close(); err != nil { - t.Fatal(err) - } - - if g, w := db.numFreeConns(), 10; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(10, time.Second); n > 10 { - t.Errorf("number of dependencies = %d; expected <= 10", n) - db.dumpDeps(t) - } - - db.SetMaxOpenConns(5) - - if g, w := db.numFreeConns(), 5; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(5, time.Second); n > 5 { - t.Errorf("number of dependencies = %d; expected 0", n) - db.dumpDeps(t) - } - - db.SetMaxOpenConns(0) - - if g, w := db.numFreeConns(), 5; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(5, time.Second); n > 5 { - t.Errorf("number of dependencies = %d; expected 0", n) - db.dumpDeps(t) - } - - db.SetMaxIdleConns(0) - - if g, w := db.numFreeConns(), 0; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(0, time.Second); n > 0 { - t.Errorf("number of dependencies = %d; expected 0", n) - db.dumpDeps(t) - } -} - -// Issue 9453: tests that SetMaxOpenConns can be lowered at runtime -// and affects the subsequent release of connections. -func TestMaxOpenConnsOnBusy(t *testing.T) { - defer setHookpostCloseConn(nil) - setHookpostCloseConn(func(_ *fakeConn, err error) { - if err != nil { - t.Errorf("Error closing fakeConn: %v", err) - } - }) - - db := newTestDB(t, "magicquery") - defer closeDB(t, db) - - db.SetMaxOpenConns(3) - - conn0, err := db.conn(cachedOrNewConn) - if err != nil { - t.Fatalf("db open conn fail: %v", err) - } - - conn1, err := db.conn(cachedOrNewConn) - if err != nil { - t.Fatalf("db open conn fail: %v", err) - } - - conn2, err := db.conn(cachedOrNewConn) - if err != nil { - t.Fatalf("db open conn fail: %v", err) - } - - if g, w := db.numOpen, 3; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - db.SetMaxOpenConns(2) - if g, w := db.numOpen, 3; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - conn0.releaseConn(nil) - conn1.releaseConn(nil) - if g, w := db.numOpen, 2; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - conn2.releaseConn(nil) - if g, w := db.numOpen, 2; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } -} - -func TestSingleOpenConn(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - db.SetMaxOpenConns(1) - - rows, err := db.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - if err = rows.Close(); err != nil { - t.Fatal(err) - } - // shouldn't deadlock - rows, err = db.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - if err = rows.Close(); err != nil { - t.Fatal(err) - } -} - -func TestStats(t *testing.T) { - db := newTestDB(t, "people") - stats := db.Stats() - if got := stats.OpenConnections; got != 1 { - t.Errorf("stats.OpenConnections = %d; want 1", got) - } - - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - tx.Commit() - - closeDB(t, db) - stats = db.Stats() - if got := stats.OpenConnections; got != 0 { - t.Errorf("stats.OpenConnections = %d; want 0", got) - } -} - -// golang.org/issue/5323 -func TestStmtCloseDeps(t *testing.T) { - if testing.Short() { - t.Skip("skipping in short mode") - } - defer setHookpostCloseConn(nil) - setHookpostCloseConn(func(_ *fakeConn, err error) { - if err != nil { - t.Errorf("Error closing fakeConn: %v", err) - } - }) - - db := newTestDB(t, "magicquery") - defer closeDB(t, db) - - driver := db.driver.(*fakeDriver) - - driver.mu.Lock() - opens0 := driver.openCount - closes0 := driver.closeCount - driver.mu.Unlock() - openDelta0 := opens0 - closes0 - - stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") - if err != nil { - t.Fatal(err) - } - - // Start 50 parallel slow queries. - const ( - nquery = 50 - sleepMillis = 25 - nbatch = 2 - ) - var wg sync.WaitGroup - for batch := 0; batch < nbatch; batch++ { - for i := 0; i < nquery; i++ { - wg.Add(1) - go func() { - defer wg.Done() - var op string - if err := stmt.QueryRow("sleep", sleepMillis).Scan(&op); err != nil && err != ErrNoRows { - t.Error(err) - } - }() - } - // Sleep for twice the expected length of time for the - // batch of 50 queries above to finish before starting - // the next round. - time.Sleep(2 * sleepMillis * time.Millisecond) - } - wg.Wait() - - if g, w := db.numFreeConns(), 2; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(4, time.Second); n > 4 { - t.Errorf("number of dependencies = %d; expected <= 4", n) - db.dumpDeps(t) - } - - driver.mu.Lock() - opens := driver.openCount - opens0 - closes := driver.closeCount - closes0 - openDelta := (driver.openCount - driver.closeCount) - openDelta0 - driver.mu.Unlock() - - if openDelta > 2 { - t.Logf("open calls = %d", opens) - t.Logf("close calls = %d", closes) - t.Logf("open delta = %d", openDelta) - t.Errorf("db connections opened = %d; want <= 2", openDelta) - db.dumpDeps(t) - } - - if len(stmt.css) > nquery { - t.Errorf("len(stmt.css) = %d; want <= %d", len(stmt.css), nquery) - } - - if err := stmt.Close(); err != nil { - t.Fatal(err) - } - - if g, w := db.numFreeConns(), 2; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(2, time.Second); n > 2 { - t.Errorf("number of dependencies = %d; expected <= 2", n) - db.dumpDeps(t) - } - - db.SetMaxIdleConns(0) - - if g, w := db.numFreeConns(), 0; g != w { - t.Errorf("free conns = %d; want %d", g, w) - } - - if n := db.numDepsPollUntil(0, time.Second); n > 0 { - t.Errorf("number of dependencies = %d; expected 0", n) - db.dumpDeps(t) - } -} - -// golang.org/issue/5046 -func TestCloseConnBeforeStmts(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - defer setHookpostCloseConn(nil) - setHookpostCloseConn(func(_ *fakeConn, err error) { - if err != nil { - t.Errorf("Error closing fakeConn: %v; from %s", err, stack()) - db.dumpDeps(t) - t.Errorf("DB = %#v", db) - } - }) - - stmt, err := db.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - - if len(db.freeConn) != 1 { - t.Fatalf("expected 1 freeConn; got %d", len(db.freeConn)) - } - dc := db.freeConn[0] - if dc.closed { - t.Errorf("conn shouldn't be closed") - } - - if n := len(dc.openStmt); n != 1 { - t.Errorf("driverConn num openStmt = %d; want 1", n) - } - err = db.Close() - if err != nil { - t.Errorf("db Close = %v", err) - } - if !dc.closed { - t.Errorf("after db.Close, driverConn should be closed") - } - if n := len(dc.openStmt); n != 0 { - t.Errorf("driverConn num openStmt = %d; want 0", n) - } - - err = stmt.Close() - if err != nil { - t.Errorf("Stmt close = %v", err) - } - - if !dc.closed { - t.Errorf("conn should be closed") - } - if dc.ci != nil { - t.Errorf("after Stmt Close, driverConn's Conn interface should be nil") - } -} - -// golang.org/issue/5283: don't release the Rows' connection in Close -// before calling Stmt.Close. -func TestRowsCloseOrder(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - db.SetMaxIdleConns(0) - setStrictFakeConnClose(t) - defer setStrictFakeConnClose(nil) - - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatal(err) - } - err = rows.Close() - if err != nil { - t.Fatal(err) - } -} - -func TestRowsImplicitClose(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatal(err) - } - - want, fail := 2, errors.New("fail") - r := rows.rowsi.(*rowsCursor) - r.errPos, r.err = want, fail - - got := 0 - for rows.Next() { - got++ - } - if got != want { - t.Errorf("got %d rows, want %d", got, want) - } - if err := rows.Err(); err != fail { - t.Errorf("got error %v, want %v", err, fail) - } - if !r.closed { - t.Errorf("r.closed is false, want true") - } -} - -func TestStmtCloseOrder(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - db.SetMaxIdleConns(0) - setStrictFakeConnClose(t) - defer setStrictFakeConnClose(nil) - - _, err := db.Query("SELECT|non_existent|name|") - if err == nil { - t.Fatal("Quering non-existent table should fail") - } -} - -// Test cases where there's more than maxBadConnRetries bad connections in the -// pool (issue 8834) -func TestManyErrBadConn(t *testing.T) { - manyErrBadConnSetup := func() *DB { - db := newTestDB(t, "people") - - nconn := maxBadConnRetries + 1 - db.SetMaxIdleConns(nconn) - db.SetMaxOpenConns(nconn) - // open enough connections - func() { - for i := 0; i < nconn; i++ { - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatal(err) - } - defer rows.Close() - } - }() - - if db.numOpen != nconn { - t.Fatalf("unexpected numOpen %d (was expecting %d)", db.numOpen, nconn) - } else if len(db.freeConn) != nconn { - t.Fatalf("unexpected len(db.freeConn) %d (was expecting %d)", len(db.freeConn), nconn) - } - for _, conn := range db.freeConn { - conn.ci.(*fakeConn).stickyBad = true - } - return db - } - - // Query - db := manyErrBadConnSetup() - defer closeDB(t, db) - rows, err := db.Query("SELECT|people|age,name|") - if err != nil { - t.Fatal(err) - } - if err = rows.Close(); err != nil { - t.Fatal(err) - } - - // Exec - db = manyErrBadConnSetup() - defer closeDB(t, db) - _, err = db.Exec("INSERT|people|name=Julia,age=19") - if err != nil { - t.Fatal(err) - } - - // Begin - db = manyErrBadConnSetup() - defer closeDB(t, db) - tx, err := db.Begin() - if err != nil { - t.Fatal(err) - } - if err = tx.Rollback(); err != nil { - t.Fatal(err) - } - - // Prepare - db = manyErrBadConnSetup() - defer closeDB(t, db) - stmt, err := db.Prepare("SELECT|people|age,name|") - if err != nil { - t.Fatal(err) - } - if err = stmt.Close(); err != nil { - t.Fatal(err) - } -} - -// golang.org/issue/5718 -func TestErrBadConnReconnect(t *testing.T) { - db := newTestDB(t, "foo") - defer closeDB(t, db) - exec(t, db, "CREATE|t1|name=string,age=int32,dead=bool") - - simulateBadConn := func(name string, hook *func() bool, op func() error) { - broken, retried := false, false - numOpen := db.numOpen - - // simulate a broken connection on the first try - *hook = func() bool { - if !broken { - broken = true - return true - } - retried = true - return false - } - - if err := op(); err != nil { - t.Errorf(name+": %v", err) - return - } - - if !broken || !retried { - t.Error(name + ": Failed to simulate broken connection") - } - *hook = nil - - if numOpen != db.numOpen { - t.Errorf(name+": leaked %d connection(s)!", db.numOpen-numOpen) - numOpen = db.numOpen - } - } - - // db.Exec - dbExec := func() error { - _, err := db.Exec("INSERT|t1|name=?,age=?,dead=?", "Gordon", 3, true) - return err - } - simulateBadConn("db.Exec prepare", &hookPrepareBadConn, dbExec) - simulateBadConn("db.Exec exec", &hookExecBadConn, dbExec) - - // db.Query - dbQuery := func() error { - rows, err := db.Query("SELECT|t1|age,name|") - if err == nil { - err = rows.Close() - } - return err - } - simulateBadConn("db.Query prepare", &hookPrepareBadConn, dbQuery) - simulateBadConn("db.Query query", &hookQueryBadConn, dbQuery) - - // db.Prepare - simulateBadConn("db.Prepare", &hookPrepareBadConn, func() error { - stmt, err := db.Prepare("INSERT|t1|name=?,age=?,dead=?") - if err != nil { - return err - } - stmt.Close() - return nil - }) - - // Provide a way to force a re-prepare of a statement on next execution - forcePrepare := func(stmt *Stmt) { - stmt.css = nil - } - - // stmt.Exec - stmt1, err := db.Prepare("INSERT|t1|name=?,age=?,dead=?") - if err != nil { - t.Fatalf("prepare: %v", err) - } - defer stmt1.Close() - // make sure we must prepare the stmt first - forcePrepare(stmt1) - - stmtExec := func() error { - _, err := stmt1.Exec("Gopher", 3, false) - return err - } - simulateBadConn("stmt.Exec prepare", &hookPrepareBadConn, stmtExec) - simulateBadConn("stmt.Exec exec", &hookExecBadConn, stmtExec) - - // stmt.Query - stmt2, err := db.Prepare("SELECT|t1|age,name|") - if err != nil { - t.Fatalf("prepare: %v", err) - } - defer stmt2.Close() - // make sure we must prepare the stmt first - forcePrepare(stmt2) - - stmtQuery := func() error { - rows, err := stmt2.Query() - if err == nil { - err = rows.Close() - } - return err - } - simulateBadConn("stmt.Query prepare", &hookPrepareBadConn, stmtQuery) - simulateBadConn("stmt.Query exec", &hookQueryBadConn, stmtQuery) -} - -type concurrentTest interface { - init(t testing.TB, db *DB) - finish(t testing.TB) - test(t testing.TB) error -} - -type concurrentDBQueryTest struct { - db *DB -} - -func (c *concurrentDBQueryTest) init(t testing.TB, db *DB) { - c.db = db -} - -func (c *concurrentDBQueryTest) finish(t testing.TB) { - c.db = nil -} - -func (c *concurrentDBQueryTest) test(t testing.TB) error { - rows, err := c.db.Query("SELECT|people|name|") - if err != nil { - t.Error(err) - return err - } - var name string - for rows.Next() { - rows.Scan(&name) - } - rows.Close() - return nil -} - -type concurrentDBExecTest struct { - db *DB -} - -func (c *concurrentDBExecTest) init(t testing.TB, db *DB) { - c.db = db -} - -func (c *concurrentDBExecTest) finish(t testing.TB) { - c.db = nil -} - -func (c *concurrentDBExecTest) test(t testing.TB) error { - _, err := c.db.Exec("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) - if err != nil { - t.Error(err) - return err - } - return nil -} - -type concurrentStmtQueryTest struct { - db *DB - stmt *Stmt -} - -func (c *concurrentStmtQueryTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.stmt, err = db.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentStmtQueryTest) finish(t testing.TB) { - if c.stmt != nil { - c.stmt.Close() - c.stmt = nil - } - c.db = nil -} - -func (c *concurrentStmtQueryTest) test(t testing.TB) error { - rows, err := c.stmt.Query() - if err != nil { - t.Errorf("error on query: %v", err) - return err - } - - var name string - for rows.Next() { - rows.Scan(&name) - } - rows.Close() - return nil -} - -type concurrentStmtExecTest struct { - db *DB - stmt *Stmt -} - -func (c *concurrentStmtExecTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.stmt, err = db.Prepare("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?") - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentStmtExecTest) finish(t testing.TB) { - if c.stmt != nil { - c.stmt.Close() - c.stmt = nil - } - c.db = nil -} - -func (c *concurrentStmtExecTest) test(t testing.TB) error { - _, err := c.stmt.Exec(3, chrisBirthday) - if err != nil { - t.Errorf("error on exec: %v", err) - return err - } - return nil -} - -type concurrentTxQueryTest struct { - db *DB - tx *Tx -} - -func (c *concurrentTxQueryTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.tx, err = c.db.Begin() - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentTxQueryTest) finish(t testing.TB) { - if c.tx != nil { - c.tx.Rollback() - c.tx = nil - } - c.db = nil -} - -func (c *concurrentTxQueryTest) test(t testing.TB) error { - rows, err := c.db.Query("SELECT|people|name|") - if err != nil { - t.Error(err) - return err - } - var name string - for rows.Next() { - rows.Scan(&name) - } - rows.Close() - return nil -} - -type concurrentTxExecTest struct { - db *DB - tx *Tx -} - -func (c *concurrentTxExecTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.tx, err = c.db.Begin() - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentTxExecTest) finish(t testing.TB) { - if c.tx != nil { - c.tx.Rollback() - c.tx = nil - } - c.db = nil -} - -func (c *concurrentTxExecTest) test(t testing.TB) error { - _, err := c.tx.Exec("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday) - if err != nil { - t.Error(err) - return err - } - return nil -} - -type concurrentTxStmtQueryTest struct { - db *DB - tx *Tx - stmt *Stmt -} - -func (c *concurrentTxStmtQueryTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.tx, err = c.db.Begin() - if err != nil { - t.Fatal(err) - } - c.stmt, err = c.tx.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentTxStmtQueryTest) finish(t testing.TB) { - if c.stmt != nil { - c.stmt.Close() - c.stmt = nil - } - if c.tx != nil { - c.tx.Rollback() - c.tx = nil - } - c.db = nil -} - -func (c *concurrentTxStmtQueryTest) test(t testing.TB) error { - rows, err := c.stmt.Query() - if err != nil { - t.Errorf("error on query: %v", err) - return err - } - - var name string - for rows.Next() { - rows.Scan(&name) - } - rows.Close() - return nil -} - -type concurrentTxStmtExecTest struct { - db *DB - tx *Tx - stmt *Stmt -} - -func (c *concurrentTxStmtExecTest) init(t testing.TB, db *DB) { - c.db = db - var err error - c.tx, err = c.db.Begin() - if err != nil { - t.Fatal(err) - } - c.stmt, err = c.tx.Prepare("NOSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?") - if err != nil { - t.Fatal(err) - } -} - -func (c *concurrentTxStmtExecTest) finish(t testing.TB) { - if c.stmt != nil { - c.stmt.Close() - c.stmt = nil - } - if c.tx != nil { - c.tx.Rollback() - c.tx = nil - } - c.db = nil -} - -func (c *concurrentTxStmtExecTest) test(t testing.TB) error { - _, err := c.stmt.Exec(3, chrisBirthday) - if err != nil { - t.Errorf("error on exec: %v", err) - return err - } - return nil -} - -type concurrentRandomTest struct { - tests []concurrentTest -} - -func (c *concurrentRandomTest) init(t testing.TB, db *DB) { - c.tests = []concurrentTest{ - new(concurrentDBQueryTest), - new(concurrentDBExecTest), - new(concurrentStmtQueryTest), - new(concurrentStmtExecTest), - new(concurrentTxQueryTest), - new(concurrentTxExecTest), - new(concurrentTxStmtQueryTest), - new(concurrentTxStmtExecTest), - } - for _, ct := range c.tests { - ct.init(t, db) - } -} - -func (c *concurrentRandomTest) finish(t testing.TB) { - for _, ct := range c.tests { - ct.finish(t) - } -} - -func (c *concurrentRandomTest) test(t testing.TB) error { - ct := c.tests[rand.Intn(len(c.tests))] - return ct.test(t) -} - -func doConcurrentTest(t testing.TB, ct concurrentTest) { - maxProcs, numReqs := 1, 500 - if testing.Short() { - maxProcs, numReqs = 4, 50 - } - defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs)) - - db := newTestDB(t, "people") - defer closeDB(t, db) - - ct.init(t, db) - defer ct.finish(t) - - var wg sync.WaitGroup - wg.Add(numReqs) - - reqs := make(chan bool) - defer close(reqs) - - for i := 0; i < maxProcs*2; i++ { - go func() { - for range reqs { - err := ct.test(t) - if err != nil { - wg.Done() - continue - } - wg.Done() - } - }() - } - - for i := 0; i < numReqs; i++ { - reqs <- true - } - - wg.Wait() -} - -func TestIssue6081(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - - drv := db.driver.(*fakeDriver) - drv.mu.Lock() - opens0 := drv.openCount - closes0 := drv.closeCount - drv.mu.Unlock() - - stmt, err := db.Prepare("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - rowsCloseHook = func(rows *Rows, err *error) { - *err = driver.ErrBadConn - } - defer func() { rowsCloseHook = nil }() - for i := 0; i < 10; i++ { - rows, err := stmt.Query() - if err != nil { - t.Fatal(err) - } - rows.Close() - } - if n := len(stmt.css); n > 1 { - t.Errorf("len(css slice) = %d; want <= 1", n) - } - stmt.Close() - if n := len(stmt.css); n != 0 { - t.Errorf("len(css slice) after Close = %d; want 0", n) - } - - drv.mu.Lock() - opens := drv.openCount - opens0 - closes := drv.closeCount - closes0 - drv.mu.Unlock() - if opens < 9 { - t.Errorf("opens = %d; want >= 9", opens) - } - if closes < 9 { - t.Errorf("closes = %d; want >= 9", closes) - } -} - -func TestConcurrency(t *testing.T) { - doConcurrentTest(t, new(concurrentDBQueryTest)) - doConcurrentTest(t, new(concurrentDBExecTest)) - doConcurrentTest(t, new(concurrentStmtQueryTest)) - doConcurrentTest(t, new(concurrentStmtExecTest)) - doConcurrentTest(t, new(concurrentTxQueryTest)) - doConcurrentTest(t, new(concurrentTxExecTest)) - doConcurrentTest(t, new(concurrentTxStmtQueryTest)) - doConcurrentTest(t, new(concurrentTxStmtExecTest)) - doConcurrentTest(t, new(concurrentRandomTest)) -} - -func TestConnectionLeak(t *testing.T) { - db := newTestDB(t, "people") - defer closeDB(t, db) - // Start by opening defaultMaxIdleConns - rows := make([]*Rows, defaultMaxIdleConns) - // We need to SetMaxOpenConns > MaxIdleConns, so the DB can open - // a new connection and we can fill the idle queue with the released - // connections. - db.SetMaxOpenConns(len(rows) + 1) - for ii := range rows { - r, err := db.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - r.Next() - if err := r.Err(); err != nil { - t.Fatal(err) - } - rows[ii] = r - } - // Now we have defaultMaxIdleConns busy connections. Open - // a new one, but wait until the busy connections are released - // before returning control to DB. - drv := db.driver.(*fakeDriver) - drv.waitCh = make(chan struct{}, 1) - drv.waitingCh = make(chan struct{}, 1) - var wg sync.WaitGroup - wg.Add(1) - go func() { - r, err := db.Query("SELECT|people|name|") - if err != nil { - t.Fatal(err) - } - r.Close() - wg.Done() - }() - // Wait until the goroutine we've just created has started waiting. - <-drv.waitingCh - // Now close the busy connections. This provides a connection for - // the blocked goroutine and then fills up the idle queue. - for _, v := range rows { - v.Close() - } - // At this point we give the new connection to DB. This connection is - // now useless, since the idle queue is full and there are no pending - // requests. DB should deal with this situation without leaking the - // connection. - drv.waitCh <- struct{}{} - wg.Wait() -} - -func BenchmarkConcurrentDBExec(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentDBExecTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentStmtQuery(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentStmtQueryTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentStmtExec(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentStmtExecTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentTxQuery(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentTxQueryTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentTxExec(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentTxExecTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentTxStmtQuery(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentTxStmtQueryTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentTxStmtExec(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentTxStmtExecTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkConcurrentRandom(b *testing.B) { - b.ReportAllocs() - ct := new(concurrentRandomTest) - for i := 0; i < b.N; i++ { - doConcurrentTest(b, ct) - } -} - -func BenchmarkManyConcurrentQueries(b *testing.B) { - b.ReportAllocs() - // To see lock contention in Go 1.4, 16~ cores and 128~ goroutines are required. - const parallelism = 16 - - db := newTestDB(b, "magicquery") - defer closeDB(b, db) - db.SetMaxIdleConns(runtime.GOMAXPROCS(0) * parallelism) - - stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?") - if err != nil { - b.Fatal(err) - } - defer stmt.Close() - - b.SetParallelism(parallelism) - b.RunParallel(func(pb *testing.PB) { - for pb.Next() { - rows, err := stmt.Query("sleep", 1) - if err != nil { - b.Error(err) - return - } - rows.Close() - } - }) -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/buf.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/buf.go deleted file mode 100644 index 2ade0bd76ad6eabef752953016a6445205e3762a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/buf.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Buffered reading and decoding of DWARF data streams. - -package dwarf - -import ( - "encoding/binary" - "strconv" -) - -// Data buffer being decoded. -type buf struct { - dwarf *Data - order binary.ByteOrder - format dataFormat - name string - off Offset - data []byte - err error -} - -// Data format, other than byte order. This affects the handling of -// certain field formats. -type dataFormat interface { - // DWARF version number. Zero means unknown. - version() int - - // 64-bit DWARF format? - dwarf64() (dwarf64 bool, isKnown bool) - - // Size of an address, in bytes. Zero means unknown. - addrsize() int -} - -// Some parts of DWARF have no data format, e.g., abbrevs. -type unknownFormat struct{} - -func (u unknownFormat) version() int { - return 0 -} - -func (u unknownFormat) dwarf64() (bool, bool) { - return false, false -} - -func (u unknownFormat) addrsize() int { - return 0 -} - -func makeBuf(d *Data, format dataFormat, name string, off Offset, data []byte) buf { - return buf{d, d.order, format, name, off, data, nil} -} - -func (b *buf) uint8() uint8 { - if len(b.data) < 1 { - b.error("underflow") - return 0 - } - val := b.data[0] - b.data = b.data[1:] - b.off++ - return val -} - -func (b *buf) bytes(n int) []byte { - if len(b.data) < n { - b.error("underflow") - return nil - } - data := b.data[0:n] - b.data = b.data[n:] - b.off += Offset(n) - return data -} - -func (b *buf) skip(n int) { b.bytes(n) } - -func (b *buf) string() string { - for i := 0; i < len(b.data); i++ { - if b.data[i] == 0 { - s := string(b.data[0:i]) - b.data = b.data[i+1:] - b.off += Offset(i + 1) - return s - } - } - b.error("underflow") - return "" -} - -func (b *buf) uint16() uint16 { - a := b.bytes(2) - if a == nil { - return 0 - } - return b.order.Uint16(a) -} - -func (b *buf) uint32() uint32 { - a := b.bytes(4) - if a == nil { - return 0 - } - return b.order.Uint32(a) -} - -func (b *buf) uint64() uint64 { - a := b.bytes(8) - if a == nil { - return 0 - } - return b.order.Uint64(a) -} - -// Read a varint, which is 7 bits per byte, little endian. -// the 0x80 bit means read another byte. -func (b *buf) varint() (c uint64, bits uint) { - for i := 0; i < len(b.data); i++ { - byte := b.data[i] - c |= uint64(byte&0x7F) << bits - bits += 7 - if byte&0x80 == 0 { - b.off += Offset(i + 1) - b.data = b.data[i+1:] - return c, bits - } - } - return 0, 0 -} - -// Unsigned int is just a varint. -func (b *buf) uint() uint64 { - x, _ := b.varint() - return x -} - -// Signed int is a sign-extended varint. -func (b *buf) int() int64 { - ux, bits := b.varint() - x := int64(ux) - if x&(1<<(bits-1)) != 0 { - x |= -1 << bits - } - return x -} - -// Address-sized uint. -func (b *buf) addr() uint64 { - switch b.format.addrsize() { - case 1: - return uint64(b.uint8()) - case 2: - return uint64(b.uint16()) - case 4: - return uint64(b.uint32()) - case 8: - return uint64(b.uint64()) - } - b.error("unknown address size") - return 0 -} - -func (b *buf) unitLength() (length Offset, dwarf64 bool) { - length = Offset(b.uint32()) - if length == 0xffffffff { - dwarf64 = true - length = Offset(b.uint64()) - } else if length >= 0xfffffff0 { - b.error("unit length has reserved value") - } - return -} - -func (b *buf) error(s string) { - if b.err == nil { - b.data = nil - b.err = DecodeError{b.name, b.off, s} - } -} - -type DecodeError struct { - Name string - Offset Offset - Err string -} - -func (e DecodeError) Error() string { - return "decoding dwarf section " + e.Name + " at offset 0x" + strconv.FormatInt(int64(e.Offset), 16) + ": " + e.Err -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/class_string.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/class_string.go deleted file mode 100644 index 0b1206b9f3daf08388f77fbd433d08a07b3e5a6c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/class_string.go +++ /dev/null @@ -1,17 +0,0 @@ -// generated by stringer -type=Class; DO NOT EDIT - -package dwarf - -import "fmt" - -const _Class_name = "ClassAddressClassBlockClassConstantClassExprLocClassFlagClassLinePtrClassLocListPtrClassMacPtrClassRangeListPtrClassReferenceClassReferenceSigClassStringClassReferenceAltClassStringAlt" - -var _Class_index = [...]uint8{0, 12, 22, 35, 47, 56, 68, 83, 94, 111, 125, 142, 153, 170, 184} - -func (i Class) String() string { - i -= 1 - if i < 0 || i+1 >= Class(len(_Class_index)) { - return fmt.Sprintf("Class(%d)", i+1) - } - return _Class_name[_Class_index[i]:_Class_index[i+1]] -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/const.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/const.go deleted file mode 100644 index 2170db1e32dc7a53cfb7972a3bac10c5f77d7400..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/const.go +++ /dev/null @@ -1,482 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Constants - -package dwarf - -import "strconv" - -// An Attr identifies the attribute type in a DWARF Entry's Field. -type Attr uint32 - -const ( - AttrSibling Attr = 0x01 - AttrLocation Attr = 0x02 - AttrName Attr = 0x03 - AttrOrdering Attr = 0x09 - AttrByteSize Attr = 0x0B - AttrBitOffset Attr = 0x0C - AttrBitSize Attr = 0x0D - AttrStmtList Attr = 0x10 - AttrLowpc Attr = 0x11 - AttrHighpc Attr = 0x12 - AttrLanguage Attr = 0x13 - AttrDiscr Attr = 0x15 - AttrDiscrValue Attr = 0x16 - AttrVisibility Attr = 0x17 - AttrImport Attr = 0x18 - AttrStringLength Attr = 0x19 - AttrCommonRef Attr = 0x1A - AttrCompDir Attr = 0x1B - AttrConstValue Attr = 0x1C - AttrContainingType Attr = 0x1D - AttrDefaultValue Attr = 0x1E - AttrInline Attr = 0x20 - AttrIsOptional Attr = 0x21 - AttrLowerBound Attr = 0x22 - AttrProducer Attr = 0x25 - AttrPrototyped Attr = 0x27 - AttrReturnAddr Attr = 0x2A - AttrStartScope Attr = 0x2C - AttrStrideSize Attr = 0x2E - AttrUpperBound Attr = 0x2F - AttrAbstractOrigin Attr = 0x31 - AttrAccessibility Attr = 0x32 - AttrAddrClass Attr = 0x33 - AttrArtificial Attr = 0x34 - AttrBaseTypes Attr = 0x35 - AttrCalling Attr = 0x36 - AttrCount Attr = 0x37 - AttrDataMemberLoc Attr = 0x38 - AttrDeclColumn Attr = 0x39 - AttrDeclFile Attr = 0x3A - AttrDeclLine Attr = 0x3B - AttrDeclaration Attr = 0x3C - AttrDiscrList Attr = 0x3D - AttrEncoding Attr = 0x3E - AttrExternal Attr = 0x3F - AttrFrameBase Attr = 0x40 - AttrFriend Attr = 0x41 - AttrIdentifierCase Attr = 0x42 - AttrMacroInfo Attr = 0x43 - AttrNamelistItem Attr = 0x44 - AttrPriority Attr = 0x45 - AttrSegment Attr = 0x46 - AttrSpecification Attr = 0x47 - AttrStaticLink Attr = 0x48 - AttrType Attr = 0x49 - AttrUseLocation Attr = 0x4A - AttrVarParam Attr = 0x4B - AttrVirtuality Attr = 0x4C - AttrVtableElemLoc Attr = 0x4D - AttrAllocated Attr = 0x4E - AttrAssociated Attr = 0x4F - AttrDataLocation Attr = 0x50 - AttrStride Attr = 0x51 - AttrEntrypc Attr = 0x52 - AttrUseUTF8 Attr = 0x53 - AttrExtension Attr = 0x54 - AttrRanges Attr = 0x55 - AttrTrampoline Attr = 0x56 - AttrCallColumn Attr = 0x57 - AttrCallFile Attr = 0x58 - AttrCallLine Attr = 0x59 - AttrDescription Attr = 0x5A -) - -var attrNames = [...]string{ - AttrSibling: "Sibling", - AttrLocation: "Location", - AttrName: "Name", - AttrOrdering: "Ordering", - AttrByteSize: "ByteSize", - AttrBitOffset: "BitOffset", - AttrBitSize: "BitSize", - AttrStmtList: "StmtList", - AttrLowpc: "Lowpc", - AttrHighpc: "Highpc", - AttrLanguage: "Language", - AttrDiscr: "Discr", - AttrDiscrValue: "DiscrValue", - AttrVisibility: "Visibility", - AttrImport: "Import", - AttrStringLength: "StringLength", - AttrCommonRef: "CommonRef", - AttrCompDir: "CompDir", - AttrConstValue: "ConstValue", - AttrContainingType: "ContainingType", - AttrDefaultValue: "DefaultValue", - AttrInline: "Inline", - AttrIsOptional: "IsOptional", - AttrLowerBound: "LowerBound", - AttrProducer: "Producer", - AttrPrototyped: "Prototyped", - AttrReturnAddr: "ReturnAddr", - AttrStartScope: "StartScope", - AttrStrideSize: "StrideSize", - AttrUpperBound: "UpperBound", - AttrAbstractOrigin: "AbstractOrigin", - AttrAccessibility: "Accessibility", - AttrAddrClass: "AddrClass", - AttrArtificial: "Artificial", - AttrBaseTypes: "BaseTypes", - AttrCalling: "Calling", - AttrCount: "Count", - AttrDataMemberLoc: "DataMemberLoc", - AttrDeclColumn: "DeclColumn", - AttrDeclFile: "DeclFile", - AttrDeclLine: "DeclLine", - AttrDeclaration: "Declaration", - AttrDiscrList: "DiscrList", - AttrEncoding: "Encoding", - AttrExternal: "External", - AttrFrameBase: "FrameBase", - AttrFriend: "Friend", - AttrIdentifierCase: "IdentifierCase", - AttrMacroInfo: "MacroInfo", - AttrNamelistItem: "NamelistItem", - AttrPriority: "Priority", - AttrSegment: "Segment", - AttrSpecification: "Specification", - AttrStaticLink: "StaticLink", - AttrType: "Type", - AttrUseLocation: "UseLocation", - AttrVarParam: "VarParam", - AttrVirtuality: "Virtuality", - AttrVtableElemLoc: "VtableElemLoc", - AttrAllocated: "Allocated", - AttrAssociated: "Associated", - AttrDataLocation: "DataLocation", - AttrStride: "Stride", - AttrEntrypc: "Entrypc", - AttrUseUTF8: "UseUTF8", - AttrExtension: "Extension", - AttrRanges: "Ranges", - AttrTrampoline: "Trampoline", - AttrCallColumn: "CallColumn", - AttrCallFile: "CallFile", - AttrCallLine: "CallLine", - AttrDescription: "Description", -} - -func (a Attr) String() string { - if int(a) < len(attrNames) { - s := attrNames[a] - if s != "" { - return s - } - } - return strconv.Itoa(int(a)) -} - -func (a Attr) GoString() string { - if int(a) < len(attrNames) { - s := attrNames[a] - if s != "" { - return "dwarf.Attr" + s - } - } - return "dwarf.Attr(" + strconv.FormatInt(int64(a), 10) + ")" -} - -// A format is a DWARF data encoding format. -type format uint32 - -const ( - // value formats - formAddr format = 0x01 - formDwarfBlock2 format = 0x03 - formDwarfBlock4 format = 0x04 - formData2 format = 0x05 - formData4 format = 0x06 - formData8 format = 0x07 - formString format = 0x08 - formDwarfBlock format = 0x09 - formDwarfBlock1 format = 0x0A - formData1 format = 0x0B - formFlag format = 0x0C - formSdata format = 0x0D - formStrp format = 0x0E - formUdata format = 0x0F - formRefAddr format = 0x10 - formRef1 format = 0x11 - formRef2 format = 0x12 - formRef4 format = 0x13 - formRef8 format = 0x14 - formRefUdata format = 0x15 - formIndirect format = 0x16 - // The following are new in DWARF 4. - formSecOffset format = 0x17 - formExprloc format = 0x18 - formFlagPresent format = 0x19 - formRefSig8 format = 0x20 - // Extensions for multi-file compression (.dwz) - // http://www.dwarfstd.org/ShowIssue.php?issue=120604.1 - formGnuRefAlt format = 0x1f20 - formGnuStrpAlt format = 0x1f21 -) - -// A Tag is the classification (the type) of an Entry. -type Tag uint32 - -const ( - TagArrayType Tag = 0x01 - TagClassType Tag = 0x02 - TagEntryPoint Tag = 0x03 - TagEnumerationType Tag = 0x04 - TagFormalParameter Tag = 0x05 - TagImportedDeclaration Tag = 0x08 - TagLabel Tag = 0x0A - TagLexDwarfBlock Tag = 0x0B - TagMember Tag = 0x0D - TagPointerType Tag = 0x0F - TagReferenceType Tag = 0x10 - TagCompileUnit Tag = 0x11 - TagStringType Tag = 0x12 - TagStructType Tag = 0x13 - TagSubroutineType Tag = 0x15 - TagTypedef Tag = 0x16 - TagUnionType Tag = 0x17 - TagUnspecifiedParameters Tag = 0x18 - TagVariant Tag = 0x19 - TagCommonDwarfBlock Tag = 0x1A - TagCommonInclusion Tag = 0x1B - TagInheritance Tag = 0x1C - TagInlinedSubroutine Tag = 0x1D - TagModule Tag = 0x1E - TagPtrToMemberType Tag = 0x1F - TagSetType Tag = 0x20 - TagSubrangeType Tag = 0x21 - TagWithStmt Tag = 0x22 - TagAccessDeclaration Tag = 0x23 - TagBaseType Tag = 0x24 - TagCatchDwarfBlock Tag = 0x25 - TagConstType Tag = 0x26 - TagConstant Tag = 0x27 - TagEnumerator Tag = 0x28 - TagFileType Tag = 0x29 - TagFriend Tag = 0x2A - TagNamelist Tag = 0x2B - TagNamelistItem Tag = 0x2C - TagPackedType Tag = 0x2D - TagSubprogram Tag = 0x2E - TagTemplateTypeParameter Tag = 0x2F - TagTemplateValueParameter Tag = 0x30 - TagThrownType Tag = 0x31 - TagTryDwarfBlock Tag = 0x32 - TagVariantPart Tag = 0x33 - TagVariable Tag = 0x34 - TagVolatileType Tag = 0x35 - // The following are new in DWARF 3. - TagDwarfProcedure Tag = 0x36 - TagRestrictType Tag = 0x37 - TagInterfaceType Tag = 0x38 - TagNamespace Tag = 0x39 - TagImportedModule Tag = 0x3A - TagUnspecifiedType Tag = 0x3B - TagPartialUnit Tag = 0x3C - TagImportedUnit Tag = 0x3D - TagMutableType Tag = 0x3E // Later removed from DWARF. - TagCondition Tag = 0x3F - TagSharedType Tag = 0x40 - // The following are new in DWARF 4. - TagTypeUnit Tag = 0x41 - TagRvalueReferenceType Tag = 0x42 - TagTemplateAlias Tag = 0x43 -) - -var tagNames = [...]string{ - TagArrayType: "ArrayType", - TagClassType: "ClassType", - TagEntryPoint: "EntryPoint", - TagEnumerationType: "EnumerationType", - TagFormalParameter: "FormalParameter", - TagImportedDeclaration: "ImportedDeclaration", - TagLabel: "Label", - TagLexDwarfBlock: "LexDwarfBlock", - TagMember: "Member", - TagPointerType: "PointerType", - TagReferenceType: "ReferenceType", - TagCompileUnit: "CompileUnit", - TagStringType: "StringType", - TagStructType: "StructType", - TagSubroutineType: "SubroutineType", - TagTypedef: "Typedef", - TagUnionType: "UnionType", - TagUnspecifiedParameters: "UnspecifiedParameters", - TagVariant: "Variant", - TagCommonDwarfBlock: "CommonDwarfBlock", - TagCommonInclusion: "CommonInclusion", - TagInheritance: "Inheritance", - TagInlinedSubroutine: "InlinedSubroutine", - TagModule: "Module", - TagPtrToMemberType: "PtrToMemberType", - TagSetType: "SetType", - TagSubrangeType: "SubrangeType", - TagWithStmt: "WithStmt", - TagAccessDeclaration: "AccessDeclaration", - TagBaseType: "BaseType", - TagCatchDwarfBlock: "CatchDwarfBlock", - TagConstType: "ConstType", - TagConstant: "Constant", - TagEnumerator: "Enumerator", - TagFileType: "FileType", - TagFriend: "Friend", - TagNamelist: "Namelist", - TagNamelistItem: "NamelistItem", - TagPackedType: "PackedType", - TagSubprogram: "Subprogram", - TagTemplateTypeParameter: "TemplateTypeParameter", - TagTemplateValueParameter: "TemplateValueParameter", - TagThrownType: "ThrownType", - TagTryDwarfBlock: "TryDwarfBlock", - TagVariantPart: "VariantPart", - TagVariable: "Variable", - TagVolatileType: "VolatileType", - TagDwarfProcedure: "DwarfProcedure", - TagRestrictType: "RestrictType", - TagInterfaceType: "InterfaceType", - TagNamespace: "Namespace", - TagImportedModule: "ImportedModule", - TagUnspecifiedType: "UnspecifiedType", - TagPartialUnit: "PartialUnit", - TagImportedUnit: "ImportedUnit", - TagMutableType: "MutableType", - TagCondition: "Condition", - TagSharedType: "SharedType", - TagTypeUnit: "TypeUnit", - TagRvalueReferenceType: "RvalueReferenceType", - TagTemplateAlias: "TemplateAlias", -} - -func (t Tag) String() string { - if int(t) < len(tagNames) { - s := tagNames[t] - if s != "" { - return s - } - } - return strconv.Itoa(int(t)) -} - -func (t Tag) GoString() string { - if int(t) < len(tagNames) { - s := tagNames[t] - if s != "" { - return "dwarf.Tag" + s - } - } - return "dwarf.Tag(" + strconv.FormatInt(int64(t), 10) + ")" -} - -// Location expression operators. -// The debug info encodes value locations like 8(R3) -// as a sequence of these op codes. -// This package does not implement full expressions; -// the opPlusUconst operator is expected by the type parser. -const ( - opAddr = 0x03 /* 1 op, const addr */ - opDeref = 0x06 - opConst1u = 0x08 /* 1 op, 1 byte const */ - opConst1s = 0x09 /* " signed */ - opConst2u = 0x0A /* 1 op, 2 byte const */ - opConst2s = 0x0B /* " signed */ - opConst4u = 0x0C /* 1 op, 4 byte const */ - opConst4s = 0x0D /* " signed */ - opConst8u = 0x0E /* 1 op, 8 byte const */ - opConst8s = 0x0F /* " signed */ - opConstu = 0x10 /* 1 op, LEB128 const */ - opConsts = 0x11 /* " signed */ - opDup = 0x12 - opDrop = 0x13 - opOver = 0x14 - opPick = 0x15 /* 1 op, 1 byte stack index */ - opSwap = 0x16 - opRot = 0x17 - opXderef = 0x18 - opAbs = 0x19 - opAnd = 0x1A - opDiv = 0x1B - opMinus = 0x1C - opMod = 0x1D - opMul = 0x1E - opNeg = 0x1F - opNot = 0x20 - opOr = 0x21 - opPlus = 0x22 - opPlusUconst = 0x23 /* 1 op, ULEB128 addend */ - opShl = 0x24 - opShr = 0x25 - opShra = 0x26 - opXor = 0x27 - opSkip = 0x2F /* 1 op, signed 2-byte constant */ - opBra = 0x28 /* 1 op, signed 2-byte constant */ - opEq = 0x29 - opGe = 0x2A - opGt = 0x2B - opLe = 0x2C - opLt = 0x2D - opNe = 0x2E - opLit0 = 0x30 - /* OpLitN = OpLit0 + N for N = 0..31 */ - opReg0 = 0x50 - /* OpRegN = OpReg0 + N for N = 0..31 */ - opBreg0 = 0x70 /* 1 op, signed LEB128 constant */ - /* OpBregN = OpBreg0 + N for N = 0..31 */ - opRegx = 0x90 /* 1 op, ULEB128 register */ - opFbreg = 0x91 /* 1 op, SLEB128 offset */ - opBregx = 0x92 /* 2 op, ULEB128 reg; SLEB128 off */ - opPiece = 0x93 /* 1 op, ULEB128 size of piece */ - opDerefSize = 0x94 /* 1-byte size of data retrieved */ - opXderefSize = 0x95 /* 1-byte size of data retrieved */ - opNop = 0x96 - /* next four new in Dwarf v3 */ - opPushObjAddr = 0x97 - opCall2 = 0x98 /* 2-byte offset of DIE */ - opCall4 = 0x99 /* 4-byte offset of DIE */ - opCallRef = 0x9A /* 4- or 8- byte offset of DIE */ - /* 0xE0-0xFF reserved for user-specific */ -) - -// Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. -const ( - encAddress = 0x01 - encBoolean = 0x02 - encComplexFloat = 0x03 - encFloat = 0x04 - encSigned = 0x05 - encSignedChar = 0x06 - encUnsigned = 0x07 - encUnsignedChar = 0x08 - encImaginaryFloat = 0x09 -) - -// Statement program standard opcode encodings. -const ( - lnsCopy = 1 - lnsAdvancePC = 2 - lnsAdvanceLine = 3 - lnsSetFile = 4 - lnsSetColumn = 5 - lnsNegateStmt = 6 - lnsSetBasicBlock = 7 - lnsConstAddPC = 8 - lnsFixedAdvancePC = 9 - - // DWARF 3 - lnsSetPrologueEnd = 10 - lnsSetEpilogueBegin = 11 - lnsSetISA = 12 -) - -// Statement program extended opcode encodings. -const ( - lneEndSequence = 1 - lneSetAddress = 2 - lneDefineFile = 3 - - // DWARF 4 - lneSetDiscriminator = 4 -) diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/entry.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/entry.go deleted file mode 100644 index d607e5b4a38e498d04cb1d1208ee4a04d74baffd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/entry.go +++ /dev/null @@ -1,633 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// DWARF debug information entry parser. -// An entry is a sequence of data items of a given format. -// The first word in the entry is an index into what DWARF -// calls the ``abbreviation table.'' An abbreviation is really -// just a type descriptor: it's an array of attribute tag/value format pairs. - -package dwarf - -import ( - "errors" - "strconv" -) - -// a single entry's description: a sequence of attributes -type abbrev struct { - tag Tag - children bool - field []afield -} - -type afield struct { - attr Attr - fmt format - class Class -} - -// a map from entry format ids to their descriptions -type abbrevTable map[uint32]abbrev - -// ParseAbbrev returns the abbreviation table that starts at byte off -// in the .debug_abbrev section. -func (d *Data) parseAbbrev(off uint32, vers int) (abbrevTable, error) { - if m, ok := d.abbrevCache[off]; ok { - return m, nil - } - - data := d.abbrev - if off > uint32(len(data)) { - data = nil - } else { - data = data[off:] - } - b := makeBuf(d, unknownFormat{}, "abbrev", 0, data) - - // Error handling is simplified by the buf getters - // returning an endless stream of 0s after an error. - m := make(abbrevTable) - for { - // Table ends with id == 0. - id := uint32(b.uint()) - if id == 0 { - break - } - - // Walk over attributes, counting. - n := 0 - b1 := b // Read from copy of b. - b1.uint() - b1.uint8() - for { - tag := b1.uint() - fmt := b1.uint() - if tag == 0 && fmt == 0 { - break - } - n++ - } - if b1.err != nil { - return nil, b1.err - } - - // Walk over attributes again, this time writing them down. - var a abbrev - a.tag = Tag(b.uint()) - a.children = b.uint8() != 0 - a.field = make([]afield, n) - for i := range a.field { - a.field[i].attr = Attr(b.uint()) - a.field[i].fmt = format(b.uint()) - a.field[i].class = formToClass(a.field[i].fmt, a.field[i].attr, vers, &b) - } - b.uint() - b.uint() - - m[id] = a - } - if b.err != nil { - return nil, b.err - } - d.abbrevCache[off] = m - return m, nil -} - -// attrIsExprloc indicates attributes that allow exprloc values that -// are encoded as block values in DWARF 2 and 3. See DWARF 4, Figure -// 20. -var attrIsExprloc = map[Attr]bool{ - AttrLocation: true, - AttrByteSize: true, - AttrBitOffset: true, - AttrBitSize: true, - AttrStringLength: true, - AttrLowerBound: true, - AttrReturnAddr: true, - AttrStrideSize: true, - AttrUpperBound: true, - AttrCount: true, - AttrDataMemberLoc: true, - AttrFrameBase: true, - AttrSegment: true, - AttrStaticLink: true, - AttrUseLocation: true, - AttrVtableElemLoc: true, - AttrAllocated: true, - AttrAssociated: true, - AttrDataLocation: true, - AttrStride: true, -} - -// attrPtrClass indicates the *ptr class of attributes that have -// encoding formSecOffset in DWARF 4 or formData* in DWARF 2 and 3. -var attrPtrClass = map[Attr]Class{ - AttrLocation: ClassLocListPtr, - AttrStmtList: ClassLinePtr, - AttrStringLength: ClassLocListPtr, - AttrReturnAddr: ClassLocListPtr, - AttrStartScope: ClassRangeListPtr, - AttrDataMemberLoc: ClassLocListPtr, - AttrFrameBase: ClassLocListPtr, - AttrMacroInfo: ClassMacPtr, - AttrSegment: ClassLocListPtr, - AttrStaticLink: ClassLocListPtr, - AttrUseLocation: ClassLocListPtr, - AttrVtableElemLoc: ClassLocListPtr, - AttrRanges: ClassRangeListPtr, -} - -// formToClass returns the DWARF 4 Class for the given form. If the -// DWARF version is less then 4, it will disambiguate some forms -// depending on the attribute. -func formToClass(form format, attr Attr, vers int, b *buf) Class { - switch form { - default: - b.error("cannot determine class of unknown attribute form") - return 0 - - case formAddr: - return ClassAddress - - case formDwarfBlock1, formDwarfBlock2, formDwarfBlock4, formDwarfBlock: - // In DWARF 2 and 3, ClassExprLoc was encoded as a - // block. DWARF 4 distinguishes ClassBlock and - // ClassExprLoc, but there are no attributes that can - // be both, so we also promote ClassBlock values in - // DWARF 4 that should be ClassExprLoc in case - // producers get this wrong. - if attrIsExprloc[attr] { - return ClassExprLoc - } - return ClassBlock - - case formData1, formData2, formData4, formData8, formSdata, formUdata: - // In DWARF 2 and 3, ClassPtr was encoded as a - // constant. Unlike ClassExprLoc/ClassBlock, some - // DWARF 4 attributes need to distinguish Class*Ptr - // from ClassConstant, so we only do this promotion - // for versions 2 and 3. - if class, ok := attrPtrClass[attr]; vers < 4 && ok { - return class - } - return ClassConstant - - case formFlag, formFlagPresent: - return ClassFlag - - case formRefAddr, formRef1, formRef2, formRef4, formRef8, formRefUdata: - return ClassReference - - case formRefSig8: - return ClassReferenceSig - - case formString, formStrp: - return ClassString - - case formSecOffset: - // DWARF 4 defines four *ptr classes, but doesn't - // distinguish them in the encoding. Disambiguate - // these classes using the attribute. - if class, ok := attrPtrClass[attr]; ok { - return class - } - b.error("cannot determine class of unknown attribute with formSecOffset") - return 0 - - case formExprloc: - return ClassExprLoc - - case formGnuRefAlt: - return ClassReferenceAlt - - case formGnuStrpAlt: - return ClassStringAlt - } -} - -// An entry is a sequence of attribute/value pairs. -type Entry struct { - Offset Offset // offset of Entry in DWARF info - Tag Tag // tag (kind of Entry) - Children bool // whether Entry is followed by children - Field []Field -} - -// A Field is a single attribute/value pair in an Entry. -// -// A value can be one of several "attribute classes" defined by DWARF. -// The Go types corresponding to each class are: -// -// DWARF class Go type Class -// ----------- ------- ----- -// address uint64 ClassAddress -// block []byte ClassBlock -// constant int64 ClassConstant -// flag bool ClassFlag -// reference -// to info dwarf.Offset ClassReference -// to type unit uint64 ClassReferenceSig -// string string ClassString -// exprloc []byte ClassExprLoc -// lineptr int64 ClassLinePtr -// loclistptr int64 ClassLocListPtr -// macptr int64 ClassMacPtr -// rangelistptr int64 ClassRangeListPtr -type Field struct { - Attr Attr - Val interface{} - Class Class -} - -// A Class is the DWARF 4 class of an attibute value. -// -// In general, a given attribute's value may take on one of several -// possible classes defined by DWARF, each of which leads to a -// slightly different interpretation of the attribute. -// -// DWARF version 4 distinguishes attribute value classes more finely -// than previous versions of DWARF. The reader will disambiguate -// coarser classes from earlier versions of DWARF into the appropriate -// DWARF 4 class. For example, DWARF 2 uses "constant" for constants -// as well as all types of section offsets, but the reader will -// canonicalize attributes in DWARF 2 files that refer to section -// offsets to one of the Class*Ptr classes, even though these classes -// were only defined in DWARF 3. -type Class int - -const ( - // ClassAddress represents values of type uint64 that are - // addresses on the target machine. - ClassAddress Class = 1 + iota - - // ClassBlock represents values of type []byte whose - // interpretation depends on the attribute. - ClassBlock - - // ClassConstant represents values of type int64 that are - // constants. The interpretation of this constant depends on - // the attribute. - ClassConstant - - // ClassExprLoc represents values of type []byte that contain - // an encoded DWARF expression or location description. - ClassExprLoc - - // ClassFlag represents values of type bool. - ClassFlag - - // ClassLinePtr represents values that are an int64 offset - // into the "line" section. - ClassLinePtr - - // ClassLocListPtr represents values that are an int64 offset - // into the "loclist" section. - ClassLocListPtr - - // ClassMacPtr represents values that are an int64 offset into - // the "mac" section. - ClassMacPtr - - // ClassMacPtr represents values that are an int64 offset into - // the "rangelist" section. - ClassRangeListPtr - - // ClassReference represents values that are an Offset offset - // of an Entry in the info section (for use with Reader.Seek). - // The DWARF specification combines ClassReference and - // ClassReferenceSig into class "reference". - ClassReference - - // ClassReferenceSig represents values that are a uint64 type - // signature referencing a type Entry. - ClassReferenceSig - - // ClassString represents values that are strings. If the - // compilation unit specifies the AttrUseUTF8 flag (strongly - // recommended), the string value will be encoded in UTF-8. - // Otherwise, the encoding is unspecified. - ClassString - - // ClassReferenceAlt represents values of type int64 that are - // an offset into the DWARF "info" section of an alternate - // object file. - ClassReferenceAlt - - // ClassStringAlt represents values of type int64 that are an - // offset into the DWARF string section of an alternate object - // file. - ClassStringAlt -) - -//go:generate stringer -type=Class - -func (i Class) GoString() string { - return "dwarf." + i.String() -} - -// Val returns the value associated with attribute Attr in Entry, -// or nil if there is no such attribute. -// -// A common idiom is to merge the check for nil return with -// the check that the value has the expected dynamic type, as in: -// v, ok := e.Val(AttrSibling).(int64) -// -func (e *Entry) Val(a Attr) interface{} { - if f := e.AttrField(a); f != nil { - return f.Val - } - return nil -} - -// AttrField returns the Field associated with attribute Attr in -// Entry, or nil if there is no such attribute. -func (e *Entry) AttrField(a Attr) *Field { - for i, f := range e.Field { - if f.Attr == a { - return &e.Field[i] - } - } - return nil -} - -// An Offset represents the location of an Entry within the DWARF info. -// (See Reader.Seek.) -type Offset uint32 - -// Entry reads a single entry from buf, decoding -// according to the given abbreviation table. -func (b *buf) entry(atab abbrevTable, ubase Offset) *Entry { - off := b.off - id := uint32(b.uint()) - if id == 0 { - return &Entry{} - } - a, ok := atab[id] - if !ok { - b.error("unknown abbreviation table index") - return nil - } - e := &Entry{ - Offset: off, - Tag: a.tag, - Children: a.children, - Field: make([]Field, len(a.field)), - } - for i := range e.Field { - e.Field[i].Attr = a.field[i].attr - e.Field[i].Class = a.field[i].class - fmt := a.field[i].fmt - if fmt == formIndirect { - fmt = format(b.uint()) - } - var val interface{} - switch fmt { - default: - b.error("unknown entry attr format 0x" + strconv.FormatInt(int64(fmt), 16)) - - // address - case formAddr: - val = b.addr() - - // block - case formDwarfBlock1: - val = b.bytes(int(b.uint8())) - case formDwarfBlock2: - val = b.bytes(int(b.uint16())) - case formDwarfBlock4: - val = b.bytes(int(b.uint32())) - case formDwarfBlock: - val = b.bytes(int(b.uint())) - - // constant - case formData1: - val = int64(b.uint8()) - case formData2: - val = int64(b.uint16()) - case formData4: - val = int64(b.uint32()) - case formData8: - val = int64(b.uint64()) - case formSdata: - val = int64(b.int()) - case formUdata: - val = int64(b.uint()) - - // flag - case formFlag: - val = b.uint8() == 1 - // New in DWARF 4. - case formFlagPresent: - // The attribute is implicitly indicated as present, and no value is - // encoded in the debugging information entry itself. - val = true - - // reference to other entry - case formRefAddr: - vers := b.format.version() - if vers == 0 { - b.error("unknown version for DW_FORM_ref_addr") - } else if vers == 2 { - val = Offset(b.addr()) - } else { - is64, known := b.format.dwarf64() - if !known { - b.error("unknown size for DW_FORM_ref_addr") - } else if is64 { - val = Offset(b.uint64()) - } else { - val = Offset(b.uint32()) - } - } - case formRef1: - val = Offset(b.uint8()) + ubase - case formRef2: - val = Offset(b.uint16()) + ubase - case formRef4: - val = Offset(b.uint32()) + ubase - case formRef8: - val = Offset(b.uint64()) + ubase - case formRefUdata: - val = Offset(b.uint()) + ubase - - // string - case formString: - val = b.string() - case formStrp: - off := b.uint32() // offset into .debug_str - if b.err != nil { - return nil - } - b1 := makeBuf(b.dwarf, unknownFormat{}, "str", 0, b.dwarf.str) - b1.skip(int(off)) - val = b1.string() - if b1.err != nil { - b.err = b1.err - return nil - } - - // lineptr, loclistptr, macptr, rangelistptr - // New in DWARF 4, but clang can generate them with -gdwarf-2. - // Section reference, replacing use of formData4 and formData8. - case formSecOffset, formGnuRefAlt, formGnuStrpAlt: - is64, known := b.format.dwarf64() - if !known { - b.error("unknown size for form 0x" + strconv.FormatInt(int64(fmt), 16)) - } else if is64 { - val = int64(b.uint64()) - } else { - val = int64(b.uint32()) - } - - // exprloc - // New in DWARF 4. - case formExprloc: - val = b.bytes(int(b.uint())) - - // reference - // New in DWARF 4. - case formRefSig8: - // 64-bit type signature. - val = b.uint64() - } - e.Field[i].Val = val - } - if b.err != nil { - return nil - } - return e -} - -// A Reader allows reading Entry structures from a DWARF ``info'' section. -// The Entry structures are arranged in a tree. The Reader's Next function -// return successive entries from a pre-order traversal of the tree. -// If an entry has children, its Children field will be true, and the children -// follow, terminated by an Entry with Tag 0. -type Reader struct { - b buf - d *Data - err error - unit int - lastChildren bool // .Children of last entry returned by Next - lastSibling Offset // .Val(AttrSibling) of last entry returned by Next -} - -// Reader returns a new Reader for Data. -// The reader is positioned at byte offset 0 in the DWARF ``info'' section. -func (d *Data) Reader() *Reader { - r := &Reader{d: d} - r.Seek(0) - return r -} - -// AddressSize returns the size in bytes of addresses in the current compilation -// unit. -func (r *Reader) AddressSize() int { - return r.d.unit[r.unit].asize -} - -// Seek positions the Reader at offset off in the encoded entry stream. -// Offset 0 can be used to denote the first entry. -func (r *Reader) Seek(off Offset) { - d := r.d - r.err = nil - r.lastChildren = false - if off == 0 { - if len(d.unit) == 0 { - return - } - u := &d.unit[0] - r.unit = 0 - r.b = makeBuf(r.d, u, "info", u.off, u.data) - return - } - - i := d.offsetToUnit(off) - if i == -1 { - r.err = errors.New("offset out of range") - return - } - u := &d.unit[i] - r.unit = i - r.b = makeBuf(r.d, u, "info", off, u.data[off-u.off:]) -} - -// maybeNextUnit advances to the next unit if this one is finished. -func (r *Reader) maybeNextUnit() { - for len(r.b.data) == 0 && r.unit+1 < len(r.d.unit) { - r.unit++ - u := &r.d.unit[r.unit] - r.b = makeBuf(r.d, u, "info", u.off, u.data) - } -} - -// Next reads the next entry from the encoded entry stream. -// It returns nil, nil when it reaches the end of the section. -// It returns an error if the current offset is invalid or the data at the -// offset cannot be decoded as a valid Entry. -func (r *Reader) Next() (*Entry, error) { - if r.err != nil { - return nil, r.err - } - r.maybeNextUnit() - if len(r.b.data) == 0 { - return nil, nil - } - u := &r.d.unit[r.unit] - e := r.b.entry(u.atable, u.base) - if r.b.err != nil { - r.err = r.b.err - return nil, r.err - } - if e != nil { - r.lastChildren = e.Children - if r.lastChildren { - r.lastSibling, _ = e.Val(AttrSibling).(Offset) - } - } else { - r.lastChildren = false - } - return e, nil -} - -// SkipChildren skips over the child entries associated with -// the last Entry returned by Next. If that Entry did not have -// children or Next has not been called, SkipChildren is a no-op. -func (r *Reader) SkipChildren() { - if r.err != nil || !r.lastChildren { - return - } - - // If the last entry had a sibling attribute, - // that attribute gives the offset of the next - // sibling, so we can avoid decoding the - // child subtrees. - if r.lastSibling >= r.b.off { - r.Seek(r.lastSibling) - return - } - - for { - e, err := r.Next() - if err != nil || e == nil || e.Tag == 0 { - break - } - if e.Children { - r.SkipChildren() - } - } -} - -// clone returns a copy of the reader. This is used by the typeReader -// interface. -func (r *Reader) clone() typeReader { - return r.d.Reader() -} - -// offset returns the current buffer offset. This is used by the -// typeReader interface. -func (r *Reader) offset() Offset { - return r.b.off -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line.go deleted file mode 100644 index ca64bbd7f3b310778058a3a404d699f5a84e0907..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line.go +++ /dev/null @@ -1,590 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dwarf - -import ( - "errors" - "fmt" - "io" - "path" -) - -// A LineReader reads a sequence of LineEntry structures from a DWARF -// "line" section for a single compilation unit. LineEntries occur in -// order of increasing PC and each LineEntry gives metadata for the -// instructions from that LineEntry's PC to just before the next -// LineEntry's PC. The last entry will have its EndSequence field set. -type LineReader struct { - buf buf - - // Original .debug_line section data. Used by Seek. - section []byte - - // Header information - version uint16 - minInstructionLength int - maxOpsPerInstruction int - defaultIsStmt bool - lineBase int - lineRange int - opcodeBase int - opcodeLengths []int - directories []string - fileEntries []*LineFile - - programOffset Offset // section offset of line number program - endOffset Offset // section offset of byte following program - - initialFileEntries int // initial length of fileEntries - - // Current line number program state machine registers - state LineEntry // public state - fileIndex int // private state -} - -// A LineEntry is a row in a DWARF line table. -type LineEntry struct { - // Address is the program-counter value of a machine - // instruction generated by the compiler. This LineEntry - // applies to each instruction from Address to just before the - // Address of the next LineEntry. - Address uint64 - - // OpIndex is the index of an operation within a VLIW - // instruction. The index of the first operation is 0. For - // non-VLIW architectures, it will always be 0. Address and - // OpIndex together form an operation pointer that can - // reference any individual operation within the instruction - // stream. - OpIndex int - - // File is the source file corresponding to these - // instructions. - File *LineFile - - // Line is the source code line number corresponding to these - // instructions. Lines are numbered beginning at 1. It may be - // 0 if these instructions cannot be attributed to any source - // line. - Line int - - // Column is the column number within the source line of these - // instructions. Columns are numbered beginning at 1. It may - // be 0 to indicate the "left edge" of the line. - Column int - - // IsStmt indicates that Address is a recommended breakpoint - // location, such as the beginning of a line, statement, or a - // distinct subpart of a statement. - IsStmt bool - - // BasicBlock indicates that Address is the beginning of a - // basic block. - BasicBlock bool - - // PrologueEnd indicates that Address is one (of possibly - // many) PCs where execution should be suspended for a - // breakpoint on entry to the containing function. - // - // Added in DWARF 3. - PrologueEnd bool - - // EpilogueBegin indicates that Address is one (of possibly - // many) PCs where execution should be suspended for a - // breakpoint on exit from this function. - // - // Added in DWARF 3. - EpilogueBegin bool - - // ISA is the instruction set architecture for these - // instructions. Possible ISA values should be defined by the - // applicable ABI specification. - // - // Added in DWARF 3. - ISA int - - // Discriminator is an arbitrary integer indicating the block - // to which these instructions belong. It serves to - // distinguish among multiple blocks that may all have with - // the same source file, line, and column. Where only one - // block exists for a given source position, it should be 0. - // - // Added in DWARF 3. - Discriminator int - - // EndSequence indicates that Address is the first byte after - // the end of a sequence of target machine instructions. If it - // is set, only this and the Address field are meaningful. A - // line number table may contain information for multiple - // potentially disjoint instruction sequences. The last entry - // in a line table should always have EndSequence set. - EndSequence bool -} - -// A LineFile is a source file referenced by a DWARF line table entry. -type LineFile struct { - Name string - Mtime uint64 // Implementation defined modification time, or 0 if unknown - Length int // File length, or 0 if unknown -} - -// LineReader returns a new reader for the line table of compilation -// unit cu, which must be an Entry with tag TagCompileUnit. -// -// If this compilation unit has no line table, it returns nil, nil. -func (d *Data) LineReader(cu *Entry) (*LineReader, error) { - if d.line == nil { - // No line tables available. - return nil, nil - } - - // Get line table information from cu. - off, ok := cu.Val(AttrStmtList).(int64) - if !ok { - // cu has no line table. - return nil, nil - } - if off > int64(len(d.line)) { - return nil, errors.New("AttrStmtList value out of range") - } - // AttrCompDir is optional if all file names are absolute. Use - // the empty string if it's not present. - compDir, _ := cu.Val(AttrCompDir).(string) - - // Create the LineReader. - u := &d.unit[d.offsetToUnit(cu.Offset)] - buf := makeBuf(d, u, "line", Offset(off), d.line[off:]) - // The compilation directory is implicitly directories[0]. - r := LineReader{buf: buf, section: d.line, directories: []string{compDir}} - - // Read the header. - if err := r.readHeader(); err != nil { - return nil, err - } - - // Initialize line reader state. - r.Reset() - - return &r, nil -} - -// readHeader reads the line number program header from r.buf and sets -// all of the header fields in r. -func (r *LineReader) readHeader() error { - buf := &r.buf - - // Read basic header fields [DWARF2 6.2.4]. - hdrOffset := buf.off - unitLength, dwarf64 := buf.unitLength() - r.endOffset = buf.off + unitLength - if r.endOffset > buf.off+Offset(len(buf.data)) { - return DecodeError{"line", hdrOffset, fmt.Sprintf("line table end %d exceeds section size %d", r.endOffset, buf.off+Offset(len(buf.data)))} - } - r.version = buf.uint16() - if buf.err == nil && (r.version < 2 || r.version > 4) { - // DWARF goes to all this effort to make new opcodes - // backward-compatible, and then adds fields right in - // the middle of the header in new versions, so we're - // picky about only supporting known line table - // versions. - return DecodeError{"line", hdrOffset, fmt.Sprintf("unknown line table version %d", r.version)} - } - var headerLength Offset - if dwarf64 { - headerLength = Offset(buf.uint64()) - } else { - headerLength = Offset(buf.uint32()) - } - r.programOffset = buf.off + headerLength - r.minInstructionLength = int(buf.uint8()) - if r.version >= 4 { - // [DWARF4 6.2.4] - r.maxOpsPerInstruction = int(buf.uint8()) - } else { - r.maxOpsPerInstruction = 1 - } - r.defaultIsStmt = buf.uint8() != 0 - r.lineBase = int(int8(buf.uint8())) - r.lineRange = int(buf.uint8()) - - // Validate header. - if buf.err != nil { - return buf.err - } - if r.maxOpsPerInstruction == 0 { - return DecodeError{"line", hdrOffset, "invalid maximum operations per instruction: 0"} - } - if r.lineRange == 0 { - return DecodeError{"line", hdrOffset, "invalid line range: 0"} - } - - // Read standard opcode length table. This table starts with opcode 1. - r.opcodeBase = int(buf.uint8()) - r.opcodeLengths = make([]int, r.opcodeBase) - for i := 1; i < r.opcodeBase; i++ { - r.opcodeLengths[i] = int(buf.uint8()) - } - - // Validate opcode lengths. - if buf.err != nil { - return buf.err - } - for i, length := range r.opcodeLengths { - if known, ok := knownOpcodeLengths[i]; ok && known != length { - return DecodeError{"line", hdrOffset, fmt.Sprintf("opcode %d expected to have length %d, but has length %d", i, known, length)} - } - } - - // Read include directories table. The caller already set - // directories[0] to the compilation directory. - for { - directory := buf.string() - if buf.err != nil { - return buf.err - } - if len(directory) == 0 { - break - } - if !path.IsAbs(directory) { - // Relative paths are implicitly relative to - // the compilation directory. - directory = path.Join(r.directories[0], directory) - } - r.directories = append(r.directories, directory) - } - - // Read file name list. File numbering starts with 1, so leave - // the first entry nil. - r.fileEntries = make([]*LineFile, 1) - for { - if done, err := r.readFileEntry(); err != nil { - return err - } else if done { - break - } - } - r.initialFileEntries = len(r.fileEntries) - - return buf.err -} - -// readFileEntry reads a file entry from either the header or a -// DW_LNE_define_file extended opcode and adds it to r.fileEntries. A -// true return value indicates that there are no more entries to read. -func (r *LineReader) readFileEntry() (bool, error) { - name := r.buf.string() - if r.buf.err != nil { - return false, r.buf.err - } - if len(name) == 0 { - return true, nil - } - off := r.buf.off - dirIndex := int(r.buf.uint()) - if !path.IsAbs(name) { - if dirIndex >= len(r.directories) { - return false, DecodeError{"line", off, "directory index too large"} - } - name = path.Join(r.directories[dirIndex], name) - } - mtime := r.buf.uint() - length := int(r.buf.uint()) - - r.fileEntries = append(r.fileEntries, &LineFile{name, mtime, length}) - return false, nil -} - -// updateFile updates r.state.File after r.fileIndex has -// changed or r.fileEntries has changed. -func (r *LineReader) updateFile() { - if r.fileIndex < len(r.fileEntries) { - r.state.File = r.fileEntries[r.fileIndex] - } else { - r.state.File = nil - } -} - -// Next sets *entry to the next row in this line table and moves to -// the next row. If there are no more entries and the line table is -// properly terminated, it returns io.EOF. -// -// Rows are always in order of increasing entry.Address, but -// entry.Line may go forward or backward. -func (r *LineReader) Next(entry *LineEntry) error { - if r.buf.err != nil { - return r.buf.err - } - - // Execute opcodes until we reach an opcode that emits a line - // table entry. - for { - if len(r.buf.data) == 0 { - return io.EOF - } - emit := r.step(entry) - if r.buf.err != nil { - return r.buf.err - } - if emit { - return nil - } - } -} - -// knownOpcodeLengths gives the opcode lengths (in varint arguments) -// of known standard opcodes. -var knownOpcodeLengths = map[int]int{ - lnsCopy: 0, - lnsAdvancePC: 1, - lnsAdvanceLine: 1, - lnsSetFile: 1, - lnsNegateStmt: 0, - lnsSetBasicBlock: 0, - lnsConstAddPC: 0, - lnsSetPrologueEnd: 0, - lnsSetEpilogueBegin: 0, - lnsSetISA: 1, - // lnsFixedAdvancePC takes a uint8 rather than a varint; it's - // unclear what length the header is supposed to claim, so - // ignore it. -} - -// step processes the next opcode and updates r.state. If the opcode -// emits a row in the line table, this updates *entry and returns -// true. -func (r *LineReader) step(entry *LineEntry) bool { - opcode := int(r.buf.uint8()) - - if opcode >= r.opcodeBase { - // Special opcode [DWARF2 6.2.5.1, DWARF4 6.2.5.1] - adjustedOpcode := opcode - r.opcodeBase - r.advancePC(adjustedOpcode / r.lineRange) - lineDelta := r.lineBase + int(adjustedOpcode)%r.lineRange - r.state.Line += lineDelta - goto emit - } - - switch opcode { - case 0: - // Extended opcode [DWARF2 6.2.5.3] - length := Offset(r.buf.uint()) - startOff := r.buf.off - opcode := r.buf.uint8() - - switch opcode { - case lneEndSequence: - r.state.EndSequence = true - *entry = r.state - r.resetState() - - case lneSetAddress: - r.state.Address = r.buf.addr() - - case lneDefineFile: - if done, err := r.readFileEntry(); err != nil { - r.buf.err = err - return false - } else if done { - r.buf.err = DecodeError{"line", startOff, "malformed DW_LNE_define_file operation"} - return false - } - r.updateFile() - - case lneSetDiscriminator: - // [DWARF4 6.2.5.3] - r.state.Discriminator = int(r.buf.uint()) - } - - r.buf.skip(int(startOff + length - r.buf.off)) - - if opcode == lneEndSequence { - return true - } - - // Standard opcodes [DWARF2 6.2.5.2] - case lnsCopy: - goto emit - - case lnsAdvancePC: - r.advancePC(int(r.buf.uint())) - - case lnsAdvanceLine: - r.state.Line += int(r.buf.int()) - - case lnsSetFile: - r.fileIndex = int(r.buf.uint()) - r.updateFile() - - case lnsSetColumn: - r.state.Column = int(r.buf.uint()) - - case lnsNegateStmt: - r.state.IsStmt = !r.state.IsStmt - - case lnsSetBasicBlock: - r.state.BasicBlock = true - - case lnsConstAddPC: - r.advancePC((255 - r.opcodeBase) / r.lineRange) - - case lnsFixedAdvancePC: - r.state.Address += uint64(r.buf.uint16()) - - // DWARF3 standard opcodes [DWARF3 6.2.5.2] - case lnsSetPrologueEnd: - r.state.PrologueEnd = true - - case lnsSetEpilogueBegin: - r.state.EpilogueBegin = true - - case lnsSetISA: - r.state.ISA = int(r.buf.uint()) - - default: - // Unhandled standard opcode. Skip the number of - // arguments that the prologue says this opcode has. - for i := 0; i < r.opcodeLengths[opcode]; i++ { - r.buf.uint() - } - } - return false - -emit: - *entry = r.state - r.state.BasicBlock = false - r.state.PrologueEnd = false - r.state.EpilogueBegin = false - r.state.Discriminator = 0 - return true -} - -// advancePC advances "operation pointer" (the combination of Address -// and OpIndex) in r.state by opAdvance steps. -func (r *LineReader) advancePC(opAdvance int) { - opIndex := r.state.OpIndex + opAdvance - r.state.Address += uint64(r.minInstructionLength * (opIndex / r.maxOpsPerInstruction)) - r.state.OpIndex = opIndex % r.maxOpsPerInstruction -} - -// A LineReaderPos represents a position in a line table. -type LineReaderPos struct { - // off is the current offset in the DWARF line section. - off Offset - // numFileEntries is the length of fileEntries. - numFileEntries int - // state and fileIndex are the statement machine state at - // offset off. - state LineEntry - fileIndex int -} - -// Tell returns the current position in the line table. -func (r *LineReader) Tell() LineReaderPos { - return LineReaderPos{r.buf.off, len(r.fileEntries), r.state, r.fileIndex} -} - -// Seek restores the line table reader to a position returned by Tell. -// -// The argument pos must have been returned by a call to Tell on this -// line table. -func (r *LineReader) Seek(pos LineReaderPos) { - r.buf.off = pos.off - r.buf.data = r.section[r.buf.off:r.endOffset] - r.fileEntries = r.fileEntries[:pos.numFileEntries] - r.state = pos.state - r.fileIndex = pos.fileIndex -} - -// Reset repositions the line table reader at the beginning of the -// line table. -func (r *LineReader) Reset() { - // Reset buffer to the line number program offset. - r.buf.off = r.programOffset - r.buf.data = r.section[r.buf.off:r.endOffset] - - // Reset file entries list. - r.fileEntries = r.fileEntries[:r.initialFileEntries] - - // Reset line number program state. - r.resetState() -} - -// resetState resets r.state to its default values -func (r *LineReader) resetState() { - // Reset the state machine registers to the defaults given in - // [DWARF4 6.2.2]. - r.state = LineEntry{ - Address: 0, - OpIndex: 0, - File: nil, - Line: 1, - Column: 0, - IsStmt: r.defaultIsStmt, - BasicBlock: false, - PrologueEnd: false, - EpilogueBegin: false, - ISA: 0, - Discriminator: 0, - } - r.fileIndex = 1 - r.updateFile() -} - -// ErrUnknownPC is the error returned by LineReader.ScanPC when the -// seek PC is not covered by any entry in the line table. -var ErrUnknownPC = errors.New("ErrUnknownPC") - -// SeekPC sets *entry to the LineEntry that includes pc and positions -// the reader on the next entry in the line table. If necessary, this -// will seek backwards to find pc. -// -// If pc is not covered by any entry in this line table, SeekPC -// returns ErrUnknownPC. In this case, *entry and the final seek -// position are unspecified. -// -// Note that DWARF line tables only permit sequential, forward scans. -// Hence, in the worst case, this takes time linear in the size of the -// line table. If the caller wishes to do repeated fast PC lookups, it -// should build an appropriate index of the line table. -func (r *LineReader) SeekPC(pc uint64, entry *LineEntry) error { - if err := r.Next(entry); err != nil { - return err - } - if entry.Address > pc { - // We're too far. Start at the beginning of the table. - r.Reset() - if err := r.Next(entry); err != nil { - return err - } - if entry.Address > pc { - // The whole table starts after pc. - r.Reset() - return ErrUnknownPC - } - } - - // Scan until we pass pc, then back up one. - for { - var next LineEntry - pos := r.Tell() - if err := r.Next(&next); err != nil { - if err == io.EOF { - return ErrUnknownPC - } - return err - } - if next.Address > pc { - if entry.EndSequence { - // pc is in a hole in the table. - return ErrUnknownPC - } - // entry is the desired entry. Back up the - // cursor to "next" and return success. - r.Seek(pos) - return nil - } - *entry = next - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line_test.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line_test.go deleted file mode 100644 index 4104b5d49b80b7399f9fe6f211cab40e79ee6107..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/line_test.go +++ /dev/null @@ -1,229 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dwarf_test - -import ( - . "debug/dwarf" - "io" - "testing" -) - -var ( - file1C = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line1.c"} - file1H = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line1.h"} - file2C = &LineFile{Name: "/home/austin/go.dev/src/debug/dwarf/testdata/line2.c"} -) - -func TestLineELFGCC(t *testing.T) { - // Generated by: - // # gcc --version | head -n1 - // gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 - // # gcc -g -o line-gcc.elf line*.c - - // Line table based on readelf --debug-dump=rawline,decodedline - want := []LineEntry{ - {Address: 0x40059d, File: file1H, Line: 2, IsStmt: true}, - {Address: 0x4005a5, File: file1H, Line: 2, IsStmt: true}, - {Address: 0x4005b4, File: file1H, Line: 5, IsStmt: true}, - {Address: 0x4005bd, File: file1H, Line: 6, IsStmt: true, Discriminator: 2}, - {Address: 0x4005c7, File: file1H, Line: 5, IsStmt: true, Discriminator: 2}, - {Address: 0x4005cb, File: file1H, Line: 5, IsStmt: false, Discriminator: 1}, - {Address: 0x4005d1, File: file1H, Line: 7, IsStmt: true}, - {Address: 0x4005e7, File: file1C, Line: 6, IsStmt: true}, - {Address: 0x4005eb, File: file1C, Line: 7, IsStmt: true}, - {Address: 0x4005f5, File: file1C, Line: 8, IsStmt: true}, - {Address: 0x4005ff, File: file1C, Line: 9, IsStmt: true}, - {Address: 0x400601, EndSequence: true}, - - {Address: 0x400601, File: file2C, Line: 4, IsStmt: true}, - {Address: 0x400605, File: file2C, Line: 5, IsStmt: true}, - {Address: 0x40060f, File: file2C, Line: 6, IsStmt: true}, - {Address: 0x400611, EndSequence: true}, - } - - testLineTable(t, want, elfData(t, "testdata/line-gcc.elf")) -} - -func TestLineELFClang(t *testing.T) { - // Generated by: - // # clang --version | head -n1 - // Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4) - // # clang -g -o line-clang.elf line*. - - want := []LineEntry{ - {Address: 0x400530, File: file1C, Line: 6, IsStmt: true}, - {Address: 0x400534, File: file1C, Line: 7, IsStmt: true, PrologueEnd: true}, - {Address: 0x400539, File: file1C, Line: 8, IsStmt: true}, - {Address: 0x400545, File: file1C, Line: 9, IsStmt: true}, - {Address: 0x400550, File: file1H, Line: 2, IsStmt: true}, - {Address: 0x400554, File: file1H, Line: 5, IsStmt: true, PrologueEnd: true}, - {Address: 0x400568, File: file1H, Line: 6, IsStmt: true}, - {Address: 0x400571, File: file1H, Line: 5, IsStmt: true}, - {Address: 0x400581, File: file1H, Line: 7, IsStmt: true}, - {Address: 0x400583, EndSequence: true}, - - {Address: 0x400590, File: file2C, Line: 4, IsStmt: true}, - {Address: 0x4005a0, File: file2C, Line: 5, IsStmt: true, PrologueEnd: true}, - {Address: 0x4005a7, File: file2C, Line: 6, IsStmt: true}, - {Address: 0x4005b0, EndSequence: true}, - } - - testLineTable(t, want, elfData(t, "testdata/line-clang.elf")) -} - -func TestLineSeek(t *testing.T) { - d := elfData(t, "testdata/line-gcc.elf") - - // Get the line table for the first CU. - cu, err := d.Reader().Next() - if err != nil { - t.Fatal("d.Reader().Next:", err) - } - lr, err := d.LineReader(cu) - if err != nil { - t.Fatal("d.LineReader:", err) - } - - // Read entries forward. - var line LineEntry - var posTable []LineReaderPos - var table []LineEntry - for { - posTable = append(posTable, lr.Tell()) - - err := lr.Next(&line) - if err != nil { - if err == io.EOF { - break - } - t.Fatal("lr.Next:", err) - } - table = append(table, line) - } - - // Test that Reset returns to the first line. - lr.Reset() - if err := lr.Next(&line); err != nil { - t.Fatal("lr.Next after Reset failed:", err) - } else if line != table[0] { - t.Fatal("lr.Next after Reset returned", line, "instead of", table[0]) - } - - // Check that entries match when seeking backward. - for i := len(posTable) - 1; i >= 0; i-- { - lr.Seek(posTable[i]) - err := lr.Next(&line) - if i == len(posTable)-1 { - if err != io.EOF { - t.Fatal("expected io.EOF after seek to end, got", err) - } - } else if err != nil { - t.Fatal("lr.Next after seek to", posTable[i], "failed:", err) - } else if line != table[i] { - t.Fatal("lr.Next after seek to", posTable[i], "returned", line, "instead of", table[i]) - } - } - - // Check that seeking to a PC returns the right line. - if err := lr.SeekPC(table[0].Address-1, &line); err != ErrUnknownPC { - t.Fatalf("lr.SeekPC to %#x returned %v instead of ErrUnknownPC", table[0].Address-1, err) - } - for i, testLine := range table { - if testLine.EndSequence { - if err := lr.SeekPC(testLine.Address, &line); err != ErrUnknownPC { - t.Fatalf("lr.SeekPC to %#x returned %v instead of ErrUnknownPC", testLine.Address, err) - } - continue - } - - nextPC := table[i+1].Address - for pc := testLine.Address; pc < nextPC; pc++ { - if err := lr.SeekPC(pc, &line); err != nil { - t.Fatalf("lr.SeekPC to %#x failed: %v", pc, err) - } else if line != testLine { - t.Fatalf("lr.SeekPC to %#x returned %v instead of %v", pc, line, testLine) - } - } - } -} - -func testLineTable(t *testing.T, want []LineEntry, d *Data) { - // Get line table from d. - var got []LineEntry - dr := d.Reader() - for { - ent, err := dr.Next() - if err != nil { - t.Fatal("dr.Next:", err) - } else if ent == nil { - break - } - - if ent.Tag != TagCompileUnit { - dr.SkipChildren() - continue - } - - // Decode CU's line table. - lr, err := d.LineReader(ent) - if err != nil { - t.Fatal("d.LineReader:", err) - } else if lr == nil { - continue - } - - for { - var line LineEntry - err := lr.Next(&line) - if err != nil { - if err == io.EOF { - break - } - t.Fatal("lr.Next:", err) - } - got = append(got, line) - } - } - - // Compare line tables. - if !compareLines(got, want) { - t.Log("Line tables do not match. Got:") - dumpLines(t, got) - t.Log("Want:") - dumpLines(t, want) - t.FailNow() - } -} - -func compareLines(a, b []LineEntry) bool { - if len(a) != len(b) { - return false - } - - for i := range a { - al, bl := a[i], b[i] - // If both are EndSequence, then the only other valid - // field is Address. Otherwise, test equality of all - // fields. - if al.EndSequence && bl.EndSequence && al.Address == bl.Address { - continue - } - if al.File.Name != bl.File.Name { - return false - } - al.File = nil - bl.File = nil - if al != bl { - return false - } - } - return true -} - -func dumpLines(t *testing.T, lines []LineEntry) { - for _, l := range lines { - t.Logf(" %+v File:%+v", l, l.File) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/open.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/open.go deleted file mode 100644 index c1b3f37aca9618ebbf5aa1f07eb691abeba9cfaa..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/open.go +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package dwarf provides access to DWARF debugging information loaded from -// executable files, as defined in the DWARF 2.0 Standard at -// http://dwarfstd.org/doc/dwarf-2.0.0.pdf -package dwarf - -import "encoding/binary" - -// Data represents the DWARF debugging information -// loaded from an executable file (for example, an ELF or Mach-O executable). -type Data struct { - // raw data - abbrev []byte - aranges []byte - frame []byte - info []byte - line []byte - pubnames []byte - ranges []byte - str []byte - - // parsed data - abbrevCache map[uint32]abbrevTable - order binary.ByteOrder - typeCache map[Offset]Type - typeSigs map[uint64]*typeUnit - unit []unit -} - -// New returns a new Data object initialized from the given parameters. -// Rather than calling this function directly, clients should typically use -// the DWARF method of the File type of the appropriate package debug/elf, -// debug/macho, or debug/pe. -// -// The []byte arguments are the data from the corresponding debug section -// in the object file; for example, for an ELF object, abbrev is the contents of -// the ".debug_abbrev" section. -func New(abbrev, aranges, frame, info, line, pubnames, ranges, str []byte) (*Data, error) { - d := &Data{ - abbrev: abbrev, - aranges: aranges, - frame: frame, - info: info, - line: line, - pubnames: pubnames, - ranges: ranges, - str: str, - abbrevCache: make(map[uint32]abbrevTable), - typeCache: make(map[Offset]Type), - typeSigs: make(map[uint64]*typeUnit), - } - - // Sniff .debug_info to figure out byte order. - // bytes 4:6 are the version, a tiny 16-bit number (1, 2, 3). - if len(d.info) < 6 { - return nil, DecodeError{"info", Offset(len(d.info)), "too short"} - } - x, y := d.info[4], d.info[5] - switch { - case x == 0 && y == 0: - return nil, DecodeError{"info", 4, "unsupported version 0"} - case x == 0: - d.order = binary.BigEndian - case y == 0: - d.order = binary.LittleEndian - default: - return nil, DecodeError{"info", 4, "cannot determine byte order"} - } - - u, err := d.parseUnits() - if err != nil { - return nil, err - } - d.unit = u - return d, nil -} - -// AddTypes will add one .debug_types section to the DWARF data. A -// typical object with DWARF version 4 debug info will have multiple -// .debug_types sections. The name is used for error reporting only, -// and serves to distinguish one .debug_types section from another. -func (d *Data) AddTypes(name string, types []byte) error { - return d.parseTypes(name, types) -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-clang.elf b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-clang.elf deleted file mode 100755 index b63cc781c410a53840c001af944e6292935ce3ff..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-clang.elf and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-gcc.elf b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-gcc.elf deleted file mode 100755 index 50500a8eecd95ee18ac78e130e12eef10c4aaf55..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line-gcc.elf and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.c b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.c deleted file mode 100644 index f35864776caf0bbf7b971b69f72cfef08dba91ee..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "line1.h" - -void f2(); - -int main() -{ - f1(); - f2(); -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.h b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.h deleted file mode 100644 index 974d4c881778482a760d68b2f197c7a91b565126..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line1.h +++ /dev/null @@ -1,7 +0,0 @@ -static void f1() -{ - char buf[10]; - int i; - for(i = 0; i < 10; i++) - buf[i] = 1; -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line2.c b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line2.c deleted file mode 100644 index 38d89983cbb2433f398e26b09aae09b24961988b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/line2.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void f2() -{ - printf("hello\n"); -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.c b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.c deleted file mode 100644 index f05f01564ff8c5f090b8c1bad1ce638bf2f475ef..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.c +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Linux ELF: -gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o - -OS X Mach-O: -gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho -*/ -#include - -typedef volatile int* t_ptr_volatile_int; -typedef const char *t_ptr_const_char; -typedef long t_long; -typedef unsigned short t_ushort; -typedef int t_func_int_of_float_double(float, double); -typedef int (*t_ptr_func_int_of_float_double)(float, double); -typedef int (*t_ptr_func_int_of_float_complex)(float complex); -typedef int (*t_ptr_func_int_of_double_complex)(double complex); -typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex); -typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char); -typedef void t_func_void_of_char(char); -typedef void t_func_void_of_void(void); -typedef void t_func_void_of_ptr_char_dots(char*, ...); -typedef struct my_struct { - volatile int vi; - char x : 1; - int y : 4; - int z[0]; - long long array[40]; - int zz[0]; -} t_my_struct; -typedef struct my_struct1 { - int zz [1]; -} t_my_struct1; -typedef union my_union { - volatile int vi; - char x : 1; - int y : 4; - long long array[40]; -} t_my_union; -typedef enum my_enum { - e1 = 1, - e2 = 2, - e3 = -5, - e4 = 1000000000000000LL, -} t_my_enum; - -typedef struct list t_my_list; -struct list { - short val; - t_my_list *next; -}; - -typedef struct tree { - struct tree *left, *right; - unsigned long long val; -} t_my_tree; - -t_ptr_volatile_int *a2; -t_ptr_const_char **a3a; -t_long *a4; -t_ushort *a5; -t_func_int_of_float_double *a6; -t_ptr_func_int_of_float_double *a7; -t_func_ptr_int_of_char_schar_uchar *a8; -t_func_void_of_char *a9; -t_func_void_of_void *a10; -t_func_void_of_ptr_char_dots *a11; -t_my_struct *a12; -t_my_struct1 *a12a; -t_my_union *a12b; -t_my_enum *a13; -t_my_list *a14; -t_my_tree *a15; -t_ptr_func_int_of_float_complex *a16; -t_ptr_func_int_of_double_complex *a17; -t_ptr_func_int_of_long_double_complex *a18; - -int main() -{ - return 0; -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf deleted file mode 100755 index b2062d2c4bb828dcb229f12869f77fd5d9522278..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf4 b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf4 deleted file mode 100644 index 3d5a5a1b1620badce20ec4ea8c630f3bfd58c4d2..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.elf4 and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.macho b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.macho deleted file mode 100644 index f75afcccbfc852d284a33c01a49eb1035b6dae9c..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/testdata/typedef.macho and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type.go deleted file mode 100644 index a5daa1d0bb18e6e48b640ef5c4e87568a5f1709c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type.go +++ /dev/null @@ -1,706 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// DWARF type information structures. -// The format is heavily biased toward C, but for simplicity -// the String methods use a pseudo-Go syntax. - -package dwarf - -import "strconv" - -// A Type conventionally represents a pointer to any of the -// specific Type structures (CharType, StructType, etc.). -type Type interface { - Common() *CommonType - String() string - Size() int64 -} - -// A CommonType holds fields common to multiple types. -// If a field is not known or not applicable for a given type, -// the zero value is used. -type CommonType struct { - ByteSize int64 // size of value of this type, in bytes - Name string // name that can be used to refer to type -} - -func (c *CommonType) Common() *CommonType { return c } - -func (c *CommonType) Size() int64 { return c.ByteSize } - -// Basic types - -// A BasicType holds fields common to all basic types. -type BasicType struct { - CommonType - BitSize int64 - BitOffset int64 -} - -func (b *BasicType) Basic() *BasicType { return b } - -func (t *BasicType) String() string { - if t.Name != "" { - return t.Name - } - return "?" -} - -// A CharType represents a signed character type. -type CharType struct { - BasicType -} - -// A UcharType represents an unsigned character type. -type UcharType struct { - BasicType -} - -// An IntType represents a signed integer type. -type IntType struct { - BasicType -} - -// A UintType represents an unsigned integer type. -type UintType struct { - BasicType -} - -// A FloatType represents a floating point type. -type FloatType struct { - BasicType -} - -// A ComplexType represents a complex floating point type. -type ComplexType struct { - BasicType -} - -// A BoolType represents a boolean type. -type BoolType struct { - BasicType -} - -// An AddrType represents a machine address type. -type AddrType struct { - BasicType -} - -// An UnspecifiedType represents an implicit, unknown, ambiguous or nonexistent type. -type UnspecifiedType struct { - BasicType -} - -// qualifiers - -// A QualType represents a type that has the C/C++ "const", "restrict", or "volatile" qualifier. -type QualType struct { - CommonType - Qual string - Type Type -} - -func (t *QualType) String() string { return t.Qual + " " + t.Type.String() } - -func (t *QualType) Size() int64 { return t.Type.Size() } - -// An ArrayType represents a fixed size array type. -type ArrayType struct { - CommonType - Type Type - StrideBitSize int64 // if > 0, number of bits to hold each element - Count int64 // if == -1, an incomplete array, like char x[]. -} - -func (t *ArrayType) String() string { - return "[" + strconv.FormatInt(t.Count, 10) + "]" + t.Type.String() -} - -func (t *ArrayType) Size() int64 { - if t.Count == -1 { - return 0 - } - return t.Count * t.Type.Size() -} - -// A VoidType represents the C void type. -type VoidType struct { - CommonType -} - -func (t *VoidType) String() string { return "void" } - -// A PtrType represents a pointer type. -type PtrType struct { - CommonType - Type Type -} - -func (t *PtrType) String() string { return "*" + t.Type.String() } - -// A StructType represents a struct, union, or C++ class type. -type StructType struct { - CommonType - StructName string - Kind string // "struct", "union", or "class". - Field []*StructField - Incomplete bool // if true, struct, union, class is declared but not defined -} - -// A StructField represents a field in a struct, union, or C++ class type. -type StructField struct { - Name string - Type Type - ByteOffset int64 - ByteSize int64 - BitOffset int64 // within the ByteSize bytes at ByteOffset - BitSize int64 // zero if not a bit field -} - -func (t *StructType) String() string { - if t.StructName != "" { - return t.Kind + " " + t.StructName - } - return t.Defn() -} - -func (t *StructType) Defn() string { - s := t.Kind - if t.StructName != "" { - s += " " + t.StructName - } - if t.Incomplete { - s += " /*incomplete*/" - return s - } - s += " {" - for i, f := range t.Field { - if i > 0 { - s += "; " - } - s += f.Name + " " + f.Type.String() - s += "@" + strconv.FormatInt(f.ByteOffset, 10) - if f.BitSize > 0 { - s += " : " + strconv.FormatInt(f.BitSize, 10) - s += "@" + strconv.FormatInt(f.BitOffset, 10) - } - } - s += "}" - return s -} - -// An EnumType represents an enumerated type. -// The only indication of its native integer type is its ByteSize -// (inside CommonType). -type EnumType struct { - CommonType - EnumName string - Val []*EnumValue -} - -// An EnumValue represents a single enumeration value. -type EnumValue struct { - Name string - Val int64 -} - -func (t *EnumType) String() string { - s := "enum" - if t.EnumName != "" { - s += " " + t.EnumName - } - s += " {" - for i, v := range t.Val { - if i > 0 { - s += "; " - } - s += v.Name + "=" + strconv.FormatInt(v.Val, 10) - } - s += "}" - return s -} - -// A FuncType represents a function type. -type FuncType struct { - CommonType - ReturnType Type - ParamType []Type -} - -func (t *FuncType) String() string { - s := "func(" - for i, t := range t.ParamType { - if i > 0 { - s += ", " - } - s += t.String() - } - s += ")" - if t.ReturnType != nil { - s += " " + t.ReturnType.String() - } - return s -} - -// A DotDotDotType represents the variadic ... function parameter. -type DotDotDotType struct { - CommonType -} - -func (t *DotDotDotType) String() string { return "..." } - -// A TypedefType represents a named type. -type TypedefType struct { - CommonType - Type Type -} - -func (t *TypedefType) String() string { return t.Name } - -func (t *TypedefType) Size() int64 { return t.Type.Size() } - -// typeReader is used to read from either the info section or the -// types section. -type typeReader interface { - Seek(Offset) - Next() (*Entry, error) - clone() typeReader - offset() Offset - // AddressSize returns the size in bytes of addresses in the current - // compilation unit. - AddressSize() int -} - -// Type reads the type at off in the DWARF ``info'' section. -func (d *Data) Type(off Offset) (Type, error) { - return d.readType("info", d.Reader(), off, d.typeCache) -} - -// readType reads a type from r at off of name using and updating a -// type cache. -func (d *Data) readType(name string, r typeReader, off Offset, typeCache map[Offset]Type) (Type, error) { - if t, ok := typeCache[off]; ok { - return t, nil - } - r.Seek(off) - e, err := r.Next() - if err != nil { - return nil, err - } - addressSize := r.AddressSize() - if e == nil || e.Offset != off { - return nil, DecodeError{name, off, "no type at offset"} - } - - // Parse type from Entry. - // Must always set typeCache[off] before calling - // d.Type recursively, to handle circular types correctly. - var typ Type - - nextDepth := 0 - - // Get next child; set err if error happens. - next := func() *Entry { - if !e.Children { - return nil - } - // Only return direct children. - // Skip over composite entries that happen to be nested - // inside this one. Most DWARF generators wouldn't generate - // such a thing, but clang does. - // See golang.org/issue/6472. - for { - kid, err1 := r.Next() - if err1 != nil { - err = err1 - return nil - } - if kid == nil { - err = DecodeError{name, r.offset(), "unexpected end of DWARF entries"} - return nil - } - if kid.Tag == 0 { - if nextDepth > 0 { - nextDepth-- - continue - } - return nil - } - if kid.Children { - nextDepth++ - } - if nextDepth > 0 { - continue - } - return kid - } - } - - // Get Type referred to by Entry's AttrType field. - // Set err if error happens. Not having a type is an error. - typeOf := func(e *Entry) Type { - tval := e.Val(AttrType) - var t Type - switch toff := tval.(type) { - case Offset: - if t, err = d.readType(name, r.clone(), toff, typeCache); err != nil { - return nil - } - case uint64: - if t, err = d.sigToType(toff); err != nil { - return nil - } - default: - // It appears that no Type means "void". - return new(VoidType) - } - return t - } - - switch e.Tag { - case TagArrayType: - // Multi-dimensional array. (DWARF v2 §5.4) - // Attributes: - // AttrType:subtype [required] - // AttrStrideSize: size in bits of each element of the array - // AttrByteSize: size of entire array - // Children: - // TagSubrangeType or TagEnumerationType giving one dimension. - // dimensions are in left to right order. - t := new(ArrayType) - typ = t - typeCache[off] = t - if t.Type = typeOf(e); err != nil { - goto Error - } - t.StrideBitSize, _ = e.Val(AttrStrideSize).(int64) - - // Accumulate dimensions, - var dims []int64 - for kid := next(); kid != nil; kid = next() { - // TODO(rsc): Can also be TagEnumerationType - // but haven't seen that in the wild yet. - switch kid.Tag { - case TagSubrangeType: - count, ok := kid.Val(AttrCount).(int64) - if !ok { - // Old binaries may have an upper bound instead. - count, ok = kid.Val(AttrUpperBound).(int64) - if ok { - count++ // Length is one more than upper bound. - } else if len(dims) == 0 { - count = -1 // As in x[]. - } - } - dims = append(dims, count) - case TagEnumerationType: - err = DecodeError{name, kid.Offset, "cannot handle enumeration type as array bound"} - goto Error - } - } - if len(dims) == 0 { - // LLVM generates this for x[]. - dims = []int64{-1} - } - - t.Count = dims[0] - for i := len(dims) - 1; i >= 1; i-- { - t.Type = &ArrayType{Type: t.Type, Count: dims[i]} - } - - case TagBaseType: - // Basic type. (DWARF v2 §5.1) - // Attributes: - // AttrName: name of base type in programming language of the compilation unit [required] - // AttrEncoding: encoding value for type (encFloat etc) [required] - // AttrByteSize: size of type in bytes [required] - // AttrBitOffset: for sub-byte types, size in bits - // AttrBitSize: for sub-byte types, bit offset of high order bit in the AttrByteSize bytes - name, _ := e.Val(AttrName).(string) - enc, ok := e.Val(AttrEncoding).(int64) - if !ok { - err = DecodeError{name, e.Offset, "missing encoding attribute for " + name} - goto Error - } - switch enc { - default: - err = DecodeError{name, e.Offset, "unrecognized encoding attribute value"} - goto Error - - case encAddress: - typ = new(AddrType) - case encBoolean: - typ = new(BoolType) - case encComplexFloat: - typ = new(ComplexType) - if name == "complex" { - // clang writes out 'complex' instead of 'complex float' or 'complex double'. - // clang also writes out a byte size that we can use to distinguish. - // See issue 8694. - switch byteSize, _ := e.Val(AttrByteSize).(int64); byteSize { - case 8: - name = "complex float" - case 16: - name = "complex double" - } - } - case encFloat: - typ = new(FloatType) - case encSigned: - typ = new(IntType) - case encUnsigned: - typ = new(UintType) - case encSignedChar: - typ = new(CharType) - case encUnsignedChar: - typ = new(UcharType) - } - typeCache[off] = typ - t := typ.(interface { - Basic() *BasicType - }).Basic() - t.Name = name - t.BitSize, _ = e.Val(AttrBitSize).(int64) - t.BitOffset, _ = e.Val(AttrBitOffset).(int64) - - case TagClassType, TagStructType, TagUnionType: - // Structure, union, or class type. (DWARF v2 §5.5) - // Attributes: - // AttrName: name of struct, union, or class - // AttrByteSize: byte size [required] - // AttrDeclaration: if true, struct/union/class is incomplete - // Children: - // TagMember to describe one member. - // AttrName: name of member [required] - // AttrType: type of member [required] - // AttrByteSize: size in bytes - // AttrBitOffset: bit offset within bytes for bit fields - // AttrBitSize: bit size for bit fields - // AttrDataMemberLoc: location within struct [required for struct, class] - // There is much more to handle C++, all ignored for now. - t := new(StructType) - typ = t - typeCache[off] = t - switch e.Tag { - case TagClassType: - t.Kind = "class" - case TagStructType: - t.Kind = "struct" - case TagUnionType: - t.Kind = "union" - } - t.StructName, _ = e.Val(AttrName).(string) - t.Incomplete = e.Val(AttrDeclaration) != nil - t.Field = make([]*StructField, 0, 8) - var lastFieldType *Type - var lastFieldBitOffset int64 - for kid := next(); kid != nil; kid = next() { - if kid.Tag == TagMember { - f := new(StructField) - if f.Type = typeOf(kid); err != nil { - goto Error - } - switch loc := kid.Val(AttrDataMemberLoc).(type) { - case []byte: - // TODO: Should have original compilation - // unit here, not unknownFormat. - b := makeBuf(d, unknownFormat{}, "location", 0, loc) - if b.uint8() != opPlusUconst { - err = DecodeError{name, kid.Offset, "unexpected opcode"} - goto Error - } - f.ByteOffset = int64(b.uint()) - if b.err != nil { - err = b.err - goto Error - } - case int64: - f.ByteOffset = loc - } - - haveBitOffset := false - f.Name, _ = kid.Val(AttrName).(string) - f.ByteSize, _ = kid.Val(AttrByteSize).(int64) - f.BitOffset, haveBitOffset = kid.Val(AttrBitOffset).(int64) - f.BitSize, _ = kid.Val(AttrBitSize).(int64) - t.Field = append(t.Field, f) - - bito := f.BitOffset - if !haveBitOffset { - bito = f.ByteOffset * 8 - } - if bito == lastFieldBitOffset && t.Kind != "union" { - // Last field was zero width. Fix array length. - // (DWARF writes out 0-length arrays as if they were 1-length arrays.) - zeroArray(lastFieldType) - } - lastFieldType = &f.Type - lastFieldBitOffset = bito - } - } - if t.Kind != "union" { - b, ok := e.Val(AttrByteSize).(int64) - if ok && b*8 == lastFieldBitOffset { - // Final field must be zero width. Fix array length. - zeroArray(lastFieldType) - } - } - - case TagConstType, TagVolatileType, TagRestrictType: - // Type modifier (DWARF v2 §5.2) - // Attributes: - // AttrType: subtype - t := new(QualType) - typ = t - typeCache[off] = t - if t.Type = typeOf(e); err != nil { - goto Error - } - switch e.Tag { - case TagConstType: - t.Qual = "const" - case TagRestrictType: - t.Qual = "restrict" - case TagVolatileType: - t.Qual = "volatile" - } - - case TagEnumerationType: - // Enumeration type (DWARF v2 §5.6) - // Attributes: - // AttrName: enum name if any - // AttrByteSize: bytes required to represent largest value - // Children: - // TagEnumerator: - // AttrName: name of constant - // AttrConstValue: value of constant - t := new(EnumType) - typ = t - typeCache[off] = t - t.EnumName, _ = e.Val(AttrName).(string) - t.Val = make([]*EnumValue, 0, 8) - for kid := next(); kid != nil; kid = next() { - if kid.Tag == TagEnumerator { - f := new(EnumValue) - f.Name, _ = kid.Val(AttrName).(string) - f.Val, _ = kid.Val(AttrConstValue).(int64) - n := len(t.Val) - if n >= cap(t.Val) { - val := make([]*EnumValue, n, n*2) - copy(val, t.Val) - t.Val = val - } - t.Val = t.Val[0 : n+1] - t.Val[n] = f - } - } - - case TagPointerType: - // Type modifier (DWARF v2 §5.2) - // Attributes: - // AttrType: subtype [not required! void* has no AttrType] - // AttrAddrClass: address class [ignored] - t := new(PtrType) - typ = t - typeCache[off] = t - if e.Val(AttrType) == nil { - t.Type = &VoidType{} - break - } - t.Type = typeOf(e) - - case TagSubroutineType: - // Subroutine type. (DWARF v2 §5.7) - // Attributes: - // AttrType: type of return value if any - // AttrName: possible name of type [ignored] - // AttrPrototyped: whether used ANSI C prototype [ignored] - // Children: - // TagFormalParameter: typed parameter - // AttrType: type of parameter - // TagUnspecifiedParameter: final ... - t := new(FuncType) - typ = t - typeCache[off] = t - if t.ReturnType = typeOf(e); err != nil { - goto Error - } - t.ParamType = make([]Type, 0, 8) - for kid := next(); kid != nil; kid = next() { - var tkid Type - switch kid.Tag { - default: - continue - case TagFormalParameter: - if tkid = typeOf(kid); err != nil { - goto Error - } - case TagUnspecifiedParameters: - tkid = &DotDotDotType{} - } - t.ParamType = append(t.ParamType, tkid) - } - - case TagTypedef: - // Typedef (DWARF v2 §5.3) - // Attributes: - // AttrName: name [required] - // AttrType: type definition [required] - t := new(TypedefType) - typ = t - typeCache[off] = t - t.Name, _ = e.Val(AttrName).(string) - t.Type = typeOf(e) - - case TagUnspecifiedType: - // Unspecified type (DWARF v3 §5.2) - // Attributes: - // AttrName: name - t := new(UnspecifiedType) - typ = t - typeCache[off] = t - t.Name, _ = e.Val(AttrName).(string) - } - - if err != nil { - goto Error - } - - { - b, ok := e.Val(AttrByteSize).(int64) - if !ok { - b = -1 - switch t := typ.(type) { - case *TypedefType: - b = t.Type.Size() - case *PtrType: - b = int64(addressSize) - } - } - typ.Common().ByteSize = b - } - return typ, nil - -Error: - // If the parse fails, take the type out of the cache - // so that the next call with this offset doesn't hit - // the cache and return success. - delete(typeCache, off) - return nil, err -} - -func zeroArray(t *Type) { - if t == nil { - return - } - at, ok := (*t).(*ArrayType) - if !ok || at.Type.Size() == 0 { - return - } - // Make a copy to avoid invalidating typeCache. - tt := *at - tt.Count = 0 - *t = &tt -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type_test.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type_test.go deleted file mode 100644 index 2cb85e74bb23a76a81817f6bdafd0b327a838c43..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/type_test.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dwarf_test - -import ( - . "debug/dwarf" - "debug/elf" - "debug/macho" - "testing" -) - -var typedefTests = map[string]string{ - "t_ptr_volatile_int": "*volatile int", - "t_ptr_const_char": "*const char", - "t_long": "long int", - "t_ushort": "short unsigned int", - "t_func_int_of_float_double": "func(float, double) int", - "t_ptr_func_int_of_float_double": "*func(float, double) int", - "t_ptr_func_int_of_float_complex": "*func(complex float) int", - "t_ptr_func_int_of_double_complex": "*func(complex double) int", - "t_ptr_func_int_of_long_double_complex": "*func(complex long double) int", - "t_func_ptr_int_of_char_schar_uchar": "func(char, signed char, unsigned char) *int", - "t_func_void_of_char": "func(char) void", - "t_func_void_of_void": "func() void", - "t_func_void_of_ptr_char_dots": "func(*char, ...) void", - "t_my_struct": "struct my_struct {vi volatile int@0; x char@4 : 1@7; y int@4 : 4@27; z [0]int@8; array [40]long long int@8; zz [0]int@328}", - "t_my_struct1": "struct my_struct1 {zz [1]int@0}", - "t_my_union": "union my_union {vi volatile int@0; x char@0 : 1@7; y int@0 : 4@28; array [40]long long int@0}", - "t_my_enum": "enum my_enum {e1=1; e2=2; e3=-5; e4=1000000000000000}", - "t_my_list": "struct list {val short int@0; next *t_my_list@8}", - "t_my_tree": "struct tree {left *struct tree@0; right *struct tree@8; val long long unsigned int@16}", -} - -// As Apple converts gcc to a clang-based front end -// they keep breaking the DWARF output. This map lists the -// conversion from real answer to Apple answer. -var machoBug = map[string]string{ - "func(*char, ...) void": "func(*char) void", - "enum my_enum {e1=1; e2=2; e3=-5; e4=1000000000000000}": "enum my_enum {e1=1; e2=2; e3=-5; e4=-1530494976}", -} - -func elfData(t *testing.T, name string) *Data { - f, err := elf.Open(name) - if err != nil { - t.Fatal(err) - } - - d, err := f.DWARF() - if err != nil { - t.Fatal(err) - } - return d -} - -func machoData(t *testing.T, name string) *Data { - f, err := macho.Open(name) - if err != nil { - t.Fatal(err) - } - - d, err := f.DWARF() - if err != nil { - t.Fatal(err) - } - return d -} - -func TestTypedefsELF(t *testing.T) { testTypedefs(t, elfData(t, "testdata/typedef.elf"), "elf") } - -func TestTypedefsMachO(t *testing.T) { - testTypedefs(t, machoData(t, "testdata/typedef.macho"), "macho") -} - -func TestTypedefsELFDwarf4(t *testing.T) { testTypedefs(t, elfData(t, "testdata/typedef.elf4"), "elf") } - -func testTypedefs(t *testing.T, d *Data, kind string) { - r := d.Reader() - seen := make(map[string]bool) - for { - e, err := r.Next() - if err != nil { - t.Fatal("r.Next:", err) - } - if e == nil { - break - } - if e.Tag == TagTypedef { - typ, err := d.Type(e.Offset) - if err != nil { - t.Fatal("d.Type:", err) - } - t1 := typ.(*TypedefType) - var typstr string - if ts, ok := t1.Type.(*StructType); ok { - typstr = ts.Defn() - } else { - typstr = t1.Type.String() - } - - if want, ok := typedefTests[t1.Name]; ok { - if seen[t1.Name] { - t.Errorf("multiple definitions for %s", t1.Name) - } - seen[t1.Name] = true - if typstr != want && (kind != "macho" || typstr != machoBug[want]) { - t.Errorf("%s:\n\thave %s\n\twant %s", t1.Name, typstr, want) - } - } - } - if e.Tag != TagCompileUnit { - r.SkipChildren() - } - } - - for k := range typedefTests { - if !seen[k] { - t.Errorf("missing %s", k) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/typeunit.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/typeunit.go deleted file mode 100644 index 9cfb4a8b256d312da316f6132d4684d3ca849e35..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/typeunit.go +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dwarf - -import ( - "fmt" - "strconv" -) - -// Parse the type units stored in a DWARF4 .debug_types section. Each -// type unit defines a single primary type and an 8-byte signature. -// Other sections may then use formRefSig8 to refer to the type. - -// The typeUnit format is a single type with a signature. It holds -// the same data as a compilation unit. -type typeUnit struct { - unit - toff Offset // Offset to signature type within data. - name string // Name of .debug_type section. - cache Type // Cache the type, nil to start. -} - -// Parse a .debug_types section. -func (d *Data) parseTypes(name string, types []byte) error { - b := makeBuf(d, unknownFormat{}, name, 0, types) - for len(b.data) > 0 { - base := b.off - n, dwarf64 := b.unitLength() - if n != Offset(uint32(n)) { - b.error("type unit length overflow") - return b.err - } - hdroff := b.off - vers := int(b.uint16()) - if vers != 4 { - b.error("unsupported DWARF version " + strconv.Itoa(vers)) - return b.err - } - var ao uint32 - if !dwarf64 { - ao = b.uint32() - } else { - ao64 := b.uint64() - if ao64 != uint64(uint32(ao64)) { - b.error("type unit abbrev offset overflow") - return b.err - } - ao = uint32(ao64) - } - atable, err := d.parseAbbrev(ao, vers) - if err != nil { - return err - } - asize := b.uint8() - sig := b.uint64() - - var toff uint32 - if !dwarf64 { - toff = b.uint32() - } else { - to64 := b.uint64() - if to64 != uint64(uint32(to64)) { - b.error("type unit type offset overflow") - return b.err - } - toff = uint32(to64) - } - - boff := b.off - d.typeSigs[sig] = &typeUnit{ - unit: unit{ - base: base, - off: boff, - data: b.bytes(int(n - (b.off - hdroff))), - atable: atable, - asize: int(asize), - vers: int(vers), - is64: dwarf64, - }, - toff: Offset(toff), - name: name, - } - if b.err != nil { - return b.err - } - } - return nil -} - -// Return the type for a type signature. -func (d *Data) sigToType(sig uint64) (Type, error) { - tu := d.typeSigs[sig] - if tu == nil { - return nil, fmt.Errorf("no type unit with signature %v", sig) - } - if tu.cache != nil { - return tu.cache, nil - } - - b := makeBuf(d, tu, tu.name, tu.off, tu.data) - r := &typeUnitReader{d: d, tu: tu, b: b} - t, err := d.readType(tu.name, r, Offset(tu.toff), make(map[Offset]Type)) - if err != nil { - return nil, err - } - - tu.cache = t - return t, nil -} - -// typeUnitReader is a typeReader for a tagTypeUnit. -type typeUnitReader struct { - d *Data - tu *typeUnit - b buf - err error -} - -// Seek to a new position in the type unit. -func (tur *typeUnitReader) Seek(off Offset) { - tur.err = nil - doff := off - tur.tu.off - if doff < 0 || doff >= Offset(len(tur.tu.data)) { - tur.err = fmt.Errorf("%s: offset %d out of range; max %d", tur.tu.name, doff, len(tur.tu.data)) - return - } - tur.b = makeBuf(tur.d, tur.tu, tur.tu.name, off, tur.tu.data[doff:]) -} - -// AddressSize returns the size in bytes of addresses in the current type unit. -func (tur *typeUnitReader) AddressSize() int { - return tur.tu.unit.asize -} - -// Next reads the next Entry from the type unit. -func (tur *typeUnitReader) Next() (*Entry, error) { - if tur.err != nil { - return nil, tur.err - } - if len(tur.tu.data) == 0 { - return nil, nil - } - e := tur.b.entry(tur.tu.atable, tur.tu.base) - if tur.b.err != nil { - tur.err = tur.b.err - return nil, tur.err - } - return e, nil -} - -// clone returns a new reader for the type unit. -func (tur *typeUnitReader) clone() typeReader { - return &typeUnitReader{ - d: tur.d, - tu: tur.tu, - b: makeBuf(tur.d, tur.tu, tur.tu.name, tur.tu.off, tur.tu.data), - } -} - -// offset returns the current offset. -func (tur *typeUnitReader) offset() Offset { - return tur.b.off -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/unit.go b/llgo/third_party/gofrontend/libgo/go/debug/dwarf/unit.go deleted file mode 100644 index ceb6cdbff321933cd10f06c5c174070fc7344fd3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/dwarf/unit.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package dwarf - -import ( - "sort" - "strconv" -) - -// DWARF debug info is split into a sequence of compilation units. -// Each unit has its own abbreviation table and address size. - -type unit struct { - base Offset // byte offset of header within the aggregate info - off Offset // byte offset of data within the aggregate info - data []byte - atable abbrevTable - asize int - vers int - is64 bool // True for 64-bit DWARF format -} - -// Implement the dataFormat interface. - -func (u *unit) version() int { - return u.vers -} - -func (u *unit) dwarf64() (bool, bool) { - return u.is64, true -} - -func (u *unit) addrsize() int { - return u.asize -} - -func (d *Data) parseUnits() ([]unit, error) { - // Count units. - nunit := 0 - b := makeBuf(d, unknownFormat{}, "info", 0, d.info) - for len(b.data) > 0 { - len, _ := b.unitLength() - if len != Offset(uint32(len)) { - b.error("unit length overflow") - break - } - b.skip(int(len)) - nunit++ - } - if b.err != nil { - return nil, b.err - } - - // Again, this time writing them down. - b = makeBuf(d, unknownFormat{}, "info", 0, d.info) - units := make([]unit, nunit) - for i := range units { - u := &units[i] - u.base = b.off - var n Offset - n, u.is64 = b.unitLength() - vers := b.uint16() - if vers != 2 && vers != 3 && vers != 4 { - b.error("unsupported DWARF version " + strconv.Itoa(int(vers))) - break - } - u.vers = int(vers) - atable, err := d.parseAbbrev(b.uint32(), u.vers) - if err != nil { - if b.err == nil { - b.err = err - } - break - } - u.atable = atable - u.asize = int(b.uint8()) - u.off = b.off - u.data = b.bytes(int(n - (2 + 4 + 1))) - } - if b.err != nil { - return nil, b.err - } - return units, nil -} - -// offsetToUnit returns the index of the unit containing offset off. -// It returns -1 if no unit contains this offset. -func (d *Data) offsetToUnit(off Offset) int { - // Find the unit after off - next := sort.Search(len(d.unit), func(i int) bool { - return d.unit[i].off > off - }) - if next == 0 { - return -1 - } - u := &d.unit[next-1] - if u.off <= off && off < u.off+Offset(len(u.data)) { - return next - 1 - } - return -1 -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/elf.go b/llgo/third_party/gofrontend/libgo/go/debug/elf/elf.go deleted file mode 100644 index c97ccaa4c1c3cd67401ad65237cfb5e7964566cb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/elf.go +++ /dev/null @@ -1,2017 +0,0 @@ -/* - * ELF constants and data structures - * - * Derived from: - * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.1 2005/12/30 22:13:58 marcel Exp $ - * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $ - * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $ - * $FreeBSD: src/sys/alpha/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $ - * $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $ - * $FreeBSD: src/sys/arm/include/elf.h,v 1.5.2.1 2006/06/30 21:42:52 cognet Exp $ - * $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $ - * $FreeBSD: src/sys/powerpc/include/elf.h,v 1.7 2004/11/02 09:47:01 ssouhlal Exp $ - * $FreeBSD: src/sys/sparc64/include/elf.h,v 1.12 2003/09/25 01:10:26 peter Exp $ - * "ELF for the ARM® 64-bit Architecture (AArch64)" (ARM IHI 0056B) - * - * Copyright (c) 1996-1998 John D. Polstra. All rights reserved. - * Copyright (c) 2001 David E. O'Brien - * Portions Copyright 2009 The Go Authors. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -package elf - -import "strconv" - -/* - * Constants - */ - -// Indexes into the Header.Ident array. -const ( - EI_CLASS = 4 /* Class of machine. */ - EI_DATA = 5 /* Data format. */ - EI_VERSION = 6 /* ELF format version. */ - EI_OSABI = 7 /* Operating system / ABI identification */ - EI_ABIVERSION = 8 /* ABI version */ - EI_PAD = 9 /* Start of padding (per SVR4 ABI). */ - EI_NIDENT = 16 /* Size of e_ident array. */ -) - -// Initial magic number for ELF files. -const ELFMAG = "\177ELF" - -// Version is found in Header.Ident[EI_VERSION] and Header.Version. -type Version byte - -const ( - EV_NONE Version = 0 - EV_CURRENT Version = 1 -) - -var versionStrings = []intName{ - {0, "EV_NONE"}, - {1, "EV_CURRENT"}, -} - -func (i Version) String() string { return stringName(uint32(i), versionStrings, false) } -func (i Version) GoString() string { return stringName(uint32(i), versionStrings, true) } - -// Class is found in Header.Ident[EI_CLASS] and Header.Class. -type Class byte - -const ( - ELFCLASSNONE Class = 0 /* Unknown class. */ - ELFCLASS32 Class = 1 /* 32-bit architecture. */ - ELFCLASS64 Class = 2 /* 64-bit architecture. */ -) - -var classStrings = []intName{ - {0, "ELFCLASSNONE"}, - {1, "ELFCLASS32"}, - {2, "ELFCLASS64"}, -} - -func (i Class) String() string { return stringName(uint32(i), classStrings, false) } -func (i Class) GoString() string { return stringName(uint32(i), classStrings, true) } - -// Data is found in Header.Ident[EI_DATA] and Header.Data. -type Data byte - -const ( - ELFDATANONE Data = 0 /* Unknown data format. */ - ELFDATA2LSB Data = 1 /* 2's complement little-endian. */ - ELFDATA2MSB Data = 2 /* 2's complement big-endian. */ -) - -var dataStrings = []intName{ - {0, "ELFDATANONE"}, - {1, "ELFDATA2LSB"}, - {2, "ELFDATA2MSB"}, -} - -func (i Data) String() string { return stringName(uint32(i), dataStrings, false) } -func (i Data) GoString() string { return stringName(uint32(i), dataStrings, true) } - -// OSABI is found in Header.Ident[EI_OSABI] and Header.OSABI. -type OSABI byte - -const ( - ELFOSABI_NONE OSABI = 0 /* UNIX System V ABI */ - ELFOSABI_HPUX OSABI = 1 /* HP-UX operating system */ - ELFOSABI_NETBSD OSABI = 2 /* NetBSD */ - ELFOSABI_LINUX OSABI = 3 /* GNU/Linux */ - ELFOSABI_HURD OSABI = 4 /* GNU/Hurd */ - ELFOSABI_86OPEN OSABI = 5 /* 86Open common IA32 ABI */ - ELFOSABI_SOLARIS OSABI = 6 /* Solaris */ - ELFOSABI_AIX OSABI = 7 /* AIX */ - ELFOSABI_IRIX OSABI = 8 /* IRIX */ - ELFOSABI_FREEBSD OSABI = 9 /* FreeBSD */ - ELFOSABI_TRU64 OSABI = 10 /* TRU64 UNIX */ - ELFOSABI_MODESTO OSABI = 11 /* Novell Modesto */ - ELFOSABI_OPENBSD OSABI = 12 /* OpenBSD */ - ELFOSABI_OPENVMS OSABI = 13 /* Open VMS */ - ELFOSABI_NSK OSABI = 14 /* HP Non-Stop Kernel */ - ELFOSABI_ARM OSABI = 97 /* ARM */ - ELFOSABI_STANDALONE OSABI = 255 /* Standalone (embedded) application */ -) - -var osabiStrings = []intName{ - {0, "ELFOSABI_NONE"}, - {1, "ELFOSABI_HPUX"}, - {2, "ELFOSABI_NETBSD"}, - {3, "ELFOSABI_LINUX"}, - {4, "ELFOSABI_HURD"}, - {5, "ELFOSABI_86OPEN"}, - {6, "ELFOSABI_SOLARIS"}, - {7, "ELFOSABI_AIX"}, - {8, "ELFOSABI_IRIX"}, - {9, "ELFOSABI_FREEBSD"}, - {10, "ELFOSABI_TRU64"}, - {11, "ELFOSABI_MODESTO"}, - {12, "ELFOSABI_OPENBSD"}, - {13, "ELFOSABI_OPENVMS"}, - {14, "ELFOSABI_NSK"}, - {97, "ELFOSABI_ARM"}, - {255, "ELFOSABI_STANDALONE"}, -} - -func (i OSABI) String() string { return stringName(uint32(i), osabiStrings, false) } -func (i OSABI) GoString() string { return stringName(uint32(i), osabiStrings, true) } - -// Type is found in Header.Type. -type Type uint16 - -const ( - ET_NONE Type = 0 /* Unknown type. */ - ET_REL Type = 1 /* Relocatable. */ - ET_EXEC Type = 2 /* Executable. */ - ET_DYN Type = 3 /* Shared object. */ - ET_CORE Type = 4 /* Core file. */ - ET_LOOS Type = 0xfe00 /* First operating system specific. */ - ET_HIOS Type = 0xfeff /* Last operating system-specific. */ - ET_LOPROC Type = 0xff00 /* First processor-specific. */ - ET_HIPROC Type = 0xffff /* Last processor-specific. */ -) - -var typeStrings = []intName{ - {0, "ET_NONE"}, - {1, "ET_REL"}, - {2, "ET_EXEC"}, - {3, "ET_DYN"}, - {4, "ET_CORE"}, - {0xfe00, "ET_LOOS"}, - {0xfeff, "ET_HIOS"}, - {0xff00, "ET_LOPROC"}, - {0xffff, "ET_HIPROC"}, -} - -func (i Type) String() string { return stringName(uint32(i), typeStrings, false) } -func (i Type) GoString() string { return stringName(uint32(i), typeStrings, true) } - -// Machine is found in Header.Machine. -type Machine uint16 - -const ( - EM_NONE Machine = 0 /* Unknown machine. */ - EM_M32 Machine = 1 /* AT&T WE32100. */ - EM_SPARC Machine = 2 /* Sun SPARC. */ - EM_386 Machine = 3 /* Intel i386. */ - EM_68K Machine = 4 /* Motorola 68000. */ - EM_88K Machine = 5 /* Motorola 88000. */ - EM_860 Machine = 7 /* Intel i860. */ - EM_MIPS Machine = 8 /* MIPS R3000 Big-Endian only. */ - EM_S370 Machine = 9 /* IBM System/370. */ - EM_MIPS_RS3_LE Machine = 10 /* MIPS R3000 Little-Endian. */ - EM_PARISC Machine = 15 /* HP PA-RISC. */ - EM_VPP500 Machine = 17 /* Fujitsu VPP500. */ - EM_SPARC32PLUS Machine = 18 /* SPARC v8plus. */ - EM_960 Machine = 19 /* Intel 80960. */ - EM_PPC Machine = 20 /* PowerPC 32-bit. */ - EM_PPC64 Machine = 21 /* PowerPC 64-bit. */ - EM_S390 Machine = 22 /* IBM System/390. */ - EM_V800 Machine = 36 /* NEC V800. */ - EM_FR20 Machine = 37 /* Fujitsu FR20. */ - EM_RH32 Machine = 38 /* TRW RH-32. */ - EM_RCE Machine = 39 /* Motorola RCE. */ - EM_ARM Machine = 40 /* ARM. */ - EM_SH Machine = 42 /* Hitachi SH. */ - EM_SPARCV9 Machine = 43 /* SPARC v9 64-bit. */ - EM_TRICORE Machine = 44 /* Siemens TriCore embedded processor. */ - EM_ARC Machine = 45 /* Argonaut RISC Core. */ - EM_H8_300 Machine = 46 /* Hitachi H8/300. */ - EM_H8_300H Machine = 47 /* Hitachi H8/300H. */ - EM_H8S Machine = 48 /* Hitachi H8S. */ - EM_H8_500 Machine = 49 /* Hitachi H8/500. */ - EM_IA_64 Machine = 50 /* Intel IA-64 Processor. */ - EM_MIPS_X Machine = 51 /* Stanford MIPS-X. */ - EM_COLDFIRE Machine = 52 /* Motorola ColdFire. */ - EM_68HC12 Machine = 53 /* Motorola M68HC12. */ - EM_MMA Machine = 54 /* Fujitsu MMA. */ - EM_PCP Machine = 55 /* Siemens PCP. */ - EM_NCPU Machine = 56 /* Sony nCPU. */ - EM_NDR1 Machine = 57 /* Denso NDR1 microprocessor. */ - EM_STARCORE Machine = 58 /* Motorola Star*Core processor. */ - EM_ME16 Machine = 59 /* Toyota ME16 processor. */ - EM_ST100 Machine = 60 /* STMicroelectronics ST100 processor. */ - EM_TINYJ Machine = 61 /* Advanced Logic Corp. TinyJ processor. */ - EM_X86_64 Machine = 62 /* Advanced Micro Devices x86-64 */ - EM_AARCH64 Machine = 183 /* ARM 64-bit Architecture (AArch64) */ - - /* Non-standard or deprecated. */ - EM_486 Machine = 6 /* Intel i486. */ - EM_MIPS_RS4_BE Machine = 10 /* MIPS R4000 Big-Endian */ - EM_ALPHA_STD Machine = 41 /* Digital Alpha (standard value). */ - EM_ALPHA Machine = 0x9026 /* Alpha (written in the absence of an ABI) */ -) - -var machineStrings = []intName{ - {0, "EM_NONE"}, - {1, "EM_M32"}, - {2, "EM_SPARC"}, - {3, "EM_386"}, - {4, "EM_68K"}, - {5, "EM_88K"}, - {7, "EM_860"}, - {8, "EM_MIPS"}, - {9, "EM_S370"}, - {10, "EM_MIPS_RS3_LE"}, - {15, "EM_PARISC"}, - {17, "EM_VPP500"}, - {18, "EM_SPARC32PLUS"}, - {19, "EM_960"}, - {20, "EM_PPC"}, - {21, "EM_PPC64"}, - {22, "EM_S390"}, - {36, "EM_V800"}, - {37, "EM_FR20"}, - {38, "EM_RH32"}, - {39, "EM_RCE"}, - {40, "EM_ARM"}, - {42, "EM_SH"}, - {43, "EM_SPARCV9"}, - {44, "EM_TRICORE"}, - {45, "EM_ARC"}, - {46, "EM_H8_300"}, - {47, "EM_H8_300H"}, - {48, "EM_H8S"}, - {49, "EM_H8_500"}, - {50, "EM_IA_64"}, - {51, "EM_MIPS_X"}, - {52, "EM_COLDFIRE"}, - {53, "EM_68HC12"}, - {54, "EM_MMA"}, - {55, "EM_PCP"}, - {56, "EM_NCPU"}, - {57, "EM_NDR1"}, - {58, "EM_STARCORE"}, - {59, "EM_ME16"}, - {60, "EM_ST100"}, - {61, "EM_TINYJ"}, - {62, "EM_X86_64"}, - - /* Non-standard or deprecated. */ - {6, "EM_486"}, - {10, "EM_MIPS_RS4_BE"}, - {41, "EM_ALPHA_STD"}, - {0x9026, "EM_ALPHA"}, -} - -func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) } -func (i Machine) GoString() string { return stringName(uint32(i), machineStrings, true) } - -// Special section indices. -type SectionIndex int - -const ( - SHN_UNDEF SectionIndex = 0 /* Undefined, missing, irrelevant. */ - SHN_LORESERVE SectionIndex = 0xff00 /* First of reserved range. */ - SHN_LOPROC SectionIndex = 0xff00 /* First processor-specific. */ - SHN_HIPROC SectionIndex = 0xff1f /* Last processor-specific. */ - SHN_LOOS SectionIndex = 0xff20 /* First operating system-specific. */ - SHN_HIOS SectionIndex = 0xff3f /* Last operating system-specific. */ - SHN_ABS SectionIndex = 0xfff1 /* Absolute values. */ - SHN_COMMON SectionIndex = 0xfff2 /* Common data. */ - SHN_XINDEX SectionIndex = 0xffff /* Escape; index stored elsewhere. */ - SHN_HIRESERVE SectionIndex = 0xffff /* Last of reserved range. */ -) - -var shnStrings = []intName{ - {0, "SHN_UNDEF"}, - {0xff00, "SHN_LOPROC"}, - {0xff20, "SHN_LOOS"}, - {0xfff1, "SHN_ABS"}, - {0xfff2, "SHN_COMMON"}, - {0xffff, "SHN_XINDEX"}, -} - -func (i SectionIndex) String() string { return stringName(uint32(i), shnStrings, false) } -func (i SectionIndex) GoString() string { return stringName(uint32(i), shnStrings, true) } - -// Section type. -type SectionType uint32 - -const ( - SHT_NULL SectionType = 0 /* inactive */ - SHT_PROGBITS SectionType = 1 /* program defined information */ - SHT_SYMTAB SectionType = 2 /* symbol table section */ - SHT_STRTAB SectionType = 3 /* string table section */ - SHT_RELA SectionType = 4 /* relocation section with addends */ - SHT_HASH SectionType = 5 /* symbol hash table section */ - SHT_DYNAMIC SectionType = 6 /* dynamic section */ - SHT_NOTE SectionType = 7 /* note section */ - SHT_NOBITS SectionType = 8 /* no space section */ - SHT_REL SectionType = 9 /* relocation section - no addends */ - SHT_SHLIB SectionType = 10 /* reserved - purpose unknown */ - SHT_DYNSYM SectionType = 11 /* dynamic symbol table section */ - SHT_INIT_ARRAY SectionType = 14 /* Initialization function pointers. */ - SHT_FINI_ARRAY SectionType = 15 /* Termination function pointers. */ - SHT_PREINIT_ARRAY SectionType = 16 /* Pre-initialization function ptrs. */ - SHT_GROUP SectionType = 17 /* Section group. */ - SHT_SYMTAB_SHNDX SectionType = 18 /* Section indexes (see SHN_XINDEX). */ - SHT_LOOS SectionType = 0x60000000 /* First of OS specific semantics */ - SHT_GNU_ATTRIBUTES SectionType = 0x6ffffff5 /* GNU object attributes */ - SHT_GNU_HASH SectionType = 0x6ffffff6 /* GNU hash table */ - SHT_GNU_LIBLIST SectionType = 0x6ffffff7 /* GNU prelink library list */ - SHT_GNU_VERDEF SectionType = 0x6ffffffd /* GNU version definition section */ - SHT_GNU_VERNEED SectionType = 0x6ffffffe /* GNU version needs section */ - SHT_GNU_VERSYM SectionType = 0x6fffffff /* GNU version symbol table */ - SHT_HIOS SectionType = 0x6fffffff /* Last of OS specific semantics */ - SHT_LOPROC SectionType = 0x70000000 /* reserved range for processor */ - SHT_HIPROC SectionType = 0x7fffffff /* specific section header types */ - SHT_LOUSER SectionType = 0x80000000 /* reserved range for application */ - SHT_HIUSER SectionType = 0xffffffff /* specific indexes */ -) - -var shtStrings = []intName{ - {0, "SHT_NULL"}, - {1, "SHT_PROGBITS"}, - {2, "SHT_SYMTAB"}, - {3, "SHT_STRTAB"}, - {4, "SHT_RELA"}, - {5, "SHT_HASH"}, - {6, "SHT_DYNAMIC"}, - {7, "SHT_NOTE"}, - {8, "SHT_NOBITS"}, - {9, "SHT_REL"}, - {10, "SHT_SHLIB"}, - {11, "SHT_DYNSYM"}, - {14, "SHT_INIT_ARRAY"}, - {15, "SHT_FINI_ARRAY"}, - {16, "SHT_PREINIT_ARRAY"}, - {17, "SHT_GROUP"}, - {18, "SHT_SYMTAB_SHNDX"}, - {0x60000000, "SHT_LOOS"}, - {0x6ffffff5, "SHT_GNU_ATTRIBUTES"}, - {0x6ffffff6, "SHT_GNU_HASH"}, - {0x6ffffff7, "SHT_GNU_LIBLIST"}, - {0x6ffffffd, "SHT_GNU_VERDEF"}, - {0x6ffffffe, "SHT_GNU_VERNEED"}, - {0x6fffffff, "SHT_GNU_VERSYM"}, - {0x70000000, "SHT_LOPROC"}, - {0x7fffffff, "SHT_HIPROC"}, - {0x80000000, "SHT_LOUSER"}, - {0xffffffff, "SHT_HIUSER"}, -} - -func (i SectionType) String() string { return stringName(uint32(i), shtStrings, false) } -func (i SectionType) GoString() string { return stringName(uint32(i), shtStrings, true) } - -// Section flags. -type SectionFlag uint32 - -const ( - SHF_WRITE SectionFlag = 0x1 /* Section contains writable data. */ - SHF_ALLOC SectionFlag = 0x2 /* Section occupies memory. */ - SHF_EXECINSTR SectionFlag = 0x4 /* Section contains instructions. */ - SHF_MERGE SectionFlag = 0x10 /* Section may be merged. */ - SHF_STRINGS SectionFlag = 0x20 /* Section contains strings. */ - SHF_INFO_LINK SectionFlag = 0x40 /* sh_info holds section index. */ - SHF_LINK_ORDER SectionFlag = 0x80 /* Special ordering requirements. */ - SHF_OS_NONCONFORMING SectionFlag = 0x100 /* OS-specific processing required. */ - SHF_GROUP SectionFlag = 0x200 /* Member of section group. */ - SHF_TLS SectionFlag = 0x400 /* Section contains TLS data. */ - SHF_MASKOS SectionFlag = 0x0ff00000 /* OS-specific semantics. */ - SHF_MASKPROC SectionFlag = 0xf0000000 /* Processor-specific semantics. */ -) - -var shfStrings = []intName{ - {0x1, "SHF_WRITE"}, - {0x2, "SHF_ALLOC"}, - {0x4, "SHF_EXECINSTR"}, - {0x10, "SHF_MERGE"}, - {0x20, "SHF_STRINGS"}, - {0x40, "SHF_INFO_LINK"}, - {0x80, "SHF_LINK_ORDER"}, - {0x100, "SHF_OS_NONCONFORMING"}, - {0x200, "SHF_GROUP"}, - {0x400, "SHF_TLS"}, -} - -func (i SectionFlag) String() string { return flagName(uint32(i), shfStrings, false) } -func (i SectionFlag) GoString() string { return flagName(uint32(i), shfStrings, true) } - -// Prog.Type -type ProgType int - -const ( - PT_NULL ProgType = 0 /* Unused entry. */ - PT_LOAD ProgType = 1 /* Loadable segment. */ - PT_DYNAMIC ProgType = 2 /* Dynamic linking information segment. */ - PT_INTERP ProgType = 3 /* Pathname of interpreter. */ - PT_NOTE ProgType = 4 /* Auxiliary information. */ - PT_SHLIB ProgType = 5 /* Reserved (not used). */ - PT_PHDR ProgType = 6 /* Location of program header itself. */ - PT_TLS ProgType = 7 /* Thread local storage segment */ - PT_LOOS ProgType = 0x60000000 /* First OS-specific. */ - PT_HIOS ProgType = 0x6fffffff /* Last OS-specific. */ - PT_LOPROC ProgType = 0x70000000 /* First processor-specific type. */ - PT_HIPROC ProgType = 0x7fffffff /* Last processor-specific type. */ -) - -var ptStrings = []intName{ - {0, "PT_NULL"}, - {1, "PT_LOAD"}, - {2, "PT_DYNAMIC"}, - {3, "PT_INTERP"}, - {4, "PT_NOTE"}, - {5, "PT_SHLIB"}, - {6, "PT_PHDR"}, - {7, "PT_TLS"}, - {0x60000000, "PT_LOOS"}, - {0x6fffffff, "PT_HIOS"}, - {0x70000000, "PT_LOPROC"}, - {0x7fffffff, "PT_HIPROC"}, -} - -func (i ProgType) String() string { return stringName(uint32(i), ptStrings, false) } -func (i ProgType) GoString() string { return stringName(uint32(i), ptStrings, true) } - -// Prog.Flag -type ProgFlag uint32 - -const ( - PF_X ProgFlag = 0x1 /* Executable. */ - PF_W ProgFlag = 0x2 /* Writable. */ - PF_R ProgFlag = 0x4 /* Readable. */ - PF_MASKOS ProgFlag = 0x0ff00000 /* Operating system-specific. */ - PF_MASKPROC ProgFlag = 0xf0000000 /* Processor-specific. */ -) - -var pfStrings = []intName{ - {0x1, "PF_X"}, - {0x2, "PF_W"}, - {0x4, "PF_R"}, -} - -func (i ProgFlag) String() string { return flagName(uint32(i), pfStrings, false) } -func (i ProgFlag) GoString() string { return flagName(uint32(i), pfStrings, true) } - -// Dyn.Tag -type DynTag int - -const ( - DT_NULL DynTag = 0 /* Terminating entry. */ - DT_NEEDED DynTag = 1 /* String table offset of a needed shared library. */ - DT_PLTRELSZ DynTag = 2 /* Total size in bytes of PLT relocations. */ - DT_PLTGOT DynTag = 3 /* Processor-dependent address. */ - DT_HASH DynTag = 4 /* Address of symbol hash table. */ - DT_STRTAB DynTag = 5 /* Address of string table. */ - DT_SYMTAB DynTag = 6 /* Address of symbol table. */ - DT_RELA DynTag = 7 /* Address of ElfNN_Rela relocations. */ - DT_RELASZ DynTag = 8 /* Total size of ElfNN_Rela relocations. */ - DT_RELAENT DynTag = 9 /* Size of each ElfNN_Rela relocation entry. */ - DT_STRSZ DynTag = 10 /* Size of string table. */ - DT_SYMENT DynTag = 11 /* Size of each symbol table entry. */ - DT_INIT DynTag = 12 /* Address of initialization function. */ - DT_FINI DynTag = 13 /* Address of finalization function. */ - DT_SONAME DynTag = 14 /* String table offset of shared object name. */ - DT_RPATH DynTag = 15 /* String table offset of library path. [sup] */ - DT_SYMBOLIC DynTag = 16 /* Indicates "symbolic" linking. [sup] */ - DT_REL DynTag = 17 /* Address of ElfNN_Rel relocations. */ - DT_RELSZ DynTag = 18 /* Total size of ElfNN_Rel relocations. */ - DT_RELENT DynTag = 19 /* Size of each ElfNN_Rel relocation. */ - DT_PLTREL DynTag = 20 /* Type of relocation used for PLT. */ - DT_DEBUG DynTag = 21 /* Reserved (not used). */ - DT_TEXTREL DynTag = 22 /* Indicates there may be relocations in non-writable segments. [sup] */ - DT_JMPREL DynTag = 23 /* Address of PLT relocations. */ - DT_BIND_NOW DynTag = 24 /* [sup] */ - DT_INIT_ARRAY DynTag = 25 /* Address of the array of pointers to initialization functions */ - DT_FINI_ARRAY DynTag = 26 /* Address of the array of pointers to termination functions */ - DT_INIT_ARRAYSZ DynTag = 27 /* Size in bytes of the array of initialization functions. */ - DT_FINI_ARRAYSZ DynTag = 28 /* Size in bytes of the array of termination functions. */ - DT_RUNPATH DynTag = 29 /* String table offset of a null-terminated library search path string. */ - DT_FLAGS DynTag = 30 /* Object specific flag values. */ - DT_ENCODING DynTag = 32 /* Values greater than or equal to DT_ENCODING - and less than DT_LOOS follow the rules for - the interpretation of the d_un union - as follows: even == 'd_ptr', even == 'd_val' - or none */ - DT_PREINIT_ARRAY DynTag = 32 /* Address of the array of pointers to pre-initialization functions. */ - DT_PREINIT_ARRAYSZ DynTag = 33 /* Size in bytes of the array of pre-initialization functions. */ - DT_LOOS DynTag = 0x6000000d /* First OS-specific */ - DT_HIOS DynTag = 0x6ffff000 /* Last OS-specific */ - DT_VERSYM DynTag = 0x6ffffff0 - DT_VERNEED DynTag = 0x6ffffffe - DT_VERNEEDNUM DynTag = 0x6fffffff - DT_LOPROC DynTag = 0x70000000 /* First processor-specific type. */ - DT_HIPROC DynTag = 0x7fffffff /* Last processor-specific type. */ -) - -var dtStrings = []intName{ - {0, "DT_NULL"}, - {1, "DT_NEEDED"}, - {2, "DT_PLTRELSZ"}, - {3, "DT_PLTGOT"}, - {4, "DT_HASH"}, - {5, "DT_STRTAB"}, - {6, "DT_SYMTAB"}, - {7, "DT_RELA"}, - {8, "DT_RELASZ"}, - {9, "DT_RELAENT"}, - {10, "DT_STRSZ"}, - {11, "DT_SYMENT"}, - {12, "DT_INIT"}, - {13, "DT_FINI"}, - {14, "DT_SONAME"}, - {15, "DT_RPATH"}, - {16, "DT_SYMBOLIC"}, - {17, "DT_REL"}, - {18, "DT_RELSZ"}, - {19, "DT_RELENT"}, - {20, "DT_PLTREL"}, - {21, "DT_DEBUG"}, - {22, "DT_TEXTREL"}, - {23, "DT_JMPREL"}, - {24, "DT_BIND_NOW"}, - {25, "DT_INIT_ARRAY"}, - {26, "DT_FINI_ARRAY"}, - {27, "DT_INIT_ARRAYSZ"}, - {28, "DT_FINI_ARRAYSZ"}, - {29, "DT_RUNPATH"}, - {30, "DT_FLAGS"}, - {32, "DT_ENCODING"}, - {32, "DT_PREINIT_ARRAY"}, - {33, "DT_PREINIT_ARRAYSZ"}, - {0x6000000d, "DT_LOOS"}, - {0x6ffff000, "DT_HIOS"}, - {0x6ffffff0, "DT_VERSYM"}, - {0x6ffffffe, "DT_VERNEED"}, - {0x6fffffff, "DT_VERNEEDNUM"}, - {0x70000000, "DT_LOPROC"}, - {0x7fffffff, "DT_HIPROC"}, -} - -func (i DynTag) String() string { return stringName(uint32(i), dtStrings, false) } -func (i DynTag) GoString() string { return stringName(uint32(i), dtStrings, true) } - -// DT_FLAGS values. -type DynFlag int - -const ( - DF_ORIGIN DynFlag = 0x0001 /* Indicates that the object being loaded may - make reference to the - $ORIGIN substitution string */ - DF_SYMBOLIC DynFlag = 0x0002 /* Indicates "symbolic" linking. */ - DF_TEXTREL DynFlag = 0x0004 /* Indicates there may be relocations in non-writable segments. */ - DF_BIND_NOW DynFlag = 0x0008 /* Indicates that the dynamic linker should - process all relocations for the object - containing this entry before transferring - control to the program. */ - DF_STATIC_TLS DynFlag = 0x0010 /* Indicates that the shared object or - executable contains code using a static - thread-local storage scheme. */ -) - -var dflagStrings = []intName{ - {0x0001, "DF_ORIGIN"}, - {0x0002, "DF_SYMBOLIC"}, - {0x0004, "DF_TEXTREL"}, - {0x0008, "DF_BIND_NOW"}, - {0x0010, "DF_STATIC_TLS"}, -} - -func (i DynFlag) String() string { return flagName(uint32(i), dflagStrings, false) } -func (i DynFlag) GoString() string { return flagName(uint32(i), dflagStrings, true) } - -// NType values; used in core files. -type NType int - -const ( - NT_PRSTATUS NType = 1 /* Process status. */ - NT_FPREGSET NType = 2 /* Floating point registers. */ - NT_PRPSINFO NType = 3 /* Process state info. */ -) - -var ntypeStrings = []intName{ - {1, "NT_PRSTATUS"}, - {2, "NT_FPREGSET"}, - {3, "NT_PRPSINFO"}, -} - -func (i NType) String() string { return stringName(uint32(i), ntypeStrings, false) } -func (i NType) GoString() string { return stringName(uint32(i), ntypeStrings, true) } - -/* Symbol Binding - ELFNN_ST_BIND - st_info */ -type SymBind int - -const ( - STB_LOCAL SymBind = 0 /* Local symbol */ - STB_GLOBAL SymBind = 1 /* Global symbol */ - STB_WEAK SymBind = 2 /* like global - lower precedence */ - STB_LOOS SymBind = 10 /* Reserved range for operating system */ - STB_HIOS SymBind = 12 /* specific semantics. */ - STB_LOPROC SymBind = 13 /* reserved range for processor */ - STB_HIPROC SymBind = 15 /* specific semantics. */ -) - -var stbStrings = []intName{ - {0, "STB_LOCAL"}, - {1, "STB_GLOBAL"}, - {2, "STB_WEAK"}, - {10, "STB_LOOS"}, - {12, "STB_HIOS"}, - {13, "STB_LOPROC"}, - {15, "STB_HIPROC"}, -} - -func (i SymBind) String() string { return stringName(uint32(i), stbStrings, false) } -func (i SymBind) GoString() string { return stringName(uint32(i), stbStrings, true) } - -/* Symbol type - ELFNN_ST_TYPE - st_info */ -type SymType int - -const ( - STT_NOTYPE SymType = 0 /* Unspecified type. */ - STT_OBJECT SymType = 1 /* Data object. */ - STT_FUNC SymType = 2 /* Function. */ - STT_SECTION SymType = 3 /* Section. */ - STT_FILE SymType = 4 /* Source file. */ - STT_COMMON SymType = 5 /* Uninitialized common block. */ - STT_TLS SymType = 6 /* TLS object. */ - STT_LOOS SymType = 10 /* Reserved range for operating system */ - STT_HIOS SymType = 12 /* specific semantics. */ - STT_LOPROC SymType = 13 /* reserved range for processor */ - STT_HIPROC SymType = 15 /* specific semantics. */ -) - -var sttStrings = []intName{ - {0, "STT_NOTYPE"}, - {1, "STT_OBJECT"}, - {2, "STT_FUNC"}, - {3, "STT_SECTION"}, - {4, "STT_FILE"}, - {5, "STT_COMMON"}, - {6, "STT_TLS"}, - {10, "STT_LOOS"}, - {12, "STT_HIOS"}, - {13, "STT_LOPROC"}, - {15, "STT_HIPROC"}, -} - -func (i SymType) String() string { return stringName(uint32(i), sttStrings, false) } -func (i SymType) GoString() string { return stringName(uint32(i), sttStrings, true) } - -/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */ -type SymVis int - -const ( - STV_DEFAULT SymVis = 0x0 /* Default visibility (see binding). */ - STV_INTERNAL SymVis = 0x1 /* Special meaning in relocatable objects. */ - STV_HIDDEN SymVis = 0x2 /* Not visible. */ - STV_PROTECTED SymVis = 0x3 /* Visible but not preemptible. */ -) - -var stvStrings = []intName{ - {0x0, "STV_DEFAULT"}, - {0x1, "STV_INTERNAL"}, - {0x2, "STV_HIDDEN"}, - {0x3, "STV_PROTECTED"}, -} - -func (i SymVis) String() string { return stringName(uint32(i), stvStrings, false) } -func (i SymVis) GoString() string { return stringName(uint32(i), stvStrings, true) } - -/* - * Relocation types. - */ - -// Relocation types for x86-64. -type R_X86_64 int - -const ( - R_X86_64_NONE R_X86_64 = 0 /* No relocation. */ - R_X86_64_64 R_X86_64 = 1 /* Add 64 bit symbol value. */ - R_X86_64_PC32 R_X86_64 = 2 /* PC-relative 32 bit signed sym value. */ - R_X86_64_GOT32 R_X86_64 = 3 /* PC-relative 32 bit GOT offset. */ - R_X86_64_PLT32 R_X86_64 = 4 /* PC-relative 32 bit PLT offset. */ - R_X86_64_COPY R_X86_64 = 5 /* Copy data from shared object. */ - R_X86_64_GLOB_DAT R_X86_64 = 6 /* Set GOT entry to data address. */ - R_X86_64_JMP_SLOT R_X86_64 = 7 /* Set GOT entry to code address. */ - R_X86_64_RELATIVE R_X86_64 = 8 /* Add load address of shared object. */ - R_X86_64_GOTPCREL R_X86_64 = 9 /* Add 32 bit signed pcrel offset to GOT. */ - R_X86_64_32 R_X86_64 = 10 /* Add 32 bit zero extended symbol value */ - R_X86_64_32S R_X86_64 = 11 /* Add 32 bit sign extended symbol value */ - R_X86_64_16 R_X86_64 = 12 /* Add 16 bit zero extended symbol value */ - R_X86_64_PC16 R_X86_64 = 13 /* Add 16 bit signed extended pc relative symbol value */ - R_X86_64_8 R_X86_64 = 14 /* Add 8 bit zero extended symbol value */ - R_X86_64_PC8 R_X86_64 = 15 /* Add 8 bit signed extended pc relative symbol value */ - R_X86_64_DTPMOD64 R_X86_64 = 16 /* ID of module containing symbol */ - R_X86_64_DTPOFF64 R_X86_64 = 17 /* Offset in TLS block */ - R_X86_64_TPOFF64 R_X86_64 = 18 /* Offset in static TLS block */ - R_X86_64_TLSGD R_X86_64 = 19 /* PC relative offset to GD GOT entry */ - R_X86_64_TLSLD R_X86_64 = 20 /* PC relative offset to LD GOT entry */ - R_X86_64_DTPOFF32 R_X86_64 = 21 /* Offset in TLS block */ - R_X86_64_GOTTPOFF R_X86_64 = 22 /* PC relative offset to IE GOT entry */ - R_X86_64_TPOFF32 R_X86_64 = 23 /* Offset in static TLS block */ -) - -var rx86_64Strings = []intName{ - {0, "R_X86_64_NONE"}, - {1, "R_X86_64_64"}, - {2, "R_X86_64_PC32"}, - {3, "R_X86_64_GOT32"}, - {4, "R_X86_64_PLT32"}, - {5, "R_X86_64_COPY"}, - {6, "R_X86_64_GLOB_DAT"}, - {7, "R_X86_64_JMP_SLOT"}, - {8, "R_X86_64_RELATIVE"}, - {9, "R_X86_64_GOTPCREL"}, - {10, "R_X86_64_32"}, - {11, "R_X86_64_32S"}, - {12, "R_X86_64_16"}, - {13, "R_X86_64_PC16"}, - {14, "R_X86_64_8"}, - {15, "R_X86_64_PC8"}, - {16, "R_X86_64_DTPMOD64"}, - {17, "R_X86_64_DTPOFF64"}, - {18, "R_X86_64_TPOFF64"}, - {19, "R_X86_64_TLSGD"}, - {20, "R_X86_64_TLSLD"}, - {21, "R_X86_64_DTPOFF32"}, - {22, "R_X86_64_GOTTPOFF"}, - {23, "R_X86_64_TPOFF32"}, -} - -func (i R_X86_64) String() string { return stringName(uint32(i), rx86_64Strings, false) } -func (i R_X86_64) GoString() string { return stringName(uint32(i), rx86_64Strings, true) } - -// Relocation types for AArch64 (aka arm64) -type R_AARCH64 int - -const ( - R_AARCH64_NONE R_AARCH64 = 0 - R_AARCH64_P32_ABS32 R_AARCH64 = 1 - R_AARCH64_P32_ABS16 R_AARCH64 = 2 - R_AARCH64_P32_PREL32 R_AARCH64 = 3 - R_AARCH64_P32_PREL16 R_AARCH64 = 4 - R_AARCH64_P32_MOVW_UABS_G0 R_AARCH64 = 5 - R_AARCH64_P32_MOVW_UABS_G0_NC R_AARCH64 = 6 - R_AARCH64_P32_MOVW_UABS_G1 R_AARCH64 = 7 - R_AARCH64_P32_MOVW_SABS_G0 R_AARCH64 = 8 - R_AARCH64_P32_LD_PREL_LO19 R_AARCH64 = 9 - R_AARCH64_P32_ADR_PREL_LO21 R_AARCH64 = 10 - R_AARCH64_P32_ADR_PREL_PG_HI21 R_AARCH64 = 11 - R_AARCH64_P32_ADD_ABS_LO12_NC R_AARCH64 = 12 - R_AARCH64_P32_LDST8_ABS_LO12_NC R_AARCH64 = 13 - R_AARCH64_P32_LDST16_ABS_LO12_NC R_AARCH64 = 14 - R_AARCH64_P32_LDST32_ABS_LO12_NC R_AARCH64 = 15 - R_AARCH64_P32_LDST64_ABS_LO12_NC R_AARCH64 = 16 - R_AARCH64_P32_LDST128_ABS_LO12_NC R_AARCH64 = 17 - R_AARCH64_P32_TSTBR14 R_AARCH64 = 18 - R_AARCH64_P32_CONDBR19 R_AARCH64 = 19 - R_AARCH64_P32_JUMP26 R_AARCH64 = 20 - R_AARCH64_P32_CALL26 R_AARCH64 = 21 - R_AARCH64_P32_GOT_LD_PREL19 R_AARCH64 = 25 - R_AARCH64_P32_ADR_GOT_PAGE R_AARCH64 = 26 - R_AARCH64_P32_LD32_GOT_LO12_NC R_AARCH64 = 27 - R_AARCH64_P32_TLSGD_ADR_PAGE21 R_AARCH64 = 81 - R_AARCH64_P32_TLSGD_ADD_LO12_NC R_AARCH64 = 82 - R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 103 - R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC R_AARCH64 = 104 - R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 105 - R_AARCH64_P32_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 106 - R_AARCH64_P32_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 107 - R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 108 - R_AARCH64_P32_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 109 - R_AARCH64_P32_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 110 - R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 111 - R_AARCH64_P32_TLSDESC_LD_PREL19 R_AARCH64 = 122 - R_AARCH64_P32_TLSDESC_ADR_PREL21 R_AARCH64 = 123 - R_AARCH64_P32_TLSDESC_ADR_PAGE21 R_AARCH64 = 124 - R_AARCH64_P32_TLSDESC_LD32_LO12_NC R_AARCH64 = 125 - R_AARCH64_P32_TLSDESC_ADD_LO12_NC R_AARCH64 = 126 - R_AARCH64_P32_TLSDESC_CALL R_AARCH64 = 127 - R_AARCH64_P32_COPY R_AARCH64 = 180 - R_AARCH64_P32_GLOB_DAT R_AARCH64 = 181 - R_AARCH64_P32_JUMP_SLOT R_AARCH64 = 182 - R_AARCH64_P32_RELATIVE R_AARCH64 = 183 - R_AARCH64_P32_TLS_DTPMOD R_AARCH64 = 184 - R_AARCH64_P32_TLS_DTPREL R_AARCH64 = 185 - R_AARCH64_P32_TLS_TPREL R_AARCH64 = 186 - R_AARCH64_P32_TLSDESC R_AARCH64 = 187 - R_AARCH64_P32_IRELATIVE R_AARCH64 = 188 - R_AARCH64_NULL R_AARCH64 = 256 - R_AARCH64_ABS64 R_AARCH64 = 257 - R_AARCH64_ABS32 R_AARCH64 = 258 - R_AARCH64_ABS16 R_AARCH64 = 259 - R_AARCH64_PREL64 R_AARCH64 = 260 - R_AARCH64_PREL32 R_AARCH64 = 261 - R_AARCH64_PREL16 R_AARCH64 = 262 - R_AARCH64_MOVW_UABS_G0 R_AARCH64 = 263 - R_AARCH64_MOVW_UABS_G0_NC R_AARCH64 = 264 - R_AARCH64_MOVW_UABS_G1 R_AARCH64 = 265 - R_AARCH64_MOVW_UABS_G1_NC R_AARCH64 = 266 - R_AARCH64_MOVW_UABS_G2 R_AARCH64 = 267 - R_AARCH64_MOVW_UABS_G2_NC R_AARCH64 = 268 - R_AARCH64_MOVW_UABS_G3 R_AARCH64 = 269 - R_AARCH64_MOVW_SABS_G0 R_AARCH64 = 270 - R_AARCH64_MOVW_SABS_G1 R_AARCH64 = 271 - R_AARCH64_MOVW_SABS_G2 R_AARCH64 = 272 - R_AARCH64_LD_PREL_LO19 R_AARCH64 = 273 - R_AARCH64_ADR_PREL_LO21 R_AARCH64 = 274 - R_AARCH64_ADR_PREL_PG_HI21 R_AARCH64 = 275 - R_AARCH64_ADR_PREL_PG_HI21_NC R_AARCH64 = 276 - R_AARCH64_ADD_ABS_LO12_NC R_AARCH64 = 277 - R_AARCH64_LDST8_ABS_LO12_NC R_AARCH64 = 278 - R_AARCH64_TSTBR14 R_AARCH64 = 279 - R_AARCH64_CONDBR19 R_AARCH64 = 280 - R_AARCH64_JUMP26 R_AARCH64 = 282 - R_AARCH64_CALL26 R_AARCH64 = 283 - R_AARCH64_LDST16_ABS_LO12_NC R_AARCH64 = 284 - R_AARCH64_LDST32_ABS_LO12_NC R_AARCH64 = 285 - R_AARCH64_LDST64_ABS_LO12_NC R_AARCH64 = 286 - R_AARCH64_LDST128_ABS_LO12_NC R_AARCH64 = 299 - R_AARCH64_GOT_LD_PREL19 R_AARCH64 = 309 - R_AARCH64_ADR_GOT_PAGE R_AARCH64 = 311 - R_AARCH64_LD64_GOT_LO12_NC R_AARCH64 = 312 - R_AARCH64_TLSGD_ADR_PAGE21 R_AARCH64 = 513 - R_AARCH64_TLSGD_ADD_LO12_NC R_AARCH64 = 514 - R_AARCH64_TLSIE_MOVW_GOTTPREL_G1 R_AARCH64 = 539 - R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC R_AARCH64 = 540 - R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 R_AARCH64 = 541 - R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC R_AARCH64 = 542 - R_AARCH64_TLSIE_LD_GOTTPREL_PREL19 R_AARCH64 = 543 - R_AARCH64_TLSLE_MOVW_TPREL_G2 R_AARCH64 = 544 - R_AARCH64_TLSLE_MOVW_TPREL_G1 R_AARCH64 = 545 - R_AARCH64_TLSLE_MOVW_TPREL_G1_NC R_AARCH64 = 546 - R_AARCH64_TLSLE_MOVW_TPREL_G0 R_AARCH64 = 547 - R_AARCH64_TLSLE_MOVW_TPREL_G0_NC R_AARCH64 = 548 - R_AARCH64_TLSLE_ADD_TPREL_HI12 R_AARCH64 = 549 - R_AARCH64_TLSLE_ADD_TPREL_LO12 R_AARCH64 = 550 - R_AARCH64_TLSLE_ADD_TPREL_LO12_NC R_AARCH64 = 551 - R_AARCH64_TLSDESC_LD_PREL19 R_AARCH64 = 560 - R_AARCH64_TLSDESC_ADR_PREL21 R_AARCH64 = 561 - R_AARCH64_TLSDESC_ADR_PAGE21 R_AARCH64 = 562 - R_AARCH64_TLSDESC_LD64_LO12_NC R_AARCH64 = 563 - R_AARCH64_TLSDESC_ADD_LO12_NC R_AARCH64 = 564 - R_AARCH64_TLSDESC_OFF_G1 R_AARCH64 = 565 - R_AARCH64_TLSDESC_OFF_G0_NC R_AARCH64 = 566 - R_AARCH64_TLSDESC_LDR R_AARCH64 = 567 - R_AARCH64_TLSDESC_ADD R_AARCH64 = 568 - R_AARCH64_TLSDESC_CALL R_AARCH64 = 569 - R_AARCH64_COPY R_AARCH64 = 1024 - R_AARCH64_GLOB_DAT R_AARCH64 = 1025 - R_AARCH64_JUMP_SLOT R_AARCH64 = 1026 - R_AARCH64_RELATIVE R_AARCH64 = 1027 - R_AARCH64_TLS_DTPMOD64 R_AARCH64 = 1028 - R_AARCH64_TLS_DTPREL64 R_AARCH64 = 1029 - R_AARCH64_TLS_TPREL64 R_AARCH64 = 1030 - R_AARCH64_TLSDESC R_AARCH64 = 1031 - R_AARCH64_IRELATIVE R_AARCH64 = 1032 -) - -var raarch64Strings = []intName{ - {0, "R_AARCH64_NONE"}, - {1, "R_AARCH64_P32_ABS32"}, - {2, "R_AARCH64_P32_ABS16"}, - {3, "R_AARCH64_P32_PREL32"}, - {4, "R_AARCH64_P32_PREL16"}, - {5, "R_AARCH64_P32_MOVW_UABS_G0"}, - {6, "R_AARCH64_P32_MOVW_UABS_G0_NC"}, - {7, "R_AARCH64_P32_MOVW_UABS_G1"}, - {8, "R_AARCH64_P32_MOVW_SABS_G0"}, - {9, "R_AARCH64_P32_LD_PREL_LO19"}, - {10, "R_AARCH64_P32_ADR_PREL_LO21"}, - {11, "R_AARCH64_P32_ADR_PREL_PG_HI21"}, - {12, "R_AARCH64_P32_ADD_ABS_LO12_NC"}, - {13, "R_AARCH64_P32_LDST8_ABS_LO12_NC"}, - {14, "R_AARCH64_P32_LDST16_ABS_LO12_NC"}, - {15, "R_AARCH64_P32_LDST32_ABS_LO12_NC"}, - {16, "R_AARCH64_P32_LDST64_ABS_LO12_NC"}, - {17, "R_AARCH64_P32_LDST128_ABS_LO12_NC"}, - {18, "R_AARCH64_P32_TSTBR14"}, - {19, "R_AARCH64_P32_CONDBR19"}, - {20, "R_AARCH64_P32_JUMP26"}, - {21, "R_AARCH64_P32_CALL26"}, - {25, "R_AARCH64_P32_GOT_LD_PREL19"}, - {26, "R_AARCH64_P32_ADR_GOT_PAGE"}, - {27, "R_AARCH64_P32_LD32_GOT_LO12_NC"}, - {81, "R_AARCH64_P32_TLSGD_ADR_PAGE21"}, - {82, "R_AARCH64_P32_TLSGD_ADD_LO12_NC"}, - {103, "R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21"}, - {104, "R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC"}, - {105, "R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19"}, - {106, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G1"}, - {107, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0"}, - {108, "R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC"}, - {109, "R_AARCH64_P32_TLSLE_ADD_TPREL_HI12"}, - {110, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12"}, - {111, "R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC"}, - {122, "R_AARCH64_P32_TLSDESC_LD_PREL19"}, - {123, "R_AARCH64_P32_TLSDESC_ADR_PREL21"}, - {124, "R_AARCH64_P32_TLSDESC_ADR_PAGE21"}, - {125, "R_AARCH64_P32_TLSDESC_LD32_LO12_NC"}, - {126, "R_AARCH64_P32_TLSDESC_ADD_LO12_NC"}, - {127, "R_AARCH64_P32_TLSDESC_CALL"}, - {180, "R_AARCH64_P32_COPY"}, - {181, "R_AARCH64_P32_GLOB_DAT"}, - {182, "R_AARCH64_P32_JUMP_SLOT"}, - {183, "R_AARCH64_P32_RELATIVE"}, - {184, "R_AARCH64_P32_TLS_DTPMOD"}, - {185, "R_AARCH64_P32_TLS_DTPREL"}, - {186, "R_AARCH64_P32_TLS_TPREL"}, - {187, "R_AARCH64_P32_TLSDESC"}, - {188, "R_AARCH64_P32_IRELATIVE"}, - {256, "R_AARCH64_NULL"}, - {257, "R_AARCH64_ABS64"}, - {258, "R_AARCH64_ABS32"}, - {259, "R_AARCH64_ABS16"}, - {260, "R_AARCH64_PREL64"}, - {261, "R_AARCH64_PREL32"}, - {262, "R_AARCH64_PREL16"}, - {263, "R_AARCH64_MOVW_UABS_G0"}, - {264, "R_AARCH64_MOVW_UABS_G0_NC"}, - {265, "R_AARCH64_MOVW_UABS_G1"}, - {266, "R_AARCH64_MOVW_UABS_G1_NC"}, - {267, "R_AARCH64_MOVW_UABS_G2"}, - {268, "R_AARCH64_MOVW_UABS_G2_NC"}, - {269, "R_AARCH64_MOVW_UABS_G3"}, - {270, "R_AARCH64_MOVW_SABS_G0"}, - {271, "R_AARCH64_MOVW_SABS_G1"}, - {272, "R_AARCH64_MOVW_SABS_G2"}, - {273, "R_AARCH64_LD_PREL_LO19"}, - {274, "R_AARCH64_ADR_PREL_LO21"}, - {275, "R_AARCH64_ADR_PREL_PG_HI21"}, - {276, "R_AARCH64_ADR_PREL_PG_HI21_NC"}, - {277, "R_AARCH64_ADD_ABS_LO12_NC"}, - {278, "R_AARCH64_LDST8_ABS_LO12_NC"}, - {279, "R_AARCH64_TSTBR14"}, - {280, "R_AARCH64_CONDBR19"}, - {282, "R_AARCH64_JUMP26"}, - {283, "R_AARCH64_CALL26"}, - {284, "R_AARCH64_LDST16_ABS_LO12_NC"}, - {285, "R_AARCH64_LDST32_ABS_LO12_NC"}, - {286, "R_AARCH64_LDST64_ABS_LO12_NC"}, - {299, "R_AARCH64_LDST128_ABS_LO12_NC"}, - {309, "R_AARCH64_GOT_LD_PREL19"}, - {311, "R_AARCH64_ADR_GOT_PAGE"}, - {312, "R_AARCH64_LD64_GOT_LO12_NC"}, - {513, "R_AARCH64_TLSGD_ADR_PAGE21"}, - {514, "R_AARCH64_TLSGD_ADD_LO12_NC"}, - {539, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G1"}, - {540, "R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC"}, - {541, "R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21"}, - {542, "R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC"}, - {543, "R_AARCH64_TLSIE_LD_GOTTPREL_PREL19"}, - {544, "R_AARCH64_TLSLE_MOVW_TPREL_G2"}, - {545, "R_AARCH64_TLSLE_MOVW_TPREL_G1"}, - {546, "R_AARCH64_TLSLE_MOVW_TPREL_G1_NC"}, - {547, "R_AARCH64_TLSLE_MOVW_TPREL_G0"}, - {548, "R_AARCH64_TLSLE_MOVW_TPREL_G0_NC"}, - {549, "R_AARCH64_TLSLE_ADD_TPREL_HI12"}, - {550, "R_AARCH64_TLSLE_ADD_TPREL_LO12"}, - {551, "R_AARCH64_TLSLE_ADD_TPREL_LO12_NC"}, - {560, "R_AARCH64_TLSDESC_LD_PREL19"}, - {561, "R_AARCH64_TLSDESC_ADR_PREL21"}, - {562, "R_AARCH64_TLSDESC_ADR_PAGE21"}, - {563, "R_AARCH64_TLSDESC_LD64_LO12_NC"}, - {564, "R_AARCH64_TLSDESC_ADD_LO12_NC"}, - {565, "R_AARCH64_TLSDESC_OFF_G1"}, - {566, "R_AARCH64_TLSDESC_OFF_G0_NC"}, - {567, "R_AARCH64_TLSDESC_LDR"}, - {568, "R_AARCH64_TLSDESC_ADD"}, - {569, "R_AARCH64_TLSDESC_CALL"}, - {1024, "R_AARCH64_COPY"}, - {1025, "R_AARCH64_GLOB_DAT"}, - {1026, "R_AARCH64_JUMP_SLOT"}, - {1027, "R_AARCH64_RELATIVE"}, - {1028, "R_AARCH64_TLS_DTPMOD64"}, - {1029, "R_AARCH64_TLS_DTPREL64"}, - {1030, "R_AARCH64_TLS_TPREL64"}, - {1031, "R_AARCH64_TLSDESC"}, - {1032, "R_AARCH64_IRELATIVE"}, -} - -func (i R_AARCH64) String() string { return stringName(uint32(i), raarch64Strings, false) } -func (i R_AARCH64) GoString() string { return stringName(uint32(i), raarch64Strings, true) } - -// Relocation types for Alpha. -type R_ALPHA int - -const ( - R_ALPHA_NONE R_ALPHA = 0 /* No reloc */ - R_ALPHA_REFLONG R_ALPHA = 1 /* Direct 32 bit */ - R_ALPHA_REFQUAD R_ALPHA = 2 /* Direct 64 bit */ - R_ALPHA_GPREL32 R_ALPHA = 3 /* GP relative 32 bit */ - R_ALPHA_LITERAL R_ALPHA = 4 /* GP relative 16 bit w/optimization */ - R_ALPHA_LITUSE R_ALPHA = 5 /* Optimization hint for LITERAL */ - R_ALPHA_GPDISP R_ALPHA = 6 /* Add displacement to GP */ - R_ALPHA_BRADDR R_ALPHA = 7 /* PC+4 relative 23 bit shifted */ - R_ALPHA_HINT R_ALPHA = 8 /* PC+4 relative 16 bit shifted */ - R_ALPHA_SREL16 R_ALPHA = 9 /* PC relative 16 bit */ - R_ALPHA_SREL32 R_ALPHA = 10 /* PC relative 32 bit */ - R_ALPHA_SREL64 R_ALPHA = 11 /* PC relative 64 bit */ - R_ALPHA_OP_PUSH R_ALPHA = 12 /* OP stack push */ - R_ALPHA_OP_STORE R_ALPHA = 13 /* OP stack pop and store */ - R_ALPHA_OP_PSUB R_ALPHA = 14 /* OP stack subtract */ - R_ALPHA_OP_PRSHIFT R_ALPHA = 15 /* OP stack right shift */ - R_ALPHA_GPVALUE R_ALPHA = 16 - R_ALPHA_GPRELHIGH R_ALPHA = 17 - R_ALPHA_GPRELLOW R_ALPHA = 18 - R_ALPHA_IMMED_GP_16 R_ALPHA = 19 - R_ALPHA_IMMED_GP_HI32 R_ALPHA = 20 - R_ALPHA_IMMED_SCN_HI32 R_ALPHA = 21 - R_ALPHA_IMMED_BR_HI32 R_ALPHA = 22 - R_ALPHA_IMMED_LO32 R_ALPHA = 23 - R_ALPHA_COPY R_ALPHA = 24 /* Copy symbol at runtime */ - R_ALPHA_GLOB_DAT R_ALPHA = 25 /* Create GOT entry */ - R_ALPHA_JMP_SLOT R_ALPHA = 26 /* Create PLT entry */ - R_ALPHA_RELATIVE R_ALPHA = 27 /* Adjust by program base */ -) - -var ralphaStrings = []intName{ - {0, "R_ALPHA_NONE"}, - {1, "R_ALPHA_REFLONG"}, - {2, "R_ALPHA_REFQUAD"}, - {3, "R_ALPHA_GPREL32"}, - {4, "R_ALPHA_LITERAL"}, - {5, "R_ALPHA_LITUSE"}, - {6, "R_ALPHA_GPDISP"}, - {7, "R_ALPHA_BRADDR"}, - {8, "R_ALPHA_HINT"}, - {9, "R_ALPHA_SREL16"}, - {10, "R_ALPHA_SREL32"}, - {11, "R_ALPHA_SREL64"}, - {12, "R_ALPHA_OP_PUSH"}, - {13, "R_ALPHA_OP_STORE"}, - {14, "R_ALPHA_OP_PSUB"}, - {15, "R_ALPHA_OP_PRSHIFT"}, - {16, "R_ALPHA_GPVALUE"}, - {17, "R_ALPHA_GPRELHIGH"}, - {18, "R_ALPHA_GPRELLOW"}, - {19, "R_ALPHA_IMMED_GP_16"}, - {20, "R_ALPHA_IMMED_GP_HI32"}, - {21, "R_ALPHA_IMMED_SCN_HI32"}, - {22, "R_ALPHA_IMMED_BR_HI32"}, - {23, "R_ALPHA_IMMED_LO32"}, - {24, "R_ALPHA_COPY"}, - {25, "R_ALPHA_GLOB_DAT"}, - {26, "R_ALPHA_JMP_SLOT"}, - {27, "R_ALPHA_RELATIVE"}, -} - -func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) } -func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) } - -// Relocation types for ARM. -type R_ARM int - -const ( - R_ARM_NONE R_ARM = 0 /* No relocation. */ - R_ARM_PC24 R_ARM = 1 - R_ARM_ABS32 R_ARM = 2 - R_ARM_REL32 R_ARM = 3 - R_ARM_PC13 R_ARM = 4 - R_ARM_ABS16 R_ARM = 5 - R_ARM_ABS12 R_ARM = 6 - R_ARM_THM_ABS5 R_ARM = 7 - R_ARM_ABS8 R_ARM = 8 - R_ARM_SBREL32 R_ARM = 9 - R_ARM_THM_PC22 R_ARM = 10 - R_ARM_THM_PC8 R_ARM = 11 - R_ARM_AMP_VCALL9 R_ARM = 12 - R_ARM_SWI24 R_ARM = 13 - R_ARM_THM_SWI8 R_ARM = 14 - R_ARM_XPC25 R_ARM = 15 - R_ARM_THM_XPC22 R_ARM = 16 - R_ARM_COPY R_ARM = 20 /* Copy data from shared object. */ - R_ARM_GLOB_DAT R_ARM = 21 /* Set GOT entry to data address. */ - R_ARM_JUMP_SLOT R_ARM = 22 /* Set GOT entry to code address. */ - R_ARM_RELATIVE R_ARM = 23 /* Add load address of shared object. */ - R_ARM_GOTOFF R_ARM = 24 /* Add GOT-relative symbol address. */ - R_ARM_GOTPC R_ARM = 25 /* Add PC-relative GOT table address. */ - R_ARM_GOT32 R_ARM = 26 /* Add PC-relative GOT offset. */ - R_ARM_PLT32 R_ARM = 27 /* Add PC-relative PLT offset. */ - R_ARM_GNU_VTENTRY R_ARM = 100 - R_ARM_GNU_VTINHERIT R_ARM = 101 - R_ARM_RSBREL32 R_ARM = 250 - R_ARM_THM_RPC22 R_ARM = 251 - R_ARM_RREL32 R_ARM = 252 - R_ARM_RABS32 R_ARM = 253 - R_ARM_RPC24 R_ARM = 254 - R_ARM_RBASE R_ARM = 255 -) - -var rarmStrings = []intName{ - {0, "R_ARM_NONE"}, - {1, "R_ARM_PC24"}, - {2, "R_ARM_ABS32"}, - {3, "R_ARM_REL32"}, - {4, "R_ARM_PC13"}, - {5, "R_ARM_ABS16"}, - {6, "R_ARM_ABS12"}, - {7, "R_ARM_THM_ABS5"}, - {8, "R_ARM_ABS8"}, - {9, "R_ARM_SBREL32"}, - {10, "R_ARM_THM_PC22"}, - {11, "R_ARM_THM_PC8"}, - {12, "R_ARM_AMP_VCALL9"}, - {13, "R_ARM_SWI24"}, - {14, "R_ARM_THM_SWI8"}, - {15, "R_ARM_XPC25"}, - {16, "R_ARM_THM_XPC22"}, - {20, "R_ARM_COPY"}, - {21, "R_ARM_GLOB_DAT"}, - {22, "R_ARM_JUMP_SLOT"}, - {23, "R_ARM_RELATIVE"}, - {24, "R_ARM_GOTOFF"}, - {25, "R_ARM_GOTPC"}, - {26, "R_ARM_GOT32"}, - {27, "R_ARM_PLT32"}, - {100, "R_ARM_GNU_VTENTRY"}, - {101, "R_ARM_GNU_VTINHERIT"}, - {250, "R_ARM_RSBREL32"}, - {251, "R_ARM_THM_RPC22"}, - {252, "R_ARM_RREL32"}, - {253, "R_ARM_RABS32"}, - {254, "R_ARM_RPC24"}, - {255, "R_ARM_RBASE"}, -} - -func (i R_ARM) String() string { return stringName(uint32(i), rarmStrings, false) } -func (i R_ARM) GoString() string { return stringName(uint32(i), rarmStrings, true) } - -// Relocation types for 386. -type R_386 int - -const ( - R_386_NONE R_386 = 0 /* No relocation. */ - R_386_32 R_386 = 1 /* Add symbol value. */ - R_386_PC32 R_386 = 2 /* Add PC-relative symbol value. */ - R_386_GOT32 R_386 = 3 /* Add PC-relative GOT offset. */ - R_386_PLT32 R_386 = 4 /* Add PC-relative PLT offset. */ - R_386_COPY R_386 = 5 /* Copy data from shared object. */ - R_386_GLOB_DAT R_386 = 6 /* Set GOT entry to data address. */ - R_386_JMP_SLOT R_386 = 7 /* Set GOT entry to code address. */ - R_386_RELATIVE R_386 = 8 /* Add load address of shared object. */ - R_386_GOTOFF R_386 = 9 /* Add GOT-relative symbol address. */ - R_386_GOTPC R_386 = 10 /* Add PC-relative GOT table address. */ - R_386_TLS_TPOFF R_386 = 14 /* Negative offset in static TLS block */ - R_386_TLS_IE R_386 = 15 /* Absolute address of GOT for -ve static TLS */ - R_386_TLS_GOTIE R_386 = 16 /* GOT entry for negative static TLS block */ - R_386_TLS_LE R_386 = 17 /* Negative offset relative to static TLS */ - R_386_TLS_GD R_386 = 18 /* 32 bit offset to GOT (index,off) pair */ - R_386_TLS_LDM R_386 = 19 /* 32 bit offset to GOT (index,zero) pair */ - R_386_TLS_GD_32 R_386 = 24 /* 32 bit offset to GOT (index,off) pair */ - R_386_TLS_GD_PUSH R_386 = 25 /* pushl instruction for Sun ABI GD sequence */ - R_386_TLS_GD_CALL R_386 = 26 /* call instruction for Sun ABI GD sequence */ - R_386_TLS_GD_POP R_386 = 27 /* popl instruction for Sun ABI GD sequence */ - R_386_TLS_LDM_32 R_386 = 28 /* 32 bit offset to GOT (index,zero) pair */ - R_386_TLS_LDM_PUSH R_386 = 29 /* pushl instruction for Sun ABI LD sequence */ - R_386_TLS_LDM_CALL R_386 = 30 /* call instruction for Sun ABI LD sequence */ - R_386_TLS_LDM_POP R_386 = 31 /* popl instruction for Sun ABI LD sequence */ - R_386_TLS_LDO_32 R_386 = 32 /* 32 bit offset from start of TLS block */ - R_386_TLS_IE_32 R_386 = 33 /* 32 bit offset to GOT static TLS offset entry */ - R_386_TLS_LE_32 R_386 = 34 /* 32 bit offset within static TLS block */ - R_386_TLS_DTPMOD32 R_386 = 35 /* GOT entry containing TLS index */ - R_386_TLS_DTPOFF32 R_386 = 36 /* GOT entry containing TLS offset */ - R_386_TLS_TPOFF32 R_386 = 37 /* GOT entry of -ve static TLS offset */ -) - -var r386Strings = []intName{ - {0, "R_386_NONE"}, - {1, "R_386_32"}, - {2, "R_386_PC32"}, - {3, "R_386_GOT32"}, - {4, "R_386_PLT32"}, - {5, "R_386_COPY"}, - {6, "R_386_GLOB_DAT"}, - {7, "R_386_JMP_SLOT"}, - {8, "R_386_RELATIVE"}, - {9, "R_386_GOTOFF"}, - {10, "R_386_GOTPC"}, - {14, "R_386_TLS_TPOFF"}, - {15, "R_386_TLS_IE"}, - {16, "R_386_TLS_GOTIE"}, - {17, "R_386_TLS_LE"}, - {18, "R_386_TLS_GD"}, - {19, "R_386_TLS_LDM"}, - {24, "R_386_TLS_GD_32"}, - {25, "R_386_TLS_GD_PUSH"}, - {26, "R_386_TLS_GD_CALL"}, - {27, "R_386_TLS_GD_POP"}, - {28, "R_386_TLS_LDM_32"}, - {29, "R_386_TLS_LDM_PUSH"}, - {30, "R_386_TLS_LDM_CALL"}, - {31, "R_386_TLS_LDM_POP"}, - {32, "R_386_TLS_LDO_32"}, - {33, "R_386_TLS_IE_32"}, - {34, "R_386_TLS_LE_32"}, - {35, "R_386_TLS_DTPMOD32"}, - {36, "R_386_TLS_DTPOFF32"}, - {37, "R_386_TLS_TPOFF32"}, -} - -func (i R_386) String() string { return stringName(uint32(i), r386Strings, false) } -func (i R_386) GoString() string { return stringName(uint32(i), r386Strings, true) } - -// Relocation types for PowerPC. -type R_PPC int - -const ( - R_PPC_NONE R_PPC = 0 /* No relocation. */ - R_PPC_ADDR32 R_PPC = 1 - R_PPC_ADDR24 R_PPC = 2 - R_PPC_ADDR16 R_PPC = 3 - R_PPC_ADDR16_LO R_PPC = 4 - R_PPC_ADDR16_HI R_PPC = 5 - R_PPC_ADDR16_HA R_PPC = 6 - R_PPC_ADDR14 R_PPC = 7 - R_PPC_ADDR14_BRTAKEN R_PPC = 8 - R_PPC_ADDR14_BRNTAKEN R_PPC = 9 - R_PPC_REL24 R_PPC = 10 - R_PPC_REL14 R_PPC = 11 - R_PPC_REL14_BRTAKEN R_PPC = 12 - R_PPC_REL14_BRNTAKEN R_PPC = 13 - R_PPC_GOT16 R_PPC = 14 - R_PPC_GOT16_LO R_PPC = 15 - R_PPC_GOT16_HI R_PPC = 16 - R_PPC_GOT16_HA R_PPC = 17 - R_PPC_PLTREL24 R_PPC = 18 - R_PPC_COPY R_PPC = 19 - R_PPC_GLOB_DAT R_PPC = 20 - R_PPC_JMP_SLOT R_PPC = 21 - R_PPC_RELATIVE R_PPC = 22 - R_PPC_LOCAL24PC R_PPC = 23 - R_PPC_UADDR32 R_PPC = 24 - R_PPC_UADDR16 R_PPC = 25 - R_PPC_REL32 R_PPC = 26 - R_PPC_PLT32 R_PPC = 27 - R_PPC_PLTREL32 R_PPC = 28 - R_PPC_PLT16_LO R_PPC = 29 - R_PPC_PLT16_HI R_PPC = 30 - R_PPC_PLT16_HA R_PPC = 31 - R_PPC_SDAREL16 R_PPC = 32 - R_PPC_SECTOFF R_PPC = 33 - R_PPC_SECTOFF_LO R_PPC = 34 - R_PPC_SECTOFF_HI R_PPC = 35 - R_PPC_SECTOFF_HA R_PPC = 36 - R_PPC_TLS R_PPC = 67 - R_PPC_DTPMOD32 R_PPC = 68 - R_PPC_TPREL16 R_PPC = 69 - R_PPC_TPREL16_LO R_PPC = 70 - R_PPC_TPREL16_HI R_PPC = 71 - R_PPC_TPREL16_HA R_PPC = 72 - R_PPC_TPREL32 R_PPC = 73 - R_PPC_DTPREL16 R_PPC = 74 - R_PPC_DTPREL16_LO R_PPC = 75 - R_PPC_DTPREL16_HI R_PPC = 76 - R_PPC_DTPREL16_HA R_PPC = 77 - R_PPC_DTPREL32 R_PPC = 78 - R_PPC_GOT_TLSGD16 R_PPC = 79 - R_PPC_GOT_TLSGD16_LO R_PPC = 80 - R_PPC_GOT_TLSGD16_HI R_PPC = 81 - R_PPC_GOT_TLSGD16_HA R_PPC = 82 - R_PPC_GOT_TLSLD16 R_PPC = 83 - R_PPC_GOT_TLSLD16_LO R_PPC = 84 - R_PPC_GOT_TLSLD16_HI R_PPC = 85 - R_PPC_GOT_TLSLD16_HA R_PPC = 86 - R_PPC_GOT_TPREL16 R_PPC = 87 - R_PPC_GOT_TPREL16_LO R_PPC = 88 - R_PPC_GOT_TPREL16_HI R_PPC = 89 - R_PPC_GOT_TPREL16_HA R_PPC = 90 - R_PPC_EMB_NADDR32 R_PPC = 101 - R_PPC_EMB_NADDR16 R_PPC = 102 - R_PPC_EMB_NADDR16_LO R_PPC = 103 - R_PPC_EMB_NADDR16_HI R_PPC = 104 - R_PPC_EMB_NADDR16_HA R_PPC = 105 - R_PPC_EMB_SDAI16 R_PPC = 106 - R_PPC_EMB_SDA2I16 R_PPC = 107 - R_PPC_EMB_SDA2REL R_PPC = 108 - R_PPC_EMB_SDA21 R_PPC = 109 - R_PPC_EMB_MRKREF R_PPC = 110 - R_PPC_EMB_RELSEC16 R_PPC = 111 - R_PPC_EMB_RELST_LO R_PPC = 112 - R_PPC_EMB_RELST_HI R_PPC = 113 - R_PPC_EMB_RELST_HA R_PPC = 114 - R_PPC_EMB_BIT_FLD R_PPC = 115 - R_PPC_EMB_RELSDA R_PPC = 116 -) - -var rppcStrings = []intName{ - {0, "R_PPC_NONE"}, - {1, "R_PPC_ADDR32"}, - {2, "R_PPC_ADDR24"}, - {3, "R_PPC_ADDR16"}, - {4, "R_PPC_ADDR16_LO"}, - {5, "R_PPC_ADDR16_HI"}, - {6, "R_PPC_ADDR16_HA"}, - {7, "R_PPC_ADDR14"}, - {8, "R_PPC_ADDR14_BRTAKEN"}, - {9, "R_PPC_ADDR14_BRNTAKEN"}, - {10, "R_PPC_REL24"}, - {11, "R_PPC_REL14"}, - {12, "R_PPC_REL14_BRTAKEN"}, - {13, "R_PPC_REL14_BRNTAKEN"}, - {14, "R_PPC_GOT16"}, - {15, "R_PPC_GOT16_LO"}, - {16, "R_PPC_GOT16_HI"}, - {17, "R_PPC_GOT16_HA"}, - {18, "R_PPC_PLTREL24"}, - {19, "R_PPC_COPY"}, - {20, "R_PPC_GLOB_DAT"}, - {21, "R_PPC_JMP_SLOT"}, - {22, "R_PPC_RELATIVE"}, - {23, "R_PPC_LOCAL24PC"}, - {24, "R_PPC_UADDR32"}, - {25, "R_PPC_UADDR16"}, - {26, "R_PPC_REL32"}, - {27, "R_PPC_PLT32"}, - {28, "R_PPC_PLTREL32"}, - {29, "R_PPC_PLT16_LO"}, - {30, "R_PPC_PLT16_HI"}, - {31, "R_PPC_PLT16_HA"}, - {32, "R_PPC_SDAREL16"}, - {33, "R_PPC_SECTOFF"}, - {34, "R_PPC_SECTOFF_LO"}, - {35, "R_PPC_SECTOFF_HI"}, - {36, "R_PPC_SECTOFF_HA"}, - - {67, "R_PPC_TLS"}, - {68, "R_PPC_DTPMOD32"}, - {69, "R_PPC_TPREL16"}, - {70, "R_PPC_TPREL16_LO"}, - {71, "R_PPC_TPREL16_HI"}, - {72, "R_PPC_TPREL16_HA"}, - {73, "R_PPC_TPREL32"}, - {74, "R_PPC_DTPREL16"}, - {75, "R_PPC_DTPREL16_LO"}, - {76, "R_PPC_DTPREL16_HI"}, - {77, "R_PPC_DTPREL16_HA"}, - {78, "R_PPC_DTPREL32"}, - {79, "R_PPC_GOT_TLSGD16"}, - {80, "R_PPC_GOT_TLSGD16_LO"}, - {81, "R_PPC_GOT_TLSGD16_HI"}, - {82, "R_PPC_GOT_TLSGD16_HA"}, - {83, "R_PPC_GOT_TLSLD16"}, - {84, "R_PPC_GOT_TLSLD16_LO"}, - {85, "R_PPC_GOT_TLSLD16_HI"}, - {86, "R_PPC_GOT_TLSLD16_HA"}, - {87, "R_PPC_GOT_TPREL16"}, - {88, "R_PPC_GOT_TPREL16_LO"}, - {89, "R_PPC_GOT_TPREL16_HI"}, - {90, "R_PPC_GOT_TPREL16_HA"}, - - {101, "R_PPC_EMB_NADDR32"}, - {102, "R_PPC_EMB_NADDR16"}, - {103, "R_PPC_EMB_NADDR16_LO"}, - {104, "R_PPC_EMB_NADDR16_HI"}, - {105, "R_PPC_EMB_NADDR16_HA"}, - {106, "R_PPC_EMB_SDAI16"}, - {107, "R_PPC_EMB_SDA2I16"}, - {108, "R_PPC_EMB_SDA2REL"}, - {109, "R_PPC_EMB_SDA21"}, - {110, "R_PPC_EMB_MRKREF"}, - {111, "R_PPC_EMB_RELSEC16"}, - {112, "R_PPC_EMB_RELST_LO"}, - {113, "R_PPC_EMB_RELST_HI"}, - {114, "R_PPC_EMB_RELST_HA"}, - {115, "R_PPC_EMB_BIT_FLD"}, - {116, "R_PPC_EMB_RELSDA"}, -} - -func (i R_PPC) String() string { return stringName(uint32(i), rppcStrings, false) } -func (i R_PPC) GoString() string { return stringName(uint32(i), rppcStrings, true) } - -// Relocation types for 64-bit PowerPC or Power Architecture processors. -type R_PPC64 int - -const ( - R_PPC64_NONE R_PPC64 = 0 - R_PPC64_ADDR32 R_PPC64 = 1 - R_PPC64_ADDR24 R_PPC64 = 2 - R_PPC64_ADDR16 R_PPC64 = 3 - R_PPC64_ADDR16_LO R_PPC64 = 4 - R_PPC64_ADDR16_HI R_PPC64 = 5 - R_PPC64_ADDR16_HA R_PPC64 = 6 - R_PPC64_ADDR14 R_PPC64 = 7 - R_PPC64_ADDR14_BRTAKEN R_PPC64 = 8 - R_PPC64_ADDR14_BRNTAKEN R_PPC64 = 9 - R_PPC64_REL24 R_PPC64 = 10 - R_PPC64_REL14 R_PPC64 = 11 - R_PPC64_REL14_BRTAKEN R_PPC64 = 12 - R_PPC64_REL14_BRNTAKEN R_PPC64 = 13 - R_PPC64_GOT16 R_PPC64 = 14 - R_PPC64_GOT16_LO R_PPC64 = 15 - R_PPC64_GOT16_HI R_PPC64 = 16 - R_PPC64_GOT16_HA R_PPC64 = 17 - R_PPC64_JMP_SLOT R_PPC64 = 21 - R_PPC64_REL32 R_PPC64 = 26 - R_PPC64_ADDR64 R_PPC64 = 38 - R_PPC64_ADDR16_HIGHER R_PPC64 = 39 - R_PPC64_ADDR16_HIGHERA R_PPC64 = 40 - R_PPC64_ADDR16_HIGHEST R_PPC64 = 41 - R_PPC64_ADDR16_HIGHESTA R_PPC64 = 42 - R_PPC64_REL64 R_PPC64 = 44 - R_PPC64_TOC16 R_PPC64 = 47 - R_PPC64_TOC16_LO R_PPC64 = 48 - R_PPC64_TOC16_HI R_PPC64 = 49 - R_PPC64_TOC16_HA R_PPC64 = 50 - R_PPC64_TOC R_PPC64 = 51 - R_PPC64_ADDR16_DS R_PPC64 = 56 - R_PPC64_ADDR16_LO_DS R_PPC64 = 57 - R_PPC64_GOT16_DS R_PPC64 = 58 - R_PPC64_GOT16_LO_DS R_PPC64 = 59 - R_PPC64_TOC16_DS R_PPC64 = 63 - R_PPC64_TOC16_LO_DS R_PPC64 = 64 - R_PPC64_TLS R_PPC64 = 67 - R_PPC64_DTPMOD64 R_PPC64 = 68 - R_PPC64_TPREL16 R_PPC64 = 69 - R_PPC64_TPREL16_LO R_PPC64 = 70 - R_PPC64_TPREL16_HI R_PPC64 = 71 - R_PPC64_TPREL16_HA R_PPC64 = 72 - R_PPC64_TPREL64 R_PPC64 = 73 - R_PPC64_DTPREL16 R_PPC64 = 74 - R_PPC64_DTPREL16_LO R_PPC64 = 75 - R_PPC64_DTPREL16_HI R_PPC64 = 76 - R_PPC64_DTPREL16_HA R_PPC64 = 77 - R_PPC64_DTPREL64 R_PPC64 = 78 - R_PPC64_GOT_TLSGD16 R_PPC64 = 79 - R_PPC64_GOT_TLSGD16_LO R_PPC64 = 80 - R_PPC64_GOT_TLSGD16_HI R_PPC64 = 81 - R_PPC64_GOT_TLSGD16_HA R_PPC64 = 82 - R_PPC64_GOT_TLSLD16 R_PPC64 = 83 - R_PPC64_GOT_TLSLD16_LO R_PPC64 = 84 - R_PPC64_GOT_TLSLD16_HI R_PPC64 = 85 - R_PPC64_GOT_TLSLD16_HA R_PPC64 = 86 - R_PPC64_GOT_TPREL16_DS R_PPC64 = 87 - R_PPC64_GOT_TPREL16_LO_DS R_PPC64 = 88 - R_PPC64_GOT_TPREL16_HI R_PPC64 = 89 - R_PPC64_GOT_TPREL16_HA R_PPC64 = 90 - R_PPC64_GOT_DTPREL16_DS R_PPC64 = 91 - R_PPC64_GOT_DTPREL16_LO_DS R_PPC64 = 92 - R_PPC64_GOT_DTPREL16_HI R_PPC64 = 93 - R_PPC64_GOT_DTPREL16_HA R_PPC64 = 94 - R_PPC64_TPREL16_DS R_PPC64 = 95 - R_PPC64_TPREL16_LO_DS R_PPC64 = 96 - R_PPC64_TPREL16_HIGHER R_PPC64 = 97 - R_PPC64_TPREL16_HIGHERA R_PPC64 = 98 - R_PPC64_TPREL16_HIGHEST R_PPC64 = 99 - R_PPC64_TPREL16_HIGHESTA R_PPC64 = 100 - R_PPC64_DTPREL16_DS R_PPC64 = 101 - R_PPC64_DTPREL16_LO_DS R_PPC64 = 102 - R_PPC64_DTPREL16_HIGHER R_PPC64 = 103 - R_PPC64_DTPREL16_HIGHERA R_PPC64 = 104 - R_PPC64_DTPREL16_HIGHEST R_PPC64 = 105 - R_PPC64_DTPREL16_HIGHESTA R_PPC64 = 106 - R_PPC64_TLSGD R_PPC64 = 107 - R_PPC64_TLSLD R_PPC64 = 108 - R_PPC64_REL16 R_PPC64 = 249 - R_PPC64_REL16_LO R_PPC64 = 250 - R_PPC64_REL16_HI R_PPC64 = 251 - R_PPC64_REL16_HA R_PPC64 = 252 -) - -var rppc64Strings = []intName{ - {0, "R_PPC64_NONE"}, - {1, "R_PPC64_ADDR32"}, - {2, "R_PPC64_ADDR24"}, - {3, "R_PPC64_ADDR16"}, - {4, "R_PPC64_ADDR16_LO"}, - {5, "R_PPC64_ADDR16_HI"}, - {6, "R_PPC64_ADDR16_HA"}, - {7, "R_PPC64_ADDR14"}, - {8, "R_PPC64_ADDR14_BRTAKEN"}, - {9, "R_PPC64_ADDR14_BRNTAKEN"}, - {10, "R_PPC64_REL24"}, - {11, "R_PPC64_REL14"}, - {12, "R_PPC64_REL14_BRTAKEN"}, - {13, "R_PPC64_REL14_BRNTAKEN"}, - {14, "R_PPC64_GOT16"}, - {15, "R_PPC64_GOT16_LO"}, - {16, "R_PPC64_GOT16_HI"}, - {17, "R_PPC64_GOT16_HA"}, - {21, "R_PPC64_JMP_SLOT"}, - {26, "R_PPC64_REL32"}, - {38, "R_PPC64_ADDR64"}, - {39, "R_PPC64_ADDR16_HIGHER"}, - {40, "R_PPC64_ADDR16_HIGHERA"}, - {41, "R_PPC64_ADDR16_HIGHEST"}, - {42, "R_PPC64_ADDR16_HIGHESTA"}, - {44, "R_PPC64_REL64"}, - {47, "R_PPC64_TOC16"}, - {48, "R_PPC64_TOC16_LO"}, - {49, "R_PPC64_TOC16_HI"}, - {50, "R_PPC64_TOC16_HA"}, - {51, "R_PPC64_TOC"}, - {56, "R_PPC64_ADDR16_DS"}, - {57, "R_PPC64_ADDR16_LO_DS"}, - {58, "R_PPC64_GOT16_DS"}, - {59, "R_PPC64_GOT16_LO_DS"}, - {63, "R_PPC64_TOC16_DS"}, - {64, "R_PPC64_TOC16_LO_DS"}, - {67, "R_PPC64_TLS"}, - {68, "R_PPC64_DTPMOD64"}, - {69, "R_PPC64_TPREL16"}, - {70, "R_PPC64_TPREL16_LO"}, - {71, "R_PPC64_TPREL16_HI"}, - {72, "R_PPC64_TPREL16_HA"}, - {73, "R_PPC64_TPREL64"}, - {74, "R_PPC64_DTPREL16"}, - {75, "R_PPC64_DTPREL16_LO"}, - {76, "R_PPC64_DTPREL16_HI"}, - {77, "R_PPC64_DTPREL16_HA"}, - {78, "R_PPC64_DTPREL64"}, - {79, "R_PPC64_GOT_TLSGD16"}, - {80, "R_PPC64_GOT_TLSGD16_LO"}, - {81, "R_PPC64_GOT_TLSGD16_HI"}, - {82, "R_PPC64_GOT_TLSGD16_HA"}, - {83, "R_PPC64_GOT_TLSLD16"}, - {84, "R_PPC64_GOT_TLSLD16_LO"}, - {85, "R_PPC64_GOT_TLSLD16_HI"}, - {86, "R_PPC64_GOT_TLSLD16_HA"}, - {87, "R_PPC64_GOT_TPREL16_DS"}, - {88, "R_PPC64_GOT_TPREL16_LO_DS"}, - {89, "R_PPC64_GOT_TPREL16_HI"}, - {90, "R_PPC64_GOT_TPREL16_HA"}, - {91, "R_PPC64_GOT_DTPREL16_DS"}, - {92, "R_PPC64_GOT_DTPREL16_LO_DS"}, - {93, "R_PPC64_GOT_DTPREL16_HI"}, - {94, "R_PPC64_GOT_DTPREL16_HA"}, - {95, "R_PPC64_TPREL16_DS"}, - {96, "R_PPC64_TPREL16_LO_DS"}, - {97, "R_PPC64_TPREL16_HIGHER"}, - {98, "R_PPC64_TPREL16_HIGHERA"}, - {99, "R_PPC64_TPREL16_HIGHEST"}, - {100, "R_PPC64_TPREL16_HIGHESTA"}, - {101, "R_PPC64_DTPREL16_DS"}, - {102, "R_PPC64_DTPREL16_LO_DS"}, - {103, "R_PPC64_DTPREL16_HIGHER"}, - {104, "R_PPC64_DTPREL16_HIGHERA"}, - {105, "R_PPC64_DTPREL16_HIGHEST"}, - {106, "R_PPC64_DTPREL16_HIGHESTA"}, - {107, "R_PPC64_TLSGD"}, - {108, "R_PPC64_TLSLD"}, - {249, "R_PPC64_REL16"}, - {250, "R_PPC64_REL16_LO"}, - {251, "R_PPC64_REL16_HI"}, - {252, "R_PPC64_REL16_HA"}, -} - -func (i R_PPC64) String() string { return stringName(uint32(i), rppc64Strings, false) } -func (i R_PPC64) GoString() string { return stringName(uint32(i), rppc64Strings, true) } - -// Relocation types for s390 -type R_390 int - -const ( - R_390_NONE R_390 = 0 - R_390_8 R_390 = 1 - R_390_12 R_390 = 2 - R_390_16 R_390 = 3 - R_390_32 R_390 = 4 - R_390_PC32 R_390 = 5 - R_390_GOT12 R_390 = 6 - R_390_GOT32 R_390 = 7 - R_390_PLT32 R_390 = 8 - R_390_COPY R_390 = 9 - R_390_GLOB_DAT R_390 = 10 - R_390_JMP_SLOT R_390 = 11 - R_390_RELATIVE R_390 = 12 - R_390_GOTOFF R_390 = 13 - R_390_GOTPC R_390 = 14 - R_390_GOT16 R_390 = 15 - R_390_PC16 R_390 = 16 - R_390_PC16DBL R_390 = 17 - R_390_PLT16DBL R_390 = 18 - R_390_PC32DBL R_390 = 19 - R_390_PLT32DBL R_390 = 20 - R_390_GOTPCDBL R_390 = 21 - R_390_64 R_390 = 22 - R_390_PC64 R_390 = 23 - R_390_GOT64 R_390 = 24 - R_390_PLT64 R_390 = 25 - R_390_GOTENT R_390 = 26 -) - -var r390Strings = []intName{ - {0, "R_390_NONE"}, - {1, "R_390_8"}, - {2, "R_390_12"}, - {3, "R_390_16"}, - {4, "R_390_32"}, - {5, "R_390_PC32"}, - {6, "R_390_GOT12"}, - {7, "R_390_GOT32"}, - {8, "R_390_PLT32"}, - {9, "R_390_COPY"}, - {10, "R_390_GLOB_DAT"}, - {11, "R_390_JMP_SLOT"}, - {12, "R_390_RELATIVE"}, - {13, "R_390_GOTOFF"}, - {14, "R_390_GOTPC"}, - {15, "R_390_GOT16"}, - {16, "R_390_PC16"}, - {17, "R_390_PC16DBL"}, - {18, "R_390_PLT16DBL"}, - {19, "R_390_PC32DBL"}, - {20, "R_390_PLT32DBL"}, - {21, "R_390_GOTPCDBL"}, - {22, "R_390_64"}, - {23, "R_390_PC64"}, - {24, "R_390_GOT64"}, - {25, "R_390_PLT64"}, - {26, "R_390_GOTENT"}, -} - -func (i R_390) String() string { return stringName(uint32(i), r390Strings, false) } -func (i R_390) GoString() string { return stringName(uint32(i), r390Strings, true) } - -// Relocation types for SPARC. -type R_SPARC int - -const ( - R_SPARC_NONE R_SPARC = 0 - R_SPARC_8 R_SPARC = 1 - R_SPARC_16 R_SPARC = 2 - R_SPARC_32 R_SPARC = 3 - R_SPARC_DISP8 R_SPARC = 4 - R_SPARC_DISP16 R_SPARC = 5 - R_SPARC_DISP32 R_SPARC = 6 - R_SPARC_WDISP30 R_SPARC = 7 - R_SPARC_WDISP22 R_SPARC = 8 - R_SPARC_HI22 R_SPARC = 9 - R_SPARC_22 R_SPARC = 10 - R_SPARC_13 R_SPARC = 11 - R_SPARC_LO10 R_SPARC = 12 - R_SPARC_GOT10 R_SPARC = 13 - R_SPARC_GOT13 R_SPARC = 14 - R_SPARC_GOT22 R_SPARC = 15 - R_SPARC_PC10 R_SPARC = 16 - R_SPARC_PC22 R_SPARC = 17 - R_SPARC_WPLT30 R_SPARC = 18 - R_SPARC_COPY R_SPARC = 19 - R_SPARC_GLOB_DAT R_SPARC = 20 - R_SPARC_JMP_SLOT R_SPARC = 21 - R_SPARC_RELATIVE R_SPARC = 22 - R_SPARC_UA32 R_SPARC = 23 - R_SPARC_PLT32 R_SPARC = 24 - R_SPARC_HIPLT22 R_SPARC = 25 - R_SPARC_LOPLT10 R_SPARC = 26 - R_SPARC_PCPLT32 R_SPARC = 27 - R_SPARC_PCPLT22 R_SPARC = 28 - R_SPARC_PCPLT10 R_SPARC = 29 - R_SPARC_10 R_SPARC = 30 - R_SPARC_11 R_SPARC = 31 - R_SPARC_64 R_SPARC = 32 - R_SPARC_OLO10 R_SPARC = 33 - R_SPARC_HH22 R_SPARC = 34 - R_SPARC_HM10 R_SPARC = 35 - R_SPARC_LM22 R_SPARC = 36 - R_SPARC_PC_HH22 R_SPARC = 37 - R_SPARC_PC_HM10 R_SPARC = 38 - R_SPARC_PC_LM22 R_SPARC = 39 - R_SPARC_WDISP16 R_SPARC = 40 - R_SPARC_WDISP19 R_SPARC = 41 - R_SPARC_GLOB_JMP R_SPARC = 42 - R_SPARC_7 R_SPARC = 43 - R_SPARC_5 R_SPARC = 44 - R_SPARC_6 R_SPARC = 45 - R_SPARC_DISP64 R_SPARC = 46 - R_SPARC_PLT64 R_SPARC = 47 - R_SPARC_HIX22 R_SPARC = 48 - R_SPARC_LOX10 R_SPARC = 49 - R_SPARC_H44 R_SPARC = 50 - R_SPARC_M44 R_SPARC = 51 - R_SPARC_L44 R_SPARC = 52 - R_SPARC_REGISTER R_SPARC = 53 - R_SPARC_UA64 R_SPARC = 54 - R_SPARC_UA16 R_SPARC = 55 -) - -var rsparcStrings = []intName{ - {0, "R_SPARC_NONE"}, - {1, "R_SPARC_8"}, - {2, "R_SPARC_16"}, - {3, "R_SPARC_32"}, - {4, "R_SPARC_DISP8"}, - {5, "R_SPARC_DISP16"}, - {6, "R_SPARC_DISP32"}, - {7, "R_SPARC_WDISP30"}, - {8, "R_SPARC_WDISP22"}, - {9, "R_SPARC_HI22"}, - {10, "R_SPARC_22"}, - {11, "R_SPARC_13"}, - {12, "R_SPARC_LO10"}, - {13, "R_SPARC_GOT10"}, - {14, "R_SPARC_GOT13"}, - {15, "R_SPARC_GOT22"}, - {16, "R_SPARC_PC10"}, - {17, "R_SPARC_PC22"}, - {18, "R_SPARC_WPLT30"}, - {19, "R_SPARC_COPY"}, - {20, "R_SPARC_GLOB_DAT"}, - {21, "R_SPARC_JMP_SLOT"}, - {22, "R_SPARC_RELATIVE"}, - {23, "R_SPARC_UA32"}, - {24, "R_SPARC_PLT32"}, - {25, "R_SPARC_HIPLT22"}, - {26, "R_SPARC_LOPLT10"}, - {27, "R_SPARC_PCPLT32"}, - {28, "R_SPARC_PCPLT22"}, - {29, "R_SPARC_PCPLT10"}, - {30, "R_SPARC_10"}, - {31, "R_SPARC_11"}, - {32, "R_SPARC_64"}, - {33, "R_SPARC_OLO10"}, - {34, "R_SPARC_HH22"}, - {35, "R_SPARC_HM10"}, - {36, "R_SPARC_LM22"}, - {37, "R_SPARC_PC_HH22"}, - {38, "R_SPARC_PC_HM10"}, - {39, "R_SPARC_PC_LM22"}, - {40, "R_SPARC_WDISP16"}, - {41, "R_SPARC_WDISP19"}, - {42, "R_SPARC_GLOB_JMP"}, - {43, "R_SPARC_7"}, - {44, "R_SPARC_5"}, - {45, "R_SPARC_6"}, - {46, "R_SPARC_DISP64"}, - {47, "R_SPARC_PLT64"}, - {48, "R_SPARC_HIX22"}, - {49, "R_SPARC_LOX10"}, - {50, "R_SPARC_H44"}, - {51, "R_SPARC_M44"}, - {52, "R_SPARC_L44"}, - {53, "R_SPARC_REGISTER"}, - {54, "R_SPARC_UA64"}, - {55, "R_SPARC_UA16"}, -} - -func (i R_SPARC) String() string { return stringName(uint32(i), rsparcStrings, false) } -func (i R_SPARC) GoString() string { return stringName(uint32(i), rsparcStrings, true) } - -// Magic number for the elf trampoline, chosen wisely to be an immediate value. -const ARM_MAGIC_TRAMP_NUMBER = 0x5c000003 - -// ELF32 File header. -type Header32 struct { - Ident [EI_NIDENT]byte /* File identification. */ - Type uint16 /* File type. */ - Machine uint16 /* Machine architecture. */ - Version uint32 /* ELF format version. */ - Entry uint32 /* Entry point. */ - Phoff uint32 /* Program header file offset. */ - Shoff uint32 /* Section header file offset. */ - Flags uint32 /* Architecture-specific flags. */ - Ehsize uint16 /* Size of ELF header in bytes. */ - Phentsize uint16 /* Size of program header entry. */ - Phnum uint16 /* Number of program header entries. */ - Shentsize uint16 /* Size of section header entry. */ - Shnum uint16 /* Number of section header entries. */ - Shstrndx uint16 /* Section name strings section. */ -} - -// ELF32 Section header. -type Section32 struct { - Name uint32 /* Section name (index into the section header string table). */ - Type uint32 /* Section type. */ - Flags uint32 /* Section flags. */ - Addr uint32 /* Address in memory image. */ - Off uint32 /* Offset in file. */ - Size uint32 /* Size in bytes. */ - Link uint32 /* Index of a related section. */ - Info uint32 /* Depends on section type. */ - Addralign uint32 /* Alignment in bytes. */ - Entsize uint32 /* Size of each entry in section. */ -} - -// ELF32 Program header. -type Prog32 struct { - Type uint32 /* Entry type. */ - Off uint32 /* File offset of contents. */ - Vaddr uint32 /* Virtual address in memory image. */ - Paddr uint32 /* Physical address (not used). */ - Filesz uint32 /* Size of contents in file. */ - Memsz uint32 /* Size of contents in memory. */ - Flags uint32 /* Access permission flags. */ - Align uint32 /* Alignment in memory and file. */ -} - -// ELF32 Dynamic structure. The ".dynamic" section contains an array of them. -type Dyn32 struct { - Tag int32 /* Entry type. */ - Val uint32 /* Integer/Address value. */ -} - -/* - * Relocation entries. - */ - -// ELF32 Relocations that don't need an addend field. -type Rel32 struct { - Off uint32 /* Location to be relocated. */ - Info uint32 /* Relocation type and symbol index. */ -} - -// ELF32 Relocations that need an addend field. -type Rela32 struct { - Off uint32 /* Location to be relocated. */ - Info uint32 /* Relocation type and symbol index. */ - Addend int32 /* Addend. */ -} - -func R_SYM32(info uint32) uint32 { return uint32(info >> 8) } -func R_TYPE32(info uint32) uint32 { return uint32(info & 0xff) } -func R_INFO32(sym, typ uint32) uint32 { return sym<<8 | typ } - -// ELF32 Symbol. -type Sym32 struct { - Name uint32 - Value uint32 - Size uint32 - Info uint8 - Other uint8 - Shndx uint16 -} - -const Sym32Size = 16 - -func ST_BIND(info uint8) SymBind { return SymBind(info >> 4) } -func ST_TYPE(info uint8) SymType { return SymType(info & 0xF) } -func ST_INFO(bind SymBind, typ SymType) uint8 { - return uint8(bind)<<4 | uint8(typ)&0xf -} -func ST_VISIBILITY(other uint8) SymVis { return SymVis(other & 3) } - -/* - * ELF64 - */ - -// ELF64 file header. -type Header64 struct { - Ident [EI_NIDENT]byte /* File identification. */ - Type uint16 /* File type. */ - Machine uint16 /* Machine architecture. */ - Version uint32 /* ELF format version. */ - Entry uint64 /* Entry point. */ - Phoff uint64 /* Program header file offset. */ - Shoff uint64 /* Section header file offset. */ - Flags uint32 /* Architecture-specific flags. */ - Ehsize uint16 /* Size of ELF header in bytes. */ - Phentsize uint16 /* Size of program header entry. */ - Phnum uint16 /* Number of program header entries. */ - Shentsize uint16 /* Size of section header entry. */ - Shnum uint16 /* Number of section header entries. */ - Shstrndx uint16 /* Section name strings section. */ -} - -// ELF64 Section header. -type Section64 struct { - Name uint32 /* Section name (index into the section header string table). */ - Type uint32 /* Section type. */ - Flags uint64 /* Section flags. */ - Addr uint64 /* Address in memory image. */ - Off uint64 /* Offset in file. */ - Size uint64 /* Size in bytes. */ - Link uint32 /* Index of a related section. */ - Info uint32 /* Depends on section type. */ - Addralign uint64 /* Alignment in bytes. */ - Entsize uint64 /* Size of each entry in section. */ -} - -// ELF64 Program header. -type Prog64 struct { - Type uint32 /* Entry type. */ - Flags uint32 /* Access permission flags. */ - Off uint64 /* File offset of contents. */ - Vaddr uint64 /* Virtual address in memory image. */ - Paddr uint64 /* Physical address (not used). */ - Filesz uint64 /* Size of contents in file. */ - Memsz uint64 /* Size of contents in memory. */ - Align uint64 /* Alignment in memory and file. */ -} - -// ELF64 Dynamic structure. The ".dynamic" section contains an array of them. -type Dyn64 struct { - Tag int64 /* Entry type. */ - Val uint64 /* Integer/address value */ -} - -/* - * Relocation entries. - */ - -/* ELF64 relocations that don't need an addend field. */ -type Rel64 struct { - Off uint64 /* Location to be relocated. */ - Info uint64 /* Relocation type and symbol index. */ -} - -/* ELF64 relocations that need an addend field. */ -type Rela64 struct { - Off uint64 /* Location to be relocated. */ - Info uint64 /* Relocation type and symbol index. */ - Addend int64 /* Addend. */ -} - -func R_SYM64(info uint64) uint32 { return uint32(info >> 32) } -func R_TYPE64(info uint64) uint32 { return uint32(info) } -func R_INFO(sym, typ uint32) uint64 { return uint64(sym)<<32 | uint64(typ) } - -// ELF64 symbol table entries. -type Sym64 struct { - Name uint32 /* String table index of name. */ - Info uint8 /* Type and binding information. */ - Other uint8 /* Reserved (not used). */ - Shndx uint16 /* Section index of symbol. */ - Value uint64 /* Symbol value. */ - Size uint64 /* Size of associated object. */ -} - -const Sym64Size = 24 - -type intName struct { - i uint32 - s string -} - -func stringName(i uint32, names []intName, goSyntax bool) string { - for _, n := range names { - if n.i == i { - if goSyntax { - return "elf." + n.s - } - return n.s - } - } - - // second pass - look for smaller to add with. - // assume sorted already - for j := len(names) - 1; j >= 0; j-- { - n := names[j] - if n.i < i { - s := n.s - if goSyntax { - s = "elf." + s - } - return s + "+" + strconv.FormatUint(uint64(i-n.i), 10) - } - } - - return strconv.FormatUint(uint64(i), 10) -} - -func flagName(i uint32, names []intName, goSyntax bool) string { - s := "" - for _, n := range names { - if n.i&i == n.i { - if len(s) > 0 { - s += "+" - } - if goSyntax { - s += "elf." - } - s += n.s - i -= n.i - } - } - if len(s) == 0 { - return "0x" + strconv.FormatUint(uint64(i), 16) - } - if i != 0 { - s += "+0x" + strconv.FormatUint(uint64(i), 16) - } - return s -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/elf_test.go b/llgo/third_party/gofrontend/libgo/go/debug/elf/elf_test.go deleted file mode 100644 index e3c51bb717b20661cc69e7b77fc1f7892e79b980..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/elf_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elf - -import ( - "fmt" - "testing" -) - -type nameTest struct { - val interface{} - str string -} - -var nameTests = []nameTest{ - {ELFOSABI_LINUX, "ELFOSABI_LINUX"}, - {ET_EXEC, "ET_EXEC"}, - {EM_860, "EM_860"}, - {SHN_LOPROC, "SHN_LOPROC"}, - {SHT_PROGBITS, "SHT_PROGBITS"}, - {SHF_MERGE + SHF_TLS, "SHF_MERGE+SHF_TLS"}, - {PT_LOAD, "PT_LOAD"}, - {PF_W + PF_R + 0x50, "PF_W+PF_R+0x50"}, - {DT_SYMBOLIC, "DT_SYMBOLIC"}, - {DF_BIND_NOW, "DF_BIND_NOW"}, - {NT_FPREGSET, "NT_FPREGSET"}, - {STB_GLOBAL, "STB_GLOBAL"}, - {STT_COMMON, "STT_COMMON"}, - {STV_HIDDEN, "STV_HIDDEN"}, - {R_X86_64_PC32, "R_X86_64_PC32"}, - {R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"}, - {R_ARM_THM_ABS5, "R_ARM_THM_ABS5"}, - {R_386_GOT32, "R_386_GOT32"}, - {R_PPC_GOT16_HI, "R_PPC_GOT16_HI"}, - {R_SPARC_GOT22, "R_SPARC_GOT22"}, - {ET_LOOS + 5, "ET_LOOS+5"}, - {ProgFlag(0x50), "0x50"}, -} - -func TestNames(t *testing.T) { - for i, tt := range nameTests { - s := fmt.Sprint(tt.val) - if s != tt.str { - t.Errorf("#%d: Sprint(%d) = %q, want %q", i, tt.val, s, tt.str) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/file.go b/llgo/third_party/gofrontend/libgo/go/debug/elf/file.go deleted file mode 100644 index 370c5e6437c94e5aaa34421a6d3fe41d708dbe95..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/file.go +++ /dev/null @@ -1,1107 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package elf implements access to ELF object files. -package elf - -import ( - "bytes" - "debug/dwarf" - "encoding/binary" - "errors" - "fmt" - "io" - "os" - "strings" -) - -// TODO: error reporting detail - -/* - * Internal ELF representation - */ - -// A FileHeader represents an ELF file header. -type FileHeader struct { - Class Class - Data Data - Version Version - OSABI OSABI - ABIVersion uint8 - ByteOrder binary.ByteOrder - Type Type - Machine Machine - Entry uint64 -} - -// A File represents an open ELF file. -type File struct { - FileHeader - Sections []*Section - Progs []*Prog - closer io.Closer - gnuNeed []verneed - gnuVersym []byte -} - -// A SectionHeader represents a single ELF section header. -type SectionHeader struct { - Name string - Type SectionType - Flags SectionFlag - Addr uint64 - Offset uint64 - Size uint64 - Link uint32 - Info uint32 - Addralign uint64 - Entsize uint64 -} - -// A Section represents a single section in an ELF file. -type Section struct { - SectionHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -// Data reads and returns the contents of the ELF section. -func (s *Section) Data() ([]byte, error) { - dat := make([]byte, s.sr.Size()) - n, err := s.sr.ReadAt(dat, 0) - if n == len(dat) { - err = nil - } - return dat[0:n], err -} - -// stringTable reads and returns the string table given by the -// specified link value. -func (f *File) stringTable(link uint32) ([]byte, error) { - if link <= 0 || link >= uint32(len(f.Sections)) { - return nil, errors.New("section has invalid string table link") - } - return f.Sections[link].Data() -} - -// Open returns a new ReadSeeker reading the ELF section. -func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } - -// A ProgHeader represents a single ELF program header. -type ProgHeader struct { - Type ProgType - Flags ProgFlag - Off uint64 - Vaddr uint64 - Paddr uint64 - Filesz uint64 - Memsz uint64 - Align uint64 -} - -// A Prog represents a single ELF program header in an ELF binary. -type Prog struct { - ProgHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -// Open returns a new ReadSeeker reading the ELF program body. -func (p *Prog) Open() io.ReadSeeker { return io.NewSectionReader(p.sr, 0, 1<<63-1) } - -// A Symbol represents an entry in an ELF symbol table section. -type Symbol struct { - Name string - Info, Other byte - Section SectionIndex - Value, Size uint64 -} - -/* - * ELF reader - */ - -type FormatError struct { - off int64 - msg string - val interface{} -} - -func (e *FormatError) Error() string { - msg := e.msg - if e.val != nil { - msg += fmt.Sprintf(" '%v' ", e.val) - } - msg += fmt.Sprintf("in record at byte %#x", e.off) - return msg -} - -// Open opens the named file using os.Open and prepares it for use as an ELF binary. -func Open(name string) (*File, error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - ff, err := NewFile(f) - if err != nil { - f.Close() - return nil, err - } - ff.closer = f - return ff, nil -} - -// Close closes the File. -// If the File was created using NewFile directly instead of Open, -// Close has no effect. -func (f *File) Close() error { - var err error - if f.closer != nil { - err = f.closer.Close() - f.closer = nil - } - return err -} - -// SectionByType returns the first section in f with the -// given type, or nil if there is no such section. -func (f *File) SectionByType(typ SectionType) *Section { - for _, s := range f.Sections { - if s.Type == typ { - return s - } - } - return nil -} - -// NewFile creates a new File for accessing an ELF binary in an underlying reader. -// The ELF binary is expected to start at position 0 in the ReaderAt. -func NewFile(r io.ReaderAt) (*File, error) { - sr := io.NewSectionReader(r, 0, 1<<63-1) - // Read and decode ELF identifier - var ident [16]uint8 - if _, err := r.ReadAt(ident[0:], 0); err != nil { - return nil, err - } - if ident[0] != '\x7f' || ident[1] != 'E' || ident[2] != 'L' || ident[3] != 'F' { - return nil, &FormatError{0, "bad magic number", ident[0:4]} - } - - f := new(File) - f.Class = Class(ident[EI_CLASS]) - switch f.Class { - case ELFCLASS32: - case ELFCLASS64: - // ok - default: - return nil, &FormatError{0, "unknown ELF class", f.Class} - } - - f.Data = Data(ident[EI_DATA]) - switch f.Data { - case ELFDATA2LSB: - f.ByteOrder = binary.LittleEndian - case ELFDATA2MSB: - f.ByteOrder = binary.BigEndian - default: - return nil, &FormatError{0, "unknown ELF data encoding", f.Data} - } - - f.Version = Version(ident[EI_VERSION]) - if f.Version != EV_CURRENT { - return nil, &FormatError{0, "unknown ELF version", f.Version} - } - - f.OSABI = OSABI(ident[EI_OSABI]) - f.ABIVersion = ident[EI_ABIVERSION] - - // Read ELF file header - var phoff int64 - var phentsize, phnum int - var shoff int64 - var shentsize, shnum, shstrndx int - shstrndx = -1 - switch f.Class { - case ELFCLASS32: - hdr := new(Header32) - sr.Seek(0, os.SEEK_SET) - if err := binary.Read(sr, f.ByteOrder, hdr); err != nil { - return nil, err - } - f.Type = Type(hdr.Type) - f.Machine = Machine(hdr.Machine) - f.Entry = uint64(hdr.Entry) - if v := Version(hdr.Version); v != f.Version { - return nil, &FormatError{0, "mismatched ELF version", v} - } - phoff = int64(hdr.Phoff) - phentsize = int(hdr.Phentsize) - phnum = int(hdr.Phnum) - shoff = int64(hdr.Shoff) - shentsize = int(hdr.Shentsize) - shnum = int(hdr.Shnum) - shstrndx = int(hdr.Shstrndx) - case ELFCLASS64: - hdr := new(Header64) - sr.Seek(0, os.SEEK_SET) - if err := binary.Read(sr, f.ByteOrder, hdr); err != nil { - return nil, err - } - f.Type = Type(hdr.Type) - f.Machine = Machine(hdr.Machine) - f.Entry = uint64(hdr.Entry) - if v := Version(hdr.Version); v != f.Version { - return nil, &FormatError{0, "mismatched ELF version", v} - } - phoff = int64(hdr.Phoff) - phentsize = int(hdr.Phentsize) - phnum = int(hdr.Phnum) - shoff = int64(hdr.Shoff) - shentsize = int(hdr.Shentsize) - shnum = int(hdr.Shnum) - shstrndx = int(hdr.Shstrndx) - } - - if shnum > 0 && shoff > 0 && (shstrndx < 0 || shstrndx >= shnum) { - return nil, &FormatError{0, "invalid ELF shstrndx", shstrndx} - } - - // Read program headers - f.Progs = make([]*Prog, phnum) - for i := 0; i < phnum; i++ { - off := phoff + int64(i)*int64(phentsize) - sr.Seek(off, os.SEEK_SET) - p := new(Prog) - switch f.Class { - case ELFCLASS32: - ph := new(Prog32) - if err := binary.Read(sr, f.ByteOrder, ph); err != nil { - return nil, err - } - p.ProgHeader = ProgHeader{ - Type: ProgType(ph.Type), - Flags: ProgFlag(ph.Flags), - Off: uint64(ph.Off), - Vaddr: uint64(ph.Vaddr), - Paddr: uint64(ph.Paddr), - Filesz: uint64(ph.Filesz), - Memsz: uint64(ph.Memsz), - Align: uint64(ph.Align), - } - case ELFCLASS64: - ph := new(Prog64) - if err := binary.Read(sr, f.ByteOrder, ph); err != nil { - return nil, err - } - p.ProgHeader = ProgHeader{ - Type: ProgType(ph.Type), - Flags: ProgFlag(ph.Flags), - Off: uint64(ph.Off), - Vaddr: uint64(ph.Vaddr), - Paddr: uint64(ph.Paddr), - Filesz: uint64(ph.Filesz), - Memsz: uint64(ph.Memsz), - Align: uint64(ph.Align), - } - } - p.sr = io.NewSectionReader(r, int64(p.Off), int64(p.Filesz)) - p.ReaderAt = p.sr - f.Progs[i] = p - } - - // Read section headers - f.Sections = make([]*Section, shnum) - names := make([]uint32, shnum) - for i := 0; i < shnum; i++ { - off := shoff + int64(i)*int64(shentsize) - sr.Seek(off, os.SEEK_SET) - s := new(Section) - switch f.Class { - case ELFCLASS32: - sh := new(Section32) - if err := binary.Read(sr, f.ByteOrder, sh); err != nil { - return nil, err - } - names[i] = sh.Name - s.SectionHeader = SectionHeader{ - Type: SectionType(sh.Type), - Flags: SectionFlag(sh.Flags), - Addr: uint64(sh.Addr), - Offset: uint64(sh.Off), - Size: uint64(sh.Size), - Link: uint32(sh.Link), - Info: uint32(sh.Info), - Addralign: uint64(sh.Addralign), - Entsize: uint64(sh.Entsize), - } - case ELFCLASS64: - sh := new(Section64) - if err := binary.Read(sr, f.ByteOrder, sh); err != nil { - return nil, err - } - names[i] = sh.Name - s.SectionHeader = SectionHeader{ - Type: SectionType(sh.Type), - Flags: SectionFlag(sh.Flags), - Offset: uint64(sh.Off), - Size: uint64(sh.Size), - Addr: uint64(sh.Addr), - Link: uint32(sh.Link), - Info: uint32(sh.Info), - Addralign: uint64(sh.Addralign), - Entsize: uint64(sh.Entsize), - } - } - s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.Size)) - s.ReaderAt = s.sr - f.Sections[i] = s - } - - if len(f.Sections) == 0 { - return f, nil - } - - // Load section header string table. - shstrtab, err := f.Sections[shstrndx].Data() - if err != nil { - return nil, err - } - for i, s := range f.Sections { - var ok bool - s.Name, ok = getString(shstrtab, int(names[i])) - if !ok { - return nil, &FormatError{shoff + int64(i*shentsize), "bad section name index", names[i]} - } - } - - return f, nil -} - -// getSymbols returns a slice of Symbols from parsing the symbol table -// with the given type, along with the associated string table. -func (f *File) getSymbols(typ SectionType) ([]Symbol, []byte, error) { - switch f.Class { - case ELFCLASS64: - return f.getSymbols64(typ) - - case ELFCLASS32: - return f.getSymbols32(typ) - } - - return nil, nil, errors.New("not implemented") -} - -// ErrNoSymbols is returned by File.Symbols and File.DynamicSymbols -// if there is no such section in the File. -var ErrNoSymbols = errors.New("no symbol section") - -func (f *File) getSymbols32(typ SectionType) ([]Symbol, []byte, error) { - symtabSection := f.SectionByType(typ) - if symtabSection == nil { - return nil, nil, ErrNoSymbols - } - - data, err := symtabSection.Data() - if err != nil { - return nil, nil, errors.New("cannot load symbol section") - } - symtab := bytes.NewReader(data) - if symtab.Len()%Sym32Size != 0 { - return nil, nil, errors.New("length of symbol section is not a multiple of SymSize") - } - - strdata, err := f.stringTable(symtabSection.Link) - if err != nil { - return nil, nil, errors.New("cannot load string table section") - } - - // The first entry is all zeros. - var skip [Sym32Size]byte - symtab.Read(skip[:]) - - symbols := make([]Symbol, symtab.Len()/Sym32Size) - - i := 0 - var sym Sym32 - for symtab.Len() > 0 { - binary.Read(symtab, f.ByteOrder, &sym) - str, _ := getString(strdata, int(sym.Name)) - symbols[i].Name = str - symbols[i].Info = sym.Info - symbols[i].Other = sym.Other - symbols[i].Section = SectionIndex(sym.Shndx) - symbols[i].Value = uint64(sym.Value) - symbols[i].Size = uint64(sym.Size) - i++ - } - - return symbols, strdata, nil -} - -func (f *File) getSymbols64(typ SectionType) ([]Symbol, []byte, error) { - symtabSection := f.SectionByType(typ) - if symtabSection == nil { - return nil, nil, ErrNoSymbols - } - - data, err := symtabSection.Data() - if err != nil { - return nil, nil, errors.New("cannot load symbol section") - } - symtab := bytes.NewReader(data) - if symtab.Len()%Sym64Size != 0 { - return nil, nil, errors.New("length of symbol section is not a multiple of Sym64Size") - } - - strdata, err := f.stringTable(symtabSection.Link) - if err != nil { - return nil, nil, errors.New("cannot load string table section") - } - - // The first entry is all zeros. - var skip [Sym64Size]byte - symtab.Read(skip[:]) - - symbols := make([]Symbol, symtab.Len()/Sym64Size) - - i := 0 - var sym Sym64 - for symtab.Len() > 0 { - binary.Read(symtab, f.ByteOrder, &sym) - str, _ := getString(strdata, int(sym.Name)) - symbols[i].Name = str - symbols[i].Info = sym.Info - symbols[i].Other = sym.Other - symbols[i].Section = SectionIndex(sym.Shndx) - symbols[i].Value = sym.Value - symbols[i].Size = sym.Size - i++ - } - - return symbols, strdata, nil -} - -// getString extracts a string from an ELF string table. -func getString(section []byte, start int) (string, bool) { - if start < 0 || start >= len(section) { - return "", false - } - - for end := start; end < len(section); end++ { - if section[end] == 0 { - return string(section[start:end]), true - } - } - return "", false -} - -// Section returns a section with the given name, or nil if no such -// section exists. -func (f *File) Section(name string) *Section { - for _, s := range f.Sections { - if s.Name == name { - return s - } - } - return nil -} - -// applyRelocations applies relocations to dst. rels is a relocations section -// in RELA format. -func (f *File) applyRelocations(dst []byte, rels []byte) error { - switch { - case f.Class == ELFCLASS64 && f.Machine == EM_X86_64: - return f.applyRelocationsAMD64(dst, rels) - case f.Class == ELFCLASS32 && f.Machine == EM_386: - return f.applyRelocations386(dst, rels) - case f.Class == ELFCLASS32 && f.Machine == EM_ARM: - return f.applyRelocationsARM(dst, rels) - case f.Class == ELFCLASS64 && f.Machine == EM_AARCH64: - return f.applyRelocationsARM64(dst, rels) - case f.Class == ELFCLASS32 && f.Machine == EM_PPC: - return f.applyRelocationsPPC(dst, rels) - case f.Class == ELFCLASS64 && f.Machine == EM_PPC64: - return f.applyRelocationsPPC64(dst, rels) - case f.Class == ELFCLASS64 && f.Machine == EM_S390: - return f.applyRelocationsS390x(dst, rels) - default: - return errors.New("applyRelocations: not implemented") - } -} - -func (f *File) applyRelocationsAMD64(dst []byte, rels []byte) error { - // 24 is the size of Rela64. - if len(rels)%24 != 0 { - return errors.New("length of relocation section is not a multiple of 24") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rela Rela64 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rela) - symNo := rela.Info >> 32 - t := R_X86_64(rela.Info & 0xffff) - - if symNo == 0 || symNo > uint64(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - if SymType(sym.Info&0xf) != STT_SECTION { - // We don't handle non-section relocations for now. - continue - } - - // There are relocations, so this must be a normal - // object file, and we only look at section symbols, - // so we assume that the symbol value is 0. - - switch t { - case R_X86_64_64: - if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) - case R_X86_64_32: - if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) - } - } - - return nil -} - -func (f *File) applyRelocations386(dst []byte, rels []byte) error { - // 8 is the size of Rel32. - if len(rels)%8 != 0 { - return errors.New("length of relocation section is not a multiple of 8") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rel Rel32 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rel) - symNo := rel.Info >> 8 - t := R_386(rel.Info & 0xff) - - if symNo == 0 || symNo > uint32(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - - if t == R_386_32 { - if rel.Off+4 >= uint32(len(dst)) { - continue - } - val := f.ByteOrder.Uint32(dst[rel.Off : rel.Off+4]) - val += uint32(sym.Value) - f.ByteOrder.PutUint32(dst[rel.Off:rel.Off+4], val) - } - } - - return nil -} - -func (f *File) applyRelocationsARM(dst []byte, rels []byte) error { - // 8 is the size of Rel32. - if len(rels)%8 != 0 { - return errors.New("length of relocation section is not a multiple of 8") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rel Rel32 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rel) - symNo := rel.Info >> 8 - t := R_ARM(rel.Info & 0xff) - - if symNo == 0 || symNo > uint32(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - - switch t { - case R_ARM_ABS32: - if rel.Off+4 >= uint32(len(dst)) { - continue - } - val := f.ByteOrder.Uint32(dst[rel.Off : rel.Off+4]) - val += uint32(sym.Value) - f.ByteOrder.PutUint32(dst[rel.Off:rel.Off+4], val) - } - } - - return nil -} - -func (f *File) applyRelocationsARM64(dst []byte, rels []byte) error { - // 24 is the size of Rela64. - if len(rels)%24 != 0 { - return errors.New("length of relocation section is not a multiple of 24") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rela Rela64 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rela) - symNo := rela.Info >> 32 - t := R_AARCH64(rela.Info & 0xffff) - - if symNo == 0 || symNo > uint64(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - if SymType(sym.Info&0xf) != STT_SECTION { - // We don't handle non-section relocations for now. - continue - } - - // There are relocations, so this must be a normal - // object file, and we only look at section symbols, - // so we assume that the symbol value is 0. - - switch t { - case R_AARCH64_ABS64: - if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) - case R_AARCH64_ABS32: - if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) - } - } - - return nil -} - -func (f *File) applyRelocationsPPC(dst []byte, rels []byte) error { - // 12 is the size of Rela32. - if len(rels)%12 != 0 { - return errors.New("length of relocation section is not a multiple of 12") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rela Rela32 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rela) - symNo := rela.Info >> 8 - t := R_PPC(rela.Info & 0xff) - - if symNo == 0 || symNo > uint32(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - if SymType(sym.Info&0xf) != STT_SECTION { - // We don't handle non-section relocations for now. - continue - } - - switch t { - case R_PPC_ADDR32: - if rela.Off+4 >= uint32(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) - } - } - - return nil -} - -func (f *File) applyRelocationsPPC64(dst []byte, rels []byte) error { - // 24 is the size of Rela64. - if len(rels)%24 != 0 { - return errors.New("length of relocation section is not a multiple of 24") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewReader(rels) - var rela Rela64 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rela) - symNo := rela.Info >> 32 - t := R_PPC64(rela.Info & 0xffff) - - if symNo == 0 || symNo > uint64(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - if SymType(sym.Info&0xf) != STT_SECTION { - // We don't handle non-section relocations for now. - continue - } - - switch t { - case R_PPC64_ADDR64: - if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)) - case R_PPC64_ADDR32: - if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)) - } - } - - return nil -} - -func (f *File) applyRelocationsS390x(dst []byte, rels []byte) error { - // 24 is the size of Rela64. - if len(rels)%24 != 0 { - return errors.New("length of relocation section is not a multiple of 24") - } - - symbols, _, err := f.getSymbols(SHT_SYMTAB) - if err != nil { - return err - } - - b := bytes.NewBuffer(rels) - var rela Rela64 - - for b.Len() > 0 { - binary.Read(b, f.ByteOrder, &rela) - symNo := rela.Info >> 32 - t := R_390(rela.Info & 0xffff) - - if symNo == 0 || symNo > uint64(len(symbols)) { - continue - } - sym := &symbols[symNo-1] - - switch t { - case R_390_64: - if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend)+uint64(sym.Value)) - case R_390_32: - if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 { - continue - } - f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend)+uint32(sym.Value)) - } - } - - return nil -} - -func (f *File) DWARF() (*dwarf.Data, error) { - // sectionData gets the data for s, checks its size, and - // applies any applicable relations. - sectionData := func(i int, s *Section) ([]byte, error) { - b, err := s.Data() - if err != nil && uint64(len(b)) < s.Size { - return nil, err - } - - for _, r := range f.Sections { - if r.Type != SHT_RELA && r.Type != SHT_REL { - continue - } - if int(r.Info) != i { - continue - } - rd, err := r.Data() - if err != nil { - return nil, err - } - err = f.applyRelocations(b, rd) - if err != nil { - return nil, err - } - } - return b, nil - } - - // There are many other DWARF sections, but these - // are the ones the debug/dwarf package uses. - // Don't bother loading others. - var dat = map[string][]byte{"abbrev": nil, "info": nil, "str": nil, "line": nil, "ranges": nil} - for i, s := range f.Sections { - if !strings.HasPrefix(s.Name, ".debug_") { - continue - } - if _, ok := dat[s.Name[7:]]; !ok { - continue - } - b, err := sectionData(i, s) - if err != nil { - return nil, err - } - dat[s.Name[7:]] = b - } - - d, err := dwarf.New(dat["abbrev"], nil, nil, dat["info"], dat["line"], nil, dat["ranges"], dat["str"]) - if err != nil { - return nil, err - } - - // Look for DWARF4 .debug_types sections. - for i, s := range f.Sections { - if s.Name == ".debug_types" { - b, err := sectionData(i, s) - if err != nil { - return nil, err - } - - err = d.AddTypes(fmt.Sprintf("types-%d", i), b) - if err != nil { - return nil, err - } - } - } - - return d, nil -} - -// Symbols returns the symbol table for f. The symbols will be listed in the order -// they appear in f. -// -// For compatibility with Go 1.0, Symbols omits the null symbol at index 0. -// After retrieving the symbols as symtab, an externally supplied index x -// corresponds to symtab[x-1], not symtab[x]. -func (f *File) Symbols() ([]Symbol, error) { - sym, _, err := f.getSymbols(SHT_SYMTAB) - return sym, err -} - -// DynamicSymbols returns the dynamic symbol table for f. The symbols -// will be listed in the order they appear in f. -// -// For compatibility with Symbols, DynamicSymbols omits the null symbol at index 0. -// After retrieving the symbols as symtab, an externally supplied index x -// corresponds to symtab[x-1], not symtab[x]. -func (f *File) DynamicSymbols() ([]Symbol, error) { - sym, _, err := f.getSymbols(SHT_DYNSYM) - return sym, err -} - -type ImportedSymbol struct { - Name string - Version string - Library string -} - -// ImportedSymbols returns the names of all symbols -// referred to by the binary f that are expected to be -// satisfied by other libraries at dynamic load time. -// It does not return weak symbols. -func (f *File) ImportedSymbols() ([]ImportedSymbol, error) { - sym, str, err := f.getSymbols(SHT_DYNSYM) - if err != nil { - return nil, err - } - f.gnuVersionInit(str) - var all []ImportedSymbol - for i, s := range sym { - if ST_BIND(s.Info) == STB_GLOBAL && s.Section == SHN_UNDEF { - all = append(all, ImportedSymbol{Name: s.Name}) - f.gnuVersion(i, &all[len(all)-1]) - } - } - return all, nil -} - -type verneed struct { - File string - Name string -} - -// gnuVersionInit parses the GNU version tables -// for use by calls to gnuVersion. -func (f *File) gnuVersionInit(str []byte) { - // Accumulate verneed information. - vn := f.SectionByType(SHT_GNU_VERNEED) - if vn == nil { - return - } - d, _ := vn.Data() - - var need []verneed - i := 0 - for { - if i+16 > len(d) { - break - } - vers := f.ByteOrder.Uint16(d[i : i+2]) - if vers != 1 { - break - } - cnt := f.ByteOrder.Uint16(d[i+2 : i+4]) - fileoff := f.ByteOrder.Uint32(d[i+4 : i+8]) - aux := f.ByteOrder.Uint32(d[i+8 : i+12]) - next := f.ByteOrder.Uint32(d[i+12 : i+16]) - file, _ := getString(str, int(fileoff)) - - var name string - j := i + int(aux) - for c := 0; c < int(cnt); c++ { - if j+16 > len(d) { - break - } - // hash := f.ByteOrder.Uint32(d[j:j+4]) - // flags := f.ByteOrder.Uint16(d[j+4:j+6]) - other := f.ByteOrder.Uint16(d[j+6 : j+8]) - nameoff := f.ByteOrder.Uint32(d[j+8 : j+12]) - next := f.ByteOrder.Uint32(d[j+12 : j+16]) - name, _ = getString(str, int(nameoff)) - ndx := int(other) - if ndx >= len(need) { - a := make([]verneed, 2*(ndx+1)) - copy(a, need) - need = a - } - - need[ndx] = verneed{file, name} - if next == 0 { - break - } - j += int(next) - } - - if next == 0 { - break - } - i += int(next) - } - - // Versym parallels symbol table, indexing into verneed. - vs := f.SectionByType(SHT_GNU_VERSYM) - if vs == nil { - return - } - d, _ = vs.Data() - - f.gnuNeed = need - f.gnuVersym = d -} - -// gnuVersion adds Library and Version information to sym, -// which came from offset i of the symbol table. -func (f *File) gnuVersion(i int, sym *ImportedSymbol) { - // Each entry is two bytes. - i = (i + 1) * 2 - if i >= len(f.gnuVersym) { - return - } - j := int(f.ByteOrder.Uint16(f.gnuVersym[i:])) - if j < 2 || j >= len(f.gnuNeed) { - return - } - n := &f.gnuNeed[j] - sym.Library = n.File - sym.Version = n.Name -} - -// ImportedLibraries returns the names of all libraries -// referred to by the binary f that are expected to be -// linked with the binary at dynamic link time. -func (f *File) ImportedLibraries() ([]string, error) { - return f.DynString(DT_NEEDED) -} - -// DynString returns the strings listed for the given tag in the file's dynamic -// section. -// -// The tag must be one that takes string values: DT_NEEDED, DT_SONAME, DT_RPATH, or -// DT_RUNPATH. -func (f *File) DynString(tag DynTag) ([]string, error) { - switch tag { - case DT_NEEDED, DT_SONAME, DT_RPATH, DT_RUNPATH: - default: - return nil, fmt.Errorf("non-string-valued tag %v", tag) - } - ds := f.SectionByType(SHT_DYNAMIC) - if ds == nil { - // not dynamic, so no libraries - return nil, nil - } - d, err := ds.Data() - if err != nil { - return nil, err - } - str, err := f.stringTable(ds.Link) - if err != nil { - return nil, err - } - var all []string - for len(d) > 0 { - var t DynTag - var v uint64 - switch f.Class { - case ELFCLASS32: - t = DynTag(f.ByteOrder.Uint32(d[0:4])) - v = uint64(f.ByteOrder.Uint32(d[4:8])) - d = d[8:] - case ELFCLASS64: - t = DynTag(f.ByteOrder.Uint64(d[0:8])) - v = f.ByteOrder.Uint64(d[8:16]) - d = d[16:] - } - if t == tag { - s, ok := getString(str, int(v)) - if ok { - all = append(all, s) - } - } - } - return all, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/file_test.go b/llgo/third_party/gofrontend/libgo/go/debug/elf/file_test.go deleted file mode 100644 index 1ad43146ac8b31858504d0c10e83d6d545b2437d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/file_test.go +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elf - -import ( - "bytes" - "compress/gzip" - "debug/dwarf" - "encoding/binary" - "io" - "net" - "os" - "path" - "reflect" - "runtime" - "testing" -) - -type fileTest struct { - file string - hdr FileHeader - sections []SectionHeader - progs []ProgHeader - needed []string -} - -var fileTests = []fileTest{ - { - "testdata/gcc-386-freebsd-exec", - FileHeader{ELFCLASS32, ELFDATA2LSB, EV_CURRENT, ELFOSABI_FREEBSD, 0, binary.LittleEndian, ET_EXEC, EM_386, 0x80483cc}, - []SectionHeader{ - {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - {".interp", SHT_PROGBITS, SHF_ALLOC, 0x80480d4, 0xd4, 0x15, 0x0, 0x0, 0x1, 0x0}, - {".hash", SHT_HASH, SHF_ALLOC, 0x80480ec, 0xec, 0x90, 0x3, 0x0, 0x4, 0x4}, - {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x804817c, 0x17c, 0x110, 0x4, 0x1, 0x4, 0x10}, - {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x804828c, 0x28c, 0xbb, 0x0, 0x0, 0x1, 0x0}, - {".rel.plt", SHT_REL, SHF_ALLOC, 0x8048348, 0x348, 0x20, 0x3, 0x7, 0x4, 0x8}, - {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x8048368, 0x368, 0x11, 0x0, 0x0, 0x4, 0x0}, - {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804837c, 0x37c, 0x50, 0x0, 0x0, 0x4, 0x4}, - {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x80483cc, 0x3cc, 0x180, 0x0, 0x0, 0x4, 0x0}, - {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x804854c, 0x54c, 0xc, 0x0, 0x0, 0x4, 0x0}, - {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x8048558, 0x558, 0xa3, 0x0, 0x0, 0x1, 0x0}, - {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80495fc, 0x5fc, 0xc, 0x0, 0x0, 0x4, 0x0}, - {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x8049608, 0x608, 0x4, 0x0, 0x0, 0x4, 0x0}, - {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x804960c, 0x60c, 0x98, 0x4, 0x0, 0x4, 0x8}, - {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496a4, 0x6a4, 0x8, 0x0, 0x0, 0x4, 0x0}, - {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496ac, 0x6ac, 0x8, 0x0, 0x0, 0x4, 0x0}, - {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b4, 0x6b4, 0x4, 0x0, 0x0, 0x4, 0x0}, - {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x80496b8, 0x6b8, 0x1c, 0x0, 0x0, 0x4, 0x4}, - {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x80496d4, 0x6d4, 0x20, 0x0, 0x0, 0x4, 0x0}, - {".comment", SHT_PROGBITS, 0x0, 0x0, 0x6d4, 0x12d, 0x0, 0x0, 0x1, 0x0}, - {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x801, 0x20, 0x0, 0x0, 0x1, 0x0}, - {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0x821, 0x1b, 0x0, 0x0, 0x1, 0x0}, - {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0x83c, 0x11d, 0x0, 0x0, 0x1, 0x0}, - {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0x959, 0x41, 0x0, 0x0, 0x1, 0x0}, - {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0x99a, 0x35, 0x0, 0x0, 0x1, 0x0}, - {".debug_frame", SHT_PROGBITS, 0x0, 0x0, 0x9d0, 0x30, 0x0, 0x0, 0x4, 0x0}, - {".debug_str", SHT_PROGBITS, 0x0, 0x0, 0xa00, 0xd, 0x0, 0x0, 0x1, 0x0}, - {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xa0d, 0xf8, 0x0, 0x0, 0x1, 0x0}, - {".symtab", SHT_SYMTAB, 0x0, 0x0, 0xfb8, 0x4b0, 0x1d, 0x38, 0x4, 0x10}, - {".strtab", SHT_STRTAB, 0x0, 0x0, 0x1468, 0x206, 0x0, 0x0, 0x1, 0x0}, - }, - []ProgHeader{ - {PT_PHDR, PF_R + PF_X, 0x34, 0x8048034, 0x8048034, 0xa0, 0xa0, 0x4}, - {PT_INTERP, PF_R, 0xd4, 0x80480d4, 0x80480d4, 0x15, 0x15, 0x1}, - {PT_LOAD, PF_R + PF_X, 0x0, 0x8048000, 0x8048000, 0x5fb, 0x5fb, 0x1000}, - {PT_LOAD, PF_R + PF_W, 0x5fc, 0x80495fc, 0x80495fc, 0xd8, 0xf8, 0x1000}, - {PT_DYNAMIC, PF_R + PF_W, 0x60c, 0x804960c, 0x804960c, 0x98, 0x98, 0x4}, - }, - []string{"libc.so.6"}, - }, - { - "testdata/gcc-amd64-linux-exec", - FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0, binary.LittleEndian, ET_EXEC, EM_X86_64, 0x4003e0}, - []SectionHeader{ - {"", SHT_NULL, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - {".interp", SHT_PROGBITS, SHF_ALLOC, 0x400200, 0x200, 0x1c, 0x0, 0x0, 0x1, 0x0}, - {".note.ABI-tag", SHT_NOTE, SHF_ALLOC, 0x40021c, 0x21c, 0x20, 0x0, 0x0, 0x4, 0x0}, - {".hash", SHT_HASH, SHF_ALLOC, 0x400240, 0x240, 0x24, 0x5, 0x0, 0x8, 0x4}, - {".gnu.hash", SHT_LOOS + 268435446, SHF_ALLOC, 0x400268, 0x268, 0x1c, 0x5, 0x0, 0x8, 0x0}, - {".dynsym", SHT_DYNSYM, SHF_ALLOC, 0x400288, 0x288, 0x60, 0x6, 0x1, 0x8, 0x18}, - {".dynstr", SHT_STRTAB, SHF_ALLOC, 0x4002e8, 0x2e8, 0x3d, 0x0, 0x0, 0x1, 0x0}, - {".gnu.version", SHT_HIOS, SHF_ALLOC, 0x400326, 0x326, 0x8, 0x5, 0x0, 0x2, 0x2}, - {".gnu.version_r", SHT_LOOS + 268435454, SHF_ALLOC, 0x400330, 0x330, 0x20, 0x6, 0x1, 0x8, 0x0}, - {".rela.dyn", SHT_RELA, SHF_ALLOC, 0x400350, 0x350, 0x18, 0x5, 0x0, 0x8, 0x18}, - {".rela.plt", SHT_RELA, SHF_ALLOC, 0x400368, 0x368, 0x30, 0x5, 0xc, 0x8, 0x18}, - {".init", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400398, 0x398, 0x18, 0x0, 0x0, 0x4, 0x0}, - {".plt", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003b0, 0x3b0, 0x30, 0x0, 0x0, 0x4, 0x10}, - {".text", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x4003e0, 0x3e0, 0x1b4, 0x0, 0x0, 0x10, 0x0}, - {".fini", SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR, 0x400594, 0x594, 0xe, 0x0, 0x0, 0x4, 0x0}, - {".rodata", SHT_PROGBITS, SHF_ALLOC, 0x4005a4, 0x5a4, 0x11, 0x0, 0x0, 0x4, 0x0}, - {".eh_frame_hdr", SHT_PROGBITS, SHF_ALLOC, 0x4005b8, 0x5b8, 0x24, 0x0, 0x0, 0x4, 0x0}, - {".eh_frame", SHT_PROGBITS, SHF_ALLOC, 0x4005e0, 0x5e0, 0xa4, 0x0, 0x0, 0x8, 0x0}, - {".ctors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600688, 0x688, 0x10, 0x0, 0x0, 0x8, 0x0}, - {".dtors", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600698, 0x698, 0x10, 0x0, 0x0, 0x8, 0x0}, - {".jcr", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x6006a8, 0x6a8, 0x8, 0x0, 0x0, 0x8, 0x0}, - {".dynamic", SHT_DYNAMIC, SHF_WRITE + SHF_ALLOC, 0x6006b0, 0x6b0, 0x1a0, 0x6, 0x0, 0x8, 0x10}, - {".got", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600850, 0x850, 0x8, 0x0, 0x0, 0x8, 0x8}, - {".got.plt", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600858, 0x858, 0x28, 0x0, 0x0, 0x8, 0x8}, - {".data", SHT_PROGBITS, SHF_WRITE + SHF_ALLOC, 0x600880, 0x880, 0x18, 0x0, 0x0, 0x8, 0x0}, - {".bss", SHT_NOBITS, SHF_WRITE + SHF_ALLOC, 0x600898, 0x898, 0x8, 0x0, 0x0, 0x4, 0x0}, - {".comment", SHT_PROGBITS, 0x0, 0x0, 0x898, 0x126, 0x0, 0x0, 0x1, 0x0}, - {".debug_aranges", SHT_PROGBITS, 0x0, 0x0, 0x9c0, 0x90, 0x0, 0x0, 0x10, 0x0}, - {".debug_pubnames", SHT_PROGBITS, 0x0, 0x0, 0xa50, 0x25, 0x0, 0x0, 0x1, 0x0}, - {".debug_info", SHT_PROGBITS, 0x0, 0x0, 0xa75, 0x1a7, 0x0, 0x0, 0x1, 0x0}, - {".debug_abbrev", SHT_PROGBITS, 0x0, 0x0, 0xc1c, 0x6f, 0x0, 0x0, 0x1, 0x0}, - {".debug_line", SHT_PROGBITS, 0x0, 0x0, 0xc8b, 0x13f, 0x0, 0x0, 0x1, 0x0}, - {".debug_str", SHT_PROGBITS, SHF_MERGE + SHF_STRINGS, 0x0, 0xdca, 0xb1, 0x0, 0x0, 0x1, 0x1}, - {".debug_ranges", SHT_PROGBITS, 0x0, 0x0, 0xe80, 0x90, 0x0, 0x0, 0x10, 0x0}, - {".shstrtab", SHT_STRTAB, 0x0, 0x0, 0xf10, 0x149, 0x0, 0x0, 0x1, 0x0}, - {".symtab", SHT_SYMTAB, 0x0, 0x0, 0x19a0, 0x6f0, 0x24, 0x39, 0x8, 0x18}, - {".strtab", SHT_STRTAB, 0x0, 0x0, 0x2090, 0x1fc, 0x0, 0x0, 0x1, 0x0}, - }, - []ProgHeader{ - {PT_PHDR, PF_R + PF_X, 0x40, 0x400040, 0x400040, 0x1c0, 0x1c0, 0x8}, - {PT_INTERP, PF_R, 0x200, 0x400200, 0x400200, 0x1c, 0x1c, 1}, - {PT_LOAD, PF_R + PF_X, 0x0, 0x400000, 0x400000, 0x684, 0x684, 0x200000}, - {PT_LOAD, PF_R + PF_W, 0x688, 0x600688, 0x600688, 0x210, 0x218, 0x200000}, - {PT_DYNAMIC, PF_R + PF_W, 0x6b0, 0x6006b0, 0x6006b0, 0x1a0, 0x1a0, 0x8}, - {PT_NOTE, PF_R, 0x21c, 0x40021c, 0x40021c, 0x20, 0x20, 0x4}, - {PT_LOOS + 0x474E550, PF_R, 0x5b8, 0x4005b8, 0x4005b8, 0x24, 0x24, 0x4}, - {PT_LOOS + 0x474E551, PF_R + PF_W, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8}, - }, - []string{"libc.so.6"}, - }, - { - "testdata/hello-world-core.gz", - FileHeader{ELFCLASS64, ELFDATA2LSB, EV_CURRENT, ELFOSABI_NONE, 0x0, binary.LittleEndian, ET_CORE, EM_X86_64, 0x0}, - []SectionHeader{}, - []ProgHeader{ - {Type: PT_NOTE, Flags: 0x0, Off: 0x3f8, Vaddr: 0x0, Paddr: 0x0, Filesz: 0x8ac, Memsz: 0x0, Align: 0x0}, - {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x1000, Vaddr: 0x400000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_R, Off: 0x1000, Vaddr: 0x401000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x2000, Vaddr: 0x402000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3000, Vaddr: 0x7f54078b8000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1b5000, Align: 0x1000}, - {Type: PT_LOAD, Flags: 0x0, Off: 0x3000, Vaddr: 0x7f5407a6d000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x1ff000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_R, Off: 0x3000, Vaddr: 0x7f5407c6c000, Paddr: 0x0, Filesz: 0x4000, Memsz: 0x4000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x7000, Vaddr: 0x7f5407c70000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x9000, Vaddr: 0x7f5407c72000, Paddr: 0x0, Filesz: 0x5000, Memsz: 0x5000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0xe000, Vaddr: 0x7f5407c77000, Paddr: 0x0, Filesz: 0x0, Memsz: 0x22000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0xe000, Vaddr: 0x7f5407e81000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x11000, Vaddr: 0x7f5407e96000, Paddr: 0x0, Filesz: 0x3000, Memsz: 0x3000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_R, Off: 0x14000, Vaddr: 0x7f5407e99000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x15000, Vaddr: 0x7f5407e9a000, Paddr: 0x0, Filesz: 0x2000, Memsz: 0x2000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_W + PF_R, Off: 0x17000, Vaddr: 0x7fff79972000, Paddr: 0x0, Filesz: 0x23000, Memsz: 0x23000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3a000, Vaddr: 0x7fff799f8000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, - {Type: PT_LOAD, Flags: PF_X + PF_R, Off: 0x3b000, Vaddr: 0xffffffffff600000, Paddr: 0x0, Filesz: 0x1000, Memsz: 0x1000, Align: 0x1000}, - }, - nil, - }, -} - -func TestOpen(t *testing.T) { - for i := range fileTests { - tt := &fileTests[i] - - var f *File - var err error - if path.Ext(tt.file) == ".gz" { - var r io.ReaderAt - if r, err = decompress(tt.file); err == nil { - f, err = NewFile(r) - } - } else { - f, err = Open(tt.file) - } - if err != nil { - t.Errorf("cannot open file %s: %v", tt.file, err) - continue - } - defer f.Close() - if !reflect.DeepEqual(f.FileHeader, tt.hdr) { - t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) - continue - } - for i, s := range f.Sections { - if i >= len(tt.sections) { - break - } - sh := &tt.sections[i] - if !reflect.DeepEqual(&s.SectionHeader, sh) { - t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, &s.SectionHeader, sh) - } - } - for i, p := range f.Progs { - if i >= len(tt.progs) { - break - } - ph := &tt.progs[i] - if !reflect.DeepEqual(&p.ProgHeader, ph) { - t.Errorf("open %s, program %d:\n\thave %#v\n\twant %#v\n", tt.file, i, &p.ProgHeader, ph) - } - } - tn := len(tt.sections) - fn := len(f.Sections) - if tn != fn { - t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) - } - tn = len(tt.progs) - fn = len(f.Progs) - if tn != fn { - t.Errorf("open %s: len(Progs) = %d, want %d", tt.file, fn, tn) - } - tl := tt.needed - fl, err := f.ImportedLibraries() - if err != nil { - t.Error(err) - } - if !reflect.DeepEqual(tl, fl) { - t.Errorf("open %s: DT_NEEDED = %v, want %v", tt.file, tl, fl) - } - } -} - -// elf.NewFile requires io.ReaderAt, which compress/gzip cannot -// provide. Decompress the file to a bytes.Reader. -func decompress(gz string) (io.ReaderAt, error) { - in, err := os.Open(gz) - if err != nil { - return nil, err - } - defer in.Close() - r, err := gzip.NewReader(in) - if err != nil { - return nil, err - } - var out bytes.Buffer - _, err = io.Copy(&out, r) - return bytes.NewReader(out.Bytes()), err -} - -type relocationTestEntry struct { - entryNumber int - entry *dwarf.Entry -} - -type relocationTest struct { - file string - entries []relocationTestEntry -} - -var relocationTests = []relocationTest{ - { - "testdata/go-relocation-test-gcc441-x86-64.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "go-relocation-test.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrHighpc, Val: uint64(0x6), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc441-x86.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.4.1", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "t.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrHighpc, Val: uint64(0x5), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc424-x86-64.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.2.4 (Ubuntu 4.2.4-1ubuntu4)", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc424.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrHighpc, Val: uint64(0x6), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc482-aarch64.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -g -fstack-protector", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrHighpc, Val: int64(0x24), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc492-arm.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "GNU C 4.9.2 20141224 (prerelease) -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -mtls-dialect=gnu -g", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "go-relocation-test-gcc492.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrCompDir, Val: "/root/go/src/debug/elf/testdata", Class: dwarf.ClassString}, {Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, {Attr: dwarf.AttrHighpc, Val: int64(0x28), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-clang-arm.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, dwarf.Field{Attr: dwarf.AttrName, Val: "hello.c", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0x0), Class: dwarf.ClassLinePtr}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: int64(48), Class: dwarf.ClassConstant}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc5-ppc.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C11 5.0.0 20150116 (experimental) -Asystem=linux -Asystem=unix -Asystem=posix -g", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test-gcc5-ppc.c", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: int64(0x44), Class: dwarf.ClassConstant}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-gcc482-ppc64le.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{dwarf.Field{Attr: dwarf.AttrProducer, Val: "GNU C 4.8.2 -Asystem=linux -Asystem=unix -Asystem=posix -msecure-plt -mtune=power8 -mcpu=power7 -gdwarf-2 -fstack-protector", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLanguage, Val: int64(1), Class: dwarf.ClassConstant}, dwarf.Field{Attr: dwarf.AttrName, Val: "go-relocation-test-gcc482-ppc64le.c", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}, dwarf.Field{Attr: dwarf.AttrLowpc, Val: uint64(0x0), Class: dwarf.ClassAddress}, dwarf.Field{Attr: dwarf.AttrHighpc, Val: uint64(0x24), Class: dwarf.ClassAddress}, dwarf.Field{Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}}}}, - }, - }, - { - "testdata/go-relocation-test-clang-x86.obj", - []relocationTestEntry{ - {0, &dwarf.Entry{Offset: 0xb, Tag: dwarf.TagCompileUnit, Children: true, Field: []dwarf.Field{{Attr: dwarf.AttrProducer, Val: "clang version google3-trunk (trunk r209387)", Class: dwarf.ClassString}, {Attr: dwarf.AttrLanguage, Val: int64(12), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrName, Val: "go-relocation-test-clang.c", Class: dwarf.ClassString}, {Attr: dwarf.AttrStmtList, Val: int64(0), Class: dwarf.ClassLinePtr}, {Attr: dwarf.AttrCompDir, Val: "/tmp", Class: dwarf.ClassString}}}}, - }, - }, - { - "testdata/gcc-amd64-openbsd-debug-with-rela.obj", - []relocationTestEntry{ - {203, &dwarf.Entry{Offset: 0xc62, Tag: dwarf.TagMember, Children: false, Field: []dwarf.Field{{Attr: dwarf.AttrName, Val: "it_interval", Class: dwarf.ClassString}, {Attr: dwarf.AttrDeclFile, Val: int64(7), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrDeclLine, Val: int64(236), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f), Class: dwarf.ClassReference}, {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x0}, Class: dwarf.ClassExprLoc}}}}, - {204, &dwarf.Entry{Offset: 0xc70, Tag: dwarf.TagMember, Children: false, Field: []dwarf.Field{{Attr: dwarf.AttrName, Val: "it_value", Class: dwarf.ClassString}, {Attr: dwarf.AttrDeclFile, Val: int64(7), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrDeclLine, Val: int64(237), Class: dwarf.ClassConstant}, {Attr: dwarf.AttrType, Val: dwarf.Offset(0xb7f), Class: dwarf.ClassReference}, {Attr: dwarf.AttrDataMemberLoc, Val: []byte{0x23, 0x10}, Class: dwarf.ClassExprLoc}}}}, - }, - }, -} - -func TestDWARFRelocations(t *testing.T) { - for i, test := range relocationTests { - f, err := Open(test.file) - if err != nil { - t.Error(err) - continue - } - dwarf, err := f.DWARF() - if err != nil { - t.Error(err) - continue - } - for _, testEntry := range test.entries { - reader := dwarf.Reader() - for j := 0; j < testEntry.entryNumber; j++ { - entry, err := reader.Next() - if entry == nil || err != nil { - t.Errorf("Failed to skip to entry %d: %v", testEntry.entryNumber, err) - continue - } - } - entry, err := reader.Next() - if err != nil { - t.Error(err) - continue - } - if !reflect.DeepEqual(testEntry.entry, entry) { - t.Errorf("#%d/%d: mismatch: got:%#v want:%#v", i, testEntry.entryNumber, entry, testEntry.entry) - continue - } - } - } -} - -func TestNoSectionOverlaps(t *testing.T) { - // Ensure 6l outputs sections without overlaps. - if runtime.GOOS != "linux" && runtime.GOOS != "freebsd" { - return // not ELF - } - _ = net.ResolveIPAddr // force dynamic linkage - f, err := Open(os.Args[0]) - if err != nil { - t.Error(err) - return - } - for i, si := range f.Sections { - sih := si.SectionHeader - if sih.Type == SHT_NOBITS { - continue - } - for j, sj := range f.Sections { - sjh := sj.SectionHeader - if i == j || sjh.Type == SHT_NOBITS || sih.Offset == sjh.Offset && sih.Size == 0 { - continue - } - if sih.Offset >= sjh.Offset && sih.Offset < sjh.Offset+sjh.Size { - t.Errorf("ld produced ELF with section %s within %s: 0x%x <= 0x%x..0x%x < 0x%x", - sih.Name, sjh.Name, sjh.Offset, sih.Offset, sih.Offset+sih.Size, sjh.Offset+sjh.Size) - } - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/symbols_test.go b/llgo/third_party/gofrontend/libgo/go/debug/elf/symbols_test.go deleted file mode 100644 index 1b79520e3ccb56c39bc61ebb3b8a575293a0498d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/symbols_test.go +++ /dev/null @@ -1,834 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package elf - -import ( - "io" - "path" - "reflect" - "testing" -) - -// TODO: remove duplicate code -func TestSymbols(t *testing.T) { - do := func(file string, ts []Symbol, getfunc func(*File) ([]Symbol, error)) { - var f *File - var err error - if path.Ext(file) == ".gz" { - var r io.ReaderAt - if r, err = decompress(file); err == nil { - f, err = NewFile(r) - } - } else { - f, err = Open(file) - } - if err != nil { - t.Errorf("TestSymbols: cannot open file %s: %v", file, err) - return - } - defer f.Close() - fs, err := getfunc(f) - if err != nil && err != ErrNoSymbols { - t.Error(err) - return - } else if err == ErrNoSymbols { - fs = []Symbol{} - } - if !reflect.DeepEqual(ts, fs) { - t.Errorf("%s: Symbols = %v, want %v", file, ts, fs) - } - } - for file, ts := range symbolsGolden { - do(file, ts, (*File).Symbols) - } - for file, ts := range dynamicSymbolsGolden { - do(file, ts, (*File).DynamicSymbols) - } -} - -// golden symbol table data generated by testdata/getgoldsym.c - -var symbolsGolden = map[string][]Symbol{ - "testdata/gcc-amd64-linux-exec": { - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1, - Value: 0x400200, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x2, - Value: 0x40021C, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x3, - Value: 0x400240, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x4, - Value: 0x400268, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x5, - Value: 0x400288, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x6, - Value: 0x4002E8, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x7, - Value: 0x400326, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x8, - Value: 0x400330, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x9, - Value: 0x400350, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xA, - Value: 0x400368, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xB, - Value: 0x400398, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xC, - Value: 0x4003B0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xD, - Value: 0x4003E0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xE, - Value: 0x400594, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xF, - Value: 0x4005A4, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x10, - Value: 0x4005B8, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x11, - Value: 0x4005E0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x12, - Value: 0x600688, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x13, - Value: 0x600698, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x14, - Value: 0x6006A8, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x15, - Value: 0x6006B0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x16, - Value: 0x600850, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x17, - Value: 0x600858, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x18, - Value: 0x600880, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x19, - Value: 0x600898, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1A, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1B, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1C, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1D, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1E, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1F, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x20, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x21, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "init.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "initfini.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "call_gmon_start", - Info: 0x2, - Other: 0x0, - Section: 0xD, - Value: 0x40040C, - Size: 0x0, - }, - Symbol{ - Name: "crtstuff.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "__CTOR_LIST__", - Info: 0x1, - Other: 0x0, - Section: 0x12, - Value: 0x600688, - Size: 0x0, - }, - Symbol{ - Name: "__DTOR_LIST__", - Info: 0x1, - Other: 0x0, - Section: 0x13, - Value: 0x600698, - Size: 0x0, - }, - Symbol{ - Name: "__JCR_LIST__", - Info: 0x1, - Other: 0x0, - Section: 0x14, - Value: 0x6006A8, - Size: 0x0, - }, - Symbol{ - Name: "__do_global_dtors_aux", - Info: 0x2, - Other: 0x0, - Section: 0xD, - Value: 0x400430, - Size: 0x0, - }, - Symbol{ - Name: "completed.6183", - Info: 0x1, - Other: 0x0, - Section: 0x19, - Value: 0x600898, - Size: 0x1, - }, - Symbol{ - Name: "p.6181", - Info: 0x1, - Other: 0x0, - Section: 0x18, - Value: 0x600890, - Size: 0x0, - }, - Symbol{ - Name: "frame_dummy", - Info: 0x2, - Other: 0x0, - Section: 0xD, - Value: 0x400470, - Size: 0x0, - }, - Symbol{ - Name: "crtstuff.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "__CTOR_END__", - Info: 0x1, - Other: 0x0, - Section: 0x12, - Value: 0x600690, - Size: 0x0, - }, - Symbol{ - Name: "__DTOR_END__", - Info: 0x1, - Other: 0x0, - Section: 0x13, - Value: 0x6006A0, - Size: 0x0, - }, - Symbol{ - Name: "__FRAME_END__", - Info: 0x1, - Other: 0x0, - Section: 0x11, - Value: 0x400680, - Size: 0x0, - }, - Symbol{ - Name: "__JCR_END__", - Info: 0x1, - Other: 0x0, - Section: 0x14, - Value: 0x6006A8, - Size: 0x0, - }, - Symbol{ - Name: "__do_global_ctors_aux", - Info: 0x2, - Other: 0x0, - Section: 0xD, - Value: 0x400560, - Size: 0x0, - }, - Symbol{ - Name: "initfini.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "hello.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "_GLOBAL_OFFSET_TABLE_", - Info: 0x1, - Other: 0x2, - Section: 0x17, - Value: 0x600858, - Size: 0x0, - }, - Symbol{ - Name: "__init_array_end", - Info: 0x0, - Other: 0x2, - Section: 0x12, - Value: 0x600684, - Size: 0x0, - }, - Symbol{ - Name: "__init_array_start", - Info: 0x0, - Other: 0x2, - Section: 0x12, - Value: 0x600684, - Size: 0x0, - }, - Symbol{ - Name: "_DYNAMIC", - Info: 0x1, - Other: 0x2, - Section: 0x15, - Value: 0x6006B0, - Size: 0x0, - }, - Symbol{ - Name: "data_start", - Info: 0x20, - Other: 0x0, - Section: 0x18, - Value: 0x600880, - Size: 0x0, - }, - Symbol{ - Name: "__libc_csu_fini", - Info: 0x12, - Other: 0x0, - Section: 0xD, - Value: 0x4004C0, - Size: 0x2, - }, - Symbol{ - Name: "_start", - Info: 0x12, - Other: 0x0, - Section: 0xD, - Value: 0x4003E0, - Size: 0x0, - }, - Symbol{ - Name: "__gmon_start__", - Info: 0x20, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "_Jv_RegisterClasses", - Info: 0x20, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "puts@@GLIBC_2.2.5", - Info: 0x12, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x18C, - }, - Symbol{ - Name: "_fini", - Info: 0x12, - Other: 0x0, - Section: 0xE, - Value: 0x400594, - Size: 0x0, - }, - Symbol{ - Name: "__libc_start_main@@GLIBC_2.2.5", - Info: 0x12, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x1C2, - }, - Symbol{ - Name: "_IO_stdin_used", - Info: 0x11, - Other: 0x0, - Section: 0xF, - Value: 0x4005A4, - Size: 0x4, - }, - Symbol{ - Name: "__data_start", - Info: 0x10, - Other: 0x0, - Section: 0x18, - Value: 0x600880, - Size: 0x0, - }, - Symbol{ - Name: "__dso_handle", - Info: 0x11, - Other: 0x2, - Section: 0x18, - Value: 0x600888, - Size: 0x0, - }, - Symbol{ - Name: "__libc_csu_init", - Info: 0x12, - Other: 0x0, - Section: 0xD, - Value: 0x4004D0, - Size: 0x89, - }, - Symbol{ - Name: "__bss_start", - Info: 0x10, - Other: 0x0, - Section: 0xFFF1, - Value: 0x600898, - Size: 0x0, - }, - Symbol{ - Name: "_end", - Info: 0x10, - Other: 0x0, - Section: 0xFFF1, - Value: 0x6008A0, - Size: 0x0, - }, - Symbol{ - Name: "_edata", - Info: 0x10, - Other: 0x0, - Section: 0xFFF1, - Value: 0x600898, - Size: 0x0, - }, - Symbol{ - Name: "main", - Info: 0x12, - Other: 0x0, - Section: 0xD, - Value: 0x400498, - Size: 0x1B, - }, - Symbol{ - Name: "_init", - Info: 0x12, - Other: 0x0, - Section: 0xB, - Value: 0x400398, - Size: 0x0, - }, - }, - "testdata/go-relocation-test-clang-x86.obj": { - Symbol{ - Name: "go-relocation-test-clang.c", - Info: 0x4, - Other: 0x0, - Section: 0xFFF1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: ".Linfo_string0", - Info: 0x0, - Other: 0x0, - Section: 0xC, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: ".Linfo_string1", - Info: 0x0, - Other: 0x0, - Section: 0xC, - Value: 0x2C, - Size: 0x0, - }, - Symbol{ - Name: ".Linfo_string2", - Info: 0x0, - Other: 0x0, - Section: 0xC, - Value: 0x47, - Size: 0x0, - }, - Symbol{ - Name: ".Linfo_string3", - Info: 0x0, - Other: 0x0, - Section: 0xC, - Value: 0x4C, - Size: 0x0, - }, - Symbol{ - Name: ".Linfo_string4", - Info: 0x0, - Other: 0x0, - Section: 0xC, - Value: 0x4E, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x1, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x2, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x3, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x4, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x6, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x7, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x8, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xA, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xC, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xD, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xE, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0xF, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "", - Info: 0x3, - Other: 0x0, - Section: 0x10, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "v", - Info: 0x11, - Other: 0x0, - Section: 0xFFF2, - Value: 0x4, - Size: 0x4, - }, - }, - "testdata/hello-world-core.gz": {}, -} - -var dynamicSymbolsGolden = map[string][]Symbol{ - "testdata/gcc-amd64-linux-exec": { - Symbol{ - Name: "__gmon_start__", - Info: 0x20, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x0, - }, - Symbol{ - Name: "puts", - Info: 0x12, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x18C, - }, - Symbol{ - Name: "__libc_start_main", - Info: 0x12, - Other: 0x0, - Section: 0x0, - Value: 0x0, - Size: 0x1C2, - }, - }, - "testdata/go-relocation-test-clang-x86.obj": {}, - "testdata/hello-world-core.gz": {}, -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-386-freebsd-exec b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-386-freebsd-exec deleted file mode 100755 index 7af9c58ca73945561c470a5e7ad29f39d0405a6e..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-386-freebsd-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-linux-exec b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-linux-exec deleted file mode 100755 index c6cb1de28c77175897ee862d91c87454a42118f2..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-linux-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj deleted file mode 100644 index f62b1ea1cada83530e45320cc58394933753dddb..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/gcc-amd64-openbsd-debug-with-rela.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-arm.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-arm.obj deleted file mode 100644 index 1cc7e4b11143698a3abc3f72b88411e41f3d4989..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-arm.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-x86.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-x86.obj deleted file mode 100644 index e909cf4e6e19a63276f497b70a170492ade64156..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-clang-x86.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj deleted file mode 100644 index a7c6d6e562c1c70342d9d1cf41194b7ef3fdedf6..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc424-x86-64.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj deleted file mode 100644 index 2d37ab6e6e12cfb6625cdda41dc7ecf775ade4e8..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86-64.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86.obj deleted file mode 100644 index 0d59fe303b6dad25698a1e7c0644d285460797a9..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc441-x86.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj deleted file mode 100644 index 849e2644ec79263a958fcabda5b9e731e3cb1842..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-aarch64.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj deleted file mode 100644 index dad7445486e8897ad351ec2c8fad09f0d8ee494d..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc482-ppc64le.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc492-arm.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc492-arm.obj deleted file mode 100644 index ed45be2c55fda61466e4860e42fab07cc9228978..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc492-arm.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj deleted file mode 100644 index f4165af0982d3b87761a4a540900e687b39e980f..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/go-relocation-test-gcc5-ppc.obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello-world-core.gz b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello-world-core.gz deleted file mode 100644 index 806af6edbc23bd0db45a9b1adfae9418ca6a969a..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello-world-core.gz and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello.c b/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello.c deleted file mode 100644 index 34d9ee79234ef29ea03feeb69d220b0796295636..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/elf/testdata/hello.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -void -main(int argc, char *argv[]) -{ - printf("hello, world\n"); -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.h b/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.h deleted file mode 100644 index a6c40e76cd5ae0ec305660c9c44e97ef37eea64c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.h +++ /dev/null @@ -1,7 +0,0 @@ -// Empty include file to generate z symbols - - - - - -// EOF diff --git a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.s b/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.s deleted file mode 100644 index 519656b63edf8782076e4486e75cf35fb577d4cd..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclinetest.s +++ /dev/null @@ -1,89 +0,0 @@ -TEXT linefrompc(SB),7,$0 // Each byte stores its line delta -BYTE $2; -BYTE $1; -BYTE $1; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; -BYTE $1; -BYTE $1; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -BYTE $1; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; BYTE $0; -#include "pclinetest.h" -BYTE $2; -#include "pclinetest.h" -BYTE $2; - -TEXT pcfromline(SB),7,$0 // Each record stores its line delta, then n, then n more bytes -BYTE $31; BYTE $0; -BYTE $1; BYTE $1; BYTE $0; -BYTE $1; BYTE $0; - -BYTE $2; BYTE $4; BYTE $0; BYTE $0; BYTE $0; BYTE $0; - - -#include "pclinetest.h" -BYTE $4; BYTE $0; - - -BYTE $3; BYTE $3; BYTE $0; BYTE $0; BYTE $0; -#include "pclinetest.h" - - -BYTE $4; BYTE $3; BYTE $0; BYTE $0; BYTE $0; - -TEXT main(SB),7,$0 - // Prevent GC of our test symbols - CALL linefrompc(SB) - CALL pcfromline(SB) - -// Keep the linker happy -TEXT runtime·morestack(SB),7,$0 - RET - -TEXT runtime·morestack00(SB),7,$0 - RET - -TEXT runtime·morestack10(SB),7,$0 - RET - -TEXT runtime·morestack01(SB),7,$0 - RET - -TEXT runtime·morestack11(SB),7,$0 - RET - -TEXT runtime·morestack8(SB),7,$0 - RET - -TEXT runtime·morestack16(SB),7,$0 - RET - -TEXT runtime·morestack24(SB),7,$0 - RET - -TEXT runtime·morestack32(SB),7,$0 - RET - -TEXT runtime·morestack40(SB),7,$0 - RET - -TEXT runtime·morestack48(SB),7,$0 - RET - -TEXT runtime·morestack8(SB),7,$0 - RET - diff --git a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab.go b/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab.go deleted file mode 100644 index 6620aefb053ceab0bb20b4a8cd5900adab4e091c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab.go +++ /dev/null @@ -1,453 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* - * Line tables - */ - -package gosym - -import ( - "encoding/binary" - "sync" -) - -// A LineTable is a data structure mapping program counters to line numbers. -// -// In Go 1.1 and earlier, each function (represented by a Func) had its own LineTable, -// and the line number corresponded to a numbering of all source lines in the -// program, across all files. That absolute line number would then have to be -// converted separately to a file name and line number within the file. -// -// In Go 1.2, the format of the data changed so that there is a single LineTable -// for the entire program, shared by all Funcs, and there are no absolute line -// numbers, just line numbers within specific files. -// -// For the most part, LineTable's methods should be treated as an internal -// detail of the package; callers should use the methods on Table instead. -type LineTable struct { - Data []byte - PC uint64 - Line int - - // Go 1.2 state - mu sync.Mutex - go12 int // is this in Go 1.2 format? -1 no, 0 unknown, 1 yes - binary binary.ByteOrder - quantum uint32 - ptrsize uint32 - functab []byte - nfunctab uint32 - filetab []byte - nfiletab uint32 - fileMap map[string]uint32 -} - -// NOTE(rsc): This is wrong for GOARCH=arm, which uses a quantum of 4, -// but we have no idea whether we're using arm or not. This only -// matters in the old (pre-Go 1.2) symbol table format, so it's not worth -// fixing. -const oldQuantum = 1 - -func (t *LineTable) parse(targetPC uint64, targetLine int) (b []byte, pc uint64, line int) { - // The PC/line table can be thought of as a sequence of - // * - // batches. Each update batch results in a (pc, line) pair, - // where line applies to every PC from pc up to but not - // including the pc of the next pair. - // - // Here we process each update individually, which simplifies - // the code, but makes the corner cases more confusing. - b, pc, line = t.Data, t.PC, t.Line - for pc <= targetPC && line != targetLine && len(b) > 0 { - code := b[0] - b = b[1:] - switch { - case code == 0: - if len(b) < 4 { - b = b[0:0] - break - } - val := binary.BigEndian.Uint32(b) - b = b[4:] - line += int(val) - case code <= 64: - line += int(code) - case code <= 128: - line -= int(code - 64) - default: - pc += oldQuantum * uint64(code-128) - continue - } - pc += oldQuantum - } - return b, pc, line -} - -func (t *LineTable) slice(pc uint64) *LineTable { - data, pc, line := t.parse(pc, -1) - return &LineTable{Data: data, PC: pc, Line: line} -} - -// PCToLine returns the line number for the given program counter. -// Callers should use Table's PCToLine method instead. -func (t *LineTable) PCToLine(pc uint64) int { - if t.isGo12() { - return t.go12PCToLine(pc) - } - _, _, line := t.parse(pc, -1) - return line -} - -// LineToPC returns the program counter for the given line number, -// considering only program counters before maxpc. -// Callers should use Table's LineToPC method instead. -func (t *LineTable) LineToPC(line int, maxpc uint64) uint64 { - if t.isGo12() { - return 0 - } - _, pc, line1 := t.parse(maxpc, line) - if line1 != line { - return 0 - } - // Subtract quantum from PC to account for post-line increment - return pc - oldQuantum -} - -// NewLineTable returns a new PC/line table -// corresponding to the encoded data. -// Text must be the start address of the -// corresponding text segment. -func NewLineTable(data []byte, text uint64) *LineTable { - return &LineTable{Data: data, PC: text, Line: 0} -} - -// Go 1.2 symbol table format. -// See golang.org/s/go12symtab. -// -// A general note about the methods here: rather than try to avoid -// index out of bounds errors, we trust Go to detect them, and then -// we recover from the panics and treat them as indicative of a malformed -// or incomplete table. -// -// The methods called by symtab.go, which begin with "go12" prefixes, -// are expected to have that recovery logic. - -// isGo12 reports whether this is a Go 1.2 (or later) symbol table. -func (t *LineTable) isGo12() bool { - t.go12Init() - return t.go12 == 1 -} - -const go12magic = 0xfffffffb - -// uintptr returns the pointer-sized value encoded at b. -// The pointer size is dictated by the table being read. -func (t *LineTable) uintptr(b []byte) uint64 { - if t.ptrsize == 4 { - return uint64(t.binary.Uint32(b)) - } - return t.binary.Uint64(b) -} - -// go12init initializes the Go 1.2 metadata if t is a Go 1.2 symbol table. -func (t *LineTable) go12Init() { - t.mu.Lock() - defer t.mu.Unlock() - if t.go12 != 0 { - return - } - - defer func() { - // If we panic parsing, assume it's not a Go 1.2 symbol table. - recover() - }() - - // Check header: 4-byte magic, two zeros, pc quantum, pointer size. - t.go12 = -1 // not Go 1.2 until proven otherwise - if len(t.Data) < 16 || t.Data[4] != 0 || t.Data[5] != 0 || - (t.Data[6] != 1 && t.Data[6] != 4) || // pc quantum - (t.Data[7] != 4 && t.Data[7] != 8) { // pointer size - return - } - - switch uint32(go12magic) { - case binary.LittleEndian.Uint32(t.Data): - t.binary = binary.LittleEndian - case binary.BigEndian.Uint32(t.Data): - t.binary = binary.BigEndian - default: - return - } - - t.quantum = uint32(t.Data[6]) - t.ptrsize = uint32(t.Data[7]) - - t.nfunctab = uint32(t.uintptr(t.Data[8:])) - t.functab = t.Data[8+t.ptrsize:] - functabsize := t.nfunctab*2*t.ptrsize + t.ptrsize - fileoff := t.binary.Uint32(t.functab[functabsize:]) - t.functab = t.functab[:functabsize] - t.filetab = t.Data[fileoff:] - t.nfiletab = t.binary.Uint32(t.filetab) - t.filetab = t.filetab[:t.nfiletab*4] - - t.go12 = 1 // so far so good -} - -// go12Funcs returns a slice of Funcs derived from the Go 1.2 pcln table. -func (t *LineTable) go12Funcs() []Func { - // Assume it is malformed and return nil on error. - defer func() { - recover() - }() - - n := len(t.functab) / int(t.ptrsize) / 2 - funcs := make([]Func, n) - for i := range funcs { - f := &funcs[i] - f.Entry = uint64(t.uintptr(t.functab[2*i*int(t.ptrsize):])) - f.End = uint64(t.uintptr(t.functab[(2*i+2)*int(t.ptrsize):])) - info := t.Data[t.uintptr(t.functab[(2*i+1)*int(t.ptrsize):]):] - f.LineTable = t - f.FrameSize = int(t.binary.Uint32(info[t.ptrsize+2*4:])) - f.Sym = &Sym{ - Value: f.Entry, - Type: 'T', - Name: t.string(t.binary.Uint32(info[t.ptrsize:])), - GoType: 0, - Func: f, - } - } - return funcs -} - -// findFunc returns the func corresponding to the given program counter. -func (t *LineTable) findFunc(pc uint64) []byte { - if pc < t.uintptr(t.functab) || pc >= t.uintptr(t.functab[len(t.functab)-int(t.ptrsize):]) { - return nil - } - - // The function table is a list of 2*nfunctab+1 uintptrs, - // alternating program counters and offsets to func structures. - f := t.functab - nf := t.nfunctab - for nf > 0 { - m := nf / 2 - fm := f[2*t.ptrsize*m:] - if t.uintptr(fm) <= pc && pc < t.uintptr(fm[2*t.ptrsize:]) { - return t.Data[t.uintptr(fm[t.ptrsize:]):] - } else if pc < t.uintptr(fm) { - nf = m - } else { - f = f[(m+1)*2*t.ptrsize:] - nf -= m + 1 - } - } - return nil -} - -// readvarint reads, removes, and returns a varint from *pp. -func (t *LineTable) readvarint(pp *[]byte) uint32 { - var v, shift uint32 - p := *pp - for shift = 0; ; shift += 7 { - b := p[0] - p = p[1:] - v |= (uint32(b) & 0x7F) << shift - if b&0x80 == 0 { - break - } - } - *pp = p - return v -} - -// string returns a Go string found at off. -func (t *LineTable) string(off uint32) string { - for i := off; ; i++ { - if t.Data[i] == 0 { - return string(t.Data[off:i]) - } - } -} - -// step advances to the next pc, value pair in the encoded table. -func (t *LineTable) step(p *[]byte, pc *uint64, val *int32, first bool) bool { - uvdelta := t.readvarint(p) - if uvdelta == 0 && !first { - return false - } - if uvdelta&1 != 0 { - uvdelta = ^(uvdelta >> 1) - } else { - uvdelta >>= 1 - } - vdelta := int32(uvdelta) - pcdelta := t.readvarint(p) * t.quantum - *pc += uint64(pcdelta) - *val += vdelta - return true -} - -// pcvalue reports the value associated with the target pc. -// off is the offset to the beginning of the pc-value table, -// and entry is the start PC for the corresponding function. -func (t *LineTable) pcvalue(off uint32, entry, targetpc uint64) int32 { - if off == 0 { - return -1 - } - p := t.Data[off:] - - val := int32(-1) - pc := entry - for t.step(&p, &pc, &val, pc == entry) { - if targetpc < pc { - return val - } - } - return -1 -} - -// findFileLine scans one function in the binary looking for a -// program counter in the given file on the given line. -// It does so by running the pc-value tables mapping program counter -// to file number. Since most functions come from a single file, these -// are usually short and quick to scan. If a file match is found, then the -// code goes to the expense of looking for a simultaneous line number match. -func (t *LineTable) findFileLine(entry uint64, filetab, linetab uint32, filenum, line int32) uint64 { - if filetab == 0 || linetab == 0 { - return 0 - } - - fp := t.Data[filetab:] - fl := t.Data[linetab:] - fileVal := int32(-1) - filePC := entry - lineVal := int32(-1) - linePC := entry - fileStartPC := filePC - for t.step(&fp, &filePC, &fileVal, filePC == entry) { - if fileVal == filenum && fileStartPC < filePC { - // fileVal is in effect starting at fileStartPC up to - // but not including filePC, and it's the file we want. - // Run the PC table looking for a matching line number - // or until we reach filePC. - lineStartPC := linePC - for linePC < filePC && t.step(&fl, &linePC, &lineVal, linePC == entry) { - // lineVal is in effect until linePC, and lineStartPC < filePC. - if lineVal == line { - if fileStartPC <= lineStartPC { - return lineStartPC - } - if fileStartPC < linePC { - return fileStartPC - } - } - lineStartPC = linePC - } - } - fileStartPC = filePC - } - return 0 -} - -// go12PCToLine maps program counter to line number for the Go 1.2 pcln table. -func (t *LineTable) go12PCToLine(pc uint64) (line int) { - defer func() { - if recover() != nil { - line = -1 - } - }() - - f := t.findFunc(pc) - if f == nil { - return -1 - } - entry := t.uintptr(f) - linetab := t.binary.Uint32(f[t.ptrsize+5*4:]) - return int(t.pcvalue(linetab, entry, pc)) -} - -// go12PCToFile maps program counter to file name for the Go 1.2 pcln table. -func (t *LineTable) go12PCToFile(pc uint64) (file string) { - defer func() { - if recover() != nil { - file = "" - } - }() - - f := t.findFunc(pc) - if f == nil { - return "" - } - entry := t.uintptr(f) - filetab := t.binary.Uint32(f[t.ptrsize+4*4:]) - fno := t.pcvalue(filetab, entry, pc) - if fno <= 0 { - return "" - } - return t.string(t.binary.Uint32(t.filetab[4*fno:])) -} - -// go12LineToPC maps a (file, line) pair to a program counter for the Go 1.2 pcln table. -func (t *LineTable) go12LineToPC(file string, line int) (pc uint64) { - defer func() { - if recover() != nil { - pc = 0 - } - }() - - t.initFileMap() - filenum := t.fileMap[file] - if filenum == 0 { - return 0 - } - - // Scan all functions. - // If this turns out to be a bottleneck, we could build a map[int32][]int32 - // mapping file number to a list of functions with code from that file. - for i := uint32(0); i < t.nfunctab; i++ { - f := t.Data[t.uintptr(t.functab[2*t.ptrsize*i+t.ptrsize:]):] - entry := t.uintptr(f) - filetab := t.binary.Uint32(f[t.ptrsize+4*4:]) - linetab := t.binary.Uint32(f[t.ptrsize+5*4:]) - pc := t.findFileLine(entry, filetab, linetab, int32(filenum), int32(line)) - if pc != 0 { - return pc - } - } - return 0 -} - -// initFileMap initializes the map from file name to file number. -func (t *LineTable) initFileMap() { - t.mu.Lock() - defer t.mu.Unlock() - - if t.fileMap != nil { - return - } - m := make(map[string]uint32) - - for i := uint32(1); i < t.nfiletab; i++ { - s := t.string(t.binary.Uint32(t.filetab[4*i:])) - m[s] = i - } - t.fileMap = m -} - -// go12MapFiles adds to m a key for every file in the Go 1.2 LineTable. -// Every key maps to obj. That's not a very interesting map, but it provides -// a way for callers to obtain the list of files in the program. -func (t *LineTable) go12MapFiles(m map[string]*Obj, obj *Obj) { - defer func() { - recover() - }() - - t.initFileMap() - for file := range t.fileMap { - m[file] = obj - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab_test.go b/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab_test.go deleted file mode 100644 index 53f3e952d62bdbf7f2d12c535aa701ecedc45da5..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/gosym/pclntab_test.go +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gosym - -import ( - "debug/elf" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - "testing" -) - -var ( - pclineTempDir string - pclinetestBinary string -) - -func dotest(self bool) bool { - // For now, only works on amd64 platforms. - if runtime.GOARCH != "amd64" { - return false - } - // Self test reads test binary; only works on Linux. - if self && runtime.GOOS != "linux" { - return false - } - if pclinetestBinary != "" { - return true - } - var err error - pclineTempDir, err = ioutil.TempDir("", "pclinetest") - if err != nil { - panic(err) - } - if strings.Contains(pclineTempDir, " ") { - panic("unexpected space in tempdir") - } - // This command builds pclinetest from pclinetest.asm; - // the resulting binary looks like it was built from pclinetest.s, - // but we have renamed it to keep it away from the go tool. - pclinetestBinary = filepath.Join(pclineTempDir, "pclinetest") - cmd := exec.Command("go", "tool", "asm", "-o", pclinetestBinary+".o", "pclinetest.asm") - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - panic(err) - } - cmd = exec.Command("go", "tool", "link", "-H", "linux", "-E", "main", - "-o", pclinetestBinary, pclinetestBinary+".o") - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - if err := cmd.Run(); err != nil { - panic(err) - } - return true -} - -func endtest() { - if pclineTempDir != "" { - os.RemoveAll(pclineTempDir) - pclineTempDir = "" - pclinetestBinary = "" - } -} - -func getTable(t *testing.T) *Table { - f, tab := crack(os.Args[0], t) - f.Close() - return tab -} - -func crack(file string, t *testing.T) (*elf.File, *Table) { - // Open self - f, err := elf.Open(file) - if err != nil { - t.Fatal(err) - } - return parse(file, f, t) -} - -func parse(file string, f *elf.File, t *testing.T) (*elf.File, *Table) { - s := f.Section(".gosymtab") - if s == nil { - t.Skip("no .gosymtab section") - } - symdat, err := s.Data() - if err != nil { - f.Close() - t.Fatalf("reading %s gosymtab: %v", file, err) - } - pclndat, err := f.Section(".gopclntab").Data() - if err != nil { - f.Close() - t.Fatalf("reading %s gopclntab: %v", file, err) - } - - pcln := NewLineTable(pclndat, f.Section(".text").Addr) - tab, err := NewTable(symdat, pcln) - if err != nil { - f.Close() - t.Fatalf("parsing %s gosymtab: %v", file, err) - } - - return f, tab -} - -var goarch = os.Getenv("O") - -func TestLineFromAline(t *testing.T) { - if !dotest(true) { - return - } - defer endtest() - - tab := getTable(t) - if tab.go12line != nil { - // aline's don't exist in the Go 1.2 table. - t.Skip("not relevant to Go 1.2 symbol table") - } - - // Find the sym package - pkg := tab.LookupFunc("debug/gosym.TestLineFromAline").Obj - if pkg == nil { - t.Fatalf("nil pkg") - } - - // Walk every absolute line and ensure that we hit every - // source line monotonically - lastline := make(map[string]int) - final := -1 - for i := 0; i < 10000; i++ { - path, line := pkg.lineFromAline(i) - // Check for end of object - if path == "" { - if final == -1 { - final = i - 1 - } - continue - } else if final != -1 { - t.Fatalf("reached end of package at absolute line %d, but absolute line %d mapped to %s:%d", final, i, path, line) - } - // It's okay to see files multiple times (e.g., sys.a) - if line == 1 { - lastline[path] = 1 - continue - } - // Check that the is the next line in path - ll, ok := lastline[path] - if !ok { - t.Errorf("file %s starts on line %d", path, line) - } else if line != ll+1 { - t.Fatalf("expected next line of file %s to be %d, got %d", path, ll+1, line) - } - lastline[path] = line - } - if final == -1 { - t.Errorf("never reached end of object") - } -} - -func TestLineAline(t *testing.T) { - if !dotest(true) { - return - } - defer endtest() - - tab := getTable(t) - if tab.go12line != nil { - // aline's don't exist in the Go 1.2 table. - t.Skip("not relevant to Go 1.2 symbol table") - } - - for _, o := range tab.Files { - // A source file can appear multiple times in a - // object. alineFromLine will always return alines in - // the first file, so track which lines we've seen. - found := make(map[string]int) - for i := 0; i < 1000; i++ { - path, line := o.lineFromAline(i) - if path == "" { - break - } - - // cgo files are full of 'Z' symbols, which we don't handle - if len(path) > 4 && path[len(path)-4:] == ".cgo" { - continue - } - - if minline, ok := found[path]; path != "" && ok { - if minline >= line { - // We've already covered this file - continue - } - } - found[path] = line - - a, err := o.alineFromLine(path, line) - if err != nil { - t.Errorf("absolute line %d in object %s maps to %s:%d, but mapping that back gives error %s", i, o.Paths[0].Name, path, line, err) - } else if a != i { - t.Errorf("absolute line %d in object %s maps to %s:%d, which maps back to absolute line %d\n", i, o.Paths[0].Name, path, line, a) - } - } - } -} - -func TestPCLine(t *testing.T) { - if !dotest(false) { - return - } - defer endtest() - - f, tab := crack(pclinetestBinary, t) - text := f.Section(".text") - textdat, err := text.Data() - if err != nil { - t.Fatalf("reading .text: %v", err) - } - - // Test PCToLine - sym := tab.LookupFunc("linefrompc") - wantLine := 0 - for pc := sym.Entry; pc < sym.End; pc++ { - off := pc - text.Addr // TODO(rsc): should not need off; bug in 8g - if textdat[off] == 255 { - break - } - wantLine += int(textdat[off]) - t.Logf("off is %d %#x (max %d)", off, textdat[off], sym.End-pc) - file, line, fn := tab.PCToLine(pc) - if fn == nil { - t.Errorf("failed to get line of PC %#x", pc) - } else if !strings.HasSuffix(file, "pclinetest.asm") || line != wantLine || fn != sym { - t.Errorf("PCToLine(%#x) = %s:%d (%s), want %s:%d (%s)", pc, file, line, fn.Name, "pclinetest.asm", wantLine, sym.Name) - } - } - - // Test LineToPC - sym = tab.LookupFunc("pcfromline") - lookupline := -1 - wantLine = 0 - off := uint64(0) // TODO(rsc): should not need off; bug in 8g - for pc := sym.Value; pc < sym.End; pc += 2 + uint64(textdat[off]) { - file, line, fn := tab.PCToLine(pc) - off = pc - text.Addr - if textdat[off] == 255 { - break - } - wantLine += int(textdat[off]) - if line != wantLine { - t.Errorf("expected line %d at PC %#x in pcfromline, got %d", wantLine, pc, line) - off = pc + 1 - text.Addr - continue - } - if lookupline == -1 { - lookupline = line - } - for ; lookupline <= line; lookupline++ { - pc2, fn2, err := tab.LineToPC(file, lookupline) - if lookupline != line { - // Should be nothing on this line - if err == nil { - t.Errorf("expected no PC at line %d, got %#x (%s)", lookupline, pc2, fn2.Name) - } - } else if err != nil { - t.Errorf("failed to get PC of line %d: %s", lookupline, err) - } else if pc != pc2 { - t.Errorf("expected PC %#x (%s) at line %d, got PC %#x (%s)", pc, fn.Name, line, pc2, fn2.Name) - } - } - off = pc + 1 - text.Addr - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/gosym/symtab.go b/llgo/third_party/gofrontend/libgo/go/debug/gosym/symtab.go deleted file mode 100644 index 46f07833442b28c7e111ee3caa96b7f6e6654780..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/gosym/symtab.go +++ /dev/null @@ -1,710 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gosym implements access to the Go symbol -// and line number tables embedded in Go binaries generated -// by the gc compilers. -package gosym - -// The table format is a variant of the format used in Plan 9's a.out -// format, documented at http://plan9.bell-labs.com/magic/man2html/6/a.out. -// The best reference for the differences between the Plan 9 format -// and the Go format is the runtime source, specifically ../../runtime/symtab.c. - -import ( - "bytes" - "encoding/binary" - "fmt" - "strconv" - "strings" -) - -/* - * Symbols - */ - -// A Sym represents a single symbol table entry. -type Sym struct { - Value uint64 - Type byte - Name string - GoType uint64 - // If this symbol is a function symbol, the corresponding Func - Func *Func -} - -// Static reports whether this symbol is static (not visible outside its file). -func (s *Sym) Static() bool { return s.Type >= 'a' } - -// PackageName returns the package part of the symbol name, -// or the empty string if there is none. -func (s *Sym) PackageName() string { - if i := strings.Index(s.Name, "."); i != -1 { - return s.Name[0:i] - } - return "" -} - -// ReceiverName returns the receiver type name of this symbol, -// or the empty string if there is none. -func (s *Sym) ReceiverName() string { - l := strings.Index(s.Name, ".") - r := strings.LastIndex(s.Name, ".") - if l == -1 || r == -1 || l == r { - return "" - } - return s.Name[l+1 : r] -} - -// BaseName returns the symbol name without the package or receiver name. -func (s *Sym) BaseName() string { - if i := strings.LastIndex(s.Name, "."); i != -1 { - return s.Name[i+1:] - } - return s.Name -} - -// A Func collects information about a single function. -type Func struct { - Entry uint64 - *Sym - End uint64 - Params []*Sym - Locals []*Sym - FrameSize int - LineTable *LineTable - Obj *Obj -} - -// An Obj represents a collection of functions in a symbol table. -// -// The exact method of division of a binary into separate Objs is an internal detail -// of the symbol table format. -// -// In early versions of Go each source file became a different Obj. -// -// In Go 1 and Go 1.1, each package produced one Obj for all Go sources -// and one Obj per C source file. -// -// In Go 1.2, there is a single Obj for the entire program. -type Obj struct { - // Funcs is a list of functions in the Obj. - Funcs []Func - - // In Go 1.1 and earlier, Paths is a list of symbols corresponding - // to the source file names that produced the Obj. - // In Go 1.2, Paths is nil. - // Use the keys of Table.Files to obtain a list of source files. - Paths []Sym // meta -} - -/* - * Symbol tables - */ - -// Table represents a Go symbol table. It stores all of the -// symbols decoded from the program and provides methods to translate -// between symbols, names, and addresses. -type Table struct { - Syms []Sym - Funcs []Func - Files map[string]*Obj // nil for Go 1.2 and later binaries - Objs []Obj // nil for Go 1.2 and later binaries - - go12line *LineTable // Go 1.2 line number table -} - -type sym struct { - value uint64 - gotype uint64 - typ byte - name []byte -} - -var ( - littleEndianSymtab = []byte{0xFD, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00} - bigEndianSymtab = []byte{0xFF, 0xFF, 0xFF, 0xFD, 0x00, 0x00, 0x00} - oldLittleEndianSymtab = []byte{0xFE, 0xFF, 0xFF, 0xFF, 0x00, 0x00} -) - -func walksymtab(data []byte, fn func(sym) error) error { - if len(data) == 0 { // missing symtab is okay - return nil - } - var order binary.ByteOrder = binary.BigEndian - newTable := false - switch { - case bytes.HasPrefix(data, oldLittleEndianSymtab): - // Same as Go 1.0, but little endian. - // Format was used during interim development between Go 1.0 and Go 1.1. - // Should not be widespread, but easy to support. - data = data[6:] - order = binary.LittleEndian - case bytes.HasPrefix(data, bigEndianSymtab): - newTable = true - case bytes.HasPrefix(data, littleEndianSymtab): - newTable = true - order = binary.LittleEndian - } - var ptrsz int - if newTable { - if len(data) < 8 { - return &DecodingError{len(data), "unexpected EOF", nil} - } - ptrsz = int(data[7]) - if ptrsz != 4 && ptrsz != 8 { - return &DecodingError{7, "invalid pointer size", ptrsz} - } - data = data[8:] - } - var s sym - p := data - for len(p) >= 4 { - var typ byte - if newTable { - // Symbol type, value, Go type. - typ = p[0] & 0x3F - wideValue := p[0]&0x40 != 0 - goType := p[0]&0x80 != 0 - if typ < 26 { - typ += 'A' - } else { - typ += 'a' - 26 - } - s.typ = typ - p = p[1:] - if wideValue { - if len(p) < ptrsz { - return &DecodingError{len(data), "unexpected EOF", nil} - } - // fixed-width value - if ptrsz == 8 { - s.value = order.Uint64(p[0:8]) - p = p[8:] - } else { - s.value = uint64(order.Uint32(p[0:4])) - p = p[4:] - } - } else { - // varint value - s.value = 0 - shift := uint(0) - for len(p) > 0 && p[0]&0x80 != 0 { - s.value |= uint64(p[0]&0x7F) << shift - shift += 7 - p = p[1:] - } - if len(p) == 0 { - return &DecodingError{len(data), "unexpected EOF", nil} - } - s.value |= uint64(p[0]) << shift - p = p[1:] - } - if goType { - if len(p) < ptrsz { - return &DecodingError{len(data), "unexpected EOF", nil} - } - // fixed-width go type - if ptrsz == 8 { - s.gotype = order.Uint64(p[0:8]) - p = p[8:] - } else { - s.gotype = uint64(order.Uint32(p[0:4])) - p = p[4:] - } - } - } else { - // Value, symbol type. - s.value = uint64(order.Uint32(p[0:4])) - if len(p) < 5 { - return &DecodingError{len(data), "unexpected EOF", nil} - } - typ = p[4] - if typ&0x80 == 0 { - return &DecodingError{len(data) - len(p) + 4, "bad symbol type", typ} - } - typ &^= 0x80 - s.typ = typ - p = p[5:] - } - - // Name. - var i int - var nnul int - for i = 0; i < len(p); i++ { - if p[i] == 0 { - nnul = 1 - break - } - } - switch typ { - case 'z', 'Z': - p = p[i+nnul:] - for i = 0; i+2 <= len(p); i += 2 { - if p[i] == 0 && p[i+1] == 0 { - nnul = 2 - break - } - } - } - if len(p) < i+nnul { - return &DecodingError{len(data), "unexpected EOF", nil} - } - s.name = p[0:i] - i += nnul - p = p[i:] - - if !newTable { - if len(p) < 4 { - return &DecodingError{len(data), "unexpected EOF", nil} - } - // Go type. - s.gotype = uint64(order.Uint32(p[:4])) - p = p[4:] - } - fn(s) - } - return nil -} - -// NewTable decodes the Go symbol table in data, -// returning an in-memory representation. -func NewTable(symtab []byte, pcln *LineTable) (*Table, error) { - var n int - err := walksymtab(symtab, func(s sym) error { - n++ - return nil - }) - if err != nil { - return nil, err - } - - var t Table - if pcln.isGo12() { - t.go12line = pcln - } - fname := make(map[uint16]string) - t.Syms = make([]Sym, 0, n) - nf := 0 - nz := 0 - lasttyp := uint8(0) - err = walksymtab(symtab, func(s sym) error { - n := len(t.Syms) - t.Syms = t.Syms[0 : n+1] - ts := &t.Syms[n] - ts.Type = s.typ - ts.Value = uint64(s.value) - ts.GoType = uint64(s.gotype) - switch s.typ { - default: - // rewrite name to use . instead of · (c2 b7) - w := 0 - b := s.name - for i := 0; i < len(b); i++ { - if b[i] == 0xc2 && i+1 < len(b) && b[i+1] == 0xb7 { - i++ - b[i] = '.' - } - b[w] = b[i] - w++ - } - ts.Name = string(s.name[0:w]) - case 'z', 'Z': - if lasttyp != 'z' && lasttyp != 'Z' { - nz++ - } - for i := 0; i < len(s.name); i += 2 { - eltIdx := binary.BigEndian.Uint16(s.name[i : i+2]) - elt, ok := fname[eltIdx] - if !ok { - return &DecodingError{-1, "bad filename code", eltIdx} - } - if n := len(ts.Name); n > 0 && ts.Name[n-1] != '/' { - ts.Name += "/" - } - ts.Name += elt - } - } - switch s.typ { - case 'T', 't', 'L', 'l': - nf++ - case 'f': - fname[uint16(s.value)] = ts.Name - } - lasttyp = s.typ - return nil - }) - if err != nil { - return nil, err - } - - t.Funcs = make([]Func, 0, nf) - t.Files = make(map[string]*Obj) - - var obj *Obj - if t.go12line != nil { - // Put all functions into one Obj. - t.Objs = make([]Obj, 1) - obj = &t.Objs[0] - t.go12line.go12MapFiles(t.Files, obj) - } else { - t.Objs = make([]Obj, 0, nz) - } - - // Count text symbols and attach frame sizes, parameters, and - // locals to them. Also, find object file boundaries. - lastf := 0 - for i := 0; i < len(t.Syms); i++ { - sym := &t.Syms[i] - switch sym.Type { - case 'Z', 'z': // path symbol - if t.go12line != nil { - // Go 1.2 binaries have the file information elsewhere. Ignore. - break - } - // Finish the current object - if obj != nil { - obj.Funcs = t.Funcs[lastf:] - } - lastf = len(t.Funcs) - - // Start new object - n := len(t.Objs) - t.Objs = t.Objs[0 : n+1] - obj = &t.Objs[n] - - // Count & copy path symbols - var end int - for end = i + 1; end < len(t.Syms); end++ { - if c := t.Syms[end].Type; c != 'Z' && c != 'z' { - break - } - } - obj.Paths = t.Syms[i:end] - i = end - 1 // loop will i++ - - // Record file names - depth := 0 - for j := range obj.Paths { - s := &obj.Paths[j] - if s.Name == "" { - depth-- - } else { - if depth == 0 { - t.Files[s.Name] = obj - } - depth++ - } - } - - case 'T', 't', 'L', 'l': // text symbol - if n := len(t.Funcs); n > 0 { - t.Funcs[n-1].End = sym.Value - } - if sym.Name == "runtime.etext" || sym.Name == "etext" { - continue - } - - // Count parameter and local (auto) syms - var np, na int - var end int - countloop: - for end = i + 1; end < len(t.Syms); end++ { - switch t.Syms[end].Type { - case 'T', 't', 'L', 'l', 'Z', 'z': - break countloop - case 'p': - np++ - case 'a': - na++ - } - } - - // Fill in the function symbol - n := len(t.Funcs) - t.Funcs = t.Funcs[0 : n+1] - fn := &t.Funcs[n] - sym.Func = fn - fn.Params = make([]*Sym, 0, np) - fn.Locals = make([]*Sym, 0, na) - fn.Sym = sym - fn.Entry = sym.Value - fn.Obj = obj - if t.go12line != nil { - // All functions share the same line table. - // It knows how to narrow down to a specific - // function quickly. - fn.LineTable = t.go12line - } else if pcln != nil { - fn.LineTable = pcln.slice(fn.Entry) - pcln = fn.LineTable - } - for j := i; j < end; j++ { - s := &t.Syms[j] - switch s.Type { - case 'm': - fn.FrameSize = int(s.Value) - case 'p': - n := len(fn.Params) - fn.Params = fn.Params[0 : n+1] - fn.Params[n] = s - case 'a': - n := len(fn.Locals) - fn.Locals = fn.Locals[0 : n+1] - fn.Locals[n] = s - } - } - i = end - 1 // loop will i++ - } - } - - if t.go12line != nil && nf == 0 { - t.Funcs = t.go12line.go12Funcs() - } - if obj != nil { - obj.Funcs = t.Funcs[lastf:] - } - return &t, nil -} - -// PCToFunc returns the function containing the program counter pc, -// or nil if there is no such function. -func (t *Table) PCToFunc(pc uint64) *Func { - funcs := t.Funcs - for len(funcs) > 0 { - m := len(funcs) / 2 - fn := &funcs[m] - switch { - case pc < fn.Entry: - funcs = funcs[0:m] - case fn.Entry <= pc && pc < fn.End: - return fn - default: - funcs = funcs[m+1:] - } - } - return nil -} - -// PCToLine looks up line number information for a program counter. -// If there is no information, it returns fn == nil. -func (t *Table) PCToLine(pc uint64) (file string, line int, fn *Func) { - if fn = t.PCToFunc(pc); fn == nil { - return - } - if t.go12line != nil { - file = t.go12line.go12PCToFile(pc) - line = t.go12line.go12PCToLine(pc) - } else { - file, line = fn.Obj.lineFromAline(fn.LineTable.PCToLine(pc)) - } - return -} - -// LineToPC looks up the first program counter on the given line in -// the named file. It returns UnknownPathError or UnknownLineError if -// there is an error looking up this line. -func (t *Table) LineToPC(file string, line int) (pc uint64, fn *Func, err error) { - obj, ok := t.Files[file] - if !ok { - return 0, nil, UnknownFileError(file) - } - - if t.go12line != nil { - pc := t.go12line.go12LineToPC(file, line) - if pc == 0 { - return 0, nil, &UnknownLineError{file, line} - } - return pc, t.PCToFunc(pc), nil - } - - abs, err := obj.alineFromLine(file, line) - if err != nil { - return - } - for i := range obj.Funcs { - f := &obj.Funcs[i] - pc := f.LineTable.LineToPC(abs, f.End) - if pc != 0 { - return pc, f, nil - } - } - return 0, nil, &UnknownLineError{file, line} -} - -// LookupSym returns the text, data, or bss symbol with the given name, -// or nil if no such symbol is found. -func (t *Table) LookupSym(name string) *Sym { - // TODO(austin) Maybe make a map - for i := range t.Syms { - s := &t.Syms[i] - switch s.Type { - case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': - if s.Name == name { - return s - } - } - } - return nil -} - -// LookupFunc returns the text, data, or bss symbol with the given name, -// or nil if no such symbol is found. -func (t *Table) LookupFunc(name string) *Func { - for i := range t.Funcs { - f := &t.Funcs[i] - if f.Sym.Name == name { - return f - } - } - return nil -} - -// SymByAddr returns the text, data, or bss symbol starting at the given address. -func (t *Table) SymByAddr(addr uint64) *Sym { - for i := range t.Syms { - s := &t.Syms[i] - switch s.Type { - case 'T', 't', 'L', 'l', 'D', 'd', 'B', 'b': - if s.Value == addr { - return s - } - } - } - return nil -} - -/* - * Object files - */ - -// This is legacy code for Go 1.1 and earlier, which used the -// Plan 9 format for pc-line tables. This code was never quite -// correct. It's probably very close, and it's usually correct, but -// we never quite found all the corner cases. -// -// Go 1.2 and later use a simpler format, documented at golang.org/s/go12symtab. - -func (o *Obj) lineFromAline(aline int) (string, int) { - type stackEnt struct { - path string - start int - offset int - prev *stackEnt - } - - noPath := &stackEnt{"", 0, 0, nil} - tos := noPath - -pathloop: - for _, s := range o.Paths { - val := int(s.Value) - switch { - case val > aline: - break pathloop - - case val == 1: - // Start a new stack - tos = &stackEnt{s.Name, val, 0, noPath} - - case s.Name == "": - // Pop - if tos == noPath { - return "", 0 - } - tos.prev.offset += val - tos.start - tos = tos.prev - - default: - // Push - tos = &stackEnt{s.Name, val, 0, tos} - } - } - - if tos == noPath { - return "", 0 - } - return tos.path, aline - tos.start - tos.offset + 1 -} - -func (o *Obj) alineFromLine(path string, line int) (int, error) { - if line < 1 { - return 0, &UnknownLineError{path, line} - } - - for i, s := range o.Paths { - // Find this path - if s.Name != path { - continue - } - - // Find this line at this stack level - depth := 0 - var incstart int - line += int(s.Value) - pathloop: - for _, s := range o.Paths[i:] { - val := int(s.Value) - switch { - case depth == 1 && val >= line: - return line - 1, nil - - case s.Name == "": - depth-- - if depth == 0 { - break pathloop - } else if depth == 1 { - line += val - incstart - } - - default: - if depth == 1 { - incstart = val - } - depth++ - } - } - return 0, &UnknownLineError{path, line} - } - return 0, UnknownFileError(path) -} - -/* - * Errors - */ - -// UnknownFileError represents a failure to find the specific file in -// the symbol table. -type UnknownFileError string - -func (e UnknownFileError) Error() string { return "unknown file: " + string(e) } - -// UnknownLineError represents a failure to map a line to a program -// counter, either because the line is beyond the bounds of the file -// or because there is no code on the given line. -type UnknownLineError struct { - File string - Line int -} - -func (e *UnknownLineError) Error() string { - return "no code at " + e.File + ":" + strconv.Itoa(e.Line) -} - -// DecodingError represents an error during the decoding of -// the symbol table. -type DecodingError struct { - off int - msg string - val interface{} -} - -func (e *DecodingError) Error() string { - msg := e.msg - if e.val != nil { - msg += fmt.Sprintf(" '%v'", e.val) - } - msg += fmt.Sprintf(" at byte %#x", e.off) - return msg -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/fat.go b/llgo/third_party/gofrontend/libgo/go/debug/macho/fat.go deleted file mode 100644 index 93b8315263cc9217365e5beefdb46cf10bf348ed..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/macho/fat.go +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package macho - -import ( - "encoding/binary" - "fmt" - "io" - "os" -) - -// A FatFile is a Mach-O universal binary that contains at least one architecture. -type FatFile struct { - Magic uint32 - Arches []FatArch - closer io.Closer -} - -// A FatArchHeader represents a fat header for a specific image architecture. -type FatArchHeader struct { - Cpu Cpu - SubCpu uint32 - Offset uint32 - Size uint32 - Align uint32 -} - -const fatArchHeaderSize = 5 * 4 - -// A FatArch is a Mach-O File inside a FatFile. -type FatArch struct { - FatArchHeader - *File -} - -// ErrNotFat is returned from NewFatFile or OpenFat when the file is not a -// universal binary but may be a thin binary, based on its magic number. -var ErrNotFat = &FormatError{0, "not a fat Mach-O file", nil} - -// NewFatFile creates a new FatFile for accessing all the Mach-O images in a -// universal binary. The Mach-O binary is expected to start at position 0 in -// the ReaderAt. -func NewFatFile(r io.ReaderAt) (*FatFile, error) { - var ff FatFile - sr := io.NewSectionReader(r, 0, 1<<63-1) - - // Read the fat_header struct, which is always in big endian. - // Start with the magic number. - err := binary.Read(sr, binary.BigEndian, &ff.Magic) - if err != nil { - return nil, &FormatError{0, "error reading magic number", nil} - } else if ff.Magic != MagicFat { - // See if this is a Mach-O file via its magic number. The magic - // must be converted to little endian first though. - var buf [4]byte - binary.BigEndian.PutUint32(buf[:], ff.Magic) - leMagic := binary.LittleEndian.Uint32(buf[:]) - if leMagic == Magic32 || leMagic == Magic64 { - return nil, ErrNotFat - } else { - return nil, &FormatError{0, "invalid magic number", nil} - } - } - offset := int64(4) - - // Read the number of FatArchHeaders that come after the fat_header. - var narch uint32 - err = binary.Read(sr, binary.BigEndian, &narch) - if err != nil { - return nil, &FormatError{offset, "invalid fat_header", nil} - } - offset += 4 - - if narch < 1 { - return nil, &FormatError{offset, "file contains no images", nil} - } - - // Combine the Cpu and SubCpu (both uint32) into a uint64 to make sure - // there are not duplicate architectures. - seenArches := make(map[uint64]bool, narch) - // Make sure that all images are for the same MH_ type. - var machoType Type - - // Following the fat_header comes narch fat_arch structs that index - // Mach-O images further in the file. - ff.Arches = make([]FatArch, narch) - for i := uint32(0); i < narch; i++ { - fa := &ff.Arches[i] - err = binary.Read(sr, binary.BigEndian, &fa.FatArchHeader) - if err != nil { - return nil, &FormatError{offset, "invalid fat_arch header", nil} - } - offset += fatArchHeaderSize - - fr := io.NewSectionReader(r, int64(fa.Offset), int64(fa.Size)) - fa.File, err = NewFile(fr) - if err != nil { - return nil, err - } - - // Make sure the architecture for this image is not duplicate. - seenArch := (uint64(fa.Cpu) << 32) | uint64(fa.SubCpu) - if o, k := seenArches[seenArch]; o || k { - return nil, &FormatError{offset, fmt.Sprintf("duplicate architecture cpu=%v, subcpu=%#x", fa.Cpu, fa.SubCpu), nil} - } - seenArches[seenArch] = true - - // Make sure the Mach-O type matches that of the first image. - if i == 0 { - machoType = fa.Type - } else { - if fa.Type != machoType { - return nil, &FormatError{offset, fmt.Sprintf("Mach-O type for architecture #%d (type=%#x) does not match first (type=%#x)", i, fa.Type, machoType), nil} - } - } - } - - return &ff, nil -} - -// OpenFat opens the named file using os.Open and prepares it for use as a Mach-O -// universal binary. -func OpenFat(name string) (ff *FatFile, err error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - ff, err = NewFatFile(f) - if err != nil { - f.Close() - return nil, err - } - ff.closer = f - return -} - -func (ff *FatFile) Close() error { - var err error - if ff.closer != nil { - err = ff.closer.Close() - ff.closer = nil - } - return err -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/file.go b/llgo/third_party/gofrontend/libgo/go/debug/macho/file.go deleted file mode 100644 index a7599aa5b2b13922956259a62ecaab5e28207387..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/macho/file.go +++ /dev/null @@ -1,524 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package macho implements access to Mach-O object files. -package macho - -// High level access to low level data structures. - -import ( - "bytes" - "debug/dwarf" - "encoding/binary" - "fmt" - "io" - "os" -) - -// A File represents an open Mach-O file. -type File struct { - FileHeader - ByteOrder binary.ByteOrder - Loads []Load - Sections []*Section - - Symtab *Symtab - Dysymtab *Dysymtab - - closer io.Closer -} - -// A Load represents any Mach-O load command. -type Load interface { - Raw() []byte -} - -// A LoadBytes is the uninterpreted bytes of a Mach-O load command. -type LoadBytes []byte - -func (b LoadBytes) Raw() []byte { return b } - -// A SegmentHeader is the header for a Mach-O 32-bit or 64-bit load segment command. -type SegmentHeader struct { - Cmd LoadCmd - Len uint32 - Name string - Addr uint64 - Memsz uint64 - Offset uint64 - Filesz uint64 - Maxprot uint32 - Prot uint32 - Nsect uint32 - Flag uint32 -} - -// A Segment represents a Mach-O 32-bit or 64-bit load segment command. -type Segment struct { - LoadBytes - SegmentHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -// Data reads and returns the contents of the segment. -func (s *Segment) Data() ([]byte, error) { - dat := make([]byte, s.sr.Size()) - n, err := s.sr.ReadAt(dat, 0) - if n == len(dat) { - err = nil - } - return dat[0:n], err -} - -// Open returns a new ReadSeeker reading the segment. -func (s *Segment) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } - -type SectionHeader struct { - Name string - Seg string - Addr uint64 - Size uint64 - Offset uint32 - Align uint32 - Reloff uint32 - Nreloc uint32 - Flags uint32 -} - -type Section struct { - SectionHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -// Data reads and returns the contents of the Mach-O section. -func (s *Section) Data() ([]byte, error) { - dat := make([]byte, s.sr.Size()) - n, err := s.sr.ReadAt(dat, 0) - if n == len(dat) { - err = nil - } - return dat[0:n], err -} - -// Open returns a new ReadSeeker reading the Mach-O section. -func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } - -// A Dylib represents a Mach-O load dynamic library command. -type Dylib struct { - LoadBytes - Name string - Time uint32 - CurrentVersion uint32 - CompatVersion uint32 -} - -// A Symtab represents a Mach-O symbol table command. -type Symtab struct { - LoadBytes - SymtabCmd - Syms []Symbol -} - -// A Dysymtab represents a Mach-O dynamic symbol table command. -type Dysymtab struct { - LoadBytes - DysymtabCmd - IndirectSyms []uint32 // indices into Symtab.Syms -} - -/* - * Mach-O reader - */ - -// FormatError is returned by some operations if the data does -// not have the correct format for an object file. -type FormatError struct { - off int64 - msg string - val interface{} -} - -func (e *FormatError) Error() string { - msg := e.msg - if e.val != nil { - msg += fmt.Sprintf(" '%v'", e.val) - } - msg += fmt.Sprintf(" in record at byte %#x", e.off) - return msg -} - -// Open opens the named file using os.Open and prepares it for use as a Mach-O binary. -func Open(name string) (*File, error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - ff, err := NewFile(f) - if err != nil { - f.Close() - return nil, err - } - ff.closer = f - return ff, nil -} - -// Close closes the File. -// If the File was created using NewFile directly instead of Open, -// Close has no effect. -func (f *File) Close() error { - var err error - if f.closer != nil { - err = f.closer.Close() - f.closer = nil - } - return err -} - -// NewFile creates a new File for accessing a Mach-O binary in an underlying reader. -// The Mach-O binary is expected to start at position 0 in the ReaderAt. -func NewFile(r io.ReaderAt) (*File, error) { - f := new(File) - sr := io.NewSectionReader(r, 0, 1<<63-1) - - // Read and decode Mach magic to determine byte order, size. - // Magic32 and Magic64 differ only in the bottom bit. - var ident [4]byte - if _, err := r.ReadAt(ident[0:], 0); err != nil { - return nil, err - } - be := binary.BigEndian.Uint32(ident[0:]) - le := binary.LittleEndian.Uint32(ident[0:]) - switch Magic32 &^ 1 { - case be &^ 1: - f.ByteOrder = binary.BigEndian - f.Magic = be - case le &^ 1: - f.ByteOrder = binary.LittleEndian - f.Magic = le - default: - return nil, &FormatError{0, "invalid magic number", nil} - } - - // Read entire file header. - if err := binary.Read(sr, f.ByteOrder, &f.FileHeader); err != nil { - return nil, err - } - - // Then load commands. - offset := int64(fileHeaderSize32) - if f.Magic == Magic64 { - offset = fileHeaderSize64 - } - dat := make([]byte, f.Cmdsz) - if _, err := r.ReadAt(dat, offset); err != nil { - return nil, err - } - f.Loads = make([]Load, f.Ncmd) - bo := f.ByteOrder - for i := range f.Loads { - // Each load command begins with uint32 command and length. - if len(dat) < 8 { - return nil, &FormatError{offset, "command block too small", nil} - } - cmd, siz := LoadCmd(bo.Uint32(dat[0:4])), bo.Uint32(dat[4:8]) - if siz < 8 || siz > uint32(len(dat)) { - return nil, &FormatError{offset, "invalid command block size", nil} - } - var cmddat []byte - cmddat, dat = dat[0:siz], dat[siz:] - offset += int64(siz) - var s *Segment - switch cmd { - default: - f.Loads[i] = LoadBytes(cmddat) - - case LoadCmdDylib: - var hdr DylibCmd - b := bytes.NewReader(cmddat) - if err := binary.Read(b, bo, &hdr); err != nil { - return nil, err - } - l := new(Dylib) - if hdr.Name >= uint32(len(cmddat)) { - return nil, &FormatError{offset, "invalid name in dynamic library command", hdr.Name} - } - l.Name = cstring(cmddat[hdr.Name:]) - l.Time = hdr.Time - l.CurrentVersion = hdr.CurrentVersion - l.CompatVersion = hdr.CompatVersion - l.LoadBytes = LoadBytes(cmddat) - f.Loads[i] = l - - case LoadCmdSymtab: - var hdr SymtabCmd - b := bytes.NewReader(cmddat) - if err := binary.Read(b, bo, &hdr); err != nil { - return nil, err - } - strtab := make([]byte, hdr.Strsize) - if _, err := r.ReadAt(strtab, int64(hdr.Stroff)); err != nil { - return nil, err - } - var symsz int - if f.Magic == Magic64 { - symsz = 16 - } else { - symsz = 12 - } - symdat := make([]byte, int(hdr.Nsyms)*symsz) - if _, err := r.ReadAt(symdat, int64(hdr.Symoff)); err != nil { - return nil, err - } - st, err := f.parseSymtab(symdat, strtab, cmddat, &hdr, offset) - if err != nil { - return nil, err - } - f.Loads[i] = st - f.Symtab = st - - case LoadCmdDysymtab: - var hdr DysymtabCmd - b := bytes.NewReader(cmddat) - if err := binary.Read(b, bo, &hdr); err != nil { - return nil, err - } - dat := make([]byte, hdr.Nindirectsyms*4) - if _, err := r.ReadAt(dat, int64(hdr.Indirectsymoff)); err != nil { - return nil, err - } - x := make([]uint32, hdr.Nindirectsyms) - if err := binary.Read(bytes.NewReader(dat), bo, x); err != nil { - return nil, err - } - st := new(Dysymtab) - st.LoadBytes = LoadBytes(cmddat) - st.DysymtabCmd = hdr - st.IndirectSyms = x - f.Loads[i] = st - f.Dysymtab = st - - case LoadCmdSegment: - var seg32 Segment32 - b := bytes.NewReader(cmddat) - if err := binary.Read(b, bo, &seg32); err != nil { - return nil, err - } - s = new(Segment) - s.LoadBytes = cmddat - s.Cmd = cmd - s.Len = siz - s.Name = cstring(seg32.Name[0:]) - s.Addr = uint64(seg32.Addr) - s.Memsz = uint64(seg32.Memsz) - s.Offset = uint64(seg32.Offset) - s.Filesz = uint64(seg32.Filesz) - s.Maxprot = seg32.Maxprot - s.Prot = seg32.Prot - s.Nsect = seg32.Nsect - s.Flag = seg32.Flag - f.Loads[i] = s - for i := 0; i < int(s.Nsect); i++ { - var sh32 Section32 - if err := binary.Read(b, bo, &sh32); err != nil { - return nil, err - } - sh := new(Section) - sh.Name = cstring(sh32.Name[0:]) - sh.Seg = cstring(sh32.Seg[0:]) - sh.Addr = uint64(sh32.Addr) - sh.Size = uint64(sh32.Size) - sh.Offset = sh32.Offset - sh.Align = sh32.Align - sh.Reloff = sh32.Reloff - sh.Nreloc = sh32.Nreloc - sh.Flags = sh32.Flags - f.pushSection(sh, r) - } - - case LoadCmdSegment64: - var seg64 Segment64 - b := bytes.NewReader(cmddat) - if err := binary.Read(b, bo, &seg64); err != nil { - return nil, err - } - s = new(Segment) - s.LoadBytes = cmddat - s.Cmd = cmd - s.Len = siz - s.Name = cstring(seg64.Name[0:]) - s.Addr = seg64.Addr - s.Memsz = seg64.Memsz - s.Offset = seg64.Offset - s.Filesz = seg64.Filesz - s.Maxprot = seg64.Maxprot - s.Prot = seg64.Prot - s.Nsect = seg64.Nsect - s.Flag = seg64.Flag - f.Loads[i] = s - for i := 0; i < int(s.Nsect); i++ { - var sh64 Section64 - if err := binary.Read(b, bo, &sh64); err != nil { - return nil, err - } - sh := new(Section) - sh.Name = cstring(sh64.Name[0:]) - sh.Seg = cstring(sh64.Seg[0:]) - sh.Addr = sh64.Addr - sh.Size = sh64.Size - sh.Offset = sh64.Offset - sh.Align = sh64.Align - sh.Reloff = sh64.Reloff - sh.Nreloc = sh64.Nreloc - sh.Flags = sh64.Flags - f.pushSection(sh, r) - } - } - if s != nil { - s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.Filesz)) - s.ReaderAt = s.sr - } - } - return f, nil -} - -func (f *File) parseSymtab(symdat, strtab, cmddat []byte, hdr *SymtabCmd, offset int64) (*Symtab, error) { - bo := f.ByteOrder - symtab := make([]Symbol, hdr.Nsyms) - b := bytes.NewReader(symdat) - for i := range symtab { - var n Nlist64 - if f.Magic == Magic64 { - if err := binary.Read(b, bo, &n); err != nil { - return nil, err - } - } else { - var n32 Nlist32 - if err := binary.Read(b, bo, &n32); err != nil { - return nil, err - } - n.Name = n32.Name - n.Type = n32.Type - n.Sect = n32.Sect - n.Desc = n32.Desc - n.Value = uint64(n32.Value) - } - sym := &symtab[i] - if n.Name >= uint32(len(strtab)) { - return nil, &FormatError{offset, "invalid name in symbol table", n.Name} - } - sym.Name = cstring(strtab[n.Name:]) - sym.Type = n.Type - sym.Sect = n.Sect - sym.Desc = n.Desc - sym.Value = n.Value - } - st := new(Symtab) - st.LoadBytes = LoadBytes(cmddat) - st.Syms = symtab - return st, nil -} - -func (f *File) pushSection(sh *Section, r io.ReaderAt) { - f.Sections = append(f.Sections, sh) - sh.sr = io.NewSectionReader(r, int64(sh.Offset), int64(sh.Size)) - sh.ReaderAt = sh.sr -} - -func cstring(b []byte) string { - var i int - for i = 0; i < len(b) && b[i] != 0; i++ { - } - return string(b[0:i]) -} - -// Segment returns the first Segment with the given name, or nil if no such segment exists. -func (f *File) Segment(name string) *Segment { - for _, l := range f.Loads { - if s, ok := l.(*Segment); ok && s.Name == name { - return s - } - } - return nil -} - -// Section returns the first section with the given name, or nil if no such -// section exists. -func (f *File) Section(name string) *Section { - for _, s := range f.Sections { - if s.Name == name { - return s - } - } - return nil -} - -// DWARF returns the DWARF debug information for the Mach-O file. -func (f *File) DWARF() (*dwarf.Data, error) { - // There are many other DWARF sections, but these - // are the ones the debug/dwarf package uses. - // Don't bother loading others. - var names = [...]string{"abbrev", "info", "line", "str"} - var dat [len(names)][]byte - for i, name := range names { - name = "__debug_" + name - s := f.Section(name) - if s == nil { - continue - } - b, err := s.Data() - if err != nil && uint64(len(b)) < s.Size { - return nil, err - } - dat[i] = b - } - - abbrev, info, line, str := dat[0], dat[1], dat[2], dat[3] - return dwarf.New(abbrev, nil, nil, info, line, nil, nil, str) -} - -// ImportedSymbols returns the names of all symbols -// referred to by the binary f that are expected to be -// satisfied by other libraries at dynamic load time. -func (f *File) ImportedSymbols() ([]string, error) { - if f.Dysymtab == nil || f.Symtab == nil { - return nil, &FormatError{0, "missing symbol table", nil} - } - - st := f.Symtab - dt := f.Dysymtab - var all []string - for _, s := range st.Syms[dt.Iundefsym : dt.Iundefsym+dt.Nundefsym] { - all = append(all, s.Name) - } - return all, nil -} - -// ImportedLibraries returns the paths of all libraries -// referred to by the binary f that are expected to be -// linked with the binary at dynamic link time. -func (f *File) ImportedLibraries() ([]string, error) { - var all []string - for _, l := range f.Loads { - if lib, ok := l.(*Dylib); ok { - all = append(all, lib.Name) - } - } - return all, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/file_test.go b/llgo/third_party/gofrontend/libgo/go/debug/macho/file_test.go deleted file mode 100644 index 4797780ce77918173d954c1c57ad4f8f59ba2f52..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/macho/file_test.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package macho - -import ( - "reflect" - "testing" -) - -type fileTest struct { - file string - hdr FileHeader - segments []*SegmentHeader - sections []*SectionHeader -} - -var fileTests = []fileTest{ - { - "testdata/gcc-386-darwin-exec", - FileHeader{0xfeedface, Cpu386, 0x3, 0x2, 0xc, 0x3c0, 0x85}, - []*SegmentHeader{ - {LoadCmdSegment, 0x38, "__PAGEZERO", 0x0, 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - {LoadCmdSegment, 0xc0, "__TEXT", 0x1000, 0x1000, 0x0, 0x1000, 0x7, 0x5, 0x2, 0x0}, - {LoadCmdSegment, 0xc0, "__DATA", 0x2000, 0x1000, 0x1000, 0x1000, 0x7, 0x3, 0x2, 0x0}, - {LoadCmdSegment, 0x7c, "__IMPORT", 0x3000, 0x1000, 0x2000, 0x1000, 0x7, 0x7, 0x1, 0x0}, - {LoadCmdSegment, 0x38, "__LINKEDIT", 0x4000, 0x1000, 0x3000, 0x12c, 0x7, 0x1, 0x0, 0x0}, - nil, - nil, - nil, - nil, - nil, - nil, - nil, - }, - []*SectionHeader{ - {"__text", "__TEXT", 0x1f68, 0x88, 0xf68, 0x2, 0x0, 0x0, 0x80000400}, - {"__cstring", "__TEXT", 0x1ff0, 0xd, 0xff0, 0x0, 0x0, 0x0, 0x2}, - {"__data", "__DATA", 0x2000, 0x14, 0x1000, 0x2, 0x0, 0x0, 0x0}, - {"__dyld", "__DATA", 0x2014, 0x1c, 0x1014, 0x2, 0x0, 0x0, 0x0}, - {"__jump_table", "__IMPORT", 0x3000, 0xa, 0x2000, 0x6, 0x0, 0x0, 0x4000008}, - }, - }, - { - "testdata/gcc-amd64-darwin-exec", - FileHeader{0xfeedfacf, CpuAmd64, 0x80000003, 0x2, 0xb, 0x568, 0x85}, - []*SegmentHeader{ - {LoadCmdSegment64, 0x48, "__PAGEZERO", 0x0, 0x100000000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, - {LoadCmdSegment64, 0x1d8, "__TEXT", 0x100000000, 0x1000, 0x0, 0x1000, 0x7, 0x5, 0x5, 0x0}, - {LoadCmdSegment64, 0x138, "__DATA", 0x100001000, 0x1000, 0x1000, 0x1000, 0x7, 0x3, 0x3, 0x0}, - {LoadCmdSegment64, 0x48, "__LINKEDIT", 0x100002000, 0x1000, 0x2000, 0x140, 0x7, 0x1, 0x0, 0x0}, - nil, - nil, - nil, - nil, - nil, - nil, - nil, - }, - []*SectionHeader{ - {"__text", "__TEXT", 0x100000f14, 0x6d, 0xf14, 0x2, 0x0, 0x0, 0x80000400}, - {"__symbol_stub1", "__TEXT", 0x100000f81, 0xc, 0xf81, 0x0, 0x0, 0x0, 0x80000408}, - {"__stub_helper", "__TEXT", 0x100000f90, 0x18, 0xf90, 0x2, 0x0, 0x0, 0x0}, - {"__cstring", "__TEXT", 0x100000fa8, 0xd, 0xfa8, 0x0, 0x0, 0x0, 0x2}, - {"__eh_frame", "__TEXT", 0x100000fb8, 0x48, 0xfb8, 0x3, 0x0, 0x0, 0x6000000b}, - {"__data", "__DATA", 0x100001000, 0x1c, 0x1000, 0x3, 0x0, 0x0, 0x0}, - {"__dyld", "__DATA", 0x100001020, 0x38, 0x1020, 0x3, 0x0, 0x0, 0x0}, - {"__la_symbol_ptr", "__DATA", 0x100001058, 0x10, 0x1058, 0x2, 0x0, 0x0, 0x7}, - }, - }, - { - "testdata/gcc-amd64-darwin-exec-debug", - FileHeader{0xfeedfacf, CpuAmd64, 0x80000003, 0xa, 0x4, 0x5a0, 0}, - []*SegmentHeader{ - nil, - {LoadCmdSegment64, 0x1d8, "__TEXT", 0x100000000, 0x1000, 0x0, 0x0, 0x7, 0x5, 0x5, 0x0}, - {LoadCmdSegment64, 0x138, "__DATA", 0x100001000, 0x1000, 0x0, 0x0, 0x7, 0x3, 0x3, 0x0}, - {LoadCmdSegment64, 0x278, "__DWARF", 0x100002000, 0x1000, 0x1000, 0x1bc, 0x7, 0x3, 0x7, 0x0}, - }, - []*SectionHeader{ - {"__text", "__TEXT", 0x100000f14, 0x0, 0x0, 0x2, 0x0, 0x0, 0x80000400}, - {"__symbol_stub1", "__TEXT", 0x100000f81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80000408}, - {"__stub_helper", "__TEXT", 0x100000f90, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0}, - {"__cstring", "__TEXT", 0x100000fa8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2}, - {"__eh_frame", "__TEXT", 0x100000fb8, 0x0, 0x0, 0x3, 0x0, 0x0, 0x6000000b}, - {"__data", "__DATA", 0x100001000, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0}, - {"__dyld", "__DATA", 0x100001020, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0}, - {"__la_symbol_ptr", "__DATA", 0x100001058, 0x0, 0x0, 0x2, 0x0, 0x0, 0x7}, - {"__debug_abbrev", "__DWARF", 0x100002000, 0x36, 0x1000, 0x0, 0x0, 0x0, 0x0}, - {"__debug_aranges", "__DWARF", 0x100002036, 0x30, 0x1036, 0x0, 0x0, 0x0, 0x0}, - {"__debug_frame", "__DWARF", 0x100002066, 0x40, 0x1066, 0x0, 0x0, 0x0, 0x0}, - {"__debug_info", "__DWARF", 0x1000020a6, 0x54, 0x10a6, 0x0, 0x0, 0x0, 0x0}, - {"__debug_line", "__DWARF", 0x1000020fa, 0x47, 0x10fa, 0x0, 0x0, 0x0, 0x0}, - {"__debug_pubnames", "__DWARF", 0x100002141, 0x1b, 0x1141, 0x0, 0x0, 0x0, 0x0}, - {"__debug_str", "__DWARF", 0x10000215c, 0x60, 0x115c, 0x0, 0x0, 0x0, 0x0}, - }, - }, -} - -func TestOpen(t *testing.T) { - for i := range fileTests { - tt := &fileTests[i] - - f, err := Open(tt.file) - if err != nil { - t.Error(err) - continue - } - if !reflect.DeepEqual(f.FileHeader, tt.hdr) { - t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) - continue - } - for i, l := range f.Loads { - if i >= len(tt.segments) { - break - } - sh := tt.segments[i] - s, ok := l.(*Segment) - if sh == nil { - if ok { - t.Errorf("open %s, section %d: skipping %#v\n", tt.file, i, &s.SegmentHeader) - } - continue - } - if !ok { - t.Errorf("open %s, section %d: not *Segment\n", tt.file, i) - continue - } - have := &s.SegmentHeader - want := sh - if !reflect.DeepEqual(have, want) { - t.Errorf("open %s, segment %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) - } - } - tn := len(tt.segments) - fn := len(f.Loads) - if tn != fn { - t.Errorf("open %s: len(Loads) = %d, want %d", tt.file, fn, tn) - } - - for i, sh := range f.Sections { - if i >= len(tt.sections) { - break - } - have := &sh.SectionHeader - want := tt.sections[i] - if !reflect.DeepEqual(have, want) { - t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) - } - } - tn = len(tt.sections) - fn = len(f.Sections) - if tn != fn { - t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) - } - - } -} - -func TestOpenFailure(t *testing.T) { - filename := "file.go" // not a Mach-O file - _, err := Open(filename) // don't crash - if err == nil { - t.Errorf("open %s: succeeded unexpectedly", filename) - } -} - -func TestOpenFat(t *testing.T) { - ff, err := OpenFat("testdata/fat-gcc-386-amd64-darwin-exec") - if err != nil { - t.Fatal(err) - } - - if ff.Magic != MagicFat { - t.Errorf("OpenFat: got magic number %#x, want %#x", ff.Magic, MagicFat) - } - if len(ff.Arches) != 2 { - t.Errorf("OpenFat: got %d architectures, want 2", len(ff.Arches)) - } - - for i := range ff.Arches { - arch := &ff.Arches[i] - ftArch := &fileTests[i] - - if arch.Cpu != ftArch.hdr.Cpu || arch.SubCpu != ftArch.hdr.SubCpu { - t.Errorf("OpenFat: architecture #%d got cpu=%#x subtype=%#x, expected cpu=%#x, subtype=%#x", i, arch.Cpu, arch.SubCpu, ftArch.hdr.Cpu, ftArch.hdr.SubCpu) - } - - if !reflect.DeepEqual(arch.FileHeader, ftArch.hdr) { - t.Errorf("OpenFat header:\n\tgot %#v\n\twant %#v\n", arch.FileHeader, ftArch.hdr) - } - } -} - -func TestOpenFatFailure(t *testing.T) { - filename := "file.go" // not a Mach-O file - if _, err := OpenFat(filename); err == nil { - t.Errorf("OpenFat %s: succeeded unexpectedly", filename) - } - - filename = "testdata/gcc-386-darwin-exec" // not a fat Mach-O - ff, err := OpenFat(filename) - if err != ErrNotFat { - t.Errorf("OpenFat %s: got %v, want ErrNotFat", filename, err) - } - if ff != nil { - t.Errorf("OpenFat %s: got %v, want nil", filename, ff) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/macho.go b/llgo/third_party/gofrontend/libgo/go/debug/macho/macho.go deleted file mode 100644 index d9678c8eda40887342c1aaa48043b36da597a45b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/macho/macho.go +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Mach-O header data structures -// http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html - -package macho - -import "strconv" - -// A FileHeader represents a Mach-O file header. -type FileHeader struct { - Magic uint32 - Cpu Cpu - SubCpu uint32 - Type Type - Ncmd uint32 - Cmdsz uint32 - Flags uint32 -} - -const ( - fileHeaderSize32 = 7 * 4 - fileHeaderSize64 = 8 * 4 -) - -const ( - Magic32 uint32 = 0xfeedface - Magic64 uint32 = 0xfeedfacf - MagicFat uint32 = 0xcafebabe -) - -// A Type is the Mach-O file type, e.g. an object file, executable, or dynamic library. -type Type uint32 - -const ( - TypeObj Type = 1 - TypeExec Type = 2 - TypeDylib Type = 6 - TypeBundle Type = 8 -) - -// A Cpu is a Mach-O cpu type. -type Cpu uint32 - -const cpuArch64 = 0x01000000 - -const ( - Cpu386 Cpu = 7 - CpuAmd64 Cpu = Cpu386 | cpuArch64 - CpuArm Cpu = 12 - CpuPpc Cpu = 18 - CpuPpc64 Cpu = CpuPpc | cpuArch64 -) - -var cpuStrings = []intName{ - {uint32(Cpu386), "Cpu386"}, - {uint32(CpuAmd64), "CpuAmd64"}, - {uint32(CpuArm), "CpuArm"}, - {uint32(CpuPpc), "CpuPpc"}, - {uint32(CpuPpc64), "CpuPpc64"}, -} - -func (i Cpu) String() string { return stringName(uint32(i), cpuStrings, false) } -func (i Cpu) GoString() string { return stringName(uint32(i), cpuStrings, true) } - -// A LoadCmd is a Mach-O load command. -type LoadCmd uint32 - -const ( - LoadCmdSegment LoadCmd = 1 - LoadCmdSymtab LoadCmd = 2 - LoadCmdThread LoadCmd = 4 - LoadCmdUnixThread LoadCmd = 5 // thread+stack - LoadCmdDysymtab LoadCmd = 11 - LoadCmdDylib LoadCmd = 12 - LoadCmdDylinker LoadCmd = 15 - LoadCmdSegment64 LoadCmd = 25 -) - -var cmdStrings = []intName{ - {uint32(LoadCmdSegment), "LoadCmdSegment"}, - {uint32(LoadCmdThread), "LoadCmdThread"}, - {uint32(LoadCmdUnixThread), "LoadCmdUnixThread"}, - {uint32(LoadCmdDylib), "LoadCmdDylib"}, - {uint32(LoadCmdSegment64), "LoadCmdSegment64"}, -} - -func (i LoadCmd) String() string { return stringName(uint32(i), cmdStrings, false) } -func (i LoadCmd) GoString() string { return stringName(uint32(i), cmdStrings, true) } - -// A Segment64 is a 64-bit Mach-O segment load command. -type Segment64 struct { - Cmd LoadCmd - Len uint32 - Name [16]byte - Addr uint64 - Memsz uint64 - Offset uint64 - Filesz uint64 - Maxprot uint32 - Prot uint32 - Nsect uint32 - Flag uint32 -} - -// A Segment32 is a 32-bit Mach-O segment load command. -type Segment32 struct { - Cmd LoadCmd - Len uint32 - Name [16]byte - Addr uint32 - Memsz uint32 - Offset uint32 - Filesz uint32 - Maxprot uint32 - Prot uint32 - Nsect uint32 - Flag uint32 -} - -// A DylibCmd is a Mach-O load dynamic library command. -type DylibCmd struct { - Cmd LoadCmd - Len uint32 - Name uint32 - Time uint32 - CurrentVersion uint32 - CompatVersion uint32 -} - -// A Section32 is a 32-bit Mach-O section header. -type Section32 struct { - Name [16]byte - Seg [16]byte - Addr uint32 - Size uint32 - Offset uint32 - Align uint32 - Reloff uint32 - Nreloc uint32 - Flags uint32 - Reserve1 uint32 - Reserve2 uint32 -} - -// A Section32 is a 64-bit Mach-O section header. -type Section64 struct { - Name [16]byte - Seg [16]byte - Addr uint64 - Size uint64 - Offset uint32 - Align uint32 - Reloff uint32 - Nreloc uint32 - Flags uint32 - Reserve1 uint32 - Reserve2 uint32 - Reserve3 uint32 -} - -// A SymtabCmd is a Mach-O symbol table command. -type SymtabCmd struct { - Cmd LoadCmd - Len uint32 - Symoff uint32 - Nsyms uint32 - Stroff uint32 - Strsize uint32 -} - -// A DysymtabCmd is a Mach-O dynamic symbol table command. -type DysymtabCmd struct { - Cmd LoadCmd - Len uint32 - Ilocalsym uint32 - Nlocalsym uint32 - Iextdefsym uint32 - Nextdefsym uint32 - Iundefsym uint32 - Nundefsym uint32 - Tocoffset uint32 - Ntoc uint32 - Modtaboff uint32 - Nmodtab uint32 - Extrefsymoff uint32 - Nextrefsyms uint32 - Indirectsymoff uint32 - Nindirectsyms uint32 - Extreloff uint32 - Nextrel uint32 - Locreloff uint32 - Nlocrel uint32 -} - -// An Nlist32 is a Mach-O 32-bit symbol table entry. -type Nlist32 struct { - Name uint32 - Type uint8 - Sect uint8 - Desc uint16 - Value uint32 -} - -// An Nlist64 is a Mach-O 64-bit symbol table entry. -type Nlist64 struct { - Name uint32 - Type uint8 - Sect uint8 - Desc uint16 - Value uint64 -} - -// A Symbol is a Mach-O 32-bit or 64-bit symbol table entry. -type Symbol struct { - Name string - Type uint8 - Sect uint8 - Desc uint16 - Value uint64 -} - -// A Thread is a Mach-O thread state command. -type Thread struct { - Cmd LoadCmd - Len uint32 - Type uint32 - Data []uint32 -} - -// Regs386 is the Mach-O 386 register structure. -type Regs386 struct { - AX uint32 - BX uint32 - CX uint32 - DX uint32 - DI uint32 - SI uint32 - BP uint32 - SP uint32 - SS uint32 - FLAGS uint32 - IP uint32 - CS uint32 - DS uint32 - ES uint32 - FS uint32 - GS uint32 -} - -// RegsAMD64 is the Mach-O AMD64 register structure. -type RegsAMD64 struct { - AX uint64 - BX uint64 - CX uint64 - DX uint64 - DI uint64 - SI uint64 - BP uint64 - SP uint64 - R8 uint64 - R9 uint64 - R10 uint64 - R11 uint64 - R12 uint64 - R13 uint64 - R14 uint64 - R15 uint64 - IP uint64 - FLAGS uint64 - CS uint64 - FS uint64 - GS uint64 -} - -type intName struct { - i uint32 - s string -} - -func stringName(i uint32, names []intName, goSyntax bool) string { - for _, n := range names { - if n.i == i { - if goSyntax { - return "macho." + n.s - } - return n.s - } - } - return strconv.FormatUint(uint64(i), 10) -} - -func flagName(i uint32, names []intName, goSyntax bool) string { - s := "" - for _, n := range names { - if n.i&i == n.i { - if len(s) > 0 { - s += "+" - } - if goSyntax { - s += "macho." - } - s += n.s - i -= n.i - } - } - if len(s) == 0 { - return "0x" + strconv.FormatUint(uint64(i), 16) - } - if i != 0 { - s += "+0x" + strconv.FormatUint(uint64(i), 16) - } - return s -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/fat-gcc-386-amd64-darwin-exec b/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/fat-gcc-386-amd64-darwin-exec deleted file mode 100644 index 7efd19300b2899328664e0e0314fac011722724b..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/fat-gcc-386-amd64-darwin-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-386-darwin-exec b/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-386-darwin-exec deleted file mode 100755 index 03ba1bafac0a6cba92b72239e51b2a9618668032..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-386-darwin-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec b/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec deleted file mode 100755 index 5155a5a26f6a7c0d9cf8720e03630f171713f859..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec-debug b/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec-debug deleted file mode 100644 index a47d3aef782a3d69b8d5d3fd4d475ec54cecf006..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/gcc-amd64-darwin-exec-debug and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/hello.c b/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/hello.c deleted file mode 100644 index a689d3644e1e95d9d9cb1f013be6430d90dab71c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/macho/testdata/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int -main(void) -{ - printf("hello, world\n"); - return 0; -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/file.go b/llgo/third_party/gofrontend/libgo/go/debug/pe/file.go deleted file mode 100644 index 3df4ae73681e0f56fce796b4fb27640576b8b00e..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/pe/file.go +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package pe implements access to PE (Microsoft Windows Portable Executable) files. -package pe - -import ( - "debug/dwarf" - "encoding/binary" - "errors" - "fmt" - "io" - "os" - "strconv" -) - -// A File represents an open PE file. -type File struct { - FileHeader - OptionalHeader interface{} // of type *OptionalHeader32 or *OptionalHeader64 - Sections []*Section - Symbols []*Symbol - - closer io.Closer -} - -type SectionHeader struct { - Name string - VirtualSize uint32 - VirtualAddress uint32 - Size uint32 - Offset uint32 - PointerToRelocations uint32 - PointerToLineNumbers uint32 - NumberOfRelocations uint16 - NumberOfLineNumbers uint16 - Characteristics uint32 -} - -type Section struct { - SectionHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -type Symbol struct { - Name string - Value uint32 - SectionNumber int16 - Type uint16 - StorageClass uint8 -} - -type ImportDirectory struct { - OriginalFirstThunk uint32 - TimeDateStamp uint32 - ForwarderChain uint32 - Name uint32 - FirstThunk uint32 - - dll string -} - -// Data reads and returns the contents of the PE section. -func (s *Section) Data() ([]byte, error) { - dat := make([]byte, s.sr.Size()) - n, err := s.sr.ReadAt(dat, 0) - if n == len(dat) { - err = nil - } - return dat[0:n], err -} - -// Open returns a new ReadSeeker reading the PE section. -func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } - -type FormatError struct { - off int64 - msg string - val interface{} -} - -func (e *FormatError) Error() string { - msg := e.msg - if e.val != nil { - msg += fmt.Sprintf(" '%v'", e.val) - } - msg += fmt.Sprintf(" in record at byte %#x", e.off) - return msg -} - -// Open opens the named file using os.Open and prepares it for use as a PE binary. -func Open(name string) (*File, error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - ff, err := NewFile(f) - if err != nil { - f.Close() - return nil, err - } - ff.closer = f - return ff, nil -} - -// Close closes the File. -// If the File was created using NewFile directly instead of Open, -// Close has no effect. -func (f *File) Close() error { - var err error - if f.closer != nil { - err = f.closer.Close() - f.closer = nil - } - return err -} - -var ( - sizeofOptionalHeader32 = uint16(binary.Size(OptionalHeader32{})) - sizeofOptionalHeader64 = uint16(binary.Size(OptionalHeader64{})) -) - -// NewFile creates a new File for accessing a PE binary in an underlying reader. -func NewFile(r io.ReaderAt) (*File, error) { - f := new(File) - sr := io.NewSectionReader(r, 0, 1<<63-1) - - var dosheader [96]byte - if _, err := r.ReadAt(dosheader[0:], 0); err != nil { - return nil, err - } - var base int64 - if dosheader[0] == 'M' && dosheader[1] == 'Z' { - signoff := int64(binary.LittleEndian.Uint32(dosheader[0x3c:])) - var sign [4]byte - r.ReadAt(sign[:], signoff) - if !(sign[0] == 'P' && sign[1] == 'E' && sign[2] == 0 && sign[3] == 0) { - return nil, errors.New("Invalid PE File Format.") - } - base = signoff + 4 - } else { - base = int64(0) - } - sr.Seek(base, os.SEEK_SET) - if err := binary.Read(sr, binary.LittleEndian, &f.FileHeader); err != nil { - return nil, err - } - if f.FileHeader.Machine != IMAGE_FILE_MACHINE_UNKNOWN && f.FileHeader.Machine != IMAGE_FILE_MACHINE_AMD64 && f.FileHeader.Machine != IMAGE_FILE_MACHINE_I386 { - return nil, errors.New("Invalid PE File Format.") - } - - var ss []byte - if f.FileHeader.NumberOfSymbols > 0 { - // Get COFF string table, which is located at the end of the COFF symbol table. - sr.Seek(int64(f.FileHeader.PointerToSymbolTable+COFFSymbolSize*f.FileHeader.NumberOfSymbols), os.SEEK_SET) - var l uint32 - if err := binary.Read(sr, binary.LittleEndian, &l); err != nil { - return nil, err - } - ss = make([]byte, l) - if _, err := r.ReadAt(ss, int64(f.FileHeader.PointerToSymbolTable+COFFSymbolSize*f.FileHeader.NumberOfSymbols)); err != nil { - return nil, err - } - - // Process COFF symbol table. - sr.Seek(int64(f.FileHeader.PointerToSymbolTable), os.SEEK_SET) - aux := uint8(0) - for i := 0; i < int(f.FileHeader.NumberOfSymbols); i++ { - cs := new(COFFSymbol) - if err := binary.Read(sr, binary.LittleEndian, cs); err != nil { - return nil, err - } - if aux > 0 { - aux-- - continue - } - var name string - if cs.Name[0] == 0 && cs.Name[1] == 0 && cs.Name[2] == 0 && cs.Name[3] == 0 { - si := int(binary.LittleEndian.Uint32(cs.Name[4:])) - name, _ = getString(ss, si) - } else { - name = cstring(cs.Name[:]) - } - aux = cs.NumberOfAuxSymbols - s := &Symbol{ - Name: name, - Value: cs.Value, - SectionNumber: cs.SectionNumber, - Type: cs.Type, - StorageClass: cs.StorageClass, - } - f.Symbols = append(f.Symbols, s) - } - } - - // Read optional header. - sr.Seek(base, os.SEEK_SET) - if err := binary.Read(sr, binary.LittleEndian, &f.FileHeader); err != nil { - return nil, err - } - var oh32 OptionalHeader32 - var oh64 OptionalHeader64 - switch f.FileHeader.SizeOfOptionalHeader { - case sizeofOptionalHeader32: - if err := binary.Read(sr, binary.LittleEndian, &oh32); err != nil { - return nil, err - } - if oh32.Magic != 0x10b { // PE32 - return nil, fmt.Errorf("pe32 optional header has unexpected Magic of 0x%x", oh32.Magic) - } - f.OptionalHeader = &oh32 - case sizeofOptionalHeader64: - if err := binary.Read(sr, binary.LittleEndian, &oh64); err != nil { - return nil, err - } - if oh64.Magic != 0x20b { // PE32+ - return nil, fmt.Errorf("pe32+ optional header has unexpected Magic of 0x%x", oh64.Magic) - } - f.OptionalHeader = &oh64 - } - - // Process sections. - f.Sections = make([]*Section, f.FileHeader.NumberOfSections) - for i := 0; i < int(f.FileHeader.NumberOfSections); i++ { - sh := new(SectionHeader32) - if err := binary.Read(sr, binary.LittleEndian, sh); err != nil { - return nil, err - } - var name string - if sh.Name[0] == '\x2F' { - si, _ := strconv.Atoi(cstring(sh.Name[1:])) - name, _ = getString(ss, si) - } else { - name = cstring(sh.Name[0:]) - } - s := new(Section) - s.SectionHeader = SectionHeader{ - Name: name, - VirtualSize: sh.VirtualSize, - VirtualAddress: sh.VirtualAddress, - Size: sh.SizeOfRawData, - Offset: sh.PointerToRawData, - PointerToRelocations: sh.PointerToRelocations, - PointerToLineNumbers: sh.PointerToLineNumbers, - NumberOfRelocations: sh.NumberOfRelocations, - NumberOfLineNumbers: sh.NumberOfLineNumbers, - Characteristics: sh.Characteristics, - } - s.sr = io.NewSectionReader(r, int64(s.SectionHeader.Offset), int64(s.SectionHeader.Size)) - s.ReaderAt = s.sr - f.Sections[i] = s - } - return f, nil -} - -func cstring(b []byte) string { - var i int - for i = 0; i < len(b) && b[i] != 0; i++ { - } - return string(b[0:i]) -} - -// getString extracts a string from symbol string table. -func getString(section []byte, start int) (string, bool) { - if start < 0 || start >= len(section) { - return "", false - } - - for end := start; end < len(section); end++ { - if section[end] == 0 { - return string(section[start:end]), true - } - } - return "", false -} - -// Section returns the first section with the given name, or nil if no such -// section exists. -func (f *File) Section(name string) *Section { - for _, s := range f.Sections { - if s.Name == name { - return s - } - } - return nil -} - -func (f *File) DWARF() (*dwarf.Data, error) { - // There are many other DWARF sections, but these - // are the ones the debug/dwarf package uses. - // Don't bother loading others. - var names = [...]string{"abbrev", "info", "line", "str"} - var dat [len(names)][]byte - for i, name := range names { - name = ".debug_" + name - s := f.Section(name) - if s == nil { - continue - } - b, err := s.Data() - if err != nil && uint32(len(b)) < s.Size { - return nil, err - } - if 0 < s.VirtualSize && s.VirtualSize < s.Size { - b = b[:s.VirtualSize] - } - dat[i] = b - } - - abbrev, info, line, str := dat[0], dat[1], dat[2], dat[3] - return dwarf.New(abbrev, nil, nil, info, line, nil, nil, str) -} - -// ImportedSymbols returns the names of all symbols -// referred to by the binary f that are expected to be -// satisfied by other libraries at dynamic load time. -// It does not return weak symbols. -func (f *File) ImportedSymbols() ([]string, error) { - pe64 := f.Machine == IMAGE_FILE_MACHINE_AMD64 - ds := f.Section(".idata") - if ds == nil { - // not dynamic, so no libraries - return nil, nil - } - d, err := ds.Data() - if err != nil { - return nil, err - } - var ida []ImportDirectory - for len(d) > 0 { - var dt ImportDirectory - dt.OriginalFirstThunk = binary.LittleEndian.Uint32(d[0:4]) - dt.Name = binary.LittleEndian.Uint32(d[12:16]) - dt.FirstThunk = binary.LittleEndian.Uint32(d[16:20]) - d = d[20:] - if dt.OriginalFirstThunk == 0 { - break - } - ida = append(ida, dt) - } - names, _ := ds.Data() - var all []string - for _, dt := range ida { - dt.dll, _ = getString(names, int(dt.Name-ds.VirtualAddress)) - d, _ = ds.Data() - // seek to OriginalFirstThunk - d = d[dt.OriginalFirstThunk-ds.VirtualAddress:] - for len(d) > 0 { - if pe64 { // 64bit - va := binary.LittleEndian.Uint64(d[0:8]) - d = d[8:] - if va == 0 { - break - } - if va&0x8000000000000000 > 0 { // is Ordinal - // TODO add dynimport ordinal support. - } else { - fn, _ := getString(names, int(uint32(va)-ds.VirtualAddress+2)) - all = append(all, fn+":"+dt.dll) - } - } else { // 32bit - va := binary.LittleEndian.Uint32(d[0:4]) - d = d[4:] - if va == 0 { - break - } - if va&0x80000000 > 0 { // is Ordinal - // TODO add dynimport ordinal support. - //ord := va&0x0000FFFF - } else { - fn, _ := getString(names, int(va-ds.VirtualAddress+2)) - all = append(all, fn+":"+dt.dll) - } - } - } - } - - return all, nil -} - -// ImportedLibraries returns the names of all libraries -// referred to by the binary f that are expected to be -// linked with the binary at dynamic link time. -func (f *File) ImportedLibraries() ([]string, error) { - // TODO - // cgo -dynimport don't use this for windows PE, so just return. - return nil, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/file_test.go b/llgo/third_party/gofrontend/libgo/go/debug/pe/file_test.go deleted file mode 100644 index 316a569ede97dd5e2a84235f5fcb886453413c17..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/pe/file_test.go +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pe - -import ( - "debug/dwarf" - "io/ioutil" - "os" - "os/exec" - "path/filepath" - "reflect" - "runtime" - "testing" -) - -type fileTest struct { - file string - hdr FileHeader - opthdr interface{} - sections []*SectionHeader - symbols []*Symbol - hasNoDwarfInfo bool -} - -var fileTests = []fileTest{ - { - file: "testdata/gcc-386-mingw-obj", - hdr: FileHeader{0x014c, 0x000c, 0x0, 0x64a, 0x1e, 0x0, 0x104}, - sections: []*SectionHeader{ - {".text", 0, 0, 36, 500, 1440, 0, 3, 0, 0x60300020}, - {".data", 0, 0, 0, 0, 0, 0, 0, 0, 3224371264}, - {".bss", 0, 0, 0, 0, 0, 0, 0, 0, 3224371328}, - {".debug_abbrev", 0, 0, 137, 536, 0, 0, 0, 0, 0x42100000}, - {".debug_info", 0, 0, 418, 673, 1470, 0, 7, 0, 1108344832}, - {".debug_line", 0, 0, 128, 1091, 1540, 0, 1, 0, 1108344832}, - {".rdata", 0, 0, 16, 1219, 0, 0, 0, 0, 1076887616}, - {".debug_frame", 0, 0, 52, 1235, 1550, 0, 2, 0, 1110441984}, - {".debug_loc", 0, 0, 56, 1287, 0, 0, 0, 0, 1108344832}, - {".debug_pubnames", 0, 0, 27, 1343, 1570, 0, 1, 0, 1108344832}, - {".debug_pubtypes", 0, 0, 38, 1370, 1580, 0, 1, 0, 1108344832}, - {".debug_aranges", 0, 0, 32, 1408, 1590, 0, 2, 0, 1108344832}, - }, - symbols: []*Symbol{ - {".file", 0x0, -2, 0x0, 0x67}, - {"_main", 0x0, 1, 0x20, 0x2}, - {".text", 0x0, 1, 0x0, 0x3}, - {".data", 0x0, 2, 0x0, 0x3}, - {".bss", 0x0, 3, 0x0, 0x3}, - {".debug_abbrev", 0x0, 4, 0x0, 0x3}, - {".debug_info", 0x0, 5, 0x0, 0x3}, - {".debug_line", 0x0, 6, 0x0, 0x3}, - {".rdata", 0x0, 7, 0x0, 0x3}, - {".debug_frame", 0x0, 8, 0x0, 0x3}, - {".debug_loc", 0x0, 9, 0x0, 0x3}, - {".debug_pubnames", 0x0, 10, 0x0, 0x3}, - {".debug_pubtypes", 0x0, 11, 0x0, 0x3}, - {".debug_aranges", 0x0, 12, 0x0, 0x3}, - {"___main", 0x0, 0, 0x20, 0x2}, - {"_puts", 0x0, 0, 0x20, 0x2}, - }, - }, - { - file: "testdata/gcc-386-mingw-exec", - hdr: FileHeader{0x014c, 0x000f, 0x4c6a1b60, 0x3c00, 0x282, 0xe0, 0x107}, - opthdr: &OptionalHeader32{ - 0x10b, 0x2, 0x38, 0xe00, 0x1a00, 0x200, 0x1160, 0x1000, 0x2000, 0x400000, 0x1000, 0x200, 0x4, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x10000, 0x400, 0x14abb, 0x3, 0x0, 0x200000, 0x1000, 0x100000, 0x1000, 0x0, 0x10, - [16]DataDirectory{ - {0x0, 0x0}, - {0x5000, 0x3c8}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x7000, 0x18}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - }, - }, - sections: []*SectionHeader{ - {".text", 0xcd8, 0x1000, 0xe00, 0x400, 0x0, 0x0, 0x0, 0x0, 0x60500060}, - {".data", 0x10, 0x2000, 0x200, 0x1200, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, - {".rdata", 0x120, 0x3000, 0x200, 0x1400, 0x0, 0x0, 0x0, 0x0, 0x40300040}, - {".bss", 0xdc, 0x4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0400080}, - {".idata", 0x3c8, 0x5000, 0x400, 0x1600, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, - {".CRT", 0x18, 0x6000, 0x200, 0x1a00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, - {".tls", 0x20, 0x7000, 0x200, 0x1c00, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, - {".debug_aranges", 0x20, 0x8000, 0x200, 0x1e00, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_pubnames", 0x51, 0x9000, 0x200, 0x2000, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_pubtypes", 0x91, 0xa000, 0x200, 0x2200, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_info", 0xe22, 0xb000, 0x1000, 0x2400, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_abbrev", 0x157, 0xc000, 0x200, 0x3400, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_line", 0x144, 0xd000, 0x200, 0x3600, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - {".debug_frame", 0x34, 0xe000, 0x200, 0x3800, 0x0, 0x0, 0x0, 0x0, 0x42300000}, - {".debug_loc", 0x38, 0xf000, 0x200, 0x3a00, 0x0, 0x0, 0x0, 0x0, 0x42100000}, - }, - }, - { - file: "testdata/gcc-amd64-mingw-obj", - hdr: FileHeader{0x8664, 0x6, 0x0, 0x198, 0x12, 0x0, 0x4}, - sections: []*SectionHeader{ - {".text", 0x0, 0x0, 0x30, 0x104, 0x15c, 0x0, 0x3, 0x0, 0x60500020}, - {".data", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0500040}, - {".bss", 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0500080}, - {".rdata", 0x0, 0x0, 0x10, 0x134, 0x0, 0x0, 0x0, 0x0, 0x40500040}, - {".xdata", 0x0, 0x0, 0xc, 0x144, 0x0, 0x0, 0x0, 0x0, 0x40300040}, - {".pdata", 0x0, 0x0, 0xc, 0x150, 0x17a, 0x0, 0x3, 0x0, 0x40300040}, - }, - symbols: []*Symbol{ - {".file", 0x0, -2, 0x0, 0x67}, - {"main", 0x0, 1, 0x20, 0x2}, - {".text", 0x0, 1, 0x0, 0x3}, - {".data", 0x0, 2, 0x0, 0x3}, - {".bss", 0x0, 3, 0x0, 0x3}, - {".rdata", 0x0, 4, 0x0, 0x3}, - {".xdata", 0x0, 5, 0x0, 0x3}, - {".pdata", 0x0, 6, 0x0, 0x3}, - {"__main", 0x0, 0, 0x20, 0x2}, - {"puts", 0x0, 0, 0x20, 0x2}, - }, - hasNoDwarfInfo: true, - }, - { - file: "testdata/gcc-amd64-mingw-exec", - hdr: FileHeader{0x8664, 0x11, 0x53e4364f, 0x39600, 0x6fc, 0xf0, 0x27}, - opthdr: &OptionalHeader64{ - 0x20b, 0x2, 0x16, 0x6a00, 0x2400, 0x1600, 0x14e0, 0x1000, 0x400000, 0x1000, 0x200, 0x4, 0x0, 0x0, 0x0, 0x5, 0x2, 0x0, 0x45000, 0x600, 0x46f19, 0x3, 0x0, 0x200000, 0x1000, 0x100000, 0x1000, 0x0, 0x10, - [16]DataDirectory{ - {0x0, 0x0}, - {0xe000, 0x990}, - {0x0, 0x0}, - {0xa000, 0x498}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x10000, 0x28}, - {0x0, 0x0}, - {0x0, 0x0}, - {0xe254, 0x218}, - {0x0, 0x0}, - {0x0, 0x0}, - {0x0, 0x0}, - }}, - sections: []*SectionHeader{ - {".text", 0x6860, 0x1000, 0x6a00, 0x600, 0x0, 0x0, 0x0, 0x0, 0x60500020}, - {".data", 0xe0, 0x8000, 0x200, 0x7000, 0x0, 0x0, 0x0, 0x0, 0xc0500040}, - {".rdata", 0x6b0, 0x9000, 0x800, 0x7200, 0x0, 0x0, 0x0, 0x0, 0x40600040}, - {".pdata", 0x498, 0xa000, 0x600, 0x7a00, 0x0, 0x0, 0x0, 0x0, 0x40300040}, - {".xdata", 0x488, 0xb000, 0x600, 0x8000, 0x0, 0x0, 0x0, 0x0, 0x40300040}, - {".bss", 0x1410, 0xc000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc0600080}, - {".idata", 0x990, 0xe000, 0xa00, 0x8600, 0x0, 0x0, 0x0, 0x0, 0xc0300040}, - {".CRT", 0x68, 0xf000, 0x200, 0x9000, 0x0, 0x0, 0x0, 0x0, 0xc0400040}, - {".tls", 0x48, 0x10000, 0x200, 0x9200, 0x0, 0x0, 0x0, 0x0, 0xc0600040}, - {".debug_aranges", 0x600, 0x11000, 0x600, 0x9400, 0x0, 0x0, 0x0, 0x0, 0x42500040}, - {".debug_info", 0x1316e, 0x12000, 0x13200, 0x9a00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - {".debug_abbrev", 0x2ccb, 0x26000, 0x2e00, 0x1cc00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - {".debug_line", 0x3c4d, 0x29000, 0x3e00, 0x1fa00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - {".debug_frame", 0x18b8, 0x2d000, 0x1a00, 0x23800, 0x0, 0x0, 0x0, 0x0, 0x42400040}, - {".debug_str", 0x396, 0x2f000, 0x400, 0x25200, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - {".debug_loc", 0x13240, 0x30000, 0x13400, 0x25600, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - {".debug_ranges", 0xa70, 0x44000, 0xc00, 0x38a00, 0x0, 0x0, 0x0, 0x0, 0x42100040}, - }, - }, -} - -func isOptHdrEq(a, b interface{}) bool { - switch va := a.(type) { - case *OptionalHeader32: - vb, ok := b.(*OptionalHeader32) - if !ok { - return false - } - return *vb == *va - case *OptionalHeader64: - vb, ok := b.(*OptionalHeader64) - if !ok { - return false - } - return *vb == *va - case nil: - return b == nil - } - return false -} - -func TestOpen(t *testing.T) { - for i := range fileTests { - tt := &fileTests[i] - - f, err := Open(tt.file) - if err != nil { - t.Error(err) - continue - } - if !reflect.DeepEqual(f.FileHeader, tt.hdr) { - t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) - continue - } - if !isOptHdrEq(tt.opthdr, f.OptionalHeader) { - t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.OptionalHeader, tt.opthdr) - continue - } - - for i, sh := range f.Sections { - if i >= len(tt.sections) { - break - } - have := &sh.SectionHeader - want := tt.sections[i] - if !reflect.DeepEqual(have, want) { - t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) - } - } - tn := len(tt.sections) - fn := len(f.Sections) - if tn != fn { - t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) - } - for i, have := range f.Symbols { - if i >= len(tt.symbols) { - break - } - want := tt.symbols[i] - if !reflect.DeepEqual(have, want) { - t.Errorf("open %s, symbol %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) - } - } - if !tt.hasNoDwarfInfo { - _, err = f.DWARF() - if err != nil { - t.Errorf("fetching %s dwarf details failed: %v", tt.file, err) - } - } - } -} - -func TestOpenFailure(t *testing.T) { - filename := "file.go" // not a PE file - _, err := Open(filename) // don't crash - if err == nil { - t.Errorf("open %s: succeeded unexpectedly", filename) - } -} - -func TestDWARF(t *testing.T) { - if runtime.GOOS != "windows" { - t.Skip("skipping windows only test") - } - - tmpdir, err := ioutil.TempDir("", "TestDWARF") - if err != nil { - t.Fatal("TempDir failed: ", err) - } - defer os.RemoveAll(tmpdir) - - prog := ` -package main -func main() { -} -` - src := filepath.Join(tmpdir, "a.go") - exe := filepath.Join(tmpdir, "a.exe") - err = ioutil.WriteFile(src, []byte(prog), 0644) - output, err := exec.Command("go", "build", "-o", exe, src).CombinedOutput() - if err != nil { - t.Fatalf("building test executable failed: %s %s", err, output) - } - - f, err := Open(exe) - if err != nil { - t.Fatal(err) - } - defer f.Close() - - d, err := f.DWARF() - if err != nil { - t.Fatal(err) - } - - // look for main.main - r := d.Reader() - for { - e, err := r.Next() - if err != nil { - t.Fatal("r.Next:", err) - } - if e == nil { - break - } - if e.Tag == dwarf.TagSubprogram { - for _, f := range e.Field { - if f.Attr == dwarf.AttrName && e.Val(dwarf.AttrName) == "main.main" { - return - } - } - } - } - t.Fatal("main.main not found") -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/pe.go b/llgo/third_party/gofrontend/libgo/go/debug/pe/pe.go deleted file mode 100644 index 8e90b1b513acb1b687eae99099fbdcb041e9b442..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/pe/pe.go +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pe - -type FileHeader struct { - Machine uint16 - NumberOfSections uint16 - TimeDateStamp uint32 - PointerToSymbolTable uint32 - NumberOfSymbols uint32 - SizeOfOptionalHeader uint16 - Characteristics uint16 -} - -type DataDirectory struct { - VirtualAddress uint32 - Size uint32 -} - -type OptionalHeader32 struct { - Magic uint16 - MajorLinkerVersion uint8 - MinorLinkerVersion uint8 - SizeOfCode uint32 - SizeOfInitializedData uint32 - SizeOfUninitializedData uint32 - AddressOfEntryPoint uint32 - BaseOfCode uint32 - BaseOfData uint32 - ImageBase uint32 - SectionAlignment uint32 - FileAlignment uint32 - MajorOperatingSystemVersion uint16 - MinorOperatingSystemVersion uint16 - MajorImageVersion uint16 - MinorImageVersion uint16 - MajorSubsystemVersion uint16 - MinorSubsystemVersion uint16 - Win32VersionValue uint32 - SizeOfImage uint32 - SizeOfHeaders uint32 - CheckSum uint32 - Subsystem uint16 - DllCharacteristics uint16 - SizeOfStackReserve uint32 - SizeOfStackCommit uint32 - SizeOfHeapReserve uint32 - SizeOfHeapCommit uint32 - LoaderFlags uint32 - NumberOfRvaAndSizes uint32 - DataDirectory [16]DataDirectory -} - -type OptionalHeader64 struct { - Magic uint16 - MajorLinkerVersion uint8 - MinorLinkerVersion uint8 - SizeOfCode uint32 - SizeOfInitializedData uint32 - SizeOfUninitializedData uint32 - AddressOfEntryPoint uint32 - BaseOfCode uint32 - ImageBase uint64 - SectionAlignment uint32 - FileAlignment uint32 - MajorOperatingSystemVersion uint16 - MinorOperatingSystemVersion uint16 - MajorImageVersion uint16 - MinorImageVersion uint16 - MajorSubsystemVersion uint16 - MinorSubsystemVersion uint16 - Win32VersionValue uint32 - SizeOfImage uint32 - SizeOfHeaders uint32 - CheckSum uint32 - Subsystem uint16 - DllCharacteristics uint16 - SizeOfStackReserve uint64 - SizeOfStackCommit uint64 - SizeOfHeapReserve uint64 - SizeOfHeapCommit uint64 - LoaderFlags uint32 - NumberOfRvaAndSizes uint32 - DataDirectory [16]DataDirectory -} - -type SectionHeader32 struct { - Name [8]uint8 - VirtualSize uint32 - VirtualAddress uint32 - SizeOfRawData uint32 - PointerToRawData uint32 - PointerToRelocations uint32 - PointerToLineNumbers uint32 - NumberOfRelocations uint16 - NumberOfLineNumbers uint16 - Characteristics uint32 -} - -const COFFSymbolSize = 18 - -type COFFSymbol struct { - Name [8]uint8 - Value uint32 - SectionNumber int16 - Type uint16 - StorageClass uint8 - NumberOfAuxSymbols uint8 -} - -const ( - IMAGE_FILE_MACHINE_UNKNOWN = 0x0 - IMAGE_FILE_MACHINE_AM33 = 0x1d3 - IMAGE_FILE_MACHINE_AMD64 = 0x8664 - IMAGE_FILE_MACHINE_ARM = 0x1c0 - IMAGE_FILE_MACHINE_EBC = 0xebc - IMAGE_FILE_MACHINE_I386 = 0x14c - IMAGE_FILE_MACHINE_IA64 = 0x200 - IMAGE_FILE_MACHINE_M32R = 0x9041 - IMAGE_FILE_MACHINE_MIPS16 = 0x266 - IMAGE_FILE_MACHINE_MIPSFPU = 0x366 - IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466 - IMAGE_FILE_MACHINE_POWERPC = 0x1f0 - IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1 - IMAGE_FILE_MACHINE_R4000 = 0x166 - IMAGE_FILE_MACHINE_SH3 = 0x1a2 - IMAGE_FILE_MACHINE_SH3DSP = 0x1a3 - IMAGE_FILE_MACHINE_SH4 = 0x1a6 - IMAGE_FILE_MACHINE_SH5 = 0x1a8 - IMAGE_FILE_MACHINE_THUMB = 0x1c2 - IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169 -) diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-exec b/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-exec deleted file mode 100644 index 4b808d043200a8cc10fb5038fe51b70ad6630765..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-obj b/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-obj deleted file mode 100644 index 0c84d898d5eee045c703a500883f97d0bdee113c..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-386-mingw-obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-exec b/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-exec deleted file mode 100644 index ce6feb6b7b6a4ca1fc5da067254d8acfd49f3377..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-obj b/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-obj deleted file mode 100644 index 48ae7921f33e4ace83da05688ca7f0c09d8df1f8..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/gcc-amd64-mingw-obj and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/hello.c b/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/hello.c deleted file mode 100644 index a689d3644e1e95d9d9cb1f013be6430d90dab71c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/pe/testdata/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int -main(void) -{ - printf("hello, world\n"); - return 0; -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file.go b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file.go deleted file mode 100644 index b11ed86f185dedffe46f24bf572da838e8d2cf72..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file.go +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package plan9obj implements access to Plan 9 a.out object files. -package plan9obj - -import ( - "encoding/binary" - "errors" - "fmt" - "io" - "os" -) - -// A FileHeader represents a Plan 9 a.out file header. -type FileHeader struct { - Magic uint32 - Bss uint32 - Entry uint64 - PtrSize int - LoadAddress uint64 - HdrSize uint64 -} - -// A File represents an open Plan 9 a.out file. -type File struct { - FileHeader - Sections []*Section - closer io.Closer -} - -// A SectionHeader represents a single Plan 9 a.out section header. -// This structure doesn't exist on-disk, but eases navigation -// through the object file. -type SectionHeader struct { - Name string - Size uint32 - Offset uint32 -} - -// A Section represents a single section in a Plan 9 a.out file. -type Section struct { - SectionHeader - - // Embed ReaderAt for ReadAt method. - // Do not embed SectionReader directly - // to avoid having Read and Seek. - // If a client wants Read and Seek it must use - // Open() to avoid fighting over the seek offset - // with other clients. - io.ReaderAt - sr *io.SectionReader -} - -// Data reads and returns the contents of the Plan 9 a.out section. -func (s *Section) Data() ([]byte, error) { - dat := make([]byte, s.sr.Size()) - n, err := s.sr.ReadAt(dat, 0) - if n == len(dat) { - err = nil - } - return dat[0:n], err -} - -// Open returns a new ReadSeeker reading the Plan 9 a.out section. -func (s *Section) Open() io.ReadSeeker { return io.NewSectionReader(s.sr, 0, 1<<63-1) } - -// A Symbol represents an entry in a Plan 9 a.out symbol table section. -type Sym struct { - Value uint64 - Type rune - Name string -} - -/* - * Plan 9 a.out reader - */ - -// formatError is returned by some operations if the data does -// not have the correct format for an object file. -type formatError struct { - off int - msg string - val interface{} -} - -func (e *formatError) Error() string { - msg := e.msg - if e.val != nil { - msg += fmt.Sprintf(" '%v'", e.val) - } - msg += fmt.Sprintf(" in record at byte %#x", e.off) - return msg -} - -// Open opens the named file using os.Open and prepares it for use as a Plan 9 a.out binary. -func Open(name string) (*File, error) { - f, err := os.Open(name) - if err != nil { - return nil, err - } - ff, err := NewFile(f) - if err != nil { - f.Close() - return nil, err - } - ff.closer = f - return ff, nil -} - -// Close closes the File. -// If the File was created using NewFile directly instead of Open, -// Close has no effect. -func (f *File) Close() error { - var err error - if f.closer != nil { - err = f.closer.Close() - f.closer = nil - } - return err -} - -func parseMagic(magic []byte) (uint32, error) { - m := binary.BigEndian.Uint32(magic) - switch m { - case Magic386, MagicAMD64, MagicARM: - return m, nil - } - return 0, &formatError{0, "bad magic number", magic} -} - -// NewFile creates a new File for accessing a Plan 9 binary in an underlying reader. -// The Plan 9 binary is expected to start at position 0 in the ReaderAt. -func NewFile(r io.ReaderAt) (*File, error) { - sr := io.NewSectionReader(r, 0, 1<<63-1) - // Read and decode Plan 9 magic - var magic [4]byte - if _, err := r.ReadAt(magic[:], 0); err != nil { - return nil, err - } - _, err := parseMagic(magic[:]) - if err != nil { - return nil, err - } - - ph := new(prog) - if err := binary.Read(sr, binary.BigEndian, ph); err != nil { - return nil, err - } - - f := &File{FileHeader: FileHeader{ - Magic: ph.Magic, - Bss: ph.Bss, - Entry: uint64(ph.Entry), - PtrSize: 4, - LoadAddress: 0x1000, - HdrSize: 4 * 8, - }} - - if ph.Magic&Magic64 != 0 { - if err := binary.Read(sr, binary.BigEndian, &f.Entry); err != nil { - return nil, err - } - f.PtrSize = 8 - f.LoadAddress = 0x200000 - f.HdrSize += 8 - } - - var sects = []struct { - name string - size uint32 - }{ - {"text", ph.Text}, - {"data", ph.Data}, - {"syms", ph.Syms}, - {"spsz", ph.Spsz}, - {"pcsz", ph.Pcsz}, - } - - f.Sections = make([]*Section, 5) - - off := uint32(f.HdrSize) - - for i, sect := range sects { - s := new(Section) - s.SectionHeader = SectionHeader{ - Name: sect.name, - Size: sect.size, - Offset: off, - } - off += sect.size - s.sr = io.NewSectionReader(r, int64(s.Offset), int64(s.Size)) - s.ReaderAt = s.sr - f.Sections[i] = s - } - - return f, nil -} - -func walksymtab(data []byte, ptrsz int, fn func(sym) error) error { - var order binary.ByteOrder = binary.BigEndian - var s sym - p := data - for len(p) >= 4 { - // Symbol type, value. - if len(p) < ptrsz { - return &formatError{len(data), "unexpected EOF", nil} - } - // fixed-width value - if ptrsz == 8 { - s.value = order.Uint64(p[0:8]) - p = p[8:] - } else { - s.value = uint64(order.Uint32(p[0:4])) - p = p[4:] - } - - var typ byte - typ = p[0] & 0x7F - s.typ = typ - p = p[1:] - - // Name. - var i int - var nnul int - for i = 0; i < len(p); i++ { - if p[i] == 0 { - nnul = 1 - break - } - } - switch typ { - case 'z', 'Z': - p = p[i+nnul:] - for i = 0; i+2 <= len(p); i += 2 { - if p[i] == 0 && p[i+1] == 0 { - nnul = 2 - break - } - } - } - if len(p) < i+nnul { - return &formatError{len(data), "unexpected EOF", nil} - } - s.name = p[0:i] - i += nnul - p = p[i:] - - fn(s) - } - return nil -} - -// NewTable decodes the Go symbol table in data, -// returning an in-memory representation. -func newTable(symtab []byte, ptrsz int) ([]Sym, error) { - var n int - err := walksymtab(symtab, ptrsz, func(s sym) error { - n++ - return nil - }) - if err != nil { - return nil, err - } - - fname := make(map[uint16]string) - syms := make([]Sym, 0, n) - err = walksymtab(symtab, ptrsz, func(s sym) error { - n := len(syms) - syms = syms[0 : n+1] - ts := &syms[n] - ts.Type = rune(s.typ) - ts.Value = s.value - switch s.typ { - default: - ts.Name = string(s.name[:]) - case 'z', 'Z': - for i := 0; i < len(s.name); i += 2 { - eltIdx := binary.BigEndian.Uint16(s.name[i : i+2]) - elt, ok := fname[eltIdx] - if !ok { - return &formatError{-1, "bad filename code", eltIdx} - } - if n := len(ts.Name); n > 0 && ts.Name[n-1] != '/' { - ts.Name += "/" - } - ts.Name += elt - } - } - switch s.typ { - case 'f': - fname[uint16(s.value)] = ts.Name - } - return nil - }) - if err != nil { - return nil, err - } - - return syms, nil -} - -// Symbols returns the symbol table for f. -func (f *File) Symbols() ([]Sym, error) { - symtabSection := f.Section("syms") - if symtabSection == nil { - return nil, errors.New("no symbol section") - } - - symtab, err := symtabSection.Data() - if err != nil { - return nil, errors.New("cannot load symbol section") - } - - return newTable(symtab, f.PtrSize) -} - -// Section returns a section with the given name, or nil if no such -// section exists. -func (f *File) Section(name string) *Section { - for _, s := range f.Sections { - if s.Name == name { - return s - } - } - return nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file_test.go b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file_test.go deleted file mode 100644 index cfd7a61d1cdff79d8752665ebc84af0c55be4530..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/file_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package plan9obj - -import ( - "reflect" - "testing" -) - -type fileTest struct { - file string - hdr FileHeader - sections []*SectionHeader -} - -var fileTests = []fileTest{ - { - "testdata/386-plan9-exec", - FileHeader{Magic386, 0x324, 0x14, 4, 0x1000, 32}, - []*SectionHeader{ - {"text", 0x4c5f, 0x20}, - {"data", 0x94c, 0x4c7f}, - {"syms", 0x2c2b, 0x55cb}, - {"spsz", 0x0, 0x81f6}, - {"pcsz", 0xf7a, 0x81f6}, - }, - }, - { - "testdata/amd64-plan9-exec", - FileHeader{MagicAMD64, 0x618, 0x13, 8, 0x200000, 40}, - []*SectionHeader{ - {"text", 0x4213, 0x28}, - {"data", 0xa80, 0x423b}, - {"syms", 0x2c8c, 0x4cbb}, - {"spsz", 0x0, 0x7947}, - {"pcsz", 0xca0, 0x7947}, - }, - }, -} - -func TestOpen(t *testing.T) { - for i := range fileTests { - tt := &fileTests[i] - - f, err := Open(tt.file) - if err != nil { - t.Error(err) - continue - } - if !reflect.DeepEqual(f.FileHeader, tt.hdr) { - t.Errorf("open %s:\n\thave %#v\n\twant %#v\n", tt.file, f.FileHeader, tt.hdr) - continue - } - - for i, sh := range f.Sections { - if i >= len(tt.sections) { - break - } - have := &sh.SectionHeader - want := tt.sections[i] - if !reflect.DeepEqual(have, want) { - t.Errorf("open %s, section %d:\n\thave %#v\n\twant %#v\n", tt.file, i, have, want) - } - } - tn := len(tt.sections) - fn := len(f.Sections) - if tn != fn { - t.Errorf("open %s: len(Sections) = %d, want %d", tt.file, fn, tn) - } - } -} - -func TestOpenFailure(t *testing.T) { - filename := "file.go" // not a Plan 9 a.out file - _, err := Open(filename) // don't crash - if err == nil { - t.Errorf("open %s: succeeded unexpectedly", filename) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/plan9obj.go b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/plan9obj.go deleted file mode 100644 index af9858562f9e2b6d4ad51e9f3e0497bea2ff5aa7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/plan9obj.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* - * Plan 9 a.out constants and data structures - */ - -package plan9obj - -// Plan 9 Program header. -type prog struct { - Magic uint32 /* magic number */ - Text uint32 /* size of text segment */ - Data uint32 /* size of initialized data */ - Bss uint32 /* size of uninitialized data */ - Syms uint32 /* size of symbol table */ - Entry uint32 /* entry point */ - Spsz uint32 /* size of pc/sp offset table */ - Pcsz uint32 /* size of pc/line number table */ -} - -// Plan 9 symbol table entries. -type sym struct { - value uint64 - typ byte - name []byte -} - -const ( - Magic64 = 0x8000 // 64-bit expanded header - - Magic386 = (4*11+0)*11 + 7 - MagicAMD64 = (4*26+0)*26 + 7 + Magic64 - MagicARM = (4*20+0)*20 + 7 -) diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/386-plan9-exec b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/386-plan9-exec deleted file mode 100644 index 748e83f8e6acc310edc5081a27d989c63f0eb2de..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/386-plan9-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/amd64-plan9-exec b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/amd64-plan9-exec deleted file mode 100644 index 3e257dd8ffc00ca4a19d9552a10d782134387e8b..0000000000000000000000000000000000000000 Binary files a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/amd64-plan9-exec and /dev/null differ diff --git a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/hello.c b/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/hello.c deleted file mode 100644 index c0d633e29f0b18b13d966f28fd9ed37718a2148f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/debug/plan9obj/testdata/hello.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -void -main(void) -{ - print("hello, world\n"); -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85.go b/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85.go deleted file mode 100644 index 4d7193873a2410fc67f9163ed6ea5e9e3e39f7b2..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85.go +++ /dev/null @@ -1,310 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ascii85 implements the ascii85 data encoding -// as used in the btoa tool and Adobe's PostScript and PDF document formats. -package ascii85 - -import ( - "io" - "strconv" -) - -/* - * Encoder - */ - -// Encode encodes src into at most MaxEncodedLen(len(src)) -// bytes of dst, returning the actual number of bytes written. -// -// The encoding handles 4-byte chunks, using a special encoding -// for the last fragment, so Encode is not appropriate for use on -// individual blocks of a large data stream. Use NewEncoder() instead. -// -// Often, ascii85-encoded data is wrapped in <~ and ~> symbols. -// Encode does not add these. -func Encode(dst, src []byte) int { - if len(src) == 0 { - return 0 - } - - n := 0 - for len(src) > 0 { - dst[0] = 0 - dst[1] = 0 - dst[2] = 0 - dst[3] = 0 - dst[4] = 0 - - // Unpack 4 bytes into uint32 to repack into base 85 5-byte. - var v uint32 - switch len(src) { - default: - v |= uint32(src[3]) - fallthrough - case 3: - v |= uint32(src[2]) << 8 - fallthrough - case 2: - v |= uint32(src[1]) << 16 - fallthrough - case 1: - v |= uint32(src[0]) << 24 - } - - // Special case: zero (!!!!!) shortens to z. - if v == 0 && len(src) >= 4 { - dst[0] = 'z' - dst = dst[1:] - src = src[4:] - n++ - continue - } - - // Otherwise, 5 base 85 digits starting at !. - for i := 4; i >= 0; i-- { - dst[i] = '!' + byte(v%85) - v /= 85 - } - - // If src was short, discard the low destination bytes. - m := 5 - if len(src) < 4 { - m -= 4 - len(src) - src = nil - } else { - src = src[4:] - } - dst = dst[m:] - n += m - } - return n -} - -// MaxEncodedLen returns the maximum length of an encoding of n source bytes. -func MaxEncodedLen(n int) int { return (n + 3) / 4 * 5 } - -// NewEncoder returns a new ascii85 stream encoder. Data written to -// the returned writer will be encoded and then written to w. -// Ascii85 encodings operate in 32-bit blocks; when finished -// writing, the caller must Close the returned encoder to flush any -// trailing partial block. -func NewEncoder(w io.Writer) io.WriteCloser { return &encoder{w: w} } - -type encoder struct { - err error - w io.Writer - buf [4]byte // buffered data waiting to be encoded - nbuf int // number of bytes in buf - out [1024]byte // output buffer -} - -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - - // Leading fringe. - if e.nbuf > 0 { - var i int - for i = 0; i < len(p) && e.nbuf < 4; i++ { - e.buf[e.nbuf] = p[i] - e.nbuf++ - } - n += i - p = p[i:] - if e.nbuf < 4 { - return - } - nout := Encode(e.out[0:], e.buf[0:]) - if _, e.err = e.w.Write(e.out[0:nout]); e.err != nil { - return n, e.err - } - e.nbuf = 0 - } - - // Large interior chunks. - for len(p) >= 4 { - nn := len(e.out) / 5 * 4 - if nn > len(p) { - nn = len(p) - } - nn -= nn % 4 - if nn > 0 { - nout := Encode(e.out[0:], p[0:nn]) - if _, e.err = e.w.Write(e.out[0:nout]); e.err != nil { - return n, e.err - } - } - n += nn - p = p[nn:] - } - - // Trailing fringe. - for i := 0; i < len(p); i++ { - e.buf[i] = p[i] - } - e.nbuf = len(p) - n += len(p) - return -} - -// Close flushes any pending output from the encoder. -// It is an error to call Write after calling Close. -func (e *encoder) Close() error { - // If there's anything left in the buffer, flush it out - if e.err == nil && e.nbuf > 0 { - nout := Encode(e.out[0:], e.buf[0:e.nbuf]) - e.nbuf = 0 - _, e.err = e.w.Write(e.out[0:nout]) - } - return e.err -} - -/* - * Decoder - */ - -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "illegal ascii85 data at input byte " + strconv.FormatInt(int64(e), 10) -} - -// Decode decodes src into dst, returning both the number -// of bytes written to dst and the number consumed from src. -// If src contains invalid ascii85 data, Decode will return the -// number of bytes successfully written and a CorruptInputError. -// Decode ignores space and control characters in src. -// Often, ascii85-encoded data is wrapped in <~ and ~> symbols. -// Decode expects these to have been stripped by the caller. -// -// If flush is true, Decode assumes that src represents the -// end of the input stream and processes it completely rather -// than wait for the completion of another 32-bit block. -// -// NewDecoder wraps an io.Reader interface around Decode. -// -func Decode(dst, src []byte, flush bool) (ndst, nsrc int, err error) { - var v uint32 - var nb int - for i, b := range src { - if len(dst)-ndst < 4 { - return - } - switch { - case b <= ' ': - continue - case b == 'z' && nb == 0: - nb = 5 - v = 0 - case '!' <= b && b <= 'u': - v = v*85 + uint32(b-'!') - nb++ - default: - return 0, 0, CorruptInputError(i) - } - if nb == 5 { - nsrc = i + 1 - dst[ndst] = byte(v >> 24) - dst[ndst+1] = byte(v >> 16) - dst[ndst+2] = byte(v >> 8) - dst[ndst+3] = byte(v) - ndst += 4 - nb = 0 - v = 0 - } - } - if flush { - nsrc = len(src) - if nb > 0 { - // The number of output bytes in the last fragment - // is the number of leftover input bytes - 1: - // the extra byte provides enough bits to cover - // the inefficiency of the encoding for the block. - if nb == 1 { - return 0, 0, CorruptInputError(len(src)) - } - for i := nb; i < 5; i++ { - // The short encoding truncated the output value. - // We have to assume the worst case values (digit 84) - // in order to ensure that the top bits are correct. - v = v*85 + 84 - } - for i := 0; i < nb-1; i++ { - dst[ndst] = byte(v >> 24) - v <<= 8 - ndst++ - } - } - } - return -} - -// NewDecoder constructs a new ascii85 stream decoder. -func NewDecoder(r io.Reader) io.Reader { return &decoder{r: r} } - -type decoder struct { - err error - readErr error - r io.Reader - buf [1024]byte // leftover input - nbuf int - out []byte // leftover decoded output - outbuf [1024]byte -} - -func (d *decoder) Read(p []byte) (n int, err error) { - if len(p) == 0 { - return 0, nil - } - if d.err != nil { - return 0, d.err - } - - for { - // Copy leftover output from last decode. - if len(d.out) > 0 { - n = copy(p, d.out) - d.out = d.out[n:] - return - } - - // Decode leftover input from last read. - var nn, nsrc, ndst int - if d.nbuf > 0 { - ndst, nsrc, d.err = Decode(d.outbuf[0:], d.buf[0:d.nbuf], d.readErr != nil) - if ndst > 0 { - d.out = d.outbuf[0:ndst] - d.nbuf = copy(d.buf[0:], d.buf[nsrc:d.nbuf]) - continue // copy out and return - } - if ndst == 0 && d.err == nil { - // Special case: input buffer is mostly filled with non-data bytes. - // Filter out such bytes to make room for more input. - off := 0 - for i := 0; i < d.nbuf; i++ { - if d.buf[i] > ' ' { - d.buf[off] = d.buf[i] - off++ - } - } - d.nbuf = off - } - } - - // Out of input, out of decoded output. Check errors. - if d.err != nil { - return 0, d.err - } - if d.readErr != nil { - d.err = d.readErr - return 0, d.err - } - - // Read more data. - nn, d.readErr = d.r.Read(d.buf[d.nbuf:]) - d.nbuf += nn - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85_test.go deleted file mode 100644 index aad199b4fad56be2fe05d8f089a5e0dfb002ac54..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/ascii85/ascii85_test.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ascii85 - -import ( - "bytes" - "io" - "io/ioutil" - "strings" - "testing" -) - -type testpair struct { - decoded, encoded string -} - -var pairs = []testpair{ - // Encode returns 0 when len(src) is 0 - { - "", - "", - }, - // Wikipedia example - { - "Man is distinguished, not only by his reason, but by this singular passion from " + - "other animals, which is a lust of the mind, that by a perseverance of delight in " + - "the continued and indefatigable generation of knowledge, exceeds the short " + - "vehemence of any carnal pleasure.", - "9jqo^BlbD-BleB1DJ+*+F(f,q/0JhKFCj@.4Gp$d7F!,L7@<6@)/0JDEF@3BB/F*&OCAfu2/AKY\n" + - "i(DIb:@FD,*)+C]U=@3BN#EcYf8ATD3s@q?d$AftVqCh[NqF-FD5W8ARlolDIa\n" + - "l(DIduD.RTpAKYo'+CT/5+Cei#DII?(E,9)oF*2M7/c\n", - }, - // Special case when shortening !!!!! to z. - { - "\000\000\000\000", - "z", - }, -} - -var bigtest = pairs[len(pairs)-1] - -func testEqual(t *testing.T, msg string, args ...interface{}) bool { - if args[len(args)-2] != args[len(args)-1] { - t.Errorf(msg, args...) - return false - } - return true -} - -func strip85(s string) string { - t := make([]byte, len(s)) - w := 0 - for r := 0; r < len(s); r++ { - c := s[r] - if c > ' ' { - t[w] = c - w++ - } - } - return string(t[0:w]) -} - -func TestEncode(t *testing.T) { - for _, p := range pairs { - buf := make([]byte, MaxEncodedLen(len(p.decoded))) - n := Encode(buf, []byte(p.decoded)) - buf = buf[0:n] - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, strip85(string(buf)), strip85(p.encoded)) - } -} - -func TestEncoder(t *testing.T) { - for _, p := range pairs { - bb := &bytes.Buffer{} - encoder := NewEncoder(bb) - encoder.Write([]byte(p.decoded)) - encoder.Close() - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, strip85(bb.String()), strip85(p.encoded)) - } -} - -func TestEncoderBuffering(t *testing.T) { - input := []byte(bigtest.decoded) - for bs := 1; bs <= 12; bs++ { - bb := &bytes.Buffer{} - encoder := NewEncoder(bb) - for pos := 0; pos < len(input); pos += bs { - end := pos + bs - if end > len(input) { - end = len(input) - } - n, err := encoder.Write(input[pos:end]) - testEqual(t, "Write(%q) gave error %v, want %v", input[pos:end], err, error(nil)) - testEqual(t, "Write(%q) gave length %v, want %v", input[pos:end], n, end-pos) - } - err := encoder.Close() - testEqual(t, "Close gave error %v, want %v", err, error(nil)) - testEqual(t, "Encoding/%d of %q = %q, want %q", bs, bigtest.decoded, strip85(bb.String()), strip85(bigtest.encoded)) - } -} - -func TestDecode(t *testing.T) { - for _, p := range pairs { - dbuf := make([]byte, 4*len(p.encoded)) - ndst, nsrc, err := Decode(dbuf, []byte(p.encoded), true) - testEqual(t, "Decode(%q) = error %v, want %v", p.encoded, err, error(nil)) - testEqual(t, "Decode(%q) = nsrc %v, want %v", p.encoded, nsrc, len(p.encoded)) - testEqual(t, "Decode(%q) = ndst %v, want %v", p.encoded, ndst, len(p.decoded)) - testEqual(t, "Decode(%q) = %q, want %q", p.encoded, string(dbuf[0:ndst]), p.decoded) - } -} - -func TestDecoder(t *testing.T) { - for _, p := range pairs { - decoder := NewDecoder(strings.NewReader(p.encoded)) - dbuf, err := ioutil.ReadAll(decoder) - if err != nil { - t.Fatal("Read failed", err) - } - testEqual(t, "Read from %q = length %v, want %v", p.encoded, len(dbuf), len(p.decoded)) - testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf), p.decoded) - if err != nil { - testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF) - } - } -} - -func TestDecoderBuffering(t *testing.T) { - for bs := 1; bs <= 12; bs++ { - decoder := NewDecoder(strings.NewReader(bigtest.encoded)) - buf := make([]byte, len(bigtest.decoded)+12) - var total int - for total = 0; total < len(bigtest.decoded); { - n, err := decoder.Read(buf[total : total+bs]) - testEqual(t, "Read from %q at pos %d = %d, %v, want _, %v", bigtest.encoded, total, n, err, error(nil)) - total += n - } - testEqual(t, "Decoding/%d of %q = %q, want %q", bs, bigtest.encoded, string(buf[0:total]), bigtest.decoded) - } -} - -func TestDecodeCorrupt(t *testing.T) { - type corrupt struct { - e string - p int - } - examples := []corrupt{ - {"v", 0}, - {"!z!!!!!!!!!", 1}, - } - - for _, e := range examples { - dbuf := make([]byte, 4*len(e.e)) - _, _, err := Decode(dbuf, []byte(e.e), true) - switch err := err.(type) { - case CorruptInputError: - testEqual(t, "Corruption in %q at offset %v, want %v", e.e, int(err), e.p) - default: - t.Error("Decoder failed to detect corruption in", e) - } - } -} - -func TestBig(t *testing.T) { - n := 3*1000 + 1 - raw := make([]byte, n) - const alpha = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - for i := 0; i < n; i++ { - raw[i] = alpha[i%len(alpha)] - } - encoded := new(bytes.Buffer) - w := NewEncoder(encoded) - nn, err := w.Write(raw) - if nn != n || err != nil { - t.Fatalf("Encoder.Write(raw) = %d, %v want %d, nil", nn, err, n) - } - err = w.Close() - if err != nil { - t.Fatalf("Encoder.Close() = %v want nil", err) - } - decoded, err := ioutil.ReadAll(NewDecoder(encoded)) - if err != nil { - t.Fatalf("io.ReadAll(NewDecoder(...)): %v", err) - } - - if !bytes.Equal(raw, decoded) { - var i int - for i = 0; i < len(decoded) && i < len(raw); i++ { - if decoded[i] != raw[i] { - break - } - } - t.Errorf("Decode(Encode(%d-byte string)) failed at offset %d", n, i) - } -} - -func TestDecoderInternalWhitespace(t *testing.T) { - s := strings.Repeat(" ", 2048) + "z" - decoded, err := ioutil.ReadAll(NewDecoder(strings.NewReader(s))) - if err != nil { - t.Errorf("Decode gave error %v", err) - } - if want := []byte("\000\000\000\000"); !bytes.Equal(want, decoded) { - t.Errorf("Decode failed: got %v, want %v", decoded, want) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1.go b/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1.go deleted file mode 100644 index 2ac411af8820b7c2c8f22f5f442307a3810ec27d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1.go +++ /dev/null @@ -1,962 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package asn1 implements parsing of DER-encoded ASN.1 data structures, -// as defined in ITU-T Rec X.690. -// -// See also ``A Layman's Guide to a Subset of ASN.1, BER, and DER,'' -// http://luca.ntop.org/Teaching/Appunti/asn1.html. -package asn1 - -// ASN.1 is a syntax for specifying abstract objects and BER, DER, PER, XER etc -// are different encoding formats for those objects. Here, we'll be dealing -// with DER, the Distinguished Encoding Rules. DER is used in X.509 because -// it's fast to parse and, unlike BER, has a unique encoding for every object. -// When calculating hashes over objects, it's important that the resulting -// bytes be the same at both ends and DER removes this margin of error. -// -// ASN.1 is very complex and this package doesn't attempt to implement -// everything by any means. - -import ( - "errors" - "fmt" - "math/big" - "reflect" - "strconv" - "time" - "unicode/utf8" -) - -// A StructuralError suggests that the ASN.1 data is valid, but the Go type -// which is receiving it doesn't match. -type StructuralError struct { - Msg string -} - -func (e StructuralError) Error() string { return "asn1: structure error: " + e.Msg } - -// A SyntaxError suggests that the ASN.1 data is invalid. -type SyntaxError struct { - Msg string -} - -func (e SyntaxError) Error() string { return "asn1: syntax error: " + e.Msg } - -// We start by dealing with each of the primitive types in turn. - -// BOOLEAN - -func parseBool(bytes []byte) (ret bool, err error) { - if len(bytes) != 1 { - err = SyntaxError{"invalid boolean"} - return - } - - // DER demands that "If the encoding represents the boolean value TRUE, - // its single contents octet shall have all eight bits set to one." - // Thus only 0 and 255 are valid encoded values. - switch bytes[0] { - case 0: - ret = false - case 0xff: - ret = true - default: - err = SyntaxError{"invalid boolean"} - } - - return -} - -// INTEGER - -// parseInt64 treats the given bytes as a big-endian, signed integer and -// returns the result. -func parseInt64(bytes []byte) (ret int64, err error) { - if len(bytes) > 8 { - // We'll overflow an int64 in this case. - err = StructuralError{"integer too large"} - return - } - for bytesRead := 0; bytesRead < len(bytes); bytesRead++ { - ret <<= 8 - ret |= int64(bytes[bytesRead]) - } - - // Shift up and down in order to sign extend the result. - ret <<= 64 - uint8(len(bytes))*8 - ret >>= 64 - uint8(len(bytes))*8 - return -} - -// parseInt treats the given bytes as a big-endian, signed integer and returns -// the result. -func parseInt32(bytes []byte) (int32, error) { - ret64, err := parseInt64(bytes) - if err != nil { - return 0, err - } - if ret64 != int64(int32(ret64)) { - return 0, StructuralError{"integer too large"} - } - return int32(ret64), nil -} - -var bigOne = big.NewInt(1) - -// parseBigInt treats the given bytes as a big-endian, signed integer and returns -// the result. -func parseBigInt(bytes []byte) *big.Int { - ret := new(big.Int) - if len(bytes) > 0 && bytes[0]&0x80 == 0x80 { - // This is a negative number. - notBytes := make([]byte, len(bytes)) - for i := range notBytes { - notBytes[i] = ^bytes[i] - } - ret.SetBytes(notBytes) - ret.Add(ret, bigOne) - ret.Neg(ret) - return ret - } - ret.SetBytes(bytes) - return ret -} - -// BIT STRING - -// BitString is the structure to use when you want an ASN.1 BIT STRING type. A -// bit string is padded up to the nearest byte in memory and the number of -// valid bits is recorded. Padding bits will be zero. -type BitString struct { - Bytes []byte // bits packed into bytes. - BitLength int // length in bits. -} - -// At returns the bit at the given index. If the index is out of range it -// returns false. -func (b BitString) At(i int) int { - if i < 0 || i >= b.BitLength { - return 0 - } - x := i / 8 - y := 7 - uint(i%8) - return int(b.Bytes[x]>>y) & 1 -} - -// RightAlign returns a slice where the padding bits are at the beginning. The -// slice may share memory with the BitString. -func (b BitString) RightAlign() []byte { - shift := uint(8 - (b.BitLength % 8)) - if shift == 8 || len(b.Bytes) == 0 { - return b.Bytes - } - - a := make([]byte, len(b.Bytes)) - a[0] = b.Bytes[0] >> shift - for i := 1; i < len(b.Bytes); i++ { - a[i] = b.Bytes[i-1] << (8 - shift) - a[i] |= b.Bytes[i] >> shift - } - - return a -} - -// parseBitString parses an ASN.1 bit string from the given byte slice and returns it. -func parseBitString(bytes []byte) (ret BitString, err error) { - if len(bytes) == 0 { - err = SyntaxError{"zero length BIT STRING"} - return - } - paddingBits := int(bytes[0]) - if paddingBits > 7 || - len(bytes) == 1 && paddingBits > 0 || - bytes[len(bytes)-1]&((1< 0 { - s += "." - } - s += strconv.Itoa(v) - } - - return s -} - -// parseObjectIdentifier parses an OBJECT IDENTIFIER from the given bytes and -// returns it. An object identifier is a sequence of variable length integers -// that are assigned in a hierarchy. -func parseObjectIdentifier(bytes []byte) (s []int, err error) { - if len(bytes) == 0 { - err = SyntaxError{"zero length OBJECT IDENTIFIER"} - return - } - - // In the worst case, we get two elements from the first byte (which is - // encoded differently) and then every varint is a single byte long. - s = make([]int, len(bytes)+1) - - // The first varint is 40*value1 + value2: - // According to this packing, value1 can take the values 0, 1 and 2 only. - // When value1 = 0 or value1 = 1, then value2 is <= 39. When value1 = 2, - // then there are no restrictions on value2. - v, offset, err := parseBase128Int(bytes, 0) - if err != nil { - return - } - if v < 80 { - s[0] = v / 40 - s[1] = v % 40 - } else { - s[0] = 2 - s[1] = v - 80 - } - - i := 2 - for ; offset < len(bytes); i++ { - v, offset, err = parseBase128Int(bytes, offset) - if err != nil { - return - } - s[i] = v - } - s = s[0:i] - return -} - -// ENUMERATED - -// An Enumerated is represented as a plain int. -type Enumerated int - -// FLAG - -// A Flag accepts any data and is set to true if present. -type Flag bool - -// parseBase128Int parses a base-128 encoded int from the given offset in the -// given byte slice. It returns the value and the new offset. -func parseBase128Int(bytes []byte, initOffset int) (ret, offset int, err error) { - offset = initOffset - for shifted := 0; offset < len(bytes); shifted++ { - if shifted > 4 { - err = StructuralError{"base 128 integer too large"} - return - } - ret <<= 7 - b := bytes[offset] - ret |= int(b & 0x7f) - offset++ - if b&0x80 == 0 { - return - } - } - err = SyntaxError{"truncated base 128 integer"} - return -} - -// UTCTime - -func parseUTCTime(bytes []byte) (ret time.Time, err error) { - s := string(bytes) - - formatStr := "0601021504Z0700" - ret, err = time.Parse(formatStr, s) - if err != nil { - formatStr = "060102150405Z0700" - ret, err = time.Parse(formatStr, s) - } - if err != nil { - return - } - - if serialized := ret.Format(formatStr); serialized != s { - err = fmt.Errorf("asn1: time did not serialize back to the original value and may be invalid: given %q, but serialized as %q", s, serialized) - return - } - - if ret.Year() >= 2050 { - // UTCTime only encodes times prior to 2050. See https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 - ret = ret.AddDate(-100, 0, 0) - } - - return -} - -// parseGeneralizedTime parses the GeneralizedTime from the given byte slice -// and returns the resulting time. -func parseGeneralizedTime(bytes []byte) (ret time.Time, err error) { - const formatStr = "20060102150405Z0700" - s := string(bytes) - - if ret, err = time.Parse(formatStr, s); err != nil { - return - } - - if serialized := ret.Format(formatStr); serialized != s { - err = fmt.Errorf("asn1: time did not serialize back to the original value and may be invalid: given %q, but serialized as %q", s, serialized) - } - - return -} - -// PrintableString - -// parsePrintableString parses a ASN.1 PrintableString from the given byte -// array and returns it. -func parsePrintableString(bytes []byte) (ret string, err error) { - for _, b := range bytes { - if !isPrintable(b) { - err = SyntaxError{"PrintableString contains invalid character"} - return - } - } - ret = string(bytes) - return -} - -// isPrintable reports whether the given b is in the ASN.1 PrintableString set. -func isPrintable(b byte) bool { - return 'a' <= b && b <= 'z' || - 'A' <= b && b <= 'Z' || - '0' <= b && b <= '9' || - '\'' <= b && b <= ')' || - '+' <= b && b <= '/' || - b == ' ' || - b == ':' || - b == '=' || - b == '?' || - // This is technically not allowed in a PrintableString. - // However, x509 certificates with wildcard strings don't - // always use the correct string type so we permit it. - b == '*' -} - -// IA5String - -// parseIA5String parses a ASN.1 IA5String (ASCII string) from the given -// byte slice and returns it. -func parseIA5String(bytes []byte) (ret string, err error) { - for _, b := range bytes { - if b >= 0x80 { - err = SyntaxError{"IA5String contains invalid character"} - return - } - } - ret = string(bytes) - return -} - -// T61String - -// parseT61String parses a ASN.1 T61String (8-bit clean string) from the given -// byte slice and returns it. -func parseT61String(bytes []byte) (ret string, err error) { - return string(bytes), nil -} - -// UTF8String - -// parseUTF8String parses a ASN.1 UTF8String (raw UTF-8) from the given byte -// array and returns it. -func parseUTF8String(bytes []byte) (ret string, err error) { - if !utf8.Valid(bytes) { - return "", errors.New("asn1: invalid UTF-8 string") - } - return string(bytes), nil -} - -// A RawValue represents an undecoded ASN.1 object. -type RawValue struct { - Class, Tag int - IsCompound bool - Bytes []byte - FullBytes []byte // includes the tag and length -} - -// RawContent is used to signal that the undecoded, DER data needs to be -// preserved for a struct. To use it, the first field of the struct must have -// this type. It's an error for any of the other fields to have this type. -type RawContent []byte - -// Tagging - -// parseTagAndLength parses an ASN.1 tag and length pair from the given offset -// into a byte slice. It returns the parsed data and the new offset. SET and -// SET OF (tag 17) are mapped to SEQUENCE and SEQUENCE OF (tag 16) since we -// don't distinguish between ordered and unordered objects in this code. -func parseTagAndLength(bytes []byte, initOffset int) (ret tagAndLength, offset int, err error) { - offset = initOffset - // parseTagAndLength should not be called without at least a single - // byte to read. Thus this check is for robustness: - if offset >= len(bytes) { - err = errors.New("asn1: internal error in parseTagAndLength") - return - } - b := bytes[offset] - offset++ - ret.class = int(b >> 6) - ret.isCompound = b&0x20 == 0x20 - ret.tag = int(b & 0x1f) - - // If the bottom five bits are set, then the tag number is actually base 128 - // encoded afterwards - if ret.tag == 0x1f { - ret.tag, offset, err = parseBase128Int(bytes, offset) - if err != nil { - return - } - } - if offset >= len(bytes) { - err = SyntaxError{"truncated tag or length"} - return - } - b = bytes[offset] - offset++ - if b&0x80 == 0 { - // The length is encoded in the bottom 7 bits. - ret.length = int(b & 0x7f) - } else { - // Bottom 7 bits give the number of length bytes to follow. - numBytes := int(b & 0x7f) - if numBytes == 0 { - err = SyntaxError{"indefinite length found (not DER)"} - return - } - ret.length = 0 - for i := 0; i < numBytes; i++ { - if offset >= len(bytes) { - err = SyntaxError{"truncated tag or length"} - return - } - b = bytes[offset] - offset++ - if ret.length >= 1<<23 { - // We can't shift ret.length up without - // overflowing. - err = StructuralError{"length too large"} - return - } - ret.length <<= 8 - ret.length |= int(b) - if ret.length == 0 { - // DER requires that lengths be minimal. - err = StructuralError{"superfluous leading zeros in length"} - return - } - } - } - - return -} - -// parseSequenceOf is used for SEQUENCE OF and SET OF values. It tries to parse -// a number of ASN.1 values from the given byte slice and returns them as a -// slice of Go values of the given type. -func parseSequenceOf(bytes []byte, sliceType reflect.Type, elemType reflect.Type) (ret reflect.Value, err error) { - expectedTag, compoundType, ok := getUniversalType(elemType) - if !ok { - err = StructuralError{"unknown Go type for slice"} - return - } - - // First we iterate over the input and count the number of elements, - // checking that the types are correct in each case. - numElements := 0 - for offset := 0; offset < len(bytes); { - var t tagAndLength - t, offset, err = parseTagAndLength(bytes, offset) - if err != nil { - return - } - switch t.tag { - case tagIA5String, tagGeneralString, tagT61String, tagUTF8String: - // We pretend that various other string types are - // PRINTABLE STRINGs so that a sequence of them can be - // parsed into a []string. - t.tag = tagPrintableString - case tagGeneralizedTime, tagUTCTime: - // Likewise, both time types are treated the same. - t.tag = tagUTCTime - } - - if t.class != classUniversal || t.isCompound != compoundType || t.tag != expectedTag { - err = StructuralError{"sequence tag mismatch"} - return - } - if invalidLength(offset, t.length, len(bytes)) { - err = SyntaxError{"truncated sequence"} - return - } - offset += t.length - numElements++ - } - ret = reflect.MakeSlice(sliceType, numElements, numElements) - params := fieldParameters{} - offset := 0 - for i := 0; i < numElements; i++ { - offset, err = parseField(ret.Index(i), bytes, offset, params) - if err != nil { - return - } - } - return -} - -var ( - bitStringType = reflect.TypeOf(BitString{}) - objectIdentifierType = reflect.TypeOf(ObjectIdentifier{}) - enumeratedType = reflect.TypeOf(Enumerated(0)) - flagType = reflect.TypeOf(Flag(false)) - timeType = reflect.TypeOf(time.Time{}) - rawValueType = reflect.TypeOf(RawValue{}) - rawContentsType = reflect.TypeOf(RawContent(nil)) - bigIntType = reflect.TypeOf(new(big.Int)) -) - -// invalidLength returns true iff offset + length > sliceLength, or if the -// addition would overflow. -func invalidLength(offset, length, sliceLength int) bool { - return offset+length < offset || offset+length > sliceLength -} - -// parseField is the main parsing function. Given a byte slice and an offset -// into the array, it will try to parse a suitable ASN.1 value out and store it -// in the given Value. -func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParameters) (offset int, err error) { - offset = initOffset - fieldType := v.Type() - - // If we have run out of data, it may be that there are optional elements at the end. - if offset == len(bytes) { - if !setDefaultValue(v, params) { - err = SyntaxError{"sequence truncated"} - } - return - } - - // Deal with raw values. - if fieldType == rawValueType { - var t tagAndLength - t, offset, err = parseTagAndLength(bytes, offset) - if err != nil { - return - } - if invalidLength(offset, t.length, len(bytes)) { - err = SyntaxError{"data truncated"} - return - } - result := RawValue{t.class, t.tag, t.isCompound, bytes[offset : offset+t.length], bytes[initOffset : offset+t.length]} - offset += t.length - v.Set(reflect.ValueOf(result)) - return - } - - // Deal with the ANY type. - if ifaceType := fieldType; ifaceType.Kind() == reflect.Interface && ifaceType.NumMethod() == 0 { - var t tagAndLength - t, offset, err = parseTagAndLength(bytes, offset) - if err != nil { - return - } - if invalidLength(offset, t.length, len(bytes)) { - err = SyntaxError{"data truncated"} - return - } - var result interface{} - if !t.isCompound && t.class == classUniversal { - innerBytes := bytes[offset : offset+t.length] - switch t.tag { - case tagPrintableString: - result, err = parsePrintableString(innerBytes) - case tagIA5String: - result, err = parseIA5String(innerBytes) - case tagT61String: - result, err = parseT61String(innerBytes) - case tagUTF8String: - result, err = parseUTF8String(innerBytes) - case tagInteger: - result, err = parseInt64(innerBytes) - case tagBitString: - result, err = parseBitString(innerBytes) - case tagOID: - result, err = parseObjectIdentifier(innerBytes) - case tagUTCTime: - result, err = parseUTCTime(innerBytes) - case tagGeneralizedTime: - result, err = parseGeneralizedTime(innerBytes) - case tagOctetString: - result = innerBytes - default: - // If we don't know how to handle the type, we just leave Value as nil. - } - } - offset += t.length - if err != nil { - return - } - if result != nil { - v.Set(reflect.ValueOf(result)) - } - return - } - universalTag, compoundType, ok1 := getUniversalType(fieldType) - if !ok1 { - err = StructuralError{fmt.Sprintf("unknown Go type: %v", fieldType)} - return - } - - t, offset, err := parseTagAndLength(bytes, offset) - if err != nil { - return - } - if params.explicit { - expectedClass := classContextSpecific - if params.application { - expectedClass = classApplication - } - if offset == len(bytes) { - err = StructuralError{"explicit tag has no child"} - return - } - if t.class == expectedClass && t.tag == *params.tag && (t.length == 0 || t.isCompound) { - if t.length > 0 { - t, offset, err = parseTagAndLength(bytes, offset) - if err != nil { - return - } - } else { - if fieldType != flagType { - err = StructuralError{"zero length explicit tag was not an asn1.Flag"} - return - } - v.SetBool(true) - return - } - } else { - // The tags didn't match, it might be an optional element. - ok := setDefaultValue(v, params) - if ok { - offset = initOffset - } else { - err = StructuralError{"explicitly tagged member didn't match"} - } - return - } - } - - // Special case for strings: all the ASN.1 string types map to the Go - // type string. getUniversalType returns the tag for PrintableString - // when it sees a string, so if we see a different string type on the - // wire, we change the universal type to match. - if universalTag == tagPrintableString { - if t.class == classUniversal { - switch t.tag { - case tagIA5String, tagGeneralString, tagT61String, tagUTF8String: - universalTag = t.tag - } - } else if params.stringType != 0 { - universalTag = params.stringType - } - } - - // Special case for time: UTCTime and GeneralizedTime both map to the - // Go type time.Time. - if universalTag == tagUTCTime && t.tag == tagGeneralizedTime && t.class == classUniversal { - universalTag = tagGeneralizedTime - } - - if params.set { - universalTag = tagSet - } - - expectedClass := classUniversal - expectedTag := universalTag - - if !params.explicit && params.tag != nil { - expectedClass = classContextSpecific - expectedTag = *params.tag - } - - if !params.explicit && params.application && params.tag != nil { - expectedClass = classApplication - expectedTag = *params.tag - } - - // We have unwrapped any explicit tagging at this point. - if t.class != expectedClass || t.tag != expectedTag || t.isCompound != compoundType { - // Tags don't match. Again, it could be an optional element. - ok := setDefaultValue(v, params) - if ok { - offset = initOffset - } else { - err = StructuralError{fmt.Sprintf("tags don't match (%d vs %+v) %+v %s @%d", expectedTag, t, params, fieldType.Name(), offset)} - } - return - } - if invalidLength(offset, t.length, len(bytes)) { - err = SyntaxError{"data truncated"} - return - } - innerBytes := bytes[offset : offset+t.length] - offset += t.length - - // We deal with the structures defined in this package first. - switch fieldType { - case objectIdentifierType: - newSlice, err1 := parseObjectIdentifier(innerBytes) - v.Set(reflect.MakeSlice(v.Type(), len(newSlice), len(newSlice))) - if err1 == nil { - reflect.Copy(v, reflect.ValueOf(newSlice)) - } - err = err1 - return - case bitStringType: - bs, err1 := parseBitString(innerBytes) - if err1 == nil { - v.Set(reflect.ValueOf(bs)) - } - err = err1 - return - case timeType: - var time time.Time - var err1 error - if universalTag == tagUTCTime { - time, err1 = parseUTCTime(innerBytes) - } else { - time, err1 = parseGeneralizedTime(innerBytes) - } - if err1 == nil { - v.Set(reflect.ValueOf(time)) - } - err = err1 - return - case enumeratedType: - parsedInt, err1 := parseInt32(innerBytes) - if err1 == nil { - v.SetInt(int64(parsedInt)) - } - err = err1 - return - case flagType: - v.SetBool(true) - return - case bigIntType: - parsedInt := parseBigInt(innerBytes) - v.Set(reflect.ValueOf(parsedInt)) - return - } - switch val := v; val.Kind() { - case reflect.Bool: - parsedBool, err1 := parseBool(innerBytes) - if err1 == nil { - val.SetBool(parsedBool) - } - err = err1 - return - case reflect.Int, reflect.Int32, reflect.Int64: - if val.Type().Size() == 4 { - parsedInt, err1 := parseInt32(innerBytes) - if err1 == nil { - val.SetInt(int64(parsedInt)) - } - err = err1 - } else { - parsedInt, err1 := parseInt64(innerBytes) - if err1 == nil { - val.SetInt(parsedInt) - } - err = err1 - } - return - // TODO(dfc) Add support for the remaining integer types - case reflect.Struct: - structType := fieldType - - if structType.NumField() > 0 && - structType.Field(0).Type == rawContentsType { - bytes := bytes[initOffset:offset] - val.Field(0).Set(reflect.ValueOf(RawContent(bytes))) - } - - innerOffset := 0 - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - if i == 0 && field.Type == rawContentsType { - continue - } - innerOffset, err = parseField(val.Field(i), innerBytes, innerOffset, parseFieldParameters(field.Tag.Get("asn1"))) - if err != nil { - return - } - } - // We allow extra bytes at the end of the SEQUENCE because - // adding elements to the end has been used in X.509 as the - // version numbers have increased. - return - case reflect.Slice: - sliceType := fieldType - if sliceType.Elem().Kind() == reflect.Uint8 { - val.Set(reflect.MakeSlice(sliceType, len(innerBytes), len(innerBytes))) - reflect.Copy(val, reflect.ValueOf(innerBytes)) - return - } - newSlice, err1 := parseSequenceOf(innerBytes, sliceType, sliceType.Elem()) - if err1 == nil { - val.Set(newSlice) - } - err = err1 - return - case reflect.String: - var v string - switch universalTag { - case tagPrintableString: - v, err = parsePrintableString(innerBytes) - case tagIA5String: - v, err = parseIA5String(innerBytes) - case tagT61String: - v, err = parseT61String(innerBytes) - case tagUTF8String: - v, err = parseUTF8String(innerBytes) - case tagGeneralString: - // GeneralString is specified in ISO-2022/ECMA-35, - // A brief review suggests that it includes structures - // that allow the encoding to change midstring and - // such. We give up and pass it as an 8-bit string. - v, err = parseT61String(innerBytes) - default: - err = SyntaxError{fmt.Sprintf("internal error: unknown string type %d", universalTag)} - } - if err == nil { - val.SetString(v) - } - return - } - err = StructuralError{"unsupported: " + v.Type().String()} - return -} - -// canHaveDefaultValue reports whether k is a Kind that we will set a default -// value for. (A signed integer, essentially.) -func canHaveDefaultValue(k reflect.Kind) bool { - switch k { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return true - } - - return false -} - -// setDefaultValue is used to install a default value, from a tag string, into -// a Value. It is successful if the field was optional, even if a default value -// wasn't provided or it failed to install it into the Value. -func setDefaultValue(v reflect.Value, params fieldParameters) (ok bool) { - if !params.optional { - return - } - ok = true - if params.defaultValue == nil { - return - } - if canHaveDefaultValue(v.Kind()) { - v.SetInt(*params.defaultValue) - } - return -} - -// Unmarshal parses the DER-encoded ASN.1 data structure b -// and uses the reflect package to fill in an arbitrary value pointed at by val. -// Because Unmarshal uses the reflect package, the structs -// being written to must use upper case field names. -// -// An ASN.1 INTEGER can be written to an int, int32, int64, -// or *big.Int (from the math/big package). -// If the encoded value does not fit in the Go type, -// Unmarshal returns a parse error. -// -// An ASN.1 BIT STRING can be written to a BitString. -// -// An ASN.1 OCTET STRING can be written to a []byte. -// -// An ASN.1 OBJECT IDENTIFIER can be written to an -// ObjectIdentifier. -// -// An ASN.1 ENUMERATED can be written to an Enumerated. -// -// An ASN.1 UTCTIME or GENERALIZEDTIME can be written to a time.Time. -// -// An ASN.1 PrintableString or IA5String can be written to a string. -// -// Any of the above ASN.1 values can be written to an interface{}. -// The value stored in the interface has the corresponding Go type. -// For integers, that type is int64. -// -// An ASN.1 SEQUENCE OF x or SET OF x can be written -// to a slice if an x can be written to the slice's element type. -// -// An ASN.1 SEQUENCE or SET can be written to a struct -// if each of the elements in the sequence can be -// written to the corresponding element in the struct. -// -// The following tags on struct fields have special meaning to Unmarshal: -// -// application specifies that a APPLICATION tag is used -// default:x sets the default value for optional integer fields -// explicit specifies that an additional, explicit tag wraps the implicit one -// optional marks the field as ASN.1 OPTIONAL -// set causes a SET, rather than a SEQUENCE type to be expected -// tag:x specifies the ASN.1 tag number; implies ASN.1 CONTEXT SPECIFIC -// -// If the type of the first field of a structure is RawContent then the raw -// ASN1 contents of the struct will be stored in it. -// -// If the type name of a slice element ends with "SET" then it's treated as if -// the "set" tag was set on it. This can be used with nested slices where a -// struct tag cannot be given. -// -// Other ASN.1 types are not supported; if it encounters them, -// Unmarshal returns a parse error. -func Unmarshal(b []byte, val interface{}) (rest []byte, err error) { - return UnmarshalWithParams(b, val, "") -} - -// UnmarshalWithParams allows field parameters to be specified for the -// top-level element. The form of the params is the same as the field tags. -func UnmarshalWithParams(b []byte, val interface{}, params string) (rest []byte, err error) { - v := reflect.ValueOf(val).Elem() - offset, err := parseField(v, b, 0, parseFieldParameters(params)) - if err != nil { - return nil, err - } - return b[offset:], nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1_test.go deleted file mode 100644 index 893d0801b00308ffd935d6d26426631fe3e9efc6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/asn1_test.go +++ /dev/null @@ -1,942 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package asn1 - -import ( - "bytes" - "fmt" - "math/big" - "reflect" - "strings" - "testing" - "time" -) - -type boolTest struct { - in []byte - ok bool - out bool -} - -var boolTestData = []boolTest{ - {[]byte{0x00}, true, false}, - {[]byte{0xff}, true, true}, - {[]byte{0x00, 0x00}, false, false}, - {[]byte{0xff, 0xff}, false, false}, - {[]byte{0x01}, false, false}, -} - -func TestParseBool(t *testing.T) { - for i, test := range boolTestData { - ret, err := parseBool(test.in) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if test.ok && ret != test.out { - t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out) - } - } -} - -type int64Test struct { - in []byte - ok bool - out int64 -} - -var int64TestData = []int64Test{ - {[]byte{0x00}, true, 0}, - {[]byte{0x7f}, true, 127}, - {[]byte{0x00, 0x80}, true, 128}, - {[]byte{0x01, 0x00}, true, 256}, - {[]byte{0x80}, true, -128}, - {[]byte{0xff, 0x7f}, true, -129}, - {[]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, true, -1}, - {[]byte{0xff}, true, -1}, - {[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, true, -9223372036854775808}, - {[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, false, 0}, -} - -func TestParseInt64(t *testing.T) { - for i, test := range int64TestData { - ret, err := parseInt64(test.in) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if test.ok && ret != test.out { - t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out) - } - } -} - -type int32Test struct { - in []byte - ok bool - out int32 -} - -var int32TestData = []int32Test{ - {[]byte{0x00}, true, 0}, - {[]byte{0x7f}, true, 127}, - {[]byte{0x00, 0x80}, true, 128}, - {[]byte{0x01, 0x00}, true, 256}, - {[]byte{0x80}, true, -128}, - {[]byte{0xff, 0x7f}, true, -129}, - {[]byte{0xff, 0xff, 0xff, 0xff}, true, -1}, - {[]byte{0xff}, true, -1}, - {[]byte{0x80, 0x00, 0x00, 0x00}, true, -2147483648}, - {[]byte{0x80, 0x00, 0x00, 0x00, 0x00}, false, 0}, -} - -func TestParseInt32(t *testing.T) { - for i, test := range int32TestData { - ret, err := parseInt32(test.in) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if test.ok && int32(ret) != test.out { - t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out) - } - } -} - -var bigIntTests = []struct { - in []byte - base10 string -}{ - {[]byte{0xff}, "-1"}, - {[]byte{0x00}, "0"}, - {[]byte{0x01}, "1"}, - {[]byte{0x00, 0xff}, "255"}, - {[]byte{0xff, 0x00}, "-256"}, - {[]byte{0x01, 0x00}, "256"}, -} - -func TestParseBigInt(t *testing.T) { - for i, test := range bigIntTests { - ret := parseBigInt(test.in) - if ret.String() != test.base10 { - t.Errorf("#%d: bad result from %x, got %s want %s", i, test.in, ret.String(), test.base10) - } - fw := newForkableWriter() - marshalBigInt(fw, ret) - result := fw.Bytes() - if !bytes.Equal(result, test.in) { - t.Errorf("#%d: got %x from marshaling %s, want %x", i, result, ret, test.in) - } - } -} - -type bitStringTest struct { - in []byte - ok bool - out []byte - bitLength int -} - -var bitStringTestData = []bitStringTest{ - {[]byte{}, false, []byte{}, 0}, - {[]byte{0x00}, true, []byte{}, 0}, - {[]byte{0x07, 0x00}, true, []byte{0x00}, 1}, - {[]byte{0x07, 0x01}, false, []byte{}, 0}, - {[]byte{0x07, 0x40}, false, []byte{}, 0}, - {[]byte{0x08, 0x00}, false, []byte{}, 0}, -} - -func TestBitString(t *testing.T) { - for i, test := range bitStringTestData { - ret, err := parseBitString(test.in) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if err == nil { - if test.bitLength != ret.BitLength || !bytes.Equal(ret.Bytes, test.out) { - t.Errorf("#%d: Bad result: %v (expected %v %v)", i, ret, test.out, test.bitLength) - } - } - } -} - -func TestBitStringAt(t *testing.T) { - bs := BitString{[]byte{0x82, 0x40}, 16} - if bs.At(0) != 1 { - t.Error("#1: Failed") - } - if bs.At(1) != 0 { - t.Error("#2: Failed") - } - if bs.At(6) != 1 { - t.Error("#3: Failed") - } - if bs.At(9) != 1 { - t.Error("#4: Failed") - } - if bs.At(-1) != 0 { - t.Error("#5: Failed") - } - if bs.At(17) != 0 { - t.Error("#6: Failed") - } -} - -type bitStringRightAlignTest struct { - in []byte - inlen int - out []byte -} - -var bitStringRightAlignTests = []bitStringRightAlignTest{ - {[]byte{0x80}, 1, []byte{0x01}}, - {[]byte{0x80, 0x80}, 9, []byte{0x01, 0x01}}, - {[]byte{}, 0, []byte{}}, - {[]byte{0xce}, 8, []byte{0xce}}, - {[]byte{0xce, 0x47}, 16, []byte{0xce, 0x47}}, - {[]byte{0x34, 0x50}, 12, []byte{0x03, 0x45}}, -} - -func TestBitStringRightAlign(t *testing.T) { - for i, test := range bitStringRightAlignTests { - bs := BitString{test.in, test.inlen} - out := bs.RightAlign() - if !bytes.Equal(out, test.out) { - t.Errorf("#%d got: %x want: %x", i, out, test.out) - } - } -} - -type objectIdentifierTest struct { - in []byte - ok bool - out []int -} - -var objectIdentifierTestData = []objectIdentifierTest{ - {[]byte{}, false, []int{}}, - {[]byte{85}, true, []int{2, 5}}, - {[]byte{85, 0x02}, true, []int{2, 5, 2}}, - {[]byte{85, 0x02, 0xc0, 0x00}, true, []int{2, 5, 2, 0x2000}}, - {[]byte{0x81, 0x34, 0x03}, true, []int{2, 100, 3}}, - {[]byte{85, 0x02, 0xc0, 0x80, 0x80, 0x80, 0x80}, false, []int{}}, -} - -func TestObjectIdentifier(t *testing.T) { - for i, test := range objectIdentifierTestData { - ret, err := parseObjectIdentifier(test.in) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if err == nil { - if !reflect.DeepEqual(test.out, ret) { - t.Errorf("#%d: Bad result: %v (expected %v)", i, ret, test.out) - } - } - } - - if s := ObjectIdentifier([]int{1, 2, 3, 4}).String(); s != "1.2.3.4" { - t.Errorf("bad ObjectIdentifier.String(). Got %s, want 1.2.3.4", s) - } -} - -type timeTest struct { - in string - ok bool - out time.Time -} - -var utcTestData = []timeTest{ - {"910506164540-0700", true, time.Date(1991, 05, 06, 16, 45, 40, 0, time.FixedZone("", -7*60*60))}, - {"910506164540+0730", true, time.Date(1991, 05, 06, 16, 45, 40, 0, time.FixedZone("", 7*60*60+30*60))}, - {"910506234540Z", true, time.Date(1991, 05, 06, 23, 45, 40, 0, time.UTC)}, - {"9105062345Z", true, time.Date(1991, 05, 06, 23, 45, 0, 0, time.UTC)}, - {"5105062345Z", true, time.Date(1951, 05, 06, 23, 45, 0, 0, time.UTC)}, - {"a10506234540Z", false, time.Time{}}, - {"91a506234540Z", false, time.Time{}}, - {"9105a6234540Z", false, time.Time{}}, - {"910506a34540Z", false, time.Time{}}, - {"910506334a40Z", false, time.Time{}}, - {"91050633444aZ", false, time.Time{}}, - {"910506334461Z", false, time.Time{}}, - {"910506334400Za", false, time.Time{}}, - /* These are invalid times. However, the time package normalises times - * and they were accepted in some versions. See #11134. */ - {"000100000000Z", false, time.Time{}}, - {"101302030405Z", false, time.Time{}}, - {"100002030405Z", false, time.Time{}}, - {"100100030405Z", false, time.Time{}}, - {"100132030405Z", false, time.Time{}}, - {"100231030405Z", false, time.Time{}}, - {"100102240405Z", false, time.Time{}}, - {"100102036005Z", false, time.Time{}}, - {"100102030460Z", false, time.Time{}}, - {"-100102030410Z", false, time.Time{}}, - {"10-0102030410Z", false, time.Time{}}, - {"10-0002030410Z", false, time.Time{}}, - {"1001-02030410Z", false, time.Time{}}, - {"100102-030410Z", false, time.Time{}}, - {"10010203-0410Z", false, time.Time{}}, - {"1001020304-10Z", false, time.Time{}}, -} - -func TestUTCTime(t *testing.T) { - for i, test := range utcTestData { - ret, err := parseUTCTime([]byte(test.in)) - if err != nil { - if test.ok { - t.Errorf("#%d: parseUTCTime(%q) = error %v", i, test.in, err) - } - continue - } - if !test.ok { - t.Errorf("#%d: parseUTCTime(%q) succeeded, should have failed", i, test.in) - continue - } - const format = "Jan _2 15:04:05 -0700 2006" // ignore zone name, just offset - have := ret.Format(format) - want := test.out.Format(format) - if have != want { - t.Errorf("#%d: parseUTCTime(%q) = %s, want %s", i, test.in, have, want) - } - } -} - -var generalizedTimeTestData = []timeTest{ - {"20100102030405Z", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.UTC)}, - {"20100102030405", false, time.Time{}}, - {"20100102030405+0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", 6*60*60+7*60))}, - {"20100102030405-0607", true, time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", -6*60*60-7*60))}, - /* These are invalid times. However, the time package normalises times - * and they were accepted in some versions. See #11134. */ - {"00000100000000Z", false, time.Time{}}, - {"20101302030405Z", false, time.Time{}}, - {"20100002030405Z", false, time.Time{}}, - {"20100100030405Z", false, time.Time{}}, - {"20100132030405Z", false, time.Time{}}, - {"20100231030405Z", false, time.Time{}}, - {"20100102240405Z", false, time.Time{}}, - {"20100102036005Z", false, time.Time{}}, - {"20100102030460Z", false, time.Time{}}, - {"-20100102030410Z", false, time.Time{}}, - {"2010-0102030410Z", false, time.Time{}}, - {"2010-0002030410Z", false, time.Time{}}, - {"201001-02030410Z", false, time.Time{}}, - {"20100102-030410Z", false, time.Time{}}, - {"2010010203-0410Z", false, time.Time{}}, - {"201001020304-10Z", false, time.Time{}}, -} - -func TestGeneralizedTime(t *testing.T) { - for i, test := range generalizedTimeTestData { - ret, err := parseGeneralizedTime([]byte(test.in)) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did fail? %v, expected: %v)", i, err == nil, test.ok) - } - if err == nil { - if !reflect.DeepEqual(test.out, ret) { - t.Errorf("#%d: Bad result: %q → %v (expected %v)", i, test.in, ret, test.out) - } - } - } -} - -type tagAndLengthTest struct { - in []byte - ok bool - out tagAndLength -} - -var tagAndLengthData = []tagAndLengthTest{ - {[]byte{0x80, 0x01}, true, tagAndLength{2, 0, 1, false}}, - {[]byte{0xa0, 0x01}, true, tagAndLength{2, 0, 1, true}}, - {[]byte{0x02, 0x00}, true, tagAndLength{0, 2, 0, false}}, - {[]byte{0xfe, 0x00}, true, tagAndLength{3, 30, 0, true}}, - {[]byte{0x1f, 0x01, 0x00}, true, tagAndLength{0, 1, 0, false}}, - {[]byte{0x1f, 0x81, 0x00, 0x00}, true, tagAndLength{0, 128, 0, false}}, - {[]byte{0x1f, 0x81, 0x80, 0x01, 0x00}, true, tagAndLength{0, 0x4001, 0, false}}, - {[]byte{0x00, 0x81, 0x01}, true, tagAndLength{0, 0, 1, false}}, - {[]byte{0x00, 0x82, 0x01, 0x00}, true, tagAndLength{0, 0, 256, false}}, - {[]byte{0x00, 0x83, 0x01, 0x00}, false, tagAndLength{}}, - {[]byte{0x1f, 0x85}, false, tagAndLength{}}, - {[]byte{0x30, 0x80}, false, tagAndLength{}}, - // Superfluous zeros in the length should be an error. - {[]byte{0xa0, 0x82, 0x00, 0x01}, false, tagAndLength{}}, - // Lengths up to the maximum size of an int should work. - {[]byte{0xa0, 0x84, 0x7f, 0xff, 0xff, 0xff}, true, tagAndLength{2, 0, 0x7fffffff, true}}, - // Lengths that would overflow an int should be rejected. - {[]byte{0xa0, 0x84, 0x80, 0x00, 0x00, 0x00}, false, tagAndLength{}}, -} - -func TestParseTagAndLength(t *testing.T) { - for i, test := range tagAndLengthData { - tagAndLength, _, err := parseTagAndLength(test.in, 0) - if (err == nil) != test.ok { - t.Errorf("#%d: Incorrect error result (did pass? %v, expected: %v)", i, err == nil, test.ok) - } - if err == nil && !reflect.DeepEqual(test.out, tagAndLength) { - t.Errorf("#%d: Bad result: %v (expected %v)", i, tagAndLength, test.out) - } - } -} - -type parseFieldParametersTest struct { - in string - out fieldParameters -} - -func newInt(n int) *int { return &n } - -func newInt64(n int64) *int64 { return &n } - -func newString(s string) *string { return &s } - -func newBool(b bool) *bool { return &b } - -var parseFieldParametersTestData []parseFieldParametersTest = []parseFieldParametersTest{ - {"", fieldParameters{}}, - {"ia5", fieldParameters{stringType: tagIA5String}}, - {"generalized", fieldParameters{timeType: tagGeneralizedTime}}, - {"utc", fieldParameters{timeType: tagUTCTime}}, - {"printable", fieldParameters{stringType: tagPrintableString}}, - {"optional", fieldParameters{optional: true}}, - {"explicit", fieldParameters{explicit: true, tag: new(int)}}, - {"application", fieldParameters{application: true, tag: new(int)}}, - {"optional,explicit", fieldParameters{optional: true, explicit: true, tag: new(int)}}, - {"default:42", fieldParameters{defaultValue: newInt64(42)}}, - {"tag:17", fieldParameters{tag: newInt(17)}}, - {"optional,explicit,default:42,tag:17", fieldParameters{optional: true, explicit: true, defaultValue: newInt64(42), tag: newInt(17)}}, - {"optional,explicit,default:42,tag:17,rubbish1", fieldParameters{true, true, false, newInt64(42), newInt(17), 0, 0, false, false}}, - {"set", fieldParameters{set: true}}, -} - -func TestParseFieldParameters(t *testing.T) { - for i, test := range parseFieldParametersTestData { - f := parseFieldParameters(test.in) - if !reflect.DeepEqual(f, test.out) { - t.Errorf("#%d: Bad result: %v (expected %v)", i, f, test.out) - } - } -} - -type TestObjectIdentifierStruct struct { - OID ObjectIdentifier -} - -type TestContextSpecificTags struct { - A int `asn1:"tag:1"` -} - -type TestContextSpecificTags2 struct { - A int `asn1:"explicit,tag:1"` - B int -} - -type TestContextSpecificTags3 struct { - S string `asn1:"tag:1,utf8"` -} - -type TestElementsAfterString struct { - S string - A, B int -} - -type TestBigInt struct { - X *big.Int -} - -type TestSet struct { - Ints []int `asn1:"set"` -} - -var unmarshalTestData = []struct { - in []byte - out interface{} -}{ - {[]byte{0x02, 0x01, 0x42}, newInt(0x42)}, - {[]byte{0x30, 0x08, 0x06, 0x06, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d}, &TestObjectIdentifierStruct{[]int{1, 2, 840, 113549}}}, - {[]byte{0x03, 0x04, 0x06, 0x6e, 0x5d, 0xc0}, &BitString{[]byte{110, 93, 192}, 18}}, - {[]byte{0x30, 0x09, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x03}, &[]int{1, 2, 3}}, - {[]byte{0x02, 0x01, 0x10}, newInt(16)}, - {[]byte{0x13, 0x04, 't', 'e', 's', 't'}, newString("test")}, - {[]byte{0x16, 0x04, 't', 'e', 's', 't'}, newString("test")}, - {[]byte{0x16, 0x04, 't', 'e', 's', 't'}, &RawValue{0, 22, false, []byte("test"), []byte("\x16\x04test")}}, - {[]byte{0x04, 0x04, 1, 2, 3, 4}, &RawValue{0, 4, false, []byte{1, 2, 3, 4}, []byte{4, 4, 1, 2, 3, 4}}}, - {[]byte{0x30, 0x03, 0x81, 0x01, 0x01}, &TestContextSpecificTags{1}}, - {[]byte{0x30, 0x08, 0xa1, 0x03, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02}, &TestContextSpecificTags2{1, 2}}, - {[]byte{0x30, 0x03, 0x81, 0x01, '@'}, &TestContextSpecificTags3{"@"}}, - {[]byte{0x01, 0x01, 0x00}, newBool(false)}, - {[]byte{0x01, 0x01, 0xff}, newBool(true)}, - {[]byte{0x30, 0x0b, 0x13, 0x03, 0x66, 0x6f, 0x6f, 0x02, 0x01, 0x22, 0x02, 0x01, 0x33}, &TestElementsAfterString{"foo", 0x22, 0x33}}, - {[]byte{0x30, 0x05, 0x02, 0x03, 0x12, 0x34, 0x56}, &TestBigInt{big.NewInt(0x123456)}}, - {[]byte{0x30, 0x0b, 0x31, 0x09, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x03}, &TestSet{Ints: []int{1, 2, 3}}}, -} - -func TestUnmarshal(t *testing.T) { - for i, test := range unmarshalTestData { - pv := reflect.New(reflect.TypeOf(test.out).Elem()) - val := pv.Interface() - _, err := Unmarshal(test.in, val) - if err != nil { - t.Errorf("Unmarshal failed at index %d %v", i, err) - } - if !reflect.DeepEqual(val, test.out) { - t.Errorf("#%d:\nhave %#v\nwant %#v", i, val, test.out) - } - } -} - -type Certificate struct { - TBSCertificate TBSCertificate - SignatureAlgorithm AlgorithmIdentifier - SignatureValue BitString -} - -type TBSCertificate struct { - Version int `asn1:"optional,explicit,default:0,tag:0"` - SerialNumber RawValue - SignatureAlgorithm AlgorithmIdentifier - Issuer RDNSequence - Validity Validity - Subject RDNSequence - PublicKey PublicKeyInfo -} - -type AlgorithmIdentifier struct { - Algorithm ObjectIdentifier -} - -type RDNSequence []RelativeDistinguishedNameSET - -type RelativeDistinguishedNameSET []AttributeTypeAndValue - -type AttributeTypeAndValue struct { - Type ObjectIdentifier - Value interface{} -} - -type Validity struct { - NotBefore, NotAfter time.Time -} - -type PublicKeyInfo struct { - Algorithm AlgorithmIdentifier - PublicKey BitString -} - -func TestCertificate(t *testing.T) { - // This is a minimal, self-signed certificate that should parse correctly. - var cert Certificate - if _, err := Unmarshal(derEncodedSelfSignedCertBytes, &cert); err != nil { - t.Errorf("Unmarshal failed: %v", err) - } - if !reflect.DeepEqual(cert, derEncodedSelfSignedCert) { - t.Errorf("Bad result:\ngot: %+v\nwant: %+v", cert, derEncodedSelfSignedCert) - } -} - -func TestCertificateWithNUL(t *testing.T) { - // This is the paypal NUL-hack certificate. It should fail to parse because - // NUL isn't a permitted character in a PrintableString. - - var cert Certificate - if _, err := Unmarshal(derEncodedPaypalNULCertBytes, &cert); err == nil { - t.Error("Unmarshal succeeded, should not have") - } -} - -type rawStructTest struct { - Raw RawContent - A int -} - -func TestRawStructs(t *testing.T) { - var s rawStructTest - input := []byte{0x30, 0x03, 0x02, 0x01, 0x50} - - rest, err := Unmarshal(input, &s) - if len(rest) != 0 { - t.Errorf("incomplete parse: %x", rest) - return - } - if err != nil { - t.Error(err) - return - } - if s.A != 0x50 { - t.Errorf("bad value for A: got %d want %d", s.A, 0x50) - } - if !bytes.Equal([]byte(s.Raw), input) { - t.Errorf("bad value for Raw: got %x want %x", s.Raw, input) - } -} - -type oiEqualTest struct { - first ObjectIdentifier - second ObjectIdentifier - same bool -} - -var oiEqualTests = []oiEqualTest{ - { - ObjectIdentifier{1, 2, 3}, - ObjectIdentifier{1, 2, 3}, - true, - }, - { - ObjectIdentifier{1}, - ObjectIdentifier{1, 2, 3}, - false, - }, - { - ObjectIdentifier{1, 2, 3}, - ObjectIdentifier{10, 11, 12}, - false, - }, -} - -func TestObjectIdentifierEqual(t *testing.T) { - for _, o := range oiEqualTests { - if s := o.first.Equal(o.second); s != o.same { - t.Errorf("ObjectIdentifier.Equal: got: %t want: %t", s, o.same) - } - } -} - -var derEncodedSelfSignedCert = Certificate{ - TBSCertificate: TBSCertificate{ - Version: 0, - SerialNumber: RawValue{Class: 0, Tag: 2, IsCompound: false, Bytes: []uint8{0x0, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c, 0x98}, FullBytes: []byte{2, 9, 0x0, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c, 0x98}}, - SignatureAlgorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}}, - Issuer: RDNSequence{ - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 6}, Value: "XX"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 8}, Value: "Some-State"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 7}, Value: "City"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 10}, Value: "Internet Widgits Pty Ltd"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 3}, Value: "false.example.com"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, Value: "false@example.com"}}, - }, - Validity: Validity{ - NotBefore: time.Date(2009, 10, 8, 00, 25, 53, 0, time.UTC), - NotAfter: time.Date(2010, 10, 8, 00, 25, 53, 0, time.UTC), - }, - Subject: RDNSequence{ - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 6}, Value: "XX"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 8}, Value: "Some-State"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 7}, Value: "City"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 10}, Value: "Internet Widgits Pty Ltd"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{2, 5, 4, 3}, Value: "false.example.com"}}, - RelativeDistinguishedNameSET{AttributeTypeAndValue{Type: ObjectIdentifier{1, 2, 840, 113549, 1, 9, 1}, Value: "false@example.com"}}, - }, - PublicKey: PublicKeyInfo{ - Algorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1}}, - PublicKey: BitString{ - Bytes: []uint8{ - 0x30, 0x48, 0x2, 0x41, 0x0, 0xcd, 0xb7, - 0x63, 0x9c, 0x32, 0x78, 0xf0, 0x6, 0xaa, 0x27, 0x7f, 0x6e, 0xaf, 0x42, - 0x90, 0x2b, 0x59, 0x2d, 0x8c, 0xbc, 0xbe, 0x38, 0xa1, 0xc9, 0x2b, 0xa4, - 0x69, 0x5a, 0x33, 0x1b, 0x1d, 0xea, 0xde, 0xad, 0xd8, 0xe9, 0xa5, 0xc2, - 0x7e, 0x8c, 0x4c, 0x2f, 0xd0, 0xa8, 0x88, 0x96, 0x57, 0x72, 0x2a, 0x4f, - 0x2a, 0xf7, 0x58, 0x9c, 0xf2, 0xc7, 0x70, 0x45, 0xdc, 0x8f, 0xde, 0xec, - 0x35, 0x7d, 0x2, 0x3, 0x1, 0x0, 0x1, - }, - BitLength: 592, - }, - }, - }, - SignatureAlgorithm: AlgorithmIdentifier{Algorithm: ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}}, - SignatureValue: BitString{ - Bytes: []uint8{ - 0xa6, 0x7b, 0x6, 0xec, 0x5e, 0xce, - 0x92, 0x77, 0x2c, 0xa4, 0x13, 0xcb, 0xa3, 0xca, 0x12, 0x56, 0x8f, 0xdc, 0x6c, - 0x7b, 0x45, 0x11, 0xcd, 0x40, 0xa7, 0xf6, 0x59, 0x98, 0x4, 0x2, 0xdf, 0x2b, - 0x99, 0x8b, 0xb9, 0xa4, 0xa8, 0xcb, 0xeb, 0x34, 0xc0, 0xf0, 0xa7, 0x8c, 0xf8, - 0xd9, 0x1e, 0xde, 0x14, 0xa5, 0xed, 0x76, 0xbf, 0x11, 0x6f, 0xe3, 0x60, 0xaa, - 0xfa, 0x88, 0x21, 0x49, 0x4, 0x35, - }, - BitLength: 512, - }, -} - -var derEncodedSelfSignedCertBytes = []byte{ - 0x30, 0x82, 0x02, 0x18, 0x30, - 0x82, 0x01, 0xc2, 0x02, 0x09, 0x00, 0x8c, 0xc3, 0x37, 0x92, 0x10, 0xec, 0x2c, - 0x98, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, - 0x05, 0x05, 0x00, 0x30, 0x81, 0x92, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x58, 0x58, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x04, 0x43, - 0x69, 0x74, 0x79, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, - 0x18, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, - 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x31, - 0x1a, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x66, 0x61, 0x6c, - 0x73, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, - 0x6d, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, - 0x01, 0x09, 0x01, 0x16, 0x11, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x40, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, - 0x30, 0x39, 0x31, 0x30, 0x30, 0x38, 0x30, 0x30, 0x32, 0x35, 0x35, 0x33, 0x5a, - 0x17, 0x0d, 0x31, 0x30, 0x31, 0x30, 0x30, 0x38, 0x30, 0x30, 0x32, 0x35, 0x35, - 0x33, 0x5a, 0x30, 0x81, 0x92, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, - 0x06, 0x13, 0x02, 0x58, 0x58, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, - 0x08, 0x13, 0x0a, 0x53, 0x6f, 0x6d, 0x65, 0x2d, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x31, 0x0d, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x04, 0x43, 0x69, - 0x74, 0x79, 0x31, 0x21, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x18, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, - 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4c, 0x74, 0x64, 0x31, 0x1a, - 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x66, 0x61, 0x6c, 0x73, - 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, - 0x31, 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, - 0x09, 0x01, 0x16, 0x11, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x40, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x5c, 0x30, 0x0d, 0x06, - 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, - 0x4b, 0x00, 0x30, 0x48, 0x02, 0x41, 0x00, 0xcd, 0xb7, 0x63, 0x9c, 0x32, 0x78, - 0xf0, 0x06, 0xaa, 0x27, 0x7f, 0x6e, 0xaf, 0x42, 0x90, 0x2b, 0x59, 0x2d, 0x8c, - 0xbc, 0xbe, 0x38, 0xa1, 0xc9, 0x2b, 0xa4, 0x69, 0x5a, 0x33, 0x1b, 0x1d, 0xea, - 0xde, 0xad, 0xd8, 0xe9, 0xa5, 0xc2, 0x7e, 0x8c, 0x4c, 0x2f, 0xd0, 0xa8, 0x88, - 0x96, 0x57, 0x72, 0x2a, 0x4f, 0x2a, 0xf7, 0x58, 0x9c, 0xf2, 0xc7, 0x70, 0x45, - 0xdc, 0x8f, 0xde, 0xec, 0x35, 0x7d, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, - 0x03, 0x41, 0x00, 0xa6, 0x7b, 0x06, 0xec, 0x5e, 0xce, 0x92, 0x77, 0x2c, 0xa4, - 0x13, 0xcb, 0xa3, 0xca, 0x12, 0x56, 0x8f, 0xdc, 0x6c, 0x7b, 0x45, 0x11, 0xcd, - 0x40, 0xa7, 0xf6, 0x59, 0x98, 0x04, 0x02, 0xdf, 0x2b, 0x99, 0x8b, 0xb9, 0xa4, - 0xa8, 0xcb, 0xeb, 0x34, 0xc0, 0xf0, 0xa7, 0x8c, 0xf8, 0xd9, 0x1e, 0xde, 0x14, - 0xa5, 0xed, 0x76, 0xbf, 0x11, 0x6f, 0xe3, 0x60, 0xaa, 0xfa, 0x88, 0x21, 0x49, - 0x04, 0x35, -} - -var derEncodedPaypalNULCertBytes = []byte{ - 0x30, 0x82, 0x06, 0x44, 0x30, - 0x82, 0x05, 0xad, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x03, 0x00, 0xf0, 0x9b, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x30, 0x82, 0x01, 0x12, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, - 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, - 0x04, 0x08, 0x13, 0x09, 0x42, 0x61, 0x72, 0x63, 0x65, 0x6c, 0x6f, 0x6e, 0x61, - 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x42, 0x61, - 0x72, 0x63, 0x65, 0x6c, 0x6f, 0x6e, 0x61, 0x31, 0x29, 0x30, 0x27, 0x06, 0x03, - 0x55, 0x04, 0x0a, 0x13, 0x20, 0x49, 0x50, 0x53, 0x20, 0x43, 0x65, 0x72, 0x74, - 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, - 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x20, 0x73, 0x2e, 0x6c, 0x2e, 0x31, 0x2e, - 0x30, 0x2c, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x14, 0x25, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x6c, 0x40, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, - 0x20, 0x43, 0x2e, 0x49, 0x2e, 0x46, 0x2e, 0x20, 0x20, 0x42, 0x2d, 0x42, 0x36, - 0x32, 0x32, 0x31, 0x30, 0x36, 0x39, 0x35, 0x31, 0x2e, 0x30, 0x2c, 0x06, 0x03, - 0x55, 0x04, 0x0b, 0x13, 0x25, 0x69, 0x70, 0x73, 0x43, 0x41, 0x20, 0x43, 0x4c, - 0x41, 0x53, 0x45, 0x41, 0x31, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x31, 0x2e, 0x30, 0x2c, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, - 0x25, 0x69, 0x70, 0x73, 0x43, 0x41, 0x20, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, - 0x31, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x31, - 0x20, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, - 0x01, 0x16, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x40, 0x69, 0x70, - 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x1e, 0x17, 0x0d, 0x30, 0x39, - 0x30, 0x32, 0x32, 0x34, 0x32, 0x33, 0x30, 0x34, 0x31, 0x37, 0x5a, 0x17, 0x0d, - 0x31, 0x31, 0x30, 0x32, 0x32, 0x34, 0x32, 0x33, 0x30, 0x34, 0x31, 0x37, 0x5a, - 0x30, 0x81, 0x94, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, - 0x02, 0x55, 0x53, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, - 0x0a, 0x43, 0x61, 0x6c, 0x69, 0x66, 0x6f, 0x72, 0x6e, 0x69, 0x61, 0x31, 0x16, - 0x30, 0x14, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x0d, 0x53, 0x61, 0x6e, 0x20, - 0x46, 0x72, 0x61, 0x6e, 0x63, 0x69, 0x73, 0x63, 0x6f, 0x31, 0x11, 0x30, 0x0f, - 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, - 0x74, 0x79, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x0b, - 0x53, 0x65, 0x63, 0x75, 0x72, 0x65, 0x20, 0x55, 0x6e, 0x69, 0x74, 0x31, 0x2f, - 0x30, 0x2d, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x26, 0x77, 0x77, 0x77, 0x2e, - 0x70, 0x61, 0x79, 0x70, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x73, 0x73, - 0x6c, 0x2e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x63, 0x63, 0x30, 0x81, 0x9f, 0x30, 0x0d, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00, - 0x03, 0x81, 0x8d, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xd2, 0x69, - 0xfa, 0x6f, 0x3a, 0x00, 0xb4, 0x21, 0x1b, 0xc8, 0xb1, 0x02, 0xd7, 0x3f, 0x19, - 0xb2, 0xc4, 0x6d, 0xb4, 0x54, 0xf8, 0x8b, 0x8a, 0xcc, 0xdb, 0x72, 0xc2, 0x9e, - 0x3c, 0x60, 0xb9, 0xc6, 0x91, 0x3d, 0x82, 0xb7, 0x7d, 0x99, 0xff, 0xd1, 0x29, - 0x84, 0xc1, 0x73, 0x53, 0x9c, 0x82, 0xdd, 0xfc, 0x24, 0x8c, 0x77, 0xd5, 0x41, - 0xf3, 0xe8, 0x1e, 0x42, 0xa1, 0xad, 0x2d, 0x9e, 0xff, 0x5b, 0x10, 0x26, 0xce, - 0x9d, 0x57, 0x17, 0x73, 0x16, 0x23, 0x38, 0xc8, 0xd6, 0xf1, 0xba, 0xa3, 0x96, - 0x5b, 0x16, 0x67, 0x4a, 0x4f, 0x73, 0x97, 0x3a, 0x4d, 0x14, 0xa4, 0xf4, 0xe2, - 0x3f, 0x8b, 0x05, 0x83, 0x42, 0xd1, 0xd0, 0xdc, 0x2f, 0x7a, 0xe5, 0xb6, 0x10, - 0xb2, 0x11, 0xc0, 0xdc, 0x21, 0x2a, 0x90, 0xff, 0xae, 0x97, 0x71, 0x5a, 0x49, - 0x81, 0xac, 0x40, 0xf3, 0x3b, 0xb8, 0x59, 0xb2, 0x4f, 0x02, 0x03, 0x01, 0x00, - 0x01, 0xa3, 0x82, 0x03, 0x21, 0x30, 0x82, 0x03, 0x1d, 0x30, 0x09, 0x06, 0x03, - 0x55, 0x1d, 0x13, 0x04, 0x02, 0x30, 0x00, 0x30, 0x11, 0x06, 0x09, 0x60, 0x86, - 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x01, 0x04, 0x04, 0x03, 0x02, 0x06, 0x40, - 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x03, 0xf8, - 0x30, 0x13, 0x06, 0x03, 0x55, 0x1d, 0x25, 0x04, 0x0c, 0x30, 0x0a, 0x06, 0x08, - 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30, 0x1d, 0x06, 0x03, 0x55, - 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x61, 0x8f, 0x61, 0x34, 0x43, 0x55, 0x14, - 0x7f, 0x27, 0x09, 0xce, 0x4c, 0x8b, 0xea, 0x9b, 0x7b, 0x19, 0x25, 0xbc, 0x6e, - 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, - 0x0e, 0x07, 0x60, 0xd4, 0x39, 0xc9, 0x1b, 0x5b, 0x5d, 0x90, 0x7b, 0x23, 0xc8, - 0xd2, 0x34, 0x9d, 0x4a, 0x9a, 0x46, 0x39, 0x30, 0x09, 0x06, 0x03, 0x55, 0x1d, - 0x11, 0x04, 0x02, 0x30, 0x00, 0x30, 0x1c, 0x06, 0x03, 0x55, 0x1d, 0x12, 0x04, - 0x15, 0x30, 0x13, 0x81, 0x11, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x6c, 0x40, - 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x30, 0x72, 0x06, 0x09, - 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x0d, 0x04, 0x65, 0x16, 0x63, - 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, - 0x49, 0x6e, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x4e, - 0x4f, 0x54, 0x20, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x41, 0x54, 0x45, 0x44, 0x2e, - 0x20, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x20, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x65, 0x20, 0x69, 0x73, 0x73, 0x75, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, 0x68, - 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, - 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x30, 0x2f, 0x06, 0x09, 0x60, - 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x02, 0x04, 0x22, 0x16, 0x20, 0x68, - 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, - 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, - 0x32, 0x30, 0x30, 0x32, 0x2f, 0x30, 0x43, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, - 0x86, 0xf8, 0x42, 0x01, 0x04, 0x04, 0x36, 0x16, 0x34, 0x68, 0x74, 0x74, 0x70, - 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, - 0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x43, 0x4c, - 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63, 0x72, 0x6c, 0x30, 0x46, 0x06, 0x09, - 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x03, 0x04, 0x39, 0x16, 0x37, - 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, - 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, - 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x72, 0x65, 0x76, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x68, 0x74, - 0x6d, 0x6c, 0x3f, 0x30, 0x43, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, - 0x42, 0x01, 0x07, 0x04, 0x36, 0x16, 0x34, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, - 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, - 0x72, 0x65, 0x6e, 0x65, 0x77, 0x61, 0x6c, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, - 0x31, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x3f, 0x30, 0x41, 0x06, 0x09, 0x60, 0x86, - 0x48, 0x01, 0x86, 0xf8, 0x42, 0x01, 0x08, 0x04, 0x34, 0x16, 0x32, 0x68, 0x74, - 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x70, 0x73, - 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, - 0x30, 0x30, 0x32, 0x2f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x43, 0x4c, 0x41, - 0x53, 0x45, 0x41, 0x31, 0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x30, 0x81, 0x83, 0x06, - 0x03, 0x55, 0x1d, 0x1f, 0x04, 0x7c, 0x30, 0x7a, 0x30, 0x39, 0xa0, 0x37, 0xa0, - 0x35, 0x86, 0x33, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, - 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, - 0x73, 0x63, 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, - 0x32, 0x30, 0x30, 0x32, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63, - 0x72, 0x6c, 0x30, 0x3d, 0xa0, 0x3b, 0xa0, 0x39, 0x86, 0x37, 0x68, 0x74, 0x74, - 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x62, 0x61, 0x63, 0x6b, 0x2e, 0x69, - 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x70, 0x73, 0x63, - 0x61, 0x32, 0x30, 0x30, 0x32, 0x2f, 0x69, 0x70, 0x73, 0x63, 0x61, 0x32, 0x30, - 0x30, 0x32, 0x43, 0x4c, 0x41, 0x53, 0x45, 0x41, 0x31, 0x2e, 0x63, 0x72, 0x6c, - 0x30, 0x32, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, - 0x26, 0x30, 0x24, 0x30, 0x22, 0x06, 0x08, 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07, - 0x30, 0x01, 0x86, 0x16, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6f, 0x63, - 0x73, 0x70, 0x2e, 0x69, 0x70, 0x73, 0x63, 0x61, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, - 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x68, 0xee, 0x79, 0x97, 0x97, 0xdd, 0x3b, - 0xef, 0x16, 0x6a, 0x06, 0xf2, 0x14, 0x9a, 0x6e, 0xcd, 0x9e, 0x12, 0xf7, 0xaa, - 0x83, 0x10, 0xbd, 0xd1, 0x7c, 0x98, 0xfa, 0xc7, 0xae, 0xd4, 0x0e, 0x2c, 0x9e, - 0x38, 0x05, 0x9d, 0x52, 0x60, 0xa9, 0x99, 0x0a, 0x81, 0xb4, 0x98, 0x90, 0x1d, - 0xae, 0xbb, 0x4a, 0xd7, 0xb9, 0xdc, 0x88, 0x9e, 0x37, 0x78, 0x41, 0x5b, 0xf7, - 0x82, 0xa5, 0xf2, 0xba, 0x41, 0x25, 0x5a, 0x90, 0x1a, 0x1e, 0x45, 0x38, 0xa1, - 0x52, 0x58, 0x75, 0x94, 0x26, 0x44, 0xfb, 0x20, 0x07, 0xba, 0x44, 0xcc, 0xe5, - 0x4a, 0x2d, 0x72, 0x3f, 0x98, 0x47, 0xf6, 0x26, 0xdc, 0x05, 0x46, 0x05, 0x07, - 0x63, 0x21, 0xab, 0x46, 0x9b, 0x9c, 0x78, 0xd5, 0x54, 0x5b, 0x3d, 0x0c, 0x1e, - 0xc8, 0x64, 0x8c, 0xb5, 0x50, 0x23, 0x82, 0x6f, 0xdb, 0xb8, 0x22, 0x1c, 0x43, - 0x96, 0x07, 0xa8, 0xbb, -} - -var stringSliceTestData = [][]string{ - {"foo", "bar"}, - {"foo", "\\bar"}, - {"foo", "\"bar\""}, - {"foo", "åäö"}, -} - -func TestStringSlice(t *testing.T) { - for _, test := range stringSliceTestData { - bs, err := Marshal(test) - if err != nil { - t.Error(err) - } - - var res []string - _, err = Unmarshal(bs, &res) - if err != nil { - t.Error(err) - } - - if fmt.Sprintf("%v", res) != fmt.Sprintf("%v", test) { - t.Errorf("incorrect marshal/unmarshal; %v != %v", res, test) - } - } -} - -type explicitTaggedTimeTest struct { - Time time.Time `asn1:"explicit,tag:0"` -} - -var explicitTaggedTimeTestData = []struct { - in []byte - out explicitTaggedTimeTest -}{ - {[]byte{0x30, 0x11, 0xa0, 0xf, 0x17, 0xd, '9', '1', '0', '5', '0', '6', '1', '6', '4', '5', '4', '0', 'Z'}, - explicitTaggedTimeTest{time.Date(1991, 05, 06, 16, 45, 40, 0, time.UTC)}}, - {[]byte{0x30, 0x17, 0xa0, 0xf, 0x18, 0x13, '2', '0', '1', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '+', '0', '6', '0', '7'}, - explicitTaggedTimeTest{time.Date(2010, 01, 02, 03, 04, 05, 0, time.FixedZone("", 6*60*60+7*60))}}, -} - -func TestExplicitTaggedTime(t *testing.T) { - // Test that a time.Time will match either tagUTCTime or - // tagGeneralizedTime. - for i, test := range explicitTaggedTimeTestData { - var got explicitTaggedTimeTest - _, err := Unmarshal(test.in, &got) - if err != nil { - t.Errorf("Unmarshal failed at index %d %v", i, err) - } - if !got.Time.Equal(test.out.Time) { - t.Errorf("#%d: got %v, want %v", i, got.Time, test.out.Time) - } - } -} - -type implicitTaggedTimeTest struct { - Time time.Time `asn1:"tag:24"` -} - -func TestImplicitTaggedTime(t *testing.T) { - // An implicitly tagged time value, that happens to have an implicit - // tag equal to a GENERALIZEDTIME, should still be parsed as a UTCTime. - // (There's no "timeType" in fieldParameters to determine what type of - // time should be expected when implicitly tagged.) - der := []byte{0x30, 0x0f, 0x80 | 24, 0xd, '9', '1', '0', '5', '0', '6', '1', '6', '4', '5', '4', '0', 'Z'} - var result implicitTaggedTimeTest - if _, err := Unmarshal(der, &result); err != nil { - t.Fatalf("Error while parsing: %s", err) - } - if expected := time.Date(1991, 05, 06, 16, 45, 40, 0, time.UTC); !result.Time.Equal(expected) { - t.Errorf("Wrong result. Got %v, want %v", result.Time, expected) - } -} - -type truncatedExplicitTagTest struct { - Test int `asn1:"explicit,tag:0"` -} - -func TestTruncatedExplicitTag(t *testing.T) { - // This crashed Unmarshal in the past. See #11154. - der := []byte{ - 0x30, // SEQUENCE - 0x02, // two bytes long - 0xa0, // context-specific, tag 0 - 0x30, // 48 bytes long - } - - var result truncatedExplicitTagTest - if _, err := Unmarshal(der, &result); err == nil { - t.Error("Unmarshal returned without error") - } -} - -type invalidUTF8Test struct { - Str string `asn1:"utf8"` -} - -func TestUnmarshalInvalidUTF8(t *testing.T) { - data := []byte("0\x05\f\x03a\xc9c") - var result invalidUTF8Test - _, err := Unmarshal(data, &result) - - const expectedSubstring = "UTF" - if err == nil { - t.Fatal("Successfully unmarshaled invalid UTF-8 data") - } else if !strings.Contains(err.Error(), expectedSubstring) { - t.Fatalf("Expected error to mention %q but error was %q", expectedSubstring, err.Error()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/common.go b/llgo/third_party/gofrontend/libgo/go/encoding/asn1/common.go deleted file mode 100644 index ab85e0496ff85171ee05f531eb4559c3694be7c7..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/common.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package asn1 - -import ( - "reflect" - "strconv" - "strings" -) - -// ASN.1 objects have metadata preceding them: -// the tag: the type of the object -// a flag denoting if this object is compound or not -// the class type: the namespace of the tag -// the length of the object, in bytes - -// Here are some standard tags and classes - -const ( - tagBoolean = 1 - tagInteger = 2 - tagBitString = 3 - tagOctetString = 4 - tagOID = 6 - tagEnum = 10 - tagUTF8String = 12 - tagSequence = 16 - tagSet = 17 - tagPrintableString = 19 - tagT61String = 20 - tagIA5String = 22 - tagUTCTime = 23 - tagGeneralizedTime = 24 - tagGeneralString = 27 -) - -const ( - classUniversal = 0 - classApplication = 1 - classContextSpecific = 2 - classPrivate = 3 -) - -type tagAndLength struct { - class, tag, length int - isCompound bool -} - -// ASN.1 has IMPLICIT and EXPLICIT tags, which can be translated as "instead -// of" and "in addition to". When not specified, every primitive type has a -// default tag in the UNIVERSAL class. -// -// For example: a BIT STRING is tagged [UNIVERSAL 3] by default (although ASN.1 -// doesn't actually have a UNIVERSAL keyword). However, by saying [IMPLICIT -// CONTEXT-SPECIFIC 42], that means that the tag is replaced by another. -// -// On the other hand, if it said [EXPLICIT CONTEXT-SPECIFIC 10], then an -// /additional/ tag would wrap the default tag. This explicit tag will have the -// compound flag set. -// -// (This is used in order to remove ambiguity with optional elements.) -// -// You can layer EXPLICIT and IMPLICIT tags to an arbitrary depth, however we -// don't support that here. We support a single layer of EXPLICIT or IMPLICIT -// tagging with tag strings on the fields of a structure. - -// fieldParameters is the parsed representation of tag string from a structure field. -type fieldParameters struct { - optional bool // true iff the field is OPTIONAL - explicit bool // true iff an EXPLICIT tag is in use. - application bool // true iff an APPLICATION tag is in use. - defaultValue *int64 // a default value for INTEGER typed fields (maybe nil). - tag *int // the EXPLICIT or IMPLICIT tag (maybe nil). - stringType int // the string tag to use when marshaling. - timeType int // the time tag to use when marshaling. - set bool // true iff this should be encoded as a SET - omitEmpty bool // true iff this should be omitted if empty when marshaling. - - // Invariants: - // if explicit is set, tag is non-nil. -} - -// Given a tag string with the format specified in the package comment, -// parseFieldParameters will parse it into a fieldParameters structure, -// ignoring unknown parts of the string. -func parseFieldParameters(str string) (ret fieldParameters) { - for _, part := range strings.Split(str, ",") { - switch { - case part == "optional": - ret.optional = true - case part == "explicit": - ret.explicit = true - if ret.tag == nil { - ret.tag = new(int) - } - case part == "generalized": - ret.timeType = tagGeneralizedTime - case part == "utc": - ret.timeType = tagUTCTime - case part == "ia5": - ret.stringType = tagIA5String - case part == "printable": - ret.stringType = tagPrintableString - case part == "utf8": - ret.stringType = tagUTF8String - case strings.HasPrefix(part, "default:"): - i, err := strconv.ParseInt(part[8:], 10, 64) - if err == nil { - ret.defaultValue = new(int64) - *ret.defaultValue = i - } - case strings.HasPrefix(part, "tag:"): - i, err := strconv.Atoi(part[4:]) - if err == nil { - ret.tag = new(int) - *ret.tag = i - } - case part == "set": - ret.set = true - case part == "application": - ret.application = true - if ret.tag == nil { - ret.tag = new(int) - } - case part == "omitempty": - ret.omitEmpty = true - } - } - return -} - -// Given a reflected Go type, getUniversalType returns the default tag number -// and expected compound flag. -func getUniversalType(t reflect.Type) (tagNumber int, isCompound, ok bool) { - switch t { - case objectIdentifierType: - return tagOID, false, true - case bitStringType: - return tagBitString, false, true - case timeType: - return tagUTCTime, false, true - case enumeratedType: - return tagEnum, false, true - case bigIntType: - return tagInteger, false, true - } - switch t.Kind() { - case reflect.Bool: - return tagBoolean, false, true - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return tagInteger, false, true - case reflect.Struct: - return tagSequence, true, true - case reflect.Slice: - if t.Elem().Kind() == reflect.Uint8 { - return tagOctetString, false, true - } - if strings.HasSuffix(t.Name(), "SET") { - return tagSet, true, true - } - return tagSequence, true, true - case reflect.String: - return tagPrintableString, false, true - } - return 0, false, false -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal.go b/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal.go deleted file mode 100644 index 67a019db2d40677d68517e2d44330419f12e743b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal.go +++ /dev/null @@ -1,652 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package asn1 - -import ( - "bytes" - "errors" - "fmt" - "io" - "math/big" - "reflect" - "time" - "unicode/utf8" -) - -// A forkableWriter is an in-memory buffer that can be -// 'forked' to create new forkableWriters that bracket the -// original. After -// pre, post := w.fork() -// the overall sequence of bytes represented is logically w+pre+post. -type forkableWriter struct { - *bytes.Buffer - pre, post *forkableWriter -} - -func newForkableWriter() *forkableWriter { - return &forkableWriter{new(bytes.Buffer), nil, nil} -} - -func (f *forkableWriter) fork() (pre, post *forkableWriter) { - if f.pre != nil || f.post != nil { - panic("have already forked") - } - f.pre = newForkableWriter() - f.post = newForkableWriter() - return f.pre, f.post -} - -func (f *forkableWriter) Len() (l int) { - l += f.Buffer.Len() - if f.pre != nil { - l += f.pre.Len() - } - if f.post != nil { - l += f.post.Len() - } - return -} - -func (f *forkableWriter) writeTo(out io.Writer) (n int, err error) { - n, err = out.Write(f.Bytes()) - if err != nil { - return - } - - var nn int - - if f.pre != nil { - nn, err = f.pre.writeTo(out) - n += nn - if err != nil { - return - } - } - - if f.post != nil { - nn, err = f.post.writeTo(out) - n += nn - } - return -} - -func marshalBase128Int(out *forkableWriter, n int64) (err error) { - if n == 0 { - err = out.WriteByte(0) - return - } - - l := 0 - for i := n; i > 0; i >>= 7 { - l++ - } - - for i := l - 1; i >= 0; i-- { - o := byte(n >> uint(i*7)) - o &= 0x7f - if i != 0 { - o |= 0x80 - } - err = out.WriteByte(o) - if err != nil { - return - } - } - - return nil -} - -func marshalInt64(out *forkableWriter, i int64) (err error) { - n := int64Length(i) - - for ; n > 0; n-- { - err = out.WriteByte(byte(i >> uint((n-1)*8))) - if err != nil { - return - } - } - - return nil -} - -func int64Length(i int64) (numBytes int) { - numBytes = 1 - - for i > 127 { - numBytes++ - i >>= 8 - } - - for i < -128 { - numBytes++ - i >>= 8 - } - - return -} - -func marshalBigInt(out *forkableWriter, n *big.Int) (err error) { - if n.Sign() < 0 { - // A negative number has to be converted to two's-complement - // form. So we'll subtract 1 and invert. If the - // most-significant-bit isn't set then we'll need to pad the - // beginning with 0xff in order to keep the number negative. - nMinus1 := new(big.Int).Neg(n) - nMinus1.Sub(nMinus1, bigOne) - bytes := nMinus1.Bytes() - for i := range bytes { - bytes[i] ^= 0xff - } - if len(bytes) == 0 || bytes[0]&0x80 == 0 { - err = out.WriteByte(0xff) - if err != nil { - return - } - } - _, err = out.Write(bytes) - } else if n.Sign() == 0 { - // Zero is written as a single 0 zero rather than no bytes. - err = out.WriteByte(0x00) - } else { - bytes := n.Bytes() - if len(bytes) > 0 && bytes[0]&0x80 != 0 { - // We'll have to pad this with 0x00 in order to stop it - // looking like a negative number. - err = out.WriteByte(0) - if err != nil { - return - } - } - _, err = out.Write(bytes) - } - return -} - -func marshalLength(out *forkableWriter, i int) (err error) { - n := lengthLength(i) - - for ; n > 0; n-- { - err = out.WriteByte(byte(i >> uint((n-1)*8))) - if err != nil { - return - } - } - - return nil -} - -func lengthLength(i int) (numBytes int) { - numBytes = 1 - for i > 255 { - numBytes++ - i >>= 8 - } - return -} - -func marshalTagAndLength(out *forkableWriter, t tagAndLength) (err error) { - b := uint8(t.class) << 6 - if t.isCompound { - b |= 0x20 - } - if t.tag >= 31 { - b |= 0x1f - err = out.WriteByte(b) - if err != nil { - return - } - err = marshalBase128Int(out, int64(t.tag)) - if err != nil { - return - } - } else { - b |= uint8(t.tag) - err = out.WriteByte(b) - if err != nil { - return - } - } - - if t.length >= 128 { - l := lengthLength(t.length) - err = out.WriteByte(0x80 | byte(l)) - if err != nil { - return - } - err = marshalLength(out, t.length) - if err != nil { - return - } - } else { - err = out.WriteByte(byte(t.length)) - if err != nil { - return - } - } - - return nil -} - -func marshalBitString(out *forkableWriter, b BitString) (err error) { - paddingBits := byte((8 - b.BitLength%8) % 8) - err = out.WriteByte(paddingBits) - if err != nil { - return - } - _, err = out.Write(b.Bytes) - return -} - -func marshalObjectIdentifier(out *forkableWriter, oid []int) (err error) { - if len(oid) < 2 || oid[0] > 2 || (oid[0] < 2 && oid[1] >= 40) { - return StructuralError{"invalid object identifier"} - } - - err = marshalBase128Int(out, int64(oid[0]*40+oid[1])) - if err != nil { - return - } - for i := 2; i < len(oid); i++ { - err = marshalBase128Int(out, int64(oid[i])) - if err != nil { - return - } - } - - return -} - -func marshalPrintableString(out *forkableWriter, s string) (err error) { - b := []byte(s) - for _, c := range b { - if !isPrintable(c) { - return StructuralError{"PrintableString contains invalid character"} - } - } - - _, err = out.Write(b) - return -} - -func marshalIA5String(out *forkableWriter, s string) (err error) { - b := []byte(s) - for _, c := range b { - if c > 127 { - return StructuralError{"IA5String contains invalid character"} - } - } - - _, err = out.Write(b) - return -} - -func marshalUTF8String(out *forkableWriter, s string) (err error) { - _, err = out.Write([]byte(s)) - return -} - -func marshalTwoDigits(out *forkableWriter, v int) (err error) { - err = out.WriteByte(byte('0' + (v/10)%10)) - if err != nil { - return - } - return out.WriteByte(byte('0' + v%10)) -} - -func marshalFourDigits(out *forkableWriter, v int) (err error) { - var bytes [4]byte - for i := range bytes { - bytes[3-i] = '0' + byte(v%10) - v /= 10 - } - _, err = out.Write(bytes[:]) - return -} - -func outsideUTCRange(t time.Time) bool { - year := t.Year() - return year < 1950 || year >= 2050 -} - -func marshalUTCTime(out *forkableWriter, t time.Time) (err error) { - year := t.Year() - - switch { - case 1950 <= year && year < 2000: - err = marshalTwoDigits(out, int(year-1900)) - case 2000 <= year && year < 2050: - err = marshalTwoDigits(out, int(year-2000)) - default: - return StructuralError{"cannot represent time as UTCTime"} - } - if err != nil { - return - } - - return marshalTimeCommon(out, t) -} - -func marshalGeneralizedTime(out *forkableWriter, t time.Time) (err error) { - year := t.Year() - if year < 0 || year > 9999 { - return StructuralError{"cannot represent time as GeneralizedTime"} - } - if err = marshalFourDigits(out, year); err != nil { - return - } - - return marshalTimeCommon(out, t) -} - -func marshalTimeCommon(out *forkableWriter, t time.Time) (err error) { - _, month, day := t.Date() - - err = marshalTwoDigits(out, int(month)) - if err != nil { - return - } - - err = marshalTwoDigits(out, day) - if err != nil { - return - } - - hour, min, sec := t.Clock() - - err = marshalTwoDigits(out, hour) - if err != nil { - return - } - - err = marshalTwoDigits(out, min) - if err != nil { - return - } - - err = marshalTwoDigits(out, sec) - if err != nil { - return - } - - _, offset := t.Zone() - - switch { - case offset/60 == 0: - err = out.WriteByte('Z') - return - case offset > 0: - err = out.WriteByte('+') - case offset < 0: - err = out.WriteByte('-') - } - - if err != nil { - return - } - - offsetMinutes := offset / 60 - if offsetMinutes < 0 { - offsetMinutes = -offsetMinutes - } - - err = marshalTwoDigits(out, offsetMinutes/60) - if err != nil { - return - } - - err = marshalTwoDigits(out, offsetMinutes%60) - return -} - -func stripTagAndLength(in []byte) []byte { - _, offset, err := parseTagAndLength(in, 0) - if err != nil { - return in - } - return in[offset:] -} - -func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameters) (err error) { - switch value.Type() { - case flagType: - return nil - case timeType: - t := value.Interface().(time.Time) - if params.timeType == tagGeneralizedTime || outsideUTCRange(t) { - return marshalGeneralizedTime(out, t) - } else { - return marshalUTCTime(out, t) - } - case bitStringType: - return marshalBitString(out, value.Interface().(BitString)) - case objectIdentifierType: - return marshalObjectIdentifier(out, value.Interface().(ObjectIdentifier)) - case bigIntType: - return marshalBigInt(out, value.Interface().(*big.Int)) - } - - switch v := value; v.Kind() { - case reflect.Bool: - if v.Bool() { - return out.WriteByte(255) - } else { - return out.WriteByte(0) - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return marshalInt64(out, int64(v.Int())) - case reflect.Struct: - t := v.Type() - - startingField := 0 - - // If the first element of the structure is a non-empty - // RawContents, then we don't bother serializing the rest. - if t.NumField() > 0 && t.Field(0).Type == rawContentsType { - s := v.Field(0) - if s.Len() > 0 { - bytes := make([]byte, s.Len()) - for i := 0; i < s.Len(); i++ { - bytes[i] = uint8(s.Index(i).Uint()) - } - /* The RawContents will contain the tag and - * length fields but we'll also be writing - * those ourselves, so we strip them out of - * bytes */ - _, err = out.Write(stripTagAndLength(bytes)) - return - } else { - startingField = 1 - } - } - - for i := startingField; i < t.NumField(); i++ { - var pre *forkableWriter - pre, out = out.fork() - err = marshalField(pre, v.Field(i), parseFieldParameters(t.Field(i).Tag.Get("asn1"))) - if err != nil { - return - } - } - return - case reflect.Slice: - sliceType := v.Type() - if sliceType.Elem().Kind() == reflect.Uint8 { - bytes := make([]byte, v.Len()) - for i := 0; i < v.Len(); i++ { - bytes[i] = uint8(v.Index(i).Uint()) - } - _, err = out.Write(bytes) - return - } - - var fp fieldParameters - for i := 0; i < v.Len(); i++ { - var pre *forkableWriter - pre, out = out.fork() - err = marshalField(pre, v.Index(i), fp) - if err != nil { - return - } - } - return - case reflect.String: - switch params.stringType { - case tagIA5String: - return marshalIA5String(out, v.String()) - case tagPrintableString: - return marshalPrintableString(out, v.String()) - default: - return marshalUTF8String(out, v.String()) - } - } - - return StructuralError{"unknown Go type"} -} - -func marshalField(out *forkableWriter, v reflect.Value, params fieldParameters) (err error) { - // If the field is an interface{} then recurse into it. - if v.Kind() == reflect.Interface && v.Type().NumMethod() == 0 { - return marshalField(out, v.Elem(), params) - } - - if v.Kind() == reflect.Slice && v.Len() == 0 && params.omitEmpty { - return - } - - if params.optional && params.defaultValue != nil && canHaveDefaultValue(v.Kind()) { - defaultValue := reflect.New(v.Type()).Elem() - defaultValue.SetInt(*params.defaultValue) - - if reflect.DeepEqual(v.Interface(), defaultValue.Interface()) { - return - } - } - - // If no default value is given then the zero value for the type is - // assumed to be the default value. This isn't obviously the correct - // behaviour, but it's what Go has traditionally done. - if params.optional && params.defaultValue == nil { - if reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()).Interface()) { - return - } - } - - if v.Type() == rawValueType { - rv := v.Interface().(RawValue) - if len(rv.FullBytes) != 0 { - _, err = out.Write(rv.FullBytes) - } else { - err = marshalTagAndLength(out, tagAndLength{rv.Class, rv.Tag, len(rv.Bytes), rv.IsCompound}) - if err != nil { - return - } - _, err = out.Write(rv.Bytes) - } - return - } - - tag, isCompound, ok := getUniversalType(v.Type()) - if !ok { - err = StructuralError{fmt.Sprintf("unknown Go type: %v", v.Type())} - return - } - class := classUniversal - - if params.timeType != 0 && tag != tagUTCTime { - return StructuralError{"explicit time type given to non-time member"} - } - - if params.stringType != 0 && tag != tagPrintableString { - return StructuralError{"explicit string type given to non-string member"} - } - - switch tag { - case tagPrintableString: - if params.stringType == 0 { - // This is a string without an explicit string type. We'll use - // a PrintableString if the character set in the string is - // sufficiently limited, otherwise we'll use a UTF8String. - for _, r := range v.String() { - if r >= utf8.RuneSelf || !isPrintable(byte(r)) { - if !utf8.ValidString(v.String()) { - return errors.New("asn1: string not valid UTF-8") - } - tag = tagUTF8String - break - } - } - } else { - tag = params.stringType - } - case tagUTCTime: - if params.timeType == tagGeneralizedTime || outsideUTCRange(v.Interface().(time.Time)) { - tag = tagGeneralizedTime - } - } - - if params.set { - if tag != tagSequence { - return StructuralError{"non sequence tagged as set"} - } - tag = tagSet - } - - tags, body := out.fork() - - err = marshalBody(body, v, params) - if err != nil { - return - } - - bodyLen := body.Len() - - var explicitTag *forkableWriter - if params.explicit { - explicitTag, tags = tags.fork() - } - - if !params.explicit && params.tag != nil { - // implicit tag. - tag = *params.tag - class = classContextSpecific - } - - err = marshalTagAndLength(tags, tagAndLength{class, tag, bodyLen, isCompound}) - if err != nil { - return - } - - if params.explicit { - err = marshalTagAndLength(explicitTag, tagAndLength{ - class: classContextSpecific, - tag: *params.tag, - length: bodyLen + tags.Len(), - isCompound: true, - }) - } - - return nil -} - -// Marshal returns the ASN.1 encoding of val. -// -// In addition to the struct tags recognised by Unmarshal, the following can be -// used: -// -// ia5: causes strings to be marshaled as ASN.1, IA5 strings -// omitempty: causes empty slices to be skipped -// printable: causes strings to be marshaled as ASN.1, PrintableString strings. -// utf8: causes strings to be marshaled as ASN.1, UTF8 strings -func Marshal(val interface{}) ([]byte, error) { - var out bytes.Buffer - v := reflect.ValueOf(val) - f := newForkableWriter() - err := marshalField(f, v, fieldParameters{}) - if err != nil { - return nil, err - } - _, err = f.writeTo(&out) - return out.Bytes(), nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal_test.go deleted file mode 100644 index cdca8aa33638d8eba823a0a730ced38a239c85f3..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/asn1/marshal_test.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package asn1 - -import ( - "bytes" - "encoding/hex" - "math/big" - "testing" - "time" -) - -type intStruct struct { - A int -} - -type twoIntStruct struct { - A int - B int -} - -type bigIntStruct struct { - A *big.Int -} - -type nestedStruct struct { - A intStruct -} - -type rawContentsStruct struct { - Raw RawContent - A int -} - -type implicitTagTest struct { - A int `asn1:"implicit,tag:5"` -} - -type explicitTagTest struct { - A int `asn1:"explicit,tag:5"` -} - -type flagTest struct { - A Flag `asn1:"tag:0,optional"` -} - -type generalizedTimeTest struct { - A time.Time `asn1:"generalized"` -} - -type ia5StringTest struct { - A string `asn1:"ia5"` -} - -type printableStringTest struct { - A string `asn1:"printable"` -} - -type optionalRawValueTest struct { - A RawValue `asn1:"optional"` -} - -type omitEmptyTest struct { - A []string `asn1:"omitempty"` -} - -type defaultTest struct { - A int `asn1:"optional,default:1"` -} - -type testSET []int - -var PST = time.FixedZone("PST", -8*60*60) - -type marshalTest struct { - in interface{} - out string // hex encoded -} - -func farFuture() time.Time { - t, err := time.Parse(time.RFC3339, "2100-04-05T12:01:01Z") - if err != nil { - panic(err) - } - return t -} - -var marshalTests = []marshalTest{ - {10, "02010a"}, - {127, "02017f"}, - {128, "02020080"}, - {-128, "020180"}, - {-129, "0202ff7f"}, - {intStruct{64}, "3003020140"}, - {bigIntStruct{big.NewInt(0x123456)}, "30050203123456"}, - {twoIntStruct{64, 65}, "3006020140020141"}, - {nestedStruct{intStruct{127}}, "3005300302017f"}, - {[]byte{1, 2, 3}, "0403010203"}, - {implicitTagTest{64}, "3003850140"}, - {explicitTagTest{64}, "3005a503020140"}, - {flagTest{true}, "30028000"}, - {flagTest{false}, "3000"}, - {time.Unix(0, 0).UTC(), "170d3730303130313030303030305a"}, - {time.Unix(1258325776, 0).UTC(), "170d3039313131353232353631365a"}, - {time.Unix(1258325776, 0).In(PST), "17113039313131353134353631362d30383030"}, - {farFuture(), "180f32313030303430353132303130315a"}, - {generalizedTimeTest{time.Unix(1258325776, 0).UTC()}, "3011180f32303039313131353232353631365a"}, - {BitString{[]byte{0x80}, 1}, "03020780"}, - {BitString{[]byte{0x81, 0xf0}, 12}, "03030481f0"}, - {ObjectIdentifier([]int{1, 2, 3, 4}), "06032a0304"}, - {ObjectIdentifier([]int{1, 2, 840, 133549, 1, 1, 5}), "06092a864888932d010105"}, - {ObjectIdentifier([]int{2, 100, 3}), "0603813403"}, - {"test", "130474657374"}, - { - "" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // This is 127 times 'x' - "137f" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "78787878787878787878787878787878787878787878787878787878787878", - }, - { - "" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + - "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // This is 128 times 'x' - "138180" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "7878787878787878787878787878787878787878787878787878787878787878" + - "7878787878787878787878787878787878787878787878787878787878787878", - }, - {ia5StringTest{"test"}, "3006160474657374"}, - {optionalRawValueTest{}, "3000"}, - {printableStringTest{"test"}, "3006130474657374"}, - {printableStringTest{"test*"}, "30071305746573742a"}, - {rawContentsStruct{nil, 64}, "3003020140"}, - {rawContentsStruct{[]byte{0x30, 3, 1, 2, 3}, 64}, "3003010203"}, - {RawValue{Tag: 1, Class: 2, IsCompound: false, Bytes: []byte{1, 2, 3}}, "8103010203"}, - {testSET([]int{10}), "310302010a"}, - {omitEmptyTest{[]string{}}, "3000"}, - {omitEmptyTest{[]string{"1"}}, "30053003130131"}, - {"Σ", "0c02cea3"}, - {defaultTest{0}, "3003020100"}, - {defaultTest{1}, "3000"}, - {defaultTest{2}, "3003020102"}, -} - -func TestMarshal(t *testing.T) { - for i, test := range marshalTests { - data, err := Marshal(test.in) - if err != nil { - t.Errorf("#%d failed: %s", i, err) - } - out, _ := hex.DecodeString(test.out) - if !bytes.Equal(out, data) { - t.Errorf("#%d got: %x want %x\n\t%q\n\t%q", i, data, out, data, out) - - } - } -} - -func TestInvalidUTF8(t *testing.T) { - _, err := Marshal(string([]byte{0xff, 0xff})) - if err == nil { - t.Errorf("invalid UTF8 string was accepted") - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32.go b/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32.go deleted file mode 100644 index 5a9e86919d80035a69febd7cc94eeabbf98db037..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32.go +++ /dev/null @@ -1,426 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package base32 implements base32 encoding as specified by RFC 4648. -package base32 - -import ( - "bytes" - "io" - "strconv" - "strings" -) - -/* - * Encodings - */ - -// An Encoding is a radix 32 encoding/decoding scheme, defined by a -// 32-character alphabet. The most common is the "base32" encoding -// introduced for SASL GSSAPI and standardized in RFC 4648. -// The alternate "base32hex" encoding is used in DNSSEC. -type Encoding struct { - encode string - decodeMap [256]byte -} - -const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" -const encodeHex = "0123456789ABCDEFGHIJKLMNOPQRSTUV" - -// NewEncoding returns a new Encoding defined by the given alphabet, -// which must be a 32-byte string. -func NewEncoding(encoder string) *Encoding { - e := new(Encoding) - e.encode = encoder - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[encoder[i]] = byte(i) - } - return e -} - -// StdEncoding is the standard base32 encoding, as defined in -// RFC 4648. -var StdEncoding = NewEncoding(encodeStd) - -// HexEncoding is the ``Extended Hex Alphabet'' defined in RFC 4648. -// It is typically used in DNS. -var HexEncoding = NewEncoding(encodeHex) - -var removeNewlinesMapper = func(r rune) rune { - if r == '\r' || r == '\n' { - return -1 - } - return r -} - -/* - * Encoder - */ - -// Encode encodes src using the encoding enc, writing -// EncodedLen(len(src)) bytes to dst. -// -// The encoding pads the output to a multiple of 8 bytes, -// so Encode is not appropriate for use on individual blocks -// of a large data stream. Use NewEncoder() instead. -func (enc *Encoding) Encode(dst, src []byte) { - if len(src) == 0 { - return - } - - for len(src) > 0 { - var b0, b1, b2, b3, b4, b5, b6, b7 byte - - // Unpack 8x 5-bit source blocks into a 5 byte - // destination quantum - switch len(src) { - default: - b7 = src[4] & 0x1F - b6 = src[4] >> 5 - fallthrough - case 4: - b6 |= (src[3] << 3) & 0x1F - b5 = (src[3] >> 2) & 0x1F - b4 = src[3] >> 7 - fallthrough - case 3: - b4 |= (src[2] << 1) & 0x1F - b3 = (src[2] >> 4) & 0x1F - fallthrough - case 2: - b3 |= (src[1] << 4) & 0x1F - b2 = (src[1] >> 1) & 0x1F - b1 = (src[1] >> 6) & 0x1F - fallthrough - case 1: - b1 |= (src[0] << 2) & 0x1F - b0 = src[0] >> 3 - } - - // Encode 5-bit blocks using the base32 alphabet - dst[0] = enc.encode[b0] - dst[1] = enc.encode[b1] - dst[2] = enc.encode[b2] - dst[3] = enc.encode[b3] - dst[4] = enc.encode[b4] - dst[5] = enc.encode[b5] - dst[6] = enc.encode[b6] - dst[7] = enc.encode[b7] - - // Pad the final quantum - if len(src) < 5 { - dst[7] = '=' - if len(src) < 4 { - dst[6] = '=' - dst[5] = '=' - if len(src) < 3 { - dst[4] = '=' - if len(src) < 2 { - dst[3] = '=' - dst[2] = '=' - } - } - } - break - } - src = src[5:] - dst = dst[8:] - } -} - -// EncodeToString returns the base32 encoding of src. -func (enc *Encoding) EncodeToString(src []byte) string { - buf := make([]byte, enc.EncodedLen(len(src))) - enc.Encode(buf, src) - return string(buf) -} - -type encoder struct { - err error - enc *Encoding - w io.Writer - buf [5]byte // buffered data waiting to be encoded - nbuf int // number of bytes in buf - out [1024]byte // output buffer -} - -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - - // Leading fringe. - if e.nbuf > 0 { - var i int - for i = 0; i < len(p) && e.nbuf < 5; i++ { - e.buf[e.nbuf] = p[i] - e.nbuf++ - } - n += i - p = p[i:] - if e.nbuf < 5 { - return - } - e.enc.Encode(e.out[0:], e.buf[0:]) - if _, e.err = e.w.Write(e.out[0:8]); e.err != nil { - return n, e.err - } - e.nbuf = 0 - } - - // Large interior chunks. - for len(p) >= 5 { - nn := len(e.out) / 8 * 5 - if nn > len(p) { - nn = len(p) - nn -= nn % 5 - } - e.enc.Encode(e.out[0:], p[0:nn]) - if _, e.err = e.w.Write(e.out[0 : nn/5*8]); e.err != nil { - return n, e.err - } - n += nn - p = p[nn:] - } - - // Trailing fringe. - for i := 0; i < len(p); i++ { - e.buf[i] = p[i] - } - e.nbuf = len(p) - n += len(p) - return -} - -// Close flushes any pending output from the encoder. -// It is an error to call Write after calling Close. -func (e *encoder) Close() error { - // If there's anything left in the buffer, flush it out - if e.err == nil && e.nbuf > 0 { - e.enc.Encode(e.out[0:], e.buf[0:e.nbuf]) - e.nbuf = 0 - _, e.err = e.w.Write(e.out[0:8]) - } - return e.err -} - -// NewEncoder returns a new base32 stream encoder. Data written to -// the returned writer will be encoded using enc and then written to w. -// Base32 encodings operate in 5-byte blocks; when finished -// writing, the caller must Close the returned encoder to flush any -// partially written blocks. -func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser { - return &encoder{enc: enc, w: w} -} - -// EncodedLen returns the length in bytes of the base32 encoding -// of an input buffer of length n. -func (enc *Encoding) EncodedLen(n int) int { return (n + 4) / 5 * 8 } - -/* - * Decoder - */ - -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "illegal base32 data at input byte " + strconv.FormatInt(int64(e), 10) -} - -// decode is like Decode but returns an additional 'end' value, which -// indicates if end-of-message padding was encountered and thus any -// additional data is an error. This method assumes that src has been -// stripped of all supported whitespace ('\r' and '\n'). -func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { - olen := len(src) - for len(src) > 0 && !end { - // Decode quantum using the base32 alphabet - var dbuf [8]byte - dlen := 8 - - for j := 0; j < 8; { - if len(src) == 0 { - return n, false, CorruptInputError(olen - len(src) - j) - } - in := src[0] - src = src[1:] - if in == '=' && j >= 2 && len(src) < 8 { - // We've reached the end and there's padding - if len(src)+j < 8-1 { - // not enough padding - return n, false, CorruptInputError(olen) - } - for k := 0; k < 8-1-j; k++ { - if len(src) > k && src[k] != '=' { - // incorrect padding - return n, false, CorruptInputError(olen - len(src) + k - 1) - } - } - dlen, end = j, true - // 7, 5 and 2 are not valid padding lengths, and so 1, 3 and 6 are not - // valid dlen values. See RFC 4648 Section 6 "Base 32 Encoding" listing - // the five valid padding lengths, and Section 9 "Illustrations and - // Examples" for an illustration for how the 1st, 3rd and 6th base32 - // src bytes do not yield enough information to decode a dst byte. - if dlen == 1 || dlen == 3 || dlen == 6 { - return n, false, CorruptInputError(olen - len(src) - 1) - } - break - } - dbuf[j] = enc.decodeMap[in] - if dbuf[j] == 0xFF { - return n, false, CorruptInputError(olen - len(src) - 1) - } - j++ - } - - // Pack 8x 5-bit source blocks into 5 byte destination - // quantum - switch dlen { - case 8: - dst[4] = dbuf[6]<<5 | dbuf[7] - fallthrough - case 7: - dst[3] = dbuf[4]<<7 | dbuf[5]<<2 | dbuf[6]>>3 - fallthrough - case 5: - dst[2] = dbuf[3]<<4 | dbuf[4]>>1 - fallthrough - case 4: - dst[1] = dbuf[1]<<6 | dbuf[2]<<1 | dbuf[3]>>4 - fallthrough - case 2: - dst[0] = dbuf[0]<<3 | dbuf[1]>>2 - } - dst = dst[5:] - switch dlen { - case 2: - n += 1 - case 4: - n += 2 - case 5: - n += 3 - case 7: - n += 4 - case 8: - n += 5 - } - } - return n, end, nil -} - -// Decode decodes src using the encoding enc. It writes at most -// DecodedLen(len(src)) bytes to dst and returns the number of bytes -// written. If src contains invalid base32 data, it will return the -// number of bytes successfully written and CorruptInputError. -// New line characters (\r and \n) are ignored. -func (enc *Encoding) Decode(dst, src []byte) (n int, err error) { - src = bytes.Map(removeNewlinesMapper, src) - n, _, err = enc.decode(dst, src) - return -} - -// DecodeString returns the bytes represented by the base32 string s. -func (enc *Encoding) DecodeString(s string) ([]byte, error) { - s = strings.Map(removeNewlinesMapper, s) - dbuf := make([]byte, enc.DecodedLen(len(s))) - n, _, err := enc.decode(dbuf, []byte(s)) - return dbuf[:n], err -} - -type decoder struct { - err error - enc *Encoding - r io.Reader - end bool // saw end of message - buf [1024]byte // leftover input - nbuf int - out []byte // leftover decoded output - outbuf [1024 / 8 * 5]byte -} - -func (d *decoder) Read(p []byte) (n int, err error) { - if d.err != nil { - return 0, d.err - } - - // Use leftover decoded output from last read. - if len(d.out) > 0 { - n = copy(p, d.out) - d.out = d.out[n:] - return n, nil - } - - // Read a chunk. - nn := len(p) / 5 * 8 - if nn < 8 { - nn = 8 - } - if nn > len(d.buf) { - nn = len(d.buf) - } - nn, d.err = io.ReadAtLeast(d.r, d.buf[d.nbuf:nn], 8-d.nbuf) - d.nbuf += nn - if d.nbuf < 8 { - return 0, d.err - } - - // Decode chunk into p, or d.out and then p if p is too small. - nr := d.nbuf / 8 * 8 - nw := d.nbuf / 8 * 5 - if nw > len(p) { - nw, d.end, d.err = d.enc.decode(d.outbuf[0:], d.buf[0:nr]) - d.out = d.outbuf[0:nw] - n = copy(p, d.out) - d.out = d.out[n:] - } else { - n, d.end, d.err = d.enc.decode(p, d.buf[0:nr]) - } - d.nbuf -= nr - for i := 0; i < d.nbuf; i++ { - d.buf[i] = d.buf[i+nr] - } - - if d.err == nil { - d.err = err - } - return n, d.err -} - -type newlineFilteringReader struct { - wrapped io.Reader -} - -func (r *newlineFilteringReader) Read(p []byte) (int, error) { - n, err := r.wrapped.Read(p) - for n > 0 { - offset := 0 - for i, b := range p[0:n] { - if b != '\r' && b != '\n' { - if i != offset { - p[offset] = b - } - offset++ - } - } - if offset > 0 { - return offset, err - } - // Previous buffer entirely whitespace, read again - n, err = r.wrapped.Read(p) - } - return n, err -} - -// NewDecoder constructs a new base32 stream decoder. -func NewDecoder(enc *Encoding, r io.Reader) io.Reader { - return &decoder{enc: enc, r: &newlineFilteringReader{r}} -} - -// DecodedLen returns the maximum length in bytes of the decoded data -// corresponding to n bytes of base32-encoded data. -func (enc *Encoding) DecodedLen(n int) int { return n / 8 * 5 } diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32_test.go deleted file mode 100644 index 5a68f06e1c94bc12e86fb2f91035fe3c1b3d4435..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/base32/base32_test.go +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package base32 - -import ( - "bytes" - "io" - "io/ioutil" - "strings" - "testing" -) - -type testpair struct { - decoded, encoded string -} - -var pairs = []testpair{ - // RFC 4648 examples - {"", ""}, - {"f", "MY======"}, - {"fo", "MZXQ===="}, - {"foo", "MZXW6==="}, - {"foob", "MZXW6YQ="}, - {"fooba", "MZXW6YTB"}, - {"foobar", "MZXW6YTBOI======"}, - - // Wikipedia examples, converted to base32 - {"sure.", "ON2XEZJO"}, - {"sure", "ON2XEZI="}, - {"sur", "ON2XE==="}, - {"su", "ON2Q===="}, - {"leasure.", "NRSWC43VOJSS4==="}, - {"easure.", "MVQXG5LSMUXA===="}, - {"asure.", "MFZXK4TFFY======"}, - {"sure.", "ON2XEZJO"}, -} - -var bigtest = testpair{ - "Twas brillig, and the slithy toves", - "KR3WC4ZAMJZGS3DMNFTSYIDBNZSCA5DIMUQHG3DJORUHSIDUN53GK4Y=", -} - -func testEqual(t *testing.T, msg string, args ...interface{}) bool { - if args[len(args)-2] != args[len(args)-1] { - t.Errorf(msg, args...) - return false - } - return true -} - -func TestEncode(t *testing.T) { - for _, p := range pairs { - got := StdEncoding.EncodeToString([]byte(p.decoded)) - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, got, p.encoded) - } -} - -func TestEncoder(t *testing.T) { - for _, p := range pairs { - bb := &bytes.Buffer{} - encoder := NewEncoder(StdEncoding, bb) - encoder.Write([]byte(p.decoded)) - encoder.Close() - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, bb.String(), p.encoded) - } -} - -func TestEncoderBuffering(t *testing.T) { - input := []byte(bigtest.decoded) - for bs := 1; bs <= 12; bs++ { - bb := &bytes.Buffer{} - encoder := NewEncoder(StdEncoding, bb) - for pos := 0; pos < len(input); pos += bs { - end := pos + bs - if end > len(input) { - end = len(input) - } - n, err := encoder.Write(input[pos:end]) - testEqual(t, "Write(%q) gave error %v, want %v", input[pos:end], err, error(nil)) - testEqual(t, "Write(%q) gave length %v, want %v", input[pos:end], n, end-pos) - } - err := encoder.Close() - testEqual(t, "Close gave error %v, want %v", err, error(nil)) - testEqual(t, "Encoding/%d of %q = %q, want %q", bs, bigtest.decoded, bb.String(), bigtest.encoded) - } -} - -func TestDecode(t *testing.T) { - for _, p := range pairs { - dbuf := make([]byte, StdEncoding.DecodedLen(len(p.encoded))) - count, end, err := StdEncoding.decode(dbuf, []byte(p.encoded)) - testEqual(t, "Decode(%q) = error %v, want %v", p.encoded, err, error(nil)) - testEqual(t, "Decode(%q) = length %v, want %v", p.encoded, count, len(p.decoded)) - if len(p.encoded) > 0 { - testEqual(t, "Decode(%q) = end %v, want %v", p.encoded, end, (p.encoded[len(p.encoded)-1] == '=')) - } - testEqual(t, "Decode(%q) = %q, want %q", p.encoded, - string(dbuf[0:count]), - p.decoded) - - dbuf, err = StdEncoding.DecodeString(p.encoded) - testEqual(t, "DecodeString(%q) = error %v, want %v", p.encoded, err, error(nil)) - testEqual(t, "DecodeString(%q) = %q, want %q", p.encoded, string(dbuf), p.decoded) - } -} - -func TestDecoder(t *testing.T) { - for _, p := range pairs { - decoder := NewDecoder(StdEncoding, strings.NewReader(p.encoded)) - dbuf := make([]byte, StdEncoding.DecodedLen(len(p.encoded))) - count, err := decoder.Read(dbuf) - if err != nil && err != io.EOF { - t.Fatal("Read failed", err) - } - testEqual(t, "Read from %q = length %v, want %v", p.encoded, count, len(p.decoded)) - testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf[0:count]), p.decoded) - if err != io.EOF { - count, err = decoder.Read(dbuf) - } - testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF) - } -} - -func TestDecoderBuffering(t *testing.T) { - for bs := 1; bs <= 12; bs++ { - decoder := NewDecoder(StdEncoding, strings.NewReader(bigtest.encoded)) - buf := make([]byte, len(bigtest.decoded)+12) - var total int - for total = 0; total < len(bigtest.decoded); { - n, err := decoder.Read(buf[total : total+bs]) - testEqual(t, "Read from %q at pos %d = %d, %v, want _, %v", bigtest.encoded, total, n, err, error(nil)) - total += n - } - testEqual(t, "Decoding/%d of %q = %q, want %q", bs, bigtest.encoded, string(buf[0:total]), bigtest.decoded) - } -} - -func TestDecodeCorrupt(t *testing.T) { - testCases := []struct { - input string - offset int // -1 means no corruption. - }{ - {"", -1}, - {"!!!!", 0}, - {"x===", 0}, - {"AA=A====", 2}, - {"AAA=AAAA", 3}, - {"MMMMMMMMM", 8}, - {"MMMMMM", 0}, - {"A=", 1}, - {"AA=", 3}, - {"AA==", 4}, - {"AA===", 5}, - {"AAAA=", 5}, - {"AAAA==", 6}, - {"AAAAA=", 6}, - {"AAAAA==", 7}, - {"A=======", 1}, - {"AA======", -1}, - {"AAA=====", 3}, - {"AAAA====", -1}, - {"AAAAA===", -1}, - {"AAAAAA==", 6}, - {"AAAAAAA=", -1}, - {"AAAAAAAA", -1}, - } - for _, tc := range testCases { - dbuf := make([]byte, StdEncoding.DecodedLen(len(tc.input))) - _, err := StdEncoding.Decode(dbuf, []byte(tc.input)) - if tc.offset == -1 { - if err != nil { - t.Error("Decoder wrongly detected coruption in", tc.input) - } - continue - } - switch err := err.(type) { - case CorruptInputError: - testEqual(t, "Corruption in %q at offset %v, want %v", tc.input, int(err), tc.offset) - default: - t.Error("Decoder failed to detect corruption in", tc) - } - } -} - -func TestBig(t *testing.T) { - n := 3*1000 + 1 - raw := make([]byte, n) - const alpha = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - for i := 0; i < n; i++ { - raw[i] = alpha[i%len(alpha)] - } - encoded := new(bytes.Buffer) - w := NewEncoder(StdEncoding, encoded) - nn, err := w.Write(raw) - if nn != n || err != nil { - t.Fatalf("Encoder.Write(raw) = %d, %v want %d, nil", nn, err, n) - } - err = w.Close() - if err != nil { - t.Fatalf("Encoder.Close() = %v want nil", err) - } - decoded, err := ioutil.ReadAll(NewDecoder(StdEncoding, encoded)) - if err != nil { - t.Fatalf("ioutil.ReadAll(NewDecoder(...)): %v", err) - } - - if !bytes.Equal(raw, decoded) { - var i int - for i = 0; i < len(decoded) && i < len(raw); i++ { - if decoded[i] != raw[i] { - break - } - } - t.Errorf("Decode(Encode(%d-byte string)) failed at offset %d", n, i) - } -} - -func testStringEncoding(t *testing.T, expected string, examples []string) { - for _, e := range examples { - buf, err := StdEncoding.DecodeString(e) - if err != nil { - t.Errorf("Decode(%q) failed: %v", e, err) - continue - } - if s := string(buf); s != expected { - t.Errorf("Decode(%q) = %q, want %q", e, s, expected) - } - } -} - -func TestNewLineCharacters(t *testing.T) { - // Each of these should decode to the string "sure", without errors. - examples := []string{ - "ON2XEZI=", - "ON2XEZI=\r", - "ON2XEZI=\n", - "ON2XEZI=\r\n", - "ON2XEZ\r\nI=", - "ON2X\rEZ\nI=", - "ON2X\nEZ\rI=", - "ON2XEZ\nI=", - "ON2XEZI\n=", - } - testStringEncoding(t, "sure", examples) - - // Each of these should decode to the string "foobar", without errors. - examples = []string{ - "MZXW6YTBOI======", - "MZXW6YTBOI=\r\n=====", - } - testStringEncoding(t, "foobar", examples) -} - -func TestDecoderIssue4779(t *testing.T) { - encoded := `JRXXEZLNEBUXA43VNUQGI33MN5ZCA43JOQQGC3LFOQWCAY3PNZZWKY3UMV2HK4 -RAMFSGS4DJONUWG2LOM4QGK3DJOQWCA43FMQQGI3YKMVUXK43NN5SCA5DFNVYG64RANFXGG2LENFSH -K3TUEB2XIIDMMFRG64TFEBSXIIDEN5WG64TFEBWWCZ3OMEQGC3DJOF2WCLRAKV2CAZLONFWQUYLEEB -WWS3TJNUQHMZLONFQW2LBAOF2WS4ZANZXXG5DSOVSCAZLYMVZGG2LUMF2GS33OEB2WY3DBNVRW6IDM -MFRG64TJOMQG42LTNEQHK5AKMFWGS4LVNFYCAZLYEBSWCIDDN5WW233EN4QGG33OONSXC5LBOQXCAR -DVNFZSAYLVORSSA2LSOVZGKIDEN5WG64RANFXAU4TFOBZGK2DFNZSGK4TJOQQGS3RAOZXWY5LQORQX -IZJAOZSWY2LUEBSXG43FEBRWS3DMOVWSAZDPNRXXEZJAMV2SAZTVM5UWC5BANZ2WY3DBBJYGC4TJMF -2HK4ROEBCXQY3FOB2GK5LSEBZWS3TUEBXWGY3BMVRWC5BAMN2XA2LEMF2GC5BANZXW4IDQOJXWSZDF -NZ2CYIDTOVXHIIDJNYFGG5LMOBQSA4LVNEQG6ZTGNFRWSYJAMRSXGZLSOVXHIIDNN5WGY2LUEBQW42 -LNEBUWIIDFON2CA3DBMJXXE5LNFY== -====` - encodedShort := strings.Replace(encoded, "\n", "", -1) - - dec := NewDecoder(StdEncoding, strings.NewReader(encoded)) - res1, err := ioutil.ReadAll(dec) - if err != nil { - t.Errorf("ReadAll failed: %v", err) - } - - dec = NewDecoder(StdEncoding, strings.NewReader(encodedShort)) - var res2 []byte - res2, err = ioutil.ReadAll(dec) - if err != nil { - t.Errorf("ReadAll failed: %v", err) - } - - if !bytes.Equal(res1, res2) { - t.Error("Decoded results not equal") - } -} - -func BenchmarkEncodeToString(b *testing.B) { - data := make([]byte, 8192) - b.SetBytes(int64(len(data))) - for i := 0; i < b.N; i++ { - StdEncoding.EncodeToString(data) - } -} - -func BenchmarkDecodeString(b *testing.B) { - data := StdEncoding.EncodeToString(make([]byte, 8192)) - b.SetBytes(int64(len(data))) - for i := 0; i < b.N; i++ { - StdEncoding.DecodeString(data) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64.go b/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64.go deleted file mode 100644 index 3302fb4a7426924d2f9b6f529184193f5bb19df9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64.go +++ /dev/null @@ -1,448 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package base64 implements base64 encoding as specified by RFC 4648. -package base64 - -import ( - "io" - "strconv" -) - -/* - * Encodings - */ - -// An Encoding is a radix 64 encoding/decoding scheme, defined by a -// 64-character alphabet. The most common encoding is the "base64" -// encoding defined in RFC 4648 and used in MIME (RFC 2045) and PEM -// (RFC 1421). RFC 4648 also defines an alternate encoding, which is -// the standard encoding with - and _ substituted for + and /. -type Encoding struct { - encode [64]byte - decodeMap [256]byte - padChar rune -} - -const ( - StdPadding rune = '=' // Standard padding character - NoPadding rune = -1 // No padding -) - -const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" -const encodeURL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" - -// NewEncoding returns a new padded Encoding defined by the given alphabet, -// which must be a 64-byte string. -// The resulting Encoding uses the default padding character ('='), -// which may be changed or disabled via WithPadding. -func NewEncoding(encoder string) *Encoding { - if len(encoder) != 64 { - panic("encoding alphabet is not 64-bytes long") - } - - e := new(Encoding) - e.padChar = StdPadding - copy(e.encode[:], encoder) - - for i := 0; i < len(e.decodeMap); i++ { - e.decodeMap[i] = 0xFF - } - for i := 0; i < len(encoder); i++ { - e.decodeMap[encoder[i]] = byte(i) - } - return e -} - -// WithPadding creates a new encoding identical to enc except -// with a specified padding character, or NoPadding to disable padding. -func (enc Encoding) WithPadding(padding rune) *Encoding { - enc.padChar = padding - return &enc -} - -// StdEncoding is the standard base64 encoding, as defined in -// RFC 4648. -var StdEncoding = NewEncoding(encodeStd) - -// URLEncoding is the alternate base64 encoding defined in RFC 4648. -// It is typically used in URLs and file names. -var URLEncoding = NewEncoding(encodeURL) - -// RawStdEncoding is the standard raw, unpadded base64 encoding, -// as defined in RFC 4648 section 3.2. -// This is the same as StdEncoding but omits padding characters. -var RawStdEncoding = StdEncoding.WithPadding(NoPadding) - -// URLEncoding is the unpadded alternate base64 encoding defined in RFC 4648. -// It is typically used in URLs and file names. -// This is the same as URLEncoding but omits padding characters. -var RawURLEncoding = URLEncoding.WithPadding(NoPadding) - -/* - * Encoder - */ - -// Encode encodes src using the encoding enc, writing -// EncodedLen(len(src)) bytes to dst. -// -// The encoding pads the output to a multiple of 4 bytes, -// so Encode is not appropriate for use on individual blocks -// of a large data stream. Use NewEncoder() instead. -func (enc *Encoding) Encode(dst, src []byte) { - if len(src) == 0 { - return - } - - di, si := 0, 0 - n := (len(src) / 3) * 3 - for si < n { - // Convert 3x 8bit source bytes into 4 bytes - val := uint(src[si+0])<<16 | uint(src[si+1])<<8 | uint(src[si+2]) - - dst[di+0] = enc.encode[val>>18&0x3F] - dst[di+1] = enc.encode[val>>12&0x3F] - dst[di+2] = enc.encode[val>>6&0x3F] - dst[di+3] = enc.encode[val&0x3F] - - si += 3 - di += 4 - } - - remain := len(src) - si - if remain == 0 { - return - } - // Add the remaining small block - val := uint(src[si+0]) << 16 - if remain == 2 { - val |= uint(src[si+1]) << 8 - } - - dst[di+0] = enc.encode[val>>18&0x3F] - dst[di+1] = enc.encode[val>>12&0x3F] - - switch remain { - case 2: - dst[di+2] = enc.encode[val>>6&0x3F] - if enc.padChar != NoPadding { - dst[di+3] = byte(enc.padChar) - } - case 1: - if enc.padChar != NoPadding { - dst[di+2] = byte(enc.padChar) - dst[di+3] = byte(enc.padChar) - } - } -} - -// EncodeToString returns the base64 encoding of src. -func (enc *Encoding) EncodeToString(src []byte) string { - buf := make([]byte, enc.EncodedLen(len(src))) - enc.Encode(buf, src) - return string(buf) -} - -type encoder struct { - err error - enc *Encoding - w io.Writer - buf [3]byte // buffered data waiting to be encoded - nbuf int // number of bytes in buf - out [1024]byte // output buffer -} - -func (e *encoder) Write(p []byte) (n int, err error) { - if e.err != nil { - return 0, e.err - } - - // Leading fringe. - if e.nbuf > 0 { - var i int - for i = 0; i < len(p) && e.nbuf < 3; i++ { - e.buf[e.nbuf] = p[i] - e.nbuf++ - } - n += i - p = p[i:] - if e.nbuf < 3 { - return - } - e.enc.Encode(e.out[:], e.buf[:]) - if _, e.err = e.w.Write(e.out[:4]); e.err != nil { - return n, e.err - } - e.nbuf = 0 - } - - // Large interior chunks. - for len(p) >= 3 { - nn := len(e.out) / 4 * 3 - if nn > len(p) { - nn = len(p) - nn -= nn % 3 - } - e.enc.Encode(e.out[:], p[:nn]) - if _, e.err = e.w.Write(e.out[0 : nn/3*4]); e.err != nil { - return n, e.err - } - n += nn - p = p[nn:] - } - - // Trailing fringe. - for i := 0; i < len(p); i++ { - e.buf[i] = p[i] - } - e.nbuf = len(p) - n += len(p) - return -} - -// Close flushes any pending output from the encoder. -// It is an error to call Write after calling Close. -func (e *encoder) Close() error { - // If there's anything left in the buffer, flush it out - if e.err == nil && e.nbuf > 0 { - e.enc.Encode(e.out[:], e.buf[:e.nbuf]) - _, e.err = e.w.Write(e.out[:e.enc.EncodedLen(e.nbuf)]) - e.nbuf = 0 - } - return e.err -} - -// NewEncoder returns a new base64 stream encoder. Data written to -// the returned writer will be encoded using enc and then written to w. -// Base64 encodings operate in 4-byte blocks; when finished -// writing, the caller must Close the returned encoder to flush any -// partially written blocks. -func NewEncoder(enc *Encoding, w io.Writer) io.WriteCloser { - return &encoder{enc: enc, w: w} -} - -// EncodedLen returns the length in bytes of the base64 encoding -// of an input buffer of length n. -func (enc *Encoding) EncodedLen(n int) int { - if enc.padChar == NoPadding { - return (n*8 + 5) / 6 // minimum # chars at 6 bits per char - } - return (n + 2) / 3 * 4 // minimum # 4-char quanta, 3 bytes each -} - -/* - * Decoder - */ - -type CorruptInputError int64 - -func (e CorruptInputError) Error() string { - return "illegal base64 data at input byte " + strconv.FormatInt(int64(e), 10) -} - -// decode is like Decode but returns an additional 'end' value, which -// indicates if end-of-message padding or a partial quantum was encountered -// and thus any additional data is an error. -func (enc *Encoding) decode(dst, src []byte) (n int, end bool, err error) { - si := 0 - - // skip over newlines - for si < len(src) && (src[si] == '\n' || src[si] == '\r') { - si++ - } - - for si < len(src) && !end { - // Decode quantum using the base64 alphabet - var dbuf [4]byte - dinc, dlen := 3, 4 - - for j := range dbuf { - if len(src) == si { - if enc.padChar != NoPadding || j < 2 { - return n, false, CorruptInputError(si - j) - } - dinc, dlen, end = j-1, j, true - break - } - in := src[si] - - si++ - // skip over newlines - for si < len(src) && (src[si] == '\n' || src[si] == '\r') { - si++ - } - - if rune(in) == enc.padChar { - // We've reached the end and there's padding - switch j { - case 0, 1: - // incorrect padding - return n, false, CorruptInputError(si - 1) - case 2: - // "==" is expected, the first "=" is already consumed. - if si == len(src) { - // not enough padding - return n, false, CorruptInputError(len(src)) - } - if rune(src[si]) != enc.padChar { - // incorrect padding - return n, false, CorruptInputError(si - 1) - } - - si++ - // skip over newlines - for si < len(src) && (src[si] == '\n' || src[si] == '\r') { - si++ - } - } - if si < len(src) { - // trailing garbage - err = CorruptInputError(si) - } - dinc, dlen, end = 3, j, true - break - } - dbuf[j] = enc.decodeMap[in] - if dbuf[j] == 0xFF { - return n, false, CorruptInputError(si - 1) - } - } - - // Convert 4x 6bit source bytes into 3 bytes - val := uint(dbuf[0])<<18 | uint(dbuf[1])<<12 | uint(dbuf[2])<<6 | uint(dbuf[3]) - switch dlen { - case 4: - dst[2] = byte(val >> 0) - fallthrough - case 3: - dst[1] = byte(val >> 8) - fallthrough - case 2: - dst[0] = byte(val >> 16) - } - dst = dst[dinc:] - n += dlen - 1 - } - - return n, end, err -} - -// Decode decodes src using the encoding enc. It writes at most -// DecodedLen(len(src)) bytes to dst and returns the number of bytes -// written. If src contains invalid base64 data, it will return the -// number of bytes successfully written and CorruptInputError. -// New line characters (\r and \n) are ignored. -func (enc *Encoding) Decode(dst, src []byte) (n int, err error) { - n, _, err = enc.decode(dst, src) - return -} - -// DecodeString returns the bytes represented by the base64 string s. -func (enc *Encoding) DecodeString(s string) ([]byte, error) { - dbuf := make([]byte, enc.DecodedLen(len(s))) - n, _, err := enc.decode(dbuf, []byte(s)) - return dbuf[:n], err -} - -type decoder struct { - err error - enc *Encoding - r io.Reader - end bool // saw end of message - buf [1024]byte // leftover input - nbuf int - out []byte // leftover decoded output - outbuf [1024 / 4 * 3]byte -} - -func (d *decoder) Read(p []byte) (n int, err error) { - if d.err != nil { - return 0, d.err - } - - // Use leftover decoded output from last read. - if len(d.out) > 0 { - n = copy(p, d.out) - d.out = d.out[n:] - return n, nil - } - - // This code assumes that d.r strips supported whitespace ('\r' and '\n'). - - // Read a chunk. - nn := len(p) / 3 * 4 - if nn < 4 { - nn = 4 - } - if nn > len(d.buf) { - nn = len(d.buf) - } - nn, d.err = io.ReadAtLeast(d.r, d.buf[d.nbuf:nn], 4-d.nbuf) - d.nbuf += nn - if d.err != nil || d.nbuf < 4 { - return 0, d.err - } - - // Decode chunk into p, or d.out and then p if p is too small. - nr := d.nbuf / 4 * 4 - nw := d.nbuf / 4 * 3 - if nw > len(p) { - nw, d.end, d.err = d.enc.decode(d.outbuf[:], d.buf[:nr]) - d.out = d.outbuf[:nw] - n = copy(p, d.out) - d.out = d.out[n:] - } else { - n, d.end, d.err = d.enc.decode(p, d.buf[:nr]) - } - d.nbuf -= nr - for i := 0; i < d.nbuf; i++ { - d.buf[i] = d.buf[i+nr] - } - - if d.err == nil { - d.err = err - } - return n, d.err -} - -type newlineFilteringReader struct { - wrapped io.Reader -} - -func (r *newlineFilteringReader) Read(p []byte) (int, error) { - n, err := r.wrapped.Read(p) - for n > 0 { - offset := 0 - for i, b := range p[:n] { - if b != '\r' && b != '\n' { - if i != offset { - p[offset] = b - } - offset++ - } - } - if offset > 0 { - return offset, err - } - // Previous buffer entirely whitespace, read again - n, err = r.wrapped.Read(p) - } - return n, err -} - -// NewDecoder constructs a new base64 stream decoder. -func NewDecoder(enc *Encoding, r io.Reader) io.Reader { - return &decoder{enc: enc, r: &newlineFilteringReader{r}} -} - -// DecodedLen returns the maximum length in bytes of the decoded data -// corresponding to n bytes of base64-encoded data. -func (enc *Encoding) DecodedLen(n int) int { - if enc.padChar == NoPadding { - // Unpadded data may end with partial block of 2-3 characters. - return (n*6 + 7) / 8 - } - // Padded base64 should always be a multiple of 4 characters in length. - return n / 4 * 3 -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64_test.go deleted file mode 100644 index d144b96821f9bf614e5f1e3ec2a9a0ddc9d144be..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/base64/base64_test.go +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package base64 - -import ( - "bytes" - "errors" - "io" - "io/ioutil" - "reflect" - "strings" - "testing" - "time" -) - -type testpair struct { - decoded, encoded string -} - -var pairs = []testpair{ - // RFC 3548 examples - {"\x14\xfb\x9c\x03\xd9\x7e", "FPucA9l+"}, - {"\x14\xfb\x9c\x03\xd9", "FPucA9k="}, - {"\x14\xfb\x9c\x03", "FPucAw=="}, - - // RFC 4648 examples - {"", ""}, - {"f", "Zg=="}, - {"fo", "Zm8="}, - {"foo", "Zm9v"}, - {"foob", "Zm9vYg=="}, - {"fooba", "Zm9vYmE="}, - {"foobar", "Zm9vYmFy"}, - - // Wikipedia examples - {"sure.", "c3VyZS4="}, - {"sure", "c3VyZQ=="}, - {"sur", "c3Vy"}, - {"su", "c3U="}, - {"leasure.", "bGVhc3VyZS4="}, - {"easure.", "ZWFzdXJlLg=="}, - {"asure.", "YXN1cmUu"}, - {"sure.", "c3VyZS4="}, -} - -// Do nothing to a reference base64 string (leave in standard format) -func stdRef(ref string) string { - return ref -} - -// Convert a reference string to URL-encoding -func urlRef(ref string) string { - ref = strings.Replace(ref, "+", "-", -1) - ref = strings.Replace(ref, "/", "_", -1) - return ref -} - -// Convert a reference string to raw, unpadded format -func rawRef(ref string) string { - return strings.TrimRight(ref, "=") -} - -// Both URL and unpadding conversions -func rawUrlRef(ref string) string { - return rawRef(urlRef(ref)) -} - -// A nonstandard encoding with a funny padding character, for testing -var funnyEncoding = NewEncoding(encodeStd).WithPadding(rune('@')) - -func funnyRef(ref string) string { - return strings.Replace(ref, "=", "@", -1) -} - -type encodingTest struct { - enc *Encoding // Encoding to test - conv func(string) string // Reference string converter -} - -var encodingTests = []encodingTest{ - encodingTest{StdEncoding, stdRef}, - encodingTest{URLEncoding, urlRef}, - encodingTest{RawStdEncoding, rawRef}, - encodingTest{RawURLEncoding, rawUrlRef}, - encodingTest{funnyEncoding, funnyRef}, -} - -var bigtest = testpair{ - "Twas brillig, and the slithy toves", - "VHdhcyBicmlsbGlnLCBhbmQgdGhlIHNsaXRoeSB0b3Zlcw==", -} - -func testEqual(t *testing.T, msg string, args ...interface{}) bool { - if args[len(args)-2] != args[len(args)-1] { - t.Errorf(msg, args...) - return false - } - return true -} - -func TestEncode(t *testing.T) { - for _, p := range pairs { - for _, tt := range encodingTests { - got := tt.enc.EncodeToString([]byte(p.decoded)) - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, - got, tt.conv(p.encoded)) - } - } -} - -func TestEncoder(t *testing.T) { - for _, p := range pairs { - bb := &bytes.Buffer{} - encoder := NewEncoder(StdEncoding, bb) - encoder.Write([]byte(p.decoded)) - encoder.Close() - testEqual(t, "Encode(%q) = %q, want %q", p.decoded, bb.String(), p.encoded) - } -} - -func TestEncoderBuffering(t *testing.T) { - input := []byte(bigtest.decoded) - for bs := 1; bs <= 12; bs++ { - bb := &bytes.Buffer{} - encoder := NewEncoder(StdEncoding, bb) - for pos := 0; pos < len(input); pos += bs { - end := pos + bs - if end > len(input) { - end = len(input) - } - n, err := encoder.Write(input[pos:end]) - testEqual(t, "Write(%q) gave error %v, want %v", input[pos:end], err, error(nil)) - testEqual(t, "Write(%q) gave length %v, want %v", input[pos:end], n, end-pos) - } - err := encoder.Close() - testEqual(t, "Close gave error %v, want %v", err, error(nil)) - testEqual(t, "Encoding/%d of %q = %q, want %q", bs, bigtest.decoded, bb.String(), bigtest.encoded) - } -} - -func TestDecode(t *testing.T) { - for _, p := range pairs { - for _, tt := range encodingTests { - encoded := tt.conv(p.encoded) - dbuf := make([]byte, tt.enc.DecodedLen(len(encoded))) - count, end, err := tt.enc.decode(dbuf, []byte(encoded)) - testEqual(t, "Decode(%q) = error %v, want %v", encoded, err, error(nil)) - testEqual(t, "Decode(%q) = length %v, want %v", encoded, count, len(p.decoded)) - if len(encoded) > 0 { - testEqual(t, "Decode(%q) = end %v, want %v", encoded, end, len(p.decoded)%3 != 0) - } - testEqual(t, "Decode(%q) = %q, want %q", encoded, string(dbuf[0:count]), p.decoded) - - dbuf, err = tt.enc.DecodeString(encoded) - testEqual(t, "DecodeString(%q) = error %v, want %v", encoded, err, error(nil)) - testEqual(t, "DecodeString(%q) = %q, want %q", string(dbuf), p.decoded) - } - } -} - -func TestDecoder(t *testing.T) { - for _, p := range pairs { - decoder := NewDecoder(StdEncoding, strings.NewReader(p.encoded)) - dbuf := make([]byte, StdEncoding.DecodedLen(len(p.encoded))) - count, err := decoder.Read(dbuf) - if err != nil && err != io.EOF { - t.Fatal("Read failed", err) - } - testEqual(t, "Read from %q = length %v, want %v", p.encoded, count, len(p.decoded)) - testEqual(t, "Decoding of %q = %q, want %q", p.encoded, string(dbuf[0:count]), p.decoded) - if err != io.EOF { - count, err = decoder.Read(dbuf) - } - testEqual(t, "Read from %q = %v, want %v", p.encoded, err, io.EOF) - } -} - -func TestDecoderBuffering(t *testing.T) { - for bs := 1; bs <= 12; bs++ { - decoder := NewDecoder(StdEncoding, strings.NewReader(bigtest.encoded)) - buf := make([]byte, len(bigtest.decoded)+12) - var total int - for total = 0; total < len(bigtest.decoded); { - n, err := decoder.Read(buf[total : total+bs]) - testEqual(t, "Read from %q at pos %d = %d, %v, want _, %v", bigtest.encoded, total, n, err, error(nil)) - total += n - } - testEqual(t, "Decoding/%d of %q = %q, want %q", bs, bigtest.encoded, string(buf[0:total]), bigtest.decoded) - } -} - -func TestDecodeCorrupt(t *testing.T) { - testCases := []struct { - input string - offset int // -1 means no corruption. - }{ - {"", -1}, - {"!!!!", 0}, - {"====", 0}, - {"x===", 1}, - {"=AAA", 0}, - {"A=AA", 1}, - {"AA=A", 2}, - {"AA==A", 4}, - {"AAA=AAAA", 4}, - {"AAAAA", 4}, - {"AAAAAA", 4}, - {"A=", 1}, - {"A==", 1}, - {"AA=", 3}, - {"AA==", -1}, - {"AAA=", -1}, - {"AAAA", -1}, - {"AAAAAA=", 7}, - {"YWJjZA=====", 8}, - } - for _, tc := range testCases { - dbuf := make([]byte, StdEncoding.DecodedLen(len(tc.input))) - _, err := StdEncoding.Decode(dbuf, []byte(tc.input)) - if tc.offset == -1 { - if err != nil { - t.Error("Decoder wrongly detected coruption in", tc.input) - } - continue - } - switch err := err.(type) { - case CorruptInputError: - testEqual(t, "Corruption in %q at offset %v, want %v", tc.input, int(err), tc.offset) - default: - t.Error("Decoder failed to detect corruption in", tc) - } - } -} - -func TestBig(t *testing.T) { - n := 3*1000 + 1 - raw := make([]byte, n) - const alpha = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - for i := 0; i < n; i++ { - raw[i] = alpha[i%len(alpha)] - } - encoded := new(bytes.Buffer) - w := NewEncoder(StdEncoding, encoded) - nn, err := w.Write(raw) - if nn != n || err != nil { - t.Fatalf("Encoder.Write(raw) = %d, %v want %d, nil", nn, err, n) - } - err = w.Close() - if err != nil { - t.Fatalf("Encoder.Close() = %v want nil", err) - } - decoded, err := ioutil.ReadAll(NewDecoder(StdEncoding, encoded)) - if err != nil { - t.Fatalf("ioutil.ReadAll(NewDecoder(...)): %v", err) - } - - if !bytes.Equal(raw, decoded) { - var i int - for i = 0; i < len(decoded) && i < len(raw); i++ { - if decoded[i] != raw[i] { - break - } - } - t.Errorf("Decode(Encode(%d-byte string)) failed at offset %d", n, i) - } -} - -func TestNewLineCharacters(t *testing.T) { - // Each of these should decode to the string "sure", without errors. - const expected = "sure" - examples := []string{ - "c3VyZQ==", - "c3VyZQ==\r", - "c3VyZQ==\n", - "c3VyZQ==\r\n", - "c3VyZ\r\nQ==", - "c3V\ryZ\nQ==", - "c3V\nyZ\rQ==", - "c3VyZ\nQ==", - "c3VyZQ\n==", - "c3VyZQ=\n=", - "c3VyZQ=\r\n\r\n=", - } - for _, e := range examples { - buf, err := StdEncoding.DecodeString(e) - if err != nil { - t.Errorf("Decode(%q) failed: %v", e, err) - continue - } - if s := string(buf); s != expected { - t.Errorf("Decode(%q) = %q, want %q", e, s, expected) - } - } -} - -type nextRead struct { - n int // bytes to return - err error // error to return -} - -// faultInjectReader returns data from source, rate-limited -// and with the errors as written to nextc. -type faultInjectReader struct { - source string - nextc <-chan nextRead -} - -func (r *faultInjectReader) Read(p []byte) (int, error) { - nr := <-r.nextc - if len(p) > nr.n { - p = p[:nr.n] - } - n := copy(p, r.source) - r.source = r.source[n:] - return n, nr.err -} - -// tests that we don't ignore errors from our underlying reader -func TestDecoderIssue3577(t *testing.T) { - next := make(chan nextRead, 10) - wantErr := errors.New("my error") - next <- nextRead{5, nil} - next <- nextRead{10, wantErr} - next <- nextRead{0, wantErr} - d := NewDecoder(StdEncoding, &faultInjectReader{ - source: "VHdhcyBicmlsbGlnLCBhbmQgdGhlIHNsaXRoeSB0b3Zlcw==", // twas brillig... - nextc: next, - }) - errc := make(chan error) - go func() { - _, err := ioutil.ReadAll(d) - errc <- err - }() - select { - case err := <-errc: - if err != wantErr { - t.Errorf("got error %v; want %v", err, wantErr) - } - case <-time.After(5 * time.Second): - t.Errorf("timeout; Decoder blocked without returning an error") - } -} - -func TestDecoderIssue4779(t *testing.T) { - encoded := `CP/EAT8AAAEF -AQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAAAQACAwQFBgcICQoLEAAB -BAEDAgQCBQcGCAUDDDMBAAIRAwQhEjEFQVFhEyJxgTIGFJGhsUIjJBVSwWIzNHKC0UMHJZJT8OHx -Y3M1FqKygyZEk1RkRcKjdDYX0lXiZfKzhMPTdePzRieUpIW0lcTU5PSltcXV5fVWZnaGlqa2xtbm -9jdHV2d3h5ent8fX5/cRAAICAQIEBAMEBQYHBwYFNQEAAhEDITESBEFRYXEiEwUygZEUobFCI8FS -0fAzJGLhcoKSQ1MVY3M08SUGFqKygwcmNcLSRJNUoxdkRVU2dGXi8rOEw9N14/NGlKSFtJXE1OT0 -pbXF1eX1VmZ2hpamtsbW5vYnN0dXZ3eHl6e3x//aAAwDAQACEQMRAD8A9VSSSSUpJJJJSkkkJ+Tj -1kiy1jCJJDnAcCTykpKkuQ6p/jN6FgmxlNduXawwAzaGH+V6jn/R/wCt71zdn+N/qL3kVYFNYB4N -ji6PDVjWpKp9TSXnvTf8bFNjg3qOEa2n6VlLpj/rT/pf567DpX1i6L1hs9Py67X8mqdtg/rUWbbf -+gkp0kkkklKSSSSUpJJJJT//0PVUkkklKVLq3WMDpGI7KzrNjADtYNXvI/Mqr/Pd/q9W3vaxjnvM -NaCXE9gNSvGPrf8AWS3qmba5jjsJhoB0DAf0NDf6sevf+/lf8Hj0JJATfWT6/dV6oXU1uOLQeKKn -EQP+Hubtfe/+R7Mf/g7f5xcocp++Z11JMCJPgFBxOg7/AOuqDx8I/ikpkXkmSdU8mJIJA/O8EMAy -j+mSARB/17pKVXYWHXjsj7yIex0PadzXMO1zT5KHoNA3HT8ietoGhgjsfA+CSnvvqh/jJtqsrwOv -2b6NGNzXfTYexzJ+nU7/ALkf4P8Awv6P9KvTQQ4AgyDqCF85Pho3CTB7eHwXoH+LT65uZbX9X+o2 -bqbPb06551Y4 -` - encodedShort := strings.Replace(encoded, "\n", "", -1) - - dec := NewDecoder(StdEncoding, strings.NewReader(encoded)) - res1, err := ioutil.ReadAll(dec) - if err != nil { - t.Errorf("ReadAll failed: %v", err) - } - - dec = NewDecoder(StdEncoding, strings.NewReader(encodedShort)) - var res2 []byte - res2, err = ioutil.ReadAll(dec) - if err != nil { - t.Errorf("ReadAll failed: %v", err) - } - - if !bytes.Equal(res1, res2) { - t.Error("Decoded results not equal") - } -} - -func TestDecoderIssue7733(t *testing.T) { - s, err := StdEncoding.DecodeString("YWJjZA=====") - want := CorruptInputError(8) - if !reflect.DeepEqual(want, err) { - t.Errorf("Error = %v; want CorruptInputError(8)", err) - } - if string(s) != "abcd" { - t.Errorf("DecodeString = %q; want abcd", s) - } -} - -func BenchmarkEncodeToString(b *testing.B) { - data := make([]byte, 8192) - b.SetBytes(int64(len(data))) - for i := 0; i < b.N; i++ { - StdEncoding.EncodeToString(data) - } -} - -func BenchmarkDecodeString(b *testing.B) { - data := StdEncoding.EncodeToString(make([]byte, 8192)) - b.SetBytes(int64(len(data))) - for i := 0; i < b.N; i++ { - StdEncoding.DecodeString(data) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go b/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go deleted file mode 100644 index 2bbe07c02ff3153886c76f8756ca9c83a3bfbfe0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary.go +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package binary implements simple translation between numbers and byte -// sequences and encoding and decoding of varints. -// -// Numbers are translated by reading and writing fixed-size values. -// A fixed-size value is either a fixed-size arithmetic -// type (int8, uint8, int16, float32, complex64, ...) -// or an array or struct containing only fixed-size values. -// -// The varint functions encode and decode single integer values using -// a variable-length encoding; smaller values require fewer bytes. -// For a specification, see -// https://developers.google.com/protocol-buffers/docs/encoding. -// -// This package favors simplicity over efficiency. Clients that require -// high-performance serialization, especially for large data structures, -// should look at more advanced solutions such as the encoding/gob -// package or protocol buffers. -package binary - -import ( - "errors" - "io" - "math" - "reflect" -) - -// A ByteOrder specifies how to convert byte sequences into -// 16-, 32-, or 64-bit unsigned integers. -type ByteOrder interface { - Uint16([]byte) uint16 - Uint32([]byte) uint32 - Uint64([]byte) uint64 - PutUint16([]byte, uint16) - PutUint32([]byte, uint32) - PutUint64([]byte, uint64) - String() string -} - -// LittleEndian is the little-endian implementation of ByteOrder. -var LittleEndian littleEndian - -// BigEndian is the big-endian implementation of ByteOrder. -var BigEndian bigEndian - -type littleEndian struct{} - -func (littleEndian) Uint16(b []byte) uint16 { return uint16(b[0]) | uint16(b[1])<<8 } - -func (littleEndian) PutUint16(b []byte, v uint16) { - b[0] = byte(v) - b[1] = byte(v >> 8) -} - -func (littleEndian) Uint32(b []byte) uint32 { - return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 -} - -func (littleEndian) PutUint32(b []byte, v uint32) { - b[0] = byte(v) - b[1] = byte(v >> 8) - b[2] = byte(v >> 16) - b[3] = byte(v >> 24) -} - -func (littleEndian) Uint64(b []byte) uint64 { - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | - uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 -} - -func (littleEndian) PutUint64(b []byte, v uint64) { - b[0] = byte(v) - b[1] = byte(v >> 8) - b[2] = byte(v >> 16) - b[3] = byte(v >> 24) - b[4] = byte(v >> 32) - b[5] = byte(v >> 40) - b[6] = byte(v >> 48) - b[7] = byte(v >> 56) -} - -func (littleEndian) String() string { return "LittleEndian" } - -func (littleEndian) GoString() string { return "binary.LittleEndian" } - -type bigEndian struct{} - -func (bigEndian) Uint16(b []byte) uint16 { return uint16(b[1]) | uint16(b[0])<<8 } - -func (bigEndian) PutUint16(b []byte, v uint16) { - b[0] = byte(v >> 8) - b[1] = byte(v) -} - -func (bigEndian) Uint32(b []byte) uint32 { - return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 -} - -func (bigEndian) PutUint32(b []byte, v uint32) { - b[0] = byte(v >> 24) - b[1] = byte(v >> 16) - b[2] = byte(v >> 8) - b[3] = byte(v) -} - -func (bigEndian) Uint64(b []byte) uint64 { - return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | - uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 -} - -func (bigEndian) PutUint64(b []byte, v uint64) { - b[0] = byte(v >> 56) - b[1] = byte(v >> 48) - b[2] = byte(v >> 40) - b[3] = byte(v >> 32) - b[4] = byte(v >> 24) - b[5] = byte(v >> 16) - b[6] = byte(v >> 8) - b[7] = byte(v) -} - -func (bigEndian) String() string { return "BigEndian" } - -func (bigEndian) GoString() string { return "binary.BigEndian" } - -// Read reads structured binary data from r into data. -// Data must be a pointer to a fixed-size value or a slice -// of fixed-size values. -// Bytes read from r are decoded using the specified byte order -// and written to successive fields of the data. -// When reading into structs, the field data for fields with -// blank (_) field names is skipped; i.e., blank field names -// may be used for padding. -// When reading into a struct, all non-blank fields must be exported. -func Read(r io.Reader, order ByteOrder, data interface{}) error { - // Fast path for basic types and slices. - if n := intDataSize(data); n != 0 { - var b [8]byte - var bs []byte - if n > len(b) { - bs = make([]byte, n) - } else { - bs = b[:n] - } - if _, err := io.ReadFull(r, bs); err != nil { - return err - } - switch data := data.(type) { - case *int8: - *data = int8(b[0]) - case *uint8: - *data = b[0] - case *int16: - *data = int16(order.Uint16(bs)) - case *uint16: - *data = order.Uint16(bs) - case *int32: - *data = int32(order.Uint32(bs)) - case *uint32: - *data = order.Uint32(bs) - case *int64: - *data = int64(order.Uint64(bs)) - case *uint64: - *data = order.Uint64(bs) - case []int8: - for i, x := range bs { // Easier to loop over the input for 8-bit values. - data[i] = int8(x) - } - case []uint8: - copy(data, bs) - case []int16: - for i := range data { - data[i] = int16(order.Uint16(bs[2*i:])) - } - case []uint16: - for i := range data { - data[i] = order.Uint16(bs[2*i:]) - } - case []int32: - for i := range data { - data[i] = int32(order.Uint32(bs[4*i:])) - } - case []uint32: - for i := range data { - data[i] = order.Uint32(bs[4*i:]) - } - case []int64: - for i := range data { - data[i] = int64(order.Uint64(bs[8*i:])) - } - case []uint64: - for i := range data { - data[i] = order.Uint64(bs[8*i:]) - } - } - return nil - } - - // Fallback to reflect-based decoding. - v := reflect.ValueOf(data) - size := -1 - switch v.Kind() { - case reflect.Ptr: - v = v.Elem() - size = dataSize(v) - case reflect.Slice: - size = dataSize(v) - } - if size < 0 { - return errors.New("binary.Read: invalid type " + reflect.TypeOf(data).String()) - } - d := &decoder{order: order, buf: make([]byte, size)} - if _, err := io.ReadFull(r, d.buf); err != nil { - return err - } - d.value(v) - return nil -} - -// Write writes the binary representation of data into w. -// Data must be a fixed-size value or a slice of fixed-size -// values, or a pointer to such data. -// Bytes written to w are encoded using the specified byte order -// and read from successive fields of the data. -// When writing structs, zero values are written for fields -// with blank (_) field names. -func Write(w io.Writer, order ByteOrder, data interface{}) error { - // Fast path for basic types and slices. - if n := intDataSize(data); n != 0 { - var b [8]byte - var bs []byte - if n > len(b) { - bs = make([]byte, n) - } else { - bs = b[:n] - } - switch v := data.(type) { - case *int8: - b[0] = byte(*v) - case int8: - b[0] = byte(v) - case []int8: - for i, x := range v { - bs[i] = byte(x) - } - case *uint8: - b[0] = *v - case uint8: - b[0] = byte(v) - case []uint8: - bs = v - case *int16: - order.PutUint16(bs, uint16(*v)) - case int16: - order.PutUint16(bs, uint16(v)) - case []int16: - for i, x := range v { - order.PutUint16(bs[2*i:], uint16(x)) - } - case *uint16: - order.PutUint16(bs, *v) - case uint16: - order.PutUint16(bs, v) - case []uint16: - for i, x := range v { - order.PutUint16(bs[2*i:], x) - } - case *int32: - order.PutUint32(bs, uint32(*v)) - case int32: - order.PutUint32(bs, uint32(v)) - case []int32: - for i, x := range v { - order.PutUint32(bs[4*i:], uint32(x)) - } - case *uint32: - order.PutUint32(bs, *v) - case uint32: - order.PutUint32(bs, v) - case []uint32: - for i, x := range v { - order.PutUint32(bs[4*i:], x) - } - case *int64: - order.PutUint64(bs, uint64(*v)) - case int64: - order.PutUint64(bs, uint64(v)) - case []int64: - for i, x := range v { - order.PutUint64(bs[8*i:], uint64(x)) - } - case *uint64: - order.PutUint64(bs, *v) - case uint64: - order.PutUint64(bs, v) - case []uint64: - for i, x := range v { - order.PutUint64(bs[8*i:], x) - } - } - _, err := w.Write(bs) - return err - } - - // Fallback to reflect-based encoding. - v := reflect.Indirect(reflect.ValueOf(data)) - size := dataSize(v) - if size < 0 { - return errors.New("binary.Write: invalid type " + reflect.TypeOf(data).String()) - } - buf := make([]byte, size) - e := &encoder{order: order, buf: buf} - e.value(v) - _, err := w.Write(buf) - return err -} - -// Size returns how many bytes Write would generate to encode the value v, which -// must be a fixed-size value or a slice of fixed-size values, or a pointer to such data. -// If v is neither of these, Size returns -1. -func Size(v interface{}) int { - return dataSize(reflect.Indirect(reflect.ValueOf(v))) -} - -// dataSize returns the number of bytes the actual data represented by v occupies in memory. -// For compound structures, it sums the sizes of the elements. Thus, for instance, for a slice -// it returns the length of the slice times the element size and does not count the memory -// occupied by the header. If the type of v is not acceptable, dataSize returns -1. -func dataSize(v reflect.Value) int { - if v.Kind() == reflect.Slice { - if s := sizeof(v.Type().Elem()); s >= 0 { - return s * v.Len() - } - return -1 - } - return sizeof(v.Type()) -} - -// sizeof returns the size >= 0 of variables for the given type or -1 if the type is not acceptable. -func sizeof(t reflect.Type) int { - switch t.Kind() { - case reflect.Array: - if s := sizeof(t.Elem()); s >= 0 { - return s * t.Len() - } - - case reflect.Struct: - sum := 0 - for i, n := 0, t.NumField(); i < n; i++ { - s := sizeof(t.Field(i).Type) - if s < 0 { - return -1 - } - sum += s - } - return sum - - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, - reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: - return int(t.Size()) - } - - return -1 -} - -type coder struct { - order ByteOrder - buf []byte -} - -type decoder coder -type encoder coder - -func (d *decoder) uint8() uint8 { - x := d.buf[0] - d.buf = d.buf[1:] - return x -} - -func (e *encoder) uint8(x uint8) { - e.buf[0] = x - e.buf = e.buf[1:] -} - -func (d *decoder) uint16() uint16 { - x := d.order.Uint16(d.buf[0:2]) - d.buf = d.buf[2:] - return x -} - -func (e *encoder) uint16(x uint16) { - e.order.PutUint16(e.buf[0:2], x) - e.buf = e.buf[2:] -} - -func (d *decoder) uint32() uint32 { - x := d.order.Uint32(d.buf[0:4]) - d.buf = d.buf[4:] - return x -} - -func (e *encoder) uint32(x uint32) { - e.order.PutUint32(e.buf[0:4], x) - e.buf = e.buf[4:] -} - -func (d *decoder) uint64() uint64 { - x := d.order.Uint64(d.buf[0:8]) - d.buf = d.buf[8:] - return x -} - -func (e *encoder) uint64(x uint64) { - e.order.PutUint64(e.buf[0:8], x) - e.buf = e.buf[8:] -} - -func (d *decoder) int8() int8 { return int8(d.uint8()) } - -func (e *encoder) int8(x int8) { e.uint8(uint8(x)) } - -func (d *decoder) int16() int16 { return int16(d.uint16()) } - -func (e *encoder) int16(x int16) { e.uint16(uint16(x)) } - -func (d *decoder) int32() int32 { return int32(d.uint32()) } - -func (e *encoder) int32(x int32) { e.uint32(uint32(x)) } - -func (d *decoder) int64() int64 { return int64(d.uint64()) } - -func (e *encoder) int64(x int64) { e.uint64(uint64(x)) } - -func (d *decoder) value(v reflect.Value) { - switch v.Kind() { - case reflect.Array: - l := v.Len() - for i := 0; i < l; i++ { - d.value(v.Index(i)) - } - - case reflect.Struct: - t := v.Type() - l := v.NumField() - for i := 0; i < l; i++ { - // Note: Calling v.CanSet() below is an optimization. - // It would be sufficient to check the field name, - // but creating the StructField info for each field is - // costly (run "go test -bench=ReadStruct" and compare - // results when making changes to this code). - if v := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { - d.value(v) - } else { - d.skip(v) - } - } - - case reflect.Slice: - l := v.Len() - for i := 0; i < l; i++ { - d.value(v.Index(i)) - } - - case reflect.Int8: - v.SetInt(int64(d.int8())) - case reflect.Int16: - v.SetInt(int64(d.int16())) - case reflect.Int32: - v.SetInt(int64(d.int32())) - case reflect.Int64: - v.SetInt(d.int64()) - - case reflect.Uint8: - v.SetUint(uint64(d.uint8())) - case reflect.Uint16: - v.SetUint(uint64(d.uint16())) - case reflect.Uint32: - v.SetUint(uint64(d.uint32())) - case reflect.Uint64: - v.SetUint(d.uint64()) - - case reflect.Float32: - v.SetFloat(float64(math.Float32frombits(d.uint32()))) - case reflect.Float64: - v.SetFloat(math.Float64frombits(d.uint64())) - - case reflect.Complex64: - v.SetComplex(complex( - float64(math.Float32frombits(d.uint32())), - float64(math.Float32frombits(d.uint32())), - )) - case reflect.Complex128: - v.SetComplex(complex( - math.Float64frombits(d.uint64()), - math.Float64frombits(d.uint64()), - )) - } -} - -func (e *encoder) value(v reflect.Value) { - switch v.Kind() { - case reflect.Array: - l := v.Len() - for i := 0; i < l; i++ { - e.value(v.Index(i)) - } - - case reflect.Struct: - t := v.Type() - l := v.NumField() - for i := 0; i < l; i++ { - // see comment for corresponding code in decoder.value() - if v := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { - e.value(v) - } else { - e.skip(v) - } - } - - case reflect.Slice: - l := v.Len() - for i := 0; i < l; i++ { - e.value(v.Index(i)) - } - - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - switch v.Type().Kind() { - case reflect.Int8: - e.int8(int8(v.Int())) - case reflect.Int16: - e.int16(int16(v.Int())) - case reflect.Int32: - e.int32(int32(v.Int())) - case reflect.Int64: - e.int64(v.Int()) - } - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - switch v.Type().Kind() { - case reflect.Uint8: - e.uint8(uint8(v.Uint())) - case reflect.Uint16: - e.uint16(uint16(v.Uint())) - case reflect.Uint32: - e.uint32(uint32(v.Uint())) - case reflect.Uint64: - e.uint64(v.Uint()) - } - - case reflect.Float32, reflect.Float64: - switch v.Type().Kind() { - case reflect.Float32: - e.uint32(math.Float32bits(float32(v.Float()))) - case reflect.Float64: - e.uint64(math.Float64bits(v.Float())) - } - - case reflect.Complex64, reflect.Complex128: - switch v.Type().Kind() { - case reflect.Complex64: - x := v.Complex() - e.uint32(math.Float32bits(float32(real(x)))) - e.uint32(math.Float32bits(float32(imag(x)))) - case reflect.Complex128: - x := v.Complex() - e.uint64(math.Float64bits(real(x))) - e.uint64(math.Float64bits(imag(x))) - } - } -} - -func (d *decoder) skip(v reflect.Value) { - d.buf = d.buf[dataSize(v):] -} - -func (e *encoder) skip(v reflect.Value) { - n := dataSize(v) - for i := range e.buf[0:n] { - e.buf[i] = 0 - } - e.buf = e.buf[n:] -} - -// intDataSize returns the size of the data required to represent the data when encoded. -// It returns zero if the type cannot be implemented by the fast path in Read or Write. -func intDataSize(data interface{}) int { - switch data := data.(type) { - case int8, uint8, *int8, *uint8: - return 1 - case []int8: - return len(data) - case []uint8: - return len(data) - case int16, uint16, *int16, *uint16: - return 2 - case []int16: - return 2 * len(data) - case []uint16: - return 2 * len(data) - case int32, uint32, *int32, *uint32: - return 4 - case []int32: - return 4 * len(data) - case []uint32: - return 4 * len(data) - case int64, uint64, *int64, *uint64: - return 8 - case []int64: - return 8 * len(data) - case []uint64: - return 8 * len(data) - } - return 0 -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary_test.go deleted file mode 100644 index 8ee595fa476aabb677c87b08a065aec30b90af8c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/binary/binary_test.go +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package binary - -import ( - "bytes" - "io" - "math" - "reflect" - "strings" - "testing" -) - -type Struct struct { - Int8 int8 - Int16 int16 - Int32 int32 - Int64 int64 - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Uint64 uint64 - Float32 float32 - Float64 float64 - Complex64 complex64 - Complex128 complex128 - Array [4]uint8 -} - -type T struct { - Int int - Uint uint - Uintptr uintptr - Array [4]int -} - -var s = Struct{ - 0x01, - 0x0203, - 0x04050607, - 0x08090a0b0c0d0e0f, - 0x10, - 0x1112, - 0x13141516, - 0x1718191a1b1c1d1e, - - math.Float32frombits(0x1f202122), - math.Float64frombits(0x232425262728292a), - complex( - math.Float32frombits(0x2b2c2d2e), - math.Float32frombits(0x2f303132), - ), - complex( - math.Float64frombits(0x333435363738393a), - math.Float64frombits(0x3b3c3d3e3f404142), - ), - - [4]uint8{0x43, 0x44, 0x45, 0x46}, -} - -var big = []byte{ - 1, - 2, 3, - 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, - 17, 18, - 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, - - 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - - 67, 68, 69, 70, -} - -var little = []byte{ - 1, - 3, 2, - 7, 6, 5, 4, - 15, 14, 13, 12, 11, 10, 9, 8, - 16, - 18, 17, - 22, 21, 20, 19, - 30, 29, 28, 27, 26, 25, 24, 23, - - 34, 33, 32, 31, - 42, 41, 40, 39, 38, 37, 36, 35, - 46, 45, 44, 43, 50, 49, 48, 47, - 58, 57, 56, 55, 54, 53, 52, 51, 66, 65, 64, 63, 62, 61, 60, 59, - - 67, 68, 69, 70, -} - -var src = []byte{1, 2, 3, 4, 5, 6, 7, 8} -var res = []int32{0x01020304, 0x05060708} - -func checkResult(t *testing.T, dir string, order ByteOrder, err error, have, want interface{}) { - if err != nil { - t.Errorf("%v %v: %v", dir, order, err) - return - } - if !reflect.DeepEqual(have, want) { - t.Errorf("%v %v:\n\thave %+v\n\twant %+v", dir, order, have, want) - } -} - -func testRead(t *testing.T, order ByteOrder, b []byte, s1 interface{}) { - var s2 Struct - err := Read(bytes.NewReader(b), order, &s2) - checkResult(t, "Read", order, err, s2, s1) -} - -func testWrite(t *testing.T, order ByteOrder, b []byte, s1 interface{}) { - buf := new(bytes.Buffer) - err := Write(buf, order, s1) - checkResult(t, "Write", order, err, buf.Bytes(), b) -} - -func TestLittleEndianRead(t *testing.T) { testRead(t, LittleEndian, little, s) } -func TestLittleEndianWrite(t *testing.T) { testWrite(t, LittleEndian, little, s) } -func TestLittleEndianPtrWrite(t *testing.T) { testWrite(t, LittleEndian, little, &s) } - -func TestBigEndianRead(t *testing.T) { testRead(t, BigEndian, big, s) } -func TestBigEndianWrite(t *testing.T) { testWrite(t, BigEndian, big, s) } -func TestBigEndianPtrWrite(t *testing.T) { testWrite(t, BigEndian, big, &s) } - -func TestReadSlice(t *testing.T) { - slice := make([]int32, 2) - err := Read(bytes.NewReader(src), BigEndian, slice) - checkResult(t, "ReadSlice", BigEndian, err, slice, res) -} - -func TestWriteSlice(t *testing.T) { - buf := new(bytes.Buffer) - err := Write(buf, BigEndian, res) - checkResult(t, "WriteSlice", BigEndian, err, buf.Bytes(), src) -} - -// Addresses of arrays are easier to manipulate with reflection than are slices. -var intArrays = []interface{}{ - &[100]int8{}, - &[100]int16{}, - &[100]int32{}, - &[100]int64{}, - &[100]uint8{}, - &[100]uint16{}, - &[100]uint32{}, - &[100]uint64{}, -} - -func TestSliceRoundTrip(t *testing.T) { - buf := new(bytes.Buffer) - for _, array := range intArrays { - src := reflect.ValueOf(array).Elem() - unsigned := false - switch src.Index(0).Kind() { - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - unsigned = true - } - for i := 0; i < src.Len(); i++ { - if unsigned { - src.Index(i).SetUint(uint64(i * 0x07654321)) - } else { - src.Index(i).SetInt(int64(i * 0x07654321)) - } - } - buf.Reset() - srcSlice := src.Slice(0, src.Len()) - err := Write(buf, BigEndian, srcSlice.Interface()) - if err != nil { - t.Fatal(err) - } - dst := reflect.New(src.Type()).Elem() - dstSlice := dst.Slice(0, dst.Len()) - err = Read(buf, BigEndian, dstSlice.Interface()) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(src.Interface(), dst.Interface()) { - t.Fatal(src) - } - } -} - -func TestWriteT(t *testing.T) { - buf := new(bytes.Buffer) - ts := T{} - if err := Write(buf, BigEndian, ts); err == nil { - t.Errorf("WriteT: have err == nil, want non-nil") - } - - tv := reflect.Indirect(reflect.ValueOf(ts)) - for i, n := 0, tv.NumField(); i < n; i++ { - typ := tv.Field(i).Type().String() - if typ == "[4]int" { - typ = "int" // the problem is int, not the [4] - } - if err := Write(buf, BigEndian, tv.Field(i).Interface()); err == nil { - t.Errorf("WriteT.%v: have err == nil, want non-nil", tv.Field(i).Type()) - } else if !strings.Contains(err.Error(), typ) { - t.Errorf("WriteT: have err == %q, want it to mention %s", err, typ) - } - } -} - -type BlankFields struct { - A uint32 - _ int32 - B float64 - _ [4]int16 - C byte - _ [7]byte - _ struct { - f [8]float32 - } -} - -type BlankFieldsProbe struct { - A uint32 - P0 int32 - B float64 - P1 [4]int16 - C byte - P2 [7]byte - P3 struct { - F [8]float32 - } -} - -func TestBlankFields(t *testing.T) { - buf := new(bytes.Buffer) - b1 := BlankFields{A: 1234567890, B: 2.718281828, C: 42} - if err := Write(buf, LittleEndian, &b1); err != nil { - t.Error(err) - } - - // zero values must have been written for blank fields - var p BlankFieldsProbe - if err := Read(buf, LittleEndian, &p); err != nil { - t.Error(err) - } - - // quick test: only check first value of slices - if p.P0 != 0 || p.P1[0] != 0 || p.P2[0] != 0 || p.P3.F[0] != 0 { - t.Errorf("non-zero values for originally blank fields: %#v", p) - } - - // write p and see if we can probe only some fields - if err := Write(buf, LittleEndian, &p); err != nil { - t.Error(err) - } - - // read should ignore blank fields in b2 - var b2 BlankFields - if err := Read(buf, LittleEndian, &b2); err != nil { - t.Error(err) - } - if b1.A != b2.A || b1.B != b2.B || b1.C != b2.C { - t.Errorf("%#v != %#v", b1, b2) - } -} - -// An attempt to read into a struct with an unexported field will -// panic. This is probably not the best choice, but at this point -// anything else would be an API change. - -type Unexported struct { - a int32 -} - -func TestUnexportedRead(t *testing.T) { - var buf bytes.Buffer - u1 := Unexported{a: 1} - if err := Write(&buf, LittleEndian, &u1); err != nil { - t.Fatal(err) - } - - defer func() { - if recover() == nil { - t.Fatal("did not panic") - } - }() - var u2 Unexported - Read(&buf, LittleEndian, &u2) -} - -func TestReadErrorMsg(t *testing.T) { - var buf bytes.Buffer - read := func(data interface{}) { - err := Read(&buf, LittleEndian, data) - want := "binary.Read: invalid type " + reflect.TypeOf(data).String() - if err == nil { - t.Errorf("%T: got no error; want %q", data, want) - return - } - if got := err.Error(); got != want { - t.Errorf("%T: got %q; want %q", data, got, want) - } - } - read(0) - s := new(struct{}) - read(&s) - p := &s - read(&p) -} - -type byteSliceReader struct { - remain []byte -} - -func (br *byteSliceReader) Read(p []byte) (int, error) { - n := copy(p, br.remain) - br.remain = br.remain[n:] - return n, nil -} - -func BenchmarkReadSlice1000Int32s(b *testing.B) { - bsr := &byteSliceReader{} - slice := make([]int32, 1000) - buf := make([]byte, len(slice)*4) - b.SetBytes(int64(len(buf))) - b.ResetTimer() - for i := 0; i < b.N; i++ { - bsr.remain = buf - Read(bsr, BigEndian, slice) - } -} - -func BenchmarkReadStruct(b *testing.B) { - bsr := &byteSliceReader{} - var buf bytes.Buffer - Write(&buf, BigEndian, &s) - b.SetBytes(int64(dataSize(reflect.ValueOf(s)))) - t := s - b.ResetTimer() - for i := 0; i < b.N; i++ { - bsr.remain = buf.Bytes() - Read(bsr, BigEndian, &t) - } - b.StopTimer() - if !reflect.DeepEqual(s, t) { - b.Fatal("no match") - } -} - -func BenchmarkReadInts(b *testing.B) { - var ls Struct - bsr := &byteSliceReader{} - var r io.Reader = bsr - b.SetBytes(2 * (1 + 2 + 4 + 8)) - b.ResetTimer() - for i := 0; i < b.N; i++ { - bsr.remain = big - Read(r, BigEndian, &ls.Int8) - Read(r, BigEndian, &ls.Int16) - Read(r, BigEndian, &ls.Int32) - Read(r, BigEndian, &ls.Int64) - Read(r, BigEndian, &ls.Uint8) - Read(r, BigEndian, &ls.Uint16) - Read(r, BigEndian, &ls.Uint32) - Read(r, BigEndian, &ls.Uint64) - } - - want := s - want.Float32 = 0 - want.Float64 = 0 - want.Complex64 = 0 - want.Complex128 = 0 - for i := range want.Array { - want.Array[i] = 0 - } - b.StopTimer() - if !reflect.DeepEqual(ls, want) { - panic("no match") - } -} - -func BenchmarkWriteInts(b *testing.B) { - buf := new(bytes.Buffer) - var w io.Writer = buf - b.SetBytes(2 * (1 + 2 + 4 + 8)) - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - Write(w, BigEndian, s.Int8) - Write(w, BigEndian, s.Int16) - Write(w, BigEndian, s.Int32) - Write(w, BigEndian, s.Int64) - Write(w, BigEndian, s.Uint8) - Write(w, BigEndian, s.Uint16) - Write(w, BigEndian, s.Uint32) - Write(w, BigEndian, s.Uint64) - } - b.StopTimer() - if !bytes.Equal(buf.Bytes(), big[:30]) { - b.Fatalf("first half doesn't match: %x %x", buf.Bytes(), big[:30]) - } -} - -func BenchmarkWriteSlice1000Int32s(b *testing.B) { - slice := make([]int32, 1000) - buf := new(bytes.Buffer) - var w io.Writer = buf - b.SetBytes(4 * 1000) - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - Write(w, BigEndian, slice) - } - b.StopTimer() -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint.go b/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint.go deleted file mode 100644 index 3a2dfa3c74e2139199fa3922521d8ca783c7594c..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint.go +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package binary - -// This file implements "varint" encoding of 64-bit integers. -// The encoding is: -// - unsigned integers are serialized 7 bits at a time, starting with the -// least significant bits -// - the most significant bit (msb) in each output byte indicates if there -// is a continuation byte (msb = 1) -// - signed integers are mapped to unsigned integers using "zig-zag" -// encoding: Positive values x are written as 2*x + 0, negative values -// are written as 2*(^x) + 1; that is, negative numbers are complemented -// and whether to complement is encoded in bit 0. -// -// Design note: -// At most 10 bytes are needed for 64-bit values. The encoding could -// be more dense: a full 64-bit value needs an extra byte just to hold bit 63. -// Instead, the msb of the previous byte could be used to hold bit 63 since we -// know there can't be more than 64 bits. This is a trivial improvement and -// would reduce the maximum encoding length to 9 bytes. However, it breaks the -// invariant that the msb is always the "continuation bit" and thus makes the -// format incompatible with a varint encoding for larger numbers (say 128-bit). - -import ( - "errors" - "io" -) - -// MaxVarintLenN is the maximum length of a varint-encoded N-bit integer. -const ( - MaxVarintLen16 = 3 - MaxVarintLen32 = 5 - MaxVarintLen64 = 10 -) - -// PutUvarint encodes a uint64 into buf and returns the number of bytes written. -// If the buffer is too small, PutUvarint will panic. -func PutUvarint(buf []byte, x uint64) int { - i := 0 - for x >= 0x80 { - buf[i] = byte(x) | 0x80 - x >>= 7 - i++ - } - buf[i] = byte(x) - return i + 1 -} - -// Uvarint decodes a uint64 from buf and returns that value and the -// number of bytes read (> 0). If an error occurred, the value is 0 -// and the number of bytes n is <= 0 meaning: -// -// n == 0: buf too small -// n < 0: value larger than 64 bits (overflow) -// and -n is the number of bytes read -// -func Uvarint(buf []byte) (uint64, int) { - var x uint64 - var s uint - for i, b := range buf { - if b < 0x80 { - if i > 9 || i == 9 && b > 1 { - return 0, -(i + 1) // overflow - } - return x | uint64(b)< 0). If an error occurred, the value is 0 -// and the number of bytes n is <= 0 with the following meaning: -// -// n == 0: buf too small -// n < 0: value larger than 64 bits (overflow) -// and -n is the number of bytes read -// -func Varint(buf []byte) (int64, int) { - ux, n := Uvarint(buf) // ok to continue in presence of error - x := int64(ux >> 1) - if ux&1 != 0 { - x = ^x - } - return x, n -} - -var overflow = errors.New("binary: varint overflows a 64-bit integer") - -// ReadUvarint reads an encoded unsigned integer from r and returns it as a uint64. -func ReadUvarint(r io.ByteReader) (uint64, error) { - var x uint64 - var s uint - for i := 0; ; i++ { - b, err := r.ReadByte() - if err != nil { - return x, err - } - if b < 0x80 { - if i > 9 || i == 9 && b > 1 { - return x, overflow - } - return x | uint64(b)<> 1) - if ux&1 != 0 { - x = ^x - } - return x, err -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint_test.go deleted file mode 100644 index ca411ecbd65e8180d2bfcb0c819a561328d66f06..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/binary/varint_test.go +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package binary - -import ( - "bytes" - "io" - "testing" -) - -func testConstant(t *testing.T, w uint, max int) { - buf := make([]byte, MaxVarintLen64) - n := PutUvarint(buf, 1< 0 { - if len(record) != r.FieldsPerRecord { - r.column = 0 // report at start of record - return record, r.error(ErrFieldCount) - } - } else if r.FieldsPerRecord == 0 { - r.FieldsPerRecord = len(record) - } - return record, nil -} - -// ReadAll reads all the remaining records from r. -// Each record is a slice of fields. -// A successful call returns err == nil, not err == EOF. Because ReadAll is -// defined to read until EOF, it does not treat end of file as an error to be -// reported. -func (r *Reader) ReadAll() (records [][]string, err error) { - for { - record, err := r.Read() - if err == io.EOF { - return records, nil - } - if err != nil { - return nil, err - } - records = append(records, record) - } -} - -// readRune reads one rune from r, folding \r\n to \n and keeping track -// of how far into the line we have read. r.column will point to the start -// of this rune, not the end of this rune. -func (r *Reader) readRune() (rune, error) { - r1, _, err := r.r.ReadRune() - - // Handle \r\n here. We make the simplifying assumption that - // anytime \r is followed by \n that it can be folded to \n. - // We will not detect files which contain both \r\n and bare \n. - if r1 == '\r' { - r1, _, err = r.r.ReadRune() - if err == nil { - if r1 != '\n' { - r.r.UnreadRune() - r1 = '\r' - } - } - } - r.column++ - return r1, err -} - -// skip reads runes up to and including the rune delim or until error. -func (r *Reader) skip(delim rune) error { - for { - r1, err := r.readRune() - if err != nil { - return err - } - if r1 == delim { - return nil - } - } -} - -// parseRecord reads and parses a single csv record from r. -func (r *Reader) parseRecord() (fields []string, err error) { - // Each record starts on a new line. We increment our line - // number (lines start at 1, not 0) and set column to -1 - // so as we increment in readRune it points to the character we read. - r.line++ - r.column = -1 - - // Peek at the first rune. If it is an error we are done. - // If we support comments and it is the comment character - // then skip to the end of line. - - r1, _, err := r.r.ReadRune() - if err != nil { - return nil, err - } - - if r.Comment != 0 && r1 == r.Comment { - return nil, r.skip('\n') - } - r.r.UnreadRune() - - // At this point we have at least one field. - for { - haveField, delim, err := r.parseField() - if haveField { - // If FieldsPerRecord is greater then 0 we can assume the final - // length of fields to be equal to FieldsPerRecord. - if r.FieldsPerRecord > 0 && fields == nil { - fields = make([]string, 0, r.FieldsPerRecord) - } - fields = append(fields, r.field.String()) - } - if delim == '\n' || err == io.EOF { - return fields, err - } else if err != nil { - return nil, err - } - } -} - -// parseField parses the next field in the record. The read field is -// located in r.field. Delim is the first character not part of the field -// (r.Comma or '\n'). -func (r *Reader) parseField() (haveField bool, delim rune, err error) { - r.field.Reset() - - r1, err := r.readRune() - for err == nil && r.TrimLeadingSpace && r1 != '\n' && unicode.IsSpace(r1) { - r1, err = r.readRune() - } - - if err == io.EOF && r.column != 0 { - return true, 0, err - } - if err != nil { - return false, 0, err - } - - switch r1 { - case r.Comma: - // will check below - - case '\n': - // We are a trailing empty field or a blank line - if r.column == 0 { - return false, r1, nil - } - return true, r1, nil - - case '"': - // quoted field - Quoted: - for { - r1, err = r.readRune() - if err != nil { - if err == io.EOF { - if r.LazyQuotes { - return true, 0, err - } - return false, 0, r.error(ErrQuote) - } - return false, 0, err - } - switch r1 { - case '"': - r1, err = r.readRune() - if err != nil || r1 == r.Comma { - break Quoted - } - if r1 == '\n' { - return true, r1, nil - } - if r1 != '"' { - if !r.LazyQuotes { - r.column-- - return false, 0, r.error(ErrQuote) - } - // accept the bare quote - r.field.WriteRune('"') - } - case '\n': - r.line++ - r.column = -1 - } - r.field.WriteRune(r1) - } - - default: - // unquoted field - for { - r.field.WriteRune(r1) - r1, err = r.readRune() - if err != nil || r1 == r.Comma { - break - } - if r1 == '\n' { - return true, r1, nil - } - if !r.LazyQuotes && r1 == '"' { - return false, 0, r.error(ErrBareQuote) - } - } - } - - if err != nil { - if err == io.EOF { - return true, 0, err - } - return false, 0, err - } - - return true, r1, nil -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/csv/reader_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/csv/reader_test.go deleted file mode 100644 index be1002d034a1768c8b5e47ee225e01f0222f3142..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/csv/reader_test.go +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package csv - -import ( - "reflect" - "strings" - "testing" -) - -var readTests = []struct { - Name string - Input string - Output [][]string - UseFieldsPerRecord bool // false (default) means FieldsPerRecord is -1 - - // These fields are copied into the Reader - Comma rune - Comment rune - FieldsPerRecord int - LazyQuotes bool - TrailingComma bool - TrimLeadingSpace bool - - Error string - Line int // Expected error line if != 0 - Column int // Expected error column if line != 0 -}{ - { - Name: "Simple", - Input: "a,b,c\n", - Output: [][]string{{"a", "b", "c"}}, - }, - { - Name: "CRLF", - Input: "a,b\r\nc,d\r\n", - Output: [][]string{{"a", "b"}, {"c", "d"}}, - }, - { - Name: "BareCR", - Input: "a,b\rc,d\r\n", - Output: [][]string{{"a", "b\rc", "d"}}, - }, - { - Name: "RFC4180test", - UseFieldsPerRecord: true, - Input: `#field1,field2,field3 -"aaa","bb -b","ccc" -"a,a","b""bb","ccc" -zzz,yyy,xxx -`, - Output: [][]string{ - {"#field1", "field2", "field3"}, - {"aaa", "bb\nb", "ccc"}, - {"a,a", `b"bb`, "ccc"}, - {"zzz", "yyy", "xxx"}, - }, - }, - { - Name: "NoEOLTest", - Input: "a,b,c", - Output: [][]string{{"a", "b", "c"}}, - }, - { - Name: "Semicolon", - Comma: ';', - Input: "a;b;c\n", - Output: [][]string{{"a", "b", "c"}}, - }, - { - Name: "MultiLine", - Input: `"two -line","one line","three -line -field"`, - Output: [][]string{{"two\nline", "one line", "three\nline\nfield"}}, - }, - { - Name: "BlankLine", - Input: "a,b,c\n\nd,e,f\n\n", - Output: [][]string{ - {"a", "b", "c"}, - {"d", "e", "f"}, - }, - }, - { - Name: "BlankLineFieldCount", - Input: "a,b,c\n\nd,e,f\n\n", - UseFieldsPerRecord: true, - Output: [][]string{ - {"a", "b", "c"}, - {"d", "e", "f"}, - }, - }, - { - Name: "TrimSpace", - Input: " a, b, c\n", - TrimLeadingSpace: true, - Output: [][]string{{"a", "b", "c"}}, - }, - { - Name: "LeadingSpace", - Input: " a, b, c\n", - Output: [][]string{{" a", " b", " c"}}, - }, - { - Name: "Comment", - Comment: '#', - Input: "#1,2,3\na,b,c\n#comment", - Output: [][]string{{"a", "b", "c"}}, - }, - { - Name: "NoComment", - Input: "#1,2,3\na,b,c", - Output: [][]string{{"#1", "2", "3"}, {"a", "b", "c"}}, - }, - { - Name: "LazyQuotes", - LazyQuotes: true, - Input: `a "word","1"2",a","b`, - Output: [][]string{{`a "word"`, `1"2`, `a"`, `b`}}, - }, - { - Name: "BareQuotes", - LazyQuotes: true, - Input: `a "word","1"2",a"`, - Output: [][]string{{`a "word"`, `1"2`, `a"`}}, - }, - { - Name: "BareDoubleQuotes", - LazyQuotes: true, - Input: `a""b,c`, - Output: [][]string{{`a""b`, `c`}}, - }, - { - Name: "BadDoubleQuotes", - Input: `a""b,c`, - Error: `bare " in non-quoted-field`, Line: 1, Column: 1, - }, - { - Name: "TrimQuote", - Input: ` "a"," b",c`, - TrimLeadingSpace: true, - Output: [][]string{{"a", " b", "c"}}, - }, - { - Name: "BadBareQuote", - Input: `a "word","b"`, - Error: `bare " in non-quoted-field`, Line: 1, Column: 2, - }, - { - Name: "BadTrailingQuote", - Input: `"a word",b"`, - Error: `bare " in non-quoted-field`, Line: 1, Column: 10, - }, - { - Name: "ExtraneousQuote", - Input: `"a "word","b"`, - Error: `extraneous " in field`, Line: 1, Column: 3, - }, - { - Name: "BadFieldCount", - UseFieldsPerRecord: true, - Input: "a,b,c\nd,e", - Error: "wrong number of fields", Line: 2, - }, - { - Name: "BadFieldCount1", - UseFieldsPerRecord: true, - FieldsPerRecord: 2, - Input: `a,b,c`, - Error: "wrong number of fields", Line: 1, - }, - { - Name: "FieldCount", - Input: "a,b,c\nd,e", - Output: [][]string{{"a", "b", "c"}, {"d", "e"}}, - }, - { - Name: "TrailingCommaEOF", - Input: "a,b,c,", - Output: [][]string{{"a", "b", "c", ""}}, - }, - { - Name: "TrailingCommaEOL", - Input: "a,b,c,\n", - Output: [][]string{{"a", "b", "c", ""}}, - }, - { - Name: "TrailingCommaSpaceEOF", - TrimLeadingSpace: true, - Input: "a,b,c, ", - Output: [][]string{{"a", "b", "c", ""}}, - }, - { - Name: "TrailingCommaSpaceEOL", - TrimLeadingSpace: true, - Input: "a,b,c, \n", - Output: [][]string{{"a", "b", "c", ""}}, - }, - { - Name: "TrailingCommaLine3", - TrimLeadingSpace: true, - Input: "a,b,c\nd,e,f\ng,hi,", - Output: [][]string{{"a", "b", "c"}, {"d", "e", "f"}, {"g", "hi", ""}}, - }, - { - Name: "NotTrailingComma3", - Input: "a,b,c, \n", - Output: [][]string{{"a", "b", "c", " "}}, - }, - { - Name: "CommaFieldTest", - TrailingComma: true, - Input: `x,y,z,w -x,y,z, -x,y,, -x,,, -,,, -"x","y","z","w" -"x","y","z","" -"x","y","","" -"x","","","" -"","","","" -`, - Output: [][]string{ - {"x", "y", "z", "w"}, - {"x", "y", "z", ""}, - {"x", "y", "", ""}, - {"x", "", "", ""}, - {"", "", "", ""}, - {"x", "y", "z", "w"}, - {"x", "y", "z", ""}, - {"x", "y", "", ""}, - {"x", "", "", ""}, - {"", "", "", ""}, - }, - }, - { - Name: "TrailingCommaIneffective1", - TrailingComma: true, - TrimLeadingSpace: true, - Input: "a,b,\nc,d,e", - Output: [][]string{ - {"a", "b", ""}, - {"c", "d", "e"}, - }, - }, - { - Name: "TrailingCommaIneffective2", - TrailingComma: false, - TrimLeadingSpace: true, - Input: "a,b,\nc,d,e", - Output: [][]string{ - {"a", "b", ""}, - {"c", "d", "e"}, - }, - }, -} - -func TestRead(t *testing.T) { - for _, tt := range readTests { - r := NewReader(strings.NewReader(tt.Input)) - r.Comment = tt.Comment - if tt.UseFieldsPerRecord { - r.FieldsPerRecord = tt.FieldsPerRecord - } else { - r.FieldsPerRecord = -1 - } - r.LazyQuotes = tt.LazyQuotes - r.TrailingComma = tt.TrailingComma - r.TrimLeadingSpace = tt.TrimLeadingSpace - if tt.Comma != 0 { - r.Comma = tt.Comma - } - out, err := r.ReadAll() - perr, _ := err.(*ParseError) - if tt.Error != "" { - if err == nil || !strings.Contains(err.Error(), tt.Error) { - t.Errorf("%s: error %v, want error %q", tt.Name, err, tt.Error) - } else if tt.Line != 0 && (tt.Line != perr.Line || tt.Column != perr.Column) { - t.Errorf("%s: error at %d:%d expected %d:%d", tt.Name, perr.Line, perr.Column, tt.Line, tt.Column) - } - } else if err != nil { - t.Errorf("%s: unexpected error %v", tt.Name, err) - } else if !reflect.DeepEqual(out, tt.Output) { - t.Errorf("%s: out=%q want %q", tt.Name, out, tt.Output) - } - } -} - -func BenchmarkRead(b *testing.B) { - data := `x,y,z,w -x,y,z, -x,y,, -x,,, -,,, -"x","y","z","w" -"x","y","z","" -"x","y","","" -"x","","","" -"","","","" -` - - for i := 0; i < b.N; i++ { - _, err := NewReader(strings.NewReader(data)).ReadAll() - - if err != nil { - b.Fatalf("could not read data: %s", err) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer.go b/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer.go deleted file mode 100644 index 353d91f238f80fa49dbb3fbebe37b28633f35fc0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package csv - -import ( - "bufio" - "io" - "strings" - "unicode" - "unicode/utf8" -) - -// A Writer writes records to a CSV encoded file. -// -// As returned by NewWriter, a Writer writes records terminated by a -// newline and uses ',' as the field delimiter. The exported fields can be -// changed to customize the details before the first call to Write or WriteAll. -// -// Comma is the field delimiter. -// -// If UseCRLF is true, the Writer ends each record with \r\n instead of \n. -type Writer struct { - Comma rune // Field delimiter (set to ',' by NewWriter) - UseCRLF bool // True to use \r\n as the line terminator - w *bufio.Writer -} - -// NewWriter returns a new Writer that writes to w. -func NewWriter(w io.Writer) *Writer { - return &Writer{ - Comma: ',', - w: bufio.NewWriter(w), - } -} - -// Writer writes a single CSV record to w along with any necessary quoting. -// A record is a slice of strings with each string being one field. -func (w *Writer) Write(record []string) (err error) { - for n, field := range record { - if n > 0 { - if _, err = w.w.WriteRune(w.Comma); err != nil { - return - } - } - - // If we don't have to have a quoted field then just - // write out the field and continue to the next field. - if !w.fieldNeedsQuotes(field) { - if _, err = w.w.WriteString(field); err != nil { - return - } - continue - } - if err = w.w.WriteByte('"'); err != nil { - return - } - - for _, r1 := range field { - switch r1 { - case '"': - _, err = w.w.WriteString(`""`) - case '\r': - if !w.UseCRLF { - err = w.w.WriteByte('\r') - } - case '\n': - if w.UseCRLF { - _, err = w.w.WriteString("\r\n") - } else { - err = w.w.WriteByte('\n') - } - default: - _, err = w.w.WriteRune(r1) - } - if err != nil { - return - } - } - - if err = w.w.WriteByte('"'); err != nil { - return - } - } - if w.UseCRLF { - _, err = w.w.WriteString("\r\n") - } else { - err = w.w.WriteByte('\n') - } - return -} - -// Flush writes any buffered data to the underlying io.Writer. -// To check if an error occurred during the Flush, call Error. -func (w *Writer) Flush() { - w.w.Flush() -} - -// Error reports any error that has occurred during a previous Write or Flush. -func (w *Writer) Error() error { - _, err := w.w.Write(nil) - return err -} - -// WriteAll writes multiple CSV records to w using Write and then calls Flush. -func (w *Writer) WriteAll(records [][]string) (err error) { - for _, record := range records { - err = w.Write(record) - if err != nil { - return err - } - } - return w.w.Flush() -} - -// fieldNeedsQuotes reports whether our field must be enclosed in quotes. -// Fields with a Comma, fields with a quote or newline, and -// fields which start with a space must be enclosed in quotes. -// We used to quote empty strings, but we do not anymore (as of Go 1.4). -// The two representations should be equivalent, but Postgres distinguishes -// quoted vs non-quoted empty string during database imports, and it has -// an option to force the quoted behavior for non-quoted CSV but it has -// no option to force the non-quoted behavior for quoted CSV, making -// CSV with quoted empty strings strictly less useful. -// Not quoting the empty string also makes this package match the behavior -// of Microsoft Excel and Google Drive. -// For Postgres, quote the data terminating string `\.`. -func (w *Writer) fieldNeedsQuotes(field string) bool { - if field == "" { - return false - } - if field == `\.` || strings.IndexRune(field, w.Comma) >= 0 || strings.IndexAny(field, "\"\r\n") >= 0 { - return true - } - - r1, _ := utf8.DecodeRuneInString(field) - return unicode.IsSpace(r1) -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer_test.go deleted file mode 100644 index 8ddca0abe0c13f09e13bc4a30718d09d17829541..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/csv/writer_test.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package csv - -import ( - "bytes" - "errors" - "testing" -) - -var writeTests = []struct { - Input [][]string - Output string - UseCRLF bool -}{ - {Input: [][]string{{"abc"}}, Output: "abc\n"}, - {Input: [][]string{{"abc"}}, Output: "abc\r\n", UseCRLF: true}, - {Input: [][]string{{`"abc"`}}, Output: `"""abc"""` + "\n"}, - {Input: [][]string{{`a"b`}}, Output: `"a""b"` + "\n"}, - {Input: [][]string{{`"a"b"`}}, Output: `"""a""b"""` + "\n"}, - {Input: [][]string{{" abc"}}, Output: `" abc"` + "\n"}, - {Input: [][]string{{"abc,def"}}, Output: `"abc,def"` + "\n"}, - {Input: [][]string{{"abc", "def"}}, Output: "abc,def\n"}, - {Input: [][]string{{"abc"}, {"def"}}, Output: "abc\ndef\n"}, - {Input: [][]string{{"abc\ndef"}}, Output: "\"abc\ndef\"\n"}, - {Input: [][]string{{"abc\ndef"}}, Output: "\"abc\r\ndef\"\r\n", UseCRLF: true}, - {Input: [][]string{{"abc\rdef"}}, Output: "\"abcdef\"\r\n", UseCRLF: true}, - {Input: [][]string{{"abc\rdef"}}, Output: "\"abc\rdef\"\n", UseCRLF: false}, - {Input: [][]string{{""}}, Output: "\n"}, - {Input: [][]string{{"", ""}}, Output: ",\n"}, - {Input: [][]string{{"", "", ""}}, Output: ",,\n"}, - {Input: [][]string{{"", "", "a"}}, Output: ",,a\n"}, - {Input: [][]string{{"", "a", ""}}, Output: ",a,\n"}, - {Input: [][]string{{"", "a", "a"}}, Output: ",a,a\n"}, - {Input: [][]string{{"a", "", ""}}, Output: "a,,\n"}, - {Input: [][]string{{"a", "", "a"}}, Output: "a,,a\n"}, - {Input: [][]string{{"a", "a", ""}}, Output: "a,a,\n"}, - {Input: [][]string{{"a", "a", "a"}}, Output: "a,a,a\n"}, - {Input: [][]string{{`\.`}}, Output: "\"\\.\"\n"}, -} - -func TestWrite(t *testing.T) { - for n, tt := range writeTests { - b := &bytes.Buffer{} - f := NewWriter(b) - f.UseCRLF = tt.UseCRLF - err := f.WriteAll(tt.Input) - if err != nil { - t.Errorf("Unexpected error: %s\n", err) - } - out := b.String() - if out != tt.Output { - t.Errorf("#%d: out=%q want %q", n, out, tt.Output) - } - } -} - -type errorWriter struct{} - -func (e errorWriter) Write(b []byte) (int, error) { - return 0, errors.New("Test") -} - -func TestError(t *testing.T) { - b := &bytes.Buffer{} - f := NewWriter(b) - f.Write([]string{"abc"}) - f.Flush() - err := f.Error() - - if err != nil { - t.Errorf("Unexpected error: %s\n", err) - } - - f = NewWriter(errorWriter{}) - f.Write([]string{"abc"}) - f.Flush() - err = f.Error() - - if err == nil { - t.Error("Error should not be nil") - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/encoding.go b/llgo/third_party/gofrontend/libgo/go/encoding/encoding.go deleted file mode 100644 index 6d218071b7ae4f9c54293c4c161b836128b39e69..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/encoding.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package encoding defines interfaces shared by other packages that -// convert data to and from byte-level and textual representations. -// Packages that check for these interfaces include encoding/gob, -// encoding/json, and encoding/xml. As a result, implementing an -// interface once can make a type useful in multiple encodings. -// Standard types that implement these interfaces include time.Time and net.IP. -// The interfaces come in pairs that produce and consume encoded data. -package encoding - -// BinaryMarshaler is the interface implemented by an object that can -// marshal itself into a binary form. -// -// MarshalBinary encodes the receiver into a binary form and returns the result. -type BinaryMarshaler interface { - MarshalBinary() (data []byte, err error) -} - -// BinaryUnmarshaler is the interface implemented by an object that can -// unmarshal a binary representation of itself. -// -// UnmarshalBinary must be able to decode the form generated by MarshalBinary. -// UnmarshalBinary must copy the data if it wishes to retain the data -// after returning. -type BinaryUnmarshaler interface { - UnmarshalBinary(data []byte) error -} - -// TextMarshaler is the interface implemented by an object that can -// marshal itself into a textual form. -// -// MarshalText encodes the receiver into UTF-8-encoded text and returns the result. -type TextMarshaler interface { - MarshalText() (text []byte, err error) -} - -// TextUnmarshaler is the interface implemented by an object that can -// unmarshal a textual representation of itself. -// -// UnmarshalText must be able to decode the form generated by MarshalText. -// UnmarshalText must copy the text if it wishes to retain the text -// after returning. -type TextUnmarshaler interface { - UnmarshalText(text []byte) error -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/codec_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/codec_test.go deleted file mode 100644 index c2583bfee337d18fbe4971dbbff005419805b5c8..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/codec_test.go +++ /dev/null @@ -1,1494 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "bytes" - "errors" - "flag" - "math" - "math/rand" - "reflect" - "strings" - "testing" - "time" -) - -var doFuzzTests = flag.Bool("gob.fuzz", false, "run the fuzz tests, which are large and very slow") - -// Guarantee encoding format by comparing some encodings to hand-written values -type EncodeT struct { - x uint64 - b []byte -} - -var encodeT = []EncodeT{ - {0x00, []byte{0x00}}, - {0x0F, []byte{0x0F}}, - {0xFF, []byte{0xFF, 0xFF}}, - {0xFFFF, []byte{0xFE, 0xFF, 0xFF}}, - {0xFFFFFF, []byte{0xFD, 0xFF, 0xFF, 0xFF}}, - {0xFFFFFFFF, []byte{0xFC, 0xFF, 0xFF, 0xFF, 0xFF}}, - {0xFFFFFFFFFF, []byte{0xFB, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}, - {0xFFFFFFFFFFFF, []byte{0xFA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}, - {0xFFFFFFFFFFFFFF, []byte{0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}, - {0xFFFFFFFFFFFFFFFF, []byte{0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}, - {0x1111, []byte{0xFE, 0x11, 0x11}}, - {0x1111111111111111, []byte{0xF8, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11}}, - {0x8888888888888888, []byte{0xF8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88}}, - {1 << 63, []byte{0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, -} - -// testError is meant to be used as a deferred function to turn a panic(gobError) into a -// plain test.Error call. -func testError(t *testing.T) { - if e := recover(); e != nil { - t.Error(e.(gobError).err) // Will re-panic if not one of our errors, such as a runtime error. - } - return -} - -func newDecBuffer(data []byte) *decBuffer { - return &decBuffer{ - data: data, - } -} - -// Test basic encode/decode routines for unsigned integers -func TestUintCodec(t *testing.T) { - defer testError(t) - b := new(encBuffer) - encState := newEncoderState(b) - for _, tt := range encodeT { - b.Reset() - encState.encodeUint(tt.x) - if !bytes.Equal(tt.b, b.Bytes()) { - t.Errorf("encodeUint: %#x encode: expected % x got % x", tt.x, tt.b, b.Bytes()) - } - } - for u := uint64(0); ; u = (u + 1) * 7 { - b.Reset() - encState.encodeUint(u) - decState := newDecodeState(newDecBuffer(b.Bytes())) - v := decState.decodeUint() - if u != v { - t.Errorf("Encode/Decode: sent %#x received %#x", u, v) - } - if u&(1<<63) != 0 { - break - } - } -} - -func verifyInt(i int64, t *testing.T) { - defer testError(t) - var b = new(encBuffer) - encState := newEncoderState(b) - encState.encodeInt(i) - decState := newDecodeState(newDecBuffer(b.Bytes())) - decState.buf = make([]byte, 8) - j := decState.decodeInt() - if i != j { - t.Errorf("Encode/Decode: sent %#x received %#x", uint64(i), uint64(j)) - } -} - -// Test basic encode/decode routines for signed integers -func TestIntCodec(t *testing.T) { - for u := uint64(0); ; u = (u + 1) * 7 { - // Do positive and negative values - i := int64(u) - verifyInt(i, t) - verifyInt(-i, t) - verifyInt(^i, t) - if u&(1<<63) != 0 { - break - } - } - verifyInt(-1<<63, t) // a tricky case -} - -// The result of encoding a true boolean with field number 7 -var boolResult = []byte{0x07, 0x01} - -// The result of encoding a number 17 with field number 7 -var signedResult = []byte{0x07, 2 * 17} -var unsignedResult = []byte{0x07, 17} -var floatResult = []byte{0x07, 0xFE, 0x31, 0x40} - -// The result of encoding a number 17+19i with field number 7 -var complexResult = []byte{0x07, 0xFE, 0x31, 0x40, 0xFE, 0x33, 0x40} - -// The result of encoding "hello" with field number 7 -var bytesResult = []byte{0x07, 0x05, 'h', 'e', 'l', 'l', 'o'} - -func newDecodeState(buf *decBuffer) *decoderState { - d := new(decoderState) - d.b = buf - d.buf = make([]byte, uint64Size) - return d -} - -func newEncoderState(b *encBuffer) *encoderState { - b.Reset() - state := &encoderState{enc: nil, b: b} - state.fieldnum = -1 - return state -} - -// Test instruction execution for encoding. -// Do not run the machine yet; instead do individual instructions crafted by hand. -func TestScalarEncInstructions(t *testing.T) { - var b = new(encBuffer) - - // bool - { - var data bool = true - instr := &encInstr{encBool, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(boolResult, b.Bytes()) { - t.Errorf("bool enc instructions: expected % x got % x", boolResult, b.Bytes()) - } - } - - // int - { - b.Reset() - var data int = 17 - instr := &encInstr{encInt, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int enc instructions: expected % x got % x", signedResult, b.Bytes()) - } - } - - // uint - { - b.Reset() - var data uint = 17 - instr := &encInstr{encUint, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint enc instructions: expected % x got % x", unsignedResult, b.Bytes()) - } - } - - // int8 - { - b.Reset() - var data int8 = 17 - instr := &encInstr{encInt, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int8 enc instructions: expected % x got % x", signedResult, b.Bytes()) - } - } - - // uint8 - { - b.Reset() - var data uint8 = 17 - instr := &encInstr{encUint, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint8 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) - } - } - - // int16 - { - b.Reset() - var data int16 = 17 - instr := &encInstr{encInt, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int16 enc instructions: expected % x got % x", signedResult, b.Bytes()) - } - } - - // uint16 - { - b.Reset() - var data uint16 = 17 - instr := &encInstr{encUint, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint16 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) - } - } - - // int32 - { - b.Reset() - var data int32 = 17 - instr := &encInstr{encInt, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int32 enc instructions: expected % x got % x", signedResult, b.Bytes()) - } - } - - // uint32 - { - b.Reset() - var data uint32 = 17 - instr := &encInstr{encUint, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint32 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) - } - } - - // int64 - { - b.Reset() - var data int64 = 17 - instr := &encInstr{encInt, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(signedResult, b.Bytes()) { - t.Errorf("int64 enc instructions: expected % x got % x", signedResult, b.Bytes()) - } - } - - // uint64 - { - b.Reset() - var data uint64 = 17 - instr := &encInstr{encUint, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(unsignedResult, b.Bytes()) { - t.Errorf("uint64 enc instructions: expected % x got % x", unsignedResult, b.Bytes()) - } - } - - // float32 - { - b.Reset() - var data float32 = 17 - instr := &encInstr{encFloat, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(floatResult, b.Bytes()) { - t.Errorf("float32 enc instructions: expected % x got % x", floatResult, b.Bytes()) - } - } - - // float64 - { - b.Reset() - var data float64 = 17 - instr := &encInstr{encFloat, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(floatResult, b.Bytes()) { - t.Errorf("float64 enc instructions: expected % x got % x", floatResult, b.Bytes()) - } - } - - // bytes == []uint8 - { - b.Reset() - data := []byte("hello") - instr := &encInstr{encUint8Array, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(bytesResult, b.Bytes()) { - t.Errorf("bytes enc instructions: expected % x got % x", bytesResult, b.Bytes()) - } - } - - // string - { - b.Reset() - var data string = "hello" - instr := &encInstr{encString, 6, nil, 0} - state := newEncoderState(b) - instr.op(instr, state, reflect.ValueOf(data)) - if !bytes.Equal(bytesResult, b.Bytes()) { - t.Errorf("string enc instructions: expected % x got % x", bytesResult, b.Bytes()) - } - } -} - -func execDec(typ string, instr *decInstr, state *decoderState, t *testing.T, value reflect.Value) { - defer testError(t) - v := int(state.decodeUint()) - if v+state.fieldnum != 6 { - t.Fatalf("decoding field number %d, got %d", 6, v+state.fieldnum) - } - instr.op(instr, state, value.Elem()) - state.fieldnum = 6 -} - -func newDecodeStateFromData(data []byte) *decoderState { - b := newDecBuffer(data) - state := newDecodeState(b) - state.fieldnum = -1 - return state -} - -// Test instruction execution for decoding. -// Do not run the machine yet; instead do individual instructions crafted by hand. -func TestScalarDecInstructions(t *testing.T) { - ovfl := errors.New("overflow") - - // bool - { - var data bool - instr := &decInstr{decBool, 6, nil, ovfl} - state := newDecodeStateFromData(boolResult) - execDec("bool", instr, state, t, reflect.ValueOf(&data)) - if data != true { - t.Errorf("bool a = %v not true", data) - } - } - // int - { - var data int - instr := &decInstr{decOpTable[reflect.Int], 6, nil, ovfl} - state := newDecodeStateFromData(signedResult) - execDec("int", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("int a = %v not 17", data) - } - } - - // uint - { - var data uint - instr := &decInstr{decOpTable[reflect.Uint], 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uint", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uint a = %v not 17", data) - } - } - - // int8 - { - var data int8 - instr := &decInstr{decInt8, 6, nil, ovfl} - state := newDecodeStateFromData(signedResult) - execDec("int8", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("int8 a = %v not 17", data) - } - } - - // uint8 - { - var data uint8 - instr := &decInstr{decUint8, 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uint8", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uint8 a = %v not 17", data) - } - } - - // int16 - { - var data int16 - instr := &decInstr{decInt16, 6, nil, ovfl} - state := newDecodeStateFromData(signedResult) - execDec("int16", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("int16 a = %v not 17", data) - } - } - - // uint16 - { - var data uint16 - instr := &decInstr{decUint16, 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uint16", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uint16 a = %v not 17", data) - } - } - - // int32 - { - var data int32 - instr := &decInstr{decInt32, 6, nil, ovfl} - state := newDecodeStateFromData(signedResult) - execDec("int32", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("int32 a = %v not 17", data) - } - } - - // uint32 - { - var data uint32 - instr := &decInstr{decUint32, 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uint32", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uint32 a = %v not 17", data) - } - } - - // uintptr - { - var data uintptr - instr := &decInstr{decOpTable[reflect.Uintptr], 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uintptr", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uintptr a = %v not 17", data) - } - } - - // int64 - { - var data int64 - instr := &decInstr{decInt64, 6, nil, ovfl} - state := newDecodeStateFromData(signedResult) - execDec("int64", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("int64 a = %v not 17", data) - } - } - - // uint64 - { - var data uint64 - instr := &decInstr{decUint64, 6, nil, ovfl} - state := newDecodeStateFromData(unsignedResult) - execDec("uint64", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("uint64 a = %v not 17", data) - } - } - - // float32 - { - var data float32 - instr := &decInstr{decFloat32, 6, nil, ovfl} - state := newDecodeStateFromData(floatResult) - execDec("float32", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("float32 a = %v not 17", data) - } - } - - // float64 - { - var data float64 - instr := &decInstr{decFloat64, 6, nil, ovfl} - state := newDecodeStateFromData(floatResult) - execDec("float64", instr, state, t, reflect.ValueOf(&data)) - if data != 17 { - t.Errorf("float64 a = %v not 17", data) - } - } - - // complex64 - { - var data complex64 - instr := &decInstr{decOpTable[reflect.Complex64], 6, nil, ovfl} - state := newDecodeStateFromData(complexResult) - execDec("complex", instr, state, t, reflect.ValueOf(&data)) - if data != 17+19i { - t.Errorf("complex a = %v not 17+19i", data) - } - } - - // complex128 - { - var data complex128 - instr := &decInstr{decOpTable[reflect.Complex128], 6, nil, ovfl} - state := newDecodeStateFromData(complexResult) - execDec("complex", instr, state, t, reflect.ValueOf(&data)) - if data != 17+19i { - t.Errorf("complex a = %v not 17+19i", data) - } - } - - // bytes == []uint8 - { - var data []byte - instr := &decInstr{decUint8Slice, 6, nil, ovfl} - state := newDecodeStateFromData(bytesResult) - execDec("bytes", instr, state, t, reflect.ValueOf(&data)) - if string(data) != "hello" { - t.Errorf(`bytes a = %q not "hello"`, string(data)) - } - } - - // string - { - var data string - instr := &decInstr{decString, 6, nil, ovfl} - state := newDecodeStateFromData(bytesResult) - execDec("bytes", instr, state, t, reflect.ValueOf(&data)) - if data != "hello" { - t.Errorf(`bytes a = %q not "hello"`, data) - } - } -} - -func TestEndToEnd(t *testing.T) { - type T2 struct { - T string - } - s1 := "string1" - s2 := "string2" - type T1 struct { - A, B, C int - M map[string]*float64 - EmptyMap map[string]int // to check that we receive a non-nil map. - N *[3]float64 - Strs *[2]string - Int64s *[]int64 - RI complex64 - S string - Y []byte - T *T2 - } - pi := 3.14159 - e := 2.71828 - t1 := &T1{ - A: 17, - B: 18, - C: -5, - M: map[string]*float64{"pi": &pi, "e": &e}, - EmptyMap: make(map[string]int), - N: &[3]float64{1.5, 2.5, 3.5}, - Strs: &[2]string{s1, s2}, - Int64s: &[]int64{77, 89, 123412342134}, - RI: 17 - 23i, - S: "Now is the time", - Y: []byte("hello, sailor"), - T: &T2{"this is T2"}, - } - b := new(bytes.Buffer) - err := NewEncoder(b).Encode(t1) - if err != nil { - t.Error("encode:", err) - } - var _t1 T1 - err = NewDecoder(b).Decode(&_t1) - if err != nil { - t.Fatal("decode:", err) - } - if !reflect.DeepEqual(t1, &_t1) { - t.Errorf("encode expected %v got %v", *t1, _t1) - } - // Be absolutely sure the received map is non-nil. - if t1.EmptyMap == nil { - t.Errorf("nil map sent") - } - if _t1.EmptyMap == nil { - t.Errorf("nil map received") - } -} - -func TestOverflow(t *testing.T) { - type inputT struct { - Maxi int64 - Mini int64 - Maxu uint64 - Maxf float64 - Minf float64 - Maxc complex128 - Minc complex128 - } - var it inputT - var err error - b := new(bytes.Buffer) - enc := NewEncoder(b) - dec := NewDecoder(b) - - // int8 - b.Reset() - it = inputT{ - Maxi: math.MaxInt8 + 1, - } - type outi8 struct { - Maxi int8 - Mini int8 - } - var o1 outi8 - enc.Encode(it) - err = dec.Decode(&o1) - if err == nil || err.Error() != `value for "Maxi" out of range` { - t.Error("wrong overflow error for int8:", err) - } - it = inputT{ - Mini: math.MinInt8 - 1, - } - b.Reset() - enc.Encode(it) - err = dec.Decode(&o1) - if err == nil || err.Error() != `value for "Mini" out of range` { - t.Error("wrong underflow error for int8:", err) - } - - // int16 - b.Reset() - it = inputT{ - Maxi: math.MaxInt16 + 1, - } - type outi16 struct { - Maxi int16 - Mini int16 - } - var o2 outi16 - enc.Encode(it) - err = dec.Decode(&o2) - if err == nil || err.Error() != `value for "Maxi" out of range` { - t.Error("wrong overflow error for int16:", err) - } - it = inputT{ - Mini: math.MinInt16 - 1, - } - b.Reset() - enc.Encode(it) - err = dec.Decode(&o2) - if err == nil || err.Error() != `value for "Mini" out of range` { - t.Error("wrong underflow error for int16:", err) - } - - // int32 - b.Reset() - it = inputT{ - Maxi: math.MaxInt32 + 1, - } - type outi32 struct { - Maxi int32 - Mini int32 - } - var o3 outi32 - enc.Encode(it) - err = dec.Decode(&o3) - if err == nil || err.Error() != `value for "Maxi" out of range` { - t.Error("wrong overflow error for int32:", err) - } - it = inputT{ - Mini: math.MinInt32 - 1, - } - b.Reset() - enc.Encode(it) - err = dec.Decode(&o3) - if err == nil || err.Error() != `value for "Mini" out of range` { - t.Error("wrong underflow error for int32:", err) - } - - // uint8 - b.Reset() - it = inputT{ - Maxu: math.MaxUint8 + 1, - } - type outu8 struct { - Maxu uint8 - } - var o4 outu8 - enc.Encode(it) - err = dec.Decode(&o4) - if err == nil || err.Error() != `value for "Maxu" out of range` { - t.Error("wrong overflow error for uint8:", err) - } - - // uint16 - b.Reset() - it = inputT{ - Maxu: math.MaxUint16 + 1, - } - type outu16 struct { - Maxu uint16 - } - var o5 outu16 - enc.Encode(it) - err = dec.Decode(&o5) - if err == nil || err.Error() != `value for "Maxu" out of range` { - t.Error("wrong overflow error for uint16:", err) - } - - // uint32 - b.Reset() - it = inputT{ - Maxu: math.MaxUint32 + 1, - } - type outu32 struct { - Maxu uint32 - } - var o6 outu32 - enc.Encode(it) - err = dec.Decode(&o6) - if err == nil || err.Error() != `value for "Maxu" out of range` { - t.Error("wrong overflow error for uint32:", err) - } - - // float32 - b.Reset() - it = inputT{ - Maxf: math.MaxFloat32 * 2, - } - type outf32 struct { - Maxf float32 - Minf float32 - } - var o7 outf32 - enc.Encode(it) - err = dec.Decode(&o7) - if err == nil || err.Error() != `value for "Maxf" out of range` { - t.Error("wrong overflow error for float32:", err) - } - - // complex64 - b.Reset() - it = inputT{ - Maxc: complex(math.MaxFloat32*2, math.MaxFloat32*2), - } - type outc64 struct { - Maxc complex64 - Minc complex64 - } - var o8 outc64 - enc.Encode(it) - err = dec.Decode(&o8) - if err == nil || err.Error() != `value for "Maxc" out of range` { - t.Error("wrong overflow error for complex64:", err) - } -} - -func TestNesting(t *testing.T) { - type RT struct { - A string - Next *RT - } - rt := new(RT) - rt.A = "level1" - rt.Next = new(RT) - rt.Next.A = "level2" - b := new(bytes.Buffer) - NewEncoder(b).Encode(rt) - var drt RT - dec := NewDecoder(b) - err := dec.Decode(&drt) - if err != nil { - t.Fatal("decoder error:", err) - } - if drt.A != rt.A { - t.Errorf("nesting: encode expected %v got %v", *rt, drt) - } - if drt.Next == nil { - t.Errorf("nesting: recursion failed") - } - if drt.Next.A != rt.Next.A { - t.Errorf("nesting: encode expected %v got %v", *rt.Next, *drt.Next) - } -} - -// These three structures have the same data with different indirections -type T0 struct { - A int - B int - C int - D int -} -type T1 struct { - A int - B *int - C **int - D ***int -} -type T2 struct { - A ***int - B **int - C *int - D int -} - -func TestAutoIndirection(t *testing.T) { - // First transfer t1 into t0 - var t1 T1 - t1.A = 17 - t1.B = new(int) - *t1.B = 177 - t1.C = new(*int) - *t1.C = new(int) - **t1.C = 1777 - t1.D = new(**int) - *t1.D = new(*int) - **t1.D = new(int) - ***t1.D = 17777 - b := new(bytes.Buffer) - enc := NewEncoder(b) - enc.Encode(t1) - dec := NewDecoder(b) - var t0 T0 - dec.Decode(&t0) - if t0.A != 17 || t0.B != 177 || t0.C != 1777 || t0.D != 17777 { - t.Errorf("t1->t0: expected {17 177 1777 17777}; got %v", t0) - } - - // Now transfer t2 into t0 - var t2 T2 - t2.D = 17777 - t2.C = new(int) - *t2.C = 1777 - t2.B = new(*int) - *t2.B = new(int) - **t2.B = 177 - t2.A = new(**int) - *t2.A = new(*int) - **t2.A = new(int) - ***t2.A = 17 - b.Reset() - enc.Encode(t2) - t0 = T0{} - dec.Decode(&t0) - if t0.A != 17 || t0.B != 177 || t0.C != 1777 || t0.D != 17777 { - t.Errorf("t2->t0 expected {17 177 1777 17777}; got %v", t0) - } - - // Now transfer t0 into t1 - t0 = T0{17, 177, 1777, 17777} - b.Reset() - enc.Encode(t0) - t1 = T1{} - dec.Decode(&t1) - if t1.A != 17 || *t1.B != 177 || **t1.C != 1777 || ***t1.D != 17777 { - t.Errorf("t0->t1 expected {17 177 1777 17777}; got {%d %d %d %d}", t1.A, *t1.B, **t1.C, ***t1.D) - } - - // Now transfer t0 into t2 - b.Reset() - enc.Encode(t0) - t2 = T2{} - dec.Decode(&t2) - if ***t2.A != 17 || **t2.B != 177 || *t2.C != 1777 || t2.D != 17777 { - t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.A, **t2.B, *t2.C, t2.D) - } - - // Now do t2 again but without pre-allocated pointers. - b.Reset() - enc.Encode(t0) - ***t2.A = 0 - **t2.B = 0 - *t2.C = 0 - t2.D = 0 - dec.Decode(&t2) - if ***t2.A != 17 || **t2.B != 177 || *t2.C != 1777 || t2.D != 17777 { - t.Errorf("t0->t2 expected {17 177 1777 17777}; got {%d %d %d %d}", ***t2.A, **t2.B, *t2.C, t2.D) - } -} - -type RT0 struct { - A int - B string - C float64 -} -type RT1 struct { - C float64 - B string - A int - NotSet string -} - -func TestReorderedFields(t *testing.T) { - var rt0 RT0 - rt0.A = 17 - rt0.B = "hello" - rt0.C = 3.14159 - b := new(bytes.Buffer) - NewEncoder(b).Encode(rt0) - dec := NewDecoder(b) - var rt1 RT1 - // Wire type is RT0, local type is RT1. - err := dec.Decode(&rt1) - if err != nil { - t.Fatal("decode error:", err) - } - if rt0.A != rt1.A || rt0.B != rt1.B || rt0.C != rt1.C { - t.Errorf("rt1->rt0: expected %v; got %v", rt0, rt1) - } -} - -// Like an RT0 but with fields we'll ignore on the decode side. -type IT0 struct { - A int64 - B string - Ignore_d []int - Ignore_e [3]float64 - Ignore_f bool - Ignore_g string - Ignore_h []byte - Ignore_i *RT1 - Ignore_m map[string]int - C float64 -} - -func TestIgnoredFields(t *testing.T) { - var it0 IT0 - it0.A = 17 - it0.B = "hello" - it0.C = 3.14159 - it0.Ignore_d = []int{1, 2, 3} - it0.Ignore_e[0] = 1.0 - it0.Ignore_e[1] = 2.0 - it0.Ignore_e[2] = 3.0 - it0.Ignore_f = true - it0.Ignore_g = "pay no attention" - it0.Ignore_h = []byte("to the curtain") - it0.Ignore_i = &RT1{3.1, "hi", 7, "hello"} - it0.Ignore_m = map[string]int{"one": 1, "two": 2} - - b := new(bytes.Buffer) - NewEncoder(b).Encode(it0) - dec := NewDecoder(b) - var rt1 RT1 - // Wire type is IT0, local type is RT1. - err := dec.Decode(&rt1) - if err != nil { - t.Error("error: ", err) - } - if int(it0.A) != rt1.A || it0.B != rt1.B || it0.C != rt1.C { - t.Errorf("rt0->rt1: expected %v; got %v", it0, rt1) - } -} - -func TestBadRecursiveType(t *testing.T) { - type Rec ***Rec - var rec Rec - b := new(bytes.Buffer) - err := NewEncoder(b).Encode(&rec) - if err == nil { - t.Error("expected error; got none") - } else if strings.Index(err.Error(), "recursive") < 0 { - t.Error("expected recursive type error; got", err) - } - // Can't test decode easily because we can't encode one, so we can't pass one to a Decoder. -} - -type Indirect struct { - A ***[3]int - S ***[]int - M ****map[string]int -} - -type Direct struct { - A [3]int - S []int - M map[string]int -} - -func TestIndirectSliceMapArray(t *testing.T) { - // Marshal indirect, unmarshal to direct. - i := new(Indirect) - i.A = new(**[3]int) - *i.A = new(*[3]int) - **i.A = new([3]int) - ***i.A = [3]int{1, 2, 3} - i.S = new(**[]int) - *i.S = new(*[]int) - **i.S = new([]int) - ***i.S = []int{4, 5, 6} - i.M = new(***map[string]int) - *i.M = new(**map[string]int) - **i.M = new(*map[string]int) - ***i.M = new(map[string]int) - ****i.M = map[string]int{"one": 1, "two": 2, "three": 3} - b := new(bytes.Buffer) - NewEncoder(b).Encode(i) - dec := NewDecoder(b) - var d Direct - err := dec.Decode(&d) - if err != nil { - t.Error("error: ", err) - } - if len(d.A) != 3 || d.A[0] != 1 || d.A[1] != 2 || d.A[2] != 3 { - t.Errorf("indirect to direct: d.A is %v not %v", d.A, ***i.A) - } - if len(d.S) != 3 || d.S[0] != 4 || d.S[1] != 5 || d.S[2] != 6 { - t.Errorf("indirect to direct: d.S is %v not %v", d.S, ***i.S) - } - if len(d.M) != 3 || d.M["one"] != 1 || d.M["two"] != 2 || d.M["three"] != 3 { - t.Errorf("indirect to direct: d.M is %v not %v", d.M, ***i.M) - } - // Marshal direct, unmarshal to indirect. - d.A = [3]int{11, 22, 33} - d.S = []int{44, 55, 66} - d.M = map[string]int{"four": 4, "five": 5, "six": 6} - i = new(Indirect) - b.Reset() - NewEncoder(b).Encode(d) - dec = NewDecoder(b) - err = dec.Decode(&i) - if err != nil { - t.Fatal("error: ", err) - } - if len(***i.A) != 3 || (***i.A)[0] != 11 || (***i.A)[1] != 22 || (***i.A)[2] != 33 { - t.Errorf("direct to indirect: ***i.A is %v not %v", ***i.A, d.A) - } - if len(***i.S) != 3 || (***i.S)[0] != 44 || (***i.S)[1] != 55 || (***i.S)[2] != 66 { - t.Errorf("direct to indirect: ***i.S is %v not %v", ***i.S, ***i.S) - } - if len(****i.M) != 3 || (****i.M)["four"] != 4 || (****i.M)["five"] != 5 || (****i.M)["six"] != 6 { - t.Errorf("direct to indirect: ****i.M is %v not %v", ****i.M, d.M) - } -} - -// An interface with several implementations -type Squarer interface { - Square() int -} - -type Int int - -func (i Int) Square() int { - return int(i * i) -} - -type Float float64 - -func (f Float) Square() int { - return int(f * f) -} - -type Vector []int - -func (v Vector) Square() int { - sum := 0 - for _, x := range v { - sum += x * x - } - return sum -} - -type Point struct { - X, Y int -} - -func (p Point) Square() int { - return p.X*p.X + p.Y*p.Y -} - -// A struct with interfaces in it. -type InterfaceItem struct { - I int - Sq1, Sq2, Sq3 Squarer - F float64 - Sq []Squarer -} - -// The same struct without interfaces -type NoInterfaceItem struct { - I int - F float64 -} - -func TestInterface(t *testing.T) { - iVal := Int(3) - fVal := Float(5) - // Sending a Vector will require that the receiver define a type in the middle of - // receiving the value for item2. - vVal := Vector{1, 2, 3} - b := new(bytes.Buffer) - item1 := &InterfaceItem{1, iVal, fVal, vVal, 11.5, []Squarer{iVal, fVal, nil, vVal}} - // Register the types. - Register(Int(0)) - Register(Float(0)) - Register(Vector{}) - err := NewEncoder(b).Encode(item1) - if err != nil { - t.Error("expected no encode error; got", err) - } - - item2 := InterfaceItem{} - err = NewDecoder(b).Decode(&item2) - if err != nil { - t.Fatal("decode:", err) - } - if item2.I != item1.I { - t.Error("normal int did not decode correctly") - } - if item2.Sq1 == nil || item2.Sq1.Square() != iVal.Square() { - t.Error("Int did not decode correctly") - } - if item2.Sq2 == nil || item2.Sq2.Square() != fVal.Square() { - t.Error("Float did not decode correctly") - } - if item2.Sq3 == nil || item2.Sq3.Square() != vVal.Square() { - t.Error("Vector did not decode correctly") - } - if item2.F != item1.F { - t.Error("normal float did not decode correctly") - } - // Now check that we received a slice of Squarers correctly, including a nil element - if len(item1.Sq) != len(item2.Sq) { - t.Fatalf("[]Squarer length wrong: got %d; expected %d", len(item2.Sq), len(item1.Sq)) - } - for i, v1 := range item1.Sq { - v2 := item2.Sq[i] - if v1 == nil || v2 == nil { - if v1 != nil || v2 != nil { - t.Errorf("item %d inconsistent nils", i) - } - } else if v1.Square() != v2.Square() { - t.Errorf("item %d inconsistent values: %v %v", i, v1, v2) - } - } -} - -// A struct with all basic types, stored in interfaces. -type BasicInterfaceItem struct { - Int, Int8, Int16, Int32, Int64 interface{} - Uint, Uint8, Uint16, Uint32, Uint64 interface{} - Float32, Float64 interface{} - Complex64, Complex128 interface{} - Bool interface{} - String interface{} - Bytes interface{} -} - -func TestInterfaceBasic(t *testing.T) { - b := new(bytes.Buffer) - item1 := &BasicInterfaceItem{ - int(1), int8(1), int16(1), int32(1), int64(1), - uint(1), uint8(1), uint16(1), uint32(1), uint64(1), - float32(1), 1.0, - complex64(1i), complex128(1i), - true, - "hello", - []byte("sailor"), - } - err := NewEncoder(b).Encode(item1) - if err != nil { - t.Error("expected no encode error; got", err) - } - - item2 := &BasicInterfaceItem{} - err = NewDecoder(b).Decode(&item2) - if err != nil { - t.Fatal("decode:", err) - } - if !reflect.DeepEqual(item1, item2) { - t.Errorf("encode expected %v got %v", item1, item2) - } - // Hand check a couple for correct types. - if v, ok := item2.Bool.(bool); !ok || !v { - t.Error("boolean should be true") - } - if v, ok := item2.String.(string); !ok || v != item1.String.(string) { - t.Errorf("string should be %v is %v", item1.String, v) - } -} - -type String string - -type PtrInterfaceItem struct { - Str1 interface{} // basic - Str2 interface{} // derived -} - -// We'll send pointers; should receive values. -// Also check that we can register T but send *T. -func TestInterfacePointer(t *testing.T) { - b := new(bytes.Buffer) - str1 := "howdy" - str2 := String("kiddo") - item1 := &PtrInterfaceItem{ - &str1, - &str2, - } - // Register the type. - Register(str2) - err := NewEncoder(b).Encode(item1) - if err != nil { - t.Error("expected no encode error; got", err) - } - - item2 := &PtrInterfaceItem{} - err = NewDecoder(b).Decode(&item2) - if err != nil { - t.Fatal("decode:", err) - } - // Hand test for correct types and values. - if v, ok := item2.Str1.(string); !ok || v != str1 { - t.Errorf("basic string failed: %q should be %q", v, str1) - } - if v, ok := item2.Str2.(String); !ok || v != str2 { - t.Errorf("derived type String failed: %q should be %q", v, str2) - } -} - -func TestIgnoreInterface(t *testing.T) { - iVal := Int(3) - fVal := Float(5) - // Sending a Point will require that the receiver define a type in the middle of - // receiving the value for item2. - pVal := Point{2, 3} - b := new(bytes.Buffer) - item1 := &InterfaceItem{1, iVal, fVal, pVal, 11.5, nil} - // Register the types. - Register(Int(0)) - Register(Float(0)) - Register(Point{}) - err := NewEncoder(b).Encode(item1) - if err != nil { - t.Error("expected no encode error; got", err) - } - - item2 := NoInterfaceItem{} - err = NewDecoder(b).Decode(&item2) - if err != nil { - t.Fatal("decode:", err) - } - if item2.I != item1.I { - t.Error("normal int did not decode correctly") - } - if item2.F != item2.F { - t.Error("normal float did not decode correctly") - } -} - -type U struct { - A int - B string - c float64 - D uint -} - -func TestUnexportedFields(t *testing.T) { - var u0 U - u0.A = 17 - u0.B = "hello" - u0.c = 3.14159 - u0.D = 23 - b := new(bytes.Buffer) - NewEncoder(b).Encode(u0) - dec := NewDecoder(b) - var u1 U - u1.c = 1234. - err := dec.Decode(&u1) - if err != nil { - t.Fatal("decode error:", err) - } - if u0.A != u0.A || u0.B != u1.B || u0.D != u1.D { - t.Errorf("u1->u0: expected %v; got %v", u0, u1) - } - if u1.c != 1234. { - t.Error("u1.c modified") - } -} - -var singletons = []interface{}{ - true, - 7, - 3.2, - "hello", - [3]int{11, 22, 33}, - []float32{0.5, 0.25, 0.125}, - map[string]int{"one": 1, "two": 2}, -} - -func TestDebugSingleton(t *testing.T) { - if debugFunc == nil { - return - } - b := new(bytes.Buffer) - // Accumulate a number of values and print them out all at once. - for _, x := range singletons { - err := NewEncoder(b).Encode(x) - if err != nil { - t.Fatal("encode:", err) - } - } - debugFunc(b) -} - -// A type that won't be defined in the gob until we send it in an interface value. -type OnTheFly struct { - A int -} - -type DT struct { - // X OnTheFly - A int - B string - C float64 - I interface{} - J interface{} - I_nil interface{} - M map[string]int - T [3]int - S []string -} - -func newDT() DT { - var dt DT - dt.A = 17 - dt.B = "hello" - dt.C = 3.14159 - dt.I = 271828 - dt.J = OnTheFly{3} - dt.I_nil = nil - dt.M = map[string]int{"one": 1, "two": 2} - dt.T = [3]int{11, 22, 33} - dt.S = []string{"hi", "joe"} - return dt -} - -func TestDebugStruct(t *testing.T) { - if debugFunc == nil { - return - } - Register(OnTheFly{}) - dt := newDT() - b := new(bytes.Buffer) - err := NewEncoder(b).Encode(dt) - if err != nil { - t.Fatal("encode:", err) - } - debugBuffer := bytes.NewBuffer(b.Bytes()) - dt2 := &DT{} - err = NewDecoder(b).Decode(&dt2) - if err != nil { - t.Error("decode:", err) - } - debugFunc(debugBuffer) -} - -func encFuzzDec(rng *rand.Rand, in interface{}) error { - buf := new(bytes.Buffer) - enc := NewEncoder(buf) - if err := enc.Encode(&in); err != nil { - return err - } - - b := buf.Bytes() - for i, bi := range b { - if rng.Intn(10) < 3 { - b[i] = bi + uint8(rng.Intn(256)) - } - } - - dec := NewDecoder(buf) - var e interface{} - if err := dec.Decode(&e); err != nil { - return err - } - return nil -} - -// This does some "fuzz testing" by attempting to decode a sequence of random bytes. -func TestFuzz(t *testing.T) { - if !*doFuzzTests { - t.Logf("disabled; run with -gob.fuzz to enable") - return - } - - // all possible inputs - input := []interface{}{ - new(int), - new(float32), - new(float64), - new(complex128), - &ByteStruct{255}, - &ArrayStruct{}, - &StringStruct{"hello"}, - &GobTest1{0, &StringStruct{"hello"}}, - } - testFuzz(t, time.Now().UnixNano(), 100, input...) -} - -func TestFuzzRegressions(t *testing.T) { - if !*doFuzzTests { - t.Logf("disabled; run with -gob.fuzz to enable") - return - } - - // An instance triggering a type name of length ~102 GB. - testFuzz(t, 1328492090837718000, 100, new(float32)) - // An instance triggering a type name of 1.6 GB. - // Note: can take several minutes to run. - testFuzz(t, 1330522872628565000, 100, new(int)) -} - -func testFuzz(t *testing.T, seed int64, n int, input ...interface{}) { - for _, e := range input { - t.Logf("seed=%d n=%d e=%T", seed, n, e) - rng := rand.New(rand.NewSource(seed)) - for i := 0; i < n; i++ { - encFuzzDec(rng, e) - } - } -} - -// TestFuzzOneByte tries to decode corrupted input sequences -// and checks that no panic occurs. -func TestFuzzOneByte(t *testing.T) { - buf := new(bytes.Buffer) - Register(OnTheFly{}) - dt := newDT() - if err := NewEncoder(buf).Encode(dt); err != nil { - t.Fatal(err) - } - s := buf.String() - - indices := make([]int, 0, len(s)) - for i := 0; i < len(s); i++ { - switch i { - case 14, 167, 231, 265: // a slice length, corruptions are not handled yet. - continue - } - indices = append(indices, i) - } - if testing.Short() { - indices = []int{1, 111, 178} // known fixed panics - } - for _, i := range indices { - for j := 0; j < 256; j += 3 { - b := []byte(s) - b[i] ^= byte(j) - var e DT - func() { - defer func() { - if p := recover(); p != nil { - t.Errorf("crash for b[%d] ^= 0x%x", i, j) - panic(p) - } - }() - err := NewDecoder(bytes.NewReader(b)).Decode(&e) - _ = err - }() - } - } -} - -// Don't crash, just give error with invalid type id. -// Issue 9649. -func TestErrorInvalidTypeId(t *testing.T) { - data := []byte{0x01, 0x00, 0x01, 0x00} - d := NewDecoder(bytes.NewReader(data)) - // When running d.Decode(&foo) the first time the decoder stops - // after []byte{0x01, 0x00} and reports an errBadType. Running - // d.Decode(&foo) again on exactly the same input sequence should - // give another errBadType, but instead caused a panic because - // decoderMap wasn't cleaned up properly after the first error. - for i := 0; i < 2; i++ { - var foo struct{} - err := d.Decode(&foo) - if err != errBadType { - t.Fatal("decode: expected %s, got %s", errBadType, err) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/debug.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/debug.go deleted file mode 100644 index 536bbdb5ac6a5397330a21d3c5e5743e826e3ad4..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/debug.go +++ /dev/null @@ -1,705 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Delete the next line to include in the gob package. -// +build ignore - -package gob - -// This file is not normally included in the gob package. Used only for debugging the package itself. -// Except for reading uints, it is an implementation of a reader that is independent of -// the one implemented by Decoder. -// To enable the Debug function, delete the +build ignore line above and do -// go install - -import ( - "bytes" - "fmt" - "io" - "os" - "strings" - "sync" -) - -var dumpBytes = false // If true, print the remaining bytes in the input buffer at each item. - -// Init installs the debugging facility. If this file is not compiled in the -// package, the tests in codec_test.go are no-ops. -func init() { - debugFunc = Debug -} - -var ( - blanks = bytes.Repeat([]byte{' '}, 3*10) - empty = []byte(": \n") - tabs = strings.Repeat("\t", 100) -) - -// tab indents itself when printed. -type tab int - -func (t tab) String() string { - n := int(t) - if n > len(tabs) { - n = len(tabs) - } - return tabs[0:n] -} - -func (t tab) print() { - fmt.Fprint(os.Stderr, t) -} - -// A peekReader wraps an io.Reader, allowing one to peek ahead to see -// what's coming without stealing the data from the client of the Reader. -type peekReader struct { - r io.Reader - data []byte // read-ahead data -} - -// newPeekReader returns a peekReader that wraps r. -func newPeekReader(r io.Reader) *peekReader { - return &peekReader{r: r} -} - -// Read is the usual method. It will first take data that has been read ahead. -func (p *peekReader) Read(b []byte) (n int, err error) { - if len(p.data) == 0 { - return p.r.Read(b) - } - // Satisfy what's possible from the read-ahead data. - n = copy(b, p.data) - // Move data down to beginning of slice, to avoid endless growth - copy(p.data, p.data[n:]) - p.data = p.data[:len(p.data)-n] - return -} - -// peek returns as many bytes as possible from the unread -// portion of the stream, up to the length of b. -func (p *peekReader) peek(b []byte) (n int, err error) { - if len(p.data) > 0 { - n = copy(b, p.data) - if n == len(b) { - return - } - b = b[n:] - } - if len(b) == 0 { - return - } - m, e := io.ReadFull(p.r, b) - if m > 0 { - p.data = append(p.data, b[:m]...) - } - n += m - if e == io.ErrUnexpectedEOF { - // That means m > 0 but we reached EOF. If we got data - // we won't complain about not being able to peek enough. - if n > 0 { - e = nil - } else { - e = io.EOF - } - } - return n, e -} - -type debugger struct { - mutex sync.Mutex - remain int // the number of bytes known to remain in the input - remainingKnown bool // the value of 'remain' is valid - r *peekReader - wireType map[typeId]*wireType - tmp []byte // scratch space for decoding uints. -} - -// dump prints the next nBytes of the input. -// It arranges to print the output aligned from call to -// call, to make it easy to see what has been consumed. -func (deb *debugger) dump(format string, args ...interface{}) { - if !dumpBytes { - return - } - fmt.Fprintf(os.Stderr, format+" ", args...) - if !deb.remainingKnown { - return - } - if deb.remain < 0 { - fmt.Fprintf(os.Stderr, "remaining byte count is negative! %d\n", deb.remain) - return - } - data := make([]byte, deb.remain) - n, _ := deb.r.peek(data) - if n == 0 { - os.Stderr.Write(empty) - return - } - b := new(bytes.Buffer) - fmt.Fprintf(b, "[%d]{\n", deb.remain) - // Blanks until first byte - lineLength := 0 - if n := len(data); n%10 != 0 { - lineLength = 10 - n%10 - fmt.Fprintf(b, "\t%s", blanks[:lineLength*3]) - } - // 10 bytes per line - for len(data) > 0 { - if lineLength == 0 { - fmt.Fprint(b, "\t") - } - m := 10 - lineLength - lineLength = 0 - if m > len(data) { - m = len(data) - } - fmt.Fprintf(b, "% x\n", data[:m]) - data = data[m:] - } - fmt.Fprint(b, "}\n") - os.Stderr.Write(b.Bytes()) -} - -// Debug prints a human-readable representation of the gob data read from r. -// It is a no-op unless debugging was enabled when the package was built. -func Debug(r io.Reader) { - err := debug(r) - if err != nil { - fmt.Fprintf(os.Stderr, "gob debug: %s\n", err) - } -} - -// debug implements Debug, but catches panics and returns -// them as errors to be printed by Debug. -func debug(r io.Reader) (err error) { - defer catchError(&err) - fmt.Fprintln(os.Stderr, "Start of debugging") - deb := &debugger{ - r: newPeekReader(r), - wireType: make(map[typeId]*wireType), - tmp: make([]byte, 16), - } - if b, ok := r.(*bytes.Buffer); ok { - deb.remain = b.Len() - deb.remainingKnown = true - } - deb.gobStream() - return -} - -// note that we've consumed some bytes -func (deb *debugger) consumed(n int) { - if deb.remainingKnown { - deb.remain -= n - } -} - -// int64 decodes and returns the next integer, which must be present. -// Don't call this if you could be at EOF. -func (deb *debugger) int64() int64 { - return toInt(deb.uint64()) -} - -// uint64 returns and decodes the next unsigned integer, which must be present. -// Don't call this if you could be at EOF. -// TODO: handle errors better. -func (deb *debugger) uint64() uint64 { - n, w, err := decodeUintReader(deb.r, deb.tmp) - if err != nil { - errorf("debug: read error: %s", err) - } - deb.consumed(w) - return n -} - -// GobStream: -// DelimitedMessage* (until EOF) -func (deb *debugger) gobStream() { - // Make sure we're single-threaded through here. - deb.mutex.Lock() - defer deb.mutex.Unlock() - - for deb.delimitedMessage(0) { - } -} - -// DelimitedMessage: -// uint(lengthOfMessage) Message -func (deb *debugger) delimitedMessage(indent tab) bool { - for { - n := deb.loadBlock(true) - if n < 0 { - return false - } - deb.dump("Delimited message of length %d", n) - deb.message(indent) - } - return true -} - -// loadBlock preps us to read a message -// of the length specified next in the input. It returns -// the length of the block. The argument tells whether -// an EOF is acceptable now. If it is and one is found, -// the return value is negative. -func (deb *debugger) loadBlock(eofOK bool) int { - n64, w, err := decodeUintReader(deb.r, deb.tmp) // deb.uint64 will error at EOF - if err != nil { - if eofOK && err == io.EOF { - return -1 - } - errorf("debug: unexpected error: %s", err) - } - deb.consumed(w) - n := int(n64) - if n < 0 { - errorf("huge value for message length: %d", n64) - } - return int(n) -} - -// Message: -// TypeSequence TypedValue -// TypeSequence -// (TypeDefinition DelimitedTypeDefinition*)? -// DelimitedTypeDefinition: -// uint(lengthOfTypeDefinition) TypeDefinition -// TypedValue: -// int(typeId) Value -func (deb *debugger) message(indent tab) bool { - for { - // Convert the uint64 to a signed integer typeId - uid := deb.int64() - id := typeId(uid) - deb.dump("type id=%d", id) - if id < 0 { - deb.typeDefinition(indent, -id) - n := deb.loadBlock(false) - deb.dump("Message of length %d", n) - continue - } else { - deb.value(indent, id) - break - } - } - return true -} - -// Helper methods to make it easy to scan a type descriptor. - -// common returns the CommonType at the input point. -func (deb *debugger) common() CommonType { - fieldNum := -1 - name := "" - id := typeId(0) - for { - delta := deb.delta(-1) - if delta == 0 { - break - } - fieldNum += delta - switch fieldNum { - case 0: - name = deb.string() - case 1: - // Id typeId - id = deb.typeId() - default: - errorf("corrupted CommonType, delta is %d fieldNum is %d", delta, fieldNum) - } - } - return CommonType{name, id} -} - -// uint returns the unsigned int at the input point, as a uint (not uint64). -func (deb *debugger) uint() uint { - return uint(deb.uint64()) -} - -// int returns the signed int at the input point, as an int (not int64). -func (deb *debugger) int() int { - return int(deb.int64()) -} - -// typeId returns the type id at the input point. -func (deb *debugger) typeId() typeId { - return typeId(deb.int64()) -} - -// string returns the string at the input point. -func (deb *debugger) string() string { - x := int(deb.uint64()) - b := make([]byte, x) - nb, _ := deb.r.Read(b) - if nb != x { - errorf("corrupted type") - } - deb.consumed(nb) - return string(b) -} - -// delta returns the field delta at the input point. The expect argument, -// if non-negative, identifies what the value should be. -func (deb *debugger) delta(expect int) int { - delta := int(deb.uint64()) - if delta < 0 || (expect >= 0 && delta != expect) { - errorf("decode: corrupted type: delta %d expected %d", delta, expect) - } - return delta -} - -// TypeDefinition: -// [int(-typeId) (already read)] encodingOfWireType -func (deb *debugger) typeDefinition(indent tab, id typeId) { - deb.dump("type definition for id %d", id) - // Encoding is of a wireType. Decode the structure as usual - fieldNum := -1 - wire := new(wireType) - // A wireType defines a single field. - delta := deb.delta(-1) - fieldNum += delta - switch fieldNum { - case 0: // array type, one field of {{Common}, elem, length} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - // Field number 1 is type Id of elem - deb.delta(1) - id := deb.typeId() - // Field number 3 is length - deb.delta(1) - length := deb.int() - wire.ArrayT = &arrayType{com, id, length} - - case 1: // slice type, one field of {{Common}, elem} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - // Field number 1 is type Id of elem - deb.delta(1) - id := deb.typeId() - wire.SliceT = &sliceType{com, id} - - case 2: // struct type, one field of {{Common}, []fieldType} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - // Field number 1 is slice of FieldType - deb.delta(1) - numField := int(deb.uint()) - field := make([]*fieldType, numField) - for i := 0; i < numField; i++ { - field[i] = new(fieldType) - deb.delta(1) // field 0 of fieldType: name - field[i].Name = deb.string() - deb.delta(1) // field 1 of fieldType: id - field[i].Id = deb.typeId() - deb.delta(0) // end of fieldType - } - wire.StructT = &structType{com, field} - - case 3: // map type, one field of {{Common}, key, elem} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - // Field number 1 is type Id of key - deb.delta(1) - keyId := deb.typeId() - // Field number 2 is type Id of elem - deb.delta(1) - elemId := deb.typeId() - wire.MapT = &mapType{com, keyId, elemId} - case 4: // GobEncoder type, one field of {{Common}} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - wire.GobEncoderT = &gobEncoderType{com} - case 5: // BinaryMarshaler type, one field of {{Common}} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - wire.BinaryMarshalerT = &gobEncoderType{com} - case 6: // TextMarshaler type, one field of {{Common}} - // Field number 0 is CommonType - deb.delta(1) - com := deb.common() - wire.TextMarshalerT = &gobEncoderType{com} - default: - errorf("bad field in type %d", fieldNum) - } - deb.printWireType(indent, wire) - deb.delta(0) // end inner type (arrayType, etc.) - deb.delta(0) // end wireType - // Remember we've seen this type. - deb.wireType[id] = wire -} - -// Value: -// SingletonValue | StructValue -func (deb *debugger) value(indent tab, id typeId) { - wire, ok := deb.wireType[id] - if ok && wire.StructT != nil { - deb.structValue(indent, id) - } else { - deb.singletonValue(indent, id) - } -} - -// SingletonValue: -// uint(0) FieldValue -func (deb *debugger) singletonValue(indent tab, id typeId) { - deb.dump("Singleton value") - // is it a builtin type? - wire := deb.wireType[id] - _, ok := builtinIdToType[id] - if !ok && wire == nil { - errorf("type id %d not defined", id) - } - m := deb.uint64() - if m != 0 { - errorf("expected zero; got %d", m) - } - deb.fieldValue(indent, id) -} - -// InterfaceValue: -// NilInterfaceValue | NonNilInterfaceValue -func (deb *debugger) interfaceValue(indent tab) { - deb.dump("Start of interface value") - if nameLen := deb.uint64(); nameLen == 0 { - deb.nilInterfaceValue(indent) - } else { - deb.nonNilInterfaceValue(indent, int(nameLen)) - } -} - -// NilInterfaceValue: -// uint(0) [already read] -func (deb *debugger) nilInterfaceValue(indent tab) int { - fmt.Fprintf(os.Stderr, "%snil interface\n", indent) - return 0 -} - -// NonNilInterfaceValue: -// ConcreteTypeName TypeSequence InterfaceContents -// ConcreteTypeName: -// uint(lengthOfName) [already read=n] name -// InterfaceContents: -// int(concreteTypeId) DelimitedValue -// DelimitedValue: -// uint(length) Value -func (deb *debugger) nonNilInterfaceValue(indent tab, nameLen int) { - // ConcreteTypeName - b := make([]byte, nameLen) - deb.r.Read(b) // TODO: CHECK THESE READS!! - deb.consumed(nameLen) - name := string(b) - - for { - id := deb.typeId() - if id < 0 { - deb.typeDefinition(indent, -id) - n := deb.loadBlock(false) - deb.dump("Nested message of length %d", n) - } else { - // DelimitedValue - x := deb.uint64() // in case we want to ignore the value; we don't. - fmt.Fprintf(os.Stderr, "%sinterface value, type %q id=%d; valueLength %d\n", indent, name, id, x) - deb.value(indent, id) - break - } - } -} - -// printCommonType prints a common type; used by printWireType. -func (deb *debugger) printCommonType(indent tab, kind string, common *CommonType) { - indent.print() - fmt.Fprintf(os.Stderr, "%s %q id=%d\n", kind, common.Name, common.Id) -} - -// printWireType prints the contents of a wireType. -func (deb *debugger) printWireType(indent tab, wire *wireType) { - fmt.Fprintf(os.Stderr, "%stype definition {\n", indent) - indent++ - switch { - case wire.ArrayT != nil: - deb.printCommonType(indent, "array", &wire.ArrayT.CommonType) - fmt.Fprintf(os.Stderr, "%slen %d\n", indent+1, wire.ArrayT.Len) - fmt.Fprintf(os.Stderr, "%selemid %d\n", indent+1, wire.ArrayT.Elem) - case wire.MapT != nil: - deb.printCommonType(indent, "map", &wire.MapT.CommonType) - fmt.Fprintf(os.Stderr, "%skey id=%d\n", indent+1, wire.MapT.Key) - fmt.Fprintf(os.Stderr, "%selem id=%d\n", indent+1, wire.MapT.Elem) - case wire.SliceT != nil: - deb.printCommonType(indent, "slice", &wire.SliceT.CommonType) - fmt.Fprintf(os.Stderr, "%selem id=%d\n", indent+1, wire.SliceT.Elem) - case wire.StructT != nil: - deb.printCommonType(indent, "struct", &wire.StructT.CommonType) - for i, field := range wire.StructT.Field { - fmt.Fprintf(os.Stderr, "%sfield %d:\t%s\tid=%d\n", indent+1, i, field.Name, field.Id) - } - case wire.GobEncoderT != nil: - deb.printCommonType(indent, "GobEncoder", &wire.GobEncoderT.CommonType) - } - indent-- - fmt.Fprintf(os.Stderr, "%s}\n", indent) -} - -// fieldValue prints a value of any type, such as a struct field. -// FieldValue: -// builtinValue | ArrayValue | MapValue | SliceValue | StructValue | InterfaceValue -func (deb *debugger) fieldValue(indent tab, id typeId) { - _, ok := builtinIdToType[id] - if ok { - if id == tInterface { - deb.interfaceValue(indent) - } else { - deb.printBuiltin(indent, id) - } - return - } - wire, ok := deb.wireType[id] - if !ok { - errorf("type id %d not defined", id) - } - switch { - case wire.ArrayT != nil: - deb.arrayValue(indent, wire) - case wire.MapT != nil: - deb.mapValue(indent, wire) - case wire.SliceT != nil: - deb.sliceValue(indent, wire) - case wire.StructT != nil: - deb.structValue(indent, id) - case wire.GobEncoderT != nil: - deb.gobEncoderValue(indent, id) - default: - panic("bad wire type for field") - } -} - -// printBuiltin prints a value not of a fundamental type, that is, -// one whose type is known to gobs at bootstrap time. -func (deb *debugger) printBuiltin(indent tab, id typeId) { - switch id { - case tBool: - x := deb.int64() - if x == 0 { - fmt.Fprintf(os.Stderr, "%sfalse\n", indent) - } else { - fmt.Fprintf(os.Stderr, "%strue\n", indent) - } - case tInt: - x := deb.int64() - fmt.Fprintf(os.Stderr, "%s%d\n", indent, x) - case tUint: - x := deb.int64() - fmt.Fprintf(os.Stderr, "%s%d\n", indent, x) - case tFloat: - x := deb.uint64() - fmt.Fprintf(os.Stderr, "%s%g\n", indent, float64FromBits(x)) - case tComplex: - r := deb.uint64() - i := deb.uint64() - fmt.Fprintf(os.Stderr, "%s%g+%gi\n", indent, float64FromBits(r), float64FromBits(i)) - case tBytes: - x := int(deb.uint64()) - b := make([]byte, x) - deb.r.Read(b) - deb.consumed(x) - fmt.Fprintf(os.Stderr, "%s{% x}=%q\n", indent, b, b) - case tString: - x := int(deb.uint64()) - b := make([]byte, x) - deb.r.Read(b) - deb.consumed(x) - fmt.Fprintf(os.Stderr, "%s%q\n", indent, b) - default: - panic("unknown builtin") - } -} - -// ArrayValue: -// uint(n) FieldValue*n -func (deb *debugger) arrayValue(indent tab, wire *wireType) { - elemId := wire.ArrayT.Elem - u := deb.uint64() - length := int(u) - for i := 0; i < length; i++ { - deb.fieldValue(indent, elemId) - } - if length != wire.ArrayT.Len { - fmt.Fprintf(os.Stderr, "%s(wrong length for array: %d should be %d)\n", indent, length, wire.ArrayT.Len) - } -} - -// MapValue: -// uint(n) (FieldValue FieldValue)*n [n (key, value) pairs] -func (deb *debugger) mapValue(indent tab, wire *wireType) { - keyId := wire.MapT.Key - elemId := wire.MapT.Elem - u := deb.uint64() - length := int(u) - for i := 0; i < length; i++ { - deb.fieldValue(indent+1, keyId) - deb.fieldValue(indent+1, elemId) - } -} - -// SliceValue: -// uint(n) (n FieldValue) -func (deb *debugger) sliceValue(indent tab, wire *wireType) { - elemId := wire.SliceT.Elem - u := deb.uint64() - length := int(u) - deb.dump("Start of slice of length %d", length) - - for i := 0; i < length; i++ { - deb.fieldValue(indent, elemId) - } -} - -// StructValue: -// (uint(fieldDelta) FieldValue)* -func (deb *debugger) structValue(indent tab, id typeId) { - deb.dump("Start of struct value of %q id=%d\n<<\n", id.name(), id) - fmt.Fprintf(os.Stderr, "%s%s struct {\n", indent, id.name()) - wire, ok := deb.wireType[id] - if !ok { - errorf("type id %d not defined", id) - } - strct := wire.StructT - fieldNum := -1 - indent++ - for { - delta := deb.uint64() - if delta == 0 { // struct terminator is zero delta fieldnum - break - } - fieldNum += int(delta) - if fieldNum < 0 || fieldNum >= len(strct.Field) { - deb.dump("field number out of range: prevField=%d delta=%d", fieldNum-int(delta), delta) - break - } - fmt.Fprintf(os.Stderr, "%sfield %d:\t%s\n", indent, fieldNum, wire.StructT.Field[fieldNum].Name) - deb.fieldValue(indent+1, strct.Field[fieldNum].Id) - } - indent-- - fmt.Fprintf(os.Stderr, "%s} // end %s struct\n", indent, id.name()) - deb.dump(">> End of struct value of type %d %q", id, id.name()) -} - -// GobEncoderValue: -// uint(n) byte*n -func (deb *debugger) gobEncoderValue(indent tab, id typeId) { - len := deb.uint64() - deb.dump("GobEncoder value of %q id=%d, length %d\n", id.name(), id, len) - fmt.Fprintf(os.Stderr, "%s%s (implements GobEncoder)\n", indent, id.name()) - data := make([]byte, len) - _, err := deb.r.Read(data) - if err != nil { - errorf("gobEncoder data read: %s", err) - } - fmt.Fprintf(os.Stderr, "%s[% .2x]\n", indent+1, data) -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/dec_helpers.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/dec_helpers.go deleted file mode 100644 index a1b67661d8f5f1f959ee358a8192d0c0ef712301..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/dec_helpers.go +++ /dev/null @@ -1,468 +0,0 @@ -// Created by decgen --output dec_helpers.go; DO NOT EDIT - -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "math" - "reflect" -) - -var decArrayHelper = map[reflect.Kind]decHelper{ - reflect.Bool: decBoolArray, - reflect.Complex64: decComplex64Array, - reflect.Complex128: decComplex128Array, - reflect.Float32: decFloat32Array, - reflect.Float64: decFloat64Array, - reflect.Int: decIntArray, - reflect.Int16: decInt16Array, - reflect.Int32: decInt32Array, - reflect.Int64: decInt64Array, - reflect.Int8: decInt8Array, - reflect.String: decStringArray, - reflect.Uint: decUintArray, - reflect.Uint16: decUint16Array, - reflect.Uint32: decUint32Array, - reflect.Uint64: decUint64Array, - reflect.Uintptr: decUintptrArray, -} - -var decSliceHelper = map[reflect.Kind]decHelper{ - reflect.Bool: decBoolSlice, - reflect.Complex64: decComplex64Slice, - reflect.Complex128: decComplex128Slice, - reflect.Float32: decFloat32Slice, - reflect.Float64: decFloat64Slice, - reflect.Int: decIntSlice, - reflect.Int16: decInt16Slice, - reflect.Int32: decInt32Slice, - reflect.Int64: decInt64Slice, - reflect.Int8: decInt8Slice, - reflect.String: decStringSlice, - reflect.Uint: decUintSlice, - reflect.Uint16: decUint16Slice, - reflect.Uint32: decUint32Slice, - reflect.Uint64: decUint64Slice, - reflect.Uintptr: decUintptrSlice, -} - -func decBoolArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decBoolSlice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decBoolSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]bool) - if !ok { - // It is kind bool but not type bool. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding bool array or slice: length exceeds input size (%d elements)", length) - } - slice[i] = state.decodeUint() != 0 - } - return true -} - -func decComplex64Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decComplex64Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decComplex64Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]complex64) - if !ok { - // It is kind complex64 but not type complex64. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding complex64 array or slice: length exceeds input size (%d elements)", length) - } - real := float32FromBits(state.decodeUint(), ovfl) - imag := float32FromBits(state.decodeUint(), ovfl) - slice[i] = complex(float32(real), float32(imag)) - } - return true -} - -func decComplex128Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decComplex128Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decComplex128Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]complex128) - if !ok { - // It is kind complex128 but not type complex128. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding complex128 array or slice: length exceeds input size (%d elements)", length) - } - real := float64FromBits(state.decodeUint()) - imag := float64FromBits(state.decodeUint()) - slice[i] = complex(real, imag) - } - return true -} - -func decFloat32Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decFloat32Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decFloat32Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]float32) - if !ok { - // It is kind float32 but not type float32. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding float32 array or slice: length exceeds input size (%d elements)", length) - } - slice[i] = float32(float32FromBits(state.decodeUint(), ovfl)) - } - return true -} - -func decFloat64Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decFloat64Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decFloat64Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]float64) - if !ok { - // It is kind float64 but not type float64. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding float64 array or slice: length exceeds input size (%d elements)", length) - } - slice[i] = float64FromBits(state.decodeUint()) - } - return true -} - -func decIntArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decIntSlice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decIntSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]int) - if !ok { - // It is kind int but not type int. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding int array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeInt() - // MinInt and MaxInt - if x < ^int64(^uint(0)>>1) || int64(^uint(0)>>1) < x { - error_(ovfl) - } - slice[i] = int(x) - } - return true -} - -func decInt16Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decInt16Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decInt16Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]int16) - if !ok { - // It is kind int16 but not type int16. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding int16 array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeInt() - if x < math.MinInt16 || math.MaxInt16 < x { - error_(ovfl) - } - slice[i] = int16(x) - } - return true -} - -func decInt32Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decInt32Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decInt32Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]int32) - if !ok { - // It is kind int32 but not type int32. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding int32 array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeInt() - if x < math.MinInt32 || math.MaxInt32 < x { - error_(ovfl) - } - slice[i] = int32(x) - } - return true -} - -func decInt64Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decInt64Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decInt64Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]int64) - if !ok { - // It is kind int64 but not type int64. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding int64 array or slice: length exceeds input size (%d elements)", length) - } - slice[i] = state.decodeInt() - } - return true -} - -func decInt8Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decInt8Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decInt8Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]int8) - if !ok { - // It is kind int8 but not type int8. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding int8 array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeInt() - if x < math.MinInt8 || math.MaxInt8 < x { - error_(ovfl) - } - slice[i] = int8(x) - } - return true -} - -func decStringArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decStringSlice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decStringSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]string) - if !ok { - // It is kind string but not type string. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding string array or slice: length exceeds input size (%d elements)", length) - } - u := state.decodeUint() - n := int(u) - if n < 0 || uint64(n) != u || n > state.b.Len() { - errorf("length of string exceeds input size (%d bytes)", u) - } - if n > state.b.Len() { - errorf("string data too long for buffer: %d", n) - } - // Read the data. - data := make([]byte, n) - if _, err := state.b.Read(data); err != nil { - errorf("error decoding string: %s", err) - } - slice[i] = string(data) - } - return true -} - -func decUintArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decUintSlice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decUintSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]uint) - if !ok { - // It is kind uint but not type uint. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding uint array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeUint() - /*TODO if math.MaxUint32 < x { - error_(ovfl) - }*/ - slice[i] = uint(x) - } - return true -} - -func decUint16Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decUint16Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decUint16Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]uint16) - if !ok { - // It is kind uint16 but not type uint16. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding uint16 array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeUint() - if math.MaxUint16 < x { - error_(ovfl) - } - slice[i] = uint16(x) - } - return true -} - -func decUint32Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decUint32Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decUint32Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]uint32) - if !ok { - // It is kind uint32 but not type uint32. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding uint32 array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeUint() - if math.MaxUint32 < x { - error_(ovfl) - } - slice[i] = uint32(x) - } - return true -} - -func decUint64Array(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decUint64Slice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decUint64Slice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]uint64) - if !ok { - // It is kind uint64 but not type uint64. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding uint64 array or slice: length exceeds input size (%d elements)", length) - } - slice[i] = state.decodeUint() - } - return true -} - -func decUintptrArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return decUintptrSlice(state, v.Slice(0, v.Len()), length, ovfl) -} - -func decUintptrSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]uintptr) - if !ok { - // It is kind uintptr but not type uintptr. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding uintptr array or slice: length exceeds input size (%d elements)", length) - } - x := state.decodeUint() - if uint64(^uintptr(0)) < x { - error_(ovfl) - } - slice[i] = uintptr(x) - } - return true -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decgen.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/decgen.go deleted file mode 100644 index da41a899ed01ca8d57f7827648b0ae376719f20b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decgen.go +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// encgen writes the helper functions for encoding. Intended to be -// used with go generate; see the invocation in encode.go. - -// TODO: We could do more by being unsafe. Add a -unsafe flag? - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/format" - "log" - "os" -) - -var output = flag.String("output", "dec_helpers.go", "file name to write") - -type Type struct { - lower string - upper string - decoder string -} - -var types = []Type{ - { - "bool", - "Bool", - `slice[i] = state.decodeUint() != 0`, - }, - { - "complex64", - "Complex64", - `real := float32FromBits(state.decodeUint(), ovfl) - imag := float32FromBits(state.decodeUint(), ovfl) - slice[i] = complex(float32(real), float32(imag))`, - }, - { - "complex128", - "Complex128", - `real := float64FromBits(state.decodeUint()) - imag := float64FromBits(state.decodeUint()) - slice[i] = complex(real, imag)`, - }, - { - "float32", - "Float32", - `slice[i] = float32(float32FromBits(state.decodeUint(), ovfl))`, - }, - { - "float64", - "Float64", - `slice[i] = float64FromBits(state.decodeUint())`, - }, - { - "int", - "Int", - `x := state.decodeInt() - // MinInt and MaxInt - if x < ^int64(^uint(0)>>1) || int64(^uint(0)>>1) < x { - error_(ovfl) - } - slice[i] = int(x)`, - }, - { - "int16", - "Int16", - `x := state.decodeInt() - if x < math.MinInt16 || math.MaxInt16 < x { - error_(ovfl) - } - slice[i] = int16(x)`, - }, - { - "int32", - "Int32", - `x := state.decodeInt() - if x < math.MinInt32 || math.MaxInt32 < x { - error_(ovfl) - } - slice[i] = int32(x)`, - }, - { - "int64", - "Int64", - `slice[i] = state.decodeInt()`, - }, - { - "int8", - "Int8", - `x := state.decodeInt() - if x < math.MinInt8 || math.MaxInt8 < x { - error_(ovfl) - } - slice[i] = int8(x)`, - }, - { - "string", - "String", - `u := state.decodeUint() - n := int(u) - if n < 0 || uint64(n) != u || n > state.b.Len() { - errorf("length of string exceeds input size (%d bytes)", u) - } - if n > state.b.Len() { - errorf("string data too long for buffer: %d", n) - } - // Read the data. - data := make([]byte, n) - if _, err := state.b.Read(data); err != nil { - errorf("error decoding string: %s", err) - } - slice[i] = string(data)`, - }, - { - "uint", - "Uint", - `x := state.decodeUint() - /*TODO if math.MaxUint32 < x { - error_(ovfl) - }*/ - slice[i] = uint(x)`, - }, - { - "uint16", - "Uint16", - `x := state.decodeUint() - if math.MaxUint16 < x { - error_(ovfl) - } - slice[i] = uint16(x)`, - }, - { - "uint32", - "Uint32", - `x := state.decodeUint() - if math.MaxUint32 < x { - error_(ovfl) - } - slice[i] = uint32(x)`, - }, - { - "uint64", - "Uint64", - `slice[i] = state.decodeUint()`, - }, - { - "uintptr", - "Uintptr", - `x := state.decodeUint() - if uint64(^uintptr(0)) < x { - error_(ovfl) - } - slice[i] = uintptr(x)`, - }, - // uint8 Handled separately. -} - -func main() { - log.SetFlags(0) - log.SetPrefix("decgen: ") - flag.Parse() - if flag.NArg() != 0 { - log.Fatal("usage: decgen [--output filename]") - } - var b bytes.Buffer - fmt.Fprintf(&b, "// Created by decgen --output %s; DO NOT EDIT\n", *output) - fmt.Fprint(&b, header) - printMaps(&b, "Array") - fmt.Fprint(&b, "\n") - printMaps(&b, "Slice") - for _, t := range types { - fmt.Fprintf(&b, arrayHelper, t.lower, t.upper) - fmt.Fprintf(&b, sliceHelper, t.lower, t.upper, t.decoder) - } - source, err := format.Source(b.Bytes()) - if err != nil { - log.Fatal("source format error:", err) - } - fd, err := os.Create(*output) - _, err = fd.Write(source) - if err != nil { - log.Fatal(err) - } -} - -func printMaps(b *bytes.Buffer, upperClass string) { - fmt.Fprintf(b, "var dec%sHelper = map[reflect.Kind]decHelper{\n", upperClass) - for _, t := range types { - fmt.Fprintf(b, "reflect.%s: dec%s%s,\n", t.upper, t.upper, upperClass) - } - fmt.Fprintf(b, "}\n") -} - -const header = ` -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "math" - "reflect" -) - -` - -const arrayHelper = ` -func dec%[2]sArray(state *decoderState, v reflect.Value, length int, ovfl error) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return dec%[2]sSlice(state, v.Slice(0, v.Len()), length, ovfl) -} -` - -const sliceHelper = ` -func dec%[2]sSlice(state *decoderState, v reflect.Value, length int, ovfl error) bool { - slice, ok := v.Interface().([]%[1]s) - if !ok { - // It is kind %[1]s but not type %[1]s. TODO: We can handle this unsafely. - return false - } - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding %[1]s array or slice: length exceeds input size (%%d elements)", length) - } - %[3]s - } - return true -} -` diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decode.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/decode.go deleted file mode 100644 index e913f15c545a240cc0760cd681fcc10af9664653..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decode.go +++ /dev/null @@ -1,1248 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run decgen.go -output dec_helpers.go - -package gob - -import ( - "encoding" - "errors" - "io" - "math" - "reflect" -) - -var ( - errBadUint = errors.New("gob: encoded unsigned integer out of range") - errBadType = errors.New("gob: unknown type id or corrupted data") - errRange = errors.New("gob: bad data: field numbers out of bounds") -) - -type decHelper func(state *decoderState, v reflect.Value, length int, ovfl error) bool - -// decoderState is the execution state of an instance of the decoder. A new state -// is created for nested objects. -type decoderState struct { - dec *Decoder - // The buffer is stored with an extra indirection because it may be replaced - // if we load a type during decode (when reading an interface value). - b *decBuffer - fieldnum int // the last field number read. - buf []byte - next *decoderState // for free list -} - -// decBuffer is an extremely simple, fast implementation of a read-only byte buffer. -// It is initialized by calling Size and then copying the data into the slice returned by Bytes(). -type decBuffer struct { - data []byte - offset int // Read offset. -} - -func (d *decBuffer) Read(p []byte) (int, error) { - n := copy(p, d.data[d.offset:]) - if n == 0 && len(p) != 0 { - return 0, io.EOF - } - d.offset += n - return n, nil -} - -func (d *decBuffer) Drop(n int) { - if n > d.Len() { - panic("drop") - } - d.offset += n -} - -// Size grows the buffer to exactly n bytes, so d.Bytes() will -// return a slice of length n. Existing data is first discarded. -func (d *decBuffer) Size(n int) { - d.Reset() - if cap(d.data) < n { - d.data = make([]byte, n) - } else { - d.data = d.data[0:n] - } -} - -func (d *decBuffer) ReadByte() (byte, error) { - if d.offset >= len(d.data) { - return 0, io.EOF - } - c := d.data[d.offset] - d.offset++ - return c, nil -} - -func (d *decBuffer) Len() int { - return len(d.data) - d.offset -} - -func (d *decBuffer) Bytes() []byte { - return d.data[d.offset:] -} - -func (d *decBuffer) Reset() { - d.data = d.data[0:0] - d.offset = 0 -} - -// We pass the bytes.Buffer separately for easier testing of the infrastructure -// without requiring a full Decoder. -func (dec *Decoder) newDecoderState(buf *decBuffer) *decoderState { - d := dec.freeList - if d == nil { - d = new(decoderState) - d.dec = dec - d.buf = make([]byte, uint64Size) - } else { - dec.freeList = d.next - } - d.b = buf - return d -} - -func (dec *Decoder) freeDecoderState(d *decoderState) { - d.next = dec.freeList - dec.freeList = d -} - -func overflow(name string) error { - return errors.New(`value for "` + name + `" out of range`) -} - -// decodeUintReader reads an encoded unsigned integer from an io.Reader. -// Used only by the Decoder to read the message length. -func decodeUintReader(r io.Reader, buf []byte) (x uint64, width int, err error) { - width = 1 - n, err := io.ReadFull(r, buf[0:width]) - if n == 0 { - return - } - b := buf[0] - if b <= 0x7f { - return uint64(b), width, nil - } - n = -int(int8(b)) - if n > uint64Size { - err = errBadUint - return - } - width, err = io.ReadFull(r, buf[0:n]) - if err != nil { - if err == io.EOF { - err = io.ErrUnexpectedEOF - } - return - } - // Could check that the high byte is zero but it's not worth it. - for _, b := range buf[0:width] { - x = x<<8 | uint64(b) - } - width++ // +1 for length byte - return -} - -// decodeUint reads an encoded unsigned integer from state.r. -// Does not check for overflow. -func (state *decoderState) decodeUint() (x uint64) { - b, err := state.b.ReadByte() - if err != nil { - error_(err) - } - if b <= 0x7f { - return uint64(b) - } - n := -int(int8(b)) - if n > uint64Size { - error_(errBadUint) - } - width, err := state.b.Read(state.buf[0:n]) - if err != nil { - error_(err) - } - // Don't need to check error; it's safe to loop regardless. - // Could check that the high byte is zero but it's not worth it. - for _, b := range state.buf[0:width] { - x = x<<8 | uint64(b) - } - return x -} - -// decodeInt reads an encoded signed integer from state.r. -// Does not check for overflow. -func (state *decoderState) decodeInt() int64 { - x := state.decodeUint() - if x&1 != 0 { - return ^int64(x >> 1) - } - return int64(x >> 1) -} - -// getLength decodes the next uint and makes sure it is a possible -// size for a data item that follows, which means it must fit in a -// non-negative int and fit in the buffer. -func (state *decoderState) getLength() (int, bool) { - n := int(state.decodeUint()) - if n < 0 || state.b.Len() < n || tooBig <= n { - return 0, false - } - return n, true -} - -// decOp is the signature of a decoding operator for a given type. -type decOp func(i *decInstr, state *decoderState, v reflect.Value) - -// The 'instructions' of the decoding machine -type decInstr struct { - op decOp - field int // field number of the wire type - index []int // field access indices for destination type - ovfl error // error message for overflow/underflow (for arrays, of the elements) -} - -// ignoreUint discards a uint value with no destination. -func ignoreUint(i *decInstr, state *decoderState, v reflect.Value) { - state.decodeUint() -} - -// ignoreTwoUints discards a uint value with no destination. It's used to skip -// complex values. -func ignoreTwoUints(i *decInstr, state *decoderState, v reflect.Value) { - state.decodeUint() - state.decodeUint() -} - -// Since the encoder writes no zeros, if we arrive at a decoder we have -// a value to extract and store. The field number has already been read -// (it's how we knew to call this decoder). -// Each decoder is responsible for handling any indirections associated -// with the data structure. If any pointer so reached is nil, allocation must -// be done. - -// decAlloc takes a value and returns a settable value that can -// be assigned to. If the value is a pointer, decAlloc guarantees it points to storage. -// The callers to the individual decoders are expected to have used decAlloc. -// The individual decoders don't need to it. -func decAlloc(v reflect.Value) reflect.Value { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - } - return v -} - -// decBool decodes a uint and stores it as a boolean in value. -func decBool(i *decInstr, state *decoderState, value reflect.Value) { - value.SetBool(state.decodeUint() != 0) -} - -// decInt8 decodes an integer and stores it as an int8 in value. -func decInt8(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeInt() - if v < math.MinInt8 || math.MaxInt8 < v { - error_(i.ovfl) - } - value.SetInt(v) -} - -// decUint8 decodes an unsigned integer and stores it as a uint8 in value. -func decUint8(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeUint() - if math.MaxUint8 < v { - error_(i.ovfl) - } - value.SetUint(v) -} - -// decInt16 decodes an integer and stores it as an int16 in value. -func decInt16(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeInt() - if v < math.MinInt16 || math.MaxInt16 < v { - error_(i.ovfl) - } - value.SetInt(v) -} - -// decUint16 decodes an unsigned integer and stores it as a uint16 in value. -func decUint16(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeUint() - if math.MaxUint16 < v { - error_(i.ovfl) - } - value.SetUint(v) -} - -// decInt32 decodes an integer and stores it as an int32 in value. -func decInt32(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeInt() - if v < math.MinInt32 || math.MaxInt32 < v { - error_(i.ovfl) - } - value.SetInt(v) -} - -// decUint32 decodes an unsigned integer and stores it as a uint32 in value. -func decUint32(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeUint() - if math.MaxUint32 < v { - error_(i.ovfl) - } - value.SetUint(v) -} - -// decInt64 decodes an integer and stores it as an int64 in value. -func decInt64(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeInt() - value.SetInt(v) -} - -// decUint64 decodes an unsigned integer and stores it as a uint64 in value. -func decUint64(i *decInstr, state *decoderState, value reflect.Value) { - v := state.decodeUint() - value.SetUint(v) -} - -// Floating-point numbers are transmitted as uint64s holding the bits -// of the underlying representation. They are sent byte-reversed, with -// the exponent end coming out first, so integer floating point numbers -// (for example) transmit more compactly. This routine does the -// unswizzling. -func float64FromBits(u uint64) float64 { - var v uint64 - for i := 0; i < 8; i++ { - v <<= 8 - v |= u & 0xFF - u >>= 8 - } - return math.Float64frombits(v) -} - -// float32FromBits decodes an unsigned integer, treats it as a 32-bit floating-point -// number, and returns it. It's a helper function for float32 and complex64. -// It returns a float64 because that's what reflection needs, but its return -// value is known to be accurately representable in a float32. -func float32FromBits(u uint64, ovfl error) float64 { - v := float64FromBits(u) - av := v - if av < 0 { - av = -av - } - // +Inf is OK in both 32- and 64-bit floats. Underflow is always OK. - if math.MaxFloat32 < av && av <= math.MaxFloat64 { - error_(ovfl) - } - return v -} - -// decFloat32 decodes an unsigned integer, treats it as a 32-bit floating-point -// number, and stores it in value. -func decFloat32(i *decInstr, state *decoderState, value reflect.Value) { - value.SetFloat(float32FromBits(state.decodeUint(), i.ovfl)) -} - -// decFloat64 decodes an unsigned integer, treats it as a 64-bit floating-point -// number, and stores it in value. -func decFloat64(i *decInstr, state *decoderState, value reflect.Value) { - value.SetFloat(float64FromBits(state.decodeUint())) -} - -// decComplex64 decodes a pair of unsigned integers, treats them as a -// pair of floating point numbers, and stores them as a complex64 in value. -// The real part comes first. -func decComplex64(i *decInstr, state *decoderState, value reflect.Value) { - real := float32FromBits(state.decodeUint(), i.ovfl) - imag := float32FromBits(state.decodeUint(), i.ovfl) - value.SetComplex(complex(real, imag)) -} - -// decComplex128 decodes a pair of unsigned integers, treats them as a -// pair of floating point numbers, and stores them as a complex128 in value. -// The real part comes first. -func decComplex128(i *decInstr, state *decoderState, value reflect.Value) { - real := float64FromBits(state.decodeUint()) - imag := float64FromBits(state.decodeUint()) - value.SetComplex(complex(real, imag)) -} - -// decUint8Slice decodes a byte slice and stores in value a slice header -// describing the data. -// uint8 slices are encoded as an unsigned count followed by the raw bytes. -func decUint8Slice(i *decInstr, state *decoderState, value reflect.Value) { - n, ok := state.getLength() - if !ok { - errorf("bad %s slice length: %d", value.Type(), n) - } - if value.Cap() < n { - value.Set(reflect.MakeSlice(value.Type(), n, n)) - } else { - value.Set(value.Slice(0, n)) - } - if _, err := state.b.Read(value.Bytes()); err != nil { - errorf("error decoding []byte: %s", err) - } -} - -// decString decodes byte array and stores in value a string header -// describing the data. -// Strings are encoded as an unsigned count followed by the raw bytes. -func decString(i *decInstr, state *decoderState, value reflect.Value) { - n, ok := state.getLength() - if !ok { - errorf("bad %s slice length: %d", value.Type(), n) - } - // Read the data. - data := make([]byte, n) - if _, err := state.b.Read(data); err != nil { - errorf("error decoding string: %s", err) - } - value.SetString(string(data)) -} - -// ignoreUint8Array skips over the data for a byte slice value with no destination. -func ignoreUint8Array(i *decInstr, state *decoderState, value reflect.Value) { - n, ok := state.getLength() - if !ok { - errorf("slice length too large") - } - b := make([]byte, n) - state.b.Read(b) -} - -// Execution engine - -// The encoder engine is an array of instructions indexed by field number of the incoming -// decoder. It is executed with random access according to field number. -type decEngine struct { - instr []decInstr - numInstr int // the number of active instructions -} - -// decodeSingle decodes a top-level value that is not a struct and stores it in value. -// Such values are preceded by a zero, making them have the memory layout of a -// struct field (although with an illegal field number). -func (dec *Decoder) decodeSingle(engine *decEngine, ut *userTypeInfo, value reflect.Value) { - state := dec.newDecoderState(&dec.buf) - defer dec.freeDecoderState(state) - state.fieldnum = singletonField - if state.decodeUint() != 0 { - errorf("decode: corrupted data: non-zero delta for singleton") - } - instr := &engine.instr[singletonField] - instr.op(instr, state, value) -} - -// decodeStruct decodes a top-level struct and stores it in value. -// Indir is for the value, not the type. At the time of the call it may -// differ from ut.indir, which was computed when the engine was built. -// This state cannot arise for decodeSingle, which is called directly -// from the user's value, not from the innards of an engine. -func (dec *Decoder) decodeStruct(engine *decEngine, ut *userTypeInfo, value reflect.Value) { - state := dec.newDecoderState(&dec.buf) - defer dec.freeDecoderState(state) - state.fieldnum = -1 - for state.b.Len() > 0 { - delta := int(state.decodeUint()) - if delta < 0 { - errorf("decode: corrupted data: negative delta") - } - if delta == 0 { // struct terminator is zero delta fieldnum - break - } - fieldnum := state.fieldnum + delta - if fieldnum >= len(engine.instr) { - error_(errRange) - break - } - instr := &engine.instr[fieldnum] - var field reflect.Value - if instr.index != nil { - // Otherwise the field is unknown to us and instr.op is an ignore op. - field = value.FieldByIndex(instr.index) - if field.Kind() == reflect.Ptr { - field = decAlloc(field) - } - } - instr.op(instr, state, field) - state.fieldnum = fieldnum - } -} - -var noValue reflect.Value - -// ignoreStruct discards the data for a struct with no destination. -func (dec *Decoder) ignoreStruct(engine *decEngine) { - state := dec.newDecoderState(&dec.buf) - defer dec.freeDecoderState(state) - state.fieldnum = -1 - for state.b.Len() > 0 { - delta := int(state.decodeUint()) - if delta < 0 { - errorf("ignore decode: corrupted data: negative delta") - } - if delta == 0 { // struct terminator is zero delta fieldnum - break - } - fieldnum := state.fieldnum + delta - if fieldnum >= len(engine.instr) { - error_(errRange) - } - instr := &engine.instr[fieldnum] - instr.op(instr, state, noValue) - state.fieldnum = fieldnum - } -} - -// ignoreSingle discards the data for a top-level non-struct value with no -// destination. It's used when calling Decode with a nil value. -func (dec *Decoder) ignoreSingle(engine *decEngine) { - state := dec.newDecoderState(&dec.buf) - defer dec.freeDecoderState(state) - state.fieldnum = singletonField - delta := int(state.decodeUint()) - if delta != 0 { - errorf("decode: corrupted data: non-zero delta for singleton") - } - instr := &engine.instr[singletonField] - instr.op(instr, state, noValue) -} - -// decodeArrayHelper does the work for decoding arrays and slices. -func (dec *Decoder) decodeArrayHelper(state *decoderState, value reflect.Value, elemOp decOp, length int, ovfl error, helper decHelper) { - if helper != nil && helper(state, value, length, ovfl) { - return - } - instr := &decInstr{elemOp, 0, nil, ovfl} - isPtr := value.Type().Elem().Kind() == reflect.Ptr - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding array or slice: length exceeds input size (%d elements)", length) - } - v := value.Index(i) - if isPtr { - v = decAlloc(v) - } - elemOp(instr, state, v) - } -} - -// decodeArray decodes an array and stores it in value. -// The length is an unsigned integer preceding the elements. Even though the length is redundant -// (it's part of the type), it's a useful check and is included in the encoding. -func (dec *Decoder) decodeArray(atyp reflect.Type, state *decoderState, value reflect.Value, elemOp decOp, length int, ovfl error, helper decHelper) { - if n := state.decodeUint(); n != uint64(length) { - errorf("length mismatch in decodeArray") - } - dec.decodeArrayHelper(state, value, elemOp, length, ovfl, helper) -} - -// decodeIntoValue is a helper for map decoding. -func decodeIntoValue(state *decoderState, op decOp, isPtr bool, value reflect.Value, ovfl error) reflect.Value { - instr := &decInstr{op, 0, nil, ovfl} - v := value - if isPtr { - v = decAlloc(value) - } - op(instr, state, v) - return value -} - -// decodeMap decodes a map and stores it in value. -// Maps are encoded as a length followed by key:value pairs. -// Because the internals of maps are not visible to us, we must -// use reflection rather than pointer magic. -func (dec *Decoder) decodeMap(mtyp reflect.Type, state *decoderState, value reflect.Value, keyOp, elemOp decOp, ovfl error) { - if value.IsNil() { - // Allocate map. - value.Set(reflect.MakeMap(mtyp)) - } - n := int(state.decodeUint()) - keyIsPtr := mtyp.Key().Kind() == reflect.Ptr - elemIsPtr := mtyp.Elem().Kind() == reflect.Ptr - for i := 0; i < n; i++ { - key := decodeIntoValue(state, keyOp, keyIsPtr, allocValue(mtyp.Key()), ovfl) - elem := decodeIntoValue(state, elemOp, elemIsPtr, allocValue(mtyp.Elem()), ovfl) - value.SetMapIndex(key, elem) - } -} - -// ignoreArrayHelper does the work for discarding arrays and slices. -func (dec *Decoder) ignoreArrayHelper(state *decoderState, elemOp decOp, length int) { - instr := &decInstr{elemOp, 0, nil, errors.New("no error")} - for i := 0; i < length; i++ { - if state.b.Len() == 0 { - errorf("decoding array or slice: length exceeds input size (%d elements)", length) - } - elemOp(instr, state, noValue) - } -} - -// ignoreArray discards the data for an array value with no destination. -func (dec *Decoder) ignoreArray(state *decoderState, elemOp decOp, length int) { - if n := state.decodeUint(); n != uint64(length) { - errorf("length mismatch in ignoreArray") - } - dec.ignoreArrayHelper(state, elemOp, length) -} - -// ignoreMap discards the data for a map value with no destination. -func (dec *Decoder) ignoreMap(state *decoderState, keyOp, elemOp decOp) { - n := int(state.decodeUint()) - keyInstr := &decInstr{keyOp, 0, nil, errors.New("no error")} - elemInstr := &decInstr{elemOp, 0, nil, errors.New("no error")} - for i := 0; i < n; i++ { - keyOp(keyInstr, state, noValue) - elemOp(elemInstr, state, noValue) - } -} - -// decodeSlice decodes a slice and stores it in value. -// Slices are encoded as an unsigned length followed by the elements. -func (dec *Decoder) decodeSlice(state *decoderState, value reflect.Value, elemOp decOp, ovfl error, helper decHelper) { - u := state.decodeUint() - typ := value.Type() - size := uint64(typ.Elem().Size()) - nBytes := u * size - n := int(u) - // Take care with overflow in this calculation. - if n < 0 || uint64(n) != u || nBytes > tooBig || (size > 0 && nBytes/size != u) { - // We don't check n against buffer length here because if it's a slice - // of interfaces, there will be buffer reloads. - errorf("%s slice too big: %d elements of %d bytes", typ.Elem(), u, size) - } - if value.Cap() < n { - value.Set(reflect.MakeSlice(typ, n, n)) - } else { - value.Set(value.Slice(0, n)) - } - dec.decodeArrayHelper(state, value, elemOp, n, ovfl, helper) -} - -// ignoreSlice skips over the data for a slice value with no destination. -func (dec *Decoder) ignoreSlice(state *decoderState, elemOp decOp) { - dec.ignoreArrayHelper(state, elemOp, int(state.decodeUint())) -} - -// decodeInterface decodes an interface value and stores it in value. -// Interfaces are encoded as the name of a concrete type followed by a value. -// If the name is empty, the value is nil and no value is sent. -func (dec *Decoder) decodeInterface(ityp reflect.Type, state *decoderState, value reflect.Value) { - // Read the name of the concrete type. - nr := state.decodeUint() - if nr < 0 || nr > 1<<31 { // zero is permissible for anonymous types - errorf("invalid type name length %d", nr) - } - if nr > uint64(state.b.Len()) { - errorf("invalid type name length %d: exceeds input size", nr) - } - b := make([]byte, nr) - state.b.Read(b) - name := string(b) - // Allocate the destination interface value. - if name == "" { - // Copy the nil interface value to the target. - value.Set(reflect.Zero(value.Type())) - return - } - if len(name) > 1024 { - errorf("name too long (%d bytes): %.20q...", len(name), name) - } - // The concrete type must be registered. - registerLock.RLock() - typ, ok := nameToConcreteType[name] - registerLock.RUnlock() - if !ok { - errorf("name not registered for interface: %q", name) - } - // Read the type id of the concrete value. - concreteId := dec.decodeTypeSequence(true) - if concreteId < 0 { - error_(dec.err) - } - // Byte count of value is next; we don't care what it is (it's there - // in case we want to ignore the value by skipping it completely). - state.decodeUint() - // Read the concrete value. - v := allocValue(typ) - dec.decodeValue(concreteId, v) - if dec.err != nil { - error_(dec.err) - } - // Assign the concrete value to the interface. - // Tread carefully; it might not satisfy the interface. - if !typ.AssignableTo(ityp) { - errorf("%s is not assignable to type %s", typ, ityp) - } - // Copy the interface value to the target. - value.Set(v) -} - -// ignoreInterface discards the data for an interface value with no destination. -func (dec *Decoder) ignoreInterface(state *decoderState) { - // Read the name of the concrete type. - n, ok := state.getLength() - if !ok { - errorf("bad interface encoding: name too large for buffer") - } - b := make([]byte, n) - _, err := state.b.Read(b) - if err != nil { - error_(err) - } - id := dec.decodeTypeSequence(true) - if id < 0 { - error_(dec.err) - } - // At this point, the decoder buffer contains a delimited value. Just toss it. - n, ok = state.getLength() - if !ok { - errorf("bad interface encoding: data length too large for buffer") - } - state.b.Drop(n) -} - -// decodeGobDecoder decodes something implementing the GobDecoder interface. -// The data is encoded as a byte slice. -func (dec *Decoder) decodeGobDecoder(ut *userTypeInfo, state *decoderState, value reflect.Value) { - // Read the bytes for the value. - n, ok := state.getLength() - if !ok { - errorf("GobDecoder: length too large for buffer") - } - b := make([]byte, n) - _, err := state.b.Read(b) - if err != nil { - error_(err) - } - // We know it's one of these. - switch ut.externalDec { - case xGob: - err = value.Interface().(GobDecoder).GobDecode(b) - case xBinary: - err = value.Interface().(encoding.BinaryUnmarshaler).UnmarshalBinary(b) - case xText: - err = value.Interface().(encoding.TextUnmarshaler).UnmarshalText(b) - } - if err != nil { - error_(err) - } -} - -// ignoreGobDecoder discards the data for a GobDecoder value with no destination. -func (dec *Decoder) ignoreGobDecoder(state *decoderState) { - // Read the bytes for the value. - n, ok := state.getLength() - if !ok { - errorf("GobDecoder: length too large for buffer") - } - b := make([]byte, n) - _, err := state.b.Read(b) - if err != nil { - error_(err) - } -} - -// Index by Go types. -var decOpTable = [...]decOp{ - reflect.Bool: decBool, - reflect.Int8: decInt8, - reflect.Int16: decInt16, - reflect.Int32: decInt32, - reflect.Int64: decInt64, - reflect.Uint8: decUint8, - reflect.Uint16: decUint16, - reflect.Uint32: decUint32, - reflect.Uint64: decUint64, - reflect.Float32: decFloat32, - reflect.Float64: decFloat64, - reflect.Complex64: decComplex64, - reflect.Complex128: decComplex128, - reflect.String: decString, -} - -// Indexed by gob types. tComplex will be added during type.init(). -var decIgnoreOpMap = map[typeId]decOp{ - tBool: ignoreUint, - tInt: ignoreUint, - tUint: ignoreUint, - tFloat: ignoreUint, - tBytes: ignoreUint8Array, - tString: ignoreUint8Array, - tComplex: ignoreTwoUints, -} - -// decOpFor returns the decoding op for the base type under rt and -// the indirection count to reach it. -func (dec *Decoder) decOpFor(wireId typeId, rt reflect.Type, name string, inProgress map[reflect.Type]*decOp) *decOp { - ut := userType(rt) - // If the type implements GobEncoder, we handle it without further processing. - if ut.externalDec != 0 { - return dec.gobDecodeOpFor(ut) - } - - // If this type is already in progress, it's a recursive type (e.g. map[string]*T). - // Return the pointer to the op we're already building. - if opPtr := inProgress[rt]; opPtr != nil { - return opPtr - } - typ := ut.base - var op decOp - k := typ.Kind() - if int(k) < len(decOpTable) { - op = decOpTable[k] - } - if op == nil { - inProgress[rt] = &op - // Special cases - switch t := typ; t.Kind() { - case reflect.Array: - name = "element of " + name - elemId := dec.wireType[wireId].ArrayT.Elem - elemOp := dec.decOpFor(elemId, t.Elem(), name, inProgress) - ovfl := overflow(name) - helper := decArrayHelper[t.Elem().Kind()] - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.decodeArray(t, state, value, *elemOp, t.Len(), ovfl, helper) - } - - case reflect.Map: - keyId := dec.wireType[wireId].MapT.Key - elemId := dec.wireType[wireId].MapT.Elem - keyOp := dec.decOpFor(keyId, t.Key(), "key of "+name, inProgress) - elemOp := dec.decOpFor(elemId, t.Elem(), "element of "+name, inProgress) - ovfl := overflow(name) - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.decodeMap(t, state, value, *keyOp, *elemOp, ovfl) - } - - case reflect.Slice: - name = "element of " + name - if t.Elem().Kind() == reflect.Uint8 { - op = decUint8Slice - break - } - var elemId typeId - if tt, ok := builtinIdToType[wireId]; ok { - elemId = tt.(*sliceType).Elem - } else { - elemId = dec.wireType[wireId].SliceT.Elem - } - elemOp := dec.decOpFor(elemId, t.Elem(), name, inProgress) - ovfl := overflow(name) - helper := decSliceHelper[t.Elem().Kind()] - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.decodeSlice(state, value, *elemOp, ovfl, helper) - } - - case reflect.Struct: - // Generate a closure that calls out to the engine for the nested type. - ut := userType(typ) - enginePtr, err := dec.getDecEnginePtr(wireId, ut) - if err != nil { - error_(err) - } - op = func(i *decInstr, state *decoderState, value reflect.Value) { - // indirect through enginePtr to delay evaluation for recursive structs. - dec.decodeStruct(*enginePtr, ut, value) - } - case reflect.Interface: - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.decodeInterface(t, state, value) - } - } - } - if op == nil { - errorf("decode can't handle type %s", rt) - } - return &op -} - -// decIgnoreOpFor returns the decoding op for a field that has no destination. -func (dec *Decoder) decIgnoreOpFor(wireId typeId, inProgress map[typeId]*decOp) *decOp { - // If this type is already in progress, it's a recursive type (e.g. map[string]*T). - // Return the pointer to the op we're already building. - if opPtr := inProgress[wireId]; opPtr != nil { - return opPtr - } - op, ok := decIgnoreOpMap[wireId] - if !ok { - inProgress[wireId] = &op - if wireId == tInterface { - // Special case because it's a method: the ignored item might - // define types and we need to record their state in the decoder. - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.ignoreInterface(state) - } - return &op - } - // Special cases - wire := dec.wireType[wireId] - switch { - case wire == nil: - errorf("bad data: undefined type %s", wireId.string()) - case wire.ArrayT != nil: - elemId := wire.ArrayT.Elem - elemOp := dec.decIgnoreOpFor(elemId, inProgress) - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.ignoreArray(state, *elemOp, wire.ArrayT.Len) - } - - case wire.MapT != nil: - keyId := dec.wireType[wireId].MapT.Key - elemId := dec.wireType[wireId].MapT.Elem - keyOp := dec.decIgnoreOpFor(keyId, inProgress) - elemOp := dec.decIgnoreOpFor(elemId, inProgress) - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.ignoreMap(state, *keyOp, *elemOp) - } - - case wire.SliceT != nil: - elemId := wire.SliceT.Elem - elemOp := dec.decIgnoreOpFor(elemId, inProgress) - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.ignoreSlice(state, *elemOp) - } - - case wire.StructT != nil: - // Generate a closure that calls out to the engine for the nested type. - enginePtr, err := dec.getIgnoreEnginePtr(wireId) - if err != nil { - error_(err) - } - op = func(i *decInstr, state *decoderState, value reflect.Value) { - // indirect through enginePtr to delay evaluation for recursive structs - state.dec.ignoreStruct(*enginePtr) - } - - case wire.GobEncoderT != nil, wire.BinaryMarshalerT != nil, wire.TextMarshalerT != nil: - op = func(i *decInstr, state *decoderState, value reflect.Value) { - state.dec.ignoreGobDecoder(state) - } - } - } - if op == nil { - errorf("bad data: ignore can't handle type %s", wireId.string()) - } - return &op -} - -// gobDecodeOpFor returns the op for a type that is known to implement -// GobDecoder. -func (dec *Decoder) gobDecodeOpFor(ut *userTypeInfo) *decOp { - rcvrType := ut.user - if ut.decIndir == -1 { - rcvrType = reflect.PtrTo(rcvrType) - } else if ut.decIndir > 0 { - for i := int8(0); i < ut.decIndir; i++ { - rcvrType = rcvrType.Elem() - } - } - var op decOp - op = func(i *decInstr, state *decoderState, value reflect.Value) { - // We now have the base type. We need its address if the receiver is a pointer. - if value.Kind() != reflect.Ptr && rcvrType.Kind() == reflect.Ptr { - value = value.Addr() - } - state.dec.decodeGobDecoder(ut, state, value) - } - return &op -} - -// compatibleType asks: Are these two gob Types compatible? -// Answers the question for basic types, arrays, maps and slices, plus -// GobEncoder/Decoder pairs. -// Structs are considered ok; fields will be checked later. -func (dec *Decoder) compatibleType(fr reflect.Type, fw typeId, inProgress map[reflect.Type]typeId) bool { - if rhs, ok := inProgress[fr]; ok { - return rhs == fw - } - inProgress[fr] = fw - ut := userType(fr) - wire, ok := dec.wireType[fw] - // If wire was encoded with an encoding method, fr must have that method. - // And if not, it must not. - // At most one of the booleans in ut is set. - // We could possibly relax this constraint in the future in order to - // choose the decoding method using the data in the wireType. - // The parentheses look odd but are correct. - if (ut.externalDec == xGob) != (ok && wire.GobEncoderT != nil) || - (ut.externalDec == xBinary) != (ok && wire.BinaryMarshalerT != nil) || - (ut.externalDec == xText) != (ok && wire.TextMarshalerT != nil) { - return false - } - if ut.externalDec != 0 { // This test trumps all others. - return true - } - switch t := ut.base; t.Kind() { - default: - // chan, etc: cannot handle. - return false - case reflect.Bool: - return fw == tBool - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return fw == tInt - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return fw == tUint - case reflect.Float32, reflect.Float64: - return fw == tFloat - case reflect.Complex64, reflect.Complex128: - return fw == tComplex - case reflect.String: - return fw == tString - case reflect.Interface: - return fw == tInterface - case reflect.Array: - if !ok || wire.ArrayT == nil { - return false - } - array := wire.ArrayT - return t.Len() == array.Len && dec.compatibleType(t.Elem(), array.Elem, inProgress) - case reflect.Map: - if !ok || wire.MapT == nil { - return false - } - MapType := wire.MapT - return dec.compatibleType(t.Key(), MapType.Key, inProgress) && dec.compatibleType(t.Elem(), MapType.Elem, inProgress) - case reflect.Slice: - // Is it an array of bytes? - if t.Elem().Kind() == reflect.Uint8 { - return fw == tBytes - } - // Extract and compare element types. - var sw *sliceType - if tt, ok := builtinIdToType[fw]; ok { - sw, _ = tt.(*sliceType) - } else if wire != nil { - sw = wire.SliceT - } - elem := userType(t.Elem()).base - return sw != nil && dec.compatibleType(elem, sw.Elem, inProgress) - case reflect.Struct: - return true - } -} - -// typeString returns a human-readable description of the type identified by remoteId. -func (dec *Decoder) typeString(remoteId typeId) string { - if t := idToType[remoteId]; t != nil { - // globally known type. - return t.string() - } - return dec.wireType[remoteId].string() -} - -// compileSingle compiles the decoder engine for a non-struct top-level value, including -// GobDecoders. -func (dec *Decoder) compileSingle(remoteId typeId, ut *userTypeInfo) (engine *decEngine, err error) { - rt := ut.user - engine = new(decEngine) - engine.instr = make([]decInstr, 1) // one item - name := rt.String() // best we can do - if !dec.compatibleType(rt, remoteId, make(map[reflect.Type]typeId)) { - remoteType := dec.typeString(remoteId) - // Common confusing case: local interface type, remote concrete type. - if ut.base.Kind() == reflect.Interface && remoteId != tInterface { - return nil, errors.New("gob: local interface type " + name + " can only be decoded from remote interface type; received concrete type " + remoteType) - } - return nil, errors.New("gob: decoding into local type " + name + ", received remote type " + remoteType) - } - op := dec.decOpFor(remoteId, rt, name, make(map[reflect.Type]*decOp)) - ovfl := errors.New(`value for "` + name + `" out of range`) - engine.instr[singletonField] = decInstr{*op, singletonField, nil, ovfl} - engine.numInstr = 1 - return -} - -// compileIgnoreSingle compiles the decoder engine for a non-struct top-level value that will be discarded. -func (dec *Decoder) compileIgnoreSingle(remoteId typeId) (engine *decEngine, err error) { - engine = new(decEngine) - engine.instr = make([]decInstr, 1) // one item - op := dec.decIgnoreOpFor(remoteId, make(map[typeId]*decOp)) - ovfl := overflow(dec.typeString(remoteId)) - engine.instr[0] = decInstr{*op, 0, nil, ovfl} - engine.numInstr = 1 - return -} - -// compileDec compiles the decoder engine for a value. If the value is not a struct, -// it calls out to compileSingle. -func (dec *Decoder) compileDec(remoteId typeId, ut *userTypeInfo) (engine *decEngine, err error) { - defer catchError(&err) - rt := ut.base - srt := rt - if srt.Kind() != reflect.Struct || ut.externalDec != 0 { - return dec.compileSingle(remoteId, ut) - } - var wireStruct *structType - // Builtin types can come from global pool; the rest must be defined by the decoder. - // Also we know we're decoding a struct now, so the client must have sent one. - if t, ok := builtinIdToType[remoteId]; ok { - wireStruct, _ = t.(*structType) - } else { - wire := dec.wireType[remoteId] - if wire == nil { - error_(errBadType) - } - wireStruct = wire.StructT - } - if wireStruct == nil { - errorf("type mismatch in decoder: want struct type %s; got non-struct", rt) - } - engine = new(decEngine) - engine.instr = make([]decInstr, len(wireStruct.Field)) - seen := make(map[reflect.Type]*decOp) - // Loop over the fields of the wire type. - for fieldnum := 0; fieldnum < len(wireStruct.Field); fieldnum++ { - wireField := wireStruct.Field[fieldnum] - if wireField.Name == "" { - errorf("empty name for remote field of type %s", wireStruct.Name) - } - ovfl := overflow(wireField.Name) - // Find the field of the local type with the same name. - localField, present := srt.FieldByName(wireField.Name) - // TODO(r): anonymous names - if !present || !isExported(wireField.Name) { - op := dec.decIgnoreOpFor(wireField.Id, make(map[typeId]*decOp)) - engine.instr[fieldnum] = decInstr{*op, fieldnum, nil, ovfl} - continue - } - if !dec.compatibleType(localField.Type, wireField.Id, make(map[reflect.Type]typeId)) { - errorf("wrong type (%s) for received field %s.%s", localField.Type, wireStruct.Name, wireField.Name) - } - op := dec.decOpFor(wireField.Id, localField.Type, localField.Name, seen) - engine.instr[fieldnum] = decInstr{*op, fieldnum, localField.Index, ovfl} - engine.numInstr++ - } - return -} - -// getDecEnginePtr returns the engine for the specified type. -func (dec *Decoder) getDecEnginePtr(remoteId typeId, ut *userTypeInfo) (enginePtr **decEngine, err error) { - rt := ut.user - decoderMap, ok := dec.decoderCache[rt] - if !ok { - decoderMap = make(map[typeId]**decEngine) - dec.decoderCache[rt] = decoderMap - } - if enginePtr, ok = decoderMap[remoteId]; !ok { - // To handle recursive types, mark this engine as underway before compiling. - enginePtr = new(*decEngine) - decoderMap[remoteId] = enginePtr - *enginePtr, err = dec.compileDec(remoteId, ut) - if err != nil { - delete(decoderMap, remoteId) - } - } - return -} - -// emptyStruct is the type we compile into when ignoring a struct value. -type emptyStruct struct{} - -var emptyStructType = reflect.TypeOf(emptyStruct{}) - -// getIgnoreEnginePtr returns the engine for the specified type when the value is to be discarded. -func (dec *Decoder) getIgnoreEnginePtr(wireId typeId) (enginePtr **decEngine, err error) { - var ok bool - if enginePtr, ok = dec.ignorerCache[wireId]; !ok { - // To handle recursive types, mark this engine as underway before compiling. - enginePtr = new(*decEngine) - dec.ignorerCache[wireId] = enginePtr - wire := dec.wireType[wireId] - if wire != nil && wire.StructT != nil { - *enginePtr, err = dec.compileDec(wireId, userType(emptyStructType)) - } else { - *enginePtr, err = dec.compileIgnoreSingle(wireId) - } - if err != nil { - delete(dec.ignorerCache, wireId) - } - } - return -} - -// decodeValue decodes the data stream representing a value and stores it in value. -func (dec *Decoder) decodeValue(wireId typeId, value reflect.Value) { - defer catchError(&dec.err) - // If the value is nil, it means we should just ignore this item. - if !value.IsValid() { - dec.decodeIgnoredValue(wireId) - return - } - // Dereference down to the underlying type. - ut := userType(value.Type()) - base := ut.base - var enginePtr **decEngine - enginePtr, dec.err = dec.getDecEnginePtr(wireId, ut) - if dec.err != nil { - return - } - value = decAlloc(value) - engine := *enginePtr - if st := base; st.Kind() == reflect.Struct && ut.externalDec == 0 { - wt := dec.wireType[wireId] - if engine.numInstr == 0 && st.NumField() > 0 && - wt != nil && len(wt.StructT.Field) > 0 { - name := base.Name() - errorf("type mismatch: no fields matched compiling decoder for %s", name) - } - dec.decodeStruct(engine, ut, value) - } else { - dec.decodeSingle(engine, ut, value) - } -} - -// decodeIgnoredValue decodes the data stream representing a value of the specified type and discards it. -func (dec *Decoder) decodeIgnoredValue(wireId typeId) { - var enginePtr **decEngine - enginePtr, dec.err = dec.getIgnoreEnginePtr(wireId) - if dec.err != nil { - return - } - wire := dec.wireType[wireId] - if wire != nil && wire.StructT != nil { - dec.ignoreStruct(*enginePtr) - } else { - dec.ignoreSingle(*enginePtr) - } -} - -func init() { - var iop, uop decOp - switch reflect.TypeOf(int(0)).Bits() { - case 32: - iop = decInt32 - uop = decUint32 - case 64: - iop = decInt64 - uop = decUint64 - default: - panic("gob: unknown size of int/uint") - } - decOpTable[reflect.Int] = iop - decOpTable[reflect.Uint] = uop - - // Finally uintptr - switch reflect.TypeOf(uintptr(0)).Bits() { - case 32: - uop = decUint32 - case 64: - uop = decUint64 - default: - panic("gob: unknown size of uintptr") - } - decOpTable[reflect.Uintptr] = uop -} - -// Gob depends on being able to take the address -// of zeroed Values it creates, so use this wrapper instead -// of the standard reflect.Zero. -// Each call allocates once. -func allocValue(t reflect.Type) reflect.Value { - return reflect.New(t).Elem() -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decoder.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/decoder.go deleted file mode 100644 index c453e9ba397d3c568d05116a5d4398be1d555bcb..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/decoder.go +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "bufio" - "errors" - "io" - "reflect" - "sync" -) - -// tooBig provides a sanity check for sizes; used in several places. -// Upper limit of 1GB, allowing room to grow a little without overflow. -// TODO: make this adjustable? -const tooBig = 1 << 30 - -// A Decoder manages the receipt of type and data information read from the -// remote side of a connection. -type Decoder struct { - mutex sync.Mutex // each item must be received atomically - r io.Reader // source of the data - buf decBuffer // buffer for more efficient i/o from r - wireType map[typeId]*wireType // map from remote ID to local description - decoderCache map[reflect.Type]map[typeId]**decEngine // cache of compiled engines - ignorerCache map[typeId]**decEngine // ditto for ignored objects - freeList *decoderState // list of free decoderStates; avoids reallocation - countBuf []byte // used for decoding integers while parsing messages - err error -} - -// NewDecoder returns a new decoder that reads from the io.Reader. -// If r does not also implement io.ByteReader, it will be wrapped in a -// bufio.Reader. -func NewDecoder(r io.Reader) *Decoder { - dec := new(Decoder) - // We use the ability to read bytes as a plausible surrogate for buffering. - if _, ok := r.(io.ByteReader); !ok { - r = bufio.NewReader(r) - } - dec.r = r - dec.wireType = make(map[typeId]*wireType) - dec.decoderCache = make(map[reflect.Type]map[typeId]**decEngine) - dec.ignorerCache = make(map[typeId]**decEngine) - dec.countBuf = make([]byte, 9) // counts may be uint64s (unlikely!), require 9 bytes - - return dec -} - -// recvType loads the definition of a type. -func (dec *Decoder) recvType(id typeId) { - // Have we already seen this type? That's an error - if id < firstUserId || dec.wireType[id] != nil { - dec.err = errors.New("gob: duplicate type received") - return - } - - // Type: - wire := new(wireType) - dec.decodeValue(tWireType, reflect.ValueOf(wire)) - if dec.err != nil { - return - } - // Remember we've seen this type. - dec.wireType[id] = wire -} - -var errBadCount = errors.New("invalid message length") - -// recvMessage reads the next count-delimited item from the input. It is the converse -// of Encoder.writeMessage. It returns false on EOF or other error reading the message. -func (dec *Decoder) recvMessage() bool { - // Read a count. - nbytes, _, err := decodeUintReader(dec.r, dec.countBuf) - if err != nil { - dec.err = err - return false - } - if nbytes >= tooBig { - dec.err = errBadCount - return false - } - dec.readMessage(int(nbytes)) - return dec.err == nil -} - -// readMessage reads the next nbytes bytes from the input. -func (dec *Decoder) readMessage(nbytes int) { - if dec.buf.Len() != 0 { - // The buffer should always be empty now. - panic("non-empty decoder buffer") - } - // Read the data - dec.buf.Size(nbytes) - _, dec.err = io.ReadFull(dec.r, dec.buf.Bytes()) - if dec.err != nil { - if dec.err == io.EOF { - dec.err = io.ErrUnexpectedEOF - } - } -} - -// toInt turns an encoded uint64 into an int, according to the marshaling rules. -func toInt(x uint64) int64 { - i := int64(x >> 1) - if x&1 != 0 { - i = ^i - } - return i -} - -func (dec *Decoder) nextInt() int64 { - n, _, err := decodeUintReader(&dec.buf, dec.countBuf) - if err != nil { - dec.err = err - } - return toInt(n) -} - -func (dec *Decoder) nextUint() uint64 { - n, _, err := decodeUintReader(&dec.buf, dec.countBuf) - if err != nil { - dec.err = err - } - return n -} - -// decodeTypeSequence parses: -// TypeSequence -// (TypeDefinition DelimitedTypeDefinition*)? -// and returns the type id of the next value. It returns -1 at -// EOF. Upon return, the remainder of dec.buf is the value to be -// decoded. If this is an interface value, it can be ignored by -// resetting that buffer. -func (dec *Decoder) decodeTypeSequence(isInterface bool) typeId { - for dec.err == nil { - if dec.buf.Len() == 0 { - if !dec.recvMessage() { - break - } - } - // Receive a type id. - id := typeId(dec.nextInt()) - if id >= 0 { - // Value follows. - return id - } - // Type definition for (-id) follows. - dec.recvType(-id) - // When decoding an interface, after a type there may be a - // DelimitedValue still in the buffer. Skip its count. - // (Alternatively, the buffer is empty and the byte count - // will be absorbed by recvMessage.) - if dec.buf.Len() > 0 { - if !isInterface { - dec.err = errors.New("extra data in buffer") - break - } - dec.nextUint() - } - } - return -1 -} - -// Decode reads the next value from the input stream and stores -// it in the data represented by the empty interface value. -// If e is nil, the value will be discarded. Otherwise, -// the value underlying e must be a pointer to the -// correct type for the next data item received. -// If the input is at EOF, Decode returns io.EOF and -// does not modify e. -func (dec *Decoder) Decode(e interface{}) error { - if e == nil { - return dec.DecodeValue(reflect.Value{}) - } - value := reflect.ValueOf(e) - // If e represents a value as opposed to a pointer, the answer won't - // get back to the caller. Make sure it's a pointer. - if value.Type().Kind() != reflect.Ptr { - dec.err = errors.New("gob: attempt to decode into a non-pointer") - return dec.err - } - return dec.DecodeValue(value) -} - -// DecodeValue reads the next value from the input stream. -// If v is the zero reflect.Value (v.Kind() == Invalid), DecodeValue discards the value. -// Otherwise, it stores the value into v. In that case, v must represent -// a non-nil pointer to data or be an assignable reflect.Value (v.CanSet()) -// If the input is at EOF, DecodeValue returns io.EOF and -// does not modify v. -func (dec *Decoder) DecodeValue(v reflect.Value) error { - if v.IsValid() { - if v.Kind() == reflect.Ptr && !v.IsNil() { - // That's okay, we'll store through the pointer. - } else if !v.CanSet() { - return errors.New("gob: DecodeValue of unassignable value") - } - } - // Make sure we're single-threaded through here. - dec.mutex.Lock() - defer dec.mutex.Unlock() - - dec.buf.Reset() // In case data lingers from previous invocation. - dec.err = nil - id := dec.decodeTypeSequence(false) - if dec.err == nil { - dec.decodeValue(id, v) - } - return dec.err -} - -// If debug.go is compiled into the program , debugFunc prints a human-readable -// representation of the gob data read from r by calling that file's Debug function. -// Otherwise it is nil. -var debugFunc func(io.Reader) diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/doc.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/doc.go deleted file mode 100644 index 4d3d0076fbc570a32ef7cdb83ae7d12b15a3bc5f..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/doc.go +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/* -Package gob manages streams of gobs - binary values exchanged between an -Encoder (transmitter) and a Decoder (receiver). A typical use is transporting -arguments and results of remote procedure calls (RPCs) such as those provided by -package "net/rpc". - -The implementation compiles a custom codec for each data type in the stream and -is most efficient when a single Encoder is used to transmit a stream of values, -amortizing the cost of compilation. - -Basics - -A stream of gobs is self-describing. Each data item in the stream is preceded by -a specification of its type, expressed in terms of a small set of predefined -types. Pointers are not transmitted, but the things they point to are -transmitted; that is, the values are flattened. Recursive types work fine, but -recursive values (data with cycles) are problematic. This may change. - -To use gobs, create an Encoder and present it with a series of data items as -values or addresses that can be dereferenced to values. The Encoder makes sure -all type information is sent before it is needed. At the receive side, a -Decoder retrieves values from the encoded stream and unpacks them into local -variables. - -Types and Values - -The source and destination values/types need not correspond exactly. For structs, -fields (identified by name) that are in the source but absent from the receiving -variable will be ignored. Fields that are in the receiving variable but missing -from the transmitted type or value will be ignored in the destination. If a field -with the same name is present in both, their types must be compatible. Both the -receiver and transmitter will do all necessary indirection and dereferencing to -convert between gobs and actual Go values. For instance, a gob type that is -schematically, - - struct { A, B int } - -can be sent from or received into any of these Go types: - - struct { A, B int } // the same - *struct { A, B int } // extra indirection of the struct - struct { *A, **B int } // extra indirection of the fields - struct { A, B int64 } // different concrete value type; see below - -It may also be received into any of these: - - struct { A, B int } // the same - struct { B, A int } // ordering doesn't matter; matching is by name - struct { A, B, C int } // extra field (C) ignored - struct { B int } // missing field (A) ignored; data will be dropped - struct { B, C int } // missing field (A) ignored; extra field (C) ignored. - -Attempting to receive into these types will draw a decode error: - - struct { A int; B uint } // change of signedness for B - struct { A int; B float } // change of type for B - struct { } // no field names in common - struct { C, D int } // no field names in common - -Integers are transmitted two ways: arbitrary precision signed integers or -arbitrary precision unsigned integers. There is no int8, int16 etc. -discrimination in the gob format; there are only signed and unsigned integers. As -described below, the transmitter sends the value in a variable-length encoding; -the receiver accepts the value and stores it in the destination variable. -Floating-point numbers are always sent using IEEE-754 64-bit precision (see -below). - -Signed integers may be received into any signed integer variable: int, int16, etc.; -unsigned integers may be received into any unsigned integer variable; and floating -point values may be received into any floating point variable. However, -the destination variable must be able to represent the value or the decode -operation will fail. - -Structs, arrays and slices are also supported. Structs encode and decode only -exported fields. Strings and arrays of bytes are supported with a special, -efficient representation (see below). When a slice is decoded, if the existing -slice has capacity the slice will be extended in place; if not, a new array is -allocated. Regardless, the length of the resulting slice reports the number of -elements decoded. - -Functions and channels will not be sent in a gob. Attempting to encode such a value -at the top level will fail. A struct field of chan or func type is treated exactly -like an unexported field and is ignored. - -Gob can encode a value of any type implementing the GobEncoder or -encoding.BinaryMarshaler interfaces by calling the corresponding method, -in that order of preference. - -Gob can decode a value of any type implementing the GobDecoder or -encoding.BinaryUnmarshaler interfaces by calling the corresponding method, -again in that order of preference. - -Encoding Details - -This section documents the encoding, details that are not important for most -users. Details are presented bottom-up. - -An unsigned integer is sent one of two ways. If it is less than 128, it is sent -as a byte with that value. Otherwise it is sent as a minimal-length big-endian -(high byte first) byte stream holding the value, preceded by one byte holding the -byte count, negated. Thus 0 is transmitted as (00), 7 is transmitted as (07) and -256 is transmitted as (FE 01 00). - -A boolean is encoded within an unsigned integer: 0 for false, 1 for true. - -A signed integer, i, is encoded within an unsigned integer, u. Within u, bits 1 -upward contain the value; bit 0 says whether they should be complemented upon -receipt. The encode algorithm looks like this: - - var u uint - if i < 0 { - u = (^uint(i) << 1) | 1 // complement i, bit 0 is 1 - } else { - u = (uint(i) << 1) // do not complement i, bit 0 is 0 - } - encodeUnsigned(u) - -The low bit is therefore analogous to a sign bit, but making it the complement bit -instead guarantees that the largest negative integer is not a special case. For -example, -129=^128=(^256>>1) encodes as (FE 01 01). - -Floating-point numbers are always sent as a representation of a float64 value. -That value is converted to a uint64 using math.Float64bits. The uint64 is then -byte-reversed and sent as a regular unsigned integer. The byte-reversal means the -exponent and high-precision part of the mantissa go first. Since the low bits are -often zero, this can save encoding bytes. For instance, 17.0 is encoded in only -three bytes (FE 31 40). - -Strings and slices of bytes are sent as an unsigned count followed by that many -uninterpreted bytes of the value. - -All other slices and arrays are sent as an unsigned count followed by that many -elements using the standard gob encoding for their type, recursively. - -Maps are sent as an unsigned count followed by that many key, element -pairs. Empty but non-nil maps are sent, so if the receiver has not allocated -one already, one will always be allocated on receipt unless the transmitted map -is nil and not at the top level. - -Structs are sent as a sequence of (field number, field value) pairs. The field -value is sent using the standard gob encoding for its type, recursively. If a -field has the zero value for its type, it is omitted from the transmission. The -field number is defined by the type of the encoded struct: the first field of the -encoded type is field 0, the second is field 1, etc. When encoding a value, the -field numbers are delta encoded for efficiency and the fields are always sent in -order of increasing field number; the deltas are therefore unsigned. The -initialization for the delta encoding sets the field number to -1, so an unsigned -integer field 0 with value 7 is transmitted as unsigned delta = 1, unsigned value -= 7 or (01 07). Finally, after all the fields have been sent a terminating mark -denotes the end of the struct. That mark is a delta=0 value, which has -representation (00). - -Interface types are not checked for compatibility; all interface types are -treated, for transmission, as members of a single "interface" type, analogous to -int or []byte - in effect they're all treated as interface{}. Interface values -are transmitted as a string identifying the concrete type being sent (a name -that must be pre-defined by calling Register), followed by a byte count of the -length of the following data (so the value can be skipped if it cannot be -stored), followed by the usual encoding of concrete (dynamic) value stored in -the interface value. (A nil interface value is identified by the empty string -and transmits no value.) Upon receipt, the decoder verifies that the unpacked -concrete item satisfies the interface of the receiving variable. - -The representation of types is described below. When a type is defined on a given -connection between an Encoder and Decoder, it is assigned a signed integer type -id. When Encoder.Encode(v) is called, it makes sure there is an id assigned for -the type of v and all its elements and then it sends the pair (typeid, encoded-v) -where typeid is the type id of the encoded type of v and encoded-v is the gob -encoding of the value v. - -To define a type, the encoder chooses an unused, positive type id and sends the -pair (-type id, encoded-type) where encoded-type is the gob encoding of a wireType -description, constructed from these types: - - type wireType struct { - ArrayT *ArrayType - SliceT *SliceType - StructT *StructType - MapT *MapType - } - type arrayType struct { - CommonType - Elem typeId - Len int - } - type CommonType struct { - Name string // the name of the struct type - Id int // the id of the type, repeated so it's inside the type - } - type sliceType struct { - CommonType - Elem typeId - } - type structType struct { - CommonType - Field []*fieldType // the fields of the struct. - } - type fieldType struct { - Name string // the name of the field. - Id int // the type id of the field, which must be already defined - } - type mapType struct { - CommonType - Key typeId - Elem typeId - } - -If there are nested type ids, the types for all inner type ids must be defined -before the top-level type id is used to describe an encoded-v. - -For simplicity in setup, the connection is defined to understand these types a -priori, as well as the basic gob types int, uint, etc. Their ids are: - - bool 1 - int 2 - uint 3 - float 4 - []byte 5 - string 6 - complex 7 - interface 8 - // gap for reserved ids. - WireType 16 - ArrayType 17 - CommonType 18 - SliceType 19 - StructType 20 - FieldType 21 - // 22 is slice of fieldType. - MapType 23 - -Finally, each message created by a call to Encode is preceded by an encoded -unsigned integer count of the number of bytes remaining in the message. After -the initial type name, interface values are wrapped the same way; in effect, the -interface value acts like a recursive invocation of Encode. - -In summary, a gob stream looks like - - (byteCount (-type id, encoding of a wireType)* (type id, encoding of a value))* - -where * signifies zero or more repetitions and the type id of a value must -be predefined or be defined before the value in the stream. - -See "Gobs of data" for a design discussion of the gob wire format: -https://blog.golang.org/gobs-of-data -*/ -package gob - -/* -Grammar: - -Tokens starting with a lower case letter are terminals; int(n) -and uint(n) represent the signed/unsigned encodings of the value n. - -GobStream: - DelimitedMessage* -DelimitedMessage: - uint(lengthOfMessage) Message -Message: - TypeSequence TypedValue -TypeSequence - (TypeDefinition DelimitedTypeDefinition*)? -DelimitedTypeDefinition: - uint(lengthOfTypeDefinition) TypeDefinition -TypedValue: - int(typeId) Value -TypeDefinition: - int(-typeId) encodingOfWireType -Value: - SingletonValue | StructValue -SingletonValue: - uint(0) FieldValue -FieldValue: - builtinValue | ArrayValue | MapValue | SliceValue | StructValue | InterfaceValue -InterfaceValue: - NilInterfaceValue | NonNilInterfaceValue -NilInterfaceValue: - uint(0) -NonNilInterfaceValue: - ConcreteTypeName TypeSequence InterfaceContents -ConcreteTypeName: - uint(lengthOfName) [already read=n] name -InterfaceContents: - int(concreteTypeId) DelimitedValue -DelimitedValue: - uint(length) Value -ArrayValue: - uint(n) FieldValue*n [n elements] -MapValue: - uint(n) (FieldValue FieldValue)*n [n (key, value) pairs] -SliceValue: - uint(n) FieldValue*n [n elements] -StructValue: - (uint(fieldDelta) FieldValue)* -*/ - -/* -For implementers and the curious, here is an encoded example. Given - type Point struct {X, Y int} -and the value - p := Point{22, 33} -the bytes transmitted that encode p will be: - 1f ff 81 03 01 01 05 50 6f 69 6e 74 01 ff 82 00 - 01 02 01 01 58 01 04 00 01 01 59 01 04 00 00 00 - 07 ff 82 01 2c 01 42 00 -They are determined as follows. - -Since this is the first transmission of type Point, the type descriptor -for Point itself must be sent before the value. This is the first type -we've sent on this Encoder, so it has type id 65 (0 through 64 are -reserved). - - 1f // This item (a type descriptor) is 31 bytes long. - ff 81 // The negative of the id for the type we're defining, -65. - // This is one byte (indicated by FF = -1) followed by - // ^-65<<1 | 1. The low 1 bit signals to complement the - // rest upon receipt. - - // Now we send a type descriptor, which is itself a struct (wireType). - // The type of wireType itself is known (it's built in, as is the type of - // all its components), so we just need to send a *value* of type wireType - // that represents type "Point". - // Here starts the encoding of that value. - // Set the field number implicitly to -1; this is done at the beginning - // of every struct, including nested structs. - 03 // Add 3 to field number; now 2 (wireType.structType; this is a struct). - // structType starts with an embedded CommonType, which appears - // as a regular structure here too. - 01 // add 1 to field number (now 0); start of embedded CommonType. - 01 // add 1 to field number (now 0, the name of the type) - 05 // string is (unsigned) 5 bytes long - 50 6f 69 6e 74 // wireType.structType.CommonType.name = "Point" - 01 // add 1 to field number (now 1, the id of the type) - ff 82 // wireType.structType.CommonType._id = 65 - 00 // end of embedded wiretype.structType.CommonType struct - 01 // add 1 to field number (now 1, the field array in wireType.structType) - 02 // There are two fields in the type (len(structType.field)) - 01 // Start of first field structure; add 1 to get field number 0: field[0].name - 01 // 1 byte - 58 // structType.field[0].name = "X" - 01 // Add 1 to get field number 1: field[0].id - 04 // structType.field[0].typeId is 2 (signed int). - 00 // End of structType.field[0]; start structType.field[1]; set field number to -1. - 01 // Add 1 to get field number 0: field[1].name - 01 // 1 byte - 59 // structType.field[1].name = "Y" - 01 // Add 1 to get field number 1: field[1].id - 04 // struct.Type.field[1].typeId is 2 (signed int). - 00 // End of structType.field[1]; end of structType.field. - 00 // end of wireType.structType structure - 00 // end of wireType structure - -Now we can send the Point value. Again the field number resets to -1: - - 07 // this value is 7 bytes long - ff 82 // the type number, 65 (1 byte (-FF) followed by 65<<1) - 01 // add one to field number, yielding field 0 - 2c // encoding of signed "22" (0x22 = 44 = 22<<1); Point.x = 22 - 01 // add one to field number, yielding field 1 - 42 // encoding of signed "33" (0x42 = 66 = 33<<1); Point.y = 33 - 00 // end of structure - -The type encoding is long and fairly intricate but we send it only once. -If p is transmitted a second time, the type is already known so the -output will be just: - - 07 ff 82 01 2c 01 42 00 - -A single non-struct value at top level is transmitted like a field with -delta tag 0. For instance, a signed integer with value 3 presented as -the argument to Encode will emit: - - 03 04 00 06 - -Which represents: - - 03 // this value is 3 bytes long - 04 // the type number, 2, represents an integer - 00 // tag delta 0 - 06 // value 3 - -*/ diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/dump.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/dump.go deleted file mode 100644 index 17238c98df0d3bdf04a1084c1edd129a656f8e84..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/dump.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -package main - -// Need to compile package gob with debug.go to build this program. -// See comments in debug.go for how to do this. - -import ( - "encoding/gob" - "fmt" - "os" -) - -func main() { - var err error - file := os.Stdin - if len(os.Args) > 1 { - file, err = os.Open(os.Args[1]) - if err != nil { - fmt.Fprintf(os.Stderr, "dump: %s\n", err) - os.Exit(1) - } - } - gob.Debug(file) -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/enc_helpers.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/enc_helpers.go deleted file mode 100644 index 804e539d84d386f5b7d3854c8c7eee2954977950..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/enc_helpers.go +++ /dev/null @@ -1,414 +0,0 @@ -// Created by encgen --output enc_helpers.go; DO NOT EDIT - -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "reflect" -) - -var encArrayHelper = map[reflect.Kind]encHelper{ - reflect.Bool: encBoolArray, - reflect.Complex64: encComplex64Array, - reflect.Complex128: encComplex128Array, - reflect.Float32: encFloat32Array, - reflect.Float64: encFloat64Array, - reflect.Int: encIntArray, - reflect.Int16: encInt16Array, - reflect.Int32: encInt32Array, - reflect.Int64: encInt64Array, - reflect.Int8: encInt8Array, - reflect.String: encStringArray, - reflect.Uint: encUintArray, - reflect.Uint16: encUint16Array, - reflect.Uint32: encUint32Array, - reflect.Uint64: encUint64Array, - reflect.Uintptr: encUintptrArray, -} - -var encSliceHelper = map[reflect.Kind]encHelper{ - reflect.Bool: encBoolSlice, - reflect.Complex64: encComplex64Slice, - reflect.Complex128: encComplex128Slice, - reflect.Float32: encFloat32Slice, - reflect.Float64: encFloat64Slice, - reflect.Int: encIntSlice, - reflect.Int16: encInt16Slice, - reflect.Int32: encInt32Slice, - reflect.Int64: encInt64Slice, - reflect.Int8: encInt8Slice, - reflect.String: encStringSlice, - reflect.Uint: encUintSlice, - reflect.Uint16: encUint16Slice, - reflect.Uint32: encUint32Slice, - reflect.Uint64: encUint64Slice, - reflect.Uintptr: encUintptrSlice, -} - -func encBoolArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encBoolSlice(state, v.Slice(0, v.Len())) -} - -func encBoolSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]bool) - if !ok { - // It is kind bool but not type bool. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != false || state.sendZero { - if x { - state.encodeUint(1) - } else { - state.encodeUint(0) - } - } - } - return true -} - -func encComplex64Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encComplex64Slice(state, v.Slice(0, v.Len())) -} - -func encComplex64Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]complex64) - if !ok { - // It is kind complex64 but not type complex64. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0+0i || state.sendZero { - rpart := floatBits(float64(real(x))) - ipart := floatBits(float64(imag(x))) - state.encodeUint(rpart) - state.encodeUint(ipart) - } - } - return true -} - -func encComplex128Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encComplex128Slice(state, v.Slice(0, v.Len())) -} - -func encComplex128Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]complex128) - if !ok { - // It is kind complex128 but not type complex128. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0+0i || state.sendZero { - rpart := floatBits(real(x)) - ipart := floatBits(imag(x)) - state.encodeUint(rpart) - state.encodeUint(ipart) - } - } - return true -} - -func encFloat32Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encFloat32Slice(state, v.Slice(0, v.Len())) -} - -func encFloat32Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]float32) - if !ok { - // It is kind float32 but not type float32. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - bits := floatBits(float64(x)) - state.encodeUint(bits) - } - } - return true -} - -func encFloat64Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encFloat64Slice(state, v.Slice(0, v.Len())) -} - -func encFloat64Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]float64) - if !ok { - // It is kind float64 but not type float64. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - bits := floatBits(x) - state.encodeUint(bits) - } - } - return true -} - -func encIntArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encIntSlice(state, v.Slice(0, v.Len())) -} - -func encIntSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]int) - if !ok { - // It is kind int but not type int. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeInt(int64(x)) - } - } - return true -} - -func encInt16Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encInt16Slice(state, v.Slice(0, v.Len())) -} - -func encInt16Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]int16) - if !ok { - // It is kind int16 but not type int16. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeInt(int64(x)) - } - } - return true -} - -func encInt32Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encInt32Slice(state, v.Slice(0, v.Len())) -} - -func encInt32Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]int32) - if !ok { - // It is kind int32 but not type int32. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeInt(int64(x)) - } - } - return true -} - -func encInt64Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encInt64Slice(state, v.Slice(0, v.Len())) -} - -func encInt64Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]int64) - if !ok { - // It is kind int64 but not type int64. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeInt(x) - } - } - return true -} - -func encInt8Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encInt8Slice(state, v.Slice(0, v.Len())) -} - -func encInt8Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]int8) - if !ok { - // It is kind int8 but not type int8. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeInt(int64(x)) - } - } - return true -} - -func encStringArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encStringSlice(state, v.Slice(0, v.Len())) -} - -func encStringSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]string) - if !ok { - // It is kind string but not type string. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != "" || state.sendZero { - state.encodeUint(uint64(len(x))) - state.b.WriteString(x) - } - } - return true -} - -func encUintArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encUintSlice(state, v.Slice(0, v.Len())) -} - -func encUintSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]uint) - if !ok { - // It is kind uint but not type uint. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeUint(uint64(x)) - } - } - return true -} - -func encUint16Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encUint16Slice(state, v.Slice(0, v.Len())) -} - -func encUint16Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]uint16) - if !ok { - // It is kind uint16 but not type uint16. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeUint(uint64(x)) - } - } - return true -} - -func encUint32Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encUint32Slice(state, v.Slice(0, v.Len())) -} - -func encUint32Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]uint32) - if !ok { - // It is kind uint32 but not type uint32. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeUint(uint64(x)) - } - } - return true -} - -func encUint64Array(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encUint64Slice(state, v.Slice(0, v.Len())) -} - -func encUint64Slice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]uint64) - if !ok { - // It is kind uint64 but not type uint64. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeUint(x) - } - } - return true -} - -func encUintptrArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return encUintptrSlice(state, v.Slice(0, v.Len())) -} - -func encUintptrSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]uintptr) - if !ok { - // It is kind uintptr but not type uintptr. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != 0 || state.sendZero { - state.encodeUint(uint64(x)) - } - } - return true -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encgen.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/encgen.go deleted file mode 100644 index efdd9282921da612c2d43afc45bb79f0742fcc42..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encgen.go +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// encgen writes the helper functions for encoding. Intended to be -// used with go generate; see the invocation in encode.go. - -// TODO: We could do more by being unsafe. Add a -unsafe flag? - -package main - -import ( - "bytes" - "flag" - "fmt" - "go/format" - "log" - "os" -) - -var output = flag.String("output", "enc_helpers.go", "file name to write") - -type Type struct { - lower string - upper string - zero string - encoder string -} - -var types = []Type{ - { - "bool", - "Bool", - "false", - `if x { - state.encodeUint(1) - } else { - state.encodeUint(0) - }`, - }, - { - "complex64", - "Complex64", - "0+0i", - `rpart := floatBits(float64(real(x))) - ipart := floatBits(float64(imag(x))) - state.encodeUint(rpart) - state.encodeUint(ipart)`, - }, - { - "complex128", - "Complex128", - "0+0i", - `rpart := floatBits(real(x)) - ipart := floatBits(imag(x)) - state.encodeUint(rpart) - state.encodeUint(ipart)`, - }, - { - "float32", - "Float32", - "0", - `bits := floatBits(float64(x)) - state.encodeUint(bits)`, - }, - { - "float64", - "Float64", - "0", - `bits := floatBits(x) - state.encodeUint(bits)`, - }, - { - "int", - "Int", - "0", - `state.encodeInt(int64(x))`, - }, - { - "int16", - "Int16", - "0", - `state.encodeInt(int64(x))`, - }, - { - "int32", - "Int32", - "0", - `state.encodeInt(int64(x))`, - }, - { - "int64", - "Int64", - "0", - `state.encodeInt(x)`, - }, - { - "int8", - "Int8", - "0", - `state.encodeInt(int64(x))`, - }, - { - "string", - "String", - `""`, - `state.encodeUint(uint64(len(x))) - state.b.WriteString(x)`, - }, - { - "uint", - "Uint", - "0", - `state.encodeUint(uint64(x))`, - }, - { - "uint16", - "Uint16", - "0", - `state.encodeUint(uint64(x))`, - }, - { - "uint32", - "Uint32", - "0", - `state.encodeUint(uint64(x))`, - }, - { - "uint64", - "Uint64", - "0", - `state.encodeUint(x)`, - }, - { - "uintptr", - "Uintptr", - "0", - `state.encodeUint(uint64(x))`, - }, - // uint8 Handled separately. -} - -func main() { - log.SetFlags(0) - log.SetPrefix("encgen: ") - flag.Parse() - if flag.NArg() != 0 { - log.Fatal("usage: encgen [--output filename]") - } - var b bytes.Buffer - fmt.Fprintf(&b, "// Created by encgen --output %s; DO NOT EDIT\n", *output) - fmt.Fprint(&b, header) - printMaps(&b, "Array") - fmt.Fprint(&b, "\n") - printMaps(&b, "Slice") - for _, t := range types { - fmt.Fprintf(&b, arrayHelper, t.lower, t.upper) - fmt.Fprintf(&b, sliceHelper, t.lower, t.upper, t.zero, t.encoder) - } - source, err := format.Source(b.Bytes()) - if err != nil { - log.Fatal("source format error:", err) - } - fd, err := os.Create(*output) - _, err = fd.Write(source) - if err != nil { - log.Fatal(err) - } -} - -func printMaps(b *bytes.Buffer, upperClass string) { - fmt.Fprintf(b, "var enc%sHelper = map[reflect.Kind]encHelper{\n", upperClass) - for _, t := range types { - fmt.Fprintf(b, "reflect.%s: enc%s%s,\n", t.upper, t.upper, upperClass) - } - fmt.Fprintf(b, "}\n") -} - -const header = ` -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "reflect" -) - -` - -const arrayHelper = ` -func enc%[2]sArray(state *encoderState, v reflect.Value) bool { - // Can only slice if it is addressable. - if !v.CanAddr() { - return false - } - return enc%[2]sSlice(state, v.Slice(0, v.Len())) -} -` - -const sliceHelper = ` -func enc%[2]sSlice(state *encoderState, v reflect.Value) bool { - slice, ok := v.Interface().([]%[1]s) - if !ok { - // It is kind %[1]s but not type %[1]s. TODO: We can handle this unsafely. - return false - } - for _, x := range slice { - if x != %[3]s || state.sendZero { - %[4]s - } - } - return true -} -` diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encode.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/encode.go deleted file mode 100644 index f66279f14134b505825c803f15483e89816493e9..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encode.go +++ /dev/null @@ -1,696 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run encgen.go -output enc_helpers.go - -package gob - -import ( - "encoding" - "math" - "reflect" -) - -const uint64Size = 8 - -type encHelper func(state *encoderState, v reflect.Value) bool - -// encoderState is the global execution state of an instance of the encoder. -// Field numbers are delta encoded and always increase. The field -// number is initialized to -1 so 0 comes out as delta(1). A delta of -// 0 terminates the structure. -type encoderState struct { - enc *Encoder - b *encBuffer - sendZero bool // encoding an array element or map key/value pair; send zero values - fieldnum int // the last field number written. - buf [1 + uint64Size]byte // buffer used by the encoder; here to avoid allocation. - next *encoderState // for free list -} - -// encBuffer is an extremely simple, fast implementation of a write-only byte buffer. -// It never returns a non-nil error, but Write returns an error value so it matches io.Writer. -type encBuffer struct { - data []byte - scratch [64]byte -} - -func (e *encBuffer) WriteByte(c byte) { - e.data = append(e.data, c) -} - -func (e *encBuffer) Write(p []byte) (int, error) { - e.data = append(e.data, p...) - return len(p), nil -} - -func (e *encBuffer) WriteString(s string) { - e.data = append(e.data, s...) -} - -func (e *encBuffer) Len() int { - return len(e.data) -} - -func (e *encBuffer) Bytes() []byte { - return e.data -} - -func (e *encBuffer) Reset() { - e.data = e.data[0:0] -} - -func (enc *Encoder) newEncoderState(b *encBuffer) *encoderState { - e := enc.freeList - if e == nil { - e = new(encoderState) - e.enc = enc - } else { - enc.freeList = e.next - } - e.sendZero = false - e.fieldnum = 0 - e.b = b - if len(b.data) == 0 { - b.data = b.scratch[0:0] - } - return e -} - -func (enc *Encoder) freeEncoderState(e *encoderState) { - e.next = enc.freeList - enc.freeList = e -} - -// Unsigned integers have a two-state encoding. If the number is less -// than 128 (0 through 0x7F), its value is written directly. -// Otherwise the value is written in big-endian byte order preceded -// by the byte length, negated. - -// encodeUint writes an encoded unsigned integer to state.b. -func (state *encoderState) encodeUint(x uint64) { - if x <= 0x7F { - state.b.WriteByte(uint8(x)) - return - } - i := uint64Size - for x > 0 { - state.buf[i] = uint8(x) - x >>= 8 - i-- - } - state.buf[i] = uint8(i - uint64Size) // = loop count, negated - state.b.Write(state.buf[i : uint64Size+1]) -} - -// encodeInt writes an encoded signed integer to state.w. -// The low bit of the encoding says whether to bit complement the (other bits of the) -// uint to recover the int. -func (state *encoderState) encodeInt(i int64) { - var x uint64 - if i < 0 { - x = uint64(^i<<1) | 1 - } else { - x = uint64(i << 1) - } - state.encodeUint(uint64(x)) -} - -// encOp is the signature of an encoding operator for a given type. -type encOp func(i *encInstr, state *encoderState, v reflect.Value) - -// The 'instructions' of the encoding machine -type encInstr struct { - op encOp - field int // field number in input - index []int // struct index - indir int // how many pointer indirections to reach the value in the struct -} - -// update emits a field number and updates the state to record its value for delta encoding. -// If the instruction pointer is nil, it does nothing -func (state *encoderState) update(instr *encInstr) { - if instr != nil { - state.encodeUint(uint64(instr.field - state.fieldnum)) - state.fieldnum = instr.field - } -} - -// Each encoder for a composite is responsible for handling any -// indirections associated with the elements of the data structure. -// If any pointer so reached is nil, no bytes are written. If the -// data item is zero, no bytes are written. Single values - ints, -// strings etc. - are indirected before calling their encoders. -// Otherwise, the output (for a scalar) is the field number, as an -// encoded integer, followed by the field data in its appropriate -// format. - -// encIndirect dereferences pv indir times and returns the result. -func encIndirect(pv reflect.Value, indir int) reflect.Value { - for ; indir > 0; indir-- { - if pv.IsNil() { - break - } - pv = pv.Elem() - } - return pv -} - -// encBool encodes the bool referenced by v as an unsigned 0 or 1. -func encBool(i *encInstr, state *encoderState, v reflect.Value) { - b := v.Bool() - if b || state.sendZero { - state.update(i) - if b { - state.encodeUint(1) - } else { - state.encodeUint(0) - } - } -} - -// encInt encodes the signed integer (int int8 int16 int32 int64) referenced by v. -func encInt(i *encInstr, state *encoderState, v reflect.Value) { - value := v.Int() - if value != 0 || state.sendZero { - state.update(i) - state.encodeInt(value) - } -} - -// encUint encodes the unsigned integer (uint uint8 uint16 uint32 uint64 uintptr) referenced by v. -func encUint(i *encInstr, state *encoderState, v reflect.Value) { - value := v.Uint() - if value != 0 || state.sendZero { - state.update(i) - state.encodeUint(value) - } -} - -// floatBits returns a uint64 holding the bits of a floating-point number. -// Floating-point numbers are transmitted as uint64s holding the bits -// of the underlying representation. They are sent byte-reversed, with -// the exponent end coming out first, so integer floating point numbers -// (for example) transmit more compactly. This routine does the -// swizzling. -func floatBits(f float64) uint64 { - u := math.Float64bits(f) - var v uint64 - for i := 0; i < 8; i++ { - v <<= 8 - v |= u & 0xFF - u >>= 8 - } - return v -} - -// encFloat encodes the floating point value (float32 float64) referenced by v. -func encFloat(i *encInstr, state *encoderState, v reflect.Value) { - f := v.Float() - if f != 0 || state.sendZero { - bits := floatBits(f) - state.update(i) - state.encodeUint(bits) - } -} - -// encComplex encodes the complex value (complex64 complex128) referenced by v. -// Complex numbers are just a pair of floating-point numbers, real part first. -func encComplex(i *encInstr, state *encoderState, v reflect.Value) { - c := v.Complex() - if c != 0+0i || state.sendZero { - rpart := floatBits(real(c)) - ipart := floatBits(imag(c)) - state.update(i) - state.encodeUint(rpart) - state.encodeUint(ipart) - } -} - -// encUint8Array encodes the byte array referenced by v. -// Byte arrays are encoded as an unsigned count followed by the raw bytes. -func encUint8Array(i *encInstr, state *encoderState, v reflect.Value) { - b := v.Bytes() - if len(b) > 0 || state.sendZero { - state.update(i) - state.encodeUint(uint64(len(b))) - state.b.Write(b) - } -} - -// encString encodes the string referenced by v. -// Strings are encoded as an unsigned count followed by the raw bytes. -func encString(i *encInstr, state *encoderState, v reflect.Value) { - s := v.String() - if len(s) > 0 || state.sendZero { - state.update(i) - state.encodeUint(uint64(len(s))) - state.b.WriteString(s) - } -} - -// encStructTerminator encodes the end of an encoded struct -// as delta field number of 0. -func encStructTerminator(i *encInstr, state *encoderState, v reflect.Value) { - state.encodeUint(0) -} - -// Execution engine - -// encEngine an array of instructions indexed by field number of the encoding -// data, typically a struct. It is executed top to bottom, walking the struct. -type encEngine struct { - instr []encInstr -} - -const singletonField = 0 - -// valid reports whether the value is valid and a non-nil pointer. -// (Slices, maps, and chans take care of themselves.) -func valid(v reflect.Value) bool { - switch v.Kind() { - case reflect.Invalid: - return false - case reflect.Ptr: - return !v.IsNil() - } - return true -} - -// encodeSingle encodes a single top-level non-struct value. -func (enc *Encoder) encodeSingle(b *encBuffer, engine *encEngine, value reflect.Value) { - state := enc.newEncoderState(b) - defer enc.freeEncoderState(state) - state.fieldnum = singletonField - // There is no surrounding struct to frame the transmission, so we must - // generate data even if the item is zero. To do this, set sendZero. - state.sendZero = true - instr := &engine.instr[singletonField] - if instr.indir > 0 { - value = encIndirect(value, instr.indir) - } - if valid(value) { - instr.op(instr, state, value) - } -} - -// encodeStruct encodes a single struct value. -func (enc *Encoder) encodeStruct(b *encBuffer, engine *encEngine, value reflect.Value) { - if !valid(value) { - return - } - state := enc.newEncoderState(b) - defer enc.freeEncoderState(state) - state.fieldnum = -1 - for i := 0; i < len(engine.instr); i++ { - instr := &engine.instr[i] - if i >= value.NumField() { - // encStructTerminator - instr.op(instr, state, reflect.Value{}) - break - } - field := value.FieldByIndex(instr.index) - if instr.indir > 0 { - field = encIndirect(field, instr.indir) - // TODO: Is field guaranteed valid? If so we could avoid this check. - if !valid(field) { - continue - } - } - instr.op(instr, state, field) - } -} - -// encodeArray encodes an array. -func (enc *Encoder) encodeArray(b *encBuffer, value reflect.Value, op encOp, elemIndir int, length int, helper encHelper) { - state := enc.newEncoderState(b) - defer enc.freeEncoderState(state) - state.fieldnum = -1 - state.sendZero = true - state.encodeUint(uint64(length)) - if helper != nil && helper(state, value) { - return - } - for i := 0; i < length; i++ { - elem := value.Index(i) - if elemIndir > 0 { - elem = encIndirect(elem, elemIndir) - // TODO: Is elem guaranteed valid? If so we could avoid this check. - if !valid(elem) { - errorf("encodeArray: nil element") - } - } - op(nil, state, elem) - } -} - -// encodeReflectValue is a helper for maps. It encodes the value v. -func encodeReflectValue(state *encoderState, v reflect.Value, op encOp, indir int) { - for i := 0; i < indir && v.IsValid(); i++ { - v = reflect.Indirect(v) - } - if !v.IsValid() { - errorf("encodeReflectValue: nil element") - } - op(nil, state, v) -} - -// encodeMap encodes a map as unsigned count followed by key:value pairs. -func (enc *Encoder) encodeMap(b *encBuffer, mv reflect.Value, keyOp, elemOp encOp, keyIndir, elemIndir int) { - state := enc.newEncoderState(b) - state.fieldnum = -1 - state.sendZero = true - keys := mv.MapKeys() - state.encodeUint(uint64(len(keys))) - for _, key := range keys { - encodeReflectValue(state, key, keyOp, keyIndir) - encodeReflectValue(state, mv.MapIndex(key), elemOp, elemIndir) - } - enc.freeEncoderState(state) -} - -// encodeInterface encodes the interface value iv. -// To send an interface, we send a string identifying the concrete type, followed -// by the type identifier (which might require defining that type right now), followed -// by the concrete value. A nil value gets sent as the empty string for the name, -// followed by no value. -func (enc *Encoder) encodeInterface(b *encBuffer, iv reflect.Value) { - // Gobs can encode nil interface values but not typed interface - // values holding nil pointers, since nil pointers point to no value. - elem := iv.Elem() - if elem.Kind() == reflect.Ptr && elem.IsNil() { - errorf("gob: cannot encode nil pointer of type %s inside interface", iv.Elem().Type()) - } - state := enc.newEncoderState(b) - state.fieldnum = -1 - state.sendZero = true - if iv.IsNil() { - state.encodeUint(0) - return - } - - ut := userType(iv.Elem().Type()) - registerLock.RLock() - name, ok := concreteTypeToName[ut.base] - registerLock.RUnlock() - if !ok { - errorf("type not registered for interface: %s", ut.base) - } - // Send the name. - state.encodeUint(uint64(len(name))) - state.b.WriteString(name) - // Define the type id if necessary. - enc.sendTypeDescriptor(enc.writer(), state, ut) - // Send the type id. - enc.sendTypeId(state, ut) - // Encode the value into a new buffer. Any nested type definitions - // should be written to b, before the encoded value. - enc.pushWriter(b) - data := new(encBuffer) - data.Write(spaceForLength) - enc.encode(data, elem, ut) - if enc.err != nil { - error_(enc.err) - } - enc.popWriter() - enc.writeMessage(b, data) - if enc.err != nil { - error_(enc.err) - } - enc.freeEncoderState(state) -} - -// isZero reports whether the value is the zero of its type. -func isZero(val reflect.Value) bool { - switch val.Kind() { - case reflect.Array: - for i := 0; i < val.Len(); i++ { - if !isZero(val.Index(i)) { - return false - } - } - return true - case reflect.Map, reflect.Slice, reflect.String: - return val.Len() == 0 - case reflect.Bool: - return !val.Bool() - case reflect.Complex64, reflect.Complex128: - return val.Complex() == 0 - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr: - return val.IsNil() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return val.Int() == 0 - case reflect.Float32, reflect.Float64: - return val.Float() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return val.Uint() == 0 - case reflect.Struct: - for i := 0; i < val.NumField(); i++ { - if !isZero(val.Field(i)) { - return false - } - } - return true - } - panic("unknown type in isZero " + val.Type().String()) -} - -// encGobEncoder encodes a value that implements the GobEncoder interface. -// The data is sent as a byte array. -func (enc *Encoder) encodeGobEncoder(b *encBuffer, ut *userTypeInfo, v reflect.Value) { - // TODO: should we catch panics from the called method? - - var data []byte - var err error - // We know it's one of these. - switch ut.externalEnc { - case xGob: - data, err = v.Interface().(GobEncoder).GobEncode() - case xBinary: - data, err = v.Interface().(encoding.BinaryMarshaler).MarshalBinary() - case xText: - data, err = v.Interface().(encoding.TextMarshaler).MarshalText() - } - if err != nil { - error_(err) - } - state := enc.newEncoderState(b) - state.fieldnum = -1 - state.encodeUint(uint64(len(data))) - state.b.Write(data) - enc.freeEncoderState(state) -} - -var encOpTable = [...]encOp{ - reflect.Bool: encBool, - reflect.Int: encInt, - reflect.Int8: encInt, - reflect.Int16: encInt, - reflect.Int32: encInt, - reflect.Int64: encInt, - reflect.Uint: encUint, - reflect.Uint8: encUint, - reflect.Uint16: encUint, - reflect.Uint32: encUint, - reflect.Uint64: encUint, - reflect.Uintptr: encUint, - reflect.Float32: encFloat, - reflect.Float64: encFloat, - reflect.Complex64: encComplex, - reflect.Complex128: encComplex, - reflect.String: encString, -} - -// encOpFor returns (a pointer to) the encoding op for the base type under rt and -// the indirection count to reach it. -func encOpFor(rt reflect.Type, inProgress map[reflect.Type]*encOp, building map[*typeInfo]bool) (*encOp, int) { - ut := userType(rt) - // If the type implements GobEncoder, we handle it without further processing. - if ut.externalEnc != 0 { - return gobEncodeOpFor(ut) - } - // If this type is already in progress, it's a recursive type (e.g. map[string]*T). - // Return the pointer to the op we're already building. - if opPtr := inProgress[rt]; opPtr != nil { - return opPtr, ut.indir - } - typ := ut.base - indir := ut.indir - k := typ.Kind() - var op encOp - if int(k) < len(encOpTable) { - op = encOpTable[k] - } - if op == nil { - inProgress[rt] = &op - // Special cases - switch t := typ; t.Kind() { - case reflect.Slice: - if t.Elem().Kind() == reflect.Uint8 { - op = encUint8Array - break - } - // Slices have a header; we decode it to find the underlying array. - elemOp, elemIndir := encOpFor(t.Elem(), inProgress, building) - helper := encSliceHelper[t.Elem().Kind()] - op = func(i *encInstr, state *encoderState, slice reflect.Value) { - if !state.sendZero && slice.Len() == 0 { - return - } - state.update(i) - state.enc.encodeArray(state.b, slice, *elemOp, elemIndir, slice.Len(), helper) - } - case reflect.Array: - // True arrays have size in the type. - elemOp, elemIndir := encOpFor(t.Elem(), inProgress, building) - helper := encArrayHelper[t.Elem().Kind()] - op = func(i *encInstr, state *encoderState, array reflect.Value) { - state.update(i) - state.enc.encodeArray(state.b, array, *elemOp, elemIndir, array.Len(), helper) - } - case reflect.Map: - keyOp, keyIndir := encOpFor(t.Key(), inProgress, building) - elemOp, elemIndir := encOpFor(t.Elem(), inProgress, building) - op = func(i *encInstr, state *encoderState, mv reflect.Value) { - // We send zero-length (but non-nil) maps because the - // receiver might want to use the map. (Maps don't use append.) - if !state.sendZero && mv.IsNil() { - return - } - state.update(i) - state.enc.encodeMap(state.b, mv, *keyOp, *elemOp, keyIndir, elemIndir) - } - case reflect.Struct: - // Generate a closure that calls out to the engine for the nested type. - getEncEngine(userType(typ), building) - info := mustGetTypeInfo(typ) - op = func(i *encInstr, state *encoderState, sv reflect.Value) { - state.update(i) - // indirect through info to delay evaluation for recursive structs - enc := info.encoder.Load().(*encEngine) - state.enc.encodeStruct(state.b, enc, sv) - } - case reflect.Interface: - op = func(i *encInstr, state *encoderState, iv reflect.Value) { - if !state.sendZero && (!iv.IsValid() || iv.IsNil()) { - return - } - state.update(i) - state.enc.encodeInterface(state.b, iv) - } - } - } - if op == nil { - errorf("can't happen: encode type %s", rt) - } - return &op, indir -} - -// gobEncodeOpFor returns the op for a type that is known to implement GobEncoder. -func gobEncodeOpFor(ut *userTypeInfo) (*encOp, int) { - rt := ut.user - if ut.encIndir == -1 { - rt = reflect.PtrTo(rt) - } else if ut.encIndir > 0 { - for i := int8(0); i < ut.encIndir; i++ { - rt = rt.Elem() - } - } - var op encOp - op = func(i *encInstr, state *encoderState, v reflect.Value) { - if ut.encIndir == -1 { - // Need to climb up one level to turn value into pointer. - if !v.CanAddr() { - errorf("unaddressable value of type %s", rt) - } - v = v.Addr() - } - if !state.sendZero && isZero(v) { - return - } - state.update(i) - state.enc.encodeGobEncoder(state.b, ut, v) - } - return &op, int(ut.encIndir) // encIndir: op will get called with p == address of receiver. -} - -// compileEnc returns the engine to compile the type. -func compileEnc(ut *userTypeInfo, building map[*typeInfo]bool) *encEngine { - srt := ut.base - engine := new(encEngine) - seen := make(map[reflect.Type]*encOp) - rt := ut.base - if ut.externalEnc != 0 { - rt = ut.user - } - if ut.externalEnc == 0 && srt.Kind() == reflect.Struct { - for fieldNum, wireFieldNum := 0, 0; fieldNum < srt.NumField(); fieldNum++ { - f := srt.Field(fieldNum) - if !isSent(&f) { - continue - } - op, indir := encOpFor(f.Type, seen, building) - engine.instr = append(engine.instr, encInstr{*op, wireFieldNum, f.Index, indir}) - wireFieldNum++ - } - if srt.NumField() > 0 && len(engine.instr) == 0 { - errorf("type %s has no exported fields", rt) - } - engine.instr = append(engine.instr, encInstr{encStructTerminator, 0, nil, 0}) - } else { - engine.instr = make([]encInstr, 1) - op, indir := encOpFor(rt, seen, building) - engine.instr[0] = encInstr{*op, singletonField, nil, indir} - } - return engine -} - -// getEncEngine returns the engine to compile the type. -func getEncEngine(ut *userTypeInfo, building map[*typeInfo]bool) *encEngine { - info, err := getTypeInfo(ut) - if err != nil { - error_(err) - } - enc, ok := info.encoder.Load().(*encEngine) - if !ok { - enc = buildEncEngine(info, ut, building) - } - return enc -} - -func buildEncEngine(info *typeInfo, ut *userTypeInfo, building map[*typeInfo]bool) *encEngine { - // Check for recursive types. - if building != nil && building[info] { - return nil - } - info.encInit.Lock() - defer info.encInit.Unlock() - enc, ok := info.encoder.Load().(*encEngine) - if !ok { - if building == nil { - building = make(map[*typeInfo]bool) - } - building[info] = true - enc = compileEnc(ut, building) - info.encoder.Store(enc) - } - return enc -} - -func (enc *Encoder) encode(b *encBuffer, value reflect.Value, ut *userTypeInfo) { - defer catchError(&enc.err) - engine := getEncEngine(ut, nil) - indir := ut.indir - if ut.externalEnc != 0 { - indir = int(ut.encIndir) - } - for i := 0; i < indir; i++ { - value = reflect.Indirect(value) - } - if ut.externalEnc == 0 && value.Type().Kind() == reflect.Struct { - enc.encodeStruct(b, engine, value) - } else { - enc.encodeSingle(b, engine, value) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder.go deleted file mode 100644 index 62d0f42e81ae3fc8f7bbdd692bfc31427803a68d..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "errors" - "io" - "reflect" - "sync" -) - -// An Encoder manages the transmission of type and data information to the -// other side of a connection. -type Encoder struct { - mutex sync.Mutex // each item must be sent atomically - w []io.Writer // where to send the data - sent map[reflect.Type]typeId // which types we've already sent - countState *encoderState // stage for writing counts - freeList *encoderState // list of free encoderStates; avoids reallocation - byteBuf encBuffer // buffer for top-level encoderState - err error -} - -// Before we encode a message, we reserve space at the head of the -// buffer in which to encode its length. This means we can use the -// buffer to assemble the message without another allocation. -const maxLength = 9 // Maximum size of an encoded length. -var spaceForLength = make([]byte, maxLength) - -// NewEncoder returns a new encoder that will transmit on the io.Writer. -func NewEncoder(w io.Writer) *Encoder { - enc := new(Encoder) - enc.w = []io.Writer{w} - enc.sent = make(map[reflect.Type]typeId) - enc.countState = enc.newEncoderState(new(encBuffer)) - return enc -} - -// writer() returns the innermost writer the encoder is using -func (enc *Encoder) writer() io.Writer { - return enc.w[len(enc.w)-1] -} - -// pushWriter adds a writer to the encoder. -func (enc *Encoder) pushWriter(w io.Writer) { - enc.w = append(enc.w, w) -} - -// popWriter pops the innermost writer. -func (enc *Encoder) popWriter() { - enc.w = enc.w[0 : len(enc.w)-1] -} - -func (enc *Encoder) setError(err error) { - if enc.err == nil { // remember the first. - enc.err = err - } -} - -// writeMessage sends the data item preceded by a unsigned count of its length. -func (enc *Encoder) writeMessage(w io.Writer, b *encBuffer) { - // Space has been reserved for the length at the head of the message. - // This is a little dirty: we grab the slice from the bytes.Buffer and massage - // it by hand. - message := b.Bytes() - messageLen := len(message) - maxLength - // Length cannot be bigger than the decoder can handle. - if messageLen >= tooBig { - enc.setError(errors.New("gob: encoder: message too big")) - return - } - // Encode the length. - enc.countState.b.Reset() - enc.countState.encodeUint(uint64(messageLen)) - // Copy the length to be a prefix of the message. - offset := maxLength - enc.countState.b.Len() - copy(message[offset:], enc.countState.b.Bytes()) - // Write the data. - _, err := w.Write(message[offset:]) - // Drain the buffer and restore the space at the front for the count of the next message. - b.Reset() - b.Write(spaceForLength) - if err != nil { - enc.setError(err) - } -} - -// sendActualType sends the requested type, without further investigation, unless -// it's been sent before. -func (enc *Encoder) sendActualType(w io.Writer, state *encoderState, ut *userTypeInfo, actual reflect.Type) (sent bool) { - if _, alreadySent := enc.sent[actual]; alreadySent { - return false - } - info, err := getTypeInfo(ut) - if err != nil { - enc.setError(err) - return - } - // Send the pair (-id, type) - // Id: - state.encodeInt(-int64(info.id)) - // Type: - enc.encode(state.b, reflect.ValueOf(info.wire), wireTypeUserInfo) - enc.writeMessage(w, state.b) - if enc.err != nil { - return - } - - // Remember we've sent this type, both what the user gave us and the base type. - enc.sent[ut.base] = info.id - if ut.user != ut.base { - enc.sent[ut.user] = info.id - } - // Now send the inner types - switch st := actual; st.Kind() { - case reflect.Struct: - for i := 0; i < st.NumField(); i++ { - if isExported(st.Field(i).Name) { - enc.sendType(w, state, st.Field(i).Type) - } - } - case reflect.Array, reflect.Slice: - enc.sendType(w, state, st.Elem()) - case reflect.Map: - enc.sendType(w, state, st.Key()) - enc.sendType(w, state, st.Elem()) - } - return true -} - -// sendType sends the type info to the other side, if necessary. -func (enc *Encoder) sendType(w io.Writer, state *encoderState, origt reflect.Type) (sent bool) { - ut := userType(origt) - if ut.externalEnc != 0 { - // The rules are different: regardless of the underlying type's representation, - // we need to tell the other side that the base type is a GobEncoder. - return enc.sendActualType(w, state, ut, ut.base) - } - - // It's a concrete value, so drill down to the base type. - switch rt := ut.base; rt.Kind() { - default: - // Basic types and interfaces do not need to be described. - return - case reflect.Slice: - // If it's []uint8, don't send; it's considered basic. - if rt.Elem().Kind() == reflect.Uint8 { - return - } - // Otherwise we do send. - break - case reflect.Array: - // arrays must be sent so we know their lengths and element types. - break - case reflect.Map: - // maps must be sent so we know their lengths and key/value types. - break - case reflect.Struct: - // structs must be sent so we know their fields. - break - case reflect.Chan, reflect.Func: - // If we get here, it's a field of a struct; ignore it. - return - } - - return enc.sendActualType(w, state, ut, ut.base) -} - -// Encode transmits the data item represented by the empty interface value, -// guaranteeing that all necessary type information has been transmitted first. -func (enc *Encoder) Encode(e interface{}) error { - return enc.EncodeValue(reflect.ValueOf(e)) -} - -// sendTypeDescriptor makes sure the remote side knows about this type. -// It will send a descriptor if this is the first time the type has been -// sent. -func (enc *Encoder) sendTypeDescriptor(w io.Writer, state *encoderState, ut *userTypeInfo) { - // Make sure the type is known to the other side. - // First, have we already sent this type? - rt := ut.base - if ut.externalEnc != 0 { - rt = ut.user - } - if _, alreadySent := enc.sent[rt]; !alreadySent { - // No, so send it. - sent := enc.sendType(w, state, rt) - if enc.err != nil { - return - } - // If the type info has still not been transmitted, it means we have - // a singleton basic type (int, []byte etc.) at top level. We don't - // need to send the type info but we do need to update enc.sent. - if !sent { - info, err := getTypeInfo(ut) - if err != nil { - enc.setError(err) - return - } - enc.sent[rt] = info.id - } - } -} - -// sendTypeId sends the id, which must have already been defined. -func (enc *Encoder) sendTypeId(state *encoderState, ut *userTypeInfo) { - // Identify the type of this top-level value. - state.encodeInt(int64(enc.sent[ut.base])) -} - -// EncodeValue transmits the data item represented by the reflection value, -// guaranteeing that all necessary type information has been transmitted first. -func (enc *Encoder) EncodeValue(value reflect.Value) error { - // Gobs contain values. They cannot represent nil pointers, which - // have no value to encode. - if value.Kind() == reflect.Ptr && value.IsNil() { - panic("gob: cannot encode nil pointer of type " + value.Type().String()) - } - - // Make sure we're single-threaded through here, so multiple - // goroutines can share an encoder. - enc.mutex.Lock() - defer enc.mutex.Unlock() - - // Remove any nested writers remaining due to previous errors. - enc.w = enc.w[0:1] - - ut, err := validUserType(value.Type()) - if err != nil { - return err - } - - enc.err = nil - enc.byteBuf.Reset() - enc.byteBuf.Write(spaceForLength) - state := enc.newEncoderState(&enc.byteBuf) - - enc.sendTypeDescriptor(enc.writer(), state, ut) - enc.sendTypeId(state, ut) - if enc.err != nil { - return enc.err - } - - // Encode the object. - enc.encode(state.b, value, ut) - if enc.err == nil { - enc.writeMessage(enc.writer(), state.b) - } - - enc.freeEncoderState(state) - return enc.err -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder_test.go deleted file mode 100644 index dc657348223ce005dc3055ea9d68da918a3697fc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/encoder_test.go +++ /dev/null @@ -1,1020 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "bytes" - "encoding/hex" - "fmt" - "reflect" - "strings" - "testing" -) - -// Test basic operations in a safe manner. -func TestBasicEncoderDecoder(t *testing.T) { - var values = []interface{}{ - true, - int(123), - int8(123), - int16(-12345), - int32(123456), - int64(-1234567), - uint(123), - uint8(123), - uint16(12345), - uint32(123456), - uint64(1234567), - uintptr(12345678), - float32(1.2345), - float64(1.2345678), - complex64(1.2345 + 2.3456i), - complex128(1.2345678 + 2.3456789i), - []byte("hello"), - string("hello"), - } - for _, value := range values { - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(value) - if err != nil { - t.Error("encoder fail:", err) - } - dec := NewDecoder(b) - result := reflect.New(reflect.TypeOf(value)) - err = dec.Decode(result.Interface()) - if err != nil { - t.Fatalf("error decoding %T: %v:", reflect.TypeOf(value), err) - } - if !reflect.DeepEqual(value, result.Elem().Interface()) { - t.Fatalf("%T: expected %v got %v", value, value, result.Elem().Interface()) - } - } -} - -type ET0 struct { - A int - B string -} - -type ET2 struct { - X string -} - -type ET1 struct { - A int - Et2 *ET2 - Next *ET1 -} - -// Like ET1 but with a different name for a field -type ET3 struct { - A int - Et2 *ET2 - DifferentNext *ET1 -} - -// Like ET1 but with a different type for a field -type ET4 struct { - A int - Et2 float64 - Next int -} - -func TestEncoderDecoder(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - et0 := new(ET0) - et0.A = 7 - et0.B = "gobs of fun" - err := enc.Encode(et0) - if err != nil { - t.Error("encoder fail:", err) - } - //fmt.Printf("% x %q\n", b, b) - //Debug(b) - dec := NewDecoder(b) - newEt0 := new(ET0) - err = dec.Decode(newEt0) - if err != nil { - t.Fatal("error decoding ET0:", err) - } - - if !reflect.DeepEqual(et0, newEt0) { - t.Fatalf("invalid data for et0: expected %+v; got %+v", *et0, *newEt0) - } - if b.Len() != 0 { - t.Error("not at eof;", b.Len(), "bytes left") - } - // t.FailNow() - - b = new(bytes.Buffer) - enc = NewEncoder(b) - et1 := new(ET1) - et1.A = 7 - et1.Et2 = new(ET2) - err = enc.Encode(et1) - if err != nil { - t.Error("encoder fail:", err) - } - dec = NewDecoder(b) - newEt1 := new(ET1) - err = dec.Decode(newEt1) - if err != nil { - t.Fatal("error decoding ET1:", err) - } - - if !reflect.DeepEqual(et1, newEt1) { - t.Fatalf("invalid data for et1: expected %+v; got %+v", *et1, *newEt1) - } - if b.Len() != 0 { - t.Error("not at eof;", b.Len(), "bytes left") - } - - enc.Encode(et1) - newEt1 = new(ET1) - err = dec.Decode(newEt1) - if err != nil { - t.Fatal("round 2: error decoding ET1:", err) - } - if !reflect.DeepEqual(et1, newEt1) { - t.Fatalf("round 2: invalid data for et1: expected %+v; got %+v", *et1, *newEt1) - } - if b.Len() != 0 { - t.Error("round 2: not at eof;", b.Len(), "bytes left") - } - - // Now test with a running encoder/decoder pair that we recognize a type mismatch. - err = enc.Encode(et1) - if err != nil { - t.Error("round 3: encoder fail:", err) - } - newEt2 := new(ET2) - err = dec.Decode(newEt2) - if err == nil { - t.Fatal("round 3: expected `bad type' error decoding ET2") - } -} - -// Run one value through the encoder/decoder, but use the wrong type. -// Input is always an ET1; we compare it to whatever is under 'e'. -func badTypeCheck(e interface{}, shouldFail bool, msg string, t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - et1 := new(ET1) - et1.A = 7 - et1.Et2 = new(ET2) - err := enc.Encode(et1) - if err != nil { - t.Error("encoder fail:", err) - } - dec := NewDecoder(b) - err = dec.Decode(e) - if shouldFail && err == nil { - t.Error("expected error for", msg) - } - if !shouldFail && err != nil { - t.Error("unexpected error for", msg, err) - } -} - -// Test that we recognize a bad type the first time. -func TestWrongTypeDecoder(t *testing.T) { - badTypeCheck(new(ET2), true, "no fields in common", t) - badTypeCheck(new(ET3), false, "different name of field", t) - badTypeCheck(new(ET4), true, "different type of field", t) -} - -// Types not supported at top level by the Encoder. -var unsupportedValues = []interface{}{ - make(chan int), - func(a int) bool { return true }, -} - -func TestUnsupported(t *testing.T) { - var b bytes.Buffer - enc := NewEncoder(&b) - for _, v := range unsupportedValues { - err := enc.Encode(v) - if err == nil { - t.Errorf("expected error for %T; got none", v) - } - } -} - -func encAndDec(in, out interface{}) error { - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(in) - if err != nil { - return err - } - dec := NewDecoder(b) - err = dec.Decode(out) - if err != nil { - return err - } - return nil -} - -func TestTypeToPtrType(t *testing.T) { - // Encode a T, decode a *T - type Type0 struct { - A int - } - t0 := Type0{7} - t0p := new(Type0) - if err := encAndDec(t0, t0p); err != nil { - t.Error(err) - } -} - -func TestPtrTypeToType(t *testing.T) { - // Encode a *T, decode a T - type Type1 struct { - A uint - } - t1p := &Type1{17} - var t1 Type1 - if err := encAndDec(t1, t1p); err != nil { - t.Error(err) - } -} - -func TestTypeToPtrPtrPtrPtrType(t *testing.T) { - type Type2 struct { - A ****float64 - } - t2 := Type2{} - t2.A = new(***float64) - *t2.A = new(**float64) - **t2.A = new(*float64) - ***t2.A = new(float64) - ****t2.A = 27.4 - t2pppp := new(***Type2) - if err := encAndDec(t2, t2pppp); err != nil { - t.Fatal(err) - } - if ****(****t2pppp).A != ****t2.A { - t.Errorf("wrong value after decode: %g not %g", ****(****t2pppp).A, ****t2.A) - } -} - -func TestSlice(t *testing.T) { - type Type3 struct { - A []string - } - t3p := &Type3{[]string{"hello", "world"}} - var t3 Type3 - if err := encAndDec(t3, t3p); err != nil { - t.Error(err) - } -} - -func TestValueError(t *testing.T) { - // Encode a *T, decode a T - type Type4 struct { - A int - } - t4p := &Type4{3} - var t4 Type4 // note: not a pointer. - if err := encAndDec(t4p, t4); err == nil || strings.Index(err.Error(), "pointer") < 0 { - t.Error("expected error about pointer; got", err) - } -} - -func TestArray(t *testing.T) { - type Type5 struct { - A [3]string - B [3]byte - } - type Type6 struct { - A [2]string // can't hold t5.a - } - t5 := Type5{[3]string{"hello", ",", "world"}, [3]byte{1, 2, 3}} - var t5p Type5 - if err := encAndDec(t5, &t5p); err != nil { - t.Error(err) - } - var t6 Type6 - if err := encAndDec(t5, &t6); err == nil { - t.Error("should fail with mismatched array sizes") - } -} - -func TestRecursiveMapType(t *testing.T) { - type recursiveMap map[string]recursiveMap - r1 := recursiveMap{"A": recursiveMap{"B": nil, "C": nil}, "D": nil} - r2 := make(recursiveMap) - if err := encAndDec(r1, &r2); err != nil { - t.Error(err) - } -} - -func TestRecursiveSliceType(t *testing.T) { - type recursiveSlice []recursiveSlice - r1 := recursiveSlice{0: recursiveSlice{0: nil}, 1: nil} - r2 := make(recursiveSlice, 0) - if err := encAndDec(r1, &r2); err != nil { - t.Error(err) - } -} - -// Regression test for bug: must send zero values inside arrays -func TestDefaultsInArray(t *testing.T) { - type Type7 struct { - B []bool - I []int - S []string - F []float64 - } - t7 := Type7{ - []bool{false, false, true}, - []int{0, 0, 1}, - []string{"hi", "", "there"}, - []float64{0, 0, 1}, - } - var t7p Type7 - if err := encAndDec(t7, &t7p); err != nil { - t.Error(err) - } -} - -var testInt int -var testFloat32 float32 -var testString string -var testSlice []string -var testMap map[string]int -var testArray [7]int - -type SingleTest struct { - in interface{} - out interface{} - err string -} - -var singleTests = []SingleTest{ - {17, &testInt, ""}, - {float32(17.5), &testFloat32, ""}, - {"bike shed", &testString, ""}, - {[]string{"bike", "shed", "paint", "color"}, &testSlice, ""}, - {map[string]int{"seven": 7, "twelve": 12}, &testMap, ""}, - {[7]int{4, 55, 0, 0, 0, 0, 0}, &testArray, ""}, // case that once triggered a bug - {[7]int{4, 55, 1, 44, 22, 66, 1234}, &testArray, ""}, - - // Decode errors - {172, &testFloat32, "type"}, -} - -func TestSingletons(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - dec := NewDecoder(b) - for _, test := range singleTests { - b.Reset() - err := enc.Encode(test.in) - if err != nil { - t.Errorf("error encoding %v: %s", test.in, err) - continue - } - err = dec.Decode(test.out) - switch { - case err != nil && test.err == "": - t.Errorf("error decoding %v: %s", test.in, err) - continue - case err == nil && test.err != "": - t.Errorf("expected error decoding %v: %s", test.in, test.err) - continue - case err != nil && test.err != "": - if strings.Index(err.Error(), test.err) < 0 { - t.Errorf("wrong error decoding %v: wanted %s, got %v", test.in, test.err, err) - } - continue - } - // Get rid of the pointer in the rhs - val := reflect.ValueOf(test.out).Elem().Interface() - if !reflect.DeepEqual(test.in, val) { - t.Errorf("decoding singleton: expected %v got %v", test.in, val) - } - } -} - -func TestStructNonStruct(t *testing.T) { - type Struct struct { - A string - } - type NonStruct string - s := Struct{"hello"} - var sp Struct - if err := encAndDec(s, &sp); err != nil { - t.Error(err) - } - var ns NonStruct - if err := encAndDec(s, &ns); err == nil { - t.Error("should get error for struct/non-struct") - } else if strings.Index(err.Error(), "type") < 0 { - t.Error("for struct/non-struct expected type error; got", err) - } - // Now try the other way - var nsp NonStruct - if err := encAndDec(ns, &nsp); err != nil { - t.Error(err) - } - if err := encAndDec(ns, &s); err == nil { - t.Error("should get error for non-struct/struct") - } else if strings.Index(err.Error(), "type") < 0 { - t.Error("for non-struct/struct expected type error; got", err) - } -} - -type interfaceIndirectTestI interface { - F() bool -} - -type interfaceIndirectTestT struct{} - -func (this *interfaceIndirectTestT) F() bool { - return true -} - -// A version of a bug reported on golang-nuts. Also tests top-level -// slice of interfaces. The issue was registering *T caused T to be -// stored as the concrete type. -func TestInterfaceIndirect(t *testing.T) { - Register(&interfaceIndirectTestT{}) - b := new(bytes.Buffer) - w := []interfaceIndirectTestI{&interfaceIndirectTestT{}} - err := NewEncoder(b).Encode(w) - if err != nil { - t.Fatal("encode error:", err) - } - - var r []interfaceIndirectTestI - err = NewDecoder(b).Decode(&r) - if err != nil { - t.Fatal("decode error:", err) - } -} - -// Now follow various tests that decode into things that can't represent the -// encoded value, all of which should be legal. - -// Also, when the ignored object contains an interface value, it may define -// types. Make sure that skipping the value still defines the types by using -// the encoder/decoder pair to send a value afterwards. If an interface -// is sent, its type in the test is always NewType0, so this checks that the -// encoder and decoder don't skew with respect to type definitions. - -type Struct0 struct { - I interface{} -} - -type NewType0 struct { - S string -} - -type ignoreTest struct { - in, out interface{} -} - -var ignoreTests = []ignoreTest{ - // Decode normal struct into an empty struct - {&struct{ A int }{23}, &struct{}{}}, - // Decode normal struct into a nil. - {&struct{ A int }{23}, nil}, - // Decode singleton string into a nil. - {"hello, world", nil}, - // Decode singleton slice into a nil. - {[]int{1, 2, 3, 4}, nil}, - // Decode struct containing an interface into a nil. - {&Struct0{&NewType0{"value0"}}, nil}, - // Decode singleton slice of interfaces into a nil. - {[]interface{}{"hi", &NewType0{"value1"}, 23}, nil}, -} - -func TestDecodeIntoNothing(t *testing.T) { - Register(new(NewType0)) - for i, test := range ignoreTests { - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(test.in) - if err != nil { - t.Errorf("%d: encode error %s:", i, err) - continue - } - dec := NewDecoder(b) - err = dec.Decode(test.out) - if err != nil { - t.Errorf("%d: decode error: %s", i, err) - continue - } - // Now see if the encoder and decoder are in a consistent state. - str := fmt.Sprintf("Value %d", i) - err = enc.Encode(&NewType0{str}) - if err != nil { - t.Fatalf("%d: NewType0 encode error: %s", i, err) - } - ns := new(NewType0) - err = dec.Decode(ns) - if err != nil { - t.Fatalf("%d: NewType0 decode error: %s", i, err) - } - if ns.S != str { - t.Fatalf("%d: expected %q got %q", i, str, ns.S) - } - } -} - -func TestIgnoreRecursiveType(t *testing.T) { - // It's hard to build a self-contained test for this because - // we can't build compatible types in one package with - // different items so something is ignored. Here is - // some data that represents, according to debug.go: - // type definition { - // slice "recursiveSlice" id=106 - // elem id=106 - // } - data := []byte{ - 0x1d, 0xff, 0xd3, 0x02, 0x01, 0x01, 0x0e, 0x72, - 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, - 0x53, 0x6c, 0x69, 0x63, 0x65, 0x01, 0xff, 0xd4, - 0x00, 0x01, 0xff, 0xd4, 0x00, 0x00, 0x07, 0xff, - 0xd4, 0x00, 0x02, 0x01, 0x00, 0x00, - } - dec := NewDecoder(bytes.NewReader(data)) - // Issue 10415: This caused infinite recursion. - err := dec.Decode(nil) - if err != nil { - t.Fatal(err) - } -} - -// Another bug from golang-nuts, involving nested interfaces. -type Bug0Outer struct { - Bug0Field interface{} -} - -type Bug0Inner struct { - A int -} - -func TestNestedInterfaces(t *testing.T) { - var buf bytes.Buffer - e := NewEncoder(&buf) - d := NewDecoder(&buf) - Register(new(Bug0Outer)) - Register(new(Bug0Inner)) - f := &Bug0Outer{&Bug0Outer{&Bug0Inner{7}}} - var v interface{} = f - err := e.Encode(&v) - if err != nil { - t.Fatal("Encode:", err) - } - err = d.Decode(&v) - if err != nil { - t.Fatal("Decode:", err) - } - // Make sure it decoded correctly. - outer1, ok := v.(*Bug0Outer) - if !ok { - t.Fatalf("v not Bug0Outer: %T", v) - } - outer2, ok := outer1.Bug0Field.(*Bug0Outer) - if !ok { - t.Fatalf("v.Bug0Field not Bug0Outer: %T", outer1.Bug0Field) - } - inner, ok := outer2.Bug0Field.(*Bug0Inner) - if !ok { - t.Fatalf("v.Bug0Field.Bug0Field not Bug0Inner: %T", outer2.Bug0Field) - } - if inner.A != 7 { - t.Fatalf("final value %d; expected %d", inner.A, 7) - } -} - -// The bugs keep coming. We forgot to send map subtypes before the map. - -type Bug1Elem struct { - Name string - Id int -} - -type Bug1StructMap map[string]Bug1Elem - -func bug1EncDec(in Bug1StructMap, out *Bug1StructMap) error { - return nil -} - -func TestMapBug1(t *testing.T) { - in := make(Bug1StructMap) - in["val1"] = Bug1Elem{"elem1", 1} - in["val2"] = Bug1Elem{"elem2", 2} - - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(in) - if err != nil { - t.Fatal("encode:", err) - } - dec := NewDecoder(b) - out := make(Bug1StructMap) - err = dec.Decode(&out) - if err != nil { - t.Fatal("decode:", err) - } - if !reflect.DeepEqual(in, out) { - t.Errorf("mismatch: %v %v", in, out) - } -} - -func TestGobMapInterfaceEncode(t *testing.T) { - m := map[string]interface{}{ - "up": uintptr(0), - "i0": []int{-1}, - "i1": []int8{-1}, - "i2": []int16{-1}, - "i3": []int32{-1}, - "i4": []int64{-1}, - "u0": []uint{1}, - "u1": []uint8{1}, - "u2": []uint16{1}, - "u3": []uint32{1}, - "u4": []uint64{1}, - "f0": []float32{1}, - "f1": []float64{1}, - "c0": []complex64{complex(2, -2)}, - "c1": []complex128{complex(2, float64(-2))}, - "us": []uintptr{0}, - "bo": []bool{false}, - "st": []string{"s"}, - } - enc := NewEncoder(new(bytes.Buffer)) - err := enc.Encode(m) - if err != nil { - t.Errorf("encode map: %s", err) - } -} - -func TestSliceReusesMemory(t *testing.T) { - buf := new(bytes.Buffer) - // Bytes - { - x := []byte("abcd") - enc := NewEncoder(buf) - err := enc.Encode(x) - if err != nil { - t.Errorf("bytes: encode: %s", err) - } - // Decode into y, which is big enough. - y := []byte("ABCDE") - addr := &y[0] - dec := NewDecoder(buf) - err = dec.Decode(&y) - if err != nil { - t.Fatal("bytes: decode:", err) - } - if !bytes.Equal(x, y) { - t.Errorf("bytes: expected %q got %q\n", x, y) - } - if addr != &y[0] { - t.Errorf("bytes: unnecessary reallocation") - } - } - // general slice - { - x := []rune("abcd") - enc := NewEncoder(buf) - err := enc.Encode(x) - if err != nil { - t.Errorf("ints: encode: %s", err) - } - // Decode into y, which is big enough. - y := []rune("ABCDE") - addr := &y[0] - dec := NewDecoder(buf) - err = dec.Decode(&y) - if err != nil { - t.Fatal("ints: decode:", err) - } - if !reflect.DeepEqual(x, y) { - t.Errorf("ints: expected %q got %q\n", x, y) - } - if addr != &y[0] { - t.Errorf("ints: unnecessary reallocation") - } - } -} - -// Used to crash: negative count in recvMessage. -func TestBadCount(t *testing.T) { - b := []byte{0xfb, 0xa5, 0x82, 0x2f, 0xca, 0x1} - if err := NewDecoder(bytes.NewReader(b)).Decode(nil); err == nil { - t.Error("expected error from bad count") - } else if err.Error() != errBadCount.Error() { - t.Error("expected bad count error; got", err) - } -} - -// Verify that sequential Decoders built on a single input will -// succeed if the input implements ReadByte and there is no -// type information in the stream. -func TestSequentialDecoder(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - const count = 10 - for i := 0; i < count; i++ { - s := fmt.Sprintf("%d", i) - if err := enc.Encode(s); err != nil { - t.Error("encoder fail:", err) - } - } - for i := 0; i < count; i++ { - dec := NewDecoder(b) - var s string - if err := dec.Decode(&s); err != nil { - t.Fatal("decoder fail:", err) - } - if s != fmt.Sprintf("%d", i) { - t.Fatalf("decode expected %d got %s", i, s) - } - } -} - -// Should be able to have unrepresentable fields (chan, func, *chan etc.); we just ignore them. -type Bug2 struct { - A int - C chan int - CP *chan int - F func() - FPP **func() -} - -func TestChanFuncIgnored(t *testing.T) { - c := make(chan int) - f := func() {} - fp := &f - b0 := Bug2{23, c, &c, f, &fp} - var buf bytes.Buffer - enc := NewEncoder(&buf) - if err := enc.Encode(b0); err != nil { - t.Fatal("error encoding:", err) - } - var b1 Bug2 - err := NewDecoder(&buf).Decode(&b1) - if err != nil { - t.Fatal("decode:", err) - } - if b1.A != b0.A { - t.Fatalf("got %d want %d", b1.A, b0.A) - } - if b1.C != nil || b1.CP != nil || b1.F != nil || b1.FPP != nil { - t.Fatal("unexpected value for chan or func") - } -} - -func TestSliceIncompatibility(t *testing.T) { - var in = []byte{1, 2, 3} - var out []int - if err := encAndDec(in, &out); err == nil { - t.Error("expected compatibility error") - } -} - -// Mutually recursive slices of structs caused problems. -type Bug3 struct { - Num int - Children []*Bug3 -} - -func TestGobPtrSlices(t *testing.T) { - in := []*Bug3{ - {1, nil}, - {2, nil}, - } - b := new(bytes.Buffer) - err := NewEncoder(b).Encode(&in) - if err != nil { - t.Fatal("encode:", err) - } - - var out []*Bug3 - err = NewDecoder(b).Decode(&out) - if err != nil { - t.Fatal("decode:", err) - } - if !reflect.DeepEqual(in, out) { - t.Fatalf("got %v; wanted %v", out, in) - } -} - -// getDecEnginePtr cached engine for ut.base instead of ut.user so we passed -// a *map and then tried to reuse its engine to decode the inner map. -func TestPtrToMapOfMap(t *testing.T) { - Register(make(map[string]interface{})) - subdata := make(map[string]interface{}) - subdata["bar"] = "baz" - data := make(map[string]interface{}) - data["foo"] = subdata - - b := new(bytes.Buffer) - err := NewEncoder(b).Encode(data) - if err != nil { - t.Fatal("encode:", err) - } - var newData map[string]interface{} - err = NewDecoder(b).Decode(&newData) - if err != nil { - t.Fatal("decode:", err) - } - if !reflect.DeepEqual(data, newData) { - t.Fatalf("expected %v got %v", data, newData) - } -} - -// A top-level nil pointer generates a panic with a helpful string-valued message. -func TestTopLevelNilPointer(t *testing.T) { - errMsg := topLevelNilPanic(t) - if errMsg == "" { - t.Fatal("top-level nil pointer did not panic") - } - if !strings.Contains(errMsg, "nil pointer") { - t.Fatal("expected nil pointer error, got:", errMsg) - } -} - -func topLevelNilPanic(t *testing.T) (panicErr string) { - defer func() { - e := recover() - if err, ok := e.(string); ok { - panicErr = err - } - }() - var ip *int - buf := new(bytes.Buffer) - if err := NewEncoder(buf).Encode(ip); err != nil { - t.Fatal("error in encode:", err) - } - return -} - -func TestNilPointerInsideInterface(t *testing.T) { - var ip *int - si := struct { - I interface{} - }{ - I: ip, - } - buf := new(bytes.Buffer) - err := NewEncoder(buf).Encode(si) - if err == nil { - t.Fatal("expected error, got none") - } - errMsg := err.Error() - if !strings.Contains(errMsg, "nil pointer") || !strings.Contains(errMsg, "interface") { - t.Fatal("expected error about nil pointer and interface, got:", errMsg) - } -} - -type Bug4Public struct { - Name string - Secret Bug4Secret -} - -type Bug4Secret struct { - a int // error: no exported fields. -} - -// Test that a failed compilation doesn't leave around an executable encoder. -// Issue 3273. -func TestMutipleEncodingsOfBadType(t *testing.T) { - x := Bug4Public{ - Name: "name", - Secret: Bug4Secret{1}, - } - buf := new(bytes.Buffer) - enc := NewEncoder(buf) - err := enc.Encode(x) - if err == nil { - t.Fatal("first encoding: expected error") - } - buf.Reset() - enc = NewEncoder(buf) - err = enc.Encode(x) - if err == nil { - t.Fatal("second encoding: expected error") - } - if !strings.Contains(err.Error(), "no exported fields") { - t.Errorf("expected error about no exported fields; got %v", err) - } -} - -// There was an error check comparing the length of the input with the -// length of the slice being decoded. It was wrong because the next -// thing in the input might be a type definition, which would lead to -// an incorrect length check. This test reproduces the corner case. - -type Z struct { -} - -func Test29ElementSlice(t *testing.T) { - Register(Z{}) - src := make([]interface{}, 100) // Size needs to be bigger than size of type definition. - for i := range src { - src[i] = Z{} - } - buf := new(bytes.Buffer) - err := NewEncoder(buf).Encode(src) - if err != nil { - t.Fatalf("encode: %v", err) - return - } - - var dst []interface{} - err = NewDecoder(buf).Decode(&dst) - if err != nil { - t.Errorf("decode: %v", err) - return - } -} - -// Don't crash, just give error when allocating a huge slice. -// Issue 8084. -func TestErrorForHugeSlice(t *testing.T) { - // Encode an int slice. - buf := new(bytes.Buffer) - slice := []int{1, 1, 1, 1, 1, 1, 1, 1, 1, 1} - err := NewEncoder(buf).Encode(slice) - if err != nil { - t.Fatal("encode:", err) - } - // Reach into the buffer and smash the count to make the encoded slice very long. - buf.Bytes()[buf.Len()-len(slice)-1] = 0xfa - // Decode and see error. - err = NewDecoder(buf).Decode(&slice) - if err == nil { - t.Fatal("decode: no error") - } - if !strings.Contains(err.Error(), "slice too big") { - t.Fatalf("decode: expected slice too big error, got %s", err.Error()) - } -} - -type badDataTest struct { - input string // The input encoded as a hex string. - error string // A substring of the error that should result. - data interface{} // What to decode into. -} - -var badDataTests = []badDataTest{ - {"", "EOF", nil}, - {"7F6869", "unexpected EOF", nil}, - {"036e6f77206973207468652074696d6520666f7220616c6c20676f6f64206d656e", "unknown type id", new(ET2)}, - {"0424666f6f", "field numbers out of bounds", new(ET2)}, // Issue 6323. - {"05100028557b02027f8302", "interface encoding", nil}, // Issue 10270. - // Issue 10273. - {"130a00fb5dad0bf8ff020263e70002fa28020202a89859", "slice length too large", nil}, - {"0f1000fb285d003316020735ff023a65c5", "interface encoding", nil}, - {"03fffb0616fffc00f902ff02ff03bf005d02885802a311a8120228022c028ee7", "GobDecoder", nil}, - // Issue 10491. - {"10fe010f020102fe01100001fe010e000016fe010d030102fe010e00010101015801fe01100000000bfe011000f85555555555555555", "length exceeds input size", nil}, -} - -// TestBadData tests that various problems caused by malformed input -// are caught as errors and do not cause panics. -func TestBadData(t *testing.T) { - for i, test := range badDataTests { - data, err := hex.DecodeString(test.input) - if err != nil { - t.Fatalf("#%d: hex error: %s", i, err) - } - d := NewDecoder(bytes.NewReader(data)) - err = d.Decode(test.data) - if err == nil { - t.Errorf("decode: no error") - continue - } - if !strings.Contains(err.Error(), test.error) { - t.Errorf("#%d: decode: expected %q error, got %s", i, test.error, err.Error()) - } - } -} - -// TestHugeWriteFails tests that enormous messages trigger an error. -func TestHugeWriteFails(t *testing.T) { - if testing.Short() { - // Requires allocating a monster, so don't do this from all.bash. - t.Skip("skipping huge allocation in short mode") - } - huge := make([]byte, tooBig) - huge[0] = 7 // Make sure it's not all zeros. - buf := new(bytes.Buffer) - err := NewEncoder(buf).Encode(huge) - if err == nil { - t.Fatalf("expected error for huge slice") - } - if !strings.Contains(err.Error(), "message too big") { - t.Fatalf("expected 'too big' error; got %s\n", err.Error()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/error.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/error.go deleted file mode 100644 index 92cc0c615e3bd94bd286700ac510705c5b1cac2a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/error.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import "fmt" - -// Errors in decoding and encoding are handled using panic and recover. -// Panics caused by user error (that is, everything except run-time panics -// such as "index out of bounds" errors) do not leave the file that caused -// them, but are instead turned into plain error returns. Encoding and -// decoding functions and methods that do not return an error either use -// panic to report an error or are guaranteed error-free. - -// A gobError is used to distinguish errors (panics) generated in this package. -type gobError struct { - err error -} - -// errorf is like error_ but takes Printf-style arguments to construct an error. -// It always prefixes the message with "gob: ". -func errorf(format string, args ...interface{}) { - error_(fmt.Errorf("gob: "+format, args...)) -} - -// error wraps the argument error and uses it as the argument to panic. -func error_(err error) { - panic(gobError{err}) -} - -// catchError is meant to be used as a deferred function to turn a panic(gobError) into a -// plain error. It overwrites the error return of the function that deferred its call. -func catchError(err *error) { - if e := recover(); e != nil { - ge, ok := e.(gobError) - if !ok { - panic(e) - } - *err = ge.err - } - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/gobencdec_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/gobencdec_test.go deleted file mode 100644 index eb76b481d198365e1552dd3b76ef76fa5bebacc0..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/gobencdec_test.go +++ /dev/null @@ -1,798 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains tests of the GobEncoder/GobDecoder support. - -package gob - -import ( - "bytes" - "errors" - "fmt" - "io" - "net" - "strings" - "testing" - "time" -) - -// Types that implement the GobEncoder/Decoder interfaces. - -type ByteStruct struct { - a byte // not an exported field -} - -type StringStruct struct { - s string // not an exported field -} - -type ArrayStruct struct { - a [8192]byte // not an exported field -} - -type Gobber int - -type ValueGobber string // encodes with a value, decodes with a pointer. - -type BinaryGobber int - -type BinaryValueGobber string - -type TextGobber int - -type TextValueGobber string - -// The relevant methods - -func (g *ByteStruct) GobEncode() ([]byte, error) { - b := make([]byte, 3) - b[0] = g.a - b[1] = g.a + 1 - b[2] = g.a + 2 - return b, nil -} - -func (g *ByteStruct) GobDecode(data []byte) error { - if g == nil { - return errors.New("NIL RECEIVER") - } - // Expect N sequential-valued bytes. - if len(data) == 0 { - return io.EOF - } - g.a = data[0] - for i, c := range data { - if c != g.a+byte(i) { - return errors.New("invalid data sequence") - } - } - return nil -} - -func (g *StringStruct) GobEncode() ([]byte, error) { - return []byte(g.s), nil -} - -func (g *StringStruct) GobDecode(data []byte) error { - // Expect N sequential-valued bytes. - if len(data) == 0 { - return io.EOF - } - a := data[0] - for i, c := range data { - if c != a+byte(i) { - return errors.New("invalid data sequence") - } - } - g.s = string(data) - return nil -} - -func (a *ArrayStruct) GobEncode() ([]byte, error) { - return a.a[:], nil -} - -func (a *ArrayStruct) GobDecode(data []byte) error { - if len(data) != len(a.a) { - return errors.New("wrong length in array decode") - } - copy(a.a[:], data) - return nil -} - -func (g *Gobber) GobEncode() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%d", *g)), nil -} - -func (g *Gobber) GobDecode(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%d", (*int)(g)) - return err -} - -func (g *BinaryGobber) MarshalBinary() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%d", *g)), nil -} - -func (g *BinaryGobber) UnmarshalBinary(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%d", (*int)(g)) - return err -} - -func (g *TextGobber) MarshalText() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%d", *g)), nil -} - -func (g *TextGobber) UnmarshalText(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%d", (*int)(g)) - return err -} - -func (v ValueGobber) GobEncode() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%s", v)), nil -} - -func (v *ValueGobber) GobDecode(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%s", (*string)(v)) - return err -} - -func (v BinaryValueGobber) MarshalBinary() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%s", v)), nil -} - -func (v *BinaryValueGobber) UnmarshalBinary(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%s", (*string)(v)) - return err -} - -func (v TextValueGobber) MarshalText() ([]byte, error) { - return []byte(fmt.Sprintf("VALUE=%s", v)), nil -} - -func (v *TextValueGobber) UnmarshalText(data []byte) error { - _, err := fmt.Sscanf(string(data), "VALUE=%s", (*string)(v)) - return err -} - -// Structs that include GobEncodable fields. - -type GobTest0 struct { - X int // guarantee we have something in common with GobTest* - G *ByteStruct -} - -type GobTest1 struct { - X int // guarantee we have something in common with GobTest* - G *StringStruct -} - -type GobTest2 struct { - X int // guarantee we have something in common with GobTest* - G string // not a GobEncoder - should give us errors -} - -type GobTest3 struct { - X int // guarantee we have something in common with GobTest* - G *Gobber - B *BinaryGobber - T *TextGobber -} - -type GobTest4 struct { - X int // guarantee we have something in common with GobTest* - V ValueGobber - BV BinaryValueGobber - TV TextValueGobber -} - -type GobTest5 struct { - X int // guarantee we have something in common with GobTest* - V *ValueGobber - BV *BinaryValueGobber - TV *TextValueGobber -} - -type GobTest6 struct { - X int // guarantee we have something in common with GobTest* - V ValueGobber - W *ValueGobber - BV BinaryValueGobber - BW *BinaryValueGobber - TV TextValueGobber - TW *TextValueGobber -} - -type GobTest7 struct { - X int // guarantee we have something in common with GobTest* - V *ValueGobber - W ValueGobber - BV *BinaryValueGobber - BW BinaryValueGobber - TV *TextValueGobber - TW TextValueGobber -} - -type GobTestIgnoreEncoder struct { - X int // guarantee we have something in common with GobTest* -} - -type GobTestValueEncDec struct { - X int // guarantee we have something in common with GobTest* - G StringStruct // not a pointer. -} - -type GobTestIndirectEncDec struct { - X int // guarantee we have something in common with GobTest* - G ***StringStruct // indirections to the receiver. -} - -type GobTestArrayEncDec struct { - X int // guarantee we have something in common with GobTest* - A ArrayStruct // not a pointer. -} - -type GobTestIndirectArrayEncDec struct { - X int // guarantee we have something in common with GobTest* - A ***ArrayStruct // indirections to a large receiver. -} - -func TestGobEncoderField(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - err := enc.Encode(GobTest0{17, &ByteStruct{'A'}}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest0) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.G.a != 'A' { - t.Errorf("expected 'A' got %c", x.G.a) - } - // Now a field that's not a structure. - b.Reset() - gobber := Gobber(23) - bgobber := BinaryGobber(24) - tgobber := TextGobber(25) - err = enc.Encode(GobTest3{17, &gobber, &bgobber, &tgobber}) - if err != nil { - t.Fatal("encode error:", err) - } - y := new(GobTest3) - err = dec.Decode(y) - if err != nil { - t.Fatal("decode error:", err) - } - if *y.G != 23 || *y.B != 24 || *y.T != 25 { - t.Errorf("expected '23 got %d", *y.G) - } -} - -// Even though the field is a value, we can still take its address -// and should be able to call the methods. -func TestGobEncoderValueField(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - err := enc.Encode(&GobTestValueEncDec{17, StringStruct{"HIJKL"}}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestValueEncDec) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.G.s != "HIJKL" { - t.Errorf("expected `HIJKL` got %s", x.G.s) - } -} - -// GobEncode/Decode should work even if the value is -// more indirect than the receiver. -func TestGobEncoderIndirectField(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - s := &StringStruct{"HIJKL"} - sp := &s - err := enc.Encode(GobTestIndirectEncDec{17, &sp}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestIndirectEncDec) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if (***x.G).s != "HIJKL" { - t.Errorf("expected `HIJKL` got %s", (***x.G).s) - } -} - -// Test with a large field with methods. -func TestGobEncoderArrayField(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - var a GobTestArrayEncDec - a.X = 17 - for i := range a.A.a { - a.A.a[i] = byte(i) - } - err := enc.Encode(&a) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestArrayEncDec) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - for i, v := range x.A.a { - if v != byte(i) { - t.Errorf("expected %x got %x", byte(i), v) - break - } - } -} - -// Test an indirection to a large field with methods. -func TestGobEncoderIndirectArrayField(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - var a GobTestIndirectArrayEncDec - a.X = 17 - var array ArrayStruct - ap := &array - app := &ap - a.A = &app - for i := range array.a { - array.a[i] = byte(i) - } - err := enc.Encode(a) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestIndirectArrayEncDec) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - for i, v := range (***x.A).a { - if v != byte(i) { - t.Errorf("expected %x got %x", byte(i), v) - break - } - } -} - -// As long as the fields have the same name and implement the -// interface, we can cross-connect them. Not sure it's useful -// and may even be bad but it works and it's hard to prevent -// without exposing the contents of the object, which would -// defeat the purpose. -func TestGobEncoderFieldsOfDifferentType(t *testing.T) { - // first, string in field to byte in field - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(GobTest1{17, &StringStruct{"ABC"}}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest0) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.G.a != 'A' { - t.Errorf("expected 'A' got %c", x.G.a) - } - // now the other direction, byte in field to string in field - b.Reset() - err = enc.Encode(GobTest0{17, &ByteStruct{'X'}}) - if err != nil { - t.Fatal("encode error:", err) - } - y := new(GobTest1) - err = dec.Decode(y) - if err != nil { - t.Fatal("decode error:", err) - } - if y.G.s != "XYZ" { - t.Fatalf("expected `XYZ` got %q", y.G.s) - } -} - -// Test that we can encode a value and decode into a pointer. -func TestGobEncoderValueEncoder(t *testing.T) { - // first, string in field to byte in field - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(GobTest4{17, ValueGobber("hello"), BinaryValueGobber("Καλημέρα"), TextValueGobber("こんにちは")}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest5) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if *x.V != "hello" || *x.BV != "Καλημέρα" || *x.TV != "こんにちは" { - t.Errorf("expected `hello` got %s", *x.V) - } -} - -// Test that we can use a value then a pointer type of a GobEncoder -// in the same encoded value. Bug 4647. -func TestGobEncoderValueThenPointer(t *testing.T) { - v := ValueGobber("forty-two") - w := ValueGobber("six-by-nine") - bv := BinaryValueGobber("1nanocentury") - bw := BinaryValueGobber("πseconds") - tv := TextValueGobber("gravitationalacceleration") - tw := TextValueGobber("π²ft/s²") - - // this was a bug: encoding a GobEncoder by value before a GobEncoder - // pointer would cause duplicate type definitions to be sent. - - b := new(bytes.Buffer) - enc := NewEncoder(b) - if err := enc.Encode(GobTest6{42, v, &w, bv, &bw, tv, &tw}); err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest6) - if err := dec.Decode(x); err != nil { - t.Fatal("decode error:", err) - } - - if got, want := x.V, v; got != want { - t.Errorf("v = %q, want %q", got, want) - } - if got, want := x.W, w; got == nil { - t.Errorf("w = nil, want %q", want) - } else if *got != want { - t.Errorf("w = %q, want %q", *got, want) - } - - if got, want := x.BV, bv; got != want { - t.Errorf("bv = %q, want %q", got, want) - } - if got, want := x.BW, bw; got == nil { - t.Errorf("bw = nil, want %q", want) - } else if *got != want { - t.Errorf("bw = %q, want %q", *got, want) - } - - if got, want := x.TV, tv; got != want { - t.Errorf("tv = %q, want %q", got, want) - } - if got, want := x.TW, tw; got == nil { - t.Errorf("tw = nil, want %q", want) - } else if *got != want { - t.Errorf("tw = %q, want %q", *got, want) - } -} - -// Test that we can use a pointer then a value type of a GobEncoder -// in the same encoded value. -func TestGobEncoderPointerThenValue(t *testing.T) { - v := ValueGobber("forty-two") - w := ValueGobber("six-by-nine") - bv := BinaryValueGobber("1nanocentury") - bw := BinaryValueGobber("πseconds") - tv := TextValueGobber("gravitationalacceleration") - tw := TextValueGobber("π²ft/s²") - - b := new(bytes.Buffer) - enc := NewEncoder(b) - if err := enc.Encode(GobTest7{42, &v, w, &bv, bw, &tv, tw}); err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest7) - if err := dec.Decode(x); err != nil { - t.Fatal("decode error:", err) - } - - if got, want := x.V, v; got == nil { - t.Errorf("v = nil, want %q", want) - } else if *got != want { - t.Errorf("v = %q, want %q", *got, want) - } - if got, want := x.W, w; got != want { - t.Errorf("w = %q, want %q", got, want) - } - - if got, want := x.BV, bv; got == nil { - t.Errorf("bv = nil, want %q", want) - } else if *got != want { - t.Errorf("bv = %q, want %q", *got, want) - } - if got, want := x.BW, bw; got != want { - t.Errorf("bw = %q, want %q", got, want) - } - - if got, want := x.TV, tv; got == nil { - t.Errorf("tv = nil, want %q", want) - } else if *got != want { - t.Errorf("tv = %q, want %q", *got, want) - } - if got, want := x.TW, tw; got != want { - t.Errorf("tw = %q, want %q", got, want) - } -} - -func TestGobEncoderFieldTypeError(t *testing.T) { - // GobEncoder to non-decoder: error - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(GobTest1{17, &StringStruct{"ABC"}}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := &GobTest2{} - err = dec.Decode(x) - if err == nil { - t.Fatal("expected decode error for mismatched fields (encoder to non-decoder)") - } - if strings.Index(err.Error(), "type") < 0 { - t.Fatal("expected type error; got", err) - } - // Non-encoder to GobDecoder: error - b.Reset() - err = enc.Encode(GobTest2{17, "ABC"}) - if err != nil { - t.Fatal("encode error:", err) - } - y := &GobTest1{} - err = dec.Decode(y) - if err == nil { - t.Fatal("expected decode error for mismatched fields (non-encoder to decoder)") - } - if strings.Index(err.Error(), "type") < 0 { - t.Fatal("expected type error; got", err) - } -} - -// Even though ByteStruct is a struct, it's treated as a singleton at the top level. -func TestGobEncoderStructSingleton(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(&ByteStruct{'A'}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(ByteStruct) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.a != 'A' { - t.Errorf("expected 'A' got %c", x.a) - } -} - -func TestGobEncoderNonStructSingleton(t *testing.T) { - b := new(bytes.Buffer) - enc := NewEncoder(b) - var g Gobber = 1234 - err := enc.Encode(&g) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - var x Gobber - err = dec.Decode(&x) - if err != nil { - t.Fatal("decode error:", err) - } - if x != 1234 { - t.Errorf("expected 1234 got %d", x) - } -} - -func TestGobEncoderIgnoreStructField(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - err := enc.Encode(GobTest0{17, &ByteStruct{'A'}}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestIgnoreEncoder) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.X != 17 { - t.Errorf("expected 17 got %c", x.X) - } -} - -func TestGobEncoderIgnoreNonStructField(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - gobber := Gobber(23) - bgobber := BinaryGobber(24) - tgobber := TextGobber(25) - err := enc.Encode(GobTest3{17, &gobber, &bgobber, &tgobber}) - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTestIgnoreEncoder) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.X != 17 { - t.Errorf("expected 17 got %c", x.X) - } -} - -func TestGobEncoderIgnoreNilEncoder(t *testing.T) { - b := new(bytes.Buffer) - // First a field that's a structure. - enc := NewEncoder(b) - err := enc.Encode(GobTest0{X: 18}) // G is nil - if err != nil { - t.Fatal("encode error:", err) - } - dec := NewDecoder(b) - x := new(GobTest0) - err = dec.Decode(x) - if err != nil { - t.Fatal("decode error:", err) - } - if x.X != 18 { - t.Errorf("expected x.X = 18, got %v", x.X) - } - if x.G != nil { - t.Errorf("expected x.G = nil, got %v", x.G) - } -} - -type gobDecoderBug0 struct { - foo, bar string -} - -func (br *gobDecoderBug0) String() string { - return br.foo + "-" + br.bar -} - -func (br *gobDecoderBug0) GobEncode() ([]byte, error) { - return []byte(br.String()), nil -} - -func (br *gobDecoderBug0) GobDecode(b []byte) error { - br.foo = "foo" - br.bar = "bar" - return nil -} - -// This was a bug: the receiver has a different indirection level -// than the variable. -func TestGobEncoderExtraIndirect(t *testing.T) { - gdb := &gobDecoderBug0{"foo", "bar"} - buf := new(bytes.Buffer) - e := NewEncoder(buf) - if err := e.Encode(gdb); err != nil { - t.Fatalf("encode: %v", err) - } - d := NewDecoder(buf) - var got *gobDecoderBug0 - if err := d.Decode(&got); err != nil { - t.Fatalf("decode: %v", err) - } - if got.foo != gdb.foo || got.bar != gdb.bar { - t.Errorf("got = %q, want %q", got, gdb) - } -} - -// Another bug: this caused a crash with the new Go1 Time type. -// We throw in a gob-encoding array, to test another case of isZero, -// and a struct containing an nil interface, to test a third. -type isZeroBug struct { - T time.Time - S string - I int - A isZeroBugArray - F isZeroBugInterface -} - -type isZeroBugArray [2]uint8 - -// Receiver is value, not pointer, to test isZero of array. -func (a isZeroBugArray) GobEncode() (b []byte, e error) { - b = append(b, a[:]...) - return b, nil -} - -func (a *isZeroBugArray) GobDecode(data []byte) error { - if len(data) != len(a) { - return io.EOF - } - a[0] = data[0] - a[1] = data[1] - return nil -} - -type isZeroBugInterface struct { - I interface{} -} - -func (i isZeroBugInterface) GobEncode() (b []byte, e error) { - return []byte{}, nil -} - -func (i *isZeroBugInterface) GobDecode(data []byte) error { - return nil -} - -func TestGobEncodeIsZero(t *testing.T) { - x := isZeroBug{time.Now(), "hello", -55, isZeroBugArray{1, 2}, isZeroBugInterface{}} - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(x) - if err != nil { - t.Fatal("encode:", err) - } - var y isZeroBug - dec := NewDecoder(b) - err = dec.Decode(&y) - if err != nil { - t.Fatal("decode:", err) - } - if x != y { - t.Fatalf("%v != %v", x, y) - } -} - -func TestGobEncodePtrError(t *testing.T) { - var err error - b := new(bytes.Buffer) - enc := NewEncoder(b) - err = enc.Encode(&err) - if err != nil { - t.Fatal("encode:", err) - } - dec := NewDecoder(b) - err2 := fmt.Errorf("foo") - err = dec.Decode(&err2) - if err != nil { - t.Fatal("decode:", err) - } - if err2 != nil { - t.Fatalf("expected nil, got %v", err2) - } -} - -func TestNetIP(t *testing.T) { - // Encoding of net.IP{1,2,3,4} in Go 1.1. - enc := []byte{0x07, 0x0a, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04} - - var ip net.IP - err := NewDecoder(bytes.NewReader(enc)).Decode(&ip) - if err != nil { - t.Fatalf("decode: %v", err) - } - if ip.String() != "1.2.3.4" { - t.Errorf("decoded to %v, want 1.2.3.4", ip.String()) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/timing_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/timing_test.go deleted file mode 100644 index 940e5ad4126a7f025de32624d62eede74759548b..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/timing_test.go +++ /dev/null @@ -1,325 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "bytes" - "io" - "os" - "runtime" - "testing" -) - -type Bench struct { - A int - B float64 - C string - D []byte -} - -func benchmarkEndToEnd(b *testing.B, ctor func() interface{}, pipe func() (r io.Reader, w io.Writer, err error)) { - b.RunParallel(func(pb *testing.PB) { - r, w, err := pipe() - if err != nil { - b.Fatal("can't get pipe:", err) - } - v := ctor() - enc := NewEncoder(w) - dec := NewDecoder(r) - for pb.Next() { - if err := enc.Encode(v); err != nil { - b.Fatal("encode error:", err) - } - if err := dec.Decode(v); err != nil { - b.Fatal("decode error:", err) - } - } - }) -} - -func BenchmarkEndToEndPipe(b *testing.B) { - benchmarkEndToEnd(b, func() interface{} { - return &Bench{7, 3.2, "now is the time", bytes.Repeat([]byte("for all good men"), 100)} - }, func() (r io.Reader, w io.Writer, err error) { - r, w, err = os.Pipe() - return - }) -} - -func BenchmarkEndToEndByteBuffer(b *testing.B) { - benchmarkEndToEnd(b, func() interface{} { - return &Bench{7, 3.2, "now is the time", bytes.Repeat([]byte("for all good men"), 100)} - }, func() (r io.Reader, w io.Writer, err error) { - var buf bytes.Buffer - return &buf, &buf, nil - }) -} - -func BenchmarkEndToEndSliceByteBuffer(b *testing.B) { - benchmarkEndToEnd(b, func() interface{} { - v := &Bench{7, 3.2, "now is the time", nil} - Register(v) - arr := make([]interface{}, 100) - for i := range arr { - arr[i] = v - } - return &arr - }, func() (r io.Reader, w io.Writer, err error) { - var buf bytes.Buffer - return &buf, &buf, nil - }) -} - -func TestCountEncodeMallocs(t *testing.T) { - if testing.Short() { - t.Skip("skipping malloc count in short mode") - } - if runtime.GOMAXPROCS(0) > 1 { - t.Skip("skipping; GOMAXPROCS>1") - } - - const N = 1000 - - var buf bytes.Buffer - enc := NewEncoder(&buf) - bench := &Bench{7, 3.2, "now is the time", []byte("for all good men")} - - allocs := testing.AllocsPerRun(N, func() { - err := enc.Encode(bench) - if err != nil { - t.Fatal("encode:", err) - } - }) - if allocs != 0 { - t.Fatalf("mallocs per encode of type Bench: %v; wanted 0\n", allocs) - } -} - -func TestCountDecodeMallocs(t *testing.T) { - if testing.Short() { - t.Skip("skipping malloc count in short mode") - } - if runtime.GOMAXPROCS(0) > 1 { - t.Skip("skipping; GOMAXPROCS>1") - } - - const N = 1000 - - var buf bytes.Buffer - enc := NewEncoder(&buf) - bench := &Bench{7, 3.2, "now is the time", []byte("for all good men")} - - // Fill the buffer with enough to decode - testing.AllocsPerRun(N, func() { - err := enc.Encode(bench) - if err != nil { - t.Fatal("encode:", err) - } - }) - - dec := NewDecoder(&buf) - allocs := testing.AllocsPerRun(N, func() { - *bench = Bench{} - err := dec.Decode(&bench) - if err != nil { - t.Fatal("decode:", err) - } - }) - if allocs != 4 { - t.Fatalf("mallocs per decode of type Bench: %v; wanted 4\n", allocs) - } -} - -func BenchmarkEncodeComplex128Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]complex128, 1000) - for i := range a { - a[i] = 1.2 + 3.4i - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - } -} - -func BenchmarkEncodeFloat64Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]float64, 1000) - for i := range a { - a[i] = 1.23e4 - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - } -} - -func BenchmarkEncodeInt32Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]int32, 1000) - for i := range a { - a[i] = 1234 - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - } -} - -func BenchmarkEncodeStringSlice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]string, 1000) - for i := range a { - a[i] = "now is the time" - } - b.ResetTimer() - for i := 0; i < b.N; i++ { - buf.Reset() - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - } -} - -// benchmarkBuf is a read buffer we can reset -type benchmarkBuf struct { - offset int - data []byte -} - -func (b *benchmarkBuf) Read(p []byte) (n int, err error) { - n = copy(p, b.data[b.offset:]) - if n == 0 { - return 0, io.EOF - } - b.offset += n - return -} - -func (b *benchmarkBuf) ReadByte() (c byte, err error) { - if b.offset >= len(b.data) { - return 0, io.EOF - } - c = b.data[b.offset] - b.offset++ - return -} - -func (b *benchmarkBuf) reset() { - b.offset = 0 -} - -func BenchmarkDecodeComplex128Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]complex128, 1000) - for i := range a { - a[i] = 1.2 + 3.4i - } - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - x := make([]complex128, 1000) - bbuf := benchmarkBuf{data: buf.Bytes()} - b.ResetTimer() - for i := 0; i < b.N; i++ { - bbuf.reset() - dec := NewDecoder(&bbuf) - err := dec.Decode(&x) - if err != nil { - b.Fatal(i, err) - } - } -} - -func BenchmarkDecodeFloat64Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]float64, 1000) - for i := range a { - a[i] = 1.23e4 - } - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - x := make([]float64, 1000) - bbuf := benchmarkBuf{data: buf.Bytes()} - b.ResetTimer() - for i := 0; i < b.N; i++ { - bbuf.reset() - dec := NewDecoder(&bbuf) - err := dec.Decode(&x) - if err != nil { - b.Fatal(i, err) - } - } -} - -func BenchmarkDecodeInt32Slice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]int32, 1000) - for i := range a { - a[i] = 1234 - } - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - x := make([]int32, 1000) - bbuf := benchmarkBuf{data: buf.Bytes()} - b.ResetTimer() - for i := 0; i < b.N; i++ { - bbuf.reset() - dec := NewDecoder(&bbuf) - err := dec.Decode(&x) - if err != nil { - b.Fatal(i, err) - } - } -} - -func BenchmarkDecodeStringSlice(b *testing.B) { - var buf bytes.Buffer - enc := NewEncoder(&buf) - a := make([]string, 1000) - for i := range a { - a[i] = "now is the time" - } - err := enc.Encode(a) - if err != nil { - b.Fatal(err) - } - x := make([]string, 1000) - bbuf := benchmarkBuf{data: buf.Bytes()} - b.ResetTimer() - for i := 0; i < b.N; i++ { - bbuf.reset() - dec := NewDecoder(&bbuf) - err := dec.Decode(&x) - if err != nil { - b.Fatal(i, err) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/type.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/type.go deleted file mode 100644 index a49b71a8676786c67aa38dbae07c8ddbdbd86ec6..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/type.go +++ /dev/null @@ -1,923 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "encoding" - "errors" - "fmt" - "os" - "reflect" - "sync" - "sync/atomic" - "unicode" - "unicode/utf8" -) - -// userTypeInfo stores the information associated with a type the user has handed -// to the package. It's computed once and stored in a map keyed by reflection -// type. -type userTypeInfo struct { - user reflect.Type // the type the user handed us - base reflect.Type // the base type after all indirections - indir int // number of indirections to reach the base type - externalEnc int // xGob, xBinary, or xText - externalDec int // xGob, xBinary or xText - encIndir int8 // number of indirections to reach the receiver type; may be negative - decIndir int8 // number of indirections to reach the receiver type; may be negative -} - -// externalEncoding bits -const ( - xGob = 1 + iota // GobEncoder or GobDecoder - xBinary // encoding.BinaryMarshaler or encoding.BinaryUnmarshaler - xText // encoding.TextMarshaler or encoding.TextUnmarshaler -) - -var ( - // Protected by an RWMutex because we read it a lot and write - // it only when we see a new type, typically when compiling. - userTypeLock sync.RWMutex - userTypeCache = make(map[reflect.Type]*userTypeInfo) -) - -// validType returns, and saves, the information associated with user-provided type rt. -// If the user type is not valid, err will be non-nil. To be used when the error handler -// is not set up. -func validUserType(rt reflect.Type) (ut *userTypeInfo, err error) { - userTypeLock.RLock() - ut = userTypeCache[rt] - userTypeLock.RUnlock() - if ut != nil { - return - } - // Now set the value under the write lock. - userTypeLock.Lock() - defer userTypeLock.Unlock() - if ut = userTypeCache[rt]; ut != nil { - // Lost the race; not a problem. - return - } - ut = new(userTypeInfo) - ut.base = rt - ut.user = rt - // A type that is just a cycle of pointers (such as type T *T) cannot - // be represented in gobs, which need some concrete data. We use a - // cycle detection algorithm from Knuth, Vol 2, Section 3.1, Ex 6, - // pp 539-540. As we step through indirections, run another type at - // half speed. If they meet up, there's a cycle. - slowpoke := ut.base // walks half as fast as ut.base - for { - pt := ut.base - if pt.Kind() != reflect.Ptr { - break - } - ut.base = pt.Elem() - if ut.base == slowpoke { // ut.base lapped slowpoke - // recursive pointer type. - return nil, errors.New("can't represent recursive pointer type " + ut.base.String()) - } - if ut.indir%2 == 0 { - slowpoke = slowpoke.Elem() - } - ut.indir++ - } - - if ok, indir := implementsInterface(ut.user, gobEncoderInterfaceType); ok { - ut.externalEnc, ut.encIndir = xGob, indir - } else if ok, indir := implementsInterface(ut.user, binaryMarshalerInterfaceType); ok { - ut.externalEnc, ut.encIndir = xBinary, indir - } - - // NOTE(rsc): Would like to allow MarshalText here, but results in incompatibility - // with older encodings for net.IP. See golang.org/issue/6760. - // } else if ok, indir := implementsInterface(ut.user, textMarshalerInterfaceType); ok { - // ut.externalEnc, ut.encIndir = xText, indir - // } - - if ok, indir := implementsInterface(ut.user, gobDecoderInterfaceType); ok { - ut.externalDec, ut.decIndir = xGob, indir - } else if ok, indir := implementsInterface(ut.user, binaryUnmarshalerInterfaceType); ok { - ut.externalDec, ut.decIndir = xBinary, indir - } - - // See note above. - // } else if ok, indir := implementsInterface(ut.user, textUnmarshalerInterfaceType); ok { - // ut.externalDec, ut.decIndir = xText, indir - // } - - userTypeCache[rt] = ut - return -} - -var ( - gobEncoderInterfaceType = reflect.TypeOf((*GobEncoder)(nil)).Elem() - gobDecoderInterfaceType = reflect.TypeOf((*GobDecoder)(nil)).Elem() - binaryMarshalerInterfaceType = reflect.TypeOf((*encoding.BinaryMarshaler)(nil)).Elem() - binaryUnmarshalerInterfaceType = reflect.TypeOf((*encoding.BinaryUnmarshaler)(nil)).Elem() - textMarshalerInterfaceType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - textUnmarshalerInterfaceType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() -) - -// implementsInterface reports whether the type implements the -// gobEncoder/gobDecoder interface. -// It also returns the number of indirections required to get to the -// implementation. -func implementsInterface(typ, gobEncDecType reflect.Type) (success bool, indir int8) { - if typ == nil { - return - } - rt := typ - // The type might be a pointer and we need to keep - // dereferencing to the base type until we find an implementation. - for { - if rt.Implements(gobEncDecType) { - return true, indir - } - if p := rt; p.Kind() == reflect.Ptr { - indir++ - if indir > 100 { // insane number of indirections - return false, 0 - } - rt = p.Elem() - continue - } - break - } - // No luck yet, but if this is a base type (non-pointer), the pointer might satisfy. - if typ.Kind() != reflect.Ptr { - // Not a pointer, but does the pointer work? - if reflect.PtrTo(typ).Implements(gobEncDecType) { - return true, -1 - } - } - return false, 0 -} - -// userType returns, and saves, the information associated with user-provided type rt. -// If the user type is not valid, it calls error. -func userType(rt reflect.Type) *userTypeInfo { - ut, err := validUserType(rt) - if err != nil { - error_(err) - } - return ut -} - -// A typeId represents a gob Type as an integer that can be passed on the wire. -// Internally, typeIds are used as keys to a map to recover the underlying type info. -type typeId int32 - -var nextId typeId // incremented for each new type we build -var typeLock sync.Mutex // set while building a type -const firstUserId = 64 // lowest id number granted to user - -type gobType interface { - id() typeId - setId(id typeId) - name() string - string() string // not public; only for debugging - safeString(seen map[typeId]bool) string -} - -var types = make(map[reflect.Type]gobType) -var idToType = make(map[typeId]gobType) -var builtinIdToType map[typeId]gobType // set in init() after builtins are established - -func setTypeId(typ gobType) { - // When building recursive types, someone may get there before us. - if typ.id() != 0 { - return - } - nextId++ - typ.setId(nextId) - idToType[nextId] = typ -} - -func (t typeId) gobType() gobType { - if t == 0 { - return nil - } - return idToType[t] -} - -// string returns the string representation of the type associated with the typeId. -func (t typeId) string() string { - if t.gobType() == nil { - return "" - } - return t.gobType().string() -} - -// Name returns the name of the type associated with the typeId. -func (t typeId) name() string { - if t.gobType() == nil { - return "" - } - return t.gobType().name() -} - -// CommonType holds elements of all types. -// It is a historical artifact, kept for binary compatibility and exported -// only for the benefit of the package's encoding of type descriptors. It is -// not intended for direct use by clients. -type CommonType struct { - Name string - Id typeId -} - -func (t *CommonType) id() typeId { return t.Id } - -func (t *CommonType) setId(id typeId) { t.Id = id } - -func (t *CommonType) string() string { return t.Name } - -func (t *CommonType) safeString(seen map[typeId]bool) string { - return t.Name -} - -func (t *CommonType) name() string { return t.Name } - -// Create and check predefined types -// The string for tBytes is "bytes" not "[]byte" to signify its specialness. - -var ( - // Primordial types, needed during initialization. - // Always passed as pointers so the interface{} type - // goes through without losing its interfaceness. - tBool = bootstrapType("bool", (*bool)(nil), 1) - tInt = bootstrapType("int", (*int)(nil), 2) - tUint = bootstrapType("uint", (*uint)(nil), 3) - tFloat = bootstrapType("float", (*float64)(nil), 4) - tBytes = bootstrapType("bytes", (*[]byte)(nil), 5) - tString = bootstrapType("string", (*string)(nil), 6) - tComplex = bootstrapType("complex", (*complex128)(nil), 7) - tInterface = bootstrapType("interface", (*interface{})(nil), 8) - // Reserve some Ids for compatible expansion - tReserved7 = bootstrapType("_reserved1", (*struct{ r7 int })(nil), 9) - tReserved6 = bootstrapType("_reserved1", (*struct{ r6 int })(nil), 10) - tReserved5 = bootstrapType("_reserved1", (*struct{ r5 int })(nil), 11) - tReserved4 = bootstrapType("_reserved1", (*struct{ r4 int })(nil), 12) - tReserved3 = bootstrapType("_reserved1", (*struct{ r3 int })(nil), 13) - tReserved2 = bootstrapType("_reserved1", (*struct{ r2 int })(nil), 14) - tReserved1 = bootstrapType("_reserved1", (*struct{ r1 int })(nil), 15) -) - -// Predefined because it's needed by the Decoder -var tWireType = mustGetTypeInfo(reflect.TypeOf(wireType{})).id -var wireTypeUserInfo *userTypeInfo // userTypeInfo of (*wireType) - -func init() { - // Some magic numbers to make sure there are no surprises. - checkId(16, tWireType) - checkId(17, mustGetTypeInfo(reflect.TypeOf(arrayType{})).id) - checkId(18, mustGetTypeInfo(reflect.TypeOf(CommonType{})).id) - checkId(19, mustGetTypeInfo(reflect.TypeOf(sliceType{})).id) - checkId(20, mustGetTypeInfo(reflect.TypeOf(structType{})).id) - checkId(21, mustGetTypeInfo(reflect.TypeOf(fieldType{})).id) - checkId(23, mustGetTypeInfo(reflect.TypeOf(mapType{})).id) - - builtinIdToType = make(map[typeId]gobType) - for k, v := range idToType { - builtinIdToType[k] = v - } - - // Move the id space upwards to allow for growth in the predefined world - // without breaking existing files. - if nextId > firstUserId { - panic(fmt.Sprintln("nextId too large:", nextId)) - } - nextId = firstUserId - registerBasics() - wireTypeUserInfo = userType(reflect.TypeOf((*wireType)(nil))) -} - -// Array type -type arrayType struct { - CommonType - Elem typeId - Len int -} - -func newArrayType(name string) *arrayType { - a := &arrayType{CommonType{Name: name}, 0, 0} - return a -} - -func (a *arrayType) init(elem gobType, len int) { - // Set our type id before evaluating the element's, in case it's our own. - setTypeId(a) - a.Elem = elem.id() - a.Len = len -} - -func (a *arrayType) safeString(seen map[typeId]bool) string { - if seen[a.Id] { - return a.Name - } - seen[a.Id] = true - return fmt.Sprintf("[%d]%s", a.Len, a.Elem.gobType().safeString(seen)) -} - -func (a *arrayType) string() string { return a.safeString(make(map[typeId]bool)) } - -// GobEncoder type (something that implements the GobEncoder interface) -type gobEncoderType struct { - CommonType -} - -func newGobEncoderType(name string) *gobEncoderType { - g := &gobEncoderType{CommonType{Name: name}} - setTypeId(g) - return g -} - -func (g *gobEncoderType) safeString(seen map[typeId]bool) string { - return g.Name -} - -func (g *gobEncoderType) string() string { return g.Name } - -// Map type -type mapType struct { - CommonType - Key typeId - Elem typeId -} - -func newMapType(name string) *mapType { - m := &mapType{CommonType{Name: name}, 0, 0} - return m -} - -func (m *mapType) init(key, elem gobType) { - // Set our type id before evaluating the element's, in case it's our own. - setTypeId(m) - m.Key = key.id() - m.Elem = elem.id() -} - -func (m *mapType) safeString(seen map[typeId]bool) string { - if seen[m.Id] { - return m.Name - } - seen[m.Id] = true - key := m.Key.gobType().safeString(seen) - elem := m.Elem.gobType().safeString(seen) - return fmt.Sprintf("map[%s]%s", key, elem) -} - -func (m *mapType) string() string { return m.safeString(make(map[typeId]bool)) } - -// Slice type -type sliceType struct { - CommonType - Elem typeId -} - -func newSliceType(name string) *sliceType { - s := &sliceType{CommonType{Name: name}, 0} - return s -} - -func (s *sliceType) init(elem gobType) { - // Set our type id before evaluating the element's, in case it's our own. - setTypeId(s) - // See the comments about ids in newTypeObject. Only slices and - // structs have mutual recursion. - if elem.id() == 0 { - setTypeId(elem) - } - s.Elem = elem.id() -} - -func (s *sliceType) safeString(seen map[typeId]bool) string { - if seen[s.Id] { - return s.Name - } - seen[s.Id] = true - return fmt.Sprintf("[]%s", s.Elem.gobType().safeString(seen)) -} - -func (s *sliceType) string() string { return s.safeString(make(map[typeId]bool)) } - -// Struct type -type fieldType struct { - Name string - Id typeId -} - -type structType struct { - CommonType - Field []*fieldType -} - -func (s *structType) safeString(seen map[typeId]bool) string { - if s == nil { - return "" - } - if _, ok := seen[s.Id]; ok { - return s.Name - } - seen[s.Id] = true - str := s.Name + " = struct { " - for _, f := range s.Field { - str += fmt.Sprintf("%s %s; ", f.Name, f.Id.gobType().safeString(seen)) - } - str += "}" - return str -} - -func (s *structType) string() string { return s.safeString(make(map[typeId]bool)) } - -func newStructType(name string) *structType { - s := &structType{CommonType{Name: name}, nil} - // For historical reasons we set the id here rather than init. - // See the comment in newTypeObject for details. - setTypeId(s) - return s -} - -// newTypeObject allocates a gobType for the reflection type rt. -// Unless ut represents a GobEncoder, rt should be the base type -// of ut. -// This is only called from the encoding side. The decoding side -// works through typeIds and userTypeInfos alone. -func newTypeObject(name string, ut *userTypeInfo, rt reflect.Type) (gobType, error) { - // Does this type implement GobEncoder? - if ut.externalEnc != 0 { - return newGobEncoderType(name), nil - } - var err error - var type0, type1 gobType - defer func() { - if err != nil { - delete(types, rt) - } - }() - // Install the top-level type before the subtypes (e.g. struct before - // fields) so recursive types can be constructed safely. - switch t := rt; t.Kind() { - // All basic types are easy: they are predefined. - case reflect.Bool: - return tBool.gobType(), nil - - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return tInt.gobType(), nil - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return tUint.gobType(), nil - - case reflect.Float32, reflect.Float64: - return tFloat.gobType(), nil - - case reflect.Complex64, reflect.Complex128: - return tComplex.gobType(), nil - - case reflect.String: - return tString.gobType(), nil - - case reflect.Interface: - return tInterface.gobType(), nil - - case reflect.Array: - at := newArrayType(name) - types[rt] = at - type0, err = getBaseType("", t.Elem()) - if err != nil { - return nil, err - } - // Historical aside: - // For arrays, maps, and slices, we set the type id after the elements - // are constructed. This is to retain the order of type id allocation after - // a fix made to handle recursive types, which changed the order in - // which types are built. Delaying the setting in this way preserves - // type ids while allowing recursive types to be described. Structs, - // done below, were already handling recursion correctly so they - // assign the top-level id before those of the field. - at.init(type0, t.Len()) - return at, nil - - case reflect.Map: - mt := newMapType(name) - types[rt] = mt - type0, err = getBaseType("", t.Key()) - if err != nil { - return nil, err - } - type1, err = getBaseType("", t.Elem()) - if err != nil { - return nil, err - } - mt.init(type0, type1) - return mt, nil - - case reflect.Slice: - // []byte == []uint8 is a special case - if t.Elem().Kind() == reflect.Uint8 { - return tBytes.gobType(), nil - } - st := newSliceType(name) - types[rt] = st - type0, err = getBaseType(t.Elem().Name(), t.Elem()) - if err != nil { - return nil, err - } - st.init(type0) - return st, nil - - case reflect.Struct: - st := newStructType(name) - types[rt] = st - idToType[st.id()] = st - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if !isSent(&f) { - continue - } - typ := userType(f.Type).base - tname := typ.Name() - if tname == "" { - t := userType(f.Type).base - tname = t.String() - } - gt, err := getBaseType(tname, f.Type) - if err != nil { - return nil, err - } - // Some mutually recursive types can cause us to be here while - // still defining the element. Fix the element type id here. - // We could do this more neatly by setting the id at the start of - // building every type, but that would break binary compatibility. - if gt.id() == 0 { - setTypeId(gt) - } - st.Field = append(st.Field, &fieldType{f.Name, gt.id()}) - } - return st, nil - - default: - return nil, errors.New("gob NewTypeObject can't handle type: " + rt.String()) - } -} - -// isExported reports whether this is an exported - upper case - name. -func isExported(name string) bool { - rune, _ := utf8.DecodeRuneInString(name) - return unicode.IsUpper(rune) -} - -// isSent reports whether this struct field is to be transmitted. -// It will be transmitted only if it is exported and not a chan or func field -// or pointer to chan or func. -func isSent(field *reflect.StructField) bool { - if !isExported(field.Name) { - return false - } - // If the field is a chan or func or pointer thereto, don't send it. - // That is, treat it like an unexported field. - typ := field.Type - for typ.Kind() == reflect.Ptr { - typ = typ.Elem() - } - if typ.Kind() == reflect.Chan || typ.Kind() == reflect.Func { - return false - } - return true -} - -// getBaseType returns the Gob type describing the given reflect.Type's base type. -// typeLock must be held. -func getBaseType(name string, rt reflect.Type) (gobType, error) { - ut := userType(rt) - return getType(name, ut, ut.base) -} - -// getType returns the Gob type describing the given reflect.Type. -// Should be called only when handling GobEncoders/Decoders, -// which may be pointers. All other types are handled through the -// base type, never a pointer. -// typeLock must be held. -func getType(name string, ut *userTypeInfo, rt reflect.Type) (gobType, error) { - typ, present := types[rt] - if present { - return typ, nil - } - typ, err := newTypeObject(name, ut, rt) - if err == nil { - types[rt] = typ - } - return typ, err -} - -func checkId(want, got typeId) { - if want != got { - fmt.Fprintf(os.Stderr, "checkId: %d should be %d\n", int(got), int(want)) - panic("bootstrap type wrong id: " + got.name() + " " + got.string() + " not " + want.string()) - } -} - -// used for building the basic types; called only from init(). the incoming -// interface always refers to a pointer. -func bootstrapType(name string, e interface{}, expect typeId) typeId { - rt := reflect.TypeOf(e).Elem() - _, present := types[rt] - if present { - panic("bootstrap type already present: " + name + ", " + rt.String()) - } - typ := &CommonType{Name: name} - types[rt] = typ - setTypeId(typ) - checkId(expect, nextId) - userType(rt) // might as well cache it now - return nextId -} - -// Representation of the information we send and receive about this type. -// Each value we send is preceded by its type definition: an encoded int. -// However, the very first time we send the value, we first send the pair -// (-id, wireType). -// For bootstrapping purposes, we assume that the recipient knows how -// to decode a wireType; it is exactly the wireType struct here, interpreted -// using the gob rules for sending a structure, except that we assume the -// ids for wireType and structType etc. are known. The relevant pieces -// are built in encode.go's init() function. -// To maintain binary compatibility, if you extend this type, always put -// the new fields last. -type wireType struct { - ArrayT *arrayType - SliceT *sliceType - StructT *structType - MapT *mapType - GobEncoderT *gobEncoderType - BinaryMarshalerT *gobEncoderType - TextMarshalerT *gobEncoderType -} - -func (w *wireType) string() string { - const unknown = "unknown type" - if w == nil { - return unknown - } - switch { - case w.ArrayT != nil: - return w.ArrayT.Name - case w.SliceT != nil: - return w.SliceT.Name - case w.StructT != nil: - return w.StructT.Name - case w.MapT != nil: - return w.MapT.Name - case w.GobEncoderT != nil: - return w.GobEncoderT.Name - case w.BinaryMarshalerT != nil: - return w.BinaryMarshalerT.Name - case w.TextMarshalerT != nil: - return w.TextMarshalerT.Name - } - return unknown -} - -type typeInfo struct { - id typeId - encInit sync.Mutex // protects creation of encoder - encoder atomic.Value // *encEngine - wire *wireType -} - -// typeInfoMap is an atomic pointer to map[reflect.Type]*typeInfo. -// It's updated copy-on-write. Readers just do an atomic load -// to get the current version of the map. Writers make a full copy of -// the map and atomically update the pointer to point to the new map. -// Under heavy read contention, this is significantly faster than a map -// protected by a mutex. -var typeInfoMap atomic.Value - -func lookupTypeInfo(rt reflect.Type) *typeInfo { - m, _ := typeInfoMap.Load().(map[reflect.Type]*typeInfo) - return m[rt] -} - -func getTypeInfo(ut *userTypeInfo) (*typeInfo, error) { - rt := ut.base - if ut.externalEnc != 0 { - // We want the user type, not the base type. - rt = ut.user - } - if info := lookupTypeInfo(rt); info != nil { - return info, nil - } - return buildTypeInfo(ut, rt) -} - -// buildTypeInfo constructs the type information for the type -// and stores it in the type info map. -func buildTypeInfo(ut *userTypeInfo, rt reflect.Type) (*typeInfo, error) { - typeLock.Lock() - defer typeLock.Unlock() - - if info := lookupTypeInfo(rt); info != nil { - return info, nil - } - - gt, err := getBaseType(rt.Name(), rt) - if err != nil { - return nil, err - } - info := &typeInfo{id: gt.id()} - - if ut.externalEnc != 0 { - userType, err := getType(rt.Name(), ut, rt) - if err != nil { - return nil, err - } - gt := userType.id().gobType().(*gobEncoderType) - switch ut.externalEnc { - case xGob: - info.wire = &wireType{GobEncoderT: gt} - case xBinary: - info.wire = &wireType{BinaryMarshalerT: gt} - case xText: - info.wire = &wireType{TextMarshalerT: gt} - } - rt = ut.user - } else { - t := info.id.gobType() - switch typ := rt; typ.Kind() { - case reflect.Array: - info.wire = &wireType{ArrayT: t.(*arrayType)} - case reflect.Map: - info.wire = &wireType{MapT: t.(*mapType)} - case reflect.Slice: - // []byte == []uint8 is a special case handled separately - if typ.Elem().Kind() != reflect.Uint8 { - info.wire = &wireType{SliceT: t.(*sliceType)} - } - case reflect.Struct: - info.wire = &wireType{StructT: t.(*structType)} - } - } - - // Create new map with old contents plus new entry. - newm := make(map[reflect.Type]*typeInfo) - m, _ := typeInfoMap.Load().(map[reflect.Type]*typeInfo) - for k, v := range m { - newm[k] = v - } - newm[rt] = info - typeInfoMap.Store(newm) - return info, nil -} - -// Called only when a panic is acceptable and unexpected. -func mustGetTypeInfo(rt reflect.Type) *typeInfo { - t, err := getTypeInfo(userType(rt)) - if err != nil { - panic("getTypeInfo: " + err.Error()) - } - return t -} - -// GobEncoder is the interface describing data that provides its own -// representation for encoding values for transmission to a GobDecoder. -// A type that implements GobEncoder and GobDecoder has complete -// control over the representation of its data and may therefore -// contain things such as private fields, channels, and functions, -// which are not usually transmissible in gob streams. -// -// Note: Since gobs can be stored permanently, It is good design -// to guarantee the encoding used by a GobEncoder is stable as the -// software evolves. For instance, it might make sense for GobEncode -// to include a version number in the encoding. -type GobEncoder interface { - // GobEncode returns a byte slice representing the encoding of the - // receiver for transmission to a GobDecoder, usually of the same - // concrete type. - GobEncode() ([]byte, error) -} - -// GobDecoder is the interface describing data that provides its own -// routine for decoding transmitted values sent by a GobEncoder. -type GobDecoder interface { - // GobDecode overwrites the receiver, which must be a pointer, - // with the value represented by the byte slice, which was written - // by GobEncode, usually for the same concrete type. - GobDecode([]byte) error -} - -var ( - registerLock sync.RWMutex - nameToConcreteType = make(map[string]reflect.Type) - concreteTypeToName = make(map[reflect.Type]string) -) - -// RegisterName is like Register but uses the provided name rather than the -// type's default. -func RegisterName(name string, value interface{}) { - if name == "" { - // reserved for nil - panic("attempt to register empty name") - } - registerLock.Lock() - defer registerLock.Unlock() - ut := userType(reflect.TypeOf(value)) - // Check for incompatible duplicates. The name must refer to the - // same user type, and vice versa. - if t, ok := nameToConcreteType[name]; ok && t != ut.user { - panic(fmt.Sprintf("gob: registering duplicate types for %q: %s != %s", name, t, ut.user)) - } - if n, ok := concreteTypeToName[ut.base]; ok && n != name { - panic(fmt.Sprintf("gob: registering duplicate names for %s: %q != %q", ut.user, n, name)) - } - // Store the name and type provided by the user.... - nameToConcreteType[name] = reflect.TypeOf(value) - // but the flattened type in the type table, since that's what decode needs. - concreteTypeToName[ut.base] = name -} - -// Register records a type, identified by a value for that type, under its -// internal type name. That name will identify the concrete type of a value -// sent or received as an interface variable. Only types that will be -// transferred as implementations of interface values need to be registered. -// Expecting to be used only during initialization, it panics if the mapping -// between types and names is not a bijection. -func Register(value interface{}) { - // Default to printed representation for unnamed types - rt := reflect.TypeOf(value) - name := rt.String() - - // But for named types (or pointers to them), qualify with import path (but see inner comment). - // Dereference one pointer looking for a named type. - star := "" - if rt.Name() == "" { - if pt := rt; pt.Kind() == reflect.Ptr { - star = "*" - // NOTE: The following line should be rt = pt.Elem() to implement - // what the comment above claims, but fixing it would break compatibility - // with existing gobs. - // - // Given package p imported as "full/p" with these definitions: - // package p - // type T1 struct { ... } - // this table shows the intended and actual strings used by gob to - // name the types: - // - // Type Correct string Actual string - // - // T1 full/p.T1 full/p.T1 - // *T1 *full/p.T1 *p.T1 - // - // The missing full path cannot be fixed without breaking existing gob decoders. - rt = pt - } - } - if rt.Name() != "" { - if rt.PkgPath() == "" { - name = star + rt.Name() - } else { - name = star + rt.PkgPath() + "." + rt.Name() - } - } - - RegisterName(name, value) -} - -func registerBasics() { - Register(int(0)) - Register(int8(0)) - Register(int16(0)) - Register(int32(0)) - Register(int64(0)) - Register(uint(0)) - Register(uint8(0)) - Register(uint16(0)) - Register(uint32(0)) - Register(uint64(0)) - Register(float32(0)) - Register(float64(0)) - Register(complex64(0i)) - Register(complex128(0i)) - Register(uintptr(0)) - Register(false) - Register("") - Register([]byte(nil)) - Register([]int(nil)) - Register([]int8(nil)) - Register([]int16(nil)) - Register([]int32(nil)) - Register([]int64(nil)) - Register([]uint(nil)) - Register([]uint8(nil)) - Register([]uint16(nil)) - Register([]uint32(nil)) - Register([]uint64(nil)) - Register([]float32(nil)) - Register([]float64(nil)) - Register([]complex64(nil)) - Register([]complex128(nil)) - Register([]uintptr(nil)) - Register([]bool(nil)) - Register([]string(nil)) -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/gob/type_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/gob/type_test.go deleted file mode 100644 index e230d22d4315584702e5f89ace19f6ee8088b547..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/gob/type_test.go +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gob - -import ( - "bytes" - "reflect" - "testing" -) - -type typeT struct { - id typeId - str string -} - -var basicTypes = []typeT{ - {tBool, "bool"}, - {tInt, "int"}, - {tUint, "uint"}, - {tFloat, "float"}, - {tBytes, "bytes"}, - {tString, "string"}, -} - -func getTypeUnlocked(name string, rt reflect.Type) gobType { - typeLock.Lock() - defer typeLock.Unlock() - t, err := getBaseType(name, rt) - if err != nil { - panic("getTypeUnlocked: " + err.Error()) - } - return t -} - -// Sanity checks -func TestBasic(t *testing.T) { - for _, tt := range basicTypes { - if tt.id.string() != tt.str { - t.Errorf("checkType: expected %q got %s", tt.str, tt.id.string()) - } - if tt.id == 0 { - t.Errorf("id for %q is zero", tt.str) - } - } -} - -// Reregister some basic types to check registration is idempotent. -func TestReregistration(t *testing.T) { - newtyp := getTypeUnlocked("int", reflect.TypeOf(int(0))) - if newtyp != tInt.gobType() { - t.Errorf("reregistration of %s got new type", newtyp.string()) - } - newtyp = getTypeUnlocked("uint", reflect.TypeOf(uint(0))) - if newtyp != tUint.gobType() { - t.Errorf("reregistration of %s got new type", newtyp.string()) - } - newtyp = getTypeUnlocked("string", reflect.TypeOf("hello")) - if newtyp != tString.gobType() { - t.Errorf("reregistration of %s got new type", newtyp.string()) - } -} - -func TestArrayType(t *testing.T) { - var a3 [3]int - a3int := getTypeUnlocked("foo", reflect.TypeOf(a3)) - newa3int := getTypeUnlocked("bar", reflect.TypeOf(a3)) - if a3int != newa3int { - t.Errorf("second registration of [3]int creates new type") - } - var a4 [4]int - a4int := getTypeUnlocked("goo", reflect.TypeOf(a4)) - if a3int == a4int { - t.Errorf("registration of [3]int creates same type as [4]int") - } - var b3 [3]bool - a3bool := getTypeUnlocked("", reflect.TypeOf(b3)) - if a3int == a3bool { - t.Errorf("registration of [3]bool creates same type as [3]int") - } - str := a3bool.string() - expected := "[3]bool" - if str != expected { - t.Errorf("array printed as %q; expected %q", str, expected) - } -} - -func TestSliceType(t *testing.T) { - var s []int - sint := getTypeUnlocked("slice", reflect.TypeOf(s)) - var news []int - newsint := getTypeUnlocked("slice1", reflect.TypeOf(news)) - if sint != newsint { - t.Errorf("second registration of []int creates new type") - } - var b []bool - sbool := getTypeUnlocked("", reflect.TypeOf(b)) - if sbool == sint { - t.Errorf("registration of []bool creates same type as []int") - } - str := sbool.string() - expected := "[]bool" - if str != expected { - t.Errorf("slice printed as %q; expected %q", str, expected) - } -} - -func TestMapType(t *testing.T) { - var m map[string]int - mapStringInt := getTypeUnlocked("map", reflect.TypeOf(m)) - var newm map[string]int - newMapStringInt := getTypeUnlocked("map1", reflect.TypeOf(newm)) - if mapStringInt != newMapStringInt { - t.Errorf("second registration of map[string]int creates new type") - } - var b map[string]bool - mapStringBool := getTypeUnlocked("", reflect.TypeOf(b)) - if mapStringBool == mapStringInt { - t.Errorf("registration of map[string]bool creates same type as map[string]int") - } - str := mapStringBool.string() - expected := "map[string]bool" - if str != expected { - t.Errorf("map printed as %q; expected %q", str, expected) - } -} - -type Bar struct { - X string -} - -// This structure has pointers and refers to itself, making it a good test case. -type Foo struct { - A int - B int32 // will become int - C string - D []byte - E *float64 // will become float64 - F ****float64 // will become float64 - G *Bar - H *Bar // should not interpolate the definition of Bar again - I *Foo // will not explode -} - -func TestStructType(t *testing.T) { - sstruct := getTypeUnlocked("Foo", reflect.TypeOf(Foo{})) - str := sstruct.string() - // If we can print it correctly, we built it correctly. - expected := "Foo = struct { A int; B int; C string; D bytes; E float; F float; G Bar = struct { X string; }; H Bar; I Foo; }" - if str != expected { - t.Errorf("struct printed as %q; expected %q", str, expected) - } -} - -// Should be OK to register the same type multiple times, as long as they're -// at the same level of indirection. -func TestRegistration(t *testing.T) { - type T struct{ a int } - Register(new(T)) - Register(new(T)) -} - -type N1 struct{} -type N2 struct{} - -// See comment in type.go/Register. -func TestRegistrationNaming(t *testing.T) { - testCases := []struct { - t interface{} - name string - }{ - {&N1{}, "*gob.N1"}, - {N2{}, "encoding/gob.N2"}, - } - - for _, tc := range testCases { - Register(tc.t) - - tct := reflect.TypeOf(tc.t) - registerLock.RLock() - ct := nameToConcreteType[tc.name] - registerLock.RUnlock() - if ct != tct { - t.Errorf("nameToConcreteType[%q] = %v, want %v", tc.name, ct, tct) - } - // concreteTypeToName is keyed off the base type. - if tct.Kind() == reflect.Ptr { - tct = tct.Elem() - } - if n := concreteTypeToName[tct]; n != tc.name { - t.Errorf("concreteTypeToName[%v] got %v, want %v", tct, n, tc.name) - } - } -} - -func TestStressParallel(t *testing.T) { - type T2 struct{ A int } - c := make(chan bool) - const N = 10 - for i := 0; i < N; i++ { - go func() { - p := new(T2) - Register(p) - b := new(bytes.Buffer) - enc := NewEncoder(b) - err := enc.Encode(p) - if err != nil { - t.Error("encoder fail:", err) - } - dec := NewDecoder(b) - err = dec.Decode(p) - if err != nil { - t.Error("decoder fail:", err) - } - c <- true - }() - } - for i := 0; i < N; i++ { - <-c - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex.go b/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex.go deleted file mode 100644 index d1fc7024a97fa24c0ea8b096dfb5a7d144550848..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex.go +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package hex implements hexadecimal encoding and decoding. -package hex - -import ( - "bytes" - "errors" - "fmt" - "io" -) - -const hextable = "0123456789abcdef" - -// EncodedLen returns the length of an encoding of n source bytes. -func EncodedLen(n int) int { return n * 2 } - -// Encode encodes src into EncodedLen(len(src)) -// bytes of dst. As a convenience, it returns the number -// of bytes written to dst, but this value is always EncodedLen(len(src)). -// Encode implements hexadecimal encoding. -func Encode(dst, src []byte) int { - for i, v := range src { - dst[i*2] = hextable[v>>4] - dst[i*2+1] = hextable[v&0x0f] - } - - return len(src) * 2 -} - -// ErrLength results from decoding an odd length slice. -var ErrLength = errors.New("encoding/hex: odd length hex string") - -// InvalidByteError values describe errors resulting from an invalid byte in a hex string. -type InvalidByteError byte - -func (e InvalidByteError) Error() string { - return fmt.Sprintf("encoding/hex: invalid byte: %#U", rune(e)) -} - -func DecodedLen(x int) int { return x / 2 } - -// Decode decodes src into DecodedLen(len(src)) bytes, returning the actual -// number of bytes written to dst. -// -// If Decode encounters invalid input, it returns an error describing the failure. -func Decode(dst, src []byte) (int, error) { - if len(src)%2 == 1 { - return 0, ErrLength - } - - for i := 0; i < len(src)/2; i++ { - a, ok := fromHexChar(src[i*2]) - if !ok { - return 0, InvalidByteError(src[i*2]) - } - b, ok := fromHexChar(src[i*2+1]) - if !ok { - return 0, InvalidByteError(src[i*2+1]) - } - dst[i] = (a << 4) | b - } - - return len(src) / 2, nil -} - -// fromHexChar converts a hex character into its value and a success flag. -func fromHexChar(c byte) (byte, bool) { - switch { - case '0' <= c && c <= '9': - return c - '0', true - case 'a' <= c && c <= 'f': - return c - 'a' + 10, true - case 'A' <= c && c <= 'F': - return c - 'A' + 10, true - } - - return 0, false -} - -// EncodeToString returns the hexadecimal encoding of src. -func EncodeToString(src []byte) string { - dst := make([]byte, EncodedLen(len(src))) - Encode(dst, src) - return string(dst) -} - -// DecodeString returns the bytes represented by the hexadecimal string s. -func DecodeString(s string) ([]byte, error) { - src := []byte(s) - dst := make([]byte, DecodedLen(len(src))) - _, err := Decode(dst, src) - if err != nil { - return nil, err - } - return dst, nil -} - -// Dump returns a string that contains a hex dump of the given data. The format -// of the hex dump matches the output of `hexdump -C` on the command line. -func Dump(data []byte) string { - var buf bytes.Buffer - dumper := Dumper(&buf) - dumper.Write(data) - dumper.Close() - return string(buf.Bytes()) -} - -// Dumper returns a WriteCloser that writes a hex dump of all written data to -// w. The format of the dump matches the output of `hexdump -C` on the command -// line. -func Dumper(w io.Writer) io.WriteCloser { - return &dumper{w: w} -} - -type dumper struct { - w io.Writer - rightChars [18]byte - buf [14]byte - used int // number of bytes in the current line - n uint // number of bytes, total -} - -func toChar(b byte) byte { - if b < 32 || b > 126 { - return '.' - } - return b -} - -func (h *dumper) Write(data []byte) (n int, err error) { - // Output lines look like: - // 00000010 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d |./0123456789:;<=| - // ^ offset ^ extra space ^ ASCII of line. - for i := range data { - if h.used == 0 { - // At the beginning of a line we print the current - // offset in hex. - h.buf[0] = byte(h.n >> 24) - h.buf[1] = byte(h.n >> 16) - h.buf[2] = byte(h.n >> 8) - h.buf[3] = byte(h.n) - Encode(h.buf[4:], h.buf[:4]) - h.buf[12] = ' ' - h.buf[13] = ' ' - _, err = h.w.Write(h.buf[4:]) - if err != nil { - return - } - } - Encode(h.buf[:], data[i:i+1]) - h.buf[2] = ' ' - l := 3 - if h.used == 7 { - // There's an additional space after the 8th byte. - h.buf[3] = ' ' - l = 4 - } else if h.used == 15 { - // At the end of the line there's an extra space and - // the bar for the right column. - h.buf[3] = ' ' - h.buf[4] = '|' - l = 5 - } - _, err = h.w.Write(h.buf[:l]) - if err != nil { - return - } - n++ - h.rightChars[h.used] = toChar(data[i]) - h.used++ - h.n++ - if h.used == 16 { - h.rightChars[16] = '|' - h.rightChars[17] = '\n' - _, err = h.w.Write(h.rightChars[:]) - if err != nil { - return - } - h.used = 0 - } - } - return -} - -func (h *dumper) Close() (err error) { - // See the comments in Write() for the details of this format. - if h.used == 0 { - return - } - h.buf[0] = ' ' - h.buf[1] = ' ' - h.buf[2] = ' ' - h.buf[3] = ' ' - h.buf[4] = '|' - nBytes := h.used - for h.used < 16 { - l := 3 - if h.used == 7 { - l = 4 - } else if h.used == 15 { - l = 5 - } - _, err = h.w.Write(h.buf[:l]) - if err != nil { - return - } - h.used++ - } - h.rightChars[nBytes] = '|' - h.rightChars[nBytes+1] = '\n' - _, err = h.w.Write(h.rightChars[:nBytes+2]) - return -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex_test.go deleted file mode 100644 index b969636cd5e6a330df08f03964f06df2fb1024db..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/hex/hex_test.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package hex - -import ( - "bytes" - "testing" -) - -type encDecTest struct { - enc string - dec []byte -} - -var encDecTests = []encDecTest{ - {"", []byte{}}, - {"0001020304050607", []byte{0, 1, 2, 3, 4, 5, 6, 7}}, - {"08090a0b0c0d0e0f", []byte{8, 9, 10, 11, 12, 13, 14, 15}}, - {"f0f1f2f3f4f5f6f7", []byte{0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7}}, - {"f8f9fafbfcfdfeff", []byte{0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff}}, - {"67", []byte{'g'}}, - {"e3a1", []byte{0xe3, 0xa1}}, -} - -func TestEncode(t *testing.T) { - for i, test := range encDecTests { - dst := make([]byte, EncodedLen(len(test.dec))) - n := Encode(dst, test.dec) - if n != len(dst) { - t.Errorf("#%d: bad return value: got: %d want: %d", i, n, len(dst)) - } - if string(dst) != test.enc { - t.Errorf("#%d: got: %#v want: %#v", i, dst, test.enc) - } - } -} - -func TestDecode(t *testing.T) { - // Case for decoding uppercase hex characters, since - // Encode always uses lowercase. - decTests := append(encDecTests, encDecTest{"F8F9FAFBFCFDFEFF", []byte{0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff}}) - for i, test := range decTests { - dst := make([]byte, DecodedLen(len(test.enc))) - n, err := Decode(dst, []byte(test.enc)) - if err != nil { - t.Errorf("#%d: bad return value: got:%d want:%d", i, n, len(dst)) - } else if !bytes.Equal(dst, test.dec) { - t.Errorf("#%d: got: %#v want: %#v", i, dst, test.dec) - } - } -} - -func TestEncodeToString(t *testing.T) { - for i, test := range encDecTests { - s := EncodeToString(test.dec) - if s != test.enc { - t.Errorf("#%d got:%s want:%s", i, s, test.enc) - } - } -} - -func TestDecodeString(t *testing.T) { - for i, test := range encDecTests { - dst, err := DecodeString(test.enc) - if err != nil { - t.Errorf("#%d: unexpected err value: %s", i, err) - continue - } - if !bytes.Equal(dst, test.dec) { - t.Errorf("#%d: got: %#v want: #%v", i, dst, test.dec) - } - } -} - -type errTest struct { - in string - err string -} - -var errTests = []errTest{ - {"0", "encoding/hex: odd length hex string"}, - {"0g", "encoding/hex: invalid byte: U+0067 'g'"}, - {"00gg", "encoding/hex: invalid byte: U+0067 'g'"}, - {"0\x01", "encoding/hex: invalid byte: U+0001"}, -} - -func TestInvalidErr(t *testing.T) { - for i, test := range errTests { - dst := make([]byte, DecodedLen(len(test.in))) - _, err := Decode(dst, []byte(test.in)) - if err == nil { - t.Errorf("#%d: expected error; got none", i) - } else if err.Error() != test.err { - t.Errorf("#%d: got: %v want: %v", i, err, test.err) - } - } -} - -func TestInvalidStringErr(t *testing.T) { - for i, test := range errTests { - _, err := DecodeString(test.in) - if err == nil { - t.Errorf("#%d: expected error; got none", i) - } else if err.Error() != test.err { - t.Errorf("#%d: got: %v want: %v", i, err, test.err) - } - } -} - -func TestDumper(t *testing.T) { - var in [40]byte - for i := range in { - in[i] = byte(i + 30) - } - - for stride := 1; stride < len(in); stride++ { - var out bytes.Buffer - dumper := Dumper(&out) - done := 0 - for done < len(in) { - todo := done + stride - if todo > len(in) { - todo = len(in) - } - dumper.Write(in[done:todo]) - done = todo - } - - dumper.Close() - if !bytes.Equal(out.Bytes(), expectedHexDump) { - t.Errorf("stride: %d failed. got:\n%s\nwant:\n%s", stride, out.Bytes(), expectedHexDump) - } - } -} - -func TestDump(t *testing.T) { - var in [40]byte - for i := range in { - in[i] = byte(i + 30) - } - - out := []byte(Dump(in[:])) - if !bytes.Equal(out, expectedHexDump) { - t.Errorf("got:\n%s\nwant:\n%s", out, expectedHexDump) - } -} - -var expectedHexDump = []byte(`00000000 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d |.. !"#$%&'()*+,-| -00000010 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d |./0123456789:;<=| -00000020 3e 3f 40 41 42 43 44 45 |>?@ABCDE| -`) diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/json/bench_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/json/bench_test.go deleted file mode 100644 index ed89d1156eda8ef31a9ce243974acf1e987e1159..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/json/bench_test.go +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Large data benchmark. -// The JSON data is a summary of agl's changes in the -// go, webkit, and chromium open source projects. -// We benchmark converting between the JSON form -// and in-memory data structures. - -package json - -import ( - "bytes" - "compress/gzip" - "io/ioutil" - "os" - "strings" - "testing" -) - -type codeResponse struct { - Tree *codeNode `json:"tree"` - Username string `json:"username"` -} - -type codeNode struct { - Name string `json:"name"` - Kids []*codeNode `json:"kids"` - CLWeight float64 `json:"cl_weight"` - Touches int `json:"touches"` - MinT int64 `json:"min_t"` - MaxT int64 `json:"max_t"` - MeanT int64 `json:"mean_t"` -} - -var codeJSON []byte -var codeStruct codeResponse - -func codeInit() { - f, err := os.Open("testdata/code.json.gz") - if err != nil { - panic(err) - } - defer f.Close() - gz, err := gzip.NewReader(f) - if err != nil { - panic(err) - } - data, err := ioutil.ReadAll(gz) - if err != nil { - panic(err) - } - - codeJSON = data - - if err := Unmarshal(codeJSON, &codeStruct); err != nil { - panic("unmarshal code.json: " + err.Error()) - } - - if data, err = Marshal(&codeStruct); err != nil { - panic("marshal code.json: " + err.Error()) - } - - if !bytes.Equal(data, codeJSON) { - println("different lengths", len(data), len(codeJSON)) - for i := 0; i < len(data) && i < len(codeJSON); i++ { - if data[i] != codeJSON[i] { - println("re-marshal: changed at byte", i) - println("orig: ", string(codeJSON[i-10:i+10])) - println("new: ", string(data[i-10:i+10])) - break - } - } - panic("re-marshal code.json: different result") - } -} - -func BenchmarkCodeEncoder(b *testing.B) { - if codeJSON == nil { - b.StopTimer() - codeInit() - b.StartTimer() - } - enc := NewEncoder(ioutil.Discard) - for i := 0; i < b.N; i++ { - if err := enc.Encode(&codeStruct); err != nil { - b.Fatal("Encode:", err) - } - } - b.SetBytes(int64(len(codeJSON))) -} - -func BenchmarkCodeMarshal(b *testing.B) { - if codeJSON == nil { - b.StopTimer() - codeInit() - b.StartTimer() - } - for i := 0; i < b.N; i++ { - if _, err := Marshal(&codeStruct); err != nil { - b.Fatal("Marshal:", err) - } - } - b.SetBytes(int64(len(codeJSON))) -} - -func BenchmarkCodeDecoder(b *testing.B) { - if codeJSON == nil { - b.StopTimer() - codeInit() - b.StartTimer() - } - var buf bytes.Buffer - dec := NewDecoder(&buf) - var r codeResponse - for i := 0; i < b.N; i++ { - buf.Write(codeJSON) - // hide EOF - buf.WriteByte('\n') - buf.WriteByte('\n') - buf.WriteByte('\n') - if err := dec.Decode(&r); err != nil { - b.Fatal("Decode:", err) - } - } - b.SetBytes(int64(len(codeJSON))) -} - -func BenchmarkDecoderStream(b *testing.B) { - b.StopTimer() - var buf bytes.Buffer - dec := NewDecoder(&buf) - buf.WriteString(`"` + strings.Repeat("x", 1000000) + `"` + "\n\n\n") - var x interface{} - if err := dec.Decode(&x); err != nil { - b.Fatal("Decode:", err) - } - ones := strings.Repeat(" 1\n", 300000) + "\n\n\n" - b.StartTimer() - for i := 0; i < b.N; i++ { - if i%300000 == 0 { - buf.WriteString(ones) - } - x = nil - if err := dec.Decode(&x); err != nil || x != 1.0 { - b.Fatalf("Decode: %v after %d", err, i) - } - } -} - -func BenchmarkCodeUnmarshal(b *testing.B) { - if codeJSON == nil { - b.StopTimer() - codeInit() - b.StartTimer() - } - for i := 0; i < b.N; i++ { - var r codeResponse - if err := Unmarshal(codeJSON, &r); err != nil { - b.Fatal("Unmmarshal:", err) - } - } - b.SetBytes(int64(len(codeJSON))) -} - -func BenchmarkCodeUnmarshalReuse(b *testing.B) { - if codeJSON == nil { - b.StopTimer() - codeInit() - b.StartTimer() - } - var r codeResponse - for i := 0; i < b.N; i++ { - if err := Unmarshal(codeJSON, &r); err != nil { - b.Fatal("Unmmarshal:", err) - } - } -} - -func BenchmarkUnmarshalString(b *testing.B) { - data := []byte(`"hello, world"`) - var s string - - for i := 0; i < b.N; i++ { - if err := Unmarshal(data, &s); err != nil { - b.Fatal("Unmarshal:", err) - } - } -} - -func BenchmarkUnmarshalFloat64(b *testing.B) { - var f float64 - data := []byte(`3.14`) - - for i := 0; i < b.N; i++ { - if err := Unmarshal(data, &f); err != nil { - b.Fatal("Unmarshal:", err) - } - } -} - -func BenchmarkUnmarshalInt64(b *testing.B) { - var x int64 - data := []byte(`3`) - - for i := 0; i < b.N; i++ { - if err := Unmarshal(data, &x); err != nil { - b.Fatal("Unmarshal:", err) - } - } -} - -func BenchmarkIssue10335(b *testing.B) { - b.ReportAllocs() - var s struct{} - j := []byte(`{"a":{ }}`) - for n := 0; n < b.N; n++ { - if err := Unmarshal(j, &s); err != nil { - b.Fatal(err) - } - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/json/decode.go b/llgo/third_party/gofrontend/libgo/go/encoding/json/decode.go deleted file mode 100644 index 530e8521dc5e6eccecfd0cde8926edada7d793fe..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/json/decode.go +++ /dev/null @@ -1,1093 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Represents JSON data structure using native Go types: booleans, floats, -// strings, arrays, and maps. - -package json - -import ( - "bytes" - "encoding" - "encoding/base64" - "errors" - "fmt" - "reflect" - "runtime" - "strconv" - "unicode" - "unicode/utf16" - "unicode/utf8" -) - -// Unmarshal parses the JSON-encoded data and stores the result -// in the value pointed to by v. -// -// Unmarshal uses the inverse of the encodings that -// Marshal uses, allocating maps, slices, and pointers as necessary, -// with the following additional rules: -// -// To unmarshal JSON into a pointer, Unmarshal first handles the case of -// the JSON being the JSON literal null. In that case, Unmarshal sets -// the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into -// the value pointed at by the pointer. If the pointer is nil, Unmarshal -// allocates a new value for it to point to. -// -// To unmarshal JSON into a struct, Unmarshal matches incoming object -// keys to the keys used by Marshal (either the struct field name or its tag), -// preferring an exact match but also accepting a case-insensitive match. -// -// To unmarshal JSON into an interface value, -// Unmarshal stores one of these in the interface value: -// -// bool, for JSON booleans -// float64, for JSON numbers -// string, for JSON strings -// []interface{}, for JSON arrays -// map[string]interface{}, for JSON objects -// nil for JSON null -// -// To unmarshal a JSON array into a slice, Unmarshal resets the slice to nil -// and then appends each element to the slice. -// -// To unmarshal a JSON object into a map, Unmarshal replaces the map -// with an empty map and then adds key-value pairs from the object to -// the map. -// -// If a JSON value is not appropriate for a given target type, -// or if a JSON number overflows the target type, Unmarshal -// skips that field and completes the unmarshalling as best it can. -// If no more serious errors are encountered, Unmarshal returns -// an UnmarshalTypeError describing the earliest such error. -// -// The JSON null value unmarshals into an interface, map, pointer, or slice -// by setting that Go value to nil. Because null is often used in JSON to mean -// ``not present,'' unmarshaling a JSON null into any other Go type has no effect -// on the value and produces no error. -// -// When unmarshaling quoted strings, invalid UTF-8 or -// invalid UTF-16 surrogate pairs are not treated as an error. -// Instead, they are replaced by the Unicode replacement -// character U+FFFD. -// -func Unmarshal(data []byte, v interface{}) error { - // Check for well-formedness. - // Avoids filling out half a data structure - // before discovering a JSON syntax error. - var d decodeState - err := checkValid(data, &d.scan) - if err != nil { - return err - } - - d.init(data) - return d.unmarshal(v) -} - -// Unmarshaler is the interface implemented by objects -// that can unmarshal a JSON description of themselves. -// The input can be assumed to be a valid encoding of -// a JSON value. UnmarshalJSON must copy the JSON data -// if it wishes to retain the data after returning. -type Unmarshaler interface { - UnmarshalJSON([]byte) error -} - -// An UnmarshalTypeError describes a JSON value that was -// not appropriate for a value of a specific Go type. -type UnmarshalTypeError struct { - Value string // description of JSON value - "bool", "array", "number -5" - Type reflect.Type // type of Go value it could not be assigned to - Offset int64 // error occurred after reading Offset bytes -} - -func (e *UnmarshalTypeError) Error() string { - return "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String() -} - -// An UnmarshalFieldError describes a JSON object key that -// led to an unexported (and therefore unwritable) struct field. -// (No longer used; kept for compatibility.) -type UnmarshalFieldError struct { - Key string - Type reflect.Type - Field reflect.StructField -} - -func (e *UnmarshalFieldError) Error() string { - return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String() -} - -// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. -// (The argument to Unmarshal must be a non-nil pointer.) -type InvalidUnmarshalError struct { - Type reflect.Type -} - -func (e *InvalidUnmarshalError) Error() string { - if e.Type == nil { - return "json: Unmarshal(nil)" - } - - if e.Type.Kind() != reflect.Ptr { - return "json: Unmarshal(non-pointer " + e.Type.String() + ")" - } - return "json: Unmarshal(nil " + e.Type.String() + ")" -} - -func (d *decodeState) unmarshal(v interface{}) (err error) { - defer func() { - if r := recover(); r != nil { - if _, ok := r.(runtime.Error); ok { - panic(r) - } - err = r.(error) - } - }() - - rv := reflect.ValueOf(v) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return &InvalidUnmarshalError{reflect.TypeOf(v)} - } - - d.scan.reset() - // We decode rv not rv.Elem because the Unmarshaler interface - // test must be applied at the top level of the value. - d.value(rv) - return d.savedError -} - -// A Number represents a JSON number literal. -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -// decodeState represents the state while decoding a JSON value. -type decodeState struct { - data []byte - off int // read offset in data - scan scanner - nextscan scanner // for calls to nextValue - savedError error - useNumber bool -} - -// errPhase is used for errors that should not happen unless -// there is a bug in the JSON decoder or something is editing -// the data slice while the decoder executes. -var errPhase = errors.New("JSON decoder out of sync - data changing underfoot?") - -func (d *decodeState) init(data []byte) *decodeState { - d.data = data - d.off = 0 - d.savedError = nil - return d -} - -// error aborts the decoding by panicking with err. -func (d *decodeState) error(err error) { - panic(err) -} - -// saveError saves the first err it is called with, -// for reporting at the end of the unmarshal. -func (d *decodeState) saveError(err error) { - if d.savedError == nil { - d.savedError = err - } -} - -// next cuts off and returns the next full JSON value in d.data[d.off:]. -// The next value is known to be an object or array, not a literal. -func (d *decodeState) next() []byte { - c := d.data[d.off] - item, rest, err := nextValue(d.data[d.off:], &d.nextscan) - if err != nil { - d.error(err) - } - d.off = len(d.data) - len(rest) - - // Our scanner has seen the opening brace/bracket - // and thinks we're still in the middle of the object. - // invent a closing brace/bracket to get it out. - if c == '{' { - d.scan.step(&d.scan, '}') - } else { - d.scan.step(&d.scan, ']') - } - - return item -} - -// scanWhile processes bytes in d.data[d.off:] until it -// receives a scan code not equal to op. -// It updates d.off and returns the new scan code. -func (d *decodeState) scanWhile(op int) int { - var newOp int - for { - if d.off >= len(d.data) { - newOp = d.scan.eof() - d.off = len(d.data) + 1 // mark processed EOF with len+1 - } else { - c := int(d.data[d.off]) - d.off++ - newOp = d.scan.step(&d.scan, c) - } - if newOp != op { - break - } - } - return newOp -} - -// value decodes a JSON value from d.data[d.off:] into the value. -// it updates d.off to point past the decoded value. -func (d *decodeState) value(v reflect.Value) { - if !v.IsValid() { - _, rest, err := nextValue(d.data[d.off:], &d.nextscan) - if err != nil { - d.error(err) - } - d.off = len(d.data) - len(rest) - - // d.scan thinks we're still at the beginning of the item. - // Feed in an empty string - the shortest, simplest value - - // so that it knows we got to the end of the value. - if d.scan.redo { - // rewind. - d.scan.redo = false - d.scan.step = stateBeginValue - } - d.scan.step(&d.scan, '"') - d.scan.step(&d.scan, '"') - - n := len(d.scan.parseState) - if n > 0 && d.scan.parseState[n-1] == parseObjectKey { - // d.scan thinks we just read an object key; finish the object - d.scan.step(&d.scan, ':') - d.scan.step(&d.scan, '"') - d.scan.step(&d.scan, '"') - d.scan.step(&d.scan, '}') - } - - return - } - - switch op := d.scanWhile(scanSkipSpace); op { - default: - d.error(errPhase) - - case scanBeginArray: - d.array(v) - - case scanBeginObject: - d.object(v) - - case scanBeginLiteral: - d.literal(v) - } -} - -type unquotedValue struct{} - -// valueQuoted is like value but decodes a -// quoted string literal or literal null into an interface value. -// If it finds anything other than a quoted string literal or null, -// valueQuoted returns unquotedValue{}. -func (d *decodeState) valueQuoted() interface{} { - switch op := d.scanWhile(scanSkipSpace); op { - default: - d.error(errPhase) - - case scanBeginArray: - d.array(reflect.Value{}) - - case scanBeginObject: - d.object(reflect.Value{}) - - case scanBeginLiteral: - switch v := d.literalInterface().(type) { - case nil, string: - return v - } - } - return unquotedValue{} -} - -// indirect walks down v allocating pointers as needed, -// until it gets to a non-pointer. -// if it encounters an Unmarshaler, indirect stops and returns that. -// if decodingNull is true, indirect stops at the last pointer so it can be set to nil. -func (d *decodeState) indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { - // If v is a named type and is addressable, - // start with its address, so that if the type has pointer methods, - // we find them. - if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { - v = v.Addr() - } - for { - // Load value from interface, but only if the result will be - // usefully addressable. - if v.Kind() == reflect.Interface && !v.IsNil() { - e := v.Elem() - if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { - v = e - continue - } - } - - if v.Kind() != reflect.Ptr { - break - } - - if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() { - break - } - if v.IsNil() { - v.Set(reflect.New(v.Type().Elem())) - } - if v.Type().NumMethod() > 0 { - if u, ok := v.Interface().(Unmarshaler); ok { - return u, nil, reflect.Value{} - } - if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { - return nil, u, reflect.Value{} - } - } - v = v.Elem() - } - return nil, nil, v -} - -// array consumes an array from d.data[d.off-1:], decoding into the value v. -// the first byte of the array ('[') has been read already. -func (d *decodeState) array(v reflect.Value) { - // Check for unmarshaler. - u, ut, pv := d.indirect(v, false) - if u != nil { - d.off-- - err := u.UnmarshalJSON(d.next()) - if err != nil { - d.error(err) - } - return - } - if ut != nil { - d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)}) - d.off-- - d.next() - return - } - - v = pv - - // Check type of target. - switch v.Kind() { - case reflect.Interface: - if v.NumMethod() == 0 { - // Decoding into nil interface? Switch to non-reflect code. - v.Set(reflect.ValueOf(d.arrayInterface())) - return - } - // Otherwise it's invalid. - fallthrough - default: - d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)}) - d.off-- - d.next() - return - case reflect.Array: - case reflect.Slice: - break - } - - i := 0 - for { - // Look ahead for ] - can only happen on first iteration. - op := d.scanWhile(scanSkipSpace) - if op == scanEndArray { - break - } - - // Back up so d.value can have the byte we just read. - d.off-- - d.scan.undo(op) - - // Get element of array, growing if necessary. - if v.Kind() == reflect.Slice { - // Grow slice if necessary - if i >= v.Cap() { - newcap := v.Cap() + v.Cap()/2 - if newcap < 4 { - newcap = 4 - } - newv := reflect.MakeSlice(v.Type(), v.Len(), newcap) - reflect.Copy(newv, v) - v.Set(newv) - } - if i >= v.Len() { - v.SetLen(i + 1) - } - } - - if i < v.Len() { - // Decode into element. - d.value(v.Index(i)) - } else { - // Ran out of fixed array: skip. - d.value(reflect.Value{}) - } - i++ - - // Next token must be , or ]. - op = d.scanWhile(scanSkipSpace) - if op == scanEndArray { - break - } - if op != scanArrayValue { - d.error(errPhase) - } - } - - if i < v.Len() { - if v.Kind() == reflect.Array { - // Array. Zero the rest. - z := reflect.Zero(v.Type().Elem()) - for ; i < v.Len(); i++ { - v.Index(i).Set(z) - } - } else { - v.SetLen(i) - } - } - if i == 0 && v.Kind() == reflect.Slice { - v.Set(reflect.MakeSlice(v.Type(), 0, 0)) - } -} - -var nullLiteral = []byte("null") - -// object consumes an object from d.data[d.off-1:], decoding into the value v. -// the first byte ('{') of the object has been read already. -func (d *decodeState) object(v reflect.Value) { - // Check for unmarshaler. - u, ut, pv := d.indirect(v, false) - if u != nil { - d.off-- - err := u.UnmarshalJSON(d.next()) - if err != nil { - d.error(err) - } - return - } - if ut != nil { - d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) - d.off-- - d.next() // skip over { } in input - return - } - v = pv - - // Decoding into nil interface? Switch to non-reflect code. - if v.Kind() == reflect.Interface && v.NumMethod() == 0 { - v.Set(reflect.ValueOf(d.objectInterface())) - return - } - - // Check type of target: struct or map[string]T - switch v.Kind() { - case reflect.Map: - // map must have string kind - t := v.Type() - if t.Key().Kind() != reflect.String { - d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) - d.off-- - d.next() // skip over { } in input - return - } - if v.IsNil() { - v.Set(reflect.MakeMap(t)) - } - case reflect.Struct: - - default: - d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)}) - d.off-- - d.next() // skip over { } in input - return - } - - var mapElem reflect.Value - - for { - // Read opening " of string key or closing }. - op := d.scanWhile(scanSkipSpace) - if op == scanEndObject { - // closing } - can only happen on first iteration. - break - } - if op != scanBeginLiteral { - d.error(errPhase) - } - - // Read key. - start := d.off - 1 - op = d.scanWhile(scanContinue) - item := d.data[start : d.off-1] - key, ok := unquoteBytes(item) - if !ok { - d.error(errPhase) - } - - // Figure out field corresponding to key. - var subv reflect.Value - destring := false // whether the value is wrapped in a string to be decoded first - - if v.Kind() == reflect.Map { - elemType := v.Type().Elem() - if !mapElem.IsValid() { - mapElem = reflect.New(elemType).Elem() - } else { - mapElem.Set(reflect.Zero(elemType)) - } - subv = mapElem - } else { - var f *field - fields := cachedTypeFields(v.Type()) - for i := range fields { - ff := &fields[i] - if bytes.Equal(ff.nameBytes, key) { - f = ff - break - } - if f == nil && ff.equalFold(ff.nameBytes, key) { - f = ff - } - } - if f != nil { - subv = v - destring = f.quoted - for _, i := range f.index { - if subv.Kind() == reflect.Ptr { - if subv.IsNil() { - subv.Set(reflect.New(subv.Type().Elem())) - } - subv = subv.Elem() - } - subv = subv.Field(i) - } - } - } - - // Read : before value. - if op == scanSkipSpace { - op = d.scanWhile(scanSkipSpace) - } - if op != scanObjectKey { - d.error(errPhase) - } - - // Read value. - if destring { - switch qv := d.valueQuoted().(type) { - case nil: - d.literalStore(nullLiteral, subv, false) - case string: - d.literalStore([]byte(qv), subv, true) - default: - d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", subv.Type())) - } - } else { - d.value(subv) - } - - // Write value back to map; - // if using struct, subv points into struct already. - if v.Kind() == reflect.Map { - kv := reflect.ValueOf(key).Convert(v.Type().Key()) - v.SetMapIndex(kv, subv) - } - - // Next token must be , or }. - op = d.scanWhile(scanSkipSpace) - if op == scanEndObject { - break - } - if op != scanObjectValue { - d.error(errPhase) - } - } -} - -// literal consumes a literal from d.data[d.off-1:], decoding into the value v. -// The first byte of the literal has been read already -// (that's how the caller knows it's a literal). -func (d *decodeState) literal(v reflect.Value) { - // All bytes inside literal return scanContinue op code. - start := d.off - 1 - op := d.scanWhile(scanContinue) - - // Scan read one byte too far; back up. - d.off-- - d.scan.undo(op) - - d.literalStore(d.data[start:d.off], v, false) -} - -// convertNumber converts the number literal s to a float64 or a Number -// depending on the setting of d.useNumber. -func (d *decodeState) convertNumber(s string) (interface{}, error) { - if d.useNumber { - return Number(s), nil - } - f, err := strconv.ParseFloat(s, 64) - if err != nil { - return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} - } - return f, nil -} - -var numberType = reflect.TypeOf(Number("")) - -// literalStore decodes a literal stored in item into v. -// -// fromQuoted indicates whether this literal came from unwrapping a -// string from the ",string" struct tag option. this is used only to -// produce more helpful error messages. -func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool) { - // Check for unmarshaler. - if len(item) == 0 { - //Empty string given - d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - return - } - wantptr := item[0] == 'n' // null - u, ut, pv := d.indirect(v, wantptr) - if u != nil { - err := u.UnmarshalJSON(item) - if err != nil { - d.error(err) - } - return - } - if ut != nil { - if item[0] != '"' { - if fromQuoted { - d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) - } - return - } - s, ok := unquoteBytes(item) - if !ok { - if fromQuoted { - d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.error(errPhase) - } - } - err := ut.UnmarshalText(s) - if err != nil { - d.error(err) - } - return - } - - v = pv - - switch c := item[0]; c { - case 'n': // null - switch v.Kind() { - case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - v.Set(reflect.Zero(v.Type())) - // otherwise, ignore null for primitives/string - } - case 't', 'f': // true, false - value := c == 't' - switch v.Kind() { - default: - if fromQuoted { - d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)}) - } - case reflect.Bool: - v.SetBool(value) - case reflect.Interface: - if v.NumMethod() == 0 { - v.Set(reflect.ValueOf(value)) - } else { - d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)}) - } - } - - case '"': // string - s, ok := unquoteBytes(item) - if !ok { - if fromQuoted { - d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.error(errPhase) - } - } - switch v.Kind() { - default: - d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) - case reflect.Slice: - if v.Type().Elem().Kind() != reflect.Uint8 { - d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) - break - } - b := make([]byte, base64.StdEncoding.DecodedLen(len(s))) - n, err := base64.StdEncoding.Decode(b, s) - if err != nil { - d.saveError(err) - break - } - v.Set(reflect.ValueOf(b[0:n])) - case reflect.String: - v.SetString(string(s)) - case reflect.Interface: - if v.NumMethod() == 0 { - v.Set(reflect.ValueOf(string(s))) - } else { - d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)}) - } - } - - default: // number - if c != '-' && (c < '0' || c > '9') { - if fromQuoted { - d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.error(errPhase) - } - } - s := string(item) - switch v.Kind() { - default: - if v.Kind() == reflect.String && v.Type() == numberType { - v.SetString(s) - break - } - if fromQuoted { - d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type())) - } else { - d.error(&UnmarshalTypeError{"number", v.Type(), int64(d.off)}) - } - case reflect.Interface: - n, err := d.convertNumber(s) - if err != nil { - d.saveError(err) - break - } - if v.NumMethod() != 0 { - d.saveError(&UnmarshalTypeError{"number", v.Type(), int64(d.off)}) - break - } - v.Set(reflect.ValueOf(n)) - - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - n, err := strconv.ParseInt(s, 10, 64) - if err != nil || v.OverflowInt(n) { - d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) - break - } - v.SetInt(n) - - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - n, err := strconv.ParseUint(s, 10, 64) - if err != nil || v.OverflowUint(n) { - d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) - break - } - v.SetUint(n) - - case reflect.Float32, reflect.Float64: - n, err := strconv.ParseFloat(s, v.Type().Bits()) - if err != nil || v.OverflowFloat(n) { - d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)}) - break - } - v.SetFloat(n) - } - } -} - -// The xxxInterface routines build up a value to be stored -// in an empty interface. They are not strictly necessary, -// but they avoid the weight of reflection in this common case. - -// valueInterface is like value but returns interface{} -func (d *decodeState) valueInterface() interface{} { - switch d.scanWhile(scanSkipSpace) { - default: - d.error(errPhase) - panic("unreachable") - case scanBeginArray: - return d.arrayInterface() - case scanBeginObject: - return d.objectInterface() - case scanBeginLiteral: - return d.literalInterface() - } -} - -// arrayInterface is like array but returns []interface{}. -func (d *decodeState) arrayInterface() []interface{} { - var v = make([]interface{}, 0) - for { - // Look ahead for ] - can only happen on first iteration. - op := d.scanWhile(scanSkipSpace) - if op == scanEndArray { - break - } - - // Back up so d.value can have the byte we just read. - d.off-- - d.scan.undo(op) - - v = append(v, d.valueInterface()) - - // Next token must be , or ]. - op = d.scanWhile(scanSkipSpace) - if op == scanEndArray { - break - } - if op != scanArrayValue { - d.error(errPhase) - } - } - return v -} - -// objectInterface is like object but returns map[string]interface{}. -func (d *decodeState) objectInterface() map[string]interface{} { - m := make(map[string]interface{}) - for { - // Read opening " of string key or closing }. - op := d.scanWhile(scanSkipSpace) - if op == scanEndObject { - // closing } - can only happen on first iteration. - break - } - if op != scanBeginLiteral { - d.error(errPhase) - } - - // Read string key. - start := d.off - 1 - op = d.scanWhile(scanContinue) - item := d.data[start : d.off-1] - key, ok := unquote(item) - if !ok { - d.error(errPhase) - } - - // Read : before value. - if op == scanSkipSpace { - op = d.scanWhile(scanSkipSpace) - } - if op != scanObjectKey { - d.error(errPhase) - } - - // Read value. - m[key] = d.valueInterface() - - // Next token must be , or }. - op = d.scanWhile(scanSkipSpace) - if op == scanEndObject { - break - } - if op != scanObjectValue { - d.error(errPhase) - } - } - return m -} - -// literalInterface is like literal but returns an interface value. -func (d *decodeState) literalInterface() interface{} { - // All bytes inside literal return scanContinue op code. - start := d.off - 1 - op := d.scanWhile(scanContinue) - - // Scan read one byte too far; back up. - d.off-- - d.scan.undo(op) - item := d.data[start:d.off] - - switch c := item[0]; c { - case 'n': // null - return nil - - case 't', 'f': // true, false - return c == 't' - - case '"': // string - s, ok := unquote(item) - if !ok { - d.error(errPhase) - } - return s - - default: // number - if c != '-' && (c < '0' || c > '9') { - d.error(errPhase) - } - n, err := d.convertNumber(string(item)) - if err != nil { - d.saveError(err) - } - return n - } -} - -// getu4 decodes \uXXXX from the beginning of s, returning the hex value, -// or it returns -1. -func getu4(s []byte) rune { - if len(s) < 6 || s[0] != '\\' || s[1] != 'u' { - return -1 - } - r, err := strconv.ParseUint(string(s[2:6]), 16, 64) - if err != nil { - return -1 - } - return rune(r) -} - -// unquote converts a quoted JSON string literal s into an actual string t. -// The rules are different than for Go, so cannot use strconv.Unquote. -func unquote(s []byte) (t string, ok bool) { - s, ok = unquoteBytes(s) - t = string(s) - return -} - -func unquoteBytes(s []byte) (t []byte, ok bool) { - if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' { - return - } - s = s[1 : len(s)-1] - - // Check for unusual characters. If there are none, - // then no unquoting is needed, so return a slice of the - // original bytes. - r := 0 - for r < len(s) { - c := s[r] - if c == '\\' || c == '"' || c < ' ' { - break - } - if c < utf8.RuneSelf { - r++ - continue - } - rr, size := utf8.DecodeRune(s[r:]) - if rr == utf8.RuneError && size == 1 { - break - } - r += size - } - if r == len(s) { - return s, true - } - - b := make([]byte, len(s)+2*utf8.UTFMax) - w := copy(b, s[0:r]) - for r < len(s) { - // Out of room? Can only happen if s is full of - // malformed UTF-8 and we're replacing each - // byte with RuneError. - if w >= len(b)-2*utf8.UTFMax { - nb := make([]byte, (len(b)+utf8.UTFMax)*2) - copy(nb, b[0:w]) - b = nb - } - switch c := s[r]; { - case c == '\\': - r++ - if r >= len(s) { - return - } - switch s[r] { - default: - return - case '"', '\\', '/', '\'': - b[w] = s[r] - r++ - w++ - case 'b': - b[w] = '\b' - r++ - w++ - case 'f': - b[w] = '\f' - r++ - w++ - case 'n': - b[w] = '\n' - r++ - w++ - case 'r': - b[w] = '\r' - r++ - w++ - case 't': - b[w] = '\t' - r++ - w++ - case 'u': - r-- - rr := getu4(s[r:]) - if rr < 0 { - return - } - r += 6 - if utf16.IsSurrogate(rr) { - rr1 := getu4(s[r:]) - if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar { - // A valid pair; consume. - r += 6 - w += utf8.EncodeRune(b[w:], dec) - break - } - // Invalid surrogate; fall back to replacement rune. - rr = unicode.ReplacementChar - } - w += utf8.EncodeRune(b[w:], rr) - } - - // Quote, control characters are invalid. - case c == '"', c < ' ': - return - - // ASCII - case c < utf8.RuneSelf: - b[w] = c - r++ - w++ - - // Coerce to well-formed UTF-8. - default: - rr, size := utf8.DecodeRune(s[r:]) - r += size - w += utf8.EncodeRune(b[w:], rr) - } - } - return b[0:w], true -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/json/decode_test.go b/llgo/third_party/gofrontend/libgo/go/encoding/json/decode_test.go deleted file mode 100644 index 51b15ef997cb4f593185971652ffa74723519b5a..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/json/decode_test.go +++ /dev/null @@ -1,1465 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package json - -import ( - "bytes" - "encoding" - "fmt" - "image" - "net" - "reflect" - "strings" - "testing" - "time" -) - -type T struct { - X string - Y int - Z int `json:"-"` -} - -type U struct { - Alphabet string `json:"alpha"` -} - -type V struct { - F1 interface{} - F2 int32 - F3 Number -} - -// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshaling with and -// without UseNumber -var ifaceNumAsFloat64 = map[string]interface{}{ - "k1": float64(1), - "k2": "s", - "k3": []interface{}{float64(1), float64(2.0), float64(3e-3)}, - "k4": map[string]interface{}{"kk1": "s", "kk2": float64(2)}, -} - -var ifaceNumAsNumber = map[string]interface{}{ - "k1": Number("1"), - "k2": "s", - "k3": []interface{}{Number("1"), Number("2.0"), Number("3e-3")}, - "k4": map[string]interface{}{"kk1": "s", "kk2": Number("2")}, -} - -type tx struct { - x int -} - -// A type that can unmarshal itself. - -type unmarshaler struct { - T bool -} - -func (u *unmarshaler) UnmarshalJSON(b []byte) error { - *u = unmarshaler{true} // All we need to see that UnmarshalJSON is called. - return nil -} - -type ustruct struct { - M unmarshaler -} - -type unmarshalerText struct { - T bool -} - -// needed for re-marshaling tests -func (u *unmarshalerText) MarshalText() ([]byte, error) { - return []byte(""), nil -} - -func (u *unmarshalerText) UnmarshalText(b []byte) error { - *u = unmarshalerText{true} // All we need to see that UnmarshalText is called. - return nil -} - -var _ encoding.TextUnmarshaler = (*unmarshalerText)(nil) - -type ustructText struct { - M unmarshalerText -} - -var ( - um0, um1 unmarshaler // target2 of unmarshaling - ump = &um1 - umtrue = unmarshaler{true} - umslice = []unmarshaler{{true}} - umslicep = new([]unmarshaler) - umstruct = ustruct{unmarshaler{true}} - - um0T, um1T unmarshalerText // target2 of unmarshaling - umpT = &um1T - umtrueT = unmarshalerText{true} - umsliceT = []unmarshalerText{{true}} - umslicepT = new([]unmarshalerText) - umstructT = ustructText{unmarshalerText{true}} -) - -// Test data structures for anonymous fields. - -type Point struct { - Z int -} - -type Top struct { - Level0 int - Embed0 - *Embed0a - *Embed0b `json:"e,omitempty"` // treated as named - Embed0c `json:"-"` // ignored - Loop - Embed0p // has Point with X, Y, used - Embed0q // has Point with Z, used - embed // contains exported field -} - -type Embed0 struct { - Level1a int // overridden by Embed0a's Level1a with json tag - Level1b int // used because Embed0a's Level1b is renamed - Level1c int // used because Embed0a's Level1c is ignored - Level1d int // annihilated by Embed0a's Level1d - Level1e int `json:"x"` // annihilated by Embed0a.Level1e -} - -type Embed0a struct { - Level1a int `json:"Level1a,omitempty"` - Level1b int `json:"LEVEL1B,omitempty"` - Level1c int `json:"-"` - Level1d int // annihilated by Embed0's Level1d - Level1f int `json:"x"` // annihilated by Embed0's Level1e -} - -type Embed0b Embed0 - -type Embed0c Embed0 - -type Embed0p struct { - image.Point -} - -type Embed0q struct { - Point -} - -type embed struct { - Q int -} - -type Loop struct { - Loop1 int `json:",omitempty"` - Loop2 int `json:",omitempty"` - *Loop -} - -// From reflect test: -// The X in S6 and S7 annihilate, but they also block the X in S8.S9. -type S5 struct { - S6 - S7 - S8 -} - -type S6 struct { - X int -} - -type S7 S6 - -type S8 struct { - S9 -} - -type S9 struct { - X int - Y int -} - -// From reflect test: -// The X in S11.S6 and S12.S6 annihilate, but they also block the X in S13.S8.S9. -type S10 struct { - S11 - S12 - S13 -} - -type S11 struct { - S6 -} - -type S12 struct { - S6 -} - -type S13 struct { - S8 -} - -type unmarshalTest struct { - in string - ptr interface{} - out interface{} - err error - useNumber bool -} - -type Ambig struct { - // Given "hello", the first match should win. - First int `json:"HELLO"` - Second int `json:"Hello"` -} - -type XYZ struct { - X interface{} - Y interface{} - Z interface{} -} - -func sliceAddr(x []int) *[]int { return &x } -func mapAddr(x map[string]int) *map[string]int { return &x } - -var unmarshalTests = []unmarshalTest{ - // basic types - {in: `true`, ptr: new(bool), out: true}, - {in: `1`, ptr: new(int), out: 1}, - {in: `1.2`, ptr: new(float64), out: 1.2}, - {in: `-5`, ptr: new(int16), out: int16(-5)}, - {in: `2`, ptr: new(Number), out: Number("2"), useNumber: true}, - {in: `2`, ptr: new(Number), out: Number("2")}, - {in: `2`, ptr: new(interface{}), out: float64(2.0)}, - {in: `2`, ptr: new(interface{}), out: Number("2"), useNumber: true}, - {in: `"a\u1234"`, ptr: new(string), out: "a\u1234"}, - {in: `"http:\/\/"`, ptr: new(string), out: "http://"}, - {in: `"g-clef: \uD834\uDD1E"`, ptr: new(string), out: "g-clef: \U0001D11E"}, - {in: `"invalid: \uD834x\uDD1E"`, ptr: new(string), out: "invalid: \uFFFDx\uFFFD"}, - {in: "null", ptr: new(interface{}), out: nil}, - {in: `{"X": [1,2,3], "Y": 4}`, ptr: new(T), out: T{Y: 4}, err: &UnmarshalTypeError{"array", reflect.TypeOf(""), 7}}, - {in: `{"x": 1}`, ptr: new(tx), out: tx{}}, - {in: `{"F1":1,"F2":2,"F3":3}`, ptr: new(V), out: V{F1: float64(1), F2: int32(2), F3: Number("3")}}, - {in: `{"F1":1,"F2":2,"F3":3}`, ptr: new(V), out: V{F1: Number("1"), F2: int32(2), F3: Number("3")}, useNumber: true}, - {in: `{"k1":1,"k2":"s","k3":[1,2.0,3e-3],"k4":{"kk1":"s","kk2":2}}`, ptr: new(interface{}), out: ifaceNumAsFloat64}, - {in: `{"k1":1,"k2":"s","k3":[1,2.0,3e-3],"k4":{"kk1":"s","kk2":2}}`, ptr: new(interface{}), out: ifaceNumAsNumber, useNumber: true}, - - // raw values with whitespace - {in: "\n true ", ptr: new(bool), out: true}, - {in: "\t 1 ", ptr: new(int), out: 1}, - {in: "\r 1.2 ", ptr: new(float64), out: 1.2}, - {in: "\t -5 \n", ptr: new(int16), out: int16(-5)}, - {in: "\t \"a\\u1234\" \n", ptr: new(string), out: "a\u1234"}, - - // Z has a "-" tag. - {in: `{"Y": 1, "Z": 2}`, ptr: new(T), out: T{Y: 1}}, - - {in: `{"alpha": "abc", "alphabet": "xyz"}`, ptr: new(U), out: U{Alphabet: "abc"}}, - {in: `{"alpha": "abc"}`, ptr: new(U), out: U{Alphabet: "abc"}}, - {in: `{"alphabet": "xyz"}`, ptr: new(U), out: U{}}, - - // syntax errors - {in: `{"X": "foo", "Y"}`, err: &SyntaxError{"invalid character '}' after object key", 17}}, - {in: `[1, 2, 3+]`, err: &SyntaxError{"invalid character '+' after array element", 9}}, - {in: `{"X":12x}`, err: &SyntaxError{"invalid character 'x' after object key:value pair", 8}, useNumber: true}, - - // raw value errors - {in: "\x01 42", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}}, - {in: " 42 \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 5}}, - {in: "\x01 true", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}}, - {in: " false \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 8}}, - {in: "\x01 1.2", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}}, - {in: " 3.4 \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 6}}, - {in: "\x01 \"string\"", err: &SyntaxError{"invalid character '\\x01' looking for beginning of value", 1}}, - {in: " \"string\" \x01", err: &SyntaxError{"invalid character '\\x01' after top-level value", 11}}, - - // array tests - {in: `[1, 2, 3]`, ptr: new([3]int), out: [3]int{1, 2, 3}}, - {in: `[1, 2, 3]`, ptr: new([1]int), out: [1]int{1}}, - {in: `[1, 2, 3]`, ptr: new([5]int), out: [5]int{1, 2, 3, 0, 0}}, - - // empty array to interface test - {in: `[]`, ptr: new([]interface{}), out: []interface{}{}}, - {in: `null`, ptr: new([]interface{}), out: []interface{}(nil)}, - {in: `{"T":[]}`, ptr: new(map[string]interface{}), out: map[string]interface{}{"T": []interface{}{}}}, - {in: `{"T":null}`, ptr: new(map[string]interface{}), out: map[string]interface{}{"T": interface{}(nil)}}, - - // composite tests - {in: allValueIndent, ptr: new(All), out: allValue}, - {in: allValueCompact, ptr: new(All), out: allValue}, - {in: allValueIndent, ptr: new(*All), out: &allValue}, - {in: allValueCompact, ptr: new(*All), out: &allValue}, - {in: pallValueIndent, ptr: new(All), out: pallValue}, - {in: pallValueCompact, ptr: new(All), out: pallValue}, - {in: pallValueIndent, ptr: new(*All), out: &pallValue}, - {in: pallValueCompact, ptr: new(*All), out: &pallValue}, - - // unmarshal interface test - {in: `{"T":false}`, ptr: &um0, out: umtrue}, // use "false" so test will fail if custom unmarshaler is not called - {in: `{"T":false}`, ptr: &ump, out: &umtrue}, - {in: `[{"T":false}]`, ptr: &umslice, out: umslice}, - {in: `[{"T":false}]`, ptr: &umslicep, out: &umslice}, - {in: `{"M":{"T":false}}`, ptr: &umstruct, out: umstruct}, - - // UnmarshalText interface test - {in: `"X"`, ptr: &um0T, out: umtrueT}, // use "false" so test will fail if custom unmarshaler is not called - {in: `"X"`, ptr: &umpT, out: &umtrueT}, - {in: `["X"]`, ptr: &umsliceT, out: umsliceT}, - {in: `["X"]`, ptr: &umslicepT, out: &umsliceT}, - {in: `{"M":"X"}`, ptr: &umstructT, out: umstructT}, - - // Overwriting of data. - // This is different from package xml, but it's what we've always done. - // Now documented and tested. - {in: `[2]`, ptr: sliceAddr([]int{1}), out: []int{2}}, - {in: `{"key": 2}`, ptr: mapAddr(map[string]int{"old": 0, "key": 1}), out: map[string]int{"key": 2}}, - - { - in: `{ - "Level0": 1, - "Level1b": 2, - "Level1c": 3, - "x": 4, - "Level1a": 5, - "LEVEL1B": 6, - "e": { - "Level1a": 8, - "Level1b": 9, - "Level1c": 10, - "Level1d": 11, - "x": 12 - }, - "Loop1": 13, - "Loop2": 14, - "X": 15, - "Y": 16, - "Z": 17, - "Q": 18 - }`, - ptr: new(Top), - out: Top{ - Level0: 1, - Embed0: Embed0{ - Level1b: 2, - Level1c: 3, - }, - Embed0a: &Embed0a{ - Level1a: 5, - Level1b: 6, - }, - Embed0b: &Embed0b{ - Level1a: 8, - Level1b: 9, - Level1c: 10, - Level1d: 11, - Level1e: 12, - }, - Loop: Loop{ - Loop1: 13, - Loop2: 14, - }, - Embed0p: Embed0p{ - Point: image.Point{X: 15, Y: 16}, - }, - Embed0q: Embed0q{ - Point: Point{Z: 17}, - }, - embed: embed{ - Q: 18, - }, - }, - }, - { - in: `{"hello": 1}`, - ptr: new(Ambig), - out: Ambig{First: 1}, - }, - - { - in: `{"X": 1,"Y":2}`, - ptr: new(S5), - out: S5{S8: S8{S9: S9{Y: 2}}}, - }, - { - in: `{"X": 1,"Y":2}`, - ptr: new(S10), - out: S10{S13: S13{S8: S8{S9: S9{Y: 2}}}}, - }, - - // invalid UTF-8 is coerced to valid UTF-8. - { - in: "\"hello\xffworld\"", - ptr: new(string), - out: "hello\ufffdworld", - }, - { - in: "\"hello\xc2\xc2world\"", - ptr: new(string), - out: "hello\ufffd\ufffdworld", - }, - { - in: "\"hello\xc2\xffworld\"", - ptr: new(string), - out: "hello\ufffd\ufffdworld", - }, - { - in: "\"hello\\ud800world\"", - ptr: new(string), - out: "hello\ufffdworld", - }, - { - in: "\"hello\\ud800\\ud800world\"", - ptr: new(string), - out: "hello\ufffd\ufffdworld", - }, - { - in: "\"hello\\ud800\\ud800world\"", - ptr: new(string), - out: "hello\ufffd\ufffdworld", - }, - { - in: "\"hello\xed\xa0\x80\xed\xb0\x80world\"", - ptr: new(string), - out: "hello\ufffd\ufffd\ufffd\ufffd\ufffd\ufffdworld", - }, - - // issue 8305 - { - in: `{"2009-11-10T23:00:00Z": "hello world"}`, - ptr: &map[time.Time]string{}, - err: &UnmarshalTypeError{"object", reflect.TypeOf(map[time.Time]string{}), 1}, - }, -} - -func TestMarshal(t *testing.T) { - b, err := Marshal(allValue) - if err != nil { - t.Fatalf("Marshal allValue: %v", err) - } - if string(b) != allValueCompact { - t.Errorf("Marshal allValueCompact") - diff(t, b, []byte(allValueCompact)) - return - } - - b, err = Marshal(pallValue) - if err != nil { - t.Fatalf("Marshal pallValue: %v", err) - } - if string(b) != pallValueCompact { - t.Errorf("Marshal pallValueCompact") - diff(t, b, []byte(pallValueCompact)) - return - } -} - -var badUTF8 = []struct { - in, out string -}{ - {"hello\xffworld", `"hello\ufffdworld"`}, - {"", `""`}, - {"\xff", `"\ufffd"`}, - {"\xff\xff", `"\ufffd\ufffd"`}, - {"a\xffb", `"a\ufffdb"`}, - {"\xe6\x97\xa5\xe6\x9c\xac\xff\xaa\x9e", `"日本\ufffd\ufffd\ufffd"`}, -} - -func TestMarshalBadUTF8(t *testing.T) { - for _, tt := range badUTF8 { - b, err := Marshal(tt.in) - if string(b) != tt.out || err != nil { - t.Errorf("Marshal(%q) = %#q, %v, want %#q, nil", tt.in, b, err, tt.out) - } - } -} - -func TestMarshalNumberZeroVal(t *testing.T) { - var n Number - out, err := Marshal(n) - if err != nil { - t.Fatal(err) - } - outStr := string(out) - if outStr != "0" { - t.Fatalf("Invalid zero val for Number: %q", outStr) - } -} - -func TestMarshalEmbeds(t *testing.T) { - top := &Top{ - Level0: 1, - Embed0: Embed0{ - Level1b: 2, - Level1c: 3, - }, - Embed0a: &Embed0a{ - Level1a: 5, - Level1b: 6, - }, - Embed0b: &Embed0b{ - Level1a: 8, - Level1b: 9, - Level1c: 10, - Level1d: 11, - Level1e: 12, - }, - Loop: Loop{ - Loop1: 13, - Loop2: 14, - }, - Embed0p: Embed0p{ - Point: image.Point{X: 15, Y: 16}, - }, - Embed0q: Embed0q{ - Point: Point{Z: 17}, - }, - embed: embed{ - Q: 18, - }, - } - b, err := Marshal(top) - if err != nil { - t.Fatal(err) - } - want := "{\"Level0\":1,\"Level1b\":2,\"Level1c\":3,\"Level1a\":5,\"LEVEL1B\":6,\"e\":{\"Level1a\":8,\"Level1b\":9,\"Level1c\":10,\"Level1d\":11,\"x\":12},\"Loop1\":13,\"Loop2\":14,\"X\":15,\"Y\":16,\"Z\":17,\"Q\":18}" - if string(b) != want { - t.Errorf("Wrong marshal result.\n got: %q\nwant: %q", b, want) - } -} - -func TestUnmarshal(t *testing.T) { - for i, tt := range unmarshalTests { - var scan scanner - in := []byte(tt.in) - if err := checkValid(in, &scan); err != nil { - if !reflect.DeepEqual(err, tt.err) { - t.Errorf("#%d: checkValid: %#v", i, err) - continue - } - } - if tt.ptr == nil { - continue - } - - // v = new(right-type) - v := reflect.New(reflect.TypeOf(tt.ptr).Elem()) - dec := NewDecoder(bytes.NewReader(in)) - if tt.useNumber { - dec.UseNumber() - } - if err := dec.Decode(v.Interface()); !reflect.DeepEqual(err, tt.err) { - t.Errorf("#%d: %v, want %v", i, err, tt.err) - continue - } else if err != nil { - continue - } - if !reflect.DeepEqual(v.Elem().Interface(), tt.out) { - t.Errorf("#%d: mismatch\nhave: %#+v\nwant: %#+v", i, v.Elem().Interface(), tt.out) - data, _ := Marshal(v.Elem().Interface()) - println(string(data)) - data, _ = Marshal(tt.out) - println(string(data)) - continue - } - - // Check round trip. - if tt.err == nil { - enc, err := Marshal(v.Interface()) - if err != nil { - t.Errorf("#%d: error re-marshaling: %v", i, err) - continue - } - vv := reflect.New(reflect.TypeOf(tt.ptr).Elem()) - dec = NewDecoder(bytes.NewReader(enc)) - if tt.useNumber { - dec.UseNumber() - } - if err := dec.Decode(vv.Interface()); err != nil { - t.Errorf("#%d: error re-unmarshaling %#q: %v", i, enc, err) - continue - } - if !reflect.DeepEqual(v.Elem().Interface(), vv.Elem().Interface()) { - t.Errorf("#%d: mismatch\nhave: %#+v\nwant: %#+v", i, v.Elem().Interface(), vv.Elem().Interface()) - t.Errorf(" In: %q", strings.Map(noSpace, string(in))) - t.Errorf("Marshal: %q", strings.Map(noSpace, string(enc))) - continue - } - } - } -} - -func TestUnmarshalMarshal(t *testing.T) { - initBig() - var v interface{} - if err := Unmarshal(jsonBig, &v); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - b, err := Marshal(v) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - if !bytes.Equal(jsonBig, b) { - t.Errorf("Marshal jsonBig") - diff(t, b, jsonBig) - return - } -} - -var numberTests = []struct { - in string - i int64 - intErr string - f float64 - floatErr string -}{ - {in: "-1.23e1", intErr: "strconv.ParseInt: parsing \"-1.23e1\": invalid syntax", f: -1.23e1}, - {in: "-12", i: -12, f: -12.0}, - {in: "1e1000", intErr: "strconv.ParseInt: parsing \"1e1000\": invalid syntax", floatErr: "strconv.ParseFloat: parsing \"1e1000\": value out of range"}, -} - -// Independent of Decode, basic coverage of the accessors in Number -func TestNumberAccessors(t *testing.T) { - for _, tt := range numberTests { - n := Number(tt.in) - if s := n.String(); s != tt.in { - t.Errorf("Number(%q).String() is %q", tt.in, s) - } - if i, err := n.Int64(); err == nil && tt.intErr == "" && i != tt.i { - t.Errorf("Number(%q).Int64() is %d", tt.in, i) - } else if (err == nil && tt.intErr != "") || (err != nil && err.Error() != tt.intErr) { - t.Errorf("Number(%q).Int64() wanted error %q but got: %v", tt.in, tt.intErr, err) - } - if f, err := n.Float64(); err == nil && tt.floatErr == "" && f != tt.f { - t.Errorf("Number(%q).Float64() is %g", tt.in, f) - } else if (err == nil && tt.floatErr != "") || (err != nil && err.Error() != tt.floatErr) { - t.Errorf("Number(%q).Float64() wanted error %q but got: %v", tt.in, tt.floatErr, err) - } - } -} - -func TestLargeByteSlice(t *testing.T) { - s0 := make([]byte, 2000) - for i := range s0 { - s0[i] = byte(i) - } - b, err := Marshal(s0) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - var s1 []byte - if err := Unmarshal(b, &s1); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if !bytes.Equal(s0, s1) { - t.Errorf("Marshal large byte slice") - diff(t, s0, s1) - } -} - -type Xint struct { - X int -} - -func TestUnmarshalInterface(t *testing.T) { - var xint Xint - var i interface{} = &xint - if err := Unmarshal([]byte(`{"X":1}`), &i); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if xint.X != 1 { - t.Fatalf("Did not write to xint") - } -} - -func TestUnmarshalPtrPtr(t *testing.T) { - var xint Xint - pxint := &xint - if err := Unmarshal([]byte(`{"X":1}`), &pxint); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if xint.X != 1 { - t.Fatalf("Did not write to xint") - } -} - -func TestEscape(t *testing.T) { - const input = `"foobar"` + " [\u2028 \u2029]" - const expected = `"\"foobar\"\u003chtml\u003e [\u2028 \u2029]"` - b, err := Marshal(input) - if err != nil { - t.Fatalf("Marshal error: %v", err) - } - if s := string(b); s != expected { - t.Errorf("Encoding of [%s]:\n got [%s]\nwant [%s]", input, s, expected) - } -} - -// WrongString is a struct that's misusing the ,string modifier. -type WrongString struct { - Message string `json:"result,string"` -} - -type wrongStringTest struct { - in, err string -} - -var wrongStringTests = []wrongStringTest{ - {`{"result":"x"}`, `json: invalid use of ,string struct tag, trying to unmarshal "x" into string`}, - {`{"result":"foo"}`, `json: invalid use of ,string struct tag, trying to unmarshal "foo" into string`}, - {`{"result":"123"}`, `json: invalid use of ,string struct tag, trying to unmarshal "123" into string`}, - {`{"result":123}`, `json: invalid use of ,string struct tag, trying to unmarshal unquoted value into string`}, -} - -// If people misuse the ,string modifier, the error message should be -// helpful, telling the user that they're doing it wrong. -func TestErrorMessageFromMisusedString(t *testing.T) { - for n, tt := range wrongStringTests { - r := strings.NewReader(tt.in) - var s WrongString - err := NewDecoder(r).Decode(&s) - got := fmt.Sprintf("%v", err) - if got != tt.err { - t.Errorf("%d. got err = %q, want %q", n, got, tt.err) - } - } -} - -func noSpace(c rune) rune { - if isSpace(c) { - return -1 - } - return c -} - -type All struct { - Bool bool - Int int - Int8 int8 - Int16 int16 - Int32 int32 - Int64 int64 - Uint uint - Uint8 uint8 - Uint16 uint16 - Uint32 uint32 - Uint64 uint64 - Uintptr uintptr - Float32 float32 - Float64 float64 - - Foo string `json:"bar"` - Foo2 string `json:"bar2,dummyopt"` - - IntStr int64 `json:",string"` - - PBool *bool - PInt *int - PInt8 *int8 - PInt16 *int16 - PInt32 *int32 - PInt64 *int64 - PUint *uint - PUint8 *uint8 - PUint16 *uint16 - PUint32 *uint32 - PUint64 *uint64 - PUintptr *uintptr - PFloat32 *float32 - PFloat64 *float64 - - String string - PString *string - - Map map[string]Small - MapP map[string]*Small - PMap *map[string]Small - PMapP *map[string]*Small - - EmptyMap map[string]Small - NilMap map[string]Small - - Slice []Small - SliceP []*Small - PSlice *[]Small - PSliceP *[]*Small - - EmptySlice []Small - NilSlice []Small - - StringSlice []string - ByteSlice []byte - - Small Small - PSmall *Small - PPSmall **Small - - Interface interface{} - PInterface *interface{} - - unexported int -} - -type Small struct { - Tag string -} - -var allValue = All{ - Bool: true, - Int: 2, - Int8: 3, - Int16: 4, - Int32: 5, - Int64: 6, - Uint: 7, - Uint8: 8, - Uint16: 9, - Uint32: 10, - Uint64: 11, - Uintptr: 12, - Float32: 14.1, - Float64: 15.1, - Foo: "foo", - Foo2: "foo2", - IntStr: 42, - String: "16", - Map: map[string]Small{ - "17": {Tag: "tag17"}, - "18": {Tag: "tag18"}, - }, - MapP: map[string]*Small{ - "19": {Tag: "tag19"}, - "20": nil, - }, - EmptyMap: map[string]Small{}, - Slice: []Small{{Tag: "tag20"}, {Tag: "tag21"}}, - SliceP: []*Small{{Tag: "tag22"}, nil, {Tag: "tag23"}}, - EmptySlice: []Small{}, - StringSlice: []string{"str24", "str25", "str26"}, - ByteSlice: []byte{27, 28, 29}, - Small: Small{Tag: "tag30"}, - PSmall: &Small{Tag: "tag31"}, - Interface: 5.2, -} - -var pallValue = All{ - PBool: &allValue.Bool, - PInt: &allValue.Int, - PInt8: &allValue.Int8, - PInt16: &allValue.Int16, - PInt32: &allValue.Int32, - PInt64: &allValue.Int64, - PUint: &allValue.Uint, - PUint8: &allValue.Uint8, - PUint16: &allValue.Uint16, - PUint32: &allValue.Uint32, - PUint64: &allValue.Uint64, - PUintptr: &allValue.Uintptr, - PFloat32: &allValue.Float32, - PFloat64: &allValue.Float64, - PString: &allValue.String, - PMap: &allValue.Map, - PMapP: &allValue.MapP, - PSlice: &allValue.Slice, - PSliceP: &allValue.SliceP, - PPSmall: &allValue.PSmall, - PInterface: &allValue.Interface, -} - -var allValueIndent = `{ - "Bool": true, - "Int": 2, - "Int8": 3, - "Int16": 4, - "Int32": 5, - "Int64": 6, - "Uint": 7, - "Uint8": 8, - "Uint16": 9, - "Uint32": 10, - "Uint64": 11, - "Uintptr": 12, - "Float32": 14.1, - "Float64": 15.1, - "bar": "foo", - "bar2": "foo2", - "IntStr": "42", - "PBool": null, - "PInt": null, - "PInt8": null, - "PInt16": null, - "PInt32": null, - "PInt64": null, - "PUint": null, - "PUint8": null, - "PUint16": null, - "PUint32": null, - "PUint64": null, - "PUintptr": null, - "PFloat32": null, - "PFloat64": null, - "String": "16", - "PString": null, - "Map": { - "17": { - "Tag": "tag17" - }, - "18": { - "Tag": "tag18" - } - }, - "MapP": { - "19": { - "Tag": "tag19" - }, - "20": null - }, - "PMap": null, - "PMapP": null, - "EmptyMap": {}, - "NilMap": null, - "Slice": [ - { - "Tag": "tag20" - }, - { - "Tag": "tag21" - } - ], - "SliceP": [ - { - "Tag": "tag22" - }, - null, - { - "Tag": "tag23" - } - ], - "PSlice": null, - "PSliceP": null, - "EmptySlice": [], - "NilSlice": null, - "StringSlice": [ - "str24", - "str25", - "str26" - ], - "ByteSlice": "Gxwd", - "Small": { - "Tag": "tag30" - }, - "PSmall": { - "Tag": "tag31" - }, - "PPSmall": null, - "Interface": 5.2, - "PInterface": null -}` - -var allValueCompact = strings.Map(noSpace, allValueIndent) - -var pallValueIndent = `{ - "Bool": false, - "Int": 0, - "Int8": 0, - "Int16": 0, - "Int32": 0, - "Int64": 0, - "Uint": 0, - "Uint8": 0, - "Uint16": 0, - "Uint32": 0, - "Uint64": 0, - "Uintptr": 0, - "Float32": 0, - "Float64": 0, - "bar": "", - "bar2": "", - "IntStr": "0", - "PBool": true, - "PInt": 2, - "PInt8": 3, - "PInt16": 4, - "PInt32": 5, - "PInt64": 6, - "PUint": 7, - "PUint8": 8, - "PUint16": 9, - "PUint32": 10, - "PUint64": 11, - "PUintptr": 12, - "PFloat32": 14.1, - "PFloat64": 15.1, - "String": "", - "PString": "16", - "Map": null, - "MapP": null, - "PMap": { - "17": { - "Tag": "tag17" - }, - "18": { - "Tag": "tag18" - } - }, - "PMapP": { - "19": { - "Tag": "tag19" - }, - "20": null - }, - "EmptyMap": null, - "NilMap": null, - "Slice": null, - "SliceP": null, - "PSlice": [ - { - "Tag": "tag20" - }, - { - "Tag": "tag21" - } - ], - "PSliceP": [ - { - "Tag": "tag22" - }, - null, - { - "Tag": "tag23" - } - ], - "EmptySlice": null, - "NilSlice": null, - "StringSlice": null, - "ByteSlice": null, - "Small": { - "Tag": "" - }, - "PSmall": null, - "PPSmall": { - "Tag": "tag31" - }, - "Interface": null, - "PInterface": 5.2 -}` - -var pallValueCompact = strings.Map(noSpace, pallValueIndent) - -func TestRefUnmarshal(t *testing.T) { - type S struct { - // Ref is defined in encode_test.go. - R0 Ref - R1 *Ref - R2 RefText - R3 *RefText - } - want := S{ - R0: 12, - R1: new(Ref), - R2: 13, - R3: new(RefText), - } - *want.R1 = 12 - *want.R3 = 13 - - var got S - if err := Unmarshal([]byte(`{"R0":"ref","R1":"ref","R2":"ref","R3":"ref"}`), &got); err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if !reflect.DeepEqual(got, want) { - t.Errorf("got %+v, want %+v", got, want) - } -} - -// Test that the empty string doesn't panic decoding when ,string is specified -// Issue 3450 -func TestEmptyString(t *testing.T) { - type T2 struct { - Number1 int `json:",string"` - Number2 int `json:",string"` - } - data := `{"Number1":"1", "Number2":""}` - dec := NewDecoder(strings.NewReader(data)) - var t2 T2 - err := dec.Decode(&t2) - if err == nil { - t.Fatal("Decode: did not return error") - } - if t2.Number1 != 1 { - t.Fatal("Decode: did not set Number1") - } -} - -// Test that a null for ,string is not replaced with the previous quoted string (issue 7046). -// It should also not be an error (issue 2540, issue 8587). -func TestNullString(t *testing.T) { - type T struct { - A int `json:",string"` - B int `json:",string"` - C *int `json:",string"` - } - data := []byte(`{"A": "1", "B": null, "C": null}`) - var s T - s.B = 1 - s.C = new(int) - *s.C = 2 - err := Unmarshal(data, &s) - if err != nil { - t.Fatalf("Unmarshal: %v", err) - } - if s.B != 1 || s.C != nil { - t.Fatalf("after Unmarshal, s.B=%d, s.C=%p, want 1, nil", s.B, s.C) - } -} - -func intp(x int) *int { - p := new(int) - *p = x - return p -} - -func intpp(x *int) **int { - pp := new(*int) - *pp = x - return pp -} - -var interfaceSetTests = []struct { - pre interface{} - json string - post interface{} -}{ - {"foo", `"bar"`, "bar"}, - {"foo", `2`, 2.0}, - {"foo", `true`, true}, - {"foo", `null`, nil}, - - {nil, `null`, nil}, - {new(int), `null`, nil}, - {(*int)(nil), `null`, nil}, - {new(*int), `null`, new(*int)}, - {(**int)(nil), `null`, nil}, - {intp(1), `null`, nil}, - {intpp(nil), `null`, intpp(nil)}, - {intpp(intp(1)), `null`, intpp(nil)}, -} - -func TestInterfaceSet(t *testing.T) { - for _, tt := range interfaceSetTests { - b := struct{ X interface{} }{tt.pre} - blob := `{"X":` + tt.json + `}` - if err := Unmarshal([]byte(blob), &b); err != nil { - t.Errorf("Unmarshal %#q: %v", blob, err) - continue - } - if !reflect.DeepEqual(b.X, tt.post) { - t.Errorf("Unmarshal %#q into %#v: X=%#v, want %#v", blob, tt.pre, b.X, tt.post) - } - } -} - -// JSON null values should be ignored for primitives and string values instead of resulting in an error. -// Issue 2540 -func TestUnmarshalNulls(t *testing.T) { - jsonData := []byte(`{ - "Bool" : null, - "Int" : null, - "Int8" : null, - "Int16" : null, - "Int32" : null, - "Int64" : null, - "Uint" : null, - "Uint8" : null, - "Uint16" : null, - "Uint32" : null, - "Uint64" : null, - "Float32" : null, - "Float64" : null, - "String" : null}`) - - nulls := All{ - Bool: true, - Int: 2, - Int8: 3, - Int16: 4, - Int32: 5, - Int64: 6, - Uint: 7, - Uint8: 8, - Uint16: 9, - Uint32: 10, - Uint64: 11, - Float32: 12.1, - Float64: 13.1, - String: "14"} - - err := Unmarshal(jsonData, &nulls) - if err != nil { - t.Errorf("Unmarshal of null values failed: %v", err) - } - if !nulls.Bool || nulls.Int != 2 || nulls.Int8 != 3 || nulls.Int16 != 4 || nulls.Int32 != 5 || nulls.Int64 != 6 || - nulls.Uint != 7 || nulls.Uint8 != 8 || nulls.Uint16 != 9 || nulls.Uint32 != 10 || nulls.Uint64 != 11 || - nulls.Float32 != 12.1 || nulls.Float64 != 13.1 || nulls.String != "14" { - - t.Errorf("Unmarshal of null values affected primitives") - } -} - -func TestStringKind(t *testing.T) { - type stringKind string - - var m1, m2 map[stringKind]int - m1 = map[stringKind]int{ - "foo": 42, - } - - data, err := Marshal(m1) - if err != nil { - t.Errorf("Unexpected error marshalling: %v", err) - } - - err = Unmarshal(data, &m2) - if err != nil { - t.Errorf("Unexpected error unmarshalling: %v", err) - } - - if !reflect.DeepEqual(m1, m2) { - t.Error("Items should be equal after encoding and then decoding") - } -} - -// Custom types with []byte as underlying type could not be marshalled -// and then unmarshalled. -// Issue 8962. -func TestByteKind(t *testing.T) { - type byteKind []byte - - a := byteKind("hello") - - data, err := Marshal(a) - if err != nil { - t.Error(err) - } - var b byteKind - err = Unmarshal(data, &b) - if err != nil { - t.Fatal(err) - } - if !reflect.DeepEqual(a, b) { - t.Errorf("expected %v == %v", a, b) - } -} - -var decodeTypeErrorTests = []struct { - dest interface{} - src string -}{ - {new(string), `{"user": "name"}`}, // issue 4628. - {new(error), `{}`}, // issue 4222 - {new(error), `[]`}, - {new(error), `""`}, - {new(error), `123`}, - {new(error), `true`}, -} - -func TestUnmarshalTypeError(t *testing.T) { - for _, item := range decodeTypeErrorTests { - err := Unmarshal([]byte(item.src), item.dest) - if _, ok := err.(*UnmarshalTypeError); !ok { - t.Errorf("expected type error for Unmarshal(%q, type %T): got %T", - item.src, item.dest, err) - } - } -} - -var unmarshalSyntaxTests = []string{ - "tru", - "fals", - "nul", - "123e", - `"hello`, - `[1,2,3`, - `{"key":1`, - `{"key":1,`, -} - -func TestUnmarshalSyntax(t *testing.T) { - var x interface{} - for _, src := range unmarshalSyntaxTests { - err := Unmarshal([]byte(src), &x) - if _, ok := err.(*SyntaxError); !ok { - t.Errorf("expected syntax error for Unmarshal(%q): got %T", src, err) - } - } -} - -// Test handling of unexported fields that should be ignored. -// Issue 4660 -type unexportedFields struct { - Name string - m map[string]interface{} `json:"-"` - m2 map[string]interface{} `json:"abcd"` -} - -func TestUnmarshalUnexported(t *testing.T) { - input := `{"Name": "Bob", "m": {"x": 123}, "m2": {"y": 456}, "abcd": {"z": 789}}` - want := &unexportedFields{Name: "Bob"} - - out := &unexportedFields{} - err := Unmarshal([]byte(input), out) - if err != nil { - t.Errorf("got error %v, expected nil", err) - } - if !reflect.DeepEqual(out, want) { - t.Errorf("got %q, want %q", out, want) - } -} - -// Time3339 is a time.Time which encodes to and from JSON -// as an RFC 3339 time in UTC. -type Time3339 time.Time - -func (t *Time3339) UnmarshalJSON(b []byte) error { - if len(b) < 2 || b[0] != '"' || b[len(b)-1] != '"' { - return fmt.Errorf("types: failed to unmarshal non-string value %q as an RFC 3339 time", b) - } - tm, err := time.Parse(time.RFC3339, string(b[1:len(b)-1])) - if err != nil { - return err - } - *t = Time3339(tm) - return nil -} - -func TestUnmarshalJSONLiteralError(t *testing.T) { - var t3 Time3339 - err := Unmarshal([]byte(`"0000-00-00T00:00:00Z"`), &t3) - if err == nil { - t.Fatalf("expected error; got time %v", time.Time(t3)) - } - if !strings.Contains(err.Error(), "range") { - t.Errorf("got err = %v; want out of range error", err) - } -} - -// Test that extra object elements in an array do not result in a -// "data changing underfoot" error. -// Issue 3717 -func TestSkipArrayObjects(t *testing.T) { - json := `[{}]` - var dest [0]interface{} - - err := Unmarshal([]byte(json), &dest) - if err != nil { - t.Errorf("got error %q, want nil", err) - } -} - -// Test semantics of pre-filled struct fields and pre-filled map fields. -// Issue 4900. -func TestPrefilled(t *testing.T) { - ptrToMap := func(m map[string]interface{}) *map[string]interface{} { return &m } - - // Values here change, cannot reuse table across runs. - var prefillTests = []struct { - in string - ptr interface{} - out interface{} - }{ - { - in: `{"X": 1, "Y": 2}`, - ptr: &XYZ{X: float32(3), Y: int16(4), Z: 1.5}, - out: &XYZ{X: float64(1), Y: float64(2), Z: 1.5}, - }, - { - in: `{"X": 1, "Y": 2}`, - ptr: ptrToMap(map[string]interface{}{"X": float32(3), "Y": int16(4), "Z": 1.5}), - out: ptrToMap(map[string]interface{}{"X": float64(1), "Y": float64(2), "Z": 1.5}), - }, - } - - for _, tt := range prefillTests { - ptrstr := fmt.Sprintf("%v", tt.ptr) - err := Unmarshal([]byte(tt.in), tt.ptr) // tt.ptr edited here - if err != nil { - t.Errorf("Unmarshal: %v", err) - } - if !reflect.DeepEqual(tt.ptr, tt.out) { - t.Errorf("Unmarshal(%#q, %s): have %v, want %v", tt.in, ptrstr, tt.ptr, tt.out) - } - } -} - -var invalidUnmarshalTests = []struct { - v interface{} - want string -}{ - {nil, "json: Unmarshal(nil)"}, - {struct{}{}, "json: Unmarshal(non-pointer struct {})"}, - {(*int)(nil), "json: Unmarshal(nil *int)"}, -} - -func TestInvalidUnmarshal(t *testing.T) { - buf := []byte(`{"a":"1"}`) - for _, tt := range invalidUnmarshalTests { - err := Unmarshal(buf, tt.v) - if err == nil { - t.Errorf("Unmarshal expecting error, got nil") - continue - } - if got := err.Error(); got != tt.want { - t.Errorf("Unmarshal = %q; want %q", got, tt.want) - } - } -} - -var invalidUnmarshalTextTests = []struct { - v interface{} - want string -}{ - {nil, "json: Unmarshal(nil)"}, - {struct{}{}, "json: Unmarshal(non-pointer struct {})"}, - {(*int)(nil), "json: Unmarshal(nil *int)"}, - {new(net.IP), "json: cannot unmarshal string into Go value of type *net.IP"}, -} - -func TestInvalidUnmarshalText(t *testing.T) { - buf := []byte(`123`) - for _, tt := range invalidUnmarshalTextTests { - err := Unmarshal(buf, tt.v) - if err == nil { - t.Errorf("Unmarshal expecting error, got nil") - continue - } - if got := err.Error(); got != tt.want { - t.Errorf("Unmarshal = %q; want %q", got, tt.want) - } - } -} - -// Test that string option is ignored for invalid types. -// Issue 9812. -func TestInvalidStringOption(t *testing.T) { - num := 0 - item := struct { - T time.Time `json:",string"` - M map[string]string `json:",string"` - S []string `json:",string"` - A [1]string `json:",string"` - I interface{} `json:",string"` - P *int `json:",string"` - }{M: make(map[string]string), S: make([]string, 0), I: num, P: &num} - - data, err := Marshal(item) - if err != nil { - t.Fatalf("Marshal: %v", err) - } - - err = Unmarshal(data, &item) - if err != nil { - t.Fatalf("Unmarshal: %v", err) - } -} diff --git a/llgo/third_party/gofrontend/libgo/go/encoding/json/encode.go b/llgo/third_party/gofrontend/libgo/go/encoding/json/encode.go deleted file mode 100644 index e829a930768ba1e00793fdda131fed156834cdfc..0000000000000000000000000000000000000000 --- a/llgo/third_party/gofrontend/libgo/go/encoding/json/encode.go +++ /dev/null @@ -1,1194 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package json implements encoding and decoding of JSON objects as defined in -// RFC 4627. The mapping between JSON objects and Go values is described -// in the documentation for the Marshal and Unmarshal functions. -// -// See "JSON and Go" for an introduction to this package: -// https://golang.org/doc/articles/json_and_go.html -package json - -import ( - "bytes" - "encoding" - "encoding/base64" - "math" - "reflect" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "unicode" - "unicode/utf8" -) - -// Marshal returns the JSON encoding of v. -// -// Marshal traverses the value v recursively. -// If an encountered value implements the Marshaler interface -// and is not a nil pointer, Marshal calls its MarshalJSON method -// to produce JSON. The nil pointer exception is not strictly necessary -// but mimics a similar, necessary exception in the behavior of -// UnmarshalJSON. -// -// Otherwise, Marshal uses the following type-dependent default encodings: -// -// Boolean values encode as JSON booleans. -// -// Floating point, integer, and Number values encode as JSON numbers. -// -// String values encode as JSON strings coerced to valid UTF-8, -// replacing invalid bytes with the Unicode replacement rune. -// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" -// to keep some browsers from misinterpreting JSON output as HTML. -// Ampersand "&" is also escaped to "\u0026" for the same reason. -// -// Array and slice values encode as JSON arrays, except that -// []byte encodes as a base64-encoded string, and a nil slice -// encodes as the null JSON object. -// -// Struct values encode as JSON objects. Each exported struct field -// becomes a member of the object unless -// - the field's tag is "-", or -// - the field is empty and its tag specifies the "omitempty" option. -// The empty values are false, 0, any -// nil pointer or interface value, and any array, slice, map, or string of -// length zero. The object's default key string is the struct field name -// but can be specified in the struct field's tag value. The "json" key in -// the struct field's tag value is the key name, followed by an optional comma -// and options. Examples: -// -// // Field is ignored by this package. -// Field int `json:"-"` -// -// // Field appears in JSON as key "myName". -// Field int `json:"myName"` -// -// // Field appears in JSON as key "myName" and -// // the field is omitted from the object if its value is empty, -// // as defined above. -// Field int `json:"myName,omitempty"` -// -// // Field appears in JSON as key "Field" (the default), but -// // the field is skipped if empty. -// // Note the leading comma. -// Field int `json:",omitempty"` -// -// The "string" option signals that a field is stored as JSON inside a -// JSON-encoded string. It applies only to fields of string, floating point, -// integer, or boolean types. This extra level of encoding is sometimes used -// when communicating with JavaScript programs: -// -// Int64String int64 `json:",string"` -// -// The key name will be used if it's a non-empty string consisting of -// only Unicode letters, digits, dollar signs, percent signs, hyphens, -// underscores and slashes. -// -// Anonymous struct fields are usually marshaled as if their inner exported fields -// were fields in the outer struct, subject to the usual Go visibility rules amended -// as described in the next paragraph. -// An anonymous struct field with a name given in its JSON tag is treated as -// having that name, rather than being anonymous. -// An anonymous struct field of interface type is treated the same as having -// that type as its name, rather than being anonymous. -// -// The Go visibility rules for struct fields are amended for JSON when -// deciding which field to marshal or unmarshal. If there are -// multiple fields at the same level, and that level is the least -// nested (and would therefore be the nesting level selected by the -// usual Go rules), the following extra rules apply: -// -// 1) Of those fields, if any are JSON-tagged, only tagged fields are considered, -// even if there are multiple untagged fields that would otherwise conflict. -// 2) If there is exactly one field (tagged or not according to the first rule), that is selected. -// 3) Otherwise there are multiple fields, and all are ignored; no error occurs. -// -// Handling of anonymous struct fields is new in Go 1.1. -// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of -// an anonymous struct field in both current and earlier versions, give the field -// a JSON tag of "-". -// -// Map values encode as JSON objects. -// The map's key type must be string; the map keys are used as JSON object -// keys, subject to the UTF-8 coercion described for string values above. -// -// Pointer values encode as the value pointed to. -// A nil pointer encodes as the null JSON object. -// -// Interface values encode as the value contained in the interface. -// A nil interface value encodes as the null JSON object. -// -// Channel, complex, and function values cannot be encoded in JSON. -// Attempting to encode such a value causes Marshal to return -// an UnsupportedTypeError. -// -// JSON cannot represent cyclic data structures and Marshal does not -// handle them. Passing cyclic structures to Marshal will result in -// an infinite recursion. -// -func Marshal(v interface{}) ([]byte, error) { - e := &encodeState{} - err := e.marshal(v) - if err != nil { - return nil, err - } - return e.Bytes(), nil -} - -// MarshalIndent is like Marshal but applies Indent to format the output. -func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { - b, err := Marshal(v) - if err != nil { - return nil, err - } - var buf bytes.Buffer - err = Indent(&buf, b, prefix, indent) - if err != nil { - return nil, err - } - return buf.Bytes(), nil -} - -// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029 -// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029 -// so that the JSON will be safe to embed inside HTML `, - []string{ - `"\u003cb\u003e \"foo%\" O'Reilly \u0026bar;"`, - `"a[href =~ \"//example.com\"]#foo"`, - `"Hello, \u003cb\u003eWorld\u003c/b\u003e \u0026amp;tc!"`, - `" dir=\"ltr\""`, - // Not escaped. - `c && alert("Hello, World!");`, - // Escape sequence not over-escaped. - `"Hello, World & O'Reilly\x21"`, - `"greeting=H%69\u0026addressee=(World)"`, - }, - }, - { - `