link01 - Produce undefined list from relocatable and link errors

This helps when tracking down how many undefined symbols there
are and where they were defined.
This commit is contained in:
Joel Sherrill 2012-04-05 14:01:54 -05:00
parent c613894a89
commit 10c59c782c
2 changed files with 40 additions and 6 deletions

View File

@ -5,6 +5,7 @@
include ../../config.inc include ../../config.inc
PGM=${ARCH}/link01.exe PGM=${ARCH}/link01.exe
PGM_R=${ARCH}/link01_r.exe
# optional managers required # optional managers required
MANAGERS=all MANAGERS=all
@ -14,7 +15,7 @@ C_FILES = test.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
AM_CPPFLAGS += -I $(INSTALL_BASE)/include AM_CPPFLAGS += -I $(INSTALL_BASE)/include
LINK_LIBS += $(INSTALL_BASE)/libbsd.a -Wl,-r LINK_LIBS += $(INSTALL_BASE)/libbsd.a ${REL_ARGS}
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM) include $(RTEMS_CUSTOM)
@ -23,10 +24,12 @@ include $(PROJECT_ROOT)/make/leaf.cfg
OBJS= $(C_O_FILES) OBJS= $(C_O_FILES)
CLEAN_ADDITIONS += undefined.txt CLEAN_ADDITIONS += undefined.txt
all: ${ARCH} $(PGM) all: ${ARCH} $(PGM_R) $(PGM)
$(NM) $(PGM_R) | grep "U " >undefined.txt
@echo `cat undefined.txt | wc -l` symbols to resolve
$(PGM): $(OBJS) $(PGM): $(OBJS)
$(make-exe) -$(make-exe)
$(NM) $(PGM) | grep "U " >undefined.txt
@echo `cat undefined.txt | wc -l` symbols to resolve $(PGM_R): $(OBJS)
@test `cat undefined.txt | wc -l` -ne 0 && exit 1 $(MAKE) -f Makefile_ldr

View File

@ -0,0 +1,31 @@
#
# $Id$
#
include ../../config.inc
PGM=${ARCH}/link01_r.exe
# optional managers required
MANAGERS=all
# C source names
C_FILES = test.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
AM_CPPFLAGS += -I $(INSTALL_BASE)/include
LINK_LIBS += $(INSTALL_BASE)/libbsd.a -Wl,-r
include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg
OBJS= $(C_O_FILES)
CLEAN_ADDITIONS += undefined.txt
all: ${ARCH} $(PGM)
$(PGM): $(OBJS)
$(make-exe)
# @test `cat undefined.txt | wc -l` -ne 0 && exit 1