electron/patches/nan/nan_string_test_alignment.patch
Keeley Hammond d03325541f
test: rebuild nan tests with libc++ and libc++abi (#29281)
* test: re-enable nan test: typedarrays-test.js

Fixes #28414.

I've confirmed this fix wfm on Linux. Pushing into a PR to get CI to run
it out on Win and Mac platforms too.

* chore: clarify comment

* test: fix NAN test string alignment

* test: (wip) add ldflags, archive file for libc++

* test: (wip) add libc++ to CircleCI

* test: (wip) add llvm flags

* test: (wip) change ldflag syntax

* test: (wip) build libc++abi as static

* fix: correct ldflags

* test: add ld env

* fix: do not commit this

* test: add lld from src to circleci

* test: add lld link to ld

* chore: preserve third_party

* seems legit

* sam swears this works kinda sort of sometimes'
:

* build: add gn visibility patch

* chore: update patches

* build: check for flatten_relative_to = false

* build: upload zip files, add to release.js validation

* debug: what the hell gn

* build: add libcxx gni to lint ignore

Linting the file adjusted the licenses array, which only contains
one value, and causes the gn check to fail later

* build: also use nan-spec-runner flags on Windows

* build: add linked flags for win32 only

* build: build libc++ as source on win

* build: clean up patch, add -fPIC for IA32

* build: delete libcxx .a files from root

* build: rename libc++.zip, clean up upload per platform

* build: fix gni lint

* ci: add libcxx gen to circleci config

* build: correct libcxx-object syntax

Co-authored-by: Samuel Attard <sam@electronjs.org>

Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: clavin <clavin@electronjs.org>
Co-authored-by: Samuel Attard <sattard@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
2021-05-22 11:48:38 -07:00

22 lines
902 B
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: clavin <clavin@electronjs.org>
Date: Wed, 12 May 2021 12:43:07 -0600
Subject: nan_string_test_alignment
Modifies a NAN test to avoid a debug check pertaining to efficient string alignment.
diff --git a/test/cpp/strings.cpp b/test/cpp/strings.cpp
index 95edeac91a4ec6a5f5cd80aa36dca8a55eb53f2a..0ad5cb7095490ac1eb454318582a9a683cb14be1 100644
--- a/test/cpp/strings.cpp
+++ b/test/cpp/strings.cpp
@@ -26,7 +26,9 @@ NAN_METHOD(EncodeHex) {
}
NAN_METHOD(EncodeUCS2) {
- info.GetReturnValue().Set(Encode("h\0e\0l\0l\0o\0", 10, UCS2));
+ // This odd declaration is to get the string data aligned to a 2-byte boundary
+ const uint16_t str[] = {'h', 'e', 'l', 'l', 'o'};
+ info.GetReturnValue().Set(Encode(reinterpret_cast<const char*>(str), 10, UCS2));
}
Persistent<v8::FunctionTemplate> returnUtf8String_persistent;