diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-06-29 21:04:22 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-06-29 21:04:22 +0000 |
| commit | 305a7ce1a29b35a463a5ea79e8089b362f9810da (patch) | |
| tree | 17e03cdf1fa32370cb0f592afc716bde45935939 /apps/plugins | |
| parent | 84d6f9e89bf1bae7e3669e487541f91f27a86b0a (diff) | |
| download | rockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.zip rockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.tar.gz rockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.tar.bz2 rockbox-305a7ce1a29b35a463a5ea79e8089b362f9810da.tar.xz | |
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/Makefile | 2 | ||||
| -rw-r--r-- | apps/plugins/lib/Makefile | 5 | ||||
| -rw-r--r-- | apps/plugins/plugin.lds | 17 |
3 files changed, 16 insertions, 8 deletions
diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index a59e33f..1f1c309 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile @@ -54,7 +54,7 @@ ifndef SIMVER $(OBJDIR)/%.elf: $(OBJDIR)/%.o $(LINKFILE) $(BUILDDIR)/libplugin.a $(SILENT)(file=`basename $@`; \ echo "LD $$file"; \ - $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$*.map) + $(CC) $(GCCOPTS) -O -nostdlib -o $@ $< -L$(BUILDDIR) $(CODECLIBS) -lplugin -lgcc -T$(LINKFILE) -Wl,--gc-sections -Wl,-Map,$(OBJDIR)/$*.map) $(OBJDIR)/%.rock : $(OBJDIR)/%.elf @echo "OBJCOPY "`basename $@` diff --git a/apps/plugins/lib/Makefile b/apps/plugins/lib/Makefile index 21dea57..7eddccd 100644 --- a/apps/plugins/lib/Makefile +++ b/apps/plugins/lib/Makefile @@ -20,6 +20,11 @@ endif CFLAGS = $(GCCOPTS) \ $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} -DPLUGIN +# Sectioned compilation for target +ifndef SIMVER + CFLAGS += -ffunction-sections -fdata-sections +endif + # This sets up 'SRC' based on the files mentioned in SOURCES include $(TOOLSDIR)/makesrc.inc diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index 42f56e5..bf1057e 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -51,12 +51,12 @@ MEMORY SECTIONS { .text : { - *(.entry) - *(.text) + KEEP(*(.entry)) + *(.text*) } > PLUGIN_RAM .data : { - *(.data) + *(.data*) } > PLUGIN_RAM /DISCARD/ : { @@ -64,13 +64,11 @@ SECTIONS } .bss : { - *(.bss) + *(.bss*) } > PLUGIN_RAM .rodata : { - *(.rodata) - *(.rodata.str1.1) - *(.rodata.str1.4) + *(.rodata*) . = ALIGN(0x4); #ifdef ARCH_IRIVER iramcopy = .; @@ -86,4 +84,9 @@ SECTIONS iramend = .; } > PLUGIN_IRAM #endif + /* Special trick to avoid a linker error when no other sections are + left after garbage collection (plugin not for this platform) */ + .comment 0 : { + KEEP(*(.comment)) + } } |