1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

391 Commits

Author SHA1 Message Date
Reid Kleckner
ce54720d68 [COFF] Return symbol VAs instead of RVAs for PE files
This makes llvm-nm consistent with binutils nm on executables and DLLs.
For a vanilla hello world executable, the address of main should include
the default image base of 0x400000.

llvm-svn: 243755
2015-07-31 16:14:22 +00:00
Tom Stellard
cb605de450 ELFYAML: Enable parsing of EM_AMDGPU
Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11263

llvm-svn: 243724
2015-07-31 01:15:15 +00:00
Rafael Espindola
6ee9519072 Support printing relocations in files with no section table.
llvm-svn: 242998
2015-07-23 09:11:05 +00:00
Rafael Espindola
8c9308a255 Refactor duplicated code and check for invalid symbol table size.
llvm-svn: 242981
2015-07-23 03:24:22 +00:00
Rafael Espindola
59556b8fec Force the gnu archive format to fix the test on darwin.
llvm-svn: 242949
2015-07-22 22:09:44 +00:00
Rafael Espindola
523d18a9a5 Fix fetching the symbol table of a thin archive.
We were trying to read it as an external file.

llvm-svn: 242926
2015-07-22 19:34:26 +00:00
Rafael Espindola
af54d5a241 Identify thin archives as archives.
llvm-svn: 242921
2015-07-22 18:29:39 +00:00
Michael J. Spencer
9eab0b93a6 [Object][ELF] Handle files with no section header string table.
llvm-svn: 242839
2015-07-21 21:40:33 +00:00
Rafael Espindola
8dc741d1bf Simplify iterating over the dynamic section and report broken ones.
llvm-svn: 242712
2015-07-20 21:23:29 +00:00
Rafael Espindola
1c58b24a44 Remove Elf_Rela_Iter and Elf_Rel_Iter.
Use just the pointers and check for invalid relocation sections.

llvm-svn: 242700
2015-07-20 20:07:50 +00:00
Rafael Espindola
3323a6b994 Report errors an invalid virtual addresses.
llvm-svn: 242676
2015-07-20 14:45:03 +00:00
Rafael Espindola
0fb99d1c9a Simplify iterating over program headers and detect corrupt ones.
We now use a simple pointer and have range loops.

llvm-svn: 242669
2015-07-20 13:35:33 +00:00
Rafael Espindola
04bc262b8d llvm-readobj: Handle invalid references to the string table.
llvm-svn: 242658
2015-07-20 03:38:17 +00:00
Rafael Espindola
d3ff9d7446 Move CHECKs closer to the RUN line.
llvm-svn: 242657
2015-07-20 03:31:25 +00:00
Rafael Espindola
7c36fd7751 llvm-readobj: call exit(1) on error.
llvm-readobj exists for testing llvm. We can safely stop the program
the first time we know the input in corrupted.

This is in preparation for making it handle a few more broken files.

llvm-svn: 242656
2015-07-20 03:23:55 +00:00
Rafael Espindola
d9685286be Trying to fix the windows bots.
llvm-svn: 242367
2015-07-16 00:38:34 +00:00
Rafael Espindola
b840aaf868 Fix handling of relative paths in thin archives.
The member has to end up with a path relative to the archive.

llvm-svn: 242362
2015-07-16 00:14:49 +00:00
Rafael Espindola
955d5aae40 llvm-ar: Don't write the directory in the string table.
We were already doing the right thing for short file names, but not long
ones.

llvm-svn: 242354
2015-07-15 23:15:33 +00:00
Rafael Espindola
cb9db3a66d Handle the error of trying to convert a regular archive to a thin one.
While at it, test that we can add to a thin archive.

llvm-svn: 242330
2015-07-15 20:45:56 +00:00
Rafael Espindola
71571d65a9 Initial support for writing thin archives.
llvm-svn: 242269
2015-07-15 05:47:46 +00:00
Rafael Espindola
92d8a3ae9e Accept lower case to handle windows error messages.
llvm-svn: 242236
2015-07-14 22:42:21 +00:00
Rafael Espindola
fadf8cbec7 Add support for reading members out of thin archives.
For now the Archive owns the buffers of the thin archive members.
This makes for a simple API, but all the buffers are destructed
only when the archive is destructed. This should be fine since we
close the files after mmap so we should not hit an open file
limit.

llvm-svn: 242215
2015-07-14 22:18:43 +00:00
Rafael Espindola
1893c5e76b llvm-ar: Don't try to extract from thin archives.
This matches the gnu ar behavior.

llvm-svn: 242162
2015-07-14 16:55:13 +00:00
Rafael Espindola
1724f6ab47 Sleep for 2.1 seconds to see if that makes the test stable on windows.
Might fix pr24106.

llvm-svn: 242158
2015-07-14 16:34:23 +00:00
Rafael Espindola
e5753ae917 llvm-ar: print an error when the requested member is not found.
llvm-svn: 242156
2015-07-14 16:02:40 +00:00
Rafael Espindola
926701ff8f Rename a test. NFC.
llvm-svn: 242151
2015-07-14 15:06:18 +00:00
Rafael Espindola
59e6986755 Add missing file.
Sorry about that.

llvm-svn: 242083
2015-07-13 23:14:26 +00:00
Rafael Espindola
61c7cb197d Fix reading archive members with / in the name.
This is important for thin archives.

llvm-svn: 242082
2015-07-13 23:07:05 +00:00
Rafael Espindola
8be47bcf22 Add support deterministic output in llvm-ar and make it the default.
llvm-svn: 242061
2015-07-13 20:38:09 +00:00
Michael J. Spencer
2a3efb265a [Object][ELF] Handle the dynamic string table in files without a section table.
llvm-svn: 241937
2015-07-10 20:11:57 +00:00
Michael J. Spencer
bb17a74bbd [Object][ELF] Support dumping hash-tables from files with no section table.
This time without breaking the bots.

llvm-svn: 241869
2015-07-09 22:32:24 +00:00
Rafael Espindola
111ba6bab3 Create BSD archives by default on OS X.
They should probably be created on anything that is not windows or linux, but I will
test on freebsd before changing that.

With this it is possible to bootstrap with llvm-ar instead of ar+ranlib on OS X.

llvm-svn: 241849
2015-07-09 20:12:50 +00:00
Rafael Espindola
282d12d41c llvm-ar: Pad the symbol table to 4 bytes.
It looks like ld64 requires it. With this we seem to be able to bootstrap using
llvm-ar+/usr/bin/true instead of ar+ranlib (currently on stage2).

llvm-svn: 241842
2015-07-09 19:48:06 +00:00
Simon Atanasyan
901c8a500a [yaml2obj] Initialize sh_addralign field for the .symtab section
llvm-svn: 241835
2015-07-09 18:23:02 +00:00
Simon Atanasyan
2f77b9cd0e [ELF] Explicitly configure sections alignment in the tests. NFC
llvm-svn: 241834
2015-07-09 18:22:55 +00:00
Rafael Espindola
bc80c9fa30 Add missing file from previous commit.
llvm-svn: 241815
2015-07-09 15:58:22 +00:00
Rafael Espindola
70e52a227c Basic support for BSD symbol tables in archives.
This could be optimized and for now we only produce __.SYMDEF
and not "__.SYMDEF SORTED".

llvm-svn: 241814
2015-07-09 15:56:23 +00:00
Adrian Prantl
e71dc1d0ed Temporarily reverting 241765, 241768, and 241772 to unbreak the build bots.
llvm-svn: 241781
2015-07-09 02:14:49 +00:00
Michael J. Spencer
b5535ebef9 [Object][ELF] Support dumping hash-tables from files with no section table.
llvm-svn: 241765
2015-07-09 00:21:06 +00:00
Rafael Espindola
a73aa6c568 Don't reject an archive with just a symbol table.
It is pretty unambiguous how to interpret it and gnu ar accepts it too.

llvm-svn: 241750
2015-07-08 22:27:54 +00:00
Rafael Espindola
116995db75 Start adding support for writing archives in BSD format.
No support for the symbol table yet (but will hopefully add it today).
We always use the long filename format so that we can align the member,
which is an advantage of the BSD format.

llvm-svn: 241721
2015-07-08 20:47:32 +00:00
Simon Atanasyan
3a38a7bfad [yaml2obj] Align section content using AddressAlign field's value
Use AddressAlign field's value to properly align sections content in the
yaml2obj tool. Before this change the yaml2obj ignored AddressAlign and
always aligned section on 16 bytes boundary.

llvm-svn: 241674
2015-07-08 10:12:40 +00:00
Simon Atanasyan
ed9fe7f06f [yaml2obj] Use regex to match sections offsets. NFC
llvm-svn: 241669
2015-07-08 06:57:24 +00:00
Rafael Espindola
5590e08308 Delete UnknownAddress. It is a perfectly valid symbol value.
getSymbolValue now returns a value that in convenient for most callers:
* 0 for undefined
* symbol size for common symbols
* offset/address for symbols the rest

Code that needs something more specific can check getSymbolFlags.

llvm-svn: 241605
2015-07-07 17:12:59 +00:00
Rafael Espindola
547db2d2a9 Common symbols are not undefined, at least for ObjectFile.
They are implemented like that in some object formats, but for the interface
provided by lib/Object, SF_Undefined and SF_Common are different things.

This matches the ELF and COFF implementation and fixes llvm-nm for MachO.

llvm-svn: 241587
2015-07-07 14:26:39 +00:00
Rafael Espindola
65d267277b llvm-nm: treat weak undefined as undefined.
This matches the behavior of gnu ld.

llvm-svn: 241512
2015-07-06 21:36:23 +00:00
Rafael Espindola
7b0c357367 When sorting by address, undefined symbols go first.
This matches gnu nm.

llvm-svn: 241488
2015-07-06 19:21:04 +00:00
Rafael Espindola
384e9f4564 Fix printing of common symbols.
Printing the symbol size matches the behavior or both gnu nm and freebsd nm.

llvm-svn: 241480
2015-07-06 18:18:44 +00:00
Rafael Espindola
2c1a53aa22 Check that COFF .obj files have sections with zero virtual address spaces.
When talking about the virtual address of sections the coff spec says:
  ... for simplicity, compilers should set this to zero. Otherwise, it is an
  arbitrary value that is subtracted from offsets during relocation.

We don't currently subtract it, so check that it is zero.

If some producer does create such files, we can change getRelocationOffset
instead.

llvm-svn: 241447
2015-07-06 14:26:07 +00:00
Rafael Espindola
b31a748216 Fix handling of ELF::R_MIPS_32 on Mips64.
Thanks to Aboud, Amjad for reporting the regression and providing the testcase.

llvm-svn: 241440
2015-07-06 12:18:44 +00:00