Doing it the naive way with first getting a mutable reference to the
section/symbol, then writing the result of section_flags/symbol_flags to
replace SectionFlags::None and SymbolFlags::None and then mutating the
flags as needed isn't allowed by the borrow checker. Instead you have to
do a dance with getting the section/symbol as immutable, then calling
section_flags/symbol_flags and then getting it as mutable and writing
the flags you got. Adding helper methods to object saves users the time
to figure this all out for themselves.
Includes writing the associated default symbol for the auxiliary weak
external tag index in `write::Object`, and support for writing out COFF
auxiliary weak external symbols in `write::coff::Writer`.
- The delta offset and flags combined may be larger than u64,
so handle the first byte separately.
- Use wrapping arithmetic.
- Change `Crel::r_sym` and `Crel::r_type` to u32.
- Add `Crel::symbol()`.
- Fuse `CrelIterator` on error.
- Replace `ElfRelaIterator` with `ElfRelocationIterator` which returns
`Crel`. This avoid the need to byteswap the `Crel`, and thus avoids
the use of `Endian::default` (which may not match the file).
- Add test outputs.
The format was suggested here:
https://groups.google.com/g/generic-abi/c/ppkaxtLb0P0/m/awgqZ_1CBAAJ
and become part of the LLVM toolchain since release 19, and it's
used by default in the Chromium build system. Recently, the Mold
linker added support for the format as well.