Add decompress section function for readelf.
Update Makefile.
Update readelf.1
Depends on this libelf patch
Details
- Reviewers
emaste markj - Group Reviewers
manpages - Commits
- rS367209: readelf: Add -z decompression support
Compared results with/without -z flags.
Confirmed -h prints -z usage info.
Compared results for:
readelf -x [section] -z file readelf -p [section] -z file
with GNU's readelf.
diff elftoolchain_output gnu_output
shows no difference.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
The readelf man page needs to be updated to mention the new option.
contrib/elftoolchain/readelf/readelf.c | ||
---|---|---|
6847 ↗ | (On Diff #78613) | The brace should be on a separate line. |
6953 ↗ | (On Diff #78613) | buf needs to be freed after we're done with it, but only if it's not equal to d->d_buf. |
7673 ↗ | (On Diff #78613) | -z needs to be documented in this usage string. |
contrib/elftoolchain/readelf/readelf.c | ||
---|---|---|
6953 ↗ | (On Diff #78613) | Since buf pointer keeps moving I added a pointer to newly allocated decompressed buffer. |
contrib/elftoolchain/readelf/readelf.c | ||
---|---|---|
6841 ↗ | (On Diff #78654) | we can use bool and return true / false |
6843–6847 ↗ | (On Diff #78654) | FreeBSD style(9) wants doesn't use this style; should be /* * Decompress a data section if needed (using ZLIB). * Returns 0 if sucessful, 1 otherwise. */ static int decompress_section(struct section *s, unsigned char *compressed_data_buffer, uint64_t compressed_size, unsigned char **ret_buf, uint64_t *ret_sz) { |
6851–6853 ↗ | (On Diff #78654) | these should be indented by 1/2 tabs |
6892–6894 ↗ | (On Diff #78654) | {} are not required for single-statement bodies. They are permitted but need to be consistent throughout and they're not used elsewhere |
contrib/elftoolchain/readelf/readelf.c | ||
---|---|---|
7043 ↗ | (On Diff #78781) | Fixed by setting new_buf to NULL every loop. |