Commit Graph

193 Commits

Author SHA1 Message Date
David Meyer
2c67727046 [Object] Add symbol attribute flags: ST_ThreadLocal, ST_Common, and ST_Undefined. Implement these completely for ELF.
Rename ST_External to ST_Unknown, and slightly change its semantics. It now only indicates that the symbol's type
is unknown, not that the symbol is undefined. (For that, use ST_Undefined).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151696 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 02:11:55 +00:00
David Meyer
c46255a32e In the ObjectFile interface, replace isInternal(), isAbsolute(), isGlobal(), and isWeak(), with a bitset of flags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151670 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 23:47:53 +00:00
Michael J. Spencer
dfa1896b6b [Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.
Add -D option to llvm-nm to dump dynamic symbols.

Patch by David Meyer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151600 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 00:40:37 +00:00
Benjamin Kramer
e1a4427ccb Remove static ctor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151160 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-22 13:42:11 +00:00
Eli Bendersky
f4eff4baeb Expose the ELFObjectFile class directly in the Object/ELF.h header, similarly
to what's done for MachO and COFF. This allows advanced uses of the class to
be implemented outside the Object library. In particular, the DyldELFObject
subclass is now moved into its logical home - ExecutionEngine/RuntimeDyld.

This patch was reviewed by Michael Spencer.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150327 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-12 06:12:10 +00:00
Dylan Noblesmith
069df954a1 Object: avoid undefined behavior when bounds-checking
Don't form an out of bounds pointer just to test if it
would be out of bounds.

Also perform the same bounds checking for all the previous
mapped structures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149750 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-04 02:41:39 +00:00
Matt Beaumont-Gay
7f64823edb Sink assert-only variables into the asserts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24 19:43:30 +00:00
Matt Beaumont-Gay
ee705a73f6 Silence warnings in -asserts build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148715 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-23 18:46:04 +00:00
Eli Bendersky
b2798fab4e Remove trailing spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148654 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-22 09:02:48 +00:00
Eli Bendersky
24973c1063 Basic runtime dynamic loading capabilities added to ELFObjectFile, implemented
in a subclass named DyldELFObject. This class supports rebasing the object file
it represents by re-mapping section addresses to the actual memory addresses
the object was placed in. This is required for MC-JIT implementation on ELF with
debugging support.

Patch reviewed on llvm-commits.

Developed together with Ashok Thirumurthi and Andrew Kaylor.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148653 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-22 09:01:03 +00:00
Rafael Espindola
aba65b05fc Remove unused variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147261 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-25 01:20:19 +00:00
David Blaikie
2d24e2a396 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146960 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-20 02:50:00 +00:00
Daniel Dunbar
4ab406d7fc LLVMBuild: Remove trailing newline, which irked me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 19:48:00 +00:00
Daniel Dunbar
d782bae970 build/CMake: Finish removal of add_llvm_library_dependencies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145420 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 19:25:30 +00:00
Danil Malyshev
b0436a7305 Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 17:40:10 +00:00
Daniel Dunbar
a483fc8e6f Fix some possible gcc-4.2 may be used uninitialized warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145292 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 22:19:32 +00:00
Chandler Carruth
790552c20f Revert r145180 as it is causing test failures on all the bots.
Original commit message:
Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-27 10:37:47 +00:00
Danil Malyshev
9b24738bd1 Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145180 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-27 10:12:52 +00:00
Michael J. Spencer
11ba26db13 Object/COFF: Support common symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144861 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-16 23:36:12 +00:00
Daniel Dunbar
b8ebca83f4 build: Attempt to rectify inconsistencies between CMake and LLVMBuild versions of explicit dependencies.
- The hope is that we have a tool/test to verify these are accurate (and tight) soon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144444 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-12 02:10:57 +00:00
Michael J. Spencer
7151ddd6ef Object/COFF: Fix PE reading.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144148 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08 23:34:07 +00:00
Benjamin Kramer
ef56d1d35d MachOObject: Use DataExtractor's uleb parser instead of rolling our own.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143810 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-05 12:13:21 +00:00
Benjamin Kramer
efd2d5e1c4 Simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143695 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 13:52:17 +00:00
Daniel Dunbar
a3a2dfd4a2 build: Add initial cut at LLVMBuild.txt files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143634 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-03 18:53:17 +00:00
Chad Rosier
eefb0de6dc Removed unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143591 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 23:21:55 +00:00
Michael J. Spencer
783d88793a object/COFF: Properly initalize uses of DataRefImpl.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143562 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 19:33:26 +00:00
Michael J. Spencer
c8a55a660e Object/Archive: Add symbol table iteration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-02 19:33:12 +00:00
Owen Anderson
b28bdbf846 If we're searching for a symbol reference to pretty-print a scattered relocation address, and we don't find a symbol table entry, try section begin addresses as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143151 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 21:53:50 +00:00
Owen Anderson
eb6bd33995 Fix pretty printing of i386 local sect diff relocations, TLV relocations, and x86_64 TLV relocations in MachO.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 20:46:09 +00:00
Owen Anderson
3529c53d2f Expose relocation accessors through the libObject C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 17:32:36 +00:00
Owen Anderson
d8b0b915c5 Add relocation iterators to the libObject C API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143107 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 17:15:47 +00:00
Owen Anderson
1832f4d94e Add support for scattered relocations to the MachO relocatation pretty printer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143051 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 20:42:54 +00:00
Owen Anderson
ef22f78c68 The order of the two symbol listings in a Macho x86_64 subtractor relocation is reversed from what seems intuitive to me.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 17:28:49 +00:00
Owen Anderson
f8261e7d07 Include the full 64 bits of relocation data in the type info for MachO relocations, so that we can recognize scattered relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143033 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 17:10:22 +00:00
Owen Anderson
9472b8d220 Expand relocation type field to 64 bits. MachO scattered relocations require 33 bits of type info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 17:08:49 +00:00
Owen Anderson
929e27cc3c Improve pretty printing of GOT relocations in MachO on x86_64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143031 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 17:05:20 +00:00
Eric Christopher
b64541fc72 Remove unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@143011 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-26 03:47:16 +00:00
Michael J. Spencer
fe944e8cd0 Object/Archive: Cleanup anon namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142983 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 22:31:11 +00:00
Michael J. Spencer
aaf98ead11 Object/Archive: Add BSD style long file name support and skip internal members.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142981 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 22:30:42 +00:00
Owen Anderson
c8aa726ec2 Remove extraneous printing of "-PC".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 20:44:00 +00:00
Owen Anderson
0685e94895 Add support for the notion of "hidden" relocations. On MachO, these are relocation entries that are used as additional information for other, real relocations, rather than being relocations themselves.
I'm not familiar enough with ELF or COFF to know if they should have any relocations marked hidden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 20:35:53 +00:00
Owen Anderson
013d756310 Teach the MachO relocation pretty-printer to interpret ARM half-relocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-25 18:48:41 +00:00
Owen Anderson
d8fa76d4be More fixes and improvements to MachO relocation pretty-printing, particular for x86 and x86_64 relocations with addends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142875 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 23:20:07 +00:00
Owen Anderson
0135fe1854 Get relocation parsing/dumping to a mostly-working state for MachO files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 21:44:00 +00:00
Owen Anderson
5f4e02cbf1 Stub out some of the MachO relocation decoding hooks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142840 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 20:19:18 +00:00
Owen Anderson
ca7eb3e171 Use LLVMBool for a function that logically returns a boolean value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142683 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 20:35:58 +00:00
Owen Anderson
a48aab924d STABS symbols are debug symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142673 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 19:26:54 +00:00
Owen Anderson
e2fa64ef22 Bind libObject API for obtaining the section containing a Symbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 18:21:22 +00:00
Owen Anderson
3cb056797b Expand the coverage of the libObject C bindings to include more SectionRef accessors as well as Symbol iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142661 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 17:50:59 +00:00
Michael J. Spencer
7c24665390 Object/COFF: Remove useless test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 19:51:36 +00:00
Michael J. Spencer
5e3a082c79 Object/COFF: Change type from a struct to a uint16_t. The struct would be
incorrect for bigendian systems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142403 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 19:31:59 +00:00
Michael J. Spencer
206d17cf60 Object: Add some types to SymbolRef::Type.
Some of these can be true at the same time and there are a lot to add,
so this should be turned into a bitfield. Some of the other accessors
should probably be folded into this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142318 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:55:06 +00:00
Michael J. Spencer
9b2b812fea Object: Add isSymbolAbsolute and getSymbolSection.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142317 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:54:46 +00:00
Michael J. Spencer
c38c36a8c4 Object: Add isSymbolWeak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142316 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:54:22 +00:00
Michael J. Spencer
0e752cb4b4 Object/COFF: Expose more data in the public API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142315 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:53:56 +00:00
Michael J. Spencer
ab6bcf35ae Object: Implement casting for concrete classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:53:37 +00:00
Michael J. Spencer
1130a799ab Object: Fix redundant name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142238 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 20:19:29 +00:00
Michael J. Spencer
63b2f8c710 ELF: Fix the section that relocations apply to. Add test to verify. Patch by Danil Malyshev!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141901 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 22:30:10 +00:00
Michael J. Spencer
bff6f8679a COFF: Implement sectionContainsSymbol for relocatable files only.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141884 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 20:36:54 +00:00
Nick Lewycky
f77dea13d7 Elf_Word is not POD! Stop using it in a DenseMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141851 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 03:30:21 +00:00
Owen Anderson
95f8db4d4d The VMAs stored in the symbol table of a MachO file are absolute addresses, not offsets from the section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141828 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 22:37:10 +00:00
Owen Anderson
10a8c62d46 Don't label a STAB debugging symbol as a function symbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141824 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 22:23:12 +00:00
Owen Anderson
cd74988fb9 sectionContainsSymbol needs to be based on VMA's rather than section indices to properly account for files with segment load commands that contain no sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141822 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 22:21:32 +00:00
Owen Anderson
41242942fc Section indices in MachO symbol tables begin at 1, not 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141815 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 21:43:24 +00:00
NAKAMURA Takumi
18dcb87f6b lib/Object/ELFObjectFile.cpp: Fix undefined behavior for MC/ELF/many-section.s not to fail (on msvc).
DenseMap::lookup(k) would return "default constructor value" when k was not met. It would be useless when value type were POD.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12 10:28:55 +00:00
Owen Anderson
f7c93a3867 Expose MachOObjectFile externally, like we do for COFF. First step in reducing the amount of special-purpose code needed for llvm-objdump.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141684 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 17:32:27 +00:00
Nick Lewycky
bfbbe32837 Reapply r141605 with fixes for appropriate handling of reserved section numbers
in st_shndx fields.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 03:18:58 +00:00
Nick Lewycky
15c3f727ae Add support for .symtab_shnidx. Unfortunately, doing this required breaking a
layer of abstraction around SymbolRef where you can read its private
SymbolPimpl member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141636 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 02:57:48 +00:00
Nick Lewycky
fb05d3d686 Revert r141605 as it broke tests for llvm-nm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141614 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 00:38:56 +00:00
Nick Lewycky
fad138dd79 Add support for reading many-section ELF files.
If you want to tackle adding the testcase, let me know. It's a 4.2MB ELF file
and I'll be happy to mail it to you.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 00:15:42 +00:00
Michael J. Spencer
15565ad758 Fix warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141597 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 23:36:56 +00:00
Michael J. Spencer
e2f2f07be7 Object: add getSectionAlignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 21:55:43 +00:00
NAKAMURA Takumi
48f248ad5f lib/Object: Suppress warnings on gcc-4.3.4 cygwin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 11:22:53 +00:00
Michael J. Spencer
c6500a5d77 Object: Add support for opening stdin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 00:17:58 +00:00
Michael J. Spencer
5861893c25 Object: constize Archive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141448 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 00:17:45 +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
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
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
Michael J. Spencer
13afc5eff2 Object: Add isSection{Data,BSS}.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 20:57:30 +00:00
Michael J. Spencer
a51d7d97b0 Object: Add archive support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140626 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 19:36:55 +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
836623420d ObjectFile: Add support for mach-o-style dSYM companion files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139676 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 00:39:22 +00:00
Benjamin Kramer
cee58a69fa Silence false positive uninitialized variable warnings from GCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-13 01:59:24 +00:00
Benjamin Kramer
d40b0b0a06 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 00:22:05 +00:00
Nick Lewycky
58856eae16 Fix release build:
MachOObjectFile.cpp:524: error: unused variable 'NumLoadCommands' [-Wunused-variable]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139341 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-09 00:16:50 +00:00
Benjamin Kramer
0fcab076f0 Add support for relocations to ObjectFile.
Patch by Danil Malyshev!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-08 20:52:17 +00:00
Benjamin Kramer
d4522460d4 Teach macho-dump to dump the uleb128s referred to by linkedit_data segments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138836 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-30 22:10:58 +00:00
Benjamin Kramer
9942acab0a Teach macho-dump how to dump linkedit_data load commands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-30 18:33:37 +00:00
Chandler Carruth
ac03e736c7 Rewrite the CMake build to use explicit dependencies between libraries,
specified in the same file that the library itself is created. This is
more idiomatic for CMake builds, and also allows us to correctly specify
dependencies that are missed due to bugs in the GenLibDeps perl script,
or change from compiler to compiler. On Linux, this returns CMake to
a place where it can relably rebuild several targets of LLVM.

I have tried not to change the dependencies from the ones in the current
auto-generated file. The only places I've really diverged are in places
where I was seeing link failures, and added a dependency. The goal of
this patch is not to start changing the dependencies, merely to move
them into the correct location, and an explicit form that we can control
and change when necessary.

This also removes a serialization point in the build because we don't
have to scan all the libraries before we begin building various tools.
We no longer have a step of the build that regenerates a file inside the
source tree. A few other associated cleanups fall out of this.

This isn't really finished yet though. After talking to dgregor he urged
switching to a single CMake macro to construct libraries with both
sources and dependencies in the arguments. Migrating from the two macros
to that style will be a follow-up patch.

Also, llvm-config is still generated with GenLibDeps.pl, which means it
still has slightly buggy dependencies. The internal CMake
'llvm-config-like' macro uses the correct explicitly specified
dependencies however. A future patch will switch llvm-config generation
(when using CMake) to be based on these deps as well.

This may well break Windows. I'm getting a machine set up now to dig
into any failures there. If anyone can chime in with problems they see
or ideas of how to solve them for Windows, much appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 00:14:25 +00:00
Benjamin Kramer
07ea23aa2d ObjectFile: Add a method to check whether a section contains a symbol.
- No ELF or COFF implementation yet, I don't have a way to test that.
  Should be straightforward to add though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135288 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 18:39:21 +00:00
Benjamin Kramer
32fb2af679 MachOObjectFile: Get symbol functions ready for 64 bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135282 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 17:32:45 +00:00
Benjamin Kramer
291e767dcf Output MachO section names in the form SEGMENT,section.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135231 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 00:29:02 +00:00
Benjamin Kramer
7d145789c0 Add support for 64 bit objects to MachOObjectFile.
- I don't see a better way than duplicating all the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135229 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 00:14:48 +00:00
Benjamin Kramer
82ba5b7c40 MachOObjectFile: Change isSectionText to return true for sections named text, not for load commands name __TEXT (which isn't the case in actual object files)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135228 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 00:14:46 +00:00
Benjamin Kramer
3209a03daf Use memcmp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134439 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 20:28:00 +00:00
Rafael Espindola
9b9c5ea2c3 Really fix typo :-(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134436 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 19:17:10 +00:00
Rafael Espindola
5ac795c56f Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134433 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 19:13:27 +00:00
Rafael Espindola
82c475d057 Compare all 4 bytes of the header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134427 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 18:41:47 +00:00
Michael J. Spencer
64388ceee0 Fix warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 14:48:59 +00:00