forked from Imagelibrary/binutils-gdb
bfd/
* bfd-in.h (bfd_elf_size_dynamic_sections): Add audit and depaudit
arguments.
* elflink.c (bfd_elf_size_dynamic_sections): Generate DT_AUDIT,
DT_DEPAUDIT from audit/depaudit arguments.
(elf_finalize_dynstr): Finalize DT_AUDIT and DT_DEPAUDIT strtab entries.
(elf_link_add_object_symbols): Set dt_audit target data when finding a
DT_AUDIT.
* bfd-in2.h: Regenerate.
* bfd-elf.h: Add dt_audit to elf_obj_tdata, and elf_dt_audit macro.
ld/
* emultempl/elf32.em (gld${EMULATION_NAME}_add_options): Add --audit,
--depaudit, and -P options.
(gld${EULATION_NAME}_handle_options): Ditto.
(gld${EULATION_NAME}_list_options): Ditto.
(gld${EMULATION_NAME}_append_to_separated_string): New function for
handling rpath-like colon separated strings.
(gld${EMULATION_NAME}_before_allocation): Pass the audit and depaudit
libs to bfd. Propagate DT_AUDIT from needed libs to depaudit.
* ld.texinfo: Document new options.
ld/testsuite/
* ld-elf/audit.exp: New.
* ld-elf/audit.rd: New.
* ld-elf/depaudit.rd: New.
* ld-elf/depaudit2.rd: New.
This commit is contained in:
@@ -3234,6 +3234,8 @@ elf_finalize_dynstr (bfd *output_bfd, struct bfd_link_info *info)
|
||||
case DT_RUNPATH:
|
||||
case DT_FILTER:
|
||||
case DT_AUXILIARY:
|
||||
case DT_AUDIT:
|
||||
case DT_DEPAUDIT:
|
||||
dyn.d_un.d_val = _bfd_elf_strtab_offset (dynstr, dyn.d_un.d_val);
|
||||
break;
|
||||
default:
|
||||
@@ -3525,6 +3527,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
asection *s;
|
||||
const char *soname = NULL;
|
||||
char *audit = NULL;
|
||||
struct bfd_link_needed_list *rpath = NULL, *runpath = NULL;
|
||||
int ret;
|
||||
|
||||
@@ -3653,6 +3656,11 @@ error_free_dyn:
|
||||
;
|
||||
*pn = n;
|
||||
}
|
||||
if (dyn.d_tag == DT_AUDIT)
|
||||
{
|
||||
unsigned int tagv = dyn.d_un.d_val;
|
||||
audit = bfd_elf_string_from_elf_section (abfd, shlink, tagv);
|
||||
}
|
||||
}
|
||||
|
||||
free (dynbuf);
|
||||
@@ -3705,6 +3713,9 @@ error_free_dyn:
|
||||
particular dynamic object more than once. */
|
||||
if (ret > 0)
|
||||
return TRUE;
|
||||
|
||||
/* Save the DT_AUDIT entry for the linker emulation code. */
|
||||
elf_dt_audit (abfd) = audit;
|
||||
}
|
||||
|
||||
/* If this is a dynamic object, we always link against the .dynsym
|
||||
@@ -5451,6 +5462,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
const char *soname,
|
||||
const char *rpath,
|
||||
const char *filter_shlib,
|
||||
const char *audit,
|
||||
const char *depaudit,
|
||||
const char * const *auxiliary_filters,
|
||||
struct bfd_link_info *info,
|
||||
asection **sinterpptr,
|
||||
@@ -5603,6 +5616,28 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
}
|
||||
}
|
||||
|
||||
if (audit != NULL)
|
||||
{
|
||||
bfd_size_type indx;
|
||||
|
||||
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, audit,
|
||||
TRUE);
|
||||
if (indx == (bfd_size_type) -1
|
||||
|| !_bfd_elf_add_dynamic_entry (info, DT_AUDIT, indx))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (depaudit != NULL)
|
||||
{
|
||||
bfd_size_type indx;
|
||||
|
||||
indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, depaudit,
|
||||
TRUE);
|
||||
if (indx == (bfd_size_type) -1
|
||||
|| !_bfd_elf_add_dynamic_entry (info, DT_DEPAUDIT, indx))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
eif.info = info;
|
||||
eif.verdefs = verdefs;
|
||||
eif.failed = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user