summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectFileInfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Allow FDE references outside the +/-2GB range supported by PC relativeEric Christopher2018-03-241-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
* [DWARFv5] Emit .debug_line_str (in a non-DWO file).Paul Robinson2018-02-061-1/+13
| | | | | | | | This should enable the linker to do string-pooling of path names. Differential Revision: https://reviews.llvm.org/D42707 llvm-svn: 324393
* Reland "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-091-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
* Revert "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-081-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
* Emit Function IDs table for Control Flow GuardAdrian McCarthy2018-01-081-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
* [CodeView] Teach clang to emit the .debug$H COFF section.Zachary Turner2017-12-131-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
* [MC] Function stack size section.Sean Eveson2017-11-301-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
* Revert r319423: [MC] Function stack size section.Sean Eveson2017-11-301-907/+905
| | | | | | I messed up the diff. llvm-svn: 319429
* [MC] Function stack size section.Sean Eveson2017-11-301-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
* [WebAssembly] MC: Fix crash when -g specified.Sam Clegg2017-10-201-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
* [llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci2017-10-061-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
* Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"Francis Ricci2017-10-051-4/+0
| | | | | | | | Breaks aarch64 builders This reverts commit r315014. llvm-svn: 315034
* [llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci2017-10-051-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
* Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"Francis Ricci2017-10-051-4/+0
| | | | | | This reverts commit r315004, because of a failing test on non-apple platforms llvm-svn: 315009
* [llvm-dsymutil] Add support for __swift_ast MachO DWARF sectionFrancis Ricci2017-10-051-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
* [WebAssembly] MC: Create wasm data segments based on MCSectionsSam Clegg2017-09-151-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
* [WebAssembly] Remove flags from MCSectionWasmSam Clegg2017-09-121-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
* Don't pass the code model to MCRafael Espindola2017-08-021-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
* Move Object format code to lib/BinaryFormat.Zachary Turner2017-06-071-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
* [DWARF] Adding support for the DWARF v5 string offsets table ↵Wolfgang Pieb2017-06-061-2/+14
| | | | | | | | | | (consumer/reader part only). Reviewers: dblaikie, aprantl Differential Revision: https://reviews.llvm.org/D32779 llvm-svn: 304759
* [bpf] add relocation supportAlexei Starovoitov2017-05-031-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
* [MC] Set SHT_MIPS_DWARF section type for all .debug_* sections on MIPSSimon Atanasyan2017-03-101-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
* [WebAssembly] Basic support for Wasm object file encoding.Dan Gohman2017-02-241-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
* [WebAssembly] Add skeleton MC support for the Wasm container formatDan Gohman2017-02-221-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
* [MC] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-02-141-0/+1
| | | | | | | | minor fixes (NFC). Same changes in files affected by reduced MC headers dependencies. llvm-svn: 295009
* Change how we handle section symbols on ELF.Rafael Espindola2017-02-021-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
* [WebAssembly] Add triple support for the new wasm object formatDan Gohman2017-01-171-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D26701 llvm-svn: 292252
* Move code only used by codegen out of MC. NFC.Rafael Espindola2016-08-291-40/+0
| | | | | | MC itself never needs to know about these sections. llvm-svn: 279965
* Replace a few more "fall through" comments with LLVM_FALLTHROUGHJustin Bogner2016-08-171-0/+1
| | | | | | Follow up to r278902. I had missed "fall through", with a space. llvm-svn: 278970
* [mips] Set Personality and LSDA encoding for FreeBSDDaniel Sanders2016-08-041-0/+8
| | | | | | | | | | Reviewers: seanbruno, sdardis Subscribers: tberghammer, danalbert, srhines, dsanders, sdardis, llvm-commits, seanbruno Differential Revision: https://reviews.llvm.org/D23113 llvm-svn: 277732
* [ARM] Fix Thumb text sections' flags under COFF/WindowsRenato Golin2016-06-271-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
* Apply most suggestions of clang-tidy's performance-unnecessary-value-paramBenjamin Kramer2016-06-081-3/+3
| | | | | | | Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190
* Don't pass a Reloc::Model to MC.Rafael Espindola2016-05-181-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
* Delete deprecated function.Rafael Espindola2016-05-171-6/+0
| | | | llvm-svn: 269853
* Add accidentally deleted "break"Krzysztof Parzyszek2016-04-251-0/+1
| | | | llvm-svn: 267476
* ARM: put extern __thread stubs in a special section.Tim Northover2016-04-251-0/+5
| | | | | | | The linker needs to know that the symbols are thread-local to do its job properly. llvm-svn: 267473
* [Hexagon] Few fixes for exception handlingKrzysztof Parzyszek2016-04-251-0/+11
| | | | llvm-svn: 267469
* [lanai] Add ELF enum value and relocations.Jacques Pienaar2016-03-011-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
* [X86] Create mergeable constant pool entries for AVXDavid Majnemer2016-02-221-0/+4
| | | | | | | We supported creating mergeable constant pool entries for smaller constants but not for 32-byte AVX constants. llvm-svn: 261584
* Improved macro emission in dwarf.Amjad Aboud2016-02-011-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
* [codeview] Begin to add support for inlined call sitesReid Kleckner2016-01-291-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
* ARMv7k: base ABI decision on v7k Arch rather than watchos OS.Tim Northover2016-01-271-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
* Added support for macro emission in dwarf (supporting DWARF version 4).Amjad Aboud2016-01-071-0/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D15495 llvm-svn: 257060
* [MC] Fix file name in file headerJeroen Ketema2016-01-041-1/+1
| | | | llvm-svn: 256749
* [MC] Don't use the architecture to govern which object file format to useDavid Majnemer2015-12-221-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
* [llvm-dwp] Support debug_tu_indexDavid Blaikie2015-12-051-0/+10
| | | | llvm-svn: 254827
* [llvm-dwp] Emit a rather fictional debug_cu_indexDavid Blaikie2015-12-021-0/+12
| | | | | | | | | | | | | | This is very rudimentary support for debug_cu_index, but it is enough to allow llvm-dwarfdump to find the offsets for contributions and correctly dump debug_info. It will need to actually find the real signature of the unit and build the real hash table with the right number of buckets, as per the DWP specification. It will also need to be expanded to cover the tu_index as well. llvm-svn: 254489
* Stop producing .data.rel sections.Rafael Espindola2015-11-181-40/+29
| | | | | | | | | | | | | | | | | If a section is rw, it is irrelevant if the dynamic linker will write to it or not. It looks like llvm implemented this because gcc was doing it. It looks like gcc implemented this in the hope that it would put all the relocated items close together and speed up the dynamic linker. There are two problem with this: * It doesn't work. Both bfd and gold will map .data.rel to .data and concatenate the input sections in the order they are seen. * If we want a feature like that, it can be implemented directly in the linker since it knowns where the dynamic relocations are. llvm-svn: 253436
* Drop prelink support.Rafael Espindola2015-11-171-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way prelink used to work was * The compiler decides if a given section only has relocations that are know to point to the same DSO. If so, it names it .data.rel.ro.local<something>. * The static linker puts all of these together. * The prelinker program assigns addresses to each library and resolves the local relocations. There are many problems with this: * It is incompatible with address space randomization. * The information passed by the compiler is redundant. The linker knows if a given relocation is in the same DSO or not. If could sort by that if so desired. * There are newer ways of speeding up DSO (gnu hash for example). * Even if we want to implement this again in the compiler, the previous implementation is pretty broken. It talks about relocations that are "resolved by the static linker". If they are resolved, there are none left for the prelinker. What one needs to track is if an expression will require only dynamic relocations that point to the same DSO. At this point it looks like the prelinker is an historical curiosity. For example, fedora has retired it because it failed to build for two releases (http://pkgs.fedoraproject.org/cgit/prelink.git/commit/?id=eb43100a8331d91c801ee3dcdb0a0bb9babfdc1f) This patch removes support for it. That is, it stops printing the ".local" sections. llvm-svn: 253280
* Bring r252305 back with a test fix.Rafael Espindola2015-11-061-24/+18
| | | | | | | | | | We now create the .eh_frame section early, just like every other special section. This means that the special flags are visible in code that explicitly asks for ".eh_frame". llvm-svn: 252313
OpenPOWER on IntegriCloud