1
0
Fork
You've already forked zar
0

Add symbol table writing support #25

Merged
iddev5 merged 16 commits from ranlib into master 2021年10月14日 09:40:55 +02:00
iddev5 commented 2021年10月13日 07:55:08 +02:00 (Migrated from github.com)
Copy link

This PR adds symbol table for

  • ELF & MachO object files
  • in GNU, GNU64, Thin, BSD and Darwin64 format
  • s and S modifiers
  • (includes code from zld)
This PR adds symbol table for - ELF & MachO object files - in GNU, GNU64, Thin, BSD and Darwin64 format - s and S modifiers - (includes code from zld)
iddev5 commented 2021年10月13日 08:05:12 +02:00 (Migrated from github.com)
Copy link

As I mentioned yesterday in #14(comment), the current way of parsing symbols is prone to modification errors. But its even more difficult to solve. Symbol table is parsed before files are parsed, why is why its not that easy to assign symbols to their respective files.

Solutions:

  1. Don't parse symbol table at all, only validate it. Then later regenerate the symbols from the file contents. This is something more doable in the long term but needs upstream support from zld (see here)

  2. Parse symbol table but store everything in a local array. Then when files are parsed, calculate its offset from the beginning of the archive. If archive offset == symbol's offset, then this symbol belongs to current active file. This one is easier and simpler for now.

As I mentioned yesterday in [#14(comment)](https://github.com/moosichu/zar/issues/14#issuecomment-941250211), the current way of parsing symbols is prone to modification errors. But its even more difficult to solve. Symbol table is parsed before files are parsed, why is why its not that easy to assign symbols to their respective files. Solutions: 1) Don't parse symbol table at all, only validate it. Then later regenerate the symbols from the file contents. This is something more doable in the long term but needs upstream support from zld (see [here](https://github.com/moosichu/zar/blob/ranlib/src/archive/Archive.zig#L484)) 2) Parse symbol table but store everything in a local array. Then when files are parsed, calculate its offset from the beginning of the archive. If archive offset == symbol's offset, then this symbol belongs to current active file. This one is easier and simpler for now.
iddev5 commented 2021年10月13日 09:09:21 +02:00 (Migrated from github.com)
Copy link

Now I think, it would make sense to solve this outside of this PR as there is no conflict. Just need agreement on the solution or other ideas on it.

Now I think, it would make sense to solve this outside of this PR as there is no conflict. Just need agreement on the solution or other ideas on it.
moosichu commented 2021年10月13日 10:56:47 +02:00 (Migrated from github.com)
Copy link

I will have a look this evening - I think I have an idea for a cleaner solution so will give that a try then.

I will have a look this evening - I think I have an idea for a cleaner solution so will give that a try then.
moosichu commented 2021年10月14日 00:11:51 +02:00 (Migrated from github.com)
Copy link

I've created PR #26 which might help? Feel free to merge if its something along the right lines for this. :)

I've created PR #26 which might help? Feel free to merge if its something along the right lines for this. :)
iddev5 commented 2021年10月14日 05:36:33 +02:00 (Migrated from github.com)
Copy link

Ahh that's better. It should do it. I will make the changes to this later along with merging #26
Thanks.

Ahh that's better. It should do it. I will make the changes to this later along with merging #26 Thanks.
iddev5 commented 2021年10月14日 09:42:50 +02:00 (Migrated from github.com)
Copy link

Success 🎉

Success :tada:
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Moosichu/zar!25
Reference in a new issue
Moosichu/zar
No description provided.
Delete branch "ranlib"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?