Commit Graph

3664 Commits

Author SHA1 Message Date
Tanya Lattner
f1f1a4f161 Make it possible to use the linker without destroying the source module. This is so the source module can be linked to multiple other destination modules. For all that used LinkModules() before, they will continue to destroy the source module as before.
This line, and those below, will be ignored--

M    include/llvm/Linker.h
M    tools/bugpoint/Miscompilation.cpp
M    tools/bugpoint/BugDriver.cpp
M    tools/llvm-link/llvm-link.cpp
M    lib/Linker/LinkModules.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141606 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 00:24:54 +00:00
Nick Lewycky
023bb15bea Add support for dumping section headers to llvm-objdump. This uses the same
flags as binutils objdump but the output is different, not just in format but
also showing different sections. Compare its results against readelf, not
objdump.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141579 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 21:21:34 +00:00
Benjamin Kramer
d226ed71f2 llvm-objdump: Take ownership of MCInstrInfos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141535 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 13:10:09 +00:00
Benjamin Kramer
1a9908daeb llvm-nm: Don't leak bitcode buffers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141534 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 13:10:04 +00:00
Michael J. Spencer
27781b78e1 llvm-objdump: Add relocation and archive support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141451 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 00:18:30 +00:00
Michael J. Spencer
20990397a4 Fix a few changes I missed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 19:52:41 +00:00
Michael J. Spencer
01a4db3ed4 Fix GCC again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141389 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 19:46:12 +00:00
Michael J. Spencer
3773fb46ba Fix spelling in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141386 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 19:25:47 +00:00
Michael J. Spencer
4344b1ef9b Change relocation API to be per section. This time without breaking GCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141385 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 19:25:32 +00:00
Bill Wendling
a48ad13339 Revert 141376 and 141377 due to breaking the build.
--- Reverse-merging r141377 into '.':
U    tools/llvm-objdump/MachODump.cpp
--- Reverse-merging r141376 into '.':
U    include/llvm/Object/COFF.h
U    include/llvm/Object/ObjectFile.h
U    include/llvm-c/Object.h
U    tools/llvm-objdump/llvm-objdump.cpp
U    lib/Object/MachOObjectFile.cpp
U    lib/Object/COFFObjectFile.cpp
U    lib/Object/Object.cpp
U    lib/Object/ELFObjectFile.cpp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141379 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 18:25:37 +00:00
Michael J. Spencer
67370ef903 Fix spelling in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141377 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 18:15:40 +00:00
Michael J. Spencer
f1164a2487 Change relocation API to be per section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 18:15:25 +00:00
Devang Patel
1e97def44a Update cmake list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 19:38:16 +00:00
Devang Patel
58c620024a Put GCOVFile and other related interface in a common header so that llvm-cov tool can share it with GCOV writer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141095 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 17:24:48 +00:00
Peter Collingbourne
e97552e850 Exclude libLLVMTableGen.a from the shared library
Unbreaks tools for --enable-shared build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 00:30:34 +00:00
Devang Patel
0066f9290e Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140789 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 17:06:40 +00:00
Devang Patel
a5ef699f41 Clarify comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140787 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 16:52:53 +00:00
Devang Patel
8d6c0fb979 Remove unnecessary and unused data member.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140786 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 16:48:44 +00:00
Devang Patel
7a50202be5 Cosmetic changes, as per Nick's review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140785 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 16:46:47 +00:00
Andrew Trick
f47e870015 Fix build failures better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140758 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 01:22:31 +00:00
Daniel Dunbar
7f3654db0c Fix build failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 01:14:42 +00:00
Michael J. Spencer
75c4abacaa llvm-size: Apply Chris's code review fixes.
This doesn't use formated_raw_ostream because it doesn't support the
functionality needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140751 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 00:59:18 +00:00
Michael J. Spencer
7da52dd2fa Fix cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 21:24:44 +00:00
Michael J. Spencer
32a12ba8c0 Add llvm-size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140722 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 20:57:46 +00:00
Devang Patel
d02c42bb85 Introduce llvm-cov.
Add llvm-cov skeleton. It has initial support to read coverage info generated by GCOVProfiling.cpp. 
Today, you can do
prompt> clang a.c -ftest-coverage -fprofile-arcs -o a
prompt> ./a
prompt> llvm-cov -gcno a.gcno -gcda a.gcda 
a.c
 :	#include "a.h"
 :	
 :	int main() {
 :		int i = 0;
 :		if (i) {
1:			int j = 0;
1:			j = 1;
1:		} else {
 :			int k = 1;
 :			k = 2;
 :		}
1:		return 0;
 :	}
 :	
 :	




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140712 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 18:50:00 +00:00
Michael J. Spencer
9142ae2cf8 Add binary archive support to llvm-nm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140627 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 19:37:18 +00:00
Benjamin Kramer
afbaf48fc4 llvm-objdump: Detach symbol listing from section enumeration for mach-o.
This reduces memory usage as we don't add the same symbol multiple times anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140278 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 22:16:43 +00:00
Benjamin Kramer
91c603bcfe llvm-objdump: Take the data from the right object when there's no dSYM around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 18:18:53 +00:00
Benjamin Kramer
b5b8d20ddd llvm-objdump: Fix use after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140237 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 04:01:19 +00:00
Benjamin Kramer
8c93097c4c llvm-objdump: Output line info next to the disassembly if available.
MachO-only at the moment, sorry.

Usage:
$ llvm-objdump -d -m -g -dsym=a.out.dSYM/Contents/Resources/DWARF/a.out a.out
_main:
100000e90:	55	pushq %rbp	## test.c:11:3
…

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140224 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 01:13:19 +00:00
Benjamin Kramer
a894c8e344 llvm-objdump: factor code better, add comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140153 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 17:53:01 +00:00
Eric Christopher
6ddbcdf928 Remove llvmc from CMake as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 00:13:13 +00:00
Eric Christopher
f11750633d Remove llvmc and assorted build machinery for it.
The problems that llvmc solved have largely been subsumed with the
tasks that the clang driver can accomplish, but llvmc lacks flexibility
and depends too heavily on the EOL'd llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140093 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 23:22:41 +00:00
Benjamin Kramer
bcc1a737f5 Nope, there's another one!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:23:01 +00:00
Benjamin Kramer
49ca96d7c2 Missed one instance of implicit pointer conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:14:46 +00:00
Benjamin Kramer
4d90638130 Try to make MSVC 2010 happy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 20:08:52 +00:00
Benjamin Kramer
0b8b771e9f Add a MachO-specific "mode" to llvm-objdump, that, if enabled, gathers additional information that are only available on MachO.
- It can take FunctionStarts from a binary to find entry points more accurately.
- Symbol offsets in executables are correct now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140028 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 17:56:04 +00:00
Chad Rosier
4e0a55d0d1 Add -rfunc and -rglob options to llvm-extract to support regular
expression matching.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139945 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16 21:09:17 +00:00
Owen Anderson
98c5ddabca Don't attach annotations to MCInst's. Instead, have the disassembler return, and the printer accept, an annotation string which can be passed through if the client cares about annotations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139876 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 23:38:46 +00:00
Ivan Krasin
71280b55a3 use 64-bit types instead of off_t/size_t to avoid the issue when
gold plugin is built with Large File Support (sizeof(off_t) == 64 on i686)
and the rest of LLVM is built w/o Large File Support
(sizeof(off_t) == 32 on i686) which corrupts the stack.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139873 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 23:13:00 +00:00
Benjamin Kramer
6b3ae4638b llvm-dwarfdump: Add an option to print out line info for a specific address
Usage:
$ llvm-dwarfdump -address=0x0000000100000ed4 a.out.dSYM/Contents/Resources/DWARF/a.out 
xxx.c:6:0

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139850 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 21:17:40 +00:00
Benjamin Kramer
34f864fd38 DWARF: wire up .debug_str dumping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139799 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 16:57:13 +00:00
Benjamin Kramer
b848e97611 DWARF: Add basic support for line tables.
The llvm-dwarfdump output isn't very verbose yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139771 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 02:12:05 +00:00
Benjamin Kramer
1c0b24f91a llvm-dwarfdump: Make the "is debug info section" heuristic stricter so it doesn't accidentaly picks up the wrong section.
Also add some validation code to the aranges section parser.

Fixes PR10926.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139701 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 17:28:13 +00:00
Benjamin Kramer
ac241fe9f0 Object: make the following changes into SymbolRef
- Add enum SymbolType and function getSymbolType()
- Add function isGlobal() - it's returns true for symbols that can be used in another objects, such as library functions.
- Rename function getAddress() to getOffset() and add new function getAddress(), because currently getAddress() returns section offset of symbol first byte. new getAddress() return symbol address.
- Change usage SymbolRef::getAddress() to getOffset() in tools/llvm-nm and tools/llvm-objdump.

Patch by Danil Malyshev!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139683 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 01:22:52 +00:00
Benjamin Kramer
358f4fd9ee DWARF: Port support for parsing .debug_aranges section from LLDB and wire it up to llvm-dwarfdump.
This is only one half of it, the part that caches address ranges from the DIEs when .debug_aranges is
not available will be ported soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139680 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 01:09:52 +00:00
Benjamin Kramer
72c0d7fdd3 Sketch out a DWARF parser.
This introduces a new library to LLVM: libDebugInfo. It will provide debug information
parsing to LLVM. Much of the design and some of the code is taken from the LLDB project.

It also contains an llvm-dwarfdump tool that can dump the abbrevs and DIEs from an
object file. It can be used to write tests for DWARF input and output easily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139627 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 19:42:23 +00:00
Ivan Krasin
ccb7c906d1 gold plugin: don't report error on non-bitcode (e.g. ELF) files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139544 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 21:47:50 +00:00
Ivan Krasin
c170f5f31c gold plugin: report errors occured in lto_module_create_from_*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 00:14:04 +00:00
Ivan Krasin
6d483c2b07 lto/addAsmGlobalSymbols: fast path when no module level asm is present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139284 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 07:38:25 +00:00