Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55a0991529 | ||
|
|
d91785457f | ||
|
|
4a9636690f | ||
|
|
95b55dec97 | ||
|
|
739e48d8dd | ||
|
|
24eca1c080 | ||
|
|
b2dd323e71 | ||
|
|
8711dee37b | ||
|
|
8b6eed2510 | ||
|
|
b005cd13c4 | ||
|
|
30f0dd688e | ||
|
|
9700b5c44f | ||
|
|
8f28483868 | ||
|
|
4d2c2dce5c | ||
|
|
dd8c5ea3ce |
No files matched your search
@@ -3,35 +3,38 @@
|
||||
A modern C toolchain for the DEC VT1200 / TI TMS34010, built as a small fork of
|
||||
upstream LLVM.
|
||||
|
||||
**Status: M8 complete (M8.4).** Branch `m8` is the current milestone branch and
|
||||
the repository default on both repositories. The M8 code state is project
|
||||
`e55287f` and compiler `ab6017a8b41f`; this documentation update rides on top
|
||||
of it. Repository policy: each milestone branch is promoted to the default
|
||||
immediately after its clean final review, and the previous default stays as a
|
||||
snapshot.
|
||||
M8.1 makes the native path library-complete: `tms-link` reads the SDK System V
|
||||
`ar` archives (1987 `FLIB.LIB`/`RTS.LIB` in the M4 SDK; 1990 copies in the M6
|
||||
SDK), extracts only members that define needed
|
||||
symbols (iterated to a fixpoint), supports `-l`/`-L`, and links the M4/M5/M6
|
||||
library programs with GSPLNK as the permanent byte/symbol oracle. M8.2 merges
|
||||
DWARF from multiple translation units: per-object section bases are rehomed,
|
||||
relocations and the raw CU abbreviation offset are rewritten, and
|
||||
`llvm-dwarfdump` validates every TU. M8.3 fixes the rotate/count/byte-swap
|
||||
lowering and adds a 64/32 i64 divide fast path; 20 curated rows flip to pass,
|
||||
lifting the full sweep to **1,912 = 1,596 pass / 316 skip / 0 fail / 0 crash**
|
||||
(c-torture **1,692 = 1,386 / 306 / 0 / 0**, c-testsuite **220 = 210 / 10 / 0 /
|
||||
0**). The 64/32 wide phase is **218** frames versus **2,440** for the 64-step
|
||||
loop (11.2×), and the 32-bit fast path is **87** versus **2,440** (28.0×), with
|
||||
status `600D600D` and the three pinned checksums. The shipped tiers report lit
|
||||
**120/120** (116 CodeGen + 4 MC; M8 adds `m8-bitops.ll` and
|
||||
`m8-i64div-wide.ll`), clang **5/5**, M5 c-torture **79/79** at `-O0` and
|
||||
`-O2`, M6 c-torture **79** at `-O0` plus the **20**-test bounded `-O2` subset,
|
||||
shipped c-testsuite **48 pass / 172 skip / 220**, and Generic **197 = 151 pass
|
||||
/ 46 unsupported / 0 crash** (two former ctlz/count entries now compile). The
|
||||
real VT1200 run remains **DEFERRED** (`VT1200_HOST` is unset;
|
||||
**Status: M9 complete (M9.4).** Branch `m9` is the current milestone branch and
|
||||
the repository default on both repositories; `m8` is the previous snapshot.
|
||||
The M9 code state is project `24eca1c` and compiler `bec449573fe3`; this
|
||||
documentation update rides on top of it. Repository policy: each milestone
|
||||
branch is promoted to the default immediately after its clean final review,
|
||||
and the previous default stays as a snapshot.
|
||||
M9.1 closes the two highest-value remaining conformance classes: vector `.data`
|
||||
initializers (exact element bytes in the raw GSPA and native TI-COFF paths) and
|
||||
inline-asm `r`/`=r`/`&r` constraints (the A-register classes). M9.2 replaces
|
||||
the M8 raw-offset assumption with a DWARF v5 form-aware multi-object input gate
|
||||
and exercises `.debug_rnglists` with a two-TU fixture; pre-v5 producers and
|
||||
unrelocated section-relative fields are refused loudly. M9.3 adds a
|
||||
single-`DIVU` 64/32 divide fast path. M9.4 records the final counts, the
|
||||
deferred hardware status and the M9/M10 boundary.
|
||||
The fresh two-tier full suite accounts for **1,912 = 1,618 pass / 294 skip /
|
||||
0 fail / 0 crash** (c-torture **1,692 = 1,408 / 284 / 0 / 0**, c-testsuite
|
||||
**220 = 210 / 10 / 0 / 0**); **22** rows flipped from the M9.1 classes (20
|
||||
inline-asm `r`, plus `simd-5` and `pr123625-2`), and the 10 loader exceptions
|
||||
remain explicit in `scripts/tests/m7/full-suite.full-loader`. The four-phase
|
||||
MAME divide measurement is fast **88**, slow **3,302**, wide **221** and div32
|
||||
**120** frames: **37.5×** (fast) and **14.9×** (wide) versus the loop, and
|
||||
**1.8×** for div32 versus the two-DIVU wide phase, status
|
||||
`600D600D`, checksums `000000011E6F9AB4`/`00000000007512AE`/
|
||||
`F56810CFEDA9D656`/`00002C61C63842EE`. The shipped tiers report lit
|
||||
**129/129** (125 CodeGen + 4 MC; M9 adds nine CodeGen tests), clang **5/5**,
|
||||
M5 c-torture **79/79** at `-O0` and `-O2`, M6 c-torture **79** at `-O0` plus
|
||||
the **20**-test bounded `-O2` subset, shipped c-testsuite **48 pass / 172 skip
|
||||
/ 220**, and Generic **197 = 151 pass / 46 unsupported / 0 crash**. The real
|
||||
VT1200 run remains **DEFERRED** (`VT1200_HOST` is unset;
|
||||
`scripts/tests/m7/hardware.sh` prints `HARDWARE: DEFERRED` and passes on the
|
||||
MAME-equivalent acceptance). M8 is the milestone branch and the repository
|
||||
default; `m7` is the previous snapshot.
|
||||
MAME-equivalent acceptance). M9 is the milestone branch; `m8` is the previous
|
||||
snapshot and stays the default until the promotion lands.
|
||||
|
||||
M7.3 widened the validated VT1200 Xlib surface, added real
|
||||
stderr capture to the conformance runtime, and shipped the real-hardware
|
||||
@@ -99,12 +102,10 @@ boundary; the hardware run is still deferred.
|
||||
> the M0 pointer shapes: `int_diff` returns 8 and `int_diff4` returns 32,
|
||||
> and `late` carries the 24-bit addend (never 192).
|
||||
|
||||
Branch `m8` is the current milestone snapshot (M8.4) and the repository
|
||||
default (promoted after the clean M8 final review; `m7` is the previous
|
||||
default). Branch
|
||||
`m7` is the previous snapshot, `m6` the one before that,
|
||||
`m5` before that, `m4` before that, `m3` the M3 snapshot, `m2` the M2
|
||||
tip and `m1` the reproducible M1 snapshot.
|
||||
Branch `m9` is the current milestone snapshot (M9.4) and the repository
|
||||
default; `m8` is the previous snapshot, `m7` the one before that,
|
||||
`m6` before that, `m5` before that, `m4` before that, `m3` the M3 snapshot,
|
||||
`m2` the M2 tip and `m1` the reproducible M1 snapshot.
|
||||
|
||||
- Design: [`docs/superpowers/specs/2026-11-10-tms34010-llvm-design.md`](docs/superpowers/specs/2026-11-10-tms34010-llvm-design.md)
|
||||
- M0 plan: [`docs/superpowers/plans/2026-11-10-tms34010-m0-fork-and-bit-address-semantics.md`](docs/superpowers/plans/2026-11-10-tms34010-m0-fork-and-bit-address-semantics.md)
|
||||
@@ -119,33 +120,137 @@ tip and `m1` the reproducible M1 snapshot.
|
||||
- M7.3 plan: [`docs/superpowers/plans/2026-11-15-tms34010-m7-3-runtime-and-hardware.md`](docs/superpowers/plans/2026-11-15-tms34010-m7-3-runtime-and-hardware.md)
|
||||
- M7.4 plan: [`docs/superpowers/plans/2026-11-15-tms34010-m7-4-conformance-performance-and-boundary.md`](docs/superpowers/plans/2026-11-15-tms34010-m7-4-conformance-performance-and-boundary.md)
|
||||
- M8 plan: [`docs/superpowers/plans/2026-11-16-tms34010-m8-archives-dwarf-conformance-and-hardware.md`](docs/superpowers/plans/2026-11-16-tms34010-m8-archives-dwarf-conformance-and-hardware.md)
|
||||
- M9 plan: [`docs/superpowers/plans/2026-11-17-tms34010-m9-conformance-classes-debug-and-performance.md`](docs/superpowers/plans/2026-11-17-tms34010-m9-conformance-classes-debug-and-performance.md)
|
||||
- Spike: [`spike/REPORT-23.md`](spike/REPORT-23.md) (current, LLVM 23.1.5);
|
||||
[`spike/REPORT.md`](spike/REPORT.md) (historical, 19.1.7)
|
||||
|
||||
## Repositories
|
||||
|
||||
- **Compiler fork:** <https://git.wut.ee/opencode.siil.arti.ee/llvm-tms34010>
|
||||
(branch `m8`) — the full buildable LLVM 23.1.5 tree with the TMS34010
|
||||
target, clang bit-address changes and the M2–M8 backend.
|
||||
Branch `m8` is the current milestone snapshot and the repository default
|
||||
(promoted after the clean M8 final review; `m7` is the previous default).
|
||||
Branch `m6` is the previous snapshot,
|
||||
`m5` is before
|
||||
(branch `m9`) — the full buildable LLVM 23.1.5 tree with the TMS34010
|
||||
target, clang bit-address changes and the M2–M9 backend.
|
||||
Branch `m9` is the current milestone snapshot and the repository default;
|
||||
`m8` is the previous snapshot.
|
||||
Branch `m7` is before that,
|
||||
`m6` is before that, `m5` is before
|
||||
that, `m4` is before that, branch `m3` is before that, branch `m2` is the M2
|
||||
tip and branch `tms34010` is the M1 tip and keeps the original M1 backend
|
||||
and suite.
|
||||
- **This project:** <https://git.wut.ee/opencode.siil.arti.ee/tms-c-compiler>
|
||||
(branch `m8`) — plans/specs, VT1200 integration tooling, `tms-bitaddr`,
|
||||
`tms-clang`, symbols, the M2–M8 harnesses and the conformance tier.
|
||||
Branch `m8` is the current milestone snapshot and the repository default
|
||||
(promoted after the clean M8 final review; `m7` is the previous default).
|
||||
Branch `m6` is the previous snapshot, `m5` is before
|
||||
that, `m4` is before that, `m3` is before that, `m2` is the M2 snapshot and
|
||||
`m1` is the reproducible M1 snapshot, including the retired M1 harness.
|
||||
(branch `m9`) — plans/specs, VT1200 integration tooling, `tms-bitaddr`,
|
||||
`tms-clang`, symbols, the M2–M9 harnesses and the conformance tier.
|
||||
Branch `m9` is the current milestone snapshot and the repository default;
|
||||
`m8` is the previous snapshot.
|
||||
Branch `m7` is before that, `m6` is before
|
||||
that, `m5` is before that, `m4` is before that, `m3` is before that, `m2` is
|
||||
the M2 snapshot and `m1` is the reproducible M1 snapshot, including the
|
||||
retired M1 harness.
|
||||
|
||||
The compiler fork is the canonical source for all target code. `patches/llvm`
|
||||
here is a **frozen M0 mirror** used by the default upstream+patches build;
|
||||
M2–M8 do not change it.
|
||||
M2–M9 do not change it.
|
||||
|
||||
## What M9 provides
|
||||
|
||||
M9 is the conformance-class, debug-depth and performance milestone. It fixes
|
||||
vector `.data` and inline-asm `r` (the two highest-value remaining full-suite
|
||||
classes), closes the M8 future-producer and `.debug_rnglists` caveats, adds a
|
||||
measured single-`DIVU` 64/32 divide fast path, and records the M9/M10
|
||||
boundary. It changes no TI ABI rule or language semantics. Full target rules
|
||||
are in [`build/llvm-clean/TMS34010.md`](build/llvm-clean/TMS34010.md)
|
||||
("M9 state").
|
||||
|
||||
- **M9.1 — vector `.data` and inline-asm `r`.** Fixed vectors of
|
||||
`i8`/`i16`/`i32`/`i64`/`f32`/`f64` elements emit their exact little-endian
|
||||
bytes when each element's allocation stride equals its store size and
|
||||
`stride * count` is the allocation size, in both the raw GSPA and native
|
||||
TI-COFF paths; arrays/records of vectors recurse. A vector
|
||||
`zeroinitializer` emits its **store** size and the caller/trailer adds the
|
||||
allocation padding once, so a padded `<3 x i32>` zero global is exactly its
|
||||
16-byte allocation and a record member stays at its DataLayout offset;
|
||||
non-zero padded/packed shapes are loud (`vector elements do not fill the
|
||||
allocation`). Inline asm `r`/`=r`/`&r` maps to the allocatable `ARegs`
|
||||
class for `i8`/`i16`/`i32`/`f32`, named A-register clobbers are modelled,
|
||||
and register/immediate operands print through `PrintAsmOperand` (A15 as
|
||||
`SP`). `t` and the memory constraints `m`/`o`/`V` fail with TMS34010-named
|
||||
diagnostics; i64 `r` (no allocatable even/odd pair) fails loudly with the
|
||||
generic allocator message (a target-named message is M10). The lit suite
|
||||
is **129/129** (125 CodeGen + 4 MC; the nine new `m9-*` tests are
|
||||
`m9-vector-data`, `-padded-zero`, two vector rejects, `m9-inline-asm`, two
|
||||
inline-asm rejects, the memory reject and `m9-i64div-64-32`). The fresh
|
||||
full-suite re-run flips **22** rows: 20 inline-asm `r` tests (`20001009-2`,
|
||||
`20020107-1`, `960312-1`, `990130-1`, `pr108498-1`, `pr110252-2`,
|
||||
`pr38533`, `pr43385`, `pr43560`, `pr45695`, `pr49279`, `pr49390`,
|
||||
`pr52286`, `pr65053-1`, `pr65648`, `pr65956`, `pr80421`, `pr84524`,
|
||||
`pr85756`, `pr88904`) and two vector `.data` tests (`simd-5`,
|
||||
`pr123625-2`). Five candidates stay curated with corrected reasons:
|
||||
`20030222-1` (64-bit value tied to a 32-bit `r` output), `pr23135`
|
||||
(timeout), `simd-1`/`simd-2` (vector runtime abort) and `stkalign` (memory
|
||||
operand).
|
||||
- **M9.2 — DWARF v5 form gate and `.debug_rnglists`.** In a multi-object
|
||||
`--keep-debug` link, `tms-link` now walks every CU/DIE through
|
||||
`.debug_abbrev` (including `DW_FORM_indirect` and `DW_FORM_implicit_const`),
|
||||
the v5 line-table directory/file entries, every `.debug_rnglists`/
|
||||
`.debug_loclists` unit and `DW_RLE_*`/`DW_LLE_*` entry, every
|
||||
`.debug_str_offsets` entry and every `.debug_addr` address. Every
|
||||
section-relative form (`strp`, `line_strp`, `sec_offset`, `ref_addr`) and
|
||||
every `DW_FORM_addr` must start on an `R-RELLONG` relocation (the GNU
|
||||
supplementary/alternate refs are consumed but not required, since they do
|
||||
not name the sections being concatenated); a missing one is a loud
|
||||
`LinkError`, and pre-v5
|
||||
producers (whose `DW_FORM_data4`/`data8` statement list cannot be rehomed)
|
||||
and DWARF64 are refused. The CU `debug_abbrev_offset` keeps the documented
|
||||
raw-patch exception. `.debug_rnglists` is now exercised by a synthetic
|
||||
two-TU fixture (`DW_AT_rnglists_base`, `DW_AT_addr_base`,
|
||||
`DW_AT_ranges` via `DW_FORM_rnglistx`, `DW_RLE_start_end` and
|
||||
`DW_RLE_startx_length`) and by a real `-O2 -g` inlining producer;
|
||||
`scripts/tests/m9/dwarf-ranges.sh` links both, wraps the kept sections in
|
||||
the M7 ELF container and requires `llvm-dwarfdump` to resolve both TUs'
|
||||
ranges and address table. The single-TU link keeps the M8 byte layout and
|
||||
the default strip is `.text/.data/.bss`, unchanged. `tools/tms-link/tests/
|
||||
run.sh` adds per-walker unrelocated-field negatives and the DWARF v4
|
||||
refusal.
|
||||
- **M9.3 — single-DIVU 64/32 divide.** After the signed-magnitude
|
||||
normalization, a zero divisor high word reaches `i64div.check32`: if
|
||||
`hi(N) < D` the quotient fits 32 bits and one even-destination `DIVU` on
|
||||
`(hi, lo)` produces it, with the remainder reconstructed as the low 32 bits
|
||||
of `lo(N) - q*D`; if `hi(N) >= D` the M8.3 two-`DIVU` outlined helper is
|
||||
kept. The fits-32 path, the 64-step loop, the shared sign fixup and
|
||||
divide-by-zero UB are unchanged. `INT64_MIN` never fits 32 bits: it keeps
|
||||
the two-step helper for a divisor of at most `2^31` and takes the
|
||||
single-DIVU path for a divisor in `(2^31, 2^32)`. `m9-i64div-64-32.ll`
|
||||
pins the new block, the `JRLO` quotient-fit branch, one even- and one
|
||||
odd-destination `DIVU` per caller and the unchanged wide helper at `-O0`
|
||||
and `-O2`. The four-phase MAME measurement (`scripts/tests/m7/i64div.sh`,
|
||||
16,384 iterations each) is fast **88**, slow **3,302**, wide **221** and
|
||||
div32 **120** frames: **37.5×** (fast) and **14.9×** (wide) versus the
|
||||
loop; **1.8×** for div32 versus the two-DIVU wide phase, status `600D600D`, checksums
|
||||
`000000011E6F9AB4`/`00000000007512AE`/`F56810CFEDA9D656`/
|
||||
`00002C61C63842EE`. The slow phase measures 3,302 frames here (M8 measured
|
||||
2,440); the 37.5× and 14.9× ratios are computed against that current slow
|
||||
phase, and the 1.8× is wide/div32.
|
||||
- **M9.4 — hardware and counts.** The real VT1200 run remains **DEFERRED**:
|
||||
`VT1200_HOST` is unset and no unit is available.
|
||||
`scripts/tests/m7/hardware.sh` builds the marker COFF at the proven
|
||||
origins, validates it in MAME through the dwt loader and prints
|
||||
`HARDWARE: DEFERRED`; setting `VT1200_HOST` additionally runs
|
||||
`hostload.py --marker`. No hardware pass is claimed. The fresh two-tier
|
||||
full suite (bare tier by default plus the 10-row
|
||||
`scripts/tests/m7/full-suite.full-loader` list) is **1,912 = 1,618 pass /
|
||||
294 skip / 0 fail / 0 crash** (c-torture **1,408 / 284**, c-testsuite
|
||||
**210 / 10**); the 294 skips are 64 classifier plus 230 curated rows, each
|
||||
with a reason. The retained TSV/report are `build/m9-bare-full/` and
|
||||
`scripts/tests/m7/full-suite-report.txt`. The other shipped tiers are
|
||||
unchanged: lit **129/129**, clang **5/5**, M5 c-torture **79/79** at `-O0`
|
||||
and `-O2`, M6 c-torture **79** at `-O0` plus the **20**-test bounded `-O2`
|
||||
subset, shipped c-testsuite **48 pass / 172 skip / 220**, Generic **197 =
|
||||
151 pass / 46 unsupported / 0 crash**.
|
||||
- **Boundary.** M9 is complete. The remaining genuine conformance classes are
|
||||
`blockaddress`; vector runtime arithmetic (the backend still has no vector
|
||||
register class); inline-asm memory constraints (`m`/`o`/`V`, loud today);
|
||||
nested functions; VLAs; sret/aggregate/variadic/float return shapes; libm;
|
||||
and the remaining runtime aborts. The pre-existing `pr63843` hang, the real
|
||||
VT1200 run and further performance work are M10.
|
||||
|
||||
## What M8 provides
|
||||
|
||||
@@ -203,8 +308,9 @@ language semantics and no default branch. Full target rules are in
|
||||
future producer that emits an unrelocated section-relative field other than
|
||||
the CU abbreviation offset is not silently rewritten (it needs a form-aware
|
||||
DIE walker; this compiler relocates every such field), and
|
||||
`.debug_rnglists` is in the concat set but this compiler's fixtures do not
|
||||
emit it (non-contiguous ranges), so it is supported but unexercised.
|
||||
`.debug_rnglists` was in the concat set but the M8 fixtures did not emit it
|
||||
(non-contiguous ranges), so it was supported but unexercised. M9.2 closes
|
||||
both caveats (see "What M9 provides").
|
||||
- **M8.3 — conformance depth and performance.** The M7.4 classifier stopped on
|
||||
`Cannot select` for rotates, `cttz`, `ctpop`/`ctlz` and `bswap`. They now
|
||||
lower without inventing instructions: `rotl`/`rotr` are `Expand`ed and
|
||||
@@ -220,10 +326,12 @@ language semantics and no default branch. Full target rules are in
|
||||
`r = lo - q0*d`), shared with the existing signed magnitude/sign fixup; it
|
||||
is outlined into `__tms34010_i64_udiv32`/`..._urem32` so the 64-step loop
|
||||
stays spill-free. The existing one-`DIVU` fits-32 path is unchanged.
|
||||
`scripts/tests/m7/i64div.sh` now measures three equal 16,384-iteration
|
||||
At M8 `scripts/tests/m7/i64div.sh` measured three equal 16,384-iteration
|
||||
phases: fast **87** frames, slow **2,440** (28.0×) and wide **218** (11.2×),
|
||||
status `600D600D`, checksums `000000011E6F9AB4`, `00000000007512AE` and
|
||||
`00025AF70AF974E0`.
|
||||
`00025AF70AF974E0`. M9.3 makes the gate four-phase and narrows the wide
|
||||
input to force the two-`DIVU` helper, so it supersedes the M8 wide
|
||||
frame/checksum number (see "What M9 provides").
|
||||
- **M8.3 flips and loader budgets.** Twenty curated rows flipped to pass: six
|
||||
rotates (`20020226-1`, `20020508-1`, `20100805-1`, `20180112-1`, `pr119428`,
|
||||
`pr97386-2`), six `cttz` (`builtin-bitops-1`, `ffs-1`, `ffs-2`, `pr37780`,
|
||||
@@ -253,12 +361,14 @@ language semantics and no default branch. Full target rules are in
|
||||
expected-fails). The fresh end-to-end full suite is **1,912 = 1,596 pass / 316
|
||||
skip / 0 fail / 0 crash**; the 316 skips are 64 classifier and 252 curated
|
||||
rows, every one with a reason. The M7.1–M7.4 counts are otherwise unchanged.
|
||||
- **Boundary.** M8 is complete. The remaining genuine conformance classes are
|
||||
`blockaddress`, vector `.data`, inline-asm constraints, nested functions,
|
||||
VLAs, sret/aggregate/variadic/float returns, libm and the remaining runtime
|
||||
aborts; the pre-existing `pr63843` hang and further performance work are
|
||||
also open. The real VT1200 run remains deferred until the unit is available.
|
||||
M9 owns those classes and the hardware run.
|
||||
- **Boundary.** M8 is complete. M9 closed vector `.data`, inline-asm `r`, the
|
||||
DWARF future-producer/`.debug_rnglists` caveats and the 64/32 divide path.
|
||||
The remaining genuine conformance classes (M9/M10 boundary) are
|
||||
`blockaddress`, vector runtime, inline-asm memory constraints, nested
|
||||
functions, VLAs, sret/aggregate/variadic/float returns, libm and the
|
||||
remaining runtime aborts; the pre-existing `pr63843` hang and further
|
||||
performance work are also open. The real VT1200 run remains deferred until
|
||||
the unit is available.
|
||||
|
||||
## What M7.4 provides
|
||||
|
||||
@@ -292,8 +402,9 @@ language semantics and no default branch. Full target rules are in
|
||||
- **Two-tier conformance harness.** The suite defaults to a bare-metal MAME
|
||||
tier: the COFF sections are mapped at their paddrs, `.bss` is zeroed,
|
||||
`PC`/`SP` are set, and the test runs without the VT1200 firmware or COFF
|
||||
loader. The M8 totals are unchanged (**1,596 / 316 / 0 / 0**), but the run
|
||||
is ~35 minutes (2,133 test-seconds) instead of ~2 h 52 m. The bare tier uses
|
||||
loader. The fresh M9 totals are **1,618 / 294 / 0 / 0** (the M8 run was
|
||||
**1,596 / 316 / 0 / 0**), and the run is ~35 minutes instead of ~2 h 52 m.
|
||||
The bare tier uses
|
||||
the 1990 r5.01 OS/2 assembler through 2ine (direct loader; qemu-i386
|
||||
fallback) and the host `tms-link`; `scripts/m8/setup-os2.sh` provisions it.
|
||||
The full-loader tier remains for the curated M5/M6 gates, X11/runtime/loader
|
||||
@@ -301,26 +412,26 @@ language semantics and no default branch. Full target rules are in
|
||||
`scripts/tests/m7/full-suite.full-loader` list (each with a reason);
|
||||
`M5_CONFORMANCE_BARE=0` selects it, and `M5_CONFORMANCE_BARE=1` is the
|
||||
default for the corpus driver.
|
||||
- **Skip classes.** The 336 skips are 64 classifier skips and 272 curated
|
||||
- **Skip classes.** The 294 skips are 64 classifier skips and 230 curated
|
||||
rows, each with a reason. The main classes (with c-torture counts) are
|
||||
inline-asm register/memory constraints **33**, nested functions **30**,
|
||||
timeouts **23** (21 loader/run, 2 compile-wall), codegen gaps **19**
|
||||
(rotates, `cttz`, `bswap`, `blockaddress` and other unselectable nodes),
|
||||
nested functions **30**, timeouts **21** (loader/run; M9's `pr23135`
|
||||
remains here), inline-asm memory/other constraints **13** (down from 33
|
||||
after the `r` flips; the remaining rows need `m`/`o`/`V` or an i64 pair),
|
||||
file I/O **18**, wide
|
||||
characters **16**, `__int128` **15**, image/region size **15**, `.data`
|
||||
initializers **14**, runtime aborts **14**, unknown builtins **11**,
|
||||
sret/aggregate/variadic/float return shapes **10** plus **9** sret and
|
||||
**3** variadic-return, runtime abort variants (i64 **10**, bitfield **9**,
|
||||
varargs **6**, float **5**, vector **3**, alignment **2**), VLAs **9**,
|
||||
varargs **6**, float **5**, vector **5**, alignment **2**), VLAs **9**,
|
||||
compiler-internal crashes **6** (unknown custom lowering, dynamic-alloca assertion; other codegen/asm rows abort with a feature diagnostic),
|
||||
`setjmp`/`longjmp` **6**, missing `gcc.dg` corpus sources **5**, vector
|
||||
constants/operations **5** plus **2**, float arguments **4**, signals **4**,
|
||||
indirect calls **2**, and one each of byval, odd `.data` pointer, decimal
|
||||
float, out-of-range float constant, libc prototype and the 16 KiB output
|
||||
cap. c-testsuite skips are wide characters **4**, file I/O **3**, an
|
||||
unimplemented `printf` conversion set **1**, libm `sin`/float formatting
|
||||
**1** and one 1000-frame timeout. The full per-reason table is in the
|
||||
retained report.
|
||||
`setjmp`/`longjmp` **6**, missing `gcc.dg` corpus sources **5**, float
|
||||
arguments **4**, signals **4**, codegen gaps **2** plus **2** float-codegen
|
||||
and **2** vector rows, indirect calls **2**, and one each of byval, odd
|
||||
`.data` pointer, decimal float, out-of-range float constant, libc prototype
|
||||
and the 16 KiB output cap. c-testsuite skips are wide characters **4**, file
|
||||
I/O **3**, an unimplemented `printf` conversion set **1**, libm
|
||||
`sin`/float formatting **1** and one 1000-frame timeout. The full
|
||||
per-reason table is in the retained report.
|
||||
- **112 pass flips.** Honest harness fixes turned 112 former failures into
|
||||
passes: **98 `fail:compile`** (per-test `-std=gnu89` from explicit
|
||||
directives plus `full-suite.gnu89` for 68 directive-free files; `assert.h`,
|
||||
@@ -732,7 +843,7 @@ sub-byte stride itself (diagnostic only), and the odd-offset raw-GSPA pointer
|
||||
shape. The M6 native-linker/`.cinit` gap is closed by M7.2 (see "What M7.2
|
||||
provides").
|
||||
|
||||
**M8/M9 boundary.** M7 is complete and M8 is complete. M7.1 delivered the `-O2`
|
||||
**M9/M10 boundary.** M7, M8 and M9 are complete. M7.1 delivered the `-O2`
|
||||
bit-pointer barrier, the sub-byte stride diagnostic and the `.data`
|
||||
aggregate-initializer extension; M7.2 the debug object sections, `.cinit` and
|
||||
`tools/tms-link` (including public long names); M7.3 the six wider Xlib
|
||||
@@ -741,13 +852,16 @@ the full external suites, the i64 divide/remainder fast path and the
|
||||
conformance-loader COFF repair. M8.1 added native `ar` archive linking with
|
||||
GSPLNK parity; M8.2 multi-TU DWARF merging; M8.3 the bit-op lowering, the
|
||||
64/32 i64 divide path, 20 full-suite flips and per-test loader budgets; M8.4
|
||||
the final docs and boundary. Real-hardware confirmation is still **deferred**
|
||||
(the unit is away); MAME plus the existing dwt loader is the acceptance
|
||||
environment, and `VT1200_HOST` enables the real run without changing the gate.
|
||||
M9 owns the remaining conformance classes (`blockaddress`, vector data,
|
||||
inline-asm constraints, nested functions, VLAs, sret/aggregate/variadic/float
|
||||
returns, libm, runtime aborts), the pre-existing `pr63843` hang, further
|
||||
performance work and the real VT1200 run once the unit is available.
|
||||
the final M8 docs and boundary. M9.1 fixed vector `.data` and inline-asm `r`
|
||||
(22 flips), M9.2 added the DWARF v5 form gate and `.debug_rnglists` coverage,
|
||||
M9.3 the single-DIVU 64/32 path, and M9.4 the final M9 counts and boundary.
|
||||
Real-hardware confirmation is still **deferred** (the unit is away); MAME plus
|
||||
the existing dwt loader is the acceptance environment, and `VT1200_HOST`
|
||||
enables the real run without changing the gate. M10 owns the remaining
|
||||
conformance classes (`blockaddress`, vector runtime, inline-asm memory
|
||||
constraints, nested functions, VLAs, sret/aggregate/variadic/float returns,
|
||||
libm, runtime aborts), the pre-existing `pr63843` hang, further performance
|
||||
work and the real VT1200 run once the unit is available.
|
||||
|
||||
## What M5 provides
|
||||
|
||||
@@ -776,7 +890,7 @@ surface on top. The M5 state below is the baseline.
|
||||
`MCObjectWriter`/`MCStreamer`, an `MCAsmParser` and an `MCDisassembler`
|
||||
cover the supported instruction table. `llvm-mc -triple=tms34010`
|
||||
assembles/disassembles it; `encodings.s` pins 126 `-show-encoding` cases,
|
||||
`disassembler.s` 77 inverse checks, and `roundtrip.s` 88 instructions
|
||||
`disassembler.s` 77 inverse checks, and `roundtrip.s` 90 instructions
|
||||
round-trip through the 1987 `dis34`. The expected bytes come from GSPA
|
||||
listings, not from the new encoder. `llvm-mc -filetype=obj` uses LLVM's
|
||||
generic ELF writer; only `llc -filetype=obj` produces TI-COFF. The 10-byte
|
||||
@@ -862,15 +976,15 @@ surface on top. The M5 state below is the baseline.
|
||||
under the ignored `vendor/conformance` (test-only; GCC is GPL and
|
||||
c-testsuite keeps its own per-test licenses; neither is distributed). The
|
||||
GCC version is only the c-torture corpus source; the compiler under test is
|
||||
`tms-clang`. The shipped tiers at the M8 head are
|
||||
`tms-clang`. The shipped tiers at the M9 head are
|
||||
LLVM `CodeGen/Generic` (197 `.ll`: 151 pass / 46 unsupported / 0 crash, plus
|
||||
a 24-file curated allowlist), GCC c-torture `execute` (curated 79/79 at
|
||||
`-O0` and `-O2`; M6 Task 8 expanded the shared list from 59 to 79), and
|
||||
c-testsuite `single-exec` (curated 48 pass / 172 skip / 220, with exact
|
||||
`.c.expected` output). M8 re-runs the **full** corpora end-to-end through
|
||||
the classifier and runner: c-torture 1,692 = **1,386 pass / 306 skip / 0
|
||||
`.c.expected` output). M9 re-runs the **full** corpora end-to-end through
|
||||
the classifier and runner: c-torture 1,692 = **1,408 pass / 284 skip / 0
|
||||
fail / 0 crash**, c-testsuite 220 = **210 pass / 10 skip / 0 fail / 0
|
||||
crash** (all 1,912 = 1,596 / 316 / 0 / 0). The shim provides `printf`/`sprintf` with a
|
||||
crash** (all 1,912 = 1,618 / 294 / 0 / 0). The shim provides `printf`/`sprintf` with a
|
||||
real `va_list` walk and `%ld`/`%lld`/`%f` plus width/precision,
|
||||
`putchar`/`puts`, `exit`/`abort`, a 16 KiB stdout buffer, a distinct 16 KiB
|
||||
stderr stream (`fprintf`/`vfprintf`/`fputs`/`fputc`/`fwrite`, length at
|
||||
@@ -1042,7 +1156,7 @@ M2 replaces the M1 test convention with the TI ABI and stops at assembly:
|
||||
|
||||
## The TI ABI
|
||||
|
||||
| | M1 test convention (branch `m1`) | TI ABI (M2–M8) |
|
||||
| | M1 test convention (branch `m1`) | TI ABI (M2–M9) |
|
||||
|---|---|---|
|
||||
| Integer/pointer arguments | `A0`–`A3`, four maximum | program stack via `A14` (STK), pushed in reverse |
|
||||
| Argument slots | registers | first at `FP(-32)`, second at `FP(-64)`, … |
|
||||
@@ -1061,22 +1175,67 @@ sign-extending) and `FS1` must be 32 at function entry and immediately after
|
||||
every `CALLA` (`SETF 16,1,0` then `SETF 32,0,1`), because ROM code may change
|
||||
either field size. FS0 drives `short` loads/stores and FS1 drives 32-bit words.
|
||||
|
||||
## Run the M8 gates
|
||||
## Compile C with `tms-cc`
|
||||
|
||||
These are the documented commands on branch `m8`; all must pass. The MAME and
|
||||
`tms-cc` is the Phase 1 usability driver. It hides the bit-address IR barrier,
|
||||
`llc`, the OS/2/GSPA entry assembly and the native linker:
|
||||
|
||||
```sh
|
||||
cd /home/arti/code/tms-c-compiler
|
||||
|
||||
# Compile, link with the freestanding conformance shim + entry, run in MAME.
|
||||
scripts/tms-cc hello.c -o hello.coff
|
||||
scripts/tms-run hello.coff # prints status and captured stdout/stderr
|
||||
|
||||
# Raw stages when you need them
|
||||
scripts/tms-cc -c hello.c -o hello.o # relocatable TI-COFF
|
||||
scripts/tms-cc -S hello.c -o hello.s # GSPA assembly
|
||||
|
||||
# Multiple TUs, optimization, debug, extra libraries
|
||||
scripts/tms-cc -O0 -g a.c b.c -o app.coff
|
||||
scripts/tms-cc -L lib -l flib hello.c -o hello.coff
|
||||
```
|
||||
|
||||
- The default link uses the freestanding conformance shim (`printf`,
|
||||
`sprintf`, `malloc`/`free`, string functions) and its `_start`; use
|
||||
`-nostdlib` if your program provides all symbols/entry itself.
|
||||
- Default layout: `.text` `018A0000`, `.bss` `01A00000`, prog `40000h`,
|
||||
ram `80000h`; override with `--text`, `--bss`, `--prog-len`, `--ram-len`.
|
||||
- `-l` archives are resolved from `-L` dirs or the extracted SDK
|
||||
(`build/m6-sdk`, `build/m4-sdk`); the SDK `flib.lib`/`rts.lib` are linked by
|
||||
default for the shim's `%f` path.
|
||||
- The entry is assembled with the 2ine OS/2 tools when present, otherwise
|
||||
DOSBox/GSPA; linking always uses `tools/tms-link`.
|
||||
- `-g` is supported for `-c` objects (and the link pipeline); the linked load
|
||||
image is stripped as usual.
|
||||
- The target is freestanding: no hosted libc or file I/O; `tms-run` reads the
|
||||
conformance result block. For X11/ROM-call programs, use the M4 harness and
|
||||
`scripts/m4/x11m4.h`.
|
||||
|
||||
The existing IR-only `scripts/tms-clang` remains the gate pipeline and is
|
||||
unchanged; `tms-cc` is the user-facing driver on top of it. Native
|
||||
`clang --target=tms34010 -c` is still not semantically correct for pointer
|
||||
code because LLVM GEPs are byte-based (Phase 2).
|
||||
|
||||
## Run the M9 gates
|
||||
|
||||
These are the documented commands on branch `m9`; all must pass. The MAME and
|
||||
conformance gates are slow, share the M4 SDK image, and must run **serially**
|
||||
(no two gates at once). The M8 gate list is the M7.1/M7.2/M7.3/M5/M6 list
|
||||
plus the M8.1/M8.2 library and multi-TU DWARF gates (step 3e), the fresh
|
||||
end-to-end full suite and the i64 performance gate (step 3f). The count change
|
||||
is lit **118 → 120** from `m8-bitops.ll` and `m8-i64div-wide.ll`; the fresh
|
||||
full-suite total is **1,596 pass / 316 skip / 0 fail / 0 crash**.
|
||||
(no two gates at once). The M9 gate list is the
|
||||
M7.1/M7.2/M7.3/M7.4/M8.1/M8.2/M5/M6 list plus the M9.1/M9.2 lit additions and
|
||||
DWARF form/rnglists gate (step 3g),
|
||||
the fresh end-to-end two-tier suite and the four-phase i64 performance gate
|
||||
(step 3f). The count
|
||||
change is lit **120 → 129** (nine new `m9-*` CodeGen tests; MC stays 4); the
|
||||
fresh full-suite total is **1,618 pass / 294 skip / 0 fail / 0 crash**.
|
||||
|
||||
```sh
|
||||
# 1. Build llc, the assembler/disassembler driver and dwarfdump
|
||||
ninja -C build/llvm-clean-build llc clang opt llvm-mc llvm-dwarfdump
|
||||
|
||||
# 2. LLVM codegen tests: 116 passed
|
||||
# (34 m2-* + 8 m3-* + 18 m4-* + 15 m5-* + 28 m6-* + 11 m7-* + 2 m8-*)
|
||||
# 2. LLVM codegen tests: 125 passed
|
||||
# (34 m2-* + 8 m3-* + 18 m4-* + 15 m5-* + 28 m6-* + 11 m7-* + 2 m8-*
|
||||
# + 9 m9-*)
|
||||
build/llvm-clean-build/bin/llvm-lit -v \
|
||||
build/llvm-clean/llvm/test/CodeGen/TMS34010
|
||||
|
||||
@@ -1119,21 +1278,29 @@ M6_LINKER=tms-link scripts/tests/m6/runtime.sh
|
||||
M6_LINKER=tms-link scripts/tests/m6/i64.sh
|
||||
# -> the M5/M6 library links accept tms-link; GSPLNK stays the default/oracle
|
||||
|
||||
# 3f. M8.3 full external suites (two-tier: bare default ~35 min; serial) and
|
||||
# the i64 fast/wide performance gate (MAME; serial)
|
||||
# 3f. M9.4 full external suites (two-tier: bare default ~35 min; serial) and
|
||||
# the four-phase i64 performance gate (MAME; serial)
|
||||
scripts/m8/setup-os2.sh # once: direct 2ine + qemu-i386 fallback
|
||||
LLVM_BIN=$PWD/build/llvm-clean-build/bin \
|
||||
scripts/tests/m7/full-suite.sh --corpus all --redo --work build/m8-bare-full
|
||||
# -> c-torture 1692 = 1386 pass / 306 skip / 0 fail / 0 crash
|
||||
scripts/tests/m7/full-suite.sh --corpus all --redo --work build/m9-bare-full
|
||||
# -> c-torture 1692 = 1408 pass / 284 skip / 0 fail / 0 crash
|
||||
# c-testsuite 220 = 210 pass / 10 skip / 0 fail / 0 crash
|
||||
# all 1912 = 1596 pass / 316 skip / 0 fail / 0 crash
|
||||
# The 10 full-loader exceptions are in scripts/tests/m7/full-suite.full-loader.
|
||||
# The fresh TSV/report are in build/m8-bare-full and
|
||||
# all 1912 = 1618 pass / 294 skip / 0 fail / 0 crash
|
||||
# The bare tier is the driver default (M5_CONFORMANCE_BARE=1). The explicit
|
||||
# 10-test full-loader exception list is scripts/tests/m7/full-suite.full-loader;
|
||||
# the curated M5/M6 gates below are the full-loader tier by default
|
||||
# (M5_CONFORMANCE_BARE=0). The fresh TSV/report are in build/m9-bare-full and
|
||||
# scripts/tests/m7/full-suite-report.txt.
|
||||
scripts/tests/m7/i64div.sh # 32-bit DIVU and the 64/32 wide path in MAME
|
||||
# -> M7 I64DIV PERF: PASS; fast_frames=87 slow_frames=2440 wide_frames=218,
|
||||
# ratio=28.0 wide_ratio=11.2 status=600D600D
|
||||
# cs_fast=000000011E6F9AB4 cs_slow=00000000007512AE cs_wide=00025AF70AF974E0
|
||||
scripts/tests/m7/i64div.sh # fast/slow/wide/div32 DIVU paths in MAME
|
||||
# -> M7 I64DIV PERF: PASS; fast_frames=88 slow_frames=3302 wide_frames=221
|
||||
# div32_frames=120 ratio=37.5 wide_ratio=14.9 div32_ratio=1.8
|
||||
# status=600D600D
|
||||
# cs_fast=000000011E6F9AB4 cs_slow=00000000007512AE
|
||||
# cs_wide=F56810CFEDA9D656 cs_div32=00002C61C63842EE
|
||||
|
||||
# 3g. M9.2 DWARF v5 form gate and two-TU .debug_rnglists fixture (hermetic)
|
||||
scripts/tests/m9/dwarf-ranges.sh # dwarfdump ranges/addresses, single-TU bytes
|
||||
# -> M9 dwarf-ranges: PASS
|
||||
|
||||
# 4. M6 language/runtime gates (MAME; run serially)
|
||||
scripts/tests/m6/spike.sh # hand-written flib/rts ABI probe
|
||||
@@ -1149,7 +1316,7 @@ scripts/tests/m6/runtime.sh # linked flib/rts + printf/sprintf, both
|
||||
# 5. Native object, link and MC round-trip
|
||||
scripts/tests/m5/object-smoke.sh # native .text == GSPA .text
|
||||
scripts/tests/m5/native-link.sh # GSPLNK link + loader/MAME markers
|
||||
scripts/tests/m5/mc-roundtrip.sh # 88 instructions through dis34
|
||||
scripts/tests/m5/mc-roundtrip.sh # 90 instructions through dis34
|
||||
|
||||
# 6. The real M4 clients through the native object path
|
||||
scripts/tests/m5/native.sh
|
||||
@@ -1163,7 +1330,8 @@ scripts/tests/m5/policy.sh
|
||||
scripts/tests/m5/private-long.sh
|
||||
scripts/tests/m5/conformance/selftest.sh
|
||||
|
||||
# 8. The conformance tiers
|
||||
# 8. The conformance tiers (curated M5/M6 gates are the full-loader tier;
|
||||
# M5_CONFORMANCE_BARE=0 is their default, =1 selects the bare tier)
|
||||
scripts/tests/m5/generic.sh # Generic allowlist + no-crash sweep
|
||||
scripts/tests/m5/c-torture.sh # 79 tests at -O0 and -O2
|
||||
scripts/tests/m5/c-testsuite.sh # 48 output tests + 172 reported skips
|
||||
@@ -1203,10 +1371,10 @@ The gate log prints each tier's counts; skipped tests carry a feature reason
|
||||
and are never counted as passes. The conformance tiers run serially because
|
||||
`M4_SDK` is shared; the MAME boot dominates the runtime.
|
||||
|
||||
## Run the M4 gates (branch `m4`; also green on `m5`–`m8`)
|
||||
## Run the M4 gates (branch `m4`; also green on `m5`–`m9`)
|
||||
|
||||
These are the documented commands on branch `m4`; all must pass. On branches
|
||||
`m5`–`m8`, use the M8 list above (it includes `llvm-mc`,
|
||||
`m5`–`m9`, use the M9 list above (it includes `llvm-mc`,
|
||||
`llvm-dwarfdump`, the M7.2 gates and the M5/M6 gates); the M4
|
||||
commands below remain the historical regression set and use the `m4` test
|
||||
counts. The MAME gates are slow and are run once.
|
||||
@@ -1598,7 +1766,7 @@ deliberately stopped before:
|
||||
reason, not counted as passes.
|
||||
- **Deeper libc/runtime coverage:** M5's shim is freestanding and does not add
|
||||
`RTS.LIB` entries. M6 links the 1990 `flib.lib`/`rts.lib` and expands
|
||||
`printf`/`sprintf`; a broader libc surface remains M8 conformance work.
|
||||
`printf`/`sprintf`; a broader libc surface remains later conformance work.
|
||||
- **Native `.cinit` and public long names:** at M5 the object writer accepted only
|
||||
`.text`/`.data`/`.bss` (termtris's `.cinit` is GSPA assembly and fails loudly
|
||||
if a C TU tries to emit it), and public identifiers longer than GSPA's 31
|
||||
@@ -1615,7 +1783,7 @@ gates are likewise test/runtime inputs, extracted from the SDK into
|
||||
## Repository layout
|
||||
|
||||
```text
|
||||
build/llvm-clean/ compiler fork checkout used for M2–M8 (ignored)
|
||||
build/llvm-clean/ compiler fork checkout used for M2–M9 (ignored)
|
||||
build/llvm-clean-build/ its Ninja build tree (ignored)
|
||||
build/m6-sdk/ extracted 1990 flib.lib/rts.lib (ignored, not vendored)
|
||||
build/llvm-src/ M0 working fork (ignored)
|
||||
@@ -1646,6 +1814,8 @@ scripts/tests/m7/ M7.1/M7.2/M7.3/M7.4 gates and drivers (pointer-o2/strid
|
||||
full-suite/i64div)
|
||||
scripts/m8/ M8 archive/library and multi-TU DWARF fixtures/checkers
|
||||
scripts/tests/m8/ M8.1 native-lib and M8.2 dwarf-multi gates (+ COFF parity)
|
||||
scripts/m9/ M9 DWARF rnglists fixtures and producer shapes
|
||||
scripts/tests/m9/ M9.2 dwarf-ranges gate (v5 form gate + rnglists)
|
||||
scripts/m1/ M1 harness (historical; also on branch `m1`, not an M2 gate)
|
||||
scripts/tests/m1/ M1 gates (historical; also on branch `m1`, not an M2 gate)
|
||||
scripts/tests/m0/ M0 integration tests
|
||||
@@ -1660,7 +1830,7 @@ docs/ design and plans
|
||||
## Prerequisites
|
||||
|
||||
`cmake`, `ninja-build`, `ccache`, a C++17 host compiler (GCC 14 is used here),
|
||||
Python 3, and about 20 GB of disk for the LLVM source and build. The M2–M8
|
||||
Python 3, and about 20 GB of disk for the LLVM source and build. The M2–M9
|
||||
MAME and dis34 gates additionally need `dosbox`, `mtools` (`mcopy`), the
|
||||
VT1200 SDK image, the `dwt` COFF loader, `dis34`, and a built MAME `vt1200`
|
||||
binary (`build/mame-src/vt1200`). The termtris gate also needs the pinned
|
||||
@@ -1685,14 +1855,14 @@ Xlib call sequence, `as34`, `dis34`, SDKs, manuals). It is not vendored:
|
||||
|
||||
## Build the compiler
|
||||
|
||||
### Compiler fork (M8, the normal path)
|
||||
### Compiler fork (M9, the normal path)
|
||||
|
||||
The fork checkout already exists at `build/llvm-clean` on `m8` (the current
|
||||
The fork checkout already exists at `build/llvm-clean` on `m9` (the current
|
||||
milestone branch and repository default). Build it in
|
||||
place:
|
||||
|
||||
```sh
|
||||
LLVM_SRC=$PWD/build/llvm-clean LLVM_BRANCH=m8 ./scripts/build-llvm.sh
|
||||
LLVM_SRC=$PWD/build/llvm-clean LLVM_BRANCH=m9 ./scripts/build-llvm.sh
|
||||
# binaries: build/llvm-clean-build/bin/{llc,llvm-mc,clang,opt,llvm-config,FileCheck}
|
||||
# lit driver: build/llvm-clean-build/bin/llvm-lit
|
||||
```
|
||||
@@ -1701,7 +1871,7 @@ To clone the fork first instead of using an existing checkout:
|
||||
|
||||
```sh
|
||||
LLVM_REPO=gitea@git.wut.ee:opencode.siil.arti.ee/llvm-tms34010.git \
|
||||
LLVM_BRANCH=m8 ./scripts/build-llvm.sh
|
||||
LLVM_BRANCH=m9 ./scripts/build-llvm.sh
|
||||
```
|
||||
|
||||
Fork mode **never** checks out, resets, cleans or patches the source tree; it
|
||||
@@ -1727,7 +1897,7 @@ M1–M6.
|
||||
|
||||
## Build the M0 support tools
|
||||
|
||||
The M2–M8 pipeline uses `tms-bitaddr` (`--scale`, `--normalize`, `--bitptr`,
|
||||
The M2–M9 pipeline uses `tms-bitaddr` (`--scale`, `--normalize`, `--bitptr`,
|
||||
`--lower-bitptr`) and `tms-clang`:
|
||||
|
||||
```sh
|
||||
@@ -1735,7 +1905,7 @@ LLVM_CONFIG=$PWD/build/llvm-clean-build/bin/llvm-config \
|
||||
tools/tms-bitaddr/build.sh
|
||||
```
|
||||
|
||||
M0 regression test (optional in M2–M8):
|
||||
M0 regression test (optional in M2–M9):
|
||||
|
||||
```sh
|
||||
TMS_CLANG=$PWD/build/llvm-clean-build/bin/clang \
|
||||
@@ -1864,9 +2034,11 @@ M7.4 is complete: the full external suites, the i64 divide/remainder fast
|
||||
path and the final M7/M8 boundary. M8 is complete: native `.lib` archive
|
||||
linking in `tms-link`, multi-TU DWARF merging, the rotate/count/byte-swap
|
||||
lowering and 64/32 i64 divide path, 20 conformance flips and the final
|
||||
M8/M9 boundary. M9 owns the remaining conformance classes, the pre-existing
|
||||
`pr63843` hang, further performance work and the real VT1200 run when the
|
||||
unit is available (the run remains **deferred**).
|
||||
M8/M9 boundary. M9 is complete: vector `.data` and inline-asm `r` (22 flips),
|
||||
the DWARF v5 form gate and `.debug_rnglists`, the single-DIVU 64/32 path and
|
||||
the final M9/M10 boundary. M10 owns the remaining conformance classes, the
|
||||
pre-existing `pr63843` hang, further performance work and the real VT1200 run
|
||||
when the unit is available (the run remains **deferred**).
|
||||
2ine r5.01 is a later speed-up for the GSPA/GSPLNK step. The compiler fork is
|
||||
canonical for target code; this project holds the plan, harness, pins and
|
||||
integration tests.
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
# TMS34010 M9 — Conformance Classes, Debug Depth and Performance Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax.
|
||||
|
||||
**Goal:** Raise the full-suite pass rate with the highest-value remaining classes, close the M8 DWARF/linker caveats, add a measured 64/32 divide fast path, and close M9 with the hardware status and boundary.
|
||||
|
||||
**Architecture:** Vector `.data` becomes another recursive aggregate in both the raw and object emitters; the target supplies an inline-asm register resolver for the A-register classes. The linker gains a form-aware DWARF input check (or walker) plus `.debug_rnglists` merging. The i64 outliner adds a single-DIVU 64/32 path when the quotient fits. The bare conformance tier and the full-loader list remain the two-tier harness.
|
||||
|
||||
**Tech Stack:** LLVM/Clang 23.1.5 fork (`llvm-tms34010`, branch `m9`), `tms-clang`, `llc`, `tms-link`, TI COFF, the dwt loader, MAME, `llvm-dwarfdump`, Python 3, the M8 two-tier harness and pins.
|
||||
|
||||
**Spec:** `docs/superpowers/specs/2026-11-10-tms34010-llvm-design.md` §8 (M9.1–M9.4); the M8 README/ledger boundary.
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- M9 baseline: compiler `m8`/`e3ad91edd130`, project `m8`/`f340d74`; work on `m9`. The default is promoted to `m9` only after the final review.
|
||||
- Keep every M2–M8.4 gate green, the TI all-stack ABI, the asm/GSPLNK oracle, the native loader contract, and the two-tier harness.
|
||||
- `M5_CONFORMANCE_BARE=1` remains the conformance default; full-loader exceptions need a reason in `full-suite.full-loader`.
|
||||
- Vector and inline-asm changes must be tested at `-O0` and `-O2`; unsupported shapes stay loud.
|
||||
- DWARF merging must stay section-relative and stripped-image compatible; single-TU output remains byte-compatible with M8.
|
||||
- Full-suite accounting remains one row per file; no crash/unclassified result; skips always carry a reason.
|
||||
- No push until the M9 final review is clean; then push `m9`, promote it, and update the README.
|
||||
|
||||
## Review Focus
|
||||
|
||||
1. **Vector bytes:** exact element order/padding for integer/fp vectors, packed widths, aggregate zero, raw and object paths; no over-read/write; existing scalar/record output unchanged.
|
||||
2. **Inline asm:** constraint mapping for i16/i32, clobbers, output/input ties, unsupported constraints loud; `-O0`/`-O2`.
|
||||
3. **DWARF:** form walker completeness, rnglists merging, offset rehoming, single-TU compatibility, dwarfdump and stripped MAME.
|
||||
4. **Divide:** 64/32 condition and quotient-fit, magnitudes/sign, `INT64_MIN`, divide-by-zero, measured frames/checksums, no M8 path regression.
|
||||
5. **No M2–M8.4 regression**, two-tier counts, and the final boundary.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Vector `.data` and inline-asm `r` constraints
|
||||
|
||||
**Files:**
|
||||
- Modify: `llvm/lib/Target/TMS34010/TMS34010AsmPrinter.cpp` (raw/object vector initializers)
|
||||
- Modify: `llvm/lib/Target/TMS34010/TMS34010ISelLowering.{h,cpp}` (inline-asm register resolver)
|
||||
- Create/modify: `llvm/test/CodeGen/TMS34010/m9-vector-data.ll`, `m9-inline-asm.ll`
|
||||
- Test: `scripts/tests/m7/data.sh`, the full-suite vector/inline-asm rows, M6/M5 gates
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: the recursive `.data` emitter and the A-register classes (`ARegs`, `ARegsEven`, …).
|
||||
- Produces: exact vector initializer bytes (integer/fp element vectors, aggregate zero, byte-multiple only) in raw and object modes; `getRegForInlineAsmConstraint` mapping `r`/`=r` (and documented accepted subsets) to the target register classes; unsupported vectors/constraints loud.
|
||||
|
||||
- [ ] **Step 1: Write failing tests.** `m9-vector-data.ll` with `<2 x i32>`, `<4 x i16>`, an fp vector if supported, and a vector zero; `data.sh` raw/object bytes. `m9-inline-asm.ll` with `r` input/output at `-O0`/`-O2`. Current emitter rejects vectors; inline asm fails to allocate.
|
||||
- [ ] **Step 2: Run red.**
|
||||
- [ ] **Step 3: Implement.** Vector constants as ordered element bytes with exact alloc size; `ConstantAggregateZero` vector zero; keep unsupported widths/types loud. Implement the inline-asm resolver and clobber handling; reject unsupported constraints with a named error.
|
||||
- [ ] **Step 4: Run green.** Lit, data.sh, and the affected full-suite rows (bare/full-loader as appropriate); record flips.
|
||||
- [ ] **Step 5: Commit** (compiler + project gates/tests).
|
||||
|
||||
### Task 2: DWARF form walker and `.debug_rnglists`
|
||||
|
||||
**Files:**
|
||||
- Modify: `tools/tms-link/tms-link`, `tools/tms-link/tmscoff.py`
|
||||
- Create: `scripts/tests/m9/dwarf-ranges.sh`, fixtures
|
||||
- Test: `scripts/tests/m8/dwarf-multi.sh`, `scripts/tests/m7/debug.sh`, `llvm-dwarfdump`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: M8's multi-TU debug merge and the current CU-abbrev-only raw patch.
|
||||
- Produces: a form-aware check/walker that rejects (or correctly patches) unrelocated section-relative fields, and `.debug_rnglists` concatenation/rehoming with a fixture; single-TU bytes unchanged.
|
||||
|
||||
- [ ] **Step 1: Write failing tests.** A synthetic object with an unrelocated `DW_AT_stmt_list`/`strp` (or a documented rejection), and a multi-TU `.debug_rnglists` fixture; current code silently assumes relocations.
|
||||
- [ ] **Step 2: Run red.**
|
||||
- [ ] **Step 3: Implement** the form walk (or input gate) and rnglists merge; keep the loud paths.
|
||||
- [ ] **Step 4: Run green.** `dwarf-ranges.sh`, `dwarf-multi.sh`, `m7/debug.sh`, stripped MAME.
|
||||
- [ ] **Step 5: Commit.**
|
||||
|
||||
### Task 3: 64/32 single-DIVU fast path
|
||||
|
||||
**Files:**
|
||||
- Modify: `llvm/lib/Target/TMS34010/TMS34010TargetMachine.cpp` (`lowerDivRem`)
|
||||
- Create/modify: `llvm/test/CodeGen/TMS34010/m9-i64div-64-32.ll`
|
||||
- Modify: `scripts/m7/i64div-perf.c`, `scripts/tests/m7/i64div.sh`
|
||||
- Test: `scripts/tests/m6/i64.sh`, `m6/runtime.sh`, `i64div.sh`
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: the M8 fast/wide/loop CFG and the target `DIVU` 64-bit pair.
|
||||
- Produces: when the divisor's high word is zero and the quotient fits 32 bits (e.g. `hi(N) < D`), a single even-destination `DIVU` fast path; otherwise the M8 two-DIVU/loop path. Signed normalization and fixups unchanged.
|
||||
|
||||
- [ ] **Step 1: Write failing tests.** A 64/32 case with `hi(N) < D` requiring one `DIVU`; the M8 wide cases still two; perf phase measured.
|
||||
- [ ] **Step 2: Run red.**
|
||||
- [ ] **Step 3: Implement** the single-DIVU branch; preserve `INT64_MIN`, divide-by-zero UB and signs.
|
||||
- [ ] **Step 4: Run green.** Lit, M6 i64/runtime, i64div measurements; record frames/checksums.
|
||||
- [ ] **Step 5: Commit.**
|
||||
|
||||
### Task 4: Hardware status, final M9 docs, full gates, review, promote
|
||||
|
||||
**Files:**
|
||||
- Modify: `README.md`, `build/llvm-clean/TMS34010.md`, spec (M9 status)
|
||||
- Test: the full M0–M9 list
|
||||
|
||||
- [ ] **Step 1: Hardware.** Run `VT1200_HOST=… scripts/tests/m7/hardware.sh` if a unit is available; otherwise keep `HARDWARE: DEFERRED`.
|
||||
- [ ] **Step 2: Docs.** Record M9.1/M9.2/M9.3 results, flips, perf, the final two-tier counts and the M9/M10 boundary; update the gate commands.
|
||||
- [ ] **Step 3: Gates and review.** Run the full serial list, commit, final whole-branch review, then push `m9`.
|
||||
- [ ] **Step 4: Promote.** Set `m9` as the repository default on both remotes (per the standing policy), update the README/docs default language, and verify `refs/heads/m9` is HEAD.
|
||||
|
||||
---
|
||||
|
||||
## Execution Handoff
|
||||
|
||||
M9 closes the highest-value conformance classes, the DWARF future-producer and rnglists caveats, and adds a measured 64/32 divide fast path. The remaining classes (`blockaddress`, nested functions, VLAs, sret/aggregate/variadic/float returns, libm), broader hardware/link depth and any further performance work are M10. The compiler repo is canonical; the project holds the linker, harness, plans and gates.
|
||||
@@ -640,21 +640,75 @@ rehomes the supported DWARF5 sections; `llvm-dwarfdump` shows both TUs'
|
||||
functions, lines and linked PCs, the stripped image runs in MAME, and the
|
||||
single-TU link is byte-identical to M7 (`scripts/tests/m8/dwarf-multi.sh`).
|
||||
The bit-op class (rotate/`cttz`/`ctpop`/`ctlz`/`bswap`) lowers without invented
|
||||
instructions, and the 64/32 i64 divide path measures **218** frames versus
|
||||
**2,440** for the 64-step loop (11.2×), while the fits-32 path measures **87**
|
||||
(28.0×), status `600D600D`, checksums `000000011E6F9AB4`/
|
||||
`00000000007512AE`/`00025AF70AF974E0`. The fresh end-to-end full suite
|
||||
instructions. At M8 the three-phase gate measured the 64/32 i64 divide path at
|
||||
**218** frames versus **2,440** for the 64-step loop (11.2×) and the fits-32
|
||||
path at **87** (28.0×), status `600D600D`, checksums
|
||||
`000000011E6F9AB4`/`00000000007512AE`/`00025AF70AF974E0`; M9.3 makes the gate
|
||||
four-phase, narrows the wide input to force the two-`DIVU` helper, and re-pins
|
||||
the wide checksum (see the M9 acceptance). The fresh end-to-end full suite
|
||||
accounts for **1,912 = 1,596 pass / 316 skip / 0 fail / 0 crash** (c-torture
|
||||
**1,386 / 306**, c-testsuite **210 / 10**), with 64 classifier plus 252
|
||||
curated skips, each with a reason; the 20 flipped rows are the six rotates,
|
||||
six `cttz`, four `bswap` and four per-test `LOADER_END=2000` runtime rows.
|
||||
Lit is **120/120** (116 CodeGen + 4 MC) and clang Sema/CodeGen **5/5**. The
|
||||
real VT1200 run remains **DEFERRED** (`VT1200_HOST` unset; the hardware gate
|
||||
prints `HARDWARE: DEFERRED` on the MAME-equivalent acceptance). M9 owns the
|
||||
remaining conformance classes (`blockaddress`, vector `.data`, inline-asm
|
||||
constraints, nested functions, VLAs, sret/aggregate/variadic/float returns,
|
||||
libm, runtime aborts), the pre-existing `pr63843` hang, further performance
|
||||
work and the real VT1200 run when the unit is available.
|
||||
prints `HARDWARE: DEFERRED` on the MAME-equivalent acceptance). M9 closed vector
|
||||
`.data` and inline-asm `r`, the DWARF future-producer/`.debug_rnglists`
|
||||
caveats and the 64/32 divide path; M10 owns the remaining classes
|
||||
(`blockaddress`, vector runtime, inline-asm memory constraints, nested
|
||||
functions, VLAs, sret/aggregate/variadic/float returns, libm, runtime aborts),
|
||||
the pre-existing `pr63843` hang, further performance work and the real VT1200
|
||||
run when the unit is available.
|
||||
|
||||
### M9 — conformance classes, debug depth, performance
|
||||
|
||||
M9 builds on the M8 baseline (`m8`, default) and uses the same plan,
|
||||
subagent-driven loop, review and push discipline. Work is on `m9`; the default
|
||||
is promoted to `m9` only after the final review, per the repository policy.
|
||||
|
||||
- **M9.1 — conformance classes.** Remove the highest-value remaining M8 skips:
|
||||
vector `.data` initializers (integer/fp vector constants emitted as their
|
||||
exact element bytes in the raw and object paths) and inline-asm `r`/`=r`
|
||||
register constraints (map the target's A-register classes; reject
|
||||
unsupported constraints loudly). The affected full-suite rows must flip to
|
||||
pass and be recorded; `blockaddress`, nested functions, VLAs, sret/
|
||||
aggregate/variadic/float returns and libm remain explicit M10 boundaries.
|
||||
- **M9.2 — debug/linker depth.** Replace the M8 raw-offset assumption with a
|
||||
form-aware DWARF walker (or an input gate that rejects any unrelocated
|
||||
section-relative field), add a `.debug_rnglists` fixture and merged-range
|
||||
validation, and keep the single-TU output byte-compatible. The default load
|
||||
image stays stripped; `--keep-debug` remains the tool image.
|
||||
- **M9.3 — performance.** Add a single `DIVU` 64/32 fast path when the divisor
|
||||
fits 32 bits and the quotient fits (or another equally justified path),
|
||||
measured against the M8 64/32 two-DIVU path and the 64-step loop. The bare
|
||||
conformance tier remains the default; no test-accounting regression.
|
||||
- **M9.4 — hardware and close-out.** Run the real VT1200 harness when the unit
|
||||
is available; otherwise keep `HARDWARE: DEFERRED` explicit. Produce the final
|
||||
M9 docs/counts/limitations and the M9/M10 boundary.
|
||||
|
||||
M9 acceptance (met, M9 complete): vector `.data` and inline-asm `r`/`=r`
|
||||
constraints are fixed with **22** recorded flips (20 inline-asm `r`, `simd-5`
|
||||
and `pr123625-2`), and the five remaining candidates stay curated with
|
||||
corrected reasons (i64 `r` pair, timeout, two vector runtime aborts, memory
|
||||
operand). Lit is **129/129** (125 CodeGen + 4 MC). The multi-object
|
||||
`--keep-debug` path walks every form and refuses pre-v5 producers and any
|
||||
unrelocated section-relative field loudly; the two-TU `.debug_rnglists`
|
||||
fixture and a real `-O2 -g` producer both validate with `llvm-dwarfdump`, the
|
||||
single-TU bytes keep the M8 layout, and the stripped image still runs. The
|
||||
four-phase i64 gate measures fast **88**, slow **3,302**, wide **221** and
|
||||
div32 **120** frames — **37.5×** (fast) and **14.9×** (wide) versus the loop,
|
||||
and **1.8×** for div32 versus the two-DIVU wide phase — with
|
||||
status `600D600D` and checksums `000000011E6F9AB4`/`00000000007512AE`/
|
||||
`F56810CFEDA9D656`/`00002C61C63842EE`; the new path is correct for
|
||||
signed/unsigned, divide-by-zero UB, and `INT64_MIN` (which never fits 32 bits:
|
||||
it keeps the two-step helper for a divisor of at most `2^31` and takes the
|
||||
single-`DIVU` path for a divisor in `(2^31, 2^32)`). The fresh two-tier full
|
||||
suite accounts for every file: **1,912 = 1,618 pass / 294 skip / 0 fail / 0
|
||||
crash** (c-torture **1,408 / 284**, c-testsuite **210 / 10**), with every skip
|
||||
carrying a reason and the 10 full-loader exceptions explicit. Every M2–M8.4
|
||||
gate stays green and the new M9 lit/DWARF gates pass, while the real VT1200
|
||||
run remains **DEFERRED**. M9 is complete; the remaining classes are the M9/M10
|
||||
boundary.
|
||||
|
||||
## 9. Risks and mitigations
|
||||
|
||||
|
||||
+3
-1
@@ -266,7 +266,9 @@ if [ "$NATIVE" = 1 ]; then
|
||||
NATIVE_LIB_PATHS=
|
||||
for lib in $NATIVE_LIBS; do
|
||||
dos=$(printf '%s' "$lib" | tr '[:lower:]' '[:upper:]')
|
||||
if [ -f "$SDK/$dos" ]; then
|
||||
if [ -f "$lib" ]; then
|
||||
NATIVE_LIB_PATHS="$NATIVE_LIB_PATHS $lib"
|
||||
elif [ -f "$SDK/$dos" ]; then
|
||||
NATIVE_LIB_PATHS="$NATIVE_LIB_PATHS $SDK/$dos"
|
||||
elif [ -f "$SDK/$lib" ]; then
|
||||
NATIVE_LIB_PATHS="$NATIVE_LIB_PATHS $SDK/$lib"
|
||||
|
||||
@@ -7,8 +7,8 @@ Usage:
|
||||
MAP is a GSPLNK 2.00 map (the SECTION ALLOCATION MAP has origin/length in
|
||||
bits) or a tms-link map (the symbol addresses give .text/etext,
|
||||
.data/edata, .bss/end). MARKER_HEX is the marker base bit address; the gate
|
||||
uses 12 cells 0x20 bits apart. The optional region arguments are also in hex
|
||||
(bits) and bound .text/.data to prog and .bss/the markers to ram.
|
||||
uses up to 16 cells 0x20 bits apart. The optional region arguments are also
|
||||
in hex (bits) and bound .text/.data to prog and .bss/the markers to ram.
|
||||
|
||||
Exit status: 0 = every check passed, 1 = overlap/out-of-region, 2 = the map
|
||||
could not be parsed.
|
||||
@@ -60,7 +60,7 @@ def main():
|
||||
return 2
|
||||
map_path = sys.argv[1]
|
||||
marker = int(sys.argv[2], 16)
|
||||
marker_end = marker + 12 * 0x20
|
||||
marker_end = marker + 16 * 0x20
|
||||
regions = None
|
||||
if len(sys.argv) == 7:
|
||||
prog_origin, prog_len, ram_origin, ram_len = (
|
||||
|
||||
@@ -10,8 +10,12 @@
|
||||
--
|
||||
-- fast phase: 16384 iterations, every divide fits 32 bits -> one DIVU each;
|
||||
-- slow phase: 16384 iterations, both high words nonzero -> the 64-step loop;
|
||||
-- wide phase: 16384 iterations, nonzero dividend high word but a 32-bit
|
||||
-- divisor -> two even-destination DIVUs (the M8.3 64/32 path).
|
||||
-- wide phase: 16384 iterations, nonzero dividend high word, 32-bit divisor
|
||||
-- and hi(N) >= D -> two even-destination DIVUs (the M8.3 64/32
|
||||
-- path, quotient needs 33+ bits);
|
||||
-- div32 phase: 16384 iterations, nonzero dividend high word, 32-bit divisor
|
||||
-- and hi(N) < D -> one even-destination DIVU plus the low-word
|
||||
-- N - q*D reconstruction (the M9.3 64/32 path).
|
||||
--
|
||||
-- The gate requires the fast phase to complete in materially fewer frames
|
||||
-- (slow_frames >= 8 * max(fast_frames, 1)) and the slow phase to be long
|
||||
@@ -19,39 +23,47 @@
|
||||
-- fast_frames=0 and compared as one frame, which can only make the check
|
||||
-- harder. The wide phase must also be materially faster than the loop
|
||||
-- (slow_frames >= 4 * max(wide_frames, 1)) and measurable (>= 2 frames).
|
||||
-- The div32 phase must be measurable and materially faster than the M8.3
|
||||
-- two-DIVU wide phase: wide_frames*4 >= div32_frames*5 (1.25x).
|
||||
--
|
||||
-- All three phase checksums are required to equal the deterministic values
|
||||
-- All four phase checksums are required to equal the deterministic values
|
||||
-- below. They were computed from the same LCG/arithmetic with an independent
|
||||
-- host implementation of scripts/m7/i64div-perf.c (see the header comment
|
||||
-- there):
|
||||
-- fast = 0x000000011E6F9AB4, slow = 0x00000000007512AE,
|
||||
-- wide = 0x00025AF70AF974E0.
|
||||
-- wide = 0xF56810CFEDA9D656, div32 = 0x00002C61C63842EE.
|
||||
-- The in-image self-check (marker 7) also covers large 32-bit magnitudes
|
||||
-- (0xFFFFFFFF/7, -123/7 and INT32_MIN/3) plus the 64/32 shapes with hi >= d,
|
||||
-- hi == d, hi < d and INT64_MIN, so a wrong quotient or remainder fails before
|
||||
-- the timing comparison.
|
||||
-- hi == d, hi < d, INT64_MIN (both the small-divisor two-step case and the
|
||||
-- 0xFFFFFFFF single-DIVU case, signed and unsigned magnitude) and the M9.3
|
||||
-- single-DIVU cases (0x1_00000000/3, 0x1_FFFFFFFF/0x10000, -2^32/3 and
|
||||
-- 2^32/-3), so a wrong quotient or remainder fails before the timing
|
||||
-- comparison.
|
||||
--
|
||||
-- Markers at 01A20000h, 0x20 bits apart (free RAM above the 4 KiB entry stack;
|
||||
-- scripts/m7/i64div-map-check.py asserts they are outside .text/.data/.bss):
|
||||
-- 0 start 0x51A47A11 | 1/2 fast checksum | 3 fast done 0xFA57D01E
|
||||
-- 4/5 slow checksum | 6 slow done 0x5104D0E5 | 7 status 0x600D600D
|
||||
-- 8 wide done 0x81DE0D0E | 9/10 wide checksum
|
||||
-- 11 div32 done 0x6432D0E5 | 12/13 div32 checksum
|
||||
|
||||
dofile(os.getenv("M4_LOADER_LUA"))
|
||||
|
||||
local ENDF = tonumber(os.getenv("LOADER_END") or "4000")
|
||||
local ENDF = tonumber(os.getenv("LOADER_END") or "5000")
|
||||
local BASE = 0x01A20000
|
||||
local START = 0x51A47A11
|
||||
local FAST_DONE = 0xFA57D01E
|
||||
local SLOW_DONE = 0x5104D0E5
|
||||
local WIDE_DONE = 0x81DE0D0E
|
||||
local DIV32_DONE = 0x6432D0E5
|
||||
local STATUS_OK = 0x600D600D
|
||||
local FAST_HI, FAST_LO = 0x00000001, 0x1E6F9AB4
|
||||
local SLOW_HI, SLOW_LO = 0x00000000, 0x007512AE
|
||||
local WIDE_HI, WIDE_LO = 0x00025AF7, 0x0AF974E0
|
||||
local WIDE_HI, WIDE_LO = 0xF56810CF, 0xEDA9D656
|
||||
local DIV32_HI, DIV32_LO = 0x00002C61, 0xC63842EE
|
||||
|
||||
local frames = 0
|
||||
local start_f, fast_f, slow_f, wide_f
|
||||
local start_f, fast_f, slow_f, wide_f, div32_f
|
||||
local reported = false
|
||||
|
||||
local function rd(n)
|
||||
@@ -74,12 +86,16 @@ emu.register_frame_done(function()
|
||||
if slow_f ~= nil and wide_f == nil and rd(8) == WIDE_DONE then
|
||||
wide_f = frames
|
||||
end
|
||||
if wide_f ~= nil and div32_f == nil and rd(11) == DIV32_DONE then
|
||||
div32_f = frames
|
||||
end
|
||||
|
||||
if wide_f ~= nil and not reported then
|
||||
if div32_f ~= nil and not reported then
|
||||
reported = true
|
||||
local fast_frames = fast_f - start_f
|
||||
local slow_frames = slow_f - fast_f
|
||||
local wide_frames = wide_f - slow_f
|
||||
local div32_frames = div32_f - wide_f
|
||||
local basis = fast_frames
|
||||
if basis < 1 then
|
||||
basis = 1
|
||||
@@ -88,34 +104,46 @@ emu.register_frame_done(function()
|
||||
if wide_basis < 1 then
|
||||
wide_basis = 1
|
||||
end
|
||||
local div32_basis = div32_frames
|
||||
if div32_basis < 1 then
|
||||
div32_basis = 1
|
||||
end
|
||||
local status = rd(7)
|
||||
local cs_fast_hi, cs_fast_lo = rd(2), rd(1)
|
||||
local cs_slow_hi, cs_slow_lo = rd(5), rd(4)
|
||||
local cs_wide_hi, cs_wide_lo = rd(10), rd(9)
|
||||
local cs_div32_hi, cs_div32_lo = rd(13), rd(12)
|
||||
local ratio = slow_frames / basis
|
||||
local wide_ratio = slow_frames / wide_basis
|
||||
local div32_ratio = wide_frames / div32_basis
|
||||
|
||||
local cs_ok = cs_fast_hi == FAST_HI and cs_fast_lo == FAST_LO
|
||||
and cs_slow_hi == SLOW_HI and cs_slow_lo == SLOW_LO
|
||||
and cs_wide_hi == WIDE_HI and cs_wide_lo == WIDE_LO
|
||||
and cs_div32_hi == DIV32_HI and cs_div32_lo == DIV32_LO
|
||||
local ok = status == STATUS_OK and cs_ok
|
||||
and slow_frames >= 20
|
||||
and slow_frames >= 8 * basis
|
||||
and wide_frames >= 2
|
||||
and slow_frames >= 4 * wide_basis
|
||||
and div32_frames >= 2
|
||||
and wide_frames * 4 >= div32_basis * 5
|
||||
|
||||
print(string.format(
|
||||
"M7: i64div perf: start=%d fast_done=%d slow_done=%d "
|
||||
.. "wide_done=%d fast_frames=%d slow_frames=%d "
|
||||
.. "wide_frames=%d ratio=%.1f wide_ratio=%.1f "
|
||||
.. "wide_done=%d div32_done=%d fast_frames=%d "
|
||||
.. "slow_frames=%d wide_frames=%d div32_frames=%d "
|
||||
.. "ratio=%.1f wide_ratio=%.1f div32_ratio=%.1f "
|
||||
.. "status=%08X cs_fast=%08X%08X cs_slow=%08X%08X "
|
||||
.. "cs_wide=%08X%08X "
|
||||
.. "cs_expected=%08X%08X/%08X%08X/%08X%08X cs=%s",
|
||||
start_f, fast_f, slow_f, wide_f, fast_frames, slow_frames,
|
||||
wide_frames, ratio, wide_ratio,
|
||||
.. "cs_wide=%08X%08X cs_div32=%08X%08X "
|
||||
.. "cs_expected=%08X%08X/%08X%08X/%08X%08X/%08X%08X cs=%s",
|
||||
start_f, fast_f, slow_f, wide_f, div32_f, fast_frames,
|
||||
slow_frames, wide_frames, div32_frames, ratio, wide_ratio,
|
||||
div32_ratio,
|
||||
status, cs_fast_hi, cs_fast_lo, cs_slow_hi, cs_slow_lo,
|
||||
cs_wide_hi, cs_wide_lo,
|
||||
cs_wide_hi, cs_wide_lo, cs_div32_hi, cs_div32_lo,
|
||||
FAST_HI, FAST_LO, SLOW_HI, SLOW_LO, WIDE_HI, WIDE_LO,
|
||||
DIV32_HI, DIV32_LO,
|
||||
cs_ok and "ok" or "BAD"))
|
||||
|
||||
if ok then
|
||||
@@ -123,22 +151,28 @@ emu.register_frame_done(function()
|
||||
else
|
||||
print(string.format(
|
||||
"M7 MAME: FAIL (status=%08X checksums=%s "
|
||||
.. "fast_frames=%d slow_frames=%d wide_frames=%d; "
|
||||
.. "fast_frames=%d slow_frames=%d wide_frames=%d "
|
||||
.. "div32_frames=%d; "
|
||||
.. "want status %08X, fast %08X%08X, slow %08X%08X, "
|
||||
.. "wide %08X%08X, slow_frames >= 20 and "
|
||||
.. ">= 8*max(fast_frames,1), wide_frames >= 2 and "
|
||||
.. "slow_frames >= 4*max(wide_frames,1))",
|
||||
.. "wide %08X%08X, div32 %08X%08X, "
|
||||
.. "slow_frames >= 20 and >= 8*max(fast_frames,1), "
|
||||
.. "wide_frames >= 2 and "
|
||||
.. "slow_frames >= 4*max(wide_frames,1), "
|
||||
.. "div32_frames >= 2 and "
|
||||
.. "4*wide_frames >= 5*max(div32_frames,1))",
|
||||
status, cs_ok and "ok" or "BAD",
|
||||
fast_frames, slow_frames, wide_frames, STATUS_OK,
|
||||
fast_frames, slow_frames, wide_frames, div32_frames,
|
||||
STATUS_OK,
|
||||
FAST_HI, FAST_LO, SLOW_HI, SLOW_LO,
|
||||
WIDE_HI, WIDE_LO))
|
||||
WIDE_HI, WIDE_LO, DIV32_HI, DIV32_LO))
|
||||
end
|
||||
elseif frames == ENDF - 1 and not reported then
|
||||
reported = true
|
||||
local seen = string.format(
|
||||
"start=%s fast_done=%s slow_done=%s wide_done=%s",
|
||||
"start=%s fast_done=%s slow_done=%s wide_done=%s "
|
||||
.. "div32_done=%s",
|
||||
tostring(start_f), tostring(fast_f), tostring(slow_f),
|
||||
tostring(wide_f))
|
||||
tostring(wide_f), tostring(div32_f))
|
||||
print(string.format(
|
||||
"M7: i64div perf: incomplete at frame %d at marker 0x%08X",
|
||||
frames, BASE))
|
||||
|
||||
+106
-17
@@ -1,6 +1,6 @@
|
||||
/* M7.4/M8.3 i64 divide/remainder fast-path performance driver.
|
||||
/* M7.4/M8.3/M9.3 i64 divide/remainder fast-path performance driver.
|
||||
*
|
||||
* Three equal-iteration workloads exercise the paths of
|
||||
* Four equal-iteration workloads exercise the paths of
|
||||
* TMS34010LowerI64::lowerDivRem:
|
||||
*
|
||||
* fast phase: both operands fit 32 bits after the signed magnitude
|
||||
@@ -10,8 +10,13 @@
|
||||
* slow phase: both operands have nonzero high words, so the 64-step loop
|
||||
* runs for each of the four i64 div/rem forms;
|
||||
* wide phase: the dividend has a nonzero high word but the divisor fits
|
||||
* 32 bits, so the M8.3 64/32 path emits two even-destination
|
||||
* DIVUs (q1/r1 then q0/r0) instead of the 64-step loop.
|
||||
* 32 bits and the quotient needs 33+ bits (hi(N) >= D), so
|
||||
* the M8.3 64/32 path emits two even-destination DIVUs (q1/r1
|
||||
* then q0/r0) instead of the 64-step loop;
|
||||
* div32 phase: the dividend has a nonzero high word but the quotient fits
|
||||
* 32 bits (hi(N) < D), so the M9.3 path emits one
|
||||
* even-destination DIVU plus the low-word N - q*D remainder
|
||||
* reconstruction.
|
||||
*
|
||||
* The loop bodies are driven by a volatile iteration count and volatile
|
||||
* seeds, and every result feeds a volatile accumulator that is published in
|
||||
@@ -31,6 +36,9 @@
|
||||
* 8 wide phase done 0x81DE0D0E
|
||||
* 9 wide checksum low (printed evidence)
|
||||
* 10 wide checksum high
|
||||
* 11 div32 phase done 0x6432D0E5
|
||||
* 12 div32 checksum low (printed evidence)
|
||||
* 13 div32 checksum high
|
||||
*
|
||||
* The self-check runs known i64 divisions first (fast and slow, unsigned and
|
||||
* signed, including full-width low words and the INT32_MIN magnitude), so the
|
||||
@@ -39,7 +47,8 @@
|
||||
* the markers once per MAME frame, turns the frame numbers into the gate's
|
||||
* cycle proxy, and requires the exact phase checksums. With the 16384
|
||||
* iterations above the deterministic LCG workloads produce
|
||||
* fast = 0x000000011E6F9AB4, slow = 0x00000000007512AE
|
||||
* fast = 0x000000011E6F9AB4, slow = 0x00000000007512AE,
|
||||
* wide = 0xF56810CFEDA9D656, div32 = 0x00002C61C63842EE
|
||||
* (checked against an independent host implementation of this file; the
|
||||
* target compiler must produce the same integer results).
|
||||
*/
|
||||
@@ -55,12 +64,13 @@ typedef long long s64;
|
||||
#define PERF_FAST_DONE 0xFA57D01Eu
|
||||
#define PERF_SLOW_DONE 0x5104D0E5u
|
||||
#define PERF_WIDE_DONE 0x81DE0D0Eu
|
||||
#define PERF_DIV32_DONE 0x6432D0E5u
|
||||
#define PERF_STATUS_OK 0x600D600Du
|
||||
#define PERF_STATUS_BAD 0xBAD0BAD0u
|
||||
|
||||
/* 16384 iterations put the fast phase at a few frames and the slow phase at a
|
||||
* few hundred frames on the emulated 50 MHz part, with a wide margin under
|
||||
* the 4000-frame loader budget. The count is volatile so the optimizer keeps
|
||||
* the gate-local loader budget (5000 frames by default). The count is volatile so the optimizer keeps
|
||||
* a real loop and does not unroll it into a folded constant. */
|
||||
static volatile u32 perf_iters = 16384u;
|
||||
|
||||
@@ -85,12 +95,16 @@ static volatile u64 sc_seven = 7ull;
|
||||
static volatile s64 sc_neg123 = -123ll;
|
||||
static volatile s64 sc_int32min = -2147483648ll;
|
||||
static volatile s64 sc_three = 3ll;
|
||||
static volatile s64 sc_three_neg = -3ll;
|
||||
|
||||
/* M8.3 64/32-path cases: nonzero dividend high word, 32-bit divisor. The
|
||||
* first, second and INT64_MIN cases exercise the two-step form where the
|
||||
* quotient needs 33+ bits (hi >= d); the third has hi < d, so q1 is zero and
|
||||
* the second even-destination divide produces the whole quotient. The helper
|
||||
* still executes both divides in every case. */
|
||||
/* M8.3/M9.3 64/32-path cases: nonzero dividend high word, 32-bit divisor.
|
||||
* The first, second and unsigned INT64_MIN-magnitude cases exercise the
|
||||
* two-step form where the quotient needs 33+ bits (hi >= d), so q1 is nonzero
|
||||
* and both even-destination divides run. The third has hi < d and takes the
|
||||
* M9.3 single-DIVU path. INT64_MIN never fits 32 bits (magnitude high word
|
||||
* 0x80000000): divisors <= 2^31 keep it on the two-step helper, while a
|
||||
* divisor in (2^31, 2^32), e.g. 0xFFFFFFFF, has hi(|N|) < d and takes the
|
||||
* single-DIVU path; the self-check below covers both. */
|
||||
static volatile u64 sc_wide1 = 0xFEDCBA9876543210ull;
|
||||
static volatile u64 sc_wide_d1 = 0x12345678ull;
|
||||
static volatile u64 sc_wide2 = 0xFFFFFFFFFFFFFFFFull;
|
||||
@@ -99,6 +113,16 @@ static volatile u64 sc_wide3 = 0x00000001FFFFFFFFull;
|
||||
static volatile u64 sc_wide4 = 0x8000000000000000ull;
|
||||
static volatile s64 sc_int64min = -9223372036854775807ll - 1ll;
|
||||
|
||||
/* M9.3 single-DIVU 64/32 cases: a nonzero dividend high word with hi < d so
|
||||
* the whole quotient fits 32 bits. 0x1_00000000 / 3 is the canonical
|
||||
* q = 0x55555555, r = 1 case; the negative form exercises the shared signed
|
||||
* fixup on the new path. */
|
||||
static volatile u64 sc_div32_n = 0x0000000100000000ull;
|
||||
static volatile u64 sc_div32_d = 3ull;
|
||||
static volatile u64 sc_div32_n2 = 0x00000001FFFFFFFFull;
|
||||
static volatile u64 sc_div32_d2 = 0x0000000000010000ull;
|
||||
static volatile s64 sc_div32_neg = -4294967296ll;
|
||||
|
||||
static u32 lcg(u32 x)
|
||||
{
|
||||
return x * 1103515245u + 12345u;
|
||||
@@ -159,11 +183,24 @@ static u32 selfcheck(void)
|
||||
r = sc_wide2 % sc_wide_d2;
|
||||
ok &= (q == 0x0000000100000001ull) && (r == 0ull);
|
||||
|
||||
/* M8.3 64/32 path with hi < d: the quotient fits in one divide. */
|
||||
/* M8.3 64/32 path with hi < d: it now takes the M9.3 single divide. */
|
||||
q = sc_wide3 / sc_wide_d2;
|
||||
r = sc_wide3 % sc_wide_d2;
|
||||
ok &= (q == 2ull) && (r == 1ull);
|
||||
|
||||
/* M9.3 single-DIVU 64/32 path: hi < d (0x1 < 3 and 0x1 < 0x10000). */
|
||||
q = sc_div32_n / sc_div32_d;
|
||||
r = sc_div32_n % sc_div32_d;
|
||||
ok &= (q == 0x55555555ull) && (r == 1ull);
|
||||
|
||||
q = sc_div32_n2 / sc_div32_d2;
|
||||
r = sc_div32_n2 % sc_div32_d2;
|
||||
ok &= (q == 0x1FFFFull) && (r == 0xFFFFull);
|
||||
|
||||
sq = sc_div32_neg / sc_three;
|
||||
sr = sc_div32_neg % sc_three;
|
||||
ok &= (sq == -1431655765ll) && (sr == -1ll);
|
||||
|
||||
/* M8.3 unsigned INT64_MIN magnitude and signed INT64_MIN / 3. */
|
||||
q = sc_wide4 / sc_three;
|
||||
r = sc_wide4 % sc_three;
|
||||
@@ -173,6 +210,25 @@ static u32 selfcheck(void)
|
||||
sr = sc_int64min % sc_three;
|
||||
ok &= (sq == -3074457345618258602ll) && (sr == -2ll);
|
||||
|
||||
/* INT64_MIN magnitude with a divisor above 2^31: hi(|N|) = 0x80000000
|
||||
* < 0xFFFFFFFF, so it takes the M9.3 single-DIVU path (unsigned and
|
||||
* signed). q = r = 2^31 in magnitude; the signed remainder keeps the
|
||||
* dividend's sign. */
|
||||
q = sc_wide4 / sc_max32;
|
||||
r = sc_wide4 % sc_max32;
|
||||
ok &= (q == 0x80000000ull) && (r == 0x80000000ull);
|
||||
|
||||
sq = sc_int64min / (s64)sc_max32;
|
||||
sr = sc_int64min % (s64)sc_max32;
|
||||
ok &= (sq == -2147483648ll) && (sr == -2147483648ll);
|
||||
|
||||
/* M9.3 single-DIVU 64/32 path with a negative 32-bit-magnitude divisor:
|
||||
* 2^32 / -3 = -1431655765 r 1 (the quotient sign is the sign XOR, the
|
||||
* remainder follows the dividend). */
|
||||
sq = (s64)sc_div32_n / (s64)sc_three_neg;
|
||||
sr = (s64)sc_div32_n % (s64)sc_three_neg;
|
||||
ok &= (sq == -1431655765ll) && (sr == 1ll);
|
||||
|
||||
return ok ? PERF_STATUS_OK : PERF_STATUS_BAD;
|
||||
}
|
||||
|
||||
@@ -228,10 +284,14 @@ static void run_slow(void)
|
||||
MARK(6) = PERF_SLOW_DONE;
|
||||
}
|
||||
|
||||
/* Nonzero dividend high word, 32-bit divisor: all four forms take the M8.3
|
||||
* two-step 64/32 path (two even-destination DIVUs) instead of the 64-step
|
||||
* loop. The high word is capped at 16 bits and the divisor at 16 bits so the
|
||||
* values stay in the tested range while still covering hi >= d and hi < d. */
|
||||
/* Nonzero dividend high word, 32-bit divisor, hi(N) >= D: all four forms take
|
||||
* the M8.3 two-step 64/32 path (two even-destination DIVUs) instead of the
|
||||
* 64-step loop. The high word mask 0x80000000|(lcg & 0x7FFEFFFF) keeps
|
||||
* hi(N) in [0x80000000, 0xFFFEFFFF] and the divisor at most 0x10000, so the
|
||||
* unsigned high word is at least 0x10000. For the signed forms the
|
||||
* magnitude's high word is 0xFFFFFFFF - hi(N), i.e. in [0x10000, 0x7FFFFFFF],
|
||||
* so the negated magnitude is also >= 2^32 and every signed division takes
|
||||
* the same two-step helper. */
|
||||
static void run_wide(void)
|
||||
{
|
||||
u64 acc = 0;
|
||||
@@ -241,7 +301,8 @@ static void run_wide(void)
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
a = ((u64)(1u + (lcg((u32)(a >> 32)) & 0xFFFFu)) << 32)
|
||||
a = ((u64)(0x80000000u
|
||||
| (lcg((u32)(a >> 32)) & 0x7FFEFFFFu)) << 32)
|
||||
| (u64)(lcg((u32)a) | 1u);
|
||||
b = (u64)(1u + (lcg((u32)b) & 0x0000FFFFu));
|
||||
acc += a / b;
|
||||
@@ -255,6 +316,33 @@ static void run_wide(void)
|
||||
MARK(8) = PERF_WIDE_DONE;
|
||||
}
|
||||
|
||||
/* Nonzero dividend high word, 32-bit divisor, hi(N) < D: all four forms take
|
||||
* the M9.3 single-even-destination-DIVU path. The dividend high word is at
|
||||
* most 0x10000 and the divisor is at least 0x10001, so the quotient always
|
||||
* fits 32 bits and the single divide produces it. */
|
||||
static void run_div32(void)
|
||||
{
|
||||
u64 acc = 0;
|
||||
u64 a = seed_a;
|
||||
u64 b = seed_b;
|
||||
u32 n = perf_iters;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
a = ((u64)(1u + (lcg((u32)(a >> 32)) & 0xFFFFu)) << 32)
|
||||
| (u64)(lcg((u32)a) | 1u);
|
||||
b = (u64)(0x10001u + (lcg((u32)b) & 0x0000FFFFu));
|
||||
acc += a / b;
|
||||
acc ^= a % b;
|
||||
acc += (u64)((s64)a / (s64)b);
|
||||
acc ^= (u64)((s64)a % (s64)b);
|
||||
}
|
||||
|
||||
MARK(12) = (u32)acc;
|
||||
MARK(13) = (u32)(acc >> 32);
|
||||
MARK(11) = PERF_DIV32_DONE;
|
||||
}
|
||||
|
||||
void i64div_perf_run(void)
|
||||
{
|
||||
MARK(7) = selfcheck();
|
||||
@@ -262,4 +350,5 @@ void i64div_perf_run(void)
|
||||
run_fast();
|
||||
run_slow();
|
||||
run_wide();
|
||||
run_div32();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* M9.2 range-list fixture A: -O2 -g loop/inlining shape that makes LLVM emit
|
||||
* a non-contiguous DW_TAG_inlined_subroutine and therefore .debug_rnglists.
|
||||
* Compiled by scripts/tests/m9/dwarf-ranges.sh; not a runtime test. */
|
||||
static inline __attribute__((always_inline)) int m9_inc(int x) {
|
||||
if (x & 1)
|
||||
return x + 1;
|
||||
return x + 3;
|
||||
}
|
||||
|
||||
int m9_range_one(int a) {
|
||||
int sum = 0;
|
||||
int i;
|
||||
for (i = 0; i < a; i++)
|
||||
sum += m9_inc(i);
|
||||
return sum;
|
||||
}
|
||||
|
||||
static int m9_helper(int q) {
|
||||
return q * 5;
|
||||
}
|
||||
|
||||
int m9_range_two(int a) {
|
||||
return m9_helper(a) + m9_range_one(a);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/* M9.2 range-list fixture B: a second TU with the same loop/inlining shape so
|
||||
* the multi-TU merge has two .debug_rnglists contributions to rehome. */
|
||||
static inline __attribute__((always_inline)) int m9_dec(int x) {
|
||||
if (x & 2)
|
||||
return x - 1;
|
||||
return x - 3;
|
||||
}
|
||||
|
||||
int m9_range_three(int a) {
|
||||
int sum = 1;
|
||||
for (int i = 0; i < a; i++)
|
||||
sum += m9_dec(i);
|
||||
return sum;
|
||||
}
|
||||
|
||||
int m9_range_four(int a) {
|
||||
return m9_range_three(a) * 3;
|
||||
}
|
||||
Executable
+276
@@ -0,0 +1,276 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Write two TI-COFF objects that actually emit DWARF v5 `.debug_rnglists`.
|
||||
|
||||
The M8 fixtures (-O0 and a straight-line -O2 shape) never emitted a range list,
|
||||
so the merge's `.debug_rnglists` whitelist was untested. This helper emits the
|
||||
section directly: a well-formed CU per object with
|
||||
|
||||
* ``DW_AT_rnglists_base`` (``DW_FORM_sec_offset`` into .debug_rnglists),
|
||||
* ``DW_AT_addr_base`` (``DW_FORM_sec_offset`` into .debug_addr),
|
||||
* ``DW_AT_ranges`` (``DW_FORM_rnglistx`` index 0),
|
||||
* a range list with one ``DW_RLE_start_end`` (absolute, relocated .text
|
||||
addresses) and one ``DW_RLE_startx_length`` (index into .debug_addr),
|
||||
* a subprogram DIE with a relocated ``DW_FORM_addr`` low PC.
|
||||
|
||||
Every section-relative field carries an R-RELLONG relocation, so the objects
|
||||
also pass the form-aware input gate. ``scripts/tests/m9/dwarf-ranges.sh``
|
||||
links them, wraps the result in the M7 ELF container and validates the ranges
|
||||
with ``llvm-dwarfdump``. The same gate also has a real `-O2 -g` producer case
|
||||
(loop/inline shapes can make LLVM emit non-contiguous inlined ranges); this
|
||||
synthetic fixture keeps the `start_end`/`startx_length` and offset-rehoming
|
||||
forms deterministic.
|
||||
|
||||
Usage: dwarf-ranges-fixture.py OUTDIR [--tag AB]
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
|
||||
MAGIC = 0x0090
|
||||
R_RELLONG = 0x11
|
||||
S_TEXT = 0x20
|
||||
S_DATA = 0x40
|
||||
S_BSS = 0x80
|
||||
C_EXT = 2
|
||||
C_STAT = 3
|
||||
|
||||
TEXT_ORIGIN = 0x018A0000
|
||||
TEXT_BYTES = 16
|
||||
|
||||
|
||||
def uleb(value):
|
||||
out = bytearray()
|
||||
while True:
|
||||
byte = value & 0x7F
|
||||
value >>= 7
|
||||
if value:
|
||||
out.append(byte | 0x80)
|
||||
else:
|
||||
out.append(byte)
|
||||
return bytes(out)
|
||||
|
||||
|
||||
class Section:
|
||||
def __init__(self, name, flags, data=b"", bits=None):
|
||||
self.name = name
|
||||
self.flags = flags
|
||||
self.data = bytearray(data)
|
||||
self.bits = len(self.data) * 8 if bits is None else bits
|
||||
self.relocs = [] # (byte offset, symbol name)
|
||||
|
||||
def reloc(self, offset, symbol):
|
||||
self.relocs.append((offset, symbol))
|
||||
return offset
|
||||
|
||||
|
||||
def debug_abbrev():
|
||||
return (
|
||||
b"\x01\x11\x01" # 1: DW_TAG_compile_unit, children
|
||||
b"\x03\x0e" # DW_AT_name, DW_FORM_strp
|
||||
b"\x73\x17" # DW_AT_addr_base, DW_FORM_sec_offset
|
||||
b"\x74\x17" # DW_AT_rnglists_base, sec_offset
|
||||
b"\x55\x23" # DW_AT_ranges, DW_FORM_rnglistx
|
||||
b"\x00\x00"
|
||||
b"\x02\x2e\x00" # 2: DW_TAG_subprogram, no children
|
||||
b"\x03\x0e" # DW_AT_name, DW_FORM_strp
|
||||
b"\x11\x01" # DW_AT_low_pc, DW_FORM_addr
|
||||
b"\x12\x06" # DW_AT_high_pc, DW_FORM_data4
|
||||
b"\x00\x00"
|
||||
b"\x00")
|
||||
|
||||
|
||||
def build(tag):
|
||||
"""One object whose single function sits at .text offset 0."""
|
||||
cu_name = ("rng-%s.c" % tag).encode("ascii")
|
||||
fn_name = ("rng_" + tag).encode("ascii")
|
||||
strings = cu_name + b"\0" + fn_name + b"\0"
|
||||
cu_off = 0
|
||||
fn_off = len(cu_name) + 1
|
||||
|
||||
sections = [
|
||||
Section(".text", S_TEXT, b"\0" * TEXT_BYTES),
|
||||
Section(".data", S_DATA),
|
||||
Section(".bss", S_BSS, bits=0),
|
||||
]
|
||||
abbrev = Section(".debug_abbrev", 0, debug_abbrev())
|
||||
sections.append(abbrev)
|
||||
|
||||
# .debug_info: v5 CU header + root DIE (code 1) + subprogram (2).
|
||||
info_section = Section(".debug_info", 0, b"\0\0\0\0")
|
||||
info = info_section.data
|
||||
info += struct.pack("<HBB", 5, 1, 4) # version, DW_UT_compile, addrsize
|
||||
info += b"\0\0\0\0" # abbrev offset (relocated)
|
||||
info_section.reloc(8, ".debug_abbrev")
|
||||
|
||||
info += b"\x01" # root DIE
|
||||
info += struct.pack("<I", cu_off) # DW_AT_name -> .debug_str
|
||||
info_section.reloc(len(info) - 4, ".debug_str")
|
||||
info += struct.pack("<I", 8) # DW_AT_addr_base -> .debug_addr
|
||||
info_section.reloc(len(info) - 4, ".debug_addr")
|
||||
info += struct.pack("<I", 12) # DW_AT_rnglists_base -> header end
|
||||
info_section.reloc(len(info) - 4, ".debug_rnglists")
|
||||
info += uleb(0) # DW_AT_ranges, rnglistx index 0
|
||||
info += b"\x02" # subprogram DIE
|
||||
info += struct.pack("<I", fn_off) # DW_AT_name
|
||||
info_section.reloc(len(info) - 4, ".debug_str")
|
||||
info += struct.pack("<I", 0) # DW_AT_low_pc, linked .text
|
||||
info_section.reloc(len(info) - 4, ".text")
|
||||
info += struct.pack("<I", 4) # DW_AT_high_pc (byte size)
|
||||
info += b"\x00" # end of the root's children
|
||||
struct.pack_into("<I", info, 0, len(info) - 4)
|
||||
sections.append(info_section)
|
||||
|
||||
sections.append(Section(".debug_str", 0, strings))
|
||||
|
||||
# .debug_addr: unit header + two 4-byte addresses (text+8, text+12).
|
||||
addr_section = Section(".debug_addr", 0, b"\0\0\0\0")
|
||||
addr = addr_section.data
|
||||
addr += struct.pack("<HBB", 5, 4, 0)
|
||||
for value in (8, 12):
|
||||
addr += struct.pack("<I", value)
|
||||
addr_section.reloc(len(addr) - 4, ".text")
|
||||
struct.pack_into("<I", addr, 0, len(addr) - 4)
|
||||
sections.append(addr_section)
|
||||
|
||||
# .debug_rnglists: header (12 bytes) + one offset entry (base = 12).
|
||||
rng_section = Section(".debug_rnglists", 0, b"\0\0\0\0")
|
||||
rng = rng_section.data
|
||||
rng += struct.pack("<HBB", 5, 4, 0)
|
||||
rng += struct.pack("<I", 1) # offset_entry_count
|
||||
rng += struct.pack("<I", 4) # offset[0]: list at base + 4
|
||||
assert len(rng) == 16, len(rng)
|
||||
rng += b"\x06" # DW_RLE_start_end
|
||||
rng += struct.pack("<I", 0) # start = text + 0
|
||||
rng_section.reloc(len(rng) - 4, ".text")
|
||||
rng += struct.pack("<I", 4) # end = text + 4
|
||||
rng_section.reloc(len(rng) - 4, ".text")
|
||||
rng += b"\x03" + uleb(0) + uleb(4) # DW_RLE_startx_length: addr[0] .. +4
|
||||
rng += b"\x00" # DW_RLE_end_of_list
|
||||
struct.pack_into("<I", rng, 0, len(rng) - 4)
|
||||
sections.append(rng_section)
|
||||
|
||||
# Section sizes were captured at construction; the unit builders above
|
||||
# append to the byte arrays afterwards.
|
||||
for sec in sections:
|
||||
if sec.name != ".bss":
|
||||
sec.bits = len(sec.data) * 8
|
||||
|
||||
return sections
|
||||
|
||||
|
||||
def short_name(name):
|
||||
return len(name.encode("latin1")) <= 8
|
||||
|
||||
|
||||
def write_object(path, sections, tag):
|
||||
"""Serialise one relocatable TI-COFF object.
|
||||
|
||||
Relocation targets are section symbols (matching the LLVM producer), plus
|
||||
an external ``_rng_<tag>`` in .text so the linked image names the function.
|
||||
"""
|
||||
section_symbols = {}
|
||||
symbols = [] # (name, value, secno, class, naux, aux)
|
||||
record = 0
|
||||
for index, sec in enumerate(sections, start=1):
|
||||
section_symbols[sec.name] = record
|
||||
aux = struct.pack("<III", sec.bits, 0, 0).ljust(18, b"\0")
|
||||
symbols.append((sec.name, 0, index, C_STAT, 1, aux))
|
||||
record += 2 # main record + one aux record
|
||||
symbols.append(("_rng_" + tag, 0, 1, C_EXT, 0, b""))
|
||||
record += 1
|
||||
|
||||
string_table = bytearray(b"\0\0\0\0")
|
||||
sec_name_offsets = {}
|
||||
for sec in sections:
|
||||
if not short_name(sec.name):
|
||||
sec_name_offsets[sec.name] = len(string_table)
|
||||
string_table.extend(sec.name.encode("latin1") + b"\0")
|
||||
sym_name_offsets = {}
|
||||
for name, _value, _secno, _class, _naux, _aux in symbols:
|
||||
if not short_name(name):
|
||||
sym_name_offsets[name] = len(string_table)
|
||||
string_table.extend(name.encode("latin1") + b"\0")
|
||||
struct.pack_into("<I", string_table, 0, len(string_table))
|
||||
|
||||
nsyms = sum(1 + naux for _n, _v, _s, _c, naux, _a in symbols)
|
||||
if nsyms != record:
|
||||
raise SystemExit("internal: symbol record count mismatch")
|
||||
header_size = 20 + 40 * len(sections)
|
||||
cursor = header_size
|
||||
payload = []
|
||||
for sec in sections:
|
||||
if sec.bits and sec.name != ".bss":
|
||||
payload.append(cursor)
|
||||
cursor += len(sec.data)
|
||||
else:
|
||||
payload.append(0)
|
||||
relptr = []
|
||||
for sec in sections:
|
||||
if sec.relocs:
|
||||
relptr.append(cursor)
|
||||
cursor += 10 * len(sec.relocs)
|
||||
else:
|
||||
relptr.append(0)
|
||||
symptr = cursor
|
||||
cursor += nsyms * 18 + len(string_table)
|
||||
|
||||
out = bytearray()
|
||||
out.extend(struct.pack("<HHIIIHH", MAGIC, len(sections), 0, symptr,
|
||||
nsyms, 0, 0))
|
||||
for sec, ptr, rptr in zip(sections, payload, relptr):
|
||||
if short_name(sec.name):
|
||||
raw_name = sec.name.encode("latin1").ljust(8, b"\0")
|
||||
else:
|
||||
raw_name = ("/%d" % sec_name_offsets[sec.name]).encode("ascii")
|
||||
out.extend(raw_name.ljust(8, b"\0"))
|
||||
out.extend(struct.pack("<IIIIIIHHI", 0, 0, sec.bits, ptr, rptr, 0,
|
||||
len(sec.relocs), 0, sec.flags))
|
||||
for sec, ptr in zip(sections, payload):
|
||||
if ptr:
|
||||
out.extend(sec.data)
|
||||
for sec, rptr in zip(sections, relptr):
|
||||
if not rptr:
|
||||
continue
|
||||
for offset, name in sec.relocs:
|
||||
out.extend(struct.pack("<IIH", offset * 8,
|
||||
section_symbols[name], R_RELLONG))
|
||||
for name, value, secno, sclass, naux, aux in symbols:
|
||||
if short_name(name):
|
||||
raw_name = name.encode("latin1").ljust(8, b"\0")
|
||||
else:
|
||||
raw_name = b"\0\0\0\0" + struct.pack("<I", sym_name_offsets[name])
|
||||
out.extend(raw_name)
|
||||
out.extend(struct.pack("<IhHBB", value, secno, 0, sclass, naux))
|
||||
out.extend(aux)
|
||||
out.extend(string_table)
|
||||
|
||||
if len(out) != cursor:
|
||||
raise SystemExit("internal: %s size %d != planned %d"
|
||||
% (path, len(out), cursor))
|
||||
with open(path, "wb") as fh:
|
||||
fh.write(out)
|
||||
return len(out)
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
parser.add_argument("outdir", metavar="OUTDIR")
|
||||
parser.add_argument("--tag", default="ab",
|
||||
help="the two single-letter tags")
|
||||
args = parser.parse_args(argv)
|
||||
if len(args.tag) != 2:
|
||||
parser.error("--tag must be two characters (one per object)")
|
||||
os.makedirs(args.outdir, exist_ok=True)
|
||||
for tag in args.tag:
|
||||
path = os.path.join(args.outdir, "rng-%s.o" % tag)
|
||||
size = write_object(path, build(tag), tag)
|
||||
print("dwarf-ranges-fixture: %s (%d bytes, .text %d bits)"
|
||||
% (path, size, TEXT_BYTES * 8))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -15,9 +15,11 @@
|
||||
# 2004-05-09-LiveVarPartialRegister, gc-lowering and shadow-stack-gc-lowering
|
||||
# when the recursive .data initializer extension made them compile. M8.3
|
||||
# removed 2008-02-04-Ctlz and llvm-ct-intrinsics when the ctlz/ctpop/cttz
|
||||
# lowering landed.
|
||||
# lowering landed. M9.1's inline-asm `r` support lets two x86-asm Generic
|
||||
# tests reach the target asm parser, so their reason is the new "inline asm
|
||||
# text is not TMS34010 assembly" (still unsupported, never counted as a pass).
|
||||
2007-04-08-MultipleFrameIndices inline asm register constraint cannot be allocated
|
||||
2007-04-27-InlineAsm-X-Dest inline asm register constraint cannot be allocated
|
||||
2007-04-27-InlineAsm-X-Dest inline asm text is not TMS34010 assembly
|
||||
2007-04-27-LargeMemObject inline asm memory constraint is not supported
|
||||
2007-12-17-InvokeAsm inline asm memory constraint is not supported
|
||||
2008-02-20-MatchingMem inline asm memory constraint is not supported
|
||||
@@ -45,7 +47,7 @@ fpowi-promote target rejection: M2 supports only void/integer(<=64)/pointer retu
|
||||
half target rejection: M2 supports only void/integer(<=64)/pointer returns
|
||||
half-op missing libcall lowering (floats/vectors are deferred to M6)
|
||||
icmp-illegal target rejection: TMS34010 supports only integer (<=64 bit) and pointer arguments
|
||||
inline-asm-mem-clobber inline asm register constraint cannot be allocated
|
||||
inline-asm-mem-clobber inline asm text is not TMS34010 assembly
|
||||
inline-asm-special-strings inline asm syntax is not supported by the TMS34010 parser
|
||||
intrinsics target rejection: M2 supports only void/integer(<=64)/pointer returns
|
||||
nested-select target rejection: TMS34010 supports only integer (<=64 bit) and pointer arguments
|
||||
|
||||
@@ -98,6 +98,8 @@ failure_reason() {
|
||||
printf 'inline asm register constraint cannot be allocated\n'
|
||||
elif grep -Fq 'error: unexpected token' "$err"; then
|
||||
printf 'inline asm syntax is not supported by the TMS34010 parser\n'
|
||||
elif grep -Fq 'error: invalid instruction mnemonic' "$err"; then
|
||||
printf 'inline asm text is not TMS34010 assembly\n'
|
||||
elif grep -Fq 'fast-math-flags specified for call' "$err"; then
|
||||
printf 'IR verifier rejects the input (fast-math flags on an integer call)\n'
|
||||
fi
|
||||
|
||||
+172
-5
@@ -114,11 +114,99 @@ WIDE_LL=${WIDE_LL:-$ROOT/build/llvm-clean/llvm/test/CodeGen/TMS34010/m7-data-ini
|
||||
-o "$WORK/wide.o" > "$WORK/wide.log" 2>&1 \
|
||||
|| { cat "$WORK/wide.log" >&2; fail "object-mode wide-integer compile failed"; }
|
||||
|
||||
echo "== M9 vector initializers in the raw and object paths"
|
||||
# Integer and floating vector constants are emitted as their exact
|
||||
# little-endian element bytes (the f32 elements are target GSP words, not
|
||||
# IEEE). The asm arm is pinned here as text and the object arm below as
|
||||
# bytes; llvm/test/CodeGen/TMS34010/m9-vector-data.ll covers the same module.
|
||||
VECTOR_LL=${VECTOR_LL:-$ROOT/build/llvm-clean/llvm/test/CodeGen/TMS34010/m9-vector-data.ll}
|
||||
[ -f "$VECTOR_LL" ] || fail "missing vector fixture $VECTOR_LL"
|
||||
"$TMS_LLC" -march=tms34010 -O0 -filetype=asm "$VECTOR_LL" \
|
||||
-o "$WORK/vector.s" > "$WORK/vector.log" 2>&1 \
|
||||
|| { cat "$WORK/vector.log" >&2; fail "raw vector compile failed"; }
|
||||
"$TMS_LLC" -march=tms34010 -O0 -filetype=obj "$VECTOR_LL" \
|
||||
-o "$WORK/vector.o" > "$WORK/vector-obj.log" 2>&1 \
|
||||
|| { cat "$WORK/vector-obj.log" >&2; fail "object vector compile failed"; }
|
||||
"$TMS_LLC" -march=tms34010 -O2 -filetype=obj "$VECTOR_LL" \
|
||||
-o "$WORK/vector-o2.o" > "$WORK/vector-obj-o2.log" 2>&1 \
|
||||
|| { cat "$WORK/vector-obj-o2.log" >&2; \
|
||||
fail "object vector -O2 compile failed"; }
|
||||
|
||||
# A padded zero vector (<3 x i32>: 12 store / 16 alloc) is supported because
|
||||
# the emitter writes store bytes and the callers/trailer add the allocation
|
||||
# padding. Its record member offset and .data size are byte-checked below.
|
||||
PADDED_LL=${PADDED_LL:-$ROOT/build/llvm-clean/llvm/test/CodeGen/TMS34010/m9-vector-data-padded-zero.ll}
|
||||
[ -f "$PADDED_LL" ] || fail "missing padded-zero vector fixture $PADDED_LL"
|
||||
"$TMS_LLC" -march=tms34010 -O0 -filetype=obj "$PADDED_LL" \
|
||||
-o "$WORK/vector-padded-zero.o" > "$WORK/vector-padded-zero.log" 2>&1 \
|
||||
|| { cat "$WORK/vector-padded-zero.log" >&2; \
|
||||
fail "object padded-zero vector compile failed"; }
|
||||
|
||||
python3 - "$WORK/vector.s" <<'PY' \
|
||||
|| fail "raw vector .data directives do not match"
|
||||
import sys
|
||||
|
||||
lines = [line.strip() for line in open(sys.argv[1])]
|
||||
|
||||
|
||||
def block(label):
|
||||
try:
|
||||
start = lines.index(label + ":")
|
||||
except ValueError:
|
||||
sys.exit(f"raw vector asm: missing {label}:")
|
||||
out = []
|
||||
for line in lines[start + 1:]:
|
||||
if not line:
|
||||
continue
|
||||
if (line.endswith(":") or line.startswith(".globl") or
|
||||
line == ".even" or line.startswith(".data") or
|
||||
line.startswith(".text")):
|
||||
break
|
||||
out.append(line)
|
||||
return out
|
||||
|
||||
|
||||
want = {
|
||||
# <2 x i32>: two little-endian .long values.
|
||||
"_v2i32": [".long 287454020", ".long 3735928559"],
|
||||
# <4 x i16>: four 16-bit elements, in order.
|
||||
"_v4i16": [".word 01234h", ".word 0FFFFh", ".word 05566h", ".word 0ABCDh"],
|
||||
# <2 x float>: GSP 1.0 = 40400000h, GSP 2.5 = 40D00000h.
|
||||
"_v2f32": [".long 40400000h", ".long 40D00000h"],
|
||||
# Vector aggregate zero: exactly the 8-byte allocation.
|
||||
"_vzero": [".byte 0, 0, 0, 0, 0, 0, 0, 0"],
|
||||
# Array of vector: element order, then a zero vector element.
|
||||
"_vaggarr": [".word 00001h", ".word 00002h", ".byte 0, 0, 0, 0"],
|
||||
# Record member vector at its DataLayout offset (3 pad bytes first).
|
||||
"_vrec": [".byte 011h", ".byte 0, 0, 0", ".word 01234h",
|
||||
".word 0ABCDh", ".long 195948557"],
|
||||
# <8 x i8>: one .byte per element in order.
|
||||
"_v8i8": [".byte 001h", ".byte 002h", ".byte 003h", ".byte 004h",
|
||||
".byte 005h", ".byte 006h", ".byte 007h", ".byte 008h"],
|
||||
# <2 x i64>: LSW-first words per element.
|
||||
"_v2i64": [".long 55667788h", ".long 11223344h",
|
||||
".long 0DDEEFF00h", ".long 99AABBCCh"],
|
||||
# <2 x f64>: GSP doubles, LSW-first (1.5 / 2.5).
|
||||
"_v2f64": [".long 00000000h", ".long 400C0000h",
|
||||
".long 00000000h", ".long 401A0000h"],
|
||||
}
|
||||
for label, want_lines in want.items():
|
||||
got = block(label)
|
||||
if got != want_lines:
|
||||
sys.exit(f"raw vector asm: {label} {got}, want {want_lines}")
|
||||
|
||||
print("m7-data-raw-vector: <2 x i32>/<4 x i16>/<2 x float>/<8 x i8>/"
|
||||
"<2 x i64>/<2 x f64>/zero/nested bytes exact")
|
||||
PY
|
||||
|
||||
echo "== parse the native objects' .data before linking"
|
||||
python3 - "$WORK/native/asm/m7data.o" \
|
||||
"$WORK/native/asm/i64arr.o" \
|
||||
"$WORK/native/asm/oddptr.o" \
|
||||
"$WORK/wide.o" <<'PY' \
|
||||
"$WORK/wide.o" \
|
||||
"$WORK/vector.o" \
|
||||
"$WORK/vector-o2.o" \
|
||||
"$WORK/vector-padded-zero.o" <<'PY' \
|
||||
|| fail "native .data bytes/symbols/relocations do not match"
|
||||
import struct
|
||||
import sys
|
||||
@@ -181,7 +269,8 @@ def at(symbols, name, raw, hexbytes, field_off=0, path=""):
|
||||
sys.exit(f"{path}: {name} bytes {got.hex()}, want {hexbytes}")
|
||||
|
||||
|
||||
base_path, i64_path, odd_path, wide_path = sys.argv[1:5]
|
||||
base_path, i64_path, odd_path, wide_path, vector_path, vector_o2_path, \
|
||||
padded_path = sys.argv[1:8]
|
||||
|
||||
# The original .data set: exactly 72 bytes and the three literal relocation
|
||||
# addresses for _pp, _cp and _pt.p.
|
||||
@@ -245,12 +334,90 @@ wide_want = {
|
||||
for name, hexbytes in wide_want.items():
|
||||
at(symbols, name, raw, hexbytes, path=wide_path)
|
||||
|
||||
# M9 vector initializers in TI-COFF: every element is its exact little-endian
|
||||
# bytes, the f32/f64 elements are GSP words, and the vector zero is the full
|
||||
# allocation. Symbol values are section-relative bit addresses. Both the
|
||||
# alloc==store fixture and the padded-zero fixture are gated, including the
|
||||
# total .data size and the inter-symbol offsets (so extra bytes emitted
|
||||
# between symbols cannot hide).
|
||||
def check_vector(path):
|
||||
raw, size, symbols, relocs = parse(path)
|
||||
if size != 96 * 8:
|
||||
sys.exit(f"{path}: .data size {size} bits, want 96 bytes (768)")
|
||||
if relocs:
|
||||
sys.exit(f"{path}: unexpected relocations "
|
||||
f"{[hex(r) for r in relocs]}")
|
||||
offsets = {
|
||||
"_v2i32": 0, "_v4i16": 8, "_v2f32": 16, "_vzero": 24,
|
||||
"_vaggarr": 32, "_vrec": 40, "_v8i8": 56, "_v2i64": 64,
|
||||
"_v2f64": 80,
|
||||
}
|
||||
for name, off in offsets.items():
|
||||
if name not in symbols:
|
||||
sys.exit(f"{path}: missing symbol {name}")
|
||||
if symbols[name] // 8 != off:
|
||||
sys.exit(f"{path}: {name} at byte {symbols[name] // 8}, "
|
||||
f"want {off}")
|
||||
vector_want = {
|
||||
"_v2i32": "44332211efbeadde",
|
||||
"_v4i16": "3412ffff6655cdab",
|
||||
"_v2f32": "000040400000d040",
|
||||
"_vzero": "0000000000000000",
|
||||
"_vaggarr": "0100020000000000",
|
||||
"_vrec": "110000003412cdab0df0ad0b",
|
||||
"_v8i8": "0102030405060708",
|
||||
"_v2i64": "887766554433221100ffeeddccbbaa99",
|
||||
"_v2f64": "0000000000000c400000000000001a40",
|
||||
}
|
||||
for name, hexbytes in vector_want.items():
|
||||
at(symbols, name, raw, hexbytes, path=path)
|
||||
return raw
|
||||
|
||||
|
||||
vector_o0 = check_vector(vector_path)
|
||||
vector_o2 = check_vector(vector_o2_path)
|
||||
if vector_o0 != vector_o2:
|
||||
sys.exit("vector object bytes differ between -O0 and -O2")
|
||||
|
||||
# Padded aggregate-zero vectors: <3 x i32> is 12 store / 16 alloc and the
|
||||
# record is 20 store / 32 alloc. Offsets prove the following member lands at
|
||||
# its DataLayout offset (record i32 at byte 16) and the total proves the
|
||||
# emitter does not over-write or double-pad.
|
||||
raw, size, symbols, relocs = parse(padded_path)
|
||||
if size != 116 * 8:
|
||||
sys.exit(f"{padded_path}: .data size {size} bits, want 116 bytes (928)")
|
||||
if relocs:
|
||||
sys.exit(f"{padded_path}: unexpected relocations "
|
||||
f"{[hex(r) for r in relocs]}")
|
||||
padded_offsets = {
|
||||
"_z3i32": 0, "_z3i32_next": 16, "_z3rec": 32,
|
||||
"_z3rec_next": 64, "_z3arr": 80, "_z3arr_next": 112,
|
||||
}
|
||||
for name, off in padded_offsets.items():
|
||||
if name not in symbols:
|
||||
sys.exit(f"{padded_path}: missing symbol {name}")
|
||||
if symbols[name] // 8 != off:
|
||||
sys.exit(f"{padded_path}: {name} at byte {symbols[name] // 8}, "
|
||||
f"want {off}")
|
||||
padded_want = {
|
||||
"_z3i32": "00" * 16,
|
||||
"_z3rec": "00" * 16 + "07000000" + "00" * 12,
|
||||
"_z3arr": "00" * 32,
|
||||
}
|
||||
for name, hexbytes in padded_want.items():
|
||||
at(symbols, name, raw, hexbytes, path=padded_path)
|
||||
|
||||
print("m7-data-object: own .data=72 bytes relocs=0x1b0/0x1d0/0x210; "
|
||||
"i64arr .data=16 bytes; oddptr .data=6 bytes reloc=0x8; "
|
||||
"wide i24/i40/i48/i56 + [2 x i24] bytes exact")
|
||||
"wide i24/i40/i48/i56 + [2 x i24] bytes exact; "
|
||||
"vector .data=96 bytes at -O0 and -O2, symbol offsets and "
|
||||
"<2 x i32>/<4 x i16>/<2 x f32>/<8 x i8>/<2 x i64>/<2 x f64>/zero/"
|
||||
"nested bytes exact; padded zero .data=116 bytes with record member at "
|
||||
"byte 16")
|
||||
PY
|
||||
|
||||
echo "m7 data: PASS (i64 LSW-first in asm and object mode, i64 array, i24/i40/"
|
||||
echo " i48/i56 and [2 x i24] bytes in asm and object mode, packed "
|
||||
echo " records, bitfields, union, pointer relocations, and the "
|
||||
echo " native-only odd-offset pointer in TI-COFF/MAME)"
|
||||
echo " records, bitfields, union, pointer relocations, the "
|
||||
echo " native-only odd-offset pointer in TI-COFF/MAME, and M9 "
|
||||
echo " integer/fp vector .data bytes in asm and object mode)"
|
||||
@@ -1,20 +1,21 @@
|
||||
# M8.4 full-suite report
|
||||
# generated: 2026-11-16T17:41:34Z
|
||||
# work: build/m8-bare-full
|
||||
# M9.4 full-suite report
|
||||
# generated: 2026-11-17T05:18:25Z
|
||||
# work: build/m9-bare-full
|
||||
# settings: -O0, bare conformance (2ine+tms-link) with a full-loader list; LOADER_AT=200, LOADER_END=1000 (default), per-test MAME timeout=120s, outer wall=210s
|
||||
# full-loader list: /home/arti/code/tms-c-compiler/scripts/tests/m7/full-suite.full-loader
|
||||
# loader-end overrides: /home/arti/code/tms-c-compiler/scripts/tests/m7/full-suite.loader-end (4 rows)
|
||||
# c-torture: /home/arti/code/tms-c-compiler/vendor/conformance/gcc-16.2.0/gcc/testsuite/gcc.c-torture/execute (1692 files)
|
||||
# c-testsuite: /home/arti/code/tms-c-compiler/vendor/conformance/c-testsuite/tests/single-exec (220 files)
|
||||
# compiler: rev=774df1e6941f583822e09291c8becf73bada4005 bin=13cfe98909313a71 loader=200/1000
|
||||
# compiler: rev=bec449573fe3c42eb213d5316f2078e89b6009b0 bin=54359ac53db46558 loader=200/1000
|
||||
# provenance: fresh end-to-end --redo run with the final M9 compiler; no retained rows. 294 skips = 64 classifier + 230 curated, every one with a reason.
|
||||
# dialect: explicit dg -std= wins; otherwise -std=gnu89 only for full-suite.gnu89 names; c-testsuite default
|
||||
# results: build/m8-bare-full/full-suite-results.tsv
|
||||
# results: build/m9-bare-full/full-suite-results.tsv
|
||||
# accounting: every row has 5 fields, a legal result and a pinned name; no duplicate ids
|
||||
#
|
||||
# corpus total pass skip fail crash corpus_files remaining
|
||||
c-torture 1692 1386 306 0 0 1692 0
|
||||
c-torture 1692 1408 284 0 0 1692 0
|
||||
c-testsuite 220 210 10 0 0 220 0
|
||||
all 1912 1596 316 0 0 1912 0
|
||||
all 1912 1618 294 0 0 1912 0
|
||||
|
||||
# fail categories (per selected corpus)
|
||||
# c-torture
|
||||
@@ -36,11 +37,10 @@ compiler-crash 6
|
||||
corpus 5
|
||||
data-init 14
|
||||
data-odd-pointer 1
|
||||
data-vector 5
|
||||
extension 1
|
||||
file-io 18
|
||||
float-constant 1
|
||||
inline-asm 33
|
||||
inline-asm 13
|
||||
int128 15
|
||||
libc 1
|
||||
memory 15
|
||||
@@ -52,11 +52,11 @@ runtime-abort-bitfield 9
|
||||
runtime-abort-float 5
|
||||
runtime-abort-i64 10
|
||||
runtime-abort-varargs 6
|
||||
runtime-abort-vector 3
|
||||
runtime-abort-vector 5
|
||||
runtime-bitfield 2
|
||||
setjmp 6
|
||||
signal 4
|
||||
timeout 20
|
||||
timeout 21
|
||||
vector 2
|
||||
vla 9
|
||||
wide-char 16
|
||||
@@ -80,7 +80,6 @@ c-testsuite 00204 skip:format-unsupported: printf %n, positional $, %e/%g/%a/%F,
|
||||
c-testsuite 00208 skip:wide-char: wide characters are unsupported 0
|
||||
c-testsuite 00220 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture 20000822-1 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture 20001009-2 skip:inline-asm: could not allocate input reg for constraint 'r' at line 105 0
|
||||
c-torture 20001111-1 skip:builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration] 0
|
||||
c-torture 20001124-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture 20010122-1 skip:compiler-crash: unexpected TMS34010 custom lowering operation (return address) 0
|
||||
@@ -92,7 +91,6 @@ c-torture 20010904-1 skip:runtime-abort-alignment: test abort (status 0x86) 0
|
||||
c-torture 20010904-2 skip:runtime-abort-alignment: test abort (status 0x86) 0
|
||||
c-torture 20010924-1 skip:data-odd-pointer: pointer field at an odd .data byte offset 0
|
||||
c-torture 20011008-3 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture 20020107-1 skip:inline-asm: could not allocate output register for constraint 'r' at line 336 0
|
||||
c-torture 20020108-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture 20020314-1 skip:compile: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion] 0
|
||||
c-torture 20020411-1 skip:abi-sret: aggregate return via an sret pointer is unsupported 0
|
||||
@@ -102,7 +100,7 @@ c-torture 20021010-2 skip:data-init: unsupported .data initializer 0
|
||||
c-torture 20021127-1 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
c-torture 20030120-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture 20030209-1 skip:memory: linked image exceeds the 45 KiB program / 64 KiB RAM region 0
|
||||
c-torture 20030222-1 skip:inline-asm: could not allocate output register for constraint 'r' at line 495 0
|
||||
c-torture 20030222-1 skip:inline-asm: a 64-bit "0" input tied to a 32-bit 'r' output has no allocatable register pair 0
|
||||
c-torture 20030323-1 skip:compiler-crash: unexpected TMS34010 custom lowering operation 0
|
||||
c-torture 20030501-1 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture 20030811-1 skip:compiler-crash: unexpected TMS34010 custom lowering operation 0
|
||||
@@ -170,13 +168,11 @@ c-torture 931004-4 skip:runtime-abort-bitfield: test abort (status 0x86) 0
|
||||
c-torture 931004-6 skip:runtime-abort-bitfield: test abort (status 0x86) 0
|
||||
c-torture 931004-8 skip:runtime-abort-bitfield: test abort (status 0x86) 0
|
||||
c-torture 941202-1 skip:timeout: did not finish within LOADER_END=1000 0
|
||||
c-torture 960312-1 skip:inline-asm: could not allocate input reg for constraint 'r' at line 218 0
|
||||
c-torture 960512-1 skip:abi-sret: aggregate return via an sret pointer is unsupported 0
|
||||
c-torture 960521-1 skip:timeout: did not finish within LOADER_END=1000 0
|
||||
c-torture 970214-1 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture 970214-2 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture 980709-1 skip:timeout: did not finish within LOADER_END=1000 0
|
||||
c-torture 990130-1 skip:inline-asm: could not allocate output register for constraint 'r' at line 152 0
|
||||
c-torture 990208-1 skip:codegen: t5: i32 = BlockAddress<@doit, %here> 0 0
|
||||
c-torture 990413-2 skip:inline-asm: invalid output constraint '=t' 0
|
||||
c-torture 991112-1 skip:runtime-abort: test abort (status 0x86) 0
|
||||
@@ -200,11 +196,11 @@ c-torture conversion skip:codegen-float: only 32-bit integer sources are support
|
||||
c-torture eeprof-1 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture floatunsisf-1 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
c-torture fprintf-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture fprintf-2 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture fprintf-2 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 1
|
||||
c-torture fprintf-chk-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture frame-address skip:compiler-crash: unexpected TMS34010 custom lowering operation (frame address) 0
|
||||
c-torture gofast skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture loop-2f skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 1
|
||||
c-torture loop-2f skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture loop-2g skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture memchr-1 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture memclr skip:memory: linked image exceeds the 45 KiB program / 64 KiB RAM region 0
|
||||
@@ -223,26 +219,23 @@ c-torture nestfunc-6 skip:nested-function: nested function definitions are unsup
|
||||
c-torture nestfunc-7 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr103052 skip:builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr103255 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
c-torture pr103376 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr103376 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr103405 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr105613 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr105777 skip:corpus: references a gcc.dg source absent from the pinned execute tree 0
|
||||
c-torture pr105984 skip:builtin: use of unknown builtin '__builtin_mul_overflow_p' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr107881-1 skip:memory: linked image exceeds the 45 KiB program / 64 KiB RAM region 0
|
||||
c-torture pr108292 skip:vector: address of vector element requested 0
|
||||
c-torture pr108498-1 skip:inline-asm: could not allocate input reg for constraint 'r' at line 1233 0
|
||||
c-torture pr109040 skip:abi-float-args: float/double arguments are unsupported 0
|
||||
c-torture pr109938 skip:corpus: references a gcc.dg source absent from the pinned execute tree 0
|
||||
c-torture pr109986 skip:corpus: references a gcc.dg source absent from the pinned execute tree 0
|
||||
c-torture pr110252-2 skip:inline-asm: could not allocate output register for constraint 'r' at line 155 0
|
||||
c-torture pr111469-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture pr111469-1 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 1
|
||||
c-torture pr114396 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture pr115033 skip:builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr117095 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr117432 skip:compile: ISO C requires a named parameter before '...' 0
|
||||
c-torture pr122943 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr123625 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr123625-2 skip:data-vector: vector constants in .data are unsupported 0
|
||||
c-torture pr123753 skip:vector: cannot decrement a vector value 0
|
||||
c-torture pr123864 skip:builtin: use of unknown builtin '__builtin_mul_overflow_p' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr125291 skip:abi-indirect-call: indirect call through a non-function value 0
|
||||
@@ -254,7 +247,7 @@ c-torture pr20621-1 skip:timeout: compilation did not finish within the 210s out
|
||||
c-torture pr22061-1 skip:compile: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion] 0
|
||||
c-torture pr22061-3 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr22061-4 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr23135 skip:data-vector: vector constants in .data are unsupported 0
|
||||
c-torture pr23135 skip:timeout: vector test does not finish within LOADER_END=1000 (LOADER_END=20000 also timed out) 0
|
||||
c-torture pr23324 skip:data-init: unsupported .data initializer 0
|
||||
c-torture pr24135 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr28865 skip:vla: variable-length array in a struct is unsupported 0
|
||||
@@ -267,31 +260,24 @@ c-torture pr35456 skip:runtime-abort-float: test abort (status 0x86) 0
|
||||
c-torture pr35800 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture pr38051 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
c-torture pr38151 skip:runtime-abort-varargs: test abort (status 0x86) 0
|
||||
c-torture pr38533 skip:inline-asm: could not allocate output register for constraint 'r' at line 2147513642 0
|
||||
c-torture pr38969 skip:abi-sret: aggregate return via an sret pointer is unsupported 0
|
||||
c-torture pr39228 skip:builtin: use of unknown builtin '__builtin_isinff' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr40022 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr40657 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr40022 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr40657 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr41239 skip:setjmp: setjmp/longjmp need non-local jumps, which are unsupported 0
|
||||
c-torture pr41935 skip:vla: variable-length array in a struct is unsupported 0
|
||||
c-torture pr43385 skip:inline-asm: could not allocate output register for constraint 'r' at line 328 0
|
||||
c-torture pr43560 skip:inline-asm: could not allocate output register for constraint 'r' at line 298 0
|
||||
c-torture pr43987 skip:file-io: stdio/POSIX file I/O is unavailable under the bare loader 0
|
||||
c-torture pr44575 skip:runtime-abort-varargs: test abort (status 0x86) 0
|
||||
c-torture pr44683 skip:runtime-abort-float: test abort (status 0x86) 0
|
||||
c-torture pr45695 skip:inline-asm: could not allocate output register for constraint 'r' at line 121 0
|
||||
c-torture pr47237 skip:builtin: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr49218 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr49279 skip:inline-asm: could not allocate output register for constraint 'r' at line 199 0
|
||||
c-torture pr49390 skip:inline-asm: could not allocate output register for constraint 'r' at line 1508 0
|
||||
c-torture pr51447 skip:nested-function: nested function definitions are unsupported 0
|
||||
c-torture pr51581-1 skip:memory: linked image exceeds the 45 KiB program / 64 KiB RAM region 0
|
||||
c-torture pr51581-2 skip:memory: linked image exceeds the 45 KiB program / 64 KiB RAM region 0
|
||||
c-torture pr52286 skip:inline-asm: could not allocate output register for constraint 'r' at line 119 0
|
||||
c-torture pr53645 skip:data-init: unsupported .data initializer 0
|
||||
c-torture pr53645-2 skip:data-init: unsupported .data initializer 0
|
||||
c-torture pr54471 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr56866 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr56866 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr56982 skip:setjmp: setjmp/longjmp need non-local jumps, which are unsupported 0
|
||||
c-torture pr57344-3 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
c-torture pr57344-4 skip:runtime-abort-i64: test abort (status 0x86) 0
|
||||
@@ -304,15 +290,12 @@ c-torture pr61375 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr63302 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr63843 skip:timeout: codegen fixed at the M7.4 pin; already compiled at the M8 base and hangs identically (status 1, no completion magic) 0
|
||||
c-torture pr64242 skip:setjmp: __builtin_longjmp is unsupported 0
|
||||
c-torture pr65053-1 skip:inline-asm: could not allocate output register for constraint 'r' at line 281 0
|
||||
c-torture pr65053-2 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr65053-2 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr65170 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr65401 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr65427 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr65648 skip:inline-asm: could not allocate input reg for constraint 'r' at line 225 0
|
||||
c-torture pr65956 skip:inline-asm: could not allocate output register for constraint 'r' at line 285 0
|
||||
c-torture pr67037 skip:timeout: did not finish within LOADER_END=1000 0
|
||||
c-torture pr68328 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr68328 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr68390 skip:abi-varargs-return: float/double/i64/aggregate return from a variadic definition is unsupported 0
|
||||
c-torture pr68532 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture pr70460 skip:data-init: unsupported .data initializer 0
|
||||
@@ -325,27 +308,23 @@ c-torture pr78622 skip:file-io: stdio/POSIX file I/O is unavailable under the ba
|
||||
c-torture pr78791 skip:data-init: unsupported .data initializer 0
|
||||
c-torture pr79327 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr79737-2 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr80421 skip:inline-asm: could not allocate input reg for constraint 'r' at line 113 0
|
||||
c-torture pr80692 skip:extension: GNU decimal float type is unsupported 0
|
||||
c-torture pr81588 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr81588 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr82210 skip:vla: variable-length array in a struct is unsupported 0
|
||||
c-torture pr82954 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr82954 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr84169 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr84521 skip:setjmp: __builtin_longjmp is unsupported 0
|
||||
c-torture pr84524 skip:inline-asm: could not allocate output register for constraint 'r' at line 468 0
|
||||
c-torture pr84748 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr85156 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr85156 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr85169 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr85331 skip:builtin: use of unknown builtin '__builtin_shuffle' [-Wimplicit-function-declaration] 0
|
||||
c-torture pr85582-2 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr85582-3 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr85756 skip:inline-asm: could not allocate input reg for constraint 'r' at line 204 0
|
||||
c-torture pr88693 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture pr88904 skip:inline-asm: could not allocate output register for constraint 'r' at line 174 0
|
||||
c-torture pr92618 skip:abi-return: unsupported aggregate/variadic return shape 0
|
||||
c-torture pr92904 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr93213 skip:int128: 128-bit integers are unsupported 0
|
||||
c-torture pr94130 skip:inline-asm: Could not match memory address. Inline asm failure! 0
|
||||
c-torture pr94130 skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture pr94412 skip:runtime-abort: test abort (status 0x86) 0
|
||||
c-torture pr94524-1 skip:abi-return: unsupported aggregate/variadic return shape 0
|
||||
c-torture pr94524-2 skip:abi-return: unsupported aggregate/variadic return shape 0
|
||||
@@ -358,13 +337,12 @@ c-torture ptr-arith-1 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture scal-to-vec1 skip:runtime-abort-vector: test abort (status 0x86) 0
|
||||
c-torture scal-to-vec2 skip:runtime-abort-vector: test abort (status 0x86) 0
|
||||
c-torture scal-to-vec3 skip:runtime-abort-vector: test abort (status 0x86) 0
|
||||
c-torture simd-1 skip:data-vector: vector constants in .data are unsupported 0
|
||||
c-torture simd-2 skip:data-vector: vector constants in .data are unsupported 0
|
||||
c-torture simd-1 skip:runtime-abort-vector: test abort (status 0x86) 0
|
||||
c-torture simd-2 skip:runtime-abort-vector: test abort (status 0x86) 0
|
||||
c-torture simd-4 skip:abi-float-args: float/double arguments are unsupported 0
|
||||
c-torture simd-5 skip:data-vector: vector constants in .data are unsupported 0
|
||||
c-torture simd-6 skip:abi-return: unsupported aggregate/variadic return shape 0
|
||||
c-torture stdarg-3 skip:runtime-abort-varargs: test abort (status 0x86) 0
|
||||
c-torture stkalign skip:inline-asm: could not allocate output register for constraint 'r' at line 344 0
|
||||
c-torture stkalign skip:inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher) 0
|
||||
c-torture strct-stdarg-1 skip:runtime-abort-varargs: test abort (status 0x86) 0
|
||||
c-torture strct-varg-1 skip:runtime-abort-varargs: test abort (status 0x86) 0
|
||||
c-torture string-opt-18 skip:timeout: did not finish within LOADER_END=1000 0
|
||||
@@ -387,4 +365,4 @@ c-torture widechar-3 skip:wide-char: wide characters are unsupported 0
|
||||
c-torture zerolen-2 skip:runtime-abort: test abort (status 0x86) 0
|
||||
|
||||
# resume
|
||||
scripts/tests/m7/full-suite.sh --corpus all --work build/m8-bare-full
|
||||
scripts/tests/m7/full-suite.sh --corpus all --work build/m9-bare-full
|
||||
@@ -795,7 +795,7 @@ summary_row() {
|
||||
}
|
||||
|
||||
{
|
||||
echo "# M8.4 full-suite report"
|
||||
echo "# M9.4 full-suite report"
|
||||
echo "# generated: $(date -u '+%Y-%m-%dT%H:%M:%SZ')"
|
||||
echo "# work: $WORK"
|
||||
echo "# settings: -O0, bare conformance (2ine+tms-link) with a full-loader list; LOADER_AT=$LOADER_AT, LOADER_END=$LOADER_END (default), per-test MAME timeout=${TIME_LIMIT}s, outer wall=$((TIME_LIMIT + 90))s"
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
# M7.4/M8.4 full-suite curated skips.
|
||||
# M7.4/M9.4 full-suite curated skips.
|
||||
#
|
||||
# Rows are <corpus>/<test><TAB><reason>. A row here is recorded as
|
||||
# skip:<reason> without running the test, so it is never counted as a pass.
|
||||
# The corpus/name must exist in the pinned tree; a stale row is a driver error.
|
||||
# Classifier skips are reported by classify.sh and are not duplicated here;
|
||||
# every row below was classifier-supported and re-run after the task that
|
||||
# added it. M8.4 re-ran the whole corpus end-to-end with the final compiler
|
||||
# (`--redo`, build/m8-full-suite); the retained M7.4/M8.3 evidence is history.
|
||||
# added it. M8.4/M9.4 re-ran the whole corpus end-to-end with the final
|
||||
# compiler (`--redo`, build/m8-full-suite and build/m9-bare-full); the retained
|
||||
# M7.4/M8.3 evidence is history.
|
||||
# M8.3 removed the rotates/cttz/bswap codegen class and the four frame-limited
|
||||
# rows in full-suite.loader-end (per-test LOADER_END=2000); pr63843 now
|
||||
# compiles and hits a pre-existing runtime hang. Reasons are tab-free; the
|
||||
# retained per-test log is under build/m8-task3-full-suite-final and the
|
||||
# timeout sweep under build/m8-task3-timeouts.
|
||||
# M9.1 removed the 22 inline-asm `r` and vector `.data` rows that now pass
|
||||
# (20 `r` constraint rows plus simd-5 and pr123625-2). The five remaining
|
||||
# rows from that class now carry an accurate reason: 20030222-1 ties a 64-bit
|
||||
# input to a 32-bit `r` output, pr23135 compiles but does not finish, simd-1/
|
||||
# simd-2 compile but abort during vector arithmetic, and stkalign still needs
|
||||
# an unsupported memory operand.
|
||||
#
|
||||
# Categories: compiler-crash, codegen, inline-asm, nested-function, vla,
|
||||
# data-init, data-vector, data-odd-pointer, abi-*, builtin, libm, memory,
|
||||
@@ -20,7 +27,6 @@
|
||||
c-testsuite/00040 timeout: did not finish within LOADER_END=1000
|
||||
c-testsuite/00174 libm: sin/float formatting differs from the expected libm output
|
||||
c-torture/20000822-1 nested-function: nested function definitions are unsupported
|
||||
c-torture/20001009-2 inline-asm: could not allocate input reg for constraint 'r' at line 105
|
||||
c-torture/20001111-1 builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration]
|
||||
c-torture/20010122-1 compiler-crash: unexpected TMS34010 custom lowering operation (return address)
|
||||
c-torture/20010209-1 nested-function: nested function definitions are unsupported
|
||||
@@ -29,7 +35,6 @@ c-torture/20010605-2 libc: call to undeclared function 'exit'; ISO C99 and later
|
||||
c-torture/20010904-1 runtime-abort-alignment: test abort (status 0x86)
|
||||
c-torture/20010904-2 runtime-abort-alignment: test abort (status 0x86)
|
||||
c-torture/20010924-1 data-odd-pointer: pointer field at an odd .data byte offset
|
||||
c-torture/20020107-1 inline-asm: could not allocate output register for constraint 'r' at line 336
|
||||
c-torture/20020314-1 compile: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
|
||||
c-torture/20020411-1 abi-sret: aggregate return via an sret pointer is unsupported
|
||||
c-torture/20020412-1 vla: variable-length array in a struct is unsupported
|
||||
@@ -37,7 +42,7 @@ c-torture/20020418-1 abi-indirect-call: indirect call through a non-function val
|
||||
c-torture/20021010-2 data-init: unsupported .data initializer
|
||||
c-torture/20021127-1 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/20030209-1 memory: linked image exceeds the 45 KiB program / 64 KiB RAM region
|
||||
c-torture/20030222-1 inline-asm: could not allocate output register for constraint 'r' at line 495
|
||||
c-torture/20030222-1 inline-asm: a 64-bit "0" input tied to a 32-bit 'r' output has no allocatable register pair
|
||||
c-torture/20030323-1 compiler-crash: unexpected TMS34010 custom lowering operation
|
||||
c-torture/20030501-1 nested-function: nested function definitions are unsupported
|
||||
c-torture/20030811-1 compiler-crash: unexpected TMS34010 custom lowering operation
|
||||
@@ -99,11 +104,9 @@ c-torture/931004-4 runtime-abort-bitfield: test abort (status 0x86)
|
||||
c-torture/931004-6 runtime-abort-bitfield: test abort (status 0x86)
|
||||
c-torture/931004-8 runtime-abort-bitfield: test abort (status 0x86)
|
||||
c-torture/941202-1 timeout: did not finish within LOADER_END=1000
|
||||
c-torture/960312-1 inline-asm: could not allocate input reg for constraint 'r' at line 218
|
||||
c-torture/960512-1 abi-sret: aggregate return via an sret pointer is unsupported
|
||||
c-torture/960521-1 timeout: did not finish within LOADER_END=1000
|
||||
c-torture/980709-1 timeout: did not finish within LOADER_END=1000
|
||||
c-torture/990130-1 inline-asm: could not allocate output register for constraint 'r' at line 152
|
||||
c-torture/990208-1 codegen: t5: i32 = BlockAddress<@doit, %here> 0
|
||||
c-torture/990413-2 inline-asm: invalid output constraint '=t'
|
||||
c-torture/991112-1 runtime-abort: test abort (status 0x86)
|
||||
@@ -142,21 +145,18 @@ c-torture/nestfunc-6 nested-function: nested function definitions are unsupporte
|
||||
c-torture/nestfunc-7 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr103052 builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration]
|
||||
c-torture/pr103255 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/pr103376 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr103376 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr103405 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr105777 corpus: references a gcc.dg source absent from the pinned execute tree
|
||||
c-torture/pr105984 builtin: use of unknown builtin '__builtin_mul_overflow_p' [-Wimplicit-function-declaration]
|
||||
c-torture/pr107881-1 memory: linked image exceeds the 45 KiB program / 64 KiB RAM region
|
||||
c-torture/pr108292 vector: address of vector element requested
|
||||
c-torture/pr108498-1 inline-asm: could not allocate input reg for constraint 'r' at line 1233
|
||||
c-torture/pr109040 abi-float-args: float/double arguments are unsupported
|
||||
c-torture/pr109938 corpus: references a gcc.dg source absent from the pinned execute tree
|
||||
c-torture/pr109986 corpus: references a gcc.dg source absent from the pinned execute tree
|
||||
c-torture/pr110252-2 inline-asm: could not allocate output register for constraint 'r' at line 155
|
||||
c-torture/pr115033 builtin: use of unknown builtin '__builtin_exit' [-Wimplicit-function-declaration]
|
||||
c-torture/pr117432 compile: ISO C requires a named parameter before '...'
|
||||
c-torture/pr123625 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr123625-2 data-vector: vector constants in .data are unsupported
|
||||
c-torture/pr123753 vector: cannot decrement a vector value
|
||||
c-torture/pr123864 builtin: use of unknown builtin '__builtin_mul_overflow_p' [-Wimplicit-function-declaration]
|
||||
c-torture/pr125291 abi-indirect-call: indirect call through a non-function value
|
||||
@@ -167,7 +167,7 @@ c-torture/pr20621-1 timeout: compilation did not finish within the 210s outer wa
|
||||
c-torture/pr22061-1 compile: incompatible integer to pointer conversion assigning to 'void *' from 'int' [-Wint-conversion]
|
||||
c-torture/pr22061-3 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr22061-4 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr23135 data-vector: vector constants in .data are unsupported
|
||||
c-torture/pr23135 timeout: vector test does not finish within LOADER_END=1000 (LOADER_END=20000 also timed out)
|
||||
c-torture/pr23324 data-init: unsupported .data initializer
|
||||
c-torture/pr24135 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr28865 vla: variable-length array in a struct is unsupported
|
||||
@@ -179,27 +179,20 @@ c-torture/pr34971 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/pr35456 runtime-abort-float: test abort (status 0x86)
|
||||
c-torture/pr38051 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/pr38151 runtime-abort-varargs: test abort (status 0x86)
|
||||
c-torture/pr38533 inline-asm: could not allocate output register for constraint 'r' at line 2147513642
|
||||
c-torture/pr38969 abi-sret: aggregate return via an sret pointer is unsupported
|
||||
c-torture/pr39228 builtin: use of unknown builtin '__builtin_isinff' [-Wimplicit-function-declaration]
|
||||
c-torture/pr40022 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr40657 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr40022 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr40657 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr41935 vla: variable-length array in a struct is unsupported
|
||||
c-torture/pr43385 inline-asm: could not allocate output register for constraint 'r' at line 328
|
||||
c-torture/pr43560 inline-asm: could not allocate output register for constraint 'r' at line 298
|
||||
c-torture/pr44575 runtime-abort-varargs: test abort (status 0x86)
|
||||
c-torture/pr44683 runtime-abort-float: test abort (status 0x86)
|
||||
c-torture/pr45695 inline-asm: could not allocate output register for constraint 'r' at line 121
|
||||
c-torture/pr47237 builtin: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration]
|
||||
c-torture/pr49279 inline-asm: could not allocate output register for constraint 'r' at line 199
|
||||
c-torture/pr49390 inline-asm: could not allocate output register for constraint 'r' at line 1508
|
||||
c-torture/pr51447 nested-function: nested function definitions are unsupported
|
||||
c-torture/pr51581-1 memory: linked image exceeds the 45 KiB program / 64 KiB RAM region
|
||||
c-torture/pr51581-2 memory: linked image exceeds the 45 KiB program / 64 KiB RAM region
|
||||
c-torture/pr52286 inline-asm: could not allocate output register for constraint 'r' at line 119
|
||||
c-torture/pr53645 data-init: unsupported .data initializer
|
||||
c-torture/pr53645-2 data-init: unsupported .data initializer
|
||||
c-torture/pr56866 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr56866 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr57344-3 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/pr57344-4 runtime-abort-i64: test abort (status 0x86)
|
||||
c-torture/pr58209 runtime-abort: test abort (status 0x86)
|
||||
@@ -209,14 +202,11 @@ c-torture/pr60822 memory: linked image exceeds the 45 KiB program / 64 KiB RAM r
|
||||
c-torture/pr60960 abi-return: unsupported aggregate/variadic return shape
|
||||
c-torture/pr63843 timeout: codegen fixed at the M7.4 pin; already compiled at the M8 base and hangs identically (status 1, no completion magic)
|
||||
c-torture/pr64242 setjmp: __builtin_longjmp is unsupported
|
||||
c-torture/pr65053-1 inline-asm: could not allocate output register for constraint 'r' at line 281
|
||||
c-torture/pr65053-2 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr65053-2 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr65401 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr65427 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr65648 inline-asm: could not allocate input reg for constraint 'r' at line 225
|
||||
c-torture/pr65956 inline-asm: could not allocate output register for constraint 'r' at line 285
|
||||
c-torture/pr67037 timeout: did not finish within LOADER_END=1000
|
||||
c-torture/pr68328 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr68328 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr68390 abi-varargs-return: float/double/i64/aggregate return from a variadic definition is unsupported
|
||||
c-torture/pr70460 data-init: unsupported .data initializer
|
||||
c-torture/pr70566 timeout: did not finish within LOADER_END=1000
|
||||
@@ -227,20 +217,16 @@ c-torture/pr71626-2 abi-return: unsupported aggregate/variadic return shape
|
||||
c-torture/pr78791 data-init: unsupported .data initializer
|
||||
c-torture/pr79327 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr79737-2 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr80421 inline-asm: could not allocate input reg for constraint 'r' at line 113
|
||||
c-torture/pr80692 extension: GNU decimal float type is unsupported
|
||||
c-torture/pr81588 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr81588 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr82210 vla: variable-length array in a struct is unsupported
|
||||
c-torture/pr82954 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr82954 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr84521 setjmp: __builtin_longjmp is unsupported
|
||||
c-torture/pr84524 inline-asm: could not allocate output register for constraint 'r' at line 468
|
||||
c-torture/pr85156 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr85156 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr85169 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr85331 builtin: use of unknown builtin '__builtin_shuffle' [-Wimplicit-function-declaration]
|
||||
c-torture/pr85756 inline-asm: could not allocate input reg for constraint 'r' at line 204
|
||||
c-torture/pr88904 inline-asm: could not allocate output register for constraint 'r' at line 174
|
||||
c-torture/pr92618 abi-return: unsupported aggregate/variadic return shape
|
||||
c-torture/pr94130 inline-asm: Could not match memory address. Inline asm failure!
|
||||
c-torture/pr94130 inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/pr94412 runtime-abort: test abort (status 0x86)
|
||||
c-torture/pr94524-1 abi-return: unsupported aggregate/variadic return shape
|
||||
c-torture/pr94524-2 abi-return: unsupported aggregate/variadic return shape
|
||||
@@ -250,13 +236,12 @@ c-torture/printf-chk-1 timeout: did not finish within LOADER_END=1000
|
||||
c-torture/scal-to-vec1 runtime-abort-vector: test abort (status 0x86)
|
||||
c-torture/scal-to-vec2 runtime-abort-vector: test abort (status 0x86)
|
||||
c-torture/scal-to-vec3 runtime-abort-vector: test abort (status 0x86)
|
||||
c-torture/simd-1 data-vector: vector constants in .data are unsupported
|
||||
c-torture/simd-2 data-vector: vector constants in .data are unsupported
|
||||
c-torture/simd-1 runtime-abort-vector: test abort (status 0x86)
|
||||
c-torture/simd-2 runtime-abort-vector: test abort (status 0x86)
|
||||
c-torture/simd-4 abi-float-args: float/double arguments are unsupported
|
||||
c-torture/simd-5 data-vector: vector constants in .data are unsupported
|
||||
c-torture/simd-6 abi-return: unsupported aggregate/variadic return shape
|
||||
c-torture/stdarg-3 runtime-abort-varargs: test abort (status 0x86)
|
||||
c-torture/stkalign inline-asm: could not allocate output register for constraint 'r' at line 344
|
||||
c-torture/stkalign inline-asm: TMS34010 memory constraints ('m'/'o'/'V') are unsupported (no addressing-mode matcher)
|
||||
c-torture/strct-stdarg-1 runtime-abort-varargs: test abort (status 0x86)
|
||||
c-torture/strct-varg-1 runtime-abort-varargs: test abort (status 0x86)
|
||||
c-torture/string-opt-18 timeout: did not finish within LOADER_END=1000
|
||||
|
||||
+43
-23
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Compiles scripts/m7/i64div-perf.c with tms-clang/llc, assembles and links
|
||||
# it with GSPA/GSPLNK 2.00 under DOSBox through scripts/m4/run.sh, loads the
|
||||
# COFF with the dwt loader and runs it in MAME. The driver runs two
|
||||
# COFF with the dwt loader and runs it in MAME. The driver runs four
|
||||
# equal-iteration workloads:
|
||||
#
|
||||
# - 16384 iterations with both operands fitting 32 bits after the signed
|
||||
@@ -13,9 +13,12 @@
|
||||
# the target's single 32-bit DIVU;
|
||||
# - 16384 iterations with nonzero high words: each i64 div/rem takes the
|
||||
# 64-step restoring loop;
|
||||
# - 16384 iterations with a nonzero dividend high word and a 32-bit
|
||||
# divisor: each i64 div/rem takes the M8.3 two-step 64/32 path (two
|
||||
# even-destination DIVUs) instead of the loop.
|
||||
# - 16384 iterations with a nonzero dividend high word, a 32-bit divisor
|
||||
# and hi(N) >= D: each i64 div/rem takes the M8.3 two-step 64/32 path
|
||||
# (two even-destination DIVUs) instead of the loop;
|
||||
# - 16384 iterations with a nonzero dividend high word, a 32-bit divisor
|
||||
# and hi(N) < D: each i64 div/rem takes the M9.3 single-DIVU 64/32 path
|
||||
# (one even-destination DIVU plus the low-word N - q*D reconstruction).
|
||||
#
|
||||
# scripts/m7/i64div-perf-check.lua polls the start and per-phase completion
|
||||
# markers once per MAME frame. A frame is a fixed number of emulated 50 MHz
|
||||
@@ -23,29 +26,37 @@
|
||||
# requires the fast phase to complete in materially fewer frames for the same
|
||||
# iteration count (slow_frames >= 8 * max(fast_frames,1), with the slow phase
|
||||
# at least 20 frames so it is measurable) and the wide phase to beat the loop
|
||||
# (slow_frames >= 4 * max(wide_frames,1), wide phase at least 2 frames). All
|
||||
# three phase checksums must equal the deterministic values computed from the
|
||||
# (slow_frames >= 4 * max(wide_frames,1), wide phase at least 2 frames). The
|
||||
# div32 phase must be measurable (>= 2 frames) and materially faster than the
|
||||
# M8.3 two-DIVU wide phase (4 * wide_frames >= 5 * div32_frames, 1.25x). All
|
||||
# four phase checksums must equal the deterministic values computed from the
|
||||
# same LCG (the driver header and the Lua pin them). The driver's self-check
|
||||
# status word proves every path first produced the known values, including
|
||||
# full-width 32-bit magnitudes (0xFFFFFFFF/7, -123/7, INT32_MIN/3) and the
|
||||
# 64/32 shapes (hi >= d, hi == d, hi < d, INT64_MIN).
|
||||
# full-width 32-bit magnitudes (0xFFFFFFFF/7, -123/7, INT32_MIN/3), the 64/32
|
||||
# shapes (hi >= d, hi == d, hi < d, INT64_MIN) and the single-DIVU cases
|
||||
# (0x1_00000000/3, 0x1_FFFFFFFF/0x10000, -2^32/3, 2^32/-3) and the
|
||||
# INT64_MIN-magnitude single-DIVU cases (0x8000000000000000 and INT64_MIN with
|
||||
# divisor 0xFFFFFFFF, q = r = 0x80000000 / -0x80000000).
|
||||
#
|
||||
# The twelve marker cells live at 01A20000h, free RAM above the 4 KiB entry
|
||||
# stack, outside
|
||||
# .text/.data/.bss. The gate-local scripts/m7/i64div-link.cmd widens the prog
|
||||
# The fourteen marker cells (a 16-cell window) live at 01A20000h, free RAM
|
||||
# above the 4 KiB entry stack, outside .text/.data/.bss. The gate-local
|
||||
# scripts/m7/i64div-link.cmd widens the prog
|
||||
# region to 40000h (the M4 default 8000h is 4 KiB and the driver's .text is
|
||||
# larger), and scripts/m7/i64div-map-check.py asserts on both the tms-link and
|
||||
# GSPLNK maps that the marker cells do not overlap any section. The GSPA link
|
||||
# phase runs before MAME as a fail-fast check. The loader budget is widened
|
||||
# from the M6 default (LOADER_AT=200, LOADER_END=4000) to leave room for the
|
||||
# from the M6 default (LOADER_AT=200, LOADER_END=4000) to 5000 to leave room for the
|
||||
# slow phase; the M7 full-suite loader settings keep 200/1000 and are
|
||||
# unaffected.
|
||||
#
|
||||
# The compile-only preflight (tms-clang + llc asm and obj, no DOSBox/MAME)
|
||||
# checks that the driver asm has both the fast blocks (i64div.fast, DIVU) and
|
||||
# the slow loop (i64div.loop), and I64DIV_PERF_LINK_ONLY=1 also checks the
|
||||
# checks that the driver asm has the fast blocks (i64div.fast, DIVU), the
|
||||
# wide blocks (i64div.wide) and the slow loop (i64div.loop), and
|
||||
# I64DIV_PERF_LINK_ONLY=1 also checks the
|
||||
# marker cells against a host tms-link map. I64DIV_PERF_COMPILE_ONLY=1 stops
|
||||
# after the asm checks.
|
||||
# after the asm checks. The preflight also requires the M9.3 i64div.div32
|
||||
# block in the driver asm, so the single-DIVU phase is compiled even when the
|
||||
# MAME timing run is deferred.
|
||||
#
|
||||
# I64DIV_PERF_OPT=-O2 is an optimizer-level baseline, not the i64 fast-path
|
||||
# measurement: at -O2 instcombine narrows some of the fast phase's divisions to
|
||||
@@ -74,10 +85,10 @@ TMS_LINK=${TMS_LINK:-$ROOT/tools/tms-link/tms-link}
|
||||
WORK=${I64DIV_PERF_WORK:-$ROOT/build/m7-i64div-perf}
|
||||
OPT=${I64DIV_PERF_OPT:--O0}
|
||||
LOADER_AT=${LOADER_AT:-200}
|
||||
LOADER_END=${LOADER_END:-4000}
|
||||
LOADER_END=${LOADER_END:-5000}
|
||||
|
||||
# The marker base in i64div-perf.c and i64div-perf-check.lua; the map check
|
||||
# asserts these 12 cells at 0x20 bits apart are outside every linked section.
|
||||
# asserts these 16 cells at 0x20 bits apart are outside every linked section.
|
||||
MARKERS=01A20000
|
||||
PROG_ORIGIN=018A0000
|
||||
PROG_LEN=40000
|
||||
@@ -99,7 +110,7 @@ done
|
||||
rm -rf "$WORK"
|
||||
mkdir -p "$WORK"
|
||||
|
||||
echo "== compile-only preflight ($OPT): both paths in the driver asm"
|
||||
echo "== compile-only preflight ($OPT): all four paths in the driver asm"
|
||||
export TMS_CLANG TMS_OPT TMS_BITADDR
|
||||
"$ROOT/scripts/tms-clang" "$OPT" -o "$WORK/i64div-perf.ll" "$SRC" \
|
||||
|| fail "tms-clang failed for i64div-perf.c"
|
||||
@@ -109,16 +120,18 @@ export TMS_CLANG TMS_OPT TMS_BITADDR
|
||||
fast=$(grep -c '; %i64div.fast' "$WORK/i64div-perf.s" || true)
|
||||
loop=$(grep -c '; %i64div.loop' "$WORK/i64div-perf.s" || true)
|
||||
wide=$(grep -c '; %i64div.wide' "$WORK/i64div-perf.s" || true)
|
||||
div32=$(grep -c '; %i64div.div32' "$WORK/i64div-perf.s" || true)
|
||||
divu=$(grep -c 'DIVU ' "$WORK/i64div-perf.s" || true)
|
||||
[ "$fast" -ge 1 ] || fail "no i64div.fast block in the driver asm"
|
||||
[ "$loop" -ge 1 ] || fail "no i64div.loop block in the driver asm"
|
||||
[ "$wide" -ge 1 ] || fail "no i64div.wide block in the driver asm"
|
||||
[ "$div32" -ge 1 ] || fail "no M9.3 i64div.div32 block in the driver asm"
|
||||
[ "$divu" -ge 1 ] || fail "no 32-bit DIVU in the driver asm"
|
||||
grep -q "0x${MARKERS}" "$SRC" \
|
||||
|| fail "i64div-perf.c does not use the marker base 0x$MARKERS"
|
||||
grep -q "0x${MARKERS}" "$CHECK_LUA" \
|
||||
|| fail "i64div-perf-check.lua does not use the marker base 0x$MARKERS"
|
||||
echo " fast blocks=$fast loop blocks=$loop wide blocks=$wide DIVU=$divu markers=$MARKERS"
|
||||
echo " fast blocks=$fast loop blocks=$loop wide blocks=$wide div32 blocks=$div32 DIVU=$divu markers=$MARKERS"
|
||||
echo " i64div-perf.s: $(grep -c . "$WORK/i64div-perf.s") lines"
|
||||
|
||||
if [ "${I64DIV_PERF_COMPILE_ONLY:-0}" = 1 ]; then
|
||||
@@ -150,28 +163,35 @@ fi
|
||||
run_m4() {
|
||||
skip=$1
|
||||
shift
|
||||
# GSPA/GSPLNK 8.3 object names: use a short copy of the driver source.
|
||||
[ -f "$WORK/prf.c" ] || cp "$SRC" "$WORK/prf.c"
|
||||
M4_WORK="$WORK" \
|
||||
M4_SDK="$WORK/sdk" \
|
||||
M4_COFF="$WORK/i64div-perf.coff" \
|
||||
M4_SOURCES="$SRC" \
|
||||
M4_SOURCES="$WORK/prf.c" \
|
||||
M4_ENTRY="$DIR/i64div-perf-entry.asm" \
|
||||
M4_CHECK_LUA="$CHECK_LUA" \
|
||||
M4_LINK_CMD="$LINK_CMD" \
|
||||
M4_CLANG_OPT="$OPT" \
|
||||
M4_LLC_OPT="$OPT" \
|
||||
M4_NATIVE=1 \
|
||||
M4_LINKER=tms-link \
|
||||
M4_OS2=1 \
|
||||
M4_NATIVE_PROG_LEN="${PROG_LEN}h" \
|
||||
M4_NATIVE_RAM_LEN="${RAM_LEN}h" \
|
||||
M4_SKIP_MAME="$skip" \
|
||||
LOADER_AT="$LOADER_AT" \
|
||||
LOADER_END="$LOADER_END" \
|
||||
"$ROOT/scripts/m4/run.sh" "$@"
|
||||
}
|
||||
|
||||
echo "== GSPA/GSPLNK link phase: assert the complete image map"
|
||||
echo "== native tms-link phase: assert the complete image map"
|
||||
run_m4 1 > "$WORK/link.log" 2>&1 \
|
||||
|| { tail -60 "$WORK/link.log" >&2; fail "GSPA/GSPLNK link failed"; }
|
||||
|| { tail -60 "$WORK/link.log" >&2; fail "native tms-link failed"; }
|
||||
python3 "$MAP_CHECK" "$WORK/m4.map" "$MARKERS" \
|
||||
"$PROG_ORIGIN" "$PROG_LEN" "$RAM_ORIGIN" "$RAM_LEN" \
|
||||
|| { tail -40 "$WORK/link.log" >&2; \
|
||||
fail "marker cells overlap a GSPLNK section"; }
|
||||
fail "marker cells overlap a linked section"; }
|
||||
|
||||
echo "== MAME run"
|
||||
run_m4 '' > "$WORK/run.log" 2>&1 \
|
||||
|
||||
Executable
+510
@@ -0,0 +1,510 @@
|
||||
#!/bin/sh
|
||||
# M9.2 .debug_rnglists merge gate: two synthetic TUs that actually emit
|
||||
# DWARF v5 range lists through tms-link --keep-debug.
|
||||
#
|
||||
# scripts/tests/m9/dwarf-ranges.sh
|
||||
#
|
||||
# The M8 fixtures (-O0, and a straight-line -O2 shape) never emitted a range
|
||||
# list, so its whitelist entry was never exercised. The fixture helper
|
||||
# `scripts/m9/dwarf-ranges-fixture.py` builds two relocatable TI-COFF objects,
|
||||
# each with
|
||||
# .debug_abbrev/.debug_info/.debug_str/.debug_addr/.debug_rnglists,
|
||||
# a CU with DW_AT_rnglists_base, DW_AT_addr_base and DW_AT_ranges
|
||||
# (DW_FORM_rnglistx), a range list containing DW_RLE_start_end (absolute,
|
||||
# relocated .text addresses) and DW_RLE_startx_length (index into .debug_addr),
|
||||
# and a subprogram with a relocated DW_FORM_addr low PC.
|
||||
#
|
||||
# The gate:
|
||||
# 1. links the two objects with --keep-debug and with the default strip;
|
||||
# 2. checks the merged section sizes, the second TU's rehomed
|
||||
# abbrev/addr/rnglists bases and the .debug_addr/.debug_rnglists entries
|
||||
# with the independent M7 COFF reader;
|
||||
# 3. checks that a single-object --keep-debug link reproduces the M8
|
||||
# single-TU byte layout (only relocation fields differ from the input);
|
||||
# 4. wraps the kept sections in the M7 ELF32 container and requires
|
||||
# llvm-dwarfdump to show both TUs' CUs, ranges and address tables;
|
||||
# 5. checks the default strip has exactly .text/.data/.bss with the same
|
||||
# allocated bytes as the kept image.
|
||||
#
|
||||
# It is hermetic (no compiler, GSPA, DOSBox or MAME required).
|
||||
#
|
||||
# Overridable: LLVM_BIN DWARFDUMP TMS_LINK M7COFF ELF_WRAP FIXTURE
|
||||
# M9_DWARF_RANGES_WORK
|
||||
set -eu
|
||||
|
||||
ROOT=$(cd "$(dirname "$0")/../../.." && pwd)
|
||||
|
||||
LLVM_BIN=${LLVM_BIN:-$ROOT/build/llvm-clean-build/bin}
|
||||
TMS_CLANG=${TMS_CLANG:-$ROOT/scripts/tms-clang}
|
||||
TMS_LLC=${TMS_LLC:-$LLVM_BIN/llc}
|
||||
DWARFDUMP=${DWARFDUMP:-$LLVM_BIN/llvm-dwarfdump}
|
||||
TMS_LINK=${TMS_LINK:-$ROOT/tools/tms-link/tms-link}
|
||||
M7COFF=${M7COFF:-$ROOT/build/llvm-clean/llvm/test/CodeGen/TMS34010/m7coff.py}
|
||||
ELF_WRAP=${ELF_WRAP:-$ROOT/scripts/m7/elf-debug-wrap.py}
|
||||
FIXTURE=${FIXTURE:-$ROOT/scripts/m9/dwarf-ranges-fixture.py}
|
||||
WORK=${M9_DWARF_RANGES_WORK:-$ROOT/build/m9-dwarf-ranges}
|
||||
|
||||
fail() {
|
||||
echo "M9 dwarf-ranges: FAIL: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -x "$TMS_LINK" ] || fail "missing tms-link: $TMS_LINK"
|
||||
[ -x "$DWARFDUMP" ] || fail "missing llvm-dwarfdump: $DWARFDUMP"
|
||||
[ -f "$M7COFF" ] \
|
||||
|| fail "independent TI-COFF reader not found: $M7COFF (set M7COFF=...)"
|
||||
[ -f "$ELF_WRAP" ] || fail "missing ELF wrapper: $ELF_WRAP"
|
||||
[ -f "$FIXTURE" ] || fail "missing range-list fixture: $FIXTURE"
|
||||
|
||||
rm -rf "$WORK"
|
||||
mkdir -p "$WORK"
|
||||
WORK=$(cd "$WORK" && pwd)
|
||||
|
||||
echo "== write the two .debug_rnglists TUs"
|
||||
python3 "$FIXTURE" "$WORK" \
|
||||
|| fail "could not write the .debug_rnglists fixture objects"
|
||||
|
||||
echo "== link --keep-debug, single-TU keep, and the default strip"
|
||||
"$TMS_LINK" -o "$WORK/keep.coff" --keep-debug --entry _rng_a \
|
||||
--text 018A0000 "$WORK/rng-a.o" "$WORK/rng-b.o" \
|
||||
|| fail "tms-link --keep-debug failed"
|
||||
"$TMS_LINK" -o "$WORK/single.coff" --keep-debug --entry _rng_a \
|
||||
--text 018A0000 "$WORK/rng-a.o" \
|
||||
|| fail "tms-link --keep-debug (single TU) failed"
|
||||
"$TMS_LINK" -o "$WORK/strip.coff" --entry _rng_a \
|
||||
--text 018A0000 "$WORK/rng-a.o" "$WORK/rng-b.o" \
|
||||
|| fail "tms-link (strip) failed"
|
||||
|
||||
echo "== inspect the merged range/address sections and single-TU bytes"
|
||||
python3 - "$M7COFF" "$WORK/rng-a.o" "$WORK/rng-b.o" "$WORK/keep.coff" \
|
||||
"$WORK/single.coff" "$WORK/strip.coff" "$WORK/ranges.env" <<'PY' \
|
||||
|| fail "merged .debug_rnglists/.debug_addr layout is wrong"
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
sys.dont_write_bytecode = True
|
||||
sys.path.insert(0, os.path.dirname(sys.argv[1]))
|
||||
import m7coff # noqa: E402
|
||||
|
||||
a_path, b_path, keep_path, single_path, strip_path, env_path = sys.argv[2:8]
|
||||
a = m7coff.parse(a_path)
|
||||
b = m7coff.parse(b_path)
|
||||
keep = m7coff.parse(keep_path)
|
||||
single = m7coff.parse(single_path)
|
||||
strip = m7coff.parse(strip_path)
|
||||
|
||||
names = [s["name"] for s in keep["sections"]]
|
||||
want = [".text", ".data", ".bss", ".debug_abbrev", ".debug_info",
|
||||
".debug_str", ".debug_addr", ".debug_rnglists"]
|
||||
if names != want:
|
||||
sys.exit("kept image sections %r, want %r" % (names, want))
|
||||
for sec in keep["sections"]:
|
||||
if sec["nreloc"]:
|
||||
sys.exit("%s still has %d relocation(s)"
|
||||
% (sec["name"], sec["nreloc"]))
|
||||
if sec["name"].startswith(".debug_"):
|
||||
if (sec["paddr"], sec["vaddr"], sec["flags"]) != (0, 0, 0):
|
||||
sys.exit("%s paddr/vaddr/flags %#x/%#x/%#x, want 0/0/0"
|
||||
% (sec["name"], sec["paddr"], sec["vaddr"], sec["flags"]))
|
||||
|
||||
def raw(coff, name):
|
||||
return m7coff.section(coff, name)["raw"]
|
||||
|
||||
a_info, b_info = raw(a, ".debug_info"), raw(b, ".debug_info")
|
||||
a_abbrev = raw(a, ".debug_abbrev")
|
||||
a_addr, b_addr = raw(a, ".debug_addr"), raw(b, ".debug_addr")
|
||||
a_rng, b_rng = raw(a, ".debug_rnglists"), raw(b, ".debug_rnglists")
|
||||
a_str, b_str = raw(a, ".debug_str"), raw(b, ".debug_str")
|
||||
|
||||
for name, parts in ((".debug_info", (a_info, b_info)),
|
||||
(".debug_str", (a_str, b_str)),
|
||||
(".debug_addr", (a_addr, b_addr)),
|
||||
(".debug_rnglists", (a_rng, b_rng)),
|
||||
(".debug_abbrev", (a_abbrev, raw(b, ".debug_abbrev")))):
|
||||
got = raw(keep, name)
|
||||
concat = b"".join(parts)
|
||||
if len(got) != len(concat):
|
||||
sys.exit("%s merged size %d bytes, want %d"
|
||||
% (name, len(got), len(concat)))
|
||||
if len(got) * 8 != m7coff.section(keep, name)["size"]:
|
||||
sys.exit("%s merged size does not match its bytes" % name)
|
||||
skip = set()
|
||||
base = 0
|
||||
for src in (a, b):
|
||||
for raddr, _symidx, _rtype in m7coff.section(src, name)["relocs"]:
|
||||
field = base + raddr // 8
|
||||
skip.update(range(field, field + 4))
|
||||
base += len(m7coff.section(src, name)["raw"])
|
||||
diff = [i for i in range(len(concat))
|
||||
if concat[i] != got[i] and i not in skip]
|
||||
if diff:
|
||||
sys.exit("%s differs from the object-order concatenation outside "
|
||||
"relocation fields at %r" % (name, diff[:8]))
|
||||
|
||||
text = m7coff.section(keep, ".text")
|
||||
origin = text["paddr"] // 8
|
||||
if origin != 0x314000:
|
||||
sys.exit("text origin byte address %#x, want 0x314000" % origin)
|
||||
if text["size"] != len(a["sections"][0]["raw"]) * 8 * 2:
|
||||
sys.exit(".text merged size %d bits" % text["size"])
|
||||
|
||||
def u32(data, off):
|
||||
return struct.unpack_from("<I", data, off)[0]
|
||||
|
||||
# Every range/address this fixture emits, by merged contribution. The second
|
||||
# TU's .text contribution starts 16 bytes into the merged section.
|
||||
base_a, base_b = origin, origin + len(raw(a, ".text"))
|
||||
|
||||
# First .debug_rnglists unit: start_end addresses, then a startx_length index.
|
||||
if u32(raw(keep, ".debug_rnglists"), 17) != base_a:
|
||||
sys.exit("first range-list start %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_rnglists"), 17), base_a))
|
||||
if u32(raw(keep, ".debug_rnglists"), 21) != base_a + 4:
|
||||
sys.exit("first range-list end %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_rnglists"), 21), base_a + 4))
|
||||
if u32(raw(keep, ".debug_addr"), 8) != base_a + 8:
|
||||
sys.exit("first addr[0] %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_addr"), 8), base_a + 8))
|
||||
if u32(raw(keep, ".debug_addr"), 12) != base_a + 12:
|
||||
sys.exit("first addr[1] %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_addr"), 12), base_a + 12))
|
||||
|
||||
# Second .debug_rnglists/.debug_addr units are rehomed past the first
|
||||
# object's whole contributions; their address fields are the linked B .text.
|
||||
rng_base_b = len(a_rng) + 12
|
||||
addr_base_b = len(a_addr) + 8
|
||||
if u32(raw(keep, ".debug_rnglists"), len(a_rng) + 17) != base_b:
|
||||
sys.exit("second range-list start %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_rnglists"), len(a_rng) + 17), base_b))
|
||||
if u32(raw(keep, ".debug_rnglists"), len(a_rng) + 21) != base_b + 4:
|
||||
sys.exit("second range-list end %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_rnglists"), len(a_rng) + 21),
|
||||
base_b + 4))
|
||||
if u32(raw(keep, ".debug_addr"), len(a_addr) + 8) != base_b + 8:
|
||||
sys.exit("second addr[0] %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_addr"), len(a_addr) + 8), base_b + 8))
|
||||
if u32(raw(keep, ".debug_addr"), len(a_addr) + 12) != base_b + 12:
|
||||
sys.exit("second addr[1] %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_addr"), len(a_addr) + 12), base_b + 12))
|
||||
|
||||
# Second CU header/root DIE: abbrev offset, strp names, addr_base and
|
||||
# rnglists_base are rehomed; the rnglistx index stays 0.
|
||||
info_b = len(a_info)
|
||||
if info_b != 40:
|
||||
sys.exit("first CU contribution %d bytes, want 40" % info_b)
|
||||
if struct.unpack_from("<I", raw(keep, ".debug_info"), info_b)[0] != \
|
||||
len(b_info) - 4:
|
||||
sys.exit("second CU unit length is wrong")
|
||||
if u32(raw(keep, ".debug_info"), info_b + 8) != len(a_abbrev):
|
||||
sys.exit("second CU abbrev offset %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_info"), info_b + 8), len(a_abbrev)))
|
||||
if u32(raw(keep, ".debug_info"), info_b + 13) != len(a_str):
|
||||
sys.exit("second CU name strp %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_info"), info_b + 13), len(a_str)))
|
||||
if u32(raw(keep, ".debug_info"), info_b + 17) != addr_base_b:
|
||||
sys.exit("second CU addr_base %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_info"), info_b + 17), addr_base_b))
|
||||
if u32(raw(keep, ".debug_info"), info_b + 21) != rng_base_b:
|
||||
sys.exit("second CU rnglists_base %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_info"), info_b + 21), rng_base_b))
|
||||
if raw(keep, ".debug_info")[info_b + 25] != 0:
|
||||
sys.exit("second CU DW_AT_ranges index is not 0")
|
||||
if u32(raw(keep, ".debug_info"), info_b + 31) != base_b:
|
||||
sys.exit("second CU subprogram low_pc %#x, want %#x"
|
||||
% (u32(raw(keep, ".debug_info"), info_b + 31), base_b))
|
||||
|
||||
# First CU's bases are unchanged from the object (single-TU/M8 layout); only
|
||||
# its absolute low PC becomes the linked text address.
|
||||
info_a = raw(keep, ".debug_info")
|
||||
if (u32(info_a, 8), u32(info_a, 13), u32(info_a, 17), u32(info_a, 21)) != \
|
||||
(0, 0, 8, 12):
|
||||
sys.exit("first CU bases are not (0, 0, 8, 12)")
|
||||
if u32(info_a, 31) != base_a:
|
||||
sys.exit("first CU subprogram low_pc %#x, want %#x"
|
||||
% (u32(info_a, 31), base_a))
|
||||
|
||||
# The single-object link must reproduce the M8 single-TU byte layout: every
|
||||
# debug section equals the input with only its relocation fields rewritten to
|
||||
# "target section base + addend" (bases are 0 for a single object).
|
||||
def expected_single(sec):
|
||||
out = bytearray(sec["raw"])
|
||||
by_record = {sym["index"]: sym for sym in a["symbols"]}
|
||||
for raddr, symidx, _rtype in sec["relocs"]:
|
||||
sym = by_record[symidx]
|
||||
target = a["sections"][sym["secno"] - 1]
|
||||
addend = struct.unpack_from("<i", out, raddr // 8)[0]
|
||||
base = 0 if target["name"].startswith(".debug_") else origin
|
||||
struct.pack_into("<I", out, raddr // 8, base + addend)
|
||||
return bytes(out)
|
||||
|
||||
single_names = [s["name"] for s in single["sections"]]
|
||||
if single_names != want:
|
||||
sys.exit("single-TU keep sections %r" % single_names)
|
||||
for name in (".debug_abbrev", ".debug_info", ".debug_str", ".debug_addr",
|
||||
".debug_rnglists"):
|
||||
want_bytes = expected_single(m7coff.section(a, name))
|
||||
got = raw(single, name)
|
||||
if got != want_bytes:
|
||||
sys.exit("single-TU %s bytes differ from the M8 layout" % name)
|
||||
|
||||
# Default strip: exactly the allocated sections, same bytes as keep.
|
||||
if [s["name"] for s in strip["sections"]] != [".text", ".data", ".bss"]:
|
||||
sys.exit("default strip has sections %r"
|
||||
% [s["name"] for s in strip["sections"]])
|
||||
for kept, stripped in zip(keep["sections"][:3], strip["sections"]):
|
||||
if (kept["paddr"], kept["size"], kept["flags"]) != \
|
||||
(stripped["paddr"], stripped["size"], stripped["flags"]):
|
||||
sys.exit("%s keep/strip layout differs" % kept["name"])
|
||||
if kept["name"] != ".bss" and kept["raw"] != stripped["raw"]:
|
||||
sys.exit("%s keep/strip bytes differ" % kept["name"])
|
||||
|
||||
with open(env_path, "w", encoding="ascii") as fh:
|
||||
fh.write("A_RNGLISTS_BITS=%d\n" % (len(a_rng) * 8))
|
||||
fh.write("B_RNGLISTS_BASE=%d\n" % rng_base_b)
|
||||
fh.write("B_ADDR_BASE=%d\n" % addr_base_b)
|
||||
fh.write("TEXT_ORIGIN=%d\n" % origin)
|
||||
print(" merged: .debug_info=%dB .debug_addr=%dB .debug_rnglists=%dB"
|
||||
% (len(raw(keep, ".debug_info")), len(raw(keep, ".debug_addr")),
|
||||
len(raw(keep, ".debug_rnglists"))))
|
||||
print(" second CU: abbrev=%d strp=%d addr_base=%#x rnglists_base=%#x"
|
||||
% (len(a_abbrev), len(a_str), addr_base_b, rng_base_b))
|
||||
print(" ranges: A [%#x,%#x) [%#x,%#x), B [%#x,%#x) [%#x,%#x)"
|
||||
% (base_a, base_a + 4, base_a + 8, base_a + 12,
|
||||
base_b, base_b + 4, base_b + 8, base_b + 12))
|
||||
print(" single TU: M8 byte layout reproduced; strip: .text/.data/.bss")
|
||||
PY
|
||||
|
||||
. "$WORK/ranges.env"
|
||||
|
||||
echo "== wrap the kept .debug_* sections in the M7 ELF32 container"
|
||||
"$ELF_WRAP" -o "$WORK/keep.elf" "$WORK/keep.coff" \
|
||||
|| fail "elf-debug-wrap failed"
|
||||
"$ELF_WRAP" -o "$WORK/single.elf" "$WORK/single.coff" >/dev/null \
|
||||
|| fail "elf-debug-wrap failed for the single-TU link"
|
||||
|
||||
echo "== llvm-dwarfdump: both TUs' ranges and address tables"
|
||||
"$DWARFDUMP" --debug-info --debug-rnglists --debug-addr "$WORK/keep.elf" \
|
||||
> "$WORK/dwarf.txt" 2> "$WORK/dwarf.err" \
|
||||
|| { cat "$WORK/dwarf.err" >&2; \
|
||||
fail "llvm-dwarfdump failed on the merged range lists"; }
|
||||
if grep -qi 'error' "$WORK/dwarf.err"; then
|
||||
cat "$WORK/dwarf.err" >&2
|
||||
fail "llvm-dwarfdump reported an error"
|
||||
fi
|
||||
|
||||
python3 - "$WORK/dwarf.txt" "$TEXT_ORIGIN" <<'PY' \
|
||||
|| fail "merged DWARF range/address content is wrong"
|
||||
import re
|
||||
import sys
|
||||
|
||||
text = open(sys.argv[1], encoding="latin1").read()
|
||||
origin = int(sys.argv[2])
|
||||
base_a = origin
|
||||
base_b = origin + 16
|
||||
|
||||
# Parse the CUs from the .debug_info dump only; the raw .debug_rnglists dump
|
||||
# later in the file also prints ranges, without a CU context.
|
||||
info_part = text.split(".debug_rnglists contents:")[0]
|
||||
blocks = info_part.split("Compile Unit:")[1:]
|
||||
if len(blocks) != 2:
|
||||
sys.exit("saw %d compile units, want 2" % len(blocks))
|
||||
cu_names = []
|
||||
for block in blocks:
|
||||
m = re.search(r'DW_AT_name\t\("([^"]+)"\)', block)
|
||||
if not m:
|
||||
sys.exit("a compile unit has no DW_AT_name")
|
||||
cu_names.append(m.group(1))
|
||||
if cu_names != ["rng-a.c", "rng-b.c"]:
|
||||
sys.exit("compile unit names %r, want ['rng-a.c', 'rng-b.c']" % cu_names)
|
||||
|
||||
def ranges(block):
|
||||
return [(int(a, 16), int(b, 16))
|
||||
for a, b in re.findall(r"\[0x([0-9a-fA-F]+), 0x([0-9a-fA-F]+)\)",
|
||||
block)]
|
||||
|
||||
want = {
|
||||
"rng-a.c": [(base_a, base_a + 4), (base_a + 8, base_a + 12)],
|
||||
"rng-b.c": [(base_b, base_b + 4), (base_b + 8, base_b + 12)],
|
||||
}
|
||||
for block in blocks:
|
||||
name = re.search(r'DW_AT_name\t\("([^"]+)"\)', block).group(1)
|
||||
got = ranges(block)
|
||||
if got != want[name]:
|
||||
sys.exit("%s ranges %r, want %r"
|
||||
% (name, [(hex(a), hex(b)) for a, b in got],
|
||||
[(hex(a), hex(b)) for a, b in want[name]]))
|
||||
m = re.search(r"DW_AT_rnglists_base\t\(0x([0-9a-fA-F]+)\)", block)
|
||||
if not m:
|
||||
sys.exit("%s has no DW_AT_rnglists_base" % name)
|
||||
if name == "rng-a.c" and int(m.group(1), 16) != 12:
|
||||
sys.exit("first CU rnglists_base %s, want 0xc" % m.group(1))
|
||||
if name == "rng-b.c":
|
||||
# The second TU's base must sit past the first contribution + header.
|
||||
if int(m.group(1), 16) <= 12:
|
||||
sys.exit("second CU rnglists_base was not rehomed: %s"
|
||||
% m.group(1))
|
||||
|
||||
addr_part = text.split(".debug_addr contents:")[1].split(
|
||||
".debug_rnglists contents:")[0]
|
||||
addr_entries = [int(v, 16) for v in
|
||||
re.findall(r"^0x([0-9a-fA-F]{8})$", addr_part,
|
||||
re.MULTILINE)]
|
||||
if addr_entries != [base_a + 8, base_a + 12, base_b + 8, base_b + 12]:
|
||||
sys.exit("address table entries %r, want %r"
|
||||
% ([hex(v) for v in addr_entries],
|
||||
[hex(v) for v in (base_a + 8, base_a + 12,
|
||||
base_b + 8, base_b + 12)]))
|
||||
if text.count("range list header:") != 2:
|
||||
sys.exit("saw %d range-list units, want 2"
|
||||
% text.count("range list header:"))
|
||||
if text.count("<End of list>") != 2:
|
||||
sys.exit("range lists did not terminate cleanly")
|
||||
print(" dwarfdump: rng-a.c [%#x,%#x) [%#x,%#x), rng-b.c [%#x,%#x) "
|
||||
"[%#x,%#x)" % (base_a, base_a + 4, base_a + 8, base_a + 12,
|
||||
base_b, base_b + 4, base_b + 8, base_b + 12))
|
||||
print(" dwarfdump: two range-list units, address table %r"
|
||||
% [hex(v) for v in addr_entries])
|
||||
PY
|
||||
|
||||
echo "== llvm-dwarfdump: single-TU range list"
|
||||
"$DWARFDUMP" --debug-info --debug-rnglists --debug-addr "$WORK/single.elf" \
|
||||
> "$WORK/single.txt" 2> "$WORK/single.err" \
|
||||
|| { cat "$WORK/single.err" >&2; \
|
||||
fail "llvm-dwarfdump failed on the single-TU range list"; }
|
||||
python3 - "$WORK/single.txt" "$TEXT_ORIGIN" <<'PY' \
|
||||
|| fail "single-TU range list is wrong"
|
||||
import re
|
||||
import sys
|
||||
|
||||
text = open(sys.argv[1], encoding="latin1").read()
|
||||
origin = int(sys.argv[2])
|
||||
if text.count("Compile Unit:") != 1:
|
||||
sys.exit("single-TU link has %d compile units"
|
||||
% text.count("Compile Unit:"))
|
||||
for want in ("[0x%08x, 0x%08x)" % (origin, origin + 4),
|
||||
"[0x%08x, 0x%08x)" % (origin + 8, origin + 12)):
|
||||
if want not in text:
|
||||
sys.exit("single-TU range list lacks %s" % want)
|
||||
m = re.search(r"DW_AT_rnglists_base\t\(0x([0-9a-fA-F]+)\)", text)
|
||||
if not m or int(m.group(1), 16) != 12:
|
||||
sys.exit("single-TU rnglists_base %r, want 0xc"
|
||||
% (m.group(1) if m else None))
|
||||
print(" dwarfdump: one CU, ranges [%#x,%#x) [%#x,%#x), base 0xc"
|
||||
% (origin, origin + 4, origin + 8, origin + 12))
|
||||
PY
|
||||
|
||||
echo "== real producer: -O2 -g loop/inline shapes emit .debug_rnglists"
|
||||
if [ -x "$TMS_CLANG" ] && [ -x "$TMS_LLC" ]; then
|
||||
for tu in a b; do
|
||||
( cd "$ROOT/scripts/m9" \
|
||||
&& "$TMS_CLANG" -g -O2 -o "$WORK/ranges-$tu.ll" \
|
||||
"dwarf-ranges-$tu.c" ) \
|
||||
|| fail "tms-clang -g -O2 failed for dwarf-ranges-$tu.c"
|
||||
"$TMS_LLC" -march=tms34010 -O0 -filetype=obj \
|
||||
"$WORK/ranges-$tu.ll" -o "$WORK/ranges-$tu.o" \
|
||||
|| fail "llc -filetype=obj failed for ranges-$tu"
|
||||
done
|
||||
rc=0
|
||||
python3 - "$M7COFF" "$WORK/ranges-a.o" "$WORK/ranges-b.o" <<'PY' \
|
||||
|| rc=$?
|
||||
import os
|
||||
import sys
|
||||
sys.dont_write_bytecode = True
|
||||
sys.path.insert(0, os.path.dirname(sys.argv[1]))
|
||||
import m7coff # noqa: E402
|
||||
missing = []
|
||||
for path in sys.argv[2:]:
|
||||
names = [s["name"] for s in m7coff.parse(path)["sections"]]
|
||||
for want in (".debug_rnglists", ".debug_loclists", ".debug_addr",
|
||||
".debug_info"):
|
||||
if want not in names:
|
||||
missing.append("%s:%s" % (os.path.basename(path), want))
|
||||
if missing:
|
||||
print(" missing producer sections: " + " ".join(missing))
|
||||
sys.exit(3)
|
||||
print(" both TUs emit .debug_rnglists and .debug_loclists")
|
||||
PY
|
||||
if [ "$rc" -eq 3 ]; then
|
||||
echo " SKIP: this producer emitted no .debug_rnglists for the shape"
|
||||
elif [ "$rc" -ne 0 ]; then
|
||||
fail "could not read/parse the real-producer objects (rc=$rc)"
|
||||
else
|
||||
"$TMS_LINK" -o "$WORK/real-keep.coff" --keep-debug --entry _m9_range_one \
|
||||
--text 018A0000 "$WORK/ranges-a.o" "$WORK/ranges-b.o" \
|
||||
|| fail "tms-link --keep-debug failed for the real producer objects"
|
||||
"$ELF_WRAP" -o "$WORK/real.elf" "$WORK/real-keep.coff" >/dev/null \
|
||||
|| fail "elf-debug-wrap failed for the real producer link"
|
||||
"$DWARFDUMP" --debug-info --debug-rnglists --debug-loclists \
|
||||
"$WORK/real.elf" > "$WORK/real.txt" 2> "$WORK/real.err" \
|
||||
|| { cat "$WORK/real.err" >&2; \
|
||||
fail "llvm-dwarfdump failed on the real producer range lists"; }
|
||||
if grep -qi 'error' "$WORK/real.err"; then
|
||||
cat "$WORK/real.err" >&2
|
||||
fail "llvm-dwarfdump reported an error for the real producer"
|
||||
fi
|
||||
python3 - "$M7COFF" "$WORK/real-keep.coff" "$WORK/real.txt" <<'PY' \
|
||||
|| fail "real-producer range lists did not merge correctly"
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
sys.dont_write_bytecode = True
|
||||
sys.path.insert(0, os.path.dirname(sys.argv[1]))
|
||||
import m7coff # noqa: E402
|
||||
|
||||
coff = m7coff.parse(sys.argv[2])
|
||||
text = m7coff.section(coff, ".text")
|
||||
lo, hi = text["paddr"] // 8, (text["paddr"] + text["size"]) // 8
|
||||
text_info = open(sys.argv[3], encoding="latin1").read()
|
||||
info_part = text_info.split(".debug_rnglists contents:")[0]
|
||||
blocks = info_part.split("Compile Unit:")[1:]
|
||||
if len(blocks) != 2:
|
||||
sys.exit("saw %d compile units, want 2" % len(blocks))
|
||||
names = []
|
||||
for block in blocks:
|
||||
m = re.search(r'DW_AT_name\t\("([^"]+)"\)', block)
|
||||
if not m:
|
||||
sys.exit("a real-producer CU has no name")
|
||||
names.append(m.group(1))
|
||||
if names != ["dwarf-ranges-a.c", "dwarf-ranges-b.c"]:
|
||||
sys.exit("real-producer CU names %r" % names)
|
||||
for block, name in zip(blocks, names):
|
||||
if not re.search(r"DW_AT_ranges\t\(indexed .*rangelist = 0x",
|
||||
block):
|
||||
sys.exit("%s has no resolved DW_AT_ranges" % name)
|
||||
ranges = [(int(a, 16), int(b, 16))
|
||||
for a, b in re.findall(
|
||||
r"\[0x([0-9a-fA-F]+), 0x([0-9a-fA-F]+)\)", block)]
|
||||
if not ranges:
|
||||
sys.exit("%s has no range entries" % name)
|
||||
for start, end in ranges:
|
||||
if not (lo <= start < end <= hi):
|
||||
sys.exit("%s range [%#x, %#x) is outside the linked .text "
|
||||
"[%#x, %#x)" % (name, start, end, lo, hi))
|
||||
m = re.search(r"DW_AT_rnglists_base\t\(0x([0-9a-fA-F]+)\)", block)
|
||||
if not m:
|
||||
sys.exit("%s has no DW_AT_rnglists_base" % name)
|
||||
base = int(m.group(1), 16)
|
||||
if name == "dwarf-ranges-b.c" and base <= 0x0C:
|
||||
sys.exit("second real-producer CU rnglists_base was not rehomed: %#x"
|
||||
% base)
|
||||
if ".debug_loclists" in text_info:
|
||||
m = re.search(r"DW_AT_loclists_base\t\(0x([0-9a-fA-F]+)\)", block)
|
||||
if not m:
|
||||
sys.exit("%s has no DW_AT_loclists_base" % name)
|
||||
if name == "dwarf-ranges-b.c" and int(m.group(1), 16) <= 0x0C:
|
||||
sys.exit("second real-producer CU loclists_base was not rehomed")
|
||||
if text_info.count("range list header:") < 2:
|
||||
sys.exit("the real-producer link has %d range-list units, want >= 2"
|
||||
% text_info.count("range list header:"))
|
||||
print(" real producer: 2 CUs, ranges inside [%#x, %#x), rnglists/loclists "
|
||||
"bases rehomed" % (lo, hi))
|
||||
PY
|
||||
fi
|
||||
else
|
||||
echo " SKIP: no tms-clang/llc ($TMS_CLANG, $TMS_LLC)"
|
||||
fi
|
||||
|
||||
echo "M9 dwarf-ranges: PASS (two TUs' .debug_rnglists units concatenated with"
|
||||
echo " rehomed rnglists/addr bases, dwarfdump resolves every"
|
||||
echo " TU's ranges and address entries, single-TU bytes keep"
|
||||
echo " the M8 layout, and the default strip is unchanged)"
|
||||
Executable
+248
@@ -0,0 +1,248 @@
|
||||
#!/usr/bin/env python3
|
||||
"""tms-cc -- a small C driver for the TMS34010 toolchain.
|
||||
|
||||
This is the Phase 1 usability driver: it hides the bit-address IR barrier,
|
||||
llc, the OS/2/GSPA entry assembly and tms-link behind a conventional
|
||||
compile/link interface.
|
||||
|
||||
tms-cc hello.c -o hello.coff # link with the conformance shim + entry
|
||||
tms-cc -c hello.c -o hello.o # relocatable TI-COFF object
|
||||
tms-cc -S hello.c -o hello.s # GSPA assembly
|
||||
|
||||
The default link uses the freestanding conformance shim (printf/sprintf/
|
||||
malloc/free/string) and its entry, so `tms-run hello.coff` can display the
|
||||
output. `-nostdlib` omits the shim; `-l NAME`/`-L DIR` add SDK archives.
|
||||
The compiler pipeline itself remains `scripts/tms-clang` + `llc`; GSPLNK is
|
||||
still the byte/symbol oracle for the gates.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
TMS_CLANG = ROOT / "scripts/tms-clang"
|
||||
LLC = Path(os.environ.get("TMS_LLC", ROOT / "build/llvm-clean-build/bin/llc"))
|
||||
RUN_SH = ROOT / "scripts/m4/run.sh"
|
||||
CONF = ROOT / "scripts/tests/m5/conformance"
|
||||
ENTRY = CONF / "entry.asm"
|
||||
SHIM = CONF / "shim.c"
|
||||
HEAP = CONF / "heap.c"
|
||||
INCLUDE = CONF / "include"
|
||||
TMS_LINK = ROOT / "tools/tms-link/tms-link"
|
||||
|
||||
|
||||
def fail(msg: str, code: int = 1):
|
||||
print(f"tms-cc: error: {msg}", file=sys.stderr)
|
||||
raise SystemExit(code)
|
||||
|
||||
|
||||
def tool(path: Path) -> Path:
|
||||
if not path.is_file():
|
||||
fail(f"missing tool: {path}")
|
||||
return path
|
||||
|
||||
|
||||
def opt_level(args) -> str:
|
||||
if args.O0:
|
||||
return "-O0"
|
||||
if args.opt in ("0",):
|
||||
return "-O0"
|
||||
return "-O2"
|
||||
|
||||
|
||||
def compile_ir(src: Path, dst: Path, opt: str, args):
|
||||
cmd = [str(TMS_CLANG), opt]
|
||||
if args.g:
|
||||
cmd.append("-g")
|
||||
for inc in [str(INCLUDE)] + list(args.includes):
|
||||
cmd += ["-I", inc]
|
||||
cmd += ["-o", str(dst), str(src)]
|
||||
if args.verbose:
|
||||
print("+", " ".join(cmd), file=sys.stderr)
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def llc_obj(ir: Path, dst: Path, args):
|
||||
cmd = [str(LLC), "-march=tms34010", "-O0", "-filetype=obj",
|
||||
str(ir), "-o", str(dst)]
|
||||
if args.verbose:
|
||||
print("+", " ".join(cmd), file=sys.stderr)
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def llc_asm(ir: Path, dst: Path, args):
|
||||
cmd = [str(LLC), "-march=tms34010", "-O0", "-filetype=asm",
|
||||
str(ir), "-o", str(dst)]
|
||||
if args.verbose:
|
||||
print("+", " ".join(cmd), file=sys.stderr)
|
||||
subprocess.run(cmd, check=True)
|
||||
|
||||
|
||||
def resolve_lib(name: str, dirs: list[Path]) -> Path:
|
||||
candidates = []
|
||||
for d in dirs:
|
||||
for fmt in (f"{name}", f"lib{name}.a", f"{name}.lib",
|
||||
f"{name}.LIB", f"lib{name}.lib"):
|
||||
candidates.append(d / fmt)
|
||||
base = Path(name)
|
||||
if base.is_file():
|
||||
return base.resolve()
|
||||
for c in candidates:
|
||||
if c.is_file():
|
||||
return c.resolve()
|
||||
# Default SDK archives.
|
||||
for d in (ROOT / "build/m6-sdk", ROOT / "build/m4-sdk"):
|
||||
for fmt in (f"{name}", f"{name}.lib", f"{name}.LIB",
|
||||
f"lib{name}.a", f"lib{name}.lib"):
|
||||
c = d / fmt
|
||||
if c.is_file():
|
||||
return c.resolve()
|
||||
fail(f"cannot resolve library '{name}' (use -L DIR)")
|
||||
|
||||
|
||||
def link_mode(sources: list[Path], out: Path, args):
|
||||
work = Path(tempfile.mkdtemp(prefix="tms-cc-"))
|
||||
try:
|
||||
copied = []
|
||||
for i, src in enumerate(sources):
|
||||
dst = work / f"c{i}.c"
|
||||
shutil.copyfile(src, dst)
|
||||
copied.append(dst)
|
||||
if not args.nostdlib:
|
||||
copied += [SHIM, HEAP]
|
||||
# Including the source directories preserves quoted headers.
|
||||
incs = ["-I", str(INCLUDE)]
|
||||
for d in sorted({str(s.parent) for s in sources} | set(args.includes)):
|
||||
if d not in incs:
|
||||
incs += ["-I", d]
|
||||
libs = [str(resolve_lib(n, [Path(x) for x in args.libdirs]))
|
||||
for n in args.libs]
|
||||
if not args.nostdlib:
|
||||
# The shim's %f path references flib's FD$* entries; link the SDK
|
||||
# runtimes by default, as the conformance harness does.
|
||||
for default in (ROOT / "build/m6-sdk/flib.lib",
|
||||
ROOT / "build/m6-sdk/rts.lib"):
|
||||
if default.is_file():
|
||||
libs.append(str(default))
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"M4_WORK": str(work),
|
||||
"M4_SDK": os.environ.get("M4_SDK", str(ROOT / "build/m4-sdk")),
|
||||
"M4_COFF": str(out),
|
||||
"M4_SOURCES": " ".join(str(s) for s in copied),
|
||||
"M4_ENTRY": str(ENTRY),
|
||||
"M4_NATIVE": "1",
|
||||
"M4_LINKER": "tms-link",
|
||||
"M4_SKIP_MAME": "1",
|
||||
"M4_CLANG_OPT": opt_level(args),
|
||||
"M4_LLC_OPT": "-O0",
|
||||
"M4_EXTRA_INCLUDES": " ".join(incs),
|
||||
"M4_NATIVE_PROG_LEN": args.prog_len,
|
||||
"M4_NATIVE_RAM_LEN": args.ram_len,
|
||||
})
|
||||
if args.g:
|
||||
env["M4_EXTRA_CFLAGS"] = "-g"
|
||||
if libs:
|
||||
env["M4_NATIVE_LIBS"] = " ".join(libs)
|
||||
# Prefer the direct 2ine assembler; fall back to DOSBox.
|
||||
lx = Path(os.environ.get(
|
||||
"M4_OS2_LX", Path.home() / "os2-work/2ine-tms34010/build/lx_loader"))
|
||||
if lx.is_file():
|
||||
env["M4_OS2"] = "1"
|
||||
env["M4_OS2_LX"] = str(lx)
|
||||
else:
|
||||
env["M4_OS2"] = "0"
|
||||
out.parent.mkdir(parents=True, exist_ok=True)
|
||||
cmd = [str(RUN_SH)]
|
||||
if args.verbose:
|
||||
print("+", " ".join(cmd), file=sys.stderr)
|
||||
r = subprocess.run(cmd, env=env)
|
||||
if r.returncode != 0:
|
||||
fail("link failed", r.returncode)
|
||||
# Keep a map next to the image.
|
||||
map_src = work / "m4.map"
|
||||
map_dst = Path(args.map) if args.map else out.with_suffix(".map")
|
||||
if map_src.is_file():
|
||||
shutil.copyfile(map_src, map_dst)
|
||||
if args.run:
|
||||
subprocess.run([str(ROOT / "scripts/tms-run"), str(out)], check=False)
|
||||
finally:
|
||||
if not args.keep:
|
||||
shutil.rmtree(work, ignore_errors=True)
|
||||
|
||||
|
||||
def main(argv):
|
||||
ap = argparse.ArgumentParser(
|
||||
prog="tms-cc", description="Compile/link C for the TMS34010/VT1200 "
|
||||
"(freestanding; the conformance shim is the default runtime).")
|
||||
ap.add_argument("sources", nargs="+", help=".c source files")
|
||||
ap.add_argument("-o", "--output", help="output file")
|
||||
ap.add_argument("-c", action="store_true", help="compile to TI-COFF objects")
|
||||
ap.add_argument("-S", action="store_true", help="compile to GSPA assembly")
|
||||
ap.add_argument("-O0", dest="O0", action="store_true")
|
||||
ap.add_argument("-O", dest="opt", default="2")
|
||||
ap.add_argument("-g", action="store_true")
|
||||
ap.add_argument("-I", dest="includes", action="append", default=[])
|
||||
ap.add_argument("-L", dest="libdirs", action="append", default=[])
|
||||
ap.add_argument("-l", dest="libs", action="append", default=[])
|
||||
ap.add_argument("-nostdlib", action="store_true",
|
||||
help="omit the shim/heap (user provides all symbols)")
|
||||
ap.add_argument("--text", default="018A0000")
|
||||
ap.add_argument("--bss", default="01A00000")
|
||||
ap.add_argument("--prog-len", default="40000h")
|
||||
ap.add_argument("--ram-len", default="80000h")
|
||||
ap.add_argument("--map", help="map output path")
|
||||
ap.add_argument("--run", action="store_true", help="run with tms-run")
|
||||
ap.add_argument("-v", "--verbose", action="store_true")
|
||||
ap.add_argument("--keep", action="store_true", help="keep the work directory")
|
||||
args = ap.parse_args(argv)
|
||||
|
||||
sources = [Path(s) for s in args.sources]
|
||||
for s in sources:
|
||||
if not s.is_file():
|
||||
fail(f"source not found: {s}")
|
||||
if s.suffix not in (".c", ".C"):
|
||||
fail(f"not a C source: {s}")
|
||||
|
||||
if args.c or args.S:
|
||||
if args.output and len(sources) > 1:
|
||||
outdir = Path(args.output)
|
||||
if not outdir.is_dir():
|
||||
fail("-o with multiple sources must be a directory")
|
||||
for src in sources:
|
||||
ext = ".o" if args.c else ".s"
|
||||
if args.output and len(sources) == 1:
|
||||
dst = Path(args.output)
|
||||
elif args.output:
|
||||
dst = Path(args.output) / (src.stem + ext)
|
||||
else:
|
||||
dst = src.with_suffix(ext)
|
||||
dst.parent.mkdir(parents=True, exist_ok=True)
|
||||
with tempfile.TemporaryDirectory(prefix="tms-cc-") as td:
|
||||
ir = Path(td) / "unit.ll"
|
||||
compile_ir(src, ir, opt_level(args), args)
|
||||
(llc_obj if args.c else llc_asm)(ir, dst, args)
|
||||
if args.verbose:
|
||||
print(dst)
|
||||
return 0
|
||||
|
||||
if not TMS_LINK.is_file():
|
||||
fail(f"missing linker: {TMS_LINK}")
|
||||
if not ENTRY.is_file() or not SHIM.is_file():
|
||||
fail("missing conformance runtime files")
|
||||
out = Path(args.output or "a.coff")
|
||||
link_mode(sources, out, args)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
except subprocess.CalledProcessError as e:
|
||||
raise SystemExit(e.returncode)
|
||||
Executable
+117
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env python3
|
||||
"""tms-run -- load a tms-cc COFF with the dwt loader in MAME and show the result.
|
||||
|
||||
tms-run hello.coff
|
||||
|
||||
The image must use the conformance entry/shim (the tms-cc default) for the
|
||||
status/stdout result block. This is the same loader/MAME acceptance path as
|
||||
the gates; it does not use the real unit (see scripts/tests/m7/hardware.sh).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
MAME = Path(os.environ.get("MAME", ROOT / "build/mame-src/vt1200"))
|
||||
LOADER_LUA = ROOT / "vendor/vt1200/dwt/loader/loader.lua"
|
||||
LOADER_BIN = ROOT / "vendor/vt1200/dwt/loader/build/loader.bin"
|
||||
CHECK_LUA = ROOT / "scripts/tests/m5/conformance/conformance-check.lua"
|
||||
ROMS = ROOT / "vendor/vt1200/harness/mame/roms"
|
||||
|
||||
|
||||
def fail(msg: str, code: int = 1):
|
||||
print(f"tms-run: error: {msg}", file=sys.stderr)
|
||||
raise SystemExit(code)
|
||||
|
||||
|
||||
def main(argv):
|
||||
ap = argparse.ArgumentParser(prog="tms-run")
|
||||
ap.add_argument("coff")
|
||||
ap.add_argument("--at", default=os.environ.get("LOADER_AT", "200"))
|
||||
ap.add_argument("--end", default=os.environ.get("LOADER_END", "1000"))
|
||||
ap.add_argument("--timeout", default="120")
|
||||
ap.add_argument("-v", "--verbose", action="store_true")
|
||||
ap.add_argument("--keep", action="store_true")
|
||||
args = ap.parse_args(argv)
|
||||
|
||||
coff = Path(args.coff)
|
||||
if not coff.is_file():
|
||||
fail(f"missing COFF: {coff}")
|
||||
for p in (MAME, LOADER_LUA, LOADER_BIN, CHECK_LUA):
|
||||
if not p.is_file():
|
||||
fail(f"missing required file: {p}")
|
||||
work = Path(tempfile.mkdtemp(prefix="tms-run-"))
|
||||
try:
|
||||
(work / "run/nvram").mkdir(parents=True)
|
||||
(work / "run/cfg").mkdir(parents=True)
|
||||
result = work / "result.txt"
|
||||
env = dict(os.environ)
|
||||
env.update({
|
||||
"M4_LOADER_LUA": str(LOADER_LUA),
|
||||
"VT1200_MONITOR": "VR319",
|
||||
"VT1200_SKIP_LEVEL1": "1",
|
||||
"LOADER_AT": args.at,
|
||||
"LOADER_END": args.end,
|
||||
"LOADER_BIN": str(LOADER_BIN),
|
||||
"LOADER_COFF": str(coff),
|
||||
"LOADER_OUT": str(work / "evidence"),
|
||||
"CONF_RESULT": str(result),
|
||||
})
|
||||
cmd = [str(MAME), "vt1200",
|
||||
"-rompath", str(ROMS),
|
||||
"-video", "none", "-sound", "none", "-nothrottle",
|
||||
"-skip_gameinfo",
|
||||
"-nvram_directory", str(work / "run/nvram"),
|
||||
"-cfg_directory", str(work / "run/cfg"),
|
||||
"-debug", "-debugger", "none",
|
||||
"-autoboot_script", str(CHECK_LUA), "-autoboot_delay", "0"]
|
||||
if args.verbose:
|
||||
print("+", " ".join(cmd), file=sys.stderr)
|
||||
try:
|
||||
with open(work / "mame.log", "wb") as log:
|
||||
r = subprocess.run(cmd, env=env, timeout=float(args.timeout),
|
||||
stdout=log, stderr=subprocess.STDOUT)
|
||||
except subprocess.TimeoutExpired:
|
||||
fail(f"MAME timed out after {args.timeout}s")
|
||||
if r.returncode != 0:
|
||||
tail = (work / "mame.log").read_text(errors="replace")[-2000:]
|
||||
fail(f"MAME exited {r.returncode}\n{tail}")
|
||||
if not result.is_file():
|
||||
tail = (work / "mame.log").read_text(errors="replace")[-2000:]
|
||||
fail("no result block (image did not use the conformance entry/shim)"
|
||||
+ (f"\n{tail}" if args.verbose else ""))
|
||||
vals = {}
|
||||
for line in result.read_text(errors="replace").splitlines():
|
||||
if "=" in line:
|
||||
k, v = line.split("=", 1)
|
||||
vals[k] = v
|
||||
status = int(vals.get("status", "FFFFFFFF"), 16)
|
||||
magic = vals.get("magic", "")
|
||||
out = bytes.fromhex(vals.get("out", ""))
|
||||
err = bytes.fromhex(vals.get("err", ""))
|
||||
print(f"status: {status} (0x{status:08X})")
|
||||
sys.stdout.flush()
|
||||
if out:
|
||||
sys.stdout.buffer.write(b"stdout:\n" + out)
|
||||
if not out.endswith(b"\n"):
|
||||
sys.stdout.buffer.write(b"\n")
|
||||
if err:
|
||||
sys.stdout.buffer.write(b"stderr:\n" + err)
|
||||
if not err.endswith(b"\n"):
|
||||
sys.stdout.buffer.write(b"\n")
|
||||
sys.stdout.buffer.flush()
|
||||
ok = status == 0 and magic == "434F4E46"
|
||||
return 0 if ok else 1
|
||||
finally:
|
||||
if not args.keep:
|
||||
import shutil
|
||||
shutil.rmtree(work, ignore_errors=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main(sys.argv[1:]))
|
||||
@@ -880,6 +880,86 @@ def make_bad_debug(work, mode):
|
||||
base + extra)
|
||||
|
||||
|
||||
def make_unrelocated_debug(work, kind):
|
||||
"""Write one otherwise-valid object that the input gate must refuse.
|
||||
|
||||
Each kind leaves one reference raw (no relocation) or uses a producer
|
||||
shape the merge cannot represent, so only the form-aware input gate can
|
||||
notice that concatenating it would produce silently wrong DWARF.
|
||||
"""
|
||||
base = [(".text", 0x20, b""), (".data", 0x40, b""),
|
||||
(".bss", 0x80, b"")]
|
||||
|
||||
def cu(version, abbrev_attrs, die_payload, header_tail=b""):
|
||||
abbrev = (b"\x01\x11\x00" + abbrev_attrs +
|
||||
b"\x00\x00" + b"\x00")
|
||||
if version >= 5:
|
||||
body = (struct.pack("<HBB", version, 1, 4) +
|
||||
struct.pack("<I", 0) + header_tail + b"\x01" +
|
||||
die_payload)
|
||||
else:
|
||||
body = (struct.pack("<H", version) + struct.pack("<I", 0) +
|
||||
b"\x04" + b"\x01" + die_payload)
|
||||
return [(".debug_abbrev", 0x00, abbrev),
|
||||
(".debug_info", 0x00,
|
||||
struct.pack("<I", len(body)) + body)]
|
||||
|
||||
if kind == "stmt":
|
||||
extra = cu(5, b"\x03\x08" + b"\x10\x17",
|
||||
b"bad.c\0" + struct.pack("<I", 0))
|
||||
elif kind == "addr":
|
||||
# DW_AT_low_pc as DW_FORM_addr with no relocation.
|
||||
extra = cu(5, b"\x03\x08" + b"\x11\x01",
|
||||
b"addr.c\0" + struct.pack("<I", 0))
|
||||
elif kind == "dwarf4":
|
||||
# Pre-v5 CU: DW_AT_stmt_list is a data4 constant, so a raw value is
|
||||
# accepted by a form-only check but is still rehomed by concatenation.
|
||||
extra = cu(4, b"\x03\x08" + b"\x10\x06",
|
||||
b"v4.c\0" + struct.pack("<I", 0))
|
||||
elif kind == "line":
|
||||
# A DWARF v5 line header whose file path is a raw line_strp.
|
||||
header = bytearray(struct.pack("<HBB", 5, 4, 0))
|
||||
header += b"\0\0\0\0" # header_length (filled below)
|
||||
header += bytes([1, 1, 1, 0xFB, 14, 13])
|
||||
header += bytes(12) # standard_opcode_lengths
|
||||
header += bytes([0]) # directory format count
|
||||
header += bytes([0]) # directory count
|
||||
header += bytes([1, 1, 0x1F]) # file format: path, line_strp
|
||||
header += bytes([1]) # file count
|
||||
header += struct.pack("<I", 0) # raw line_strp, no relocation
|
||||
struct.pack_into("<I", header, 4, len(header) - 8)
|
||||
extra = [(".debug_line", 0x00,
|
||||
struct.pack("<I", len(header)) + header)]
|
||||
elif kind == "rnglists":
|
||||
unit = bytearray(b"\0\0\0\0")
|
||||
unit += struct.pack("<HBB", 5, 4, 0)
|
||||
unit += struct.pack("<I", 1) # offset_entry_count
|
||||
unit += struct.pack("<I", 4) # offset[0]
|
||||
unit += b"\x06" # DW_RLE_start_end
|
||||
unit += struct.pack("<II", 0, 0) # raw addresses, no relocation
|
||||
unit += b"\x00"
|
||||
struct.pack_into("<I", unit, 0, len(unit) - 4)
|
||||
extra = [(".debug_rnglists", 0x00, bytes(unit))]
|
||||
elif kind == "debug_addr":
|
||||
unit = bytearray(b"\0\0\0\0")
|
||||
unit += struct.pack("<HBB", 5, 4, 0)
|
||||
unit += struct.pack("<I", 0) # raw address entry
|
||||
struct.pack_into("<I", unit, 0, len(unit) - 4)
|
||||
extra = [(".debug_addr", 0x00, bytes(unit))]
|
||||
elif kind == "str_offsets":
|
||||
unit = bytearray(b"\0\0\0\0")
|
||||
unit += struct.pack("<HH", 5, 0)
|
||||
unit += struct.pack("<I", 0) # raw .debug_str offset
|
||||
struct.pack_into("<I", unit, 0, len(unit) - 4)
|
||||
extra = [(".debug_str_offsets", 0x00, bytes(unit))]
|
||||
else:
|
||||
fail("unknown unrelocated-debug kind %s" % kind)
|
||||
|
||||
write_minimal_object(
|
||||
os.path.join(work, "unrelocated-debug-%s.o" % kind),
|
||||
base + extra)
|
||||
|
||||
|
||||
def raw_debug(work):
|
||||
out = read_object(os.path.join(work, "raw-debug.out"),
|
||||
relocatable=False)
|
||||
@@ -1058,6 +1138,8 @@ def main(argv):
|
||||
make_raw_debug(work)
|
||||
elif mode == "make-bad-debug":
|
||||
make_bad_debug(work, argv[3])
|
||||
elif mode == "make-unrelocated-debug":
|
||||
make_unrelocated_debug(work, argv[3] if len(argv) > 3 else "stmt")
|
||||
elif mode == "raw-debug":
|
||||
raw_debug(work)
|
||||
elif mode == "emptycinit":
|
||||
|
||||
@@ -290,4 +290,21 @@ for case in unknown dwarf64 strnul; do
|
||||
"$WORK/debug.o" "$WORK/bad-debug-$case.o"
|
||||
done
|
||||
|
||||
echo "== debug merge: unrelocated/unsupported producer fields fail loudly"
|
||||
while IFS='|' read -r kind pattern; do
|
||||
python3 "$DIR/linktest.py" make-unrelocated-debug "$WORK" "$kind" \
|
||||
>/dev/null
|
||||
expect_fail "unrelocated-$kind" "$pattern" \
|
||||
"$TMS_LINK" -o "$WORK/unrelocated-$kind.out" --keep-debug \
|
||||
"$WORK/debug.o" "$WORK/unrelocated-debug-$kind.o"
|
||||
done <<'EOF'
|
||||
stmt|unrelocated DW_FORM_sec_offset for DW_AT_stmt_list
|
||||
addr|unrelocated DW_FORM_addr for DW_AT_low_pc
|
||||
line|unrelocated DW_FORM_line_strp for line-table file entry 0 content 0x1
|
||||
rnglists|unrelocated absolute address for DW_RLE_start_end
|
||||
debug_addr|unrelocated address entry
|
||||
str_offsets|unrelocated entry offset into .debug_str
|
||||
dwarf4|requires DWARF v5
|
||||
EOF
|
||||
|
||||
echo "tms-link tests: PASS"
|
||||
+620
-1
@@ -67,7 +67,10 @@ R_RELLONG = 0x11
|
||||
# carried by a relocation or by the one raw field handled in
|
||||
# _patch_raw_debug_offsets (the CU header's debug_abbrev_offset). LLVM 23.1.5
|
||||
# `-g` objects use exactly these shapes; anything else is refused in a
|
||||
# multi-TU link rather than silently mis-merged.
|
||||
# multi-TU link rather than silently mis-merged. The DWARF walkers
|
||||
# (_check_debug_info/_check_debug_line/_check_debug_list and the .debug_addr/
|
||||
# .debug_str_offsets entry checks) enforce the relocation coverage instead of
|
||||
# assuming it.
|
||||
DEBUG_CONCAT_SECTIONS = frozenset((
|
||||
".debug_abbrev",
|
||||
".debug_info",
|
||||
@@ -85,6 +88,582 @@ class LinkError(Exception):
|
||||
"""A loud link failure (bad input, layout, or unresolved symbol)."""
|
||||
|
||||
|
||||
# -- DWARF input-gate constants ---------------------------------------------
|
||||
#
|
||||
# The multi-object merge copies each object's debug bytes verbatim, so every
|
||||
# field whose value is relative to the start of a debug section must be
|
||||
# rewritten by a relocation. ``_check_debug_references`` walks the sections
|
||||
# and requires that coverage; the one exception is the CU header's
|
||||
# ``debug_abbrev_offset``, which ``_patch_raw_debug_offsets`` patches in place.
|
||||
|
||||
DW_UT_COMPILE = 0x01
|
||||
DW_UT_PARTIAL = 0x03
|
||||
|
||||
DW_FORM_ADDR = 0x01
|
||||
DW_FORM_BLOCK2 = 0x03
|
||||
DW_FORM_BLOCK4 = 0x04
|
||||
DW_FORM_DATA2 = 0x05
|
||||
DW_FORM_DATA4 = 0x06
|
||||
DW_FORM_DATA8 = 0x07
|
||||
DW_FORM_STRING = 0x08
|
||||
DW_FORM_BLOCK = 0x09
|
||||
DW_FORM_BLOCK1 = 0x0A
|
||||
DW_FORM_DATA1 = 0x0B
|
||||
DW_FORM_FLAG = 0x0C
|
||||
DW_FORM_SDATA = 0x0D
|
||||
DW_FORM_STRP = 0x0E
|
||||
DW_FORM_UDATA = 0x0F
|
||||
DW_FORM_REF_ADDR = 0x10
|
||||
DW_FORM_REF1 = 0x11
|
||||
DW_FORM_REF2 = 0x12
|
||||
DW_FORM_REF4 = 0x13
|
||||
DW_FORM_REF8 = 0x14
|
||||
DW_FORM_REF_UDATA = 0x15
|
||||
DW_FORM_INDIRECT = 0x16
|
||||
DW_FORM_SEC_OFFSET = 0x17
|
||||
DW_FORM_EXPRLOC = 0x18
|
||||
DW_FORM_FLAG_PRESENT = 0x19
|
||||
DW_FORM_STRX = 0x1A
|
||||
DW_FORM_ADDRX = 0x1B
|
||||
DW_FORM_REF_SUP4 = 0x1C
|
||||
DW_FORM_STRP_SUP = 0x1D
|
||||
DW_FORM_DATA16 = 0x1E
|
||||
DW_FORM_LINE_STRP = 0x1F
|
||||
DW_FORM_REF_SIG8 = 0x20
|
||||
DW_FORM_IMPLICIT_CONST = 0x21
|
||||
DW_FORM_LOCLISTX = 0x22
|
||||
DW_FORM_RNGLISTX = 0x23
|
||||
DW_FORM_REF_SUP8 = 0x24
|
||||
DW_FORM_STRX1 = 0x25
|
||||
DW_FORM_STRX2 = 0x26
|
||||
DW_FORM_STRX3 = 0x27
|
||||
DW_FORM_STRX4 = 0x28
|
||||
DW_FORM_ADDRX1 = 0x29
|
||||
DW_FORM_ADDRX2 = 0x2A
|
||||
DW_FORM_ADDRX3 = 0x2B
|
||||
DW_FORM_ADDRX4 = 0x2C
|
||||
# GNU extensions seen in the wild (.debug_info only).
|
||||
DW_FORM_GNU_REF_ALT = 0x1F20
|
||||
DW_FORM_GNU_STRP_ALT = 0x1F21
|
||||
|
||||
# Forms that must be covered by a relocation in a multi-object merge:
|
||||
# `DW_FORM_addr` is an absolute address and the rest are offsets from the
|
||||
# start of another debug section. Concatenating debug sections changes those
|
||||
# bases (and the linked image changes addresses), so a raw field is silently
|
||||
# wrong. The CU abbrev offset is the separate documented exception.
|
||||
# `DW_FORM_ref_sup*`/`strp_sup`/GNU `*_alt` are deliberately absent: they
|
||||
# reference the supplementary/alternate object file, not the sections being
|
||||
# concatenated, so they need no rehoming here (and non-compile unit types,
|
||||
# where they can appear, are refused below).
|
||||
REQUIRED_RELOC_FORMS = {
|
||||
DW_FORM_ADDR: "DW_FORM_addr",
|
||||
DW_FORM_STRP: "DW_FORM_strp",
|
||||
DW_FORM_REF_ADDR: "DW_FORM_ref_addr",
|
||||
DW_FORM_SEC_OFFSET: "DW_FORM_sec_offset",
|
||||
DW_FORM_LINE_STRP: "DW_FORM_line_strp",
|
||||
}
|
||||
|
||||
|
||||
ATTR_NAMES = {
|
||||
0x03: "DW_AT_name",
|
||||
0x10: "DW_AT_stmt_list",
|
||||
0x11: "DW_AT_low_pc",
|
||||
0x12: "DW_AT_high_pc",
|
||||
0x1B: "DW_AT_comp_dir",
|
||||
0x25: "DW_AT_producer",
|
||||
0x31: "DW_AT_abstract_origin",
|
||||
0x40: "DW_AT_frame_base",
|
||||
0x55: "DW_AT_ranges",
|
||||
0x72: "DW_AT_str_offsets_base",
|
||||
0x73: "DW_AT_addr_base",
|
||||
0x74: "DW_AT_rnglists_base",
|
||||
0x8C: "DW_AT_loclists_base",
|
||||
}
|
||||
|
||||
DW_RLE_BASE_ADDRESSX = 0x01
|
||||
DW_RLE_STARTX_ENDX = 0x02
|
||||
DW_RLE_STARTX_LENGTH = 0x03
|
||||
DW_RLE_OFFSET_PAIR = 0x04
|
||||
DW_RLE_BASE_ADDRESS = 0x05
|
||||
DW_RLE_START_END = 0x06
|
||||
DW_RLE_START_LENGTH = 0x07
|
||||
|
||||
DW_LLE_BASE_ADDRESSX = 0x01
|
||||
DW_LLE_STARTX_ENDX = 0x02
|
||||
DW_LLE_STARTX_LENGTH = 0x03
|
||||
DW_LLE_OFFSET_PAIR = 0x04
|
||||
DW_LLE_DEFAULT_LOCATION = 0x05
|
||||
DW_LLE_BASE_ADDRESS = 0x06
|
||||
DW_LLE_START_END = 0x07
|
||||
DW_LLE_START_LENGTH = 0x08
|
||||
DW_LLE_GNU_VIEW_PAIR = 0x09
|
||||
|
||||
|
||||
class _DwarfReader:
|
||||
"""A bounded, little-endian DWARF byte reader with loud truncation."""
|
||||
|
||||
__slots__ = ("data", "pos", "end", "where")
|
||||
|
||||
def __init__(self, data, pos, end, where):
|
||||
self.data = data
|
||||
self.pos = pos
|
||||
self.end = end
|
||||
self.where = where
|
||||
|
||||
def fail(self, msg):
|
||||
raise LinkError("%s at byte %#x: %s" % (self.where, self.pos, msg))
|
||||
|
||||
def need(self, n):
|
||||
if self.pos + n > self.end:
|
||||
self.fail("truncated (need %d byte(s), %d remain)"
|
||||
% (n, self.end - self.pos))
|
||||
|
||||
def skip(self, n):
|
||||
self.need(n)
|
||||
self.pos += n
|
||||
|
||||
def u8(self):
|
||||
self.need(1)
|
||||
value = self.data[self.pos]
|
||||
self.pos += 1
|
||||
return value
|
||||
|
||||
def u16(self):
|
||||
self.need(2)
|
||||
value = struct.unpack_from("<H", self.data, self.pos)[0]
|
||||
self.pos += 2
|
||||
return value
|
||||
|
||||
def u32(self):
|
||||
self.need(4)
|
||||
value = struct.unpack_from("<I", self.data, self.pos)[0]
|
||||
self.pos += 4
|
||||
return value
|
||||
|
||||
def cstr(self):
|
||||
end = self.data.find(b"\0", self.pos, self.end)
|
||||
if end < 0:
|
||||
self.fail("unterminated string")
|
||||
self.pos = end + 1
|
||||
|
||||
def uleb(self):
|
||||
value = 0
|
||||
shift = 0
|
||||
while True:
|
||||
byte = self.u8()
|
||||
value |= (byte & 0x7F) << shift
|
||||
if not byte & 0x80:
|
||||
return value
|
||||
shift += 7
|
||||
if shift > 63:
|
||||
self.fail("overlong LEB128 value")
|
||||
|
||||
def sleb(self):
|
||||
value = 0
|
||||
shift = 0
|
||||
while True:
|
||||
byte = self.u8()
|
||||
value |= (byte & 0x7F) << shift
|
||||
shift += 7
|
||||
if not byte & 0x80:
|
||||
if byte & 0x40:
|
||||
value -= 1 << shift
|
||||
return value
|
||||
if shift > 63:
|
||||
self.fail("overlong SLEB128 value")
|
||||
|
||||
|
||||
def _read_form(reader, form, address_size):
|
||||
"""Consume one attribute value.
|
||||
|
||||
Returns ``(resolved_form, value_start, value_size)``. ``DW_FORM_indirect``
|
||||
resolves to the inner form; the returned span is the value itself, not the
|
||||
form selector, so a relocation must cover that span's start.
|
||||
"""
|
||||
if form == DW_FORM_INDIRECT:
|
||||
return _read_form(reader, reader.uleb(), address_size)
|
||||
start = reader.pos
|
||||
if form == DW_FORM_ADDR:
|
||||
reader.skip(address_size)
|
||||
elif form == DW_FORM_BLOCK2:
|
||||
reader.skip(reader.u16())
|
||||
elif form == DW_FORM_BLOCK4:
|
||||
reader.skip(reader.u32())
|
||||
elif form == DW_FORM_BLOCK:
|
||||
reader.skip(reader.uleb())
|
||||
elif form == DW_FORM_BLOCK1:
|
||||
reader.skip(reader.u8())
|
||||
elif form == DW_FORM_EXPRLOC:
|
||||
reader.skip(reader.uleb())
|
||||
elif form == DW_FORM_DATA2:
|
||||
reader.skip(2)
|
||||
elif form == DW_FORM_DATA4:
|
||||
reader.skip(4)
|
||||
elif form in (DW_FORM_DATA8, DW_FORM_REF_SIG8):
|
||||
reader.skip(8)
|
||||
elif form == DW_FORM_DATA16:
|
||||
reader.skip(16)
|
||||
elif form in (DW_FORM_DATA1, DW_FORM_FLAG, DW_FORM_REF1, DW_FORM_STRX1,
|
||||
DW_FORM_ADDRX1):
|
||||
reader.skip(1)
|
||||
elif form in (DW_FORM_REF2, DW_FORM_STRX2, DW_FORM_ADDRX2):
|
||||
reader.skip(2)
|
||||
elif form in (DW_FORM_REF4, DW_FORM_STRP, DW_FORM_REF_ADDR,
|
||||
DW_FORM_SEC_OFFSET, DW_FORM_STRP_SUP, DW_FORM_LINE_STRP,
|
||||
DW_FORM_REF_SUP4, DW_FORM_STRX4, DW_FORM_ADDRX4,
|
||||
DW_FORM_GNU_REF_ALT, DW_FORM_GNU_STRP_ALT):
|
||||
reader.skip(4)
|
||||
elif form in (DW_FORM_REF8, DW_FORM_REF_SUP8):
|
||||
reader.skip(8)
|
||||
elif form in (DW_FORM_STRX3, DW_FORM_ADDRX3):
|
||||
reader.skip(3)
|
||||
elif form == DW_FORM_STRING:
|
||||
reader.cstr()
|
||||
elif form == DW_FORM_SDATA:
|
||||
reader.sleb()
|
||||
elif form in (DW_FORM_UDATA, DW_FORM_REF_UDATA, DW_FORM_STRX,
|
||||
DW_FORM_ADDRX, DW_FORM_LOCLISTX, DW_FORM_RNGLISTX):
|
||||
reader.uleb()
|
||||
elif form in (DW_FORM_FLAG_PRESENT, DW_FORM_IMPLICIT_CONST):
|
||||
pass
|
||||
else:
|
||||
reader.fail("unsupported DWARF form %#x" % form)
|
||||
return form, start, reader.pos - start
|
||||
|
||||
|
||||
def _parse_abbreviations(data, offset, where):
|
||||
"""Parse one abbreviation table; ``offset`` is section-relative."""
|
||||
if offset > len(data):
|
||||
raise LinkError("%s: abbreviation offset %#x is past the %d-byte "
|
||||
"section" % (where, offset, len(data)))
|
||||
reader = _DwarfReader(data, offset, len(data), where)
|
||||
table = {}
|
||||
while True:
|
||||
code = reader.uleb()
|
||||
if code == 0:
|
||||
break
|
||||
if code in table:
|
||||
reader.fail("duplicate abbreviation code %d" % code)
|
||||
tag = reader.uleb()
|
||||
children = reader.u8()
|
||||
attrs = []
|
||||
while True:
|
||||
attr = reader.uleb()
|
||||
form = reader.uleb()
|
||||
if attr == 0 and form == 0:
|
||||
break
|
||||
implicit = None
|
||||
if form == DW_FORM_IMPLICIT_CONST:
|
||||
implicit = reader.sleb()
|
||||
attrs.append((attr, form, implicit))
|
||||
table[code] = (tag, children, attrs)
|
||||
return table
|
||||
|
||||
|
||||
def _dwarf_unit(data, pos, where):
|
||||
"""Return ``(unit_length, unit_end)`` for a bounded DWARF32 unit."""
|
||||
if pos + 4 > len(data):
|
||||
raise LinkError("%s: truncated unit header at %#x" % (where, pos))
|
||||
unit_length = struct.unpack_from("<I", data, pos)[0]
|
||||
if unit_length == 0xFFFFFFFF:
|
||||
raise LinkError("%s: 64-bit DWARF units are not supported in a "
|
||||
"multi-object link" % where)
|
||||
unit_end = pos + 4 + unit_length
|
||||
if unit_end > len(data):
|
||||
raise LinkError("%s: unit at %#x ends past the section"
|
||||
% (where, pos))
|
||||
return unit_length, unit_end
|
||||
|
||||
|
||||
def _require_relocation(relocated, start, size, where, what):
|
||||
"""Every required field must be covered by whole 4-byte relocation(s)."""
|
||||
covered = (size > 0 and size % 4 == 0 and
|
||||
all(start + offset in relocated
|
||||
for offset in range(0, size, 4)))
|
||||
if covered:
|
||||
return
|
||||
raise LinkError(
|
||||
"%s: unrelocated %s at byte %#x; the multi-object debug merge cannot "
|
||||
"rehome it (the producer must emit an R-RELLONG relocation for every "
|
||||
"section-relative field)" % (where, what, start))
|
||||
|
||||
|
||||
def _check_debug_info(obj, sec, relocated):
|
||||
"""Walk each CU's DIEs and require relocations on required fields."""
|
||||
data = sec.data
|
||||
abbrev = obj.section_by_name.get(".debug_abbrev")
|
||||
where = "%s: %s" % (obj.path, sec.name)
|
||||
pos = 0
|
||||
while pos < len(data):
|
||||
_unit_length, unit_end = _dwarf_unit(data, pos, where)
|
||||
header = _DwarfReader(data, pos + 4, unit_end, where)
|
||||
version = header.u16()
|
||||
if version < 5:
|
||||
raise LinkError(
|
||||
"%s: unit at %#x has DWARF version %d; a multi-object "
|
||||
"--keep-debug link requires DWARF v5 (a pre-v5 "
|
||||
"DW_AT_stmt_list uses DW_FORM_data4/data8, which the merge "
|
||||
"cannot rehome)" % (where, pos, version))
|
||||
unit_type = header.u8()
|
||||
address_size = header.u8()
|
||||
if unit_type not in (DW_UT_COMPILE, DW_UT_PARTIAL):
|
||||
raise LinkError(
|
||||
"%s: unit at %#x has unsupported DWARF unit type %#x"
|
||||
% (where, pos, unit_type))
|
||||
abbrev_offset = header.u32()
|
||||
if address_size != 4:
|
||||
raise LinkError(
|
||||
"%s: unit at %#x has address size %d; the link format only "
|
||||
"represents 32-bit DWARF addresses"
|
||||
% (where, pos, address_size))
|
||||
if abbrev is None:
|
||||
raise LinkError("%s: unit at %#x has no .debug_abbrev section"
|
||||
% (where, pos))
|
||||
table = _parse_abbreviations(
|
||||
abbrev.data, abbrev_offset,
|
||||
"%s: .debug_abbrev" % obj.path)
|
||||
reader = _DwarfReader(data, header.pos, unit_end,
|
||||
"%s (unit at %#x)" % (where, pos))
|
||||
while reader.pos < unit_end:
|
||||
die_offset = reader.pos
|
||||
code = reader.uleb()
|
||||
if code == 0:
|
||||
continue
|
||||
entry = table.get(code)
|
||||
if entry is None:
|
||||
raise LinkError(
|
||||
"%s: DIE at %#x uses undefined abbreviation code %d"
|
||||
% (where, die_offset, code))
|
||||
_tag, _children, attrs = entry
|
||||
for attr, form, _implicit in attrs:
|
||||
form, start, size = _read_form(reader, form, address_size)
|
||||
if form not in REQUIRED_RELOC_FORMS:
|
||||
continue
|
||||
what = "%s for %s" % (
|
||||
REQUIRED_RELOC_FORMS[form],
|
||||
ATTR_NAMES.get(attr, "DW_AT_%#x" % attr))
|
||||
_require_relocation(relocated, start, size,
|
||||
"%s (DIE at %#x)" % (where, die_offset),
|
||||
what)
|
||||
pos = unit_end
|
||||
|
||||
|
||||
def _check_debug_line(obj, sec, relocated):
|
||||
"""Walk DWARF v5 line-table directory/file formats for required fields."""
|
||||
data = sec.data
|
||||
where = "%s: %s" % (obj.path, sec.name)
|
||||
pos = 0
|
||||
while pos < len(data):
|
||||
_unit_length, unit_end = _dwarf_unit(data, pos, where)
|
||||
reader = _DwarfReader(data, pos + 4, unit_end, where)
|
||||
version = reader.u16()
|
||||
if version < 5:
|
||||
raise LinkError(
|
||||
"%s: line unit at %#x has DWARF version %d; a multi-object "
|
||||
"--keep-debug link requires DWARF v5 (pre-v5 line headers "
|
||||
"have only inline strings and a data4 stmt_list)"
|
||||
% (where, pos, version))
|
||||
if version >= 5:
|
||||
address_size = reader.u8()
|
||||
reader.u8() # segment_selector_size
|
||||
if address_size != 4:
|
||||
raise LinkError(
|
||||
"%s: line unit at %#x has address size %d; the link "
|
||||
"format only represents 32-bit DWARF addresses"
|
||||
% (where, pos, address_size))
|
||||
header_length = reader.u32()
|
||||
header_end = reader.pos + header_length
|
||||
if header_end > unit_end:
|
||||
raise LinkError("%s: unit at %#x has a header past its end"
|
||||
% (where, pos))
|
||||
head = _DwarfReader(data, reader.pos, header_end,
|
||||
"%s (unit at %#x)" % (where, pos))
|
||||
head.u8() # minimum_instruction_length
|
||||
if version >= 4:
|
||||
head.u8() # maximum_operations_per_instruction
|
||||
head.u8() # default_is_stmt
|
||||
# LLVM's MC writer emits line_base as a plain int8 (DWARF says
|
||||
# SLEB128) and its own reader consumes one byte; follow the pinned
|
||||
# producer so 0xfb means -5 rather than an overlong SLEB128.
|
||||
head.u8() # line_base (int8)
|
||||
head.u8() # line_range
|
||||
opcode_base = head.u8()
|
||||
if opcode_base < 1:
|
||||
raise LinkError("%s: line unit at %#x has opcode_base 0"
|
||||
% (where, pos))
|
||||
head.skip(opcode_base - 1) # standard_opcode_lengths
|
||||
for kind in ("directory", "file"):
|
||||
format_count = head.u8()
|
||||
formats = [(head.uleb(), head.uleb())
|
||||
for _ in range(format_count)]
|
||||
entry_count = head.uleb()
|
||||
for index in range(entry_count):
|
||||
for content_type, form in formats:
|
||||
form, start, size = _read_form(head, form,
|
||||
address_size)
|
||||
if form not in REQUIRED_RELOC_FORMS:
|
||||
continue
|
||||
what = "%s for line-table %s entry %d content %#x" % (
|
||||
REQUIRED_RELOC_FORMS[form], kind, index,
|
||||
content_type)
|
||||
_require_relocation(relocated, start, size,
|
||||
"%s (line unit at %#x)"
|
||||
% (where, pos), what)
|
||||
if head.pos != header_end:
|
||||
raise LinkError(
|
||||
"%s: line unit at %#x has an inconsistent header length "
|
||||
"(%#x bytes parsed, %#x declared)"
|
||||
% (where, pos, head.pos, header_end))
|
||||
pos = unit_end
|
||||
|
||||
|
||||
def _check_debug_list(obj, sec, relocated, ranges):
|
||||
"""Walk .debug_rnglists/.debug_loclists entries.
|
||||
|
||||
Section-relative list offsets are self-relative and stay valid when a
|
||||
whole unit is copied. Absolute address fields, however, still need their
|
||||
relocated .text/.data value, and the indexed (``startx_*``) forms need a
|
||||
relocated .debug_addr entry (checked separately).
|
||||
"""
|
||||
data = sec.data
|
||||
where = "%s: %s" % (obj.path, sec.name)
|
||||
pos = 0
|
||||
while pos < len(data):
|
||||
_unit_length, unit_end = _dwarf_unit(data, pos, where)
|
||||
reader = _DwarfReader(data, pos + 4, unit_end,
|
||||
"%s (unit at %#x)" % (where, pos))
|
||||
version = reader.u16()
|
||||
if version != 5:
|
||||
raise LinkError("%s: unit at %#x has DWARF version %d; only v5 "
|
||||
"list sections are supported in a multi-object "
|
||||
"link" % (where, pos, version))
|
||||
address_size = reader.u8()
|
||||
reader.u8() # segment_selector_size
|
||||
if address_size != 4:
|
||||
raise LinkError(
|
||||
"%s: unit at %#x has address size %d; the link format only "
|
||||
"represents 32-bit DWARF addresses"
|
||||
% (where, pos, address_size))
|
||||
reader.skip(reader.u32() * 4) # offset_entry_count / offset entries
|
||||
|
||||
def address(kind, list_at):
|
||||
start = reader.pos
|
||||
reader.skip(address_size)
|
||||
_require_relocation(relocated, start, address_size,
|
||||
"%s (list at %#x)" % (where, list_at),
|
||||
"absolute address for %s" % kind)
|
||||
|
||||
while reader.pos < unit_end:
|
||||
list_at = reader.pos
|
||||
kind = reader.u8()
|
||||
if kind == 0:
|
||||
continue
|
||||
if ranges:
|
||||
if kind == DW_RLE_BASE_ADDRESSX:
|
||||
reader.uleb()
|
||||
elif kind in (DW_RLE_STARTX_ENDX, DW_RLE_OFFSET_PAIR):
|
||||
reader.uleb()
|
||||
reader.uleb()
|
||||
elif kind == DW_RLE_STARTX_LENGTH:
|
||||
reader.uleb()
|
||||
reader.uleb()
|
||||
elif kind == DW_RLE_BASE_ADDRESS:
|
||||
address("DW_RLE_base_address", list_at)
|
||||
elif kind == DW_RLE_START_END:
|
||||
address("DW_RLE_start_end", list_at)
|
||||
address("DW_RLE_start_end", list_at)
|
||||
elif kind == DW_RLE_START_LENGTH:
|
||||
address("DW_RLE_start_length", list_at)
|
||||
reader.uleb()
|
||||
else:
|
||||
raise LinkError(
|
||||
"%s: unknown DW_RLE entry %#x at %#x"
|
||||
% (where, kind, list_at))
|
||||
else:
|
||||
if kind == DW_LLE_BASE_ADDRESSX:
|
||||
reader.uleb()
|
||||
elif kind in (DW_LLE_STARTX_ENDX, DW_LLE_STARTX_LENGTH,
|
||||
DW_LLE_OFFSET_PAIR):
|
||||
reader.uleb()
|
||||
reader.uleb()
|
||||
reader.skip(reader.uleb()) # location description
|
||||
elif kind == DW_LLE_DEFAULT_LOCATION:
|
||||
reader.skip(reader.uleb())
|
||||
elif kind == DW_LLE_BASE_ADDRESS:
|
||||
address("DW_LLE_base_address", list_at)
|
||||
elif kind == DW_LLE_START_END:
|
||||
address("DW_LLE_start_end", list_at)
|
||||
address("DW_LLE_start_end", list_at)
|
||||
reader.skip(reader.uleb())
|
||||
elif kind == DW_LLE_START_LENGTH:
|
||||
address("DW_LLE_start_length", list_at)
|
||||
reader.uleb()
|
||||
reader.skip(reader.uleb())
|
||||
elif kind == DW_LLE_GNU_VIEW_PAIR:
|
||||
reader.uleb()
|
||||
reader.uleb()
|
||||
else:
|
||||
raise LinkError(
|
||||
"%s: unknown DW_LLE entry %#x at %#x"
|
||||
% (where, kind, list_at))
|
||||
pos = unit_end
|
||||
|
||||
|
||||
def _check_debug_str_offsets(obj, sec, relocated):
|
||||
"""Every .debug_str_offsets entry is an offset into .debug_str."""
|
||||
data = sec.data
|
||||
where = "%s: %s" % (obj.path, sec.name)
|
||||
pos = 0
|
||||
while pos < len(data):
|
||||
_unit_length, unit_end = _dwarf_unit(data, pos, where)
|
||||
reader = _DwarfReader(data, pos + 4, unit_end, where)
|
||||
version = reader.u16()
|
||||
if version != 5:
|
||||
raise LinkError("%s: unit at %#x has DWARF version %d; only v5 "
|
||||
"string-offset tables are supported"
|
||||
% (where, pos, version))
|
||||
reader.u16() # padding
|
||||
if (unit_end - reader.pos) % 4:
|
||||
raise LinkError("%s: unit at %#x has a partial entry"
|
||||
% (where, pos))
|
||||
while reader.pos < unit_end:
|
||||
start = reader.pos
|
||||
reader.u32()
|
||||
_require_relocation(relocated, start, 4,
|
||||
"%s (unit at %#x)" % (where, pos),
|
||||
"entry offset into .debug_str")
|
||||
pos = unit_end
|
||||
|
||||
|
||||
def _check_debug_addr(obj, sec, relocated):
|
||||
"""Every .debug_addr entry is an absolute address."""
|
||||
data = sec.data
|
||||
where = "%s: %s" % (obj.path, sec.name)
|
||||
pos = 0
|
||||
while pos < len(data):
|
||||
_unit_length, unit_end = _dwarf_unit(data, pos, where)
|
||||
reader = _DwarfReader(data, pos + 4, unit_end, where)
|
||||
version = reader.u16()
|
||||
if version != 5:
|
||||
raise LinkError("%s: unit at %#x has DWARF version %d; only v5 "
|
||||
"address tables are supported"
|
||||
% (where, pos, version))
|
||||
address_size = reader.u8()
|
||||
reader.u8() # segment_selector_size
|
||||
if address_size != 4:
|
||||
raise LinkError(
|
||||
"%s: unit at %#x has address size %d; the link format only "
|
||||
"represents 32-bit DWARF addresses"
|
||||
% (where, pos, address_size))
|
||||
while reader.pos < unit_end:
|
||||
start = reader.pos
|
||||
reader.skip(address_size)
|
||||
_require_relocation(relocated, start, address_size,
|
||||
"%s (unit at %#x)" % (where, pos),
|
||||
"address entry")
|
||||
pos = unit_end
|
||||
|
||||
|
||||
def parse_addr(text):
|
||||
s = text.strip().lower()
|
||||
if s.endswith("h"):
|
||||
@@ -472,6 +1051,11 @@ class Linker:
|
||||
byte base inside the merged section (in bits), which is what
|
||||
``_reloc_value`` adds to a section-relative debug reference. With one
|
||||
object every base is 0, so the M7 single-TU bytes are unchanged.
|
||||
|
||||
In a multi-object keep-debug link the inputs are also walked (see
|
||||
``_check_debug_references``), because concatenation is only correct
|
||||
when every section-relative field carries a relocation. The raw
|
||||
CU ``debug_abbrev_offset`` is the one exception and is patched.
|
||||
"""
|
||||
merged = {}
|
||||
order = []
|
||||
@@ -515,11 +1099,46 @@ class Linker:
|
||||
".debug_addr", ".debug_loclists",
|
||||
".debug_rnglists"):
|
||||
self._check_debug_unit_chain(obj, sec)
|
||||
self._check_debug_references(objects)
|
||||
self._patch_raw_debug_offsets(objects)
|
||||
if self.args.keep_debug:
|
||||
for out in order:
|
||||
self._register(out)
|
||||
|
||||
@staticmethod
|
||||
def _check_debug_references(objects):
|
||||
"""Refuse an input whose section-relative fields are not relocated.
|
||||
|
||||
The merge assumes each object's debug bytes can be copied verbatim and
|
||||
then fixed up through its relocation records. A raw (non-relocated)
|
||||
``DW_FORM_strp``/``line_strp``/``sec_offset``/``ref_addr``/
|
||||
``DW_FORM_addr`` or list/address/string-offset entry would be silently
|
||||
wrong after the merge, so the walkers below require a relocation on
|
||||
every such field.
|
||||
|
||||
Bound: line-program ``DW_LNE_set_address`` operands and ``DW_OP_addr``
|
||||
inside location expressions are not decoded; the pinned producer
|
||||
covers those addresses with relocations, but this gate only inspects
|
||||
the DIE/header/list/tables it parses.
|
||||
"""
|
||||
for obj in objects:
|
||||
for sec in obj.sections:
|
||||
if not sec.is_debug:
|
||||
continue
|
||||
relocated = sec.reloc_offsets
|
||||
if sec.name == ".debug_info":
|
||||
_check_debug_info(obj, sec, relocated)
|
||||
elif sec.name == ".debug_line":
|
||||
_check_debug_line(obj, sec, relocated)
|
||||
elif sec.name == ".debug_rnglists":
|
||||
_check_debug_list(obj, sec, relocated, True)
|
||||
elif sec.name == ".debug_loclists":
|
||||
_check_debug_list(obj, sec, relocated, False)
|
||||
elif sec.name == ".debug_str_offsets":
|
||||
_check_debug_str_offsets(obj, sec, relocated)
|
||||
elif sec.name == ".debug_addr":
|
||||
_check_debug_addr(obj, sec, relocated)
|
||||
|
||||
@staticmethod
|
||||
def _check_debug_unit_chain(obj, sec):
|
||||
"""Every unit in a concatenated debug section must be self-contained."""
|
||||
|
||||
@@ -92,6 +92,17 @@ class Section:
|
||||
def is_allocated(self):
|
||||
return self.name in (".text", ".data", ".cinit", ".bss")
|
||||
|
||||
@property
|
||||
def reloc_offsets(self):
|
||||
"""Byte offsets of this section's 4-byte R-RELLONG fields.
|
||||
|
||||
The DWARF input gate uses this to decide whether a section-relative
|
||||
field is actually covered by a relocation. Every relocation record is
|
||||
validated as R-RELLONG with a byte-aligned, in-section field by
|
||||
``read_object``, so the address alone identifies the covered bytes.
|
||||
"""
|
||||
return {rel.raddr // 8 for rel in (self.relocs or ())}
|
||||
|
||||
def __repr__(self):
|
||||
return "Section(%d, %r, size=%d bits)" % (self.index, self.name,
|
||||
self.size)
|
||||
|
||||
Reference in new issue
Block a user