summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc2
-rw-r--r--src/arch/x86/Makefile.inc8
-rw-r--r--src/arch/x86/init/romstage.ld7
-rw-r--r--src/arch/x86/ramstage.ld11
-rw-r--r--src/lib/Makefile.inc2
-rw-r--r--src/lib/rmodule.ld10
-rw-r--r--toolchain.inc2
7 files changed, 24 insertions, 18 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 412afde67cf6..cc696e44be98 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -253,7 +253,7 @@ CPPFLAGS_common += -include $(src)/include/kconfig.h
CFLAGS_common += -pipe -g -nostdinc
CFLAGS_common += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
-CFLAGS_common += -Wstrict-aliasing -Wshadow
+CFLAGS_common += -Wstrict-aliasing -Wshadow -Wno-unused-but-set-variable
ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
CFLAGS_common += -Werror
endif
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index a92c55c4231f..7acdb57b12ae 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -27,11 +27,7 @@ subdirs-y += boot
subdirs-y += lib
subdirs-y += smp
-ifeq ($(CONFIG_COMPILER_GCC),y)
-DISASSEMBLY=-Wa,-acdlns
-else
DISASSEMBLY=-Wa,--divide
-endif
OPTION_TABLE_H:=
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
@@ -214,7 +210,7 @@ $(objcbfs)/romstage_null.debug: $$(romstage-objs) $(objgenerated)/romstage_null.
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objgenerated)/romstage.ld $$(romstage-libs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
- $(LD_romstage) -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld
+ $(LD_romstage) --gc-sections -nostdlib -nostartfiles -static -o $@ -L$(obj) $(COMPILER_RT_FLAGS_romstage) --start-group $(romstage-objs) $(romstage-libs) $(COMPILER_RT_romstage) --end-group -T $(objgenerated)/romstage.ld
$(objgenerated)/romstage_null.ld: $$(ldscripts) $(obj)/ldoptions
@printf " GEN $(subst $(obj)/,,$(@))\n"
@@ -310,7 +306,7 @@ else
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(src)/arch/x86/ramstage.ld
@printf " CC $(subst $(obj)/,,$(@))\n"
- $(LD_ramstage) -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld
+ $(LD_ramstage) --gc-sections -o $@ -L$(obj) $< -T $(src)/arch/x86/ramstage.ld
endif
diff --git a/src/arch/x86/init/romstage.ld b/src/arch/x86/init/romstage.ld
index 50eb4ab2226a..95b9571e37ee 100644
--- a/src/arch/x86/init/romstage.ld
+++ b/src/arch/x86/init/romstage.ld
@@ -30,13 +30,16 @@ SECTIONS
.rom . : {
_rom = .;
*(.rom.text);
+ *(.rom.text.*);
+ *(.text);
+ *(.text.*);
*(.rom.data);
*(.rodata);
*(.rodata.*);
*(.rom.data.*);
. = ALIGN(16);
_car_migrate_start = .;
- *(.car.migrate);
+ KEEP(*(.car.migrate));
LONG(0);
_car_migrate_end = .;
. = ALIGN(16);
@@ -73,7 +76,7 @@ SECTIONS
. = 0xffffff00;
.illegal_globals . : {
*(EXCLUDE_FILE (*/libagesa.*.a: */buildOpts.romstage.o */agesawrapper.romstage.o */vendorcode/amd/agesa/* */vendorcode/amd/cimx/*) .data)
- *(.data.*)
+ *(EXCLUDE_FILE (*/libagesa.*.a: */buildOpts.romstage.o */agesawrapper.romstage.o */vendorcode/amd/agesa/* */vendorcode/amd/cimx/*) .data.*)
*(.bss)
*(.bss.*)
*(.sbss)
diff --git a/src/arch/x86/ramstage.ld b/src/arch/x86/ramstage.ld
index 1c8e8dcd6f6e..0843be790625 100644
--- a/src/arch/x86/ramstage.ld
+++ b/src/arch/x86/ramstage.ld
@@ -42,7 +42,7 @@ SECTIONS
.ctors : {
. = ALIGN(0x100);
__CTOR_LIST__ = .;
- *(.ctors);
+ KEEP(*(.ctors));
LONG(0);
__CTOR_END__ = .;
}
@@ -55,13 +55,13 @@ SECTIONS
* section names the equivalent changes need to made to
* rmodule.ld. */
pci_drivers = . ;
- *(.rodata.pci_driver)
+ KEEP(*(.rodata.pci_driver));
epci_drivers = . ;
cpu_drivers = . ;
- *(.rodata.cpu_driver)
+ KEEP(*(.rodata.cpu_driver));
ecpu_drivers = . ;
_bs_init_begin = .;
- *(.bs_init)
+ KEEP(*(.bs_init));
_bs_init_end = .;
*(.rodata)
@@ -82,6 +82,7 @@ SECTIONS
.data : {
_data = .;
*(.data)
+ *(.data.*)
_edata = .;
}
@@ -92,7 +93,9 @@ SECTIONS
_bss = .;
.bss . : {
*(.bss)
+ *(.bss.*)
*(.sbss)
+ *(.sbss.*)
*(COMMON)
}
_ebss = .;
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 9650fd5fd9c6..e599066b5e48 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 f3e7cba21203..c1669becb69e 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);
diff --git a/toolchain.inc b/toolchain.inc
index f888d68d0a4f..8241e250ecb9 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -66,6 +66,8 @@ CFLAGS_arm64 := -ffunction-sections -fdata-sections
CFLAGS_mipsel := -mips32r2 -G 0
+CFLAGS_x86_32 := -ffunction-sections -fdata-sections
+
toolchain_to_dir = \
$(foreach arch,$(ARCH_SUPPORTED),\
$(eval CPPFLAGS_$(arch) += \