Microblaze gcc can't use .symver attribute leading to: error: symver is only supported on ELF platforms This is a simple test-case(taken from libfuse3) that reproduce the problem: ''' # if !__has_attribute (symver) # error symver attribute not supported # endif #else #error __has_attribute not defined, assume we do not have symver #endif __attribute__ ((symver ("fuse_new@FUSE_3.0"))) void func1(void) { } int main(void) { return 0; } ''' The problem is the discrepancy I've found between __has_attribute(symver) that return true, while in gcc/gcc/config.gcc 'elfos.h' is not listed under Microblaze cases. Trying adding elfos.h to it leads to other linker problems and this makes me think that Microblaze doesn't actually support __ELF__(symver). So I thought to build gcc using --disable-symvers explictly until a fix is found, but that doesn't either work. Can you please give help? Thanks a lot!
__has_attribute is broken for many attributes. If GCC supports them in a generic way but does not really support them, __has_attribute still returns true.
Ah ok, so the workaround is to check with a little build test, right?
I've done this: https://github.com/libfuse/libfuse/pull/620/commits/3aba09a5c56e017746c5c1652dbc845f4db7374a and works fine. It doesn't seem to have pitfalls.
*** Bug 102110 has been marked as a duplicate of this bug. ***
There's a mail discussion about this topic https://gcc.gnu.org/pipermail/gcc/2023-March/240834.html The "easy" route is to just add the proper macro to config/microblaze/microblaze.h The more correct, but more arduous, route is "porting" microblaze to correctly use the elfos.h header and provide the proper overrides in a separate header. I've tested the former with zero issues and tested a version of the latter and was able to compile both a kernel and ramfs and successfully boot but doubt all cases are accounted for. attaching patches for posterity
Created attachment 54645 [details] add macro to microblaze.h
Created attachment 54646 [details] partial patch for microblaze migration to elfos.h