| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
No functional changes.
llvm-svn: 234052
|
|
|
|
|
|
|
|
| |
Also removed some over-generalization added in r232866, such as
making a function take two parameters and pass two equivalent
arguments to the function.
llvm-svn: 233882
|
|
|
|
|
|
|
|
|
|
|
| |
All calls of findAbsoluteAtoms seem a bit awkward because of the type
of the function. It semantically returns a pointer to an AtomLayout or
nothing, so I made the function return AtomLayout*.
In this patch, I also expanded some "auto"s because their actual type
were not obvious in their contexts.
llvm-svn: 233769
|
|
|
|
| |
llvm-svn: 233456
|
|
|
|
| |
llvm-svn: 233453
|
|
|
|
| |
llvm-svn: 233452
|
|
|
|
| |
llvm-svn: 233344
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
N64 ABI relocation record r_info field in fact consists of five subfields:
* r_sym - symbol index
* r_ssym - special symbol
* r_type3 - third relocation type
* r_type2 - second relocation type
* r_type - first relocation type
Up to three these relocations applied one by one. The first relocation
uses an addendum from the relocation record. Each subsequent relocation
takes as its addend the result of the previous operation. Only the final
operation actually modifies the location relocated. The first relocation
uses as a reference symbol specified by the `r_sym` field. The third
relocation assumes NULL symbol.
The patch represents these data using LLD model and takes in account
additional relocation types during a relocation calculation.
Additional relocations do not introduce any new relations between two
atoms and just specify operations need to be done during a relocation
calculation. The first relocation type (`r_type`) stored in the
`Reference::_kindValue`. The rest of relocations and `r_ssym` value are
stored in the new `Reference::_tag` field "as-is". I decided to do not
"decode" these data on the core LLD level to prevent pollution of the
core LLD model by very target specific data.
Also I have to override writing of relocation records in the `RelocationTable`
class to convert MIPS N64 ABI relocation information from the `Reference`
class back to the ELF relocation record.
http://reviews.llvm.org/D8533
llvm-svn: 233057
|
|
|
|
| |
llvm-svn: 232985
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the init array/fini array sorting to the Output ELF writer.
AFAIK, this is only needed by the X86_64/ARM ABI.
This shaves time taken to self host lld by 0.2 seconds.
Before patch
----------------
4791.062059 task-clock # 1.634 CPUs utilized ( +- 0.28% )
61,107 context-switches # 0.013 M/sec ( +- 0.56% )
2.932902671 seconds time elapsed ( +- 0.84% )
After patch
-------------
4608.417248 task-clock # 1.669 CPUs utilized ( +- 0.30% )
61,616 context-switches # 0.013 M/sec ( +- 0.63% )
2.761012703 seconds time elapsed ( +- 0.63% )
llvm-svn: 232866
|
|
|
|
|
|
| |
Fix a leftover class during implementation.
llvm-svn: 232864
|
|
|
|
|
|
|
| |
MSVC 2013 cannot compile this code because of C1001 "internal error".
Stop using initializer list without type name.
llvm-svn: 232448
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements the behaviour of the SECTIONS linker script directive,
used to not only define a custom mapping between input and output sections, but
also order input sections in the output file. To do this, we modify
DefaultLayout with hooks at important places that allow us to re-order input
sections according to a custom order. We also add a hook in SegmentChunk to
allow us to calculate linker script expressions while assigning virtual
addresses to the input sections that live in a segment.
Not all SECTIONS constructs are currently supported, but only the ones that do
not use special sort orders. It adds two LIT test as practical examples of
which sections directives are currently supported.
In terms of high-level changes, it creates a new class "script::Sema" that owns
all linker script ASTs and the logic for linker script semantics as well.
ELFLinkingContext owns a single copy of Sema, which will be used throughout
the object file writing process (to layout sections as proposed by the linker
script).
Other high-level change is that the writer no longer uses a "const" copy of
the linking context. This happens because linker script expressions must be
calculated *while* calculating final virtual addresses, which is a very late
step in object file writing. While calculating these expressions, we need to
update the linker script symbol table (inside the semantics object), and, thus,
we are "modifying our context" as we prepare to write the file.
http://reviews.llvm.org/D8157
llvm-svn: 232402
|
|
|
|
|
|
|
|
| |
This reverts commit r232253.
Fix comments from dblaikie. Since these functions dont access member state, its ok to be static.
llvm-svn: 232271
|
|
|
|
|
|
| |
Functions hasOutputSegment/maybeGetSOName doesnot need not be static.
llvm-svn: 232253
|
|
|
|
|
|
| |
We dropped Visual Studio 2012 support, so we can use template aliases.
llvm-svn: 231756
|
|
|
|
| |
llvm-svn: 231271
|
|
|
|
|
|
| |
Cleanup.
llvm-svn: 230219
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
SHF_GROUP: Group Member Sections
----------------------------------
A section which is part of a group, and is to be retained or discarded with the
group as a whole, is identified by a new section header attribute: SHF_GROUP
This section is a member (perhaps the only one) of a group of sections, and the
linker should retain or discard all or none of the members. This section must be
referenced in a SHT_GROUP section. This attribute flag may be set in any section
header, and no other modification or indication is made in the grouped sections.
All additional information is contained in the associated SHT_GROUP section.
SHT_GROUP: Section Group Definition
-------------------------------------
Represents a group section.
The section group's sh_link field identifies a symbol table section, and its
sh_info field the index of a symbol in that section. The name of that symbol is
treated as the identifier of the section group.
More information: https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html
Added a lot of extensive tests, that tests functionality.
llvm-svn: 230195
|
|
|
|
|
|
|
|
|
| |
Now since the correct file path for atoms is available and not clobbered,
commit r222309 which was reverted previously can be added back.
No change in functionality.
llvm-svn: 230138
|
|
|
|
| |
llvm-svn: 229055
|
|
|
|
| |
llvm-svn: 229030
|
|
|
|
|
|
| |
We can add this function when we really have a need.
llvm-svn: 228907
|
|
|
|
| |
llvm-svn: 228378
|
|
|
|
|
|
|
|
|
|
| |
After the total number of program headers are determined, virtual addresses
and file offsets need not be reassigned for sections whose virtual addresses and
fileoffsets remained the same.
This doesnot change any functionality.
llvm-svn: 228377
|
|
|
|
| |
llvm-svn: 227707
|
|
|
|
|
|
|
| |
The .got and .got.plt sections are already handled as typeGOT. There is no need
to handle these atoms whose contentType is typeData.
llvm-svn: 227706
|
|
|
|
|
|
|
| |
To find an AtomLayout object for the given symbol I replace the
`Layout::findAtomAddrByName` method by `Layout::findAtomLayoutByName` method.
llvm-svn: 223359
|
|
|
|
|
|
|
|
|
| |
The AtomSections were improperly merging sections from various input files. This
patch fixes the problem, with an updated test that was provided by Simon.
Thanks to Simon Atanasyan for catching this issue.
llvm-svn: 222982
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222975
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222973
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222972
|
|
|
|
|
|
|
|
| |
This reverts commit r222309.
Reverting because of failures on darwin bot.
llvm-svn: 222332
|
|
|
|
|
|
|
|
|
| |
This reverts commit r222310.
Not sure which commit is the cause of the failure on the darwin bot. Will need
to revert my changes and commit one change at a time.
llvm-svn: 222330
|
|
|
|
|
|
|
|
| |
This reverts commit r222311.
Reverting because of failure in the darwin bot.
llvm-svn: 222329
|
|
|
|
|
|
|
|
| |
Move functionality from MIPS target to DefaultLayout.
No change in functionality.
llvm-svn: 222313
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222311
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222310
|
|
|
|
|
|
| |
No change in functionality.
llvm-svn: 222309
|
|
|
|
|
|
| |
Addressed comments from Sean silva.
llvm-svn: 221650
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
llvm-svn: 221430
|
|
|
|
| |
llvm-svn: 221426
|
|
|
|
|
|
|
|
|
| |
The ELF writer creates a invalid binary for few cases with large filesize and
memory size for segments. This patch addresses the functionality and updates the
test. This patch also cleans up parts of the ELF writer for future enhancements
to support Linker scripts.
llvm-svn: 221233
|
|
|
|
|
|
|
|
|
| |
This would permit the ELF reader to check the architecture that is being
selected by the linking process.
This patch also sorts the include files according to LLVM conventions.
llvm-svn: 220129
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When committed in r219353, this patch originally caused problems because it was
not tested in debug build. In such scenarios, Driver.cpp adds two additional
passes. These passes serialize all atoms via YAML and reads it back. Since the
patch changed ObjectAtom to hold a new reference, the serialization was removing
the extra data.
This commit implements r219853 in another way, similar to the original MIPS way,
by using a StringSet that holds the names of all copied atoms instead of
directly holding a reference to the copied atom. In this way, this commit is
simpler and eliminate the necessity of changing the DefinedAtom hierarchy to
hold a new data.
Reviewers: shankarke
http://reviews.llvm.org/D5713
llvm-svn: 219449
|
|
|
|
|
|
| |
This reverts commit r219353 because that seems to break buildbots.
llvm-svn: 219369
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enhances the creation of an ELF dynamic executable by avoiding recording
unnecessary shared libraries as NEEDED to load a program.
To do this, we must keep track of not only symbols that were referenced but
also of COPY relocations, which steal the symbol from a shared library but does
not store from which lib this symbol came from. To fix this, this commit changes
ObjectSymbol to store the original library from which this symbol came. With
this information, we are able to build a list of the exact shared libraries that
must be marked as DT_NEEDED, instead of blindly marking all shared libraries as
needed.
This logic originally came from the MIPS backend with some adaptation.
Reviewers: atanasyan, shankar.easwaran
http://reviews.llvm.org/D5574
llvm-svn: 219353
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements in the X86_64 ELF lld backend yet another feature that
was only available in the MIPS backend. However, this patch changes generic ELF
classes to make it trivial for other ELF backends to use this logic too. When
creating a dynamic executable that has dynamic relocations against weak
undefined symbols, these symbols must be exported to the dynamic symbol table
to seek a possible resolution at run time.
A common use case is the __gmon_start__ weak glibc undefined symbol.
Reviewer: shankarke
http://reviews.llvm.org/D5571
llvm-svn: 219349
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch adds support for the general dynamic TLS access model for X86_64 (see www.akkadia.org/drepper/tls.pdf).
To properly support TLS, the patch also changes the __tls_get_addr atom to be a shared library atom instead of a regularly defined atom (the previous lld approach). This closely models the reality of a function that will be resolved at runtime by the dynamic linker and loader itself (ld.so). I was tempted to force LLD to link against ld.so itself to resolve these symbols, but since GNU ld does not need the ld.so library to resolve this symbol, I decided to mimic its behavior and keep hardwired a definition of __tls_get_addr in the lld code.
This patch also moves some important logic that previously was only available to the MIPS lld backend to be used to all ELF backends. This logic, which now lives in the DefaultLayout class, will monitor which external (shared lib) symbols are really imported by the current module and will only populate the dynamic symbol table with used symbols, as opposed to the previous approach of dumping all shared lib symbols in the dynamic symbol table. This is important to this patch to avoid __tls_get_addr from getting injected into all dynamic symbol tables.
By solving the previous problem of always adding __tls_get_addr, now the produced symbol tables are slightly smaller. But this impacted several tests that relied on hardwired/predefined sizes of the symbol table, requiring this patch to update such tests.
Test Plan: Added a LIT test case that exercises a simple use case of TLS variable in a shared library.
Reviewers: ruiu, rafael, Bigcheese, shankarke
Reviewed By: Bigcheese, shankarke
Subscribers: emaste, shankarke, joerg, kledzik, mcrosier, llvm-commits
Projects: #lld
Differential Revision: http://reviews.llvm.org/D5505
llvm-svn: 218633
|