From c3c8d6ae27a2c86cd133b285d3e9bbf5ef047701 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Tue, 15 Jul 2014 20:52:32 +1000 Subject: [PATCH] net-snk: Sanitize our .lds file No need to have a single giant section, break it back up, add some missing bits, and make sure .opd is separate so that objdump and gdb can properly reconstitute the dot symbols. Signed-off-by: Benjamin Herrenschmidt [ do not discard .comment, this is fixed with binutils 2.24] Signed-off-by: Nikunj A Dadhania --- clients/net-snk/client.lds | 78 ++++++++++++++++++++++++---------- clients/net-snk/kernel/init.c | 2 - clients/net-snk/sec-client.lds | 7 --- 3 files changed, 56 insertions(+), 31 deletions(-) diff --git a/clients/net-snk/client.lds b/clients/net-snk/client.lds index 2ebf9d1..39d0459 100644 --- a/clients/net-snk/client.lds +++ b/clients/net-snk/client.lds @@ -15,37 +15,71 @@ OUTPUT_ARCH(powerpc:common64) ENTRY(_entry) SECTIONS { - .client 0xF000100: - { - __client_start = .; - *(.text .stub .text.* .gnu.linkonce.t.*) + . = 0xF000100; + .text : + { + __client_start = .; + *(.text* .stub .gnu.linkonce.t.*) *(.sfpr .glink) - *(.rodata .rodata.* .gnu.linkonce.r.*) - KEEP (*(.opd)) - . = ALIGN(256); - *(.data .data.* .gnu.linkonce.d.*) - . = ALIGN(256); - } =0x60000000 - - .lowmem : - { - _lowmem_start = .; - *(.lowmem) - _lowmem_end = .; } + . = ALIGN(0x100); + .rodata : + { + *(.rodata* .gnu.linkonce.r.*) + } + + . = ALIGN(0x10); + .data : + { + *(.data* .gnu.linkonce.d.*) + *(.force.data) + *(.toc1) + *(.branch_lt) + } + + . = ALIGN(0x10); + .opd : + { + *(.opd) + } + + . = ALIGN(0x10); .got : { - . = ALIGN(8); _got = .; - *(.got .toc) + *(.got) + *(.toc) _got_end = .; - } - .comment : { *(.comment) } - .branch_lt : { *(.branch_lt) } + } + + . = ALIGN(0x1000); .bss : { - *(*COM* .bss .gnu.linkonce.b.*) + *(*COM* .bss* .gnu.linkonce.b.*) + } __client_end = .; + + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + . = ALIGN(0x10); + .dynamic : { + *(.dynamic) + } + . = ALIGN(0x10); + .rela.dyn : { + *(.rela*) + } + .hash : { *(.hash) } + + .comment : { + /* + * Discarding this section caused errors on binutils 2.23, + * this is fixed in 2.24. + */ + *(.comment) + } + /DISCARD/ : { + *(.interp) } } diff --git a/clients/net-snk/kernel/init.c b/clients/net-snk/kernel/init.c index 8ae436f..1376b64 100644 --- a/clients/net-snk/kernel/init.c +++ b/clients/net-snk/kernel/init.c @@ -31,8 +31,6 @@ snk_fileio_t fd_array[FILEIO_MAX]; extern uint64_t tb_freq; -extern char _lowmem_start; -extern char _lowmem_end; extern char __client_start; extern char __client_end; diff --git a/clients/net-snk/sec-client.lds b/clients/net-snk/sec-client.lds index 0ca24ab..0eefdda 100644 --- a/clients/net-snk/sec-client.lds +++ b/clients/net-snk/sec-client.lds @@ -28,13 +28,6 @@ SECTIONS { /* *(*COM* .bss .gnu.linkonce.b.*) */ } =0x60000000 - .lowmem : - { - _lowmem_start = .; - *(.lowmem) - _lowmem_end = .; - } - .got : { . = ALIGN(8);