Repository navigation
Tags
Tags
GNU as syntax: C++ without exceptions (#164) Forms found by assembling g++ output (two XML libraries and a test program with templates, virtual functions, global constructors and inline variables across two translation units) at -O0, -O2 and -Os for 68000 to 68060 and comparing with GNU as + ld. - COMDAT groups (`.section name,"axG",@progbits,sig,comdat`): of each group the first file's sections are kept and later copies are dropped, as ld does. Before, every copy of a template or inline function was stored. A section name in another group is another section. - `.init_array`, `.fini_array` and their `.N` priority forms: placed after the read-only data, sorted by priority with the plain section last (SORT_BY_INIT_PRIORITY). The link defines `__init_array_start`/ `_end` and `__fini_array_start`/`_end`; each array starts at the largest alignment of its sections, so the start symbol never points at padding. They precede the data sections, so `.reloc_table` still ends the image. `--sym` lists the bounds only when an array exists. - String merging for 2- and 4-byte characters (`"aMS",@progbits,2/4`, wchar_t and char16_t literals), with tail sharing as for 1-byte strings. - A `.word a-b` in a dropped COMDAT copy followed by a label in another section indexed the emptied section and panicked. Reference script: the arrays are output sections of their own and the data section is placed at `.` exactly, so its alignment is unchanged; `.eh_frame`, which m68k-asm does not build from `.cfi_*`, is discarded; relocations against an undefined weak symbol are not fixups, since that pointer stays 0. New fixture `cxx`: groups, priorities, wide strings with shared tails, an undefined weak symbol, an array after odd-sized read-only data. Co-authored-by: Attackwave <attackwave@users.noreply.github.com>
Release 2.10.0 (#163) * GNU as syntax: weak symbols, aliases, broken words, CAS Forms found by assembling a C library's math code and a 250 000-line C program at -O0 to -O3 for 68000 to 68060 and comparing with GNU as + ld. - Switch tables beyond 32 KB: a `.word a-b` that does not fit 16 bits was stored as 0x8000..0xFFFF, which `move.w tab(%pc,%dn),%an; jmp (2,%pc,%an.w)` reads as negative, so those cases jumped to the wrong place. As GNU as does ("broken words"), the first label after such words now gets a `bra.w` over one long jump per overflowing target (`bra.l` from the 68020, `jmp` absolute with a fixup before), and each overflowing word holds the distance to its jump. Words with the same target share it; the order follows GNU as. - `.weak`: global; a definition that is not weak replaces it, and a weak symbol nothing defines is 0. `jbsr`/`jra` to such a number becomes `jsr`/`jmp` absolute from the 68020 on as well, the same length as `bsr.l`, which would not survive relocation. - `.set`, `.equ` and `name = expr` define a symbol as an expression, as libc aliases (weak_alias) and constants use them. A local alias of a label in the same section relaxes like the label: GCC's -fipa-icf makes identical functions such aliases. Sizing resolves aliases, so a constant keeps its value; a cycle is an error. - `mov` is read as `move`, as GNU as does; GCC 15 writes it. - A bitfield width of 0 means 32, as GNU as reads it (`bfffo %d0{#0:#0}`). - CAS with its three operands. - The probe encoding that finds fixups moves the image by a multiple of the coarsest alignment: `.p2align 15` gave the two encodings different lengths and an out-of-bounds read. The remaining differences on that code base are branches GNU as makes larger than needed (`beq.w` where `beq.s` reaches). Which ones depends on how GNU as splits its fragment memory, not on the code; with those branch sizes given explicitly, every image is identical. Tests: GNU as + ld fixture sets alias (68020), wordjump (68000, jumps with fixups) and wordjump020 (68020); bitfield width 0 and CAS in edge; weak resolution, alias cycles and the alignment case in gas_syntax.rs. gnu_reference.py skips undefined symbols in nm output. * Release 2.10.0 Bump the workspace to 2.10.0. --------- Co-authored-by: Attackwave <attackwave@users.noreply.github.com>
Release 2.9.1 (#162) * Fuzz the GNU as syntax mode New target gas_syntax feeds arbitrary text to gas::assemble for a CPU chosen by the first byte; NUL bytes split the rest into up to four files, so cross-file symbols and far branches are reached. Added to the per-PR fuzz matrix. * GNU as syntax: fix silently wrong code, overflows and unbounded memory Wrong code without an error: - An index register without a size is long, as in GNU as; it was encoded as a word index. - A displacement was taken as 0 when the abstract places of its labels summed to 0 (`(a-b+c-b)(%a0)`); now only when they cancel. - A numeric `d(%pc)` behind a leading extension word (MULU.L, DIVS.L, FPU, bitfield, CHK2/CMP2) was 2 bytes short; the displacement is now measured from the word that holds it. - A byte branch displacement of -1 ($FF, the 32-bit form on a 68020) is refused, and relaxation no longer picks it. - MOVEM/FMOVEM register masks wider than 16/8 bits are refused instead of truncated. - `.comm` of a name the same file defines as a global label is an error. - Adjacent string literals are joined (`.ascii "ab" "cd"`); text between them is an error. - `>>` shifts the value as unsigned and a shift count outside 0..63 is an error, as in GNU as. - `.previous`, `.pushsection` and `.popsection` inside a dropped debug section are refused instead of skipped with everything after them; `.globl`, `.local` and `.comm` there still count, and numeric labels there are counted for `1b`/`1f`. - Register numbers are one digit (`%d01`, `%d+1` refused). Crashes and unbounded resources: - Section offsets saturate and the layout is computed in 64 bits: an image over 16 MiB or a program ending beyond 4 GiB is an error, where the arithmetic panicked or wrapped. The limit is checked before strings are merged and before the image is allocated; non-zero `.skip` fill is limited the same way while parsing. - Expression evaluation uses checked arithmetic, and an expression holds at most 256 operators, which bounds the recursion of parsing, evaluation and drop. A bitfield operand may not nest. - The relaxation limit grows with the number of relaxable items: a chain where each branch only grows after the next one needs one round per branch. Tests: fixture set tests/gas/fixtures/edge (68030, GNU as + ld reference) for the corrected encodings; hostile inputs and a 1100-step branch chain in gas_syntax.rs. * Release 2.9.1 Bump the workspace to 2.9.1. * GNU as syntax: keep encoded addresses away from 4 GiB Relaxation encodes instructions at their section offsets, which saturated at 4 GiB behind a huge `.zero`, and the encoder adds to the PC: the image size is now checked before relaxation as well. A program must end 256 bytes below 4 GiB, and the second encoding that finds the fixups moves the image down where moving it up would pass that. --------- Co-authored-by: Attackwave <attackwave@users.noreply.github.com>
Release 2.9.0 (#161) * FPU: one table for the 68040 rounding-precision forms, FTST without destination The FSxxx/FDxxx opmodes were listed twice, in the encoder and in the decoder, and both lacked FSABS, FDABS, FSNEG and FDNEG (0x58, 0x5C, 0x5A, 0x5E). The table now lives in m68k-core next to the arithmetic one, with the four added. These forms exist on the 68040 and 68060 only and are gated so; the 68881/68882 have no such opmodes. FTST has no destination register: FTST FPn now leaves the field 0 (f200 0c3a for FP3, not 0dba), FTST <ea> without an FPn is accepted, and the decoder no longer prints a destination of 0 for it. * GNU as syntax: FPU instructions --syntax gas refused FPU code; GCC emits it for -m68020 and later unless -msoft-float is given. Now read as GNU as does: - %fp0-%fp7, %fpcr/%fpsr/%fpiar and lists of either; - .s/.d/.x/.p sizes; floating-point immediates as the bit patterns GCC writes (#0x..., up to 96 bits for .x); - fmovem with a register list or, as for movem, a mask as encoded; - fjXX relaxes from a word to a 32-bit fbcc (32-bit to another file); fbXX stays a word branch, and out of reach is an error where GNU as truncates the displacement. The fixture set fpu (68040) holds the GNU as + ld reference. * Release 2.9.0 Bump the workspace to 2.9.0. --------- Co-authored-by: Attackwave <attackwave@users.noreply.github.com>
Release 2.8.0 (#160) * GNU as syntax for the 68020 to 68060 --syntax gas accepted --cpu 68000 and 68010 only. From the 68020 on it now follows GNU as: - jbsr/jra/jXX to another file or beyond the word range become 32-bit branches (bsr.l, bra.l, bcc.l); a DBcc out of reach skips over a bra.l. bra.l/bsr.l/bcc.l may be written. - Index and d16 displacements that do not fit, and addresses in them, use the full-format extension word; (bd,%dn.l*4) without a base register is read. - %dh:%dl register pairs and ea{offset:width} bitfield operands. - muls.l/mulu.l with a 32-bit product leave the unused Dh field 0. An unknown CPU name is refused. The fixture set m68020 holds the GNU as + ld reference; fixture sets may name their CPU in cpu.txt, and parity.py/gnu_reference.py take M68K_CPU. * Release 2.8.0 Bump the workspace to 2.8.0. * GNU as syntax: --sym and --map for the linked image --sym writes the program's symbols at their addresses in the image, in the format of the Motorola mode: labels other than GCC's .L labels, commons and __image_end/__bss_start/__bss_end. A file-local symbol whose name occurs more than once is written file:name. --map lists every non-empty input section with its place in the image, the global commons as one block, and the image and BSS bounds. GasImage carries both lists (symbols, sections). --------- Co-authored-by: Attackwave <attackwave@users.noreply.github.com>
PreviousNext