diff options
Diffstat (limited to 'man')
| -rw-r--r-- | man/Makefile.am | 16 | ||||
| -rw-r--r-- | man/libmcpu.7 | 160 | ||||
| -rw-r--r-- | man/mcpu-ar.1 | 75 | ||||
| -rw-r--r-- | man/mcpu-as.1 | 85 | ||||
| -rw-r--r-- | man/mcpu-ld.1 | 180 | ||||
| -rw-r--r-- | man/mcpu-nm.1 | 66 | ||||
| -rw-r--r-- | man/mcpu-objcopy.1 | 77 | ||||
| -rw-r--r-- | man/mcpu-objdump.1 | 69 | ||||
| -rw-r--r-- | man/mcpu-readelf.1 | 76 | ||||
| -rw-r--r-- | man/mcpu-run.1 | 210 | ||||
| -rw-r--r-- | man/mcpu-strip.1 | 56 | ||||
| -rw-r--r-- | man/ru/Makefile.am | 18 | ||||
| -rw-r--r-- | man/ru/libmcpu.7 | 157 | ||||
| -rw-r--r-- | man/ru/mcpu-ar.1 | 70 | ||||
| -rw-r--r-- | man/ru/mcpu-as.1 | 79 | ||||
| -rw-r--r-- | man/ru/mcpu-ld.1 | 170 | ||||
| -rw-r--r-- | man/ru/mcpu-nm.1 | 59 | ||||
| -rw-r--r-- | man/ru/mcpu-objcopy.1 | 71 | ||||
| -rw-r--r-- | man/ru/mcpu-objdump.1 | 66 | ||||
| -rw-r--r-- | man/ru/mcpu-readelf.1 | 76 | ||||
| -rw-r--r-- | man/ru/mcpu-run.1 | 199 | ||||
| -rw-r--r-- | man/ru/mcpu-strip.1 | 53 |
22 files changed, 2088 insertions, 0 deletions
diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..3fa0e04 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,16 @@ + +SUBDIRS = ru + +MAN1 = mcpu-as.1 \ + mcpu-ld.1 \ + mcpu-run.1 \ + mcpu-readelf.1 \ + mcpu-ar.1 \ + mcpu-nm.1 \ + mcpu-objdump.1 \ + mcpu-strip.1 \ + mcpu-objcopy.1 + +MAN7 = libmcpu.7 + +dist_man_MANS = $(MAN1) $(MAN7) diff --git a/man/libmcpu.7 b/man/libmcpu.7 new file mode 100644 index 0000000..bfaa765 --- /dev/null +++ b/man/libmcpu.7 @@ -0,0 +1,160 @@ +.TH LIBMCPU 7 "October 2026" "LibMCPU" "MCPU Architecture and Toolchain" + +.SH NAME +libmcpu \- MCPU virtual CPU architecture, MELF ABI and binary toolchain +.SH DESCRIPTION +LibMCPU is a software CPU and system-programming toolchain built on LibMPU and +LibMPUIO. It defines the MCPU instruction set, register file, segmented PTR64 +addressing, CALL and lifecycle ABIs, the MELF object/executable format, startup +dynamic linking and host-side execution supervisor. +.PP +The current toolchain reads MELF ET_REL, ET_EXEC and ET_DYN objects. Static +executables use ABI v1. Historical explicit-preload dynamic files use ABI v2. +The current normal dynamic contract is frozen MELF ABI v3 with .dynamic, +DT_SONAME and DT_NEEDED. Incompatible execution-format changes require a new +MELF ABI number; auxiliary non-ALLOC development metadata does not. +.SH ARCHITECTURAL ADDRESS SPACES +PTR64 uses bits 63..60 as a segment selector and bits 59..0 as byte offset. +Current selectors are DATA=0, STACK=1, PROGRAM=2, CONTROL=3, INPUT=4, OUTPUT=5, +TRACE=6 and HEAP=7. PROGRAM, CONTROL and INPUT are guest read-only; DATA, +STACK, OUTPUT, TRACE and HEAP are writable according to the runtime contract. +.SH PROGRAM STATUS WORD +PSW bits 0..7 form the writable CPU flag byte and bits 8..15 form the writable +MPU flag byte. SETF/CLRF change exactly one named flag in bits 0..15; +CLRCPUF clears bits 0..7 and CLRMPUF clears bits 8..15. HF, TF, IF and MODE +are execution/control state and are not writable through these arithmetic/status +flag instructions. JSET/JCLR retain their wider read-only selector contract. +.SH LOW-LEVEL LIFECYCLE +Every ET_EXEC has mandatory _start and _life lifecycle symbols; e_entry always +addresses _start. An executable may place _start in optional .init and may +provide optional .fini/_fini. END returns control to the supervisor at managed +INIT, LIFE and FINI boundaries. A low-level executable owns these lifecycle +symbols itself and receives no automatic HLL CRT. +.SH HLL RUNTIME ABI V1 +Final executable linking also recognizes compiler-normalized HLL complete-program +objects. A PROGRAM defining ET_REL contains strong GLOBAL/FUNC main and fini in +one object. A MODEL defining ET_REL contains strong GLOBAL/FUNC init, life and +fini in one object. PROGRAM main is incompatible with MODEL init/life, and HLL +complete-program roots cannot be mixed with low-level _start/_life ownership. +This is an object-level contract: if a source language makes fini optional, its +compiler must synthesize an empty strong fini while normalizing the ET_REL. +.PP +The binary signatures are: +.nf +PROGRAM: int32 main(int64 argc, PTR64 argv) + void fini(void) +MODEL: int32 init(int64 argc, PTR64 argv) + int32 life(void) + void fini(void) +.fi +.PP +The loader constructs one persistent 32-byte McpuStartup v1 object before +_start. It contains version, size, uint64 argc, PTR64 argv and a reserved zero +field. CRT validates this object, requires argc to fit target signed int64, +reuses the loader-owned persistent argv array, and invokes main/init through the +ordinary CALL ABI. HLL functions return with RET; END and EXIT remain CRT/MELF +lifecycle operations. +.PP +MODEL life returns INT32_MIN (-2147483648) to continue through exactly one LIFE +END boundary, zero for normal completion, or a positive status for an error +exit. Other negative values are reserved by HLL Runtime ABI v1. +.SH HLL CRT +For final static or dynamic ET_EXEC links, mcpu-ld classifies the explicit input +ET_REL objects before library extraction. PROGRAM selects crt0.o; MODEL selects +crt1.o. Both forms also insert crti.o before user objects and crtn.o after user +objects. The objects are loaded only from: +.nf +<MCPU-root>/lib/mcpu/ +.fi +A missing or invalid required CRT object is a fatal link error. There is no +fallback to another root and no fallback from HLL to low-level linking. +.PP +Startup calls __mcpu_libc_init and __mcpu_init_array before entering the HLL +program/model. Graceful HLL finalization calls user fini, __mcpu_fini_array and +__mcpu_libc_fini before the final FINI END. A failure before runtime startup +completes remains PRE_RUNTIME and skips all HLL finalizers. Normal DT_NEEDED +MCPU Libc dependencies may provide the four internal runtime hooks; explicit +preload interposition may not replace them. +.SH TOOLCHAIN +.TP +.BR mcpu-as (1) +Assembler producing MELF ET_REL. +.TP +.BR mcpu-ld (1) +Static/dynamic final linker and partial ET_REL linker. +.TP +.BR mcpu-run (1) +Loader, startup linker, execution supervisor and host-side test bench. +.TP +.BR mcpu-readelf (1) +Structured read-only MELF inspection. +.TP +.BR mcpu-ar (1) +Deterministic UNIX static-archive manager. +.TP +.BR mcpu-nm (1) +Symbol inspection for MELF files and archives. +.TP +.BR mcpu-objdump (1) +Section, relocation and instruction disassembly/inspection. +.TP +.BR mcpu-strip (1) +Conservative removal of non-runtime symbol metadata. +.TP +.BR mcpu-objcopy (1) +Safe MELF-to-MELF metadata copy/edit operations. +.SH INSTALLATION LAYOUT +For the conventional configuration --prefix=/usr --libdir=/usr/lib64, +private commands live below /usr/lib64/mcpu/bin and public command names are +symbolic links in /usr/bin. The runtime root is relocatable and is derived from +the real command location unless an explicit --sys-root is used by tools that +support it. +.PP +The library-search configuration chain used by mcpu-ld and mcpu-run is: +.nf +<runtime-root>/etc/mcpu-ld.conf +/etc/mcpu/mcpu-ld.conf +$HOME/.mcpu/etc/mcpu-ld.conf +.fi +.PP +The canonical target CRT is installed under: +.nf +<runtime-root>/lib/mcpu/crt0.o +<runtime-root>/lib/mcpu/crt1.o +<runtime-root>/lib/mcpu/crti.o +<runtime-root>/lib/mcpu/crtn.o +.fi +.SH MELF AND DEBUG METADATA +MELF is the native MCPU object and executable container; the toolchain does not +need flat firmware images for normal execution. Development/debug information +can be represented as optional non-ALLOC metadata outside PT_LOAD and outside +the runtime dynamic-link contract. Such metadata can evolve under its own +format version and can be removed without changing frozen MELF ABI v3 or guest +execution semantics. +.SH DOCUMENTATION +The LibMCPU release contains the maintained Russian PDF references: +.nf +doc/libmcpu-bytecode-architecture-ru.pdf +doc/libmcpu-melf-abi-ru.pdf +.fi +Editable XeLaTeX sources are under doc/src/. +.SH FILES +.TP +.I /usr/include/libmcpu.h +Public CPU architecture and operation declarations. +.TP +.I /usr/include/mcpu-elf.h +Public MELF constants and record declarations. +.TP +.I /usr/lib64/pkgconfig/libmcpu.pc +Pkg-config metadata for a conventional /usr,/usr/lib64 installation. +.SH SEE ALSO +.BR mcpu-as (1), +.BR mcpu-ld (1), +.BR mcpu-run (1), +.BR mcpu-readelf (1), +.BR mcpu-ar (1), +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR mcpu-strip (1), +.BR mcpu-objcopy (1) diff --git a/man/mcpu-ar.1 b/man/mcpu-ar.1 new file mode 100644 index 0000000..3de29f8 --- /dev/null +++ b/man/mcpu-ar.1 @@ -0,0 +1,75 @@ +.TH MCPU-AR 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-ar \- create and maintain deterministic MCPU static archives +.SH SYNOPSIS +.B mcpu-ar +.RI [ options ] " operation archive " [ member ...] +.SH DESCRIPTION +.B mcpu-ar +creates and maintains deterministic UNIX ar archives whose ordinary members +are MCPU MELF ET_REL objects. Member order is preserved. A standard +System-V/GNU-style archive symbol index can be built with the s operation or +modifier and is used by +.BR mcpu-ld (1) +for selective extraction. +.SH OPERATIONS +.TP +.B r +Replace matching members in place or append members not already present. +.TP +.B q +Append members without replacement. +.TP +.B d +Delete named members. +.TP +.B t +List members. +.TP +.B p +Write selected member contents to standard output. +.TP +.B x +Extract selected members into the current directory. +.TP +.B s +Rebuild the archive symbol index. +.SH MODIFIERS +.TP +.B c +Accepted for ar compatibility; archive creation is quiet. +.TP +.B s +Write or rebuild the standard archive symbol index. +.TP +.B v +Verbose operation. +.PP +Operation and modifiers may be combined, for example rcs, tv or xv. +.SH OPTIONS +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH EXIT STATUS +Zero on success; nonzero on malformed archives, invalid members, I/O or command +errors. +.SH EXAMPLES +.nf +mcpu-ar rcs libsimple.a add-one.o add-two.o value.o +mcpu-ar t libsimple.a +mcpu-ar tv libsimple.a +mcpu-ar x libsimple.a add-one.o +mcpu-ar s libsimple.a +.fi +.SH SEE ALSO +.BR mcpu-ld (1), +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/mcpu-as.1 b/man/mcpu-as.1 new file mode 100644 index 0000000..c4c73be --- /dev/null +++ b/man/mcpu-as.1 @@ -0,0 +1,85 @@ +.TH MCPU-AS 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-as \- assemble MCPU source into a MELF relocatable object +.SH SYNOPSIS +.B mcpu-as +.RI [ options ] " -o output.o input.s" +.SH DESCRIPTION +.B mcpu-as +reads one UTF-8 MCPU assembler source and writes one MELF +.B ET_REL +relocatable object. The assembler does not have a separate compile-only mode: +ET_REL is its normal and only object output. Input and the +.B -o +option may appear in either order. +.PP +The assembler records the symbols, sections and relocations explicitly described +by the source; it does not choose PROGRAM versus MODEL and does not synthesize +HLL CRT objects. Final lifecycle ownership, automatic HLL CRT selection, +STACK and HEAP program headers are resolved later by +.BR mcpu-ld (1). +.SH OPTIONS +.TP +.BI -o " file" +Write the relocatable object to +.IR file . +This option is mandatory. +.TP +.BR -v ", " --verbose +Print the MELF ET_REL output-object summary after successful assembly. +The default successful invocation is quiet. +.TP +.BR -h ", " --help +Display command-line help and exit. +.SH PSW FLAG INSTRUCTIONS +The assembler accepts explicit arithmetic/status flag control instructions: +.nf +SETF flag +CLRF flag +CLRCPUF +CLRMPUF +.fi +.PP +.B SETF +and +.B CLRF +accept the named flags AF, CF, OF, SF, PF, ZF, RF, VF, DOMF, SNGF, OVFF, +UDFF, TLSF, PLSF, INDF and INXF, corresponding to PSW bits 0 through 15. +HF, TF and IF remain readable branch selectors but are not writable through +these instructions; MODE is a multi-bit field and has no selector. +.B CLRCPUF +clears PSW[7:0], while +.B CLRMPUF +clears PSW[15:8]. Both preserve all control/execution state above bit 15. +.SH SOURCE LOCATION CONTROL +The assembler accepts the source directive +.B #line +with a decimal line number and an optional quoted file name. It is intended +for preprocessor output and changes subsequent diagnostic source locations; +it does not become part of the MELF object. +.SH FILES +.TP +.I *.s +MCPU assembler source. +.TP +.I *.o +Conventional name for MELF ET_REL output. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH EXIT STATUS +Zero on success; nonzero on syntax, semantic, I/O or object-generation error. +.SH EXAMPLES +.nf +mcpu-as -o main.o main.s +mcpu-as helper.s -o helper.o +.fi +.SH SEE ALSO +.BR mcpu-ld (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/mcpu-ld.1 b/man/mcpu-ld.1 new file mode 100644 index 0000000..05172bd --- /dev/null +++ b/man/mcpu-ld.1 @@ -0,0 +1,180 @@ +.TH MCPU-LD 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-ld \- link MCPU MELF objects, archives and shared libraries +.SH SYNOPSIS +.B mcpu-ld +.RI [ link-options ] " -o output input ..." +.SH DESCRIPTION +.B mcpu-ld +links MELF ET_REL objects and MCPU static libraries. It can produce a +partially linked ET_REL object, a fully static ABI-v1 ET_EXEC, a frozen ABI-v3 +startup-dynamic ET_EXEC, or an ABI-v3 ET_DYN shared object. +.PP +The default output, when none of +.BR -r , +.B --shared +or +.B --dynamic +is present, is a fully static ABI-v1 ET_EXEC. +.SH OUTPUT MODES +.TP +.B -r +Produce one partial-link MELF ET_REL object. Unresolved strong symbols and +RELA records may remain for a later final link. STACK, HEAP, SONAME and shared +objects are not part of this mode. +.TP +.B --shared +Produce a frozen ABI-v3 MELF ET_DYN shared object. A logical +.B --soname +is mandatory. Shared objects may contain only .text/.data/.bss allocated +sections and own no lifecycle, model spaces, STACK or HEAP. +.TP +.B --dynamic +Produce a frozen ABI-v3 startup-dynamic MELF ET_EXEC. Normal dependencies are +recorded as DT_NEEDED SONAMEs. +.SH AUTOMATIC HLL CRT +For final static or dynamic ET_EXEC output, mcpu-ld examines the explicitly +listed ET_REL input objects before processing -l libraries. It recognizes two +compiler-normalized complete-program forms: +.nf +PROGRAM: strong GLOBAL/FUNC main + fini in one ET_REL +MODEL: strong GLOBAL/FUNC init + life + fini in one ET_REL +.fi +.PP +PROGRAM and MODEL roots are mutually exclusive. Incomplete or split MODEL +definitions are rejected, as are split PROGRAM main/fini definitions. A final +link that mixes HLL roots with low-level _start/_life lifecycle ownership is an +error. The linker does not use library members or shared-library definitions to +classify the complete program. +.PP +After classification, mcpu-ld automatically inserts: +.nf +PROGRAM: crt0.o crti.o <explicit input objects> crtn.o +MODEL: crt1.o crti.o <explicit input objects> crtn.o +.fi +The CRT objects are loaded from <MCPU-root>/lib/mcpu, where <MCPU-root> is the +active installation/system root. Missing or unreadable required CRT objects +are fatal errors. There is no fallback CRT search in another root and no +fallback from an HLL link to low-level linking. +.PP +Low-level ET_EXEC inputs that own _start/_life themselves are linked without HLL +CRT insertion. The -r and --shared modes never perform HLL complete-program +classification or CRT insertion. +.SH SYSTEM ROOT AND CONFIGURATION +.TP +.B --no-config +Do not read mcpu-ld.conf files. The executable-derived runtime root remains +active and supplies its default lib directory. +.TP +.BI --sys-root= PATH +Use PATH as the MCPU system root and do not read configuration files. PATH/lib +becomes the system library directory. A relative PATH is resolved from the +invocation working directory. +.TP +.BI --sys-root " PATH" +Equivalent two-argument form. +.TP +.B --dump-config +Print the effective MCPU configuration and exit. +.TP +.B --print-search-dirs +Print effective library search directories in search order and exit. +.SH LIBRARY OPTIONS +.TP +.BI -L " dir" +.TQ +.BI -L dir +Add an explicit library search directory. Explicit -L directories precede +the configured system library path. +.TP +.BI -l " name" +.TQ +.BI -l name +Link against libNAME. ABI-v1 and -r search only libNAME.a. ABI-v3 dynamic +and shared links search each directory in directory-major order, trying +libNAME.so before libNAME.a. +.TP +.B --static +Force every -l lookup to use libNAME.a without changing the selected output +mode. Static archive members are copied into the result and do not create +DT_NEEDED entries. +.SH SHARED-LIBRARY IDENTITY +.TP +.BI --soname= NAME +.TQ +.BI --soname " NAME" +Set the mandatory ABI-v3 ET_DYN SONAME. NAME is a logical library identity +and must not contain a slash. +.SH EXECUTABLE LAYOUT OPTIONS +.TP +.BI -o " file" +Write the result to file. +.TP +.BI --stack-size= size +Set fixed executable STACK size. The value must be positive and 16-byte +aligned. The default is 1048576 bytes. +.TP +.BI --heap-size= size +Set initial HEAP size. Default: 1048576 bytes. +.TP +.BI --heap-limit= size +Set immutable maximum HEAP size. Default: 1048576 bytes. +.TP +.B --no-heap +Omit PT_MCPU_HEAP from an executable. +.TP +.BR -v ", " --verbose +Print the MELF output-object summary after a successful link. +The default successful invocation is quiet. +.TP +.BR -h ", " --help +Display command-line help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.PP +Size operands are bytes by default. K/KiB, M/MiB and G/GiB are accepted; +K, M and G use binary multipliers. +.SH ARCHIVES AND SYMBOL RESOLUTION +Static libraries are ordinary deterministic UNIX ar containers whose ordinary +members are MELF ET_REL objects. Archive members are extracted selectively +when they satisfy currently unresolved strong GLOBAL symbols. An unresolved +WEAK reference does not by itself pull an archive member. +.PP +For ABI-v3 dynamic output, selecting an ET_DYN provider records its SONAME as +DT_NEEDED. Selecting an archive provider links the required members +statically and records no dependency for that archive. +.SH FILES +.TP +.I <runtime-root>/lib/mcpu/crt0.o, crt1.o, crti.o, crtn.o +Required automatic HLL CRT objects for PROGRAM/MODEL final executable links. +.TP +.I <runtime-root>/etc/mcpu-ld.conf +Relocatable-tree configuration installed with LibMCPU. +.TP +.I /etc/mcpu/mcpu-ld.conf +Optional machine-wide override. +.TP +.I $HOME/.mcpu/etc/mcpu-ld.conf +Optional per-user override. +.SH EXIT STATUS +Zero on success; nonzero on command-line, input-validation, symbol-resolution, +relocation or output error. +.SH EXAMPLES +.nf +mcpu-ld --stack-size=64K --no-heap -o program main.o helper.o +mcpu-ld -r -o combined.o a.o b.o +mcpu-ld --shared --soname=libfoo.so.1 -o libfoo.so.1.0.0 foo.o +mcpu-ld --dynamic -L ./lib -lfoo -o program main.o +mcpu-ld --dynamic --static -L ./lib -lchoice -o program main.o +.fi +.SH SEE ALSO +.BR mcpu-as (1), +.BR mcpu-ar (1), +.BR mcpu-run (1), +.BR mcpu-readelf (1), +.BR libmcpu (7) diff --git a/man/mcpu-nm.1 b/man/mcpu-nm.1 new file mode 100644 index 0000000..abf4f92 --- /dev/null +++ b/man/mcpu-nm.1 @@ -0,0 +1,66 @@ +.TH MCPU-NM 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-nm \- list symbols from MCPU MELF files and archives +.SH SYNOPSIS +.B mcpu-nm +.RI [ options ] " MELF-file(s)" +.SH DESCRIPTION +.B mcpu-nm +lists symbols from MELF ET_REL objects, ET_EXEC executables, ET_DYN shared +objects and deterministic MCPU static archives. By default it reads .symtab +and sorts symbols by name. For ABI-v2/v3 runtime symbols use +.BR -D . +.SH OPTIONS +.TP +.BR -a ", " --debug-syms +Display all named symbols, including FILE and SECTION symbols. +.TP +.BR -g ", " --extern-only +Display only external GLOBAL and WEAK symbols. +.TP +.BR -u ", " --undefined-only +Display only undefined symbols. +.TP +.BR -n ", " --numeric-sort +Sort symbols numerically by value. +.TP +.BR -r ", " --reverse-sort +Reverse the selected sort order. +.TP +.BR -p ", " --no-sort +Preserve symbol-table order. +.TP +.BR -D ", " --dynamic +Read .dynsym instead of .symtab. +.TP +.BR -A ", " --print-file-name +Prefix each output line with the input file name. Archive output identifies +the archive and member. +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH SYMBOL TYPE LETTERS +As with traditional nm output, upper-case type letters identify external +symbols and lower-case letters local symbols. The letter also reflects the +MCPU section class, for example T/t for PROGRAM text and D/d for DATA. +.SH EXIT STATUS +Zero on successful inspection; nonzero for inaccessible or malformed input. +.SH EXAMPLES +.nf +mcpu-nm file.o +mcpu-nm -n file.o +mcpu-nm -D libfoo.so.1 +mcpu-nm -A -D -g libfoo.so.1 +mcpu-nm -A libsimple.a +.fi +.SH SEE ALSO +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/mcpu-objcopy.1 b/man/mcpu-objcopy.1 new file mode 100644 index 0000000..d6efeac --- /dev/null +++ b/man/mcpu-objcopy.1 @@ -0,0 +1,77 @@ +.TH MCPU-OBJCOPY 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-objcopy \- safely copy and edit MCPU MELF metadata +.SH SYNOPSIS +.B mcpu-objcopy +.RI [ options ] " INPUT OUTPUT" +.SH DESCRIPTION +.B mcpu-objcopy +is a MELF-to-MELF structural copier and metadata editor. It is intentionally +not a ROM-image conversion tool: there are no flat binary, Intel HEX, S-record, +VMA/LMA, start-address or section-flag conversion modes. +.PP +The editor protects the frozen MELF ABI-v3 execution contract. Runtime-visible +allocated sections, dynamic-linking metadata, runtime relocations and MCPU +target/lifecycle data cannot be removed, renamed or updated through the safe +metadata interface. +.SH OPTIONS +.TP +.BI -j " NAME" +.TQ +.BI --only-section= NAME +Copy only named sections. Repeatable. The operation is rejected if filtering +would discard runtime-visible, dynamic-linking or ET_REL link-critical data. +.TP +.BI -R " NAME" +.TQ +.BI --remove-section= NAME +Remove a safe non-runtime section. +.TP +.BI --dump-section= NAME=FILE +Write section contents to FILE. For archive input this operation is rejected +as ambiguous because one destination does not identify an archive member. +.TP +.BI --add-section= NAME=FILE +Add a new non-allocated SHT_PROGBITS metadata section whose contents are read +from FILE. Reserved runtime section names are rejected. +.TP +.BI --update-section= NAME=FILE +Replace contents of a safe non-allocated SHT_PROGBITS section. +.TP +.BI --rename-section= OLD=NEW +Rename a safe non-allocated section. Reserved runtime names are protected. +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH STRUCTURAL INVARIANTS +Metadata-only edits rebuild .shstrtab and remap affected section references, +including retained symbol st_shndx values, while preserving the allocated +image and program headers. The non-allocated metadata tail may be repacked. +.SH ARCHIVES +Deterministic MCPU archives are transformed member-by-member and keep their +archive symbol-index semantics. Unknown non-MELF archive members are preserved +according to the archive editor policy. +.SH EXIT STATUS +Zero on success; nonzero on invalid operations, safety-policy violations, +malformed input or I/O error. +.SH EXAMPLES +.nf +mcpu-objcopy input.o output.o +mcpu-objcopy --add-section=.note.build=build.txt input.o output.o +mcpu-objcopy --update-section=.note.build=new.txt input.o output.o +mcpu-objcopy --rename-section=.note.build=.note.release input.o output.o +mcpu-objcopy -R .note.release input.o output.o +mcpu-objcopy --dump-section=.data=data.bin input.o output.o +.fi +.SH SEE ALSO +.BR mcpu-strip (1), +.BR mcpu-objdump (1), +.BR mcpu-readelf (1), +.BR libmcpu (7) diff --git a/man/mcpu-objdump.1 b/man/mcpu-objdump.1 new file mode 100644 index 0000000..92f17a0 --- /dev/null +++ b/man/mcpu-objdump.1 @@ -0,0 +1,69 @@ +.TH MCPU-OBJDUMP 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-objdump \- display sections, relocations and MCPU instructions +.SH SYNOPSIS +.B mcpu-objdump +.RI [ options ] " MELF-file(s)" +.SH DESCRIPTION +.B mcpu-objdump +inspects MELF objects, executables, shared objects and deterministic archives. +Its disassembler uses the same LibMCPU instruction decoder used by execution, +so the toolchain does not maintain a second ISA parser. Symbol and relocation +information is used to annotate disassembly without rewriting raw operand bytes. +.SH OPTIONS +.TP +.BR -d ", " --disassemble +Disassemble executable PROGBITS sections. +.TP +.BR -D ", " --disassemble-all +Attempt disassembly of all selected nonempty PROGBITS sections. +.TP +.BR -r ", " --reloc +Display relocation entries. During disassembly, relocations are associated +with the instruction containing the relocated field; relocations from other +sections remain visible as tables. +.TP +.BR -s ", " --full-contents +Display raw contents of selected sections. +.TP +.BR -t ", " --syms +Display .symtab symbols. +.TP +.BR -T ", " --dynamic-syms +Display .dynsym symbols. +.TP +.BR -h ", " --section-headers +Display section headers. +.TP +.BI -j " NAME" +.TQ +.BI --section= NAME +Restrict section-oriented output to NAME. Repeatable. +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.PP +At least one display option is required. Undecodable bytes are printed as +.byte data and inspection continues. +.SH EXIT STATUS +Zero on successful inspection; nonzero for invalid options or malformed input. +.SH EXAMPLES +.nf +mcpu-objdump -h file.o +mcpu-objdump -t -r -d file.o +mcpu-objdump -T -d -r libfoo.so.1 +mcpu-objdump -s -j .data file.o +mcpu-objdump -d libsimple.a +.fi +.SH SEE ALSO +.BR mcpu-readelf (1), +.BR mcpu-nm (1), +.BR mcpu-objcopy (1), +.BR libmcpu (7) diff --git a/man/mcpu-readelf.1 b/man/mcpu-readelf.1 new file mode 100644 index 0000000..df770bd --- /dev/null +++ b/man/mcpu-readelf.1 @@ -0,0 +1,76 @@ +.TH MCPU-READELF 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-readelf \- display structured information from MCPU MELF files +.SH SYNOPSIS +.B mcpu-readelf +.RI "option(s) MELF-file(s)" +.SH DESCRIPTION +.B mcpu-readelf +is a read-only inspector for LibMCPU MELF ABI-v1, ABI-v2 and ABI-v3 files. It +displays headers, sections, symbols, RELA relocations, dynamic dependency +metadata and MCPU-specific target/lifecycle records without modifying input. +.SH OPTIONS +.TP +.BR -a ", " --all +Equivalent to -h -l -S -s -r -d -A. +.TP +.BR -e ", " --headers +Equivalent to -h -l -S. +.TP +.BR -h ", " --file-header +Display the MELF file header. +.TP +.BR -l ", " --program-headers +Display program headers. +.TP +.B --segments +Alias for --program-headers. +.TP +.BR -S ", " --section-headers +Display section headers. +.TP +.B --sections +Alias for --section-headers. +.TP +.BR -s ", " --symbols +Display .symtab and .dynsym symbol tables when present. +.TP +.B --syms +Alias for --symbols. +.TP +.BR -r ", " --relocs +Display RELA relocation sections. +.TP +.BR -d ", " --dynamic +Display ABI-v3 .dynamic dependency metadata including SONAME and NEEDED. +.TP +.BR -A ", " --arch-specific +Display MCPU target and lifecycle metadata. +.TP +.BR -W ", " --wide +Do not truncate output; accepted for GNU-readelf-style compatibility. +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH EXIT STATUS +Zero when all requested files are read successfully; nonzero for malformed, +unsupported or inaccessible input. +.SH EXAMPLES +.nf +mcpu-readelf -h -S file.o +mcpu-readelf -s -r file.o +mcpu-readelf -l -A program +mcpu-readelf -d libfoo.so.1 +mcpu-readelf -a program +.fi +.SH SEE ALSO +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/mcpu-run.1 b/man/mcpu-run.1 new file mode 100644 index 0000000..65c8f42 --- /dev/null +++ b/man/mcpu-run.1 @@ -0,0 +1,210 @@ +.TH MCPU-RUN 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-run \- load and execute an MCPU MELF executable +.SH SYNOPSIS +.B mcpu-run +.RI [ runtime-options ] " -- executable " [ program-args ...] +.br +.B mcpu-run +.RI [ runtime-options ] " executable " [ program-args ...] +.SH DESCRIPTION +.B mcpu-run +is the LibMCPU loader, startup linker, execution supervisor and host-side test +bench for MELF ET_EXEC images. The form with an explicit +.B -- +separator is preferred. STACK and HEAP sizes are part of the executable MELF +ABI and cannot be overridden by the runner. +.PP +The loader accepts static ABI-v1 executables, historical ABI-v2 explicit +preload files, and frozen ABI-v3 startup-dynamic executables and dependencies. +All startup dependency discovery, symbol selection and runtime relocation is +completed before the first guest instruction. +.SH HLL STARTUP AND LIFECYCLE +An HLL PROGRAM or MODEL executable still enters through the ordinary MELF +_start/_life/_fini lifecycle supplied by the linked CRT. mcpu-run does not +call main, init, life or fini directly. +.PP +Before _start, the loader constructs one persistent McpuStartup v1 area in +STACK containing version, size, argc, PTR64 argv and a reserved zero field. +The argv array and argument strings remain valid for the executable lifetime. +The HLL CRT validates this state and bridges it to the ordinary CALL ABI. +.PP +PROGRAM executes its HLL main once and exits with the returned int32 status. +MODEL performs INIT through init(), then invokes life() once per lifecycle +iteration. INT32_MIN means continue through one LIFE END boundary; zero means +normal completion; a positive value is an error exit status. Other negative +life results are reserved by HLL Runtime ABI v1. +.PP +Graceful HLL exit runs user fini(), __mcpu_fini_array() and +__mcpu_libc_fini() before the final FINI END. Startup failure before the CRT +reaches RUNNING skips those finalizers. A diagnostic --steps stop remains a +supervisor stop and does not synthesize graceful HLL finalization. +.SH SYSTEM OPTIONS +.TP +.B --no-config +Do not read mcpu-ld.conf files while keeping the executable-derived default +system library tree. +.TP +.BI --sys-root= PATH +Use PATH as the MCPU root, suppress configuration files and use PATH/lib as the +system library directory. +.TP +.B --dump-config +Print effective MCPU configuration and exit. +.TP +.B --print-search-dirs +Print effective library search directories and exit. +.SH LIBRARY OPTIONS +These options must precede the executable or explicit -- separator. +.TP +.BI --library-path= DIR[:DIR...] +Add explicit library search directories. The option may be repeated. These +directories precede the effective system library path. +.TP +.BI --ldpreload= a.so:b.so +Preload ABI-v2 or ABI-v3 shared objects. A name without slash is searched; +a spelling containing slash is used as an explicit pathname. +.SH ENVIRONMENT +.TP +.B MCPU_LD_PRELOAD +Colon-separated preload list applied before command-line --ldpreload entries. +For equal-strength definitions the established rightmost priority applies, so +command-line preloads can override environment preloads. +.SH POST-STOP INSPECTION OPTIONS +.TP +.BI --int-reg= r<bits>@<addr> +Print a signed integer register after execution stops. +.TP +.BI --real-reg= r<bits>@<addr> +Print a real register after execution stops. +.TP +.BI --int-data= <bits>@<addr> +.TQ +.BI --real-data= <bits>@<addr> +.TQ +.BI --raw-data= <bytes>@<addr> +Inspect DATA. +.TP +.BI --int-control= <bits>@<addr> +.TQ +.BI --real-control= <bits>@<addr> +.TQ +.BI --raw-control= <bytes>@<addr> +Inspect CONTROL. +.TP +.BI --int-heap= <bits>@<addr> +.TQ +.BI --real-heap= <bits>@<addr> +.TQ +.BI --raw-heap= <bytes>@<addr> +Inspect HEAP. +.TP +.BI --int-input= <bits>@<addr> +.TQ +.BI --real-input= <bits>@<addr> +.TQ +.BI --raw-input= <bytes>@<addr> +Inspect INPUT. +.TP +.BI --int-output= <bits>@<addr> +.TQ +.BI --real-output= <bits>@<addr> +.TQ +.BI --raw-output= <bytes>@<addr> +Inspect OUTPUT. +.TP +.BI --int-trace= <bits>@<addr> +.TQ +.BI --real-trace= <bits>@<addr> +.TQ +.BI --raw-trace= <bytes>@<addr> +Inspect TRACE. +.SH LIFECYCLE CONTROL +.TP +.BI --digits= n +Set mantissa digits for real output. Default: 80. +.TP +.B --init-only +Execute INIT through its END boundary, then stop. +.TP +.BI --steps= n +Stop after n LIFE END boundaries. Without this option normal diagnostic +stepping stops at the first LIFE END boundary. +.TP +.BR -h ", " --help +Display command-line help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH STAGE ACTIONS +The following repeatable options run host actions at lifecycle boundaries: +.TP +.BI --before-run= action +After loading, startup linking, relocations and startup-area preparation, but +before the first guest instruction. +.TP +.BI --after-init= action +After INIT END, or once at the logical empty INIT boundary when .init is absent. +.TP +.BI --on-step= action +After every LIFE END boundary. +.TP +.BI --after-run= action +After final normal execution stop; graceful FINI has already completed. +.PP +Actions execute in command-line order. Supported action forms are: +.nf +print-int-regs:r<bits>@<addr>[,...] +print-real-regs:r<bits>@<addr>[,...] +set-int-regs:r<bits>@<addr>=<value>[,...] +set-real-regs:r<bits>@<addr>=<value>[,...] +print-int-<memory>:<bits>@<addr>[,...] +print-real-<memory>:<bits>@<addr>[,...] +set-int-<memory>:<bits>@<addr>=<value>[,...] +set-real-<memory>:<bits>@<addr>=<value>[,...] +print-raw-<memory>:<bytes>@<addr> +.fi +.PP +.I memory +is data, control, heap, input, output or trace. Scalar print actions print the +comma-separated objects on one line. Raw actions contain exactly one dump; +repeat the stage option for multiple dumps. There are no set-raw-* actions. +Set values are parsed by LibMPUIO mpu_sscanf(). Step-number action filters are +not implemented. +.PP +Raw byte counts accept K/KiB, M/MiB and G/GiB binary suffixes. +.SH LIFECYCLE AND EXIT +END returns control to the supervisor at managed INIT/LIFE/FINI boundaries. +A graceful guest EXIT may enter optional FINI before the final stop. A +diagnostic --steps stop does not synthesize a graceful EXIT and therefore does +not by itself invoke FINI. +.SH FILES +.TP +.I <runtime-root>/etc/mcpu-ld.conf +Installed relocatable-tree library-search configuration. +.TP +.I /etc/mcpu/mcpu-ld.conf +Optional machine-wide override. +.TP +.I $HOME/.mcpu/etc/mcpu-ld.conf +Optional per-user override. +.SH EXIT STATUS +For a normally completed guest program the runner returns the guest exit +status. Loader, startup-linker, option or runtime errors terminate with a +nonzero host-side status. +.SH EXAMPLES +.nf +mcpu-run -- program arg1 arg2 +mcpu-run --library-path=./lib -- program +MCPU_LD_PRELOAD=libhook.so mcpu-run -- program +mcpu-run --steps=20 --on-step=print-real-trace:128@0,128@16 -- pendulum +.fi +.SH SEE ALSO +.BR mcpu-ld (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/mcpu-strip.1 b/man/mcpu-strip.1 new file mode 100644 index 0000000..f36e9aa --- /dev/null +++ b/man/mcpu-strip.1 @@ -0,0 +1,56 @@ +.TH MCPU-STRIP 1 "October 2026" "LibMCPU" "User Commands" + +.SH NAME +mcpu-strip \- safely remove non-runtime symbol metadata from MELF +.SH SYNOPSIS +.B mcpu-strip +.RI [ options ] " MELF-file" +.SH DESCRIPTION +.B mcpu-strip +is deliberately conservative. It removes ordinary non-allocated SHT_SYMTAB +metadata from ET_EXEC and ET_DYN only when no retained section depends on it, +and removes an associated ordinary string table only when it becomes +unreferenced. +.PP +ET_REL symbol tables are preserved because they are part of later link +semantics. Dynamic-linking tables, RELA sections, MCPU target/lifecycle +metadata, allocated/model sections and program headers are always preserved. +Current LibMCPU final-image writers are already compact, so stripping a normal +current ET_EXEC or ET_DYN may intentionally be a byte-for-byte no-op. +.SH OPTIONS +.TP +.BI -o " file" +.TQ +.BI --output= FILE +Write the result to FILE instead of replacing the input in place. +.TP +.B --help +Display help and exit. +.TP +.B --version +Display the program name, MCPU toolchain identity and version, then exit. +.TP +.B --dump-version +Display only the MCPU package version number and exit. +.SH IN-PLACE SAFETY +In-place replacement is performed through a temporary file in the same +directory followed by rename, while preserving the original file mode. +Allocated image bytes and program-header layout are not repacked by the safe +metadata policy. +.SH ARCHIVES +Deterministic MCPU static archives are processed member-by-member; link-critical +ET_REL symbol information remains intact. +.SH EXIT STATUS +Zero on success; nonzero on malformed input, dependency-safety or I/O error. +.SH EXAMPLES +.nf +mcpu-strip program +mcpu-strip -o program.stripped program +mcpu-strip libfoo.so.1 +mcpu-strip libsimple.a +.fi +.SH SEE ALSO +.BR mcpu-objcopy (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/Makefile.am b/man/ru/Makefile.am new file mode 100644 index 0000000..21e1639 --- /dev/null +++ b/man/ru/Makefile.am @@ -0,0 +1,18 @@ + +LANG = ru + +mandir = @mandir@/$(LANG) + +MAN1 = mcpu-as.1 \ + mcpu-ld.1 \ + mcpu-run.1 \ + mcpu-readelf.1 \ + mcpu-ar.1 \ + mcpu-nm.1 \ + mcpu-objdump.1 \ + mcpu-strip.1 \ + mcpu-objcopy.1 + +MAN7 = libmcpu.7 + +dist_man_MANS = $(MAN1) $(MAN7) diff --git a/man/ru/libmcpu.7 b/man/ru/libmcpu.7 new file mode 100644 index 0000000..8003296 --- /dev/null +++ b/man/ru/libmcpu.7 @@ -0,0 +1,157 @@ +.TH LIBMCPU 7 "Октябрь 2026" "LibMCPU" "Архитектура и инструментарий MCPU" + +.SH ИМЯ +libmcpu \- виртуальный CPU MCPU, MELF ABI и бинарный toolchain +.SH ОПИСАНИЕ +LibMCPU — программный CPU и system-programming toolchain на базе LibMPU и +LibMPUIO. Он определяет ISA MCPU, register file, segmented PTR64, CALL и +lifecycle ABI, объектный/исполняемый формат MELF, startup dynamic linking и +host-side execution supervisor. +.PP +Toolchain читает MELF ET_REL, ET_EXEC и ET_DYN. Статические executable +используют ABI v1; historical explicit-preload dynamic files — ABI v2; текущий +normal dynamic contract — frozen MELF ABI v3 с .dynamic, DT_SONAME и DT_NEEDED. +Несовместимое изменение execution format требует нового MELF ABI number; +дополнительные non-ALLOC development metadata его не требуют. +.SH АРХИТЕКТУРНЫЕ ПРОСТРАНСТВА +PTR64 использует bits 63..60 как segment selector и 59..0 как byte offset. +Селекторы: DATA=0, STACK=1, PROGRAM=2, CONTROL=3, INPUT=4, OUTPUT=5, TRACE=6, +HEAP=7. PROGRAM, CONTROL и INPUT guest read-only; DATA, STACK, OUTPUT, TRACE и +HEAP writable в рамках runtime contract. +.SH СЛОВО СОСТОЯНИЯ PSW +PSW bits 0..7 образуют writable CPU flag byte, а bits 8..15 — writable MPU +flag byte. SETF/CLRF изменяют ровно один именованный flag в диапазоне 0..15; +CLRCPUF очищает bits 0..7, CLRMPUF — bits 8..15. HF, TF, IF и MODE относятся +к execution/control state и этими arithmetic/status instructions не записываются. +JSET/JCLR сохраняют более широкий read-only selector contract. +.SH НИЗКОУРОВНЕВЫЙ LIFECYCLE +Каждый ET_EXEC имеет обязательные _start и _life; e_entry всегда адресует +_start. Executable может размещать _start в optional .init и иметь optional +.fini/_fini. END возвращает управление supervisor на управляемых границах INIT, +LIFE и FINI. Низкоуровневый executable сам владеет lifecycle symbols и не +получает automatic HLL CRT. +.SH HLL RUNTIME ABI V1 +Final executable link также распознаёт compiler-normalized HLL complete-program +objects. PROGRAM defining ET_REL содержит strong GLOBAL/FUNC main и fini в одном +object. MODEL defining ET_REL содержит strong GLOBAL/FUNC init, life и fini в +одном object. PROGRAM main несовместим с MODEL init/life; HLL complete-program +roots нельзя смешивать с низкоуровневым владением _start/_life. +Это object-level contract: если source language делает fini optional, compiler +обязан синтезировать empty strong fini при нормализации ET_REL. +.PP +Binary signatures: +.nf +PROGRAM: int32 main(int64 argc, PTR64 argv) + void fini(void) +MODEL: int32 init(int64 argc, PTR64 argv) + int32 life(void) + void fini(void) +.fi +.PP +Перед _start loader один раз создаёт постоянный 32-byte McpuStartup v1: +version, size, uint64 argc, PTR64 argv и reserved zero field. CRT проверяет эту +структуру, требует представимость argc в target signed int64, повторно использует +loader-owned persistent argv и вызывает main/init через обычный CALL ABI. HLL +functions завершаются RET; END и EXIT остаются операциями CRT/MELF lifecycle. +.PP +MODEL life возвращает INT32_MIN (-2147483648) для продолжения через ровно одну +LIFE END boundary, zero для нормального завершения модели и positive status для +error exit. Остальные отрицательные значения зарезервированы HLL Runtime ABI v1. +.SH HLL CRT +Для final static/dynamic ET_EXEC link mcpu-ld классифицирует явные входные +ET_REL objects до извлечения библиотек. PROGRAM выбирает crt0.o, MODEL — crt1.o; +в обоих случаях crti.o вставляется перед user objects, а crtn.o после них. +Объекты загружаются только из: +.nf +<MCPU-root>/lib/mcpu/ +.fi +Отсутствующий или повреждённый обязательный CRT object является fatal link +error. Перехода к другому root и fallback из HLL в low-level linking нет. +.PP +Startup вызывает __mcpu_libc_init и __mcpu_init_array до входа в HLL +program/model. Graceful HLL finalization вызывает user fini, +__mcpu_fini_array и __mcpu_libc_fini перед финальным FINI END. Ошибка до +завершения runtime startup остаётся PRE_RUNTIME и пропускает HLL finalizers. +Обычная DT_NEEDED MCPU Libc dependency может предоставлять четыре internal +runtime hooks; explicit preload не может их подменять. +.SH TOOLCHAIN +.TP +.BR mcpu-as (1) +Assembler MELF ET_REL. +.TP +.BR mcpu-ld (1) +Final/static/dynamic и partial ET_REL linker. +.TP +.BR mcpu-run (1) +Loader, startup linker, execution supervisor и host-side test bench. +.TP +.BR mcpu-readelf (1) +Structured read-only MELF inspection. +.TP +.BR mcpu-ar (1) +Deterministic UNIX static archives. +.TP +.BR mcpu-nm (1) +Symbol inspection. +.TP +.BR mcpu-objdump (1) +Sections, relocations и disassembly. +.TP +.BR mcpu-strip (1) +Conservative non-runtime symbol stripping. +.TP +.BR mcpu-objcopy (1) +Safe MELF-to-MELF metadata editing. +.SH INSTALLATION LAYOUT +При --prefix=/usr --libdir=/usr/lib64 private commands находятся в +/usr/lib64/mcpu/bin, а public names являются symlinks в /usr/bin. Runtime root +перемещаем и обычно выводится из реального пути executable; инструменты с +--sys-root могут выбрать другой root явно. +.PP +Configuration chain mcpu-ld/mcpu-run: +.nf +<runtime-root>/etc/mcpu-ld.conf +/etc/mcpu/mcpu-ld.conf +$HOME/.mcpu/etc/mcpu-ld.conf +.fi +.PP +Canonical target CRT устанавливается в: +.nf +<runtime-root>/lib/mcpu/crt0.o +<runtime-root>/lib/mcpu/crt1.o +<runtime-root>/lib/mcpu/crti.o +<runtime-root>/lib/mcpu/crtn.o +.fi +.SH MELF И DEBUG METADATA +MELF — native MCPU object/executable container; для обычного исполнения не +нужны flat firmware images. Development/debug information может жить как +необязательная non-ALLOC metadata вне PT_LOAD и runtime dynamic-link contract. +Такая metadata может иметь собственную версию формата и удаляться без изменения +frozen MELF ABI v3 и guest execution semantics. +.SH ДОКУМЕНТАЦИЯ +В release входят русские PDF references: +.nf +doc/libmcpu-bytecode-architecture-ru.pdf +doc/libmcpu-melf-abi-ru.pdf +.fi +Editable XeLaTeX sources находятся в doc/src/. +.SH ФАЙЛЫ +.TP +.I /usr/include/libmcpu.h +Public CPU declarations. +.TP +.I /usr/include/mcpu-elf.h +Public MELF constants/records. +.TP +.I /usr/lib64/pkgconfig/libmcpu.pc +Pkg-config metadata при обычной /usr,/usr/lib64 установке. +.SH СМ. ТАКЖЕ +.BR mcpu-as (1), +.BR mcpu-ld (1), +.BR mcpu-run (1), +.BR mcpu-readelf (1), +.BR mcpu-ar (1), +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR mcpu-strip (1), +.BR mcpu-objcopy (1) diff --git a/man/ru/mcpu-ar.1 b/man/ru/mcpu-ar.1 new file mode 100644 index 0000000..d19db3f --- /dev/null +++ b/man/ru/mcpu-ar.1 @@ -0,0 +1,70 @@ +.TH MCPU-AR 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-ar \- manager deterministic static archives MCPU +.SH СИНТАКСИС +.B mcpu-ar +.RI [ опции ] " операция архив " [ member ...] +.SH ОПИСАНИЕ +.B mcpu-ar +создаёт deterministic UNIX ar archives с MELF ET_REL members. Порядок members +сохраняется. Операция/модификатор s строит System-V/GNU-style symbol index, +который использует +.BR mcpu-ld (1) +при selective extraction. +.SH ОПЕРАЦИИ +.TP +.B r +Заменить existing members на месте или добавить новые. +.TP +.B q +Всегда добавить members без replacement. +.TP +.B d +Удалить named members. +.TP +.B t +Список members. +.TP +.B p +Вывести содержимое member в stdout. +.TP +.B x +Извлечь members в текущий каталог. +.TP +.B s +Перестроить symbol index. +.SH МОДИФИКАТОРЫ +.TP +.B c +Compatibility modifier; создание архива тихое. +.TP +.B s +Записать/rebuild symbol index. +.TP +.B v +Verbose operation. +.PP +Операция и modifiers объединяются: rcs, tv, xv. +.SH ОПЦИИ +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH ПРИМЕРЫ +.nf +mcpu-ar rcs libsimple.a add-one.o add-two.o value.o +mcpu-ar t libsimple.a +mcpu-ar tv libsimple.a +mcpu-ar x libsimple.a add-one.o +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-ld (1), +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-as.1 b/man/ru/mcpu-as.1 new file mode 100644 index 0000000..96d79ed --- /dev/null +++ b/man/ru/mcpu-as.1 @@ -0,0 +1,79 @@ +.TH MCPU-AS 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-as \- ассемблер исходного текста MCPU в перемещаемый объект MELF +.SH СИНТАКСИС +.B mcpu-as +.RI [ опции ] " -o output.o input.s" +.SH ОПИСАНИЕ +.B mcpu-as +читает один исходный файл ассемблера MCPU в UTF-8 и создаёт один перемещаемый +объект MELF +.BR ET_REL . +Отдельного режима compile-only нет: ET_REL является нормальным и единственным +объектным выходом ассемблера. Исходный файл и +.B -o +могут находиться в любом порядке. +.PP +Assembler записывает symbols, sections и relocations, явно заданные исходным +текстом; он не выбирает PROGRAM или MODEL и не синтезирует HLL CRT objects. +Final lifecycle ownership, automatic HLL CRT selection, STACK и HEAP program +headers определяются позднее командой +.BR mcpu-ld (1). +.SH ОПЦИИ +.TP +.BI -o " файл" +Записать объект в указанный файл. Опция обязательна. +.TP +.BR -v ", " --verbose +После успешной сборки вывести краткую сводку о созданном MELF ET_REL object. +По умолчанию успешный запуск ничего не выводит. +.TP +.BR -h ", " --help +Вывести справку и завершиться. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH УПРАВЛЕНИЕ ФЛАГАМИ PSW +Ассемблер принимает явные инструкции управления arithmetic/status flags: +.nf +SETF flag +CLRF flag +CLRCPUF +CLRMPUF +.fi +.PP +.B SETF +и +.B CLRF +принимают именованные флаги AF, CF, OF, SF, PF, ZF, RF, VF, DOMF, SNGF, +OVFF, UDFF, TLSF, PLSF, INDF и INXF, то есть PSW bits 0..15. HF, TF и IF +остаются допустимыми selectors для чтения через условные переходы, но этими +инструкциями не записываются; MODE является многобитовым полем и selector не +имеет. +.B CLRCPUF +очищает PSW[7:0], а +.B CLRMPUF +очищает PSW[15:8]. Обе инструкции сохраняют control/execution state выше bit 15. +.SH УПРАВЛЕНИЕ ИСХОДНОЙ ПОЗИЦИЕЙ +Ассемблер принимает директиву +.B #line +с десятичным номером строки и необязательным именем файла в кавычках. Она +предназначена для вывода препроцессора, меняет последующие позиции диагностик и +не записывается в MELF. +.SH СТАТУС ЗАВЕРШЕНИЯ +Ноль при успехе; ненулевое значение при синтаксической, семантической, I/O или +object-generation ошибке. +.SH ПРИМЕРЫ +.nf +mcpu-as -o main.o main.s +mcpu-as helper.s -o helper.o +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-ld (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-ld.1 b/man/ru/mcpu-ld.1 new file mode 100644 index 0000000..b57cb93 --- /dev/null +++ b/man/ru/mcpu-ld.1 @@ -0,0 +1,170 @@ +.TH MCPU-LD 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-ld \- компоновщик объектов, архивов и shared libraries MCPU +.SH СИНТАКСИС +.B mcpu-ld +.RI [ опции-компоновки ] " -o output input ..." +.SH ОПИСАНИЕ +.B mcpu-ld +компонует MELF ET_REL objects и статические библиотеки MCPU. Он создаёт partial +ET_REL, полностью статический ABI-v1 ET_EXEC, frozen ABI-v3 startup-dynamic +ET_EXEC или ABI-v3 ET_DYN shared object. +.PP +Без +.BR -r , +.B --shared +и +.B --dynamic +по умолчанию создаётся статический ABI-v1 ET_EXEC. +.SH РЕЖИМЫ ВЫХОДА +.TP +.B -r +Создать один partial-link MELF ET_REL. Неразрешённые strong symbols и RELA +могут остаться для последующей final link. STACK, HEAP, SONAME и shared objects +к этому режиму не относятся. +.TP +.B --shared +Создать frozen ABI-v3 MELF ET_DYN. Обязателен логический +.BR --soname . +Shared object может иметь только allocated .text/.data/.bss и не владеет +lifecycle, model spaces, STACK или HEAP. +.TP +.B --dynamic +Создать frozen ABI-v3 startup-dynamic MELF ET_EXEC. Normal dependencies +записываются как DT_NEEDED SONAME. +.SH AUTOMATIC HLL CRT +Для final static/dynamic ET_EXEC output mcpu-ld сначала анализирует явно +перечисленные входные ET_REL objects и только затем обрабатывает -l libraries. +Распознаются две compiler-normalized complete-program формы: +.nf +PROGRAM: strong GLOBAL/FUNC main + fini в одном ET_REL +MODEL: strong GLOBAL/FUNC init + life + fini в одном ET_REL +.fi +.PP +PROGRAM и MODEL roots взаимоисключающие. Incomplete или split MODEL definitions +отклоняются; PROGRAM main/fini также должны принадлежать одному defining ET_REL. +Смешивание HLL roots с низкоуровневым владением _start/_life является ошибкой. +Library members и shared-library definitions не участвуют в классификации +complete program. +.PP +После классификации mcpu-ld автоматически вставляет: +.nf +PROGRAM: crt0.o crti.o <explicit input objects> crtn.o +MODEL: crt1.o crti.o <explicit input objects> crtn.o +.fi +CRT objects загружаются из <MCPU-root>/lib/mcpu, где <MCPU-root> — активный +installation/system root. Отсутствующий или нечитаемый обязательный CRT object +является fatal error. Поиска fallback CRT в другом root и перехода HLL link в +low-level linking нет. +.PP +Low-level ET_EXEC inputs, самостоятельно владеющие _start/_life, компонуются без +HLL CRT insertion. Режимы -r и --shared не выполняют HLL complete-program +classification или CRT insertion. +.SH SYSTEM ROOT И CONFIGURATION +.TP +.B --no-config +Не читать mcpu-ld.conf; executable-derived runtime root и его default lib +остаются активными. +.TP +.BI --sys-root= ПУТЬ +Использовать ПУТЬ как MCPU system root, не читать configuration files и взять +ПУТЬ/lib как системный каталог библиотек. Относительный путь разрешается от +рабочего каталога запуска. +.TP +.BI --sys-root " ПУТЬ" +Эквивалентная двухаргументная форма. +.TP +.B --dump-config +Вывести effective MCPU configuration и завершиться. +.TP +.B --print-search-dirs +Вывести effective library search directories в порядке поиска и завершиться. +.SH БИБЛИОТЕКИ +.TP +.BI -L " каталог" +.TQ +.BI -L каталог +Добавить явный каталог поиска. -L каталоги идут раньше configured system path. +.TP +.BI -l " имя" +.TQ +.BI -l имя +Искать libИМЯ. ABI-v1 и -r рассматривают только libИМЯ.a; ABI-v3 dynamic/shared +в каждом каталоге сначала рассматривает libИМЯ.so, затем libИМЯ.a. +.TP +.B --static +Принудить все -l искать только libИМЯ.a, не меняя выбранный output mode. +Архивные members встраиваются статически и не создают DT_NEEDED. +.SH SHARED-LIBRARY IDENTITY +.TP +.BI --soname= ИМЯ +.TQ +.BI --soname " ИМЯ" +Установить обязательный SONAME ABI-v3 ET_DYN. Логическое ИМЯ не должно содержать '/'. +.SH ПАРАМЕТРЫ EXECUTABLE +.TP +.BI -o " файл" +Записать результат в файл. +.TP +.BI --stack-size= размер +Фиксированный размер STACK; положительный и кратный 16. Default 1048576. +.TP +.BI --heap-size= размер +Начальный HEAP. Default 1048576. +.TP +.BI --heap-limit= размер +Неизменяемый maximum HEAP. Default 1048576. +.TP +.B --no-heap +Не создавать PT_MCPU_HEAP. +.TP +.BR -v ", " --verbose +После успешной компоновки вывести краткую сводку о созданном MELF object. +По умолчанию успешный запуск ничего не выводит. +.TP +.BR -h ", " --help +Вывести справку. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.PP +Размер по умолчанию задаётся в байтах. Поддерживаются K/KiB, M/MiB, G/GiB; +K, M, G используют двоичные множители. +.SH АРХИВЫ И SYMBOL RESOLUTION +Статические библиотеки MCPU — обычные deterministic UNIX ar containers с MELF +ET_REL members. Member извлекается, когда он удовлетворяет текущему +неразрешённому strong GLOBAL symbol. Один unresolved WEAK сам по себе member не +вытягивает. +.SH ФАЙЛЫ +.TP +.I <runtime-root>/lib/mcpu/crt0.o, crt1.o, crti.o, crtn.o +Обязательные automatic HLL CRT objects для final PROGRAM/MODEL executable link. +.TP +.I <runtime-root>/etc/mcpu-ld.conf +Configuration из переносимого дерева MCPU. +.TP +.I /etc/mcpu/mcpu-ld.conf +Необязательный machine-wide override. +.TP +.I $HOME/.mcpu/etc/mcpu-ld.conf +Необязательный user override. +.SH СТАТУС ЗАВЕРШЕНИЯ +Ноль при успехе; ненулевое значение при ошибке опций, validation, symbol +resolution, relocation или записи результата. +.SH ПРИМЕРЫ +.nf +mcpu-ld --stack-size=64K --no-heap -o program main.o helper.o +mcpu-ld -r -o combined.o a.o b.o +mcpu-ld --shared --soname=libfoo.so.1 -o libfoo.so.1.0.0 foo.o +mcpu-ld --dynamic -L ./lib -lfoo -o program main.o +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-as (1), +.BR mcpu-ar (1), +.BR mcpu-run (1), +.BR mcpu-readelf (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-nm.1 b/man/ru/mcpu-nm.1 new file mode 100644 index 0000000..b58db53 --- /dev/null +++ b/man/ru/mcpu-nm.1 @@ -0,0 +1,59 @@ +.TH MCPU-NM 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-nm \- вывод символов MELF-файлов и архивов MCPU +.SH СИНТАКСИС +.B mcpu-nm +.RI [ опции ] " MELF-файл(ы)" +.SH ОПИСАНИЕ +.B mcpu-nm +показывает symbols из ET_REL, ET_EXEC, ET_DYN и deterministic MCPU archives. +По умолчанию читается .symtab и сортировка идёт по имени; для runtime symbols +используется +.BR -D . +.SH ОПЦИИ +.TP +.BR -a ", " --debug-syms +Все named symbols, включая FILE/SECTION. +.TP +.BR -g ", " --extern-only +Только external GLOBAL/WEAK. +.TP +.BR -u ", " --undefined-only +Только undefined symbols. +.TP +.BR -n ", " --numeric-sort +Сортировка по value. +.TP +.BR -r ", " --reverse-sort +Обратный выбранный порядок. +.TP +.BR -p ", " --no-sort +Порядок symbol table. +.TP +.BR -D ", " --dynamic +Использовать .dynsym вместо .symtab. +.TP +.BR -A ", " --print-file-name +Префиксовать каждую строку именем input; для archive указывается archive/member. +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH ПРИМЕРЫ +.nf +mcpu-nm file.o +mcpu-nm -n file.o +mcpu-nm -D libfoo.so.1 +mcpu-nm -A -D -g libfoo.so.1 +mcpu-nm -A libsimple.a +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-objcopy.1 b/man/ru/mcpu-objcopy.1 new file mode 100644 index 0000000..204aa9e --- /dev/null +++ b/man/ru/mcpu-objcopy.1 @@ -0,0 +1,71 @@ +.TH MCPU-OBJCOPY 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-objcopy \- безопасное копирование и редактирование metadata MELF +.SH СИНТАКСИС +.B mcpu-objcopy +.RI [ опции ] " INPUT OUTPUT" +.SH ОПИСАНИЕ +.B mcpu-objcopy +— MELF-to-MELF structural copier/editor. Это намеренно не ROM-image converter: +нет flat binary, Intel HEX, S-record, VMA/LMA, start-address или section-flags +conversion modes. +.PP +Editor защищает frozen MELF ABI v3: runtime-visible allocated sections, +dynamic-link metadata, runtime relocations и MCPU target/lifecycle data нельзя +удалять, переименовывать или изменять safe metadata interface. +.SH ОПЦИИ +.TP +.BI -j " ИМЯ" +.TQ +.BI --only-section= ИМЯ +Копировать только указанные sections; repeatable. Операция отклоняется, если +фильтрация выбрасывает runtime, dynamic или ET_REL link-critical data. +.TP +.BI -R " ИМЯ" +.TQ +.BI --remove-section= ИМЯ +Удалить safe non-runtime section. +.TP +.BI --dump-section= ИМЯ=ФАЙЛ +Записать contents section в ФАЙЛ. Для archive input отклоняется как +неоднозначная операция. +.TP +.BI --add-section= ИМЯ=ФАЙЛ +Добавить non-ALLOC SHT_PROGBITS metadata из ФАЙЛ. Reserved runtime names +запрещены. +.TP +.BI --update-section= ИМЯ=ФАЙЛ +Заменить contents safe non-ALLOC SHT_PROGBITS section. +.TP +.BI --rename-section= СТАРОЕ=НОВОЕ +Переименовать safe non-ALLOC section; reserved runtime names защищены. +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH STRUCTURAL INVARIANTS +Metadata-only edits перестраивают .shstrtab и remap section references, +включая st_shndx сохраняемых symbols, но не изменяют allocated image и program +headers. Non-ALLOC metadata tail может быть repacked. +.SH АРХИВЫ +Deterministic MCPU archives преобразуются member-by-member с сохранением +archive symbol-index semantics. +.SH ПРИМЕРЫ +.nf +mcpu-objcopy input.o output.o +mcpu-objcopy --add-section=.note.build=build.txt input.o output.o +mcpu-objcopy --update-section=.note.build=new.txt input.o output.o +mcpu-objcopy --rename-section=.note.build=.note.release input.o output.o +mcpu-objcopy -R .note.release input.o output.o +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-strip (1), +.BR mcpu-objdump (1), +.BR mcpu-readelf (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-objdump.1 b/man/ru/mcpu-objdump.1 new file mode 100644 index 0000000..ec2dcd4 --- /dev/null +++ b/man/ru/mcpu-objdump.1 @@ -0,0 +1,66 @@ +.TH MCPU-OBJDUMP 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-objdump \- секции, relocations и дизассемблирование инструкций MCPU +.SH СИНТАКСИС +.B mcpu-objdump +.RI [ опции ] " MELF-файл(ы)" +.SH ОПИСАНИЕ +.B mcpu-objdump +просматривает MELF objects, executables, shared objects и deterministic +archives. Дизассемблер использует тот же LibMCPU instruction decoder, что и +runtime, а symbol/relocation information применяется для аннотаций без +подмены raw operand bytes. +.SH ОПЦИИ +.TP +.BR -d ", " --disassemble +Дизассемблировать executable PROGBITS sections. +.TP +.BR -D ", " --disassemble-all +Пытаться дизассемблировать все выбранные nonempty PROGBITS. +.TP +.BR -r ", " --reloc +Показать relocations; при disassembly relocation привязывается к инструкции, +содержащей поле relocation. +.TP +.BR -s ", " --full-contents +Raw contents sections. +.TP +.BR -t ", " --syms +.symtab symbols. +.TP +.BR -T ", " --dynamic-syms +.dynsym symbols. +.TP +.BR -h ", " --section-headers +Section headers. +.TP +.BI -j " ИМЯ" +.TQ +.BI --section= ИМЯ +Ограничить section-oriented output; repeatable. +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.PP +Нужна хотя бы одна display option. Нераспознаваемые bytes печатаются как +.byte, после чего просмотр продолжается. +.SH ПРИМЕРЫ +.nf +mcpu-objdump -h file.o +mcpu-objdump -t -r -d file.o +mcpu-objdump -T -d -r libfoo.so.1 +mcpu-objdump -s -j .data file.o +mcpu-objdump -d libsimple.a +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-readelf (1), +.BR mcpu-nm (1), +.BR mcpu-objcopy (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-readelf.1 b/man/ru/mcpu-readelf.1 new file mode 100644 index 0000000..2c6d1ae --- /dev/null +++ b/man/ru/mcpu-readelf.1 @@ -0,0 +1,76 @@ +.TH MCPU-READELF 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-readelf \- структурный просмотр MELF-файлов MCPU +.SH СИНТАКСИС +.B mcpu-readelf +.RI "опции MELF-файл(ы)" +.SH ОПИСАНИЕ +.B mcpu-readelf +— read-only inspector для MELF ABI v1/v2/v3. Показывает headers, sections, +symbols, RELA, dynamic dependency metadata и MCPU target/lifecycle records, не +изменяя входные файлы. +.SH ОПЦИИ +.TP +.BR -a ", " --all +Эквивалент -h -l -S -s -r -d -A. +.TP +.BR -e ", " --headers +Эквивалент -h -l -S. +.TP +.BR -h ", " --file-header +Показать MELF file header. +.TP +.BR -l ", " --program-headers +Показать program headers. +.TP +.B --segments +Alias для --program-headers. +.TP +.BR -S ", " --section-headers +Показать section headers. +.TP +.B --sections +Alias для --section-headers. +.TP +.BR -s ", " --symbols +Показать .symtab/.dynsym. +.TP +.B --syms +Alias для --symbols. +.TP +.BR -r ", " --relocs +Показать RELA sections. +.TP +.BR -d ", " --dynamic +Показать ABI-v3 .dynamic, включая SONAME/NEEDED. +.TP +.BR -A ", " --arch-specific +Показать MCPU target/lifecycle metadata. +.TP +.BR -W ", " --wide +Не усекать вывод; compatibility option. +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH СТАТУС ЗАВЕРШЕНИЯ +Ноль при успешном чтении всех файлов; ненулевое значение при malformed, +unsupported или недоступном input. +.SH ПРИМЕРЫ +.nf +mcpu-readelf -h -S file.o +mcpu-readelf -s -r file.o +mcpu-readelf -l -A program +mcpu-readelf -d libfoo.so.1 +mcpu-readelf -a program +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-nm (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-run.1 b/man/ru/mcpu-run.1 new file mode 100644 index 0000000..9701dcf --- /dev/null +++ b/man/ru/mcpu-run.1 @@ -0,0 +1,199 @@ +.TH MCPU-RUN 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-run \- загрузчик, runtime и supervisor исполнения MCPU +.SH СИНТАКСИС +.B mcpu-run +.RI [ runtime-options ] " -- executable " [ program-args ...] +.br +.B mcpu-run +.RI [ runtime-options ] " executable " [ program-args ...] +.SH ОПИСАНИЕ +.B mcpu-run +— loader, startup linker, execution supervisor и host-side test bench для MELF +ET_EXEC. Предпочтительна форма с явным разделителем +.BR -- . +Размеры STACK и HEAP являются частью executable ABI и не переопределяются +runner-ом. +.PP +Поддерживаются статический ABI v1, исторический explicit-preload ABI v2 и +frozen ABI v3. Discovery зависимостей, symbol selection и runtime relocation +завершаются до первой guest instruction. +.SH HLL STARTUP И LIFECYCLE +HLL PROGRAM или MODEL executable всё равно входит через обычный MELF +_start/_life/_fini lifecycle, предоставленный linked CRT. mcpu-run не вызывает +main, init, life или fini напрямую. +.PP +Перед _start loader один раз создаёт в STACK постоянную область McpuStartup v1 +с version, size, argc, PTR64 argv и reserved zero field. Массив argv и строки +аргументов остаются действительными весь executable lifetime. HLL CRT проверяет +это состояние и переводит его в обычный CALL ABI. +.PP +PROGRAM выполняет HLL main один раз и завершает работу с возвращённым int32 +status. MODEL выполняет INIT через init(), затем вызывает life() один раз на +каждой lifecycle iteration. INT32_MIN означает продолжение через одну LIFE END +boundary; zero — нормальное завершение; positive value — error exit status. +Остальные отрицательные результаты life зарезервированы HLL Runtime ABI v1. +.PP +Graceful HLL exit вызывает user fini(), __mcpu_fini_array() и +__mcpu_libc_fini() перед финальным FINI END. Startup failure до перехода CRT в +RUNNING пропускает эти finalizers. Diagnostic stop по --steps остаётся +supervisor stop и не синтезирует graceful HLL finalization. +.SH SYSTEM OPTIONS +.TP +.B --no-config +Не читать mcpu-ld.conf, сохраняя executable-derived default system library tree. +.TP +.BI --sys-root= ПУТЬ +Использовать ПУТЬ как MCPU root, не читать config и использовать ПУТЬ/lib. +.TP +.B --dump-config +Вывести effective configuration и завершиться. +.TP +.B --print-search-dirs +Вывести search directories и завершиться. +.SH LIBRARY OPTIONS +Эти опции должны находиться перед executable или явным --. +.TP +.BI --library-path= КАТАЛОГ[:КАТАЛОГ...] +Добавить явные каталоги поиска. Опция повторяемая; эти каталоги предшествуют +system library path. +.TP +.BI --ldpreload= a.so:b.so +Предзагрузить ABI-v2/ABI-v3 shared objects. Имя без '/' ищется по search path; +имя с '/' считается явным pathname. +.SH ОКРУЖЕНИЕ +.TP +.B MCPU_LD_PRELOAD +Colon-separated preload list, применяемый раньше command-line --ldpreload. При +равной силе определения действует rightmost priority, поэтому command-line +preload может переопределить environment preload. +.SH INSPECTION ПОСЛЕ ОСТАНОВА +.TP +.BI --int-reg= r<bits>@<addr> +Вывести signed integer register. +.TP +.BI --real-reg= r<bits>@<addr> +Вывести real register. +.TP +.BI --int-data= <bits>@<addr> +.TQ +.BI --real-data= <bits>@<addr> +.TQ +.BI --raw-data= <bytes>@<addr> +Inspection DATA. +.TP +.BI --int-control= <bits>@<addr> +.TQ +.BI --real-control= <bits>@<addr> +.TQ +.BI --raw-control= <bytes>@<addr> +Inspection CONTROL. +.TP +.BI --int-heap= <bits>@<addr> +.TQ +.BI --real-heap= <bits>@<addr> +.TQ +.BI --raw-heap= <bytes>@<addr> +Inspection HEAP. +.TP +.BI --int-input= <bits>@<addr> +.TQ +.BI --real-input= <bits>@<addr> +.TQ +.BI --raw-input= <bytes>@<addr> +Inspection INPUT. +.TP +.BI --int-output= <bits>@<addr> +.TQ +.BI --real-output= <bits>@<addr> +.TQ +.BI --raw-output= <bytes>@<addr> +Inspection OUTPUT. +.TP +.BI --int-trace= <bits>@<addr> +.TQ +.BI --real-trace= <bits>@<addr> +.TQ +.BI --raw-trace= <bytes>@<addr> +Inspection TRACE. +.SH LIFECYCLE CONTROL +.TP +.BI --digits= n +Mantissa digits для real output; default 80. +.TP +.B --init-only +Выполнить INIT до END и остановиться. +.TP +.BI --steps= n +Остановиться после n LIFE END boundaries. +.TP +.BR -h ", " --help +Вывести справку. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH STAGE ACTIONS +Повторяемые stage options выполняют host actions на lifecycle boundaries: +.TP +.BI --before-run= action +После load/startup-link/relocations/startup area, до первой guest instruction. +.TP +.BI --after-init= action +После INIT END или один раз на logical empty INIT boundary без .init. +.TP +.BI --on-step= action +После каждого LIFE END. +.TP +.BI --after-run= action +После final normal stop; graceful FINI уже завершён. +.PP +Формы actions: +.nf +print-int-regs:r<bits>@<addr>[,...] +print-real-regs:r<bits>@<addr>[,...] +set-int-regs:r<bits>@<addr>=<value>[,...] +set-real-regs:r<bits>@<addr>=<value>[,...] +print-int-<memory>:<bits>@<addr>[,...] +print-real-<memory>:<bits>@<addr>[,...] +set-int-<memory>:<bits>@<addr>=<value>[,...] +set-real-<memory>:<bits>@<addr>=<value>[,...] +print-raw-<memory>:<bytes>@<addr> +.fi +.PP +memory = data, control, heap, input, output или trace. Scalar print выводит +comma-list одной строкой. Raw action содержит ровно один dump; для нескольких +нужно повторить stage option. set-raw-* отсутствуют. Set values разбираются +LibMPUIO mpu_sscanf(). Step-number filters не реализованы. +.SH LIFECYCLE И EXIT +END возвращает управление supervisor-у на INIT/LIFE/FINI boundaries. Graceful +EXIT может запустить optional FINI. Diagnostic stop по --steps не синтезирует +EXIT и сам по себе FINI не запускает. +.SH ФАЙЛЫ +.TP +.I <runtime-root>/etc/mcpu-ld.conf +Installed relocatable-tree configuration. +.TP +.I /etc/mcpu/mcpu-ld.conf +Machine-wide override. +.TP +.I $HOME/.mcpu/etc/mcpu-ld.conf +User override. +.SH СТАТУС ЗАВЕРШЕНИЯ +При нормальном завершении возвращается guest exit status. Loader/startup-linker, +option и runtime errors дают ненулевой host-side status. +.SH ПРИМЕРЫ +.nf +mcpu-run -- program arg1 arg2 +mcpu-run --library-path=./lib -- program +MCPU_LD_PRELOAD=libhook.so mcpu-run -- program +mcpu-run --steps=20 --on-step=print-real-trace:128@0,128@16 -- pendulum +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-ld (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) diff --git a/man/ru/mcpu-strip.1 b/man/ru/mcpu-strip.1 new file mode 100644 index 0000000..3e437ff --- /dev/null +++ b/man/ru/mcpu-strip.1 @@ -0,0 +1,53 @@ +.TH MCPU-STRIP 1 "Октябрь 2026" "LibMCPU" "Команды пользователя" + +.SH ИМЯ +mcpu-strip \- безопасное удаление non-runtime symbol metadata из MELF +.SH СИНТАКСИС +.B mcpu-strip +.RI [ опции ] " MELF-файл" +.SH ОПИСАНИЕ +.B mcpu-strip +намеренно консервативен. Он удаляет ordinary non-ALLOC SHT_SYMTAB из +ET_EXEC/ET_DYN только когда ни одна сохраняемая section от него не зависит, и +удаляет связанную ordinary string table только когда она становится +unreferenced. +.PP +ET_REL symbol tables сохраняются как часть последующей link semantics. +.dynsym/.dynstr/.dynamic, RELA, MCPU target/lifecycle metadata, allocated/model +sections и program headers всегда сохраняются. Современные final-image writers +LibMCPU уже компактны, поэтому нормальный ET_EXEC/ET_DYN часто остаётся +byte-for-byte неизменным. +.SH ОПЦИИ +.TP +.BI -o " файл" +.TQ +.BI --output= ФАЙЛ +Записать отдельный результат вместо in-place replacement. +.TP +.B --help +Справка. +.TP +.B --version +Вывести имя программы, идентификатор инструментария MCPU и версию, затем завершить работу. +.TP +.B --dump-version +Вывести только номер версии пакета MCPU и завершить работу. +.SH IN-PLACE SAFETY +In-place replacement выполняется через temporary file в том же каталоге и +rename с сохранением mode исходного файла. Allocated image и program headers не +перепаковываются safe metadata policy. +.SH АРХИВЫ +MCPU archives обрабатываются member-by-member; link-critical ET_REL symbols +сохраняются. +.SH ПРИМЕРЫ +.nf +mcpu-strip program +mcpu-strip -o program.stripped program +mcpu-strip libfoo.so.1 +mcpu-strip libsimple.a +.fi +.SH СМ. ТАКЖЕ +.BR mcpu-objcopy (1), +.BR mcpu-readelf (1), +.BR mcpu-objdump (1), +.BR libmcpu (7) |
