Commit Graph

1174 Commits

Author SHA1 Message Date
Luke Street 3ceabdf081 Rework internal symbol layout; support local records 2026-06-11 10:16:02 -06:00
Luke Street cbfb7e2b15 Remove WKEXT handling and handle ABS symbols 2026-06-11 10:16:02 -06:00
Luke Street ba4f5d6cb0 Initial read support for OMF 2026-06-11 10:16:02 -06:00
Philip Craig 57716c0d83 write/elf: Encoder address size cleanups (#917)
Change Encoder::address_size to u64 to avoid conversions in
callers, and remove unneeded Encoder::address_align.
2026-06-08 19:02:15 +10:00
Philip Craig 6573ce5e0a write/elf: avoid temp Vec for strtab in SinglePhase mode (#916)
Change `StringTable::write` to allow writing directly to the
WritableBuffer.

Also add `Encoder::strtab`.
2026-06-08 18:49:03 +10:00
Philip Craig b87fc2f0cb write: use u64 for file offsets (#914)
The goal is to reduce the amount of casts required by API users, and
make it easier to correctly handle overflow later (not implemented by
this commit).

usize is still used in many places for counts.

Breaking changes:

- WritableBuffer trait method signatures
- various low level writer APIs
2026-06-08 18:38:59 +10:00
Philip Craig 6ffc31a4cc elfcopy: style fixes (#915) 2026-06-08 18:34:06 +10:00
Mark Danial 75da283f29 Support for z/OS archive files (#904)
Co-authored-by: Philip Craig <philipjcraig@gmail.com>
2026-06-04 11:43:11 +10:00
Philip Craig a06449bc0b write/elf: versym size improvements in Writer
Handle differing dynsym and versym counts (although this shouldn't
happen in practice).
2026-06-04 11:41:49 +10:00
Philip Craig 86b0798ca9 write/elf: .gnu.attributes section alignment is 1 2026-06-04 11:41:49 +10:00
Philip Craig a15a3d1362 write/elf: remove Writer::set_gnu_ver*_count methods
Move the count parameter to the write_gnu_ver*_align calls.
2026-06-04 11:41:49 +10:00
Philip Craig cd7aa028f4 write/elf: fix need_dynstr handling in Writer
.dynsym needs to link to .dynstr. This matches the existing logic
for .symtab and .strtab. Also some minor dynstr_len cleanup.

Writer originally required this, but was changed in f3432e98. This
change was because there are files in the wild that are missing .dynstr,
and Builder needed to be able to handle them. Now that Builder is no
longer using Writer, I don't see any downside to writing the empty
.dynstr, so I think it's better to change Writer back again.

It's still possible to omit .dynstr if you use Builder (which uses
Encoder directly, not Writer), and there is a test for this.
2026-06-04 11:41:49 +10:00
Philip Craig 165712e6a8 write/elf: delete some Writer methods
These were added for use by elf::Builder, but are no longer needed,
and so removing to reduce clutter in the Writer API.
2026-06-04 11:41:49 +10:00
Philip Craig f87e69f6c5 write/elf: move AttributesWriter to encoder module 2026-06-04 11:41:49 +10:00
Philip Craig cdd9d43a82 write: make StringTable public
Needed for use with elf::Encoder.

Also change StringId from usize to u32, since offsets are limited
to that anyway.
2026-06-04 11:41:49 +10:00
Philip Craig ceb1d59f82 write/elf: add Encoder (#910)
This is the struct writing component of `Writer`, without any state management.
`Encoder` also includes size methods, replacing the need for `Class`.

`build::elf::Builder` already does a lot of its own state management, so
change it to use `Encoder`.

Breaking change: the structs for writing need more information computed
by the caller (string offsets and version string hashes).
Added `Writer` methods to return string offsets.
2026-05-31 16:47:58 +10:00
Philip Craig 5060df4d5e Add elfcopy example (#911)
This will be needed to test the two-phase ELF writer.
It's largely code that existed prior to the addition of elf::Builder.
2026-05-31 16:31:35 +10:00
Philip Craig c42c699b77 Add elfstub example
This tests `write::elf::SinglePhaseWriter`
2026-05-29 18:38:24 +10:00
Philip Craig 31f494f737 write: add StringTable::new_in_order
Use this for write::elf::SinglePhaseWriter
2026-05-29 18:38:24 +10:00
Philip Craig bdb86ee867 write/elf: return file offsets and sizes when writing 2026-05-29 18:38:24 +10:00
Philip Craig a96d90d87e write/elf: update function docs 2026-05-29 18:38:24 +10:00
Philip Craig b1a0942c66 write/elf: add SinglePhaseWriter 2026-05-29 18:38:24 +10:00
Philip Craig f0e2df57c1 write: add GrowableBuffer::as_writable 2026-05-29 18:38:24 +10:00
Philip Craig 0c9005dd7f write/elf: reorder methods 2026-05-29 18:38:24 +10:00
Philip Craig b47e34900f Add write::GrowableBuffer (#908)
Also improve WritableBuffer documentation.
2026-05-26 11:20:03 +10:00