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
.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.
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.