-
Notifications
You must be signed in to change notification settings - Fork 156
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
elf: add read and write support for GNU properties #541
Conversation
26ded31
to
e91df1d
Compare
let n_name = b"GNU\0"; | ||
data.extend_from_slice(pod::bytes_of(&elf::NoteHeader32 { | ||
n_namesz: U32::new(self.endian, n_name.len() as u32), | ||
n_descsz: U32::new(self.endian, util::align(3 * 4, align) as u32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be 12 for 32-bit and 16 for 64-bit. The expression util::align(3 * 4, align)
should handle that.
// Value size | ||
data.extend_from_slice(pod::bytes_of(&U32::new(self.endian, 4))); | ||
data.extend_from_slice(pod::bytes_of(&U32::new(self.endian, value))); | ||
util::write_align(&mut data, align); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it typical to not include padding information if it's 0? #learning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what you mean. util::write_align(&mut data, align)
is the padding, which may be either 0 or 4 bytes.
No description provided.