Tom Stellard
f9f5f12ce7
ELFYAML: Add support for parsing AMDGPU section attribute flags
...
Reviewers: silvas
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14444
llvm-svn: 253052
2015-11-13 17:06:29 +00:00
Tim Northover
dd6752279f
Tests: be slightly more specific to avoid conflict with path.
...
llvm-svn: 251290
2015-10-26 13:40:03 +00:00
Dylan McKay
57cee79f7c
[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
e883514736
Fix printing of 64 bit values and make test more strict.
...
llvm-svn: 249043
2015-10-01 17:57:31 +00:00
Rafael Espindola
8055ed0c12
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
e210ee56f2
Fixup r248096, commit the *correct* test.
...
llvm-svn: 248097
2015-09-19 20:52:47 +00:00
Davide Italiano
a539f63ae1
[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
2f40830dde
[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
b355fd0308
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
71ba9bdd23
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
8cff17469f
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
22b1b7aad2
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
e038948166
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
3db2273861
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
f7eb882176
add missing tests files
...
llvm-svn: 244323
2015-08-07 15:35:49 +00:00
Rafael Espindola
e01f43bcc1
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
8b3b09fdcf
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
b9583d22eb
Update comments.
...
llvm-svn: 244259
2015-08-06 20:05:27 +00:00
Reid Kleckner
47ea9ece1a
[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
e182e74c53
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
b82657d3f1
Support printing relocations in files with no section table.
...
llvm-svn: 242998
2015-07-23 09:11:05 +00:00
Rafael Espindola
6565ea7299
Refactor duplicated code and check for invalid symbol table size.
...
llvm-svn: 242981
2015-07-23 03:24:22 +00:00
Rafael Espindola
41f0f108a5
Force the gnu archive format to fix the test on darwin.
...
llvm-svn: 242949
2015-07-22 22:09:44 +00:00
Rafael Espindola
be9ab2682e
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
69ef2afaeb
Identify thin archives as archives.
...
llvm-svn: 242921
2015-07-22 18:29:39 +00:00
Michael J. Spencer
402a4f1088
[Object][ELF] Handle files with no section header string table.
...
llvm-svn: 242839
2015-07-21 21:40:33 +00:00
Rafael Espindola
b68a16c47c
Simplify iterating over the dynamic section and report broken ones.
...
llvm-svn: 242712
2015-07-20 21:23:29 +00:00
Rafael Espindola
33f250931c
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
836f2e86e5
Report errors an invalid virtual addresses.
...
llvm-svn: 242676
2015-07-20 14:45:03 +00:00
Rafael Espindola
073624bb56
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
00ddb1416d
llvm-readobj: Handle invalid references to the string table.
...
llvm-svn: 242658
2015-07-20 03:38:17 +00:00
Rafael Espindola
c46ffb7a49
Move CHECKs closer to the RUN line.
...
llvm-svn: 242657
2015-07-20 03:31:25 +00:00
Rafael Espindola
fb3acd6216
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
e79b62d923
Trying to fix the windows bots.
...
llvm-svn: 242367
2015-07-16 00:38:34 +00:00
Rafael Espindola
06d6d1905e
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
57c0525d2c
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
449208d95b
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
e649258272
Initial support for writing thin archives.
...
llvm-svn: 242269
2015-07-15 05:47:46 +00:00
Rafael Espindola
142fc2d1c2
Accept lower case to handle windows error messages.
...
llvm-svn: 242236
2015-07-14 22:42:21 +00:00
Rafael Espindola
4b83cb5390
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
e549b8c259
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
4ae784396c
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
c3eec458ab
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
bcb440fb1f
Rename a test. NFC.
...
llvm-svn: 242151
2015-07-14 15:06:18 +00:00
Rafael Espindola
8c1a9102e6
Add missing file.
...
Sorry about that.
llvm-svn: 242083
2015-07-13 23:14:26 +00:00
Rafael Espindola
c60d0d2a15
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
6a8e86f26e
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
3569a84598
[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
20546ffd4a
[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
2535ea0b83
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