Commit Graph

97 Commits

Author SHA1 Message Date
Owen Anderson cef5641982 STABS symbols are debug symbols.
llvm-svn: 142673
2011-10-21 19:26:54 +00:00
Owen Anderson 07bfdbb233 Bind libObject API for obtaining the section containing a Symbol.
llvm-svn: 142667
2011-10-21 18:21:22 +00:00
Owen Anderson f239db40d5 Expand the coverage of the libObject C bindings to include more SectionRef accessors as well as Symbol iterators.
llvm-svn: 142661
2011-10-21 17:50:59 +00:00
Michael J. Spencer 443410d722 Object/COFF: Remove useless test.
llvm-svn: 142408
2011-10-18 19:51:36 +00:00
Michael J. Spencer 097be9f63c Object/COFF: Change type from a struct to a uint16_t. The struct would be
incorrect for bigendian systems.

llvm-svn: 142403
2011-10-18 19:31:59 +00:00
Michael J. Spencer 1d19f97ea5 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.

llvm-svn: 142318
2011-10-17 23:55:06 +00:00
Michael J. Spencer 321731539e Object: Add isSymbolAbsolute and getSymbolSection.
llvm-svn: 142317
2011-10-17 23:54:46 +00:00
Michael J. Spencer 017597540e Object: Add isSymbolWeak.
llvm-svn: 142316
2011-10-17 23:54:22 +00:00
Michael J. Spencer 89a7a5ea1f Object/COFF: Expose more data in the public API.
llvm-svn: 142315
2011-10-17 23:53:56 +00:00
Michael J. Spencer 4f91c2f2bd Object: Implement casting for concrete classes.
llvm-svn: 142314
2011-10-17 23:53:37 +00:00
Michael J. Spencer d39466760a Object: Fix redundant name.
llvm-svn: 142238
2011-10-17 20:19:29 +00:00
Michael J. Spencer 834bd602e6 ELF: Fix the section that relocations apply to. Add test to verify. Patch by Danil Malyshev!
llvm-svn: 141901
2011-10-13 22:30:10 +00:00
Michael J. Spencer 9a28851e52 COFF: Implement sectionContainsSymbol for relocatable files only.
llvm-svn: 141884
2011-10-13 20:36:54 +00:00
Nick Lewycky d3043965b9 Elf_Word is not POD! Stop using it in a DenseMap.
llvm-svn: 141851
2011-10-13 03:30:21 +00:00
Owen Anderson 000721f058 The VMAs stored in the symbol table of a MachO file are absolute addresses, not offsets from the section.
llvm-svn: 141828
2011-10-12 22:37:10 +00:00
Owen Anderson 34e1707fbb Don't label a STAB debugging symbol as a function symbol.
llvm-svn: 141824
2011-10-12 22:23:12 +00:00
Owen Anderson fb02ecde5e 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.
llvm-svn: 141822
2011-10-12 22:21:32 +00:00
Owen Anderson f903c154c7 Section indices in MachO symbol tables begin at 1, not 0.
llvm-svn: 141815
2011-10-12 21:43:24 +00:00
NAKAMURA Takumi 9bfcf77638 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.

llvm-svn: 141774
2011-10-12 10:28:55 +00:00
Owen Anderson 27c579dba4 Expose MachOObjectFile externally, like we do for COFF. First step in reducing the amount of special-purpose code needed for llvm-objdump.
llvm-svn: 141684
2011-10-11 17:32:27 +00:00
Nick Lewycky 43f01cae95 Reapply r141605 with fixes for appropriate handling of reserved section numbers
in st_shndx fields.

llvm-svn: 141639
2011-10-11 03:18:58 +00:00
Nick Lewycky 7adc4370e0 Add support for .symtab_shnidx. Unfortunately, doing this required breaking a
layer of abstraction around SymbolRef where you can read its private
SymbolPimpl member.

llvm-svn: 141636
2011-10-11 02:57:48 +00:00
Nick Lewycky 35a90c4baf Revert r141605 as it broke tests for llvm-nm.
llvm-svn: 141614
2011-10-11 00:38:56 +00:00
Nick Lewycky fdbb7c51e9 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.

llvm-svn: 141605
2011-10-11 00:15:42 +00:00
Michael J. Spencer ee3be4f2a9 Fix warning.
llvm-svn: 141597
2011-10-10 23:36:56 +00:00
Michael J. Spencer 7989460a1f Object: add getSectionAlignment.
llvm-svn: 141581
2011-10-10 21:55:43 +00:00
NAKAMURA Takumi 648b2fafd8 lib/Object: Suppress warnings on gcc-4.3.4 cygwin
llvm-svn: 141485
2011-10-08 11:22:53 +00:00
Michael J. Spencer 159970f733 Object: Add support for opening stdin.
llvm-svn: 141449
2011-10-08 00:17:58 +00:00
Michael J. Spencer 7eb8159927 Object: constize Archive.
llvm-svn: 141448
2011-10-08 00:17:45 +00:00
Michael J. Spencer cfb6cc7b14 Fix GCC again.
llvm-svn: 141389
2011-10-07 19:46:12 +00:00
Michael J. Spencer e5fd004719 Change relocation API to be per section. This time without breaking GCC.
llvm-svn: 141385
2011-10-07 19:25:32 +00:00
Bill Wendling 206d8a7f48 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

llvm-svn: 141379
2011-10-07 18:25:37 +00:00
Michael J. Spencer b0d61540cb Change relocation API to be per section.
llvm-svn: 141376
2011-10-07 18:15:25 +00:00
Michael J. Spencer 800619f2bb Object: Add isSection{Data,BSS}.
llvm-svn: 140721
2011-09-28 20:57:30 +00:00
Michael J. Spencer d3b7b12618 Object: Add archive support.
llvm-svn: 140626
2011-09-27 19:36:55 +00:00
Benjamin Kramer 75d1cf3391 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!

llvm-svn: 139683
2011-09-14 01:22:52 +00:00
Benjamin Kramer 557a81e9d7 ObjectFile: Add support for mach-o-style dSYM companion files.
llvm-svn: 139676
2011-09-14 00:39:22 +00:00
Benjamin Kramer 40ddfedd6c Silence false positive uninitialized variable warnings from GCC.
llvm-svn: 139573
2011-09-13 01:59:24 +00:00
Benjamin Kramer eba0b40384 Remove dead code.
llvm-svn: 139343
2011-09-09 00:22:05 +00:00
Nick Lewycky 940b598f6f Fix release build:
MachOObjectFile.cpp:524: error: unused variable 'NumLoadCommands' [-Wunused-variable]

llvm-svn: 139341
2011-09-09 00:16:50 +00:00
Benjamin Kramer 022ecdf277 Add support for relocations to ObjectFile.
Patch by Danil Malyshev!

llvm-svn: 139314
2011-09-08 20:52:17 +00:00
Benjamin Kramer 58298f028c Teach macho-dump to dump the uleb128s referred to by linkedit_data segments.
llvm-svn: 138836
2011-08-30 22:10:58 +00:00
Benjamin Kramer 267a6d92fa Teach macho-dump how to dump linkedit_data load commands.
llvm-svn: 138807
2011-08-30 18:33:37 +00:00
Chandler Carruth 9d7feab3e0 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.

llvm-svn: 136433
2011-07-29 00:14:25 +00:00
Benjamin Kramer f6f3e81c07 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.

llvm-svn: 135288
2011-07-15 18:39:21 +00:00
Benjamin Kramer 99582e9b52 MachOObjectFile: Get symbol functions ready for 64 bit.
llvm-svn: 135282
2011-07-15 17:32:45 +00:00
Benjamin Kramer c41d4fe243 Output MachO section names in the form SEGMENT,section.
llvm-svn: 135231
2011-07-15 00:29:02 +00:00
Benjamin Kramer 56498d167a Add support for 64 bit objects to MachOObjectFile.
- I don't see a better way than duplicating all the code.

llvm-svn: 135229
2011-07-15 00:14:48 +00:00
Benjamin Kramer b1d80722a8 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)
llvm-svn: 135228
2011-07-15 00:14:46 +00:00
Benjamin Kramer e6490e03d7 Use memcmp.
llvm-svn: 134439
2011-07-05 20:28:00 +00:00