summaryrefslogtreecommitdiff
path: root/test/Object
Commit message (Collapse)AuthorAge
* [ELF][Mips] Fix recognition of MIPS 64-bit arch in the ↵Simon Atanasyan2014-06-27
| | | | | | ELFObjectFile:getArch() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211891 91177308-0d34-0410-b5e6-96231b3b80d8
* nm-trivial-object.test requires shell since Lit internal runner isn't ↵NAKAMURA Takumi2014-06-23
| | | | | | capable of chdir. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211537 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the default input for llvm-nm to be a.out instead of standard inputKevin Enderby2014-06-23
| | | | | | | | | | to match llvm-size and other UNIX systems for their nm(1). Tweak test cases that used llvm-nm with standard input to add a "-" to indicate that and add a test case to check the default of a.out for llvm-nm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211529 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some double printing of filenames for archives in llvm-nm whenKevin Enderby2014-06-20
| | | | | | | | | the tool is given multiple files. Also fix the same issue with Mach-O universal files. And fix the newline spacing to separate the output in these cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211405 91177308-0d34-0410-b5e6-96231b3b80d8
* Added the -m option as an alias for -format=darwin to llvm-nm and llvm-sizeKevin Enderby2014-06-20
| | | | | | | which is what the darwin tools use for the Mach-O format output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211326 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the output of llvm-nm for Mach-O files to use the characters ‘d’ and ↵Kevin Enderby2014-06-19
| | | | | | | | | ‘b’ for data and bss symbols instead of the generic ’s’ for a symbol in a section. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211321 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the output of llvm-nm and llvm-size for Mach-O universal files (akaKevin Enderby2014-06-19
| | | | | | | | | | | fat files) to print “ (for architecture XYZ)” for fat files with more than one architecture to be like what the darwin tools do for fat files. Also clean up the Mach-O printing of archive membernames in llvm-nm to use the darwin form of "libx.a(foo.o)". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211316 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach llvm-size to know about Mach-O universal files (aka fat files) andKevin Enderby2014-06-18
| | | | | | | | | | | fat files containing archives. Also fix a bug in MachOUniversalBinary::ObjectForArch::ObjectForArch() where it needed a >= when comparing the Index with the number of objects in a fat file. As the index starts at 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211230 91177308-0d34-0410-b5e6-96231b3b80d8
* Add "-format darwin" to llvm-size to be like darwin's size(1) -m output, andKevin Enderby2014-06-17
| | | | | | | | | | | | | | | | and the -l option for the long format. Also when the object is a Mach-O file and the format is berkeley produce output like darwin’s default size(1) summary berkeley derived output. Like System V format, there are also some small changes in how and where the file names and archive member names are printed for darwin and Mach-O. Like the changes to llvm-nm these are the first steps in seeing if it is possible to make llvm-size produce the same output as darwin's size(1). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211117 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix pr17056.Rafael Espindola2014-06-16
| | | | | | | | | | | | | This makes llvm-nm ignore members that are not sufficiently aligned for lib/Object to handle. These archives are invalid. GNU AR is able to handle this, but in general just warns about broken archive members. We should probably start warning too, but for now just make sure llvm-nm exits with an 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211036 91177308-0d34-0410-b5e6-96231b3b80d8
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of this patch is to turn llvm/Support/system_error.h into a transitional header that just brings in the erorr_code api to the llvm namespace. I will remove it shortly afterwards. The cases where the general idea needed some tweaking: * std::errc is a namespace in msvc, so we cannot use "using std::errc". I could add an #ifdef, but there were not that many uses, so I just added std:: to them in this patch. * Template specialization had to be moved to the std namespace in this patch set already. * The msvc implementation of default_error_condition doesn't seem to provide the same transformations as we need. Not too surprising since the standard doesn't actually say what "equivalent" means. I fixed the problem by keeping our old mapping and using it at error_code construction time. Despite these shortcomings I think this is still a good thing. Some reasons: * The different implementations of system_error might improve over time. * It removes 925 lines of code from llvm already. * It removes 6313 bytes from the text segment of the clang binary when it is built with gcc and 2816 bytes when building with clang and libstdc++. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210687 91177308-0d34-0410-b5e6-96231b3b80d8
* Reduce verbiage of lit.local.cfg filesAlp Toker2014-06-09
| | | | | | We can just split targets_to_build in one place and make it immutable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210496 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][obj2yaml] Support ELF symbol's visibility flags ↵Simon Atanasyan2014-06-06
| | | | | | (default/hidden/protected). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210316 91177308-0d34-0410-b5e6-96231b3b80d8
* Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.Kevin Enderby2014-06-05
| | | | | | | | | | | | | | | | This is a first step in seeing if it is possible to make llvm-nm produce the same output as darwin's nm(1). Darwin's default format is bsd but its -m output prints the longer Mach-O specific details. For now I added the "-format darwin" to do this (whos name may need to change in the future). As there are other Mach-O specific flags to nm(1) which I'm hoping to add some how in the future. But I wanted to see if I could get the correct output for -m flag using llvm-nm and the libObject interfaces. I got this working but would love to hear what others think about this approach to getting object/format specific details printed with llvm-nm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210285 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add new command line option `-docnum`.Simon Atanasyan2014-05-31
| | | | | | | | | | Input YAML file might contain multiple object file definitions. New option `-docnum` allows to specify an ordinal number (starting from 1) of definition used for an object file generation. Patch reviewed by Sean Silva. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209967 91177308-0d34-0410-b5e6-96231b3b80d8
* [elf2yaml][ELF] Move Info field to the RelocationSection structure. ThisSimon Atanasyan2014-05-29
| | | | | | | field represents ELF section header sh_info field and does not have any sense for regular sections. Its interpretation depends on section type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209801 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm/test/Object/ar-error.test: Don't check the message "No such file or ↵NAKAMURA Takumi2014-05-24
| | | | | | | | directory". It didn't match on non-English version of Windows. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209570 91177308-0d34-0410-b5e6-96231b3b80d8
* [YAML] Add an optional argument `EnumMask` to the `yaml::IO::bitSetCase()`.Simon Atanasyan2014-05-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some bit-set fields used in ELF file headers in fact contain two parts. The first one is a regular bit-field. The second one is an enumeraion. For example ELF header `e_flags` for MIPS target might contain the following values: Bit-set values: EF_MIPS_NOREORDER = 0x00000001 EF_MIPS_PIC = 0x00000002 EF_MIPS_CPIC = 0x00000004 EF_MIPS_ABI2 = 0x00000020 Enumeration: EF_MIPS_ARCH_32 = 0x50000000 EF_MIPS_ARCH_64 = 0x60000000 EF_MIPS_ARCH_32R2 = 0x70000000 EF_MIPS_ARCH_64R2 = 0x80000000 For printing bit-sets we use the `yaml::IO::bitSetCase()`. It does not support bit-set/enumeration combinations and prints too many flags from an enumeration part. This patch fixes this problem. New method `yaml::IO::maskedBitSetCase()` handle "enumeration" part of bitset defined by provided mask. Patch reviewed by Nick Kledzik and Sean Silva. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209504 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm-ar: Output the file we errored on.Filipe Cabecinhas2014-05-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209500 91177308-0d34-0410-b5e6-96231b3b80d8
* Update MachOObjectFile::getSymbolAddress so it returns UnknownAddressOrSizeKevin Enderby2014-05-20
| | | | | | | | | | | | | for undefined symbols, so it matches what COFFObjectFile::getSymbolAddress does. This allows llvm-nm to print spaces instead of 0’s for the value of undefined symbols in Mach-O files. To make this change other uses of MachOObjectFile::getSymbolAddress are updated to handle when the Value is returned as UnknownAddressOrSize. Which is needed to keep two of the ExecutionEngine tests working for example. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209253 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r209235 as it broke two tests:Kevin Enderby2014-05-20
| | | | | | | | | Failing Tests (2): LLVM :: ExecutionEngine/MCJIT/stubs-sm-pic.ll LLVM :: ExecutionEngine/MCJIT/stubs.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209236 91177308-0d34-0410-b5e6-96231b3b80d8
* Update MachOObjectFile::getSymbolAddress so it returns UnknownAddressOrSizeKevin Enderby2014-05-20
| | | | | | | | for undefined symbols. Allowing llvm-nm to print spaces instead of 0’s for the value of undefined symbols in Mach-O files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209235 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement MachOObjectFile::isSectionData() and MachOObjectFile::isSectionBSSKevin Enderby2014-05-19
| | | | | | | | | so that llvm-size will total up all the sections in the Berkeley format. This allows for rough categorizations for Mach-O sections. And allows the total of llvm-size’s Berkeley and System V formats to be the same. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209158 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] Add an optional `Size` field to the YAML section declaration.Simon Atanasyan2014-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the only method to configure ELF section's content and size is to assign a hexadecimal string to the `Content` field. Unfortunately this way is completely useless when you need to declare a really large section. To solve this problem this patch adds one more optional field `Size` to the `RawContentSection` structure. When yaml2obj generates an ELF file it uses the following algorithm: 1. If both `Content` and `Size` fields are missed create an empty section. 2. If only `Content` field is missed take section length from the `Size` field and fill the section by zero. 3. If only `Size` field is missed create a section using data from the `Content` field. 4. If both `Content` and `Size` fields are provided validate that the `Size` value is not less than size of `Content` data. Than take section length from the `Size`, fill beginning of the section by `Content` and the rest by zero. Examples -------- * Create a section 0x10000 bytes long filled by zero Name: .data Type: SHT_PROGBITS Flags: [ SHF_ALLOC ] Size: 0x10000 * Create a section 0x10000 bytes long starting from 'CA' 'FE' 'BA' 'BE' Name: .data Type: SHT_PROGBITS Flags: [ SHF_ALLOC ] Content: CAFEBABE Size: 0x10000 The patch reviewed by Michael Spencer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208995 91177308-0d34-0410-b5e6-96231b3b80d8
* [obj2yaml][ELF] Print relocation's offset as a hex number. Use a properSimon Atanasyan2014-05-15
| | | | | | types to hold relocation's offset and addend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208906 91177308-0d34-0410-b5e6-96231b3b80d8
* [obj2yaml][ELF] Do not print empty Link and Info fields for ELF sections.Simon Atanasyan2014-05-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208905 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add "-o" command line option to specify an output file name.Simon Atanasyan2014-05-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208900 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach llvm-nm to know about fat archives (aka MachOUniversal filesKevin Enderby2014-05-14
| | | | | | | containing archives). First step as other tools will be updated next. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208812 91177308-0d34-0410-b5e6-96231b3b80d8
* [obj2yaml] Support ELF input format in the obj2yaml tool.Simon Atanasyan2014-05-14
| | | | | | | | | | The ELF header e_flags field in the MIPS related test cases handled incorrectly. The obj2yaml prints too many flags. I will fix that in the next patches. The patch reviewed by Michael Spencer and Sean Silva. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208752 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix llvm-nm to print the full 64-bit address for symbols in 64-bit object files.Kevin Enderby2014-05-09
| | | | | | | | | | | | | | | The implementation might be better to have a method is64Bit() in the class SymbolicFile instead of having the static routine isSymbolList64Bit() in llvm-nm.cpp . But this is very much in the sprit of isObject() and getNMTypeChar() in llvm-nm.cpp that has a series of if else statements based on the specific class of the SymbolicFile. I can update this if folks would like. Also the tests were updated to be explicit about checking the address for 64-bits or 32-bits from object files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208463 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Follow-up to the r208228 and r208406. Remove duplicated YAMLSimon Atanasyan2014-05-09
| | | | | | map keys. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208412 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark yaml2obj-elf-x86-rel.yaml as XFAIL:vg_leak for now. This has two pairs ↵NAKAMURA Takumi2014-05-09
| | | | | | of duplicate hashes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208406 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Support ELF x86 relocations.Simon Atanasyan2014-05-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208228 91177308-0d34-0410-b5e6-96231b3b80d8
* [llvm-readobj] Add support for Mips specific ELF header e_flags.Simon Atanasyan2014-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207744 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new StringTableBuilder in yaml2elfHans Wennborg2014-04-30
| | | | | | http://reviews.llvm.org/D3574 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207694 91177308-0d34-0410-b5e6-96231b3b80d8
* Update tests to use the new format of printing a TimeValue. It's a bitChandler Carruth2014-04-28
| | | | | | | | | | | | odd to have the output of 'llvm-ar tv' depend on the format of TimeValue::str(), but that's what we have today. If anyone needs the output to remain compatible with GNU ar or old versions of llvm-ar, just shout and I'll switch the code to manually format its times. Note that there isn't a portable format -- Mac and GNU have different formats at least (thanks Rafael!) so... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207387 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj][ELF] ELF Relocations Support.Simon Atanasyan2014-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch implements support for both relocation record formats: Elf_Rel and Elf_Rela. It is possible to define relocation against symbol only. Relocations against sections will be implemented later. Now yaml2obj recognizes X86_64, MIPS and Hexagon relocation types. Example of relocation section specification: Sections: - Name: .text Type: SHT_PROGBITS Content: "0000000000000000" AddressAlign: 16 Flags: [SHF_ALLOC] - Name: .rel.text Type: SHT_REL Info: .text AddressAlign: 4 Relocations: - Offset: 0x1 Symbol: glob1 Type: R_MIPS_32 - Offset: 0x2 Symbol: glob2 Type: R_MIPS_CALL16 The patch reviewed by Michael Spencer, Sean Silva, Shankar Easwaran. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206017 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Allow scalars to dictate quotation rulesDavid Majnemer2014-04-10
| | | | | | | Introduce ScalarTraits::mustQuote which determines whether or not a StringRef needs quoting before it is acceptable to output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205955 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly""David Majnemer2014-04-09
| | | | | | | | | Don't quote octal compatible strings if they are only two wide, they aren't ambiguous. This reverts commit r205857 which reverted r205857. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205914 91177308-0d34-0410-b5e6-96231b3b80d8
* obj2yaml: Don't crash if the characteristics field is zeroDavid Majnemer2014-04-09
| | | | | | | | | obj2yaml would fail when seeing a Weak External auxiliary record with a characteristics field holding zero instead of one of IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY, IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY, or IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205911 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "YAMLIO: Encode ambiguous hex strings explicitly"Filipe Cabecinhas2014-04-09
| | | | | | | | This reverts commit r205839. It broke several tests in lld. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205857 91177308-0d34-0410-b5e6-96231b3b80d8
* YAMLIO: Encode ambiguous hex strings explicitlyDavid Majnemer2014-04-09
| | | | | | | | | | YAMLIO would turn a BinaryRef into the string 0000000004000000. However, the leading zero causes parsers to interpret it as being an octal number instead of a hexadecimal one. Instead, escape such strings as needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205839 91177308-0d34-0410-b5e6-96231b3b80d8
* obj2yaml: Use the correct relocation type for different machine typesDavid Majnemer2014-04-07
| | | | | | | | | | | | | The IO normalizer would essentially lump I386 and AMD64 relocations together. Relocation types with the same numeric value would then get mapped in appropriately. For example: IMAGE_REL_AMD64_ADDR64 and IMAGE_REL_I386_DIR16 both have a numeric value of one. We would see IMAGE_REL_I386_DIR16 in obj2yaml conversions of object files with a machine type of IMAGE_FILE_MACHINE_AMD64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205746 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement getRelocationAddress for MachO and ET_REL elf files.Rafael Espindola2014-04-03
| | | | | | With that, fix the symbolizer to work with any ELF file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205588 91177308-0d34-0410-b5e6-96231b3b80d8
* Only clear the thumb bit from function addresses.Rafael Espindola2014-04-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205500 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Fix a nomenclature error in llvm-nm."Rafael Espindola2014-04-03
| | | | | | | | | | | | | | | | This reverts commit r205479. It turns out that nm does use addresses, it is just that every reasonable relocatable ELF object has sections with address 0. I have no idea if those exist in reality, but it at least it shows that llvm-nm should use the name address. The added test was includes an unusual .o file with non 0 section addresses. I created it by hacking ELFObjectWriter.cpp. Really sorry for the churn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205493 91177308-0d34-0410-b5e6-96231b3b80d8
* [yaml2obj] Add support for ELF e_flags.Daniel Sanders2014-03-31
| | | | | | | | | | | | | | | | Summary: The FileHeader mapping now accepts an optional Flags sequence that accepts the EF_<arch>_<flag> constants. When not given, Flags defaults to zero. Reviewers: atanasyan Reviewed By: atanasyan CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3213 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205173 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach llvm-readobj to print human friendly description of reserved sections.Rafael Espindola2014-03-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204584 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Output .file symbols properlyDavid Majnemer2014-03-20
| | | | | | | obj2yaml would emit the NUL bytes padding the auxiliary file symbol records. Trimming them looks nicer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204314 91177308-0d34-0410-b5e6-96231b3b80d8
* Object: Provide a richer means of describing auxiliary symbolsDavid Majnemer2014-03-19
| | | | | | | | | | | | | | | | The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204214 91177308-0d34-0410-b5e6-96231b3b80d8