From 98540684dfaac1b0ef75b7d047f5b6a46a519c1b Mon Sep 17 00:00:00 2001 From: marcansoft Date: Fri, 26 Feb 2010 14:03:03 +0000 Subject: [PATCH] Link using gcc and get rid of the LIBGCC stuff GCC knows how to find libgcc, and the proper way to link C code is to use gcc, not ld. --- armsrc/Makefile | 4 ++-- common/Makefile.common | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/armsrc/Makefile b/armsrc/Makefile index 045e1fba..cc3e4a27 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -49,8 +49,8 @@ all: $(OBJDIR)/osimage.s19 $(OBJDIR)/fpgaimage.s19 $(OBJDIR)/fpga.o: fpga.bit $(OBJCOPY) -O elf32-littlearm -I binary -B arm --redefine-sym _binary____fpga_fpga_bit_start=_binary_fpga_bit_start --redefine-sym _binary____fpga_fpga_bit_end=_binary_fpga_bit_end --prefix-sections=fpga_bit $^ $@ -$(OBJDIR)/fullimage.elf: $(VERSIONOBJ) $(OBJDIR)/fpga.o $(THUMBOBJ) $(ARMOBJ) $(LIBGCC) - $(LD) -g -Tldscript -Map=$(patsubst %.elf,%.map,$@) -o $@ $^ +$(OBJDIR)/fullimage.elf: $(VERSIONOBJ) $(OBJDIR)/fpga.o $(THUMBOBJ) $(ARMOBJ) + $(CC) $(LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) $(OBJDIR)/fpgaimage.elf: $(OBJDIR)/fullimage.elf $(OBJCOPY) -F elf32-littlearm --only-section .fpgaimage $^ $@ diff --git a/common/Makefile.common b/common/Makefile.common index 6fb2045f..aa6049e3 100644 --- a/common/Makefile.common +++ b/common/Makefile.common @@ -40,9 +40,6 @@ COPY=cp PATHSEP=/ FLASH_TOOL=client/flasher DETECTED_OS=UNAME -# You may/should set this in your environment -LIBGCC ?= $(shell $(CC) -print-libgcc-file-name) -PATH := $(PATH):$(DEVKITARM)/bin else @@ -51,7 +48,6 @@ DELETE=del /q MOVE=ren COPY=copy PATHSEP=\\# -LIBGCC ?= ../../devkitARM/lib/gcc/arm-elf/4.1.0/interwork/libgcc.a FLASH_TOOL=winsrc\\prox.exe DETECTED_OS=Windows @@ -64,6 +60,8 @@ VPATH = . ../common/ ../fpga/ INCLUDES = ../include/proxmark3.h ../include/at91sam7s512.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES) CFLAGS = -c $(INCLUDE) -Wall -Werror -pedantic -std=gnu99 $(APP_CFLAGS) +LDFLAGS = -nostartfiles -nodefaultlibs -Wl,-gc-sections -n +LIBS = -lgcc THUMBOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(THUMBSRC)) ARMOBJ = $(ARMSRC:%.c=$(OBJDIR)/%.o) -- 2.39.2