Page MenuHomeFreeBSD

riscv: also enable stats and stats_client in libclang_rt

Authored by pkubaj on Apr 1 2022, 7:02 PM.



I found they build after enabling COMPILER_RT in devel/llvm-devel.

Test Plan

make buildworld with riscv64 and riscv64sf

Diff Detail

rG FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pkubaj requested review of this revision.Apr 1 2022, 7:02 PM
  • powerpc: implement __clear_cache

Remove powerpc-related change.

Sure. Were you able to test them? (I assume they compile, but not sure if it's easy to do a check if the stats libs work... :)

This revision is now accepted and ready to land.Apr 1 2022, 7:28 PM
  • powerpc: add GENERIC64LE-NODEBUG config and improve GENERIC64-NODEBUG
This revision now requires review to proceed.Apr 2 2022, 8:04 PM

Also add includes directory, I didn't notice it earlier.

How do I test it? I only tested build-time. I'm trying to compare to amd64, but even there I'm having issues. According to, I need Statistic.h, but this is not installed. And when using llvm13 from ports:

clang++13 -S -emit-llvm -I /usr/local/llvm13/include/ -I /usr/include/c++/v1 helloworld.c
llc helloworld.ll
clang++13 helloworld.s

ld: error: undefined symbol: llvm::TrackingStatistic::RegisterStatistic()
>>> referenced by helloworld.c
>>>               /tmp/helloworld-19b012.o:(llvm::TrackingStatistic::init())
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)

The file I use for testing is:

#include <iostream>
#include <llvm/ADT/Statistic.h>

#define DEBUG_TYPE "mypassname"   // This goes after any #includes.
STATISTIC(NumXForms, "The # of times I did stuff");

int main()
    std::cout << "Hello, World!" << std::endl;
    ++NumXForms;   // I did stuff!

    return 0;

If I just try to use opt on ll file:

opt13 -stats -mypassname < helloworld.ll > /dev/null

I end up with:

opt: Unknown command line argument '-mypassname'.  Try: '/usr/local/llvm13/bin/opt --help'
opt: Did you mean '--metarenamer'?
This comment was removed by pkubaj.

Sigh, another arc confusion.

In I showed how I tried to test it. Are stats broken on FreeBSD after all?

This revision was not accepted when it landed; it landed in state Needs Review.May 16 2022, 9:57 PM
This revision was automatically updated to reflect the committed changes.