Skip to content

sync.stdatomic: workaround libatomic.a indirect symbols tcc bug#24472

Merged
spytheman merged 1 commit into
vlang:masterfrom
kbkpbot:fix-aarch64-libatomic
May 13, 2025
Merged

sync.stdatomic: workaround libatomic.a indirect symbols tcc bug#24472
spytheman merged 1 commit into
vlang:masterfrom
kbkpbot:fix-aarch64-libatomic

Conversation

@kbkpbot

@kbkpbot kbkpbot commented May 13, 2025

Copy link
Copy Markdown
Contributor

Fix issue #23924

This is due to a tcc bug handling indirect(IFUNC) symbols in .a.
I think it should generate a GOT/PLT in output elf file.
It can't determine the symbol's address at compile time.
https://lists.nongnu.org/archive/html/tinycc-devel/2025-05/msg00010.html

$ uname -a
Linux armbian 5.15.49-flippy-74+o #134 SMP PREEMPT Wed Jun 22 22:05:04 CST 2022 aarch64 aarch64 aarch64 GNU/Linux

$ nm libatomic.a | grep __atomic_fetch_add
nm: init.o:无符号
0000000000000050 i __atomic_fetch_add_1
0000000000000050 i __atomic_fetch_add_2
0000000000000050 i __atomic_fetch_add_4
0000000000000050 i __atomic_fetch_add_8
00000000000000b0 i __atomic_fetch_add_16

The i show above mean IFUNC(indrect) symbol.

$ uname -a
Linux mars-QiTianM428-A688 6.8.0-59-generic #61-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 11 23:16:11 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

$ nm libatomic.a | grep __atomic_fetch_add
0000000000000000 T __atomic_fetch_add_1
0000000000000000 T __atomic_fetch_add_2
0000000000000000 T __atomic_fetch_add_4
0000000000000000 T __atomic_fetch_add_8
0000000000000090 i __atomic_fetch_add_16

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22841

@kbkpbot kbkpbot linked an issue May 13, 2025 that may be closed by this pull request

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit a3f4b06 into vlang:master May 13, 2025
70 checks passed
@kbkpbot kbkpbot deleted the fix-aarch64-libatomic branch May 13, 2025 13:27
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

Successfully merging this pull request may close these issues.

make stuck under ARM/Linux

2 participants