#6 Fix symbol versioning to use symver attribute when supported and re-enable LTO
Opened 3 years ago by law. Modified 3 years ago
rpms/ law/fuse3 fix_symbol_versioning  into  master

No commits found

The patch has an meson test to verify the build compiler supports the attribute, and if it doesn't, it'll gracefully fall back to the ASM variant. While not strictly needed for Fedora, my hope is that the patch is more palatable to the upstream community given the graceful fallback to prior behavior when the attribute is not supported.

I have about 200 packages I'm working through, so I can't reasonably engage every upstream project. I'd like to merge this PR into Fedora so that LTO gets enabled for the fuse3 package and let the package maintainers enagage the appropriate upstream community so that we don't have to carry a Fedora specific patch forever.

Filed upstream: https://github.com/libfuse/libfuse/pull/545

If they merge, I will apply the change in Fedora.

Jeff, there are issues here.

Upstream uses Travis to build test, and when Travis builds it through Ubuntu Bionic with GCC 7.5.0, the meson check reports:

Message: Compiler supports symver attribute

However, the build has issues:

../../../home/travis/build/libfuse/libfuse/lib/fuse_loop_mt.c:309:1: warning: ‘symver’ attribute directive ignored [-Wattributes]

example/hello_ll@exe/hello_ll.c.o: In function `main':
582/tmp/libfuse-build-VwANJo/build-gcc/../../../home/travis/build/libfuse/libfuse/example/hello_ll.c:213: undefined reference to `fuse_session_loop_mt'
583collect2: error: ld returned 1 exit status

The original test code in meson.build just throws a warning on symver:

origtest.c:1:1: warning: ‘symver’ attribute directive ignored [-Wattributes]
 __attribute__((symver ("get@@TEST_0"))) int get_4() {
 ^~~~~~~~~~~~~

But because it compiles...

I think this might be a better test:

#if defined __has_attribute && !__has_attribute (symver)
#error symver attribute not supported
#endif

int main(void) {
return 0;
}

clang and gcc have __has_attribute, so they'll be okay here. another compiler which doesn't have __has_attribute is probably safe to use the fallback asm logic (and if not, it was broken before).

Thoughts?

I've amended this to be:


#if defined __has_attribute
# if !__has_attribute (symver)
# error symver attribute not supported
# endif
#else
#error __has_attribute not defined, assume we do not have symver
#endif

int main(void) {
return 0;
}

Thanks. I ran into something similar with the autoconf test. GCC tries to be "helpful" and only warn on the unrecognized attribute :( So yea, the amended version is better.

I'm absolutely comfortable waiting on upstream for this -- there's no pressing need to get LTO enabled for fuse3 in F33 -- I'm looking at this more in the rawhide flowing into ELN and F34 contexts.

Metadata