summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-081-10/+8
| | | | | | class. llvm-svn: 203340
* Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles2014-03-061-2/+1
| | | | | | | | | | This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
* doesSectionRequireSymbols is meaningless on ELF, remove.Rafael Espindola2014-02-061-3/+0
| | | | | | | | | | | | | | | | | | | | This is a nop. doesSectionRequireSymbols is only used from isSymbolLinkerVisible. isSymbolLinkerVisible only use from ELF was in if (!Asm.isSymbolLinkerVisible(Symbol) && !Symbol.isUndefined()) return false; if (Symbol.isTemporary()) return false; If the symbol is a temporary this code returns false and it is irrelevant if we take the first if or not. If the symbol is not a temporary, Asm.isSymbolLinkerVisible returns true without ever calling doesSectionRequireSymbols. This was an horrible leftover from when support for ELF was first added. llvm-svn: 200894
* Force emit a relocation for @gnu_indirect_function symbols so that the indirectRoman Divacky2014-01-081-1/+1
| | | | | | resolution works. llvm-svn: 198780
* In the ELFWriter when writing aliased (.set) symbols dont blindlyRoman Divacky2014-01-071-1/+36
| | | | | | | | | | | | take type from the new symbol but merge them so that the type is never "downgraded". This is probably quite rare, except for IFUNC symbols which we used to misassemble, losing the IFUNC type. Fixes #18372. llvm-svn: 198706
* MC: Fatally error if subtraction operand is badDavid Majnemer2014-01-061-0/+6
| | | | | | | | | Instead of crashing, raise an error when a subtraction expression involves an undefined symbol. This fixes PR18375. llvm-svn: 198590
* [mc] Fix ELF st_other flag.Logan Chien2013-12-051-2/+1
| | | | | | | | | | | | ELF_Other_Weakref and ELF_Other_ThumbFunc seems to be LLVM internal ELF symbol flags. These should not be emitted to object file. This commit defines ELF_STO_Shift for the target-defined flags for st_other, and increase the value of ELF_Other_Shift to 16. llvm-svn: 196440
* Move the STT_FILE symbols out of the normal symbol table processing forJoerg Sonnenberger2013-10-291-8/+26
| | | | | | | ELF. They can overlap with the other symbols, e.g. if a source file "foo.c" contains a function "foo" with a static variable "c". llvm-svn: 193569
* MC: Support multiple sections with the same name in the same comdat groupDavid Blaikie2013-10-221-8/+11
| | | | | | Code review by Eric Christopher and Rafael Espindola. llvm-svn: 193209
* WhitespaceDavid Blaikie2013-10-221-2/+2
| | | | llvm-svn: 193194
* Provide basic type safety for array_pod_sort comparators.Benjamin Kramer2013-09-221-5/+4
| | | | | | | | This makes using array_pod_sort significantly safer. The implementation relies on function pointer casting but that should be safe as we're dealing with void* here. llvm-svn: 191175
* Put ELF COMDAT relocations into the relevant COMDAT group.Tim Northover2013-07-101-2/+9
| | | | | | | | Patch from Игорь Пашев (I do hope we support utf-8 commit messages; I also hope he'll forgive me for transliterating it as Igor Pashev in case things go horribly wrong). llvm-svn: 186034
* Remove MCELFObjectTargetWriter::adjustFixupOffset hackUlrich Weigand2013-05-151-3/+0
| | | | | | | | Now that PowerPC no longer uses adjustFixupOffset, and no other back-end (ever?) did, we can remove the infrastructure itself (incidentally addressing a FIXME to that effect). llvm-svn: 181895
* Commit the right files for r176762. Sigh.Nick Lewycky2013-03-091-3/+3
| | | | llvm-svn: 176763
* ELF symbol table field st_other support, Jack Carter2013-02-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | excluding visibility bits. Generic STO handling at the Target level. The st_other field of the ELF symbol table is one byte in size. The first 2 bytes are used for generic visibility and are currently handled by llvm. The other six bits are processor specific and need to be set at the target level. A couple of notes: The new static methods for accessing and setting the "other" flags in include/llvm/MC/MCELF.h match the style guide and not the other methods in the file. I don't like the inconsistency, but feel I should follow the prescribed lowerUpper() convention. STO_ value definitions are not specified in gnu land as consistently as the STT_ and STB_ fields. Probably because the latter were defined in a standards doc and the former defined partially in code. I have stuck with the full byte definition of the flags. Contributer: Zoran Jovanovic llvm-svn: 175561
* This patch just fixes up various llvm formattingJack Carter2013-02-121-1/+2
| | | | | | | | | | violations such as tabs, blanks at eol and long lines. llvm-svn: 175007
* Link .ARM.exidx with corresponding text section.Logan Chien2013-02-051-0/+18
| | | | | | | | The sh_link in the ELF section header of .ARM.exidx should be filled with the section index of the corresponding text section. llvm-svn: 174372
* This patch reworks how llvm targets set Jack Carter2013-01-301-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | and update ELF header e_flags. Currently gathering information such as symbol, section and data is done by collecting it in an MCAssembler object. From MCAssembler and MCAsmLayout objects ELFObjectWriter::WriteObject() forms and streams out the ELF object file. This patch just adds a few members to the MCAssember class to store and access the e_flag settings. It allows for runtime additions to the e_flag by assembler directives. The standalone assembler can get to MCAssembler from getParser().getStreamer().getAssembler(). This patch is the generic infrastructure and will be followed by patches for ARM and Mips for their target specific use. Contributer: Jack Carter llvm-svn: 173882
* This is a resubmittal. For some reason it broke the bots yesterdayJack Carter2013-01-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | but I cannot reproduce the problem and have scrubed my sources and even tested with llvm-lit -v --vg. Support for Mips register information sections. Mips ELF object files have a section that is dedicated to register use info. Some of this information such as the assumed Global Pointer value is used by the linker in relocation resolution. The register info file is .reginfo in o32 and .MIPS.options in 64 and n32 abi files. This patch contains the changes needed to create the sections, but leaves the actual register accounting for a future patch. Contributer: Jack Carter llvm-svn: 172847
* Remove redundant 'llvm::' qualificationsDmitri Gribenko2013-01-131-1/+1
| | | | llvm-svn: 172358
* Make the contents of encoded sections SmallVector<char, N> instead ofEli Bendersky2012-12-071-8/+8
| | | | | | | | | | | SmallString. This makes it possible to use the length-erased SmallVectorImpl in the interface without imposing buffer size. Thus, the size of MCInstFragment is back down since a preallocated 8-byte contents buffer is enough. It would be generally a good idea to rid all the fragments of SmallString as contents, because a vector just makes more sense. llvm-svn: 169644
* Added Mapping Symbols for ARM ELFTim Northover2012-12-071-1/+1
| | | | | | | | | | Before this patch, when you objdump an LLVM-compiled file, objdump tried to decode data-in-code sections as if they were code. This patch adds the missing Mapping Symbols, as defined by "ELF for the ARM Architecture" (ARM IHI 0044D). Patch based on work by Greg Fitzgerald. llvm-svn: 169609
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-4/+3
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Initial TOC support for PowerPC64 object creationAdhemerval Zanella2012-10-251-5/+13
| | | | | | | | | | | | | | This patch adds initial PPC64 TOC MC object creation using the small mcmodel (a single 64K TOC) adding the some TOC relocations (R_PPC64_TOC, R_PPC64_TOC16, and R_PPC64_TOC16DS). The addition of 'undefinedExplicitRelSym' hook on 'MCELFObjectTargetWriter' is meant to avoid the creation of an unreferenced ".TOC." symbol (used in the .odp creation) as well to set the R_PPC64_TOC relocation target as the temporary ".TOC." symbol. On PPC64 ABI, the R_PPC64_TOC relocation should not point to any symbol. llvm-svn: 166677
* Check .rela instead of ELF64 for the compensation vaue resettingMichael Liao2012-10-161-2/+1
| | | | llvm-svn: 166051
* Fix comment.Rafael Espindola2012-08-271-3/+4
| | | | llvm-svn: 162678
* The ELF relocation record format is different for N64 Jack Carter2012-06-271-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which many Mips 64 ABIs use than for O64 which many if not all other target ABIs use. Most architectures have the following 64 bit relocation record format: typedef struct { Elf64_Addr r_offset; /* Address of reference */ Elf64_Xword r_info; /* Symbol index and type of relocation */ } Elf64_Rel; typedef struct { Elf64_Addr r_offset; Elf64_Xword r_info; Elf64_Sxword r_addend; } Elf64_Rela; Whereas N64 has the following format: typedef struct { Elf64_Addr r_offset;/* Address of reference */ Elf64_Word r_sym; /* Symbol index */ Elf64_Byte r_ssym; /* Special symbol */ Elf64_Byte r_type3; /* Relocation type */ Elf64_Byte r_type2; /* Relocation type */ Elf64_Byte r_type; /* Relocation type */ } Elf64_Rel; typedef struct { Elf64_Addr r_offset;/* Address of reference */ Elf64_Word r_sym; /* Symbol index */ Elf64_Byte r_ssym; /* Special symbol */ Elf64_Byte r_type3; /* Relocation type */ Elf64_Byte r_type2; /* Relocation type */ Elf64_Byte r_type; /* Relocation type */ Elf64_Sxword r_addend; } Elf64_Rela; The structure is the same size, but the r_info data element is now 5 separate elements. Besides the content aspects, endian byte reordering will be different for the area with each element being endianized separately. I treat this as generic and continue to pass r_type as an integer masking and unmasking the byte sized N64 values for N64 mode. I've implemented this and it causes no affect on other current targets. This passes make check. Jack llvm-svn: 159299
* Tidy up. Trailing whitespace.Jim Grosbach2012-05-111-1/+1
| | | | llvm-svn: 156602
* Prune some includes and forward declarations.Craig Topper2012-03-261-3/+2
| | | | llvm-svn: 153429
* Add a hook in MCELFObjectTargetWriter to allow targets to sort relocationAkira Hatanaka2012-03-231-29/+5
| | | | | | entries in the relocation table before they are written out to the file. llvm-svn: 153345
* Remove a bunch of unused variable assignments.Benjamin Kramer2012-01-201-9/+2
| | | | | | Found by the clang static analyzer. llvm-svn: 148541
* Kill the monstrosity that was ELFObjectWriter.h.Rafael Espindola2011-12-221-1/+331
| | | | llvm-svn: 147136
* Misc cleanups.Rafael Espindola2011-12-221-20/+1
| | | | llvm-svn: 147135
* Move the Mips only bits of the ELF writer to lib/Target/Mips.Rafael Espindola2011-12-221-101/+1
| | | | llvm-svn: 147133
* Move the MBlaze ELF writer bits to lib/Target/MBlaze.Rafael Espindola2011-12-221-47/+1
| | | | llvm-svn: 147129
* Move PPC bits to lib/Target/PowerPC.Rafael Espindola2011-12-221-75/+4
| | | | llvm-svn: 147124
* Local dynamic TLS model for direct object output. Create the correct TLS MIPSAkira Hatanaka2011-12-221-0/+9
| | | | | | | | ELF relocations. Patch by Jack Carter. llvm-svn: 147118
* Move the ARM specific parts of the ELF writer to Target/ARM.Rafael Espindola2011-12-221-241/+1
| | | | llvm-svn: 147115
* getEFlags is const.Rafael Espindola2011-12-221-2/+2
| | | | llvm-svn: 147114
* Switch from WriteEFlags to getEFlags in preparation for moving itRafael Espindola2011-12-211-6/+5
| | | | | | to Target/. llvm-svn: 147087
* Move the X86 specific bits of the ELF writer to the Target/X86 directory.Rafael Espindola2011-12-211-191/+10
| | | | | | Other targets will follow shortly. llvm-svn: 147060
* Reduce the exposure of Triple::OSType in the ELF object writer. This willRafael Espindola2011-12-211-5/+1
| | | | | | | avoid including ADT/Triple.h in many places when the target specific bits are moved. llvm-svn: 147059
* Small refactoring so that RelocNeedsGOT can stay in the target independentRafael Espindola2011-12-211-17/+10
| | | | | | side when the target specific bits are moved to the Target directory. llvm-svn: 147053
* Relocation against a symbol, instead of against section. We had some extremeAkira Hatanaka2011-12-131-2/+2
| | | | | | | | | | | test cases where there were a lot of relocations applied relative to a large rodata section. Gas would create a symbol for each of these whereas we would be relative to the beginning of the rodata section. This change mimics what gas does. Patch by Jack Carter. llvm-svn: 146468
* Handle reloc_signed_4byte in here. Not doing so was a regression from myRafael Espindola2011-12-091-0/+1
| | | | | | | previous commit. It is strange that we see it in 32 bits. We already have a fixme about it. llvm-svn: 146273
* Handle the case of the magical _GLOBAL_OFFSET_TABLE_ showing up in aRafael Espindola2011-12-091-7/+18
| | | | | | | | symbol difference. This matches gas behavior and fixes PR11513. We still don't handle _GLOBAL_OFFSET_TABLE_ in data sections. llvm-svn: 146238
* Add a few moreLocal/Global R_MIPS_GOT related fixups andBruno Cardoso Lopes2011-12-071-1/+2
| | | | | | | | make the addend fixup code a bit more generic Patch by Jack Carter. llvm-svn: 145998
* Explicit symbols for gnu mimicing relocations. Patch by Jack CarterBruno Cardoso Lopes2011-12-061-0/+14
| | | | llvm-svn: 145911
* Tidy up. Hard tabs.Jim Grosbach2011-12-061-1/+1
| | | | llvm-svn: 145878
* Switch MCAssembler to method names starting w/ lower-case.Jim Grosbach2011-12-061-1/+1
| | | | | | per http://llvm.org/docs/CodingStandards.html#ll_naming llvm-svn: 145873
OpenPOWER on IntegriCloud