summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/MachO
Commit message (Collapse)AuthorAgeFilesLines
...
* Reverting back r285355: "Update .debug_line section version information to ↵Ekaterina Romanova2016-10-273-12/+12
| | | | | | match DWARF version", while I'm investigating a test failure. llvm-svn: 285362
* Update .debug_line section version information to match DWARF version.Ekaterina Romanova2016-10-273-12/+12
| | | | | | | | | | In the past the compiler always emitted .debug_line version 2, though some opcodes from DWARF 3 (e.g. DW_LNS_set_prologue_end, DW_LNS_set_epilogue_begin or DW_LNS_set_isa) and from DWARF 4 could be emitted by the compiler. This patch changes version information of .debug_line to exactly match the DWARF version. For .debug_line version 4, a new field maximum_operations_per_instruction is emitted. Differential Revision: https://reviews.llvm.org/D16697 llvm-svn: 285355
* CodeGen: Use PLT relocations for relative references to unnamed_addr functions.Peter Collingbourne2016-04-221-1/+1
| | | | | | | | | | | | | The relative vtable ABI (PR26723) needs PLT relocations to refer to virtual functions defined in other DSOs. The unnamed_addr attribute means that the function's address is not significant, so we're allowed to substitute it with the address of a PLT entry. Also includes a bonus feature: addends for COFF image-relative references. Differential Revision: http://reviews.llvm.org/D17938 llvm-svn: 267211
* MachO: enable .data_region directives everywhereTim Northover2016-04-213-107/+96
| | | | | | | | | | We'd disabled them on x86 because back in the early days some host tools couldn't handle the new load commands. This no longer holds: anyone capable of deploying Clang should be able to deploy its copies of ar/ranlib/etc. rdar://25254790 llvm-svn: 267075
* AsmParser: record "# line file" context to calculate location for diagTim Northover2016-04-131-1/+3
| | | | | | | | | | | Since we can't emit diagnostics for missing "jmp 1f" labels until the end of the file, we need to be able to restore the context used to calculate file/line. This is basically the "# line file" directive that's being used at the time the expression is seen. rdar://25706972 llvm-svn: 266238
* MCParser: diagnose missing directional labels more clearly.Tim Northover2016-04-111-0/+9
| | | | | | | | Before, ELF at least managed a diagnostic but it was a completely untraceable "undefined symbol" error. MachO had a variety of even worse behaviours: crash, emit corrupt file, or an equally bad message. llvm-svn: 265984
* Add missing emissionKind flags to the DICompileUnits of several old testcases.Adrian Prantl2016-04-011-1/+1
| | | | llvm-svn: 265192
* [MachO] Extend the alt_entry support for aliases added in r263521 toLang Hames2016-03-151-23/+45
| | | | | | expressions of the form 'a = .' and 'a = Ltmp'. llvm-svn: 263528
* [MachO] Add MachO alt-entry directive support.Lang Hames2016-03-154-8/+67
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the MachO .alt_entry assembly directive, and uses it for global aliases with non-zero GEP offsets. The alt_entry flag indicates that a symbol should be layed out immediately after the preceding symbol. Conceptually it introduces an alternate entry point for a function or data structure. E.g.: safe_foo: // check preconditions for foo .alt_entry fast_foo fast_foo: // body of foo, can assume preconditions. The .alt_entry flag is also implicitly set on assembly aliases of the form: a = b + C where C is a non-zero constant, since these have the same effect as an alt_entry symbol: they introduce a label that cannot be moved relative to the preceding one. Setting the alt_entry flag on aliases of this form fixes http://llvm.org/PR25381. llvm-svn: 263521
* [AArch64] Refactor AArch64FrameLowering::emitPrologue. NFC.Chad Rosier2016-03-141-6/+6
| | | | | | | http://reviews.llvm.org/D18125 Patch by Aditya Kumar. llvm-svn: 263461
* Form reform for MCDwarf.Paul Robinson2015-12-231-2/+2
| | | | | | | | | MCDwarf emits a canned abbreviation table, but was not emitting proper forms for DWARF version 4, which is the default after r249655. Differential Revision: http://reviews.llvm.org/D15732 llvm-svn: 256313
* [MC] Add a test for state reset in MCMachOStreamerKeno Fischer2015-12-051-0/+12
| | | | | | | | This was fixed in r254751, but untestable until r254774, which added the necessary command line flag to llc. Add a test now to make sure this doesn't regress again. llvm-svn: 254814
* [Assembler] Make fatal assembler errors non-fatalOliver Stannard2015-11-175-13/+25
| | | | | | | | | | | | | | Currently, if the assembler encounters an error after parsing (such as an out-of-range fixup), it reports this as a fatal error, and so stops after the first error. However, for most of these there is an obvious way to recover after emitting the error, such as emitting the fixup with a value of zero. This means that we can report on all of the errors in a file, not just the first one. MCContext::reportError records the fact that an error was encountered, so we won't actually emit an object file with the incorrect contents. Differential Revision: http://reviews.llvm.org/D14717 llvm-svn: 253328
* MachO: support tvOS and watchOS version min commands in llvm-objdumpTim Northover2015-11-021-3/+2
| | | | llvm-svn: 251834
* MachO: improve load command tests slightlyTim Northover2015-11-022-4/+22
| | | | llvm-svn: 251815
* ARM: add support for WatchOS's compact unwind information.Tim Northover2015-10-281-0/+124
| | | | llvm-svn: 251573
* ARM: support .watchos_version_min and .tvos_version_min.Tim Northover2015-10-285-6/+119
| | | | | | | | These MachO file directives are used by linkers and other tools to provide compatibility information, much like the existing .ios_version_min and .macosx_version_min. llvm-svn: 251569
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-153-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r250342: move coal-sections-powerpc.s to subdirectory for powerpc. Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250370
* Revert r250349.Akira Hatanaka2015-10-152-94/+0
| | | | | | Test case coal-sections-powerpc.s is still failing on some buildbots. llvm-svn: 250351
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-142-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recommit r250342: add -arch=ppc32 to the RUN lines of powerpc tests. Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250349
* Revert r250342.Akira Hatanaka2015-10-142-94/+0
| | | | | | Investigate why coal-sections-powerpc.s is failing on some buildbots. llvm-svn: 250346
* [MachO] Stop generating *coal* sections.Akira Hatanaka2015-10-142-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some background on why we don't have to use *coal* sections anymore: Long ago when C++ was new and "weak" had not been standardized, an attempt was made in cctools to support C++ inlines that can be coalesced by putting them into their own section (TEXT/textcoal_nt instead of TEXT/text). The current macho linker supports the weak-def bit on any symbol to allow it to be coalesced, but the compiler still puts weak-def functions/data into alternate section names, which the linker must map back to the base section name. This patch makes changes that are necessary to prevent the compiler from using the "coal" sections and have it use the non-coal sections instead when the target architecture is not powerpc: TEXT/textcoal_nt instead use TEXT/text TEXT/const_coal instead use TEXT/const DATA/datacoal_nt instead use DATA/data If the target is powerpc, we continue to use the *coal* sections since anyone targeting powerpc is probably using an old linker that doesn't have support for the weak-def bits. Also, have the assembler issue a warning if it encounters a *coal* section in the assembly file and inform the users to use the non-coal sections instead. rdar://problem/14265330 Differential Revision: http://reviews.llvm.org/D13188 llvm-svn: 250342
* [MC] Convert all the remaining tests from macho-dump to llvm-readobj.Davide Italiano2015-09-1037-4561/+5023
| | | | | | | | | This sort-of deprecates macho-dump. It may take still a little while to garbage collect it, but at least there's no real usage of it in the tree anymore. New tests should always rely on llvm-readobj or llvm-objdump. llvm-svn: 247235
* [llvm-readobj] MachO -- dump LinkerOptions load command.Davide Italiano2015-09-092-49/+35
| | | | | | | | | | | | | | | | | | | | Example output: Linker Options { Size: 32 Count: 2 Strings [ Value: -framework Value: Cocoa ] } There were only two tests using this -- so I converted them as part of this commit rather than separately. Differential Revision: http://reviews.llvm.org/D12702 llvm-svn: 247106
* [MC] Convert other MachO tests from macho-dump to llvm-readobj.Davide Italiano2015-09-0523-2603/+3261
| | | | | | | | | | | | | | | This commit accomplish two goals: 1) it's a step forward to deprecate macho-dump, now less than 40 tests rely on it. 2) It tests all the MachO specific features introduced in llvm-readobj in the following commits: r246789, r246665, r246474. While the conversion is mostly mechanical (I double-checked all the tests output one by one, but still), a post-commit review is greatly appreciated. llvm-svn: 246904
* [MC] Convert tests to use llvm-readobj --macho-version-min.Davide Italiano2015-08-282-12/+24
| | | | | | As an added bonus this also tests the newly introduced feature. llvm-svn: 246296
* [llvm-readobj] Test --macho-data-in-code option.Davide Italiano2015-08-221-18/+35
| | | | | | | As added bonus this converts an existing test from macho-dump to llvm-readobj. Only 66 to go. llvm-svn: 245791
* [MC] Convert another bunch of tests from macho-dump to llvm-readobj.Davide Italiano2015-08-1812-68/+196
| | | | | | | | This is (almost) everything under MC/MachO/ARM. There are still some cases missing, because llvm-readobj doesn't (yet) support some features, that macho-dump provides. I plan to reduce the gap between them shortly. llvm-svn: 245302
* Force the MachO generated for Darwin to have VERSION_MIN load commandSteven Wu2015-08-0540-415/+435
| | | | | | | | | On Darwin, it is required to stamp the object file with VERSION_MIN load command. This commit will provide a VERSRION_MIN load command to the MachO file that doesn't specify the version itself by inferring from Target Triple. llvm-svn: 244059
* [AsmPrinter] Check for valid constants in handleIndirectSymViaGOTPCRelBruno Cardoso Lopes2015-07-211-3/+9
| | | | | | | | | Check whether BaseCst is valid before extracting a GlobalValue. This fixes PR24163. Patch by David Majnemer. llvm-svn: 242840
* Reworking the test part of r241149Gabor Ballabas2015-07-021-0/+10
| | | | | | | | | The test part of r241149 has been reverted in r241451, due to misplaced test cases. This patch splits those test cases among the appropriate targets. Differential Revision: http://reviews.llvm.org/D10897 llvm-svn: 241283
* [AsmPrinter] Fix crash in handleIndirectSymViaGOTPCRelBruno Cardoso Lopes2015-06-251-0/+9
| | | | | | | | | | | Check for symbols in MCValue before using them. Bail out early in case they are null. This fixes PR23779. Differential Revision: http://reviews.llvm.org/D10712 rdar://problem/21532830 llvm-svn: 240649
* Revert r240302 ("Bring r240130 back.").Daniel Jasper2015-06-237-52/+52
| | | | | | | | | | | | | This causes errors like: ld: error: blah.o: requires dynamic R_X86_64_PC32 reloc against '' which may overflow at runtime; recompile with -fPIC blah.cc:function f(): error: undefined reference to '' blah.o:g(): error: undefined reference to '' I have not yet come up with an appropriate reproduction. llvm-svn: 240394
* Bring r240130 back.Rafael Espindola2015-06-227-52/+52
| | | | | | | | | | | | | | | | | | | | | | Now that pr23900 is fixed, we can bring it back with no changes. Original message: Make all temporary symbols unnamed. What this does is make all symbols that would otherwise start with a .L (or L on MachO) unnamed. Some of these symbols still show up in the symbol table, but we can just make them unnamed. In order to make sure we produce identical results when going thought assembly, all .L (not just the compiler produced ones), are now unnamed. Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to 205.57MB. llvm-svn: 240302
* Revert 240130, it caused crashes (repro in PR23900).Nico Weber2015-06-197-52/+52
| | | | llvm-svn: 240193
* Make all temporary symbols unnamed.Rafael Espindola2015-06-197-52/+52
| | | | | | | | | | | | | | | | What this does is make all symbols that would otherwise start with a .L (or L on MachO) unnamed. Some of these symbols still show up in the symbol table, but we can just make them unnamed. In order to make sure we produce identical results when going thought assembly, all .L (not just the compiler produced ones), are now unnamed. Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to 205.57MB. llvm-svn: 240130
* Improve the --expand-relocs handling of MachO.Rafael Espindola2015-06-1811-231/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In a relocation target can take 3 basic forms * A r_value in scattered relocations. * A symbol in external relocations. * A section is non-external relocations. Have the dump reflect that. With this change we go from CHECK-NEXT: Extern: 0 CHECK-NEXT: Type: X86_64_RELOC_SUBTRACTOR (5) CHECK-NEXT: Symbol: 0x2 CHECK-NEXT: Scattered: 0 To just // CHECK-NEXT: Type: X86_64_RELOC_SUBTRACTOR (5) // CHECK-NEXT: Section: __data (2) Since the relocation is with a section, we print the seciton name and don't need to say that it is not scattered or external. Someone motivated can add further special cases for things like ARM64_RELOC_ADDEND and ARM_RELOC_PAIR. llvm-svn: 240073
* Pass --expand-relocs to a few more tests.Rafael Espindola2015-06-181-3/+19
| | | | llvm-svn: 240069
* MC: Remove obsolete MachO UseAggressiveSymbolFolding.Jim Grosbach2015-06-042-52/+16
| | | | | | | | | | Fix the FIXME and remove this old as(1) compat option. It was useful for bringup of the integrated assembler to diff object files, but now it's just causing more relocations than strictly necessary to be generated. rdar://21201804 llvm-svn: 239084
* AArch64: work around ld64 bug more aggressively.Tim Northover2015-05-183-26/+72
| | | | | | | | | | | | | | | ld64 currently mishandles internal pointer relocations (i.e. ARM64_RELOC_UNSIGNED referred to by section & offset rather than symbol). The existing __cfstring clause was an early discovery and workaround for this, but the problem is wider and we should avoid such relocations wherever possible for now. This code should be reverted to allowing internal relocations as soon as possible. PR23437. llvm-svn: 237621
* MC: For variable symbols, maintain MCSymbol::Section as a cache.Peter Collingbourne2015-04-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes PR19582. Previously, when an asm assignment (.set or =) was created, we would look up the section immediately in MCSymbol::setVariableValue. This caused symbols to receive the wrong section if the RHS of the assignment had not been seen yet. This had a knock-on effect in the object file emitters, causing them to emit extra symbols, or to give symbols the wrong visibility or the wrong section. For example, in the following asm: .data .Llocal: .text leaq .Llocal1(%rip), %rdi .Llocal1 = .Llocal2 .Llocal2 = .Llocal the first assignment would give .Llocal1 a null section, which would never get fixed up by the second assignment. This would cause the ELF object file emitter to consider .Llocal1 to be an undefined symbol and give it external linkage, even though .Llocal1 should not have been emitted at all in the object file. Or in the following asm: alias_to_local = Ltmp0 Ltmp0: the Mach-O object file emitter would give the alias_to_local symbol a n_type of N_SECT and a n_sect of 0. This is invalid under the Mach-O specification, which requires N_SECT symbols to receive a non-zero section number if the symbol is defined in a section in the object file. https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/#//apple_ref/c/tag/nlist After this change we do not look up the section when the assignment is created, but instead look it up on demand and store it in Section, which is treated as a cache if the symbol is a variable symbol. This change also fixes a bug in MCExpr::FindAssociatedSection. Previously, if we saw a subtraction, we would return the first referenced section, even in cases where we should have been returning the absolute pseudo-section. Now we always return the absolute pseudo-section for expressions that subtract two section-derived expressions. This isn't always correct (e.g. if one of the sections ends up being laid out at an absolute address), but it's probably the best we can do without more context. This allows us to remove code in two places where we appear to have been working around this bug, in MachObjectWriter::markAbsoluteVariableSymbols and in X86AsmPrinter::EmitStartOfAsmFile. Re-applies r233595 (aka D8586), which was reverted in r233898. Differential Revision: http://reviews.llvm.org/D8798 llvm-svn: 233995
* Revert r233595, "MC: For variable symbols, maintain MCSymbol::Section as a ↵Peter Collingbourne2015-04-021-5/+5
| | | | | | cache." llvm-svn: 233898
* MC: For variable symbols, maintain MCSymbol::Section as a cache.Peter Collingbourne2015-03-301-5/+5
| | | | | | | | | | | This fixes the visibility of symbols in certain edge cases involving aliases with multiple levels of indirection. Fixes PR19582. Differential Revision: http://reviews.llvm.org/D8586 llvm-svn: 233595
* [AsmPrinter] Don't assert on GOT equivalent non-constant users.Ahmed Bougacha2015-03-271-0/+5
| | | | | | | We used to dyn_cast<Constant> in the recursive call, but cast<> in the initial one, and there can be non-Constant initial users. llvm-svn: 233346
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-03-134-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gep operator Similar to gep (r230786) and load (r230794) changes. Similar migration script can be used to update test cases, which successfully migrated all of LLVM and Polly, but about 4 test cases needed manually changes in Clang. (this script will read the contents of stdin and massage it into stdout - wrap it in the 'apply.sh' script shown in previous commits + xargs to apply it over a large set of test cases) import fileinput import sys import re rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL) def conv(match): line = match.group(1) line += match.group(4) line += ", " line += match.group(2) return line line = sys.stdin.read() off = 0 for match in re.finditer(rep, line): sys.stdout.write(line[off:match.start()]) sys.stdout.write(conv(match)) off = match.end() sys.stdout.write(line[off:]) llvm-svn: 232184
* [AsmPrinter][TLOF] Reintroduce AArch64 testBruno Cardoso Lopes2015-03-101-0/+92
| | | | | | | | | | | | Follow up from r231505. Fix the non-determinism by using a MapVector and reintroduce the AArch64 testcase. Defer deleting the got candidates up to the end and remove them in a bulk, avoiding linear time removal of each element. Thanks to Renato Golin for trying it out on other platforms. llvm-svn: 231830
* [AsmPrinter][TLOF] Remove AArch64 test to appease buildbotsBruno Cardoso Lopes2015-03-061-93/+0
| | | | | | | Follow up from r231497. Using XFAIL would still trigger fail on some buildbots. Will re-introduce it as soon as I have a fix. llvm-svn: 231505
* [AsmPrinter][TLOF] XFAIL AArch64 test to appease buildbotsBruno Cardoso Lopes2015-03-061-0/+5
| | | | | | | | | The checking for extgotequiv and localgotequiv rely on the emission order, which is not guaranteed because we use DenseMap to hold the GOT equivalents. XFAIL this now until I get time to use MapVector and test out the solution. In the meantime, appease buildbots. llvm-svn: 231497
* [AsmPrinter][TLOF] Make AArch64 test a bit more flexibleBruno Cardoso Lopes2015-03-061-8/+8
| | | | llvm-svn: 231481
* [AsmPrinter][TLOF] Split tests and move to appropriate directoriesBruno Cardoso Lopes2015-03-064-38/+164
| | | | | | Follow up from r231474 and 231475 to appease buildbots llvm-svn: 231480
OpenPOWER on IntegriCloud