* bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id.
bfd/
* configure.in: Bump version to 2.23.52.
* elf-bfd.h (struct elf_build_id_info): New.
(struct elf_obj_tdata): Delete after_write_object_contents,
after_write_object_contents_info and build_id_size. Make build_id
a pointer to struct elf_build_id_info.
* elf.c (_bfd_elf_write_object_contents): Style. Update
after_write_ibject_contents invocation.
(elfobj_grok_gnu_build_id): Update for new build_id struct. Don't
allow zero size notes.
* configure: Regenerate.
gdb/
* elfread.c (struct build_id): Delete. Use struct elf_build_id
throughout file instead.
(build_id_bfd_get): Update to use new elf_tdata build_id field.
Don't xmalloc return value.
(build_id_verify): Similarly. Don't xfree.
(build_id_to_debug_filename): Update.
(find_separate_debug_file_by_buildid): Update, don't xfree.
ld/
* emultempl/elf32.em (emit_note_gnu_build_id): New static var.
Replace all info->emit_note_gnu_build_id refs.
(id_note_section_size): Rename from
gld${EMULATION_NAME}_id_note_section_size.
(struct build_id_info): Delete.
(write_build_id): Rename from
gld${EMULATION_NAME}_write_build_id_section.
Update elf_tdata usage. Style, formatting.
(setup_build_id): New function.
(gld${EMULATION_NAME}_after_open): Use setup_build_id.
+2013-02-19 Alan Modra <amodra@gmail.com>
+
+ * configure.in: Bump version to 2.23.52.
+ * elf-bfd.h (struct elf_build_id_info): New.
+ (struct elf_obj_tdata): Delete after_write_object_contents,
+ after_write_object_contents_info and build_id_size. Make build_id
+ a pointer to struct elf_build_id_info.
+ * elf.c (_bfd_elf_write_object_contents): Style. Update
+ after_write_ibject_contents invocation.
+ (elfobj_grok_gnu_build_id): Update for new build_id struct. Don't
+ allow zero size notes.
+ * configure: Regenerate.
+
2013-02-18 Maciej W. Rozycki <macro@codesourcery.com>
* elf64-mips.c (micromips_elf64_howto_table_rel): Add
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for bfd 2.23.51.
+# Generated by GNU Autoconf 2.64 for bfd 2.23.52.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
# Identity of this package.
PACKAGE_NAME='bfd'
PACKAGE_TARNAME='bfd'
-PACKAGE_VERSION='2.23.51'
-PACKAGE_STRING='bfd 2.23.51'
+PACKAGE_VERSION='2.23.52'
+PACKAGE_STRING='bfd 2.23.52'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures bfd 2.23.51 to adapt to many kinds of systems.
+\`configure' configures bfd 2.23.52 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of bfd 2.23.51:";;
+ short | recursive ) echo "Configuration of bfd 2.23.52:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-bfd configure 2.23.51
+bfd configure 2.23.52
generated by GNU Autoconf 2.64
Copyright (C) 2009 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by bfd $as_me 2.23.51, which was
+It was created by bfd $as_me 2.23.52, which was
generated by GNU Autoconf 2.64. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='bfd'
- VERSION='2.23.51'
+ VERSION='2.23.52'
cat >>confdefs.h <<_ACEOF
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by bfd $as_me 2.23.51, which was
+This file was extended by bfd $as_me 2.23.52, which was
generated by GNU Autoconf 2.64. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-bfd config.status 2.23.51
+bfd config.status 2.23.52
configured by $0, generated by GNU Autoconf 2.64,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
dnl
AC_PREREQ(2.59)
-AC_INIT([bfd], [2.23.51])
+AC_INIT([bfd], [2.23.52])
AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_TARGET
bfd_byte data[1];
};
+/* NT_GNU_BUILD_ID note type info. */
+struct elf_build_id_info
+{
+ union
+ {
+ /* Used on output bfd by linker. */
+ struct elf_build_id_out
+ {
+ size_t zero; /* Always zero */
+ bfd_boolean (*after_write_object_contents) (bfd *);
+ const char *style;
+ asection *sec;
+ } o;
+ /* Used for input bfd. */
+ struct elf_build_id
+ {
+ size_t size; /* Always non-zero */
+ bfd_byte data[1];
+ } i;
+ } u;
+};
+
/* Some private data is stashed away for future use using the tdata pointer
in the bfd structure. */
obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
obj_attribute_list *other_obj_attributes[2];
- /* Called at the end of _bfd_elf_write_object_contents if not NULL. */
- bfd_boolean (*after_write_object_contents) (bfd *);
- void *after_write_object_contents_info;
-
/* NT_GNU_BUILD_ID note type. */
- bfd_size_type build_id_size;
- bfd_byte *build_id;
+ struct elf_build_id_info *build_id;
/* Linked-list containing information about every Systemtap section
found in the object file. Each section corresponds to one entry
Elf_Internal_Shdr **i_shdrp;
bfd_boolean failed;
unsigned int count, num_sec;
+ struct elf_obj_tdata *t;
if (! abfd->output_has_begun
&& ! _bfd_elf_compute_section_file_positions (abfd, NULL))
}
/* Write out the section header names. */
+ t = elf_tdata (abfd);
if (elf_shstrtab (abfd) != NULL
- && (bfd_seek (abfd, elf_tdata (abfd)->shstrtab_hdr.sh_offset, SEEK_SET) != 0
+ && (bfd_seek (abfd, t->shstrtab_hdr.sh_offset, SEEK_SET) != 0
|| !_bfd_elf_strtab_emit (abfd, elf_shstrtab (abfd))))
return FALSE;
if (bed->elf_backend_final_write_processing)
- (*bed->elf_backend_final_write_processing) (abfd,
- elf_tdata (abfd)->linker);
+ (*bed->elf_backend_final_write_processing) (abfd, t->linker);
if (!bed->s->write_shdrs_and_ehdr (abfd))
return FALSE;
/* This is last since write_shdrs_and_ehdr can touch i_shdrp[0]. */
- if (elf_tdata (abfd)->after_write_object_contents)
- return (*elf_tdata (abfd)->after_write_object_contents) (abfd);
+ if (t->build_id != NULL
+ && t->build_id->u.o.zero == 0)
+ return (*t->build_id->u.o.after_write_object_contents) (abfd);
return TRUE;
}
static bfd_boolean
elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note)
{
- elf_tdata (abfd)->build_id_size = note->descsz;
- elf_tdata (abfd)->build_id = (bfd_byte *) bfd_alloc (abfd, note->descsz);
- if (elf_tdata (abfd)->build_id == NULL)
+ struct elf_obj_tdata *t;
+
+ if (note->descsz == 0)
+ return FALSE;
+
+ t = elf_tdata (abfd);
+ t->build_id = bfd_alloc (abfd, sizeof (t->build_id->u.i) - 1 + note->descsz);
+ if (t->build_id == NULL)
return FALSE;
- memcpy (elf_tdata (abfd)->build_id, note->descdata, note->descsz);
+ t->build_id->u.i.size = note->descsz;
+ memcpy (t->build_id->u.i.data, note->descdata, note->descsz);
return TRUE;
}
+2013-02-19 Alan Modra <amodra@gmail.com>
+
+ * elfread.c (struct build_id): Delete. Use struct elf_build_id
+ throughout file instead.
+ (build_id_bfd_get): Update to use new elf_tdata build_id field.
+ Don't xmalloc return value.
+ (build_id_verify): Similarly. Don't xfree.
+ (build_id_to_debug_filename): Update.
+ (find_separate_debug_file_by_buildid): Update, don't xfree.
+
2013-02-18 Tom Tromey <tromey@redhat.com>
PR gdb/15102:
2013-01-24 Tiago Stürmer Daitx <tdaitx@linux.vnet.ibm.com>
- * MAINTAINERS (Write After Approval): Add myself to the list.
+ * MAINTAINERS (Write After Approval): Add myself to the list.
2013-01-24 Tom Tromey <tromey@redhat.com>
update_breakpoint_locations (b, sals, sals_end);
}
-struct build_id
- {
- size_t size;
- gdb_byte data[1];
- };
-
/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */
-static struct build_id *
+static struct elf_build_id *
build_id_bfd_get (bfd *abfd)
{
- struct build_id *retval;
-
if (!bfd_check_format (abfd, bfd_object)
|| bfd_get_flavour (abfd) != bfd_target_elf_flavour
- || elf_tdata (abfd)->build_id == NULL)
+ || elf_tdata (abfd)->build_id == NULL
+ || elf_tdata (abfd)->build_id->u.i.size == 0)
return NULL;
- retval = xmalloc (sizeof *retval - 1 + elf_tdata (abfd)->build_id_size);
- retval->size = elf_tdata (abfd)->build_id_size;
- memcpy (retval->data, elf_tdata (abfd)->build_id, retval->size);
-
- return retval;
+ return &elf_tdata (abfd)->build_id->u.i;
}
/* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */
static int
-build_id_verify (const char *filename, struct build_id *check)
+build_id_verify (const char *filename, struct elf_build_id *check)
{
bfd *abfd;
- struct build_id *found = NULL;
+ struct elf_build_id *found;
int retval = 0;
/* We expect to be silent on the non-existing files. */
gdb_bfd_unref (abfd);
- xfree (found);
-
return retval;
}
static char *
-build_id_to_debug_filename (struct build_id *build_id)
+build_id_to_debug_filename (struct elf_build_id *build_id)
{
char *link, *debugdir, *retval = NULL;
VEC (char_ptr) *debugdir_vec;
static char *
find_separate_debug_file_by_buildid (struct objfile *objfile)
{
- struct build_id *build_id;
+ struct elf_build_id *build_id;
build_id = build_id_bfd_get (objfile->obfd);
if (build_id != NULL)
char *build_id_name;
build_id_name = build_id_to_debug_filename (build_id);
- xfree (build_id);
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL
&& filename_cmp (build_id_name, objfile->name) == 0)
+2013-02-19 Alan Modra <amodra@gmail.com>
+
+ * bfdlink.h (struct bfd_link_info): Delete emit_note_gnu_build_id.
+
2013-02-11 Sriraman Tallam <tmsriram@google.com>
* plugin-api.h (enum ld_plugin_level): Assign integers
- explicitly for all values.
+ explicitly for all values.
2013-02-06 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com>
2012-08-02 Sean Keys <skeys@ipdatasys.com>
- * elf/m68hc11.h: #define E_M68HC11_NO_BANK_WARNING
- 0x000000200
+ * elf/m68hc11.h: #define E_M68HC11_NO_BANK_WARNING 0x000000200
2012-07-24 Stephan McCamant <smcc@cs.berkeley.edu>
Dr David Alan Gilbert <dave@treblig.org>
2012-07-05 Sean Keys <skeys@ipdatasys.com>
- * opcode/xgate.h: Changed the format string for mode
- XGATE_OP_DYA_MON.
+ * opcode/xgate.h: Changed the format string for mode
+ XGATE_OP_DYA_MON.
2012-06-18 Doug Evans <dje@google.com>
bfd *input_bfds;
bfd **input_bfds_tail;
- /* Non-NULL if .note.gnu.build-id section should be created. */
- char *emit_note_gnu_build_id;
-
/* If a symbol should be created for each input BFD, this is section
where those symbols should be placed. It must be a section in
the output BFD. It may be NULL, in which case no such symbols
+2013-02-19 Alan Modra <amodra@gmail.com>
+
+ * emultempl/elf32.em (emit_note_gnu_build_id): New static var.
+ Replace all info->emit_note_gnu_build_id refs.
+ (id_note_section_size): Rename from
+ gld${EMULATION_NAME}_id_note_section_size.
+ (struct build_id_info): Delete.
+ (write_build_id): Rename from
+ gld${EMULATION_NAME}_write_build_id_section.
+ Update elf_tdata usage. Style, formatting.
+ (setup_build_id): New function.
+ (gld${EMULATION_NAME}_after_open): Use setup_build_id.
+
2013-02-16 H.J. Lu <hongjiu.lu@intel.com>
PR ld/15146
static char *audit; /* colon (typically) separated list of libs */
static char *depaudit; /* colon (typically) separated list of libs */
+/* Style of .note.gnu.build-id section. */
+static const char *emit_note_gnu_build_id;
+
/* On Linux, it's possible to have different versions of the same
shared library linked against different versions of libc. The
dynamic linker somehow tags which libc version to use in
fragment <<EOF
static bfd_size_type
-gld${EMULATION_NAME}_id_note_section_size (bfd *abfd,
- struct bfd_link_info *linfo)
+id_note_section_size (bfd *abfd)
{
- const char *style = linfo->emit_note_gnu_build_id;
+ const char *style = emit_note_gnu_build_id;
bfd_size_type size;
abfd = abfd;
return 0;
}
-struct build_id_info
-{
- const char *style;
- asection *sec;
-};
-
static bfd_boolean
-gld${EMULATION_NAME}_write_build_id_section (bfd *abfd)
+write_build_id (bfd *abfd)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- struct build_id_info *info = (struct build_id_info *)
- elf_tdata (abfd)->after_write_object_contents_info;
+ struct elf_obj_tdata *t = elf_tdata (abfd);
+ const char *style;
asection *asec;
Elf_Internal_Shdr *i_shdr;
unsigned char *contents, *id_bits;
bfd_size_type size;
+ file_ptr position;
Elf_External_Note *e_note;
+ typedef void (*sum_fn) (const void *, size_t, void *);
- asec = info->sec;
+ style = t->build_id->u.o.style;
+ asec = t->build_id->u.o.sec;
if (bfd_is_abs_section (asec->output_section))
{
einfo (_("%P: warning: .note.gnu.build-id section discarded,"
bfd_h_put_32 (abfd, NT_GNU_BUILD_ID, &e_note->type);
memcpy (e_note->name, "GNU", sizeof "GNU");
- if (!strcmp (info->style, "md5"))
+ if (strcmp (style, "md5") == 0)
{
struct md5_ctx ctx;
+
md5_init_ctx (&ctx);
- if (bed->s->checksum_contents (abfd,
- (void (*) (const void *, size_t, void *))
- &md5_process_bytes,
- &ctx))
- md5_finish_ctx (&ctx, id_bits);
- else
+ if (!bed->s->checksum_contents (abfd, (sum_fn) &md5_process_bytes, &ctx))
return FALSE;
+ md5_finish_ctx (&ctx, id_bits);
}
- else if (!strcmp (info->style, "sha1"))
+ else if (strcmp (style, "sha1") == 0)
{
struct sha1_ctx ctx;
+
sha1_init_ctx (&ctx);
- if (bed->s->checksum_contents (abfd,
- (void (*) (const void *, size_t, void *))
- &sha1_process_bytes,
- &ctx))
- sha1_finish_ctx (&ctx, id_bits);
- else
+ if (!bed->s->checksum_contents (abfd, (sum_fn) &sha1_process_bytes, &ctx))
return FALSE;
+ sha1_finish_ctx (&ctx, id_bits);
}
- else if (!strcmp (info->style, "uuid"))
+ else if (strcmp (style, "uuid") == 0)
{
int n;
int fd = open ("/dev/urandom", O_RDONLY);
if (n < (int) size)
return FALSE;
}
- else if (!strncmp (info->style, "0x", 2))
+ else if (strncmp (style, "0x", 2) == 0)
{
/* ID is in string form (hex). Convert to bits. */
- const char *id = info->style + 2;
+ const char *id = style + 2;
size_t n = 0;
do
{
else
abort (); /* Should have been validated earlier. */
+ position = i_shdr->sh_offset + asec->output_offset;
size = asec->size;
- return (bfd_seek (abfd,
- i_shdr->sh_offset + asec->output_offset, SEEK_SET) == 0
+ return (bfd_seek (abfd, position, SEEK_SET) == 0
&& bfd_bwrite (contents, size, abfd) == size);
}
+/* Make .note.gnu.build-id section, and set up elf_tdata->build_id. */
+
+static bfd_boolean
+setup_build_id (bfd *ibfd)
+{
+ asection *s;
+ bfd_size_type size;
+ flagword flags;
+
+ size = id_note_section_size (ibfd);
+ if (size == 0)
+ {
+ einfo ("%P: warning: unrecognized --build-id style ignored.\n");
+ return FALSE;
+ }
+
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA);
+ s = bfd_make_section_with_flags (ibfd, ".note.gnu.build-id", flags);
+ if (s != NULL && bfd_set_section_alignment (ibfd, s, 2))
+ {
+ struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
+ t->build_id = bfd_alloc (link_info.output_bfd, sizeof (t->build_id->u.o));
+ if (t->build_id != NULL)
+ {
+ t->build_id->u.o.zero = 0;
+ t->build_id->u.o.after_write_object_contents = &write_build_id;
+ t->build_id->u.o.style = emit_note_gnu_build_id;
+ t->build_id->u.o.sec = s;
+ elf_section_type (s) = SHT_NOTE;
+ s->size = size;
+ return TRUE;
+ }
+ }
+
+ einfo ("%P: warning: Cannot create .note.gnu.build-id section,"
+ " --build-id ignored.\n");
+ return FALSE;
+}
/* This is called after all the input files have been opened. */
if (!is_elf_hash_table (htab))
return;
- if (link_info.emit_note_gnu_build_id)
+ if (emit_note_gnu_build_id != NULL)
{
bfd *abfd;
- asection *s;
- bfd_size_type size;
/* Find an ELF input. */
for (abfd = link_info.input_bfds;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
break;
- if (abfd == NULL)
- {
- /* PR 10555: If there are no input files do not
- try to create a .note.gnu-build-id section. */
- free (link_info.emit_note_gnu_build_id);
- link_info.emit_note_gnu_build_id = NULL;
- }
- else
+ /* PR 10555: If there are no ELF input files do not try to
+ create a .note.gnu-build-id section. */
+ if (abfd == NULL
+ || !setup_build_id (abfd))
{
- size = gld${EMULATION_NAME}_id_note_section_size (abfd, &link_info);
- if (size == 0)
- {
- einfo ("%P: warning: unrecognized --build-id style ignored.\n");
- free (link_info.emit_note_gnu_build_id);
- link_info.emit_note_gnu_build_id = NULL;
- }
- else
- {
- s = bfd_make_section_with_flags (abfd, ".note.gnu.build-id",
- SEC_ALLOC | SEC_LOAD
- | SEC_IN_MEMORY | SEC_LINKER_CREATED
- | SEC_READONLY | SEC_DATA);
- if (s != NULL && bfd_set_section_alignment (abfd, s, 2))
- {
- struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
- struct build_id_info *b =
- (struct build_id_info *) xmalloc (sizeof *b);
-
- b->style = link_info.emit_note_gnu_build_id;
- b->sec = s;
- elf_section_type (s) = SHT_NOTE;
- s->size = size;
- t->after_write_object_contents
- = &gld${EMULATION_NAME}_write_build_id_section;
- t->after_write_object_contents_info = b;
- }
- else
- {
- einfo ("%P: warning: Cannot create .note.gnu.build-id section,"
- " --build-id ignored.\n");
- free (link_info.emit_note_gnu_build_id);
- link_info.emit_note_gnu_build_id = NULL;
- }
- }
+ free ((char *) emit_note_gnu_build_id);
+ emit_note_gnu_build_id = NULL;
}
}
return FALSE;
case OPTION_BUILD_ID:
- if (link_info.emit_note_gnu_build_id != NULL)
+ if (emit_note_gnu_build_id != NULL)
{
- free (link_info.emit_note_gnu_build_id);
- link_info.emit_note_gnu_build_id = NULL;
+ free ((char *) emit_note_gnu_build_id);
+ emit_note_gnu_build_id = NULL;
}
if (optarg == NULL)
optarg = DEFAULT_BUILD_ID_STYLE;
if (strcmp (optarg, "none"))
- link_info.emit_note_gnu_build_id = xstrdup (optarg);
+ emit_note_gnu_build_id = xstrdup (optarg);
break;
EOF