Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a zero-copy, safe, symtable for use in no std #21

Closed
m4b opened this issue Apr 6, 2017 · 1 comment
Closed

add a zero-copy, safe, symtable for use in no std #21

m4b opened this issue Apr 6, 2017 · 1 comment

Comments

@m4b
Copy link
Owner

m4b commented Apr 6, 2017

It would pass out references to Syms, which are byte-casted from a backing &[u8]; and have a new -> Result api (which validates the bounds). We'd need two for elf32 and elf64 probably; or we can initialize as 32 or 64 bit (or pass a container context, which has less boolean blindness). This will be tricky and annoying I think due to type name punning stuff, so probably easiest to just add two typed versions and re-export it

Similar to strtab, I would also want it to implement Index, so it can be literally drop-in replaced in code that previously used a &[Sym].

Another approach could just provide a newtype wrapper on &[Sym] that validates the backing bytes and a count provided, and then Derefs to a &[Sym] so we get indexing for free.

Lots of options.

If we want to get fancy-pantsy, we might be able generify it to both ELF and Mach symbols, and have it return references via something like:

get::<Symbol>(index) -> Result<&Symbol>

but that might not be worth the effort.

@m4b m4b added this to the 0.0.10 milestone Apr 6, 2017
m4b added a commit that referenced this issue Apr 9, 2017
… move to bytes api instead of AsRef when struct has no lifetime, to prepare zero-copy everywhere, ref #14,#15,#16,#21
@m4b m4b modified the milestones: 0.0.10, 0.0.12 Aug 25, 2017
@m4b
Copy link
Owner Author

m4b commented Sep 29, 2018

I think parts of this are implemented; not as interesting, so closing

@m4b m4b closed this as completed Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant