aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-04-10[MachO] Emit Weak ReadOnlyWithRel to ConstDataSectionSteven Wu1-3/+6
Summary: Darwin dynamic linker can handle weak symbols in ConstDataSection. ReadonReadOnlyWithRel symbols should be emitted in ConstDataSection instead of normal DataSection. rdar://problem/39298457 Reviewers: dexonsmith, kledzik Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45472 llvm-svn: 329752
2018-04-04Re-commit r329179 after fixing build&test issuesPavel Labath1-0/+10
- MSVC was not OK with a static_assert referencing a non-static member variable, even though it was just in a sizeof(expression). I move the assert into the emit function, where it is probably more useful. - Tests were failing in builds which did not have the X86 target configured. Since this functionality is not target-specific, I have removed the target specifiers from the .ll files. llvm-svn: 329201
2018-04-04Revert r329179 (and follow-up unsuccessful fix attempts 329184, 329186); it ↵Nico Weber1-10/+0
doesn't build. llvm-svn: 329190
2018-04-04[CodeGen] Generate DWARF v5 Accelerator TablesPavel Labath1-0/+10
Summary: This patch adds a DwarfAccelTableEmitter class, which generates an accelerator table, as specified in DWARF v5 standard. At the moment it only generates a DIE offset column and (if we are indexing more than one compile unit) a CU column. Indexing type units is not currently supported, as we don't even have the ability to generate DWARF v5-compatible compile units. The implementation is not data-source agnostic like the one generating apple tables. This was not necessary as we currently only have one user of this code, and without a second user it was not obvious to me how to best abstract this. (The difference between these tables and the apple ones is that they need a lot more metadata about the debug info they are indexing). The generation is triggered by the --accel-tables argument, which supersedes the --dwarf-accel-tables arg -- the latter was a simple on-off switch, but not we can choose between two kinds of accelerator tables we can generate. This is tested by parsing the generated tables with llvm-dwarfdump and the DWARFVerifier, and I've also checked that GNU readelf is able to make sense of the tables. Differential Revision: https://reviews.llvm.org/D43286 llvm-svn: 329179
2018-03-24Allow FDE references outside the +/-2GB range supported by PC relativeEric Christopher1-0/+2
offsets for code models other than small/medium. For JIT application, memory layout is less controlled and can result in truncations otherwise. Patch based on one by Olexa Bilaniuk! llvm-svn: 328400
2018-02-06[DWARFv5] Emit .debug_line_str (in a non-DWO file).Paul Robinson1-1/+13
This should enable the linker to do string-pooling of path names. Differential Revision: https://reviews.llvm.org/D42707 llvm-svn: 324393
2018-01-09Reland "Emit Function IDs table for Control Flow Guard"Adrian McCarthy1-0/+5
Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. The original patch didn't have the lit.local.cfg file that restricts the new test to x86, thus the new test was failing on the non-x86 bots. Differential Revision: https://reviews.llvm.org/D40531 The reverts r322008, which was a revert of r322005. This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba. llvm-svn: 322136
2018-01-08Revert "Emit Function IDs table for Control Flow Guard"Adrian McCarthy1-5/+0
The new test fails on the Hexagon bot. Reverting while I investigate. This reverts https://reviews.llvm.org/rL322005 This reverts commit b7e0026b4385180c378edc658ec91a39566f2942. llvm-svn: 322008
2018-01-08Emit Function IDs table for Control Flow GuardAdrian McCarthy1-0/+5
Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. Differential Revision: https://reviews.llvm.org/D40531 llvm-svn: 322005
2017-12-13[CodeView] Teach clang to emit the .debug$H COFF section.Zachary Turner1-0/+6
Currently this is an LLVM extension to the COFF spec which is experimental and intended to speed up linking. For now it is behind a hidden cl::opt flag, but in the future we can move it to a "real" cc1 flag and have the driver pass it through whenever it is appropriate. The patch to actually make use of this section in lld will come in a followup. Differential Revision: https://reviews.llvm.org/D40917 llvm-svn: 320649
2017-11-30[MC] Function stack size section.Sean Eveson1-0/+2
Re applying after fixing issues in the diff, sorry for any painful conflicts/merges! Original RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-August/117028.html This change adds a '.stack-size' section containing metadata on function stack sizes to output ELF files behind the new -stack-size-section flag. The section contains pairs of function symbol references (8 byte) and stack sizes (unsigned LEB128). The contents of this section can be used to measure changes to stack sizes between different versions of the compiler or a source base. The advantage of having a section is that we can extract this information when examining binaries that we didn't build, and it allows users and tools easy access to that information just by referencing the binary. There is a follow up change to add an option to clang. Thanks. Reviewers: hfinkel, MatzeB Reviewed By: MatzeB Subscribers: thegameg, asb, llvm-commits Differential Revision: https://reviews.llvm.org/D39788 llvm-svn: 319430
2017-11-30Revert r319423: [MC] Function stack size section.Sean Eveson1-907/+905
I messed up the diff. llvm-svn: 319429
2017-11-30[MC] Function stack size section.Sean Eveson1-905/+907
Summary: Original RFC: http://lists.llvm.org/pipermail/llvm-dev/2017-August/117028.html I wasn't sure who to put as reviewers, so please add/remove people as appropriate. This change adds a '.stack-size' section containing metadata on function stack sizes to output ELF files behind the new -stack-size-section flag. The section contains pairs of function symbol references (8 byte) and stack sizes (unsigned LEB128). The contents of this section can be used to measure changes to stack sizes between different versions of the compiler or a source base. The advantage of having a section is that we can extract this information when examining binaries that we didn't build, and it allows users and tools easy access to that information just by referencing the binary. There is a follow up change to add an option to clang. Thanks. Reviewers: hfinkel, MatzeB Reviewed By: MatzeB Subscribers: thegameg, asb, llvm-commits Differential Revision: https://reviews.llvm.org/D39788 llvm-svn: 319423
2017-10-20[WebAssembly] MC: Fix crash when -g specified.Sam Clegg1-16/+16
At this point we don't output any debug sections or thier relocations. Differential Revision: https://reviews.llvm.org/D39076 llvm-svn: 316240
2017-10-06[llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci1-0/+4
Summary: Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging, and which contains a byte-for-byte dump of the swiftmodule file. Add this feature to llvm-dsymutil. Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of `__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil (Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the __swift_ast section). Reviewers: aprantl, friss Subscribers: llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D38504 llvm-svn: 315066
2017-10-05Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"Francis Ricci1-4/+0
Breaks aarch64 builders This reverts commit r315014. llvm-svn: 315034
2017-10-05[llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci1-0/+4
Summary: Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging, and which contains a byte-for-byte dump of the swiftmodule file. Add this feature to llvm-dsymutil. Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of `__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil (Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the __swift_ast section). Reviewers: aprantl, friss Subscribers: llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D38504 llvm-svn: 315014
2017-10-05Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"Francis Ricci1-4/+0
This reverts commit r315004, because of a failing test on non-apple platforms llvm-svn: 315009
2017-10-05[llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci1-0/+4
Summary: Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging, and which contains a byte-for-byte dump of the swiftmodule file. Add this feature to llvm-dsymutil. Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of `__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil (Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the __swift_ast section). Reviewers: aprantl, friss Subscribers: llvm-commits, JDevlieghere Differential Revision: https://reviews.llvm.org/D38504 llvm-svn: 315004
2017-09-15[WebAssembly] MC: Create wasm data segments based on MCSectionsSam Clegg1-16/+16
This means that we can honor -fdata-sections rather than always creating a segment for each symbol. It also allows for a followup change to add .init_array and friends. Differential Revision: https://reviews.llvm.org/D37876 llvm-svn: 313395
2017-09-12[WebAssembly] Remove flags from MCSectionWasmSam Clegg1-16/+16
Looks like these were copied from the ELF sections but don't apply to Wasm and were not used anywhere. Also remove unused Wasm methods in MCContext. Differential Revision: https://reviews.llvm.org/D37633 llvm-svn: 313058
2017-08-02Don't pass the code model to MCRafael Espindola1-20/+13
I was surprised to see the code model being passed to MC. After all, it assembles code, it doesn't create it. The one place it is used is in the expansion of .cfi directives to handle .eh_frame being more that 2gb away from the code. As far as I can tell, gnu assembler doesn't even have an option to enable this. Compiling a c file with gcc -mcmodel=large produces a regular looking .eh_frame. This is probably because in practice linker parse and recreate .eh_frames. In llvm this is used because the JIT can place the code and .eh_frame very far apart. Ideally we would fix the jit and delete this option. This is hard. Apart from confusion another problem with the current interface is that most callers pass CodeModel::Default, which is bad since MC has no way to map it to the target default if it actually needed to. This patch then replaces the argument with a boolean with a default value. The vast majority of users don't ever need to look at it. In fact, only CodeGen and llvm-mc use it and llvm-mc just to enable more testing. llvm-svn: 309884
2017-06-07Move Object format code to lib/BinaryFormat.Zachary Turner1-2/+2
This creates a new library called BinaryFormat that has all of the headers from llvm/Support containing structure and layout definitions for various types of binary formats like dwarf, coff, elf, etc as well as the code for identifying a file from its magic. Differential Revision: https://reviews.llvm.org/D33843 llvm-svn: 304864
2017-06-06[DWARF] Adding support for the DWARF v5 string offsets table ↵Wolfgang Pieb1-2/+14
(consumer/reader part only). Reviewers: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D32779 llvm-svn: 304759
2017-05-03[bpf] add relocation supportAlexei Starovoitov1-0/+4
. there should be no runtime relocation inside the bpf function. . relocation supported here mostly for debugging. . a test case is added. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 302055
2017-03-10[MC] Set SHT_MIPS_DWARF section type for all .debug_* sections on MIPSSimon Atanasyan1-23/+32
All MIPS .debug_* sections should be marked with ELF type SHT_MIPS_DWARF accordingly the specification [1]. Also the same section type is assigned to these sections by GNU tools. [1] ftp.software.ibm.com/software/os390/czos/dwarf/mips_extensions.pdf Differential Revision: https://reviews.llvm.org/D29789 llvm-svn: 297447
2017-02-24[WebAssembly] Basic support for Wasm object file encoding.Dan Gohman1-2/+2
With the "wasm32-unknown-unknown-wasm" triple, this allows writing out simple wasm object files, and is another step in a larger series toward migrating from ELF to general wasm object support. Note that this code and the binary format itself is still experimental. llvm-svn: 296190
2017-02-22[WebAssembly] Add skeleton MC support for the Wasm container formatDan Gohman1-1/+27
This just adds the basic skeleton for supporting a new object file format. All of the actual encoding will be implemented in followup patches. Differential Revision: https://reviews.llvm.org/D26722 llvm-svn: 295803
2017-02-14[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko1-0/+1
minor fixes (NFC). Same changes in files affected by reduced MC headers dependencies. llvm-svn: 295009
2017-02-02Change how we handle section symbols on ELF.Rafael Espindola1-15/+13
On ELF every section can have a corresponding section symbol. When in an assembly file we have .quad .text the '.text' refers to that symbol. The way we used to handle them is to leave .text an undefined symbol until the very end when the object writer would map them to the actual section symbol. The problem with that is that anything before the end would see an undefined symbol. This could result in bad diagnostics (test/MC/AArch64/label-arithmetic-diags-elf.s), or incorrect results when using the asm streamer (est/MC/Mips/expansion-jal-sym-pic.s). Fixing this will also allow using the section symbol earlier for setting sh_link of SHF_METADATA sections. This patch includes a few hacks to avoid changing our behaviour when handling conflicts between section symbols and other symbols. I reported pr31850 to track that. llvm-svn: 293936
2017-01-17[WebAssembly] Add triple support for the new wasm object formatDan Gohman1-0/+3
Differential Revision: https://reviews.llvm.org/D26701 llvm-svn: 292252
2016-08-29Move code only used by codegen out of MC. NFC.Rafael Espindola1-40/+0
MC itself never needs to know about these sections. llvm-svn: 279965
2016-08-17Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner1-0/+1
Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
2016-08-04[mips] Set Personality and LSDA encoding for FreeBSDDaniel Sanders1-0/+8
Reviewers: seanbruno, sdardis Subscribers: tberghammer, danalbert, srhines, dsanders, sdardis, llvm-commits, seanbruno Differential Revision: https://reviews.llvm.org/D23113 llvm-svn: 277732
2016-06-27[ARM] Fix Thumb text sections' flags under COFF/WindowsRenato Golin1-2/+5
The main issue here is that the "thumb" flag wasn't set for some of these sections, making MSVC's link.exe fails to correctly relocate code against the symbols inside these sections. link.exe could fail for instance with the "fixup is not aligned for target 'XX'" error. If linking doesn't fail, the relocation process goes wrong in the end and invalid code is generated by the linker. This patch adds Thumb/ARM information so that the right flags are set on COFF/Windows. Patch by Adrien Guinet. llvm-svn: 273880
2016-06-08Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer1-3/+3
Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
2016-05-18Don't pass a Reloc::Model to MC.Rafael Espindola1-19/+21
MC only needs to know if the output is PIC or not. It never has to decide about creating GOTs and PLTs for example. The only thing that MC itself uses this information for is expanding "macros" in sparc and mips. The rest I am pretty sure could be moved to CodeGen. This is a cleanup and isolates the code from future changes to Reloc::Model. llvm-svn: 269909
2016-05-17Delete deprecated function.Rafael Espindola1-6/+0
llvm-svn: 269853
2016-04-25Add accidentally deleted "break"Krzysztof Parzyszek1-0/+1
llvm-svn: 267476
2016-04-25ARM: put extern __thread stubs in a special section.Tim Northover1-0/+5
The linker needs to know that the symbols are thread-local to do its job properly. llvm-svn: 267473
2016-04-25[Hexagon] Few fixes for exception handlingKrzysztof Parzyszek1-0/+11
llvm-svn: 267469
2016-03-01[lanai] Add ELF enum value and relocations.Jacques Pienaar1-0/+5
Add ELF enum value and relocations for Lanai backed. General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend" (http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html). Differential Revision: http://reviews.llvm.org/D17008 llvm-svn: 262394
2016-02-22[X86] Create mergeable constant pool entries for AVXDavid Majnemer1-0/+4
We supported creating mergeable constant pool entries for smaller constants but not for 32-byte AVX constants. llvm-svn: 261584
2016-02-01Improved macro emission in dwarf.Amjad Aboud1-4/+4
Changed emitting offset of macinfo entry into compiler unit DIE to use "addSectionLabel" method rather than explicitly calculating size/offset of macro entry. Differential Revision: http://reviews.llvm.org/D16292 llvm-svn: 259358
2016-01-29[codeview] Begin to add support for inlined call sitesReid Kleckner1-3/+10
Summary: There are three parts to inlined call frames: 1. The inlinee line subsection 2. The inline site symbol record 3. The function ids referenced by both This change starts by emitting function ids (3) for all subprograms and emitting the base inline site symbol record (2). The actual line numbers in (2) use an encoded format that will come next, along with the inlinee line subsection. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16333 llvm-svn: 259217
2016-01-27ARMv7k: base ABI decision on v7k Arch rather than watchos OS.Tim Northover1-2/+2
Various bits we want to use the new ABI actually compile with "-arch armv7k -miphoneos-version-min=9.0". Not ideal, but also not ridiculous given how slices work. llvm-svn: 258975
2016-01-07Added support for macro emission in dwarf (supporting DWARF version 4).Amjad Aboud1-0/+10
Differential Revision: http://reviews.llvm.org/D15495 llvm-svn: 257060
2016-01-04[MC] Fix file name in file headerJeroen Ketema1-1/+1
llvm-svn: 256749
2015-12-22[MC] Don't use the architecture to govern which object file format to useDavid Majnemer1-14/+14
InitMCObjectFileInfo was trying to override the triple in awkward ways. For example, a triple specifying COFF but not Windows was forced as ELF. This makes it easy for internal invariants to get violated, such as those which triggered PR25912. This fixes PR25912. llvm-svn: 256226
2015-12-05[llvm-dwp] Support debug_tu_indexDavid Blaikie1-0/+10
llvm-svn: 254827