Skip to content

Commit

Permalink
ppc4xx: Cleanup for partial linking and --gc-sections
Browse files Browse the repository at this point in the history
This commit adapts 4xx boards for partial linking with --gc-sections.

Signed-off-by: Stefan Roese <[email protected]>
Signed-off-by: Wolfgang Denk <[email protected]>
Cc: Stefan Roese <[email protected]>
Cc: Tirumala Marri <[email protected]>
Cc: David Updegraff <[email protected]>
Cc: Matthias Fuchs <[email protected]>
Cc: Dirk Eibach <[email protected]>
Cc: Larry Johnson <[email protected]>
Cc: Peter De Schrijver <[email protected]>
Cc: Niklaus Giger <[email protected]>
Cc: Daniel Poirot <[email protected]>
Acked-by: Stefan Roese <[email protected]>
  • Loading branch information
wdenx committed Nov 27, 2010
1 parent c08e5cf commit ee8028b
Show file tree
Hide file tree
Showing 33 changed files with 152 additions and 407 deletions.
53 changes: 10 additions & 43 deletions arch/powerpc/cpu/ppc4xx/u-boot.lds
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#endif

OUTPUT_ARCH(powerpc)
/* Do we need any of these for elf?
__DYNAMIC = 0; */

PHDRS
{
text PT_LOAD;
Expand All @@ -39,67 +38,36 @@ SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
*(.text)
*(.got1)
*(.text*)
} :text
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(.eh_frame)
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
} :text
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }

/* Read-write section, merged into data segment: */
. = (. + 0x00FF) & 0xFFFFFF00;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
KEEP(*(.got))
_GOT2_TABLE_ = .;
*(.got2)
KEEP(*(.got2))
_FIXUP_TABLE_ = .;
*(.fixup)
KEEP(*(.fixup))
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
__fixup_entries = (. - _FIXUP_TABLE_) >> 2;

.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
*(.data*)
*(.sdata*)
}
_edata = .;
PROVIDE (edata = .);
Expand Down Expand Up @@ -138,7 +106,7 @@ SECTIONS

.resetvec RESET_VECTOR_ADDRESS :
{
*(.resetvec)
KEEP(*(.resetvec))
} :text = 0xffff

. = RESET_VECTOR_ADDRESS + 0x4;
Expand All @@ -157,9 +125,8 @@ SECTIONS
__bss_start = .;
.bss (NOLOAD) :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(.bss*)
*(.sbss*)
*(COMMON)
} :bss

Expand Down
6 changes: 4 additions & 2 deletions board/amcc/bamboo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))

$(LIB): $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
all: $(LIB) $(SOBJS)

$(LIB): $(OBJS)
$(call cmd_link_o_target, $^)

clean:
rm -f $(SOBJS) $(OBJS)
Expand Down
50 changes: 10 additions & 40 deletions board/amcc/bamboo/u-boot-nand.lds
Original file line number Diff line number Diff line change
Expand Up @@ -26,77 +26,48 @@ SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
/* WARNING - the following is hand-optimized to fit within */
/* the sector layout of our flash chips! XXX FIXME XXX */

arch/powerpc/cpu/ppc4xx/start.o (.text)
arch/powerpc/cpu/ppc4xx/start.o (.text*)
board/amcc/bamboo/init.o (.text*)

/* Align to next NAND block */
. = ALIGN(0x4000);
common/env_embedded.o (.ppcenv)
/* Keep some space here for redundant env and potential bad env blocks */
. = ALIGN(0x10000);

*(.text)
*(.got1)
*(.text*)
}
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }

/* Read-write section, merged into data segment: */
. = (. + 0x00FF) & 0xFFFFFF00;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
KEEP(*(.got))
_GOT2_TABLE_ = .;
*(.got2)
KEEP(*(.got2))
_FIXUP_TABLE_ = .;
*(.fixup)
KEEP(*(.fixup))
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
__fixup_entries = (. - _FIXUP_TABLE_)>>2;

.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
*(.data*)
*(.sdata*)
}
_edata = .;
PROVIDE (edata = .);
Expand All @@ -122,9 +93,8 @@ SECTIONS
__bss_start = .;
.bss (NOLOAD) :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(.bss*)
*(.sbss*)
*(COMMON)
. = ALIGN(4);
}
Expand Down
6 changes: 4 additions & 2 deletions board/amcc/bluestone/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))

$(LIB): $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
all: $(LIB) $(SOBJS)

$(LIB): $(OBJS)
$(call cmd_link_o_target, $^)

clean:
rm -f $(SOBJS) $(OBJS)
Expand Down
6 changes: 4 additions & 2 deletions board/amcc/canyonlands/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))

$(LIB): $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
all: $(LIB) $(SOBJS)

$(LIB): $(OBJS)
$(call cmd_link_o_target, $^)

clean:
rm -f $(SOBJS) $(OBJS)
Expand Down
48 changes: 9 additions & 39 deletions board/amcc/canyonlands/u-boot-nand.lds
Original file line number Diff line number Diff line change
Expand Up @@ -26,77 +26,48 @@ SECTIONS
{
/* Read-only sections, merged into text segment: */
. = + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.rel.text : { *(.rel.text) }
.rela.text : { *(.rela.text) }
.rel.data : { *(.rel.data) }
.rela.data : { *(.rela.data) }
.rel.rodata : { *(.rel.rodata) }
.rela.rodata : { *(.rela.rodata) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.ctors : { *(.rel.ctors) }
.rela.ctors : { *(.rela.ctors) }
.rel.dtors : { *(.rel.dtors) }
.rela.dtors : { *(.rela.dtors) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
.init : { *(.init) }
.plt : { *(.plt) }
.text :
{
/* WARNING - the following is hand-optimized to fit within */
/* the sector layout of our flash chips! XXX FIXME XXX */

arch/powerpc/cpu/ppc4xx/start.o (.text)
board/amcc/canyonlands/init.o (.text*)

/* Align to next NAND block */
. = ALIGN(0x20000);
common/env_embedded.o (.ppcenv)
/* Keep some space here for redundant env and potential bad env blocks */
. = ALIGN(0x80000);

*(.text)
*(.got1)
*(.text*)
}
_etext = .;
PROVIDE (etext = .);
.rodata :
{
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
}
.fini : { *(.fini) } =0
.ctors : { *(.ctors) }
.dtors : { *(.dtors) }

/* Read-write section, merged into data segment: */
. = (. + 0x00FF) & 0xFFFFFF00;
_erotext = .;
PROVIDE (erotext = .);
.reloc :
{
*(.got)
KEEP(*(.got))
_GOT2_TABLE_ = .;
*(.got2)
KEEP(*(.got2))
_FIXUP_TABLE_ = .;
*(.fixup)
KEEP(*(.fixup))
}
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
__fixup_entries = (. - _FIXUP_TABLE_)>>2;

.data :
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.dynamic)
CONSTRUCTORS
*(.data*)
*(.sdata*)
}
_edata = .;
PROVIDE (edata = .);
Expand All @@ -122,9 +93,8 @@ SECTIONS
__bss_start = .;
.bss (NOLOAD) :
{
*(.sbss) *(.scommon)
*(.dynbss)
*(.bss)
*(.bss*)
*(.sbss*)
*(COMMON)
. = ALIGN(4);
}
Expand Down
6 changes: 4 additions & 2 deletions board/amcc/sequoia/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
SOBJS := $(addprefix $(obj),$(SOBJS))

$(LIB): $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
all: $(LIB) $(SOBJS)

$(LIB): $(OBJS)
$(call cmd_link_o_target, $^)

clean:
rm -f $(SOBJS) $(OBJS)
Expand Down
Loading

0 comments on commit ee8028b

Please sign in to comment.