summaryrefslogtreecommitdiffstats
path: root/tests/elfstrmerge.c
Commit message (Collapse)AuthorAgeFilesLines
* Use octal numbers rather than permission macrosUlf Hermann2017-05-081-2/+2
| | | | | | | | The permission macros are not guaranteed to be defined and the octal numbers are rather well known. Change-Id: I90ea2f98013f963857946a2f150a4a7114ca2b9a Reviewed-by: Christian Kandeler <[email protected]>
* Open files in O_BINARYUlf Hermann2017-05-081-2/+2
| | | | | | | | | If O_BINARY is not defined, define it to 0, so that the change has no effect then. Some systems have separate binary and text modes for files, and we don't want the text mode to be used. Change-Id: If7efb5bd448c2a1c7d1eb5dab276849b1b15a3ce Reviewed-by: Christian Kandeler <[email protected]>
* Skip fchown, fchmod, fadvise, fallocate if functions are unavailableUlf Hermann2017-05-041-0/+4
| | | | | | | | | | | If fchmod or fchown are unavailable, then the file permission model is likely to be different from what we expect there. posix_fallocate is a rather fragile affair already on linux, and not guaranteed to do anything useful. If it's not available, the result will be the same as when it's available and unreliable. fadvise is an optimization. Change-Id: I28a77e976a0198cf80397b45eb1bc8cfb30664f5 Reviewed-by: Christian Kandeler <[email protected]>
* Drop handrolled or #ifdef'ed libc replacementsUlf Hermann2017-04-281-1/+0
| | | | | | | | | mempcpy, memrchr, rawmemchr, and argp are provided by gnulib now. We don't need to define them locally and we don't need to search for an external libargp. Change-Id: I131ca4bc2d77c597b99c296c28259a3600e5d1b5 Reviewed-by: Christian Kandeler <[email protected]>
* Check for existence of mempcpyUlf Hermann2017-02-171-0/+1
| | | | | | If it doesn't exist, provide a definition based on memcpy. Signed-off-by: Ulf Hermann <[email protected]>
* dwelf: Add string table functions from ebl.Mark Wielaard2016-08-031-15/+16
| | | | | | | | | | | | | | | | Move the strtab functions from libebl to libdw. Programs often want to create ELF/DWARF string tables. We don't want (static) linking against ebl since those are internal functions that might change. This introduces dwelf_strtab_init, dwelf_strtab_add, dwelf_strtab_add_len, dwelf_strtab_finalize, dwelf_strent_off, dwelf_strent_str and dwelf_strtab_free. Documentation for each has been added to libdwelf.h. The add fucntion got a variant that takes the length explicitly and finalize was changed to return NULL on out of memory instead of aborting. All code and tests now uses the new functions. Signed-off-by: Mark Wielaard <[email protected]>
* tests: elfstrmerge warn about STT_SECTION symbol for shstrhndx.Mark Wielaard2016-01-051-2/+7
| | | | | | | | | | | | | | Old linkers might have created an STT_SECTION symbol for the section header string table section, which isn't actually used. For now just warn about such symbols. If such a symbol would actually really be used (but why?) then we would have to handle it by removing it and rewriting the symbol table. This is a testsuite only change, but includes an extra test with files that have such STT_SECTION symbols to make sure it will be handled in case we "upgrade" the elfstrmerge test to a real utility. Signed-off-by: Mark Wielaard <[email protected]>
* Handle merged strtab/shstrtab string tables in strip and unstrip.Mark Wielaard2015-10-051-0/+667
ELF files can share the section header string table (e_shstrndx) with the symtab .strtab section. That might in some cases save a bit of space since symbols and sections might share some (sub)strings. To handle that eu-strip just needs to not unconditionally remove the .shstrtab section (it will be properly marked as used/unused as needed). eu-unstrip needs to make sure the section names are added to the strtab if it decides to rewrite that section. Also makes sure that eu-strip won't move around a SHT_NOBITS section that has SHF_ALLOC set. Although it is allowed to move such sections around, there is no benefit. And some tools might expect no allocated section to move around, not even a nobits section. It also makes it harder to do "roundtripping" sanity checks that make sure splitting a file with eu-strip and then reconstructed with eu-unstrip produce the same ELF file (as is done in the new run-strip-strmerge.sh). Introduces a somewhat large test generator elfstrmerge.c that will hopefully turn into a more generic string table merger program. Signed-off-by: Mark Wielaard <[email protected]>