nm: also retrieve size for COFF function symbols

Like ELF for all symbols, COFF can record size for at least function
ones. Use that - if available - in preference to the distance-to-next-
symbol heuristic.

To be able to use the new test there, make TI C54x follow TI C4x in
providing .sdef to cover for .def already having different meaning.
This commit is contained in:
Jan Beulich
2025-04-07 12:45:11 +02:00
parent 50491ef1d3
commit 6fe5e01b13
5 changed files with 78 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
.globl text_symbol1
.globl text_symbol2
.globl text_symbol3
.macro ENDFN name:req
.def \name
.type 0x20 /* DT_FUNC */
.scl 2 /* C_EXT */
.endef
.def \name
.scl 0xff /* C_EFCN */
.val .
.endef
.endm
.text
text_symbol1:
.long 0
.long 0
.long 0
ENDFN text_symbol1
text_symbol2:
.long 0
.long 0
ENDFN text_symbol2
text_symbol3:
.long 0
ENDFN text_symbol3

View File

@@ -0,0 +1,26 @@
.globl text_symbol1
.globl text_symbol2
.globl text_symbol3
.macro ENDFN name:req
.sdef \name
.type 0x20 /* DT_FUNC */
.scl 2 /* C_EXT */
.endef
.sdef \name
.scl 0xff /* C_EFCN */
.val .
.endef
.endm
.text
text_symbol1:
.byte 0,0,0,0
.byte 0,0,0,0
.byte 0,0,0,0
ENDFN text_symbol1
text_symbol2:
.byte 0,0,0,0
.byte 0,0,0,0
ENDFN text_symbol2
text_symbol3:
.byte 0,0,0,0
ENDFN text_symbol3

View File

@@ -163,6 +163,12 @@ if { [is_elf_format]
|| [istarget wasm32-*-*]
|| [istarget bpf-*-*]} {
set nm_1_src "nm-elf-1.s"
} elseif {[is_coff_format] && ![istarget arm*-*-*]} {
if {[istarget *c4x-*-*] || [istarget *c54x-*-*]} {
set nm_1_src "nm-coff-sdef-1.s"
} else {
set nm_1_src "nm-coff-1.s"
}
} else {
set nm_1_src "nm-1.s"
}