summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-06-29 21:04:22 +0000
committerJens Arnold <amiconn@rockbox.org>2005-06-29 21:04:22 +0000
commit305a7ce1a29b35a463a5ea79e8089b362f9810da (patch)
tree17e03cdf1fa32370cb0f592afc716bde45935939 /apps/plugins
parent84d6f9e89bf1bae7e3669e487541f91f27a86b0a (diff)
downloadrockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.tar.gz
rockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.zip
Enabled sectioned compilation for the plugin library, and linking with garbage collection for the plugins. The effect is that functions and data objects from one object file in the plugin library are included in the .elf individually, not as a whole. It makes maintaining larger plugin library packages easier, as it is no longer necessary to split the source files by function to avoid dead code to get included in the plugins.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6931 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/Makefile2
-rw-r--r--apps/plugins/lib/Makefile5
-rw-r--r--apps/plugins/plugin.lds17
3 files changed, 16 insertions, 8 deletions
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile
index a59e33f5c6..1f1c309bd2 100644
--- a/apps/plugins/Makefile
+++ b/apps/plugins/Makefile
@@ -54,7 +54,7 @@ ifndef SIMVER
54$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a 54$(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a
55 $(SILENT)(file=`basename $@`; \ 55 $(SILENT)(file=`basename $@`; \
56 echo "LD $$file"; \ 56 echo "LD $$file"; \
57 $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map) 57 $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/$*.map)
58 58
59$(OBJDIR)/%.rock : $(OBJDIR)/%.elf 59$(OBJDIR)/%.rock : $(OBJDIR)/%.elf
60 @echo "OBJCOPY "`basename $@` 60 @echo "OBJCOPY "`basename $@`
diff --git a/apps/plugins/lib/Makefile b/apps/plugins/lib/Makefile
index 21dea571ae..7eddccddc5 100644
--- a/apps/plugins/lib/Makefile
+++ b/apps/plugins/lib/Makefile
@@ -20,6 +20,11 @@ endif
20CFLAGS = $(GCCOPTS) \ 20CFLAGS = $(GCCOPTS) \
21$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DPLUGIN 21$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DPLUGIN
22 22
23# Sectioned compilation for target
24ifndef SIMVER
25 CFLAGS += -ffunction-sections -fdata-sections
26endif
27
23# This sets up 'SRC' based on the files mentioned in SOURCES 28# This sets up 'SRC' based on the files mentioned in SOURCES
24include $(TOOLSDIR)/makesrc.inc 29include $(TOOLSDIR)/makesrc.inc
25 30
diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds
index 42f56e58bf..bf1057e332 100644
--- a/apps/plugins/plugin.lds
+++ b/apps/plugins/plugin.lds
@@ -51,12 +51,12 @@ MEMORY
51SECTIONS 51SECTIONS
52{ 52{
53 .text : { 53 .text : {
54 *(.entry) 54 KEEP(*(.entry))
55 *(.text) 55 *(.text*)
56 } > PLUGIN_RAM 56 } > PLUGIN_RAM
57 57
58 .data : { 58 .data : {
59 *(.data) 59 *(.data*)
60 } > PLUGIN_RAM 60 } > PLUGIN_RAM
61 61
62 /DISCARD/ : { 62 /DISCARD/ : {
@@ -64,13 +64,11 @@ SECTIONS
64 } 64 }
65 65
66 .bss : { 66 .bss : {
67 *(.bss) 67 *(.bss*)
68 } > PLUGIN_RAM 68 } > PLUGIN_RAM
69 69
70 .rodata : { 70 .rodata : {
71 *(.rodata) 71 *(.rodata*)
72 *(.rodata.str1.1)
73 *(.rodata.str1.4)
74 . = ALIGN(0x4); 72 . = ALIGN(0x4);
75#ifdef ARCH_IRIVER 73#ifdef ARCH_IRIVER
76 iramcopy = .; 74 iramcopy = .;
@@ -86,4 +84,9 @@ SECTIONS
86 iramend = .; 84 iramend = .;
87 } > PLUGIN_IRAM 85 } > PLUGIN_IRAM
88#endif 86#endif
87 /* Special trick to avoid a linker error when no other sections are
88 left after garbage collection (plugin not for this platform) */
89 .comment 0 : {
90 KEEP(*(.comment))
91 }
89} 92}