Compiler fails with 'fatal error: error in backend: A @@ version cannot be undefined'.
Created attachment 200846 [details] Compiler diagnostic data: preprocessed source
Created attachment 200847 [details] Compiler diagnostic data: run script
I can reproduce this, and it looks almost the same as <https://bugs.llvm.org/show_bug.cgi?id=39270>. Mostly minimized: /* clang -cc1 -triple x86_64-- -emit-obj glfs-min.c */ #define STR(str) #str #define GFAPI_SYMVER_PRIVATE_DEFAULT(fn, ver) \ asm(".symver priv_"STR(fn)", "STR(fn)"@@GFAPI_PRIVATE_"STR(ver)) GFAPI_SYMVER_PRIVATE_DEFAULT(foo, 1.0); Minimized even more: /* clang -cc1 -triple x86_64-- -emit-obj glfs-min.c */ asm(".symver a,b@@c"); The upstream bug report is sitting there since 2018-10-13 without any activity, I'll see if I can poke somebody.
A commit references this bug: Author: dim Date: Wed Feb 13 20:13:40 UTC 2019 New revision: 344112 URL: https://svnweb.freebsd.org/changeset/base/344112 Log: Pull in r353907 from upstream llvm trunk (by Reid Kleckner): [MC] Make symbol version errors non-fatal We stil don't have a source location, which is pretty lame, but at least we won't tell the user to file a clang bug report anymore. Fixes PR40712 This will make errors for symbols with @@ versions that are not defined non-fatal. For example: void f(void) { __asm__(".symver foo,bar@@baz"); } will now result in: error: versioned symbol bar@@baz must be defined instead of clang crashing with a diagnostic report. PR: 234671 Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40712 MFC after: 3 days Changes: head/contrib/llvm/lib/MC/ELFObjectWriter.cpp
A commit references this bug: Author: dim Date: Sat Feb 16 19:49:13 UTC 2019 New revision: 344217 URL: https://svnweb.freebsd.org/changeset/base/344217 Log: MFC r344112: Pull in r353907 from upstream llvm trunk (by Reid Kleckner): [MC] Make symbol version errors non-fatal We stil don't have a source location, which is pretty lame, but at least we won't tell the user to file a clang bug report anymore. Fixes PR40712 This will make errors for symbols with @@ versions that are not defined non-fatal. For example: void f(void) { __asm__(".symver foo,bar@@baz"); } will now result in: error: versioned symbol bar@@baz must be defined instead of clang crashing with a diagnostic report. PR: 234671 Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=40712 Changes: _U stable/11/ stable/11/contrib/llvm/lib/MC/ELFObjectWriter.cpp _U stable/12/ stable/12/contrib/llvm/lib/MC/ELFObjectWriter.cpp
After merging the upstream fixes, clang won't crash anymore with a fatal error. It still will refuse to compile the glfs.c file though, now with: error: versioned symbol glfs_upcall_register@@GFAPI_3.13.0 must be defined error: versioned symbol glfs_upcall_unregister@@GFAPI_3.13.0 must be defined 2 errors generated. Indeed, this is an error in the code, which seems to have been fixed in this upstream commit (together with a lot of other symbol breakage): https://github.com/gluster/glusterfs/commit/b4ce5e090dee2afc9ed0c86456a54f76a2bb6563 Can you try applying that, or at least parts of it? Alternatively, a minimal fix is: --- a/glfs.c 2019-01-10 08:57:50.000000000 +0100 +++ b/glfs.c 2019-02-16 21:45:03.999966000 +0100 @@ -48952,7 +48952,7 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_sysrq, 3.10.0); int -glfs_upcall_register (struct glfs *fs, uint32_t event_list, +pub_glfs_upcall_register (struct glfs *fs, uint32_t event_list, glfs_upcall_cbk cbk, void *data) { int ret = 0; @@ -49003,7 +49003,7 @@ } GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_register, 3.13.0); -int glfs_upcall_unregister (struct glfs *fs, uint32_t event_list) +int pub_glfs_upcall_unregister (struct glfs *fs, uint32_t event_list) { int ret = 0; /* list of supported upcall events */
^Triage: clear stale flags. To submitter: is this aging PR still relevant?