- May 05, 2017
-
-
Rafael Espindola authored
This feels a bit hackish, but I think it is still an improvement. The way a tls address is computed in the various architectures is not that different. For example, for local dynamic we need the base of the tls (R_TLSLD or R_TLSLD_PC), and the offset of that particular symbol (R_ABS). Given the similarity, we can just use the expressions instead of having two additional target hooks. llvm-svn: 302279
-
Rui Ueyama authored
llvm-svn: 302273
-
Rafael Espindola authored
LazyObjectFile might turn out to be a BitcodeFile, so we need OffsetInArchive. llvm-svn: 302242
-
Rafael Espindola authored
The test ELF/lto/thin-archivecollision.ll was not testing what it wanted to test. It needs two archive members with the same name, but different offsets. Without this we could remove all references of OffsetInArchive and all tests would still pass. Fixing the test showed that the --whole-archive case was broken, which this patch fixes. llvm-svn: 302241
-
Rafael Espindola authored
It is needed for creating an unique identifier for ThinLTO. This fixes pr32931. llvm-svn: 302235
-
George Rimar authored
Previously we accepted --defsym=foo=value only. Reported by Sean Silva. llvm-svn: 302227
-
- May 04, 2017
-
-
Rafael Espindola authored
In the non linker script case we would try very early to find out if we could allocate the headers. Failing to do that would add extra alignment to the first ro section, since we would set PageAlign thinking it was the first section in the PT_LOAD. In the linker script case the header allocation must be done in the end, causing some duplication. We now tentatively add the headers to the first PT_LOAD and if it turns out they don't fit, remove them. With this we only need to allocate the headers in one place in the code. llvm-svn: 302186
-
Rafael Espindola authored
llvm-svn: 302155
-
Eric Fiselier authored
llvm-svn: 302130
-
Rafael Espindola authored
We were correctly computing the size contribution of a .tbss input section (it is none), but we were incorrectly considering the alignment of the output section: it was advancing Dot instead of ThreadBssOffset. As far as I can tell this was always wrong in our linkerscript implementation, but that became more visible now that the code is shared with the non linker script case. llvm-svn: 302107
-
Rui Ueyama authored
llvm-svn: 302090
-
- May 03, 2017
-
-
Rui Ueyama authored
It seems virtually everyone who tries to do LTO build with Clang and LLD was hit by a mistake to forget using llvm-ar command to create archive files. I wasn't an exception. Since this is an annoying common issue, it is probably better to handle that gracefully rather than reporting an error and tell the user to redo build with different configuration. Differential Revision: https://reviews.llvm.org/D32721 llvm-svn: 302083
-
Peter Collingbourne authored
It doesn't matter what binding we store in a non-UsedInRegularObj undefined symbol because we should reset it when we see a real undefined symbol in a combined LTO object. The fact that we weren't doing so before is a bug (PR32899) which is now fixed. llvm-svn: 302067
-
Rafael Espindola authored
We were ignoring strong undefined symbols if they followed weak ones. Fixes pr32899. llvm-svn: 302065
-
Peter Smith authored
The --section-start <name>=<address> needs to be translated into equivalent linker script commands. There are a couple of problems with the existing implementation: - The --section-start with the lowest address is assumed to be at the start of the map. This assumption is incorrect, we have to iterate through the SectionStartMap to find the lowest address. - The addresses in --section-start were being over-aligned when the sections were marked as PageAlign. This is inconsistent with the use of SectionStartMap in fixHeaders(), and can cause problems when the PageAlign causes an "unable to move location counter backward" error when the --section-start with PageAlign is aligned to an address higher than the next --section-start. The ld.bfd and ld.gold seem to be more consistent with this approach but this is not a well specified area. This change fixes the problems above and also corrects a typo in which fabricateDefaultCommands() is called with the wrong parameter, it should be called with AllocateHeader not Config->MaxPageSize. Differential Revision: https://reviews.llvm.org/D32749 llvm-svn: 302007
-
https://reviews.llvm.org/D32750George Rimar authored
Before rL301170 was landed, LLD did not produce correct entries in .gdb_index address area. Issue was fixed on LLVM DWARF parsers side and was relative to how .debug_ranges section was scanned. It was main problem of PR32319. It makes sense to have testcase on LLD size too. This checks that we generate proper values now, because we do not have any tests for .gdb_index which works with .debug_ranges atm. Differential revision: https://reviews.llvm.org/D32750 llvm-svn: 302006
-
Rui Ueyama authored
llvm-svn: 301982
-
Joel Jones authored
llvm-svn: 301979
-
- May 02, 2017
-
-
Rui Ueyama authored
llvm-svn: 301975
-
Rafael Espindola authored
This reverts commit r301964. It broke the build. llvm-svn: 301969
-
Joel Jones authored
llvm-svn: 301964
-
Zachary Turner authored
With the forthcoming codeview::StringTable which a pdb::StringTable would hold an instance of as one member, this ambiguity becomes confusing. Rename to PDBStringTable to avoid this. llvm-svn: 301948
-
Rafael Espindola authored
Strip on OpenBSD does not correctly handle an empty .eh_frame section and produces broken binaries in that case. Currently lld creates such an empty .eh_frame section, despite the fact that the OpenBSD crtend.o explicitly inserts a terminator. The Linux LSB "standard": https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#EHFRAME explicitly says that The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records. This diff includes a test that specifically tests the issue I'm seeing on OpenBSD. Patch by Mark Kettenis! llvm-svn: 301931
-
Peter Collingbourne authored
If there is a bug in the LTO implementation that causes it to fail to provide an expected symbol definition, the linker should report an undefined symbol error. Unfortunately, we were failing to do so if the symbol definition was weak, as the undefine() function was turning the definition into a weak undefined symbol, which resolves to zero if the symbol remains undefined. This patch causes us to set the binding to STB_GLOBAL when we undefine a symbol. I can't see a good way to test this. The behaviour should only be observable if there is a bug in the LTO implementation. Differential Revision: https://reviews.llvm.org/D32731 llvm-svn: 301897
-
Rui Ueyama authored
llvm-svn: 301896
-
Rui Ueyama authored
It didn't have to be a member function of Driver. This patch makes that function a file-scoped non-member function. llvm-svn: 301895
-
- May 01, 2017
-
-
Rui Ueyama authored
Also factored out code. llvm-svn: 301833
-
Rafael Espindola authored
When using linkerscripts we were trying to sort SHF_LINK_ORDER sections too early. Instead of always doing two runs of assignAddresses, record the section order in processCommands. llvm-svn: 301830
-
Rui Ueyama authored
Leaving a directory with a permission 0o100 is inconvenient. For example, macOS's rm can't remove such directory. llvm-svn: 301821
-
- Apr 30, 2017
-
-
Rui Ueyama authored
llvm-svn: 301778
-
Rui Ueyama authored
When the -no-keep-memory option is given, BFD linker tries to save memory in their own way. Since our internal architecture is completely different from that linker, that option doesn't make sense to us. llvm-svn: 301772
-
Rui Ueyama authored
llvm-svn: 301771
-
Rui Ueyama authored
For an option -foo-bar-baz, we have Config->FooBarBaz. Since -rpath is -rpath and not -r-path, it should be Config->Rpath instead Config->RPath. llvm-svn: 301759
-
Rui Ueyama authored
llvm-svn: 301758
-
Rui Ueyama authored
llvm-svn: 301757
-
- Apr 29, 2017
-
-
Rui Ueyama authored
llvm-svn: 301754
-
Rafael Espindola authored
This version uses a set to speed up the synchronize method. Original message: Remove LinkerScript::flush. This patch replaces flush with a last ditch attempt at synchronizing the section list with the linker script "AST". The synchronization is a bit of a hack and should in time be avoided by creating the AST earlier so that modifications can be made directly to it instead of modifying the section list and synchronizing it back. This is the main step for fixing https://bugs.llvm.org/show_bug.cgi?id=32816. With this in place I think the only missing thing would be to have processCommands assign section indexes as dummy offsets so that the sort in OutputSection::finalize works. With this LinkerScript::assignAddresses becomes much simpler, which should help with the thunk work. llvm-svn: 301745
-
Davide Italiano authored
Fixes PR32785. Thanks to Piotr Padlewski for the report and Rafael for the fix. llvm-svn: 301729
-
Rui Ueyama authored
Since the output format has been simplified, the class to print out a map file doesn't seem to be needed anymore. We can replace it with a few non-member functions. llvm-svn: 301715
-
Rui Ueyama authored
This patch is to ignore .debug_gnu_pub{names,types} sections if the -gdb-index option was given. Differential Revision: https://reviews.llvm.org/D32662 llvm-svn: 301710
-