/* ELF attributes support (based on ARM EABI attributes).
- Copyright (C) 2005-2014 Free Software Foundation, Inc.
+ Copyright (C) 2005-2017 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
/* Return the size of a single attribute. */
static bfd_vma
-obj_attr_size (int tag, obj_attribute *attr)
+obj_attr_size (unsigned int tag, obj_attribute *attr)
{
bfd_vma size;
/* Write attribute ATTR to butter P, and return a pointer to the following
byte. */
static bfd_byte *
-write_obj_attribute (bfd_byte *p, int tag, obj_attribute *attr)
+write_obj_attribute (bfd_byte *p, unsigned int tag, obj_attribute *attr)
{
/* Suppress default entries. */
if (is_default_attr (attr))
attr = elf_known_obj_attributes (abfd)[vendor];
for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++)
{
- int tag = i;
+ unsigned int tag = i;
if (get_elf_backend_data (abfd)->obj_attrs_order)
tag = get_elf_backend_data (abfd)->obj_attrs_order (i);
p = write_obj_attribute (p, tag, &attr[tag]);
/* Allocate/find an object attribute. */
static obj_attribute *
-elf_new_obj_attr (bfd *abfd, int vendor, int tag)
+elf_new_obj_attr (bfd *abfd, int vendor, unsigned int tag)
{
obj_attribute *attr;
obj_attribute_list *list;
/* Return the value of an integer object attribute. */
int
-bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, int tag)
+bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, unsigned int tag)
{
obj_attribute_list *p;
/* Add an integer object attribute. */
void
-bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i)
+bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, unsigned int tag, unsigned int i)
{
obj_attribute *attr;
/* Add a string object attribute. */
void
-bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s)
+bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag, const char *s)
{
obj_attribute *attr;
/* Add a int+string object attribute. */
void
-bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, int tag,
+bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor,
+ unsigned int tag,
unsigned int i, const char *s)
{
obj_attribute *attr;
/* Determine whether a GNU object attribute tag takes an integer, a
string or both. */
static int
-gnu_obj_attrs_arg_type (int tag)
+gnu_obj_attrs_arg_type (unsigned int tag)
{
/* Except for Tag_compatibility, for GNU attributes we follow the
same rule ARM ones > 32 follow: odd-numbered tags take strings
/* Determine what arguments an attribute tag takes. */
int
-_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, int tag)
+_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, unsigned int tag)
{
switch (vendor)
{
p = contents;
p_end = p + hdr->sh_size;
std_sec = get_elf_backend_data (abfd)->obj_attrs_vendor;
-
+
if (*(p++) == 'A')
{
len = hdr->sh_size - 1;
p += namelen;
while (section_len > 0 && p < p_end)
{
- int tag;
+ unsigned int tag;
unsigned int n;
unsigned int val;
bfd_vma subsection_len;
bfd_byte *end;
- tag = safe_read_leb128 (abfd, p, &n, FALSE, p_end);
+ tag = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, p_end);
p += n;
if (p < p_end - 4)
subsection_len = bfd_get_32 (abfd, p);
{
int type;
- tag = safe_read_leb128 (abfd, p, &n, FALSE, end);
+ tag = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
p += n;
type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag);
switch (type & (ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL))
{
case ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL:
- val = safe_read_leb128 (abfd, p, &n, FALSE, end);
+ val = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
p += n;
bfd_elf_add_obj_attr_int_string (abfd, vendor, tag,
val, (char *) p);
p += strlen ((char *)p) + 1;
break;
case ATTR_TYPE_FLAG_INT_VAL:
- val = safe_read_leb128 (abfd, p, &n, FALSE, end);
+ val = _bfd_safe_read_leb128 (abfd, p, &n, FALSE, end);
p += n;
bfd_elf_add_obj_attr_int (abfd, vendor, tag, val);
break;
attributes. */
bfd_boolean
-_bfd_elf_merge_object_attributes (bfd *ibfd, bfd *obfd)
+_bfd_elf_merge_object_attributes (bfd *ibfd, struct bfd_link_info *info)
{
+ bfd *obfd = info->output_bfd;
obj_attribute *in_attr;
obj_attribute *out_attr;
int vendor;
if (in_attr->i > 0 && strcmp (in_attr->s, "gnu") != 0)
{
_bfd_error_handler
+ /* xgettext:c-format */
(_("error: %B: Object has vendor-specific contents that "
"must be processed by the '%s' toolchain"),
ibfd, in_attr->s);
if (in_attr->i != out_attr->i
|| (in_attr->i != 0 && strcmp (in_attr->s, out_attr->s) != 0))
{
+ /* xgettext:c-format */
_bfd_error_handler (_("error: %B: Object tag '%d, %s' is "
"incompatible with tag '%d, %s'"),
ibfd,
for (; in_list || out_list; )
{
bfd *err_bfd = NULL;
- int err_tag = 0;
+ unsigned int err_tag = 0;
/* The tags for each list are in numerical order. */
/* If the tags are equal, then merge. */