[PATCH] D58677: [llvm-readobj]Add additional testing for various ELF features
Xing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 27 04:42:02 PST 2019
Higuoxing added inline comments.
================
Comment at: test/tools/llvm-readobj/elf-dynamic-tags.test:275
+ - Tag: 0x7ffffffe
+ Value: 0x8888777766665555
+ - Tag: DT_NULL
----------------
grimar wrote:
> jhenderson wrote:
> > grimar wrote:
> > > Could you explain the logic of numeric tags for me?
> > >
> > > I see you're testing LOPROC and (HIPROC-1) it seems:
> > >
> > > > DYNAMIC_TAG_MARKER(LOOS, 0x60000000) // Start of environment specific tags.
> > > > DYNAMIC_TAG_MARKER(HIOS, 0x6FFFFFFF) // End of environment specific tags.
> > > > DYNAMIC_TAG_MARKER(LOPROC, 0x70000000) // Start of processor specific tags.
> > > > DYNAMIC_TAG_MARKER(HIPROC, 0x7FFFFFFF) // End of processor specific tags.
> > >
> > > But what is 0x6000000D and 0x6ffff000 then?
> > 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.
> Not sure about 0x7ffffffe, because it is surrounded by DT_AUXILIARY(0x7FFFFFFD) and DT_FILTER(0x7FFFFFFF),
> I guess someone might want to use it one day.
>
> Seems to test that we can work with unknown tags you can just test a single value and perhaps any
> obviously unused/weird value like 0x6ABCDEF0 would work here?
0x7ffffffe is DT_USED
I find some code example, but cannot find docs on it.
```
#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
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58677/new/
https://reviews.llvm.org/D58677
More information about the llvm-commits
mailing list