Repository navigation
What's Changed
Optional libdwarf support: if the Makefile finds libdwarfp (header +
library; probe result in HAVE_LIBDWARF, override with make HAVE_LIBDWARF=0|1), -g builds .debug_line/.debug_info/.debug_abbrev/
.debug_aranges through it
(src/obj_libdwarf.c); otherwise, or if libdwarf fails, the built-in
emitter in src/obj.c is used.
Debug levels now follow gcc: -g and -g1 (the default -g level) emit the
line table only; -g2 (-ggdb2) and -g3 (-ggdb3) emit full DWARF 4 (ELF
x86-64 with libdwarfp, src/dwarf_g3.c; elsewhere both silently behave like
-g1), -g3 additionally with macros: subprograms
with parameters, locals in lexical blocks (compound statements and for
initializers), globals, typedefs, base/pointer/array/function types,
cv-qualifiers, struct/union/enum with bit-fields, and #define/#undef as
.debug_macinfo (gdb info macro/macro expand). Every section-relative
reference carries a real relocation, so several -g3 objects link
correctly; rcc's own linker keeps the debug sections. Not yet covered:
block-scope statics, VLAs, TLS variables, typedef names on variable types.
-g no longer disables the SSA IR backend: -O2 -g/-g2/-g3 produce the same
optimized code as -O2 alone and emit debug info from the IR emitter -
per-instruction line rows, .eh_frame for IR prologues (including
shrink-wrapped cold-block frames), and .debug_loc location lists for
register-allocated locals (IR_DBGVAL pseudo-instructions carried through the
SSA passes, resolved against the linear-scan register allocator's live
ranges). -fno-inline now also disables IR inlining.
-g (every level, ELF x86-64) now also emits .eh_frame call-frame
information for rcc's functions (src/eh_frame.c): backtrace(), C++
exceptions, pthread_exit() and gdb's bt/finish work through rcc frames, and
locals resolve from the first instruction (DW_AT_frame_base is the CFA).
rcc's own linker writes .eh_frame_hdr and PT_GNU_EH_FRAME.
__builtin_cpu_supports() now accepts every feature name GCC does on x86-64
(115 names: pclmul, aes, popcnt, sha, adx, lzcnt, avx512*, amx-*, apxf,
x86-64, x86-64-v2/v3/v4, ...) with GCC's semantics (XCR0 OS-support checks
for AVX/AVX-512/AMX/APX, CPUID max-leaf guards), and is new on AArch64
(Linux: AT_HWCAP/AT_HWCAP2; macOS: sysctlbyname) with the ACLE names clang
accepts (fp, simd, aes, sha2, crc, lse, sve, sve2, bf16, i8mm, sme, bti,
...). Unknown names yield 0.
Third-party build fixes found re-running test/third_party: inline asm with
fixed registers (cpuid) no longer corrupts an earlier call argument or its
own captured outputs; return __builtin_bswapN(x) is no longer tail-jumped
to a missing symbol; global arrays of 16 bytes or more are 16-byte aligned
(SSE movdqa); -Xlinker ARG is -Wl,ARG; the parenthesized forms (&&label)
and __extension__(&&label) (Ruby's LABEL_PTR) are accepted in static
initializers; struct operands of arithmetic operators are diagnosed;
unix/linux are not predefined under strict -std=cNN; and the x86
assembler gained correct handling of sym(%rip)
relocations for every mnemonic, %ah..%bh, shld/shrd, movlps/movhps/movlpd/
movhpd and pshufd with memory operands, unsuffixed shifts by %cl, pclmul
selectors, .quad literals above INT64_MAX, cmov with an explicit size
suffix (cmovcq/cmovgl/... -- previously all encoded as cmove), and
two-operand imul with a memory or an immediate source (previously
silently dropped), cmp with an immediate and a memory destination
(cmpb $0, 7(%rbp) -- the K-table loop terminator in OpenSSL's
sha512/sha256 asm; previously silently dropped, the following jne
tested stale flags and the round loop ran until the K pointer walked
off the table: sha_test/ssl_test segfaults and flag-dependent wrong
SHA-384/512 digests), and bt with an immediate bit index
(bt $0x1c, %edx -- the CPUID feature probe; previously encoded as a
register-form BT with a garbage register, corrupting every detected
CPU feature).
More fixes from the remaining third-party projects: duplicate case
values (also overlapping GNU ranges) are an error, as in GCC (autoconf
probes such as Tcl's TCL_WIDE_INT_IS_LONG depend on it);
fpclassify()/isnormal() classify subnormal double and float values
correctly (they came out as zero/normal); __attribute__((naked)) emits
no prologue/epilogue (the body is the asm); a jmp/jcc in inline asm to
an external function gets a relocation instead of a zero displacement;
-f[no-][asynchronous-]unwind-tables are accepted under -Werror. Linking:
atexit()/at_quick_exit()/pthread_atfork() resolve from libc_nonshared.a, so
such programs link without the gcc fallback; the empty libutil.a/libdl.a
stubs of glibc >= 2.34 no longer force it either; symbols a shared library
exports only under a hidden version (glibc's __malloc_hook) count as
undefined, as with ld; and the gcc fallback brackets static archives in a
linker group, matching rcc's own rescan-until-fixed-point archive order.
The clang build no longer passes -Wl,-w to the fallback link on
GNU/Linux: GNU ld.bfd reports a reference to a symbol that exists only
under a non-default (hidden/compat) version as a warning, and -w let
such a link silently succeed where it must fail (kept on the BSDs, where
it silences ld.lld's "strcpy() misused" notices). Case ranges in switch
are rejected under -pedantic as in GCC ("ISO C does not support range
expressions in switch statements before C2Y"); duplicate-case detection
converts the labels to the switch expression's type first and reports
each conflict as it is parsed (so the rest of the file still gets
diagnosed); and -W warns when a case label's value changes on that
conversion.
Every malloc/calloc/realloc/strdup in the compiler goes through the shared
xmalloc/xcalloc/xrealloc/xstrdup (src/alloc.c), which print "rcc: out of
memory" and exit(1) instead of dereferencing NULL or leaking on a failed
realloc.
macOS/arm64 fixes found building libredwg with
-fsanitize=address,undefined: a conditional branch in a function over 1MB (B.cond reaches only +-1MB) is
emitted as a branch around an unconditional B, and a branch that still
cannot reach its target is a compile error instead of a jump into
unrelated code. The UBSan overflow checks no longer overwrite a local in a
large frame, no longer report every negative product, and no longer
compute l + l when the lhs was spilled; pointer additions are checked by
offset sign as on x86-64, so negative offsets are not reported, and
test_ubsan_ptr_neg now actually runs with -fsanitize=undefined. The ASan
check keeps the shadow base out of the address register. Relocatable
Mach-O objects get a correct section layout, which rcc's own linker now
reads back correctly, and extern asm-named objects are no longer defined.
macOS: the bundled <string.h> and <stdio.h> now declare memmem, the scanf
and v*printf families and the other variadic or non-int stdio functions
(an undeclared function is called as int with its arguments in
registers, which truncates pointers and breaks variadic calls), and
<limits.h> chains to the SDK for PATH_MAX. Programs are no longer linked
with -undefined dynamic_lookup, which made configure link checks find
functions that do not exist; shared libraries still are.
-dynamiclib, -install_name, -compatibility_version and -current_version
are accepted, as GNU libtool passes them on macOS.
Full Changelog: v1.2.3...v1.2.4
Files
rcc-v1.2.4-src.tar.gz
rcc-v1.2.4-src.tar.gz.sig.txt
rcc-v1.2.4-src.tar.xz
rcc-v1.2.4-src.tar.xz.sig.txt
rcc-v1.2.4.tar.gz
rcc-v1.2.4.tar.gz.sig.txt
rcc-v1.2.4.tar.xz
rcc-v1.2.4.tar.xz.sig.txt
Verification
ff9d5a22da335fd790f6a01bdf13b7710f85ade451c4caa9f4ccf08b51feaaee rcc-v1.2.4-src.tar.gz
3e475ccaed3c976a0c4c8be69b4725668b353a24f3fbb88d8a4a98212784a4ee rcc-v1.2.4.tar.gz
48a61bd7a9d09d2e2f99aaa9eea9f3f7553ff0aaf852d14eb636f0ef4cff8566 rcc-v1.2.4-src.tar.xz
2993dbda5c0dfda91748cd5cc76fa29f01e607c3912620fe4e5265fb7d006a60 rcc-v1.2.4.tar.xz
Use the .sig.txt files to verify that the corresponding file (without the
.sig.txt suffix) is intact. First, be sure to download both the .sig.txt file
and the corresponding binary. Then, run a command like this:
mv binary.sig.txt binary.sig
gpg --verify binary.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys 38A4167B0DB69E49C5F7216CB8C28866AB27A7A2
and rerun the 'gpg --verify' command.