|
1 | 1 | import mcpp; |
2 | | -#include <cstring> |
3 | 2 |
|
4 | | -int main() { |
5 | | - // ⭐⭐ THE LINKER SCRIPT IS FOR THE MACHINE WITH NO OPERATING SYSTEM, AND |
6 | | - // ONLY FOR IT. THAT CONDITION IS WHAT MAKES THIS ONE PROJECT INSTEAD OF TWO. |
7 | | - // |
8 | | - // The claim the design document makes is that a program above openkal is |
9 | | - // built without regard to which implementation is beneath — same source, |
10 | | - // different machine, nothing edited. A directory that could only be built |
11 | | - // one way would illustrate that claim rather than demonstrate it. |
12 | | - // |
13 | | - // So: `mcpp run` puts this on the host over openkal-linux, and |
14 | | - // `mcpp run --target riscv64-none-elf` puts the SAME source on riscv64 over |
15 | | - // OpenSBI. Both print the same four lines. The only thing that differs is |
16 | | - // the memory layout, which is a statement about the machine — and it is |
17 | | - // stated here, once, behind the condition that says which machine. |
18 | | - if (std::strcmp(mcpp::target_os(), "none") == 0) { |
19 | | - // A relative path in `ldflags` would resolve against the build |
20 | | - // directory; `link-script` resolves against the package root. |
21 | | - mcpp::link_script("link.ld"); |
22 | | - } |
23 | | - mcpp::rerun_if_changed("link.ld"); |
24 | | - mcpp::rerun_if_env_changed("MCPP_TARGET_OS"); |
25 | | - return 0; |
26 | | -} |
| 3 | +// ⚠️ THIS FILE STATES NOTHING, AND ITS EMPTINESS IS WHAT THE EXAMPLE IS ABOUT. |
| 4 | +// |
| 5 | +// Until 2026-08-23 it carried a linker script for the machine with no operating |
| 6 | +// system — where OpenSBI hands control over, how much stack, where the heap is |
| 7 | +// — behind a condition on the target. The condition was the honest part: those |
| 8 | +// are statements about a MACHINE and not about this program. |
| 9 | +// |
| 10 | +// ⭐ Which is exactly why they do not belong here either. `openkal-opensbi` is |
| 11 | +// the package that knows that machine, and it supplies the map the same way it |
| 12 | +// supplies its `kal_*` definitions: through its own build program, reaching |
| 13 | +// every consumer's link line. A program adds nothing and gets a layout that |
| 14 | +// works, and the claim this directory makes — same source, different machine, |
| 15 | +// nothing edited — becomes true of the build files as well as of the source. |
| 16 | +// |
| 17 | +// ⚠️ Measured while both copies existed, because a board fact reaches its |
| 18 | +// consumers TRANSITIVELY and this example is a consumer: |
| 19 | +// |
| 20 | +// ld.lld: error: section .eh_frame file range overlaps with |
| 21 | +// .debug_str_offsets |
| 22 | +// ld.lld: error: section .debug_str file range overlaps with .eh_frame_hdr |
| 23 | +// |
| 24 | +// Two scripts, both applied, and a diagnostic that says nothing about there |
| 25 | +// being two. ⇒ A program that also states a board fact states it twice. |
| 26 | +// |
| 27 | +// The file remains rather than being deleted: a build program is how this |
| 28 | +// example would say anything at all, and its absence would read as "this was |
| 29 | +// never considered" rather than "there is nothing to say". |
| 30 | +int main() { return 0; } |
0 commit comments