summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/obj2yaml
Commit message (Collapse)AuthorAgeFilesLines
* Revert "[yaml2obj/obj2yaml] - Add support for SHT_RELR sections."Georgii Rymar2020-01-151-102/+0
| | | | | | This reverts commit 46d11e30ee807accefd14e0b7f306647963a39b5. It broke bots. E.g. http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/60744
* [yaml2obj/obj2yaml] - Add support for SHT_RELR sections.Georgii Rymar2020-01-151-0/+102
| | | | | | | | | | | | | | | The encoded sequence of Elf*_Relr entries in a SHT_RELR section looks like [ AAAAAAAA BBBBBBB1 BBBBBBB1 ... AAAAAAAA BBBBBB1 ... ] i.e. start with an address, followed by any number of bitmaps. The address entry encodes 1 relocation. The subsequent bitmap entries encode up to 63(31) relocations each, at subsequent offsets following the last address entry. More information is here: https://github.com/llvm-mirror/llvm/blob/master/lib/Object/ELF.cpp#L272 This patch adds a support for these sections. Differential revision: https://reviews.llvm.org/D71872
* [yaml2obj/obj2yaml] - Add support for SHT_LLVM_DEPENDENT_LIBRARIES sections.Georgii Rymar2019-11-251-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | This section contains strings specifying libraries to be added to the link by the linker. The strings are encoded as standard null-terminated UTF-8 strings. This patch adds a way to describe and dump SHT_LLVM_DEPENDENT_LIBRARIES sections. I introduced a new YAMLFlowString type here. That used to teach obj2yaml to dump them like: ``` Libraries: [ foo, bar ] ``` instead of the following (if StringRef would be used): ``` Libraries: - foo - bar ``` Differential revision: https://reviews.llvm.org/D70598
* [yaml2obj/obj2yaml] - Add support for SHT_LLVM_LINKER_OPTIONS sections.Georgii Rymar2019-11-121-0/+69
| | | | | | | SHT_LLVM_LINKER_OPTIONS section contains pairs of null-terminated strings. This patch adds support for them. Differential revision: https://reviews.llvm.org/D69895
* [yaml2obj/obj2yaml] - Add support for SHT_GNU_HASH section.georgerim2019-10-311-0/+132
| | | | | | | This adds parsing and dumping support for GNU hash sections. They are described nicely here: https://blogs.oracle.com/solaris/gnu-hash-elf-sections-v2 Differential revision: https://reviews.llvm.org/D69399
* minidump: Rename some architecture constantsPavel Labath2019-10-301-2/+2
| | | | | | | | | | | | | | | | | | | | | The architecture enum contains two kinds of contstants: the "official" ones defined by Microsoft, and unofficial constants added by breakpad to cover the architectures not described by the first ones. Up until now, there was no big need to differentiate between the two. However, now that Microsoft has defined https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info a constant for ARM64, we have a name clash. This patch renames all breakpad-defined constants with to include the prefix "BP_". This frees up the name "ARM64", which I'll re-introduce with the new "official" value in a follow-up patch. Reviewers: amccarth, clayborg Subscribers: lldb-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D69285
* [obj2yaml] - Update a comment in a test case. NFC.Georgii Rymar2019-10-291-2/+2
| | | | Addresses post-commit comments for D69160.
* [yaml2obj] - Make .symtab to be not mandatory section for SHT_REL[A] section.Georgii Rymar2019-10-293-4/+0
| | | | | | | | | | | | | | Before this change .symtab section was required for SHT_REL[A] section declarations. yaml2obj automatically defined it in case when YAML document did not have it. With this change it is now possible to produce an object that has a relocation section, but has no symbol table. It simplifies the code and also it is inline with how we handle Link fields for another special sections. Differential revision: https://reviews.llvm.org/D69260
* [obj2yaml] - Better dumping for relocations without symbols associated.georgerim2019-10-253-96/+0
| | | | | | | | | This just reorders the code and removes an assignment of an empty string for the case when a relocation has no symbol associated. With this our output becomes cleaner and shorter. Differential revision: https://reviews.llvm.org/D69255
* [llvm/Object] - Fix the error message reported for a broken SHT_SYMTAB_SHNDX ↵georgerim2019-10-251-2/+1
| | | | | | | | | | | | | | section. SHT_SYMTAB_SHNDX should have the same number of entries as the symbol table associated (https://www.sco.com/developers/gabi/latest/ch4.sheader.html) We currently can report the following message: "SHT_SYMTAB_SHNDX section has sh_size (24) which is not equal to the number of symbols (2)" It is just broken. This patch refines/fixes it. Differential revision: https://reviews.llvm.org/D69305
* [obj2yaml] - Fix a comment. NFC.George Rimar2019-10-211-1/+1
| | | | | | I forgot to address this nit before committing.. llvm-svn: 375405
* [obj2yaml] - Stop triggering UB when dumping corrupted strings.George Rimar2019-10-211-0/+31
| | | | | | | | | | | | | | | | | | | We have a following code to find quote type: if (isspace(S.front()) || isspace(S.back())) ... Problem is that: "int isspace( int ch ): The behavior is undefined if the value of ch is not representable as unsigned char and is not equal to EOF." (https://en.cppreference.com/w/cpp/string/byte/isspace) This patch shows how this UB can be triggered and fixes an issue. Differential revision: https://reviews.llvm.org/D69160 llvm-svn: 375404
* [yaml2obj][obj2yaml] - Do not create a symbol table by default.George Rimar2019-10-205-2/+46
| | | | | | | | | | | | | | | | | | This patch tries to resolve problems faced in D68943 and uses some of the code written by Konrad Wilhelm Kleine in that patch. Previously, yaml2obj tool always created a .symtab section. This patch changes that. With it we only create it when have a "Symbols:" tag in the YAML document or when we need to create it because it is used by another section(s). obj2yaml follows the new behavior and does not print "Symbols:" anymore when there is no symbol table. Differential revision: https://reviews.llvm.org/D69041 llvm-svn: 375361
* Update MinidumpYAML to use minidump::Exception for exception streamJoseph Tremoulet2019-10-181-0/+22
| | | | | | | | | | | | | | Reviewers: labath, jhenderson, clayborg, MaskRay, grimar Reviewed By: grimar Subscribers: lldb-commits, grimar, MaskRay, hiraditya, llvm-commits Tags: #llvm, #lldb Differential Revision: https://reviews.llvm.org/D68657 llvm-svn: 375242
* MinidumpYAML: Add support for the memory info list streamPavel Labath2019-10-101-0/+42
| | | | | | | | | | | | | | | | | | | | | Summary: The implementation is fairly straight-forward and uses the same patterns as the existing streams. The yaml form does not attempt to preserve the data in the "gaps" that can be created by setting a larger-than-required header or entry size in the stream header, because the existing consumer (lldb) does not make use of the information in the gap in any way, and attempting to preserve that would make the implementation more complicated. Reviewers: amccarth, jhenderson, clayborg Subscribers: llvm-commits, lldb-commits, markmentovai, zturner, JosephTremoulet Tags: #llvm Differential Revision: https://reviews.llvm.org/D68645 llvm-svn: 374337
* Recommit r373598 "[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG ↵George Rimar2019-10-031-0/+98
| | | | | | | | | | | | | | | | | sections." Fix: call `consumeError()` for a case missed. Original commit message: SHT_LLVM_ADDRSIG is described here: https://llvm.org/docs/Extensions.html#sht-llvm-addrsig-section-address-significance-table This patch teaches tools to dump them and to parse the YAML declarations of such sections. Differential revision: https://reviews.llvm.org/D68333 llvm-svn: 373606
* Revert r373598 "[yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG ↵George Rimar2019-10-031-98/+0
| | | | | | | | | sections." It broke BB: http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/18655/steps/test/logs/stdio llvm-svn: 373599
* [yaml2obj/obj2yaml] - Add support for SHT_LLVM_ADDRSIG sections.George Rimar2019-10-031-0/+98
| | | | | | | | | | | SHT_LLVM_ADDRSIG is described here: https://llvm.org/docs/Extensions.html#sht-llvm-addrsig-section-address-significance-table This patch teaches tools to dump them and to parse the YAML declarations of such sections. Differential revision: https://reviews.llvm.org/D68333 llvm-svn: 373598
* [yaml2obj/obj2yaml] - Add support for SHT_HASH sections.George Rimar2019-10-011-0/+78
| | | | | | | | | | | | | | | SHT_HASH specification is: http://www.sco.com/developers/gabi/latest/ch5.dynamic.html#hash In short the format is the following: it has 2 uint32 fields in its header: nbucket and nchain followed by (nbucket + nchain) uint32 values. This patch allows dumping and parsing such sections. Differential revision: https://reviews.llvm.org/D68085 llvm-svn: 373315
* [yaml2obj/obj2yaml] - Add support for .stack_sizes sections.George Rimar2019-09-241-0/+88
| | | | | | | | | | | .stack_sizes is a SHT_PROGBITS section that contains pairs of <address (4/8 bytes), stack size (uleb128)>. This patch teach tools to parse and dump it. Differential revision: https://reviews.llvm.org/D67757 llvm-svn: 372762
* [yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing ↵George Rimar2019-09-201-0/+38
| | | | | | | | | | | | | | relocations and e_machine is unsupported. Currently when e_machine is set to something that is not supported by YAML lib, then tools fail with llvm_unreachable. In this patch I allow them to handle relocations in this case. It can be used to dump and create objects for broken or unsupported targets. Differential revision: https://reviews.llvm.org/D67657 llvm-svn: 372377
* [obj2yaml] - Support PPC64 relocation types.George Rimar2019-09-171-0/+488
| | | | | | | | | | | | | We do not support them and fail with llvm_unreachable currently. This is not the only target we do not support and also seems we are missing the tests for those we have already. But I needed this one for another patch, so posted it separatelly. Relocation names are taken from llvm\include\llvm\BinaryFormat\ELFRelocs\PowerPC64.def Differential revision: https://reviews.llvm.org/D67615 llvm-svn: 372109
* [yaml2obj/obj2yaml] - Allow setting an arbitrary values for e_machine.George Rimar2019-09-171-0/+39
| | | | | | | | | | | | | | | Currently we only allow using a known named constants for `Machine` field in YAML documents. This patch allows using any numbers (valid or "unknown") and adds test cases for current and new functionality. With this it is possible to write a test cases for really unknown EM_* targets. Differential revision: https://reviews.llvm.org/D67652 llvm-svn: 372108
* [yaml2obj][obj2yaml] - Use a single "Other" field instead of "Other", ↵George Rimar2019-08-301-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "Visibility" and "StOther". Currenly we can encode the 'st_other' field of symbol using 3 fields. 'Visibility' is used to encode STV_* values. 'Other' is used to encode everything except the visibility, but it can't handle arbitrary values. 'StOther' is used to encode arbitrary values when 'Visibility'/'Other' are not helpfull enough. 'st_other' field is used to encode symbol visibility and platform-dependent flags and values. Problem to encode it is that it consists of Visibility part (STV_* values) which are enumeration values and the Other part, which is different and inconsistent. For MIPS the Other part contains flags for all STO_MIPS_* values except STO_MIPS_MIPS16. (Like comment in ELFDumper says: "Someones in their infinite wisdom decided to make STO_MIPS_MIPS16 flag overlapped with other ST_MIPS_xxx flags."...) And for PPC64 the Other part might actually encode any value. This patch implements custom logic for handling the st_other and removes 'Visibility' and 'StOther' fields. Here is an example of a new YAML style this patch allows: - Name: foo Other: [ 0x4 ] - Name: bar Other: [ STV_PROTECTED, 4 ] - Name: zed Other: [ STV_PROTECTED, STO_MIPS_OPTIONAL, 0xf8 ] Differential revision: https://reviews.llvm.org/D66886 llvm-svn: 370472
* [yaml2obj/obj2yaml] - Add a basic support for extended section indexes.George Rimar2019-08-083-6/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | In some cases a symbol might have section index == SHN_XINDEX. This is an escape value indicating that the actual section header index is too large to fit in the containing field. Then the SHT_SYMTAB_SHNDX section is used. It contains the 32bit values that stores section indexes. ELF gABI says that there can be multiple SHT_SYMTAB_SHNDX sections, i.e. for example one for .symtab and one for .dynsym (1) https://groups.google.com/forum/#!topic/generic-abi/-XJAV5d8PRg (2) DT_SYMTAB_SHNDX: http://www.sco.com/developers/gabi/latest/ch5.dynamic.html In this patch I am only supporting a single SHT_SYMTAB_SHNDX associated with a .symtab. This is a more or less common case which is used a few tests I saw in LLVM. I decided not to create the SHT_SYMTAB_SHNDX section as "implicit", but implement is like a kind of regular section for now. i.e. tools do not recreate this section or its content, like they do for symbol table sections, for example. That should allow to write all kind of possible broken test cases for our needs and keep the output closer to requested. Differential revision: https://reviews.llvm.org/D65446 llvm-svn: 368272
* [obj2yaml] - MIPS: move and improve testing of the e_flagsGeorge Rimar2019-08-071-0/+380
| | | | | | | | | | | | | | Mips/elf-flags.yaml and Mips/elf-abi.yaml are tests that intention was to show that yaml2obj/obj2yaml are able to read/dump MIPS specific e_flags. They were not complete, contained an excessive YAML parts and were placed at a wrong location. I removed them and created the obj2yaml/elf-mips-eflags.yaml instead. Differential revision: https://reviews.llvm.org/D65807 llvm-svn: 368140
* [test/Object] - Cleanup the Object\obj2yaml.test a bit.George Rimar2019-08-061-2/+1
| | | | | | | | | | | | | | | This makes 2 changes: 1) Removes unwind-section.elf-x86-64 object and the corresponding test case, because SHT_X86_64_UNWIND is already tested here: https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/section-type.yaml 2) Removes/partially moves "No such file or directory" test, because we already have a similar test here: https://github.com/llvm-mirror/llvm/blob/master/test/tools/obj2yaml/invalid_input_file.test Differential revision: https://reviews.llvm.org/D65570 llvm-svn: 368044
* [llvm/test/Object] - Cleanup and move out the yaml2obj tests.George Rimar2019-08-061-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are multiple yaml2obj-* tests in llvm/test/Object folder. This is not correct place to have them and my intention was to move them out to test\tools\yaml2obj folder. I reviewed them, made some changes, and my comments are below. For all tests I: Added comments when needed. Moved them from llvm/test/Object to yaml2obj tests. Another changes performed: 1) yaml2obj-invalid.yaml. It was a test for an invalid YAML input. I just moved it. 2) yaml2obj-coff-multi-doc.test/yaml2obj-elf-multi-doc.test: these were a tests for testing --docnum=x functionality, one was for COFF and one for ELF. I merged them into one. 3) yaml2obj-elf-bits-endian.test: I removed its 4 YAML inputs (merged into the main test). 4) yaml2obj-readobj.test: This file has a long history. It was added to check the "parsing of header charactestics" initially. Then was used to test how yaml2obj writes the relocations. Then was upgraded to check how yaml2obj handle "-o" option. I think it should be heavily splitted and refactored in a separate patch. For now I leaved it as is, but restyled to reduce the changes in a follow-ups. 5) yaml2obj-elf-alignment.yaml: its intention was to check we can set sh-addralign field. I moved, renamed (to elf-sh-addralign.yaml) and updated this test. 6) yaml2obj-elf-file-headers.yaml: I removed it. It's intention was to check that yaml2obj handles OS/ABI and ELF type (e.g Relocatable). We are testing this already, for example in D64800. We might want to add a better (more complete) test, but keeping the existent test does not have much sense I think. 7) yaml2obj-elf-file-headers-with-e_flags.yaml: I would describe its intention as "testing MIPS e_flags". It is far from being complete and tests only a few flags. I leaved it alone for now. 8) yaml2obj-elf-rel.yaml: its intention is to check the MIPS32 relocations. We have a version for MIPS64 here: test\Object\Mips\elf-mips64-rel.yaml Seems them both are incomplete. I leaved them alone for now. 9) yaml2obj-elf-rel-noref.yaml: was introduced to check the support of arm32 R_ARM_V4BX relocatiion. I leaved it alone for now. 10) yaml2obj-elf-section-basic.yaml: it just checked that we are able to recognise trivial fields like section 'Name', 'Type', 'Flags' and others. All of our yaml2obj tests are heavily using it. I just removed this test. 11) yaml2obj-elf-section-invalid-size.yaml: its intention was to check the "Section size must be greater than or equal to the content size" error. I moved this test to `tools\yaml2obj\section-size-content.yaml' 12) yaml2obj-elf-symbol-basic.yaml: its intention seems was to support declarations of the symbols in yaml2obj. I removed it. We use this in almost each test we already have. 13) yaml2obj-elf-symbol-LocalGlobalWeak.yaml: its intention was to check that we can declare different symbol bindings. I moved it to tools\yaml2obj\elf-symbol-binding.yaml. 14) yaml2obj-coff-invalid-alignment.test: check that error is reported for a too large coff section alignment. Moved it to tools\yaml2obj\coff-invalid-alignment.test 15) yaml2obj-elf-symbol-visibility.yaml: tests ELF symbols visibility. I improved it and moved to tools\yaml2obj\elf-symbol-visibility.yaml and tools\obj2yaml\elf-symbol-visibility.yaml Differential revision: https://reviews.llvm.org/D65652 llvm-svn: 367988
* [obj2yaml] - Teach tool to dump SHT_NULL sections.George Rimar2019-08-051-0/+143
| | | | | | | | | | | Recently an advanced support of SHT_NULL sections was implemented in yaml2obj. This patch adds a corresponding support to obj2yaml. Differential revision: https://reviews.llvm.org/D65215 llvm-svn: 367852
* [obj2yaml] - Report a error when unable to resolve a sh_link reference properly.George Rimar2019-07-291-0/+58
| | | | | | | | | Because of a bug we did not report a error in the case shown in the test. With this patch we do. Differential revision: https://reviews.llvm.org/D65214 llvm-svn: 367203
* Recommit r366052 "[obj2yaml] - Rework tool's error reporting logic for ELF ↵George Rimar2019-07-152-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | target." No changes, LLD code was updated in r366057. Original commit message: ELF.h contains two getSymbol methods which seems to be used only from obj2yaml. One of these methods calls another, which in turn contains untested error message which doesn't provide enough information. Problem is that after improving only just that message, obj2yaml will not show it, ("Error reading file: yaml: Invalid data was encountered while parsing the file" message will be shown instead), because internal errors handling of tool is based on ErrorOr<> class which stores a error code and as a result can only show a predefined error string, what actually isn't very useful. In this patch, I rework obj2yaml's error reporting system for ELF targets to use Error Expected<> classes. Also, I improve the error message produced by getSymbol for demonstration of the new functionality. Differential revision: https://reviews.llvm.org/D64631 llvm-svn: 366058
* Revert r366052 "[obj2yaml] - Rework tool's error reporting logic for ELF ↵George Rimar2019-07-152-24/+2
| | | | | | | | | target." Seems it broke LLD: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/48434 llvm-svn: 366053
* [obj2yaml] - Rework tool's error reporting logic for ELF target.George Rimar2019-07-152-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | ELF.h contains two getSymbol methods which seems to be used only from obj2yaml. One of these methods calls another, which in turn contains untested error message which doesn't provide enough information. Problem is that after improving only just that message, obj2yaml will not show it, ("Error reading file: yaml: Invalid data was encountered while parsing the file" message will be shown instead), because internal errors handling of tool is based on ErrorOr<> class which stores a error code and as a result can only show a predefined error string, what actually isn't very useful. In this patch, I rework obj2yaml's error reporting system for ELF targets to use Error Expected<> classes. Also, I improve the error message produced by getSymbol for demonstration of the new functionality. Differential revision: https://reviews.llvm.org/D64631 llvm-svn: 366052
* [test/Object, obj2yaml] - Move test cases from test/Object and cleanup.George Rimar2019-07-126-0/+439
| | | | | | | | | | | | | | | test/Object is not correct place to have tests that check obj2yaml functionality, because we have test/tools/obj2yaml folder for that. In this patch I merged a few test cases with their YAMLs from Inputs folder, converted one of binary inputs and moved them to tools/obj2yaml folder. There are still another tests that might need the same, so it is initial step. Differential revision: https://reviews.llvm.org/D64555 llvm-svn: 365891
* [yaml2obj/obj2yaml] - Allow having the symbols and sections with duplicated ↵George Rimar2019-06-251-0/+152
| | | | | | | | | | | | names. The patch teaches yaml2obj/obj2yaml to support parsing/dumping the sections and symbols with the same name. A special suffix is added to a name to make it unique. Differential revision: https://reviews.llvm.org/D63596 llvm-svn: 364282
* [yaml2obj/obj2yaml] - Make RawContentSection::Info Optional<>George Rimar2019-06-191-0/+25
| | | | | | | | This allows to customize this field for "implicit" sections properly. Differential revision: https://reviews.llvm.org/D63487 llvm-svn: 363777
* [yaml2obj/obj2yaml] - Make RawContentSection::Content and ↵George Rimar2019-06-101-1/+0
| | | | | | | | | | | | | | | | RawContentSection::Size optional This is a follow-up for D62809. Content and Size fields should be optional as was discussed in comments of the D62809's thread. With that, we can describe a specific string table and symbol table sections in a more correct way and also show appropriate errors. The patch adds lots of test cases where the behavior is described in details. Differential revision: https://reviews.llvm.org/D62957 llvm-svn: 362931
* [llvm-objdump/llvm-readobj/obj2yaml/yaml2obj] Support DT_PPC_GOT and DT_PPC_OPTFangrui Song2019-06-051-4/+28
| | | | | | | | | | | | | | In glibc, DT_PPC_GOT indicates that PowerPC32 Secure PLT ABI is used. I plan to use it in D62464. DT_PPC_OPT currently indicates if a TLSDESC inspired TLS optimization is enabled. Reviewed By: grimar, jhenderson, rupprecht Differential Revision: https://reviews.llvm.org/D62851 llvm-svn: 362569
* [AArch64][ELF][llvm-readobj] Add support for BTI and PAC dynamic tagsPeter Smith2019-06-041-1/+25
| | | | | | | | | | | | | | | | | | | | | | | ELF for the 64-bit Arm Architecture defines two processor-specific dynamic tags: DT_AARCH64_BTI_PLT 0x70000001, d_val DT_AARCH64_PAC_PLT 0x70000003, d_val These presence of these tags indicate that PLT sequences have been protected using Branch Target Identification and Pointer Authentication respectively. The presence of both indicates that the PLT sequences have been protected with both Branch Target Identification and Pointer Authentication. This patch adds the tags and tests for llvm-readobj and yaml2obj. As some of the processor specific dynamic tags overlap, this patch splits them up, keeping their original default value if they were not previously mentioned explicitly in a switch case. Differential Revision: https://reviews.llvm.org/D62596 llvm-svn: 362493
* [XCOFF] Implement parsing symbol table for xcoffobjfile and output as yaml ↵Jason Liu2019-05-282-7/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | format Summary: This patch implement parsing symbol table for xcoffobjfile and output as yaml format. Parsing auxiliary entries of a symbol will be in a separate patch. The XCOFF object file (aix_xcoff.o) used in the test comes from -bash-4.2$ cat test.c extern int i; extern int TestforXcoff; int main() { i++; TestforXcoff--; } Patch by DiggerLin Reviewers: sfertile, hubert.reinterpretcast, MaskRay, daltenty Differential Revision: https://reviews.llvm.org/D61532 llvm-svn: 361832
* Minidump: Add support for the MemoryList streamPavel Labath2019-05-161-8/+16
| | | | | | | | | | | | | | | | | | Summary: the stream format is exactly the same as for ThreadList and ModuleList streams, only the entry types are slightly different, so the changes in this patch are just straight-forward applications of established patterns. Reviewers: amccarth, jhenderson, clayborg Subscribers: markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61885 llvm-svn: 360908
* [COFF] Fix .bss section size bug in obj2yaml / yaml2objReid Kleckner2019-05-101-0/+14
| | | | | | | | | We need to serialize SizeOfRawData through even when there is no data, as in a .bss section. Fixes PR41836 llvm-svn: 360473
* MinidumpYAML: add support for the ThreadList streamPavel Labath2019-05-091-32/+50
| | | | | | | | | | | | | | | | | | | Summary: The implementation is a pretty straightforward extension of the pattern used for (de)serializing the ModuleList stream. Since there are other streams which use the same format (MemoryList and MemoryList64, at least). I tried to generalize the code a bit so that adding future streams of this type can be done with less code. Reviewers: amccarth, jhenderson, clayborg Subscribers: markmentovai, lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61423 llvm-svn: 360350
* MinidumpYAML: Add support for ModuleList streamPavel Labath2019-04-181-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support for yaml (de)serialization of the minidump ModuleList stream. It's a fairly straight forward-application of the existing patterns to the ModuleList structures defined in previous patches. One thing, which may be interesting to call out explicitly is the addition of "new" allocation functions to the helper BlobAllocator class. The reason for this was, that there was an emerging pattern of a need to allocate space for entities, which do not have a suitable lifetime for use with the existing allocation functions. A typical example of that was the "size" of various lists, which is only available as a temporary returned by the .size() method of some container. For these cases, one can use the new set of allocation functions, which will take a temporary object, and store it in an allocator-managed buffer until it is written to disk. Reviewers: amccarth, jhenderson, clayborg, zturner Subscribers: lldb-commits, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60405 llvm-svn: 358672
* [yaml2elf/obj2yaml] - Allow normal parsing/dumping of the .rela.dyn sectionGeorge Rimar2019-04-181-0/+44
| | | | | | | | | | | | | | | .rela.dyn is a section that has sh_info normally set to zero. And Info is an optional field in the description of the relocation section in YAML. But currently, yaml2obj would fail to produce the object when Info is not explicitly listed. The patch fixes the issue. Differential revision: https://reviews.llvm.org/D60820 llvm-svn: 358656
* Minidump: Add support for reading/writing stringsPavel Labath2019-04-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Strings in minidump files are stored as a 32-bit length field, giving the length of the string in *bytes*, which is followed by the appropriate number of UTF16 code units. The string is also supposed to be null-terminated, and the null-terminator is not a part of the length field. This patch: - adds support for reading these strings out of the minidump file (this implementation does not depend on proper null-termination) - adds support for writing them to a minidump file - using the previous two pieces implements proper (de)serialization of the CSDVersion field of the SystemInfo stream. Previously, this was only read/written as hex, and no attempt was made to access the referenced string -- now this string is read and written correctly. The changes are tested via yaml2obj|obj2yaml round-trip as well as a unit test which checks the corner cases of the string deserialization logic. Reviewers: jhenderson, zturner, clayborg Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59775 llvm-svn: 357749
* [XCOFF] Add functionality for parsing AIX XCOFF object file headersHubert Tong2019-04-044-0/+13
| | | | | | | | | | | | | | | | | | | | | Summary: 1. Add functionality for parsing AIX XCOFF object files headers. 2. Only support 32-bit AIX XCOFF object files in this patch. 3. Print out the AIX XCOFF object file header in YAML format. Reviewers: sfertile, hubert.reinterpretcast, jasonliu, mstorsjo, zturner, rnk Reviewed By: sfertile, hubert.reinterpretcast Subscribers: jsji, mgorny, hiraditya, jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59419 Patch by Digger Lin llvm-svn: 357663
* [yaml2obj][obj2yaml] - Change how symbol's binding is descibed when ↵George Rimar2019-04-037-53/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parsing/dumping. Currently, YAML has the following syntax for describing the symbols: Symbols: Local: LocalSymbol1: ... LocalSymbol2: ... ... Global: GlobalSymbol1: ... Weak: ... GNUUnique: I.e. symbols are grouped by their bindings. That is not very convenient, because: It does not allow to set a custom binding, what can be useful for producing broken/special outputs for test cases. Adding a new binding would require to change a syntax (what we observed when added GNUUnique recently). It does not allow to change the order of the symbols in .symtab/.dynsym, i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique are following, but we are not able to change the order. It is not consistent. Binding is just one of the properties of the symbol, we do not group them by other properties. It makes the code more complex that it can be. This patch shows it can be simplified with the change performed. The patch changes the syntax to just: Symbols: Symbol1: ... Symbol2: ... ... With that, we are able to work with the binding field just like with any other symbol property. Differential revision: https://reviews.llvm.org/D60122 llvm-svn: 357595
* Add minidump support to obj2yamlPavel Labath2019-04-021-0/+35
| | | | | | | | | | | | | | | | | Summary: This patch adds the code needed to parse a minidump file into the MinidumpYAML model, and the necessary glue code so that obj2yaml can recognise the minidump files and process them. Reviewers: jhenderson, zturner, clayborg Subscribers: mgorny, lldb-commits, amccarth, markmentovai, aprantl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59634 llvm-svn: 357469
* [yaml2obj][obj2yaml] - Teach yaml2obj/obj2yaml tools about STB_GNU_UNIQUE ↵George Rimar2019-03-281-0/+30
| | | | | | | | | | | | | symbols. yaml2obj/obj2yaml does not support the symbols with STB_GNU_UNIQUE yet. Currently, obj2yaml fails with llvm_unreachable when met such a symbol. I faced it when investigated the https://bugs.llvm.org/show_bug.cgi?id=41196. Differential revision: https://reviews.llvm.org/D59875 llvm-svn: 357158
OpenPOWER on IntegriCloud