From: Nolen Johnson Date: Sun, 27 Oct 2024 20:32:26 +0000 (-0400) Subject: exynos9610-common: Move libdemange shim to prebuilt X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0fdf02b4930f6911d68a350b7408f10c4c44ca33;p=GitHub%2FLineageOS%2Fandroid_device_motorola_exynos9610-common.git exynos9610-common: Move libdemange shim to prebuilt * Refuses to build in Android 15. Change-Id: I3a26cd7a6997d330cea8d33ee4f3c9ca53c3c4a5 --- diff --git a/common.mk b/common.mk index efb6181..f95ef6d 100644 --- a/common.mk +++ b/common.mk @@ -408,8 +408,7 @@ PRODUCT_COPY_FILES += \ # Shims PRODUCT_PACKAGES += \ libaudioproxy_shim \ - libmemset_shim \ - libdemangle.vendor + libmemset_shim # Shipping API $(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_p.mk) diff --git a/proprietary-files-vendor.txt b/proprietary-files-vendor.txt index 211c1e0..79ae709 100644 --- a/proprietary-files-vendor.txt +++ b/proprietary-files-vendor.txt @@ -14,6 +14,7 @@ vendor/lib64/libdapparamstorage.so ## Camera vendor/lib/libENF.so +vendor/lib/libdemangle.so|d3fc0883a09a0debbf79ddd4bba922e79cb3d9ee vendor/lib/libexynoscamera_hifi_plugin.so vendor/lib/libexynoscamera_hifills_plugin.so vendor/lib/libexynoscamera_plugin.so @@ -34,6 +35,10 @@ vendor/lib64/libhwjpeg.so vendor/lib64/libvdis.so vendor/lib64/libyuvrepro.so +# Camera - Shims - Built in lineage-21, and prebuilt here. +vendor/lib/libdemangle.so|d3fc0883a09a0debbf79ddd4bba922e79cb3d9ee +vendor/lib64/libdemangle.so|ac9a52ac9146d0eceaeaba5e0c47f0d2c14e4428 + ## Charger vendor/bin/charge_only_mode|aa277db47fd537f95ca5bf15c5f1b95d4b893258|4ba1390cb8ff9257879be773b96e568e0c7e0421 diff --git a/shims/libdemangle/Android.bp b/shims/libdemangle/Android.bp deleted file mode 100644 index 0d608bf..0000000 --- a/shims/libdemangle/Android.bp +++ /dev/null @@ -1,24 +0,0 @@ -cc_library { - name: "libdemangle", - vendor_available: true, - include_dirs: [ - "external/libcxx/include", - "external/libcxxabi/include", - "external/libcxxabi/src", - ], - cflags: [ - "-Wall", - "-Werror", - ], - cppflags: [ - "-std=c++14", - "-fexceptions", - "-Wextra", - "-Wno-unused-function", - "-Wno-implicit-fallthrough", - // src/cxa_demangle.cpp:2591 -Wimplicit-fallthrough - ], - srcs: [ - "cxa_demangle.cpp" - ], -} diff --git a/shims/libdemangle/cxa_demangle.cpp b/shims/libdemangle/cxa_demangle.cpp deleted file mode 100644 index f227add..0000000 --- a/shims/libdemangle/cxa_demangle.cpp +++ /dev/null @@ -1,370 +0,0 @@ -//===-------------------------- cxa_demangle.cpp --------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// FIXME: (possibly) incomplete list of features that clang mangles that this -// file does not yet support: -// - C++ modules TS - -#define _LIBCPP_NO_EXCEPTIONS - -#include "__cxxabi_config.h" - -#include "demangle/ItaniumDemangle.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace itanium_demangle; - -constexpr const char *itanium_demangle::FloatData::spec; -constexpr const char *itanium_demangle::FloatData::spec; -constexpr const char *itanium_demangle::FloatData::spec; - -// := _ # when number < 10 -// := __ _ # when number >= 10 -// extension := decimal-digit+ # at the end of string -const char *itanium_demangle::parse_discriminator(const char *first, - const char *last) { - // parse but ignore discriminator - if (first != last) { - if (*first == '_') { - const char *t1 = first + 1; - if (t1 != last) { - if (std::isdigit(*t1)) - first = t1 + 1; - else if (*t1 == '_') { - for (++t1; t1 != last && std::isdigit(*t1); ++t1) - ; - if (t1 != last && *t1 == '_') - first = t1 + 1; - } - } - } else if (std::isdigit(*first)) { - const char *t1 = first + 1; - for (; t1 != last && std::isdigit(*t1); ++t1) - ; - if (t1 == last) - first = last; - } - } - return first; -} - -#ifndef NDEBUG -namespace { -struct DumpVisitor { - unsigned Depth = 0; - bool PendingNewline = false; - - template static constexpr bool wantsNewline(const NodeT *) { - return true; - } - static bool wantsNewline(NodeArray A) { return !A.empty(); } - static constexpr bool wantsNewline(...) { return false; } - - template static bool anyWantNewline(Ts ...Vs) { - for (bool B : {wantsNewline(Vs)...}) - if (B) - return true; - return false; - } - - void printStr(const char *S) { fprintf(stderr, "%s", S); } - void print(StringView SV) { - fprintf(stderr, "\"%.*s\"", (int)SV.size(), SV.begin()); - } - void print(const Node *N) { - if (N) - N->visit(std::ref(*this)); - else - printStr(""); - } - void print(NodeOrString NS) { - if (NS.isNode()) - print(NS.asNode()); - else if (NS.isString()) - print(NS.asString()); - else - printStr("NodeOrString()"); - } - void print(NodeArray A) { - ++Depth; - printStr("{"); - bool First = true; - for (const Node *N : A) { - if (First) - print(N); - else - printWithComma(N); - First = false; - } - printStr("}"); - --Depth; - } - - // Overload used when T is exactly 'bool', not merely convertible to 'bool'. - void print(bool B) { printStr(B ? "true" : "false"); } - - template - typename std::enable_if::value>::type print(T N) { - fprintf(stderr, "%llu", (unsigned long long)N); - } - - template - typename std::enable_if::value>::type print(T N) { - fprintf(stderr, "%lld", (long long)N); - } - - void print(ReferenceKind RK) { - switch (RK) { - case ReferenceKind::LValue: - return printStr("ReferenceKind::LValue"); - case ReferenceKind::RValue: - return printStr("ReferenceKind::RValue"); - } - } - void print(FunctionRefQual RQ) { - switch (RQ) { - case FunctionRefQual::FrefQualNone: - return printStr("FunctionRefQual::FrefQualNone"); - case FunctionRefQual::FrefQualLValue: - return printStr("FunctionRefQual::FrefQualLValue"); - case FunctionRefQual::FrefQualRValue: - return printStr("FunctionRefQual::FrefQualRValue"); - } - } - void print(Qualifiers Qs) { - if (!Qs) return printStr("QualNone"); - struct QualName { Qualifiers Q; const char *Name; } Names[] = { - {QualConst, "QualConst"}, - {QualVolatile, "QualVolatile"}, - {QualRestrict, "QualRestrict"}, - }; - for (QualName Name : Names) { - if (Qs & Name.Q) { - printStr(Name.Name); - Qs = Qualifiers(Qs & ~Name.Q); - if (Qs) printStr(" | "); - } - } - } - void print(SpecialSubKind SSK) { - switch (SSK) { - case SpecialSubKind::allocator: - return printStr("SpecialSubKind::allocator"); - case SpecialSubKind::basic_string: - return printStr("SpecialSubKind::basic_string"); - case SpecialSubKind::string: - return printStr("SpecialSubKind::string"); - case SpecialSubKind::istream: - return printStr("SpecialSubKind::istream"); - case SpecialSubKind::ostream: - return printStr("SpecialSubKind::ostream"); - case SpecialSubKind::iostream: - return printStr("SpecialSubKind::iostream"); - } - } - - void newLine() { - printStr("\n"); - for (unsigned I = 0; I != Depth; ++I) - printStr(" "); - PendingNewline = false; - } - - template void printWithPendingNewline(T V) { - print(V); - if (wantsNewline(V)) - PendingNewline = true; - } - - template void printWithComma(T V) { - if (PendingNewline || wantsNewline(V)) { - printStr(","); - newLine(); - } else { - printStr(", "); - } - - printWithPendingNewline(V); - } - - struct CtorArgPrinter { - DumpVisitor &Visitor; - - template void operator()(T V, Rest ...Vs) { - if (Visitor.anyWantNewline(V, Vs...)) - Visitor.newLine(); - Visitor.printWithPendingNewline(V); - int PrintInOrder[] = { (Visitor.printWithComma(Vs), 0)..., 0 }; - (void)PrintInOrder; - } - }; - - template void operator()(const NodeT *Node) { - Depth += 2; - fprintf(stderr, "%s(", itanium_demangle::NodeKind::name()); - Node->match(CtorArgPrinter{*this}); - fprintf(stderr, ")"); - Depth -= 2; - } - - void operator()(const ForwardTemplateReference *Node) { - Depth += 2; - fprintf(stderr, "ForwardTemplateReference("); - if (Node->Ref && !Node->Printing) { - Node->Printing = true; - CtorArgPrinter{*this}(Node->Ref); - Node->Printing = false; - } else { - CtorArgPrinter{*this}(Node->Index); - } - fprintf(stderr, ")"); - Depth -= 2; - } -}; -} - -void itanium_demangle::Node::dump() const { - DumpVisitor V; - visit(std::ref(V)); - V.newLine(); -} -#endif - -namespace { -class BumpPointerAllocator { - struct BlockMeta { - BlockMeta* Next; - size_t Current; - }; - - static constexpr size_t AllocSize = 4096; - static constexpr size_t UsableAllocSize = AllocSize - sizeof(BlockMeta); - - alignas(long double) char InitialBuffer[AllocSize]; - BlockMeta* BlockList = nullptr; - - void grow() { - char* NewMeta = static_cast(std::malloc(AllocSize)); - if (NewMeta == nullptr) - std::terminate(); - BlockList = new (NewMeta) BlockMeta{BlockList, 0}; - } - - void* allocateMassive(size_t NBytes) { - NBytes += sizeof(BlockMeta); - BlockMeta* NewMeta = reinterpret_cast(std::malloc(NBytes)); - if (NewMeta == nullptr) - std::terminate(); - BlockList->Next = new (NewMeta) BlockMeta{BlockList->Next, 0}; - return static_cast(NewMeta + 1); - } - -public: - BumpPointerAllocator() - : BlockList(new (InitialBuffer) BlockMeta{nullptr, 0}) {} - - void* allocate(size_t N) { - N = (N + 15u) & ~15u; - if (N + BlockList->Current >= UsableAllocSize) { - if (N > UsableAllocSize) - return allocateMassive(N); - grow(); - } - BlockList->Current += N; - return static_cast(reinterpret_cast(BlockList + 1) + - BlockList->Current - N); - } - - void reset() { - while (BlockList) { - BlockMeta* Tmp = BlockList; - BlockList = BlockList->Next; - if (reinterpret_cast(Tmp) != InitialBuffer) - std::free(Tmp); - } - BlockList = new (InitialBuffer) BlockMeta{nullptr, 0}; - } - - ~BumpPointerAllocator() { reset(); } -}; - -class DefaultAllocator { - BumpPointerAllocator Alloc; - -public: - void reset() { Alloc.reset(); } - - template T *makeNode(Args &&...args) { - return new (Alloc.allocate(sizeof(T))) - T(std::forward(args)...); - } - - void *allocateNodeArray(size_t sz) { - return Alloc.allocate(sizeof(Node *) * sz); - } -}; -} // unnamed namespace - -//===----------------------------------------------------------------------===// -// Code beyond this point should not be synchronized with LLVM. -//===----------------------------------------------------------------------===// - -using Demangler = itanium_demangle::ManglingParser; - -namespace { -enum : int { - demangle_invalid_args = -3, - demangle_invalid_mangled_name = -2, - demangle_memory_alloc_failure = -1, - demangle_success = 0, -}; -} - -namespace __cxxabiv1 { -extern "C" _LIBCXXABI_FUNC_VIS char * -__cxa_demangle(const char *MangledName, char *Buf, size_t *N, int *Status) { - if (MangledName == nullptr || (Buf != nullptr && N == nullptr)) { - if (Status) - *Status = demangle_invalid_args; - return nullptr; - } - - int InternalStatus = demangle_success; - Demangler Parser(MangledName, MangledName + std::strlen(MangledName)); - OutputStream S; - - Node *AST = Parser.parse(); - - if (AST == nullptr) - InternalStatus = demangle_invalid_mangled_name; - else if (!initializeOutputStream(Buf, N, S, 1024)) - InternalStatus = demangle_memory_alloc_failure; - else { - assert(Parser.ForwardTemplateRefs.empty()); - AST->print(S); - S += '\0'; - if (N != nullptr) - *N = S.getCurrentPosition(); - Buf = S.getBuffer(); - } - - if (Status) - *Status = InternalStatus; - return InternalStatus == demangle_success ? Buf : nullptr; -} -} // __cxxabiv1