build: Make bitmap object files position independent to silence linker warnings

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sat, 2 May 2026 13:25:20 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 0dc670d25cb6a4a7283c007f7bf96a73fbc18da0
Author: Solomon Peachy <[email protected]>
Date:   Sat May 2 13:22:51 2026 -0400

    build:  Make bitmap object files position independent to silence linker warnings
    
    Finally addresses the "warning: creating DT_TEXTREL in a shared object" warnings
    seen when linking plugins that reference bitmaps.
    
    This currently only happens with simulator builds using recent-ish
    toolchains (GCC >= 12 IIRC).  However, binutils 2.46 promotes this
    warning to an error, so it's finally tracked down and addressed.
    
    Change-Id: I4b4926c14f7c0047496892c55009c26da2a4756d

diff --git a/apps/bitmaps/bitmaps.make b/apps/bitmaps/bitmaps.make
index d39531a8b8..cf166f3f8c 100644
--- a/apps/bitmaps/bitmaps.make
+++ b/apps/bitmaps/bitmaps.make
@@ -50,3 +50,11 @@ $(BUILDDIR)/apps/bitmaps/remote_mono/%.c: $(ROOTDIR)/apps/bitmaps/remote_mono/%.
 $(BUILDDIR)/apps/bitmaps/remote_native/%.c: $(ROOTDIR)/apps/bitmaps/remote_native/%.bmp $(TOOLSDIR)/bmp2rb
 	$(SILENT)mkdir -p $(dir $@) $(BMPINCDIR)
 	$(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTENATIVE) -b -h $(BMPINCDIR) $< > $@
+
+ifdef APP_TYPE
+# Bitmaps must be explicitly Position independent to avoid linker warnings
+$(BUILDDIR)/apps/bitmaps/native/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/bitmaps/mono/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/bitmaps/remote_mono/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/bitmaps/remote_native/%.o: CFLAGS += -fPIC
+endif
diff --git a/apps/plugins/bitmaps/pluginbitmaps.make b/apps/plugins/bitmaps/pluginbitmaps.make
index 78294a5e8c..caf7d23535 100644
--- a/apps/plugins/bitmaps/pluginbitmaps.make
+++ b/apps/plugins/bitmaps/pluginbitmaps.make
@@ -58,4 +58,12 @@ $(BUILDDIR)/apps/plugins/bitmaps/remote_native/%.c: $(ROOTDIR)/apps/plugins/bitm
 	$(SILENT)mkdir -p $(dir $@) $(PBMPINCDIR)
 	$(call PRINTS,BMP2RB $(<F))$(BMP2RB_REMOTENATIVE) -b -h $(PBMPINCDIR) $< > $@
 
+ifdef APP_TYPE
+# Bitmaps must be explicitly Position independent to avoid linker warnings
+$(BUILDDIR)/apps/plugins/bitmaps/native/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/plugins/bitmaps/mono/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/plugins/bitmaps/remote_mono/%.o: CFLAGS += -fPIC
+$(BUILDDIR)/apps/plugins/bitmaps/remote_native/%.o: CFLAGS += -fPIC
+endif
+
 endif
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs