summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [Mips] Configure PLT and LA25 entries in the corresponding constructorsSimon Atanasyan2014-11-191-24/+24
| | | | | | No functional changes. llvm-svn: 222324
* [Mips] Inline the configurePLTReference methodSimon Atanasyan2014-11-191-9/+2
| | | | | | No functional changes. llvm-svn: 222323
* [Mips] Remove redundant const_castSimon Atanasyan2014-11-191-1/+1
| | | | | | No functional changes. llvm-svn: 222322
* [Mips] Make the function return type constant pointerSimon Atanasyan2014-11-191-2/+2
| | | | | | No functional changes. llvm-svn: 222321
* [Mips] Move setup of LLD_R_MIPS_STO_PLT relocation to the getPLTEntry() routineSimon Atanasyan2014-11-191-20/+5
| | | | | | No functional changes. llvm-svn: 222320
* [ELF] Handle ctors/dtors sectionsShankar Easwaran2014-11-192-21/+4
| | | | | | | | Move functionality from MIPS target to DefaultLayout. No change in functionality. llvm-svn: 222313
* [ELF] Fix creation of segments.Shankar Easwaran2014-11-191-3/+15
| | | | | | | Linker was creating a separate output segment in some cases if input sections had huge alignments. This patch fixes the issue. llvm-svn: 222312
* [ELF] Create input and output section namesShankar Easwaran2014-11-196-28/+63
| | | | | | No change in functionality. llvm-svn: 222311
* [ELF] Rename MergedSection to OutputSection.Shankar Easwaran2014-11-194-102/+95
| | | | | | No change in functionality. llvm-svn: 222310
* [ELF] Sectionkey should also contain path.Shankar Easwaran2014-11-191-14/+18
| | | | | | No change in functionality. llvm-svn: 222309
* [mach-o] propagate dylib version numbersNick Kledzik2014-11-198-20/+84
| | | | | | | | | | | | | | Mach-o does not use a simple SO_NEEDED to track dependent dylibs. Instead, the linker copies four things from each dylib to each client: the runtime path (aka "install name"), the build time, current version (dylib build number), and compatibility version The build time is no longer used (it cause every rebuild of a dylib to be different). The compatibility version is usually just 1.0 and never changes, or the dylib becomes incompatible. This patch copies that information into the NormalizedMachO format and propagates it to clients. llvm-svn: 222300
* Fix MSVC warning.Rui Ueyama2014-11-191-6/+9
| | | | | | | | | This patch fixes the following MSVC warning. warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?) llvm-svn: 222293
* [mach-o] for 32-bit arm, in -r mode support B (not BL) to undefined symbolNick Kledzik2014-11-181-1/+3
| | | | | | | | | | | | | When fixing up BL instructions, the linker has to compare the thumbness of the target to decide if the instruction needs to be converted to BLX. But with B instruction there is no BX, so the linker asserts if the target is not the same thumbness. This assert was firing in -r mode when the target was undefined which it interpreted as being non-thumb. Test case change is to add a B (in both thumb and arm code) to an undefined symbol and round trip through -r mode. llvm-svn: 222266
* [mach-o] zero-fill sections have no file offsetNick Kledzik2014-11-182-11/+22
| | | | | | | In mach-o, sections of type S_ZEROFILL are special cased and to always have their section.offset field be zero. llvm-svn: 222202
* [mach-o] extract atom alignment information from mach-o filesNick Kledzik2014-11-183-11/+21
| | | | llvm-svn: 222201
* [mach-o] enhance arm64 reloc parser to support local pointer relocationsNick Kledzik2014-11-181-1/+5
| | | | | | | | | | | The arm64 assembler almost always uses r_extern=1 relocations in which the r_symbolnum field is the index of the symbol the relocation references. But sometimes it will set r_extern=0 in which case the linker needs to read the content of the reloction to determine the target. Add test case that the r_extern=0 relocation round trips. llvm-svn: 222200
* [mach-o] fix typos. No function changeNick Kledzik2014-11-181-5/+1
| | | | llvm-svn: 222199
* [mach-o] enhance arm64 reloc parser to support local pointer relocationsNick Kledzik2014-11-181-5/+19
| | | | | | | | | | | The arm64 assembler almost always uses r_extern=1 relocations in which the r_symbolnum field is the index of the symbol the relocation references. But sometimes it will set r_extern=0 in which case the linker needs to read the content of the reloction to determine the target. Add test case that the r_extern=0 relocation round trips. llvm-svn: 222198
* [mach-o] fix typos. No function changeNick Kledzik2014-11-181-4/+3
| | | | llvm-svn: 222197
* [PECOFF] Fix 32-bit delay-import table.Rui Ueyama2014-11-171-1/+1
| | | | llvm-svn: 222116
* [PECOFF] Fix section alignment.Rui Ueyama2014-11-141-12/+31
| | | | | | | | | | | | | | | | | If you have something like __declspec(align(8192)) int foo = 1; in your code, the compiler makes the data to be aligned to 8192-byte boundary, and the linker align the section containing the data to 8192. LLD always aligned the section to 4192. So, as long as alignment requirement is smaller than 4192, it was correct, but for larger requirements, it's wrong. This patch fixes the issue. llvm-svn: 222043
* [PECOFF] Remove dead codeRui Ueyama2014-11-141-4/+0
| | | | | | | | | AddressOfEntryPoint is overridden after we layout all atoms (until then, we don't know the entry point address for obvious reason.) I believe this code is leftover from very early version of the PE/COFF port that we only had an entry function in a test object file. llvm-svn: 222026
* Silence inconsistent override warnings.Eric Christopher2014-11-141-3/+3
| | | | llvm-svn: 222021
* Follow-up to r221913. Fix some -Wcast-qual warning reasons.Simon Atanasyan2014-11-1413-80/+90
| | | | llvm-svn: 221974
* [ELF] Dynamic section was not aligned properly.Shankar Easwaran2014-11-141-4/+14
| | | | | | | The dynamic section was not aligned properly. The alignment of the section is determined by the word size of the architecture. llvm-svn: 221972
* [ELF] Fix the fileoffset according to the ELF spec.Shankar Easwaran2014-11-131-1/+2
| | | | | | | | | With --no-align-segments, there is a bug that the fileoffset may not be congruent to virtual address modulo page alignment. This patch fixes the problem. llvm-svn: 221890
* [ELF] Add CodeModel attribute to the DefinedAtom classSimon Atanasyan2014-11-139-8/+118
| | | | | | | | | | | | | | | | | | | | | | MIPS ELF symbols might contain some additional MIPS-specific flags in the st_other field besides visibility ones. These flags indicate code properties like microMIPS / MIPS16 encoding, position independent code etc. We need to transfer the flags from input objects to the output linked file to write them into the symbol table, adjust symbols addresses etc. I add new attribute CodeModel to the DefinedAtom class to hold target specific flag and to get over YAML/Native format conversion barrier. Other architectures/targets can extend CodeModel enumeration by their own flags. MIPS specific part of this patch adds support for STO_MIPS_MICROMIPS flag. This flag marks microMIPS symbols. Such symbol should: a) Has STO_MIPS_MICROMIPS in the corresponding .symtab record. b) Has adjusted (odd) address in the corresponding .symtab and .dynsym records. llvm-svn: 221864
* [ELF] Fix segment alignment.Shankar Easwaran2014-11-131-4/+11
| | | | | | | | | The segment alignment for PT_LOAD segments is set to page size by default, but if any of the sections require an alignment more than the page size, the segment alignment property is set to the maximum alignment of the sections that are part of the segment. llvm-svn: 221862
* [ELF] Fix conditions for max-page-size.Shankar Easwaran2014-11-131-1/+1
| | | | | | Fix comments from Rui, also adds a test. llvm-svn: 221860
* [ELF] Fix max-page-size option.Shankar Easwaran2014-11-132-4/+2
| | | | | | | | | | The user can use the max-page-size option and set the maximum page size. Dont check for maximum allowed values for page size, as its what the kernel is configured with. Fix the test as well. llvm-svn: 221858
* [PECOFF] Fix delay-import address table contents.Rui Ueyama2014-11-132-3/+9
| | | | | | | | | | | Each entry in the delay-import address table had a wrong alignment requirement if 32 bit. As a result it got wrong delay-import table. Because llvm-readobj doesn't print out that field, we don't have a test for that. I'll submit a test that would catch this bug after improving llvm-readobj. llvm-svn: 221853
* [mach-o] Sort GOT entries by name to make links reproducibleNick Kledzik2014-11-121-5/+18
| | | | | | | | | | | | | The GOT slots were being laid out in a random order by the GOTPass which caused randomness in the output file. Note: With this change lld now bootstraps on darwin. That is: 1) link lld using system linker to make lld.1 2) link lld using lld.1 to make lld.2 3) link lld using lld.2 to make lld.3 Now lld.2 and lld.3 are identical. llvm-svn: 221831
* [mach-o] Support linker synthesized mach_header symbols.Nick Kledzik2014-11-125-1/+88
| | | | | | | | | | | | | | | | | | | | | | | On darwin in final linked images, the __TEXT segment covers that start of the file. That means in memory a process can see the mach_header (and load commands) for every loaded image in a process. There are APIs that take and return the mach_header addresses as a way to specify a particular loaded image. For completeness, any code can get the address of the mach_header of the image it is in by using &__dso_handle. In addition there are mach-o type specific symbols like __mh_execute_header. The linker needs to supply a definition for any of these symbols if used. But the address the symbol it resolves to is not in any section. Instead it is the address of the start of the __TEXT segment. I needed to make a small change to SimpleFileNode to not override resetNextIndex() because the Driver creates a SimpleFileNode to hold the internal/implicit files that the context/writer can create. For some reason SimpleFileNode overrode resetNextIndex() to do nothing instead of reseting the index (which mach-o needs if the internal file is an archive). llvm-svn: 221822
* [mach-o] Fix lazy binding offsetsNick Kledzik2014-11-117-123/+114
| | | | | | | | | | The way lazy binding works in mach-o is that the linker generates a helper function and has the stub (PLT) initially jump to it. The helper function pushes an extra parameter then jumps into dyld. The extra parameter is an offset into the lazy binding info where dyld will find the information about which symbol to bind and way lazy binding pointer to update. llvm-svn: 221654
* [ELF] Change order of section match.Shankar Easwaran2014-11-111-1/+1
| | | | | | Addressed comments from Sean silva. llvm-svn: 221650
* Revert "Add support library."Shankar Easwaran2014-11-116-141/+108
| | | | | | This reverts commit r221583. llvm-svn: 221649
* [Gnu][Driver] Use StringRef conversion functionsShankar Easwaran2014-11-111-13/+7
| | | | llvm-svn: 221648
* [Mips] Replace the redundant condition by assert callSimon Atanasyan2014-11-101-3/+3
| | | | | | No functional changes. llvm-svn: 221603
* [Mips] Do not read addends for relocations which do not use themSimon Atanasyan2014-11-102-11/+8
| | | | | | No functional changes. llvm-svn: 221602
* [Gnu] Support --image-base optionShankar Easwaran2014-11-102-0/+16
| | | | | | The value for --image-base is used as the base address of the program. llvm-svn: 221589
* [ELF] Fix DT_INIT_ARRAY{SZ} and DT_FINI_ARRAY{SZ}Shankar Easwaran2014-11-101-4/+26
| | | | | | | | | | The dynamic table was creating the entry DT_FINI_ARRAY{SZ} even when there was no .fini_array section. The entries should be creating in the dynamic section only if there are sections .init_array/.fini_array in the output. Fixes the tests that checked for errroneous outputs. llvm-svn: 221588
* [ELF] Fix values of linker created dynamic variables.Shankar Easwaran2014-11-101-0/+3
| | | | | | | | The value of _DYNAMIC should be pointing at the start of the .dynamic segment. This was pointing to the end of the dynamic segment. Similarly the value of _GLOBAL_OFFSET_TABLE_ was not proper too. llvm-svn: 221587
* [ELF] .dynamic should have SHT_DYNAMIC flagShankar Easwaran2014-11-101-0/+5
| | | | llvm-svn: 221586
* [Gnu] Add options that are ignoredShankar Easwaran2014-11-101-0/+15
| | | | | | Add options that are ignored and exists just for compatibility reasons. llvm-svn: 221585
* [ELF] Support -z max-page-size optionShankar Easwaran2014-11-102-2/+38
| | | | | | | The GNU linker allows the user to change the page size by using the option -z max-page-size. llvm-svn: 221584
* Add support library.Shankar Easwaran2014-11-106-108/+141
| | | | | | | | | The parsing routines in the linker script to parse strings encoded in various formats(hexadecimal, octal, decimal, etc), is needed by the GNU driver too. This library provides helper functions for all flavors and flavors to add helper functions which other flavors may make use of. llvm-svn: 221583
* [ELF] Remove unused variableShankar Easwaran2014-11-081-1/+0
| | | | llvm-svn: 221572
* [ELF] Support --no-align-segments.Shankar Easwaran2014-11-084-13/+30
| | | | | | | | | | | | | lld generates an ELF by adhering to the ELF spec by aligning vma/fileoffset to a page boundary, but this becomes an issue when dealing with large pages. This adds support so that lld generated executables adheres to the ELF spec with the rule vma % p_align = offset % p_align. This is supported by the flag --no-align-segments. This could be the default in few targets like X86_64 to save space on disk. llvm-svn: 221571
* [mach-o] remove stray debug outputNick Kledzik2014-11-071-3/+0
| | | | llvm-svn: 221553
* [mach-o] Fix MachOFileNode to own archives same as ELFFileNodeNick Kledzik2014-11-071-1/+4
| | | | | | | | | My previous fix to have FileArchive own the member MemoryBuffers was not a complete solution for darwin because nothing owned the FileArchive object. Fixed MachOFileNode to be like ELFFileNode and have the graph node own the archive object. llvm-svn: 221552
OpenPOWER on IntegriCloud