docs(asm): correct the reference against the assemblers' behaviour

Assisted-by: GLM 5.3
This commit is contained in:
2026-10-02 00:40:54 +02:00
parent 42bc1669d7
commit fefb76beb9
+12 -8
View File
@@ -34,9 +34,9 @@ TEXT symbol(SB), [flags,] $framesize[-argsize]
(0x80000000 in the object, the value of `ArgsSizeUnknown` from
`funcdata.h`); a frame size may be negative only in the generated ABI
wrappers.
- A function whose last instruction is not a branch cannot fall through into
the next TEXT: the toolchain appends a jump to itself, so end functions
with `RET` deliberately.
- A function whose last instruction is not a branch falls through into
whatever follows: nothing is appended, the next TEXT's code simply
continues the stream, so end functions with `RET` deliberately.
- One TEXT per symbol; redeclaring is an error. The TEXT line also fixes the
function's source line for traceback: it is the line number that pcln
reports for the function's start.
@@ -59,7 +59,7 @@ Values from `textflag.h`, in agreement with `cmd/internal/obj/textflag.go`:
| WRAPPER | 32 | TEXT | a wrapper; must not disable `recover` |
| NEEDCTXT | 64 | TEXT | a closure consuming the context register |
| TLSBSS | 256 | data | a thread local word in BSS |
| NOFRAME | 512 | TEXT | no frame setup; only valid with a frame size of 0 |
| NOFRAME | 512 | TEXT | no frame setup; the zero-frame spelling (the toolchain accepts a positive frame beside it and still allocates the frame, and the arm64 BSD syscall stubs pair it with $-8 deliberately) |
| REFLECTMETHOD | 1024 | TEXT | the function calls `reflect.Type.Method` or `MethodByName` |
| TOPFRAME | 2048 | TEXT | the outermost frame; unwinders stop here |
| ABIWRAPPER | 4096 | TEXT | an ABI transition wrapper |
@@ -89,11 +89,15 @@ GLOBL ·msg(SB), RODATA, $14
DATA symbol+offset(SB)/width, value
```
- `width` is exactly 1, 2, 4 or 8: the initialiser is written into the data
image at `symbol+offset` in that many bytes.
- `width` is bound by the value it carries: exactly 1, 2, 4 or 8 for an
integer (the assembler rejects any other), 4 or 8 for a float, and any
width for a string. The initialiser is written into the data image at
`symbol+offset` in that many bytes.
- The value is an integer or character constant of the width, or a string
literal whose byte length equals the width exactly; escapes count. Long
data is written as successive DATA lines at increasing offsets; bytes the
literal whose bytes fit the width: a shorter literal is zero-padded, a
longer one is rejected; escapes count. An integer wider than the field is
silently truncated to the low bytes by both assemblers. Long data is
written as successive DATA lines at increasing offsets; bytes the
directives never name are zero.
- Every symbol initialised with DATA ends with a GLOBL line declaring its
total size, after all of its DATA lines.