8
0
Files
nodejs-electron/swiftshader-Half-Wstrict-aliasing.patch
Bruno Pitrus d43d7ad921 Accepting request 1031228 from home:dziobian:gulgul-ultron:19
- Enable LTO on x64 (Tumbleweed and Fedora only) now that it works correctly.
  * add seccomp_pbf-no-lto.patch
- Do not build some chromium features unused in Electron.
- Remove upstream's tinkering with optimization flags.
  * change chromium-102-compiler.patch
- Remove upstream's warning suppression
  * change chromium-102-compiler.patch
  * add -Wno-class-memaccess due to log spam
  * add -Wno-error=narrowing due to non-compliant generated code
- Add -DIS_SERIAL_ENABLED_PLATFORM to work around upstream C++ ODR error.
- Build main binary as PIE instead of PIC.
  * change chromium-102-compiler.patch
  * add fpic.patch
- Compile with gcc11 (was 10) on Leap now that it's available.
- Add backported patches
  * compact_enc_det_generated_tables-Wnarrowing.patch
  * half_float-Wstrict-aliasing.patch
  * ipcz-buffer_id-Wnarrowing.patch
  * select_file_dialog_linux_kde-Wodr.patch
  * string_hasher-type-pun-UB-causes-heap-corruption.patch
  * unzip-Wsubobject-linkage.patch
  * web_contents_impl-Wsubobject-linkage.patch
- Add patches to fix C++ bugs and submit them upstream
  * swiftshader-Constants-Wstrict-aliasing.patch
  * swiftshader-Half-Wstrict-aliasing.patch
  * v8_initializer-PageAllocator-fpermissive.patch

OBS-URL: https://build.opensuse.org/request/show/1031228
OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs-electron?expand=0&rev=42
2022-10-26 04:51:48 +00:00

79 lines
2.1 KiB
Diff

--- src/third_party/swiftshader/src/System/Half.hpp.orig 2022-10-12 18:07:57.859149000 +0200
+++ src/third_party/swiftshader/src/System/Half.hpp 2022-10-19 21:30:33.133940800 +0200
@@ -19,6 +19,7 @@
#include <algorithm>
#include <cmath>
+#include <cstring>
namespace sw {
@@ -194,7 +195,8 @@
const unsigned int float32MinNormfloat11 = 0x38800000;
const unsigned int float32MinDenormfloat11 = 0x35000080;
- const unsigned int float32Bits = *reinterpret_cast<unsigned int *>(&fp32);
+ unsigned int float32Bits;
+ std::memcpy(&float32Bits, &fp32, 4);
const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
unsigned int float32Val = float32Bits & float32ValueMask;
@@ -273,7 +275,8 @@
const unsigned int float32MinNormfloat10 = 0x38800000;
const unsigned int float32MinDenormfloat10 = 0x35800040;
- const unsigned int float32Bits = *reinterpret_cast<unsigned int *>(&fp32);
+ unsigned int float32Bits;
+ std::memcpy(&float32Bits, &fp32, 4);
const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask;
unsigned int float32Val = float32Bits & float32ValueMask;
--- src/third_party/swiftshader/src/System/Half.cpp.orig 2022-10-12 18:07:57.859149000 +0200
+++ src/third_party/swiftshader/src/System/Half.cpp 2022-10-19 22:47:18.573634800 +0200
@@ -14,11 +14,14 @@
#include "Half.hpp"
+#include <cstring>
+
namespace sw {
half::half(float fp32)
{
- unsigned int fp32i = *(unsigned int *)&fp32;
+ unsigned int fp32i;
+ std::memcpy(&fp32i, &fp32, 4);
unsigned int sign = (fp32i & 0x80000000) >> 16;
unsigned int abs = fp32i & 0x7FFFFFFF;
@@ -51,7 +54,7 @@
half::operator float() const
{
unsigned int fp32i;
-
+ float ret;
int s = (fp16i >> 15) & 0x00000001;
int e = (fp16i >> 10) & 0x0000001F;
int m = fp16i & 0x000003FF;
@@ -61,8 +64,8 @@
if(m == 0)
{
fp32i = s << 31;
-
- return (float &)fp32i;
+ std::memcpy(&ret, &fp32i, 4);
+ return ret;
}
else
{
@@ -82,7 +85,8 @@
fp32i = (s << 31) | (e << 23) | m;
- return (float &)fp32i;
+ std::memcpy(&ret, &fp32i, 4);
+ return ret;
}
half &half::operator=(float f)