summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* llvm-readobj: Fix addend in relocations for android packed formatPeter Collingbourne2018-08-151-9/+6
| | | | | | | | | | | If a relocation group doesn't have the RELOCATION_GROUP_HAS_ADDEND_FLAG set, then this implies the group's addend equals zero. In this case android packed format won't encode an explicit addend delta, instead we need to set Addend, the "previous addend" variable, to zero by ourself. Patch by Yi-Yo Chiang! Differential Revision: https://reviews.llvm.org/D50601 llvm-svn: 339799
* [WASM] Fix overflow when reading custom sectionJonas Devlieghere2018-08-081-3/+10
| | | | | | | | | | | | | When reading a custom WASM section, it was possible that its name extended beyond the size of the section. This resulted in a bogus value for the section size due to the size overflowing. Fixes heap buffer overflow detected by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8190 Differential revision: https://reviews.llvm.org/D50387 llvm-svn: 339269
* Remove trailing spaceFangrui Song2018-07-301-1/+1
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
* [llvm-objdump] Add dynamic section printing to private-headers optionPaul Semel2018-07-251-0/+138
| | | | | | Differential Revision: https://reviews.llvm.org/D49016 llvm-svn: 337902
* Put "built-in" function definitions in global Used list, for LTO. (fix bug ↵Peter Collingbourne2018-07-241-1/+13
| | | | | | | | | | | | | | 34169) When building with LTO, builtin functions that are defined but whose calls have not been inserted yet, get internalized. The Global Dead Code Elimination phase in the new LTO implementation then removes these function definitions. Later optimizations add calls to those functions, and the linker then dies complaining that there are no definitions. This CL fixes the new LTO implementation to check if a function is builtin, and if so, to not internalize (and later DCE) the function. As part of this fix I needed to move the RuntimeLibcalls.{def,h} files from the CodeGen subidrectory to the IR subdirectory. I have updated all the files that accessed those two files to access their new location. Fixes PR34169 Patch by Caroline Tice! Differential Revision: https://reviews.llvm.org/D49434 llvm-svn: 337847
* [COFF] Use symbolic constants instead of hardcoded numbers. NFCI.Martin Storsjo2018-07-201-1/+6
| | | | | | Patch by Martell Malone. llvm-svn: 337614
* [COFF] Adjust how we flag weak externalsMartin Storsjo2018-07-202-6/+5
| | | | | | | | | | This fixes PR36096. Originally based on a patch by Martell Malone. Differential Revision: https://reviews.llvm.org/D44357 llvm-svn: 337613
* MC: Implement support for new .addrsig and .addrsig_sym directives.Peter Collingbourne2018-07-171-0/+1
| | | | | | | | | Part of the address-significance tables proposal: http://lists.llvm.org/pipermail/llvm-dev/2018-May/123514.html Differential Revision: https://reviews.llvm.org/D47744 llvm-svn: 337328
* [WebAssembly] Remove ELF file support.Sam Clegg2018-07-161-9/+0
| | | | | | | | | This support was partial and temporary. Now that we have wasm object file support its no longer needed. Differential Revision: https://reviews.llvm.org/D48744 llvm-svn: 337222
* [llvm-readobj] Add -hex-dump (-x) optionPaul Semel2018-07-112-0/+36
| | | | | | Differential Revision: https://reviews.llvm.org/D48281 llvm-svn: 336782
* [llvm-objdump] Add --file-headers (-f) optionPaul Semel2018-07-041-0/+6
| | | | llvm-svn: 336284
* [MC] Error on a .zerofill directive in a non-virtual sectionFrancis Visoiu Mistrih2018-07-022-2/+3
| | | | | | | | | | | | | | | On darwin, all virtual sections have zerofill type, and having a .zerofill directive in a non-virtual section is not allowed. Instead of asserting, show a nicer error. In order to use the equivalent of .zerofill in a non-virtual section, the usage of .zero of .space is required. This patch replaces the assert with an error. Differential Revision: https://reviews.llvm.org/D48517 llvm-svn: 336127
* [llvm-readobj] Add experimental support for SHT_RELR sectionsJake Ehrlich2018-06-281-0/+127
| | | | | | | | | | | | | | | This change adds experimental support for SHT_RELR sections, proposed here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg Definitions for the new ELF section type and dynamic array tags, as well as the encoding used in the new section are all under discussion and are subject to change. Use with caution! Author: rahulchaudhry Differential Revision: https://reviews.llvm.org/D47919 llvm-svn: 335922
* Fix MSVC "signed/unsigned mismatch" warning. NFCI.Simon Pilgrim2018-06-261-1/+1
| | | | llvm-svn: 335587
* [MachO] Add out-of-bounds check to MachOObjectFile.cppSam Clegg2018-06-041-0/+1
| | | | | | | | This is a followup to rL333496. Differential Revision: https://reviews.llvm.org/D47544 llvm-svn: 333929
* [MC] Add assembler support for .cg_profile.Michael J. Spencer2018-06-021-0/+1
| | | | | | | | | | | | | | | Object FIle Representation At codegen time this is emitted into the ELF file a pair of symbol indices and a weight. In assembly it looks like: .cg_profile a, b, 32 .cg_profile freq, a, 11 .cg_profile freq, b, 20 When writing an ELF file these are put into a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight). Differential Revision: https://reviews.llvm.org/D44965 llvm-svn: 333823
* MC: Remove redundant substr() callSam Clegg2018-05-302-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D47047 llvm-svn: 333496
* Fix build error introduced in rL333459Sam Clegg2018-05-291-2/+3
| | | | | | The DEBUG macro was renamed LLVM_DEBUG. llvm-svn: 333462
* [WebAssembly] Add more error checking to object file parsingSam Clegg2018-05-291-224/+240
| | | | | | | | | | This should address some of the assert failures the fuzzer has been finding such as: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6719 Differential Revision: https://reviews.llvm.org/D47086 llvm-svn: 333459
* [WebAssembly] Object: Add more error checking for object file readingSam Clegg2018-05-181-3/+9
| | | | | | | | | | This should address some the assert failures the fuzzer has been finding such as: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6719 Differential Revision: https://reviews.llvm.org/D47046 llvm-svn: 332769
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-181-4/+2
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* [NFC] WebAssembly build break #2JF Bastien2018-05-161-0/+4
| | | | | | | | | | | | | | | | | Summary: Same as r332530, move WasmSymbol::dump to an implementation file to avoid linker issues when the dump function is seen in the header, doesn't get eliminated, and then linking fails because of the missing dependency. <rdar://problem/40258137> Reviewers: sbc100, ncw, paquette, vsk, dschuff Subscribers: jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46985 llvm-svn: 332542
* [NFC] WebAssembly build fixJF Bastien2018-05-161-0/+13
| | | | | | | | | | | | | | | | | | | | | | Summary: r332305 added a use of llvm::wasm::toString in llvm::object::WasmSymbol::print, which is in a header file. It also moves toString to BinaryFormat. This has the unintended side-effect that any inclusion of Object/Wasm.h now relies on toString, and needs to required_libraries = BinaryFormat. Thankfully most builds don't fail with this because print just isn't used and gets eliminated, dropping the required dependency in the process. Not all builds are so lucky. Fix this issue by moving print to the corresponding .cpp file. <rdar://problem/40258137> Reviewers: sbc100, ncw, paquette Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46977 llvm-svn: 332530
* [WebAssembly] Provide WasmFunction content offset information.Sam Clegg2018-05-151-0/+1
| | | | | | | | | | | | | WasmObjectWriter mostly operates with function segments offsets that do not include their size fields. WasmObjectFile needs to have and provide this information to the lld to maintain proper R_WEBASSEMBLY_FUNCTION_OFFSET_I32 relocations entries. Patch by Yury Delendik Differential Revision: https://reviews.llvm.org/D46763 llvm-svn: 332406
* Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen2018-05-141-2/+2
| | | | | | | | | | | | | | | | The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
* [COFF] Improve correctness of def parsing for GNU featuresMartin Storsjo2018-05-092-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | The operator == used for exporting a function with a different name in the DLL compared to the name in the import library (which is useful for adding linker level aliases for function in the import library) is a feature distinct and different from the operator = used for exporting a function with a different name (both in import library and DLL) than in the implementation producing the DLL. When creating an import library using dlltool, from a def file that contains forwards (Func = OtherDll.Func), this shouldn't affect the produced import library, which should still behave just as if it was a normal exported function. This clears a lot of confusion and subtle misunderstandings, and avoids a parameter that was used to avoid creating weak aliases when invoked from lld. (This parameter was added previously due to the existing conflation of the two features.) Differential Revision: https://reviews.llvm.org/D46245 llvm-svn: 331859
* Object: Find terminator correctly when reading long filenames in GNU ↵Hans Wennborg2018-05-081-4/+8
| | | | | | | | | | | | archives (PR37244) The code was previously relying on there being a null terminator somewhere in (or after) the string table, something made less likely by r330786. Differential Revision: https://reviews.llvm.org/D46527 llvm-svn: 331746
* IWYU for llvm-config.h in llvm, additions.Nico Weber2018-04-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See r331124 for how I made a list of files missing the include. I then ran this Python script: for f in open('filelist.txt'): f = f.strip() fl = open(f).readlines() found = False for i in xrange(len(fl)): p = '#include "llvm/' if not fl[i].startswith(p): continue if fl[i][len(p):] > 'Config': fl.insert(i, '#include "llvm/Config/llvm-config.h"\n') found = True break if not found: print 'not found', f else: open(f, 'w').write(''.join(fl)) and then looked through everything with `svn diff | diffstat -l | xargs -n 1000 gvim -p` and tried to fix include ordering and whatnot. No intended behavior change. llvm-svn: 331184
* s/LLVM_ON_WIN32/_WIN32/, llvmNico Weber2018-04-291-1/+1
| | | | | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. This moves over all uses of the macro, but doesn't remove the definition of it in (llvm-)config.h yet. llvm-svn: 331127
* typoSam Clegg2018-04-271-2/+3
| | | | llvm-svn: 331006
* [WebAssembly] Section symbols must have local bindingSam Clegg2018-04-271-0/+4
| | | | | | | | | | Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D46160 llvm-svn: 331005
* [WebAssembly] Write DWARF data into wasm object fileSam Clegg2018-04-261-1/+35
| | | | | | | | | | | - Writes ".debug_XXX" into corresponding custom sections. - Writes relocation records into "reloc.debug_XXX" sections. Patch by Yury Delendik! Differential Revision: https://reviews.llvm.org/D44184 llvm-svn: 330982
* [WebAssembly] Add version to object file metadataSam Clegg2018-04-261-0/+8
| | | | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/issues/54 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46069 llvm-svn: 330969
* [WebAssembly] Implement getRelocationValueString()Sam Clegg2018-04-261-4/+8
| | | | | | | | And use it in llvm-objdump. Differential Revision: https://reviews.llvm.org/D46092 llvm-svn: 330957
* [WebAssebmly] Add Module name to WasmSymbolSam Clegg2018-04-251-0/+1
| | | | | | | | | | | | Imports in a wasm module can have custom module name. This change adds the module name to the WasmSymbol structure so that the linker can preserve this module name. This is needed to fix: https://bugs.llvm.org/show_bug.cgi?id=37168 Differential Revision: https://reviews.llvm.org/D45797 llvm-svn: 330854
* [WebAssembly] Use section index in relocation section headerSam Clegg2018-04-241-29/+6
| | | | | | | | | | | Rather than referring to sections my their code, use the absolute index of the target section within the module. See https://github.com/WebAssembly/tool-conventions/issues/52 Differential Revision: https://reviews.llvm.org/D45980 llvm-svn: 330749
* Fix computeSymbolSizes SEGFAULT on invalid fileAdrian Prantl2018-04-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | We use llvm-symbolizer in some production systems, and we run it against all possibly related files, including some that are not ELF. We noticed that for some of those invalid files, llvm-symbolizer would crash with SEGFAULT. Here is an example of such a file. It is due to that in computeSymbolSizes, a loop uses condition for (unsigned I = 0, N = Addresses.size() - 1; I < N; ++I) { where if Addresses.size() is 0, N would overflow and causing the loop to access invalid memory. Instead of patching the loop conditions, the commit makes so that the function returns early if Addresses is empty. Validated by checking that llvm-symbolizer no longer crashes. Patch by Teng Qin! Differential Revision: https://reviews.llvm.org/D44285 llvm-svn: 330610
* [WebAssembly] Distinguish debug/symbol names in the Wasm structs. NFCNicholas Wilson2018-04-201-15/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D45021 llvm-svn: 330448
* LowerTypeTests: Propagate symver directivesVlad Tsyrklevich2018-04-203-36/+64
| | | | | | | | | | | | | | | | | | | | | | Summary: This change fixes https://crbug.com/834474, a build failure caused by LowerTypeTests not preserving .symver symbol versioning directives for exported functions. Emit symver information to ThinLTO summary data and then propagate symver directives for exported functions to the merged module. Emitting symver information to the summaries increases the size of intermediate build artifacts for a Chromium build by less than 0.2%. Reviewers: pcc Reviewed By: pcc Subscribers: tejohnson, mehdi_amini, eraman, llvm-commits, eugenis, kcc Differential Revision: https://reviews.llvm.org/D45798 llvm-svn: 330387
* [llvm-objdump] Print "..." instead of random data for virtual sectionsFrancis Visoiu Mistrih2018-04-191-2/+4
| | | | | | | | | | | | | | | | | When disassembling with -D, skip virtual sections by printing "..." for each symbol. This patch also implements `MachOObjectFile::isSectionVirtual`. Test case comes from: ``` .zerofill __DATA,__common,_data64unsigned,472,3 ``` Differential Revision: https://reviews.llvm.org/D45824 llvm-svn: 330342
* COFF: Make SectionChunk::Relocs field an ArrayRef. NFCI.Peter Collingbourne2018-04-171-6/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D45714 llvm-svn: 330172
* [WebAssembly] libObject: Don't include the name the size of custom sectionsSam Clegg2018-04-121-1/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D45579 llvm-svn: 329947
* [NFC] fix trivial typos in documents and commentsHiroshi Inoue2018-04-121-1/+1
| | | | | | "is is" -> "is", "if if" -> "if", "or or" -> "or" llvm-svn: 329878
* Object: Don't mark alias unconditionally definedVitaly Buka2018-04-101-1/+4
| | | | | | | | | | | | | | Summary: Can't remove EmitAssignment override as llvm/test/Object/X86/nm-bitcodeweak.test expects this behavior. Reviewers: pcc, espindola Subscribers: mehdi_amini, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D44596 llvm-svn: 329651
* [llvm-ar] Support multiple dashed optionsPeter Collingbourne2018-03-281-9/+13
| | | | | | | | | | | | | | | This allows syntax like: $ llvm-ar -c -r -u file.a file.o This is in addition to the other formats that are already supported: $ llvm-ar cru file.a file.o $ llvm-ar -cru file.a file.o Patch by Tom Anderson! Differential Revision: https://reviews.llvm.org/D44452 llvm-svn: 328716
* Sink Analysis/ObjectUtil(canBeOmittedFromSymbolTable) into IR so it can be ↵David Blaikie2018-03-211-2/+1
| | | | | | legitimately be used by Object/IRSymtab llvm-svn: 328135
* Object: Fix handling of @@@ in .symver directiveVitaly Buka2018-03-201-10/+37
| | | | | | | | | | | | | | | | | Summary: name@@@nodename is going to be replaced with name@@nodename if symbols is defined in the assembled file, or name@nodename if undefined. https://sourceware.org/binutils/docs/as/Symver.html Fixes PR36623 Reviewers: pcc, espindola Subscribers: mehdi_amini, hiraditya Differential Revision: https://reviews.llvm.org/D44274 llvm-svn: 327930
* Object: Move attribute calculation into RecordStreamer. NFCVitaly Buka2018-03-203-97/+94
| | | | | | | | | | | | Summary: Preparation for D44274 Reviewers: pcc, espindola Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D44276 llvm-svn: 327928
* [WebAssembly] Identify COMDATs by index rather than string. NFCNicholas Wilson2018-03-141-6/+11
| | | | | | | | This will enable an optimisation in LLD. Differential Revision: https://reviews.llvm.org/D44343 llvm-svn: 327522
* Delay creating an alias for @@@.Rafael Espindola2018-03-092-2/+4
| | | | | | | | | | | With this we only create an alias for @@@ once we know if it should use @ or @@. This avoids last minutes renames and hacks to handle MS names. This only handles the ELF writer. LTO still has issues with @@@ aliases. llvm-svn: 327160
OpenPOWER on IntegriCloud