Skip to content

Delete format specific variants in RelocationKind#585

Merged
philipc merged 7 commits intogimli-rs:masterfrom
philipc:reloc
Jan 3, 2024
Merged

Delete format specific variants in RelocationKind#585
philipc merged 7 commits intogimli-rs:masterfrom
philipc:reloc

Conversation

@philipc
Copy link
Copy Markdown
Contributor

@philipc philipc commented Oct 26, 2023

Replace uses of these variants with read::Relocation::flags and write::Relocation::flags.

Additionally, for write::Relocation, move the kind/encoding/size fields into RelocationFlags::Generic, since these are not required when using format specific variants.

Closes #214

This is preparation for doing this step earlier.
No functionality changes.
This is preparation for removing the size field when the user
specifies the flags, and also lets us do the flag calculation
earlier.
This simplifies the code because we no longer need to avoid
modifying the addend in the relocation.

Also make the implicit addend handling clearer.
Previously we adjusted the addend based on the relocation kind.
For cases where the flags are derived from the relocation kind,
this should not change the behaviour.

For cases where the user supplies the flags, this ensures the
adjustment is consistent with the flags that are actually used
(since previously the kind and flags did not need to agree).

This is preparation for removing the relocation kind field
when the user supplies the flags.
Replace uses of these variants with read::Relocation::flags
and write::Relocation::flags.

Additionally, for write::Relocation, move the kind/encoding/size
fields into RelocationFlags::Generic, since these are not
required when using format specific variants.
@philipc philipc merged commit e719bd6 into gimli-rs:master Jan 3, 2024
@philipc philipc deleted the reloc branch January 3, 2024 07:20
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
Delete format specific variants in RelocationKind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

write: redesign relocation kinds

1 participant