Source: firefox
Version: 146.0-1
Severity: normal
Tags: patch
User: [email protected]
Usertags: loong64

Dear maintainers,

Compiling the firefox failed for loong64 in the Debian Package Auto-Building environment.
The error log is as follows,
```
/usr/bin/clang -o Unified_c_modules_brotli0.o -c -I/<<PKGBUILDDIR>>/build-browser/dist/system_wrappers -include /<<PKGBUILDDIR>>/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstrict-flex-arrays=1 -DNDEBUG=1 -DTRIMMED=1 -I/<<PKGBUILDDIR>>/modules/brotli -I/<<PKGBUILDDIR>>/build-browser/modules/brotli -I/<<PKGBUILDDIR>>/build-browser/dist/include -I/usr/include/nspr -I/usr/include/nss -I/usr/include/nspr -I/<<PKGBUILDDIR>>/build-browser/dist/include/nss -DMOZILLA_CLIENT -include /<<PKGBUILDDIR>>/build-browser/mozilla-config.h -Wdate-time -D_FORTIFY_SOURCE=2 -pthread -ffunction-sections -fdata-sections -fno-math-errno -fPIC -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -gdwarf-4 -O2 -fomit-frame-pointer -funwind-tables -Wall -Wbitfield-enum-conversion -Wempty-body -Wformat-type-confusion -Wignored-qualifiers -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtautological-constant-in-range-compare -Wtype-limits -Wno-error=tautological-type-limit-compare -Wunreachable-code -Wunreachable-code-return -Wunused-but-set-parameter -Wclass-varargs -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wno-range-loop-analysis -Wenum-compare-conditional -Wenum-float-conversion -Winvalid-utf8 -Wstring-conversion -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=free-nonheap-object -Wno-error=atomic-alignment -Wno-error=deprecated-builtins -Wformat -Wformat-security -Werror=implicit-function-declaration -Wno-psabi -Wthread-safety -Wno-error=builtin-macro-redefined -Wno-unknown-warning-option -Wno-character-conversion -DBROTLI_BUILD_PORTABLE -fno-strict-aliasing -ffp-contract=off -MD -MP -MF .deps/Unified_c_modules_brotli0.o.pp Unified_c_modules_brotli0.c
In file included from Unified_c_modules_brotli0.c:2:
In file included from /<<PKGBUILDDIR>>/modules/brotli/common/constants.c:7:
/<<PKGBUILDDIR>>/modules/brotli/common/constants.h:195:45: error: code model 'small' is not supported on this target
  195 | BROTLI_COMMON_API extern const BROTLI_MODEL("small")
      |                                             ^
In file included from Unified_c_modules_brotli0.c:2:
/<<PKGBUILDDIR>>/modules/brotli/common/constants.c:9:20: error: code model 'small' is not supported on this target
    9 | const BROTLI_MODEL("small")
      |                    ^
In file included from Unified_c_modules_brotli0.c:11:
/<<PKGBUILDDIR>>/modules/brotli/common/context.c:6:20: error: code model 'small' is not supported on this target     6 | const BROTLI_MODEL("small") uint8_t _kBrotliContextLookupTable[2048] = {
      |                    ^
In file included from Unified_c_modules_brotli0.c:20:
In file included from /<<PKGBUILDDIR>>/modules/brotli/common/dictionary.c:16:
```

The main error is "code model 'small' is not supported on loong64".
After analysis, we found that above error has been fixed in google/brotli upstream. The link is https://github.com/google/brotli/commit/e230f474b87134e8c6c85b630084c612057f253e.
Please cherry-pick this upstream patch to Debian firefox.
Patch attached.

Best regards,
Dandan Zhang

Description: disable BROTLI_MODEL macro for loong64
 .
 firefox (146.0-1+loong64) unstable; urgency=medium
 .
    * Cherry-pick upstream patch to fix build error on loong64.
Author: Dandan Zhang <[email protected]>

---
Applied-Upstream: https://github.com/google/brotli/commit/e230f474b87134e8c6c85b630084c612057f253e
Last-Update: 2025-12-18

--- firefox-146.0.orig/modules/brotli/common/platform.h
+++ firefox-146.0/modules/brotli/common/platform.h
@@ -665,7 +665,8 @@ BROTLI_UNUSED_FUNCTION void BrotliSuppre
 #undef BROTLI_TEST
 #endif
 
-#if BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3)
+#if !defined(BROTLI_MODEL) && BROTLI_GNUC_HAS_ATTRIBUTE(model, 3, 0, 3) && \
+    !defined(BROTLI_TARGET_LOONGARCH64)
 #define BROTLI_MODEL(M) __attribute__((model(M)))
 #else
 #define BROTLI_MODEL(M) /* M */

Reply via email to