This patch adds testing of areas of the code that are not fully tested, in particular dynamic table printing, ELF type printing, handling of edge cases where things are missing/empty (relocations/program header tables/section header table), and the --string-dump switch.
Details
- Reviewers
grimar rupprecht Higuoxing alexander-shaposhnikov - Commits
- rG6eef7d05249f: [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin
rL355018: [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin
rCRT355018: [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin
rG416603e32a9c: [llvm-readobj]Add additional testing for various ELF features
rL355003: [llvm-readobj]Add additional testing for various ELF features
Diff Detail
- Repository
- rL LLVM
Event Timeline
| test/tools/llvm-readobj/elf-malformed-PT_DYNAMIC.test | ||
|---|---|---|
| 16–17 ↗ | (On Diff #188378) | Here should be # RUN: %python -c "with open(r'%t.truncated1', 'r+') as f: f.truncate(0x1001)"
^
# RUN: not llvm-readobj %t.truncated1 --dynamic-table 2>&1 | FileCheck %s
^right? |
| 22 ↗ | (On Diff #188378) | Here should be # RUN: %python -c "with open(r'%t.truncated2', 'r+') as f: f.truncate(0x1001)"
^
# RUN: not llvm-readobj %t.truncated2 --dynamic-table 2>&1 | FileCheck %s
^ |
I always like having more tests :D
| test/tools/llvm-readobj/elf-dynamic-no-PT_DYNAMIC.test | ||
|---|---|---|
| 1 ↗ | (On Diff #188378) | nit: it seems like uppercase filenames are rarely used, "elf-dynamic-no-pt-dynamic.test" might be better |
| test/tools/llvm-readobj/elf-dynamic-malformed.test | ||
|---|---|---|
| 92 ↗ | (On Diff #188378) | Do I correctly understand that issue here is that DT_NEEDED has a value 0x1, which If so, it is not really obvious perhaps, I would suggest extending the comment for this sub-test. |
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
| 275 ↗ | (On Diff #188378) | Could you explain the logic of numeric tags for me? I see you're testing LOPROC and (HIPROC-1) it seems:
But what is 0x6000000D and 0x6ffff000 then? |
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
|---|---|---|
| 150 ↗ | (On Diff #188378) | I think here should be linked with .dynstr - Name: .dynamic Link: 1 Or, objdump cannot dump this. But, never mind here :) |
| test/tools/llvm-readobj/elf-dynamic-malformed.test | ||
|---|---|---|
| 92 ↗ | (On Diff #188378) | Yes, that's correct. I'll improve it. |
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
| 213 ↗ | (On Diff #188378) | I'll go the whole hog and do 0xffffffffffffffff, to enumerate all flags current and future. |
| 251 ↗ | (On Diff #188378) | Ditto. |
| 275 ↗ | (On Diff #188378) | I can't remember my own logic now! I'm interested in other reserved values effectively, that don't have a known meaning in LLVM, but looking at the known values, I don't see any reason to not use 0x60000000. Note that 0x6FFFFFFF is DT_VERNEEDNUM, so I can't use that. The highest I can use is 0x6FFFFFF8, I believe. I could also test a mid-range value too, if that's desirable? By the way, I'm using 0x7ffffffe, because 0x7fffffff is DT_FILTER. |
| test/tools/llvm-readobj/elf-malformed-PT_DYNAMIC.test | ||
| 16–17 ↗ | (On Diff #188378) | Oops, thanks. I'll fix that. I renamed the file, so there must be one still in my test output directory of the old name. |
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
|---|---|---|
| 275 ↗ | (On Diff #188378) | Not sure about 0x7ffffffe, because it is surrounded by DT_AUXILIARY(0x7FFFFFFD) and DT_FILTER(0x7FFFFFFF), Seems to test that we can work with unknown tags you can just test a single value and perhaps any |
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
|---|---|---|
| 275 ↗ | (On Diff #188378) | 0x7ffffffe is DT_USED #define DT_USED 0x7ffffffe /* ignored - same as needed */ https://github.com/switchbrew/switch-tools/blob/master/src/elf_common.h and case DT_USED:
case DT_INIT_ARRAY:
case DT_FINI_ARRAY:
if (do_dynamic)
{
if (entry->d_tag == DT_USED
&& VALID_DYNAMIC_NAME (entry->d_un.d_val))
{
char *name = GET_DYNAMIC_NAME (entry->d_un.d_val);
if (*name)
{
printf (_("Not needed object: [%s]\n"), name);
break;
}
}
print_vma (entry->d_un.d_val, PREFIX_HEX);
putchar ('\n');
}
break;http://web.mit.edu/freebsd/head/contrib/binutils/binutils/readelf.c |
Address review comments:
- Rename tests to lower case.
- Fix test file names.
- Change tags in reserved range to be more sensible.
- Use all values in DT_FLAGS and DT_FLAGS_1 tags.
- Add a couple of comments for clarity.
| test/tools/llvm-readobj/elf-dynamic-tags.test | ||
|---|---|---|
| 150 ↗ | (On Diff #188378) | I'm trying to keep these tests as minimal as possible, because there's already a lot of stuff in it. llvm-readobj does not require the link field, because it uses the dynamic tags. |