Skip to content

Separate reader and writer #74

Answered by jrmadsen
jrmadsen asked this question in General
Aug 13, 2021 · 12 comments · 1 reply
Discussion options

You must be logged in to vote

@serge1 Thank you for all your insight. I had to make segment::set_offset public to finally get it working. Here is the final simplified workflow:

using Section = ELFIO::section;
using Segment = ELFIO::segment;

void read_write(std::string in, std::string out)
{
    ELFIO::elfio reader{};
    ELFIO::elfio writer{};

    reader.load(in);

    writer.create(reader.get_class(), reader.get_encoding());
    writer.set_os_abi(reader.get_os_abi());
    writer.set_type(reader.get_type());
    writer.set_machine(reader.get_machine());
    writer.set_abi_version(reader.get_abi_version());
    writer.set_entry(reader.get_entry());

    std::vector<std::pair<Section*, Section*>> _sections{};
    std:…

Replies: 12 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by serge1
Comment options

You must be logged in to vote
1 reply
@jrmadsen
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #73 on August 16, 2021 04:43.