Here are my patches which supplement Magnus’s:
porting build_vm_def.sh from bsd-port/jdk8 repo, to fix NM errors during build
The next patches where less straightforward. When running java I was getting a ton of messages like:
Thread 832744400 has exited with leftover thread-specific data after 4 destructor iterations
After doing a lot of digging and debugging on Linux, I found the code path for Linux was identical for Freebsd and the cleanup destructor was being executed 4 times just like Freebsd, the difference being that Freebsd would print out this benign warning while Linux would just ignore it. The problem is that all threads that are created and initialize TLS current thread data, must clean them up by explicitly setting the TLS current thread to null. I’ve come up with two approaches to accomplish this.