Skip to content

sync.stdatomic: add GCC 15/16 libatomic paths for TCC on Linux - #28044

Open
nepinhum wants to merge 2 commits into
vlang:masterfrom
nepinhum:fix/stdatomic-tcc-gcc16
Open

sync.stdatomic: add GCC 15/16 libatomic paths for TCC on Linux#28044
nepinhum wants to merge 2 commits into
vlang:masterfrom
nepinhum:fix/stdatomic-tcc-gcc16

Conversation

@nepinhum

@nepinhum nepinhum commented Aug 6, 2026

Copy link
Copy Markdown

Fixes #28043

Also adds a regression test (vlib/sync/stdatomic/tcc_libatomic_linux_test.v) that builds and runs a small sync.stdatomic program with -cc tcc -no-retry-compilation.

  • Reproduced the original bug on Arch Linux, GCC 16.1.1 with
    v -cc tcc -no-retry-compilation -showcc -keepc run test.v
  • Confirmed the fix resolves it, the tcc response file now
    includes /usr/lib/gcc/x86_64-pc-linux-gnu/16/libatomic.a
    and the program compiles and runs correctly
  • v test vlib/sync/stdatomic/ all pass
  • v test vlib/v/cflag/ pass
  • v fmt -verify on changed files
  • v vet on changed files
  • New test verified to fail against the pre-fix code, pass after

@medvednikov medvednikov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Arch/EndeavourOS (x86_64-pc-linux-gnu) additions and the no-fallback compile/run regression test look appropriate. However, the amd64 path table still omits Debian/Ubuntu's x86_64-linux-gnu GCC layout, so this same GCC 15/16 linker failure remains on that distro family. I also noted a minor issue-reference correction in the test comment.

$if amd64 {
// Redhat/CentOS:
#flag $when_first_existing('/usr/lib/gcc/x86_64-redhat-linux/6/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/7/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/8/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/9/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/10/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/11/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/12/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/13/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/14/libatomic.a')
#flag $when_first_existing('/usr/lib/gcc/x86_64-redhat-linux/6/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/7/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/8/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/9/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/10/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/11/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/12/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/13/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/14/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/15/libatomic.a','/usr/lib/gcc/x86_64-redhat-linux/16/libatomic.a')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add/restore the Debian/Ubuntu amd64 candidates here as well: /usr/lib/gcc/x86_64-linux-gnu/{6..16}/libatomic.a. GCC installs libatomic.a under this target triple on Debian-family x86_64 systems, and this block currently has no matching entry (unlike the arm64 block). Without those paths, the same __atomic_*_8 link failure remains on Debian/Ubuntu systems using GCC 15/16.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alr, sent a new commit / done.

}
'

// This is a regression test for https://github.com/vlang/v/issues/28027 (and similar reports),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should reference issue #28043. #28027 is the earlier stdatomic.h compatibility PR and covers a different failure.

@nepinhum

nepinhum commented Aug 9, 2026

Copy link
Copy Markdown
Author

Wanted to say sorry for the delay, I’m on vacation and only just got a chance to review the feedback.

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.

sync.stdatomic fails to link under TCC with GCC 16 libatomic paths (not duplicate!)

2 participants