2007-07-09 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@gnu.org>
Mon, 9 Jul 2007 21:23:39 +0000 (21:23 +0000)
committerRoland McGrath <roland@gnu.org>
Mon, 9 Jul 2007 21:23:39 +0000 (21:23 +0000)
* elf-bfd.h (struct elf_obj_tdata): Add members
emit_note_gnu_build_id and note_gnu_build_id_sec.
* elf.c (_bfd_id_note_section_size): New global function.
(read_hex, _bfd_elf_write_build_id_section): New static functions.
(_bfd_elf_write_object_contents): Call _bfd_elf_write_build_id_section
if emit_note_gnu_build_id is set.
* Makefile.am (elf.lo): Update dependencies.
* elf-bfd.h (struct elf_size_info): Add checksum_contents hook.
(bfd_elf32_checksum_contents, bfd_elf64_checksum_contents): Declare.
* elfcode.h (elf_checksum_contents): New macro and function.
(NAME(_bfd_elf,size_info)): Initialize checksum_contents hook.

bfd/elf-bfd.h

index f7fba9d..7e3592e 100644 (file)
@@ -448,6 +448,8 @@ struct elf_size_info {
     (bfd *, const Elf_Internal_Phdr *, unsigned int);
   bfd_boolean
     (*write_shdrs_and_ehdr) (bfd *);
+  bfd_boolean (*checksum_contents)
+    (bfd * , void (*) (const void *, size_t, void *), void *);
   void (*write_relocs)
     (bfd *, asection *, void *);
   bfd_boolean (*swap_symbol_in)
@@ -1466,6 +1468,10 @@ struct elf_obj_tdata
 
   obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
   obj_attribute_list *other_obj_attributes[2];
+
+  /* The .note.gnu.build-id section and --build-id option setting, or NULL.  */
+  char *emit_note_gnu_build_id;
+  asection *note_gnu_build_id_sec;
 };
 
 #define elf_tdata(bfd)         ((bfd) -> tdata.elf_obj_data)
@@ -1869,6 +1875,8 @@ extern bfd_boolean bfd_elf32_write_shdrs_and_ehdr
   (bfd *);
 extern int bfd_elf32_write_out_phdrs
   (bfd *, const Elf_Internal_Phdr *, unsigned int);
+extern bfd_boolean bfd_elf32_checksum_contents
+  (bfd * , void (*) (const void *, size_t, void *), void *);
 extern void bfd_elf32_write_relocs
   (bfd *, asection *, void *);
 extern bfd_boolean bfd_elf32_slurp_reloc_table
@@ -1911,6 +1919,8 @@ extern bfd_boolean bfd_elf64_write_shdrs_and_ehdr
   (bfd *);
 extern int bfd_elf64_write_out_phdrs
   (bfd *, const Elf_Internal_Phdr *, unsigned int);
+extern bfd_boolean bfd_elf64_checksum_contents
+  (bfd * , void (*) (const void *, size_t, void *), void *);
 extern void bfd_elf64_write_relocs
   (bfd *, asection *, void *);
 extern bfd_boolean bfd_elf64_slurp_reloc_table
@@ -2036,6 +2046,9 @@ extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int);
 extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *);
 extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *);
 
+extern bfd_size_type _bfd_id_note_section_size
+  (bfd *abfd, struct bfd_link_info *link_info);
+
 /* Large common section.  */
 extern asection _bfd_elf_large_com_section;