Commit Graph

6691 Commits

Author SHA1 Message Date
Rui Ueyama 881406e787 Define '-undefined foo' as an alias to '-undefined=foo'.
llvm-svn: 280985
2016-09-08 20:35:29 +00:00
Ed Maste 2b68ada188 ELF: Report original emulation name in "unknown emulation" error
A trailing _fbsd is stripped from emulation names, but if the result was
still not a valid emulation the error was somewhat confusing.

For example,

% ld.lld -m elf_amd64_fbsd
unknown emulation: elf_amd64

Use the original emulation name in error messages.

Differential Revision:	https://reviews.llvm.org/D24357

llvm-svn: 280983
2016-09-08 19:36:22 +00:00
Ed Maste 21e2be6403 ELF: accept -m elf_amd64 as an alias for -m elf_x86_64
In the FreeBSD world x86_64 still has its original name, amd64. Accept
it as an alias.

Differential Revision:	https://reviews.llvm.org/D24356

llvm-svn: 280982
2016-09-08 19:30:47 +00:00
Rafael Espindola 868fc9279e Handle globs in global symbol names.
Fixes pr28775.

llvm-svn: 280947
2016-09-08 14:50:55 +00:00
Rafael Espindola 4d1e4d76ee Use a protected destructor instead of a virtual one.
llvm-svn: 280941
2016-09-08 14:11:08 +00:00
Rafael Espindola 042a3f209b Compute section names only once.
This simplifies error handling as there is now only one place in the
code that needs to consider the possibility that the name is
corrupted. Before we would do it in every access.

llvm-svn: 280937
2016-09-08 14:06:08 +00:00
Rafael Espindola 16853bb00f Pack InputSectionData from 72 to 64 bytes. NFC.
llvm-svn: 280925
2016-09-08 12:33:41 +00:00
George Rimar 9fc6143a5b [ELF] - Add virtual destructor to LinkerScriptBase class. NFC.
Absence of it caused a clang warning:
warning: 'lld:🧝:LinkerScriptBase' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor]

At fact we don't need it here because do not destroy this object by
base pointer.

llvm-svn: 280916
2016-09-08 09:59:13 +00:00
Eugene Leviant 36fac7f0d0 Linker script: implement ALIGNOF
Differential revision: https://reviews.llvm.org/D24141

llvm-svn: 280915
2016-09-08 09:08:30 +00:00
Simon Atanasyan 919a58c456 [ELF][MIPS] Fix initialization of TLS-related GOT entries
This patch allows static linking of TLS code. To do that it fixes
GOT entries initialization.

If TLS-related GOT entry created for a preemptible symbol i.e. has
a corresponding dynamic relocation, leave the entry initialized by zero.
Write down adjusted TLS symbol's values otherwise. For the adjustments
calculation use offsets for thread-local storage.

https://www.linux-mips.org/wiki/NPTL

llvm-svn: 280914
2016-09-08 09:07:19 +00:00
Simon Atanasyan af52f6af22 [ELF][MIPS] Update the comment
llvm-svn: 280913
2016-09-08 09:07:12 +00:00
Eugene Leviant 3967ea05a9 Set entry address to 0x0 if no _start symbol
Differential revision: https://reviews.llvm.org/D23925

llvm-svn: 280912
2016-09-08 08:57:51 +00:00
George Rimar 6c55f0e35e [ELF] - Apply clang-format to LinkerScript.cpp, NFC.
llvm-svn: 280911
2016-09-08 08:20:30 +00:00
George Rimar 884e786d38 [ELF] - Linkerscript: simplify access to templated methods from parser.
Previous way of accessing templated methods was a bit bulky,
Patch introduces small interface based solution.

Differential revision: https://reviews.llvm.org/D23872

llvm-svn: 280910
2016-09-08 08:19:13 +00:00
Rui Ueyama 8239617acd Rename test file. NFC.
llvm-svn: 280904
2016-09-08 03:08:05 +00:00
Ed Maste 4d9947ba09 ELF: Add -Qy as ignored option
GCC passes it by default on powerpc64 on FreeBSD. GNU ld claims "this
option is ignored for SVR4 compatibility", so we can ignore it too.

Differential Revision:	https://reviews.llvm.org/D24313

llvm-svn: 280864
2016-09-07 21:10:25 +00:00
Rui Ueyama a3b7546cf7 Fix inconsistent indentation.
llvm-svn: 280860
2016-09-07 20:50:41 +00:00
Rafael Espindola 0a75850fa7 Move field to the base class. NFC.
llvm-svn: 280858
2016-09-07 20:41:19 +00:00
Rafael Espindola 664c6522fa Delete dead field. NFC.
llvm-svn: 280856
2016-09-07 20:37:34 +00:00
Ed Maste 5ad1cbeecb ELF: add version script void function test case
After r280733 we use LLVM's demangler in lld. As a result we no longer
have a discrepancy between f() and f(void) on FreeBSD (due to an issue
with FreeBSD's system demangler).

Restore a test case for a void arg function.

Differential Revision:	https://reviews.llvm.org/D24305

llvm-svn: 280831
2016-09-07 17:51:00 +00:00
Rafael Espindola 4a2350e841 Enable test on windows.
It looks like it was disable just because we were missing a demangler.

llvm-svn: 280805
2016-09-07 12:09:10 +00:00
George Rimar bcbbb3987d [ELF] - Sort command line options. NFC.
llvm-svn: 280803
2016-09-07 11:43:18 +00:00
George Rimar a14b13d867 [ELF] - Linkerscript: create multiple output sections for inputs with different attributes.
Previously we combined sections by name if linkerscript was used.
For that we had to disable SHF_MERGE handling temporarily, but then
found that implementing it properly will require additional complexity layers like
subsections or something.
At the same time looks we can live with multiple output sections approach for now.
That patch do this change.

Differential revision: https://reviews.llvm.org/D24127

llvm-svn: 280801
2016-09-07 10:46:07 +00:00
George Rimar 51da9c7178 [ELF] - Fix for: PR29093 - version script does not support [chars] wildcards
GNU ld supports [chars] wildcards in version scripts, to match a single instance of any of the chars.
Here is an extern example from libstdc++'s version script in FreeBSD:

extern "C++"
{
...

std::locale::_[T-Za-z]*;                                                                                                       
std::[A-Zm]*;                                                            
std::n[^u]*;                                                             
std::nu[^m]*;                                                            
std::num[^e]*;
...

}

Patch adds support for scripts above. This is PR29093.

Differential revision: https://reviews.llvm.org/D23803

llvm-svn: 280799
2016-09-07 10:19:44 +00:00
George Rimar 8825a5c6ef [ELF] - Enable testcases that uses demangler to run under windows and escape quotes around "C++".
Previously testcases were enabled only for shell.
r280733 added c++ itanium demangler to lld and we can enable them fully.

Also this change make quotes to be escaped:

extern "C++" -> extern \"C++\", which worked before just because we are dropping tokens 
quotes internally at this moment.

llvm-svn: 280797
2016-09-07 09:59:29 +00:00
Eugene Leviant db741e7203 Support ABSOLUE keyword in symbol assignments
This patch allows making section defined symbols absolute:
.foo : {
  begin_foo = ABSOLUTE(.);
  *(.foo)
}

Differential revision: https://reviews.llvm.org/D24135

llvm-svn: 280788
2016-09-07 07:08:43 +00:00
Rui Ueyama adcdb664cb Simplify a boolean expression by using the De Morgan's law.
llvm-svn: 280766
2016-09-06 22:50:48 +00:00
Rafael Espindola 5b0fb8f4d5 Fix shared library build.
llvm-svn: 280753
2016-09-06 21:06:55 +00:00
Rafael Espindola d1942133e8 Use the demangler in llvm.
llvm-svn: 280733
2016-09-06 19:17:14 +00:00
Petr Hosek 5baa1c7641 [ELF] Add support for -no-gc-sections flag
This flag is supported by both BFD ld and gold and is occasionally
used to negate the effect of -gc-sections flag.

Differential Revision: https://reviews.llvm.org/D24270

llvm-svn: 280729
2016-09-06 18:28:49 +00:00
Rui Ueyama 25150e8b0d Add a comment.
llvm-svn: 280724
2016-09-06 17:46:43 +00:00
Rafael Espindola 719f55d379 Mark R_GOTREL_FROM_END as a relative expression.
Fixes pr30282.

llvm-svn: 280709
2016-09-06 13:57:15 +00:00
George Rimar ff1f29e0f6 [ELF] - Linkerscript: implemented FILL command as alias for =fillexpr
Patch implements FILL just as alias for =fillexpr. 
This allows to make implementation much shorted and simpler than D24186.

Differential revision: https://reviews.llvm.org/D24227

llvm-svn: 280708
2016-09-06 13:51:57 +00:00
Simon Atanasyan 643729d277 [ELF][MIPS] Support R_MIPS_TLS_DTPREL64 / R_MIPS_TLS_TPREL64 relocations calculation
llvm-svn: 280666
2016-09-05 15:42:43 +00:00
Simon Atanasyan 875951eceb [ELF][MIPS] Support R_MIPS_TLS_DTPREL32 / R_MIPS_TLS_TPREL32 relocations calculation
llvm-svn: 280665
2016-09-05 15:42:39 +00:00
Simon Atanasyan d9ea656021 [ELF][MIPS] Do not create a hidden definition for __tls_get_addr on MIPS
On most architectures the linker is required to optimize away any
references to __tls_get_addr in case of static linking. As usual
a special case is MIPS - libc defines __tls_get_addr itself because
there are no TLS optimizations for this architecture.

llvm-svn: 280664
2016-09-05 15:42:29 +00:00
Simon Atanasyan 65b2461cfd [ELF][MIPS] Do not emit DT_REL[A]COUNT for MIPS targets
It looks like MIPS dynamic loader does not support RELCOUNT tag.
Both gold/bfd linkers does not emit this tag on MIPS. I will investigate
the problem further but for now it is better to behave like GNU linkers.

llvm-svn: 280630
2016-09-04 17:40:12 +00:00
Duncan P. N. Exon Smith 9f71057d69 ReaderWriter: Use ilist_noalloc_traits for TrieEdge, NFC
Adopt r280128 in lld, specializing ilist_alloc_traits rather than
reinventing the wheel.

llvm-svn: 280566
2016-09-03 01:29:36 +00:00
Rui Ueyama dad2b88c7d Update comments.
llvm-svn: 280548
2016-09-02 22:15:08 +00:00
Simon Atanasyan eaeafb2b4f [ELF] PR30221 - linker script expression parser does not accept '~'
The patch adds support for both '-' and '~' unary expressions. Also it
brings support for signed numbers is expressions.

https://llvm.org/bugs/show_bug.cgi?id=30221

Differential revision: https://reviews.llvm.org/D24128

llvm-svn: 280546
2016-09-02 21:54:35 +00:00
George Rimar c91930a17f [ELF] - Use std::regex instead of hand written logic in elf::globMatch()
Use std::regex instead of hand written matcher.

Patch based on code and ideas of Rui Ueyama.

Differential revision: https://reviews.llvm.org/D23829

llvm-svn: 280544
2016-09-02 21:17:20 +00:00
Rui Ueyama ffdc16051f Move a test file to the right place.
llvm-svn: 280541
2016-09-02 20:46:06 +00:00
Rui Ueyama 66ba9f08b9 Remove useless file prefix.
Differential Revision: https://reviews.llvm.org/D24207

llvm-svn: 280540
2016-09-02 20:40:53 +00:00
Rui Ueyama b397ab5895 Use od instead of hexdump.
od is defined by POSIX and exists since version 1 AT&T Unix.
hexdump is not part of any standard as far as I know.
So od is a better choice than hexdump.

Differential Revision: https://reviews.llvm.org/D24205

llvm-svn: 280536
2016-09-02 20:20:04 +00:00
Rui Ueyama 6af4016f6d Simplify. NFC.
llvm-svn: 280533
2016-09-02 19:49:27 +00:00
Rui Ueyama fee70ea8c6 Rename UnresolvedPolicy::Error -> UnresolvedPolicy::ReportError.
"Error" looks like it is indicating a parse error. "Error" actually
instructs the later process to report an error if there's an error
condition. Thus the new name.

llvm-svn: 280529
2016-09-02 19:36:29 +00:00
Rui Ueyama 6c7ad13f89 Add -nostdlib.
llvm-svn: 280528
2016-09-02 19:20:33 +00:00
Rui Ueyama a27eeccade Dispatch without hash table lookup.
Cmd used to be the single central place to dispatch. It is not longer
the case because we have a logic for readProvideOrAssignment().
This patch removes the hash table so that evrything is in a single
function. This is slightly verbose but should improve readability.

Differential Revision: https://reviews.llvm.org/D24200

llvm-svn: 280524
2016-09-02 18:52:41 +00:00
Rui Ueyama 626e0b08ac Add comments.
llvm-svn: 280515
2016-09-02 18:19:00 +00:00
Rui Ueyama fa12b8bd1a Remove temoprary files.
Previously, we created temporary files using llvm::sys::fs::createTemporaryFile
and removed them using llvm::FileRemover. This is error-prone as it is easy to
forget creating FileRemover instances after creating temporary files.
There is actually a temporary file leak bug.

This patch introduces a new class, TemporaryFile, to manage temporary files
in the RAII style.

Differential Revision: https://reviews.llvm.org/D24176

llvm-svn: 280510
2016-09-02 17:34:17 +00:00
Rui Ueyama 951cfb6aae Fix potential test failures.
Windows does not allow opened files to be removed. This patch
fixes two types of errors.

 - Output file being the same as input file. Because LLD itself
   holds a file descriptor of the input file, it cannot create an
   output file with the same name as a new file.

 - Removing files before releasing MemoryBuffer objects.

These tests are not failing no because MemoryBuffer happens to
decide not to use mmap on these files. But we shouldn't rely on
that behavior.

llvm-svn: 280507
2016-09-02 17:19:28 +00:00
George Rimar 9f2f7ad98b [ELF] - Linkerscript: add support for suffixes in numbers.
Both bfd and gold accept:
foo = 1K;
bar = 1M;
zed = 1H;

And lowercase forms: k, m, h.
Patch adds support for that.

Differential revision: https://reviews.llvm.org/D24194

llvm-svn: 280494
2016-09-02 16:01:42 +00:00
George Rimar b952ece2df [ELF] - Fix for: bug 30237 - lld does not implement -f option
FreeBSD's libstdc++ build (used on tier-2 architectures) uses GNU ld's 
-f <name> option, which sets the DT_AUXILIARY field to the specified name.
Multiple -f options may be specified and the DT_AUXILIARY entries 
will be added in the order in which they appear.

Patch implements that option.

Differential revision: https://reviews.llvm.org/D24139

llvm-svn: 280475
2016-09-02 09:13:05 +00:00
Rui Ueyama 8a425f03dd Add comments.
llvm-svn: 280423
2016-09-01 22:48:05 +00:00
Petr Hosek fdfcb796e1 [ELF] Do not omit debug sections when computing build-id
The primary use of build-id is in debugging, hence omitting debug
sections when computing it significantly reduces its usability as
changes in debug section content wouldn't alter the build-id.

Differential Revision: https://reviews.llvm.org/D24120

llvm-svn: 280421
2016-09-01 22:43:03 +00:00
Rafael Espindola d59509eecc Add missing REQUIRES.
llvm-svn: 280375
2016-09-01 14:59:11 +00:00
Rafael Espindola 3a9eef1670 Sign extend a value before passing it to the Target.
This is what InputSectionBase<ELFT>::relocate does and we need to be
consistent. The other option would be to be more explicit about which
relocations are signed and which are not, and sign extend only when
appropriated. That would require extending the target interface.

llvm-svn: 280366
2016-09-01 13:52:52 +00:00
Eugene Leviant 97403d15ee Eliminate LayoutInputSection class
Previously we used LayoutInputSection class to correctly assign
symbols defined in linker script. This patch removes it and uses
pointer to preceding input section in SymbolAssignment class instead.

Differential revision: https://reviews.llvm.org/D23661

llvm-svn: 280348
2016-09-01 09:55:57 +00:00
Rafael Espindola 79202c378f Fix the implementation of R_386_GOTPC and R_386_GOTOFF.
They were both pointing to the start of the got, not the end.

Fixes pr28924.

llvm-svn: 280310
2016-08-31 23:24:11 +00:00
Rafael Espindola 7f4f9cd546 Use getSize to find the size of a section. NFC.
llvm-svn: 280305
2016-08-31 23:01:13 +00:00
Rui Ueyama 7caf48cc5b Initialize RelativeRel for AMDGPU.
Target->RelativeRel is used for all platforms, but AMDGPU did
not send that member.

Fixes bug 30227 - RelativeRel is used, but not initialized for AMDGPU.

Differential Revision: https://reviews.llvm.org/D24100

llvm-svn: 280291
2016-08-31 21:04:25 +00:00
Rui Ueyama 95769b4a29 Linker script: support VERSION command.
Summary:
VERSION commands define symbol versions. The grammar of the
commnad is as follows

  VERSION { version-script-commands }

where version-script-commands is

  [ name ] { version-definitions }.

Note that we already support version-script-commands because
it is being used for version script command.

This patch is based on George's patch https://reviews.llvm.org/D23609

Reviewers: grimar

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24089

llvm-svn: 280284
2016-08-31 20:03:54 +00:00
Ivan Krasin 8baccc2f19 Fix UBSan bot by not passing NULL into memcpy src.
Summary:
UBSan complains like the following:
tools/lld/COFF/Writer.cpp:97:15: runtime error: null pointer passed as argument 2, which is declared to never be null

The reason is that the vector could be empty.

Reviewers: rsmith

Subscribers: Eugene.Zelenko, kcc

Differential Revision: https://reviews.llvm.org/D24050

llvm-svn: 280259
2016-08-31 17:23:05 +00:00
Petr Hosek e5d3ca5031 [ELF] Linkerscript: define symbols outside SECTIONS
Symbol assignments outside of SECTIONS command need to be created
even when SECTIONS command is not used.

Differential Revision: https://reviews.llvm.org/D23751

llvm-svn: 280252
2016-08-31 15:31:17 +00:00
Rafael Espindola 0509876f3f Remove redundant argument. NFC.
llvm-svn: 280243
2016-08-31 13:49:23 +00:00
Rafael Espindola 8db87291ef Internalize common variables.
Before this lld was always creating common symbols itself. It worked,
but prevented them from being internalized when possible.

Now it preserves common symbols is the bitcode and they are internalized.

Fixes pr30184.

llvm-svn: 280242
2016-08-31 13:42:08 +00:00
Rafael Espindola e7553e4eac Delete unnecessary template.
llvm-svn: 280237
2016-08-31 13:28:33 +00:00
Rafael Espindola a6c9744a6c Delete DefinedBitcode.
Given that we almost always want to handle it as DefinedRegular, just
use DefinedRegular.

llvm-svn: 280226
2016-08-31 12:30:34 +00:00
Davide Italiano 29fa6ab7b1 [LTO/InputFiles] Merge two ifs into one. NFCI.
llvm-svn: 280225
2016-08-31 12:27:47 +00:00
Davide Italiano 30ed8106ad [LTO] Simplify unnamed_addr handling logic. NFCI.
llvm-svn: 280224
2016-08-31 12:20:46 +00:00
Simon Atanasyan e5532a12f7 [ELF][MIPS] Support R_MIPS_HIGHER / R_MIPS_HIGHEST relocations calculation
llvm-svn: 280223
2016-08-31 11:47:21 +00:00
Simon Atanasyan 97519cba2e [ELF][MIPS] Inline function. NFC
llvm-svn: 280222
2016-08-31 11:47:17 +00:00
George Rimar 20b6598c10 [ELF] - Remove VersionScriptParser class and move the members to ScriptParser
Patch removes VersionScriptParser class and moves the members to ScriptParser
It opens road for implementation of VERSION linkerscript command.

Differential revision: https://reviews.llvm.org/D23774

llvm-svn: 280212
2016-08-31 09:08:26 +00:00
George Rimar ebf1da565c [ELF] - Fix (partial) for bug 28843 - Make sure we handle options with opposing meanings.
As stated in PR28843:

we should handle command lines with

-target1-rel -target1-abs
--demangle --no-demangle
Patch implements this for specified options.
There are probably other conflicting options can exist,
so fix is called "partial".

Differential revision: https://reviews.llvm.org/D23867

llvm-svn: 280211
2016-08-31 08:53:21 +00:00
Eugene Leviant aa49819162 Add DT_REL(A)COUNT tag to .dynamic section
This patch groups relative relocations in a single block
in combrelocs mode and adds DT_RELCOUNT or DT_RELACOUNT
tag to .dynamic section

Differential revision: https://reviews.llvm.org/D23661

llvm-svn: 280210
2016-08-31 08:51:39 +00:00
George Rimar 9503f6d211 [ELF] - Introduce DiscardPolicy instead of 3 relative bool fields.
DiscardPolicy is enum replacing several boolean options. 
This approach is not only consistent with what we use for 
unresolveds (UnresolvedPolicy), but also should help to solve a problem 
of options with opposing meanings, mentioned in PR28843

Differential revision: https://reviews.llvm.org/D23868

llvm-svn: 280209
2016-08-31 08:46:30 +00:00
George Rimar f21aade0d8 [ELF] - Introduce StripPolicy instead of Config->StripAll/StripDebug flags.
This approach is not only consistent with UnresolvedPolicy, 
but also should help to solve a problem 
of options with opposing meanings, mentioned in PR28843

Differential revision: https://reviews.llvm.org/D23869

llvm-svn: 280206
2016-08-31 08:38:11 +00:00
Eugene Leviant 20889c51b7 Allow adding start/end symbols to any section
Allows adding start and/or end symbols to special output sections,
like .eh_frame_hdr, which aren't lists of regular input sections. 

Differential revision: https://reviews.llvm.org/D23716

llvm-svn: 280205
2016-08-31 08:13:33 +00:00
Eugene Leviant e4f590faeb Allow .eh_frame_hdr to be placed before .eh_frame
Differential revision: https://reviews.llvm.org/D24041

llvm-svn: 280203
2016-08-31 07:43:50 +00:00
Rafael Espindola cceb92a075 Pass Binding instead of IsWeak to addBitcode.
We were computing the binding on both the caller and callee.

llvm-svn: 280156
2016-08-30 20:53:26 +00:00
Davide Italiano 35af5b3d21 [LTO] Fix the logic for dropping unnamed_addr.
Differential Revision:  https://reviews.llvm.org/D24037

llvm-svn: 280144
2016-08-30 20:15:03 +00:00
George Rimar 96659df09c [ELF] - Linkerscript: implemented ADDR command.
ADDR(section)
Return the absolute address (the VMA) of the named section.

Used in the wild, eg.: https://searchcode.com/file/53617342/arch/x86/kernel/vmlinux.lds.S

Differential revision: https://reviews.llvm.org/D23913

llvm-svn: 280070
2016-08-30 09:54:01 +00:00
George Rimar a2496cbed4 [ELF] - Fix for: bug 29115 - linkerscript does not support non-wildcard filename spec.
FreeBSD/mips script has non-wildcard filename specifications:
.text :
{
 start.o(.text*)

Patch adds support for that, this is PR29115.

Differential revision: https://reviews.llvm.org/D23839

llvm-svn: 280069
2016-08-30 09:46:59 +00:00
George Rimar 7af6452927 [ELF] - Use early return. NFC.
This addresses forgotten review comment for r280067:
"[ELF] - Versionscript: support wildcards for extern "c++" tag."

llvm-svn: 280068
2016-08-30 09:39:36 +00:00
George Rimar 397cd87a69 [ELF] - Versionscript: support wildcards for extern "c++" tag.
Previously for extern keyword only names in quotes (exact match) was supported.
Patch adds support for wildcards, so next scripts can be handled properly:

LIBSAMPLE_1.0 {
   global:            
     extern "C++" {  
       foo*;   
   };                  
 };

Differential revision: https://reviews.llvm.org/D23794

llvm-svn: 280067
2016-08-30 09:35:03 +00:00
George Rimar c3ec9d0cbf [ELF] - Cleanup of scanVersionScript(): do not change local Demangled variable. NFC.
llvm-svn: 280066
2016-08-30 09:29:37 +00:00
Rui Ueyama 2c8f1f048c Make lld actually compatible with gold in terms of filler handling.
GNU gold handles output section fillers as 32-bit values.
This patch makes LLD compatible with that behavior.

Differential revision: https://reviews.llvm.org/D23181

llvm-svn: 280018
2016-08-29 22:01:21 +00:00
Saleem Abdulrasool dcbf2cbfca COFF: disambiguate make_unique (NFC)
This disambiguates `llvm::make_unqiue` and `std::make_unique` for the Windows
buildbots.

llvm-svn: 280014
2016-08-29 21:33:01 +00:00
Saleem Abdulrasool 8fcff934ba COFF: add beginnings of debug directory creation
The IMAGE_FILE_HEADER structure contains a (RVA, size) to an array of
COFF_DEBUG_DIRECTORY records. Each one of these records contains an RVA to a OMF
Debug Directory. These OMF debug directories are derived into newer types such
as PDB70, PDB20, etc. This constructs a PDB70 structure which will allow us to
associate a GUID with a build to actually tie debug information.

llvm-svn: 280012
2016-08-29 21:20:46 +00:00
Eugene Leviant 933dae7435 Implement support for --build-id=uuid switch
Differential revision: https://reviews.llvm.org/D23349

llvm-svn: 279810
2016-08-26 09:55:37 +00:00
Eugene Leviant 0bbb600a9c [ELF] Added test case for PROVIDE and PROVIDE_HIDDEN within section
llvm-svn: 279809
2016-08-26 09:48:32 +00:00
Hemant Kulkarni 3ed7dc705a Fix test corresponding to change r279770
llvm-svn: 279775
2016-08-25 20:43:49 +00:00
George Rimar 449cf3e44a Removed trailing whitespace. NFC.
llvm-svn: 279729
2016-08-25 10:39:04 +00:00
George Rimar 86ce267a4a [ELF] - Implemented --oformat binary option.
-oformat output-format
`-oformat' option can be used to specify the binary format for the output object file.

Patch implements binary format output type.

Differential revision: https://reviews.llvm.org/D23769

llvm-svn: 279726
2016-08-25 09:05:47 +00:00
Nico Weber d08aa5c391 fix typo "varaibles"
llvm-svn: 279638
2016-08-24 16:36:41 +00:00
Peter Smith a52864a78c Canonicalize output section name for .ARM.exidx sections
The ARM Exception handling ABI requires that all ARM exception index
table sections have a prefix of .ARM.exidx and are combined into a
single contiguous block either in their own output section or as part
of another output section.
    
In general clang will output a single .ARM.exidx section per object,
but will use .ARM.exidx.<section name> when -ffunction-sections is used.
    
This change canonicalizes the names of sections with the .ARM.exidx
prefix to just .ARM.exidx, which ensures that there is only a single
output section.

Differential Revision: https://reviews.llvm.org/D23775

llvm-svn: 279617
2016-08-24 09:08:54 +00:00
Rafael Espindola cc3dd629ee Add support for '|' in expressions.
llvm-svn: 279480
2016-08-22 21:33:35 +00:00
Petr Hosek 5b4f6c6b28 [ELF] Only print symbol name when it is available
Not only symbols (like sections) have names, in case where we
fail to create relocation against such symbol, we should not
print out an empty string, instead we should print a generic
message.

Differential Revision: https://reviews.llvm.org/D23731

llvm-svn: 279459
2016-08-22 19:01:53 +00:00
Duncan P. N. Exon Smith c9e8bc191c ADT: Remove uses of ilist_*sentinel_traits, NFC
llvm-svn: 279458
2016-08-22 18:59:33 +00:00
Petr Hosek 901948a205 [ELF] ICF should respect section alignment
When performing ICF, we have to respect the alignment requirement
of each section within each group.

Differential Revision: https://reviews.llvm.org/D23732

llvm-svn: 279456
2016-08-22 18:53:09 +00:00