Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All SVE functions cannot be debugged with GDB because of the missing .text declaration in the asm file. #125

Open
chenxuqiang opened this issue Oct 9, 2023 · 6 comments

Comments

@chenxuqiang
Copy link
Contributor

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:

# 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:

...
 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:

sm3_mb/aarch64/sm3_mb_sve.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <sm3_mb_sve_max_lanes>:
       0:       04a0e3e0        cntw    x0
       4:       d65f03c0        ret

0000000000000008 <sm3_mb_sve>:
        8:       3401bf80        cbz     w0, 37f8 <sm3_mb_sve+0x37f0>
        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".

@pablodelara
Copy link
Contributor

Thanks for reporting @chenxuqiang. Anyone from ARM that can review this issue and issue #124? Also, @chenxuqiang, feel free to submit a PR with these changes.

@docularxu
Copy link

docularxu commented Nov 27, 2023

This issue relates to gcc (or GNU as)'s default behavior actually. It's not a SVE assembly issue. I explained in #127 (comment)

I would suggest to add '.text' declaration explicitly in all .S files where it's needed.

@pablodelara
Copy link
Contributor

@chenxuqiang, could you look into the other .S files?

@chenxuqiang
Copy link
Contributor Author

Thanks @docularxu @pablodelara , I'm going to fix it before April 7th.

@pablodelara
Copy link
Contributor

Thanks @chenxuqiang!

@pablodelara
Copy link
Contributor

pablodelara commented Apr 21, 2024

@chenxuqiang We are looking at a release next month, so could you look into this as soon as you can? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants