I am compiling a project with armcc : It has following flags:
ASFLAGS := -g --fpu None $(addprefix -i,$(INCL)) --apcs /interwork ASFLAGS += --diag_error=warning,193 CFLAGS := -g --split_sections --c99 --gnu --depend_dir=$(OBJ_PATH) --no_depend_system_headers --md CFLAGS += --enum_is_int CFLAGS += --diag_error=warning,193,1301,2530 --remarks CFLAGS += --diag_suppress=2815 CFLAGS += --diag_remark=1215 #CFLAGS += -O0 CFLAGS += -O3 CFLAGS += -Otime $(TARTGET):="Mytarget" LDFLAGS := $(INSTRUCTION) --info=totals --info=unused --info=sizes --callgraph --map --symbols --scatter=$(SCAT_FILE) --list $(TARGET).map LDFLAGS += --datacompressor=off --library_type=microlib --entry=0xFFFF0000
this generates a map file and also i have fromelf binary to generate the asm.
fromelf $(TARGET).axf -c > $(TARGET).asm
However in the output *.map(memory) file
i am unable to see API names I added to the build under the main function if the Optimization3 (-O3 ) flags is set, removing it brings back the api names
e.gsource: main.c
test_func() { <assume code is present here> } main() { .....<assume some code is present here>..... test_func() .....<assume some code is present here>..... }
*.map (with O3)
main 0xffff2218 ARM Code 152 main.o(i.main) util_print 0xffff22c0 ARM Code 40 util_print.o(i.util_print) harm_reset_handler 0xffff22ec ARM Code 0 host_reset.o(reset)
source: *.map (with -O0)
main 0xffff2218 ARM Code 152 main.o(i.main) test_func 0xffff22c0 ARM Code 40 test_func.o(i.test_func) util_print 0xffff22ec ARM Code 40 util_print.o(i.util_print) harm_reset_handler 0xffff24f4 ARM Code 0 host_reset.o(reset)
My Question is is there a way to generate the map file with the -O3 turned ON but still not have the function symbol missing from *.map and *.asm files?
the example only shows api names being called from the function , i did not add actual code of the main and the test function API for the example. you may assume valid code in these spots.
__noinline attribute works. Although i cannot make code changes to these source files, just the build system.
Intent here is to not change the function but the build to not optimize normal (not inline)functions to be optimized to a inline by default. all the while maintaining the other -O3 optimizations.
The final goal is to maintin the -O3 flag and still have symbols show up int the *.map and *.asm files.
Regards,
Tejas Joshi
the code base is scattered with API calls with __inline and __forceinline attributes. changing the build to --no_inline will have the following effect:
1. APIs defined as __inline attribute would no longer be inlined?
2. APIs defined with __forceinline attribute would still be inlined overriding the compiler flag
This(1.) would require change _inline to __forceinline attribute(if intended by the code creator).
Think there no way around the code modification ...