Skip to contentSkip to conversation

Add support for generating assembly listing files

PATCH New timur at freescale.com 1 participant 1 message Jan 11, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add support for generating assembly listing files

From: Timur Tabi <[email protected]>

This patch adds support for generating assembly listing files when building U-Boot. When "LISTING=1" is specified on the "make" command line, each compiled .c and .S file will generate a .lst file in the same location as the corresponding .o file. Assembly listing files contain the assembly instructions and opcodes that the compiler generates.

---
 Makefile  |    2 +-
 README    |   15 +++++++++++++++
 config.mk |   20 +++++++++-----------
 3 files changed, 25 insertions(+), 12 deletions(-)
Makefile +1 -1
index a973dff..1dbdf4d 100644
@@ -2302,7 +2302,7 @@ atstk1002_config	:	unconfig
 clean:
 	find $(OBJTREE) -type f \
 		\( -name 'core' -o -name '*.bak' -o -name '*~' \
-		-o -name '*.o'  -o -name '*.a'  \) -print \
+		-o -name '*.o'  -o -name '*.a' -o -name '*.lst' \) -print \
 		| xargs rm -f
 	rm -f $(obj)examples/hello_world $(obj)examples/timer \
 	      $(obj)examples/eepro100_eeprom $(obj)examples/sched \
README +15 -0
index ecfd1f8..f6bef2d 100644
@@ -2425,6 +2425,21 @@ this behavior and build U-Boot to some e
 Note that the command line "O=" setting overrides the BUILD_DIR environment
 variable.
 
+To generate an assembly listing file for each source file (.c and .S), add
+"LISTING=1" on the make command line when building your image:
+
+	make LISTING=1 all
+
+or
+
+	make O=/tmp/build LISTING=1 all
+
+A listing file contains the assembly instructions (with opcodes) that the 
+compiler generated when it compiled a source file.  Each listing file will be 
+located in the same place as the corresponding .o file, and it will have 
+a .lst extension.  Listing files are useful when you want to examine the
+compiler's output, which may not be what you expect.  They are also useful
+with hardware debuggers that do not support source code.
 
 Please be aware that the Makefiles assume you are using GNU make, so
 for instance on NetBSD you might need to use "gmake" instead of
config.mk +9 -11
index 6e280bc..a3c88c7 100644
@@ -224,22 +224,20 @@ export	TEXT_BASE PLATFORM_CPPFLAGS PLATF
 
 #########################################################################
 
-ifndef REMOTE_BUILD
-
-%.s:	%.S
-	$(CPP) $(AFLAGS) -o $@ $<
-%.o:	%.S
-	$(CC) $(AFLAGS) -c -o $@ $<
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
-else
-
 $(obj)%.s:	%.S
 	$(CPP) $(AFLAGS) -o $@ $<
+
 $(obj)%.o:	%.S
+ifdef LISTING
+	$(CC) $(AFLAGS) -Wa,-alds=$(@D)/$(*F).lst -c -o $@ $<
+else
 	$(CC) $(AFLAGS) -c -o $@ $<
+endif
+
 $(obj)%.o:	%.c
+ifdef LISTING
+	$(CC) $(CFLAGS) -Wa,-alds=$(@D)/$(*F).lst -c -o $@ $<
+else
 	$(CC) $(CFLAGS) -c -o $@ $<
 endif
 
Signature · 1 line
1.4.4