Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 729268

Summary: sys-libs/compiler-rt-10.0.0 does not provide BlocksRuntime library for -fblocks
Product: Gentoo Linux Reporter: Sergei Trofimovich (RETIRED) <slyfox>
Component: Current packagesAssignee: LLVM support project <llvm>
Status: RESOLVED INVALID    
Severity: normal CC: mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 729256    

Description Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-23 07:21:49 UTC
Popped up in https://bugs.gentoo.org/729256 where honggfuzz uses blocks to implement destructors in C on clang.

https://stackoverflow.com/questions/5907071/clang-block-in-linux provides a cmall example that should work:

$ cat c.c
#include <stdio.h>

int main() {
    void (^hello)(void) = ^(void) {
        printf("Hello, block!\n");
    };
    hello();
    return 0;
}

$ LANG=C clang -fblocks c.c -lBlocksRuntime
/usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lBlocksRuntime
/usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible libgcc_s.so.1 when searching for libgcc_s.so.1
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-06-23 21:16:41 UTC
Is it supposed to be provided?  A quick grep over CMakeLists.txt doesn't reveal any rules to build these files.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-26 16:08:57 UTC
Other distributions package it from somewhere else. I can do the same.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-06-26 17:06:32 UTC
If 'somewhere else' is a LLVM project, I still think it's better to be maintained by LLVM team.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-06-26 17:08:33 UTC
It is 6 years old fork of compiler-rt: https://github.com/mackyle/blocksruntime
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2020-06-26 17:19:11 UTC
If you have some free time (yeah!), maybe try to submit CMakeLists.txt for building it from compiler-rt ;-).