Tim Northover
2b47a04ccd
Tests: be slightly more specific to avoid conflict with path.
...
llvm-svn: 251290
2015-10-26 13:40:03 +00:00
Dylan McKay
c3afafb9c3
[AVR] Add ELF constants to headers
...
Also adds a 'trivial' ELF file. This was generated by assembling
and linking a file with the symbol main which contains a single
return instruction.
llvm-svn: 251096
2015-10-23 06:05:55 +00:00
Rafael Espindola
154404108e
Fix printing of 64 bit values and make test more strict.
...
llvm-svn: 249043
2015-10-01 17:57:31 +00:00
Rafael Espindola
67bae00308
Avoid SEGFAULT if a requested symbol section is absent.
...
Patch by Igor Kudrin!
llvm-svn: 248194
2015-09-21 19:17:18 +00:00
Davide Italiano
d2d6cb55fa
Fixup r248096, commit the *correct* test.
...
llvm-svn: 248097
2015-09-19 20:52:47 +00:00
Davide Italiano
0f09710333
[obj2yaml] Fix "time of check to time of use" bug. Add a test.
...
llvm-svn: 248096
2015-09-19 20:49:34 +00:00
David Blaikie
65b92c4f37
[opaque pointer type] Add textual IR support for explicit type parameter for global aliases
...
update.py:
import fileinput
import sys
import re
alias_match_prefix = r"(.*(?:=|:|^)\s*(?:external |)(?:(?:private|internal|linkonce|linkonce_odr|weak|weak_odr|common|appending|extern_weak|available_externally) )?(?:default |hidden |protected )?(?:dllimport |dllexport )?(?:unnamed_addr |)(?:thread_local(?:\([a-z]*\))? )?alias"
plain = re.compile(alias_match_prefix + r" (.*?))(| addrspace\(\d+\) *)\*($| *(?:%|@|null|undef|blockaddress|addrspacecast|\[\[[a-zA-Z]|\{\{).*$)")
cast = re.compile(alias_match_prefix + r") ((?:bitcast|inttoptr|addrspacecast)\s*\(.* to (.*?)(| addrspace\(\d+\) *)\*\)\s*(?:;.*)?$)")
gep = re.compile(alias_match_prefix + r") ((?:getelementptr)\s*(?:inbounds)?\s*\((?P<type>.*), (?P=type)(?:\s*addrspace\(\d+\)\s*)?\* .*\)\s*(?:;.*)?$)")
def conv(line):
m = re.match(cast, line)
if m:
return m.group(1) + " " + m.group(3) + ", " + m.group(2)
m = re.match(gep, line)
if m:
return m.group(1) + " " + m.group(3) + ", " + m.group(2)
m = re.match(plain, line)
if m:
return m.group(1) + ", " + m.group(2) + m.group(3) + "*" + m.group(4) + "\n"
return line
for line in sys.stdin:
sys.stdout.write(conv(line))
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
llvm-svn: 247378
2015-09-11 03:22:04 +00:00
Rui Ueyama
5657cab5f3
Object: Fix COFF import file's symbols.
...
If a symbol is marked as "data", the symbol should be exported
with __imp_ prefix. Previously, the symbol was exported as-is.
llvm-svn: 246532
2015-09-01 06:01:53 +00:00
Rui Ueyama
0fad42df2f
Re-apply r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files
...
This patch includes a fix for a llvm-readobj test. With this patch,
the tool does no longer print out COFF headers for the short import
file, but that's probably desirable because the header for the short
import file is dummy.
llvm-svn: 246283
2015-08-28 07:40:30 +00:00
Rui Ueyama
0c65dc4e7d
Rollback r246276 - Object: Teach llvm-ar to create symbol table for COFF short import files
...
This change caused a test for llvm-readobj to fail.
llvm-svn: 246277
2015-08-28 06:03:01 +00:00
Rui Ueyama
078253747a
Object: Teach llvm-ar to create symbol table for COFF short import files.
...
COFF short import files are special kind of files that contains only
DLL-exported symbol names. That's different from object files because
it has no data except symbol names.
This change implements a SymbolicFile interface for the short import
files so that symbol names can be accessed through that interface.
llvm-ar is now able to read the file and create symbol table entries
for short import files.
llvm-svn: 246276
2015-08-28 05:47:46 +00:00
Rafael Espindola
a72d6ae775
Report an error if a SHT_SYMTAB_SHNDX section has the wrong size.
...
llvm-svn: 245873
2015-08-24 21:09:41 +00:00
Rafael Espindola
9c7a419c99
Add a test showing that objdump (and so ObjectFIle) can handle shndx.
...
It was already passing, we were just not testing the code.
llvm-svn: 244504
2015-08-10 21:00:15 +00:00
Rafael Espindola
e75ec1768a
add missing tests files
...
llvm-svn: 244323
2015-08-07 15:35:49 +00:00
Rafael Espindola
0d29f912e2
Add dynamic_table iterators back to ELF.h.
...
In tree they are only used by llvm-readobj, but it is also used by
https://github.com/mono/CppSharp .
While at it, add some missing error checking.
llvm-svn: 244320
2015-08-07 15:25:20 +00:00
Rafael Espindola
833df2a833
Move to llvm-readobj code that is only used there.
...
lld might end up using a small part of this, but it will be in a much
refactored form. For now this unblocks avoiding the full section scan in the
ELFFile constructor.
This also has a (very small) error handling improvement.
llvm-svn: 244282
2015-08-06 21:54:37 +00:00
Rui Ueyama
ed91b976b4
Update comments.
...
llvm-svn: 244259
2015-08-06 20:05:27 +00:00
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