News for hackers. Stuff that matters.
Re:LLVM 8.0.0 Release by zegl on Wednesday March 20, 2019 @09:43AM (#19442022)
I've been wanting to test out the LLVM IR to WebAssembly compilation, but I've been too lazy (or impatient) to compile LLVM from source. Nice to see that it's now enabled by default!
Re:LLVM 8.0.0 Release by slacka on Wednesday March 20, 2019 @10:14AM (#19442364)
There truly is nothing to it. I just built it for the first time on this fresh install of Ubuntu. You can just copy and paste the lines from the getting started page.[1] Here's my .bash_history:

  $ git clone https://github.com/llvm/llvm-project.git
  $ cd llvm-project
  $ mkdir build && cd build
  $ cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
  $ make -j4 
Took < 40 min on an old laptop.

[1] https://clang.llvm.org/get_started.html

Re:LLVM 8.0.0 Release by atq2119 on Wednesday March 20, 2019 @12:59PM (#19444155)
It doesn't matter much when you build only once, but more people need to be aware of Ninja for builds. Both cmake and meson can target it, and it is much faster for incremental builds.
Re:LLVM 8.0.0 Release by RantyDave on Wednesday March 20, 2019 @04:46PM (#19446683)
I never understand this. Surely 'make' itself uses an almost irrelevantly low amount of CPU compared to compiling?

That being said: have used Ninja with Cmake. Damn fast.

Re:LLVM 8.0.0 Release by atq2119 on Thursday March 21, 2019 @10:24AM (#19452668)
The problem is with how make checks which files have changed and the related I/O latency, plus the fact that pretty much everybody uses recursive make. The overhead of recursive make initialization plus the forced serialisation of builds is the main cause of slow make.

Consider the Linux kernel as a contrast, which doesn't suffer from slow make because a lot of investment was made into a non-recursive make system.

The fact that makefile generators like CMake tend to generate recursive makefiles is a shame.

Re:LLVM 8.0.0 Release by maccam912 on Wednesday March 20, 2019 @06:47PM (#19447772)
It's not so much how much CPU each takes up, but that 'make' will waste some time recompiling stuff that doesn't need to be recompiled. Ninja is better about reusing stuff compiled the first time to make the second compilation faster but still accurate.
Re:LLVM 8.0.0 Release by coherentpony on Wednesday March 20, 2019 @10:39PM (#19448869)
Isn't the point of `make` that it doesn't build stuff that doesn't need to be rebuilt? Am I missing something?
Re:LLVM 8.0.0 Release by swuecho on Wednesday March 20, 2019 @11:05PM (#19448971)
I guess make and ninjia use different algorithm to compute the targets that does not beed to rebuild.
Re:LLVM 8.0.0 Release by monocasa on Wednesday March 20, 2019 @05:32PM (#19447172)
Last time I tried on a not super new laptop, it couldn't link. It really needs 8GB of RAM last time I tried.
Re:LLVM 8.0.0 Release by slacka on Thursday March 21, 2019 @08:03PM (#19458541)
Something was wrong with your setup. I've built clang in the past on a VM with only 3GB physical + 3GB of virtual RAM/swap allocated.
Re:LLVM 8.0.0 Release by monocasa on Friday March 22, 2019 @03:58PM (#19466308)
Recently? It was a 4GB laptop that ran out of memory while linking back in Oct '18.
Re:LLVM 8.0.0 Release by Scuds on Wednesday March 20, 2019 @10:35AM (#19442630)
Does this mean wasm is effectively just another ISA to compile to and emscripten is no longer needed?
Re:LLVM 8.0.0 Release by steveklabnik on Wednesday March 20, 2019 @12:17PM (#19443686)
It's a bit more complex than that. emscripten tries to provide a full environment; it adds a runtime with features like a libc. It also produces some HTML and JavaScript to load up the wasm, etc. The new wasm target gives you none of that. This means smaller binaries for some things, but it's harder to get existing desktop codebases up and running.

(In Rust, we've had this new target for a while, and it's where we're putting in all of our development efforts. We still technically support the emscripten target as well.)

Re:LLVM 8.0.0 Release by Orphis on Wednesday March 20, 2019 @10:51AM (#19442777)
If you need really small functions, yes. emscripten is providing all the libc functions, WASM loading code and binding generators. You will probably need some of that when porting existing libraries or applications to the web!
Re:LLVM 8.0.0 Release by e12e on Wednesday March 20, 2019 @01:34PM (#19444595)
Well, you generally need a libc when compiling for any platform, so that shouldn't be too special?
Re:LLVM 8.0.0 Release by steveklabnik on Wednesday March 20, 2019 @02:03PM (#19444954)
You don't inherently need a libc for wasm. That is, libc is usually the API for the platform; wasm doesn't have such a thing really. Your wasm module says "hey, these are the functions I expose, and these are the functions that I am planning to call from the environment" and it's the host's job to wire that up properly. In the browser, that means when you instantiate a wasm module, you need to provide all the required functions, and then you can call the exposed functions from JS. Outside the browser, what things you can call and will be called is defined by the host.

A libc can be useful inside of wasm for existing C or C++ code (or whatever) that is built for another platform, so that you can more easily compile to wasm as well. But it's an option, not required.

Re:LLVM 8.0.0 Release by e12e on Wednesday March 20, 2019 @04:13PM (#19446362)
Well, I meant that if you want to cross compile general code, you might want malloc, printf etc...

I'm not sure the primary appeal of wasm is treating it as a low level target (even if that is possible and sometimes useful).

Re:LLVM 8.0.0 Release by steveklabnik on Wednesday March 20, 2019 @04:42PM (#19446626)
You can get that stuff without a libc, if you’re not literally compiling C or C++. If you are, you’re right, though.
Re:LLVM 8.0.0 Release by Orphis on Wednesday March 20, 2019 @04:59PM (#19446855)
You don't necessarily need it. You could have some math focused code you want to call from JS.
Re:LLVM 8.0.0 Release by petters on Wednesday March 20, 2019 @12:19PM (#19443704)
No, it is not needed any more. I have a demo here: https://github.com/PetterS/clang-wasm

But be prepared to work without libc if you don't use emscripten. Writing a malloc is fun though!

Re:LLVM 8.0.0 Release by s_tec on Wednesday March 20, 2019 @05:18PM (#19447042)
Nice demo, thanks.

It's funny how technology go in waves. This reminds me more of programming microcontrollers than writing Web stuff, and yet this is the hot new thing!

Re:LLVM 8.0.0 Release by BubRoss on Wednesday March 20, 2019 @12:07PM (#19443567)
That is a good question, but as I understand it (from reading only) emscripten does a few other things, such as convert opengl calls to webgl, as well as use special integrated versions of SDL and GLFW so that native programs that use those libraries can be compiled directly.

Both of those would include input and I think audio is dealt with in a similar way.

Re:LLVM 8.0.0 Release by wyldfire on Wednesday March 20, 2019 @01:17PM (#19444363)
> too lazy (or impatient) to compile LLVM from source

You can use llc from the release tarballs.

Re:LLVM 8.0.0 Release by xvilka on Wednesday March 20, 2019 @11:00PM (#19448955)
While they did an amazing job on improving the framework, compiler, and tools, a few important compatibility features weren't addressed:

- '-MT' and '-MM' options support (like in GCC)[1]

- '-M'/'-MF' options support (like in GCC)[2]

- 'MENUEX' menu resource section parsing (like in MSVC)[3]

Also, we recently found a problem[4] while compiling radare2 with 8.0.0 clang-cl for Windows. Hopefully, it will be addressed soon since the tool offers sanitizers support for the Windows platform, which is a blast.

[1] https://bugs.llvm.org/show_bug.cgi?id=10091

[2] https://bugs.llvm.org/show_bug.cgi?id=8312

[3] https://bugs.llvm.org/show_bug.cgi?id=40108

[4] https://bugs.llvm.org/show_bug.cgi?id=41128

Re:LLVM 8.0.0 Release by benchaney on Wednesday March 20, 2019 @11:45AM (#19443336)
Does anyone know what the status of the llvm riscv backend is? I haven’t heard about it in a while.
Re:LLVM 8.0.0 Release by steveklabnik on Wednesday March 20, 2019 @12:16PM (#19443675)
rustc has support in-tree for

  riscv32imac-unknown-none-elf
  riscv32imc-unknown-none-elf
  riscv64gc-unknown-none-elf
  riscv64imac-unknown-none-elf
So, it's at least far enough along to have that turned on!
Re:LLVM 8.0.0 Release by bionicbits on Wednesday March 20, 2019 @12:39PM (#19443932)
Nice, was just looking into this!
Re:LLVM 8.0.0 Release by steveklabnik on Wednesday March 20, 2019 @12:49PM (#19444038)
You have to

  $ rustup target add <triple>
to download the pre-compiled libraries, but then it should be a --target <triple> away! As far as I know anyway, I'm sure there are bugs since it's so new.
Re:LLVM 8.0.0 Release by smitty1110 on Wednesday March 20, 2019 @12:06PM (#19443557)
LLD just added support for that architecture with this release, so I assume it's still being actively developed.
Re:LLVM 8.0.0 Release by wyldfire on Wednesday March 20, 2019 @09:44AM (#19442032)
> -mspeculative-load-hardening Clang now has an option to enable Speculative Load Hardening.

I wonder -- which targets support this flag? And which ones need it (i.e. which are susceptible)?

Also, I didn't see it in the changelog -- does libc++ have std::execution::* yet?

Re:LLVM 8.0.0 Release by newnewpdro on Wednesday March 20, 2019 @09:43PM (#19448634)
I was able to get AMDGPU & Mesa-OpenCL working reliably on an AMD RX480 with this release.

On 6 and 7 some OpenCL kernels would consistently fail with illegal instruction problems.

If you've been using AMDGPU PRO just for OpenCL support, and prefer running mainline drivers, give AMDGPU a try on llvm8 and a recent kernel.

Re:LLVM 8.0.0 Release by openbasic on Wednesday March 20, 2019 @11:01AM (#19442862)
Wish they updated the Kaleidoscope tutorial.
Re:LLVM 8.0.0 Release by xvilka on Wednesday March 20, 2019 @11:27PM (#19449066)
I should also note that KLEE 2.0 was released[1] in line with LLVM 8.0 release. It is the first release in the last 2 years, so the amount of changes is huge. If you are using symbolic execution - I recommend you to check out this version.

[1] https://github.com/klee/klee/releases/tag/v2.0

Re:LLVM 8.0.0 Release by 0x0 on Wednesday March 20, 2019 @09:49AM (#19442118)
Are LLVM releases always timed to align with Xcode releases these days? I guess most people expect new Xcode and iOS/Mac SDKs on Monday.
Re:LLVM 8.0.0 Release by AlexeyBrin on Wednesday March 20, 2019 @09:52AM (#19442140)
Not really, Clang and LLVM from Apple (the version that comes with Xcode) is usually behind the official LLVM release and it is also slightly modified/patched.
Re:LLVM 8.0.0 Release by coldtea on Wednesday March 20, 2019 @10:30AM (#19442576)
>I guess most people expect new Xcode and iOS/Mac SDKs on Monday.

Most people don't expect them then, and they'd be wrong if they do.

Apple just has one of the regular spring-time announcements for hardware and services products.

WWDC, when the new Xcode and iOS/Mac SDKs will be announced (but usually not released to non-devs until Fall), is, and has always been, in the summer (June).

(And there's another hardware/services announcement in Fall usually).

Re:LLVM 8.0.0 Release by 0x0 on Wednesday March 20, 2019 @11:02AM (#19442874)
It's expected that iOS 12.2 is coming with Swift5, and ABI stability for the first time, as well as os-bundled libswift for the first time. Sounds like a semi major sdk update to me.
Re:LLVM 8.0.0 Release by coldtea on Wednesday March 20, 2019 @11:35AM (#19443228)
Hmm, the minor update with new Swing is indeed a good point.

Not the usual way it happens though. Usually those things came at WWDC.

Re:LLVM 8.0.0 Release by pavlov on Wednesday March 20, 2019 @10:16AM (#19442403)
Really? What's happening on Monday? Seems like unusual timing for SDK updates, a few months early of the usual WWDC releases...
Re:LLVM 8.0.0 Release by rudedogg on Wednesday March 20, 2019 @12:56PM (#19444112)
It'll just be a point/minor release. WWDC is where major releases are usually announced (iOS 13 and macOS 10.15 for the coming 2019 WWDC).
Re:LLVM 8.0.0 Release by Someone on Wednesday March 20, 2019 @05:40PM (#19447240)
It wouldn’t surprise me if Monday were television series, only.

Alternatively, it’s that plus “one more thing”, where that thing is big.

I’m thinking that because the 70% faster iPad and the 100% faster iMac apparently didn't make the cut for Monday.

Re:LLVM 8.0.0 Release by wyldfire on Wednesday March 20, 2019 @10:23AM (#19442485)
I think it's ~6 month cycles so it might end up lining up with an annual event for a while. But soon enough they'll probably be out of phase.
Re:LLVM 8.0.0 Release by zmodem on Wednesday March 20, 2019 @09:33AM (#19441930)
https://news.ycombinator.com/item?id=19441297 links to the release announcement for the whole project, not just the LLVM module.
Re:LLVM 8.0.0 Release by aboutruby on Wednesday March 20, 2019 @09:50AM (#19442130)
The other post has no comments yet and the link is: https://lists.llvm.org/pipermail/llvm-announce/2019-March/00...
Re:LLVM 8.0.0 Release by sctb on Wednesday March 20, 2019 @11:31AM (#19443179)
Re:LLVM 8.0.0 Release by AndrewGaspar on Wednesday March 20, 2019 @09:45AM (#19442056)
This link is definitely more interesting if you care about clang or clang tools.
Re:LLVM 8.0.0 Release by aquabeagle on Wednesday March 20, 2019 @10:44AM (#19442721)
edit: nevermind
Re:LLVM 8.0.0 Release by aepiepaey on Wednesday March 20, 2019 @11:00AM (#19442859)
No, it does not.

According to you reference link:

> We currently plan to install the new developer policy and add the new license in January 2019 after the LLVM 8.0 release has branched.

Also, the source archive for LLVM 8 still contains the old license.

Which means that the first release under the Apache 2 license should be LLVM 9.

Re:LLVM 8.0.0 Release by zmodem on Wednesday March 20, 2019 @10:59AM (#19442849)
The link makes it sound like the switch happens after the 8.0.0 release.