+2017-11-05 Alan Modra <amodra@gmail.com>
+
+ PR 22397
+ * bfd.c (_bfd_doprnt_scan): Check args index before storing, not
+ after.
+
+2017-11-05 Alan Modra <amodra@gmail.com>
+
+ PR 22397
+ * bfd.c (union _bfd_doprnt_args): New.
+ (PRINT_TYPE): Add FIELD arg. Take value from args.
+ (_bfd_doprnt): Replace ap parameter with args. Adjust all
+ PRINT_TYPE invocations and reading of format args to suit.
+ Move "%%" handling out of switch handling args. Support
+ positional parameters.
+ (_bfd_doprnt_scan): New function.
+ (error_handler_internal): Call _bfd_doprnt_scan and read args.
+
+2017-11-05 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-11 Pedro Alves <palves@redhat.com>
+ * bfd.c (_doprnt): Rename to ...
+ (_bfd_doprnt): ... this.
+ (error_handler_internal): Adjust.
+
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-30 Alan Modra <amodra@gmail.com>
+ * elf32-frv.c (ELF_TARGET_ID): Don't define for generic
+ elf target.
+
+ 2017-10-30 Alan Modra <amodra@gmail.com>
+ * elflink.c (elf_gc_sweep): Test elf_object_id in addition to
+ relocs_compatible.
+ (bfd_elf_gc_sections): Likewise.
+
+ 2017-10-28 Alan Modra <amodra@gmail.com>
+ PR 22300
+ * elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
+ * elf32-hppa.c (elf_backend_relocs_compatible): Define.
+ * elf32-ppc.c (elf_backend_relocs_compatible): Define.
+ * elf64-ppc.c (elf_backend_relocs_compatible): Define.
+
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ * archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
+ optionally prefixed with "_".
+ * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
+
+2017-10-05 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (elf_link_input_bfd): Correct ctor/dtor in init_array/
+ fini_array error value.
+
+2017-10-04 Pavel I. Kryukov <kryukov@frtk.ru>
+
+ PR 22245
+ * bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that
+ undergoes default promotion.
+ * bfd-in2.h: Regenerate.
+
+2017-09-28 Alan Modra <amodra@gmail.com>
+
+ PR 22220
+ * elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
+ a case where plugin_notice isn't called.
+
+2017-09-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/22199
+ * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass
+ output_bfd to info->callbacks->minfo.
+
+2017-09-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/22170
+ * elf32-i386.c (elf_i386_get_synthetic_symtab): Guard against
+ corrupted PLT.
+ * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
+
+2017-09-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/22163
+ * elf32-i386.c (elf_i386_get_synthetic_symtab): Also return -1
+ if bfd_canonicalize_dynamic_reloc returns 0.
+ * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
+
+2017-09-21 Nick Clifton <nickc@redhat.com>
+
+ * development.sh (development): Revert previous delta.
+
+2017-09-20 Nick Clifton <nickc@redhat.com>
+
+ * development.sh (development): Set to false.
+
2017-09-19 Nick Clifton <nickc@redhat.com>
2.29.1 Release
map = new_map;
}
- if (strcmp (syms[src_count]->name, "__gnu_lto_slim") == 0)
+ if (syms[src_count]->name[0] == '_'
+ && syms[src_count]->name[1] == '_'
+ && strcmp (syms[src_count]->name
+ + (syms[src_count]->name[2] == '_'),
+ "__gnu_lto_slim") == 0)
_bfd_error_handler
(_("%B: plugin needed to handle lto object"),
current);
bfd_error_type bfd_get_error (void);
-void bfd_set_error (bfd_error_type error_tag, ...);
+void bfd_set_error (int error_tag, ...);
const char *bfd_errmsg (bfd_error_type error_tag);
bfd_set_error
SYNOPSIS
- void bfd_set_error (bfd_error_type error_tag, ...);
+ void bfd_set_error (int error_tag, ...);
DESCRIPTION
Set the BFD error condition to be @var{error_tag}.
*/
void
-bfd_set_error (bfd_error_type error_tag, ...)
+bfd_set_error (int error_tag, ...)
{
bfd_error = error_tag;
if (error_tag == bfd_error_on_input)
static const char *_bfd_error_program_name;
-/* This macro and _doprnt taken from libiberty _doprnt.c, tidied a
- little and extended to handle '%A' and '%B'. 'L' as a modifer for
- integer formats is used for bfd_vma and bfd_size_type args, which
- vary in size depending on BFD configuration. */
+/* Support for positional parameters. */
-#define PRINT_TYPE(TYPE) \
+union _bfd_doprnt_args
+{
+ int i;
+ long l;
+ long long ll;
+ double d;
+ long double ld;
+ void *p;
+ enum
+ {
+ Int,
+ Long,
+ LongLong,
+ Double,
+ LongDouble,
+ Ptr
+ } type;
+};
+
+/* This macro and _bfd_doprnt taken from libiberty _doprnt.c, tidied a
+ little and extended to handle '%A', '%B' and positional parameters.
+ 'L' as a modifer for integer formats is used for bfd_vma and
+ bfd_size_type args, which vary in size depending on BFD
+ configuration. */
+
+#define PRINT_TYPE(TYPE, FIELD) \
do \
{ \
- TYPE value = va_arg (ap, TYPE); \
+ TYPE value = (TYPE) args[arg_no].FIELD; \
result = fprintf (stream, specifier, value); \
} while (0)
static int
-_doprnt (FILE *stream, const char *format, va_list ap)
+_bfd_doprnt (FILE *stream, const char *format, union _bfd_doprnt_args *args)
{
const char *ptr = format;
char specifier[128];
int total_printed = 0;
+ unsigned int arg_count = 0;
while (*ptr != '\0')
{
result = fprintf (stream, "%s", ptr);
ptr += result;
}
+ else if (ptr[1] == '%')
+ {
+ fputc ('%', stream);
+ result = 1;
+ ptr += 2;
+ }
else
{
/* We have a format specifier! */
char *sptr = specifier;
int wide_width = 0, short_width = 0;
+ unsigned int arg_no;
/* Copy the % and move forward. */
*sptr++ = *ptr++;
+ /* Check for a positional parameter. */
+ arg_no = -1u;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_no = *ptr - '1';
+ ptr += 2;
+ }
+
/* Move past flags. */
while (strchr ("-+ #0", *ptr))
*sptr++ = *ptr++;
if (*ptr == '*')
{
- int value = abs (va_arg (ap, int));
- sptr += sprintf (sptr, "%d", value);
+ int value;
+ unsigned int arg_index;
+
ptr++;
+ arg_index = arg_count;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_index = *ptr - '1';
+ ptr += 2;
+ }
+ value = abs (args[arg_index].i);
+ arg_count++;
+ sptr += sprintf (sptr, "%d", value);
}
else
/* Handle explicit numeric value. */
while (ISDIGIT (*ptr))
*sptr++ = *ptr++;
+ /* Precision. */
if (*ptr == '.')
{
/* Copy and go past the period. */
*sptr++ = *ptr++;
if (*ptr == '*')
{
- int value = abs (va_arg (ap, int));
- sptr += sprintf (sptr, "%d", value);
+ int value;
+ unsigned int arg_index;
+
ptr++;
+ arg_index = arg_count;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_index = *ptr - '1';
+ ptr += 2;
+ }
+ value = abs (args[arg_index].i);
+ arg_count++;
+ sptr += sprintf (sptr, "%d", value);
}
else
/* Handle explicit numeric value. */
/* Copy the type specifier, and NULL terminate. */
*sptr++ = *ptr++;
*sptr = '\0';
+ if ((int) arg_no < 0)
+ arg_no = arg_count;
switch (ptr[-1])
{
as an int and trust the C library printf to cast it
to the right width. */
if (short_width)
- PRINT_TYPE (int);
+ PRINT_TYPE (int, i);
else
{
/* L modifier for bfd_vma or bfd_size_type may be
either long long or long. */
- if (sptr[-2] == 'L')
+ if (ptr[-2] == 'L')
{
sptr[-2] = 'l';
if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
switch (wide_width)
{
case 0:
- PRINT_TYPE (int);
+ PRINT_TYPE (int, i);
break;
case 1:
- PRINT_TYPE (long);
+ PRINT_TYPE (long, l);
break;
case 2:
default:
*sptr = '\0';
#endif
#if defined (__GNUC__) || defined (HAVE_LONG_LONG)
- PRINT_TYPE (long long);
+ PRINT_TYPE (long long, ll);
#else
/* Fake it and hope for the best. */
- PRINT_TYPE (long);
+ PRINT_TYPE (long, l);
#endif
break;
}
case 'G':
{
if (wide_width == 0)
- PRINT_TYPE (double);
+ PRINT_TYPE (double, d);
else
{
#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
- PRINT_TYPE (long double);
+ PRINT_TYPE (long double, ld);
#else
/* Fake it and hope for the best. */
- PRINT_TYPE (double);
+ PRINT_TYPE (double, d);
#endif
}
}
break;
case 's':
- PRINT_TYPE (char *);
+ PRINT_TYPE (char *, p);
break;
case 'p':
- PRINT_TYPE (void *);
- break;
- case '%':
- fputc ('%', stream);
- result = 1;
+ PRINT_TYPE (void *, p);
break;
case 'A':
{
- asection *sec = va_arg (ap, asection *);
+ asection *sec;
bfd *abfd;
const char *group = NULL;
struct coff_comdat_info *ci;
+ sec = (asection *) args[arg_no].p;
if (sec == NULL)
/* Invoking %A with a null section pointer is an
internal error. */
break;
case 'B':
{
- bfd *abfd = va_arg (ap, bfd *);
+ bfd *abfd;
+ abfd = (bfd *) args[arg_no].p;
if (abfd == NULL)
/* Invoking %B with a null bfd pointer is an
internal error. */
default:
abort();
}
+ arg_count++;
}
if (result == -1)
return -1;
return total_printed;
}
+/* First pass over FORMAT to gather ARGS. Returns number of args. */
+
+static unsigned int
+_bfd_doprnt_scan (const char *format, union _bfd_doprnt_args *args)
+{
+ const char *ptr = format;
+ unsigned int arg_count = 0;
+
+ while (*ptr != '\0')
+ {
+ if (*ptr != '%')
+ {
+ ptr = strchr (ptr, '%');
+ if (ptr == NULL)
+ break;
+ }
+ else if (ptr[1] == '%')
+ ptr += 2;
+ else
+ {
+ int wide_width = 0, short_width = 0;
+ unsigned int arg_no;
+
+ ptr++;
+
+ /* Check for a positional parameter. */
+ arg_no = -1u;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_no = *ptr - '1';
+ ptr += 2;
+ }
+
+ /* Move past flags. */
+ while (strchr ("-+ #0", *ptr))
+ ptr++;
+
+ if (*ptr == '*')
+ {
+ unsigned int arg_index;
+
+ ptr++;
+ arg_index = arg_count;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_index = *ptr - '1';
+ ptr += 2;
+ }
+ if (arg_index >= 9)
+ abort ();
+ args[arg_index].type = Int;
+ arg_count++;
+ }
+ else
+ /* Handle explicit numeric value. */
+ while (ISDIGIT (*ptr))
+ ptr++;
+
+ /* Precision. */
+ if (*ptr == '.')
+ {
+ ptr++;
+ if (*ptr == '*')
+ {
+ unsigned int arg_index;
+
+ ptr++;
+ arg_index = arg_count;
+ if (*ptr != '0' && ISDIGIT (*ptr) && ptr[1] == '$')
+ {
+ arg_index = *ptr - '1';
+ ptr += 2;
+ }
+ if (arg_index >= 9)
+ abort ();
+ args[arg_index].type = Int;
+ arg_count++;
+ }
+ else
+ /* Handle explicit numeric value. */
+ while (ISDIGIT (*ptr))
+ ptr++;
+ }
+ while (strchr ("hlL", *ptr))
+ {
+ switch (*ptr)
+ {
+ case 'h':
+ short_width = 1;
+ break;
+ case 'l':
+ wide_width++;
+ break;
+ case 'L':
+ wide_width = 2;
+ break;
+ default:
+ abort();
+ }
+ ptr++;
+ }
+
+ ptr++;
+ if ((int) arg_no < 0)
+ arg_no = arg_count;
+
+ if (arg_no >= 9)
+ abort ();
+ switch (ptr[-1])
+ {
+ case 'd':
+ case 'i':
+ case 'o':
+ case 'u':
+ case 'x':
+ case 'X':
+ case 'c':
+ {
+ if (short_width)
+ args[arg_no].type = Int;
+ else
+ {
+ if (ptr[-2] == 'L')
+ {
+ if (BFD_ARCH_SIZE < 64 || BFD_HOST_64BIT_LONG)
+ wide_width = 1;
+ }
+
+ switch (wide_width)
+ {
+ case 0:
+ args[arg_no].type = Int;
+ break;
+ case 1:
+ args[arg_no].type = Long;
+ break;
+ case 2:
+ default:
+#if defined (__GNUC__) || defined (HAVE_LONG_LONG)
+ args[arg_no].type = LongLong;
+#else
+ args[arg_no].type = Long;
+#endif
+ break;
+ }
+ }
+ }
+ break;
+ case 'f':
+ case 'e':
+ case 'E':
+ case 'g':
+ case 'G':
+ {
+ if (wide_width == 0)
+ args[arg_no].type = Double;
+ else
+ {
+#if defined (__GNUC__) || defined (HAVE_LONG_DOUBLE)
+ args[arg_no].type = LongDouble;
+#else
+ args[arg_no].type = Double;
+#endif
+ }
+ }
+ break;
+ case 's':
+ case 'p':
+ case 'A':
+ case 'B':
+ args[arg_no].type = Ptr;
+ break;
+ default:
+ abort();
+ }
+ arg_count++;
+ }
+ }
+
+ return arg_count;
+}
+
/* This is the default routine to handle BFD error messages.
Like fprintf (stderr, ...), but also handles some extra format specifiers.
- %A section name from section. For group components, print group name too.
- %B file name from bfd. For archive components, prints archive too. */
+ %A section name from section. For group components, prints group name too.
+ %B file name from bfd. For archive components, prints archive too.
+
+ Beware: Only supports a maximum of 9 format arguments. */
static void
error_handler_internal (const char *fmt, va_list ap)
{
+ int i, arg_count;
+ union _bfd_doprnt_args args[9];
+
+ arg_count = _bfd_doprnt_scan (fmt, args);
+ for (i = 0; i < arg_count; i++)
+ {
+ switch (args[i].type)
+ {
+ case Int:
+ args[i].i = va_arg (ap, int);
+ break;
+ case Long:
+ args[i].l = va_arg (ap, long);
+ break;
+ case LongLong:
+ args[i].ll = va_arg (ap, long long);
+ break;
+ case Double:
+ args[i].d = va_arg (ap, double);
+ break;
+ case LongDouble:
+ args[i].ld = va_arg (ap, long double);
+ break;
+ case Ptr:
+ args[i].p = va_arg (ap, void *);
+ break;
+ default:
+ abort ();
+ }
+ }
+
/* PR 4992: Don't interrupt output being sent to stdout. */
fflush (stdout);
else
fprintf (stderr, "BFD: ");
- _doprnt (stderr, fmt, ap);
+ _bfd_doprnt (stderr, fmt, args);
/* On AIX, putc is implemented as a macro that triggers a -Wunused-value
warning, so use the fputc function to avoid it. */
return TRUE;
}
#define ELF_ARCH bfd_arch_frv
-#define ELF_TARGET_ID FRV_ELF_DATA
#define ELF_MACHINE_CODE EM_CYGNUS_FRV
#define ELF_MAXPAGESIZE 0x1000
#include "elf32-target.h"
+#undef ELF_TARGET_ID
+#define ELF_TARGET_ID FRV_ELF_DATA
#undef ELF_MAXPAGESIZE
#define ELF_MAXPAGESIZE 0x4000
#define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol
#define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol
#define elf_backend_check_relocs elf32_hppa_check_relocs
+#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible
#define elf_backend_create_dynamic_sections elf32_hppa_create_dynamic_sections
#define elf_backend_fake_sections elf_hppa_fake_sections
#define elf_backend_relocate_section elf32_hppa_relocate_section
dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf,
dynsyms);
- if (dynrelcount < 0)
+ if (dynrelcount <= 0)
return -1;
/* Sort the relocs by address. */
size += sizeof ("+0x") - 1 + 8;
n++;
s++;
+ /* There should be only one entry in PLT for a given
+ symbol. Set howto to NULL after processing a PLT
+ entry to guard against corrupted PLT. */
+ p->howto = NULL;
}
offset += plt_entry_size;
}
#define elf_backend_relocate_section ppc_elf_relocate_section
#define elf_backend_create_dynamic_sections ppc_elf_create_dynamic_sections
#define elf_backend_check_relocs ppc_elf_check_relocs
+#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible
#define elf_backend_copy_indirect_symbol ppc_elf_copy_indirect_symbol
#define elf_backend_adjust_dynamic_symbol ppc_elf_adjust_dynamic_symbol
#define elf_backend_add_symbol_hook ppc_elf_add_symbol_hook
#define elf_backend_notice_as_needed ppc64_elf_notice_as_needed
#define elf_backend_archive_symbol_lookup ppc64_elf_archive_symbol_lookup
#define elf_backend_check_relocs ppc64_elf_check_relocs
+#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible
#define elf_backend_gc_keep ppc64_elf_gc_keep
#define elf_backend_gc_mark_dynamic_ref ppc64_elf_gc_mark_dynamic_ref
#define elf_backend_gc_mark_hook ppc64_elf_gc_mark_hook
if (SYMBOL_REFERENCES_LOCAL (info, h))
{
info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
- output_bfd,
h->root.root.string,
h->root.u.def.section->owner);
dynrelcount = bfd_canonicalize_dynamic_reloc (abfd, dynrelbuf,
dynsyms);
- if (dynrelcount < 0)
+ if (dynrelcount <= 0)
return -1;
/* Sort the relocs by address. */
size += sizeof ("+0x") - 1 + 8 + 8 * ABI_64_P (abfd);
n++;
s++;
+ /* There should be only one entry in PLT for a given
+ symbol. Set howto to NULL after processing a PLT
+ entry to guard against corrupted PLT. */
+ p->howto = NULL;
}
offset += plt_entry_size;
}
if (pold_weak)
*pold_weak = oldweak;
- /* This code is for coping with dynamic objects, and is only useful
- if we are doing an ELF link. */
- if (!(*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
- return TRUE;
-
/* We have to check it for every instance since the first few may be
references and not all compilers emit symbol type for undefined
symbols. */
olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0;
}
+ /* Handle a case where plugin_notice won't be called and thus won't
+ set the non_ir_ref flags on the first pass over symbols. */
+ if (oldbfd != NULL
+ && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN)
+ && newdyn != olddyn)
+ {
+ h->root.non_ir_ref_dynamic = TRUE;
+ hi->root.non_ir_ref_dynamic = TRUE;
+ }
+
/* NEWDEF and OLDDEF indicate whether the new or old symbol,
respectively, appear to be a definition rather than reference. */
(_("error: %B: size of section %A is not "
"multiple of address size"),
input_bfd, o);
- bfd_set_error (bfd_error_on_input);
+ bfd_set_error (bfd_error_bad_value);
return FALSE;
}
o->flags |= SEC_ELF_REVERSE_COPY;
asection *o;
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
+ || elf_object_id (sub) != elf_hash_table_id (elf_hash_table (info))
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
continue;
o = sub->sections;
asection *o;
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
+ || elf_object_id (sub) != elf_hash_table_id (htab)
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
continue;
{
row = COMMON_ROW;
if (!bfd_link_relocatable (info)
- && strcmp (name, "__gnu_lto_slim") == 0)
+ && name[0] == '_'
+ && name[1] == '_'
+ && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
_bfd_error_handler
(_("%B: plugin needed to handle lto object"), abfd);
}
-#define BFD_VERSION_DATE 20170919
+#define BFD_VERSION_DATE 20171107
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ * nm.c (filter_symbols): Match "__gnu_lto_slim" optionally prefixed
+ with "_".
+
+2017-09-21 Maciej W. Rozycki <macro@imgtec.com>
+
+ * readelf.c (get_machine_flags) <E_MIPS_MACH_5900>: New case.
+
2017-09-15 Nick Clifton <nickc@redhat.com>
2.29.1 Release
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
- if (strcmp (sym->name, "__gnu_lto_slim") == 0)
+ if (sym->name[0] == '_'
+ && sym->name[1] == '_'
+ && strcmp (sym->name + (sym->name[2] == '_'), "__gnu_lto_slim") == 0)
non_fatal (_("%s: plugin needed to handle lto object"),
bfd_get_filename (abfd));
case E_MIPS_MACH_4650: strcat (buf, ", 4650"); break;
case E_MIPS_MACH_5400: strcat (buf, ", 5400"); break;
case E_MIPS_MACH_5500: strcat (buf, ", 5500"); break;
+ case E_MIPS_MACH_5900: strcat (buf, ", 5900"); break;
case E_MIPS_MACH_SB1: strcat (buf, ", sb1"); break;
case E_MIPS_MACH_9000: strcat (buf, ", 9000"); break;
case E_MIPS_MACH_LS2E: strcat (buf, ", loongson-2e"); break;
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ PR 22348
+ * config/tc-crx.c (instruction, output_opcode): Make static.
+ (relocatable, ins_parse, cur_arg_num): Likewise.
+ (parse_insn): Adjust for renamed opcodes globals.
+ (check_range): Likewise
+
+2017-09-21 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/gas/mips/elf_mach_5900.d: New test.
+ * testsuite/gas/mips/mips.exp: Run it.
+
2017-09-15 Nick Clifton <nickc@redhat.com>
2.29.1 Release
/* CRX coprocessor registers hash table. */
static struct hash_control *copreg_hash;
/* Current instruction we're assembling. */
-const inst *instruction;
+static const inst *instruction;
/* Global variables. */
/* Array to hold an instruction encoding. */
-long output_opcode[2];
+static long output_opcode[2];
/* Nonzero means a relocatable symbol. */
-int relocatable;
+static int relocatable;
/* A copy of the original instruction (used in error messages). */
-char ins_parse[MAX_INST_LEN];
+static char ins_parse[MAX_INST_LEN];
/* The current processed argument number. */
-int cur_arg_num;
+static int cur_arg_num;
/* Generic assembler global variables which must be defined by all targets. */
int i;
/* Handle instructions with no operands. */
- for (i = 0; no_op_insn[i] != NULL; i++)
+ for (i = 0; crx_no_op_insn[i] != NULL; i++)
{
- if (streq (no_op_insn[i], instruction->mnemonic))
+ if (streq (crx_no_op_insn[i], instruction->mnemonic))
{
insn->nargs = 0;
return;
: instruction->flags & DISPUD4 ? 4
: 0);
- for (bin = 0; bin < cst4_maps; bin++)
+ for (bin = 0; bin < crx_cst4_maps; bin++)
{
if (value == mul * bin)
{
{
int is_cst4 = 0;
- for (bin = 0; bin < cst4_maps; bin++)
+ for (bin = 0; bin < crx_cst4_maps; bin++)
{
- if (value == (uint32_t) cst4_map[bin])
+ if (value == (uint32_t) crx_cst4_map[bin])
{
is_cst4 = 1;
if (update)
--- /dev/null
+#readelf: -Ah
+#name: ELF R5900 markings
+#as: -32 -march=r5900
+#source: empty.s
+
+ELF Header:
+#...
+ Flags: +0x..92...., .*5900.*
+#...
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS3
+GPR size: 32
+CPR1 size: 32
+CPR2 size: 0
+FP ABI: .*
+ISA Extension: Toshiba R5900
+ASEs:
+ None
+FLAGS 1: .*
+FLAGS 2: .*
run_dump_test "elf_ase_micromips-2"
# Verify that machine markings are handled properly.
+ run_dump_test "elf_mach_5900"
run_dump_test "elf_mach_interaptiv-mr2"
run_dump_test "mips-gp32-fp32-pic"
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ * symtab.cc (Symbol_table::add_from_relobj): Match "__gnu_lto_slim"
+ optionally prefixed with "_".
+
+2017-10-18 Kyle Butt <iteratee@google.com>
+ Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Target_powerpc::Scan::local): Correct dst_off
+ calculation for TOC16 relocs.
+ (Target_powerpc::Scan::global): Likewise.
+
+2017-09-28 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Target_powerpc<64,*>::powerpc_info): Set
+ is_default_stack_executable false.
+
+2017-08-03 James Clarke <jrtc27@jrtc27.com>
+
+ * options.h (General_options): Set a non-NULL second help string
+ argument for relax to allow --no-relax.
+
+2017-09-20 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Target_powerpc::Branch_info::make_stub): Put
+ stubs for ppc32 non-branch relocs in first stub table.
+ (Target_powerpc::Relocate::relocate): Resolve similarly.
+
2017-09-19 Alan Modra <amodra@gmail.com>
* options.h (stub-group-multi): Default to true. Add
N_("Generate relocatable output"), NULL);
DEFINE_bool(relax, options::TWO_DASHES, '\0', false,
- N_("Relax branches on certain targets"), NULL);
+ N_("Relax branches on certain targets"),
+ N_("Do not relax branches"));
DEFINE_string(retain_symbols_file, options::TWO_DASHES, '\0', NULL,
N_("keep only symbols listed in this file"), N_("FILE"));
false, // has_make_symbol
true, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/usr/lib/ld.so.1", // dynamic_linker
false, // has_make_symbol
true, // has_resolve
false, // has_code_fill
- true, // is_default_stack_executable
+ false, // is_default_stack_executable
false, // can_icf_inline_merge_sections
'\0', // wrap_char
"/usr/lib/ld.so.1", // dynamic_linker
target->glink_section()->add_global_entry(gsym);
else
{
- if (stub_table == NULL)
+ if (stub_table == NULL
+ && !(size == 32
+ && gsym != NULL
+ && !parameters->options().output_is_position_independent()
+ && !is_branch_reloc(this->r_type_)))
stub_table = this->object_->stub_table(this->shndx_);
if (stub_table == NULL)
{
- // This is a ref from a data section to an ifunc symbol.
+ // This is a ref from a data section to an ifunc symbol,
+ // or a non-branch reloc for which we always want to use
+ // one set of stubs for resolving function addresses.
stub_table = ifunc_stub_table;
}
gold_assert(stub_table != NULL);
shndx = ppc_object->adjust_sym_shndx(r_sym, shndx, &is_ordinary);
if (is_ordinary && shndx == ppc_object->toc_shndx())
{
- Address dst_off = lsym.get_st_value() + reloc.get_r_offset();
+ Address dst_off = lsym.get_st_value() + reloc.get_r_addend();
if (dst_off < ppc_object->section_size(shndx))
{
bool ok = false;
if (shndx == sym_object->toc_shndx())
{
Sized_symbol<size>* sym = symtab->get_sized_symbol<size>(gsym);
- Address dst_off = sym->value() + reloc.get_r_offset();
+ Address dst_off = sym->value() + reloc.get_r_addend();
if (dst_off < sym_object->section_size(shndx))
{
bool ok = false;
}
else
{
- Stub_table<size, big_endian>* stub_table
- = object->stub_table(relinfo->data_shndx);
+ Stub_table<size, big_endian>* stub_table = NULL;
+ if (target->stub_tables().size() == 1)
+ stub_table = target->stub_tables()[0];
+ if (stub_table == NULL
+ && !(size == 32
+ && gsym != NULL
+ && !parameters->options().output_is_position_independent()
+ && !is_branch_reloc(r_type)))
+ stub_table = object->stub_table(relinfo->data_shndx);
if (stub_table == NULL)
{
- // This is a ref from a data section to an ifunc symbol.
+ // This is a ref from a data section to an ifunc symbol,
+ // or a non-branch reloc for which we always want to use
+ // one set of stubs for resolving function addresses.
if (target->stub_tables().size() != 0)
stub_table = target->stub_tables()[0];
}
const char* name = sym_names + st_name;
if (!parameters->options().relocatable()
- && strcmp (name, "__gnu_lto_slim") == 0)
+ && name[0] == '_'
+ && name[1] == '_'
+ && strcmp (name + (name[2] == '_'), "__gnu_lto_slim") == 0)
gold_info(_("%s: plugin needed to handle lto object"),
relobj->name().c_str());
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ PR 22348
+ * opcode/cr16.h (instruction): Delete.
+ (cr16_words, cr16_allWords, cr16_currInsn): Delete.
+ * opcode/crx.h (crx_cst4_map): Rename from cst4_map.
+ (crx_cst4_maps): Rename from cst4_maps.
+ (crx_no_op_insn): Rename from no_op_insn.
+ (instruction): Delete.
+
2017-07-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
/* Table of instructions with no operands. */
extern const char * cr16_no_op_insn[];
-/* Current instruction we're assembling. */
-extern const inst *instruction;
-
/* A macro for representing the instruction "constant" opcode, that is,
the FIXED part of the instruction. The "constant" opcode is represented
as a 32-bit unsigned long, where OPC is expanded (by a left SHIFT)
typedef unsigned long dwordU;
typedef unsigned short wordU;
-/* Globals to store opcode data and build the instruction. */
-extern wordU cr16_words[3];
-extern ULONGLONG cr16_allWords;
-extern ins cr16_currInsn;
-
/* Prototypes for function in cr16-dis.c. */
extern void cr16_make_instruction (void);
extern int cr16_match_opcode (void);
#define NUMTRAPS crx_num_traps
/* cst4 operand mapping. */
-extern const int cst4_map[];
-extern const int cst4_maps;
+extern const int crx_cst4_map[];
+extern const int crx_cst4_maps;
/* Table of instructions with no operands. */
-extern const char* no_op_insn[];
-
-/* Current instruction we're assembling. */
-extern const inst *instruction;
+extern const char* crx_no_op_insn[];
/* A macro for representing the instruction "constant" opcode, that is,
the FIXED part of the instruction. The "constant" opcode is represented
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ * testsuite/ld-plugin/lto-3r.d: Match "__gnu_lto_v" optionally
+ prefixed with "_".
+ * testsuite/ld-plugin/lto-5r.d: Likewise.
+
+2017-09-28 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-plugin/pr22220.h,
+ * testsuite/ld-plugin/pr22220lib.cc,
+ * testsuite/ld-plugin/pr22220lib.ver,
+ * testsuite/ld-plugin/pr22220main.cc: New test.
+ * testsuite/ld-plugin/lto.exp: Run it.
+
2017-09-19 Nick Clifton <nickc@redhat.com>
2.29.1 Release
#nm: -p
#...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
#pass
#nm: -p
#...
-[0-9a-f]+ C __gnu_lto_v.*
+[0-9a-f]+ C _?__gnu_lto_v.*
#pass
[list "Build pr21382.so" \
"-shared" "-O2 -fpic" \
{pr21382b.c} {} "pr21382.so" "c"] \
+ [list {Build pr22220lib.so} \
+ {-shared -Wl,--version-script=pr22220lib.ver} {-fPIC} \
+ {pr22220lib.cc} {} {pr22220lib.so} {c++}] \
+ [list {Build pr22220main.o} \
+ {} {-flto} \
+ {pr22220main.cc} {} {} {c++}] \
]
# Check final symbols in executables.
[list "Run pr21382" \
"-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr21382a.o tmpdir/pr21382.so" "" \
{dummy.c} "pr21382.exe" "pass.out" "" "c"] \
+ [list {pr22220a} \
+ {-flto -fuse-linker-plugin tmpdir/pr22220main.o tmpdir/pr22220lib.so} {} \
+ {dummy.c} {pr22220a.exe} {pass.out} {} {c++}] \
+ [list {pr22220b} \
+ {-flto -fuse-linker-plugin -Wl,--no-as-needed tmpdir/pr22220lib.so tmpdir/pr22220main.o} {} \
+ {dummy.c} {pr22220b.exe} {pass.out} {} {c++}] \
]
# LTO run-time tests for ELF
--- /dev/null
+extern int doo();
+
+inline int *goo() {
+ static int xyz;
+ return &xyz;
+}
+
+int *boo();
--- /dev/null
+#include "pr22220.h"
+
+int* boo()
+{
+ return goo ();
+}
--- /dev/null
+BAR { global: *; };
--- /dev/null
+#include <stdio.h>
+#include "pr22220.h"
+
+int main()
+{
+ if (boo() == goo())
+ {
+ printf ("PASS\n");
+ return 0;
+ }
+ return 1;
+}
+2017-11-01 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2017-10-25 Alan Modra <amodra@gmail.com>
+ PR 22348
+ * cr16-dis.c (cr16_cinvs, instruction, cr16_currInsn): Make static.
+ (cr16_words, cr16_allWords, processing_argument_number): Likewise.
+ (imm4flag, size_changed): Likewise.
+ * crx-dis.c (crx_cinvs, NUMCINVS, instruction, currInsn): Likewise.
+ (words, allWords, processing_argument_number): Likewise.
+ (cst4flag, size_changed): Likewise.
+ * crx-opc.c (crx_cst4_map): Rename from cst4_map.
+ (crx_cst4_maps): Rename from cst4_maps.
+ (crx_no_op_insn): Rename from no_op_insn.
+
2017-09-15 Nick Clifton <nickc@redhat.com>
2.29.1 Release
cinv_entry;
/* CR16 'cinv' options mapping. */
-const cinv_entry cr16_cinvs[] =
+static const cinv_entry cr16_cinvs[] =
{
{"cinv[i]", "cinv [i]"},
{"cinv[i,u]", "cinv [i,u]"},
REG_ARG_TYPE;
/* Current opcode table entry we're disassembling. */
-const inst *instruction;
+static const inst *instruction;
/* Current instruction we're disassembling. */
-ins cr16_currInsn;
+static ins cr16_currInsn;
/* The current instruction is read into 3 consecutive words. */
-wordU cr16_words[3];
+static wordU cr16_words[3];
/* Contains all words in appropriate order. */
-ULONGLONG cr16_allWords;
+static ULONGLONG cr16_allWords;
/* Holds the current processed argument number. */
-int processing_argument_number;
+static int processing_argument_number;
/* Nonzero means a IMM4 instruction. */
-int imm4flag;
+static int imm4flag;
/* Nonzero means the instruction's original size is
incremented (escape sequence is used). */
-int size_changed;
+static int size_changed;
/* Print the constant expression length. */
cinv_entry;
/* CRX 'cinv' options. */
-const cinv_entry crx_cinvs[] =
+static const cinv_entry crx_cinvs[] =
{
{"[i]", 2}, {"[i,u]", 3}, {"[d]", 4}, {"[d,u]", 5},
{"[d,i]", 6}, {"[d,i,u]", 7}, {"[b]", 8},
REG_ARG_TYPE;
/* Number of valid 'cinv' instruction options. */
-int NUMCINVS = ((sizeof crx_cinvs)/(sizeof crx_cinvs[0]));
+static int NUMCINVS = ((sizeof crx_cinvs)/(sizeof crx_cinvs[0]));
/* Current opcode table entry we're disassembling. */
-const inst *instruction;
+static const inst *instruction;
/* Current instruction we're disassembling. */
-ins currInsn;
+static ins currInsn;
/* The current instruction is read into 3 consecutive words. */
-wordU words[3];
+static wordU words[3];
/* Contains all words in appropriate order. */
-ULONGLONG allWords;
+static ULONGLONG allWords;
/* Holds the current processed argument number. */
-int processing_argument_number;
+static int processing_argument_number;
/* Nonzero means a CST4 instruction. */
-int cst4flag;
+static int cst4flag;
/* Nonzero means the instruction's original size is
incremented (escape sequence is used). */
-int size_changed;
+static int size_changed;
static int get_number_of_operands (void);
static argtype getargtype (operand_type);
Example (for N=5):
cst4_map[5]=-4 -->> 5 */
-const int cst4_map[] =
+const int crx_cst4_map[] =
{
0, 1, 2, 3, 4, -4, -1, 7, 8, 16, 32, 20, 12, 48
};
-const int cst4_maps = ARRAY_SIZE (cst4_map);
+const int crx_cst4_maps = ARRAY_SIZE (crx_cst4_map);
/* CRX instructions that don't have arguments. */
-const char* no_op_insn[] =
+const char* crx_no_op_insn[] =
{
"di", "ei", "eiwait", "nop", "retx", "wait", NULL
};