summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Makefile.inc2
-rw-r--r--src/lib/rmodule.ld10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 9650fd5fd9..e599066b5e 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -119,7 +119,7 @@ ramstage-y += rmodule.c
romstage-$(CONFIG_RELOCATABLE_RAMSTAGE) += rmodule.c
RMODULE_LDSCRIPT := $(src)/lib/rmodule.ld
-RMODULE_LDFLAGS := -nostartfiles --emit-relocs -z defs -Bsymbolic -T$(RMODULE_LDSCRIPT)
+RMODULE_LDFLAGS := -nostartfiles --gc-sections --emit-relocs -z defs -Bsymbolic -T$(RMODULE_LDSCRIPT)
# rmodule_link_rules is a function that should be called with:
# (1) the object name to link
diff --git a/src/lib/rmodule.ld b/src/lib/rmodule.ld
index f3e7cba212..c1669becb6 100644
--- a/src/lib/rmodule.ld
+++ b/src/lib/rmodule.ld
@@ -14,6 +14,8 @@
BASE_ADDRESS = 0x00000;
+ENTRY(__rmodule_entry);
+
SECTIONS
{
. = BASE_ADDRESS;
@@ -38,15 +40,15 @@ SECTIONS
* ramstage.ld should be made here as well. */
. = ALIGN(8);
pci_drivers = . ;
- *(.rodata.pci_driver)
+ KEEP(*(.rodata.pci_driver));
epci_drivers = . ;
. = ALIGN(8);
cpu_drivers = . ;
- *(.rodata.cpu_driver)
+ KEEP(*(.rodata.cpu_driver));
ecpu_drivers = . ;
. = ALIGN(8);
_bs_init_begin = .;
- *(.bs_init)
+ KEEP(*(.bs_init));
_bs_init_end = .;
. = ALIGN(8);
@@ -59,7 +61,7 @@ SECTIONS
* to a module, however there has to be an prior agreement
* on how to interpret the parameters. */
_module_params_begin = .;
- *(.module_parameters);
+ KEEP(*(.module_parameters));
_module_params_end = .;
. = ALIGN(8);