summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/obj2yaml
Commit message (Collapse)AuthorAgeFilesLines
...
* [BinaryFormat] Add DT_USED tag into dynamic section.Xing GUO2019-03-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This tag is documented in https://docs.oracle.com/cd/E19253-01/817-1984/chapter6-42444/index.html Though I could not find some docs that describe it in detail, I found some code snippets. 1. ``` /* * Look up the string in the string table and get its offset. If * this succeeds, then it is possible that there is a DT_NEEDED * dynamic entry that references it. */ have_string = elfedit_sec_findstr(argstate->str.sec, strpad_elt.dn_dyn.d_un.d_val, arg, &str_offset) != 0; if (have_string) { dyn = argstate->dynamic.data; for (ndx = 0; ndx < numdyn; dyn++, ndx++) { if (((dyn->d_tag == DT_NEEDED) || (dyn->d_tag == DT_USED)) && (dyn->d_un.d_val == str_offset)) goto done; } } ``` https://github.com/kofemann/opensolaris/blob/80192cd83bf665e708269dae856f9145f7190f74/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c#L512 2. ``` case DT_USED: case DT_INIT_ARRAY: case DT_FINI_ARRAY: if (do_dynamic) { if (entry->d_tag == DT_USED && VALID_DYNAMIC_NAME (entry->d_un.d_val)) { char *name = GET_DYNAMIC_NAME (entry->d_un.d_val); if (*name) { printf (_("Not needed object: [%s]\n"), name); break; } } print_vma (entry->d_un.d_val, PREFIX_HEX); putchar ('\n'); } break; ``` http://web.mit.edu/freebsd/head/contrib/binutils/binutils/readelf.c 3. ``` #define DT_USED 0x7ffffffe /* ignored - same as needed */ ``` https://github.com/switchbrew/switch-tools/blob/master/src/elf_common.h Reviewers: jhenderson, grimar Reviewed By: jhenderson, grimar Subscribers: emaste, krytarowski, fedor.sergeev, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58762 llvm-svn: 355468
* [yaml2obj] - Allow setting custom sh_info for RawContentSection sections.George Rimar2019-03-011-0/+20
| | | | | | | | | | | This is for tweaking SHT_SYMTAB sections. Their sh_info contains the (number of symbols + 1) usually. But for creating invalid inputs for test cases it would be convenient to allow explicitly override this field from YAML. Differential revision: https://reviews.llvm.org/D58779 llvm-svn: 355193
* [yaml2obj][obj2yaml] - Add support for the architecture specific dynamic tags.George Rimar2019-02-261-0/+272
| | | | | | | | | | | This allows tools to parse/dump the architecture specific tags like DT_MIPS_*, DT_PPC64_* and DT_HEXAGON_* Also fixes a bug in DynamicTags.def which was revealed in this patch. Differential revision: https://reviews.llvm.org/D58667 llvm-svn: 354876
* [obj2yaml] - Do not miss section index for special symbols.George Rimar2019-02-222-0/+46
| | | | | | | | | | | | | | This fixes https://bugs.llvm.org/show_bug.cgi?id=40786 ("obj2yaml symbol output missing section index for SHN_ABS and SHN_COMMON symbols") Since SHN_ABS and SHN_COMMON symbols are special, we should preserve the st_shndx for them. The patch does this for them and the other special symbols. The test case is based on the test provided by James Henderson at the bug page! Differential revision: https://reviews.llvm.org/D58498 llvm-svn: 354661
* [yaml2obj][obj2yaml] - Support SHT_GNU_verdef (.gnu.version_d) section.George Rimar2019-02-211-0/+72
| | | | | | | | | | This patch adds support for parsing/dumping the .gnu.version section. Description of the section is: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverdefs.html Differential revision: https://reviews.llvm.org/D58437 llvm-svn: 354574
* [obj2yaml][yaml2obj]Locate all .yaml and .test testsJames Henderson2019-02-201-0/+1
| | | | | | | | | | | | | | | | A number of the obj2yaml tests end in .yaml, but .yaml is not a default file type picked up by lit, so these tests weren't being run when running the testsuite as a whole (they could be run explicitly still). This change adds a lit local config file to specify the known file types for obj2yaml tests (.yaml and .test). Additionally, it fixes the yaml2obj config file to allow both .test and .yaml suffixed tests (previously, the two tests ending in '.test' were not being run). Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D58439 llvm-svn: 354474
* [yaml2obj][obj2yaml] Remove section type range markers from allowed mappings ↵James Henderson2019-02-191-0/+28
| | | | | | | | | | | | | | | | | | | | | and support hex values yaml2obj/obj2yaml previously supported SHT_LOOS, SHT_HIOS, and SHT_LOPROC for section types. These are simply values that delineate a range and don't really make sense as valid values. For example if a section has type value 0x70000000, obj2yaml shouldn't print this value as SHT_LOPROC. Additionally, this was missing the three other range markers (SHT_HIPROC, SHT_LOUSER and SHT_HIUSER). This change removes these three range markers. It also adds support for specifying the type as an integer, to allow section types that LLVM doesn't know about. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D58383 llvm-svn: 354344
* [yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section.George Rimar2019-02-191-0/+48
| | | | | | | | | This patch adds support for parsing dumping the .gnu.version section. Description of the section is: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symversion.html#SYMVERTBL Differential revision: https://reviews.llvm.org/D58280 llvm-svn: 354338
* Recommit r354328, r354329 "[obj2yaml][yaml2obj] - Add support of ↵George Rimar2019-02-191-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing/dumping of the .gnu.version_r section." Fix: Replace assert(!IO.getContext() && "The IO context is initialized already"); with assert(IO.getContext() && "The IO context is not initialized"); (this was introduced in r354329, where I tried to quickfix the darwin BB and seems copypasted the assert from the wrong place). Original commit message: The section is described here: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverrqmts.html Patch just teaches obj2yaml/yaml2obj to dump and parse such sections. We did the finalization of string tables very late, and I had to move the logic to make it a bit earlier. That was needed in this patch since .gnu.version_r adds strings to .dynstr. This might also be useful for implementing other special sections. Everything else changed in this patch seems to be straightforward. Differential revision: https://reviews.llvm.org/D58119 llvm-svn: 354335
* Revert r354328, r354329 "[obj2yaml][yaml2obj] - Add support of ↵George Rimar2019-02-191-69/+0
| | | | | | | | | parsing/dumping of the .gnu.version_r section." Something went wrong. Bots are unhappy: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/44113/steps/test/logs/stdio llvm-svn: 354332
* [obj2yaml][yaml2obj] - Add support of parsing/dumping of the .gnu.version_r ↵George Rimar2019-02-191-0/+69
| | | | | | | | | | | | | | | | | | | | section. The section is described here: https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/symverrqmts.html Patch just teaches obj2yaml/yaml2obj to dump and parse such sections. We did the finalization of string tables very late, and I had to move the logic to make it a bit earlier. That was needed in this patch since .gnu.version_r adds strings to .dynstr. This might also be useful for implementing other special sections. Everything else changed in this patch seems to be straightforward. Differential revision: https://reviews.llvm.org/D58119 llvm-svn: 354328
* [yaml2obj][obj2yaml] - Add support for dumping/parsing .dynamic sections.George Rimar2019-02-091-0/+248
| | | | | | | | | This teaches the tools to parse and dump the .dynamic section and its dynamic tags. Differential revision: https://reviews.llvm.org/D57691 llvm-svn: 353606
* [yaml2obj]Allow number for ELF symbol typeJames Henderson2019-02-061-0/+22
| | | | | | | | | | | | | yaml2obj previously only recognised standard STT_* names, and didn't allow arbitrary numbers. This change allows the user to specify a number for the type instead. It also adds a test to verify the existing behaviour for obj2yaml for unkown symbol types. Reviewed by: grimar Differential Revision: https://reviews.llvm.org/D57822 llvm-svn: 353315
* [obj2yaml] - Dump the sh_entsize section field.George Rimar2019-01-281-0/+21
| | | | | | | | | | | | I faced with the fact that obj2yaml does not dump the sh_entsize field. A problem arose when I tried to dump ELF versioning sections. This is close to what D50235 did, but D50235 did the change for yaml2obj, and now I had to do the same for obj2yaml. Differential revision: https://reviews.llvm.org/D57229 llvm-svn: 352373
* [obj2yaml] Don't crash for input files without symbol tableAlexander Richardson2017-09-222-0/+5
| | | | | | | | | | | | Summary: Previously we would dereference Symtab without checking for null. Reviewers: davide, atanasyan, rafael Reviewed By: davide, atanasyan Differential Revision: https://reviews.llvm.org/D38080 llvm-svn: 313970
* obj2yaml: Improve error reportingSam Clegg2017-06-161-0/+4
Previously only the error codes were reported which meant that useful information about malformed inputs was not shown. Differential Revision: https://reviews.llvm.org/D34008 llvm-svn: 305609
OpenPOWER on IntegriCloud