1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/tools/obj2yaml
Xing GUO 91f02ebcd5 [BinaryFormat] Add DT_USED tag into dynamic section.
Summary:
This tag is documented in https://docs.oracle.com/cd/E19253-01/817-1984/chapter6-42444/index.html 
Though I could not find some docs that describe it in detail, I found some code snippets.

1.
```
	/*
	 * Look up the string in the string table and get its offset. If
	 * this succeeds, then it is possible that there is a DT_NEEDED
	 * dynamic entry that references it.
	 */
	have_string = elfedit_sec_findstr(argstate->str.sec,
	    strpad_elt.dn_dyn.d_un.d_val, arg, &str_offset) != 0;
	if (have_string) {
		dyn = argstate->dynamic.data;
		for (ndx = 0; ndx < numdyn; dyn++, ndx++) {
			if (((dyn->d_tag == DT_NEEDED) ||
			    (dyn->d_tag == DT_USED)) &&
			    (dyn->d_un.d_val == str_offset))
				goto done;
		}
	}
```
80192cd83b/usr/src/cmd/sgs/elfedit/modules/common/syminfo.c (L512)

2.
```
    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

3.
```
#define DT_USED     0x7ffffffe  /* ignored - same as needed */
```
https://github.com/switchbrew/switch-tools/blob/master/src/elf_common.h

Reviewers: jhenderson, grimar

Reviewed By: jhenderson, grimar

Subscribers: emaste, krytarowski, fedor.sergeev, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58762

llvm-svn: 355468
2019-03-06 01:28:40 +00:00
..
Inputs [obj2yaml] - Do not miss section index for special symbols. 2019-02-22 08:45:21 +00:00
dynamic-section-arch-tags.test [yaml2obj][obj2yaml] - Add support for the architecture specific dynamic tags. 2019-02-26 14:14:49 +00:00
dynamic-section.test [BinaryFormat] Add DT_USED tag into dynamic section. 2019-03-06 01:28:40 +00:00
elf-entsize.yaml
elf-shinfo.yaml [yaml2obj] - Allow setting custom sh_info for RawContentSection sections. 2019-03-01 10:18:16 +00:00
invalid_input_file.test
lit.local.cfg [obj2yaml][yaml2obj]Locate all .yaml and .test tests 2019-02-20 15:13:44 +00:00
missing_symtab.test
section-type.yaml [yaml2obj][obj2yaml] Remove section type range markers from allowed mappings and support hex values 2019-02-19 16:22:21 +00:00
special-symbol-indices.yaml [obj2yaml] - Do not miss section index for special symbols. 2019-02-22 08:45:21 +00:00
symbol-type.yaml
verdef-section.yaml [yaml2obj][obj2yaml] - Support SHT_GNU_verdef (.gnu.version_d) section. 2019-02-21 12:21:43 +00:00
verneed-section.yaml Recommit r354328, r354329 "[obj2yaml][yaml2obj] - Add support of parsing/dumping of the .gnu.version_r section." 2019-02-19 14:53:48 +00:00
versym-section.yaml [yaml2obj][obj2yaml] - Support SHT_GNU_versym (.gnu.version) section. 2019-02-19 15:29:07 +00:00