Thread (9 messages) 9 messages, 4 authors, 8d ago

Re: [PATCH] lib/fonts: Avoid unncessary 64-bit math in font code

From: Helge Deller <deller@gmx.de>
Date: 2026-06-09 09:03:24
Also in: dri-devel

On 6/9/26 08:14, Thomas Zimmermann wrote:
Hi,

thanks for the fix.

Am 08.06.26 um 22:26 schrieb Helge Deller:
quoted
* Ethan Nelson-Moore [off-list ref]:
quoted
Hi, Helge and Thomas,

On Mon, Jun 8, 2026 at 12:58 PM Helge Deller [off-list ref] wrote:
quoted
On 6/8/26 13:25, Thomas Zimmermann wrote:
quoted
Why is there a 64-bit division at all?
Not sure. Might be platform specific.
Maybe, because you add two integers and divide by an integer, that the
compiler then chooses to use 64-bit integer division by 32-bit integer.
Actually, I think the real issue is that
arch/arm/boot/compressed/Makefile defines "static" to nothing when
compiling its copy of lib/fonts/font_acorn_8x8.c (via font.c), so that
the font array is available outside of the object file. I assume that
this causes various unused static inline functions in the headers it
includes (such as <linux/math.h>) to be included in the object file
because they become normal inline functions.
Does this patch fix the issue then?
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index a159120d1e42..e3f550d62857 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -157,4 +157,4 @@ $(obj)/piggy_data: $(obj)/../Image FORCE
  $(obj)/piggy.o: $(obj)/piggy_data
-CFLAGS_font.o := -Dstatic=
+CFLAGS_font.o := -DBOOTLOADER
diff --git a/lib/fonts/font_acorn_8x8.c b/lib/fonts/font_acorn_8x8.c
index 36c51016769d..3327aa6d161d 100644
--- a/lib/fonts/font_acorn_8x8.c
+++ b/lib/fonts/font_acorn_8x8.c
@@ -5,7 +5,11 @@
  #define FONTDATAMAX 2048
+#ifndef BOOTLOADER
  static const struct font_data acorndata_8x8 = {
+#else
+const struct font_data acorndata_8x8 = {
+#endif
  { 0, 0, FONTDATAMAX, 0 }, {
  /* 00 */  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
  /* 01 */  0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e, /* ^A */
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Thanks for review!
I do like this better than the other patch.
Yes, I'll drop the other patch and re-send this one properly.

Helge
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help