logo

etc_portage

Unnamed repository; edit this file 'description' to name the repository. git clone https://hacktivis.me/git/etc_portage.git

0001-Fixes-for-musl.patch (7232B)


  1. From f9b0ff92a9c173e2b73f2cb897153b31e46e0276 Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Tue, 28 Jan 2020 18:34:42 +0100
  4. Subject: [PATCH 01/15] Fixes for musl
  5. Grabbed from CarbsLinux
  6. Original upstream: Alpine Linux
  7. Source: @q66, @pullmoll
  8. Original upstream: Alpine Linux
  9. Reason: fixing machine context access for musl libc; reduce stack/heap usage for jsc; fix some overly restrictive __GLIBC__ checks
  10. Updated for latest webkit2gtk.
  11. ---
  12. Source/JavaScriptCore/runtime/MachineContext.h | 10 +++++-----
  13. Source/JavaScriptCore/runtime/Options.h | 16 +++++++++++++---
  14. .../compiler/preprocessor/ExpressionParser.cpp | 4 ++--
  15. Source/WTF/wtf/Platform.h | 2 +-
  16. Source/WebCore/xml/XPathGrammar.cpp | 4 ++--
  17. 5 files changed, 23 insertions(+), 13 deletions(-)
  18. diff --git a/Source/JavaScriptCore/runtime/MachineContext.h b/Source/JavaScriptCore/runtime/MachineContext.h
  19. index 823964c2..e8062952 100644
  20. --- a/Source/JavaScriptCore/runtime/MachineContext.h
  21. +++ b/Source/JavaScriptCore/runtime/MachineContext.h
  22. @@ -188,7 +188,7 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
  23. #error Unknown Architecture
  24. #endif
  25. -#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
  26. +#elif OS(FUCHSIA) || defined(__linux__)
  27. #if CPU(X86)
  28. return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
  29. @@ -335,7 +335,7 @@ static inline void*& framePointerImpl(mcontext_t& machineContext)
  30. #error Unknown Architecture
  31. #endif
  32. -#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
  33. +#elif OS(FUCHSIA) || defined(__linux__)
  34. // The following sequence depends on glibc's sys/ucontext.h.
  35. #if CPU(X86)
  36. @@ -482,7 +482,7 @@ static inline void*& instructionPointerImpl(mcontext_t& machineContext)
  37. #error Unknown Architecture
  38. #endif
  39. -#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
  40. +#elif OS(FUCHSIA) || defined(__linux__)
  41. // The following sequence depends on glibc's sys/ucontext.h.
  42. #if CPU(X86)
  43. @@ -639,7 +639,7 @@ inline void*& argumentPointer<1>(mcontext_t& machineContext)
  44. #error Unknown Architecture
  45. #endif
  46. -#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
  47. +#elif OS(FUCHSIA) || defined(__linux__)
  48. // The following sequence depends on glibc's sys/ucontext.h.
  49. #if CPU(X86)
  50. @@ -756,7 +756,7 @@ inline void*& llintInstructionPointer(mcontext_t& machineContext)
  51. #error Unknown Architecture
  52. #endif
  53. -#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
  54. +#elif OS(FUCHSIA) || defined(__linux__)
  55. // The following sequence depends on glibc's sys/ucontext.h.
  56. #if CPU(X86)
  57. diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h
  58. index 44fbc30c..271e0652 100644
  59. --- a/Source/JavaScriptCore/runtime/Options.h
  60. +++ b/Source/JavaScriptCore/runtime/Options.h
  61. @@ -112,6 +112,16 @@ constexpr bool enableWebAssemblyStreamingApi = true;
  62. constexpr bool enableWebAssemblyStreamingApi = false;
  63. #endif
  64. +#if defined(__GLIBC__)
  65. +constexpr unsigned jscMaxPerThreadStack = 4 * MB;
  66. +constexpr unsigned jscSoftReservedZoneSize = 128 * KB;
  67. +constexpr unsigned jscReservedZoneSize = 64 * KB;
  68. +#else
  69. +constexpr unsigned jscMaxPerThreadStack = 80 * KB;
  70. +constexpr unsigned jscSoftReservedZoneSize = 32 * KB;
  71. +constexpr unsigned jscReservedZoneSize = 16 * KB;
  72. +#endif
  73. +
  74. #define JSC_OPTIONS(v) \
  75. v(bool, useKernTCSM, true, Normal, "Note: this needs to go before other options since they depend on this value.") \
  76. v(bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \
  77. @@ -127,9 +137,9 @@ constexpr bool enableWebAssemblyStreamingApi = false;
  78. \
  79. v(bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
  80. \
  81. - v(unsigned, maxPerThreadStackUsage, 4 * MB, Normal, "Max allowed stack usage by the VM") \
  82. - v(unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
  83. - v(unsigned, reservedZoneSize, 64 * KB, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
  84. + v(unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \
  85. + v(unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
  86. + v(unsigned, reservedZoneSize, jscReservedZoneSize, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
  87. \
  88. v(bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
  89. v(unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
  90. diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
  91. index 5da6a22d..b380fb71 100644
  92. --- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
  93. +++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
  94. @@ -728,7 +728,7 @@ int yydebug;
  95. #if YYERROR_VERBOSE
  96. # ifndef yystrlen
  97. -# if defined __GLIBC__ && defined _STRING_H
  98. +# if defined __linux__ && defined _STRING_H
  99. # define yystrlen strlen
  100. # else
  101. /* Return the length of YYSTR. */
  102. @@ -743,7 +743,7 @@ static YYSIZE_T yystrlen(const char *yystr)
  103. # endif
  104. # ifndef yystpcpy
  105. -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  106. +# if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
  107. # define yystpcpy stpcpy
  108. # else
  109. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  110. diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
  111. index 0e6faaa8..f8c6d684 100644
  112. --- a/Source/WTF/wtf/Platform.h
  113. +++ b/Source/WTF/wtf/Platform.h
  114. @@ -707,7 +707,7 @@
  115. #endif /* OS(DARWIN) */
  116. -#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || defined(__GLIBC__) || defined(__BIONIC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
  117. +#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || defined(__linux__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
  118. #define HAVE_MACHINE_CONTEXT 1
  119. #endif
  120. diff --git a/Source/WebCore/xml/XPathGrammar.cpp b/Source/WebCore/xml/XPathGrammar.cpp
  121. index 5e069d79..c58413c8 100644
  122. --- a/Source/WebCore/xml/XPathGrammar.cpp
  123. +++ b/Source/WebCore/xml/XPathGrammar.cpp
  124. @@ -966,7 +966,7 @@ int yydebug;
  125. #if YYERROR_VERBOSE
  126. # ifndef yystrlen
  127. -# if defined __GLIBC__ && defined _STRING_H
  128. +# if defined __linux__ && defined _STRING_H
  129. # define yystrlen strlen
  130. # else
  131. /* Return the length of YYSTR. */
  132. @@ -989,7 +989,7 @@ yystrlen (yystr)
  133. # endif
  134. # ifndef yystpcpy
  135. -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
  136. +# if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
  137. # define yystpcpy stpcpy
  138. # else
  139. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  140. --
  141. 2.24.1