Andrew Kelley 9ed599b4e3 stage2: LLVM backend: miscompilation fixes
* work around a stage1 miscompilation leading to the wrong integer
   comparison predicate being emitted.
 * fix the bug of not annotating callsites with the calling convention
   of the callee, leading to undefined behavior.
 * add the `nobuiltin` attribute when building freestanding libc or
   compiler_rt libraries to prevent e.g. memcpy from being "optimized"
   into a call to itself.
 * compiler-rt: change a call to be comptime to make the generated LLVM
   IR simpler and easier to study.

I still can't enable the widening tests due to the compiler-rt compare
function being miscompiled in some not-yet-diagnosed way.
2021-10-05 20:36:04 -07:00
..
2019-09-25 23:35:41 -04:00

This compiler-rt library is ported from LLVM.

It's needed because LLVM emits library calls to compiler-rt when hardware lacks functionality, for example, 64-bit integer multiplication on 32-bit x86.

This library is automatically built as-needed for the compilation target and then statically linked and therefore is a transparent dependency for the programmer.

Any bugs should be solved by trying to duplicate the bug upstream.

  • If the bug exists upstream, get it fixed with the LLVM team and then port the fix downstream to Zig.
  • If the bug only exists in Zig, something went wrong porting the code, and you can run the C code and Zig code side by side in a debugger to figure out what's happening differently.