All SVE functions cannot be debugged with GDB because of the missing .text declaration in the asm file.
- Dominant language
- C
- Stars
- 301
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
I found that all SVE functions cannot be debugged with GDB. This is because the code segment identifier of `.text` is missing in the SVE function code implementation. As a result, GDB cannot find executable assembly code. You can use the `objdump -d` to verify this problem:
```sh
# objdump -d sm3_mb/aarch64/sm3_mb_sve.o
sm3_mb/aarch64/sm3_mb_sve.o: file format elf64-littleaarch64
[no assembler contents of executable sections]
```
If we add `.text` to the sm3_mb/aarch64/sm3_mb_sve.S:
```asm
...
60 #include "sm3_sve_common.S"
61
62 .text // <--- this line
63 /* int sm3_mb_sve_max_lanes()
64 * return : max lanes of SVE vector
65 */
66 .global sm3_mb_sve_max_lanes
67 .type sm3_mb_sve_max_lanes, %function
68 sm3_mb_sve_max_lanes:
...
```
We can see:
```sh
sm3_mb/aarch64/sm3_mb_sve.o: file format elf64-littleaarch64
Disassembly of section .text:
0000000000000000 :
0: 04a0e3e0 cntw x0
4: d65f03c0 ret
0000000000000008 :
8: 3401bf80 cbz w0, 37f8
c: 6dbc27e8 stp d8, d9, [sp, #-64]!
10: 6d012fea stp d10, d11, [sp, #16]
14: 6d0237ec stp d12, d13, [sp, #32]
18: 6d033fee stp d14, d15, [sp, #48]
1c: 910003ea mov x10, sp
20: 52800007 mov w7, #0x0
...
```
and use GDB Debug this function:
```
Breakpoint 1, sm3_mb_sve_max_lanes () at sm3_mb/aarch64/sm3_mb_sve.S:69
69 cntw x0
(gdb) l
66 .global sm3_mb_sve_max_lanes
67 .type sm3_mb_sve_max_lanes, %function
68 sm3_mb_sve_max_lanes:
69 cntw x0
70 ret
71 .size sm3_mb_sve_max_lanes, .-sm3_mb_sve_max_lanes
```
So I think we should add `.text` for all SVE functions, including: `md5_mb_sve.S`, `mh_sha1_block_sve.S`, `sm3_mb_sve.S`. and and should be followed by `#inlude "xxxxx.S"`.
Contributor guide
Research direction
Inspect md5_mb_sve.S, mh_sha1_block_sve.S, and sm3_mb/aarch64/sm3_mb_sve.S, starting by running objdump -d on the affected object file. Add the missing .text declarations as described, then verify that objdump shows executable .text contents and that GDB can locate and step through the SVE functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100