external/nss/0001-Bug-1983399-lib-softtoken-sdb.c-sftkdbti.h-Align-sft.patch.1 
|   77 ++++++++++
 external/nss/UnpackedTarball_nss.mk                                            
|    1 
 2 files changed, 78 insertions(+)

New commits:
commit 9653afbbe9ed5b124b2fc3186577c3788f664692
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Aug 26 13:34:18 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 26 16:25:00 2025 +0200

    nss: fix aarch64 build
    
    dbtool.obj : error LNK2048: relocation PAGEOFFSET_12L targeting 
'sftkdb_known_attributes_size' (00007F3C) is invalid for the instruction 
(F9400108 at RVA 000017B8) at section 0xD offset 0x48, due to bad alignment of 
offset to target (F3C); expected to be 8 bytes aligned
    dbtool.obj : error LNK2048: relocation PAGEOFFSET_12L targeting 
'sftkdb_known_attributes_size' (00007F3C) is invalid for the instruction 
(F9400108 at RVA 00001B20) at section 0xD offset 0x3B0, due to bad alignment of 
offset to target (F3C); expected to be 8 bytes aligned
    
    Change-Id: I7c5331d4976073a7a84575fec5f66db0f12d54cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190219
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git 
a/external/nss/0001-Bug-1983399-lib-softtoken-sdb.c-sftkdbti.h-Align-sft.patch.1
 
b/external/nss/0001-Bug-1983399-lib-softtoken-sdb.c-sftkdbti.h-Align-sft.patch.1
new file mode 100644
index 000000000000..8a1fa9c5cfb7
--- /dev/null
+++ 
b/external/nss/0001-Bug-1983399-lib-softtoken-sdb.c-sftkdbti.h-Align-sft.patch.1
@@ -0,0 +1,77 @@
+From 41b30bd6ee62ed0b8420c45e71ea9f1e6e46cc67 Mon Sep 17 00:00:00 2001
+From: Robert Relyea <rrel...@redhat.com>
+Date: Tue, 19 Aug 2025 17:35:17 -0700
+Subject: [PATCH] Bug 1983399 lib/softtoken/{sdb.c,sftkdbti.h}: Align
+ sftkdb_known_attributes_size type r=rrelyea patch by nvinson234
+
+sftkdb_known_attributes_size is defined with conflicting types. In 
/lib/softtoken/sdb.c it is defined as a 'const size_t'; whereas in 
lib/softtoken/sftkdbti.h it is defined as an 'unsigned int'. The correct type 
for sftkdb_known_attributes_size is size_t since its value is derived from the 
size of the sftkdb_known_attributes array.
+
+Differential Revision: https://phabricator.services.mozilla.com/D261440
+
+--HG--
+extra : rebase_source : e234b04d1754b26d2b4e8b79978bd8403d85fa5e
+---
+ lib/softoken/sdb.c      | 12 ++++++------
+ lib/softoken/sftkdbti.h |  2 +-
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/lib/softoken/sdb.c b/lib/softoken/sdb.c
+index 8b5ce70e3..28480ee2a 100644
+--- nss/nss/lib/softoken/sdb.c
++++ nss/nss/lib/softoken/sdb.c
+@@ -158,7 +158,7 @@ const CK_ATTRIBUTE_TYPE sftkdb_known_attributes[] = {
+ };
+ // clang-format on
+ 
+-const int sftkdb_known_attributes_size = 
PR_ARRAY_SIZE(sftkdb_known_attributes);
++const size_t sftkdb_known_attributes_size = 
PR_ARRAY_SIZE(sftkdb_known_attributes);
+ 
+ /*
+  * Note on use of sqlReadDB: Only one thread at a time may have an actual
+@@ -2024,8 +2024,8 @@ sdb_update_column(sqlite3 *sqlDB, const char *table, 
sdbDataType type)
+     }
+     /* we have more attributes than in the database, so we know things
+      * are missing, find what was missing */
+-    for (int i = 0; i < sftkdb_known_attributes_size; i++) {
+-        char *typeString = sqlite3_mprintf("a%x", sftkdb_known_attributes[i]);
++    for (size_t i = 0; i < sftkdb_known_attributes_size; i++) {
++        char *typeString = sqlite3_mprintf("a%lx", 
sftkdb_known_attributes[i]);
+         PRBool found = PR_FALSE;
+         /* this one index is important, we skip the first column (id), since
+          * it will never match, starting at zero isn't a bug,
+@@ -2072,7 +2072,6 @@ CK_RV
+ sdb_init(char *dbname, char *table, sdbDataType type, int *inUpdate,
+          int *newInit, int inFlags, PRUint32 accessOps, SDB **pSdb)
+ {
+-    int i;
+     char *initStr = NULL;
+     char *newStr;
+     char *queryStr = NULL;
+@@ -2136,8 +2135,9 @@ sdb_init(char *dbname, char *table, sdbDataType type, 
int *inUpdate,
+             goto loser;
+         }
+         initStr = sqlite3_mprintf("");
+-        for (i = 0; initStr && i < sftkdb_known_attributes_size; i++) {
+-            newStr = sqlite3_mprintf("%s, a%x", initStr, 
sftkdb_known_attributes[i]);
++        for (size_t i = 0; initStr && i < sftkdb_known_attributes_size; i++) {
++            newStr = sqlite3_mprintf("%s, a%lx", initStr,
++                                     sftkdb_known_attributes[i]);
+             sqlite3_free(initStr);
+             initStr = newStr;
+         }
+diff --git a/lib/softoken/sftkdbti.h b/lib/softoken/sftkdbti.h
+index c08334919..7dfbdabf1 100644
+--- nss/nss/lib/softoken/sftkdbti.h
++++ nss/nss/lib/softoken/sftkdbti.h
+@@ -27,7 +27,7 @@ struct SFTKDBHandleStr {
+ };
+ 
+ extern const CK_ATTRIBUTE_TYPE sftkdb_known_attributes[];
+-extern unsigned int sftkdb_known_attributes_size;
++extern size_t sftkdb_known_attributes_size;
+ 
+ #define SFTK_KEYDB_TYPE 0x40000000
+ #define SFTK_CERTDB_TYPE 0x00000000
+-- 
+2.39.5
+
diff --git a/external/nss/UnpackedTarball_nss.mk 
b/external/nss/UnpackedTarball_nss.mk
index a33a293f972d..de632ca24a05 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
         external/nss/nss.windows.patch \
         external/nss/nss.nowerror.patch \
         external/nss/nss.utf8bom.patch.1) \
+    
external/nss/0001-Bug-1983399-lib-softtoken-sdb.c-sftkdbti.h-Align-sft.patch.1 \
 ))
 
 ifeq ($(COM_IS_CLANG),TRUE)

Reply via email to