Makefile: Generate Map file for each firmware
PATCH 1/1 Makefile: Generate Map file for each firmware
Currently, OpenSBI does not generate Map file. This patch allows OpenSBI generates Map file for each firmware. This comes in handy in debugging process as Map file gives detailed information about the symbols in our program.
--- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile +3 -1
@@ -445,7 +445,7 @@ compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ $(AS) $(ASFLAGS) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1) compile_elf = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " ELF $(subst $(build_dir)/,,$(1))"; \ - $(CC) $(CFLAGS) $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1) + $(CC) $(CFLAGS) -Wl,-Map=$(basename $(1)).map $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1) compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " AR $(subst $(build_dir)/,,$(1))"; \ $(AR) $(ARFLAGS) $(1) $(2)
@@ -669,6 +669,8 @@ clean: $(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.dtb") $(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.map") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.map" -exec rm -rf {} + # Rule for "make distclean" .PHONY: distclean
Signature · 1 line
2.38.1
PATCH 1/1 Makefile: Generate Map file for each firmware
Quoted 6 lines · Jun Liang Tan
Currently, OpenSBI does not generate Map file. This patch allows OpenSBI generates Map file for each firmware. This comes in handy in debugging process as Map file gives detailed information about the symbols in our program.
How and why? Isn?t this just a bunch of tracing for how the linker laid the binary out? I really don?t see how this is particularly useful, it definitely shouldn?t be on by default and the file format varies wildly between GNU ld and LLVM LLD anyway.
What are you trying to do that you can?t do with an unstripped ELF?
Quoted 11 lines
Signed-off-by Jun Liang Tan <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>---
Makefile| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Makefile +0
-0
Makefile compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ · line 448
Quoted 5 lines
Makefile +1
-1@@ -445,7 +445,7 @@ compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ $(AS) $(ASFLAGS) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1) compile_elf = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " ELF $(subst $(build_dir)/,,$(1))"; \ - $(CC) $(CFLAGS) $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1) + $(CC) $(CFLAGS) -Wl,-Map=$(basename $(1)).map $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1)
This is clearly not the right path to use.
Jess
Quoted 20 lines
Makefile +2
-0compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " AR $(subst $(build_dir)/,,$(1))"; \ $(AR) $(ARFLAGS) $(1) $(2)@@ -669,6 +669,8 @@ clean: $(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.dtb") $(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.map") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.map" -exec rm -rf {} + # Rule for "make distclean".PHONY: distclean
Signature · 7 lines
2.38.1 -- opensbi mailing list opensbi at lists.infradead.org http://lists.infradead.org/mailman/listinfo/opensbi
PATCH 1/1 Makefile: Generate Map file for each firmware
Quoted 16 lines
-----Original Message-----
From: Jessica Clarke <[email protected]>
Sent: Tuesday, March 21, 2023 12:33 AM
To: JunLiang Tan <[email protected]>
Cc: opensbi at lists.infradead.org; Cheehong Ang <[email protected]>
Subject: Re: [PATCH]Makefile: Generate Map file for each firmwareQuoted 5 lines · Jun Liang Tan
Currently, OpenSBI does not generate Map file.
This patch allows OpenSBI generates Map file for each firmware. This comes in handy in debugging process as Map file gives detailed information about the symbols in our program.
Quoted 6 lines
How and why? Isn?t this just a bunch of tracing for how the linker laid the binary out? I really don?t see how this is particularly useful, it definitely shouldn?t be on by default and the file format varies wildly between GNU ld and LLVM LLD anyway.
What are you trying to do that you can?t do with an unstripped ELF?
Yes. We knew there are other ways to trace the binary layout.
We find it handy to generate .map file (just like U-Boot did) for quick reference in editor. Just pass this one if it's not relevant.
Quoted 46 lines
Makefile compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`;
Quoted 12 lines
Signed-off-by Jun Liang Tan <[email protected]>Reviewed-by Chee Hong Ang <[email protected]>---
Makefile| 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)Makefile +0
-0@@ -445,7 +445,7 @@ compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`;\
Makefile compile_as = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \
Quoted 6 lines
Makefile +2
-1$(AS) $(ASFLAGS) $(call dynamic_flags,$(1),$(2)) -c $(2) -o $(1) compile_elf = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " ELF $(subst $(build_dir)/,,$(1))"; \ - $(CC) $(CFLAGS) $(3) $(ELFFLAGS) -Wl,-T$(2) -o $(1) + $(CC) $(CFLAGS) -Wl,-Map=$(basename $(1)).map $(3) $(ELFFLAGS) +-Wl,-T$(2) -o $(1)This is clearly not the right path to use.
Jess
Quoted 22 lines
Makefile +0
-0compile_ar = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " AR $(subst $(build_dir)/,,$(1))"; \$(AR) $(ARFLAGS) $(1) $(2)Makefile +4
-0@@ -669,6 +669,8 @@ clean: $(CMD_PREFIX)find $(build_dir) -type f -name "*.bin" -exec rm -rf {} + $(if $(V), @echo " RM $(build_dir)/*.dtb") $(CMD_PREFIX)find $(build_dir) -type f -name "*.dtb" -exec rm -rf {} + + $(if $(V), @echo " RM $(build_dir)/*.map") + $(CMD_PREFIX)find $(build_dir) -type f -name "*.map" -exec rm -rf {} ++# Rule for "make distclean"
.PHONY: distclean
--
2.38.1--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi