All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ladislav Michl <Ladislav.Michl@seznam.cz>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5] NetStar: eeprom - fix linker error
Date: Thu, 28 Jan 2010 00:20:44 +0100	[thread overview]
Message-ID: <20100127232044.GD18557@localhost.localdomain> (raw)
In-Reply-To: <20100127231620.GA18557@localhost.localdomain>

From: Ladislav Michl <ladis@linux-mips.org>

linking eeprom with libgeneric.a is not really needed and causes following
error:
../../lib_generic/libgeneric.a(string.o): In function `strcmp':
lib_generic/string.c:152: multiple definition of `strcmp'
../../examples/standalone/libstubs.a(stubs.o):include/_exports.h:24: first defined here
Remove eeprom linker script as well and generate entry point object
(to start application by jumping on its beginning) on the fly.
Out-of-tree build tested as well.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
---
 board/netstar/Makefile       |   54 +++++++++++++++++++----------------------
 board/netstar/eeprom.lds     |   51 ---------------------------------------
 board/netstar/eeprom_start.S |   13 ----------
 3 files changed, 25 insertions(+), 93 deletions(-)
 delete mode 100644 board/netstar/eeprom.lds
 delete mode 100644 board/netstar/eeprom_start.S

diff --git a/board/netstar/Makefile b/board/netstar/Makefile
index 11578b7..c435762 100644
--- a/board/netstar/Makefile
+++ b/board/netstar/Makefile
@@ -29,20 +29,15 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).a
 
 COBJS	:= netstar.o
-SOBJS	:= setup.o crcek.o
+SOBJS	:= setup.o
 
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) eeprom.c \
-		eeprom_start.S
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
 
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
 LOAD_ADDR = 0x10400000
-LDSCRIPT = $(TOPDIR)/board/$(BOARDDIR)/eeprom.lds
-lnk = $(if $(obj),$(obj),.)
 
-HOSTCFLAGS = -Wall -pedantic -I$(TOPDIR)/include
+#########################################################################
 
 all:	$(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \
 		$(obj)crcek.srec $(obj)crcek.bin $(obj)crcit
@@ -50,41 +45,42 @@ all:	$(obj).depend $(LIB) $(obj)eeprom.srec $(obj)eeprom.bin \
 $(LIB):	$(OBJS) $(SOBJS)
 	$(AR) $(ARFLAGS) $@ $^
 
-$(obj)eeprom.srec:	$(obj)eeprom.o $(obj)eeprom_start.o $(obj)u-boot.lds
-	cd $(lnk) && $(LD) -T $(obj)u-boot.lds -g -Ttext $(LOAD_ADDR) \
-		-o $(<:.o=) -e eeprom eeprom.o eeprom_start.o \
+$(obj)eeprom_start.o:
+	echo "b eeprom" | $(CC) $(AFLAGS) -c -x assembler -o $@ -
+
+$(obj)eeprom:		$(obj)eeprom_start.o $(obj)eeprom.o
+	$(LD) -Ttext $(LOAD_ADDR) -e eeprom -o $@ $^ \
 		-L$(obj)../../examples/standalone -lstubs \
-		-L$(obj)../../lib_generic -lgeneric \
-		-L$(gcclibdir) -lgcc
-	$(OBJCOPY) -O srec $(<:.o=) $@
+		$(PLATFORM_LIBS)
 
-$(obj)eeprom.bin:	$(obj)eeprom.srec
-	$(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
+$(obj)eeprom.srec:	$(obj)eeprom
+	$(OBJCOPY) -S -O srec $(<:.o=) $@
+
+$(obj)eeprom.bin:	$(obj)eeprom
+	$(OBJCOPY) -S -O binary $< $@
 
 $(obj)crcek.srec:	$(obj)crcek.o
-	$(LD) -g -Ttext 0x00000000 \
-		-o $(<:.o=) -e crcek $^
-	$(OBJCOPY) -O srec $(<:.o=) $@
+	$(LD) -g -Ttext 0x00000000 -e crcek -o $(<:.o=) $^
+	$(OBJCOPY) -S -O srec $(<:.o=) $@
 
 $(obj)crcek.bin:	$(obj)crcek.srec
-	$(OBJCOPY) -I srec -O binary $< $@ 2>/dev/null
+	$(OBJCOPY) -I srec -O binary $< $@
 
 $(obj)crcit:		$(obj)crcit.o $(obj)crc32.o
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
 
-$(obj)crcit.o:	crcit.c
+$(obj)crcit.o:		crcit.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ -c $<
 
-$(obj)crc32.o:	$(SRCTREE)/lib_generic/crc32.c
-	$(HOSTCC) $(HOSTCFLAGS) -DUSE_HOSTCC -o $@ -c $<
-
-$(obj)u-boot.lds: $(LDSCRIPT)
-	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
+$(obj)crc32.o:		$(SRCTREE)/lib_generic/crc32.c
+	$(HOSTCC) $(HOSTCFLAGS) -DUSE_HOSTCC -I$(TOPDIR)/include \
+		-o $@ -c $<
 
 clean:
-	rm -f $(SOBJS) $(OBJS) $(obj)eeprom $(obj)eeprom.srec \
-		$(obj)eeprom.bin $(obj)crcek $(obj)crcek.srec \
-		$(obj)crcek.bin $(obj)u-boot.lds
+	rm -f $(SOBJS) $(OBJS) \
+		$(obj)eeprom_start.o $(obj)eeprom.o \
+		$(obj)eeprom $(obj)eeprom.srec 	$(obj)eeprom.bin \
+		$(obj)crcek.o $(obj)crcek $(obj)crcek.srec $(obj)crcek.bin
 
 distclean:	clean
 	rm -f $(LIB) core *.bak $(obj).depend
diff --git a/board/netstar/eeprom.lds b/board/netstar/eeprom.lds
deleted file mode 100644
index 1e48494..0000000
--- a/board/netstar/eeprom.lds
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- * (C) Copyright 2005
- * Ladislav Michl, 2N Telekomunikace, <michl@2n.cz>
- *
- * 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
- */
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
-	. = ALIGN(4);
-	.text      :
-	{
-	  eeprom_start.o	(.text)
-	  *(.text)
-	}
-
-	. = ALIGN(4);
-	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
-	. = ALIGN(4);
-	.data : { *(.data) }
-
-	. = ALIGN(4);
-	.got : { *(.got) }
-
-	. = ALIGN(4);
-	__bss_start = .;
-	.bss (NOLOAD) : { *(.bss) . = ALIGN(4); }
-	_end = .;
-}
diff --git a/board/netstar/eeprom_start.S b/board/netstar/eeprom_start.S
deleted file mode 100644
index 3609382..0000000
--- a/board/netstar/eeprom_start.S
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 2005  2N Telekomunikace
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- */
-
-.globl _start
-_start:	b	eeprom
-
-.end
-- 
1.5.3.8

  parent reply	other threads:[~2010-01-27 23:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 23:16 [U-Boot] [PATCH 0/5] NetStar updates Ladislav Michl
2010-01-27 23:18 ` [U-Boot] [PATCH 1/5] NetStar: eeprom - undefined reference to `memset' Ladislav Michl
2010-01-27 23:19 ` [U-Boot] [PATCH 2/5] NetStar: eeprom - be less verbose Ladislav Michl
2010-01-27 23:20 ` Ladislav Michl [this message]
2010-01-27 23:21 ` [U-Boot] [PATCH 4/5] NetStar: fix default environment Ladislav Michl
2010-01-27 23:22 ` [U-Boot] [PATCH 5/5] NetStar: make mtdparts default ready for recent kernels Ladislav Michl
2010-02-08 16:55 ` [U-Boot] [PATCH 0/5] NetStar updates Paulraj, Sandeep
2010-02-08 18:39   ` Ladislav Michl
2010-02-08 19:21     ` Paulraj, Sandeep
2010-02-08 21:41       ` Ladislav Michl
2010-02-08 20:45         ` Paulraj, Sandeep
2010-02-09  9:12         ` [U-Boot] [PATCH] netstar.h: do not exceed 80 columns Ladislav Michl
2010-02-18  2:22           ` Paulraj, Sandeep

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=20100127232044.GD18557@localhost.localdomain \
    --to=ladislav.michl@seznam.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.