From d59ca7feb3220ae846a10b6f7da0712e2c1feae3 Mon Sep 17 00:00:00 2001 From: sascha Date: Wed, 17 Oct 2007 12:21:53 +0200 Subject: [PATCH] Linking: Remove linker scripts from (arm based-) boards and add a generic linker script to arch/arm/lib/u-boot.lds.S. If a board wants to overwrite a linker script it can do so using CONFIG_BOARD_LINKER_SCRIPT. There is no generic linker script for ppc and blackfin yet, so still use the board specific one. --- Makefile | 6 +-- arch/arm/Kconfig | 9 ++++ arch/arm/Makefile | 4 ++ arch/arm/lib/Makefile | 2 + arch/blackfin/Makefile | 4 +- arch/ppc/Makefile | 2 + board/eco920/Makefile | 1 - board/eco920/u-boot.lds.S | 63 --------------------------- board/netx/Makefile | 1 - board/netx/u-boot.lds.S | 65 ---------------------------- board/phycore_pcm038/Makefile | 2 - board/phycore_pcm038/u-boot.lds.S | 71 ------------------------------- board/scb9328/Makefile | 2 - board/scb9328/u-boot.lds.S | 71 ------------------------------- 14 files changed, 23 insertions(+), 280 deletions(-) delete mode 100644 board/eco920/u-boot.lds.S delete mode 100644 board/netx/u-boot.lds.S delete mode 100644 board/phycore_pcm038/u-boot.lds.S delete mode 100644 board/scb9328/u-boot.lds.S diff --git a/Makefile b/Makefile index b1dba189d..1d4b5b1d1 100644 --- a/Makefile +++ b/Makefile @@ -494,8 +494,8 @@ common-y := $(patsubst %/, %/built-in.o, $(common-y)) # System.map is generated to document addresses of all kernel symbols uboot-common := $(common-y) -uboot-all := $(uboot-common) -uboot-lds := $(BOARD)/u-boot.lds +uboot-all := $(uboot-common) +uboot-lds := $(lds-y) # Rule to link uboot # May be overridden by arch/$(ARCH)/Makefile @@ -903,7 +903,7 @@ endif # CONFIG_MODULES # Directories & files removed with 'make clean' CLEAN_DIRS += $(MODVERDIR) CLEAN_FILES += uboot System.map include/uboot_default_env.h \ - .tmp_version .tmp_uboot* uboot.bin uboot.S $(uboot-lds) \ + .tmp_version .tmp_uboot* uboot.bin uboot.S \ .tmp_kallsyms* # Directories & files removed with 'make mrproper' diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 539232269..41f9fc81d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -16,6 +16,15 @@ config BOARDINFO config BOARDINFO default "Phytec Phycore MX27" if MACH_PCM038 +config BOARD_LINKER_SCRIPT + bool + default n + +config GENERIC_LINKER_SCRIPT + bool + default y + depends on !BOARD_LINKER_SCRIPT + config ARM bool select HAS_KALLSYMS diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f838d3743..fb81d237e 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -77,4 +77,8 @@ endif common-y += $(BOARD) $(MACH) common-y += arch/arm/lib/ arch/arm/cpu/ +lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/arm/lib/u-boot.lds +lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/u-boot.lds + +CLEAN_FILES += arch/arm/lib/u-boot.lds MRPROPER_FILES += include/asm-arm/arch include/asm-arm/proc diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 5c207457e..9656ca81d 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -10,3 +10,5 @@ obj-y += _umodsi3.o obj-y += _lshrdi3.o obj-y += arm.o obj-$(CONFIG_MODULES) += module.o +extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += u-boot.lds + diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile index a3a1cf53f..2ca75dc99 100644 --- a/arch/blackfin/Makefile +++ b/arch/blackfin/Makefile @@ -53,6 +53,8 @@ CPU := endif common-y += $(BOARD) -common-y += arch/blackfin/lib/ $(CPU) +common-y += arch/blackfin/lib/ $(CPU) + +lds-y += $(BOARD)/u-boot.lds MRPROPER_FILES += include/asm-arm/arch include/asm-arm/proc diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index c92663659..3645a288d 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile @@ -58,4 +58,6 @@ endif common-y += $(BOARD) $(CPU) common-y += arch/ppc/lib/ +lds-y += $(BOARD)/u-boot.lds + MRPROPER_FILES += include/asm-ppc/arch diff --git a/board/eco920/Makefile b/board/eco920/Makefile index 65266285c..2cc70ca05 100644 --- a/board/eco920/Makefile +++ b/board/eco920/Makefile @@ -1,3 +1,2 @@ obj-y += eco920.o -extra-y += u-boot.lds diff --git a/board/eco920/u-boot.lds.S b/board/eco920/u-boot.lds.S deleted file mode 100644 index 109aae3a3..000000000 --- a/board/eco920/u-boot.lds.S +++ /dev/null @@ -1,63 +0,0 @@ -/* - * (C) Copyright 2002 - * Gary Jennejohn, DENX Software Engineering, - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/ -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = 0x00000000; - - . = ALIGN(4); - .text : - { - *(.text_entry) - *(.text) - } - - . = ALIGN(4); - .rodata : { *(.rodata) } - - . = ALIGN(4); - .data : { *(.data) } - - . = ALIGN(4); - .got : { *(.got) } - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { *(.u_boot_cmd) } - __u_boot_cmd_end = .; - - __u_boot_initcalls_start = .; - .u_boot_initcalls : { INITCALLS } - __u_boot_initcalls_end = .; - - . = ALIGN(4); - __bss_start = .; - .bss : { *(.bss) } - _end = .; -} diff --git a/board/netx/Makefile b/board/netx/Makefile index 33ad98d4e..c1d02f8a4 100644 --- a/board/netx/Makefile +++ b/board/netx/Makefile @@ -1,2 +1 @@ obj-y += netx.o -extra-y += u-boot.lds diff --git a/board/netx/u-boot.lds.S b/board/netx/u-boot.lds.S deleted file mode 100644 index 3641ca6b6..000000000 --- a/board/netx/u-boot.lds.S +++ /dev/null @@ -1,65 +0,0 @@ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - */ - -#include - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = 0x00000000; - - . = ALIGN(4); - .text : - { - _stext = .; - _text = .; - *(.text_entry) - *(.text) - } - - . = ALIGN(4); - .rodata : { *(.rodata) } - - . = ALIGN(4); - .data : { *(.data) } - - . = ALIGN(4); - .got : { *(.got) } - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { U_BOOT_CMDS } - __u_boot_cmd_end = .; - - __u_boot_initcalls_start = .; - .u_boot_initcalls : { INITCALLS } - __u_boot_initcalls_end = .; - - . = ALIGN(4); - __bss_start = .; - .bss : { *(.bss) } - _end = .; -} diff --git a/board/phycore_pcm038/Makefile b/board/phycore_pcm038/Makefile index a382b3b50..6082b2d65 100644 --- a/board/phycore_pcm038/Makefile +++ b/board/phycore_pcm038/Makefile @@ -1,5 +1,3 @@ obj-y += lowlevel_init.o obj-y += pcm038.o - -extra-y += u-boot.lds diff --git a/board/phycore_pcm038/u-boot.lds.S b/board/phycore_pcm038/u-boot.lds.S deleted file mode 100644 index 1494a8eb0..000000000 --- a/board/phycore_pcm038/u-boot.lds.S +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - */ - -#include - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = TEXT_BASE; - - . = ALIGN(4); - .text : - { - _stext = .; - _text = .; - *(.text_entry) - *(.text) - } - - . = ALIGN(4); - .rodata : { *(.rodata) } - - _etext = .; /* End of text and rodata section */ - - . = ALIGN(4); - .data : { *(.data) } - - . = ALIGN(4); - .got : { *(.got) } - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { U_BOOT_CMDS } - __u_boot_cmd_end = .; - - __u_boot_initcalls_start = .; - .u_boot_initcalls : { INITCALLS } - __u_boot_initcalls_end = .; - - __usymtab_start = .; - __usymtab : { U_BOOT_SYMS } - __usymtab_end = .; - - . = ALIGN(4); - __bss_start = .; - .bss : { *(.bss) } - _end = .; -} diff --git a/board/scb9328/Makefile b/board/scb9328/Makefile index 72dc0f5cd..db6fd7ec3 100644 --- a/board/scb9328/Makefile +++ b/board/scb9328/Makefile @@ -1,5 +1,3 @@ obj-y += lowlevel_init.o obj-y += scb9328.o - -extra-y += u-boot.lds diff --git a/board/scb9328/u-boot.lds.S b/board/scb9328/u-boot.lds.S deleted file mode 100644 index 1494a8eb0..000000000 --- a/board/scb9328/u-boot.lds.S +++ /dev/null @@ -1,71 +0,0 @@ -/* - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - */ - -#include - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -SECTIONS -{ - . = TEXT_BASE; - - . = ALIGN(4); - .text : - { - _stext = .; - _text = .; - *(.text_entry) - *(.text) - } - - . = ALIGN(4); - .rodata : { *(.rodata) } - - _etext = .; /* End of text and rodata section */ - - . = ALIGN(4); - .data : { *(.data) } - - . = ALIGN(4); - .got : { *(.got) } - - . = .; - __u_boot_cmd_start = .; - .u_boot_cmd : { U_BOOT_CMDS } - __u_boot_cmd_end = .; - - __u_boot_initcalls_start = .; - .u_boot_initcalls : { INITCALLS } - __u_boot_initcalls_end = .; - - __usymtab_start = .; - __usymtab : { U_BOOT_SYMS } - __usymtab_end = .; - - . = ALIGN(4); - __bss_start = .; - .bss : { *(.bss) } - _end = .; -}