From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [x86] use gc sections to reduce image size
Date: Tue, 01 Jun 2010 23:01:34 +1000 [thread overview]
Message-ID: <4C0504AE.5070009@gmail.com> (raw)
I have run a quick test on x86 with a saving of 5.8kB with no apparent
problems. NOTE: If I add -fdata-sections as per the NIOS patches, U-Boot
fails to run.
I'm in the middle of a major re-write of the x86 startup code and will
include this as a formal patch when that work is complete.
Regards,
Graeme
diff --git a/arch/i386/config.mk b/arch/i386/config.mk
index 4b990e0..0e80a1a 100644
--- a/arch/i386/config.mk
+++ b/arch/i386/config.mk
@@ -26,3 +26,6 @@ CROSS_COMPILE ?= i386-linux-
STANDALONE_LOAD_ADDR = 0x40000
PLATFORM_CPPFLAGS += -DCONFIG_I386 -D__I386__
+
+LDFLAGS += --cref --gc-sections
+PLATFORM_RELFLAGS += -ffunction-sections
diff --git a/board/eNET/u-boot.lds b/board/eNET/u-boot.lds
index d78d75f..7b211a8 100644
--- a/board/eNET/u-boot.lds
+++ b/board/eNET/u-boot.lds
@@ -77,13 +77,13 @@ SECTIONS
_i386boot_bss_size = SIZEOF(.bss);
/* 16bit realmode trampoline code */
- .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) {
*(.realmode) }
+ .realmode 0x7c0 : AT ( LOADADDR(.rel.dyn) + SIZEOF(.rel.dyn) ) {
KEEP(*(.realmode)) }
_i386boot_realmode = LOADADDR(.realmode);
_i386boot_realmode_size = SIZEOF(.realmode);
/* 16bit BIOS emulation code (just enough to boot Linux) */
- .bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { *(.bios) }
+ .bios 0 : AT ( LOADADDR(.realmode) + SIZEOF(.realmode) ) { KEEP(*(.bios)) }
_i386boot_bios = LOADADDR(.bios);
_i386boot_bios_size = SIZEOF(.bios);
@@ -98,12 +98,12 @@ SECTIONS
* The fff0 offset of resetvec is important, however.
*/
. = 0xfffffe00;
- .start32 : AT (TEXT_BASE + 0x3fe00) { *(.start32); }
+ .start32 : AT (TEXT_BASE + 0x3fe00) { KEEP(*(.start32)); }
. = 0xf800;
- .start16 : AT (TEXT_BASE + 0x3f800) { *(.start16); }
+ .start16 : AT (TEXT_BASE + 0x3f800) { KEEP(*(.start16)); }
. = 0xfff0;
- .resetvec : AT (TEXT_BASE + 0x3fff0) { *(.resetvec); }
+ .resetvec : AT (TEXT_BASE + 0x3fff0) { KEEP(*(.resetvec)); }
_i386boot_end = (LOADADDR(.resetvec) + SIZEOF(.resetvec) );
}
reply other threads:[~2010-06-01 13:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C0504AE.5070009@gmail.com \
--to=graeme.russ@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox